mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Add experimental sqlite_reset() API (allows pre-compiled queries) (CVS 1060)
FossilOrigin-Name: 1d2fcb017811db90e85d63f2ca76867c00ab8f1b
This commit is contained in:
28
src/vdbe.c
28
src/vdbe.c
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user