# 2017 December 9 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix zipfile load_static_extension db zipfile forcedelete test.zip do_execsql_test 1.0 { CREATE VIRTUAL TABLE temp.zz USING zipfile('test.zip'); PRAGMA table_info(zz); } { 0 name {} 0 {} 0 1 mode {} 0 {} 0 2 mtime {} 0 {} 0 3 sz {} 0 {} 0 4 data {} 0 {} 0 5 method {} 0 {} 0 } do_execsql_test 1.1 { INSERT INTO zz VALUES('f.txt', '-rw-r--r--', 1000000000, 5, 'abcde', 0); INSERT INTO zz VALUES('g.txt', '-rw-r--r--', 1000000002, 5, '12345', 0); } do_execsql_test 1.2 { SELECT name, mtime, data FROM zipfile('test.zip'); } { f.txt 1000000000 abcde g.txt 1000000002 12345 } do_execsql_test 1.3 { INSERT INTO zz VALUES('h.txt', '-rw-r--r--', 1000000004, 20, 'aaaaaaaaaabbbbbbbbbb', NULL ); } do_execsql_test 1.4 { SELECT name, mtime, zipfile_uncompress(data, sz, method), method FROM zipfile('test.zip'); } { f.txt 1000000000 abcde 0 g.txt 1000000002 12345 0 h.txt 1000000004 aaaaaaaaaabbbbbbbbbb 8 } finish_test