From ef16da27477a2a234cab8aed1e072555d6bb410e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 24 Feb 2019 13:30:22 +0000 Subject: Bring inline with clang-tidy checks --- libsqlitepp/sqlite-connection.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libsqlitepp/sqlite-connection.cpp') diff --git a/libsqlitepp/sqlite-connection.cpp b/libsqlitepp/sqlite-connection.cpp index 1539668..a93cad7 100644 --- a/libsqlitepp/sqlite-connection.cpp +++ b/libsqlitepp/sqlite-connection.cpp @@ -10,12 +10,12 @@ SQLite::ConnectionError::ConnectionError(sqlite3 * db) : { } -SQLite::Connection::Connection(const std::string & str) +SQLite::Connection::Connection(const std::string & str) : + db(nullptr) { if (sqlite3_open(str.c_str(), &db) != SQLITE_OK) { - ConnectionError err(db); - sqlite3_close(db); - throw err; + auto dbp = std::unique_ptr(db, &sqlite3_close); + throw ConnectionError(dbp.get()); } } @@ -27,7 +27,7 @@ SQLite::Connection::~Connection() void SQLite::Connection::beginTxInt() { - if (sqlite3_exec(db, "BEGIN TRANSACTION", NULL, NULL, NULL) != SQLITE_OK) { + if (sqlite3_exec(db, "BEGIN TRANSACTION", nullptr, nullptr, nullptr) != SQLITE_OK) { throw Error(db); } } @@ -35,7 +35,7 @@ SQLite::Connection::beginTxInt() void SQLite::Connection::commitTxInt() { - if (sqlite3_exec(db, "COMMIT TRANSACTION", NULL, NULL, NULL) != SQLITE_OK) { + if (sqlite3_exec(db, "COMMIT TRANSACTION", nullptr, nullptr, nullptr) != SQLITE_OK) { throw Error(db); } } @@ -43,7 +43,7 @@ SQLite::Connection::commitTxInt() void SQLite::Connection::rollbackTxInt() { - if (sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL) != SQLITE_OK) { + if (sqlite3_exec(db, "ROLLBACK TRANSACTION", nullptr, nullptr, nullptr) != SQLITE_OK) { throw Error(db); } } -- cgit v1.2.3