DBD-SQLcipher
view release on metacpan or search on metacpan
$code_ref->($action_code, $database, $table, $rowid)
where
$action_code
is an integer equal to either "DBD::SQLcipher::INSERT",
"DBD::SQLcipher::DELETE" or "DBD::SQLcipher::UPDATE" (see "Action Codes");
$database
is the name of the database containing the affected row;
$table
is the name of the table containing the affected row;
$rowid
is the unique 64-bit signed integer key of the affected row within
that table.
$dbh->sqlite_set_authorizer( $code_ref )
This method registers an authorizer callback to be invoked whenever SQL
statements are being compiled by the "prepare" in DBI method. The
authorizer callback should return "DBD::SQLcipher::OK" to allow the action,
"DBD::SQLcipher::IGNORE" to disallow the specific action but allow the SQL
statement to continue to be compiled, or "DBD::SQLcipher::DENY" to cause
the entire SQL statement to be rejected with an error. If the authorizer
callback returns any other value, then then "prepare" call that
triggered the authorizer will fail with an error message.
An authorizer is used when preparing SQL statements from an untrusted
source, to ensure that the SQL statements do not try to access data they
are not allowed to see, or that they do not try to execute malicious
statements that damage the database. For example, an application may
allow a user to enter arbitrary SQL queries for evaluation by a
database. But the application does not want the user to be able to make
arbitrary changes to the database. An authorizer could then be put in
place while the user-entered SQL is being prepared that disallows
everything except SELECT statements.
The callback will be called as
$code_ref->($action_code, $string1, $string2, $database, $trigger_or_view)
where
$action_code
is an integer that specifies what action is being authorized (see
"Action Codes").
$string1, $string2
are strings that depend on the action code (see "Action Codes").
$database
is the name of the database ("main", "temp", etc.) if applicable.
$trigger_or_view
is the name of the inner-most trigger or view that is responsible
for the access attempt, or "undef" if this access attempt is
directly from top-level SQL code.
$dbh->sqlite_backup_from_file( $filename )
This method accesses the SQLcipher Online Backup API, and will take a
backup of the named database file, copying it to, and overwriting, your
current database connection. This can be particularly handy if your
current connection is to the special :memory: database, and you wish to
populate it from an existing DB.
$dbh->sqlite_backup_to_file( $filename )
This method accesses the SQLcipher Online Backup API, and will take a
backup of the currently connected database, and write it out to the
named file.
$dbh->sqlite_enable_load_extension( $bool )
Calling this method with a true value enables loading (external) sqlite3
extensions. After the call, you can load extensions like this:
$dbh->sqlite_enable_load_extension(1);
$sth = $dbh->prepare("select load_extension('libsqlitefunctions.so')")
or die "Cannot prepare: " . $dbh->errstr();
$dbh->sqlite_trace( $code_ref )
This method registers a trace callback to be invoked whenever SQL
statements are being run.
The callback will be called as
$code_ref->($statement)
where
$statement
is a UTF-8 rendering of the SQL statement text as the statement
first begins executing.
Additional callbacks might occur as each triggered subprogram is
entered. The callbacks for triggers contain a UTF-8 SQL comment that
identifies the trigger.
See also "TRACING" in DBI for better tracing options.
$dbh->sqlite_profile( $code_ref )
This method registers a profile callback to be invoked whenever a SQL
statement finishes.
The callback will be called as
$code_ref->($statement, $elapsed_time)
where
$statement
is the original statement text (without bind parameters).
$elapsed_time
is an estimate of wall-clock time of how long that statement took to
run (in milliseconds).
This method is considered experimental and is subject to change in
future versions of SQLcipher.
See also DBI::Profile for better profiling options.
DBD::SQLcipher::compile_options()
Returns an array of compile options (available since sqlite 3.6.23,
bundled in DBD::SQLcipher 1.30_01), or an empty array if the bundled
library is old or compiled with SQLITE_OMIT_COMPILEOPTION_DIAGS.
DRIVER CONSTANTS
A subset of SQLcipher C constants are made available to Perl, because they
may be needed when writing hooks or authorizer callbacks. For accessing
( run in 0.789 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )