[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql f179ba928a 047/427: Add :drop-table expander.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql f179ba928a 047/427: Add :drop-table expander. |
Date: |
Tue, 13 Dec 2022 02:59:26 -0500 (EST) |
branch: elpa/emacsql
commit f179ba928a98a7a71db0c298f73205cd95eb9682
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Add :drop-table expander.
---
emacsql-tests.el | 4 +++-
emacsql.el | 9 ++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/emacsql-tests.el b/emacsql-tests.el
index f27fd23860..63ba565522 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -50,4 +50,6 @@
(emacsql-tests-query [: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);"))
+ "CREATE TABLE foo (a, b, c);")
+ (emacsql-tests-query [:drop-table $1] '(foo)
+ "DROP TABLE foo;"))
diff --git a/emacsql.el b/emacsql.el
index be59bc2977..97d2638a52 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -265,11 +265,6 @@ If NAMED is non-nil, don't include column names."
(emacsql-escape table)
(emacsql--schema-to-string schema)))))
-(defun emacsql-drop (conn table)
- "Drop TABLE from CONN."
- (emacsql-with-errors conn
- (emacsql--send conn (format "DROP TABLE %s;" (emacsql-escape table)))))
-
(defun emacsql-escape-value (value)
"Escape VALUE for sending to SQLite."
(let ((print-escape-newlines t))
@@ -416,6 +411,10 @@ definitions for return from a `emacsql-defexpander'."
(format "%s (%s)" (var table :identifier)
(emacsql--schema-to-string schema))))
+(emacsql-defexpander :drop-table (table)
+ (emacsql-with-vars "DROP TABLE "
+ (var table :identifier)))
+
(provide 'emacsql)
;;; emacsql.el ends here
- [nongnu] elpa/emacsql f8c3d9fce2 369/427: Silence Emacs 25's byte-compiler, (continued)
- [nongnu] elpa/emacsql f8c3d9fce2 369/427: Silence Emacs 25's byte-compiler, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8e34660ba1 370/427: Allow `gcc` as a separate option for C compilation., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 739c24cab6 389/427: Add kludge to work around `cl-defmethod' bug, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 18b40213fd 403/427: No longer use obsolete generalized variable `point', ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6d999ba39d 400/427: Update library headers, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a29b9e7ea5 388/427: No longer needlessly require url and url-http, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 20e390ea06 401/427: Add FAQ to README.md, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 30912aa69e 404/427: Include ../.config.mk in sqlite/Makefile, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f5da68e5f9 391/427: Fix quoting in docstring, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a4d01edd71 411/427: Adjust emacsql-pg to new pg version from original author, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f179ba928a 047/427: Add :drop-table expander.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 458b8a6acd 074/427: Add :insert and :values expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2faed63b20 107/427: Prime emacsql-expand for substatements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 13cfbeeaba 186/427: Tidy up the constructors., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a742687cfb 192/427: Add funcall operator., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8fa1ca451c 238/427: Fix schema mistake in unit test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ea613c5191 360/427: Push other sub-packages up to Emacs 25 as well, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fbda94e6b5 339/427: Improve some doc-strings., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6f1e375a2e 367/427: Better escaping of NUL and control characters (#42), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3dc6971829 190/427: Add ALTER TABLE stuff., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ef976b8649 189/427: Add package target for Makefile., ELPA Syncer, 2022/12/13