diff --git a/catalogue/DropSchemaCmd.cpp b/catalogue/DropSchemaCmd.cpp index a3855e476f23a2e16a2db7590836eeddabb086c3..8e3ccf8d29ea9b34e9d4b51d345e73bc9a1f4328 100644 --- a/catalogue/DropSchemaCmd.cpp +++ b/catalogue/DropSchemaCmd.cpp @@ -157,7 +157,7 @@ void DropSchemaCmd::dropDatabaseTables(rdbms::Conn &conn, const std::list<std::s for(auto tableToDrop : tablesToDrop) { const bool tableToDropIsInDb = tablesInDb.end() != std::find(tablesInDb.begin(), tablesInDb.end(), tableToDrop); if(tableToDropIsInDb) { - conn.executeNonQuery(std::string("DROP TABLE ") + tableToDrop, rdbms::AutocommitMode::ON); + conn.executeNonQuery(std::string("DROP TABLE ") + tableToDrop, rdbms::AutocommitMode::AUTOCOMMIT_ON); m_out << "Dropped table " << tableToDrop << std::endl; } } @@ -208,7 +208,7 @@ void DropSchemaCmd::dropDatabaseSequences(rdbms::Conn &conn, const std::list<std const bool sequenceToDropIsInDb = sequencesInDb.end() != std::find(sequencesInDb.begin(), sequencesInDb.end(), sequenceToDrop); if(sequenceToDropIsInDb) { - conn.executeNonQuery(std::string("DROP SEQUENCE ") + sequenceToDrop, rdbms::AutocommitMode::ON); + conn.executeNonQuery(std::string("DROP SEQUENCE ") + sequenceToDrop, rdbms::AutocommitMode::AUTOCOMMIT_ON); m_out << "Dropped sequence " << sequenceToDrop << std::endl; } } diff --git a/catalogue/OracleCatalogue.cpp b/catalogue/OracleCatalogue.cpp index 16653dcc16b9b69fdba116c641137f1d9dd053bb..87ef8f4fec7fc9c2786d595314ae62b5eb01d084 100644 --- a/catalogue/OracleCatalogue.cpp +++ b/catalogue/OracleCatalogue.cpp @@ -168,7 +168,7 @@ uint64_t OracleCatalogue::getNextArchiveFileId(rdbms::Conn &conn) { "ARCHIVE_FILE_ID_SEQ.NEXTVAL AS ARCHIVE_FILE_ID " "FROM " "DUAL"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); if (!rset.next()) { throw exception::Exception(std::string("Result set is unexpectedly empty")); @@ -193,7 +193,7 @@ uint64_t OracleCatalogue::getNextStorageClassId(rdbms::Conn &conn) { "STORAGE_CLASS_ID_SEQ.NEXTVAL AS STORAGE_CLASS_ID " "FROM " "DUAL"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); if (!rset.next()) { throw exception::Exception(std::string("Result set is unexpectedly empty")); @@ -249,7 +249,7 @@ common::dataStructures::Tape OracleCatalogue::selectTapeForUpdate(rdbms::Conn &c "WHERE " "VID = :VID " "FOR UPDATE"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":VID", vid); auto rset = stmt.executeQuery(); if (!rset.next()) { @@ -379,20 +379,20 @@ void OracleCatalogue::filesWrittenToTape(const std::set<TapeItemWrittenPointer> auto lastEventItor = events.cend(); lastEventItor--; const TapeItemWritten &lastEvent = **lastEventItor; - updateTape(conn, rdbms::AutocommitMode::OFF, lastEvent.vid, lastEvent.fSeq, totalCompressedBytesWritten, + updateTape(conn, rdbms::AutocommitMode::AUTOCOMMIT_OFF, lastEvent.vid, lastEvent.fSeq, totalCompressedBytesWritten, lastEvent.tapeDrive); // If we had only placeholders and no file recorded, we are done. if (fileEvents.empty()) return; // Create the archive file entries, skipping those that already exist - idempotentBatchInsertArchiveFiles(conn, rdbms::AutocommitMode::OFF, fileEvents); + idempotentBatchInsertArchiveFiles(conn, rdbms::AutocommitMode::AUTOCOMMIT_OFF, fileEvents); - insertTapeFileBatchIntoTempTable(conn, rdbms::AutocommitMode::OFF, fileEvents); + insertTapeFileBatchIntoTempTable(conn, rdbms::AutocommitMode::AUTOCOMMIT_OFF, fileEvents); // Verify that the archive file entries in the catalogue database agree with // the tape file written events - const auto fileSizesAndChecksums = selectArchiveFileSizesAndChecksums(conn, rdbms::AutocommitMode::OFF, fileEvents); + const auto fileSizesAndChecksums = selectArchiveFileSizesAndChecksums(conn, rdbms::AutocommitMode::AUTOCOMMIT_OFF, fileEvents); for (const auto &event: fileEvents) { const auto fileSizeAndChecksumItor = fileSizesAndChecksums.find(event.archiveFileId); @@ -461,7 +461,7 @@ void OracleCatalogue::filesWrittenToTape(const std::set<TapeItemWrittenPointer> ":COPY_NB," ":CREATION_TIME," ":ARCHIVE_FILE_ID)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); rdbms::wrapper::OcciStmt &occiStmt = dynamic_cast<rdbms::wrapper::OcciStmt &>(stmt.getStmt()); occiStmt.setColumn(tapeFileBatch.vid); occiStmt.setColumn(tapeFileBatch.fSeq); diff --git a/catalogue/RdbmsArchiveFileItorImpl.cpp b/catalogue/RdbmsArchiveFileItorImpl.cpp index 6f551dd3e4655584d68747b0c02b136014b4d382..8f4d7b34d70c0f2e7e322859650ae6333c6051d0 100644 --- a/catalogue/RdbmsArchiveFileItorImpl.cpp +++ b/catalogue/RdbmsArchiveFileItorImpl.cpp @@ -202,7 +202,7 @@ RdbmsArchiveFileItorImpl::RdbmsArchiveFileItorImpl( } auto conn = connPool.getConn(); - m_stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + m_stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); if(searchCriteria.archiveFileId) { m_stmt.bindUint64(":ARCHIVE_FILE_ID", searchCriteria.archiveFileId.value()); } diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 4a843435a13eae03059ee8ea7253c6093dbff7ad..0bc692bc03dff73f9c946e3a55f0bbc7861f1df7 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -123,7 +123,7 @@ void RdbmsCatalogue::createAdminUser( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":ADMIN_USER_NAME", username); @@ -158,7 +158,7 @@ bool RdbmsCatalogue::adminUserExists(rdbms::Conn &conn, const std::string adminU "ADMIN_USER " "WHERE " "ADMIN_USER_NAME = :ADMIN_USER_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":ADMIN_USER_NAME", adminUsername); auto rset = stmt.executeQuery(); return rset.next(); @@ -177,7 +177,7 @@ void RdbmsCatalogue::deleteAdminUser(const std::string &username) { try { const char *const sql = "DELETE FROM ADMIN_USER WHERE ADMIN_USER_NAME = :ADMIN_USER_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":ADMIN_USER_NAME", username); stmt.executeNonQuery(); @@ -216,7 +216,7 @@ std::list<common::dataStructures::AdminUser> RdbmsCatalogue::getAdminUsers() con "ORDER BY " "ADMIN_USER_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while (rset.next()) { common::dataStructures::AdminUser admin; @@ -266,7 +266,7 @@ void RdbmsCatalogue::modifyAdminUserComment(const common::dataStructures::Securi "WHERE " "ADMIN_USER_NAME = :ADMIN_USER_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -344,7 +344,7 @@ void RdbmsCatalogue::createStorageClass( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":STORAGE_CLASS_ID", storageClassId); stmt.bindString(":DISK_INSTANCE_NAME", storageClass.diskInstance); @@ -385,7 +385,7 @@ bool RdbmsCatalogue::storageClassExists(rdbms::Conn &conn, const std::string &di "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":STORAGE_CLASS_NAME", storageClassName); auto rset = stmt.executeQuery(); @@ -410,7 +410,7 @@ void RdbmsCatalogue::deleteStorageClass(const std::string &diskInstanceName, con "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql,rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql,rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":STORAGE_CLASS_NAME", storageClassName); @@ -454,7 +454,7 @@ std::list<common::dataStructures::StorageClass> RdbmsCatalogue::getStorageClasse "ORDER BY " "DISK_INSTANCE_NAME, STORAGE_CLASS_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while (rset.next()) { common::dataStructures::StorageClass storageClass; @@ -499,7 +499,7 @@ void RdbmsCatalogue::modifyStorageClassNbCopies(const common::dataStructures::Se "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":NB_COPIES", nbCopies); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -537,7 +537,7 @@ void RdbmsCatalogue::modifyStorageClassComment(const common::dataStructures::Sec "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -619,7 +619,7 @@ void RdbmsCatalogue::createTapePool( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":TAPE_POOL_NAME", name); stmt.bindString(":VO", vo); @@ -672,7 +672,7 @@ bool RdbmsCatalogue::tapePoolExists(rdbms::Conn &conn, const std::string &tapePo "TAPE_POOL " "WHERE " "TAPE_POOL_NAME = :TAPE_POOL_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":TAPE_POOL_NAME", tapePoolName); auto rset = stmt.executeQuery(); return rset.next(); @@ -696,7 +696,7 @@ bool RdbmsCatalogue::archiveFileIdExists(rdbms::Conn &conn, const uint64_t archi "ARCHIVE_FILE " "WHERE " "ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); auto rset = stmt.executeQuery(); return rset.next(); @@ -723,7 +723,7 @@ bool RdbmsCatalogue::diskFileIdExists(rdbms::Conn &conn, const std::string &disk "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "DISK_FILE_ID = :DISK_FILE_ID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":DISK_FILE_ID", diskFileId); auto rset = stmt.executeQuery(); @@ -751,7 +751,7 @@ bool RdbmsCatalogue::diskFilePathExists(rdbms::Conn &conn, const std::string &di "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "DISK_FILE_PATH = :DISK_FILE_PATH"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":DISK_FILE_PATH", diskFilePath); auto rset = stmt.executeQuery(); @@ -779,7 +779,7 @@ bool RdbmsCatalogue::diskFileUserExists(rdbms::Conn &conn, const std::string &di "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "DISK_FILE_USER = :DISK_FILE_USER"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":DISK_FILE_USER", diskFileUser); auto rset = stmt.executeQuery(); @@ -807,7 +807,7 @@ bool RdbmsCatalogue::diskFileGroupExists(rdbms::Conn &conn, const std::string &d "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "DISK_FILE_GROUP = :DISK_FILE_GROUP"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":DISK_FILE_GROUP", diskFileGroup); auto rset = stmt.executeQuery(); @@ -838,7 +838,7 @@ bool RdbmsCatalogue::archiveRouteExists(rdbms::Conn &conn, const std::string &di "STORAGE_CLASS.DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS.STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME AND " "ARCHIVE_ROUTE.COPY_NB = :COPY_NB"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":STORAGE_CLASS_NAME", storageClassName); stmt.bindUint64(":COPY_NB", copyNb); @@ -859,7 +859,7 @@ void RdbmsCatalogue::deleteTapePool(const std::string &name) { try { const char *const sql = "DELETE FROM TAPE_POOL WHERE TAPE_POOL_NAME = :TAPE_POOL_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":TAPE_POOL_NAME", name); stmt.executeNonQuery(); @@ -921,7 +921,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const { "TAPE_POOL_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while (rset.next()) { TapePool pool; @@ -979,7 +979,7 @@ void RdbmsCatalogue::modifyTapePoolVo(const common::dataStructures::SecurityIden "WHERE " "TAPE_POOL_NAME = :TAPE_POOL_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":VO", vo); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -1019,7 +1019,7 @@ void RdbmsCatalogue::modifyTapePoolNbPartialTapes(const common::dataStructures:: "WHERE " "TAPE_POOL_NAME = :TAPE_POOL_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":NB_PARTIAL_TAPES", nbPartialTapes); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -1063,7 +1063,7 @@ void RdbmsCatalogue::modifyTapePoolComment(const common::dataStructures::Securit "WHERE " "TAPE_POOL_NAME = :TAPE_POOL_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -1098,7 +1098,7 @@ void RdbmsCatalogue::setTapePoolEncryption(const common::dataStructures::Securit "WHERE " "TAPE_POOL_NAME = :TAPE_POOL_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindBool(":IS_ENCRYPTED", encryptionValue); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -1203,7 +1203,7 @@ void RdbmsCatalogue::createArchiveRoute( "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":STORAGE_CLASS_NAME", storageClassName); @@ -1249,7 +1249,7 @@ void RdbmsCatalogue::deleteArchiveRoute(const std::string &diskInstanceName, con "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME) AND " "COPY_NB = :COPY_NB"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":STORAGE_CLASS_NAME", storageClassName); stmt.bindUint64(":COPY_NB", copyNb); @@ -1298,7 +1298,7 @@ std::list<common::dataStructures::ArchiveRoute> RdbmsCatalogue::getArchiveRoutes "ORDER BY " "DISK_INSTANCE_NAME, STORAGE_CLASS_NAME, COPY_NB"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while (rset.next()) { common::dataStructures::ArchiveRoute route; @@ -1352,7 +1352,7 @@ void RdbmsCatalogue::modifyArchiveRouteTapePoolName(const common::dataStructures "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME) AND " "COPY_NB = :COPY_NB"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":TAPE_POOL_NAME", tapePoolName); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -1401,7 +1401,7 @@ void RdbmsCatalogue::modifyArchiveRouteComment(const common::dataStructures::Sec "STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME) AND " "COPY_NB = :COPY_NB"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -1464,7 +1464,7 @@ void RdbmsCatalogue::createLogicalLibrary( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":LOGICAL_LIBRARY_NAME", name); @@ -1499,7 +1499,7 @@ bool RdbmsCatalogue::logicalLibraryExists(rdbms::Conn &conn, const std::string & "LOGICAL_LIBRARY " "WHERE " "LOGICAL_LIBRARY_NAME = :LOGICAL_LIBRARY_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName); auto rset = stmt.executeQuery(); return rset.next(); @@ -1518,7 +1518,7 @@ void RdbmsCatalogue::deleteLogicalLibrary(const std::string &name) { try { const char *const sql = "DELETE FROM LOGICAL_LIBRARY WHERE LOGICAL_LIBRARY_NAME = :LOGICAL_LIBRARY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":LOGICAL_LIBRARY_NAME", name); stmt.executeNonQuery(); @@ -1557,7 +1557,7 @@ std::list<common::dataStructures::LogicalLibrary> RdbmsCatalogue::getLogicalLibr "ORDER BY " "LOGICAL_LIBRARY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while (rset.next()) { common::dataStructures::LogicalLibrary lib; @@ -1599,7 +1599,7 @@ void RdbmsCatalogue::modifyLogicalLibraryComment(const common::dataStructures::S "WHERE " "LOGICAL_LIBRARY_NAME = :LOGICAL_LIBRARY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -1705,7 +1705,7 @@ void RdbmsCatalogue::createTape( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":VID", vid); stmt.bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName); @@ -1762,7 +1762,7 @@ bool RdbmsCatalogue::tapeExists(rdbms::Conn &conn, const std::string &vid) const "TAPE " "WHERE " "VID = :VID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":VID", vid); auto rset = stmt.executeQuery(); return rset.next(); @@ -1787,7 +1787,7 @@ void RdbmsCatalogue::deleteTape(const std::string &vid) { "VID = :DELETE_VID AND " "NOT EXISTS (SELECT VID FROM TAPE_FILE WHERE VID = :SELECT_VID)"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(delete_sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(delete_sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DELETE_VID", vid); stmt.bindString(":SELECT_VID", vid); stmt.executeNonQuery(); @@ -1913,7 +1913,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co sql += " ORDER BY VID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); if(searchCriteria.vid) stmt.bindString(":VID", searchCriteria.vid.value()); if(searchCriteria.logicalLibrary) stmt.bindString(":LOGICAL_LIBRARY_NAME", searchCriteria.logicalLibrary.value()); @@ -2016,7 +2016,7 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getTapesByVid(const std::se } auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); { uint64_t vidNb = 1; @@ -2110,7 +2110,7 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getAllTapes() const { "TAPE"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while (rset.next()) { @@ -2170,7 +2170,7 @@ void RdbmsCatalogue::reclaimTape(const common::dataStructures::SecurityIdentity "IS_FULL != 0 AND " "NOT EXISTS (SELECT VID FROM TAPE_FILE WHERE VID = :SELECT_VID)"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); stmt.bindUint64(":LAST_UPDATE_TIME", now); @@ -2262,7 +2262,7 @@ void RdbmsCatalogue::modifyTapeLogicalLibraryName(const common::dataStructures:: "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2297,7 +2297,7 @@ void RdbmsCatalogue::modifyTapeTapePoolName(const common::dataStructures::Securi "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":TAPE_POOL_NAME", tapePoolName); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2332,7 +2332,7 @@ void RdbmsCatalogue::modifyTapeCapacityInBytes(const common::dataStructures::Sec "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":CAPACITY_IN_BYTES", capacityInBytes); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2367,7 +2367,7 @@ void RdbmsCatalogue::modifyTapeEncryptionKey(const common::dataStructures::Secur "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":ENCRYPTION_KEY", encryptionKey); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2399,7 +2399,7 @@ void RdbmsCatalogue::tapeMountedForArchive(const std::string &vid, const std::st "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":LAST_WRITE_DRIVE", drive); stmt.bindUint64(":LAST_WRITE_TIME", now); stmt.bindString(":VID", vid); @@ -2429,7 +2429,7 @@ void RdbmsCatalogue::tapeMountedForRetrieve(const std::string &vid, const std::s "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":LAST_READ_DRIVE", drive); stmt.bindUint64(":LAST_READ_TIME", now); stmt.bindString(":VID", vid); @@ -2462,7 +2462,7 @@ void RdbmsCatalogue::setTapeFull(const common::dataStructures::SecurityIdentity "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindBool(":IS_FULL", fullValue); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2492,7 +2492,7 @@ void RdbmsCatalogue::noSpaceLeftOnTape(const std::string &vid) { "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":VID", vid); stmt.executeNonQuery(); @@ -2523,7 +2523,7 @@ void RdbmsCatalogue::setTapeDisabled(const common::dataStructures::SecurityIdent "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindBool(":IS_DISABLED", disabledValue); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2558,7 +2558,7 @@ void RdbmsCatalogue::modifyTapeComment(const common::dataStructures::SecurityIde "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2594,7 +2594,7 @@ void RdbmsCatalogue::modifyRequesterMountRulePolicy(const common::dataStructures "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_NAME = :REQUESTER_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":MOUNT_POLICY_NAME", mountPolicy); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2632,7 +2632,7 @@ void RdbmsCatalogue::modifyRequesteMountRuleComment(const common::dataStructures "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_NAME = :REQUESTER_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2670,7 +2670,7 @@ void RdbmsCatalogue::modifyRequesterGroupMountRulePolicy(const common::dataStruc "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_GROUP_NAME = :REQUESTER_GROUP_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":MOUNT_POLICY_NAME", mountPolicy); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2708,7 +2708,7 @@ void RdbmsCatalogue::modifyRequesterGroupMountRuleComment(const common::dataStru "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_GROUP_NAME = :REQUESTER_GROUP_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -2789,7 +2789,7 @@ void RdbmsCatalogue::createMountPolicy( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":MOUNT_POLICY_NAME", name); @@ -2873,7 +2873,7 @@ void RdbmsCatalogue::createRequesterMountRule( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":REQUESTER_NAME", requesterName); @@ -2924,7 +2924,7 @@ std::list<common::dataStructures::RequesterMountRule> RdbmsCatalogue::getRequest "ORDER BY " "DISK_INSTANCE_NAME, REQUESTER_NAME, MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while(rset.next()) { common::dataStructures::RequesterMountRule rule; @@ -2964,7 +2964,7 @@ void RdbmsCatalogue::deleteRequesterMountRule(const std::string &diskInstanceNam "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_NAME = :REQUESTER_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":REQUESTER_NAME", requesterName); stmt.executeNonQuery(); @@ -3036,7 +3036,7 @@ void RdbmsCatalogue::createRequesterGroupMountRule( ":LAST_UPDATE_USER_NAME," ":LAST_UPDATE_HOST_NAME," ":LAST_UPDATE_TIME)"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":REQUESTER_GROUP_NAME", requesterGroupName); @@ -3116,7 +3116,7 @@ optional<common::dataStructures::MountPolicy> RdbmsCatalogue::getRequesterGroupM "WHERE " "REQUESTER_GROUP_MOUNT_RULE.DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_GROUP_MOUNT_RULE.REQUESTER_GROUP_NAME = :REQUESTER_GROUP_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", group.diskInstanceName); stmt.bindString(":REQUESTER_GROUP_NAME", group.groupName); auto rset = stmt.executeQuery(); @@ -3179,7 +3179,7 @@ std::list<common::dataStructures::RequesterGroupMountRule> RdbmsCatalogue::getRe "ORDER BY " "DISK_INSTANCE_NAME, REQUESTER_GROUP_NAME, MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while(rset.next()) { common::dataStructures::RequesterGroupMountRule rule; @@ -3221,7 +3221,7 @@ void RdbmsCatalogue::deleteRequesterGroupMountRule(const std::string &diskInstan "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_GROUP_NAME = :REQUESTER_GROUP_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":REQUESTER_GROUP_NAME", requesterGroupName); stmt.executeNonQuery(); @@ -3250,7 +3250,7 @@ bool RdbmsCatalogue::mountPolicyExists(rdbms::Conn &conn, const std::string &mou "MOUNT_POLICY " "WHERE " "MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":MOUNT_POLICY_NAME", mountPolicyName); auto rset = stmt.executeQuery(); return rset.next(); @@ -3276,7 +3276,7 @@ bool RdbmsCatalogue::requesterMountRuleExists(rdbms::Conn &conn, const std::stri "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_NAME = :REQUESTER_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":REQUESTER_NAME", requesterName); auto rset = stmt.executeQuery(); @@ -3343,7 +3343,7 @@ optional<common::dataStructures::MountPolicy> RdbmsCatalogue::getRequesterMountP "WHERE " "REQUESTER_MOUNT_RULE.DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_MOUNT_RULE.REQUESTER_NAME = :REQUESTER_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", user.diskInstanceName); stmt.bindString(":REQUESTER_NAME", user.username); auto rset = stmt.executeQuery(); @@ -3398,7 +3398,7 @@ bool RdbmsCatalogue::requesterGroupMountRuleExists(rdbms::Conn &conn, const std: "WHERE " "DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "REQUESTER_GROUP_NAME = :REQUESTER_GROUP_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":REQUESTER_GROUP_NAME", requesterGroupName); auto rset = stmt.executeQuery(); @@ -3418,7 +3418,7 @@ void RdbmsCatalogue::deleteMountPolicy(const std::string &name) { try { const char *const sql = "DELETE FROM MOUNT_POLICY WHERE MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":MOUNT_POLICY_NAME", name); stmt.executeNonQuery(); @@ -3465,7 +3465,7 @@ std::list<common::dataStructures::MountPolicy> RdbmsCatalogue::getMountPolicies( "ORDER BY " "MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); while (rset.next()) { common::dataStructures::MountPolicy policy; @@ -3518,7 +3518,7 @@ void RdbmsCatalogue::modifyMountPolicyArchivePriority(const common::dataStructur "WHERE " "MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":ARCHIVE_PRIORITY", archivePriority); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -3553,7 +3553,7 @@ void RdbmsCatalogue::modifyMountPolicyArchiveMinRequestAge(const common::dataStr "WHERE " "MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":ARCHIVE_MIN_REQUEST_AGE", minArchiveRequestAge); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -3588,7 +3588,7 @@ void RdbmsCatalogue::modifyMountPolicyRetrievePriority(const common::dataStructu "WHERE " "MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":RETRIEVE_PRIORITY", retrievePriority); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -3623,7 +3623,7 @@ void RdbmsCatalogue::modifyMountPolicyRetrieveMinRequestAge(const common::dataSt "WHERE " "MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":RETRIEVE_MIN_REQUEST_AGE", minRetrieveRequestAge); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -3658,7 +3658,7 @@ void RdbmsCatalogue::modifyMountPolicyMaxDrivesAllowed(const common::dataStructu "WHERE " "MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindUint64(":MAX_DRIVES_ALLOWED", maxDrivesAllowed); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -3693,7 +3693,7 @@ void RdbmsCatalogue::modifyMountPolicyComment(const common::dataStructures::Secu "WHERE " "MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); @@ -3974,7 +3974,7 @@ common::dataStructures::ArchiveFileSummary RdbmsCatalogue::getTapeFileSummary( } auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); if(searchCriteria.archiveFileId) { stmt.bindUint64(":ARCHIVE_FILE_ID", searchCriteria.archiveFileId.value()); } @@ -4061,7 +4061,7 @@ void RdbmsCatalogue::tapeLabelled(const std::string &vid, const std::string &dri "WHERE " "VID = :VID"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":LABEL_DRIVE", drive); stmt.bindUint64(":LABEL_TIME", now); stmt.bindBool(":LBP_IS_ON", lbpIsOn); @@ -4215,7 +4215,7 @@ common::dataStructures::TapeCopyToPoolMap RdbmsCatalogue::getTapeCopyToPoolMap(r "WHERE " "STORAGE_CLASS.DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS.STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", storageClass.diskInstanceName); stmt.bindString(":STORAGE_CLASS_NAME", storageClass.storageClassName); auto rset = stmt.executeQuery(); @@ -4269,7 +4269,7 @@ uint64_t RdbmsCatalogue::getExpectedNbArchiveRoutes(rdbms::Conn &conn, const Sto "WHERE " "STORAGE_CLASS.DISK_INSTANCE_NAME = :DISK_INSTANCE_NAME AND " "STORAGE_CLASS.STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", storageClass.diskInstanceName); stmt.bindString(":STORAGE_CLASS_NAME", storageClass.storageClassName); auto rset = stmt.executeQuery(); @@ -4449,7 +4449,7 @@ RequesterAndGroupMountPolicies RdbmsCatalogue::getMountPolicies( "REQUESTER_GROUP_MOUNT_RULE.DISK_INSTANCE_NAME = :GROUP_DISK_INSTANCE_NAME AND " "REQUESTER_GROUP_MOUNT_RULE.REQUESTER_GROUP_NAME = :REQUESTER_GROUP_NAME"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":REQUESTER_DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":GROUP_DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":REQUESTER_NAME", requesterName); @@ -4530,7 +4530,7 @@ void RdbmsCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons auto conn = m_connPool.getConn(); rdbms::AutoRollback autoRollback(conn); const auto getConnTime = t.secs(utils::Timer::resetCounter); - auto selectStmt = conn.createStmt(selectSql, rdbms::AutocommitMode::OFF); + auto selectStmt = conn.createStmt(selectSql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); const auto createStmtTime = t.secs(); selectStmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); t.reset(); @@ -4625,7 +4625,7 @@ void RdbmsCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons t.reset(); { const char *const sql = "DELETE FROM TAPE_FILE WHERE ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); stmt.executeNonQuery(); } @@ -4633,7 +4633,7 @@ void RdbmsCatalogue::deleteArchiveFile(const std::string &diskInstanceName, cons { const char *const sql = "DELETE FROM ARCHIVE_FILE WHERE ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); stmt.executeNonQuery(); } @@ -4728,7 +4728,7 @@ bool RdbmsCatalogue::isNonCachedAdmin(const common::dataStructures::SecurityIden "WHERE " "ADMIN_USER_NAME = :ADMIN_USER_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":ADMIN_USER_NAME", admin.username); auto rset = stmt.executeQuery(); return rset.next(); @@ -4764,7 +4764,7 @@ std::list<TapeForWriting> RdbmsCatalogue::getTapesForWriting(const std::string & "LOGICAL_LIBRARY_NAME = :LOGICAL_LIBRARY_NAME"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName); auto rset = stmt.executeQuery(); while (rset.next()) { @@ -4851,7 +4851,7 @@ void RdbmsCatalogue::setTapeLastFSeq(rdbms::Conn &conn, const std::string &vid, "LAST_FSEQ = :LAST_FSEQ " "WHERE " "VID=:VID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt.bindString(":VID", vid); stmt.bindUint64(":LAST_FSEQ", lastFSeq); stmt.executeNonQuery(); @@ -4875,7 +4875,7 @@ uint64_t RdbmsCatalogue::getTapeLastFSeq(rdbms::Conn &conn, const std::string &v "TAPE " "WHERE " "VID = :VID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":VID", vid); auto rset = stmt.executeQuery(); if(rset.next()) { @@ -4929,7 +4929,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF "ARCHIVE_FILE.ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID " "ORDER BY " "TAPE_FILE.CREATION_TIME ASC"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); auto rset = stmt.executeQuery(); std::unique_ptr<common::dataStructures::ArchiveFile> archiveFile; @@ -5018,7 +5018,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF "TAPE.IS_DISABLED = 0 " "ORDER BY " "TAPE_FILE.CREATION_TIME ASC"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); auto rset = stmt.executeQuery(); std::unique_ptr<common::dataStructures::ArchiveFile> archiveFile; @@ -5107,7 +5107,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF "ARCHIVE_FILE.DISK_FILE_ID = :DISK_FILE_ID " "ORDER BY " "TAPE_FILE.CREATION_TIME ASC"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":DISK_FILE_ID", diskFileId); auto rset = stmt.executeQuery(); @@ -5200,7 +5200,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF "TAPE.IS_DISABLED = 0 " "ORDER BY " "TAPE_FILE.CREATION_TIME ASC"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindString(":DISK_INSTANCE_NAME", diskInstanceName); stmt.bindString(":DISK_FILE_ID", diskFileId); auto rset = stmt.executeQuery(); @@ -5257,7 +5257,7 @@ void RdbmsCatalogue::ping() { try { const char *const sql = "SELECT COUNT(*) FROM CTA_CATALOGUE"; auto conn = m_connPool.getConn(); - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); } catch(exception::UserError &) { throw; diff --git a/catalogue/SqliteCatalogue.cpp b/catalogue/SqliteCatalogue.cpp index cf93bbdf8da219e4ffe94ed66b07eaac809b7a3a..bcad8a2167379be8a29d0ef0c70241fe9794298f 100644 --- a/catalogue/SqliteCatalogue.cpp +++ b/catalogue/SqliteCatalogue.cpp @@ -123,7 +123,7 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con t.reset(); { const char *const sql = "DELETE FROM TAPE_FILE WHERE ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID;"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); stmt.executeNonQuery(); } @@ -131,7 +131,7 @@ void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, con { const char *const sql = "DELETE FROM ARCHIVE_FILE WHERE ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID;"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); stmt.bindUint64(":ARCHIVE_FILE_ID", archiveFileId); stmt.executeNonQuery(); } @@ -191,7 +191,7 @@ uint64_t SqliteCatalogue::getNextArchiveFileId(rdbms::Conn &conn) { rdbms::AutoRollback autoRollback(conn); - conn.executeNonQuery("UPDATE ARCHIVE_FILE_ID SET ID = ID + 1", rdbms::AutocommitMode::OFF); + conn.executeNonQuery("UPDATE ARCHIVE_FILE_ID SET ID = ID + 1", rdbms::AutocommitMode::AUTOCOMMIT_OFF); uint64_t archiveFileId = 0; { const char *const sql = @@ -199,7 +199,7 @@ uint64_t SqliteCatalogue::getNextArchiveFileId(rdbms::Conn &conn) { "ID AS ID " "FROM " "ARCHIVE_FILE_ID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); if(!rset.next()) { throw exception::Exception("ARCHIVE_FILE_ID table is empty"); @@ -230,7 +230,7 @@ uint64_t SqliteCatalogue::getNextStorageClassId(rdbms::Conn &conn) { rdbms::AutoRollback autoRollback(conn); - conn.executeNonQuery("UPDATE STORAGE_CLASS_ID SET ID = ID + 1", rdbms::AutocommitMode::OFF); + conn.executeNonQuery("UPDATE STORAGE_CLASS_ID SET ID = ID + 1", rdbms::AutocommitMode::AUTOCOMMIT_OFF); uint64_t storageClassId = 0; { const char *const sql = @@ -238,7 +238,7 @@ uint64_t SqliteCatalogue::getNextStorageClassId(rdbms::Conn &conn) { "ID AS ID " "FROM " "STORAGE_CLASS_ID"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::OFF); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt.executeQuery(); if(!rset.next()) { throw exception::Exception("STORAGE_CLASS_ID table is empty"); @@ -372,7 +372,7 @@ void SqliteCatalogue::filesWrittenToTape(const std::set<TapeItemWrittenPointer> threading::MutexLocker locker(m_mutex); auto conn = m_connPool.getConn(); - const auto tape = selectTape(rdbms::AutocommitMode::ON, conn, firstEvent.vid); + const auto tape = selectTape(rdbms::AutocommitMode::AUTOCOMMIT_ON, conn, firstEvent.vid); uint64_t expectedFSeq = tape.lastFSeq + 1; uint64_t totalCompressedBytesWritten = 0; @@ -403,14 +403,14 @@ void SqliteCatalogue::filesWrittenToTape(const std::set<TapeItemWrittenPointer> auto lastEventItor = events.cend(); lastEventItor--; const TapeItemWritten &lastEvent = **lastEventItor; - updateTape(conn, rdbms::AutocommitMode::ON, lastEvent.vid, lastEvent.fSeq, totalCompressedBytesWritten, + updateTape(conn, rdbms::AutocommitMode::AUTOCOMMIT_ON, lastEvent.vid, lastEvent.fSeq, totalCompressedBytesWritten, lastEvent.tapeDrive); for(const auto &event : events) { try { // If this is a file (as opposed to a placeholder), do the full processing. const auto &fileEvent=dynamic_cast<const TapeFileWritten &>(*event); - fileWrittenToTape(rdbms::AutocommitMode::ON, conn, fileEvent); + fileWrittenToTape(rdbms::AutocommitMode::AUTOCOMMIT_ON, conn, fileEvent); } catch (std::bad_cast&) {} } } catch(exception::UserError &) { diff --git a/rdbms/AutocommitMode.hpp b/rdbms/AutocommitMode.hpp index 6d392f1a86d7d5de09e7a5ac385c8227cc61a369..8c020c6cd24bdbfcf98f94524cbeb25aa8fddb03 100644 --- a/rdbms/AutocommitMode.hpp +++ b/rdbms/AutocommitMode.hpp @@ -25,8 +25,8 @@ namespace rdbms { * A database statement can either have auto commiting mode turned on or off. */ enum class AutocommitMode { - ON, - OFF + AUTOCOMMIT_ON, + AUTOCOMMIT_OFF }; } // namespace rdbms diff --git a/rdbms/Conn.cpp b/rdbms/Conn.cpp index 0d9e8e1d45a60c46ffed6acc8fd80d310cb181f6..d80e66aae36c8b5b65cb519b063083b1149e9e43 100644 --- a/rdbms/Conn.cpp +++ b/rdbms/Conn.cpp @@ -100,7 +100,7 @@ void Conn::executeNonQueries(const std::string &sqlStmts) { searchPos = findResult + 1; if(0 < sqlStmt.size()) { // Ignore empty statements - executeNonQuery(sqlStmt, AutocommitMode::ON); + executeNonQuery(sqlStmt, AutocommitMode::AUTOCOMMIT_ON); } } diff --git a/rdbms/ConnTest.cpp b/rdbms/ConnTest.cpp index e405e5dc1450fbaee05e50407cb65691da04e135..1988d24c7ff1c548bdc37915432d6debea6925ff 100644 --- a/rdbms/ConnTest.cpp +++ b/rdbms/ConnTest.cpp @@ -47,7 +47,7 @@ TEST_F(cta_rdbms_ConnTest, createTableInMemoryDatabase_executeNonQuery) { ASSERT_TRUE(conn.getTableNames().empty()); - conn.executeNonQuery(sql, AutocommitMode::ON); + conn.executeNonQuery(sql, AutocommitMode::AUTOCOMMIT_ON); ASSERT_EQ(1, conn.getTableNames().size()); } @@ -87,7 +87,7 @@ TEST_F(cta_rdbms_ConnTest, createSameTableInTwoSeparateInMemoryDatabases_execute ASSERT_TRUE(conn.getTableNames().empty()); - conn.executeNonQuery(sql, AutocommitMode::ON); + conn.executeNonQuery(sql, AutocommitMode::AUTOCOMMIT_ON); ASSERT_EQ(1, conn.getTableNames().size()); } @@ -101,7 +101,7 @@ TEST_F(cta_rdbms_ConnTest, createSameTableInTwoSeparateInMemoryDatabases_execute ASSERT_TRUE(conn.getTableNames().empty()); - conn.executeNonQuery(sql, AutocommitMode::ON); + conn.executeNonQuery(sql, AutocommitMode::AUTOCOMMIT_ON); ASSERT_EQ(1, conn.getTableNames().size()); } diff --git a/rdbms/StmtPoolTest.cpp b/rdbms/StmtPoolTest.cpp index 4e63d4d38d35df71b5b1ff480c801882354ccb69..3924118b6d0c5b6838a0a8bf97f27f96fbcc13e2 100644 --- a/rdbms/StmtPoolTest.cpp +++ b/rdbms/StmtPoolTest.cpp @@ -45,7 +45,7 @@ TEST_F(cta_rdbms_StmtPoolTest, getStmt) { StmtPool pool; ASSERT_EQ(0, pool.getNbStmts()); { - auto stmt = pool.getStmt(*conn, sql, AutocommitMode::ON); + auto stmt = pool.getStmt(*conn, sql, AutocommitMode::AUTOCOMMIT_ON); ASSERT_EQ(0, pool.getNbStmts()); } ASSERT_EQ(1, pool.getNbStmts()); @@ -61,7 +61,7 @@ TEST_F(cta_rdbms_StmtPoolTest, moveAssignment) { StmtPool pool; ASSERT_EQ(0, pool.getNbStmts()); { - Stmt stmt1 = pool.getStmt(*conn, sql, AutocommitMode::ON); + Stmt stmt1 = pool.getStmt(*conn, sql, AutocommitMode::AUTOCOMMIT_ON); Stmt stmt2; stmt2 = std::move(stmt1); ASSERT_EQ(0, pool.getNbStmts()); @@ -79,7 +79,7 @@ TEST_F(cta_rdbms_StmtPoolTest, moveConstructor) { StmtPool pool; ASSERT_EQ(0, pool.getNbStmts()); { - Stmt stmt1 = pool.getStmt(*conn, sql, AutocommitMode::ON); + Stmt stmt1 = pool.getStmt(*conn, sql, AutocommitMode::AUTOCOMMIT_ON); Stmt stmt2(std::move(stmt1)); ASSERT_EQ(0, pool.getNbStmts()); } @@ -109,7 +109,7 @@ TEST_F(cta_rdbms_StmtPoolTest, createSameTableInTwoSeparateInMemoryDatabases) { StmtPool pool; { - Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt.executeQuery(); std::list<std::string> names; while(rset.next()) { @@ -119,12 +119,12 @@ TEST_F(cta_rdbms_StmtPoolTest, createSameTableInTwoSeparateInMemoryDatabases) { } { - Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::AUTOCOMMIT_ON); stmt.executeNonQuery(); } { - Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt.executeQuery(); std::list<std::string> names; while(rset.next()) { @@ -143,7 +143,7 @@ TEST_F(cta_rdbms_StmtPoolTest, createSameTableInTwoSeparateInMemoryDatabases) { StmtPool pool; { - Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt.executeQuery(); std::list<std::string> names; while(rset.next()) { @@ -153,12 +153,12 @@ TEST_F(cta_rdbms_StmtPoolTest, createSameTableInTwoSeparateInMemoryDatabases) { } { - Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::AUTOCOMMIT_ON); stmt.executeNonQuery(); } { - Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, selectTableNamesSql, AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt.executeQuery(); std::list<std::string> names; while(rset.next()) { @@ -186,7 +186,7 @@ TEST_F(cta_rdbms_StmtPoolTest, createSameTableInTwoSeparateInMemoryDatabases_get ASSERT_TRUE(conn->getTableNames().empty()); { - Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::AUTOCOMMIT_ON); stmt.executeNonQuery(); } @@ -204,7 +204,7 @@ TEST_F(cta_rdbms_StmtPoolTest, createSameTableInTwoSeparateInMemoryDatabases_get ASSERT_TRUE(conn->getTableNames().empty()); { - Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::ON); + Stmt stmt = pool.getStmt(*conn, createTableSql, AutocommitMode::AUTOCOMMIT_ON); stmt.executeNonQuery(); } @@ -222,8 +222,8 @@ TEST_F(cta_rdbms_StmtPoolTest, sameSqlTwoCachedStmts) { StmtPool pool; ASSERT_EQ(0, pool.getNbStmts()); { - Stmt stmt1 = pool.getStmt(*conn, sql, AutocommitMode::ON); - Stmt stmt2 = pool.getStmt(*conn, sql, AutocommitMode::ON); + Stmt stmt1 = pool.getStmt(*conn, sql, AutocommitMode::AUTOCOMMIT_ON); + Stmt stmt2 = pool.getStmt(*conn, sql, AutocommitMode::AUTOCOMMIT_ON); ASSERT_EQ(0, pool.getNbStmts()); } ASSERT_EQ(2, pool.getNbStmts()); diff --git a/rdbms/wrapper/ConnTest.cpp b/rdbms/wrapper/ConnTest.cpp index 23e013c33d9f4a6ca8d01397196affd49b5f4751..cfea5c20d85d646dc7dbe145a6883e21c129c5d4 100644 --- a/rdbms/wrapper/ConnTest.cpp +++ b/rdbms/wrapper/ConnTest.cpp @@ -48,7 +48,7 @@ TEST_F(cta_rdbms_wrapper_ConnTest, createSameTableInTwoSeparateInMemoryDatabases ASSERT_TRUE(conn->getTableNames().empty()); - auto stmt = conn->createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn->createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, conn->getTableNames().size()); @@ -62,7 +62,7 @@ TEST_F(cta_rdbms_wrapper_ConnTest, createSameTableInTwoSeparateInMemoryDatabases ASSERT_TRUE(conn->getTableNames().empty()); - auto stmt = conn->createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn->createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, conn->getTableNames().size()); diff --git a/rdbms/wrapper/OcciConn.cpp b/rdbms/wrapper/OcciConn.cpp index 6f4c9590eb12d6926172d5f1121abb141bc234fa..dacb83e309c771ecaaf4d427f64e783752d0cc97 100644 --- a/rdbms/wrapper/OcciConn.cpp +++ b/rdbms/wrapper/OcciConn.cpp @@ -140,7 +140,7 @@ std::list<std::string> OcciConn::getTableNames() { "USER_TABLES " "ORDER BY " "TABLE_NAME"; - auto stmt = createStmt(sql, AutocommitMode::OFF); + auto stmt = createStmt(sql, AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt->executeQuery(); while (rset->next()) { auto name = rset->columnOptionalString("TABLE_NAME"); @@ -168,7 +168,7 @@ std::list<std::string> OcciConn::getSequenceNames() { "USER_SEQUENCES " "ORDER BY " "SEQUENCE_NAME"; - auto stmt = createStmt(sql, AutocommitMode::OFF); + auto stmt = createStmt(sql, AutocommitMode::AUTOCOMMIT_OFF); auto rset = stmt->executeQuery(); while (rset->next()) { auto name = rset->columnOptionalString("SEQUENCE_NAME"); diff --git a/rdbms/wrapper/OcciStmt.cpp b/rdbms/wrapper/OcciStmt.cpp index eb1aa6e926e5579d86319aefea62beab790799e0..38059fd503c1e837f65b5b1a0aa9075c8b8d7eaf 100644 --- a/rdbms/wrapper/OcciStmt.cpp +++ b/rdbms/wrapper/OcciStmt.cpp @@ -50,10 +50,10 @@ OcciStmt::OcciStmt( // call close() from now on try { switch(autocommitMode) { - case AutocommitMode::ON: + case AutocommitMode::AUTOCOMMIT_ON: m_stmt->setAutoCommit(true); break; - case AutocommitMode::OFF: + case AutocommitMode::AUTOCOMMIT_OFF: // Do nothing because an occi::Statement has autocommit turned off by default break; default: diff --git a/rdbms/wrapper/SqliteConn.cpp b/rdbms/wrapper/SqliteConn.cpp index 21a7386f5c51367900c8730bfd106a11ade4655c..c19a5702fcaa6c6a812c3947f3b21a03a0b565ae 100644 --- a/rdbms/wrapper/SqliteConn.cpp +++ b/rdbms/wrapper/SqliteConn.cpp @@ -185,7 +185,7 @@ void SqliteConn::printSchema(std::ostream &os) { "ORDER BY " "TYPE, " "NAME;"; - auto stmt = createStmt(sql, AutocommitMode::ON); + auto stmt = createStmt(sql, AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); os << "NAME, TYPE" << std::endl; os << "==========" << std::endl; @@ -213,7 +213,7 @@ std::list<std::string> SqliteConn::getTableNames() { "TYPE = 'table' " "ORDER BY " "NAME;"; - auto stmt = createStmt(sql, AutocommitMode::ON); + auto stmt = createStmt(sql, AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); std::list<std::string> names; while (rset->next()) { diff --git a/rdbms/wrapper/SqliteStmt.cpp b/rdbms/wrapper/SqliteStmt.cpp index 512afeab4ad6f4c6a0d9a36cb53165476b1711e0..4576179e186936c574ffafd4b087391404b20a54 100644 --- a/rdbms/wrapper/SqliteStmt.cpp +++ b/rdbms/wrapper/SqliteStmt.cpp @@ -84,10 +84,10 @@ SqliteStmt::SqliteStmt( // m_stmt has been set so it is safe to call close() from now on try { switch(autocommitMode) { - case AutocommitMode::ON: + case AutocommitMode::AUTOCOMMIT_ON: // Do nothing because SQLite statements autocommit be default break; - case AutocommitMode::OFF: { + case AutocommitMode::AUTOCOMMIT_OFF: { if(!m_conn.m_transactionInProgress) { beginDeferredTransaction(); m_conn.m_transactionInProgress = true; diff --git a/rdbms/wrapper/SqliteStmtTest.cpp b/rdbms/wrapper/SqliteStmtTest.cpp index 0bf7e8a74245435cd59fba77209f3ae839b83a95..6cd4182727de42382be7aa68c72519d18e4c4639 100644 --- a/rdbms/wrapper/SqliteStmtTest.cpp +++ b/rdbms/wrapper/SqliteStmtTest.cpp @@ -52,7 +52,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, create_table) { "SQLITE_MASTER " "WHERE " "TYPE = 'table';"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); ASSERT_TRUE(rset->next()); const auto nbTables = rset->columnOptionalUint64("NB_TABLES"); @@ -69,7 +69,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, create_table) { "COL1 TEXT," "COL2 TEXT," "COL3 INTEGER);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); } @@ -82,7 +82,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, create_table) { "WHERE " "NAME = 'TEST1' AND " "TYPE = 'table';"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); ASSERT_TRUE(rset->next()); const auto nbTables = rset->columnOptionalUint64("NB_TABLES"); @@ -100,7 +100,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, create_table) { "COL1 TEXT," "COL2 TEXT," "COL3 INTEGER);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); } @@ -113,7 +113,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, create_table) { "WHERE " "NAME = 'TEST2' AND " "TYPE = 'table';"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); ASSERT_TRUE(rset->next()); const auto nbTables = rset->columnOptionalUint64("NB_TABLES"); @@ -146,7 +146,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, select_from_empty_table) { "COL1 TEXT," "COL2 TEXT," "COL3 INTEGER);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, conn.getTableNames().size()); ASSERT_EQ("TEST", conn.getTableNames().front()); @@ -161,7 +161,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, select_from_empty_table) { "COL3 " "FROM " "TEST;"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); ASSERT_FALSE(rset->next()); } @@ -182,7 +182,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, insert_without_bind) { "COL1 TEXT," "COL2 TEXT," "COL3 INTEGER);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, conn.getTableNames().size()); ASSERT_EQ("TEST", conn.getTableNames().front()); @@ -199,7 +199,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, insert_without_bind) { "'one'," "'two'," "3);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); } @@ -212,7 +212,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, insert_without_bind) { "COL3 AS COL3 " "FROM " "TEST;"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); ASSERT_TRUE(rset->next()); @@ -248,7 +248,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, insert_with_bind) { "COL1 TEXT," "COL2 TEXT," "COL3 INTEGER);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, conn.getTableNames().size()); ASSERT_EQ("TEST", conn.getTableNames().front()); @@ -265,7 +265,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, insert_with_bind) { ":COL1," ":COL2," ":COL3);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->bindString(":COL1", "one"); stmt->bindString(":COL2", "two"); stmt->bindUint64(":COL3", 3); @@ -281,7 +281,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, insert_with_bind) { "COL3 AS COL3 " "FROM " "TEST;"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); ASSERT_TRUE(rset->next()); @@ -316,7 +316,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, isolated_transaction) { "COL1 TEXT," "COL2 TEXT," "COL3 INTEGER);"; - auto stmt = connForCreate.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = connForCreate.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, connForCreate.getTableNames().size()); ASSERT_EQ("TEST", connForCreate.getTableNames().front()); @@ -334,7 +334,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, isolated_transaction) { "'one'," "'two'," "3);"; - auto stmt = connForInsert.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = connForInsert.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); } @@ -348,7 +348,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, isolated_transaction) { "COUNT(*) AS NB_ROWS " "FROM " "TEST;"; - auto stmt = connForSelect.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = connForSelect.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); auto rset = stmt->executeQuery(); ASSERT_TRUE(rset->next()); @@ -375,7 +375,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeNonQuery_insert_violating_primar "CREATE TABLE TEST(" "COL1 INTEGER," "CONSTRAINT TEST_COL1_PK PRIMARY KEY(COL1));"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, conn.getTableNames().size()); ASSERT_EQ("TEST", conn.getTableNames().front()); @@ -388,7 +388,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeNonQuery_insert_violating_primar "COL1)" "VALUES(" ":COL1);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->bindUint64(":COL1", 1); stmt->executeNonQuery(); } @@ -400,7 +400,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeNonQuery_insert_violating_primar "COL1)" "VALUES(" ":COL1);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->bindUint64(":COL1", 1); ASSERT_THROW(stmt->executeNonQuery(), exception::DatabasePrimaryKeyError); } @@ -421,7 +421,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeQuery_insert_violating_primary_k "CREATE TABLE TEST(" "COL1 INTEGER," "CONSTRAINT TEST_COL1_PK PRIMARY KEY(COL1));"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->executeNonQuery(); ASSERT_EQ(1, conn.getTableNames().size()); ASSERT_EQ("TEST", conn.getTableNames().front()); @@ -434,7 +434,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeQuery_insert_violating_primary_k "COL1)" "VALUES(" ":COL1);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->bindUint64(":COL1", 1); stmt->executeNonQuery(); } @@ -446,7 +446,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeQuery_insert_violating_primary_k "COL1)" "VALUES(" ":COL1);"; - auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON); + auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::AUTOCOMMIT_ON); stmt->bindUint64(":COL1", 1); auto rset = stmt->executeQuery(); ASSERT_THROW(rset->next(), exception::DatabasePrimaryKeyError);