1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add the sqlite3_next_stmt() interface, including test cases. (CVS 5243)

FossilOrigin-Name: 565a530896b40790287eeaad709edd51980fbddf
This commit is contained in:
drh
2008-06-19 02:52:25 +00:00
parent 8c4d6b97e0
commit bb5a9c3eea
6 changed files with 189 additions and 12 deletions

View File

@@ -13,7 +13,7 @@
** This file contains code use to implement APIs that are part of the
** VDBE.
**
** $Id: vdbeapi.c,v 1.133 2008/06/18 17:09:10 danielk1977 Exp $
** $Id: vdbeapi.c,v 1.134 2008/06/19 02:52:25 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -1256,3 +1256,21 @@ int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){
return pStmt ? ((Vdbe*)pStmt)->db : 0;
}
/*
** Return a pointer to the next prepared statement after pStmt associated
** with database connection pDb. If pStmt is NULL, return the first
** prepared statement for the database connection. Return NULL if there
** are no more.
*/
sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
sqlite3_stmt *pNext;
sqlite3_mutex_enter(pDb->mutex);
if( pStmt==0 ){
pNext = (sqlite3_stmt*)pDb->pVdbe;
}else{
pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;
}
sqlite3_mutex_leave(pDb->mutex);
return pNext;
}