# ENCODING = ISO8859
ENCODING = @ENCODING@
+# Flags controlling use of the in memory btree implementation
+# INCOREDB says whether to build btree_rb.c
+# TEMPDBINCORE controls the default placement of temporary databases.
+# ALLOWATTACHMEM controls whether ATTACH DATABASE ':memory:' is supported
+INCOREDB = @INCOREDB@
+TEMPDBINCORE = @TEMPDBINCORE@
+ALLOWATTACHMEM = @ALLOWATTACHMEM@
+
+INCOREFLAGS = -DINCOREDB=${INCOREDB} -DTEMPDBINCORE=${TEMPDBINCORE}
+INCOREFLAGS += -DALLOWATTACHMEM=${ALLOWATTACHMEM}
+
# You should not have to change anything below this line
###############################################################################
update.lo util.lo vacuum.lo vdbe.lo \
where.lo trigger.lo
+ifeq (${INCOREDB},1)
+LIBOBJ += btree_rb.lo
+endif
+
# All of the source code files.
#
SRC = \
btree.lo: $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
$(LIBTOOL) $(TCC) -c $(TOP)/src/btree.c
+btree_rb.lo: $(TOP)/src/btree_rb.c $(HDR)
+ $(LIBTOOL) $(TCC) -c $(TOP)/src/btree_rb.c
+
build.lo: $(TOP)/src/build.c $(HDR)
$(LIBTOOL) $(TCC) -c $(TOP)/src/build.c
main.lo: $(TOP)/src/main.c $(HDR)
- $(LIBTOOL) $(TCC) -c $(TOP)/src/main.c
+ $(LIBTOOL) $(TCC) -c ${INCOREFLAGS} $(TOP)/src/main.c
pager.lo: $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
$(LIBTOOL) $(TCC) -c $(TOP)/src/pager.c
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LN_S ECHO RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CPP EGREP LIBTOOL INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA program_prefix VERSION BUILD_CC BUILD_CFLAGS BUILD_LIBS TARGET_CC TARGET_CFLAGS TARGET_LINK TARGET_LFLAGS TARGET_RANLIB TARGET_AR ENCODING BUILD_EXEEXT OS_UNIX OS_WIN TARGET_EXEEXT TARGET_LIBS TARGET_TCL_LIBS TARGET_TCL_INC TARGET_READLINE_LIBS TARGET_READLINE_INC TARGET_HAVE_READLINE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LN_S ECHO RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CPP EGREP LIBTOOL INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA program_prefix VERSION BUILD_CC BUILD_CFLAGS BUILD_LIBS TARGET_CC TARGET_CFLAGS TARGET_LINK TARGET_LFLAGS TARGET_RANLIB TARGET_AR ENCODING ALLOWATTACHMEM INCOREDB TEMPDBINCORE BUILD_EXEEXT OS_UNIX OS_WIN TARGET_EXEEXT TARGET_LIBS TARGET_TCL_LIBS TARGET_TCL_INC TARGET_READLINE_LIBS TARGET_READLINE_INC TARGET_HAVE_READLINE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
--enable-fast-install=PKGS optimize for fast installation default=yes
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-utf8 Use UTF-8 encodings
+ --enable-incore-db Support incore database
+ --enable-tempdb-in-ram Use an in-ram database for temporary tables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
# The following RCS revision string applies to configure.in
-# $Revision: 1.13 $
+# $Revision: 1.14 $
#########
# Programs needed
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4037 "configure"' > conftest.$ac_ext
+ echo '#line 4039 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
-if { (eval echo configure:4566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:4568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 6411 "configure"
+#line 6413 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 6509 "configure"
+#line 6511 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
fi
+##########
+# Do we want to support in-ram databases for ATTACH DATABASE and sqlite_open
+#
+# Check whether --enable-incore-db or --disable-incore-db was given.
+if test "${enable_incore_db+set}" = set; then
+ enableval="$enable_incore_db"
+
+else
+ enable_incore-db=yes
+fi;
+echo "$as_me:$LINENO: checking whether to support incore databases for attach and open" >&5
+echo $ECHO_N "checking whether to support incore databases for attach and open... $ECHO_C" >&6
+if test "$enable_incore-db" = "no"; then
+ INCOREDB=0
+ ALLOWATTACHMEM=0
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+ INCOREDB=1
+ ALLOWATTACHMEM=1
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+fi
+
+
+##########
+# Do we want temporary databases in memory
+#
+# Check whether --enable-tempdb-in-ram or --disable-tempdb-in-ram was given.
+if test "${enable_tempdb_in_ram+set}" = set; then
+ enableval="$enable_tempdb_in_ram"
+
+else
+ enable_tempdb-in-ram=no
+fi;
+echo "$as_me:$LINENO: checking whether to use an in-ram database for temporary tables" >&5
+echo $ECHO_N "checking whether to use an in-ram database for temporary tables... $ECHO_C" >&6
+case "$enable_tempdb-in-ram" in
+ never )
+ TEMPDBINCORE=0
+ echo "$as_me:$LINENO: result: never" >&5
+echo "${ECHO_T}never" >&6
+ ;;
+ no )
+ INCOREDB=1
+ TEMPDBINCORE=1
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ ;;
+ always )
+ INCOREDB=1
+ TEMPDBINCORE=3
+ echo "$as_me:$LINENO: result: always" >&5
+echo "${ECHO_T}always" >&6
+ ;;
+ * )
+ INCOREDB=1
+ TEMPDBINCORE=2
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ ;;
+esac
+
+
+
###########
# Lots of things are different if we are compiling for Windows using
# the CYGWIN environment. So check for that special case and handle
s,@TARGET_RANLIB@,$TARGET_RANLIB,;t t
s,@TARGET_AR@,$TARGET_AR,;t t
s,@ENCODING@,$ENCODING,;t t
+s,@ALLOWATTACHMEM@,$ALLOWATTACHMEM,;t t
+s,@INCOREDB@,$INCOREDB,;t t
+s,@TEMPDBINCORE@,$TEMPDBINCORE,;t t
s,@BUILD_EXEEXT@,$BUILD_EXEEXT,;t t
s,@OS_UNIX@,$OS_UNIX,;t t
s,@OS_WIN@,$OS_WIN,;t t
dnl Put the RCS revision string after AC_INIT so that it will also
dnl show in in configure.
# The following RCS revision string applies to configure.in
-# $Revision: 1.2 $
+# $Revision: 1.3 $
#########
# Programs needed
fi
AC_SUBST(ENCODING)
+##########
+# Do we want to support in-ram databases for ATTACH DATABASE and sqlite_open
+#
+AC_ARG_ENABLE(incore-db,
+[ --enable-incore-db Support incore database],,enable_incore-db=yes)
+AC_MSG_CHECKING([whether to support incore databases for attach and open])
+if test "$enable_incore-db" = "no"; then
+ INCOREDB=0
+ ALLOWATTACHMEM=0
+ AC_MSG_RESULT([no])
+else
+ INCOREDB=1
+ ALLOWATTACHMEM=1
+ AC_MSG_RESULT([yes])
+fi
+AC_SUBST(ALLOWATTACHMEM)
+
+##########
+# Do we want temporary databases in memory
+#
+AC_ARG_ENABLE(tempdb-in-ram,
+[ --enable-tempdb-in-ram Use an in-ram database for temporary tables],,enable_tempdb-in-ram=no)
+AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
+case "$enable_tempdb-in-ram" in
+ never )
+ TEMPDBINCORE=0
+ AC_MSG_RESULT([never])
+ ;;
+ no )
+ INCOREDB=1
+ TEMPDBINCORE=1
+ AC_MSG_RESULT([no])
+ ;;
+ always )
+ INCOREDB=1
+ TEMPDBINCORE=3
+ AC_MSG_RESULT([always])
+ ;;
+ * )
+ INCOREDB=1
+ TEMPDBINCORE=2
+ AC_MSG_RESULT([yes])
+ ;;
+esac
+AC_SUBST(INCOREDB)
+AC_SUBST(TEMPDBINCORE)
+
###########
# Lots of things are different if we are compiling for Windows using
# the CYGWIN environment. So check for that special case and handle
-C Split\sthe\simplementation\sof\sCOPY,\sPRAGMA,\sand\sATTACH\sinto\sseparate\nsource\scode\sfiles.\s(CVS\s902)
-D 2003-04-06T21:08:24
-F Makefile.in 935bf18ecefa32f780acdc1660852403468f0058
+C Support\sin-memory\sdatabases\sfor\stemp\stables\s(CVS\s903)
+D 2003-04-13T18:26:49
+F Makefile.in 503590f4bdb4733d4c1f114939d68ff8a74523c6
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F VERSION e5b03976c56deafa24511d6ef17d64a28679e9bd
F aclocal.m4 ff32919e75f42b2d4213fe3c6f79dd0fe47f7769
F config.guess 831db445a8ae31d1f773fce85e14c16c8677417d
F config.sub 975368989965310238930ecf8e7f06a23061dbb1
-F configure b9ece53c0bca7c50934980dd5c460d7b1a315955 x
-F configure.ac 222ba4ebf74c05114a2b4922843ec57e3d41b7c8
+F configure 21b2d9997812b8134fe6281aca659af23fd92131 x
+F configure.ac 6bd07419ebca8993cd117a2fb58629c2b506d71c
F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F spec.template 238f7db425a78dc1bb7682e56e3834c7270a3f5e
F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
-F src/attach.c 1e429791ee28427403938388ede9fea2caef17b2
+F src/attach.c 8c98e2c0ca434b94deca1b8694c72bd0303a9a87
F src/auth.c f37bfc9451b8c1fa52f34adff474560018892729
-F src/btree.c 3b0e0f09886bc83fa183df367d6a1b7077da9c46
+F src/btree.c 9949031b6087e9d1b43b359b84c68a491086984f
F src/btree.h 5cb871546bd6fa58396a6f033e2b29b388241e1b
-F src/build.c f0c774c4c4ec7d79d1021de7d941863faeb77fd6
+F src/build.c 77b910f739174b0655f052ce8c1a7a0f01d3bfca
F src/copy.c ddd204d5dddac09d71a07f4ceded4c9926d5512b
F src/delete.c 58d698779a6b7f819718ecd45b310a9de8537088
F src/encode.c faf03741efe921755ec371cf4a6984536de00042
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
F src/insert.c e2f5e7feecb507d904a7da48874595f440b715aa
-F src/main.c c5109638c0cd86fa450faa2bd5a60468325aef69
+F src/main.c 8500dcd5dab93b201842b6688e0329c2b25c0d79
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c c33ebb320921b8df6d09ea19fe846348df86a0c9
F src/os.h aa52f0c9da321ff6134d19f2ca959e18e33615d0
F src/pager.c df4c81350cbd80c1ab48341ae0768ba78d99ad49
F src/pager.h e3702f7d384921f6cd5ce0b3ed589185433e9f6c
F src/parse.y 3be47fa18323aa2e3364fc42bf7a6ba5b3cc0a81
-F src/pragma.c 927fc036580eea38ae05c5f0da75fd4ee340f6f0
+F src/pragma.c 476b13896571bc8d1049d6dbe9c9a84e6d4e33c8
F src/printf.c fc5fdef6e92ad205005263661fe9716f55a49f3e
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c 14e2e2a512f4edfc75fb310ebcb502ff3ee87402
F src/shell.c 97f397c0c108176ccbc52ea5b8ec688f995eba7a
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in f49c2cdec7d24cb03e496a1ca519e16306495ee1
-F src/sqliteInt.h 5c2371b20f69f2607ee988ba0aee85cdf9367370
+F src/sqliteInt.h 3dcd08da7d9a9f85dcd67a064f1e9baa17238d3a
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c 7a072c3c8ba9796edc25e5ffa62b68558134e192
F src/test1.c 7ad4e6308dde0bf5a0f0775ce20cb2ec37a328f8
F src/test2.c 5014337d8576b731cce5b5a14bec4f0daf432700
-F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
+F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
F src/tokenize.c 675b4718d17c69fe7609dc8e85e426ef002be811
F src/trigger.c bd5a5b234b47f28f9f21a46243dcaf1c5b2383a3
F src/update.c b368369f1fbe6d7f56a53e5ffad3b75dae9e3e1a
F src/util.c 8953c612a036e30f24c1c1f5a1498176173daa37
F src/vacuum.c 6b9ebf0ef5761b06ce86672574c71b1e9098ef9c
-F src/vdbe.c 540c480912e11e23f5c08a31b8b3594df016f4d1
+F src/vdbe.c 45d2987a5f8337d9aa0da92830fd654fb5fcd478
F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21
F src/where.c e5733f7d5e9cc4ed3590dc3401f779e7b7bb8127
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P b123c165fd3d0a5a86ee8a7baa669105dafb481a
-R 351f9d3f3ae1d413356658b3a79e309f
-U drh
-Z 8dcf477abd69457b6da834133632d978
+P 73359037ea639abb066c74db9c19e84bf1104006
+R 4a0923ca1b7d3d92da7657c4b796ad95
+U paul
+Z 85c89f43ad9bfc64133f7dac4ee2ff75
-73359037ea639abb066c74db9c19e84bf1104006
\ No newline at end of file
+96336bffde6c441af197a521ee9e56fdfd7efff8
\ No newline at end of file
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
-** $Id: attach.c,v 1.1 2003/04/06 21:08:24 drh Exp $
+** $Id: attach.c,v 1.2 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"
sqliteSetNString(&zFile, pFilename->z, pFilename->n, 0);
if( zFile==0 ) return;
sqliteDequote(zFile);
- rc = sqliteBtreeOpen(zFile, 0, MAX_PAGES, &aNew->pBt);
+ rc = sqliteBtreeFactory(db, zFile, 0, MAX_PAGES, &aNew->pBt);
if( rc ){
sqliteErrorMsg(pParse, "unable to open database: %s", zFile);
}
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.87 2003/04/06 20:44:45 drh Exp $
+** $Id: btree.c,v 1.88 2003/04/13 18:26:51 paul Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
** BTree begins on page 2 of the file. (Pages are numbered beginning with
** 1, not 0.) Thus a minimum database contains 2 pages.
*/
-/* We don't want the btree function macros */
+
+/* We don't want the btree function macros as they clash with the functions
+** defined in this file. This may be fixed in future by renaming the macros
+** or the functions defined here, or both.
+*/
#define SQLITE_NO_BTREE_DEFS
#include "sqliteInt.h"
** ROLLBACK
** PRAGMA
**
-** $Id: build.c,v 1.143 2003/04/06 21:08:24 drh Exp $
+** $Id: build.c,v 1.144 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
** holding temporary tables is open.
*/
if( isTemp && db->aDb[1].pBt==0 && !pParse->explain ){
- int rc = sqliteBtreeOpen(0, 0, MAX_PAGES, &db->aDb[1].pBt);
+ int rc = sqliteBtreeFactory(db, ":temp:", 0, MAX_PAGES, &db->aDb[1].pBt);
if( rc!=SQLITE_OK ){
sqliteSetString(&pParse->zErrMsg, "unable to open a temporary database "
"file for storing temporary tables", 0);
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.121 2003/04/05 03:42:27 drh Exp $
+** $Id: main.c,v 1.122 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"
#include "os.h"
db->pCommitArg = pArg;
return pOld;
}
+
+/*
+** This routine is called when sqlite wants to open a btree. zFilename is
+** either the name of a btree file or the magic name ":memory:" which opens an
+** in-memory btree or ":temp:" which opens a temporary btree. This may either
+** be in memory or backed by a temporary file depending on run-time settings.
+*/
+int sqliteBtreeFactory(
+ const sqlite *db, /* Main database when opening aux otherwise 0 */
+ const char *zFilename, /* Name of the file containing the BTree database */
+ int omitJournal, /* if TRUE then do not journal this file */
+ int nCache, /* How many pages in the page cache */
+ Btree **ppBtree){ /* Pointer to new Btree object written here */
+
+ assert( zFilename != 0 );
+ assert( ppBtree != 0);
+
+ if (strcmp(zFilename, ":memory:") == 0) {
+ if (ALLOWATTACHMEM) {
+ return sqliteRBtreeOpen(0, 0, 0, ppBtree);
+ } else {
+ return SQLITE_CANTOPEN;
+ }
+ } else if (strcmp(zFilename, ":temp:") == 0) {
+ if (TEMPDBINCORE == 0) {
+ /* Always use file based temporary DB */
+ return sqliteBtreeOpen(0, omitJournal, nCache, ppBtree);
+ } else if (TEMPDBINCORE == 1 || TEMPDBINCORE == 2) {
+ /* Switch depending on compile-time and/or runtime settings. */
+ int location = db->tmpdb_loc == 0 ? TEMPDBINCORE : db->tmpdb_loc;
+
+ if (location == 1) {
+ return sqliteBtreeOpen(zFilename, omitJournal, nCache, ppBtree);
+ } else {
+ return sqliteRBtreeOpen(0, 0, 0, ppBtree);
+ }
+ } else {
+ /* Always use in-core DB */
+ return sqliteRBtreeOpen(0, 0, 0, ppBtree);
+ }
+ } else {
+ return sqliteBtreeOpen(zFilename, omitJournal, nCache, ppBtree);
+ }
+}
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.1 2003/04/06 21:08:24 drh Exp $
+** $Id: pragma.c,v 1.2 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"
return 1;
}
+/*
+** Interpret the given string as a temp db location. Return 1 for file
+** backed temporary databases, 2 for the Red-Black tree in memory database
+** and 0 to use the compile-time default.
+*/
+static int getTmpdbLocation(char *z){
+ if (sqliteStrICmp(z, "file") == 0) {
+ return 1;
+ } else if (sqliteStrICmp(z, "memory") == 0) {
+ return 2;
+ } else {
+ return 0;
+ }
+}
+
/*
** Process a pragma statement.
**
sqliteVdbeAddOp(v, OP_Callback, 2, 0);
}
}else
+ /*
+ ** PRAGMA tmpdb_location
+ ** PRAGMA tmpdb_location= DEFAULT|MEMORY|FILE
+ **
+ ** Return or set the local value of the tmpdb_location flag. Changing
+ ** the local value does not make changes to the disk file and the default
+ ** value will be restored the next time the database is opened.
+ **
+ ** Note that it is possible for the library compile-time options to
+ ** override this setting
+ */
+ if( sqliteStrICmp(zLeft, "tmpdb_location")==0 ){
+ static VdbeOp getTmpDbLoc[] = {
+ { OP_ColumnName, 0, 0, "tmpdb_location"},
+ { OP_Callback, 1, 0, 0},
+ };
+ if( pRight->z==pLeft->z ){
+ sqliteVdbeAddOp(v, OP_Integer, db->tmpdb_loc, 0);
+ sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
+ }else{
+ if (&db->aDb[1].pBt != 0) {
+ sqliteErrorMsg(pParse, "The temporary database already exists, its location cannot now be changed");
+ } else {
+ db->tmpdb_loc = getTmpdbLocation(zRight);
+ }
+ }
+ }else
+ /*
+ ** PRAGMA default_tmpdb_location
+ ** PRAGMA default_tmpdb_location= DEFAULT|MEMORY|FILE
+ **
+ ** Return or set the value of the persistent tmpdb_location flag (as
+ ** well as the value currently in force).
+ **
+ ** Note that it is possible for the library compile-time options to
+ ** override this setting
+ */
+ if( sqliteStrICmp(zLeft, "default_tmpdb_location")==0 ){
+ static VdbeOp getTmpDbLoc[] = {
+ { OP_ColumnName, 0, 0, "tmpdb_location"},
+ { OP_ReadCookie, 0, 5, 0},
+ { OP_Callback, 1, 0, 0}};
+ if( pRight->z==pLeft->z ){
+ sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
+ }else{
+ if (&db->aDb[1].pBt != 0) {
+ sqliteErrorMsg(pParse, "The temporary database already exists, its location cannot now be changed");
+ } else {
+ sqliteBeginWriteOperation(pParse, 0, 0);
+ db->tmpdb_loc = getTmpdbLocation(zRight);
+ sqliteVdbeAddOp(v, OP_Integer, db->tmpdb_loc, 0);
+ sqliteVdbeAddOp(v, OP_SetCookie, 0, 5);
+ sqliteEndWriteOperation(pParse);
+ }
+ }
+ }else
#ifndef NDEBUG
if( sqliteStrICmp(zLeft, "parser_trace")==0 ){
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.170 2003/04/03 15:46:04 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.171 2003/04/13 18:26:52 paul Exp $
*/
#include "config.h"
#include "sqlite.h"
u8 want_to_close; /* Close after all VDBEs are deallocated */
int next_cookie; /* Next value of aDb[0].schema_cookie */
int cache_size; /* Number of pages to use in the cache */
+ int tmpdb_loc; /* Temp DB loc */
int nTable; /* Number of tables in the database */
void *pBusyArg; /* 1st Argument to the busy callback */
int (*xBusyCallback)(void *,const char*,int); /* The busy callback */
#endif
void sqliteAttach(Parse*, Token*, Token*);
void sqliteDetach(Parse*, Token*);
+int sqliteBtreeFactory(const sqlite *db, const char *zFilename, int mode, int nPg, Btree **ppBtree);
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test3.c,v 1.22 2002/12/04 13:40:26 drh Exp $
+** $Id: test3.c,v 1.23 2003/04/13 18:26:52 paul Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
" FILENAME\"", 0);
return TCL_ERROR;
}
- rc = sqliteBtreeOpen(argv[1], 0, 1000, &pBt);
+ rc = sqliteBtreeFactory(0, argv[1], 0, 1000, &pBt);
if( rc!=SQLITE_OK ){
Tcl_AppendResult(interp, errorName(rc), 0);
return TCL_ERROR;
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.211 2003/04/03 15:46:04 drh Exp $
+** $Id: vdbe.c,v 1.212 2003/04/13 18:26:52 paul Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
cleanupCursor(pCx);
memset(pCx, 0, sizeof(*pCx));
pCx->nullRow = 1;
- rc = sqliteBtreeOpen(0, 1, TEMP_PAGES, &pCx->pBt);
+ rc = sqliteBtreeFactory(db, ":temp:", 1, TEMP_PAGES, &pCx->pBt);
+
if( rc==SQLITE_OK ){
rc = sqliteBtreeBeginTrans(pCx->pBt);
}