interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / rbu / rbucollate.test

58 lines · 1535 bytes Raw Blame History
1# 2018 March 22
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
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.
9#
10#***********************************************************************
11#
12
13source [file join [file dirname [info script]] rbu_common.tcl]
14if_no_rbu_support { finish_test ; return }
15set ::testprefix rbucollate
16
17ifcapable !icu_collations {
18 finish_test
19 return
20}
21
22# Create a simple RBU database. That expects to write to a table:
23#
24# CREATE TABLE t1(a PRIMARY KEY, b, c);
25#
26proc create_rbu1 {filename} {
27 forcedelete $filename
28 sqlite3 rbu1 $filename
29 rbu1 eval {
30 CREATE TABLE data_t1(a, b, c, rbu_control);
31 INSERT INTO data_t1 VALUES('a', 'one', 1, 0);
32 INSERT INTO data_t1 VALUES('b', 'two', 2, 0);
33 INSERT INTO data_t1 VALUES('c', 'three', 3, 0);
34 }
35 rbu1 close
36 return $filename
37}
38
39do_execsql_test 1.0 {
40 SELECT icu_load_collation('en_US', 'my-collate');
41 CREATE TABLE t1(a COLLATE "my-collate" PRIMARY KEY, b, c);
42} {{}}
43
44do_test 1.2 {
45 create_rbu1 testrbu.db
46 sqlite3rbu rbu test.db testrbu.db
47 rbu dbMain_eval { SELECT icu_load_collation('en_US', 'my-collate') }
48 rbu dbRbu_eval { SELECT icu_load_collation('en_US', 'my-collate') }
49 while 1 {
50 set rc [rbu step]
51 if {$rc!="SQLITE_OK"} break
52 }
53 rbu close
54 db eval { SELECT * FROM t1 }
55} {a one 1 b two 2 c three 3}
56
57#forcedelete testrbu.db
58finish_test