mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Fix for bug #15: Add the sqlite_changes() API function for retrieving the
number of rows that changed in the previous operation. (CVS 526) FossilOrigin-Name: 6e71493b9dc77d508c3ce90562766789e87e6d80
This commit is contained in:
12
src/main.c
12
src/main.c
@@ -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.68 2002/03/06 22:01:36 drh Exp $
|
||||
** $Id: main.c,v 1.69 2002/04/12 10:08:59 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -421,6 +421,13 @@ int sqlite_last_insert_rowid(sqlite *db){
|
||||
return db->lastRowid;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the number of changes in the most recent call to sqlite_exec().
|
||||
*/
|
||||
int sqlite_changes(sqlite *db){
|
||||
return db->nChange;
|
||||
}
|
||||
|
||||
/*
|
||||
** Close an existing SQLite database
|
||||
*/
|
||||
@@ -526,6 +533,8 @@ int sqlite_exec(
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
if( db->recursionDepth==0 ){ db->nChange = 0; }
|
||||
db->recursionDepth++;
|
||||
memset(&sParse, 0, sizeof(sParse));
|
||||
sParse.db = db;
|
||||
sParse.pBe = db->pBe;
|
||||
@@ -544,6 +553,7 @@ int sqlite_exec(
|
||||
if( sParse.rc==SQLITE_SCHEMA ){
|
||||
clearHashTable(db, 1);
|
||||
}
|
||||
db->recursionDepth--;
|
||||
return sParse.rc;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user