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

Invoke the authorization callback when compiling SAVEPOINT, ROLLBACK TO and RELEASE commands. (CVS 6074)

FossilOrigin-Name: e49807b16f7f86d3f2290d6c1f7562f3db6330f9
This commit is contained in:
danielk1977
2008-12-30 06:24:58 +00:00
parent 954701a054
commit ab9b703fde
6 changed files with 89 additions and 25 deletions

View File

@@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.510 2008/12/23 11:11:51 danielk1977 Exp $
** $Id: build.c,v 1.511 2008/12/30 06:24:58 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -3316,15 +3316,18 @@ void sqlite3RollbackTransaction(Parse *pParse){
** release or rollback an SQL savepoint.
*/
void sqlite3Savepoint(Parse *pParse, int op, Token *pName){
Vdbe *v;
if( pParse->nErr || pParse->db->mallocFailed ) return;
/* TODO: Invoke the authorization callback */
v = sqlite3GetVdbe(pParse);
if( v ){
const char *zName = (const char *)pName->z;
sqlite3VdbeAddOp4(v, OP_Savepoint, op, 0, 0, zName, pName->n);
char *zName = sqlite3NameFromToken(pParse->db, pName);
if( zName ){
Vdbe *v = sqlite3GetVdbe(pParse);
#ifndef SQLITE_OMIT_AUTHORIZATION
static const char *az[] = { "BEGIN", "RELEASE", "ROLLBACK" };
assert( !SAVEPOINT_BEGIN && SAVEPOINT_RELEASE==1 && SAVEPOINT_ROLLBACK==2 );
#endif
if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){
sqlite3DbFree(pParse->db, zName);
return;
}
sqlite3VdbeAddOp4(v, OP_Savepoint, op, 0, 0, zName, P4_DYNAMIC);
}
}