Skip to content

Commit f8348de

Browse files
authored
Merge pull request #5 from syohex/issue-4
Fix issue 4 issue
2 parents 98849c8 + 1d0a941 commit f8348de

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

sqlite3.el

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ is row element of list, second argument is field names of list."
5757
(let* ((rargs (reverse args))
5858
(callback (car rargs))
5959
bounds)
60-
(when (functionp callback)
61-
(setq rargs (cdr rargs)))
60+
(if (functionp callback)
61+
(setq rargs (cdr rargs))
62+
(setq callback nil))
6263
(when rargs
6364
(setq bounds (car rargs)))
6465
(when (and bounds (not (vectorp bounds)))

test/test.el

+8
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,12 @@
107107

108108
(should-error (sqlite3-execute-batch db "SELECT *" (lambda (&rest _args)) 'not-null))))
109109

110+
(ert-deftest regression-issue4 ()
111+
"Regression test https://github.com/syohex/emacs-sqlite3/issues/4"
112+
(let ((db (sqlite3-new)))
113+
(sqlite3-execute-batch db "CREATE TABLE foo(id integer primary key, editor text);")
114+
(sqlite3-execute-batch db "INSERT INTO foo(editor) values(?)" ["Emacs"])
115+
(sqlite3-execute db "SELECT * FROM foo WHERE editor = ?;" ["Emacs"])
116+
(should t)))
117+
110118
;;; test-sqlite3.el ends here

0 commit comments

Comments
 (0)