mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-02 05:54:29 +03:00
Merge 3.12.0 beta changes from trunk.
FossilOrigin-Name: 3296a0ceedef43c2790f0b36471f91138a575243
This commit is contained in:
@@ -392,6 +392,13 @@ void sqlite3VdbeRunOnlyOnce(Vdbe *p){
|
||||
p->runOnlyOnce = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** Mark the VDBE as one that can only be run multiple times.
|
||||
*/
|
||||
void sqlite3VdbeReusable(Vdbe *p){
|
||||
p->runOnlyOnce = 0;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */
|
||||
|
||||
/*
|
||||
@@ -1795,7 +1802,7 @@ void sqlite3VdbeRewind(Vdbe *p){
|
||||
p->magic = VDBE_MAGIC_RUN;
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
for(i=1; i<p->nMem; i++){
|
||||
for(i=0; i<p->nMem; i++){
|
||||
assert( p->aMem[i].db==p->db );
|
||||
}
|
||||
#endif
|
||||
@@ -1860,16 +1867,13 @@ void sqlite3VdbeMakeReady(
|
||||
nOnce = pParse->nOnce;
|
||||
if( nOnce==0 ) nOnce = 1; /* Ensure at least one byte in p->aOnceFlag[] */
|
||||
|
||||
/* For each cursor required, also allocate a memory cell. Memory
|
||||
** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by
|
||||
** the vdbe program. Instead they are used to allocate memory for
|
||||
** VdbeCursor/BtCursor structures. The blob of memory associated with
|
||||
** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1)
|
||||
** stores the blob of memory associated with cursor 1, etc.
|
||||
**
|
||||
/* Each cursor uses a memory cell. The first cursor (cursor 0) can
|
||||
** use aMem[0] which is not otherwise used by the VDBE program. Allocate
|
||||
** space at the end of aMem[] for cursors 1 and greater.
|
||||
** See also: allocateCursor().
|
||||
*/
|
||||
nMem += nCursor;
|
||||
if( nCursor==0 && nMem>0 ) nMem++; /* Space for aMem[0] even if not used */
|
||||
|
||||
/* Figure out how much reusable memory is available at the end of the
|
||||
** opcode array. This extra memory will be reallocated for other elements
|
||||
@@ -1931,9 +1935,8 @@ void sqlite3VdbeMakeReady(
|
||||
pParse->nzVar = 0;
|
||||
pParse->azVar = 0;
|
||||
if( p->aMem ){
|
||||
p->aMem--; /* aMem[] goes from 1..nMem */
|
||||
p->nMem = nMem; /* not from 0..nMem-1 */
|
||||
for(n=1; n<=nMem; n++){
|
||||
p->nMem = nMem;
|
||||
for(n=0; n<nMem; n++){
|
||||
p->aMem[n].flags = MEM_Undefined;
|
||||
p->aMem[n].db = db;
|
||||
}
|
||||
@@ -2043,7 +2046,7 @@ static void closeAllCursors(Vdbe *p){
|
||||
assert( p->nFrame==0 );
|
||||
closeCursorsInFrame(p);
|
||||
if( p->aMem ){
|
||||
releaseMemArray(&p->aMem[1], p->nMem);
|
||||
releaseMemArray(p->aMem, p->nMem);
|
||||
}
|
||||
while( p->pDelFrame ){
|
||||
VdbeFrame *pDel = p->pDelFrame;
|
||||
@@ -2068,7 +2071,7 @@ static void Cleanup(Vdbe *p){
|
||||
int i;
|
||||
if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );
|
||||
if( p->aMem ){
|
||||
for(i=1; i<=p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
|
||||
for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user