[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 77ae713186 046/427: Create table expander.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 77ae713186 046/427: Create table expander. |
Date: |
Tue, 13 Dec 2022 02:59:26 -0500 (EST) |
branch: elpa/emacsql
commit 77ae713186a750bc5c6fb1e77aa177f445dfe0c2
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Create table expander.
---
emacsql-tests.el | 4 +++-
emacsql.el | 5 +++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/emacsql-tests.el b/emacsql-tests.el
index 59332dbe34..f27fd23860 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -48,4 +48,6 @@
(emacsql-tests-query [:select * :from employees] ()
"SELECT * FROM employees;")
(emacsql-tests-query [:select * :from employees :where (< salary 50000)] ()
- "SELECT * FROM employees WHERE salary < 50000;"))
+ "SELECT * FROM employees WHERE salary < 50000;")
+ (emacsql-tests-query [:create-table foo [a b c]] ()
+ "CREATE TABLE foo (a, b, c);"))
diff --git a/emacsql.el b/emacsql.el
index cbf2634fb6..be59bc2977 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -411,6 +411,11 @@ definitions for return from a `emacsql-defexpander'."
(cl-destructuring-bind (op a b) expr
(format "%s %s %s" (var a :auto) op (var b :auto)))))
+(emacsql-defexpander :create-table (table schema)
+ (emacsql-with-vars "CREATE TABLE "
+ (format "%s (%s)" (var table :identifier)
+ (emacsql--schema-to-string schema))))
+
(provide 'emacsql)
;;; emacsql.el ends here
- [nongnu] elpa/emacsql c9854331c0 028/427: Add (un)license header., (continued)
- [nongnu] elpa/emacsql c9854331c0 028/427: Add (un)license header., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 896bb7ce52 035/427: Start adding SQL expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9272d13ace 036/427: Add some tests for the expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3511a0df1d 037/427: Add a top-level query function, emacsql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 7e18a43da1 039/427: Add a template example., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8b2cf8c208 041/427: Fix up :where., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c92c56ce55 003/427: Add a close buffer sentinel., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1a84c983cf 013/427: No named results by default., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 76a430032e 014/427: Fix up old test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 36c6aae4b5 042/427: Drop raw select., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 77ae713186 046/427: Create table expander.,
ELPA Syncer <=
- [nongnu] elpa/emacsql e859204451 064/427: Flesh out more README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 35676bb560 065/427: Fix README examples., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 847f3bd87f 078/427: Add new keywords to listing., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a9b9d6bfc8 083/427: Fix typo in README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 29f65b3b8e 093/427: Update Windows statement in the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b447994514 033/427: Change table type recommendation., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4fa57ba758 051/427: Fully drop named parsing., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 7c572d688d 052/427: Fix % operator situation., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 84499878d0 081/427: Add :union, :union-all, :difference, and :except., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a1ce9f16f2 097/427: Add emacsql-with-connection back in., ELPA Syncer, 2022/12/13