19 #ifndef CQL_CONNECTION_H
20 #define CQL_CONNECTION_H
24 #include <cassandra.h>
30 #include <unordered_map>
77 : name_(name), text_(text), prepared_statement_(NULL), is_raw_(false) {
85 : name_(name), text_(text), prepared_statement_(NULL), is_raw_(is_raw) {
94 return std::hash<std::string>{}(std::string(key));
100 bool operator()(StatementTag
const& lhs, StatementTag
const& rhs)
const {
101 return std::strcmp(lhs, rhs) == 0;
106 typedef std::unordered_map<
StatementTag, CqlTaggedStatement,
140 static std::pair<uint32_t, uint32_t>
179 CassConsistency consistency,
180 CassConsistency serial_consistency);
204 static const std::string
207 StatementTag statement_tag = NULL);
240 #endif // CQL_CONNECTION_H
bool operator()(StatementTag const &lhs, StatementTag const &rhs) const
StatementMap statements_
Pointer to external array of tagged statements containing statement name, array of names of bind para...
static std::pair< uint32_t, uint32_t > getVersion(const ParameterMap ¶meters)
Get the schema version.
constexpr uint32_t CQL_DRIVER_VERSION_MAJOR
Define CQL backend version.
StatementTag name_
Short description of the query.
virtual void commit()
Commit Transactions.
const CassPrepared * prepared_statement_
Internal Cassandra object representing the prepared statement.
bool force_consistency_
CQL consistency enabled.
void startTransaction()
Start transaction.
void prepareStatements(StatementMap &statements)
Prepare statements.
void openDatabase()
Open database.
constexpr uint32_t CQL_DRIVER_VERSION_MINOR
virtual void rollback()
Rollback Transactions.
Common database connection class.
virtual ~CqlConnection()
Destructor.
char const *const StatementTag
Statement index representing the statement name.
size_t operator()(StatementTag const &key) const
CqlTaggedStatement(StatementTag name, char const *const text, bool const &is_raw)
Constructor.
const CassKeyspaceMeta * keyspace_meta_
Keyspace meta information, used for UDTs.
void setConsistency(bool force, CassConsistency consistency, CassConsistency serial_consistency)
Set consistency.
Defines a single statement or query.
CassConsistency consistency_
CQL consistency.
CassSession * session_
CQL session handle.
static CassConsistency parseConsistency(std::string value)
parse Consistency value
std::pair< uint32_t, uint32_t > VersionPair
Pair containing major and minor versions.
CassCluster * cluster_
CQL connection handle.
constexpr uint32_t CQL_SCHEMA_VERSION_MAJOR
Define CQL schema version: 5.0.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Equality function for StatementMap keys.
CqlTaggedStatement(StatementTag name, char const *const text)
Constructor.
std::shared_ptr< CqlConnection > CqlConnectionPtr
Hash function for StatementMap keys.
std::unordered_map< StatementTag, CqlTaggedStatement, StatementTagHash, StatementTagEqual > StatementMap
A container for all statements.
CassConsistency serial_consistency_
CQL serial consistency.
constexpr uint32_t CQL_SCHEMA_VERSION_MINOR
const CassSchemaMeta * schema_meta_
Common CQL connector pool.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
static const std::string checkFutureError(const std::string &what, CassFuture *future, StatementTag statement_tag=NULL)
Check for errors.
std::pair< StatementTag, CqlTaggedStatement > StatementMapEntry
A type for a single entry on the statements map.
bool is_raw_
Should the statement be executed raw or with binds?
CqlConnection(const ParameterMap ¶meters)
Constructor.
char const *const text_
Text representation of the actual query.