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