Pdo\Sqlite::setAuthorizerConfigures a callback to be used as an authorizer to limit what a statement can do Description
public void Pdo\Sqlite::setAuthorizer(callablenull
$callback)Sets a callback that will be called by SQLite every time an action is performed (reading, deleting, updating, etc.). This is used when preparing an SQL statement from an untrusted source to ensure that the statement does not access data it is not allowed to see or execute malicious statements that damage the database.
The authorizer is used only during the statement preparation phase.
It may be called several times for a single statement: a
The authorizer is called with up to five arguments. The arguments received are described at SQLite3::setAuthorizer.
Only a single authorizer can be in place on a database connection at a time.
Each call to this method overrides the previous one. The authorizer is disabled
by default, and can be disabled again by setting a The callback must not modify the database connection that invoked it. More details can be found in the » SQLite documentation.
Parameters
Return ValuesNo value is returned. Errors/Exceptions
This method itself does not throw, but if the authorizer callback does not return
an int, or returns an int which is not one of
ExamplesExample #1 Pdo\Sqlite::setAuthorizer example Only read actions are allowed on the connection. The action codes are exposed as SQLite3 class constants, which requires the SQLite3 extension to be available; their integer values may be used directly otherwise. The above example will output something similar to: bool(true) SQLSTATE[HY000]: General error: 23 not authorized See Also
|