From 7a5d6818a3136e09bea50aaa0a131ebc355cb101 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Fri, 18 Dec 2015 12:54:19 +0200 Subject: [PATCH] cql3: Move update_statement implementation to source file --- cql3/statements/update_statement.cc | 28 ++++++++++++++++++++++++++++ cql3/statements/update_statement.hh | 21 ++++----------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/cql3/statements/update_statement.cc b/cql3/statements/update_statement.cc index 4db72837c0..d813db33b9 100644 --- a/cql3/statements/update_statement.cc +++ b/cql3/statements/update_statement.cc @@ -48,6 +48,14 @@ namespace cql3 { namespace statements { +update_statement::update_statement(statement_type type, uint32_t bound_terms, schema_ptr s, std::unique_ptr attrs) + : modification_statement{type, bound_terms, std::move(s), std::move(attrs)} +{ } + +bool update_statement::require_full_clustering_key() const { + return true; +} + void update_statement::add_update_for_key(mutation& m, const exploded_clustering_prefix& prefix, const update_parameters& params) { if (s->is_dense()) { if (!prefix || (prefix.size() == 1 && prefix.components().front().empty())) { @@ -100,6 +108,16 @@ void update_statement::add_update_for_key(mutation& m, const exploded_clustering #endif } +update_statement::parsed_insert::parsed_insert(::shared_ptr name, + ::shared_ptr attrs, + std::vector<::shared_ptr> column_names, + std::vector<::shared_ptr> column_values, + bool if_not_exists) + : modification_statement::parsed{std::move(name), std::move(attrs), conditions_vector{}, if_not_exists, false} + , _column_names{std::move(column_names)} + , _column_values{std::move(column_values)} +{ } + ::shared_ptr update_statement::parsed_insert::prepare_internal(database& db, schema_ptr schema, ::shared_ptr bound_names, std::unique_ptr attrs) @@ -148,6 +166,16 @@ update_statement::parsed_insert::prepare_internal(database& db, schema_ptr schem return stmt; } +update_statement::parsed_update::parsed_update(::shared_ptr name, + ::shared_ptr attrs, + std::vector, ::shared_ptr>> updates, + std::vector where_clause, + conditions_vector conditions) + : modification_statement::parsed(std::move(name), std::move(attrs), std::move(conditions), false, false) + , _updates(std::move(updates)) + , _where_clause(std::move(where_clause)) +{ } + ::shared_ptr update_statement::parsed_update::prepare_internal(database& db, schema_ptr schema, ::shared_ptr bound_names, std::unique_ptr attrs) diff --git a/cql3/statements/update_statement.hh b/cql3/statements/update_statement.hh index f2b481dce8..9cafb1fb75 100644 --- a/cql3/statements/update_statement.hh +++ b/cql3/statements/update_statement.hh @@ -64,14 +64,9 @@ public: private static final Constants.Value EMPTY = new Constants.Value(ByteBufferUtil.EMPTY_BYTE_BUFFER); #endif - update_statement(statement_type type, uint32_t bound_terms, schema_ptr s, std::unique_ptr attrs) - : modification_statement{type, bound_terms, std::move(s), std::move(attrs)} - { } - + update_statement(statement_type type, uint32_t bound_terms, schema_ptr s, std::unique_ptr attrs); private: - virtual bool require_full_clustering_key() const override { - return true; - } + virtual bool require_full_clustering_key() const override; virtual void add_update_for_key(mutation& m, const exploded_clustering_prefix& prefix, const update_parameters& params) override; public: @@ -92,11 +87,7 @@ public: ::shared_ptr attrs, std::vector<::shared_ptr> column_names, std::vector<::shared_ptr> column_values, - bool if_not_exists) - : modification_statement::parsed{std::move(name), std::move(attrs), conditions_vector{}, if_not_exists, false} - , _column_names{std::move(column_names)} - , _column_values{std::move(column_values)} - { } + bool if_not_exists); virtual ::shared_ptr prepare_internal(database& db, schema_ptr schema, ::shared_ptr bound_names, std::unique_ptr attrs) override; @@ -122,11 +113,7 @@ public: ::shared_ptr attrs, std::vector, ::shared_ptr>> updates, std::vector where_clause, - conditions_vector conditions) - : modification_statement::parsed(std::move(name), std::move(attrs), std::move(conditions), false, false) - , _updates(std::move(updates)) - , _where_clause(std::move(where_clause)) - { } + conditions_vector conditions); protected: virtual ::shared_ptr prepare_internal(database& db, schema_ptr schema, ::shared_ptr bound_names, std::unique_ptr attrs);