Begins the SQLite savepoint
| 21 | |
| 22 | // Begins the SQLite savepoint |
| 23 | Savepoint::Savepoint(Database& aDatabase, const std::string& aName) |
| 24 | : mDatabase(aDatabase), msName(aName) |
| 25 | { |
| 26 | // workaround because you cannot bind to SAVEPOINT |
| 27 | // escape name for use in query |
| 28 | Statement stmt(mDatabase, "SELECT quote(?)"); |
| 29 | stmt.bind(1, msName); |
| 30 | stmt.executeStep(); |
| 31 | msName = stmt.getColumn(0).getText(); |
| 32 | |
| 33 | mDatabase.exec(std::string("SAVEPOINT ") + msName); |
| 34 | } |
| 35 | |
| 36 | // Safely rollback the savepoint if it has not been committed. |
| 37 | Savepoint::~Savepoint() |