Name

sqlite3_set_authorizer() — Register an authorization callback

Definition

int sqlite3_set_authorizer( sqlite3* db, auth_callback, void* udp );

int auth_callback( void* udp, int action_code,
                     const char* param1,  const char* param2,
                     const char* db_name, const char* trigger_name );
db

A database connection.

auth_callback

An application-defined authorization callback function.

udp

An application-defined user-data pointer. This value is made available to the authorization callback.

action_code

A code indicating which database operation requires authorization.

param1, param2

Two data values related to the authorization action. The specific meaning of these parameters depends on the value of the action_code parameter.

db_name

The logical name of the database being affected by the action in question. This value is valid for many, but not all, action_code values.

trigger_name

If the action in question comes from a trigger, the name of the lowest-level trigger. If the action comes from a bare SQL statement, this parameter will be NULL.

Returns (sqlite3_set_authorizer())

An SQLite result code.

Returns (auth_func())

An SQLite result code. The code SQLITE_OK indicates that the action is allowed. The code SQLITE_IGNORE denies the specific action, but allows the SQL statement to continue. The code SQLITE_DENY causes the whole SQL statement to be rejected.

Description

This function registers an authorization callback. The callback is called when SQL statements are prepared, allowing the application to ...

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.