aboutsummaryrefslogtreecommitdiff
path: root/sqlite3
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2021-01-10 13:12:36 +1000
committerSteve Bennett <steveb@workware.net.au>2021-01-10 15:33:15 +1000
commit8f3e1ce80995c42a200db98fbfe02e4a60771c26 (patch)
tree79cfcc498292df506fb71660caa3527f03823246 /sqlite3
parenta95647743db1816f54368c8b515b6cc6d4c3c745 (diff)
downloadjimtcl-8f3e1ce80995c42a200db98fbfe02e4a60771c26.zip
jimtcl-8f3e1ce80995c42a200db98fbfe02e4a60771c26.tar.gz
jimtcl-8f3e1ce80995c42a200db98fbfe02e4a60771c26.tar.bz2
package: add ABI version checking
jim.h now includes JIM_ABI_VERSION that should be incremented whenever the ABI changes. Then all loadable modules should call Jim_CheckAbiVersion() to make sure they are loaded against the correct version. Add Jim_PackageProvideCheck() that does both Jim_CheckAbiVersion() and Jim_PackageProvide() to simplify the implementation of loadable extensions. Also rename the "big" sqlite3 extension to just sqlite to avoid a naming conflict with the smaller jim-sqlite3 extension. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'sqlite3')
-rw-r--r--sqlite3/Makefile8
-rw-r--r--sqlite3/README16
-rw-r--r--sqlite3/jim-sqlite.c (renamed from sqlite3/jim-sqlite3.c)6
-rw-r--r--sqlite3/test-sqlite.tcl (renamed from sqlite3/test-sqlite3.tcl)6
4 files changed, 17 insertions, 19 deletions
diff --git a/sqlite3/Makefile b/sqlite3/Makefile
index 2b69ae4..3b920cf 100644
--- a/sqlite3/Makefile
+++ b/sqlite3/Makefile
@@ -1,16 +1,16 @@
# Builds the full sqlite3 extension for Jim Tcl with the sqlite3 amalgamation
-all: sqlite3.so
+all: sqlite.so
SQLITE3_OPTS := -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
-DSQLITE_ENABLE_STAT3 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_OMIT_INCRBLOB
-sqlite3.so: jim-sqlite3.c sqlite3.c
+sqlite.so: jim-sqlite.c sqlite3.c
./build-ext -Wall -o $@ -I.. -L.. $(SQLITE3_OPTS) $(BUILDOPTS) $^
clean:
rm -f *.o *.so
# Note that this will only work when not cross compiling
-test: sqlite3.so
- ../jimsh test-sqlite3.tcl
+test: sqlite.so
+ ../jimsh test-sqlite.tcl
diff --git a/sqlite3/README b/sqlite3/README
index d1094dd..297c3de 100644
--- a/sqlite3/README
+++ b/sqlite3/README
@@ -13,14 +13,14 @@ Ensure that you have configured and built jim in the source directory, then:
$ make
-./build-ext -o sqlite3.so -I.. -L.. -DSQLITE_OMIT_LOAD_EXTENSION=1 ... jim-sqlite3.c sqlite3.c
-Building sqlite3.so from jim-sqlite3.c sqlite3.c
+./build-ext -o sqlite.so -I.. -L.. -DSQLITE_OMIT_LOAD_EXTENSION=1 ... jim-sqlite.c sqlite3.c
+Building sqlite.so from jim-sqlite.c sqlite3.c
Warning: libjim is static. Dynamic module may not work on some platforms.
-Compile: jim-sqlite3.o
+Compile: jim-sqlite.o
Compile: sqlite3.o
-Link: sqlite3.so
+Link: sqlite.so
Success!
@@ -32,17 +32,17 @@ $ make test
Installing
----------
-Copy sqlite3.so to your jim library directory, typically /usr/local/lib/jim or
+Copy sqlite.so to your jim library directory, typically /usr/local/lib/jim or
where $JIMLIB points to.
Using
-----
-In your Jim Tcl code, ensure that sqlite3.so is in a directory on $auto_path.
+In your Jim Tcl code, ensure that sqlite.so is in a directory on $auto_path.
Then:
- package require sqlite3
+ package require sqlite
- sqlite3 db test.db
+ sqlite db test.db
...etc..
Documentation
diff --git a/sqlite3/jim-sqlite3.c b/sqlite3/jim-sqlite.c
index 8f33d80..06ed7c0 100644
--- a/sqlite3/jim-sqlite3.c
+++ b/sqlite3/jim-sqlite.c
@@ -2821,10 +2821,8 @@ static int DbMain(Jim_Interp *interp, int objc, Jim_Obj *const*objv){
** used to open a new SQLite database. See the DbMain() routine above
** for additional information.
*/
-EXTERN int Jim_sqlite3Init(Jim_Interp *interp){
- Jim_CreateCommand(interp, "sqlite3", DbMain, 0, 0);
- Jim_PackageProvide(interp, "sqlite3", PACKAGE_VERSION, 0);
+EXTERN int Jim_sqliteInit(Jim_Interp *interp){
+ Jim_PackageProvideCheck(interp, "sqlite");
Jim_CreateCommand(interp, "sqlite", DbMain, 0, 0);
- Jim_PackageProvide(interp, "sqlite", PACKAGE_VERSION, 0);
return JIM_OK;
}
diff --git a/sqlite3/test-sqlite3.tcl b/sqlite3/test-sqlite.tcl
index 3786b09..82cce40 100644
--- a/sqlite3/test-sqlite3.tcl
+++ b/sqlite3/test-sqlite.tcl
@@ -1,11 +1,11 @@
-# A simple test of the "big" sqlite3 extension
+# A simple test of the "big" sqlite extension
set auto_path [list . {*}$auto_path]
-package require sqlite3
+package require sqlite
# Create an in-memory database and add some data
-sqlite3 db :memory:
+sqlite db :memory:
db eval {CREATE TABLE history (type, time, value)}
foreach t [range 1 50] {
set temp [rand 100]