]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add experimental sqlite_reset() API (allows pre-compiled queries) (CVS 1060)
authordanielk1977 <danielk1977@noemail.net>
Tue, 22 Jul 2003 09:24:43 +0000 (09:24 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Tue, 22 Jul 2003 09:24:43 +0000 (09:24 +0000)
FossilOrigin-Name: 1d2fcb017811db90e85d63f2ca76867c00ab8f1b

manifest
manifest.uuid
src/main.c
src/sqlite.h.in
src/vdbe.c
src/vdbe.h

index 50ec63417a41e3593acb47b7cd52a4657afc1c64..46f72a98e33d0093ff1a4ae50bb9f80204a1de36 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\ssure\stemporary\sfile\snames\sin\swindows\shave\sa\sfull\s15\scharacters\sof\nrandom\stext\sat\sthe\send.\s(CVS\s1059)
-D 2003-07-22T00:39:14
+C Add\sexperimental\ssqlite_reset()\sAPI\s(allows\spre-compiled\squeries)\s(CVS\s1060)
+D 2003-07-22T09:24:44
 F Makefile.in 9ad23ed4ca97f9670c4496432e3fbd4b3760ebde
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -33,7 +33,7 @@ F src/func.c 6b23578d48a8be98a664db145a635c2fa9ddb57b
 F src/hash.c 058f077c1f36f266581aa16f907a3903abf64aa3
 F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
 F src/insert.c fc4c26a0bb505fb802babfb9a7b7a1d4be2e3061
-F src/main.c 8053b3a76e4e77c769b324a2f1cc99a0265d0ec4
+F src/main.c ce96c3c09f15104247f0367159a80937d4222d00
 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
 F src/os.c 2f24ede4d3464ac38d24d113e0d44d3c7d460be4
 F src/os.h 9e5bbddff123187295e3d00d49af06192cd1cd49
@@ -46,7 +46,7 @@ F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
 F src/select.c 2fa83d6c972d3e3f379faee32e3621411490dedb
 F src/shell.c c2ba26c850874964f5ec1ebf6c43406f28e44c4a
 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
-F src/sqlite.h.in 54619fa5df4c83b22def66bb3d24808fd03dcbae
+F src/sqlite.h.in dafa83571810b6932f089b589c783355ef7a54b5
 F src/sqliteInt.h e3c756e5aa7bcbf7fbcd20e6aef640c9359c23f2
 F src/table.c 4301926464d88d2c2c7cd21c3360aa75bf068b95
 F src/tclsqlite.c d6860dcd56348b9521726280b72c412d2a33ae97
@@ -59,8 +59,8 @@ F src/trigger.c 6ff205aaac4869e402d9902e528e1d22a85de14c
 F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
 F src/util.c 566c7780170dd11fb1ad5de3ba81f0dfea7cccf0
 F src/vacuum.c 0820984615786c9ccdaad8032a792309b354a8eb
-F src/vdbe.c 7bef599539f72d5b5ae62723a7d52aefe9bfb2f0
-F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21
+F src/vdbe.c b5feda6d6fd818dc4541323b0f61bf03e1c89b91
+F src/vdbe.h d853ed6cc4727fa9e8ace6187c55afcf817041dd
 F src/where.c 83b2a2d26d5c3bea33457a83e541bb1dcf7b1248
 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
 F test/attach.test c26848402e7ac829e043e1fa5e0eb87032e5d81d
@@ -168,7 +168,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
 F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P 543479e3aed77976a0c689cf40811bf88353f706
-R 4b5c7a99f11b5b97ce8b005695a09544
-U drh
-Z 3eaafec342ab59e94ea1fdb3d5b75ad3
+P 6ccb92b14f2e6e01bb60dac10331fa7be0b4525e
+R 804ca90e7b76ecef82e1c1554a328a4e
+U danielk1977
+Z 5f47bcd4ce11d578c0e1428e96d9a20d
index 5ddf319a38f7f1b5ee47e796633600a67daca029..2f74612a7b5e50c70f5867b08f26bb49c4ec808f 100644 (file)
@@ -1 +1 @@
-6ccb92b14f2e6e01bb60dac10331fa7be0b4525e
\ No newline at end of file
+1d2fcb017811db90e85d63f2ca76867c00ab8f1b
\ No newline at end of file
index 6779ba2c7910b68010a78bdee2e8370233b7df11..e96b524428397a94acba898d6890eb609157d9ae 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.138 2003/07/09 00:28:14 drh Exp $
+** $Id: main.c,v 1.139 2003/07/22 09:24:45 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -714,6 +714,21 @@ int sqlite_finalize(
   return rc;
 }
 
+/*
+** Destroy a virtual machine in the same manner as sqlite_finalize(). If 
+** possible, leave *ppVm pointing at a new virtual machine which may be
+** used to re-execute the query.
+*/
+int sqlite_reset(
+  sqlite_vm *pVm,            /* The virtual machine to be destroyed */
+  char **pzErrMsg,           /* OUT: Write error messages here */
+  sqlite_vm **ppVm           /* OUT: The new virtual machine */
+){
+  int rc = sqliteVdbeReset((Vdbe*)pVm, pzErrMsg, (Vdbe **)ppVm);
+  sqliteStrRealloc(pzErrMsg);
+  return rc;
+}
+
 /*
 ** Return a static string that describes the kind of error specified in the
 ** argument.
index 02c233a6aa6ce2b10dd6db94e4f6a2d2deb3a4dc..2980f817e7fb92570a62c1b119ec64c39576b32b 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.49 2003/06/06 19:00:42 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.50 2003/07/22 09:24:44 danielk1977 Exp $
 */
 #ifndef _SQLITE_H_
 #define _SQLITE_H_
@@ -684,6 +684,21 @@ int sqlite_step(
 */
 int sqlite_finalize(sqlite_vm*, char **pzErrMsg);
 
+/*
+** This routine deletes the virtual machine, writes any error message to
+** *pzErrMsg and returns an SQLite return code in the same way as the
+** sqlite_finalize() function.
+**
+** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual
+** machine loaded with the compiled version of the original query ready for
+** execution.
+**
+** If sqlite_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.
+**
+******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
+*/
+int sqlite_reset(sqlite_vm *, char **pzErrMsg, sqlite_vm **ppVm);
+
 #ifdef __cplusplus
 }  /* End of the 'extern "C"' block */
 #endif
index 0183e127e91da3a016e95f23c67f0deee1bcad20..4c230d0190bd6ab872b54e62ae6e9a82e60ee583 100644 (file)
@@ -36,7 +36,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.233 2003/07/09 00:28:15 drh Exp $
+** $Id: vdbe.c,v 1.234 2003/07/22 09:24:45 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -5901,3 +5901,29 @@ int sqliteVdbeFinalize(Vdbe *p, char **pzErrMsg){
   }
   return rc;
 }
+
+/*
+** Create a new Vdbe in *pOut and populate it with the program from p. Then
+** pass p to sqliteVdbeFinalize().
+*/
+int sqliteVdbeReset(Vdbe *p, char ** pErrMsg, Vdbe** pOut)
+{
+  if( pOut && p->rc != SQLITE_SCHEMA ){
+
+    /* Create a new VDBE and populate it with the program used by the old
+    ** VDBE. Don't copy the last instruction of the program, as this is an 
+    ** OP_Halt coded by sqliteVdbeMakeReady(). 
+    */
+    *pOut = sqliteVdbeCreate( p->db );
+    (*pOut)->aOp = p->aOp;
+    (*pOut)->nOp = p->nOp-1;
+    (*pOut)->nOpAlloc = p->nOpAlloc;
+    sqliteVdbeMakeReady( *pOut, p->xCallback, p->pCbArg, (int)p->explain );
+    p->aOp = 0;
+    p->nOp = 0;
+    p->nOpAlloc = 0;
+  }else if( pOut ){
+    *pOut = NULL;
+  }
+  return sqliteVdbeFinalize(p, pErrMsg);
+}
index 3cdbd7e75309ebb3e4162bc49a96ca7935b8b0c0..9d77ac5695274c12c6397387d122fa89373714bc 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.65 2003/04/03 01:50:47 drh Exp $
+** $Id: vdbe.h,v 1.66 2003/07/22 09:24:44 danielk1977 Exp $
 */
 #ifndef _SQLITE_VDBE_H_
 #define _SQLITE_VDBE_H_
@@ -92,5 +92,6 @@ void sqliteVdbeResolveLabel(Vdbe*, int);
 int sqliteVdbeCurrentAddr(Vdbe*);
 void sqliteVdbeTrace(Vdbe*,FILE*);
 void sqliteVdbeCompressSpace(Vdbe*,int);
+int sqliteVdbeReset(Vdbe*,char **,Vdbe**);
 
 #endif