diff options
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/bindings/sqlite/JSSQLStatement.cpp | 5 | ||||
-rw-r--r-- | src/bun.js/bindings/sqlite/lazy_sqlite3.h | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp index e36d2b809..72c7d9a07 100644 --- a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp +++ b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp @@ -695,6 +695,11 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementLoadExtensionFunction, (JSC::JSGlobalObje return JSValue::encode(JSC::jsUndefined()); } + if(sqlite3_compileoption_used("SQLITE_OMIT_LOAD_EXTENSION")) { + throwException(lexicalGlobalObject, scope, createError(lexicalGlobalObject, "This build of sqlite3 does not support dynamic extension loading"_s)); + return JSValue::encode(JSC::jsUndefined()); + } + auto entryPointStr = callFrame->argumentCount() > 2 && callFrame->argument(2).isString() ? callFrame->argument(2).toWTFString(lexicalGlobalObject) : String(); const char* entryPoint = entryPointStr.length() == 0 ? NULL : entryPointStr.utf8().data(); char* error; diff --git a/src/bun.js/bindings/sqlite/lazy_sqlite3.h b/src/bun.js/bindings/sqlite/lazy_sqlite3.h index 8b23a7e03..a012f6ab6 100644 --- a/src/bun.js/bindings/sqlite/lazy_sqlite3.h +++ b/src/bun.js/bindings/sqlite/lazy_sqlite3.h @@ -71,6 +71,7 @@ typedef int (*lazy_sqlite3_deserialize_type)( ); typedef int (*lazy_sqlite3_stmt_readonly_type)(sqlite3_stmt* pStmt); +typedef int (*lazy_sqlite3_compileoption_used_type)(const char *zOptName); static lazy_sqlite3_bind_blob_type lazy_sqlite3_bind_blob; static lazy_sqlite3_bind_double_type lazy_sqlite3_bind_double; @@ -112,6 +113,7 @@ static lazy_sqlite3_malloc64_type lazy_sqlite3_malloc64; static lazy_sqlite3_serialize_type lazy_sqlite3_serialize; static lazy_sqlite3_deserialize_type lazy_sqlite3_deserialize; static lazy_sqlite3_stmt_readonly_type lazy_sqlite3_stmt_readonly; +static lazy_sqlite3_compileoption_used_type lazy_sqlite3_compileoption_used; #define sqlite3_bind_blob lazy_sqlite3_bind_blob #define sqlite3_bind_double lazy_sqlite3_bind_double @@ -152,6 +154,7 @@ static lazy_sqlite3_stmt_readonly_type lazy_sqlite3_stmt_readonly; #define sqlite3_deserialize lazy_sqlite3_deserialize #define sqlite3_stmt_readonly lazy_sqlite3_stmt_readonly #define sqlite3_column_int64 lazy_sqlite3_column_int64 +#define sqlite3_compileoption_used lazy_sqlite3_compileoption_used; static void* sqlite3_handle = nullptr; static const char* sqlite3_lib_path = "libsqlite3.dylib"; @@ -204,6 +207,7 @@ static int lazyLoadSQLite() lazy_sqlite3_deserialize = (lazy_sqlite3_deserialize_type)dlsym(sqlite3_handle, "sqlite3_deserialize"); lazy_sqlite3_malloc64 = (lazy_sqlite3_malloc64_type)dlsym(sqlite3_handle, "sqlite3_malloc64"); lazy_sqlite3_stmt_readonly = (lazy_sqlite3_stmt_readonly_type)dlsym(sqlite3_handle, "sqlite3_stmt_readonly"); + lazy_sqlite3_compileoption_used = (lazy_sqlite3_compileoption_used_type)dlsym(sqlite3_handle, "sqlite3_compileoption_used"); return 0; } |