DUNE: Uniform Navigational Environment  2016.05.0
DUNE::Database::Connection Class Reference

Detailed Description

Database connection.

Public Member Functions

 Connection (const char *path, bool create=false)
 
 ~Connection ()
 
void execute (const char *sql_stmt, int *count=0)
 
void beginTransaction (void)
 
void commit (void)
 
void rollback (void)
 
const char * lastError (void)
 
DB_HANDLEhandle (void)
 

Static Public Attributes

static const char * c_memory_db
 

Constructor & Destructor Documentation

DUNE::Database::Connection::Connection ( const char *  path,
bool  create = false 
)

Constructor.

Parameters
pathdatabase file
createcreate database if it does not exist

References lastError(), and DUNE::Database::Statement.

DUNE::Database::Connection::~Connection ( void  )

Destructor.

Member Function Documentation

void DUNE::Database::Connection::beginTransaction ( void  )

Begin transaction.

References DUNE::Database::Statement::execute().

void DUNE::Database::Connection::commit ( void  )

Commit (end) current transaction.

References DUNE::Database::Statement::execute().

void DUNE::Database::Connection::execute ( const char *  sql_stmt,
int *  count = 0 
)

Execute an SQL statement directly and optionally obtain the number of affected rows for (INSERT, UPDATE, and DELETE statements).

Parameters
sql_stmtSQL statement
countoptional argument to get number of affected rows
DB_HANDLE* DUNE::Database::Connection::handle ( void  )
inline

Get internal database connection handle.

This is for use by other classes in the package.

Referenced by DUNE::Database::Statement::execute(), and DUNE::Database::Statement::Statement().

const char * DUNE::Database::Connection::lastError ( void  )

Get description of last error.

Returns
description of last database error.

Referenced by Connection().

void DUNE::Database::Connection::rollback ( void  )

Rollback current transaction.

References DUNE::Database::Statement::execute().

Member Data Documentation

const char * DUNE::Database::Connection::c_memory_db
static

Identifier to use for temporary, memory-only based databases.

Collaboration diagram for DUNE::Database::Connection:
Collaboration graph