Class handling SQLite transactions. More...
Inherits SQLite::RefObj.
Public Member Functions | |
RealTransaction (const DB &db, Transaction::TransactionType eType, const std::tstring &sName=_T("")) | |
Constructor from a database and type. | |
bool | IsValid () const |
Tests if the transaction is live (i.e., started). | |
const std::tstring & | GetLastError () const |
bool | Close () |
Commit the transaction and end it. | |
bool | Commit () |
Commit the transaction, i.e., make the changes up to now permanent. | |
bool | Rollback () |
Roll back the changes the transaction performed in the database from the last commit. | |
bool | Execute (LPCTSTR pSQL) |
Runs an SQL action on the database (in the transaction). | |
bool | Execute (const std::tstring &sSQL) |
Runs an SQL action on the database (in the transaction). | |
bool | Execute (Statement &statement) |
Runs a prepared SQL statement on the database (in the transaction). | |
Recordset | Query (LPCTSTR pSQL) |
Performs an SQL query on the database (in the transaction). | |
Recordset | Query (const std::tstring &sSQL) |
Performs an SQL query on the database (in the transaction). | |
Recordset | Query (Statement &statement) |
Performs a prepared SQL query on the database (in the transaction). | |
Protected Member Functions | |
virtual | ~RealTransaction () |
Destructor; closes the transaction if still active. | |
bool | StartTransaction (Transaction::TransactionType eType) |
Starts the transaction. | |
Protected Attributes | |
DB | m_db |
Database this transaction belongs to. | |
std::tstring | m_sName |
Name of transaction. | |
bool | m_bActive |
true if the transaction is 'live', i.e., has uncommited data | |
std::tstring | m_sLastError |
Description of last error that occured while executing statements. | |
Static Protected Attributes | |
static LPCTSTR | TRANSACTION_TYPE [] |
SQLite keywords for the transaction types. |
Class handling SQLite transactions.
Definition at line 431 of file SQLiteDB.cpp.
SQLite::RealTransaction::RealTransaction | ( | const DB & | db, | |
Transaction::TransactionType | eType, | |||
const std::tstring & | sName = _T("") | |||
) | [inline] |
Constructor from a database and type.
db | Database wrapper of the database this transaction object belongs to | |
eType | Type of the transaction | |
sName | Name of the transaction (optional, and currenntly not used in SQLite) |
Definition at line 441 of file SQLiteDB.cpp.
References m_bActive, and StartTransaction().
bool SQLite::RealTransaction::Close | ( | ) |
Commit the transaction and end it.
Definition at line 563 of file SQLiteDB.cpp.
References SQLite::DB::Execute(), IsValid(), m_bActive, m_db, and m_sName.
Referenced by SQLite::Transaction::Close(), and ~RealTransaction().
bool SQLite::RealTransaction::Commit | ( | ) | [inline] |
Commit the transaction, i.e., make the changes up to now permanent.
Definition at line 482 of file SQLiteDB.cpp.
References SQLite::DB::Execute(), SQLite::DB::GetLastError(), IsValid(), m_db, m_sLastError, and m_sName.
Referenced by SQLite::Transaction::Commit().
bool SQLite::RealTransaction::Execute | ( | Statement & | statement | ) | [inline] |
Runs a prepared SQL statement on the database (in the transaction).
statement | Statement to perform |
Definition at line 506 of file SQLiteDB.cpp.
References SQLite::Statement::Execute(), SQLite::Statement::GetDB(), IsValid(), and m_db.
bool SQLite::RealTransaction::Execute | ( | const std::tstring & | sSQL | ) | [inline] |
Runs an SQL action on the database (in the transaction).
sSQL | SQL statement to perform |
Definition at line 500 of file SQLiteDB.cpp.
References SQLite::DB::Execute(), and m_db.
bool SQLite::RealTransaction::Execute | ( | LPCTSTR | pSQL | ) | [inline] |
Runs an SQL action on the database (in the transaction).
pSQL | SQL statement to perform |
Definition at line 494 of file SQLiteDB.cpp.
References SQLite::DB::Execute(), SQLite::DB::GetLastError(), IsValid(), m_db, and m_sLastError.
Referenced by SQLite::Transaction::Execute().
const std::tstring& SQLite::RealTransaction::GetLastError | ( | ) | const [inline] |
Definition at line 472 of file SQLiteDB.cpp.
References m_sLastError.
Referenced by SQLite::Transaction::GetLastError().
bool SQLite::RealTransaction::IsValid | ( | ) | const [inline] |
Tests if the transaction is live (i.e., started).
Definition at line 468 of file SQLiteDB.cpp.
References m_bActive.
Referenced by Close(), Commit(), Execute(), Query(), Rollback(), and StartTransaction().
Performs a prepared SQL query on the database (in the transaction).
statement | The query to perform |
Definition at line 524 of file SQLiteDB.cpp.
References SQLite::Statement::GetDB(), IsValid(), m_db, and SQLite::Statement::Query().
Recordset SQLite::RealTransaction::Query | ( | const std::tstring & | sSQL | ) | [inline] |
Performs an SQL query on the database (in the transaction).
sSQL | SQL query to perform |
Definition at line 518 of file SQLiteDB.cpp.
References IsValid(), m_db, and SQLite::DB::Query().
Recordset SQLite::RealTransaction::Query | ( | LPCTSTR | pSQL | ) | [inline] |
Performs an SQL query on the database (in the transaction).
pSQL | SQL query to perform |
Definition at line 512 of file SQLiteDB.cpp.
References SQLite::DB::GetLastError(), SQLite::Recordset::IsValid(), IsValid(), m_db, m_sLastError, and SQLite::DB::Query().
Referenced by SQLite::Transaction::Query().
bool SQLite::RealTransaction::Rollback | ( | ) | [inline] |
Roll back the changes the transaction performed in the database from the last commit.
Definition at line 487 of file SQLiteDB.cpp.
References SQLite::DB::Execute(), SQLite::DB::GetLastError(), IsValid(), m_bActive, m_db, m_sLastError, and m_sName.
Referenced by SQLite::Transaction::Rollback().
bool SQLite::RealTransaction::StartTransaction | ( | Transaction::TransactionType | eType | ) | [protected] |
Starts the transaction.
eType | The type of the transaction to start |
Definition at line 545 of file SQLiteDB.cpp.
References SQLite::DB::Execute(), IsValid(), m_bActive, m_db, m_sName, TRANSACTION_TYPE, and tstring.
Referenced by RealTransaction().