Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sqlite-ffi.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -198,3 +199,7 @@

(defcfun sqlite3-last-insert-rowid :int64
(db p-sqlite3))

(defcfun sqlite3-enable-load-extension :int
(db p-sqlite3)
(onoff :int))
7 changes: 6 additions & 1 deletion sqlite.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
:execute-non-query/named
:execute-one-row-m-v
:last-insert-rowid
:enable-load-extension
:with-transaction
:with-open-database))

Expand Down Expand Up @@ -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-"))
Expand Down Expand Up @@ -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)))))))
(terminate)))))))