[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 2e9e2d6ba1 390/427: Fix SQL truncated when print-l
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 2e9e2d6ba1 390/427: Fix SQL truncated when print-level or print-length are changed |
Date: |
Tue, 13 Dec 2022 03:00:15 -0500 (EST) |
branch: elpa/emacsql
commit 2e9e2d6ba112fa87bb3cb645b04f824b962b2843
Author: Kisaragi Hiu <mail@kisaragi-hiu.com>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Fix SQL truncated when print-level or print-length are changed
For long values or statements (like saving entire hash tables into a
field, for instance), if print-level and print-length were not reset
to nil, `format` (`prin1-to-string` under the hood) would truncate the
string, leading to an invalid value being sent.
;; Last 5 characters of the string
;; (eval-last-sexp does its own truncation)
(s-right 5 (format "%s" (make-list 100 t)))
;; -> " t t)" if the result is not truncated
;; " ...)" if it is
---
emacsql-compiler.el | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/emacsql-compiler.el b/emacsql-compiler.el
index 81d8105492..ca7193a48d 100644
--- a/emacsql-compiler.el
+++ b/emacsql-compiler.el
@@ -516,17 +516,19 @@ Only use within `emacsql-with-params'!"
(defun emacsql-format (expansion &rest args)
"Fill in the variables EXPANSION with ARGS."
(cl-destructuring-bind (format . vars) expansion
- (apply #'format format
- (cl-loop for (i . kind) in vars collect
- (let ((thing (nth i args)))
- (cl-case kind
- (:identifier (emacsql-escape-identifier thing))
- (:scalar (emacsql-escape-scalar thing))
- (:vector (emacsql-escape-vector thing))
- (:raw (emacsql-escape-raw thing))
- (:schema (emacsql-prepare-schema thing))
- (otherwise
- (emacsql-error "Invalid var type %S" kind))))))))
+ (let ((print-level nil)
+ (print-length nil))
+ (apply #'format format
+ (cl-loop for (i . kind) in vars collect
+ (let ((thing (nth i args)))
+ (cl-case kind
+ (:identifier (emacsql-escape-identifier thing))
+ (:scalar (emacsql-escape-scalar thing))
+ (:vector (emacsql-escape-vector thing))
+ (:raw (emacsql-escape-raw thing))
+ (:schema (emacsql-prepare-schema thing))
+ (otherwise
+ (emacsql-error "Invalid var type %S" kind)))))))))
(provide 'emacsql-compiler)
- [nongnu] elpa/emacsql e318a6c8f6 426/427: Add new SQLite back-ends, (continued)
- [nongnu] elpa/emacsql e318a6c8f6 426/427: Add new SQLite back-ends, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9f0a19280c 296/427: Enhance emacsql-with-transaction to retry., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 616dde3752 361/427: An identifier named * means select all columns (#19), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 5da614bc9b 359/427: Drop finalizer use and explicitely depend on Emacs 25, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3b70e8f5dd 366/427: Add support for NUL characters in strings (fixes #42), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 75ac0448a5 364/427: Add support for DISTINCT in aggregate functions (#41), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8c46fb2c1e 286/427: Drop argument count check since it's wrong., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 641338533c 331/427: Just build SQLite on first connection., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 56a2882936 333/427: Update README for Melpa changes., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1b37570bf5 352/427: Fix up the Makefile., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2e9e2d6ba1 390/427: Fix SQL truncated when print-level or print-length are changed,
ELPA Syncer <=
- [nongnu] elpa/emacsql 50b139443b 414/427: make: Fix compiling and cleaning tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4fe4413994 420/427: Re-indent some data so that machine and human can agree, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 62d3915737 363/427: Update to SQLite 3.22.0 and remove download system (#40), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a164ecd9d3 374/427: Implement operator precedence handling, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 214b46f547 372/427: Update documentation for building SQLite backend (#46), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 5f30787890 375/427: Add precedence handling for "between" syntax, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 60b99760c5 371/427: Extend the compiler search to a configurable list (#45), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 373975cbcc 387/427: Remove types from cl-defgeneric arguments, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9dca599616 383/427: Fix whitespace, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2fa32d2ab7 395/427: Create new log buffer if existing one isn't live anymore, ELPA Syncer, 2022/12/13