[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql add06c47b9 117/427: Bring back :into for :replace
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql add06c47b9 117/427: Bring back :into for :replace (oops!). |
Date: |
Tue, 13 Dec 2022 02:59:33 -0500 (EST) |
branch: elpa/emacsql
commit add06c47b90715394c615b3f5cdcea6c2f121019
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Bring back :into for :replace (oops!).
---
README.md | 15 ++++++++++++---
emacsql-tests.el | 4 ++--
emacsql.el | 19 +++++++++++--------
3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 318906e58a..55654a5b91 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ shouldn't impact normal use of the database.
(emacsql db [:create-table people [name (id integer :unique) (salary float)]])
;; Insert some data:
-(emacsql db [:insert-into people
+(emacsql db [:insert :into people
:values (["Jeff" 1000 60000.0] ["Susan" 1001 64000.0])])
;; Query the database for results:
@@ -160,9 +160,18 @@ Provides `GROUP BY`.
[... :group-by name]
```
-#### :insert-into `<table>`
+#### :insert, :replace
-Provides `INSERT INTO`.
+Provides `INSERT`, `REPLACE`.
+
+```el
+[:insert :into ...]
+[:replace :into ...]
+```
+
+#### :into `<table>`
+
+Provides `INTO`.
```el
[:insert-into employees ...]
diff --git a/emacsql-tests.el b/emacsql-tests.el
index 2c81a4d18c..2138d3ec96 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -69,7 +69,7 @@
"UPDATE people SET id = 10;")
(emacsql-tests-query [:select * :from people :where (in name $1)] '([FOO
BAR])
"SELECT * FROM people WHERE name IN ('FOO', 'BAR');")
- (emacsql-tests-query [:insert-into foo :values [nil $1]] '(10.1)
+ (emacsql-tests-query [:insert :into foo :values [nil $1]] '(10.1)
"INSERT INTO foo VALUES (NULL, 10.1);")
(emacsql-tests-query [:create-table (:temporary :if-not-exists x) [y]] '()
"CREATE TEMPORARY TABLE IF NOT EXISTS x (y);"))
@@ -78,7 +78,7 @@
(emacsql-with-connection (db nil)
(emacsql db [:create-table foo [x]])
(should-error (emacsql db [:create-table foo [x]]))
- (emacsql db [:insert-into foo :values ([1] [2] [3])])
+ (emacsql db [:insert :into foo :values ([1] [2] [3])])
(should (equal (emacsql db [:select * :from foo])
'((1) (2) (3))))))
diff --git a/emacsql.el b/emacsql.el
index 548606715f..b674bfbc9e 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -36,7 +36,7 @@
;; Insert values into a table with `emacsql-insert'.
-;; (emacsql db [:insert-into people
+;; (emacsql db [:insert :into people
;; :values (["Jeff" 1000 60000.0] ["Susan" 1001 64000.0])])
;; Currently all actions are synchronous and Emacs will block until
@@ -135,7 +135,7 @@ CONN-SPEC is a connection specification like the call to
(emacsql-with-connection (db \"company.db\")
(emacsql db [:create-table foo [x]])
- (emacsql db [:insert-into foo :values ([1] [2] [3])])
+ (emacsql db [:insert :into foo :values ([1] [2] [3])])
(emacsql db [:select * :from foo]))"
(declare (indent 1))
`(let ((,(car conn-spec) (emacsql-connect ,@(cdr conn-spec))))
@@ -499,9 +499,15 @@ definitions for return from a `emacsql-defexpander'."
(emacsql-with-vars "FROM "
(var table :identifier)))
-(emacsql-defexpander :insert-into (table)
- "Expands to the INSERT INTO keywords."
- (emacsql-with-vars "INSERT INTO "
+(emacsql-defexpander :replace ()
+ (list "REPLACE"))
+
+(emacsql-defexpander :insert ()
+ (list "INSERT"))
+
+(emacsql-defexpander :into (table)
+ "Expands to the INTO keywords."
+ (emacsql-with-vars "INTO "
(cl-typecase table
(symbol (var table :identifier))
(list (cl-destructuring-bind (name columns) table
@@ -537,9 +543,6 @@ definitions for return from a `emacsql-defexpander'."
(emacsql-defexpander :delete ()
(list "DELETE"))
-(emacsql-defexpander :replace ()
- (list "REPLACE"))
-
(emacsql-defexpander :values (values)
(emacsql-with-vars "VALUES "
(combine (emacsql--vector values))))
- [nongnu] elpa/emacsql ad6c09681e 261/427: Oops, print the tuple., (continued)
- [nongnu] elpa/emacsql ad6c09681e 261/427: Oops, print the tuple., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ff59ca9336 265/427: Clear out binaries in distclean, too., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 00bb81ff2b 266/427: Fix Makefile typo., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c8de0ff1fd 293/427: Adjust the EmacSQL protocol., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 51224aab7a 288/427: Add unit test for last change., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c5845884f4 021/427: Rename type to column., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 7caa63c11e 023/427: Allow any sequence for table spec., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 963f221b82 049/427: Add expr expansion function., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 109664b88b 060/427: Memoize emacsql-expand., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1fb97f7d4a 092/427: Drop unusable macro emacsql-with-connection., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql add06c47b9 117/427: Bring back :into for :replace (oops!).,
ELPA Syncer <=
- [nongnu] elpa/emacsql d7a05db54e 080/427: Add :replace expander., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 0f0840ffbf 128/427: Add :default column constraint., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bbe3031a50 130/427: Add table constraints., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 53b2e98515 131/427: Fill out README for new schema table constraints., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 364c3cacb6 133/427: More advanced :from sources, again., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 99a8069389 135/427: Add support for foreign keys., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e6ab07e16b 140/427: Switch to a friendlier name., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bec6af6940 148/427: Add VACUUM., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 03aebdecd1 160/427: Rename :log option to :debug., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bb221f6134 161/427: Drop .print command flushing., ELPA Syncer, 2022/12/13