SearchSECODatabaseAPI
DatabaseUtility Class Reference

Implements generic database functionality. More...

#include <DatabaseUtility.h>

Static Public Member Functions

static CassSession * connect (std::string ip, int port, std::string keyspace)
 Establishes a connection to the database. More...
 
static const CassPrepared * prepareStatement (CassSession *connection, std::string query)
 Prepares a specified statement (query) to be executed later. More...
 
static std::string getString (const CassRow *row, const char *column)
 Retrieves a string in a column and some row. More...
 
static int getInt32 (const CassRow *row, const char *column)
 Retrieves a 32-bit integer from a row. More...
 
static long long getInt64 (const CassRow *row, const char *column)
 Retrieves a 64-bit integer from a row. More...
 
static std::string getUUID (const CassRow *row, const char *column)
 Retrieves a UUID from a row and converts it to a string. More...
 

Detailed Description

Implements generic database functionality.

Member Function Documentation

◆ connect()

CassSession * DatabaseUtility::connect ( std::string  ip,
int  port,
std::string  keyspace 
)
static

Establishes a connection to the database.

Parameters
connectionPointer to the connection variable to write to.
ipThe ip in string format.
portThe portnumber to connect to.
keyspaceThe keyspace to connect to.

◆ getInt32()

int DatabaseUtility::getInt32 ( const CassRow *  row,
const char *  column 
)
static

Retrieves a 32-bit integer from a row.

Parameters
rowThe corresponding row.
columnThe corresponding column.

◆ getInt64()

long long DatabaseUtility::getInt64 ( const CassRow *  row,
const char *  column 
)
static

Retrieves a 64-bit integer from a row.

Parameters
rowThe corresponding row.
columnThe corresponding column.

◆ getString()

std::string DatabaseUtility::getString ( const CassRow *  row,
const char *  column 
)
static

Retrieves a string in a column and some row.

Parameters
rowThe corresponding row.
columnThe corresponding column.

◆ getUUID()

std::string DatabaseUtility::getUUID ( const CassRow *  row,
const char *  column 
)
static

Retrieves a UUID from a row and converts it to a string.

Parameters
rowThe corresponding row.
columnThe corresponding column.

◆ prepareStatement()

const CassPrepared * DatabaseUtility::prepareStatement ( CassSession *  connection,
std::string  query 
)
static

Prepares a specified statement (query) to be executed later.

Parameters
connectionThe connection to prepare the statement on.
queryA string containing the CQL-query to be executed later.
Returns
The constant prepared statement that allows us to execute the query given as input.

The documentation for this class was generated from the following files: