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.
13 # The focus of this file is testing of the proper handling of conversions
14 # to the native text representation.
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
23 PRAGMA encoding=utf16le;
31 INSERT INTO t1 VALUES('abc''123',5);
37 SELECT quote(x) || ' ' || quote(y) FROM t1
44 INSERT INTO t1 VALUES(x'616263646566',NULL);
50 SELECT quote(x) || ' ' || quote(y) FROM t1
52 } {{X'616263646566' NULL}}
54 ifcapable {bloblit && utf16} {
63 INSERT INTO t2 VALUES(x'61006200630064006500');
64 SELECT CAST(a AS text) FROM t2 WHERE CAST(a AS text) LIKE 'abc%';
69 SELECT CAST(x'61006200630064006500' AS text);
75 WHERE CAST(a AS text) LIKE CAST(x'610062002500' AS text);
80 # Try to attach a database with a different encoding.
82 ifcapable {utf16 && shared_cache} {
84 forcedelete test8.db test8.db-journal
85 set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
86 sqlite3 dbaux test8.db
88 db eval {SELECT 1 FROM sqlite_master LIMIT 1}
91 PRAGMA encoding='utf8';
98 ATTACH 'test.db' AS utf16;
99 SELECT 1 FROM utf16.sqlite_master LIMIT 1;
101 } {1 {attached databases must use the same text encoding as main database}}
103 forcedelete test8.db test8.db-journal
104 sqlite3_enable_shared_cache $::enable_shared_cache