![]() |
Kea 2.0.2
|
Cassandra Exchange. More...
#include <cql_exchange.h>
Inheritance diagram for isc::db::CqlExchange:Public Member Functions | |
| CqlExchange () | |
| Constructor. More... | |
| virtual | ~CqlExchange () |
| Destructor. More... | |
| virtual void | createBindForSelect (AnyArray &data, StatementTag statement_tag=NULL)=0 |
| Create BIND array to receive C++ data. More... | |
| void | executeMutation (const CqlConnection &connection, const AnyArray &assigned_values, StatementTag statement_tag) |
| Executes INSERT, UPDATE or DELETE statements. More... | |
| AnyArray | executeSelect (const CqlConnection &connection, const AnyArray &where_values, StatementTag statement_tag, const bool &single=false) |
| Executes SELECT statements. More... | |
| virtual boost::any | retrieve ()=0 |
| Copy received data into the derived class' object. More... | |
| bool | statementApplied (CassFuture *future, size_t *row_count=NULL, size_t *column_count=NULL) |
| Check if CQL statement has been applied. More... | |
Public Member Functions inherited from isc::db::SqlExchange | |
| SqlExchange () | |
| Constructor. More... | |
| virtual | ~SqlExchange () |
| Destructor. More... | |
Static Public Member Functions | |||||||
Time conversion: | |||||||
Converts time to Cassandra format
| |||||||
| static void | convertToDatabaseTime (const time_t &cltt, const uint32_t &valid_lifetime, cass_int64_t &expire) | ||||||
| static void | convertFromDatabaseTime (const cass_int64_t &expire, const cass_int64_t &valid_lifetime, time_t &cltt) | ||||||
| Converts time from Cassandra format. More... | |||||||
Cassandra Exchange.
Used to convert between Cassandra CQL and C++ data types. A different exchange is made for every distinct set of columns. Multiple tables may use the same exchange if they have the same columns.
Definition at line 142 of file cql_exchange.h.
| isc::db::CqlExchange::CqlExchange | ( | ) |
Constructor.
Empty body. Derived constructors specify table columns.
Definition at line 736 of file cql_exchange.cc.
|
virtual |
Destructor.
Definition at line 739 of file cql_exchange.cc.
|
static |
Converts time from Cassandra format.
| expire | expiration time in Cassandra format |
| valid_lifetime | lifetime of a lease |
| cltt | client last transmission time (result will be stored here) |
Definition at line 754 of file cql_exchange.cc.
Referenced by isc::dhcp::CqlLease4Exchange::retrieve(), and isc::dhcp::CqlLease6Exchange::retrieve().
|
static |
Definition at line 743 of file cql_exchange.cc.
Referenced by isc::dhcp::CqlLease4Exchange::createBindForDelete(), isc::dhcp::CqlLease6Exchange::createBindForDelete(), isc::dhcp::CqlLease4Exchange::createBindForInsert(), isc::dhcp::CqlLease6Exchange::createBindForInsert(), isc::dhcp::CqlLease4Exchange::createBindForUpdate(), and isc::dhcp::CqlLease6Exchange::createBindForUpdate().
|
pure virtual |
Create BIND array to receive C++ data.
Used in executeSelect() to retrieve from database
| data | array of bound objects representing data to be retrieved |
| statement_tag | prepared statement being executed; defaults to an invalid index |
Implemented in isc::db::CqlVersionExchange, isc::dhcp::CqlHostExchange, isc::dhcp::CqlLease4Exchange, isc::dhcp::CqlLease6Exchange, and isc::dhcp::CqlLeaseExchange.
Referenced by executeSelect().
| void isc::db::CqlExchange::executeMutation | ( | const CqlConnection & | connection, |
| const AnyArray & | assigned_values, | ||
| StatementTag | statement_tag | ||
| ) |
Executes INSERT, UPDATE or DELETE statements.
| connection | connection used to communicate with the Cassandra database |
| assigned_values | array of bound objects to be used when inserting values |
| statement_tag | prepared statement being executed applied, could be different for commit than it is for rollback |
Definition at line 874 of file cql_exchange.cc.
References isc::db::CqlCommon::bindData(), isc::db::CqlConnection::checkFutureError(), isc::db::CqlConnection::consistency_, isc::db::error, isc::db::CqlConnection::force_consistency_, isc_throw, isc::db::CqlTaggedStatement::name_, isc::db::CqlTaggedStatement::prepared_statement_, isc::db::CqlConnection::serial_consistency_, isc::db::CqlConnection::session_, statementApplied(), and isc::db::CqlConnection::statements_.
Here is the call graph for this function:| AnyArray isc::db::CqlExchange::executeSelect | ( | const CqlConnection & | connection, |
| const AnyArray & | where_values, | ||
| StatementTag | statement_tag, | ||
| const bool & | single = false |
||
| ) |
Executes SELECT statements.
| connection | connection used to communicate with the Cassandra database |
| where_values | array of bound objects used to filter the results |
| statement_tag | prepared statement being executed |
| single | true if a single row should be returned; by default, multiple rows are allowed |
| DbOperationError | |
| MultipleRecords |
Definition at line 762 of file cql_exchange.cc.
References isc::db::AnyArray::add(), isc::db::CqlCommon::bindData(), isc::db::CqlConnection::checkFutureError(), isc::db::CqlConnection::consistency_, createBindForSelect(), isc::db::error, isc::db::CqlConnection::force_consistency_, isc::db::CqlCommon::getData(), isc::db::CqlTaggedStatement::is_raw_, isc_throw, isc::db::CqlTaggedStatement::name_, isc::db::CqlTaggedStatement::prepared_statement_, retrieve(), isc::db::CqlConnection::serial_consistency_, isc::db::CqlConnection::session_, and isc::db::CqlConnection::statements_.
Referenced by isc::dhcp::CqlLease4Exchange::getLeaseCollection(), isc::dhcp::CqlLease6Exchange::getLeaseCollection(), and isc::db::CqlVersionExchange::retrieveVersion().
Here is the call graph for this function:
|
pure virtual |
Copy received data into the derived class' object.
Copies information about the entity to be retrieved into a holistic object. Called in executeSelect(). Not implemented for base class CqlExchange. To be implemented in derived classes.
Implemented in isc::db::CqlVersionExchange, isc::dhcp::CqlHostExchange, isc::dhcp::CqlLease4Exchange, isc::dhcp::CqlLease6Exchange, and isc::dhcp::CqlLeaseExchange.
Referenced by executeSelect().
| bool isc::db::CqlExchange::statementApplied | ( | CassFuture * | future, |
| size_t * | row_count = NULL, |
||
| size_t * | column_count = NULL |
||
| ) |
Check if CQL statement has been applied.
| future | structure used to wait on statement executions |
| row_count | number of rows returned |
| column_count | number of columns queried |
On insert, a false [applied] means there is a duplicate entry with the same primary key.
Definition at line 953 of file cql_exchange.cc.
References isc::db::AnyArray::add(), isc::db::CqlCommon::getData(), and isc_throw.
Referenced by executeMutation().
Here is the call graph for this function: