Add some tests for the new API. Many more to come. (CVS 1462)

FossilOrigin-Name: d5659f2ee6788e0205fb5e03eeaf64e6c0aa9bed
This commit is contained in:
danielk1977 2004-05-26 10:11:05 +00:00
parent 398eae781e
commit 3cf8606395
18 changed files with 428 additions and 156 deletions

View File

@ -1,5 +1,5 @@
C Remove\sthe\sshow_datatypes\spragma.\s(CVS\s1461)
D 2004-05-26T06:58:44
C Add\ssome\stests\sfor\sthe\snew\sAPI.\sMany\smore\sto\scome.\s(CVS\s1462)
D 2004-05-26T10:11:05
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -27,17 +27,17 @@ F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79
F src/btree.c 6db76fbf63efd6008c5e6cb038ea40f94abffcf7
F src/btree.h b65140b5ae891f30d2a39e64b9f0343225553545
F src/build.c 35cbeb439b49cca5eb5e8a1de010a5194f4523e8
F src/copy.c 3c4ee52cc6ab3dea44ddfa8426c19155b2bbf242
F src/copy.c 6eb7cc08ae6dc60bf83ecadf4508a0bef909dbd2
F src/date.c 1a6a72549e1eb8454b8bacb1734892cdcd78cebb
F src/delete.c f4a04c0c5c67852a44768c29f408ddda8cfeeab2
F src/delete.c 66c5ab98cbad7e6b315fc997bfe6c8080784a701
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
F src/expr.c 5b283e68bd6df365b7c2ad10bd04cc54c2b4b07c
F src/func.c ddd86cbd438e385123785b67bd6c37a40a3c92bd
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c 48bb15bff280767684a0f9ee4ae5973c9504f880
F src/insert.c dd117e8b3f50e943e6cf5fbcf4bbdc0b907b0b4c
F src/legacy.c a856d2d5317ed2ac93c2c6cbba7d4faa564a5b20
F src/main.c 2f144d7576413d73e146cb6f9fc33d5169610f8c
F src/main.c 6a583e9d92dbc5b1371c3a4a35c398e5253327a5
F src/md5.c 833671b541a76fc0e62404433c9176706eeacdf0
F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67
F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f
@ -50,30 +50,30 @@ F src/os_win.h 5d41af24caaef6c13a2d8e2399caa1c57d45c84d
F src/pager.c 6ff6b906427d4824099140776cb8768f922f3dc5
F src/pager.h 78a00ac280899bcba1a89dc51585dcae6b7b3253
F src/parse.y 567718866b94d58a6c7681cc45ba7987771d583a
F src/pragma.c aa6a887017a512aba8c6bd9cd7c235b536a2b2f3
F src/pragma.c f2b05b087a5764802296a28d7abdd75728beedee
F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 42996047868542619a8879bce3b446d92c81ead0
F src/select.c 53f1aea3fabf51d22e6efa5662ccd7b0b7368179
F src/shell.c ed4d237b3e52a0a42512bfcc53530e46de20c28f
F src/sqlite.h.in c36ab3d4dc1b863ba0cf79905210180b8059a839
F src/sqliteInt.h 323281bd04c7f988c6873777750acaa1f6b3b9a6
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
F src/tclsqlite.c 2700a35f494e8fc5ad2742bcae09d2cb66a295ab
F src/test1.c d2e0b5e8a12dc70fa011748c01e4a7ef38cc5a8e
F src/test1.c e9509ec479cb84bb6e6f88079dc4d0932459663e
F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872
F src/test3.c 5e4a6d596f982f6f47a5f9f75ede9b4a3b739968
F src/test4.c 014478492bddb3f9b4a3151b05f9ac708fe279fb
F src/test5.c 9a1f15133f6955f067c5246e564723b5f23ff221
F src/tokenize.c e7536dd31205d5afb76c1bdc832dea009c7a3847
F src/trigger.c 11afe9abfba13a2ba142944c797c952e162d117f
F src/update.c 2b5ec85fa19020686ed2fc4a3fc43cbcefbfdfa7
F src/update.c 96461bcf4e946697e83c09c77c7e61b545a2f66e
F src/utf.c 1d38da85bffb928fb0d9f301e7db913a6df486ce
F src/util.c 4c0adcbc9ce6678dd046931253e45d623c6d279f
F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
F src/vdbe.c 4db41e7cc51368614ce8bf428aee1400e471ef1b
F src/vdbe.h ebd59ee7a988d39c58b27149593f09a432ad1410
F src/vdbeInt.h c8706615ad49c7a5292daa31425dd1b0b24b3b9b
F src/vdbeaux.c a792ac602eb81c15ebdea64931bd3fad85b025f2
F src/vdbe.c f1dcfdc19d4b62413a46cf47414d9858c2c08769
F src/vdbe.h 948cafed61e827967e07b44d51009c0e48ce168e
F src/vdbeInt.h 653525b165ccc72b506d2793281a7d95eb42ad32
F src/vdbeaux.c be599d276d25f04c5a8c26e8e270e3909f6c3c05
F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
@ -81,21 +81,21 @@ F test/attach2.test 5472d442bb2ef1ee587e0ae7472bb68b52509a38
F test/auth.test 5c4d95cdaf539c0c236e20ce1f71a93e7dde9185
F test/bigfile.test ea904b853ce2d703b16c5ce90e2b54951bc1ae81
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
F test/bind.test b2e77ea6e9317b48210d47fa03ea1f7169bcf764
F test/bind.test 44097e9a885ac851934c2e9b74d2fec36659bca5
F test/btree.test 08e4093c78d2bc1d54e27266f8d17fed14751125
F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635
F test/btree4.test 3797b4305694c7af6828675b0f4b1424b8ca30e4
F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2
F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027
F test/capi2.test 8fb64e8ab7f78b8254cd4d04bb96822167f731b2
F test/capi3.test 5b01d70ec1510e6cee053b2a80ad3aa96ae2acf2
F test/capi3.test b85ea1e676ff482a813332ef4418c8ef63721538
F test/conflict.test 0911bb2f079046914a6e9c3341b36658c4e2103e
F test/copy.test f07ea8d60878da7a67416ab62f78e9706b9d3c45
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/date.test aed5030482ebc02bd8d386c6c86a29f694ab068d
F test/delete.test 92256384f1801760180ded129f7427884cf28886
F test/enc.test a55481d45ff493804e8d88357feb4642fc50a6b2
F test/enc2.test c72d5d74f2f6731c9e7f00f20caab0aeba65027e
F test/enc2.test f80bcf14a286f34e54378b9b044c5d93b7679bc1
F test/expr.test 8b62f3fcac64fbd5c3d43d7a7984245743dcbe65
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
F test/format3.test 149cc166c97923fa60def047e90dd3fb32bba916
@ -158,7 +158,7 @@ F test/types.test 8fa51489d4765b8baa2d3c92de32aba06315a655
F test/types2.test 5d725fcb68dbd032c6d4950d568d75fa33872687
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
F test/vacuum.test 81417656043f2402ec4a7dd8255f88bb4d1b73af
F test/vacuum.test c083e578c4f159b1ce7b5a4594149fd19b3f4f5f
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/version.test 2ba212ba06380e65e476bdf2fcd390e8b05af5a0
F test/view.test 1ee12c6f8f4791a2c0655120d5562a49400cfe53
@ -203,7 +203,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 0317bef4b0c219ca2888c90553201e53230fb360
R 250b3406a1267384090bf13650dde2b6
P 93bb958d939302795027f738b8f663cbce3e8783
R 9229fc306f747f64e12780c4e3dc4ddb
U danielk1977
Z 468d6cd88bf024746a793243f549c65d
Z 12be33fdc43bb15fcde0f5e6812926c8

View File

@ -1 +1 @@
93bb958d939302795027f738b8f663cbce3e8783
d5659f2ee6788e0205fb5e03eeaf64e6c0aa9bed

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the COPY command.
**
** $Id: copy.c,v 1.12 2004/05/25 23:35:18 danielk1977 Exp $
** $Id: copy.c,v 1.13 2004/05/26 10:11:05 danielk1977 Exp $
*/
#include "sqliteInt.h"
@ -97,10 +97,9 @@ void sqlite3Copy(
sqlite3VdbeAddOp(v, OP_Noop, 0, 0);
sqlite3EndWriteOperation(pParse);
if( db->flags & SQLITE_CountRows ){
sqlite3VdbeAddOp(v, OP_ColumnName, 0, 1);
sqlite3VdbeChangeP3(v, -1, "rows inserted", P3_STATIC);
sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "rows inserted", P3_STATIC);
}
}

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements.
**
** $Id: delete.c,v 1.69 2004/05/25 23:35:18 danielk1977 Exp $
** $Id: delete.c,v 1.70 2004/05/26 10:11:05 danielk1977 Exp $
*/
#include "sqliteInt.h"
@ -303,10 +303,9 @@ void sqlite3DeleteFrom(
** Return the number of rows that were deleted.
*/
if( db->flags & SQLITE_CountRows ){
sqlite3VdbeAddOp(v, OP_ColumnName, 0, 1);
sqlite3VdbeChangeP3(v, -1, "rows deleted", P3_STATIC);
sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "rows deleted", P3_STATIC);
}
delete_from_cleanup:

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.106 2004/05/25 23:35:18 danielk1977 Exp $
** $Id: insert.c,v 1.107 2004/05/26 10:11:06 danielk1977 Exp $
*/
#include "sqliteInt.h"
@ -617,10 +617,10 @@ void sqlite3Insert(
** Return the number of rows inserted.
*/
if( db->flags & SQLITE_CountRows ){
sqlite3VdbeOp3(v, OP_ColumnName, 0, 1, "rows inserted", P3_STATIC);
sqlite3VdbeAddOp(v, OP_MemLoad, iCntMem, 0);
sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "rows inserted", P3_STATIC);
}
insert_cleanup:

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.192 2004/05/26 06:58:44 danielk1977 Exp $
** $Id: main.c,v 1.193 2004/05/26 10:11:06 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -930,6 +930,11 @@ int sqlite3_prepare(
if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
sqlite3VdbeSetNumCols(sParse.pVdbe, 5);
sqlite3VdbeSetColName(sParse.pVdbe, 0, "addr", P3_STATIC);
sqlite3VdbeSetColName(sParse.pVdbe, 1, "opcode", P3_STATIC);
sqlite3VdbeSetColName(sParse.pVdbe, 2, "p1", P3_STATIC);
sqlite3VdbeSetColName(sParse.pVdbe, 3, "p2", P3_STATIC);
sqlite3VdbeSetColName(sParse.pVdbe, 4, "p3", P3_STATIC);
}
prepare_out:

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.31 2004/05/26 06:58:44 danielk1977 Exp $
** $Id: pragma.c,v 1.32 2004/05/26 10:11:06 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -129,11 +129,9 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
Vdbe *v;
if( strcmp(zLeft,zRight)==0 && (v = sqlite3GetVdbe(pParse))!=0 ){
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeOp3(v, OP_ColumnName, 0, 1, aPragma[i].zName, P3_STATIC);
sqlite3VdbeOp3(v, OP_ColumnName, 1, 0, "boolean", P3_STATIC);
sqlite3VdbeSetColName(v, 0, aPragma[i].zName, P3_STATIC);
sqlite3VdbeCode(v, OP_Integer, (db->flags & aPragma[i].mask)!=0, 0,
OP_Callback, 1, 0,
0);
OP_Callback, 1, 0, 0);
}else if( getBoolean(zRight) ){
db->flags |= aPragma[i].mask;
}else{
@ -202,12 +200,12 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
{ OP_Integer, 0, 0, 0},
{ OP_Ne, 0, 6, 0},
{ OP_Integer, 0, 0, 0}, /* 5 */
{ OP_ColumnName, 0, 1, "cache_size"},
{ OP_Callback, 1, 0, 0},
};
int addr;
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "cache_size", P3_STATIC);
addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
sqlite3VdbeChangeP1(v, addr+5, MAX_PAGES);
}else{
@ -242,7 +240,6 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
*/
if( sqlite3StrICmp(zLeft,"cache_size")==0 ){
static VdbeOpList getCacheSize[] = {
{ OP_ColumnName, 0, 1, "cache_size"},
{ OP_Callback, 1, 0, 0},
};
if( pRight->z==pLeft->z ){
@ -250,6 +247,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
if( size<0 ) size = -size;
sqlite3VdbeAddOp(v, OP_Integer, size, 0);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "cache_size", P3_STATIC);
sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
}else{
int size = atoi(zRight);
@ -281,24 +279,24 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
*/
if( sqlite3StrICmp(zLeft,"default_synchronous")==0 ){
static VdbeOpList getSync[] = {
{ OP_ColumnName, 0, 1, "synchronous"},
{ OP_ReadCookie, 0, 3, 0},
{ OP_Dup, 0, 0, 0},
{ OP_If, 0, 0, 0}, /* 3 */
{ OP_If, 0, 0, 0}, /* 2 */
{ OP_ReadCookie, 0, 2, 0},
{ OP_Integer, 0, 0, 0},
{ OP_Lt, 0, 5, 0},
{ OP_AddImm, 1, 0, 0},
{ OP_Callback, 1, 0, 0},
{ OP_Halt, 0, 0, 0},
{ OP_AddImm, -1, 0, 0}, /* 10 */
{ OP_AddImm, -1, 0, 0}, /* 9 */
{ OP_Callback, 1, 0, 0}
};
int addr;
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "synchronous", P3_STATIC);
addr = sqlite3VdbeAddOpList(v, ArraySize(getSync), getSync);
sqlite3VdbeChangeP2(v, addr+3, addr+10);
sqlite3VdbeChangeP2(v, addr+2, addr+9);
}else{
int size = db->cache_size;
if( size<0 ) size = -size;
@ -335,11 +333,11 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
*/
if( sqlite3StrICmp(zLeft,"synchronous")==0 ){
static VdbeOpList getSync[] = {
{ OP_ColumnName, 0, 1, "synchronous"},
{ OP_Callback, 1, 0, 0},
};
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "synchronous", P3_STATIC);
sqlite3VdbeAddOp(v, OP_Integer, db->safety_level-1, 0);
sqlite3VdbeAddOpList(v, ArraySize(getSync), getSync);
}else{
@ -371,17 +369,14 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
Table *pTab;
pTab = sqlite3FindTable(db, zRight, 0);
if( pTab ){
static VdbeOpList tableInfoPreface[] = {
{ OP_ColumnName, 0, 0, "cid"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 0, "type"},
{ OP_ColumnName, 3, 0, "notnull"},
{ OP_ColumnName, 4, 0, "dflt_value"},
{ OP_ColumnName, 5, 1, "pk"},
};
int i;
sqlite3VdbeSetNumCols(v, 6);
sqlite3VdbeAddOpList(v, ArraySize(tableInfoPreface), tableInfoPreface);
sqlite3VdbeSetColName(v, 0, "cid", P3_STATIC);
sqlite3VdbeSetColName(v, 1, "name", P3_STATIC);
sqlite3VdbeSetColName(v, 2, "type", P3_STATIC);
sqlite3VdbeSetColName(v, 3, "notnull", P3_STATIC);
sqlite3VdbeSetColName(v, 4, "dflt_value", P3_STATIC);
sqlite3VdbeSetColName(v, 5, "pk", P3_STATIC);
sqlite3ViewGetColumnNames(pParse, pTab);
for(i=0; i<pTab->nCol; i++){
sqlite3VdbeAddOp(v, OP_Integer, i, 0);
@ -402,15 +397,12 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
Table *pTab;
pIdx = sqlite3FindIndex(db, zRight, 0);
if( pIdx ){
static VdbeOpList tableInfoPreface[] = {
{ OP_ColumnName, 0, 0, "seqno"},
{ OP_ColumnName, 1, 0, "cid"},
{ OP_ColumnName, 2, 1, "name"},
};
int i;
pTab = pIdx->pTable;
sqlite3VdbeSetNumCols(v, 3);
sqlite3VdbeAddOpList(v, ArraySize(tableInfoPreface), tableInfoPreface);
sqlite3VdbeSetColName(v, 0, "seqno", P3_STATIC);
sqlite3VdbeSetColName(v, 1, "cid", P3_STATIC);
sqlite3VdbeSetColName(v, 2, "name", P3_STATIC);
for(i=0; i<pIdx->nColumn; i++){
int cnum = pIdx->aiColumn[i];
sqlite3VdbeAddOp(v, OP_Integer, i, 0);
@ -432,14 +424,10 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
}
if( pTab && pIdx ){
int i = 0;
static VdbeOpList indexListPreface[] = {
{ OP_ColumnName, 0, 0, "seq"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 1, "unique"},
};
sqlite3VdbeSetNumCols(v, 3);
sqlite3VdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC);
sqlite3VdbeSetColName(v, 1, "name", P3_STATIC);
sqlite3VdbeSetColName(v, 2, "unique", P3_STATIC);
while(pIdx){
sqlite3VdbeAddOp(v, OP_Integer, i, 0);
sqlite3VdbeOp3(v, OP_String, 0, 0, pIdx->zName, 0);
@ -461,16 +449,12 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
}
if( pTab && pFK ){
int i = 0;
static VdbeOpList indexListPreface[] = {
{ OP_ColumnName, 0, 0, "id"},
{ OP_ColumnName, 1, 0, "seq"},
{ OP_ColumnName, 2, 0, "table"},
{ OP_ColumnName, 3, 0, "from"},
{ OP_ColumnName, 4, 1, "to"},
};
sqlite3VdbeSetNumCols(v, 6);
sqlite3VdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
sqlite3VdbeSetNumCols(v, 5);
sqlite3VdbeSetColName(v, 0, "id", P3_STATIC);
sqlite3VdbeSetColName(v, 1, "seq", P3_STATIC);
sqlite3VdbeSetColName(v, 2, "table", P3_STATIC);
sqlite3VdbeSetColName(v, 3, "from", P3_STATIC);
sqlite3VdbeSetColName(v, 4, "to", P3_STATIC);
while(pFK){
int j;
for(j=0; j<pFK->nCol; j++){
@ -490,14 +474,10 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
if( sqlite3StrICmp(zLeft, "database_list")==0 ){
int i;
static VdbeOpList indexListPreface[] = {
{ OP_ColumnName, 0, 0, "seq"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 1, "file"},
};
sqlite3VdbeSetNumCols(v, 3);
sqlite3VdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC);
sqlite3VdbeSetColName(v, 1, "name", P3_STATIC);
sqlite3VdbeSetColName(v, 2, "file", P3_STATIC);
for(i=0; i<db->nDb; i++){
if( db->aDb[i].pBt==0 ) continue;
assert( db->aDb[i].zName!=0 );
@ -523,12 +503,12 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
*/
if( sqlite3StrICmp(zLeft, "temp_store")==0 ){
static VdbeOpList getTmpDbLoc[] = {
{ OP_ColumnName, 0, 1, "temp_store"},
{ OP_Callback, 1, 0, 0},
};
if( pRight->z==pLeft->z ){
sqlite3VdbeAddOp(v, OP_Integer, db->temp_store, 0);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "temp_store", P3_STATIC);
sqlite3VdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
}else{
changeTempStorage(pParse, zRight);
@ -548,11 +528,11 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
*/
if( sqlite3StrICmp(zLeft, "default_temp_store")==0 ){
static VdbeOpList getTmpDbLoc[] = {
{ OP_ColumnName, 0, 1, "temp_store"},
{ OP_ReadCookie, 0, 5, 0},
{ OP_Callback, 1, 0, 0}};
if( pRight->z==pLeft->z ){
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "temp_store", P3_STATIC);
sqlite3VdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
}else{
sqlite3BeginWriteOperation(pParse, 0, 0);
@ -582,7 +562,6 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
static VdbeOpList initCode[] = {
{ OP_Integer, 0, 0, 0},
{ OP_MemStore, 0, 1, 0},
{ OP_ColumnName, 0, 1, "integrity_check"},
};
/* Code that appears at the end of the integrity check. If no error
@ -599,6 +578,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
/* Initialize the VDBE program */
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "integrity_check", P3_STATIC);
sqlite3VdbeAddOpList(v, ArraySize(initCode), initCode);
/* Do an integrity check on each database file */

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.176 2004/05/26 06:18:38 danielk1977 Exp $
** $Id: select.c,v 1.177 2004/05/26 10:11:06 danielk1977 Exp $
*/
#include "sqliteInt.h"
@ -682,6 +682,11 @@ static void generateColumnNames(
sqlite *db = pParse->db;
int fullNames, shortNames;
/* If this is an EXPLAIN, skip this step */
if( pParse->explain ){
return SQLITE_OK;
}
assert( v!=0 );
if( pParse->colNamesSet || v==0 || sqlite3_malloc_failed ) return;
pParse->colNamesSet = 1;
@ -695,7 +700,7 @@ static void generateColumnNames(
if( p==0 ) continue;
if( pEList->a[i].zName ){
char *zName = pEList->a[i].zName;
sqlite3VdbeOp3(v, OP_ColumnName, i, p2, zName, 0);
sqlite3VdbeSetColName(v, i, zName, 0);
continue;
}
if( p->op==TK_COLUMN && pTabList ){
@ -713,8 +718,8 @@ static void generateColumnNames(
zCol = pTab->aCol[iCol].zName;
}
if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){
int addr = sqlite3VdbeOp3(v,OP_ColumnName, i, p2, p->span.z, p->span.n);
sqlite3VdbeCompressSpace(v, addr);
sqlite3VdbeSetColName(v, i, p->span.z, p->span.n);
/* sqlite3VdbeCompressSpace(v, addr); */
}else if( fullNames || (!shortNames && pTabList->nSrc>1) ){
char *zName = 0;
char *zTab;
@ -722,18 +727,18 @@ static void generateColumnNames(
zTab = pTabList->a[j].zAlias;
if( fullNames || zTab==0 ) zTab = pTab->zName;
sqlite3SetString(&zName, zTab, ".", zCol, 0);
sqlite3VdbeOp3(v, OP_ColumnName, i, p2, zName, P3_DYNAMIC);
sqlite3VdbeSetColName(v, i, zName, P3_DYNAMIC);
}else{
sqlite3VdbeOp3(v, OP_ColumnName, i, p2, zCol, 0);
sqlite3VdbeSetColName(v, i, zCol, 0);
}
}else if( p->span.z && p->span.z[0] ){
int addr = sqlite3VdbeOp3(v,OP_ColumnName, i, p2, p->span.z, p->span.n);
sqlite3VdbeCompressSpace(v, addr);
sqlite3VdbeSetColName(v, i, p->span.z, p->span.n);
/* sqlite3VdbeCompressSpace(v, addr); */
}else{
char zName[30];
assert( p->op!=TK_COLUMN || pTabList==0 );
sprintf(zName, "column%d", i+1);
sqlite3VdbeOp3(v, OP_ColumnName, i, p2, zName, 0);
sqlite3VdbeSetColName(v, i, zName, 0);
}
}
}
@ -1429,7 +1434,6 @@ static int multiSelect(
assert( p->pEList );
if( eDest==SRT_Callback ){
generateColumnNames(pParse, 0, p->pEList);
generateColumnTypes(pParse, p->pSrc, p->pEList);
}
iBreak = sqlite3VdbeMakeLabel(v);
iCont = sqlite3VdbeMakeLabel(v);
@ -1500,7 +1504,6 @@ static int multiSelect(
assert( p->pEList );
if( eDest==SRT_Callback ){
generateColumnNames(pParse, 0, p->pEList);
generateColumnTypes(pParse, p->pSrc, p->pEList);
}
iBreak = sqlite3VdbeMakeLabel(v);
iCont = sqlite3VdbeMakeLabel(v);
@ -1942,9 +1945,6 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
*/
v = sqlite3GetVdbe(pParse);
if( v==0 ) return 0;
if( eDest==SRT_Callback ){
generateColumnTypes(pParse, p->pSrc, p->pEList);
}
/* If the output is destined for a temporary table, open that table.
*/
@ -2294,19 +2294,6 @@ int sqlite3Select(
*/
computeLimitRegisters(pParse, p);
/* Identify column types if we will be using a callback. This
** step is skipped if the output is going to a destination other
** than a callback.
**
** We have to do this separately from the creation of column names
** above because if the pTabList contains views then they will not
** have been resolved and we will not know the column types until
** now.
*/
if( eDest==SRT_Callback ){
generateColumnTypes(pParse, pTabList, pEList);
}
/* If the output is destined for a temporary table, open that table.
*/
if( eDest==SRT_TempTable ){

View File

@ -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.56 2004/05/26 06:58:44 danielk1977 Exp $
** $Id: test1.c,v 1.57 2004/05/26 10:11:06 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@ -742,6 +742,7 @@ static int test_finalize(
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
rc = sqlite3_finalize(pStmt);
Tcl_SetResult(interp, errorName(rc), TCL_STATIC);
if( rc ){
return TCL_ERROR;
}
@ -1405,6 +1406,66 @@ static int test_column_data16(
return TCL_OK;
}
/*
** Usage: sqlite3_column_name STMT column
**
** Advance the statement to the next row.
*/
static int test_column_name(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3_stmt *pStmt;
int col;
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetString(objv[0]), " STMT column", 0);
return TCL_ERROR;
}
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR;
Tcl_SetResult(interp, (char *)sqlite3_column_name(pStmt, col), 0);
return TCL_OK;
}
/*
** Usage: sqlite3_column_name16 STMT column
**
** Advance the statement to the next row.
*/
static int test_column_name16(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3_stmt *pStmt;
int col;
Tcl_Obj *pRet;
const void *zName16;
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetString(objv[0]), " STMT column", 0);
return TCL_ERROR;
}
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR;
zName16 = sqlite3_column_name16(pStmt, col);
pRet = Tcl_NewByteArrayObj(zName16, sqlite3utf16ByteLen(zName16, -1)+2);
Tcl_SetObjResult(interp, pRet);
return TCL_OK;
}
/*
** Usage: sqlite3_column_count STMT
**
@ -1430,6 +1491,82 @@ static int test_column_count(
return TCL_OK;
}
/*
** Usage: sqlite3_column_type STMT column
**
** Return the type of the data in column 'column' of the current row.
*/
static int test_column_type(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3_stmt *pStmt;
int col;
int tp;
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetString(objv[0]), " STMT column", 0);
return TCL_ERROR;
}
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR;
tp = sqlite3_column_type(pStmt, col);
switch( tp ){
case SQLITE3_INTEGER:
Tcl_SetResult(interp, "INTEGER", TCL_STATIC);
break;
case SQLITE3_NULL:
Tcl_SetResult(interp, "NULL", TCL_STATIC);
break;
case SQLITE3_FLOAT:
Tcl_SetResult(interp, "FLOAT", TCL_STATIC);
break;
case SQLITE3_TEXT:
Tcl_SetResult(interp, "TEXT", TCL_STATIC);
break;
case SQLITE3_BLOB:
Tcl_SetResult(interp, "BLOB", TCL_STATIC);
break;
default:
assert(0);
}
return TCL_OK;
}
/*
** Usage: sqlite3_column_int STMT column
**
** Return the data in column 'column' of the current row cast as an
** integer.
*/
static int test_column_int(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3_stmt *pStmt;
int col;
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetString(objv[0]), " STMT column", 0);
return TCL_ERROR;
}
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR;
Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_column_int(pStmt, col)));
return TCL_OK;
}
/*
** Usage: sqlite3_data_count STMT
**
@ -1551,8 +1688,12 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_reset", (Tcl_ObjCmdProc*)test_reset },
{ "sqlite3_step", (Tcl_ObjCmdProc*)test_step},
{ "sqlite3_column_data", (Tcl_ObjCmdProc*)test_column_data },
{ "sqlite3_column_data16", (Tcl_ObjCmdProc*)test_column_data16 },
{ "sqlite3_column_count", (Tcl_ObjCmdProc*)test_column_count },
{ "sqlite3_column_data16", (Tcl_ObjCmdProc*)test_column_data16 },
{ "sqlite3_column_count", (Tcl_ObjCmdProc*)test_column_count },
{ "sqlite3_column_name", (Tcl_ObjCmdProc*)test_column_name },
{ "sqlite3_column_name16", (Tcl_ObjCmdProc*)test_column_name16 },
{ "sqlite3_column_type", (Tcl_ObjCmdProc*)test_column_type },
{ "sqlite3_column_int", (Tcl_ObjCmdProc*)test_column_int },
{ "sqlite3_data_count", (Tcl_ObjCmdProc*)test_data_count },
{ "add_reverse_collating_func", (Tcl_ObjCmdProc*)reverse_collfunc },
};

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.79 2004/05/25 23:35:19 danielk1977 Exp $
** $Id: update.c,v 1.80 2004/05/26 10:11:06 danielk1977 Exp $
*/
#include "sqliteInt.h"
@ -446,9 +446,9 @@ void sqlite3Update(
** Return the number of rows that were changed.
*/
if( db->flags & SQLITE_CountRows && !pParse->trigStack ){
sqlite3VdbeOp3(v, OP_ColumnName, 0, 1, "rows updated", P3_STATIC);
sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "rows updated", P3_STATIC);
}
update_cleanup:

View File

@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.332 2004/05/26 06:18:38 danielk1977 Exp $
** $Id: vdbe.c,v 1.333 2004/05/26 10:11:06 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -762,15 +762,35 @@ double sqlite3_column_float(sqlite3_stmt *pStmt, int i){
*/
const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
Vdbe *p = (Vdbe *)pStmt;
Mem *pColName;
if( N>=sqlite3_column_count(pStmt) || N<0 ){
sqlite3Error(p->db, SQLITE_RANGE, 0);
return 0;
}
return p->azColName[N];
pColName = &(p->aColName[N]);
return sqlite3_value_data(pColName);
}
/*
** Return the name of the 'i'th column of the result set of SQL statement
** pStmt, encoded as UTF-16.
*/
const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
Vdbe *p = (Vdbe *)pStmt;
Mem *pColName;
if( N>=sqlite3_column_count(pStmt) || N<0 ){
sqlite3Error(p->db, SQLITE_RANGE, 0);
return 0;
}
pColName = &(p->aColName[N]);
return sqlite3_value_data16(pColName);
}
/*
** Return the type of the value stored in the sqlite_value* object.
*/
@ -801,7 +821,6 @@ int sqlite3_value_type(sqlite3_value* pVal){
int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
int vals;
Vdbe *p = (Vdbe *)pStmt;
int f;
vals = sqlite3_data_count(pStmt);
if( i>=vals || i<0 ){
@ -809,24 +828,7 @@ int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
return 0;
}
f = p->pTos[(1-vals)+i].flags;
if( f&MEM_Null ){
return SQLITE3_NULL;
}
if( f&MEM_Int ){
return SQLITE3_INTEGER;
}
if( f&MEM_Real ){
return SQLITE3_FLOAT;
}
if( f&MEM_Str ){
return SQLITE3_TEXT;
}
if( f&MEM_Blob ){
return SQLITE3_BLOB;
}
assert(0);
return sqlite3_value_type(&(p->pTos[(1-vals)+i]));
}
/*
@ -868,14 +870,6 @@ static const void *columnName16(sqlite3_stmt *pStmt, int i, int decltype){
return p->azColName16[i];
}
/*
** Return the name of the 'i'th column of the result set of SQL statement
** pStmt, encoded as UTF-16.
*/
const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int i){
return columnName16(pStmt, i, 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.
@ -2010,6 +2004,7 @@ case OP_Push: {
** value of the OP_ColumnName that has P2==1.
*/
case OP_ColumnName: {
assert(0);
assert( pOp->p1>=0 && pOp->p1<p->nOp );
p->azColName[pOp->p1] = pOp->p3;
p->nCallback = 0;

View File

@ -15,7 +15,7 @@
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.82 2004/05/25 23:35:20 danielk1977 Exp $
** $Id: vdbe.h,v 1.83 2004/05/26 10:11:07 danielk1977 Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
@ -121,6 +121,7 @@ void sqlite3VdbeCompressSpace(Vdbe*,int);
int sqlite3VdbeReset(Vdbe*,char **);
int sqliteVdbeSetVariables(Vdbe*,int,const char**);
void sqlite3VdbeSetNumCols(Vdbe*,int);
int sqlite3VdbeSetColName(Vdbe*, int, const char *, int);
#ifndef NDEBUG
void sqlite3VdbeComment(Vdbe*, const char*, ...);

View File

@ -327,6 +327,7 @@ struct Vdbe {
Mem *aStack; /* The operand stack, except string values */
Mem *pTos; /* Top entry in the operand stack */
Mem **apArg; /* Arguments to currently executing user function */
Mem *aColName; /* Column names to return */
char **azColName; /* Becomes the 4th parameter to callbacks */
void **azColName16; /* UTF-16 encoded equivalent of azColName */
int nCursor; /* Number of slots in apCsr[] */
@ -401,3 +402,4 @@ int sqlite3VdbeList(Vdbe*);
int sqlite3VdbeSetEncoding(Mem *, u8);
int sqlite3VdbeMemCopy(Mem*, const Mem*);
int sqlite3VdbeMemNulTerminate(Mem *);
int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, int);

View File

@ -873,9 +873,49 @@ static void Cleanup(Vdbe *p){
** be called on an SQL statement before sqlite3_step().
*/
void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
assert( 0==p->nResColumn );
p->nResColumn = nResColumn;
}
/*
** Set the name of the idx'th column to be returned by the SQL statement.
** zName must be a pointer to a nul terminated string.
**
** This call must be made after a call to sqlite3VdbeSetNumCols().
**
** Parameter N may be either P3_DYNAMIC or P3_STATIC.
*/
int sqlite3VdbeSetColName(Vdbe *p, int idx, const char *zName, int N){
int rc;
Mem *pColName;
assert( idx<p->nResColumn );
/* If the Vdbe.aColName array has not yet been allocated, allocate
** it now.
*/
if( !p->aColName ){
int i;
p->aColName = (Mem *)sqliteMalloc(sizeof(Mem)*p->nResColumn);
if( !p->aColName ){
return SQLITE_NOMEM;
}
for(i=0; i<p->nResColumn; i++){
p->aColName[i].flags = MEM_Null;
}
}
pColName = &(p->aColName[idx]);
if( N==0 ){
rc = MemSetStr(pColName, zName, -1, TEXT_Utf8, 1);
}else{
rc = MemSetStr(pColName, zName, N, TEXT_Utf8, N>0);
}
if( rc==SQLITE_OK && N==P3_DYNAMIC ){
pColName->flags = (pColName->flags&(~MEM_Static))|MEM_Dyn;
}
return rc;
}
/*
** Clean up a VDBE after execution but do not delete the VDBE just yet.
** Write any error messages into *pzErrMsg. Return the result code.

View File

@ -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.8 2004/05/26 00:07:25 danielk1977 Exp $
# $Id: bind.test,v 1.9 2004/05/26 10:11:07 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -82,7 +82,7 @@ do_test bind-1.9 {
do_test bind-1.99 {
sqlite3_finalize $VM
} {}
} SQLITE_OK
do_test bind-2.1 {
execsql {
@ -234,7 +234,7 @@ do_test bind-8.7 {
do_test bind-9.99 {
sqlite3_finalize $VM
} {}
} SQLITE_OK

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
# $Id: capi3.test,v 1.3 2004/05/21 10:08:55 danielk1977 Exp $
# $Id: capi3.test,v 1.4 2004/05/26 10:11:07 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -47,6 +47,7 @@ proc utf8 {str} {
# capi3-2.*: Test sqlite3_prepare16
# capi3-3.*: Test sqlite3_open
# capi3-4.*: Test sqlite3_open16
# capi3-5.*: Test the various sqlite3_result_* APIs
#
db close
@ -155,8 +156,130 @@ do_test capi3-4.4 {
sqlite3_close $db2
} {}
# The tests cases capi3-5.* test work as follows:
#
# capi3-5.0: Prepare a statement, and check we can retrieve the number of
# columns (before the statement is executed).
# capi3-5.1: Check we can retrieve column names (before statement execution)
# capi3-5.2: Check we can retrieve column names in UTF-16
# capi3-5.3: Step the statement.
# capi3-5.4: Check the types of the values.
# capi3-5.5: Check the values can be retrieved as integers.
# capi3-5.6: Check the values can be retrieved as UTF-8 text.
# capi3-5.7: Check the values can be retrieved as UTF-16 text.
# capi3-5.8: Check that the types of the values have not been altered by
# retrieving the values as text.
#
# Test cases capi3-5.9 - capi3-5.14 are a repeat of 3-8, with a different
# row of data.
#
do_test capi3-5.0 {
execsql {
CREATE TABLE t1(a VARINT, b BLOB, c VARCHAR(16));
INSERT INTO t1 VALUES(1, 2, 3);
INSERT INTO t1 VALUES('one', 'two', 'three');
}
set sql "SELECT * FROM t1"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_column_count $STMT
} 3
do_test capi3-5.1 {
set cnamelist [list]
foreach i {0 1 2} {lappend cnamelist [sqlite3_column_name $STMT $i]}
set cnamelist
} {a b c}
do_test capi3-5.2 {
set cnamelist [list]
foreach i {0 1 2} {lappend cnamelist [utf8 [sqlite3_column_name16 $STMT $i]]}
set cnamelist
} {a b c}
do_test capi3-5.3 {
sqlite3_step $STMT
} SQLITE_ROW
do_test capi3-5.4 {
set types [list]
foreach i {0 1 2} {lappend types [sqlite3_column_type $STMT $i]}
set types
} {INTEGER INTEGER TEXT}
do_test capi3-5.5 {
set ints [list]
foreach i {0 1 2} {lappend ints [sqlite3_column_int $STMT $i]}
set ints
} {1 2 3}
do_test capi3-5.6 {
set utf8 [list]
foreach i {0 1 2} {lappend utf8 [sqlite3_column_data $STMT $i]}
set utf8
} {1 2 3}
do_test capi3-5.7 {
set utf8 [list]
foreach i {0 1 2} {lappend utf8 [utf8 [sqlite3_column_data16 $STMT $i]]}
set utf8
} {1 2 3}
do_test capi3-5.8 {
set types [list]
foreach i {0 1 2} {lappend types [sqlite3_column_type $STMT $i]}
set types
} {INTEGER INTEGER TEXT}
do_test capi3-5.9 {
sqlite3_step $STMT
} SQLITE_ROW
do_test capi3-5.10 {
set types [list]
foreach i {0 1 2} {lappend types [sqlite3_column_type $STMT $i]}
set types
} {TEXT TEXT TEXT}
do_test capi3-5.11 {
set ints [list]
foreach i {0 1 2} {lappend ints [sqlite3_column_int $STMT $i]}
set ints
} {0 0 0}
do_test capi3-5.12 {
set utf8 [list]
foreach i {0 1 2} {lappend utf8 [sqlite3_column_data $STMT $i]}
set utf8
} {one two three}
do_test capi3-5.13 {
set utf8 [list]
foreach i {0 1 2} {lappend utf8 [utf8 [sqlite3_column_data16 $STMT $i]]}
set utf8
} {one two three}
do_test capi3-5.14 {
set types [list]
foreach i {0 1 2} {lappend types [sqlite3_column_type $STMT $i]}
set types
} {TEXT TEXT TEXT}
do_test capi3-5.15 {
sqlite3_step $STMT
} SQLITE_DONE
do_test capi3-5.99 {
sqlite3_finalize $STMT
} {SQLITE_OK}
db close
finish_test

View File

@ -13,7 +13,7 @@
# various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
# UTF-16be).
#
# $Id: enc2.test,v 1.1 2004/05/22 10:33:04 danielk1977 Exp $
# $Id: enc2.test,v 1.2 2004/05/26 10:11:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -101,7 +101,7 @@ do_test $t.8 {
do_test $t.9 {
sqlite3_finalize $STMT
} {}
} SQLITE_OK
do_test $t.99 {
db close

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the VACUUM statement.
#
# $Id: vacuum.test,v 1.17 2004/05/21 10:08:55 danielk1977 Exp $
# $Id: vacuum.test,v 1.18 2004/05/26 10:11:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -136,11 +136,11 @@ do_test vacuum-4.1 {
db close
set DB [sqlite db test.db]
set VM [sqlite3_prepare $DB {VACUUM} -1 TAIL]
sqlite_step $VM N VALUES COLNAMES
sqlite3_step $VM
} {SQLITE_DONE}
do_test vacuum-4.2 {
sqlite3_finalize $VM
} {}
} SQLITE_OK
# Ticket #515. VACUUM after deleting and recreating the table that
# a view refers to.