mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
Pass sqlite3_log messages on to DBI tracing
This commit is contained in:
parent
f066bb49ad
commit
d6a129143e
1 changed files with 27 additions and 0 deletions
27
dbdimp.c
27
dbdimp.c
|
@ -175,6 +175,13 @@ _sqlite_exec(pTHX_ SV *h, sqlite3 *db, const char *sql)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
_sqlite_log_callback(void *imp_dbh, int error_code, const char *message)
|
||||
{
|
||||
dTHX;
|
||||
sqlite_trace(NULL, imp_dbh, 3, form("sqlite3_log %d, %s", error_code, message));
|
||||
}
|
||||
|
||||
int
|
||||
_sqlite_open(pTHX_ SV *dbh, const char *dbname, sqlite3 **db, int flags, int extended)
|
||||
{
|
||||
|
@ -442,6 +449,26 @@ sqlite_db_login6(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *user, char *pa
|
|||
int flag = 0;
|
||||
int unicode = 0;
|
||||
|
||||
#if SQLITE_VERSION_NUMBER >= 3006023
|
||||
/*
|
||||
* "The sqlite3_config() interface may only be
|
||||
* invoked prior to library initialization using
|
||||
* sqlite3_initialize() or after shutdown by
|
||||
* sqlite3_shutdown()."
|
||||
* -- https://sqlite.org/c3ref/config.html
|
||||
*/
|
||||
sqlite3_config(SQLITE_CONFIG_LOG, _sqlite_log_callback, imp_dbh);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "For maximum portability, it is recommended that
|
||||
* applications always invoke sqlite3_initialize()
|
||||
* directly prior to using any other SQLite interface.
|
||||
* Future releases of SQLite may require this."
|
||||
* -- https://sqlite.org/c3ref/initialize.html
|
||||
*/
|
||||
sqlite3_initialize();
|
||||
|
||||
sqlite_trace(dbh, imp_dbh, 3, form("login '%s' (version %s)", dbname, sqlite3_version));
|
||||
|
||||
if (SvROK(attr)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue