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
|
# 2018 March 22
#
# 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.
#
#***********************************************************************
#
source [file join [file dirname [info script]] rbu_common.tcl]
set ::testprefix rbucollate
ifcapable !icu_collations {
finish_test
return
}
db close
sqlite3_shutdown
sqlite3_config_uri 1
reset_db
# Create a simple RBU database. That expects to write to a table:
#
# CREATE TABLE t1(a PRIMARY KEY, b, c);
#
proc create_rbu1 {filename} {
forcedelete $filename
sqlite3 rbu1 $filename
rbu1 eval {
CREATE TABLE data_t1(a, b, c, rbu_control);
INSERT INTO data_t1 VALUES('a', 'one', 1, 0);
INSERT INTO data_t1 VALUES('b', 'two', 2, 0);
INSERT INTO data_t1 VALUES('c', 'three', 3, 0);
}
rbu1 close
return $filename
}
do_execsql_test 1.0 {
SELECT icu_load_collation('en_US', 'my-collate');
CREATE TABLE t1(a COLLATE "my-collate" PRIMARY KEY, b, c);
} {{}}
do_test 1.2 {
create_rbu1 testrbu.db
sqlite3rbu rbu test.db testrbu.db
rbu dbMain_eval { SELECT icu_load_collation('en_US', 'my-collate') }
rbu dbRbu_eval { SELECT icu_load_collation('en_US', 'my-collate') }
while 1 {
set rc [rbu step]
if {$rc!="SQLITE_OK"} break
}
rbu close
db eval { SELECT * FROM t1 }
} {a one 1 b two 2 c three 3}
#forcedelete testrbu.db
finish_test
|