avoid releasing the connection multiple times

when the ResultSet is released, the connection is returned. The same happens with the statement.
This commit is contained in:
Brian J. Cardiff 2016-08-29 16:41:29 -03:00
parent c3fce779fe
commit 6b72e01c2f

View file

@ -13,9 +13,14 @@ class SQLite3::Statement < DB::Statement
end
protected def perform_exec(args : Enumerable) : DB::ExecResult
rs = perform_query(args)
rs.move_next
rs.close
LibSQLite3.reset(self.to_unsafe)
args.each_with_index(1) do |arg, index|
bind_arg(index, arg)
end
# exec
step = LibSQLite3::Code.new LibSQLite3.step(self)
raise Exception.new(sqlite3_connection) unless step == LibSQLite3::Code::DONE
rows_affected = LibSQLite3.changes(sqlite3_connection).to_i64
last_id = LibSQLite3.last_insert_rowid(sqlite3_connection)