branch: elpa/emacsql
commit 6f1e375a2ebb558138b73d2a63f2077da1028f92
Author: Christopher Wellons <[email protected]>
Commit: Christopher Wellons <[email protected]>
Better escaping of NUL and control characters (#42)
---
emacsql-compiler.el | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/emacsql-compiler.el b/emacsql-compiler.el
index bfa03f228c..c16e774a2e 100644
--- a/emacsql-compiler.el
+++ b/emacsql-compiler.el
@@ -55,9 +55,6 @@
(while (re-search-forward "'" nil t)
(replace-match "''"))
(setf (point) (point-min))
- (while (re-search-forward "\0" nil t)
- (replace-match "\\\\0"))
- (setf (point) (point-min))
(insert "'")
(setf (point) (point-max))
(insert "'")
@@ -93,7 +90,8 @@
(defun emacsql-escape-scalar (value)
"Escape VALUE for sending to SQLite."
- (let ((print-escape-newlines t))
+ (let ((print-escape-newlines t)
+ (print-escape-control-characters t))
(cond ((null value) "NULL")
((numberp value) (prin1-to-string value))
((emacsql-quote-scalar (prin1-to-string value))))))