diff --git a/sqlite-ffi.lisp b/sqlite-ffi.lisp index 09964f7..0a822bf 100644 --- a/sqlite-ffi.lisp +++ b/sqlite-ffi.lisp @@ -30,7 +30,8 @@ :sqlite3-bind-blob :destructor-transient :destructor-static - :sqlite3-last-insert-rowid)) + :sqlite3-last-insert-rowid + :sqlite3-enable-load-extension)) (in-package :sqlite-ffi) @@ -198,3 +199,7 @@ (defcfun sqlite3-last-insert-rowid :int64 (db p-sqlite3)) + +(defcfun sqlite3-enable-load-extension :int + (db p-sqlite3) + (onoff :int)) diff --git a/sqlite.lisp b/sqlite.lisp index de0f97d..15e831d 100644 --- a/sqlite.lisp +++ b/sqlite.lisp @@ -29,6 +29,7 @@ :execute-non-query/named :execute-one-row-m-v :last-insert-rowid + :enable-load-extension :with-transaction :with-open-database)) @@ -439,6 +440,10 @@ See BIND-PARAMETER for the list of supported parameter types." "Returns the auto-generated ID of the last inserted row on the database connection DB." (sqlite-ffi:sqlite3-last-insert-rowid (handle db))) +(defun enable-load-extension (db enable) + "Enable extension loading, or disable it if ENABLE is NIL." + (sqlite-ffi:sqlite3-enable-load-extension (handle db) (if enable 1 0))) + (defmacro with-transaction (db &body body) "Wraps the BODY inside the transaction." (let ((ok (gensym "TRANSACTION-COMMIT-")) @@ -504,4 +509,4 @@ See BIND-PARAMETER for the list of supported parameter types." next (progn (if (step-statement ,statement-var) (values ,@(iter (for i from 0 below (if (symbolp vars) 1 (length vars))) (collect `(statement-column-value ,statement-var ,i)))) - (terminate))))))) \ No newline at end of file + (terminate)))))))