DUNE: Uniform Navigational Environment
2019.02.1
|
Database connection.
Public Types |
Public Member Functions | |
Connection (int flags) | |
Connection (const char *path, int flags) | |
~Connection (void) | |
void | execute (const char *sql_stmt, int *count=0) |
void | beginTransaction (void) |
void | commit (void) |
void | rollback (void) |
const char * | lastError (void) |
DB_HANDLE * | handle (void) |
Connection flags.
Enumerator | |
---|---|
CF_RDONLY |
Open read-only connection. |
CF_CREATE |
Create database if it does not exist. |
DUNE::Database::Connection::Connection | ( | int | flags | ) |
DUNE::Database::Connection::Connection | ( | const char * | path, |
int | flags | ||
) |
Constructs a file-based database.
path | database file |
flags | connection flags ( |
References CF_CREATE, CF_RDONLY, lastError(), and DUNE::Database::Statement.
DUNE::Database::Connection::~Connection | ( | void | ) |
Destructor.
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).
sql_stmt | SQL statement |
count | optional argument to get number of affected rows |
|
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.
Referenced by Connection(), and DUNE::Database::Statement::~Statement().
void DUNE::Database::Connection::rollback | ( | void | ) |
Rollback current transaction.
References DUNE::Database::Statement::execute().