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

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

[nongnu] elpa/emacsql ad3483c97c 5/9: emacsql-sqlite-list-tables: New fu


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql ad3483c97c 5/9: emacsql-sqlite-list-tables: New function
Date: Wed, 22 Feb 2023 14:59:07 -0500 (EST)

branch: elpa/emacsql
commit ad3483c97c8197e1adc06ca5011185397b291ce0
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    emacsql-sqlite-list-tables: New function
---
 emacsql-sqlite-common.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/emacsql-sqlite-common.el b/emacsql-sqlite-common.el
index 15a879bebe..216dbcc47a 100644
--- a/emacsql-sqlite-common.el
+++ b/emacsql-sqlite-common.el
@@ -83,6 +83,22 @@ Also see http://www.sqlite.org/lang_keywords.html.";)
 Elements have the form (ERRCODE SYMBOLIC-NAME EMACSQL-ERROR
 ERRSTR).  Also see https://www.sqlite.org/rescode.html.";)
 
+;;; Utilities
+
+(defun emacsql-sqlite-list-tables (connection)
+  "Return a list of the names of all tables in CONNECTION.
+Tables whose names begin with \"sqlite_\", are not included
+in the returned value."
+  (emacsql connection
+           [:select name
+            ;; The new name is `sqlite-schema', but this name
+            ;; is supported by old and new SQLite versions.
+            ;; See https://www.sqlite.org/schematab.html.
+            :from sqlite-master
+            :where (and (= type 'table)
+                        (not-like name "sqlite_%"))
+            :order-by [(asc name)]]))
+
 (provide 'emacsql-sqlite-common)
 
 ;;; emacsql-sqlite-common.el ends here



reply via email to

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