summaryrefslogtreecommitdiff
path: root/libsqlitepp/sqlite-connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-02-24 13:30:22 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-02-24 13:30:22 +0000
commitef16da27477a2a234cab8aed1e072555d6bb410e (patch)
tree540a3ffaa7ade15ef4beca5a786bb9270721ed51 /libsqlitepp/sqlite-connection.cpp
parentBring up-to-date with libdbpp. (diff)
downloadlibdbpp-sqlite-ef16da27477a2a234cab8aed1e072555d6bb410e.tar.bz2
libdbpp-sqlite-ef16da27477a2a234cab8aed1e072555d6bb410e.tar.xz
libdbpp-sqlite-ef16da27477a2a234cab8aed1e072555d6bb410e.zip
Bring inline with clang-tidy checks
Diffstat (limited to 'libsqlitepp/sqlite-connection.cpp')
-rw-r--r--libsqlitepp/sqlite-connection.cpp14
1 files changed, 7 insertions, 7 deletions
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<sqlite3, decltype(&sqlite3_close)>(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);
}
}