mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
Multi-step exec support (#27)
This commit is contained in:
parent
c850ec4b72
commit
e6d5ad33c3
2 changed files with 13 additions and 1 deletions
|
@ -119,4 +119,12 @@ DB::DriverSpecs(DB::Any).run do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "handles single-step pragma statements" do |db|
|
||||||
|
db.exec %(PRAGMA synchronous = OFF)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "handles multi-step pragma statements" do |db|
|
||||||
|
db.exec %(PRAGMA journal_mode = memory)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,11 @@ class SQLite3::Statement < DB::Statement
|
||||||
end
|
end
|
||||||
|
|
||||||
# exec
|
# exec
|
||||||
step = LibSQLite3::Code.new LibSQLite3.step(self)
|
step = uninitialized LibSQLite3::Code
|
||||||
|
loop do
|
||||||
|
step = LibSQLite3::Code.new LibSQLite3.step(self)
|
||||||
|
break unless step == LibSQLite3::Code::ROW
|
||||||
|
end
|
||||||
raise Exception.new(sqlite3_connection) unless step == LibSQLite3::Code::DONE
|
raise Exception.new(sqlite3_connection) unless step == LibSQLite3::Code::DONE
|
||||||
|
|
||||||
rows_affected = LibSQLite3.changes(sqlite3_connection).to_i64
|
rows_affected = LibSQLite3.changes(sqlite3_connection).to_i64
|
||||||
|
|
Loading…
Reference in a new issue