Changes toward reducing code size when SQLITE_OMIT_UTF16 is enabled. (CVS 2099)

FossilOrigin-Name: 59a0a8b7cebc011731654bd0545cf8d19612ca8e
This commit is contained in:
drh 2004-11-14 04:04:17 +00:00
parent 13d7042a73
commit 5436dc2d97
8 changed files with 127 additions and 79 deletions

View File

@ -1,5 +1,5 @@
C More\scompile-time\soptions\sfor\sremoving\scomponents.\s(CVS\s2098) C Changes\stoward\sreducing\scode\ssize\swhen\sSQLITE_OMIT_UTF16\sis\senabled.\s(CVS\s2099)
D 2004-11-13T15:59:15 D 2004-11-14T04:04:17
F Makefile.in c4d2416860f472a1e3393714d0372074197565df F Makefile.in c4d2416860f472a1e3393714d0372074197565df
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@ -64,7 +64,7 @@ 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 4d671e27cc8f27869786110824d23408622b2aa9 F src/test1.c af2cc6864464b18675c9bdbb02142d765f2f0c6d
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
@ -89,7 +89,7 @@ F test/attach2.test 399128a7b3b209a339a8dbf53ca2ed42eb982d1a
F test/attach3.test 8a0309e284cf9aa1d7d6cc444989031881f7a21c F test/attach3.test 8a0309e284cf9aa1d7d6cc444989031881f7a21c
F test/auth.test cf13e449cb253f75d6584b376202c94bbdd53ec9 F test/auth.test cf13e449cb253f75d6584b376202c94bbdd53ec9
F test/autoinc.test 11330758197e0301d3600a071230d45b2f6a65b7 F test/autoinc.test 11330758197e0301d3600a071230d45b2f6a65b7
F test/autovacuum.test e52b8fab3b82f6b51b7fde5b7140827ce8e86b1c 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
@ -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 9258ca75fc98d89477015dcd70aa3d2757b142b8 F test/capi3.test 1e15509a61fa93ef637ec9c2a3fc93bc1d971a3b
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
@ -120,7 +120,7 @@ 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 2f5463af488d50aef60c6110bec6b21b5efba961
F test/enc2.test ca80d1f07484d66b5e407eb833da1e7fb74e2e8d F test/enc2.test 6d1a2650e9da43eab499d18ca694a0cb6ec69dee
F test/enc3.test a96f4a7c44bac4d63bdc4ff422b8049912083998 F test/enc3.test a96f4a7c44bac4d63bdc4ff422b8049912083998
F test/expr.test 20ddaf66c7ab673c1d0c953889e3466139256f9a F test/expr.test 20ddaf66c7ab673c1d0c953889e3466139256f9a
F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
@ -130,7 +130,7 @@ F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
F test/index.test 5776a3ebcbe0bdc69e7eeaeb5e95dfba6b17389e F test/index.test 5776a3ebcbe0bdc69e7eeaeb5e95dfba6b17389e
F test/insert.test 56f9c20c9adc8d707490c4ffa5d4daa94826ea03 F test/insert.test 56f9c20c9adc8d707490c4ffa5d4daa94826ea03
F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
F test/interrupt.test 3b78c7c1a466fc3989eb376d5ea56099810a835d F test/interrupt.test 0aa230f8aedec0ad7caaf5edaced337e4cfb3820
F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194 F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c
F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd
@ -180,7 +180,7 @@ F test/table.test 87a6219c784722249a2f604b6495ce171ca2588a
F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede
F test/tclsqlite.test 5e262df81a638a058536fb6d6666f316843ac7b2 F test/tclsqlite.test 5e262df81a638a058536fb6d6666f316843ac7b2
F test/temptable.test 63a16e3ad19adf073cfbcdf7624c92ac5236522c F test/temptable.test 63a16e3ad19adf073cfbcdf7624c92ac5236522c
F test/tester.tcl 9bd005b223871bceb4733d453f90df66ff39be5b F test/tester.tcl e7ebedf60c8ebbb0a9af4950981babfbb80cc9a7
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b
@ -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 5eaa18d43f2996a9d354bb4fb9c81e267e98be29 P dcbc0c22cf269e2f67002aa3f1bc0c66aaeff5f1
R 7bedbeea778ef4d3e2b1635c460d0010 R b20243043da42c552406a47e684bc877
U drh U drh
Z cd7be5fd7726d4f38a75365a78354a97 Z 6d564933ddae0997ba41ac32b88f3e8b

View File

@ -1 +1 @@
dcbc0c22cf269e2f67002aa3f1bc0c66aaeff5f1 59a0a8b7cebc011731654bd0545cf8d19612ca8e

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.112 2004/11/13 15:59:15 drh Exp $ ** $Id: test1.c,v 1.113 2004/11/14 04:04:17 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@ -490,6 +490,7 @@ static int test_create_function(
rc = sqlite3_create_function(db, "x_coalesce", -1, SQLITE_ANY, 0, rc = sqlite3_create_function(db, "x_coalesce", -1, SQLITE_ANY, 0,
ifnullFunc, 0, 0); ifnullFunc, 0, 0);
#ifndef SQLITE_OMIT_UTF16
/* Use the sqlite3_create_function16() API here. Mainly for fun, but also /* Use the sqlite3_create_function16() API here. Mainly for fun, but also
** because it is not tested anywhere else. */ ** because it is not tested anywhere else. */
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
@ -500,6 +501,8 @@ static int test_create_function(
1, SQLITE_UTF16, db, sqlite3ExecFunc, 0, 0); 1, SQLITE_UTF16, db, sqlite3ExecFunc, 0, 0);
sqlite3ValueFree(pVal); sqlite3ValueFree(pVal);
} }
#endif
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR; if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
return TCL_OK; return TCL_OK;
} }
@ -1005,7 +1008,7 @@ static int test_bind(
return TCL_OK; return TCL_OK;
} }
#ifndef SQLITE_OMIT_UTF16
/* /*
** Usage: add_test_collate <db ptr> <utf8> <utf16le> <utf16be> ** Usage: add_test_collate <db ptr> <utf8> <utf16le> <utf16be>
** **
@ -1148,6 +1151,7 @@ bad_args:
Tcl_WrongNumArgs(interp, 1, objv, "DB"); Tcl_WrongNumArgs(interp, 1, objv, "DB");
return TCL_ERROR; return TCL_ERROR;
} }
#endif /* SQLITE_OMIT_UTF16 */
/* /*
** Usage: add_test_function <db ptr> <utf8> <utf16le> <utf16be> ** Usage: add_test_function <db ptr> <utf8> <utf16le> <utf16be>
@ -1174,6 +1178,7 @@ bad_args:
** for a UTF-16LE test_function(), and UTF-16LE for an implementation that ** for a UTF-16LE test_function(), and UTF-16LE for an implementation that
** prefers UTF-16BE. ** prefers UTF-16BE.
*/ */
#ifndef SQLITE_OMIT_UTF16
static void test_function_utf8( static void test_function_utf8(
sqlite3_context *pCtx, sqlite3_context *pCtx,
int nArg, int nArg,
@ -1243,12 +1248,14 @@ static void test_function_utf16be(
-1, SQLITE_TRANSIENT); -1, SQLITE_TRANSIENT);
sqlite3ValueFree(pVal); sqlite3ValueFree(pVal);
} }
#endif /* SQLITE_OMIT_UTF16 */
static int test_function( static int test_function(
void * clientData, void * clientData,
Tcl_Interp *interp, Tcl_Interp *interp,
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
sqlite3 *db; sqlite3 *db;
int val; int val;
@ -1275,6 +1282,7 @@ static int test_function(
bad_args: bad_args:
Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <DB> <utf8> <utf16le> <utf16be>", 0); Tcl_GetStringFromObj(objv[0], 0), " <DB> <utf8> <utf16le> <utf16be>", 0);
#endif /* SQLITE_OMIT_UTF16 */
return TCL_ERROR; return TCL_ERROR;
} }
@ -1553,6 +1561,7 @@ static int test_bind_text16(
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
sqlite3_stmt *pStmt; sqlite3_stmt *pStmt;
int idx; int idx;
int bytes; int bytes;
@ -1576,6 +1585,7 @@ static int test_bind_text16(
return TCL_ERROR; return TCL_ERROR;
} }
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK; return TCL_OK;
} }
@ -1760,6 +1770,7 @@ static int test_errmsg16(
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
sqlite3 *db; sqlite3 *db;
const void *zErr; const void *zErr;
int bytes; int bytes;
@ -1774,6 +1785,7 @@ static int test_errmsg16(
zErr = sqlite3_errmsg16(db); zErr = sqlite3_errmsg16(db);
bytes = sqlite3utf16ByteLen(zErr, -1); bytes = sqlite3utf16ByteLen(zErr, -1);
Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(zErr, bytes)); Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(zErr, bytes));
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK; return TCL_OK;
} }
@ -1844,6 +1856,7 @@ static int test_prepare16(
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
sqlite3 *db; sqlite3 *db;
const void *zSql; const void *zSql;
const void *zTail = 0; const void *zTail = 0;
@ -1883,6 +1896,7 @@ static int test_prepare16(
if( makePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR; if( makePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
} }
Tcl_AppendResult(interp, zBuf, 0); Tcl_AppendResult(interp, zBuf, 0);
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK; return TCL_OK;
} }
@ -1923,6 +1937,7 @@ static int test_open16(
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
const void *zFilename; const void *zFilename;
sqlite3 *db; sqlite3 *db;
int rc; int rc;
@ -1939,6 +1954,7 @@ static int test_open16(
if( makePointerStr(interp, zBuf, db) ) return TCL_ERROR; if( makePointerStr(interp, zBuf, db) ) return TCL_ERROR;
Tcl_AppendResult(interp, zBuf, 0); Tcl_AppendResult(interp, zBuf, 0);
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK; return TCL_OK;
} }
@ -1954,6 +1970,7 @@ static int test_complete16(
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
char *zBuf; char *zBuf;
if( objc!=2 ){ if( objc!=2 ){
@ -1963,6 +1980,7 @@ static int test_complete16(
zBuf = Tcl_GetByteArrayFromObj(objv[1], 0); zBuf = Tcl_GetByteArrayFromObj(objv[1], 0);
Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_complete16(zBuf))); Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_complete16(zBuf)));
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK; return TCL_OK;
} }
@ -2227,6 +2245,7 @@ static int test_stmt_utf16(
int objc, int objc,
Tcl_Obj *CONST objv[] Tcl_Obj *CONST objv[]
){ ){
#ifndef SQLITE_OMIT_UTF16
sqlite3_stmt *pStmt; sqlite3_stmt *pStmt;
int col; int col;
Tcl_Obj *pRet; Tcl_Obj *pRet;
@ -2247,6 +2266,7 @@ static int test_stmt_utf16(
pRet = Tcl_NewByteArrayObj(zName16, sqlite3utf16ByteLen(zName16, -1)+2); pRet = Tcl_NewByteArrayObj(zName16, sqlite3utf16ByteLen(zName16, -1)+2);
Tcl_SetObjResult(interp, pRet); Tcl_SetObjResult(interp, pRet);
} }
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK; return TCL_OK;
} }
@ -2721,9 +2741,11 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
/* Custom test interfaces */ /* Custom test interfaces */
{ "sqlite3OsUnlock", test_sqlite3OsUnlock, 0 }, { "sqlite3OsUnlock", test_sqlite3OsUnlock, 0 },
#ifndef SQLITE_OMIT_UTF16
{ "add_test_collate", test_collate, 0 }, { "add_test_collate", test_collate, 0 },
{ "add_test_collate_needed", test_collate_needed, 0 }, { "add_test_collate_needed", test_collate_needed, 0 },
{ "add_test_function", test_function, 0 }, { "add_test_function", test_function, 0 },
#endif
{ "sqlite3_crashparams", sqlite3_crashparams, 0 }, { "sqlite3_crashparams", sqlite3_crashparams, 0 },
{ "sqlite3_test_errstr", test_errstr, 0 }, { "sqlite3_test_errstr", test_errstr, 0 },
{ "tcl_variable_type", tcl_variable_type, 0 }, { "tcl_variable_type", tcl_variable_type, 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 file is testing the SELECT statement. # focus of this file is testing the SELECT statement.
# #
# $Id: autovacuum.test,v 1.11 2004/11/10 15:27:38 danielk1977 Exp $ # $Id: autovacuum.test,v 1.12 2004/11/14 04:04:18 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -82,11 +82,13 @@ foreach delete_order $delete_orders {
} }
# Make sure the integrity check passes with the initial data. # Make sure the integrity check passes with the initial data.
do_test autovacuum-1.$tn.1 { ifcapable {integrityck} {
execsql { do_test autovacuum-1.$tn.1 {
pragma integrity_check execsql {
} pragma integrity_check
} {ok} }
} {ok}
}
# set btree_trace 1 # set btree_trace 1
foreach delete $delete_order { foreach delete $delete_order {
@ -98,12 +100,13 @@ foreach delete_order $delete_orders {
} {} } {}
# Do the integrity check. # Do the integrity check.
do_test autovacuum-1.$tn.($delete).2 { ifcapable {integrityck} {
execsql { do_test autovacuum-1.$tn.($delete).2 {
pragma integrity_check execsql {
} pragma integrity_check
} {ok} }
} {ok}
}
# Ensure the data remaining in the table is what was expected. # Ensure the data remaining in the table is what was expected.
foreach d $delete { foreach d $delete {
set idx [lsearch $::tbl_data [make_str $d $ENTRY_LEN]] set idx [lsearch $::tbl_data [make_str $d $ENTRY_LEN]]
@ -486,4 +489,3 @@ do_test autovacuum-3.7 {
} [expr $AUTOVACUUM?1:2] } [expr $AUTOVACUUM?1:2]
finish_test finish_test

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.21 2004/09/02 14:57:09 drh Exp $ # $Id: capi3.test,v 1.22 2004/11/14 04:04:18 drh Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -84,6 +84,7 @@ do_test capi3-1.7 {
sqlite3_errmsg $DB sqlite3_errmsg $DB
} {no such column: namex} } {no such column: namex}
ifcapable {utf16} {
do_test capi3-2.1 { do_test capi3-2.1 {
set sql16 [utf16 {SELECT name FROM sqlite_master}] set sql16 [utf16 {SELECT name FROM sqlite_master}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 ::TAIL] set STMT [sqlite3_prepare16 $DB $sql16 -1 ::TAIL]
@ -108,6 +109,7 @@ do_test capi3-2.4 {
do_test capi3-2.5 { do_test capi3-2.5 {
sqlite3_errmsg $DB sqlite3_errmsg $DB
} {no such column: namex} } {no such column: namex}
} ;# endif utf16
# rename sqlite3_open sqlite3_open_old # rename sqlite3_open sqlite3_open_old
# proc sqlite3_open {fname options} {sqlite3_open_new $fname $options} # proc sqlite3_open {fname options} {sqlite3_open_new $fname $options}
@ -132,19 +134,22 @@ do_test capi3-3.4 {
do_test capi3-3.5 { do_test capi3-3.5 {
sqlite3_close $db2 sqlite3_close $db2
} {SQLITE_OK} } {SQLITE_OK}
do_test capi3-3.6 { do_test capi3-3.6.1 {
sqlite3_close $db2 sqlite3_close $db2
} {SQLITE_MISUSE} } {SQLITE_MISUSE}
do_test capi3-3.6 { do_test capi3-3.6.2 {
sqlite3_errmsg $db2 sqlite3_errmsg $db2
} {library routine called out of sequence} } {library routine called out of sequence}
do_test capi3-3.6 { ifcapable {utf16} {
utf8 [sqlite3_errmsg16 $db2] do_test capi3-3.6.3 {
} {library routine called out of sequence} utf8 [sqlite3_errmsg16 $db2]
} {library routine called out of sequence}
}
# rename sqlite3_open "" # rename sqlite3_open ""
# rename sqlite3_open_old sqlite3_open # rename sqlite3_open_old sqlite3_open
ifcapable {utf16} {
do_test capi3-4.1 { do_test capi3-4.1 {
set db2 [sqlite3_open16 [utf16 test.db] {}] set db2 [sqlite3_open16 [utf16 test.db] {}]
sqlite3_errcode $db2 sqlite3_errcode $db2
@ -165,6 +170,7 @@ do_test capi3-4.4 {
do_test capi3-4.5 { do_test capi3-4.5 {
sqlite3_close $db2 sqlite3_close $db2
} {SQLITE_OK} } {SQLITE_OK}
} ;# utf16
# This proc is used to test the following API calls: # This proc is used to test the following API calls:
# #
@ -201,13 +207,15 @@ proc check_header {STMT test names decltypes} {
} $names } $names
# Column names in UTF-16 # Column names in UTF-16
do_test $test.2 { ifcapable {utf16} {
set cnamelist [list] do_test $test.2 {
foreach i $idxlist { set cnamelist [list]
lappend cnamelist [utf8 [sqlite3_column_name16 $STMT $i]] foreach i $idxlist {
} lappend cnamelist [utf8 [sqlite3_column_name16 $STMT $i]]
set cnamelist }
} $names set cnamelist
} $names
}
# Column names in UTF-8 # Column names in UTF-8
do_test $test.3 { do_test $test.3 {
@ -217,13 +225,15 @@ proc check_header {STMT test names decltypes} {
} $names } $names
# Column names in UTF-16 # Column names in UTF-16
do_test $test.4 { ifcapable {utf16} {
set cnamelist [list] do_test $test.4 {
foreach i $idxlist { set cnamelist [list]
lappend cnamelist [utf8 [sqlite3_column_name16 $STMT $i]] foreach i $idxlist {
} lappend cnamelist [utf8 [sqlite3_column_name16 $STMT $i]]
set cnamelist }
} $names set cnamelist
} $names
}
# Column names in UTF-8 # Column names in UTF-8
do_test $test.5 { do_test $test.5 {
@ -233,27 +243,31 @@ proc check_header {STMT test names decltypes} {
} $decltypes } $decltypes
# Column declaration types in UTF-16 # Column declaration types in UTF-16
do_test $test.6 { ifcapable {utf16} {
set cnamelist [list] do_test $test.6 {
foreach i $idxlist { set cnamelist [list]
lappend cnamelist [utf8 [sqlite3_column_decltype16 $STMT $i]] foreach i $idxlist {
} lappend cnamelist [utf8 [sqlite3_column_decltype16 $STMT $i]]
set cnamelist }
} $decltypes set cnamelist
} $decltypes
}
# Test some out of range conditions: # Test some out of range conditions:
do_test $test.7 { ifcapable {utf16} {
list \ do_test $test.7 {
[sqlite3_column_name $STMT -1] \ list \
[sqlite3_column_name16 $STMT -1] \ [sqlite3_column_name $STMT -1] \
[sqlite3_column_decltype $STMT -1] \ [sqlite3_column_name16 $STMT -1] \
[sqlite3_column_decltype16 $STMT -1] \ [sqlite3_column_decltype $STMT -1] \
[sqlite3_column_name $STMT $numcols] \ [sqlite3_column_decltype16 $STMT -1] \
[sqlite3_column_name16 $STMT $numcols] \ [sqlite3_column_name $STMT $numcols] \
[sqlite3_column_decltype $STMT $numcols] \ [sqlite3_column_name16 $STMT $numcols] \
[sqlite3_column_decltype16 $STMT $numcols] [sqlite3_column_decltype $STMT $numcols] \
} {{} {} {} {} {} {} {} {}} [sqlite3_column_decltype16 $STMT $numcols]
} {{} {} {} {} {} {} {} {}}
}
} }
@ -352,11 +366,13 @@ do_test $test.7 {
} $doubles } $doubles
# UTF-16 # UTF-16
do_test $test.8 { ifcapable {utf16} {
set utf8 [list] do_test $test.8 {
foreach i $idxlist {lappend utf8 [utf8 [sqlite3_column_text16 $STMT $i]]} set utf8 [list]
set utf8 foreach i $idxlist {lappend utf8 [utf8 [sqlite3_column_text16 $STMT $i]]}
} $strings set utf8
} $strings
}
# Integers # Integers
do_test $test.9 { do_test $test.9 {
@ -601,9 +617,11 @@ do_test capi3-10-1 {
do_test capi3-10-2 { do_test capi3-10-2 {
sqlite3_errmsg $::DB sqlite3_errmsg $::DB
} {out of memory} } {out of memory}
do_test capi3-10-3 { ifcapable {utf16} {
utf8 [sqlite3_errmsg16 $::DB] do_test capi3-10-3 {
} {out of memory} utf8 [sqlite3_errmsg16 $::DB]
} {out of memory}
}
db close db close
sqlite_malloc_fail 0 sqlite_malloc_fail 0
} }

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: enc2.test,v 1.18 2004/11/10 15:27:38 danielk1977 Exp $ # $Id: enc2.test,v 1.19 2004/11/14 04:04:18 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# If UTF16 support is disabled, ignore the tests in this file
#
ifcapable {!utf16} {
finish_test
return
}
# The rough organisation of tests in this file is: # The rough organisation of tests in this file is:
# #
# enc2.1.*: Simple tests with a UTF-8 db. # enc2.1.*: Simple tests with a UTF-8 db.

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 is the sqlite_interrupt() API. # focus of this script is the sqlite_interrupt() API.
# #
# $Id: interrupt.test,v 1.7 2004/11/10 15:27:38 danielk1977 Exp $ # $Id: interrupt.test,v 1.8 2004/11/14 04:04:18 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -102,7 +102,7 @@ do_test interrupt-2.3 {
SELECT md5sum(a || b) FROM t1; SELECT md5sum(a || b) FROM t1;
} }
} $cksum } $cksum
ifcapable vacuum&&!$AUTOVACUUM { ifcapable {vacuum && !default_autovacuum} {
do_test interrupt-2.4 { do_test interrupt-2.4 {
expr {$::origsize>[file size test.db]} expr {$::origsize>[file size test.db]}
} 1 } 1

View File

@ -11,7 +11,7 @@
# This file implements some common TCL routines used for regression # This file implements some common TCL routines used for regression
# testing the SQLite library # testing the SQLite library
# #
# $Id: tester.tcl,v 1.41 2004/11/10 15:27:38 danielk1977 Exp $ # $Id: tester.tcl,v 1.42 2004/11/14 04:04:18 drh Exp $
# Make sure tclsqlite3 was compiled correctly. Abort now with an # Make sure tclsqlite3 was compiled correctly. Abort now with an
# error message if not. # error message if not.
@ -241,7 +241,7 @@ proc integrity_check {name} {
# code. Omit the code if false. # code. Omit the code if false.
# #
proc ifcapable {expr code} { proc ifcapable {expr code} {
regsub -all {[a-z_]+} $expr {$::sqlite_options(&)} e2 regsub -all {[a-z_0-9]+} $expr {$::sqlite_options(&)} e2
if !($e2) return if !($e2) return
return -code [catch {uplevel 1 $code}] return -code [catch {uplevel 1 $code}]
} }
@ -249,4 +249,3 @@ proc ifcapable {expr code} {
# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set # If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1. # to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum) set AUTOVACUUM $sqlite_options(default_autovacuum)