Skip to content

Commit de1e8cb

Browse files
committed
Increase safety by asserting the buffer
1 parent c19f88b commit de1e8cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

emacsql-compiler.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@
6060
"Returns non-nil if string NAME is a SQL keyword."
6161
(gethash (upcase name) emacsql-reserved))
6262

63+
(defvar emacsql-work-buffer nil)
6364
(defun emacsql-quote-scalar-dangerous (string)
6465
"Single-quote (scalar) STRING for use in a SQL expression."
66+
(cl-assert (eq (current-buffer) emacsql-work-buffer))
6567
(erase-buffer)
6668
(insert "'" string)
6769
(goto-char 2)
@@ -548,7 +550,8 @@ Only use within `emacsql-with-params'!"
548550
(cl-destructuring-bind (format . vars) expansion
549551
(let ((print-level nil)
550552
(print-length nil))
551-
(with-temp-buffer
553+
(with-current-buffer (setq emacsql-work-buffer
554+
(get-buffer-create " *emacsql-throwaway*" t))
552555
(apply #'format format
553556
(cl-loop for (i . kind) in vars collect
554557
(let ((thing (nth i args)))

0 commit comments

Comments
 (0)