Commit af4bb41a authored by Steven Murray's avatar Steven Murray
Browse files

Renamed rdbms::AutocommitMode::ON and rdbms::AutocommitMode::OFF to...

Renamed rdbms::AutocommitMode::ON and rdbms::AutocommitMode::OFF to rdbms::AutocommitMode::AUTOCOMMIT_ON and rdbms::AutocommitMode::OFF respectively
parent 21dbdefd
......@@ -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;
}
}
......
......@@ -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);
......
......@@ -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());
}
......
This diff is collapsed.
......@@ -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 &) {
......
......@@ -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
......
......@@ -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);
}
}
......
......@@ -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());
}
......
......@@ -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());
......
......@@ -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());
......
......@@ -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");
......
......@@ -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:
......
......@@ -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()) {
......
......@@ -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;
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment