1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Obj-ify tclsqlite (CVS 146)

FossilOrigin-Name: 85a4254ef0998fac06ddc285decd79345968fee1
This commit is contained in:
drh
2000-09-21 13:01:35 +00:00
parent 6562e5af1f
commit 6d31316cf3
8 changed files with 163 additions and 107 deletions

View File

@@ -49,7 +49,7 @@ LIBREADLINE = @TARGET_READLINE_LIBS@
# #
LIBOBJ = build.o dbbe.o delete.o expr.o insert.o \ LIBOBJ = build.o dbbe.o delete.o expr.o insert.o \
main.o parse.o select.o tokenize.o update.o \ main.o parse.o select.o tokenize.o update.o \
util.o vdbe.o where.o util.o vdbe.o where.o tclsqlite.o
# All of the source code files. # All of the source code files.
# #
@@ -157,6 +157,9 @@ select.o: $(TOP)/src/select.c $(HDR)
update.o: $(TOP)/src/update.c $(HDR) update.o: $(TOP)/src/update.c $(HDR)
$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/update.c $(TCC) $(GDBM_FLAGS) -c $(TOP)/src/update.c
tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
$(TCC) $(GDBM_FLAGS) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
gdbmdump: $(TOP)/tool/gdbmdump.c gdbmdump: $(TOP)/tool/gdbmdump.c
$(TCC) $(GDBM_FLAGS) -o gdbmdump $(TOP)/tool/gdbmdump.c $(LIBGDBM) $(TCC) $(GDBM_FLAGS) -o gdbmdump $(TOP)/tool/gdbmdump.c $(LIBGDBM)

53
configure vendored
View File

@@ -525,7 +525,7 @@ fi
# The following RCS revision string applies to configure.in # The following RCS revision string applies to configure.in
# $Revision: 1.6 $ # $Revision: 1.7 $
######### #########
# Make sure we are not building in a subdirectory of the source tree. # Make sure we are not building in a subdirectory of the source tree.
@@ -1374,6 +1374,9 @@ fi
fi fi
done done
fi fi
if test "$found" = "no"; then
TARGET_TCL_INC="-DNO_TCL=1"
fi
########## ##########
@@ -1387,14 +1390,14 @@ else
LIBS="" LIBS=""
echo $ac_n "checking for library containing gdbm_open""... $ac_c" 1>&6 echo $ac_n "checking for library containing gdbm_open""... $ac_c" 1>&6
echo "configure:1391: checking for library containing gdbm_open" >&5 echo "configure:1394: checking for library containing gdbm_open" >&5
if eval "test \"`echo '$''{'ac_cv_search_gdbm_open'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_search_gdbm_open'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
ac_func_search_save_LIBS="$LIBS" ac_func_search_save_LIBS="$LIBS"
ac_cv_search_gdbm_open="no" ac_cv_search_gdbm_open="no"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1398 "configure" #line 1401 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@@ -1405,7 +1408,7 @@ int main() {
gdbm_open() gdbm_open()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
ac_cv_search_gdbm_open="none required" ac_cv_search_gdbm_open="none required"
else else
@@ -1416,7 +1419,7 @@ rm -f conftest*
test "$ac_cv_search_gdbm_open" = "no" && for i in gdbm; do test "$ac_cv_search_gdbm_open" = "no" && for i in gdbm; do
LIBS="-l$i $ac_func_search_save_LIBS" LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1420 "configure" #line 1423 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@@ -1427,7 +1430,7 @@ int main() {
gdbm_open() gdbm_open()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
ac_cv_search_gdbm_open="-l$i" ac_cv_search_gdbm_open="-l$i"
break break
@@ -1455,7 +1458,7 @@ fi
# Figure out where to get the GDBM header files. # Figure out where to get the GDBM header files.
# #
echo $ac_n "checking GDBM header files""... $ac_c" 1>&6 echo $ac_n "checking GDBM header files""... $ac_c" 1>&6
echo "configure:1459: checking GDBM header files" >&5 echo "configure:1462: checking GDBM header files" >&5
found=no found=no
if test "$config_TARGET_GDBM_INC" != ""; then if test "$config_TARGET_GDBM_INC" != ""; then
TARGET_GDBM_INC=$config_TARGET_GDBM_INC TARGET_GDBM_INC=$config_TARGET_GDBM_INC
@@ -1467,17 +1470,17 @@ else
echo "$ac_t""not specified: still searching..." 1>&6 echo "$ac_t""not specified: still searching..." 1>&6
ac_safe=`echo "gdbm.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "gdbm.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for gdbm.h""... $ac_c" 1>&6 echo $ac_n "checking for gdbm.h""... $ac_c" 1>&6
echo "configure:1471: checking for gdbm.h" >&5 echo "configure:1474: checking for gdbm.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1476 "configure" #line 1479 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <gdbm.h> #include <gdbm.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1481: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1484: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@@ -1504,7 +1507,7 @@ if test "$found" = "no"; then
ac_safe=`echo "$dir/include/gdbm.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "$dir/include/gdbm.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $dir/include/gdbm.h""... $ac_c" 1>&6 echo $ac_n "checking for $dir/include/gdbm.h""... $ac_c" 1>&6
echo "configure:1508: checking for $dir/include/gdbm.h" >&5 echo "configure:1511: checking for $dir/include/gdbm.h" >&5
if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@@ -1545,14 +1548,14 @@ else
LIBS="" LIBS=""
echo $ac_n "checking for library containing readline""... $ac_c" 1>&6 echo $ac_n "checking for library containing readline""... $ac_c" 1>&6
echo "configure:1549: checking for library containing readline" >&5 echo "configure:1552: checking for library containing readline" >&5
if eval "test \"`echo '$''{'ac_cv_search_readline'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_search_readline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
ac_func_search_save_LIBS="$LIBS" ac_func_search_save_LIBS="$LIBS"
ac_cv_search_readline="no" ac_cv_search_readline="no"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1556 "configure" #line 1559 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@@ -1563,7 +1566,7 @@ int main() {
readline() readline()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
ac_cv_search_readline="none required" ac_cv_search_readline="none required"
else else
@@ -1574,7 +1577,7 @@ rm -f conftest*
test "$ac_cv_search_readline" = "no" && for i in readline; do test "$ac_cv_search_readline" = "no" && for i in readline; do
LIBS="-l$i $ac_func_search_save_LIBS" LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1578 "configure" #line 1581 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@@ -1585,7 +1588,7 @@ int main() {
readline() readline()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
ac_cv_search_readline="-l$i" ac_cv_search_readline="-l$i"
break break
@@ -1613,7 +1616,7 @@ fi
# Figure out where to get the READLINE header files. # Figure out where to get the READLINE header files.
# #
echo $ac_n "checking readline header files""... $ac_c" 1>&6 echo $ac_n "checking readline header files""... $ac_c" 1>&6
echo "configure:1617: checking readline header files" >&5 echo "configure:1620: checking readline header files" >&5
found=no found=no
if test "$config_TARGET_READLINE_INC" != ""; then if test "$config_TARGET_READLINE_INC" != ""; then
TARGET_READLINE_INC=$config_TARGET_READLINE_INC TARGET_READLINE_INC=$config_TARGET_READLINE_INC
@@ -1625,17 +1628,17 @@ else
echo "$ac_t""not specified: still searching..." 1>&6 echo "$ac_t""not specified: still searching..." 1>&6
ac_safe=`echo "readline.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "readline.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for readline.h""... $ac_c" 1>&6 echo $ac_n "checking for readline.h""... $ac_c" 1>&6
echo "configure:1629: checking for readline.h" >&5 echo "configure:1632: checking for readline.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1634 "configure" #line 1637 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <readline.h> #include <readline.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@@ -1662,7 +1665,7 @@ if test "$found" = "no"; then
ac_safe=`echo "$dir/include/readline.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "$dir/include/readline.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $dir/include/readline.h""... $ac_c" 1>&6 echo $ac_n "checking for $dir/include/readline.h""... $ac_c" 1>&6
echo "configure:1666: checking for $dir/include/readline.h" >&5 echo "configure:1669: checking for $dir/include/readline.h" >&5
if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@@ -1691,7 +1694,7 @@ fi
ac_safe=`echo "$dir/include/readline/readline.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "$dir/include/readline/readline.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $dir/include/readline/readline.h""... $ac_c" 1>&6 echo $ac_n "checking for $dir/include/readline/readline.h""... $ac_c" 1>&6
echo "configure:1695: checking for $dir/include/readline/readline.h" >&5 echo "configure:1698: checking for $dir/include/readline/readline.h" >&5
if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@@ -1735,12 +1738,12 @@ fi
# Figure out whether or not we have a "usleep()" function. # Figure out whether or not we have a "usleep()" function.
# #
echo $ac_n "checking for usleep""... $ac_c" 1>&6 echo $ac_n "checking for usleep""... $ac_c" 1>&6
echo "configure:1739: checking for usleep" >&5 echo "configure:1742: checking for usleep" >&5
if eval "test \"`echo '$''{'ac_cv_func_usleep'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_usleep'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1744 "configure" #line 1747 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char usleep(); below. */ which can conflict with char usleep(); below. */
@@ -1763,7 +1766,7 @@ usleep();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_usleep=yes" eval "ac_cv_func_usleep=yes"
else else

View File

@@ -151,7 +151,7 @@ AC_INIT(src/sqlite.h.in)
dnl Put the RCS revision string after AC_INIT so that it will also dnl Put the RCS revision string after AC_INIT so that it will also
dnl show in in configure. dnl show in in configure.
# The following RCS revision string applies to configure.in # The following RCS revision string applies to configure.in
# $Revision: 1.6 $ # $Revision: 1.7 $
######### #########
# Make sure we are not building in a subdirectory of the source tree. # Make sure we are not building in a subdirectory of the source tree.
@@ -416,6 +416,9 @@ if test "$found" = "no"; then
fi fi
done done
fi fi
if test "$found" = "no"; then
TARGET_TCL_INC="-DNO_TCL=1"
fi
AC_SUBST(TARGET_TCL_INC) AC_SUBST(TARGET_TCL_INC)
########## ##########

View File

@@ -1,11 +1,11 @@
C Version\s1.0.5\s(CVS\s495) C Obj-ify\stclsqlite\s(CVS\s146)
D 2000-09-14T01:25:00 D 2000-09-21T13:01:36
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 036bce328b963f48dbaadbec8cc4144a1fd9e50a F Makefile.in e699d55492bcfe06ab93e2d3f86da4705d45692c
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958 F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
F VERSION 4edef6ec60a55c61b01fc0abebbf5a2f67c4f0e7 F VERSION 4edef6ec60a55c61b01fc0abebbf5a2f67c4f0e7
F configure 078a370347baf9375baa8053857ca1e6bc84afa7 x F configure bc917320fcc6d8a1a5154737304763acb5f7f68c x
F configure.in 381aeb4564f1562b7b2a115f5e99035c561a7fea F configure.in ae915ce37ff010e8aac34b90b9136d4a32659bdb
F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47 F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47
F src/build.c 4d90e9e94750ca80249fc7958c617021d8bb7a50 F src/build.c 4d90e9e94750ca80249fc7958c617021d8bb7a50
F src/dbbe.c 226daaf8c095ceb4aff48cad188dad90643f9867 F src/dbbe.c 226daaf8c095ceb4aff48cad188dad90643f9867
@@ -20,7 +20,7 @@ F src/shell.c f1ef4268c679e4a9faedc7b0bbf8045d062d1f9c
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in d341439fc1432c7d7014bcff5f7b6e914571232c F src/sqlite.h.in d341439fc1432c7d7014bcff5f7b6e914571232c
F src/sqliteInt.h b65fdecac7281aafb4c9ff3e79ea1b5546478385 F src/sqliteInt.h b65fdecac7281aafb4c9ff3e79ea1b5546478385
F src/tclsqlite.c 89dc4ba2b521f3e919d6d7aaa4cc1c2aba8e16f3 F src/tclsqlite.c a08428125ba2429b71764d5365653771ded4a2b8
F src/tokenize.c 097bec5843d4a0fb4509e036fee93bac080c5e73 F src/tokenize.c 097bec5843d4a0fb4509e036fee93bac080c5e73
F src/update.c 51b9ef7434b15e31096155da920302e9db0d27fc F src/update.c 51b9ef7434b15e31096155da920302e9db0d27fc
F src/util.c 782f87af3c48c898631a2d5b7074437c899f6f13 F src/util.c 782f87af3c48c898631a2d5b7074437c899f6f13
@@ -47,7 +47,7 @@ F test/select5.test e2b9d51d88cbd6c307c2c05b0ef55fe7ba811ac2
F test/sort.test d582086c4bb7df3fbf50aa72e69d7e235e9f8e31 F test/sort.test d582086c4bb7df3fbf50aa72e69d7e235e9f8e31
F test/subselect.test bf8b251a92fb091973c1c469ce499dc9648a41d5 F test/subselect.test bf8b251a92fb091973c1c469ce499dc9648a41d5
F test/table.test 620cd72a6c29da3b9153d15c9e94abbbb282373b F test/table.test 620cd72a6c29da3b9153d15c9e94abbbb282373b
F test/tester.tcl 95b286791e6256bb6db0165f9342c70fff549a62 F test/tester.tcl ad57d7e8114b0691eb5e943b9dabbd68119b8e2c
F test/update.test 62f6ce99ff31756aab0ca832ff6d34c5a87b6250 F test/update.test 62f6ce99ff31756aab0ca832ff6d34c5a87b6250
F test/vacuum.test 8becf5cfeb897108b35cdd996793e7f1df2f28fd F test/vacuum.test 8becf5cfeb897108b35cdd996793e7f1df2f28fd
F test/where.test bbab5a308055fb6087dc23d600b4ad2b72797397 F test/where.test bbab5a308055fb6087dc23d600b4ad2b72797397
@@ -62,7 +62,7 @@ F www/arch.fig 4e26e9dca3c49724fc8f554c695ddea9f2413156
F www/arch.png c4d908b79065a72e7dcf19317f36d1324c550e87 F www/arch.png c4d908b79065a72e7dcf19317f36d1324c550e87
F www/arch.tcl 4f6a9afecc099a27bba17b4f8cc9561abc15dc40 F www/arch.tcl 4f6a9afecc099a27bba17b4f8cc9561abc15dc40
F www/c_interface.tcl 1b79e404a0dd46f44cd453a44b01df568c9586d1 F www/c_interface.tcl 1b79e404a0dd46f44cd453a44b01df568c9586d1
F www/changes.tcl 8ac23210e8cef43b77041f01b439a6ff3d1554fc F www/changes.tcl 5f047e9e0154cf1b800e626e635c4334420ddb9b
F www/crosscompile.tcl 19734ce7f18b16ff2ed8479412abf8aca56e1dcc F www/crosscompile.tcl 19734ce7f18b16ff2ed8479412abf8aca56e1dcc
F www/fileformat.tcl cfb7fba80b7275555281ba2f256c00734bcdd1c9 F www/fileformat.tcl cfb7fba80b7275555281ba2f256c00734bcdd1c9
F www/index.tcl 2f5cc070b8fa8c3fc2f71bba4e6b7877d528fbde F www/index.tcl 2f5cc070b8fa8c3fc2f71bba4e6b7877d528fbde
@@ -71,7 +71,7 @@ F www/mingw.tcl fc5f4ba9d336b6e8c97347cc6496d6162461ef60
F www/opcode.tcl cb3a1abf8b7b9be9f3a228d097d6bf8b742c2b6f F www/opcode.tcl cb3a1abf8b7b9be9f3a228d097d6bf8b742c2b6f
F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f
F www/vdbe.tcl bcbfc33bcdd0ebad95eab31286adb9e1bc289520 F www/vdbe.tcl bcbfc33bcdd0ebad95eab31286adb9e1bc289520
P ea0e32828f5643eeb00b216a287d14f4826ddf2d P 84839d8764ecdfac4d8c56618d9c107c8bbf65ab
R d838e77add09f4d92cf328c578007f7b R c08eefda2a9f502c4bc4de062c9d0908
U drh U drh
Z de8fe72d201ddf752c7db67bb8650632 Z 23e467b7f382bfed639e5b43f4e92064

View File

@@ -1 +1 @@
84839d8764ecdfac4d8c56618d9c107c8bbf65ab 85a4254ef0998fac06ddc285decd79345968fee1

View File

@@ -23,8 +23,10 @@
************************************************************************* *************************************************************************
** A TCL Interface to SQLite ** A TCL Interface to SQLite
** **
** $Id: tclsqlite.c,v 1.8 2000/08/17 09:50:00 drh Exp $ ** $Id: tclsqlite.c,v 1.9 2000/09/21 13:01:37 drh Exp $
*/ */
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
#include "sqlite.h" #include "sqlite.h"
#include <tcl.h> #include <tcl.h>
#include <stdlib.h> #include <stdlib.h>
@@ -38,7 +40,7 @@ typedef struct SqliteDb SqliteDb;
struct SqliteDb { struct SqliteDb {
sqlite *db; /* The "real" database structure */ sqlite *db; /* The "real" database structure */
Tcl_Interp *interp; /* The interpreter used for this database */ Tcl_Interp *interp; /* The interpreter used for this database */
char *zBusy; /* The name of the busy callback routine */ char *zBusy; /* The busy callback routine */
}; };
/* /*
@@ -49,7 +51,7 @@ typedef struct CallbackData CallbackData;
struct CallbackData { struct CallbackData {
Tcl_Interp *interp; /* The TCL interpreter */ Tcl_Interp *interp; /* The TCL interpreter */
char *zArray; /* The array into which data is written */ char *zArray; /* The array into which data is written */
char *zCode; /* The code to execute for each row */ Tcl_Obj *pCode; /* The code to execute for each row */
int once; /* Set only for the first invocation of callback */ int once; /* Set only for the first invocation of callback */
}; };
@@ -84,10 +86,36 @@ static int DbEvalCallback(
} }
} }
cbData->once = 0; cbData->once = 0;
rc = Tcl_Eval(cbData->interp, cbData->zCode); rc = Tcl_EvalObj(cbData->interp, cbData->pCode);
return rc; return rc;
} }
/*
** This is an alternative callback for database queries. Instead
** of invoking a TCL script to handle the result, this callback just
** appends each column of the result to a list. After the query
** is complete, the list is returned.
*/
static int DbEvalCallback2(
void *clientData, /* An instance of CallbackData */
int nCol, /* Number of columns in the result */
char ** azCol, /* Data for each column */
char ** azN /* Name for each column */
){
Tcl_Obj *pList = (Tcl_Obj*)clientData;
int i;
for(i=0; i<nCol; i++){
Tcl_Obj *pElem;
if( azCol[i] && *azCol[i] ){
pElem = Tcl_NewStringObj(azCol[i], -1);
}else{
pElem = Tcl_NewObj();
}
Tcl_ListObjAppendElement(0, pList, pElem);
}
return 0;
}
/* /*
** Called when the command is deleted. ** Called when the command is deleted.
*/ */
@@ -139,58 +167,70 @@ static int DbBusyHandler(void *cd, const char *zTable, int nTries){
** and calls that connection "db1". The second command causes this ** and calls that connection "db1". The second command causes this
** subroutine to be invoked. ** subroutine to be invoked.
*/ */
static int DbCmd(void *cd, Tcl_Interp *interp, int argc, char **argv){ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
char *z;
int n, c;
SqliteDb *pDb = (SqliteDb*)cd; SqliteDb *pDb = (SqliteDb*)cd;
if( argc<2 ){ int choice;
Tcl_AppendResult(interp,"wrong # args: should be \"", argv[0], static char *DB_optStrs[] = {
" SUBCOMMAND ...\"", 0); "busy", "close", "complete", "eval", "timeout"
};
enum DB_opts {
DB_BUSY, DB_CLOSE, DB_COMPLETE, DB_EVAL, DB_TIMEOUT
};
if( objc<2 ){
Tcl_WrongNumArgs(interp, 1, objv, "SUBCOMMAND ...");
return TCL_ERROR; return TCL_ERROR;
} }
z = argv[1]; if( Tcl_GetIndexFromObj(interp, objv[1], DB_optStrs, "option", 0, &choice) ){
n = strlen(z); return TCL_ERROR;
c = z[0]; }
switch( (enum DB_opts)choice ){
/* $db busy ?CALLBACK? /* $db busy ?CALLBACK?
** **
** Invoke the given callback if an SQL statement attempts to open ** Invoke the given callback if an SQL statement attempts to open
** a locked database file. ** a locked database file.
*/ */
if( c=='b' && strncmp(z,"busy",n)==0 ){ case DB_BUSY: {
if( argc>3 ){ if( objc>3 ){
Tcl_AppendResult(interp,"wrong # args: should be \"", Tcl_WrongNumArgs(interp, 2, objv, "CALLBACK");
argv[0], " busy ?CALLBACK?", 0);
return TCL_ERROR; return TCL_ERROR;
}else if( argc==2 ){ }else if( objc==2 ){
if( pDb->zBusy ){ if( pDb->zBusy ){
Tcl_AppendResult(interp, pDb->zBusy, 0); Tcl_AppendResult(interp, pDb->zBusy, 0);
} }
}else{ }else{
char *zBusy;
int len;
if( pDb->zBusy ){ if( pDb->zBusy ){
Tcl_Free(pDb->zBusy); Tcl_Free(pDb->zBusy);
pDb->zBusy = 0;
} }
if( argv[2][0] ){ zBusy = Tcl_GetStringFromObj(objv[2], &len);
pDb->zBusy = Tcl_Alloc( strlen(argv[2]) + 1 ); if( zBusy && len>0 ){
if( pDb->zBusy ){ pDb->zBusy = Tcl_Alloc( len + 1 );
strcpy(pDb->zBusy, argv[2]); strcpy(pDb->zBusy, zBusy);
} }else{
pDb->zBusy = 0;
} }
if( pDb->zBusy ){ if( pDb->zBusy ){
pDb->interp = interp; pDb->interp = interp;
sqlite_busy_handler(pDb->db, DbBusyHandler, pDb); sqlite_busy_handler(pDb->db, DbBusyHandler, pDb);
}else{
sqlite_busy_handler(pDb->db, 0, 0);
} }
} }
}else break;
}
/* $db close /* $db close
** **
** Shutdown the database ** Shutdown the database
*/ */
if( c=='c' && n>=2 && strncmp(z,"close",n)==0 ){ case DB_CLOSE: {
Tcl_DeleteCommand(interp, argv[0]); Tcl_DeleteCommand(interp, Tcl_GetStringFromObj(objv[0], 0));
}else break;
}
/* $db complete SQL /* $db complete SQL
** **
@@ -198,16 +238,18 @@ static int DbCmd(void *cd, Tcl_Interp *interp, int argc, char **argv){
** additional lines of input are needed. This is similar to the ** additional lines of input are needed. This is similar to the
** built-in "info complete" command of Tcl. ** built-in "info complete" command of Tcl.
*/ */
if( c=='c' && n>=2 && strncmp(z,"complete",n)==0 ){ case DB_COMPLETE: {
char *zRes; Tcl_Obj *pResult;
if( argc!=3 ){ int isComplete;
Tcl_AppendResult(interp,"wrong # args: should be \"", argv[0], if( objc!=3 ){
" complete SQL\"", 0); Tcl_WrongNumArgs(interp, 2, objv, "SQL");
return TCL_ERROR; return TCL_ERROR;
} }
zRes = sqlite_complete(argv[2]) ? "1" : "0"; isComplete = sqlite_complete( Tcl_GetStringFromObj(objv[2], 0) );
Tcl_SetResult(interp, zRes, TCL_VOLATILE); pResult = Tcl_GetObjResult(interp);
}else Tcl_SetBooleanObj(pResult, isComplete);
break;
}
/* /*
** $db eval $sql ?array { ...code... }? ** $db eval $sql ?array { ...code... }?
@@ -218,57 +260,59 @@ static int DbCmd(void *cd, Tcl_Interp *interp, int argc, char **argv){
** If "array" is an empty string, then the values are placed in variables ** If "array" is an empty string, then the values are placed in variables
** that have the same name as the fields extracted by the query. ** that have the same name as the fields extracted by the query.
*/ */
if( c=='e' && strncmp(z,"eval",n)==0 ){ case DB_EVAL: {
CallbackData cbData; CallbackData cbData;
char *zErrMsg; char *zErrMsg;
char *zSql;
int rc; int rc;
if( argc!=5 && argc!=3 ){ if( objc!=5 && objc!=3 ){
Tcl_AppendResult(interp,"wrong # args: should be \"", argv[0], Tcl_WrongNumArgs(interp, 2, objv, "SQL ?ARRAY-NAME CODE?");
" eval SQL ?ARRAY-NAME CODE?", 0);
return TCL_ERROR; return TCL_ERROR;
} }
pDb->interp = interp; pDb->interp = interp;
if( argc==5 ){ zSql = Tcl_GetStringFromObj(objv[2], 0);
Tcl_IncrRefCount(objv[2]);
if( objc==5 ){
cbData.interp = interp; cbData.interp = interp;
cbData.once = 1; cbData.once = 1;
cbData.zArray = argv[3]; cbData.zArray = Tcl_GetStringFromObj(objv[3], 0);
cbData.zCode = argv[4]; cbData.pCode = objv[4];
zErrMsg = 0; zErrMsg = 0;
rc = sqlite_exec(pDb->db, argv[2], DbEvalCallback, &cbData, &zErrMsg); Tcl_IncrRefCount(objv[3]);
Tcl_IncrRefCount(objv[4]);
rc = sqlite_exec(pDb->db, zSql, DbEvalCallback, &cbData, &zErrMsg);
Tcl_DecrRefCount(objv[4]);
Tcl_DecrRefCount(objv[3]);
}else{ }else{
rc = sqlite_exec(pDb->db, argv[2], 0, 0, &zErrMsg); Tcl_Obj *pList = Tcl_NewObj();
rc = sqlite_exec(pDb->db, zSql, DbEvalCallback2, pList, &zErrMsg);
Tcl_SetObjResult(interp, pList);
} }
if( zErrMsg ){ if( zErrMsg ){
Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);
free(zErrMsg); free(zErrMsg);
} }
Tcl_DecrRefCount(objv[2]);
return rc; return rc;
}else }
/* /*
** $db timeout MILLESECONDS ** $db timeout MILLESECONDS
** **
** Delay for the number of milliseconds specified when a file is locked. ** Delay for the number of milliseconds specified when a file is locked.
*/ */
if( c=='t' && strncmp(z,"timeout",n)==0 ){ case DB_TIMEOUT: {
int ms; int ms;
if( argc!=3 ){ if( objc!=3 ){
Tcl_AppendResult(interp,"wrong # args: should be \"", argv[0], Tcl_WrongNumArgs(interp, 2, objv, "MILLISECONDS");
" timeout MILLISECONDS", 0);
return TCL_ERROR; return TCL_ERROR;
} }
if( Tcl_GetInt(interp, argv[2], &ms) ) return TCL_ERROR; if( Tcl_GetIntFromObj(interp, objv[2], &ms) ) return TCL_ERROR;
sqlite_busy_timeout(pDb->db, ms); sqlite_busy_timeout(pDb->db, ms);
}else break;
/* The default
*/
{
Tcl_AppendResult(interp,"unknown subcommand \"", z,
"\" - should be one of: close complete eval", 0);
return TCL_ERROR;
} }
} /* End of the SWITCH statement */
return TCL_OK; return TCL_OK;
} }
@@ -314,7 +358,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int argc, char **argv){
free(zErrMsg); free(zErrMsg);
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_CreateCommand(interp, argv[1], DbCmd, (char*)p, DbDeleteCmd); Tcl_CreateObjCommand(interp, argv[1], DbObjCmd, (char*)p, DbDeleteCmd);
return TCL_OK; return TCL_OK;
} }
@@ -397,3 +441,5 @@ int TCLSH_MAIN(int argc, char **argv){
return 0; return 0;
} }
#endif /* TCLSH */ #endif /* TCLSH */
#endif /* !defined(NO_TCL) */

View File

@@ -23,7 +23,7 @@
# This file implements some common TCL routines used for regression # This file implements some common TCL routines used for regression
# testing the SQLite library # testing the SQLite library
# #
# $Id: tester.tcl,v 1.5 2000/06/08 13:36:41 drh Exp $ # $Id: tester.tcl,v 1.6 2000/09/21 13:01:37 drh Exp $
# Create a test database # Create a test database
# #
@@ -82,13 +82,7 @@ proc finish_test {} {
# A procedure to execute SQL # A procedure to execute SQL
# #
proc execsql {sql} { proc execsql {sql} {
set result {} return [db eval $sql]
db eval $sql data {
foreach f $data(*) {
lappend result $data($f)
}
}
return $result
} }
# Another procedure to execute SQL. This one includes the field # Another procedure to execute SQL. This one includes the field

View File

@@ -17,6 +17,13 @@ proc chng {date desc} {
puts "<DD><P><UL>$desc</UL></P></DD>" puts "<DD><P><UL>$desc</UL></P></DD>"
} }
chng {2000 Sep 21 (Not Released)} {
<li>Change the tclsqlite "eval" method to return a list of results if
no callback script is specified.</li>
<li>Change tclsqlite.c to use the Tcl_Obj interface</li>
<li>Add tclsqlite.c to the libsqlite.a library</li>
}
chng {2000 Sep 13 (Version 1.0.5)} { chng {2000 Sep 13 (Version 1.0.5)} {
<li>Changed the print format for floating point values from "%g" to "%.15g". <li>Changed the print format for floating point values from "%g" to "%.15g".
</li> </li>