From 616af3ba1d20cf89ff378b2e5bd21df0c4e1b314 Mon Sep 17 00:00:00 2001 From: Benoist Date: Mon, 29 May 2017 20:20:32 +0200 Subject: [PATCH] better closing checks (#23) --- .travis.yml | 2 +- src/sqlite3/connection.cr | 2 +- src/sqlite3/lib_sqlite3.cr | 1 + src/sqlite3/statement.cr | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ef359b..d42871c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,4 @@ before_install: - sudo apt-get -y update - sudo apt-cache show sqlite3 - sudo apt-get install sqlite3=3.7.15.1-1~travis1 - - sudo sqlite3 -version \ No newline at end of file + - sudo sqlite3 -version diff --git a/src/sqlite3/connection.cr b/src/sqlite3/connection.cr index 367ce3c..d405654 100644 --- a/src/sqlite3/connection.cr +++ b/src/sqlite3/connection.cr @@ -32,7 +32,7 @@ class SQLite3::Connection < DB::Connection def do_close super - LibSQLite3.close_v2(self) + check LibSQLite3.close(self) end # :nodoc: diff --git a/src/sqlite3/lib_sqlite3.cr b/src/sqlite3/lib_sqlite3.cr index 8b6e270..f904772 100644 --- a/src/sqlite3/lib_sqlite3.cr +++ b/src/sqlite3/lib_sqlite3.cr @@ -48,4 +48,5 @@ lib LibSQLite3 fun finalize = sqlite3_finalize(stmt : Statement) : Int32 fun close_v2 = sqlite3_close_v2(SQLite3) : Int32 + fun close = sqlite3_close(SQLite3) : Int32 end diff --git a/src/sqlite3/statement.cr b/src/sqlite3/statement.cr index f0f1e6c..90c4d7e 100644 --- a/src/sqlite3/statement.cr +++ b/src/sqlite3/statement.cr @@ -28,7 +28,7 @@ class SQLite3::Statement < DB::Statement DB::ExecResult.new rows_affected, last_id end - protected def on_close + protected def do_close super check LibSQLite3.finalize(self) end