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

Initial check-in of the code for the new sqlite_set_authorizer() API function.

The code is mostly untested at this point. (CVS 827)

FossilOrigin-Name: 52d5007f64d0af5286b2a0e1f0b9e53c86bece3f
This commit is contained in:
drh
2003-01-12 18:02:16 +00:00
parent 49f0936ec7
commit ed6c8671b3
17 changed files with 277 additions and 40 deletions

View File

@@ -50,6 +50,8 @@ void sqliteCreateTrigger(
Trigger *nt;
Table *tab;
if( sqliteAuthCommand(pParse, "CREATE", "TRIGGER") ) goto trigger_cleanup;
/* Check that:
** 1. the trigger name does not already exist.
** 2. the table (or view) does exist.
@@ -102,6 +104,9 @@ void sqliteCreateTrigger(
" trigger on table: ", -1, pTableName->z, pTableName->n, 0);
goto trigger_cleanup;
}
if( sqliteAuthInsert(pParse, SCHEMA_TABLE(tab->isTemp), 1) ){
goto trigger_cleanup;
}
}
if (tr_tm == TK_INSTEAD){
@@ -337,6 +342,7 @@ void sqliteDropTrigger(Parse *pParse, Token *pName, int nested){
Table *pTable;
Vdbe *v;
if( sqliteAuthCommand(pParse, "DROP", "TRIGGER") ) return;
zName = sqliteStrNDup(pName->z, pName->n);
/* ensure that the trigger being dropped exists */
@@ -347,13 +353,18 @@ void sqliteDropTrigger(Parse *pParse, Token *pName, int nested){
sqliteFree(zName);
return;
}
pTable = sqliteFindTable(pParse->db, pTrigger->table);
assert(pTable);
if( sqliteAuthDelete(pParse, SCHEMA_TABLE(pTable->isTemp), 1) ){
sqliteFree(zName);
return;
}
/*
* If this is not an "explain", then delete the trigger structure.
*/
if( !pParse->explain ){
pTable = sqliteFindTable(pParse->db, pTrigger->table);
assert(pTable);
if( pTable->pTrigger == pTrigger ){
pTable->pTrigger = pTrigger->pNext;
}else{