The class is repurposed to be more generic and also be able
to hold additional metadata related to function calls within
a CQL statement. Rename all methods appropriately.
Visitor functions in AST nodes (`collect_marker_specification`)
are also renamed to a more generic `collect_prepare_metadata`.
The name `raw_prepare_metadata` designates that this metadata
structure is a byproduct of `stmt::raw::prepare()` call and
is needed only for "prepare" step of query execution.
Signed-off-by: Pavel Solodovnikov <
pa.solo...@scylladb.com>
---
CMakeLists.txt | 2 +-
configure.py | 2 +-
cql3/abstract_marker.cc | 6 +--
cql3/abstract_marker.hh | 4 +-
cql3/attributes.cc | 8 ++--
cql3/attributes.hh | 4 +-
cql3/column_condition.cc | 8 ++--
cql3/column_condition.hh | 2 +-
cql3/functions/function_call.hh | 2 +-
cql3/functions/functions.cc | 4 +-
cql3/lists.cc | 8 ++--
cql3/lists.hh | 4 +-
cql3/maps.cc | 8 ++--
cql3/maps.hh | 4 +-
cql3/multi_column_relation.hh | 22 +++++-----
cql3/operation.hh | 6 +--
...cifications.cc => raw_prepare_metadata.cc} | 24 +++++------
...cifications.hh => raw_prepare_metadata.hh} | 26 ++++++------
cql3/relation.hh | 42 +++++++++----------
cql3/restrictions/statement_restrictions.cc | 4 +-
cql3/restrictions/statement_restrictions.hh | 4 +-
cql3/sets.cc | 2 +-
cql3/sets.hh | 2 +-
cql3/single_column_relation.cc | 22 +++++-----
cql3/single_column_relation.hh | 16 +++----
cql3/statements/batch_statement.cc | 12 +++---
cql3/statements/create_view_statement.cc | 2 +-
cql3/statements/delete_statement.cc | 10 ++---
cql3/statements/modification_statement.cc | 20 ++++-----
cql3/statements/modification_statement.hh | 2 +-
cql3/statements/prepared_statement.hh | 6 +--
cql3/statements/raw/delete_statement.hh | 2 +-
cql3/statements/raw/insert_statement.hh | 4 +-
cql3/statements/raw/modification_statement.hh | 6 +--
cql3/statements/raw/parsed_statement.cc | 18 ++++----
cql3/statements/raw/parsed_statement.hh | 8 ++--
cql3/statements/raw/select_statement.hh | 4 +-
cql3/statements/raw/update_statement.hh | 2 +-
cql3/statements/select_statement.cc | 30 ++++++-------
cql3/statements/update_statement.cc | 28 ++++++-------
cql3/term.hh | 6 +--
cql3/token_relation.cc | 18 ++++----
cql3/token_relation.hh | 12 +++---
cql3/tuples.hh | 4 +-
cql3/user_types.cc | 4 +-
cql3/user_types.hh | 2 +-
test/boost/statement_restrictions_test.cc | 4 +-
47 files changed, 220 insertions(+), 220 deletions(-)
rename cql3/{variable_specifications.cc => raw_prepare_metadata.cc} (74%)
rename cql3/{variable_specifications.hh => raw_prepare_metadata.hh} (75%)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2459eac7f0..036875a364 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -410,7 +410,7 @@ set(scylla_sources
cql3/ut_name.cc
cql3/util.cc
cql3/values.cc
- cql3/variable_specifications.cc
+ cql3/raw_prepare_metadata.cc
data/cell.cc
database.cc
db/batchlog_manager.cc
diff --git a/configure.py b/configure.py
index aa973a3e60..8bbf4b54d7 100755
--- a/configure.py
+++ b/configure.py
@@ -843,7 +843,7 @@ scylla_core = (['database.cc',
'cql3/selection/selector.cc',
'cql3/restrictions/statement_restrictions.cc',
'cql3/result_set.cc',
- 'cql3/variable_specifications.cc',
+ 'cql3/raw_prepare_metadata.cc',
'db/consistency_level.cc',
'db/system_keyspace.cc',
'db/virtual_table.cc',
diff --git a/cql3/abstract_marker.cc b/cql3/abstract_marker.cc
index fd20149049..bf98a9b0bd 100644
--- a/cql3/abstract_marker.cc
+++ b/cql3/abstract_marker.cc
@@ -46,7 +46,7 @@
#include "cql3/maps.hh"
#include "cql3/sets.hh"
#include "cql3/user_types.hh"
-#include "cql3/variable_specifications.hh"
+#include "cql3/raw_prepare_metadata.hh"
#include "types/list.hh"
namespace cql3 {
@@ -56,8 +56,8 @@ abstract_marker::abstract_marker(int32_t bind_index, lw_shared_ptr<column_specif
, _receiver{std::move(receiver)}
{ }
-void abstract_marker::collect_marker_specification(variable_specifications& bound_names) const {
- bound_names.add(_bind_index, _receiver);
+void abstract_marker::collect_prepare_metadata(raw_prepare_metadata& meta) const {
+ meta.add_variable_specification(_bind_index, _receiver);
}
bool abstract_marker::contains_bind_marker() const {
diff --git a/cql3/abstract_marker.hh b/cql3/abstract_marker.hh
index 6dc883de8d..8aa16cfc47 100644
--- a/cql3/abstract_marker.hh
+++ b/cql3/abstract_marker.hh
@@ -46,7 +46,7 @@
namespace cql3 {
class column_specification;
-class variable_specifications;
+class raw_prepare_metadata;
/**
* A single bind marker.
@@ -58,7 +58,7 @@ class abstract_marker : public non_terminal {
public:
abstract_marker(int32_t bind_index, lw_shared_ptr<column_specification>&& receiver);
- virtual void collect_marker_specification(variable_specifications& bound_names) const override;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const override;
virtual bool contains_bind_marker() const override;
diff --git a/cql3/attributes.cc b/cql3/attributes.cc
index 13a7eef626..5a02ce84df 100644
--- a/cql3/attributes.cc
+++ b/cql3/attributes.cc
@@ -136,15 +136,15 @@ db::timeout_clock::duration attributes::get_timeout(const query_options& options
return std::chrono::duration_cast<db::timeout_clock::duration>(std::chrono::nanoseconds(duration.nanoseconds));
}
-void attributes::collect_marker_specification(variable_specifications& bound_names) const {
+void attributes::collect_prepare_metadata(raw_prepare_metadata& meta) const {
if (_timestamp) {
- _timestamp->collect_marker_specification(bound_names);
+ _timestamp->collect_prepare_metadata(meta);
}
if (_time_to_live) {
- _time_to_live->collect_marker_specification(bound_names);
+ _time_to_live->collect_prepare_metadata(meta);
}
if (_timeout) {
- _timeout->collect_marker_specification(bound_names);
+ _timeout->collect_prepare_metadata(meta);
}
}
diff --git a/cql3/attributes.hh b/cql3/attributes.hh
index 386fe4427d..03dc5bfcca 100644
--- a/cql3/attributes.hh
+++ b/cql3/attributes.hh
@@ -46,7 +46,7 @@
namespace cql3 {
class query_options;
-class variable_specifications;
+class raw_prepare_metadata;
/**
* Utility class for the Parser to gather attributes for modification
@@ -74,7 +74,7 @@ class attributes final {
db::timeout_clock::duration get_timeout(const query_options& options) const;
- void collect_marker_specification(variable_specifications& bound_names) const;
+ void collect_prepare_metadata(raw_prepare_metadata& meta) const;
class raw final {
public:
diff --git a/cql3/column_condition.cc b/cql3/column_condition.cc
index c9875daca1..9207a8baff 100644
--- a/cql3/column_condition.cc
+++ b/cql3/column_condition.cc
@@ -118,17 +118,17 @@ uint32_t read_and_check_list_index(const cql3::raw_value_view& key) {
namespace cql3 {
-void column_condition::collect_marker_specificaton(variable_specifications& bound_names) const {
+void column_condition::collect_marker_specificaton(raw_prepare_metadata& meta) const {
if (_collection_element) {
- _collection_element->collect_marker_specification(bound_names);
+ _collection_element->collect_prepare_metadata(meta);
}
if (!_in_values.empty()) {
for (auto&& value : _in_values) {
- value->collect_marker_specification(bound_names);
+ value->collect_prepare_metadata(meta);
}
}
if (_value) {
- _value->collect_marker_specification(bound_names);
+ _value->collect_prepare_metadata(meta);
}
}
diff --git a/cql3/column_condition.hh b/cql3/column_condition.hh
index 68082571b8..54ff3dcfac 100644
--- a/cql3/column_condition.hh
+++ b/cql3/column_condition.hh
@@ -89,7 +89,7 @@ class column_condition final {
* @param boundNames the list of column specification where to collect the
* bind variables of this term in.
*/
- void collect_marker_specificaton(variable_specifications& bound_names) const;
+ void collect_marker_specificaton(raw_prepare_metadata& meta) const;
// Retrieve parameter marker values, if any, find the appropriate collection
// element if the cell is a collection and an element access is used in the expression,
diff --git a/cql3/functions/function_call.hh b/cql3/functions/function_call.hh
index d4c4fec9df..7ca9db9efd 100644
--- a/cql3/functions/function_call.hh
+++ b/cql3/functions/function_call.hh
@@ -57,7 +57,7 @@ class function_call : public non_terminal {
function_call(shared_ptr<scalar_function> fun, std::vector<shared_ptr<term>> terms)
: _fun(std::move(fun)), _terms(std::move(terms)) {
}
- virtual void collect_marker_specification(variable_specifications& bound_names) const override;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const override;
virtual shared_ptr<terminal> bind(const query_options& options) override;
virtual cql3::raw_value_view bind_and_get(const query_options& options) override;
private:
diff --git a/cql3/functions/functions.cc b/cql3/functions/functions.cc
index d855706912..596ef665c1 100644
--- a/cql3/functions/functions.cc
+++ b/cql3/functions/functions.cc
@@ -430,9 +430,9 @@ functions::type_equals(const std::vector<data_type>& t1, const std::vector<data_
}
void
-function_call::collect_marker_specification(variable_specifications& bound_names) const {
+function_call::collect_prepare_metadata(raw_prepare_metadata& meta) const {
for (auto&& t : _terms) {
- t->collect_marker_specification(bound_names);
+ t->collect_prepare_metadata(meta);
}
}
diff --git a/cql3/lists.cc b/cql3/lists.cc
index 6a69da6cb1..ff1d5b0f1d 100644
--- a/cql3/lists.cc
+++ b/cql3/lists.cc
@@ -207,7 +207,7 @@ lists::delayed_value::contains_bind_marker() const {
}
void
-lists::delayed_value::collect_marker_specification(variable_specifications& bound_names) const {
+lists::delayed_value::collect_prepare_metadata(raw_prepare_metadata& meta) const {
}
shared_ptr<terminal>
@@ -275,9 +275,9 @@ lists::setter_by_index::requires_read() const {
}
void
-lists::setter_by_index::collect_marker_specification(variable_specifications& bound_names) const {
- operation::collect_marker_specification(bound_names);
- _idx->collect_marker_specification(bound_names);
+lists::setter_by_index::collect_prepare_metadata(raw_prepare_metadata& meta) const {
+ operation::collect_prepare_metadata(meta);
+ _idx->collect_prepare_metadata(meta);
}
void
diff --git a/cql3/lists.hh b/cql3/lists.hh
index c58a94ea7f..8efc45cc58 100644
--- a/cql3/lists.hh
+++ b/cql3/lists.hh
@@ -104,7 +104,7 @@ class lists {
: _elements(std::move(elements)) {
}
virtual bool contains_bind_marker() const override;
- virtual void collect_marker_specification(variable_specifications& bound_names) const override;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const override;
virtual shared_ptr<terminal> bind(const query_options& options) override;
const std::vector<shared_ptr<term>>& get_elements() const {
return _elements;
@@ -140,7 +140,7 @@ class lists {
: operation(column, std::move(t)), _idx(std::move(idx)) {
}
virtual bool requires_read() const override;
- virtual void collect_marker_specification(variable_specifications& bound_names) const;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const;
virtual void execute(mutation& m, const clustering_key_prefix& prefix, const update_parameters& params) override;
};
diff --git a/cql3/maps.cc b/cql3/maps.cc
index ef28986a85..791977a8e8 100644
--- a/cql3/maps.cc
+++ b/cql3/maps.cc
@@ -228,7 +228,7 @@ maps::delayed_value::contains_bind_marker() const {
}
void
-maps::delayed_value::collect_marker_specification(variable_specifications& bound_names) const {
+maps::delayed_value::collect_prepare_metadata(raw_prepare_metadata& meta) const {
}
shared_ptr<terminal>
@@ -306,9 +306,9 @@ maps::setter::execute(mutation& m, const clustering_key_prefix& row_key, const u
}
void
-maps::setter_by_key::collect_marker_specification(variable_specifications& bound_names) const {
- operation::collect_marker_specification(bound_names);
- _k->collect_marker_specification(bound_names);
+maps::setter_by_key::collect_prepare_metadata(raw_prepare_metadata& meta) const {
+ operation::collect_prepare_metadata(meta);
+ _k->collect_prepare_metadata(meta);
}
void
diff --git a/cql3/maps.hh b/cql3/maps.hh
index 57b9a4ad91..d8ac86501c 100644
--- a/cql3/maps.hh
+++ b/cql3/maps.hh
@@ -98,7 +98,7 @@ class maps {
: _comparator(std::move(comparator)), _elements(std::move(elements)) {
}
virtual bool contains_bind_marker() const override;
- virtual void collect_marker_specification(variable_specifications& bound_names) const override;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const override;
shared_ptr<terminal> bind(const query_options& options);
};
@@ -126,7 +126,7 @@ class maps {
setter_by_key(const column_definition& column, shared_ptr<term> k, shared_ptr<term> t)
: operation(column, std::move(t)), _k(std::move(k)) {
}
- virtual void collect_marker_specification(variable_specifications& bound_names) const override;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const override;
virtual void execute(mutation& m, const clustering_key_prefix& prefix, const update_parameters& params) override;
};
diff --git a/cql3/multi_column_relation.hh b/cql3/multi_column_relation.hh
index 1df5be96a4..8786b02c70 100644
--- a/cql3/multi_column_relation.hh
+++ b/cql3/multi_column_relation.hh
@@ -160,31 +160,31 @@ class multi_column_relation final : public relation {
protected:
virtual shared_ptr<restrictions::restriction> new_EQ_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names) override {
+ raw_prepare_metadata& meta) override {
auto rs = receivers(db, *schema);
std::vector<lw_shared_ptr<column_specification>> col_specs(rs.size());
std::transform(rs.begin(), rs.end(), col_specs.begin(), [] (auto cs) {
return cs->column_specification;
});
- auto t = to_term(col_specs, *get_value(), db, schema->ks_name(), bound_names);
+ auto t = to_term(col_specs, *get_value(), db, schema->ks_name(), meta);
return ::make_shared<restrictions::multi_column_restriction::EQ>(schema, rs, t);
}
virtual shared_ptr<restrictions::restriction> new_IN_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names) override {
+ raw_prepare_metadata& meta) override {
auto rs = receivers(db, *schema);
std::vector<lw_shared_ptr<column_specification>> col_specs(rs.size());
std::transform(rs.begin(), rs.end(), col_specs.begin(), [] (auto cs) {
return cs->column_specification;
});
if (_in_marker) {
- auto t = to_term(col_specs, *get_value(), db, schema->ks_name(), bound_names);
+ auto t = to_term(col_specs, *get_value(), db, schema->ks_name(), meta);
auto as_abstract_marker = static_pointer_cast<abstract_marker>(t);
return ::make_shared<restrictions::multi_column_restriction::IN_with_marker>(schema, rs, as_abstract_marker);
} else {
std::vector<::shared_ptr<term::raw>> raws(_in_values.size());
std::copy(_in_values.begin(), _in_values.end(), raws.begin());
- auto ts = to_terms(col_specs, raws, db, schema->ks_name(), bound_names);
+ auto ts = to_terms(col_specs, raws, db, schema->ks_name(), meta);
// Convert a single-item IN restriction to an EQ restriction
if (ts.size() == 1) {
return ::make_shared<restrictions::multi_column_restriction::EQ>(schema, rs, std::move(ts[0]));
@@ -194,24 +194,24 @@ class multi_column_relation final : public relation {
}
virtual shared_ptr<restrictions::restriction> new_slice_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
statements::bound bound, bool inclusive) override {
auto rs = receivers(db, *schema);
std::vector<lw_shared_ptr<column_specification>> col_specs(rs.size());
std::transform(rs.begin(), rs.end(), col_specs.begin(), [] (auto cs) {
return cs->column_specification;
});
- auto t = to_term(col_specs, *get_value(), db, schema->ks_name(), bound_names);
+ auto t = to_term(col_specs, *get_value(), db, schema->ks_name(), meta);
return ::make_shared<restrictions::multi_column_restriction::slice>(schema, rs, bound, inclusive, t, _mode);
}
virtual shared_ptr<restrictions::restriction> new_contains_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names, bool is_key) override {
+ raw_prepare_metadata& meta, bool is_key) override {
throw exceptions::invalid_request_exception(format("{} cannot be used for Multi-column relations", get_operator()));
}
virtual ::shared_ptr<restrictions::restriction> new_LIKE_restriction(
- database& db, schema_ptr schema, variable_specifications& bound_names) override {
+ database& db, schema_ptr schema, raw_prepare_metadata& meta) override {
throw exceptions::invalid_request_exception("LIKE cannot be used for Multi-column relations");
}
@@ -224,10 +224,10 @@ class multi_column_relation final : public relation {
virtual shared_ptr<term> to_term(const std::vector<lw_shared_ptr<column_specification>>& receivers,
const term::raw& raw, database& db, const sstring& keyspace,
- variable_specifications& bound_names) const override {
+ raw_prepare_metadata& meta) const override {
const auto& as_multi_column_raw = dynamic_cast<const term::multi_column_raw&>(raw);
auto t = as_multi_column_raw.prepare(db, keyspace, receivers);
- t->collect_marker_specification(bound_names);
+ t->collect_prepare_metadata(meta);
return t;
}
diff --git a/cql3/operation.hh b/cql3/operation.hh
index 936b513dd7..8b1532b80a 100644
--- a/cql3/operation.hh
+++ b/cql3/operation.hh
@@ -103,12 +103,12 @@ class operation {
/**
* Collects the column specification for the bind variables of this operation.
*
- * @param bound_names the list of column specification where to collect the
+ * @param meta the list of column specification where to collect the
* bind variables of this term in.
*/
- virtual void collect_marker_specification(variable_specifications& bound_names) const {
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const {
if (_t) {
- _t->collect_marker_specification(bound_names);
+ _t->collect_prepare_metadata(meta);
}
}
diff --git a/cql3/variable_specifications.cc b/cql3/raw_prepare_metadata.cc
similarity index 74%
rename from cql3/variable_specifications.cc
rename to cql3/raw_prepare_metadata.cc
index b8e21d1225..d3fe69b34b 100644
--- a/cql3/variable_specifications.cc
+++ b/cql3/raw_prepare_metadata.cc
@@ -39,33 +39,33 @@
* along with Scylla. If not, see <
http://www.gnu.org/licenses/>.
*/
-#include "cql3/variable_specifications.hh"
+#include "cql3/raw_prepare_metadata.hh"
#include "cql3/column_identifier.hh"
#include "cql3/column_specification.hh"
namespace cql3 {
-variable_specifications::variable_specifications(const std::vector<::shared_ptr<column_identifier>>& variable_names)
+raw_prepare_metadata::raw_prepare_metadata(const std::vector<::shared_ptr<column_identifier>>& variable_names)
: _variable_names{variable_names}
, _specs{variable_names.size()}
, _target_columns{variable_names.size()}
{ }
-lw_shared_ptr<variable_specifications> variable_specifications::empty() {
- return make_lw_shared<variable_specifications>(std::vector<::shared_ptr<column_identifier>>{});
+lw_shared_ptr<raw_prepare_metadata> raw_prepare_metadata::empty() {
+ return make_lw_shared<raw_prepare_metadata>(std::vector<::shared_ptr<column_identifier>>{});
}
-size_t variable_specifications::size() const {
+size_t raw_prepare_metadata::bound_variables_size() const {
return _variable_names.size();
}
-std::vector<lw_shared_ptr<column_specification>> variable_specifications::get_specifications() const & {
+std::vector<lw_shared_ptr<column_specification>> raw_prepare_metadata::get_variable_specifications() const & {
return std::vector<lw_shared_ptr<column_specification>>(_specs.begin(), _specs.end());
}
-std::vector<lw_shared_ptr<column_specification>> variable_specifications::get_specifications() && {
+std::vector<lw_shared_ptr<column_specification>> raw_prepare_metadata::get_variable_specifications() && {
return std::move(_specs);
}
-std::vector<uint16_t> variable_specifications::get_partition_key_bind_indexes(const schema& schema) const {
+std::vector<uint16_t> raw_prepare_metadata::get_partition_key_bind_indexes(const schema& schema) const {
auto count = schema.partition_key_columns().size();
std::vector<uint16_t> partition_key_positions(count, uint16_t(0));
std::vector<bool> set(count, false);
@@ -85,7 +85,7 @@ std::vector<uint16_t> variable_specifications::get_partition_key_bind_indexes(co
return partition_key_positions;
}
-void variable_specifications::add(int32_t bind_index, lw_shared_ptr<column_specification> spec) {
+void raw_prepare_metadata::add_variable_specification(int32_t bind_index, lw_shared_ptr<column_specification> spec) {
_target_columns[bind_index] = spec;
auto name = _variable_names[bind_index];
// Use the user name, if there is one
@@ -95,12 +95,12 @@ void variable_specifications::add(int32_t bind_index, lw_shared_ptr<column_speci
_specs[bind_index] = spec;
}
-void variable_specifications::set_bound_variables(const std::vector<shared_ptr<column_identifier>>& bound_names) {
- _variable_names = bound_names;
+void raw_prepare_metadata::set_bound_variables(const std::vector<shared_ptr<column_identifier>>& prepare_meta) {
+ _variable_names = prepare_meta;
_specs.clear();
_target_columns.clear();
- const size_t bn_size = bound_names.size();
+ const size_t bn_size = prepare_meta.size();
_specs.resize(bn_size);
_target_columns.resize(bn_size);
}
diff --git a/cql3/variable_specifications.hh b/cql3/raw_prepare_metadata.hh
similarity index 75%
rename from cql3/variable_specifications.hh
rename to cql3/raw_prepare_metadata.hh
index e261851e1d..0a9cd0b520 100644
--- a/cql3/variable_specifications.hh
+++ b/cql3/raw_prepare_metadata.hh
@@ -55,7 +55,11 @@ namespace cql3 {
class column_identifier;
class column_specification;
-class variable_specifications final {
+/**
+ * A metadata class currently holding bind variables specifications and
+ * populated at "prepare" step of query execution.
+ */
+class raw_prepare_metadata final {
private:
std::vector<shared_ptr<column_identifier>> _variable_names;
std::vector<lw_shared_ptr<column_specification>> _specs;
@@ -63,26 +67,22 @@ class variable_specifications final {
public:
- variable_specifications() = default;
- variable_specifications(const std::vector<::shared_ptr<column_identifier>>& variable_names);
+ raw_prepare_metadata() = default;
+ raw_prepare_metadata(const std::vector<::shared_ptr<column_identifier>>& variable_names);
- /**
- * Returns an empty instance of <code>VariableSpecifications</code>.
- * @return an empty instance of <code>VariableSpecifications</code>
- */
- static lw_shared_ptr<variable_specifications> empty();
+ static lw_shared_ptr<raw_prepare_metadata> empty();
- size_t size() const;
+ size_t bound_variables_size() const;
- std::vector<lw_shared_ptr<column_specification>> get_specifications() const &;
+ std::vector<lw_shared_ptr<column_specification>> get_variable_specifications() const &;
- std::vector<lw_shared_ptr<column_specification>> get_specifications() &&;
+ std::vector<lw_shared_ptr<column_specification>> get_variable_specifications() &&;
std::vector<uint16_t> get_partition_key_bind_indexes(const schema& schema) const;
- void add(int32_t bind_index, lw_shared_ptr<column_specification> spec);
+ void add_variable_specification(int32_t bind_index, lw_shared_ptr<column_specification> spec);
- void set_bound_variables(const std::vector<shared_ptr<column_identifier>>& bound_names);
+ void set_bound_variables(const std::vector<shared_ptr<column_identifier>>& prepare_meta);
};
}
diff --git a/cql3/relation.hh b/cql3/relation.hh
index 0734898aa9..7023697cc4 100644
--- a/cql3/relation.hh
+++ b/cql3/relation.hh
@@ -43,7 +43,7 @@
#include "schema_fwd.hh"
#include "column_identifier.hh"
-#include "variable_specifications.hh"
+#include "raw_prepare_metadata.hh"
#include "restrictions/restriction.hh"
#include "statements/bound.hh"
#include "term.hh"
@@ -139,29 +139,29 @@ class relation : public enable_shared_from_this<relation> {
* @return the <code>Restriction</code> corresponding to this <code>Relation</code>
* @throws InvalidRequestException if this <code>Relation</code> is not valid
*/
- virtual ::shared_ptr<restrictions::restriction> to_restriction(database& db, schema_ptr schema, variable_specifications& bound_names) final {
+ virtual ::shared_ptr<restrictions::restriction> to_restriction(database& db, schema_ptr schema, raw_prepare_metadata& meta) final {
if (_relation_type == expr::oper_t::EQ) {
- return new_EQ_restriction(db, schema, bound_names);
+ return new_EQ_restriction(db, schema, meta);
} else if (_relation_type == expr::oper_t::LT) {
- return new_slice_restriction(db, schema, bound_names, statements::bound::END, false);
+ return new_slice_restriction(db, schema, meta, statements::bound::END, false);
} else if (_relation_type == expr::oper_t::LTE) {
- return new_slice_restriction(db, schema, bound_names, statements::bound::END, true);
+ return new_slice_restriction(db, schema, meta, statements::bound::END, true);
} else if (_relation_type == expr::oper_t::GTE) {
- return new_slice_restriction(db, schema, bound_names, statements::bound::START, true);
+ return new_slice_restriction(db, schema, meta, statements::bound::START, true);
} else if (_relation_type == expr::oper_t::GT) {
- return new_slice_restriction(db, schema, bound_names, statements::bound::START, false);
+ return new_slice_restriction(db, schema, meta, statements::bound::START, false);
} else if (_relation_type == expr::oper_t::IN) {
- return new_IN_restriction(db, schema, bound_names);
+ return new_IN_restriction(db, schema, meta);
} else if (_relation_type == expr::oper_t::CONTAINS) {
- return new_contains_restriction(db, schema, bound_names, false);
+ return new_contains_restriction(db, schema, meta, false);
} else if (_relation_type == expr::oper_t::CONTAINS_KEY) {
- return new_contains_restriction(db, schema, bound_names, true);
+ return new_contains_restriction(db, schema, meta, true);
} else if (_relation_type == expr::oper_t::IS_NOT) {
// This case is not supposed to happen: statement_restrictions
// constructor does not call this function for views' IS_NOT.
throw exceptions::invalid_request_exception(format("Unsupported \"IS NOT\" relation: {}", to_string()));
} else if (_relation_type == expr::oper_t::LIKE) {
- return new_LIKE_restriction(db, schema, bound_names);
+ return new_LIKE_restriction(db, schema, meta);
} else {
throw exceptions::invalid_request_exception(format("Unsupported \"!=\" relation: {}", to_string()));
}
@@ -182,31 +182,31 @@ class relation : public enable_shared_from_this<relation> {
* @throws InvalidRequestException if the relation cannot be converted into an EQ restriction.
*/
virtual ::shared_ptr<restrictions::restriction> new_EQ_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names) = 0;
+ raw_prepare_metadata& meta) = 0;
/**
* Creates a new IN restriction instance.
*
* @param cfm the Column Family meta data
- * @param bound_names the variables specification where to collect the bind variables
+ * @param meta the variables specification where to collect the bind variables
* @return a new IN restriction instance
* @throws InvalidRequestException if the relation cannot be converted into an IN restriction.
*/
virtual ::shared_ptr<restrictions::restriction> new_IN_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names) = 0;
+ raw_prepare_metadata& meta) = 0;
/**
* Creates a new Slice restriction instance.
*
* @param cfm the Column Family meta data
- * @param bound_names the variables specification where to collect the bind variables
+ * @param meta the variables specification where to collect the bind variables
* @param bound the slice bound
* @param inclusive <code>true</code> if the bound is included.
* @return a new slice restriction instance
* @throws InvalidRequestException if the <code>Relation</code> is not valid
*/
virtual ::shared_ptr<restrictions::restriction> new_slice_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
statements::bound bound,
bool inclusive) = 0;
@@ -214,19 +214,19 @@ class relation : public enable_shared_from_this<relation> {
* Creates a new Contains restriction instance.
*
* @param cfm the Column Family meta data
- * @param bound_names the variables specification where to collect the bind variables
+ * @param meta the variables specification where to collect the bind variables
* @param isKey <code>true</code> if the restriction to create is a CONTAINS KEY
* @return a new Contains <code>::shared_ptr<restrictions::restriction></code> instance
* @throws InvalidRequestException if the <code>Relation</code> is not valid
*/
virtual ::shared_ptr<restrictions::restriction> new_contains_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names, bool isKey) = 0;
+ raw_prepare_metadata& meta, bool isKey) = 0;
/**
* Creates a new LIKE restriction instance.
*/
virtual ::shared_ptr<restrictions::restriction> new_LIKE_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names) = 0;
+ raw_prepare_metadata& meta) = 0;
/**
* Renames an identifier in this Relation, if applicable.
@@ -253,7 +253,7 @@ class relation : public enable_shared_from_this<relation> {
const term::raw& raw,
database& db,
const sstring& keyspace,
- variable_specifications& boundNames) const = 0;
+ raw_prepare_metadata& boundNames) const = 0;
/**
* Converts the specified <code>Raw</code> terms into a <code>Term</code>s.
@@ -269,7 +269,7 @@ class relation : public enable_shared_from_this<relation> {
const std::vector<::shared_ptr<term::raw>>& raws,
database& db,
const sstring& keyspace,
- variable_specifications& boundNames) const {
+ raw_prepare_metadata& boundNames) const {
std::vector<::shared_ptr<term>> terms;
for (const auto& r : raws) {
terms.emplace_back(to_term(receivers, *r, db, keyspace, boundNames));
diff --git a/cql3/restrictions/statement_restrictions.cc b/cql3/restrictions/statement_restrictions.cc
index b7651e5b43..1d85f2a51c 100644
--- a/cql3/restrictions/statement_restrictions.cc
+++ b/cql3/restrictions/statement_restrictions.cc
@@ -305,7 +305,7 @@ statement_restrictions::statement_restrictions(database& db,
schema_ptr schema,
statements::statement_type type,
const std::vector<::shared_ptr<relation>>& where_clause,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
bool selects_only_static_columns,
bool for_view,
bool allow_filtering)
@@ -336,7 +336,7 @@ statement_restrictions::statement_restrictions(database& db,
throw exceptions::invalid_request_exception(format("restriction '{}' is only supported in materialized view creation", relation->to_string()));
}
} else {
- const auto restriction = relation->to_restriction(db, schema, bound_names);
+ const auto restriction = relation->to_restriction(db, schema, meta);
if (dynamic_pointer_cast<multi_column_restriction>(restriction)) {
_clustering_columns_restrictions = _clustering_columns_restrictions->merge_to(_schema, restriction);
} else if (has_token(restriction->expression)) {
diff --git a/cql3/restrictions/statement_restrictions.hh b/cql3/restrictions/statement_restrictions.hh
index b17fcfe8dd..ce429314ff 100644
--- a/cql3/restrictions/statement_restrictions.hh
+++ b/cql3/restrictions/statement_restrictions.hh
@@ -49,7 +49,7 @@
#include "cql3/restrictions/primary_key_restrictions.hh"
#include "cql3/restrictions/single_column_restrictions.hh"
#include "cql3/relation.hh"
-#include "cql3/variable_specifications.hh"
+#include "cql3/raw_prepare_metadata.hh"
#include "cql3/statements/statement_type.hh"
namespace cql3 {
@@ -151,7 +151,7 @@ class statement_restrictions {
schema_ptr schema,
statements::statement_type type,
const std::vector<::shared_ptr<relation>>& where_clause,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
bool selects_only_static_columns,
bool for_view = false,
bool allow_filtering = false);
diff --git a/cql3/sets.cc b/cql3/sets.cc
index 883290a46b..75c44dff18 100644
--- a/cql3/sets.cc
+++ b/cql3/sets.cc
@@ -201,7 +201,7 @@ sets::delayed_value::contains_bind_marker() const {
}
void
-sets::delayed_value::collect_marker_specification(variable_specifications& bound_names) const {
+sets::delayed_value::collect_prepare_metadata(raw_prepare_metadata& meta) const {
}
shared_ptr<terminal>
diff --git a/cql3/sets.hh b/cql3/sets.hh
index 21ed2883e3..664eaf73b3 100644
--- a/cql3/sets.hh
+++ b/cql3/sets.hh
@@ -94,7 +94,7 @@ class sets {
: _comparator(std::move(comparator)), _elements(std::move(elements)) {
}
virtual bool contains_bind_marker() const override;
- virtual void collect_marker_specification(variable_specifications& bound_names) const override;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const override;
virtual shared_ptr<terminal> bind(const query_options& options);
};
diff --git a/cql3/single_column_relation.cc b/cql3/single_column_relation.cc
index fa004a2984..2d5219e0a0 100644
--- a/cql3/single_column_relation.cc
+++ b/cql3/single_column_relation.cc
@@ -57,26 +57,26 @@ single_column_relation::to_term(const std::vector<lw_shared_ptr<column_specifica
const term::raw& raw,
database& db,
const sstring& keyspace,
- variable_specifications& bound_names) const {
+ raw_prepare_metadata& meta) const {
// TODO: optimize vector away, accept single column_specification
assert(receivers.size() == 1);
auto term = raw.prepare(db, keyspace, receivers[0]);
- term->collect_marker_specification(bound_names);
+ term->collect_prepare_metadata(meta);
return term;
}
::shared_ptr<restrictions::restriction>
-single_column_relation::new_EQ_restriction(database& db, schema_ptr schema, variable_specifications& bound_names) {
+single_column_relation::new_EQ_restriction(database& db, schema_ptr schema, raw_prepare_metadata& meta) {
const column_definition& column_def = to_column_definition(*schema, *_entity);
if (!_map_key) {
auto r = ::make_shared<restrictions::single_column_restriction>(column_def);
- auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), bound_names);
+ auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), meta);
r->expression = binary_operator{&column_def, expr::oper_t::EQ, std::move(term)};
return r;
}
auto&& receivers = to_receivers(*schema, column_def);
- auto&& entry_key = to_term({receivers[0]}, *_map_key, db, schema->ks_name(), bound_names);
- auto&& entry_value = to_term({receivers[1]}, *_value, db, schema->ks_name(), bound_names);
+ auto&& entry_key = to_term({receivers[0]}, *_map_key, db, schema->ks_name(), meta);
+ auto&& entry_value = to_term({receivers[1]}, *_value, db, schema->ks_name(), meta);
auto r = make_shared<restrictions::single_column_restriction>(column_def);
r->expression = binary_operator{
column_value(&column_def, std::move(entry_key)), oper_t::EQ, std::move(entry_value)};
@@ -84,18 +84,18 @@ single_column_relation::new_EQ_restriction(database& db, schema_ptr schema, vari
}
::shared_ptr<restrictions::restriction>
-single_column_relation::new_IN_restriction(database& db, schema_ptr schema, variable_specifications& bound_names) {
+single_column_relation::new_IN_restriction(database& db, schema_ptr schema, raw_prepare_metadata& meta) {
using namespace restrictions;
const column_definition& column_def = to_column_definition(*schema, *_entity);
auto receivers = to_receivers(*schema, column_def);
assert(_in_values.empty() || !_value);
if (_value) {
- auto term = to_term(receivers, *_value, db, schema->ks_name(), bound_names);
+ auto term = to_term(receivers, *_value, db, schema->ks_name(), meta);
auto r = ::make_shared<single_column_restriction>(column_def);
r->expression = binary_operator{&column_def, expr::oper_t::IN, std::move(term)};
return r;
}
- auto terms = to_terms(receivers, _in_values, db, schema->ks_name(), bound_names);
+ auto terms = to_terms(receivers, _in_values, db, schema->ks_name(), meta);
// Convert a single-item IN restriction to an EQ restriction
if (terms.size() == 1) {
auto r = ::make_shared<single_column_restriction>(column_def);
@@ -110,13 +110,13 @@ single_column_relation::new_IN_restriction(database& db, schema_ptr schema, vari
::shared_ptr<restrictions::restriction>
single_column_relation::new_LIKE_restriction(
- database& db, schema_ptr schema, variable_specifications& bound_names) {
+ database& db, schema_ptr schema, raw_prepare_metadata& meta) {
const column_definition& column_def = to_column_definition(*schema, *_entity);
if (!column_def.type->is_string()) {
throw exceptions::invalid_request_exception(
format("LIKE is allowed only on string types, which {} is not", column_def.name_as_text()));
}
- auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), bound_names);
+ auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), meta);
auto r = ::make_shared<restrictions::single_column_restriction>(column_def);
r->expression = binary_operator{&column_def, expr::oper_t::LIKE, std::move(term)};
return r;
diff --git a/cql3/single_column_relation.hh b/cql3/single_column_relation.hh
index 3acf11d8c1..3779e679d0 100644
--- a/cql3/single_column_relation.hh
+++ b/cql3/single_column_relation.hh
@@ -117,7 +117,7 @@ class single_column_relation final : public relation {
protected:
virtual ::shared_ptr<term> to_term(const std::vector<lw_shared_ptr<column_specification>>& receivers,
const term::raw& raw, database& db, const sstring& keyspace,
- variable_specifications& bound_names) const override;
+ raw_prepare_metadata& meta) const override;
#if 0
public SingleColumnRelation withNonStrictOperator()
@@ -146,13 +146,13 @@ class single_column_relation final : public relation {
protected:
virtual ::shared_ptr<restrictions::restriction> new_EQ_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names);
+ raw_prepare_metadata& meta);
virtual ::shared_ptr<restrictions::restriction> new_IN_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names) override;
+ raw_prepare_metadata& meta) override;
virtual ::shared_ptr<restrictions::restriction> new_slice_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
statements::bound bound,
bool inclusive) override {
auto&& column_def = to_column_definition(*schema, *_entity);
@@ -169,17 +169,17 @@ class single_column_relation final : public relation {
throw exceptions::invalid_request_exception("Slice restrictions are not supported on duration columns");
}
- auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), bound_names);
+ auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), meta);
auto r = ::make_shared<restrictions::single_column_restriction>(column_def);
r->expression = expr::binary_operator{&column_def, _relation_type, std::move(term)};
return r;
}
virtual shared_ptr<restrictions::restriction> new_contains_restriction(database& db, schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
bool is_key) override {
auto&& column_def = to_column_definition(*schema, *_entity);
- auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), bound_names);
+ auto term = to_term(to_receivers(*schema, column_def), *_value, db, schema->ks_name(), meta);
auto r = ::make_shared<restrictions::single_column_restriction>(column_def);
r->expression = expr::binary_operator{
&column_def, is_key ? expr::oper_t::CONTAINS_KEY : expr::oper_t::CONTAINS, std::move(term)};
@@ -187,7 +187,7 @@ class single_column_relation final : public relation {
}
virtual ::shared_ptr<restrictions::restriction> new_LIKE_restriction(
- database& db, schema_ptr schema, variable_specifications& bound_names) override;
+ database& db, schema_ptr schema, raw_prepare_metadata& meta) override;
virtual ::shared_ptr<relation> maybe_rename_identifier(const column_identifier::raw& from, column_identifier::raw to) override {
return *_entity == from
diff --git a/cql3/statements/batch_statement.cc b/cql3/statements/batch_statement.cc
index a19473b3f1..30706675e0 100644
--- a/cql3/statements/batch_statement.cc
+++ b/cql3/statements/batch_statement.cc
@@ -433,7 +433,7 @@ namespace raw {
std::unique_ptr<prepared_statement>
batch_statement::prepare(database& db, cql_stats& stats) {
- auto&& bound_names = get_bound_variables();
+ auto&& meta = get_prepare_metadata();
std::optional<sstring> first_ks;
std::optional<sstring> first_cf;
@@ -449,20 +449,20 @@ batch_statement::prepare(database& db, cql_stats& stats) {
} else {
have_multiple_cfs = first_ks.value() != parsed->keyspace() || first_cf.value() != parsed->column_family();
}
- statements.emplace_back(parsed->prepare(db, bound_names, stats));
+ statements.emplace_back(parsed->prepare(db, meta, stats));
}
auto&& prep_attrs = _attrs->prepare(db, "[batch]", "[batch]");
- prep_attrs->collect_marker_specification(bound_names);
+ prep_attrs->collect_prepare_metadata(meta);
- cql3::statements::batch_statement batch_statement_(bound_names.size(), _type, std::move(statements), std::move(prep_attrs), stats);
+ cql3::statements::batch_statement batch_statement_(meta.bound_variables_size(), _type, std::move(statements), std::move(prep_attrs), stats);
std::vector<uint16_t> partition_key_bind_indices;
if (!have_multiple_cfs && batch_statement_.get_statements().size() > 0) {
- partition_key_bind_indices = bound_names.get_partition_key_bind_indexes(*batch_statement_.get_statements()[0].statement->s);
+ partition_key_bind_indices = meta.get_partition_key_bind_indexes(*batch_statement_.get_statements()[0].statement->s);
}
return std::make_unique<prepared_statement>(make_shared<cql3::statements::batch_statement>(std::move(batch_statement_)),
- bound_names.get_specifications(),
+ meta.get_variable_specifications(),
std::move(partition_key_bind_indices));
}
diff --git a/cql3/statements/create_view_statement.cc b/cql3/statements/create_view_statement.cc
index 19d9b12c25..c7cda35611 100644
--- a/cql3/statements/create_view_statement.cc
+++ b/cql3/statements/create_view_statement.cc
@@ -222,7 +222,7 @@ future<shared_ptr<cql_transport::event::schema_change>> create_view_statement::a
return def;
}));
- if (!_variables.empty()) {
+ if (!_prep_meta.empty()) {
throw exceptions::invalid_request_exception(format("Cannot use query parameters in CREATE MATERIALIZED VIEW statements"));
}
diff --git a/cql3/statements/delete_statement.cc b/cql3/statements/delete_statement.cc
index 2cb0e2bbf3..4d33bf4ab5 100644
--- a/cql3/statements/delete_statement.cc
+++ b/cql3/statements/delete_statement.cc
@@ -85,9 +85,9 @@ void delete_statement::add_update_for_key(mutation& m, const query::clustering_r
namespace raw {
::shared_ptr<cql3::statements::modification_statement>
-delete_statement::prepare_internal(database& db, schema_ptr schema, variable_specifications& bound_names,
+delete_statement::prepare_internal(database& db, schema_ptr schema, raw_prepare_metadata& meta,
std::unique_ptr<attributes> attrs, cql_stats& stats) const {
- auto stmt = ::make_shared<cql3::statements::delete_statement>(statement_type::DELETE, bound_names.size(), schema, std::move(attrs), stats);
+ auto stmt = ::make_shared<cql3::statements::delete_statement>(statement_type::DELETE, meta.bound_variables_size(), schema, std::move(attrs), stats);
for (auto&& deletion : _deletions) {
auto&& id = deletion->affected_column().prepare_column_identifier(*schema);
@@ -103,11 +103,11 @@ delete_statement::prepare_internal(database& db, schema_ptr schema, variable_spe
}
auto&& op = deletion->prepare(db, schema->ks_name(), *def);
- op->collect_marker_specification(bound_names);
+ op->collect_prepare_metadata(meta);
stmt->add_operation(op);
}
- prepare_conditions(db, *schema, bound_names, *stmt);
- stmt->process_where_clause(db, _where_clause, bound_names);
+ prepare_conditions(db, *schema, meta, *stmt);
+ stmt->process_where_clause(db, _where_clause, meta);
if (has_slice(stmt->restrictions().get_clustering_columns_restrictions()->expression)) {
if (!schema->is_compound()) {
throw exceptions::invalid_request_exception("Range deletions on \"compact storage\" schemas are not supported");
diff --git a/cql3/statements/modification_statement.cc b/cql3/statements/modification_statement.cc
index d1af58f12b..f5487fefb1 100644
--- a/cql3/statements/modification_statement.cc
+++ b/cql3/statements/modification_statement.cc
@@ -389,7 +389,7 @@ void modification_statement::build_cas_result_set_metadata() {
}
void
-modification_statement::process_where_clause(database& db, std::vector<relation_ptr> where_clause, variable_specifications& names) {
+modification_statement::process_where_clause(database& db, std::vector<relation_ptr> where_clause, raw_prepare_metadata& names) {
_restrictions = restrictions::statement_restrictions(db, s, type, where_clause, names,
applies_only_to_static_columns(), _selects_a_collection, false);
/*
@@ -461,24 +461,24 @@ namespace raw {
std::unique_ptr<prepared_statement>
modification_statement::prepare(database& db, cql_stats& stats) {
schema_ptr schema = validation::validate_column_family(db, keyspace(), column_family());
- auto bound_names = get_bound_variables();
- auto statement = prepare(db, bound_names, stats);
- auto partition_key_bind_indices = bound_names.get_partition_key_bind_indexes(*schema);
- return std::make_unique<prepared_statement>(std::move(statement), bound_names, std::move(partition_key_bind_indices));
+ auto meta = get_prepare_metadata();
+ auto statement = prepare(db, meta, stats);
+ auto partition_key_bind_indices = meta.get_partition_key_bind_indexes(*schema);
+ return std::make_unique<prepared_statement>(std::move(statement), meta, std::move(partition_key_bind_indices));
}
::shared_ptr<cql3::statements::modification_statement>
-modification_statement::prepare(database& db, variable_specifications& bound_names, cql_stats& stats) const {
+modification_statement::prepare(database& db, raw_prepare_metadata& meta, cql_stats& stats) const {
schema_ptr schema = validation::validate_column_family(db, keyspace(), column_family());
auto prepared_attributes = _attrs->prepare(db, keyspace(), column_family());
- prepared_attributes->collect_marker_specification(bound_names);
+ prepared_attributes->collect_prepare_metadata(meta);
- return prepare_internal(db, schema, bound_names, std::move(prepared_attributes), stats);
+ return prepare_internal(db, schema, meta, std::move(prepared_attributes), stats);
}
void
-modification_statement::prepare_conditions(database& db, const schema& schema, variable_specifications& bound_names,
+modification_statement::prepare_conditions(database& db, const schema& schema, raw_prepare_metadata& meta,
cql3::statements::modification_statement& stmt) const
{
if (_if_not_exists || _if_exists || !_conditions.empty()) {
@@ -508,7 +508,7 @@ modification_statement::prepare_conditions(database& db, const schema& schema, v
}
auto condition = entry.second->prepare(db, keyspace(), *def);
- condition->collect_marker_specificaton(bound_names);
+ condition->collect_marker_specificaton(meta);
if (def->is_primary_key()) {
throw exceptions::invalid_request_exception(format("PRIMARY KEY column '{}' cannot have IF conditions", *id));
diff --git a/cql3/statements/modification_statement.hh b/cql3/statements/modification_statement.hh
index 87a69c0662..39c8ed3f89 100644
--- a/cql3/statements/modification_statement.hh
+++ b/cql3/statements/modification_statement.hh
@@ -194,7 +194,7 @@ class modification_statement : public cql_statement_opt_metadata {
return _is_raw_counter_shard_write.value_or(false);
}
- void process_where_clause(database& db, std::vector<relation_ptr> where_clause, variable_specifications& names);
+ void process_where_clause(database& db, std::vector<relation_ptr> where_clause, raw_prepare_metadata& names);
// CAS statement returns a result set. Prepare result set metadata
// so that get_result_metadata() returns a meaningful value.
diff --git a/cql3/statements/prepared_statement.hh b/cql3/statements/prepared_statement.hh
index fe28aea9b1..4bdd341a8d 100644
--- a/cql3/statements/prepared_statement.hh
+++ b/cql3/statements/prepared_statement.hh
@@ -51,7 +51,7 @@
namespace cql3 {
-class variable_specifications;
+class raw_prepare_metadata;
class column_specification;
class cql_statement;
@@ -74,9 +74,9 @@ class prepared_statement : public seastar::weakly_referencable<prepared_statemen
prepared_statement(seastar::shared_ptr<cql_statement> statement_, std::vector<seastar::lw_shared_ptr<column_specification>> bound_names_, std::vector<uint16_t> partition_key_bind_indices);
- prepared_statement(seastar::shared_ptr<cql_statement> statement_, const variable_specifications& names, const std::vector<uint16_t>& partition_key_bind_indices);
+ prepared_statement(seastar::shared_ptr<cql_statement> statement_, const raw_prepare_metadata& meta, const std::vector<uint16_t>& partition_key_bind_indices);
- prepared_statement(seastar::shared_ptr<cql_statement> statement_, variable_specifications&& names, std::vector<uint16_t>&& partition_key_bind_indices);
+ prepared_statement(seastar::shared_ptr<cql_statement> statement_, raw_prepare_metadata&& meta, std::vector<uint16_t>&& partition_key_bind_indices);
prepared_statement(seastar::shared_ptr<cql_statement>&& statement_);
diff --git a/cql3/statements/raw/delete_statement.hh b/cql3/statements/raw/delete_statement.hh
index 0d1e273985..442d0d6fc6 100644
--- a/cql3/statements/raw/delete_statement.hh
+++ b/cql3/statements/raw/delete_statement.hh
@@ -69,7 +69,7 @@ class delete_statement : public modification_statement {
bool if_exists);
protected:
virtual ::shared_ptr<cql3::statements::modification_statement> prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
};
}
diff --git a/cql3/statements/raw/insert_statement.hh b/cql3/statements/raw/insert_statement.hh
index 5ec5d58b76..84faf065a9 100644
--- a/cql3/statements/raw/insert_statement.hh
+++ b/cql3/statements/raw/insert_statement.hh
@@ -77,7 +77,7 @@ class insert_statement : public raw::modification_statement {
bool if_not_exists);
virtual ::shared_ptr<cql3::statements::modification_statement> prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
};
@@ -98,7 +98,7 @@ class insert_json_statement : public raw::modification_statement {
insert_json_statement(cf_name name, std::unique_ptr<attributes::raw> attrs, ::shared_ptr<term::raw> json_value, bool if_not_exists, bool default_unset);
virtual ::shared_ptr<cql3::statements::modification_statement> prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
};
diff --git a/cql3/statements/raw/modification_statement.hh b/cql3/statements/raw/modification_statement.hh
index a4da08671a..1c5bfe5282 100644
--- a/cql3/statements/raw/modification_statement.hh
+++ b/cql3/statements/raw/modification_statement.hh
@@ -73,15 +73,15 @@ class modification_statement : public cf_statement {
public:
virtual std::unique_ptr<prepared_statement> prepare(database& db, cql_stats& stats) override;
- ::shared_ptr<cql3::statements::modification_statement> prepare(database& db, variable_specifications& bound_names, cql_stats& stats) const;
+ ::shared_ptr<cql3::statements::modification_statement> prepare(database& db, raw_prepare_metadata& meta, cql_stats& stats) const;
protected:
virtual ::shared_ptr<cql3::statements::modification_statement> prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const = 0;
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const = 0;
// Helper function used by child classes to prepare conditions for a prepared statement.
// Must be called before processing WHERE clause, because to perform sanity checks there
// we need to know what kinds of conditions (static, regular) the statement has.
- void prepare_conditions(database& db, const schema& schema, variable_specifications& bound_names,
+ void prepare_conditions(database& db, const schema& schema, raw_prepare_metadata& meta,
cql3::statements::modification_statement& stmt) const;
};
diff --git a/cql3/statements/raw/parsed_statement.cc b/cql3/statements/raw/parsed_statement.cc
index dc58ef7811..b44132b8a1 100644
--- a/cql3/statements/raw/parsed_statement.cc
+++ b/cql3/statements/raw/parsed_statement.cc
@@ -53,17 +53,17 @@ namespace raw {
parsed_statement::~parsed_statement()
{ }
-variable_specifications& parsed_statement::get_bound_variables() {
- return _variables;
+raw_prepare_metadata& parsed_statement::get_prepare_metadata() {
+ return _prep_meta;
}
-const variable_specifications& parsed_statement::get_bound_variables() const {
- return _variables;
+const raw_prepare_metadata& parsed_statement::get_prepare_metadata() const {
+ return _prep_meta;
}
// Used by the parser and preparable statement
void parsed_statement::set_bound_variables(const std::vector<::shared_ptr<column_identifier>>& bound_names) {
- _variables.set_bound_variables(bound_names);
+ _prep_meta.set_bound_variables(bound_names);
}
}
@@ -74,12 +74,12 @@ prepared_statement::prepared_statement(::shared_ptr<cql_statement> statement_, s
, partition_key_bind_indices(std::move(partition_key_bind_indices))
{ }
-prepared_statement::prepared_statement(::shared_ptr<cql_statement> statement_, const variable_specifications& names, const std::vector<uint16_t>& partition_key_bind_indices)
- : prepared_statement(statement_, names.get_specifications(), partition_key_bind_indices)
+prepared_statement::prepared_statement(::shared_ptr<cql_statement> statement_, const raw_prepare_metadata& meta, const std::vector<uint16_t>& partition_key_bind_indices)
+ : prepared_statement(statement_, meta.get_variable_specifications(), partition_key_bind_indices)
{ }
-prepared_statement::prepared_statement(::shared_ptr<cql_statement> statement_, variable_specifications&& names, std::vector<uint16_t>&& partition_key_bind_indices)
- : prepared_statement(statement_, std::move(names).get_specifications(), std::move(partition_key_bind_indices))
+prepared_statement::prepared_statement(::shared_ptr<cql_statement> statement_, raw_prepare_metadata&& meta, std::vector<uint16_t>&& partition_key_bind_indices)
+ : prepared_statement(statement_, std::move(meta).get_variable_specifications(), std::move(partition_key_bind_indices))
{ }
prepared_statement::prepared_statement(::shared_ptr<cql_statement>&& statement_)
diff --git a/cql3/statements/raw/parsed_statement.hh b/cql3/statements/raw/parsed_statement.hh
index 3643a7e9ab..a508b7f4a2 100644
--- a/cql3/statements/raw/parsed_statement.hh
+++ b/cql3/statements/raw/parsed_statement.hh
@@ -41,7 +41,7 @@
#pragma once
-#include "cql3/variable_specifications.hh"
+#include "cql3/raw_prepare_metadata.hh"
#include "cql3/column_specification.hh"
#include <seastar/core/shared_ptr.hh>
@@ -64,13 +64,13 @@ namespace raw {
class parsed_statement {
protected:
- variable_specifications _variables;
+ raw_prepare_metadata _prep_meta;
public:
virtual ~parsed_statement();
- variable_specifications& get_bound_variables();
- const variable_specifications& get_bound_variables() const;
+ raw_prepare_metadata& get_prepare_metadata();
+ const raw_prepare_metadata& get_prepare_metadata() const;
void set_bound_variables(const std::vector<::shared_ptr<column_identifier>>& bound_names);
diff --git a/cql3/statements/raw/select_statement.hh b/cql3/statements/raw/select_statement.hh
index 9c6bcb0df1..c396cb2261 100644
--- a/cql3/statements/raw/select_statement.hh
+++ b/cql3/statements/raw/select_statement.hh
@@ -127,13 +127,13 @@ class select_statement : public cf_statement
::shared_ptr<restrictions::statement_restrictions> prepare_restrictions(
database& db,
schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
::shared_ptr<selection::selection> selection,
bool for_view = false,
bool allow_filtering = false);
/** Returns a ::shared_ptr<term> for the limit or null if no limit is set */
- ::shared_ptr<term> prepare_limit(database& db, variable_specifications& bound_names, ::shared_ptr<term::raw> limit);
+ ::shared_ptr<term> prepare_limit(database& db, raw_prepare_metadata& meta, ::shared_ptr<term::raw> limit);
static void verify_ordering_is_allowed(const restrictions::statement_restrictions& restrictions);
diff --git a/cql3/statements/raw/update_statement.hh b/cql3/statements/raw/update_statement.hh
index d03aa055ef..a1b25c516c 100644
--- a/cql3/statements/raw/update_statement.hh
+++ b/cql3/statements/raw/update_statement.hh
@@ -81,7 +81,7 @@ class update_statement : public raw::modification_statement {
conditions_vector conditions, bool if_exists);
protected:
virtual ::shared_ptr<cql3::statements::modification_statement> prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const override;
};
}
diff --git a/cql3/statements/select_statement.cc b/cql3/statements/select_statement.cc
index c25d1c7418..ce0f176ceb 100644
--- a/cql3/statements/select_statement.cc
+++ b/cql3/statements/select_statement.cc
@@ -1402,7 +1402,7 @@ void select_statement::maybe_jsonize_select_clause(database& db, schema_ptr sche
std::unique_ptr<prepared_statement> select_statement::prepare(database& db, cql_stats& stats, bool for_view) {
schema_ptr schema = validation::validate_column_family(db, keyspace(), column_family());
- variable_specifications& bound_names = get_bound_variables();
+ raw_prepare_metadata& meta = get_prepare_metadata();
maybe_jsonize_select_clause(db, schema);
@@ -1410,7 +1410,7 @@ std::unique_ptr<prepared_statement> select_statement::prepare(database& db, cql_
? selection::selection::wildcard(schema)
: selection::selection::from_selectors(db, schema, _select_clause);
- auto restrictions = prepare_restrictions(db, schema, bound_names, selection, for_view, _parameters->allow_filtering());
+ auto restrictions = prepare_restrictions(db, schema, meta, selection, for_view, _parameters->allow_filtering());
if (_parameters->is_distinct()) {
validate_distinct_selection(*schema, *selection, *restrictions);
@@ -1432,53 +1432,53 @@ std::unique_ptr<prepared_statement> select_statement::prepare(database& db, cql_
::shared_ptr<cql3::statements::select_statement> stmt;
auto prepared_attrs = _attrs->prepare(db, keyspace(), column_family());
- prepared_attrs->collect_marker_specification(bound_names);
+ prepared_attrs->collect_prepare_metadata(meta);
if (restrictions->uses_secondary_indexing()) {
stmt = indexed_table_select_statement::prepare(
db,
schema,
- bound_names.size(),
+ meta.bound_variables_size(),
_parameters,
std::move(selection),
std::move(restrictions),
std::move(group_by_cell_indices),
is_reversed_,
std::move(ordering_comparator),
- prepare_limit(db, bound_names, _limit),
- prepare_limit(db, bound_names, _per_partition_limit),
+ prepare_limit(db, meta, _limit),
+ prepare_limit(db, meta, _per_partition_limit),
stats,
std::move(prepared_attrs));
} else {
stmt = ::make_shared<cql3::statements::primary_key_select_statement>(
schema,
- bound_names.size(),
+ meta.bound_variables_size(),
_parameters,
std::move(selection),
std::move(restrictions),
std::move(group_by_cell_indices),
is_reversed_,
std::move(ordering_comparator),
- prepare_limit(db, bound_names, _limit),
- prepare_limit(db, bound_names, _per_partition_limit),
+ prepare_limit(db, meta, _limit),
+ prepare_limit(db, meta, _per_partition_limit),
stats,
std::move(prepared_attrs));
}
- auto partition_key_bind_indices = bound_names.get_partition_key_bind_indexes(*schema);
+ auto partition_key_bind_indices = meta.get_partition_key_bind_indexes(*schema);
- return std::make_unique<prepared_statement>(std::move(stmt), bound_names, std::move(partition_key_bind_indices));
+ return std::make_unique<prepared_statement>(std::move(stmt), meta, std::move(partition_key_bind_indices));
}
::shared_ptr<restrictions::statement_restrictions>
select_statement::prepare_restrictions(database& db,
schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
::shared_ptr<selection::selection> selection,
bool for_view,
bool allow_filtering)
{
try {
- return ::make_shared<restrictions::statement_restrictions>(db, schema, statement_type::SELECT, std::move(_where_clause), bound_names,
+ return ::make_shared<restrictions::statement_restrictions>(db, schema, statement_type::SELECT, std::move(_where_clause), meta,
selection->contains_only_static_columns(), for_view, allow_filtering);
} catch (const exceptions::unrecognized_entity_exception& e) {
if (contains_alias(e.entity)) {
@@ -1490,14 +1490,14 @@ select_statement::prepare_restrictions(database& db,
/** Returns a ::shared_ptr<term> for the limit or null if no limit is set */
::shared_ptr<term>
-select_statement::prepare_limit(database& db, variable_specifications& bound_names, ::shared_ptr<term::raw> limit)
+select_statement::prepare_limit(database& db, raw_prepare_metadata& meta, ::shared_ptr<term::raw> limit)
{
if (!limit) {
return {};
}
auto prep_limit = limit->prepare(db, keyspace(), limit_receiver());
- prep_limit->collect_marker_specification(bound_names);
+ prep_limit->collect_prepare_metadata(meta);
return prep_limit;
}
diff --git a/cql3/statements/update_statement.cc b/cql3/statements/update_statement.cc
index ea2de9b4e9..d39af45a8a 100644
--- a/cql3/statements/update_statement.cc
+++ b/cql3/statements/update_statement.cc
@@ -300,9 +300,9 @@ insert_statement::insert_statement(cf_name name,
::shared_ptr<cql3::statements::modification_statement>
insert_statement::prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const
{
- auto stmt = ::make_shared<cql3::statements::update_statement>(statement_type::INSERT, bound_names.size(), schema, std::move(attrs), stats);
+ auto stmt = ::make_shared<cql3::statements::update_statement>(statement_type::INSERT, meta.bound_variables_size(), schema, std::move(attrs), stats);
// Created from an INSERT
if (stmt->is_counter()) {
@@ -337,12 +337,12 @@ insert_statement::prepare_internal(database& db, schema_ptr schema,
relations.push_back(::make_shared<single_column_relation>(col, expr::oper_t::EQ, value));
} else {
auto operation = operation::set_value(value).prepare(db, keyspace(), *def);
- operation->collect_marker_specification(bound_names);
+ operation->collect_prepare_metadata(meta);
stmt->add_operation(std::move(operation));
};
}
- prepare_conditions(db, *schema, bound_names, *stmt);
- stmt->process_where_clause(db, relations, bound_names);
+ prepare_conditions(db, *schema, meta, *stmt);
+ stmt->process_where_clause(db, relations, meta);
return stmt;
}
@@ -359,16 +359,16 @@ insert_json_statement::insert_json_statement(cf_name name,
::shared_ptr<cql3::statements::modification_statement>
insert_json_statement::prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const
{
// FIXME: handle _if_not_exists. For now, mark it used to quiet the compiler. #8682
(void)_if_not_exists;
assert(dynamic_pointer_cast<constants::literal>(_json_value) || dynamic_pointer_cast<abstract_marker::raw>(_json_value));
auto json_column_placeholder = ::make_shared<column_identifier>("", true);
auto prepared_json_value = _json_value->prepare(db, "", make_lw_shared<column_specification>("", "", json_column_placeholder, utf8_type));
- prepared_json_value->collect_marker_specification(bound_names);
- auto stmt = ::make_shared<cql3::statements::insert_prepared_json_statement>(bound_names.size(), schema, std::move(attrs), stats, std::move(prepared_json_value), _default_unset);
- prepare_conditions(db, *schema, bound_names, *stmt);
+ prepared_json_value->collect_prepare_metadata(meta);
+ auto stmt = ::make_shared<cql3::statements::insert_prepared_json_statement>(meta.bound_variables_size(), schema, std::move(attrs), stats, std::move(prepared_json_value), _default_unset);
+ prepare_conditions(db, *schema, meta, *stmt);
return stmt;
}
@@ -384,9 +384,9 @@ update_statement::update_statement(cf_name name,
::shared_ptr<cql3::statements::modification_statement>
update_statement::prepare_internal(database& db, schema_ptr schema,
- variable_specifications& bound_names, std::unique_ptr<attributes> attrs, cql_stats& stats) const
+ raw_prepare_metadata& meta, std::unique_ptr<attributes> attrs, cql_stats& stats) const
{
- auto stmt = ::make_shared<cql3::statements::update_statement>(statement_type::UPDATE, bound_names.size(), schema, std::move(attrs), stats);
+ auto stmt = ::make_shared<cql3::statements::update_statement>(statement_type::UPDATE, meta.bound_variables_size(), schema, std::move(attrs), stats);
for (auto&& entry : _updates) {
auto id = entry.first->prepare_column_identifier(*schema);
@@ -396,15 +396,15 @@ update_statement::prepare_internal(database& db, schema_ptr schema,
}
auto operation = entry.second->prepare(db, keyspace(), *def);
- operation->collect_marker_specification(bound_names);
+ operation->collect_prepare_metadata(meta);
if (def->is_primary_key()) {
throw exceptions::invalid_request_exception(format("PRIMARY KEY part {} found in SET part", *entry.first));
}
stmt->add_operation(std::move(operation));
}
- prepare_conditions(db, *schema, bound_names, *stmt);
- stmt->process_where_clause(db, _where_clause, bound_names);
+ prepare_conditions(db, *schema, meta, *stmt);
+ stmt->process_where_clause(db, _where_clause, meta);
return stmt;
}
diff --git a/cql3/term.hh b/cql3/term.hh
index 145da86f15..3837c5ba4c 100644
--- a/cql3/term.hh
+++ b/cql3/term.hh
@@ -48,7 +48,7 @@
namespace cql3 {
class terminal;
-class variable_specifications;
+class raw_prepare_metadata;
/**
* A CQL3 term, i.e. a column value with or without bind variables.
@@ -68,7 +68,7 @@ class term : public ::enable_shared_from_this<term> {
* @param boundNames the variables specification where to collect the
* bind variables of this term in.
*/
- virtual void collect_marker_specification(variable_specifications& bound_names) const = 0;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const = 0;
/**
* Bind the values in this term to the values contained in {@code values}.
@@ -161,7 +161,7 @@ class term : public ::enable_shared_from_this<term> {
*/
class terminal : public term {
public:
- virtual void collect_marker_specification(variable_specifications& bound_names) const {
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const {
}
virtual ::shared_ptr<terminal> bind(const query_options& options) override {
diff --git a/cql3/token_relation.cc b/cql3/token_relation.cc
index 5a6e612f83..20bab49388 100644
--- a/cql3/token_relation.cc
+++ b/cql3/token_relation.cc
@@ -81,10 +81,10 @@ std::vector<lw_shared_ptr<cql3::column_specification>> cql3::token_relation::to_
::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_EQ_restriction(
database& db, schema_ptr schema,
- variable_specifications& bound_names) {
+ raw_prepare_metadata& meta) {
auto column_defs = get_column_definitions(*schema);
auto term = to_term(to_receivers(*schema, column_defs), *_value, db,
- schema->ks_name(), bound_names);
+ schema->ks_name(), meta);
auto r = ::make_shared<restrictions::token_restriction>(column_defs);
using namespace expr;
r->expression = binary_operator{token{}, oper_t::EQ, std::move(term)};
@@ -93,7 +93,7 @@ ::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_EQ_restr
::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_IN_restriction(
database& db, schema_ptr schema,
- variable_specifications& bound_names) {
+ raw_prepare_metadata& meta) {
throw exceptions::invalid_request_exception(
format("{} cannot be used with the token function",
get_operator()));
@@ -101,12 +101,12 @@ ::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_IN_restr
::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_slice_restriction(
database& db, schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
statements::bound bound,
bool inclusive) {
auto column_defs = get_column_definitions(*schema);
auto term = to_term(to_receivers(*schema, column_defs), *_value, db,
- schema->ks_name(), bound_names);
+ schema->ks_name(), meta);
auto r = ::make_shared<restrictions::token_restriction>(column_defs);
using namespace expr;
r->expression = binary_operator{token{}, pick_operator(bound, inclusive), std::move(term)};
@@ -115,14 +115,14 @@ ::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_slice_re
::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_contains_restriction(
database& db, schema_ptr schema,
- variable_specifications& bound_names, bool isKey) {
+ raw_prepare_metadata& meta, bool isKey) {
throw exceptions::invalid_request_exception(
format("{} cannot be used with the token function",
get_operator()));
}
::shared_ptr<cql3::restrictions::restriction> cql3::token_relation::new_LIKE_restriction(
- database&, schema_ptr, variable_specifications&) {
+ database&, schema_ptr, raw_prepare_metadata&) {
throw exceptions::invalid_request_exception("LIKE cannot be used with the token function");
}
@@ -133,9 +133,9 @@ sstring cql3::token_relation::to_string() const {
::shared_ptr<cql3::term> cql3::token_relation::to_term(
const std::vector<lw_shared_ptr<column_specification>>& receivers,
const term::raw& raw, database& db, const sstring& keyspace,
- variable_specifications& bound_names) const {
+ raw_prepare_metadata& meta) const {
auto term = raw.prepare(db, keyspace, receivers.front());
- term->collect_marker_specification(bound_names);
+ term->collect_prepare_metadata(meta);
return term;
}
diff --git a/cql3/token_relation.hh b/cql3/token_relation.hh
index 7a986de41d..5e50fc1021 100644
--- a/cql3/token_relation.hh
+++ b/cql3/token_relation.hh
@@ -98,25 +98,25 @@ class token_relation : public relation {
::shared_ptr<restrictions::restriction> new_EQ_restriction(database& db,
schema_ptr schema,
- variable_specifications& bound_names) override;
+ raw_prepare_metadata& meta) override;
::shared_ptr<restrictions::restriction> new_IN_restriction(database& db,
schema_ptr schema,
- variable_specifications& bound_names) override;
+ raw_prepare_metadata& meta) override;
::shared_ptr<restrictions::restriction> new_slice_restriction(database& db,
schema_ptr schema,
- variable_specifications& bound_names,
+ raw_prepare_metadata& meta,
statements::bound bound,
bool inclusive) override;
::shared_ptr<restrictions::restriction> new_contains_restriction(
database& db, schema_ptr schema,
- variable_specifications& bound_names, bool isKey) override;
+ raw_prepare_metadata& meta, bool isKey) override;
::shared_ptr<restrictions::restriction> new_LIKE_restriction(database& db,
schema_ptr schema,
- variable_specifications& bound_names) override;
+ raw_prepare_metadata& meta) override;
::shared_ptr<relation> maybe_rename_identifier(const column_identifier::raw& from, column_identifier::raw to) override;
@@ -127,7 +127,7 @@ class token_relation : public relation {
const term::raw& raw,
database& db,
const sstring& keyspace,
- variable_specifications& bound_names) const override;
+ raw_prepare_metadata& meta) const override;
};
}
diff --git a/cql3/tuples.hh b/cql3/tuples.hh
index 4ef78d6029..5bbc6fcab3 100644
--- a/cql3/tuples.hh
+++ b/cql3/tuples.hh
@@ -153,9 +153,9 @@ class tuples {
return std::any_of(_elements.begin(), _elements.end(), std::mem_fn(&term::contains_bind_marker));
}
- virtual void collect_marker_specification(variable_specifications& bound_names) const override {
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const override {
for (auto&& term : _elements) {
- term->collect_marker_specification(bound_names);
+ term->collect_prepare_metadata(meta);
}
}
private:
diff --git a/cql3/user_types.cc b/cql3/user_types.cc
index 309ab0e57a..e76463f06a 100644
--- a/cql3/user_types.cc
+++ b/cql3/user_types.cc
@@ -185,9 +185,9 @@ bool user_types::delayed_value::contains_bind_marker() const {
return boost::algorithm::any_of(_values, std::mem_fn(&term::contains_bind_marker));
}
-void user_types::delayed_value::collect_marker_specification(variable_specifications& bound_names) const {
+void user_types::delayed_value::collect_prepare_metadata(raw_prepare_metadata& meta) const {
for (auto&& v : _values) {
- v->collect_marker_specification(bound_names);
+ v->collect_prepare_metadata(meta);
}
}
diff --git a/cql3/user_types.hh b/cql3/user_types.hh
index 6186befe4a..f66a531cec 100644
--- a/cql3/user_types.hh
+++ b/cql3/user_types.hh
@@ -93,7 +93,7 @@ class user_types {
public:
delayed_value(user_type type, std::vector<shared_ptr<term>> values);
virtual bool contains_bind_marker() const override;
- virtual void collect_marker_specification(variable_specifications& bound_names) const;
+ virtual void collect_prepare_metadata(raw_prepare_metadata& meta) const;
private:
std::vector<managed_bytes_opt> bind_internal(const query_options& options);
public:
diff --git a/test/boost/statement_restrictions_test.cc b/test/boost/statement_restrictions_test.cc
index c5fa60f9d6..3546cbba6d 100644
--- a/test/boost/statement_restrictions_test.cc
+++ b/test/boost/statement_restrictions_test.cc
@@ -39,13 +39,13 @@ namespace {
query::clustering_row_ranges slice(
const std::vector<relation_ptr>& where_clause, cql_test_env& env,
const sstring& table_name = "t", const sstring& keyspace_name = "ks") {
- variable_specifications bound_names;
+ raw_prepare_metadata meta;
return restrictions::statement_restrictions(
env.local_db(),
env.local_db().find_schema(keyspace_name, table_name),
statements::statement_type::SELECT,
where_clause,
- bound_names,
+ meta,
/*contains_only_static_columns=*/false,
/*for_view=*/false,
/*allow_filtering=*/true)
--
2.31.1