[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sqlite3 b6868d2437 27/62: sqlite3-finalize accepts multipl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sqlite3 b6868d2437 27/62: sqlite3-finalize accepts multiple params |
Date: |
Tue, 14 Mar 2023 11:01:46 -0400 (EDT) |
branch: elpa/sqlite3
commit b6868d2437dc23a7c335aa863b30945d6732fc8c
Author: Y. N. Lo <gordonynlo@yahoo.com>
Commit: Y. N. Lo <gordonynlo@yahoo.com>
sqlite3-finalize accepts multiple params
---
Makefile | 8 +++++++-
README-in.md | 13 ++++++++-----
README.md | 13 ++++++++-----
sqlite3-api.c | 25 +++++++++++++++----------
4 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
index ac979abd22..c32f088469 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,8 @@ CFLAGS=-g3 -Wall -std=c99 $(INC)
EMACS252=$(HOME)/test-emacs/bin/emacs
EMACS251=$(HOME)/test-emacs-251/bin/emacs
+EMACS253=$(HOME)/test-emacs-253/bin/emacs
+
SQLITE3_H=$(shell tools/find-sqlite3-h.sh $(INC))
# Melpa package
@@ -12,7 +14,7 @@ PKG=sqlite3-api
# dynamic module package
MODULE=$(PKG)
-MODULE_VERSION=0.1
+MODULE_VERSION=0.11
MODULE_BASENAME=$(MODULE)-$(MODULE_VERSION)
MODULE_PKG_EL=$(MODULE_BASENAME)/$(MODULE)-pkg.el
MODULE_TAR=$(MODULE_BASENAME).tar
@@ -49,3 +51,7 @@ test:
# Emacs 25.1
t251:
$(EMACS251) -batch -Q -L . -l tests/regression.el
+
+# Emacs 25.1
+t253:
+ $(EMACS253) -batch -Q -L . -l tests/regression.el
diff --git a/README-in.md b/README-in.md
index 6ebdc8f24d..40c6af38cb 100644
--- a/README-in.md
+++ b/README-in.md
@@ -1,4 +1,4 @@
-# SQLite3 API v0.1 for Emacs 25+
+# SQLite3 API v0.11 for Emacs 25+
`sqlite3-api` is a dynamic module for GNU Emacs 25+ that provides
direct access to the core SQLite3 C API from Emacs Lisp.
~~~el
@@ -12,7 +12,7 @@ direct access to the core SQLite3 C API from Emacs Lisp.
;; execute the SQL
(sqlite3-step stmt)
;; call reset if you want to bind the SQL to a new set of variables
- (sqlite3-reset stmt) )
+ (sqlite3-reset stmt))
(sqlite3-finalize stmt)
(setq stmt (sqlite3-prepare dbh "select * from temp"))
@@ -25,7 +25,7 @@ direct access to the core SQLite3 C API from Emacs Lisp.
While this module provides only 14 functions (vs [200+ in the C
API](https://sqlite.org/c3ref/funclist.html)), it should satisfy most
users' needs.
-The current version is 0.1.
+The current version is v0.11.
This is an alpha release so it might crash your Emacs. Save your work before
you try it out!
@@ -108,9 +108,9 @@ Compile the supplied SQL statement and return a statement
handle.
This function calls
[`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html) internally
and raises 'sql-error in case of error.
### sqlite3-finalize
~~~el
-(sqlite3-finalize statement-handle)
+(sqlite3-finalize statement-handle1 statement-handle2 ...)
~~~
-Destroy a prepared statement.
+Destroy prepared statements.
### sqlite3-step
~~~el
(sqlite3-step statement-handle)
@@ -293,6 +293,9 @@ For integers > 61 bits you can retrieve them as text as a
workaround.
The code is licensed under the [GNU GPL
v3](https://www.gnu.org/licenses/gpl-3.0.html).
## Changelog
+*v0.11 - 2017-09-14*
+- `sqlite3-finalize` now accepts multiple handles.
+
*v0.1 - 2017-09-04*
- Emacs Lisp code removed. The package is now pure C.
diff --git a/README.md b/README.md
index eb0a4befb1..1fd2a8f298 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# SQLite3 API v0.1 for Emacs 25+
+# SQLite3 API v0.11 for Emacs 25+
`sqlite3-api` is a dynamic module for GNU Emacs 25+ that provides
direct access to the core SQLite3 C API from Emacs Lisp.
~~~el
@@ -12,7 +12,7 @@ direct access to the core SQLite3 C API from Emacs Lisp.
;; execute the SQL
(sqlite3-step stmt)
;; call reset if you want to bind the SQL to a new set of variables
- (sqlite3-reset stmt) )
+ (sqlite3-reset stmt))
(sqlite3-finalize stmt)
(setq stmt (sqlite3-prepare dbh "select * from temp"))
@@ -25,7 +25,7 @@ direct access to the core SQLite3 C API from Emacs Lisp.
While this module provides only 14 functions (vs [200+ in the C
API](https://sqlite.org/c3ref/funclist.html)), it should satisfy most
users' needs.
-The current version is 0.1.
+The current version is v0.11.
This is an alpha release so it might crash your Emacs. Save your work before
you try it out!
@@ -133,9 +133,9 @@ Compile the supplied SQL statement and return a statement
handle.
This function calls
[`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html) internally
and raises 'sql-error in case of error.
### <a name="3-4"/> sqlite3-finalize
~~~el
-(sqlite3-finalize statement-handle)
+(sqlite3-finalize statement-handle1 statement-handle2 ...)
~~~
-Destroy a prepared statement.
+Destroy prepared statements.
### <a name="3-5"/> sqlite3-step
~~~el
(sqlite3-step statement-handle)
@@ -318,6 +318,9 @@ For integers > 61 bits you can retrieve them as text as a
workaround.
The code is licensed under the [GNU GPL
v3](https://www.gnu.org/licenses/gpl-3.0.html).
## <a name="9"/> Changelog
+*v0.11 - 2017-09-14*
+- `sqlite3-finalize` now accepts multiple handles.
+
*v0.1 - 2017-09-04*
- Emacs Lisp code removed. The package is now pure C.
diff --git a/sqlite3-api.c b/sqlite3-api.c
index 27718e143a..11ac7a7b7e 100644
--- a/sqlite3-api.c
+++ b/sqlite3-api.c
@@ -764,18 +764,23 @@ static emacs_value sqlite3_api_finalize(
emacs_value *args,
void *ptr) {
(void)ptr;
- (void)n;
- /* User passed a nil stmt */
- if (!env->is_not_nil(env, args[0]))
- return SYM(env, "nil");
+ INFO(env, "%s: entered", __func__);
- sqlite3_stmt *stmt = (sqlite3_stmt *)env->get_user_ptr(env, args[0]);
- NON_LOCAL_EXIT_CHECK(env);
+ for (int i = 0; i < n; i++) {
+ /* User passed a nil stmt */
+ if (!env->is_not_nil(env, args[i]))
+ /* return SYM(env, "nil"); */
+ continue;
+
+ sqlite3_stmt *stmt = (sqlite3_stmt *)env->get_user_ptr(env, args[i]);
+ NON_LOCAL_EXIT_CHECK(env);
+
+ sqlite3_finalize(stmt);
+ env->set_user_ptr(env, args[i], 0);
+ DEBUG(env, "%s: #%d finalized", __func__, i);
+ }
- INFO(env, "%s: entered", __func__);
- sqlite3_finalize(stmt);
- env->set_user_ptr(env, args[0], 0);
return SYM(env, "nil");
}
@@ -965,7 +970,7 @@ int emacs_module_init(struct emacs_runtime *ert) {
"Close a SQLite3 database." },
{ "sqlite3-prepare", 2, 2, sqlite3_api_prepare,
"Prepare (compile) a SQL statement." },
- { "sqlite3-finalize", 1, 1, sqlite3_api_finalize,
+ { "sqlite3-finalize", 1, 127, sqlite3_api_finalize,
"Destroy a prepared statement." },
{ "sqlite3-changes", 1, 1, sqlite3_api_changes,
"Count the number of rows modified." },
- [nongnu] elpa/sqlite3 b8fc4e2fae 35/62: TOC, (continued)
- [nongnu] elpa/sqlite3 b8fc4e2fae 35/62: TOC, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 15697800f8 37/62: Fixed changelog, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 9a2dbb9dc2 38/62: fixed typo, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 f2c30e8b86 16/62: removed 'Package Version', ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 bdb5832e27 17/62: removed 'Package Version' from sqlite3-api-constants.el, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 639ffb711e 20/62: all .el files removed., ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 96e1cdfaa8 34/62: Rewrote README in org, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 33525c1976 29/62: Emacs 26.0-pretest test added, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 00f4591f25 36/62: Fixed TOC, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 d2b2032977 51/62: Update README.org, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 b6868d2437 27/62: sqlite3-finalize accepts multiple params,
ELPA Syncer <=
- [nongnu] elpa/sqlite3 a47384ef04 13/62: moved sqlite3-api-constants.el to tools/, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 b619a38eb5 25/62: fixed typos, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 781f915cd4 31/62: added sqlite3-fetch_alist, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 f702217d7b 32/62: Removed gcc warnings, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 e0943d0f90 39/62: Let users override make variables if necessary, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 e5b14b0318 46/62: Bump version to 0.14, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 d03bda0360 47/62: replaced == with eq in type predicates, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 75d89d64e6 49/62: Typo?, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 1caff0e721 52/62: Merge branch 'master' of github.com:pekingduck/emacs-sqlite3-api, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 68eda59d5f 55/62: Bumped version to 0.16, ELPA Syncer, 2023/03/14