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:
Hinrik Örn Sigurðsson 2017-01-17 20:57:27 +01:00 committed by Brian J. Cardiff
parent c3ee15db6a
commit bbed6256a6
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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