1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix a problem triggered when a zipfile virtual table is created and written to

within the same transaction. And add other zipfile test.

FossilOrigin-Name: 48f1c556994d7f8f359c649a1da81eec02306106b68946a9a20b276742c4610d
This commit is contained in:
dan
2018-02-01 19:41:23 +00:00
parent 563ddbe54d
commit 15daa6b53e
6 changed files with 270 additions and 70 deletions

View File

@ -42,11 +42,19 @@ do_execsql_test 2.0 {
INSERT INTO setup(name, data) VALUES('a.txt', '1234567890');
}
do_faultsim_test 2 -faults oom* -body {
do_faultsim_test 2.1 -faults oom* -body {
execsql { SELECT name,data FROM zipfile('test.zip') }
} -test {
faultsim_test_result {0 {a.txt 1234567890}}
}
do_faultsim_test 2.2 -faults oom* -body {
execsql {
SELECT json_extract( zipfile_cds(z), '$.version-made-by' )
FROM zipfile('test.zip')
}
} -test {
faultsim_test_result {0 798}
}
forcedelete test.zip
reset_db
@ -75,6 +83,50 @@ do_faultsim_test 4 -faults oom* -body {
faultsim_test_result {0 {1 aaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbb}}
}
reset_db
load_static_extension db zipfile
do_execsql_test 5.0 {
CREATE VIRTUAL TABLE setup USING zipfile('test.zip')
}
do_faultsim_test 5.1 -faults oom* -prep {
forcedelete test.zip
} -body {
execsql {
INSERT INTO setup(name, data)
VALUES('a.txt', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa');
}
} -test {
faultsim_test_result {0 {}}
}
do_faultsim_test 5.2 -faults oom* -prep {
forcedelete test.zip
} -body {
execsql {
INSERT INTO setup(name, data) VALUES('dir', NULL)
}
} -test {
faultsim_test_result {0 {}}
}
do_faultsim_test 5.3 -faults oom* -prep {
forcedelete test.zip
execsql {
DROP TABLE IF EXISTS setup;
BEGIN;
CREATE VIRTUAL TABLE setup USING zipfile('test.zip')
}
} -body {
execsql {
INSERT INTO setup(name, data) VALUES('dir', NULL)
}
} -test {
catchsql { COMMIT }
faultsim_test_result {0 {}}
}
finish_test