Tcl interface transfers values directly between SQLite and Tcl_Objs, without
at translation to strings. (CVS 1898) FossilOrigin-Name: e97c331362545ce21117776c7b61d3488668f2bf
This commit is contained in:
parent
895d747226
commit
92febd92ad
64
manifest
64
manifest
@ -1,5 +1,5 @@
|
||||
C Add\ssupport\sfor\snamed\swildcards\sin\sSQL\sstatements.\s(CVS\s1897)
|
||||
D 2004-08-20T16:02:39
|
||||
C Tcl\sinterface\stransfers\svalues\sdirectly\sbetween\sSQLite\sand\sTcl_Objs,\swithout\nat\stranslation\sto\sstrings.\s(CVS\s1898)
|
||||
D 2004-08-20T18:34:20
|
||||
F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -62,8 +62,8 @@ F src/shell.c 42f65424a948f197f389e13bc7aaa3cf24dafd0c
|
||||
F src/sqlite.h.in de2be4043f0bfa16958d33392a3e7a5e7d4bd50b
|
||||
F src/sqliteInt.h 251662c89dd35c4ed745681ff00758d19ffd0906
|
||||
F src/table.c 4521c278892f60e4d630788c0ea5cf4db1e75c49
|
||||
F src/tclsqlite.c d6cf0db0a491c93c1971cf7ea70cbb0656ad8ce3
|
||||
F src/test1.c 896580d200136ed369154dbf52ee76d1ebfc4b2e
|
||||
F src/tclsqlite.c 2e044cb0638c03fa38575fe607bdd4ee4885e1f4
|
||||
F src/test1.c b87fae63b2994c150a579c4101f302be48ad77bc
|
||||
F src/test2.c f4c2f3928f1998fd8cb75a81e33a60e025ea85d4
|
||||
F src/test3.c 94d0a2a90bccd85802488cb42c69ec8afd2e4646
|
||||
F src/test4.c c38766914e924091516030b6a8b677d849c08bf0
|
||||
@ -77,7 +77,7 @@ F src/vacuum.c 9978a5760c2c430bc5b5e66505a02dad76f25813
|
||||
F src/vdbe.c 281af7f601a3220e86be2152eeb2ec6d82a6f71a
|
||||
F src/vdbe.h 75b241c02431b9c0f16eaa9cdbb34146c6287f52
|
||||
F src/vdbeInt.h 5e57e36a03ebf09f2653caec0d9c18a904e0d060
|
||||
F src/vdbeapi.c cd8d153c77fd0c03ad746aef2fa4c61ef29955b8
|
||||
F src/vdbeapi.c 4f9b3072589dcad2fcd3abb3538e5e8f00d224a1
|
||||
F src/vdbeaux.c cc86e59cb56dad2f9335933f71268227f5f91bce
|
||||
F src/vdbemem.c 68fefaf83adb48fe44135da01502c9327f6172b0
|
||||
F src/where.c cf8a54641eea01f1af5d09529ad69166db92f658
|
||||
@ -88,7 +88,7 @@ F test/attach3.test 6d060986ff004ebb89e1876a331d96c6bb62269e
|
||||
F test/auth.test e74b015545f608c06d5b84d17acdf7146eb818af
|
||||
F test/bigfile.test 62722ac4b420dfbcdceb137b8634e2cf2865fe27
|
||||
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
|
||||
F test/bind.test e8132be4fa89726d4a793072cfa848ebacfc218b
|
||||
F test/bind.test 8fd93bd2c828decc8208b71b6fa6cf4d15636d9e
|
||||
F test/blob.test 8727a7b46b2073a369cfc9bcb6f54dd366b9d884
|
||||
F test/btree.test 97b563e1ab999bf8764b129e8c4b4be0a116a52a
|
||||
F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635
|
||||
@ -98,7 +98,7 @@ F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027
|
||||
F test/btree7.test 429b96cfef5b51a7d512cfb4b5b3e453384af293
|
||||
F test/capi2.test 78f2c486689fcc80394a24c2cc32725330ab6299
|
||||
F test/capi3.test e2d47b59c1ca5be2e5986fb77f716a7fdd228e25
|
||||
F test/collate1.test 2ee4fa3a47a652ccf56c5ddf65dcc44d9bad82ef
|
||||
F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03
|
||||
F test/collate2.test c1a3b41f761b28853c5696037f92de928f93233b
|
||||
F test/collate3.test e60b428e07ec945492ba90ff1c895902ee3a8a50
|
||||
F test/collate4.test 4a7902b7560686af11d6cace717d876c6937b7ef
|
||||
@ -107,18 +107,18 @@ F test/collate6.test 2a45768914f04c1447a69d1358bbede376552675
|
||||
F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87
|
||||
F test/crash.test 3ea432ce624369c04ba1a23a5288115e40f5daa2
|
||||
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
|
||||
F test/date.test a5cdaed88fe575f2d6f63ff605abb5abc1b7319c
|
||||
F test/date.test fd3db29bba089578b1b008e3511ea9e74840377a
|
||||
F test/delete.test ec0b455f2dcc0e189d96ee438438ba026c4e51d8
|
||||
F test/delete2.test 050a3a6e8ea0f83aed817d164b16af2a499fb452
|
||||
F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961
|
||||
F test/enc2.test 7a60971a62748be6b607b4b4380eb4c5e151a6ec
|
||||
F test/enc3.test 2ae80b11adf5b2c171d2e17214dabd356b9672c1
|
||||
F test/expr.test b4e945265c4c697bf5213b72558914ba10a989cc
|
||||
F test/expr.test 91358521f8ec41cd0fd1c5370c93104265f1fefc
|
||||
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
|
||||
F test/func.test d47ff9da6cdc2c7c5e56733678c17e98a4630ee3
|
||||
F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05
|
||||
F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
|
||||
F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
|
||||
F test/index.test 6db94446dab9cf66bbafb6d4de71ea22fe29e33d
|
||||
F test/index.test 31ed90af028d1ec9a3a8a4f0d7021717ba05dd16
|
||||
F test/insert.test ebbab63db4ad69395a058514bccb3cdb0a029d48
|
||||
F test/insert2.test ea5d4f8dcbc68d8ad85eaa5f03d9812757610f90
|
||||
F test/interrupt.test 9142ce4448605127640eda5e283952f75f67ed91
|
||||
@ -130,21 +130,21 @@ F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
|
||||
F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93
|
||||
F test/lastinsert.test 31382f88b9b0270333ac9e4a17f2c2f4732da718
|
||||
F test/laststmtchanges.test 417aa27eb2b5cdfafb46e390e2c9ddd0a20eba43
|
||||
F test/limit.test e4ee72ab4869992950f8cfce256e04a0a2a98b23
|
||||
F test/limit.test f7c06fccd76755e8d083b61c06bc31cf461b9c35
|
||||
F test/lock.test 7cb9395919a0986ee4dd08bd49d34df93c8fc4fe
|
||||
F test/lock2.test 2213590d442147d09fd2334c905a755586c1c398
|
||||
F test/main.test e8c4d9ca6d1e5f5e55e6550d31aec488883b2ed9
|
||||
F test/main.test 1430a4b5bd3a6d5e0294966b742d80a551f87211
|
||||
F test/malloc.test 769b240d89a7ef3320d88919fdb6765f9395a51f
|
||||
F test/memdb.test b8a13fa79f006bd087bbcf135ce8eb62056a6027
|
||||
F test/memleak.test a7efa33c7adc2762add028a4cc70a6bb04fe573e
|
||||
F test/minmax.test 6513f9a1bb85fd35ff72b34b7b6634fad6b1e69c
|
||||
F test/misc1.test 72768ec8cabc952a4cfcddca43d566f9e0bce899
|
||||
F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6
|
||||
F test/misc1.test 1a20ea722dff15155e93948dc4ac3e8d80fec386
|
||||
F test/misc2.test 703734f5817215ca54e364833b3bf5ff36fcc21e
|
||||
F test/misc3.test eb488314990bfc0959221a1acc465013238bf168
|
||||
F test/misc3.test 57c373aed45acdf45f8f78ea914ef8855841e6b7
|
||||
F test/misc4.test 9f8ab4896dd627f5f9ba893a7b57c9f0a95dfd64
|
||||
F test/misuse.test 2a64ce711419f2fd12806ed95af930fd4e7bb8f3
|
||||
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
|
||||
F test/null.test c14d0f4739f21e929b8115b72bf0c765b6bb1721
|
||||
F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b
|
||||
F test/pager.test 059cc5c58d3b5a851343dff8c56cf7286425d03a
|
||||
F test/pager2.test 55469c7c1c1a54d6b32d7b3cc99001e90101a1ce
|
||||
F test/pager3.test 16f546293bb751b8151dc17df613fca938bbec8b
|
||||
@ -152,33 +152,33 @@ F test/pragma.test 66a66b7f3b273b93325c9a5794acb418f52fdcbf
|
||||
F test/printf.test 5a30fb0d736148fca64cb1b7ed0390be7414e024
|
||||
F test/progress.test 76c722f090b1ccb575e7e4e203a71608c5763beb x
|
||||
F test/quick.test 5bb4afdb204c57329c86fa11f3f0a5296675fd7f
|
||||
F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d
|
||||
F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62
|
||||
F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c
|
||||
F test/rowid.test b3d059f5c8d8874fa1c31030e0636f67405d20ea
|
||||
F test/select1.test 3ada65f9909987d763537db47c7ba49615f37e9f
|
||||
F test/select1.test 0e459a8066259445d707cc4f64ea00459441e29f
|
||||
F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
|
||||
F test/select3.test ab2e583154ee230fa4b46b06512775a38cd9d8b0
|
||||
F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
|
||||
F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2
|
||||
F test/select5.test 3f3f0f31e674fa61f8a3bdb6af1517dfae674081
|
||||
F test/select6.test a9e31906e700e7c7592c4d0acfc022808f718baf
|
||||
F test/sort.test 30fb9ea782a78da849a562d53233ec62d421bf61
|
||||
F test/subselect.test 8e889521c4234d8ebbe3945d91b147ed051fb9da
|
||||
F test/select5.test 94db800bbeff2e426c0175e07f7a71d4617853b5
|
||||
F test/select6.test 7a4c572ada0c2f969cecacd76f1f5c1533a22bbb
|
||||
F test/sort.test 35e9d6bd6930969050606c8feb9c6745469720e3
|
||||
F test/subselect.test 50f98723f00e97b1839d36410ee63597ca82d775
|
||||
F test/table.test fd9a0f4992230e4ca89cd37ae3191a12750df1d0
|
||||
F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede
|
||||
F test/tclsqlite.test 7f2322f9ba620d0155ada2e247df75dff2d66f45
|
||||
F test/tclsqlite.test d84b91f5e8219bbaf7f960ce649806eb39cc703f
|
||||
F test/temptable.test 63a16e3ad19adf073cfbcdf7624c92ac5236522c
|
||||
F test/tester.tcl f36cc22d0532725073ca78272d7834d56dceb6d9
|
||||
F test/tester.tcl 1ff1170dd4203d87f572871080cdb64330dade99
|
||||
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
|
||||
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
|
||||
F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b
|
||||
F test/trace.test 0ed72787440d97c6de6b6ecb4c022e6f78d5d94a
|
||||
F test/trans.test 29645b344d2b9b6792793562b12340177ddd8f96
|
||||
F test/trigger1.test dc015c410161f1a6109fd52638dfac852e2a34de
|
||||
F test/trigger2.test 0767ab30cb5a2c8402c8524f3d566b410b6f5263
|
||||
F test/trigger2.test a5d06e6e8e1e773cfcb5aaa75ab381b2ff35de63
|
||||
F test/trigger3.test 70931be83fa3f563f7a5ca9e88b86f476af73948
|
||||
F test/trigger4.test 97c11d3cf43d752b172809bb82536372ee5e399c
|
||||
F test/trigger5.test 25ba4d352282cd05753496a50f0bd23162cc97b9
|
||||
F test/types.test db5483a8dc5c8fadc737c3ab36d9cbd96ba25e14
|
||||
F test/types.test 1f5f0670cf07e44c0a5b03a31e31ec5ed39a482e
|
||||
F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7
|
||||
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
|
||||
F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
|
||||
@ -186,7 +186,7 @@ F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558
|
||||
F test/vacuum.test 3aabfb73dcafffed01fefd0789f2fcc8540b9b52
|
||||
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
|
||||
F test/view.test ca5c296989d3045f121be9a67588ff88c64874a8
|
||||
F test/where.test 9c5752b807b78078fab8da6f52e689832579ca20
|
||||
F test/where.test 40dcffcb77ad0a00960cef2b5b1212c77fd02199
|
||||
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
|
||||
F tool/lemon.c 0bae9c6743cfe6597e8f35f50900949d6c0f056d
|
||||
F tool/lempar.c 0b5e7a58634e0d448929b8e85f7981c2aa708d57
|
||||
@ -243,7 +243,7 @@ F www/tclsqlite.tcl 06a86cba4d7fc88e2bcd633b57702d3d16abebb5
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P d5b0269e0dd7c310460a7ffc4120ed45db823ce9
|
||||
R 37b9443293b714f26179a23a9fff9794
|
||||
P d3be0b7c5a39c02b9b2d6d85f1595d591984a569
|
||||
R 1cbcdf6d3d0885857959264a9f52fa75
|
||||
U drh
|
||||
Z 5dc7be52ed3e3d2ef835f3803509271c
|
||||
Z e2be1e764ed7eb73ae85dcaeb658f10f
|
||||
|
@ -1 +1 @@
|
||||
d3be0b7c5a39c02b9b2d6d85f1595d591984a569
|
||||
e97c331362545ce21117776c7b61d3488668f2bf
|
183
src/tclsqlite.c
183
src/tclsqlite.c
@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** A TCL Interface to SQLite
|
||||
**
|
||||
** $Id: tclsqlite.c,v 1.99 2004/08/20 16:02:39 drh Exp $
|
||||
** $Id: tclsqlite.c,v 1.100 2004/08/20 18:34:20 drh Exp $
|
||||
*/
|
||||
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
|
||||
|
||||
@ -59,7 +59,6 @@ struct SqlCollate {
|
||||
** that has been opened by the SQLite TCL interface.
|
||||
*/
|
||||
typedef struct SqliteDb SqliteDb;
|
||||
typedef struct SqlStmt SqlStmt;
|
||||
struct SqliteDb {
|
||||
sqlite3 *db; /* The "real" database structure */
|
||||
Tcl_Interp *interp; /* The interpreter used for this database */
|
||||
@ -72,19 +71,6 @@ struct SqliteDb {
|
||||
SqlCollate *pCollate; /* List of SQL collation functions */
|
||||
int rc; /* Return code of most recent sqlite3_exec() */
|
||||
Tcl_Obj *pCollateNeeded; /* Collation needed script */
|
||||
SqlStmt *pStmtList; /* List of all prepared statements */
|
||||
};
|
||||
|
||||
/*
|
||||
** Each prepared statement is an instance of the following structure.
|
||||
*/
|
||||
struct SqlStmt {
|
||||
SqliteDb *pDb; /* The database that this statement is part of */
|
||||
SqlStmt *pAll; /* Next statement in list of all for pDb */
|
||||
SqlStmt **ppPrev; /* Previous pAll pointer */
|
||||
sqlite3_stmt *pVm; /* Compiled statement. */
|
||||
int nBind; /* Number of bindings in this statement */
|
||||
char *azBindVar[1]; /* Name of variables for each binding */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -122,12 +108,6 @@ static int DbEvalCallback3(
|
||||
*/
|
||||
static void DbDeleteCmd(void *db){
|
||||
SqliteDb *pDb = (SqliteDb*)db;
|
||||
SqlStmt *pStmt, *pNextStmt;
|
||||
for(pStmt=pDb->pStmtList; pStmt; pStmt=pNextStmt){
|
||||
pNextStmt = pStmt->pAll;
|
||||
sqlite3_finalize(pStmt->pVm);
|
||||
Tcl_Free(pStmt);
|
||||
}
|
||||
sqlite3_close(pDb->db);
|
||||
while( pDb->pFunc ){
|
||||
SqlFunc *pFunc = pDb->pFunc;
|
||||
@ -716,74 +696,171 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
||||
char const *zSql;
|
||||
char const *zLeft;
|
||||
sqlite3_stmt *pStmt;
|
||||
Tcl_Obj *pArray; /* Name of array into which results are written */
|
||||
Tcl_Obj *pScript; /* Script to run for each result set */
|
||||
|
||||
Tcl_Obj *pRet = Tcl_NewObj();
|
||||
Tcl_IncrRefCount(pRet);
|
||||
|
||||
if( objc<3 || objc>5 || objc==4 ){
|
||||
if( objc<3 || objc>5 ){
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "SQL ?ARRAY-NAME? ?SCRIPT?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( objc==3 ){
|
||||
pArray = pScript = 0;
|
||||
}else if( objc==4 ){
|
||||
pArray = 0;
|
||||
pScript = objv[3];
|
||||
}else{
|
||||
pArray = objv[3];
|
||||
if( Tcl_GetString(pArray)[0]==0 ) pArray = 0;
|
||||
pScript = objv[4];
|
||||
}
|
||||
|
||||
zSql = Tcl_GetStringFromObj(objv[2], 0);
|
||||
while( zSql[0] ){
|
||||
int i;
|
||||
int i; /* Loop counter */
|
||||
int nVar; /* Number of wildcards in the SQL */
|
||||
int nCol; /* Number of columns in the result set */
|
||||
Tcl_Obj **apColName = 0; /* Array of column names */
|
||||
|
||||
/* Compile a single SQL statement */
|
||||
if( SQLITE_OK!=sqlite3_prepare(pDb->db, zSql, -1, &pStmt, &zLeft) ){
|
||||
Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
|
||||
rc = TCL_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if( pStmt && objc==5 ){
|
||||
Tcl_Obj *pColList = Tcl_NewObj();
|
||||
Tcl_IncrRefCount(pColList);
|
||||
|
||||
for(i=0; i<sqlite3_column_count(pStmt); i++){
|
||||
Tcl_ListObjAppendElement(interp, pColList,
|
||||
dbTextToObj(sqlite3_column_name(pStmt, i))
|
||||
);
|
||||
if( pStmt==0 ){
|
||||
if( SQLITE_OK!=sqlite3_errcode(pDb->db) ){
|
||||
Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
|
||||
rc = TCL_ERROR;
|
||||
break;
|
||||
}else{
|
||||
zSql = zLeft;
|
||||
continue;
|
||||
}
|
||||
Tcl_ObjSetVar2(interp,objv[3],Tcl_NewStringObj("*",-1),pColList,0);
|
||||
}
|
||||
|
||||
/* Bind values to wildcards that begin with $ */
|
||||
nVar = sqlite3_bind_parameter_count(pStmt);
|
||||
for(i=1; i<=nVar; i++){
|
||||
const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
|
||||
if( zVar[0]=='$' ){
|
||||
Tcl_Obj *pVar = Tcl_GetVar2Ex(interp, &zVar[1], 0, 0);
|
||||
if( pVar ){
|
||||
int n;
|
||||
u8 *data;
|
||||
char *zType = pVar->typePtr ? pVar->typePtr->name : "";
|
||||
char c = zType[0];
|
||||
if( c=='b' && strcmp(zType,"bytearray")==0 ){
|
||||
data = Tcl_GetByteArrayFromObj(pVar, &n);
|
||||
sqlite3_bind_blob(pStmt, i, data, n, SQLITE_STATIC);
|
||||
}else if( (c=='b' && strcmp(zType,"boolean")==0) ||
|
||||
(c=='i' && strcmp(zType,"int")==0) ){
|
||||
Tcl_GetIntFromObj(interp, pVar, &n);
|
||||
sqlite3_bind_int(pStmt, i, n);
|
||||
}else if( c=='d' && strcmp(zType,"double")==0 ){
|
||||
double r;
|
||||
Tcl_GetDoubleFromObj(interp, pVar, &r);
|
||||
sqlite3_bind_double(pStmt, i, r);
|
||||
}else{
|
||||
data = Tcl_GetStringFromObj(pVar, &n);
|
||||
sqlite3_bind_text(pStmt, i, data, n, SQLITE_STATIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Compute column names */
|
||||
nCol = sqlite3_column_count(pStmt);
|
||||
if( pScript ){
|
||||
apColName = (Tcl_Obj**)Tcl_Alloc( sizeof(Tcl_Obj*)*nCol );
|
||||
if( apColName==0 ) break;
|
||||
for(i=0; i<nCol; i++){
|
||||
apColName[i] = dbTextToObj(sqlite3_column_name(pStmt,i));
|
||||
Tcl_IncrRefCount(apColName[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* If results are being stored in an array variable, then create
|
||||
** the array(*) entry for that array
|
||||
*/
|
||||
if( pArray ){
|
||||
Tcl_Obj *pColList = Tcl_NewObj();
|
||||
Tcl_IncrRefCount(pColList);
|
||||
for(i=0; i<nCol; i++){
|
||||
Tcl_ListObjAppendElement(interp, pColList, apColName[i]);
|
||||
}
|
||||
Tcl_ObjSetVar2(interp, pArray, Tcl_NewStringObj("*",-1), pColList,0);
|
||||
}
|
||||
|
||||
/* Execute the SQL
|
||||
*/
|
||||
while( pStmt && SQLITE_ROW==sqlite3_step(pStmt) ){
|
||||
for(i=0; i<sqlite3_column_count(pStmt); i++){
|
||||
for(i=0; i<nCol; i++){
|
||||
Tcl_Obj *pVal;
|
||||
|
||||
/* Set pVal to contain the i'th column of this row. */
|
||||
if( SQLITE_BLOB!=sqlite3_column_type(pStmt, i) ){
|
||||
pVal = dbTextToObj(sqlite3_column_text(pStmt, i));
|
||||
}else{
|
||||
int bytes = sqlite3_column_bytes(pStmt, i);
|
||||
pVal = Tcl_NewByteArrayObj(sqlite3_column_blob(pStmt, i), bytes);
|
||||
switch( sqlite3_column_type(pStmt, i) ){
|
||||
case SQLITE_BLOB: {
|
||||
int bytes = sqlite3_column_bytes(pStmt, i);
|
||||
pVal = Tcl_NewByteArrayObj(sqlite3_column_blob(pStmt, i), bytes);
|
||||
break;
|
||||
}
|
||||
case SQLITE_INTEGER: {
|
||||
sqlite_int64 v = sqlite3_column_int64(pStmt, i);
|
||||
if( v>=-2147483647 && v<=2147483647 ){
|
||||
pVal = Tcl_NewIntObj(v);
|
||||
}else{
|
||||
pVal = Tcl_NewWideIntObj(v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLITE_FLOAT: {
|
||||
double r = sqlite3_column_double(pStmt, i);
|
||||
pVal = Tcl_NewDoubleObj(r);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
pVal = dbTextToObj(sqlite3_column_text(pStmt, i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( objc==5 ){
|
||||
Tcl_Obj *pName = dbTextToObj(sqlite3_column_name(pStmt, i));
|
||||
Tcl_IncrRefCount(pName);
|
||||
if( !strcmp("", Tcl_GetString(objv[3])) ){
|
||||
Tcl_ObjSetVar2(interp, pName, 0, pVal, 0);
|
||||
if( pScript ){
|
||||
if( pArray==0 ){
|
||||
Tcl_ObjSetVar2(interp, apColName[i], 0, pVal, 0);
|
||||
}else{
|
||||
Tcl_ObjSetVar2(interp, objv[3], pName, pVal, 0);
|
||||
Tcl_ObjSetVar2(interp, pArray, apColName[i], pVal, 0);
|
||||
}
|
||||
Tcl_DecrRefCount(pName);
|
||||
}else{
|
||||
Tcl_ListObjAppendElement(interp, pRet, pVal);
|
||||
}
|
||||
}
|
||||
|
||||
if( objc==5 ){
|
||||
rc = Tcl_EvalObjEx(interp, objv[4], 0);
|
||||
if( pScript ){
|
||||
rc = Tcl_EvalObjEx(interp, pScript, 0);
|
||||
if( rc!=TCL_ERROR ) rc = TCL_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if( pStmt && SQLITE_SCHEMA==sqlite3_finalize(pStmt) ){
|
||||
|
||||
/* Free the column name objects */
|
||||
if( pScript ){
|
||||
for(i=0; i<nCol; i++){
|
||||
Tcl_DecrRefCount(apColName[i]);
|
||||
}
|
||||
Tcl_Free((char*)apColName);
|
||||
}
|
||||
|
||||
/* Finalize the statement. If the result code is SQLITE_SCHEMA, then
|
||||
** try again to execute the same statement
|
||||
*/
|
||||
if( SQLITE_SCHEMA==sqlite3_finalize(pStmt) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
if( pStmt && SQLITE_OK!=sqlite3_errcode(pDb->db) ){
|
||||
if( SQLITE_OK!=sqlite3_errcode(pDb->db) ){
|
||||
Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
|
||||
rc = TCL_ERROR;
|
||||
break;
|
||||
@ -1124,13 +1201,13 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
||||
** for additional information.
|
||||
*/
|
||||
int Sqlite3_Init(Tcl_Interp *interp){
|
||||
Tcl_InitStubs(interp, "8.0", 0);
|
||||
Tcl_InitStubs(interp, "8.4", 0);
|
||||
Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
|
||||
Tcl_PkgProvide(interp, "sqlite3", "3.0");
|
||||
return TCL_OK;
|
||||
}
|
||||
int Tclsqlite3_Init(Tcl_Interp *interp){
|
||||
Tcl_InitStubs(interp, "8.0", 0);
|
||||
Tcl_InitStubs(interp, "8.4", 0);
|
||||
Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
|
||||
Tcl_PkgProvide(interp, "sqlite3", "3.0");
|
||||
return TCL_OK;
|
||||
|
28
src/test1.c
28
src/test1.c
@ -13,7 +13,7 @@
|
||||
** is not included in the SQLite library. It is used for automated
|
||||
** testing of the SQLite library.
|
||||
**
|
||||
** $Id: test1.c,v 1.98 2004/08/20 16:02:39 drh Exp $
|
||||
** $Id: test1.c,v 1.99 2004/08/20 18:34:20 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "tcl.h"
|
||||
@ -2388,6 +2388,31 @@ static int test_sqlite3OsTempFileName(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Usage: tcl_variable_type VARIABLENAME
|
||||
**
|
||||
** Return the name of the internal representation for the
|
||||
** value of the given variable.
|
||||
*/
|
||||
static int tcl_variable_type(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
Tcl_Obj *pVar;
|
||||
if( objc!=2 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "VARIABLE");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
pVar = Tcl_GetVar2Ex(interp, Tcl_GetString(objv[1]), 0, TCL_LEAVE_ERR_MSG);
|
||||
if( pVar==0 ) return TCL_ERROR;
|
||||
if( pVar->typePtr ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(pVar->typePtr->name, -1));
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Register commands with the TCL interpreter.
|
||||
*/
|
||||
@ -2482,6 +2507,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
{ "add_test_function", test_function, 0 },
|
||||
{ "sqlite3_crashparams", sqlite3_crashparams, 0 },
|
||||
{ "sqlite3_test_errstr", test_errstr, 0 },
|
||||
{ "tcl_variable_type", tcl_variable_type, 0 },
|
||||
|
||||
};
|
||||
int i;
|
||||
|
@ -520,7 +520,8 @@ int sqlite3_bind_text16(
|
||||
** This routine is added to support DBD::SQLite.
|
||||
*/
|
||||
int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
|
||||
return ((Vdbe*)pStmt)->nVar;
|
||||
Vdbe *p = (Vdbe*)pStmt;
|
||||
return p ? p->nVar : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -531,7 +532,7 @@ int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
|
||||
*/
|
||||
const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
|
||||
Vdbe *p = (Vdbe*)pStmt;
|
||||
if( i<1 || i>p->nVar ){
|
||||
if( p==0 || i<1 || i>p->nVar ){
|
||||
return 0;
|
||||
}
|
||||
if( !p->okVar ){
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script testing the sqlite_bind API.
|
||||
#
|
||||
# $Id: bind.test,v 1.16 2004/08/20 16:02:39 drh Exp $
|
||||
# $Id: bind.test,v 1.17 2004/08/20 18:34:20 drh Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -167,7 +167,7 @@ do_test bind-4.1 {
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 1234.1234 1e-05 123456789}
|
||||
} {1 1234.1234 1e-05 123456789.0}
|
||||
do_test bind-4.2 {
|
||||
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
|
||||
} {real real real}
|
||||
|
@ -12,7 +12,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is page cache subsystem.
|
||||
#
|
||||
# $Id: collate1.test,v 1.2 2004/06/11 10:51:41 danielk1977 Exp $
|
||||
# $Id: collate1.test,v 1.3 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -214,7 +214,7 @@ do_test collate1-4.3 {
|
||||
execsql {
|
||||
SELECT c2+0 FROM collate1t1 ORDER BY 1;
|
||||
}
|
||||
} {{} 1 12 101}
|
||||
} {{} 1.0 12.0 101.0}
|
||||
do_test collate1-4.4 {
|
||||
execsql {
|
||||
SELECT c1||'' FROM collate1t1 ORDER BY 1;
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing date and time functions.
|
||||
#
|
||||
# $Id: date.test,v 1.8 2004/07/18 22:22:44 drh Exp $
|
||||
# $Id: date.test,v 1.9 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -21,14 +21,14 @@ proc datetest {tnum expr result} {
|
||||
execsql "SELECT coalesce($expr,'NULL')"
|
||||
}] [list $result]
|
||||
}
|
||||
|
||||
set tcl_precision 15
|
||||
datetest 1.1 julianday('2000-01-01') 2451544.5
|
||||
datetest 1.2 julianday('1970-01-01') 2440587.5
|
||||
datetest 1.3 julianday('1910-04-20') 2418781.5
|
||||
datetest 1.4 julianday('1986-02-09') 2446470.5
|
||||
datetest 1.5 julianday('12:00:00') 2451545
|
||||
datetest 1.6 {julianday('2000-01-01 12:00:00')} 2451545
|
||||
datetest 1.7 {julianday('2000-01-01 12:00')} 2451545
|
||||
datetest 1.5 julianday('12:00:00') 2451545.0
|
||||
datetest 1.6 {julianday('2000-01-01 12:00:00')} 2451545.0
|
||||
datetest 1.7 {julianday('2000-01-01 12:00')} 2451545.0
|
||||
datetest 1.8 julianday('bogus') NULL
|
||||
datetest 1.9 julianday('1999-12-31') 2451543.5
|
||||
datetest 1.10 julianday('1999-12-32') NULL
|
||||
@ -39,7 +39,7 @@ datetest 1.14 julianday('+2000-01-01') NULL
|
||||
datetest 1.15 julianday('200-01-01') NULL
|
||||
datetest 1.16 julianday('2000-1-01') NULL
|
||||
datetest 1.17 julianday('2000-01-1') NULL
|
||||
datetest 1.18 {julianday('2000-01-01 12:00:00')} 2451545
|
||||
datetest 1.18 {julianday('2000-01-01 12:00:00')} 2451545.0
|
||||
datetest 1.19 {julianday('2000-01-01 12:00:00.1')} 2451545.00000116
|
||||
datetest 1.20 {julianday('2000-01-01 12:00:00.01')} 2451545.00000012
|
||||
datetest 1.21 {julianday('2000-01-01 12:00:00.001')} 2451545.00000001
|
||||
@ -216,13 +216,13 @@ set sqlite_current_time 0
|
||||
|
||||
# Negative years work. Example: '-4713-11-26' is JD 1.5.
|
||||
#
|
||||
datetest 9.1 {julianday('-4713-11-24 12:00:00')} {0}
|
||||
datetest 9.2 {julianday(datetime(5))} {5}
|
||||
datetest 9.3 {julianday(datetime(10))} {10}
|
||||
datetest 9.4 {julianday(datetime(100))} {100}
|
||||
datetest 9.5 {julianday(datetime(1000))} {1000}
|
||||
datetest 9.6 {julianday(datetime(10000))} {10000}
|
||||
datetest 9.7 {julianday(datetime(100000))} {100000}
|
||||
datetest 9.1 {julianday('-4713-11-24 12:00:00')} {0.0}
|
||||
datetest 9.2 {julianday(datetime(5))} {5.0}
|
||||
datetest 9.3 {julianday(datetime(10))} {10.0}
|
||||
datetest 9.4 {julianday(datetime(100))} {100.0}
|
||||
datetest 9.5 {julianday(datetime(1000))} {1000.0}
|
||||
datetest 9.6 {julianday(datetime(10000))} {10000.0}
|
||||
datetest 9.7 {julianday(datetime(100000))} {100000.0}
|
||||
|
||||
# datetime() with just an HH:MM:SS correctly inserts the date 2000-01-01.
|
||||
#
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing expressions.
|
||||
#
|
||||
# $Id: expr.test,v 1.35 2004/06/19 00:16:31 drh Exp $
|
||||
# $Id: expr.test,v 1.36 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -48,8 +48,8 @@ test_expr expr-1.18 {i1=20, i2=20} {i2!=i1} 0
|
||||
test_expr expr-1.19 {i1=20, i2=20} {i2=i1} 1
|
||||
test_expr expr-1.20 {i1=20, i2=20} {i2<>i1} 0
|
||||
test_expr expr-1.21 {i1=20, i2=20} {i2==i1} 1
|
||||
test_expr expr-1.22 {i1=1, i2=2, r1=3.0} {i1+i2*r1} {7}
|
||||
test_expr expr-1.23 {i1=1, i2=2, r1=3.0} {(i1+i2)*r1} {9}
|
||||
test_expr expr-1.22 {i1=1, i2=2, r1=3.0} {i1+i2*r1} {7.0}
|
||||
test_expr expr-1.23 {i1=1, i2=2, r1=3.0} {(i1+i2)*r1} {9.0}
|
||||
test_expr expr-1.24 {i1=1, i2=2} {min(i1,i2,i1+i2,i1-i2)} {-1}
|
||||
test_expr expr-1.25 {i1=1, i2=2} {max(i1,i2,i1+i2,i1-i2)} {3}
|
||||
test_expr expr-1.26 {i1=1, i2=2} {max(i1,i2,i1+i2,i1-i2)} {3}
|
||||
@ -135,6 +135,7 @@ test_expr expr-1.101 {i1=0, i2=''} {i1=i2} 0
|
||||
test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57
|
||||
test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11
|
||||
test_expr expr-2.3 {r1=1.23, r2=2.34} {r1*r2} 2.8782
|
||||
set tcl_precision 15
|
||||
test_expr expr-2.4 {r1=1.23, r2=2.34} {r1/r2} 0.525641025641026
|
||||
test_expr expr-2.5 {r1=1.23, r2=2.34} {r2/r1} 1.90243902439024
|
||||
test_expr expr-2.6 {r1=1.23, r2=2.34} {r2<r1} 0
|
||||
@ -155,7 +156,7 @@ test_expr expr-2.20 {r1=2.34, r2=2.34} {r2<>r1} 0
|
||||
test_expr expr-2.21 {r1=2.34, r2=2.34} {r2==r1} 1
|
||||
test_expr expr-2.22 {r1=1.23, r2=2.34} {min(r1,r2,r1+r2,r1-r2)} {-1.11}
|
||||
test_expr expr-2.23 {r1=1.23, r2=2.34} {max(r1,r2,r1+r2,r1-r2)} {3.57}
|
||||
test_expr expr-2.24 {r1=25.0, r2=11.0} {r1%r2} 3
|
||||
test_expr expr-2.24 {r1=25.0, r2=11.0} {r1%r2} 3.0
|
||||
test_expr expr-2.25 {r1=1.23, r2=NULL} {coalesce(r1+r2,99.0)} 99.0
|
||||
|
||||
test_expr expr-3.1 {t1='abc', t2='xyz'} {t1<t2} 1
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing built-in functions.
|
||||
#
|
||||
# $Id: func.test,v 1.28 2004/07/18 20:52:32 drh Exp $
|
||||
# $Id: func.test,v 1.29 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -172,7 +172,7 @@ do_test func-4.4.1 {
|
||||
} {1 {} 345 {} 67890}
|
||||
do_test func-4.4.2 {
|
||||
execsql {SELECT abs(t1) FROM tbl1}
|
||||
} {0 0 0 0 0}
|
||||
} {0.0 0.0 0.0 0.0 0.0}
|
||||
|
||||
do_test func-4.5 {
|
||||
catchsql {SELECT round(a,b,c) FROM t1}
|
||||
@ -251,7 +251,7 @@ do_test func-8.1 {
|
||||
execsql {
|
||||
SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
|
||||
}
|
||||
} {68236 3 22745.33 1 67890 5}
|
||||
} {68236.0 3 22745.33 1 67890 5}
|
||||
do_test func-8.2 {
|
||||
execsql {
|
||||
SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2;
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the CREATE INDEX statement.
|
||||
#
|
||||
# $Id: index.test,v 1.31 2004/07/20 00:52:44 drh Exp $
|
||||
# $Id: index.test,v 1.32 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -359,38 +359,38 @@ do_test index-12.1 {
|
||||
INSERT INTO t4 VALUES('00000',7);
|
||||
SELECT a FROM t4 ORDER BY b;
|
||||
}
|
||||
} {0 0 abc -1 1 0 0}
|
||||
} {0.0 0.0 abc -1.0 1.0 0 0}
|
||||
do_test index-12.2 {
|
||||
execsql {
|
||||
SELECT a FROM t4 WHERE a==0 ORDER BY b
|
||||
}
|
||||
} {0 0 0 0}
|
||||
} {0.0 0.0 0 0}
|
||||
do_test index-12.3 {
|
||||
execsql {
|
||||
SELECT a FROM t4 WHERE a<0.5 ORDER BY b
|
||||
}
|
||||
} {0 0 -1 0 0}
|
||||
} {0.0 0.0 -1.0 0 0}
|
||||
do_test index-12.4 {
|
||||
execsql {
|
||||
SELECT a FROM t4 WHERE a>-0.5 ORDER BY b
|
||||
}
|
||||
} {0 0 abc 1 0 0}
|
||||
} {0.0 0.0 abc 1.0 0 0}
|
||||
do_test index-12.5 {
|
||||
execsql {
|
||||
CREATE INDEX t4i1 ON t4(a);
|
||||
SELECT a FROM t4 WHERE a==0 ORDER BY b
|
||||
}
|
||||
} {0 0 0 0}
|
||||
} {0.0 0.0 0 0}
|
||||
do_test index-12.6 {
|
||||
execsql {
|
||||
SELECT a FROM t4 WHERE a<0.5 ORDER BY b
|
||||
}
|
||||
} {0 0 -1 0 0}
|
||||
} {0.0 0.0 -1.0 0 0}
|
||||
do_test index-12.7 {
|
||||
execsql {
|
||||
SELECT a FROM t4 WHERE a>-0.5 ORDER BY b
|
||||
}
|
||||
} {0 0 abc 1 0 0}
|
||||
} {0.0 0.0 abc 1.0 0 0}
|
||||
integrity_check index-12.8
|
||||
|
||||
# Make sure we cannot drop an automatically created index.
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing the LIMIT ... OFFSET ... clause
|
||||
# of SELECT statements.
|
||||
#
|
||||
# $Id: limit.test,v 1.15 2004/07/19 23:38:11 drh Exp $
|
||||
# $Id: limit.test,v 1.16 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -162,7 +162,7 @@ do_test limit-5.5 {
|
||||
ORDER BY 1, 2 LIMIT 1000;
|
||||
SELECT count(*), sum(x), sum(y), min(x), max(x), min(y), max(y) FROM t5;
|
||||
}
|
||||
} {1000 1528204 593161 0 3107 505 1005}
|
||||
} {1000 1528204.0 593161.0 0 3107 505 1005}
|
||||
|
||||
# There is some contraversy about whether LIMIT 0 should be the same as
|
||||
# no limit at all or if LIMIT 0 should result in zero output rows.
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is exercising the code in main.c.
|
||||
#
|
||||
# $Id: main.test,v 1.15 2004/06/19 00:16:31 drh Exp $
|
||||
# $Id: main.test,v 1.16 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -284,7 +284,7 @@ do_test main-3.3 {
|
||||
insert into T1 values(5.0E+03);
|
||||
select x*10 from T1 order by x*5;
|
||||
}
|
||||
} {-0.51 -0.5 0.05 0.5 5 500 500 500 5000 50000}
|
||||
} {-0.51 -0.5 0.05 0.5 5.0 500.0 500.0 500.0 5000.0 50000.0}
|
||||
do_test main-3.4 {
|
||||
set v [catch {execsql {create bogus}} msg]
|
||||
lappend v $msg
|
||||
|
@ -13,7 +13,7 @@
|
||||
# aggregate min() and max() functions and which are handled as
|
||||
# as a special case.
|
||||
#
|
||||
# $Id: minmax.test,v 1.12 2004/07/18 21:33:02 drh Exp $
|
||||
# $Id: minmax.test,v 1.13 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -134,7 +134,7 @@ do_test minmax-4.2 {
|
||||
(SELECT null, y+1 FROM t1 UNION SELECT * FROM t1)
|
||||
GROUP BY y ORDER BY y;
|
||||
}
|
||||
} {1 1 2 5 3 22 4 92 5 90 6 0}
|
||||
} {1 1.0 2 5.0 3 22.0 4 92.0 5 90.0 6 0.0}
|
||||
do_test minmax-4.3 {
|
||||
execsql {
|
||||
SELECT y, count(x), count(*) FROM
|
||||
|
@ -13,7 +13,7 @@
|
||||
# This file implements tests for miscellanous features that were
|
||||
# left out of other test files.
|
||||
#
|
||||
# $Id: misc1.test,v 1.29 2004/07/19 00:39:46 drh Exp $
|
||||
# $Id: misc1.test,v 1.30 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -115,11 +115,11 @@ do_test misc1-2.1 {
|
||||
do_test misc1-2.2 {
|
||||
execsql {SELECT sum(one), two, four FROM agger
|
||||
GROUP BY two, four ORDER BY sum(one) desc}
|
||||
} {8 two no 6 one yes 4 two yes 3 thr yes}
|
||||
} {8.0 two no 6.0 one yes 4.0 two yes 3.0 thr yes}
|
||||
do_test misc1-2.3 {
|
||||
execsql {SELECT sum((one)), (two), (four) FROM agger
|
||||
GROUP BY (two), (four) ORDER BY sum(one) desc}
|
||||
} {8 two no 6 one yes 4 two yes 3 thr yes}
|
||||
} {8.0 two no 6.0 one yes 4.0 two yes 3.0 thr yes}
|
||||
|
||||
# Here's a test for a bug found by Joel Lucsy. The code below
|
||||
# was causing an assertion failure.
|
||||
|
@ -13,7 +13,7 @@
|
||||
# This file implements tests for miscellanous features that were
|
||||
# left out of other test files.
|
||||
#
|
||||
# $Id: misc3.test,v 1.11 2004/05/20 03:30:11 drh Exp $
|
||||
# $Id: misc3.test,v 1.12 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -72,13 +72,13 @@ do_test misc3-1.2 {
|
||||
#
|
||||
do_test misc3-2.1 {
|
||||
execsql {SELECT 2e-25*0.5e25}
|
||||
} 1
|
||||
} 1.0
|
||||
do_test misc3-2.2 {
|
||||
execsql {SELECT 2.0e-25*000000.500000000000000000000000000000e+00025}
|
||||
} 1
|
||||
} 1.0
|
||||
do_test misc3-2.3 {
|
||||
execsql {SELECT 000000000002e-0000000025*0.5e25}
|
||||
} 1
|
||||
} 1.0
|
||||
do_test misc3-2.4 {
|
||||
execsql {SELECT 2e-25*0.5e250}
|
||||
} 1e+225
|
||||
|
@ -100,7 +100,7 @@ do_test null-3.1 {
|
||||
select count(*), count(b), count(c), sum(b), sum(c),
|
||||
avg(b), avg(c), min(b), max(b) from t1;
|
||||
}
|
||||
} {7 4 6 2 3 0.5 0.5 0 1}
|
||||
} {7 4 6 2.0 3.0 0.5 0.5 0 1}
|
||||
|
||||
# Check to see how WHERE clauses handle NULL values. A NULL value
|
||||
# is the same as UNKNOWN. The WHERE clause should only select those
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is the ability to specify table and column names
|
||||
# as quoted strings.
|
||||
#
|
||||
# $Id: quote.test,v 1.3 2002/05/21 13:43:04 drh Exp $
|
||||
# $Id: quote.test,v 1.4 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -50,7 +50,7 @@ do_test quote-1.3.1 {
|
||||
catchsql {
|
||||
SELECT '!pqr', '#xyz'+5 FROM '@abc'
|
||||
}
|
||||
} {0 {!pqr 5}}
|
||||
} {0 {!pqr 5.0}}
|
||||
do_test quote-1.3.2 {
|
||||
catchsql {
|
||||
SELECT "!pqr", "#xyz"+5 FROM '@abc'
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the SELECT statement.
|
||||
#
|
||||
# $Id: select1.test,v 1.35 2004/07/20 01:45:21 drh Exp $
|
||||
# $Id: select1.test,v 1.36 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -199,7 +199,7 @@ do_test select1-2.14 {
|
||||
do_test select1-2.15 {
|
||||
set v [catch {execsql {SELECT Sum(f1) FROM test1}} msg]
|
||||
lappend v $msg
|
||||
} {0 44}
|
||||
} {0 44.0}
|
||||
do_test select1-2.16 {
|
||||
set v [catch {execsql {SELECT sum(f1,f2) FROM test1}} msg]
|
||||
lappend v $msg
|
||||
@ -207,10 +207,10 @@ do_test select1-2.16 {
|
||||
do_test select1-2.17 {
|
||||
set v [catch {execsql {SELECT SUM(f1)+1 FROM test1}} msg]
|
||||
lappend v $msg
|
||||
} {0 45}
|
||||
} {0 45.0}
|
||||
do_test select1-2.17.1 {
|
||||
execsql {SELECT sum(a) FROM t3}
|
||||
} {44}
|
||||
} {44.0}
|
||||
do_test select1-2.18 {
|
||||
set v [catch {execsql {SELECT XYZZY(f1) FROM test1}} msg]
|
||||
lappend v $msg
|
||||
@ -218,7 +218,7 @@ do_test select1-2.18 {
|
||||
do_test select1-2.19 {
|
||||
set v [catch {execsql {SELECT SUM(min(f1,f2)) FROM test1}} msg]
|
||||
lappend v $msg
|
||||
} {0 44}
|
||||
} {0 44.0}
|
||||
do_test select1-2.20 {
|
||||
set v [catch {execsql {SELECT SUM(min(f1)) FROM test1}} msg]
|
||||
lappend v $msg
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing aggregate functions and the
|
||||
# GROUP BY and HAVING clauses of SELECT statements.
|
||||
#
|
||||
# $Id: select3.test,v 1.11 2004/06/11 13:19:22 danielk1977 Exp $
|
||||
# $Id: select3.test,v 1.12 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -44,7 +44,7 @@ do_test select3-1.2 {
|
||||
SELECT min(n),min(log),max(n),max(log),sum(n),sum(log),avg(n),avg(log)
|
||||
FROM t1
|
||||
}
|
||||
} {1 0 31 5 496 124 16 4}
|
||||
} {1 0 31 5 496.0 124.0 16.0 4.0}
|
||||
do_test select3-1.3 {
|
||||
execsql {SELECT max(n)/avg(n), max(log)/avg(log) FROM t1}
|
||||
} {1.9375 1.25}
|
||||
@ -59,16 +59,16 @@ do_test select3-2.2 {
|
||||
} {0 1 1 2 2 3 3 5 4 9 5 17}
|
||||
do_test select3-2.3 {
|
||||
execsql {SELECT log, avg(n) FROM t1 GROUP BY log ORDER BY log}
|
||||
} {0 1 1 2 2 3.5 3 6.5 4 12.5 5 24}
|
||||
} {0 1.0 1 2.0 2 3.5 3 6.5 4 12.5 5 24.0}
|
||||
do_test select3-2.3 {
|
||||
execsql {SELECT log, avg(n)+1 FROM t1 GROUP BY log ORDER BY log}
|
||||
} {0 2 1 3 2 4.5 3 7.5 4 13.5 5 25}
|
||||
} {0 2.0 1 3.0 2 4.5 3 7.5 4 13.5 5 25.0}
|
||||
do_test select3-2.4 {
|
||||
execsql {SELECT log, avg(n)-min(n) FROM t1 GROUP BY log ORDER BY log}
|
||||
} {0 0 1 0 2 0.5 3 1.5 4 3.5 5 7}
|
||||
} {0 0.0 1 0.0 2 0.5 3 1.5 4 3.5 5 7.0}
|
||||
do_test select3-2.5 {
|
||||
execsql {SELECT log*2+1, avg(n)-min(n) FROM t1 GROUP BY log ORDER BY log}
|
||||
} {1 0 3 0 5 0.5 7 1.5 9 3.5 11 7}
|
||||
} {1 0.0 3 0.0 5 0.5 7 1.5 9 3.5 11 7.0}
|
||||
do_test select3-2.6 {
|
||||
execsql {
|
||||
SELECT log*2+1 as x, count(*) FROM t1 GROUP BY x ORDER BY x
|
||||
@ -166,14 +166,14 @@ do_test select3-5.1 {
|
||||
GROUP BY log
|
||||
ORDER BY max(n+log*2)+0, avg(n)+0
|
||||
}
|
||||
} {0 1 1 1 1 1 2 4 2 2 3.5 8 3 4 6.5 14 4 8 12.5 24 5 15 24 41}
|
||||
} {0 1 1.0 1 1 1 2.0 4 2 2 3.5 8 3 4 6.5 14 4 8 12.5 24 5 15 24.0 41}
|
||||
do_test select3-5.2 {
|
||||
execsql {
|
||||
SELECT log, count(*), avg(n), max(n+log*2) FROM t1
|
||||
GROUP BY log
|
||||
ORDER BY max(n+log*2)+0, min(log,avg(n))+0
|
||||
}
|
||||
} {0 1 1 1 1 1 2 4 2 2 3.5 8 3 4 6.5 14 4 8 12.5 24 5 15 24 41}
|
||||
} {0 1 1.0 1 1 1 2.0 4 2 2 3.5 8 3 4 6.5 14 4 8 12.5 24 5 15 24.0 41}
|
||||
|
||||
# Test sorting of GROUP BY results in the presence of an index
|
||||
# on the GROUP BY column.
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing aggregate functions and the
|
||||
# GROUP BY and HAVING clauses of SELECT statements.
|
||||
#
|
||||
# $Id: select5.test,v 1.7 2004/05/27 17:22:56 drh Exp $
|
||||
# $Id: select5.test,v 1.8 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -86,7 +86,7 @@ do_test select5-3.1 {
|
||||
execsql {
|
||||
SELECT x, count(*), avg(y) FROM t1 GROUP BY x HAVING x<4 ORDER BY x
|
||||
}
|
||||
} {1 1 5 2 1 5 3 1 5}
|
||||
} {1 1 5.0 2 1 5.0 3 1 5.0}
|
||||
|
||||
# Run various aggregate functions when the count is zero.
|
||||
#
|
||||
@ -114,6 +114,6 @@ do_test select5-4.5 {
|
||||
execsql {
|
||||
SELECT sum(x) FROM t1 WHERE x>100
|
||||
}
|
||||
} {0}
|
||||
} {0.0}
|
||||
|
||||
finish_test
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing SELECT statements that contain
|
||||
# subqueries in their FROM clause.
|
||||
#
|
||||
# $Id: select6.test,v 1.11 2004/01/24 20:18:13 drh Exp $
|
||||
# $Id: select6.test,v 1.12 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -175,12 +175,12 @@ do_test select6-3.4 {
|
||||
execsql {
|
||||
SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1 WHERE y=4)
|
||||
}
|
||||
} {11.5 4 15.5}
|
||||
} {11.5 4.0 15.5}
|
||||
do_test select6-3.5 {
|
||||
execsql {
|
||||
SELECT x,y,x+y FROM (SELECT avg(a) as 'x', avg(b) as 'y' FROM t2 WHERE a=4)
|
||||
}
|
||||
} {4 3 7}
|
||||
} {4.0 3.0 7.0}
|
||||
do_test select6-3.6 {
|
||||
execsql {
|
||||
SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1)
|
||||
@ -198,7 +198,7 @@ do_test select6-3.8 {
|
||||
SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1 WHERE y=4)
|
||||
WHERE a>10
|
||||
}
|
||||
} {11.5 4 15.5}
|
||||
} {11.5 4.0 15.5}
|
||||
do_test select6-3.9 {
|
||||
execsql {
|
||||
SELECT a,b,a+b FROM (SELECT avg(x) as 'a', avg(y) as 'b' FROM t1 WHERE y=4)
|
||||
@ -210,14 +210,14 @@ do_test select6-3.10 {
|
||||
SELECT a,b,a+b FROM (SELECT avg(x) as 'a', y as 'b' FROM t1 GROUP BY b)
|
||||
ORDER BY a
|
||||
}
|
||||
} {1 1 2 2.5 2 4.5 5.5 3 8.5 11.5 4 15.5 18 5 23}
|
||||
} {1.0 1 2.0 2.5 2 4.5 5.5 3 8.5 11.5 4 15.5 18.0 5 23.0}
|
||||
do_test select6-3.11 {
|
||||
execsql {
|
||||
SELECT a,b,a+b FROM
|
||||
(SELECT avg(x) as 'a', y as 'b' FROM t1 GROUP BY b)
|
||||
WHERE b<4 ORDER BY a
|
||||
}
|
||||
} {1 1 2 2.5 2 4.5 5.5 3 8.5}
|
||||
} {1.0 1 2.0 2.5 2 4.5 5.5 3 8.5}
|
||||
do_test select6-3.12 {
|
||||
execsql {
|
||||
SELECT a,b,a+b FROM
|
||||
@ -231,7 +231,7 @@ do_test select6-3.13 {
|
||||
(SELECT avg(x) as 'a', y as 'b' FROM t1 GROUP BY b HAVING a>1)
|
||||
ORDER BY a
|
||||
}
|
||||
} {2.5 2 4.5 5.5 3 8.5 11.5 4 15.5 18 5 23}
|
||||
} {2.5 2 4.5 5.5 3 8.5 11.5 4 15.5 18.0 5 23.0}
|
||||
do_test select6-3.14 {
|
||||
execsql {
|
||||
SELECT [count(*)],y FROM (SELECT count(*), y FROM t1 GROUP BY y)
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the CREATE TABLE statement.
|
||||
#
|
||||
# $Id: sort.test,v 1.14 2004/06/27 21:31:40 drh Exp $
|
||||
# $Id: sort.test,v 1.15 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -62,10 +62,10 @@ do_test sort-1.4 {
|
||||
} {2 3 6 7 1 4 5 8}
|
||||
do_test sort-1.5 {
|
||||
execsql {SELECT flt FROM t1 ORDER BY flt}
|
||||
} {-11 -1.6 -0.0013442 0.123 2.15 3.141592653 123 4221}
|
||||
} {-11 -1.6 -0.0013442 0.123 2.15 3.141592653 123.0 4221.0}
|
||||
do_test sort-1.6 {
|
||||
execsql {SELECT flt FROM t1 ORDER BY flt DESC}
|
||||
} {4221 123 3.141592653 2.15 0.123 -0.0013442 -1.6 -11}
|
||||
} {4221.0 123.0 3.141592653 2.15 0.123 -0.0013442 -1.6 -11}
|
||||
do_test sort-1.7 {
|
||||
execsql {SELECT roman FROM t1 ORDER BY roman}
|
||||
} {I II III IV V VI VII VIII}
|
||||
@ -353,7 +353,7 @@ do_test sort-8.1 {
|
||||
INSERT INTO t5 VALUES(100.0,'A2');
|
||||
SELECT * FROM t5 ORDER BY a, b;
|
||||
}
|
||||
} {100 A1 100 A2}
|
||||
} {100 A1 100.0 A2}
|
||||
|
||||
# BLOBs should sort after TEXT
|
||||
#
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing SELECT statements that are part of
|
||||
# expressions.
|
||||
#
|
||||
# $Id: subselect.test,v 1.9 2004/07/26 23:32:27 drh Exp $
|
||||
# $Id: subselect.test,v 1.10 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -113,12 +113,12 @@ do_test subselect-3.2 {
|
||||
execsql {
|
||||
SELECT sum(x) FROM (SELECT x FROM t3 ORDER BY x LIMIT 2);
|
||||
}
|
||||
} {3}
|
||||
} {3.0}
|
||||
do_test subselect-3.3 {
|
||||
execsql {
|
||||
SELECT sum(x) FROM (SELECT x FROM t3 ORDER BY x DESC LIMIT 2);
|
||||
}
|
||||
} {11}
|
||||
} {11.0}
|
||||
do_test subselect-3.4 {
|
||||
execsql {
|
||||
SELECT (SELECT x FROM t3 ORDER BY x);
|
||||
|
@ -15,7 +15,7 @@
|
||||
# interface is pretty well tested. This file contains some addition
|
||||
# tests for fringe issues that the main test suite does not cover.
|
||||
#
|
||||
# $Id: tclsqlite.test,v 1.29 2004/08/20 16:02:39 drh Exp $
|
||||
# $Id: tclsqlite.test,v 1.30 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -185,4 +185,39 @@ do_test tcl-4.2 {
|
||||
db busy
|
||||
} {}
|
||||
|
||||
# Parsing of TCL variable names within SQL into bound parameters.
|
||||
#
|
||||
do_test tcl-5.1 {
|
||||
execsql {CREATE TABLE t3(a,b,c)}
|
||||
catch {unset x}
|
||||
set x(1) 5
|
||||
set x(2) 7
|
||||
execsql {
|
||||
INSERT INTO t3 VALUES($::x(1),$::x(2),$::x(3));
|
||||
SELECT * FROM t3
|
||||
}
|
||||
} {5 7 {}}
|
||||
do_test tcl-5.2 {
|
||||
execsql {
|
||||
SELECT typeof(a), typeof(b), typeof(c) FROM t3
|
||||
}
|
||||
} {text text null}
|
||||
do_test tcl-5.3 {
|
||||
catch {unset x}
|
||||
set x [binary format h12 686900686f00]
|
||||
execsql {
|
||||
UPDATE t3 SET a=$::x;
|
||||
}
|
||||
db eval {
|
||||
SELECT a FROM t3
|
||||
} break
|
||||
binary scan $a h12 adata
|
||||
set adata
|
||||
} {686900686f00}
|
||||
do_test tcl-5.4 {
|
||||
execsql {
|
||||
SELECT typeof(a), typeof(b), typeof(c) FROM t3
|
||||
}
|
||||
} {blob text null}
|
||||
|
||||
finish_test
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements some common TCL routines used for regression
|
||||
# testing the SQLite library
|
||||
#
|
||||
# $Id: tester.tcl,v 1.37 2004/06/19 00:16:31 drh Exp $
|
||||
# $Id: tester.tcl,v 1.38 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
# Make sure tclsqlite3 was compiled correctly. Abort now with an
|
||||
# error message if not.
|
||||
@ -40,6 +40,8 @@ if {[sqlite3 -tcl-uses-utf]} {
|
||||
}
|
||||
}
|
||||
|
||||
set tcl_precision 15
|
||||
|
||||
# Use the pager codec if it is available
|
||||
#
|
||||
if {[sqlite3 -has-codec] && [info command sqlite_orig]==""} {
|
||||
|
@ -106,11 +106,15 @@ foreach tbl_defn {
|
||||
}
|
||||
|
||||
do_test trigger2-1.$ii.1 {
|
||||
execsql {
|
||||
set r {}
|
||||
foreach v [execsql {
|
||||
UPDATE tbl SET a = a * 10, b = b * 10;
|
||||
SELECT * FROM rlog ORDER BY idx;
|
||||
SELECT * FROM clog ORDER BY idx;
|
||||
}] {
|
||||
lappend r [expr {int($v)}]
|
||||
}
|
||||
set r
|
||||
} [list 1 1 2 4 6 10 20 \
|
||||
2 1 2 13 24 10 20 \
|
||||
3 3 4 13 24 30 40 \
|
||||
@ -139,10 +143,14 @@ foreach tbl_defn {
|
||||
END;
|
||||
}
|
||||
do_test trigger2-1.$ii.2 {
|
||||
execsql {
|
||||
set r {}
|
||||
foreach v [execsql {
|
||||
DELETE FROM tbl;
|
||||
SELECT * FROM rlog;
|
||||
}] {
|
||||
lappend r [expr {int($v)}]
|
||||
}
|
||||
set r
|
||||
} [list 1 100 100 400 300 0 0 \
|
||||
2 100 100 300 200 0 0 \
|
||||
3 300 200 300 200 0 0 \
|
||||
@ -178,8 +186,8 @@ foreach tbl_defn {
|
||||
|
||||
SELECT * FROM rlog;
|
||||
}
|
||||
} [list 1 0 0 0 0 5 6 \
|
||||
2 0 0 5 6 5 6 ]
|
||||
} [list 1 0 0 0.0 0.0 5 6 \
|
||||
2 0 0 5.0 6.0 5 6 ]
|
||||
|
||||
do_test trigger2-1.$ii.4 {
|
||||
execsql {
|
||||
|
@ -12,7 +12,7 @@
|
||||
# it tests that the different storage classes (integer, real, text etc.)
|
||||
# all work correctly.
|
||||
#
|
||||
# $Id: types.test,v 1.10 2004/07/22 15:02:26 drh Exp $
|
||||
# $Id: types.test,v 1.11 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -219,7 +219,7 @@ do_test types-2.2.2 {
|
||||
execsql {
|
||||
SELECT a FROM t2;
|
||||
}
|
||||
} {0 12345.678 -12345.678}
|
||||
} {0.0 12345.678 -12345.678}
|
||||
|
||||
# Check that all the record sizes are as we expected.
|
||||
do_test types-2.2.3 {
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the use of indices in WHERE clases.
|
||||
#
|
||||
# $Id: where.test,v 1.21 2004/05/21 03:01:59 drh Exp $
|
||||
# $Id: where.test,v 1.22 2004/08/20 18:34:20 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -380,7 +380,7 @@ do_test where-6.1 {
|
||||
INSERT INTO t3 SELECT w, 101-w, y FROM t1;
|
||||
SELECT count(*), sum(a), sum(b), sum(c) FROM t3;
|
||||
}
|
||||
} {100 5050 5050 348550}
|
||||
} {100 5050.0 5050.0 348550.0}
|
||||
do_test where-6.2 {
|
||||
cksort {
|
||||
SELECT * FROM t3 ORDER BY a LIMIT 3
|
||||
|
Loading…
x
Reference in New Issue
Block a user