Get the App
SLTechnology News&Howtos  ›  Database  › 

SQLite compile-time authorization callback Compile-Time Aut

Shulou Source: shulou.com Published: 2022-06-01 16:15:21 09月30日 Update

Original: https://www.sqlite.org/c3ref/set_authorizer.html

Int sqlite3_set_authorizer (

Sqlite3*

Int (* xAuth) (void*,int,const char*,const char*,const char*,const char*)

Void * pUserData

);

This function registers an authorized callback function to a specified database handle, and the first parameter specifies the database handle. This callback function is called when the SQL statement is compiled by functions such as sqlite3_prepare or her variant sqlite3_prepare_v2,sqlite3_prepare16,sqlite3_prepare166_v2. If different operations are performed at different compilation points, the authorized callback function will be executed and returns whether the current operation is legal (At various points during the compilation process,as logic is beingcreated to perform various actions, the authorizer callback is invoked to seeif those actions are allowed). If the callback function returns SQLITE_OK, which means that the operation is allowed, SQLITE_IGNORE means that the specified operation is not allowed, but if compilation is allowed, SQLITE_DENY will return an error and reject the execution of the operation. If the callback function returns a value other than one of the above three types, the sqlite3_prepare_v2 function will trigger an error message (then the sqlite3_prepare_v2 () or equivalent call that triggered theauthorizer will fail with an error message.)

SQLITE_OK allows SQL to execute

SQLITE_DENY refuses SQL execution

SQLITE_IGNORE allows SQL execution, but an attempt to read a recordset returns NULL, and an attempt to write to a recordset is ignored

The first parameter of the authorized callback function will be set by the third function of sqlite3_set_authorizer. The second function is an integer opcode that specifies which operations are allowed. The third to sixth parameters are a string with a zero Terminator, and these three parameters contain what additional operational details are allowed by authorization.

Tags: Function parameter compile different three handle data database error attempt legal information original text variant character string time type detail Terminator Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Redmi NVidia Apple