]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Move the sqlite3_exec() function to legacy.c. (CVS 1455)
authordanielk1977 <danielk1977@noemail.net>
Tue, 25 May 2004 23:35:17 +0000 (23:35 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Tue, 25 May 2004 23:35:17 +0000 (23:35 +0000)
FossilOrigin-Name: 9385ad5ca82c82d9ef699102ca0b53661d02a052

15 files changed:
main.mk
manifest
manifest.uuid
src/copy.c
src/delete.c
src/insert.c
src/main.c
src/pragma.c
src/select.c
src/sqlite.h.in
src/test1.c
src/update.c
src/vdbe.c
src/vdbe.h
src/vdbeaux.c

diff --git a/main.mk b/main.mk
index b346d3f1992445bf857e9250b8c5c97e4fea3f87..00479d559633f23952d69fb3560428ed70270f3a 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -59,7 +59,7 @@ LIBOBJ = attach.o auth.o btree.o build.o copy.o date.o delete.o \
          main.o opcodes.o os_mac.o os_unix.o os_win.o \
          pager.o parse.o pragma.o printf.o random.o \
          select.o table.o tokenize.o trigger.o update.o util.o \
-         vacuum.o vdbe.o vdbeaux.o where.o tclsqlite.o utf.o
+         vacuum.o vdbe.o vdbeaux.o where.o tclsqlite.o utf.o legacy.o
 
 # All of the source code files.
 #
@@ -240,6 +240,8 @@ hash.o:     $(TOP)/src/hash.c $(HDR)
 insert.o:      $(TOP)/src/insert.c $(HDR)
        $(TCCX) -c $(TOP)/src/insert.c
 
+legacy.o:      $(TOP)/src/legacy.c $(HDR)
+       $(TCCX) -c $(TOP)/src/legacy.c
 
 main.o:        $(TOP)/src/main.c $(HDR)
        $(TCCX) -c $(TOP)/src/main.c
index f3d1734bd5bc799d6ec0584621c90c367fc58147..487c0722365a6464b7f95f9d39f5ddf811c27bbf 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Change\sa\scouple\sof\ssymbol\snames\sfor\sthe\snew\suser\sfunction\sAPI.\s(CVS\s1454)
-D 2004-05-25T12:05:57
+C Move\sthe\ssqlite3_exec()\sfunction\sto\slegacy.c.\s(CVS\s1455)
+D 2004-05-25T23:35:18
 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -16,7 +16,7 @@ F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
 F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
 F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826
-F main.mk a56ffbc29258e373614da28baa568f173d80d0d7
+F main.mk bbbe8057c8fac1ec03af0a41f2fac5390dd30386
 F publish.sh 1cd5c982388560fa91eedf6a338e210f713b35c8
 F spec.template a38492f1c1dd349fc24cb0565e08afc53045304b
 F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
@@ -27,16 +27,16 @@ F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79
 F src/btree.c 51dfa34da5f42762b228d7360cf3273ee403bce8
 F src/btree.h b65140b5ae891f30d2a39e64b9f0343225553545
 F src/build.c 35cbeb439b49cca5eb5e8a1de010a5194f4523e8
-F src/copy.c 4d2038602fd0549d80c59bda27d96f13ea9b5e29
+F src/copy.c 3c4ee52cc6ab3dea44ddfa8426c19155b2bbf242
 F src/date.c 098aee0a006d6e14dcd8f3ad21733691790c4459
-F src/delete.c 2e1dda38345416a1ea1c0a6468589a7472334dac
+F src/delete.c f4a04c0c5c67852a44768c29f408ddda8cfeeab2
 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
 F src/expr.c 5b283e68bd6df365b7c2ad10bd04cc54c2b4b07c
 F src/func.c e67a36ae28ee3495d02261f74989a7bb192658fd
 F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
 F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
-F src/insert.c e510d62d23b4de4d901e7ccbbe7833b7fb3b9570
-F src/main.c 6b308d6f181be8a07a34d79e10c527b43696c6ea
+F src/insert.c 48bb15bff280767684a0f9ee4ae5973c9504f880
+F src/main.c 843361d68f275bc9dd3494897a105b34ad80e019
 F src/md5.c 32ec4d879e9b34d6a597ae8bda684d8e395003f4
 F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67
 F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f
@@ -49,30 +49,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 e14dd3b06cedeadcc027f0b6706b2f53d456a46e
+F src/pragma.c 399feca7ce0fc364859a7ecef48795179a33b738
 F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
-F src/select.c 7d77a8bed7eeac23216d42fc1be006fb4352fcdc
+F src/select.c 867cab23c0577d4ac0510c925a85b8e032cfe139
 F src/shell.c ed4d237b3e52a0a42512bfcc53530e46de20c28f
-F src/sqlite.h.in 53469b35d64de3248438709f50c769b08e2b64b2
+F src/sqlite.h.in 87fff6c325bb946205247854320011f17a137f79
 F src/sqliteInt.h 6559811caeae0d1855e0b973e363a8c5141e566b
 F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
 F src/tclsqlite.c 0b62e8df6da5abdddf49f3d9274a8103ee61fb63
-F src/test1.c cf86941c235c307549179d9ca38a16904b977655
+F src/test1.c 81525798a9d159eab12ce9b7de5e54d9307dda4b
 F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872
 F src/test3.c 5e4a6d596f982f6f47a5f9f75ede9b4a3b739968
 F src/test4.c b9947c319a5c023c10c1e953e6610abd571c2283
 F src/test5.c 9a1f15133f6955f067c5246e564723b5f23ff221
 F src/tokenize.c e7536dd31205d5afb76c1bdc832dea009c7a3847
 F src/trigger.c 11afe9abfba13a2ba142944c797c952e162d117f
-F src/update.c 1a5e9182596f3ea8c7a141e308a3d2a7e5689fee
+F src/update.c 2b5ec85fa19020686ed2fc4a3fc43cbcefbfdfa7
 F src/utf.c 1d38da85bffb928fb0d9f301e7db913a6df486ce
 F src/util.c 4c0adcbc9ce6678dd046931253e45d623c6d279f
 F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
-F src/vdbe.c bf205ee831161cffc924c71307e24eb61b237230
-F src/vdbe.h 391d5642a83af686f35c228fcd36cb4456d68f44
+F src/vdbe.c fe75ac32889c717df2e96ae38edb7ab7fc42c48a
+F src/vdbe.h ebd59ee7a988d39c58b27149593f09a432ad1410
 F src/vdbeInt.h e500998a0ab3b10850c771c60d6b132037ff56e7
-F src/vdbeaux.c 051acd76f0afd30556288e3881f1838bc536e00c
+F src/vdbeaux.c b2527b7ce884c2c1dc102d48a07c6327f8eac3c2
 F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c
 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
 F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
@@ -202,7 +202,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 4eccae03b4a7f37804fea30416579787c3584bb2
-R 53de2c4205311190b1b667f6c790aa60
+P 8f6b20c2938ded7ab9e400494c02370ecf7e9311
+R d7e2aba31e181ad39960b2f1be066f14
 U danielk1977
-Z 585412757c2c184bef9cb8e869c28219
+Z 651dbe0e74604e5a9ec8c254d6d50b80
index 965de056ebb3fce1f87a4ee62edcc96ab198e046..3d04ac80cc89141831abfaf1c7a2796785572103 100644 (file)
@@ -1 +1 @@
-8f6b20c2938ded7ab9e400494c02370ecf7e9311
\ No newline at end of file
+9385ad5ca82c82d9ef699102ca0b53661d02a052
\ No newline at end of file
index 3bfd2b6473125fe4d88c39bc383f2685c895f98f..72bc5ac0c90aa2814995c76288431bf3b3cf4ecd 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** This file contains code used to implement the COPY command.
 **
-** $Id: copy.c,v 1.11 2004/05/10 10:34:35 danielk1977 Exp $
+** $Id: copy.c,v 1.12 2004/05/25 23:35:18 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -100,6 +100,7 @@ void sqlite3Copy(
       sqlite3VdbeAddOp(v, OP_ColumnName, 0, 1);
       sqlite3VdbeChangeP3(v, -1, "rows inserted", P3_STATIC);
       sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
+      sqlite3VdbeSetNumCols(v, 1);
     }
   }
   
index 939519a09bcf64ec63f7b03394832a9b1d8c5b8a..0922c0684aee15ac903502cf55666b9f200f1b61 100644 (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.68 2004/05/19 14:56:56 drh Exp $
+** $Id: delete.c,v 1.69 2004/05/25 23:35:18 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -306,6 +306,7 @@ void sqlite3DeleteFrom(
     sqlite3VdbeAddOp(v, OP_ColumnName, 0, 1);
     sqlite3VdbeChangeP3(v, -1, "rows deleted", P3_STATIC);
     sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
+    sqlite3VdbeSetNumCols(v, 1);
   }
 
 delete_from_cleanup:
index c122643d4df535d8b69389daf0a5b35b6d84f4b3..0091c6d0ebfdbcfc97f4494f3586cd173f9ad7f4 100644 (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.105 2004/05/20 22:16:29 drh Exp $
+** $Id: insert.c,v 1.106 2004/05/25 23:35:18 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -620,6 +620,7 @@ void sqlite3Insert(
     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);
   }
 
 insert_cleanup:
index 00880dc303a0dd0a3c1308770fb20e0c3b9ba759..d23c0982d01ccef6b22e1c69bd7ad7a67fb9ab7c 100644 (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.188 2004/05/25 12:05:57 danielk1977 Exp $
+** $Id: main.c,v 1.189 2004/05/25 23:35:18 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -482,79 +482,6 @@ void sqlite3RollbackAll(sqlite *db){
   /* sqlite3RollbackInternalChanges(db); */
 }
 
-/*
-** Execute SQL code.  Return one of the SQLITE_ success/failure
-** codes.  Also write an error message into memory obtained from
-** malloc() and make *pzErrMsg point to that message.
-**
-** If the SQL is a query, then for each row in the query result
-** the xCallback() function is called.  pArg becomes the first
-** argument to xCallback().  If xCallback=NULL then no callback
-** is invoked, even for queries.
-*/
-int sqlite3_exec(
-  sqlite *db,                 /* The database on which the SQL executes */
-  const char *zSql,           /* The SQL to be executed */
-  sqlite_callback xCallback,  /* Invoke this callback routine */
-  void *pArg,                 /* First argument to xCallback() */
-  char **pzErrMsg             /* Write error messages here */
-){
-  int rc = SQLITE_OK;
-  const char *zLeftover;
-  sqlite_vm *pVm;
-  int nRetry = 0;
-  int nChange = 0;
-  int nCallback;
-
-  if( zSql==0 ) return SQLITE_OK;
-  while( rc==SQLITE_OK && zSql[0] ){
-    pVm = 0;
-    rc = sqlite3_compile(db, zSql, &zLeftover, &pVm, pzErrMsg);
-    if( rc!=SQLITE_OK ){
-      assert( pVm==0 || sqlite3_malloc_failed );
-      return rc;
-    }
-    if( pVm==0 ){
-      /* This happens if the zSql input contained only whitespace */
-      break;
-    }
-    db->nChange += nChange;
-    nCallback = 0;
-    while(1){
-      int nArg;
-      char **azArg, **azCol;
-      rc = sqlite3_step(pVm, &nArg, (const char***)&azArg,(const char***)&azCol);
-      if( rc==SQLITE_ROW ){
-        if( xCallback!=0 && xCallback(pArg, nArg, azArg, azCol) ){
-          sqlite3_finalize(pVm, 0);
-          return SQLITE_ABORT;
-        }
-        nCallback++;
-      }else{
-        if( rc==SQLITE_DONE && nCallback==0
-          && (db->flags & SQLITE_NullCallback)!=0 && xCallback!=0 ){
-          xCallback(pArg, nArg, azArg, azCol);
-        }
-        rc = sqlite3_finalize(pVm, pzErrMsg);
-        if( rc==SQLITE_SCHEMA && nRetry<2 ){
-          nRetry++;
-          rc = SQLITE_OK;
-          break;
-        }
-        if( db->pVdbe==0 ){
-          nChange = db->nChange;
-        }
-        nRetry = 0;
-        zSql = zLeftover;
-        while( isspace(zSql[0]) ) zSql++;
-        break;
-      }
-    }
-  }
-  return rc;
-}
-
-
 /*
 ** Compile a single statement of SQL into a virtual machine.  Return one
 ** of the SQLITE_ success/failure codes.  Also write an error message into
@@ -1074,7 +1001,7 @@ int sqlite3_prepare(
 
   if( !db->init.busy ){
     if( (db->flags & SQLITE_Initialized)==0 ){
-      int rc, cnt = 1;
+      int cnt = 1;
       while( (rc = sqlite3Init(db, &zErrMsg))==SQLITE_BUSY
          && db->xBusyCallback
          && db->xBusyCallback(db->pBusyArg, "", cnt++)!=0 ){}
@@ -1132,15 +1059,16 @@ int sqlite3_prepare(
   assert( ppStmt );
   *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
   if( pzTail ) *pzTail = sParse.zTail;
+  rc = sParse.rc;
+
+  if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
+    sqlite3VdbeSetNumCols(sParse.pVdbe, 5);
+  } 
 
+prepare_out:
   if( sqlite3SafetyOff(db) ){
     rc = SQLITE_MISUSE;
-    goto prepare_out;
   }
-
-  rc = sParse.rc;
-
-prepare_out:
   if( zErrMsg ){
     sqlite3Error(db, rc, "%s", zErrMsg);
   }else{
index c13b445ec0514cb022cf1886aa68d75c9a855a1c..2e0f8103a5b1cd923fbb37960efaa651a0243956 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** This file contains code used to implement the PRAGMA command.
 **
-** $Id: pragma.c,v 1.28 2004/05/22 21:30:41 drh Exp $
+** $Id: pragma.c,v 1.29 2004/05/25 23:35:18 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -129,6 +129,7 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
       sqlite *db = pParse->db;
       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);
         sqlite3VdbeCode(v, OP_Integer, (db->flags & aPragma[i].mask)!=0, 0,
@@ -207,6 +208,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
     };
     int addr;
     if( pRight->z==pLeft->z ){
+      sqlite3VdbeSetNumCols(v, 1);
       addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
       sqlite3VdbeChangeP1(v, addr+5, MAX_PAGES);
     }else{
@@ -248,6 +250,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
       int size = db->cache_size;;
       if( size<0 ) size = -size;
       sqlite3VdbeAddOp(v, OP_Integer, size, 0);
+      sqlite3VdbeSetNumCols(v, 1);
       sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
     }else{
       int size = atoi(zRight);
@@ -293,6 +296,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
       { OP_Callback,    1, 0,        0}
     };
     if( pRight->z==pLeft->z ){
+      sqlite3VdbeSetNumCols(v, 1);
       int addr = sqlite3VdbeAddOpList(v, ArraySize(getSync), getSync);
       sqlite3VdbeChangeP2(v, addr+3, addr+10);
     }else{
@@ -336,6 +340,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
       { OP_Callback,    1, 0,        0},
     };
     if( pRight->z==pLeft->z ){
+      sqlite3VdbeSetNumCols(v, 1);
       sqlite3VdbeAddOp(v, OP_Integer, db->safety_level-1, 0);
       sqlite3VdbeAddOpList(v, ArraySize(getSync), getSync);
     }else{
@@ -376,6 +381,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
         { OP_ColumnName,  5, 1,       "pk"},
       };
       int i;
+      sqlite3VdbeSetNumCols(v, 6);
       sqlite3VdbeAddOpList(v, ArraySize(tableInfoPreface), tableInfoPreface);
       sqlite3ViewGetColumnNames(pParse, pTab);
       for(i=0; i<pTab->nCol; i++){
@@ -404,6 +410,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
       };
       int i;
       pTab = pIdx->pTable;
+      sqlite3VdbeSetNumCols(v, 3);
       sqlite3VdbeAddOpList(v, ArraySize(tableInfoPreface), tableInfoPreface);
       for(i=0; i<pIdx->nColumn; i++){
         int cnum = pIdx->aiColumn[i];
@@ -432,6 +439,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
         { OP_ColumnName,  2, 1,       "unique"},
       };
 
+      sqlite3VdbeSetNumCols(v, 3);
       sqlite3VdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
       while(pIdx){
         sqlite3VdbeAddOp(v, OP_Integer, i, 0);
@@ -462,6 +470,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
         { OP_ColumnName,  4, 1,       "to"},
       };
 
+      sqlite3VdbeSetNumCols(v, 6);
       sqlite3VdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
       while(pFK){
         int j;
@@ -488,6 +497,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
       { OP_ColumnName,  2, 1,       "file"},
     };
 
+    sqlite3VdbeSetNumCols(v, 3);
     sqlite3VdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
     for(i=0; i<db->nDb; i++){
       if( db->aDb[i].pBt==0 ) continue;
@@ -519,6 +529,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
     };
     if( pRight->z==pLeft->z ){
       sqlite3VdbeAddOp(v, OP_Integer, db->temp_store, 0);
+      sqlite3VdbeSetNumCols(v, 1);
       sqlite3VdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
     }else{
       changeTempStorage(pParse, zRight);
@@ -542,6 +553,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
       { OP_ReadCookie,  0, 5,        0},
       { OP_Callback,    1, 0,        0}};
     if( pRight->z==pLeft->z ){
+      sqlite3VdbeSetNumCols(v, 1);
       sqlite3VdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
     }else{
       sqlite3BeginWriteOperation(pParse, 0, 0);
@@ -587,6 +599,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
     };
 
     /* Initialize the VDBE program */
+    sqlite3VdbeSetNumCols(v, 1);
     sqlite3VdbeAddOpList(v, ArraySize(initCode), initCode);
 
     /* Do an integrity check on each database file */
index 1db17c8a9db16acec782ea098dba8d95c0483a69..f9bd39fe1689ebb2182497cf63158ec76031b2d3 100644 (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.174 2004/05/21 03:01:59 drh Exp $
+** $Id: select.c,v 1.175 2004/05/25 23:35:19 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -687,6 +687,7 @@ static void generateColumnNames(
   pParse->colNamesSet = 1;
   fullNames = (db->flags & SQLITE_FullColNames)!=0;
   shortNames = (db->flags & SQLITE_ShortColNames)!=0;
+  sqlite3VdbeSetNumCols(v, pEList->nExpr);
   for(i=0; i<pEList->nExpr; i++){
     Expr *p;
     int p2 = i==pEList->nExpr-1;
index 978da19e7a33567c33bc2c191b011e9e9ee47726..3127a63756ddc565b455d745df067192d92ca0fd 100644 (file)
@@ -12,7 +12,7 @@
 ** This header file defines the interface that the SQLite library
 ** presents to client programs.
 **
-** @(#) $Id: sqlite.h.in,v 1.76 2004/05/25 12:05:57 danielk1977 Exp $
+** @(#) $Id: sqlite.h.in,v 1.77 2004/05/25 23:35:19 danielk1977 Exp $
 */
 #ifndef _SQLITE_H_
 #define _SQLITE_H_
@@ -1059,7 +1059,7 @@ const void *sqlite3_column_name16(sqlite3_stmt*,int);
 ** column, then a NULL pointer is returned. The returned string is always
 ** UTF-8 encoded. For example, in the database schema:
 **
-** CREATE TABLE t1(c1 VARINT);
+** CREATE TABLE t1(c1 VARIANT);
 **
 ** And the following statement compiled:
 **
index 23646f9b3d913231bbd63d9777dafa8054399bd8..af783efa5c3b9ec890ebcc6bcfd560a8878f39ab 100644 (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.51 2004/05/25 12:05:57 danielk1977 Exp $
+** $Id: test1.c,v 1.52 2004/05/25 23:35:19 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -764,6 +764,7 @@ static int sqlite_datatypes(
 ** Step a virtual machine.  Return a the result code as a string.
 ** Column results are written into three variables.
 */
+#if 0
 static int test_step(
   void *NotUsed,
   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
@@ -817,6 +818,7 @@ static int test_step(
   Tcl_AppendResult(interp, zRc, 0);
   return TCL_OK;
 }
+#endif
 
 /*
 ** Usage:  sqlite3_finalize  STMT 
@@ -1562,7 +1564,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
      { "sqlite3_mprintf_double",        (Tcl_CmdProc*)sqlite3_mprintf_double },
      { "sqlite3_mprintf_scaled",        (Tcl_CmdProc*)sqlite3_mprintf_scaled },
      { "sqlite3_mprintf_z_test",        (Tcl_CmdProc*)test_mprintf_z        },
-//     { "sqlite3_open",                  (Tcl_CmdProc*)sqlite_test_open      },
      { "sqlite3_last_insert_rowid",     (Tcl_CmdProc*)test_last_rowid       },
      { "sqlite3_exec_printf",           (Tcl_CmdProc*)test_exec_printf      },
      { "sqlite3_get_table_printf",      (Tcl_CmdProc*)test_get_table_printf },
@@ -1576,10 +1577,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
      { "sqlite_malloc_fail",            (Tcl_CmdProc*)sqlite_malloc_fail    },
      { "sqlite_malloc_stat",            (Tcl_CmdProc*)sqlite_malloc_stat    },
 #endif
-     { "sqlite_step",                    (Tcl_CmdProc*)test_step             },
-// { "sqlite_finalize",                (Tcl_CmdProc*)test_finalize         },
+/*{ "sqlite_step",                    (Tcl_CmdProc*)test_step * },*/
      { "sqlite_bind",                    (Tcl_CmdProc*)test_bind             },
-// { "sqlite_reset",                   (Tcl_CmdProc*)test_reset            },
      { "breakpoint",                     (Tcl_CmdProc*)test_breakpoint       },
   };
   static struct {
index 449f396cb06a9b1382020ed51b4746718766ead8..8f3c8edb39f130b0529dee31c9754a26d55d790d 100644 (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.78 2004/05/20 22:16:30 drh Exp $
+** $Id: update.c,v 1.79 2004/05/25 23:35:19 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -448,6 +448,7 @@ void sqlite3Update(
   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);
   }
 
 update_cleanup:
index aa4645bc89e1081ec8ed72733ae3ff8323b04d45..af9189ddb414c332448f8458ce1f4f4ca9b6a562 100644 (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.328 2004/05/25 11:47:26 danielk1977 Exp $
+** $Id: vdbe.c,v 1.329 2004/05/25 23:35:19 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -527,6 +527,7 @@ static void hardRealify(Mem *pStack, u8 enc){
 ** SQLITE_DONE.  Or it could be the case the the same database connection
 ** is being used simulataneously by two or more threads.
 */
+#if 0
 int sqlite3_step(
   sqlite_vm *pVm,              /* The virtual machine to execute */
   int *pN,                     /* OUT: Number of columns in result */
@@ -568,6 +569,7 @@ int sqlite3_step(
 
   return rc;
 }
+#endif 
 
 /*
 ** Execute the statement pStmt, either until a row of data is ready, the
@@ -2090,7 +2092,8 @@ case OP_ColumnName: {
   assert( pOp->p1>=0 && pOp->p1<p->nOp );
   p->azColName[pOp->p1] = pOp->p3;
   p->nCallback = 0;
-  if( pOp->p2 ) p->nResColumn = pOp->p1+1;
+  assert( !pOp->p2 || p->nResColumn==(pOp->p1+1) );
+  /* if( pOp->p2 ) p->nResColumn = pOp->p1+1; */
   break;
 }
 
@@ -2347,7 +2350,7 @@ divide_by_zero:
 case OP_Function: {
   int i;
   Mem *pArg;
-  sqlite_func ctx;
+  sqlite3_context ctx;
   sqlite3_value **apVal;
   int n = pOp->p1;
 
@@ -5693,7 +5696,7 @@ case OP_AggFunc: {
   int n = pOp->p2;
   int i;
   Mem *pMem, *pRec;
-  sqlite_func ctx;
+  sqlite3_context ctx;
   sqlite3_value **apVal;
 
   assert( n>=0 );
@@ -5840,7 +5843,7 @@ case OP_AggNext: {
     pc = pOp->p2 - 1;
   } else {
     int i;
-    sqlite_func ctx;
+    sqlite3_context ctx;
     Mem *aMem;
     p->agg.pCurrent = sqliteHashData(p->agg.pSearch);
     aMem = p->agg.pCurrent->aMem;
index b270b104998c1e07f92ca5de82ef4fc6edb0619c..130aaff0a028f620d10777eb17f554eae02d5d2b 100644 (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.81 2004/05/21 10:08:55 danielk1977 Exp $
+** $Id: vdbe.h,v 1.82 2004/05/25 23:35:20 danielk1977 Exp $
 */
 #ifndef _SQLITE_VDBE_H_
 #define _SQLITE_VDBE_H_
@@ -120,6 +120,7 @@ void sqlite3VdbeTrace(Vdbe*,FILE*);
 void sqlite3VdbeCompressSpace(Vdbe*,int);
 int sqlite3VdbeReset(Vdbe*,char **);
 int sqliteVdbeSetVariables(Vdbe*,int,const char**);
+void sqlite3VdbeSetNumCols(Vdbe*,int);
 
 #ifndef NDEBUG
   void sqlite3VdbeComment(Vdbe*, const char*, ...);
index 5da2b95cb3cb31c7372e04822938987db13340c9..402820c84ddd205314349f58aa96a824fbb75f56 100644 (file)
@@ -866,6 +866,16 @@ static void Cleanup(Vdbe *p){
   p->zErrMsg = 0;
 }
 
+/*
+** Set the number of result columns that will be returned by this SQL
+** statement. This is now set at compile time, rather than during
+** execution of the vdbe program so that sqlite3_column_count() can
+** be called on an SQL statement before sqlite3_step().
+*/
+void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
+  p->nResColumn = nResColumn;
+}
+
 /*
 ** Clean up a VDBE after execution but do not delete the VDBE just yet.
 ** Write any error messages into *pzErrMsg.  Return the result code.