emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/emacsql afef528d81 179/427: Fix memoization to include typ


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql afef528d81 179/427: Fix memoization to include type map.
Date: Tue, 13 Dec 2022 02:59:40 -0500 (EST)

branch: elpa/emacsql
commit afef528d8110809e587d6aee5dd4e18401fc7477
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Fix memoization to include type map.
---
 emacsql.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 85ddf5dc12..05c4f97747 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -342,7 +342,8 @@ a list of (<string> [arg-pos] ...)."
 (defun emacsql-expand (sql &optional subsql-p)
   "Expand SQL into a SQL-consumable string, with variables."
   (let* ((cache emacsql-expander-cache)
-         (cached (and cache (gethash sql cache))))
+         (key (cons emacsql-type-map sql))
+         (cached (and cache (gethash key cache))))
     (or cached
         (cl-loop with items = (cl-coerce sql 'list)
                  while (not (null items))
@@ -358,7 +359,7 @@ a list of (<string> [arg-pos] ...)."
                                        (if subsql-p ")" ";")))
                        (vars (apply #'nconc (mapcar #'cdr parts))))
                    (cl-return (if cache
-                                  (setf (gethash sql cache) (cons string vars))
+                                  (setf (gethash key cache) (cons string vars))
                                 (cons string vars))))))))
 
 (defun emacsql-format (expansion &rest args)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]