25#include <boost/any.hpp>
29#include <unordered_map>
50class AnyArray :
public std::vector<boost::any> {
53 void add(
const boost::any& value);
57 void remove(
const size_t& index);
99 CassStatement* statement);
107 CassUserType* cass_user_type);
113 CassCollection* collection);
121 const CassValue* value);
160 const uint32_t& valid_lifetime,
161 cass_int64_t& expire);
168 const cass_int64_t& valid_lifetime,
198 const bool& single =
false);
223 size_t* column_count = NULL);
272 virtual boost::any
retrieve()
override;
284 cass_int32_t version_;
Structure used to bind C++ input values to dynamic CQL parameters.
void add(const boost::any &value)
Add a value at the end of the vector.
void remove(const size_t &index)
Remove the void pointer to the data value from a specified position inside the vector.
Common operations in Cassandra exchanges.
static void bindData(const AnyArray &data, CassStatement *statement)
Assigns values to every column of an INSERT or an UPDATE statement.
static void getData(const CassRow *row, AnyArray &data)
Retrieves data returned by Cassandra.
Common CQL connector pool.
CqlExchange()
Constructor.
AnyArray executeSelect(const CqlConnection &connection, const AnyArray &where_values, StatementTag statement_tag, const bool &single=false)
Executes SELECT statements.
void executeMutation(const CqlConnection &connection, const AnyArray &assigned_values, StatementTag statement_tag)
Executes INSERT, UPDATE or DELETE statements.
virtual boost::any retrieve()=0
Copy received data into the derived class' object.
virtual ~CqlExchange()
Destructor.
virtual void createBindForSelect(AnyArray &data, StatementTag statement_tag=NULL)=0
Create BIND array to receive C++ data.
bool statementApplied(CassFuture *future, size_t *row_count=NULL, size_t *column_count=NULL)
Check if CQL statement has been applied.
static void convertFromDatabaseTime(const cass_int64_t &expire, const cass_int64_t &valid_lifetime, time_t &cltt)
Converts time from Cassandra format.
static void convertToDatabaseTime(const time_t &cltt, const uint32_t &valid_lifetime, cass_int64_t &expire)
Exchange used to retrieve schema version from the keyspace.
virtual VersionPair retrieveVersion(const CqlConnection &connection)
Standalone method used to retrieve schema version.
static StatementMap tagged_statements_
Cassandra statements.
virtual ~CqlVersionExchange()
Destructor.
static constexpr StatementTag GET_VERSION
Statement tags definitions.
CqlVersionExchange()
Constructor.
virtual boost::any retrieve() override
Copy received data into the <version,minor> pair.
virtual void createBindForSelect(AnyArray &data, StatementTag statement_tag=NULL) override
Create BIND array to receive C++ data.
Base class for backend exchanges.
Udt(const CqlConnection &connection, const std::string &name)
Parameterized constructor.
const CassDataType * cass_data_type_
Internal Cassandra driver object representing a Cassandra data type.
void newUserType()
Creates the underlying container.
const CqlConnection & connection_
Connection to the Cassandra database.
CassUserType * cass_user_type_
Internal Cassandra driver object representing a user defined type.
void freeUserType()
Frees the underlying container.
const std::string name_
Name of the UDT in the schema: CREATE TYPE ___ { ... }.
AnyArray AnyCollection
Defines an array of arbitrary objects (used by Cassandra backend)
char const *const StatementTag
Statement index representing the statement name.
CassError(* CqlGetFunction)(const boost::any &data, const CassValue *value)
Converts a single Cassandra column value to a C++ object.
std::pair< uint32_t, uint32_t > VersionPair
Pair containing major and minor versions.
CassError(* CqlBindFunction)(const boost::any &value, const size_t &index, CassStatement *statement)
Binds a C++ object to a Cassandra statement's parameter.
ExchangeDataType
Used to map server data types with internal backend storage data types.
std::vector< cass_byte_t > CassBlob
Host identifier converted to Cassandra data type.
CassError(* CqlCollectionAppendFunction)(const boost::any &value, CassCollection *collection)
Sets an item in a collection.
std::unordered_map< StatementTag, CqlTaggedStatement, StatementTagHash, StatementTagEqual > StatementMap
A container for all statements.
ExchangeDataType exchangeType(const boost::any &object)
Determine exchange type based on boost::any type.
CassError(* CqlUdtSetFunction)(const boost::any &value, const size_t &index, CassUserType *cass_user_type)
Sets a member in a UDT.
Defines the logger used by the top-level component of kea-lfc.
Wrapper over the bind and get functions that interface with Cassandra.
CqlUdtSetFunction cqlUdtSetFunction_
Sets a member in a UDT. Used in INSERT & UPDATE statements.
CqlGetFunction cqlGetFunction_
Converts a single Cassandra column value to a C++ object.
CqlCollectionAppendFunction cqlCollectionAppendFunction_
Sets an item in a collection. Used in INSERT & UPDATE statements.
CqlBindFunction cqlBindFunction_
Binds a C++ object to a Cassandra statement's parameter.