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.
16 # $Id: enc3.test,v 1.8 2008/01/22 01:48:09 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
24 PRAGMA encoding=utf16le;
32 INSERT INTO t1 VALUES('abc''123',5);
38 SELECT quote(x) || ' ' || quote(y) FROM t1
45 INSERT INTO t1 VALUES(x'616263646566',NULL);
51 SELECT quote(x) || ' ' || quote(y) FROM t1
53 } {{X'616263646566' NULL}}
55 ifcapable {bloblit && utf16} {
64 INSERT INTO t2 VALUES(x'61006200630064006500');
65 SELECT CAST(a AS text) FROM t2 WHERE a LIKE 'abc%';
70 SELECT CAST(x'61006200630064006500' AS text);
75 SELECT rowid FROM t2 WHERE a LIKE x'610062002500';
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