1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

The SQLITE_OMIT_UTF16 macro now removes lots of code and all tests still pass. (CVS 2100)

FossilOrigin-Name: 98c7a55478f7c465b219edc1a33eee222586fd65
This commit is contained in:
drh
2004-11-14 21:56:29 +00:00
parent 5436dc2d97
commit 6c62608fc6
20 changed files with 172 additions and 112 deletions

View File

@@ -139,6 +139,7 @@ SRC = \
# #
TESTSRC = \ TESTSRC = \
$(TOP)/src/btree.c \ $(TOP)/src/btree.c \
$(TOP)/src/date.c \
$(TOP)/src/func.c \ $(TOP)/src/func.c \
$(TOP)/src/os_mac.c \ $(TOP)/src/os_mac.c \
$(TOP)/src/os_unix.c \ $(TOP)/src/os_unix.c \

View File

@@ -113,6 +113,7 @@ SRC = \
# #
TESTSRC = \ TESTSRC = \
$(TOP)/src/btree.c \ $(TOP)/src/btree.c \
$(TOP)/src/date.c \
$(TOP)/src/func.c \ $(TOP)/src/func.c \
$(TOP)/src/os_mac.c \ $(TOP)/src/os_mac.c \
$(TOP)/src/os_unix.c \ $(TOP)/src/os_unix.c \

View File

@@ -1,6 +1,6 @@
C Changes\stoward\sreducing\scode\ssize\swhen\sSQLITE_OMIT_UTF16\sis\senabled.\s(CVS\s2099) C The\sSQLITE_OMIT_UTF16\smacro\snow\sremoves\slots\sof\scode\sand\sall\stests\sstill\spass.\s(CVS\s2100)
D 2004-11-14T04:04:17 D 2004-11-14T21:56:29
F Makefile.in c4d2416860f472a1e3393714d0372074197565df F Makefile.in e747bb5ba34ccbdd81f79dcf1b2b33c02817c21d
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
F VERSION 342b6d5fde93b6d45023e2fee0163dda6464b9d6 F VERSION 342b6d5fde93b6d45023e2fee0163dda6464b9d6
@@ -16,7 +16,7 @@ F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826 F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826
F main.mk 32367381f4e75d7c13f24a739495e60a7b622256 F main.mk 02cb9ff3e70a3b24ede38dd458af451c871cd00f
F mkdll.sh 468d4f41d3ea98221371df4825cfbffbaac4d7e4 F mkdll.sh 468d4f41d3ea98221371df4825cfbffbaac4d7e4
F mkopcodec.awk 14a794f7b206976afc416b30fe8e0fc97f3434e9 F mkopcodec.awk 14a794f7b206976afc416b30fe8e0fc97f3434e9
F mkopcodeh.awk 4090944e4de0a2ccb99aa0083290f73bce4db406 F mkopcodeh.awk 4090944e4de0a2ccb99aa0083290f73bce4db406
@@ -32,15 +32,15 @@ F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
F src/btree.c b0b6238c54302e779aa9cb958c8c6da7cab4a090 F src/btree.c b0b6238c54302e779aa9cb958c8c6da7cab4a090
F src/btree.h 861e40b759a195ba63819740e484390012cf81ab F src/btree.h 861e40b759a195ba63819740e484390012cf81ab
F src/build.c a95eb1181247368b0ffe2eed121a43735976a964 F src/build.c a95eb1181247368b0ffe2eed121a43735976a964
F src/date.c 4fd4e90b3880dacd67305e96330940dc243ffc10 F src/date.c 65536e7ea04fdde6e0551264fca15966966e171f
F src/delete.c f0af21a1ede15524a5edd59fe10ef486283a1ee9 F src/delete.c f0af21a1ede15524a5edd59fe10ef486283a1ee9
F src/expr.c 4ee3e47358c92a919062255b14057a7a8f641e01 F src/expr.c 4ee3e47358c92a919062255b14057a7a8f641e01
F src/func.c b68572e79ada56dd038b7e71755212215092b717 F src/func.c 181ea4b8bbc621457838494a440d2e4e2307ab70
F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c 9524a6c3e86cbdbae3313f6a083bb9a3e7a2462b F src/insert.c 9524a6c3e86cbdbae3313f6a083bb9a3e7a2462b
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
F src/main.c c7dc54c62c86cab8b2e2883aef607c179eefa611 F src/main.c 22f12e9d453065dce5ef5feabc41a5fa2399b8c3
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h 38258df2db895499b6e2957dbf17f25e0df71667 F src/os.h 38258df2db895499b6e2957dbf17f25e0df71667
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73 F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
@@ -64,23 +64,23 @@ F src/sqlite.h.in a44eac0716bf4751447160d5c8ed049ece66d45a
F src/sqliteInt.h 8569ce94e891a854de71d7bd628da1d25ee6dfe4 F src/sqliteInt.h 8569ce94e891a854de71d7bd628da1d25ee6dfe4
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c 7f1a1a678140e6901c8954590ca2aabe50b48f71 F src/tclsqlite.c 7f1a1a678140e6901c8954590ca2aabe50b48f71
F src/test1.c af2cc6864464b18675c9bdbb02142d765f2f0c6d F src/test1.c 8c330b53aa04d234ea7da6a90141ce9958a8901c
F src/test2.c b11fa244fff02190707dd0879987c37c75e61fc8 F src/test2.c b11fa244fff02190707dd0879987c37c75e61fc8
F src/test3.c 6f1ec93e13632a004b527049535079eda84c459d F src/test3.c 6f1ec93e13632a004b527049535079eda84c459d
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1 F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5
F src/tokenize.c 2ad3d1ae1a0a70746db0b31a0a74f58050a3c39a F src/tokenize.c 2ad3d1ae1a0a70746db0b31a0a74f58050a3c39a
F src/trigger.c 0c91b56182560263733e4b035acdb939bd1cf0e2 F src/trigger.c 0c91b56182560263733e4b035acdb939bd1cf0e2
F src/update.c 3cc67f6053495152e82a6a48c93ed331218e936e F src/update.c 3cc67f6053495152e82a6a48c93ed331218e936e
F src/utf.c f4f83acd73389090e32d6589d307fc55d794c7ed F src/utf.c e45ce11be6922408cd381561721f6cca7d3b992a
F src/util.c 005fdf2d008f3429d081766ad6098fdd86d8d8e6 F src/util.c 005fdf2d008f3429d081766ad6098fdd86d8d8e6
F src/vacuum.c ecb4a2c6f1ac5cc9b394dc64d3bb14ca650c4f60 F src/vacuum.c ecb4a2c6f1ac5cc9b394dc64d3bb14ca650c4f60
F src/vdbe.c 312df85707ed3d2a90ac2ccec4e614b6996842d9 F src/vdbe.c ab76044e19a2f1ebcff1b86e72620d2a2d323337
F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181 F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181
F src/vdbeInt.h 6017100adff362b8dfa37a69e3f1431f084bfa5b F src/vdbeInt.h 6017100adff362b8dfa37a69e3f1431f084bfa5b
F src/vdbeapi.c 3965bf4678ae32c05f73550c1b5be3268f9f3006 F src/vdbeapi.c 74be7f96c0a1ac275661f8b32276ac521d9ce37c
F src/vdbeaux.c c6da55e0096e141211f918837eca98e0be6400b4 F src/vdbeaux.c c6da55e0096e141211f918837eca98e0be6400b4
F src/vdbemem.c ef9ac7d32acfe4bce5c5b408b1294c8d9e0cdb56 F src/vdbemem.c 5876c8abf4374fef671f4fd8dc333ef3fc95a2f0
F src/where.c 6e637a6b3e61fe3104adc4e5caa4738bf6570daa F src/where.c 6e637a6b3e61fe3104adc4e5caa4738bf6570daa
F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c
F test/alter.test ea6b104fa83da6970b1ce61885827817bdaced3a F test/alter.test ea6b104fa83da6970b1ce61885827817bdaced3a
@@ -93,7 +93,7 @@ F test/autovacuum.test d0517eb9fa7bb12c9e7f3b5d6fd4275d22e57c15
F test/autovacuum_crash.test 2dca85cbcc497098e45e8847c86407eb3554f3d4 F test/autovacuum_crash.test 2dca85cbcc497098e45e8847c86407eb3554f3d4
F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bind.test fa74f98417cd313f28272acff832a8a7d04a0916 F test/bind.test 5ff767304c68ee0eb4e0efda1fbbea3fffdc5489
F test/blob.test fc41fe95bdc10da51f0dee73ce86e75ce1d6eb9d F test/blob.test fc41fe95bdc10da51f0dee73ce86e75ce1d6eb9d
F test/btree.test 7ae2c9dde6c9fffd61b96efe28f9e28b396ddd78 F test/btree.test 7ae2c9dde6c9fffd61b96efe28f9e28b396ddd78
F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635 F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635
@@ -103,7 +103,7 @@ F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027
F test/btree7.test a6d3b842db22af97dd14b989e90a2fd96066b72f F test/btree7.test a6d3b842db22af97dd14b989e90a2fd96066b72f
F test/btree8.test eee59cfd3a0151adbc7d85e5373f31ae6d4c3061 F test/btree8.test eee59cfd3a0151adbc7d85e5373f31ae6d4c3061
F test/capi2.test 1ec97bf8896185aec2366c7d07b01edef6ae4b7e F test/capi2.test 1ec97bf8896185aec2366c7d07b01edef6ae4b7e
F test/capi3.test 1e15509a61fa93ef637ec9c2a3fc93bc1d971a3b F test/capi3.test c9b162838cda7f61c6cfefed304b69287f2fc688
F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336 F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336
F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03 F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03
F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036 F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036
@@ -119,9 +119,9 @@ F test/date.test dda578ec1857837156bd8b32f8e09d81d7d7881c
F test/delete.test fc29491f6a7ac899ce29f4549a104809e245d9a6 F test/delete.test fc29491f6a7ac899ce29f4549a104809e245d9a6
F test/delete2.test 1d3f99f52f50eb6ed10c803f80540a6857307a7d F test/delete2.test 1d3f99f52f50eb6ed10c803f80540a6857307a7d
F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0 F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0
F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961 F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
F test/enc2.test 6d1a2650e9da43eab499d18ca694a0cb6ec69dee F test/enc2.test 6d1a2650e9da43eab499d18ca694a0cb6ec69dee
F test/enc3.test a96f4a7c44bac4d63bdc4ff422b8049912083998 F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837
F test/expr.test 20ddaf66c7ab673c1d0c953889e3466139256f9a F test/expr.test 20ddaf66c7ab673c1d0c953889e3466139256f9a
F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05 F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05
@@ -152,14 +152,14 @@ F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a
F test/misc2.test 9d9403f7e6092699f3f92bb1e26ff55165528e7c F test/misc2.test 9d9403f7e6092699f3f92bb1e26ff55165528e7c
F test/misc3.test 928a2f1e1189924ed14e1ae074e34f40688bdf94 F test/misc3.test 928a2f1e1189924ed14e1ae074e34f40688bdf94
F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622 F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622
F test/misuse.test fcd9e7cec6ecccc34822584aec6b4e31f13629e1 F test/misuse.test 2d7c46160f7c214f761fc5d030684a37ae8832a6
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b
F test/pager.test 394455707a079804e8a4e431d12edce831a065f0 F test/pager.test 394455707a079804e8a4e431d12edce831a065f0
F test/pager2.test c7e731ac56a2984a605b032ffd19b9deee820377 F test/pager2.test c7e731ac56a2984a605b032ffd19b9deee820377
F test/pager3.test 647f696a9cf7409df00a1e0047c2eb55585a1b85 F test/pager3.test 647f696a9cf7409df00a1e0047c2eb55585a1b85
F test/pagesize.test 6f94b70ed9645dbe6314b627ae765c5dec8036d9 F test/pagesize.test 6f94b70ed9645dbe6314b627ae765c5dec8036d9
F test/pragma.test d14ed14407a00c10562ca35128120dc09019ed34 F test/pragma.test ab309fb98bf4fe49481b9661354376cc56067f7e
F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57 F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57
F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x
F test/quick.test 91e5b8ae6663dc9e3e754b271f0384f0cae706e6 F test/quick.test 91e5b8ae6663dc9e3e754b271f0384f0cae706e6
@@ -191,7 +191,7 @@ F test/trigger2.test cbf5da84a2413380644bde3fef94943ee103ea4e
F test/trigger3.test f1c0cc1365f00b21a8cd41c189edca139c2d6cc6 F test/trigger3.test f1c0cc1365f00b21a8cd41c189edca139c2d6cc6
F test/trigger4.test ce5c97aba6a8a11be5820e694659438c3e982ada F test/trigger4.test ce5c97aba6a8a11be5820e694659438c3e982ada
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83 F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
F test/types.test 9fa078d90ade052344a02e03a41b5df23bd429f1 F test/types.test f0a98d10c5ecc9865d19dc94486f9873afc6bb6b
F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7 F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217 F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
@@ -258,7 +258,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
P dcbc0c22cf269e2f67002aa3f1bc0c66aaeff5f1 P 59a0a8b7cebc011731654bd0545cf8d19612ca8e
R b20243043da42c552406a47e684bc877 R 0f932cfb065804fe829dcf5001ff03c1
U drh U drh
Z 6d564933ddae0997ba41ac32b88f3e8b Z 02b6691979f3c9a7b41515737ea686d0

View File

@@ -1 +1 @@
59a0a8b7cebc011731654bd0545cf8d19612ca8e 98c7a55478f7c465b219edc1a33eee222586fd65

View File

@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope. ** All other code has file scope.
** **
** $Id: date.c,v 1.41 2004/11/11 01:50:30 danielk1977 Exp $ ** $Id: date.c,v 1.42 2004/11/14 21:56:30 drh Exp $
** **
** NOTES: ** NOTES:
** **
@@ -938,15 +938,14 @@ static void currentTimeFunc(
char *zFormat = (char *)sqlite3_user_data(context); char *zFormat = (char *)sqlite3_user_data(context);
char zBuf[20]; char zBuf[20];
#ifdef SQLITE_TEST
/* This test variable is located in os_XXX.c */
extern int sqlite3_current_time;
#endif
time(&t); time(&t);
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
{
extern int sqlite3_current_time; /* See os_XXX.c */
if( sqlite3_current_time ){ if( sqlite3_current_time ){
t = sqlite3_current_time; t = sqlite3_current_time;
} }
}
#endif #endif
sqlite3OsEnterMutex(); sqlite3OsEnterMutex();
@@ -1001,4 +1000,3 @@ void sqlite3RegisterDateTimeFunctions(sqlite3 *db){
} }
#endif #endif
} }

View File

@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope. ** All other code has file scope.
** **
** $Id: func.c,v 1.86 2004/11/12 13:42:31 danielk1977 Exp $ ** $Id: func.c,v 1.87 2004/11/14 21:56:30 drh Exp $
*/ */
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
@@ -747,10 +747,12 @@ static void test_destructor(
memcpy(zVal, sqlite3ValueText(argv[0], db->enc), len); memcpy(zVal, sqlite3ValueText(argv[0], db->enc), len);
if( db->enc==SQLITE_UTF8 ){ if( db->enc==SQLITE_UTF8 ){
sqlite3_result_text(pCtx, zVal, -1, destructor); sqlite3_result_text(pCtx, zVal, -1, destructor);
#ifndef SQLITE_OMIT_UTF16
}else if( db->enc==SQLITE_UTF16LE ){ }else if( db->enc==SQLITE_UTF16LE ){
sqlite3_result_text16le(pCtx, zVal, -1, destructor); sqlite3_result_text16le(pCtx, zVal, -1, destructor);
}else{ }else{
sqlite3_result_text16be(pCtx, zVal, -1, destructor); sqlite3_result_text16be(pCtx, zVal, -1, destructor);
#endif /* SQLITE_OMIT_UTF16 */
} }
} }
static void test_destructor_count( static void test_destructor_count(
@@ -976,7 +978,9 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
{ "typeof", 1, 0, SQLITE_UTF8, 0, typeofFunc }, { "typeof", 1, 0, SQLITE_UTF8, 0, typeofFunc },
{ "length", 1, 0, SQLITE_UTF8, 0, lengthFunc }, { "length", 1, 0, SQLITE_UTF8, 0, lengthFunc },
{ "substr", 3, 0, SQLITE_UTF8, 0, substrFunc }, { "substr", 3, 0, SQLITE_UTF8, 0, substrFunc },
#ifndef SQLITE_OMIT_UTF16
{ "substr", 3, 0, SQLITE_UTF16LE, 0, sqlite3utf16Substr }, { "substr", 3, 0, SQLITE_UTF16LE, 0, sqlite3utf16Substr },
#endif
{ "abs", 1, 0, SQLITE_UTF8, 0, absFunc }, { "abs", 1, 0, SQLITE_UTF8, 0, absFunc },
{ "round", 1, 0, SQLITE_UTF8, 0, roundFunc }, { "round", 1, 0, SQLITE_UTF8, 0, roundFunc },
{ "round", 2, 0, SQLITE_UTF8, 0, roundFunc }, { "round", 2, 0, SQLITE_UTF8, 0, roundFunc },

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: main.c,v 1.264 2004/11/11 05:10:44 danielk1977 Exp $ ** $Id: main.c,v 1.265 2004/11/14 21:56:30 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -880,6 +880,7 @@ const char *sqlite3_errmsg(sqlite3 *db){
return z; return z;
} }
#ifndef SQLITE_OMIT_UTF16
/* /*
** Return UTF-16 encoded English language explanation of the most recent ** Return UTF-16 encoded English language explanation of the most recent
** error. ** error.
@@ -919,6 +920,7 @@ const void *sqlite3_errmsg16(sqlite3 *db){
} }
return z; return z;
} }
#endif /* SQLITE_OMIT_UTF16 */
/* /*
** Return the most recent error code generated by an SQLite routine. ** Return the most recent error code generated by an SQLite routine.
@@ -1033,6 +1035,7 @@ prepare_out:
return rc; return rc;
} }
#ifndef SQLITE_OMIT_UTF16
/* /*
** Compile the UTF-16 encoded SQL statement zSql into a statement handle. ** Compile the UTF-16 encoded SQL statement zSql into a statement handle.
*/ */
@@ -1076,6 +1079,7 @@ int sqlite3_prepare16(
return rc; return rc;
} }
#endif /* SQLITE_OMIT_UTF16 */
/* /*
** This routine does the work of opening a database on behalf of ** This routine does the work of opening a database on behalf of
@@ -1177,6 +1181,7 @@ int sqlite3_open(
return openDatabase(zFilename, ppDb); return openDatabase(zFilename, ppDb);
} }
#ifndef SQLITE_OMIT_UTF16
/* /*
** Open a new database handle. ** Open a new database handle.
*/ */
@@ -1205,6 +1210,7 @@ int sqlite3_open16(
return rc; return rc;
} }
#endif /* SQLITE_OMIT_UTF16 */
/* /*
** The following routine destroys a virtual machine that is created by ** The following routine destroys a virtual machine that is created by
@@ -1288,6 +1294,7 @@ int sqlite3_create_collation(
return rc; return rc;
} }
#ifndef SQLITE_OMIT_UTF16
/* /*
** Register a new collation sequence with the database handle db. ** Register a new collation sequence with the database handle db.
*/ */
@@ -1308,6 +1315,7 @@ int sqlite3_create_collation16(
zName8 = sqlite3ValueText(pTmp, SQLITE_UTF8); zName8 = sqlite3ValueText(pTmp, SQLITE_UTF8);
return sqlite3_create_collation(db, zName8, enc, pCtx, xCompare); return sqlite3_create_collation(db, zName8, enc, pCtx, xCompare);
} }
#endif /* SQLITE_OMIT_UTF16 */
/* /*
** Register a collation sequence factory callback with the database handle ** Register a collation sequence factory callback with the database handle
@@ -1327,6 +1335,7 @@ int sqlite3_collation_needed(
return SQLITE_OK; return SQLITE_OK;
} }
#ifndef SQLITE_OMIT_UTF16
/* /*
** Register a collation sequence factory callback with the database handle ** Register a collation sequence factory callback with the database handle
** db. Replace any previously installed collation sequence factory. ** db. Replace any previously installed collation sequence factory.
@@ -1344,3 +1353,4 @@ int sqlite3_collation_needed16(
db->pCollNeededArg = pCollNeededArg; db->pCollNeededArg = pCollNeededArg;
return SQLITE_OK; return SQLITE_OK;
} }
#endif /* SQLITE_OMIT_UTF16 */

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated ** is not included in the SQLite library. It is used for automated
** testing of the SQLite library. ** testing of the SQLite library.
** **
** $Id: test1.c,v 1.113 2004/11/14 04:04:17 drh Exp $ ** $Id: test1.c,v 1.114 2004/11/14 21:56:30 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@@ -2723,15 +2723,17 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_column_blob", test_column_blob ,0 }, { "sqlite3_column_blob", test_column_blob ,0 },
{ "sqlite3_column_double", test_column_double ,0 }, { "sqlite3_column_double", test_column_double ,0 },
{ "sqlite3_column_int64", test_column_int64 ,0 }, { "sqlite3_column_int64", test_column_int64 ,0 },
{ "sqlite3_column_int", test_stmt_int, sqlite3_column_int },
{ "sqlite3_column_bytes", test_stmt_int, sqlite3_column_bytes },
{ "sqlite3_column_bytes16", test_stmt_int, sqlite3_column_bytes16 },
{ "sqlite3_column_text", test_stmt_utf8, sqlite3_column_text }, { "sqlite3_column_text", test_stmt_utf8, sqlite3_column_text },
{ "sqlite3_column_decltype", test_stmt_utf8, sqlite3_column_decltype }, { "sqlite3_column_decltype", test_stmt_utf8, sqlite3_column_decltype },
{ "sqlite3_column_name", test_stmt_utf8, sqlite3_column_name }, { "sqlite3_column_name", test_stmt_utf8, sqlite3_column_name },
{ "sqlite3_column_int", test_stmt_int, sqlite3_column_int },
{ "sqlite3_column_bytes", test_stmt_int, sqlite3_column_bytes },
#ifndef SQLITE_OMIT_UTF16
{ "sqlite3_column_bytes16", test_stmt_int, sqlite3_column_bytes16 },
{ "sqlite3_column_text16", test_stmt_utf16, sqlite3_column_text16 }, { "sqlite3_column_text16", test_stmt_utf16, sqlite3_column_text16 },
{ "sqlite3_column_decltype16", test_stmt_utf16, sqlite3_column_decltype16}, { "sqlite3_column_decltype16", test_stmt_utf16, sqlite3_column_decltype16},
{ "sqlite3_column_name16", test_stmt_utf16, sqlite3_column_name16 }, { "sqlite3_column_name16", test_stmt_utf16, sqlite3_column_name16 },
#endif
/* Functions from os.h */ /* Functions from os.h */
{ "sqlite3OsOpenReadWrite",test_sqlite3OsOpenReadWrite, 0 }, { "sqlite3OsOpenReadWrite",test_sqlite3OsOpenReadWrite, 0 },

View File

@@ -15,7 +15,7 @@
** is used for testing the SQLite routines for converting between ** is used for testing the SQLite routines for converting between
** the various supported unicode encodings. ** the various supported unicode encodings.
** **
** $Id: test5.c,v 1.13 2004/06/25 02:38:55 danielk1977 Exp $ ** $Id: test5.c,v 1.14 2004/11/14 21:56:30 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "vdbeInt.h" #include "vdbeInt.h"
@@ -190,7 +190,9 @@ static int test_translate_selftest(
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
sqlite3utfSelfTest(); sqlite3utfSelfTest();
#endif
return SQLITE_OK; return SQLITE_OK;
} }
@@ -214,4 +216,3 @@ int Sqlitetest5_Init(Tcl_Interp *interp){
} }
return SQLITE_OK; return SQLITE_OK;
} }

View File

@@ -12,7 +12,7 @@
** This file contains routines used to translate between UTF-8, ** This file contains routines used to translate between UTF-8,
** UTF-16, UTF-16BE, and UTF-16LE. ** UTF-16, UTF-16BE, and UTF-16LE.
** **
** $Id: utf.c,v 1.29 2004/09/24 23:20:52 drh Exp $ ** $Id: utf.c,v 1.30 2004/11/14 21:56:30 drh Exp $
** **
** Notes on UTF-8: ** Notes on UTF-8:
** **
@@ -232,6 +232,7 @@ int sqlite3ReadUtf8(const unsigned char *z){
*/ */
/* #define TRANSLATE_TRACE 1 */ /* #define TRANSLATE_TRACE 1 */
#ifndef SQLITE_OMIT_UTF16
/* /*
** This routine transforms the internal text encoding used by pMem to ** This routine transforms the internal text encoding used by pMem to
** desiredEnc. It is an error if the string is already of the desired ** desiredEnc. It is an error if the string is already of the desired
@@ -423,6 +424,7 @@ int sqlite3VdbeMemHandleBom(Mem *pMem){
} }
return rc; return rc;
} }
#endif /* SQLITE_OMIT_UTF16 */
/* /*
** pZ is a UTF-8 encoded unicode string. If nByte is less than zero, ** pZ is a UTF-8 encoded unicode string. If nByte is less than zero,
@@ -447,6 +449,7 @@ int sqlite3utf8CharLen(const char *z, int nByte){
return r; return r;
} }
#ifndef SQLITE_OMIT_UTF16
/* /*
** pZ is a UTF-16 encoded unicode string. If nChar is less than zero, ** pZ is a UTF-16 encoded unicode string. If nChar is less than zero,
** return the number of bytes up to (but not including), the first pair ** return the number of bytes up to (but not including), the first pair
@@ -563,4 +566,5 @@ void sqlite3utfSelfTest(){
assert( (z-zBuf)==n ); assert( (z-zBuf)==n );
} }
} }
#endif #endif /* SQLITE_TEST */
#endif /* SQLITE_OMIT_UTF16 */

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.427 2004/11/13 03:48:07 drh Exp $ ** $Id: vdbe.c,v 1.428 2004/11/14 21:56:30 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -710,11 +710,16 @@ case OP_String: {
if( pOp->p3 ){ if( pOp->p3 ){
pTos->flags = MEM_Str|MEM_Static|MEM_Term; pTos->flags = MEM_Str|MEM_Static|MEM_Term;
pTos->z = pOp->p3; pTos->z = pOp->p3;
#ifndef SQLITE_OMIT_UTF16
if( db->enc==SQLITE_UTF8 ){ if( db->enc==SQLITE_UTF8 ){
pTos->n = strlen(pTos->z); pTos->n = strlen(pTos->z);
}else{ }else{
pTos->n = sqlite3utf16ByteLen(pTos->z, -1); pTos->n = sqlite3utf16ByteLen(pTos->z, -1);
} }
#else
assert( db->enc==SQLITE_UTF8 );
pTos->n = strlen(pTos->z);
#endif
pTos->enc = db->enc; pTos->enc = db->enc;
}else{ }else{
pTos->flags = MEM_Null; pTos->flags = MEM_Null;

View File

@@ -46,6 +46,7 @@ sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
const unsigned char *sqlite3_value_text(sqlite3_value *pVal){ const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
return (const char *)sqlite3ValueText(pVal, SQLITE_UTF8); return (const char *)sqlite3ValueText(pVal, SQLITE_UTF8);
} }
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_value_text16(sqlite3_value* pVal){ const void *sqlite3_value_text16(sqlite3_value* pVal){
return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE); return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
} }
@@ -55,6 +56,7 @@ const void *sqlite3_value_text16be(sqlite3_value *pVal){
const void *sqlite3_value_text16le(sqlite3_value *pVal){ const void *sqlite3_value_text16le(sqlite3_value *pVal){
return sqlite3ValueText(pVal, SQLITE_UTF16LE); return sqlite3ValueText(pVal, SQLITE_UTF16LE);
} }
#endif /* SQLITE_OMIT_UTF16 */
int sqlite3_value_type(sqlite3_value* pVal){ int sqlite3_value_type(sqlite3_value* pVal){
return pVal->type; return pVal->type;
} }
@@ -100,6 +102,7 @@ void sqlite3_result_text(
){ ){
sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, xDel); sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, xDel);
} }
#ifndef SQLITE_OMIT_UTF16
void sqlite3_result_text16( void sqlite3_result_text16(
sqlite3_context *pCtx, sqlite3_context *pCtx,
const void *z, const void *z,
@@ -124,6 +127,7 @@ void sqlite3_result_text16le(
){ ){
sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16LE, xDel); sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16LE, xDel);
} }
#endif /* SQLITE_OMIT_UTF16 */
void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){ void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
sqlite3VdbeMemCopy(&pCtx->s, pValue); sqlite3VdbeMemCopy(&pCtx->s, pValue);
} }
@@ -346,9 +350,11 @@ sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){ const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){
return sqlite3_value_text( columnMem(pStmt,i) ); return sqlite3_value_text( columnMem(pStmt,i) );
} }
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){ const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){
return sqlite3_value_text16( columnMem(pStmt,i) ); return sqlite3_value_text16( columnMem(pStmt,i) );
} }
#endif /* SQLITE_OMIT_UTF16 */
int sqlite3_column_type(sqlite3_stmt *pStmt, int i){ int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
return sqlite3_value_type( columnMem(pStmt,i) ); return sqlite3_value_type( columnMem(pStmt,i) );
} }
@@ -386,6 +392,15 @@ const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 0); return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 0);
} }
/*
** Return the column declaration type (if applicable) of the 'i'th column
** of the result set of SQL statement pStmt, encoded as UTF-8.
*/
const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 1);
}
#ifndef SQLITE_OMIT_UTF16
/* /*
** Return the name of the 'i'th column of the result set of SQL statement ** Return the name of the 'i'th column of the result set of SQL statement
** pStmt, encoded as UTF-16. ** pStmt, encoded as UTF-16.
@@ -394,14 +409,6 @@ const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 0); return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 0);
} }
/*
** Return the column declaration type (if applicable) of the 'i'th column
** of the result set of SQL statement pStmt, encoded as UTF-8.
*/
const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 1);
}
/* /*
** Return the column declaration type (if applicable) of the 'i'th column ** Return the column declaration type (if applicable) of the 'i'th column
** of the result set of SQL statement pStmt, encoded as UTF-16. ** of the result set of SQL statement pStmt, encoded as UTF-16.
@@ -409,6 +416,7 @@ const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){ const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 1); return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 1);
} }
#endif /* SQLITE_OMIT_UTF16 */
/******************************* sqlite3_bind_ *************************** /******************************* sqlite3_bind_ ***************************
** **
@@ -516,6 +524,7 @@ int sqlite3_bind_text(
){ ){
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8); return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
} }
#ifndef SQLITE_OMIT_UTF16
int sqlite3_bind_text16( int sqlite3_bind_text16(
sqlite3_stmt *pStmt, sqlite3_stmt *pStmt,
int i, int i,
@@ -525,6 +534,7 @@ int sqlite3_bind_text16(
){ ){
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE); return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
} }
#endif /* SQLITE_OMIT_UTF16 */
/* /*
** Return the number of wildcards that can be potentially bound to. ** Return the number of wildcards that can be potentially bound to.

View File

@@ -37,7 +37,11 @@ int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){ if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
return SQLITE_OK; return SQLITE_OK;
} }
#ifdef SQLITE_OMIT_UTF16
return SQLITE_ERROR;
#else
return sqlite3VdbeMemTranslate(pMem, desiredEnc); return sqlite3VdbeMemTranslate(pMem, desiredEnc);
#endif
} }
/* /*
@@ -403,6 +407,7 @@ int sqlite3VdbeMemSetStr(
} }
break; break;
#ifndef SQLITE_OMIT_UTF16
case SQLITE_UTF16LE: case SQLITE_UTF16LE:
case SQLITE_UTF16BE: case SQLITE_UTF16BE:
pMem->flags |= MEM_Str; pMem->flags |= MEM_Str;
@@ -414,6 +419,7 @@ int sqlite3VdbeMemSetStr(
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
break; break;
#endif /* SQLITE_OMIT_UTF16 */
default: default:
assert(0); assert(0);

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this script testing the sqlite_bind API. # focus of this script testing the sqlite_bind API.
# #
# $Id: bind.test,v 1.21 2004/11/03 16:27:02 drh Exp $ # $Id: bind.test,v 1.22 2004/11/14 21:56:31 drh Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@@ -247,17 +247,19 @@ do_test bind-6.3 {
} {} } {}
# UTF-16 text # UTF-16 text
do_test bind-7.1 { ifcapable {utf16} {
do_test bind-7.1 {
sqlite3_bind_text16 $VM 1 [encoding convertto unicode hellothere] 10 sqlite3_bind_text16 $VM 1 [encoding convertto unicode hellothere] 10
sqlite3_bind_text16 $VM 2 [encoding convertto unicode ""] 0 sqlite3_bind_text16 $VM 2 [encoding convertto unicode ""] 0
sqlite3_bind_text16 $VM 3 [encoding convertto unicode world] 10 sqlite3_bind_text16 $VM 3 [encoding convertto unicode world] 10
sqlite_step $VM N VALUES COLNAMES sqlite_step $VM N VALUES COLNAMES
sqlite3_reset $VM sqlite3_reset $VM
execsql {SELECT rowid, * FROM t1} execsql {SELECT rowid, * FROM t1}
} {1 hello {} world} } {1 hello {} world}
do_test bind-7.2 { do_test bind-7.2 {
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1} execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
} {text text text} } {text text text}
}
do_test bind-7.3 { do_test bind-7.3 {
execsql { execsql {
DELETE FROM t1; DELETE FROM t1;
@@ -271,9 +273,11 @@ do_test bind-8.1 {
do_test bind-8.2 { do_test bind-8.2 {
sqlite3_errmsg $DB sqlite3_errmsg $DB
} {bind index out of range} } {bind index out of range}
do_test bind-8.3 { ifcapable {utf16} {
do_test bind-8.3 {
encoding convertfrom unicode [sqlite3_errmsg16 $DB] encoding convertfrom unicode [sqlite3_errmsg16 $DB]
} {bind index out of range} } {bind index out of range}
}
do_test bind-8.4 { do_test bind-8.4 {
sqlite3_bind_null $VM 1 sqlite3_bind_null $VM 1
sqlite3_errmsg $DB sqlite3_errmsg $DB
@@ -284,9 +288,11 @@ do_test bind-8.5 {
do_test bind-8.6 { do_test bind-8.6 {
sqlite3_errmsg $DB sqlite3_errmsg $DB
} {bind index out of range} } {bind index out of range}
do_test bind-8.7 { ifcapable {utf16} {
do_test bind-8.7 {
encoding convertfrom unicode [sqlite3_errmsg16 $DB] encoding convertfrom unicode [sqlite3_errmsg16 $DB]
} {bind index out of range} } {bind index out of range}
}
do_test bind-8.8 { do_test bind-8.8 {
catch { sqlite3_bind_blob $VM 0 "abc" 3 } catch { sqlite3_bind_blob $VM 0 "abc" 3 }
@@ -297,9 +303,11 @@ do_test bind-8.9 {
do_test bind-8.10 { do_test bind-8.10 {
catch { sqlite3_bind_text $VM 0 "abc" 3 } catch { sqlite3_bind_text $VM 0 "abc" 3 }
} {1} } {1}
do_test bind-8.11 { ifcapable {utf16} {
do_test bind-8.11 {
catch { sqlite3_bind_text16 $VM 4 "abc" 2 } catch { sqlite3_bind_text16 $VM 4 "abc" 2 }
} {1} } {1}
}
do_test bind-8.12 { do_test bind-8.12 {
catch { sqlite3_bind_int $VM 0 5 } catch { sqlite3_bind_int $VM 0 5 }
} {1} } {1}

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API. # focus of this script testing the callback-free C/C++ API.
# #
# $Id: capi3.test,v 1.22 2004/11/14 04:04:18 drh Exp $ # $Id: capi3.test,v 1.23 2004/11/14 21:56:31 drh Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@@ -331,18 +331,20 @@ do_test $test.3 {
} $lens } $lens
# bytes16 # bytes16
set lens [list] ifcapable {utf16} {
foreach i $::idxlist { set lens [list]
foreach i $::idxlist {
lappend lens [expr 2 * [string length [lindex $strings $i]]] lappend lens [expr 2 * [string length [lindex $strings $i]]]
} }
do_test $test.4 { do_test $test.4 {
set bytes [list] set bytes [list]
set lens [list] set lens [list]
foreach i $idxlist { foreach i $idxlist {
lappend bytes [sqlite3_column_bytes16 $STMT $i] lappend bytes [sqlite3_column_bytes16 $STMT $i]
} }
set bytes set bytes
} $lens } $lens
}
# Blob # Blob
do_test $test.5 { do_test $test.5 {

View File

@@ -13,11 +13,18 @@
# various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
# UTF-16be). # UTF-16be).
# #
# $Id: enc.test,v 1.4 2004/06/23 13:46:33 danielk1977 Exp $ # $Id: enc.test,v 1.5 2004/11/14 21:56:31 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# Skip this test if the build does not support multiple encodings.
#
ifcapable {!utf16} {
finish_test
return
}
proc do_bincmp_test {testname got expect} { proc do_bincmp_test {testname got expect} {
binary scan $expect \c* expectvals binary scan $expect \c* expectvals
binary scan $got \c* gotvals binary scan $got \c* gotvals
@@ -143,6 +150,3 @@ test_conversion enc-8 [string repeat "\u007E\u007F\u0080\u0081" 100]
test_conversion enc-9 [string repeat "\u07FE\u07FF\u0800\u0801\uFFF0" 100] test_conversion enc-9 [string repeat "\u07FE\u07FF\u0800\u0801\uFFF0" 100]
finish_test finish_test

View File

@@ -13,17 +13,19 @@
# The focus of this file is testing of the proper handling of conversions # The focus of this file is testing of the proper handling of conversions
# to the native text representation. # to the native text representation.
# #
# $Id: enc3.test,v 1.3 2004/11/03 13:59:06 drh Exp $ # $Id: enc3.test,v 1.4 2004/11/14 21:56:31 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
do_test enc3-1.1 { ifcapable {utf16} {
do_test enc3-1.1 {
execsql { execsql {
PRAGMA encoding=utf16le; PRAGMA encoding=utf16le;
PRAGMA encoding; PRAGMA encoding;
} }
} {UTF-16le} } {UTF-16le}
}
do_test enc3-1.2 { do_test enc3-1.2 {
execsql { execsql {
CREATE TABLE t1(x,y); CREATE TABLE t1(x,y);

View File

@@ -13,7 +13,7 @@
# This file implements tests for the SQLITE_MISUSE detection logic. # This file implements tests for the SQLITE_MISUSE detection logic.
# This test file leaks memory and file descriptors. # This test file leaks memory and file descriptors.
# #
# $Id: misuse.test,v 1.7 2004/09/30 13:43:14 drh Exp $ # $Id: misuse.test,v 1.8 2004/11/14 21:56:31 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -68,11 +68,13 @@ do_test misuse-1.3 {
# but that has changed. The following tests used to cause errors but now # but that has changed. The following tests used to cause errors but now
# they do not. # they do not.
# #
do_test misuse-1.4 { ifcapable {utf16} {
do_test misuse-1.4 {
catchsql2 { catchsql2 {
SELECT x_sqlite_exec('SELECT * FROM t1') AS xyz; SELECT x_sqlite_exec('SELECT * FROM t1') AS xyz;
} }
} {0 {xyz {1 2}}} } {0 {xyz {1 2}}}
}
do_test misuse-1.5 { do_test misuse-1.5 {
catchsql2 {SELECT * FROM t1} catchsql2 {SELECT * FROM t1}
} {0 {a b 1 2}} } {0 {a b 1 2}}

View File

@@ -12,7 +12,7 @@
# #
# This file implements tests for the PRAGMA command. # This file implements tests for the PRAGMA command.
# #
# $Id: pragma.test,v 1.23 2004/11/12 16:12:00 danielk1977 Exp $ # $Id: pragma.test,v 1.24 2004/11/14 21:56:31 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -351,13 +351,15 @@ do_test pragma-7.1 {
pragma index_list(t3); pragma index_list(t3);
} }
} {0 t3i1 0 1 sqlite_autoindex_t3_1 1} } {0 t3i1 0 1 sqlite_autoindex_t3_1 1}
do_test pragma-7.2 { ifcapable {utf16} {
do_test pragma-7.2 {
db close db close
sqlite3 db test.db sqlite3 db test.db
catchsql { catchsql {
pragma encoding=bogus; pragma encoding=bogus;
} }
} {1 {unsupported encoding: bogus}} } {1 {unsupported encoding: bogus}}
}
do_test pragma-7.3 { do_test pragma-7.3 {
db close db close
sqlite3 db test.db sqlite3 db test.db
@@ -572,5 +574,3 @@ do_test pragma-8.2.15 {
} {-450} } {-450}
finish_test finish_test

View File

@@ -12,7 +12,7 @@
# it tests that the different storage classes (integer, real, text etc.) # it tests that the different storage classes (integer, real, text etc.)
# all work correctly. # all work correctly.
# #
# $Id: types.test,v 1.13 2004/11/03 16:27:02 drh Exp $ # $Id: types.test,v 1.14 2004/11/14 21:56:31 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -269,7 +269,7 @@ do_test types-2.4.2 {
# Check that all the record sizes are as we expected. This is dependant on # Check that all the record sizes are as we expected. This is dependant on
# the database encoding. # the database encoding.
if { [execsql {pragma encoding}] == "UTF-8" } { if { $sqlite_options(utf16)==0 || [execsql {pragma encoding}] == "UTF-8" } {
do_test types-2.4.3 { do_test types-2.4.3 {
set root [db eval {select rootpage from sqlite_master where name = 't4'}] set root [db eval {select rootpage from sqlite_master where name = 't4'}]
record_sizes $root record_sizes $root