mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-29 08:37:36 -04:00
Added new methods for transaction to RetroDb.
This commit is contained in:
parent
4309642d14
commit
3665238e61
3 changed files with 58 additions and 14 deletions
|
@ -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*> ¶mBindings){
|
||||
|
||||
// prepare statement
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue