该文章主要与注册授权回调函数相关:sqlite3_set_authorizer

详细的调用方式,请参考其他的章节!!

摘自:https://www.sqlite.org/c3ref/c_alter_table.html

/*******************************************3rd ************ 4th ***********/

#define SQLITE_CREATE_INDEX          1  /* Index Name      Table Name      */

#define SQLITE_CREATE_TABLE          2  /* Table Name      NULL            */

#define SQLITE_CREATE_TEMP_INDEX     3  /* Index Name      Table Name      */

#define SQLITE_CREATE_TEMP_TABLE     4  /* Table Name      NULL            */

#define SQLITE_CREATE_TEMP_TRIGGER   5   /*Trigger Name    Table Name      */

#define SQLITE_CREATE_TEMP_VIEW      6  /* View Name       NULL            */

#define SQLITE_CREATE_TRIGGER        7  /* Trigger Name    Table Name      */

#define SQLITE_CREATE_VIEW           8  /* View Name       NULL            */

#define SQLITE_DELETE                9   /* Table Name      NULL            */

#define SQLITE_DROP_INDEX           10  /* Index Name      Table Name      */

#define SQLITE_DROP_TABLE           11  /* Table Name      NULL            */

#define SQLITE_DROP_TEMP_INDEX      12  /* Index Name      Table Name      */

#define SQLITE_DROP_TEMP_TABLE      13  /* Table Name      NULL            */

#define SQLITE_DROP_TEMP_TRIGGER    14  /* Trigger Name    Table Name      */

#define SQLITE_DROP_TEMP_VIEW       15  /* View Name       NULL            */

#define SQLITE_DROP_TRIGGER         16  /* Trigger Name    Table Name      */

#define SQLITE_DROP_VIEW            17  /* View Name       NULL            */

#define SQLITE_INSERT               18   /* Table Name      NULL            */

#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */

#define SQLITE_READ                 20   /* Table Name      Column Name     */

#define SQLITE_SELECT               21   /* NULL            NULL            */

#define SQLITE_TRANSACTION          22  /* Operation       NULL            */

#define SQLITE_UPDATE               23   /* Table Name      Column Name     */

#define SQLITE_ATTACH               24   /* Filename        NULL            */

#define SQLITE_DETACH               25   /* Database Name   NULL            */

#define SQLITE_ALTER_TABLE          26  /* Database Name   Table Name      */

#define SQLITE_REINDEX              27   /* Index Name      NULL            */

#define SQLITE_ANALYZE              28   /* Table Name      NULL            */

#define SQLITE_CREATE_VTABLE        29  /* Table Name      ModuleName     */

#define SQLITE_DROP_VTABLE          30  /* Table Name      ModuleName     */

#define SQLITE_FUNCTION             31   /* NULL            Function Name   */

#define SQLITE_SAVEPOINT            32  /* Operation       SavepointName  */

#define SQLITE_COPY                  0   /* No longer used */

#define SQLITE_RECURSIVE            33  /* NULL            NULL            */

sqlite3_set_authorizer接口注册一个回调函数,该回调函数将被调用去授权执行SQL语句。回调函数的第二个参数是一个整型,指定了那些操作是被授权的,这些整型的动作编码(integer action codes)是回调函数可以通过的。

这些动作编号值指定了哪种操作是被允许的。第三和第四个参数是否为NULL,还是其他的参数,完全依赖于第二个参数的设置,第五个参数是数据库的名称(main,temp,或者其他)if applicable.第六个参数尝试访问的内置触发器或者视图,当然如果为NULL,表示尝试访问来自于最高级的SQL编码(The 6th parameter to the authorizer callback is the nameof the inner-most trigger or view that is responsible for the access attempt orNULL if this access attempt is directly from top-level SQL code.