mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Ensure sqlite3_finalize() can be called from within the xDisconnect() method of virtual tables. (CVS 3845)
FossilOrigin-Name: 8d6c3bfc4dfdd380a2915d778e256d3e49d22d72
This commit is contained in:
23
src/build.c
23
src/build.c
@@ -22,7 +22,7 @@
|
||||
** COMMIT
|
||||
** ROLLBACK
|
||||
**
|
||||
** $Id: build.c,v 1.419 2007/04/05 11:25:58 drh Exp $
|
||||
** $Id: build.c,v 1.420 2007/04/16 15:06:25 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -478,18 +478,11 @@ static void sqliteResetColumnNames(Table *pTable){
|
||||
** foreign keys from the sqlite.aFKey hash table. But it does destroy
|
||||
** memory structures of the indices and foreign keys associated with
|
||||
** the table.
|
||||
**
|
||||
** Indices associated with the table are unlinked from the "db"
|
||||
** data structure if db!=NULL. If db==NULL, indices attached to
|
||||
** the table are deleted, but it is assumed they have already been
|
||||
** unlinked.
|
||||
*/
|
||||
void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
void sqlite3DeleteTable(Table *pTable){
|
||||
Index *pIndex, *pNext;
|
||||
FKey *pFKey, *pNextFKey;
|
||||
|
||||
db = 0;
|
||||
|
||||
if( pTable==0 ) return;
|
||||
|
||||
/* Do not delete the table until the reference count reaches zero. */
|
||||
@@ -509,7 +502,7 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
|
||||
#ifndef SQLITE_OMIT_FOREIGN_KEY
|
||||
/* Delete all foreign keys associated with this table. The keys
|
||||
** should have already been unlinked from the db->aFKey hash table
|
||||
** should have already been unlinked from the pSchema->aFKey hash table
|
||||
*/
|
||||
for(pFKey=pTable->pFKey; pFKey; pFKey=pNextFKey){
|
||||
pNextFKey = pFKey->pNextFrom;
|
||||
@@ -561,7 +554,7 @@ void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){
|
||||
}
|
||||
}
|
||||
#endif
|
||||
sqlite3DeleteTable(db, p);
|
||||
sqlite3DeleteTable(p);
|
||||
}
|
||||
db->flags |= SQLITE_InternChanges;
|
||||
}
|
||||
@@ -810,7 +803,7 @@ void sqlite3StartTable(
|
||||
pTable->iPKey = -1;
|
||||
pTable->pSchema = db->aDb[iDb].pSchema;
|
||||
pTable->nRef = 1;
|
||||
if( pParse->pNewTable ) sqlite3DeleteTable(db, pParse->pNewTable);
|
||||
if( pParse->pNewTable ) sqlite3DeleteTable(pParse->pNewTable);
|
||||
pParse->pNewTable = pTable;
|
||||
|
||||
/* If this is the magic sqlite_sequence table used by autoincrement,
|
||||
@@ -1484,7 +1477,7 @@ void sqlite3EndTable(
|
||||
p->aCol = pSelTab->aCol;
|
||||
pSelTab->nCol = 0;
|
||||
pSelTab->aCol = 0;
|
||||
sqlite3DeleteTable(0, pSelTab);
|
||||
sqlite3DeleteTable(pSelTab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1712,7 +1705,7 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
|
||||
pTable->aCol = pSelTab->aCol;
|
||||
pSelTab->nCol = 0;
|
||||
pSelTab->aCol = 0;
|
||||
sqlite3DeleteTable(0, pSelTab);
|
||||
sqlite3DeleteTable(pSelTab);
|
||||
pTable->pSchema->flags |= DB_UnresetViews;
|
||||
}else{
|
||||
pTable->nCol = 0;
|
||||
@@ -2959,7 +2952,7 @@ void sqlite3SrcListDelete(SrcList *pList){
|
||||
sqliteFree(pItem->zDatabase);
|
||||
sqliteFree(pItem->zName);
|
||||
sqliteFree(pItem->zAlias);
|
||||
sqlite3DeleteTable(0, pItem->pTab);
|
||||
sqlite3DeleteTable(pItem->pTab);
|
||||
sqlite3SelectDelete(pItem->pSelect);
|
||||
sqlite3ExprDelete(pItem->pOn);
|
||||
sqlite3IdListDelete(pItem->pUsing);
|
||||
|
||||
Reference in New Issue
Block a user