This commit is contained in:
Gregory Burd 2023-10-23 12:00:50 -04:00
parent bdd732cef7
commit 7ce1172dcd
5 changed files with 53 additions and 21 deletions

30
.editorconfig Normal file
View file

@ -0,0 +1,30 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
# Ignore diffs/patches
[*.{diff,patch}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_size = unset
[*.c]
ident_style = tab
ident_size = 8
[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab
ident_size = 4
[*.md]
max_line_length = off
trim_trailing_whitespace = false

2
README
View file

@ -1,4 +1,4 @@
DBSQL 0.3.1: (October 21, 2023)
DBSQL 0.3.1: (October 23, 2023)
This is version 0.3.1 of DBSQL.

4
dist/RELEASE vendored
View file

@ -17,8 +17,8 @@
# General Public License for more details.
DBSQL_VERSION_MAJOR=0
DBSQL_VERSION_MINOR=3
DBSQL_VERSION_PATCH=1
DBSQL_VERSION_MINOR=4
DBSQL_VERSION_PATCH=0
DBSQL_VERSION="$DBSQL_VERSION_MAJOR.$DBSQL_VERSION_MINOR.$DBSQL_VERSION_PATCH"
DBSQL_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DBSQL_VERSION_MAJOR $DBSQL_VERSION_MINOR`

23
dist/sqlconf vendored
View file

@ -36,10 +36,11 @@ args="--enable-soundex-sqlfn $args"
#args="LD_TWOLEVEL_NAMESPACE=1 LIBTSO_LIBS=-ltcl8.4 $args"
# On NixOS enable:
CFLAGS=${NIX_CFLAGS_COMPILE}
LDLAGS=${NIX_LDFLAGS}
CFLAGS="${NIX_CFLAGS_COMPILE} -O0 -g -DDEBUG"
LDLAGS="${NIX_LDFLAGS} /home/gburd/src/libdb/build_unix/.libs"
#args="--with-berkeleydb=$(pkg-config --variable=prefix db) $args"
args="--with-berkeleydb=/nix/store/mlhib3c2ra8bj36vhxmwqhyxph8a8sgf-db-4.8.30 $args"
#args="--with-berkeleydb=/nix/store/mlhib3c2ra8bj36vhxmwqhyxph8a8sgf-db-4.8.30 $args"
args="--with-berkeleydb=/home/gburd/opt $args"
args="--with-tcl=$(pkg-config --variable=libdir tcl) $args"
echo "env $cppflags $ldflags $libs ../dist/configure $args"
@ -54,13 +55,13 @@ env $cppflags $ldflags $libs sh ../dist/configure -C $args
# echo 'print __db_dump(dbc->dbp, "a", "/tmp/o")' &&
# echo "end") > .gdbinit
(echo "set environment LD_LIBRARY_PATH=.:.libs" &&
echo "dir ../src" &&
echo "dir ../src/dbsql" &&
echo "dir ../src/dbsql/rl/src" &&
echo "dir /usr/local/db/src/dist" &&
echo "path /usr/local/db/lib" &&
echo "path .") > .gdbinit
# (echo "set environment LD_LIBRARY_PATH=.:.libs" &&
# echo "dir ../src" &&
# echo "dir ../src/dbsql" &&
# echo "dir ../src/dbsql/rl/src" &&
# echo "dir /usr/local/db/src/dist" &&
# echo "path /usr/local/db/lib" &&
# echo "path .") > .gdbinit
rm -f tags
ln -s ../dist/tags tags
@ -70,4 +71,4 @@ exit 0
nix-build -E 'with import <nixpkgs> {}; enableDebugging db4'
gdb -ix .gdbinit --tui build_unix/.libs/dbsql
r --init ../tests/smoke.sql /tmp/dbsql
r --init ../test/smoke.sql smoke

View file

@ -81,7 +81,7 @@ __sm_is_threaded(sm)
sm_t *sm;
{
int flags;
return (sm->dbp->flags & DBSQL_Threaded ? 1 : 0);
return F_ISSET(sm->dbp, DBSQL_Threaded);
}
/*
@ -208,7 +208,7 @@ __sm_meta_init(sm, txn, name, init)
if (__sm_is_threaded(sm))
flags |= DB_THREAD;
if ((rc = db->open(db, txn, (name ? name : NULL), (name ? mn : NULL),
if ((rc = db->open(db, txn, (name ? name : NULL), (name ? mn : NULL),
DB_BTREE, flags, 0)) != 0)
return NULL;
return db;
@ -263,9 +263,9 @@ __sm_init(sm, init)
(F_ISSET(sm, SM_INMEM_DB) ? NULL : SM_META_NAME),
DB_BTREE,
DB_CREATE | DB_EXCL | flags, 0)) == EEXIST) {
/* Try to open the databse, it already exists */
/* The database already exists, try to open it */
if ((rc = db->open(db, txn, sm->name, SM_META_NAME, DB_BTREE,
flags, 0)) == 0)
flags, 0)) == 0)
*init = 0;
else
goto err;
@ -279,6 +279,7 @@ __sm_init(sm, init)
goto err;
txn->commit(txn, 0);
txn = 0;
F_SET(sm, SM_HAS_INIT);
return DBSQL_SUCCESS;
err:
if (sm->meta)
@ -566,7 +567,7 @@ __sm_close_cursor(smc)
int rc = DBSQL_SUCCESS;
DBSQL_ASSERT(smc != 0);
if (smc->dbc->c_close(smc->dbc) == DB_LOCK_DEADLOCK) {
smc->txn->abort(smc->txn);
rc = DBSQL_INTERNAL;
@ -1227,11 +1228,11 @@ __sm_resource(sm, id, type, init)
if (__dbsql_calloc(sm->dbp, 1, sizeof(sm_rec_t), &smr) == ENOMEM)
return DBSQL_CANTOPEN;
/* Create and initialize database object, open the database. */
if ((rc = db_create(&smr->db, dbenv, 0)) != 0)
return DBSQL_CANTOPEN;
smr->db->set_bt_compare(smr->db, __sm_bt_compare);
/* Start a transaction, get an id, open the database, commit. */