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

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

[nongnu] elpa/sqlite3 0d4ca93830 33/62: Removed gcc warnings


From: ELPA Syncer
Subject: [nongnu] elpa/sqlite3 0d4ca93830 33/62: Removed gcc warnings
Date: Tue, 14 Mar 2023 11:01:47 -0400 (EDT)

branch: elpa/sqlite3
commit 0d4ca93830f61cda96942ece486966737520b74d
Author: Uphill Battler <code@uphill.me>
Commit: Uphill Battler <code@uphill.me>

    Removed gcc warnings
---
 .gitignore          |   3 +-
 Makefile            |  30 ++++------
 README-in.md        |  29 ++++++++--
 README.md           | 161 +++++++++++++++++++++++++++++-----------------------
 consts.c            |  16 +++++-
 sqlite3-api.c       |   2 +-
 tools/gen-consts.sh |  13 ++++-
 7 files changed, 152 insertions(+), 102 deletions(-)

diff --git a/.gitignore b/.gitignore
index b770ade4ff..2478bd3050 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@
 **/.DS_Store
 sqlite3-napi-module-with-create-function.c
 xxx.el
-**/sqlite3-api-*
\ No newline at end of file
+**/sqlite3-api-*
+consts.c
\ No newline at end of file
diff --git a/Makefile b/Makefile
index ceb4d18f6a..b9d329ee3a 100644
--- a/Makefile
+++ b/Makefile
@@ -9,18 +9,14 @@ endif
 
 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
-EMACS260=$(HOME)/test-emacs-260/bin/emacs --module-assertions
-EMACS261=/Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_10
+EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_14
 
 # Melpa package
 PKG=sqlite3-api
 
 # dynamic module package
 MODULE=$(PKG)
-MODULE_VERSION=0.12
+MODULE_VERSION=0.13
 MODULE_BASENAME=$(MODULE)-$(MODULE_VERSION)
 MODULE_PKG_EL=$(MODULE_BASENAME)/$(MODULE)-pkg.el
 MODULE_TAR=$(MODULE_BASENAME).tar
@@ -32,7 +28,7 @@ clean:
 
 # File "MODULE" is read by (sqlite3-api-install-dynamic-module)
 # during installation
-module: $(MODULE).so 
+module: $(MODULE).so
        mkdir -p $(MODULE_BASENAME)
        cp $(MODULE).so $(MODULE_BASENAME)
        echo "(define-package \"$(MODULE)\" \"$(MODULE_VERSION)\" \"SQLite3 API 
dynamic module\")" > $(MODULE_PKG_EL)
@@ -43,6 +39,12 @@ install: module
 
 doc: README.md
 
+# create constants based on sqlite3.h
+consts:
+       tools/gen-consts.sh > consts.c
+
+# Create README.md
+# md-toc.py inserts a TOC into the markdown file
 README.md: README-in.md
        tools/md-toc.py $< > $@
 
@@ -54,16 +56,4 @@ README.md: README-in.md
 
 # Emacs 25.3
 test:
-       $(EMACS253) -batch -Q -L . -l tests/regression.el
-
-t252:
-       $(EMACS252) -batch -Q -L . -l tests/regression.el
-
-t251:
-       $(EMACS251) -batch -Q -L . -l tests/regression.el
-
-t260:
-       $(EMACS260) -batch -Q -L . -l tests/regression.el       
-
-t261:
-       $(EMACS261) -batch -Q -L . -l tests/regression.el
+       $(EMACS) -batch -Q -L . -l tests/regression.el
diff --git a/README-in.md b/README-in.md
index 6c17b7275e..66d3d2ae0b 100644
--- a/README-in.md
+++ b/README-in.md
@@ -1,4 +1,4 @@
-# SQLite3 API v0.11 for Emacs 25+
+# SQLite3 API 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
@@ -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 v0.11.
+The current version is v0.12.
 
 This is an alpha release so it might crash your Emacs. Save your work before 
you try it out!
 
@@ -37,28 +37,31 @@ This is an alpha release so it might crash your Emacs. Save 
your work before you
 
 It's been tested on macOS (Sierra) and CentOS 7.
 ## Installation
+### Manual
 ~~~sh
 $ git co https://github.com/pekingduck/emacs-sqlite3-api
 $ cd emacs-sqlite3-api
 $ make
 $ cp sqlite3-api.so /your/elisp/load-path/
 ~~~
-<!--
+
+### Package
 ~~~sh
 $ git co https://github.com/pekingduck/emacs-sqlite3-api
 $ cd emacs-sqlite3-api
 $ make module
+$
 ~~~
 A tar archive called `sqlite3-api-X.Y.tar` will be created. Do a `M-x 
package-install-file` in Emacs to install that tar archive and 
 you'll all set.
--->
+
 For Mac users:
 ~~~sh
 $ make HOMEBREW=1
 ~~~
 to build the module against sqlite3 installed by homebrew.
 
-If you have sqlite3 installed in a nonstandard location, you can do
+If you have sqlite3 installed in a nonstandard location:
 ~~~sh
 $ make INC=/path/to/sqlite3/include LIB="-L/path/to/sqlite3/lib -lsqlite3"
 ~~~
@@ -237,6 +240,10 @@ Note: Column number starts from 0.
 (sqlite3-column-double statement-handle column-no)
 ~~~
 The above functions retrieve data of the specified column.
+~~~el
+(sqlite3-column-name statement-handle column-no)
+~~~
+This function returns the column name of the specified column.
 
 Note: You can call `sqlite3-column-xxx` on a column even 
 if `sqlite3-column-type` returns `sqlite-yyy`: the SQLite3 engine will
@@ -258,6 +265,14 @@ Example:
 convenience. It retrieves the current row as a 
 list without having to deal with sqlite3-column-* explicitly.
 
+### sqlite3-fetch-alist
+~~~el
+(sqlite3-fetch-alist statement-handle)
+~~~
+`sqlite3-fetch-alist` is not part of the official API but provided for 
+convenience. It retrieves the current row as an
+alist in the form of `(("col_name1" . value1) ("col_name2" . value2) ..)`
+
 ## Transaction Support
 Use `sqlite3-exec` to start, commit and rollback a transaction:
 ~~~el
@@ -299,6 +314,10 @@ 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.12 - 2019-05-12
+- `sqlite3-fetch-alist` added
+- Fixed a compilation problem on macOS Mojave
+
 *v0.11 - 2017-09-14*
 - `sqlite3-finalize` now accepts multiple handles.
 
diff --git a/README.md b/README.md
index 92ccd577c0..e06139e06b 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-# SQLite3 API v0.11 for Emacs 25+
-`sqlite3-api` is a dynamic module for GNU Emacs 25+ that provides 
+# SQLite3 API 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
 (require 'sqlite3-api)
@@ -25,35 +25,37 @@ 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 v0.11.
+The current version is v0.12.
 
 This is an alpha release so it might crash your Emacs. Save your work before 
you try it out!
 
-## Table of Contents
 * [Requirements](#1)
 * [Installation](#2)
-* [API](#3)
-    * [sqlite3-open](#3-1)
-    * [sqlite3-close](#3-2)
-    * [sqlite3-prepare](#3-3)
-    * [sqlite3-finalize](#3-4)
-    * [sqlite3-step](#3-5)
-    * [sqlite3-changes](#3-6)
-    * [sqlite3-reset](#3-7)
-    * [sqlite3-last-insert-rowid](#3-8)
-    * [sqlite3-get-autocommit](#3-9)
-    * [sqlite3-exec](#3-10)
-    * [sqlite3-bind-*](#3-11)
-    * [sqlite3-bind-multi](#3-12)
-    * [sqlite3-column-*](#3-13)
-    * [sqlite3-fetch](#3-14)
-* [Transaction Support](#4)
-* [Error Handling](#5)
-* [A Note on Garbage Collection](#6)
-* [Known Problems](#7)
-* [License](#8)
-* [Changelog](#9)
-* [Useful Links for Writing Dynamic Modules](#10)
+    * [Manual](#3)
+    * [Package](#4)
+* [API](#5)
+    * [sqlite3-open](#6)
+    * [sqlite3-close](#7)
+    * [sqlite3-prepare](#8)
+    * [sqlite3-finalize](#9)
+    * [sqlite3-step](#10)
+    * [sqlite3-changes](#11)
+    * [sqlite3-reset](#12)
+    * [sqlite3-last-insert-rowid](#13)
+    * [sqlite3-get-autocommit](#14)
+    * [sqlite3-exec](#15)
+    * [sqlite3-bind-*](#16)
+    * [sqlite3-bind-multi](#17)
+    * [sqlite3-column-*](#18)
+    * [sqlite3-fetch](#19)
+    * [sqlite3-fetch-alist](#20)
+* [Transaction Support](#21)
+* [Error Handling](#22)
+* [A Note on Garbage Collection](#23)
+* [Known Problems](#24)
+* [License](#25)
+* [Changelog](#26)
+* [Useful Links for Writing Dynamic Modules](#27)
 
 ## <a name="1"/> Requirements
 - Emacs 25.1 or above, compiled with module support (`./configure 
--with-modules`)
@@ -62,28 +64,31 @@ This is an alpha release so it might crash your Emacs. Save 
your work before you
 
 It's been tested on macOS (Sierra) and CentOS 7.
 ## <a name="2"/> Installation
+### <a name="3"/> Manual
 ~~~sh
 $ git co https://github.com/pekingduck/emacs-sqlite3-api
 $ cd emacs-sqlite3-api
 $ make
 $ cp sqlite3-api.so /your/elisp/load-path/
 ~~~
-<!--
+
+### <a name="4"/> Package
 ~~~sh
 $ git co https://github.com/pekingduck/emacs-sqlite3-api
 $ cd emacs-sqlite3-api
 $ make module
+$
 ~~~
-A tar archive called `sqlite3-api-X.Y.tar` will be created. Do a `M-x 
package-install-file` in Emacs to install that tar archive and 
+A tar archive called `sqlite3-api-X.Y.tar` will be created. Do a `M-x 
package-install-file` in Emacs to install that tar archive and
 you'll all set.
--->
+
 For Mac users:
 ~~~sh
 $ make HOMEBREW=1
 ~~~
 to build the module against sqlite3 installed by homebrew.
 
-If you have sqlite3 installed in a nonstandard location, you can do
+If you have sqlite3 installed in a nonstandard location:
 ~~~sh
 $ make INC=/path/to/sqlite3/include LIB="-L/path/to/sqlite3/lib -lsqlite3"
 ~~~
@@ -92,13 +97,13 @@ Currently there's no way to reload a dynamic module in Emacs
 If you are updating from an older version, you'll need to restart Emacs
 for the new module to take effect.
 
-## <A NAME="3"/> API
+## <a name="5"/> API
 To load the package, put the following in your `.emacs`:
 ~~~el
 (require 'sqlite3-api)
 ~~~
 
-An application will typically use sqlite3_open() to create a single database 
connection during initialization. 
+An application will typically use sqlite3_open() to create a single database 
connection during initialization.
 
 To run an SQL statement, the application follows these steps:
 
@@ -113,10 +118,10 @@ To run an SQL statement, the application follows these 
steps:
 In elisp they are in lowercase and words are separated by "-" instead of
 "_". For example, `SQLITE_OK` would be `sqlite-ok`.
 
-[www.sqlite.org](https://www.sqlite.org) is always a good source of 
information, especially 
+[www.sqlite.org](https://www.sqlite.org) is always a good source of 
information, especially
 [An Introduction to the SQLite C/C++ 
Interface](https://www.sqlite.org/cintro.html) and [C/C++ API 
Reference](https://www.sqlite.org/c3ref/intro.html).
 
-### <a name="3-1"/> sqlite3-open
+### <a name="6"/> sqlite3-open
 ~~~el
 (sqlite3-open "/path/to/data-file" flag1 flag2 ...)
 ~~~
@@ -125,24 +130,24 @@ Open the database file and return a database handle.
 This function calls 
[`sqlite3_open_v2()`](https://www.sqlite.org/c3ref/open.html) internally and 
raises `'db-error` in case of error.
 
 *flag1*, *flag2*.... will be ORed together.
-### <a name="3-2"/> sqlite3-close
+### <a name="7"/> sqlite3-close
 ~~~el
 (sqlite3-close database-handle)
 ~~~
 Close the database file.
-### <a name="3-3"/> sqlite3-prepare
+### <a name="8"/> sqlite3-prepare
 ~~~el
 (sqlite3-prepare database-handle sql-statement)
 ~~~
 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
+### <a name="9"/> sqlite3-finalize
 ~~~el
 (sqlite3-finalize statement-handle1 statement-handle2 ...)
 ~~~
 Destroy prepared statements.
-### <a name="3-5"/> sqlite3-step
+### <a name="10"/> sqlite3-step
 ~~~el
 (sqlite3-step statement-handle)
 ~~~
@@ -150,34 +155,34 @@ Execute a prepared SQL statement. Some of the return 
codes are:
 
 `sqlite-done` - the statement has finished executing successfully.
 
-`sqlite-row` - if the SQL statement being executed returns any data, then 
`sqlite-row` is returned each time a new row of data is ready for processing by 
the caller. 
+`sqlite-row` - if the SQL statement being executed returns any data, then 
`sqlite-row` is returned each time a new row of data is ready for processing by 
the caller.
 
-### <a name="3-6"/> sqlite3-changes
+### <a name="11"/> sqlite3-changes
 ~~~el
 (sqlite3-changes database-handle)
 ~~~
 Return the number of rows modified (for update/delete/insert statements)
 
-### <a name="3-7"/> sqlite3-reset
+### <a name="12"/> sqlite3-reset
 ~~~el
 (sqlite3-reset statement-handle)
 ~~~
-Reset a prepared statement. Call this function if you want to re-bind 
+Reset a prepared statement. Call this function if you want to re-bind
 the statement to new variables, or to re-execute the prepared statement
 from the start.
-### <a name="3-8"/> sqlite3-last-insert-rowid
+### <a name="13"/> sqlite3-last-insert-rowid
 ~~~el
 (sqlite3-last-insert-rowid database-handle)
 ~~~
-Retrieve the last inserted rowid (64 bit). 
+Retrieve the last inserted rowid (64 bit).
 
 Notes: Beware that Emacs only supports integers up to 61 bits.
-### <a name="3-9"/> sqlite3-get-autocommit
+### <a name="14"/> sqlite3-get-autocommit
 ~~~el
 (sqlite3-get-autocommit database-handle)
 ~~~
 Return 1 / 0 if auto-commit mode is ON / OFF.
-### <a name="3-10"/> sqlite3-exec
+### <a name="15"/> sqlite3-exec
 ~~~el
 (sqlite3-exec database-handle sql-statements &optional callback)
 ~~~
@@ -185,11 +190,11 @@ The Swiss Army Knife of the API, you can execute multiple 
SQL statements
 (separated by ";") in a row with just one call.
 
 The callback function, if supplied, is invoked for *each row* and should 
accept 3
- parameters: 
+ parameters:
  1. the first parameter is the number of columns in the current row;
- 2. the second parameter is the actual data (as a list strings or nil in case 
of NULL); 
- 3. the third one is a list of column names. 
- 
+ 2. the second parameter is the actual data (as a list strings or nil in case 
of NULL);
+ 3. the third one is a list of column names.
+
 To signal an error condition inside the callback, return `nil`.
 `sqlite3_exec()` will stop the execution and raise 'db-error.
 
@@ -202,7 +207,7 @@ An example of a callback:
            (message "[Column %d/%d]%s=%s" (1+ i) ncols (elt names i) (elt data 
i)))
   (message "--------------------")
   t)
-  
+
 (sqlite3-exec dbh "select * from table_a; select * from table b"
               #'print-row)
 ~~~
@@ -214,7 +219,7 @@ More examples:
 ;; Retrieve the metadata of columns in a table
 (sqlite3-exec dbh "pragma table_info(table)" #'print-row)
 ~~~
-### <a name="3-11"/> sqlite3-bind-*
+### <a name="16"/> sqlite3-bind-*
 ~~~el
 (sqlite3-bind-text statement-handle column-no value)
 (sqlite3-bind-int64 statement-handle column-no value)
@@ -227,21 +232,21 @@ Please note that column number starts from 1, not 0!
 ~~~el
 (sqlite3-bind-parameter-count statement-handle)
 ~~~
-The above functions returns the number of SQL parameters of a prepared 
+The above functions returns the number of SQL parameters of a prepared
 statement.
-### <a name="3-12"/> sqlite3-bind-multi
+### <a name="17"/> sqlite3-bind-multi
 ~~~el
 (sqlite3-bind-multi statement-handle &rest params)
 ~~~
-`sqlite3-bind-multi` binds multiple parameters to a prepared SQL 
-statement. It is not part of the official API but is provided for 
+`sqlite3-bind-multi` binds multiple parameters to a prepared SQL
+statement. It is not part of the official API but is provided for
 convenience.
 
 Example:
 ~~~el
 (sqlite3-bind-multi stmt 1234 "a" 1.555 nil) ;; nil for NULL
 ~~~
-### <a name="3-13"/> sqlite3-column-*
+### <a name="18"/> sqlite3-column-*
 These column functions are used to retrieve the current row
 of the result set.
 
@@ -253,7 +258,7 @@ Return number of columns in a result set.
 (sqlite3-column-type statement-handle column-no)
 ~~~
 Return the type (`sqlite-integer`, `sqlite-float`, `sqlite3-text` or
-`sqlite-null`) of the specified column. 
+`sqlite-null`) of the specified column.
 
 Note: Column number starts from 0.
 ~~~el
@@ -263,7 +268,7 @@ Note: Column number starts from 0.
 ~~~
 The above functions retrieve data of the specified column.
 
-Note: You can call `sqlite3-column-xxx` on a column even 
+Note: You can call `sqlite3-column-xxx` on a column even
 if `sqlite3-column-type` returns `sqlite-yyy`: the SQLite3 engine will
 perform the necessary type conversion.
 
@@ -275,15 +280,23 @@ Example:
              (age (sqlite3-column-int64 stmt 1)))
       (message "name: %s, age: %d" name age)))
 ~~~
-### <a name="3-14"/> sqlite3-fetch
+### <a name="19"/> sqlite3-fetch
 ~~~el
 (sqlite3-fetch statement-handle) ;; returns a list such as (123 56 "Peter 
Smith" nil)
 ~~~
-`sqlite3-fetch` is not part of the official API but provided for 
-convenience. It retrieves the current row as a 
+`sqlite3-fetch` is not part of the official API but provided for
+convenience. It retrieves the current row as a
 list without having to deal with sqlite3-column-* explicitly.
 
-## <a name="4"/> Transaction Support
+### <a name="20"/> sqlite3-fetch-alist
+~~~el
+(sqlite3-fetch-alist statement-handle)
+~~~
+`sqlite3-fetch-alist` is not part of the official API but provided for
+convenience. It retrieves the current row as an
+alist in the form of `(("col_name1" . value1) ("col_name2" . value2) ..)`
+
+## <a name="21"/> Transaction Support
 Use `sqlite3-exec` to start, commit and rollback a transaction:
 ~~~el
 (sqlite3-exec dbh "begin")
@@ -291,7 +304,7 @@ Use `sqlite3-exec` to start, commit and rollback a 
transaction:
 (sqlite3-exec dbh "rollback")
 ~~~
 See Error Handling below on how to use the 
[`condition-case`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Handling-Errors.html)
 form to handle rollback.
-## <a name="5"/> Error Handling
+## <a name="22"/> Error Handling
 Currently two error symbols are defined in `sqlite3-api.el`:
 1. `sql-error` is raised by `sqlite3-prepare`
 2. `db-error` is raised by `sqlite3-open` and `sqlite3-exec`
@@ -306,24 +319,28 @@ Currently two error symbols are defined in 
`sqlite3-api.el`:
    (message "Symbol:%s, Message:%s, Error Code:%d" (elt db-err 0) (elt db-err 
1) (elt db-err 2))
    (sqlite3-exec dbh "rollback")))
 ~~~
-`db-err` is a list containing the error symbol (`db-error` or `sql-error`), an 
error message and finally an error code returned from the 
+`db-err` is a list containing the error symbol (`db-error` or `sql-error`), an 
error message and finally an error code returned from the
 corresponding SQLite
 C API.
 
-## <a name="6"/> A Note on Garbage Collection
-Since Emacs's garbage collection is non-deterministic, it would be 
-a good idea 
+## <a name="23"/> A Note on Garbage Collection
+Since Emacs's garbage collection is non-deterministic, it would be
+a good idea
 to manually free database/statement handles once they are not needed.
 
-## <a name="7"/> Known Problems
+## <a name="24"/> Known Problems
 - SQLite3 supports 64 bit integers but Emacs integers are only 61 bits.
 For integers > 61 bits you can retrieve them as text as a workaround.
 - BLOB and TEXT columns with embedded NULLs are not supported.
 
-## <a name="8"/> License
+## <a name="25"/> License
 The code is licensed under the [GNU GPL 
v3](https://www.gnu.org/licenses/gpl-3.0.html).
 
-## <a name="9"/> Changelog
+## <a name="26"/> Changelog
+*v0.12 - 2019-05-12
+- `sqlite3-fetch-alist` added
+- Fixed a compilation problem on macOS Mojave
+
 *v0.11 - 2017-09-14*
 - `sqlite3-finalize` now accepts multiple handles.
 
@@ -334,6 +351,6 @@ The code is licensed under the [GNU GPL 
v3](https://www.gnu.org/licenses/gpl-3.0
 - Fixed a memory leak in `sql_api_exec()`
 - Changed `sqlite3_close()` to `sqlite3_close_v2()` in `sqlite_api_close()`
 - Better error handling: Error code is returned along with error message
-## <a name="10"/> Useful Links for Writing Dynamic Modules
+## <a name="27"/> Useful Links for Writing Dynamic Modules
 - https://phst.github.io/emacs-modules
 - http://nullprogram.com/blog/2016/11/05/
diff --git a/consts.c b/consts.c
index b0d30bc1b7..aa468e79bb 100644
--- a/consts.c
+++ b/consts.c
@@ -1,3 +1,8 @@
+/*
+  Auto-generated 2020-04-14 20:31:47
+  Based on 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h
+*/
+
 defconst(env, "sqlite-version", env->make_string(env, SQLITE_VERSION, 
strlen(SQLITE_VERSION)));
 defconst(env, "sqlite-version-number", env->make_integer(env, 
SQLITE_VERSION_NUMBER));
 defconst(env, "sqlite-source-id", env->make_string(env, SQLITE_SOURCE_ID, 
strlen(SQLITE_SOURCE_ID)));
@@ -180,6 +185,8 @@ defconst(env, "sqlite-fcntl-begin-atomic-write", 
env->make_integer(env, SQLITE_F
 defconst(env, "sqlite-fcntl-commit-atomic-write", env->make_integer(env, 
SQLITE_FCNTL_COMMIT_ATOMIC_WRITE));
 defconst(env, "sqlite-fcntl-rollback-atomic-write", env->make_integer(env, 
SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE));
 defconst(env, "sqlite-fcntl-lock-timeout", env->make_integer(env, 
SQLITE_FCNTL_LOCK_TIMEOUT));
+defconst(env, "sqlite-fcntl-data-version", env->make_integer(env, 
SQLITE_FCNTL_DATA_VERSION));
+defconst(env, "sqlite-fcntl-size-limit", env->make_integer(env, 
SQLITE_FCNTL_SIZE_LIMIT));
 defconst(env, "sqlite-get-lockproxyfile", env->make_integer(env, 
SQLITE_GET_LOCKPROXYFILE));
 defconst(env, "sqlite-set-lockproxyfile", env->make_integer(env, 
SQLITE_SET_LOCKPROXYFILE));
 defconst(env, "sqlite-last-errno", env->make_integer(env, SQLITE_LAST_ERRNO));
@@ -218,6 +225,7 @@ defconst(env, "sqlite-config-pmasz", env->make_integer(env, 
SQLITE_CONFIG_PMASZ)
 defconst(env, "sqlite-config-stmtjrnl-spill", env->make_integer(env, 
SQLITE_CONFIG_STMTJRNL_SPILL));
 defconst(env, "sqlite-config-small-malloc", env->make_integer(env, 
SQLITE_CONFIG_SMALL_MALLOC));
 defconst(env, "sqlite-config-sorterref-size", env->make_integer(env, 
SQLITE_CONFIG_SORTERREF_SIZE));
+defconst(env, "sqlite-config-memdb-maxsize", env->make_integer(env, 
SQLITE_CONFIG_MEMDB_MAXSIZE));
 defconst(env, "sqlite-dbconfig-maindbname", env->make_integer(env, 
SQLITE_DBCONFIG_MAINDBNAME));
 defconst(env, "sqlite-dbconfig-lookaside", env->make_integer(env, 
SQLITE_DBCONFIG_LOOKASIDE));
 defconst(env, "sqlite-dbconfig-enable-fkey", env->make_integer(env, 
SQLITE_DBCONFIG_ENABLE_FKEY));
@@ -228,6 +236,8 @@ defconst(env, "sqlite-dbconfig-no-ckpt-on-close", 
env->make_integer(env, SQLITE_
 defconst(env, "sqlite-dbconfig-enable-qpsg", env->make_integer(env, 
SQLITE_DBCONFIG_ENABLE_QPSG));
 defconst(env, "sqlite-dbconfig-trigger-eqp", env->make_integer(env, 
SQLITE_DBCONFIG_TRIGGER_EQP));
 defconst(env, "sqlite-dbconfig-reset-database", env->make_integer(env, 
SQLITE_DBCONFIG_RESET_DATABASE));
+defconst(env, "sqlite-dbconfig-defensive", env->make_integer(env, 
SQLITE_DBCONFIG_DEFENSIVE));
+defconst(env, "sqlite-dbconfig-writable-schema", env->make_integer(env, 
SQLITE_DBCONFIG_WRITABLE_SCHEMA));
 defconst(env, "sqlite-dbconfig-max", env->make_integer(env, 
SQLITE_DBCONFIG_MAX));
 defconst(env, "sqlite-deny", env->make_integer(env, SQLITE_DENY));
 defconst(env, "sqlite-ignore", env->make_integer(env, SQLITE_IGNORE));
@@ -282,6 +292,8 @@ defconst(env, "sqlite-limit-variable-number", 
env->make_integer(env, SQLITE_LIMI
 defconst(env, "sqlite-limit-trigger-depth", env->make_integer(env, 
SQLITE_LIMIT_TRIGGER_DEPTH));
 defconst(env, "sqlite-limit-worker-threads", env->make_integer(env, 
SQLITE_LIMIT_WORKER_THREADS));
 defconst(env, "sqlite-prepare-persistent", env->make_integer(env, 
SQLITE_PREPARE_PERSISTENT));
+defconst(env, "sqlite-prepare-normalize", env->make_integer(env, 
SQLITE_PREPARE_NORMALIZE));
+defconst(env, "sqlite-prepare-no-vtab", env->make_integer(env, 
SQLITE_PREPARE_NO_VTAB));
 defconst(env, "sqlite-integer", env->make_integer(env, SQLITE_INTEGER));
 defconst(env, "sqlite-float", env->make_integer(env, SQLITE_FLOAT));
 defconst(env, "sqlite-blob", env->make_integer(env, SQLITE_BLOB));
@@ -293,8 +305,6 @@ defconst(env, "sqlite-utf16", env->make_integer(env, 
SQLITE_UTF16));
 defconst(env, "sqlite-any", env->make_integer(env, SQLITE_ANY));
 defconst(env, "sqlite-utf16-aligned", env->make_integer(env, 
SQLITE_UTF16_ALIGNED));
 defconst(env, "sqlite-deterministic", env->make_integer(env, 
SQLITE_DETERMINISTIC));
-defconst(env, "sqlite-static", env->make_integer(env, SQLITE_STATIC));
-defconst(env, "sqlite-transient", env->make_integer(env, SQLITE_TRANSIENT));
 defconst(env, "sqlite-index-scan-unique", env->make_integer(env, 
SQLITE_INDEX_SCAN_UNIQUE));
 defconst(env, "sqlite-index-constraint-eq", env->make_integer(env, 
SQLITE_INDEX_CONSTRAINT_EQ));
 defconst(env, "sqlite-index-constraint-gt", env->make_integer(env, 
SQLITE_INDEX_CONSTRAINT_GT));
@@ -310,6 +320,7 @@ defconst(env, "sqlite-index-constraint-isnot", 
env->make_integer(env, SQLITE_IND
 defconst(env, "sqlite-index-constraint-isnotnull", env->make_integer(env, 
SQLITE_INDEX_CONSTRAINT_ISNOTNULL));
 defconst(env, "sqlite-index-constraint-isnull", env->make_integer(env, 
SQLITE_INDEX_CONSTRAINT_ISNULL));
 defconst(env, "sqlite-index-constraint-is", env->make_integer(env, 
SQLITE_INDEX_CONSTRAINT_IS));
+defconst(env, "sqlite-index-constraint-function", env->make_integer(env, 
SQLITE_INDEX_CONSTRAINT_FUNCTION));
 defconst(env, "sqlite-mutex-fast", env->make_integer(env, SQLITE_MUTEX_FAST));
 defconst(env, "sqlite-mutex-recursive", env->make_integer(env, 
SQLITE_MUTEX_RECURSIVE));
 defconst(env, "sqlite-mutex-static-master", env->make_integer(env, 
SQLITE_MUTEX_STATIC_MASTER));
@@ -340,6 +351,7 @@ defconst(env, "sqlite-testctrl-reserve", 
env->make_integer(env, SQLITE_TESTCTRL_
 defconst(env, "sqlite-testctrl-optimizations", env->make_integer(env, 
SQLITE_TESTCTRL_OPTIMIZATIONS));
 defconst(env, "sqlite-testctrl-iskeyword", env->make_integer(env, 
SQLITE_TESTCTRL_ISKEYWORD));
 defconst(env, "sqlite-testctrl-scratchmalloc", env->make_integer(env, 
SQLITE_TESTCTRL_SCRATCHMALLOC));
+defconst(env, "sqlite-testctrl-internal-functions", env->make_integer(env, 
SQLITE_TESTCTRL_INTERNAL_FUNCTIONS));
 defconst(env, "sqlite-testctrl-localtime-fault", env->make_integer(env, 
SQLITE_TESTCTRL_LOCALTIME_FAULT));
 defconst(env, "sqlite-testctrl-explain-stmt", env->make_integer(env, 
SQLITE_TESTCTRL_EXPLAIN_STMT));
 defconst(env, "sqlite-testctrl-once-reset-threshold", env->make_integer(env, 
SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD));
diff --git a/sqlite3-api.c b/sqlite3-api.c
index 774b964ff2..b8928e52e7 100644
--- a/sqlite3-api.c
+++ b/sqlite3-api.c
@@ -1092,7 +1092,7 @@ int emacs_module_init(struct emacs_runtime *ert) {
     sqlite3_api_log_level = SQLITE3_LOG_LEVEL_ERROR;
 
     /* consts.c includes all the (defconst sqlite-xxx ....) function
-       calls which is generated by tools/gen-consts.py */
+       calls which is generated by tools/gen-consts.sh */
 #include "consts.c"
 
     define_error(env, "db-error", "Database Error");
diff --git a/tools/gen-consts.sh b/tools/gen-consts.sh
index ebda553bb9..2fac34da16 100755
--- a/tools/gen-consts.sh
+++ b/tools/gen-consts.sh
@@ -1,4 +1,15 @@
 #!/bin/bash
 # locate the path of sqlite3.h
 # Take -I... as the only argument
-echo '#include <sqlite3.h>' | gcc $* -x c -H -fsyntax-only - 2>&1 | grep '^\. 
' | cut -f2 -d' '
+DIR=$(dirname $0)
+NOW=$(date '+%Y-%m-%d %H:%M:%S')
+SQLITE3_H=$(echo '#include <sqlite3.h>' | gcc $* -x c -H -fsyntax-only - 2>&1 
| grep '^\. ' | cut -f2 -d' ')
+
+cat<<EOF
+/*
+  Auto-generated $NOW
+  Based on $SQLITE3_H
+*/
+
+EOF
+grep '^#define SQLITE_' $SQLITE3_H | grep -v 'SQLITE_TRANSIENT' | grep -v 
SQLITE_STATIC | $DIR/gen-consts.py



reply via email to

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