SQLite

Check-in [96336bffde]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Support in-memory databases for temp tables (CVS 903)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 96336bffde6c441af197a521ee9e56fdfd7efff8
User & Date: paul 2003-04-13 18:26:49.000
Context
2003-04-15
01:19
Change some variable names and comments in the new in-memory database file implementation. Partial (non-working) implementation of the VACUUM command. (CVS 904) (check-in: e76787f877 user: drh tags: trunk)
2003-04-13
18:26
Support in-memory databases for temp tables (CVS 903) (check-in: 96336bffde user: paul tags: trunk)
2003-04-06
21:08
Split the implementation of COPY, PRAGMA, and ATTACH into separate source code files. (CVS 902) (check-in: 73359037ea user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.in.
52
53
54
55
56
57
58











59
60
61
62
63
64
65
66
67
68
69
70




71
72
73
74
75
76
77
LIBREADLINE = @TARGET_READLINE_LIBS@

# Should the database engine assume text is coded as UTF-8 or iso8859?
#
# ENCODING  = UTF8
# ENCODING  = ISO8859
ENCODING = @ENCODING@












# You should not have to change anything below this line
###############################################################################

# Object files for the SQLite library.
#
LIBOBJ = attach.lo auth.lo btree.lo build.lo copy.lo \
         delete.lo expr.lo func.lo hash.lo insert.lo \
         main.lo opcodes.lo os.lo pager.lo parse.lo pragma.lo \
         printf.lo random.lo select.lo table.lo tokenize.lo \
         update.lo util.lo vacuum.lo vdbe.lo \
         where.lo trigger.lo





# All of the source code files.
#
SRC = \
  $(TOP)/src/attach.c \
  $(TOP)/src/auth.c \
  $(TOP)/src/btree.c \







>
>
>
>
>
>
>
>
>
>
>












>
>
>
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
LIBREADLINE = @TARGET_READLINE_LIBS@

# Should the database engine assume text is coded as UTF-8 or iso8859?
#
# ENCODING  = UTF8
# 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
###############################################################################

# Object files for the SQLite library.
#
LIBOBJ = attach.lo auth.lo btree.lo build.lo copy.lo \
         delete.lo expr.lo func.lo hash.lo insert.lo \
         main.lo opcodes.lo os.lo pager.lo parse.lo pragma.lo \
         printf.lo random.lo select.lo table.lo tokenize.lo \
         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 = \
  $(TOP)/src/attach.c \
  $(TOP)/src/auth.c \
  $(TOP)/src/btree.c \
173
174
175
176
177
178
179



180
181
182
183
184
185
186
187
188
189
190
191
lemon:	$(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
	$(BCC) -o lemon $(TOP)/tool/lemon.c
	cp $(TOP)/tool/lempar.c .

btree.lo:	$(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
	$(LIBTOOL) $(TCC) -c $(TOP)/src/btree.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

pager.lo:	$(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
	$(LIBTOOL) $(TCC) -c $(TOP)/src/pager.c

opcodes.lo:	opcodes.c
	$(LIBTOOL) $(TCC) -c opcodes.c








>
>
>




|







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
lemon:	$(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
	$(BCC) -o lemon $(TOP)/tool/lemon.c
	cp $(TOP)/tool/lempar.c .

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 ${INCOREFLAGS} $(TOP)/src/main.c

pager.lo:	$(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
	$(LIBTOOL) $(TCC) -c $(TOP)/src/pager.c

opcodes.lo:	opcodes.c
	$(LIBTOOL) $(TCC) -c opcodes.c

Changes to configure.
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
#  include <stdint.h>
# endif
#endif
#if HAVE_UNISTD_H
# 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_files=''

# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.







|







463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
#  include <stdint.h>
# endif
#endif
#if HAVE_UNISTD_H
# 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 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.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
1003
1004
1005
1006
1007
1008
1009


1010
1011
1012
1013
1014
1015
1016
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-shared=PKGS  build shared libraries default=yes
  --enable-static=PKGS  build static libraries default=yes
  --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



Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-gnu-ld           assume the C compiler uses GNU ld default=no
  --with-pic              try to use only PIC/non-PIC objects default=use both
  --with-hints=FILE       Read configuration options from FILE







>
>







1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-shared=PKGS  build shared libraries default=yes
  --enable-static=PKGS  build static libraries default=yes
  --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]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-gnu-ld           assume the C compiler uses GNU ld default=no
  --with-pic              try to use only PIC/non-PIC objects default=use both
  --with-hints=FILE       Read configuration options from FILE
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442






# The following RCS revision string applies to configure.in
# $Revision: 1.13 $

#########
# Programs needed
#
# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
  enableval="$enable_shared"







|







1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444






# The following RCS revision string applies to configure.in
# $Revision: 1.14 $

#########
# Programs needed
#
# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
  enableval="$enable_shared"
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes

# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case $host in
*-*-irix6*)
  # Find out which ABI we are using.
  echo '#line 4037 "configure"' > conftest.$ac_ext
  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; then
    case `/usr/bin/file conftest.$ac_objext` in
    *32-bit*)







|







4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes

# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case $host in
*-*-irix6*)
  # Find out which ABI we are using.
  echo '#line 4039 "configure"' > conftest.$ac_ext
  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; then
    case `/usr/bin/file conftest.$ac_objext` in
    *32-bit*)
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
# the output directory.  Thus, making CWD read-only will cause this test
# to fail, enabling locking or at least warning the user not to do parallel
# builds.
chmod -w .
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
  # 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_cv_compiler_c_o=no
  else
    lt_cv_compiler_c_o=yes
  fi







|







4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
# the output directory.  Thus, making CWD read-only will cause this test
# to fail, enabling locking or at least warning the user not to do parallel
# builds.
chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
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_cv_compiler_c_o=no
  else
    lt_cv_compiler_c_o=yes
  fi
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
else
  	  if test "$cross_compiling" = yes; then :
  lt_cv_dlopen_self=cross
else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  lt_status=$lt_dlunknown
  cat > conftest.$ac_ext <<EOF
#line 6411 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif

#include <stdio.h>







|







6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
else
  	  if test "$cross_compiling" = yes; then :
  lt_cv_dlopen_self=cross
else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  lt_status=$lt_dlunknown
  cat > conftest.$ac_ext <<EOF
#line 6413 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif

#include <stdio.h>
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
else
  	  if test "$cross_compiling" = yes; then :
  lt_cv_dlopen_self_static=cross
else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  lt_status=$lt_dlunknown
  cat > conftest.$ac_ext <<EOF
#line 6509 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif

#include <stdio.h>







|







6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
else
  	  if test "$cross_compiling" = yes; then :
  lt_cv_dlopen_self_static=cross
else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  lt_status=$lt_dlunknown
  cat > conftest.$ac_ext <<EOF
#line 6511 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif

#include <stdio.h>
8237
8238
8239
8240
8241
8242
8243

































































8244
8245
8246
8247
8248
8249
8250
echo "${ECHO_T}iso8859" >&6
else
  ENCODING=UTF8
  echo "$as_me:$LINENO: result: UTF-8" >&5
echo "${ECHO_T}UTF-8" >&6
fi



































































###########
# Lots of things are different if we are compiling for Windows using
# the CYGWIN environment.  So check for that special case and handle
# things accordingly.
#
echo "$as_me:$LINENO: checking if executables have the .exe suffix" >&5







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
echo "${ECHO_T}iso8859" >&6
else
  ENCODING=UTF8
  echo "$as_me:$LINENO: result: UTF-8" >&5
echo "${ECHO_T}UTF-8" >&6
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
# things accordingly.
#
echo "$as_me:$LINENO: checking if executables have the .exe suffix" >&5
9855
9856
9857
9858
9859
9860
9861



9862
9863
9864
9865
9866
9867
9868
s,@TARGET_CC@,$TARGET_CC,;t t
s,@TARGET_CFLAGS@,$TARGET_CFLAGS,;t t
s,@TARGET_LINK@,$TARGET_LINK,;t t
s,@TARGET_LFLAGS@,$TARGET_LFLAGS,;t t
s,@TARGET_RANLIB@,$TARGET_RANLIB,;t t
s,@TARGET_AR@,$TARGET_AR,;t t
s,@ENCODING@,$ENCODING,;t t



s,@BUILD_EXEEXT@,$BUILD_EXEEXT,;t t
s,@OS_UNIX@,$OS_UNIX,;t t
s,@OS_WIN@,$OS_WIN,;t t
s,@TARGET_EXEEXT@,$TARGET_EXEEXT,;t t
s,@TARGET_LIBS@,$TARGET_LIBS,;t t
s,@TARGET_TCL_LIBS@,$TARGET_TCL_LIBS,;t t
s,@TARGET_TCL_INC@,$TARGET_TCL_INC,;t t







>
>
>







9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
s,@TARGET_CC@,$TARGET_CC,;t t
s,@TARGET_CFLAGS@,$TARGET_CFLAGS,;t t
s,@TARGET_LINK@,$TARGET_LINK,;t t
s,@TARGET_LFLAGS@,$TARGET_LFLAGS,;t t
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
s,@TARGET_EXEEXT@,$TARGET_EXEEXT,;t t
s,@TARGET_LIBS@,$TARGET_LIBS,;t t
s,@TARGET_TCL_LIBS@,$TARGET_TCL_LIBS,;t t
s,@TARGET_TCL_INC@,$TARGET_TCL_INC,;t t
Changes to configure.ac.
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# the corresponding code.
#
AC_INIT(src/sqlite.h.in)

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 $

#########
# Programs needed
#
AC_PROG_LIBTOOL
AC_PROG_INSTALL








|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# the corresponding code.
#
AC_INIT(src/sqlite.h.in)

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.3 $

#########
# Programs needed
#
AC_PROG_LIBTOOL
AC_PROG_INSTALL

301
302
303
304
305
306
307















































308
309
310
311
312
313
314
  AC_MSG_RESULT([iso8859])
else
  ENCODING=UTF8
  AC_MSG_RESULT([UTF-8])
fi
AC_SUBST(ENCODING)
















































###########
# Lots of things are different if we are compiling for Windows using
# the CYGWIN environment.  So check for that special case and handle
# things accordingly.
#
AC_MSG_CHECKING([if executables have the .exe suffix])
if test "$config_BUILD_EXEEXT" = ".exe"; then







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
  AC_MSG_RESULT([iso8859])
else
  ENCODING=UTF8
  AC_MSG_RESULT([UTF-8])
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
# things accordingly.
#
AC_MSG_CHECKING([if executables have the .exe suffix])
if test "$config_BUILD_EXEEXT" = ".exe"; then
Changes to src/attach.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** 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 $
*/
#include "sqliteInt.h"

/*
** This routine is called by the parser to process an ATTACH statement:
**
**     ATTACH DATABASE filename AS dbname













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.2 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"

/*
** This routine is called by the parser to process an ATTACH statement:
**
**     ATTACH DATABASE filename AS dbname
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
    }
  }
  aNew->zName = zName;
  zFile = 0;
  sqliteSetNString(&zFile, pFilename->z, pFilename->n, 0);
  if( zFile==0 ) return;
  sqliteDequote(zFile);
  rc = sqliteBtreeOpen(zFile, 0, MAX_PAGES, &aNew->pBt);
  if( rc ){
    sqliteErrorMsg(pParse, "unable to open database: %s", zFile);
  }
  sqliteFree(zFile);
  db->flags &= ~SQLITE_Initialized;
  if( pParse->nErr ) return;
  rc = sqliteInit(pParse->db, &pParse->zErrMsg);







|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
    }
  }
  aNew->zName = zName;
  zFile = 0;
  sqliteSetNString(&zFile, pFilename->z, pFilename->n, 0);
  if( zFile==0 ) return;
  sqliteDequote(zFile);
  rc = sqliteBtreeFactory(db, zFile, 0, MAX_PAGES, &aNew->pBt);
  if( rc ){
    sqliteErrorMsg(pParse, "unable to open database: %s", zFile);
  }
  sqliteFree(zFile);
  db->flags &= ~SQLITE_Initialized;
  if( pParse->nErr ) return;
  rc = sqliteInit(pParse->db, &pParse->zErrMsg);
Changes to src/btree.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.87 2003/04/06 20:44:45 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $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
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
45
46
47
48
49
50
51

52



53
54
55
56
57
58
59
**
** The first page of the file contains a magic string used to verify that
** the file really is a valid BTree database, a pointer to a list of unused
** pages in the file, and some meta information.  The root of the first
** 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 */



#define SQLITE_NO_BTREE_DEFS

#include "sqliteInt.h"
#include "pager.h"
#include "btree.h"
#include <assert.h>








>
|
>
>
>







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
**
** The first page of the file contains a magic string used to verify that
** the file really is a valid BTree database, a pointer to a list of unused
** pages in the file, and some meta information.  The root of the first
** 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 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"
#include "pager.h"
#include "btree.h"
#include <assert.h>

Changes to src/build.c.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**     PRAGMA
**
** $Id: build.c,v 1.143 2003/04/06 21:08:24 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Check to see if the schema for the database needs







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**     PRAGMA
**
** $Id: build.c,v 1.144 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Check to see if the schema for the database needs
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#endif
 

  /* Before trying to create a temporary table, make sure the Btree for
  ** 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);
    if( rc!=SQLITE_OK ){
      sqliteSetString(&pParse->zErrMsg, "unable to open a temporary database "
        "file for storing temporary tables", 0);
      pParse->nErr++;
      return;
    }
    if( db->flags & SQLITE_InTrans ){







|







432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#endif
 

  /* Before trying to create a temporary table, make sure the Btree for
  ** holding temporary tables is open.
  */
  if( isTemp && db->aDb[1].pBt==0 && !pParse->explain ){
    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);
      pParse->nErr++;
      return;
    }
    if( db->flags & SQLITE_InTrans ){
Changes to src/main.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** 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 $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** A pointer to this structure is used to communicate information







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.122 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** A pointer to this structure is used to communicate information
1051
1052
1053
1054
1055
1056
1057












































  void *pArg
){
  void *pOld = db->pCommitArg;
  db->xCommitCallback = xCallback;
  db->pCommitArg = pArg;
  return pOld;
}



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
  void *pArg
){
  void *pOld = db->pCommitArg;
  db->xCommitCallback = xCallback;
  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);
  }
}
Changes to src/pragma.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.1 2003/04/06 21:08:24 drh Exp $
*/
#include "sqliteInt.h"

/*
** Interpret the given string as a boolean value.
*/
static int getBoolean(char *z){













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.2 2003/04/13 18:26:51 paul Exp $
*/
#include "sqliteInt.h"

/*
** Interpret the given string as a boolean value.
*/
static int getBoolean(char *z){
59
60
61
62
63
64
65















66
67
68
69
70
71
72
    return atoi(z);
  }
  for(i=0; i<sizeof(aKey)/sizeof(aKey[0]); i++){
    if( sqliteStrICmp(z,aKey[i].zWord)==0 ) return aKey[i].val;
  }
  return 1;
}
















/*
** Process a pragma statement.  
**
** Pragmas are of this form:
**
**      PRAGMA id = value







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    return atoi(z);
  }
  for(i=0; i<sizeof(aKey)/sizeof(aKey[0]); i++){
    if( sqliteStrICmp(z,aKey[i].zWord)==0 ) return aKey[i].val;
  }
  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.  
**
** Pragmas are of this form:
**
**      PRAGMA id = value
417
418
419
420
421
422
423
























































424
425
426
427
428
429
430
    for(i=0; i<db->nDb; i++){
      if( db->aDb[i].pBt==0 ) continue;
      assert( db->aDb[i].zName!=0 );
      sqliteVdbeAddOp(v, OP_Integer, i, 0);
      sqliteVdbeAddOp(v, OP_String, 0, 0);
      sqliteVdbeChangeP3(v, -1, db->aDb[i].zName, P3_STATIC);
      sqliteVdbeAddOp(v, OP_Callback, 2, 0);
























































    }
  }else

#ifndef NDEBUG
  if( sqliteStrICmp(zLeft, "parser_trace")==0 ){
    extern void sqliteParserTrace(FILE*, char *);
    if( getBoolean(zRight) ){







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
    for(i=0; i<db->nDb; i++){
      if( db->aDb[i].pBt==0 ) continue;
      assert( db->aDb[i].zName!=0 );
      sqliteVdbeAddOp(v, OP_Integer, i, 0);
      sqliteVdbeAddOp(v, OP_String, 0, 0);
      sqliteVdbeChangeP3(v, -1, db->aDb[i].zName, P3_STATIC);
      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 ){
    extern void sqliteParserTrace(FILE*, char *);
    if( getBoolean(zRight) ){
Changes to src/sqliteInt.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.170 2003/04/03 15:46:04 drh Exp $
*/
#include "config.h"
#include "sqlite.h"
#include "hash.h"
#include "vdbe.h"
#include "parse.h"
#include "btree.h"













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.171 2003/04/13 18:26:52 paul Exp $
*/
#include "config.h"
#include "sqlite.h"
#include "hash.h"
#include "vdbe.h"
#include "parse.h"
#include "btree.h"
237
238
239
240
241
242
243

244
245
246
247
248
249
250
  Db aDbStatic[2];              /* Static space for the 2 default backends */
  int flags;                    /* Miscellanous flags. See below */
  u8 file_format;               /* What file format version is this database? */
  u8 safety_level;              /* How aggressive at synching data to disk */
  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 nTable;                   /* Number of tables in the database */
  void *pBusyArg;               /* 1st Argument to the busy callback */
  int (*xBusyCallback)(void *,const char*,int);  /* The busy callback */
  void *pBeginArg;              /* Argument to the xBeginCallback() */
  int (*xBeginCallback)(void*); /* Invoked at every transaction start */
  void *pCommitArg;             /* Argument to xCommitCallback() */   
  int (*xCommitCallback)(void*);/* Invoked at every commit. */







>







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
  Db aDbStatic[2];              /* Static space for the 2 default backends */
  int flags;                    /* Miscellanous flags. See below */
  u8 file_format;               /* What file format version is this database? */
  u8 safety_level;              /* How aggressive at synching data to disk */
  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 */
  void *pBeginArg;              /* Argument to the xBeginCallback() */
  int (*xBeginCallback)(void*); /* Invoked at every transaction start */
  void *pCommitArg;             /* Argument to xCommitCallback() */   
  int (*xCommitCallback)(void*);/* Invoked at every commit. */
1093
1094
1095
1096
1097
1098
1099

  int sqliteAuthCheck(Parse*,int, const char*, const char*);
#else
# define sqliteAuthRead(a,b,c,d)
# define sqliteAuthCheck(a,b,c,d)    SQLITE_OK
#endif
void sqliteAttach(Parse*, Token*, Token*);
void sqliteDetach(Parse*, Token*);








>
1094
1095
1096
1097
1098
1099
1100
1101
  int sqliteAuthCheck(Parse*,int, const char*, const char*);
#else
# define sqliteAuthRead(a,b,c,d)
# define sqliteAuthCheck(a,b,c,d)    SQLITE_OK
#endif
void sqliteAttach(Parse*, Token*, Token*);
void sqliteDetach(Parse*, Token*);
int sqliteBtreeFactory(const sqlite *db, const char *zFilename, int mode, int nPg, Btree **ppBtree);
Changes to src/test3.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the btree.c module in SQLite.  This code
** 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 $
*/
#include "sqliteInt.h"
#include "pager.h"
#include "btree.h"
#include "tcl.h"
#include <stdlib.h>
#include <string.h>







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the btree.c module in SQLite.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test3.c,v 1.23 2003/04/13 18:26:52 paul Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
#include "btree.h"
#include "tcl.h"
#include <stdlib.h>
#include <string.h>
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  int rc;
  char zBuf[100];
  if( argc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
       " FILENAME\"", 0);
    return TCL_ERROR;
  }
  rc = sqliteBtreeOpen(argv[1], 0, 1000, &pBt);
  if( rc!=SQLITE_OK ){
    Tcl_AppendResult(interp, errorName(rc), 0);
    return TCL_ERROR;
  }
  sprintf(zBuf,"%p", pBt);
  if( strncmp(zBuf,"0x",2) ){
    sprintf(zBuf, "0x%p", pBt);







|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  int rc;
  char zBuf[100];
  if( argc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
       " FILENAME\"", 0);
    return TCL_ERROR;
  }
  rc = sqliteBtreeFactory(0, argv[1], 0, 1000, &pBt);
  if( rc!=SQLITE_OK ){
    Tcl_AppendResult(interp, errorName(rc), 0);
    return TCL_ERROR;
  }
  sprintf(zBuf,"%p", pBt);
  if( strncmp(zBuf,"0x",2) ){
    sprintf(zBuf, "0x%p", pBt);
Changes to src/vdbe.c.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** 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 $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The makefile scans this source file and creates the following
** array of string constants which are the names of all VDBE opcodes.







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** 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.212 2003/04/13 18:26:52 paul Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The makefile scans this source file and creates the following
** array of string constants which are the names of all VDBE opcodes.
3499
3500
3501
3502
3503
3504
3505
3506

3507
3508
3509
3510
3511
3512
3513
  Cursor *pCx;
  VERIFY( if( i<0 ) goto bad_instruction; )
  if( expandCursorArraySize(p, i) ) goto no_mem;
  pCx = &p->aCsr[i];
  cleanupCursor(pCx);
  memset(pCx, 0, sizeof(*pCx));
  pCx->nullRow = 1;
  rc = sqliteBtreeOpen(0, 1, TEMP_PAGES, &pCx->pBt);

  if( rc==SQLITE_OK ){
    rc = sqliteBtreeBeginTrans(pCx->pBt);
  }
  if( rc==SQLITE_OK ){
    if( pOp->p2 ){
      int pgno;
      rc = sqliteBtreeCreateIndex(pCx->pBt, &pgno);







|
>







3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
  Cursor *pCx;
  VERIFY( if( i<0 ) goto bad_instruction; )
  if( expandCursorArraySize(p, i) ) goto no_mem;
  pCx = &p->aCsr[i];
  cleanupCursor(pCx);
  memset(pCx, 0, sizeof(*pCx));
  pCx->nullRow = 1;
  rc = sqliteBtreeFactory(db, ":temp:", 1, TEMP_PAGES, &pCx->pBt);

  if( rc==SQLITE_OK ){
    rc = sqliteBtreeBeginTrans(pCx->pBt);
  }
  if( rc==SQLITE_OK ){
    if( pOp->p2 ){
      int pgno;
      rc = sqliteBtreeCreateIndex(pCx->pBt, &pgno);