Fossil SCM

Bring the merge-info-html branch up to date with trunk, step 1 of 2.

stephan 2025-02-20 14:32 UTC merge-info-html merge
Commit 1140b020de296a7724c5d444f1bb73d96a666333b38111280efcf6f81c36a761
80 files changed +6 -6 +1 -1 +110 -36 +65 -16 +3000 -2454 +165 -61 +4 -1 +1 -1 +2 -3 +1 -1 +38 -27 +2 -2 +1 -1 +12 -3 +3 -4 +26 -3 +1 +108 -32 +10 -4 +10 -4 +49 -39 +9 +5 -1 +92 -16 +92 -16 +8 -1 +18 +39 +1 -1 -2 +90 -26 +3 -1 +28 -12 +1 -1 +466 -36 +37 -10 +17 -2 +7 -3 +386 +23 -8 +23 -8 +6 -1 +151 -24 +50 -17 +14 -1 +3 -3 +1 -1 +71 -35 +3 -39 +4 -4 +2 +473 -462 +17 -11 +1 +11 -13 +55 -2 +25 +28 -25 +6 -4 +2 +1 -1 +24 -18 +4 -1 +16 -5 +12 -6 +16 -2 +14 -2 +4 -8 +20 -22 +53 -1 +14 -11 +1 -1 +1 -1 +9 -8 +19 +1 +5 -4 +117 +197 -88 +8
+6 -6
--- Dockerfile
+++ Dockerfile
@@ -3,19 +3,19 @@
33
44
## ---------------------------------------------------------------------
55
## STAGE 1: Build static Fossil binary
66
## ---------------------------------------------------------------------
77
8
-### We aren't pinning to a more stable version of Alpine because we want
8
+### We don't pin a more stable version of our base layer because we want
99
### to build with the latest tools and libraries available in case they
1010
### fixed something that matters to us since the last build. Everything
1111
### below depends on this layer, and so, alas, we toss this container's
1212
### cache on Alpine's release schedule, roughly once a month.
1313
FROM alpine:latest AS bld
1414
WORKDIR /fsl
1515
16
-### Bake the basic Alpine Linux into a base layer so it only changes
16
+### Bake the build-time userland into a base layer so it only changes
1717
### when the upstream image is updated or we change the package set.
1818
RUN set -x \
1919
&& apk update \
2020
&& apk upgrade --no-cache \
2121
&& apk add --no-cache \
@@ -23,19 +23,19 @@
2323
linux-headers musl-dev \
2424
openssl-dev openssl-libs-static \
2525
zlib-dev zlib-static
2626
2727
### Build Fossil as a separate layer so we don't have to rebuild the
28
-### Alpine environment for each iteration of Fossil's dev cycle.
28
+### userland for each iteration of Fossil's dev cycle.
2929
###
3030
### We must cope with a bizarre ADD misfeature here: it unpacks tarballs
3131
### automatically when you give it a local file name but not if you give
3232
### it a /tarball URL! It matters because we default to a URL in case
3333
### you're building outside a Fossil checkout, but when building via the
34
-### container-image target, we avoid a costly hit on fossil-scm.org
35
-### by leveraging its DVCS nature via the "tarball" command and passing
36
-### the resulting file's name in.
34
+### container-image target, we avoid a costly hit on fossil-scm.org by
35
+### leveraging its DVCS nature via the "tarball" command and passing the
36
+### resulting file's name in.
3737
ARG FSLCFG=""
3838
ARG FSLVER="trunk"
3939
ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
4040
ENV FSLSTB=/fsl/src.tar.gz
4141
ADD $FSLURL $FSLSTB
4242
--- Dockerfile
+++ Dockerfile
@@ -3,19 +3,19 @@
3
4 ## ---------------------------------------------------------------------
5 ## STAGE 1: Build static Fossil binary
6 ## ---------------------------------------------------------------------
7
8 ### We aren't pinning to a more stable version of Alpine because we want
9 ### to build with the latest tools and libraries available in case they
10 ### fixed something that matters to us since the last build. Everything
11 ### below depends on this layer, and so, alas, we toss this container's
12 ### cache on Alpine's release schedule, roughly once a month.
13 FROM alpine:latest AS bld
14 WORKDIR /fsl
15
16 ### Bake the basic Alpine Linux into a base layer so it only changes
17 ### when the upstream image is updated or we change the package set.
18 RUN set -x \
19 && apk update \
20 && apk upgrade --no-cache \
21 && apk add --no-cache \
@@ -23,19 +23,19 @@
23 linux-headers musl-dev \
24 openssl-dev openssl-libs-static \
25 zlib-dev zlib-static
26
27 ### Build Fossil as a separate layer so we don't have to rebuild the
28 ### Alpine environment for each iteration of Fossil's dev cycle.
29 ###
30 ### We must cope with a bizarre ADD misfeature here: it unpacks tarballs
31 ### automatically when you give it a local file name but not if you give
32 ### it a /tarball URL! It matters because we default to a URL in case
33 ### you're building outside a Fossil checkout, but when building via the
34 ### container-image target, we avoid a costly hit on fossil-scm.org
35 ### by leveraging its DVCS nature via the "tarball" command and passing
36 ### the resulting file's name in.
37 ARG FSLCFG=""
38 ARG FSLVER="trunk"
39 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
40 ENV FSLSTB=/fsl/src.tar.gz
41 ADD $FSLURL $FSLSTB
42
--- Dockerfile
+++ Dockerfile
@@ -3,19 +3,19 @@
3
4 ## ---------------------------------------------------------------------
5 ## STAGE 1: Build static Fossil binary
6 ## ---------------------------------------------------------------------
7
8 ### We don't pin a more stable version of our base layer because we want
9 ### to build with the latest tools and libraries available in case they
10 ### fixed something that matters to us since the last build. Everything
11 ### below depends on this layer, and so, alas, we toss this container's
12 ### cache on Alpine's release schedule, roughly once a month.
13 FROM alpine:latest AS bld
14 WORKDIR /fsl
15
16 ### Bake the build-time userland into a base layer so it only changes
17 ### when the upstream image is updated or we change the package set.
18 RUN set -x \
19 && apk update \
20 && apk upgrade --no-cache \
21 && apk add --no-cache \
@@ -23,19 +23,19 @@
23 linux-headers musl-dev \
24 openssl-dev openssl-libs-static \
25 zlib-dev zlib-static
26
27 ### Build Fossil as a separate layer so we don't have to rebuild the
28 ### userland for each iteration of Fossil's dev cycle.
29 ###
30 ### We must cope with a bizarre ADD misfeature here: it unpacks tarballs
31 ### automatically when you give it a local file name but not if you give
32 ### it a /tarball URL! It matters because we default to a URL in case
33 ### you're building outside a Fossil checkout, but when building via the
34 ### container-image target, we avoid a costly hit on fossil-scm.org by
35 ### leveraging its DVCS nature via the "tarball" command and passing the
36 ### resulting file's name in.
37 ARG FSLCFG=""
38 ARG FSLVER="trunk"
39 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
40 ENV FSLSTB=/fsl/src.tar.gz
41 ADD $FSLURL $FSLSTB
42
--- Makefile.classic
+++ Makefile.classic
@@ -95,11 +95,11 @@
9595
#
9696
# Automatic platform-specific options.
9797
HOST_OS_CMD = uname -s
9898
HOST_OS = $(HOST_OS_CMD:sh)
9999
100
-LIB.SunOS= -lsocket -lnsl
100
+LIB.SunOS= -lsocket -lnsl -lrt
101101
LIB += $(LIB.$(HOST_OS))
102102
103103
TCC.DragonFly += -DUSE_PREAD
104104
TCC.FreeBSD += -DUSE_PREAD
105105
TCC.NetBSD += -DUSE_PREAD
106106
--- Makefile.classic
+++ Makefile.classic
@@ -95,11 +95,11 @@
95 #
96 # Automatic platform-specific options.
97 HOST_OS_CMD = uname -s
98 HOST_OS = $(HOST_OS_CMD:sh)
99
100 LIB.SunOS= -lsocket -lnsl
101 LIB += $(LIB.$(HOST_OS))
102
103 TCC.DragonFly += -DUSE_PREAD
104 TCC.FreeBSD += -DUSE_PREAD
105 TCC.NetBSD += -DUSE_PREAD
106
--- Makefile.classic
+++ Makefile.classic
@@ -95,11 +95,11 @@
95 #
96 # Automatic platform-specific options.
97 HOST_OS_CMD = uname -s
98 HOST_OS = $(HOST_OS_CMD:sh)
99
100 LIB.SunOS= -lsocket -lnsl -lrt
101 LIB += $(LIB.$(HOST_OS))
102
103 TCC.DragonFly += -DUSE_PREAD
104 TCC.FreeBSD += -DUSE_PREAD
105 TCC.NetBSD += -DUSE_PREAD
106
+110 -36
--- auto.def
+++ auto.def
@@ -44,10 +44,24 @@
4444
# to compare the one they have against the minimum required
4545
if {[opt-bool print-minimum-sqlite-version]} {
4646
puts [get-define MINIMUM_SQLITE_VERSION]
4747
exit 0
4848
}
49
+
50
+# Space characters have never been allowed in either the source
51
+# tree nor the build directory. But the resulting error messages
52
+# could be confusing. The following checks make the reason for the
53
+# failure clear.
54
+#
55
+if {[string first " " $autosetup(srcdir)] != -1} {
56
+ user-error "The pathname of the source tree\
57
+ may not contain space characters"
58
+}
59
+if {[string first " " $autosetup(builddir)] != -1} {
60
+ user-error "The pathname of the build directory\
61
+ may not contain space characters"
62
+}
4963
5064
set outOfTreeBuild 0
5165
if {![file exists fossil.1]} {
5266
puts "This appears to be an out-of-tree build."
5367
set outOfTreeBuild 1
@@ -82,11 +96,11 @@
8296
cc-check-progs tclsh
8397
set hbtd /usr/local/Cellar/tcl-tk
8498
if {[string equal false [get-define TCLSH]]} {
8599
msg-result "WARNING: 'make test' will not run here."
86100
} else {
87
- set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"]
101
+ set v [exec sh -c "echo 'puts \$tcl_version' | tclsh"]
88102
if {[expr {$v >= 8.6}]} {
89103
msg-result "Found Tclsh version $v in the PATH."
90104
define TCLSH tclsh
91105
} elseif {[file isdirectory $hbtd]} {
92106
# This is a macOS system with the Homebrew version of Tcl/Tk
@@ -104,11 +118,11 @@
104118
msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
105119
define TCLSH false ;# force "make test" failure via /usr/bin/false
106120
}
107121
}
108122
109
-define CFLAGS [get-env CFLAGS "-g -O2"]
123
+define CFLAGS [get-env CFLAGS "-g -Os"]
110124
define EXTRA_CFLAGS "-Wall"
111125
define EXTRA_LDFLAGS ""
112126
define USE_SYSTEM_SQLITE 0
113127
define USE_LINENOISE 0
114128
define USE_MMAN_H 0
@@ -230,11 +244,14 @@
230244
test_system_sqlite
231245
232246
}
233247
234248
proc is_mingw {} {
235
- return [string match *mingw* [get-define host]]
249
+ return [expr {
250
+ [string match *mingw* [get-define host]] &&
251
+ ![file exists "/dev/null"]
252
+ }]
236253
}
237254
238255
if {[is_mingw]} {
239256
define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
240257
define-append LIBS -lkernel32 -lws2_32
@@ -422,15 +439,15 @@
422439
if {$ssldirs eq "tree"} {
423440
set ssldir [file dirname $autosetup(dir)]/compat/openssl
424441
if {![file isdirectory $ssldir]} {
425442
user-error "The OpenSSL in source tree directory does not exist"
426443
}
427
- set msg "ssl in $ssldir"
444
+ set msg "openssl in $ssldir"
428445
set cflags "-I$ssldir/include"
429446
set ldflags "-L$ssldir"
430447
set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
431
- set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs]
448
+ set found [check-for-openssl "openssl in source tree" "$cflags $ldflags" $ssllibs]
432449
} else {
433450
if {$ssldirs in {auto ""}} {
434451
catch {
435452
set cflags [exec pkg-config openssl --cflags-only-I]
436453
set ldflags [exec pkg-config openssl --libs-only-L]
@@ -443,21 +460,30 @@
443460
}
444461
}
445462
if {!$found} {
446463
foreach dir $ssldirs {
447464
if {$dir eq ""} {
448
- set msg "system ssl"
465
+ set msg "system openssl"
449466
set cflags ""
450467
set ldflags ""
451468
} else {
452
- set msg "ssl in $dir"
469
+ set msg "openssl in $dir"
453470
set cflags "-I$dir/include"
454471
set ldflags "-L$dir/lib"
455472
}
456473
if {[check-for-openssl $msg "$cflags $ldflags"]} {
457474
incr found
458475
break
476
+ }
477
+ if {$dir ne ""} {
478
+ set ldflags ""
479
+ set msg "static build of openssl in $dir"
480
+ set ssllibs "$dir/libssl.a $dir/libcrypto.a -lpthread"
481
+ if {[check-for-openssl $msg "$cflags $ldflags" $ssllibs]} {
482
+ incr found
483
+ break
484
+ }
459485
}
460486
}
461487
}
462488
}
463489
if {$found} {
@@ -683,45 +709,21 @@
683709
$tclconfig(TCL_LD_FLAGS)]
684710
define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
685711
define FOSSIL_ENABLE_TCL
686712
}
687713
688
-# Emscripten is a purely optional component used only for doing
689
-# in-tree builds of WASM stuff, as opposed to WASM binaries we import
690
-# from other places. This is only set up for Unix-style OSes and is
691
-# untested anywhere but Linux.
692
-set emsdkHome [opt-val with-emsdk]
693
-define EMSDK_HOME ""
694
-define EMSDK_ENV ""
695
-define EMCC_OPT "-Oz"
696
-if {$emsdkHome eq "" && [info exists ::env(EMSDK)]} {
697
- # Fall back to checking the environment. $EMSDK gets set
698
- # by sourcing emsdk_env.sh.
699
- set emsdkHome $::env(EMSDK)
700
-}
701
-if {$emsdkHome ne ""} {
702
- define EMSDK_HOME $emsdkHome
703
- set emsdkEnv "$emsdkHome/emsdk_env.sh"
704
- if {[file exists $emsdkEnv]} {
705
- puts "Using Emscripten SDK environment from $emsdkEnv."
706
- define EMSDK_ENV $emsdkEnv
707
- if {[info exists ::env(EMCC_OPT)]} {
708
- define EMCC_OPT $::env(EMCC_OPT)
709
- }
710
- } else {
711
- puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
712
- }
713
-}
714
-
715714
# Network functions require libraries on some systems
716715
cc-check-function-in-lib gethostbyname nsl
717716
if {![cc-check-function-in-lib socket {socket network}]} {
718717
# Last resort, may be Windows
719718
if {[is_mingw]} {
720719
define-append LIBS -lwsock32
721720
}
722721
}
722
+
723
+# Some systems (ex: SunOS) require -lrt in order to use nanosleep
724
+cc-check-function-in-lib nanosleep rt
723725
724726
# The SMTP module requires special libraries and headers for MX DNS
725727
# record lookups and such.
726728
cc-check-includes arpa/nameser.h
727729
cc-include-needs bind/resolv.h netinet/in.h
@@ -744,11 +746,11 @@
744746
cc-check-functions strchrnul
745747
cc-check-functions pledge
746748
cc-check-functions backtrace
747749
748750
# Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
749
-# guard against including it again; use cctest as cc-check-functions and
751
+# guard against including it again; use cctest as cc-check-functions and
750752
# cctest_function check for "getpass()" with no args and fail
751753
if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
752754
define FOSSIL_HAVE_GETPASS 1
753755
msg-result "Found getpass() with unistd.h"
754756
}
@@ -836,16 +838,88 @@
836838
# Linux can only infer the dependency on pthread from OpenSSL when
837839
# doing dynamic linkage.
838840
define-append LIBS -lpthread
839841
}
840842
841
-if {[get-define EMSDK_HOME] ne ""} {
843
+
844
+########################################################################
845
+# @proj-check-emsdk
846
+#
847
+# Emscripten is used for doing in-tree builds of web-based WASM stuff,
848
+# as opposed to WASI-based WASM or WASM binaries we import from other
849
+# places. This is only set up for Unix-style OSes and is untested
850
+# anywhere but Linux. Requires that the --with-emsdk flag be
851
+# registered with autosetup.
852
+#
853
+# It looks for the SDK in the location specified by --with-emsdk.
854
+# Values of "" or "auto" mean to check for the environment var EMSDK
855
+# (which gets set by the emsdk_env.sh script from the SDK) or that
856
+# same var passed to configure.
857
+#
858
+# If the given directory is found, it expects to find emsdk_env.sh in
859
+# that directory, as well as the emcc compiler somewhere under there.
860
+#
861
+# If the --with-emsdk flag is explicitly provided and the SDK is not
862
+# found then a fatal error is generated, otherwise failure to find the
863
+# SDK is not fatal.
864
+#
865
+# Defines the following:
866
+#
867
+# - EMSDK_HOME = top dir of the emsdk or "".
868
+# - EMSDK_ENV_SH = path to EMSDK_HOME/emsdk_env.sh or ""
869
+# - BIN_EMCC = $EMSDK_HOME/upstream/emscripten/emcc or ""
870
+# - HAVE_EMSDK = 0 or 1 (this function's return value)
871
+#
872
+# Returns 1 if EMSDK_ENV_SH is found, else 0. If EMSDK_HOME is not empty
873
+# but BIN_EMCC is then emcc was not found in the EMSDK_HOME, in which
874
+# case we have to rely on the fact that sourcing $EMSDK_ENV_SH from a
875
+# shell will add emcc to the $PATH.
876
+proc proj-check-emsdk {} {
877
+ set emsdkHome [opt-val with-emsdk]
878
+ define EMSDK_HOME ""
879
+ define EMSDK_ENV_SH ""
880
+ define BIN_EMCC ""
881
+ set hadValue [llength $emsdkHome]
882
+ msg-checking "Emscripten SDK? "
883
+ if {$emsdkHome in {"" "auto"}} {
884
+ # Check the environment. $EMSDK gets set by sourcing emsdk_env.sh.
885
+ set emsdkHome [get-env EMSDK ""]
886
+ }
887
+ set rc 0
888
+ if {$emsdkHome ne ""} {
889
+ define EMSDK_HOME $emsdkHome
890
+ set emsdkEnv "$emsdkHome/emsdk_env.sh"
891
+ if {[file exists $emsdkEnv]} {
892
+ msg-result "$emsdkHome"
893
+ define EMSDK_ENV_SH $emsdkEnv
894
+ set rc 1
895
+ set emcc "$emsdkHome/upstream/emscripten/emcc"
896
+ if {[file exists $emcc]} {
897
+ define BIN_EMCC $emcc
898
+ }
899
+ } else {
900
+ msg-result "emsdk_env.sh not found in $emsdkHome"
901
+ }
902
+ } else {
903
+ msg-result "not found"
904
+ }
905
+ if {$hadValue && 0 == $rc} {
906
+ # Fail if it was explicitly requested but not found
907
+ proj-fatal "Cannot find the Emscripten SDK"
908
+ }
909
+ define HAVE_EMSDK $rc
910
+ return $rc
911
+}
912
+
913
+if {[proj-check-emsdk]} {
842914
define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh
915
+ define EMCC_OPT [get-env EMCC_OPT "-Oz"]; # optional flags to pass to emcc
843916
make-template tools/emcc.sh.in
844917
catch {exec chmod u+x tools/emcc.sh}
845918
} else {
846919
define EMCC_WRAPPER ""
920
+ define EMCC_OPT ""
847921
catch {exec rm -f tools/emcc.sh}
848922
}
849923
850924
# Tag container builds with a prefix of the checkin ID of the version
851925
# of Fossil each one contains. This not only allows multiple images
852926
--- auto.def
+++ auto.def
@@ -44,10 +44,24 @@
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47 exit 0
48 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
50 set outOfTreeBuild 0
51 if {![file exists fossil.1]} {
52 puts "This appears to be an out-of-tree build."
53 set outOfTreeBuild 1
@@ -82,11 +96,11 @@
82 cc-check-progs tclsh
83 set hbtd /usr/local/Cellar/tcl-tk
84 if {[string equal false [get-define TCLSH]]} {
85 msg-result "WARNING: 'make test' will not run here."
86 } else {
87 set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"]
88 if {[expr {$v >= 8.6}]} {
89 msg-result "Found Tclsh version $v in the PATH."
90 define TCLSH tclsh
91 } elseif {[file isdirectory $hbtd]} {
92 # This is a macOS system with the Homebrew version of Tcl/Tk
@@ -104,11 +118,11 @@
104 msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
105 define TCLSH false ;# force "make test" failure via /usr/bin/false
106 }
107 }
108
109 define CFLAGS [get-env CFLAGS "-g -O2"]
110 define EXTRA_CFLAGS "-Wall"
111 define EXTRA_LDFLAGS ""
112 define USE_SYSTEM_SQLITE 0
113 define USE_LINENOISE 0
114 define USE_MMAN_H 0
@@ -230,11 +244,14 @@
230 test_system_sqlite
231
232 }
233
234 proc is_mingw {} {
235 return [string match *mingw* [get-define host]]
 
 
 
236 }
237
238 if {[is_mingw]} {
239 define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
240 define-append LIBS -lkernel32 -lws2_32
@@ -422,15 +439,15 @@
422 if {$ssldirs eq "tree"} {
423 set ssldir [file dirname $autosetup(dir)]/compat/openssl
424 if {![file isdirectory $ssldir]} {
425 user-error "The OpenSSL in source tree directory does not exist"
426 }
427 set msg "ssl in $ssldir"
428 set cflags "-I$ssldir/include"
429 set ldflags "-L$ssldir"
430 set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
431 set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs]
432 } else {
433 if {$ssldirs in {auto ""}} {
434 catch {
435 set cflags [exec pkg-config openssl --cflags-only-I]
436 set ldflags [exec pkg-config openssl --libs-only-L]
@@ -443,21 +460,30 @@
443 }
444 }
445 if {!$found} {
446 foreach dir $ssldirs {
447 if {$dir eq ""} {
448 set msg "system ssl"
449 set cflags ""
450 set ldflags ""
451 } else {
452 set msg "ssl in $dir"
453 set cflags "-I$dir/include"
454 set ldflags "-L$dir/lib"
455 }
456 if {[check-for-openssl $msg "$cflags $ldflags"]} {
457 incr found
458 break
 
 
 
 
 
 
 
 
 
459 }
460 }
461 }
462 }
463 if {$found} {
@@ -683,45 +709,21 @@
683 $tclconfig(TCL_LD_FLAGS)]
684 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
685 define FOSSIL_ENABLE_TCL
686 }
687
688 # Emscripten is a purely optional component used only for doing
689 # in-tree builds of WASM stuff, as opposed to WASM binaries we import
690 # from other places. This is only set up for Unix-style OSes and is
691 # untested anywhere but Linux.
692 set emsdkHome [opt-val with-emsdk]
693 define EMSDK_HOME ""
694 define EMSDK_ENV ""
695 define EMCC_OPT "-Oz"
696 if {$emsdkHome eq "" && [info exists ::env(EMSDK)]} {
697 # Fall back to checking the environment. $EMSDK gets set
698 # by sourcing emsdk_env.sh.
699 set emsdkHome $::env(EMSDK)
700 }
701 if {$emsdkHome ne ""} {
702 define EMSDK_HOME $emsdkHome
703 set emsdkEnv "$emsdkHome/emsdk_env.sh"
704 if {[file exists $emsdkEnv]} {
705 puts "Using Emscripten SDK environment from $emsdkEnv."
706 define EMSDK_ENV $emsdkEnv
707 if {[info exists ::env(EMCC_OPT)]} {
708 define EMCC_OPT $::env(EMCC_OPT)
709 }
710 } else {
711 puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
712 }
713 }
714
715 # Network functions require libraries on some systems
716 cc-check-function-in-lib gethostbyname nsl
717 if {![cc-check-function-in-lib socket {socket network}]} {
718 # Last resort, may be Windows
719 if {[is_mingw]} {
720 define-append LIBS -lwsock32
721 }
722 }
 
 
 
723
724 # The SMTP module requires special libraries and headers for MX DNS
725 # record lookups and such.
726 cc-check-includes arpa/nameser.h
727 cc-include-needs bind/resolv.h netinet/in.h
@@ -744,11 +746,11 @@
744 cc-check-functions strchrnul
745 cc-check-functions pledge
746 cc-check-functions backtrace
747
748 # Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
749 # guard against including it again; use cctest as cc-check-functions and
750 # cctest_function check for "getpass()" with no args and fail
751 if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
752 define FOSSIL_HAVE_GETPASS 1
753 msg-result "Found getpass() with unistd.h"
754 }
@@ -836,16 +838,88 @@
836 # Linux can only infer the dependency on pthread from OpenSSL when
837 # doing dynamic linkage.
838 define-append LIBS -lpthread
839 }
840
841 if {[get-define EMSDK_HOME] ne ""} {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
842 define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh
 
843 make-template tools/emcc.sh.in
844 catch {exec chmod u+x tools/emcc.sh}
845 } else {
846 define EMCC_WRAPPER ""
 
847 catch {exec rm -f tools/emcc.sh}
848 }
849
850 # Tag container builds with a prefix of the checkin ID of the version
851 # of Fossil each one contains. This not only allows multiple images
852
--- auto.def
+++ auto.def
@@ -44,10 +44,24 @@
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47 exit 0
48 }
49
50 # Space characters have never been allowed in either the source
51 # tree nor the build directory. But the resulting error messages
52 # could be confusing. The following checks make the reason for the
53 # failure clear.
54 #
55 if {[string first " " $autosetup(srcdir)] != -1} {
56 user-error "The pathname of the source tree\
57 may not contain space characters"
58 }
59 if {[string first " " $autosetup(builddir)] != -1} {
60 user-error "The pathname of the build directory\
61 may not contain space characters"
62 }
63
64 set outOfTreeBuild 0
65 if {![file exists fossil.1]} {
66 puts "This appears to be an out-of-tree build."
67 set outOfTreeBuild 1
@@ -82,11 +96,11 @@
96 cc-check-progs tclsh
97 set hbtd /usr/local/Cellar/tcl-tk
98 if {[string equal false [get-define TCLSH]]} {
99 msg-result "WARNING: 'make test' will not run here."
100 } else {
101 set v [exec sh -c "echo 'puts \$tcl_version' | tclsh"]
102 if {[expr {$v >= 8.6}]} {
103 msg-result "Found Tclsh version $v in the PATH."
104 define TCLSH tclsh
105 } elseif {[file isdirectory $hbtd]} {
106 # This is a macOS system with the Homebrew version of Tcl/Tk
@@ -104,11 +118,11 @@
118 msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
119 define TCLSH false ;# force "make test" failure via /usr/bin/false
120 }
121 }
122
123 define CFLAGS [get-env CFLAGS "-g -Os"]
124 define EXTRA_CFLAGS "-Wall"
125 define EXTRA_LDFLAGS ""
126 define USE_SYSTEM_SQLITE 0
127 define USE_LINENOISE 0
128 define USE_MMAN_H 0
@@ -230,11 +244,14 @@
244 test_system_sqlite
245
246 }
247
248 proc is_mingw {} {
249 return [expr {
250 [string match *mingw* [get-define host]] &&
251 ![file exists "/dev/null"]
252 }]
253 }
254
255 if {[is_mingw]} {
256 define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
257 define-append LIBS -lkernel32 -lws2_32
@@ -422,15 +439,15 @@
439 if {$ssldirs eq "tree"} {
440 set ssldir [file dirname $autosetup(dir)]/compat/openssl
441 if {![file isdirectory $ssldir]} {
442 user-error "The OpenSSL in source tree directory does not exist"
443 }
444 set msg "openssl in $ssldir"
445 set cflags "-I$ssldir/include"
446 set ldflags "-L$ssldir"
447 set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
448 set found [check-for-openssl "openssl in source tree" "$cflags $ldflags" $ssllibs]
449 } else {
450 if {$ssldirs in {auto ""}} {
451 catch {
452 set cflags [exec pkg-config openssl --cflags-only-I]
453 set ldflags [exec pkg-config openssl --libs-only-L]
@@ -443,21 +460,30 @@
460 }
461 }
462 if {!$found} {
463 foreach dir $ssldirs {
464 if {$dir eq ""} {
465 set msg "system openssl"
466 set cflags ""
467 set ldflags ""
468 } else {
469 set msg "openssl in $dir"
470 set cflags "-I$dir/include"
471 set ldflags "-L$dir/lib"
472 }
473 if {[check-for-openssl $msg "$cflags $ldflags"]} {
474 incr found
475 break
476 }
477 if {$dir ne ""} {
478 set ldflags ""
479 set msg "static build of openssl in $dir"
480 set ssllibs "$dir/libssl.a $dir/libcrypto.a -lpthread"
481 if {[check-for-openssl $msg "$cflags $ldflags" $ssllibs]} {
482 incr found
483 break
484 }
485 }
486 }
487 }
488 }
489 if {$found} {
@@ -683,45 +709,21 @@
709 $tclconfig(TCL_LD_FLAGS)]
710 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
711 define FOSSIL_ENABLE_TCL
712 }
713
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
714 # Network functions require libraries on some systems
715 cc-check-function-in-lib gethostbyname nsl
716 if {![cc-check-function-in-lib socket {socket network}]} {
717 # Last resort, may be Windows
718 if {[is_mingw]} {
719 define-append LIBS -lwsock32
720 }
721 }
722
723 # Some systems (ex: SunOS) require -lrt in order to use nanosleep
724 cc-check-function-in-lib nanosleep rt
725
726 # The SMTP module requires special libraries and headers for MX DNS
727 # record lookups and such.
728 cc-check-includes arpa/nameser.h
729 cc-include-needs bind/resolv.h netinet/in.h
@@ -744,11 +746,11 @@
746 cc-check-functions strchrnul
747 cc-check-functions pledge
748 cc-check-functions backtrace
749
750 # Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
751 # guard against including it again; use cctest as cc-check-functions and
752 # cctest_function check for "getpass()" with no args and fail
753 if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
754 define FOSSIL_HAVE_GETPASS 1
755 msg-result "Found getpass() with unistd.h"
756 }
@@ -836,16 +838,88 @@
838 # Linux can only infer the dependency on pthread from OpenSSL when
839 # doing dynamic linkage.
840 define-append LIBS -lpthread
841 }
842
843
844 ########################################################################
845 # @proj-check-emsdk
846 #
847 # Emscripten is used for doing in-tree builds of web-based WASM stuff,
848 # as opposed to WASI-based WASM or WASM binaries we import from other
849 # places. This is only set up for Unix-style OSes and is untested
850 # anywhere but Linux. Requires that the --with-emsdk flag be
851 # registered with autosetup.
852 #
853 # It looks for the SDK in the location specified by --with-emsdk.
854 # Values of "" or "auto" mean to check for the environment var EMSDK
855 # (which gets set by the emsdk_env.sh script from the SDK) or that
856 # same var passed to configure.
857 #
858 # If the given directory is found, it expects to find emsdk_env.sh in
859 # that directory, as well as the emcc compiler somewhere under there.
860 #
861 # If the --with-emsdk flag is explicitly provided and the SDK is not
862 # found then a fatal error is generated, otherwise failure to find the
863 # SDK is not fatal.
864 #
865 # Defines the following:
866 #
867 # - EMSDK_HOME = top dir of the emsdk or "".
868 # - EMSDK_ENV_SH = path to EMSDK_HOME/emsdk_env.sh or ""
869 # - BIN_EMCC = $EMSDK_HOME/upstream/emscripten/emcc or ""
870 # - HAVE_EMSDK = 0 or 1 (this function's return value)
871 #
872 # Returns 1 if EMSDK_ENV_SH is found, else 0. If EMSDK_HOME is not empty
873 # but BIN_EMCC is then emcc was not found in the EMSDK_HOME, in which
874 # case we have to rely on the fact that sourcing $EMSDK_ENV_SH from a
875 # shell will add emcc to the $PATH.
876 proc proj-check-emsdk {} {
877 set emsdkHome [opt-val with-emsdk]
878 define EMSDK_HOME ""
879 define EMSDK_ENV_SH ""
880 define BIN_EMCC ""
881 set hadValue [llength $emsdkHome]
882 msg-checking "Emscripten SDK? "
883 if {$emsdkHome in {"" "auto"}} {
884 # Check the environment. $EMSDK gets set by sourcing emsdk_env.sh.
885 set emsdkHome [get-env EMSDK ""]
886 }
887 set rc 0
888 if {$emsdkHome ne ""} {
889 define EMSDK_HOME $emsdkHome
890 set emsdkEnv "$emsdkHome/emsdk_env.sh"
891 if {[file exists $emsdkEnv]} {
892 msg-result "$emsdkHome"
893 define EMSDK_ENV_SH $emsdkEnv
894 set rc 1
895 set emcc "$emsdkHome/upstream/emscripten/emcc"
896 if {[file exists $emcc]} {
897 define BIN_EMCC $emcc
898 }
899 } else {
900 msg-result "emsdk_env.sh not found in $emsdkHome"
901 }
902 } else {
903 msg-result "not found"
904 }
905 if {$hadValue && 0 == $rc} {
906 # Fail if it was explicitly requested but not found
907 proj-fatal "Cannot find the Emscripten SDK"
908 }
909 define HAVE_EMSDK $rc
910 return $rc
911 }
912
913 if {[proj-check-emsdk]} {
914 define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh
915 define EMCC_OPT [get-env EMCC_OPT "-Oz"]; # optional flags to pass to emcc
916 make-template tools/emcc.sh.in
917 catch {exec chmod u+x tools/emcc.sh}
918 } else {
919 define EMCC_WRAPPER ""
920 define EMCC_OPT ""
921 catch {exec rm -f tools/emcc.sh}
922 }
923
924 # Tag container builds with a prefix of the checkin ID of the version
925 # of Fossil each one contains. This not only allows multiple images
926
+65 -16
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -355,10 +355,15 @@
355355
**
356356
** The default behavior, if neither of the above is defined is to
357357
** use O_U8TEXT when writing to the Windows console (or anything
358358
** else for which _isatty() returns true) and to use O_BINARY or O_TEXT
359359
** for all other output channels.
360
+**
361
+** The SQLITE_USE_W32_FOR_CONSOLE_IO macro is also available. If
362
+** defined, it forces the use of Win32 APIs for all console I/O, both
363
+** input and output. This is necessary for some non-Microsoft run-times
364
+** that implement stdio differently from Microsoft/Visual-Studio.
360365
*/
361366
#if defined(SQLITE_U8TEXT_ONLY)
362367
# define UseWtextForOutput(fd) 1
363368
# define UseWtextForInput(fd) 1
364369
# define IsConsole(fd) _isatty(_fileno(fd))
@@ -457,14 +462,14 @@
457462
** that into UTF-8. Otherwise, non-ASCII characters all get translated
458463
** into '?'.
459464
*/
460465
wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
461466
if( b1==0 ) return 0;
462
-#ifndef SQLITE_USE_STDIO_FOR_CONSOLE
467
+#ifdef SQLITE_USE_W32_FOR_CONSOLE_IO
463468
DWORD nRead = 0;
464469
if( IsConsole(in)
465
- && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz, &nRead, 0)
470
+ && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz-1, &nRead, 0)
466471
){
467472
b1[nRead] = 0;
468473
}else
469474
#endif
470475
{
@@ -535,22 +540,23 @@
535540
wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) );
536541
if( b1==0 ) return 0;
537542
sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
538543
b1[sz] = 0;
539544
540
-#ifndef SQLITE_STDIO_FOR_CONSOLE
545
+#ifdef SQLITE_USE_W32_FOR_CONSOLE_IO
541546
DWORD nWr = 0;
542547
if( IsConsole(out)
543548
&& WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),b1,sz,&nWr,0)
544549
){
545550
/* If writing to the console, then the WriteConsoleW() is all we
546551
** need to do. */
547552
}else
548553
#endif
549554
{
550
- /* For non-console I/O, or if SQLITE_USE_STDIO_FOR_CONSOLE is defined
551
- ** then write using the standard library. */
555
+ /* As long as SQLITE_USE_W32_FOR_CONSOLE_IO is not defined, or for
556
+ ** non-console I/O even if that macro is defined, write using the
557
+ ** standard library. */
552558
_setmode(_fileno(out), _O_U8TEXT);
553559
if( UseBinaryWText(out) ){
554560
piecemealOutput(b1, sz, out);
555561
}else{
556562
fputws(b1, out);
@@ -5289,31 +5295,34 @@
52895295
u8 bdp = BX_DV_PROTO(c);
52905296
switch( bdp ){
52915297
case ND:
52925298
/* Treat dark non-digits as pad, but they terminate decode too. */
52935299
ncIn = 0;
5294
- deliberate_fall_through;
5300
+ deliberate_fall_through; /* FALLTHRU */
52955301
case WS:
52965302
/* Treat whitespace as pad and terminate this group.*/
52975303
nti = nac;
5298
- deliberate_fall_through;
5304
+ deliberate_fall_through; /* FALLTHRU */
52995305
case PC:
53005306
bdp = 0;
53015307
--nbo;
5302
- deliberate_fall_through;
5308
+ deliberate_fall_through; /* FALLTHRU */
53035309
default: /* bdp is the digit value. */
53045310
qv = qv<<6 | bdp;
53055311
break;
53065312
}
53075313
}
53085314
switch( nbo ){
53095315
case 3:
53105316
pOut[2] = (qv) & 0xff;
5317
+ deliberate_fall_through; /* FALLTHRU */
53115318
case 2:
53125319
pOut[1] = (qv>>8) & 0xff;
5320
+ deliberate_fall_through; /* FALLTHRU */
53135321
case 1:
53145322
pOut[0] = (qv>>16) & 0xff;
5323
+ break;
53155324
}
53165325
pOut += nbo;
53175326
}
53185327
return pOut;
53195328
}
@@ -5644,16 +5653,20 @@
56445653
}
56455654
nbo -= nti; /* Adjust for early (non-digit) end of group. */
56465655
switch( nbo ){
56475656
case 4:
56485657
*pOut++ = (qv >> 24)&0xff;
5658
+ /* FALLTHRU */
56495659
case 3:
56505660
*pOut++ = (qv >> 16)&0xff;
5661
+ /* FALLTHRU */
56515662
case 2:
56525663
*pOut++ = (qv >> 8)&0xff;
5664
+ /* FALLTHRU */
56535665
case 1:
56545666
*pOut++ = qv&0xff;
5667
+ /* FALLTHRU */
56555668
case 0:
56565669
break;
56575670
}
56585671
}
56595672
return pOut;
@@ -7692,11 +7705,12 @@
76927705
76937706
/* Free and reclaim all the memory used by a previously compiled
76947707
** regular expression. Applications should invoke this routine once
76957708
** for every call to re_compile() to avoid memory leaks.
76967709
*/
7697
-static void re_free(ReCompiled *pRe){
7710
+static void re_free(void *p){
7711
+ ReCompiled *pRe = (ReCompiled*)p;
76987712
if( pRe ){
76997713
sqlite3_free(pRe->aOp);
77007714
sqlite3_free(pRe->aArg);
77017715
sqlite3_free(pRe);
77027716
}
@@ -8358,11 +8372,11 @@
83588372
LPWSTR zUnicodeName;
83598373
extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
83608374
83618375
GetSystemTime(&currentTime);
83628376
SystemTimeToFileTime(&currentTime, &lastAccess);
8363
- intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
8377
+ intervals = (mtime*10000000) + 116444736000000000;
83648378
lastWrite.dwLowDateTime = (DWORD)intervals;
83658379
lastWrite.dwHighDateTime = intervals >> 32;
83668380
zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
83678381
if( zUnicodeName==0 ){
83688382
return 1;
@@ -16344,10 +16358,11 @@
1634416358
#define VTR_DLCLOSE 0x00800000
1634516359
#define VTR_RAND 0x01000000
1634616360
#define VTR_SLEEP 0x02000000
1634716361
#define VTR_CURTIME 0x04000000
1634816362
#define VTR_LASTERR 0x08000000
16363
+#define VTR_FETCH 0x10000000 /* Also coverse xUnfetch */
1634916364
1635016365
/*
1635116366
** Method declarations for vfstrace_file.
1635216367
*/
1635316368
static int vfstraceClose(sqlite3_file*);
@@ -16773,10 +16788,11 @@
1677316788
{ "randomness", VTR_RAND },
1677416789
{ "sleep", VTR_SLEEP },
1677516790
{ "currenttime", VTR_CURTIME },
1677616791
{ "currenttimeint64", VTR_CURTIME },
1677716792
{ "getlasterror", VTR_LASTERR },
16793
+ { "fetch", VTR_FETCH },
1677816794
};
1677916795
int onOff = 1;
1678016796
while( zArg[0] ){
1678116797
int jj, n;
1678216798
while( zArg[0]!=0 && zArg[0]!='-' && zArg[0]!='+'
@@ -17000,11 +17016,32 @@
1700017016
pInfo->zVfsName, p->zFName, delFlag);
1700117017
rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
1700217018
vfstrace_print_errcode(pInfo, " -> %s\n", rc);
1700317019
return rc;
1700417020
}
17005
-
17021
+static int vfstraceFetch(sqlite3_file *pFile, i64 iOff, int nAmt, void **pptr){
17022
+ vfstrace_file *p = (vfstrace_file *)pFile;
17023
+ vfstrace_info *pInfo = p->pInfo;
17024
+ int rc;
17025
+ vfstraceOnOff(pInfo, VTR_FETCH);
17026
+ vfstrace_printf(pInfo, "%s.xFetch(%s,iOff=%lld,nAmt=%d,p=%p)",
17027
+ pInfo->zVfsName, p->zFName, iOff, nAmt, *pptr);
17028
+ rc = p->pReal->pMethods->xFetch(p->pReal, iOff, nAmt, pptr);
17029
+ vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17030
+ return rc;
17031
+}
17032
+static int vfstraceUnfetch(sqlite3_file *pFile, i64 iOff, void *ptr){
17033
+ vfstrace_file *p = (vfstrace_file *)pFile;
17034
+ vfstrace_info *pInfo = p->pInfo;
17035
+ int rc;
17036
+ vfstraceOnOff(pInfo, VTR_FETCH);
17037
+ vfstrace_printf(pInfo, "%s.xUnfetch(%s,iOff=%lld,p=%p)",
17038
+ pInfo->zVfsName, p->zFName, iOff, ptr);
17039
+ rc = p->pReal->pMethods->xUnfetch(p->pReal, iOff, ptr);
17040
+ vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17041
+ return rc;
17042
+}
1700617043
1700717044
1700817045
/*
1700917046
** Open an vfstrace file handle.
1701017047
*/
@@ -17047,10 +17084,14 @@
1704717084
pNew->xShmMap = pSub->xShmMap ? vfstraceShmMap : 0;
1704817085
pNew->xShmLock = pSub->xShmLock ? vfstraceShmLock : 0;
1704917086
pNew->xShmBarrier = pSub->xShmBarrier ? vfstraceShmBarrier : 0;
1705017087
pNew->xShmUnmap = pSub->xShmUnmap ? vfstraceShmUnmap : 0;
1705117088
}
17089
+ if( pNew->iVersion>=3 ){
17090
+ pNew->xFetch = pSub->xFetch ? vfstraceFetch : 0;
17091
+ pNew->xUnfetch = pSub->xUnfetch ? vfstraceUnfetch : 0;
17092
+ }
1705217093
pFile->pMethods = pNew;
1705317094
}
1705417095
vfstrace_print_errcode(pInfo, " -> %s", rc);
1705517096
if( pOutFlags ){
1705617097
vfstrace_printf(pInfo, ", outFlags=0x%x\n", *pOutFlags);
@@ -17162,11 +17203,11 @@
1716217203
*/
1716317204
static void vfstraceDlClose(sqlite3_vfs *pVfs, void *pHandle){
1716417205
vfstrace_info *pInfo = (vfstrace_info*)pVfs->pAppData;
1716517206
sqlite3_vfs *pRoot = pInfo->pRootVfs;
1716617207
vfstraceOnOff(pInfo, VTR_DLCLOSE);
17167
- vfstrace_printf(pInfo, "%s.xDlOpen()\n", pInfo->zVfsName);
17208
+ vfstrace_printf(pInfo, "%s.xDlClose()\n", pInfo->zVfsName);
1716817209
pRoot->xDlClose(pRoot, pHandle);
1716917210
}
1717017211
1717117212
/*
1717217213
** Populate the buffer pointed to by zBufOut with nByte bytes of
@@ -27460,11 +27501,11 @@
2746027501
case AR_SWITCH_VERBOSE:
2746127502
pAr->bVerbose = 1;
2746227503
break;
2746327504
case AR_SWITCH_APPEND:
2746427505
pAr->bAppend = 1;
27465
- deliberate_fall_through;
27506
+ deliberate_fall_through; /* FALLTHRU */
2746627507
case AR_SWITCH_FILE:
2746727508
pAr->zFile = zArg;
2746827509
break;
2746927510
case AR_SWITCH_DIRECTORY:
2747027511
pAr->zDir = zArg;
@@ -28848,10 +28889,13 @@
2884828889
if( c=='d' && n>=3 && cli_strncmp(azArg[0], "dbconfig", n)==0 ){
2884928890
static const struct DbConfigChoices {
2885028891
const char *zName;
2885128892
int op;
2885228893
} aDbConfig[] = {
28894
+ { "attach_create", SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE },
28895
+ { "attach_write", SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE },
28896
+ { "comments", SQLITE_DBCONFIG_ENABLE_COMMENTS },
2885328897
{ "defensive", SQLITE_DBCONFIG_DEFENSIVE },
2885428898
{ "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
2885528899
{ "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
2885628900
{ "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY },
2885728901
{ "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
@@ -30202,10 +30246,11 @@
3020230246
}
3020330247
}
3020430248
if( zFile==0 ){
3020530249
zFile = sqlite3_mprintf("stdout");
3020630250
}
30251
+ shell_check_oom(zFile);
3020730252
if( bOnce ){
3020830253
p->outCount = 2;
3020930254
}else{
3021030255
p->outCount = 0;
3021130256
}
@@ -30244,10 +30289,11 @@
3024430289
rc = 1;
3024530290
output_redir(p, stdout);
3024630291
#else
3024730292
FILE *pfPipe = sqlite3_popen(zFile + 1, "w");
3024830293
if( pfPipe==0 ){
30294
+ assert( stderr!=NULL );
3024930295
sqlite3_fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
3025030296
rc = 1;
3025130297
}else{
3025230298
output_redir(p, pfPipe);
3025330299
if( zBom ) sqlite3_fputs(zBom, pfPipe);
@@ -30256,11 +30302,12 @@
3025630302
#endif
3025730303
}else{
3025830304
FILE *pfFile = output_file_open(zFile);
3025930305
if( pfFile==0 ){
3026030306
if( cli_strcmp(zFile,"off")!=0 ){
30261
- sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
30307
+ assert( stderr!=NULL );
30308
+ sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
3026230309
}
3026330310
rc = 1;
3026430311
} else {
3026530312
output_redir(p, pfFile);
3026630313
if( zBom ) sqlite3_fputs(zBom, pfFile);
@@ -30360,10 +30407,11 @@
3036030407
sqlite3_finalize(pStmt);
3036130408
pStmt = 0;
3036230409
rc = 1;
3036330410
}
3036430411
}
30412
+ bind_prepared_stmt(p, pStmt);
3036530413
sqlite3_step(pStmt);
3036630414
sqlite3_finalize(pStmt);
3036730415
}else
3036830416
3036930417
/* .parameter unset NAME
@@ -31594,10 +31642,11 @@
3159431642
{ 0x01000000, 1, "IndexedEXpr" },
3159531643
{ 0x02000000, 1, "Coroutines" },
3159631644
{ 0x04000000, 1, "NullUnusedCols" },
3159731645
{ 0x08000000, 1, "OnePass" },
3159831646
{ 0x10000000, 1, "OrderBySubq" },
31647
+ { 0x20000000, 1, "StarQuery" },
3159931648
{ 0xffffffff, 0, "All" },
3160031649
};
3160131650
unsigned int curOpt;
3160231651
unsigned int newOpt;
3160331652
unsigned int m;
@@ -32148,11 +32197,11 @@
3214832197
goto TermScan;
3214932198
}
3215032199
break;
3215132200
case '[':
3215232201
cin = ']';
32153
- deliberate_fall_through;
32202
+ deliberate_fall_through; /* FALLTHRU */
3215432203
case '`': case '\'': case '"':
3215532204
cWait = cin;
3215632205
qss = QSS_HasDark | cWait;
3215732206
CONTINUE_PROMPT_AWAITC(pst, cin);
3215832207
goto TermScan;
@@ -32183,11 +32232,11 @@
3218332232
if(*zLine==cWait){
3218432233
/* Swallow doubled end-delimiter.*/
3218532234
++zLine;
3218632235
continue;
3218732236
}
32188
- deliberate_fall_through;
32237
+ deliberate_fall_through; /* FALLTHRU */
3218932238
case ']':
3219032239
CONTINUE_PROMPT_AWAITC(pst, 0);
3219132240
qss = QSS_SETV(qss, 0);
3219232241
goto PlainScan;
3219332242
default: assert(0);
3219432243
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -355,10 +355,15 @@
355 **
356 ** The default behavior, if neither of the above is defined is to
357 ** use O_U8TEXT when writing to the Windows console (or anything
358 ** else for which _isatty() returns true) and to use O_BINARY or O_TEXT
359 ** for all other output channels.
 
 
 
 
 
360 */
361 #if defined(SQLITE_U8TEXT_ONLY)
362 # define UseWtextForOutput(fd) 1
363 # define UseWtextForInput(fd) 1
364 # define IsConsole(fd) _isatty(_fileno(fd))
@@ -457,14 +462,14 @@
457 ** that into UTF-8. Otherwise, non-ASCII characters all get translated
458 ** into '?'.
459 */
460 wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
461 if( b1==0 ) return 0;
462 #ifndef SQLITE_USE_STDIO_FOR_CONSOLE
463 DWORD nRead = 0;
464 if( IsConsole(in)
465 && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz, &nRead, 0)
466 ){
467 b1[nRead] = 0;
468 }else
469 #endif
470 {
@@ -535,22 +540,23 @@
535 wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) );
536 if( b1==0 ) return 0;
537 sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
538 b1[sz] = 0;
539
540 #ifndef SQLITE_STDIO_FOR_CONSOLE
541 DWORD nWr = 0;
542 if( IsConsole(out)
543 && WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),b1,sz,&nWr,0)
544 ){
545 /* If writing to the console, then the WriteConsoleW() is all we
546 ** need to do. */
547 }else
548 #endif
549 {
550 /* For non-console I/O, or if SQLITE_USE_STDIO_FOR_CONSOLE is defined
551 ** then write using the standard library. */
 
552 _setmode(_fileno(out), _O_U8TEXT);
553 if( UseBinaryWText(out) ){
554 piecemealOutput(b1, sz, out);
555 }else{
556 fputws(b1, out);
@@ -5289,31 +5295,34 @@
5289 u8 bdp = BX_DV_PROTO(c);
5290 switch( bdp ){
5291 case ND:
5292 /* Treat dark non-digits as pad, but they terminate decode too. */
5293 ncIn = 0;
5294 deliberate_fall_through;
5295 case WS:
5296 /* Treat whitespace as pad and terminate this group.*/
5297 nti = nac;
5298 deliberate_fall_through;
5299 case PC:
5300 bdp = 0;
5301 --nbo;
5302 deliberate_fall_through;
5303 default: /* bdp is the digit value. */
5304 qv = qv<<6 | bdp;
5305 break;
5306 }
5307 }
5308 switch( nbo ){
5309 case 3:
5310 pOut[2] = (qv) & 0xff;
 
5311 case 2:
5312 pOut[1] = (qv>>8) & 0xff;
 
5313 case 1:
5314 pOut[0] = (qv>>16) & 0xff;
 
5315 }
5316 pOut += nbo;
5317 }
5318 return pOut;
5319 }
@@ -5644,16 +5653,20 @@
5644 }
5645 nbo -= nti; /* Adjust for early (non-digit) end of group. */
5646 switch( nbo ){
5647 case 4:
5648 *pOut++ = (qv >> 24)&0xff;
 
5649 case 3:
5650 *pOut++ = (qv >> 16)&0xff;
 
5651 case 2:
5652 *pOut++ = (qv >> 8)&0xff;
 
5653 case 1:
5654 *pOut++ = qv&0xff;
 
5655 case 0:
5656 break;
5657 }
5658 }
5659 return pOut;
@@ -7692,11 +7705,12 @@
7692
7693 /* Free and reclaim all the memory used by a previously compiled
7694 ** regular expression. Applications should invoke this routine once
7695 ** for every call to re_compile() to avoid memory leaks.
7696 */
7697 static void re_free(ReCompiled *pRe){
 
7698 if( pRe ){
7699 sqlite3_free(pRe->aOp);
7700 sqlite3_free(pRe->aArg);
7701 sqlite3_free(pRe);
7702 }
@@ -8358,11 +8372,11 @@
8358 LPWSTR zUnicodeName;
8359 extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
8360
8361 GetSystemTime(&currentTime);
8362 SystemTimeToFileTime(&currentTime, &lastAccess);
8363 intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
8364 lastWrite.dwLowDateTime = (DWORD)intervals;
8365 lastWrite.dwHighDateTime = intervals >> 32;
8366 zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
8367 if( zUnicodeName==0 ){
8368 return 1;
@@ -16344,10 +16358,11 @@
16344 #define VTR_DLCLOSE 0x00800000
16345 #define VTR_RAND 0x01000000
16346 #define VTR_SLEEP 0x02000000
16347 #define VTR_CURTIME 0x04000000
16348 #define VTR_LASTERR 0x08000000
 
16349
16350 /*
16351 ** Method declarations for vfstrace_file.
16352 */
16353 static int vfstraceClose(sqlite3_file*);
@@ -16773,10 +16788,11 @@
16773 { "randomness", VTR_RAND },
16774 { "sleep", VTR_SLEEP },
16775 { "currenttime", VTR_CURTIME },
16776 { "currenttimeint64", VTR_CURTIME },
16777 { "getlasterror", VTR_LASTERR },
 
16778 };
16779 int onOff = 1;
16780 while( zArg[0] ){
16781 int jj, n;
16782 while( zArg[0]!=0 && zArg[0]!='-' && zArg[0]!='+'
@@ -17000,11 +17016,32 @@
17000 pInfo->zVfsName, p->zFName, delFlag);
17001 rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
17002 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17003 return rc;
17004 }
17005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17006
17007
17008 /*
17009 ** Open an vfstrace file handle.
17010 */
@@ -17047,10 +17084,14 @@
17047 pNew->xShmMap = pSub->xShmMap ? vfstraceShmMap : 0;
17048 pNew->xShmLock = pSub->xShmLock ? vfstraceShmLock : 0;
17049 pNew->xShmBarrier = pSub->xShmBarrier ? vfstraceShmBarrier : 0;
17050 pNew->xShmUnmap = pSub->xShmUnmap ? vfstraceShmUnmap : 0;
17051 }
 
 
 
 
17052 pFile->pMethods = pNew;
17053 }
17054 vfstrace_print_errcode(pInfo, " -> %s", rc);
17055 if( pOutFlags ){
17056 vfstrace_printf(pInfo, ", outFlags=0x%x\n", *pOutFlags);
@@ -17162,11 +17203,11 @@
17162 */
17163 static void vfstraceDlClose(sqlite3_vfs *pVfs, void *pHandle){
17164 vfstrace_info *pInfo = (vfstrace_info*)pVfs->pAppData;
17165 sqlite3_vfs *pRoot = pInfo->pRootVfs;
17166 vfstraceOnOff(pInfo, VTR_DLCLOSE);
17167 vfstrace_printf(pInfo, "%s.xDlOpen()\n", pInfo->zVfsName);
17168 pRoot->xDlClose(pRoot, pHandle);
17169 }
17170
17171 /*
17172 ** Populate the buffer pointed to by zBufOut with nByte bytes of
@@ -27460,11 +27501,11 @@
27460 case AR_SWITCH_VERBOSE:
27461 pAr->bVerbose = 1;
27462 break;
27463 case AR_SWITCH_APPEND:
27464 pAr->bAppend = 1;
27465 deliberate_fall_through;
27466 case AR_SWITCH_FILE:
27467 pAr->zFile = zArg;
27468 break;
27469 case AR_SWITCH_DIRECTORY:
27470 pAr->zDir = zArg;
@@ -28848,10 +28889,13 @@
28848 if( c=='d' && n>=3 && cli_strncmp(azArg[0], "dbconfig", n)==0 ){
28849 static const struct DbConfigChoices {
28850 const char *zName;
28851 int op;
28852 } aDbConfig[] = {
 
 
 
28853 { "defensive", SQLITE_DBCONFIG_DEFENSIVE },
28854 { "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
28855 { "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
28856 { "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY },
28857 { "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
@@ -30202,10 +30246,11 @@
30202 }
30203 }
30204 if( zFile==0 ){
30205 zFile = sqlite3_mprintf("stdout");
30206 }
 
30207 if( bOnce ){
30208 p->outCount = 2;
30209 }else{
30210 p->outCount = 0;
30211 }
@@ -30244,10 +30289,11 @@
30244 rc = 1;
30245 output_redir(p, stdout);
30246 #else
30247 FILE *pfPipe = sqlite3_popen(zFile + 1, "w");
30248 if( pfPipe==0 ){
 
30249 sqlite3_fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
30250 rc = 1;
30251 }else{
30252 output_redir(p, pfPipe);
30253 if( zBom ) sqlite3_fputs(zBom, pfPipe);
@@ -30256,11 +30302,12 @@
30256 #endif
30257 }else{
30258 FILE *pfFile = output_file_open(zFile);
30259 if( pfFile==0 ){
30260 if( cli_strcmp(zFile,"off")!=0 ){
30261 sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
 
30262 }
30263 rc = 1;
30264 } else {
30265 output_redir(p, pfFile);
30266 if( zBom ) sqlite3_fputs(zBom, pfFile);
@@ -30360,10 +30407,11 @@
30360 sqlite3_finalize(pStmt);
30361 pStmt = 0;
30362 rc = 1;
30363 }
30364 }
 
30365 sqlite3_step(pStmt);
30366 sqlite3_finalize(pStmt);
30367 }else
30368
30369 /* .parameter unset NAME
@@ -31594,10 +31642,11 @@
31594 { 0x01000000, 1, "IndexedEXpr" },
31595 { 0x02000000, 1, "Coroutines" },
31596 { 0x04000000, 1, "NullUnusedCols" },
31597 { 0x08000000, 1, "OnePass" },
31598 { 0x10000000, 1, "OrderBySubq" },
 
31599 { 0xffffffff, 0, "All" },
31600 };
31601 unsigned int curOpt;
31602 unsigned int newOpt;
31603 unsigned int m;
@@ -32148,11 +32197,11 @@
32148 goto TermScan;
32149 }
32150 break;
32151 case '[':
32152 cin = ']';
32153 deliberate_fall_through;
32154 case '`': case '\'': case '"':
32155 cWait = cin;
32156 qss = QSS_HasDark | cWait;
32157 CONTINUE_PROMPT_AWAITC(pst, cin);
32158 goto TermScan;
@@ -32183,11 +32232,11 @@
32183 if(*zLine==cWait){
32184 /* Swallow doubled end-delimiter.*/
32185 ++zLine;
32186 continue;
32187 }
32188 deliberate_fall_through;
32189 case ']':
32190 CONTINUE_PROMPT_AWAITC(pst, 0);
32191 qss = QSS_SETV(qss, 0);
32192 goto PlainScan;
32193 default: assert(0);
32194
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -355,10 +355,15 @@
355 **
356 ** The default behavior, if neither of the above is defined is to
357 ** use O_U8TEXT when writing to the Windows console (or anything
358 ** else for which _isatty() returns true) and to use O_BINARY or O_TEXT
359 ** for all other output channels.
360 **
361 ** The SQLITE_USE_W32_FOR_CONSOLE_IO macro is also available. If
362 ** defined, it forces the use of Win32 APIs for all console I/O, both
363 ** input and output. This is necessary for some non-Microsoft run-times
364 ** that implement stdio differently from Microsoft/Visual-Studio.
365 */
366 #if defined(SQLITE_U8TEXT_ONLY)
367 # define UseWtextForOutput(fd) 1
368 # define UseWtextForInput(fd) 1
369 # define IsConsole(fd) _isatty(_fileno(fd))
@@ -457,14 +462,14 @@
462 ** that into UTF-8. Otherwise, non-ASCII characters all get translated
463 ** into '?'.
464 */
465 wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
466 if( b1==0 ) return 0;
467 #ifdef SQLITE_USE_W32_FOR_CONSOLE_IO
468 DWORD nRead = 0;
469 if( IsConsole(in)
470 && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz-1, &nRead, 0)
471 ){
472 b1[nRead] = 0;
473 }else
474 #endif
475 {
@@ -535,22 +540,23 @@
540 wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) );
541 if( b1==0 ) return 0;
542 sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
543 b1[sz] = 0;
544
545 #ifdef SQLITE_USE_W32_FOR_CONSOLE_IO
546 DWORD nWr = 0;
547 if( IsConsole(out)
548 && WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),b1,sz,&nWr,0)
549 ){
550 /* If writing to the console, then the WriteConsoleW() is all we
551 ** need to do. */
552 }else
553 #endif
554 {
555 /* As long as SQLITE_USE_W32_FOR_CONSOLE_IO is not defined, or for
556 ** non-console I/O even if that macro is defined, write using the
557 ** standard library. */
558 _setmode(_fileno(out), _O_U8TEXT);
559 if( UseBinaryWText(out) ){
560 piecemealOutput(b1, sz, out);
561 }else{
562 fputws(b1, out);
@@ -5289,31 +5295,34 @@
5295 u8 bdp = BX_DV_PROTO(c);
5296 switch( bdp ){
5297 case ND:
5298 /* Treat dark non-digits as pad, but they terminate decode too. */
5299 ncIn = 0;
5300 deliberate_fall_through; /* FALLTHRU */
5301 case WS:
5302 /* Treat whitespace as pad and terminate this group.*/
5303 nti = nac;
5304 deliberate_fall_through; /* FALLTHRU */
5305 case PC:
5306 bdp = 0;
5307 --nbo;
5308 deliberate_fall_through; /* FALLTHRU */
5309 default: /* bdp is the digit value. */
5310 qv = qv<<6 | bdp;
5311 break;
5312 }
5313 }
5314 switch( nbo ){
5315 case 3:
5316 pOut[2] = (qv) & 0xff;
5317 deliberate_fall_through; /* FALLTHRU */
5318 case 2:
5319 pOut[1] = (qv>>8) & 0xff;
5320 deliberate_fall_through; /* FALLTHRU */
5321 case 1:
5322 pOut[0] = (qv>>16) & 0xff;
5323 break;
5324 }
5325 pOut += nbo;
5326 }
5327 return pOut;
5328 }
@@ -5644,16 +5653,20 @@
5653 }
5654 nbo -= nti; /* Adjust for early (non-digit) end of group. */
5655 switch( nbo ){
5656 case 4:
5657 *pOut++ = (qv >> 24)&0xff;
5658 /* FALLTHRU */
5659 case 3:
5660 *pOut++ = (qv >> 16)&0xff;
5661 /* FALLTHRU */
5662 case 2:
5663 *pOut++ = (qv >> 8)&0xff;
5664 /* FALLTHRU */
5665 case 1:
5666 *pOut++ = qv&0xff;
5667 /* FALLTHRU */
5668 case 0:
5669 break;
5670 }
5671 }
5672 return pOut;
@@ -7692,11 +7705,12 @@
7705
7706 /* Free and reclaim all the memory used by a previously compiled
7707 ** regular expression. Applications should invoke this routine once
7708 ** for every call to re_compile() to avoid memory leaks.
7709 */
7710 static void re_free(void *p){
7711 ReCompiled *pRe = (ReCompiled*)p;
7712 if( pRe ){
7713 sqlite3_free(pRe->aOp);
7714 sqlite3_free(pRe->aArg);
7715 sqlite3_free(pRe);
7716 }
@@ -8358,11 +8372,11 @@
8372 LPWSTR zUnicodeName;
8373 extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
8374
8375 GetSystemTime(&currentTime);
8376 SystemTimeToFileTime(&currentTime, &lastAccess);
8377 intervals = (mtime*10000000) + 116444736000000000;
8378 lastWrite.dwLowDateTime = (DWORD)intervals;
8379 lastWrite.dwHighDateTime = intervals >> 32;
8380 zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
8381 if( zUnicodeName==0 ){
8382 return 1;
@@ -16344,10 +16358,11 @@
16358 #define VTR_DLCLOSE 0x00800000
16359 #define VTR_RAND 0x01000000
16360 #define VTR_SLEEP 0x02000000
16361 #define VTR_CURTIME 0x04000000
16362 #define VTR_LASTERR 0x08000000
16363 #define VTR_FETCH 0x10000000 /* Also coverse xUnfetch */
16364
16365 /*
16366 ** Method declarations for vfstrace_file.
16367 */
16368 static int vfstraceClose(sqlite3_file*);
@@ -16773,10 +16788,11 @@
16788 { "randomness", VTR_RAND },
16789 { "sleep", VTR_SLEEP },
16790 { "currenttime", VTR_CURTIME },
16791 { "currenttimeint64", VTR_CURTIME },
16792 { "getlasterror", VTR_LASTERR },
16793 { "fetch", VTR_FETCH },
16794 };
16795 int onOff = 1;
16796 while( zArg[0] ){
16797 int jj, n;
16798 while( zArg[0]!=0 && zArg[0]!='-' && zArg[0]!='+'
@@ -17000,11 +17016,32 @@
17016 pInfo->zVfsName, p->zFName, delFlag);
17017 rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
17018 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17019 return rc;
17020 }
17021 static int vfstraceFetch(sqlite3_file *pFile, i64 iOff, int nAmt, void **pptr){
17022 vfstrace_file *p = (vfstrace_file *)pFile;
17023 vfstrace_info *pInfo = p->pInfo;
17024 int rc;
17025 vfstraceOnOff(pInfo, VTR_FETCH);
17026 vfstrace_printf(pInfo, "%s.xFetch(%s,iOff=%lld,nAmt=%d,p=%p)",
17027 pInfo->zVfsName, p->zFName, iOff, nAmt, *pptr);
17028 rc = p->pReal->pMethods->xFetch(p->pReal, iOff, nAmt, pptr);
17029 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17030 return rc;
17031 }
17032 static int vfstraceUnfetch(sqlite3_file *pFile, i64 iOff, void *ptr){
17033 vfstrace_file *p = (vfstrace_file *)pFile;
17034 vfstrace_info *pInfo = p->pInfo;
17035 int rc;
17036 vfstraceOnOff(pInfo, VTR_FETCH);
17037 vfstrace_printf(pInfo, "%s.xUnfetch(%s,iOff=%lld,p=%p)",
17038 pInfo->zVfsName, p->zFName, iOff, ptr);
17039 rc = p->pReal->pMethods->xUnfetch(p->pReal, iOff, ptr);
17040 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17041 return rc;
17042 }
17043
17044
17045 /*
17046 ** Open an vfstrace file handle.
17047 */
@@ -17047,10 +17084,14 @@
17084 pNew->xShmMap = pSub->xShmMap ? vfstraceShmMap : 0;
17085 pNew->xShmLock = pSub->xShmLock ? vfstraceShmLock : 0;
17086 pNew->xShmBarrier = pSub->xShmBarrier ? vfstraceShmBarrier : 0;
17087 pNew->xShmUnmap = pSub->xShmUnmap ? vfstraceShmUnmap : 0;
17088 }
17089 if( pNew->iVersion>=3 ){
17090 pNew->xFetch = pSub->xFetch ? vfstraceFetch : 0;
17091 pNew->xUnfetch = pSub->xUnfetch ? vfstraceUnfetch : 0;
17092 }
17093 pFile->pMethods = pNew;
17094 }
17095 vfstrace_print_errcode(pInfo, " -> %s", rc);
17096 if( pOutFlags ){
17097 vfstrace_printf(pInfo, ", outFlags=0x%x\n", *pOutFlags);
@@ -17162,11 +17203,11 @@
17203 */
17204 static void vfstraceDlClose(sqlite3_vfs *pVfs, void *pHandle){
17205 vfstrace_info *pInfo = (vfstrace_info*)pVfs->pAppData;
17206 sqlite3_vfs *pRoot = pInfo->pRootVfs;
17207 vfstraceOnOff(pInfo, VTR_DLCLOSE);
17208 vfstrace_printf(pInfo, "%s.xDlClose()\n", pInfo->zVfsName);
17209 pRoot->xDlClose(pRoot, pHandle);
17210 }
17211
17212 /*
17213 ** Populate the buffer pointed to by zBufOut with nByte bytes of
@@ -27460,11 +27501,11 @@
27501 case AR_SWITCH_VERBOSE:
27502 pAr->bVerbose = 1;
27503 break;
27504 case AR_SWITCH_APPEND:
27505 pAr->bAppend = 1;
27506 deliberate_fall_through; /* FALLTHRU */
27507 case AR_SWITCH_FILE:
27508 pAr->zFile = zArg;
27509 break;
27510 case AR_SWITCH_DIRECTORY:
27511 pAr->zDir = zArg;
@@ -28848,10 +28889,13 @@
28889 if( c=='d' && n>=3 && cli_strncmp(azArg[0], "dbconfig", n)==0 ){
28890 static const struct DbConfigChoices {
28891 const char *zName;
28892 int op;
28893 } aDbConfig[] = {
28894 { "attach_create", SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE },
28895 { "attach_write", SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE },
28896 { "comments", SQLITE_DBCONFIG_ENABLE_COMMENTS },
28897 { "defensive", SQLITE_DBCONFIG_DEFENSIVE },
28898 { "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
28899 { "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
28900 { "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY },
28901 { "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
@@ -30202,10 +30246,11 @@
30246 }
30247 }
30248 if( zFile==0 ){
30249 zFile = sqlite3_mprintf("stdout");
30250 }
30251 shell_check_oom(zFile);
30252 if( bOnce ){
30253 p->outCount = 2;
30254 }else{
30255 p->outCount = 0;
30256 }
@@ -30244,10 +30289,11 @@
30289 rc = 1;
30290 output_redir(p, stdout);
30291 #else
30292 FILE *pfPipe = sqlite3_popen(zFile + 1, "w");
30293 if( pfPipe==0 ){
30294 assert( stderr!=NULL );
30295 sqlite3_fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
30296 rc = 1;
30297 }else{
30298 output_redir(p, pfPipe);
30299 if( zBom ) sqlite3_fputs(zBom, pfPipe);
@@ -30256,11 +30302,12 @@
30302 #endif
30303 }else{
30304 FILE *pfFile = output_file_open(zFile);
30305 if( pfFile==0 ){
30306 if( cli_strcmp(zFile,"off")!=0 ){
30307 assert( stderr!=NULL );
30308 sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
30309 }
30310 rc = 1;
30311 } else {
30312 output_redir(p, pfFile);
30313 if( zBom ) sqlite3_fputs(zBom, pfFile);
@@ -30360,10 +30407,11 @@
30407 sqlite3_finalize(pStmt);
30408 pStmt = 0;
30409 rc = 1;
30410 }
30411 }
30412 bind_prepared_stmt(p, pStmt);
30413 sqlite3_step(pStmt);
30414 sqlite3_finalize(pStmt);
30415 }else
30416
30417 /* .parameter unset NAME
@@ -31594,10 +31642,11 @@
31642 { 0x01000000, 1, "IndexedEXpr" },
31643 { 0x02000000, 1, "Coroutines" },
31644 { 0x04000000, 1, "NullUnusedCols" },
31645 { 0x08000000, 1, "OnePass" },
31646 { 0x10000000, 1, "OrderBySubq" },
31647 { 0x20000000, 1, "StarQuery" },
31648 { 0xffffffff, 0, "All" },
31649 };
31650 unsigned int curOpt;
31651 unsigned int newOpt;
31652 unsigned int m;
@@ -32148,11 +32197,11 @@
32197 goto TermScan;
32198 }
32199 break;
32200 case '[':
32201 cin = ']';
32202 deliberate_fall_through; /* FALLTHRU */
32203 case '`': case '\'': case '"':
32204 cWait = cin;
32205 qss = QSS_HasDark | cWait;
32206 CONTINUE_PROMPT_AWAITC(pst, cin);
32207 goto TermScan;
@@ -32183,11 +32232,11 @@
32232 if(*zLine==cWait){
32233 /* Swallow doubled end-delimiter.*/
32234 ++zLine;
32235 continue;
32236 }
32237 deliberate_fall_through; /* FALLTHRU */
32238 case ']':
32239 CONTINUE_PROMPT_AWAITC(pst, 0);
32240 qss = QSS_SETV(qss, 0);
32241 goto PlainScan;
32242 default: assert(0);
32243
+3000 -2454
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.48.0. By combining all the individual C code files into this
3
+** version 3.50.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -16,11 +16,11 @@
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21
-** e2bae4143afd07de1ae55a6d2606a3b541a5 with changes in files:
21
+** 57caa3136d1bfca06e4f2285734a4977b8d3 with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -463,13 +463,13 @@
463463
**
464464
** See also: [sqlite3_libversion()],
465465
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466466
** [sqlite_version()] and [sqlite_source_id()].
467467
*/
468
-#define SQLITE_VERSION "3.48.0"
469
-#define SQLITE_VERSION_NUMBER 3048000
470
-#define SQLITE_SOURCE_ID "2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653"
468
+#define SQLITE_VERSION "3.50.0"
469
+#define SQLITE_VERSION_NUMBER 3050000
470
+#define SQLITE_SOURCE_ID "2025-02-18 01:16:26 57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc"
471471
472472
/*
473473
** CAPI3REF: Run-Time Library Version Numbers
474474
** KEYWORDS: sqlite3_version sqlite3_sourceid
475475
**
@@ -2306,17 +2306,20 @@
23062306
** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
23072307
** return [SQLITE_ERROR].</dd>
23082308
**
23092309
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
23102310
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
2311
-** the default size of lookaside memory on each [database connection].
2311
+** the default size of [lookaside memory] on each [database connection].
23122312
** The first argument is the
2313
-** size of each lookaside buffer slot and the second is the number of
2314
-** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
2315
-** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
2316
-** option to [sqlite3_db_config()] can be used to change the lookaside
2317
-** configuration on individual connections.)^ </dd>
2313
+** size of each lookaside buffer slot ("sz") and the second is the number of
2314
+** slots allocated to each database connection ("cnt").)^
2315
+** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
2316
+** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
2317
+** be used to change the lookaside configuration on individual connections.)^
2318
+** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the
2319
+** default lookaside configuration at compile-time.
2320
+** </dd>
23182321
**
23192322
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
23202323
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
23212324
** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
23222325
** the interface to a custom page cache implementation.)^
@@ -2528,11 +2531,19 @@
25282531
25292532
/*
25302533
** CAPI3REF: Database Connection Configuration Options
25312534
**
25322535
** These constants are the available integer configuration options that
2533
-** can be passed as the second argument to the [sqlite3_db_config()] interface.
2536
+** can be passed as the second parameter to the [sqlite3_db_config()] interface.
2537
+**
2538
+** The [sqlite3_db_config()] interface is a var-args functions. It takes a
2539
+** variable number of parameters, though always at least two. The number of
2540
+** parameters passed into sqlite3_db_config() depends on which of these
2541
+** constants is given as the second parameter. This documentation page
2542
+** refers to parameters beyond the second as "arguments". Thus, when this
2543
+** page says "the N-th argument" it means "the N-th parameter past the
2544
+** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
25342545
**
25352546
** New configuration options may be added in future releases of SQLite.
25362547
** Existing configuration options might be discontinued. Applications
25372548
** should check the return code from [sqlite3_db_config()] to make sure that
25382549
** the call worked. ^The [sqlite3_db_config()] interface will return a
@@ -2540,35 +2551,61 @@
25402551
** is invoked.
25412552
**
25422553
** <dl>
25432554
** [[SQLITE_DBCONFIG_LOOKASIDE]]
25442555
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
2545
-** <dd> ^This option takes three additional arguments that determine the
2546
-** [lookaside memory allocator] configuration for the [database connection].
2547
-** ^The first argument (the third parameter to [sqlite3_db_config()] is a
2556
+** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
2557
+** configuration of the [lookaside memory allocator] within a database
2558
+** connection.
2559
+** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
2560
+** in the [DBCONFIG arguments|usual format].
2561
+** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
2562
+** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
2563
+** should have a total of five parameters.
2564
+** <ol>
2565
+** <li><p>The first argument ("buf") is a
25482566
** pointer to a memory buffer to use for lookaside memory.
2549
-** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
2550
-** may be NULL in which case SQLite will allocate the
2551
-** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
2552
-** size of each lookaside buffer slot. ^The third argument is the number of
2553
-** slots. The size of the buffer in the first argument must be greater than
2554
-** or equal to the product of the second and third arguments. The buffer
2555
-** must be aligned to an 8-byte boundary. ^If the second argument to
2556
-** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
2557
-** rounded down to the next smaller multiple of 8. ^(The lookaside memory
2567
+** The first argument may be NULL in which case SQLite will allocate the
2568
+** lookaside buffer itself using [sqlite3_malloc()].
2569
+** <li><P>The second argument ("sz") is the
2570
+** size of each lookaside buffer slot. Lookaside is disabled if "sz"
2571
+** is less than 8. The "sz" argument should be a multiple of 8 less than
2572
+** 65536. If "sz" does not meet this constraint, it is reduced in size until
2573
+** it does.
2574
+** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled
2575
+** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so
2576
+** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
2577
+** parameter is usually chosen so that the product of "sz" and "cnt" is less
2578
+** than 1,000,000.
2579
+** </ol>
2580
+** <p>If the "buf" argument is not NULL, then it must
2581
+** point to a memory buffer with a size that is greater than
2582
+** or equal to the product of "sz" and "cnt".
2583
+** The buffer must be aligned to an 8-byte boundary.
2584
+** The lookaside memory
25582585
** configuration for a database connection can only be changed when that
25592586
** connection is not currently using lookaside memory, or in other words
2560
-** when the "current value" returned by
2561
-** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
2587
+** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
25622588
** Any attempt to change the lookaside memory configuration when lookaside
25632589
** memory is in use leaves the configuration unchanged and returns
2564
-** [SQLITE_BUSY].)^</dd>
2590
+** [SQLITE_BUSY].
2591
+** If the "buf" argument is NULL and an attempt
2592
+** to allocate memory based on "sz" and "cnt" fails, then
2593
+** lookaside is silently disabled.
2594
+** <p>
2595
+** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the
2596
+** default lookaside configuration at initialization. The
2597
+** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside
2598
+** configuration at compile-time. Typical values for lookaside are 1200 for
2599
+** "sz" and 40 to 100 for "cnt".
2600
+** </dd>
25652601
**
25662602
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
25672603
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
25682604
** <dd> ^This option is used to enable or disable the enforcement of
2569
-** [foreign key constraints]. There should be two additional arguments.
2605
+** [foreign key constraints]. This is the same setting that is
2606
+** enabled or disabled by the [PRAGMA foreign_keys] statement.
25702607
** The first argument is an integer which is 0 to disable FK enforcement,
25712608
** positive to enable FK enforcement or negative to leave FK enforcement
25722609
** unchanged. The second parameter is a pointer to an integer into which
25732610
** is written 0 or 1 to indicate whether FK enforcement is off or on
25742611
** following this call. The second parameter may be a NULL pointer, in
@@ -2586,17 +2623,17 @@
25862623
** which case the trigger setting is not reported back.
25872624
**
25882625
** <p>Originally this option disabled all triggers. ^(However, since
25892626
** SQLite version 3.35.0, TEMP triggers are still allowed even if
25902627
** this option is off. So, in other words, this option now only disables
2591
-** triggers in the main database schema or in the schemas of ATTACH-ed
2628
+** triggers in the main database schema or in the schemas of [ATTACH]-ed
25922629
** databases.)^ </dd>
25932630
**
25942631
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
25952632
** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
25962633
** <dd> ^This option is used to enable or disable [CREATE VIEW | views].
2597
-** There should be two additional arguments.
2634
+** There must be two additional arguments.
25982635
** The first argument is an integer which is 0 to disable views,
25992636
** positive to enable views or negative to leave the setting unchanged.
26002637
** The second parameter is a pointer to an integer into which
26012638
** is written 0 or 1 to indicate whether views are disabled or enabled
26022639
** following this call. The second parameter may be a NULL pointer, in
@@ -2611,11 +2648,11 @@
26112648
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
26122649
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
26132650
** <dd> ^This option is used to enable or disable the
26142651
** [fts3_tokenizer()] function which is part of the
26152652
** [FTS3] full-text search engine extension.
2616
-** There should be two additional arguments.
2653
+** There must be two additional arguments.
26172654
** The first argument is an integer which is 0 to disable fts3_tokenizer() or
26182655
** positive to enable fts3_tokenizer() or negative to leave the setting
26192656
** unchanged.
26202657
** The second parameter is a pointer to an integer into which
26212658
** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
@@ -2626,11 +2663,11 @@
26262663
** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
26272664
** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()]
26282665
** interface independently of the [load_extension()] SQL function.
26292666
** The [sqlite3_enable_load_extension()] API enables or disables both the
26302667
** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
2631
-** There should be two additional arguments.
2668
+** There must be two additional arguments.
26322669
** When the first argument to this interface is 1, then only the C-API is
26332670
** enabled and the SQL function remains disabled. If the first argument to
26342671
** this interface is 0, then both the C-API and the SQL function are disabled.
26352672
** If the first argument is -1, then no changes are made to state of either the
26362673
** C-API or the SQL function.
@@ -2640,27 +2677,34 @@
26402677
** be a NULL pointer, in which case the new setting is not reported back.
26412678
** </dd>
26422679
**
26432680
** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
26442681
** <dd> ^This option is used to change the name of the "main" database
2645
-** schema. ^The sole argument is a pointer to a constant UTF8 string
2646
-** which will become the new schema name in place of "main". ^SQLite
2647
-** does not make a copy of the new main schema name string, so the application
2648
-** must ensure that the argument passed into this DBCONFIG option is unchanged
2649
-** until after the database connection closes.
2682
+** schema. This option does not follow the
2683
+** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
2684
+** This option takes exactly one additional argument so that the
2685
+** [sqlite3_db_config()] call has a total of three parameters. The
2686
+** extra argument must be a pointer to a constant UTF8 string which
2687
+** will become the new schema name in place of "main". ^SQLite does
2688
+** not make a copy of the new main schema name string, so the application
2689
+** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
2690
+** is unchanged until after the database connection closes.
26502691
** </dd>
26512692
**
26522693
** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
26532694
** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
2654
-** <dd> Usually, when a database in wal mode is closed or detached from a
2655
-** database handle, SQLite checks if this will mean that there are now no
2656
-** connections at all to the database. If so, it performs a checkpoint
2657
-** operation before closing the connection. This option may be used to
2658
-** override this behavior. The first parameter passed to this operation
2659
-** is an integer - positive to disable checkpoints-on-close, or zero (the
2660
-** default) to enable them, and negative to leave the setting unchanged.
2661
-** The second parameter is a pointer to an integer
2695
+** <dd> Usually, when a database in [WAL mode] is closed or detached from a
2696
+** database handle, SQLite checks if if there are other connections to the
2697
+** same database, and if there are no other database connection (if the
2698
+** connection being closed is the last open connection to the database),
2699
+** then SQLite performs a [checkpoint] before closing the connection and
2700
+** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
2701
+** be used to override that behavior. The first argument passed to this
2702
+** operation (the third parameter to [sqlite3_db_config()]) is an integer
2703
+** which is positive to disable checkpoints-on-close, or zero (the default)
2704
+** to enable them, and negative to leave the setting unchanged.
2705
+** The second argument (the fourth parameter) is a pointer to an integer
26622706
** into which is written 0 or 1 to indicate whether checkpoints-on-close
26632707
** have been disabled - 0 if they are not disabled, 1 if they are.
26642708
** </dd>
26652709
**
26662710
** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
@@ -2817,11 +2861,11 @@
28172861
** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
28182862
** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
28192863
** statistics. For statistics to be collected, the flag must be set on
28202864
** the database handle both when the SQL statement is prepared and when it
28212865
** is stepped. The flag is set (collection of statistics is enabled)
2822
-** by default. This option takes two arguments: an integer and a pointer to
2866
+** by default. <p>This option takes two arguments: an integer and a pointer to
28232867
** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
28242868
** leave unchanged the statement scanstatus option. If the second argument
28252869
** is not NULL, then the value of the statement scanstatus setting after
28262870
** processing the first argument is written into the integer that the second
28272871
** argument points to.
@@ -2831,20 +2875,89 @@
28312875
** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</dt>
28322876
** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order
28332877
** in which tables and indexes are scanned so that the scans start at the end
28342878
** and work toward the beginning rather than starting at the beginning and
28352879
** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2836
-** same as setting [PRAGMA reverse_unordered_selects]. This option takes
2880
+** same as setting [PRAGMA reverse_unordered_selects]. <p>This option takes
28372881
** two arguments which are an integer and a pointer to an integer. The first
28382882
** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
28392883
** reverse scan order flag, respectively. If the second argument is not NULL,
28402884
** then 0 or 1 is written into the integer that the second argument points to
28412885
** depending on if the reverse scan order flag is set after processing the
28422886
** first argument.
28432887
** </dd>
28442888
**
2889
+** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]]
2890
+** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE</dt>
2891
+** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables
2892
+** the ability of the [ATTACH DATABASE] SQL command to create a new database
2893
+** file if the database filed named in the ATTACH command does not already
2894
+** exist. This ability of ATTACH to create a new database is enabled by
2895
+** default. Applications can disable or reenable the ability for ATTACH to
2896
+** create new database files using this DBCONFIG option.<p>
2897
+** This option takes two arguments which are an integer and a pointer
2898
+** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
2899
+** leave unchanged the attach-create flag, respectively. If the second
2900
+** argument is not NULL, then 0 or 1 is written into the integer that the
2901
+** second argument points to depending on if the attach-create flag is set
2902
+** after processing the first argument.
2903
+** </dd>
2904
+**
2905
+** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]]
2906
+** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE</dt>
2907
+** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
2908
+** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
2909
+** This capability is enabled by default. Applications can disable or
2910
+** reenable this capability using the current DBCONFIG option. If the
2911
+** the this capability is disabled, the [ATTACH] command will still work,
2912
+** but the database will be opened read-only. If this option is disabled,
2913
+** then the ability to create a new database using [ATTACH] is also disabled,
2914
+** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
2915
+** option.<p>
2916
+** This option takes two arguments which are an integer and a pointer
2917
+** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
2918
+** leave unchanged the ability to ATTACH another database for writing,
2919
+** respectively. If the second argument is not NULL, then 0 or 1 is written
2920
+** into the integer to which the second argument points, depending on whether
2921
+** the ability to ATTACH a read/write database is enabled or disabled
2922
+** after processing the first argument.
2923
+** </dd>
2924
+**
2925
+** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]]
2926
+** <dt>SQLITE_DBCONFIG_ENABLE_COMMENTS</dt>
2927
+** <dd>The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the
2928
+** ability to include comments in SQL text. Comments are enabled by default.
2929
+** An application can disable or reenable comments in SQL text using this
2930
+** DBCONFIG option.<p>
2931
+** This option takes two arguments which are an integer and a pointer
2932
+** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
2933
+** leave unchanged the ability to use comments in SQL text,
2934
+** respectively. If the second argument is not NULL, then 0 or 1 is written
2935
+** into the integer that the second argument points to depending on if
2936
+** comments are allowed in SQL text after processing the first argument.
2937
+** </dd>
2938
+**
28452939
** </dl>
2940
+**
2941
+** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3>
2942
+**
2943
+** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
2944
+** overall call to [sqlite3_db_config()] has a total of four parameters.
2945
+** The first argument (the third parameter to sqlite3_db_config()) is a integer.
2946
+** The second argument is a pointer to an integer. If the first argument is 1,
2947
+** then the option becomes enabled. If the first integer argument is 0, then the
2948
+** option is disabled. If the first argument is -1, then the option setting
2949
+** is unchanged. The second argument, the pointer to an integer, may be NULL.
2950
+** If the second argument is not NULL, then a value of 0 or 1 is written into
2951
+** the integer to which the second argument points, depending on whether the
2952
+** setting is disabled or enabled after applying any changes specified by
2953
+** the first argument.
2954
+**
2955
+** <p>While most SQLITE_DBCONFIG options use the argument format
2956
+** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
2957
+** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the
2958
+** documentation of those exceptional options for details.
28462959
*/
28472960
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
28482961
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
28492962
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
28502963
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
@@ -2862,11 +2975,14 @@
28622975
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
28632976
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
28642977
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
28652978
#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
28662979
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2867
-#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
2980
+#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
2981
+#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
2982
+#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
2983
+#define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */
28682984
28692985
/*
28702986
** CAPI3REF: Enable Or Disable Extended Result Codes
28712987
** METHOD: sqlite3
28722988
**
@@ -11065,12 +11181,13 @@
1106511181
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
1106611182
1106711183
/*
1106811184
** CAPI3REF: Serialize a database
1106911185
**
11070
-** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory
11071
-** that is a serialization of the S database on [database connection] D.
11186
+** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
11187
+** memory that is a serialization of the S database on
11188
+** [database connection] D. If S is a NULL pointer, the main database is used.
1107211189
** If P is not a NULL pointer, then the size of the database in bytes
1107311190
** is written into *P.
1107411191
**
1107511192
** For an ordinary on-disk database file, the serialization is just a
1107611193
** copy of the disk file. For an in-memory database or a "TEMP" database,
@@ -12232,23 +12349,10 @@
1223212349
int nB, /* Number of bytes in buffer pB */
1223312350
void *pB, /* Pointer to buffer containing changeset B */
1223412351
int *pnOut, /* OUT: Number of bytes in output changeset */
1223512352
void **ppOut /* OUT: Buffer containing output changeset */
1223612353
);
12237
-
12238
-
12239
-/*
12240
-** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
12241
-*/
12242
-SQLITE_API int sqlite3changeset_upgrade(
12243
- sqlite3 *db,
12244
- const char *zDb,
12245
- int nIn, const void *pIn, /* Input changeset */
12246
- int *pnOut, void **ppOut /* OUT: Inverse of input */
12247
-);
12248
-
12249
-
1225012354
1225112355
/*
1225212356
** CAPI3REF: Changegroup Handle
1225312357
**
1225412358
** A changegroup is an object used to combine two or more
@@ -14046,13 +14150,17 @@
1404614150
# define SQLITE_MAX_VDBE_OP 250000000
1404714151
#endif
1404814152
1404914153
/*
1405014154
** The maximum number of arguments to an SQL function.
14155
+**
14156
+** This value has a hard upper limit of 32767 due to storage
14157
+** constraints (it needs to fit inside a i16). We keep it
14158
+** lower than that to prevent abuse.
1405114159
*/
1405214160
#ifndef SQLITE_MAX_FUNCTION_ARG
14053
-# define SQLITE_MAX_FUNCTION_ARG 127
14161
+# define SQLITE_MAX_FUNCTION_ARG 1000
1405414162
#endif
1405514163
1405614164
/*
1405714165
** The suggested maximum number of in-memory pages to use for
1405814166
** the main database table and for temporary tables.
@@ -14648,10 +14756,11 @@
1464814756
*/
1464914757
struct HashElem {
1465014758
HashElem *next, *prev; /* Next and previous elements in the table */
1465114759
void *data; /* Data associated with this element */
1465214760
const char *pKey; /* Key associated with this element */
14761
+ unsigned int h; /* hash for pKey */
1465314762
};
1465414763
1465514764
/*
1465614765
** Access routines. To delete, insert a NULL pointer.
1465714766
*/
@@ -14871,11 +14980,12 @@
1487114980
#define TK_ASTERISK 180
1487214981
#define TK_SPAN 181
1487314982
#define TK_ERROR 182
1487414983
#define TK_QNUMBER 183
1487514984
#define TK_SPACE 184
14876
-#define TK_ILLEGAL 185
14985
+#define TK_COMMENT 185
14986
+#define TK_ILLEGAL 186
1487714987
1487814988
/************** End of parse.h ***********************************************/
1487914989
/************** Continuing where we left off in sqliteInt.h ******************/
1488014990
#include <stdio.h>
1488114991
#include <stdlib.h>
@@ -15085,10 +15195,15 @@
1508515195
typedef UINT16_TYPE u16; /* 2-byte unsigned integer */
1508615196
typedef INT16_TYPE i16; /* 2-byte signed integer */
1508715197
typedef UINT8_TYPE u8; /* 1-byte unsigned integer */
1508815198
typedef INT8_TYPE i8; /* 1-byte signed integer */
1508915199
15200
+/* A bitfield type for use inside of structures. Always follow with :N where
15201
+** N is the number of bits.
15202
+*/
15203
+typedef unsigned bft; /* Bit Field Type */
15204
+
1509015205
/*
1509115206
** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value
1509215207
** that can be stored in a u32 without loss of data. The value
1509315208
** is 0x00000000ffffffff. But because of quirks of some compilers, we
1509415209
** have to specify the value in the less intuitive manner shown:
@@ -15123,10 +15238,12 @@
1512315238
** Examples:
1512415239
**
1512515240
** 0.5 -> -10 0.1 -> -33 0.0625 -> -40
1512615241
*/
1512715242
typedef INT16_TYPE LogEst;
15243
+#define LOGEST_MIN (-32768)
15244
+#define LOGEST_MAX (32767)
1512815245
1512915246
/*
1513015247
** Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer
1513115248
*/
1513215249
#ifndef SQLITE_PTRSIZE
@@ -15251,10 +15368,18 @@
1525115368
*/
1525215369
#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
1525315370
#define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32))
1525415371
#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
1525515372
15373
+/*
15374
+** Macro SMXV(n) return the maximum value that can be held in variable n,
15375
+** assuming n is a signed integer type. UMXV(n) is similar for unsigned
15376
+** integer types.
15377
+*/
15378
+#define SMXV(n) ((((i64)1)<<(sizeof(n)-1))-1)
15379
+#define UMXV(n) ((((i64)1)<<(sizeof(n)))-1)
15380
+
1525615381
/*
1525715382
** Round up a number to the next larger multiple of 8. This is used
1525815383
** to force 8-byte alignment on 64-bit architectures.
1525915384
**
1526015385
** ROUND8() always does the rounding, for any argument.
@@ -15393,11 +15518,11 @@
1539315518
** 0x-------F High-level debug messages
1539415519
** 0x----FFF- More detail
1539515520
** 0xFFFF---- Low-level debug messages
1539615521
**
1539715522
** 0x00000001 Code generation
15398
-** 0x00000002 Solver
15523
+** 0x00000002 Solver (Use 0x40000 for less detail)
1539915524
** 0x00000004 Solver costs
1540015525
** 0x00000008 WhereLoop inserts
1540115526
**
1540215527
** 0x00000010 Display sqlite3_index_info xBestIndex calls
1540315528
** 0x00000020 Range an equality scan metrics
@@ -15412,10 +15537,12 @@
1541215537
** 0x00004000 Show all WHERE terms at key points
1541315538
** 0x00008000 Show the full SELECT statement at key places
1541415539
**
1541515540
** 0x00010000 Show more detail when printing WHERE terms
1541615541
** 0x00020000 Show WHERE terms returned from whereScanNext()
15542
+** 0x00040000 Solver overview messages
15543
+** 0x00080000 Star-query heuristic
1541715544
*/
1541815545
1541915546
1542015547
/*
1542115548
** An instance of the following structure is used to store the busy-handler
@@ -16049,10 +16176,26 @@
1604916176
#define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */
1605016177
#define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */
1605116178
#define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */
1605216179
#define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */
1605316180
#define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */
16181
+
16182
+#define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL)
16183
+
16184
+/*
16185
+** The argument to this macro is a file descriptor (type sqlite3_file*).
16186
+** Return 0 if it is not open, or non-zero (but not 1) if it is.
16187
+**
16188
+** This is so that expressions can be written as:
16189
+**
16190
+** if( isOpen(pPager->jfd) ){ ...
16191
+**
16192
+** instead of
16193
+**
16194
+** if( pPager->jfd->pMethods ){ ...
16195
+*/
16196
+#define isOpen(pFd) ((pFd)->pMethods!=0)
1605416197
1605516198
/*
1605616199
** Flags that make up the mask passed to sqlite3PagerGet().
1605716200
*/
1605816201
#define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */
@@ -16688,10 +16831,11 @@
1668816831
** A signature for a reusable subroutine that materializes the RHS of
1668916832
** an IN operator.
1669016833
*/
1669116834
struct SubrtnSig {
1669216835
int selId; /* SELECT-id for the SELECT statement on the RHS */
16836
+ u8 bComplete; /* True if fully coded and available for reusable */
1669316837
char *zAff; /* Affinity of the overall IN expression */
1669416838
int iTable; /* Ephemeral table generated by the subroutine */
1669516839
int iAddr; /* Subroutine entry address */
1669616840
int regReturn; /* Register used to hold return address */
1669716841
};
@@ -18018,10 +18162,13 @@
1801818162
/* DELETE, or UPDATE and return */
1801918163
/* the count using a callback. */
1802018164
#define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
1802118165
#define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
1802218166
#define SQLITE_FkNoAction HI(0x00008) /* Treat all FK as NO ACTION */
18167
+#define SQLITE_AttachCreate HI(0x00010) /* ATTACH allowed to create new dbs */
18168
+#define SQLITE_AttachWrite HI(0x00020) /* ATTACH allowed to open for write */
18169
+#define SQLITE_Comments HI(0x00040) /* Enable SQL comments */
1802318170
1802418171
/* Flags used only if debugging */
1802518172
#ifdef SQLITE_DEBUG
1802618173
#define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
1802718174
#define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -18077,10 +18224,11 @@
1807718224
#define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
1807818225
#define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
1807918226
#define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */
1808018227
#define SQLITE_OnePass 0x08000000 /* Single-pass DELETE and UPDATE */
1808118228
#define SQLITE_OrderBySubq 0x10000000 /* ORDER BY in subquery helps outer */
18229
+#define SQLITE_StarQuery 0x20000000 /* Heurists for star queries */
1808218230
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
1808318231
1808418232
/*
1808518233
** Macros for testing whether or not optimizations are enabled or disabled.
1808618234
*/
@@ -18113,11 +18261,11 @@
1811318261
**
1811418262
** The u.pHash field is used by the global built-ins. The u.pDestructor
1811518263
** field is used by per-connection app-def functions.
1811618264
*/
1811718265
struct FuncDef {
18118
- i8 nArg; /* Number of arguments. -1 means unlimited */
18266
+ i16 nArg; /* Number of arguments. -1 means unlimited */
1811918267
u32 funcFlags; /* Some combination of SQLITE_FUNC_* */
1812018268
void *pUserData; /* User data parameter */
1812118269
FuncDef *pNext; /* Next function with same name */
1812218270
void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */
1812318271
void (*xFinalize)(sqlite3_context*); /* Agg finalizer */
@@ -18606,10 +18754,11 @@
1860618754
VTable *p; /* List of VTable objects. */
1860718755
} vtab;
1860818756
} u;
1860918757
Trigger *pTrigger; /* List of triggers on this object */
1861018758
Schema *pSchema; /* Schema that contains this table */
18759
+ u8 aHx[16]; /* Column aHt[K%sizeof(aHt)] might have hash K */
1861118760
};
1861218761
1861318762
/*
1861418763
** Allowed values for Table.tabFlags.
1861518764
**
@@ -19406,17 +19555,12 @@
1940619555
**
1940719556
** If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
1940819557
*/
1940919558
struct IdList {
1941019559
int nId; /* Number of identifiers on the list */
19411
- u8 eU4; /* Which element of a.u4 is valid */
1941219560
struct IdList_item {
1941319561
char *zName; /* Name of the identifier */
19414
- union {
19415
- int idx; /* Index in some Table.aCol[] of a column named zName */
19416
- Expr *pExpr; /* Expr to implement a USING variable -- NOT USED */
19417
- } u4;
1941819562
} a[1];
1941919563
};
1942019564
1942119565
/*
1942219566
** Allowed values for IdList.eType, which determines which value of the a.u4
@@ -20008,29 +20152,36 @@
2000820152
struct Parse {
2000920153
sqlite3 *db; /* The main database structure */
2001020154
char *zErrMsg; /* An error message */
2001120155
Vdbe *pVdbe; /* An engine for executing database bytecode */
2001220156
int rc; /* Return code from execution */
20013
- u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
20014
- u8 checkSchema; /* Causes schema cookie check after an error */
20157
+ LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
2001520158
u8 nested; /* Number of nested calls to the parser/code generator */
2001620159
u8 nTempReg; /* Number of temporary registers in aTempReg[] */
2001720160
u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
2001820161
u8 mayAbort; /* True if statement may throw an ABORT exception */
2001920162
u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
20020
- u8 okConstFactor; /* OK to factor out constants */
2002120163
u8 disableLookaside; /* Number of times lookaside has been disabled */
2002220164
u8 prepFlags; /* SQLITE_PREPARE_* flags */
2002320165
u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
20024
- u8 bHasWith; /* True if statement contains WITH */
2002520166
u8 mSubrtnSig; /* mini Bloom filter on available SubrtnSig.selId */
20167
+ u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
20168
+ u8 bReturning; /* Coding a RETURNING trigger */
20169
+ u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
20170
+ u8 disableTriggers; /* True to disable triggers */
2002620171
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
2002720172
u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
2002820173
#endif
2002920174
#ifdef SQLITE_DEBUG
2003020175
u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
20176
+ u8 isCreate; /* CREATE TABLE, INDEX, or VIEW (but not TRIGGER)
20177
+ ** and ALTER TABLE ADD COLUMN. */
2003120178
#endif
20179
+ bft colNamesSet :1; /* TRUE after OP_ColumnName has been issued to pVdbe */
20180
+ bft bHasWith :1; /* True if statement contains WITH */
20181
+ bft okConstFactor :1; /* OK to factor out constants */
20182
+ bft checkSchema :1; /* Causes schema cookie check after an error */
2003220183
int nRangeReg; /* Size of the temporary register block */
2003320184
int iRangeReg; /* First register in temporary register block */
2003420185
int nErr; /* Number of errors seen */
2003520186
int nTab; /* Number of previously allocated VDBE cursors */
2003620187
int nMem; /* Number of memory cells used so far */
@@ -20041,16 +20192,13 @@
2004120192
int nLabelAlloc; /* Number of slots in aLabel */
2004220193
int *aLabel; /* Space to hold the labels */
2004320194
ExprList *pConstExpr;/* Constant expressions */
2004420195
IndexedExpr *pIdxEpr;/* List of expressions used by active indexes */
2004520196
IndexedExpr *pIdxPartExpr; /* Exprs constrained by index WHERE clauses */
20046
- Token constraintName;/* Name of the constraint currently being parsed */
2004720197
yDbMask writeMask; /* Start a write transaction on these databases */
2004820198
yDbMask cookieMask; /* Bitmask of schema verified databases */
20049
- int regRowid; /* Register holding rowid of CREATE TABLE entry */
20050
- int regRoot; /* Register holding root page number for new objects */
20051
- int nMaxArg; /* Max args passed to user function by sub-program */
20199
+ int nMaxArg; /* Max args to xUpdate and xFilter vtab methods */
2005220200
int nSelect; /* Number of SELECT stmts. Counter for Select.selId */
2005320201
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
2005420202
u32 nProgressSteps; /* xProgress steps taken during sqlite3_prepare() */
2005520203
#endif
2005620204
#ifndef SQLITE_OMIT_SHARED_CACHE
@@ -20060,21 +20208,10 @@
2006020208
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
2006120209
Parse *pToplevel; /* Parse structure for main program (or NULL) */
2006220210
Table *pTriggerTab; /* Table triggers are being coded for */
2006320211
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
2006420212
ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
20065
- union {
20066
- int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
20067
- Returning *pReturning; /* The RETURNING clause */
20068
- } u1;
20069
- u32 oldmask; /* Mask of old.* columns referenced */
20070
- u32 newmask; /* Mask of new.* columns referenced */
20071
- LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
20072
- u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
20073
- u8 bReturning; /* Coding a RETURNING trigger */
20074
- u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
20075
- u8 disableTriggers; /* True to disable triggers */
2007620213
2007720214
/**************************************************************************
2007820215
** Fields above must be initialized to zero. The fields that follow,
2007920216
** down to the beginning of the recursive section, do not need to be
2008020217
** initialized as they will be set before being used. The boundary is
@@ -20082,10 +20219,23 @@
2008220219
**************************************************************************/
2008320220
2008420221
int aTempReg[8]; /* Holding area for temporary registers */
2008520222
Parse *pOuterParse; /* Outer Parse object when nested */
2008620223
Token sNameToken; /* Token with unqualified schema object name */
20224
+ u32 oldmask; /* Mask of old.* columns referenced */
20225
+ u32 newmask; /* Mask of new.* columns referenced */
20226
+ union {
20227
+ struct { /* These fields available when isCreate is true */
20228
+ int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
20229
+ int regRowid; /* Register holding rowid of CREATE TABLE entry */
20230
+ int regRoot; /* Register holding root page for new objects */
20231
+ Token constraintName; /* Name of the constraint currently being parsed */
20232
+ } cr;
20233
+ struct { /* These fields available to all other statements */
20234
+ Returning *pReturning; /* The RETURNING clause */
20235
+ } d;
20236
+ } u1;
2008720237
2008820238
/************************************************************************
2008920239
** Above is constant between recursions. Below is reset before and after
2009020240
** each recursion. The boundary between these two regions is determined
2009120241
** using offsetof(Parse,sLastToken) so the sLastToken field must be the
@@ -20099,13 +20249,11 @@
2009920249
u8 eParseMode; /* PARSE_MODE_XXX constant */
2010020250
#ifndef SQLITE_OMIT_VIRTUALTABLE
2010120251
int nVtabLock; /* Number of virtual tables to lock */
2010220252
#endif
2010320253
int nHeight; /* Expression tree height of current sub-select */
20104
-#ifndef SQLITE_OMIT_EXPLAIN
2010520254
int addrExplain; /* Address of current OP_Explain opcode */
20106
-#endif
2010720255
VList *pVList; /* Mapping between variable names and numbers */
2010820256
Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
2010920257
const char *zTail; /* All SQL text past the last semicolon parsed */
2011020258
Table *pNewTable; /* A table being constructed by CREATE TABLE */
2011120259
Index *pNewIndex; /* An index being constructed by CREATE INDEX.
@@ -23559,10 +23707,11 @@
2355923707
char *zMalloc; /* Space to hold MEM_Str or MEM_Blob if szMalloc>0 */
2356023708
void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */
2356123709
#ifdef SQLITE_DEBUG
2356223710
Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
2356323711
u16 mScopyFlags; /* flags value immediately after the shallow copy */
23712
+ u8 bScopy; /* The pScopyFrom of some other Mem *might* point here */
2356423713
#endif
2356523714
};
2356623715
2356723716
/*
2356823717
** Size of struct Mem not including the Mem.zMalloc member or anything that
@@ -23708,18 +23857,14 @@
2370823857
Vdbe *pVdbe; /* The VM that owns this context */
2370923858
int iOp; /* Instruction number of OP_Function */
2371023859
int isError; /* Error code returned by the function. */
2371123860
u8 enc; /* Encoding to use for results */
2371223861
u8 skipFlag; /* Skip accumulator loading if true */
23713
- u8 argc; /* Number of arguments */
23862
+ u16 argc; /* Number of arguments */
2371423863
sqlite3_value *argv[1]; /* Argument set */
2371523864
};
2371623865
23717
-/* A bitfield type for use inside of structures. Always follow with :N where
23718
-** N is the number of bits.
23719
-*/
23720
-typedef unsigned bft; /* Bit Field Type */
2372123866
2372223867
/* The ScanStatus object holds a single value for the
2372323868
** sqlite3_stmt_scanstatus() interface.
2372423869
**
2372523870
** aAddrRange[]:
@@ -23776,11 +23921,11 @@
2377623921
i64 iCurrentTime; /* Value of julianday('now') for this statement */
2377723922
i64 nFkConstraint; /* Number of imm. FK constraints this VM */
2377823923
i64 nStmtDefCons; /* Number of def. constraints when stmt started */
2377923924
i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
2378023925
Mem *aMem; /* The memory locations */
23781
- Mem **apArg; /* Arguments to currently executing user function */
23926
+ Mem **apArg; /* Arguments xUpdate and xFilter vtab methods */
2378223927
VdbeCursor **apCsr; /* One element of this array for each open cursor */
2378323928
Mem *aVar; /* Values for the OP_Variable opcode. */
2378423929
2378523930
/* When allocating a new Vdbe object, all of the fields below should be
2378623931
** initialized to zero or NULL */
@@ -23796,10 +23941,11 @@
2379623941
i64 startTime; /* Time when query started - used for profiling */
2379723942
#endif
2379823943
#ifdef SQLITE_DEBUG
2379923944
int rcApp; /* errcode set by sqlite3_result_error_code() */
2380023945
u32 nWrite; /* Number of write operations that have occurred */
23946
+ int napArg; /* Size of the apArg[] array */
2380123947
#endif
2380223948
u16 nResColumn; /* Number of columns in one row of the result set */
2380323949
u16 nResAlloc; /* Column slots allocated to aColName[] */
2380423950
u8 errorAction; /* Recovery action to do in case of an error */
2380523951
u8 minWriteFileFormat; /* Minimum file format for writable database files */
@@ -24657,10 +24803,13 @@
2465724803
ms = ms*10.0 + *zDate - '0';
2465824804
rScale *= 10.0;
2465924805
zDate++;
2466024806
}
2466124807
ms /= rScale;
24808
+ /* Truncate to avoid problems with sub-milliseconds
24809
+ ** rounding. https://sqlite.org/forum/forumpost/766a2c9231 */
24810
+ if( ms>0.999 ) ms = 0.999;
2466224811
}
2466324812
}else{
2466424813
s = 0;
2466524814
}
2466624815
p->validJD = 0;
@@ -25864,11 +26013,11 @@
2586426013
sqlite3_str_appendf(&sRes, cf=='d' ? "%02d" : "%2d", x.D);
2586526014
break;
2586626015
}
2586726016
case 'f': { /* Fractional seconds. (Non-standard) */
2586826017
double s = x.s;
25869
- if( s>59.999 ) s = 59.999;
26018
+ if( NEVER(s>59.999) ) s = 59.999;
2587026019
sqlite3_str_appendf(&sRes, "%06.3f", s);
2587126020
break;
2587226021
}
2587326022
case 'F': {
2587426023
sqlite3_str_appendf(&sRes, "%04d-%02d-%02d", x.Y, x.M, x.D);
@@ -32424,11 +32573,11 @@
3242432573
** pointer if any kind of error was encountered.
3242532574
*/
3242632575
static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){
3242732576
char *zText;
3242832577
assert( p->mxAlloc>0 && !isMalloced(p) );
32429
- zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );
32578
+ zText = sqlite3DbMallocRaw(p->db, 1+(u64)p->nChar );
3243032579
if( zText ){
3243132580
memcpy(zText, p->zText, p->nChar+1);
3243232581
p->printfFlags |= SQLITE_PRINTF_MALLOCED;
3243332582
}else{
3243432583
sqlite3StrAccumSetError(p, SQLITE_NOMEM);
@@ -33032,11 +33181,14 @@
3303233181
}
3303333182
if( pItem->fg.fromDDL ){
3303433183
sqlite3_str_appendf(&x, " DDL");
3303533184
}
3303633185
if( pItem->fg.isCte ){
33037
- sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
33186
+ static const char *aMat[] = {",MAT", "", ",NO-MAT"};
33187
+ sqlite3_str_appendf(&x, " CteUse=%d%s",
33188
+ pItem->u2.pCteUse->nUse,
33189
+ aMat[pItem->u2.pCteUse->eM10d]);
3303833190
}
3303933191
if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
3304033192
sqlite3_str_appendf(&x, " isOn");
3304133193
}
3304233194
if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc");
@@ -33063,13 +33215,10 @@
3306333215
if( pItem->pSTab ){
3306433216
Table *pTab = pItem->pSTab;
3306533217
sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
3306633218
}
3306733219
assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) );
33068
- sqlite3TreeViewPush(&pView, 0);
33069
- sqlite3TreeViewLine(pView, "SUBQUERY");
33070
- sqlite3TreeViewPop(&pView);
3307133220
sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0);
3307233221
}
3307333222
if( pItem->fg.isTabFunc ){
3307433223
sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
3307533224
}
@@ -33795,25 +33944,11 @@
3379533944
char *zName = pList->a[i].zName;
3379633945
int moreToFollow = i<pList->nId - 1;
3379733946
if( zName==0 ) zName = "(null)";
3379833947
sqlite3TreeViewPush(&pView, moreToFollow);
3379933948
sqlite3TreeViewLine(pView, 0);
33800
- if( pList->eU4==EU4_NONE ){
33801
- fprintf(stdout, "%s\n", zName);
33802
- }else if( pList->eU4==EU4_IDX ){
33803
- fprintf(stdout, "%s (%d)\n", zName, pList->a[i].u4.idx);
33804
- }else{
33805
- assert( pList->eU4==EU4_EXPR );
33806
- if( pList->a[i].u4.pExpr==0 ){
33807
- fprintf(stdout, "%s (pExpr=NULL)\n", zName);
33808
- }else{
33809
- fprintf(stdout, "%s\n", zName);
33810
- sqlite3TreeViewPush(&pView, i<pList->nId-1);
33811
- sqlite3TreeViewExpr(pView, pList->a[i].u4.pExpr, 0);
33812
- sqlite3TreeViewPop(&pView);
33813
- }
33814
- }
33949
+ fprintf(stdout, "%s\n", zName);
3381533950
sqlite3TreeViewPop(&pView);
3381633951
}
3381733952
}
3381833953
}
3381933954
SQLITE_PRIVATE void sqlite3TreeViewIdList(
@@ -36290,11 +36425,15 @@
3629036425
}
3629136426
}
3629236427
}
3629336428
p->z = &p->zBuf[i+1];
3629436429
assert( i+p->n < sizeof(p->zBuf) );
36295
- while( ALWAYS(p->n>0) && p->z[p->n-1]=='0' ){ p->n--; }
36430
+ assert( p->n>0 );
36431
+ while( p->z[p->n-1]=='0' ){
36432
+ p->n--;
36433
+ assert( p->n>0 );
36434
+ }
3629636435
}
3629736436
3629836437
/*
3629936438
** Try to convert z into an unsigned 32-bit integer. Return true on
3630036439
** success and false if there is an error.
@@ -37076,16 +37215,23 @@
3707637215
/*
3707737216
** The hashing function.
3707837217
*/
3707937218
static unsigned int strHash(const char *z){
3708037219
unsigned int h = 0;
37081
- unsigned char c;
37082
- while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/
37220
+ while( z[0] ){ /*OPTIMIZATION-IF-TRUE*/
3708337221
/* Knuth multiplicative hashing. (Sorting & Searching, p. 510).
3708437222
** 0x9e3779b1 is 2654435761 which is the closest prime number to
37085
- ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */
37086
- h += sqlite3UpperToLower[c];
37223
+ ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2.
37224
+ **
37225
+ ** Only bits 0xdf for ASCII and bits 0xbf for EBCDIC each octet are
37226
+ ** hashed since the omitted bits determine the upper/lower case difference.
37227
+ */
37228
+#ifdef SQLITE_EBCDIC
37229
+ h += 0xbf & (unsigned char)*(z++);
37230
+#else
37231
+ h += 0xdf & (unsigned char)*(z++);
37232
+#endif
3708737233
h *= 0x9e3779b1;
3708837234
}
3708937235
return h;
3709037236
}
3709137237
@@ -37154,13 +37300,12 @@
3715437300
sqlite3_free(pH->ht);
3715537301
pH->ht = new_ht;
3715637302
pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);
3715737303
memset(new_ht, 0, new_size*sizeof(struct _ht));
3715837304
for(elem=pH->first, pH->first=0; elem; elem = next_elem){
37159
- unsigned int h = strHash(elem->pKey) % new_size;
3716037305
next_elem = elem->next;
37161
- insertElement(pH, &new_ht[h], elem);
37306
+ insertElement(pH, &new_ht[elem->h % new_size], elem);
3716237307
}
3716337308
return 1;
3716437309
}
3716537310
3716637311
/* This function (for internal use only) locates an element in an
@@ -37174,27 +37319,26 @@
3717437319
unsigned int *pHash /* Write the hash value here */
3717537320
){
3717637321
HashElem *elem; /* Used to loop thru the element list */
3717737322
unsigned int count; /* Number of elements left to test */
3717837323
unsigned int h; /* The computed hash */
37179
- static HashElem nullElement = { 0, 0, 0, 0 };
37324
+ static HashElem nullElement = { 0, 0, 0, 0, 0 };
3718037325
37326
+ h = strHash(pKey);
3718137327
if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
3718237328
struct _ht *pEntry;
37183
- h = strHash(pKey) % pH->htsize;
37184
- pEntry = &pH->ht[h];
37329
+ pEntry = &pH->ht[h % pH->htsize];
3718537330
elem = pEntry->chain;
3718637331
count = pEntry->count;
3718737332
}else{
37188
- h = 0;
3718937333
elem = pH->first;
3719037334
count = pH->count;
3719137335
}
3719237336
if( pHash ) *pHash = h;
3719337337
while( count ){
3719437338
assert( elem!=0 );
37195
- if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
37339
+ if( h==elem->h && sqlite3StrICmp(elem->pKey,pKey)==0 ){
3719637340
return elem;
3719737341
}
3719837342
elem = elem->next;
3719937343
count--;
3720037344
}
@@ -37202,14 +37346,13 @@
3720237346
}
3720337347
3720437348
/* Remove a single entry from the hash table given a pointer to that
3720537349
** element and a hash on the element's key.
3720637350
*/
37207
-static void removeElementGivenHash(
37351
+static void removeElement(
3720837352
Hash *pH, /* The pH containing "elem" */
37209
- HashElem* elem, /* The element to be removed from the pH */
37210
- unsigned int h /* Hash value for the element */
37353
+ HashElem *elem /* The element to be removed from the pH */
3721137354
){
3721237355
struct _ht *pEntry;
3721337356
if( elem->prev ){
3721437357
elem->prev->next = elem->next;
3721537358
}else{
@@ -37217,11 +37360,11 @@
3721737360
}
3721837361
if( elem->next ){
3721937362
elem->next->prev = elem->prev;
3722037363
}
3722137364
if( pH->ht ){
37222
- pEntry = &pH->ht[h];
37365
+ pEntry = &pH->ht[elem->h % pH->htsize];
3722337366
if( pEntry->chain==elem ){
3722437367
pEntry->chain = elem->next;
3722537368
}
3722637369
assert( pEntry->count>0 );
3722737370
pEntry->count--;
@@ -37268,11 +37411,11 @@
3726837411
assert( pKey!=0 );
3726937412
elem = findElementWithHash(pH,pKey,&h);
3727037413
if( elem->data ){
3727137414
void *old_data = elem->data;
3727237415
if( data==0 ){
37273
- removeElementGivenHash(pH,elem,h);
37416
+ removeElement(pH,elem);
3727437417
}else{
3727537418
elem->data = data;
3727637419
elem->pKey = pKey;
3727737420
}
3727837421
return old_data;
@@ -37279,19 +37422,17 @@
3727937422
}
3728037423
if( data==0 ) return 0;
3728137424
new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) );
3728237425
if( new_elem==0 ) return data;
3728337426
new_elem->pKey = pKey;
37427
+ new_elem->h = h;
3728437428
new_elem->data = data;
3728537429
pH->count++;
37286
- if( pH->count>=10 && pH->count > 2*pH->htsize ){
37287
- if( rehash(pH, pH->count*2) ){
37288
- assert( pH->htsize>0 );
37289
- h = strHash(pKey) % pH->htsize;
37290
- }
37430
+ if( pH->count>=5 && pH->count > 2*pH->htsize ){
37431
+ rehash(pH, pH->count*3);
3729137432
}
37292
- insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem);
37433
+ insertElement(pH, pH->ht ? &pH->ht[new_elem->h % pH->htsize] : 0, new_elem);
3729337434
return 0;
3729437435
}
3729537436
3729637437
/************** End of hash.c ************************************************/
3729737438
/************** Begin file opcodes.c *****************************************/
@@ -40150,11 +40291,11 @@
4015040291
assert( pInode!=0 );
4015140292
assert( sqlite3_mutex_held(pInode->pLockMutex) );
4015240293
if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){
4015340294
if( pInode->bProcessLock==0 ){
4015440295
struct flock lock;
40155
- assert( pInode->nLock==0 );
40296
+ /* assert( pInode->nLock==0 ); <-- Not true if unix-excl READONLY used */
4015640297
lock.l_whence = SEEK_SET;
4015740298
lock.l_start = SHARED_FIRST;
4015840299
lock.l_len = SHARED_SIZE;
4015940300
lock.l_type = F_WRLCK;
4016040301
rc = osSetPosixAdvisoryLock(pFile->h, &lock, pFile);
@@ -50698,11 +50839,11 @@
5069850839
** allocate space for a new winShmNode and filename.
5069950840
*/
5070050841
p = sqlite3MallocZero( sizeof(*p) );
5070150842
if( p==0 ) return SQLITE_IOERR_NOMEM_BKPT;
5070250843
nName = sqlite3Strlen30(pDbFd->zPath);
50703
- pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 );
50844
+ pNew = sqlite3MallocZero( sizeof(*pShmNode) + (i64)nName + 17 );
5070450845
if( pNew==0 ){
5070550846
sqlite3_free(p);
5070650847
return SQLITE_IOERR_NOMEM_BKPT;
5070750848
}
5070850849
pNew->zFilename = (char*)&pNew[1];
@@ -51519,11 +51660,11 @@
5151951660
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
5152051661
"0123456789";
5152151662
size_t i, j;
5152251663
DWORD pid;
5152351664
int nPre = sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX);
51524
- int nMax, nBuf, nDir, nLen;
51665
+ i64 nMax, nBuf, nDir, nLen;
5152551666
char *zBuf;
5152651667
5152751668
/* It's odd to simulate an io-error here, but really this is just
5152851669
** using the io-error infrastructure to test that SQLite handles this
5152951670
** function failing.
@@ -51531,11 +51672,12 @@
5153151672
SimulateIOError( return SQLITE_IOERR );
5153251673
5153351674
/* Allocate a temporary buffer to store the fully qualified file
5153451675
** name for the temporary file. If this fails, we cannot continue.
5153551676
*/
51536
- nMax = pVfs->mxPathname; nBuf = nMax + 2;
51677
+ nMax = pVfs->mxPathname;
51678
+ nBuf = 2 + (i64)nMax;
5153751679
zBuf = sqlite3MallocZero( nBuf );
5153851680
if( !zBuf ){
5153951681
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
5154051682
return SQLITE_IOERR_NOMEM_BKPT;
5154151683
}
@@ -52390,11 +52532,11 @@
5239052532
** NOTE: We are dealing with a relative path name and the data
5239152533
** directory has been set. Therefore, use it as the basis
5239252534
** for converting the relative path name to an absolute
5239352535
** one by prepending the data directory and a slash.
5239452536
*/
52395
- char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
52537
+ char *zOut = sqlite3MallocZero( 1+(u64)pVfs->mxPathname );
5239652538
if( !zOut ){
5239752539
return SQLITE_IOERR_NOMEM_BKPT;
5239852540
}
5239952541
if( cygwin_conv_path(
5240052542
(osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) |
@@ -52485,17 +52627,16 @@
5248552627
if( nByte==0 ){
5248652628
sqlite3_free(zConverted);
5248752629
return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
5248852630
"winFullPathname1", zRelative);
5248952631
}
52490
- nByte += 3;
52491
- zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
52632
+ zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) );
5249252633
if( zTemp==0 ){
5249352634
sqlite3_free(zConverted);
5249452635
return SQLITE_IOERR_NOMEM_BKPT;
5249552636
}
52496
- nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0);
52637
+ nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte+3, zTemp, 0);
5249752638
if( nByte==0 ){
5249852639
sqlite3_free(zConverted);
5249952640
sqlite3_free(zTemp);
5250052641
return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
5250152642
"winFullPathname2", zRelative);
@@ -52511,17 +52652,16 @@
5251152652
if( nByte==0 ){
5251252653
sqlite3_free(zConverted);
5251352654
return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
5251452655
"winFullPathname3", zRelative);
5251552656
}
52516
- nByte += 3;
52517
- zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
52657
+ zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) );
5251852658
if( zTemp==0 ){
5251952659
sqlite3_free(zConverted);
5252052660
return SQLITE_IOERR_NOMEM_BKPT;
5252152661
}
52522
- nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0);
52662
+ nByte = osGetFullPathNameA((char*)zConverted, nByte+3, zTemp, 0);
5252352663
if( nByte==0 ){
5252452664
sqlite3_free(zConverted);
5252552665
sqlite3_free(zTemp);
5252652666
return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
5252752667
"winFullPathname4", zRelative);
@@ -53546,17 +53686,17 @@
5354653686
break;
5354753687
}
5354853688
}
5354953689
if( p==0 ){
5355053690
MemStore **apNew;
53551
- p = sqlite3Malloc( sizeof(*p) + szName + 3 );
53691
+ p = sqlite3Malloc( sizeof(*p) + (i64)szName + 3 );
5355253692
if( p==0 ){
5355353693
sqlite3_mutex_leave(pVfsMutex);
5355453694
return SQLITE_NOMEM;
5355553695
}
5355653696
apNew = sqlite3Realloc(memdb_g.apMemStore,
53557
- sizeof(apNew[0])*(memdb_g.nMemStore+1) );
53697
+ sizeof(apNew[0])*(1+(i64)memdb_g.nMemStore) );
5355853698
if( apNew==0 ){
5355953699
sqlite3_free(p);
5356053700
sqlite3_mutex_leave(pVfsMutex);
5356153701
return SQLITE_NOMEM;
5356253702
}
@@ -54262,11 +54402,11 @@
5426254402
void *pTmpSpace;
5426354403
5426454404
/* Allocate the Bitvec to be tested and a linear array of
5426554405
** bits to act as the reference */
5426654406
pBitvec = sqlite3BitvecCreate( sz );
54267
- pV = sqlite3MallocZero( (sz+7)/8 + 1 );
54407
+ pV = sqlite3MallocZero( (7+(i64)sz)/8 + 1 );
5426854408
pTmpSpace = sqlite3_malloc64(BITVEC_SZ);
5426954409
if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end;
5427054410
5427154411
/* NULL pBitvec tests */
5427254412
sqlite3BitvecSet(0, 1);
@@ -55809,16 +55949,16 @@
5580955949
**
5581055950
** The PCache mutex must be held when this function is called.
5581155951
*/
5581255952
static void pcache1ResizeHash(PCache1 *p){
5581355953
PgHdr1 **apNew;
55814
- unsigned int nNew;
55815
- unsigned int i;
55954
+ u64 nNew;
55955
+ u32 i;
5581655956
5581755957
assert( sqlite3_mutex_held(p->pGroup->mutex) );
5581855958
55819
- nNew = p->nHash*2;
55959
+ nNew = 2*(u64)p->nHash;
5582055960
if( nNew<256 ){
5582155961
nNew = 256;
5582255962
}
5582355963
5582455964
pcache1LeaveMutex(p->pGroup);
@@ -56037,11 +56177,11 @@
5603756177
** Allocate a new cache.
5603856178
*/
5603956179
static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){
5604056180
PCache1 *pCache; /* The newly created page cache */
5604156181
PGroup *pGroup; /* The group the new page cache will belong to */
56042
- int sz; /* Bytes of memory required to allocate the new cache */
56182
+ i64 sz; /* Bytes of memory required to allocate the new cache */
5604356183
5604456184
assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 );
5604556185
assert( szExtra < 300 );
5604656186
5604756187
sz = sizeof(PCache1) + sizeof(PGroup)*pcache1.separateCache;
@@ -58014,24 +58154,10 @@
5801458154
# define USEFETCH(x) ((x)->bUseFetch)
5801558155
#else
5801658156
# define USEFETCH(x) 0
5801758157
#endif
5801858158
58019
-/*
58020
-** The argument to this macro is a file descriptor (type sqlite3_file*).
58021
-** Return 0 if it is not open, or non-zero (but not 1) if it is.
58022
-**
58023
-** This is so that expressions can be written as:
58024
-**
58025
-** if( isOpen(pPager->jfd) ){ ...
58026
-**
58027
-** instead of
58028
-**
58029
-** if( pPager->jfd->pMethods ){ ...
58030
-*/
58031
-#define isOpen(pFd) ((pFd)->pMethods!=0)
58032
-
5803358159
#ifdef SQLITE_DIRECT_OVERFLOW_READ
5803458160
/*
5803558161
** Return true if page pgno can be read directly from the database file
5803658162
** by the b-tree layer. This is the case if:
5803758163
**
@@ -58047,11 +58173,11 @@
5804758173
if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0; /* Failed (3) */
5804858174
#ifndef SQLITE_OMIT_WAL
5804958175
if( pPager->pWal ){
5805058176
u32 iRead = 0;
5805158177
(void)sqlite3WalFindFrame(pPager->pWal, pgno, &iRead);
58052
- return iRead==0; /* Condition (4) */
58178
+ if( iRead ) return 0; /* Case (4) */
5805358179
}
5805458180
#endif
5805558181
assert( pPager->fd->pMethods->xDeviceCharacteristics!=0 );
5805658182
if( (pPager->fd->pMethods->xDeviceCharacteristics(pPager->fd)
5805758183
& SQLITE_IOCAP_SUBPAGE_READ)==0 ){
@@ -58530,11 +58656,11 @@
5853058656
** zSuper[0] is set to 0 and SQLITE_OK returned.
5853158657
**
5853258658
** If an error occurs while reading from the journal file, an SQLite
5853358659
** error code is returned.
5853458660
*/
58535
-static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u32 nSuper){
58661
+static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u64 nSuper){
5853658662
int rc; /* Return code */
5853758663
u32 len; /* Length in bytes of super-journal name */
5853858664
i64 szJ; /* Total size in bytes of journal file pJrnl */
5853958665
u32 cksum; /* MJ checksum value read from journal */
5854058666
u32 u; /* Unsigned loop counter */
@@ -59313,11 +59439,11 @@
5931359439
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
5931459440
}
5931559441
}
5931659442
pPager->journalOff = 0;
5931759443
}else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST
59318
- || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL)
59444
+ || (pPager->exclusiveMode && pPager->journalMode<PAGER_JOURNALMODE_WAL)
5931959445
){
5932059446
rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile);
5932159447
pPager->journalOff = 0;
5932259448
}else{
5932359449
/* This branch may be executed with Pager.journalMode==MEMORY if
@@ -59766,16 +59892,16 @@
5976659892
char *zSuperJournal = 0; /* Contents of super-journal file */
5976759893
i64 nSuperJournal; /* Size of super-journal file */
5976859894
char *zJournal; /* Pointer to one journal within MJ file */
5976959895
char *zSuperPtr; /* Space to hold super-journal filename */
5977059896
char *zFree = 0; /* Free this buffer */
59771
- int nSuperPtr; /* Amount of space allocated to zSuperPtr[] */
59897
+ i64 nSuperPtr; /* Amount of space allocated to zSuperPtr[] */
5977259898
5977359899
/* Allocate space for both the pJournal and pSuper file descriptors.
5977459900
** If successful, open the super-journal file for reading.
5977559901
*/
59776
- pSuper = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2);
59902
+ pSuper = (sqlite3_file *)sqlite3MallocZero(2 * (i64)pVfs->szOsFile);
5977759903
if( !pSuper ){
5977859904
rc = SQLITE_NOMEM_BKPT;
5977959905
pJournal = 0;
5978059906
}else{
5978159907
const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_SUPER_JOURNAL);
@@ -59789,15 +59915,18 @@
5978959915
** sufficient space (in zSuperPtr) to hold the names of super-journal
5979059916
** files extracted from regular rollback-journals.
5979159917
*/
5979259918
rc = sqlite3OsFileSize(pSuper, &nSuperJournal);
5979359919
if( rc!=SQLITE_OK ) goto delsuper_out;
59794
- nSuperPtr = pVfs->mxPathname+1;
59920
+ nSuperPtr = 1 + (i64)pVfs->mxPathname;
59921
+ assert( nSuperJournal>=0 && nSuperPtr>0 );
5979559922
zFree = sqlite3Malloc(4 + nSuperJournal + nSuperPtr + 2);
5979659923
if( !zFree ){
5979759924
rc = SQLITE_NOMEM_BKPT;
5979859925
goto delsuper_out;
59926
+ }else{
59927
+ assert( nSuperJournal<=0x7fffffff );
5979959928
}
5980059929
zFree[0] = zFree[1] = zFree[2] = zFree[3] = 0;
5980159930
zSuperJournal = &zFree[4];
5980259931
zSuperPtr = &zSuperJournal[nSuperJournal+2];
5980359932
rc = sqlite3OsRead(pSuper, zSuperJournal, (int)nSuperJournal, 0);
@@ -60054,11 +60183,11 @@
6005460183
** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c,
6005560184
** mxPathname is 512, which is the same as the minimum allowable value
6005660185
** for pageSize.
6005760186
*/
6005860187
zSuper = pPager->pTmpSpace;
60059
- rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1);
60188
+ rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname);
6006060189
if( rc==SQLITE_OK && zSuper[0] ){
6006160190
rc = sqlite3OsAccess(pVfs, zSuper, SQLITE_ACCESS_EXISTS, &res);
6006260191
}
6006360192
zSuper = 0;
6006460193
if( rc!=SQLITE_OK || !res ){
@@ -60193,11 +60322,11 @@
6019360322
/* Leave 4 bytes of space before the super-journal filename in memory.
6019460323
** This is because it may end up being passed to sqlite3OsOpen(), in
6019560324
** which case it requires 4 0x00 bytes in memory immediately before
6019660325
** the filename. */
6019760326
zSuper = &pPager->pTmpSpace[4];
60198
- rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1);
60327
+ rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname);
6019960328
testcase( rc!=SQLITE_OK );
6020060329
}
6020160330
if( rc==SQLITE_OK
6020260331
&& (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
6020360332
){
@@ -61963,10 +62092,11 @@
6196362092
int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */
6196462093
int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */
6196562094
u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */
6196662095
const char *zUri = 0; /* URI args to copy */
6196762096
int nUriByte = 1; /* Number of bytes of URI args at *zUri */
62097
+
6196862098
6196962099
/* Figure out how much space is required for each journal file-handle
6197062100
** (there are two of them, the main journal and the sub-journal). */
6197162101
journalFileSize = ROUND8(sqlite3JournalSize(pVfs));
6197262102
@@ -61989,12 +62119,12 @@
6198962119
** to by zPathname, length nPathname. Or, if this is a temporary file,
6199062120
** leave both nPathname and zPathname set to 0.
6199162121
*/
6199262122
if( zFilename && zFilename[0] ){
6199362123
const char *z;
61994
- nPathname = pVfs->mxPathname+1;
61995
- zPathname = sqlite3DbMallocRaw(0, nPathname*2);
62124
+ nPathname = pVfs->mxPathname + 1;
62125
+ zPathname = sqlite3DbMallocRaw(0, 2*(i64)nPathname);
6199662126
if( zPathname==0 ){
6199762127
return SQLITE_NOMEM_BKPT;
6199862128
}
6199962129
zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */
6200062130
rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);
@@ -62077,18 +62207,18 @@
6207762207
assert( SQLITE_PTRSIZE==sizeof(Pager*) );
6207862208
pPtr = (u8 *)sqlite3MallocZero(
6207962209
ROUND8(sizeof(*pPager)) + /* Pager structure */
6208062210
ROUND8(pcacheSize) + /* PCache object */
6208162211
ROUND8(pVfs->szOsFile) + /* The main db file */
62082
- journalFileSize * 2 + /* The two journal files */
62212
+ (u64)journalFileSize * 2 + /* The two journal files */
6208362213
SQLITE_PTRSIZE + /* Space to hold a pointer */
6208462214
4 + /* Database prefix */
62085
- nPathname + 1 + /* database filename */
62086
- nUriByte + /* query parameters */
62087
- nPathname + 8 + 1 + /* Journal filename */
62215
+ (u64)nPathname + 1 + /* database filename */
62216
+ (u64)nUriByte + /* query parameters */
62217
+ (u64)nPathname + 8 + 1 + /* Journal filename */
6208862218
#ifndef SQLITE_OMIT_WAL
62089
- nPathname + 4 + 1 + /* WAL filename */
62219
+ (u64)nPathname + 4 + 1 + /* WAL filename */
6209062220
#endif
6209162221
3 /* Terminator */
6209262222
);
6209362223
assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );
6209462224
if( !pPtr ){
@@ -65790,11 +65920,11 @@
6579065920
){
6579165921
int rc = SQLITE_OK;
6579265922
6579365923
/* Enlarge the pWal->apWiData[] array if required */
6579465924
if( pWal->nWiData<=iPage ){
65795
- sqlite3_int64 nByte = sizeof(u32*)*(iPage+1);
65925
+ sqlite3_int64 nByte = sizeof(u32*)*(1+(i64)iPage);
6579665926
volatile u32 **apNew;
6579765927
apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte);
6579865928
if( !apNew ){
6579965929
*ppPage = 0;
6580065930
return SQLITE_NOMEM_BKPT;
@@ -68023,15 +68153,11 @@
6802368153
** so it takes care to hold an exclusive lock on the corresponding
6802468154
** WAL_READ_LOCK() while changing values.
6802568155
*/
6802668156
static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){
6802768157
volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */
68028
- u32 mxReadMark; /* Largest aReadMark[] value */
68029
- int mxI; /* Index of largest aReadMark[] value */
68030
- int i; /* Loop counter */
6803168158
int rc = SQLITE_OK; /* Return code */
68032
- u32 mxFrame; /* Wal frame to lock to */
6803368159
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
6803468160
int nBlockTmout = 0;
6803568161
#endif
6803668162
6803768163
assert( pWal->readLock<0 ); /* Not currently locked */
@@ -68133,145 +68259,151 @@
6813368259
6813468260
assert( pWal->nWiData>0 );
6813568261
assert( pWal->apWiData[0]!=0 );
6813668262
pInfo = walCkptInfo(pWal);
6813768263
SEH_INJECT_FAULT;
68138
- if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame
68139
-#ifdef SQLITE_ENABLE_SNAPSHOT
68140
- && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0)
68141
-#endif
68142
- ){
68143
- /* The WAL has been completely backfilled (or it is empty).
68144
- ** and can be safely ignored.
68145
- */
68146
- rc = walLockShared(pWal, WAL_READ_LOCK(0));
68147
- walShmBarrier(pWal);
68148
- if( rc==SQLITE_OK ){
68149
- if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){
68150
- /* It is not safe to allow the reader to continue here if frames
68151
- ** may have been appended to the log before READ_LOCK(0) was obtained.
68152
- ** When holding READ_LOCK(0), the reader ignores the entire log file,
68153
- ** which implies that the database file contains a trustworthy
68154
- ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from
68155
- ** happening, this is usually correct.
68156
- **
68157
- ** However, if frames have been appended to the log (or if the log
68158
- ** is wrapped and written for that matter) before the READ_LOCK(0)
68159
- ** is obtained, that is not necessarily true. A checkpointer may
68160
- ** have started to backfill the appended frames but crashed before
68161
- ** it finished. Leaving a corrupt image in the database file.
68162
- */
68163
- walUnlockShared(pWal, WAL_READ_LOCK(0));
68164
- return WAL_RETRY;
68165
- }
68166
- pWal->readLock = 0;
68167
- return SQLITE_OK;
68168
- }else if( rc!=SQLITE_BUSY ){
68169
- return rc;
68170
- }
68171
- }
68172
-
68173
- /* If we get this far, it means that the reader will want to use
68174
- ** the WAL to get at content from recent commits. The job now is
68175
- ** to select one of the aReadMark[] entries that is closest to
68176
- ** but not exceeding pWal->hdr.mxFrame and lock that entry.
68177
- */
68178
- mxReadMark = 0;
68179
- mxI = 0;
68180
- mxFrame = pWal->hdr.mxFrame;
68181
-#ifdef SQLITE_ENABLE_SNAPSHOT
68182
- if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){
68183
- mxFrame = pWal->pSnapshot->mxFrame;
68184
- }
68185
-#endif
68186
- for(i=1; i<WAL_NREADER; i++){
68187
- u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT;
68188
- if( mxReadMark<=thisMark && thisMark<=mxFrame ){
68189
- assert( thisMark!=READMARK_NOT_USED );
68190
- mxReadMark = thisMark;
68191
- mxI = i;
68192
- }
68193
- }
68194
- if( (pWal->readOnly & WAL_SHM_RDONLY)==0
68195
- && (mxReadMark<mxFrame || mxI==0)
68196
- ){
68197
- for(i=1; i<WAL_NREADER; i++){
68198
- rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);
68199
- if( rc==SQLITE_OK ){
68200
- AtomicStore(pInfo->aReadMark+i,mxFrame);
68201
- mxReadMark = mxFrame;
68202
- mxI = i;
68203
- walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
68204
- break;
68205
- }else if( rc!=SQLITE_BUSY ){
68206
- return rc;
68207
- }
68208
- }
68209
- }
68210
- if( mxI==0 ){
68211
- assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 );
68212
- return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT;
68213
- }
68214
-
68215
- (void)walEnableBlockingMs(pWal, nBlockTmout);
68216
- rc = walLockShared(pWal, WAL_READ_LOCK(mxI));
68217
- walDisableBlocking(pWal);
68218
- if( rc ){
68219
-#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
68220
- if( rc==SQLITE_BUSY_TIMEOUT ){
68221
- *pCnt |= WAL_RETRY_BLOCKED_MASK;
68222
- }
68223
-#else
68224
- assert( rc!=SQLITE_BUSY_TIMEOUT );
68225
-#endif
68226
- assert( (rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT );
68227
- return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc;
68228
- }
68229
- /* Now that the read-lock has been obtained, check that neither the
68230
- ** value in the aReadMark[] array or the contents of the wal-index
68231
- ** header have changed.
68232
- **
68233
- ** It is necessary to check that the wal-index header did not change
68234
- ** between the time it was read and when the shared-lock was obtained
68235
- ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility
68236
- ** that the log file may have been wrapped by a writer, or that frames
68237
- ** that occur later in the log than pWal->hdr.mxFrame may have been
68238
- ** copied into the database by a checkpointer. If either of these things
68239
- ** happened, then reading the database with the current value of
68240
- ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry
68241
- ** instead.
68242
- **
68243
- ** Before checking that the live wal-index header has not changed
68244
- ** since it was read, set Wal.minFrame to the first frame in the wal
68245
- ** file that has not yet been checkpointed. This client will not need
68246
- ** to read any frames earlier than minFrame from the wal file - they
68247
- ** can be safely read directly from the database file.
68248
- **
68249
- ** Because a ShmBarrier() call is made between taking the copy of
68250
- ** nBackfill and checking that the wal-header in shared-memory still
68251
- ** matches the one cached in pWal->hdr, it is guaranteed that the
68252
- ** checkpointer that set nBackfill was not working with a wal-index
68253
- ** header newer than that cached in pWal->hdr. If it were, that could
68254
- ** cause a problem. The checkpointer could omit to checkpoint
68255
- ** a version of page X that lies before pWal->minFrame (call that version
68256
- ** A) on the basis that there is a newer version (version B) of the same
68257
- ** page later in the wal file. But if version B happens to like past
68258
- ** frame pWal->hdr.mxFrame - then the client would incorrectly assume
68259
- ** that it can read version A from the database file. However, since
68260
- ** we can guarantee that the checkpointer that set nBackfill could not
68261
- ** see any pages past pWal->hdr.mxFrame, this problem does not come up.
68262
- */
68263
- pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT;
68264
- walShmBarrier(pWal);
68265
- if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark
68266
- || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
68267
- ){
68268
- walUnlockShared(pWal, WAL_READ_LOCK(mxI));
68269
- return WAL_RETRY;
68270
- }else{
68271
- assert( mxReadMark<=pWal->hdr.mxFrame );
68272
- pWal->readLock = (i16)mxI;
68264
+ {
68265
+ u32 mxReadMark; /* Largest aReadMark[] value */
68266
+ int mxI; /* Index of largest aReadMark[] value */
68267
+ int i; /* Loop counter */
68268
+ u32 mxFrame; /* Wal frame to lock to */
68269
+ if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame
68270
+#ifdef SQLITE_ENABLE_SNAPSHOT
68271
+ && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0)
68272
+#endif
68273
+ ){
68274
+ /* The WAL has been completely backfilled (or it is empty).
68275
+ ** and can be safely ignored.
68276
+ */
68277
+ rc = walLockShared(pWal, WAL_READ_LOCK(0));
68278
+ walShmBarrier(pWal);
68279
+ if( rc==SQLITE_OK ){
68280
+ if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr,sizeof(WalIndexHdr)) ){
68281
+ /* It is not safe to allow the reader to continue here if frames
68282
+ ** may have been appended to the log before READ_LOCK(0) was obtained.
68283
+ ** When holding READ_LOCK(0), the reader ignores the entire log file,
68284
+ ** which implies that the database file contains a trustworthy
68285
+ ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from
68286
+ ** happening, this is usually correct.
68287
+ **
68288
+ ** However, if frames have been appended to the log (or if the log
68289
+ ** is wrapped and written for that matter) before the READ_LOCK(0)
68290
+ ** is obtained, that is not necessarily true. A checkpointer may
68291
+ ** have started to backfill the appended frames but crashed before
68292
+ ** it finished. Leaving a corrupt image in the database file.
68293
+ */
68294
+ walUnlockShared(pWal, WAL_READ_LOCK(0));
68295
+ return WAL_RETRY;
68296
+ }
68297
+ pWal->readLock = 0;
68298
+ return SQLITE_OK;
68299
+ }else if( rc!=SQLITE_BUSY ){
68300
+ return rc;
68301
+ }
68302
+ }
68303
+
68304
+ /* If we get this far, it means that the reader will want to use
68305
+ ** the WAL to get at content from recent commits. The job now is
68306
+ ** to select one of the aReadMark[] entries that is closest to
68307
+ ** but not exceeding pWal->hdr.mxFrame and lock that entry.
68308
+ */
68309
+ mxReadMark = 0;
68310
+ mxI = 0;
68311
+ mxFrame = pWal->hdr.mxFrame;
68312
+#ifdef SQLITE_ENABLE_SNAPSHOT
68313
+ if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){
68314
+ mxFrame = pWal->pSnapshot->mxFrame;
68315
+ }
68316
+#endif
68317
+ for(i=1; i<WAL_NREADER; i++){
68318
+ u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT;
68319
+ if( mxReadMark<=thisMark && thisMark<=mxFrame ){
68320
+ assert( thisMark!=READMARK_NOT_USED );
68321
+ mxReadMark = thisMark;
68322
+ mxI = i;
68323
+ }
68324
+ }
68325
+ if( (pWal->readOnly & WAL_SHM_RDONLY)==0
68326
+ && (mxReadMark<mxFrame || mxI==0)
68327
+ ){
68328
+ for(i=1; i<WAL_NREADER; i++){
68329
+ rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);
68330
+ if( rc==SQLITE_OK ){
68331
+ AtomicStore(pInfo->aReadMark+i,mxFrame);
68332
+ mxReadMark = mxFrame;
68333
+ mxI = i;
68334
+ walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
68335
+ break;
68336
+ }else if( rc!=SQLITE_BUSY ){
68337
+ return rc;
68338
+ }
68339
+ }
68340
+ }
68341
+ if( mxI==0 ){
68342
+ assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 );
68343
+ return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT;
68344
+ }
68345
+
68346
+ (void)walEnableBlockingMs(pWal, nBlockTmout);
68347
+ rc = walLockShared(pWal, WAL_READ_LOCK(mxI));
68348
+ walDisableBlocking(pWal);
68349
+ if( rc ){
68350
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
68351
+ if( rc==SQLITE_BUSY_TIMEOUT ){
68352
+ *pCnt |= WAL_RETRY_BLOCKED_MASK;
68353
+ }
68354
+#else
68355
+ assert( rc!=SQLITE_BUSY_TIMEOUT );
68356
+#endif
68357
+ assert((rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT);
68358
+ return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc;
68359
+ }
68360
+ /* Now that the read-lock has been obtained, check that neither the
68361
+ ** value in the aReadMark[] array or the contents of the wal-index
68362
+ ** header have changed.
68363
+ **
68364
+ ** It is necessary to check that the wal-index header did not change
68365
+ ** between the time it was read and when the shared-lock was obtained
68366
+ ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility
68367
+ ** that the log file may have been wrapped by a writer, or that frames
68368
+ ** that occur later in the log than pWal->hdr.mxFrame may have been
68369
+ ** copied into the database by a checkpointer. If either of these things
68370
+ ** happened, then reading the database with the current value of
68371
+ ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry
68372
+ ** instead.
68373
+ **
68374
+ ** Before checking that the live wal-index header has not changed
68375
+ ** since it was read, set Wal.minFrame to the first frame in the wal
68376
+ ** file that has not yet been checkpointed. This client will not need
68377
+ ** to read any frames earlier than minFrame from the wal file - they
68378
+ ** can be safely read directly from the database file.
68379
+ **
68380
+ ** Because a ShmBarrier() call is made between taking the copy of
68381
+ ** nBackfill and checking that the wal-header in shared-memory still
68382
+ ** matches the one cached in pWal->hdr, it is guaranteed that the
68383
+ ** checkpointer that set nBackfill was not working with a wal-index
68384
+ ** header newer than that cached in pWal->hdr. If it were, that could
68385
+ ** cause a problem. The checkpointer could omit to checkpoint
68386
+ ** a version of page X that lies before pWal->minFrame (call that version
68387
+ ** A) on the basis that there is a newer version (version B) of the same
68388
+ ** page later in the wal file. But if version B happens to like past
68389
+ ** frame pWal->hdr.mxFrame - then the client would incorrectly assume
68390
+ ** that it can read version A from the database file. However, since
68391
+ ** we can guarantee that the checkpointer that set nBackfill could not
68392
+ ** see any pages past pWal->hdr.mxFrame, this problem does not come up.
68393
+ */
68394
+ pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT;
68395
+ walShmBarrier(pWal);
68396
+ if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark
68397
+ || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
68398
+ ){
68399
+ walUnlockShared(pWal, WAL_READ_LOCK(mxI));
68400
+ return WAL_RETRY;
68401
+ }else{
68402
+ assert( mxReadMark<=pWal->hdr.mxFrame );
68403
+ pWal->readLock = (i16)mxI;
68404
+ }
6827368405
}
6827468406
return rc;
6827568407
}
6827668408
6827768409
#ifdef SQLITE_ENABLE_SNAPSHOT
@@ -71412,11 +71544,11 @@
7141271544
** up to the size of 1 varint plus 1 8-byte value when the cursor
7141371545
** position is restored. Hence the 17 bytes of padding allocated
7141471546
** below. */
7141571547
void *pKey;
7141671548
pCur->nKey = sqlite3BtreePayloadSize(pCur);
71417
- pKey = sqlite3Malloc( pCur->nKey + 9 + 8 );
71549
+ pKey = sqlite3Malloc( ((i64)pCur->nKey) + 9 + 8 );
7141871550
if( pKey ){
7141971551
rc = sqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey);
7142071552
if( rc==SQLITE_OK ){
7142171553
memset(((u8*)pKey)+pCur->nKey, 0, 9+8);
7142271554
pCur->pKey = pKey;
@@ -76783,11 +76915,11 @@
7678376915
testcase( nCell==2 ); /* Minimum legal index key size */
7678476916
if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){
7678576917
rc = SQLITE_CORRUPT_PAGE(pPage);
7678676918
goto moveto_index_finish;
7678776919
}
76788
- pCellKey = sqlite3Malloc( nCell+nOverrun );
76920
+ pCellKey = sqlite3Malloc( (u64)nCell+(u64)nOverrun );
7678976921
if( pCellKey==0 ){
7679076922
rc = SQLITE_NOMEM_BKPT;
7679176923
goto moveto_index_finish;
7679276924
}
7679376925
pCur->ix = (u16)idx;
@@ -81972,10 +82104,11 @@
8197282104
** blob of allocated memory. The xFree function should not call sqlite3_free()
8197382105
** on the memory, the btree layer does that.
8197482106
*/
8197582107
SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){
8197682108
BtShared *pBt = p->pBt;
82109
+ assert( nBytes==0 || nBytes==sizeof(Schema) );
8197782110
sqlite3BtreeEnter(p);
8197882111
if( !pBt->pSchema && nBytes ){
8197982112
pBt->pSchema = sqlite3DbMallocZero(0, nBytes);
8198082113
pBt->xFreeSchema = xFree;
8198182114
}
@@ -83274,11 +83407,11 @@
8327483407
if( (pMem->flags & (MEM_Str|MEM_Term|MEM_Ephem|MEM_Static))!=MEM_Str ){
8327583408
/* pMem must be a string, and it cannot be an ephemeral or static string */
8327683409
return;
8327783410
}
8327883411
if( pMem->enc!=SQLITE_UTF8 ) return;
83279
- if( NEVER(pMem->z==0) ) return;
83412
+ assert( pMem->z!=0 );
8328083413
if( pMem->flags & MEM_Dyn ){
8328183414
if( pMem->xDel==sqlite3_free
8328283415
&& sqlite3_msize(pMem->z) >= (u64)(pMem->n+1)
8328383416
){
8328483417
pMem->z[pMem->n] = 0;
@@ -83993,31 +84126,34 @@
8399384126
** copies (created by OP_SCopy) are not misused.
8399484127
*/
8399584128
SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
8399684129
int i;
8399784130
Mem *pX;
83998
- for(i=1, pX=pVdbe->aMem+1; i<pVdbe->nMem; i++, pX++){
83999
- if( pX->pScopyFrom==pMem ){
84000
- u16 mFlags;
84001
- if( pVdbe->db->flags & SQLITE_VdbeTrace ){
84002
- sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n",
84003
- (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem));
84004
- }
84005
- /* If pX is marked as a shallow copy of pMem, then try to verify that
84006
- ** no significant changes have been made to pX since the OP_SCopy.
84007
- ** A significant change would indicated a missed call to this
84008
- ** function for pX. Minor changes, such as adding or removing a
84009
- ** dual type, are allowed, as long as the underlying value is the
84010
- ** same. */
84011
- mFlags = pMem->flags & pX->flags & pX->mScopyFlags;
84012
- assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i );
84013
-
84014
- /* pMem is the register that is changing. But also mark pX as
84015
- ** undefined so that we can quickly detect the shallow-copy error */
84016
- pX->flags = MEM_Undefined;
84017
- pX->pScopyFrom = 0;
84018
- }
84131
+ if( pMem->bScopy ){
84132
+ for(i=1, pX=pVdbe->aMem+1; i<pVdbe->nMem; i++, pX++){
84133
+ if( pX->pScopyFrom==pMem ){
84134
+ u16 mFlags;
84135
+ if( pVdbe->db->flags & SQLITE_VdbeTrace ){
84136
+ sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n",
84137
+ (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem));
84138
+ }
84139
+ /* If pX is marked as a shallow copy of pMem, then try to verify that
84140
+ ** no significant changes have been made to pX since the OP_SCopy.
84141
+ ** A significant change would indicated a missed call to this
84142
+ ** function for pX. Minor changes, such as adding or removing a
84143
+ ** dual type, are allowed, as long as the underlying value is the
84144
+ ** same. */
84145
+ mFlags = pMem->flags & pX->flags & pX->mScopyFlags;
84146
+ assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i );
84147
+
84148
+ /* pMem is the register that is changing. But also mark pX as
84149
+ ** undefined so that we can quickly detect the shallow-copy error */
84150
+ pX->flags = MEM_Undefined;
84151
+ pX->pScopyFrom = 0;
84152
+ }
84153
+ }
84154
+ pMem->bScopy = 0;
8401984155
}
8402084156
pMem->pScopyFrom = 0;
8402184157
}
8402284158
#endif /* SQLITE_DEBUG */
8402384159
@@ -84384,11 +84520,11 @@
8438484520
if( p ){
8438584521
UnpackedRecord *pRec = p->ppRec[0];
8438684522
8438784523
if( pRec==0 ){
8438884524
Index *pIdx = p->pIdx; /* Index being probed */
84389
- int nByte; /* Bytes of space to allocate */
84525
+ i64 nByte; /* Bytes of space to allocate */
8439084526
int i; /* Counter variable */
8439184527
int nCol = pIdx->nColumn; /* Number of index columns including rowid */
8439284528
8439384529
nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord));
8439484530
pRec = (UnpackedRecord*)sqlite3DbMallocZero(db, nByte);
@@ -84450,11 +84586,11 @@
8445084586
sqlite3_value **ppVal, /* Write the new value here */
8445184587
struct ValueNewStat4Ctx *pCtx /* Second argument for valueNew() */
8445284588
){
8445384589
sqlite3_context ctx; /* Context object for function invocation */
8445484590
sqlite3_value **apVal = 0; /* Function arguments */
84455
- int nVal = 0; /* Size of apVal[] array */
84591
+ int nVal = 0; /* Number of function arguments */
8445684592
FuncDef *pFunc = 0; /* Function definition */
8445784593
sqlite3_value *pVal = 0; /* New value */
8445884594
int rc = SQLITE_OK; /* Return code */
8445984595
ExprList *pList = 0; /* Function arguments */
8446084596
int i; /* Iterator variable */
@@ -85729,11 +85865,11 @@
8572985865
p->iSub++;
8573085866
p->iAddr = 0;
8573185867
}
8573285868
8573385869
if( pRet->p4type==P4_SUBPROGRAM ){
85734
- int nByte = (p->nSub+1)*sizeof(SubProgram*);
85870
+ i64 nByte = (1+(u64)p->nSub)*sizeof(SubProgram*);
8573585871
int j;
8573685872
for(j=0; j<p->nSub; j++){
8573785873
if( p->apSub[j]==pRet->p4.pProgram ) break;
8573885874
}
8573985875
if( j==p->nSub ){
@@ -85859,12 +85995,12 @@
8585985995
** through all the opcodes and fixes up some details.
8586085996
**
8586185997
** (1) For each jump instruction with a negative P2 value (a label)
8586285998
** resolve the P2 value to an actual address.
8586385999
**
85864
-** (2) Compute the maximum number of arguments used by any SQL function
85865
-** and store that value in *pMaxFuncArgs.
86000
+** (2) Compute the maximum number of arguments used by the xUpdate/xFilter
86001
+** methods of any virtual table and store that value in *pMaxVtabArgs.
8586686002
**
8586786003
** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately
8586886004
** indicate what the prepared statement actually does.
8586986005
**
8587086006
** (4) (discontinued)
@@ -85873,12 +86009,12 @@
8587386009
**
8587486010
** This routine will only function correctly if the mkopcodeh.tcl generator
8587586011
** script numbers the opcodes correctly. Changes to this routine must be
8587686012
** coordinated with changes to mkopcodeh.tcl.
8587786013
*/
85878
-static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
85879
- int nMaxArgs = *pMaxFuncArgs;
86014
+static void resolveP2Values(Vdbe *p, int *pMaxVtabArgs){
86015
+ int nMaxVtabArgs = *pMaxVtabArgs;
8588086016
Op *pOp;
8588186017
Parse *pParse = p->pParse;
8588286018
int *aLabel = pParse->aLabel;
8588386019
8588486020
assert( pParse->db->mallocFailed==0 ); /* tag-20230419-1 */
@@ -85919,19 +86055,23 @@
8591986055
assert( pOp->p2>=0 );
8592086056
goto resolve_p2_values_loop_exit;
8592186057
}
8592286058
#ifndef SQLITE_OMIT_VIRTUALTABLE
8592386059
case OP_VUpdate: {
85924
- if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
86060
+ if( pOp->p2>nMaxVtabArgs ) nMaxVtabArgs = pOp->p2;
8592586061
break;
8592686062
}
8592786063
case OP_VFilter: {
8592886064
int n;
86065
+ /* The instruction immediately prior to VFilter will be an
86066
+ ** OP_Integer that sets the "argc" value for the VFilter. See
86067
+ ** the code where OP_VFilter is generated at tag-20250207a. */
8592986068
assert( (pOp - p->aOp) >= 3 );
8593086069
assert( pOp[-1].opcode==OP_Integer );
86070
+ assert( pOp[-1].p2==pOp->p3+1 );
8593186071
n = pOp[-1].p1;
85932
- if( n>nMaxArgs ) nMaxArgs = n;
86072
+ if( n>nMaxVtabArgs ) nMaxVtabArgs = n;
8593386073
/* Fall through into the default case */
8593486074
/* no break */ deliberate_fall_through
8593586075
}
8593686076
#endif
8593786077
default: {
@@ -85968,11 +86108,11 @@
8596886108
if( aLabel ){
8596986109
sqlite3DbNNFreeNN(p->db, pParse->aLabel);
8597086110
pParse->aLabel = 0;
8597186111
}
8597286112
pParse->nLabel = 0;
85973
- *pMaxFuncArgs = nMaxArgs;
86113
+ *pMaxVtabArgs = nMaxVtabArgs;
8597486114
assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
8597586115
}
8597686116
8597786117
#ifdef SQLITE_DEBUG
8597886118
/*
@@ -86197,11 +86337,11 @@
8619786337
int addrVisit, /* Address of rows visited counter */
8619886338
LogEst nEst, /* Estimated number of output rows */
8619986339
const char *zName /* Name of table or index being scanned */
8620086340
){
8620186341
if( IS_STMT_SCANSTATUS(p->db) ){
86202
- sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
86342
+ i64 nByte = (1+(i64)p->nScan) * sizeof(ScanStatus);
8620386343
ScanStatus *aNew;
8620486344
aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
8620586345
if( aNew ){
8620686346
ScanStatus *pNew = &aNew[p->nScan++];
8620786347
memset(pNew, 0, sizeof(ScanStatus));
@@ -87147,17 +87287,19 @@
8714787287
**
8714887288
** All other fields of Mem can safely remain uninitialized for now. They
8714987289
** will be initialized before use.
8715087290
*/
8715187291
static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
87292
+ assert( db!=0 );
8715287293
if( N>0 ){
8715387294
do{
8715487295
p->flags = flags;
8715587296
p->db = db;
8715687297
p->szMalloc = 0;
8715787298
#ifdef SQLITE_DEBUG
8715887299
p->pScopyFrom = 0;
87300
+ p->bScopy = 0;
8715987301
#endif
8716087302
p++;
8716187303
}while( (--N)>0 );
8716287304
}
8716387305
}
@@ -87172,10 +87314,11 @@
8717287314
*/
8717387315
static void releaseMemArray(Mem *p, int N){
8717487316
if( p && N ){
8717587317
Mem *pEnd = &p[N];
8717687318
sqlite3 *db = p->db;
87319
+ assert( db!=0 );
8717787320
if( db->pnBytesFreed ){
8717887321
do{
8717987322
if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
8718087323
}while( (++p)<pEnd );
8718187324
return;
@@ -87643,19 +87786,20 @@
8764387786
){
8764487787
sqlite3 *db; /* The database connection */
8764587788
int nVar; /* Number of parameters */
8764687789
int nMem; /* Number of VM memory registers */
8764787790
int nCursor; /* Number of cursors required */
87648
- int nArg; /* Number of arguments in subprograms */
87791
+ int nArg; /* Max number args to xFilter or xUpdate */
8764987792
int n; /* Loop counter */
8765087793
struct ReusableSpace x; /* Reusable bulk memory */
8765187794
8765287795
assert( p!=0 );
8765387796
assert( p->nOp>0 );
8765487797
assert( pParse!=0 );
8765587798
assert( p->eVdbeState==VDBE_INIT_STATE );
8765687799
assert( pParse==p->pParse );
87800
+ assert( pParse->db==p->db );
8765787801
p->pVList = pParse->pVList;
8765887802
pParse->pVList = 0;
8765987803
db = p->db;
8766087804
assert( db->mallocFailed==0 );
8766187805
nVar = pParse->nVar;
@@ -87714,10 +87858,13 @@
8771487858
p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem));
8771587859
p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*));
8771687860
p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
8771787861
}
8771887862
}
87863
+#ifdef SQLITE_DEBUG
87864
+ p->napArg = nArg;
87865
+#endif
8771987866
8772087867
if( db->mallocFailed ){
8772187868
p->nVar = 0;
8772287869
p->nCursor = 0;
8772387870
p->nMem = 0;
@@ -89211,10 +89358,11 @@
8921189358
SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
8921289359
KeyInfo *pKeyInfo /* Description of the record */
8921389360
){
8921489361
UnpackedRecord *p; /* Unpacked record to return */
8921589362
int nByte; /* Number of bytes required for *p */
89363
+ assert( sizeof(UnpackedRecord) + sizeof(Mem)*65536 < 0x7fffffff );
8921689364
nByte = ROUND8P(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1);
8921789365
p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
8921889366
if( !p ) return 0;
8921989367
p->aMem = (Mem*)&((char*)p)[ROUND8P(sizeof(UnpackedRecord))];
8922089368
assert( pKeyInfo->aSortFlags!=0 );
@@ -90617,11 +90765,10 @@
9061790765
*/
9061890766
static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){
9061990767
sqlite3_int64 iNow;
9062090768
sqlite3_int64 iElapse;
9062190769
assert( p->startTime>0 );
90622
- assert( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0 );
9062390770
assert( db->init.busy==0 );
9062490771
assert( p->zSql!=0 );
9062590772
sqlite3OsCurrentTimeInt64(db->pVfs, &iNow);
9062690773
iElapse = (iNow - p->startTime)*1000000;
9062790774
#ifndef SQLITE_OMIT_DEPRECATED
@@ -91337,11 +91484,11 @@
9133791484
if( db->nVdbeActive==0 ){
9133891485
AtomicStore(&db->u1.isInterrupted, 0);
9133991486
}
9134091487
9134191488
assert( db->nVdbeWrite>0 || db->autoCommit==0
91342
- || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
91489
+ || ((db->nDeferredCons + db->nDeferredImmCons)==0)
9134391490
);
9134491491
9134591492
#ifndef SQLITE_OMIT_TRACE
9134691493
if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
9134791494
&& !db->init.busy && p->zSql ){
@@ -91848,10 +91995,11 @@
9184891995
/* .zMalloc = */ (char*)0,
9184991996
/* .xDel = */ (void(*)(void*))0,
9185091997
#ifdef SQLITE_DEBUG
9185191998
/* .pScopyFrom = */ (Mem*)0,
9185291999
/* .mScopyFlags= */ 0,
92000
+ /* .bScopy = */ 0,
9185392001
#endif
9185492002
};
9185592003
return &nullMem;
9185692004
}
9185792005
@@ -91889,11 +92037,11 @@
9188992037
**
9189092038
** sqlite3_column_int()
9189192039
** sqlite3_column_int64()
9189292040
** sqlite3_column_text()
9189392041
** sqlite3_column_text16()
91894
-** sqlite3_column_real()
92042
+** sqlite3_column_double()
9189592043
** sqlite3_column_bytes()
9189692044
** sqlite3_column_bytes16()
9189792045
** sqlite3_column_blob()
9189892046
*/
9189992047
static void columnMallocFailure(sqlite3_stmt *pStmt)
@@ -92730,10 +92878,11 @@
9273092878
*/
9273192879
SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
9273292880
PreUpdate *p;
9273392881
Mem *pMem;
9273492882
int rc = SQLITE_OK;
92883
+ int iStore = 0;
9273592884
9273692885
#ifdef SQLITE_ENABLE_API_ARMOR
9273792886
if( db==0 || ppValue==0 ){
9273892887
return SQLITE_MISUSE_BKPT;
9273992888
}
@@ -92744,13 +92893,15 @@
9274492893
if( !p || p->op==SQLITE_INSERT ){
9274592894
rc = SQLITE_MISUSE_BKPT;
9274692895
goto preupdate_old_out;
9274792896
}
9274892897
if( p->pPk ){
92749
- iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx);
92898
+ iStore = sqlite3TableColumnToIndex(p->pPk, iIdx);
92899
+ }else{
92900
+ iStore = sqlite3TableColumnToStorage(p->pTab, iIdx);
9275092901
}
92751
- if( iIdx>=p->pCsr->nField || iIdx<0 ){
92902
+ if( iStore>=p->pCsr->nField || iStore<0 ){
9275292903
rc = SQLITE_RANGE;
9275392904
goto preupdate_old_out;
9275492905
}
9275592906
9275692907
if( iIdx==p->pTab->iPKey ){
@@ -92777,18 +92928,20 @@
9277792928
goto preupdate_old_out;
9277892929
}
9277992930
p->aRecord = aRec;
9278092931
}
9278192932
92782
- pMem = *ppValue = &p->pUnpacked->aMem[iIdx];
92783
- if( iIdx>=p->pUnpacked->nField ){
92933
+ pMem = *ppValue = &p->pUnpacked->aMem[iStore];
92934
+ if( iStore>=p->pUnpacked->nField ){
9278492935
/* This occurs when the table has been extended using ALTER TABLE
9278592936
** ADD COLUMN. The value to return is the default value of the column. */
9278692937
Column *pCol = &p->pTab->aCol[iIdx];
9278792938
if( pCol->iDflt>0 ){
9278892939
if( p->apDflt==0 ){
92789
- int nByte = sizeof(sqlite3_value*)*p->pTab->nCol;
92940
+ int nByte;
92941
+ assert( sizeof(sqlite3_value*)*UMXV(p->pTab->nCol) < 0x7fffffff );
92942
+ nByte = sizeof(sqlite3_value*)*p->pTab->nCol;
9279092943
p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte);
9279192944
if( p->apDflt==0 ) goto preupdate_old_out;
9279292945
}
9279392946
if( p->apDflt[iIdx]==0 ){
9279492947
sqlite3_value *pVal = 0;
@@ -92882,10 +93035,11 @@
9288293035
*/
9288393036
SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
9288493037
PreUpdate *p;
9288593038
int rc = SQLITE_OK;
9288693039
Mem *pMem;
93040
+ int iStore = 0;
9288793041
9288893042
#ifdef SQLITE_ENABLE_API_ARMOR
9288993043
if( db==0 || ppValue==0 ){
9289093044
return SQLITE_MISUSE_BKPT;
9289193045
}
@@ -92894,13 +93048,16 @@
9289493048
if( !p || p->op==SQLITE_DELETE ){
9289593049
rc = SQLITE_MISUSE_BKPT;
9289693050
goto preupdate_new_out;
9289793051
}
9289893052
if( p->pPk && p->op!=SQLITE_UPDATE ){
92899
- iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx);
93053
+ iStore = sqlite3TableColumnToIndex(p->pPk, iIdx);
93054
+ }else{
93055
+ iStore = sqlite3TableColumnToStorage(p->pTab, iIdx);
9290093056
}
92901
- if( iIdx>=p->pCsr->nField || iIdx<0 ){
93057
+
93058
+ if( iStore>=p->pCsr->nField || iStore<0 ){
9290293059
rc = SQLITE_RANGE;
9290393060
goto preupdate_new_out;
9290493061
}
9290593062
9290693063
if( p->op==SQLITE_INSERT ){
@@ -92916,37 +93073,38 @@
9291693073
rc = SQLITE_NOMEM;
9291793074
goto preupdate_new_out;
9291893075
}
9291993076
p->pNewUnpacked = pUnpack;
9292093077
}
92921
- pMem = &pUnpack->aMem[iIdx];
93078
+ pMem = &pUnpack->aMem[iStore];
9292293079
if( iIdx==p->pTab->iPKey ){
9292393080
sqlite3VdbeMemSetInt64(pMem, p->iKey2);
92924
- }else if( iIdx>=pUnpack->nField ){
93081
+ }else if( iStore>=pUnpack->nField ){
9292593082
pMem = (sqlite3_value *)columnNullValue();
9292693083
}
9292793084
}else{
92928
- /* For an UPDATE, memory cell (p->iNewReg+1+iIdx) contains the required
93085
+ /* For an UPDATE, memory cell (p->iNewReg+1+iStore) contains the required
9292993086
** value. Make a copy of the cell contents and return a pointer to it.
9293093087
** It is not safe to return a pointer to the memory cell itself as the
9293193088
** caller may modify the value text encoding.
9293293089
*/
9293393090
assert( p->op==SQLITE_UPDATE );
9293493091
if( !p->aNew ){
92935
- p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField);
93092
+ assert( sizeof(Mem)*UMXV(p->pCsr->nField) < 0x7fffffff );
93093
+ p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem)*p->pCsr->nField);
9293693094
if( !p->aNew ){
9293793095
rc = SQLITE_NOMEM;
9293893096
goto preupdate_new_out;
9293993097
}
9294093098
}
92941
- assert( iIdx>=0 && iIdx<p->pCsr->nField );
92942
- pMem = &p->aNew[iIdx];
93099
+ assert( iStore>=0 && iStore<p->pCsr->nField );
93100
+ pMem = &p->aNew[iStore];
9294393101
if( pMem->flags==0 ){
9294493102
if( iIdx==p->pTab->iPKey ){
9294593103
sqlite3VdbeMemSetInt64(pMem, p->iKey2);
9294693104
}else{
92947
- rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iIdx]);
93105
+ rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iStore]);
9294893106
if( rc!=SQLITE_OK ) goto preupdate_new_out;
9294993107
}
9295093108
}
9295193109
}
9295293110
*ppValue = pMem;
@@ -93700,11 +93858,11 @@
9370093858
** the top of the register space. Cursor 1 is at Mem[p->nMem-1].
9370193859
** Cursor 2 is at Mem[p->nMem-2]. And so forth.
9370293860
*/
9370393861
Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem;
9370493862
93705
- int nByte;
93863
+ i64 nByte;
9370693864
VdbeCursor *pCx = 0;
9370793865
nByte =
9370893866
ROUND8P(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField +
9370993867
(eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0);
9371093868
@@ -93728,11 +93886,11 @@
9372893886
pMem->z = pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, nByte);
9372993887
if( pMem->zMalloc==0 ){
9373093888
pMem->szMalloc = 0;
9373193889
return 0;
9373293890
}
93733
- pMem->szMalloc = nByte;
93891
+ pMem->szMalloc = (int)nByte;
9373493892
}
9373593893
9373693894
p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc;
9373793895
memset(pCx, 0, offsetof(VdbeCursor,pAltCursor));
9373893896
pCx->eCurType = eCurType;
@@ -94031,10 +94189,11 @@
9403194189
}
9403294190
static void registerTrace(int iReg, Mem *p){
9403394191
printf("R[%d] = ", iReg);
9403494192
memTracePrint(p);
9403594193
if( p->pScopyFrom ){
94194
+ assert( p->pScopyFrom->bScopy );
9403694195
printf(" <== R[%d]", (int)(p->pScopyFrom - &p[-iReg]));
9403794196
}
9403894197
printf("\n");
9403994198
sqlite3VdbeCheckMemInvariants(p);
9404094199
}
@@ -95014,10 +95173,11 @@
9501495173
#ifdef SQLITE_DEBUG
9501595174
pIn1->pScopyFrom = 0;
9501695175
{ int i;
9501795176
for(i=1; i<p->nMem; i++){
9501895177
if( aMem[i].pScopyFrom==pIn1 ){
95178
+ assert( aMem[i].bScopy );
9501995179
aMem[i].pScopyFrom = pOut;
9502095180
}
9502195181
}
9502295182
}
9502395183
#endif
@@ -95086,10 +95246,11 @@
9508695246
assert( pOut!=pIn1 );
9508795247
sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
9508895248
#ifdef SQLITE_DEBUG
9508995249
pOut->pScopyFrom = pIn1;
9509095250
pOut->mScopyFlags = pIn1->flags;
95251
+ pIn1->bScopy = 1;
9509195252
#endif
9509295253
break;
9509395254
}
9509495255
9509595256
/* Opcode: IntCopy P1 P2 * * *
@@ -100746,11 +100907,11 @@
100746100907
**
100747100908
** If P5 is non-zero, then recursive program invocation is enabled.
100748100909
*/
100749100910
case OP_Program: { /* jump0 */
100750100911
int nMem; /* Number of memory registers for sub-program */
100751
- int nByte; /* Bytes of runtime space required for sub-program */
100912
+ i64 nByte; /* Bytes of runtime space required for sub-program */
100752100913
Mem *pRt; /* Register to allocate runtime space */
100753100914
Mem *pMem; /* Used to iterate through memory cells */
100754100915
Mem *pEnd; /* Last memory cell in new array */
100755100916
VdbeFrame *pFrame; /* New vdbe frame to execute in */
100756100917
SubProgram *pProgram; /* Sub-program to execute */
@@ -100797,19 +100958,19 @@
100797100958
assert( nMem>0 );
100798100959
if( pProgram->nCsr==0 ) nMem++;
100799100960
nByte = ROUND8(sizeof(VdbeFrame))
100800100961
+ nMem * sizeof(Mem)
100801100962
+ pProgram->nCsr * sizeof(VdbeCursor*)
100802
- + (pProgram->nOp + 7)/8;
100963
+ + (7 + (i64)pProgram->nOp)/8;
100803100964
pFrame = sqlite3DbMallocZero(db, nByte);
100804100965
if( !pFrame ){
100805100966
goto no_mem;
100806100967
}
100807100968
sqlite3VdbeMemRelease(pRt);
100808100969
pRt->flags = MEM_Blob|MEM_Dyn;
100809100970
pRt->z = (char*)pFrame;
100810
- pRt->n = nByte;
100971
+ pRt->n = (int)nByte;
100811100972
pRt->xDel = sqlite3VdbeFrameMemDel;
100812100973
100813100974
pFrame->v = p;
100814100975
pFrame->nChildMem = nMem;
100815100976
pFrame->nChildCsr = pProgram->nCsr;
@@ -100904,16 +101065,18 @@
100904101065
** If P1 is non-zero, the database constraint counter is incremented
100905101066
** (deferred foreign key constraints). Otherwise, if P1 is zero, the
100906101067
** statement counter is incremented (immediate foreign key constraints).
100907101068
*/
100908101069
case OP_FkCounter: {
100909
- if( db->flags & SQLITE_DeferFKs ){
100910
- db->nDeferredImmCons += pOp->p2;
100911
- }else if( pOp->p1 ){
101070
+ if( pOp->p1 ){
100912101071
db->nDeferredCons += pOp->p2;
100913101072
}else{
100914
- p->nFkConstraint += pOp->p2;
101073
+ if( db->flags & SQLITE_DeferFKs ){
101074
+ db->nDeferredImmCons += pOp->p2;
101075
+ }else{
101076
+ p->nFkConstraint += pOp->p2;
101077
+ }
100915101078
}
100916101079
break;
100917101080
}
100918101081
100919101082
/* Opcode: FkIfZero P1 P2 * * *
@@ -101784,10 +101947,11 @@
101784101947
nArg = (int)pArgc->u.i;
101785101948
iQuery = (int)pQuery->u.i;
101786101949
101787101950
/* Invoke the xFilter method */
101788101951
apArg = p->apArg;
101952
+ assert( nArg<=p->napArg );
101789101953
for(i = 0; i<nArg; i++){
101790101954
apArg[i] = &pArgc[i+1];
101791101955
}
101792101956
rc = pModule->xFilter(pVCur, iQuery, pOp->p4.z, nArg, apArg);
101793101957
sqlite3VtabImportErrmsg(p, pVtab);
@@ -101994,10 +102158,11 @@
101994102158
assert( pOp->p4type==P4_VTAB );
101995102159
if( ALWAYS(pModule->xUpdate) ){
101996102160
u8 vtabOnConflict = db->vtabOnConflict;
101997102161
apArg = p->apArg;
101998102162
pX = &aMem[pOp->p3];
102163
+ assert( nArg<=p->napArg );
101999102164
for(i=0; i<nArg; i++){
102000102165
assert( memIsValid(pX) );
102001102166
memAboutToChange(p, pX);
102002102167
apArg[i] = pX;
102003102168
pX++;
@@ -102839,16 +103004,12 @@
102839103004
}
102840103005
pBlob->pTab = pTab;
102841103006
pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName;
102842103007
102843103008
/* Now search pTab for the exact column. */
102844
- for(iCol=0; iCol<pTab->nCol; iCol++) {
102845
- if( sqlite3StrICmp(pTab->aCol[iCol].zCnName, zColumn)==0 ){
102846
- break;
102847
- }
102848
- }
102849
- if( iCol==pTab->nCol ){
103009
+ iCol = sqlite3ColumnIndex(pTab, zColumn);
103010
+ if( iCol<0 ){
102850103011
sqlite3DbFree(db, zErr);
102851103012
zErr = sqlite3MPrintf(db, "no such column: \"%s\"", zColumn);
102852103013
rc = SQLITE_ERROR;
102853103014
sqlite3BtreeLeaveAll(db);
102854103015
goto blob_open_out;
@@ -104106,11 +104267,11 @@
104106104267
int pgsz; /* Page size of main database */
104107104268
int i; /* Used to iterate through aTask[] */
104108104269
VdbeSorter *pSorter; /* The new sorter */
104109104270
KeyInfo *pKeyInfo; /* Copy of pCsr->pKeyInfo with db==0 */
104110104271
int szKeyInfo; /* Size of pCsr->pKeyInfo in bytes */
104111
- int sz; /* Size of pSorter in bytes */
104272
+ i64 sz; /* Size of pSorter in bytes */
104112104273
int rc = SQLITE_OK;
104113104274
#if SQLITE_MAX_WORKER_THREADS==0
104114104275
# define nWorker 0
104115104276
#else
104116104277
int nWorker;
@@ -104134,10 +104295,12 @@
104134104295
#endif
104135104296
104136104297
assert( pCsr->pKeyInfo );
104137104298
assert( !pCsr->isEphemeral );
104138104299
assert( pCsr->eCurType==CURTYPE_SORTER );
104300
+ assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*)
104301
+ < 0x7fffffff );
104139104302
szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*);
104140104303
sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
104141104304
104142104305
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
104143104306
pCsr->uc.pSorter = pSorter;
@@ -104347,11 +104510,11 @@
104347104510
** nReader is automatically rounded up to the next power of two.
104348104511
** nReader may not exceed SORTER_MAX_MERGE_COUNT even after rounding up.
104349104512
*/
104350104513
static MergeEngine *vdbeMergeEngineNew(int nReader){
104351104514
int N = 2; /* Smallest power of two >= nReader */
104352
- int nByte; /* Total bytes of space to allocate */
104515
+ i64 nByte; /* Total bytes of space to allocate */
104353104516
MergeEngine *pNew; /* Pointer to allocated object to return */
104354104517
104355104518
assert( nReader<=SORTER_MAX_MERGE_COUNT );
104356104519
104357104520
while( N<nReader ) N += N;
@@ -107390,11 +107553,10 @@
107390107553
SrcItem *pMatch = 0; /* The matching pSrcList item */
107391107554
NameContext *pTopNC = pNC; /* First namecontext in the list */
107392107555
Schema *pSchema = 0; /* Schema of the expression */
107393107556
int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
107394107557
Table *pTab = 0; /* Table holding the row */
107395
- Column *pCol; /* A column of pTab */
107396107558
ExprList *pFJMatch = 0; /* Matches for FULL JOIN .. USING */
107397107559
const char *zCol = pRight->u.zToken;
107398107560
107399107561
assert( pNC ); /* the name context cannot be NULL. */
107400107562
assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
@@ -107441,11 +107603,10 @@
107441107603
ExprList *pEList;
107442107604
SrcList *pSrcList = pNC->pSrcList;
107443107605
107444107606
if( pSrcList ){
107445107607
for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){
107446
- u8 hCol;
107447107608
pTab = pItem->pSTab;
107448107609
assert( pTab!=0 && pTab->zName!=0 );
107449107610
assert( pTab->nCol>0 || pParse->nErr );
107450107611
assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem));
107451107612
if( pItem->fg.isNestedFrom ){
@@ -107529,47 +107690,42 @@
107529107690
assert( ExprUseYTab(pExpr) );
107530107691
if( IN_RENAME_OBJECT && pItem->zAlias ){
107531107692
sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->y.pTab);
107532107693
}
107533107694
}
107534
- hCol = sqlite3StrIHash(zCol);
107535
- for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
107536
- if( pCol->hName==hCol
107537
- && sqlite3StrICmp(pCol->zCnName, zCol)==0
107538
- ){
107539
- if( cnt>0 ){
107540
- if( pItem->fg.isUsing==0
107541
- || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0
107542
- ){
107543
- /* Two or more tables have the same column name which is
107544
- ** not joined by USING. This is an error. Signal as much
107545
- ** by clearing pFJMatch and letting cnt go above 1. */
107546
- sqlite3ExprListDelete(db, pFJMatch);
107547
- pFJMatch = 0;
107548
- }else
107549
- if( (pItem->fg.jointype & JT_RIGHT)==0 ){
107550
- /* An INNER or LEFT JOIN. Use the left-most table */
107551
- continue;
107552
- }else
107553
- if( (pItem->fg.jointype & JT_LEFT)==0 ){
107554
- /* A RIGHT JOIN. Use the right-most table */
107555
- cnt = 0;
107556
- sqlite3ExprListDelete(db, pFJMatch);
107557
- pFJMatch = 0;
107558
- }else{
107559
- /* For a FULL JOIN, we must construct a coalesce() func */
107560
- extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn);
107561
- }
107562
- }
107563
- cnt++;
107564
- pMatch = pItem;
107565
- /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
107566
- pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
107567
- if( pItem->fg.isNestedFrom ){
107568
- sqlite3SrcItemColumnUsed(pItem, j);
107569
- }
107570
- break;
107695
+ j = sqlite3ColumnIndex(pTab, zCol);
107696
+ if( j>=0 ){
107697
+ if( cnt>0 ){
107698
+ if( pItem->fg.isUsing==0
107699
+ || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0
107700
+ ){
107701
+ /* Two or more tables have the same column name which is
107702
+ ** not joined by USING. This is an error. Signal as much
107703
+ ** by clearing pFJMatch and letting cnt go above 1. */
107704
+ sqlite3ExprListDelete(db, pFJMatch);
107705
+ pFJMatch = 0;
107706
+ }else
107707
+ if( (pItem->fg.jointype & JT_RIGHT)==0 ){
107708
+ /* An INNER or LEFT JOIN. Use the left-most table */
107709
+ continue;
107710
+ }else
107711
+ if( (pItem->fg.jointype & JT_LEFT)==0 ){
107712
+ /* A RIGHT JOIN. Use the right-most table */
107713
+ cnt = 0;
107714
+ sqlite3ExprListDelete(db, pFJMatch);
107715
+ pFJMatch = 0;
107716
+ }else{
107717
+ /* For a FULL JOIN, we must construct a coalesce() func */
107718
+ extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn);
107719
+ }
107720
+ }
107721
+ cnt++;
107722
+ pMatch = pItem;
107723
+ /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
107724
+ pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
107725
+ if( pItem->fg.isNestedFrom ){
107726
+ sqlite3SrcItemColumnUsed(pItem, j);
107571107727
}
107572107728
}
107573107729
if( 0==cnt && VisibleRowid(pTab) ){
107574107730
/* pTab is a potential ROWID match. Keep track of it and match
107575107731
** the ROWID later if that seems appropriate. (Search for "cntTab"
@@ -107655,26 +107811,21 @@
107655107811
}
107656107812
#endif /* SQLITE_OMIT_UPSERT */
107657107813
107658107814
if( pTab ){
107659107815
int iCol;
107660
- u8 hCol = sqlite3StrIHash(zCol);
107661107816
pSchema = pTab->pSchema;
107662107817
cntTab++;
107663
- for(iCol=0, pCol=pTab->aCol; iCol<pTab->nCol; iCol++, pCol++){
107664
- if( pCol->hName==hCol
107665
- && sqlite3StrICmp(pCol->zCnName, zCol)==0
107666
- ){
107667
- if( iCol==pTab->iPKey ){
107668
- iCol = -1;
107669
- }
107670
- break;
107671
- }
107672
- }
107673
- if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
107674
- /* IMP: R-51414-32910 */
107675
- iCol = -1;
107818
+ iCol = sqlite3ColumnIndex(pTab, zCol);
107819
+ if( iCol>=0 ){
107820
+ if( pTab->iPKey==iCol ) iCol = -1;
107821
+ }else{
107822
+ if( sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
107823
+ iCol = -1;
107824
+ }else{
107825
+ iCol = pTab->nCol;
107826
+ }
107676107827
}
107677107828
if( iCol<pTab->nCol ){
107678107829
cnt++;
107679107830
pMatch = 0;
107680107831
#ifndef SQLITE_OMIT_UPSERT
@@ -109896,11 +110047,11 @@
109896110047
p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);
109897110048
}
109898110049
p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
109899110050
addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
109900110051
(void*)p4, P4_COLLSEQ);
109901
- sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);
110052
+ sqlite3VdbeChangeP5(pParse->pVdbe, (u16)p5);
109902110053
return addr;
109903110054
}
109904110055
109905110056
/*
109906110057
** Return true if expression pExpr is a vector, or false otherwise.
@@ -111266,11 +111417,10 @@
111266111417
pNewExpr->pLeft = pPriorSelectColNew;
111267111418
}
111268111419
}
111269111420
pItem->zEName = sqlite3DbStrDup(db, pOldItem->zEName);
111270111421
pItem->fg = pOldItem->fg;
111271
- pItem->fg.done = 0;
111272111422
pItem->u = pOldItem->u;
111273111423
}
111274111424
return pNew;
111275111425
}
111276111426
@@ -111349,20 +111499,17 @@
111349111499
SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, const IdList *p){
111350111500
IdList *pNew;
111351111501
int i;
111352111502
assert( db!=0 );
111353111503
if( p==0 ) return 0;
111354
- assert( p->eU4!=EU4_EXPR );
111355111504
pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew)+(p->nId-1)*sizeof(p->a[0]) );
111356111505
if( pNew==0 ) return 0;
111357111506
pNew->nId = p->nId;
111358
- pNew->eU4 = p->eU4;
111359111507
for(i=0; i<p->nId; i++){
111360111508
struct IdList_item *pNewItem = &pNew->a[i];
111361111509
const struct IdList_item *pOldItem = &p->a[i];
111362111510
pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
111363
- pNewItem->u4 = pOldItem->u4;
111364111511
}
111365111512
return pNew;
111366111513
}
111367111514
SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, const Select *pDup, int flags){
111368111515
Select *pRet = 0;
@@ -112386,17 +112533,11 @@
112386112533
SQLITE_PRIVATE const char *sqlite3RowidAlias(Table *pTab){
112387112534
const char *azOpt[] = {"_ROWID_", "ROWID", "OID"};
112388112535
int ii;
112389112536
assert( VisibleRowid(pTab) );
112390112537
for(ii=0; ii<ArraySize(azOpt); ii++){
112391
- int iCol;
112392
- for(iCol=0; iCol<pTab->nCol; iCol++){
112393
- if( sqlite3_stricmp(azOpt[ii], pTab->aCol[iCol].zCnName)==0 ) break;
112394
- }
112395
- if( iCol==pTab->nCol ){
112396
- return azOpt[ii];
112397
- }
112538
+ if( sqlite3ColumnIndex(pTab, azOpt[ii])<0 ) return azOpt[ii];
112398112539
}
112399112540
return 0;
112400112541
}
112401112542
112402112543
/*
@@ -112702,10 +112843,11 @@
112702112843
if( mCol & colUsed ) break; /* Each column used only once */
112703112844
colUsed |= mCol;
112704112845
if( aiMap ) aiMap[i] = j;
112705112846
}
112706112847
112848
+ assert( nExpr>0 && nExpr<BMS );
112707112849
assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );
112708112850
if( colUsed==(MASKBIT(nExpr)-1) ){
112709112851
/* If we reach this point, that means the index pIdx is usable */
112710112852
int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
112711112853
ExplainQueryPlan((pParse, 0,
@@ -112795,11 +112937,11 @@
112795112937
int nVal = sqlite3ExprVectorSize(pLeft);
112796112938
Select *pSelect = ExprUseXSelect(pExpr) ? pExpr->x.pSelect : 0;
112797112939
char *zRet;
112798112940
112799112941
assert( pExpr->op==TK_IN );
112800
- zRet = sqlite3DbMallocRaw(pParse->db, nVal+1);
112942
+ zRet = sqlite3DbMallocRaw(pParse->db, 1+(i64)nVal);
112801112943
if( zRet ){
112802112944
int i;
112803112945
for(i=0; i<nVal; i++){
112804112946
Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i);
112805112947
char a = sqlite3ExprAffinity(pA);
@@ -112881,10 +113023,11 @@
112881113023
for(; pOp<pEnd; pOp++){
112882113024
if( pOp->p4type!=P4_SUBRTNSIG ) continue;
112883113025
assert( pOp->opcode==OP_BeginSubrtn );
112884113026
pSig = pOp->p4.pSubrtnSig;
112885113027
assert( pSig!=0 );
113028
+ if( !pSig->bComplete ) continue;
112886113029
if( pNewSig->selId!=pSig->selId ) continue;
112887113030
if( strcmp(pNewSig->zAff,pSig->zAff)!=0 ) continue;
112888113031
pExpr->y.sub.iAddr = pSig->iAddr;
112889113032
pExpr->y.sub.regReturn = pSig->regReturn;
112890113033
pExpr->iTable = pSig->iTable;
@@ -112927,10 +113070,11 @@
112927113070
int addr; /* Address of OP_OpenEphemeral instruction */
112928113071
Expr *pLeft; /* the LHS of the IN operator */
112929113072
KeyInfo *pKeyInfo = 0; /* Key information */
112930113073
int nVal; /* Size of vector pLeft */
112931113074
Vdbe *v; /* The prepared statement under construction */
113075
+ SubrtnSig *pSig = 0; /* Signature for this subroutine */
112932113076
112933113077
v = pParse->pVdbe;
112934113078
assert( v!=0 );
112935113079
112936113080
/* The evaluation of the IN must be repeated every time it
@@ -112947,11 +113091,10 @@
112947113091
/* Reuse of the RHS is allowed
112948113092
**
112949113093
** Compute a signature for the RHS of the IN operator to facility
112950113094
** finding and reusing prior instances of the same IN operator.
112951113095
*/
112952
- SubrtnSig *pSig = 0;
112953113096
assert( !ExprUseXSelect(pExpr) || pExpr->x.pSelect!=0 );
112954113097
if( ExprUseXSelect(pExpr) && (pExpr->x.pSelect->selFlags & SF_All)==0 ){
112955113098
pSig = sqlite3DbMallocRawNN(pParse->db, sizeof(pSig[0]));
112956113099
if( pSig ){
112957113100
pSig->selId = pExpr->x.pSelect->selId;
@@ -112990,10 +113133,11 @@
112990113133
assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
112991113134
pExpr->y.sub.regReturn = ++pParse->nMem;
112992113135
pExpr->y.sub.iAddr =
112993113136
sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1;
112994113137
if( pSig ){
113138
+ pSig->bComplete = 0;
112995113139
pSig->iAddr = pExpr->y.sub.iAddr;
112996113140
pSig->regReturn = pExpr->y.sub.regReturn;
112997113141
pSig->iTable = iTab;
112998113142
pParse->mSubrtnSig = 1 << (pSig->selId&7);
112999113143
sqlite3VdbeChangeP4(v, -1, (const char*)pSig, P4_SUBRTNSIG);
@@ -113125,10 +113269,11 @@
113125113269
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r1, 1);
113126113270
}
113127113271
sqlite3ReleaseTempReg(pParse, r1);
113128113272
sqlite3ReleaseTempReg(pParse, r2);
113129113273
}
113274
+ if( pSig ) pSig->bComplete = 1;
113130113275
if( pKeyInfo ){
113131113276
sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO);
113132113277
}
113133113278
if( addrOnce ){
113134113279
sqlite3VdbeAddOp1(v, OP_NullRow, iTab);
@@ -117437,14 +117582,12 @@
117437117582
117438117583
/* Make sure the old name really is a column name in the table to be
117439117584
** altered. Set iCol to be the index of the column being renamed */
117440117585
zOld = sqlite3NameFromToken(db, pOld);
117441117586
if( !zOld ) goto exit_rename_column;
117442
- for(iCol=0; iCol<pTab->nCol; iCol++){
117443
- if( 0==sqlite3StrICmp(pTab->aCol[iCol].zCnName, zOld) ) break;
117444
- }
117445
- if( iCol==pTab->nCol ){
117587
+ iCol = sqlite3ColumnIndex(pTab, zOld);
117588
+ if( iCol<0 ){
117446117589
sqlite3ErrorMsg(pParse, "no such column: \"%T\"", pOld);
117447117590
goto exit_rename_column;
117448117591
}
117449117592
117450117593
/* Ensure the schema contains no double-quoted strings */
@@ -119339,11 +119482,12 @@
119339119482
** of the new table in register pParse->regRoot. This is important
119340119483
** because the OpenWrite opcode below will be needing it. */
119341119484
sqlite3NestedParse(pParse,
119342119485
"CREATE TABLE %Q.%s(%s)", pDb->zDbSName, zTab, aTable[i].zCols
119343119486
);
119344
- aRoot[i] = (u32)pParse->regRoot;
119487
+ assert( pParse->isCreate || pParse->nErr );
119488
+ aRoot[i] = (u32)pParse->u1.cr.regRoot;
119345119489
aCreateTbl[i] = OPFLAG_P2ISREG;
119346119490
}
119347119491
}else{
119348119492
/* The table already exists. If zWhere is not NULL, delete all entries
119349119493
** associated with the table zWhere. If zWhere is NULL, delete the
@@ -119530,11 +119674,11 @@
119530119674
){
119531119675
StatAccum *p;
119532119676
int nCol; /* Number of columns in index being sampled */
119533119677
int nKeyCol; /* Number of key columns */
119534119678
int nColUp; /* nCol rounded up for alignment */
119535
- int n; /* Bytes of space to allocate */
119679
+ i64 n; /* Bytes of space to allocate */
119536119680
sqlite3 *db = sqlite3_context_db_handle(context); /* Database connection */
119537119681
#ifdef SQLITE_ENABLE_STAT4
119538119682
/* Maximum number of samples. 0 if STAT4 data is not collected */
119539119683
int mxSample = OptimizationEnabled(db,SQLITE_Stat4) ?SQLITE_STAT4_SAMPLES :0;
119540119684
#endif
@@ -121304,11 +121448,11 @@
121304121448
if( db->aDb==db->aDbStatic ){
121305121449
aNew = sqlite3DbMallocRawNN(db, sizeof(db->aDb[0])*3 );
121306121450
if( aNew==0 ) return;
121307121451
memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2);
121308121452
}else{
121309
- aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) );
121453
+ aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(1+(i64)db->nDb));
121310121454
if( aNew==0 ) return;
121311121455
}
121312121456
db->aDb = aNew;
121313121457
pNew = &db->aDb[db->nDb];
121314121458
memset(pNew, 0, sizeof(*pNew));
@@ -121322,10 +121466,16 @@
121322121466
if( rc!=SQLITE_OK ){
121323121467
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
121324121468
sqlite3_result_error(context, zErr, -1);
121325121469
sqlite3_free(zErr);
121326121470
return;
121471
+ }
121472
+ if( (db->flags & SQLITE_AttachWrite)==0 ){
121473
+ flags &= ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE);
121474
+ flags |= SQLITE_OPEN_READONLY;
121475
+ }else if( (db->flags & SQLITE_AttachCreate)==0 ){
121476
+ flags &= ~SQLITE_OPEN_CREATE;
121327121477
}
121328121478
assert( pVfs );
121329121479
flags |= SQLITE_OPEN_MAIN_DB;
121330121480
rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags);
121331121481
db->nDb++;
@@ -122091,10 +122241,11 @@
122091122241
p->isWriteLock = (p->isWriteLock || isWriteLock);
122092122242
return;
122093122243
}
122094122244
}
122095122245
122246
+ assert( pToplevel->nTableLock < 0x7fff0000 );
122096122247
nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1);
122097122248
pToplevel->aTableLock =
122098122249
sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes);
122099122250
if( pToplevel->aTableLock ){
122100122251
p = &pToplevel->aTableLock[pToplevel->nTableLock++];
@@ -122191,14 +122342,16 @@
122191122342
}
122192122343
assert( !pParse->isMultiWrite
122193122344
|| sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
122194122345
if( v ){
122195122346
if( pParse->bReturning ){
122196
- Returning *pReturning = pParse->u1.pReturning;
122347
+ Returning *pReturning;
122197122348
int addrRewind;
122198122349
int reg;
122199122350
122351
+ assert( !pParse->isCreate );
122352
+ pReturning = pParse->u1.d.pReturning;
122200122353
if( pReturning->nRetCol ){
122201122354
sqlite3VdbeAddOp0(v, OP_FkCheck);
122202122355
addrRewind =
122203122356
sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
122204122357
VdbeCoverage(v);
@@ -122270,11 +122423,13 @@
122270122423
sqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg);
122271122424
}
122272122425
}
122273122426
122274122427
if( pParse->bReturning ){
122275
- Returning *pRet = pParse->u1.pReturning;
122428
+ Returning *pRet;
122429
+ assert( !pParse->isCreate );
122430
+ pRet = pParse->u1.d.pReturning;
122276122431
if( pRet->nRetCol ){
122277122432
sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol);
122278122433
}
122279122434
}
122280122435
@@ -123342,12 +123497,13 @@
123342123497
#endif
123343123498
123344123499
/* If the file format and encoding in the database have not been set,
123345123500
** set them now.
123346123501
*/
123347
- reg1 = pParse->regRowid = ++pParse->nMem;
123348
- reg2 = pParse->regRoot = ++pParse->nMem;
123502
+ assert( pParse->isCreate );
123503
+ reg1 = pParse->u1.cr.regRowid = ++pParse->nMem;
123504
+ reg2 = pParse->u1.cr.regRoot = ++pParse->nMem;
123349123505
reg3 = ++pParse->nMem;
123350123506
sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT);
123351123507
sqlite3VdbeUsesBtree(v, iDb);
123352123508
addr1 = sqlite3VdbeAddOp1(v, OP_If, reg3); VdbeCoverage(v);
123353123509
fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ?
@@ -123358,12 +123514,12 @@
123358123514
123359123515
/* This just creates a place-holder record in the sqlite_schema table.
123360123516
** The record created does not contain anything yet. It will be replaced
123361123517
** by the real entry in code generated at sqlite3EndTable().
123362123518
**
123363
- ** The rowid for the new entry is left in register pParse->regRowid.
123364
- ** The root page number of the new table is left in reg pParse->regRoot.
123519
+ ** The rowid for the new entry is left in register pParse->u1.cr.regRowid.
123520
+ ** The root page of the new table is left in reg pParse->u1.cr.regRoot.
123365123521
** The rowid and root page number values are needed by the code that
123366123522
** sqlite3EndTable will generate.
123367123523
*/
123368123524
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
123369123525
if( isView || isVirtual ){
@@ -123370,11 +123526,11 @@
123370123526
sqlite3VdbeAddOp2(v, OP_Integer, 0, reg2);
123371123527
}else
123372123528
#endif
123373123529
{
123374123530
assert( !pParse->bReturning );
123375
- pParse->u1.addrCrTab =
123531
+ pParse->u1.cr.addrCrTab =
123376123532
sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, reg2, BTREE_INTKEY);
123377123533
}
123378123534
sqlite3OpenSchemaTable(pParse, iDb);
123379123535
sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1);
123380123536
sqlite3VdbeAddOp4(v, OP_Blob, 6, reg3, 0, nullRow, P4_STATIC);
@@ -123448,11 +123604,12 @@
123448123604
pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
123449123605
if( pRet==0 ){
123450123606
sqlite3ExprListDelete(db, pList);
123451123607
return;
123452123608
}
123453
- pParse->u1.pReturning = pRet;
123609
+ assert( !pParse->isCreate );
123610
+ pParse->u1.d.pReturning = pRet;
123454123611
pRet->pParse = pParse;
123455123612
pRet->pReturnEL = pList;
123456123613
sqlite3ParserAddCleanup(pParse, sqlite3DeleteReturning, pRet);
123457123614
testcase( pParse->earlyCleanup );
123458123615
if( db->mallocFailed ) return;
@@ -123490,11 +123647,10 @@
123490123647
int i;
123491123648
char *z;
123492123649
char *zType;
123493123650
Column *pCol;
123494123651
sqlite3 *db = pParse->db;
123495
- u8 hName;
123496123652
Column *aNew;
123497123653
u8 eType = COLTYPE_CUSTOM;
123498123654
u8 szEst = 1;
123499123655
char affinity = SQLITE_AFF_BLOB;
123500123656
@@ -123544,17 +123700,14 @@
123544123700
if( z==0 ) return;
123545123701
if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, &sName);
123546123702
memcpy(z, sName.z, sName.n);
123547123703
z[sName.n] = 0;
123548123704
sqlite3Dequote(z);
123549
- hName = sqlite3StrIHash(z);
123550
- for(i=0; i<p->nCol; i++){
123551
- if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zCnName)==0 ){
123552
- sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
123553
- sqlite3DbFree(db, z);
123554
- return;
123555
- }
123705
+ if( p->nCol && sqlite3ColumnIndex(p, z)>=0 ){
123706
+ sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
123707
+ sqlite3DbFree(db, z);
123708
+ return;
123556123709
}
123557123710
aNew = sqlite3DbRealloc(db,p->aCol,((i64)p->nCol+1)*sizeof(p->aCol[0]));
123558123711
if( aNew==0 ){
123559123712
sqlite3DbFree(db, z);
123560123713
return;
@@ -123561,11 +123714,11 @@
123561123714
}
123562123715
p->aCol = aNew;
123563123716
pCol = &p->aCol[p->nCol];
123564123717
memset(pCol, 0, sizeof(p->aCol[0]));
123565123718
pCol->zCnName = z;
123566
- pCol->hName = hName;
123719
+ pCol->hName = sqlite3StrIHash(z);
123567123720
sqlite3ColumnPropertiesFromName(p, pCol);
123568123721
123569123722
if( sType.n==0 ){
123570123723
/* If there is no type specified, columns have the default affinity
123571123724
** 'BLOB' with a default size of 4 bytes. */
@@ -123585,13 +123738,18 @@
123585123738
zType[sType.n] = 0;
123586123739
sqlite3Dequote(zType);
123587123740
pCol->affinity = sqlite3AffinityType(zType, pCol);
123588123741
pCol->colFlags |= COLFLAG_HASTYPE;
123589123742
}
123743
+ if( p->nCol<=0xff ){
123744
+ u8 h = pCol->hName % sizeof(p->aHx);
123745
+ p->aHx[h] = p->nCol;
123746
+ }
123590123747
p->nCol++;
123591123748
p->nNVCol++;
123592
- pParse->constraintName.n = 0;
123749
+ assert( pParse->isCreate );
123750
+ pParse->u1.cr.constraintName.n = 0;
123593123751
}
123594123752
123595123753
/*
123596123754
** This routine is called by the parser while in the middle of
123597123755
** parsing a CREATE TABLE statement. A "NOT NULL" constraint has
@@ -123851,19 +124009,15 @@
123851124009
for(i=0; i<nTerm; i++){
123852124010
Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr);
123853124011
assert( pCExpr!=0 );
123854124012
sqlite3StringToId(pCExpr);
123855124013
if( pCExpr->op==TK_ID ){
123856
- const char *zCName;
123857124014
assert( !ExprHasProperty(pCExpr, EP_IntValue) );
123858
- zCName = pCExpr->u.zToken;
123859
- for(iCol=0; iCol<pTab->nCol; iCol++){
123860
- if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zCnName)==0 ){
123861
- pCol = &pTab->aCol[iCol];
123862
- makeColumnPartOfPrimaryKey(pParse, pCol);
123863
- break;
123864
- }
124015
+ iCol = sqlite3ColumnIndex(pTab, pCExpr->u.zToken);
124016
+ if( iCol>=0 ){
124017
+ pCol = &pTab->aCol[iCol];
124018
+ makeColumnPartOfPrimaryKey(pParse, pCol);
123865124019
}
123866124020
}
123867124021
}
123868124022
}
123869124023
if( nTerm==1
@@ -123911,12 +124065,14 @@
123911124065
sqlite3 *db = pParse->db;
123912124066
if( pTab && !IN_DECLARE_VTAB
123913124067
&& !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
123914124068
){
123915124069
pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
123916
- if( pParse->constraintName.n ){
123917
- sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
124070
+ assert( pParse->isCreate );
124071
+ if( pParse->u1.cr.constraintName.n ){
124072
+ sqlite3ExprListSetName(pParse, pTab->pCheck,
124073
+ &pParse->u1.cr.constraintName, 1);
123918124074
}else{
123919124075
Token t;
123920124076
for(zStart++; sqlite3Isspace(zStart[0]); zStart++){}
123921124077
while( sqlite3Isspace(zEnd[-1]) ){ zEnd--; }
123922124078
t.z = zStart;
@@ -124107,11 +124263,12 @@
124107124263
** Generate a CREATE TABLE statement appropriate for the given
124108124264
** table. Memory to hold the text of the statement is obtained
124109124265
** from sqliteMalloc() and must be freed by the calling function.
124110124266
*/
124111124267
static char *createTableStmt(sqlite3 *db, Table *p){
124112
- int i, k, n;
124268
+ int i, k, len;
124269
+ i64 n;
124113124270
char *zStmt;
124114124271
char *zSep, *zSep2, *zEnd;
124115124272
Column *pCol;
124116124273
n = 0;
124117124274
for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){
@@ -124131,12 +124288,13 @@
124131124288
zStmt = sqlite3DbMallocRaw(0, n);
124132124289
if( zStmt==0 ){
124133124290
sqlite3OomFault(db);
124134124291
return 0;
124135124292
}
124136
- sqlite3_snprintf(n, zStmt, "CREATE TABLE ");
124137
- k = sqlite3Strlen30(zStmt);
124293
+ assert( n>14 && n<=0x7fffffff );
124294
+ memcpy(zStmt, "CREATE TABLE ", 13);
124295
+ k = 13;
124138124296
identPut(zStmt, &k, p->zName);
124139124297
zStmt[k++] = '(';
124140124298
for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
124141124299
static const char * const azType[] = {
124142124300
/* SQLITE_AFF_BLOB */ "",
@@ -124144,17 +124302,19 @@
124144124302
/* SQLITE_AFF_NUMERIC */ " NUM",
124145124303
/* SQLITE_AFF_INTEGER */ " INT",
124146124304
/* SQLITE_AFF_REAL */ " REAL",
124147124305
/* SQLITE_AFF_FLEXNUM */ " NUM",
124148124306
};
124149
- int len;
124150124307
const char *zType;
124151124308
124152
- sqlite3_snprintf(n-k, &zStmt[k], zSep);
124153
- k += sqlite3Strlen30(&zStmt[k]);
124309
+ len = sqlite3Strlen30(zSep);
124310
+ assert( k+len<n );
124311
+ memcpy(&zStmt[k], zSep, len);
124312
+ k += len;
124154124313
zSep = zSep2;
124155124314
identPut(zStmt, &k, pCol->zCnName);
124315
+ assert( k<n );
124156124316
assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 );
124157124317
assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) );
124158124318
testcase( pCol->affinity==SQLITE_AFF_BLOB );
124159124319
testcase( pCol->affinity==SQLITE_AFF_TEXT );
124160124320
testcase( pCol->affinity==SQLITE_AFF_NUMERIC );
@@ -124165,15 +124325,18 @@
124165124325
zType = azType[pCol->affinity - SQLITE_AFF_BLOB];
124166124326
len = sqlite3Strlen30(zType);
124167124327
assert( pCol->affinity==SQLITE_AFF_BLOB
124168124328
|| pCol->affinity==SQLITE_AFF_FLEXNUM
124169124329
|| pCol->affinity==sqlite3AffinityType(zType, 0) );
124330
+ assert( k+len<n );
124170124331
memcpy(&zStmt[k], zType, len);
124171124332
k += len;
124172124333
assert( k<=n );
124173124334
}
124174
- sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd);
124335
+ len = sqlite3Strlen30(zEnd);
124336
+ assert( k+len<n );
124337
+ memcpy(&zStmt[k], zEnd, len+1);
124175124338
return zStmt;
124176124339
}
124177124340
124178124341
/*
124179124342
** Resize an Index object to hold N columns total. Return SQLITE_OK
@@ -124362,13 +124525,13 @@
124362124525
124363124526
/* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY
124364124527
** into BTREE_BLOBKEY.
124365124528
*/
124366124529
assert( !pParse->bReturning );
124367
- if( pParse->u1.addrCrTab ){
124530
+ if( pParse->u1.cr.addrCrTab ){
124368124531
assert( v );
124369
- sqlite3VdbeChangeP3(v, pParse->u1.addrCrTab, BTREE_BLOBKEY);
124532
+ sqlite3VdbeChangeP3(v, pParse->u1.cr.addrCrTab, BTREE_BLOBKEY);
124370124533
}
124371124534
124372124535
/* Locate the PRIMARY KEY index. Or, if this table was originally
124373124536
** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index.
124374124537
*/
@@ -124804,11 +124967,11 @@
124804124967
#endif
124805124968
}
124806124969
124807124970
/* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT
124808124971
** statement to populate the new table. The root-page number for the
124809
- ** new table is in register pParse->regRoot.
124972
+ ** new table is in register pParse->u1.cr.regRoot.
124810124973
**
124811124974
** Once the SELECT has been coded by sqlite3Select(), it is in a
124812124975
** suitable state to query for the column names and types to be used
124813124976
** by the new table.
124814124977
**
@@ -124835,11 +124998,12 @@
124835124998
iCsr = pParse->nTab++;
124836124999
regYield = ++pParse->nMem;
124837125000
regRec = ++pParse->nMem;
124838125001
regRowid = ++pParse->nMem;
124839125002
sqlite3MayAbort(pParse);
124840
- sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->regRoot, iDb);
125003
+ assert( pParse->isCreate );
125004
+ sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->u1.cr.regRoot, iDb);
124841125005
sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG);
124842125006
addrTop = sqlite3VdbeCurrentAddr(v) + 1;
124843125007
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
124844125008
if( pParse->nErr ) return;
124845125009
pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB);
@@ -124880,21 +125044,22 @@
124880125044
124881125045
/* A slot for the record has already been allocated in the
124882125046
** schema table. We just need to update that slot with all
124883125047
** the information we've collected.
124884125048
*/
125049
+ assert( pParse->isCreate );
124885125050
sqlite3NestedParse(pParse,
124886125051
"UPDATE %Q." LEGACY_SCHEMA_TABLE
124887125052
" SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q"
124888125053
" WHERE rowid=#%d",
124889125054
db->aDb[iDb].zDbSName,
124890125055
zType,
124891125056
p->zName,
124892125057
p->zName,
124893
- pParse->regRoot,
125058
+ pParse->u1.cr.regRoot,
124894125059
zStmt,
124895
- pParse->regRowid
125060
+ pParse->u1.cr.regRowid
124896125061
);
124897125062
sqlite3DbFree(db, zStmt);
124898125063
sqlite3ChangeCookie(pParse, iDb);
124899125064
124900125065
#ifndef SQLITE_OMIT_AUTOINCREMENT
@@ -125861,11 +126026,11 @@
125861126026
i16 nCol, /* Total number of columns in the index */
125862126027
int nExtra, /* Number of bytes of extra space to alloc */
125863126028
char **ppExtra /* Pointer to the "extra" space */
125864126029
){
125865126030
Index *p; /* Allocated index object */
125866
- int nByte; /* Bytes of space for Index object + arrays */
126031
+ i64 nByte; /* Bytes of space for Index object + arrays */
125867126032
125868126033
nByte = ROUND8(sizeof(Index)) + /* Index structure */
125869126034
ROUND8(sizeof(char*)*nCol) + /* Index.azColl */
125870126035
ROUND8(sizeof(LogEst)*(nCol+1) + /* Index.aiRowLogEst */
125871126036
sizeof(i16)*nCol + /* Index.aiColumn */
@@ -126714,11 +126879,10 @@
126714126879
*/
126715126880
SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){
126716126881
int i;
126717126882
assert( db!=0 );
126718126883
if( pList==0 ) return;
126719
- assert( pList->eU4!=EU4_EXPR ); /* EU4_EXPR mode is not currently used */
126720126884
for(i=0; i<pList->nId; i++){
126721126885
sqlite3DbFree(db, pList->a[i].zName);
126722126886
}
126723126887
sqlite3DbNNFreeNN(db, pList);
126724126888
}
@@ -128095,16 +128259,22 @@
128095128259
FuncDef *p, /* The function we are evaluating for match quality */
128096128260
int nArg, /* Desired number of arguments. (-1)==any */
128097128261
u8 enc /* Desired text encoding */
128098128262
){
128099128263
int match;
128100
- assert( p->nArg>=-1 );
128264
+ assert( p->nArg>=(-4) && p->nArg!=(-2) );
128265
+ assert( nArg>=(-2) );
128101128266
128102128267
/* Wrong number of arguments means "no match" */
128103128268
if( p->nArg!=nArg ){
128104
- if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH;
128269
+ if( nArg==(-2) ) return p->xSFunc==0 ? 0 : FUNC_PERFECT_MATCH;
128105128270
if( p->nArg>=0 ) return 0;
128271
+ /* Special p->nArg values available to built-in functions only:
128272
+ ** -3 1 or more arguments required
128273
+ ** -4 2 or more arguments required
128274
+ */
128275
+ if( p->nArg<(-2) && nArg<(-2-p->nArg) ) return 0;
128106128276
}
128107128277
128108128278
/* Give a better score to a function with a specific number of arguments
128109128279
** than to function that accepts any number of arguments. */
128110128280
if( p->nArg==nArg ){
@@ -129723,20 +129893,14 @@
129723129893
const unsigned char *z;
129724129894
const unsigned char *z2;
129725129895
int len;
129726129896
int p0type;
129727129897
i64 p1, p2;
129728
- int negP2 = 0;
129729129898
129730129899
assert( argc==3 || argc==2 );
129731
- if( sqlite3_value_type(argv[1])==SQLITE_NULL
129732
- || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL)
129733
- ){
129734
- return;
129735
- }
129736129900
p0type = sqlite3_value_type(argv[0]);
129737
- p1 = sqlite3_value_int(argv[1]);
129901
+ p1 = sqlite3_value_int64(argv[1]);
129738129902
if( p0type==SQLITE_BLOB ){
129739129903
len = sqlite3_value_bytes(argv[0]);
129740129904
z = sqlite3_value_blob(argv[0]);
129741129905
if( z==0 ) return;
129742129906
assert( len==sqlite3_value_bytes(argv[0]) );
@@ -129748,45 +129912,49 @@
129748129912
for(z2=z; *z2; len++){
129749129913
SQLITE_SKIP_UTF8(z2);
129750129914
}
129751129915
}
129752129916
}
129753
-#ifdef SQLITE_SUBSTR_COMPATIBILITY
129754
- /* If SUBSTR_COMPATIBILITY is defined then substr(X,0,N) work the same as
129755
- ** as substr(X,1,N) - it returns the first N characters of X. This
129756
- ** is essentially a back-out of the bug-fix in check-in [5fc125d362df4b8]
129757
- ** from 2009-02-02 for compatibility of applications that exploited the
129758
- ** old buggy behavior. */
129759
- if( p1==0 ) p1 = 1; /* <rdar://problem/6778339> */
129760
-#endif
129761129917
if( argc==3 ){
129762
- p2 = sqlite3_value_int(argv[2]);
129763
- if( p2<0 ){
129764
- p2 = -p2;
129765
- negP2 = 1;
129766
- }
129918
+ p2 = sqlite3_value_int64(argv[2]);
129919
+ if( p2==0 && sqlite3_value_type(argv[2])==SQLITE_NULL ) return;
129767129920
}else{
129768129921
p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH];
129769129922
}
129923
+ if( p1==0 ){
129924
+#ifdef SQLITE_SUBSTR_COMPATIBILITY
129925
+ /* If SUBSTR_COMPATIBILITY is defined then substr(X,0,N) work the same as
129926
+ ** as substr(X,1,N) - it returns the first N characters of X. This
129927
+ ** is essentially a back-out of the bug-fix in check-in [5fc125d362df4b8]
129928
+ ** from 2009-02-02 for compatibility of applications that exploited the
129929
+ ** old buggy behavior. */
129930
+ p1 = 1; /* <rdar://problem/6778339> */
129931
+#endif
129932
+ if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return;
129933
+ }
129770129934
if( p1<0 ){
129771129935
p1 += len;
129772129936
if( p1<0 ){
129773
- p2 += p1;
129774
- if( p2<0 ) p2 = 0;
129937
+ if( p2<0 ){
129938
+ p2 = 0;
129939
+ }else{
129940
+ p2 += p1;
129941
+ }
129775129942
p1 = 0;
129776129943
}
129777129944
}else if( p1>0 ){
129778129945
p1--;
129779129946
}else if( p2>0 ){
129780129947
p2--;
129781129948
}
129782
- if( negP2 ){
129949
+ if( p2<0 ){
129950
+ if( p2<-p1 ){
129951
+ p2 = p1;
129952
+ }else{
129953
+ p2 = -p2;
129954
+ }
129783129955
p1 -= p2;
129784
- if( p1<0 ){
129785
- p2 += p1;
129786
- p1 = 0;
129787
- }
129788129956
}
129789129957
assert( p1>=0 && p2>=0 );
129790129958
if( p0type!=SQLITE_BLOB ){
129791129959
while( *z && p1 ){
129792129960
SQLITE_SKIP_UTF8(z);
@@ -129796,13 +129964,15 @@
129796129964
SQLITE_SKIP_UTF8(z2);
129797129965
}
129798129966
sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT,
129799129967
SQLITE_UTF8);
129800129968
}else{
129801
- if( p1+p2>len ){
129969
+ if( p1>=len ){
129970
+ p1 = p2 = 0;
129971
+ }else if( p2>len-p1 ){
129802129972
p2 = len-p1;
129803
- if( p2<0 ) p2 = 0;
129973
+ assert( p2>0 );
129804129974
}
129805129975
sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT);
129806129976
}
129807129977
}
129808129978
@@ -129809,17 +129979,17 @@
129809129979
/*
129810129980
** Implementation of the round() function
129811129981
*/
129812129982
#ifndef SQLITE_OMIT_FLOATING_POINT
129813129983
static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
129814
- int n = 0;
129984
+ i64 n = 0;
129815129985
double r;
129816129986
char *zBuf;
129817129987
assert( argc==1 || argc==2 );
129818129988
if( argc==2 ){
129819129989
if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
129820
- n = sqlite3_value_int(argv[1]);
129990
+ n = sqlite3_value_int64(argv[1]);
129821129991
if( n>30 ) n = 30;
129822129992
if( n<0 ) n = 0;
129823129993
}
129824129994
if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
129825129995
r = sqlite3_value_double(argv[0]);
@@ -129830,11 +130000,11 @@
129830130000
if( r<-4503599627370496.0 || r>+4503599627370496.0 ){
129831130001
/* The value has no fractional part so there is nothing to round */
129832130002
}else if( n==0 ){
129833130003
r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5)));
129834130004
}else{
129835
- zBuf = sqlite3_mprintf("%!.*f",n,r);
130005
+ zBuf = sqlite3_mprintf("%!.*f",(int)n,r);
129836130006
if( zBuf==0 ){
129837130007
sqlite3_result_error_nomem(context);
129838130008
return;
129839130009
}
129840130010
sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);
@@ -130789,11 +130959,11 @@
130789130959
if( zRep==0 ) return;
130790130960
nRep = sqlite3_value_bytes(argv[2]);
130791130961
assert( zRep==sqlite3_value_text(argv[2]) );
130792130962
nOut = nStr + 1;
130793130963
assert( nOut<SQLITE_MAX_LENGTH );
130794
- zOut = contextMalloc(context, (i64)nOut);
130964
+ zOut = contextMalloc(context, nOut);
130795130965
if( zOut==0 ){
130796130966
return;
130797130967
}
130798130968
loopLimit = nStr - nPattern;
130799130969
cntExpand = 0;
@@ -130939,11 +131109,11 @@
130939131109
int i;
130940131110
char *z;
130941131111
for(i=0; i<argc; i++){
130942131112
n += sqlite3_value_bytes(argv[i]);
130943131113
}
130944
- n += (argc-1)*nSep;
131114
+ n += (argc-1)*(i64)nSep;
130945131115
z = sqlite3_malloc64(n+1);
130946131116
if( z==0 ){
130947131117
sqlite3_result_error_nomem(context);
130948131118
return;
130949131119
}
@@ -131237,11 +131407,14 @@
131237131407
** to initialize it */
131238131408
if( ALWAYS(p) && type!=SQLITE_NULL ){
131239131409
assert( p->cnt>0 );
131240131410
p->cnt--;
131241131411
if( !p->approx ){
131242
- p->iSum -= sqlite3_value_int64(argv[0]);
131412
+ if( sqlite3SubInt64(&p->iSum, sqlite3_value_int64(argv[0])) ){
131413
+ p->ovrfl = 1;
131414
+ p->approx = 1;
131415
+ }
131243131416
}else if( type==SQLITE_INTEGER ){
131244131417
i64 iVal = sqlite3_value_int64(argv[0]);
131245131418
if( iVal!=SMALLEST_INT64 ){
131246131419
kahanBabuskaNeumaierStepInt64(p, -iVal);
131247131420
}else{
@@ -132063,16 +132236,14 @@
132063132236
FUNCTION(ltrim, 2, 1, 0, trimFunc ),
132064132237
FUNCTION(rtrim, 1, 2, 0, trimFunc ),
132065132238
FUNCTION(rtrim, 2, 2, 0, trimFunc ),
132066132239
FUNCTION(trim, 1, 3, 0, trimFunc ),
132067132240
FUNCTION(trim, 2, 3, 0, trimFunc ),
132068
- FUNCTION(min, -1, 0, 1, minmaxFunc ),
132069
- FUNCTION(min, 0, 0, 1, 0 ),
132241
+ FUNCTION(min, -3, 0, 1, minmaxFunc ),
132070132242
WAGGREGATE(min, 1, 0, 1, minmaxStep, minMaxFinalize, minMaxValue, 0,
132071132243
SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ),
132072
- FUNCTION(max, -1, 1, 1, minmaxFunc ),
132073
- FUNCTION(max, 0, 1, 1, 0 ),
132244
+ FUNCTION(max, -3, 1, 1, minmaxFunc ),
132074132245
WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0,
132075132246
SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ),
132076132247
FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF),
132077132248
FUNCTION2(subtype, 1, 0, 0, subtypeFunc,
132078132249
SQLITE_FUNC_TYPEOF|SQLITE_SUBTYPE),
@@ -132095,15 +132266,12 @@
132095132266
FUNCTION(upper, 1, 0, 0, upperFunc ),
132096132267
FUNCTION(lower, 1, 0, 0, lowerFunc ),
132097132268
FUNCTION(hex, 1, 0, 0, hexFunc ),
132098132269
FUNCTION(unhex, 1, 0, 0, unhexFunc ),
132099132270
FUNCTION(unhex, 2, 0, 0, unhexFunc ),
132100
- FUNCTION(concat, -1, 0, 0, concatFunc ),
132101
- FUNCTION(concat, 0, 0, 0, 0 ),
132102
- FUNCTION(concat_ws, -1, 0, 0, concatwsFunc ),
132103
- FUNCTION(concat_ws, 0, 0, 0, 0 ),
132104
- FUNCTION(concat_ws, 1, 0, 0, 0 ),
132271
+ FUNCTION(concat, -3, 0, 0, concatFunc ),
132272
+ FUNCTION(concat_ws, -4, 0, 0, concatwsFunc ),
132105132273
INLINE_FUNC(ifnull, 2, INLINEFUNC_coalesce, 0 ),
132106132274
VFUNCTION(random, 0, 0, 0, randomFunc ),
132107132275
VFUNCTION(randomblob, 1, 0, 0, randomBlob ),
132108132276
FUNCTION(nullif, 2, 0, 1, nullifFunc ),
132109132277
DFUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
@@ -132143,12 +132311,10 @@
132143132311
LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),
132144132312
#endif
132145132313
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
132146132314
FUNCTION(unknown, -1, 0, 0, unknownFunc ),
132147132315
#endif
132148
- FUNCTION(coalesce, 1, 0, 0, 0 ),
132149
- FUNCTION(coalesce, 0, 0, 0, 0 ),
132150132316
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
132151132317
MFUNCTION(ceil, 1, xCeil, ceilingFunc ),
132152132318
MFUNCTION(ceiling, 1, xCeil, ceilingFunc ),
132153132319
MFUNCTION(floor, 1, xFloor, ceilingFunc ),
132154132320
#if SQLITE_HAVE_C99_MATH_FUNCS
@@ -132182,15 +132348,13 @@
132182132348
MFUNCTION(radians, 1, degToRad, math1Func ),
132183132349
MFUNCTION(degrees, 1, radToDeg, math1Func ),
132184132350
MFUNCTION(pi, 0, 0, piFunc ),
132185132351
#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
132186132352
FUNCTION(sign, 1, 0, 0, signFunc ),
132187
- INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
132188
- INLINE_FUNC(iif, 2, INLINEFUNC_iif, 0 ),
132189
- INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
132190
- INLINE_FUNC(if, 2, INLINEFUNC_iif, 0 ),
132191
- INLINE_FUNC(if, 3, INLINEFUNC_iif, 0 ),
132353
+ INLINE_FUNC(coalesce, -4, INLINEFUNC_coalesce, 0 ),
132354
+ INLINE_FUNC(iif, -4, INLINEFUNC_iif, 0 ),
132355
+ INLINE_FUNC(if, -4, INLINEFUNC_iif, 0 ),
132192132356
};
132193132357
#ifndef SQLITE_OMIT_ALTERTABLE
132194132358
sqlite3AlterFunctions();
132195132359
#endif
132196132360
sqlite3WindowFunctions();
@@ -134632,10 +134796,11 @@
134632134796
int regRowCount = 0; /* Memory cell used for the row counter */
134633134797
int regIns; /* Block of regs holding rowid+data being inserted */
134634134798
int regRowid; /* registers holding insert rowid */
134635134799
int regData; /* register holding first column to insert */
134636134800
int *aRegIdx = 0; /* One register allocated to each index */
134801
+ int *aTabColMap = 0; /* Mapping from pTab columns to pCol entries */
134637134802
134638134803
#ifndef SQLITE_OMIT_TRIGGER
134639134804
int isView; /* True if attempting to insert into a view */
134640134805
Trigger *pTrigger; /* List of triggers on pTab, if required */
134641134806
int tmask; /* Mask of trigger times */
@@ -134776,35 +134941,29 @@
134776134941
** columns into storage order. False negatives are harmless,
134777134942
** but false positives will cause database corruption.
134778134943
*/
134779134944
bIdListInOrder = (pTab->tabFlags & (TF_OOOHidden|TF_HasStored))==0;
134780134945
if( pColumn ){
134781
- assert( pColumn->eU4!=EU4_EXPR );
134782
- pColumn->eU4 = EU4_IDX;
134783
- for(i=0; i<pColumn->nId; i++){
134784
- pColumn->a[i].u4.idx = -1;
134785
- }
134786
- for(i=0; i<pColumn->nId; i++){
134787
- for(j=0; j<pTab->nCol; j++){
134788
- if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zCnName)==0 ){
134789
- pColumn->a[i].u4.idx = j;
134790
- if( i!=j ) bIdListInOrder = 0;
134791
- if( j==pTab->iPKey ){
134792
- ipkColumn = i; assert( !withoutRowid );
134793
- }
134794
-#ifndef SQLITE_OMIT_GENERATED_COLUMNS
134795
- if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){
134796
- sqlite3ErrorMsg(pParse,
134797
- "cannot INSERT into generated column \"%s\"",
134798
- pTab->aCol[j].zCnName);
134799
- goto insert_cleanup;
134800
- }
134801
-#endif
134802
- break;
134803
- }
134804
- }
134805
- if( j>=pTab->nCol ){
134946
+ aTabColMap = sqlite3DbMallocZero(db, pTab->nCol*sizeof(int));
134947
+ if( aTabColMap==0 ) goto insert_cleanup;
134948
+ for(i=0; i<pColumn->nId; i++){
134949
+ j = sqlite3ColumnIndex(pTab, pColumn->a[i].zName);
134950
+ if( j>=0 ){
134951
+ if( aTabColMap[j]==0 ) aTabColMap[j] = i+1;
134952
+ if( i!=j ) bIdListInOrder = 0;
134953
+ if( j==pTab->iPKey ){
134954
+ ipkColumn = i; assert( !withoutRowid );
134955
+ }
134956
+#ifndef SQLITE_OMIT_GENERATED_COLUMNS
134957
+ if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){
134958
+ sqlite3ErrorMsg(pParse,
134959
+ "cannot INSERT into generated column \"%s\"",
134960
+ pTab->aCol[j].zCnName);
134961
+ goto insert_cleanup;
134962
+ }
134963
+#endif
134964
+ }else{
134806134965
if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){
134807134966
ipkColumn = i;
134808134967
bIdListInOrder = 0;
134809134968
}else{
134810134969
sqlite3ErrorMsg(pParse, "table %S has no column named %s",
@@ -135098,29 +135257,29 @@
135098135257
sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore);
135099135258
}
135100135259
continue;
135101135260
}else if( pColumn==0 ){
135102135261
/* Hidden columns that are not explicitly named in the INSERT
135103
- ** get there default value */
135262
+ ** get their default value */
135104135263
sqlite3ExprCodeFactorable(pParse,
135105135264
sqlite3ColumnExpr(pTab, &pTab->aCol[i]),
135106135265
iRegStore);
135107135266
continue;
135108135267
}
135109135268
}
135110135269
if( pColumn ){
135111
- assert( pColumn->eU4==EU4_IDX );
135112
- for(j=0; j<pColumn->nId && pColumn->a[j].u4.idx!=i; j++){}
135113
- if( j>=pColumn->nId ){
135270
+ j = aTabColMap[i];
135271
+ assert( j>=0 && j<=pColumn->nId );
135272
+ if( j==0 ){
135114135273
/* A column not named in the insert column list gets its
135115135274
** default value */
135116135275
sqlite3ExprCodeFactorable(pParse,
135117135276
sqlite3ColumnExpr(pTab, &pTab->aCol[i]),
135118135277
iRegStore);
135119135278
continue;
135120135279
}
135121
- k = j;
135280
+ k = j - 1;
135122135281
}else if( nColumn==0 ){
135123135282
/* This is INSERT INTO ... DEFAULT VALUES. Load the default value. */
135124135283
sqlite3ExprCodeFactorable(pParse,
135125135284
sqlite3ColumnExpr(pTab, &pTab->aCol[i]),
135126135285
iRegStore);
@@ -135361,11 +135520,14 @@
135361135520
insert_cleanup:
135362135521
sqlite3SrcListDelete(db, pTabList);
135363135522
sqlite3ExprListDelete(db, pList);
135364135523
sqlite3UpsertDelete(db, pUpsert);
135365135524
sqlite3SelectDelete(db, pSelect);
135366
- sqlite3IdListDelete(db, pColumn);
135525
+ if( pColumn ){
135526
+ sqlite3IdListDelete(db, pColumn);
135527
+ sqlite3DbFree(db, aTabColMap);
135528
+ }
135367135529
if( aRegIdx ) sqlite3DbNNFreeNN(db, aRegIdx);
135368135530
}
135369135531
135370135532
/* Make sure "isView" and other macros defined above are undefined. Otherwise
135371135533
** they may interfere with compilation of other functions in this file
@@ -140708,11 +140870,14 @@
140708140870
){
140709140871
db->flags |= mask;
140710140872
}
140711140873
}else{
140712140874
db->flags &= ~mask;
140713
- if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0;
140875
+ if( mask==SQLITE_DeferFKs ){
140876
+ db->nDeferredImmCons = 0;
140877
+ db->nDeferredCons = 0;
140878
+ }
140714140879
if( (mask & SQLITE_WriteSchema)!=0
140715140880
&& sqlite3_stricmp(zRight, "reset")==0
140716140881
){
140717140882
/* IMP: R-60817-01178 If the argument is "RESET" then schema
140718140883
** writing is disabled (as with "PRAGMA writable_schema=OFF") and,
@@ -141316,11 +141481,11 @@
141316141481
sqlite3VdbeAddOp3(v, OP_Null, 0, 8, 8+cnt);
141317141482
sqlite3ClearTempRegCache(pParse);
141318141483
141319141484
/* Do the b-tree integrity checks */
141320141485
sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY);
141321
- sqlite3VdbeChangeP5(v, (u8)i);
141486
+ sqlite3VdbeChangeP5(v, (u16)i);
141322141487
addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v);
141323141488
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
141324141489
sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName),
141325141490
P4_DYNAMIC);
141326141491
sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3);
@@ -144042,14 +144207,37 @@
144042144207
** Return the index of a column in a table. Return -1 if the column
144043144208
** is not contained in the table.
144044144209
*/
144045144210
SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol){
144046144211
int i;
144047
- u8 h = sqlite3StrIHash(zCol);
144048
- Column *pCol;
144049
- for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){
144050
- if( pCol->hName==h && sqlite3StrICmp(pCol->zCnName, zCol)==0 ) return i;
144212
+ u8 h;
144213
+ const Column *aCol;
144214
+ int nCol;
144215
+
144216
+ h = sqlite3StrIHash(zCol);
144217
+ aCol = pTab->aCol;
144218
+ nCol = pTab->nCol;
144219
+
144220
+ /* See if the aHx gives us a lucky match */
144221
+ i = pTab->aHx[h % sizeof(pTab->aHx)];
144222
+ assert( i<nCol );
144223
+ if( aCol[i].hName==h
144224
+ && sqlite3StrICmp(aCol[i].zCnName, zCol)==0
144225
+ ){
144226
+ return i;
144227
+ }
144228
+
144229
+ /* No lucky match from the hash table. Do a full search. */
144230
+ i = 0;
144231
+ while( 1 /*exit-by-break*/ ){
144232
+ if( aCol[i].hName==h
144233
+ && sqlite3StrICmp(aCol[i].zCnName, zCol)==0
144234
+ ){
144235
+ return i;
144236
+ }
144237
+ i++;
144238
+ if( i>=nCol ) break;
144051144239
}
144052144240
return -1;
144053144241
}
144054144242
144055144243
/*
@@ -150549,11 +150737,11 @@
150549150737
}
150550150738
sqlite3ReleaseTempReg(pParse, regSubtype);
150551150739
}
150552150740
sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i));
150553150741
sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF);
150554
- sqlite3VdbeChangeP5(v, (u8)nArg);
150742
+ sqlite3VdbeChangeP5(v, (u16)nArg);
150555150743
sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); VdbeCoverage(v);
150556150744
sqlite3VdbeJumpHere(v, iTop);
150557150745
sqlite3ReleaseTempRange(pParse, regAgg, nArg);
150558150746
}
150559150747
sqlite3VdbeAddOp2(v, OP_AggFinal, AggInfoFuncReg(pAggInfo,i),
@@ -150712,11 +150900,11 @@
150712150900
sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0,
150713150901
(char *)pColl, P4_COLLSEQ);
150714150902
}
150715150903
sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i));
150716150904
sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF);
150717
- sqlite3VdbeChangeP5(v, (u8)nArg);
150905
+ sqlite3VdbeChangeP5(v, (u16)nArg);
150718150906
sqlite3ReleaseTempRange(pParse, regAgg, nArg);
150719150907
}
150720150908
if( addrNext ){
150721150909
sqlite3VdbeResolveLabel(v, addrNext);
150722150910
}
@@ -152767,11 +152955,12 @@
152767152955
}else if( pTrig->op==TK_RETURNING ){
152768152956
#ifndef SQLITE_OMIT_VIRTUALTABLE
152769152957
assert( pParse->db->pVtabCtx==0 );
152770152958
#endif
152771152959
assert( pParse->bReturning );
152772
- assert( &(pParse->u1.pReturning->retTrig) == pTrig );
152960
+ assert( !pParse->isCreate );
152961
+ assert( &(pParse->u1.d.pReturning->retTrig) == pTrig );
152773152962
pTrig->table = pTab->zName;
152774152963
pTrig->pTabSchema = pTab->pSchema;
152775152964
pTrig->pNext = pList;
152776152965
pList = pTrig;
152777152966
}
@@ -153744,11 +153933,12 @@
153744153933
/* This RETURNING trigger must be for a different statement as
153745153934
** this statement lacks a RETURNING clause. */
153746153935
return;
153747153936
}
153748153937
assert( db->pParse==pParse );
153749
- pReturning = pParse->u1.pReturning;
153938
+ assert( !pParse->isCreate );
153939
+ pReturning = pParse->u1.d.pReturning;
153750153940
if( pTrigger != &(pReturning->retTrig) ){
153751153941
/* This RETURNING trigger is for a different statement */
153752153942
return;
153753153943
}
153754153944
memset(&sSelect, 0, sizeof(sSelect));
@@ -153974,10 +154164,12 @@
153974154164
sSubParse.pToplevel = pTop;
153975154165
sSubParse.zAuthContext = pTrigger->zName;
153976154166
sSubParse.eTriggerOp = pTrigger->op;
153977154167
sSubParse.nQueryLoop = pParse->nQueryLoop;
153978154168
sSubParse.prepFlags = pParse->prepFlags;
154169
+ sSubParse.oldmask = 0;
154170
+ sSubParse.newmask = 0;
153979154171
153980154172
v = sqlite3GetVdbe(&sSubParse);
153981154173
if( v ){
153982154174
VdbeComment((v, "Start: %s.%s (%s %s%s%s ON %s)",
153983154175
pTrigger->zName, onErrorText(orconf),
@@ -154106,11 +154298,11 @@
154106154298
/* Set the P5 operand of the OP_Program instruction to non-zero if
154107154299
** recursive invocation of this trigger program is disallowed. Recursive
154108154300
** invocation is disallowed if (a) the sub-program is really a trigger,
154109154301
** not a foreign key action, and (b) the flag to enable recursive triggers
154110154302
** is clear. */
154111
- sqlite3VdbeChangeP5(v, (u8)bRecursive);
154303
+ sqlite3VdbeChangeP5(v, (u16)bRecursive);
154112154304
}
154113154305
}
154114154306
154115154307
/*
154116154308
** This is called to code the required FOR EACH ROW triggers for an operation
@@ -154728,42 +154920,36 @@
154728154920
** column to be updated, make sure we have authorization to change
154729154921
** that column.
154730154922
*/
154731154923
chngRowid = chngPk = 0;
154732154924
for(i=0; i<pChanges->nExpr; i++){
154733
- u8 hCol = sqlite3StrIHash(pChanges->a[i].zEName);
154734154925
/* If this is an UPDATE with a FROM clause, do not resolve expressions
154735154926
** here. The call to sqlite3Select() below will do that. */
154736154927
if( nChangeFrom==0 && sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){
154737154928
goto update_cleanup;
154738154929
}
154739
- for(j=0; j<pTab->nCol; j++){
154740
- if( pTab->aCol[j].hName==hCol
154741
- && sqlite3StrICmp(pTab->aCol[j].zCnName, pChanges->a[i].zEName)==0
154742
- ){
154743
- if( j==pTab->iPKey ){
154744
- chngRowid = 1;
154745
- pRowidExpr = pChanges->a[i].pExpr;
154746
- iRowidExpr = i;
154747
- }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
154748
- chngPk = 1;
154749
- }
154930
+ j = sqlite3ColumnIndex(pTab, pChanges->a[i].zEName);
154931
+ if( j>=0 ){
154932
+ if( j==pTab->iPKey ){
154933
+ chngRowid = 1;
154934
+ pRowidExpr = pChanges->a[i].pExpr;
154935
+ iRowidExpr = i;
154936
+ }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
154937
+ chngPk = 1;
154938
+ }
154750154939
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
154751
- else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){
154752
- testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL );
154753
- testcase( pTab->aCol[j].colFlags & COLFLAG_STORED );
154754
- sqlite3ErrorMsg(pParse,
154755
- "cannot UPDATE generated column \"%s\"",
154756
- pTab->aCol[j].zCnName);
154757
- goto update_cleanup;
154758
- }
154940
+ else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){
154941
+ testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL );
154942
+ testcase( pTab->aCol[j].colFlags & COLFLAG_STORED );
154943
+ sqlite3ErrorMsg(pParse,
154944
+ "cannot UPDATE generated column \"%s\"",
154945
+ pTab->aCol[j].zCnName);
154946
+ goto update_cleanup;
154947
+ }
154759154948
#endif
154760
- aXRef[j] = i;
154761
- break;
154762
- }
154763
- }
154764
- if( j>=pTab->nCol ){
154949
+ aXRef[j] = i;
154950
+ }else{
154765154951
if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zEName) ){
154766154952
j = -1;
154767154953
chngRowid = 1;
154768154954
pRowidExpr = pChanges->a[i].pExpr;
154769154955
iRowidExpr = i;
@@ -156866,24 +157052,25 @@
156866157052
156867157053
/* A slot for the record has already been allocated in the
156868157054
** schema table. We just need to update that slot with all
156869157055
** the information we've collected.
156870157056
**
156871
- ** The VM register number pParse->regRowid holds the rowid of an
157057
+ ** The VM register number pParse->u1.cr.regRowid holds the rowid of an
156872157058
** entry in the sqlite_schema table that was created for this vtab
156873157059
** by sqlite3StartTable().
156874157060
*/
156875157061
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
157062
+ assert( pParse->isCreate );
156876157063
sqlite3NestedParse(pParse,
156877157064
"UPDATE %Q." LEGACY_SCHEMA_TABLE " "
156878157065
"SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q "
156879157066
"WHERE rowid=#%d",
156880157067
db->aDb[iDb].zDbSName,
156881157068
pTab->zName,
156882157069
pTab->zName,
156883157070
zStmt,
156884
- pParse->regRowid
157071
+ pParse->u1.cr.regRowid
156885157072
);
156886157073
v = sqlite3GetVdbe(pParse);
156887157074
sqlite3ChangeCookie(pParse, iDb);
156888157075
156889157076
sqlite3VdbeAddOp0(v, OP_Expire);
@@ -157217,11 +157404,13 @@
157217157404
** sqlite3_declare_vtab() is being misused.
157218157405
*/
157219157406
z = (const unsigned char*)zCreateTable;
157220157407
for(i=0; aKeyword[i]; i++){
157221157408
int tokenType = 0;
157222
- do{ z += sqlite3GetToken(z, &tokenType); }while( tokenType==TK_SPACE );
157409
+ do{
157410
+ z += sqlite3GetToken(z, &tokenType);
157411
+ }while( tokenType==TK_SPACE || tokenType==TK_COMMENT );
157223157412
if( tokenType!=aKeyword[i] ){
157224157413
sqlite3ErrorWithMsg(db, SQLITE_ERROR, "syntax error");
157225157414
return SQLITE_ERROR;
157226157415
}
157227157416
}
@@ -157948,12 +158137,14 @@
157948158137
u16 nLTerm; /* Number of entries in aLTerm[] */
157949158138
u16 nSkip; /* Number of NULL aLTerm[] entries */
157950158139
/**** whereLoopXfer() copies fields above ***********************/
157951158140
# define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot)
157952158141
u16 nLSlot; /* Number of slots allocated for aLTerm[] */
158142
+#ifdef WHERETRACE_ENABLED
157953158143
LogEst rStarDelta; /* Cost delta due to star-schema heuristic. Not
157954
- ** initialized unless pWInfo->nOutStarDelta>0 */
158144
+ ** initialized unless pWInfo->bStarUsed */
158145
+#endif
157955158146
WhereTerm **aLTerm; /* WhereTerms used */
157956158147
WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */
157957158148
WhereTerm *aLTermSpace[3]; /* Initial aLTerm[] space */
157958158149
};
157959158150
@@ -157998,11 +158189,11 @@
157998158189
struct WherePath {
157999158190
Bitmask maskLoop; /* Bitmask of all WhereLoop objects in this path */
158000158191
Bitmask revLoop; /* aLoop[]s that should be reversed for ORDER BY */
158001158192
LogEst nRow; /* Estimated number of rows generated by this path */
158002158193
LogEst rCost; /* Total cost of this path */
158003
- LogEst rUnsorted; /* Total cost of this path ignoring sorting costs */
158194
+ LogEst rUnsort; /* Total cost of this path ignoring sorting costs */
158004158195
i8 isOrdered; /* No. of ORDER BY terms satisfied. -1 for unknown */
158005158196
WhereLoop **aLoop; /* Array of WhereLoop objects implementing this path */
158006158197
};
158007158198
158008158199
/*
@@ -158271,13 +158462,17 @@
158271158462
u8 eOnePass; /* ONEPASS_OFF, or _SINGLE, or _MULTI */
158272158463
u8 eDistinct; /* One of the WHERE_DISTINCT_* values */
158273158464
unsigned bDeferredSeek :1; /* Uses OP_DeferredSeek */
158274158465
unsigned untestedTerms :1; /* Not all WHERE terms resolved by outer loop */
158275158466
unsigned bOrderedInnerLoop:1;/* True if only the inner-most loop is ordered */
158276
- unsigned sorted :1; /* True if really sorted (not just grouped) */
158277
- LogEst nOutStarDelta; /* Artifical nOut reduction for star-query */
158467
+ unsigned sorted :1; /* True if really sorted (not just grouped) */
158468
+ unsigned bStarDone :1; /* True if check for star-query is complete */
158469
+ unsigned bStarUsed :1; /* True if star-query heuristic is used */
158278158470
LogEst nRowOut; /* Estimated number of output rows */
158471
+#ifdef WHERETRACE_ENABLED
158472
+ LogEst rTotalCost; /* Total cost of the solution */
158473
+#endif
158279158474
int iTop; /* The very beginning of the WHERE loop */
158280158475
int iEndWhere; /* End of the WHERE clause itself */
158281158476
WhereLoop *pLoops; /* List of all WhereLoop objects */
158282158477
WhereMemBlock *pMemToFree;/* Memory to free when this object destroyed */
158283158478
Bitmask revMask; /* Mask of ORDER BY terms that need reversing */
@@ -160029,10 +160224,13 @@
160029160224
}
160030160225
}
160031160226
}
160032160227
sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg);
160033160228
sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1);
160229
+ /* The instruction immediately prior to OP_VFilter must be an OP_Integer
160230
+ ** that sets the "argc" value for xVFilter. This is necessary for
160231
+ ** resolveP2() to work correctly. See tag-20250207a. */
160034160232
sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg,
160035160233
pLoop->u.vtab.idxStr,
160036160234
pLoop->u.vtab.needFree ? P4_DYNAMIC : P4_STATIC);
160037160235
VdbeCoverage(v);
160038160236
pLoop->u.vtab.needFree = 0;
@@ -161584,24 +161782,26 @@
161584161782
}else if( op==TK_STRING ){
161585161783
assert( !ExprHasProperty(pRight, EP_IntValue) );
161586161784
z = (u8*)pRight->u.zToken;
161587161785
}
161588161786
if( z ){
161589
- /* Count the number of prefix bytes prior to the first wildcard.
161590
- ** or U+fffd character. If the underlying database has a UTF16LE
161591
- ** encoding, then only consider ASCII characters. Note that the
161592
- ** encoding of z[] is UTF8 - we are dealing with only UTF8 here in
161593
- ** this code, but the database engine itself might be processing
161594
- ** content using a different encoding. */
161787
+ /* Count the number of prefix bytes prior to the first wildcard,
161788
+ ** U+fffd character, or malformed utf-8. If the underlying database
161789
+ ** has a UTF16LE encoding, then only consider ASCII characters. Note that
161790
+ ** the encoding of z[] is UTF8 - we are dealing with only UTF8 here in this
161791
+ ** code, but the database engine itself might be processing content using a
161792
+ ** different encoding. */
161595161793
cnt = 0;
161596161794
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
161597161795
cnt++;
161598161796
if( c==wc[3] && z[cnt]>0 && z[cnt]<0x80 ){
161599161797
cnt++;
161600161798
}else if( c>=0x80 ){
161601161799
const u8 *z2 = z+cnt-1;
161602
- if( sqlite3Utf8Read(&z2)==0xfffd || ENC(db)==SQLITE_UTF16LE ){
161800
+ if( c==0xff || sqlite3Utf8Read(&z2)==0xfffd /* bad utf-8 */
161801
+ || ENC(db)==SQLITE_UTF16LE
161802
+ ){
161603161803
cnt--;
161604161804
break;
161605161805
}else{
161606161806
cnt = (int)(z2-z);
161607161807
}
@@ -162749,24 +162949,30 @@
162749162949
pStr2->u.zToken[i] = sqlite3Tolower(c);
162750162950
}
162751162951
}
162752162952
162753162953
if( !db->mallocFailed ){
162754
- u8 c, *pC; /* Last character before the first wildcard */
162954
+ u8 *pC; /* Last character before the first wildcard */
162755162955
pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1];
162756
- c = *pC;
162757162956
if( noCase ){
162758162957
/* The point is to increment the last character before the first
162759162958
** wildcard. But if we increment '@', that will push it into the
162760162959
** alphabetic range where case conversions will mess up the
162761162960
** inequality. To avoid this, make sure to also run the full
162762162961
** LIKE on all candidate expressions by clearing the isComplete flag
162763162962
*/
162764
- if( c=='A'-1 ) isComplete = 0;
162765
- c = sqlite3UpperToLower[c];
162963
+ if( *pC=='A'-1 ) isComplete = 0;
162964
+ *pC = sqlite3UpperToLower[*pC];
162766162965
}
162767
- *pC = c + 1;
162966
+
162967
+ /* Increment the value of the last utf8 character in the prefix. */
162968
+ while( *pC==0xBF && pC>(u8*)pStr2->u.zToken ){
162969
+ *pC = 0x80;
162970
+ pC--;
162971
+ }
162972
+ assert( *pC!=0xFF ); /* isLikeOrGlob() guarantees this */
162973
+ (*pC)++;
162768162974
}
162769162975
zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY;
162770162976
pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
162771162977
pNewExpr1 = sqlite3PExpr(pParse, TK_GE,
162772162978
sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName),
@@ -164130,10 +164336,15 @@
164130164336
**
164131164337
** 2. If iCol is part of an existing index that has an aiRowLogEst of
164132164338
** more than 20, then return false.
164133164339
**
164134164340
** 3. If no disqualifying conditions above are found, return true.
164341
+**
164342
+** 2025-01-03: I experimented with a new rule that returns false if the
164343
+** the datatype of the column is "BOOLEAN". This did not improve
164344
+** performance on any queries at hand, but it did burn CPU cycles, so the
164345
+** idea was not committed.
164135164346
*/
164136164347
static SQLITE_NOINLINE int columnIsGoodIndexCandidate(
164137164348
const Table *pTab,
164138164349
int iCol
164139164350
){
@@ -164214,11 +164425,11 @@
164214164425
char *zText = 0;
164215164426
int ii = 0;
164216164427
sqlite3_str *pStr = sqlite3_str_new(pParse->db);
164217164428
sqlite3_str_appendf(pStr,"CREATE AUTOMATIC INDEX ON %s(", pTab->zName);
164218164429
assert( pIdx->nColumn>1 );
164219
- assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID );
164430
+ assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID || !HasRowid(pTab) );
164220164431
for(ii=0; ii<(pIdx->nColumn-1); ii++){
164221164432
const char *zName = 0;
164222164433
int iCol = pIdx->aiColumn[ii];
164223164434
164224164435
zName = pTab->aCol[iCol].zCnName;
@@ -164344,10 +164555,23 @@
164344164555
*/
164345164556
if( IsView(pTable) ){
164346164557
extraCols = ALLBITS & ~idxCols;
164347164558
}else{
164348164559
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
164560
+ }
164561
+ if( !HasRowid(pTable) ){
164562
+ /* For WITHOUT ROWID tables, ensure that all PRIMARY KEY columns are
164563
+ ** either in the idxCols mask or in the extraCols mask */
164564
+ for(i=0; i<pTable->nCol; i++){
164565
+ if( (pTable->aCol[i].colFlags & COLFLAG_PRIMKEY)==0 ) continue;
164566
+ if( i>=BMS-1 ){
164567
+ extraCols |= MASKBIT(BMS-1);
164568
+ break;
164569
+ }
164570
+ if( idxCols & MASKBIT(i) ) continue;
164571
+ extraCols |= MASKBIT(i);
164572
+ }
164349164573
}
164350164574
mxBitCol = MIN(BMS-1,pTable->nCol);
164351164575
testcase( pTable->nCol==BMS-1 );
164352164576
testcase( pTable->nCol==BMS-2 );
164353164577
for(i=0; i<mxBitCol; i++){
@@ -164356,11 +164580,12 @@
164356164580
if( pSrc->colUsed & MASKBIT(BMS-1) ){
164357164581
nKeyCol += pTable->nCol - BMS + 1;
164358164582
}
164359164583
164360164584
/* Construct the Index object to describe this index */
164361
- pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
164585
+ pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+HasRowid(pTable),
164586
+ 0, &zNotUsed);
164362164587
if( pIdx==0 ) goto end_auto_index_create;
164363164588
pLoop->u.btree.pIndex = pIdx;
164364164589
pIdx->zName = "auto-index";
164365164590
pIdx->pTable = pTable;
164366164591
n = 0;
@@ -164412,12 +164637,14 @@
164412164637
pIdx->azColl[n] = sqlite3StrBINARY;
164413164638
n++;
164414164639
}
164415164640
}
164416164641
assert( n==nKeyCol );
164417
- pIdx->aiColumn[n] = XN_ROWID;
164418
- pIdx->azColl[n] = sqlite3StrBINARY;
164642
+ if( HasRowid(pTable) ){
164643
+ pIdx->aiColumn[n] = XN_ROWID;
164644
+ pIdx->azColl[n] = sqlite3StrBINARY;
164645
+ }
164419164646
164420164647
/* Create the automatic index */
164421164648
explainAutomaticIndex(pParse, pIdx, pPartial!=0, &addrExp);
164422164649
assert( pLevel->iIdxCur>=0 );
164423164650
pLevel->iIdxCur = pParse->nTab++;
@@ -165680,21 +165907,23 @@
165680165907
** | | | __|__ nEq ---. ___|__ | __|__
165681165908
** | / \ / \ / \ | / \ / \ / \
165682165909
** 1.002.001 t2.t2xy 2 f 010241 N 2 cost 0,56,31
165683165910
*/
165684165911
SQLITE_PRIVATE void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC){
165912
+ WhereInfo *pWInfo;
165685165913
if( pWC ){
165686
- WhereInfo *pWInfo = pWC->pWInfo;
165914
+ pWInfo = pWC->pWInfo;
165687165915
int nb = 1+(pWInfo->pTabList->nSrc+3)/4;
165688165916
SrcItem *pItem = pWInfo->pTabList->a + p->iTab;
165689165917
Table *pTab = pItem->pSTab;
165690165918
Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1;
165691165919
sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId,
165692165920
p->iTab, nb, p->maskSelf, nb, p->prereq & mAll);
165693165921
sqlite3DebugPrintf(" %12s",
165694165922
pItem->zAlias ? pItem->zAlias : pTab->zName);
165695165923
}else{
165924
+ pWInfo = 0;
165696165925
sqlite3DebugPrintf("%c%2d.%03llx.%03llx %c%d",
165697165926
p->cId, p->iTab, p->maskSelf, p->prereq & 0xfff, p->cId, p->iTab);
165698165927
}
165699165928
if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){
165700165929
const char *zName;
@@ -165722,11 +165951,16 @@
165722165951
if( p->wsFlags & WHERE_SKIPSCAN ){
165723165952
sqlite3DebugPrintf(" f %06x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
165724165953
}else{
165725165954
sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm);
165726165955
}
165727
- sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
165956
+ if( pWInfo && pWInfo->bStarUsed && p->rStarDelta!=0 ){
165957
+ sqlite3DebugPrintf(" cost %d,%d,%d delta=%d\n",
165958
+ p->rSetup, p->rRun, p->nOut, p->rStarDelta);
165959
+ }else{
165960
+ sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
165961
+ }
165728165962
if( p->nLTerm && (sqlite3WhereTrace & 0x4000)!=0 ){
165729165963
int i;
165730165964
for(i=0; i<p->nLTerm; i++){
165731165965
sqlite3WhereTermPrint(p->aLTerm[i], i);
165732165966
}
@@ -167188,11 +167422,10 @@
167188167422
if( !pBuilder->pOrSet /* Not part of an OR optimization */
167189167423
&& (pWInfo->wctrlFlags & (WHERE_RIGHT_JOIN|WHERE_OR_SUBCLAUSE))==0
167190167424
&& (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
167191167425
&& !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */
167192167426
&& !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
167193
- && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
167194167427
&& !pSrc->fg.isCorrelated /* Not a correlated subquery */
167195167428
&& !pSrc->fg.isRecursive /* Not a recursive common table expression. */
167196167429
&& (pSrc->fg.jointype & JT_RIGHT)==0 /* Not the right tab of a RIGHT JOIN */
167197167430
){
167198167431
/* Generate auto-index WhereLoops */
@@ -168691,72 +168924,205 @@
168691168924
** The value returned is a tuning parameter. Currently the value is:
168692168925
**
168693168926
** 18 for star queries
168694168927
** 12 otherwise
168695168928
**
168696
-** For the purposes of SQLite, a star-query is defined as a query
168697
-** with a large central table that is joined against four or more
168698
-** smaller tables. The central table is called the "fact" table.
168699
-** The smaller tables that get joined are "dimension tables".
168929
+** For the purposes of this heuristic, a star-query is defined as a query
168930
+** with a large central table that is joined using an INNER JOIN,
168931
+** not CROSS or OUTER JOINs, against four or more smaller tables.
168932
+** The central table is called the "fact" table. The smaller tables
168933
+** that get joined are "dimension tables". Also, any table that is
168934
+** self-joined cannot be a dimension table; we assume that dimension
168935
+** tables may only be joined against fact tables.
168700168936
**
168701168937
** SIDE EFFECT: (and really the whole point of this subroutine)
168702168938
**
168703
-** If pWInfo describes a star-query, then the cost on WhereLoops for the
168704
-** fact table is reduced. This heuristic helps keep fact tables in
168705
-** outer loops. Without this heuristic, paths with fact tables in outer
168706
-** loops tend to get pruned by the mxChoice limit on the number of paths,
168707
-** resulting in poor query plans. The total amount of heuristic cost
168708
-** adjustment is stored in pWInfo->nOutStarDelta and the cost adjustment
168709
-** for each WhereLoop is stored in its rStarDelta field.
168939
+** If pWInfo describes a star-query, then the cost for SCANs of dimension
168940
+** WhereLoops is increased to be slightly larger than the cost of a SCAN
168941
+** in the fact table. Only SCAN costs are increased. SEARCH costs are
168942
+** unchanged. This heuristic helps keep fact tables in outer loops. Without
168943
+** this heuristic, paths with fact tables in outer loops tend to get pruned
168944
+** by the mxChoice limit on the number of paths, resulting in poor query
168945
+** plans. See the starschema1.test test module for examples of queries
168946
+** that need this heuristic to find good query plans.
168947
+**
168948
+** This heuristic can be completely disabled, so that no query is
168949
+** considered a star-query, using SQLITE_TESTCTRL_OPTIMIZATION to
168950
+** disable the SQLITE_StarQuery optimization. In the CLI, the command
168951
+** to do that is: ".testctrl opt -starquery".
168952
+**
168953
+** HISTORICAL NOTES:
168954
+**
168955
+** This optimization was first added on 2024-05-09 by check-in 38db9b5c83d.
168956
+** The original optimization reduced the cost and output size estimate for
168957
+** fact tables to help them move to outer loops. But months later (as people
168958
+** started upgrading) performance regression reports started caming in,
168959
+** including:
168960
+**
168961
+** forum post b18ef983e68d06d1 (2024-12-21)
168962
+** forum post 0025389d0860af82 (2025-01-14)
168963
+** forum post d87570a145599033 (2025-01-17)
168964
+**
168965
+** To address these, the criteria for a star-query was tightened to exclude
168966
+** cases where the fact and dimensions are separated by an outer join, and
168967
+** the affect of star-schema detection was changed to increase the rRun cost
168968
+** on just full table scans of dimension tables, rather than reducing costs
168969
+** in the all access methods of the fact table.
168710168970
*/
168711
-static int computeMxChoice(WhereInfo *pWInfo, LogEst nRowEst){
168971
+static int computeMxChoice(WhereInfo *pWInfo){
168712168972
int nLoop = pWInfo->nLevel; /* Number of terms in the join */
168713
- if( nRowEst==0 && nLoop>=5 ){
168714
- /* Check to see if we are dealing with a star schema and if so, reduce
168715
- ** the cost of fact tables relative to dimension tables, as a heuristic
168716
- ** to help keep the fact tables in outer loops.
168973
+ WhereLoop *pWLoop; /* For looping over WhereLoops */
168974
+
168975
+#ifdef SQLITE_DEBUG
168976
+ /* The star-query detection code below makes use of the following
168977
+ ** properties of the WhereLoop list, so verify them before
168978
+ ** continuing:
168979
+ ** (1) .maskSelf is the bitmask corresponding to .iTab
168980
+ ** (2) The WhereLoop list is in ascending .iTab order
168981
+ */
168982
+ for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
168983
+ assert( pWLoop->maskSelf==MASKBIT(pWLoop->iTab) );
168984
+ assert( pWLoop->pNextLoop==0 || pWLoop->iTab<=pWLoop->pNextLoop->iTab );
168985
+ }
168986
+#endif /* SQLITE_DEBUG */
168987
+
168988
+ if( nLoop>=5
168989
+ && !pWInfo->bStarDone
168990
+ && OptimizationEnabled(pWInfo->pParse->db, SQLITE_StarQuery)
168991
+ ){
168992
+ SrcItem *aFromTabs; /* All terms of the FROM clause */
168993
+ int iFromIdx; /* Term of FROM clause is the candidate fact-table */
168994
+ Bitmask m; /* Bitmask for candidate fact-table */
168995
+ Bitmask mSelfJoin = 0; /* Tables that cannot be dimension tables */
168996
+ WhereLoop *pStart; /* Where to start searching for dimension-tables */
168997
+
168998
+ pWInfo->bStarDone = 1; /* Only do this computation once */
168999
+
169000
+ /* Look for fact tables with four or more dimensions where the
169001
+ ** dimension tables are not separately from the fact tables by an outer
169002
+ ** or cross join. Adjust cost weights if found.
168717169003
*/
168718
- int iLoop; /* Counter over join terms */
168719
- Bitmask m; /* Bitmask for current loop */
168720
- assert( pWInfo->nOutStarDelta==0 );
168721
- for(iLoop=0, m=1; iLoop<nLoop; iLoop++, m<<=1){
168722
- WhereLoop *pWLoop; /* For looping over WhereLoops */
169004
+ assert( !pWInfo->bStarUsed );
169005
+ aFromTabs = pWInfo->pTabList->a;
169006
+ pStart = pWInfo->pLoops;
169007
+ for(iFromIdx=0, m=1; iFromIdx<nLoop; iFromIdx++, m<<=1){
168723169008
int nDep = 0; /* Number of dimension tables */
168724
- LogEst rDelta; /* Heuristic cost adjustment */
169009
+ LogEst mxRun; /* Maximum SCAN cost of a fact table */
168725169010
Bitmask mSeen = 0; /* Mask of dimension tables */
168726
- for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
168727
- if( (pWLoop->prereq & m)!=0 && (pWLoop->maskSelf & mSeen)==0 ){
168728
- nDep++;
168729
- mSeen |= pWLoop->maskSelf;
169011
+ SrcItem *pFactTab; /* The candidate fact table */
169012
+
169013
+ pFactTab = aFromTabs + iFromIdx;
169014
+ if( (pFactTab->fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
169015
+ /* If the candidate fact-table is the right table of an outer join
169016
+ ** restrict the search for dimension-tables to be tables to the right
169017
+ ** of the fact-table. */
169018
+ if( iFromIdx+4 > nLoop ) break; /* Impossible to reach nDep>=4 */
169019
+ while( pStart && pStart->iTab<=iFromIdx ){
169020
+ pStart = pStart->pNextLoop;
169021
+ }
169022
+ }
169023
+ for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
169024
+ if( (aFromTabs[pWLoop->iTab].fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
169025
+ /* Fact-tables and dimension-tables cannot be separated by an
169026
+ ** outer join (at least for the definition of fact- and dimension-
169027
+ ** used by this heuristic). */
169028
+ break;
169029
+ }
169030
+ if( (pWLoop->prereq & m)!=0 /* pWInfo depends on iFromIdx */
169031
+ && (pWLoop->maskSelf & mSeen)==0 /* pWInfo not already a dependency */
169032
+ && (pWLoop->maskSelf & mSelfJoin)==0 /* Not a self-join */
169033
+ ){
169034
+ if( aFromTabs[pWLoop->iTab].pSTab==pFactTab->pSTab ){
169035
+ mSelfJoin |= m;
169036
+ }else{
169037
+ nDep++;
169038
+ mSeen |= pWLoop->maskSelf;
169039
+ }
168730169040
}
168731169041
}
168732169042
if( nDep<=3 ) continue;
168733
- rDelta = 15*(nDep-3);
168734
-#ifdef WHERETRACE_ENABLED /* 0x4 */
168735
- if( sqlite3WhereTrace&0x4 ){
168736
- SrcItem *pItem = pWInfo->pTabList->a + iLoop;
168737
- sqlite3DebugPrintf("Fact-table %s: %d dimensions, cost reduced %d\n",
168738
- pItem->zAlias ? pItem->zAlias : pItem->pSTab->zName,
168739
- nDep, rDelta);
168740
- }
168741
-#endif
168742
- if( pWInfo->nOutStarDelta==0 ){
169043
+
169044
+ /* If we reach this point, it means that pFactTab is a fact table
169045
+ ** with four or more dimensions connected by inner joins. Proceed
169046
+ ** to make cost adjustments. */
169047
+
169048
+#ifdef WHERETRACE_ENABLED
169049
+ /* Make sure rStarDelta values are initialized */
169050
+ if( !pWInfo->bStarUsed ){
168743169051
for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
168744169052
pWLoop->rStarDelta = 0;
168745169053
}
168746169054
}
168747
- pWInfo->nOutStarDelta += rDelta;
169055
+#endif
169056
+ pWInfo->bStarUsed = 1;
169057
+
169058
+ /* Compute the maximum cost of any WhereLoop for the
169059
+ ** fact table plus one epsilon */
169060
+ mxRun = LOGEST_MIN;
169061
+ for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
169062
+ if( pWLoop->iTab<iFromIdx ) continue;
169063
+ if( pWLoop->iTab>iFromIdx ) break;
169064
+ if( pWLoop->rRun>mxRun ) mxRun = pWLoop->rRun;
169065
+ }
169066
+ if( ALWAYS(mxRun<LOGEST_MAX) ) mxRun++;
169067
+
169068
+ /* Increase the cost of table scans for dimension tables to be
169069
+ ** slightly more than the maximum cost of the fact table */
169070
+ for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
169071
+ if( (pWLoop->maskSelf & mSeen)==0 ) continue;
169072
+ if( pWLoop->nLTerm ) continue;
169073
+ if( pWLoop->rRun<mxRun ){
169074
+#ifdef WHERETRACE_ENABLED /* 0x80000 */
169075
+ if( sqlite3WhereTrace & 0x80000 ){
169076
+ SrcItem *pDim = aFromTabs + pWLoop->iTab;
169077
+ sqlite3DebugPrintf(
169078
+ "Increase SCAN cost of dimension %s(%d) of fact %s(%d) to %d\n",
169079
+ pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, pWLoop->iTab,
169080
+ pFactTab->zAlias ? pFactTab->zAlias : pFactTab->pSTab->zName,
169081
+ iFromIdx, mxRun
169082
+ );
169083
+ }
169084
+ pWLoop->rStarDelta = mxRun - pWLoop->rRun;
169085
+#endif /* WHERETRACE_ENABLED */
169086
+ pWLoop->rRun = mxRun;
169087
+ }
169088
+ }
169089
+ }
169090
+#ifdef WHERETRACE_ENABLED /* 0x80000 */
169091
+ if( (sqlite3WhereTrace & 0x80000)!=0 && pWInfo->bStarUsed ){
169092
+ sqlite3DebugPrintf("WhereLoops changed by star-query heuristic:\n");
168748169093
for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
168749
- if( pWLoop->maskSelf==m ){
168750
- pWLoop->rRun -= rDelta;
168751
- pWLoop->nOut -= rDelta;
168752
- pWLoop->rStarDelta = rDelta;
169094
+ if( pWLoop->rStarDelta ){
169095
+ sqlite3WhereLoopPrint(pWLoop, &pWInfo->sWC);
168753169096
}
168754169097
}
168755169098
}
169099
+#endif
168756169100
}
168757
- return pWInfo->nOutStarDelta>0 ? 18 : 12;
169101
+ return pWInfo->bStarUsed ? 18 : 12;
169102
+}
169103
+
169104
+/*
169105
+** Two WhereLoop objects, pCandidate and pBaseline, are known to have the
169106
+** same cost. Look deep into each to see if pCandidate is even slightly
169107
+** better than pBaseline. Return false if it is, if pCandidate is is preferred.
169108
+** Return true if pBaseline is preferred or if we cannot tell the difference.
169109
+**
169110
+** Result Meaning
169111
+** -------- ----------------------------------------------------------
169112
+** true We cannot tell the difference in pCandidate and pBaseline
169113
+** false pCandidate seems like a better choice than pBaseline
169114
+*/
169115
+static SQLITE_NOINLINE int whereLoopIsNoBetter(
169116
+ const WhereLoop *pCandidate,
169117
+ const WhereLoop *pBaseline
169118
+){
169119
+ if( (pCandidate->wsFlags & WHERE_INDEXED)==0 ) return 1;
169120
+ if( (pBaseline->wsFlags & WHERE_INDEXED)==0 ) return 1;
169121
+ if( pCandidate->u.btree.pIndex->szIdxRow <
169122
+ pBaseline->u.btree.pIndex->szIdxRow ) return 0;
169123
+ return 1;
168758169124
}
168759169125
168760169126
/*
168761169127
** Given the list of WhereLoop objects at pWInfo->pLoops, this routine
168762169128
** attempts to find the lowest cost path that visits each WhereLoop
@@ -168776,11 +169142,11 @@
168776169142
int iLoop; /* Loop counter over the terms of the join */
168777169143
int ii, jj; /* Loop counters */
168778169144
int mxI = 0; /* Index of next entry to replace */
168779169145
int nOrderBy; /* Number of ORDER BY clause terms */
168780169146
LogEst mxCost = 0; /* Maximum cost of a set of paths */
168781
- LogEst mxUnsorted = 0; /* Maximum unsorted cost of a set of path */
169147
+ LogEst mxUnsort = 0; /* Maximum unsorted cost of a set of path */
168782169148
int nTo, nFrom; /* Number of valid entries in aTo[] and aFrom[] */
168783169149
WherePath *aFrom; /* All nFrom paths at the previous level */
168784169150
WherePath *aTo; /* The nTo best paths at the current level */
168785169151
WherePath *pFrom; /* An element of aFrom[] that we are working on */
168786169152
WherePath *pTo; /* An element of aTo[] that we are working on */
@@ -168805,12 +169171,14 @@
168805169171
*/
168806169172
if( nLoop<=1 ){
168807169173
mxChoice = 1;
168808169174
}else if( nLoop==2 ){
168809169175
mxChoice = 5;
169176
+ }else if( pParse->nErr ){
169177
+ mxChoice = 1;
168810169178
}else{
168811
- mxChoice = computeMxChoice(pWInfo, nRowEst);
169179
+ mxChoice = computeMxChoice(pWInfo);
168812169180
}
168813169181
assert( nLoop<=pWInfo->pTabList->nSrc );
168814169182
168815169183
/* If nRowEst is zero and there is an ORDER BY clause, ignore it. In this
168816169184
** case the purpose of this call is to estimate the number of rows returned
@@ -168873,11 +169241,11 @@
168873169241
nTo = 0;
168874169242
for(ii=0, pFrom=aFrom; ii<nFrom; ii++, pFrom++){
168875169243
for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
168876169244
LogEst nOut; /* Rows visited by (pFrom+pWLoop) */
168877169245
LogEst rCost; /* Cost of path (pFrom+pWLoop) */
168878
- LogEst rUnsorted; /* Unsorted cost of (pFrom+pWLoop) */
169246
+ LogEst rUnsort; /* Unsorted cost of (pFrom+pWLoop) */
168879169247
i8 isOrdered; /* isOrdered for (pFrom+pWLoop) */
168880169248
Bitmask maskNew; /* Mask of src visited by (..) */
168881169249
Bitmask revMask; /* Mask of rev-order loops for (..) */
168882169250
168883169251
if( (pWLoop->prereq & ~pFrom->maskLoop)!=0 ) continue;
@@ -168891,15 +169259,15 @@
168891169259
continue;
168892169260
}
168893169261
168894169262
/* At this point, pWLoop is a candidate to be the next loop.
168895169263
** Compute its cost */
168896
- rUnsorted = pWLoop->rRun + pFrom->nRow;
169264
+ rUnsort = pWLoop->rRun + pFrom->nRow;
168897169265
if( pWLoop->rSetup ){
168898
- rUnsorted = sqlite3LogEstAdd(pWLoop->rSetup, rUnsorted);
169266
+ rUnsort = sqlite3LogEstAdd(pWLoop->rSetup, rUnsort);
168899169267
}
168900
- rUnsorted = sqlite3LogEstAdd(rUnsorted, pFrom->rUnsorted);
169268
+ rUnsort = sqlite3LogEstAdd(rUnsort, pFrom->rUnsort);
168901169269
nOut = pFrom->nRow + pWLoop->nOut;
168902169270
maskNew = pFrom->maskLoop | pWLoop->maskSelf;
168903169271
isOrdered = pFrom->isOrdered;
168904169272
if( isOrdered<0 ){
168905169273
revMask = 0;
@@ -168917,19 +169285,19 @@
168917169285
}
168918169286
/* TUNING: Add a small extra penalty (3) to sorting as an
168919169287
** extra encouragement to the query planner to select a plan
168920169288
** where the rows emerge in the correct order without any sorting
168921169289
** required. */
168922
- rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 3;
169290
+ rCost = sqlite3LogEstAdd(rUnsort, aSortCost[isOrdered]) + 3;
168923169291
168924169292
WHERETRACE(0x002,
168925169293
("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n",
168926169294
aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy,
168927
- rUnsorted, rCost));
169295
+ rUnsort, rCost));
168928169296
}else{
168929
- rCost = rUnsorted;
168930
- rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */
169297
+ rCost = rUnsort;
169298
+ rUnsort -= 2; /* TUNING: Slight bias in favor of no-sort plans */
168931169299
}
168932169300
168933169301
/* Check to see if pWLoop should be added to the set of
168934169302
** mxChoice best-so-far paths.
168935169303
**
@@ -168951,19 +169319,19 @@
168951169319
}
168952169320
}
168953169321
if( jj>=nTo ){
168954169322
/* None of the existing best-so-far paths match the candidate. */
168955169323
if( nTo>=mxChoice
168956
- && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted))
169324
+ && (rCost>mxCost || (rCost==mxCost && rUnsort>=mxUnsort))
168957169325
){
168958169326
/* The current candidate is no better than any of the mxChoice
168959169327
** paths currently in the best-so-far buffer. So discard
168960169328
** this candidate as not viable. */
168961169329
#ifdef WHERETRACE_ENABLED /* 0x4 */
168962169330
if( sqlite3WhereTrace&0x4 ){
168963169331
sqlite3DebugPrintf("Skip %s cost=%-3d,%3d,%3d order=%c\n",
168964
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
169332
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
168965169333
isOrdered>=0 ? isOrdered+'0' : '?');
168966169334
}
168967169335
#endif
168968169336
continue;
168969169337
}
@@ -168978,11 +169346,11 @@
168978169346
}
168979169347
pTo = &aTo[jj];
168980169348
#ifdef WHERETRACE_ENABLED /* 0x4 */
168981169349
if( sqlite3WhereTrace&0x4 ){
168982169350
sqlite3DebugPrintf("New %s cost=%-3d,%3d,%3d order=%c\n",
168983
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
169351
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
168984169352
isOrdered>=0 ? isOrdered+'0' : '?');
168985169353
}
168986169354
#endif
168987169355
}else{
168988169356
/* Control reaches here if best-so-far path pTo=aTo[jj] covers the
@@ -168989,28 +169357,27 @@
168989169357
** same set of loops and has the same isOrdered setting as the
168990169358
** candidate path. Check to see if the candidate should replace
168991169359
** pTo or if the candidate should be skipped.
168992169360
**
168993169361
** The conditional is an expanded vector comparison equivalent to:
168994
- ** (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted)
169362
+ ** (pTo->rCost,pTo->nRow,pTo->rUnsort) <= (rCost,nOut,rUnsort)
168995169363
*/
168996
- if( pTo->rCost<rCost
168997
- || (pTo->rCost==rCost
168998
- && (pTo->nRow<nOut
168999
- || (pTo->nRow==nOut && pTo->rUnsorted<=rUnsorted)
169000
- )
169001
- )
169364
+ if( (pTo->rCost<rCost)
169365
+ || (pTo->rCost==rCost && pTo->nRow<nOut)
169366
+ || (pTo->rCost==rCost && pTo->nRow==nOut && pTo->rUnsort<rUnsort)
169367
+ || (pTo->rCost==rCost && pTo->nRow==nOut && pTo->rUnsort==rUnsort
169368
+ && whereLoopIsNoBetter(pWLoop, pTo->aLoop[iLoop]) )
169002169369
){
169003169370
#ifdef WHERETRACE_ENABLED /* 0x4 */
169004169371
if( sqlite3WhereTrace&0x4 ){
169005169372
sqlite3DebugPrintf(
169006169373
"Skip %s cost=%-3d,%3d,%3d order=%c",
169007
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
169374
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
169008169375
isOrdered>=0 ? isOrdered+'0' : '?');
169009169376
sqlite3DebugPrintf(" vs %s cost=%-3d,%3d,%3d order=%c\n",
169010169377
wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
169011
- pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
169378
+ pTo->rUnsort, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
169012169379
}
169013169380
#endif
169014169381
/* Discard the candidate path from further consideration */
169015169382
testcase( pTo->rCost==rCost );
169016169383
continue;
@@ -169020,37 +169387,37 @@
169020169387
** pTo path. Replace pTo with the candidate. */
169021169388
#ifdef WHERETRACE_ENABLED /* 0x4 */
169022169389
if( sqlite3WhereTrace&0x4 ){
169023169390
sqlite3DebugPrintf(
169024169391
"Update %s cost=%-3d,%3d,%3d order=%c",
169025
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
169392
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
169026169393
isOrdered>=0 ? isOrdered+'0' : '?');
169027169394
sqlite3DebugPrintf(" was %s cost=%-3d,%3d,%3d order=%c\n",
169028169395
wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
169029
- pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
169396
+ pTo->rUnsort, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
169030169397
}
169031169398
#endif
169032169399
}
169033169400
/* pWLoop is a winner. Add it to the set of best so far */
169034169401
pTo->maskLoop = pFrom->maskLoop | pWLoop->maskSelf;
169035169402
pTo->revLoop = revMask;
169036169403
pTo->nRow = nOut;
169037169404
pTo->rCost = rCost;
169038
- pTo->rUnsorted = rUnsorted;
169405
+ pTo->rUnsort = rUnsort;
169039169406
pTo->isOrdered = isOrdered;
169040169407
memcpy(pTo->aLoop, pFrom->aLoop, sizeof(WhereLoop*)*iLoop);
169041169408
pTo->aLoop[iLoop] = pWLoop;
169042169409
if( nTo>=mxChoice ){
169043169410
mxI = 0;
169044169411
mxCost = aTo[0].rCost;
169045
- mxUnsorted = aTo[0].nRow;
169412
+ mxUnsort = aTo[0].nRow;
169046169413
for(jj=1, pTo=&aTo[1]; jj<mxChoice; jj++, pTo++){
169047169414
if( pTo->rCost>mxCost
169048
- || (pTo->rCost==mxCost && pTo->rUnsorted>mxUnsorted)
169415
+ || (pTo->rCost==mxCost && pTo->rUnsort>mxUnsort)
169049169416
){
169050169417
mxCost = pTo->rCost;
169051
- mxUnsorted = pTo->rUnsorted;
169418
+ mxUnsort = pTo->rUnsort;
169052169419
mxI = jj;
169053169420
}
169054169421
}
169055169422
}
169056169423
}
@@ -169058,12 +169425,14 @@
169058169425
169059169426
#ifdef WHERETRACE_ENABLED /* >=2 */
169060169427
if( sqlite3WhereTrace & 0x02 ){
169061169428
LogEst rMin, rFloor = 0;
169062169429
int nDone = 0;
169430
+ int nProgress;
169063169431
sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
169064
- while( nDone<nTo ){
169432
+ do{
169433
+ nProgress = 0;
169065169434
rMin = 0x7fff;
169066169435
for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){
169067169436
if( pTo->rCost>rFloor && pTo->rCost<rMin ) rMin = pTo->rCost;
169068169437
}
169069169438
for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){
@@ -169075,14 +169444,15 @@
169075169444
sqlite3DebugPrintf(" rev=0x%llx\n", pTo->revLoop);
169076169445
}else{
169077169446
sqlite3DebugPrintf("\n");
169078169447
}
169079169448
nDone++;
169449
+ nProgress++;
169080169450
}
169081169451
}
169082169452
rFloor = rMin;
169083
- }
169453
+ }while( nDone<nTo && nProgress>0 );
169084169454
}
169085169455
#endif
169086169456
169087169457
/* Swap the roles of aFrom and aTo for the next generation */
169088169458
pFrom = aTo;
@@ -169172,11 +169542,14 @@
169172169542
pWInfo->revMask = revMask;
169173169543
}
169174169544
}
169175169545
}
169176169546
169177
- pWInfo->nRowOut = pFrom->nRow + pWInfo->nOutStarDelta;
169547
+ pWInfo->nRowOut = pFrom->nRow;
169548
+#ifdef WHERETRACE_ENABLED
169549
+ pWInfo->rTotalCost = pFrom->rCost;
169550
+#endif
169178169551
169179169552
/* Free temporary memory and return success */
169180169553
sqlite3StackFreeNN(pParse->db, pSpace);
169181169554
return SQLITE_OK;
169182169555
}
@@ -169570,11 +169943,10 @@
169570169943
pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName,
169571169944
(double)sqlite3LogEstToInt(pTab->nRowLogEst)));
169572169945
}
169573169946
}
169574169947
nSearch += pLoop->nOut;
169575
- if( pWInfo->nOutStarDelta ) nSearch += pLoop->rStarDelta;
169576169948
}
169577169949
}
169578169950
169579169951
/*
169580169952
** The index pIdx is used by a query and contains one or more expressions.
@@ -170053,11 +170425,12 @@
170053170425
goto whereBeginError;
170054170426
}
170055170427
assert( db->mallocFailed==0 );
170056170428
#ifdef WHERETRACE_ENABLED
170057170429
if( sqlite3WhereTrace ){
170058
- sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut);
170430
+ sqlite3DebugPrintf("---- Solution cost=%d, nRow=%d",
170431
+ pWInfo->rTotalCost, pWInfo->nRowOut);
170059170432
if( pWInfo->nOBSat>0 ){
170060170433
sqlite3DebugPrintf(" ORDERBY=%d,0x%llx", pWInfo->nOBSat, pWInfo->revMask);
170061170434
}
170062170435
switch( pWInfo->eDistinct ){
170063170436
case WHERE_DISTINCT_UNIQUE: {
@@ -170414,10 +170787,11 @@
170414170787
int pc,
170415170788
VdbeOp *pOp
170416170789
){
170417170790
if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return;
170418170791
sqlite3VdbePrintOp(0, pc, pOp);
170792
+ sqlite3ShowWhereTerm(0); /* So compiler won't complain about unused func */
170419170793
}
170420170794
#endif
170421170795
170422170796
/*
170423170797
** Generate the end of the WHERE loop. See comments on
@@ -172523,11 +172897,11 @@
172523172897
sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ);
172524172898
}
172525172899
sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep,
172526172900
bInverse, regArg, pWin->regAccum);
172527172901
sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF);
172528
- sqlite3VdbeChangeP5(v, (u8)nArg);
172902
+ sqlite3VdbeChangeP5(v, (u16)nArg);
172529172903
if( pWin->bExprArgs ){
172530172904
sqlite3ReleaseTempRange(pParse, regArg, nArg);
172531172905
}
172532172906
}
172533172907
@@ -173907,10 +174281,15 @@
173907174281
** to the original parse.y sources.
173908174282
*/
173909174283
173910174284
/* #include "sqliteInt.h" */
173911174285
174286
+/*
174287
+** Verify that the pParse->isCreate field is set
174288
+*/
174289
+#define ASSERT_IS_CREATE assert(pParse->isCreate)
174290
+
173912174291
/*
173913174292
** Disable all error recovery processing in the parser push-down
173914174293
** automaton.
173915174294
*/
173916174295
#define YYNOERRORRECOVERY 1
@@ -173970,10 +174349,14 @@
173970174349
** shared across database connections.
173971174350
*/
173972174351
static void disableLookaside(Parse *pParse){
173973174352
sqlite3 *db = pParse->db;
173974174353
pParse->disableLookaside++;
174354
+#ifdef SQLITE_DEBUG
174355
+ pParse->isCreate = 1;
174356
+#endif
174357
+ memset(&pParse->u1.cr, 0, sizeof(pParse->u1.cr));
173975174358
DisableLookaside;
173976174359
}
173977174360
173978174361
#if !defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) \
173979174362
&& defined(SQLITE_UDL_CAPABLE_PARSER)
@@ -174310,11 +174693,12 @@
174310174693
#define TK_ASTERISK 180
174311174694
#define TK_SPAN 181
174312174695
#define TK_ERROR 182
174313174696
#define TK_QNUMBER 183
174314174697
#define TK_SPACE 184
174315
-#define TK_ILLEGAL 185
174698
+#define TK_COMMENT 185
174699
+#define TK_ILLEGAL 186
174316174700
#endif
174317174701
/**************** End token definitions ***************************************/
174318174702
174319174703
/* The next sections is a series of control #defines.
174320174704
** various aspects of the generated parser.
@@ -174375,35 +174759,35 @@
174375174759
#ifndef INTERFACE
174376174760
# define INTERFACE 1
174377174761
#endif
174378174762
/************* Begin control #defines *****************************************/
174379174763
#define YYCODETYPE unsigned short int
174380
-#define YYNOCODE 322
174764
+#define YYNOCODE 323
174381174765
#define YYACTIONTYPE unsigned short int
174382174766
#define YYWILDCARD 102
174383174767
#define sqlite3ParserTOKENTYPE Token
174384174768
typedef union {
174385174769
int yyinit;
174386174770
sqlite3ParserTOKENTYPE yy0;
174387
- ExprList* yy14;
174388
- With* yy59;
174389
- Cte* yy67;
174390
- Upsert* yy122;
174391
- IdList* yy132;
174392
- int yy144;
174393
- const char* yy168;
174394
- SrcList* yy203;
174395
- Window* yy211;
174396
- OnOrUsing yy269;
174397
- struct TrigEvent yy286;
174398
- struct {int value; int mask;} yy383;
174399
- u32 yy391;
174400
- TriggerStep* yy427;
174401
- Expr* yy454;
174402
- u8 yy462;
174403
- struct FrameBound yy509;
174404
- Select* yy555;
174771
+ u32 yy9;
174772
+ struct TrigEvent yy28;
174773
+ With* yy125;
174774
+ IdList* yy204;
174775
+ struct FrameBound yy205;
174776
+ TriggerStep* yy319;
174777
+ const char* yy342;
174778
+ Cte* yy361;
174779
+ ExprList* yy402;
174780
+ Upsert* yy403;
174781
+ OnOrUsing yy421;
174782
+ u8 yy444;
174783
+ struct {int value; int mask;} yy481;
174784
+ Window* yy483;
174785
+ int yy502;
174786
+ SrcList* yy563;
174787
+ Expr* yy590;
174788
+ Select* yy637;
174405174789
} YYMINORTYPE;
174406174790
#ifndef YYSTACKDEPTH
174407174791
#define YYSTACKDEPTH 100
174408174792
#endif
174409174793
#define sqlite3ParserARG_SDECL
@@ -174421,21 +174805,21 @@
174421174805
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
174422174806
#define YYFALLBACK 1
174423174807
#define YYNSTATE 583
174424174808
#define YYNRULE 409
174425174809
#define YYNRULE_WITH_ACTION 344
174426
-#define YYNTOKEN 186
174810
+#define YYNTOKEN 187
174427174811
#define YY_MAX_SHIFT 582
174428174812
#define YY_MIN_SHIFTREDUCE 845
174429174813
#define YY_MAX_SHIFTREDUCE 1253
174430174814
#define YY_ERROR_ACTION 1254
174431174815
#define YY_ACCEPT_ACTION 1255
174432174816
#define YY_NO_ACTION 1256
174433174817
#define YY_MIN_REDUCE 1257
174434174818
#define YY_MAX_REDUCE 1665
174435
-#define YY_MIN_DSTRCTR 205
174436
-#define YY_MAX_DSTRCTR 319
174819
+#define YY_MIN_DSTRCTR 206
174820
+#define YY_MAX_DSTRCTR 320
174437174821
/************* End control #defines *******************************************/
174438174822
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
174439174823
174440174824
/* Define the yytestcase() macro to be a no-op if is not already defined
174441174825
** otherwise.
@@ -174527,573 +174911,573 @@
174527174911
/* 60 */ 288, 288, 182, 288, 288, 481, 536, 288, 288, 130,
174528174912
/* 70 */ 127, 234, 432, 573, 525, 562, 573, 557, 562, 1290,
174529174913
/* 80 */ 573, 421, 562, 137, 138, 91, 559, 1228, 1228, 1063,
174530174914
/* 90 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 296,
174531174915
/* 100 */ 460, 398, 1249, 134, 134, 134, 134, 133, 133, 132,
174532
- /* 110 */ 132, 132, 131, 128, 451, 44, 1050, 1050, 1064, 1067,
174916
+ /* 110 */ 132, 132, 131, 128, 451, 451, 1050, 1050, 1064, 1067,
174533174917
/* 120 */ 1255, 1, 1, 582, 2, 1259, 581, 1174, 1259, 1174,
174534
- /* 130 */ 321, 413, 155, 321, 1584, 155, 379, 112, 498, 1341,
174918
+ /* 130 */ 321, 413, 155, 321, 1584, 155, 379, 112, 481, 1341,
174535174919
/* 140 */ 456, 299, 1341, 134, 134, 134, 134, 133, 133, 132,
174536
- /* 150 */ 132, 132, 131, 128, 451, 137, 138, 91, 1105, 1228,
174920
+ /* 150 */ 132, 132, 131, 128, 451, 137, 138, 91, 498, 1228,
174537174921
/* 160 */ 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136,
174538
- /* 170 */ 136, 1204, 320, 567, 288, 288, 283, 288, 288, 523,
174539
- /* 180 */ 523, 1250, 139, 1541, 7, 214, 503, 573, 1169, 562,
174540
- /* 190 */ 573, 1054, 562, 136, 136, 136, 136, 129, 401, 547,
174541
- /* 200 */ 487, 1169, 245, 1568, 1169, 245, 133, 133, 132, 132,
174542
- /* 210 */ 132, 131, 128, 451, 261, 134, 134, 134, 134, 133,
174543
- /* 220 */ 133, 132, 132, 132, 131, 128, 451, 451, 1204, 1205,
174544
- /* 230 */ 1204, 130, 127, 234, 455, 413, 182, 455, 130, 127,
174922
+ /* 170 */ 136, 1204, 862, 1281, 288, 288, 283, 288, 288, 523,
174923
+ /* 180 */ 523, 1250, 139, 578, 7, 578, 1345, 573, 1169, 562,
174924
+ /* 190 */ 573, 1054, 562, 136, 136, 136, 136, 129, 573, 547,
174925
+ /* 200 */ 562, 1169, 245, 1541, 1169, 245, 133, 133, 132, 132,
174926
+ /* 210 */ 132, 131, 128, 451, 302, 134, 134, 134, 134, 133,
174927
+ /* 220 */ 133, 132, 132, 132, 131, 128, 451, 1575, 1204, 1205,
174928
+ /* 230 */ 1204, 7, 470, 550, 455, 413, 550, 455, 130, 127,
174545174929
/* 240 */ 234, 134, 134, 134, 134, 133, 133, 132, 132, 132,
174546
- /* 250 */ 131, 128, 451, 136, 136, 136, 136, 538, 576, 137,
174547
- /* 260 */ 138, 91, 261, 1228, 1228, 1063, 1066, 1053, 1053, 135,
174548
- /* 270 */ 135, 136, 136, 136, 136, 44, 472, 346, 1204, 472,
174549
- /* 280 */ 346, 51, 51, 418, 93, 157, 134, 134, 134, 134,
174550
- /* 290 */ 133, 133, 132, 132, 132, 131, 128, 451, 166, 363,
174551
- /* 300 */ 298, 134, 134, 134, 134, 133, 133, 132, 132, 132,
174552
- /* 310 */ 131, 128, 451, 1293, 461, 1570, 423, 377, 275, 134,
174930
+ /* 250 */ 131, 128, 451, 136, 136, 136, 136, 538, 483, 137,
174931
+ /* 260 */ 138, 91, 1019, 1228, 1228, 1063, 1066, 1053, 1053, 135,
174932
+ /* 270 */ 135, 136, 136, 136, 136, 1085, 576, 1204, 132, 132,
174933
+ /* 280 */ 132, 131, 128, 451, 93, 214, 134, 134, 134, 134,
174934
+ /* 290 */ 133, 133, 132, 132, 132, 131, 128, 451, 401, 19,
174935
+ /* 300 */ 19, 134, 134, 134, 134, 133, 133, 132, 132, 132,
174936
+ /* 310 */ 131, 128, 451, 1498, 426, 267, 344, 467, 332, 134,
174553174937
/* 320 */ 134, 134, 134, 133, 133, 132, 132, 132, 131, 128,
174554
- /* 330 */ 451, 418, 320, 567, 1292, 1204, 1205, 1204, 257, 413,
174555
- /* 340 */ 483, 511, 508, 507, 94, 132, 132, 132, 131, 128,
174556
- /* 350 */ 451, 506, 1204, 548, 548, 388, 576, 384, 7, 413,
174557
- /* 360 */ 550, 229, 522, 137, 138, 91, 530, 1228, 1228, 1063,
174558
- /* 370 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 51,
174559
- /* 380 */ 51, 1582, 380, 137, 138, 91, 331, 1228, 1228, 1063,
174560
- /* 390 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 320,
174561
- /* 400 */ 567, 288, 288, 320, 567, 1602, 582, 2, 1259, 1204,
174562
- /* 410 */ 1205, 1204, 1628, 321, 573, 155, 562, 576, 1511, 264,
174563
- /* 420 */ 231, 520, 1341, 134, 134, 134, 134, 133, 133, 132,
174564
- /* 430 */ 132, 132, 131, 128, 451, 519, 1511, 1513, 1333, 1333,
174565
- /* 440 */ 82, 82, 498, 134, 134, 134, 134, 133, 133, 132,
174566
- /* 450 */ 132, 132, 131, 128, 451, 1435, 257, 288, 288, 511,
174567
- /* 460 */ 508, 507, 944, 1568, 413, 1019, 1204, 943, 360, 506,
174568
- /* 470 */ 573, 1598, 562, 44, 575, 551, 551, 557, 1107, 1582,
174569
- /* 480 */ 544, 576, 1107, 40, 417, 245, 531, 1505, 137, 138,
174938
+ /* 330 */ 451, 1281, 576, 6, 1204, 1205, 1204, 257, 576, 413,
174939
+ /* 340 */ 511, 508, 507, 1279, 94, 1019, 464, 1204, 551, 551,
174940
+ /* 350 */ 506, 1224, 1571, 44, 38, 51, 51, 411, 576, 413,
174941
+ /* 360 */ 45, 51, 51, 137, 138, 91, 530, 1228, 1228, 1063,
174942
+ /* 370 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 398,
174943
+ /* 380 */ 1148, 82, 82, 137, 138, 91, 39, 1228, 1228, 1063,
174944
+ /* 390 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 344,
174945
+ /* 400 */ 44, 288, 288, 375, 1204, 1205, 1204, 209, 1204, 1224,
174946
+ /* 410 */ 320, 567, 471, 576, 573, 576, 562, 576, 316, 264,
174947
+ /* 420 */ 231, 46, 160, 134, 134, 134, 134, 133, 133, 132,
174948
+ /* 430 */ 132, 132, 131, 128, 451, 303, 82, 82, 82, 82,
174949
+ /* 440 */ 82, 82, 442, 134, 134, 134, 134, 133, 133, 132,
174950
+ /* 450 */ 132, 132, 131, 128, 451, 1582, 544, 320, 567, 1250,
174951
+ /* 460 */ 874, 1582, 380, 382, 413, 1204, 1205, 1204, 360, 182,
174952
+ /* 470 */ 288, 288, 1576, 557, 1339, 557, 7, 557, 1277, 472,
174953
+ /* 480 */ 346, 526, 531, 573, 556, 562, 439, 1511, 137, 138,
174570174954
/* 490 */ 91, 219, 1228, 1228, 1063, 1066, 1053, 1053, 135, 135,
174571
- /* 500 */ 136, 136, 136, 136, 81, 81, 1281, 1204, 413, 553,
174572
- /* 510 */ 1511, 48, 512, 448, 447, 493, 578, 455, 578, 344,
174573
- /* 520 */ 45, 1204, 1233, 1204, 1205, 1204, 428, 1235, 158, 882,
174574
- /* 530 */ 320, 567, 137, 138, 91, 1234, 1228, 1228, 1063, 1066,
174955
+ /* 500 */ 136, 136, 136, 136, 465, 1511, 1513, 532, 413, 288,
174956
+ /* 510 */ 288, 423, 512, 288, 288, 411, 288, 288, 874, 130,
174957
+ /* 520 */ 127, 234, 573, 1107, 562, 1204, 573, 1107, 562, 573,
174958
+ /* 530 */ 560, 562, 137, 138, 91, 1293, 1228, 1228, 1063, 1066,
174575174959
/* 540 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 134, 134,
174576174960
/* 550 */ 134, 134, 133, 133, 132, 132, 132, 131, 128, 451,
174577
- /* 560 */ 1236, 576, 1236, 329, 1204, 1205, 1204, 387, 492, 403,
174578
- /* 570 */ 1040, 382, 489, 123, 568, 1569, 4, 377, 1204, 1205,
174579
- /* 580 */ 1204, 570, 570, 570, 82, 82, 882, 1029, 1331, 1331,
174580
- /* 590 */ 571, 1028, 134, 134, 134, 134, 133, 133, 132, 132,
174581
- /* 600 */ 132, 131, 128, 451, 288, 288, 1281, 1204, 576, 423,
174582
- /* 610 */ 576, 1568, 413, 423, 452, 378, 886, 573, 1279, 562,
174583
- /* 620 */ 46, 557, 532, 1028, 1028, 1030, 565, 130, 127, 234,
174584
- /* 630 */ 556, 82, 82, 82, 82, 479, 137, 138, 91, 462,
174961
+ /* 560 */ 493, 503, 1292, 1204, 257, 288, 288, 511, 508, 507,
174962
+ /* 570 */ 1204, 1628, 1169, 123, 568, 275, 4, 506, 573, 1511,
174963
+ /* 580 */ 562, 331, 1204, 1205, 1204, 1169, 548, 548, 1169, 261,
174964
+ /* 590 */ 571, 7, 134, 134, 134, 134, 133, 133, 132, 132,
174965
+ /* 600 */ 132, 131, 128, 451, 108, 533, 130, 127, 234, 1204,
174966
+ /* 610 */ 448, 447, 413, 1451, 452, 983, 886, 96, 1598, 1233,
174967
+ /* 620 */ 1204, 1205, 1204, 984, 1235, 1450, 565, 1204, 1205, 1204,
174968
+ /* 630 */ 229, 522, 1234, 534, 1333, 1333, 137, 138, 91, 1449,
174585174969
/* 640 */ 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136,
174586
- /* 650 */ 136, 136, 1188, 487, 1506, 1040, 413, 6, 1204, 50,
174587
- /* 660 */ 879, 121, 121, 948, 1204, 1205, 1204, 358, 557, 122,
174588
- /* 670 */ 316, 452, 577, 452, 535, 1204, 1028, 439, 303, 212,
174589
- /* 680 */ 137, 138, 91, 213, 1228, 1228, 1063, 1066, 1053, 1053,
174970
+ /* 650 */ 136, 136, 373, 1595, 971, 1040, 413, 1236, 418, 1236,
174971
+ /* 660 */ 879, 121, 121, 948, 373, 1595, 1204, 1205, 1204, 122,
174972
+ /* 670 */ 1204, 452, 577, 452, 363, 417, 1028, 882, 373, 1595,
174973
+ /* 680 */ 137, 138, 91, 462, 1228, 1228, 1063, 1066, 1053, 1053,
174590174974
/* 690 */ 135, 135, 136, 136, 136, 136, 134, 134, 134, 134,
174591174975
/* 700 */ 133, 133, 132, 132, 132, 131, 128, 451, 1028, 1028,
174592
- /* 710 */ 1030, 1031, 35, 288, 288, 1204, 1205, 1204, 1040, 1339,
174593
- /* 720 */ 533, 123, 568, 1569, 4, 377, 573, 1019, 562, 353,
174594
- /* 730 */ 1277, 356, 1204, 1205, 1204, 1029, 488, 1188, 571, 1028,
174976
+ /* 710 */ 1030, 1031, 35, 570, 570, 570, 197, 423, 1040, 198,
174977
+ /* 720 */ 1204, 123, 568, 1204, 4, 320, 567, 1204, 1205, 1204,
174978
+ /* 730 */ 40, 388, 576, 384, 882, 1029, 423, 1188, 571, 1028,
174595174979
/* 740 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
174596
- /* 750 */ 128, 451, 576, 343, 288, 288, 449, 449, 449, 971,
174597
- /* 760 */ 413, 1627, 452, 911, 1187, 288, 288, 573, 464, 562,
174598
- /* 770 */ 238, 1028, 1028, 1030, 565, 82, 82, 498, 573, 411,
174599
- /* 780 */ 562, 344, 467, 332, 137, 138, 91, 197, 1228, 1228,
174980
+ /* 750 */ 128, 451, 529, 1568, 1204, 19, 19, 1204, 575, 492,
174981
+ /* 760 */ 413, 157, 452, 489, 1187, 1331, 1331, 5, 1204, 949,
174982
+ /* 770 */ 431, 1028, 1028, 1030, 565, 22, 22, 1204, 1205, 1204,
174983
+ /* 780 */ 1204, 1205, 1204, 477, 137, 138, 91, 212, 1228, 1228,
174600174984
/* 790 */ 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136, 136,
174601
- /* 800 */ 1188, 528, 1169, 1040, 413, 1110, 1110, 495, 1041, 121,
174602
- /* 810 */ 121, 1204, 317, 540, 862, 1169, 1244, 122, 1169, 452,
174603
- /* 820 */ 577, 452, 1340, 198, 1028, 1204, 481, 526, 137, 138,
174604
- /* 830 */ 91, 560, 1228, 1228, 1063, 1066, 1053, 1053, 135, 135,
174985
+ /* 800 */ 1188, 48, 111, 1040, 413, 1204, 213, 970, 1041, 121,
174986
+ /* 810 */ 121, 1204, 1205, 1204, 1204, 1205, 1204, 122, 221, 452,
174987
+ /* 820 */ 577, 452, 44, 487, 1028, 1204, 1205, 1204, 137, 138,
174988
+ /* 830 */ 91, 378, 1228, 1228, 1063, 1066, 1053, 1053, 135, 135,
174605174989
/* 840 */ 136, 136, 136, 136, 134, 134, 134, 134, 133, 133,
174606174990
/* 850 */ 132, 132, 132, 131, 128, 451, 1028, 1028, 1030, 1031,
174607
- /* 860 */ 35, 1204, 288, 288, 1204, 477, 288, 288, 1204, 1205,
174608
- /* 870 */ 1204, 539, 481, 437, 470, 573, 1451, 562, 364, 573,
174609
- /* 880 */ 1153, 562, 1204, 1205, 1204, 1188, 5, 576, 134, 134,
174991
+ /* 860 */ 35, 461, 1204, 1205, 1204, 1569, 1040, 377, 214, 1149,
174992
+ /* 870 */ 1657, 535, 1657, 437, 902, 320, 567, 1568, 364, 320,
174993
+ /* 880 */ 567, 412, 329, 1029, 519, 1188, 3, 1028, 134, 134,
174610174994
/* 890 */ 134, 134, 133, 133, 132, 132, 132, 131, 128, 451,
174611
- /* 900 */ 221, 214, 302, 96, 1149, 1657, 232, 1657, 413, 392,
174612
- /* 910 */ 19, 19, 1024, 949, 406, 373, 1595, 1085, 1204, 1205,
174613
- /* 920 */ 1204, 1204, 1205, 1204, 1204, 426, 1149, 1658, 413, 1658,
174614
- /* 930 */ 1659, 399, 137, 138, 91, 3, 1228, 1228, 1063, 1066,
174615
- /* 940 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 304, 1311,
174616
- /* 950 */ 514, 1204, 137, 138, 91, 1498, 1228, 1228, 1063, 1066,
174617
- /* 960 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 434, 131,
174618
- /* 970 */ 128, 451, 375, 1204, 274, 291, 372, 517, 367, 516,
174619
- /* 980 */ 262, 1204, 1205, 1204, 1147, 227, 363, 448, 447, 1435,
174620
- /* 990 */ 1568, 1310, 134, 134, 134, 134, 133, 133, 132, 132,
174621
- /* 1000 */ 132, 131, 128, 451, 1568, 576, 1147, 487, 1204, 1205,
174622
- /* 1010 */ 1204, 442, 134, 134, 134, 134, 133, 133, 132, 132,
174623
- /* 1020 */ 132, 131, 128, 451, 386, 576, 485, 576, 19, 19,
174624
- /* 1030 */ 1204, 1205, 1204, 1345, 1236, 970, 1236, 574, 47, 936,
174625
- /* 1040 */ 936, 473, 413, 431, 1552, 573, 1125, 562, 19, 19,
174626
- /* 1050 */ 19, 19, 49, 336, 850, 851, 852, 111, 1368, 315,
174627
- /* 1060 */ 429, 576, 413, 433, 341, 306, 137, 138, 91, 115,
174995
+ /* 900 */ 1659, 399, 1169, 307, 893, 307, 515, 576, 413, 214,
174996
+ /* 910 */ 498, 944, 1024, 540, 903, 1169, 943, 392, 1169, 1028,
174997
+ /* 920 */ 1028, 1030, 406, 298, 1204, 50, 1149, 1658, 413, 1658,
174998
+ /* 930 */ 145, 145, 137, 138, 91, 293, 1228, 1228, 1063, 1066,
174999
+ /* 940 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 1188, 1147,
175000
+ /* 950 */ 514, 1568, 137, 138, 91, 1505, 1228, 1228, 1063, 1066,
175001
+ /* 960 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 434, 323,
175002
+ /* 970 */ 435, 539, 111, 1506, 274, 291, 372, 517, 367, 516,
175003
+ /* 980 */ 262, 1204, 1205, 1204, 1574, 481, 363, 576, 7, 1569,
175004
+ /* 990 */ 1568, 377, 134, 134, 134, 134, 133, 133, 132, 132,
175005
+ /* 1000 */ 132, 131, 128, 451, 1568, 576, 1147, 576, 232, 576,
175006
+ /* 1010 */ 19, 19, 134, 134, 134, 134, 133, 133, 132, 132,
175007
+ /* 1020 */ 132, 131, 128, 451, 1169, 433, 576, 1207, 19, 19,
175008
+ /* 1030 */ 19, 19, 19, 19, 1627, 576, 911, 1169, 47, 120,
175009
+ /* 1040 */ 1169, 117, 413, 306, 498, 438, 1125, 206, 336, 19,
175010
+ /* 1050 */ 19, 1435, 49, 449, 449, 449, 1368, 315, 81, 81,
175011
+ /* 1060 */ 576, 304, 413, 1570, 207, 377, 137, 138, 91, 115,
174628175012
/* 1070 */ 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136,
174629
- /* 1080 */ 136, 136, 576, 1309, 82, 82, 137, 138, 91, 529,
175013
+ /* 1080 */ 136, 136, 576, 82, 82, 1207, 137, 138, 91, 1340,
174630175014
/* 1090 */ 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136,
174631
- /* 1100 */ 136, 136, 1569, 222, 377, 19, 19, 305, 1126, 1169,
174632
- /* 1110 */ 398, 1148, 22, 22, 498, 333, 1569, 335, 377, 576,
174633
- /* 1120 */ 438, 445, 1169, 1127, 486, 1169, 134, 134, 134, 134,
175015
+ /* 1100 */ 136, 136, 1569, 386, 377, 82, 82, 463, 1126, 1552,
175016
+ /* 1110 */ 333, 463, 335, 131, 128, 451, 1569, 161, 377, 16,
175017
+ /* 1120 */ 317, 387, 428, 1127, 448, 447, 134, 134, 134, 134,
174634175018
/* 1130 */ 133, 133, 132, 132, 132, 131, 128, 451, 1128, 576,
174635
- /* 1140 */ 902, 576, 145, 145, 6, 576, 134, 134, 134, 134,
174636
- /* 1150 */ 133, 133, 132, 132, 132, 131, 128, 451, 214, 1336,
174637
- /* 1160 */ 922, 576, 19, 19, 19, 19, 1282, 419, 19, 19,
174638
- /* 1170 */ 923, 412, 515, 141, 576, 1169, 413, 206, 465, 207,
174639
- /* 1180 */ 903, 215, 1575, 552, 147, 147, 7, 227, 1169, 411,
174640
- /* 1190 */ 1250, 1169, 120, 307, 117, 307, 413, 66, 66, 334,
175019
+ /* 1140 */ 1105, 10, 445, 267, 576, 1554, 134, 134, 134, 134,
175020
+ /* 1150 */ 133, 133, 132, 132, 132, 131, 128, 451, 532, 576,
175021
+ /* 1160 */ 922, 576, 19, 19, 576, 1573, 576, 147, 147, 7,
175022
+ /* 1170 */ 923, 1236, 498, 1236, 576, 487, 413, 552, 285, 1224,
175023
+ /* 1180 */ 969, 215, 82, 82, 66, 66, 1435, 67, 67, 21,
175024
+ /* 1190 */ 21, 1110, 1110, 495, 334, 297, 413, 53, 53, 297,
174641175025
/* 1200 */ 137, 138, 91, 119, 1228, 1228, 1063, 1066, 1053, 1053,
174642
- /* 1210 */ 135, 135, 136, 136, 136, 136, 413, 285, 209, 969,
174643
- /* 1220 */ 137, 138, 91, 471, 1228, 1228, 1063, 1066, 1053, 1053,
174644
- /* 1230 */ 135, 135, 136, 136, 136, 136, 435, 10, 1450, 267,
174645
- /* 1240 */ 137, 126, 91, 1435, 1228, 1228, 1063, 1066, 1053, 1053,
174646
- /* 1250 */ 135, 135, 136, 136, 136, 136, 1435, 1435, 410, 409,
175026
+ /* 1210 */ 135, 135, 136, 136, 136, 136, 413, 1336, 1311, 446,
175027
+ /* 1220 */ 137, 138, 91, 227, 1228, 1228, 1063, 1066, 1053, 1053,
175028
+ /* 1230 */ 135, 135, 136, 136, 136, 136, 574, 1224, 936, 936,
175029
+ /* 1240 */ 137, 126, 91, 141, 1228, 1228, 1063, 1066, 1053, 1053,
175030
+ /* 1250 */ 135, 135, 136, 136, 136, 136, 533, 429, 472, 346,
174647175031
/* 1260 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
174648
- /* 1270 */ 128, 451, 576, 969, 576, 1224, 498, 373, 1595, 1554,
175032
+ /* 1270 */ 128, 451, 576, 457, 233, 343, 1435, 403, 498, 1550,
174649175033
/* 1280 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
174650
- /* 1290 */ 128, 451, 532, 457, 576, 82, 82, 82, 82, 111,
175034
+ /* 1290 */ 128, 451, 576, 324, 576, 82, 82, 487, 576, 969,
174651175035
/* 1300 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
174652
- /* 1310 */ 128, 451, 109, 233, 430, 1576, 546, 67, 67, 7,
174653
- /* 1320 */ 413, 351, 550, 1550, 260, 259, 258, 494, 443, 569,
174654
- /* 1330 */ 419, 983, 446, 1224, 450, 545, 1207, 576, 969, 984,
174655
- /* 1340 */ 413, 475, 1449, 1574, 1180, 138, 91, 7, 1228, 1228,
175036
+ /* 1310 */ 128, 451, 288, 288, 546, 68, 68, 54, 54, 553,
175037
+ /* 1320 */ 413, 69, 69, 351, 6, 573, 944, 562, 410, 409,
175038
+ /* 1330 */ 1435, 943, 450, 545, 260, 259, 258, 576, 158, 576,
175039
+ /* 1340 */ 413, 222, 1180, 479, 969, 138, 91, 430, 1228, 1228,
174656175040
/* 1350 */ 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136, 136,
174657
- /* 1360 */ 21, 21, 267, 576, 300, 1126, 91, 233, 1228, 1228,
175041
+ /* 1360 */ 70, 70, 71, 71, 576, 1126, 91, 576, 1228, 1228,
174658175042
/* 1370 */ 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136, 136,
174659
- /* 1380 */ 1127, 373, 1595, 161, 1573, 16, 53, 53, 7, 108,
174660
- /* 1390 */ 533, 38, 969, 125, 1207, 1128, 1180, 576, 1224, 123,
174661
- /* 1400 */ 568, 893, 4, 324, 134, 134, 134, 134, 133, 133,
174662
- /* 1410 */ 132, 132, 132, 131, 128, 451, 571, 564, 534, 576,
174663
- /* 1420 */ 68, 68, 576, 39, 134, 134, 134, 134, 133, 133,
174664
- /* 1430 */ 132, 132, 132, 131, 128, 451, 576, 160, 1571, 1223,
174665
- /* 1440 */ 452, 576, 54, 54, 576, 69, 69, 576, 1366, 576,
174666
- /* 1450 */ 420, 184, 565, 463, 297, 576, 1224, 463, 297, 70,
174667
- /* 1460 */ 70, 576, 44, 474, 71, 71, 576, 72, 72, 576,
174668
- /* 1470 */ 73, 73, 55, 55, 411, 874, 242, 576, 56, 56,
174669
- /* 1480 */ 576, 1040, 576, 478, 57, 57, 576, 121, 121, 59,
174670
- /* 1490 */ 59, 23, 60, 60, 411, 122, 319, 452, 577, 452,
174671
- /* 1500 */ 74, 74, 1028, 75, 75, 76, 76, 411, 290, 20,
174672
- /* 1510 */ 20, 108, 287, 231, 553, 123, 568, 325, 4, 320,
174673
- /* 1520 */ 567, 97, 218, 944, 1144, 328, 400, 576, 943, 576,
174674
- /* 1530 */ 1380, 424, 571, 874, 1028, 1028, 1030, 1031, 35, 293,
174675
- /* 1540 */ 534, 576, 1104, 576, 1104, 9, 576, 342, 576, 111,
174676
- /* 1550 */ 77, 77, 143, 143, 576, 205, 452, 222, 1379, 889,
174677
- /* 1560 */ 576, 901, 900, 1188, 144, 144, 78, 78, 565, 62,
174678
- /* 1570 */ 62, 79, 79, 323, 1021, 576, 266, 63, 63, 908,
174679
- /* 1580 */ 909, 1589, 542, 80, 80, 576, 371, 541, 123, 568,
174680
- /* 1590 */ 480, 4, 266, 482, 244, 266, 370, 1040, 64, 64,
174681
- /* 1600 */ 576, 466, 576, 121, 121, 571, 1557, 576, 170, 170,
174682
- /* 1610 */ 576, 122, 576, 452, 577, 452, 576, 889, 1028, 576,
174683
- /* 1620 */ 165, 576, 111, 171, 171, 87, 87, 337, 1616, 452,
174684
- /* 1630 */ 65, 65, 1530, 83, 83, 146, 146, 986, 987, 84,
174685
- /* 1640 */ 84, 565, 168, 168, 148, 148, 1092, 347, 1032, 111,
174686
- /* 1650 */ 1028, 1028, 1030, 1031, 35, 542, 1103, 576, 1103, 576,
174687
- /* 1660 */ 543, 123, 568, 504, 4, 263, 576, 361, 1529, 111,
174688
- /* 1670 */ 1040, 1088, 576, 263, 576, 490, 121, 121, 571, 1188,
174689
- /* 1680 */ 142, 142, 169, 169, 122, 576, 452, 577, 452, 162,
174690
- /* 1690 */ 162, 1028, 576, 563, 576, 152, 152, 151, 151, 348,
174691
- /* 1700 */ 1376, 974, 452, 266, 1092, 942, 1032, 125, 149, 149,
174692
- /* 1710 */ 939, 576, 125, 576, 565, 150, 150, 86, 86, 872,
174693
- /* 1720 */ 352, 159, 576, 1028, 1028, 1030, 1031, 35, 542, 941,
174694
- /* 1730 */ 576, 125, 355, 541, 88, 88, 85, 85, 357, 359,
174695
- /* 1740 */ 1324, 1308, 366, 1040, 376, 52, 52, 499, 1389, 121,
174696
- /* 1750 */ 121, 1434, 1188, 58, 58, 1362, 1374, 122, 1439, 452,
174697
- /* 1760 */ 577, 452, 1289, 167, 1028, 1280, 280, 1268, 1267, 1269,
174698
- /* 1770 */ 1609, 1359, 312, 313, 12, 314, 397, 1421, 224, 1416,
174699
- /* 1780 */ 295, 237, 1409, 339, 340, 1426, 301, 345, 484, 228,
174700
- /* 1790 */ 1371, 1307, 1372, 1370, 1425, 404, 1028, 1028, 1030, 1031,
174701
- /* 1800 */ 35, 1601, 1192, 454, 509, 369, 292, 1502, 210, 1501,
174702
- /* 1810 */ 1369, 396, 396, 395, 277, 393, 211, 566, 859, 1612,
174703
- /* 1820 */ 1244, 123, 568, 391, 4, 1188, 223, 270, 1549, 1547,
174704
- /* 1830 */ 1241, 239, 186, 327, 422, 96, 195, 220, 571, 235,
174705
- /* 1840 */ 180, 326, 188, 468, 190, 1507, 191, 192, 92, 193,
174706
- /* 1850 */ 469, 95, 1422, 13, 502, 247, 1430, 109, 199, 402,
174707
- /* 1860 */ 476, 405, 452, 1496, 1428, 1427, 14, 491, 251, 102,
174708
- /* 1870 */ 497, 1518, 241, 281, 565, 253, 203, 354, 500, 254,
174709
- /* 1880 */ 175, 1270, 407, 43, 350, 518, 1327, 436, 255, 1326,
174710
- /* 1890 */ 1325, 1318, 104, 893, 1626, 229, 408, 440, 1625, 441,
174711
- /* 1900 */ 240, 310, 1296, 1040, 311, 1317, 527, 1594, 1297, 121,
174712
- /* 1910 */ 121, 368, 1295, 1624, 268, 269, 1580, 122, 1579, 452,
174713
- /* 1920 */ 577, 452, 374, 444, 1028, 1394, 1393, 140, 553, 90,
174714
- /* 1930 */ 568, 11, 4, 1483, 383, 414, 385, 110, 116, 216,
174715
- /* 1940 */ 320, 567, 1350, 555, 42, 318, 571, 537, 1349, 389,
174716
- /* 1950 */ 390, 579, 1198, 276, 279, 278, 1028, 1028, 1030, 1031,
174717
- /* 1960 */ 35, 580, 415, 1265, 458, 1260, 416, 185, 1534, 172,
174718
- /* 1970 */ 452, 1535, 173, 156, 308, 846, 1533, 1532, 453, 217,
174719
- /* 1980 */ 225, 89, 565, 174, 322, 1188, 226, 236, 1102, 154,
174720
- /* 1990 */ 1100, 330, 176, 187, 1223, 189, 925, 338, 243, 1116,
174721
- /* 2000 */ 246, 194, 177, 178, 425, 427, 98, 99, 196, 100,
174722
- /* 2010 */ 101, 1040, 179, 1119, 248, 1115, 249, 121, 121, 24,
174723
- /* 2020 */ 163, 250, 349, 1108, 266, 122, 1238, 452, 577, 452,
174724
- /* 2030 */ 1192, 454, 1028, 200, 292, 496, 252, 201, 861, 396,
175043
+ /* 1380 */ 1127, 166, 850, 851, 852, 1282, 419, 72, 72, 108,
175044
+ /* 1390 */ 73, 73, 1310, 358, 1180, 1128, 576, 305, 576, 123,
175045
+ /* 1400 */ 568, 494, 4, 488, 134, 134, 134, 134, 133, 133,
175046
+ /* 1410 */ 132, 132, 132, 131, 128, 451, 571, 564, 534, 55,
175047
+ /* 1420 */ 55, 56, 56, 576, 134, 134, 134, 134, 133, 133,
175048
+ /* 1430 */ 132, 132, 132, 131, 128, 451, 576, 1104, 233, 1104,
175049
+ /* 1440 */ 452, 1602, 582, 2, 1259, 576, 57, 57, 576, 321,
175050
+ /* 1450 */ 576, 155, 565, 1435, 485, 353, 576, 356, 1341, 59,
175051
+ /* 1460 */ 59, 576, 44, 969, 569, 419, 576, 238, 60, 60,
175052
+ /* 1470 */ 261, 74, 74, 75, 75, 287, 231, 576, 1366, 76,
175053
+ /* 1480 */ 76, 1040, 420, 184, 20, 20, 576, 121, 121, 77,
175054
+ /* 1490 */ 77, 97, 218, 288, 288, 122, 125, 452, 577, 452,
175055
+ /* 1500 */ 143, 143, 1028, 576, 520, 576, 573, 576, 562, 144,
175056
+ /* 1510 */ 144, 474, 227, 1244, 478, 123, 568, 576, 4, 320,
175057
+ /* 1520 */ 567, 245, 411, 576, 443, 411, 78, 78, 62, 62,
175058
+ /* 1530 */ 79, 79, 571, 319, 1028, 1028, 1030, 1031, 35, 418,
175059
+ /* 1540 */ 63, 63, 576, 290, 411, 9, 80, 80, 1144, 576,
175060
+ /* 1550 */ 400, 576, 486, 455, 576, 1223, 452, 576, 325, 342,
175061
+ /* 1560 */ 576, 111, 576, 1188, 242, 64, 64, 473, 565, 576,
175062
+ /* 1570 */ 23, 576, 170, 170, 171, 171, 576, 87, 87, 328,
175063
+ /* 1580 */ 65, 65, 542, 83, 83, 146, 146, 541, 123, 568,
175064
+ /* 1590 */ 341, 4, 84, 84, 168, 168, 576, 1040, 576, 148,
175065
+ /* 1600 */ 148, 576, 1380, 121, 121, 571, 1021, 576, 266, 576,
175066
+ /* 1610 */ 424, 122, 576, 452, 577, 452, 576, 553, 1028, 142,
175067
+ /* 1620 */ 142, 169, 169, 576, 162, 162, 528, 889, 371, 452,
175068
+ /* 1630 */ 152, 152, 151, 151, 1379, 149, 149, 109, 370, 150,
175069
+ /* 1640 */ 150, 565, 576, 480, 576, 266, 86, 86, 576, 1092,
175070
+ /* 1650 */ 1028, 1028, 1030, 1031, 35, 542, 482, 576, 266, 466,
175071
+ /* 1660 */ 543, 123, 568, 1616, 4, 88, 88, 85, 85, 475,
175072
+ /* 1670 */ 1040, 52, 52, 222, 901, 900, 121, 121, 571, 1188,
175073
+ /* 1680 */ 58, 58, 244, 1032, 122, 889, 452, 577, 452, 908,
175074
+ /* 1690 */ 909, 1028, 300, 347, 504, 111, 263, 361, 165, 111,
175075
+ /* 1700 */ 111, 1088, 452, 263, 974, 1153, 266, 1092, 986, 987,
175076
+ /* 1710 */ 942, 939, 125, 125, 565, 1103, 872, 1103, 159, 941,
175077
+ /* 1720 */ 1309, 125, 1557, 1028, 1028, 1030, 1031, 35, 542, 337,
175078
+ /* 1730 */ 1530, 205, 1529, 541, 499, 1589, 490, 348, 1376, 352,
175079
+ /* 1740 */ 355, 1032, 357, 1040, 359, 1324, 1308, 366, 563, 121,
175080
+ /* 1750 */ 121, 376, 1188, 1389, 1434, 1362, 280, 122, 1374, 452,
175081
+ /* 1760 */ 577, 452, 167, 1439, 1028, 1289, 1280, 1268, 1267, 1269,
175082
+ /* 1770 */ 1609, 1359, 312, 313, 314, 397, 12, 237, 224, 1421,
175083
+ /* 1780 */ 295, 1416, 1409, 1426, 339, 484, 340, 509, 1371, 1612,
175084
+ /* 1790 */ 1372, 1425, 1244, 404, 301, 228, 1028, 1028, 1030, 1031,
175085
+ /* 1800 */ 35, 1601, 1192, 454, 345, 1307, 292, 369, 1502, 1501,
175086
+ /* 1810 */ 270, 396, 396, 395, 277, 393, 1370, 1369, 859, 1549,
175087
+ /* 1820 */ 186, 123, 568, 235, 4, 1188, 391, 210, 211, 223,
175088
+ /* 1830 */ 1547, 239, 1241, 327, 422, 96, 220, 195, 571, 180,
175089
+ /* 1840 */ 188, 326, 468, 469, 190, 191, 502, 192, 193, 566,
175090
+ /* 1850 */ 247, 109, 1430, 491, 199, 251, 102, 281, 402, 476,
175091
+ /* 1860 */ 405, 1496, 452, 497, 253, 1422, 13, 1428, 14, 1427,
175092
+ /* 1870 */ 203, 1507, 241, 500, 565, 354, 407, 92, 95, 1270,
175093
+ /* 1880 */ 175, 254, 518, 43, 1327, 255, 1326, 1325, 436, 1518,
175094
+ /* 1890 */ 350, 1318, 104, 229, 893, 1626, 440, 441, 1625, 408,
175095
+ /* 1900 */ 240, 1296, 268, 1040, 310, 269, 1297, 527, 444, 121,
175096
+ /* 1910 */ 121, 368, 1295, 1594, 1624, 311, 1394, 122, 1317, 452,
175097
+ /* 1920 */ 577, 452, 374, 1580, 1028, 1393, 140, 553, 11, 90,
175098
+ /* 1930 */ 568, 385, 4, 116, 318, 414, 1579, 110, 1483, 537,
175099
+ /* 1940 */ 320, 567, 1350, 555, 42, 579, 571, 1349, 1198, 383,
175100
+ /* 1950 */ 276, 390, 216, 389, 278, 279, 1028, 1028, 1030, 1031,
175101
+ /* 1960 */ 35, 172, 580, 1265, 458, 1260, 415, 416, 185, 156,
175102
+ /* 1970 */ 452, 1534, 1535, 173, 1533, 1532, 89, 308, 225, 226,
175103
+ /* 1980 */ 846, 174, 565, 453, 217, 1188, 322, 236, 1102, 154,
175104
+ /* 1990 */ 1100, 330, 187, 176, 1223, 243, 189, 925, 338, 246,
175105
+ /* 2000 */ 1116, 194, 177, 425, 178, 427, 98, 196, 99, 100,
175106
+ /* 2010 */ 101, 1040, 179, 1119, 1115, 248, 249, 121, 121, 163,
175107
+ /* 2020 */ 24, 250, 349, 1238, 496, 122, 1108, 452, 577, 452,
175108
+ /* 2030 */ 1192, 454, 1028, 266, 292, 200, 252, 201, 861, 396,
174725175109
/* 2040 */ 396, 395, 277, 393, 15, 501, 859, 370, 292, 256,
174726175110
/* 2050 */ 202, 554, 505, 396, 396, 395, 277, 393, 103, 239,
174727175111
/* 2060 */ 859, 327, 25, 26, 1028, 1028, 1030, 1031, 35, 326,
174728175112
/* 2070 */ 362, 510, 891, 239, 365, 327, 513, 904, 105, 309,
174729175113
/* 2080 */ 164, 181, 27, 326, 106, 521, 107, 1185, 1069, 1155,
174730
- /* 2090 */ 17, 1154, 284, 1188, 286, 978, 265, 204, 125, 1171,
174731
- /* 2100 */ 241, 230, 972, 1175, 28, 1160, 29, 1179, 175, 1173,
174732
- /* 2110 */ 30, 43, 31, 1178, 241, 32, 41, 549, 8, 33,
174733
- /* 2120 */ 208, 111, 175, 1083, 1070, 43, 113, 1068, 240, 114,
174734
- /* 2130 */ 1072, 34, 1073, 561, 1124, 118, 271, 36, 18, 1194,
174735
- /* 2140 */ 1033, 873, 240, 935, 124, 37, 272, 273, 1617, 572,
174736
- /* 2150 */ 183, 153, 394, 1193, 1256, 1256, 1256, 1256, 1256, 1256,
175114
+ /* 2090 */ 17, 1154, 230, 1188, 284, 286, 265, 204, 125, 1171,
175115
+ /* 2100 */ 241, 28, 978, 972, 29, 41, 1175, 1179, 175, 1173,
175116
+ /* 2110 */ 30, 43, 31, 8, 241, 1178, 32, 1160, 208, 549,
175117
+ /* 2120 */ 33, 111, 175, 1083, 1070, 43, 1068, 1072, 240, 113,
175118
+ /* 2130 */ 114, 34, 561, 118, 1124, 271, 1073, 36, 18, 572,
175119
+ /* 2140 */ 1033, 873, 240, 124, 37, 935, 272, 273, 1617, 183,
175120
+ /* 2150 */ 153, 394, 1194, 1193, 1256, 1256, 1256, 1256, 1256, 1256,
174737175121
/* 2160 */ 1256, 1256, 1256, 414, 1256, 1256, 1256, 1256, 320, 567,
174738175122
/* 2170 */ 1256, 1256, 1256, 1256, 1256, 1256, 1256, 414, 1256, 1256,
174739175123
/* 2180 */ 1256, 1256, 320, 567, 1256, 1256, 1256, 1256, 1256, 1256,
174740175124
/* 2190 */ 1256, 1256, 458, 1256, 1256, 1256, 1256, 1256, 1256, 1256,
174741175125
/* 2200 */ 1256, 1256, 1256, 1256, 1256, 1256, 458,
174742175126
};
174743175127
static const YYCODETYPE yy_lookahead[] = {
174744
- /* 0 */ 276, 277, 278, 240, 241, 224, 194, 226, 194, 240,
174745
- /* 10 */ 241, 194, 216, 220, 194, 234, 253, 194, 255, 19,
174746
- /* 20 */ 224, 297, 253, 194, 255, 205, 212, 213, 205, 217,
174747
- /* 30 */ 218, 31, 205, 194, 217, 218, 194, 217, 218, 39,
174748
- /* 40 */ 217, 218, 312, 43, 44, 45, 316, 47, 48, 49,
175128
+ /* 0 */ 277, 278, 279, 241, 242, 225, 195, 227, 195, 241,
175129
+ /* 10 */ 242, 195, 217, 221, 195, 235, 254, 195, 256, 19,
175130
+ /* 20 */ 225, 298, 254, 195, 256, 206, 213, 214, 206, 218,
175131
+ /* 30 */ 219, 31, 206, 195, 218, 219, 195, 218, 219, 39,
175132
+ /* 40 */ 218, 219, 313, 43, 44, 45, 317, 47, 48, 49,
174749175133
/* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 19,
174750
- /* 60 */ 240, 241, 194, 240, 241, 194, 254, 240, 241, 276,
174751
- /* 70 */ 277, 278, 233, 253, 254, 255, 253, 254, 255, 217,
174752
- /* 80 */ 253, 239, 255, 43, 44, 45, 263, 47, 48, 49,
174753
- /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 270,
174754
- /* 100 */ 286, 22, 23, 103, 104, 105, 106, 107, 108, 109,
174755
- /* 110 */ 110, 111, 112, 113, 114, 82, 47, 48, 49, 50,
174756
- /* 120 */ 186, 187, 188, 189, 190, 191, 189, 87, 191, 89,
174757
- /* 130 */ 196, 19, 198, 196, 317, 198, 319, 25, 194, 205,
174758
- /* 140 */ 298, 270, 205, 103, 104, 105, 106, 107, 108, 109,
174759
- /* 150 */ 110, 111, 112, 113, 114, 43, 44, 45, 11, 47,
175134
+ /* 60 */ 241, 242, 195, 241, 242, 195, 255, 241, 242, 277,
175135
+ /* 70 */ 278, 279, 234, 254, 255, 256, 254, 255, 256, 218,
175136
+ /* 80 */ 254, 240, 256, 43, 44, 45, 264, 47, 48, 49,
175137
+ /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 271,
175138
+ /* 100 */ 287, 22, 23, 103, 104, 105, 106, 107, 108, 109,
175139
+ /* 110 */ 110, 111, 112, 113, 114, 114, 47, 48, 49, 50,
175140
+ /* 120 */ 187, 188, 189, 190, 191, 192, 190, 87, 192, 89,
175141
+ /* 130 */ 197, 19, 199, 197, 318, 199, 320, 25, 195, 206,
175142
+ /* 140 */ 299, 271, 206, 103, 104, 105, 106, 107, 108, 109,
175143
+ /* 150 */ 110, 111, 112, 113, 114, 43, 44, 45, 195, 47,
174760175144
/* 160 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
174761
- /* 170 */ 58, 60, 139, 140, 240, 241, 214, 240, 241, 311,
174762
- /* 180 */ 312, 102, 70, 239, 316, 194, 19, 253, 77, 255,
174763
- /* 190 */ 253, 122, 255, 55, 56, 57, 58, 59, 207, 88,
174764
- /* 200 */ 194, 90, 268, 194, 93, 268, 107, 108, 109, 110,
174765
- /* 210 */ 111, 112, 113, 114, 47, 103, 104, 105, 106, 107,
174766
- /* 220 */ 108, 109, 110, 111, 112, 113, 114, 114, 117, 118,
174767
- /* 230 */ 119, 276, 277, 278, 300, 19, 194, 300, 276, 277,
174768
- /* 240 */ 278, 103, 104, 105, 106, 107, 108, 109, 110, 111,
174769
- /* 250 */ 112, 113, 114, 55, 56, 57, 58, 146, 194, 43,
174770
- /* 260 */ 44, 45, 47, 47, 48, 49, 50, 51, 52, 53,
174771
- /* 270 */ 54, 55, 56, 57, 58, 82, 129, 130, 60, 129,
174772
- /* 280 */ 130, 217, 218, 116, 68, 25, 103, 104, 105, 106,
174773
- /* 290 */ 107, 108, 109, 110, 111, 112, 113, 114, 23, 132,
174774
- /* 300 */ 294, 103, 104, 105, 106, 107, 108, 109, 110, 111,
174775
- /* 310 */ 112, 113, 114, 217, 121, 306, 194, 308, 26, 103,
175145
+ /* 170 */ 58, 60, 21, 195, 241, 242, 215, 241, 242, 312,
175146
+ /* 180 */ 313, 102, 70, 205, 317, 207, 242, 254, 77, 256,
175147
+ /* 190 */ 254, 122, 256, 55, 56, 57, 58, 59, 254, 88,
175148
+ /* 200 */ 256, 90, 269, 240, 93, 269, 107, 108, 109, 110,
175149
+ /* 210 */ 111, 112, 113, 114, 271, 103, 104, 105, 106, 107,
175150
+ /* 220 */ 108, 109, 110, 111, 112, 113, 114, 313, 117, 118,
175151
+ /* 230 */ 119, 317, 81, 195, 301, 19, 195, 301, 277, 278,
175152
+ /* 240 */ 279, 103, 104, 105, 106, 107, 108, 109, 110, 111,
175153
+ /* 250 */ 112, 113, 114, 55, 56, 57, 58, 146, 195, 43,
175154
+ /* 260 */ 44, 45, 74, 47, 48, 49, 50, 51, 52, 53,
175155
+ /* 270 */ 54, 55, 56, 57, 58, 124, 195, 60, 109, 110,
175156
+ /* 280 */ 111, 112, 113, 114, 68, 195, 103, 104, 105, 106,
175157
+ /* 290 */ 107, 108, 109, 110, 111, 112, 113, 114, 208, 218,
175158
+ /* 300 */ 219, 103, 104, 105, 106, 107, 108, 109, 110, 111,
175159
+ /* 310 */ 112, 113, 114, 162, 233, 24, 128, 129, 130, 103,
174776175160
/* 320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
174777
- /* 330 */ 114, 116, 139, 140, 217, 117, 118, 119, 120, 19,
174778
- /* 340 */ 194, 123, 124, 125, 24, 109, 110, 111, 112, 113,
174779
- /* 350 */ 114, 133, 60, 311, 312, 250, 194, 252, 316, 19,
174780
- /* 360 */ 194, 166, 167, 43, 44, 45, 205, 47, 48, 49,
174781
- /* 370 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 217,
174782
- /* 380 */ 218, 317, 318, 43, 44, 45, 264, 47, 48, 49,
174783
- /* 390 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 139,
174784
- /* 400 */ 140, 240, 241, 139, 140, 188, 189, 190, 191, 117,
174785
- /* 410 */ 118, 119, 231, 196, 253, 198, 255, 194, 194, 258,
174786
- /* 420 */ 259, 146, 205, 103, 104, 105, 106, 107, 108, 109,
174787
- /* 430 */ 110, 111, 112, 113, 114, 109, 212, 213, 236, 237,
174788
- /* 440 */ 217, 218, 194, 103, 104, 105, 106, 107, 108, 109,
174789
- /* 450 */ 110, 111, 112, 113, 114, 194, 120, 240, 241, 123,
174790
- /* 460 */ 124, 125, 136, 194, 19, 74, 60, 141, 23, 133,
174791
- /* 470 */ 253, 194, 255, 82, 194, 309, 310, 254, 29, 317,
174792
- /* 480 */ 318, 194, 33, 22, 199, 268, 263, 239, 43, 44,
175161
+ /* 330 */ 114, 195, 195, 215, 117, 118, 119, 120, 195, 19,
175162
+ /* 340 */ 123, 124, 125, 207, 24, 74, 246, 60, 310, 311,
175163
+ /* 350 */ 133, 60, 311, 82, 22, 218, 219, 257, 195, 19,
175164
+ /* 360 */ 73, 218, 219, 43, 44, 45, 206, 47, 48, 49,
175165
+ /* 370 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 22,
175166
+ /* 380 */ 23, 218, 219, 43, 44, 45, 54, 47, 48, 49,
175167
+ /* 390 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 128,
175168
+ /* 400 */ 82, 241, 242, 195, 117, 118, 119, 289, 60, 118,
175169
+ /* 410 */ 139, 140, 294, 195, 254, 195, 256, 195, 255, 259,
175170
+ /* 420 */ 260, 73, 22, 103, 104, 105, 106, 107, 108, 109,
175171
+ /* 430 */ 110, 111, 112, 113, 114, 206, 218, 219, 218, 219,
175172
+ /* 440 */ 218, 219, 234, 103, 104, 105, 106, 107, 108, 109,
175173
+ /* 450 */ 110, 111, 112, 113, 114, 318, 319, 139, 140, 102,
175174
+ /* 460 */ 60, 318, 319, 221, 19, 117, 118, 119, 23, 195,
175175
+ /* 470 */ 241, 242, 313, 255, 206, 255, 317, 255, 206, 129,
175176
+ /* 480 */ 130, 206, 264, 254, 264, 256, 264, 195, 43, 44,
174793175177
/* 490 */ 45, 151, 47, 48, 49, 50, 51, 52, 53, 54,
174794
- /* 500 */ 55, 56, 57, 58, 217, 218, 194, 60, 19, 146,
174795
- /* 510 */ 286, 242, 23, 107, 108, 66, 204, 300, 206, 128,
174796
- /* 520 */ 73, 60, 116, 117, 118, 119, 265, 121, 165, 60,
174797
- /* 530 */ 139, 140, 43, 44, 45, 129, 47, 48, 49, 50,
175178
+ /* 500 */ 55, 56, 57, 58, 246, 213, 214, 19, 19, 241,
175179
+ /* 510 */ 242, 195, 23, 241, 242, 257, 241, 242, 118, 277,
175180
+ /* 520 */ 278, 279, 254, 29, 256, 60, 254, 33, 256, 254,
175181
+ /* 530 */ 206, 256, 43, 44, 45, 218, 47, 48, 49, 50,
174798175182
/* 540 */ 51, 52, 53, 54, 55, 56, 57, 58, 103, 104,
174799175183
/* 550 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
174800
- /* 560 */ 154, 194, 156, 194, 117, 118, 119, 280, 283, 205,
174801
- /* 570 */ 101, 220, 287, 19, 20, 306, 22, 308, 117, 118,
174802
- /* 580 */ 119, 211, 212, 213, 217, 218, 117, 118, 236, 237,
174803
- /* 590 */ 36, 122, 103, 104, 105, 106, 107, 108, 109, 110,
174804
- /* 600 */ 111, 112, 113, 114, 240, 241, 194, 60, 194, 194,
174805
- /* 610 */ 194, 194, 19, 194, 60, 194, 23, 253, 206, 255,
174806
- /* 620 */ 73, 254, 19, 154, 155, 156, 72, 276, 277, 278,
174807
- /* 630 */ 263, 217, 218, 217, 218, 271, 43, 44, 45, 271,
175184
+ /* 560 */ 66, 19, 218, 60, 120, 241, 242, 123, 124, 125,
175185
+ /* 570 */ 60, 232, 77, 19, 20, 26, 22, 133, 254, 287,
175186
+ /* 580 */ 256, 265, 117, 118, 119, 90, 312, 313, 93, 47,
175187
+ /* 590 */ 36, 317, 103, 104, 105, 106, 107, 108, 109, 110,
175188
+ /* 600 */ 111, 112, 113, 114, 116, 117, 277, 278, 279, 60,
175189
+ /* 610 */ 107, 108, 19, 276, 60, 31, 23, 152, 195, 116,
175190
+ /* 620 */ 117, 118, 119, 39, 121, 276, 72, 117, 118, 119,
175191
+ /* 630 */ 166, 167, 129, 145, 237, 238, 43, 44, 45, 276,
174808175192
/* 640 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
174809
- /* 650 */ 57, 58, 183, 194, 285, 101, 19, 214, 60, 242,
174810
- /* 660 */ 23, 107, 108, 109, 117, 118, 119, 16, 254, 115,
174811
- /* 670 */ 254, 117, 118, 119, 194, 60, 122, 263, 205, 264,
174812
- /* 680 */ 43, 44, 45, 264, 47, 48, 49, 50, 51, 52,
175193
+ /* 650 */ 57, 58, 315, 316, 144, 101, 19, 154, 116, 156,
175194
+ /* 660 */ 23, 107, 108, 109, 315, 316, 117, 118, 119, 115,
175195
+ /* 670 */ 60, 117, 118, 119, 132, 200, 122, 60, 315, 316,
175196
+ /* 680 */ 43, 44, 45, 272, 47, 48, 49, 50, 51, 52,
174813175197
/* 690 */ 53, 54, 55, 56, 57, 58, 103, 104, 105, 106,
174814175198
/* 700 */ 107, 108, 109, 110, 111, 112, 113, 114, 154, 155,
174815
- /* 710 */ 156, 157, 158, 240, 241, 117, 118, 119, 101, 205,
174816
- /* 720 */ 117, 19, 20, 306, 22, 308, 253, 74, 255, 78,
174817
- /* 730 */ 205, 80, 117, 118, 119, 118, 293, 183, 36, 122,
175199
+ /* 710 */ 156, 157, 158, 212, 213, 214, 22, 195, 101, 22,
175200
+ /* 720 */ 60, 19, 20, 60, 22, 139, 140, 117, 118, 119,
175201
+ /* 730 */ 22, 251, 195, 253, 117, 118, 195, 183, 36, 122,
174818175202
/* 740 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
174819
- /* 750 */ 113, 114, 194, 294, 240, 241, 211, 212, 213, 144,
174820
- /* 760 */ 19, 23, 60, 25, 23, 240, 241, 253, 245, 255,
174821
- /* 770 */ 15, 154, 155, 156, 72, 217, 218, 194, 253, 256,
174822
- /* 780 */ 255, 128, 129, 130, 43, 44, 45, 22, 47, 48,
175203
+ /* 750 */ 113, 114, 195, 195, 60, 218, 219, 60, 195, 284,
175204
+ /* 760 */ 19, 25, 60, 288, 23, 237, 238, 22, 60, 109,
175205
+ /* 770 */ 233, 154, 155, 156, 72, 218, 219, 117, 118, 119,
175206
+ /* 780 */ 117, 118, 119, 116, 43, 44, 45, 265, 47, 48,
174823175207
/* 790 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
174824
- /* 800 */ 183, 19, 77, 101, 19, 128, 129, 130, 23, 107,
174825
- /* 810 */ 108, 60, 254, 88, 21, 90, 61, 115, 93, 117,
174826
- /* 820 */ 118, 119, 239, 22, 122, 60, 194, 205, 43, 44,
174827
- /* 830 */ 45, 205, 47, 48, 49, 50, 51, 52, 53, 54,
175208
+ /* 800 */ 183, 243, 25, 101, 19, 60, 265, 144, 23, 107,
175209
+ /* 810 */ 108, 117, 118, 119, 117, 118, 119, 115, 151, 117,
175210
+ /* 820 */ 118, 119, 82, 195, 122, 117, 118, 119, 43, 44,
175211
+ /* 830 */ 45, 195, 47, 48, 49, 50, 51, 52, 53, 54,
174828175212
/* 840 */ 55, 56, 57, 58, 103, 104, 105, 106, 107, 108,
174829175213
/* 850 */ 109, 110, 111, 112, 113, 114, 154, 155, 156, 157,
174830
- /* 860 */ 158, 60, 240, 241, 60, 116, 240, 241, 117, 118,
174831
- /* 870 */ 119, 146, 194, 19, 81, 253, 275, 255, 24, 253,
174832
- /* 880 */ 98, 255, 117, 118, 119, 183, 22, 194, 103, 104,
175214
+ /* 860 */ 158, 121, 117, 118, 119, 307, 101, 309, 195, 22,
175215
+ /* 870 */ 23, 195, 25, 19, 35, 139, 140, 195, 24, 139,
175216
+ /* 880 */ 140, 208, 195, 118, 109, 183, 22, 122, 103, 104,
174833175217
/* 890 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
174834
- /* 900 */ 151, 194, 270, 152, 22, 23, 194, 25, 19, 202,
174835
- /* 910 */ 217, 218, 23, 109, 207, 314, 315, 124, 117, 118,
174836
- /* 920 */ 119, 117, 118, 119, 60, 232, 22, 23, 19, 25,
174837
- /* 930 */ 303, 304, 43, 44, 45, 22, 47, 48, 49, 50,
174838
- /* 940 */ 51, 52, 53, 54, 55, 56, 57, 58, 270, 227,
174839
- /* 950 */ 96, 60, 43, 44, 45, 162, 47, 48, 49, 50,
174840
- /* 960 */ 51, 52, 53, 54, 55, 56, 57, 58, 114, 112,
174841
- /* 970 */ 113, 114, 194, 60, 120, 121, 122, 123, 124, 125,
174842
- /* 980 */ 126, 117, 118, 119, 102, 25, 132, 107, 108, 194,
174843
- /* 990 */ 194, 227, 103, 104, 105, 106, 107, 108, 109, 110,
174844
- /* 1000 */ 111, 112, 113, 114, 194, 194, 102, 194, 117, 118,
174845
- /* 1010 */ 119, 233, 103, 104, 105, 106, 107, 108, 109, 110,
174846
- /* 1020 */ 111, 112, 113, 114, 194, 194, 19, 194, 217, 218,
174847
- /* 1030 */ 117, 118, 119, 241, 154, 144, 156, 135, 242, 137,
174848
- /* 1040 */ 138, 130, 19, 232, 194, 253, 23, 255, 217, 218,
174849
- /* 1050 */ 217, 218, 242, 16, 7, 8, 9, 25, 261, 262,
174850
- /* 1060 */ 265, 194, 19, 232, 153, 232, 43, 44, 45, 160,
175218
+ /* 900 */ 304, 305, 77, 230, 127, 232, 67, 195, 19, 195,
175219
+ /* 910 */ 195, 136, 23, 88, 75, 90, 141, 203, 93, 154,
175220
+ /* 920 */ 155, 156, 208, 295, 60, 243, 22, 23, 19, 25,
175221
+ /* 930 */ 218, 219, 43, 44, 45, 100, 47, 48, 49, 50,
175222
+ /* 940 */ 51, 52, 53, 54, 55, 56, 57, 58, 183, 102,
175223
+ /* 950 */ 96, 195, 43, 44, 45, 240, 47, 48, 49, 50,
175224
+ /* 960 */ 51, 52, 53, 54, 55, 56, 57, 58, 114, 134,
175225
+ /* 970 */ 131, 146, 25, 286, 120, 121, 122, 123, 124, 125,
175226
+ /* 980 */ 126, 117, 118, 119, 313, 195, 132, 195, 317, 307,
175227
+ /* 990 */ 195, 309, 103, 104, 105, 106, 107, 108, 109, 110,
175228
+ /* 1000 */ 111, 112, 113, 114, 195, 195, 102, 195, 195, 195,
175229
+ /* 1010 */ 218, 219, 103, 104, 105, 106, 107, 108, 109, 110,
175230
+ /* 1020 */ 111, 112, 113, 114, 77, 233, 195, 60, 218, 219,
175231
+ /* 1030 */ 218, 219, 218, 219, 23, 195, 25, 90, 243, 159,
175232
+ /* 1040 */ 93, 161, 19, 233, 195, 233, 23, 233, 16, 218,
175233
+ /* 1050 */ 219, 195, 243, 212, 213, 214, 262, 263, 218, 219,
175234
+ /* 1060 */ 195, 271, 19, 307, 233, 309, 43, 44, 45, 160,
174851175235
/* 1070 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
174852
- /* 1080 */ 57, 58, 194, 227, 217, 218, 43, 44, 45, 194,
175236
+ /* 1080 */ 57, 58, 195, 218, 219, 118, 43, 44, 45, 240,
174853175237
/* 1090 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
174854
- /* 1100 */ 57, 58, 306, 143, 308, 217, 218, 294, 12, 77,
174855
- /* 1110 */ 22, 23, 217, 218, 194, 78, 306, 80, 308, 194,
174856
- /* 1120 */ 232, 254, 90, 27, 117, 93, 103, 104, 105, 106,
174857
- /* 1130 */ 107, 108, 109, 110, 111, 112, 113, 114, 42, 194,
174858
- /* 1140 */ 35, 194, 217, 218, 214, 194, 103, 104, 105, 106,
174859
- /* 1150 */ 107, 108, 109, 110, 111, 112, 113, 114, 194, 239,
174860
- /* 1160 */ 64, 194, 217, 218, 217, 218, 209, 210, 217, 218,
174861
- /* 1170 */ 74, 207, 67, 22, 194, 77, 19, 232, 245, 232,
174862
- /* 1180 */ 75, 24, 312, 232, 217, 218, 316, 25, 90, 256,
174863
- /* 1190 */ 102, 93, 159, 229, 161, 231, 19, 217, 218, 162,
175238
+ /* 1100 */ 57, 58, 307, 195, 309, 218, 219, 263, 12, 195,
175239
+ /* 1110 */ 78, 267, 80, 112, 113, 114, 307, 22, 309, 24,
175240
+ /* 1120 */ 255, 281, 266, 27, 107, 108, 103, 104, 105, 106,
175241
+ /* 1130 */ 107, 108, 109, 110, 111, 112, 113, 114, 42, 195,
175242
+ /* 1140 */ 11, 22, 255, 24, 195, 195, 103, 104, 105, 106,
175243
+ /* 1150 */ 107, 108, 109, 110, 111, 112, 113, 114, 19, 195,
175244
+ /* 1160 */ 64, 195, 218, 219, 195, 313, 195, 218, 219, 317,
175245
+ /* 1170 */ 74, 154, 195, 156, 195, 195, 19, 233, 23, 60,
175246
+ /* 1180 */ 25, 24, 218, 219, 218, 219, 195, 218, 219, 218,
175247
+ /* 1190 */ 219, 128, 129, 130, 162, 263, 19, 218, 219, 267,
174864175248
/* 1200 */ 43, 44, 45, 160, 47, 48, 49, 50, 51, 52,
174865
- /* 1210 */ 53, 54, 55, 56, 57, 58, 19, 23, 288, 25,
174866
- /* 1220 */ 43, 44, 45, 293, 47, 48, 49, 50, 51, 52,
174867
- /* 1230 */ 53, 54, 55, 56, 57, 58, 131, 22, 275, 24,
174868
- /* 1240 */ 43, 44, 45, 194, 47, 48, 49, 50, 51, 52,
174869
- /* 1250 */ 53, 54, 55, 56, 57, 58, 194, 194, 107, 108,
175249
+ /* 1210 */ 53, 54, 55, 56, 57, 58, 19, 240, 228, 255,
175250
+ /* 1220 */ 43, 44, 45, 25, 47, 48, 49, 50, 51, 52,
175251
+ /* 1230 */ 53, 54, 55, 56, 57, 58, 135, 118, 137, 138,
175252
+ /* 1240 */ 43, 44, 45, 22, 47, 48, 49, 50, 51, 52,
175253
+ /* 1250 */ 53, 54, 55, 56, 57, 58, 117, 266, 129, 130,
174870175254
/* 1260 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
174871
- /* 1270 */ 113, 114, 194, 25, 194, 60, 194, 314, 315, 194,
175255
+ /* 1270 */ 113, 114, 195, 195, 119, 295, 195, 206, 195, 195,
174872175256
/* 1280 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
174873
- /* 1290 */ 113, 114, 19, 194, 194, 217, 218, 217, 218, 25,
175257
+ /* 1290 */ 113, 114, 195, 195, 195, 218, 219, 195, 195, 144,
174874175258
/* 1300 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
174875
- /* 1310 */ 113, 114, 150, 119, 265, 312, 67, 217, 218, 316,
174876
- /* 1320 */ 19, 239, 194, 194, 128, 129, 130, 265, 265, 209,
174877
- /* 1330 */ 210, 31, 254, 118, 254, 86, 60, 194, 144, 39,
174878
- /* 1340 */ 19, 130, 275, 312, 95, 44, 45, 316, 47, 48,
175259
+ /* 1310 */ 113, 114, 241, 242, 67, 218, 219, 218, 219, 146,
175260
+ /* 1320 */ 19, 218, 219, 240, 215, 254, 136, 256, 107, 108,
175261
+ /* 1330 */ 195, 141, 255, 86, 128, 129, 130, 195, 165, 195,
175262
+ /* 1340 */ 19, 143, 95, 272, 25, 44, 45, 266, 47, 48,
174879175263
/* 1350 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
174880
- /* 1360 */ 217, 218, 24, 194, 153, 12, 45, 119, 47, 48,
175264
+ /* 1360 */ 218, 219, 218, 219, 195, 12, 45, 195, 47, 48,
174881175265
/* 1370 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
174882
- /* 1380 */ 27, 314, 315, 22, 312, 24, 217, 218, 316, 116,
174883
- /* 1390 */ 117, 22, 144, 25, 118, 42, 147, 194, 60, 19,
174884
- /* 1400 */ 20, 127, 22, 194, 103, 104, 105, 106, 107, 108,
174885
- /* 1410 */ 109, 110, 111, 112, 113, 114, 36, 64, 145, 194,
174886
- /* 1420 */ 217, 218, 194, 54, 103, 104, 105, 106, 107, 108,
174887
- /* 1430 */ 109, 110, 111, 112, 113, 114, 194, 22, 310, 25,
174888
- /* 1440 */ 60, 194, 217, 218, 194, 217, 218, 194, 260, 194,
174889
- /* 1450 */ 301, 302, 72, 262, 262, 194, 118, 266, 266, 217,
174890
- /* 1460 */ 218, 194, 82, 245, 217, 218, 194, 217, 218, 194,
174891
- /* 1470 */ 217, 218, 217, 218, 256, 60, 24, 194, 217, 218,
174892
- /* 1480 */ 194, 101, 194, 245, 217, 218, 194, 107, 108, 217,
174893
- /* 1490 */ 218, 22, 217, 218, 256, 115, 245, 117, 118, 119,
174894
- /* 1500 */ 217, 218, 122, 217, 218, 217, 218, 256, 22, 217,
174895
- /* 1510 */ 218, 116, 258, 259, 146, 19, 20, 194, 22, 139,
174896
- /* 1520 */ 140, 150, 151, 136, 23, 194, 25, 194, 141, 194,
174897
- /* 1530 */ 194, 62, 36, 118, 154, 155, 156, 157, 158, 100,
174898
- /* 1540 */ 145, 194, 154, 194, 156, 49, 194, 23, 194, 25,
174899
- /* 1550 */ 217, 218, 217, 218, 194, 257, 60, 143, 194, 60,
174900
- /* 1560 */ 194, 121, 122, 183, 217, 218, 217, 218, 72, 217,
174901
- /* 1570 */ 218, 217, 218, 134, 23, 194, 25, 217, 218, 7,
174902
- /* 1580 */ 8, 321, 86, 217, 218, 194, 122, 91, 19, 20,
174903
- /* 1590 */ 23, 22, 25, 23, 142, 25, 132, 101, 217, 218,
174904
- /* 1600 */ 194, 194, 194, 107, 108, 36, 194, 194, 217, 218,
174905
- /* 1610 */ 194, 115, 194, 117, 118, 119, 194, 118, 122, 194,
174906
- /* 1620 */ 23, 194, 25, 217, 218, 217, 218, 194, 142, 60,
174907
- /* 1630 */ 217, 218, 194, 217, 218, 217, 218, 84, 85, 217,
174908
- /* 1640 */ 218, 72, 217, 218, 217, 218, 60, 23, 60, 25,
174909
- /* 1650 */ 154, 155, 156, 157, 158, 86, 154, 194, 156, 194,
174910
- /* 1660 */ 91, 19, 20, 23, 22, 25, 194, 23, 194, 25,
174911
- /* 1670 */ 101, 23, 194, 25, 194, 194, 107, 108, 36, 183,
174912
- /* 1680 */ 217, 218, 217, 218, 115, 194, 117, 118, 119, 217,
174913
- /* 1690 */ 218, 122, 194, 237, 194, 217, 218, 217, 218, 194,
174914
- /* 1700 */ 194, 23, 60, 25, 118, 23, 118, 25, 217, 218,
174915
- /* 1710 */ 23, 194, 25, 194, 72, 217, 218, 217, 218, 23,
174916
- /* 1720 */ 194, 25, 194, 154, 155, 156, 157, 158, 86, 23,
174917
- /* 1730 */ 194, 25, 194, 91, 217, 218, 217, 218, 194, 194,
174918
- /* 1740 */ 194, 194, 194, 101, 194, 217, 218, 290, 194, 107,
174919
- /* 1750 */ 108, 194, 183, 217, 218, 194, 194, 115, 194, 117,
174920
- /* 1760 */ 118, 119, 194, 243, 122, 194, 289, 194, 194, 194,
174921
- /* 1770 */ 194, 257, 257, 257, 244, 257, 192, 273, 215, 269,
174922
- /* 1780 */ 246, 299, 269, 295, 247, 273, 247, 246, 295, 230,
174923
- /* 1790 */ 261, 226, 261, 261, 273, 273, 154, 155, 156, 157,
174924
- /* 1800 */ 158, 0, 1, 2, 221, 220, 5, 220, 250, 220,
174925
- /* 1810 */ 261, 10, 11, 12, 13, 14, 250, 282, 17, 197,
174926
- /* 1820 */ 61, 19, 20, 246, 22, 183, 244, 142, 201, 201,
174927
- /* 1830 */ 38, 30, 299, 32, 201, 152, 22, 151, 36, 299,
174928
- /* 1840 */ 43, 40, 235, 18, 238, 285, 238, 238, 296, 238,
174929
- /* 1850 */ 201, 296, 274, 272, 18, 200, 235, 150, 235, 247,
174930
- /* 1860 */ 247, 247, 60, 247, 274, 274, 272, 201, 200, 159,
174931
- /* 1870 */ 63, 292, 71, 201, 72, 200, 22, 201, 222, 200,
174932
- /* 1880 */ 79, 201, 222, 82, 291, 116, 219, 65, 200, 219,
174933
- /* 1890 */ 219, 228, 22, 127, 225, 166, 222, 24, 225, 114,
174934
- /* 1900 */ 99, 284, 221, 101, 284, 228, 307, 315, 219, 107,
174935
- /* 1910 */ 108, 219, 219, 219, 201, 92, 320, 115, 320, 117,
174936
- /* 1920 */ 118, 119, 222, 83, 122, 267, 267, 149, 146, 19,
174937
- /* 1930 */ 20, 22, 22, 279, 250, 134, 201, 148, 159, 249,
174938
- /* 1940 */ 139, 140, 251, 141, 25, 281, 36, 147, 251, 248,
174939
- /* 1950 */ 247, 203, 13, 195, 6, 195, 154, 155, 156, 157,
174940
- /* 1960 */ 158, 193, 305, 193, 163, 193, 305, 302, 214, 208,
174941
- /* 1970 */ 60, 214, 208, 223, 223, 4, 214, 214, 3, 22,
174942
- /* 1980 */ 215, 214, 72, 208, 164, 183, 215, 15, 23, 16,
174943
- /* 1990 */ 23, 140, 131, 152, 25, 143, 20, 16, 24, 1,
174944
- /* 2000 */ 145, 143, 131, 131, 62, 37, 54, 54, 152, 54,
174945
- /* 2010 */ 54, 101, 131, 117, 34, 1, 142, 107, 108, 22,
174946
- /* 2020 */ 5, 116, 162, 69, 25, 115, 76, 117, 118, 119,
174947
- /* 2030 */ 1, 2, 122, 69, 5, 41, 142, 116, 20, 10,
175266
+ /* 1380 */ 27, 23, 7, 8, 9, 210, 211, 218, 219, 116,
175267
+ /* 1390 */ 218, 219, 228, 16, 147, 42, 195, 295, 195, 19,
175268
+ /* 1400 */ 20, 266, 22, 294, 103, 104, 105, 106, 107, 108,
175269
+ /* 1410 */ 109, 110, 111, 112, 113, 114, 36, 64, 145, 218,
175270
+ /* 1420 */ 219, 218, 219, 195, 103, 104, 105, 106, 107, 108,
175271
+ /* 1430 */ 109, 110, 111, 112, 113, 114, 195, 154, 119, 156,
175272
+ /* 1440 */ 60, 189, 190, 191, 192, 195, 218, 219, 195, 197,
175273
+ /* 1450 */ 195, 199, 72, 195, 19, 78, 195, 80, 206, 218,
175274
+ /* 1460 */ 219, 195, 82, 144, 210, 211, 195, 15, 218, 219,
175275
+ /* 1470 */ 47, 218, 219, 218, 219, 259, 260, 195, 261, 218,
175276
+ /* 1480 */ 219, 101, 302, 303, 218, 219, 195, 107, 108, 218,
175277
+ /* 1490 */ 219, 150, 151, 241, 242, 115, 25, 117, 118, 119,
175278
+ /* 1500 */ 218, 219, 122, 195, 146, 195, 254, 195, 256, 218,
175279
+ /* 1510 */ 219, 246, 25, 61, 246, 19, 20, 195, 22, 139,
175280
+ /* 1520 */ 140, 269, 257, 195, 266, 257, 218, 219, 218, 219,
175281
+ /* 1530 */ 218, 219, 36, 246, 154, 155, 156, 157, 158, 116,
175282
+ /* 1540 */ 218, 219, 195, 22, 257, 49, 218, 219, 23, 195,
175283
+ /* 1550 */ 25, 195, 117, 301, 195, 25, 60, 195, 195, 23,
175284
+ /* 1560 */ 195, 25, 195, 183, 24, 218, 219, 130, 72, 195,
175285
+ /* 1570 */ 22, 195, 218, 219, 218, 219, 195, 218, 219, 195,
175286
+ /* 1580 */ 218, 219, 86, 218, 219, 218, 219, 91, 19, 20,
175287
+ /* 1590 */ 153, 22, 218, 219, 218, 219, 195, 101, 195, 218,
175288
+ /* 1600 */ 219, 195, 195, 107, 108, 36, 23, 195, 25, 195,
175289
+ /* 1610 */ 62, 115, 195, 117, 118, 119, 195, 146, 122, 218,
175290
+ /* 1620 */ 219, 218, 219, 195, 218, 219, 19, 60, 122, 60,
175291
+ /* 1630 */ 218, 219, 218, 219, 195, 218, 219, 150, 132, 218,
175292
+ /* 1640 */ 219, 72, 195, 23, 195, 25, 218, 219, 195, 60,
175293
+ /* 1650 */ 154, 155, 156, 157, 158, 86, 23, 195, 25, 195,
175294
+ /* 1660 */ 91, 19, 20, 142, 22, 218, 219, 218, 219, 130,
175295
+ /* 1670 */ 101, 218, 219, 143, 121, 122, 107, 108, 36, 183,
175296
+ /* 1680 */ 218, 219, 142, 60, 115, 118, 117, 118, 119, 7,
175297
+ /* 1690 */ 8, 122, 153, 23, 23, 25, 25, 23, 23, 25,
175298
+ /* 1700 */ 25, 23, 60, 25, 23, 98, 25, 118, 84, 85,
175299
+ /* 1710 */ 23, 23, 25, 25, 72, 154, 23, 156, 25, 23,
175300
+ /* 1720 */ 228, 25, 195, 154, 155, 156, 157, 158, 86, 195,
175301
+ /* 1730 */ 195, 258, 195, 91, 291, 322, 195, 195, 195, 195,
175302
+ /* 1740 */ 195, 118, 195, 101, 195, 195, 195, 195, 238, 107,
175303
+ /* 1750 */ 108, 195, 183, 195, 195, 195, 290, 115, 195, 117,
175304
+ /* 1760 */ 118, 119, 244, 195, 122, 195, 195, 195, 195, 195,
175305
+ /* 1770 */ 195, 258, 258, 258, 258, 193, 245, 300, 216, 274,
175306
+ /* 1780 */ 247, 270, 270, 274, 296, 296, 248, 222, 262, 198,
175307
+ /* 1790 */ 262, 274, 61, 274, 248, 231, 154, 155, 156, 157,
175308
+ /* 1800 */ 158, 0, 1, 2, 247, 227, 5, 221, 221, 221,
175309
+ /* 1810 */ 142, 10, 11, 12, 13, 14, 262, 262, 17, 202,
175310
+ /* 1820 */ 300, 19, 20, 300, 22, 183, 247, 251, 251, 245,
175311
+ /* 1830 */ 202, 30, 38, 32, 202, 152, 151, 22, 36, 43,
175312
+ /* 1840 */ 236, 40, 18, 202, 239, 239, 18, 239, 239, 283,
175313
+ /* 1850 */ 201, 150, 236, 202, 236, 201, 159, 202, 248, 248,
175314
+ /* 1860 */ 248, 248, 60, 63, 201, 275, 273, 275, 273, 275,
175315
+ /* 1870 */ 22, 286, 71, 223, 72, 202, 223, 297, 297, 202,
175316
+ /* 1880 */ 79, 201, 116, 82, 220, 201, 220, 220, 65, 293,
175317
+ /* 1890 */ 292, 229, 22, 166, 127, 226, 24, 114, 226, 223,
175318
+ /* 1900 */ 99, 222, 202, 101, 285, 92, 220, 308, 83, 107,
175319
+ /* 1910 */ 108, 220, 220, 316, 220, 285, 268, 115, 229, 117,
175320
+ /* 1920 */ 118, 119, 223, 321, 122, 268, 149, 146, 22, 19,
175321
+ /* 1930 */ 20, 202, 22, 159, 282, 134, 321, 148, 280, 147,
175322
+ /* 1940 */ 139, 140, 252, 141, 25, 204, 36, 252, 13, 251,
175323
+ /* 1950 */ 196, 248, 250, 249, 196, 6, 154, 155, 156, 157,
175324
+ /* 1960 */ 158, 209, 194, 194, 163, 194, 306, 306, 303, 224,
175325
+ /* 1970 */ 60, 215, 215, 209, 215, 215, 215, 224, 216, 216,
175326
+ /* 1980 */ 4, 209, 72, 3, 22, 183, 164, 15, 23, 16,
175327
+ /* 1990 */ 23, 140, 152, 131, 25, 24, 143, 20, 16, 145,
175328
+ /* 2000 */ 1, 143, 131, 62, 131, 37, 54, 152, 54, 54,
175329
+ /* 2010 */ 54, 101, 131, 117, 1, 34, 142, 107, 108, 5,
175330
+ /* 2020 */ 22, 116, 162, 76, 41, 115, 69, 117, 118, 119,
175331
+ /* 2030 */ 1, 2, 122, 25, 5, 69, 142, 116, 20, 10,
174948175332
/* 2040 */ 11, 12, 13, 14, 24, 19, 17, 132, 5, 126,
174949175333
/* 2050 */ 22, 141, 68, 10, 11, 12, 13, 14, 22, 30,
174950175334
/* 2060 */ 17, 32, 22, 22, 154, 155, 156, 157, 158, 40,
174951175335
/* 2070 */ 23, 68, 60, 30, 24, 32, 97, 28, 22, 68,
174952175336
/* 2080 */ 23, 37, 34, 40, 150, 22, 25, 23, 23, 23,
174953
- /* 2090 */ 22, 98, 23, 183, 23, 117, 34, 22, 25, 89,
174954
- /* 2100 */ 71, 142, 144, 76, 34, 23, 34, 76, 79, 87,
174955
- /* 2110 */ 34, 82, 34, 94, 71, 34, 22, 24, 44, 34,
174956
- /* 2120 */ 25, 25, 79, 23, 23, 82, 143, 23, 99, 143,
174957
- /* 2130 */ 23, 22, 11, 25, 23, 25, 22, 22, 22, 1,
174958
- /* 2140 */ 23, 23, 99, 136, 22, 22, 142, 142, 142, 25,
174959
- /* 2150 */ 25, 23, 15, 1, 322, 322, 322, 322, 322, 322,
174960
- /* 2160 */ 322, 322, 322, 134, 322, 322, 322, 322, 139, 140,
174961
- /* 2170 */ 322, 322, 322, 322, 322, 322, 322, 134, 322, 322,
174962
- /* 2180 */ 322, 322, 139, 140, 322, 322, 322, 322, 322, 322,
174963
- /* 2190 */ 322, 322, 163, 322, 322, 322, 322, 322, 322, 322,
174964
- /* 2200 */ 322, 322, 322, 322, 322, 322, 163, 322, 322, 322,
174965
- /* 2210 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174966
- /* 2220 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174967
- /* 2230 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174968
- /* 2240 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174969
- /* 2250 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174970
- /* 2260 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174971
- /* 2270 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174972
- /* 2280 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174973
- /* 2290 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174974
- /* 2300 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174975
- /* 2310 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174976
- /* 2320 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174977
- /* 2330 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
174978
- /* 2340 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
174979
- /* 2350 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
174980
- /* 2360 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
174981
- /* 2370 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
174982
- /* 2380 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
174983
- /* 2390 */ 186, 186, 186,
175337
+ /* 2090 */ 22, 98, 142, 183, 23, 23, 34, 22, 25, 89,
175338
+ /* 2100 */ 71, 34, 117, 144, 34, 22, 76, 76, 79, 87,
175339
+ /* 2110 */ 34, 82, 34, 44, 71, 94, 34, 23, 25, 24,
175340
+ /* 2120 */ 34, 25, 79, 23, 23, 82, 23, 23, 99, 143,
175341
+ /* 2130 */ 143, 22, 25, 25, 23, 22, 11, 22, 22, 25,
175342
+ /* 2140 */ 23, 23, 99, 22, 22, 136, 142, 142, 142, 25,
175343
+ /* 2150 */ 23, 15, 1, 1, 323, 323, 323, 323, 323, 323,
175344
+ /* 2160 */ 323, 323, 323, 134, 323, 323, 323, 323, 139, 140,
175345
+ /* 2170 */ 323, 323, 323, 323, 323, 323, 323, 134, 323, 323,
175346
+ /* 2180 */ 323, 323, 139, 140, 323, 323, 323, 323, 323, 323,
175347
+ /* 2190 */ 323, 323, 163, 323, 323, 323, 323, 323, 323, 323,
175348
+ /* 2200 */ 323, 323, 323, 323, 323, 323, 163, 323, 323, 323,
175349
+ /* 2210 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175350
+ /* 2220 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175351
+ /* 2230 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175352
+ /* 2240 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175353
+ /* 2250 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175354
+ /* 2260 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175355
+ /* 2270 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175356
+ /* 2280 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175357
+ /* 2290 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175358
+ /* 2300 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175359
+ /* 2310 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175360
+ /* 2320 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175361
+ /* 2330 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
175362
+ /* 2340 */ 323, 187, 187, 187, 187, 187, 187, 187, 187, 187,
175363
+ /* 2350 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
175364
+ /* 2360 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
175365
+ /* 2370 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
175366
+ /* 2380 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
175367
+ /* 2390 */ 187, 187, 187, 187,
174984175368
};
174985175369
#define YY_SHIFT_COUNT (582)
174986175370
#define YY_SHIFT_MIN (0)
174987175371
#define YY_SHIFT_MAX (2152)
174988175372
static const unsigned short int yy_shift_ofst[] = {
174989
- /* 0 */ 2029, 1801, 2043, 1380, 1380, 33, 391, 1496, 1569, 1642,
174990
- /* 10 */ 702, 702, 702, 193, 33, 33, 33, 33, 33, 0,
175373
+ /* 0 */ 2029, 1801, 2043, 1380, 1380, 318, 271, 1496, 1569, 1642,
175374
+ /* 10 */ 702, 702, 702, 740, 318, 318, 318, 318, 318, 0,
174991175375
/* 20 */ 0, 216, 1177, 702, 702, 702, 702, 702, 702, 702,
174992
- /* 30 */ 702, 702, 702, 702, 702, 702, 702, 702, 406, 406,
174993
- /* 40 */ 111, 111, 218, 447, 547, 598, 598, 260, 260, 260,
174994
- /* 50 */ 260, 40, 112, 320, 340, 445, 489, 593, 637, 741,
175376
+ /* 30 */ 702, 702, 702, 702, 702, 702, 702, 702, 503, 503,
175377
+ /* 40 */ 111, 111, 217, 287, 348, 610, 610, 736, 736, 736,
175378
+ /* 50 */ 736, 40, 112, 320, 340, 445, 489, 593, 637, 741,
174995175379
/* 60 */ 785, 889, 909, 1023, 1043, 1157, 1177, 1177, 1177, 1177,
174996175380
/* 70 */ 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177,
174997175381
/* 80 */ 1177, 1177, 1177, 1177, 1197, 1177, 1301, 1321, 1321, 554,
174998175382
/* 90 */ 1802, 1910, 702, 702, 702, 702, 702, 702, 702, 702,
174999175383
/* 100 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702,
175000175384
/* 110 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702,
175001175385
/* 120 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702,
175002175386
/* 130 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702,
175003175387
/* 140 */ 702, 702, 138, 198, 198, 198, 198, 198, 198, 198,
175004
- /* 150 */ 183, 99, 236, 292, 598, 793, 167, 598, 598, 880,
175005
- /* 160 */ 880, 598, 857, 150, 195, 195, 195, 264, 113, 113,
175006
- /* 170 */ 2207, 2207, 854, 854, 854, 751, 765, 765, 765, 765,
175007
- /* 180 */ 1096, 1096, 725, 292, 882, 904, 598, 598, 598, 598,
175008
- /* 190 */ 598, 598, 598, 598, 598, 598, 598, 598, 598, 598,
175009
- /* 200 */ 598, 598, 598, 598, 598, 1273, 1032, 1032, 598, 147,
175010
- /* 210 */ 1098, 1098, 603, 603, 1276, 1276, 363, 2207, 2207, 2207,
175011
- /* 220 */ 2207, 2207, 2207, 2207, 469, 617, 617, 801, 336, 461,
175012
- /* 230 */ 804, 864, 615, 891, 913, 598, 598, 598, 598, 598,
175013
- /* 240 */ 598, 598, 598, 598, 598, 653, 598, 598, 598, 598,
175014
- /* 250 */ 598, 598, 598, 598, 598, 598, 598, 598, 1105, 1105,
175015
- /* 260 */ 1105, 598, 598, 598, 1194, 598, 598, 598, 1215, 1249,
175016
- /* 270 */ 598, 1353, 598, 598, 598, 598, 598, 598, 598, 598,
175017
- /* 280 */ 677, 449, 902, 1338, 1338, 1338, 1338, 1248, 902, 902,
175018
- /* 290 */ 326, 1151, 1047, 755, 749, 1371, 960, 1371, 1007, 1162,
175019
- /* 300 */ 749, 749, 1162, 749, 960, 1007, 1274, 738, 215, 1300,
175020
- /* 310 */ 1300, 1300, 1395, 1395, 1395, 1395, 1368, 1368, 1033, 1414,
175021
- /* 320 */ 1387, 1361, 1759, 1759, 1685, 1685, 1792, 1792, 1685, 1683,
175022
- /* 330 */ 1686, 1814, 1797, 1825, 1825, 1825, 1825, 1685, 1836, 1707,
175023
- /* 340 */ 1686, 1686, 1707, 1814, 1797, 1707, 1797, 1707, 1685, 1836,
175024
- /* 350 */ 1710, 1807, 1685, 1836, 1854, 1685, 1836, 1685, 1836, 1854,
175025
- /* 360 */ 1769, 1769, 1769, 1822, 1870, 1870, 1854, 1769, 1766, 1769,
175026
- /* 370 */ 1822, 1769, 1769, 1729, 1873, 1785, 1785, 1854, 1685, 1823,
175027
- /* 380 */ 1823, 1840, 1840, 1778, 1782, 1909, 1685, 1779, 1778, 1789,
175028
- /* 390 */ 1800, 1707, 1919, 1939, 1939, 1948, 1948, 1948, 2207, 2207,
175388
+ /* 150 */ 183, 99, 169, 549, 610, 151, 542, 610, 610, 1017,
175389
+ /* 160 */ 1017, 610, 1001, 350, 464, 464, 464, 586, 1, 1,
175390
+ /* 170 */ 2207, 2207, 854, 854, 854, 465, 694, 694, 694, 694,
175391
+ /* 180 */ 1096, 1096, 825, 549, 847, 904, 610, 610, 610, 610,
175392
+ /* 190 */ 610, 610, 610, 610, 610, 610, 610, 610, 610, 610,
175393
+ /* 200 */ 610, 610, 610, 610, 610, 488, 947, 947, 610, 1129,
175394
+ /* 210 */ 495, 495, 1139, 1139, 967, 967, 1173, 2207, 2207, 2207,
175395
+ /* 220 */ 2207, 2207, 2207, 2207, 617, 765, 765, 697, 444, 708,
175396
+ /* 230 */ 660, 745, 510, 663, 864, 610, 610, 610, 610, 610,
175397
+ /* 240 */ 610, 610, 610, 610, 610, 188, 610, 610, 610, 610,
175398
+ /* 250 */ 610, 610, 610, 610, 610, 610, 610, 610, 839, 839,
175399
+ /* 260 */ 839, 610, 610, 610, 1155, 610, 610, 610, 1119, 1247,
175400
+ /* 270 */ 610, 1353, 610, 610, 610, 610, 610, 610, 610, 610,
175401
+ /* 280 */ 1063, 494, 1101, 291, 291, 291, 291, 1319, 1101, 1101,
175402
+ /* 290 */ 775, 1221, 1375, 1452, 667, 1341, 1198, 1341, 1435, 1487,
175403
+ /* 300 */ 667, 667, 1487, 667, 1198, 1435, 777, 1011, 1423, 584,
175404
+ /* 310 */ 584, 584, 1273, 1273, 1273, 1273, 1471, 1471, 880, 1530,
175405
+ /* 320 */ 1190, 1095, 1731, 1731, 1668, 1668, 1794, 1794, 1668, 1683,
175406
+ /* 330 */ 1685, 1815, 1796, 1824, 1824, 1824, 1824, 1668, 1828, 1701,
175407
+ /* 340 */ 1685, 1685, 1701, 1815, 1796, 1701, 1796, 1701, 1668, 1828,
175408
+ /* 350 */ 1697, 1800, 1668, 1828, 1848, 1668, 1828, 1668, 1828, 1848,
175409
+ /* 360 */ 1766, 1766, 1766, 1823, 1870, 1870, 1848, 1766, 1767, 1766,
175410
+ /* 370 */ 1823, 1766, 1766, 1727, 1872, 1783, 1783, 1848, 1668, 1813,
175411
+ /* 380 */ 1813, 1825, 1825, 1777, 1781, 1906, 1668, 1774, 1777, 1789,
175412
+ /* 390 */ 1792, 1701, 1919, 1935, 1935, 1949, 1949, 1949, 2207, 2207,
175029175413
/* 400 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207,
175030
- /* 410 */ 2207, 2207, 2207, 69, 1037, 79, 1088, 651, 1196, 1415,
175031
- /* 420 */ 1501, 1439, 1369, 1452, 911, 1211, 1524, 1469, 1551, 1567,
175032
- /* 430 */ 1570, 1624, 1640, 1644, 1499, 1440, 1572, 1464, 1597, 275,
175033
- /* 440 */ 782, 1586, 1648, 1678, 1553, 1682, 1687, 1388, 1502, 1696,
175034
- /* 450 */ 1706, 1588, 1486, 1971, 1975, 1957, 1820, 1972, 1973, 1965,
175035
- /* 460 */ 1967, 1851, 1841, 1861, 1969, 1969, 1974, 1852, 1976, 1855,
175036
- /* 470 */ 1981, 1998, 1858, 1871, 1969, 1872, 1942, 1968, 1969, 1856,
175037
- /* 480 */ 1952, 1953, 1955, 1956, 1881, 1896, 1980, 1874, 2014, 2015,
175038
- /* 490 */ 1997, 1905, 1860, 1954, 1999, 1964, 1950, 1994, 1894, 1921,
175414
+ /* 410 */ 2207, 2207, 2207, 69, 1032, 79, 357, 1377, 1206, 400,
175415
+ /* 420 */ 1525, 835, 332, 1540, 1437, 1539, 1536, 1548, 1583, 1620,
175416
+ /* 430 */ 1633, 1670, 1671, 1674, 1567, 1553, 1682, 1506, 1675, 1358,
175417
+ /* 440 */ 1607, 1589, 1678, 1681, 1624, 1687, 1688, 1283, 1561, 1693,
175418
+ /* 450 */ 1696, 1623, 1521, 1976, 1980, 1962, 1822, 1972, 1973, 1965,
175419
+ /* 460 */ 1967, 1851, 1840, 1862, 1969, 1969, 1971, 1853, 1977, 1854,
175420
+ /* 470 */ 1982, 1999, 1858, 1871, 1969, 1873, 1941, 1968, 1969, 1855,
175421
+ /* 480 */ 1952, 1954, 1955, 1956, 1881, 1896, 1981, 1874, 2013, 2014,
175422
+ /* 490 */ 1998, 1905, 1860, 1957, 2008, 1966, 1947, 1983, 1894, 1921,
175039175423
/* 500 */ 2020, 2018, 2026, 1915, 1923, 2028, 1984, 2036, 2040, 2047,
175040175424
/* 510 */ 2041, 2003, 2012, 2050, 1979, 2049, 2056, 2011, 2044, 2057,
175041
- /* 520 */ 2048, 1934, 2063, 2064, 2065, 2061, 2066, 2068, 1993, 1959,
175042
- /* 530 */ 2069, 2071, 1978, 2062, 2075, 1958, 2073, 2070, 2072, 2076,
175043
- /* 540 */ 2078, 2010, 2027, 2022, 2074, 2031, 2019, 2081, 2082, 2094,
175044
- /* 550 */ 2093, 2095, 2096, 2085, 1983, 1986, 2100, 2073, 2101, 2104,
175045
- /* 560 */ 2107, 2109, 2108, 2110, 2111, 2114, 2121, 2115, 2116, 2117,
175046
- /* 570 */ 2118, 2122, 2123, 2124, 2007, 2004, 2005, 2006, 2125, 2128,
175047
- /* 580 */ 2137, 2138, 2152,
175425
+ /* 520 */ 2048, 1934, 2063, 2064, 2065, 2061, 2066, 2068, 1993, 1950,
175426
+ /* 530 */ 2071, 2072, 1985, 2062, 2075, 1959, 2073, 2067, 2070, 2076,
175427
+ /* 540 */ 2078, 2010, 2030, 2022, 2069, 2031, 2021, 2082, 2094, 2083,
175428
+ /* 550 */ 2095, 2093, 2096, 2086, 1986, 1987, 2100, 2073, 2101, 2103,
175429
+ /* 560 */ 2104, 2109, 2107, 2108, 2111, 2113, 2125, 2115, 2116, 2117,
175430
+ /* 570 */ 2118, 2121, 2122, 2114, 2009, 2004, 2005, 2006, 2124, 2127,
175431
+ /* 580 */ 2136, 2151, 2152,
175048175432
};
175049175433
#define YY_REDUCE_COUNT (412)
175050
-#define YY_REDUCE_MIN (-276)
175051
-#define YY_REDUCE_MAX (1775)
175434
+#define YY_REDUCE_MIN (-277)
175435
+#define YY_REDUCE_MAX (1772)
175052175436
static const short yy_reduce_ofst[] = {
175053
- /* 0 */ -66, 217, -63, -177, -180, 161, 364, 64, -183, 162,
175054
- /* 10 */ 223, 367, 414, -173, 473, 514, 525, 622, 626, -207,
175055
- /* 20 */ 351, -276, -38, 693, 811, 831, 833, 888, -188, 945,
175056
- /* 30 */ 947, 416, 558, 951, 867, 287, 1078, 1080, -186, 224,
175057
- /* 40 */ -132, 42, 964, 269, 417, 796, 810, -237, -231, -237,
175058
- /* 50 */ -231, -45, -45, -45, -45, -45, -45, -45, -45, -45,
175059
- /* 60 */ -45, -45, -45, -45, -45, -45, -45, -45, -45, -45,
175060
- /* 70 */ -45, -45, -45, -45, -45, -45, -45, -45, -45, -45,
175061
- /* 80 */ -45, -45, -45, -45, -45, -45, -45, -45, -45, 895,
175062
- /* 90 */ 925, 967, 980, 1100, 1143, 1169, 1203, 1225, 1228, 1242,
175063
- /* 100 */ 1247, 1250, 1253, 1255, 1261, 1267, 1272, 1275, 1283, 1286,
175064
- /* 110 */ 1288, 1292, 1333, 1335, 1347, 1349, 1352, 1354, 1360, 1366,
175065
- /* 120 */ 1381, 1391, 1406, 1408, 1413, 1416, 1418, 1422, 1425, 1427,
175066
- /* 130 */ 1463, 1465, 1472, 1478, 1480, 1491, 1498, 1500, 1517, 1519,
175067
- /* 140 */ 1528, 1536, -45, -45, -45, -45, -45, -45, -45, -45,
175068
- /* 150 */ -45, -45, -45, 312, -158, 285, -219, 9, 166, 370,
175069
- /* 160 */ 545, 707, -45, 930, 601, 963, 1067, 792, -45, -45,
175070
- /* 170 */ -45, -45, -204, -204, -204, 369, -171, -129, 632, 678,
175071
- /* 180 */ 202, 352, -270, 412, 627, 627, -9, 122, 415, 419,
175072
- /* 190 */ -56, 248, 583, 920, 6, 261, 459, 795, 1049, 813,
175073
- /* 200 */ 1062, 1082, -161, 778, 1063, 797, 870, 1003, 1128, 443,
175074
- /* 210 */ 1031, 1072, 1191, 1192, 957, 1120, 105, 1149, 523, 933,
175075
- /* 220 */ 1218, 1238, 1254, 1251, -138, 96, 117, 146, 181, 277,
175076
- /* 230 */ 280, 421, 480, 712, 830, 850, 1085, 1099, 1129, 1209,
175077
- /* 240 */ 1323, 1331, 1336, 1364, 1407, 368, 1412, 1433, 1438, 1474,
175078
- /* 250 */ 1481, 1505, 1506, 1526, 1538, 1544, 1545, 1546, 722, 764,
175079
- /* 260 */ 856, 1547, 1548, 1550, 1188, 1554, 1557, 1561, 1298, 1260,
175080
- /* 270 */ 1562, 1456, 1564, 280, 1568, 1571, 1573, 1574, 1575, 1576,
175081
- /* 280 */ 1457, 1477, 1520, 1514, 1515, 1516, 1518, 1188, 1520, 1520,
175082
- /* 290 */ 1530, 1563, 1584, 1482, 1504, 1510, 1534, 1513, 1488, 1537,
175083
- /* 300 */ 1512, 1521, 1539, 1522, 1541, 1493, 1583, 1559, 1565, 1585,
175084
- /* 310 */ 1587, 1589, 1529, 1531, 1532, 1549, 1558, 1566, 1535, 1577,
175085
- /* 320 */ 1582, 1622, 1533, 1540, 1627, 1628, 1552, 1555, 1633, 1560,
175086
- /* 330 */ 1578, 1581, 1607, 1606, 1608, 1609, 1611, 1649, 1655, 1612,
175087
- /* 340 */ 1590, 1591, 1613, 1594, 1621, 1614, 1623, 1616, 1666, 1668,
175088
- /* 350 */ 1579, 1593, 1672, 1675, 1656, 1676, 1679, 1680, 1688, 1660,
175089
- /* 360 */ 1667, 1670, 1671, 1663, 1669, 1673, 1674, 1689, 1681, 1692,
175090
- /* 370 */ 1677, 1693, 1694, 1592, 1599, 1617, 1620, 1700, 1713, 1596,
175091
- /* 380 */ 1598, 1658, 1659, 1691, 1684, 1654, 1735, 1664, 1697, 1690,
175092
- /* 390 */ 1701, 1703, 1748, 1758, 1760, 1768, 1770, 1772, 1657, 1661,
175093
- /* 400 */ 1665, 1761, 1754, 1757, 1762, 1763, 1764, 1750, 1751, 1765,