1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
|
# 2010 October 29
#
# 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
source $testdir/malloc_common.tcl
# The tests in this file assume that SQLite is compiled without
# ENABLE_8_3_NAMES.
#
ifcapable 8_3_names {
puts -nonewline "SQLite compiled with SQLITE_ENABLE_8_3_NAMES. "
puts "Skipping tests multiplex-*."
finish_test
return
}
set g_chunk_size [ expr ($::SQLITE_MAX_PAGE_SIZE*16384) ]
set g_max_chunks 32
# This handles appending the chunk number
# to the end of the filename. if
# SQLITE_MULTIPLEX_EXT_OVWR is defined, then
# it overwrites the last 2 bytes of the
# file name with the chunk number.
proc multiplex_name {name chunk} {
if {$chunk==0} { return $name }
set num [format "%03d" $chunk]
ifcapable {multiplex_ext_overwrite} {
set name [string range $name 0 [expr [string length $name]-2-1]]
}
return $name$num
}
# This saves off the parameters and calls the
# underlying sqlite3_multiplex_control() API.
proc multiplex_set {db name chunk_size max_chunks} {
global g_chunk_size
global g_max_chunks
set g_chunk_size [ expr (($chunk_size+($::SQLITE_MAX_PAGE_SIZE-1)) & ~($::SQLITE_MAX_PAGE_SIZE-1)) ]
set g_max_chunks $max_chunks
set rc [catch {sqlite3_multiplex_control $db $name chunk_size $chunk_size} msg]
if { $rc==0 } {
set rc [catch {sqlite3_multiplex_control $db $name max_chunks $max_chunks} msg]
}
list $msg
}
# This attempts to delete the base file and
# and files with the chunk extension.
proc multiplex_delete {name} {
global g_max_chunks
forcedelete $name
for {set i 0} {$i<$g_max_chunks} {incr i} {
forcedelete [multiplex_name $name $i]
forcedelete [multiplex_name $name-journal $i]
forcedelete [multiplex_name $name-wal $i]
}
}
db close
sqlite3_shutdown
test_sqlite3_log xLog
proc xLog {error_code msg} {
lappend ::log $error_code $msg
}
unset -nocomplain log
multiplex_delete test.db
multiplex_delete test2.db
#-------------------------------------------------------------------------
# multiplex-1.1.*: Test initialize and shutdown.
do_test multiplex-1.1 { sqlite3_multiplex_initialize nosuchvfs 1 } {SQLITE_ERROR}
do_test multiplex-1.2 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.3 { sqlite3_multiplex_initialize "" 1 } {SQLITE_MISUSE}
do_test multiplex-1.4 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.5 { sqlite3_multiplex_initialize "" 0 } {SQLITE_OK}
do_test multiplex-1.6 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.7 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.8 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.9.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.9.2 { sqlite3 db test.db } {}
do_test multiplex-1.9.3 { multiplex_set db main 32768 16 } {SQLITE_OK}
do_test multiplex-1.9.4 { multiplex_set db main 32768 -1 } {SQLITE_OK}
do_test multiplex-1.9.6 { multiplex_set db main 31 16 } {SQLITE_OK}
do_test multiplex-1.9.7 { multiplex_set db main 32768 100 } {SQLITE_OK}
do_test multiplex-1.9.8 { multiplex_set db main 1073741824 1 } {SQLITE_OK}
do_test multiplex-1.9.9 { db close } {}
do_test multiplex-1.9.10 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.10.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.10.2 { sqlite3 db test.db } {}
do_test multiplex-1.10.3 { lindex [ catchsql { SELECT multiplex_control(2, 32768); } ] 0 } {0}
do_test multiplex-1.10.4 { lindex [ catchsql { SELECT multiplex_control(3, -1); } ] 0 } {0}
do_test multiplex-1.10.6 { lindex [ catchsql { SELECT multiplex_control(2, 31); } ] 0 } {0}
do_test multiplex-1.10.7 { lindex [ catchsql { SELECT multiplex_control(3, 100); } ] 0 } {0}
do_test multiplex-1.10.8 { lindex [ catchsql { SELECT multiplex_control(2, 1073741824); } ] 0 } {0}
do_test multiplex-1.10.9 { db close } {}
do_test multiplex-1.10.10 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.11.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.11.2 { sqlite3 db test.db } {}
do_test multiplex-1.11.3 { sqlite3_multiplex_control db main enable 0 } {SQLITE_OK}
do_test multiplex-1.11.4 { sqlite3_multiplex_control db main enable 1 } {SQLITE_OK}
do_test multiplex-1.11.5 { sqlite3_multiplex_control db main enable -1 } {SQLITE_OK}
do_test multiplex-1.11.6 { db close } {}
do_test multiplex-1.11.7 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.12.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.12.2 { sqlite3 db test.db } {}
do_test multiplex-1.12.3 { lindex [ catchsql { SELECT multiplex_control(1, 0); } ] 0 } {0}
do_test multiplex-1.12.4 { lindex [ catchsql { SELECT multiplex_control(1, 1); } ] 0 } {0}
do_test multiplex-1.12.5 { lindex [ catchsql { SELECT multiplex_control(1, -1); } ] 0 } {0}
do_test multiplex-1.12.6 { db close } {}
do_test multiplex-1.12.7 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.13.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.13.2 { sqlite3 db test.db } {}
do_test multiplex-1.13.3 { lindex [ catchsql { SELECT multiplex_control(-1, 0); } ] 0 } {1}
do_test multiplex-1.13.4 { lindex [ catchsql { SELECT multiplex_control(4, 1); } ] 0 } {1}
do_test multiplex-1.13.6 { db close } {}
do_test multiplex-1.13.7 { sqlite3_multiplex_shutdown } {SQLITE_OK}
#-------------------------------------------------------------------------
# Some simple warm-body tests with a single database file in rollback
# mode:
#
# multiplex-2.1.*: Test simple writing to a multiplex file.
#
# multiplex-2.2.*: More writing.
#
# multiplex-2.3.*: Open and close a second db.
#
# multiplex-2.4.*: Try to shutdown the multiplex system before closing the db
# file. Check that this fails and the multiplex system still works
# afterwards. Then close the database and successfully shut
# down the multiplex system.
#
# multiplex-2.5.*: More reading/writing.
#
# multiplex-2.6.*: More reading/writing with varying small chunk sizes, as
# well as varying journal mode.
#
# multiplex-2.7.*: Disable/enable tests.
#
sqlite3_multiplex_initialize "" 1
multiplex_set db main 32768 16
forcedelete test.x
foreach f [glob -nocomplain {test.x*[0-9][0-9][0-9]}] {
forcedelete $f
}
do_test multiplex-2.1.2 {
sqlite3 db test.x
execsql {
PRAGMA page_size=1024;
PRAGMA auto_vacuum=OFF;
PRAGMA journal_mode=DELETE;
}
execsql {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, randomblob(1100));
INSERT INTO t1 VALUES(2, randomblob(1100));
}
} {}
do_test multiplex-2.1.3 { file size [multiplex_name test.x 0] } {4096}
do_test multiplex-2.1.4 {
execsql { INSERT INTO t1 VALUES(3, randomblob(1100)) }
} {}
do_execsql_test multiplex-2.1.5 {
PRAGMA multiplex_enabled;
PRAGMA multiplex_filecount;
PRAGMA multiplex_chunksize;
} {1 1 2147418112}
do_test multiplex-2.2.1 {
execsql { INSERT INTO t1 VALUES(3, randomblob(1100)) }
} {}
do_test multiplex-2.2.3 { file size [multiplex_name test.x 0] } {6144}
do_test multiplex-2.3.1 {
sqlite3 db2 test2.x
db2 close
} {}
unset -nocomplain ::log
#do_test multiplex-2.4.1 {
# sqlite3_multiplex_shutdown
#} {SQLITE_MISUSE}
do_test multiplex-2.4.2 {
execsql { INSERT INTO t1 VALUES(3, randomblob(1100)) }
} {}
#do_test multiplex-2.4.3 {
# set ::log
#} {SQLITE_MISUSE {sqlite3_multiplex_shutdown() called while database connections are still open}}
do_test multiplex-2.4.4 { file size [multiplex_name test.x 0] } {7168}
do_test multiplex-2.4.5 {
db close
sqlite3 db test.x
db eval vacuum
db close
glob test.x*
} {test.x}
do_test multiplex-2.4.99 {
sqlite3_multiplex_shutdown
} {SQLITE_OK}
do_test multiplex-2.5.1 {
multiplex_delete test.x
sqlite3_multiplex_initialize "" 1
sqlite3 db test.x
multiplex_set db main 4096 16
} {SQLITE_OK}
do_test multiplex-2.5.2 {
execsql {
PRAGMA page_size = 1024;
PRAGMA journal_mode = delete;
PRAGMA auto_vacuum = off;
CREATE TABLE t1(a PRIMARY KEY, b);
}
} {delete}
do_test multiplex-2.5.3 {
execsql {
INSERT INTO t1 VALUES(1, 'one');
INSERT INTO t1 VALUES(2, randomblob(4000));
INSERT INTO t1 VALUES(3, 'three');
INSERT INTO t1 VALUES(4, randomblob(4000));
INSERT INTO t1 VALUES(5, 'five');
INSERT INTO t1 VALUES(6, randomblob($g_chunk_size));
INSERT INTO t1 VALUES(7, randomblob($g_chunk_size));
}
} {}
do_test multiplex-2.5.4 {
db eval {SELECT * FROM t1 WHERE a=1}
} {1 one}
do_test multiplex-2.5.5 {
db eval {SELECT * FROM t1 WHERE a=3}
} {3 three}
do_test multiplex-2.5.6 {
db eval {SELECT * FROM t1 WHERE a=5}
} {5 five}
do_test multiplex-2.5.7 {
db eval {SELECT a,length(b) FROM t1 WHERE a=2}
} {2 4000}
do_test multiplex-2.5.8 {
db eval {SELECT a,length(b) FROM t1 WHERE a=4}
} {4 4000}
do_test multiplex-2.5.9 { file size [multiplex_name test.x 0] } [list $g_chunk_size]
do_test multiplex-2.5.10 { file size [multiplex_name test.x 1] } [list $g_chunk_size]
do_execsql_test multiplex-2.5.11 {
PRAGMA multiplex_enabled;
PRAGMA multiplex_filecount;
PRAGMA multiplex_chunksize;
} {1 3 65536}
sqlite3 db test.x
do_execsql_test multiplex-2.5.12 {
PRAGMA multiplex_filecount;
PRAGMA multiplex_chunksize;
} {3 65536}
do_test multiplex-2.5.99 {
db close
sqlite3_multiplex_shutdown
} {SQLITE_OK}
set all_journal_modes {delete persist truncate memory off}
foreach jmode $all_journal_modes {
for {set sz 151} {$sz<8000} {set sz [expr $sz+419]} {
do_test multiplex-2.6.1.$sz.$jmode {
multiplex_delete test.db
sqlite3_multiplex_initialize "" 1
sqlite3 db test.db
multiplex_set db main $sz 32
} {SQLITE_OK}
do_test multiplex-2.6.2.$sz.$jmode {
db eval {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = off;
}
db eval "PRAGMA journal_mode = $jmode;"
} $jmode
do_test multiplex-2.6.3.$sz.$jmode {
execsql {
CREATE TABLE t1(a PRIMARY KEY, b);
INSERT INTO t1 VALUES(1, 'one');
INSERT INTO t1 VALUES(2, randomblob($g_chunk_size));
}
} {}
do_test multiplex-2.6.4.$sz.$jmode {
db eval {SELECT b FROM t1 WHERE a=1}
} {one}
do_test multiplex-2.6.5.$sz.$jmode {
db eval {SELECT length(b) FROM t1 WHERE a=2}
} [list $g_chunk_size]
do_test multiplex-2.6.6.$sz.$jmode { file size [multiplex_name test.db 0] } [list $g_chunk_size]
do_test multiplex-2.6.99.$sz.$jmode {
db close
sqlite3_multiplex_shutdown
} {SQLITE_OK}
}
}
do_test multiplex-2.7.1 { multiplex_delete test.db } {}
do_test multiplex-2.7.2 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-2.7.3 { sqlite3 db test.db } {}
do_test multiplex-2.7.4 { lindex [ catchsql { SELECT multiplex_control(2, 65536); } ] 0 } {0}
do_test multiplex-2.7.5 { lindex [ catchsql { SELECT multiplex_control(1, 0); } ] 0 } {0}
do_test multiplex-2.7.6 {
execsql {
CREATE TABLE t1(a PRIMARY KEY, b);
INSERT INTO t1 VALUES(1, randomblob(1000));
}
} {}
# verify only one file, and file size is less than chunks size
do_test multiplex-2.7.7 { expr ([file size [multiplex_name test.db 0]] < 65536) } {1}
do_test multiplex-2.7.8 { file exists [multiplex_name test.db 1] } {0}
do_test multiplex-2.7.9 {
execsql {
INSERT INTO t1 VALUES(2, randomblob(65536));
}
} {}
# verify only one file, and file size exceeds chunks size
do_test multiplex-2.7.10 { expr ([file size [multiplex_name test.db 0]] > 65536) } {1}
do_test multiplex-2.7.11 { file exists [multiplex_name test.db 1] } {0}
do_test multiplex-2.7.12 { db close } {}
do_test multiplex-2.7.13 { sqlite3_multiplex_shutdown } {SQLITE_OK}
#-------------------------------------------------------------------------
# Try some tests with more than one connection to a database file. Still
# in rollback mode.
#
# multiplex-3.1.*: Two connections to a single database file.
#
# multiplex-3.2.*: Two connections to each of several database files (that
# are in the same multiplex group).
#
do_test multiplex-3.1.1 {
multiplex_delete test.db
sqlite3_multiplex_initialize "" 1
sqlite3 db test.db
multiplex_set db main 32768 16
} {SQLITE_OK}
do_test multiplex-3.1.2 {
execsql {
PRAGMA page_size = 1024;
PRAGMA journal_mode = delete;
PRAGMA auto_vacuum = off;
CREATE TABLE t1(a PRIMARY KEY, b);
INSERT INTO t1 VALUES(1, 'one');
}
file size [multiplex_name test.db 0]
} {3072}
do_test multiplex-3.1.3 {
sqlite3 db2 test.db
execsql { CREATE TABLE t2(a, b) } db2
} {}
do_test multiplex-3.1.4 {
execsql { CREATE TABLE t3(a, b) }
} {}
do_test multiplex-3.1.5 {
catchsql { CREATE TABLE t3(a, b) }
} {1 {table t3 already exists}}
do_test multiplex-3.1.6 {
db close
db2 close
} {}
do_test multiplex-3.2.1a {
multiplex_delete test.db
multiplex_delete test2.db
sqlite3 db1a test.db
sqlite3 db2a test2.db
foreach db {db1a db2a} {
execsql {
PRAGMA page_size = 1024;
PRAGMA journal_mode = delete;
PRAGMA auto_vacuum = off;
CREATE TABLE t1(a, b);
} $db
}
list [file size [multiplex_name test.db 0]] [file size [multiplex_name test2.db 0]]
} {2048 2048}
do_test multiplex-3.2.1b {
sqlite3 db1b test.db
sqlite3 db2b test2.db
} {}
do_test multiplex-3.2.2 { execsql { INSERT INTO t1 VALUES('x', 'y') } db1a } {}
do_test multiplex-3.2.3 { execsql { INSERT INTO t1 VALUES('v', 'w') } db1b } {}
do_test multiplex-3.2.4 { execsql { INSERT INTO t1 VALUES('t', 'u') } db2a } {}
do_test multiplex-3.2.5 { execsql { INSERT INTO t1 VALUES('r', 's') } db2b } {}
do_test multiplex-3.2.6 {
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db1a
} {}
do_test multiplex-3.2.7 {
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db1b
} {}
do_test multiplex-3.2.8 {
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db2a
} {}
do_test multiplex-3.2.9 {
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db2b
} {}
do_test multiplex-3.3.1 {
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db1a
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db1b
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db2a
execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db2b
} {}
do_test multiplex-3.2.X {
foreach db {db1a db2a db2b db1b} { catch { $db close } }
} {}
#-------------------------------------------------------------------------
#
sqlite3_multiplex_initialize "" 1
multiplex_set db main 32768 16
# Return a list of all currently defined multiplexs.
proc multiplex_list {} {
glob -nocomplain test2.db*
}
do_test multiplex-4.1.6 {
multiplex_delete test2.db
sqlite3 db test2.db
db eval {CREATE TABLE t2(x); INSERT INTO t2 VALUES('tab-t2');}
set res [multiplex_list]
list [regexp {test2.db} $res]
} {1}
do_test multiplex-4.1.6a {
sqlite3 db2 test2.db
db2 eval {SELECT * FROM t2}
} {tab-t2}
do_test multiplex-4.1.7 {
execsql {INSERT INTO t2 VALUES(zeroblob(200000))}
} {}
do_test multiplex-4.1.8 {
sqlite3 db2 test2.db
db2 eval {SELECT count(*) FROM t2}
} {2}
do_test multiplex-4.1.8a {
db2 eval { DELETE FROM t2 WHERE x = 'tab-t2' }
} {}
do_test multiplex-4.1.8b {
sqlite3 db2 test2.db
db2 eval {SELECT count(*) FROM t2}
} {1}
do_test multiplex-4.1.9 {
execsql {INSERT INTO t2 VALUES(zeroblob(200000))}
} {}
do_test multiplex-4.1.10 {
set res [multiplex_list]
list [regexp {test2.db} $res]
} {1}
do_test multiplex-4.1.11 {
db2 close
set res [multiplex_list]
list [regexp {test2.db} $res]
} {1}
do_test multiplex-4.1.12 {
db close
multiplex_list
} {test2.db}
#-------------------------------------------------------------------------
# The following tests test that the multiplex VFS handles malloc and IO
# errors.
#
sqlite3_multiplex_initialize "" 1
multiplex_set db main 32768 16
do_faultsim_test multiplex-5.1 -prep {
catch {db close}
} -body {
sqlite3 db test2.db
}
do_faultsim_test multiplex-5.2 -prep {
catch {db close}
} -body {
sqlite3 db test.db
}
catch { db close }
multiplex_delete test.db
multiplex_delete test2.db
do_test multiplex-5.3.prep {
sqlite3 db test.db
execsql {
PRAGMA auto_vacuum = 1;
PRAGMA page_size = 1024;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(10, zeroblob(1200));
}
faultsim_save_and_close
} {}
do_faultsim_test multiplex-5.3 -prep {
faultsim_restore_and_reopen
} -body {
execsql { DELETE FROM t1 }
}
do_test multiplex-5.4.1 {
catch { db close }
multiplex_delete test.db
file mkdir test.db
list [catch { sqlite3 db test.db } msg] $msg
} {1 {unable to open database file}}
catch { delete_file test.db }
do_faultsim_test multiplex-5.5 -prep {
catch { sqlite3_multiplex_shutdown }
} -body {
sqlite3_multiplex_initialize "" 1
multiplex_set db main 32768 16
}
#-------------------------------------------------------------------------
# Test that you can vacuum a multiplex'ed DB.
ifcapable vacuum {
sqlite3_multiplex_shutdown
do_test multiplex-6.0.0 {
multiplex_delete test.db
multiplex_delete test.x
sqlite3_multiplex_initialize "" 1
sqlite3 db test.x
multiplex_set db main 4096 16
} {SQLITE_OK}
do_test multiplex-6.1.0 {
execsql {
PRAGMA page_size=1024;
PRAGMA journal_mode=DELETE;
PRAGMA auto_vacuum=OFF;
}
execsql {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, randomblob($g_chunk_size));
INSERT INTO t1 VALUES(2, randomblob($g_chunk_size));
}
} {}
do_test multiplex-6.2.1 { file size [multiplex_name test.x 0] } [list $g_chunk_size]
do_test multiplex-6.2.2 { file size [multiplex_name test.x 1] } [list $g_chunk_size]
do_test multiplex-6.3.0 {
execsql { VACUUM }
} {}
do_test multiplex-6.99 {
db close
multiplex_delete test.x
sqlite3_multiplex_shutdown
} {SQLITE_OK}
}
catch { db close }
catch { sqlite3_multiplex_shutdown }
sqlite3_shutdown
test_sqlite3_log
sqlite3_initialize
finish_test
|