mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
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:
parent
c3fce779fe
commit
6b72e01c2f
1 changed files with 8 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue