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

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

[nongnu] elpa/emacsql 8a66563af6 105/427: Combine :insert and :into.


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 8a66563af6 105/427: Combine :insert and :into.
Date: Tue, 13 Dec 2022 02:59:32 -0500 (EST)

branch: elpa/emacsql
commit 8a66563af6e6aae8077001aa41712289cc7b4fef
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Combine :insert and :into.
    
    SQLite has no other use of :into, so no reason to keep it around.
---
 README.md        | 16 ++++------------
 emacsql-tests.el |  4 ++--
 emacsql.el       | 13 +++++--------
 3 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/README.md b/README.md
index ef41cdfef4..dfbf1a6438 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:
@@ -143,12 +143,12 @@ Provides `FROM`.
 [... :from employees]
 ```
 
-#### :into `<table>`
+#### :insert-into `<table>`
 
-Provides `INTO`.
+Provides `INSERT INTO`.
 
 ```el
-[... :into employees]
+[:insert-into employees ...]
 ```
 
 #### :delete
@@ -159,14 +159,6 @@ Provides `DELETE`.
 [:delete :from employees :where ...]
 ```
 
-#### :insert
-
-Provides `INSERT`.
-
-```el
-[:insert :into employees ...]
-```
-
 #### :replace
 
 Provides `REPLACE`.
diff --git a/emacsql-tests.el b/emacsql-tests.el
index 19299426a7..8773cf9d29 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -69,14 +69,14 @@
                        "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);"))
 
 (ert-deftest emacsql-system ()
   (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 43fb473aba..1f5f8518f6 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))))
@@ -484,9 +484,9 @@ definitions for return from a `emacsql-defexpander'."
   (emacsql-with-vars "FROM "
     (var table :identifier)))
 
-(emacsql-defexpander :into (table)
-  "Expands to the INTO keyword."
-  (emacsql-with-vars "INTO "
+(emacsql-defexpander :insert-into (table)
+  "Expands to the INSERT INTO keywords."
+  (emacsql-with-vars "INSERT INTO "
     (var table :identifier)))
 
 (emacsql-defexpander :where (expr)
@@ -505,9 +505,6 @@ definitions for return from a `emacsql-defexpander'."
 (emacsql-defexpander :delete ()
   (list "DELETE"))
 
-(emacsql-defexpander :insert ()
-  (list "INSERT"))
-
 (emacsql-defexpander :replace ()
   (list "REPLACE"))
 



reply via email to

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