aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/sqlite-tests.el
diff options
context:
space:
mode:
authorJavier Olaechea2024-03-31 23:07:10 -0500
committerEli Zaretskii2024-06-06 12:51:46 +0300
commit23ef989935d38fe5c2c105933ae5f4d692656c72 (patch)
treed2551d14e9899b8ae1556cdaa0ac3590be98b617 /test/src/sqlite-tests.el
parent7fbafb9d9527f3888469dead8309fd748d2fb9e0 (diff)
downloademacs-23ef989935d38fe5c2c105933ae5f4d692656c72.tar.gz
emacs-23ef989935d38fe5c2c105933ae5f4d692656c72.zip
Add 'sqlite-execute-batch' command
This command is similar to 'sqlite-execute' except that it executes multiple statements in exchange for not accepting any arguments. (Bug#70145) * src/sqlite.c (Fsqlite_execute_batch): New function. * test/src/sqlite-tests.el (sqlite-multiple-statements): Add smoke test for 'sqlite-execute-batch'. * etc/NEWS: Mention new command 'sqlite-execute-batch'. * doc/lispref/text.texi (Database): Document the new command.
Diffstat (limited to 'test/src/sqlite-tests.el')
-rw-r--r--test/src/sqlite-tests.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index a10dca9a0c9..e87a5fc77b1 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -261,4 +261,30 @@
261 '("Joe" "Doe")) 261 '("Joe" "Doe"))
262 '((1 "Joe"))))))) 262 '((1 "Joe")))))))
263 263
264(ert-deftest sqlite-multiple-statements ()
265 (skip-unless (sqlite-available-p))
266 (let ((db (sqlite-open nil))
267 (query (with-temp-buffer
268 (insert "-- -*- sql-product: sqlite -*-
269
270-- I 💘 emojis
271
272CREATE TABLE settings (
273 name TEXT NOT NULL,
274 value TEXT,
275 section TEXT NOT NULL,
276 PRIMARY KEY (section, name)
277);
278
279CREATE TABLE tags📎 (
280 name TEXT PRIMARY KEY NOT NULL
281);
282
283-- CREATE TABLE todo_states (id INTEGER PRIMARY KEY, name TEXT NOT NULL);
284")
285 (buffer-string))))
286 (sqlite-execute-batch db query)
287 (should (equal '(("settings") ("tags📎"))
288 (sqlite-select db "select name from sqlite_master where type = 'table' and name not like 'sqlite_%' order by name")))))
289
264;;; sqlite-tests.el ends here 290;;; sqlite-tests.el ends here