void OsmApiDb::transaction() { // Queries must be created from within the current transaction. _resetQueries(); if (!_db.transaction()) { throw HootException(_db.lastError().text()); } _inTransaction = true; }
void OsmApiDb::rollback() { _resetQueries(); if (!_db.rollback()) { LOG_WARN("Error rolling back transaction."); throw HootException("Error rolling back transaction: " + _db.lastError().text()); } _inTransaction = false; }
void ServicesDb::commit() { createPendingMapIndexes(); _flushBulkInserts(); _resetQueries(); if (!_db.commit()) { LOG_WARN("Error committing transaction."); throw HootException("Error committing transaction: " + _db.lastError().text()); } _inTransaction = false; }
void ServicesDb::_checkLastMapId(long mapId) { if (_lastMapId != mapId) { _flushBulkInserts(); _resetQueries(); _nodeIdReserver.reset(); _wayIdReserver.reset(); _relationIdReserver.reset(); _lastMapId = mapId; } }
void OsmApiDb::close() { _resetQueries(); if (_inTransaction) { LOG_WARN("Closing database before transaction is committed. Rolling back transaction."); rollback(); } // Seeing this? "Unable to free statement: connection pointer is NULL" // Make sure all queries are listed in _resetQueries. _db.close(); }
void ServicesDb::close() { createPendingMapIndexes(); _flushBulkInserts(); _resetQueries(); if (_inTransaction) { LOG_WARN("Closing database before transaction is committed. Rolling back transaction."); rollback(); } // Seeing this? "Unable to free statement: connection pointer is NULL" // Make sure all queries are listed in _resetQueries. _db.close(); }
void OsmApiDb::commit() { if ( _db.isOpen() == false ) { throw HootException("Tried to commit a transaction on a closed database"); } if ( _inTransaction == false ) { throw HootException("Tried to commit but weren't in a transaction"); } _resetQueries(); if (!_db.commit()) { LOG_WARN("Error committing transaction."); throw HootException("Error committing transaction: " + _db.lastError().text()); } _inTransaction = false; }
void OsmApiDb::_init() { _inTransaction = false; _resetQueries(); }