From 6b8dc80622b2e69eb9134165cb208c3c40f864e7 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Sun, 5 Apr 2009 13:04:56 +0000 Subject: [PATCH] DBD-SQLite: applied an enable_load_extension patch from RT #32998 --- SQLite.xs | 9 +++++++++ dbdimp.c | 14 ++++++++++++++ dbdimp.h | 5 +++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/SQLite.xs b/SQLite.xs index fbe3230..c2fdf47 100644 --- a/SQLite.xs +++ b/SQLite.xs @@ -42,6 +42,15 @@ create_function(dbh, name, argc, func) sqlite3_db_create_function( dbh, name, argc, func ); } +void +enable_load_extension(dbh, onoff) + SV *dbh + int onoff + CODE: + { + sqlite3_db_enable_load_extension( dbh, onoff ); + } + void create_aggregate(dbh, name, argc, aggr) SV *dbh diff --git a/dbdimp.c b/dbdimp.c index 1840dc8..b862cdf 100644 --- a/dbdimp.c +++ b/dbdimp.c @@ -939,6 +939,20 @@ sqlite3_db_create_function( SV *dbh, const char *name, int argc, SV *func ) } } +void +sqlite3_db_enable_load_extension( SV *dbh, int onoff ) +{ + D_imp_dbh(dbh); + int rv; + + rv = sqlite3_enable_load_extension( imp_dbh->db, onoff ); + if ( rv != SQLITE_OK ) + { + croak( "sqlite_enable_load_extension failed with error %s", + sqlite3_errmsg(imp_dbh->db) ); + } +} + typedef struct aggrInfo aggrInfo; struct aggrInfo { SV *aggr_inst; diff --git a/dbdimp.h b/dbdimp.h index 06656c6..d73dd0b 100644 --- a/dbdimp.h +++ b/dbdimp.h @@ -72,9 +72,10 @@ struct imp_sth_st { #define dbd_st_bind_col sqlite_bind_col void sqlite3_db_create_function(SV *dbh, const char *name, int argc, SV *func); +void sqlite3_db_enable_load_extension(SV *dbh, int onoff); void sqlite3_db_create_aggregate( SV *dbh, const char *name, int argc, SV *aggr ); -void sqlite_db_create_collation(SV *dbh, const char *name, SV *func); -void sqlite_db_progress_handler(SV *dbh, int n_opcodes, SV *handler); +void sqlite3_db_create_collation(SV *dbh, const char *name, SV *func); +void sqlite3_db_progress_handler(SV *dbh, int n_opcodes, SV *handler); void sqlite_st_reset( SV *sth ); int sqlite_bind_col( SV *sth, imp_sth_t *imp_sth, SV *col, SV *ref, IV sql_type, SV *attribs ); int dbd_set_sqlite3_busy_timeout ( SV *dbh, int timeout );