3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this script is testing the file name handling provided
13 # by the "win32-longpath" VFS.
16 if {$tcl_platform(platform)!="windows"} return
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20 set testprefix win32longpath
23 file_control_vfsname db
27 set path [file nativename [get_pwd]]
28 sqlite3 db [file join $path test.db] -vfs win32-longpath
31 file_control_vfsname db
38 INSERT INTO t1 VALUES(1);
39 INSERT INTO t1 VALUES(2);
40 INSERT INTO t1 VALUES(3);
41 INSERT INTO t1 VALUES(4);
42 SELECT x FROM t1 ORDER BY x;
47 set longPath(1) \\\\?\\$path\\[pid]
48 make_win32_dir $longPath(1)
50 set longPath(2) $longPath(1)\\[string repeat X 255]
51 make_win32_dir $longPath(2)
53 set longPath(3) $longPath(2)\\[string repeat Y 255]
54 make_win32_dir $longPath(3)
56 set fileName $longPath(3)\\test.db
59 list [catch {sqlite3 db2 [string range $fileName 4 end]} msg] $msg
60 } {1 {unable to open database file}}
62 sqlite3 db3 $fileName -vfs win32-longpath
68 INSERT INTO t1 VALUES(5);
69 INSERT INTO t1 VALUES(6);
70 INSERT INTO t1 VALUES(7);
71 INSERT INTO t1 VALUES(8);
72 SELECT x FROM t1 ORDER BY x;
78 # puts " Database exists \{[exists_win32_path $fileName]\}"
80 sqlite3 db3 $fileName -vfs win32-longpath
84 PRAGMA journal_mode = WAL;
91 INSERT INTO t1 VALUES(9);
92 INSERT INTO t1 VALUES(10);
93 INSERT INTO t1 VALUES(11);
94 INSERT INTO t1 VALUES(12);
95 SELECT x FROM t1 ORDER BY x;
98 } {5 6 7 8 9 10 11 12}
101 # puts " Database exists \{[exists_win32_path $fileName]\}"
103 do_delete_win32_file $fileName
104 # puts " Files remaining \{[find_win32_file $longPath(3)\\*]\}"
106 do_remove_win32_dir $longPath(3)
107 do_remove_win32_dir $longPath(2)
108 do_remove_win32_dir $longPath(1)