Wrapper class for the actual SQLite DB object. More...
#include <SQLiteDB.h>
Public Member Functions | |
DB (LPCTSTR pFilename=NULL) | |
Default constructor - open a database file if one is received. | |
DB (const DB &db) | |
Copy constructor. | |
virtual | ~DB () |
Destructor. | |
bool | IsOpen () const |
Tests if a database was opened and connected to this wrapper. | |
bool | Open (LPCTSTR pFilename) |
Open a database file. | |
bool | Close () |
Close the current database. | |
bool | Execute (LPCTSTR pSQL) |
Perform an SQL statement. | |
bool | Execute (const std::tstring &sSQL) |
Perform an SQL statement. | |
Recordset | Query (LPCTSTR pSQL) |
Perform a SELECT SQL statement. | |
Recordset | Query (const std::tstring &sSQL) |
Perform a SELECT SQL statement. | |
Transaction | BeginTransaction (Transaction::TransactionType eType, const std::tstring &sName=_T("")) |
Start a transaction. | |
Statement | CreateStatement (LPCTSTR pStatement) |
Compile an SQL statement for this database (can contain parameters). | |
Statement | CreateStatement (const std::tstring &sStatement) |
Compile an SQL statement for this database (can contain parameters). | |
std::tstring | GetLastError () |
Retrieve the last error for operations on the wrapped database. | |
sqlite_int64 | GetLastInsertRowid () const |
Retrieve the ID of the last row added to the wrapped database. | |
bool | operator!= (const DB &db) const |
Deferential operator. | |
Static Public Member Functions | |
static std::string | printf (const char *pString,...) |
Helper function for creating statements in an SQL-safe way. | |
Protected Member Functions | |
DB (RealDB *pDB) | |
Constructor from an actual database object. | |
void | AddRef () const |
Adds a reference to the actual database object. | |
void | DecRef () const |
Deletes a reference to the actual database object (can delete the object). | |
Protected Attributes | |
RealDB * | m_pDB |
Pointer to the actual database object. |
Wrapper class for the actual SQLite DB object.
Definition at line 454 of file SQLiteDB.h.
SQLite::DB::DB | ( | LPCTSTR | pFilename = NULL |
) |
Default constructor - open a database file if one is received.
pFilename | File to open |
Definition at line 977 of file SQLiteDB.cpp.
SQLite::DB::DB | ( | const DB & | db | ) | [inline] |
Copy constructor.
db | The database wrapper object to copy |
Definition at line 464 of file SQLiteDB.h.
References AddRef().
SQLite::DB::DB | ( | RealDB * | pDB | ) | [inline, protected] |
Constructor from an actual database object.
pDB | Pointer to the actual database object |
Definition at line 474 of file SQLiteDB.h.
References AddRef().
Transaction SQLite::DB::BeginTransaction | ( | Transaction::TransactionType | eType, | |
const std::tstring & | sName = _T("") | |||
) |
Start a transaction.
eType | Type of transaction to start | |
sName | The name of the transaction (can be NULL) |
Definition at line 1033 of file SQLiteDB.cpp.
References m_pDB.
bool SQLite::DB::Close | ( | ) |
Close the current database.
Definition at line 1003 of file SQLiteDB.cpp.
References SQLite::RealDB::Close(), and m_pDB.
Statement SQLite::DB::CreateStatement | ( | const std::tstring & | sStatement | ) | [inline] |
Compile an SQL statement for this database (can contain parameters).
sStatement | The statement to compile |
Definition at line 521 of file SQLiteDB.h.
References CreateStatement().
Referenced by CreateStatement().
Statement SQLite::DB::CreateStatement | ( | LPCTSTR | pStatement | ) |
Compile an SQL statement for this database (can contain parameters).
pStatement | The SQL statement to prepare for the database |
Definition at line 1042 of file SQLiteDB.cpp.
References m_pDB.
bool SQLite::DB::Execute | ( | const std::tstring & | sSQL | ) | [inline] |
Perform an SQL statement.
sSQL | The statement to perform |
Definition at line 503 of file SQLiteDB.h.
References Execute().
Referenced by Execute().
bool SQLite::DB::Execute | ( | LPCTSTR | pSQL | ) |
Perform an SQL statement.
pSQL | SQL statement to perform |
Definition at line 1012 of file SQLiteDB.cpp.
References SQLite::RealDB::Execute(), and m_pDB.
Referenced by SQLite::RealTransaction::Close(), SQLite::RealTransaction::Commit(), SQLite::RealTransaction::Execute(), SQLite::RealTransaction::Rollback(), and SQLite::RealTransaction::StartTransaction().
std::tstring SQLite::DB::GetLastError | ( | ) |
Retrieve the last error for operations on the wrapped database.
Definition at line 1050 of file SQLiteDB.cpp.
References SQLite::RealDB::GetLastError(), and m_pDB.
Referenced by SQLite::RealStatement::BindParameter(), SQLite::RealTransaction::Commit(), DoLicensePage(), SQLite::RealStatement::Execute(), SQLite::RealTransaction::Execute(), SQLite::RealTransaction::Query(), SQLite::Realset::Realset(), SQLite::RealStatement::Reset(), and SQLite::RealTransaction::Rollback().
sqlite_int64 SQLite::DB::GetLastInsertRowid | ( | ) | const |
Retrieve the ID of the last row added to the wrapped database.
Definition at line 1099 of file SQLiteDB.cpp.
References SQLite::RealDB::GetLastInsertRowid(), and m_pDB.
Referenced by SQLite::RealStatement::Execute().
bool SQLite::DB::IsOpen | ( | ) | const |
Tests if a database was opened and connected to this wrapper.
Definition at line 986 of file SQLiteDB.cpp.
References SQLite::RealDB::IsOpen(), and m_pDB.
Referenced by Query().
bool SQLite::DB::Open | ( | LPCTSTR | pFilename | ) |
Open a database file.
pFilename | File to open |
Definition at line 995 of file SQLiteDB.cpp.
References m_pDB, and SQLite::RealDB::Open().
Referenced by DoLicensePage().
bool SQLite::DB::operator!= | ( | const DB & | db | ) | const [inline] |
Deferential operator.
db | Database to compare |
Definition at line 543 of file SQLiteDB.h.
References m_pDB.
std::string SQLite::DB::printf | ( | const char * | pString, | |
... | ||||
) | [static] |
Helper function for creating statements in an SQL-safe way.
pString | The definition string |
Definition at line 1077 of file SQLiteDB.cpp.
Recordset SQLite::DB::Query | ( | const std::tstring & | sSQL | ) | [inline] |
Perform a SELECT SQL statement.
sSQL | The SELECT SQL statement |
Definition at line 511 of file SQLiteDB.h.
References Query().
Referenced by Query().
Recordset SQLite::DB::Query | ( | LPCTSTR | pSQL | ) |
Perform a SELECT SQL statement.
pSQL | SQL query to perform |
Definition at line 1021 of file SQLiteDB.cpp.
References SQLite::RealDB::GetSQLiteDB(), IsOpen(), and m_pDB.
Referenced by DoLicensePage(), and SQLite::RealTransaction::Query().