Added new methods for transaction to RetroDb.

This commit is contained in:
thunder2 2015-08-15 17:06:06 +02:00
parent 4309642d14
commit 3665238e61
3 changed files with 58 additions and 14 deletions

View file

@ -264,6 +264,32 @@ std::string RetroDb::getKey() const
return mKey;
}
bool RetroDb::beginTransaction()
{
if (!isOpen()) {
return false;
}
return execSQL("BEGIN;");
}
bool RetroDb::commitTransaction()
{
if (!isOpen()) {
return false;
}
return execSQL("COMMIT;");
}
bool RetroDb::rollbackTransaction()
{
if (!isOpen()) {
return false;
}
return execSQL("ROLLBACK;");
}
bool RetroDb::execSQL_bind(const std::string &query, std::list<RetroBind*> &paramBindings){
// prepare statement

View file

@ -92,6 +92,24 @@ public:
/*!
* Start transaction
* @return true/false
*/
bool beginTransaction();
/*!
* Commit transaction
* @return true/false
*/
bool commitTransaction();
/*!
* Rollback transaction
* @return true/false
*/
bool rollbackTransaction();
/*!
* To a make query which do not return a result \n
* below are the type of queries this method should be used for \n