diff options
| author | Javier Olaechea | 2024-03-31 23:07:10 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2024-06-06 12:51:46 +0300 |
| commit | 23ef989935d38fe5c2c105933ae5f4d692656c72 (patch) | |
| tree | d2551d14e9899b8ae1556cdaa0ac3590be98b617 /src/sqlite.c | |
| parent | 7fbafb9d9527f3888469dead8309fd748d2fb9e0 (diff) | |
| download | emacs-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 'src/sqlite.c')
| -rw-r--r-- | src/sqlite.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sqlite.c b/src/sqlite.c index 261080da673..c606fa5f831 100644 --- a/src/sqlite.c +++ b/src/sqlite.c | |||
| @@ -646,6 +646,17 @@ sqlite_exec (sqlite3 *sdb, const char *query) | |||
| 646 | return Qt; | 646 | return Qt; |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | DEFUN ("sqlite-execute-batch", Fsqlite_execute_batch, Ssqlite_execute_batch, 2, 2, 0, | ||
| 650 | doc: /* Execute multiple SQL statements in DB. | ||
| 651 | Query is a string containing 0 or more SQL statements. */) | ||
| 652 | (Lisp_Object db, Lisp_Object query) | ||
| 653 | { | ||
| 654 | check_sqlite (db, false); | ||
| 655 | CHECK_STRING (query); | ||
| 656 | Lisp_Object encoded = encode_string(query); | ||
| 657 | return sqlite_exec (XSQLITE (db)->db, SSDATA (encoded)); | ||
| 658 | } | ||
| 659 | |||
| 649 | DEFUN ("sqlite-transaction", Fsqlite_transaction, Ssqlite_transaction, 1, 1, 0, | 660 | DEFUN ("sqlite-transaction", Fsqlite_transaction, Ssqlite_transaction, 1, 1, 0, |
| 650 | doc: /* Start a transaction in DB. */) | 661 | doc: /* Start a transaction in DB. */) |
| 651 | (Lisp_Object db) | 662 | (Lisp_Object db) |
| @@ -866,6 +877,7 @@ syms_of_sqlite (void) | |||
| 866 | defsubr (&Ssqlite_close); | 877 | defsubr (&Ssqlite_close); |
| 867 | defsubr (&Ssqlite_execute); | 878 | defsubr (&Ssqlite_execute); |
| 868 | defsubr (&Ssqlite_select); | 879 | defsubr (&Ssqlite_select); |
| 880 | defsubr (&Ssqlite_execute_batch); | ||
| 869 | defsubr (&Ssqlite_transaction); | 881 | defsubr (&Ssqlite_transaction); |
| 870 | defsubr (&Ssqlite_commit); | 882 | defsubr (&Ssqlite_commit); |
| 871 | defsubr (&Ssqlite_rollback); | 883 | defsubr (&Ssqlite_rollback); |