mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
Make SQLite3::Connection#dump copy all DB pages (#16)
An issue with bindings caused less than total pages to be copied.
This commit is contained in:
parent
c3ee15db6a
commit
bbed6256a6
2 changed files with 14 additions and 1 deletions
|
@ -44,4 +44,17 @@ describe Connection do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "opens a database, inserts records (>1024K), and dumps to an in-memory db" do
|
||||
with_db do |db|
|
||||
with_mem_db do |in_memory_db|
|
||||
db.exec "create table person (name string, age integer)"
|
||||
db.transaction do |tx|
|
||||
100_000.times { tx.connection.exec "insert into person values (\"foo\", 10)" }
|
||||
end
|
||||
dump db, in_memory_db
|
||||
in_memory_db.scalar("select count(*) from person").should eq(100_000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ lib LibSQLite3
|
|||
fun errmsg = sqlite3_errmsg(SQLite3) : UInt8*
|
||||
|
||||
fun backup_init = sqlite3_backup_init(SQLite3, UInt8*, SQLite3, UInt8*) : SQLite3Backup
|
||||
fun backup_step = sqlite3_backup_step(SQLite3Backup, Int8) : Code
|
||||
fun backup_step = sqlite3_backup_step(SQLite3Backup, Int32) : Code
|
||||
fun backup_finish = sqlite3_backup_finish(SQLite3Backup) : Code
|
||||
|
||||
fun prepare_v2 = sqlite3_prepare_v2(db : SQLite3, zSql : UInt8*, nByte : Int32, ppStmt : Statement*, pzTail : UInt8**) : Int32
|
||||
|
|
Loading…
Reference in a new issue