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

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

[elpa] externals/triples 3593f55dfb 16/19: Support numbers stored via em


From: ELPA Syncer
Subject: [elpa] externals/triples 3593f55dfb 16/19: Support numbers stored via emacsql.
Date: Sat, 5 Nov 2022 11:58:17 -0400 (EDT)

branch: externals/triples
commit 3593f55dfbbd750737c98bbcb8d21736a630cf24
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>

    Support numbers stored via emacsql.
    
    Although the triples columns are all TEXT type, emacsql was able to store 
raw
    numbers in them, not strings. This makes it possible to retrieve those 
numbers.
---
 triples.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/triples.el b/triples.el
index ca42b023db..c003db4b86 100644
--- a/triples.el
+++ b/triples.el
@@ -116,10 +116,13 @@ one, because sqlite cannot handle symbols."
 This imitates the way emacsql returns items, with strings
 becoming either symbols, lists, or strings depending on whether
 the string itself is wrapped in quotes."
-  (if (and (string-prefix-p "\"" result)
+  (if (and (stringp result)
+           (string-prefix-p "\"" result)
            (string-suffix-p "\"" result))
       (string-remove-suffix "\"" (string-remove-prefix "\"" result))
-    (read result)))
+    (if (numberp result)
+        result
+      (read result))))
 
 (defun triples--insert (db subject predicate object &optional properties)
   "Insert triple to DB: SUBJECT, PREDICATE, OBJECT with PROPERTIES.



reply via email to

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