Fossil SCM

Merge latest changes from trunk.

mgagnon 2023-04-17 21:50 merge-conflict-when-no-file-on-pivot merge
Commit 88a76afc2c8adb8f0880340d3df2481dd0a726bc4fd95ec01d2b7449c6cb2297
+52 -78
--- Dockerfile
+++ Dockerfile
@@ -1,60 +1,47 @@
1
-# syntax=docker/dockerfile:1.4
1
+# syntax=docker/dockerfile:1.3
22
# See www/containers.md for documentation on how to use this file.
33
44
## ---------------------------------------------------------------------
5
-## STAGE 1: Build static Fossil & BusyBox binaries atop Alpine Linux
5
+## STAGE 1: Build static Fossil binary
66
## ---------------------------------------------------------------------
77
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.
813
FROM alpine:latest AS builder
914
WORKDIR /tmp
1015
11
-### Bake the basic Alpine Linux into a base layer so we never have to
12
-### repeat that step unless we change the package set. Although we're
13
-### going to throw this layer away below, we still pass --no-cache
14
-### because that cache is of no use in an immutable layer.
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.
1518
RUN set -x \
1619
&& apk update \
1720
&& apk upgrade --no-cache \
1821
&& apk add --no-cache \
1922
gcc make \
2023
linux-headers musl-dev \
2124
openssl-dev openssl-libs-static \
2225
zlib-dev zlib-static
2326
24
-### Bake the custom BusyBox into another layer. The intent is that this
25
-### changes only when we change BBXVER. That will force an update of
26
-### the layers below, but this is a rare occurrence.
27
-ARG BBXVER="1_35_0"
28
-ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}"
29
-COPY containers/busybox-config /tmp/bbx/.config
30
-ADD $BBXURL /tmp/bbx/src.tar.gz
31
-RUN set -x \
32
- && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
33
- && ( cd bbx && yes "" | make oldconfig && make -j11 )
34
-
35
-# Copy in dummied-up OS release info file for those using nspawn.
36
-# Without this, it'll gripe that the rootfs dir doesn't look like
37
-# it contains an OS.
38
-COPY containers/os-release /etc/os-release
39
-
40
-### The changeable Fossil layer is the only one in the first stage that
41
-### changes often, so add it last, to make it independent of the others.
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.
4229
###
43
-### $FSLSTB can be either a file or a directory due to a ADD's bizarre
44
-### behavior: it unpacks tarballs when added from a local file but not
45
-### from a URL! It matters because we default to a URL in case you're
46
-### building outside a Fossil checkout, but when building via the
47
-### container-image target, we can avoid a costly hit on the Fossil
48
-### project's home site by pulling the data from the local repo via the
49
-### "tarball" command. This is a DVCS, after all!
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.
5037
ARG FSLCFG=""
5138
ARG FSLVER="trunk"
5239
ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
5340
ENV FSLSTB=/tmp/fsl/src.tar.gz
5441
ADD $FSLURL $FSLSTB
55
-RUN set -x \
42
+RUN set -x \
5643
&& if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
5744
else tar -C fsl -xzf fsl/src.tar.gz ; fi \
5845
&& m=fsl/src/src/main.mk \
5946
&& fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11
6047
@@ -61,56 +48,43 @@
6148
6249
## ---------------------------------------------------------------------
6350
## STAGE 2: Pare that back to the bare essentials.
6451
## ---------------------------------------------------------------------
6552
66
-FROM scratch
67
-WORKDIR /jail
53
+FROM busybox AS os
6854
ARG UID=499
69
-ENV PATH "/bin:/usr/bin:/jail/bin"
70
-
71
-### Lay BusyBox down as the first base layer. Coupled with the host's
72
-### kernel, this is the "OS."
73
-COPY --from=builder /tmp/bbx/busybox /bin/
74
-COPY --from=builder /etc/os-release /etc/
75
-RUN [ "/bin/busybox", "--install", "/bin" ]
7655
7756
### Set up that base OS for our specific use without tying it to
7857
### anything likely to change often. So long as the user leaves
7958
### UID alone, this layer will be durable.
80
-RUN set -x \
81
- && echo 'root:x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd \
82
- && echo 'root:x:0:root' > /etc/group \
83
- && addgroup -S -g ${UID} fossil \
84
- && adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
85
- && install -d -m 700 -o fossil -g fossil log museum \
86
- && install -d -m 755 -o fossil -g fossil dev \
87
- && install -d -m 755 -o root -g root /usr/bin \
88
- && install -d -m 400 -o root -g root /run \
89
- && install -d -m 1777 -o root -g root /tmp \
90
- && mknod -m 666 dev/null c 1 3 \
91
- && mknod -m 444 dev/urandom c 1 9
92
-
93
-### Do Fossil-specific things atop those base layers; this will change
94
-### as often as the Fossil build-from-source layer above.
95
-COPY --from=builder /tmp/fossil bin/
96
-RUN set -x \
97
- && ln -s /jail/bin/fossil /usr/bin/f \
98
- && echo -e '#!/bin/sh\nfossil sha1sum "$@"' > /usr/bin/sha1sum \
99
- && echo -e '#!/bin/sh\nfossil sha3sum "$@"' > /usr/bin/sha3sum \
100
- && echo -e '#!/bin/sh\nfossil sqlite3 --no-repository "$@"' > \
101
- /usr/bin/sqlite3 \
102
- && chmod +x /usr/bin/sha?sum /usr/bin/sqlite3
103
-
104
-
105
-## ---------------------------------------------------------------------
106
-## STAGE 3: Run!
107
-## ---------------------------------------------------------------------
108
-
109
-EXPOSE 8080/tcp
110
-CMD [ \
111
- "fossil", "server", \
112
- "--chroot", "/jail", \
113
- "--create", \
114
- "--jsmode", "bundled", \
115
- "--user", "admin", \
116
- "museum/repo.fossil"]
59
+RUN set -x \
60
+ && mkdir log museum \
61
+ && echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \
62
+ && echo "root:x:0:root" > /tmp/group \
63
+ && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \
64
+ && echo "fossil:x:${UID}:fossil" >> /tmp/group
65
+
66
+
67
+## ---------------------------------------------------------------------
68
+## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
69
+## ---------------------------------------------------------------------
70
+
71
+FROM scratch AS run
72
+COPY --from=os /tmp/group /tmp/passwd /etc/
73
+COPY --from=os --chown=fossil:fossil /log /log/
74
+COPY --from=os --chown=fossil:fossil /museum /museum/
75
+COPY --from=os --chmod=1777 /tmp /tmp/
76
+COPY --from=builder /tmp/fossil /bin/
77
+
78
+
79
+## ---------------------------------------------------------------------
80
+## RUN!
81
+## ---------------------------------------------------------------------
82
+
83
+ENV PATH "/bin"
84
+EXPOSE 8080/tcp
85
+USER fossil
86
+ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
87
+CMD [ \
88
+ "--create", \
89
+ "--jsmode", "bundled", \
90
+ "--user", "admin" ]
11791
--- Dockerfile
+++ Dockerfile
@@ -1,60 +1,47 @@
1 # syntax=docker/dockerfile:1.4
2 # See www/containers.md for documentation on how to use this file.
3
4 ## ---------------------------------------------------------------------
5 ## STAGE 1: Build static Fossil & BusyBox binaries atop Alpine Linux
6 ## ---------------------------------------------------------------------
7
 
 
 
 
 
8 FROM alpine:latest AS builder
9 WORKDIR /tmp
10
11 ### Bake the basic Alpine Linux into a base layer so we never have to
12 ### repeat that step unless we change the package set. Although we're
13 ### going to throw this layer away below, we still pass --no-cache
14 ### because that cache is of no use in an immutable layer.
15 RUN set -x \
16 && apk update \
17 && apk upgrade --no-cache \
18 && apk add --no-cache \
19 gcc make \
20 linux-headers musl-dev \
21 openssl-dev openssl-libs-static \
22 zlib-dev zlib-static
23
24 ### Bake the custom BusyBox into another layer. The intent is that this
25 ### changes only when we change BBXVER. That will force an update of
26 ### the layers below, but this is a rare occurrence.
27 ARG BBXVER="1_35_0"
28 ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}"
29 COPY containers/busybox-config /tmp/bbx/.config
30 ADD $BBXURL /tmp/bbx/src.tar.gz
31 RUN set -x \
32 && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
33 && ( cd bbx && yes "" | make oldconfig && make -j11 )
34
35 # Copy in dummied-up OS release info file for those using nspawn.
36 # Without this, it'll gripe that the rootfs dir doesn't look like
37 # it contains an OS.
38 COPY containers/os-release /etc/os-release
39
40 ### The changeable Fossil layer is the only one in the first stage that
41 ### changes often, so add it last, to make it independent of the others.
42 ###
43 ### $FSLSTB can be either a file or a directory due to a ADD's bizarre
44 ### behavior: it unpacks tarballs when added from a local file but not
45 ### from a URL! It matters because we default to a URL in case you're
46 ### building outside a Fossil checkout, but when building via the
47 ### container-image target, we can avoid a costly hit on the Fossil
48 ### project's home site by pulling the data from the local repo via the
49 ### "tarball" command. This is a DVCS, after all!
50 ARG FSLCFG=""
51 ARG FSLVER="trunk"
52 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
53 ENV FSLSTB=/tmp/fsl/src.tar.gz
54 ADD $FSLURL $FSLSTB
55 RUN set -x \
56 && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
57 else tar -C fsl -xzf fsl/src.tar.gz ; fi \
58 && m=fsl/src/src/main.mk \
59 && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11
60
@@ -61,56 +48,43 @@
61
62 ## ---------------------------------------------------------------------
63 ## STAGE 2: Pare that back to the bare essentials.
64 ## ---------------------------------------------------------------------
65
66 FROM scratch
67 WORKDIR /jail
68 ARG UID=499
69 ENV PATH "/bin:/usr/bin:/jail/bin"
70
71 ### Lay BusyBox down as the first base layer. Coupled with the host's
72 ### kernel, this is the "OS."
73 COPY --from=builder /tmp/bbx/busybox /bin/
74 COPY --from=builder /etc/os-release /etc/
75 RUN [ "/bin/busybox", "--install", "/bin" ]
76
77 ### Set up that base OS for our specific use without tying it to
78 ### anything likely to change often. So long as the user leaves
79 ### UID alone, this layer will be durable.
80 RUN set -x \
81 && echo 'root:x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd \
82 && echo 'root:x:0:root' > /etc/group \
83 && addgroup -S -g ${UID} fossil \
84 && adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
85 && install -d -m 700 -o fossil -g fossil log museum \
86 && install -d -m 755 -o fossil -g fossil dev \
87 && install -d -m 755 -o root -g root /usr/bin \
88 && install -d -m 400 -o root -g root /run \
89 && install -d -m 1777 -o root -g root /tmp \
90 && mknod -m 666 dev/null c 1 3 \
91 && mknod -m 444 dev/urandom c 1 9
92
93 ### Do Fossil-specific things atop those base layers; this will change
94 ### as often as the Fossil build-from-source layer above.
95 COPY --from=builder /tmp/fossil bin/
96 RUN set -x \
97 && ln -s /jail/bin/fossil /usr/bin/f \
98 && echo -e '#!/bin/sh\nfossil sha1sum "$@"' > /usr/bin/sha1sum \
99 && echo -e '#!/bin/sh\nfossil sha3sum "$@"' > /usr/bin/sha3sum \
100 && echo -e '#!/bin/sh\nfossil sqlite3 --no-repository "$@"' > \
101 /usr/bin/sqlite3 \
102 && chmod +x /usr/bin/sha?sum /usr/bin/sqlite3
103
104
105 ## ---------------------------------------------------------------------
106 ## STAGE 3: Run!
107 ## ---------------------------------------------------------------------
108
109 EXPOSE 8080/tcp
110 CMD [ \
111 "fossil", "server", \
112 "--chroot", "/jail", \
113 "--create", \
114 "--jsmode", "bundled", \
115 "--user", "admin", \
116 "museum/repo.fossil"]
117
--- Dockerfile
+++ Dockerfile
@@ -1,60 +1,47 @@
1 # syntax=docker/dockerfile:1.3
2 # See www/containers.md for documentation on how to use this file.
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 builder
14 WORKDIR /tmp
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 \
22 gcc make \
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=/tmp/fsl/src.tar.gz
41 ADD $FSLURL $FSLSTB
42 RUN set -x \
43 && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
44 else tar -C fsl -xzf fsl/src.tar.gz ; fi \
45 && m=fsl/src/src/main.mk \
46 && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11
47
@@ -61,56 +48,43 @@
48
49 ## ---------------------------------------------------------------------
50 ## STAGE 2: Pare that back to the bare essentials.
51 ## ---------------------------------------------------------------------
52
53 FROM busybox AS os
 
54 ARG UID=499
 
 
 
 
 
 
 
55
56 ### Set up that base OS for our specific use without tying it to
57 ### anything likely to change often. So long as the user leaves
58 ### UID alone, this layer will be durable.
59 RUN set -x \
60 && mkdir log museum \
61 && echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \
62 && echo "root:x:0:root" > /tmp/group \
63 && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \
64 && echo "fossil:x:${UID}:fossil" >> /tmp/group
65
66
67 ## ---------------------------------------------------------------------
68 ## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
69 ## ---------------------------------------------------------------------
70
71 FROM scratch AS run
72 COPY --from=os /tmp/group /tmp/passwd /etc/
73 COPY --from=os --chown=fossil:fossil /log /log/
74 COPY --from=os --chown=fossil:fossil /museum /museum/
75 COPY --from=os --chmod=1777 /tmp /tmp/
76 COPY --from=builder /tmp/fossil /bin/
77
78
79 ## ---------------------------------------------------------------------
80 ## RUN!
81 ## ---------------------------------------------------------------------
82
83 ENV PATH "/bin"
84 EXPOSE 8080/tcp
85 USER fossil
86 ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
87 CMD [ \
88 "--create", \
89 "--jsmode", "bundled", \
90 "--user", "admin" ]
 
 
 
 
 
91
+12 -11
--- Makefile.in
+++ Makefile.in
@@ -121,15 +121,16 @@
121121
122122
# Container stuff
123123
SRCTB := src-@[email protected]
124124
IMGVER := fossil:@FOSSIL_CI_PFX@
125125
CNTVER := fossil-@FOSSIL_CI_PFX@
126
+CENGINE := docker
126127
container:
127
- docker image inspect $(IMGVER) > /dev/null 2>&1 || \
128
+ $(CENGINE) image inspect $(IMGVER) > /dev/null 2>&1 || \
128129
$(MAKE) container-image
129
- docker container inspect $(CNTVER) > /dev/null 2>&1 || \
130
- docker create \
130
+ $(CENGINE) container inspect $(CNTVER) > /dev/null 2>&1 || \
131
+ $(CENGINE) create \
131132
--name $(CNTVER) \
132133
--cap-drop AUDIT_WRITE \
133134
--cap-drop CHOWN \
134135
--cap-drop FSETID \
135136
--cap-drop KILL \
@@ -137,31 +138,31 @@
137138
--cap-drop NET_BIND_SERVICE \
138139
--cap-drop NET_RAW \
139140
--cap-drop SETFCAP \
140141
--cap-drop SETPCAP \
141142
--publish 8080:8080 \
142
- $(DCFLAGS) $(IMGVER)
143
+ $(DCFLAGS) $(IMGVER) $(DCCMD)
143144
144145
container-clean:
145
- -docker container kill $(CNTVER)
146
- -docker container rm $(CNTVER)
147
- -docker image rm $(IMGVER)
146
+ -$(CENGINE) container kill $(CNTVER)
147
+ -$(CENGINE) container rm $(CNTVER)
148
+ -$(CENGINE) image rm $(IMGVER)
148149
149150
container-image:
150151
$(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
151
- docker buildx build \
152
+ $(CENGINE) buildx build \
152153
--load \
153154
--tag $(IMGVER) \
154155
--build-arg FSLURL=$(SRCTB) \
155156
$(DBFLAGS) @srcdir@
156157
rm -f $(SRCTB)
157158
158159
container-run container-start: container
159
- docker start $(DSFLAGS) $(CNTVER)
160
+ $(CENGINE) start $(DSFLAGS) $(CNTVER)
160161
@sleep 1 # decrease likelihood of logging race condition
161
- docker container logs $(CNTVER)
162
+ $(CENGINE) container logs $(CNTVER)
162163
163164
container-stop:
164
- docker stop $(CNTVER)
165
+ $(CENGINE) stop $(CNTVER)
165166
166167
container-version:
167168
@echo $(CNTVER)
168169
--- Makefile.in
+++ Makefile.in
@@ -121,15 +121,16 @@
121
122 # Container stuff
123 SRCTB := src-@[email protected]
124 IMGVER := fossil:@FOSSIL_CI_PFX@
125 CNTVER := fossil-@FOSSIL_CI_PFX@
 
126 container:
127 docker image inspect $(IMGVER) > /dev/null 2>&1 || \
128 $(MAKE) container-image
129 docker container inspect $(CNTVER) > /dev/null 2>&1 || \
130 docker create \
131 --name $(CNTVER) \
132 --cap-drop AUDIT_WRITE \
133 --cap-drop CHOWN \
134 --cap-drop FSETID \
135 --cap-drop KILL \
@@ -137,31 +138,31 @@
137 --cap-drop NET_BIND_SERVICE \
138 --cap-drop NET_RAW \
139 --cap-drop SETFCAP \
140 --cap-drop SETPCAP \
141 --publish 8080:8080 \
142 $(DCFLAGS) $(IMGVER)
143
144 container-clean:
145 -docker container kill $(CNTVER)
146 -docker container rm $(CNTVER)
147 -docker image rm $(IMGVER)
148
149 container-image:
150 $(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
151 docker buildx build \
152 --load \
153 --tag $(IMGVER) \
154 --build-arg FSLURL=$(SRCTB) \
155 $(DBFLAGS) @srcdir@
156 rm -f $(SRCTB)
157
158 container-run container-start: container
159 docker start $(DSFLAGS) $(CNTVER)
160 @sleep 1 # decrease likelihood of logging race condition
161 docker container logs $(CNTVER)
162
163 container-stop:
164 docker stop $(CNTVER)
165
166 container-version:
167 @echo $(CNTVER)
168
--- Makefile.in
+++ Makefile.in
@@ -121,15 +121,16 @@
121
122 # Container stuff
123 SRCTB := src-@[email protected]
124 IMGVER := fossil:@FOSSIL_CI_PFX@
125 CNTVER := fossil-@FOSSIL_CI_PFX@
126 CENGINE := docker
127 container:
128 $(CENGINE) image inspect $(IMGVER) > /dev/null 2>&1 || \
129 $(MAKE) container-image
130 $(CENGINE) container inspect $(CNTVER) > /dev/null 2>&1 || \
131 $(CENGINE) create \
132 --name $(CNTVER) \
133 --cap-drop AUDIT_WRITE \
134 --cap-drop CHOWN \
135 --cap-drop FSETID \
136 --cap-drop KILL \
@@ -137,31 +138,31 @@
138 --cap-drop NET_BIND_SERVICE \
139 --cap-drop NET_RAW \
140 --cap-drop SETFCAP \
141 --cap-drop SETPCAP \
142 --publish 8080:8080 \
143 $(DCFLAGS) $(IMGVER) $(DCCMD)
144
145 container-clean:
146 -$(CENGINE) container kill $(CNTVER)
147 -$(CENGINE) container rm $(CNTVER)
148 -$(CENGINE) image rm $(IMGVER)
149
150 container-image:
151 $(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
152 $(CENGINE) buildx build \
153 --load \
154 --tag $(IMGVER) \
155 --build-arg FSLURL=$(SRCTB) \
156 $(DBFLAGS) @srcdir@
157 rm -f $(SRCTB)
158
159 container-run container-start: container
160 $(CENGINE) start $(DSFLAGS) $(CNTVER)
161 @sleep 1 # decrease likelihood of logging race condition
162 $(CENGINE) container logs $(CNTVER)
163
164 container-stop:
165 $(CENGINE) stop $(CNTVER)
166
167 container-version:
168 @echo $(CNTVER)
169
-1
--- auto.def
+++ auto.def
@@ -773,9 +773,8 @@
773773
# them, it also changes the URL we fetch the source tarball from, so
774774
# repeated builds of a given version generate and fetch the source
775775
# tarball once only, keeping it in the local Docker/Podman cache.
776776
set ci [readfile "$::autosetup(srcdir)/manifest.uuid"]
777777
define FOSSIL_CI_PFX [string range $ci 0 11]
778
-make-template containers/os-release.in
779778
780779
make-template Makefile.in
781780
make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
782781
783782
DELETED containers/Dockerfile-nojail.patch
784783
DELETED containers/busybox-config
785784
DELETED containers/os-release.in
--- auto.def
+++ auto.def
@@ -773,9 +773,8 @@
773 # them, it also changes the URL we fetch the source tarball from, so
774 # repeated builds of a given version generate and fetch the source
775 # tarball once only, keeping it in the local Docker/Podman cache.
776 set ci [readfile "$::autosetup(srcdir)/manifest.uuid"]
777 define FOSSIL_CI_PFX [string range $ci 0 11]
778 make-template containers/os-release.in
779
780 make-template Makefile.in
781 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
782
783 ELETED containers/Dockerfile-nojail.patch
784 ELETED containers/busybox-config
785 ELETED containers/os-release.in
--- auto.def
+++ auto.def
@@ -773,9 +773,8 @@
773 # them, it also changes the URL we fetch the source tarball from, so
774 # repeated builds of a given version generate and fetch the source
775 # tarball once only, keeping it in the local Docker/Podman cache.
776 set ci [readfile "$::autosetup(srcdir)/manifest.uuid"]
777 define FOSSIL_CI_PFX [string range $ci 0 11]
 
778
779 make-template Makefile.in
780 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
781
782 ELETED containers/Dockerfile-nojail.patch
783 ELETED containers/busybox-config
784 ELETED containers/os-release.in
D containers/Dockerfile-nojail.patch
-5
--- a/containers/Dockerfile-nojail.patch
+++ b/containers/Dockerfile-nojail.patch
@@ -1,5 +0,0 @@
1
-Index: Doc62,13 +62: DocIndebbx/busybox /bin/
2
- etc/os-release /etc/
3
-@@ -84,19 +84,17 @@
4
- && adduser -S -h `pwd` -g 'Fossil User'7,10 +105,9 @@
5
- ##
--- a/containers/Dockerfile-nojail.patch
+++ b/containers/Dockerfile-nojail.patch
@@ -1,5 +0,0 @@
1 Index: Doc62,13 +62: DocIndebbx/busybox /bin/
2 etc/os-release /etc/
3 @@ -84,19 +84,17 @@
4 && adduser -S -h `pwd` -g 'Fossil User'7,10 +105,9 @@
5 ##
--- a/containers/Dockerfile-nojail.patch
+++ b/containers/Dockerfile-nojail.patch
@@ -1,5 +0,0 @@
 
 
 
 
 
D containers/busybox-config
-1200
--- a/containers/busybox-config
+++ b/containers/busybox-config
@@ -1,1200 +0,0 @@
1
-#
2
-# Automatically generated make config: don't edit
3
-# Busybox version: 1.35.0
4
-# Tue Aug 16 02:15:21 2022
5
-#
6
-CONFIG_HAVE_DOT_CONFIG=y
7
-
8
-#
9
-# Settings
10
-#
11
-CONFIG_DESKTOP=y
12
-# CONFIG_EXTRA_COMPAT is not set
13
-# CONFIG_FEDORA_COMPAT is not set
14
-CONFIG_INCLUDE_SUSv2=y
15
-CONFIG_LONG_OPTS=y
16
-CONFIG_SHOW_USAGE=y
17
-CONFIG_FEATURE_VERBOSE_USAGE=y
18
-CONFIG_FEATURE_COMPRESS_USAGE=y
19
-CONFIG_LFS=y
20
-# CONFIG_PAM is not set
21
-CONFIG_FEATURE_DEVPTS=y
22
-CONFIG_FEATURE_UTMP=y
23
-CONFIG_FEATURE_WTMP=y
24
-CONFIG_FEATURE_PIDFILE=y
25
-CONFIG_PID_FILE_PATH="/var/run"
26
-CONFIG_BUSYBOX=y
27
-CONFIG_FEATURE_SHOW_SCRIPT=y
28
-CONFIG_FEATURE_INSTALLER=y
29
-# CONFIG_INSTALL_NO_USR is not set
30
-CONFIG_FEATURE_SUID=y
31
-CONFIG_FEATURE_SUID_CONFIG=y
32
-CONFIG_FEATURE_SUID_CONFIG_QUIET=y
33
-# CONFIG_FEATURE_PREFER_APPLETS is not set
34
-CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
35
-# CONFIG_SELINUX is not set
36
-# CONFIG_FEATURE_CLEAN_UP is not set
37
-CONFIG_FEATURE_SYSLOG_INFO=y
38
-CONFIG_FEATURE_SYSLOG=y
39
-
40
-#
41
-# Build Options
42
-#
43
-CONFIG_STATIC=y
44
-# CONFIG_PIE is not set
45
-# CONFIG_NOMMU is not set
46
-# CONFIG_BUILD_LIBBUSYBOX is not set
47
-# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
48
-# CONFIG_FEATURE_INDIVIDUAL is not set
49
-# CONFIG_FEATURE_SHARED_BUSYBOX is not set
50
-CONFIG_CROSS_COMPILER_PREFIX=""
51
-CONFIG_SYSROOT=""
52
-CONFIG_EXTRA_CFLAGS=""
53
-CONFIG_EXTRA_LDFLAGS=""
54
-CONFIG_EXTRA_LDLIBS=""
55
-# CONFIG_USE_PORTABLE_CODE is not set
56
-CONFIG_STACK_OPTIMIZATION_386=y
57
-CONFIG_STATIC_LIBGCC=y
58
-
59
-#
60
-# Installation Options ("make install" behavior)
61
-#
62
-CONFIG_INSTALL_APPLET_SYMLINKS=y
63
-# CONFIG_INSTALL_APPLET_HARDLINKS is not set
64
-# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
65
-# CONFIG_INSTALL_APPLET_DONT is not set
66
-# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
67
-# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
68
-# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
69
-CONFIG_PREFIX="./_install"
70
-
71
-#
72
-# Debugging Options
73
-#
74
-# CONFIG_DEBUG is not set
75
-# CONFIG_DEBUG_PESSIMIZE is not set
76
-# CONFIG_DEBUG_SANITIZE is not set
77
-# CONFIG_UNIT_TEST is not set
78
-# CONFIG_WERROR is not set
79
-# CONFIG_WARN_SIMPLE_MSG is not set
80
-CONFIG_NO_DEBUG_LIB=y
81
-# CONFIG_DMALLOC is not set
82
-# CONFIG_EFENCE is not set
83
-
84
-#
85
-# Library Tuning
86
-#
87
-# CONFIG_FEATURE_USE_BSS_TAIL is not set
88
-CONFIG_FLOAT_DURATION=y
89
-CONFIG_FEATURE_RTMINMAX=y
90
-CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=y
91
-CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
92
-# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
93
-# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
94
-CONFIG_PASSWORD_MINLEN=6
95
-CONFIG_MD5_SMALL=1
96
-CONFIG_SHA3_SMALL=1
97
-CONFIG_FEATURE_NON_POSIX_CP=y
98
-# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
99
-CONFIG_FEATURE_USE_SENDFILE=y
100
-CONFIG_FEATURE_COPYBUF_KB=4
101
-CONFIG_MONOTONIC_SYSCALL=y
102
-CONFIG_IOCTL_HEX2STR_ERROR=y
103
-CONFIG_FEATURE_EDITING=y
104
-CONFIG_FEATURE_EDITING_MAX_LEN=1024
105
-# CONFIG_FEATURE_EDITING_VI is not set
106
-CONFIG_FEATURE_EDITING_HISTORY=255
107
-CONFIG_FEATURE_EDITING_SAVEHISTORY=y
108
-# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
109
-CONFIG_FEATURE_REVERSE_SEARCH=y
110
-CONFIG_FEATURE_TAB_COMPLETION=y
111
-CONFIG_FEATURE_USERNAME_COMPLETION=y
112
-CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
113
-CONFIG_FEATURE_EDITING_WINCH=y
114
-# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
115
-# CONFIG_LOCALE_SUPPORT is not set
116
-CONFIG_UNICODE_SUPPORT=y
117
-# CONFIG_UNICODE_USING_LOCALE is not set
118
-# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
119
-CONFIG_SUBST_WCHAR=63
120
-CONFIG_LAST_SUPPORTED_WCHAR=767
121
-# CONFIG_UNICODE_COMBINING_WCHARS is not set
122
-# CONFIG_UNICODE_WIDE_WCHARS is not set
123
-# CONFIG_UNICODE_BIDI_SUPPORT is not set
124
-# CONFIG_UNICODE_NEUTRAL_TABLE is not set
125
-# CONFIG_UNICODE_PRESERVE_BROKEN is not set
126
-
127
-#
128
-# Applets
129
-#
130
-
131
-#
132
-# Archival Utilities
133
-#
134
-# CONFIG_FEATURE_SEAMLESS_XZ is not set
135
-# CONFIG_FEATURE_SEAMLESS_LZMA is not set
136
-# CONFIG_FEATURE_SEAMLESS_BZ2 is not set
137
-CONFIG_FEATURE_SEAMLESS_GZ=y
138
-# CONFIG_FEATURE_SEAMLESS_Z is not set
139
-# CONFIG_AR is not set
140
-# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
141
-# CONFIG_FEATURE_AR_CREATE is not set
142
-# CONFIG_UNCOMPRESS is not set
143
-CONFIG_GUNZIP=y
144
-CONFIG_ZCAT=y
145
-CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
146
-# CONFIG_BUNZIP2 is not set
147
-# CONFIG_BZCAT is not set
148
-# CONFIG_UNLZMA is not set
149
-# CONFIG_LZCAT is not set
150
-# CONFIG_LZMA is not set
151
-# CONFIG_UNXZ is not set
152
-# CONFIG_XZCAT is not set
153
-# CONFIG_XZ is not set
154
-# CONFIG_BZIP2 is not set
155
-CONFIG_BZIP2_SMALL=0
156
-# CONFIG_FEATURE_BZIP2_DECOMPRESS is not set
157
-# CONFIG_CPIO is not set
158
-# CONFIG_FEATURE_CPIO_O is not set
159
-# CONFIG_FEATURE_CPIO_P is not set
160
-# CONFIG_FEATURE_CPIO_IGNORE_DEVNO is not set
161
-# CONFIG_FEATURE_CPIO_RENUMBER_INODES is not set
162
-# CONFIG_DPKG is not set
163
-# CONFIG_DPKG_DEB is not set
164
-CONFIG_GZIP=y
165
-CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
166
-CONFIG_GZIP_FAST=0
167
-# CONFIG_FEATURE_GZIP_LEVELS is not set
168
-CONFIG_FEATURE_GZIP_DECOMPRESS=y
169
-# CONFIG_LZOP is not set
170
-# CONFIG_UNLZOP is not set
171
-# CONFIG_LZOPCAT is not set
172
-# CONFIG_LZOP_COMPR_HIGH is not set
173
-# CONFIG_RPM is not set
174
-# CONFIG_RPM2CPIO is not set
175
-CONFIG_TAR=y
176
-CONFIG_FEATURE_TAR_LONG_OPTIONS=y
177
-CONFIG_FEATURE_TAR_CREATE=y
178
-CONFIG_FEATURE_TAR_AUTODETECT=y
179
-CONFIG_FEATURE_TAR_FROM=y
180
-# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
181
-# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
182
-CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
183
-# CONFIG_FEATURE_TAR_TO_COMMAND is not set
184
-CONFIG_FEATURE_TAR_UNAME_GNAME=y
185
-CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
186
-# CONFIG_FEATURE_TAR_SELINUX is not set
187
-CONFIG_UNZIP=y
188
-CONFIG_FEATURE_UNZIP_CDF=y
189
-CONFIG_FEATURE_UNZIP_BZIP2=y
190
-CONFIG_FEATURE_UNZIP_LZMA=y
191
-CONFIG_FEATURE_UNZIP_XZ=y
192
-# CONFIG_FEATURE_LZMA_FAST is not set
193
-
194
-#
195
-# Coreutils
196
-#
197
-CONFIG_FEATURE_VERBOSE=y
198
-
199
-#
200
-# Common options for date and touch
201
-#
202
-CONFIG_FEATURE_TIMEZONE=y
203
-
204
-#
205
-# Common options for cp and mv
206
-#
207
-CONFIG_FEATURE_PRESERVE_HARDLINKS=y
208
-
209
-#
210
-# Common options for df, du, ls
211
-#
212
-CONFIG_FEATURE_HUMAN_READABLE=y
213
-CONFIG_BASENAME=y
214
-CONFIG_CAT=y
215
-CONFIG_FEATURE_CATN=y
216
-CONFIG_FEATURE_CATV=y
217
-CONFIG_CHGRP=y
218
-CONFIG_CHMOD=y
219
-CONFIG_CHOWN=y
220
-CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
221
-CONFIG_CHROOT=y
222
-# CONFIG_CKSUM is not set
223
-# CONFIG_CRC32 is not set
224
-CONFIG_COMM=y
225
-CONFIG_CP=y
226
-CONFIG_FEATURE_CP_LONG_OPTIONS=y
227
-CONFIG_FEATURE_CP_REFLINK=y
228
-CONFIG_CUT=y
229
-CONFIG_FEATURE_CUT_REGEX=y
230
-CONFIG_DATE=y
231
-CONFIG_FEATURE_DATE_ISOFMT=y
232
-# CONFIG_FEATURE_DATE_NANO is not set
233
-CONFIG_FEATURE_DATE_COMPAT=y
234
-CONFIG_DD=y
235
-CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
236
-CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
237
-CONFIG_FEATURE_DD_IBS_OBS=y
238
-CONFIG_FEATURE_DD_STATUS=y
239
-CONFIG_DF=y
240
-CONFIG_FEATURE_DF_FANCY=y
241
-CONFIG_FEATURE_SKIP_ROOTFS=y
242
-CONFIG_DIRNAME=y
243
-CONFIG_DOS2UNIX=y
244
-CONFIG_UNIX2DOS=y
245
-CONFIG_DU=y
246
-CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
247
-# CONFIG_ECHO is not set
248
-CONFIG_FEATURE_FANCY_ECHO=y
249
-CONFIG_ENV=y
250
-CONFIG_EXPAND=y
251
-CONFIG_UNEXPAND=y
252
-CONFIG_EXPR=y
253
-CONFIG_EXPR_MATH_SUPPORT_64=y
254
-# CONFIG_FACTOR is not set
255
-CONFIG_FALSE=y
256
-CONFIG_FOLD=y
257
-CONFIG_HEAD=y
258
-CONFIG_FEATURE_FANCY_HEAD=y
259
-CONFIG_HOSTID=y
260
-CONFIG_ID=y
261
-CONFIG_GROUPS=y
262
-CONFIG_INSTALL=y
263
-CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
264
-CONFIG_LINK=y
265
-CONFIG_LN=y
266
-# CONFIG_LOGNAME is not set
267
-CONFIG_LS=y
268
-CONFIG_FEATURE_LS_FILETYPES=y
269
-CONFIG_FEATURE_LS_FOLLOWLINKS=y
270
-CONFIG_FEATURE_LS_RECURSIVE=y
271
-CONFIG_FEATURE_LS_WIDTH=y
272
-CONFIG_FEATURE_LS_SORTFILES=y
273
-CONFIG_FEATURE_LS_TIMESTAMPS=y
274
-CONFIG_FEATURE_LS_USERNAME=y
275
-CONFIG_FEATURE_LS_COLOR=y
276
-CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
277
-# CONFIG_MD5SUM is not set
278
-# CONFIG_SHA1SUM is not set
279
-# CONFIG_SHA256SUM is not set
280
-# CONFIG_SHA512SUM is not set
281
-# CONFIG_SHA3SUM is not set
282
-# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
283
-CONFIG_MKDIR=y
284
-CONFIG_MKFIFO=y
285
-CONFIG_MKNOD=y
286
-CONFIG_MKTEMP=y
287
-CONFIG_MV=y
288
-CONFIG_NICE=y
289
-CONFIG_NL=y
290
-CONFIG_NOHUP=y
291
-CONFIG_NPROC=y
292
-CONFIG_OD=y
293
-CONFIG_PASTE=y
294
-# CONFIG_PRINTENV is not set
295
-# CONFIG_PRINTF is not set
296
-CONFIG_PWD=y
297
-CONFIG_READLINK=y
298
-CONFIG_FEATURE_READLINK_FOLLOW=y
299
-CONFIG_REALPATH=y
300
-CONFIG_RM=y
301
-CONFIG_RMDIR=y
302
-CONFIG_SEQ=y
303
-CONFIG_SHRED=y
304
-CONFIG_SHUF=y
305
-CONFIG_SLEEP=y
306
-CONFIG_FEATURE_FANCY_SLEEP=y
307
-CONFIG_SORT=y
308
-# CONFIG_FEATURE_SORT_BIG is not set
309
-# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
310
-CONFIG_SPLIT=y
311
-CONFIG_FEATURE_SPLIT_FANCY=y
312
-CONFIG_STAT=y
313
-CONFIG_FEATURE_STAT_FORMAT=y
314
-CONFIG_FEATURE_STAT_FILESYSTEM=y
315
-CONFIG_STTY=y
316
-# CONFIG_SUM is not set
317
-CONFIG_SYNC=y
318
-CONFIG_FEATURE_SYNC_FANCY=y
319
-CONFIG_FSYNC=y
320
-CONFIG_TAC=y
321
-CONFIG_TAIL=y
322
-CONFIG_FEATURE_FANCY_TAIL=y
323
-CONFIG_TEE=y
324
-CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
325
-# CONFIG_TEST is not set
326
-# CONFIG_TEST1 is not set
327
-# CONFIG_TEST2 is not set
328
-# CONFIG_FEATURE_TEST_64 is not set
329
-CONFIG_TIMEOUT=y
330
-CONFIG_TOUCH=y
331
-CONFIG_FEATURE_TOUCH_SUSV3=y
332
-CONFIG_TR=y
333
-CONFIG_FEATURE_TR_CLASSES=y
334
-CONFIG_FEATURE_TR_EQUIV=y
335
-CONFIG_TRUE=y
336
-CONFIG_TRUNCATE=y
337
-CONFIG_TTY=y
338
-CONFIG_UNAME=y
339
-CONFIG_UNAME_OSNAME="GNU/Linux"
340
-CONFIG_BB_ARCH=y
341
-CONFIG_UNIQ=y
342
-CONFIG_UNLINK=y
343
-CONFIG_USLEEP=y
344
-CONFIG_UUDECODE=y
345
-CONFIG_BASE32=y
346
-CONFIG_BASE64=y
347
-CONFIG_UUENCODE=y
348
-CONFIG_WC=y
349
-CONFIG_FEATURE_WC_LARGE=y
350
-CONFIG_WHO=y
351
-CONFIG_W=y
352
-CONFIG_USERS=y
353
-CONFIG_WHOAMI=y
354
-CONFIG_YES=y
355
-
356
-#
357
-# Console Utilities
358
-#
359
-# CONFIG_CHVT is not set
360
-CONFIG_CLEAR=y
361
-# CONFIG_DEALLOCVT is not set
362
-# CONFIG_DUMPKMAP is not set
363
-# CONFIG_FGCONSOLE is not set
364
-# CONFIG_KBD_MODE is not set
365
-# CONFIG_LOADFONT is not set
366
-# CONFIG_SETFONT is not set
367
-# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
368
-CONFIG_DEFAULT_SETFONT_DIR=""
369
-# CONFIG_FEATURE_LOADFONT_PSF2 is not set
370
-# CONFIG_FEATURE_LOADFONT_RAW is not set
371
-# CONFIG_LOADKMAP is not set
372
-# CONFIG_OPENVT is not set
373
-# CONFIG_RESET is not set
374
-# CONFIG_RESIZE is not set
375
-# CONFIG_FEATURE_RESIZE_PRINT is not set
376
-# CONFIG_SETCONSOLE is not set
377
-# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
378
-# CONFIG_SETKEYCODES is not set
379
-# CONFIG_SETLOGCONS is not set
380
-# CONFIG_SHOWKEY is not set
381
-
382
-#
383
-# Debian Utilities
384
-#
385
-# CONFIG_PIPE_PROGRESS is not set
386
-# CONFIG_RUN_PARTS is not set
387
-# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
388
-# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
389
-# CONFIG_START_STOP_DAEMON is not set
390
-# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
391
-# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
392
-CONFIG_WHICH=y
393
-
394
-#
395
-# klibc-utils
396
-#
397
-# CONFIG_MINIPS is not set
398
-# CONFIG_NUKE is not set
399
-# CONFIG_RESUME is not set
400
-# CONFIG_RUN_INIT is not set
401
-
402
-#
403
-# Editors
404
-#
405
-# CONFIG_AWK is not set
406
-# CONFIG_FEATURE_AWK_LIBM is not set
407
-# CONFIG_FEATURE_AWK_GNU_EXTENSIONS is not set
408
-# CONFIG_CMP is not set
409
-CONFIG_DIFF=y
410
-CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
411
-CONFIG_FEATURE_DIFF_DIR=y
412
-# CONFIG_ED is not set
413
-CONFIG_PATCH=y
414
-CONFIG_SED=y
415
-CONFIG_VI=y
416
-CONFIG_FEATURE_VI_MAX_LEN=4096
417
-# CONFIG_FEATURE_VI_8BIT is not set
418
-CONFIG_FEATURE_VI_COLON=y
419
-CONFIG_FEATURE_VI_COLON_EXPAND=y
420
-CONFIG_FEATURE_VI_YANKMARK=y
421
-CONFIG_FEATURE_VI_SEARCH=y
422
-# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
423
-CONFIG_FEATURE_VI_USE_SIGNALS=y
424
-CONFIG_FEATURE_VI_DOT_CMD=y
425
-CONFIG_FEATURE_VI_READONLY=y
426
-CONFIG_FEATURE_VI_SETOPTS=y
427
-CONFIG_FEATURE_VI_SET=y
428
-CONFIG_FEATURE_VI_WIN_RESIZE=y
429
-CONFIG_FEATURE_VI_ASK_TERMINAL=y
430
-CONFIG_FEATURE_VI_UNDO=y
431
-CONFIG_FEATURE_VI_UNDO_QUEUE=y
432
-CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
433
-CONFIG_FEATURE_VI_VERBOSE_STATUS=y
434
-CONFIG_FEATURE_ALLOW_EXEC=y
435
-
436
-#
437
-# Finding Utilities
438
-#
439
-CONFIG_FIND=y
440
-CONFIG_FEATURE_FIND_PRINT0=y
441
-CONFIG_FEATURE_FIND_MTIME=y
442
-CONFIG_FEATURE_FIND_ATIME=y
443
-CONFIG_FEATURE_FIND_CTIME=y
444
-CONFIG_FEATURE_FIND_MMIN=y
445
-CONFIG_FEATURE_FIND_AMIN=y
446
-CONFIG_FEATURE_FIND_CMIN=y
447
-CONFIG_FEATURE_FIND_PERM=y
448
-CONFIG_FEATURE_FIND_TYPE=y
449
-CONFIG_FEATURE_FIND_EXECUTABLE=y
450
-CONFIG_FEATURE_FIND_XDEV=y
451
-CONFIG_FEATURE_FIND_MAXDEPTH=y
452
-CONFIG_FEATURE_FIND_NEWER=y
453
-CONFIG_FEATURE_FIND_INUM=y
454
-CONFIG_FEATURE_FIND_SAMEFILE=y
455
-CONFIG_FEATURE_FIND_EXEC=y
456
-CONFIG_FEATURE_FIND_EXEC_PLUS=y
457
-CONFIG_FEATURE_FIND_USER=y
458
-CONFIG_FEATURE_FIND_GROUP=y
459
-CONFIG_FEATURE_FIND_NOT=y
460
-CONFIG_FEATURE_FIND_DEPTH=y
461
-CONFIG_FEATURE_FIND_PAREN=y
462
-CONFIG_FEATURE_FIND_SIZE=y
463
-CONFIG_FEATURE_FIND_PRUNE=y
464
-CONFIG_FEATURE_FIND_QUIT=y
465
-CONFIG_FEATURE_FIND_DELETE=y
466
-CONFIG_FEATURE_FIND_EMPTY=y
467
-CONFIG_FEATURE_FIND_PATH=y
468
-CONFIG_FEATURE_FIND_REGEX=y
469
-# CONFIG_FEATURE_FIND_CONTEXT is not set
470
-CONFIG_FEATURE_FIND_LINKS=y
471
-CONFIG_GREP=y
472
-# CONFIG_EGREP is not set
473
-# CONFIG_FGREP is not set
474
-CONFIG_FEATURE_GREP_CONTEXT=y
475
-CONFIG_XARGS=y
476
-CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
477
-CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
478
-CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
479
-CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
480
-CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
481
-CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y
482
-CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y
483
-
484
-#
485
-# Init Utilities
486
-#
487
-# CONFIG_BOOTCHARTD is not set
488
-# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
489
-# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
490
-# CONFIG_HALT is not set
491
-# CONFIG_POWEROFF is not set
492
-# CONFIG_REBOOT is not set
493
-# CONFIG_FEATURE_WAIT_FOR_INIT is not set
494
-# CONFIG_FEATURE_CALL_TELINIT is not set
495
-CONFIG_TELINIT_PATH=""
496
-# CONFIG_INIT is not set
497
-# CONFIG_LINUXRC is not set
498
-# CONFIG_FEATURE_USE_INITTAB is not set
499
-# CONFIG_FEATURE_KILL_REMOVED is not set
500
-CONFIG_FEATURE_KILL_DELAY=0
501
-# CONFIG_FEATURE_INIT_SCTTY is not set
502
-# CONFIG_FEATURE_INIT_SYSLOG is not set
503
-# CONFIG_FEATURE_INIT_QUIET is not set
504
-# CONFIG_FEATURE_INIT_COREDUMPS is not set
505
-CONFIG_INIT_TERMINAL_TYPE=""
506
-# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
507
-
508
-#
509
-# Login/Password Management Utilities
510
-#
511
-# CONFIG_FEATURE_SHADOWPASSWDS is not set
512
-CONFIG_USE_BB_PWD_GRP=y
513
-# CONFIG_USE_BB_SHADOW is not set
514
-CONFIG_USE_BB_CRYPT=y
515
-CONFIG_USE_BB_CRYPT_SHA=y
516
-# CONFIG_ADD_SHELL is not set
517
-# CONFIG_REMOVE_SHELL is not set
518
-CONFIG_ADDGROUP=y
519
-# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
520
-CONFIG_ADDUSER=y
521
-# CONFIG_FEATURE_CHECK_NAMES is not set
522
-CONFIG_LAST_ID=60000
523
-CONFIG_FIRST_SYSTEM_ID=100
524
-CONFIG_LAST_SYSTEM_ID=999
525
-# CONFIG_CHPASSWD is not set
526
-CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
527
-# CONFIG_CRYPTPW is not set
528
-# CONFIG_MKPASSWD is not set
529
-# CONFIG_DELUSER is not set
530
-# CONFIG_DELGROUP is not set
531
-# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
532
-# CONFIG_GETTY is not set
533
-# CONFIG_LOGIN is not set
534
-# CONFIG_LOGIN_SESSION_AS_CHILD is not set
535
-# CONFIG_LOGIN_SCRIPTS is not set
536
-# CONFIG_FEATURE_NOLOGIN is not set
537
-# CONFIG_FEATURE_SECURETTY is not set
538
-# CONFIG_PASSWD is not set
539
-# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
540
-# CONFIG_SU is not set
541
-# CONFIG_FEATURE_SU_SYSLOG is not set
542
-# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
543
-# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
544
-# CONFIG_SULOGIN is not set
545
-# CONFIG_VLOCK is not set
546
-
547
-#
548
-# Linux Ext2 FS Progs
549
-#
550
-# CONFIG_CHATTR is not set
551
-# CONFIG_FSCK is not set
552
-# CONFIG_LSATTR is not set
553
-# CONFIG_TUNE2FS is not set
554
-
555
-#
556
-# Linux Module Utilities
557
-#
558
-# CONFIG_MODPROBE_SMALL is not set
559
-# CONFIG_DEPMOD is not set
560
-# CONFIG_INSMOD is not set
561
-# CONFIG_LSMOD is not set
562
-# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
563
-# CONFIG_MODINFO is not set
564
-# CONFIG_MODPROBE is not set
565
-# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
566
-# CONFIG_RMMOD is not set
567
-
568
-#
569
-# Options common to multiple modutils
570
-#
571
-# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
572
-# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
573
-# CONFIG_FEATURE_2_4_MODULES is not set
574
-# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
575
-# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
576
-# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
577
-# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
578
-# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
579
-# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
580
-# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
581
-# CONFIG_FEATURE_MODUTILS_ALIAS is not set
582
-# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
583
-CONFIG_DEFAULT_MODULES_DIR=""
584
-CONFIG_DEFAULT_DEPMOD_FILE=""
585
-
586
-#
587
-# Linux System Utilities
588
-#
589
-# CONFIG_ACPID is not set
590
-# CONFIG_FEATURE_ACPID_COMPAT is not set
591
-# CONFIG_BLKDISCARD is not set
592
-# CONFIG_BLKID is not set
593
-# CONFIG_FEATURE_BLKID_TYPE is not set
594
-# CONFIG_BLOCKDEV is not set
595
-# CONFIG_CAL is not set
596
-# CONFIG_CHRT is not set
597
-# CONFIG_DMESG is not set
598
-# CONFIG_FEATURE_DMESG_PRETTY is not set
599
-# CONFIG_EJECT is not set
600
-# CONFIG_FEATURE_EJECT_SCSI is not set
601
-# CONFIG_FALLOCATE is not set
602
-# CONFIG_FATATTR is not set
603
-# CONFIG_FBSET is not set
604
-# CONFIG_FEATURE_FBSET_FANCY is not set
605
-# CONFIG_FEATURE_FBSET_READMODE is not set
606
-# CONFIG_FDFORMAT is not set
607
-# CONFIG_FDISK is not set
608
-# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
609
-# CONFIG_FEATURE_FDISK_WRITABLE is not set
610
-# CONFIG_FEATURE_AIX_LABEL is not set
611
-# CONFIG_FEATURE_SGI_LABEL is not set
612
-# CONFIG_FEATURE_SUN_LABEL is not set
613
-# CONFIG_FEATURE_OSF_LABEL is not set
614
-# CONFIG_FEATURE_GPT_LABEL is not set
615
-# CONFIG_FEATURE_FDISK_ADVANCED is not set
616
-# CONFIG_FINDFS is not set
617
-# CONFIG_FLOCK is not set
618
-# CONFIG_FDFLUSH is not set
619
-# CONFIG_FREERAMDISK is not set
620
-# CONFIG_FSCK_MINIX is not set
621
-# CONFIG_FSFREEZE is not set
622
-# CONFIG_FSTRIM is not set
623
-# CONFIG_GETOPT is not set
624
-# CONFIG_FEATURE_GETOPT_LONG is not set
625
-CONFIG_HEXDUMP=y
626
-CONFIG_HD=y
627
-CONFIG_XXD=y
628
-# CONFIG_HWCLOCK is not set
629
-# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
630
-# CONFIG_IONICE is not set
631
-# CONFIG_IPCRM is not set
632
-# CONFIG_IPCS is not set
633
-# CONFIG_LAST is not set
634
-# CONFIG_FEATURE_LAST_FANCY is not set
635
-# CONFIG_LOSETUP is not set
636
-# CONFIG_LSPCI is not set
637
-# CONFIG_LSUSB is not set
638
-# CONFIG_MDEV is not set
639
-# CONFIG_FEATURE_MDEV_CONF is not set
640
-# CONFIG_FEATURE_MDEV_RENAME is not set
641
-# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
642
-# CONFIG_FEATURE_MDEV_EXEC is not set
643
-# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
644
-# CONFIG_FEATURE_MDEV_DAEMON is not set
645
-# CONFIG_MESG is not set
646
-# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
647
-# CONFIG_MKE2FS is not set
648
-# CONFIG_MKFS_EXT2 is not set
649
-# CONFIG_MKFS_MINIX is not set
650
-# CONFIG_FEATURE_MINIX2 is not set
651
-# CONFIG_MKFS_REISER is not set
652
-# CONFIG_MKDOSFS is not set
653
-# CONFIG_MKFS_VFAT is not set
654
-# CONFIG_MKSWAP is not set
655
-# CONFIG_FEATURE_MKSWAP_UUID is not set
656
-CONFIG_MORE=y
657
-CONFIG_MOUNT=y
658
-CONFIG_FEATURE_MOUNT_FAKE=y
659
-CONFIG_FEATURE_MOUNT_VERBOSE=y
660
-# CONFIG_FEATURE_MOUNT_HELPERS is not set
661
-# CONFIG_FEATURE_MOUNT_LABEL is not set
662
-# CONFIG_FEATURE_MOUNT_NFS is not set
663
-# CONFIG_FEATURE_MOUNT_CIFS is not set
664
-CONFIG_FEATURE_MOUNT_FLAGS=y
665
-CONFIG_FEATURE_MOUNT_FSTAB=y
666
-CONFIG_FEATURE_MOUNT_OTHERTAB=y
667
-# CONFIG_MOUNTPOINT is not set
668
-CONFIG_NOLOGIN=y
669
-# CONFIG_NOLOGIN_DEPENDENCIES is not set
670
-# CONFIG_NSENTER is not set
671
-# CONFIG_PIVOT_ROOT is not set
672
-# CONFIG_RDATE is not set
673
-# CONFIG_RDEV is not set
674
-# CONFIG_READPROFILE is not set
675
-CONFIG_RENICE=y
676
-CONFIG_REV=y
677
-# CONFIG_RTCWAKE is not set
678
-# CONFIG_SCRIPT is not set
679
-# CONFIG_SCRIPTREPLAY is not set
680
-# CONFIG_SETARCH is not set
681
-# CONFIG_LINUX32 is not set
682
-# CONFIG_LINUX64 is not set
683
-# CONFIG_SETPRIV is not set
684
-# CONFIG_FEATURE_SETPRIV_DUMP is not set
685
-# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
686
-# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
687
-# CONFIG_SETSID is not set
688
-# CONFIG_SWAPON is not set
689
-# CONFIG_FEATURE_SWAPON_DISCARD is not set
690
-# CONFIG_FEATURE_SWAPON_PRI is not set
691
-# CONFIG_SWAPOFF is not set
692
-# CONFIG_FEATURE_SWAPONOFF_LABEL is not set
693
-# CONFIG_SWITCH_ROOT is not set
694
-# CONFIG_TASKSET is not set
695
-# CONFIG_FEATURE_TASKSET_FANCY is not set
696
-# CONFIG_FEATURE_TASKSET_CPULIST is not set
697
-# CONFIG_UEVENT is not set
698
-CONFIG_UMOUNT=y
699
-CONFIG_FEATURE_UMOUNT_ALL=y
700
-# CONFIG_UNSHARE is not set
701
-# CONFIG_WALL is not set
702
-
703
-#
704
-# Common options for mount/umount
705
-#
706
-# CONFIG_FEATURE_MOUNT_LOOP is not set
707
-# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
708
-# CONFIG_FEATURE_MTAB_SUPPORT is not set
709
-# CONFIG_VOLUMEID is not set
710
-# CONFIG_FEATURE_VOLUMEID_BCACHE is not set
711
-# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
712
-# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
713
-# CONFIG_FEATURE_VOLUMEID_EROFS is not set
714
-# CONFIG_FEATURE_VOLUMEID_EXFAT is not set
715
-# CONFIG_FEATURE_VOLUMEID_EXT is not set
716
-# CONFIG_FEATURE_VOLUMEID_F2FS is not set
717
-# CONFIG_FEATURE_VOLUMEID_FAT is not set
718
-# CONFIG_FEATURE_VOLUMEID_HFS is not set
719
-# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
720
-# CONFIG_FEATURE_VOLUMEID_JFS is not set
721
-# CONFIG_FEATURE_VOLUMEID_LFS is not set
722
-# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
723
-# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
724
-# CONFIG_FEATURE_VOLUMEID_LUKS is not set
725
-# CONFIG_FEATURE_VOLUMEID_MINIX is not set
726
-# CONFIG_FEATURE_VOLUMEID_NILFS is not set
727
-# CONFIG_FEATURE_VOLUMEID_NTFS is not set
728
-# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
729
-# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
730
-# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
731
-# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
732
-# CONFIG_FEATURE_VOLUMEID_SYSV is not set
733
-# CONFIG_FEATURE_VOLUMEID_UBIFS is not set
734
-# CONFIG_FEATURE_VOLUMEID_UDF is not set
735
-# CONFIG_FEATURE_VOLUMEID_XFS is not set
736
-
737
-#
738
-# Miscellaneous Utilities
739
-#
740
-# CONFIG_ADJTIMEX is not set
741
-# CONFIG_ASCII is not set
742
-# CONFIG_BBCONFIG is not set
743
-# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
744
-CONFIG_BC=y
745
-# CONFIG_DC is not set
746
-CONFIG_FEATURE_DC_BIG=y
747
-# CONFIG_FEATURE_DC_LIBM is not set
748
-# CONFIG_FEATURE_BC_INTERACTIVE is not set
749
-# CONFIG_FEATURE_BC_LONG_OPTIONS is not set
750
-# CONFIG_BEEP is not set
751
-CONFIG_FEATURE_BEEP_FREQ=0
752
-CONFIG_FEATURE_BEEP_LENGTH_MS=0
753
-# CONFIG_CHAT is not set
754
-# CONFIG_FEATURE_CHAT_NOFAIL is not set
755
-# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
756
-# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
757
-# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
758
-# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
759
-# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
760
-# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
761
-# CONFIG_CONSPY is not set
762
-CONFIG_CROND=y
763
-CONFIG_FEATURE_CROND_D=y
764
-CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
765
-CONFIG_FEATURE_CROND_SPECIAL_TIMES=y
766
-CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
767
-CONFIG_CRONTAB=y
768
-# CONFIG_DEVFSD is not set
769
-# CONFIG_DEVFSD_MODLOAD is not set
770
-# CONFIG_DEVFSD_FG_NP is not set
771
-# CONFIG_DEVFSD_VERBOSE is not set
772
-# CONFIG_FEATURE_DEVFS is not set
773
-# CONFIG_DEVMEM is not set
774
-# CONFIG_FBSPLASH is not set
775
-# CONFIG_FLASH_ERASEALL is not set
776
-# CONFIG_FLASH_LOCK is not set
777
-# CONFIG_FLASH_UNLOCK is not set
778
-# CONFIG_FLASHCP is not set
779
-# CONFIG_HDPARM is not set
780
-# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
781
-# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
782
-# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
783
-# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
784
-# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
785
-# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
786
-CONFIG_HEXEDIT=y
787
-# CONFIG_I2CGET is not set
788
-# CONFIG_I2CSET is not set
789
-# CONFIG_I2CDUMP is not set
790
-# CONFIG_I2CDETECT is not set
791
-# CONFIG_I2CTRANSFER is not set
792
-# CONFIG_INOTIFYD is not set
793
-CONFIG_LESS=y
794
-CONFIG_FEATURE_LESS_MAXLINES=9999999
795
-CONFIG_FEATURE_LESS_BRACKETS=y
796
-CONFIG_FEATURE_LESS_FLAGS=y
797
-CONFIG_FEATURE_LESS_TRUNCATE=y
798
-CONFIG_FEATURE_LESS_MARKS=y
799
-CONFIG_FEATURE_LESS_REGEXP=y
800
-CONFIG_FEATURE_LESS_WINCH=y
801
-CONFIG_FEATURE_LESS_ASK_TERMINAL=y
802
-CONFIG_FEATURE_LESS_DASHCMD=y
803
-CONFIG_FEATURE_LESS_LINENUMS=y
804
-CONFIG_FEATURE_LESS_RAW=y
805
-CONFIG_FEATURE_LESS_ENV=y
806
-# CONFIG_LSSCSI is not set
807
-# CONFIG_MAKEDEVS is not set
808
-# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
809
-# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
810
-# CONFIG_MAN is not set
811
-# CONFIG_MICROCOM is not set
812
-# CONFIG_MIM is not set
813
-# CONFIG_MT is not set
814
-# CONFIG_NANDWRITE is not set
815
-# CONFIG_NANDDUMP is not set
816
-# CONFIG_PARTPROBE is not set
817
-# CONFIG_RAIDAUTORUN is not set
818
-# CONFIG_READAHEAD is not set
819
-# CONFIG_RFKILL is not set
820
-# CONFIG_RUNLEVEL is not set
821
-# CONFIG_RX is not set
822
-# CONFIG_SETFATTR is not set
823
-# CONFIG_SETSERIAL is not set
824
-CONFIG_STRINGS=y
825
-CONFIG_TIME=y
826
-# CONFIG_TS is not set
827
-# CONFIG_TTYSIZE is not set
828
-# CONFIG_UBIATTACH is not set
829
-# CONFIG_UBIDETACH is not set
830
-# CONFIG_UBIMKVOL is not set
831
-# CONFIG_UBIRMVOL is not set
832
-# CONFIG_UBIRSVOL is not set
833
-# CONFIG_UBIUPDATEVOL is not set
834
-# CONFIG_UBIRENAME is not set
835
-# CONFIG_VOLNAME is not set
836
-# CONFIG_WATCHDOG is not set
837
-# CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set
838
-
839
-#
840
-# Networking Utilities
841
-#
842
-CONFIG_FEATURE_IPV6=y
843
-# CONFIG_FEATURE_UNIX_LOCAL is not set
844
-CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
845
-# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
846
-# CONFIG_FEATURE_ETC_NETWORKS is not set
847
-# CONFIG_FEATURE_ETC_SERVICES is not set
848
-# CONFIG_FEATURE_HWIB is not set
849
-# CONFIG_FEATURE_TLS_SHA1 is not set
850
-# CONFIG_ARP is not set
851
-# CONFIG_ARPING is not set
852
-# CONFIG_BRCTL is not set
853
-# CONFIG_FEATURE_BRCTL_FANCY is not set
854
-# CONFIG_FEATURE_BRCTL_SHOW is not set
855
-# CONFIG_DNSD is not set
856
-# CONFIG_ETHER_WAKE is not set
857
-# CONFIG_FTPD is not set
858
-# CONFIG_FEATURE_FTPD_WRITE is not set
859
-# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
860
-# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
861
-# CONFIG_FTPGET is not set
862
-# CONFIG_FTPPUT is not set
863
-# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
864
-# CONFIG_HOSTNAME is not set
865
-# CONFIG_DNSDOMAINNAME is not set
866
-# CONFIG_HTTPD is not set
867
-CONFIG_FEATURE_HTTPD_PORT_DEFAULT=0
868
-# CONFIG_FEATURE_HTTPD_RANGES is not set
869
-# CONFIG_FEATURE_HTTPD_SETUID is not set
870
-# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
871
-# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
872
-# CONFIG_FEATURE_HTTPD_CGI is not set
873
-# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
874
-# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
875
-# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
876
-# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
877
-# CONFIG_FEATURE_HTTPD_PROXY is not set
878
-# CONFIG_FEATURE_HTTPD_GZIP is not set
879
-# CONFIG_FEATURE_HTTPD_ETAG is not set
880
-# CONFIG_FEATURE_HTTPD_LAST_MODIFIED is not set
881
-# CONFIG_FEATURE_HTTPD_DATE is not set
882
-# CONFIG_FEATURE_HTTPD_ACL_IP is not set
883
-CONFIG_IFCONFIG=y
884
-CONFIG_FEATURE_IFCONFIG_STATUS=y
885
-# CONFIG_FEATURE_IFCONFIG_SLIP is not set
886
-CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
887
-CONFIG_FEATURE_IFCONFIG_HW=y
888
-CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
889
-# CONFIG_IFENSLAVE is not set
890
-# CONFIG_IFPLUGD is not set
891
-# CONFIG_IFUP is not set
892
-# CONFIG_IFDOWN is not set
893
-CONFIG_IFUPDOWN_IFSTATE_PATH=""
894
-# CONFIG_FEATURE_IFUPDOWN_IP is not set
895
-# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
896
-# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
897
-# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
898
-# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
899
-CONFIG_INETD=y
900
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
901
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
902
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
903
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
904
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
905
-# CONFIG_FEATURE_INETD_RPC is not set
906
-CONFIG_IP=y
907
-# CONFIG_IPADDR is not set
908
-# CONFIG_IPLINK is not set
909
-# CONFIG_IPROUTE is not set
910
-# CONFIG_IPTUNNEL is not set
911
-# CONFIG_IPRULE is not set
912
-# CONFIG_IPNEIGH is not set
913
-CONFIG_FEATURE_IP_ADDRESS=y
914
-CONFIG_FEATURE_IP_LINK=y
915
-CONFIG_FEATURE_IP_ROUTE=y
916
-CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
917
-# CONFIG_FEATURE_IP_TUNNEL is not set
918
-# CONFIG_FEATURE_IP_RULE is not set
919
-CONFIG_FEATURE_IP_NEIGH=y
920
-# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
921
-CONFIG_IPCALC=y
922
-CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
923
-CONFIG_FEATURE_IPCALC_FANCY=y
924
-# CONFIG_FAKEIDENTD is not set
925
-# CONFIG_NAMEIF is not set
926
-# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
927
-# CONFIG_NBDCLIENT is not set
928
-CONFIG_NC=y
929
-# CONFIG_NETCAT is not set
930
-CONFIG_NC_SERVER=y
931
-CONFIG_NC_EXTRA=y
932
-CONFIG_NC_110_COMPAT=y
933
-# CONFIG_NETSTAT is not set
934
-# CONFIG_FEATURE_NETSTAT_WIDE is not set
935
-# CONFIG_FEATURE_NETSTAT_PRG is not set
936
-# CONFIG_NSLOOKUP is not set
937
-# CONFIG_FEATURE_NSLOOKUP_BIG is not set
938
-# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
939
-# CONFIG_NTPD is not set
940
-# CONFIG_FEATURE_NTPD_SERVER is not set
941
-# CONFIG_FEATURE_NTPD_CONF is not set
942
-# CONFIG_FEATURE_NTP_AUTH is not set
943
-# CONFIG_PING is not set
944
-# CONFIG_PING6 is not set
945
-# CONFIG_FEATURE_FANCY_PING is not set
946
-# CONFIG_PSCAN is not set
947
-CONFIG_ROUTE=y
948
-# CONFIG_SLATTACH is not set
949
-CONFIG_SSL_CLIENT=y
950
-# CONFIG_TC is not set
951
-# CONFIG_FEATURE_TC_INGRESS is not set
952
-# CONFIG_TCPSVD is not set
953
-# CONFIG_UDPSVD is not set
954
-# CONFIG_TELNET is not set
955
-# CONFIG_FEATURE_TELNET_TTYPE is not set
956
-# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
957
-# CONFIG_FEATURE_TELNET_WIDTH is not set
958
-# CONFIG_TELNETD is not set
959
-# CONFIG_FEATURE_TELNETD_STANDALONE is not set
960
-CONFIG_FEATURE_TELNETD_PORT_DEFAULT=0
961
-# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
962
-# CONFIG_TFTP is not set
963
-# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
964
-# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set
965
-# CONFIG_TFTPD is not set
966
-# CONFIG_FEATURE_TFTP_GET is not set
967
-# CONFIG_FEATURE_TFTP_PUT is not set
968
-# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
969
-# CONFIG_TFTP_DEBUG is not set
970
-CONFIG_TLS=y
971
-# CONFIG_TRACEROUTE is not set
972
-# CONFIG_TRACEROUTE6 is not set
973
-# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
974
-# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
975
-# CONFIG_TUNCTL is not set
976
-# CONFIG_FEATURE_TUNCTL_UG is not set
977
-# CONFIG_VCONFIG is not set
978
-CONFIG_WGET=y
979
-CONFIG_FEATURE_WGET_LONG_OPTIONS=y
980
-CONFIG_FEATURE_WGET_STATUSBAR=y
981
-CONFIG_FEATURE_WGET_FTP=y
982
-CONFIG_FEATURE_WGET_AUTHENTICATION=y
983
-CONFIG_FEATURE_WGET_TIMEOUT=y
984
-CONFIG_FEATURE_WGET_HTTPS=y
985
-CONFIG_FEATURE_WGET_OPENSSL=y
986
-CONFIG_WHOIS=y
987
-# CONFIG_ZCIP is not set
988
-# CONFIG_UDHCPD is not set
989
-# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
990
-# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
991
-CONFIG_DHCPD_LEASES_FILE=""
992
-# CONFIG_DUMPLEASES is not set
993
-# CONFIG_DHCPRELAY is not set
994
-# CONFIG_UDHCPC is not set
995
-# CONFIG_FEATURE_UDHCPC_ARPING is not set
996
-# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
997
-CONFIG_UDHCPC_DEFAULT_SCRIPT=""
998
-# CONFIG_UDHCPC6 is not set
999
-# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
1000
-# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
1001
-# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
1002
-# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
1003
-CONFIG_UDHCPC_DEFAULT_INTERFACE=""
1004
-# CONFIG_FEATURE_UDHCP_PORT is not set
1005
-CONFIG_UDHCP_DEBUG=0
1006
-CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
1007
-# CONFIG_FEATURE_UDHCP_RFC3397 is not set
1008
-# CONFIG_FEATURE_UDHCP_8021Q is not set
1009
-CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
1010
-
1011
-#
1012
-# Print Utilities
1013
-#
1014
-# CONFIG_LPD is not set
1015
-# CONFIG_LPR is not set
1016
-# CONFIG_LPQ is not set
1017
-
1018
-#
1019
-# Mail Utilities
1020
-#
1021
-CONFIG_FEATURE_MIME_CHARSET="utf-8"
1022
-# CONFIG_MAKEMIME is not set
1023
-# CONFIG_POPMAILDIR is not set
1024
-# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
1025
-# CONFIG_REFORMIME is not set
1026
-# CONFIG_FEATURE_REFORMIME_COMPAT is not set
1027
-CONFIG_SENDMAIL=y
1028
-
1029
-#
1030
-# Process Utilities
1031
-#
1032
-# CONFIG_FEATURE_FAST_TOP is not set
1033
-CONFIG_FEATURE_SHOW_THREADS=y
1034
-CONFIG_FREE=y
1035
-CONFIG_FUSER=y
1036
-CONFIG_IOSTAT=y
1037
-CONFIG_KILL=y
1038
-CONFIG_KILLALL=y
1039
-# CONFIG_KILLALL5 is not set
1040
-CONFIG_LSOF=y
1041
-CONFIG_MPSTAT=y
1042
-CONFIG_NMETER=y
1043
-CONFIG_PGREP=y
1044
-CONFIG_PKILL=y
1045
-CONFIG_PIDOF=y
1046
-CONFIG_FEATURE_PIDOF_SINGLE=y
1047
-CONFIG_FEATURE_PIDOF_OMIT=y
1048
-CONFIG_PMAP=y
1049
-# CONFIG_POWERTOP is not set
1050
-# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
1051
-CONFIG_PS=y
1052
-# CONFIG_FEATURE_PS_WIDE is not set
1053
-# CONFIG_FEATURE_PS_LONG is not set
1054
-CONFIG_FEATURE_PS_TIME=y
1055
-# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
1056
-CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
1057
-CONFIG_PSTREE=y
1058
-CONFIG_PWDX=y
1059
-CONFIG_SMEMCAP=y
1060
-CONFIG_BB_SYSCTL=y
1061
-CONFIG_TOP=y
1062
-CONFIG_FEATURE_TOP_INTERACTIVE=y
1063
-CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
1064
-CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
1065
-CONFIG_FEATURE_TOP_SMP_CPU=y
1066
-CONFIG_FEATURE_TOP_DECIMALS=y
1067
-CONFIG_FEATURE_TOP_SMP_PROCESS=y
1068
-CONFIG_FEATURE_TOPMEM=y
1069
-CONFIG_UPTIME=y
1070
-CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y
1071
-CONFIG_WATCH=y
1072
-
1073
-#
1074
-# Runit Utilities
1075
-#
1076
-CONFIG_CHPST=y
1077
-CONFIG_SETUIDGID=y
1078
-CONFIG_ENVUIDGID=y
1079
-CONFIG_ENVDIR=y
1080
-CONFIG_SOFTLIMIT=y
1081
-CONFIG_RUNSV=y
1082
-CONFIG_RUNSVDIR=y
1083
-# CONFIG_FEATURE_RUNSVDIR_LOG is not set
1084
-CONFIG_SV=y
1085
-CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service"
1086
-CONFIG_SVC=y
1087
-CONFIG_SVOK=y
1088
-CONFIG_SVLOGD=y
1089
-# CONFIG_CHCON is not set
1090
-# CONFIG_GETENFORCE is not set
1091
-# CONFIG_GETSEBOOL is not set
1092
-# CONFIG_LOAD_POLICY is not set
1093
-# CONFIG_MATCHPATHCON is not set
1094
-# CONFIG_RUNCON is not set
1095
-# CONFIG_SELINUXENABLED is not set
1096
-# CONFIG_SESTATUS is not set
1097
-# CONFIG_SETENFORCE is not set
1098
-# CONFIG_SETFILES is not set
1099
-# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
1100
-# CONFIG_RESTORECON is not set
1101
-# CONFIG_SETSEBOOL is not set
1102
-
1103
-#
1104
-# Shells
1105
-#
1106
-CONFIG_SH_IS_ASH=y
1107
-# CONFIG_SH_IS_HUSH is not set
1108
-# CONFIG_SH_IS_NONE is not set
1109
-# CONFIG_BASH_IS_ASH is not set
1110
-# CONFIG_BASH_IS_HUSH is not set
1111
-CONFIG_BASH_IS_NONE=y
1112
-CONFIG_SHELL_ASH=y
1113
-CONFIG_ASH=y
1114
-CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
1115
-CONFIG_ASH_INTERNAL_GLOB=y
1116
-CONFIG_ASH_BASH_COMPAT=y
1117
-# CONFIG_ASH_BASH_SOURCE_CURDIR is not set
1118
-CONFIG_ASH_BASH_NOT_FOUND_HOOK=y
1119
-CONFIG_ASH_JOB_CONTROL=y
1120
-CONFIG_ASH_ALIAS=y
1121
-CONFIG_ASH_RANDOM_SUPPORT=y
1122
-CONFIG_ASH_EXPAND_PRMT=y
1123
-CONFIG_ASH_IDLE_TIMEOUT=y
1124
-CONFIG_ASH_MAIL=y
1125
-CONFIG_ASH_ECHO=y
1126
-CONFIG_ASH_PRINTF=y
1127
-CONFIG_ASH_TEST=y
1128
-CONFIG_ASH_HELP=y
1129
-CONFIG_ASH_GETOPTS=y
1130
-CONFIG_ASH_CMDCMD=y
1131
-# CONFIG_CTTYHACK is not set
1132
-# CONFIG_HUSH is not set
1133
-# CONFIG_SHELL_HUSH is not set
1134
-# CONFIG_HUSH_BASH_COMPAT is not set
1135
-# CONFIG_HUSH_BRACE_EXPANSION is not set
1136
-# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
1137
-# CONFIG_HUSH_LINENO_VAR is not set
1138
-# CONFIG_HUSH_INTERACTIVE is not set
1139
-# CONFIG_HUSH_SAVEHISTORY is not set
1140
-# CONFIG_HUSH_JOB is not set
1141
-# CONFIG_HUSH_TICK is not set
1142
-# CONFIG_HUSH_IF is not set
1143
-# CONFIG_HUSH_LOOPS is not set
1144
-# CONFIG_HUSH_CASE is not set
1145
-# CONFIG_HUSH_FUNCTIONS is not set
1146
-# CONFIG_HUSH_LOCAL is not set
1147
-# CONFIG_HUSH_RANDOM_SUPPORT is not set
1148
-# CONFIG_HUSH_MODE_X is not set
1149
-# CONFIG_HUSH_ECHO is not set
1150
-# CONFIG_HUSH_PRINTF is not set
1151
-# CONFIG_HUSH_TEST is not set
1152
-# CONFIG_HUSH_HELP is not set
1153
-# CONFIG_HUSH_EXPORT is not set
1154
-# CONFIG_HUSH_EXPORT_N is not set
1155
-# CONFIG_HUSH_READONLY is not set
1156
-# CONFIG_HUSH_KILL is not set
1157
-# CONFIG_HUSH_WAIT is not set
1158
-# CONFIG_HUSH_COMMAND is not set
1159
-# CONFIG_HUSH_TRAP is not set
1160
-# CONFIG_HUSH_TYPE is not set
1161
-# CONFIG_HUSH_TIMES is not set
1162
-# CONFIG_HUSH_READ is not set
1163
-# CONFIG_HUSH_SET is not set
1164
-# CONFIG_HUSH_UNSET is not set
1165
-# CONFIG_HUSH_ULIMIT is not set
1166
-# CONFIG_HUSH_UMASK is not set
1167
-# CONFIG_HUSH_GETOPTS is not set
1168
-# CONFIG_HUSH_MEMLEAK is not set
1169
-
1170
-#
1171
-# Options common to all shells
1172
-#
1173
-CONFIG_FEATURE_SH_MATH=y
1174
-CONFIG_FEATURE_SH_MATH_64=y
1175
-CONFIG_FEATURE_SH_MATH_BASE=y
1176
-CONFIG_FEATURE_SH_EXTRA_QUIET=y
1177
-# CONFIG_FEATURE_SH_STANDALONE is not set
1178
-# CONFIG_FEATURE_SH_NOFORK is not set
1179
-CONFIG_FEATURE_SH_READ_FRAC=y
1180
-CONFIG_FEATURE_SH_HISTFILESIZE=y
1181
-CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS=y
1182
-
1183
-#
1184
-# System Logging Utilities
1185
-#
1186
-# CONFIG_KLOGD is not set
1187
-# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
1188
-# CONFIG_LOGGER is not set
1189
-# CONFIG_LOGREAD is not set
1190
-# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
1191
-# CONFIG_SYSLOGD is not set
1192
-# CONFIG_FEATURE_ROTATE_LOGFILE is not set
1193
-# CONFIG_FEATURE_REMOTE_LOG is not set
1194
-# CONFIG_FEATURE_SYSLOGD_DUP is not set
1195
-# CONFIG_FEATURE_SYSLOGD_CFG is not set
1196
-# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
1197
-CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
1198
-# CONFIG_FEATURE_IPC_SYSLOG is not set
1199
-CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
1200
-# CONFIG_FEATURE_KMSG_SYSLOG is not set
--- a/containers/busybox-config
+++ b/containers/busybox-config
@@ -1,1200 +0,0 @@
1 #
2 # Automatically generated make config: don't edit
3 # Busybox version: 1.35.0
4 # Tue Aug 16 02:15:21 2022
5 #
6 CONFIG_HAVE_DOT_CONFIG=y
7
8 #
9 # Settings
10 #
11 CONFIG_DESKTOP=y
12 # CONFIG_EXTRA_COMPAT is not set
13 # CONFIG_FEDORA_COMPAT is not set
14 CONFIG_INCLUDE_SUSv2=y
15 CONFIG_LONG_OPTS=y
16 CONFIG_SHOW_USAGE=y
17 CONFIG_FEATURE_VERBOSE_USAGE=y
18 CONFIG_FEATURE_COMPRESS_USAGE=y
19 CONFIG_LFS=y
20 # CONFIG_PAM is not set
21 CONFIG_FEATURE_DEVPTS=y
22 CONFIG_FEATURE_UTMP=y
23 CONFIG_FEATURE_WTMP=y
24 CONFIG_FEATURE_PIDFILE=y
25 CONFIG_PID_FILE_PATH="/var/run"
26 CONFIG_BUSYBOX=y
27 CONFIG_FEATURE_SHOW_SCRIPT=y
28 CONFIG_FEATURE_INSTALLER=y
29 # CONFIG_INSTALL_NO_USR is not set
30 CONFIG_FEATURE_SUID=y
31 CONFIG_FEATURE_SUID_CONFIG=y
32 CONFIG_FEATURE_SUID_CONFIG_QUIET=y
33 # CONFIG_FEATURE_PREFER_APPLETS is not set
34 CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
35 # CONFIG_SELINUX is not set
36 # CONFIG_FEATURE_CLEAN_UP is not set
37 CONFIG_FEATURE_SYSLOG_INFO=y
38 CONFIG_FEATURE_SYSLOG=y
39
40 #
41 # Build Options
42 #
43 CONFIG_STATIC=y
44 # CONFIG_PIE is not set
45 # CONFIG_NOMMU is not set
46 # CONFIG_BUILD_LIBBUSYBOX is not set
47 # CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
48 # CONFIG_FEATURE_INDIVIDUAL is not set
49 # CONFIG_FEATURE_SHARED_BUSYBOX is not set
50 CONFIG_CROSS_COMPILER_PREFIX=""
51 CONFIG_SYSROOT=""
52 CONFIG_EXTRA_CFLAGS=""
53 CONFIG_EXTRA_LDFLAGS=""
54 CONFIG_EXTRA_LDLIBS=""
55 # CONFIG_USE_PORTABLE_CODE is not set
56 CONFIG_STACK_OPTIMIZATION_386=y
57 CONFIG_STATIC_LIBGCC=y
58
59 #
60 # Installation Options ("make install" behavior)
61 #
62 CONFIG_INSTALL_APPLET_SYMLINKS=y
63 # CONFIG_INSTALL_APPLET_HARDLINKS is not set
64 # CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
65 # CONFIG_INSTALL_APPLET_DONT is not set
66 # CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
67 # CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
68 # CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
69 CONFIG_PREFIX="./_install"
70
71 #
72 # Debugging Options
73 #
74 # CONFIG_DEBUG is not set
75 # CONFIG_DEBUG_PESSIMIZE is not set
76 # CONFIG_DEBUG_SANITIZE is not set
77 # CONFIG_UNIT_TEST is not set
78 # CONFIG_WERROR is not set
79 # CONFIG_WARN_SIMPLE_MSG is not set
80 CONFIG_NO_DEBUG_LIB=y
81 # CONFIG_DMALLOC is not set
82 # CONFIG_EFENCE is not set
83
84 #
85 # Library Tuning
86 #
87 # CONFIG_FEATURE_USE_BSS_TAIL is not set
88 CONFIG_FLOAT_DURATION=y
89 CONFIG_FEATURE_RTMINMAX=y
90 CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=y
91 CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
92 # CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
93 # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
94 CONFIG_PASSWORD_MINLEN=6
95 CONFIG_MD5_SMALL=1
96 CONFIG_SHA3_SMALL=1
97 CONFIG_FEATURE_NON_POSIX_CP=y
98 # CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
99 CONFIG_FEATURE_USE_SENDFILE=y
100 CONFIG_FEATURE_COPYBUF_KB=4
101 CONFIG_MONOTONIC_SYSCALL=y
102 CONFIG_IOCTL_HEX2STR_ERROR=y
103 CONFIG_FEATURE_EDITING=y
104 CONFIG_FEATURE_EDITING_MAX_LEN=1024
105 # CONFIG_FEATURE_EDITING_VI is not set
106 CONFIG_FEATURE_EDITING_HISTORY=255
107 CONFIG_FEATURE_EDITING_SAVEHISTORY=y
108 # CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
109 CONFIG_FEATURE_REVERSE_SEARCH=y
110 CONFIG_FEATURE_TAB_COMPLETION=y
111 CONFIG_FEATURE_USERNAME_COMPLETION=y
112 CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
113 CONFIG_FEATURE_EDITING_WINCH=y
114 # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
115 # CONFIG_LOCALE_SUPPORT is not set
116 CONFIG_UNICODE_SUPPORT=y
117 # CONFIG_UNICODE_USING_LOCALE is not set
118 # CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
119 CONFIG_SUBST_WCHAR=63
120 CONFIG_LAST_SUPPORTED_WCHAR=767
121 # CONFIG_UNICODE_COMBINING_WCHARS is not set
122 # CONFIG_UNICODE_WIDE_WCHARS is not set
123 # CONFIG_UNICODE_BIDI_SUPPORT is not set
124 # CONFIG_UNICODE_NEUTRAL_TABLE is not set
125 # CONFIG_UNICODE_PRESERVE_BROKEN is not set
126
127 #
128 # Applets
129 #
130
131 #
132 # Archival Utilities
133 #
134 # CONFIG_FEATURE_SEAMLESS_XZ is not set
135 # CONFIG_FEATURE_SEAMLESS_LZMA is not set
136 # CONFIG_FEATURE_SEAMLESS_BZ2 is not set
137 CONFIG_FEATURE_SEAMLESS_GZ=y
138 # CONFIG_FEATURE_SEAMLESS_Z is not set
139 # CONFIG_AR is not set
140 # CONFIG_FEATURE_AR_LONG_FILENAMES is not set
141 # CONFIG_FEATURE_AR_CREATE is not set
142 # CONFIG_UNCOMPRESS is not set
143 CONFIG_GUNZIP=y
144 CONFIG_ZCAT=y
145 CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
146 # CONFIG_BUNZIP2 is not set
147 # CONFIG_BZCAT is not set
148 # CONFIG_UNLZMA is not set
149 # CONFIG_LZCAT is not set
150 # CONFIG_LZMA is not set
151 # CONFIG_UNXZ is not set
152 # CONFIG_XZCAT is not set
153 # CONFIG_XZ is not set
154 # CONFIG_BZIP2 is not set
155 CONFIG_BZIP2_SMALL=0
156 # CONFIG_FEATURE_BZIP2_DECOMPRESS is not set
157 # CONFIG_CPIO is not set
158 # CONFIG_FEATURE_CPIO_O is not set
159 # CONFIG_FEATURE_CPIO_P is not set
160 # CONFIG_FEATURE_CPIO_IGNORE_DEVNO is not set
161 # CONFIG_FEATURE_CPIO_RENUMBER_INODES is not set
162 # CONFIG_DPKG is not set
163 # CONFIG_DPKG_DEB is not set
164 CONFIG_GZIP=y
165 CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
166 CONFIG_GZIP_FAST=0
167 # CONFIG_FEATURE_GZIP_LEVELS is not set
168 CONFIG_FEATURE_GZIP_DECOMPRESS=y
169 # CONFIG_LZOP is not set
170 # CONFIG_UNLZOP is not set
171 # CONFIG_LZOPCAT is not set
172 # CONFIG_LZOP_COMPR_HIGH is not set
173 # CONFIG_RPM is not set
174 # CONFIG_RPM2CPIO is not set
175 CONFIG_TAR=y
176 CONFIG_FEATURE_TAR_LONG_OPTIONS=y
177 CONFIG_FEATURE_TAR_CREATE=y
178 CONFIG_FEATURE_TAR_AUTODETECT=y
179 CONFIG_FEATURE_TAR_FROM=y
180 # CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
181 # CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
182 CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
183 # CONFIG_FEATURE_TAR_TO_COMMAND is not set
184 CONFIG_FEATURE_TAR_UNAME_GNAME=y
185 CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
186 # CONFIG_FEATURE_TAR_SELINUX is not set
187 CONFIG_UNZIP=y
188 CONFIG_FEATURE_UNZIP_CDF=y
189 CONFIG_FEATURE_UNZIP_BZIP2=y
190 CONFIG_FEATURE_UNZIP_LZMA=y
191 CONFIG_FEATURE_UNZIP_XZ=y
192 # CONFIG_FEATURE_LZMA_FAST is not set
193
194 #
195 # Coreutils
196 #
197 CONFIG_FEATURE_VERBOSE=y
198
199 #
200 # Common options for date and touch
201 #
202 CONFIG_FEATURE_TIMEZONE=y
203
204 #
205 # Common options for cp and mv
206 #
207 CONFIG_FEATURE_PRESERVE_HARDLINKS=y
208
209 #
210 # Common options for df, du, ls
211 #
212 CONFIG_FEATURE_HUMAN_READABLE=y
213 CONFIG_BASENAME=y
214 CONFIG_CAT=y
215 CONFIG_FEATURE_CATN=y
216 CONFIG_FEATURE_CATV=y
217 CONFIG_CHGRP=y
218 CONFIG_CHMOD=y
219 CONFIG_CHOWN=y
220 CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
221 CONFIG_CHROOT=y
222 # CONFIG_CKSUM is not set
223 # CONFIG_CRC32 is not set
224 CONFIG_COMM=y
225 CONFIG_CP=y
226 CONFIG_FEATURE_CP_LONG_OPTIONS=y
227 CONFIG_FEATURE_CP_REFLINK=y
228 CONFIG_CUT=y
229 CONFIG_FEATURE_CUT_REGEX=y
230 CONFIG_DATE=y
231 CONFIG_FEATURE_DATE_ISOFMT=y
232 # CONFIG_FEATURE_DATE_NANO is not set
233 CONFIG_FEATURE_DATE_COMPAT=y
234 CONFIG_DD=y
235 CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
236 CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
237 CONFIG_FEATURE_DD_IBS_OBS=y
238 CONFIG_FEATURE_DD_STATUS=y
239 CONFIG_DF=y
240 CONFIG_FEATURE_DF_FANCY=y
241 CONFIG_FEATURE_SKIP_ROOTFS=y
242 CONFIG_DIRNAME=y
243 CONFIG_DOS2UNIX=y
244 CONFIG_UNIX2DOS=y
245 CONFIG_DU=y
246 CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
247 # CONFIG_ECHO is not set
248 CONFIG_FEATURE_FANCY_ECHO=y
249 CONFIG_ENV=y
250 CONFIG_EXPAND=y
251 CONFIG_UNEXPAND=y
252 CONFIG_EXPR=y
253 CONFIG_EXPR_MATH_SUPPORT_64=y
254 # CONFIG_FACTOR is not set
255 CONFIG_FALSE=y
256 CONFIG_FOLD=y
257 CONFIG_HEAD=y
258 CONFIG_FEATURE_FANCY_HEAD=y
259 CONFIG_HOSTID=y
260 CONFIG_ID=y
261 CONFIG_GROUPS=y
262 CONFIG_INSTALL=y
263 CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
264 CONFIG_LINK=y
265 CONFIG_LN=y
266 # CONFIG_LOGNAME is not set
267 CONFIG_LS=y
268 CONFIG_FEATURE_LS_FILETYPES=y
269 CONFIG_FEATURE_LS_FOLLOWLINKS=y
270 CONFIG_FEATURE_LS_RECURSIVE=y
271 CONFIG_FEATURE_LS_WIDTH=y
272 CONFIG_FEATURE_LS_SORTFILES=y
273 CONFIG_FEATURE_LS_TIMESTAMPS=y
274 CONFIG_FEATURE_LS_USERNAME=y
275 CONFIG_FEATURE_LS_COLOR=y
276 CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
277 # CONFIG_MD5SUM is not set
278 # CONFIG_SHA1SUM is not set
279 # CONFIG_SHA256SUM is not set
280 # CONFIG_SHA512SUM is not set
281 # CONFIG_SHA3SUM is not set
282 # CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
283 CONFIG_MKDIR=y
284 CONFIG_MKFIFO=y
285 CONFIG_MKNOD=y
286 CONFIG_MKTEMP=y
287 CONFIG_MV=y
288 CONFIG_NICE=y
289 CONFIG_NL=y
290 CONFIG_NOHUP=y
291 CONFIG_NPROC=y
292 CONFIG_OD=y
293 CONFIG_PASTE=y
294 # CONFIG_PRINTENV is not set
295 # CONFIG_PRINTF is not set
296 CONFIG_PWD=y
297 CONFIG_READLINK=y
298 CONFIG_FEATURE_READLINK_FOLLOW=y
299 CONFIG_REALPATH=y
300 CONFIG_RM=y
301 CONFIG_RMDIR=y
302 CONFIG_SEQ=y
303 CONFIG_SHRED=y
304 CONFIG_SHUF=y
305 CONFIG_SLEEP=y
306 CONFIG_FEATURE_FANCY_SLEEP=y
307 CONFIG_SORT=y
308 # CONFIG_FEATURE_SORT_BIG is not set
309 # CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
310 CONFIG_SPLIT=y
311 CONFIG_FEATURE_SPLIT_FANCY=y
312 CONFIG_STAT=y
313 CONFIG_FEATURE_STAT_FORMAT=y
314 CONFIG_FEATURE_STAT_FILESYSTEM=y
315 CONFIG_STTY=y
316 # CONFIG_SUM is not set
317 CONFIG_SYNC=y
318 CONFIG_FEATURE_SYNC_FANCY=y
319 CONFIG_FSYNC=y
320 CONFIG_TAC=y
321 CONFIG_TAIL=y
322 CONFIG_FEATURE_FANCY_TAIL=y
323 CONFIG_TEE=y
324 CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
325 # CONFIG_TEST is not set
326 # CONFIG_TEST1 is not set
327 # CONFIG_TEST2 is not set
328 # CONFIG_FEATURE_TEST_64 is not set
329 CONFIG_TIMEOUT=y
330 CONFIG_TOUCH=y
331 CONFIG_FEATURE_TOUCH_SUSV3=y
332 CONFIG_TR=y
333 CONFIG_FEATURE_TR_CLASSES=y
334 CONFIG_FEATURE_TR_EQUIV=y
335 CONFIG_TRUE=y
336 CONFIG_TRUNCATE=y
337 CONFIG_TTY=y
338 CONFIG_UNAME=y
339 CONFIG_UNAME_OSNAME="GNU/Linux"
340 CONFIG_BB_ARCH=y
341 CONFIG_UNIQ=y
342 CONFIG_UNLINK=y
343 CONFIG_USLEEP=y
344 CONFIG_UUDECODE=y
345 CONFIG_BASE32=y
346 CONFIG_BASE64=y
347 CONFIG_UUENCODE=y
348 CONFIG_WC=y
349 CONFIG_FEATURE_WC_LARGE=y
350 CONFIG_WHO=y
351 CONFIG_W=y
352 CONFIG_USERS=y
353 CONFIG_WHOAMI=y
354 CONFIG_YES=y
355
356 #
357 # Console Utilities
358 #
359 # CONFIG_CHVT is not set
360 CONFIG_CLEAR=y
361 # CONFIG_DEALLOCVT is not set
362 # CONFIG_DUMPKMAP is not set
363 # CONFIG_FGCONSOLE is not set
364 # CONFIG_KBD_MODE is not set
365 # CONFIG_LOADFONT is not set
366 # CONFIG_SETFONT is not set
367 # CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
368 CONFIG_DEFAULT_SETFONT_DIR=""
369 # CONFIG_FEATURE_LOADFONT_PSF2 is not set
370 # CONFIG_FEATURE_LOADFONT_RAW is not set
371 # CONFIG_LOADKMAP is not set
372 # CONFIG_OPENVT is not set
373 # CONFIG_RESET is not set
374 # CONFIG_RESIZE is not set
375 # CONFIG_FEATURE_RESIZE_PRINT is not set
376 # CONFIG_SETCONSOLE is not set
377 # CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
378 # CONFIG_SETKEYCODES is not set
379 # CONFIG_SETLOGCONS is not set
380 # CONFIG_SHOWKEY is not set
381
382 #
383 # Debian Utilities
384 #
385 # CONFIG_PIPE_PROGRESS is not set
386 # CONFIG_RUN_PARTS is not set
387 # CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
388 # CONFIG_FEATURE_RUN_PARTS_FANCY is not set
389 # CONFIG_START_STOP_DAEMON is not set
390 # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
391 # CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
392 CONFIG_WHICH=y
393
394 #
395 # klibc-utils
396 #
397 # CONFIG_MINIPS is not set
398 # CONFIG_NUKE is not set
399 # CONFIG_RESUME is not set
400 # CONFIG_RUN_INIT is not set
401
402 #
403 # Editors
404 #
405 # CONFIG_AWK is not set
406 # CONFIG_FEATURE_AWK_LIBM is not set
407 # CONFIG_FEATURE_AWK_GNU_EXTENSIONS is not set
408 # CONFIG_CMP is not set
409 CONFIG_DIFF=y
410 CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
411 CONFIG_FEATURE_DIFF_DIR=y
412 # CONFIG_ED is not set
413 CONFIG_PATCH=y
414 CONFIG_SED=y
415 CONFIG_VI=y
416 CONFIG_FEATURE_VI_MAX_LEN=4096
417 # CONFIG_FEATURE_VI_8BIT is not set
418 CONFIG_FEATURE_VI_COLON=y
419 CONFIG_FEATURE_VI_COLON_EXPAND=y
420 CONFIG_FEATURE_VI_YANKMARK=y
421 CONFIG_FEATURE_VI_SEARCH=y
422 # CONFIG_FEATURE_VI_REGEX_SEARCH is not set
423 CONFIG_FEATURE_VI_USE_SIGNALS=y
424 CONFIG_FEATURE_VI_DOT_CMD=y
425 CONFIG_FEATURE_VI_READONLY=y
426 CONFIG_FEATURE_VI_SETOPTS=y
427 CONFIG_FEATURE_VI_SET=y
428 CONFIG_FEATURE_VI_WIN_RESIZE=y
429 CONFIG_FEATURE_VI_ASK_TERMINAL=y
430 CONFIG_FEATURE_VI_UNDO=y
431 CONFIG_FEATURE_VI_UNDO_QUEUE=y
432 CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
433 CONFIG_FEATURE_VI_VERBOSE_STATUS=y
434 CONFIG_FEATURE_ALLOW_EXEC=y
435
436 #
437 # Finding Utilities
438 #
439 CONFIG_FIND=y
440 CONFIG_FEATURE_FIND_PRINT0=y
441 CONFIG_FEATURE_FIND_MTIME=y
442 CONFIG_FEATURE_FIND_ATIME=y
443 CONFIG_FEATURE_FIND_CTIME=y
444 CONFIG_FEATURE_FIND_MMIN=y
445 CONFIG_FEATURE_FIND_AMIN=y
446 CONFIG_FEATURE_FIND_CMIN=y
447 CONFIG_FEATURE_FIND_PERM=y
448 CONFIG_FEATURE_FIND_TYPE=y
449 CONFIG_FEATURE_FIND_EXECUTABLE=y
450 CONFIG_FEATURE_FIND_XDEV=y
451 CONFIG_FEATURE_FIND_MAXDEPTH=y
452 CONFIG_FEATURE_FIND_NEWER=y
453 CONFIG_FEATURE_FIND_INUM=y
454 CONFIG_FEATURE_FIND_SAMEFILE=y
455 CONFIG_FEATURE_FIND_EXEC=y
456 CONFIG_FEATURE_FIND_EXEC_PLUS=y
457 CONFIG_FEATURE_FIND_USER=y
458 CONFIG_FEATURE_FIND_GROUP=y
459 CONFIG_FEATURE_FIND_NOT=y
460 CONFIG_FEATURE_FIND_DEPTH=y
461 CONFIG_FEATURE_FIND_PAREN=y
462 CONFIG_FEATURE_FIND_SIZE=y
463 CONFIG_FEATURE_FIND_PRUNE=y
464 CONFIG_FEATURE_FIND_QUIT=y
465 CONFIG_FEATURE_FIND_DELETE=y
466 CONFIG_FEATURE_FIND_EMPTY=y
467 CONFIG_FEATURE_FIND_PATH=y
468 CONFIG_FEATURE_FIND_REGEX=y
469 # CONFIG_FEATURE_FIND_CONTEXT is not set
470 CONFIG_FEATURE_FIND_LINKS=y
471 CONFIG_GREP=y
472 # CONFIG_EGREP is not set
473 # CONFIG_FGREP is not set
474 CONFIG_FEATURE_GREP_CONTEXT=y
475 CONFIG_XARGS=y
476 CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
477 CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
478 CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
479 CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
480 CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
481 CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y
482 CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y
483
484 #
485 # Init Utilities
486 #
487 # CONFIG_BOOTCHARTD is not set
488 # CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
489 # CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
490 # CONFIG_HALT is not set
491 # CONFIG_POWEROFF is not set
492 # CONFIG_REBOOT is not set
493 # CONFIG_FEATURE_WAIT_FOR_INIT is not set
494 # CONFIG_FEATURE_CALL_TELINIT is not set
495 CONFIG_TELINIT_PATH=""
496 # CONFIG_INIT is not set
497 # CONFIG_LINUXRC is not set
498 # CONFIG_FEATURE_USE_INITTAB is not set
499 # CONFIG_FEATURE_KILL_REMOVED is not set
500 CONFIG_FEATURE_KILL_DELAY=0
501 # CONFIG_FEATURE_INIT_SCTTY is not set
502 # CONFIG_FEATURE_INIT_SYSLOG is not set
503 # CONFIG_FEATURE_INIT_QUIET is not set
504 # CONFIG_FEATURE_INIT_COREDUMPS is not set
505 CONFIG_INIT_TERMINAL_TYPE=""
506 # CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
507
508 #
509 # Login/Password Management Utilities
510 #
511 # CONFIG_FEATURE_SHADOWPASSWDS is not set
512 CONFIG_USE_BB_PWD_GRP=y
513 # CONFIG_USE_BB_SHADOW is not set
514 CONFIG_USE_BB_CRYPT=y
515 CONFIG_USE_BB_CRYPT_SHA=y
516 # CONFIG_ADD_SHELL is not set
517 # CONFIG_REMOVE_SHELL is not set
518 CONFIG_ADDGROUP=y
519 # CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
520 CONFIG_ADDUSER=y
521 # CONFIG_FEATURE_CHECK_NAMES is not set
522 CONFIG_LAST_ID=60000
523 CONFIG_FIRST_SYSTEM_ID=100
524 CONFIG_LAST_SYSTEM_ID=999
525 # CONFIG_CHPASSWD is not set
526 CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
527 # CONFIG_CRYPTPW is not set
528 # CONFIG_MKPASSWD is not set
529 # CONFIG_DELUSER is not set
530 # CONFIG_DELGROUP is not set
531 # CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
532 # CONFIG_GETTY is not set
533 # CONFIG_LOGIN is not set
534 # CONFIG_LOGIN_SESSION_AS_CHILD is not set
535 # CONFIG_LOGIN_SCRIPTS is not set
536 # CONFIG_FEATURE_NOLOGIN is not set
537 # CONFIG_FEATURE_SECURETTY is not set
538 # CONFIG_PASSWD is not set
539 # CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
540 # CONFIG_SU is not set
541 # CONFIG_FEATURE_SU_SYSLOG is not set
542 # CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
543 # CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
544 # CONFIG_SULOGIN is not set
545 # CONFIG_VLOCK is not set
546
547 #
548 # Linux Ext2 FS Progs
549 #
550 # CONFIG_CHATTR is not set
551 # CONFIG_FSCK is not set
552 # CONFIG_LSATTR is not set
553 # CONFIG_TUNE2FS is not set
554
555 #
556 # Linux Module Utilities
557 #
558 # CONFIG_MODPROBE_SMALL is not set
559 # CONFIG_DEPMOD is not set
560 # CONFIG_INSMOD is not set
561 # CONFIG_LSMOD is not set
562 # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
563 # CONFIG_MODINFO is not set
564 # CONFIG_MODPROBE is not set
565 # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
566 # CONFIG_RMMOD is not set
567
568 #
569 # Options common to multiple modutils
570 #
571 # CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
572 # CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
573 # CONFIG_FEATURE_2_4_MODULES is not set
574 # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
575 # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
576 # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
577 # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
578 # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
579 # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
580 # CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
581 # CONFIG_FEATURE_MODUTILS_ALIAS is not set
582 # CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
583 CONFIG_DEFAULT_MODULES_DIR=""
584 CONFIG_DEFAULT_DEPMOD_FILE=""
585
586 #
587 # Linux System Utilities
588 #
589 # CONFIG_ACPID is not set
590 # CONFIG_FEATURE_ACPID_COMPAT is not set
591 # CONFIG_BLKDISCARD is not set
592 # CONFIG_BLKID is not set
593 # CONFIG_FEATURE_BLKID_TYPE is not set
594 # CONFIG_BLOCKDEV is not set
595 # CONFIG_CAL is not set
596 # CONFIG_CHRT is not set
597 # CONFIG_DMESG is not set
598 # CONFIG_FEATURE_DMESG_PRETTY is not set
599 # CONFIG_EJECT is not set
600 # CONFIG_FEATURE_EJECT_SCSI is not set
601 # CONFIG_FALLOCATE is not set
602 # CONFIG_FATATTR is not set
603 # CONFIG_FBSET is not set
604 # CONFIG_FEATURE_FBSET_FANCY is not set
605 # CONFIG_FEATURE_FBSET_READMODE is not set
606 # CONFIG_FDFORMAT is not set
607 # CONFIG_FDISK is not set
608 # CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
609 # CONFIG_FEATURE_FDISK_WRITABLE is not set
610 # CONFIG_FEATURE_AIX_LABEL is not set
611 # CONFIG_FEATURE_SGI_LABEL is not set
612 # CONFIG_FEATURE_SUN_LABEL is not set
613 # CONFIG_FEATURE_OSF_LABEL is not set
614 # CONFIG_FEATURE_GPT_LABEL is not set
615 # CONFIG_FEATURE_FDISK_ADVANCED is not set
616 # CONFIG_FINDFS is not set
617 # CONFIG_FLOCK is not set
618 # CONFIG_FDFLUSH is not set
619 # CONFIG_FREERAMDISK is not set
620 # CONFIG_FSCK_MINIX is not set
621 # CONFIG_FSFREEZE is not set
622 # CONFIG_FSTRIM is not set
623 # CONFIG_GETOPT is not set
624 # CONFIG_FEATURE_GETOPT_LONG is not set
625 CONFIG_HEXDUMP=y
626 CONFIG_HD=y
627 CONFIG_XXD=y
628 # CONFIG_HWCLOCK is not set
629 # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
630 # CONFIG_IONICE is not set
631 # CONFIG_IPCRM is not set
632 # CONFIG_IPCS is not set
633 # CONFIG_LAST is not set
634 # CONFIG_FEATURE_LAST_FANCY is not set
635 # CONFIG_LOSETUP is not set
636 # CONFIG_LSPCI is not set
637 # CONFIG_LSUSB is not set
638 # CONFIG_MDEV is not set
639 # CONFIG_FEATURE_MDEV_CONF is not set
640 # CONFIG_FEATURE_MDEV_RENAME is not set
641 # CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
642 # CONFIG_FEATURE_MDEV_EXEC is not set
643 # CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
644 # CONFIG_FEATURE_MDEV_DAEMON is not set
645 # CONFIG_MESG is not set
646 # CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
647 # CONFIG_MKE2FS is not set
648 # CONFIG_MKFS_EXT2 is not set
649 # CONFIG_MKFS_MINIX is not set
650 # CONFIG_FEATURE_MINIX2 is not set
651 # CONFIG_MKFS_REISER is not set
652 # CONFIG_MKDOSFS is not set
653 # CONFIG_MKFS_VFAT is not set
654 # CONFIG_MKSWAP is not set
655 # CONFIG_FEATURE_MKSWAP_UUID is not set
656 CONFIG_MORE=y
657 CONFIG_MOUNT=y
658 CONFIG_FEATURE_MOUNT_FAKE=y
659 CONFIG_FEATURE_MOUNT_VERBOSE=y
660 # CONFIG_FEATURE_MOUNT_HELPERS is not set
661 # CONFIG_FEATURE_MOUNT_LABEL is not set
662 # CONFIG_FEATURE_MOUNT_NFS is not set
663 # CONFIG_FEATURE_MOUNT_CIFS is not set
664 CONFIG_FEATURE_MOUNT_FLAGS=y
665 CONFIG_FEATURE_MOUNT_FSTAB=y
666 CONFIG_FEATURE_MOUNT_OTHERTAB=y
667 # CONFIG_MOUNTPOINT is not set
668 CONFIG_NOLOGIN=y
669 # CONFIG_NOLOGIN_DEPENDENCIES is not set
670 # CONFIG_NSENTER is not set
671 # CONFIG_PIVOT_ROOT is not set
672 # CONFIG_RDATE is not set
673 # CONFIG_RDEV is not set
674 # CONFIG_READPROFILE is not set
675 CONFIG_RENICE=y
676 CONFIG_REV=y
677 # CONFIG_RTCWAKE is not set
678 # CONFIG_SCRIPT is not set
679 # CONFIG_SCRIPTREPLAY is not set
680 # CONFIG_SETARCH is not set
681 # CONFIG_LINUX32 is not set
682 # CONFIG_LINUX64 is not set
683 # CONFIG_SETPRIV is not set
684 # CONFIG_FEATURE_SETPRIV_DUMP is not set
685 # CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
686 # CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
687 # CONFIG_SETSID is not set
688 # CONFIG_SWAPON is not set
689 # CONFIG_FEATURE_SWAPON_DISCARD is not set
690 # CONFIG_FEATURE_SWAPON_PRI is not set
691 # CONFIG_SWAPOFF is not set
692 # CONFIG_FEATURE_SWAPONOFF_LABEL is not set
693 # CONFIG_SWITCH_ROOT is not set
694 # CONFIG_TASKSET is not set
695 # CONFIG_FEATURE_TASKSET_FANCY is not set
696 # CONFIG_FEATURE_TASKSET_CPULIST is not set
697 # CONFIG_UEVENT is not set
698 CONFIG_UMOUNT=y
699 CONFIG_FEATURE_UMOUNT_ALL=y
700 # CONFIG_UNSHARE is not set
701 # CONFIG_WALL is not set
702
703 #
704 # Common options for mount/umount
705 #
706 # CONFIG_FEATURE_MOUNT_LOOP is not set
707 # CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
708 # CONFIG_FEATURE_MTAB_SUPPORT is not set
709 # CONFIG_VOLUMEID is not set
710 # CONFIG_FEATURE_VOLUMEID_BCACHE is not set
711 # CONFIG_FEATURE_VOLUMEID_BTRFS is not set
712 # CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
713 # CONFIG_FEATURE_VOLUMEID_EROFS is not set
714 # CONFIG_FEATURE_VOLUMEID_EXFAT is not set
715 # CONFIG_FEATURE_VOLUMEID_EXT is not set
716 # CONFIG_FEATURE_VOLUMEID_F2FS is not set
717 # CONFIG_FEATURE_VOLUMEID_FAT is not set
718 # CONFIG_FEATURE_VOLUMEID_HFS is not set
719 # CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
720 # CONFIG_FEATURE_VOLUMEID_JFS is not set
721 # CONFIG_FEATURE_VOLUMEID_LFS is not set
722 # CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
723 # CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
724 # CONFIG_FEATURE_VOLUMEID_LUKS is not set
725 # CONFIG_FEATURE_VOLUMEID_MINIX is not set
726 # CONFIG_FEATURE_VOLUMEID_NILFS is not set
727 # CONFIG_FEATURE_VOLUMEID_NTFS is not set
728 # CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
729 # CONFIG_FEATURE_VOLUMEID_REISERFS is not set
730 # CONFIG_FEATURE_VOLUMEID_ROMFS is not set
731 # CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
732 # CONFIG_FEATURE_VOLUMEID_SYSV is not set
733 # CONFIG_FEATURE_VOLUMEID_UBIFS is not set
734 # CONFIG_FEATURE_VOLUMEID_UDF is not set
735 # CONFIG_FEATURE_VOLUMEID_XFS is not set
736
737 #
738 # Miscellaneous Utilities
739 #
740 # CONFIG_ADJTIMEX is not set
741 # CONFIG_ASCII is not set
742 # CONFIG_BBCONFIG is not set
743 # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
744 CONFIG_BC=y
745 # CONFIG_DC is not set
746 CONFIG_FEATURE_DC_BIG=y
747 # CONFIG_FEATURE_DC_LIBM is not set
748 # CONFIG_FEATURE_BC_INTERACTIVE is not set
749 # CONFIG_FEATURE_BC_LONG_OPTIONS is not set
750 # CONFIG_BEEP is not set
751 CONFIG_FEATURE_BEEP_FREQ=0
752 CONFIG_FEATURE_BEEP_LENGTH_MS=0
753 # CONFIG_CHAT is not set
754 # CONFIG_FEATURE_CHAT_NOFAIL is not set
755 # CONFIG_FEATURE_CHAT_TTY_HIFI is not set
756 # CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
757 # CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
758 # CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
759 # CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
760 # CONFIG_FEATURE_CHAT_CLR_ABORT is not set
761 # CONFIG_CONSPY is not set
762 CONFIG_CROND=y
763 CONFIG_FEATURE_CROND_D=y
764 CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
765 CONFIG_FEATURE_CROND_SPECIAL_TIMES=y
766 CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
767 CONFIG_CRONTAB=y
768 # CONFIG_DEVFSD is not set
769 # CONFIG_DEVFSD_MODLOAD is not set
770 # CONFIG_DEVFSD_FG_NP is not set
771 # CONFIG_DEVFSD_VERBOSE is not set
772 # CONFIG_FEATURE_DEVFS is not set
773 # CONFIG_DEVMEM is not set
774 # CONFIG_FBSPLASH is not set
775 # CONFIG_FLASH_ERASEALL is not set
776 # CONFIG_FLASH_LOCK is not set
777 # CONFIG_FLASH_UNLOCK is not set
778 # CONFIG_FLASHCP is not set
779 # CONFIG_HDPARM is not set
780 # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
781 # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
782 # CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
783 # CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
784 # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
785 # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
786 CONFIG_HEXEDIT=y
787 # CONFIG_I2CGET is not set
788 # CONFIG_I2CSET is not set
789 # CONFIG_I2CDUMP is not set
790 # CONFIG_I2CDETECT is not set
791 # CONFIG_I2CTRANSFER is not set
792 # CONFIG_INOTIFYD is not set
793 CONFIG_LESS=y
794 CONFIG_FEATURE_LESS_MAXLINES=9999999
795 CONFIG_FEATURE_LESS_BRACKETS=y
796 CONFIG_FEATURE_LESS_FLAGS=y
797 CONFIG_FEATURE_LESS_TRUNCATE=y
798 CONFIG_FEATURE_LESS_MARKS=y
799 CONFIG_FEATURE_LESS_REGEXP=y
800 CONFIG_FEATURE_LESS_WINCH=y
801 CONFIG_FEATURE_LESS_ASK_TERMINAL=y
802 CONFIG_FEATURE_LESS_DASHCMD=y
803 CONFIG_FEATURE_LESS_LINENUMS=y
804 CONFIG_FEATURE_LESS_RAW=y
805 CONFIG_FEATURE_LESS_ENV=y
806 # CONFIG_LSSCSI is not set
807 # CONFIG_MAKEDEVS is not set
808 # CONFIG_FEATURE_MAKEDEVS_LEAF is not set
809 # CONFIG_FEATURE_MAKEDEVS_TABLE is not set
810 # CONFIG_MAN is not set
811 # CONFIG_MICROCOM is not set
812 # CONFIG_MIM is not set
813 # CONFIG_MT is not set
814 # CONFIG_NANDWRITE is not set
815 # CONFIG_NANDDUMP is not set
816 # CONFIG_PARTPROBE is not set
817 # CONFIG_RAIDAUTORUN is not set
818 # CONFIG_READAHEAD is not set
819 # CONFIG_RFKILL is not set
820 # CONFIG_RUNLEVEL is not set
821 # CONFIG_RX is not set
822 # CONFIG_SETFATTR is not set
823 # CONFIG_SETSERIAL is not set
824 CONFIG_STRINGS=y
825 CONFIG_TIME=y
826 # CONFIG_TS is not set
827 # CONFIG_TTYSIZE is not set
828 # CONFIG_UBIATTACH is not set
829 # CONFIG_UBIDETACH is not set
830 # CONFIG_UBIMKVOL is not set
831 # CONFIG_UBIRMVOL is not set
832 # CONFIG_UBIRSVOL is not set
833 # CONFIG_UBIUPDATEVOL is not set
834 # CONFIG_UBIRENAME is not set
835 # CONFIG_VOLNAME is not set
836 # CONFIG_WATCHDOG is not set
837 # CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set
838
839 #
840 # Networking Utilities
841 #
842 CONFIG_FEATURE_IPV6=y
843 # CONFIG_FEATURE_UNIX_LOCAL is not set
844 CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
845 # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
846 # CONFIG_FEATURE_ETC_NETWORKS is not set
847 # CONFIG_FEATURE_ETC_SERVICES is not set
848 # CONFIG_FEATURE_HWIB is not set
849 # CONFIG_FEATURE_TLS_SHA1 is not set
850 # CONFIG_ARP is not set
851 # CONFIG_ARPING is not set
852 # CONFIG_BRCTL is not set
853 # CONFIG_FEATURE_BRCTL_FANCY is not set
854 # CONFIG_FEATURE_BRCTL_SHOW is not set
855 # CONFIG_DNSD is not set
856 # CONFIG_ETHER_WAKE is not set
857 # CONFIG_FTPD is not set
858 # CONFIG_FEATURE_FTPD_WRITE is not set
859 # CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
860 # CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
861 # CONFIG_FTPGET is not set
862 # CONFIG_FTPPUT is not set
863 # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
864 # CONFIG_HOSTNAME is not set
865 # CONFIG_DNSDOMAINNAME is not set
866 # CONFIG_HTTPD is not set
867 CONFIG_FEATURE_HTTPD_PORT_DEFAULT=0
868 # CONFIG_FEATURE_HTTPD_RANGES is not set
869 # CONFIG_FEATURE_HTTPD_SETUID is not set
870 # CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
871 # CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
872 # CONFIG_FEATURE_HTTPD_CGI is not set
873 # CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
874 # CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
875 # CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
876 # CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
877 # CONFIG_FEATURE_HTTPD_PROXY is not set
878 # CONFIG_FEATURE_HTTPD_GZIP is not set
879 # CONFIG_FEATURE_HTTPD_ETAG is not set
880 # CONFIG_FEATURE_HTTPD_LAST_MODIFIED is not set
881 # CONFIG_FEATURE_HTTPD_DATE is not set
882 # CONFIG_FEATURE_HTTPD_ACL_IP is not set
883 CONFIG_IFCONFIG=y
884 CONFIG_FEATURE_IFCONFIG_STATUS=y
885 # CONFIG_FEATURE_IFCONFIG_SLIP is not set
886 CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
887 CONFIG_FEATURE_IFCONFIG_HW=y
888 CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
889 # CONFIG_IFENSLAVE is not set
890 # CONFIG_IFPLUGD is not set
891 # CONFIG_IFUP is not set
892 # CONFIG_IFDOWN is not set
893 CONFIG_IFUPDOWN_IFSTATE_PATH=""
894 # CONFIG_FEATURE_IFUPDOWN_IP is not set
895 # CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
896 # CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
897 # CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
898 # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
899 CONFIG_INETD=y
900 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
901 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
902 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
903 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
904 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
905 # CONFIG_FEATURE_INETD_RPC is not set
906 CONFIG_IP=y
907 # CONFIG_IPADDR is not set
908 # CONFIG_IPLINK is not set
909 # CONFIG_IPROUTE is not set
910 # CONFIG_IPTUNNEL is not set
911 # CONFIG_IPRULE is not set
912 # CONFIG_IPNEIGH is not set
913 CONFIG_FEATURE_IP_ADDRESS=y
914 CONFIG_FEATURE_IP_LINK=y
915 CONFIG_FEATURE_IP_ROUTE=y
916 CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
917 # CONFIG_FEATURE_IP_TUNNEL is not set
918 # CONFIG_FEATURE_IP_RULE is not set
919 CONFIG_FEATURE_IP_NEIGH=y
920 # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
921 CONFIG_IPCALC=y
922 CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
923 CONFIG_FEATURE_IPCALC_FANCY=y
924 # CONFIG_FAKEIDENTD is not set
925 # CONFIG_NAMEIF is not set
926 # CONFIG_FEATURE_NAMEIF_EXTENDED is not set
927 # CONFIG_NBDCLIENT is not set
928 CONFIG_NC=y
929 # CONFIG_NETCAT is not set
930 CONFIG_NC_SERVER=y
931 CONFIG_NC_EXTRA=y
932 CONFIG_NC_110_COMPAT=y
933 # CONFIG_NETSTAT is not set
934 # CONFIG_FEATURE_NETSTAT_WIDE is not set
935 # CONFIG_FEATURE_NETSTAT_PRG is not set
936 # CONFIG_NSLOOKUP is not set
937 # CONFIG_FEATURE_NSLOOKUP_BIG is not set
938 # CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
939 # CONFIG_NTPD is not set
940 # CONFIG_FEATURE_NTPD_SERVER is not set
941 # CONFIG_FEATURE_NTPD_CONF is not set
942 # CONFIG_FEATURE_NTP_AUTH is not set
943 # CONFIG_PING is not set
944 # CONFIG_PING6 is not set
945 # CONFIG_FEATURE_FANCY_PING is not set
946 # CONFIG_PSCAN is not set
947 CONFIG_ROUTE=y
948 # CONFIG_SLATTACH is not set
949 CONFIG_SSL_CLIENT=y
950 # CONFIG_TC is not set
951 # CONFIG_FEATURE_TC_INGRESS is not set
952 # CONFIG_TCPSVD is not set
953 # CONFIG_UDPSVD is not set
954 # CONFIG_TELNET is not set
955 # CONFIG_FEATURE_TELNET_TTYPE is not set
956 # CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
957 # CONFIG_FEATURE_TELNET_WIDTH is not set
958 # CONFIG_TELNETD is not set
959 # CONFIG_FEATURE_TELNETD_STANDALONE is not set
960 CONFIG_FEATURE_TELNETD_PORT_DEFAULT=0
961 # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
962 # CONFIG_TFTP is not set
963 # CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
964 # CONFIG_FEATURE_TFTP_HPA_COMPAT is not set
965 # CONFIG_TFTPD is not set
966 # CONFIG_FEATURE_TFTP_GET is not set
967 # CONFIG_FEATURE_TFTP_PUT is not set
968 # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
969 # CONFIG_TFTP_DEBUG is not set
970 CONFIG_TLS=y
971 # CONFIG_TRACEROUTE is not set
972 # CONFIG_TRACEROUTE6 is not set
973 # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
974 # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
975 # CONFIG_TUNCTL is not set
976 # CONFIG_FEATURE_TUNCTL_UG is not set
977 # CONFIG_VCONFIG is not set
978 CONFIG_WGET=y
979 CONFIG_FEATURE_WGET_LONG_OPTIONS=y
980 CONFIG_FEATURE_WGET_STATUSBAR=y
981 CONFIG_FEATURE_WGET_FTP=y
982 CONFIG_FEATURE_WGET_AUTHENTICATION=y
983 CONFIG_FEATURE_WGET_TIMEOUT=y
984 CONFIG_FEATURE_WGET_HTTPS=y
985 CONFIG_FEATURE_WGET_OPENSSL=y
986 CONFIG_WHOIS=y
987 # CONFIG_ZCIP is not set
988 # CONFIG_UDHCPD is not set
989 # CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
990 # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
991 CONFIG_DHCPD_LEASES_FILE=""
992 # CONFIG_DUMPLEASES is not set
993 # CONFIG_DHCPRELAY is not set
994 # CONFIG_UDHCPC is not set
995 # CONFIG_FEATURE_UDHCPC_ARPING is not set
996 # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
997 CONFIG_UDHCPC_DEFAULT_SCRIPT=""
998 # CONFIG_UDHCPC6 is not set
999 # CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
1000 # CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
1001 # CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
1002 # CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
1003 CONFIG_UDHCPC_DEFAULT_INTERFACE=""
1004 # CONFIG_FEATURE_UDHCP_PORT is not set
1005 CONFIG_UDHCP_DEBUG=0
1006 CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
1007 # CONFIG_FEATURE_UDHCP_RFC3397 is not set
1008 # CONFIG_FEATURE_UDHCP_8021Q is not set
1009 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
1010
1011 #
1012 # Print Utilities
1013 #
1014 # CONFIG_LPD is not set
1015 # CONFIG_LPR is not set
1016 # CONFIG_LPQ is not set
1017
1018 #
1019 # Mail Utilities
1020 #
1021 CONFIG_FEATURE_MIME_CHARSET="utf-8"
1022 # CONFIG_MAKEMIME is not set
1023 # CONFIG_POPMAILDIR is not set
1024 # CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
1025 # CONFIG_REFORMIME is not set
1026 # CONFIG_FEATURE_REFORMIME_COMPAT is not set
1027 CONFIG_SENDMAIL=y
1028
1029 #
1030 # Process Utilities
1031 #
1032 # CONFIG_FEATURE_FAST_TOP is not set
1033 CONFIG_FEATURE_SHOW_THREADS=y
1034 CONFIG_FREE=y
1035 CONFIG_FUSER=y
1036 CONFIG_IOSTAT=y
1037 CONFIG_KILL=y
1038 CONFIG_KILLALL=y
1039 # CONFIG_KILLALL5 is not set
1040 CONFIG_LSOF=y
1041 CONFIG_MPSTAT=y
1042 CONFIG_NMETER=y
1043 CONFIG_PGREP=y
1044 CONFIG_PKILL=y
1045 CONFIG_PIDOF=y
1046 CONFIG_FEATURE_PIDOF_SINGLE=y
1047 CONFIG_FEATURE_PIDOF_OMIT=y
1048 CONFIG_PMAP=y
1049 # CONFIG_POWERTOP is not set
1050 # CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
1051 CONFIG_PS=y
1052 # CONFIG_FEATURE_PS_WIDE is not set
1053 # CONFIG_FEATURE_PS_LONG is not set
1054 CONFIG_FEATURE_PS_TIME=y
1055 # CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
1056 CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
1057 CONFIG_PSTREE=y
1058 CONFIG_PWDX=y
1059 CONFIG_SMEMCAP=y
1060 CONFIG_BB_SYSCTL=y
1061 CONFIG_TOP=y
1062 CONFIG_FEATURE_TOP_INTERACTIVE=y
1063 CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
1064 CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
1065 CONFIG_FEATURE_TOP_SMP_CPU=y
1066 CONFIG_FEATURE_TOP_DECIMALS=y
1067 CONFIG_FEATURE_TOP_SMP_PROCESS=y
1068 CONFIG_FEATURE_TOPMEM=y
1069 CONFIG_UPTIME=y
1070 CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y
1071 CONFIG_WATCH=y
1072
1073 #
1074 # Runit Utilities
1075 #
1076 CONFIG_CHPST=y
1077 CONFIG_SETUIDGID=y
1078 CONFIG_ENVUIDGID=y
1079 CONFIG_ENVDIR=y
1080 CONFIG_SOFTLIMIT=y
1081 CONFIG_RUNSV=y
1082 CONFIG_RUNSVDIR=y
1083 # CONFIG_FEATURE_RUNSVDIR_LOG is not set
1084 CONFIG_SV=y
1085 CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service"
1086 CONFIG_SVC=y
1087 CONFIG_SVOK=y
1088 CONFIG_SVLOGD=y
1089 # CONFIG_CHCON is not set
1090 # CONFIG_GETENFORCE is not set
1091 # CONFIG_GETSEBOOL is not set
1092 # CONFIG_LOAD_POLICY is not set
1093 # CONFIG_MATCHPATHCON is not set
1094 # CONFIG_RUNCON is not set
1095 # CONFIG_SELINUXENABLED is not set
1096 # CONFIG_SESTATUS is not set
1097 # CONFIG_SETENFORCE is not set
1098 # CONFIG_SETFILES is not set
1099 # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
1100 # CONFIG_RESTORECON is not set
1101 # CONFIG_SETSEBOOL is not set
1102
1103 #
1104 # Shells
1105 #
1106 CONFIG_SH_IS_ASH=y
1107 # CONFIG_SH_IS_HUSH is not set
1108 # CONFIG_SH_IS_NONE is not set
1109 # CONFIG_BASH_IS_ASH is not set
1110 # CONFIG_BASH_IS_HUSH is not set
1111 CONFIG_BASH_IS_NONE=y
1112 CONFIG_SHELL_ASH=y
1113 CONFIG_ASH=y
1114 CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
1115 CONFIG_ASH_INTERNAL_GLOB=y
1116 CONFIG_ASH_BASH_COMPAT=y
1117 # CONFIG_ASH_BASH_SOURCE_CURDIR is not set
1118 CONFIG_ASH_BASH_NOT_FOUND_HOOK=y
1119 CONFIG_ASH_JOB_CONTROL=y
1120 CONFIG_ASH_ALIAS=y
1121 CONFIG_ASH_RANDOM_SUPPORT=y
1122 CONFIG_ASH_EXPAND_PRMT=y
1123 CONFIG_ASH_IDLE_TIMEOUT=y
1124 CONFIG_ASH_MAIL=y
1125 CONFIG_ASH_ECHO=y
1126 CONFIG_ASH_PRINTF=y
1127 CONFIG_ASH_TEST=y
1128 CONFIG_ASH_HELP=y
1129 CONFIG_ASH_GETOPTS=y
1130 CONFIG_ASH_CMDCMD=y
1131 # CONFIG_CTTYHACK is not set
1132 # CONFIG_HUSH is not set
1133 # CONFIG_SHELL_HUSH is not set
1134 # CONFIG_HUSH_BASH_COMPAT is not set
1135 # CONFIG_HUSH_BRACE_EXPANSION is not set
1136 # CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
1137 # CONFIG_HUSH_LINENO_VAR is not set
1138 # CONFIG_HUSH_INTERACTIVE is not set
1139 # CONFIG_HUSH_SAVEHISTORY is not set
1140 # CONFIG_HUSH_JOB is not set
1141 # CONFIG_HUSH_TICK is not set
1142 # CONFIG_HUSH_IF is not set
1143 # CONFIG_HUSH_LOOPS is not set
1144 # CONFIG_HUSH_CASE is not set
1145 # CONFIG_HUSH_FUNCTIONS is not set
1146 # CONFIG_HUSH_LOCAL is not set
1147 # CONFIG_HUSH_RANDOM_SUPPORT is not set
1148 # CONFIG_HUSH_MODE_X is not set
1149 # CONFIG_HUSH_ECHO is not set
1150 # CONFIG_HUSH_PRINTF is not set
1151 # CONFIG_HUSH_TEST is not set
1152 # CONFIG_HUSH_HELP is not set
1153 # CONFIG_HUSH_EXPORT is not set
1154 # CONFIG_HUSH_EXPORT_N is not set
1155 # CONFIG_HUSH_READONLY is not set
1156 # CONFIG_HUSH_KILL is not set
1157 # CONFIG_HUSH_WAIT is not set
1158 # CONFIG_HUSH_COMMAND is not set
1159 # CONFIG_HUSH_TRAP is not set
1160 # CONFIG_HUSH_TYPE is not set
1161 # CONFIG_HUSH_TIMES is not set
1162 # CONFIG_HUSH_READ is not set
1163 # CONFIG_HUSH_SET is not set
1164 # CONFIG_HUSH_UNSET is not set
1165 # CONFIG_HUSH_ULIMIT is not set
1166 # CONFIG_HUSH_UMASK is not set
1167 # CONFIG_HUSH_GETOPTS is not set
1168 # CONFIG_HUSH_MEMLEAK is not set
1169
1170 #
1171 # Options common to all shells
1172 #
1173 CONFIG_FEATURE_SH_MATH=y
1174 CONFIG_FEATURE_SH_MATH_64=y
1175 CONFIG_FEATURE_SH_MATH_BASE=y
1176 CONFIG_FEATURE_SH_EXTRA_QUIET=y
1177 # CONFIG_FEATURE_SH_STANDALONE is not set
1178 # CONFIG_FEATURE_SH_NOFORK is not set
1179 CONFIG_FEATURE_SH_READ_FRAC=y
1180 CONFIG_FEATURE_SH_HISTFILESIZE=y
1181 CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS=y
1182
1183 #
1184 # System Logging Utilities
1185 #
1186 # CONFIG_KLOGD is not set
1187 # CONFIG_FEATURE_KLOGD_KLOGCTL is not set
1188 # CONFIG_LOGGER is not set
1189 # CONFIG_LOGREAD is not set
1190 # CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
1191 # CONFIG_SYSLOGD is not set
1192 # CONFIG_FEATURE_ROTATE_LOGFILE is not set
1193 # CONFIG_FEATURE_REMOTE_LOG is not set
1194 # CONFIG_FEATURE_SYSLOGD_DUP is not set
1195 # CONFIG_FEATURE_SYSLOGD_CFG is not set
1196 # CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
1197 CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
1198 # CONFIG_FEATURE_IPC_SYSLOG is not set
1199 CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
1200 # CONFIG_FEATURE_KMSG_SYSLOG is not set
--- a/containers/busybox-config
+++ b/containers/busybox-config
@@ -1,1200 +0,0 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D containers/os-release.in
-3
--- a/containers/os-release.in
+++ b/containers/os-release.in
@@ -1,3 +0,0 @@
1
-NAME="Fossil Bus@FOSSIL_CI_PFX@="fslbbx"
2
-VERSION="Fossil 2"
3
-HOME_URL="https://fossil-scm.org/home/doc/trunk/www/contain
--- a/containers/os-release.in
+++ b/containers/os-release.in
@@ -1,3 +0,0 @@
1 NAME="Fossil Bus@FOSSIL_CI_PFX@="fslbbx"
2 VERSION="Fossil 2"
3 HOME_URL="https://fossil-scm.org/home/doc/trunk/www/contain
--- a/containers/os-release.in
+++ b/containers/os-release.in
@@ -1,3 +0,0 @@
 
 
 
+108 -187
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -115,10 +115,11 @@
115115
116116
#include <stdlib.h>
117117
#include <string.h>
118118
#include <stdio.h>
119119
#include <assert.h>
120
+#include <math.h>
120121
#include "sqlite3.h"
121122
typedef sqlite3_int64 i64;
122123
typedef sqlite3_uint64 u64;
123124
typedef unsigned char u8;
124125
#if SQLITE_USER_AUTHENTICATION
@@ -3171,10 +3172,11 @@
31713172
#ifndef U8_TYPEDEF
31723173
/* typedef unsigned char u8; */
31733174
#define U8_TYPEDEF
31743175
#endif
31753176
3177
+/* Decoding table, ASCII (7-bit) value to base 64 digit value or other */
31763178
static const u8 b64DigitValues[128] = {
31773179
/* HT LF VT FF CR */
31783180
ND,ND,ND,ND, ND,ND,ND,ND, ND,WS,WS,WS, WS,WS,ND,ND,
31793181
/* US */
31803182
ND,ND,ND,ND, ND,ND,ND,ND, ND,ND,ND,ND, ND,ND,ND,ND,
@@ -8771,11 +8773,14 @@
87718773
}else{
87728774
/* Figure out if this is a directory or a zero-sized file. Consider
87738775
** it to be a directory either if the mode suggests so, or if
87748776
** the final character in the name is '/'. */
87758777
u32 mode = pCDS->iExternalAttr >> 16;
8776
- if( !(mode & S_IFDIR) && pCDS->zFile[pCDS->nFile-1]!='/' ){
8778
+ if( !(mode & S_IFDIR)
8779
+ && pCDS->nFile>=1
8780
+ && pCDS->zFile[pCDS->nFile-1]!='/'
8781
+ ){
87778782
sqlite3_result_blob(ctx, "", 0, SQLITE_STATIC);
87788783
}
87798784
}
87808785
}
87818786
break;
@@ -12505,11 +12510,10 @@
1250512510
#endif
1250612511
1250712512
#endif /* ifndef _SQLITE_RECOVER_H */
1250812513
1250912514
/************************* End ../ext/recover/sqlite3recover.h ********************/
12510
-# ifndef SQLITE_HAVE_SQLITE3R
1251112515
/************************* Begin ../ext/recover/dbdata.c ******************/
1251212516
/*
1251312517
** 2019-04-17
1251412518
**
1251512519
** The author disclaims copyright to this source code. In place of
@@ -12676,10 +12680,11 @@
1267612680
int rc = sqlite3_declare_vtab(db, pAux ? DBPTR_SCHEMA : DBDATA_SCHEMA);
1267712681
1267812682
(void)argc;
1267912683
(void)argv;
1268012684
(void)pzErr;
12685
+ sqlite3_vtab_config(db, SQLITE_VTAB_USES_ALL_SCHEMAS);
1268112686
if( rc==SQLITE_OK ){
1268212687
pTab = (DbdataTable*)sqlite3_malloc64(sizeof(DbdataTable));
1268312688
if( pTab==0 ){
1268412689
rc = SQLITE_NOMEM;
1268512690
}else{
@@ -13021,14 +13026,18 @@
1302113026
if( pCsr->aPage==0 ){
1302213027
while( 1 ){
1302313028
if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK;
1302413029
rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage);
1302513030
if( rc!=SQLITE_OK ) return rc;
13026
- if( pCsr->aPage ) break;
13031
+ if( pCsr->aPage && pCsr->nPage>=256 ) break;
13032
+ sqlite3_free(pCsr->aPage);
13033
+ pCsr->aPage = 0;
1302713034
if( pCsr->bOnePage ) return SQLITE_OK;
1302813035
pCsr->iPgno++;
1302913036
}
13037
+
13038
+ assert( iOff+3+2<=pCsr->nPage );
1303013039
pCsr->iCell = pTab->bPtr ? -2 : 0;
1303113040
pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
1303213041
}
1303313042
1303413043
if( pTab->bPtr ){
@@ -13259,12 +13268,11 @@
1325913268
static int dbdataGetEncoding(DbdataCursor *pCsr){
1326013269
int rc = SQLITE_OK;
1326113270
int nPg1 = 0;
1326213271
u8 *aPg1 = 0;
1326313272
rc = dbdataLoadPage(pCsr, 1, &aPg1, &nPg1);
13264
- assert( rc!=SQLITE_OK || nPg1==0 || nPg1>=512 );
13265
- if( rc==SQLITE_OK && nPg1>0 ){
13273
+ if( rc==SQLITE_OK && nPg1>=(56+4) ){
1326613274
pCsr->enc = get_uint32(&aPg1[56]);
1326713275
}
1326813276
sqlite3_free(aPg1);
1326913277
return rc;
1327013278
}
@@ -13318,19 +13326,21 @@
1331813326
);
1331913327
}
1332013328
}
1332113329
if( rc==SQLITE_OK ){
1332213330
rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
13323
- }else{
13324
- pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
1332513331
}
1332613332
1332713333
/* Try to determine the encoding of the db by inspecting the header
1332813334
** field on page 1. */
1332913335
if( rc==SQLITE_OK ){
1333013336
rc = dbdataGetEncoding(pCsr);
1333113337
}
13338
+
13339
+ if( rc!=SQLITE_OK ){
13340
+ pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
13341
+ }
1333213342
1333313343
if( rc==SQLITE_OK ){
1333413344
rc = dbdataNext(pCursor);
1333513345
}
1333613346
return rc;
@@ -16330,11 +16340,10 @@
1633016340
}
1633116341
1633216342
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
1633316343
1633416344
/************************* End ../ext/recover/sqlite3recover.c ********************/
16335
-# endif
1633616345
#endif
1633716346
#ifdef SQLITE_SHELL_EXTSRC
1633816347
# include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
1633916348
#endif
1634016349
@@ -17233,10 +17242,11 @@
1723317242
const char *zOrig = z;
1723417243
static const char *azTerm[] = { "", "*/", "\n" };
1723517244
int i;
1723617245
for(i=0; i<ArraySize(azTerm); i++){
1723717246
char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
17247
+ shell_check_oom(zNew);
1723817248
if( sqlite3_complete(zNew) ){
1723917249
size_t n = strlen(zNew);
1724017250
zNew[n-1] = 0;
1724117251
zToFree = zNew;
1724217252
z = zNew;
@@ -17667,13 +17677,13 @@
1766717677
char z[50];
1766817678
double r = sqlite3_column_double(p->pStmt, i);
1766917679
sqlite3_uint64 ur;
1767017680
memcpy(&ur,&r,sizeof(r));
1767117681
if( ur==0x7ff0000000000000LL ){
17672
- raw_printf(p->out, "1e999");
17682
+ raw_printf(p->out, "9.0e+999");
1767317683
}else if( ur==0xfff0000000000000LL ){
17674
- raw_printf(p->out, "-1e999");
17684
+ raw_printf(p->out, "-9.0e+999");
1767517685
}else{
1767617686
sqlite3_int64 ir = (sqlite3_int64)r;
1767717687
if( r==(double)ir ){
1767817688
sqlite3_snprintf(50,z,"%lld.0", ir);
1767917689
}else{
@@ -17713,13 +17723,13 @@
1771317723
char z[50];
1771417724
double r = sqlite3_column_double(p->pStmt, i);
1771517725
sqlite3_uint64 ur;
1771617726
memcpy(&ur,&r,sizeof(r));
1771717727
if( ur==0x7ff0000000000000LL ){
17718
- raw_printf(p->out, "1e999");
17728
+ raw_printf(p->out, "9.0e+999");
1771917729
}else if( ur==0xfff0000000000000LL ){
17720
- raw_printf(p->out, "-1e999");
17730
+ raw_printf(p->out, "-9.0e+999");
1772117731
}else{
1772217732
sqlite3_snprintf(50,z,"%!.20g", r);
1772317733
raw_printf(p->out, "%s", z);
1772417734
}
1772517735
}else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
@@ -17919,10 +17929,11 @@
1791917929
char *zMsg;
1792017930
int i;
1792117931
if( db==0
1792217932
|| zSql==0
1792317933
|| (iOffset = sqlite3_error_offset(db))<0
17934
+ || iOffset>=(int)strlen(zSql)
1792417935
){
1792517936
return sqlite3_mprintf("");
1792617937
}
1792717938
while( iOffset>50 ){
1792817939
iOffset--;
@@ -17930,11 +17941,11 @@
1793017941
while( (zSql[0]&0xc0)==0x80 ){ zSql++; iOffset--; }
1793117942
}
1793217943
len = strlen(zSql);
1793317944
if( len>78 ){
1793417945
len = 78;
17935
- while( (zSql[len]&0xc0)==0x80 ) len--;
17946
+ while( len>0 && (zSql[len]&0xc0)==0x80 ) len--;
1793617947
}
1793717948
zCode = sqlite3_mprintf("%.*s", len, zSql);
1793817949
shell_check_oom(zCode);
1793917950
for(i=0; zCode[i]; i++){ if( IsSpace(zSql[i]) ) zCode[i] = ' '; }
1794017951
if( iOffset<25 ){
@@ -18531,26 +18542,31 @@
1853118542
1853218543
nVar = sqlite3_bind_parameter_count(pStmt);
1853318544
if( nVar==0 ) return; /* Nothing to do */
1853418545
if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
1853518546
"key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
18536
- return; /* Parameter table does not exist */
18547
+ rc = SQLITE_NOTFOUND;
18548
+ pQ = 0;
18549
+ }else{
18550
+ rc = sqlite3_prepare_v2(pArg->db,
18551
+ "SELECT value FROM temp.sqlite_parameters"
18552
+ " WHERE key=?1", -1, &pQ, 0);
1853718553
}
18538
- rc = sqlite3_prepare_v2(pArg->db,
18539
- "SELECT value FROM temp.sqlite_parameters"
18540
- " WHERE key=?1", -1, &pQ, 0);
18541
- if( rc || pQ==0 ) return;
1854218554
for(i=1; i<=nVar; i++){
1854318555
char zNum[30];
1854418556
const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
1854518557
if( zVar==0 ){
1854618558
sqlite3_snprintf(sizeof(zNum),zNum,"?%d",i);
1854718559
zVar = zNum;
1854818560
}
1854918561
sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18550
- if( sqlite3_step(pQ)==SQLITE_ROW ){
18562
+ if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
1855118563
sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
18564
+ }else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
18565
+ sqlite3_bind_double(pStmt, i, NAN);
18566
+ }else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
18567
+ sqlite3_bind_double(pStmt, i, INFINITY);
1855218568
}else{
1855318569
sqlite3_bind_null(pStmt, i);
1855418570
}
1855518571
sqlite3_reset(pQ);
1855618572
}
@@ -19768,12 +19784,14 @@
1976819784
" Options:",
1976919785
" fkey-indexes Find missing foreign key indexes",
1977019786
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
1977119787
".load FILE ?ENTRY? Load an extension library",
1977219788
#endif
19773
-#ifndef SQLITE_SHELL_FIDDLE
19774
- ".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
19789
+#if !defined(SQLITE_SHELL_FIDDLE)
19790
+ ".log FILE|on|off Turn logging on or off. FILE can be stderr/stdout",
19791
+#else
19792
+ ".log on|off Turn logging on or off.",
1977519793
#endif
1977619794
".mode MODE ?OPTIONS? Set output mode",
1977719795
" MODE is one of:",
1977819796
" ascii Columns/rows delimited by 0x1F and 0x1E",
1977919797
" box Tables using unicode box-drawing characters",
@@ -20037,20 +20055,31 @@
2003720055
static char *readFile(const char *zName, int *pnByte){
2003820056
FILE *in = fopen(zName, "rb");
2003920057
long nIn;
2004020058
size_t nRead;
2004120059
char *pBuf;
20060
+ int rc;
2004220061
if( in==0 ) return 0;
20043
- fseek(in, 0, SEEK_END);
20062
+ rc = fseek(in, 0, SEEK_END);
20063
+ if( rc!=0 ){
20064
+ raw_printf(stderr, "Error: '%s' not seekable\n", zName);
20065
+ fclose(in);
20066
+ return 0;
20067
+ }
2004420068
nIn = ftell(in);
2004520069
rewind(in);
2004620070
pBuf = sqlite3_malloc64( nIn+1 );
20047
- if( pBuf==0 ){ fclose(in); return 0; }
20071
+ if( pBuf==0 ){
20072
+ raw_printf(stderr, "Error: out of memory\n");
20073
+ fclose(in);
20074
+ return 0;
20075
+ }
2004820076
nRead = fread(pBuf, nIn, 1, in);
2004920077
fclose(in);
2005020078
if( nRead!=1 ){
2005120079
sqlite3_free(pBuf);
20080
+ raw_printf(stderr, "Error: cannot read '%s'\n", zName);
2005220081
return 0;
2005320082
}
2005420083
pBuf[nIn] = 0;
2005520084
if( pnByte ) *pnByte = nIn;
2005620085
return pBuf;
@@ -20235,57 +20264,10 @@
2023520264
utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine);
2023620265
return 0;
2023720266
}
2023820267
#endif /* SQLITE_OMIT_DESERIALIZE */
2023920268
20240
-/*
20241
-** Scalar function "shell_int32". The first argument to this function
20242
-** must be a blob. The second a non-negative integer. This function
20243
-** reads and returns a 32-bit big-endian integer from byte
20244
-** offset (4*<arg2>) of the blob.
20245
-*/
20246
-static void shellInt32(
20247
- sqlite3_context *context,
20248
- int argc,
20249
- sqlite3_value **argv
20250
-){
20251
- const unsigned char *pBlob;
20252
- int nBlob;
20253
- int iInt;
20254
-
20255
- UNUSED_PARAMETER(argc);
20256
- nBlob = sqlite3_value_bytes(argv[0]);
20257
- pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]);
20258
- iInt = sqlite3_value_int(argv[1]);
20259
-
20260
- if( iInt>=0 && (iInt+1)*4<=nBlob ){
20261
- const unsigned char *a = &pBlob[iInt*4];
20262
- sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24)
20263
- + ((sqlite3_int64)a[1]<<16)
20264
- + ((sqlite3_int64)a[2]<< 8)
20265
- + ((sqlite3_int64)a[3]<< 0);
20266
- sqlite3_result_int64(context, iVal);
20267
- }
20268
-}
20269
-
20270
-/*
20271
-** Scalar function "shell_idquote(X)" returns string X quoted as an identifier,
20272
-** using "..." with internal double-quote characters doubled.
20273
-*/
20274
-static void shellIdQuote(
20275
- sqlite3_context *context,
20276
- int argc,
20277
- sqlite3_value **argv
20278
-){
20279
- const char *zName = (const char*)sqlite3_value_text(argv[0]);
20280
- UNUSED_PARAMETER(argc);
20281
- if( zName ){
20282
- char *z = sqlite3_mprintf("\"%w\"", zName);
20283
- sqlite3_result_text(context, z, -1, sqlite3_free);
20284
- }
20285
-}
20286
-
2028720269
/*
2028820270
** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
2028920271
*/
2029020272
static void shellUSleepFunc(
2029120273
sqlite3_context *context,
@@ -20296,101 +20278,10 @@
2029620278
(void)argcUnused;
2029720279
sqlite3_sleep(sleep/1000);
2029820280
sqlite3_result_int(context, sleep);
2029920281
}
2030020282
20301
-/*
20302
-** Scalar function "shell_escape_crnl" used by the .recover command.
20303
-** The argument passed to this function is the output of built-in
20304
-** function quote(). If the first character of the input is "'",
20305
-** indicating that the value passed to quote() was a text value,
20306
-** then this function searches the input for "\n" and "\r" characters
20307
-** and adds a wrapper similar to the following:
20308
-**
20309
-** replace(replace(<input>, '\n', char(10), '\r', char(13));
20310
-**
20311
-** Or, if the first character of the input is not "'", then a copy
20312
-** of the input is returned.
20313
-*/
20314
-static void shellEscapeCrnl(
20315
- sqlite3_context *context,
20316
- int argc,
20317
- sqlite3_value **argv
20318
-){
20319
- const char *zText = (const char*)sqlite3_value_text(argv[0]);
20320
- UNUSED_PARAMETER(argc);
20321
- if( zText && zText[0]=='\'' ){
20322
- i64 nText = sqlite3_value_bytes(argv[0]);
20323
- i64 i;
20324
- char zBuf1[20];
20325
- char zBuf2[20];
20326
- const char *zNL = 0;
20327
- const char *zCR = 0;
20328
- i64 nCR = 0;
20329
- i64 nNL = 0;
20330
-
20331
- for(i=0; zText[i]; i++){
20332
- if( zNL==0 && zText[i]=='\n' ){
20333
- zNL = unused_string(zText, "\\n", "\\012", zBuf1);
20334
- nNL = strlen(zNL);
20335
- }
20336
- if( zCR==0 && zText[i]=='\r' ){
20337
- zCR = unused_string(zText, "\\r", "\\015", zBuf2);
20338
- nCR = strlen(zCR);
20339
- }
20340
- }
20341
-
20342
- if( zNL || zCR ){
20343
- i64 iOut = 0;
20344
- i64 nMax = (nNL > nCR) ? nNL : nCR;
20345
- i64 nAlloc = nMax * nText + (nMax+64)*2;
20346
- char *zOut = (char*)sqlite3_malloc64(nAlloc);
20347
- if( zOut==0 ){
20348
- sqlite3_result_error_nomem(context);
20349
- return;
20350
- }
20351
-
20352
- if( zNL && zCR ){
20353
- memcpy(&zOut[iOut], "replace(replace(", 16);
20354
- iOut += 16;
20355
- }else{
20356
- memcpy(&zOut[iOut], "replace(", 8);
20357
- iOut += 8;
20358
- }
20359
- for(i=0; zText[i]; i++){
20360
- if( zText[i]=='\n' ){
20361
- memcpy(&zOut[iOut], zNL, nNL);
20362
- iOut += nNL;
20363
- }else if( zText[i]=='\r' ){
20364
- memcpy(&zOut[iOut], zCR, nCR);
20365
- iOut += nCR;
20366
- }else{
20367
- zOut[iOut] = zText[i];
20368
- iOut++;
20369
- }
20370
- }
20371
-
20372
- if( zNL ){
20373
- memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20374
- memcpy(&zOut[iOut], zNL, nNL); iOut += nNL;
20375
- memcpy(&zOut[iOut], "', char(10))", 12); iOut += 12;
20376
- }
20377
- if( zCR ){
20378
- memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20379
- memcpy(&zOut[iOut], zCR, nCR); iOut += nCR;
20380
- memcpy(&zOut[iOut], "', char(13))", 12); iOut += 12;
20381
- }
20382
-
20383
- sqlite3_result_text(context, zOut, iOut, SQLITE_TRANSIENT);
20384
- sqlite3_free(zOut);
20385
- return;
20386
- }
20387
- }
20388
-
20389
- sqlite3_result_value(context, argv[0]);
20390
-}
20391
-
2039220283
/* Flags for open_db().
2039320284
**
2039420285
** The default behavior of open_db() is to exit(1) if the database fails to
2039520286
** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
2039620287
** but still returns without calling exit.
@@ -20452,10 +20343,11 @@
2045220343
sqlite3_open(":memory:", &p->db);
2045320344
return;
2045420345
}
2045520346
exit(1);
2045620347
}
20348
+ sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
2045720349
2045820350
#ifndef SQLITE_OMIT_LOAD_EXTENSION
2045920351
sqlite3_enable_load_extension(p->db, 1);
2046020352
#endif
2046120353
sqlite3_shathree_init(p->db, 0, 0);
@@ -20464,17 +20356,17 @@
2046420356
sqlite3_base64_init(p->db, 0, 0);
2046520357
sqlite3_base85_init(p->db, 0, 0);
2046620358
sqlite3_regexp_init(p->db, 0, 0);
2046720359
sqlite3_ieee_init(p->db, 0, 0);
2046820360
sqlite3_series_init(p->db, 0, 0);
20361
+#if SQLITE_SHELL_HAVE_RECOVER
20362
+ sqlite3_dbdata_init(p->db, 0, 0);
20363
+#endif
2046920364
#ifndef SQLITE_SHELL_FIDDLE
2047020365
sqlite3_fileio_init(p->db, 0, 0);
2047120366
sqlite3_completion_init(p->db, 0, 0);
2047220367
#endif
20473
-#if SQLITE_SHELL_HAVE_RECOVER
20474
- sqlite3_dbdata_init(p->db, 0, 0);
20475
-#endif
2047620368
#ifdef SQLITE_HAVE_ZLIB
2047720369
if( !p->bSafeModePersist ){
2047820370
sqlite3_zipfile_init(p->db, 0, 0);
2047920371
sqlite3_sqlar_init(p->db, 0, 0);
2048020372
}
@@ -20511,16 +20403,10 @@
2051120403
shellAddSchemaName, 0, 0);
2051220404
sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
2051320405
shellModuleSchema, 0, 0);
2051420406
sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
2051520407
shellPutsFunc, 0, 0);
20516
- sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0,
20517
- shellEscapeCrnl, 0, 0);
20518
- sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
20519
- shellInt32, 0, 0);
20520
- sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
20521
- shellIdQuote, 0, 0);
2052220408
sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
2052320409
shellUSleepFunc, 0, 0);
2052420410
#ifndef SQLITE_NOHAVE_SYSTEM
2052520411
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
2052620412
editFunc, 0, 0);
@@ -20543,13 +20429,13 @@
2054320429
unsigned char *aData;
2054420430
if( p->openMode==SHELL_OPEN_DESERIALIZE ){
2054520431
aData = (unsigned char*)readFile(zDbFilename, &nData);
2054620432
}else{
2054720433
aData = readHexDb(p, &nData);
20548
- if( aData==0 ){
20549
- return;
20550
- }
20434
+ }
20435
+ if( aData==0 ){
20436
+ return;
2055120437
}
2055220438
rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
2055320439
SQLITE_DESERIALIZE_RESIZEABLE |
2055420440
SQLITE_DESERIALIZE_FREEONCLOSE);
2055520441
if( rc ){
@@ -20559,12 +20445,17 @@
2055920445
sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax);
2056020446
}
2056120447
}
2056220448
#endif
2056320449
}
20564
- if( p->bSafeModePersist && p->db!=0 ){
20565
- sqlite3_set_authorizer(p->db, safeModeAuth, p);
20450
+ if( p->db!=0 ){
20451
+ if( p->bSafeModePersist ){
20452
+ sqlite3_set_authorizer(p->db, safeModeAuth, p);
20453
+ }
20454
+ sqlite3_db_config(
20455
+ p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
20456
+ );
2056620457
}
2056720458
}
2056820459
2056920460
/*
2057020461
** Attempt to close the databaes connection. Report errors.
@@ -21283,11 +21174,11 @@
2128321174
}
2128421175
sqlite3_finalize(pStmt);
2128521176
return res;
2128621177
}
2128721178
21288
-#if defined(SQLITE_SHELL_HAVE_RECOVER)
21179
+#if SQLITE_SHELL_HAVE_RECOVER
2128921180
/*
2129021181
** Convert a 2-byte or 4-byte big-endian integer into a native integer
2129121182
*/
2129221183
static unsigned int get2byteInt(unsigned char *a){
2129321184
return (a[0]<<8) + a[1];
@@ -23179,11 +23070,10 @@
2317923070
output_reset(p);
2318023071
if( nArg!=2 ){
2318123072
raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
2318223073
rc = 2;
2318323074
}else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
23184
- raw_printf(stderr, "Error: cannot read 'testcase-out.txt'\n");
2318523075
rc = 2;
2318623076
}else if( testcase_glob(azArg[1],zRes)==0 ){
2318723077
utf8_printf(stderr,
2318823078
"testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
2318923079
p->zTestcase, azArg[1], zRes);
@@ -23309,10 +23199,12 @@
2330923199
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
2331023200
{ "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
2331123201
{ "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
2331223202
{ "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
2331323203
{ "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
23204
+ { "reverse_scanorder", SQLITE_DBCONFIG_REVERSE_SCANORDER },
23205
+ { "stmt_scanstatus", SQLITE_DBCONFIG_STMT_SCANSTATUS },
2331423206
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
2331523207
{ "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
2331623208
{ "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
2331723209
};
2331823210
int ii, v;
@@ -24258,23 +24150,29 @@
2425824150
rc = 1;
2425924151
}
2426024152
}else
2426124153
#endif
2426224154
24263
-#ifndef SQLITE_SHELL_FIDDLE
2426424155
if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){
24265
- failIfSafeMode(p, "cannot run .log in safe mode");
2426624156
if( nArg!=2 ){
2426724157
raw_printf(stderr, "Usage: .log FILENAME\n");
2426824158
rc = 1;
2426924159
}else{
2427024160
const char *zFile = azArg[1];
24161
+ if( p->bSafeMode
24162
+ && cli_strcmp(zFile,"on")!=0
24163
+ && cli_strcmp(zFile,"off")!=0
24164
+ ){
24165
+ raw_printf(stdout, "cannot set .log to anything other "
24166
+ "than \"on\" or \"off\"\n");
24167
+ zFile = "off";
24168
+ }
2427124169
output_file_close(p->pLog);
24170
+ if( cli_strcmp(zFile,"on")==0 ) zFile = "stdout";
2427224171
p->pLog = output_file_open(zFile, 0);
2427324172
}
2427424173
}else
24275
-#endif
2427624174
2427724175
if( c=='m' && cli_strncmp(azArg[0], "mode", n)==0 ){
2427824176
const char *zMode = 0;
2427924177
const char *zTabname = 0;
2428024178
int i, n2;
@@ -24906,10 +24804,14 @@
2490624804
if( cli_strcmp(azArg[1], "est")==0 ){
2490724805
p->scanstatsOn = 2;
2490824806
}else{
2490924807
p->scanstatsOn = (u8)booleanValue(azArg[1]);
2491024808
}
24809
+ open_db(p, 0);
24810
+ sqlite3_db_config(
24811
+ p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
24812
+ );
2491124813
#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
2491224814
raw_printf(stderr, "Warning: .scanstats not available in this build.\n");
2491324815
#endif
2491424816
}else{
2491524817
raw_printf(stderr, "Usage: .scanstats on|off|est\n");
@@ -26786,10 +26688,11 @@
2678626688
2678726689
/*
2678826690
** Show available command line options
2678926691
*/
2679026692
static const char zOptions[] =
26693
+ " -- treat no subsequent arguments as options\n"
2679126694
#if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
2679226695
" -A ARGS... run \".archive ARGS\" and exit\n"
2679326696
#endif
2679426697
" -append append the database to the end of the file\n"
2679526698
" -ascii set output mode to 'ascii'\n"
@@ -26848,13 +26751,13 @@
2684826751
" -zip open the file as a ZIP Archive\n"
2684926752
#endif
2685026753
;
2685126754
static void usage(int showDetail){
2685226755
utf8_printf(stderr,
26853
- "Usage: %s [OPTIONS] FILENAME [SQL]\n"
26756
+ "Usage: %s [OPTIONS] [FILENAME [SQL]]\n"
2685426757
"FILENAME is the name of an SQLite database. A new database is created\n"
26855
- "if the file does not previously exist.\n", Argv0);
26758
+ "if the file does not previously exist. Defaults to :memory:.\n", Argv0);
2685626759
if( showDetail ){
2685726760
utf8_printf(stderr, "OPTIONS include:\n%s", zOptions);
2685826761
}else{
2685926762
raw_printf(stderr, "Use the -help option for additional information\n");
2686026763
}
@@ -26882,13 +26785,15 @@
2688226785
data->pAuxDb = &data->aAuxDb[0];
2688326786
memcpy(data->colSeparator,SEP_Column, 2);
2688426787
memcpy(data->rowSeparator,SEP_Row, 2);
2688526788
data->showHeader = 0;
2688626789
data->shellFlgs = SHFLG_Lookaside;
26790
+ sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
26791
+#if !defined(SQLITE_SHELL_FIDDLE)
2688726792
verify_uninitialized();
26793
+#endif
2688826794
sqlite3_config(SQLITE_CONFIG_URI, 1);
26889
- sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
2689026795
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
2689126796
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
2689226797
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
2689326798
}
2689426799
@@ -26961,10 +26866,11 @@
2696126866
int i;
2696226867
int rc = 0;
2696326868
int warnInmemoryDb = 0;
2696426869
int readStdin = 1;
2696526870
int nCmd = 0;
26871
+ int nOptsEnd = argc;
2696626872
char **azCmd = 0;
2696726873
const char *zVfs = 0; /* Value of -vfs command-line option */
2696826874
#if !SQLITE_SHELL_IS_UTF8
2696926875
char **argvToFree = 0;
2697026876
int argcToFree = 0;
@@ -27064,15 +26970,17 @@
2706426970
/* Do an initial pass through the command-line argument to locate
2706526971
** the name of the database file, the name of the initialization file,
2706626972
** the size of the alternative malloc heap,
2706726973
** and the first command to execute.
2706826974
*/
26975
+#ifndef SQLITE_SHELL_FIDDLE
2706926976
verify_uninitialized();
26977
+#endif
2707026978
for(i=1; i<argc; i++){
2707126979
char *z;
2707226980
z = argv[i];
27073
- if( z[0]!='-' ){
26981
+ if( z[0]!='-' || i>nOptsEnd ){
2707426982
if( data.aAuxDb->zDbFilename==0 ){
2707526983
data.aAuxDb->zDbFilename = z;
2707626984
}else{
2707726985
/* Excesss arguments are interpreted as SQL (or dot-commands) and
2707826986
** mean that nothing is read from stdin */
@@ -27080,13 +26988,17 @@
2708026988
nCmd++;
2708126989
azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
2708226990
shell_check_oom(azCmd);
2708326991
azCmd[nCmd-1] = z;
2708426992
}
26993
+ continue;
2708526994
}
2708626995
if( z[1]=='-' ) z++;
27087
- if( cli_strcmp(z,"-separator")==0
26996
+ if( cli_strcmp(z, "-")==0 ){
26997
+ nOptsEnd = i;
26998
+ continue;
26999
+ }else if( cli_strcmp(z,"-separator")==0
2708827000
|| cli_strcmp(z,"-nullvalue")==0
2708927001
|| cli_strcmp(z,"-newline")==0
2709027002
|| cli_strcmp(z,"-cmd")==0
2709127003
){
2709227004
(void)cmdline_option_value(argc, argv, ++i);
@@ -27104,10 +27016,11 @@
2710427016
sqlite3_int64 szHeap;
2710527017
2710627018
zSize = cmdline_option_value(argc, argv, ++i);
2710727019
szHeap = integerValue(zSize);
2710827020
if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
27021
+ verify_uninitialized();
2710927022
sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
2711027023
#else
2711127024
(void)cmdline_option_value(argc, argv, ++i);
2711227025
#endif
2711327026
}else if( cli_strcmp(z,"-pagecache")==0 ){
@@ -27117,24 +27030,27 @@
2711727030
if( sz<0 ) sz = 0;
2711827031
n = integerValue(cmdline_option_value(argc,argv,++i));
2711927032
if( sz>0 && n>0 && 0xffffffffffffLL/sz<n ){
2712027033
n = 0xffffffffffffLL/sz;
2712127034
}
27035
+ verify_uninitialized();
2712227036
sqlite3_config(SQLITE_CONFIG_PAGECACHE,
2712327037
(n>0 && sz>0) ? malloc(n*sz) : 0, sz, n);
2712427038
data.shellFlgs |= SHFLG_Pagecache;
2712527039
}else if( cli_strcmp(z,"-lookaside")==0 ){
2712627040
int n, sz;
2712727041
sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
2712827042
if( sz<0 ) sz = 0;
2712927043
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
2713027044
if( n<0 ) n = 0;
27045
+ verify_uninitialized();
2713127046
sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, n);
2713227047
if( sz*n==0 ) data.shellFlgs &= ~SHFLG_Lookaside;
2713327048
}else if( cli_strcmp(z,"-threadsafe")==0 ){
2713427049
int n;
2713527050
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27051
+ verify_uninitialized();
2713627052
switch( n ){
2713727053
case 0: sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); break;
2713827054
case 2: sqlite3_config(SQLITE_CONFIG_MULTITHREAD); break;
2713927055
default: sqlite3_config(SQLITE_CONFIG_SERIALIZED); break;
2714027056
}
@@ -27154,14 +27070,16 @@
2715427070
extern int sqlite3_multiple_initialize(const char*,int);
2715527071
sqlite3_multiplex_initialize(0, 1);
2715627072
#endif
2715727073
}else if( cli_strcmp(z,"-mmap")==0 ){
2715827074
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27075
+ verify_uninitialized();
2715927076
sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
27160
-#ifdef SQLITE_ENABLE_SORTER_REFERENCES
27077
+#if defined(SQLITE_ENABLE_SORTER_REFERENCES)
2716127078
}else if( cli_strcmp(z,"-sorterref")==0 ){
2716227079
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27080
+ verify_uninitialized();
2716327081
sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
2716427082
#endif
2716527083
}else if( cli_strcmp(z,"-vfs")==0 ){
2716627084
zVfs = cmdline_option_value(argc, argv, ++i);
2716727085
#ifdef SQLITE_HAVE_ZLIB
@@ -27195,11 +27113,13 @@
2719527113
data.zNonce = strdup(argv[++i]);
2719627114
}else if( cli_strcmp(z,"-safe")==0 ){
2719727115
/* no-op - catch this on the second pass */
2719827116
}
2719927117
}
27118
+#ifndef SQLITE_SHELL_FIDDLE
2720027119
verify_uninitialized();
27120
+#endif
2720127121
2720227122
2720327123
#ifdef SQLITE_SHELL_INIT_PROC
2720427124
{
2720527125
/* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
@@ -27259,11 +27179,11 @@
2725927179
** file is processed so that the command-line arguments will override
2726027180
** settings in the initialization file.
2726127181
*/
2726227182
for(i=1; i<argc; i++){
2726327183
char *z = argv[i];
27264
- if( z[0]!='-' ) continue;
27184
+ if( z[0]!='-' || i>=nOptsEnd ) continue;
2726527185
if( z[1]=='-' ){ z++; }
2726627186
if( cli_strcmp(z,"-init")==0 ){
2726727187
i++;
2726827188
}else if( cli_strcmp(z,"-html")==0 ){
2726927189
data.mode = MODE_Html;
@@ -27443,10 +27363,11 @@
2744327363
free(azCmd);
2744427364
return rc==2 ? 0 : rc;
2744527365
}
2744627366
}else{
2744727367
open_db(&data, 0);
27368
+ echo_group_input(&data, azCmd[i]);
2744827369
rc = shell_exec(&data, azCmd[i], &zErrMsg);
2744927370
if( zErrMsg || rc ){
2745027371
if( zErrMsg!=0 ){
2745127372
utf8_printf(stderr,"Error: %s\n", zErrMsg);
2745227373
}else{
2745327374
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -115,10 +115,11 @@
115
116 #include <stdlib.h>
117 #include <string.h>
118 #include <stdio.h>
119 #include <assert.h>
 
120 #include "sqlite3.h"
121 typedef sqlite3_int64 i64;
122 typedef sqlite3_uint64 u64;
123 typedef unsigned char u8;
124 #if SQLITE_USER_AUTHENTICATION
@@ -3171,10 +3172,11 @@
3171 #ifndef U8_TYPEDEF
3172 /* typedef unsigned char u8; */
3173 #define U8_TYPEDEF
3174 #endif
3175
 
3176 static const u8 b64DigitValues[128] = {
3177 /* HT LF VT FF CR */
3178 ND,ND,ND,ND, ND,ND,ND,ND, ND,WS,WS,WS, WS,WS,ND,ND,
3179 /* US */
3180 ND,ND,ND,ND, ND,ND,ND,ND, ND,ND,ND,ND, ND,ND,ND,ND,
@@ -8771,11 +8773,14 @@
8771 }else{
8772 /* Figure out if this is a directory or a zero-sized file. Consider
8773 ** it to be a directory either if the mode suggests so, or if
8774 ** the final character in the name is '/'. */
8775 u32 mode = pCDS->iExternalAttr >> 16;
8776 if( !(mode & S_IFDIR) && pCDS->zFile[pCDS->nFile-1]!='/' ){
 
 
 
8777 sqlite3_result_blob(ctx, "", 0, SQLITE_STATIC);
8778 }
8779 }
8780 }
8781 break;
@@ -12505,11 +12510,10 @@
12505 #endif
12506
12507 #endif /* ifndef _SQLITE_RECOVER_H */
12508
12509 /************************* End ../ext/recover/sqlite3recover.h ********************/
12510 # ifndef SQLITE_HAVE_SQLITE3R
12511 /************************* Begin ../ext/recover/dbdata.c ******************/
12512 /*
12513 ** 2019-04-17
12514 **
12515 ** The author disclaims copyright to this source code. In place of
@@ -12676,10 +12680,11 @@
12676 int rc = sqlite3_declare_vtab(db, pAux ? DBPTR_SCHEMA : DBDATA_SCHEMA);
12677
12678 (void)argc;
12679 (void)argv;
12680 (void)pzErr;
 
12681 if( rc==SQLITE_OK ){
12682 pTab = (DbdataTable*)sqlite3_malloc64(sizeof(DbdataTable));
12683 if( pTab==0 ){
12684 rc = SQLITE_NOMEM;
12685 }else{
@@ -13021,14 +13026,18 @@
13021 if( pCsr->aPage==0 ){
13022 while( 1 ){
13023 if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK;
13024 rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage);
13025 if( rc!=SQLITE_OK ) return rc;
13026 if( pCsr->aPage ) break;
 
 
13027 if( pCsr->bOnePage ) return SQLITE_OK;
13028 pCsr->iPgno++;
13029 }
 
 
13030 pCsr->iCell = pTab->bPtr ? -2 : 0;
13031 pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
13032 }
13033
13034 if( pTab->bPtr ){
@@ -13259,12 +13268,11 @@
13259 static int dbdataGetEncoding(DbdataCursor *pCsr){
13260 int rc = SQLITE_OK;
13261 int nPg1 = 0;
13262 u8 *aPg1 = 0;
13263 rc = dbdataLoadPage(pCsr, 1, &aPg1, &nPg1);
13264 assert( rc!=SQLITE_OK || nPg1==0 || nPg1>=512 );
13265 if( rc==SQLITE_OK && nPg1>0 ){
13266 pCsr->enc = get_uint32(&aPg1[56]);
13267 }
13268 sqlite3_free(aPg1);
13269 return rc;
13270 }
@@ -13318,19 +13326,21 @@
13318 );
13319 }
13320 }
13321 if( rc==SQLITE_OK ){
13322 rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
13323 }else{
13324 pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
13325 }
13326
13327 /* Try to determine the encoding of the db by inspecting the header
13328 ** field on page 1. */
13329 if( rc==SQLITE_OK ){
13330 rc = dbdataGetEncoding(pCsr);
13331 }
 
 
 
 
13332
13333 if( rc==SQLITE_OK ){
13334 rc = dbdataNext(pCursor);
13335 }
13336 return rc;
@@ -16330,11 +16340,10 @@
16330 }
16331
16332 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
16333
16334 /************************* End ../ext/recover/sqlite3recover.c ********************/
16335 # endif
16336 #endif
16337 #ifdef SQLITE_SHELL_EXTSRC
16338 # include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
16339 #endif
16340
@@ -17233,10 +17242,11 @@
17233 const char *zOrig = z;
17234 static const char *azTerm[] = { "", "*/", "\n" };
17235 int i;
17236 for(i=0; i<ArraySize(azTerm); i++){
17237 char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
 
17238 if( sqlite3_complete(zNew) ){
17239 size_t n = strlen(zNew);
17240 zNew[n-1] = 0;
17241 zToFree = zNew;
17242 z = zNew;
@@ -17667,13 +17677,13 @@
17667 char z[50];
17668 double r = sqlite3_column_double(p->pStmt, i);
17669 sqlite3_uint64 ur;
17670 memcpy(&ur,&r,sizeof(r));
17671 if( ur==0x7ff0000000000000LL ){
17672 raw_printf(p->out, "1e999");
17673 }else if( ur==0xfff0000000000000LL ){
17674 raw_printf(p->out, "-1e999");
17675 }else{
17676 sqlite3_int64 ir = (sqlite3_int64)r;
17677 if( r==(double)ir ){
17678 sqlite3_snprintf(50,z,"%lld.0", ir);
17679 }else{
@@ -17713,13 +17723,13 @@
17713 char z[50];
17714 double r = sqlite3_column_double(p->pStmt, i);
17715 sqlite3_uint64 ur;
17716 memcpy(&ur,&r,sizeof(r));
17717 if( ur==0x7ff0000000000000LL ){
17718 raw_printf(p->out, "1e999");
17719 }else if( ur==0xfff0000000000000LL ){
17720 raw_printf(p->out, "-1e999");
17721 }else{
17722 sqlite3_snprintf(50,z,"%!.20g", r);
17723 raw_printf(p->out, "%s", z);
17724 }
17725 }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
@@ -17919,10 +17929,11 @@
17919 char *zMsg;
17920 int i;
17921 if( db==0
17922 || zSql==0
17923 || (iOffset = sqlite3_error_offset(db))<0
 
17924 ){
17925 return sqlite3_mprintf("");
17926 }
17927 while( iOffset>50 ){
17928 iOffset--;
@@ -17930,11 +17941,11 @@
17930 while( (zSql[0]&0xc0)==0x80 ){ zSql++; iOffset--; }
17931 }
17932 len = strlen(zSql);
17933 if( len>78 ){
17934 len = 78;
17935 while( (zSql[len]&0xc0)==0x80 ) len--;
17936 }
17937 zCode = sqlite3_mprintf("%.*s", len, zSql);
17938 shell_check_oom(zCode);
17939 for(i=0; zCode[i]; i++){ if( IsSpace(zSql[i]) ) zCode[i] = ' '; }
17940 if( iOffset<25 ){
@@ -18531,26 +18542,31 @@
18531
18532 nVar = sqlite3_bind_parameter_count(pStmt);
18533 if( nVar==0 ) return; /* Nothing to do */
18534 if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
18535 "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
18536 return; /* Parameter table does not exist */
 
 
 
 
 
18537 }
18538 rc = sqlite3_prepare_v2(pArg->db,
18539 "SELECT value FROM temp.sqlite_parameters"
18540 " WHERE key=?1", -1, &pQ, 0);
18541 if( rc || pQ==0 ) return;
18542 for(i=1; i<=nVar; i++){
18543 char zNum[30];
18544 const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
18545 if( zVar==0 ){
18546 sqlite3_snprintf(sizeof(zNum),zNum,"?%d",i);
18547 zVar = zNum;
18548 }
18549 sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18550 if( sqlite3_step(pQ)==SQLITE_ROW ){
18551 sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
 
 
 
 
18552 }else{
18553 sqlite3_bind_null(pStmt, i);
18554 }
18555 sqlite3_reset(pQ);
18556 }
@@ -19768,12 +19784,14 @@
19768 " Options:",
19769 " fkey-indexes Find missing foreign key indexes",
19770 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
19771 ".load FILE ?ENTRY? Load an extension library",
19772 #endif
19773 #ifndef SQLITE_SHELL_FIDDLE
19774 ".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
 
 
19775 #endif
19776 ".mode MODE ?OPTIONS? Set output mode",
19777 " MODE is one of:",
19778 " ascii Columns/rows delimited by 0x1F and 0x1E",
19779 " box Tables using unicode box-drawing characters",
@@ -20037,20 +20055,31 @@
20037 static char *readFile(const char *zName, int *pnByte){
20038 FILE *in = fopen(zName, "rb");
20039 long nIn;
20040 size_t nRead;
20041 char *pBuf;
 
20042 if( in==0 ) return 0;
20043 fseek(in, 0, SEEK_END);
 
 
 
 
 
20044 nIn = ftell(in);
20045 rewind(in);
20046 pBuf = sqlite3_malloc64( nIn+1 );
20047 if( pBuf==0 ){ fclose(in); return 0; }
 
 
 
 
20048 nRead = fread(pBuf, nIn, 1, in);
20049 fclose(in);
20050 if( nRead!=1 ){
20051 sqlite3_free(pBuf);
 
20052 return 0;
20053 }
20054 pBuf[nIn] = 0;
20055 if( pnByte ) *pnByte = nIn;
20056 return pBuf;
@@ -20235,57 +20264,10 @@
20235 utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine);
20236 return 0;
20237 }
20238 #endif /* SQLITE_OMIT_DESERIALIZE */
20239
20240 /*
20241 ** Scalar function "shell_int32". The first argument to this function
20242 ** must be a blob. The second a non-negative integer. This function
20243 ** reads and returns a 32-bit big-endian integer from byte
20244 ** offset (4*<arg2>) of the blob.
20245 */
20246 static void shellInt32(
20247 sqlite3_context *context,
20248 int argc,
20249 sqlite3_value **argv
20250 ){
20251 const unsigned char *pBlob;
20252 int nBlob;
20253 int iInt;
20254
20255 UNUSED_PARAMETER(argc);
20256 nBlob = sqlite3_value_bytes(argv[0]);
20257 pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]);
20258 iInt = sqlite3_value_int(argv[1]);
20259
20260 if( iInt>=0 && (iInt+1)*4<=nBlob ){
20261 const unsigned char *a = &pBlob[iInt*4];
20262 sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24)
20263 + ((sqlite3_int64)a[1]<<16)
20264 + ((sqlite3_int64)a[2]<< 8)
20265 + ((sqlite3_int64)a[3]<< 0);
20266 sqlite3_result_int64(context, iVal);
20267 }
20268 }
20269
20270 /*
20271 ** Scalar function "shell_idquote(X)" returns string X quoted as an identifier,
20272 ** using "..." with internal double-quote characters doubled.
20273 */
20274 static void shellIdQuote(
20275 sqlite3_context *context,
20276 int argc,
20277 sqlite3_value **argv
20278 ){
20279 const char *zName = (const char*)sqlite3_value_text(argv[0]);
20280 UNUSED_PARAMETER(argc);
20281 if( zName ){
20282 char *z = sqlite3_mprintf("\"%w\"", zName);
20283 sqlite3_result_text(context, z, -1, sqlite3_free);
20284 }
20285 }
20286
20287 /*
20288 ** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
20289 */
20290 static void shellUSleepFunc(
20291 sqlite3_context *context,
@@ -20296,101 +20278,10 @@
20296 (void)argcUnused;
20297 sqlite3_sleep(sleep/1000);
20298 sqlite3_result_int(context, sleep);
20299 }
20300
20301 /*
20302 ** Scalar function "shell_escape_crnl" used by the .recover command.
20303 ** The argument passed to this function is the output of built-in
20304 ** function quote(). If the first character of the input is "'",
20305 ** indicating that the value passed to quote() was a text value,
20306 ** then this function searches the input for "\n" and "\r" characters
20307 ** and adds a wrapper similar to the following:
20308 **
20309 ** replace(replace(<input>, '\n', char(10), '\r', char(13));
20310 **
20311 ** Or, if the first character of the input is not "'", then a copy
20312 ** of the input is returned.
20313 */
20314 static void shellEscapeCrnl(
20315 sqlite3_context *context,
20316 int argc,
20317 sqlite3_value **argv
20318 ){
20319 const char *zText = (const char*)sqlite3_value_text(argv[0]);
20320 UNUSED_PARAMETER(argc);
20321 if( zText && zText[0]=='\'' ){
20322 i64 nText = sqlite3_value_bytes(argv[0]);
20323 i64 i;
20324 char zBuf1[20];
20325 char zBuf2[20];
20326 const char *zNL = 0;
20327 const char *zCR = 0;
20328 i64 nCR = 0;
20329 i64 nNL = 0;
20330
20331 for(i=0; zText[i]; i++){
20332 if( zNL==0 && zText[i]=='\n' ){
20333 zNL = unused_string(zText, "\\n", "\\012", zBuf1);
20334 nNL = strlen(zNL);
20335 }
20336 if( zCR==0 && zText[i]=='\r' ){
20337 zCR = unused_string(zText, "\\r", "\\015", zBuf2);
20338 nCR = strlen(zCR);
20339 }
20340 }
20341
20342 if( zNL || zCR ){
20343 i64 iOut = 0;
20344 i64 nMax = (nNL > nCR) ? nNL : nCR;
20345 i64 nAlloc = nMax * nText + (nMax+64)*2;
20346 char *zOut = (char*)sqlite3_malloc64(nAlloc);
20347 if( zOut==0 ){
20348 sqlite3_result_error_nomem(context);
20349 return;
20350 }
20351
20352 if( zNL && zCR ){
20353 memcpy(&zOut[iOut], "replace(replace(", 16);
20354 iOut += 16;
20355 }else{
20356 memcpy(&zOut[iOut], "replace(", 8);
20357 iOut += 8;
20358 }
20359 for(i=0; zText[i]; i++){
20360 if( zText[i]=='\n' ){
20361 memcpy(&zOut[iOut], zNL, nNL);
20362 iOut += nNL;
20363 }else if( zText[i]=='\r' ){
20364 memcpy(&zOut[iOut], zCR, nCR);
20365 iOut += nCR;
20366 }else{
20367 zOut[iOut] = zText[i];
20368 iOut++;
20369 }
20370 }
20371
20372 if( zNL ){
20373 memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20374 memcpy(&zOut[iOut], zNL, nNL); iOut += nNL;
20375 memcpy(&zOut[iOut], "', char(10))", 12); iOut += 12;
20376 }
20377 if( zCR ){
20378 memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20379 memcpy(&zOut[iOut], zCR, nCR); iOut += nCR;
20380 memcpy(&zOut[iOut], "', char(13))", 12); iOut += 12;
20381 }
20382
20383 sqlite3_result_text(context, zOut, iOut, SQLITE_TRANSIENT);
20384 sqlite3_free(zOut);
20385 return;
20386 }
20387 }
20388
20389 sqlite3_result_value(context, argv[0]);
20390 }
20391
20392 /* Flags for open_db().
20393 **
20394 ** The default behavior of open_db() is to exit(1) if the database fails to
20395 ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
20396 ** but still returns without calling exit.
@@ -20452,10 +20343,11 @@
20452 sqlite3_open(":memory:", &p->db);
20453 return;
20454 }
20455 exit(1);
20456 }
 
20457
20458 #ifndef SQLITE_OMIT_LOAD_EXTENSION
20459 sqlite3_enable_load_extension(p->db, 1);
20460 #endif
20461 sqlite3_shathree_init(p->db, 0, 0);
@@ -20464,17 +20356,17 @@
20464 sqlite3_base64_init(p->db, 0, 0);
20465 sqlite3_base85_init(p->db, 0, 0);
20466 sqlite3_regexp_init(p->db, 0, 0);
20467 sqlite3_ieee_init(p->db, 0, 0);
20468 sqlite3_series_init(p->db, 0, 0);
 
 
 
20469 #ifndef SQLITE_SHELL_FIDDLE
20470 sqlite3_fileio_init(p->db, 0, 0);
20471 sqlite3_completion_init(p->db, 0, 0);
20472 #endif
20473 #if SQLITE_SHELL_HAVE_RECOVER
20474 sqlite3_dbdata_init(p->db, 0, 0);
20475 #endif
20476 #ifdef SQLITE_HAVE_ZLIB
20477 if( !p->bSafeModePersist ){
20478 sqlite3_zipfile_init(p->db, 0, 0);
20479 sqlite3_sqlar_init(p->db, 0, 0);
20480 }
@@ -20511,16 +20403,10 @@
20511 shellAddSchemaName, 0, 0);
20512 sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
20513 shellModuleSchema, 0, 0);
20514 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
20515 shellPutsFunc, 0, 0);
20516 sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0,
20517 shellEscapeCrnl, 0, 0);
20518 sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
20519 shellInt32, 0, 0);
20520 sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
20521 shellIdQuote, 0, 0);
20522 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
20523 shellUSleepFunc, 0, 0);
20524 #ifndef SQLITE_NOHAVE_SYSTEM
20525 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
20526 editFunc, 0, 0);
@@ -20543,13 +20429,13 @@
20543 unsigned char *aData;
20544 if( p->openMode==SHELL_OPEN_DESERIALIZE ){
20545 aData = (unsigned char*)readFile(zDbFilename, &nData);
20546 }else{
20547 aData = readHexDb(p, &nData);
20548 if( aData==0 ){
20549 return;
20550 }
20551 }
20552 rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
20553 SQLITE_DESERIALIZE_RESIZEABLE |
20554 SQLITE_DESERIALIZE_FREEONCLOSE);
20555 if( rc ){
@@ -20559,12 +20445,17 @@
20559 sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax);
20560 }
20561 }
20562 #endif
20563 }
20564 if( p->bSafeModePersist && p->db!=0 ){
20565 sqlite3_set_authorizer(p->db, safeModeAuth, p);
 
 
 
 
 
20566 }
20567 }
20568
20569 /*
20570 ** Attempt to close the databaes connection. Report errors.
@@ -21283,11 +21174,11 @@
21283 }
21284 sqlite3_finalize(pStmt);
21285 return res;
21286 }
21287
21288 #if defined(SQLITE_SHELL_HAVE_RECOVER)
21289 /*
21290 ** Convert a 2-byte or 4-byte big-endian integer into a native integer
21291 */
21292 static unsigned int get2byteInt(unsigned char *a){
21293 return (a[0]<<8) + a[1];
@@ -23179,11 +23070,10 @@
23179 output_reset(p);
23180 if( nArg!=2 ){
23181 raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
23182 rc = 2;
23183 }else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
23184 raw_printf(stderr, "Error: cannot read 'testcase-out.txt'\n");
23185 rc = 2;
23186 }else if( testcase_glob(azArg[1],zRes)==0 ){
23187 utf8_printf(stderr,
23188 "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
23189 p->zTestcase, azArg[1], zRes);
@@ -23309,10 +23199,12 @@
23309 { "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
23310 { "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
23311 { "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
23312 { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
23313 { "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
 
 
23314 { "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
23315 { "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
23316 { "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
23317 };
23318 int ii, v;
@@ -24258,23 +24150,29 @@
24258 rc = 1;
24259 }
24260 }else
24261 #endif
24262
24263 #ifndef SQLITE_SHELL_FIDDLE
24264 if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){
24265 failIfSafeMode(p, "cannot run .log in safe mode");
24266 if( nArg!=2 ){
24267 raw_printf(stderr, "Usage: .log FILENAME\n");
24268 rc = 1;
24269 }else{
24270 const char *zFile = azArg[1];
 
 
 
 
 
 
 
 
24271 output_file_close(p->pLog);
 
24272 p->pLog = output_file_open(zFile, 0);
24273 }
24274 }else
24275 #endif
24276
24277 if( c=='m' && cli_strncmp(azArg[0], "mode", n)==0 ){
24278 const char *zMode = 0;
24279 const char *zTabname = 0;
24280 int i, n2;
@@ -24906,10 +24804,14 @@
24906 if( cli_strcmp(azArg[1], "est")==0 ){
24907 p->scanstatsOn = 2;
24908 }else{
24909 p->scanstatsOn = (u8)booleanValue(azArg[1]);
24910 }
 
 
 
 
24911 #ifndef SQLITE_ENABLE_STMT_SCANSTATUS
24912 raw_printf(stderr, "Warning: .scanstats not available in this build.\n");
24913 #endif
24914 }else{
24915 raw_printf(stderr, "Usage: .scanstats on|off|est\n");
@@ -26786,10 +26688,11 @@
26786
26787 /*
26788 ** Show available command line options
26789 */
26790 static const char zOptions[] =
 
26791 #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
26792 " -A ARGS... run \".archive ARGS\" and exit\n"
26793 #endif
26794 " -append append the database to the end of the file\n"
26795 " -ascii set output mode to 'ascii'\n"
@@ -26848,13 +26751,13 @@
26848 " -zip open the file as a ZIP Archive\n"
26849 #endif
26850 ;
26851 static void usage(int showDetail){
26852 utf8_printf(stderr,
26853 "Usage: %s [OPTIONS] FILENAME [SQL]\n"
26854 "FILENAME is the name of an SQLite database. A new database is created\n"
26855 "if the file does not previously exist.\n", Argv0);
26856 if( showDetail ){
26857 utf8_printf(stderr, "OPTIONS include:\n%s", zOptions);
26858 }else{
26859 raw_printf(stderr, "Use the -help option for additional information\n");
26860 }
@@ -26882,13 +26785,15 @@
26882 data->pAuxDb = &data->aAuxDb[0];
26883 memcpy(data->colSeparator,SEP_Column, 2);
26884 memcpy(data->rowSeparator,SEP_Row, 2);
26885 data->showHeader = 0;
26886 data->shellFlgs = SHFLG_Lookaside;
 
 
26887 verify_uninitialized();
 
26888 sqlite3_config(SQLITE_CONFIG_URI, 1);
26889 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
26890 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
26891 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
26892 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
26893 }
26894
@@ -26961,10 +26866,11 @@
26961 int i;
26962 int rc = 0;
26963 int warnInmemoryDb = 0;
26964 int readStdin = 1;
26965 int nCmd = 0;
 
26966 char **azCmd = 0;
26967 const char *zVfs = 0; /* Value of -vfs command-line option */
26968 #if !SQLITE_SHELL_IS_UTF8
26969 char **argvToFree = 0;
26970 int argcToFree = 0;
@@ -27064,15 +26970,17 @@
27064 /* Do an initial pass through the command-line argument to locate
27065 ** the name of the database file, the name of the initialization file,
27066 ** the size of the alternative malloc heap,
27067 ** and the first command to execute.
27068 */
 
27069 verify_uninitialized();
 
27070 for(i=1; i<argc; i++){
27071 char *z;
27072 z = argv[i];
27073 if( z[0]!='-' ){
27074 if( data.aAuxDb->zDbFilename==0 ){
27075 data.aAuxDb->zDbFilename = z;
27076 }else{
27077 /* Excesss arguments are interpreted as SQL (or dot-commands) and
27078 ** mean that nothing is read from stdin */
@@ -27080,13 +26988,17 @@
27080 nCmd++;
27081 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
27082 shell_check_oom(azCmd);
27083 azCmd[nCmd-1] = z;
27084 }
 
27085 }
27086 if( z[1]=='-' ) z++;
27087 if( cli_strcmp(z,"-separator")==0
 
 
 
27088 || cli_strcmp(z,"-nullvalue")==0
27089 || cli_strcmp(z,"-newline")==0
27090 || cli_strcmp(z,"-cmd")==0
27091 ){
27092 (void)cmdline_option_value(argc, argv, ++i);
@@ -27104,10 +27016,11 @@
27104 sqlite3_int64 szHeap;
27105
27106 zSize = cmdline_option_value(argc, argv, ++i);
27107 szHeap = integerValue(zSize);
27108 if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
 
27109 sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
27110 #else
27111 (void)cmdline_option_value(argc, argv, ++i);
27112 #endif
27113 }else if( cli_strcmp(z,"-pagecache")==0 ){
@@ -27117,24 +27030,27 @@
27117 if( sz<0 ) sz = 0;
27118 n = integerValue(cmdline_option_value(argc,argv,++i));
27119 if( sz>0 && n>0 && 0xffffffffffffLL/sz<n ){
27120 n = 0xffffffffffffLL/sz;
27121 }
 
27122 sqlite3_config(SQLITE_CONFIG_PAGECACHE,
27123 (n>0 && sz>0) ? malloc(n*sz) : 0, sz, n);
27124 data.shellFlgs |= SHFLG_Pagecache;
27125 }else if( cli_strcmp(z,"-lookaside")==0 ){
27126 int n, sz;
27127 sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
27128 if( sz<0 ) sz = 0;
27129 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27130 if( n<0 ) n = 0;
 
27131 sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, n);
27132 if( sz*n==0 ) data.shellFlgs &= ~SHFLG_Lookaside;
27133 }else if( cli_strcmp(z,"-threadsafe")==0 ){
27134 int n;
27135 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
 
27136 switch( n ){
27137 case 0: sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); break;
27138 case 2: sqlite3_config(SQLITE_CONFIG_MULTITHREAD); break;
27139 default: sqlite3_config(SQLITE_CONFIG_SERIALIZED); break;
27140 }
@@ -27154,14 +27070,16 @@
27154 extern int sqlite3_multiple_initialize(const char*,int);
27155 sqlite3_multiplex_initialize(0, 1);
27156 #endif
27157 }else if( cli_strcmp(z,"-mmap")==0 ){
27158 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
 
27159 sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
27160 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
27161 }else if( cli_strcmp(z,"-sorterref")==0 ){
27162 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
 
27163 sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
27164 #endif
27165 }else if( cli_strcmp(z,"-vfs")==0 ){
27166 zVfs = cmdline_option_value(argc, argv, ++i);
27167 #ifdef SQLITE_HAVE_ZLIB
@@ -27195,11 +27113,13 @@
27195 data.zNonce = strdup(argv[++i]);
27196 }else if( cli_strcmp(z,"-safe")==0 ){
27197 /* no-op - catch this on the second pass */
27198 }
27199 }
 
27200 verify_uninitialized();
 
27201
27202
27203 #ifdef SQLITE_SHELL_INIT_PROC
27204 {
27205 /* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
@@ -27259,11 +27179,11 @@
27259 ** file is processed so that the command-line arguments will override
27260 ** settings in the initialization file.
27261 */
27262 for(i=1; i<argc; i++){
27263 char *z = argv[i];
27264 if( z[0]!='-' ) continue;
27265 if( z[1]=='-' ){ z++; }
27266 if( cli_strcmp(z,"-init")==0 ){
27267 i++;
27268 }else if( cli_strcmp(z,"-html")==0 ){
27269 data.mode = MODE_Html;
@@ -27443,10 +27363,11 @@
27443 free(azCmd);
27444 return rc==2 ? 0 : rc;
27445 }
27446 }else{
27447 open_db(&data, 0);
 
27448 rc = shell_exec(&data, azCmd[i], &zErrMsg);
27449 if( zErrMsg || rc ){
27450 if( zErrMsg!=0 ){
27451 utf8_printf(stderr,"Error: %s\n", zErrMsg);
27452 }else{
27453
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -115,10 +115,11 @@
115
116 #include <stdlib.h>
117 #include <string.h>
118 #include <stdio.h>
119 #include <assert.h>
120 #include <math.h>
121 #include "sqlite3.h"
122 typedef sqlite3_int64 i64;
123 typedef sqlite3_uint64 u64;
124 typedef unsigned char u8;
125 #if SQLITE_USER_AUTHENTICATION
@@ -3171,10 +3172,11 @@
3172 #ifndef U8_TYPEDEF
3173 /* typedef unsigned char u8; */
3174 #define U8_TYPEDEF
3175 #endif
3176
3177 /* Decoding table, ASCII (7-bit) value to base 64 digit value or other */
3178 static const u8 b64DigitValues[128] = {
3179 /* HT LF VT FF CR */
3180 ND,ND,ND,ND, ND,ND,ND,ND, ND,WS,WS,WS, WS,WS,ND,ND,
3181 /* US */
3182 ND,ND,ND,ND, ND,ND,ND,ND, ND,ND,ND,ND, ND,ND,ND,ND,
@@ -8771,11 +8773,14 @@
8773 }else{
8774 /* Figure out if this is a directory or a zero-sized file. Consider
8775 ** it to be a directory either if the mode suggests so, or if
8776 ** the final character in the name is '/'. */
8777 u32 mode = pCDS->iExternalAttr >> 16;
8778 if( !(mode & S_IFDIR)
8779 && pCDS->nFile>=1
8780 && pCDS->zFile[pCDS->nFile-1]!='/'
8781 ){
8782 sqlite3_result_blob(ctx, "", 0, SQLITE_STATIC);
8783 }
8784 }
8785 }
8786 break;
@@ -12505,11 +12510,10 @@
12510 #endif
12511
12512 #endif /* ifndef _SQLITE_RECOVER_H */
12513
12514 /************************* End ../ext/recover/sqlite3recover.h ********************/
 
12515 /************************* Begin ../ext/recover/dbdata.c ******************/
12516 /*
12517 ** 2019-04-17
12518 **
12519 ** The author disclaims copyright to this source code. In place of
@@ -12676,10 +12680,11 @@
12680 int rc = sqlite3_declare_vtab(db, pAux ? DBPTR_SCHEMA : DBDATA_SCHEMA);
12681
12682 (void)argc;
12683 (void)argv;
12684 (void)pzErr;
12685 sqlite3_vtab_config(db, SQLITE_VTAB_USES_ALL_SCHEMAS);
12686 if( rc==SQLITE_OK ){
12687 pTab = (DbdataTable*)sqlite3_malloc64(sizeof(DbdataTable));
12688 if( pTab==0 ){
12689 rc = SQLITE_NOMEM;
12690 }else{
@@ -13021,14 +13026,18 @@
13026 if( pCsr->aPage==0 ){
13027 while( 1 ){
13028 if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK;
13029 rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage);
13030 if( rc!=SQLITE_OK ) return rc;
13031 if( pCsr->aPage && pCsr->nPage>=256 ) break;
13032 sqlite3_free(pCsr->aPage);
13033 pCsr->aPage = 0;
13034 if( pCsr->bOnePage ) return SQLITE_OK;
13035 pCsr->iPgno++;
13036 }
13037
13038 assert( iOff+3+2<=pCsr->nPage );
13039 pCsr->iCell = pTab->bPtr ? -2 : 0;
13040 pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
13041 }
13042
13043 if( pTab->bPtr ){
@@ -13259,12 +13268,11 @@
13268 static int dbdataGetEncoding(DbdataCursor *pCsr){
13269 int rc = SQLITE_OK;
13270 int nPg1 = 0;
13271 u8 *aPg1 = 0;
13272 rc = dbdataLoadPage(pCsr, 1, &aPg1, &nPg1);
13273 if( rc==SQLITE_OK && nPg1>=(56+4) ){
 
13274 pCsr->enc = get_uint32(&aPg1[56]);
13275 }
13276 sqlite3_free(aPg1);
13277 return rc;
13278 }
@@ -13318,19 +13326,21 @@
13326 );
13327 }
13328 }
13329 if( rc==SQLITE_OK ){
13330 rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
 
 
13331 }
13332
13333 /* Try to determine the encoding of the db by inspecting the header
13334 ** field on page 1. */
13335 if( rc==SQLITE_OK ){
13336 rc = dbdataGetEncoding(pCsr);
13337 }
13338
13339 if( rc!=SQLITE_OK ){
13340 pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
13341 }
13342
13343 if( rc==SQLITE_OK ){
13344 rc = dbdataNext(pCursor);
13345 }
13346 return rc;
@@ -16330,11 +16340,10 @@
16340 }
16341
16342 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
16343
16344 /************************* End ../ext/recover/sqlite3recover.c ********************/
 
16345 #endif
16346 #ifdef SQLITE_SHELL_EXTSRC
16347 # include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
16348 #endif
16349
@@ -17233,10 +17242,11 @@
17242 const char *zOrig = z;
17243 static const char *azTerm[] = { "", "*/", "\n" };
17244 int i;
17245 for(i=0; i<ArraySize(azTerm); i++){
17246 char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
17247 shell_check_oom(zNew);
17248 if( sqlite3_complete(zNew) ){
17249 size_t n = strlen(zNew);
17250 zNew[n-1] = 0;
17251 zToFree = zNew;
17252 z = zNew;
@@ -17667,13 +17677,13 @@
17677 char z[50];
17678 double r = sqlite3_column_double(p->pStmt, i);
17679 sqlite3_uint64 ur;
17680 memcpy(&ur,&r,sizeof(r));
17681 if( ur==0x7ff0000000000000LL ){
17682 raw_printf(p->out, "9.0e+999");
17683 }else if( ur==0xfff0000000000000LL ){
17684 raw_printf(p->out, "-9.0e+999");
17685 }else{
17686 sqlite3_int64 ir = (sqlite3_int64)r;
17687 if( r==(double)ir ){
17688 sqlite3_snprintf(50,z,"%lld.0", ir);
17689 }else{
@@ -17713,13 +17723,13 @@
17723 char z[50];
17724 double r = sqlite3_column_double(p->pStmt, i);
17725 sqlite3_uint64 ur;
17726 memcpy(&ur,&r,sizeof(r));
17727 if( ur==0x7ff0000000000000LL ){
17728 raw_printf(p->out, "9.0e+999");
17729 }else if( ur==0xfff0000000000000LL ){
17730 raw_printf(p->out, "-9.0e+999");
17731 }else{
17732 sqlite3_snprintf(50,z,"%!.20g", r);
17733 raw_printf(p->out, "%s", z);
17734 }
17735 }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
@@ -17919,10 +17929,11 @@
17929 char *zMsg;
17930 int i;
17931 if( db==0
17932 || zSql==0
17933 || (iOffset = sqlite3_error_offset(db))<0
17934 || iOffset>=(int)strlen(zSql)
17935 ){
17936 return sqlite3_mprintf("");
17937 }
17938 while( iOffset>50 ){
17939 iOffset--;
@@ -17930,11 +17941,11 @@
17941 while( (zSql[0]&0xc0)==0x80 ){ zSql++; iOffset--; }
17942 }
17943 len = strlen(zSql);
17944 if( len>78 ){
17945 len = 78;
17946 while( len>0 && (zSql[len]&0xc0)==0x80 ) len--;
17947 }
17948 zCode = sqlite3_mprintf("%.*s", len, zSql);
17949 shell_check_oom(zCode);
17950 for(i=0; zCode[i]; i++){ if( IsSpace(zSql[i]) ) zCode[i] = ' '; }
17951 if( iOffset<25 ){
@@ -18531,26 +18542,31 @@
18542
18543 nVar = sqlite3_bind_parameter_count(pStmt);
18544 if( nVar==0 ) return; /* Nothing to do */
18545 if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
18546 "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
18547 rc = SQLITE_NOTFOUND;
18548 pQ = 0;
18549 }else{
18550 rc = sqlite3_prepare_v2(pArg->db,
18551 "SELECT value FROM temp.sqlite_parameters"
18552 " WHERE key=?1", -1, &pQ, 0);
18553 }
 
 
 
 
18554 for(i=1; i<=nVar; i++){
18555 char zNum[30];
18556 const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
18557 if( zVar==0 ){
18558 sqlite3_snprintf(sizeof(zNum),zNum,"?%d",i);
18559 zVar = zNum;
18560 }
18561 sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18562 if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
18563 sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
18564 }else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
18565 sqlite3_bind_double(pStmt, i, NAN);
18566 }else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
18567 sqlite3_bind_double(pStmt, i, INFINITY);
18568 }else{
18569 sqlite3_bind_null(pStmt, i);
18570 }
18571 sqlite3_reset(pQ);
18572 }
@@ -19768,12 +19784,14 @@
19784 " Options:",
19785 " fkey-indexes Find missing foreign key indexes",
19786 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
19787 ".load FILE ?ENTRY? Load an extension library",
19788 #endif
19789 #if !defined(SQLITE_SHELL_FIDDLE)
19790 ".log FILE|on|off Turn logging on or off. FILE can be stderr/stdout",
19791 #else
19792 ".log on|off Turn logging on or off.",
19793 #endif
19794 ".mode MODE ?OPTIONS? Set output mode",
19795 " MODE is one of:",
19796 " ascii Columns/rows delimited by 0x1F and 0x1E",
19797 " box Tables using unicode box-drawing characters",
@@ -20037,20 +20055,31 @@
20055 static char *readFile(const char *zName, int *pnByte){
20056 FILE *in = fopen(zName, "rb");
20057 long nIn;
20058 size_t nRead;
20059 char *pBuf;
20060 int rc;
20061 if( in==0 ) return 0;
20062 rc = fseek(in, 0, SEEK_END);
20063 if( rc!=0 ){
20064 raw_printf(stderr, "Error: '%s' not seekable\n", zName);
20065 fclose(in);
20066 return 0;
20067 }
20068 nIn = ftell(in);
20069 rewind(in);
20070 pBuf = sqlite3_malloc64( nIn+1 );
20071 if( pBuf==0 ){
20072 raw_printf(stderr, "Error: out of memory\n");
20073 fclose(in);
20074 return 0;
20075 }
20076 nRead = fread(pBuf, nIn, 1, in);
20077 fclose(in);
20078 if( nRead!=1 ){
20079 sqlite3_free(pBuf);
20080 raw_printf(stderr, "Error: cannot read '%s'\n", zName);
20081 return 0;
20082 }
20083 pBuf[nIn] = 0;
20084 if( pnByte ) *pnByte = nIn;
20085 return pBuf;
@@ -20235,57 +20264,10 @@
20264 utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine);
20265 return 0;
20266 }
20267 #endif /* SQLITE_OMIT_DESERIALIZE */
20268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20269 /*
20270 ** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
20271 */
20272 static void shellUSleepFunc(
20273 sqlite3_context *context,
@@ -20296,101 +20278,10 @@
20278 (void)argcUnused;
20279 sqlite3_sleep(sleep/1000);
20280 sqlite3_result_int(context, sleep);
20281 }
20282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20283 /* Flags for open_db().
20284 **
20285 ** The default behavior of open_db() is to exit(1) if the database fails to
20286 ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
20287 ** but still returns without calling exit.
@@ -20452,10 +20343,11 @@
20343 sqlite3_open(":memory:", &p->db);
20344 return;
20345 }
20346 exit(1);
20347 }
20348 sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
20349
20350 #ifndef SQLITE_OMIT_LOAD_EXTENSION
20351 sqlite3_enable_load_extension(p->db, 1);
20352 #endif
20353 sqlite3_shathree_init(p->db, 0, 0);
@@ -20464,17 +20356,17 @@
20356 sqlite3_base64_init(p->db, 0, 0);
20357 sqlite3_base85_init(p->db, 0, 0);
20358 sqlite3_regexp_init(p->db, 0, 0);
20359 sqlite3_ieee_init(p->db, 0, 0);
20360 sqlite3_series_init(p->db, 0, 0);
20361 #if SQLITE_SHELL_HAVE_RECOVER
20362 sqlite3_dbdata_init(p->db, 0, 0);
20363 #endif
20364 #ifndef SQLITE_SHELL_FIDDLE
20365 sqlite3_fileio_init(p->db, 0, 0);
20366 sqlite3_completion_init(p->db, 0, 0);
20367 #endif
 
 
 
20368 #ifdef SQLITE_HAVE_ZLIB
20369 if( !p->bSafeModePersist ){
20370 sqlite3_zipfile_init(p->db, 0, 0);
20371 sqlite3_sqlar_init(p->db, 0, 0);
20372 }
@@ -20511,16 +20403,10 @@
20403 shellAddSchemaName, 0, 0);
20404 sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
20405 shellModuleSchema, 0, 0);
20406 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
20407 shellPutsFunc, 0, 0);
 
 
 
 
 
 
20408 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
20409 shellUSleepFunc, 0, 0);
20410 #ifndef SQLITE_NOHAVE_SYSTEM
20411 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
20412 editFunc, 0, 0);
@@ -20543,13 +20429,13 @@
20429 unsigned char *aData;
20430 if( p->openMode==SHELL_OPEN_DESERIALIZE ){
20431 aData = (unsigned char*)readFile(zDbFilename, &nData);
20432 }else{
20433 aData = readHexDb(p, &nData);
20434 }
20435 if( aData==0 ){
20436 return;
20437 }
20438 rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
20439 SQLITE_DESERIALIZE_RESIZEABLE |
20440 SQLITE_DESERIALIZE_FREEONCLOSE);
20441 if( rc ){
@@ -20559,12 +20445,17 @@
20445 sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax);
20446 }
20447 }
20448 #endif
20449 }
20450 if( p->db!=0 ){
20451 if( p->bSafeModePersist ){
20452 sqlite3_set_authorizer(p->db, safeModeAuth, p);
20453 }
20454 sqlite3_db_config(
20455 p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
20456 );
20457 }
20458 }
20459
20460 /*
20461 ** Attempt to close the databaes connection. Report errors.
@@ -21283,11 +21174,11 @@
21174 }
21175 sqlite3_finalize(pStmt);
21176 return res;
21177 }
21178
21179 #if SQLITE_SHELL_HAVE_RECOVER
21180 /*
21181 ** Convert a 2-byte or 4-byte big-endian integer into a native integer
21182 */
21183 static unsigned int get2byteInt(unsigned char *a){
21184 return (a[0]<<8) + a[1];
@@ -23179,11 +23070,10 @@
23070 output_reset(p);
23071 if( nArg!=2 ){
23072 raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
23073 rc = 2;
23074 }else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
 
23075 rc = 2;
23076 }else if( testcase_glob(azArg[1],zRes)==0 ){
23077 utf8_printf(stderr,
23078 "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
23079 p->zTestcase, azArg[1], zRes);
@@ -23309,10 +23199,12 @@
23199 { "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
23200 { "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
23201 { "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
23202 { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
23203 { "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
23204 { "reverse_scanorder", SQLITE_DBCONFIG_REVERSE_SCANORDER },
23205 { "stmt_scanstatus", SQLITE_DBCONFIG_STMT_SCANSTATUS },
23206 { "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
23207 { "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
23208 { "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
23209 };
23210 int ii, v;
@@ -24258,23 +24150,29 @@
24150 rc = 1;
24151 }
24152 }else
24153 #endif
24154
 
24155 if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){
 
24156 if( nArg!=2 ){
24157 raw_printf(stderr, "Usage: .log FILENAME\n");
24158 rc = 1;
24159 }else{
24160 const char *zFile = azArg[1];
24161 if( p->bSafeMode
24162 && cli_strcmp(zFile,"on")!=0
24163 && cli_strcmp(zFile,"off")!=0
24164 ){
24165 raw_printf(stdout, "cannot set .log to anything other "
24166 "than \"on\" or \"off\"\n");
24167 zFile = "off";
24168 }
24169 output_file_close(p->pLog);
24170 if( cli_strcmp(zFile,"on")==0 ) zFile = "stdout";
24171 p->pLog = output_file_open(zFile, 0);
24172 }
24173 }else
 
24174
24175 if( c=='m' && cli_strncmp(azArg[0], "mode", n)==0 ){
24176 const char *zMode = 0;
24177 const char *zTabname = 0;
24178 int i, n2;
@@ -24906,10 +24804,14 @@
24804 if( cli_strcmp(azArg[1], "est")==0 ){
24805 p->scanstatsOn = 2;
24806 }else{
24807 p->scanstatsOn = (u8)booleanValue(azArg[1]);
24808 }
24809 open_db(p, 0);
24810 sqlite3_db_config(
24811 p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
24812 );
24813 #ifndef SQLITE_ENABLE_STMT_SCANSTATUS
24814 raw_printf(stderr, "Warning: .scanstats not available in this build.\n");
24815 #endif
24816 }else{
24817 raw_printf(stderr, "Usage: .scanstats on|off|est\n");
@@ -26786,10 +26688,11 @@
26688
26689 /*
26690 ** Show available command line options
26691 */
26692 static const char zOptions[] =
26693 " -- treat no subsequent arguments as options\n"
26694 #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
26695 " -A ARGS... run \".archive ARGS\" and exit\n"
26696 #endif
26697 " -append append the database to the end of the file\n"
26698 " -ascii set output mode to 'ascii'\n"
@@ -26848,13 +26751,13 @@
26751 " -zip open the file as a ZIP Archive\n"
26752 #endif
26753 ;
26754 static void usage(int showDetail){
26755 utf8_printf(stderr,
26756 "Usage: %s [OPTIONS] [FILENAME [SQL]]\n"
26757 "FILENAME is the name of an SQLite database. A new database is created\n"
26758 "if the file does not previously exist. Defaults to :memory:.\n", Argv0);
26759 if( showDetail ){
26760 utf8_printf(stderr, "OPTIONS include:\n%s", zOptions);
26761 }else{
26762 raw_printf(stderr, "Use the -help option for additional information\n");
26763 }
@@ -26882,13 +26785,15 @@
26785 data->pAuxDb = &data->aAuxDb[0];
26786 memcpy(data->colSeparator,SEP_Column, 2);
26787 memcpy(data->rowSeparator,SEP_Row, 2);
26788 data->showHeader = 0;
26789 data->shellFlgs = SHFLG_Lookaside;
26790 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
26791 #if !defined(SQLITE_SHELL_FIDDLE)
26792 verify_uninitialized();
26793 #endif
26794 sqlite3_config(SQLITE_CONFIG_URI, 1);
 
26795 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
26796 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
26797 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
26798 }
26799
@@ -26961,10 +26866,11 @@
26866 int i;
26867 int rc = 0;
26868 int warnInmemoryDb = 0;
26869 int readStdin = 1;
26870 int nCmd = 0;
26871 int nOptsEnd = argc;
26872 char **azCmd = 0;
26873 const char *zVfs = 0; /* Value of -vfs command-line option */
26874 #if !SQLITE_SHELL_IS_UTF8
26875 char **argvToFree = 0;
26876 int argcToFree = 0;
@@ -27064,15 +26970,17 @@
26970 /* Do an initial pass through the command-line argument to locate
26971 ** the name of the database file, the name of the initialization file,
26972 ** the size of the alternative malloc heap,
26973 ** and the first command to execute.
26974 */
26975 #ifndef SQLITE_SHELL_FIDDLE
26976 verify_uninitialized();
26977 #endif
26978 for(i=1; i<argc; i++){
26979 char *z;
26980 z = argv[i];
26981 if( z[0]!='-' || i>nOptsEnd ){
26982 if( data.aAuxDb->zDbFilename==0 ){
26983 data.aAuxDb->zDbFilename = z;
26984 }else{
26985 /* Excesss arguments are interpreted as SQL (or dot-commands) and
26986 ** mean that nothing is read from stdin */
@@ -27080,13 +26988,17 @@
26988 nCmd++;
26989 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
26990 shell_check_oom(azCmd);
26991 azCmd[nCmd-1] = z;
26992 }
26993 continue;
26994 }
26995 if( z[1]=='-' ) z++;
26996 if( cli_strcmp(z, "-")==0 ){
26997 nOptsEnd = i;
26998 continue;
26999 }else if( cli_strcmp(z,"-separator")==0
27000 || cli_strcmp(z,"-nullvalue")==0
27001 || cli_strcmp(z,"-newline")==0
27002 || cli_strcmp(z,"-cmd")==0
27003 ){
27004 (void)cmdline_option_value(argc, argv, ++i);
@@ -27104,10 +27016,11 @@
27016 sqlite3_int64 szHeap;
27017
27018 zSize = cmdline_option_value(argc, argv, ++i);
27019 szHeap = integerValue(zSize);
27020 if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
27021 verify_uninitialized();
27022 sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
27023 #else
27024 (void)cmdline_option_value(argc, argv, ++i);
27025 #endif
27026 }else if( cli_strcmp(z,"-pagecache")==0 ){
@@ -27117,24 +27030,27 @@
27030 if( sz<0 ) sz = 0;
27031 n = integerValue(cmdline_option_value(argc,argv,++i));
27032 if( sz>0 && n>0 && 0xffffffffffffLL/sz<n ){
27033 n = 0xffffffffffffLL/sz;
27034 }
27035 verify_uninitialized();
27036 sqlite3_config(SQLITE_CONFIG_PAGECACHE,
27037 (n>0 && sz>0) ? malloc(n*sz) : 0, sz, n);
27038 data.shellFlgs |= SHFLG_Pagecache;
27039 }else if( cli_strcmp(z,"-lookaside")==0 ){
27040 int n, sz;
27041 sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
27042 if( sz<0 ) sz = 0;
27043 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27044 if( n<0 ) n = 0;
27045 verify_uninitialized();
27046 sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, n);
27047 if( sz*n==0 ) data.shellFlgs &= ~SHFLG_Lookaside;
27048 }else if( cli_strcmp(z,"-threadsafe")==0 ){
27049 int n;
27050 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27051 verify_uninitialized();
27052 switch( n ){
27053 case 0: sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); break;
27054 case 2: sqlite3_config(SQLITE_CONFIG_MULTITHREAD); break;
27055 default: sqlite3_config(SQLITE_CONFIG_SERIALIZED); break;
27056 }
@@ -27154,14 +27070,16 @@
27070 extern int sqlite3_multiple_initialize(const char*,int);
27071 sqlite3_multiplex_initialize(0, 1);
27072 #endif
27073 }else if( cli_strcmp(z,"-mmap")==0 ){
27074 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27075 verify_uninitialized();
27076 sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
27077 #if defined(SQLITE_ENABLE_SORTER_REFERENCES)
27078 }else if( cli_strcmp(z,"-sorterref")==0 ){
27079 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27080 verify_uninitialized();
27081 sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
27082 #endif
27083 }else if( cli_strcmp(z,"-vfs")==0 ){
27084 zVfs = cmdline_option_value(argc, argv, ++i);
27085 #ifdef SQLITE_HAVE_ZLIB
@@ -27195,11 +27113,13 @@
27113 data.zNonce = strdup(argv[++i]);
27114 }else if( cli_strcmp(z,"-safe")==0 ){
27115 /* no-op - catch this on the second pass */
27116 }
27117 }
27118 #ifndef SQLITE_SHELL_FIDDLE
27119 verify_uninitialized();
27120 #endif
27121
27122
27123 #ifdef SQLITE_SHELL_INIT_PROC
27124 {
27125 /* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
@@ -27259,11 +27179,11 @@
27179 ** file is processed so that the command-line arguments will override
27180 ** settings in the initialization file.
27181 */
27182 for(i=1; i<argc; i++){
27183 char *z = argv[i];
27184 if( z[0]!='-' || i>=nOptsEnd ) continue;
27185 if( z[1]=='-' ){ z++; }
27186 if( cli_strcmp(z,"-init")==0 ){
27187 i++;
27188 }else if( cli_strcmp(z,"-html")==0 ){
27189 data.mode = MODE_Html;
@@ -27443,10 +27363,11 @@
27363 free(azCmd);
27364 return rc==2 ? 0 : rc;
27365 }
27366 }else{
27367 open_db(&data, 0);
27368 echo_group_input(&data, azCmd[i]);
27369 rc = shell_exec(&data, azCmd[i], &zErrMsg);
27370 if( zErrMsg || rc ){
27371 if( zErrMsg!=0 ){
27372 utf8_printf(stderr,"Error: %s\n", zErrMsg);
27373 }else{
27374
+2592 -1793
--- 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.41.1. By combining all the individual C code files into this
3
+** version 3.42.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.
@@ -450,13 +450,13 @@
450450
**
451451
** See also: [sqlite3_libversion()],
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455
-#define SQLITE_VERSION "3.41.1"
456
-#define SQLITE_VERSION_NUMBER 3041001
457
-#define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
455
+#define SQLITE_VERSION "3.42.0"
456
+#define SQLITE_VERSION_NUMBER 3042000
457
+#define SQLITE_SOURCE_ID "2023-04-10 18:44:00 4c5a3c5fb351cc1c2ce16c33314ce19c53531f09263f87456283d9d756002f9d"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -1959,23 +1959,26 @@
19591959
**
19601960
** <b>The sqlite3_config() interface is not threadsafe. The application
19611961
** must ensure that no other SQLite interfaces are invoked by other
19621962
** threads while sqlite3_config() is running.</b>
19631963
**
1964
-** The sqlite3_config() interface
1965
-** may only be invoked prior to library initialization using
1966
-** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1967
-** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1968
-** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1969
-** Note, however, that ^sqlite3_config() can be called as part of the
1970
-** implementation of an application-defined [sqlite3_os_init()].
1971
-**
19721964
** The first argument to sqlite3_config() is an integer
19731965
** [configuration option] that determines
19741966
** what property of SQLite is to be configured. Subsequent arguments
19751967
** vary depending on the [configuration option]
19761968
** in the first argument.
1969
+**
1970
+** For most configuration options, the sqlite3_config() interface
1971
+** may only be invoked prior to library initialization using
1972
+** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1973
+** The exceptional configuration options that may be invoked at any time
1974
+** are called "anytime configuration options".
1975
+** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1976
+** [sqlite3_shutdown()] with a first argument that is not an anytime
1977
+** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1978
+** Note, however, that ^sqlite3_config() can be called as part of the
1979
+** implementation of an application-defined [sqlite3_os_init()].
19771980
**
19781981
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
19791982
** ^If the option is unknown or SQLite is unable to set the option
19801983
** then this routine returns a non-zero [error code].
19811984
*/
@@ -2079,10 +2082,27 @@
20792082
** CAPI3REF: Configuration Options
20802083
** KEYWORDS: {configuration option}
20812084
**
20822085
** These constants are the available integer configuration options that
20832086
** can be passed as the first argument to the [sqlite3_config()] interface.
2087
+**
2088
+** Most of the configuration options for sqlite3_config()
2089
+** will only work if invoked prior to [sqlite3_initialize()] or after
2090
+** [sqlite3_shutdown()]. The few exceptions to this rule are called
2091
+** "anytime configuration options".
2092
+** ^Calling [sqlite3_config()] with a first argument that is not an
2093
+** anytime configuration option in between calls to [sqlite3_initialize()] and
2094
+** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
2095
+**
2096
+** The set of anytime configuration options can change (by insertions
2097
+** and/or deletions) from one release of SQLite to the next.
2098
+** As of SQLite version 3.42.0, the complete set of anytime configuration
2099
+** options is:
2100
+** <ul>
2101
+** <li> SQLITE_CONFIG_LOG
2102
+** <li> SQLITE_CONFIG_PCACHE_HDRSZ
2103
+** </ul>
20842104
**
20852105
** New configuration options may be added in future releases of SQLite.
20862106
** Existing configuration options might be discontinued. Applications
20872107
** should check the return code from [sqlite3_config()] to make sure that
20882108
** the call worked. The [sqlite3_config()] interface will return a
@@ -2740,10 +2760,30 @@
27402760
** the [VACUUM] command will fail with an obscure error when attempting to
27412761
** process a table with generated columns and a descending index. This is
27422762
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
27432763
** either generated columns or decending indexes.
27442764
** </dd>
2765
+**
2766
+** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2767
+** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2768
+** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2769
+** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2770
+** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2771
+** statistics. For statistics to be collected, the flag must be set on
2772
+** the database handle both when the SQL statement is prepared and when it
2773
+** is stepped. The flag is set (collection of statistics is enabled)
2774
+** by default.</dd>
2775
+**
2776
+** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2777
+** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2778
+** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2779
+** in which tables and indexes are scanned so that the scans start at the end
2780
+** and work toward the beginning rather than starting at the beginning and
2781
+** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2782
+** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2783
+** is useful for application testing.</dd>
2784
+**
27452785
** </dl>
27462786
*/
27472787
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
27482788
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
27492789
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2760,11 +2800,13 @@
27602800
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
27612801
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
27622802
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
27632803
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
27642804
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2765
-#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
2805
+#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
2806
+#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2807
+#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
27662808
27672809
/*
27682810
** CAPI3REF: Enable Or Disable Extended Result Codes
27692811
** METHOD: sqlite3
27702812
**
@@ -9868,22 +9910,32 @@
98689910
** </dd>
98699911
**
98709912
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
98719913
** <dd>Calls of the form
98729914
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9873
-** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
9915
+** the [xConnect] or [xCreate] methods of a [virtual table] implementation
98749916
** identify that virtual table as being safe to use from within triggers
98759917
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
98769918
** virtual table can do no serious harm even if it is controlled by a
98779919
** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
98789920
** flag unless absolutely necessary.
98799921
** </dd>
9922
+**
9923
+** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt>
9924
+** <dd>Calls of the form
9925
+** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
9926
+** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9927
+** instruct the query planner to begin at least a read transaction on
9928
+** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the
9929
+** virtual table is used.
9930
+** </dd>
98809931
** </dl>
98819932
*/
98829933
#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
98839934
#define SQLITE_VTAB_INNOCUOUS 2
98849935
#define SQLITE_VTAB_DIRECTONLY 3
9936
+#define SQLITE_VTAB_USES_ALL_SCHEMAS 4
98859937
98869938
/*
98879939
** CAPI3REF: Determine The Virtual Table Conflict Policy
98889940
**
98899941
** This function may only be called from within a call to the [xUpdate] method
@@ -12217,13 +12269,27 @@
1221712269
**
1221812270
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
1221912271
** Invert the changeset before applying it. This is equivalent to inverting
1222012272
** a changeset using sqlite3changeset_invert() before applying it. It is
1222112273
** an error to specify this flag with a patchset.
12274
+**
12275
+** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
12276
+** Do not invoke the conflict handler callback for any changes that
12277
+** would not actually modify the database even if they were applied.
12278
+** Specifically, this means that the conflict handler is not invoked
12279
+** for:
12280
+** <ul>
12281
+** <li>a delete change if the row being deleted cannot be found,
12282
+** <li>an update change if the modified fields are already set to
12283
+** their new values in the conflicting row, or
12284
+** <li>an insert change if all fields of the conflicting row match
12285
+** the row being inserted.
12286
+** </ul>
1222212287
*/
1222312288
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
1222412289
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
12290
+#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
1222512291
1222612292
/*
1222712293
** CAPI3REF: Constants Passed To The Conflict Handler
1222812294
**
1222912295
** Values that may be passed as the second argument to a conflict-handler.
@@ -13516,12 +13582,12 @@
1351613582
#pragma warn -csu /* Comparing signed and unsigned */
1351713583
#pragma warn -spa /* Suspicious pointer arithmetic */
1351813584
#endif
1351913585
1352013586
/*
13521
-** WAL mode depends on atomic aligned 32-bit loads and stores in a few
13522
-** places. The following macros try to make this explicit.
13587
+** A few places in the code require atomic load/store of aligned
13588
+** integer values.
1352313589
*/
1352413590
#ifndef __has_extension
1352513591
# define __has_extension(x) 0 /* compatibility with non-clang compilers */
1352613592
#endif
1352713593
#if GCC_VERSION>=4007000 || __has_extension(c_atomic)
@@ -13573,19 +13639,26 @@
1357313639
# define SQLITE_INT_TO_PTR(X) ((void*)(X))
1357413640
# define SQLITE_PTR_TO_INT(X) ((int)(X))
1357513641
#endif
1357613642
1357713643
/*
13578
-** A macro to hint to the compiler that a function should not be
13644
+** Macros to hint to the compiler that a function should or should not be
1357913645
** inlined.
1358013646
*/
1358113647
#if defined(__GNUC__)
1358213648
# define SQLITE_NOINLINE __attribute__((noinline))
13649
+# define SQLITE_INLINE __attribute__((always_inline)) inline
1358313650
#elif defined(_MSC_VER) && _MSC_VER>=1310
1358413651
# define SQLITE_NOINLINE __declspec(noinline)
13652
+# define SQLITE_INLINE __forceinline
1358513653
#else
1358613654
# define SQLITE_NOINLINE
13655
+# define SQLITE_INLINE
13656
+#endif
13657
+#if defined(SQLITE_COVERAGE_TEST)
13658
+# undef SQLITE_INLINE
13659
+# define SQLITE_INLINE
1358713660
#endif
1358813661
1358913662
/*
1359013663
** Make sure that the compiler intrinsics we desire are enabled when
1359113664
** compiling with an appropriate version of MSVC unless prevented by
@@ -16541,10 +16614,14 @@
1654116614
#endif
1654216615
1654316616
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
1654416617
SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*);
1654516618
#endif
16619
+
16620
+#if defined(SQLITE_ENABLE_CURSOR_HINTS) && defined(SQLITE_DEBUG)
16621
+SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr);
16622
+#endif
1654616623
1654716624
#endif /* SQLITE_VDBE_H */
1654816625
1654916626
/************** End of vdbe.h ************************************************/
1655016627
/************** Continuing where we left off in sqliteInt.h ******************/
@@ -16590,11 +16667,11 @@
1659016667
/**********************************************************************
1659116668
** Elements above, except pCache, are public. All that follow are
1659216669
** private to pcache.c and should not be accessed by other modules.
1659316670
** pCache is grouped with the public elements for efficiency.
1659416671
*/
16595
- i16 nRef; /* Number of users of this page */
16672
+ i64 nRef; /* Number of users of this page */
1659616673
PgHdr *pDirtyNext; /* Next element in list of dirty pages */
1659716674
PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
1659816675
/* NB: pDirtyNext and pDirtyPrev are undefined if the
1659916676
** PgHdr object is not dirty */
1660016677
};
@@ -16671,16 +16748,16 @@
1667116748
1667216749
/* Discard the contents of the cache */
1667316750
SQLITE_PRIVATE void sqlite3PcacheClear(PCache*);
1667416751
1667516752
/* Return the total number of outstanding page references */
16676
-SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*);
16753
+SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache*);
1667716754
1667816755
/* Increment the reference count of an existing page */
1667916756
SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);
1668016757
16681
-SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*);
16758
+SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr*);
1668216759
1668316760
/* Return the total number of pages stored in the cache */
1668416761
SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);
1668516762
1668616763
#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
@@ -17251,11 +17328,11 @@
1725117328
#define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
1725217329
** vtabs in the schema definition */
1725317330
#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
1725417331
/* result set is empty */
1725517332
#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
17256
-#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */
17333
+#define SQLITE_StmtScanStatus 0x00000400 /* Enable stmt_scanstats() counters */
1725717334
#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
1725817335
#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
1725917336
#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
1726017337
#define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
1726117338
#define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
@@ -17277,10 +17354,11 @@
1727717354
#define SQLITE_EnableView 0x80000000 /* Enable the use of views */
1727817355
#define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
1727917356
/* DELETE, or UPDATE and return */
1728017357
/* the count using a callback. */
1728117358
#define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
17359
+#define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
1728217360
1728317361
/* Flags used only if debugging */
1728417362
#ifdef SQLITE_DEBUG
1728517363
#define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
1728617364
#define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -17333,10 +17411,11 @@
1733317411
#define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */
1733417412
#define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
1733517413
/* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
1733617414
#define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
1733717415
#define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
17416
+#define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */
1733817417
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
1733917418
1734017419
/*
1734117420
** Macros for testing whether or not optimizations are enabled or disabled.
1734217421
*/
@@ -17804,10 +17883,11 @@
1780417883
sqlite3 *db; /* Database connection associated with this table */
1780517884
Module *pMod; /* Pointer to module implementation */
1780617885
sqlite3_vtab *pVtab; /* Pointer to vtab instance */
1780717886
int nRef; /* Number of pointers to this structure */
1780817887
u8 bConstraint; /* True if constraints are supported */
17888
+ u8 bAllSchemas; /* True if might use any attached schema */
1780917889
u8 eVtabRisk; /* Riskiness of allowing hacker access */
1781017890
int iSavepoint; /* Depth of the SAVEPOINT stack */
1781117891
VTable *pNext; /* Next in linked list (see above) */
1781217892
};
1781317893
@@ -18835,11 +18915,11 @@
1883518915
#define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */
1883618916
#define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */
1883718917
#define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
1883818918
#define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
1883918919
#define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
18840
-#define NC_VarSelect 0x000040 /* A correlated subquery has been seen */
18920
+#define NC_Subquery 0x000040 /* A subquery has been seen */
1884118921
#define NC_UEList 0x000080 /* True if uNC.pEList is used */
1884218922
#define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
1884318923
#define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
1884418924
#define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */
1884518925
#define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */
@@ -19207,10 +19287,13 @@
1920719287
u8 prepFlags; /* SQLITE_PREPARE_* flags */
1920819288
u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
1920919289
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
1921019290
u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
1921119291
#endif
19292
+#ifdef SQLITE_DEBUG
19293
+ u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
19294
+#endif
1921219295
int nRangeReg; /* Size of the temporary register block */
1921319296
int iRangeReg; /* First register in temporary register block */
1921419297
int nErr; /* Number of errors seen */
1921519298
int nTab; /* Number of previously allocated VDBE cursors */
1921619299
int nMem; /* Number of memory cells used so far */
@@ -19667,10 +19750,11 @@
1966719750
struct RenameCtx *pRename; /* RENAME COLUMN context */
1966819751
struct Table *pTab; /* Table of generated column */
1966919752
struct CoveringIndexCheck *pCovIdxCk; /* Check for covering index */
1967019753
SrcItem *pSrcItem; /* A single FROM clause item */
1967119754
DbFixer *pFix; /* See sqlite3FixSelect() */
19755
+ Mem *aMem; /* See sqlite3BtreeCursorHint() */
1967219756
} u;
1967319757
};
1967419758
1967519759
/*
1967619760
** The following structure contains information used by the sqliteFix...
@@ -20138,10 +20222,14 @@
2013820222
SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
2013920223
SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
2014020224
SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
2014120225
SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
2014220226
SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
20227
+SQLITE_PRIVATE void sqlite3TouchRegister(Parse*,int);
20228
+#if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
20229
+SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse*,int);
20230
+#endif
2014320231
#ifdef SQLITE_DEBUG
2014420232
SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
2014520233
#endif
2014620234
SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
2014720235
SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20288,11 +20376,11 @@
2028820376
SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
2028920377
SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
2029020378
Expr*,ExprList*,u32,Expr*);
2029120379
SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
2029220380
SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20293
-SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
20381
+SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*);
2029420382
SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
2029520383
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
2029620384
SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
2029720385
#endif
2029820386
SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -20825,14 +20913,11 @@
2082520913
SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
2082620914
SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
2082720915
SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *);
2082820916
2082920917
SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20830
-#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
20831
- && !defined(SQLITE_OMIT_VIRTUALTABLE)
20832
-SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info*);
20833
-#endif
20918
+SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse*);
2083420919
SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
2083520920
SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
2083620921
SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
2083720922
SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*);
2083820923
SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*);
@@ -21074,10 +21159,16 @@
2107421159
#if defined(VDBE_PROFILE) \
2107521160
|| defined(SQLITE_PERFORMANCE_TRACE) \
2107621161
|| defined(SQLITE_ENABLE_STMT_SCANSTATUS)
2107721162
SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
2107821163
#endif
21164
+
21165
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
21166
+# define IS_STMT_SCANSTATUS(db) (db->flags & SQLITE_StmtScanStatus)
21167
+#else
21168
+# define IS_STMT_SCANSTATUS(db) 0
21169
+#endif
2107921170
2108021171
#endif /* SQLITEINT_H */
2108121172
2108221173
/************** End of sqliteInt.h *******************************************/
2108321174
/************** Begin file os_common.h ***************************************/
@@ -22264,11 +22355,11 @@
2226422355
0, /* xAltLocaltime */
2226522356
0x7ffffffe, /* iOnceResetThreshold */
2226622357
SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
2226722358
0, /* iPrngSeed */
2226822359
#ifdef SQLITE_DEBUG
22269
- {0,0,0,0,0,0} /* aTune */
22360
+ {0,0,0,0,0,0}, /* aTune */
2227022361
#endif
2227122362
};
2227222363
2227322364
/*
2227422365
** Hash table for global functions - functions common to all
@@ -30069,10 +30160,24 @@
3006930160
*val = (*val - d)*10.0;
3007030161
return (char)digit;
3007130162
}
3007230163
#endif /* SQLITE_OMIT_FLOATING_POINT */
3007330164
30165
+#ifndef SQLITE_OMIT_FLOATING_POINT
30166
+/*
30167
+** "*val" is a u64. *msd is a divisor used to extract the
30168
+** most significant digit of *val. Extract that most significant
30169
+** digit and return it.
30170
+*/
30171
+static char et_getdigit_int(u64 *val, u64 *msd){
30172
+ u64 x = (*val)/(*msd);
30173
+ *val -= x*(*msd);
30174
+ if( *msd>=10 ) *msd /= 10;
30175
+ return '0' + (char)(x & 15);
30176
+}
30177
+#endif /* SQLITE_OMIT_FLOATING_POINT */
30178
+
3007430179
/*
3007530180
** Set the StrAccum object to an error mode.
3007630181
*/
3007730182
SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
3007830183
assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30161,10 +30266,12 @@
3016130266
etByte xtype = etINVALID; /* Conversion paradigm */
3016230267
u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
3016330268
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
3016430269
sqlite_uint64 longvalue; /* Value for integer types */
3016530270
LONGDOUBLE_TYPE realvalue; /* Value for real types */
30271
+ sqlite_uint64 msd; /* Divisor to get most-significant-digit
30272
+ ** of longvalue */
3016630273
const et_info *infop; /* Pointer to the appropriate info structure */
3016730274
char *zOut; /* Rendering buffer */
3016830275
int nOut; /* Size of the rendering buffer */
3016930276
char *zExtra = 0; /* Malloced memory used by some conversion */
3017030277
#ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30467,56 +30574,82 @@
3046730574
realvalue = -realvalue;
3046830575
prefix = '-';
3046930576
}else{
3047030577
prefix = flag_prefix;
3047130578
}
30579
+ exp = 0;
3047230580
if( xtype==etGENERIC && precision>0 ) precision--;
3047330581
testcase( precision>0xfff );
30474
- idx = precision & 0xfff;
30475
- rounder = arRound[idx%10];
30476
- while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30477
- if( xtype==etFLOAT ){
30478
- double rx = (double)realvalue;
30479
- sqlite3_uint64 u;
30480
- int ex;
30481
- memcpy(&u, &rx, sizeof(u));
30482
- ex = -1023 + (int)((u>>52)&0x7ff);
30483
- if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30484
- realvalue += rounder;
30485
- }
30486
- /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30487
- exp = 0;
30488
- if( sqlite3IsNaN((double)realvalue) ){
30489
- bufpt = "NaN";
30490
- length = 3;
30491
- break;
30492
- }
30493
- if( realvalue>0.0 ){
30494
- LONGDOUBLE_TYPE scale = 1.0;
30495
- while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
30496
- while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
30497
- while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30498
- realvalue /= scale;
30499
- while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30500
- while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30501
- if( exp>350 ){
30502
- bufpt = buf;
30503
- buf[0] = prefix;
30504
- memcpy(buf+(prefix!=0),"Inf",4);
30505
- length = 3+(prefix!=0);
30506
- break;
30507
- }
30508
- }
30509
- bufpt = buf;
30582
+ if( realvalue<1.0e+16
30583
+ && realvalue==(LONGDOUBLE_TYPE)(longvalue = (u64)realvalue)
30584
+ ){
30585
+ /* Number is a pure integer that can be represented as u64 */
30586
+ for(msd=1; msd*10<=longvalue; msd *= 10, exp++){}
30587
+ if( exp>precision && xtype!=etFLOAT ){
30588
+ u64 rnd = msd/2;
30589
+ int kk = precision;
30590
+ while( kk-- > 0 ){ rnd /= 10; }
30591
+ longvalue += rnd;
30592
+ }
30593
+ }else{
30594
+ msd = 0;
30595
+ longvalue = 0; /* To prevent a compiler warning */
30596
+ idx = precision & 0xfff;
30597
+ rounder = arRound[idx%10];
30598
+ while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30599
+ if( xtype==etFLOAT ){
30600
+ double rx = (double)realvalue;
30601
+ sqlite3_uint64 u;
30602
+ int ex;
30603
+ memcpy(&u, &rx, sizeof(u));
30604
+ ex = -1023 + (int)((u>>52)&0x7ff);
30605
+ if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30606
+ realvalue += rounder;
30607
+ }
30608
+ if( sqlite3IsNaN((double)realvalue) ){
30609
+ if( flag_zeropad ){
30610
+ bufpt = "null";
30611
+ length = 4;
30612
+ }else{
30613
+ bufpt = "NaN";
30614
+ length = 3;
30615
+ }
30616
+ break;
30617
+ }
30618
+
30619
+ /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30620
+ if( ALWAYS(realvalue>0.0) ){
30621
+ LONGDOUBLE_TYPE scale = 1.0;
30622
+ while( realvalue>=1e100*scale && exp<=350){ scale*=1e100;exp+=100;}
30623
+ while( realvalue>=1e10*scale && exp<=350 ){ scale*=1e10; exp+=10; }
30624
+ while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30625
+ realvalue /= scale;
30626
+ while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30627
+ while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30628
+ if( exp>350 ){
30629
+ if( flag_zeropad ){
30630
+ realvalue = 9.0;
30631
+ exp = 999;
30632
+ }else{
30633
+ bufpt = buf;
30634
+ buf[0] = prefix;
30635
+ memcpy(buf+(prefix!=0),"Inf",4);
30636
+ length = 3+(prefix!=0);
30637
+ break;
30638
+ }
30639
+ }
30640
+ if( xtype!=etFLOAT ){
30641
+ realvalue += rounder;
30642
+ if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30643
+ }
30644
+ }
30645
+ }
30646
+
3051030647
/*
3051130648
** If the field type is etGENERIC, then convert to either etEXP
3051230649
** or etFLOAT, as appropriate.
3051330650
*/
30514
- if( xtype!=etFLOAT ){
30515
- realvalue += rounder;
30516
- if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30517
- }
3051830651
if( xtype==etGENERIC ){
3051930652
flag_rtz = !flag_alternateform;
3052030653
if( exp<-4 || exp>precision ){
3052130654
xtype = etEXP;
3052230655
}else{
@@ -30529,28 +30662,33 @@
3052930662
if( xtype==etEXP ){
3053030663
e2 = 0;
3053130664
}else{
3053230665
e2 = exp;
3053330666
}
30667
+ nsd = 16 + flag_altform2*10;
30668
+ bufpt = buf;
3053430669
{
3053530670
i64 szBufNeeded; /* Size of a temporary buffer needed */
3053630671
szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
3053730672
if( szBufNeeded > etBUFSIZE ){
3053830673
bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
3053930674
if( bufpt==0 ) return;
3054030675
}
3054130676
}
3054230677
zOut = bufpt;
30543
- nsd = 16 + flag_altform2*10;
3054430678
flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
3054530679
/* The sign in front of the number */
3054630680
if( prefix ){
3054730681
*(bufpt++) = prefix;
3054830682
}
3054930683
/* Digits prior to the decimal point */
3055030684
if( e2<0 ){
3055130685
*(bufpt++) = '0';
30686
+ }else if( msd>0 ){
30687
+ for(; e2>=0; e2--){
30688
+ *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30689
+ }
3055230690
}else{
3055330691
for(; e2>=0; e2--){
3055430692
*(bufpt++) = et_getdigit(&realvalue,&nsd);
3055530693
}
3055630694
}
@@ -30563,12 +30701,18 @@
3056330701
for(e2++; e2<0; precision--, e2++){
3056430702
assert( precision>0 );
3056530703
*(bufpt++) = '0';
3056630704
}
3056730705
/* Significant digits after the decimal point */
30568
- while( (precision--)>0 ){
30569
- *(bufpt++) = et_getdigit(&realvalue,&nsd);
30706
+ if( msd>0 ){
30707
+ while( (precision--)>0 ){
30708
+ *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30709
+ }
30710
+ }else{
30711
+ while( (precision--)>0 ){
30712
+ *(bufpt++) = et_getdigit(&realvalue,&nsd);
30713
+ }
3057030714
}
3057130715
/* Remove trailing zeros and the "." if no digits follow the "." */
3057230716
if( flag_rtz && flag_dp ){
3057330717
while( bufpt[-1]=='0' ) *(--bufpt) = 0;
3057430718
assert( bufpt>zOut );
@@ -31245,16 +31389,26 @@
3124531389
sqlite3_str_vappendf(&acc, zFormat, ap);
3124631390
zBuf[acc.nChar] = 0;
3124731391
return zBuf;
3124831392
}
3124931393
SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31250
- char *z;
31394
+ StrAccum acc;
3125131395
va_list ap;
31396
+ if( n<=0 ) return zBuf;
31397
+#ifdef SQLITE_ENABLE_API_ARMOR
31398
+ if( zBuf==0 || zFormat==0 ) {
31399
+ (void)SQLITE_MISUSE_BKPT;
31400
+ if( zBuf ) zBuf[0] = 0;
31401
+ return zBuf;
31402
+ }
31403
+#endif
31404
+ sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
3125231405
va_start(ap,zFormat);
31253
- z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
31406
+ sqlite3_str_vappendf(&acc, zFormat, ap);
3125431407
va_end(ap);
31255
- return z;
31408
+ zBuf[acc.nChar] = 0;
31409
+ return zBuf;
3125631410
}
3125731411
3125831412
/*
3125931413
** This is the routine that actually formats the sqlite3_log() message.
3126031414
** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52652,11 +52806,11 @@
5265252806
** pointers).
5265352807
*/
5265452808
struct PCache {
5265552809
PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
5265652810
PgHdr *pSynced; /* Last synced page in dirty page list */
52657
- int nRefSum; /* Sum of ref counts over all pages */
52811
+ i64 nRefSum; /* Sum of ref counts over all pages */
5265852812
int szCache; /* Configured cache size */
5265952813
int szSpill; /* Size before spilling occurs */
5266052814
int szPage; /* Size of every page in this cache */
5266152815
int szExtra; /* Size of extra space for each page */
5266252816
u8 bPurgeable; /* True if pages are on backing store */
@@ -52682,11 +52836,11 @@
5268252836
static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
5268352837
PgHdr *pPg;
5268452838
unsigned char *a;
5268552839
int j;
5268652840
pPg = (PgHdr*)pLower->pExtra;
52687
- printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52841
+ printf("%3lld: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
5268852842
a = (unsigned char *)pLower->pBuf;
5268952843
for(j=0; j<12; j++) printf("%02x", a[j]);
5269052844
printf(" ptr %p\n", pPg);
5269152845
}
5269252846
static void pcacheDump(PCache *pCache){
@@ -53426,18 +53580,18 @@
5342653580
** Return the total number of references to all pages held by the cache.
5342753581
**
5342853582
** This is not the total number of pages referenced, but the sum of the
5342953583
** reference count for all pages.
5343053584
*/
53431
-SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){
53585
+SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache *pCache){
5343253586
return pCache->nRefSum;
5343353587
}
5343453588
5343553589
/*
5343653590
** Return the number of references to the page supplied as an argument.
5343753591
*/
53438
-SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){
53592
+SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr *p){
5343953593
return p->nRef;
5344053594
}
5344153595
5344253596
/*
5344353597
** Return the total number of pages in the cache.
@@ -68091,12 +68245,13 @@
6809168245
int mxErr; /* Stop accumulating errors when this reaches zero */
6809268246
int nErr; /* Number of messages written to zErrMsg so far */
6809368247
int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
6809468248
u32 nStep; /* Number of steps into the integrity_check process */
6809568249
const char *zPfx; /* Error message prefix */
68096
- Pgno v1; /* Value for first %u substitution in zPfx */
68097
- int v2; /* Value for second %d substitution in zPfx */
68250
+ Pgno v0; /* Value for first %u substitution in zPfx (root page) */
68251
+ Pgno v1; /* Value for second %u substitution in zPfx (current pg) */
68252
+ int v2; /* Value for third %d substitution in zPfx */
6809868253
StrAccum errMsg; /* Accumulate the error message text here */
6809968254
u32 *heap; /* Min-heap used for analyzing cell coverage */
6810068255
sqlite3 *db; /* Database connection running the check */
6810168256
};
6810268257
@@ -68555,12 +68710,12 @@
6855568710
*/
6855668711
#ifdef SQLITE_DEBUG
6855768712
int corruptPageError(int lineno, MemPage *p){
6855868713
char *zMsg;
6855968714
sqlite3BeginBenignMalloc();
68560
- zMsg = sqlite3_mprintf("database corruption page %d of %s",
68561
- (int)p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
68715
+ zMsg = sqlite3_mprintf("database corruption page %u of %s",
68716
+ p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
6856268717
);
6856368718
sqlite3EndBenignMalloc();
6856468719
if( zMsg ){
6856568720
sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
6856668721
}
@@ -69365,12 +69520,29 @@
6936569520
** and number of the varargs parameters) is determined by the eHintType
6936669521
** parameter. See the definitions of the BTREE_HINT_* macros for details.
6936769522
*/
6936869523
SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){
6936969524
/* Used only by system that substitute their own storage engine */
69525
+#ifdef SQLITE_DEBUG
69526
+ if( ALWAYS(eHintType==BTREE_HINT_RANGE) ){
69527
+ va_list ap;
69528
+ Expr *pExpr;
69529
+ Walker w;
69530
+ memset(&w, 0, sizeof(w));
69531
+ w.xExprCallback = sqlite3CursorRangeHintExprCheck;
69532
+ va_start(ap, eHintType);
69533
+ pExpr = va_arg(ap, Expr*);
69534
+ w.u.aMem = va_arg(ap, Mem*);
69535
+ va_end(ap);
69536
+ assert( pExpr!=0 );
69537
+ assert( w.u.aMem!=0 );
69538
+ sqlite3WalkExpr(&w, pExpr);
69539
+ }
69540
+#endif /* SQLITE_DEBUG */
6937069541
}
69371
-#endif
69542
+#endif /* SQLITE_ENABLE_CURSOR_HINTS */
69543
+
6937269544
6937369545
/*
6937469546
** Provide flag hints to the cursor.
6937569547
*/
6937669548
SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){
@@ -69451,11 +69623,11 @@
6945169623
}
6945269624
assert( offset <= (int)pBt->usableSize-5 );
6945369625
pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
6945469626
6945569627
if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69456
- TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
69628
+ TRACE(("PTRMAP_UPDATE: %u->(%u,%u)\n", key, eType, parent));
6945769629
*pRC= rc = sqlite3PagerWrite(pDbPage);
6945869630
if( rc==SQLITE_OK ){
6945969631
pPtrmap[offset] = eType;
6946069632
put4byte(&pPtrmap[offset+1], parent);
6946169633
}
@@ -69650,31 +69822,35 @@
6965069822
** This routine is a high-runner.
6965169823
*/
6965269824
iKey = *pIter;
6965369825
if( iKey>=0x80 ){
6965469826
u8 x;
69655
- iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
69656
- if( x>=0x80 ){
69657
- iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
69658
- if( x>=0x80 ){
69659
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69660
- if( x>=0x80 ){
69661
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69662
- if( x>=0x80 ){
69663
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69664
- if( x>=0x80 ){
69665
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69666
- if( x>=0x80 ){
69667
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69668
- if( x>=0x80 ){
69669
- iKey = (iKey<<8) | (*++pIter);
69670
- }
69671
- }
69672
- }
69673
- }
69674
- }
69675
- }
69827
+ iKey = (iKey<<7) ^ (x = *++pIter);
69828
+ if( x>=0x80 ){
69829
+ iKey = (iKey<<7) ^ (x = *++pIter);
69830
+ if( x>=0x80 ){
69831
+ iKey = (iKey<<7) ^ 0x10204000 ^ (x = *++pIter);
69832
+ if( x>=0x80 ){
69833
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69834
+ if( x>=0x80 ){
69835
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69836
+ if( x>=0x80 ){
69837
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69838
+ if( x>=0x80 ){
69839
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69840
+ if( x>=0x80 ){
69841
+ iKey = (iKey<<8) ^ 0x8000 ^ (*++pIter);
69842
+ }
69843
+ }
69844
+ }
69845
+ }
69846
+ }
69847
+ }else{
69848
+ iKey ^= 0x204000;
69849
+ }
69850
+ }else{
69851
+ iKey ^= 0x4000;
6967669852
}
6967769853
}
6967869854
pIter++;
6967969855
6968069856
pInfo->nKey = *(i64*)&iKey;
@@ -69747,14 +69923,57 @@
6974769923
** data header and the local payload, but not any overflow page or
6974869924
** the space used by the cell pointer.
6974969925
**
6975069926
** cellSizePtrNoPayload() => table internal nodes
6975169927
** cellSizePtrTableLeaf() => table leaf nodes
69752
-** cellSizePtr() => all index nodes & table leaf nodes
69928
+** cellSizePtr() => index internal nodes
69929
+** cellSizeIdxLeaf() => index leaf nodes
6975369930
*/
6975469931
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69755
- u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
69932
+ u8 *pIter = pCell + 4; /* For looping over bytes of pCell */
69933
+ u8 *pEnd; /* End mark for a varint */
69934
+ u32 nSize; /* Size value to return */
69935
+
69936
+#ifdef SQLITE_DEBUG
69937
+ /* The value returned by this function should always be the same as
69938
+ ** the (CellInfo.nSize) value found by doing a full parse of the
69939
+ ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
69940
+ ** this function verifies that this invariant is not violated. */
69941
+ CellInfo debuginfo;
69942
+ pPage->xParseCell(pPage, pCell, &debuginfo);
69943
+#endif
69944
+
69945
+ assert( pPage->childPtrSize==4 );
69946
+ nSize = *pIter;
69947
+ if( nSize>=0x80 ){
69948
+ pEnd = &pIter[8];
69949
+ nSize &= 0x7f;
69950
+ do{
69951
+ nSize = (nSize<<7) | (*++pIter & 0x7f);
69952
+ }while( *(pIter)>=0x80 && pIter<pEnd );
69953
+ }
69954
+ pIter++;
69955
+ testcase( nSize==pPage->maxLocal );
69956
+ testcase( nSize==(u32)pPage->maxLocal+1 );
69957
+ if( nSize<=pPage->maxLocal ){
69958
+ nSize += (u32)(pIter - pCell);
69959
+ assert( nSize>4 );
69960
+ }else{
69961
+ int minLocal = pPage->minLocal;
69962
+ nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
69963
+ testcase( nSize==pPage->maxLocal );
69964
+ testcase( nSize==(u32)pPage->maxLocal+1 );
69965
+ if( nSize>pPage->maxLocal ){
69966
+ nSize = minLocal;
69967
+ }
69968
+ nSize += 4 + (u16)(pIter - pCell);
69969
+ }
69970
+ assert( nSize==debuginfo.nSize || CORRUPT_DB );
69971
+ return (u16)nSize;
69972
+}
69973
+static u16 cellSizePtrIdxLeaf(MemPage *pPage, u8 *pCell){
69974
+ u8 *pIter = pCell; /* For looping over bytes of pCell */
6975669975
u8 *pEnd; /* End mark for a varint */
6975769976
u32 nSize; /* Size value to return */
6975869977
6975969978
#ifdef SQLITE_DEBUG
6976069979
/* The value returned by this function should always be the same as
@@ -69763,10 +69982,11 @@
6976369982
** this function verifies that this invariant is not violated. */
6976469983
CellInfo debuginfo;
6976569984
pPage->xParseCell(pPage, pCell, &debuginfo);
6976669985
#endif
6976769986
69987
+ assert( pPage->childPtrSize==0 );
6976869988
nSize = *pIter;
6976969989
if( nSize>=0x80 ){
6977069990
pEnd = &pIter[8];
6977169991
nSize &= 0x7f;
6977269992
do{
@@ -69999,14 +70219,14 @@
6999970219
testcase( pc==iCellFirst );
7000070220
testcase( pc==iCellLast );
7000170221
/* These conditions have already been verified in btreeInitPage()
7000270222
** if PRAGMA cell_size_check=ON.
7000370223
*/
70004
- if( pc<iCellStart || pc>iCellLast ){
70224
+ if( pc>iCellLast ){
7000570225
return SQLITE_CORRUPT_PAGE(pPage);
7000670226
}
70007
- assert( pc>=iCellStart && pc<=iCellLast );
70227
+ assert( pc>=0 && pc<=iCellLast );
7000870228
size = pPage->xCellSize(pPage, &src[pc]);
7000970229
cbrk -= size;
7001070230
if( cbrk<iCellStart || pc+size>usableSize ){
7001170231
return SQLITE_CORRUPT_PAGE(pPage);
7001270232
}
@@ -70117,11 +70337,11 @@
7011770337
** all the space together, however. This routine will avoid using
7011870338
** the first two bytes past the cell pointer area since presumably this
7011970339
** allocation is being made in order to insert a new cell, so we will
7012070340
** also end up needing a new cell pointer.
7012170341
*/
70122
-static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
70342
+static SQLITE_INLINE int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
7012370343
const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
7012470344
u8 * const data = pPage->aData; /* Local cache of pPage->aData */
7012570345
int top; /* First byte of cell content area */
7012670346
int rc = SQLITE_OK; /* Integer return code */
7012770347
u8 *pTmp; /* Temp ptr into data[] */
@@ -70143,17 +70363,18 @@
7014370363
** then the cell content offset of an empty page wants to be 65536.
7014470364
** However, that integer is too large to be stored in a 2-byte unsigned
7014570365
** integer, so a value of 0 is used in its place. */
7014670366
pTmp = &data[hdr+5];
7014770367
top = get2byte(pTmp);
70148
- assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */
7014970368
if( gap>top ){
7015070369
if( top==0 && pPage->pBt->usableSize==65536 ){
7015170370
top = 65536;
7015270371
}else{
7015370372
return SQLITE_CORRUPT_PAGE(pPage);
7015470373
}
70374
+ }else if( top>(int)pPage->pBt->usableSize ){
70375
+ return SQLITE_CORRUPT_PAGE(pPage);
7015570376
}
7015670377
7015770378
/* If there is enough space between gap and top for one more cell pointer,
7015870379
** and if the freelist is not empty, then search the
7015970380
** freelist looking for a slot big enough to satisfy the request.
@@ -70232,11 +70453,11 @@
7023270453
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
7023370454
assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
7023470455
assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
7023570456
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
7023670457
assert( iSize>=4 ); /* Minimum cell size is 4 */
70237
- assert( iStart<=pPage->pBt->usableSize-4 );
70458
+ assert( CORRUPT_DB || iStart<=pPage->pBt->usableSize-4 );
7023870459
7023970460
/* The list of freeblocks must be in ascending order. Find the
7024070461
** spot on the list where iStart should be inserted.
7024170462
*/
7024270463
hdr = pPage->hdrOffset;
@@ -70289,10 +70510,15 @@
7028970510
if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
7029070511
data[hdr+7] -= nFrag;
7029170512
}
7029270513
pTmp = &data[hdr+5];
7029370514
x = get2byte(pTmp);
70515
+ if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
70516
+ /* Overwrite deleted information with zeros when the secure_delete
70517
+ ** option is enabled */
70518
+ memset(&data[iStart], 0, iSize);
70519
+ }
7029470520
if( iStart<=x ){
7029570521
/* The new freeblock is at the beginning of the cell content area,
7029670522
** so just extend the cell content area rather than create another
7029770523
** freelist entry */
7029870524
if( iStart<x ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -70300,18 +70526,13 @@
7030070526
put2byte(&data[hdr+1], iFreeBlk);
7030170527
put2byte(&data[hdr+5], iEnd);
7030270528
}else{
7030370529
/* Insert the new freeblock into the freelist */
7030470530
put2byte(&data[iPtr], iStart);
70305
- }
70306
- if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
70307
- /* Overwrite deleted information with zeros when the secure_delete
70308
- ** option is enabled */
70309
- memset(&data[iStart], 0, iSize);
70310
- }
70311
- put2byte(&data[iStart], iFreeBlk);
70312
- put2byte(&data[iStart+2], iSize);
70531
+ put2byte(&data[iStart], iFreeBlk);
70532
+ put2byte(&data[iStart+2], iSize);
70533
+ }
7031370534
pPage->nFree += iOrigSize;
7031470535
return SQLITE_OK;
7031570536
}
7031670537
7031770538
/*
@@ -70344,18 +70565,18 @@
7034470565
pPage->maxLocal = pBt->maxLeaf;
7034570566
pPage->minLocal = pBt->minLeaf;
7034670567
}else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
7034770568
pPage->intKey = 0;
7034870569
pPage->intKeyLeaf = 0;
70349
- pPage->xCellSize = cellSizePtr;
70570
+ pPage->xCellSize = cellSizePtrIdxLeaf;
7035070571
pPage->xParseCell = btreeParseCellPtrIndex;
7035170572
pPage->maxLocal = pBt->maxLocal;
7035270573
pPage->minLocal = pBt->minLocal;
7035370574
}else{
7035470575
pPage->intKey = 0;
7035570576
pPage->intKeyLeaf = 0;
70356
- pPage->xCellSize = cellSizePtr;
70577
+ pPage->xCellSize = cellSizePtrIdxLeaf;
7035770578
pPage->xParseCell = btreeParseCellPtrIndex;
7035870579
return SQLITE_CORRUPT_PAGE(pPage);
7035970580
}
7036070581
}else{
7036170582
pPage->childPtrSize = 4;
@@ -72217,11 +72438,11 @@
7221772438
assert( sqlite3_mutex_held(pBt->mutex) );
7221872439
assert( pDbPage->pBt==pBt );
7221972440
if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
7222072441
7222172442
/* Move page iDbPage from its current location to page number iFreePage */
72222
- TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n",
72443
+ TRACE(("AUTOVACUUM: Moving %u to free page %u (ptr page %u type %u)\n",
7222372444
iDbPage, iFreePage, iPtrPage, eType));
7222472445
rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
7222572446
if( rc!=SQLITE_OK ){
7222672447
return rc;
7222772448
}
@@ -74503,11 +74724,12 @@
7450374724
}
7450474725
}
7450574726
7450674727
pPage = pCur->pPage;
7450774728
idx = ++pCur->ix;
74508
- if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){
74729
+ if( sqlite3FaultSim(412) ) pPage->isInit = 0;
74730
+ if( !pPage->isInit ){
7450974731
return SQLITE_CORRUPT_BKPT;
7451074732
}
7451174733
7451274734
if( idx>=pPage->nCell ){
7451374735
if( !pPage->leaf ){
@@ -74766,11 +74988,11 @@
7476674988
}
7476774989
*pPgno = iTrunk;
7476874990
memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
7476974991
*ppPage = pTrunk;
7477074992
pTrunk = 0;
74771
- TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74993
+ TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
7477274994
}else if( k>(u32)(pBt->usableSize/4 - 2) ){
7477374995
/* Value of k is out of range. Database corruption */
7477474996
rc = SQLITE_CORRUPT_PGNO(iTrunk);
7477574997
goto end_allocate_page;
7477674998
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74832,11 +75054,11 @@
7483275054
}
7483375055
put4byte(&pPrevTrunk->aData[0], iNewTrunk);
7483475056
}
7483575057
}
7483675058
pTrunk = 0;
74837
- TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
75059
+ TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
7483875060
#endif
7483975061
}else if( k>0 ){
7484075062
/* Extract a leaf from the trunk */
7484175063
u32 closest;
7484275064
Pgno iPage;
@@ -74877,12 +75099,12 @@
7487775099
if( !searchList
7487875100
|| (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
7487975101
){
7488075102
int noContent;
7488175103
*pPgno = iPage;
74882
- TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
74883
- ": %d more free pages\n",
75104
+ TRACE(("ALLOCATE: %u was leaf %u of %u on trunk %u"
75105
+ ": %u more free pages\n",
7488475106
*pPgno, closest+1, k, pTrunk->pgno, n-1));
7488575107
rc = sqlite3PagerWrite(pTrunk->pDbPage);
7488675108
if( rc ) goto end_allocate_page;
7488775109
if( closest<k-1 ){
7488875110
memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74934,11 +75156,11 @@
7493475156
/* If *pPgno refers to a pointer-map page, allocate two new pages
7493575157
** at the end of the file instead of one. The first allocated page
7493675158
** becomes a new pointer-map page, the second is used by the caller.
7493775159
*/
7493875160
MemPage *pPg = 0;
74939
- TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
75161
+ TRACE(("ALLOCATE: %u from end of file (pointer-map page)\n", pBt->nPage));
7494075162
assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
7494175163
rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
7494275164
if( rc==SQLITE_OK ){
7494375165
rc = sqlite3PagerWrite(pPg->pDbPage);
7494475166
releasePage(pPg);
@@ -74957,11 +75179,11 @@
7495775179
rc = sqlite3PagerWrite((*ppPage)->pDbPage);
7495875180
if( rc!=SQLITE_OK ){
7495975181
releasePage(*ppPage);
7496075182
*ppPage = 0;
7496175183
}
74962
- TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
75184
+ TRACE(("ALLOCATE: %u from end of file\n", *pPgno));
7496375185
}
7496475186
7496575187
assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
7496675188
7496775189
end_allocate_page:
@@ -75085,11 +75307,11 @@
7508575307
if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
7508675308
sqlite3PagerDontWrite(pPage->pDbPage);
7508775309
}
7508875310
rc = btreeSetHasContent(pBt, iPage);
7508975311
}
75090
- TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
75312
+ TRACE(("FREE-PAGE: %u leaf on trunk page %u\n",pPage->pgno,pTrunk->pgno));
7509175313
goto freepage_out;
7509275314
}
7509375315
}
7509475316
7509575317
/* If control flows to this point, then it was not possible to add the
@@ -75106,11 +75328,11 @@
7510675328
goto freepage_out;
7510775329
}
7510875330
put4byte(pPage->aData, iTrunk);
7510975331
put4byte(&pPage->aData[4], 0);
7511075332
put4byte(&pPage1->aData[32], iPage);
75111
- TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk));
75333
+ TRACE(("FREE-PAGE: %u new trunk page replacing %u\n", pPage->pgno, iTrunk));
7511275334
7511375335
freepage_out:
7511475336
if( pPage ){
7511575337
pPage->isInit = 0;
7511675338
}
@@ -75465,10 +75687,18 @@
7546575687
** pTemp is not null. Regardless of pTemp, allocate a new entry
7546675688
** in pPage->apOvfl[] and make it point to the cell content (either
7546775689
** in pTemp or the original pCell) and also record its index.
7546875690
** Allocating a new entry in pPage->aCell[] implies that
7546975691
** pPage->nOverflow is incremented.
75692
+**
75693
+** The insertCellFast() routine below works exactly the same as
75694
+** insertCell() except that it lacks the pTemp and iChild parameters
75695
+** which are assumed zero. Other than that, the two routines are the
75696
+** same.
75697
+**
75698
+** Fixes or enhancements to this routine should be reflected in
75699
+** insertCellFast()!
7547075700
*/
7547175701
static int insertCell(
7547275702
MemPage *pPage, /* Page into which we are copying */
7547375703
int i, /* New cell becomes the i-th cell of the page */
7547475704
u8 *pCell, /* Content of the new cell */
@@ -75487,18 +75717,107 @@
7548775717
assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
7548875718
assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
7548975719
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
7549075720
assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
7549175721
assert( pPage->nFree>=0 );
75722
+ assert( iChild>0 );
7549275723
if( pPage->nOverflow || sz+2>pPage->nFree ){
7549375724
if( pTemp ){
7549475725
memcpy(pTemp, pCell, sz);
7549575726
pCell = pTemp;
7549675727
}
75497
- if( iChild ){
75498
- put4byte(pCell, iChild);
75728
+ put4byte(pCell, iChild);
75729
+ j = pPage->nOverflow++;
75730
+ /* Comparison against ArraySize-1 since we hold back one extra slot
75731
+ ** as a contingency. In other words, never need more than 3 overflow
75732
+ ** slots but 4 are allocated, just to be safe. */
75733
+ assert( j < ArraySize(pPage->apOvfl)-1 );
75734
+ pPage->apOvfl[j] = pCell;
75735
+ pPage->aiOvfl[j] = (u16)i;
75736
+
75737
+ /* When multiple overflows occur, they are always sequential and in
75738
+ ** sorted order. This invariants arise because multiple overflows can
75739
+ ** only occur when inserting divider cells into the parent page during
75740
+ ** balancing, and the dividers are adjacent and sorted.
75741
+ */
75742
+ assert( j==0 || pPage->aiOvfl[j-1]<(u16)i ); /* Overflows in sorted order */
75743
+ assert( j==0 || i==pPage->aiOvfl[j-1]+1 ); /* Overflows are sequential */
75744
+ }else{
75745
+ int rc = sqlite3PagerWrite(pPage->pDbPage);
75746
+ if( NEVER(rc!=SQLITE_OK) ){
75747
+ return rc;
7549975748
}
75749
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
75750
+ data = pPage->aData;
75751
+ assert( &data[pPage->cellOffset]==pPage->aCellIdx );
75752
+ rc = allocateSpace(pPage, sz, &idx);
75753
+ if( rc ){ return rc; }
75754
+ /* The allocateSpace() routine guarantees the following properties
75755
+ ** if it returns successfully */
75756
+ assert( idx >= 0 );
75757
+ assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
75758
+ assert( idx+sz <= (int)pPage->pBt->usableSize );
75759
+ pPage->nFree -= (u16)(2 + sz);
75760
+ /* In a corrupt database where an entry in the cell index section of
75761
+ ** a btree page has a value of 3 or less, the pCell value might point
75762
+ ** as many as 4 bytes in front of the start of the aData buffer for
75763
+ ** the source page. Make sure this does not cause problems by not
75764
+ ** reading the first 4 bytes */
75765
+ memcpy(&data[idx+4], pCell+4, sz-4);
75766
+ put4byte(&data[idx], iChild);
75767
+ pIns = pPage->aCellIdx + i*2;
75768
+ memmove(pIns+2, pIns, 2*(pPage->nCell - i));
75769
+ put2byte(pIns, idx);
75770
+ pPage->nCell++;
75771
+ /* increment the cell count */
75772
+ if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
75773
+ assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB );
75774
+#ifndef SQLITE_OMIT_AUTOVACUUM
75775
+ if( pPage->pBt->autoVacuum ){
75776
+ int rc2 = SQLITE_OK;
75777
+ /* The cell may contain a pointer to an overflow page. If so, write
75778
+ ** the entry for the overflow page into the pointer map.
75779
+ */
75780
+ ptrmapPutOvflPtr(pPage, pPage, pCell, &rc2);
75781
+ if( rc2 ) return rc2;
75782
+ }
75783
+#endif
75784
+ }
75785
+ return SQLITE_OK;
75786
+}
75787
+
75788
+/*
75789
+** This variant of insertCell() assumes that the pTemp and iChild
75790
+** parameters are both zero. Use this variant in sqlite3BtreeInsert()
75791
+** for performance improvement, and also so that this variant is only
75792
+** called from that one place, and is thus inlined, and thus runs must
75793
+** faster.
75794
+**
75795
+** Fixes or enhancements to this routine should be reflected into
75796
+** the insertCell() routine.
75797
+*/
75798
+static int insertCellFast(
75799
+ MemPage *pPage, /* Page into which we are copying */
75800
+ int i, /* New cell becomes the i-th cell of the page */
75801
+ u8 *pCell, /* Content of the new cell */
75802
+ int sz /* Bytes of content in pCell */
75803
+){
75804
+ int idx = 0; /* Where to write new cell content in data[] */
75805
+ int j; /* Loop counter */
75806
+ u8 *data; /* The content of the whole page */
75807
+ u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */
75808
+
75809
+ assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
75810
+ assert( MX_CELL(pPage->pBt)<=10921 );
75811
+ assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB );
75812
+ assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
75813
+ assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
75814
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
75815
+ assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
75816
+ assert( pPage->nFree>=0 );
75817
+ assert( pPage->nOverflow==0 );
75818
+ if( sz+2>pPage->nFree ){
7550075819
j = pPage->nOverflow++;
7550175820
/* Comparison against ArraySize-1 since we hold back one extra slot
7550275821
** as a contingency. In other words, never need more than 3 overflow
7550375822
** slots but 4 are allocated, just to be safe. */
7550475823
assert( j < ArraySize(pPage->apOvfl)-1 );
@@ -75526,21 +75845,11 @@
7552675845
** if it returns successfully */
7552775846
assert( idx >= 0 );
7552875847
assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
7552975848
assert( idx+sz <= (int)pPage->pBt->usableSize );
7553075849
pPage->nFree -= (u16)(2 + sz);
75531
- if( iChild ){
75532
- /* In a corrupt database where an entry in the cell index section of
75533
- ** a btree page has a value of 3 or less, the pCell value might point
75534
- ** as many as 4 bytes in front of the start of the aData buffer for
75535
- ** the source page. Make sure this does not cause problems by not
75536
- ** reading the first 4 bytes */
75537
- memcpy(&data[idx+4], pCell+4, sz-4);
75538
- put4byte(&data[idx], iChild);
75539
- }else{
75540
- memcpy(&data[idx], pCell, sz);
75541
- }
75850
+ memcpy(&data[idx], pCell, sz);
7554275851
pIns = pPage->aCellIdx + i*2;
7554375852
memmove(pIns+2, pIns, 2*(pPage->nCell - i));
7554475853
put2byte(pIns, idx);
7554575854
pPage->nCell++;
7554675855
/* increment the cell count */
@@ -75721,11 +76030,11 @@
7572176030
int k; /* Current slot in pCArray->apEnd[] */
7572276031
u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
7572376032
7572476033
assert( i<iEnd );
7572576034
j = get2byte(&aData[hdr+5]);
75726
- if( j>(u32)usableSize ){ j = 0; }
76035
+ if( NEVER(j>(u32)usableSize) ){ j = 0; }
7572776036
memcpy(&pTmp[j], &aData[j], usableSize - j);
7572876037
7572976038
for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
7573076039
pSrcEnd = pCArray->apEnd[k];
7573176040
@@ -75865,46 +76174,54 @@
7586576174
){
7586676175
u8 * const aData = pPg->aData;
7586776176
u8 * const pEnd = &aData[pPg->pBt->usableSize];
7586876177
u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
7586976178
int nRet = 0;
75870
- int i;
76179
+ int i, j;
7587176180
int iEnd = iFirst + nCell;
75872
- u8 *pFree = 0; /* \__ Parameters for pending call to */
75873
- int szFree = 0; /* / freeSpace() */
76181
+ int nFree = 0;
76182
+ int aOfst[10];
76183
+ int aAfter[10];
7587476184
7587576185
for(i=iFirst; i<iEnd; i++){
7587676186
u8 *pCell = pCArray->apCell[i];
7587776187
if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
7587876188
int sz;
76189
+ int iAfter;
76190
+ int iOfst;
7587976191
/* No need to use cachedCellSize() here. The sizes of all cells that
7588076192
** are to be freed have already been computing while deciding which
7588176193
** cells need freeing */
7588276194
sz = pCArray->szCell[i]; assert( sz>0 );
75883
- if( pFree!=(pCell + sz) ){
75884
- if( pFree ){
75885
- assert( pFree>aData && (pFree - aData)<65536 );
75886
- freeSpace(pPg, (u16)(pFree - aData), szFree);
75887
- }
75888
- pFree = pCell;
75889
- szFree = sz;
75890
- if( pFree+sz>pEnd ){
75891
- return 0;
75892
- }
75893
- }else{
75894
- /* The current cell is adjacent to and before the pFree cell.
75895
- ** Combine the two regions into one to reduce the number of calls
75896
- ** to freeSpace(). */
75897
- pFree = pCell;
75898
- szFree += sz;
76195
+ iOfst = (u16)(pCell - aData);
76196
+ iAfter = iOfst+sz;
76197
+ for(j=0; j<nFree; j++){
76198
+ if( aOfst[j]==iAfter ){
76199
+ aOfst[j] = iOfst;
76200
+ break;
76201
+ }else if( aAfter[j]==iOfst ){
76202
+ aAfter[j] = iAfter;
76203
+ break;
76204
+ }
76205
+ }
76206
+ if( j>=nFree ){
76207
+ if( nFree>=sizeof(aOfst)/sizeof(aOfst[0]) ){
76208
+ for(j=0; j<nFree; j++){
76209
+ freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]);
76210
+ }
76211
+ nFree = 0;
76212
+ }
76213
+ aOfst[nFree] = iOfst;
76214
+ aAfter[nFree] = iAfter;
76215
+ if( &aData[iAfter]>pEnd ) return 0;
76216
+ nFree++;
7589976217
}
7590076218
nRet++;
7590176219
}
7590276220
}
75903
- if( pFree ){
75904
- assert( pFree>aData && (pFree - aData)<65536 );
75905
- freeSpace(pPg, (u16)(pFree - aData), szFree);
76221
+ for(j=0; j<nFree; j++){
76222
+ freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]);
7590676223
}
7590776224
return nRet;
7590876225
}
7590976226
7591076227
/*
@@ -75955,11 +76272,11 @@
7595576272
nCell -= nTail;
7595676273
}
7595776274
7595876275
pData = &aData[get2byteNotZero(&aData[hdr+5])];
7595976276
if( pData<pBegin ) goto editpage_fail;
75960
- if( pData>pPg->aDataEnd ) goto editpage_fail;
76277
+ if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail;
7596176278
7596276279
/* Add cells to the start of the page */
7596376280
if( iNew<iOld ){
7596476281
int nAdd = MIN(nNew,iOld-iNew);
7596576282
assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -76692,11 +77009,11 @@
7669277009
** (2) pPage is a virtual root page. A virtual root page is when
7669377010
** the real root page is page 1 and we are the only child of
7669477011
** that page.
7669577012
*/
7669677013
assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
76697
- TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n",
77014
+ TRACE(("BALANCE: old: %u(nc=%u) %u(nc=%u) %u(nc=%u)\n",
7669877015
apOld[0]->pgno, apOld[0]->nCell,
7669977016
nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
7670077017
nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
7670177018
));
7670277019
@@ -76776,12 +77093,12 @@
7677677093
apNew[i]->pgno = pgnoB;
7677777094
apNew[iB]->pgno = pgnoA;
7677877095
}
7677977096
}
7678077097
76781
- TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
76782
- "%d(%d nc=%d) %d(%d nc=%d)\n",
77098
+ TRACE(("BALANCE: new: %u(%u nc=%u) %u(%u nc=%u) %u(%u nc=%u) "
77099
+ "%u(%u nc=%u) %u(%u nc=%u)\n",
7678377100
apNew[0]->pgno, szNew[0], cntNew[0],
7678477101
nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
7678577102
nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
7678677103
nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
7678777104
nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77022,11 +77339,11 @@
7702277339
ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
7702377340
}
7702477341
}
7702577342
7702677343
assert( pParent->isInit );
77027
- TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
77344
+ TRACE(("BALANCE: finished: old=%u new=%u cells=%u\n",
7702877345
nOld, nNew, b.nCell));
7702977346
7703077347
/* Free any old pages that were not reused as new pages.
7703177348
*/
7703277349
for(i=nNew; i<nOld; i++){
@@ -77107,11 +77424,11 @@
7710777424
}
7710877425
assert( sqlite3PagerIswriteable(pChild->pDbPage) );
7710977426
assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
7711077427
assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
7711177428
77112
- TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
77429
+ TRACE(("BALANCE: copy root %u into %u\n", pRoot->pgno, pChild->pgno));
7711377430
7711477431
/* Copy the overflow cells from pRoot to pChild */
7711577432
memcpy(pChild->aiOvfl, pRoot->aiOvfl,
7711677433
pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
7711777434
memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77605,11 +77922,11 @@
7760577922
rc = btreeComputeFreeSpace(pPage);
7760677923
}
7760777924
if( rc ) return rc;
7760877925
}
7760977926
77610
- TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
77927
+ TRACE(("INSERT: table=%u nkey=%lld ndata=%u page=%u %s\n",
7761177928
pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
7761277929
loc==0 ? "overwrite" : "new entry"));
7761377930
assert( pPage->isInit || CORRUPT_DB );
7761477931
newCell = p->pBt->pTmpSpace;
7761577932
assert( newCell!=0 );
@@ -77632,10 +77949,11 @@
7763277949
if( rc ) goto end_insert;
7763377950
}
7763477951
assert( szNew==pPage->xCellSize(pPage, newCell) );
7763577952
assert( szNew <= MX_CELL_SIZE(p->pBt) );
7763677953
idx = pCur->ix;
77954
+ pCur->info.nSize = 0;
7763777955
if( loc==0 ){
7763877956
CellInfo info;
7763977957
assert( idx>=0 );
7764077958
if( idx>=pPage->nCell ){
7764177959
return SQLITE_CORRUPT_BKPT;
@@ -77680,11 +77998,11 @@
7768077998
idx = ++pCur->ix;
7768177999
pCur->curFlags &= ~BTCF_ValidNKey;
7768278000
}else{
7768378001
assert( pPage->leaf );
7768478002
}
77685
- rc = insertCell(pPage, idx, newCell, szNew, 0, 0);
78003
+ rc = insertCellFast(pPage, idx, newCell, szNew);
7768678004
assert( pPage->nOverflow==0 || rc==SQLITE_OK );
7768778005
assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );
7768878006
7768978007
/* If no error has occurred and pPage has an overflow cell, call balance()
7769078008
** to redistribute the cells within the tree. Since balance() may move
@@ -77704,11 +78022,10 @@
7770478022
** the b-tree if possible. If the cursor is left pointing to the last
7770578023
** entry in the table, and the next row inserted has an integer key
7770678024
** larger than the largest existing key, it is possible to insert the
7770778025
** row without seeking the cursor. This can be a big performance boost.
7770878026
*/
77709
- pCur->info.nSize = 0;
7771078027
if( pPage->nOverflow ){
7771178028
assert( rc==SQLITE_OK );
7771278029
pCur->curFlags &= ~(BTCF_ValidNKey);
7771378030
rc = balance(pCur);
7771478031
@@ -77904,10 +78221,13 @@
7790478221
return SQLITE_CORRUPT_BKPT;
7790578222
}
7790678223
pCell = findCell(pPage, iCellIdx);
7790778224
if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
7790878225
return SQLITE_CORRUPT_BKPT;
78226
+ }
78227
+ if( pCell<&pPage->aCellIdx[pPage->nCell] ){
78228
+ return SQLITE_CORRUPT_BKPT;
7790978229
}
7791078230
7791178231
/* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
7791278232
** be preserved following this delete operation. If the current delete
7791378233
** will cause a b-tree rebalance, then this is done by saving the cursor
@@ -78653,11 +78973,12 @@
7865378973
va_start(ap, zFormat);
7865478974
if( pCheck->errMsg.nChar ){
7865578975
sqlite3_str_append(&pCheck->errMsg, "\n", 1);
7865678976
}
7865778977
if( pCheck->zPfx ){
78658
- sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2);
78978
+ sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx,
78979
+ pCheck->v0, pCheck->v1, pCheck->v2);
7865978980
}
7866078981
sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
7866178982
va_end(ap);
7866278983
if( pCheck->errMsg.accError==SQLITE_NOMEM ){
7866378984
checkOom(pCheck);
@@ -78693,15 +79014,15 @@
7869379014
**
7869479015
** Also check that the page number is in bounds.
7869579016
*/
7869679017
static int checkRef(IntegrityCk *pCheck, Pgno iPage){
7869779018
if( iPage>pCheck->nPage || iPage==0 ){
78698
- checkAppendMsg(pCheck, "invalid page number %d", iPage);
79019
+ checkAppendMsg(pCheck, "invalid page number %u", iPage);
7869979020
return 1;
7870079021
}
7870179022
if( getPageReferenced(pCheck, iPage) ){
78702
- checkAppendMsg(pCheck, "2nd reference to page %d", iPage);
79023
+ checkAppendMsg(pCheck, "2nd reference to page %u", iPage);
7870379024
return 1;
7870479025
}
7870579026
setPageReferenced(pCheck, iPage);
7870679027
return 0;
7870779028
}
@@ -78723,17 +79044,17 @@
7872379044
Pgno iPtrmapParent;
7872479045
7872579046
rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
7872679047
if( rc!=SQLITE_OK ){
7872779048
if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
78728
- checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild);
79049
+ checkAppendMsg(pCheck, "Failed to read ptrmap key=%u", iChild);
7872979050
return;
7873079051
}
7873179052
7873279053
if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
7873379054
checkAppendMsg(pCheck,
78734
- "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)",
79055
+ "Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)",
7873579056
iChild, eType, iParent, ePtrmapType, iPtrmapParent);
7873679057
}
7873779058
}
7873879059
#endif
7873979060
@@ -78754,11 +79075,11 @@
7875479075
DbPage *pOvflPage;
7875579076
unsigned char *pOvflData;
7875679077
if( checkRef(pCheck, iPage) ) break;
7875779078
N--;
7875879079
if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
78759
- checkAppendMsg(pCheck, "failed to get page %d", iPage);
79080
+ checkAppendMsg(pCheck, "failed to get page %u", iPage);
7876079081
break;
7876179082
}
7876279083
pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
7876379084
if( isFreeList ){
7876479085
u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78767,11 +79088,11 @@
7876779088
checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
7876879089
}
7876979090
#endif
7877079091
if( n>pCheck->pBt->usableSize/4-2 ){
7877179092
checkAppendMsg(pCheck,
78772
- "freelist leaf count too big on page %d", iPage);
79093
+ "freelist leaf count too big on page %u", iPage);
7877379094
N--;
7877479095
}else{
7877579096
for(i=0; i<(int)n; i++){
7877679097
Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
7877779098
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78799,11 +79120,11 @@
7879979120
iPage = get4byte(pOvflData);
7880079121
sqlite3PagerUnref(pOvflPage);
7880179122
}
7880279123
if( N && nErrAtStart==pCheck->nErr ){
7880379124
checkAppendMsg(pCheck,
78804
- "%s is %d but should be %d",
79125
+ "%s is %u but should be %u",
7880579126
isFreeList ? "size" : "overflow list length",
7880679127
expected-N, expected);
7880779128
}
7880879129
}
7880979130
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78914,12 +79235,12 @@
7891479235
if( pCheck->mxErr==0 ) goto end_of_check;
7891579236
pBt = pCheck->pBt;
7891679237
usableSize = pBt->usableSize;
7891779238
if( iPage==0 ) return 0;
7891879239
if( checkRef(pCheck, iPage) ) return 0;
78919
- pCheck->zPfx = "Page %u: ";
78920
- pCheck->v1 = iPage;
79240
+ pCheck->zPfx = "Tree %u page %u: ";
79241
+ pCheck->v0 = pCheck->v1 = iPage;
7892179242
if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
7892279243
checkAppendMsg(pCheck,
7892379244
"unable to get the page. error code=%d", rc);
7892479245
goto end_of_check;
7892579246
}
@@ -78941,11 +79262,11 @@
7894179262
}
7894279263
data = pPage->aData;
7894379264
hdr = pPage->hdrOffset;
7894479265
7894579266
/* Set up for cell analysis */
78946
- pCheck->zPfx = "On tree page %u cell %d: ";
79267
+ pCheck->zPfx = "Tree %u page %u cell %u: ";
7894779268
contentOffset = get2byteNotZero(&data[hdr+5]);
7894879269
assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
7894979270
7895079271
/* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
7895179272
** number of cells on the page. */
@@ -78961,11 +79282,11 @@
7896179282
if( !pPage->leaf ){
7896279283
/* Analyze the right-child page of internal pages */
7896379284
pgno = get4byte(&data[hdr+8]);
7896479285
#ifndef SQLITE_OMIT_AUTOVACUUM
7896579286
if( pBt->autoVacuum ){
78966
- pCheck->zPfx = "On page %u at right child: ";
79287
+ pCheck->zPfx = "Tree %u page %u right child: ";
7896779288
checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
7896879289
}
7896979290
#endif
7897079291
depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
7897179292
keyCanBeEqual = 0;
@@ -78985,11 +79306,11 @@
7898579306
pCheck->v2 = i;
7898679307
assert( pCellIdx==&data[cellStart + i*2] );
7898779308
pc = get2byteAligned(pCellIdx);
7898879309
pCellIdx -= 2;
7898979310
if( pc<contentOffset || pc>usableSize-4 ){
78990
- checkAppendMsg(pCheck, "Offset %d out of range %d..%d",
79311
+ checkAppendMsg(pCheck, "Offset %u out of range %u..%u",
7899179312
pc, contentOffset, usableSize-4);
7899279313
doCoverageCheck = 0;
7899379314
continue;
7899479315
}
7899579316
pCell = &data[pc];
@@ -79117,11 +79438,11 @@
7911779438
** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
7911879439
** number of fragmented free bytes within the cell content area.
7911979440
*/
7912079441
if( heap[0]==0 && nFrag!=data[hdr+7] ){
7912179442
checkAppendMsg(pCheck,
79122
- "Fragmentation of %d bytes reported as %d on page %u",
79443
+ "Fragmentation of %u bytes reported as %u on page %u",
7912379444
nFrag, data[hdr+7], iPage);
7912479445
}
7912579446
}
7912679447
7912779448
end_of_check:
@@ -79214,11 +79535,11 @@
7921479535
if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
7921579536
7921679537
/* Check the integrity of the freelist
7921779538
*/
7921879539
if( bCkFreelist ){
79219
- sCheck.zPfx = "Main freelist: ";
79540
+ sCheck.zPfx = "Freelist: ";
7922079541
checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
7922179542
get4byte(&pBt->pPage1->aData[36]));
7922279543
sCheck.zPfx = 0;
7922379544
}
7922479545
@@ -79231,11 +79552,11 @@
7923179552
Pgno mxInHdr;
7923279553
for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
7923379554
mxInHdr = get4byte(&pBt->pPage1->aData[52]);
7923479555
if( mx!=mxInHdr ){
7923579556
checkAppendMsg(&sCheck,
79236
- "max rootpage (%d) disagrees with header (%d)",
79557
+ "max rootpage (%u) disagrees with header (%u)",
7923779558
mx, mxInHdr
7923879559
);
7923979560
}
7924079561
}else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
7924179562
checkAppendMsg(&sCheck,
@@ -79262,23 +79583,23 @@
7926279583
*/
7926379584
if( !bPartial ){
7926479585
for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
7926579586
#ifdef SQLITE_OMIT_AUTOVACUUM
7926679587
if( getPageReferenced(&sCheck, i)==0 ){
79267
- checkAppendMsg(&sCheck, "Page %d is never used", i);
79588
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
7926879589
}
7926979590
#else
7927079591
/* If the database supports auto-vacuum, make sure no tables contain
7927179592
** references to pointer-map pages.
7927279593
*/
7927379594
if( getPageReferenced(&sCheck, i)==0 &&
7927479595
(PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79275
- checkAppendMsg(&sCheck, "Page %d is never used", i);
79596
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
7927679597
}
7927779598
if( getPageReferenced(&sCheck, i)!=0 &&
7927879599
(PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79279
- checkAppendMsg(&sCheck, "Pointer map page %d is referenced", i);
79600
+ checkAppendMsg(&sCheck, "Page %u: pointer map referenced", i);
7928079601
}
7928179602
#endif
7928279603
}
7928379604
}
7928479605
@@ -80806,11 +81127,11 @@
8080681127
return SQLITE_NOMEM_BKPT;
8080781128
}
8080881129
8080981130
vdbeMemRenderNum(nByte, pMem->z, pMem);
8081081131
assert( pMem->z!=0 );
80811
- assert( pMem->n==sqlite3Strlen30NN(pMem->z) );
81132
+ assert( pMem->n==(int)sqlite3Strlen30NN(pMem->z) );
8081281133
pMem->enc = SQLITE_UTF8;
8081381134
pMem->flags |= MEM_Str|MEM_Term;
8081481135
if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
8081581136
sqlite3VdbeChangeEncoding(pMem, enc);
8081681137
return SQLITE_OK;
@@ -81850,10 +82171,13 @@
8185082171
assert( ExprUseXList(p) );
8185182172
pList = p->x.pList;
8185282173
if( pList ) nVal = pList->nExpr;
8185382174
assert( !ExprHasProperty(p, EP_IntValue) );
8185482175
pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0);
82176
+#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
82177
+ if( pFunc==0 ) return SQLITE_OK;
82178
+#endif
8185582179
assert( pFunc );
8185682180
if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
8185782181
|| (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
8185882182
){
8185982183
return SQLITE_OK;
@@ -81886,20 +82210,15 @@
8188682210
rc = ctx.isError;
8188782211
sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
8188882212
}else{
8188982213
sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
8189082214
assert( rc==SQLITE_OK );
81891
- assert( enc==pVal->enc
81892
- || (pVal->flags & MEM_Str)==0
81893
- || db->mallocFailed );
81894
-#if 0 /* Not reachable except after a prior failure */
8189582215
rc = sqlite3VdbeChangeEncoding(pVal, enc);
81896
- if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
82216
+ if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){
8189782217
rc = SQLITE_TOOBIG;
8189882218
pCtx->pParse->nErr++;
8189982219
}
81900
-#endif
8190182220
}
8190282221
8190382222
value_from_function_out:
8190482223
if( rc!=SQLITE_OK ){
8190582224
pVal = 0;
@@ -81959,10 +82278,17 @@
8195982278
assert( !ExprHasProperty(pExpr, EP_IntValue) );
8196082279
aff = sqlite3AffinityType(pExpr->u.zToken,0);
8196182280
rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
8196282281
testcase( rc!=SQLITE_OK );
8196382282
if( *ppVal ){
82283
+#ifdef SQLITE_ENABLE_STAT4
82284
+ rc = ExpandBlob(*ppVal);
82285
+#else
82286
+ /* zero-blobs only come from functions, not literal values. And
82287
+ ** functions are only processed under STAT4 */
82288
+ assert( (ppVal[0][0].flags & MEM_Zero)==0 );
82289
+#endif
8196482290
sqlite3VdbeMemCast(*ppVal, aff, enc);
8196582291
sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
8196682292
}
8196782293
return rc;
8196882294
}
@@ -82805,14 +83131,14 @@
8280583131
** If the bPush flag is true, then make this opcode the parent for
8280683132
** subsequent Explains until sqlite3VdbeExplainPop() is called.
8280783133
*/
8280883134
SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
8280983135
int addr = 0;
82810
-#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
83136
+#if !defined(SQLITE_DEBUG)
8281183137
/* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
8281283138
** But omit them (for performance) during production builds */
82813
- if( pParse->explain==2 )
83139
+ if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
8281483140
#endif
8281583141
{
8281683142
char *zMsg;
8281783143
Vdbe *v;
8281883144
va_list ap;
@@ -83484,22 +83810,24 @@
8348483810
int addrLoop, /* Address of loop counter */
8348583811
int addrVisit, /* Address of rows visited counter */
8348683812
LogEst nEst, /* Estimated number of output rows */
8348783813
const char *zName /* Name of table or index being scanned */
8348883814
){
83489
- sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83490
- ScanStatus *aNew;
83491
- aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83492
- if( aNew ){
83493
- ScanStatus *pNew = &aNew[p->nScan++];
83494
- memset(pNew, 0, sizeof(ScanStatus));
83495
- pNew->addrExplain = addrExplain;
83496
- pNew->addrLoop = addrLoop;
83497
- pNew->addrVisit = addrVisit;
83498
- pNew->nEst = nEst;
83499
- pNew->zName = sqlite3DbStrDup(p->db, zName);
83500
- p->aScan = aNew;
83815
+ if( IS_STMT_SCANSTATUS(p->db) ){
83816
+ sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83817
+ ScanStatus *aNew;
83818
+ aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83819
+ if( aNew ){
83820
+ ScanStatus *pNew = &aNew[p->nScan++];
83821
+ memset(pNew, 0, sizeof(ScanStatus));
83822
+ pNew->addrExplain = addrExplain;
83823
+ pNew->addrLoop = addrLoop;
83824
+ pNew->addrVisit = addrVisit;
83825
+ pNew->nEst = nEst;
83826
+ pNew->zName = sqlite3DbStrDup(p->db, zName);
83827
+ p->aScan = aNew;
83828
+ }
8350183829
}
8350283830
}
8350383831
8350483832
/*
8350583833
** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83512,24 +83840,26 @@
8351283840
Vdbe *p,
8351383841
int addrExplain,
8351483842
int addrStart,
8351583843
int addrEnd
8351683844
){
83517
- ScanStatus *pScan = 0;
83518
- int ii;
83519
- for(ii=p->nScan-1; ii>=0; ii--){
83520
- pScan = &p->aScan[ii];
83521
- if( pScan->addrExplain==addrExplain ) break;
83522
- pScan = 0;
83523
- }
83524
- if( pScan ){
83525
- if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83526
- for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83527
- if( pScan->aAddrRange[ii]==0 ){
83528
- pScan->aAddrRange[ii] = addrStart;
83529
- pScan->aAddrRange[ii+1] = addrEnd;
83530
- break;
83845
+ if( IS_STMT_SCANSTATUS(p->db) ){
83846
+ ScanStatus *pScan = 0;
83847
+ int ii;
83848
+ for(ii=p->nScan-1; ii>=0; ii--){
83849
+ pScan = &p->aScan[ii];
83850
+ if( pScan->addrExplain==addrExplain ) break;
83851
+ pScan = 0;
83852
+ }
83853
+ if( pScan ){
83854
+ if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83855
+ for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83856
+ if( pScan->aAddrRange[ii]==0 ){
83857
+ pScan->aAddrRange[ii] = addrStart;
83858
+ pScan->aAddrRange[ii+1] = addrEnd;
83859
+ break;
83860
+ }
8353183861
}
8353283862
}
8353383863
}
8353483864
}
8353583865
@@ -83542,23 +83872,25 @@
8354283872
Vdbe *p,
8354383873
int addrExplain,
8354483874
int addrLoop,
8354583875
int addrVisit
8354683876
){
83547
- ScanStatus *pScan = 0;
83548
- int ii;
83549
- for(ii=p->nScan-1; ii>=0; ii--){
83550
- pScan = &p->aScan[ii];
83551
- if( pScan->addrExplain==addrExplain ) break;
83552
- pScan = 0;
83553
- }
83554
- if( pScan ){
83555
- pScan->addrLoop = addrLoop;
83556
- pScan->addrVisit = addrVisit;
83877
+ if( IS_STMT_SCANSTATUS(p->db) ){
83878
+ ScanStatus *pScan = 0;
83879
+ int ii;
83880
+ for(ii=p->nScan-1; ii>=0; ii--){
83881
+ pScan = &p->aScan[ii];
83882
+ if( pScan->addrExplain==addrExplain ) break;
83883
+ pScan = 0;
83884
+ }
83885
+ if( pScan ){
83886
+ pScan->addrLoop = addrLoop;
83887
+ pScan->addrVisit = addrVisit;
83888
+ }
8355783889
}
8355883890
}
83559
-#endif
83891
+#endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */
8356083892
8356183893
8356283894
/*
8356383895
** Change the value of the opcode, or P1, P2, P3, or P5 operands
8356483896
** for a specific instruction.
@@ -85682,10 +86014,12 @@
8568286014
db->nDeferredCons = 0;
8568386015
db->nDeferredImmCons = 0;
8568486016
db->flags &= ~(u64)SQLITE_DeferFKs;
8568586017
sqlite3CommitInternalChanges(db);
8568686018
}
86019
+ }else if( p->rc==SQLITE_SCHEMA && db->nVdbeActive>1 ){
86020
+ p->nChange = 0;
8568786021
}else{
8568886022
sqlite3RollbackAll(db, SQLITE_OK);
8568986023
p->nChange = 0;
8569086024
}
8569186025
db->nStatement = 0;
@@ -86000,13 +86334,13 @@
8600086334
vdbeFreeOpArray(db, p->aOp, p->nOp);
8600186335
if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
8600286336
#ifdef SQLITE_ENABLE_NORMALIZE
8600386337
sqlite3DbFree(db, p->zNormSql);
8600486338
{
86005
- DblquoteStr *pThis, *pNext;
86006
- for(pThis=p->pDblStr; pThis; pThis=pNext){
86007
- pNext = pThis->pNextStr;
86339
+ DblquoteStr *pThis, *pNxt;
86340
+ for(pThis=p->pDblStr; pThis; pThis=pNxt){
86341
+ pNxt = pThis->pNextStr;
8600886342
sqlite3DbFree(db, pThis);
8600986343
}
8601086344
}
8601186345
#endif
8601286346
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -87629,10 +87963,24 @@
8762987963
return 0;
8763087964
}
8763187965
return 1;
8763287966
}
8763387967
87968
+#if defined(SQLITE_ENABLE_CURSOR_HINTS) && defined(SQLITE_DEBUG)
87969
+/*
87970
+** This Walker callback is used to help verify that calls to
87971
+** sqlite3BtreeCursorHint() with opcode BTREE_HINT_RANGE have
87972
+** byte-code register values correctly initialized.
87973
+*/
87974
+SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr){
87975
+ if( pExpr->op==TK_REGISTER ){
87976
+ assert( (pWalker->u.aMem[pExpr->iTable].flags & MEM_Undefined)==0 );
87977
+ }
87978
+ return WRC_Continue;
87979
+}
87980
+#endif /* SQLITE_ENABLE_CURSOR_HINTS && SQLITE_DEBUG */
87981
+
8763487982
#ifndef SQLITE_OMIT_VIRTUALTABLE
8763587983
/*
8763687984
** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
8763787985
** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
8763887986
** in memory obtained from sqlite3DbMalloc).
@@ -88015,11 +88363,11 @@
8801588363
SQLITE_NULL, /* 0x1d (not possible) */
8801688364
SQLITE_INTEGER, /* 0x1e (not possible) */
8801788365
SQLITE_NULL, /* 0x1f (not possible) */
8801888366
SQLITE_FLOAT, /* 0x20 INTREAL */
8801988367
SQLITE_NULL, /* 0x21 (not possible) */
88020
- SQLITE_TEXT, /* 0x22 INTREAL + TEXT */
88368
+ SQLITE_FLOAT, /* 0x22 INTREAL + TEXT */
8802188369
SQLITE_NULL, /* 0x23 (not possible) */
8802288370
SQLITE_FLOAT, /* 0x24 (not possible) */
8802388371
SQLITE_NULL, /* 0x25 (not possible) */
8802488372
SQLITE_FLOAT, /* 0x26 (not possible) */
8802588373
SQLITE_NULL, /* 0x27 (not possible) */
@@ -89882,19 +90230,28 @@
8988290230
int iScanStatusOp, /* Which metric to return */
8988390231
int flags,
8988490232
void *pOut /* OUT: Write the answer here */
8988590233
){
8988690234
Vdbe *p = (Vdbe*)pStmt;
89887
- ScanStatus *pScan;
90235
+ VdbeOp *aOp = p->aOp;
90236
+ int nOp = p->nOp;
90237
+ ScanStatus *pScan = 0;
8988890238
int idx;
90239
+
90240
+ if( p->pFrame ){
90241
+ VdbeFrame *pFrame;
90242
+ for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
90243
+ aOp = pFrame->aOp;
90244
+ nOp = pFrame->nOp;
90245
+ }
8988990246
8989090247
if( iScan<0 ){
8989190248
int ii;
8989290249
if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
8989390250
i64 res = 0;
89894
- for(ii=0; ii<p->nOp; ii++){
89895
- res += p->aOp[ii].nCycle;
90251
+ for(ii=0; ii<nOp; ii++){
90252
+ res += aOp[ii].nCycle;
8989690253
}
8989790254
*(i64*)pOut = res;
8989890255
return 0;
8989990256
}
8990090257
return 1;
@@ -89916,19 +90273,19 @@
8991690273
if( idx>=p->nScan ) return 1;
8991790274
8991890275
switch( iScanStatusOp ){
8991990276
case SQLITE_SCANSTAT_NLOOP: {
8992090277
if( pScan->addrLoop>0 ){
89921
- *(sqlite3_int64*)pOut = p->aOp[pScan->addrLoop].nExec;
90278
+ *(sqlite3_int64*)pOut = aOp[pScan->addrLoop].nExec;
8992290279
}else{
8992390280
*(sqlite3_int64*)pOut = -1;
8992490281
}
8992590282
break;
8992690283
}
8992790284
case SQLITE_SCANSTAT_NVISIT: {
8992890285
if( pScan->addrVisit>0 ){
89929
- *(sqlite3_int64*)pOut = p->aOp[pScan->addrVisit].nExec;
90286
+ *(sqlite3_int64*)pOut = aOp[pScan->addrVisit].nExec;
8993090287
}else{
8993190288
*(sqlite3_int64*)pOut = -1;
8993290289
}
8993390290
break;
8993490291
}
@@ -89946,27 +90303,27 @@
8994690303
*(const char**)pOut = pScan->zName;
8994790304
break;
8994890305
}
8994990306
case SQLITE_SCANSTAT_EXPLAIN: {
8995090307
if( pScan->addrExplain ){
89951
- *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
90308
+ *(const char**)pOut = aOp[ pScan->addrExplain ].p4.z;
8995290309
}else{
8995390310
*(const char**)pOut = 0;
8995490311
}
8995590312
break;
8995690313
}
8995790314
case SQLITE_SCANSTAT_SELECTID: {
8995890315
if( pScan->addrExplain ){
89959
- *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
90316
+ *(int*)pOut = aOp[ pScan->addrExplain ].p1;
8996090317
}else{
8996190318
*(int*)pOut = -1;
8996290319
}
8996390320
break;
8996490321
}
8996590322
case SQLITE_SCANSTAT_PARENTID: {
8996690323
if( pScan->addrExplain ){
89967
- *(int*)pOut = p->aOp[ pScan->addrExplain ].p2;
90324
+ *(int*)pOut = aOp[ pScan->addrExplain ].p2;
8996890325
}else{
8996990326
*(int*)pOut = -1;
8997090327
}
8997190328
break;
8997290329
}
@@ -89980,22 +90337,22 @@
8998090337
int iIns = pScan->aAddrRange[ii];
8998190338
int iEnd = pScan->aAddrRange[ii+1];
8998290339
if( iIns==0 ) break;
8998390340
if( iIns>0 ){
8998490341
while( iIns<=iEnd ){
89985
- res += p->aOp[iIns].nCycle;
90342
+ res += aOp[iIns].nCycle;
8998690343
iIns++;
8998790344
}
8998890345
}else{
8998990346
int iOp;
89990
- for(iOp=0; iOp<p->nOp; iOp++){
89991
- Op *pOp = &p->aOp[iOp];
90347
+ for(iOp=0; iOp<nOp; iOp++){
90348
+ Op *pOp = &aOp[iOp];
8999290349
if( pOp->p1!=iEnd ) continue;
8999390350
if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
8999490351
continue;
8999590352
}
89996
- res += p->aOp[iOp].nCycle;
90353
+ res += aOp[iOp].nCycle;
8999790354
}
8999890355
}
8999990356
}
9000090357
}
9000190358
*(i64*)pOut = res;
@@ -90914,11 +91271,14 @@
9091491271
if( p->flags & (MEM_Int|MEM_IntReal) ){
9091591272
h += p->u.i;
9091691273
}else if( p->flags & MEM_Real ){
9091791274
h += sqlite3VdbeIntValue(p);
9091891275
}else if( p->flags & (MEM_Str|MEM_Blob) ){
90919
- /* no-op */
91276
+ /* All strings have the same hash and all blobs have the same hash,
91277
+ ** though, at least, those hashes are different from each other and
91278
+ ** from NULL. */
91279
+ h += 4093 + (p->flags & (MEM_Str|MEM_Blob));
9092091280
}
9092191281
}
9092291282
return h;
9092391283
}
9092491284
@@ -90964,10 +91324,11 @@
9096491324
Mem *pIn2 = 0; /* 2nd input operand */
9096591325
Mem *pIn3 = 0; /* 3rd input operand */
9096691326
Mem *pOut = 0; /* Output operand */
9096791327
#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
9096891328
u64 *pnCycle = 0;
91329
+ int bStmtScanStatus = IS_STMT_SCANSTATUS(db)!=0;
9096991330
#endif
9097091331
/*** INSERT STACK UNION HERE ***/
9097191332
9097291333
assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
9097391334
if( DbMaskNonZero(p->lockMask) ){
@@ -91028,17 +91389,21 @@
9102891389
** jumps to abort_due_to_error. */
9102991390
assert( rc==SQLITE_OK );
9103091391
9103191392
assert( pOp>=aOp && pOp<&aOp[p->nOp]);
9103291393
nVmStep++;
91033
-#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
91394
+
91395
+#if defined(VDBE_PROFILE)
9103491396
pOp->nExec++;
9103591397
pnCycle = &pOp->nCycle;
91036
-# ifdef VDBE_PROFILE
91037
- if( sqlite3NProfileCnt==0 )
91038
-# endif
91398
+ if( sqlite3NProfileCnt==0 ) *pnCycle -= sqlite3Hwtime();
91399
+#elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
91400
+ if( bStmtScanStatus ){
91401
+ pOp->nExec++;
91402
+ pnCycle = &pOp->nCycle;
9103991403
*pnCycle -= sqlite3Hwtime();
91404
+ }
9104091405
#endif
9104191406
9104291407
/* Only allow tracing if SQLITE_DEBUG is defined.
9104391408
*/
9104491409
#ifdef SQLITE_DEBUG
@@ -92848,10 +93213,16 @@
9284893213
** from the value in that register.
9284993214
**
9285093215
** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant
9285193216
** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04.
9285293217
** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10.
93218
+**
93219
+** WARNING: This opcode does not reliably distinguish between NULL and REAL
93220
+** when P1>=0. If the database contains a NaN value, this opcode will think
93221
+** that the datatype is REAL when it should be NULL. When P1<0 and the value
93222
+** is already stored in register P3, then this opcode does reliably
93223
+** distinguish between NULL and REAL. The problem only arises then P1>=0.
9285393224
**
9285493225
** Take the jump to address P2 if and only if the datatype of the
9285593226
** value determined by P1 and P3 corresponds to one of the bits in the
9285693227
** P5 bitmask.
9285793228
**
@@ -95196,10 +95567,11 @@
9519695567
#endif
9519795568
VdbeBranchTaken(0,3);
9519895569
break;
9519995570
}
9520095571
nStep--;
95572
+ pC->cacheStatus = CACHE_STALE;
9520195573
rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
9520295574
if( rc ){
9520395575
if( rc==SQLITE_DONE ){
9520495576
rc = SQLITE_OK;
9520595577
goto seekscan_search_fail;
@@ -97848,10 +98220,11 @@
9784898220
sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
9784998221
goto abort_due_to_error;
9785098222
}
9785198223
sqlite3VdbeChangeEncoding(pMem, encoding);
9785298224
UPDATE_MAX_BLOBSIZE(pMem);
98225
+ REGISTER_TRACE((int)(pMem-aMem), pMem);
9785398226
break;
9785498227
}
9785598228
9785698229
#ifndef SQLITE_OMIT_WAL
9785798230
/* Opcode: Checkpoint P1 P2 P3 * *
@@ -98986,12 +99359,14 @@
9898699359
9898799360
#if defined(VDBE_PROFILE)
9898899361
*pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
9898999362
pnCycle = 0;
9899099363
#elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
98991
- *pnCycle += sqlite3Hwtime();
98992
- pnCycle = 0;
99364
+ if( pnCycle ){
99365
+ *pnCycle += sqlite3Hwtime();
99366
+ pnCycle = 0;
99367
+ }
9899399368
#endif
9899499369
9899599370
/* The following code adds nothing to the actual functionality
9899699371
** of the program. It is only here for testing and debugging.
9899799372
** On the other hand, it does burn CPU cycles every time through
@@ -104013,11 +104388,12 @@
104013104388
if( pParse->pTriggerTab!=0 ){
104014104389
int op = pParse->eTriggerOp;
104015104390
assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
104016104391
if( pParse->bReturning ){
104017104392
if( (pNC->ncFlags & NC_UBaseReg)!=0
104018
- && (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
104393
+ && ALWAYS(zTab==0
104394
+ || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
104019104395
){
104020104396
pExpr->iTable = op!=TK_DELETE;
104021104397
pTab = pParse->pTriggerTab;
104022104398
}
104023104399
}else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
@@ -104798,12 +105174,12 @@
104798105174
sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
104799105175
}
104800105176
assert( pNC->nRef>=nRef );
104801105177
if( nRef!=pNC->nRef ){
104802105178
ExprSetProperty(pExpr, EP_VarSelect);
104803
- pNC->ncFlags |= NC_VarSelect;
104804105179
}
105180
+ pNC->ncFlags |= NC_Subquery;
104805105181
}
104806105182
break;
104807105183
}
104808105184
case TK_VARIABLE: {
104809105185
testcase( pNC->ncFlags & NC_IsCheck );
@@ -105987,15 +106363,14 @@
105987106363
if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
105988106364
p = p->pLeft;
105989106365
}else{
105990106366
Expr *pNext = p->pRight;
105991106367
/* The Expr.x union is never used at the same time as Expr.pRight */
105992
- assert( ExprUseXList(p) );
105993
- assert( p->x.pList==0 || p->pRight==0 );
105994
- if( p->x.pList!=0 && !db->mallocFailed ){
106368
+ assert( !ExprUseXList(p) || p->x.pList==0 || p->pRight==0 );
106369
+ if( ExprUseXList(p) && p->x.pList!=0 && !db->mallocFailed ){
105995106370
int i;
105996
- for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){
106371
+ for(i=0; i<p->x.pList->nExpr; i++){
105997106372
if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
105998106373
pNext = p->x.pList->a[i].pExpr;
105999106374
break;
106000106375
}
106001106376
}
@@ -108359,11 +108734,11 @@
108359108734
108360108735
/*
108361108736
** pX is the RHS of an IN operator. If pX is a SELECT statement
108362108737
** that can be simplified to a direct table access, then return
108363108738
** a pointer to the SELECT statement. If pX is not a SELECT statement,
108364
-** or if the SELECT statement needs to be manifested into a transient
108739
+** or if the SELECT statement needs to be materialized into a transient
108365108740
** table, then return NULL.
108366108741
*/
108367108742
#ifndef SQLITE_OMIT_SUBQUERY
108368108743
static Select *isCandidateForInOpt(const Expr *pX){
108369108744
Select *p;
@@ -108645,11 +109020,10 @@
108645109020
Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
108646109021
Expr *pRhs = pEList->a[i].pExpr;
108647109022
CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
108648109023
int j;
108649109024
108650
- assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );
108651109025
for(j=0; j<nExpr; j++){
108652109026
if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
108653109027
assert( pIdx->azColl[j] );
108654109028
if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
108655109029
continue;
@@ -109548,10 +109922,11 @@
109548109922
Column *pCol, /* The generated column */
109549109923
int regOut /* Put the result in this register */
109550109924
){
109551109925
int iAddr;
109552109926
Vdbe *v = pParse->pVdbe;
109927
+ int nErr = pParse->nErr;
109553109928
assert( v!=0 );
109554109929
assert( pParse->iSelfTab!=0 );
109555109930
if( pParse->iSelfTab>0 ){
109556109931
iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109557109932
}else{
@@ -109560,10 +109935,11 @@
109560109935
sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109561109936
if( pCol->affinity>=SQLITE_AFF_TEXT ){
109562109937
sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109563109938
}
109564109939
if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
109940
+ if( pParse->nErr>nErr ) pParse->db->errByteOffset = -1;
109565109941
}
109566109942
#endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109567109943
109568109944
/*
109569109945
** Generate code to extract the value of the iCol-th column of a table.
@@ -109576,10 +109952,11 @@
109576109952
int regOut /* Extract the value into this register */
109577109953
){
109578109954
Column *pCol;
109579109955
assert( v!=0 );
109580109956
assert( pTab!=0 );
109957
+ assert( iCol!=XN_EXPR );
109581109958
if( iCol<0 || iCol==pTab->iPKey ){
109582109959
sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109583109960
VdbeComment((v, "%s.rowid", pTab->zName));
109584109961
}else{
109585109962
int op;
@@ -109928,11 +110305,23 @@
109928110305
switch( op ){
109929110306
case TK_AGG_COLUMN: {
109930110307
AggInfo *pAggInfo = pExpr->pAggInfo;
109931110308
struct AggInfo_col *pCol;
109932110309
assert( pAggInfo!=0 );
109933
- assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
110310
+ assert( pExpr->iAgg>=0 );
110311
+ if( pExpr->iAgg>=pAggInfo->nColumn ){
110312
+ /* Happens when the left table of a RIGHT JOIN is null and
110313
+ ** is using an expression index */
110314
+ sqlite3VdbeAddOp2(v, OP_Null, 0, target);
110315
+#ifdef SQLITE_VDBE_COVERAGE
110316
+ /* Verify that the OP_Null above is exercised by tests
110317
+ ** tag-20230325-2 */
110318
+ sqlite3VdbeAddOp2(v, OP_NotNull, target, 1);
110319
+ VdbeCoverageNeverTaken(v);
110320
+#endif
110321
+ break;
110322
+ }
109934110323
pCol = &pAggInfo->aCol[pExpr->iAgg];
109935110324
if( !pAggInfo->directMode ){
109936110325
return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
109937110326
}else if( pAggInfo->useSortingIdx ){
109938110327
Table *pTab = pCol->pTab;
@@ -110103,15 +110492,12 @@
110103110492
return pExpr->iTable;
110104110493
}
110105110494
#ifndef SQLITE_OMIT_CAST
110106110495
case TK_CAST: {
110107110496
/* Expressions of the form: CAST(pLeft AS token) */
110108
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110109
- if( inReg!=target ){
110110
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110111
- inReg = target;
110112
- }
110497
+ sqlite3ExprCode(pParse, pExpr->pLeft, target);
110498
+ assert( inReg==target );
110113110499
assert( !ExprHasProperty(pExpr, EP_IntValue) );
110114110500
sqlite3VdbeAddOp2(v, OP_Cast, target,
110115110501
sqlite3AffinityType(pExpr->u.zToken, 0));
110116110502
return inReg;
110117110503
}
@@ -110446,17 +110832,13 @@
110446110832
** "SOFT-COLLATE" that is added to constraints that are pushed down
110447110833
** from outer queries into sub-queries by the push-down optimization.
110448110834
** Clear subtypes as subtypes may not cross a subquery boundary.
110449110835
*/
110450110836
assert( pExpr->pLeft );
110451
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110452
- if( inReg!=target ){
110453
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110454
- inReg = target;
110455
- }
110456
- sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg);
110457
- return inReg;
110837
+ sqlite3ExprCode(pParse, pExpr->pLeft, target);
110838
+ sqlite3VdbeAddOp1(v, OP_ClrSubtype, target);
110839
+ return target;
110458110840
}else{
110459110841
pExpr = pExpr->pLeft;
110460110842
goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110461110843
}
110462110844
}
@@ -110562,16 +110944,13 @@
110562110944
** (1) Temporarily disable factoring of constant expressions
110563110945
** (2) Make sure the computed value really is stored in register
110564110946
** "target" and not someplace else.
110565110947
*/
110566110948
pParse->okConstFactor = 0; /* note (1) above */
110567
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110949
+ sqlite3ExprCode(pParse, pExpr->pLeft, target);
110950
+ assert( target==inReg );
110568110951
pParse->okConstFactor = okConstFactor;
110569
- if( inReg!=target ){ /* note (2) above */
110570
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110571
- inReg = target;
110572
- }
110573110952
sqlite3VdbeJumpHere(v, addrINR);
110574110953
break;
110575110954
}
110576110955
110577110956
/*
@@ -110805,11 +111184,13 @@
110805111184
assert( pParse->pVdbe!=0 || pParse->db->mallocFailed );
110806111185
if( pParse->pVdbe==0 ) return;
110807111186
inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);
110808111187
if( inReg!=target ){
110809111188
u8 op;
110810
- if( ALWAYS(pExpr) && ExprHasProperty(pExpr,EP_Subquery) ){
111189
+ if( ALWAYS(pExpr)
111190
+ && (ExprHasProperty(pExpr,EP_Subquery) || pExpr->op==TK_REGISTER)
111191
+ ){
110811111192
op = OP_Copy;
110812111193
}else{
110813111194
op = OP_SCopy;
110814111195
}
110815111196
sqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target);
@@ -111990,23 +112371,26 @@
111990112371
){
111991112372
AggInfo *pAggInfo = pExpr->pAggInfo;
111992112373
int iAgg = pExpr->iAgg;
111993112374
Parse *pParse = pWalker->pParse;
111994112375
sqlite3 *db = pParse->db;
112376
+ assert( iAgg>=0 );
111995112377
if( pExpr->op!=TK_AGG_FUNCTION ){
111996
- assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
111997
- if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
112378
+ if( ALWAYS(iAgg<pAggInfo->nColumn)
112379
+ && pAggInfo->aCol[iAgg].pCExpr==pExpr
112380
+ ){
111998112381
pExpr = sqlite3ExprDup(db, pExpr, 0);
111999112382
if( pExpr ){
112000112383
pAggInfo->aCol[iAgg].pCExpr = pExpr;
112001112384
sqlite3ExprDeferredDelete(pParse, pExpr);
112002112385
}
112003112386
}
112004112387
}else{
112005112388
assert( pExpr->op==TK_AGG_FUNCTION );
112006
- assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
112007
- if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
112389
+ if( ALWAYS(iAgg<pAggInfo->nFunc)
112390
+ && pAggInfo->aFunc[iAgg].pFExpr==pExpr
112391
+ ){
112008112392
pExpr = sqlite3ExprDup(db, pExpr, 0);
112009112393
if( pExpr ){
112010112394
pAggInfo->aFunc[iAgg].pFExpr = pExpr;
112011112395
sqlite3ExprDeferredDelete(pParse, pExpr);
112012112396
}
@@ -112152,11 +112536,16 @@
112152112536
if( iDataCur<0 ) continue;
112153112537
if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112154112538
}
112155112539
if( pIEpr==0 ) break;
112156112540
if( NEVER(!ExprUseYTab(pExpr)) ) break;
112157
- if( pExpr->pAggInfo!=0 ) break; /* Already resolved by outer context */
112541
+ for(i=0; i<pSrcList->nSrc; i++){
112542
+ if( pSrcList->a[0].iCursor==pIEpr->iDataCur ) break;
112543
+ }
112544
+ if( i>=pSrcList->nSrc ) break;
112545
+ if( NEVER(pExpr->pAggInfo!=0) ) break; /* Resolved by outer context */
112546
+ if( pParse->nErr ){ return WRC_Abort; }
112158112547
112159112548
/* If we reach this point, it means that expression pExpr can be
112160112549
** translated into a reference to an index column as described by
112161112550
** pIEpr.
112162112551
*/
@@ -112163,10 +112552,13 @@
112163112552
memset(&tmp, 0, sizeof(tmp));
112164112553
tmp.op = TK_AGG_COLUMN;
112165112554
tmp.iTable = pIEpr->iIdxCur;
112166112555
tmp.iColumn = pIEpr->iIdxCol;
112167112556
findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
112557
+ if( pParse->nErr ){ return WRC_Abort; }
112558
+ assert( pAggInfo->aCol!=0 );
112559
+ assert( tmp.iAgg<pAggInfo->nColumn );
112168112560
pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112169112561
pExpr->pAggInfo = pAggInfo;
112170112562
pExpr->iAgg = tmp.iAgg;
112171112563
return WRC_Prune;
112172112564
}
@@ -112339,10 +112731,41 @@
112339112731
SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112340112732
pParse->nTempReg = 0;
112341112733
pParse->nRangeReg = 0;
112342112734
}
112343112735
112736
+/*
112737
+** Make sure sufficient registers have been allocated so that
112738
+** iReg is a valid register number.
112739
+*/
112740
+SQLITE_PRIVATE void sqlite3TouchRegister(Parse *pParse, int iReg){
112741
+ if( pParse->nMem<iReg ) pParse->nMem = iReg;
112742
+}
112743
+
112744
+#if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
112745
+/*
112746
+** Return the latest reusable register in the set of all registers.
112747
+** The value returned is no less than iMin. If any register iMin or
112748
+** greater is in permanent use, then return one more than that last
112749
+** permanent register.
112750
+*/
112751
+SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse *pParse, int iMin){
112752
+ const ExprList *pList = pParse->pConstExpr;
112753
+ if( pList ){
112754
+ int i;
112755
+ for(i=0; i<pList->nExpr; i++){
112756
+ if( pList->a[i].u.iConstExprReg>=iMin ){
112757
+ iMin = pList->a[i].u.iConstExprReg + 1;
112758
+ }
112759
+ }
112760
+ }
112761
+ pParse->nTempReg = 0;
112762
+ pParse->nRangeReg = 0;
112763
+ return iMin;
112764
+}
112765
+#endif /* SQLITE_ENABLE_STAT4 || SQLITE_DEBUG */
112766
+
112344112767
/*
112345112768
** Validate that no temporary register falls within the range of
112346112769
** iFirst..iLast, inclusive. This routine is only call from within assert()
112347112770
** statements.
112348112771
*/
@@ -112357,10 +112780,18 @@
112357112780
}
112358112781
for(i=0; i<pParse->nTempReg; i++){
112359112782
if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112360112783
return 0;
112361112784
}
112785
+ }
112786
+ if( pParse->pConstExpr ){
112787
+ ExprList *pList = pParse->pConstExpr;
112788
+ for(i=0; i<pList->nExpr; i++){
112789
+ int iReg = pList->a[i].u.iConstExprReg;
112790
+ if( iReg==0 ) continue;
112791
+ if( iReg>=iFirst && iReg<=iLast ) return 0;
112792
+ }
112362112793
}
112363112794
return 1;
112364112795
}
112365112796
#endif /* SQLITE_DEBUG */
112366112797
@@ -115641,15 +116072,19 @@
115641116072
int regTemp2 = iMem++; /* Second temporary use register */
115642116073
int regTabname = iMem++; /* Register containing table name */
115643116074
int regIdxname = iMem++; /* Register containing index name */
115644116075
int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
115645116076
int regPrev = iMem; /* MUST BE LAST (see below) */
116077
+#ifdef SQLITE_ENABLE_STAT4
116078
+ int doOnce = 1; /* Flag for a one-time computation */
116079
+#endif
115646116080
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
115647116081
Table *pStat1 = 0;
115648116082
#endif
115649116083
115650
- pParse->nMem = MAX(pParse->nMem, iMem);
116084
+ sqlite3TouchRegister(pParse, iMem);
116085
+ assert( sqlite3NoTempsInRange(pParse, regNewRowid, iMem) );
115651116086
v = sqlite3GetVdbe(pParse);
115652116087
if( v==0 || NEVER(pTab==0) ){
115653116088
return;
115654116089
}
115655116090
if( !IsOrdinaryTable(pTab) ){
@@ -115751,11 +116186,11 @@
115751116186
115752116187
/* Make sure there are enough memory cells allocated to accommodate
115753116188
** the regPrev array and a trailing rowid (the rowid slot is required
115754116189
** when building a record to insert into the sample column of
115755116190
** the sqlite_stat4 table. */
115756
- pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);
116191
+ sqlite3TouchRegister(pParse, regPrev+nColTest);
115757116192
115758116193
/* Open a read-only cursor on the index being analyzed. */
115759116194
assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
115760116195
sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
115761116196
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115923,11 +116358,39 @@
115923116358
int regSampleRowid = regCol + nCol;
115924116359
int addrNext;
115925116360
int addrIsNull;
115926116361
u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
115927116362
115928
- pParse->nMem = MAX(pParse->nMem, regCol+nCol);
116363
+ if( doOnce ){
116364
+ int mxCol = nCol;
116365
+ Index *pX;
116366
+
116367
+ /* Compute the maximum number of columns in any index */
116368
+ for(pX=pTab->pIndex; pX; pX=pX->pNext){
116369
+ int nColX; /* Number of columns in pX */
116370
+ if( !HasRowid(pTab) && IsPrimaryKeyIndex(pX) ){
116371
+ nColX = pX->nKeyCol;
116372
+ }else{
116373
+ nColX = pX->nColumn;
116374
+ }
116375
+ if( nColX>mxCol ) mxCol = nColX;
116376
+ }
116377
+
116378
+ /* Allocate space to compute results for the largest index */
116379
+ sqlite3TouchRegister(pParse, regCol+mxCol);
116380
+ doOnce = 0;
116381
+#ifdef SQLITE_DEBUG
116382
+ /* Verify that the call to sqlite3ClearTempRegCache() below
116383
+ ** really is needed.
116384
+ ** https://sqlite.org/forum/forumpost/83cb4a95a0 (2023-03-25)
116385
+ */
116386
+ testcase( !sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116387
+#endif
116388
+ sqlite3ClearTempRegCache(pParse); /* tag-20230325-1 */
116389
+ assert( sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116390
+ }
116391
+ assert( sqlite3NoTempsInRange(pParse, regEq, regCol+nCol) );
115929116392
115930116393
addrNext = sqlite3VdbeCurrentAddr(v);
115931116394
callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
115932116395
addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
115933116396
VdbeCoverage(v);
@@ -116004,10 +116467,15 @@
116004116467
iTab = pParse->nTab;
116005116468
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
116006116469
for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
116007116470
Table *pTab = (Table*)sqliteHashData(k);
116008116471
analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
116472
+#ifdef SQLITE_ENABLE_STAT4
116473
+ iMem = sqlite3FirstAvailableRegister(pParse, iMem);
116474
+#else
116475
+ assert( iMem==sqlite3FirstAvailableRegister(pParse,iMem) );
116476
+#endif
116009116477
}
116010116478
loadAnalysis(pParse, iDb);
116011116479
}
116012116480
116013116481
/*
@@ -118931,11 +119399,11 @@
118931119399
Hash *pHash;
118932119400
sqlite3 *db = pParse->db;
118933119401
if( pParse->pNewTrigger ){
118934119402
sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
118935119403
}else{
118936
- assert( pParse->bReturning==0 );
119404
+ assert( pParse->bReturning==0 || pParse->ifNotExists );
118937119405
}
118938119406
pParse->bReturning = 1;
118939119407
pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
118940119408
if( pRet==0 ){
118941119409
sqlite3ExprListDelete(db, pList);
@@ -118957,11 +119425,12 @@
118957119425
pRet->retTrig.step_list = &pRet->retTStep;
118958119426
pRet->retTStep.op = TK_RETURNING;
118959119427
pRet->retTStep.pTrig = &pRet->retTrig;
118960119428
pRet->retTStep.pExprList = pList;
118961119429
pHash = &(db->aDb[1].pSchema->trigHash);
118962
- assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
119430
+ assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0
119431
+ || pParse->nErr || pParse->ifNotExists );
118963119432
if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
118964119433
==&pRet->retTrig ){
118965119434
sqlite3OomFault(db);
118966119435
}
118967119436
}
@@ -123830,17 +124299,19 @@
123830124299
**
123831124300
** If pTab is not writable -> generate an error message and return 1.
123832124301
** If pTab is writable but other errors have occurred -> return 1.
123833124302
** If pTab is writable and no prior errors -> return 0;
123834124303
*/
123835
-SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
124304
+SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, Trigger *pTrigger){
123836124305
if( tabIsReadOnly(pParse, pTab) ){
123837124306
sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
123838124307
return 1;
123839124308
}
123840124309
#ifndef SQLITE_OMIT_VIEW
123841
- if( !viewOk && IsView(pTab) ){
124310
+ if( IsView(pTab)
124311
+ && (pTrigger==0 || (pTrigger->bReturning && pTrigger->pNext==0))
124312
+ ){
123842124313
sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
123843124314
return 1;
123844124315
}
123845124316
#endif
123846124317
return 0;
@@ -124090,11 +124561,11 @@
124090124561
*/
124091124562
if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124092124563
goto delete_from_cleanup;
124093124564
}
124094124565
124095
- if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
124566
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
124096124567
goto delete_from_cleanup;
124097124568
}
124098124569
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124099124570
assert( iDb<db->nDb );
124100124571
rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -124199,11 +124670,11 @@
124199124670
}
124200124671
}else
124201124672
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124202124673
{
124203124674
u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124204
- if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
124675
+ if( sNC.ncFlags & NC_Subquery ) bComplex = 1;
124205124676
wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124206124677
if( HasRowid(pTab) ){
124207124678
/* For a rowid table, initialize the RowSet to an empty set */
124208124679
pPk = 0;
124209124680
nPk = 1;
@@ -128787,49 +129258,51 @@
128787129258
**
128788129259
** Memory for the buffer containing the column index affinity string
128789129260
** is managed along with the rest of the Index structure. It will be
128790129261
** released when sqlite3DeleteIndex() is called.
128791129262
*/
128792
-SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
128793
- if( !pIdx->zColAff ){
128794
- /* The first time a column affinity string for a particular index is
128795
- ** required, it is allocated and populated here. It is then stored as
128796
- ** a member of the Index structure for subsequent use.
128797
- **
128798
- ** The column affinity string will eventually be deleted by
128799
- ** sqliteDeleteIndex() when the Index structure itself is cleaned
128800
- ** up.
128801
- */
128802
- int n;
128803
- Table *pTab = pIdx->pTable;
128804
- pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
128805
- if( !pIdx->zColAff ){
128806
- sqlite3OomFault(db);
128807
- return 0;
128808
- }
128809
- for(n=0; n<pIdx->nColumn; n++){
128810
- i16 x = pIdx->aiColumn[n];
128811
- char aff;
128812
- if( x>=0 ){
128813
- aff = pTab->aCol[x].affinity;
128814
- }else if( x==XN_ROWID ){
128815
- aff = SQLITE_AFF_INTEGER;
128816
- }else{
128817
- assert( x==XN_EXPR );
128818
- assert( pIdx->bHasExpr );
128819
- assert( pIdx->aColExpr!=0 );
128820
- aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
128821
- }
128822
- if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
128823
- if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
128824
- pIdx->zColAff[n] = aff;
128825
- }
128826
- pIdx->zColAff[n] = 0;
128827
- }
128828
-
129263
+static SQLITE_NOINLINE const char *computeIndexAffStr(sqlite3 *db, Index *pIdx){
129264
+ /* The first time a column affinity string for a particular index is
129265
+ ** required, it is allocated and populated here. It is then stored as
129266
+ ** a member of the Index structure for subsequent use.
129267
+ **
129268
+ ** The column affinity string will eventually be deleted by
129269
+ ** sqliteDeleteIndex() when the Index structure itself is cleaned
129270
+ ** up.
129271
+ */
129272
+ int n;
129273
+ Table *pTab = pIdx->pTable;
129274
+ pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
129275
+ if( !pIdx->zColAff ){
129276
+ sqlite3OomFault(db);
129277
+ return 0;
129278
+ }
129279
+ for(n=0; n<pIdx->nColumn; n++){
129280
+ i16 x = pIdx->aiColumn[n];
129281
+ char aff;
129282
+ if( x>=0 ){
129283
+ aff = pTab->aCol[x].affinity;
129284
+ }else if( x==XN_ROWID ){
129285
+ aff = SQLITE_AFF_INTEGER;
129286
+ }else{
129287
+ assert( x==XN_EXPR );
129288
+ assert( pIdx->bHasExpr );
129289
+ assert( pIdx->aColExpr!=0 );
129290
+ aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
129291
+ }
129292
+ if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
129293
+ if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
129294
+ pIdx->zColAff[n] = aff;
129295
+ }
129296
+ pIdx->zColAff[n] = 0;
129297
+ return pIdx->zColAff;
129298
+}
129299
+SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
129300
+ if( !pIdx->zColAff ) return computeIndexAffStr(db, pIdx);
128829129301
return pIdx->zColAff;
128830129302
}
129303
+
128831129304
128832129305
/*
128833129306
** Compute an affinity string for a table. Space is obtained
128834129307
** from sqlite3DbMalloc(). The caller is responsible for freeing
128835129308
** the space when done.
@@ -129511,11 +129984,11 @@
129511129984
goto insert_cleanup;
129512129985
}
129513129986
129514129987
/* Cannot insert into a read-only table.
129515129988
*/
129516
- if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
129989
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
129517129990
goto insert_cleanup;
129518129991
}
129519129992
129520129993
/* Allocate a VDBE
129521129994
*/
@@ -129958,11 +130431,11 @@
129958130431
sqlite3VdbeJumpHere(v, addr1);
129959130432
sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
129960130433
}
129961130434
129962130435
/* Copy the new data already generated. */
129963
- assert( pTab->nNVCol>0 );
130436
+ assert( pTab->nNVCol>0 || pParse->nErr>0 );
129964130437
sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
129965130438
129966130439
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
129967130440
/* Compute the new value for generated columns after all other
129968130441
** columns have already been computed. This must be done after
@@ -133321,19 +133794,25 @@
133321133794
zEntry = zProc ? zProc : "sqlite3_extension_init";
133322133795
133323133796
/* tag-20210611-1. Some dlopen() implementations will segfault if given
133324133797
** an oversize filename. Most filesystems have a pathname limit of 4K,
133325133798
** so limit the extension filename length to about twice that.
133326
- ** https://sqlite.org/forum/forumpost/08a0d6d9bf */
133799
+ ** https://sqlite.org/forum/forumpost/08a0d6d9bf
133800
+ **
133801
+ ** Later (2023-03-25): Save an extra 6 bytes for the filename suffix.
133802
+ ** See https://sqlite.org/forum/forumpost/24083b579d.
133803
+ */
133327133804
if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133328133805
133329133806
handle = sqlite3OsDlOpen(pVfs, zFile);
133330133807
#if SQLITE_OS_UNIX || SQLITE_OS_WIN
133331133808
for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133332133809
char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133333133810
if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133334
- handle = sqlite3OsDlOpen(pVfs, zAltFile);
133811
+ if( nMsg+strlen(azEndings[ii])+1<=SQLITE_MAX_PATHLEN ){
133812
+ handle = sqlite3OsDlOpen(pVfs, zAltFile);
133813
+ }
133335133814
sqlite3_free(zAltFile);
133336133815
}
133337133816
#endif
133338133817
if( handle==0 ) goto extension_not_found;
133339133818
xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135824,11 +136303,11 @@
135824136303
if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
135825136304
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135826136305
zDb = db->aDb[iDb].zDbSName;
135827136306
sqlite3CodeVerifySchema(pParse, iDb);
135828136307
sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
135829
- if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
136308
+ sqlite3TouchRegister(pParse, pTab->nCol+regRow);
135830136309
sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
135831136310
sqlite3VdbeLoadString(v, regResult, pTab->zName);
135832136311
assert( IsOrdinaryTable(pTab) );
135833136312
for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
135834136313
pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135865,11 +136344,11 @@
135865136344
135866136345
/* Generate code to read the child key values into registers
135867136346
** regRow..regRow+n. If any of the child key values are NULL, this
135868136347
** row cannot cause an FK violation. Jump directly to addrOk in
135869136348
** this case. */
135870
- if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol;
136349
+ sqlite3TouchRegister(pParse, regRow + pFK->nCol);
135871136350
for(j=0; j<pFK->nCol; j++){
135872136351
int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
135873136352
sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
135874136353
sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
135875136354
}
@@ -135994,10 +136473,11 @@
135994136473
135995136474
if( OMIT_TEMPDB && i==1 ) continue;
135996136475
if( iDb>=0 && i!=iDb ) continue;
135997136476
135998136477
sqlite3CodeVerifySchema(pParse, i);
136478
+ pParse->okConstFactor = 0; /* tag-20230327-1 */
135999136479
136000136480
/* Do an integrity check of the B-Tree
136001136481
**
136002136482
** Begin by finding the root pages numbers
136003136483
** for all tables and indices in the database.
@@ -136029,11 +136509,11 @@
136029136509
}
136030136510
}
136031136511
aRoot[0] = cnt;
136032136512
136033136513
/* Make sure sufficient number of registers have been allocated */
136034
- pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
136514
+ sqlite3TouchRegister(pParse, 8+mxIdx);
136035136515
sqlite3ClearTempRegCache(pParse);
136036136516
136037136517
/* Do the b-tree integrity checks */
136038136518
sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136039136519
sqlite3VdbeChangeP5(v, (u8)i);
@@ -136179,19 +136659,33 @@
136179136659
136180136660
labelError = sqlite3VdbeMakeLabel(pParse);
136181136661
labelOk = sqlite3VdbeMakeLabel(pParse);
136182136662
if( pCol->notNull ){
136183136663
/* (1) NOT NULL columns may not contain a NULL */
136664
+ int jmp3;
136184136665
int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
136185
- sqlite3VdbeChangeP5(v, 0x0f);
136186136666
VdbeCoverage(v);
136667
+ if( p1<0 ){
136668
+ sqlite3VdbeChangeP5(v, 0x0f); /* INT, REAL, TEXT, or BLOB */
136669
+ jmp3 = jmp2;
136670
+ }else{
136671
+ sqlite3VdbeChangeP5(v, 0x0d); /* INT, TEXT, or BLOB */
136672
+ /* OP_IsType does not detect NaN values in the database file
136673
+ ** which should be treated as a NULL. So if the header type
136674
+ ** is REAL, we have to load the actual data using OP_Column
136675
+ ** to reliably determine if the value is a NULL. */
136676
+ sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3);
136677
+ jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk);
136678
+ VdbeCoverage(v);
136679
+ }
136187136680
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136188136681
pCol->zCnName);
136189136682
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136190136683
if( doTypeCheck ){
136191136684
sqlite3VdbeGoto(v, labelError);
136192136685
sqlite3VdbeJumpHere(v, jmp2);
136686
+ sqlite3VdbeJumpHere(v, jmp3);
136193136687
}else{
136194136688
/* VDBE byte code will fall thru */
136195136689
}
136196136690
}
136197136691
if( bStrict && doTypeCheck ){
@@ -136295,11 +136789,11 @@
136295136789
** any extra bytes at the end. Verify that this is the case. */
136296136790
if( HasRowid(pTab) ){
136297136791
int jmp7;
136298136792
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3);
136299136793
jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1);
136300
- VdbeCoverage(v);
136794
+ VdbeCoverageNeverNull(v);
136301136795
sqlite3VdbeLoadString(v, 3,
136302136796
"rowid not at end-of-record for row ");
136303136797
sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
136304136798
sqlite3VdbeLoadString(v, 4, " of index ");
136305136799
sqlite3VdbeGoto(v, jmp5-1);
@@ -142129,11 +142623,13 @@
142129142623
assert( pExpr->pRight==0 );
142130142624
if( sqlite3ExprIsVector(pCopy) ){
142131142625
sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142132142626
}else{
142133142627
sqlite3 *db = pSubst->pParse->db;
142134
- if( pSubst->isOuterJoin ){
142628
+ if( pSubst->isOuterJoin
142629
+ && (pCopy->op!=TK_COLUMN || pCopy->iTable!=pSubst->iNewTable)
142630
+ ){
142135142631
memset(&ifNullRow, 0, sizeof(ifNullRow));
142136142632
ifNullRow.op = TK_IF_NULL_ROW;
142137142633
ifNullRow.pLeft = pCopy;
142138142634
ifNullRow.iTable = pSubst->iNewTable;
142139142635
ifNullRow.iColumn = -99;
@@ -142506,12 +143002,11 @@
142506143002
** (17f) the subquery must not be the RHS of a LEFT JOIN.
142507143003
** (17g) either the subquery is the first element of the outer
142508143004
** query or there are no RIGHT or FULL JOINs in any arm
142509143005
** of the subquery. (This is a duplicate of condition (27b).)
142510143006
** (17h) The corresponding result set expressions in all arms of the
142511
-** compound must have the same affinity. (See restriction (9)
142512
-** on the push-down optimization.)
143007
+** compound must have the same affinity.
142513143008
**
142514143009
** The parent and sub-query may contain WHERE clauses. Subject to
142515143010
** rules (11), (13) and (14), they may also contain ORDER BY,
142516143011
** LIMIT and OFFSET clauses. The subquery cannot use any compound
142517143012
** operator other than UNION ALL because all the other compound
@@ -143375,14 +143870,10 @@
143375143870
**
143376143871
** (8) If the subquery is a compound that uses UNION, INTERSECT,
143377143872
** or EXCEPT, then all of the result set columns for all arms of
143378143873
** the compound must use the BINARY collating sequence.
143379143874
**
143380
-** (9) If the subquery is a compound, then all arms of the compound must
143381
-** have the same affinity. (This is the same as restriction (17h)
143382
-** for query flattening.)
143383
-**
143384143875
**
143385143876
** Return 0 if no changes are made and non-zero if one or more WHERE clause
143386143877
** terms are duplicated into the subquery.
143387143878
*/
143388143879
static int pushDownWhereTerms(
@@ -143409,13 +143900,10 @@
143409143900
}
143410143901
#ifndef SQLITE_OMIT_WINDOWFUNC
143411143902
if( pSel->pWin ) return 0; /* restriction (6b) */
143412143903
#endif
143413143904
}
143414
- if( compoundHasDifferentAffinities(pSubq) ){
143415
- return 0; /* restriction (9) */
143416
- }
143417143905
if( notUnionAll ){
143418143906
/* If any of the compound arms are connected using UNION, INTERSECT,
143419143907
** or EXCEPT, then we must ensure that none of the columns use a
143420143908
** non-BINARY collating sequence. */
143421143909
for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143502,10 +143990,80 @@
143502143990
}
143503143991
}
143504143992
return nChng;
143505143993
}
143506143994
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
143995
+
143996
+/*
143997
+** Check to see if a subquery contains result-set columns that are
143998
+** never used. If it does, change the value of those result-set columns
143999
+** to NULL so that they do not cause unnecessary work to compute.
144000
+**
144001
+** Return the number of column that were changed to NULL.
144002
+*/
144003
+static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
144004
+ int nCol;
144005
+ Select *pSub; /* The subquery to be simplified */
144006
+ Select *pX; /* For looping over compound elements of pSub */
144007
+ Table *pTab; /* The table that describes the subquery */
144008
+ int j; /* Column number */
144009
+ int nChng = 0; /* Number of columns converted to NULL */
144010
+ Bitmask colUsed; /* Columns that may not be NULLed out */
144011
+
144012
+ assert( pItem!=0 );
144013
+ if( pItem->fg.isCorrelated || pItem->fg.isCte ){
144014
+ return 0;
144015
+ }
144016
+ assert( pItem->pTab!=0 );
144017
+ pTab = pItem->pTab;
144018
+ assert( pItem->pSelect!=0 );
144019
+ pSub = pItem->pSelect;
144020
+ assert( pSub->pEList->nExpr==pTab->nCol );
144021
+ if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
144022
+ testcase( pSub->selFlags & SF_Distinct );
144023
+ testcase( pSub->selFlags & SF_Aggregate );
144024
+ return 0;
144025
+ }
144026
+ for(pX=pSub; pX; pX=pX->pPrior){
144027
+ if( pX->pPrior && pX->op!=TK_ALL ){
144028
+ /* This optimization does not work for compound subqueries that
144029
+ ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
144030
+ return 0;
144031
+ }
144032
+ if( pX->pWin ){
144033
+ /* This optimization does not work for subqueries that use window
144034
+ ** functions. */
144035
+ return 0;
144036
+ }
144037
+ }
144038
+ colUsed = pItem->colUsed;
144039
+ if( pSub->pOrderBy ){
144040
+ ExprList *pList = pSub->pOrderBy;
144041
+ for(j=0; j<pList->nExpr; j++){
144042
+ u16 iCol = pList->a[j].u.x.iOrderByCol;
144043
+ if( iCol>0 ){
144044
+ iCol--;
144045
+ colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
144046
+ }
144047
+ }
144048
+ }
144049
+ nCol = pTab->nCol;
144050
+ for(j=0; j<nCol; j++){
144051
+ Bitmask m = j<BMS-1 ? MASKBIT(j) : TOPBIT;
144052
+ if( (m & colUsed)!=0 ) continue;
144053
+ for(pX=pSub; pX; pX=pX->pPrior) {
144054
+ Expr *pY = pX->pEList->a[j].pExpr;
144055
+ if( pY->op==TK_NULL ) continue;
144056
+ pY->op = TK_NULL;
144057
+ ExprClearProperty(pY, EP_Skip|EP_Unlikely);
144058
+ pX->selFlags |= SF_PushDown;
144059
+ nChng++;
144060
+ }
144061
+ }
144062
+ return nChng;
144063
+}
144064
+
143507144065
143508144066
/*
143509144067
** The pFunc is the only aggregate function in the query. Check to see
143510144068
** if the query is a candidate for the min/max optimization.
143511144069
**
@@ -144688,15 +145246,17 @@
144688145246
if( pExpr->pAggInfo==0 ) return WRC_Continue;
144689145247
if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
144690145248
if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
144691145249
if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
144692145250
pAggInfo = pExpr->pAggInfo;
144693
- assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
145251
+ if( NEVER(pExpr->iAgg>=pAggInfo->nColumn) ) return WRC_Continue;
145252
+ assert( pExpr->iAgg>=0 );
144694145253
pCol = &pAggInfo->aCol[pExpr->iAgg];
144695145254
pExpr->op = TK_AGG_COLUMN;
144696145255
pExpr->iTable = pCol->iTable;
144697145256
pExpr->iColumn = pCol->iColumn;
145257
+ ExprClearProperty(pExpr, EP_Skip|EP_Collate);
144698145258
return WRC_Prune;
144699145259
}
144700145260
144701145261
/*
144702145262
** Convert every pAggInfo->aFunc[].pExpr such that any node within
@@ -145046,11 +145606,10 @@
145046145606
sqlite3DbFree(db, p->aCol);
145047145607
sqlite3DbFree(db, p->aFunc);
145048145608
sqlite3DbFreeNN(db, p);
145049145609
}
145050145610
145051
-#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145052145611
/*
145053145612
** Attempt to transform a query of the form
145054145613
**
145055145614
** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145056145615
**
@@ -145074,10 +145633,11 @@
145074145633
Expr *pCount;
145075145634
sqlite3 *db;
145076145635
if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145077145636
if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145078145637
if( p->pWhere ) return 0;
145638
+ if( p->pHaving ) return 0;
145079145639
if( p->pGroupBy ) return 0;
145080145640
if( p->pOrderBy ) return 0;
145081145641
pExpr = p->pEList->a[0].pExpr;
145082145642
if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145083145643
assert( ExprUseUToken(pExpr) );
@@ -145093,11 +145653,12 @@
145093145653
do{
145094145654
if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145095145655
if( pSub->pWhere ) return 0; /* No WHERE clause */
145096145656
if( pSub->pLimit ) return 0; /* No LIMIT clause */
145097145657
if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145098
- pSub = pSub->pPrior; /* Repeat over compound */
145658
+ assert( pSub->pHaving==0 ); /* Due to the previous */
145659
+ pSub = pSub->pPrior; /* Repeat over compound */
145099145660
}while( pSub );
145100145661
145101145662
/* If we reach this point then it is OK to perform the transformation */
145102145663
145103145664
db = pParse->db;
@@ -145136,11 +145697,10 @@
145136145697
sqlite3TreeViewSelect(0, p, 0);
145137145698
}
145138145699
#endif
145139145700
return 1;
145140145701
}
145141
-#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
145142145702
145143145703
/*
145144145704
** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145145145705
** as pSrcItem but has the same alias as p0, then return true.
145146145706
** Otherwise return false.
@@ -145525,18 +146085,16 @@
145525146085
#endif
145526146086
}else{
145527146087
TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
145528146088
}
145529146089
145530
-#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145531146090
if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
145532146091
&& countOfViewOptimization(pParse, p)
145533146092
){
145534146093
if( db->mallocFailed ) goto select_end;
145535146094
pTabList = p->pSrc;
145536146095
}
145537
-#endif
145538146096
145539146097
/* For each term in the FROM clause, do two things:
145540146098
** (1) Authorized unreferenced tables
145541146099
** (2) Generate code for all sub-queries
145542146100
*/
@@ -145604,10 +146162,26 @@
145604146162
#endif
145605146163
assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
145606146164
}else{
145607146165
TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
145608146166
}
146167
+
146168
+ /* Convert unused result columns of the subquery into simple NULL
146169
+ ** expressions, to avoid unneeded searching and computation.
146170
+ */
146171
+ if( OptimizationEnabled(db, SQLITE_NullUnusedCols)
146172
+ && disableUnusedSubqueryResultColumns(pItem)
146173
+ ){
146174
+#if TREETRACE_ENABLED
146175
+ if( sqlite3TreeTrace & 0x4000 ){
146176
+ TREETRACE(0x4000,pParse,p,
146177
+ ("Change unused result columns to NULL for subquery %d:\n",
146178
+ pSub->selId));
146179
+ sqlite3TreeViewSelect(0, p, 0);
146180
+ }
146181
+#endif
146182
+ }
145609146183
145610146184
zSavedAuthContext = pParse->zAuthContext;
145611146185
pParse->zAuthContext = pItem->zName;
145612146186
145613146187
/* Generate code to implement the subquery
@@ -146891,10 +147465,11 @@
146891147465
if( !noErr ){
146892147466
sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
146893147467
}else{
146894147468
assert( !db->init.busy );
146895147469
sqlite3CodeVerifySchema(pParse, iDb);
147470
+ VVA_ONLY( pParse->ifNotExists = 1; )
146896147471
}
146897147472
goto trigger_cleanup;
146898147473
}
146899147474
}
146900147475
@@ -148141,10 +148716,13 @@
148141148716
const int op = pChanges ? TK_UPDATE : TK_DELETE;
148142148717
u32 mask = 0;
148143148718
Trigger *p;
148144148719
148145148720
assert( isNew==1 || isNew==0 );
148721
+ if( IsView(pTab) ){
148722
+ return 0xffffffff;
148723
+ }
148146148724
for(p=pTrigger; p; p=p->pNext){
148147148725
if( p->op==op
148148148726
&& (tr_tm&p->tr_tm)
148149148727
&& checkColumnOverlap(p->pColumns,pChanges)
148150148728
){
@@ -148575,11 +149153,11 @@
148575149153
#endif
148576149154
148577149155
if( sqlite3ViewGetColumnNames(pParse, pTab) ){
148578149156
goto update_cleanup;
148579149157
}
148580
- if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
149158
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
148581149159
goto update_cleanup;
148582149160
}
148583149161
148584149162
/* Allocate a cursors for the main database table and for all indices.
148585149163
** The index cursors might not be used, but if they are used they
@@ -148894,16 +149472,26 @@
148894149472
bFinishSeek = 0;
148895149473
}else{
148896149474
/* Begin the database scan.
148897149475
**
148898149476
** Do not consider a single-pass strategy for a multi-row update if
148899
- ** there are any triggers or foreign keys to process, or rows may
148900
- ** be deleted as a result of REPLACE conflict handling. Any of these
148901
- ** things might disturb a cursor being used to scan through the table
148902
- ** or index, causing a single-pass approach to malfunction. */
149477
+ ** there is anything that might disrupt the cursor being used to do
149478
+ ** the UPDATE:
149479
+ ** (1) This is a nested UPDATE
149480
+ ** (2) There are triggers
149481
+ ** (3) There are FOREIGN KEY constraints
149482
+ ** (4) There are REPLACE conflict handlers
149483
+ ** (5) There are subqueries in the WHERE clause
149484
+ */
148903149485
flags = WHERE_ONEPASS_DESIRED;
148904
- if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
149486
+ if( !pParse->nested
149487
+ && !pTrigger
149488
+ && !hasFK
149489
+ && !chngKey
149490
+ && !bReplace
149491
+ && (sNC.ncFlags & NC_Subquery)==0
149492
+ ){
148905149493
flags |= WHERE_ONEPASS_MULTIROW;
148906149494
}
148907149495
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
148908149496
if( pWInfo==0 ) goto update_cleanup;
148909149497
@@ -150864,11 +151452,13 @@
150864151452
sCtx.pTab = pTab;
150865151453
sCtx.pVTable = pVTable;
150866151454
sCtx.pPrior = db->pVtabCtx;
150867151455
sCtx.bDeclared = 0;
150868151456
db->pVtabCtx = &sCtx;
151457
+ pTab->nTabRef++;
150869151458
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
151459
+ sqlite3DeleteTable(db, pTab);
150870151460
db->pVtabCtx = sCtx.pPrior;
150871151461
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
150872151462
assert( sCtx.pTab==pTab );
150873151463
150874151464
if( SQLITE_OK!=rc ){
@@ -151582,10 +152172,14 @@
151582152172
break;
151583152173
}
151584152174
case SQLITE_VTAB_DIRECTONLY: {
151585152175
p->pVTable->eVtabRisk = SQLITE_VTABRISK_High;
151586152176
break;
152177
+ }
152178
+ case SQLITE_VTAB_USES_ALL_SCHEMAS: {
152179
+ p->pVTable->bAllSchemas = 1;
152180
+ break;
151587152181
}
151588152182
default: {
151589152183
rc = SQLITE_MISUSE_BKPT;
151590152184
break;
151591152185
}
@@ -152356,13 +152950,13 @@
152356152950
sqlite3_str_append(pStr, ")", 1);
152357152951
}
152358152952
152359152953
/*
152360152954
** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152361
-** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
152362
-** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
152363
-** is added to the output to describe the table scan strategy in pLevel.
152955
+** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG
152956
+** was defined at compile-time. If it is not a no-op, a single OP_Explain
152957
+** opcode is added to the output to describe the table scan strategy in pLevel.
152364152958
**
152365152959
** If an OP_Explain opcode is added to the VM, its address is returned.
152366152960
** Otherwise, if no OP_Explain is coded, zero is returned.
152367152961
*/
152368152962
SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152370,12 +152964,12 @@
152370152964
SrcList *pTabList, /* Table list this loop refers to */
152371152965
WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152372152966
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152373152967
){
152374152968
int ret = 0;
152375
-#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
152376
- if( sqlite3ParseToplevel(pParse)->explain==2 )
152969
+#if !defined(SQLITE_DEBUG)
152970
+ if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
152377152971
#endif
152378152972
{
152379152973
SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152380152974
Vdbe *v = pParse->pVdbe; /* VM being constructed */
152381152975
sqlite3 *db = pParse->db; /* Database handle */
@@ -152537,31 +153131,33 @@
152537153131
Vdbe *v, /* Vdbe to add scanstatus entry to */
152538153132
SrcList *pSrclist, /* FROM clause pLvl reads data from */
152539153133
WhereLevel *pLvl, /* Level to add scanstatus() entry for */
152540153134
int addrExplain /* Address of OP_Explain (or 0) */
152541153135
){
152542
- const char *zObj = 0;
152543
- WhereLoop *pLoop = pLvl->pWLoop;
152544
- int wsFlags = pLoop->wsFlags;
152545
- int viaCoroutine = 0;
152546
-
152547
- if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152548
- zObj = pLoop->u.btree.pIndex->zName;
152549
- }else{
152550
- zObj = pSrclist->a[pLvl->iFrom].zName;
152551
- viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152552
- }
152553
- sqlite3VdbeScanStatus(
152554
- v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152555
- );
152556
-
152557
- if( viaCoroutine==0 ){
152558
- if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152559
- sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152560
- }
152561
- if( wsFlags & WHERE_INDEXED ){
152562
- sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
153136
+ if( IS_STMT_SCANSTATUS( sqlite3VdbeDb(v) ) ){
153137
+ const char *zObj = 0;
153138
+ WhereLoop *pLoop = pLvl->pWLoop;
153139
+ int wsFlags = pLoop->wsFlags;
153140
+ int viaCoroutine = 0;
153141
+
153142
+ if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
153143
+ zObj = pLoop->u.btree.pIndex->zName;
153144
+ }else{
153145
+ zObj = pSrclist->a[pLvl->iFrom].zName;
153146
+ viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
153147
+ }
153148
+ sqlite3VdbeScanStatus(
153149
+ v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
153150
+ );
153151
+
153152
+ if( viaCoroutine==0 ){
153153
+ if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
153154
+ sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
153155
+ }
153156
+ if( wsFlags & WHERE_INDEXED ){
153157
+ sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
153158
+ }
152563153159
}
152564153160
}
152565153161
}
152566153162
#endif
152567153163
@@ -153254,31 +153850,29 @@
153254153850
** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into
153255153851
** an access of the index rather than the original table.
153256153852
*/
153257153853
static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
153258153854
int rc = WRC_Continue;
153855
+ int reg;
153259153856
struct CCurHint *pHint = pWalker->u.pCCurHint;
153260153857
if( pExpr->op==TK_COLUMN ){
153261153858
if( pExpr->iTable!=pHint->iTabCur ){
153262
- int reg = ++pWalker->pParse->nMem; /* Register for column value */
153263
- sqlite3ExprCode(pWalker->pParse, pExpr, reg);
153859
+ reg = ++pWalker->pParse->nMem; /* Register for column value */
153860
+ reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
153264153861
pExpr->op = TK_REGISTER;
153265153862
pExpr->iTable = reg;
153266153863
}else if( pHint->pIdx!=0 ){
153267153864
pExpr->iTable = pHint->iIdxCur;
153268153865
pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn);
153269153866
assert( pExpr->iColumn>=0 );
153270153867
}
153271
- }else if( pExpr->op==TK_AGG_FUNCTION ){
153272
- /* An aggregate function in the WHERE clause of a query means this must
153273
- ** be a correlated sub-query, and expression pExpr is an aggregate from
153274
- ** the parent context. Do not walk the function arguments in this case.
153275
- **
153276
- ** todo: It should be possible to replace this node with a TK_REGISTER
153277
- ** expression, as the result of the expression must be stored in a
153278
- ** register at this point. The same holds for TK_AGG_COLUMN nodes. */
153868
+ }else if( pExpr->pAggInfo ){
153279153869
rc = WRC_Prune;
153870
+ reg = ++pWalker->pParse->nMem; /* Register for column value */
153871
+ reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
153872
+ pExpr->op = TK_REGISTER;
153873
+ pExpr->iTable = reg;
153280153874
}
153281153875
return rc;
153282153876
}
153283153877
153284153878
/*
@@ -154170,11 +154764,11 @@
154170154764
** of entries in the tree, so basing the number of steps to try
154171154765
** on the estimated number of rows in the btree seems like a good
154172154766
** guess. */
154173154767
addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154174154768
(pIdx->aiRowLogEst[0]+9)/10);
154175
- if( pRangeStart ){
154769
+ if( pRangeStart || pRangeEnd ){
154176154770
sqlite3VdbeChangeP5(v, 1);
154177154771
sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154178154772
addrSeekScan = 0;
154179154773
}
154180154774
VdbeCoverage(v);
@@ -154211,20 +154805,11 @@
154211154805
*/
154212154806
nConstraint = nEq;
154213154807
assert( pLevel->p2==0 );
154214154808
if( pRangeEnd ){
154215154809
Expr *pRight = pRangeEnd->pExpr->pRight;
154216
- if( addrSeekScan ){
154217
- /* For a seek-scan that has a range on the lowest term of the index,
154218
- ** we have to make the top of the loop be code that sets the end
154219
- ** condition of the range. Otherwise, the OP_SeekScan might jump
154220
- ** over that initialization, leaving the range-end value set to the
154221
- ** range-start value, resulting in a wrong answer.
154222
- ** See ticket 5981a8c041a3c2f3 (2021-11-02).
154223
- */
154224
- pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154225
- }
154810
+ assert( addrSeekScan==0 );
154226154811
codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154227154812
whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154228154813
if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154229154814
&& sqlite3ExprCanBeNull(pRight)
154230154815
){
@@ -154254,11 +154839,11 @@
154254154839
}
154255154840
if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154256154841
if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154257154842
154258154843
/* Top of the loop body */
154259
- if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154844
+ pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154260154845
154261154846
/* Check if the index cursor is past the end of the range. */
154262154847
if( nConstraint ){
154263154848
if( regBignull ){
154264154849
/* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156896,13 +157481,16 @@
156896157481
pColRef->y.pTab = pTab;
156897157482
pItem->colUsed |= sqlite3ExprColUsed(pColRef);
156898157483
pRhs = sqlite3PExpr(pParse, TK_UPLUS,
156899157484
sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
156900157485
pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
156901
- if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
157486
+ if( pItem->fg.jointype & (JT_LEFT|JT_RIGHT) ){
157487
+ testcase( pItem->fg.jointype & JT_LEFT ); /* testtag-20230227a */
157488
+ testcase( pItem->fg.jointype & JT_RIGHT ); /* testtag-20230227b */
156902157489
joinType = EP_OuterON;
156903157490
}else{
157491
+ testcase( pItem->fg.jointype & JT_LTORJ ); /* testtag-20230227c */
156904157492
joinType = EP_InnerON;
156905157493
}
156906157494
sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
156907157495
whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
156908157496
}
@@ -157741,11 +158329,11 @@
157741158329
Parse *pParse,
157742158330
Index *pIdx, /* Automatic index to explain */
157743158331
int bPartial, /* True if pIdx is a partial index */
157744158332
int *pAddrExplain /* OUT: Address of OP_Explain */
157745158333
){
157746
- if( pParse->explain!=2 ){
158334
+ if( IS_STMT_SCANSTATUS(pParse->db) && pParse->explain!=2 ){
157747158335
Table *pTab = pIdx->pTable;
157748158336
const char *zSep = "";
157749158337
char *zText = 0;
157750158338
int ii = 0;
157751158339
sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157802,11 +158390,12 @@
157802158390
CollSeq *pColl; /* Collating sequence to on a column */
157803158391
WhereLoop *pLoop; /* The Loop object */
157804158392
char *zNotUsed; /* Extra space on the end of pIdx */
157805158393
Bitmask idxCols; /* Bitmap of columns used for indexing */
157806158394
Bitmask extraCols; /* Bitmap of additional columns */
157807
- u8 sentWarning = 0; /* True if a warnning has been issued */
158395
+ u8 sentWarning = 0; /* True if a warning has been issued */
158396
+ u8 useBloomFilter = 0; /* True to also add a Bloom filter */
157808158397
Expr *pPartial = 0; /* Partial Index Expression */
157809158398
int iContinue = 0; /* Jump here to skip excluded rows */
157810158399
SrcItem *pTabItem; /* FROM clause term being indexed */
157811158400
int addrCounter = 0; /* Address where integer counter is initialized */
157812158401
int regBase; /* Array of registers where record is assembled */
@@ -157872,11 +158461,15 @@
157872158461
** original table never needs to be accessed. Automatic indices must
157873158462
** be a covering index because the index will not be updated if the
157874158463
** original table changes and the index and table cannot both be used
157875158464
** if they go out of sync.
157876158465
*/
157877
- extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
158466
+ if( IsView(pTable) ){
158467
+ extraCols = ALLBITS;
158468
+ }else{
158469
+ extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
158470
+ }
157878158471
mxBitCol = MIN(BMS-1,pTable->nCol);
157879158472
testcase( pTable->nCol==BMS-1 );
157880158473
testcase( pTable->nCol==BMS-2 );
157881158474
for(i=0; i<mxBitCol; i++){
157882158475
if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157908,10 +158501,20 @@
157908158501
pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
157909158502
pColl = sqlite3ExprCompareCollSeq(pParse, pX);
157910158503
assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
157911158504
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
157912158505
n++;
158506
+ if( ALWAYS(pX->pLeft!=0)
158507
+ && sqlite3ExprAffinity(pX->pLeft)!=SQLITE_AFF_TEXT
158508
+ ){
158509
+ /* TUNING: only use a Bloom filter on an automatic index
158510
+ ** if one or more key columns has the ability to hold numeric
158511
+ ** values, since strings all have the same hash in the Bloom
158512
+ ** filter implementation and hence a Bloom filter on a text column
158513
+ ** is not usually helpful. */
158514
+ useBloomFilter = 1;
158515
+ }
157913158516
}
157914158517
}
157915158518
}
157916158519
assert( (u32)n==pLoop->u.btree.nEq );
157917158520
@@ -157940,11 +158543,12 @@
157940158543
assert( pLevel->iIdxCur>=0 );
157941158544
pLevel->iIdxCur = pParse->nTab++;
157942158545
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
157943158546
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
157944158547
VdbeComment((v, "for %s", pTable->zName));
157945
- if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
158548
+ if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) && useBloomFilter ){
158549
+ sqlite3WhereExplainBloomFilter(pParse, pWC->pWInfo, pLevel);
157946158550
pLevel->regFilter = ++pParse->nMem;
157947158551
sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
157948158552
}
157949158553
157950158554
/* Fill the automatic index with content */
@@ -158033,10 +158637,14 @@
158033158637
const WhereTerm *pWCEnd; /* Last WHERE clause term */
158034158638
Parse *pParse = pWInfo->pParse; /* Parsing context */
158035158639
Vdbe *v = pParse->pVdbe; /* VDBE under construction */
158036158640
WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
158037158641
int iCur; /* Cursor for table getting the filter */
158642
+ IndexedExpr *saved_pIdxEpr; /* saved copy of Parse.pIdxEpr */
158643
+
158644
+ saved_pIdxEpr = pParse->pIdxEpr;
158645
+ pParse->pIdxEpr = 0;
158038158646
158039158647
assert( pLoop!=0 );
158040158648
assert( v!=0 );
158041158649
assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158042158650
@@ -158089,13 +158697,12 @@
158089158697
Index *pIdx = pLoop->u.btree.pIndex;
158090158698
int n = pLoop->u.btree.nEq;
158091158699
int r1 = sqlite3GetTempRange(pParse, n);
158092158700
int jj;
158093158701
for(jj=0; jj<n; jj++){
158094
- int iCol = pIdx->aiColumn[jj];
158095158702
assert( pIdx->pTable==pItem->pTab );
158096
- sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
158703
+ sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iCur, jj, r1+jj);
158097158704
}
158098158705
sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158099158706
sqlite3ReleaseTempRange(pParse, r1, n);
158100158707
}
158101158708
sqlite3VdbeResolveLabel(v, addrCont);
@@ -158122,10 +158729,11 @@
158122158729
break;
158123158730
}
158124158731
}
158125158732
}while( iLevel < pWInfo->nLevel );
158126158733
sqlite3VdbeJumpHere(v, addrOnce);
158734
+ pParse->pIdxEpr = saved_pIdxEpr;
158127158735
}
158128158736
158129158737
158130158738
#ifndef SQLITE_OMIT_VIRTUALTABLE
158131158739
/*
@@ -158377,10 +158985,13 @@
158377158985
sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc));
158378158986
}else{
158379158987
sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg);
158380158988
}
158381158989
}
158990
+ if( pTab->u.vtab.p->bAllSchemas ){
158991
+ sqlite3VtabUsesAllSchemas(pParse);
158992
+ }
158382158993
sqlite3_free(pVtab->zErrMsg);
158383158994
pVtab->zErrMsg = 0;
158384158995
return rc;
158385158996
}
158386158997
#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
@@ -158420,10 +159031,11 @@
158420159031
UNUSED_PARAMETER( pParse );
158421159032
#endif
158422159033
assert( pRec!=0 );
158423159034
assert( pIdx->nSample>0 );
158424159035
assert( pRec->nField>0 );
159036
+
158425159037
158426159038
/* Do a binary search to find the first sample greater than or equal
158427159039
** to pRec. If pRec contains a single field, the set of samples to search
158428159040
** is simply the aSample[] array. If the samples in aSample[] contain more
158429159041
** than one fields, all fields following the first are ignored.
@@ -158465,11 +159077,16 @@
158465159077
** appears that it should be 1 field in size. However, that would make it
158466159078
** smaller than sample 1, so the binary search would not work. As a result,
158467159079
** it is extended to two fields. The duplicates that this creates do not
158468159080
** cause any problems.
158469159081
*/
158470
- nField = MIN(pRec->nField, pIdx->nSample);
159082
+ if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
159083
+ nField = pIdx->nKeyCol;
159084
+ }else{
159085
+ nField = pIdx->nColumn;
159086
+ }
159087
+ nField = MIN(pRec->nField, nField);
158471159088
iCol = 0;
158472159089
iSample = pIdx->nSample * nField;
158473159090
do{
158474159091
int iSamp; /* Index in aSample[] of test sample */
158475159092
int n; /* Number of fields in test sample */
@@ -158901,11 +159518,11 @@
158901159518
#else
158902159519
UNUSED_PARAMETER(pParse);
158903159520
UNUSED_PARAMETER(pBuilder);
158904159521
assert( pLower || pUpper );
158905159522
#endif
158906
- assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );
159523
+ assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 || pParse->nErr>0 );
158907159524
nNew = whereRangeAdjust(pLower, nOut);
158908159525
nNew = whereRangeAdjust(pUpper, nNew);
158909159526
158910159527
/* TUNING: If there is both an upper and lower limit and neither limit
158911159528
** has an application-defined likelihood(), assume the range is
@@ -161002,24 +161619,20 @@
161002161619
HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
161003161620
assert( pHidden->eDistinct>=0 && pHidden->eDistinct<=3 );
161004161621
return pHidden->eDistinct;
161005161622
}
161006161623
161007
-#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
161008
- && !defined(SQLITE_OMIT_VIRTUALTABLE)
161009161624
/*
161010161625
** Cause the prepared statement that is associated with a call to
161011161626
** xBestIndex to potentially use all schemas. If the statement being
161012161627
** prepared is read-only, then just start read transactions on all
161013161628
** schemas. But if this is a write operation, start writes on all
161014161629
** schemas.
161015161630
**
161016161631
** This is used by the (built-in) sqlite_dbpage virtual table.
161017161632
*/
161018
-SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info *pIdxInfo){
161019
- HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
161020
- Parse *pParse = pHidden->pParse;
161633
+SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse *pParse){
161021161634
int nDb = pParse->db->nDb;
161022161635
int i;
161023161636
for(i=0; i<nDb; i++){
161024161637
sqlite3CodeVerifySchema(pParse, i);
161025161638
}
@@ -161027,11 +161640,10 @@
161027161640
for(i=0; i<nDb; i++){
161028161641
sqlite3BeginWriteOperation(pParse, 0, i);
161029161642
}
161030161643
}
161031161644
}
161032
-#endif
161033161645
161034161646
/*
161035161647
** Add all WhereLoop objects for a table of the join identified by
161036161648
** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
161037161649
**
@@ -162193,10 +162805,14 @@
162193162805
pWInfo->nOBSat = pFrom->isOrdered;
162194162806
if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162195162807
if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162196162808
pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162197162809
}
162810
+ if( pWInfo->pSelect->pOrderBy
162811
+ && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){
162812
+ pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr;
162813
+ }
162198162814
}else{
162199162815
pWInfo->revMask = pFrom->revLoop;
162200162816
if( pWInfo->nOBSat<=0 ){
162201162817
pWInfo->nOBSat = 0;
162202162818
if( nLoop>0 ){
@@ -163122,11 +163738,11 @@
163122163738
for(; b; b=b>>1, n++){}
163123163739
sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163124163740
assert( n<=pTab->nCol );
163125163741
}
163126163742
#ifdef SQLITE_ENABLE_CURSOR_HINTS
163127
- if( pLoop->u.btree.pIndex!=0 ){
163743
+ if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){
163128163744
sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163129163745
}else
163130163746
#endif
163131163747
{
163132163748
sqlite3VdbeChangeP5(v, bFordelete);
@@ -163580,11 +164196,12 @@
163580164196
}
163581164197
}
163582164198
k = pLevel->addrBody + 1;
163583164199
#ifdef SQLITE_DEBUG
163584164200
if( db->flags & SQLITE_VdbeAddopTrace ){
163585
- printf("TRANSLATE opcodes in range %d..%d\n", k, last-1);
164201
+ printf("TRANSLATE cursor %d->%d in opcode range %d..%d\n",
164202
+ pLevel->iTabCur, pLevel->iIdxCur, k, last-1);
163586164203
}
163587164204
/* Proof that the "+1" on the k value above is safe */
163588164205
pOp = sqlite3VdbeGetOp(v, k - 1);
163589164206
assert( pOp->opcode!=OP_Column || pOp->p1!=pLevel->iTabCur );
163590164207
assert( pOp->opcode!=OP_Rowid || pOp->p1!=pLevel->iTabCur );
@@ -167283,22 +167900,22 @@
167283167900
#define sqlite3ParserCTX_PDECL ,Parse *pParse
167284167901
#define sqlite3ParserCTX_PARAM ,pParse
167285167902
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167286167903
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167287167904
#define YYFALLBACK 1
167288
-#define YYNSTATE 576
167289
-#define YYNRULE 405
167290
-#define YYNRULE_WITH_ACTION 342
167905
+#define YYNSTATE 575
167906
+#define YYNRULE 403
167907
+#define YYNRULE_WITH_ACTION 341
167291167908
#define YYNTOKEN 185
167292
-#define YY_MAX_SHIFT 575
167293
-#define YY_MIN_SHIFTREDUCE 835
167294
-#define YY_MAX_SHIFTREDUCE 1239
167295
-#define YY_ERROR_ACTION 1240
167296
-#define YY_ACCEPT_ACTION 1241
167297
-#define YY_NO_ACTION 1242
167298
-#define YY_MIN_REDUCE 1243
167299
-#define YY_MAX_REDUCE 1647
167909
+#define YY_MAX_SHIFT 574
167910
+#define YY_MIN_SHIFTREDUCE 833
167911
+#define YY_MAX_SHIFTREDUCE 1235
167912
+#define YY_ERROR_ACTION 1236
167913
+#define YY_ACCEPT_ACTION 1237
167914
+#define YY_NO_ACTION 1238
167915
+#define YY_MIN_REDUCE 1239
167916
+#define YY_MAX_REDUCE 1641
167300167917
/************* End control #defines *******************************************/
167301167918
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167302167919
167303167920
/* Define the yytestcase() macro to be a no-op if is not already defined
167304167921
** otherwise.
@@ -167361,222 +167978,222 @@
167361167978
** yy_reduce_ofst[] For each state, the offset into yy_action for
167362167979
** shifting non-terminals after a reduce.
167363167980
** yy_default[] Default action for each state.
167364167981
**
167365167982
*********** Begin parsing tables **********************************************/
167366
-#define YY_ACTTAB_COUNT (2098)
167983
+#define YY_ACTTAB_COUNT (2096)
167367167984
static const YYACTIONTYPE yy_action[] = {
167368167985
/* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167369
- /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409,
167370
- /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71,
167371
- /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972,
167372
- /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053,
167373
- /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409,
167374
- /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229,
167375
- /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327,
167376
- /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053,
167377
- /* 90 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 118, 115,
167986
+ /* 10 */ 568, 1310, 377, 1289, 408, 562, 562, 562, 568, 409,
167987
+ /* 20 */ 378, 1310, 1272, 41, 41, 41, 41, 208, 1521, 71,
167988
+ /* 30 */ 71, 969, 419, 41, 41, 491, 303, 279, 303, 970,
167989
+ /* 40 */ 397, 71, 71, 125, 126, 80, 1213, 1213, 1047, 1050,
167990
+ /* 50 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 476, 409,
167991
+ /* 60 */ 1237, 1, 1, 574, 2, 1241, 550, 118, 115, 229,
167992
+ /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1323,
167993
+ /* 80 */ 417, 523, 142, 125, 126, 80, 1213, 1213, 1047, 1050,
167994
+ /* 90 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 118, 115,
167378167995
/* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167379167996
/* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167380
- /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565,
167381
- /* 130 */ 409, 1567, 537, 259, 226, 444, 101, 145, 449, 316,
167997
+ /* 120 */ 442, 1562, 376, 1564, 1189, 375, 1160, 565, 1160, 565,
167998
+ /* 130 */ 409, 1562, 537, 259, 226, 444, 101, 145, 449, 316,
167382167999
/* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
167383
- /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050,
167384
- /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142,
167385
- /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444,
167386
- /* 180 */ 127, 1192, 1193, 1194, 148, 441, 440, 568, 119, 116,
168000
+ /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1213, 1213, 1047,
168001
+ /* 160 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 142,
168002
+ /* 170 */ 294, 1189, 339, 448, 120, 120, 120, 119, 116, 444,
168003
+ /* 180 */ 127, 1189, 1190, 1189, 148, 441, 440, 568, 119, 116,
167387168004
/* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
167388168005
/* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
167389168006
/* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
167390
- /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193,
167391
- /* 230 */ 1194, 149, 1224, 409, 1224, 124, 124, 124, 124, 122,
168007
+ /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1189, 1190,
168008
+ /* 230 */ 1189, 149, 1220, 409, 1220, 124, 124, 124, 124, 122,
167392168009
/* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167393
- /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80,
167394
- /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124,
167395
- /* 270 */ 124, 124, 1279, 522, 222, 1192, 568, 409, 224, 514,
168010
+ /* 250 */ 444, 465, 342, 1034, 1034, 1048, 1051, 125, 126, 80,
168011
+ /* 260 */ 1213, 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124,
168012
+ /* 270 */ 124, 124, 1275, 522, 222, 1189, 568, 409, 224, 514,
167396168013
/* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
167397
- /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133,
167398
- /* 300 */ 133, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, 1040,
168014
+ /* 290 */ 120, 120, 119, 116, 444, 1005, 16, 16, 1189, 133,
168015
+ /* 300 */ 133, 125, 126, 80, 1213, 1213, 1047, 1050, 1037, 1037,
167399168016
/* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
167400
- /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546,
167401
- /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501,
167402
- /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340,
167403
- /* 350 */ 460, 328, 360, 394, 1237, 1192, 1193, 1194, 563, 568,
168017
+ /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1038, 546,
168018
+ /* 330 */ 1189, 373, 1189, 1190, 1189, 252, 1429, 399, 504, 501,
168019
+ /* 340 */ 500, 111, 560, 566, 4, 924, 924, 433, 499, 340,
168020
+ /* 350 */ 460, 328, 360, 394, 1233, 1189, 1190, 1189, 563, 568,
167404168021
/* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
167405
- /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154,
167406
- /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194,
167407
- /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222,
167408
- /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050,
167409
- /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550,
167410
- /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109,
167411
- /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570,
167412
- /* 440 */ 569, 430, 1552, 1017, 325, 551, 1192, 270, 287, 368,
168022
+ /* 370 */ 116, 444, 284, 284, 369, 1575, 1601, 441, 440, 154,
168023
+ /* 380 */ 409, 445, 71, 71, 1282, 565, 1217, 1189, 1190, 1189,
168024
+ /* 390 */ 85, 1219, 271, 557, 543, 515, 1556, 568, 98, 1218,
168025
+ /* 400 */ 6, 1274, 472, 142, 125, 126, 80, 1213, 1213, 1047,
168026
+ /* 410 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 550,
168027
+ /* 420 */ 13, 13, 1024, 507, 1220, 1189, 1220, 549, 109, 109,
168028
+ /* 430 */ 222, 568, 1234, 175, 568, 427, 110, 197, 445, 569,
168029
+ /* 440 */ 445, 430, 1547, 1014, 325, 551, 1189, 270, 287, 368,
167413168030
/* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
167414
- /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120,
167415
- /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27,
167416
- /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901,
167417
- /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516,
167418
- /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51,
167419
- /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040,
167420
- /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135,
167421
- /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120,
167422
- /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561,
167423
- /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217,
167424
- /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167425
- /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167426
- /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267,
167427
- /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571,
167428
- /* 600 */ 1192, 571, 409, 292, 499, 957, 876, 191, 480, 316,
168031
+ /* 460 */ 316, 559, 1607, 122, 122, 122, 122, 121, 121, 120,
168032
+ /* 470 */ 120, 120, 119, 116, 444, 1014, 1014, 1016, 1017, 27,
168033
+ /* 480 */ 284, 284, 1189, 1190, 1189, 1155, 568, 1606, 409, 899,
168034
+ /* 490 */ 190, 550, 356, 565, 550, 935, 533, 517, 1155, 516,
168035
+ /* 500 */ 413, 1155, 552, 1189, 1190, 1189, 568, 544, 1549, 51,
168036
+ /* 510 */ 51, 214, 125, 126, 80, 1213, 1213, 1047, 1050, 1037,
168037
+ /* 520 */ 1037, 123, 123, 124, 124, 124, 124, 1189, 474, 135,
168038
+ /* 530 */ 135, 409, 284, 284, 1485, 505, 121, 121, 120, 120,
168039
+ /* 540 */ 120, 119, 116, 444, 1005, 565, 518, 217, 541, 1556,
168040
+ /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1213, 1213,
168041
+ /* 560 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
168042
+ /* 570 */ 1550, 122, 122, 122, 122, 121, 121, 120, 120, 120,
168043
+ /* 580 */ 119, 116, 444, 485, 1189, 1190, 1189, 482, 281, 1263,
168044
+ /* 590 */ 955, 252, 1189, 373, 504, 501, 500, 1189, 340, 570,
168045
+ /* 600 */ 1189, 570, 409, 292, 499, 955, 874, 191, 480, 316,
167429168046
/* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
167430
- /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167431
- /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167432
- /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192,
167433
- /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194,
167434
- /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217,
167435
- /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167436
- /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121,
167437
- /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192,
167438
- /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232,
167439
- /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580,
167440
- /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121,
167441
- /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167442
- /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167443
- /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192,
167444
- /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568,
167445
- /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217,
167446
- /* 780 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
168047
+ /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168048
+ /* 630 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168049
+ /* 640 */ 124, 409, 394, 1133, 1189, 867, 100, 284, 284, 1189,
168050
+ /* 650 */ 1190, 1189, 373, 1090, 1189, 1190, 1189, 1189, 1190, 1189,
168051
+ /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1213, 1213,
168052
+ /* 670 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
168053
+ /* 680 */ 1428, 957, 568, 228, 956, 122, 122, 122, 122, 121,
168054
+ /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1155, 228, 1189,
168055
+ /* 700 */ 157, 1189, 1190, 1189, 1548, 13, 13, 301, 955, 1228,
168056
+ /* 710 */ 1155, 153, 409, 1155, 373, 1578, 1173, 5, 369, 1575,
168057
+ /* 720 */ 429, 1234, 3, 955, 122, 122, 122, 122, 121, 121,
168058
+ /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168059
+ /* 740 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168060
+ /* 750 */ 124, 409, 208, 567, 1189, 1025, 1189, 1190, 1189, 1189,
168061
+ /* 760 */ 388, 850, 155, 1547, 286, 402, 1095, 1095, 488, 568,
168062
+ /* 770 */ 465, 342, 1315, 1315, 1547, 125, 126, 80, 1213, 1213,
168063
+ /* 780 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167447168064
/* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
167448168065
/* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
167449
- /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297,
167450
- /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200,
167451
- /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121,
167452
- /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167453
- /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167454
- /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278,
167455
- /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568,
167456
- /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217,
167457
- /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167458
- /* 900 */ 453, 1482, 13, 13, 1536, 122, 122, 122, 122, 121,
168066
+ /* 810 */ 528, 1189, 1190, 1189, 13, 13, 1189, 1190, 1189, 1293,
168067
+ /* 820 */ 463, 1263, 409, 1313, 1313, 1547, 1010, 453, 452, 200,
168068
+ /* 830 */ 299, 71, 71, 1261, 122, 122, 122, 122, 121, 121,
168069
+ /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168070
+ /* 850 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168071
+ /* 860 */ 124, 409, 227, 1070, 1155, 284, 284, 419, 312, 278,
168072
+ /* 870 */ 278, 285, 285, 1415, 406, 405, 382, 1155, 565, 568,
168073
+ /* 880 */ 1155, 1192, 565, 1595, 565, 125, 126, 80, 1213, 1213,
168074
+ /* 890 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
168075
+ /* 900 */ 453, 1477, 13, 13, 1531, 122, 122, 122, 122, 121,
167459168076
/* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
167460
- /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212,
167461
- /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1327, 9, 1196,
168077
+ /* 920 */ 1581, 574, 2, 1241, 838, 839, 840, 1557, 317, 1208,
168078
+ /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1323, 9, 1192,
167462168079
/* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
167463
- /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167464
- /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167465
- /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245,
167466
- /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643,
167467
- /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240,
167468
- /* 1000 */ 1325, 104, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123,
168080
+ /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168081
+ /* 960 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168082
+ /* 970 */ 124, 568, 284, 284, 568, 1209, 409, 573, 313, 1241,
168083
+ /* 980 */ 349, 1292, 352, 419, 317, 565, 146, 491, 525, 1637,
168084
+ /* 990 */ 395, 371, 491, 1323, 70, 70, 1291, 71, 71, 240,
168085
+ /* 1000 */ 1321, 104, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123,
167469168086
/* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
167470
- /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284,
167471
- /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311,
167472
- /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538,
167473
- /* 1050 */ 568, 972, 207, 568, 1027, 240, 383, 1116, 519, 122,
168087
+ /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1111, 284, 284,
168088
+ /* 1030 */ 428, 448, 1520, 1209, 439, 284, 284, 1484, 1348, 311,
168089
+ /* 1040 */ 474, 565, 1112, 969, 491, 491, 217, 1259, 565, 1533,
168090
+ /* 1050 */ 568, 970, 207, 568, 1024, 240, 383, 1113, 519, 122,
167474168091
/* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167475
- /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568,
167476
- /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326,
167477
- /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497,
167478
- /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019,
167479
- /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217,
167480
- /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167481
- /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217,
167482
- /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167483
- /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217,
167484
- /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167485
- /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121,
167486
- /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568,
167487
- /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121,
167488
- /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642,
167489
- /* 1210 */ 539, 1642, 15, 15, 892, 122, 122, 122, 122, 121,
168092
+ /* 1070 */ 444, 1015, 107, 71, 71, 1014, 13, 13, 910, 568,
168093
+ /* 1080 */ 1490, 568, 284, 284, 97, 526, 491, 448, 911, 1322,
168094
+ /* 1090 */ 1318, 545, 409, 284, 284, 565, 151, 209, 1490, 1492,
168095
+ /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1014, 1014, 1016,
168096
+ /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1213,
168097
+ /* 1120 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168098
+ /* 1130 */ 124, 347, 409, 862, 1529, 1209, 125, 126, 80, 1213,
168099
+ /* 1140 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168100
+ /* 1150 */ 124, 1134, 1635, 474, 1635, 371, 125, 114, 80, 1213,
168101
+ /* 1160 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168102
+ /* 1170 */ 124, 1490, 329, 474, 331, 122, 122, 122, 122, 121,
168103
+ /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1415, 568,
168104
+ /* 1190 */ 1290, 862, 464, 1209, 436, 122, 122, 122, 122, 121,
168105
+ /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1134, 1636,
168106
+ /* 1210 */ 539, 1636, 15, 15, 890, 122, 122, 122, 122, 121,
167490168107
/* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
167491
- /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268,
167492
- /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457,
167493
- /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407,
167494
- /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123,
167495
- /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419,
167496
- /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849,
167497
- /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557,
167498
- /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431,
167499
- /* 1310 */ 568, 1158, 322, 17, 487, 1115, 58, 58, 122, 122,
168108
+ /* 1230 */ 1132, 1415, 1554, 1555, 1327, 409, 6, 6, 1166, 1264,
168109
+ /* 1240 */ 415, 320, 284, 284, 1415, 508, 565, 525, 300, 457,
168110
+ /* 1250 */ 43, 43, 568, 891, 12, 565, 330, 478, 425, 407,
168111
+ /* 1260 */ 126, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123, 123,
168112
+ /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1189, 1415,
168113
+ /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1132, 1553, 847,
168114
+ /* 1290 */ 1166, 407, 6, 568, 321, 1155, 470, 44, 44, 1552,
168115
+ /* 1300 */ 1111, 426, 234, 6, 323, 256, 540, 256, 1155, 431,
168116
+ /* 1310 */ 568, 1155, 322, 17, 487, 1112, 58, 58, 122, 122,
167500168117
/* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
167501
- /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560,
168118
+ /* 1330 */ 1113, 216, 481, 59, 59, 1189, 1190, 1189, 111, 560,
167502168119
/* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
167503
- /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095,
167504
- /* 1360 */ 568, 293, 568, 1095, 531, 568, 872, 8, 60, 60,
168120
+ /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1092,
168121
+ /* 1360 */ 568, 293, 568, 1092, 531, 568, 870, 8, 60, 60,
167505168122
/* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
167506168123
/* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
167507168124
/* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
167508
- /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534,
167509
- /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027,
167510
- /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66,
167511
- /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177,
167512
- /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471,
167513
- /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407,
167514
- /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52,
167515
- /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447,
167516
- /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391,
167517
- /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466,
167518
- /* 1500 */ 4, 568, 152, 30, 38, 568, 1132, 234, 396, 323,
168125
+ /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1024, 568, 534,
168126
+ /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1024,
168127
+ /* 1420 */ 568, 512, 930, 870, 1015, 109, 109, 929, 1014, 66,
168128
+ /* 1430 */ 66, 131, 131, 110, 451, 445, 569, 445, 416, 177,
168129
+ /* 1440 */ 1014, 132, 132, 67, 67, 568, 467, 568, 930, 471,
168130
+ /* 1450 */ 1360, 283, 226, 929, 315, 1359, 407, 568, 459, 407,
168131
+ /* 1460 */ 1014, 1014, 1016, 239, 407, 86, 213, 1346, 52, 52,
168132
+ /* 1470 */ 68, 68, 1014, 1014, 1016, 1017, 27, 1580, 1177, 447,
168133
+ /* 1480 */ 69, 69, 288, 97, 108, 1536, 106, 392, 392, 391,
168134
+ /* 1490 */ 273, 389, 568, 877, 847, 881, 568, 111, 560, 466,
168135
+ /* 1500 */ 4, 568, 152, 30, 38, 568, 1129, 234, 396, 323,
167519168136
/* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
167520168137
/* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
167521
- /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483,
167522
- /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557,
167523
- /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161,
167524
- /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009,
167525
- /* 1570 */ 473, 261, 261, 891, 890, 235, 535, 568, 1027, 568,
168138
+ /* 1530 */ 568, 289, 1509, 568, 31, 1508, 568, 445, 338, 483,
168139
+ /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1077, 557,
168140
+ /* 1550 */ 445, 877, 1356, 134, 134, 168, 73, 73, 141, 161,
168141
+ /* 1560 */ 161, 1569, 557, 535, 568, 319, 568, 348, 536, 1007,
168142
+ /* 1570 */ 473, 261, 261, 889, 888, 235, 535, 568, 1024, 568,
167526168143
/* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
167527
- /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017,
167528
- /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569,
167529
- /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568,
167530
- /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355,
167531
- /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451,
167532
- /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180,
167533
- /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392,
167534
- /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258,
167535
- /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261,
167536
- /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74,
167537
- /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974,
167538
- /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346,
167539
- /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253,
167540
- /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141,
167541
- /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219,
167542
- /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110,
167543
- /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365,
167544
- /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109,
167545
- /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570,
167546
- /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017,
167547
- /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4,
167548
- /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461,
167549
- /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27,
167550
- /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36,
167551
- /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246,
167552
- /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350,
167553
- /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4,
167554
- /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520,
167555
- /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281,
167556
- /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438,
167557
- /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10,
167558
- /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314,
167559
- /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386,
167560
- /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519,
167561
- /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147,
167562
- /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212,
167563
- /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088,
167564
- /* 1960 */ 326, 180, 169, 1212, 182, 334, 238, 915, 241, 1104,
168144
+ /* 1590 */ 130, 1024, 110, 366, 445, 569, 445, 109, 109, 1014,
168145
+ /* 1600 */ 162, 162, 156, 156, 568, 110, 1077, 445, 569, 445,
168146
+ /* 1610 */ 410, 351, 1014, 568, 353, 316, 559, 568, 343, 568,
168147
+ /* 1620 */ 100, 497, 357, 258, 100, 896, 897, 140, 140, 355,
168148
+ /* 1630 */ 1306, 1014, 1014, 1016, 1017, 27, 139, 139, 362, 451,
168149
+ /* 1640 */ 137, 137, 138, 138, 1014, 1014, 1016, 1017, 27, 1177,
168150
+ /* 1650 */ 447, 568, 372, 288, 111, 560, 1018, 4, 392, 392,
168151
+ /* 1660 */ 391, 273, 389, 568, 1138, 847, 568, 1073, 568, 258,
168152
+ /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 960, 234, 261,
168153
+ /* 1680 */ 323, 111, 560, 927, 4, 113, 77, 77, 322, 74,
168154
+ /* 1690 */ 74, 42, 42, 1369, 445, 48, 48, 1414, 563, 972,
168155
+ /* 1700 */ 973, 1089, 1088, 1089, 1088, 860, 557, 150, 928, 1342,
168156
+ /* 1710 */ 113, 1354, 554, 1419, 1018, 1271, 1262, 1250, 236, 1249,
168157
+ /* 1720 */ 1251, 445, 1588, 1339, 308, 276, 168, 309, 11, 141,
168158
+ /* 1730 */ 393, 310, 232, 557, 1401, 1024, 335, 291, 1396, 219,
168159
+ /* 1740 */ 336, 109, 109, 934, 297, 1406, 235, 341, 477, 110,
168160
+ /* 1750 */ 502, 445, 569, 445, 1389, 1405, 1014, 400, 1289, 365,
168161
+ /* 1760 */ 223, 1481, 1024, 1480, 1351, 1352, 1350, 1349, 109, 109,
168162
+ /* 1770 */ 204, 1591, 1228, 558, 265, 218, 110, 205, 445, 569,
168163
+ /* 1780 */ 445, 410, 387, 1014, 1528, 179, 316, 559, 1014, 1014,
168164
+ /* 1790 */ 1016, 1017, 27, 230, 1526, 1225, 79, 560, 85, 4,
168165
+ /* 1800 */ 418, 215, 548, 81, 84, 188, 1402, 173, 181, 461,
168166
+ /* 1810 */ 451, 35, 462, 563, 183, 1014, 1014, 1016, 1017, 27,
168167
+ /* 1820 */ 184, 1486, 185, 186, 495, 242, 98, 398, 1408, 36,
168168
+ /* 1830 */ 1407, 484, 91, 469, 401, 1410, 445, 192, 1475, 246,
168169
+ /* 1840 */ 1497, 490, 346, 277, 248, 196, 493, 511, 557, 350,
168170
+ /* 1850 */ 1252, 249, 250, 403, 1309, 1308, 111, 560, 432, 4,
168171
+ /* 1860 */ 1307, 1300, 93, 1605, 881, 1604, 224, 404, 434, 520,
168172
+ /* 1870 */ 263, 435, 1574, 563, 1279, 1278, 364, 1024, 306, 1277,
168173
+ /* 1880 */ 264, 1603, 1560, 109, 109, 370, 1299, 307, 1559, 438,
168174
+ /* 1890 */ 128, 110, 1374, 445, 569, 445, 445, 546, 1014, 10,
168175
+ /* 1900 */ 1461, 105, 381, 1373, 34, 571, 99, 1332, 557, 314,
168176
+ /* 1910 */ 1183, 530, 272, 274, 379, 210, 1331, 547, 385, 386,
168177
+ /* 1920 */ 275, 572, 1247, 1242, 411, 412, 1513, 165, 178, 1514,
168178
+ /* 1930 */ 1014, 1014, 1016, 1017, 27, 1512, 1511, 1024, 78, 147,
168179
+ /* 1940 */ 166, 220, 221, 109, 109, 834, 304, 167, 446, 212,
168180
+ /* 1950 */ 318, 110, 231, 445, 569, 445, 144, 1087, 1014, 1085,
168181
+ /* 1960 */ 326, 180, 169, 1208, 182, 334, 238, 913, 241, 1101,
167565168182
/* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
167566
- /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247,
167567
- /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489,
167568
- /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19,
167569
- /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159,
167570
- /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174,
167571
- /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260,
167572
- /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25,
167573
- /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055,
167574
- /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022,
167575
- /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925,
167576
- /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
167577
- /* 2090 */ 1242, 1242, 1242, 1242, 269, 1602, 1242, 1601,
168183
+ /* 1980 */ 172, 1104, 243, 1100, 244, 158, 18, 245, 345, 247,
168184
+ /* 1990 */ 1014, 1014, 1016, 1017, 27, 261, 1093, 193, 1222, 489,
168185
+ /* 2000 */ 194, 37, 366, 849, 494, 251, 195, 506, 92, 19,
168186
+ /* 2010 */ 498, 358, 20, 503, 879, 361, 94, 892, 305, 159,
168187
+ /* 2020 */ 513, 39, 95, 1171, 160, 1053, 964, 1140, 96, 174,
168188
+ /* 2030 */ 1139, 225, 280, 282, 198, 958, 113, 1161, 1157, 260,
168189
+ /* 2040 */ 21, 22, 23, 1159, 1165, 1164, 1145, 24, 33, 25,
168190
+ /* 2050 */ 202, 542, 26, 100, 1068, 102, 1054, 103, 7, 1052,
168191
+ /* 2060 */ 1056, 1110, 1057, 1109, 266, 267, 28, 40, 390, 1019,
168192
+ /* 2070 */ 861, 112, 29, 564, 1179, 1178, 268, 176, 143, 923,
168193
+ /* 2080 */ 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
168194
+ /* 2090 */ 1238, 1238, 1238, 1238, 269, 1596,
167578168195
};
167579168196
static const YYCODETYPE yy_lookahead[] = {
167580168197
/* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
167581168198
/* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
167582168199
/* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167784,11 +168401,11 @@
167784168401
/* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
167785168402
/* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
167786168403
/* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
167787168404
/* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
167788168405
/* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167789
- /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319,
168406
+ /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 319, 319, 319,
167790168407
/* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167791168408
/* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167792168409
/* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167793168410
/* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167794168411
/* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167803,13 +168420,13 @@
167803168420
/* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167804168421
/* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167805168422
/* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167806168423
/* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167807168424
/* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167808
- /* 2280 */ 319, 319, 319,
168425
+ /* 2280 */ 319,
167809168426
};
167810
-#define YY_SHIFT_COUNT (575)
168427
+#define YY_SHIFT_COUNT (574)
167811168428
#define YY_SHIFT_MIN (0)
167812168429
#define YY_SHIFT_MAX (2074)
167813168430
static const unsigned short int yy_shift_ofst[] = {
167814168431
/* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
167815168432
/* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167825,16 +168442,16 @@
167825168442
/* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167826168443
/* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167827168444
/* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
167828168445
/* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
167829168446
/* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
167830
- /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468,
168447
+ /* 160 */ 113, 22, 22, 2096, 2096, 328, 328, 328, 239, 468,
167831168448
/* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
167832168449
/* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167833168450
/* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
167834168451
/* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
167835
- /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307,
168452
+ /* 210 */ 67, 1274, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 1307,
167836168453
/* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
167837168454
/* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167838168455
/* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167839168456
/* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
167840168457
/* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167848,12 +168465,12 @@
167848168465
/* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
167849168466
/* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
167850168467
/* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
167851168468
/* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
167852168469
/* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
167853
- /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098,
167854
- /* 400 */ 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 207,
168470
+ /* 390 */ 1897, 1914, 1914, 1914, 2096, 2096, 2096, 2096, 2096, 2096,
168471
+ /* 400 */ 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 207,
167855168472
/* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
167856168473
/* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
167857168474
/* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
167858168475
/* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
167859168476
/* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167866,11 +168483,11 @@
167866168483
/* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
167867168484
/* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
167868168485
/* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
167869168486
/* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
167870168487
/* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
167871
- /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074,
168488
+ /* 570 */ 2052, 2055, 2053, 2073, 2074,
167872168489
};
167873168490
#define YY_REDUCE_COUNT (408)
167874168491
#define YY_REDUCE_MIN (-271)
167875168492
#define YY_REDUCE_MAX (1740)
167876168493
static const short yy_reduce_ofst[] = {
@@ -167915,68 +168532,68 @@
167915168532
/* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
167916168533
/* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
167917168534
/* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
167918168535
};
167919168536
static const YYACTIONTYPE yy_default[] = {
167920
- /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475,
167921
- /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240,
167922
- /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240,
167923
- /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240,
167924
- /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240,
167925
- /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403,
167926
- /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469,
167927
- /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240,
167928
- /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167929
- /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167930
- /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167931
- /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167932
- /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167933
- /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441,
167934
- /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240,
167935
- /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432,
167936
- /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240,
167937
- /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240,
167938
- /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167939
- /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371,
167940
- /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269,
167941
- /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240,
167942
- /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167943
- /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240,
167944
- /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167945
- /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167946
- /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240,
167947
- /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347,
167948
- /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639,
167949
- /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407,
167950
- /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371,
167951
- /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639,
167952
- /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324,
167953
- /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416,
167954
- /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258,
167955
- /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305,
167956
- /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581,
167957
- /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389,
167958
- /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595,
167959
- /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273,
167960
- /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240,
167961
- /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361,
167962
- /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167963
- /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240,
167964
- /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240,
167965
- /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362,
167966
- /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240,
167967
- /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167968
- /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240,
167969
- /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167970
- /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240,
167971
- /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167972
- /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386,
167973
- /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167974
- /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240,
167975
- /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167976
- /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422,
167977
- /* 570 */ 1426, 1262, 1240, 1252, 1240, 1240,
168537
+ /* 0 */ 1641, 1641, 1641, 1470, 1236, 1347, 1236, 1236, 1236, 1470,
168538
+ /* 10 */ 1470, 1470, 1236, 1377, 1377, 1523, 1269, 1236, 1236, 1236,
168539
+ /* 20 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1469, 1236, 1236,
168540
+ /* 30 */ 1236, 1236, 1558, 1558, 1236, 1236, 1236, 1236, 1236, 1236,
168541
+ /* 40 */ 1236, 1236, 1386, 1236, 1393, 1236, 1236, 1236, 1236, 1236,
168542
+ /* 50 */ 1471, 1472, 1236, 1236, 1236, 1522, 1524, 1487, 1400, 1399,
168543
+ /* 60 */ 1398, 1397, 1505, 1365, 1391, 1384, 1388, 1465, 1466, 1464,
168544
+ /* 70 */ 1468, 1472, 1471, 1236, 1387, 1433, 1449, 1432, 1236, 1236,
168545
+ /* 80 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168546
+ /* 90 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168547
+ /* 100 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168548
+ /* 110 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168549
+ /* 120 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168550
+ /* 130 */ 1441, 1448, 1447, 1446, 1455, 1445, 1442, 1435, 1434, 1436,
168551
+ /* 140 */ 1437, 1236, 1236, 1260, 1236, 1236, 1257, 1311, 1236, 1236,
168552
+ /* 150 */ 1236, 1236, 1236, 1542, 1541, 1236, 1438, 1236, 1269, 1427,
168553
+ /* 160 */ 1426, 1452, 1439, 1451, 1450, 1530, 1594, 1593, 1488, 1236,
168554
+ /* 170 */ 1236, 1236, 1236, 1236, 1236, 1558, 1236, 1236, 1236, 1236,
168555
+ /* 180 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168556
+ /* 190 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1367,
168557
+ /* 200 */ 1558, 1558, 1236, 1269, 1558, 1558, 1368, 1368, 1265, 1265,
168558
+ /* 210 */ 1371, 1236, 1537, 1338, 1338, 1338, 1338, 1347, 1338, 1236,
168559
+ /* 220 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168560
+ /* 230 */ 1236, 1236, 1236, 1236, 1527, 1525, 1236, 1236, 1236, 1236,
168561
+ /* 240 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168562
+ /* 250 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168563
+ /* 260 */ 1236, 1236, 1236, 1343, 1236, 1236, 1236, 1236, 1236, 1236,
168564
+ /* 270 */ 1236, 1236, 1236, 1236, 1236, 1587, 1236, 1500, 1325, 1343,
168565
+ /* 280 */ 1343, 1343, 1343, 1345, 1326, 1324, 1337, 1270, 1243, 1633,
168566
+ /* 290 */ 1403, 1392, 1344, 1392, 1630, 1390, 1403, 1403, 1390, 1403,
168567
+ /* 300 */ 1344, 1630, 1286, 1609, 1281, 1377, 1377, 1377, 1367, 1367,
168568
+ /* 310 */ 1367, 1367, 1371, 1371, 1467, 1344, 1337, 1236, 1633, 1633,
168569
+ /* 320 */ 1353, 1353, 1632, 1632, 1353, 1488, 1617, 1412, 1314, 1320,
168570
+ /* 330 */ 1320, 1320, 1320, 1353, 1254, 1390, 1617, 1617, 1390, 1412,
168571
+ /* 340 */ 1314, 1390, 1314, 1390, 1353, 1254, 1504, 1627, 1353, 1254,
168572
+ /* 350 */ 1478, 1353, 1254, 1353, 1254, 1478, 1312, 1312, 1312, 1301,
168573
+ /* 360 */ 1236, 1236, 1478, 1312, 1286, 1312, 1301, 1312, 1312, 1576,
168574
+ /* 370 */ 1236, 1482, 1482, 1478, 1353, 1568, 1568, 1380, 1380, 1385,
168575
+ /* 380 */ 1371, 1473, 1353, 1236, 1385, 1383, 1381, 1390, 1304, 1590,
168576
+ /* 390 */ 1590, 1586, 1586, 1586, 1638, 1638, 1537, 1602, 1269, 1269,
168577
+ /* 400 */ 1269, 1269, 1602, 1288, 1288, 1270, 1270, 1269, 1602, 1236,
168578
+ /* 410 */ 1236, 1236, 1236, 1236, 1236, 1597, 1236, 1532, 1489, 1357,
168579
+ /* 420 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168580
+ /* 430 */ 1236, 1236, 1236, 1236, 1543, 1236, 1236, 1236, 1236, 1236,
168581
+ /* 440 */ 1236, 1236, 1236, 1236, 1236, 1417, 1236, 1239, 1534, 1236,
168582
+ /* 450 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1394, 1395, 1358,
168583
+ /* 460 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1409, 1236, 1236,
168584
+ /* 470 */ 1236, 1404, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168585
+ /* 480 */ 1629, 1236, 1236, 1236, 1236, 1236, 1236, 1503, 1502, 1236,
168586
+ /* 490 */ 1236, 1355, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168587
+ /* 500 */ 1236, 1236, 1236, 1236, 1236, 1284, 1236, 1236, 1236, 1236,
168588
+ /* 510 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168589
+ /* 520 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1382,
168590
+ /* 530 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168591
+ /* 540 */ 1236, 1236, 1236, 1236, 1573, 1372, 1236, 1236, 1236, 1236,
168592
+ /* 550 */ 1620, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168593
+ /* 560 */ 1236, 1236, 1236, 1236, 1236, 1613, 1328, 1418, 1236, 1421,
168594
+ /* 570 */ 1258, 1236, 1248, 1236, 1236,
167978168595
};
167979168596
/********** End of lemon-generated parsing tables *****************************/
167980168597
167981168598
/* The next table maps tokens (terminal symbols) into fallback tokens.
167982168599
** If a construct like the following:
@@ -168769,237 +169386,235 @@
168769169386
/* 173 */ "idlist_opt ::=",
168770169387
/* 174 */ "idlist_opt ::= LP idlist RP",
168771169388
/* 175 */ "idlist ::= idlist COMMA nm",
168772169389
/* 176 */ "idlist ::= nm",
168773169390
/* 177 */ "expr ::= LP expr RP",
168774
- /* 178 */ "expr ::= ID|INDEXED",
168775
- /* 179 */ "expr ::= JOIN_KW",
168776
- /* 180 */ "expr ::= nm DOT nm",
168777
- /* 181 */ "expr ::= nm DOT nm DOT nm",
168778
- /* 182 */ "term ::= NULL|FLOAT|BLOB",
168779
- /* 183 */ "term ::= STRING",
168780
- /* 184 */ "term ::= INTEGER",
168781
- /* 185 */ "expr ::= VARIABLE",
168782
- /* 186 */ "expr ::= expr COLLATE ID|STRING",
168783
- /* 187 */ "expr ::= CAST LP expr AS typetoken RP",
168784
- /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
168785
- /* 189 */ "expr ::= ID|INDEXED LP STAR RP",
168786
- /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
168787
- /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
168788
- /* 192 */ "term ::= CTIME_KW",
168789
- /* 193 */ "expr ::= LP nexprlist COMMA expr RP",
168790
- /* 194 */ "expr ::= expr AND expr",
168791
- /* 195 */ "expr ::= expr OR expr",
168792
- /* 196 */ "expr ::= expr LT|GT|GE|LE expr",
168793
- /* 197 */ "expr ::= expr EQ|NE expr",
168794
- /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
168795
- /* 199 */ "expr ::= expr PLUS|MINUS expr",
168796
- /* 200 */ "expr ::= expr STAR|SLASH|REM expr",
168797
- /* 201 */ "expr ::= expr CONCAT expr",
168798
- /* 202 */ "likeop ::= NOT LIKE_KW|MATCH",
168799
- /* 203 */ "expr ::= expr likeop expr",
168800
- /* 204 */ "expr ::= expr likeop expr ESCAPE expr",
168801
- /* 205 */ "expr ::= expr ISNULL|NOTNULL",
168802
- /* 206 */ "expr ::= expr NOT NULL",
168803
- /* 207 */ "expr ::= expr IS expr",
168804
- /* 208 */ "expr ::= expr IS NOT expr",
168805
- /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr",
168806
- /* 210 */ "expr ::= expr IS DISTINCT FROM expr",
168807
- /* 211 */ "expr ::= NOT expr",
168808
- /* 212 */ "expr ::= BITNOT expr",
168809
- /* 213 */ "expr ::= PLUS|MINUS expr",
168810
- /* 214 */ "expr ::= expr PTR expr",
168811
- /* 215 */ "between_op ::= BETWEEN",
168812
- /* 216 */ "between_op ::= NOT BETWEEN",
168813
- /* 217 */ "expr ::= expr between_op expr AND expr",
168814
- /* 218 */ "in_op ::= IN",
168815
- /* 219 */ "in_op ::= NOT IN",
168816
- /* 220 */ "expr ::= expr in_op LP exprlist RP",
168817
- /* 221 */ "expr ::= LP select RP",
168818
- /* 222 */ "expr ::= expr in_op LP select RP",
168819
- /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist",
168820
- /* 224 */ "expr ::= EXISTS LP select RP",
168821
- /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END",
168822
- /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
168823
- /* 227 */ "case_exprlist ::= WHEN expr THEN expr",
168824
- /* 228 */ "case_else ::= ELSE expr",
168825
- /* 229 */ "case_else ::=",
168826
- /* 230 */ "case_operand ::= expr",
168827
- /* 231 */ "case_operand ::=",
168828
- /* 232 */ "exprlist ::=",
168829
- /* 233 */ "nexprlist ::= nexprlist COMMA expr",
168830
- /* 234 */ "nexprlist ::= expr",
168831
- /* 235 */ "paren_exprlist ::=",
168832
- /* 236 */ "paren_exprlist ::= LP exprlist RP",
168833
- /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
168834
- /* 238 */ "uniqueflag ::= UNIQUE",
168835
- /* 239 */ "uniqueflag ::=",
168836
- /* 240 */ "eidlist_opt ::=",
168837
- /* 241 */ "eidlist_opt ::= LP eidlist RP",
168838
- /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder",
168839
- /* 243 */ "eidlist ::= nm collate sortorder",
168840
- /* 244 */ "collate ::=",
168841
- /* 245 */ "collate ::= COLLATE ID|STRING",
168842
- /* 246 */ "cmd ::= DROP INDEX ifexists fullname",
168843
- /* 247 */ "cmd ::= VACUUM vinto",
168844
- /* 248 */ "cmd ::= VACUUM nm vinto",
168845
- /* 249 */ "vinto ::= INTO expr",
168846
- /* 250 */ "vinto ::=",
168847
- /* 251 */ "cmd ::= PRAGMA nm dbnm",
168848
- /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
168849
- /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
168850
- /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
168851
- /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
168852
- /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT",
168853
- /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT",
168854
- /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
168855
- /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
168856
- /* 260 */ "trigger_time ::= BEFORE|AFTER",
168857
- /* 261 */ "trigger_time ::= INSTEAD OF",
168858
- /* 262 */ "trigger_time ::=",
168859
- /* 263 */ "trigger_event ::= DELETE|INSERT",
168860
- /* 264 */ "trigger_event ::= UPDATE",
168861
- /* 265 */ "trigger_event ::= UPDATE OF idlist",
168862
- /* 266 */ "when_clause ::=",
168863
- /* 267 */ "when_clause ::= WHEN expr",
168864
- /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
168865
- /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI",
168866
- /* 270 */ "trnm ::= nm DOT nm",
168867
- /* 271 */ "tridxby ::= INDEXED BY nm",
168868
- /* 272 */ "tridxby ::= NOT INDEXED",
168869
- /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
168870
- /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
168871
- /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
168872
- /* 276 */ "trigger_cmd ::= scanpt select scanpt",
168873
- /* 277 */ "expr ::= RAISE LP IGNORE RP",
168874
- /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
168875
- /* 279 */ "raisetype ::= ROLLBACK",
168876
- /* 280 */ "raisetype ::= ABORT",
168877
- /* 281 */ "raisetype ::= FAIL",
168878
- /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
168879
- /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
168880
- /* 284 */ "cmd ::= DETACH database_kw_opt expr",
168881
- /* 285 */ "key_opt ::=",
168882
- /* 286 */ "key_opt ::= KEY expr",
168883
- /* 287 */ "cmd ::= REINDEX",
168884
- /* 288 */ "cmd ::= REINDEX nm dbnm",
168885
- /* 289 */ "cmd ::= ANALYZE",
168886
- /* 290 */ "cmd ::= ANALYZE nm dbnm",
168887
- /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
168888
- /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
168889
- /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
168890
- /* 294 */ "add_column_fullname ::= fullname",
168891
- /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
168892
- /* 296 */ "cmd ::= create_vtab",
168893
- /* 297 */ "cmd ::= create_vtab LP vtabarglist RP",
168894
- /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
168895
- /* 299 */ "vtabarg ::=",
168896
- /* 300 */ "vtabargtoken ::= ANY",
168897
- /* 301 */ "vtabargtoken ::= lp anylist RP",
168898
- /* 302 */ "lp ::= LP",
168899
- /* 303 */ "with ::= WITH wqlist",
168900
- /* 304 */ "with ::= WITH RECURSIVE wqlist",
168901
- /* 305 */ "wqas ::= AS",
168902
- /* 306 */ "wqas ::= AS MATERIALIZED",
168903
- /* 307 */ "wqas ::= AS NOT MATERIALIZED",
168904
- /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
168905
- /* 309 */ "wqlist ::= wqitem",
168906
- /* 310 */ "wqlist ::= wqlist COMMA wqitem",
168907
- /* 311 */ "windowdefn_list ::= windowdefn",
168908
- /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
168909
- /* 313 */ "windowdefn ::= nm AS LP window RP",
168910
- /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
168911
- /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
168912
- /* 316 */ "window ::= ORDER BY sortlist frame_opt",
168913
- /* 317 */ "window ::= nm ORDER BY sortlist frame_opt",
168914
- /* 318 */ "window ::= frame_opt",
168915
- /* 319 */ "window ::= nm frame_opt",
168916
- /* 320 */ "frame_opt ::=",
168917
- /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
168918
- /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
168919
- /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
168920
- /* 324 */ "frame_bound_s ::= frame_bound",
168921
- /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
168922
- /* 326 */ "frame_bound_e ::= frame_bound",
168923
- /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
168924
- /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
168925
- /* 329 */ "frame_bound ::= CURRENT ROW",
168926
- /* 330 */ "frame_exclude_opt ::=",
168927
- /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
168928
- /* 332 */ "frame_exclude ::= NO OTHERS",
168929
- /* 333 */ "frame_exclude ::= CURRENT ROW",
168930
- /* 334 */ "frame_exclude ::= GROUP|TIES",
168931
- /* 335 */ "window_clause ::= WINDOW windowdefn_list",
168932
- /* 336 */ "filter_over ::= filter_clause over_clause",
168933
- /* 337 */ "filter_over ::= over_clause",
168934
- /* 338 */ "filter_over ::= filter_clause",
168935
- /* 339 */ "over_clause ::= OVER LP window RP",
168936
- /* 340 */ "over_clause ::= OVER nm",
168937
- /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP",
168938
- /* 342 */ "input ::= cmdlist",
168939
- /* 343 */ "cmdlist ::= cmdlist ecmd",
168940
- /* 344 */ "cmdlist ::= ecmd",
168941
- /* 345 */ "ecmd ::= SEMI",
168942
- /* 346 */ "ecmd ::= cmdx SEMI",
168943
- /* 347 */ "ecmd ::= explain cmdx SEMI",
168944
- /* 348 */ "trans_opt ::=",
168945
- /* 349 */ "trans_opt ::= TRANSACTION",
168946
- /* 350 */ "trans_opt ::= TRANSACTION nm",
168947
- /* 351 */ "savepoint_opt ::= SAVEPOINT",
168948
- /* 352 */ "savepoint_opt ::=",
168949
- /* 353 */ "cmd ::= create_table create_table_args",
168950
- /* 354 */ "table_option_set ::= table_option",
168951
- /* 355 */ "columnlist ::= columnlist COMMA columnname carglist",
168952
- /* 356 */ "columnlist ::= columnname carglist",
168953
- /* 357 */ "nm ::= ID|INDEXED",
168954
- /* 358 */ "nm ::= STRING",
168955
- /* 359 */ "nm ::= JOIN_KW",
168956
- /* 360 */ "typetoken ::= typename",
168957
- /* 361 */ "typename ::= ID|STRING",
168958
- /* 362 */ "signed ::= plus_num",
168959
- /* 363 */ "signed ::= minus_num",
168960
- /* 364 */ "carglist ::= carglist ccons",
168961
- /* 365 */ "carglist ::=",
168962
- /* 366 */ "ccons ::= NULL onconf",
168963
- /* 367 */ "ccons ::= GENERATED ALWAYS AS generated",
168964
- /* 368 */ "ccons ::= AS generated",
168965
- /* 369 */ "conslist_opt ::= COMMA conslist",
168966
- /* 370 */ "conslist ::= conslist tconscomma tcons",
168967
- /* 371 */ "conslist ::= tcons",
168968
- /* 372 */ "tconscomma ::=",
168969
- /* 373 */ "defer_subclause_opt ::= defer_subclause",
168970
- /* 374 */ "resolvetype ::= raisetype",
168971
- /* 375 */ "selectnowith ::= oneselect",
168972
- /* 376 */ "oneselect ::= values",
168973
- /* 377 */ "sclp ::= selcollist COMMA",
168974
- /* 378 */ "as ::= ID|STRING",
168975
- /* 379 */ "indexed_opt ::= indexed_by",
168976
- /* 380 */ "returning ::=",
168977
- /* 381 */ "expr ::= term",
168978
- /* 382 */ "likeop ::= LIKE_KW|MATCH",
168979
- /* 383 */ "exprlist ::= nexprlist",
168980
- /* 384 */ "nmnum ::= plus_num",
168981
- /* 385 */ "nmnum ::= nm",
168982
- /* 386 */ "nmnum ::= ON",
168983
- /* 387 */ "nmnum ::= DELETE",
168984
- /* 388 */ "nmnum ::= DEFAULT",
168985
- /* 389 */ "plus_num ::= INTEGER|FLOAT",
168986
- /* 390 */ "foreach_clause ::=",
168987
- /* 391 */ "foreach_clause ::= FOR EACH ROW",
168988
- /* 392 */ "trnm ::= nm",
168989
- /* 393 */ "tridxby ::=",
168990
- /* 394 */ "database_kw_opt ::= DATABASE",
168991
- /* 395 */ "database_kw_opt ::=",
168992
- /* 396 */ "kwcolumn_opt ::=",
168993
- /* 397 */ "kwcolumn_opt ::= COLUMNKW",
168994
- /* 398 */ "vtabarglist ::= vtabarg",
168995
- /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
168996
- /* 400 */ "vtabarg ::= vtabarg vtabargtoken",
168997
- /* 401 */ "anylist ::=",
168998
- /* 402 */ "anylist ::= anylist LP anylist RP",
168999
- /* 403 */ "anylist ::= anylist ANY",
169000
- /* 404 */ "with ::=",
169391
+ /* 178 */ "expr ::= ID|INDEXED|JOIN_KW",
169392
+ /* 179 */ "expr ::= nm DOT nm",
169393
+ /* 180 */ "expr ::= nm DOT nm DOT nm",
169394
+ /* 181 */ "term ::= NULL|FLOAT|BLOB",
169395
+ /* 182 */ "term ::= STRING",
169396
+ /* 183 */ "term ::= INTEGER",
169397
+ /* 184 */ "expr ::= VARIABLE",
169398
+ /* 185 */ "expr ::= expr COLLATE ID|STRING",
169399
+ /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
169400
+ /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP",
169401
+ /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP",
169402
+ /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over",
169403
+ /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over",
169404
+ /* 191 */ "term ::= CTIME_KW",
169405
+ /* 192 */ "expr ::= LP nexprlist COMMA expr RP",
169406
+ /* 193 */ "expr ::= expr AND expr",
169407
+ /* 194 */ "expr ::= expr OR expr",
169408
+ /* 195 */ "expr ::= expr LT|GT|GE|LE expr",
169409
+ /* 196 */ "expr ::= expr EQ|NE expr",
169410
+ /* 197 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
169411
+ /* 198 */ "expr ::= expr PLUS|MINUS expr",
169412
+ /* 199 */ "expr ::= expr STAR|SLASH|REM expr",
169413
+ /* 200 */ "expr ::= expr CONCAT expr",
169414
+ /* 201 */ "likeop ::= NOT LIKE_KW|MATCH",
169415
+ /* 202 */ "expr ::= expr likeop expr",
169416
+ /* 203 */ "expr ::= expr likeop expr ESCAPE expr",
169417
+ /* 204 */ "expr ::= expr ISNULL|NOTNULL",
169418
+ /* 205 */ "expr ::= expr NOT NULL",
169419
+ /* 206 */ "expr ::= expr IS expr",
169420
+ /* 207 */ "expr ::= expr IS NOT expr",
169421
+ /* 208 */ "expr ::= expr IS NOT DISTINCT FROM expr",
169422
+ /* 209 */ "expr ::= expr IS DISTINCT FROM expr",
169423
+ /* 210 */ "expr ::= NOT expr",
169424
+ /* 211 */ "expr ::= BITNOT expr",
169425
+ /* 212 */ "expr ::= PLUS|MINUS expr",
169426
+ /* 213 */ "expr ::= expr PTR expr",
169427
+ /* 214 */ "between_op ::= BETWEEN",
169428
+ /* 215 */ "between_op ::= NOT BETWEEN",
169429
+ /* 216 */ "expr ::= expr between_op expr AND expr",
169430
+ /* 217 */ "in_op ::= IN",
169431
+ /* 218 */ "in_op ::= NOT IN",
169432
+ /* 219 */ "expr ::= expr in_op LP exprlist RP",
169433
+ /* 220 */ "expr ::= LP select RP",
169434
+ /* 221 */ "expr ::= expr in_op LP select RP",
169435
+ /* 222 */ "expr ::= expr in_op nm dbnm paren_exprlist",
169436
+ /* 223 */ "expr ::= EXISTS LP select RP",
169437
+ /* 224 */ "expr ::= CASE case_operand case_exprlist case_else END",
169438
+ /* 225 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
169439
+ /* 226 */ "case_exprlist ::= WHEN expr THEN expr",
169440
+ /* 227 */ "case_else ::= ELSE expr",
169441
+ /* 228 */ "case_else ::=",
169442
+ /* 229 */ "case_operand ::= expr",
169443
+ /* 230 */ "case_operand ::=",
169444
+ /* 231 */ "exprlist ::=",
169445
+ /* 232 */ "nexprlist ::= nexprlist COMMA expr",
169446
+ /* 233 */ "nexprlist ::= expr",
169447
+ /* 234 */ "paren_exprlist ::=",
169448
+ /* 235 */ "paren_exprlist ::= LP exprlist RP",
169449
+ /* 236 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
169450
+ /* 237 */ "uniqueflag ::= UNIQUE",
169451
+ /* 238 */ "uniqueflag ::=",
169452
+ /* 239 */ "eidlist_opt ::=",
169453
+ /* 240 */ "eidlist_opt ::= LP eidlist RP",
169454
+ /* 241 */ "eidlist ::= eidlist COMMA nm collate sortorder",
169455
+ /* 242 */ "eidlist ::= nm collate sortorder",
169456
+ /* 243 */ "collate ::=",
169457
+ /* 244 */ "collate ::= COLLATE ID|STRING",
169458
+ /* 245 */ "cmd ::= DROP INDEX ifexists fullname",
169459
+ /* 246 */ "cmd ::= VACUUM vinto",
169460
+ /* 247 */ "cmd ::= VACUUM nm vinto",
169461
+ /* 248 */ "vinto ::= INTO expr",
169462
+ /* 249 */ "vinto ::=",
169463
+ /* 250 */ "cmd ::= PRAGMA nm dbnm",
169464
+ /* 251 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
169465
+ /* 252 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
169466
+ /* 253 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
169467
+ /* 254 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
169468
+ /* 255 */ "plus_num ::= PLUS INTEGER|FLOAT",
169469
+ /* 256 */ "minus_num ::= MINUS INTEGER|FLOAT",
169470
+ /* 257 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
169471
+ /* 258 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
169472
+ /* 259 */ "trigger_time ::= BEFORE|AFTER",
169473
+ /* 260 */ "trigger_time ::= INSTEAD OF",
169474
+ /* 261 */ "trigger_time ::=",
169475
+ /* 262 */ "trigger_event ::= DELETE|INSERT",
169476
+ /* 263 */ "trigger_event ::= UPDATE",
169477
+ /* 264 */ "trigger_event ::= UPDATE OF idlist",
169478
+ /* 265 */ "when_clause ::=",
169479
+ /* 266 */ "when_clause ::= WHEN expr",
169480
+ /* 267 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
169481
+ /* 268 */ "trigger_cmd_list ::= trigger_cmd SEMI",
169482
+ /* 269 */ "trnm ::= nm DOT nm",
169483
+ /* 270 */ "tridxby ::= INDEXED BY nm",
169484
+ /* 271 */ "tridxby ::= NOT INDEXED",
169485
+ /* 272 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
169486
+ /* 273 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
169487
+ /* 274 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
169488
+ /* 275 */ "trigger_cmd ::= scanpt select scanpt",
169489
+ /* 276 */ "expr ::= RAISE LP IGNORE RP",
169490
+ /* 277 */ "expr ::= RAISE LP raisetype COMMA nm RP",
169491
+ /* 278 */ "raisetype ::= ROLLBACK",
169492
+ /* 279 */ "raisetype ::= ABORT",
169493
+ /* 280 */ "raisetype ::= FAIL",
169494
+ /* 281 */ "cmd ::= DROP TRIGGER ifexists fullname",
169495
+ /* 282 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
169496
+ /* 283 */ "cmd ::= DETACH database_kw_opt expr",
169497
+ /* 284 */ "key_opt ::=",
169498
+ /* 285 */ "key_opt ::= KEY expr",
169499
+ /* 286 */ "cmd ::= REINDEX",
169500
+ /* 287 */ "cmd ::= REINDEX nm dbnm",
169501
+ /* 288 */ "cmd ::= ANALYZE",
169502
+ /* 289 */ "cmd ::= ANALYZE nm dbnm",
169503
+ /* 290 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
169504
+ /* 291 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
169505
+ /* 292 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
169506
+ /* 293 */ "add_column_fullname ::= fullname",
169507
+ /* 294 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
169508
+ /* 295 */ "cmd ::= create_vtab",
169509
+ /* 296 */ "cmd ::= create_vtab LP vtabarglist RP",
169510
+ /* 297 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
169511
+ /* 298 */ "vtabarg ::=",
169512
+ /* 299 */ "vtabargtoken ::= ANY",
169513
+ /* 300 */ "vtabargtoken ::= lp anylist RP",
169514
+ /* 301 */ "lp ::= LP",
169515
+ /* 302 */ "with ::= WITH wqlist",
169516
+ /* 303 */ "with ::= WITH RECURSIVE wqlist",
169517
+ /* 304 */ "wqas ::= AS",
169518
+ /* 305 */ "wqas ::= AS MATERIALIZED",
169519
+ /* 306 */ "wqas ::= AS NOT MATERIALIZED",
169520
+ /* 307 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
169521
+ /* 308 */ "wqlist ::= wqitem",
169522
+ /* 309 */ "wqlist ::= wqlist COMMA wqitem",
169523
+ /* 310 */ "windowdefn_list ::= windowdefn",
169524
+ /* 311 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
169525
+ /* 312 */ "windowdefn ::= nm AS LP window RP",
169526
+ /* 313 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
169527
+ /* 314 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
169528
+ /* 315 */ "window ::= ORDER BY sortlist frame_opt",
169529
+ /* 316 */ "window ::= nm ORDER BY sortlist frame_opt",
169530
+ /* 317 */ "window ::= frame_opt",
169531
+ /* 318 */ "window ::= nm frame_opt",
169532
+ /* 319 */ "frame_opt ::=",
169533
+ /* 320 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
169534
+ /* 321 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
169535
+ /* 322 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
169536
+ /* 323 */ "frame_bound_s ::= frame_bound",
169537
+ /* 324 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
169538
+ /* 325 */ "frame_bound_e ::= frame_bound",
169539
+ /* 326 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
169540
+ /* 327 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
169541
+ /* 328 */ "frame_bound ::= CURRENT ROW",
169542
+ /* 329 */ "frame_exclude_opt ::=",
169543
+ /* 330 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
169544
+ /* 331 */ "frame_exclude ::= NO OTHERS",
169545
+ /* 332 */ "frame_exclude ::= CURRENT ROW",
169546
+ /* 333 */ "frame_exclude ::= GROUP|TIES",
169547
+ /* 334 */ "window_clause ::= WINDOW windowdefn_list",
169548
+ /* 335 */ "filter_over ::= filter_clause over_clause",
169549
+ /* 336 */ "filter_over ::= over_clause",
169550
+ /* 337 */ "filter_over ::= filter_clause",
169551
+ /* 338 */ "over_clause ::= OVER LP window RP",
169552
+ /* 339 */ "over_clause ::= OVER nm",
169553
+ /* 340 */ "filter_clause ::= FILTER LP WHERE expr RP",
169554
+ /* 341 */ "input ::= cmdlist",
169555
+ /* 342 */ "cmdlist ::= cmdlist ecmd",
169556
+ /* 343 */ "cmdlist ::= ecmd",
169557
+ /* 344 */ "ecmd ::= SEMI",
169558
+ /* 345 */ "ecmd ::= cmdx SEMI",
169559
+ /* 346 */ "ecmd ::= explain cmdx SEMI",
169560
+ /* 347 */ "trans_opt ::=",
169561
+ /* 348 */ "trans_opt ::= TRANSACTION",
169562
+ /* 349 */ "trans_opt ::= TRANSACTION nm",
169563
+ /* 350 */ "savepoint_opt ::= SAVEPOINT",
169564
+ /* 351 */ "savepoint_opt ::=",
169565
+ /* 352 */ "cmd ::= create_table create_table_args",
169566
+ /* 353 */ "table_option_set ::= table_option",
169567
+ /* 354 */ "columnlist ::= columnlist COMMA columnname carglist",
169568
+ /* 355 */ "columnlist ::= columnname carglist",
169569
+ /* 356 */ "nm ::= ID|INDEXED|JOIN_KW",
169570
+ /* 357 */ "nm ::= STRING",
169571
+ /* 358 */ "typetoken ::= typename",
169572
+ /* 359 */ "typename ::= ID|STRING",
169573
+ /* 360 */ "signed ::= plus_num",
169574
+ /* 361 */ "signed ::= minus_num",
169575
+ /* 362 */ "carglist ::= carglist ccons",
169576
+ /* 363 */ "carglist ::=",
169577
+ /* 364 */ "ccons ::= NULL onconf",
169578
+ /* 365 */ "ccons ::= GENERATED ALWAYS AS generated",
169579
+ /* 366 */ "ccons ::= AS generated",
169580
+ /* 367 */ "conslist_opt ::= COMMA conslist",
169581
+ /* 368 */ "conslist ::= conslist tconscomma tcons",
169582
+ /* 369 */ "conslist ::= tcons",
169583
+ /* 370 */ "tconscomma ::=",
169584
+ /* 371 */ "defer_subclause_opt ::= defer_subclause",
169585
+ /* 372 */ "resolvetype ::= raisetype",
169586
+ /* 373 */ "selectnowith ::= oneselect",
169587
+ /* 374 */ "oneselect ::= values",
169588
+ /* 375 */ "sclp ::= selcollist COMMA",
169589
+ /* 376 */ "as ::= ID|STRING",
169590
+ /* 377 */ "indexed_opt ::= indexed_by",
169591
+ /* 378 */ "returning ::=",
169592
+ /* 379 */ "expr ::= term",
169593
+ /* 380 */ "likeop ::= LIKE_KW|MATCH",
169594
+ /* 381 */ "exprlist ::= nexprlist",
169595
+ /* 382 */ "nmnum ::= plus_num",
169596
+ /* 383 */ "nmnum ::= nm",
169597
+ /* 384 */ "nmnum ::= ON",
169598
+ /* 385 */ "nmnum ::= DELETE",
169599
+ /* 386 */ "nmnum ::= DEFAULT",
169600
+ /* 387 */ "plus_num ::= INTEGER|FLOAT",
169601
+ /* 388 */ "foreach_clause ::=",
169602
+ /* 389 */ "foreach_clause ::= FOR EACH ROW",
169603
+ /* 390 */ "trnm ::= nm",
169604
+ /* 391 */ "tridxby ::=",
169605
+ /* 392 */ "database_kw_opt ::= DATABASE",
169606
+ /* 393 */ "database_kw_opt ::=",
169607
+ /* 394 */ "kwcolumn_opt ::=",
169608
+ /* 395 */ "kwcolumn_opt ::= COLUMNKW",
169609
+ /* 396 */ "vtabarglist ::= vtabarg",
169610
+ /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
169611
+ /* 398 */ "vtabarg ::= vtabarg vtabargtoken",
169612
+ /* 399 */ "anylist ::=",
169613
+ /* 400 */ "anylist ::= anylist LP anylist RP",
169614
+ /* 401 */ "anylist ::= anylist ANY",
169615
+ /* 402 */ "with ::=",
169001169616
};
169002169617
#endif /* NDEBUG */
169003169618
169004169619
169005169620
#if YYSTACKDEPTH<=0
@@ -169680,237 +170295,235 @@
169680170295
270, /* (173) idlist_opt ::= */
169681170296
270, /* (174) idlist_opt ::= LP idlist RP */
169682170297
263, /* (175) idlist ::= idlist COMMA nm */
169683170298
263, /* (176) idlist ::= nm */
169684170299
217, /* (177) expr ::= LP expr RP */
169685
- 217, /* (178) expr ::= ID|INDEXED */
169686
- 217, /* (179) expr ::= JOIN_KW */
169687
- 217, /* (180) expr ::= nm DOT nm */
169688
- 217, /* (181) expr ::= nm DOT nm DOT nm */
169689
- 216, /* (182) term ::= NULL|FLOAT|BLOB */
169690
- 216, /* (183) term ::= STRING */
169691
- 216, /* (184) term ::= INTEGER */
169692
- 217, /* (185) expr ::= VARIABLE */
169693
- 217, /* (186) expr ::= expr COLLATE ID|STRING */
169694
- 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
169695
- 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
169696
- 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
169697
- 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
169698
- 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
169699
- 216, /* (192) term ::= CTIME_KW */
169700
- 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
169701
- 217, /* (194) expr ::= expr AND expr */
169702
- 217, /* (195) expr ::= expr OR expr */
169703
- 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
169704
- 217, /* (197) expr ::= expr EQ|NE expr */
169705
- 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
169706
- 217, /* (199) expr ::= expr PLUS|MINUS expr */
169707
- 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
169708
- 217, /* (201) expr ::= expr CONCAT expr */
169709
- 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
169710
- 217, /* (203) expr ::= expr likeop expr */
169711
- 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
169712
- 217, /* (205) expr ::= expr ISNULL|NOTNULL */
169713
- 217, /* (206) expr ::= expr NOT NULL */
169714
- 217, /* (207) expr ::= expr IS expr */
169715
- 217, /* (208) expr ::= expr IS NOT expr */
169716
- 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
169717
- 217, /* (210) expr ::= expr IS DISTINCT FROM expr */
169718
- 217, /* (211) expr ::= NOT expr */
169719
- 217, /* (212) expr ::= BITNOT expr */
169720
- 217, /* (213) expr ::= PLUS|MINUS expr */
169721
- 217, /* (214) expr ::= expr PTR expr */
169722
- 275, /* (215) between_op ::= BETWEEN */
169723
- 275, /* (216) between_op ::= NOT BETWEEN */
169724
- 217, /* (217) expr ::= expr between_op expr AND expr */
169725
- 276, /* (218) in_op ::= IN */
169726
- 276, /* (219) in_op ::= NOT IN */
169727
- 217, /* (220) expr ::= expr in_op LP exprlist RP */
169728
- 217, /* (221) expr ::= LP select RP */
169729
- 217, /* (222) expr ::= expr in_op LP select RP */
169730
- 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
169731
- 217, /* (224) expr ::= EXISTS LP select RP */
169732
- 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
169733
- 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
169734
- 279, /* (227) case_exprlist ::= WHEN expr THEN expr */
169735
- 280, /* (228) case_else ::= ELSE expr */
169736
- 280, /* (229) case_else ::= */
169737
- 278, /* (230) case_operand ::= expr */
169738
- 278, /* (231) case_operand ::= */
169739
- 261, /* (232) exprlist ::= */
169740
- 253, /* (233) nexprlist ::= nexprlist COMMA expr */
169741
- 253, /* (234) nexprlist ::= expr */
169742
- 277, /* (235) paren_exprlist ::= */
169743
- 277, /* (236) paren_exprlist ::= LP exprlist RP */
169744
- 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
169745
- 281, /* (238) uniqueflag ::= UNIQUE */
169746
- 281, /* (239) uniqueflag ::= */
169747
- 221, /* (240) eidlist_opt ::= */
169748
- 221, /* (241) eidlist_opt ::= LP eidlist RP */
169749
- 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
169750
- 232, /* (243) eidlist ::= nm collate sortorder */
169751
- 282, /* (244) collate ::= */
169752
- 282, /* (245) collate ::= COLLATE ID|STRING */
169753
- 190, /* (246) cmd ::= DROP INDEX ifexists fullname */
169754
- 190, /* (247) cmd ::= VACUUM vinto */
169755
- 190, /* (248) cmd ::= VACUUM nm vinto */
169756
- 283, /* (249) vinto ::= INTO expr */
169757
- 283, /* (250) vinto ::= */
169758
- 190, /* (251) cmd ::= PRAGMA nm dbnm */
169759
- 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
169760
- 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
169761
- 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
169762
- 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
169763
- 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
169764
- 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
169765
- 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
169766
- 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
169767
- 287, /* (260) trigger_time ::= BEFORE|AFTER */
169768
- 287, /* (261) trigger_time ::= INSTEAD OF */
169769
- 287, /* (262) trigger_time ::= */
169770
- 288, /* (263) trigger_event ::= DELETE|INSERT */
169771
- 288, /* (264) trigger_event ::= UPDATE */
169772
- 288, /* (265) trigger_event ::= UPDATE OF idlist */
169773
- 290, /* (266) when_clause ::= */
169774
- 290, /* (267) when_clause ::= WHEN expr */
169775
- 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
169776
- 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
169777
- 292, /* (270) trnm ::= nm DOT nm */
169778
- 293, /* (271) tridxby ::= INDEXED BY nm */
169779
- 293, /* (272) tridxby ::= NOT INDEXED */
169780
- 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169781
- 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
169782
- 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
169783
- 291, /* (276) trigger_cmd ::= scanpt select scanpt */
169784
- 217, /* (277) expr ::= RAISE LP IGNORE RP */
169785
- 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
169786
- 236, /* (279) raisetype ::= ROLLBACK */
169787
- 236, /* (280) raisetype ::= ABORT */
169788
- 236, /* (281) raisetype ::= FAIL */
169789
- 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
169790
- 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
169791
- 190, /* (284) cmd ::= DETACH database_kw_opt expr */
169792
- 295, /* (285) key_opt ::= */
169793
- 295, /* (286) key_opt ::= KEY expr */
169794
- 190, /* (287) cmd ::= REINDEX */
169795
- 190, /* (288) cmd ::= REINDEX nm dbnm */
169796
- 190, /* (289) cmd ::= ANALYZE */
169797
- 190, /* (290) cmd ::= ANALYZE nm dbnm */
169798
- 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
169799
- 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
169800
- 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
169801
- 296, /* (294) add_column_fullname ::= fullname */
169802
- 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
169803
- 190, /* (296) cmd ::= create_vtab */
169804
- 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */
169805
- 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
169806
- 300, /* (299) vtabarg ::= */
169807
- 301, /* (300) vtabargtoken ::= ANY */
169808
- 301, /* (301) vtabargtoken ::= lp anylist RP */
169809
- 302, /* (302) lp ::= LP */
169810
- 266, /* (303) with ::= WITH wqlist */
169811
- 266, /* (304) with ::= WITH RECURSIVE wqlist */
169812
- 305, /* (305) wqas ::= AS */
169813
- 305, /* (306) wqas ::= AS MATERIALIZED */
169814
- 305, /* (307) wqas ::= AS NOT MATERIALIZED */
169815
- 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
169816
- 241, /* (309) wqlist ::= wqitem */
169817
- 241, /* (310) wqlist ::= wqlist COMMA wqitem */
169818
- 306, /* (311) windowdefn_list ::= windowdefn */
169819
- 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
169820
- 307, /* (313) windowdefn ::= nm AS LP window RP */
169821
- 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
169822
- 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
169823
- 308, /* (316) window ::= ORDER BY sortlist frame_opt */
169824
- 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */
169825
- 308, /* (318) window ::= frame_opt */
169826
- 308, /* (319) window ::= nm frame_opt */
169827
- 309, /* (320) frame_opt ::= */
169828
- 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
169829
- 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
169830
- 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
169831
- 315, /* (324) frame_bound_s ::= frame_bound */
169832
- 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
169833
- 316, /* (326) frame_bound_e ::= frame_bound */
169834
- 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
169835
- 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
169836
- 314, /* (329) frame_bound ::= CURRENT ROW */
169837
- 317, /* (330) frame_exclude_opt ::= */
169838
- 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
169839
- 318, /* (332) frame_exclude ::= NO OTHERS */
169840
- 318, /* (333) frame_exclude ::= CURRENT ROW */
169841
- 318, /* (334) frame_exclude ::= GROUP|TIES */
169842
- 251, /* (335) window_clause ::= WINDOW windowdefn_list */
169843
- 273, /* (336) filter_over ::= filter_clause over_clause */
169844
- 273, /* (337) filter_over ::= over_clause */
169845
- 273, /* (338) filter_over ::= filter_clause */
169846
- 312, /* (339) over_clause ::= OVER LP window RP */
169847
- 312, /* (340) over_clause ::= OVER nm */
169848
- 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
169849
- 185, /* (342) input ::= cmdlist */
169850
- 186, /* (343) cmdlist ::= cmdlist ecmd */
169851
- 186, /* (344) cmdlist ::= ecmd */
169852
- 187, /* (345) ecmd ::= SEMI */
169853
- 187, /* (346) ecmd ::= cmdx SEMI */
169854
- 187, /* (347) ecmd ::= explain cmdx SEMI */
169855
- 192, /* (348) trans_opt ::= */
169856
- 192, /* (349) trans_opt ::= TRANSACTION */
169857
- 192, /* (350) trans_opt ::= TRANSACTION nm */
169858
- 194, /* (351) savepoint_opt ::= SAVEPOINT */
169859
- 194, /* (352) savepoint_opt ::= */
169860
- 190, /* (353) cmd ::= create_table create_table_args */
169861
- 203, /* (354) table_option_set ::= table_option */
169862
- 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */
169863
- 201, /* (356) columnlist ::= columnname carglist */
169864
- 193, /* (357) nm ::= ID|INDEXED */
169865
- 193, /* (358) nm ::= STRING */
169866
- 193, /* (359) nm ::= JOIN_KW */
169867
- 208, /* (360) typetoken ::= typename */
169868
- 209, /* (361) typename ::= ID|STRING */
169869
- 210, /* (362) signed ::= plus_num */
169870
- 210, /* (363) signed ::= minus_num */
169871
- 207, /* (364) carglist ::= carglist ccons */
169872
- 207, /* (365) carglist ::= */
169873
- 215, /* (366) ccons ::= NULL onconf */
169874
- 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */
169875
- 215, /* (368) ccons ::= AS generated */
169876
- 202, /* (369) conslist_opt ::= COMMA conslist */
169877
- 228, /* (370) conslist ::= conslist tconscomma tcons */
169878
- 228, /* (371) conslist ::= tcons */
169879
- 229, /* (372) tconscomma ::= */
169880
- 233, /* (373) defer_subclause_opt ::= defer_subclause */
169881
- 235, /* (374) resolvetype ::= raisetype */
169882
- 239, /* (375) selectnowith ::= oneselect */
169883
- 240, /* (376) oneselect ::= values */
169884
- 254, /* (377) sclp ::= selcollist COMMA */
169885
- 255, /* (378) as ::= ID|STRING */
169886
- 264, /* (379) indexed_opt ::= indexed_by */
169887
- 272, /* (380) returning ::= */
169888
- 217, /* (381) expr ::= term */
169889
- 274, /* (382) likeop ::= LIKE_KW|MATCH */
169890
- 261, /* (383) exprlist ::= nexprlist */
169891
- 284, /* (384) nmnum ::= plus_num */
169892
- 284, /* (385) nmnum ::= nm */
169893
- 284, /* (386) nmnum ::= ON */
169894
- 284, /* (387) nmnum ::= DELETE */
169895
- 284, /* (388) nmnum ::= DEFAULT */
169896
- 211, /* (389) plus_num ::= INTEGER|FLOAT */
169897
- 289, /* (390) foreach_clause ::= */
169898
- 289, /* (391) foreach_clause ::= FOR EACH ROW */
169899
- 292, /* (392) trnm ::= nm */
169900
- 293, /* (393) tridxby ::= */
169901
- 294, /* (394) database_kw_opt ::= DATABASE */
169902
- 294, /* (395) database_kw_opt ::= */
169903
- 297, /* (396) kwcolumn_opt ::= */
169904
- 297, /* (397) kwcolumn_opt ::= COLUMNKW */
169905
- 299, /* (398) vtabarglist ::= vtabarg */
169906
- 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
169907
- 300, /* (400) vtabarg ::= vtabarg vtabargtoken */
169908
- 303, /* (401) anylist ::= */
169909
- 303, /* (402) anylist ::= anylist LP anylist RP */
169910
- 303, /* (403) anylist ::= anylist ANY */
169911
- 266, /* (404) with ::= */
170300
+ 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170301
+ 217, /* (179) expr ::= nm DOT nm */
170302
+ 217, /* (180) expr ::= nm DOT nm DOT nm */
170303
+ 216, /* (181) term ::= NULL|FLOAT|BLOB */
170304
+ 216, /* (182) term ::= STRING */
170305
+ 216, /* (183) term ::= INTEGER */
170306
+ 217, /* (184) expr ::= VARIABLE */
170307
+ 217, /* (185) expr ::= expr COLLATE ID|STRING */
170308
+ 217, /* (186) expr ::= CAST LP expr AS typetoken RP */
170309
+ 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170310
+ 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170311
+ 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170312
+ 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170313
+ 216, /* (191) term ::= CTIME_KW */
170314
+ 217, /* (192) expr ::= LP nexprlist COMMA expr RP */
170315
+ 217, /* (193) expr ::= expr AND expr */
170316
+ 217, /* (194) expr ::= expr OR expr */
170317
+ 217, /* (195) expr ::= expr LT|GT|GE|LE expr */
170318
+ 217, /* (196) expr ::= expr EQ|NE expr */
170319
+ 217, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170320
+ 217, /* (198) expr ::= expr PLUS|MINUS expr */
170321
+ 217, /* (199) expr ::= expr STAR|SLASH|REM expr */
170322
+ 217, /* (200) expr ::= expr CONCAT expr */
170323
+ 274, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170324
+ 217, /* (202) expr ::= expr likeop expr */
170325
+ 217, /* (203) expr ::= expr likeop expr ESCAPE expr */
170326
+ 217, /* (204) expr ::= expr ISNULL|NOTNULL */
170327
+ 217, /* (205) expr ::= expr NOT NULL */
170328
+ 217, /* (206) expr ::= expr IS expr */
170329
+ 217, /* (207) expr ::= expr IS NOT expr */
170330
+ 217, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170331
+ 217, /* (209) expr ::= expr IS DISTINCT FROM expr */
170332
+ 217, /* (210) expr ::= NOT expr */
170333
+ 217, /* (211) expr ::= BITNOT expr */
170334
+ 217, /* (212) expr ::= PLUS|MINUS expr */
170335
+ 217, /* (213) expr ::= expr PTR expr */
170336
+ 275, /* (214) between_op ::= BETWEEN */
170337
+ 275, /* (215) between_op ::= NOT BETWEEN */
170338
+ 217, /* (216) expr ::= expr between_op expr AND expr */
170339
+ 276, /* (217) in_op ::= IN */
170340
+ 276, /* (218) in_op ::= NOT IN */
170341
+ 217, /* (219) expr ::= expr in_op LP exprlist RP */
170342
+ 217, /* (220) expr ::= LP select RP */
170343
+ 217, /* (221) expr ::= expr in_op LP select RP */
170344
+ 217, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170345
+ 217, /* (223) expr ::= EXISTS LP select RP */
170346
+ 217, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170347
+ 279, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170348
+ 279, /* (226) case_exprlist ::= WHEN expr THEN expr */
170349
+ 280, /* (227) case_else ::= ELSE expr */
170350
+ 280, /* (228) case_else ::= */
170351
+ 278, /* (229) case_operand ::= expr */
170352
+ 278, /* (230) case_operand ::= */
170353
+ 261, /* (231) exprlist ::= */
170354
+ 253, /* (232) nexprlist ::= nexprlist COMMA expr */
170355
+ 253, /* (233) nexprlist ::= expr */
170356
+ 277, /* (234) paren_exprlist ::= */
170357
+ 277, /* (235) paren_exprlist ::= LP exprlist RP */
170358
+ 190, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170359
+ 281, /* (237) uniqueflag ::= UNIQUE */
170360
+ 281, /* (238) uniqueflag ::= */
170361
+ 221, /* (239) eidlist_opt ::= */
170362
+ 221, /* (240) eidlist_opt ::= LP eidlist RP */
170363
+ 232, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170364
+ 232, /* (242) eidlist ::= nm collate sortorder */
170365
+ 282, /* (243) collate ::= */
170366
+ 282, /* (244) collate ::= COLLATE ID|STRING */
170367
+ 190, /* (245) cmd ::= DROP INDEX ifexists fullname */
170368
+ 190, /* (246) cmd ::= VACUUM vinto */
170369
+ 190, /* (247) cmd ::= VACUUM nm vinto */
170370
+ 283, /* (248) vinto ::= INTO expr */
170371
+ 283, /* (249) vinto ::= */
170372
+ 190, /* (250) cmd ::= PRAGMA nm dbnm */
170373
+ 190, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170374
+ 190, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170375
+ 190, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170376
+ 190, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170377
+ 211, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170378
+ 212, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170379
+ 190, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170380
+ 285, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170381
+ 287, /* (259) trigger_time ::= BEFORE|AFTER */
170382
+ 287, /* (260) trigger_time ::= INSTEAD OF */
170383
+ 287, /* (261) trigger_time ::= */
170384
+ 288, /* (262) trigger_event ::= DELETE|INSERT */
170385
+ 288, /* (263) trigger_event ::= UPDATE */
170386
+ 288, /* (264) trigger_event ::= UPDATE OF idlist */
170387
+ 290, /* (265) when_clause ::= */
170388
+ 290, /* (266) when_clause ::= WHEN expr */
170389
+ 286, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170390
+ 286, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170391
+ 292, /* (269) trnm ::= nm DOT nm */
170392
+ 293, /* (270) tridxby ::= INDEXED BY nm */
170393
+ 293, /* (271) tridxby ::= NOT INDEXED */
170394
+ 291, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170395
+ 291, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170396
+ 291, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170397
+ 291, /* (275) trigger_cmd ::= scanpt select scanpt */
170398
+ 217, /* (276) expr ::= RAISE LP IGNORE RP */
170399
+ 217, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170400
+ 236, /* (278) raisetype ::= ROLLBACK */
170401
+ 236, /* (279) raisetype ::= ABORT */
170402
+ 236, /* (280) raisetype ::= FAIL */
170403
+ 190, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170404
+ 190, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170405
+ 190, /* (283) cmd ::= DETACH database_kw_opt expr */
170406
+ 295, /* (284) key_opt ::= */
170407
+ 295, /* (285) key_opt ::= KEY expr */
170408
+ 190, /* (286) cmd ::= REINDEX */
170409
+ 190, /* (287) cmd ::= REINDEX nm dbnm */
170410
+ 190, /* (288) cmd ::= ANALYZE */
170411
+ 190, /* (289) cmd ::= ANALYZE nm dbnm */
170412
+ 190, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170413
+ 190, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170414
+ 190, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170415
+ 296, /* (293) add_column_fullname ::= fullname */
170416
+ 190, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170417
+ 190, /* (295) cmd ::= create_vtab */
170418
+ 190, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170419
+ 298, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170420
+ 300, /* (298) vtabarg ::= */
170421
+ 301, /* (299) vtabargtoken ::= ANY */
170422
+ 301, /* (300) vtabargtoken ::= lp anylist RP */
170423
+ 302, /* (301) lp ::= LP */
170424
+ 266, /* (302) with ::= WITH wqlist */
170425
+ 266, /* (303) with ::= WITH RECURSIVE wqlist */
170426
+ 305, /* (304) wqas ::= AS */
170427
+ 305, /* (305) wqas ::= AS MATERIALIZED */
170428
+ 305, /* (306) wqas ::= AS NOT MATERIALIZED */
170429
+ 304, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170430
+ 241, /* (308) wqlist ::= wqitem */
170431
+ 241, /* (309) wqlist ::= wqlist COMMA wqitem */
170432
+ 306, /* (310) windowdefn_list ::= windowdefn */
170433
+ 306, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170434
+ 307, /* (312) windowdefn ::= nm AS LP window RP */
170435
+ 308, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170436
+ 308, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170437
+ 308, /* (315) window ::= ORDER BY sortlist frame_opt */
170438
+ 308, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170439
+ 308, /* (317) window ::= frame_opt */
170440
+ 308, /* (318) window ::= nm frame_opt */
170441
+ 309, /* (319) frame_opt ::= */
170442
+ 309, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170443
+ 309, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170444
+ 313, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170445
+ 315, /* (323) frame_bound_s ::= frame_bound */
170446
+ 315, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170447
+ 316, /* (325) frame_bound_e ::= frame_bound */
170448
+ 316, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170449
+ 314, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170450
+ 314, /* (328) frame_bound ::= CURRENT ROW */
170451
+ 317, /* (329) frame_exclude_opt ::= */
170452
+ 317, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170453
+ 318, /* (331) frame_exclude ::= NO OTHERS */
170454
+ 318, /* (332) frame_exclude ::= CURRENT ROW */
170455
+ 318, /* (333) frame_exclude ::= GROUP|TIES */
170456
+ 251, /* (334) window_clause ::= WINDOW windowdefn_list */
170457
+ 273, /* (335) filter_over ::= filter_clause over_clause */
170458
+ 273, /* (336) filter_over ::= over_clause */
170459
+ 273, /* (337) filter_over ::= filter_clause */
170460
+ 312, /* (338) over_clause ::= OVER LP window RP */
170461
+ 312, /* (339) over_clause ::= OVER nm */
170462
+ 311, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170463
+ 185, /* (341) input ::= cmdlist */
170464
+ 186, /* (342) cmdlist ::= cmdlist ecmd */
170465
+ 186, /* (343) cmdlist ::= ecmd */
170466
+ 187, /* (344) ecmd ::= SEMI */
170467
+ 187, /* (345) ecmd ::= cmdx SEMI */
170468
+ 187, /* (346) ecmd ::= explain cmdx SEMI */
170469
+ 192, /* (347) trans_opt ::= */
170470
+ 192, /* (348) trans_opt ::= TRANSACTION */
170471
+ 192, /* (349) trans_opt ::= TRANSACTION nm */
170472
+ 194, /* (350) savepoint_opt ::= SAVEPOINT */
170473
+ 194, /* (351) savepoint_opt ::= */
170474
+ 190, /* (352) cmd ::= create_table create_table_args */
170475
+ 203, /* (353) table_option_set ::= table_option */
170476
+ 201, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170477
+ 201, /* (355) columnlist ::= columnname carglist */
170478
+ 193, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170479
+ 193, /* (357) nm ::= STRING */
170480
+ 208, /* (358) typetoken ::= typename */
170481
+ 209, /* (359) typename ::= ID|STRING */
170482
+ 210, /* (360) signed ::= plus_num */
170483
+ 210, /* (361) signed ::= minus_num */
170484
+ 207, /* (362) carglist ::= carglist ccons */
170485
+ 207, /* (363) carglist ::= */
170486
+ 215, /* (364) ccons ::= NULL onconf */
170487
+ 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170488
+ 215, /* (366) ccons ::= AS generated */
170489
+ 202, /* (367) conslist_opt ::= COMMA conslist */
170490
+ 228, /* (368) conslist ::= conslist tconscomma tcons */
170491
+ 228, /* (369) conslist ::= tcons */
170492
+ 229, /* (370) tconscomma ::= */
170493
+ 233, /* (371) defer_subclause_opt ::= defer_subclause */
170494
+ 235, /* (372) resolvetype ::= raisetype */
170495
+ 239, /* (373) selectnowith ::= oneselect */
170496
+ 240, /* (374) oneselect ::= values */
170497
+ 254, /* (375) sclp ::= selcollist COMMA */
170498
+ 255, /* (376) as ::= ID|STRING */
170499
+ 264, /* (377) indexed_opt ::= indexed_by */
170500
+ 272, /* (378) returning ::= */
170501
+ 217, /* (379) expr ::= term */
170502
+ 274, /* (380) likeop ::= LIKE_KW|MATCH */
170503
+ 261, /* (381) exprlist ::= nexprlist */
170504
+ 284, /* (382) nmnum ::= plus_num */
170505
+ 284, /* (383) nmnum ::= nm */
170506
+ 284, /* (384) nmnum ::= ON */
170507
+ 284, /* (385) nmnum ::= DELETE */
170508
+ 284, /* (386) nmnum ::= DEFAULT */
170509
+ 211, /* (387) plus_num ::= INTEGER|FLOAT */
170510
+ 289, /* (388) foreach_clause ::= */
170511
+ 289, /* (389) foreach_clause ::= FOR EACH ROW */
170512
+ 292, /* (390) trnm ::= nm */
170513
+ 293, /* (391) tridxby ::= */
170514
+ 294, /* (392) database_kw_opt ::= DATABASE */
170515
+ 294, /* (393) database_kw_opt ::= */
170516
+ 297, /* (394) kwcolumn_opt ::= */
170517
+ 297, /* (395) kwcolumn_opt ::= COLUMNKW */
170518
+ 299, /* (396) vtabarglist ::= vtabarg */
170519
+ 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170520
+ 300, /* (398) vtabarg ::= vtabarg vtabargtoken */
170521
+ 303, /* (399) anylist ::= */
170522
+ 303, /* (400) anylist ::= anylist LP anylist RP */
170523
+ 303, /* (401) anylist ::= anylist ANY */
170524
+ 266, /* (402) with ::= */
169912170525
};
169913170526
169914170527
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
169915170528
** of symbols on the right-hand side of that rule. */
169916170529
static const signed char yyRuleInfoNRhs[] = {
@@ -170090,237 +170703,235 @@
170090170703
0, /* (173) idlist_opt ::= */
170091170704
-3, /* (174) idlist_opt ::= LP idlist RP */
170092170705
-3, /* (175) idlist ::= idlist COMMA nm */
170093170706
-1, /* (176) idlist ::= nm */
170094170707
-3, /* (177) expr ::= LP expr RP */
170095
- -1, /* (178) expr ::= ID|INDEXED */
170096
- -1, /* (179) expr ::= JOIN_KW */
170097
- -3, /* (180) expr ::= nm DOT nm */
170098
- -5, /* (181) expr ::= nm DOT nm DOT nm */
170099
- -1, /* (182) term ::= NULL|FLOAT|BLOB */
170100
- -1, /* (183) term ::= STRING */
170101
- -1, /* (184) term ::= INTEGER */
170102
- -1, /* (185) expr ::= VARIABLE */
170103
- -3, /* (186) expr ::= expr COLLATE ID|STRING */
170104
- -6, /* (187) expr ::= CAST LP expr AS typetoken RP */
170105
- -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
170106
- -4, /* (189) expr ::= ID|INDEXED LP STAR RP */
170107
- -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
170108
- -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
170109
- -1, /* (192) term ::= CTIME_KW */
170110
- -5, /* (193) expr ::= LP nexprlist COMMA expr RP */
170111
- -3, /* (194) expr ::= expr AND expr */
170112
- -3, /* (195) expr ::= expr OR expr */
170113
- -3, /* (196) expr ::= expr LT|GT|GE|LE expr */
170114
- -3, /* (197) expr ::= expr EQ|NE expr */
170115
- -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170116
- -3, /* (199) expr ::= expr PLUS|MINUS expr */
170117
- -3, /* (200) expr ::= expr STAR|SLASH|REM expr */
170118
- -3, /* (201) expr ::= expr CONCAT expr */
170119
- -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */
170120
- -3, /* (203) expr ::= expr likeop expr */
170121
- -5, /* (204) expr ::= expr likeop expr ESCAPE expr */
170122
- -2, /* (205) expr ::= expr ISNULL|NOTNULL */
170123
- -3, /* (206) expr ::= expr NOT NULL */
170124
- -3, /* (207) expr ::= expr IS expr */
170125
- -4, /* (208) expr ::= expr IS NOT expr */
170126
- -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
170127
- -5, /* (210) expr ::= expr IS DISTINCT FROM expr */
170128
- -2, /* (211) expr ::= NOT expr */
170129
- -2, /* (212) expr ::= BITNOT expr */
170130
- -2, /* (213) expr ::= PLUS|MINUS expr */
170131
- -3, /* (214) expr ::= expr PTR expr */
170132
- -1, /* (215) between_op ::= BETWEEN */
170133
- -2, /* (216) between_op ::= NOT BETWEEN */
170134
- -5, /* (217) expr ::= expr between_op expr AND expr */
170135
- -1, /* (218) in_op ::= IN */
170136
- -2, /* (219) in_op ::= NOT IN */
170137
- -5, /* (220) expr ::= expr in_op LP exprlist RP */
170138
- -3, /* (221) expr ::= LP select RP */
170139
- -5, /* (222) expr ::= expr in_op LP select RP */
170140
- -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
170141
- -4, /* (224) expr ::= EXISTS LP select RP */
170142
- -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
170143
- -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170144
- -4, /* (227) case_exprlist ::= WHEN expr THEN expr */
170145
- -2, /* (228) case_else ::= ELSE expr */
170146
- 0, /* (229) case_else ::= */
170147
- -1, /* (230) case_operand ::= expr */
170148
- 0, /* (231) case_operand ::= */
170149
- 0, /* (232) exprlist ::= */
170150
- -3, /* (233) nexprlist ::= nexprlist COMMA expr */
170151
- -1, /* (234) nexprlist ::= expr */
170152
- 0, /* (235) paren_exprlist ::= */
170153
- -3, /* (236) paren_exprlist ::= LP exprlist RP */
170154
- -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170155
- -1, /* (238) uniqueflag ::= UNIQUE */
170156
- 0, /* (239) uniqueflag ::= */
170157
- 0, /* (240) eidlist_opt ::= */
170158
- -3, /* (241) eidlist_opt ::= LP eidlist RP */
170159
- -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
170160
- -3, /* (243) eidlist ::= nm collate sortorder */
170161
- 0, /* (244) collate ::= */
170162
- -2, /* (245) collate ::= COLLATE ID|STRING */
170163
- -4, /* (246) cmd ::= DROP INDEX ifexists fullname */
170164
- -2, /* (247) cmd ::= VACUUM vinto */
170165
- -3, /* (248) cmd ::= VACUUM nm vinto */
170166
- -2, /* (249) vinto ::= INTO expr */
170167
- 0, /* (250) vinto ::= */
170168
- -3, /* (251) cmd ::= PRAGMA nm dbnm */
170169
- -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
170170
- -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170171
- -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
170172
- -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170173
- -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
170174
- -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
170175
- -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170176
- -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170177
- -1, /* (260) trigger_time ::= BEFORE|AFTER */
170178
- -2, /* (261) trigger_time ::= INSTEAD OF */
170179
- 0, /* (262) trigger_time ::= */
170180
- -1, /* (263) trigger_event ::= DELETE|INSERT */
170181
- -1, /* (264) trigger_event ::= UPDATE */
170182
- -3, /* (265) trigger_event ::= UPDATE OF idlist */
170183
- 0, /* (266) when_clause ::= */
170184
- -2, /* (267) when_clause ::= WHEN expr */
170185
- -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170186
- -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
170187
- -3, /* (270) trnm ::= nm DOT nm */
170188
- -3, /* (271) tridxby ::= INDEXED BY nm */
170189
- -2, /* (272) tridxby ::= NOT INDEXED */
170190
- -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170191
- -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170192
- -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170193
- -3, /* (276) trigger_cmd ::= scanpt select scanpt */
170194
- -4, /* (277) expr ::= RAISE LP IGNORE RP */
170195
- -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
170196
- -1, /* (279) raisetype ::= ROLLBACK */
170197
- -1, /* (280) raisetype ::= ABORT */
170198
- -1, /* (281) raisetype ::= FAIL */
170199
- -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
170200
- -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170201
- -3, /* (284) cmd ::= DETACH database_kw_opt expr */
170202
- 0, /* (285) key_opt ::= */
170203
- -2, /* (286) key_opt ::= KEY expr */
170204
- -1, /* (287) cmd ::= REINDEX */
170205
- -3, /* (288) cmd ::= REINDEX nm dbnm */
170206
- -1, /* (289) cmd ::= ANALYZE */
170207
- -3, /* (290) cmd ::= ANALYZE nm dbnm */
170208
- -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
170209
- -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170210
- -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170211
- -1, /* (294) add_column_fullname ::= fullname */
170212
- -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170213
- -1, /* (296) cmd ::= create_vtab */
170214
- -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */
170215
- -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170216
- 0, /* (299) vtabarg ::= */
170217
- -1, /* (300) vtabargtoken ::= ANY */
170218
- -3, /* (301) vtabargtoken ::= lp anylist RP */
170219
- -1, /* (302) lp ::= LP */
170220
- -2, /* (303) with ::= WITH wqlist */
170221
- -3, /* (304) with ::= WITH RECURSIVE wqlist */
170222
- -1, /* (305) wqas ::= AS */
170223
- -2, /* (306) wqas ::= AS MATERIALIZED */
170224
- -3, /* (307) wqas ::= AS NOT MATERIALIZED */
170225
- -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
170226
- -1, /* (309) wqlist ::= wqitem */
170227
- -3, /* (310) wqlist ::= wqlist COMMA wqitem */
170228
- -1, /* (311) windowdefn_list ::= windowdefn */
170229
- -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170230
- -5, /* (313) windowdefn ::= nm AS LP window RP */
170231
- -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170232
- -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170233
- -4, /* (316) window ::= ORDER BY sortlist frame_opt */
170234
- -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */
170235
- -1, /* (318) window ::= frame_opt */
170236
- -2, /* (319) window ::= nm frame_opt */
170237
- 0, /* (320) frame_opt ::= */
170238
- -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170239
- -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170240
- -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
170241
- -1, /* (324) frame_bound_s ::= frame_bound */
170242
- -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
170243
- -1, /* (326) frame_bound_e ::= frame_bound */
170244
- -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
170245
- -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
170246
- -2, /* (329) frame_bound ::= CURRENT ROW */
170247
- 0, /* (330) frame_exclude_opt ::= */
170248
- -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
170249
- -2, /* (332) frame_exclude ::= NO OTHERS */
170250
- -2, /* (333) frame_exclude ::= CURRENT ROW */
170251
- -1, /* (334) frame_exclude ::= GROUP|TIES */
170252
- -2, /* (335) window_clause ::= WINDOW windowdefn_list */
170253
- -2, /* (336) filter_over ::= filter_clause over_clause */
170254
- -1, /* (337) filter_over ::= over_clause */
170255
- -1, /* (338) filter_over ::= filter_clause */
170256
- -4, /* (339) over_clause ::= OVER LP window RP */
170257
- -2, /* (340) over_clause ::= OVER nm */
170258
- -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
170259
- -1, /* (342) input ::= cmdlist */
170260
- -2, /* (343) cmdlist ::= cmdlist ecmd */
170261
- -1, /* (344) cmdlist ::= ecmd */
170262
- -1, /* (345) ecmd ::= SEMI */
170263
- -2, /* (346) ecmd ::= cmdx SEMI */
170264
- -3, /* (347) ecmd ::= explain cmdx SEMI */
170265
- 0, /* (348) trans_opt ::= */
170266
- -1, /* (349) trans_opt ::= TRANSACTION */
170267
- -2, /* (350) trans_opt ::= TRANSACTION nm */
170268
- -1, /* (351) savepoint_opt ::= SAVEPOINT */
170269
- 0, /* (352) savepoint_opt ::= */
170270
- -2, /* (353) cmd ::= create_table create_table_args */
170271
- -1, /* (354) table_option_set ::= table_option */
170272
- -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */
170273
- -2, /* (356) columnlist ::= columnname carglist */
170274
- -1, /* (357) nm ::= ID|INDEXED */
170275
- -1, /* (358) nm ::= STRING */
170276
- -1, /* (359) nm ::= JOIN_KW */
170277
- -1, /* (360) typetoken ::= typename */
170278
- -1, /* (361) typename ::= ID|STRING */
170279
- -1, /* (362) signed ::= plus_num */
170280
- -1, /* (363) signed ::= minus_num */
170281
- -2, /* (364) carglist ::= carglist ccons */
170282
- 0, /* (365) carglist ::= */
170283
- -2, /* (366) ccons ::= NULL onconf */
170284
- -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */
170285
- -2, /* (368) ccons ::= AS generated */
170286
- -2, /* (369) conslist_opt ::= COMMA conslist */
170287
- -3, /* (370) conslist ::= conslist tconscomma tcons */
170288
- -1, /* (371) conslist ::= tcons */
170289
- 0, /* (372) tconscomma ::= */
170290
- -1, /* (373) defer_subclause_opt ::= defer_subclause */
170291
- -1, /* (374) resolvetype ::= raisetype */
170292
- -1, /* (375) selectnowith ::= oneselect */
170293
- -1, /* (376) oneselect ::= values */
170294
- -2, /* (377) sclp ::= selcollist COMMA */
170295
- -1, /* (378) as ::= ID|STRING */
170296
- -1, /* (379) indexed_opt ::= indexed_by */
170297
- 0, /* (380) returning ::= */
170298
- -1, /* (381) expr ::= term */
170299
- -1, /* (382) likeop ::= LIKE_KW|MATCH */
170300
- -1, /* (383) exprlist ::= nexprlist */
170301
- -1, /* (384) nmnum ::= plus_num */
170302
- -1, /* (385) nmnum ::= nm */
170303
- -1, /* (386) nmnum ::= ON */
170304
- -1, /* (387) nmnum ::= DELETE */
170305
- -1, /* (388) nmnum ::= DEFAULT */
170306
- -1, /* (389) plus_num ::= INTEGER|FLOAT */
170307
- 0, /* (390) foreach_clause ::= */
170308
- -3, /* (391) foreach_clause ::= FOR EACH ROW */
170309
- -1, /* (392) trnm ::= nm */
170310
- 0, /* (393) tridxby ::= */
170311
- -1, /* (394) database_kw_opt ::= DATABASE */
170312
- 0, /* (395) database_kw_opt ::= */
170313
- 0, /* (396) kwcolumn_opt ::= */
170314
- -1, /* (397) kwcolumn_opt ::= COLUMNKW */
170315
- -1, /* (398) vtabarglist ::= vtabarg */
170316
- -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
170317
- -2, /* (400) vtabarg ::= vtabarg vtabargtoken */
170318
- 0, /* (401) anylist ::= */
170319
- -4, /* (402) anylist ::= anylist LP anylist RP */
170320
- -2, /* (403) anylist ::= anylist ANY */
170321
- 0, /* (404) with ::= */
170708
+ -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170709
+ -3, /* (179) expr ::= nm DOT nm */
170710
+ -5, /* (180) expr ::= nm DOT nm DOT nm */
170711
+ -1, /* (181) term ::= NULL|FLOAT|BLOB */
170712
+ -1, /* (182) term ::= STRING */
170713
+ -1, /* (183) term ::= INTEGER */
170714
+ -1, /* (184) expr ::= VARIABLE */
170715
+ -3, /* (185) expr ::= expr COLLATE ID|STRING */
170716
+ -6, /* (186) expr ::= CAST LP expr AS typetoken RP */
170717
+ -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170718
+ -4, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170719
+ -6, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170720
+ -5, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170721
+ -1, /* (191) term ::= CTIME_KW */
170722
+ -5, /* (192) expr ::= LP nexprlist COMMA expr RP */
170723
+ -3, /* (193) expr ::= expr AND expr */
170724
+ -3, /* (194) expr ::= expr OR expr */
170725
+ -3, /* (195) expr ::= expr LT|GT|GE|LE expr */
170726
+ -3, /* (196) expr ::= expr EQ|NE expr */
170727
+ -3, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170728
+ -3, /* (198) expr ::= expr PLUS|MINUS expr */
170729
+ -3, /* (199) expr ::= expr STAR|SLASH|REM expr */
170730
+ -3, /* (200) expr ::= expr CONCAT expr */
170731
+ -2, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170732
+ -3, /* (202) expr ::= expr likeop expr */
170733
+ -5, /* (203) expr ::= expr likeop expr ESCAPE expr */
170734
+ -2, /* (204) expr ::= expr ISNULL|NOTNULL */
170735
+ -3, /* (205) expr ::= expr NOT NULL */
170736
+ -3, /* (206) expr ::= expr IS expr */
170737
+ -4, /* (207) expr ::= expr IS NOT expr */
170738
+ -6, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170739
+ -5, /* (209) expr ::= expr IS DISTINCT FROM expr */
170740
+ -2, /* (210) expr ::= NOT expr */
170741
+ -2, /* (211) expr ::= BITNOT expr */
170742
+ -2, /* (212) expr ::= PLUS|MINUS expr */
170743
+ -3, /* (213) expr ::= expr PTR expr */
170744
+ -1, /* (214) between_op ::= BETWEEN */
170745
+ -2, /* (215) between_op ::= NOT BETWEEN */
170746
+ -5, /* (216) expr ::= expr between_op expr AND expr */
170747
+ -1, /* (217) in_op ::= IN */
170748
+ -2, /* (218) in_op ::= NOT IN */
170749
+ -5, /* (219) expr ::= expr in_op LP exprlist RP */
170750
+ -3, /* (220) expr ::= LP select RP */
170751
+ -5, /* (221) expr ::= expr in_op LP select RP */
170752
+ -5, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170753
+ -4, /* (223) expr ::= EXISTS LP select RP */
170754
+ -5, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170755
+ -5, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170756
+ -4, /* (226) case_exprlist ::= WHEN expr THEN expr */
170757
+ -2, /* (227) case_else ::= ELSE expr */
170758
+ 0, /* (228) case_else ::= */
170759
+ -1, /* (229) case_operand ::= expr */
170760
+ 0, /* (230) case_operand ::= */
170761
+ 0, /* (231) exprlist ::= */
170762
+ -3, /* (232) nexprlist ::= nexprlist COMMA expr */
170763
+ -1, /* (233) nexprlist ::= expr */
170764
+ 0, /* (234) paren_exprlist ::= */
170765
+ -3, /* (235) paren_exprlist ::= LP exprlist RP */
170766
+ -12, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170767
+ -1, /* (237) uniqueflag ::= UNIQUE */
170768
+ 0, /* (238) uniqueflag ::= */
170769
+ 0, /* (239) eidlist_opt ::= */
170770
+ -3, /* (240) eidlist_opt ::= LP eidlist RP */
170771
+ -5, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170772
+ -3, /* (242) eidlist ::= nm collate sortorder */
170773
+ 0, /* (243) collate ::= */
170774
+ -2, /* (244) collate ::= COLLATE ID|STRING */
170775
+ -4, /* (245) cmd ::= DROP INDEX ifexists fullname */
170776
+ -2, /* (246) cmd ::= VACUUM vinto */
170777
+ -3, /* (247) cmd ::= VACUUM nm vinto */
170778
+ -2, /* (248) vinto ::= INTO expr */
170779
+ 0, /* (249) vinto ::= */
170780
+ -3, /* (250) cmd ::= PRAGMA nm dbnm */
170781
+ -5, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170782
+ -6, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170783
+ -5, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170784
+ -6, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170785
+ -2, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170786
+ -2, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170787
+ -5, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170788
+ -11, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170789
+ -1, /* (259) trigger_time ::= BEFORE|AFTER */
170790
+ -2, /* (260) trigger_time ::= INSTEAD OF */
170791
+ 0, /* (261) trigger_time ::= */
170792
+ -1, /* (262) trigger_event ::= DELETE|INSERT */
170793
+ -1, /* (263) trigger_event ::= UPDATE */
170794
+ -3, /* (264) trigger_event ::= UPDATE OF idlist */
170795
+ 0, /* (265) when_clause ::= */
170796
+ -2, /* (266) when_clause ::= WHEN expr */
170797
+ -3, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170798
+ -2, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170799
+ -3, /* (269) trnm ::= nm DOT nm */
170800
+ -3, /* (270) tridxby ::= INDEXED BY nm */
170801
+ -2, /* (271) tridxby ::= NOT INDEXED */
170802
+ -9, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170803
+ -8, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170804
+ -6, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170805
+ -3, /* (275) trigger_cmd ::= scanpt select scanpt */
170806
+ -4, /* (276) expr ::= RAISE LP IGNORE RP */
170807
+ -6, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170808
+ -1, /* (278) raisetype ::= ROLLBACK */
170809
+ -1, /* (279) raisetype ::= ABORT */
170810
+ -1, /* (280) raisetype ::= FAIL */
170811
+ -4, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170812
+ -6, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170813
+ -3, /* (283) cmd ::= DETACH database_kw_opt expr */
170814
+ 0, /* (284) key_opt ::= */
170815
+ -2, /* (285) key_opt ::= KEY expr */
170816
+ -1, /* (286) cmd ::= REINDEX */
170817
+ -3, /* (287) cmd ::= REINDEX nm dbnm */
170818
+ -1, /* (288) cmd ::= ANALYZE */
170819
+ -3, /* (289) cmd ::= ANALYZE nm dbnm */
170820
+ -6, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170821
+ -7, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170822
+ -6, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170823
+ -1, /* (293) add_column_fullname ::= fullname */
170824
+ -8, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170825
+ -1, /* (295) cmd ::= create_vtab */
170826
+ -4, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170827
+ -8, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170828
+ 0, /* (298) vtabarg ::= */
170829
+ -1, /* (299) vtabargtoken ::= ANY */
170830
+ -3, /* (300) vtabargtoken ::= lp anylist RP */
170831
+ -1, /* (301) lp ::= LP */
170832
+ -2, /* (302) with ::= WITH wqlist */
170833
+ -3, /* (303) with ::= WITH RECURSIVE wqlist */
170834
+ -1, /* (304) wqas ::= AS */
170835
+ -2, /* (305) wqas ::= AS MATERIALIZED */
170836
+ -3, /* (306) wqas ::= AS NOT MATERIALIZED */
170837
+ -6, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170838
+ -1, /* (308) wqlist ::= wqitem */
170839
+ -3, /* (309) wqlist ::= wqlist COMMA wqitem */
170840
+ -1, /* (310) windowdefn_list ::= windowdefn */
170841
+ -3, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170842
+ -5, /* (312) windowdefn ::= nm AS LP window RP */
170843
+ -5, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170844
+ -6, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170845
+ -4, /* (315) window ::= ORDER BY sortlist frame_opt */
170846
+ -5, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170847
+ -1, /* (317) window ::= frame_opt */
170848
+ -2, /* (318) window ::= nm frame_opt */
170849
+ 0, /* (319) frame_opt ::= */
170850
+ -3, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170851
+ -6, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170852
+ -1, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170853
+ -1, /* (323) frame_bound_s ::= frame_bound */
170854
+ -2, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170855
+ -1, /* (325) frame_bound_e ::= frame_bound */
170856
+ -2, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170857
+ -2, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170858
+ -2, /* (328) frame_bound ::= CURRENT ROW */
170859
+ 0, /* (329) frame_exclude_opt ::= */
170860
+ -2, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170861
+ -2, /* (331) frame_exclude ::= NO OTHERS */
170862
+ -2, /* (332) frame_exclude ::= CURRENT ROW */
170863
+ -1, /* (333) frame_exclude ::= GROUP|TIES */
170864
+ -2, /* (334) window_clause ::= WINDOW windowdefn_list */
170865
+ -2, /* (335) filter_over ::= filter_clause over_clause */
170866
+ -1, /* (336) filter_over ::= over_clause */
170867
+ -1, /* (337) filter_over ::= filter_clause */
170868
+ -4, /* (338) over_clause ::= OVER LP window RP */
170869
+ -2, /* (339) over_clause ::= OVER nm */
170870
+ -5, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170871
+ -1, /* (341) input ::= cmdlist */
170872
+ -2, /* (342) cmdlist ::= cmdlist ecmd */
170873
+ -1, /* (343) cmdlist ::= ecmd */
170874
+ -1, /* (344) ecmd ::= SEMI */
170875
+ -2, /* (345) ecmd ::= cmdx SEMI */
170876
+ -3, /* (346) ecmd ::= explain cmdx SEMI */
170877
+ 0, /* (347) trans_opt ::= */
170878
+ -1, /* (348) trans_opt ::= TRANSACTION */
170879
+ -2, /* (349) trans_opt ::= TRANSACTION nm */
170880
+ -1, /* (350) savepoint_opt ::= SAVEPOINT */
170881
+ 0, /* (351) savepoint_opt ::= */
170882
+ -2, /* (352) cmd ::= create_table create_table_args */
170883
+ -1, /* (353) table_option_set ::= table_option */
170884
+ -4, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170885
+ -2, /* (355) columnlist ::= columnname carglist */
170886
+ -1, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170887
+ -1, /* (357) nm ::= STRING */
170888
+ -1, /* (358) typetoken ::= typename */
170889
+ -1, /* (359) typename ::= ID|STRING */
170890
+ -1, /* (360) signed ::= plus_num */
170891
+ -1, /* (361) signed ::= minus_num */
170892
+ -2, /* (362) carglist ::= carglist ccons */
170893
+ 0, /* (363) carglist ::= */
170894
+ -2, /* (364) ccons ::= NULL onconf */
170895
+ -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170896
+ -2, /* (366) ccons ::= AS generated */
170897
+ -2, /* (367) conslist_opt ::= COMMA conslist */
170898
+ -3, /* (368) conslist ::= conslist tconscomma tcons */
170899
+ -1, /* (369) conslist ::= tcons */
170900
+ 0, /* (370) tconscomma ::= */
170901
+ -1, /* (371) defer_subclause_opt ::= defer_subclause */
170902
+ -1, /* (372) resolvetype ::= raisetype */
170903
+ -1, /* (373) selectnowith ::= oneselect */
170904
+ -1, /* (374) oneselect ::= values */
170905
+ -2, /* (375) sclp ::= selcollist COMMA */
170906
+ -1, /* (376) as ::= ID|STRING */
170907
+ -1, /* (377) indexed_opt ::= indexed_by */
170908
+ 0, /* (378) returning ::= */
170909
+ -1, /* (379) expr ::= term */
170910
+ -1, /* (380) likeop ::= LIKE_KW|MATCH */
170911
+ -1, /* (381) exprlist ::= nexprlist */
170912
+ -1, /* (382) nmnum ::= plus_num */
170913
+ -1, /* (383) nmnum ::= nm */
170914
+ -1, /* (384) nmnum ::= ON */
170915
+ -1, /* (385) nmnum ::= DELETE */
170916
+ -1, /* (386) nmnum ::= DEFAULT */
170917
+ -1, /* (387) plus_num ::= INTEGER|FLOAT */
170918
+ 0, /* (388) foreach_clause ::= */
170919
+ -3, /* (389) foreach_clause ::= FOR EACH ROW */
170920
+ -1, /* (390) trnm ::= nm */
170921
+ 0, /* (391) tridxby ::= */
170922
+ -1, /* (392) database_kw_opt ::= DATABASE */
170923
+ 0, /* (393) database_kw_opt ::= */
170924
+ 0, /* (394) kwcolumn_opt ::= */
170925
+ -1, /* (395) kwcolumn_opt ::= COLUMNKW */
170926
+ -1, /* (396) vtabarglist ::= vtabarg */
170927
+ -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170928
+ -2, /* (398) vtabarg ::= vtabarg vtabargtoken */
170929
+ 0, /* (399) anylist ::= */
170930
+ -4, /* (400) anylist ::= anylist LP anylist RP */
170931
+ -2, /* (401) anylist ::= anylist ANY */
170932
+ 0, /* (402) with ::= */
170322170933
};
170323170934
170324170935
static void yy_accept(yyParser*); /* Forward Declaration */
170325170936
170326170937
/*
@@ -170376,11 +170987,11 @@
170376170987
{yymsp[1].minor.yy394 = TK_DEFERRED;}
170377170988
break;
170378170989
case 5: /* transtype ::= DEFERRED */
170379170990
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170380170991
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170381
- case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323);
170992
+ case 322: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==322);
170382170993
{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170383170994
break;
170384170995
case 8: /* cmd ::= COMMIT|END trans_opt */
170385170996
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170386170997
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170413,11 +171024,11 @@
170413171024
case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
170414171025
case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
170415171026
case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
170416171027
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
170417171028
case 98: /* distinct ::= */ yytestcase(yyruleno==98);
170418
- case 244: /* collate ::= */ yytestcase(yyruleno==244);
171029
+ case 243: /* collate ::= */ yytestcase(yyruleno==243);
170419171030
{yymsp[1].minor.yy394 = 0;}
170420171031
break;
170421171032
case 16: /* ifnotexists ::= IF NOT EXISTS */
170422171033
{yymsp[-2].minor.yy394 = 1;}
170423171034
break;
@@ -170597,13 +171208,13 @@
170597171208
case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
170598171209
{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
170599171210
break;
170600171211
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
170601171212
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
170602
- case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216);
170603
- case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219);
170604
- case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245);
171213
+ case 215: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==215);
171214
+ case 218: /* in_op ::= NOT IN */ yytestcase(yyruleno==218);
171215
+ case 244: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==244);
170605171216
{yymsp[-1].minor.yy394 = 1;}
170606171217
break;
170607171218
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
170608171219
{yymsp[-1].minor.yy394 = 0;}
170609171220
break;
@@ -170749,13 +171360,13 @@
170749171360
{yymsp[0].minor.yy394 = SF_All;}
170750171361
break;
170751171362
case 99: /* sclp ::= */
170752171363
case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
170753171364
case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
170754
- case 232: /* exprlist ::= */ yytestcase(yyruleno==232);
170755
- case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235);
170756
- case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240);
171365
+ case 231: /* exprlist ::= */ yytestcase(yyruleno==231);
171366
+ case 234: /* paren_exprlist ::= */ yytestcase(yyruleno==234);
171367
+ case 239: /* eidlist_opt ::= */ yytestcase(yyruleno==239);
170757171368
{yymsp[1].minor.yy322 = 0;}
170758171369
break;
170759171370
case 100: /* selcollist ::= sclp scanpt expr scanpt as */
170760171371
{
170761171372
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170777,12 +171388,12 @@
170777171388
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
170778171389
}
170779171390
break;
170780171391
case 103: /* as ::= AS nm */
170781171392
case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
170782
- case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170783
- case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257);
171393
+ case 255: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==255);
171394
+ case 256: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170784171395
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
170785171396
break;
170786171397
case 105: /* from ::= */
170787171398
case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
170788171399
{yymsp[1].minor.yy131 = 0;}
@@ -170950,20 +171561,20 @@
170950171561
break;
170951171562
case 144: /* having_opt ::= */
170952171563
case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
170953171564
case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
170954171565
case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
170955
- case 229: /* case_else ::= */ yytestcase(yyruleno==229);
170956
- case 231: /* case_operand ::= */ yytestcase(yyruleno==231);
170957
- case 250: /* vinto ::= */ yytestcase(yyruleno==250);
171566
+ case 228: /* case_else ::= */ yytestcase(yyruleno==228);
171567
+ case 230: /* case_operand ::= */ yytestcase(yyruleno==230);
171568
+ case 249: /* vinto ::= */ yytestcase(yyruleno==249);
170958171569
{yymsp[1].minor.yy528 = 0;}
170959171570
break;
170960171571
case 145: /* having_opt ::= HAVING expr */
170961171572
case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
170962171573
case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
170963
- case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228);
170964
- case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249);
171574
+ case 227: /* case_else ::= ELSE expr */ yytestcase(yyruleno==227);
171575
+ case 248: /* vinto ::= INTO expr */ yytestcase(yyruleno==248);
170965171576
{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
170966171577
break;
170967171578
case 147: /* limit_opt ::= LIMIT expr */
170968171579
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
170969171580
break;
@@ -171071,23 +171682,22 @@
171071171682
{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171072171683
break;
171073171684
case 177: /* expr ::= LP expr RP */
171074171685
{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171075171686
break;
171076
- case 178: /* expr ::= ID|INDEXED */
171077
- case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
171687
+ case 178: /* expr ::= ID|INDEXED|JOIN_KW */
171078171688
{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171079171689
break;
171080
- case 180: /* expr ::= nm DOT nm */
171690
+ case 179: /* expr ::= nm DOT nm */
171081171691
{
171082171692
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171083171693
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171084171694
yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171085171695
}
171086171696
yymsp[-2].minor.yy528 = yylhsminor.yy528;
171087171697
break;
171088
- case 181: /* expr ::= nm DOT nm DOT nm */
171698
+ case 180: /* expr ::= nm DOT nm DOT nm */
171089171699
{
171090171700
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171091171701
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171092171702
Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171093171703
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171096,22 +171706,22 @@
171096171706
}
171097171707
yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171098171708
}
171099171709
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171100171710
break;
171101
- case 182: /* term ::= NULL|FLOAT|BLOB */
171102
- case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
171711
+ case 181: /* term ::= NULL|FLOAT|BLOB */
171712
+ case 182: /* term ::= STRING */ yytestcase(yyruleno==182);
171103171713
{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171104171714
break;
171105
- case 184: /* term ::= INTEGER */
171715
+ case 183: /* term ::= INTEGER */
171106171716
{
171107171717
yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171108171718
if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171109171719
}
171110171720
yymsp[0].minor.yy528 = yylhsminor.yy528;
171111171721
break;
171112
- case 185: /* expr ::= VARIABLE */
171722
+ case 184: /* expr ::= VARIABLE */
171113171723
{
171114171724
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171115171725
u32 n = yymsp[0].minor.yy0.n;
171116171726
yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171117171727
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171129,54 +171739,54 @@
171129171739
if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171130171740
}
171131171741
}
171132171742
}
171133171743
break;
171134
- case 186: /* expr ::= expr COLLATE ID|STRING */
171744
+ case 185: /* expr ::= expr COLLATE ID|STRING */
171135171745
{
171136171746
yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171137171747
}
171138171748
break;
171139
- case 187: /* expr ::= CAST LP expr AS typetoken RP */
171749
+ case 186: /* expr ::= CAST LP expr AS typetoken RP */
171140171750
{
171141171751
yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171142171752
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171143171753
}
171144171754
break;
171145
- case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
171755
+ case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
171146171756
{
171147171757
yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171148171758
}
171149171759
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171150171760
break;
171151
- case 189: /* expr ::= ID|INDEXED LP STAR RP */
171761
+ case 188: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
171152171762
{
171153171763
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171154171764
}
171155171765
yymsp[-3].minor.yy528 = yylhsminor.yy528;
171156171766
break;
171157
- case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
171767
+ case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
171158171768
{
171159171769
yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171160171770
sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171161171771
}
171162171772
yymsp[-5].minor.yy528 = yylhsminor.yy528;
171163171773
break;
171164
- case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
171774
+ case 190: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
171165171775
{
171166171776
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171167171777
sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171168171778
}
171169171779
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171170171780
break;
171171
- case 192: /* term ::= CTIME_KW */
171781
+ case 191: /* term ::= CTIME_KW */
171172171782
{
171173171783
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171174171784
}
171175171785
yymsp[0].minor.yy528 = yylhsminor.yy528;
171176171786
break;
171177
- case 193: /* expr ::= LP nexprlist COMMA expr RP */
171787
+ case 192: /* expr ::= LP nexprlist COMMA expr RP */
171178171788
{
171179171789
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171180171790
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171181171791
if( yymsp[-4].minor.yy528 ){
171182171792
yymsp[-4].minor.yy528->x.pList = pList;
@@ -171186,26 +171796,26 @@
171186171796
}else{
171187171797
sqlite3ExprListDelete(pParse->db, pList);
171188171798
}
171189171799
}
171190171800
break;
171191
- case 194: /* expr ::= expr AND expr */
171801
+ case 193: /* expr ::= expr AND expr */
171192171802
{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171193171803
break;
171194
- case 195: /* expr ::= expr OR expr */
171195
- case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
171196
- case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
171197
- case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
171198
- case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
171199
- case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
171200
- case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
171804
+ case 194: /* expr ::= expr OR expr */
171805
+ case 195: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==195);
171806
+ case 196: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==196);
171807
+ case 197: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==197);
171808
+ case 198: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==198);
171809
+ case 199: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==199);
171810
+ case 200: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==200);
171201171811
{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171202171812
break;
171203
- case 202: /* likeop ::= NOT LIKE_KW|MATCH */
171813
+ case 201: /* likeop ::= NOT LIKE_KW|MATCH */
171204171814
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171205171815
break;
171206
- case 203: /* expr ::= expr likeop expr */
171816
+ case 202: /* expr ::= expr likeop expr */
171207171817
{
171208171818
ExprList *pList;
171209171819
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171210171820
yymsp[-1].minor.yy0.n &= 0x7fffffff;
171211171821
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171213,11 +171823,11 @@
171213171823
yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171214171824
if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171215171825
if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171216171826
}
171217171827
break;
171218
- case 204: /* expr ::= expr likeop expr ESCAPE expr */
171828
+ case 203: /* expr ::= expr likeop expr ESCAPE expr */
171219171829
{
171220171830
ExprList *pList;
171221171831
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171222171832
yymsp[-3].minor.yy0.n &= 0x7fffffff;
171223171833
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171226,63 +171836,63 @@
171226171836
yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171227171837
if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171228171838
if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171229171839
}
171230171840
break;
171231
- case 205: /* expr ::= expr ISNULL|NOTNULL */
171841
+ case 204: /* expr ::= expr ISNULL|NOTNULL */
171232171842
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171233171843
break;
171234
- case 206: /* expr ::= expr NOT NULL */
171844
+ case 205: /* expr ::= expr NOT NULL */
171235171845
{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171236171846
break;
171237
- case 207: /* expr ::= expr IS expr */
171847
+ case 206: /* expr ::= expr IS expr */
171238171848
{
171239171849
yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171240171850
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171241171851
}
171242171852
break;
171243
- case 208: /* expr ::= expr IS NOT expr */
171853
+ case 207: /* expr ::= expr IS NOT expr */
171244171854
{
171245171855
yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171246171856
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171247171857
}
171248171858
break;
171249
- case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */
171859
+ case 208: /* expr ::= expr IS NOT DISTINCT FROM expr */
171250171860
{
171251171861
yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171252171862
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171253171863
}
171254171864
break;
171255
- case 210: /* expr ::= expr IS DISTINCT FROM expr */
171865
+ case 209: /* expr ::= expr IS DISTINCT FROM expr */
171256171866
{
171257171867
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171258171868
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171259171869
}
171260171870
break;
171261
- case 211: /* expr ::= NOT expr */
171262
- case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212);
171871
+ case 210: /* expr ::= NOT expr */
171872
+ case 211: /* expr ::= BITNOT expr */ yytestcase(yyruleno==211);
171263171873
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171264171874
break;
171265
- case 213: /* expr ::= PLUS|MINUS expr */
171875
+ case 212: /* expr ::= PLUS|MINUS expr */
171266171876
{
171267171877
yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171268171878
/*A-overwrites-B*/
171269171879
}
171270171880
break;
171271
- case 214: /* expr ::= expr PTR expr */
171881
+ case 213: /* expr ::= expr PTR expr */
171272171882
{
171273171883
ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171274171884
pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171275171885
yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171276171886
}
171277171887
yymsp[-2].minor.yy528 = yylhsminor.yy528;
171278171888
break;
171279
- case 215: /* between_op ::= BETWEEN */
171280
- case 218: /* in_op ::= IN */ yytestcase(yyruleno==218);
171889
+ case 214: /* between_op ::= BETWEEN */
171890
+ case 217: /* in_op ::= IN */ yytestcase(yyruleno==217);
171281171891
{yymsp[0].minor.yy394 = 0;}
171282171892
break;
171283
- case 217: /* expr ::= expr between_op expr AND expr */
171893
+ case 216: /* expr ::= expr between_op expr AND expr */
171284171894
{
171285171895
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171286171896
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171287171897
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171288171898
if( yymsp[-4].minor.yy528 ){
@@ -171291,11 +171901,11 @@
171291171901
sqlite3ExprListDelete(pParse->db, pList);
171292171902
}
171293171903
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171294171904
}
171295171905
break;
171296
- case 220: /* expr ::= expr in_op LP exprlist RP */
171906
+ case 219: /* expr ::= expr in_op LP exprlist RP */
171297171907
{
171298171908
if( yymsp[-1].minor.yy322==0 ){
171299171909
/* Expressions of the form
171300171910
**
171301171911
** expr1 IN ()
@@ -171337,41 +171947,41 @@
171337171947
}
171338171948
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171339171949
}
171340171950
}
171341171951
break;
171342
- case 221: /* expr ::= LP select RP */
171952
+ case 220: /* expr ::= LP select RP */
171343171953
{
171344171954
yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171345171955
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171346171956
}
171347171957
break;
171348
- case 222: /* expr ::= expr in_op LP select RP */
171958
+ case 221: /* expr ::= expr in_op LP select RP */
171349171959
{
171350171960
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171351171961
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171352171962
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171353171963
}
171354171964
break;
171355
- case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */
171965
+ case 222: /* expr ::= expr in_op nm dbnm paren_exprlist */
171356171966
{
171357171967
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171358171968
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171359171969
if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171360171970
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171361171971
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171362171972
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171363171973
}
171364171974
break;
171365
- case 224: /* expr ::= EXISTS LP select RP */
171975
+ case 223: /* expr ::= EXISTS LP select RP */
171366171976
{
171367171977
Expr *p;
171368171978
p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171369171979
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171370171980
}
171371171981
break;
171372
- case 225: /* expr ::= CASE case_operand case_exprlist case_else END */
171982
+ case 224: /* expr ::= CASE case_operand case_exprlist case_else END */
171373171983
{
171374171984
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171375171985
if( yymsp[-4].minor.yy528 ){
171376171986
yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171377171987
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171379,406 +171989,406 @@
171379171989
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171380171990
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171381171991
}
171382171992
}
171383171993
break;
171384
- case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171994
+ case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171385171995
{
171386171996
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171387171997
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171388171998
}
171389171999
break;
171390
- case 227: /* case_exprlist ::= WHEN expr THEN expr */
172000
+ case 226: /* case_exprlist ::= WHEN expr THEN expr */
171391172001
{
171392172002
yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171393172003
yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
171394172004
}
171395172005
break;
171396
- case 230: /* case_operand ::= expr */
172006
+ case 229: /* case_operand ::= expr */
171397172007
{yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
171398172008
break;
171399
- case 233: /* nexprlist ::= nexprlist COMMA expr */
172009
+ case 232: /* nexprlist ::= nexprlist COMMA expr */
171400172010
{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
171401172011
break;
171402
- case 234: /* nexprlist ::= expr */
172012
+ case 233: /* nexprlist ::= expr */
171403172013
{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
171404172014
break;
171405
- case 236: /* paren_exprlist ::= LP exprlist RP */
171406
- case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241);
172015
+ case 235: /* paren_exprlist ::= LP exprlist RP */
172016
+ case 240: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==240);
171407172017
{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
171408172018
break;
171409
- case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
172019
+ case 236: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
171410172020
{
171411172021
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
171412172022
sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
171413172023
&yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
171414172024
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
171415172025
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
171416172026
}
171417172027
}
171418172028
break;
171419
- case 238: /* uniqueflag ::= UNIQUE */
171420
- case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280);
172029
+ case 237: /* uniqueflag ::= UNIQUE */
172030
+ case 279: /* raisetype ::= ABORT */ yytestcase(yyruleno==279);
171421172031
{yymsp[0].minor.yy394 = OE_Abort;}
171422172032
break;
171423
- case 239: /* uniqueflag ::= */
172033
+ case 238: /* uniqueflag ::= */
171424172034
{yymsp[1].minor.yy394 = OE_None;}
171425172035
break;
171426
- case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */
172036
+ case 241: /* eidlist ::= eidlist COMMA nm collate sortorder */
171427172037
{
171428172038
yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
171429172039
}
171430172040
break;
171431
- case 243: /* eidlist ::= nm collate sortorder */
172041
+ case 242: /* eidlist ::= nm collate sortorder */
171432172042
{
171433172043
yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
171434172044
}
171435172045
break;
171436
- case 246: /* cmd ::= DROP INDEX ifexists fullname */
172046
+ case 245: /* cmd ::= DROP INDEX ifexists fullname */
171437172047
{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
171438172048
break;
171439
- case 247: /* cmd ::= VACUUM vinto */
172049
+ case 246: /* cmd ::= VACUUM vinto */
171440172050
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
171441172051
break;
171442
- case 248: /* cmd ::= VACUUM nm vinto */
172052
+ case 247: /* cmd ::= VACUUM nm vinto */
171443172053
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
171444172054
break;
171445
- case 251: /* cmd ::= PRAGMA nm dbnm */
172055
+ case 250: /* cmd ::= PRAGMA nm dbnm */
171446172056
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
171447172057
break;
171448
- case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
172058
+ case 251: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171449172059
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
171450172060
break;
171451
- case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
172061
+ case 252: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171452172062
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
171453172063
break;
171454
- case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
172064
+ case 253: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171455172065
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
171456172066
break;
171457
- case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
172067
+ case 254: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171458172068
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
171459172069
break;
171460
- case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
172070
+ case 257: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171461172071
{
171462172072
Token all;
171463172073
all.z = yymsp[-3].minor.yy0.z;
171464172074
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
171465172075
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
171466172076
}
171467172077
break;
171468
- case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
172078
+ case 258: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
171469172079
{
171470172080
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
171471172081
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
171472172082
}
171473172083
break;
171474
- case 260: /* trigger_time ::= BEFORE|AFTER */
172084
+ case 259: /* trigger_time ::= BEFORE|AFTER */
171475172085
{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
171476172086
break;
171477
- case 261: /* trigger_time ::= INSTEAD OF */
172087
+ case 260: /* trigger_time ::= INSTEAD OF */
171478172088
{ yymsp[-1].minor.yy394 = TK_INSTEAD;}
171479172089
break;
171480
- case 262: /* trigger_time ::= */
172090
+ case 261: /* trigger_time ::= */
171481172091
{ yymsp[1].minor.yy394 = TK_BEFORE; }
171482172092
break;
171483
- case 263: /* trigger_event ::= DELETE|INSERT */
171484
- case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264);
172093
+ case 262: /* trigger_event ::= DELETE|INSERT */
172094
+ case 263: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==263);
171485172095
{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
171486172096
break;
171487
- case 265: /* trigger_event ::= UPDATE OF idlist */
172097
+ case 264: /* trigger_event ::= UPDATE OF idlist */
171488172098
{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
171489172099
break;
171490
- case 266: /* when_clause ::= */
171491
- case 285: /* key_opt ::= */ yytestcase(yyruleno==285);
172100
+ case 265: /* when_clause ::= */
172101
+ case 284: /* key_opt ::= */ yytestcase(yyruleno==284);
171492172102
{ yymsp[1].minor.yy528 = 0; }
171493172103
break;
171494
- case 267: /* when_clause ::= WHEN expr */
171495
- case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286);
172104
+ case 266: /* when_clause ::= WHEN expr */
172105
+ case 285: /* key_opt ::= KEY expr */ yytestcase(yyruleno==285);
171496172106
{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
171497172107
break;
171498
- case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
172108
+ case 267: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171499172109
{
171500172110
assert( yymsp[-2].minor.yy33!=0 );
171501172111
yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
171502172112
yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
171503172113
}
171504172114
break;
171505
- case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */
172115
+ case 268: /* trigger_cmd_list ::= trigger_cmd SEMI */
171506172116
{
171507172117
assert( yymsp[-1].minor.yy33!=0 );
171508172118
yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
171509172119
}
171510172120
break;
171511
- case 270: /* trnm ::= nm DOT nm */
172121
+ case 269: /* trnm ::= nm DOT nm */
171512172122
{
171513172123
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
171514172124
sqlite3ErrorMsg(pParse,
171515172125
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
171516172126
"statements within triggers");
171517172127
}
171518172128
break;
171519
- case 271: /* tridxby ::= INDEXED BY nm */
172129
+ case 270: /* tridxby ::= INDEXED BY nm */
171520172130
{
171521172131
sqlite3ErrorMsg(pParse,
171522172132
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
171523172133
"within triggers");
171524172134
}
171525172135
break;
171526
- case 272: /* tridxby ::= NOT INDEXED */
172136
+ case 271: /* tridxby ::= NOT INDEXED */
171527172137
{
171528172138
sqlite3ErrorMsg(pParse,
171529172139
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
171530172140
"within triggers");
171531172141
}
171532172142
break;
171533
- case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
172143
+ case 272: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171534172144
{yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
171535172145
yymsp[-8].minor.yy33 = yylhsminor.yy33;
171536172146
break;
171537
- case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
172147
+ case 273: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
171538172148
{
171539172149
yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
171540172150
}
171541172151
yymsp[-7].minor.yy33 = yylhsminor.yy33;
171542172152
break;
171543
- case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
172153
+ case 274: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171544172154
{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
171545172155
yymsp[-5].minor.yy33 = yylhsminor.yy33;
171546172156
break;
171547
- case 276: /* trigger_cmd ::= scanpt select scanpt */
172157
+ case 275: /* trigger_cmd ::= scanpt select scanpt */
171548172158
{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
171549172159
yymsp[-2].minor.yy33 = yylhsminor.yy33;
171550172160
break;
171551
- case 277: /* expr ::= RAISE LP IGNORE RP */
172161
+ case 276: /* expr ::= RAISE LP IGNORE RP */
171552172162
{
171553172163
yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
171554172164
if( yymsp[-3].minor.yy528 ){
171555172165
yymsp[-3].minor.yy528->affExpr = OE_Ignore;
171556172166
}
171557172167
}
171558172168
break;
171559
- case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */
172169
+ case 277: /* expr ::= RAISE LP raisetype COMMA nm RP */
171560172170
{
171561172171
yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
171562172172
if( yymsp[-5].minor.yy528 ) {
171563172173
yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
171564172174
}
171565172175
}
171566172176
break;
171567
- case 279: /* raisetype ::= ROLLBACK */
172177
+ case 278: /* raisetype ::= ROLLBACK */
171568172178
{yymsp[0].minor.yy394 = OE_Rollback;}
171569172179
break;
171570
- case 281: /* raisetype ::= FAIL */
172180
+ case 280: /* raisetype ::= FAIL */
171571172181
{yymsp[0].minor.yy394 = OE_Fail;}
171572172182
break;
171573
- case 282: /* cmd ::= DROP TRIGGER ifexists fullname */
172183
+ case 281: /* cmd ::= DROP TRIGGER ifexists fullname */
171574172184
{
171575172185
sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
171576172186
}
171577172187
break;
171578
- case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
172188
+ case 282: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
171579172189
{
171580172190
sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
171581172191
}
171582172192
break;
171583
- case 284: /* cmd ::= DETACH database_kw_opt expr */
172193
+ case 283: /* cmd ::= DETACH database_kw_opt expr */
171584172194
{
171585172195
sqlite3Detach(pParse, yymsp[0].minor.yy528);
171586172196
}
171587172197
break;
171588
- case 287: /* cmd ::= REINDEX */
172198
+ case 286: /* cmd ::= REINDEX */
171589172199
{sqlite3Reindex(pParse, 0, 0);}
171590172200
break;
171591
- case 288: /* cmd ::= REINDEX nm dbnm */
172201
+ case 287: /* cmd ::= REINDEX nm dbnm */
171592172202
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171593172203
break;
171594
- case 289: /* cmd ::= ANALYZE */
172204
+ case 288: /* cmd ::= ANALYZE */
171595172205
{sqlite3Analyze(pParse, 0, 0);}
171596172206
break;
171597
- case 290: /* cmd ::= ANALYZE nm dbnm */
172207
+ case 289: /* cmd ::= ANALYZE nm dbnm */
171598172208
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171599172209
break;
171600
- case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
172210
+ case 290: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
171601172211
{
171602172212
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
171603172213
}
171604172214
break;
171605
- case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
172215
+ case 291: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
171606172216
{
171607172217
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
171608172218
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
171609172219
}
171610172220
break;
171611
- case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
172221
+ case 292: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
171612172222
{
171613172223
sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
171614172224
}
171615172225
break;
171616
- case 294: /* add_column_fullname ::= fullname */
172226
+ case 293: /* add_column_fullname ::= fullname */
171617172227
{
171618172228
disableLookaside(pParse);
171619172229
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
171620172230
}
171621172231
break;
171622
- case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
172232
+ case 294: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
171623172233
{
171624172234
sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
171625172235
}
171626172236
break;
171627
- case 296: /* cmd ::= create_vtab */
172237
+ case 295: /* cmd ::= create_vtab */
171628172238
{sqlite3VtabFinishParse(pParse,0);}
171629172239
break;
171630
- case 297: /* cmd ::= create_vtab LP vtabarglist RP */
172240
+ case 296: /* cmd ::= create_vtab LP vtabarglist RP */
171631172241
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
171632172242
break;
171633
- case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
172243
+ case 297: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
171634172244
{
171635172245
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
171636172246
}
171637172247
break;
171638
- case 299: /* vtabarg ::= */
172248
+ case 298: /* vtabarg ::= */
171639172249
{sqlite3VtabArgInit(pParse);}
171640172250
break;
171641
- case 300: /* vtabargtoken ::= ANY */
171642
- case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301);
171643
- case 302: /* lp ::= LP */ yytestcase(yyruleno==302);
172251
+ case 299: /* vtabargtoken ::= ANY */
172252
+ case 300: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==300);
172253
+ case 301: /* lp ::= LP */ yytestcase(yyruleno==301);
171644172254
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
171645172255
break;
171646
- case 303: /* with ::= WITH wqlist */
171647
- case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304);
172256
+ case 302: /* with ::= WITH wqlist */
172257
+ case 303: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==303);
171648172258
{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
171649172259
break;
171650
- case 305: /* wqas ::= AS */
172260
+ case 304: /* wqas ::= AS */
171651172261
{yymsp[0].minor.yy516 = M10d_Any;}
171652172262
break;
171653
- case 306: /* wqas ::= AS MATERIALIZED */
172263
+ case 305: /* wqas ::= AS MATERIALIZED */
171654172264
{yymsp[-1].minor.yy516 = M10d_Yes;}
171655172265
break;
171656
- case 307: /* wqas ::= AS NOT MATERIALIZED */
172266
+ case 306: /* wqas ::= AS NOT MATERIALIZED */
171657172267
{yymsp[-2].minor.yy516 = M10d_No;}
171658172268
break;
171659
- case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */
172269
+ case 307: /* wqitem ::= nm eidlist_opt wqas LP select RP */
171660172270
{
171661172271
yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
171662172272
}
171663172273
break;
171664
- case 309: /* wqlist ::= wqitem */
172274
+ case 308: /* wqlist ::= wqitem */
171665172275
{
171666172276
yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
171667172277
}
171668172278
break;
171669
- case 310: /* wqlist ::= wqlist COMMA wqitem */
172279
+ case 309: /* wqlist ::= wqlist COMMA wqitem */
171670172280
{
171671172281
yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
171672172282
}
171673172283
break;
171674
- case 311: /* windowdefn_list ::= windowdefn */
172284
+ case 310: /* windowdefn_list ::= windowdefn */
171675172285
{ yylhsminor.yy41 = yymsp[0].minor.yy41; }
171676172286
yymsp[0].minor.yy41 = yylhsminor.yy41;
171677172287
break;
171678
- case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
172288
+ case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
171679172289
{
171680172290
assert( yymsp[0].minor.yy41!=0 );
171681172291
sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
171682172292
yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
171683172293
yylhsminor.yy41 = yymsp[0].minor.yy41;
171684172294
}
171685172295
yymsp[-2].minor.yy41 = yylhsminor.yy41;
171686172296
break;
171687
- case 313: /* windowdefn ::= nm AS LP window RP */
172297
+ case 312: /* windowdefn ::= nm AS LP window RP */
171688172298
{
171689172299
if( ALWAYS(yymsp[-1].minor.yy41) ){
171690172300
yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
171691172301
}
171692172302
yylhsminor.yy41 = yymsp[-1].minor.yy41;
171693172303
}
171694172304
yymsp[-4].minor.yy41 = yylhsminor.yy41;
171695172305
break;
171696
- case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
172306
+ case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
171697172307
{
171698172308
yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
171699172309
}
171700172310
break;
171701
- case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
172311
+ case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
171702172312
{
171703172313
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
171704172314
}
171705172315
yymsp[-5].minor.yy41 = yylhsminor.yy41;
171706172316
break;
171707
- case 316: /* window ::= ORDER BY sortlist frame_opt */
172317
+ case 315: /* window ::= ORDER BY sortlist frame_opt */
171708172318
{
171709172319
yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
171710172320
}
171711172321
break;
171712
- case 317: /* window ::= nm ORDER BY sortlist frame_opt */
172322
+ case 316: /* window ::= nm ORDER BY sortlist frame_opt */
171713172323
{
171714172324
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
171715172325
}
171716172326
yymsp[-4].minor.yy41 = yylhsminor.yy41;
171717172327
break;
171718
- case 318: /* window ::= frame_opt */
171719
- case 337: /* filter_over ::= over_clause */ yytestcase(yyruleno==337);
172328
+ case 317: /* window ::= frame_opt */
172329
+ case 336: /* filter_over ::= over_clause */ yytestcase(yyruleno==336);
171720172330
{
171721172331
yylhsminor.yy41 = yymsp[0].minor.yy41;
171722172332
}
171723172333
yymsp[0].minor.yy41 = yylhsminor.yy41;
171724172334
break;
171725
- case 319: /* window ::= nm frame_opt */
172335
+ case 318: /* window ::= nm frame_opt */
171726172336
{
171727172337
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
171728172338
}
171729172339
yymsp[-1].minor.yy41 = yylhsminor.yy41;
171730172340
break;
171731
- case 320: /* frame_opt ::= */
172341
+ case 319: /* frame_opt ::= */
171732172342
{
171733172343
yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
171734172344
}
171735172345
break;
171736
- case 321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
172346
+ case 320: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
171737172347
{
171738172348
yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
171739172349
}
171740172350
yymsp[-2].minor.yy41 = yylhsminor.yy41;
171741172351
break;
171742
- case 322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
172352
+ case 321: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
171743172353
{
171744172354
yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
171745172355
}
171746172356
yymsp[-5].minor.yy41 = yylhsminor.yy41;
171747172357
break;
171748
- case 324: /* frame_bound_s ::= frame_bound */
171749
- case 326: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==326);
172358
+ case 323: /* frame_bound_s ::= frame_bound */
172359
+ case 325: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==325);
171750172360
{yylhsminor.yy595 = yymsp[0].minor.yy595;}
171751172361
yymsp[0].minor.yy595 = yylhsminor.yy595;
171752172362
break;
171753
- case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */
171754
- case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327);
171755
- case 329: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==329);
172363
+ case 324: /* frame_bound_s ::= UNBOUNDED PRECEDING */
172364
+ case 326: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==326);
172365
+ case 328: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==328);
171756172366
{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
171757172367
yymsp[-1].minor.yy595 = yylhsminor.yy595;
171758172368
break;
171759
- case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */
172369
+ case 327: /* frame_bound ::= expr PRECEDING|FOLLOWING */
171760172370
{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
171761172371
yymsp[-1].minor.yy595 = yylhsminor.yy595;
171762172372
break;
171763
- case 330: /* frame_exclude_opt ::= */
172373
+ case 329: /* frame_exclude_opt ::= */
171764172374
{yymsp[1].minor.yy516 = 0;}
171765172375
break;
171766
- case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
172376
+ case 330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
171767172377
{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
171768172378
break;
171769
- case 332: /* frame_exclude ::= NO OTHERS */
171770
- case 333: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==333);
172379
+ case 331: /* frame_exclude ::= NO OTHERS */
172380
+ case 332: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==332);
171771172381
{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
171772172382
break;
171773
- case 334: /* frame_exclude ::= GROUP|TIES */
172383
+ case 333: /* frame_exclude ::= GROUP|TIES */
171774172384
{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
171775172385
break;
171776
- case 335: /* window_clause ::= WINDOW windowdefn_list */
172386
+ case 334: /* window_clause ::= WINDOW windowdefn_list */
171777172387
{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
171778172388
break;
171779
- case 336: /* filter_over ::= filter_clause over_clause */
172389
+ case 335: /* filter_over ::= filter_clause over_clause */
171780172390
{
171781172391
if( yymsp[0].minor.yy41 ){
171782172392
yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
171783172393
}else{
171784172394
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171785,11 +172395,11 @@
171785172395
}
171786172396
yylhsminor.yy41 = yymsp[0].minor.yy41;
171787172397
}
171788172398
yymsp[-1].minor.yy41 = yylhsminor.yy41;
171789172399
break;
171790
- case 338: /* filter_over ::= filter_clause */
172400
+ case 337: /* filter_over ::= filter_clause */
171791172401
{
171792172402
yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171793172403
if( yylhsminor.yy41 ){
171794172404
yylhsminor.yy41->eFrmType = TK_FILTER;
171795172405
yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171797,91 +172407,90 @@
171797172407
sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
171798172408
}
171799172409
}
171800172410
yymsp[0].minor.yy41 = yylhsminor.yy41;
171801172411
break;
171802
- case 339: /* over_clause ::= OVER LP window RP */
172412
+ case 338: /* over_clause ::= OVER LP window RP */
171803172413
{
171804172414
yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
171805172415
assert( yymsp[-3].minor.yy41!=0 );
171806172416
}
171807172417
break;
171808
- case 340: /* over_clause ::= OVER nm */
172418
+ case 339: /* over_clause ::= OVER nm */
171809172419
{
171810172420
yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171811172421
if( yymsp[-1].minor.yy41 ){
171812172422
yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
171813172423
}
171814172424
}
171815172425
break;
171816
- case 341: /* filter_clause ::= FILTER LP WHERE expr RP */
172426
+ case 340: /* filter_clause ::= FILTER LP WHERE expr RP */
171817172427
{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
171818172428
break;
171819172429
default:
171820
- /* (342) input ::= cmdlist */ yytestcase(yyruleno==342);
171821
- /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343);
171822
- /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344);
171823
- /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345);
171824
- /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346);
171825
- /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347);
171826
- /* (348) trans_opt ::= */ yytestcase(yyruleno==348);
171827
- /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349);
171828
- /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350);
171829
- /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351);
171830
- /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352);
171831
- /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353);
171832
- /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354);
171833
- /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355);
171834
- /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356);
171835
- /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357);
171836
- /* (358) nm ::= STRING */ yytestcase(yyruleno==358);
171837
- /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359);
171838
- /* (360) typetoken ::= typename */ yytestcase(yyruleno==360);
171839
- /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361);
171840
- /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362);
171841
- /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363);
171842
- /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364);
171843
- /* (365) carglist ::= */ yytestcase(yyruleno==365);
171844
- /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366);
171845
- /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367);
171846
- /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368);
171847
- /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369);
171848
- /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370);
171849
- /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371);
171850
- /* (372) tconscomma ::= */ yytestcase(yyruleno==372);
171851
- /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373);
171852
- /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374);
171853
- /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375);
171854
- /* (376) oneselect ::= values */ yytestcase(yyruleno==376);
171855
- /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377);
171856
- /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378);
171857
- /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379);
171858
- /* (380) returning ::= */ yytestcase(yyruleno==380);
171859
- /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381);
171860
- /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382);
171861
- /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383);
171862
- /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384);
171863
- /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385);
171864
- /* (386) nmnum ::= ON */ yytestcase(yyruleno==386);
171865
- /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387);
171866
- /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388);
171867
- /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389);
171868
- /* (390) foreach_clause ::= */ yytestcase(yyruleno==390);
171869
- /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391);
171870
- /* (392) trnm ::= nm */ yytestcase(yyruleno==392);
171871
- /* (393) tridxby ::= */ yytestcase(yyruleno==393);
171872
- /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394);
171873
- /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395);
171874
- /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396);
171875
- /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397);
171876
- /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398);
171877
- /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399);
171878
- /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400);
171879
- /* (401) anylist ::= */ yytestcase(yyruleno==401);
171880
- /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402);
171881
- /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403);
171882
- /* (404) with ::= */ yytestcase(yyruleno==404);
172430
+ /* (341) input ::= cmdlist */ yytestcase(yyruleno==341);
172431
+ /* (342) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==342);
172432
+ /* (343) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=343);
172433
+ /* (344) ecmd ::= SEMI */ yytestcase(yyruleno==344);
172434
+ /* (345) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==345);
172435
+ /* (346) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=346);
172436
+ /* (347) trans_opt ::= */ yytestcase(yyruleno==347);
172437
+ /* (348) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==348);
172438
+ /* (349) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==349);
172439
+ /* (350) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==350);
172440
+ /* (351) savepoint_opt ::= */ yytestcase(yyruleno==351);
172441
+ /* (352) cmd ::= create_table create_table_args */ yytestcase(yyruleno==352);
172442
+ /* (353) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=353);
172443
+ /* (354) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==354);
172444
+ /* (355) columnlist ::= columnname carglist */ yytestcase(yyruleno==355);
172445
+ /* (356) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==356);
172446
+ /* (357) nm ::= STRING */ yytestcase(yyruleno==357);
172447
+ /* (358) typetoken ::= typename */ yytestcase(yyruleno==358);
172448
+ /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359);
172449
+ /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
172450
+ /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361);
172451
+ /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362);
172452
+ /* (363) carglist ::= */ yytestcase(yyruleno==363);
172453
+ /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364);
172454
+ /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365);
172455
+ /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366);
172456
+ /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367);
172457
+ /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368);
172458
+ /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369);
172459
+ /* (370) tconscomma ::= */ yytestcase(yyruleno==370);
172460
+ /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371);
172461
+ /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372);
172462
+ /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373);
172463
+ /* (374) oneselect ::= values */ yytestcase(yyruleno==374);
172464
+ /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375);
172465
+ /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376);
172466
+ /* (377) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=377);
172467
+ /* (378) returning ::= */ yytestcase(yyruleno==378);
172468
+ /* (379) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=379);
172469
+ /* (380) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==380);
172470
+ /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381);
172471
+ /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382);
172472
+ /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383);
172473
+ /* (384) nmnum ::= ON */ yytestcase(yyruleno==384);
172474
+ /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385);
172475
+ /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386);
172476
+ /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387);
172477
+ /* (388) foreach_clause ::= */ yytestcase(yyruleno==388);
172478
+ /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389);
172479
+ /* (390) trnm ::= nm */ yytestcase(yyruleno==390);
172480
+ /* (391) tridxby ::= */ yytestcase(yyruleno==391);
172481
+ /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392);
172482
+ /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393);
172483
+ /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394);
172484
+ /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395);
172485
+ /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396);
172486
+ /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397);
172487
+ /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398);
172488
+ /* (399) anylist ::= */ yytestcase(yyruleno==399);
172489
+ /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400);
172490
+ /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401);
172491
+ /* (402) with ::= */ yytestcase(yyruleno==402);
171883172492
break;
171884172493
/********** End reduce actions ************************************************/
171885172494
};
171886172495
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
171887172496
yygoto = yyRuleInfoLhs[yyruleno];
@@ -172453,11 +173062,11 @@
172453173062
132, 0, 98, 38, 39, 0, 20, 45, 117, 93,
172454173063
};
172455173064
/* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
172456173065
** then the i-th keyword has no more hash collisions. Otherwise,
172457173066
** the next keyword with the same hash is aKWHash[i]-1. */
172458
-static const unsigned char aKWNext[147] = {
173067
+static const unsigned char aKWNext[148] = {0,
172459173068
0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0,
172460173069
0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0,
172461173070
141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0,
172462173071
138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
172463173072
0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -172468,11 +173077,11 @@
172468173077
112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0,
172469173078
99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0,
172470173079
102, 0, 0, 87,
172471173080
};
172472173081
/* aKWLen[i] is the length (in bytes) of the i-th keyword */
172473
-static const unsigned char aKWLen[147] = {
173082
+static const unsigned char aKWLen[148] = {0,
172474173083
7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
172475173084
7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
172476173085
6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
172477173086
4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
172478173087
2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
@@ -172484,11 +173093,11 @@
172484173093
4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2,
172485173094
2, 9, 3, 7,
172486173095
};
172487173096
/* aKWOffset[i] is the index into zKWText[] of the start of
172488173097
** the text for the i-th keyword. */
172489
-static const unsigned short int aKWOffset[147] = {
173098
+static const unsigned short int aKWOffset[148] = {0,
172490173099
0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
172491173100
36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
172492173101
86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
172493173102
129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
172494173103
184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
@@ -172499,11 +173108,11 @@
172499173108
520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579,
172500173109
585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645,
172501173110
648, 650, 655, 659,
172502173111
};
172503173112
/* aKWCode[i] is the parser symbol code for the i-th keyword */
172504
-static const unsigned char aKWCode[147] = {
173113
+static const unsigned char aKWCode[148] = {0,
172505173114
TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
172506173115
TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
172507173116
TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
172508173117
TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
172509173118
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -172668,11 +173277,11 @@
172668173277
static int keywordCode(const char *z, int n, int *pType){
172669173278
int i, j;
172670173279
const char *zKW;
172671173280
if( n>=2 ){
172672173281
i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
172673
- for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
173282
+ for(i=(int)aKWHash[i]; i>0; i=aKWNext[i]){
172674173283
if( aKWLen[i]!=n ) continue;
172675173284
zKW = &zKWText[aKWOffset[i]];
172676173285
#ifdef SQLITE_ASCII
172677173286
if( (z[0]&~0x20)!=zKW[0] ) continue;
172678173287
if( (z[1]&~0x20)!=zKW[1] ) continue;
@@ -172684,157 +173293,157 @@
172684173293
if( toupper(z[1])!=zKW[1] ) continue;
172685173294
j = 2;
172686173295
while( j<n && toupper(z[j])==zKW[j] ){ j++; }
172687173296
#endif
172688173297
if( j<n ) continue;
172689
- testcase( i==0 ); /* REINDEX */
172690
- testcase( i==1 ); /* INDEXED */
172691
- testcase( i==2 ); /* INDEX */
172692
- testcase( i==3 ); /* DESC */
172693
- testcase( i==4 ); /* ESCAPE */
172694
- testcase( i==5 ); /* EACH */
172695
- testcase( i==6 ); /* CHECK */
172696
- testcase( i==7 ); /* KEY */
172697
- testcase( i==8 ); /* BEFORE */
172698
- testcase( i==9 ); /* FOREIGN */
172699
- testcase( i==10 ); /* FOR */
172700
- testcase( i==11 ); /* IGNORE */
172701
- testcase( i==12 ); /* REGEXP */
172702
- testcase( i==13 ); /* EXPLAIN */
172703
- testcase( i==14 ); /* INSTEAD */
172704
- testcase( i==15 ); /* ADD */
172705
- testcase( i==16 ); /* DATABASE */
172706
- testcase( i==17 ); /* AS */
172707
- testcase( i==18 ); /* SELECT */
172708
- testcase( i==19 ); /* TABLE */
172709
- testcase( i==20 ); /* LEFT */
172710
- testcase( i==21 ); /* THEN */
172711
- testcase( i==22 ); /* END */
172712
- testcase( i==23 ); /* DEFERRABLE */
172713
- testcase( i==24 ); /* ELSE */
172714
- testcase( i==25 ); /* EXCLUDE */
172715
- testcase( i==26 ); /* DELETE */
172716
- testcase( i==27 ); /* TEMPORARY */
172717
- testcase( i==28 ); /* TEMP */
172718
- testcase( i==29 ); /* OR */
172719
- testcase( i==30 ); /* ISNULL */
172720
- testcase( i==31 ); /* NULLS */
172721
- testcase( i==32 ); /* SAVEPOINT */
172722
- testcase( i==33 ); /* INTERSECT */
172723
- testcase( i==34 ); /* TIES */
172724
- testcase( i==35 ); /* NOTNULL */
172725
- testcase( i==36 ); /* NOT */
172726
- testcase( i==37 ); /* NO */
172727
- testcase( i==38 ); /* NULL */
172728
- testcase( i==39 ); /* LIKE */
172729
- testcase( i==40 ); /* EXCEPT */
172730
- testcase( i==41 ); /* TRANSACTION */
172731
- testcase( i==42 ); /* ACTION */
172732
- testcase( i==43 ); /* ON */
172733
- testcase( i==44 ); /* NATURAL */
172734
- testcase( i==45 ); /* ALTER */
172735
- testcase( i==46 ); /* RAISE */
172736
- testcase( i==47 ); /* EXCLUSIVE */
172737
- testcase( i==48 ); /* EXISTS */
172738
- testcase( i==49 ); /* CONSTRAINT */
172739
- testcase( i==50 ); /* INTO */
172740
- testcase( i==51 ); /* OFFSET */
172741
- testcase( i==52 ); /* OF */
172742
- testcase( i==53 ); /* SET */
172743
- testcase( i==54 ); /* TRIGGER */
172744
- testcase( i==55 ); /* RANGE */
172745
- testcase( i==56 ); /* GENERATED */
172746
- testcase( i==57 ); /* DETACH */
172747
- testcase( i==58 ); /* HAVING */
172748
- testcase( i==59 ); /* GLOB */
172749
- testcase( i==60 ); /* BEGIN */
172750
- testcase( i==61 ); /* INNER */
172751
- testcase( i==62 ); /* REFERENCES */
172752
- testcase( i==63 ); /* UNIQUE */
172753
- testcase( i==64 ); /* QUERY */
172754
- testcase( i==65 ); /* WITHOUT */
172755
- testcase( i==66 ); /* WITH */
172756
- testcase( i==67 ); /* OUTER */
172757
- testcase( i==68 ); /* RELEASE */
172758
- testcase( i==69 ); /* ATTACH */
172759
- testcase( i==70 ); /* BETWEEN */
172760
- testcase( i==71 ); /* NOTHING */
172761
- testcase( i==72 ); /* GROUPS */
172762
- testcase( i==73 ); /* GROUP */
172763
- testcase( i==74 ); /* CASCADE */
172764
- testcase( i==75 ); /* ASC */
172765
- testcase( i==76 ); /* DEFAULT */
172766
- testcase( i==77 ); /* CASE */
172767
- testcase( i==78 ); /* COLLATE */
172768
- testcase( i==79 ); /* CREATE */
172769
- testcase( i==80 ); /* CURRENT_DATE */
172770
- testcase( i==81 ); /* IMMEDIATE */
172771
- testcase( i==82 ); /* JOIN */
172772
- testcase( i==83 ); /* INSERT */
172773
- testcase( i==84 ); /* MATCH */
172774
- testcase( i==85 ); /* PLAN */
172775
- testcase( i==86 ); /* ANALYZE */
172776
- testcase( i==87 ); /* PRAGMA */
172777
- testcase( i==88 ); /* MATERIALIZED */
172778
- testcase( i==89 ); /* DEFERRED */
172779
- testcase( i==90 ); /* DISTINCT */
172780
- testcase( i==91 ); /* IS */
172781
- testcase( i==92 ); /* UPDATE */
172782
- testcase( i==93 ); /* VALUES */
172783
- testcase( i==94 ); /* VIRTUAL */
172784
- testcase( i==95 ); /* ALWAYS */
172785
- testcase( i==96 ); /* WHEN */
172786
- testcase( i==97 ); /* WHERE */
172787
- testcase( i==98 ); /* RECURSIVE */
172788
- testcase( i==99 ); /* ABORT */
172789
- testcase( i==100 ); /* AFTER */
172790
- testcase( i==101 ); /* RENAME */
172791
- testcase( i==102 ); /* AND */
172792
- testcase( i==103 ); /* DROP */
172793
- testcase( i==104 ); /* PARTITION */
172794
- testcase( i==105 ); /* AUTOINCREMENT */
172795
- testcase( i==106 ); /* TO */
172796
- testcase( i==107 ); /* IN */
172797
- testcase( i==108 ); /* CAST */
172798
- testcase( i==109 ); /* COLUMN */
172799
- testcase( i==110 ); /* COMMIT */
172800
- testcase( i==111 ); /* CONFLICT */
172801
- testcase( i==112 ); /* CROSS */
172802
- testcase( i==113 ); /* CURRENT_TIMESTAMP */
172803
- testcase( i==114 ); /* CURRENT_TIME */
172804
- testcase( i==115 ); /* CURRENT */
172805
- testcase( i==116 ); /* PRECEDING */
172806
- testcase( i==117 ); /* FAIL */
172807
- testcase( i==118 ); /* LAST */
172808
- testcase( i==119 ); /* FILTER */
172809
- testcase( i==120 ); /* REPLACE */
172810
- testcase( i==121 ); /* FIRST */
172811
- testcase( i==122 ); /* FOLLOWING */
172812
- testcase( i==123 ); /* FROM */
172813
- testcase( i==124 ); /* FULL */
172814
- testcase( i==125 ); /* LIMIT */
172815
- testcase( i==126 ); /* IF */
172816
- testcase( i==127 ); /* ORDER */
172817
- testcase( i==128 ); /* RESTRICT */
172818
- testcase( i==129 ); /* OTHERS */
172819
- testcase( i==130 ); /* OVER */
172820
- testcase( i==131 ); /* RETURNING */
172821
- testcase( i==132 ); /* RIGHT */
172822
- testcase( i==133 ); /* ROLLBACK */
172823
- testcase( i==134 ); /* ROWS */
172824
- testcase( i==135 ); /* ROW */
172825
- testcase( i==136 ); /* UNBOUNDED */
172826
- testcase( i==137 ); /* UNION */
172827
- testcase( i==138 ); /* USING */
172828
- testcase( i==139 ); /* VACUUM */
172829
- testcase( i==140 ); /* VIEW */
172830
- testcase( i==141 ); /* WINDOW */
172831
- testcase( i==142 ); /* DO */
172832
- testcase( i==143 ); /* BY */
172833
- testcase( i==144 ); /* INITIALLY */
172834
- testcase( i==145 ); /* ALL */
172835
- testcase( i==146 ); /* PRIMARY */
173298
+ testcase( i==1 ); /* REINDEX */
173299
+ testcase( i==2 ); /* INDEXED */
173300
+ testcase( i==3 ); /* INDEX */
173301
+ testcase( i==4 ); /* DESC */
173302
+ testcase( i==5 ); /* ESCAPE */
173303
+ testcase( i==6 ); /* EACH */
173304
+ testcase( i==7 ); /* CHECK */
173305
+ testcase( i==8 ); /* KEY */
173306
+ testcase( i==9 ); /* BEFORE */
173307
+ testcase( i==10 ); /* FOREIGN */
173308
+ testcase( i==11 ); /* FOR */
173309
+ testcase( i==12 ); /* IGNORE */
173310
+ testcase( i==13 ); /* REGEXP */
173311
+ testcase( i==14 ); /* EXPLAIN */
173312
+ testcase( i==15 ); /* INSTEAD */
173313
+ testcase( i==16 ); /* ADD */
173314
+ testcase( i==17 ); /* DATABASE */
173315
+ testcase( i==18 ); /* AS */
173316
+ testcase( i==19 ); /* SELECT */
173317
+ testcase( i==20 ); /* TABLE */
173318
+ testcase( i==21 ); /* LEFT */
173319
+ testcase( i==22 ); /* THEN */
173320
+ testcase( i==23 ); /* END */
173321
+ testcase( i==24 ); /* DEFERRABLE */
173322
+ testcase( i==25 ); /* ELSE */
173323
+ testcase( i==26 ); /* EXCLUDE */
173324
+ testcase( i==27 ); /* DELETE */
173325
+ testcase( i==28 ); /* TEMPORARY */
173326
+ testcase( i==29 ); /* TEMP */
173327
+ testcase( i==30 ); /* OR */
173328
+ testcase( i==31 ); /* ISNULL */
173329
+ testcase( i==32 ); /* NULLS */
173330
+ testcase( i==33 ); /* SAVEPOINT */
173331
+ testcase( i==34 ); /* INTERSECT */
173332
+ testcase( i==35 ); /* TIES */
173333
+ testcase( i==36 ); /* NOTNULL */
173334
+ testcase( i==37 ); /* NOT */
173335
+ testcase( i==38 ); /* NO */
173336
+ testcase( i==39 ); /* NULL */
173337
+ testcase( i==40 ); /* LIKE */
173338
+ testcase( i==41 ); /* EXCEPT */
173339
+ testcase( i==42 ); /* TRANSACTION */
173340
+ testcase( i==43 ); /* ACTION */
173341
+ testcase( i==44 ); /* ON */
173342
+ testcase( i==45 ); /* NATURAL */
173343
+ testcase( i==46 ); /* ALTER */
173344
+ testcase( i==47 ); /* RAISE */
173345
+ testcase( i==48 ); /* EXCLUSIVE */
173346
+ testcase( i==49 ); /* EXISTS */
173347
+ testcase( i==50 ); /* CONSTRAINT */
173348
+ testcase( i==51 ); /* INTO */
173349
+ testcase( i==52 ); /* OFFSET */
173350
+ testcase( i==53 ); /* OF */
173351
+ testcase( i==54 ); /* SET */
173352
+ testcase( i==55 ); /* TRIGGER */
173353
+ testcase( i==56 ); /* RANGE */
173354
+ testcase( i==57 ); /* GENERATED */
173355
+ testcase( i==58 ); /* DETACH */
173356
+ testcase( i==59 ); /* HAVING */
173357
+ testcase( i==60 ); /* GLOB */
173358
+ testcase( i==61 ); /* BEGIN */
173359
+ testcase( i==62 ); /* INNER */
173360
+ testcase( i==63 ); /* REFERENCES */
173361
+ testcase( i==64 ); /* UNIQUE */
173362
+ testcase( i==65 ); /* QUERY */
173363
+ testcase( i==66 ); /* WITHOUT */
173364
+ testcase( i==67 ); /* WITH */
173365
+ testcase( i==68 ); /* OUTER */
173366
+ testcase( i==69 ); /* RELEASE */
173367
+ testcase( i==70 ); /* ATTACH */
173368
+ testcase( i==71 ); /* BETWEEN */
173369
+ testcase( i==72 ); /* NOTHING */
173370
+ testcase( i==73 ); /* GROUPS */
173371
+ testcase( i==74 ); /* GROUP */
173372
+ testcase( i==75 ); /* CASCADE */
173373
+ testcase( i==76 ); /* ASC */
173374
+ testcase( i==77 ); /* DEFAULT */
173375
+ testcase( i==78 ); /* CASE */
173376
+ testcase( i==79 ); /* COLLATE */
173377
+ testcase( i==80 ); /* CREATE */
173378
+ testcase( i==81 ); /* CURRENT_DATE */
173379
+ testcase( i==82 ); /* IMMEDIATE */
173380
+ testcase( i==83 ); /* JOIN */
173381
+ testcase( i==84 ); /* INSERT */
173382
+ testcase( i==85 ); /* MATCH */
173383
+ testcase( i==86 ); /* PLAN */
173384
+ testcase( i==87 ); /* ANALYZE */
173385
+ testcase( i==88 ); /* PRAGMA */
173386
+ testcase( i==89 ); /* MATERIALIZED */
173387
+ testcase( i==90 ); /* DEFERRED */
173388
+ testcase( i==91 ); /* DISTINCT */
173389
+ testcase( i==92 ); /* IS */
173390
+ testcase( i==93 ); /* UPDATE */
173391
+ testcase( i==94 ); /* VALUES */
173392
+ testcase( i==95 ); /* VIRTUAL */
173393
+ testcase( i==96 ); /* ALWAYS */
173394
+ testcase( i==97 ); /* WHEN */
173395
+ testcase( i==98 ); /* WHERE */
173396
+ testcase( i==99 ); /* RECURSIVE */
173397
+ testcase( i==100 ); /* ABORT */
173398
+ testcase( i==101 ); /* AFTER */
173399
+ testcase( i==102 ); /* RENAME */
173400
+ testcase( i==103 ); /* AND */
173401
+ testcase( i==104 ); /* DROP */
173402
+ testcase( i==105 ); /* PARTITION */
173403
+ testcase( i==106 ); /* AUTOINCREMENT */
173404
+ testcase( i==107 ); /* TO */
173405
+ testcase( i==108 ); /* IN */
173406
+ testcase( i==109 ); /* CAST */
173407
+ testcase( i==110 ); /* COLUMN */
173408
+ testcase( i==111 ); /* COMMIT */
173409
+ testcase( i==112 ); /* CONFLICT */
173410
+ testcase( i==113 ); /* CROSS */
173411
+ testcase( i==114 ); /* CURRENT_TIMESTAMP */
173412
+ testcase( i==115 ); /* CURRENT_TIME */
173413
+ testcase( i==116 ); /* CURRENT */
173414
+ testcase( i==117 ); /* PRECEDING */
173415
+ testcase( i==118 ); /* FAIL */
173416
+ testcase( i==119 ); /* LAST */
173417
+ testcase( i==120 ); /* FILTER */
173418
+ testcase( i==121 ); /* REPLACE */
173419
+ testcase( i==122 ); /* FIRST */
173420
+ testcase( i==123 ); /* FOLLOWING */
173421
+ testcase( i==124 ); /* FROM */
173422
+ testcase( i==125 ); /* FULL */
173423
+ testcase( i==126 ); /* LIMIT */
173424
+ testcase( i==127 ); /* IF */
173425
+ testcase( i==128 ); /* ORDER */
173426
+ testcase( i==129 ); /* RESTRICT */
173427
+ testcase( i==130 ); /* OTHERS */
173428
+ testcase( i==131 ); /* OVER */
173429
+ testcase( i==132 ); /* RETURNING */
173430
+ testcase( i==133 ); /* RIGHT */
173431
+ testcase( i==134 ); /* ROLLBACK */
173432
+ testcase( i==135 ); /* ROWS */
173433
+ testcase( i==136 ); /* ROW */
173434
+ testcase( i==137 ); /* UNBOUNDED */
173435
+ testcase( i==138 ); /* UNION */
173436
+ testcase( i==139 ); /* USING */
173437
+ testcase( i==140 ); /* VACUUM */
173438
+ testcase( i==141 ); /* VIEW */
173439
+ testcase( i==142 ); /* WINDOW */
173440
+ testcase( i==143 ); /* DO */
173441
+ testcase( i==144 ); /* BY */
173442
+ testcase( i==145 ); /* INITIALLY */
173443
+ testcase( i==146 ); /* ALL */
173444
+ testcase( i==147 ); /* PRIMARY */
172836173445
*pType = aKWCode[i];
172837173446
break;
172838173447
}
172839173448
}
172840173449
return n;
@@ -172845,10 +173454,11 @@
172845173454
return id;
172846173455
}
172847173456
#define SQLITE_N_KEYWORD 147
172848173457
SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
172849173458
if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
173459
+ i++;
172850173460
*pzName = zKWText + aKWOffset[i];
172851173461
*pnName = aKWLen[i];
172852173462
return SQLITE_OK;
172853173463
}
172854173464
SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; }
@@ -174383,13 +174993,25 @@
174383174993
*/
174384174994
SQLITE_API int sqlite3_config(int op, ...){
174385174995
va_list ap;
174386174996
int rc = SQLITE_OK;
174387174997
174388
- /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
174389
- ** the SQLite library is in use. */
174390
- if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;
174998
+ /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while
174999
+ ** the SQLite library is in use. Except, a few selected opcodes
175000
+ ** are allowed.
175001
+ */
175002
+ if( sqlite3GlobalConfig.isInit ){
175003
+ static const u64 mAnytimeConfigOption = 0
175004
+ | MASKBIT64( SQLITE_CONFIG_LOG )
175005
+ | MASKBIT64( SQLITE_CONFIG_PCACHE_HDRSZ )
175006
+ ;
175007
+ if( op<0 || op>63 || (MASKBIT64(op) & mAnytimeConfigOption)==0 ){
175008
+ return SQLITE_MISUSE_BKPT;
175009
+ }
175010
+ testcase( op==SQLITE_CONFIG_LOG );
175011
+ testcase( op==SQLITE_CONFIG_PCACHE_HDRSZ );
175012
+ }
174391175013
174392175014
va_start(ap, op);
174393175015
switch( op ){
174394175016
174395175017
/* Mutex configuration options are only available in a threadsafe
@@ -174454,10 +175076,11 @@
174454175076
if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
174455175077
*va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
174456175078
break;
174457175079
}
174458175080
case SQLITE_CONFIG_MEMSTATUS: {
175081
+ assert( !sqlite3GlobalConfig.isInit ); /* Cannot change at runtime */
174459175082
/* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
174460175083
** single argument of type int, interpreted as a boolean, which enables
174461175084
** or disables the collection of memory allocation statistics. */
174462175085
sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
174463175086
break;
@@ -174577,12 +175200,14 @@
174577175200
/* MSVC is picky about pulling func ptrs from va lists.
174578175201
** http://support.microsoft.com/kb/47961
174579175202
** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
174580175203
*/
174581175204
typedef void(*LOGFUNC_t)(void*,int,const char*);
174582
- sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
174583
- sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
175205
+ LOGFUNC_t xLog = va_arg(ap, LOGFUNC_t);
175206
+ void *pLogArg = va_arg(ap, void*);
175207
+ AtomicStore(&sqlite3GlobalConfig.xLog, xLog);
175208
+ AtomicStore(&sqlite3GlobalConfig.pLogArg, pLogArg);
174584175209
break;
174585175210
}
174586175211
174587175212
/* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
174588175213
** can be changed at start-time using the
@@ -174592,11 +175217,12 @@
174592175217
case SQLITE_CONFIG_URI: {
174593175218
/* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
174594175219
** argument of type int. If non-zero, then URI handling is globally
174595175220
** enabled. If the parameter is zero, then URI handling is globally
174596175221
** disabled. */
174597
- sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
175222
+ int bOpenUri = va_arg(ap, int);
175223
+ AtomicStore(&sqlite3GlobalConfig.bOpenUri, bOpenUri);
174598175224
break;
174599175225
}
174600175226
174601175227
case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
174602175228
/* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174907,10 +175533,12 @@
174907175533
{ SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
174908175534
{ SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
174909175535
{ SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
174910175536
{ SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
174911175537
{ SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
175538
+ { SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus },
175539
+ { SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder },
174912175540
};
174913175541
unsigned int i;
174914175542
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
174915175543
for(i=0; i<ArraySize(aFlagOp); i++){
174916175544
if( aFlagOp[i].op==op ){
@@ -176892,13 +177520,13 @@
176892177520
char c;
176893177521
int nUri = sqlite3Strlen30(zUri);
176894177522
176895177523
assert( *pzErrMsg==0 );
176896177524
176897
- if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
176898
- || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
176899
- && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
177525
+ if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
177526
+ || AtomicLoad(&sqlite3GlobalConfig.bOpenUri)) /* IMP: R-51689-46548 */
177527
+ && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
176900177528
){
176901177529
char *zOpt;
176902177530
int eState; /* Parser state when parsing URI */
176903177531
int iIn; /* Input character index */
176904177532
int iOut = 0; /* Output character index */
@@ -177300,10 +177928,13 @@
177300177928
#if defined(SQLITE_DEFAULT_DEFENSIVE)
177301177929
| SQLITE_Defensive
177302177930
#endif
177303177931
#if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177304177932
| SQLITE_LegacyAlter
177933
+#endif
177934
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
177935
+ | SQLITE_StmtScanStatus
177305177936
#endif
177306177937
;
177307177938
sqlite3HashInit(&db->aCollSeq);
177308177939
#ifndef SQLITE_OMIT_VIRTUALTABLE
177309177940
sqlite3HashInit(&db->aModule);
@@ -193069,20 +193700,22 @@
193069193700
static int fts3MsrBufferData(
193070193701
Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193071193702
char *pList,
193072193703
i64 nList
193073193704
){
193074
- if( nList>pMsr->nBuffer ){
193705
+ if( (nList+FTS3_NODE_PADDING)>pMsr->nBuffer ){
193075193706
char *pNew;
193076
- pMsr->nBuffer = nList*2;
193077
- pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
193707
+ int nNew = nList*2 + FTS3_NODE_PADDING;
193708
+ pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, nNew);
193078193709
if( !pNew ) return SQLITE_NOMEM;
193079193710
pMsr->aBuffer = pNew;
193711
+ pMsr->nBuffer = nNew;
193080193712
}
193081193713
193082193714
assert( nList>0 );
193083193715
memcpy(pMsr->aBuffer, pList, nList);
193716
+ memset(&pMsr->aBuffer[nList], 0, FTS3_NODE_PADDING);
193084193717
return SQLITE_OK;
193085193718
}
193086193719
193087193720
SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193088193721
Fts3Table *p, /* Virtual table handle */
@@ -199070,12 +199703,15 @@
199070199703
switch( sqlite3_value_type(pValue) ){
199071199704
case SQLITE_NULL: {
199072199705
jsonAppendRaw(p, "null", 4);
199073199706
break;
199074199707
}
199075
- case SQLITE_INTEGER:
199076199708
case SQLITE_FLOAT: {
199709
+ jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue));
199710
+ break;
199711
+ }
199712
+ case SQLITE_INTEGER: {
199077199713
const char *z = (const char*)sqlite3_value_text(pValue);
199078199714
u32 n = (u32)sqlite3_value_bytes(pValue);
199079199715
jsonAppendRaw(p, z, n);
199080199716
break;
199081199717
}
@@ -199517,10 +200153,31 @@
199517200153
int i;
199518200154
for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0;
199519200155
return 1;
199520200156
}
199521200157
200158
+#ifdef SQLITE_ENABLE_JSON_NAN_INF
200159
+/*
200160
+** Extra floating-point literals to allow in JSON.
200161
+*/
200162
+static const struct NanInfName {
200163
+ char c1;
200164
+ char c2;
200165
+ char n;
200166
+ char eType;
200167
+ char nRepl;
200168
+ char *zMatch;
200169
+ char *zRepl;
200170
+} aNanInfName[] = {
200171
+ { 'i', 'I', 3, JSON_REAL, 7, "inf", "9.0e999" },
200172
+ { 'i', 'I', 8, JSON_REAL, 7, "infinity", "9.0e999" },
200173
+ { 'n', 'N', 3, JSON_NULL, 4, "NaN", "null" },
200174
+ { 'q', 'Q', 4, JSON_NULL, 4, "QNaN", "null" },
200175
+ { 's', 'S', 4, JSON_NULL, 4, "SNaN", "null" },
200176
+};
200177
+#endif /* SQLITE_ENABLE_JSON_NAN_INF */
200178
+
199522200179
/*
199523200180
** Parse a single JSON value which begins at pParse->zJson[i]. Return the
199524200181
** index of the first character past the end of the value parsed.
199525200182
**
199526200183
** Return negative for a syntax error. Special cases: return -2 if the
@@ -199662,10 +200319,28 @@
199662200319
c = z[j+1];
199663200320
}
199664200321
if( c<'0' || c>'9' ) return -1;
199665200322
continue;
199666200323
}
200324
+#ifdef SQLITE_ENABLE_JSON_NAN_INF
200325
+ /* Non-standard JSON: Allow "-Inf" (in any case)
200326
+ ** to be understood as floating point literals. */
200327
+ if( (c=='i' || c=='I')
200328
+ && j==i+1
200329
+ && z[i]=='-'
200330
+ && sqlite3StrNICmp(&z[j], "inf",3)==0
200331
+ ){
200332
+ if( !sqlite3Isalnum(z[j+3]) ){
200333
+ jsonParseAddNode(pParse, JSON_REAL, 8, "-9.0e999");
200334
+ return i+4;
200335
+ }else if( (sqlite3StrNICmp(&z[j],"infinity",8)==0 &&
200336
+ !sqlite3Isalnum(z[j+8])) ){
200337
+ jsonParseAddNode(pParse, JSON_REAL, 8, "-9.0e999");
200338
+ return i+9;
200339
+ }
200340
+ }
200341
+#endif
199667200342
break;
199668200343
}
199669200344
if( z[j-1]<'0' ) return -1;
199670200345
jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT,
199671200346
j - i, &z[i]);
@@ -199675,10 +200350,24 @@
199675200350
}else if( c==']' ){
199676200351
return -3; /* End of [...] */
199677200352
}else if( c==0 ){
199678200353
return 0; /* End of file */
199679200354
}else{
200355
+#ifdef SQLITE_ENABLE_JSON_NAN_INF
200356
+ int k, nn;
200357
+ for(k=0; k<sizeof(aNanInfName)/sizeof(aNanInfName[0]); k++){
200358
+ if( c!=aNanInfName[k].c1 && c!=aNanInfName[k].c2 ) continue;
200359
+ nn = aNanInfName[k].n;
200360
+ if( sqlite3StrNICmp(&z[i], aNanInfName[k].zMatch, nn)!=0 ){
200361
+ continue;
200362
+ }
200363
+ if( sqlite3Isalnum(z[i+nn]) ) continue;
200364
+ jsonParseAddNode(pParse, aNanInfName[k].eType,
200365
+ aNanInfName[k].nRepl, aNanInfName[k].zRepl);
200366
+ return i + nn;
200367
+ }
200368
+#endif
199680200369
return -1; /* Syntax error */
199681200370
}
199682200371
}
199683200372
199684200373
/*
@@ -212497,19 +213186,28 @@
212497213186
212498213187
iOff = (i64)(pFrame->iDbPage-1) * p->pgsz;
212499213188
p->rc = pDb->pMethods->xWrite(pDb, p->aBuf, p->pgsz, iOff);
212500213189
}
212501213190
213191
+/*
213192
+** This value is copied from the definition of ZIPVFS_CTRL_FILE_POINTER
213193
+** in zipvfs.h.
213194
+*/
213195
+#define RBU_ZIPVFS_CTRL_FILE_POINTER 230439
212502213196
212503213197
/*
212504213198
** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if
212505213199
** successful, or an SQLite error code otherwise.
212506213200
*/
212507213201
static int rbuLockDatabase(sqlite3 *db){
212508213202
int rc = SQLITE_OK;
212509213203
sqlite3_file *fd = 0;
212510
- sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd);
213204
+
213205
+ sqlite3_file_control(db, "main", RBU_ZIPVFS_CTRL_FILE_POINTER, &fd);
213206
+ if( fd==0 ){
213207
+ sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd);
213208
+ }
212511213209
212512213210
if( fd->pMethods ){
212513213211
rc = fd->pMethods->xLock(fd, SQLITE_LOCK_SHARED);
212514213212
if( rc==SQLITE_OK ){
212515213213
rc = fd->pMethods->xLock(fd, SQLITE_LOCK_EXCLUSIVE);
@@ -215744,10 +216442,11 @@
215744216442
(void)argc;
215745216443
(void)argv;
215746216444
(void)pzErr;
215747216445
215748216446
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
216447
+ sqlite3_vtab_config(db, SQLITE_VTAB_USES_ALL_SCHEMAS);
215749216448
rc = sqlite3_declare_vtab(db,
215750216449
"CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
215751216450
if( rc==SQLITE_OK ){
215752216451
pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable));
215753216452
if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
@@ -215827,11 +216526,10 @@
215827216526
&& pIdxInfo->aOrderBy[0].iColumn<=0
215828216527
&& pIdxInfo->aOrderBy[0].desc==0
215829216528
){
215830216529
pIdxInfo->orderByConsumed = 1;
215831216530
}
215832
- sqlite3VtabUsesAllSchemas(pIdxInfo);
215833216531
return SQLITE_OK;
215834216532
}
215835216533
215836216534
/*
215837216535
** Open a new dbpagevfs cursor.
@@ -218216,13 +218914,14 @@
218216218914
SessionBuffer *p,
218217218915
const char *zStr,
218218218916
int *pRc
218219218917
){
218220218918
int nStr = sqlite3Strlen30(zStr);
218221
- if( 0==sessionBufferGrow(p, nStr, pRc) ){
218919
+ if( 0==sessionBufferGrow(p, nStr+1, pRc) ){
218222218920
memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218223218921
p->nBuf += nStr;
218922
+ p->aBuf[p->nBuf] = 0x00;
218224218923
}
218225218924
}
218226218925
218227218926
/*
218228218927
** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218239,10 +218938,31 @@
218239218938
){
218240218939
char aBuf[24];
218241218940
sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218242218941
sessionAppendStr(p, aBuf, pRc);
218243218942
}
218943
+
218944
+static void sessionAppendPrintf(
218945
+ SessionBuffer *p, /* Buffer to append to */
218946
+ int *pRc,
218947
+ const char *zFmt,
218948
+ ...
218949
+){
218950
+ if( *pRc==SQLITE_OK ){
218951
+ char *zApp = 0;
218952
+ va_list ap;
218953
+ va_start(ap, zFmt);
218954
+ zApp = sqlite3_vmprintf(zFmt, ap);
218955
+ if( zApp==0 ){
218956
+ *pRc = SQLITE_NOMEM;
218957
+ }else{
218958
+ sessionAppendStr(p, zApp, pRc);
218959
+ }
218960
+ va_end(ap);
218961
+ sqlite3_free(zApp);
218962
+ }
218963
+}
218244218964
218245218965
/*
218246218966
** This function is a no-op if *pRc is other than SQLITE_OK when it is
218247218967
** called. Otherwise, append the string zStr enclosed in quotes (") and
218248218968
** with any embedded quote characters escaped to the buffer. No
@@ -218254,11 +218974,11 @@
218254218974
static void sessionAppendIdent(
218255218975
SessionBuffer *p, /* Buffer to a append to */
218256218976
const char *zStr, /* String to quote, escape and append */
218257218977
int *pRc /* IN/OUT: Error code */
218258218978
){
218259
- int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1;
218979
+ int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2;
218260218980
if( 0==sessionBufferGrow(p, nStr, pRc) ){
218261218981
char *zOut = (char *)&p->aBuf[p->nBuf];
218262218982
const char *zIn = zStr;
218263218983
*zOut++ = '"';
218264218984
while( *zIn ){
@@ -218265,10 +218985,11 @@
218265218985
if( *zIn=='"' ) *zOut++ = '"';
218266218986
*zOut++ = *(zIn++);
218267218987
}
218268218988
*zOut++ = '"';
218269218989
p->nBuf = (int)((u8 *)zOut - p->aBuf);
218990
+ p->aBuf[p->nBuf] = 0x00;
218270218991
}
218271218992
}
218272218993
218273218994
/*
218274218995
** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218489,33 +219210,82 @@
218489219210
218490219211
/*
218491219212
** Formulate and prepare a SELECT statement to retrieve a row from table
218492219213
** zTab in database zDb based on its primary key. i.e.
218493219214
**
218494
-** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ...
219215
+** SELECT *, <noop-test> FROM zDb.zTab WHERE (pk1, pk2,...) IS (?1, ?2,...)
219216
+**
219217
+** where <noop-test> is:
219218
+**
219219
+** 1 AND (?A OR ?1 IS <column>) AND ...
219220
+**
219221
+** for each non-pk <column>.
218495219222
*/
218496219223
static int sessionSelectStmt(
218497219224
sqlite3 *db, /* Database handle */
219225
+ int bIgnoreNoop,
218498219226
const char *zDb, /* Database name */
218499219227
const char *zTab, /* Table name */
218500219228
int nCol, /* Number of columns in table */
218501219229
const char **azCol, /* Names of table columns */
218502219230
u8 *abPK, /* PRIMARY KEY array */
218503219231
sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
218504219232
){
218505219233
int rc = SQLITE_OK;
218506219234
char *zSql = 0;
219235
+ const char *zSep = "";
219236
+ const char *zCols = "*";
218507219237
int nSql = -1;
219238
+ int i;
218508219239
219240
+ SessionBuffer nooptest = {0, 0, 0};
219241
+ SessionBuffer pkfield = {0, 0, 0};
219242
+ SessionBuffer pkvar = {0, 0, 0};
219243
+
219244
+ sessionAppendStr(&nooptest, ", 1", &rc);
219245
+
219246
+ if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
219247
+ sessionAppendStr(&nooptest, " AND (?6 OR ?3 IS stat)", &rc);
219248
+ sessionAppendStr(&pkfield, "tbl, idx", &rc);
219249
+ sessionAppendStr(&pkvar,
219250
+ "?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc
219251
+ );
219252
+ zCols = "tbl, ?2, stat";
219253
+ }else{
219254
+ for(i=0; i<nCol; i++){
219255
+
219256
+ if( abPK[i] ){
219257
+ sessionAppendStr(&pkfield, zSep, &rc);
219258
+ sessionAppendStr(&pkvar, zSep, &rc);
219259
+ zSep = ", ";
219260
+ sessionAppendIdent(&pkfield, azCol[i], &rc);
219261
+ sessionAppendPrintf(&pkvar, &rc, "?%d", i+1);
219262
+ }else{
219263
+ sessionAppendPrintf(&nooptest, &rc,
219264
+ " AND (?%d OR ?%d IS %w.%w)", i+1+nCol, i+1, zTab, azCol[i]
219265
+ );
219266
+ }
219267
+ }
219268
+ }
219269
+
219270
+ if( rc==SQLITE_OK ){
219271
+ zSql = sqlite3_mprintf(
219272
+ "SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)",
219273
+ zCols, (bIgnoreNoop ? (char*)nooptest.aBuf : ""),
219274
+ zDb, zTab, (char*)pkfield.aBuf, (char*)pkvar.aBuf
219275
+ );
219276
+ if( zSql==0 ) rc = SQLITE_NOMEM;
219277
+ }
219278
+
219279
+#if 0
218509219280
if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
218510219281
zSql = sqlite3_mprintf(
218511219282
"SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
218512219283
"idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
218513219284
);
218514219285
if( zSql==0 ) rc = SQLITE_NOMEM;
218515219286
}else{
218516
- int i;
218517219287
const char *zSep = "";
218518219288
SessionBuffer buf = {0, 0, 0};
218519219289
218520219290
sessionAppendStr(&buf, "SELECT * FROM ", &rc);
218521219291
sessionAppendIdent(&buf, zDb, &rc);
@@ -218532,15 +219302,19 @@
218532219302
}
218533219303
}
218534219304
zSql = (char*)buf.aBuf;
218535219305
nSql = buf.nBuf;
218536219306
}
219307
+#endif
218537219308
218538219309
if( rc==SQLITE_OK ){
218539219310
rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
218540219311
}
218541219312
sqlite3_free(zSql);
219313
+ sqlite3_free(nooptest.aBuf);
219314
+ sqlite3_free(pkfield.aBuf);
219315
+ sqlite3_free(pkvar.aBuf);
218542219316
return rc;
218543219317
}
218544219318
218545219319
/*
218546219320
** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218696,11 +219470,12 @@
218696219470
sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
218697219471
218698219472
/* Build and compile a statement to execute: */
218699219473
if( rc==SQLITE_OK ){
218700219474
rc = sessionSelectStmt(
218701
- db, pSession->zDb, zName, nCol, azCol, abPK, &pSel);
219475
+ db, 0, pSession->zDb, zName, nCol, azCol, abPK, &pSel
219476
+ );
218702219477
}
218703219478
218704219479
nNoop = buf.nBuf;
218705219480
for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
218706219481
SessionChange *p; /* Used to iterate through changes */
@@ -219885,10 +220660,11 @@
219885220660
int bInvertConstraints; /* Invert when iterating constraints buffer */
219886220661
SessionBuffer constraints; /* Deferred constraints are stored here */
219887220662
SessionBuffer rebase; /* Rebase information (if any) here */
219888220663
u8 bRebaseStarted; /* If table header is already in rebase */
219889220664
u8 bRebase; /* True to collect rebase information */
220665
+ u8 bIgnoreNoop; /* True to ignore no-op conflicts */
219890220666
};
219891220667
219892220668
/* Number of prepared UPDATE statements to cache. */
219893220669
#define SESSION_UPDATE_CACHE_SZ 12
219894220670
@@ -220135,12 +220911,13 @@
220135220911
static int sessionSelectRow(
220136220912
sqlite3 *db, /* Database handle */
220137220913
const char *zTab, /* Table name */
220138220914
SessionApplyCtx *p /* Session changeset-apply context */
220139220915
){
220140
- return sessionSelectStmt(
220141
- db, "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect);
220916
+ return sessionSelectStmt(db, p->bIgnoreNoop,
220917
+ "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect
220918
+ );
220142220919
}
220143220920
220144220921
/*
220145220922
** Formulate and prepare an INSERT statement to add a record to table zTab.
220146220923
** For example:
@@ -220295,23 +221072,36 @@
220295221072
** new.* record to the SELECT statement. Or, if it points to a DELETE or
220296221073
** UPDATE, bind values from the old.* record.
220297221074
*/
220298221075
static int sessionSeekToRow(
220299221076
sqlite3_changeset_iter *pIter, /* Changeset iterator */
220300
- u8 *abPK, /* Primary key flags array */
220301
- sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
221077
+ SessionApplyCtx *p
220302221078
){
221079
+ sqlite3_stmt *pSelect = p->pSelect;
220303221080
int rc; /* Return code */
220304221081
int nCol; /* Number of columns in table */
220305221082
int op; /* Changset operation (SQLITE_UPDATE etc.) */
220306221083
const char *zDummy; /* Unused */
220307221084
221085
+ sqlite3_clear_bindings(pSelect);
220308221086
sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
220309221087
rc = sessionBindRow(pIter,
220310221088
op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
220311
- nCol, abPK, pSelect
221089
+ nCol, p->abPK, pSelect
220312221090
);
221091
+
221092
+ if( op!=SQLITE_DELETE && p->bIgnoreNoop ){
221093
+ int ii;
221094
+ for(ii=0; rc==SQLITE_OK && ii<nCol; ii++){
221095
+ if( p->abPK[ii]==0 ){
221096
+ sqlite3_value *pVal = 0;
221097
+ sqlite3changeset_new(pIter, ii, &pVal);
221098
+ sqlite3_bind_int(pSelect, ii+1+nCol, (pVal==0));
221099
+ if( pVal ) rc = sessionBindValue(pSelect, ii+1, pVal);
221100
+ }
221101
+ }
221102
+ }
220313221103
220314221104
if( rc==SQLITE_OK ){
220315221105
rc = sqlite3_step(pSelect);
220316221106
if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
220317221107
}
@@ -220423,20 +221213,26 @@
220423221213
assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
220424221214
assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
220425221215
220426221216
/* Bind the new.* PRIMARY KEY values to the SELECT statement. */
220427221217
if( pbReplace ){
220428
- rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
221218
+ rc = sessionSeekToRow(pIter, p);
220429221219
}else{
220430221220
rc = SQLITE_OK;
220431221221
}
220432221222
220433221223
if( rc==SQLITE_ROW ){
220434221224
/* There exists another row with the new.* primary key. */
220435
- pIter->pConflict = p->pSelect;
220436
- res = xConflict(pCtx, eType, pIter);
220437
- pIter->pConflict = 0;
221225
+ if( p->bIgnoreNoop
221226
+ && sqlite3_column_int(p->pSelect, sqlite3_column_count(p->pSelect)-1)
221227
+ ){
221228
+ res = SQLITE_CHANGESET_OMIT;
221229
+ }else{
221230
+ pIter->pConflict = p->pSelect;
221231
+ res = xConflict(pCtx, eType, pIter);
221232
+ pIter->pConflict = 0;
221233
+ }
220438221234
rc = sqlite3_reset(p->pSelect);
220439221235
}else if( rc==SQLITE_OK ){
220440221236
if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
220441221237
/* Instead of invoking the conflict handler, append the change blob
220442221238
** to the SessionApplyCtx.constraints buffer. */
@@ -220540,11 +221336,11 @@
220540221336
}
220541221337
if( rc!=SQLITE_OK ) return rc;
220542221338
220543221339
sqlite3_step(p->pDelete);
220544221340
rc = sqlite3_reset(p->pDelete);
220545
- if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){
221341
+ if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 && p->bIgnoreNoop==0 ){
220546221342
rc = sessionConflictHandler(
220547221343
SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
220548221344
);
220549221345
}else if( (rc&0xff)==SQLITE_CONSTRAINT ){
220550221346
rc = sessionConflictHandler(
@@ -220597,11 +221393,11 @@
220597221393
assert( op==SQLITE_INSERT );
220598221394
if( p->bStat1 ){
220599221395
/* Check if there is a conflicting row. For sqlite_stat1, this needs
220600221396
** to be done using a SELECT, as there is no PRIMARY KEY in the
220601221397
** database schema to throw an exception if a duplicate is inserted. */
220602
- rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
221398
+ rc = sessionSeekToRow(pIter, p);
220603221399
if( rc==SQLITE_ROW ){
220604221400
rc = SQLITE_CONSTRAINT;
220605221401
sqlite3_reset(p->pSelect);
220606221402
}
220607221403
}
@@ -220774,10 +221570,11 @@
220774221570
220775221571
pIter->in.bNoDiscard = 1;
220776221572
memset(&sApply, 0, sizeof(sApply));
220777221573
sApply.bRebase = (ppRebase && pnRebase);
220778221574
sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
221575
+ sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP);
220779221576
sqlite3_mutex_enter(sqlite3_db_mutex(db));
220780221577
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
220781221578
rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
220782221579
}
220783221580
if( rc==SQLITE_OK ){
@@ -225030,11 +225827,11 @@
225030225827
UNUSED_PARAM2(pToken, nToken);
225031225828
225032225829
if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
225033225830
iPos = p->iPos++;
225034225831
225035
- if( p->iRangeEnd>0 ){
225832
+ if( p->iRangeEnd>=0 ){
225036225833
if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
225037225834
if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
225038225835
}
225039225836
225040225837
if( iPos==p->iter.iStart ){
@@ -225042,11 +225839,11 @@
225042225839
fts5HighlightAppend(&rc, p, p->zOpen, -1);
225043225840
p->iOff = iStartOff;
225044225841
}
225045225842
225046225843
if( iPos==p->iter.iEnd ){
225047
- if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){
225844
+ if( p->iRangeEnd>=0 && p->iter.iStart<p->iRangeStart ){
225048225845
fts5HighlightAppend(&rc, p, p->zOpen, -1);
225049225846
}
225050225847
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225051225848
fts5HighlightAppend(&rc, p, p->zClose, -1);
225052225849
p->iOff = iEndOff;
@@ -225053,11 +225850,11 @@
225053225850
if( rc==SQLITE_OK ){
225054225851
rc = fts5CInstIterNext(&p->iter);
225055225852
}
225056225853
}
225057225854
225058
- if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
225855
+ if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){
225059225856
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225060225857
p->iOff = iEndOff;
225061225858
if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225062225859
fts5HighlightAppend(&rc, p, p->zClose, -1);
225063225860
}
@@ -225088,10 +225885,11 @@
225088225885
225089225886
iCol = sqlite3_value_int(apVal[0]);
225090225887
memset(&ctx, 0, sizeof(HighlightContext));
225091225888
ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225092225889
ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
225890
+ ctx.iRangeEnd = -1;
225093225891
rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225094225892
225095225893
if( ctx.zIn ){
225096225894
if( rc==SQLITE_OK ){
225097225895
rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225273,10 +226071,11 @@
225273226071
nCol = pApi->xColumnCount(pFts);
225274226072
memset(&ctx, 0, sizeof(HighlightContext));
225275226073
iCol = sqlite3_value_int(apVal[0]);
225276226074
ctx.zOpen = fts5ValueToText(apVal[1]);
225277226075
ctx.zClose = fts5ValueToText(apVal[2]);
226076
+ ctx.iRangeEnd = -1;
225278226077
zEllips = fts5ValueToText(apVal[3]);
225279226078
nToken = sqlite3_value_int(apVal[4]);
225280226079
225281226080
iBestCol = (iCol>=0 ? iCol : 0);
225282226081
nPhrase = pApi->xPhraseCount(pFts);
@@ -240222,11 +241021,11 @@
240222241021
int nArg, /* Number of args */
240223241022
sqlite3_value **apUnused /* Function arguments */
240224241023
){
240225241024
assert( nArg==0 );
240226241025
UNUSED_PARAM2(nArg, apUnused);
240227
- sqlite3_result_text(pCtx, "fts5: 2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730", -1, SQLITE_TRANSIENT);
241026
+ sqlite3_result_text(pCtx, "fts5: 2023-04-10 13:20:51 49ba030080dd00b4fdf788fd3da057b333e705fa0fe37d653e2461bf96ca3785", -1, SQLITE_TRANSIENT);
240228241027
}
240229241028
240230241029
/*
240231241030
** Return true if zName is the extension on one of the shadow tables used
240232241031
** by this module.
240233241032
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.41.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.41.1"
456 #define SQLITE_VERSION_NUMBER 3041001
457 #define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -1959,23 +1959,26 @@
1959 **
1960 ** <b>The sqlite3_config() interface is not threadsafe. The application
1961 ** must ensure that no other SQLite interfaces are invoked by other
1962 ** threads while sqlite3_config() is running.</b>
1963 **
1964 ** The sqlite3_config() interface
1965 ** may only be invoked prior to library initialization using
1966 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1967 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1968 ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1969 ** Note, however, that ^sqlite3_config() can be called as part of the
1970 ** implementation of an application-defined [sqlite3_os_init()].
1971 **
1972 ** The first argument to sqlite3_config() is an integer
1973 ** [configuration option] that determines
1974 ** what property of SQLite is to be configured. Subsequent arguments
1975 ** vary depending on the [configuration option]
1976 ** in the first argument.
 
 
 
 
 
 
 
 
 
 
 
1977 **
1978 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1979 ** ^If the option is unknown or SQLite is unable to set the option
1980 ** then this routine returns a non-zero [error code].
1981 */
@@ -2079,10 +2082,27 @@
2079 ** CAPI3REF: Configuration Options
2080 ** KEYWORDS: {configuration option}
2081 **
2082 ** These constants are the available integer configuration options that
2083 ** can be passed as the first argument to the [sqlite3_config()] interface.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2084 **
2085 ** New configuration options may be added in future releases of SQLite.
2086 ** Existing configuration options might be discontinued. Applications
2087 ** should check the return code from [sqlite3_config()] to make sure that
2088 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2740,10 +2760,30 @@
2740 ** the [VACUUM] command will fail with an obscure error when attempting to
2741 ** process a table with generated columns and a descending index. This is
2742 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2743 ** either generated columns or decending indexes.
2744 ** </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2745 ** </dl>
2746 */
2747 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2748 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2749 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2760,11 +2800,13 @@
2760 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2761 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2762 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2763 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2764 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2765 #define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
 
 
2766
2767 /*
2768 ** CAPI3REF: Enable Or Disable Extended Result Codes
2769 ** METHOD: sqlite3
2770 **
@@ -9868,22 +9910,32 @@
9868 ** </dd>
9869 **
9870 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
9871 ** <dd>Calls of the form
9872 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9873 ** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
9874 ** identify that virtual table as being safe to use from within triggers
9875 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
9876 ** virtual table can do no serious harm even if it is controlled by a
9877 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
9878 ** flag unless absolutely necessary.
9879 ** </dd>
 
 
 
 
 
 
 
 
 
9880 ** </dl>
9881 */
9882 #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
9883 #define SQLITE_VTAB_INNOCUOUS 2
9884 #define SQLITE_VTAB_DIRECTONLY 3
 
9885
9886 /*
9887 ** CAPI3REF: Determine The Virtual Table Conflict Policy
9888 **
9889 ** This function may only be called from within a call to the [xUpdate] method
@@ -12217,13 +12269,27 @@
12217 **
12218 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
12219 ** Invert the changeset before applying it. This is equivalent to inverting
12220 ** a changeset using sqlite3changeset_invert() before applying it. It is
12221 ** an error to specify this flag with a patchset.
 
 
 
 
 
 
 
 
 
 
 
 
 
12222 */
12223 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
12224 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
 
12225
12226 /*
12227 ** CAPI3REF: Constants Passed To The Conflict Handler
12228 **
12229 ** Values that may be passed as the second argument to a conflict-handler.
@@ -13516,12 +13582,12 @@
13516 #pragma warn -csu /* Comparing signed and unsigned */
13517 #pragma warn -spa /* Suspicious pointer arithmetic */
13518 #endif
13519
13520 /*
13521 ** WAL mode depends on atomic aligned 32-bit loads and stores in a few
13522 ** places. The following macros try to make this explicit.
13523 */
13524 #ifndef __has_extension
13525 # define __has_extension(x) 0 /* compatibility with non-clang compilers */
13526 #endif
13527 #if GCC_VERSION>=4007000 || __has_extension(c_atomic)
@@ -13573,19 +13639,26 @@
13573 # define SQLITE_INT_TO_PTR(X) ((void*)(X))
13574 # define SQLITE_PTR_TO_INT(X) ((int)(X))
13575 #endif
13576
13577 /*
13578 ** A macro to hint to the compiler that a function should not be
13579 ** inlined.
13580 */
13581 #if defined(__GNUC__)
13582 # define SQLITE_NOINLINE __attribute__((noinline))
 
13583 #elif defined(_MSC_VER) && _MSC_VER>=1310
13584 # define SQLITE_NOINLINE __declspec(noinline)
 
13585 #else
13586 # define SQLITE_NOINLINE
 
 
 
 
 
13587 #endif
13588
13589 /*
13590 ** Make sure that the compiler intrinsics we desire are enabled when
13591 ** compiling with an appropriate version of MSVC unless prevented by
@@ -16541,10 +16614,14 @@
16541 #endif
16542
16543 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
16544 SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*);
16545 #endif
 
 
 
 
16546
16547 #endif /* SQLITE_VDBE_H */
16548
16549 /************** End of vdbe.h ************************************************/
16550 /************** Continuing where we left off in sqliteInt.h ******************/
@@ -16590,11 +16667,11 @@
16590 /**********************************************************************
16591 ** Elements above, except pCache, are public. All that follow are
16592 ** private to pcache.c and should not be accessed by other modules.
16593 ** pCache is grouped with the public elements for efficiency.
16594 */
16595 i16 nRef; /* Number of users of this page */
16596 PgHdr *pDirtyNext; /* Next element in list of dirty pages */
16597 PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
16598 /* NB: pDirtyNext and pDirtyPrev are undefined if the
16599 ** PgHdr object is not dirty */
16600 };
@@ -16671,16 +16748,16 @@
16671
16672 /* Discard the contents of the cache */
16673 SQLITE_PRIVATE void sqlite3PcacheClear(PCache*);
16674
16675 /* Return the total number of outstanding page references */
16676 SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*);
16677
16678 /* Increment the reference count of an existing page */
16679 SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);
16680
16681 SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*);
16682
16683 /* Return the total number of pages stored in the cache */
16684 SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);
16685
16686 #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
@@ -17251,11 +17328,11 @@
17251 #define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
17252 ** vtabs in the schema definition */
17253 #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
17254 /* result set is empty */
17255 #define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
17256 #define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */
17257 #define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
17258 #define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
17259 #define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
17260 #define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
17261 #define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
@@ -17277,10 +17354,11 @@
17277 #define SQLITE_EnableView 0x80000000 /* Enable the use of views */
17278 #define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
17279 /* DELETE, or UPDATE and return */
17280 /* the count using a callback. */
17281 #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
 
17282
17283 /* Flags used only if debugging */
17284 #ifdef SQLITE_DEBUG
17285 #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
17286 #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -17333,10 +17411,11 @@
17333 #define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */
17334 #define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
17335 /* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
17336 #define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
17337 #define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
 
17338 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
17339
17340 /*
17341 ** Macros for testing whether or not optimizations are enabled or disabled.
17342 */
@@ -17804,10 +17883,11 @@
17804 sqlite3 *db; /* Database connection associated with this table */
17805 Module *pMod; /* Pointer to module implementation */
17806 sqlite3_vtab *pVtab; /* Pointer to vtab instance */
17807 int nRef; /* Number of pointers to this structure */
17808 u8 bConstraint; /* True if constraints are supported */
 
17809 u8 eVtabRisk; /* Riskiness of allowing hacker access */
17810 int iSavepoint; /* Depth of the SAVEPOINT stack */
17811 VTable *pNext; /* Next in linked list (see above) */
17812 };
17813
@@ -18835,11 +18915,11 @@
18835 #define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */
18836 #define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */
18837 #define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
18838 #define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
18839 #define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
18840 #define NC_VarSelect 0x000040 /* A correlated subquery has been seen */
18841 #define NC_UEList 0x000080 /* True if uNC.pEList is used */
18842 #define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
18843 #define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
18844 #define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */
18845 #define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */
@@ -19207,10 +19287,13 @@
19207 u8 prepFlags; /* SQLITE_PREPARE_* flags */
19208 u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
19209 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
19210 u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
19211 #endif
 
 
 
19212 int nRangeReg; /* Size of the temporary register block */
19213 int iRangeReg; /* First register in temporary register block */
19214 int nErr; /* Number of errors seen */
19215 int nTab; /* Number of previously allocated VDBE cursors */
19216 int nMem; /* Number of memory cells used so far */
@@ -19667,10 +19750,11 @@
19667 struct RenameCtx *pRename; /* RENAME COLUMN context */
19668 struct Table *pTab; /* Table of generated column */
19669 struct CoveringIndexCheck *pCovIdxCk; /* Check for covering index */
19670 SrcItem *pSrcItem; /* A single FROM clause item */
19671 DbFixer *pFix; /* See sqlite3FixSelect() */
 
19672 } u;
19673 };
19674
19675 /*
19676 ** The following structure contains information used by the sqliteFix...
@@ -20138,10 +20222,14 @@
20138 SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
20139 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
20140 SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
20141 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
20142 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
 
 
 
 
20143 #ifdef SQLITE_DEBUG
20144 SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
20145 #endif
20146 SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
20147 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20288,11 +20376,11 @@
20288 SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
20289 SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
20290 Expr*,ExprList*,u32,Expr*);
20291 SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
20292 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20293 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
20294 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
20295 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
20296 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
20297 #endif
20298 SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -20825,14 +20913,11 @@
20825 SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
20826 SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
20827 SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *);
20828
20829 SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20830 #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
20831 && !defined(SQLITE_OMIT_VIRTUALTABLE)
20832 SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info*);
20833 #endif
20834 SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
20835 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
20836 SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
20837 SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*);
20838 SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*);
@@ -21074,10 +21159,16 @@
21074 #if defined(VDBE_PROFILE) \
21075 || defined(SQLITE_PERFORMANCE_TRACE) \
21076 || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
21077 SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
21078 #endif
 
 
 
 
 
 
21079
21080 #endif /* SQLITEINT_H */
21081
21082 /************** End of sqliteInt.h *******************************************/
21083 /************** Begin file os_common.h ***************************************/
@@ -22264,11 +22355,11 @@
22264 0, /* xAltLocaltime */
22265 0x7ffffffe, /* iOnceResetThreshold */
22266 SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
22267 0, /* iPrngSeed */
22268 #ifdef SQLITE_DEBUG
22269 {0,0,0,0,0,0} /* aTune */
22270 #endif
22271 };
22272
22273 /*
22274 ** Hash table for global functions - functions common to all
@@ -30069,10 +30160,24 @@
30069 *val = (*val - d)*10.0;
30070 return (char)digit;
30071 }
30072 #endif /* SQLITE_OMIT_FLOATING_POINT */
30073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30074 /*
30075 ** Set the StrAccum object to an error mode.
30076 */
30077 SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
30078 assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30161,10 +30266,12 @@
30161 etByte xtype = etINVALID; /* Conversion paradigm */
30162 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
30163 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
30164 sqlite_uint64 longvalue; /* Value for integer types */
30165 LONGDOUBLE_TYPE realvalue; /* Value for real types */
 
 
30166 const et_info *infop; /* Pointer to the appropriate info structure */
30167 char *zOut; /* Rendering buffer */
30168 int nOut; /* Size of the rendering buffer */
30169 char *zExtra = 0; /* Malloced memory used by some conversion */
30170 #ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30467,56 +30574,82 @@
30467 realvalue = -realvalue;
30468 prefix = '-';
30469 }else{
30470 prefix = flag_prefix;
30471 }
 
30472 if( xtype==etGENERIC && precision>0 ) precision--;
30473 testcase( precision>0xfff );
30474 idx = precision & 0xfff;
30475 rounder = arRound[idx%10];
30476 while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30477 if( xtype==etFLOAT ){
30478 double rx = (double)realvalue;
30479 sqlite3_uint64 u;
30480 int ex;
30481 memcpy(&u, &rx, sizeof(u));
30482 ex = -1023 + (int)((u>>52)&0x7ff);
30483 if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30484 realvalue += rounder;
30485 }
30486 /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30487 exp = 0;
30488 if( sqlite3IsNaN((double)realvalue) ){
30489 bufpt = "NaN";
30490 length = 3;
30491 break;
30492 }
30493 if( realvalue>0.0 ){
30494 LONGDOUBLE_TYPE scale = 1.0;
30495 while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
30496 while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
30497 while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30498 realvalue /= scale;
30499 while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30500 while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30501 if( exp>350 ){
30502 bufpt = buf;
30503 buf[0] = prefix;
30504 memcpy(buf+(prefix!=0),"Inf",4);
30505 length = 3+(prefix!=0);
30506 break;
30507 }
30508 }
30509 bufpt = buf;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30510 /*
30511 ** If the field type is etGENERIC, then convert to either etEXP
30512 ** or etFLOAT, as appropriate.
30513 */
30514 if( xtype!=etFLOAT ){
30515 realvalue += rounder;
30516 if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30517 }
30518 if( xtype==etGENERIC ){
30519 flag_rtz = !flag_alternateform;
30520 if( exp<-4 || exp>precision ){
30521 xtype = etEXP;
30522 }else{
@@ -30529,28 +30662,33 @@
30529 if( xtype==etEXP ){
30530 e2 = 0;
30531 }else{
30532 e2 = exp;
30533 }
 
 
30534 {
30535 i64 szBufNeeded; /* Size of a temporary buffer needed */
30536 szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30537 if( szBufNeeded > etBUFSIZE ){
30538 bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
30539 if( bufpt==0 ) return;
30540 }
30541 }
30542 zOut = bufpt;
30543 nsd = 16 + flag_altform2*10;
30544 flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
30545 /* The sign in front of the number */
30546 if( prefix ){
30547 *(bufpt++) = prefix;
30548 }
30549 /* Digits prior to the decimal point */
30550 if( e2<0 ){
30551 *(bufpt++) = '0';
 
 
 
 
30552 }else{
30553 for(; e2>=0; e2--){
30554 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30555 }
30556 }
@@ -30563,12 +30701,18 @@
30563 for(e2++; e2<0; precision--, e2++){
30564 assert( precision>0 );
30565 *(bufpt++) = '0';
30566 }
30567 /* Significant digits after the decimal point */
30568 while( (precision--)>0 ){
30569 *(bufpt++) = et_getdigit(&realvalue,&nsd);
 
 
 
 
 
 
30570 }
30571 /* Remove trailing zeros and the "." if no digits follow the "." */
30572 if( flag_rtz && flag_dp ){
30573 while( bufpt[-1]=='0' ) *(--bufpt) = 0;
30574 assert( bufpt>zOut );
@@ -31245,16 +31389,26 @@
31245 sqlite3_str_vappendf(&acc, zFormat, ap);
31246 zBuf[acc.nChar] = 0;
31247 return zBuf;
31248 }
31249 SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31250 char *z;
31251 va_list ap;
 
 
 
 
 
 
 
 
 
31252 va_start(ap,zFormat);
31253 z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
31254 va_end(ap);
31255 return z;
 
31256 }
31257
31258 /*
31259 ** This is the routine that actually formats the sqlite3_log() message.
31260 ** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52652,11 +52806,11 @@
52652 ** pointers).
52653 */
52654 struct PCache {
52655 PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
52656 PgHdr *pSynced; /* Last synced page in dirty page list */
52657 int nRefSum; /* Sum of ref counts over all pages */
52658 int szCache; /* Configured cache size */
52659 int szSpill; /* Size before spilling occurs */
52660 int szPage; /* Size of every page in this cache */
52661 int szExtra; /* Size of extra space for each page */
52662 u8 bPurgeable; /* True if pages are on backing store */
@@ -52682,11 +52836,11 @@
52682 static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
52683 PgHdr *pPg;
52684 unsigned char *a;
52685 int j;
52686 pPg = (PgHdr*)pLower->pExtra;
52687 printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52688 a = (unsigned char *)pLower->pBuf;
52689 for(j=0; j<12; j++) printf("%02x", a[j]);
52690 printf(" ptr %p\n", pPg);
52691 }
52692 static void pcacheDump(PCache *pCache){
@@ -53426,18 +53580,18 @@
53426 ** Return the total number of references to all pages held by the cache.
53427 **
53428 ** This is not the total number of pages referenced, but the sum of the
53429 ** reference count for all pages.
53430 */
53431 SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){
53432 return pCache->nRefSum;
53433 }
53434
53435 /*
53436 ** Return the number of references to the page supplied as an argument.
53437 */
53438 SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){
53439 return p->nRef;
53440 }
53441
53442 /*
53443 ** Return the total number of pages in the cache.
@@ -68091,12 +68245,13 @@
68091 int mxErr; /* Stop accumulating errors when this reaches zero */
68092 int nErr; /* Number of messages written to zErrMsg so far */
68093 int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
68094 u32 nStep; /* Number of steps into the integrity_check process */
68095 const char *zPfx; /* Error message prefix */
68096 Pgno v1; /* Value for first %u substitution in zPfx */
68097 int v2; /* Value for second %d substitution in zPfx */
 
68098 StrAccum errMsg; /* Accumulate the error message text here */
68099 u32 *heap; /* Min-heap used for analyzing cell coverage */
68100 sqlite3 *db; /* Database connection running the check */
68101 };
68102
@@ -68555,12 +68710,12 @@
68555 */
68556 #ifdef SQLITE_DEBUG
68557 int corruptPageError(int lineno, MemPage *p){
68558 char *zMsg;
68559 sqlite3BeginBenignMalloc();
68560 zMsg = sqlite3_mprintf("database corruption page %d of %s",
68561 (int)p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
68562 );
68563 sqlite3EndBenignMalloc();
68564 if( zMsg ){
68565 sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
68566 }
@@ -69365,12 +69520,29 @@
69365 ** and number of the varargs parameters) is determined by the eHintType
69366 ** parameter. See the definitions of the BTREE_HINT_* macros for details.
69367 */
69368 SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){
69369 /* Used only by system that substitute their own storage engine */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69370 }
69371 #endif
 
69372
69373 /*
69374 ** Provide flag hints to the cursor.
69375 */
69376 SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){
@@ -69451,11 +69623,11 @@
69451 }
69452 assert( offset <= (int)pBt->usableSize-5 );
69453 pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
69454
69455 if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69456 TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
69457 *pRC= rc = sqlite3PagerWrite(pDbPage);
69458 if( rc==SQLITE_OK ){
69459 pPtrmap[offset] = eType;
69460 put4byte(&pPtrmap[offset+1], parent);
69461 }
@@ -69650,31 +69822,35 @@
69650 ** This routine is a high-runner.
69651 */
69652 iKey = *pIter;
69653 if( iKey>=0x80 ){
69654 u8 x;
69655 iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
69656 if( x>=0x80 ){
69657 iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
69658 if( x>=0x80 ){
69659 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69660 if( x>=0x80 ){
69661 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69662 if( x>=0x80 ){
69663 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69664 if( x>=0x80 ){
69665 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69666 if( x>=0x80 ){
69667 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69668 if( x>=0x80 ){
69669 iKey = (iKey<<8) | (*++pIter);
69670 }
69671 }
69672 }
69673 }
69674 }
69675 }
 
 
 
 
69676 }
69677 }
69678 pIter++;
69679
69680 pInfo->nKey = *(i64*)&iKey;
@@ -69747,14 +69923,57 @@
69747 ** data header and the local payload, but not any overflow page or
69748 ** the space used by the cell pointer.
69749 **
69750 ** cellSizePtrNoPayload() => table internal nodes
69751 ** cellSizePtrTableLeaf() => table leaf nodes
69752 ** cellSizePtr() => all index nodes & table leaf nodes
 
69753 */
69754 static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69755 u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69756 u8 *pEnd; /* End mark for a varint */
69757 u32 nSize; /* Size value to return */
69758
69759 #ifdef SQLITE_DEBUG
69760 /* The value returned by this function should always be the same as
@@ -69763,10 +69982,11 @@
69763 ** this function verifies that this invariant is not violated. */
69764 CellInfo debuginfo;
69765 pPage->xParseCell(pPage, pCell, &debuginfo);
69766 #endif
69767
 
69768 nSize = *pIter;
69769 if( nSize>=0x80 ){
69770 pEnd = &pIter[8];
69771 nSize &= 0x7f;
69772 do{
@@ -69999,14 +70219,14 @@
69999 testcase( pc==iCellFirst );
70000 testcase( pc==iCellLast );
70001 /* These conditions have already been verified in btreeInitPage()
70002 ** if PRAGMA cell_size_check=ON.
70003 */
70004 if( pc<iCellStart || pc>iCellLast ){
70005 return SQLITE_CORRUPT_PAGE(pPage);
70006 }
70007 assert( pc>=iCellStart && pc<=iCellLast );
70008 size = pPage->xCellSize(pPage, &src[pc]);
70009 cbrk -= size;
70010 if( cbrk<iCellStart || pc+size>usableSize ){
70011 return SQLITE_CORRUPT_PAGE(pPage);
70012 }
@@ -70117,11 +70337,11 @@
70117 ** all the space together, however. This routine will avoid using
70118 ** the first two bytes past the cell pointer area since presumably this
70119 ** allocation is being made in order to insert a new cell, so we will
70120 ** also end up needing a new cell pointer.
70121 */
70122 static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
70123 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
70124 u8 * const data = pPage->aData; /* Local cache of pPage->aData */
70125 int top; /* First byte of cell content area */
70126 int rc = SQLITE_OK; /* Integer return code */
70127 u8 *pTmp; /* Temp ptr into data[] */
@@ -70143,17 +70363,18 @@
70143 ** then the cell content offset of an empty page wants to be 65536.
70144 ** However, that integer is too large to be stored in a 2-byte unsigned
70145 ** integer, so a value of 0 is used in its place. */
70146 pTmp = &data[hdr+5];
70147 top = get2byte(pTmp);
70148 assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */
70149 if( gap>top ){
70150 if( top==0 && pPage->pBt->usableSize==65536 ){
70151 top = 65536;
70152 }else{
70153 return SQLITE_CORRUPT_PAGE(pPage);
70154 }
 
 
70155 }
70156
70157 /* If there is enough space between gap and top for one more cell pointer,
70158 ** and if the freelist is not empty, then search the
70159 ** freelist looking for a slot big enough to satisfy the request.
@@ -70232,11 +70453,11 @@
70232 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
70233 assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
70234 assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
70235 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
70236 assert( iSize>=4 ); /* Minimum cell size is 4 */
70237 assert( iStart<=pPage->pBt->usableSize-4 );
70238
70239 /* The list of freeblocks must be in ascending order. Find the
70240 ** spot on the list where iStart should be inserted.
70241 */
70242 hdr = pPage->hdrOffset;
@@ -70289,10 +70510,15 @@
70289 if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
70290 data[hdr+7] -= nFrag;
70291 }
70292 pTmp = &data[hdr+5];
70293 x = get2byte(pTmp);
 
 
 
 
 
70294 if( iStart<=x ){
70295 /* The new freeblock is at the beginning of the cell content area,
70296 ** so just extend the cell content area rather than create another
70297 ** freelist entry */
70298 if( iStart<x ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -70300,18 +70526,13 @@
70300 put2byte(&data[hdr+1], iFreeBlk);
70301 put2byte(&data[hdr+5], iEnd);
70302 }else{
70303 /* Insert the new freeblock into the freelist */
70304 put2byte(&data[iPtr], iStart);
70305 }
70306 if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
70307 /* Overwrite deleted information with zeros when the secure_delete
70308 ** option is enabled */
70309 memset(&data[iStart], 0, iSize);
70310 }
70311 put2byte(&data[iStart], iFreeBlk);
70312 put2byte(&data[iStart+2], iSize);
70313 pPage->nFree += iOrigSize;
70314 return SQLITE_OK;
70315 }
70316
70317 /*
@@ -70344,18 +70565,18 @@
70344 pPage->maxLocal = pBt->maxLeaf;
70345 pPage->minLocal = pBt->minLeaf;
70346 }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
70347 pPage->intKey = 0;
70348 pPage->intKeyLeaf = 0;
70349 pPage->xCellSize = cellSizePtr;
70350 pPage->xParseCell = btreeParseCellPtrIndex;
70351 pPage->maxLocal = pBt->maxLocal;
70352 pPage->minLocal = pBt->minLocal;
70353 }else{
70354 pPage->intKey = 0;
70355 pPage->intKeyLeaf = 0;
70356 pPage->xCellSize = cellSizePtr;
70357 pPage->xParseCell = btreeParseCellPtrIndex;
70358 return SQLITE_CORRUPT_PAGE(pPage);
70359 }
70360 }else{
70361 pPage->childPtrSize = 4;
@@ -72217,11 +72438,11 @@
72217 assert( sqlite3_mutex_held(pBt->mutex) );
72218 assert( pDbPage->pBt==pBt );
72219 if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
72220
72221 /* Move page iDbPage from its current location to page number iFreePage */
72222 TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n",
72223 iDbPage, iFreePage, iPtrPage, eType));
72224 rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
72225 if( rc!=SQLITE_OK ){
72226 return rc;
72227 }
@@ -74503,11 +74724,12 @@
74503 }
74504 }
74505
74506 pPage = pCur->pPage;
74507 idx = ++pCur->ix;
74508 if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){
 
74509 return SQLITE_CORRUPT_BKPT;
74510 }
74511
74512 if( idx>=pPage->nCell ){
74513 if( !pPage->leaf ){
@@ -74766,11 +74988,11 @@
74766 }
74767 *pPgno = iTrunk;
74768 memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
74769 *ppPage = pTrunk;
74770 pTrunk = 0;
74771 TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74772 }else if( k>(u32)(pBt->usableSize/4 - 2) ){
74773 /* Value of k is out of range. Database corruption */
74774 rc = SQLITE_CORRUPT_PGNO(iTrunk);
74775 goto end_allocate_page;
74776 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74832,11 +75054,11 @@
74832 }
74833 put4byte(&pPrevTrunk->aData[0], iNewTrunk);
74834 }
74835 }
74836 pTrunk = 0;
74837 TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74838 #endif
74839 }else if( k>0 ){
74840 /* Extract a leaf from the trunk */
74841 u32 closest;
74842 Pgno iPage;
@@ -74877,12 +75099,12 @@
74877 if( !searchList
74878 || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
74879 ){
74880 int noContent;
74881 *pPgno = iPage;
74882 TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
74883 ": %d more free pages\n",
74884 *pPgno, closest+1, k, pTrunk->pgno, n-1));
74885 rc = sqlite3PagerWrite(pTrunk->pDbPage);
74886 if( rc ) goto end_allocate_page;
74887 if( closest<k-1 ){
74888 memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74934,11 +75156,11 @@
74934 /* If *pPgno refers to a pointer-map page, allocate two new pages
74935 ** at the end of the file instead of one. The first allocated page
74936 ** becomes a new pointer-map page, the second is used by the caller.
74937 */
74938 MemPage *pPg = 0;
74939 TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
74940 assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
74941 rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
74942 if( rc==SQLITE_OK ){
74943 rc = sqlite3PagerWrite(pPg->pDbPage);
74944 releasePage(pPg);
@@ -74957,11 +75179,11 @@
74957 rc = sqlite3PagerWrite((*ppPage)->pDbPage);
74958 if( rc!=SQLITE_OK ){
74959 releasePage(*ppPage);
74960 *ppPage = 0;
74961 }
74962 TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
74963 }
74964
74965 assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
74966
74967 end_allocate_page:
@@ -75085,11 +75307,11 @@
75085 if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
75086 sqlite3PagerDontWrite(pPage->pDbPage);
75087 }
75088 rc = btreeSetHasContent(pBt, iPage);
75089 }
75090 TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
75091 goto freepage_out;
75092 }
75093 }
75094
75095 /* If control flows to this point, then it was not possible to add the
@@ -75106,11 +75328,11 @@
75106 goto freepage_out;
75107 }
75108 put4byte(pPage->aData, iTrunk);
75109 put4byte(&pPage->aData[4], 0);
75110 put4byte(&pPage1->aData[32], iPage);
75111 TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk));
75112
75113 freepage_out:
75114 if( pPage ){
75115 pPage->isInit = 0;
75116 }
@@ -75465,10 +75687,18 @@
75465 ** pTemp is not null. Regardless of pTemp, allocate a new entry
75466 ** in pPage->apOvfl[] and make it point to the cell content (either
75467 ** in pTemp or the original pCell) and also record its index.
75468 ** Allocating a new entry in pPage->aCell[] implies that
75469 ** pPage->nOverflow is incremented.
 
 
 
 
 
 
 
 
75470 */
75471 static int insertCell(
75472 MemPage *pPage, /* Page into which we are copying */
75473 int i, /* New cell becomes the i-th cell of the page */
75474 u8 *pCell, /* Content of the new cell */
@@ -75487,18 +75717,107 @@
75487 assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
75488 assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
75489 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
75490 assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
75491 assert( pPage->nFree>=0 );
 
75492 if( pPage->nOverflow || sz+2>pPage->nFree ){
75493 if( pTemp ){
75494 memcpy(pTemp, pCell, sz);
75495 pCell = pTemp;
75496 }
75497 if( iChild ){
75498 put4byte(pCell, iChild);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75499 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75500 j = pPage->nOverflow++;
75501 /* Comparison against ArraySize-1 since we hold back one extra slot
75502 ** as a contingency. In other words, never need more than 3 overflow
75503 ** slots but 4 are allocated, just to be safe. */
75504 assert( j < ArraySize(pPage->apOvfl)-1 );
@@ -75526,21 +75845,11 @@
75526 ** if it returns successfully */
75527 assert( idx >= 0 );
75528 assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
75529 assert( idx+sz <= (int)pPage->pBt->usableSize );
75530 pPage->nFree -= (u16)(2 + sz);
75531 if( iChild ){
75532 /* In a corrupt database where an entry in the cell index section of
75533 ** a btree page has a value of 3 or less, the pCell value might point
75534 ** as many as 4 bytes in front of the start of the aData buffer for
75535 ** the source page. Make sure this does not cause problems by not
75536 ** reading the first 4 bytes */
75537 memcpy(&data[idx+4], pCell+4, sz-4);
75538 put4byte(&data[idx], iChild);
75539 }else{
75540 memcpy(&data[idx], pCell, sz);
75541 }
75542 pIns = pPage->aCellIdx + i*2;
75543 memmove(pIns+2, pIns, 2*(pPage->nCell - i));
75544 put2byte(pIns, idx);
75545 pPage->nCell++;
75546 /* increment the cell count */
@@ -75721,11 +76030,11 @@
75721 int k; /* Current slot in pCArray->apEnd[] */
75722 u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
75723
75724 assert( i<iEnd );
75725 j = get2byte(&aData[hdr+5]);
75726 if( j>(u32)usableSize ){ j = 0; }
75727 memcpy(&pTmp[j], &aData[j], usableSize - j);
75728
75729 for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
75730 pSrcEnd = pCArray->apEnd[k];
75731
@@ -75865,46 +76174,54 @@
75865 ){
75866 u8 * const aData = pPg->aData;
75867 u8 * const pEnd = &aData[pPg->pBt->usableSize];
75868 u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
75869 int nRet = 0;
75870 int i;
75871 int iEnd = iFirst + nCell;
75872 u8 *pFree = 0; /* \__ Parameters for pending call to */
75873 int szFree = 0; /* / freeSpace() */
 
75874
75875 for(i=iFirst; i<iEnd; i++){
75876 u8 *pCell = pCArray->apCell[i];
75877 if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
75878 int sz;
 
 
75879 /* No need to use cachedCellSize() here. The sizes of all cells that
75880 ** are to be freed have already been computing while deciding which
75881 ** cells need freeing */
75882 sz = pCArray->szCell[i]; assert( sz>0 );
75883 if( pFree!=(pCell + sz) ){
75884 if( pFree ){
75885 assert( pFree>aData && (pFree - aData)<65536 );
75886 freeSpace(pPg, (u16)(pFree - aData), szFree);
75887 }
75888 pFree = pCell;
75889 szFree = sz;
75890 if( pFree+sz>pEnd ){
75891 return 0;
75892 }
75893 }else{
75894 /* The current cell is adjacent to and before the pFree cell.
75895 ** Combine the two regions into one to reduce the number of calls
75896 ** to freeSpace(). */
75897 pFree = pCell;
75898 szFree += sz;
 
 
 
 
 
 
75899 }
75900 nRet++;
75901 }
75902 }
75903 if( pFree ){
75904 assert( pFree>aData && (pFree - aData)<65536 );
75905 freeSpace(pPg, (u16)(pFree - aData), szFree);
75906 }
75907 return nRet;
75908 }
75909
75910 /*
@@ -75955,11 +76272,11 @@
75955 nCell -= nTail;
75956 }
75957
75958 pData = &aData[get2byteNotZero(&aData[hdr+5])];
75959 if( pData<pBegin ) goto editpage_fail;
75960 if( pData>pPg->aDataEnd ) goto editpage_fail;
75961
75962 /* Add cells to the start of the page */
75963 if( iNew<iOld ){
75964 int nAdd = MIN(nNew,iOld-iNew);
75965 assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -76692,11 +77009,11 @@
76692 ** (2) pPage is a virtual root page. A virtual root page is when
76693 ** the real root page is page 1 and we are the only child of
76694 ** that page.
76695 */
76696 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
76697 TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n",
76698 apOld[0]->pgno, apOld[0]->nCell,
76699 nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
76700 nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
76701 ));
76702
@@ -76776,12 +77093,12 @@
76776 apNew[i]->pgno = pgnoB;
76777 apNew[iB]->pgno = pgnoA;
76778 }
76779 }
76780
76781 TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
76782 "%d(%d nc=%d) %d(%d nc=%d)\n",
76783 apNew[0]->pgno, szNew[0], cntNew[0],
76784 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
76785 nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
76786 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
76787 nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77022,11 +77339,11 @@
77022 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
77023 }
77024 }
77025
77026 assert( pParent->isInit );
77027 TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
77028 nOld, nNew, b.nCell));
77029
77030 /* Free any old pages that were not reused as new pages.
77031 */
77032 for(i=nNew; i<nOld; i++){
@@ -77107,11 +77424,11 @@
77107 }
77108 assert( sqlite3PagerIswriteable(pChild->pDbPage) );
77109 assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
77110 assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
77111
77112 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
77113
77114 /* Copy the overflow cells from pRoot to pChild */
77115 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
77116 pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
77117 memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77605,11 +77922,11 @@
77605 rc = btreeComputeFreeSpace(pPage);
77606 }
77607 if( rc ) return rc;
77608 }
77609
77610 TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
77611 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
77612 loc==0 ? "overwrite" : "new entry"));
77613 assert( pPage->isInit || CORRUPT_DB );
77614 newCell = p->pBt->pTmpSpace;
77615 assert( newCell!=0 );
@@ -77632,10 +77949,11 @@
77632 if( rc ) goto end_insert;
77633 }
77634 assert( szNew==pPage->xCellSize(pPage, newCell) );
77635 assert( szNew <= MX_CELL_SIZE(p->pBt) );
77636 idx = pCur->ix;
 
77637 if( loc==0 ){
77638 CellInfo info;
77639 assert( idx>=0 );
77640 if( idx>=pPage->nCell ){
77641 return SQLITE_CORRUPT_BKPT;
@@ -77680,11 +77998,11 @@
77680 idx = ++pCur->ix;
77681 pCur->curFlags &= ~BTCF_ValidNKey;
77682 }else{
77683 assert( pPage->leaf );
77684 }
77685 rc = insertCell(pPage, idx, newCell, szNew, 0, 0);
77686 assert( pPage->nOverflow==0 || rc==SQLITE_OK );
77687 assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );
77688
77689 /* If no error has occurred and pPage has an overflow cell, call balance()
77690 ** to redistribute the cells within the tree. Since balance() may move
@@ -77704,11 +78022,10 @@
77704 ** the b-tree if possible. If the cursor is left pointing to the last
77705 ** entry in the table, and the next row inserted has an integer key
77706 ** larger than the largest existing key, it is possible to insert the
77707 ** row without seeking the cursor. This can be a big performance boost.
77708 */
77709 pCur->info.nSize = 0;
77710 if( pPage->nOverflow ){
77711 assert( rc==SQLITE_OK );
77712 pCur->curFlags &= ~(BTCF_ValidNKey);
77713 rc = balance(pCur);
77714
@@ -77904,10 +78221,13 @@
77904 return SQLITE_CORRUPT_BKPT;
77905 }
77906 pCell = findCell(pPage, iCellIdx);
77907 if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
77908 return SQLITE_CORRUPT_BKPT;
 
 
 
77909 }
77910
77911 /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
77912 ** be preserved following this delete operation. If the current delete
77913 ** will cause a b-tree rebalance, then this is done by saving the cursor
@@ -78653,11 +78973,12 @@
78653 va_start(ap, zFormat);
78654 if( pCheck->errMsg.nChar ){
78655 sqlite3_str_append(&pCheck->errMsg, "\n", 1);
78656 }
78657 if( pCheck->zPfx ){
78658 sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2);
 
78659 }
78660 sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
78661 va_end(ap);
78662 if( pCheck->errMsg.accError==SQLITE_NOMEM ){
78663 checkOom(pCheck);
@@ -78693,15 +79014,15 @@
78693 **
78694 ** Also check that the page number is in bounds.
78695 */
78696 static int checkRef(IntegrityCk *pCheck, Pgno iPage){
78697 if( iPage>pCheck->nPage || iPage==0 ){
78698 checkAppendMsg(pCheck, "invalid page number %d", iPage);
78699 return 1;
78700 }
78701 if( getPageReferenced(pCheck, iPage) ){
78702 checkAppendMsg(pCheck, "2nd reference to page %d", iPage);
78703 return 1;
78704 }
78705 setPageReferenced(pCheck, iPage);
78706 return 0;
78707 }
@@ -78723,17 +79044,17 @@
78723 Pgno iPtrmapParent;
78724
78725 rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
78726 if( rc!=SQLITE_OK ){
78727 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
78728 checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild);
78729 return;
78730 }
78731
78732 if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
78733 checkAppendMsg(pCheck,
78734 "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)",
78735 iChild, eType, iParent, ePtrmapType, iPtrmapParent);
78736 }
78737 }
78738 #endif
78739
@@ -78754,11 +79075,11 @@
78754 DbPage *pOvflPage;
78755 unsigned char *pOvflData;
78756 if( checkRef(pCheck, iPage) ) break;
78757 N--;
78758 if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
78759 checkAppendMsg(pCheck, "failed to get page %d", iPage);
78760 break;
78761 }
78762 pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
78763 if( isFreeList ){
78764 u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78767,11 +79088,11 @@
78767 checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
78768 }
78769 #endif
78770 if( n>pCheck->pBt->usableSize/4-2 ){
78771 checkAppendMsg(pCheck,
78772 "freelist leaf count too big on page %d", iPage);
78773 N--;
78774 }else{
78775 for(i=0; i<(int)n; i++){
78776 Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
78777 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78799,11 +79120,11 @@
78799 iPage = get4byte(pOvflData);
78800 sqlite3PagerUnref(pOvflPage);
78801 }
78802 if( N && nErrAtStart==pCheck->nErr ){
78803 checkAppendMsg(pCheck,
78804 "%s is %d but should be %d",
78805 isFreeList ? "size" : "overflow list length",
78806 expected-N, expected);
78807 }
78808 }
78809 #endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78914,12 +79235,12 @@
78914 if( pCheck->mxErr==0 ) goto end_of_check;
78915 pBt = pCheck->pBt;
78916 usableSize = pBt->usableSize;
78917 if( iPage==0 ) return 0;
78918 if( checkRef(pCheck, iPage) ) return 0;
78919 pCheck->zPfx = "Page %u: ";
78920 pCheck->v1 = iPage;
78921 if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
78922 checkAppendMsg(pCheck,
78923 "unable to get the page. error code=%d", rc);
78924 goto end_of_check;
78925 }
@@ -78941,11 +79262,11 @@
78941 }
78942 data = pPage->aData;
78943 hdr = pPage->hdrOffset;
78944
78945 /* Set up for cell analysis */
78946 pCheck->zPfx = "On tree page %u cell %d: ";
78947 contentOffset = get2byteNotZero(&data[hdr+5]);
78948 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
78949
78950 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
78951 ** number of cells on the page. */
@@ -78961,11 +79282,11 @@
78961 if( !pPage->leaf ){
78962 /* Analyze the right-child page of internal pages */
78963 pgno = get4byte(&data[hdr+8]);
78964 #ifndef SQLITE_OMIT_AUTOVACUUM
78965 if( pBt->autoVacuum ){
78966 pCheck->zPfx = "On page %u at right child: ";
78967 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
78968 }
78969 #endif
78970 depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
78971 keyCanBeEqual = 0;
@@ -78985,11 +79306,11 @@
78985 pCheck->v2 = i;
78986 assert( pCellIdx==&data[cellStart + i*2] );
78987 pc = get2byteAligned(pCellIdx);
78988 pCellIdx -= 2;
78989 if( pc<contentOffset || pc>usableSize-4 ){
78990 checkAppendMsg(pCheck, "Offset %d out of range %d..%d",
78991 pc, contentOffset, usableSize-4);
78992 doCoverageCheck = 0;
78993 continue;
78994 }
78995 pCell = &data[pc];
@@ -79117,11 +79438,11 @@
79117 ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
79118 ** number of fragmented free bytes within the cell content area.
79119 */
79120 if( heap[0]==0 && nFrag!=data[hdr+7] ){
79121 checkAppendMsg(pCheck,
79122 "Fragmentation of %d bytes reported as %d on page %u",
79123 nFrag, data[hdr+7], iPage);
79124 }
79125 }
79126
79127 end_of_check:
@@ -79214,11 +79535,11 @@
79214 if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
79215
79216 /* Check the integrity of the freelist
79217 */
79218 if( bCkFreelist ){
79219 sCheck.zPfx = "Main freelist: ";
79220 checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
79221 get4byte(&pBt->pPage1->aData[36]));
79222 sCheck.zPfx = 0;
79223 }
79224
@@ -79231,11 +79552,11 @@
79231 Pgno mxInHdr;
79232 for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
79233 mxInHdr = get4byte(&pBt->pPage1->aData[52]);
79234 if( mx!=mxInHdr ){
79235 checkAppendMsg(&sCheck,
79236 "max rootpage (%d) disagrees with header (%d)",
79237 mx, mxInHdr
79238 );
79239 }
79240 }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
79241 checkAppendMsg(&sCheck,
@@ -79262,23 +79583,23 @@
79262 */
79263 if( !bPartial ){
79264 for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
79265 #ifdef SQLITE_OMIT_AUTOVACUUM
79266 if( getPageReferenced(&sCheck, i)==0 ){
79267 checkAppendMsg(&sCheck, "Page %d is never used", i);
79268 }
79269 #else
79270 /* If the database supports auto-vacuum, make sure no tables contain
79271 ** references to pointer-map pages.
79272 */
79273 if( getPageReferenced(&sCheck, i)==0 &&
79274 (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79275 checkAppendMsg(&sCheck, "Page %d is never used", i);
79276 }
79277 if( getPageReferenced(&sCheck, i)!=0 &&
79278 (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79279 checkAppendMsg(&sCheck, "Pointer map page %d is referenced", i);
79280 }
79281 #endif
79282 }
79283 }
79284
@@ -80806,11 +81127,11 @@
80806 return SQLITE_NOMEM_BKPT;
80807 }
80808
80809 vdbeMemRenderNum(nByte, pMem->z, pMem);
80810 assert( pMem->z!=0 );
80811 assert( pMem->n==sqlite3Strlen30NN(pMem->z) );
80812 pMem->enc = SQLITE_UTF8;
80813 pMem->flags |= MEM_Str|MEM_Term;
80814 if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
80815 sqlite3VdbeChangeEncoding(pMem, enc);
80816 return SQLITE_OK;
@@ -81850,10 +82171,13 @@
81850 assert( ExprUseXList(p) );
81851 pList = p->x.pList;
81852 if( pList ) nVal = pList->nExpr;
81853 assert( !ExprHasProperty(p, EP_IntValue) );
81854 pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0);
 
 
 
81855 assert( pFunc );
81856 if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
81857 || (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
81858 ){
81859 return SQLITE_OK;
@@ -81886,20 +82210,15 @@
81886 rc = ctx.isError;
81887 sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
81888 }else{
81889 sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
81890 assert( rc==SQLITE_OK );
81891 assert( enc==pVal->enc
81892 || (pVal->flags & MEM_Str)==0
81893 || db->mallocFailed );
81894 #if 0 /* Not reachable except after a prior failure */
81895 rc = sqlite3VdbeChangeEncoding(pVal, enc);
81896 if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
81897 rc = SQLITE_TOOBIG;
81898 pCtx->pParse->nErr++;
81899 }
81900 #endif
81901 }
81902
81903 value_from_function_out:
81904 if( rc!=SQLITE_OK ){
81905 pVal = 0;
@@ -81959,10 +82278,17 @@
81959 assert( !ExprHasProperty(pExpr, EP_IntValue) );
81960 aff = sqlite3AffinityType(pExpr->u.zToken,0);
81961 rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
81962 testcase( rc!=SQLITE_OK );
81963 if( *ppVal ){
 
 
 
 
 
 
 
81964 sqlite3VdbeMemCast(*ppVal, aff, enc);
81965 sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
81966 }
81967 return rc;
81968 }
@@ -82805,14 +83131,14 @@
82805 ** If the bPush flag is true, then make this opcode the parent for
82806 ** subsequent Explains until sqlite3VdbeExplainPop() is called.
82807 */
82808 SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
82809 int addr = 0;
82810 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
82811 /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
82812 ** But omit them (for performance) during production builds */
82813 if( pParse->explain==2 )
82814 #endif
82815 {
82816 char *zMsg;
82817 Vdbe *v;
82818 va_list ap;
@@ -83484,22 +83810,24 @@
83484 int addrLoop, /* Address of loop counter */
83485 int addrVisit, /* Address of rows visited counter */
83486 LogEst nEst, /* Estimated number of output rows */
83487 const char *zName /* Name of table or index being scanned */
83488 ){
83489 sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83490 ScanStatus *aNew;
83491 aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83492 if( aNew ){
83493 ScanStatus *pNew = &aNew[p->nScan++];
83494 memset(pNew, 0, sizeof(ScanStatus));
83495 pNew->addrExplain = addrExplain;
83496 pNew->addrLoop = addrLoop;
83497 pNew->addrVisit = addrVisit;
83498 pNew->nEst = nEst;
83499 pNew->zName = sqlite3DbStrDup(p->db, zName);
83500 p->aScan = aNew;
 
 
83501 }
83502 }
83503
83504 /*
83505 ** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83512,24 +83840,26 @@
83512 Vdbe *p,
83513 int addrExplain,
83514 int addrStart,
83515 int addrEnd
83516 ){
83517 ScanStatus *pScan = 0;
83518 int ii;
83519 for(ii=p->nScan-1; ii>=0; ii--){
83520 pScan = &p->aScan[ii];
83521 if( pScan->addrExplain==addrExplain ) break;
83522 pScan = 0;
83523 }
83524 if( pScan ){
83525 if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83526 for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83527 if( pScan->aAddrRange[ii]==0 ){
83528 pScan->aAddrRange[ii] = addrStart;
83529 pScan->aAddrRange[ii+1] = addrEnd;
83530 break;
 
 
83531 }
83532 }
83533 }
83534 }
83535
@@ -83542,23 +83872,25 @@
83542 Vdbe *p,
83543 int addrExplain,
83544 int addrLoop,
83545 int addrVisit
83546 ){
83547 ScanStatus *pScan = 0;
83548 int ii;
83549 for(ii=p->nScan-1; ii>=0; ii--){
83550 pScan = &p->aScan[ii];
83551 if( pScan->addrExplain==addrExplain ) break;
83552 pScan = 0;
83553 }
83554 if( pScan ){
83555 pScan->addrLoop = addrLoop;
83556 pScan->addrVisit = addrVisit;
 
 
83557 }
83558 }
83559 #endif
83560
83561
83562 /*
83563 ** Change the value of the opcode, or P1, P2, P3, or P5 operands
83564 ** for a specific instruction.
@@ -85682,10 +86014,12 @@
85682 db->nDeferredCons = 0;
85683 db->nDeferredImmCons = 0;
85684 db->flags &= ~(u64)SQLITE_DeferFKs;
85685 sqlite3CommitInternalChanges(db);
85686 }
 
 
85687 }else{
85688 sqlite3RollbackAll(db, SQLITE_OK);
85689 p->nChange = 0;
85690 }
85691 db->nStatement = 0;
@@ -86000,13 +86334,13 @@
86000 vdbeFreeOpArray(db, p->aOp, p->nOp);
86001 if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
86002 #ifdef SQLITE_ENABLE_NORMALIZE
86003 sqlite3DbFree(db, p->zNormSql);
86004 {
86005 DblquoteStr *pThis, *pNext;
86006 for(pThis=p->pDblStr; pThis; pThis=pNext){
86007 pNext = pThis->pNextStr;
86008 sqlite3DbFree(db, pThis);
86009 }
86010 }
86011 #endif
86012 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -87629,10 +87963,24 @@
87629 return 0;
87630 }
87631 return 1;
87632 }
87633
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87634 #ifndef SQLITE_OMIT_VIRTUALTABLE
87635 /*
87636 ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
87637 ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
87638 ** in memory obtained from sqlite3DbMalloc).
@@ -88015,11 +88363,11 @@
88015 SQLITE_NULL, /* 0x1d (not possible) */
88016 SQLITE_INTEGER, /* 0x1e (not possible) */
88017 SQLITE_NULL, /* 0x1f (not possible) */
88018 SQLITE_FLOAT, /* 0x20 INTREAL */
88019 SQLITE_NULL, /* 0x21 (not possible) */
88020 SQLITE_TEXT, /* 0x22 INTREAL + TEXT */
88021 SQLITE_NULL, /* 0x23 (not possible) */
88022 SQLITE_FLOAT, /* 0x24 (not possible) */
88023 SQLITE_NULL, /* 0x25 (not possible) */
88024 SQLITE_FLOAT, /* 0x26 (not possible) */
88025 SQLITE_NULL, /* 0x27 (not possible) */
@@ -89882,19 +90230,28 @@
89882 int iScanStatusOp, /* Which metric to return */
89883 int flags,
89884 void *pOut /* OUT: Write the answer here */
89885 ){
89886 Vdbe *p = (Vdbe*)pStmt;
89887 ScanStatus *pScan;
 
 
89888 int idx;
 
 
 
 
 
 
 
89889
89890 if( iScan<0 ){
89891 int ii;
89892 if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
89893 i64 res = 0;
89894 for(ii=0; ii<p->nOp; ii++){
89895 res += p->aOp[ii].nCycle;
89896 }
89897 *(i64*)pOut = res;
89898 return 0;
89899 }
89900 return 1;
@@ -89916,19 +90273,19 @@
89916 if( idx>=p->nScan ) return 1;
89917
89918 switch( iScanStatusOp ){
89919 case SQLITE_SCANSTAT_NLOOP: {
89920 if( pScan->addrLoop>0 ){
89921 *(sqlite3_int64*)pOut = p->aOp[pScan->addrLoop].nExec;
89922 }else{
89923 *(sqlite3_int64*)pOut = -1;
89924 }
89925 break;
89926 }
89927 case SQLITE_SCANSTAT_NVISIT: {
89928 if( pScan->addrVisit>0 ){
89929 *(sqlite3_int64*)pOut = p->aOp[pScan->addrVisit].nExec;
89930 }else{
89931 *(sqlite3_int64*)pOut = -1;
89932 }
89933 break;
89934 }
@@ -89946,27 +90303,27 @@
89946 *(const char**)pOut = pScan->zName;
89947 break;
89948 }
89949 case SQLITE_SCANSTAT_EXPLAIN: {
89950 if( pScan->addrExplain ){
89951 *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
89952 }else{
89953 *(const char**)pOut = 0;
89954 }
89955 break;
89956 }
89957 case SQLITE_SCANSTAT_SELECTID: {
89958 if( pScan->addrExplain ){
89959 *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
89960 }else{
89961 *(int*)pOut = -1;
89962 }
89963 break;
89964 }
89965 case SQLITE_SCANSTAT_PARENTID: {
89966 if( pScan->addrExplain ){
89967 *(int*)pOut = p->aOp[ pScan->addrExplain ].p2;
89968 }else{
89969 *(int*)pOut = -1;
89970 }
89971 break;
89972 }
@@ -89980,22 +90337,22 @@
89980 int iIns = pScan->aAddrRange[ii];
89981 int iEnd = pScan->aAddrRange[ii+1];
89982 if( iIns==0 ) break;
89983 if( iIns>0 ){
89984 while( iIns<=iEnd ){
89985 res += p->aOp[iIns].nCycle;
89986 iIns++;
89987 }
89988 }else{
89989 int iOp;
89990 for(iOp=0; iOp<p->nOp; iOp++){
89991 Op *pOp = &p->aOp[iOp];
89992 if( pOp->p1!=iEnd ) continue;
89993 if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
89994 continue;
89995 }
89996 res += p->aOp[iOp].nCycle;
89997 }
89998 }
89999 }
90000 }
90001 *(i64*)pOut = res;
@@ -90914,11 +91271,14 @@
90914 if( p->flags & (MEM_Int|MEM_IntReal) ){
90915 h += p->u.i;
90916 }else if( p->flags & MEM_Real ){
90917 h += sqlite3VdbeIntValue(p);
90918 }else if( p->flags & (MEM_Str|MEM_Blob) ){
90919 /* no-op */
 
 
 
90920 }
90921 }
90922 return h;
90923 }
90924
@@ -90964,10 +91324,11 @@
90964 Mem *pIn2 = 0; /* 2nd input operand */
90965 Mem *pIn3 = 0; /* 3rd input operand */
90966 Mem *pOut = 0; /* Output operand */
90967 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
90968 u64 *pnCycle = 0;
 
90969 #endif
90970 /*** INSERT STACK UNION HERE ***/
90971
90972 assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
90973 if( DbMaskNonZero(p->lockMask) ){
@@ -91028,17 +91389,21 @@
91028 ** jumps to abort_due_to_error. */
91029 assert( rc==SQLITE_OK );
91030
91031 assert( pOp>=aOp && pOp<&aOp[p->nOp]);
91032 nVmStep++;
91033 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
 
91034 pOp->nExec++;
91035 pnCycle = &pOp->nCycle;
91036 # ifdef VDBE_PROFILE
91037 if( sqlite3NProfileCnt==0 )
91038 # endif
 
 
91039 *pnCycle -= sqlite3Hwtime();
 
91040 #endif
91041
91042 /* Only allow tracing if SQLITE_DEBUG is defined.
91043 */
91044 #ifdef SQLITE_DEBUG
@@ -92848,10 +93213,16 @@
92848 ** from the value in that register.
92849 **
92850 ** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant
92851 ** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04.
92852 ** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10.
 
 
 
 
 
 
92853 **
92854 ** Take the jump to address P2 if and only if the datatype of the
92855 ** value determined by P1 and P3 corresponds to one of the bits in the
92856 ** P5 bitmask.
92857 **
@@ -95196,10 +95567,11 @@
95196 #endif
95197 VdbeBranchTaken(0,3);
95198 break;
95199 }
95200 nStep--;
 
95201 rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
95202 if( rc ){
95203 if( rc==SQLITE_DONE ){
95204 rc = SQLITE_OK;
95205 goto seekscan_search_fail;
@@ -97848,10 +98220,11 @@
97848 sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
97849 goto abort_due_to_error;
97850 }
97851 sqlite3VdbeChangeEncoding(pMem, encoding);
97852 UPDATE_MAX_BLOBSIZE(pMem);
 
97853 break;
97854 }
97855
97856 #ifndef SQLITE_OMIT_WAL
97857 /* Opcode: Checkpoint P1 P2 P3 * *
@@ -98986,12 +99359,14 @@
98986
98987 #if defined(VDBE_PROFILE)
98988 *pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
98989 pnCycle = 0;
98990 #elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
98991 *pnCycle += sqlite3Hwtime();
98992 pnCycle = 0;
 
 
98993 #endif
98994
98995 /* The following code adds nothing to the actual functionality
98996 ** of the program. It is only here for testing and debugging.
98997 ** On the other hand, it does burn CPU cycles every time through
@@ -104013,11 +104388,12 @@
104013 if( pParse->pTriggerTab!=0 ){
104014 int op = pParse->eTriggerOp;
104015 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
104016 if( pParse->bReturning ){
104017 if( (pNC->ncFlags & NC_UBaseReg)!=0
104018 && (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
 
104019 ){
104020 pExpr->iTable = op!=TK_DELETE;
104021 pTab = pParse->pTriggerTab;
104022 }
104023 }else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
@@ -104798,12 +105174,12 @@
104798 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
104799 }
104800 assert( pNC->nRef>=nRef );
104801 if( nRef!=pNC->nRef ){
104802 ExprSetProperty(pExpr, EP_VarSelect);
104803 pNC->ncFlags |= NC_VarSelect;
104804 }
 
104805 }
104806 break;
104807 }
104808 case TK_VARIABLE: {
104809 testcase( pNC->ncFlags & NC_IsCheck );
@@ -105987,15 +106363,14 @@
105987 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
105988 p = p->pLeft;
105989 }else{
105990 Expr *pNext = p->pRight;
105991 /* The Expr.x union is never used at the same time as Expr.pRight */
105992 assert( ExprUseXList(p) );
105993 assert( p->x.pList==0 || p->pRight==0 );
105994 if( p->x.pList!=0 && !db->mallocFailed ){
105995 int i;
105996 for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){
105997 if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
105998 pNext = p->x.pList->a[i].pExpr;
105999 break;
106000 }
106001 }
@@ -108359,11 +108734,11 @@
108359
108360 /*
108361 ** pX is the RHS of an IN operator. If pX is a SELECT statement
108362 ** that can be simplified to a direct table access, then return
108363 ** a pointer to the SELECT statement. If pX is not a SELECT statement,
108364 ** or if the SELECT statement needs to be manifested into a transient
108365 ** table, then return NULL.
108366 */
108367 #ifndef SQLITE_OMIT_SUBQUERY
108368 static Select *isCandidateForInOpt(const Expr *pX){
108369 Select *p;
@@ -108645,11 +109020,10 @@
108645 Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
108646 Expr *pRhs = pEList->a[i].pExpr;
108647 CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
108648 int j;
108649
108650 assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );
108651 for(j=0; j<nExpr; j++){
108652 if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
108653 assert( pIdx->azColl[j] );
108654 if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
108655 continue;
@@ -109548,10 +109922,11 @@
109548 Column *pCol, /* The generated column */
109549 int regOut /* Put the result in this register */
109550 ){
109551 int iAddr;
109552 Vdbe *v = pParse->pVdbe;
 
109553 assert( v!=0 );
109554 assert( pParse->iSelfTab!=0 );
109555 if( pParse->iSelfTab>0 ){
109556 iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109557 }else{
@@ -109560,10 +109935,11 @@
109560 sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109561 if( pCol->affinity>=SQLITE_AFF_TEXT ){
109562 sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109563 }
109564 if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
 
109565 }
109566 #endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109567
109568 /*
109569 ** Generate code to extract the value of the iCol-th column of a table.
@@ -109576,10 +109952,11 @@
109576 int regOut /* Extract the value into this register */
109577 ){
109578 Column *pCol;
109579 assert( v!=0 );
109580 assert( pTab!=0 );
 
109581 if( iCol<0 || iCol==pTab->iPKey ){
109582 sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109583 VdbeComment((v, "%s.rowid", pTab->zName));
109584 }else{
109585 int op;
@@ -109928,11 +110305,23 @@
109928 switch( op ){
109929 case TK_AGG_COLUMN: {
109930 AggInfo *pAggInfo = pExpr->pAggInfo;
109931 struct AggInfo_col *pCol;
109932 assert( pAggInfo!=0 );
109933 assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
 
 
 
 
 
 
 
 
 
 
 
 
109934 pCol = &pAggInfo->aCol[pExpr->iAgg];
109935 if( !pAggInfo->directMode ){
109936 return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
109937 }else if( pAggInfo->useSortingIdx ){
109938 Table *pTab = pCol->pTab;
@@ -110103,15 +110492,12 @@
110103 return pExpr->iTable;
110104 }
110105 #ifndef SQLITE_OMIT_CAST
110106 case TK_CAST: {
110107 /* Expressions of the form: CAST(pLeft AS token) */
110108 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110109 if( inReg!=target ){
110110 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110111 inReg = target;
110112 }
110113 assert( !ExprHasProperty(pExpr, EP_IntValue) );
110114 sqlite3VdbeAddOp2(v, OP_Cast, target,
110115 sqlite3AffinityType(pExpr->u.zToken, 0));
110116 return inReg;
110117 }
@@ -110446,17 +110832,13 @@
110446 ** "SOFT-COLLATE" that is added to constraints that are pushed down
110447 ** from outer queries into sub-queries by the push-down optimization.
110448 ** Clear subtypes as subtypes may not cross a subquery boundary.
110449 */
110450 assert( pExpr->pLeft );
110451 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110452 if( inReg!=target ){
110453 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110454 inReg = target;
110455 }
110456 sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg);
110457 return inReg;
110458 }else{
110459 pExpr = pExpr->pLeft;
110460 goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110461 }
110462 }
@@ -110562,16 +110944,13 @@
110562 ** (1) Temporarily disable factoring of constant expressions
110563 ** (2) Make sure the computed value really is stored in register
110564 ** "target" and not someplace else.
110565 */
110566 pParse->okConstFactor = 0; /* note (1) above */
110567 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
 
110568 pParse->okConstFactor = okConstFactor;
110569 if( inReg!=target ){ /* note (2) above */
110570 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110571 inReg = target;
110572 }
110573 sqlite3VdbeJumpHere(v, addrINR);
110574 break;
110575 }
110576
110577 /*
@@ -110805,11 +111184,13 @@
110805 assert( pParse->pVdbe!=0 || pParse->db->mallocFailed );
110806 if( pParse->pVdbe==0 ) return;
110807 inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);
110808 if( inReg!=target ){
110809 u8 op;
110810 if( ALWAYS(pExpr) && ExprHasProperty(pExpr,EP_Subquery) ){
 
 
110811 op = OP_Copy;
110812 }else{
110813 op = OP_SCopy;
110814 }
110815 sqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target);
@@ -111990,23 +112371,26 @@
111990 ){
111991 AggInfo *pAggInfo = pExpr->pAggInfo;
111992 int iAgg = pExpr->iAgg;
111993 Parse *pParse = pWalker->pParse;
111994 sqlite3 *db = pParse->db;
 
111995 if( pExpr->op!=TK_AGG_FUNCTION ){
111996 assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
111997 if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
 
111998 pExpr = sqlite3ExprDup(db, pExpr, 0);
111999 if( pExpr ){
112000 pAggInfo->aCol[iAgg].pCExpr = pExpr;
112001 sqlite3ExprDeferredDelete(pParse, pExpr);
112002 }
112003 }
112004 }else{
112005 assert( pExpr->op==TK_AGG_FUNCTION );
112006 assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
112007 if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
 
112008 pExpr = sqlite3ExprDup(db, pExpr, 0);
112009 if( pExpr ){
112010 pAggInfo->aFunc[iAgg].pFExpr = pExpr;
112011 sqlite3ExprDeferredDelete(pParse, pExpr);
112012 }
@@ -112152,11 +112536,16 @@
112152 if( iDataCur<0 ) continue;
112153 if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112154 }
112155 if( pIEpr==0 ) break;
112156 if( NEVER(!ExprUseYTab(pExpr)) ) break;
112157 if( pExpr->pAggInfo!=0 ) break; /* Already resolved by outer context */
 
 
 
 
 
112158
112159 /* If we reach this point, it means that expression pExpr can be
112160 ** translated into a reference to an index column as described by
112161 ** pIEpr.
112162 */
@@ -112163,10 +112552,13 @@
112163 memset(&tmp, 0, sizeof(tmp));
112164 tmp.op = TK_AGG_COLUMN;
112165 tmp.iTable = pIEpr->iIdxCur;
112166 tmp.iColumn = pIEpr->iIdxCol;
112167 findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
 
 
 
112168 pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112169 pExpr->pAggInfo = pAggInfo;
112170 pExpr->iAgg = tmp.iAgg;
112171 return WRC_Prune;
112172 }
@@ -112339,10 +112731,41 @@
112339 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112340 pParse->nTempReg = 0;
112341 pParse->nRangeReg = 0;
112342 }
112343
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112344 /*
112345 ** Validate that no temporary register falls within the range of
112346 ** iFirst..iLast, inclusive. This routine is only call from within assert()
112347 ** statements.
112348 */
@@ -112357,10 +112780,18 @@
112357 }
112358 for(i=0; i<pParse->nTempReg; i++){
112359 if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112360 return 0;
112361 }
 
 
 
 
 
 
 
 
112362 }
112363 return 1;
112364 }
112365 #endif /* SQLITE_DEBUG */
112366
@@ -115641,15 +116072,19 @@
115641 int regTemp2 = iMem++; /* Second temporary use register */
115642 int regTabname = iMem++; /* Register containing table name */
115643 int regIdxname = iMem++; /* Register containing index name */
115644 int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
115645 int regPrev = iMem; /* MUST BE LAST (see below) */
 
 
 
115646 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
115647 Table *pStat1 = 0;
115648 #endif
115649
115650 pParse->nMem = MAX(pParse->nMem, iMem);
 
115651 v = sqlite3GetVdbe(pParse);
115652 if( v==0 || NEVER(pTab==0) ){
115653 return;
115654 }
115655 if( !IsOrdinaryTable(pTab) ){
@@ -115751,11 +116186,11 @@
115751
115752 /* Make sure there are enough memory cells allocated to accommodate
115753 ** the regPrev array and a trailing rowid (the rowid slot is required
115754 ** when building a record to insert into the sample column of
115755 ** the sqlite_stat4 table. */
115756 pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);
115757
115758 /* Open a read-only cursor on the index being analyzed. */
115759 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
115760 sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
115761 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115923,11 +116358,39 @@
115923 int regSampleRowid = regCol + nCol;
115924 int addrNext;
115925 int addrIsNull;
115926 u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
115927
115928 pParse->nMem = MAX(pParse->nMem, regCol+nCol);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115929
115930 addrNext = sqlite3VdbeCurrentAddr(v);
115931 callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
115932 addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
115933 VdbeCoverage(v);
@@ -116004,10 +116467,15 @@
116004 iTab = pParse->nTab;
116005 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
116006 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
116007 Table *pTab = (Table*)sqliteHashData(k);
116008 analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
 
 
 
 
 
116009 }
116010 loadAnalysis(pParse, iDb);
116011 }
116012
116013 /*
@@ -118931,11 +119399,11 @@
118931 Hash *pHash;
118932 sqlite3 *db = pParse->db;
118933 if( pParse->pNewTrigger ){
118934 sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
118935 }else{
118936 assert( pParse->bReturning==0 );
118937 }
118938 pParse->bReturning = 1;
118939 pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
118940 if( pRet==0 ){
118941 sqlite3ExprListDelete(db, pList);
@@ -118957,11 +119425,12 @@
118957 pRet->retTrig.step_list = &pRet->retTStep;
118958 pRet->retTStep.op = TK_RETURNING;
118959 pRet->retTStep.pTrig = &pRet->retTrig;
118960 pRet->retTStep.pExprList = pList;
118961 pHash = &(db->aDb[1].pSchema->trigHash);
118962 assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
 
118963 if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
118964 ==&pRet->retTrig ){
118965 sqlite3OomFault(db);
118966 }
118967 }
@@ -123830,17 +124299,19 @@
123830 **
123831 ** If pTab is not writable -> generate an error message and return 1.
123832 ** If pTab is writable but other errors have occurred -> return 1.
123833 ** If pTab is writable and no prior errors -> return 0;
123834 */
123835 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
123836 if( tabIsReadOnly(pParse, pTab) ){
123837 sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
123838 return 1;
123839 }
123840 #ifndef SQLITE_OMIT_VIEW
123841 if( !viewOk && IsView(pTab) ){
 
 
123842 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
123843 return 1;
123844 }
123845 #endif
123846 return 0;
@@ -124090,11 +124561,11 @@
124090 */
124091 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124092 goto delete_from_cleanup;
124093 }
124094
124095 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
124096 goto delete_from_cleanup;
124097 }
124098 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124099 assert( iDb<db->nDb );
124100 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -124199,11 +124670,11 @@
124199 }
124200 }else
124201 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124202 {
124203 u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124204 if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
124205 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124206 if( HasRowid(pTab) ){
124207 /* For a rowid table, initialize the RowSet to an empty set */
124208 pPk = 0;
124209 nPk = 1;
@@ -128787,49 +129258,51 @@
128787 **
128788 ** Memory for the buffer containing the column index affinity string
128789 ** is managed along with the rest of the Index structure. It will be
128790 ** released when sqlite3DeleteIndex() is called.
128791 */
128792 SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
128793 if( !pIdx->zColAff ){
128794 /* The first time a column affinity string for a particular index is
128795 ** required, it is allocated and populated here. It is then stored as
128796 ** a member of the Index structure for subsequent use.
128797 **
128798 ** The column affinity string will eventually be deleted by
128799 ** sqliteDeleteIndex() when the Index structure itself is cleaned
128800 ** up.
128801 */
128802 int n;
128803 Table *pTab = pIdx->pTable;
128804 pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
128805 if( !pIdx->zColAff ){
128806 sqlite3OomFault(db);
128807 return 0;
128808 }
128809 for(n=0; n<pIdx->nColumn; n++){
128810 i16 x = pIdx->aiColumn[n];
128811 char aff;
128812 if( x>=0 ){
128813 aff = pTab->aCol[x].affinity;
128814 }else if( x==XN_ROWID ){
128815 aff = SQLITE_AFF_INTEGER;
128816 }else{
128817 assert( x==XN_EXPR );
128818 assert( pIdx->bHasExpr );
128819 assert( pIdx->aColExpr!=0 );
128820 aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
128821 }
128822 if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
128823 if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
128824 pIdx->zColAff[n] = aff;
128825 }
128826 pIdx->zColAff[n] = 0;
128827 }
128828
 
128829 return pIdx->zColAff;
128830 }
 
128831
128832 /*
128833 ** Compute an affinity string for a table. Space is obtained
128834 ** from sqlite3DbMalloc(). The caller is responsible for freeing
128835 ** the space when done.
@@ -129511,11 +129984,11 @@
129511 goto insert_cleanup;
129512 }
129513
129514 /* Cannot insert into a read-only table.
129515 */
129516 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
129517 goto insert_cleanup;
129518 }
129519
129520 /* Allocate a VDBE
129521 */
@@ -129958,11 +130431,11 @@
129958 sqlite3VdbeJumpHere(v, addr1);
129959 sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
129960 }
129961
129962 /* Copy the new data already generated. */
129963 assert( pTab->nNVCol>0 );
129964 sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
129965
129966 #ifndef SQLITE_OMIT_GENERATED_COLUMNS
129967 /* Compute the new value for generated columns after all other
129968 ** columns have already been computed. This must be done after
@@ -133321,19 +133794,25 @@
133321 zEntry = zProc ? zProc : "sqlite3_extension_init";
133322
133323 /* tag-20210611-1. Some dlopen() implementations will segfault if given
133324 ** an oversize filename. Most filesystems have a pathname limit of 4K,
133325 ** so limit the extension filename length to about twice that.
133326 ** https://sqlite.org/forum/forumpost/08a0d6d9bf */
 
 
 
 
133327 if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133328
133329 handle = sqlite3OsDlOpen(pVfs, zFile);
133330 #if SQLITE_OS_UNIX || SQLITE_OS_WIN
133331 for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133332 char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133333 if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133334 handle = sqlite3OsDlOpen(pVfs, zAltFile);
 
 
133335 sqlite3_free(zAltFile);
133336 }
133337 #endif
133338 if( handle==0 ) goto extension_not_found;
133339 xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135824,11 +136303,11 @@
135824 if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
135825 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135826 zDb = db->aDb[iDb].zDbSName;
135827 sqlite3CodeVerifySchema(pParse, iDb);
135828 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
135829 if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
135830 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
135831 sqlite3VdbeLoadString(v, regResult, pTab->zName);
135832 assert( IsOrdinaryTable(pTab) );
135833 for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
135834 pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135865,11 +136344,11 @@
135865
135866 /* Generate code to read the child key values into registers
135867 ** regRow..regRow+n. If any of the child key values are NULL, this
135868 ** row cannot cause an FK violation. Jump directly to addrOk in
135869 ** this case. */
135870 if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol;
135871 for(j=0; j<pFK->nCol; j++){
135872 int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
135873 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
135874 sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
135875 }
@@ -135994,10 +136473,11 @@
135994
135995 if( OMIT_TEMPDB && i==1 ) continue;
135996 if( iDb>=0 && i!=iDb ) continue;
135997
135998 sqlite3CodeVerifySchema(pParse, i);
 
135999
136000 /* Do an integrity check of the B-Tree
136001 **
136002 ** Begin by finding the root pages numbers
136003 ** for all tables and indices in the database.
@@ -136029,11 +136509,11 @@
136029 }
136030 }
136031 aRoot[0] = cnt;
136032
136033 /* Make sure sufficient number of registers have been allocated */
136034 pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
136035 sqlite3ClearTempRegCache(pParse);
136036
136037 /* Do the b-tree integrity checks */
136038 sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136039 sqlite3VdbeChangeP5(v, (u8)i);
@@ -136179,19 +136659,33 @@
136179
136180 labelError = sqlite3VdbeMakeLabel(pParse);
136181 labelOk = sqlite3VdbeMakeLabel(pParse);
136182 if( pCol->notNull ){
136183 /* (1) NOT NULL columns may not contain a NULL */
 
136184 int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
136185 sqlite3VdbeChangeP5(v, 0x0f);
136186 VdbeCoverage(v);
 
 
 
 
 
 
 
 
 
 
 
 
 
136187 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136188 pCol->zCnName);
136189 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136190 if( doTypeCheck ){
136191 sqlite3VdbeGoto(v, labelError);
136192 sqlite3VdbeJumpHere(v, jmp2);
 
136193 }else{
136194 /* VDBE byte code will fall thru */
136195 }
136196 }
136197 if( bStrict && doTypeCheck ){
@@ -136295,11 +136789,11 @@
136295 ** any extra bytes at the end. Verify that this is the case. */
136296 if( HasRowid(pTab) ){
136297 int jmp7;
136298 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3);
136299 jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1);
136300 VdbeCoverage(v);
136301 sqlite3VdbeLoadString(v, 3,
136302 "rowid not at end-of-record for row ");
136303 sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
136304 sqlite3VdbeLoadString(v, 4, " of index ");
136305 sqlite3VdbeGoto(v, jmp5-1);
@@ -142129,11 +142623,13 @@
142129 assert( pExpr->pRight==0 );
142130 if( sqlite3ExprIsVector(pCopy) ){
142131 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142132 }else{
142133 sqlite3 *db = pSubst->pParse->db;
142134 if( pSubst->isOuterJoin ){
 
 
142135 memset(&ifNullRow, 0, sizeof(ifNullRow));
142136 ifNullRow.op = TK_IF_NULL_ROW;
142137 ifNullRow.pLeft = pCopy;
142138 ifNullRow.iTable = pSubst->iNewTable;
142139 ifNullRow.iColumn = -99;
@@ -142506,12 +143002,11 @@
142506 ** (17f) the subquery must not be the RHS of a LEFT JOIN.
142507 ** (17g) either the subquery is the first element of the outer
142508 ** query or there are no RIGHT or FULL JOINs in any arm
142509 ** of the subquery. (This is a duplicate of condition (27b).)
142510 ** (17h) The corresponding result set expressions in all arms of the
142511 ** compound must have the same affinity. (See restriction (9)
142512 ** on the push-down optimization.)
142513 **
142514 ** The parent and sub-query may contain WHERE clauses. Subject to
142515 ** rules (11), (13) and (14), they may also contain ORDER BY,
142516 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
142517 ** operator other than UNION ALL because all the other compound
@@ -143375,14 +143870,10 @@
143375 **
143376 ** (8) If the subquery is a compound that uses UNION, INTERSECT,
143377 ** or EXCEPT, then all of the result set columns for all arms of
143378 ** the compound must use the BINARY collating sequence.
143379 **
143380 ** (9) If the subquery is a compound, then all arms of the compound must
143381 ** have the same affinity. (This is the same as restriction (17h)
143382 ** for query flattening.)
143383 **
143384 **
143385 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
143386 ** terms are duplicated into the subquery.
143387 */
143388 static int pushDownWhereTerms(
@@ -143409,13 +143900,10 @@
143409 }
143410 #ifndef SQLITE_OMIT_WINDOWFUNC
143411 if( pSel->pWin ) return 0; /* restriction (6b) */
143412 #endif
143413 }
143414 if( compoundHasDifferentAffinities(pSubq) ){
143415 return 0; /* restriction (9) */
143416 }
143417 if( notUnionAll ){
143418 /* If any of the compound arms are connected using UNION, INTERSECT,
143419 ** or EXCEPT, then we must ensure that none of the columns use a
143420 ** non-BINARY collating sequence. */
143421 for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143502,10 +143990,80 @@
143502 }
143503 }
143504 return nChng;
143505 }
143506 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143507
143508 /*
143509 ** The pFunc is the only aggregate function in the query. Check to see
143510 ** if the query is a candidate for the min/max optimization.
143511 **
@@ -144688,15 +145246,17 @@
144688 if( pExpr->pAggInfo==0 ) return WRC_Continue;
144689 if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
144690 if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
144691 if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
144692 pAggInfo = pExpr->pAggInfo;
144693 assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
 
144694 pCol = &pAggInfo->aCol[pExpr->iAgg];
144695 pExpr->op = TK_AGG_COLUMN;
144696 pExpr->iTable = pCol->iTable;
144697 pExpr->iColumn = pCol->iColumn;
 
144698 return WRC_Prune;
144699 }
144700
144701 /*
144702 ** Convert every pAggInfo->aFunc[].pExpr such that any node within
@@ -145046,11 +145606,10 @@
145046 sqlite3DbFree(db, p->aCol);
145047 sqlite3DbFree(db, p->aFunc);
145048 sqlite3DbFreeNN(db, p);
145049 }
145050
145051 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145052 /*
145053 ** Attempt to transform a query of the form
145054 **
145055 ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145056 **
@@ -145074,10 +145633,11 @@
145074 Expr *pCount;
145075 sqlite3 *db;
145076 if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145077 if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145078 if( p->pWhere ) return 0;
 
145079 if( p->pGroupBy ) return 0;
145080 if( p->pOrderBy ) return 0;
145081 pExpr = p->pEList->a[0].pExpr;
145082 if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145083 assert( ExprUseUToken(pExpr) );
@@ -145093,11 +145653,12 @@
145093 do{
145094 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145095 if( pSub->pWhere ) return 0; /* No WHERE clause */
145096 if( pSub->pLimit ) return 0; /* No LIMIT clause */
145097 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145098 pSub = pSub->pPrior; /* Repeat over compound */
 
145099 }while( pSub );
145100
145101 /* If we reach this point then it is OK to perform the transformation */
145102
145103 db = pParse->db;
@@ -145136,11 +145697,10 @@
145136 sqlite3TreeViewSelect(0, p, 0);
145137 }
145138 #endif
145139 return 1;
145140 }
145141 #endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
145142
145143 /*
145144 ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145145 ** as pSrcItem but has the same alias as p0, then return true.
145146 ** Otherwise return false.
@@ -145525,18 +146085,16 @@
145525 #endif
145526 }else{
145527 TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
145528 }
145529
145530 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145531 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
145532 && countOfViewOptimization(pParse, p)
145533 ){
145534 if( db->mallocFailed ) goto select_end;
145535 pTabList = p->pSrc;
145536 }
145537 #endif
145538
145539 /* For each term in the FROM clause, do two things:
145540 ** (1) Authorized unreferenced tables
145541 ** (2) Generate code for all sub-queries
145542 */
@@ -145604,10 +146162,26 @@
145604 #endif
145605 assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
145606 }else{
145607 TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
145608 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145609
145610 zSavedAuthContext = pParse->zAuthContext;
145611 pParse->zAuthContext = pItem->zName;
145612
145613 /* Generate code to implement the subquery
@@ -146891,10 +147465,11 @@
146891 if( !noErr ){
146892 sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
146893 }else{
146894 assert( !db->init.busy );
146895 sqlite3CodeVerifySchema(pParse, iDb);
 
146896 }
146897 goto trigger_cleanup;
146898 }
146899 }
146900
@@ -148141,10 +148716,13 @@
148141 const int op = pChanges ? TK_UPDATE : TK_DELETE;
148142 u32 mask = 0;
148143 Trigger *p;
148144
148145 assert( isNew==1 || isNew==0 );
 
 
 
148146 for(p=pTrigger; p; p=p->pNext){
148147 if( p->op==op
148148 && (tr_tm&p->tr_tm)
148149 && checkColumnOverlap(p->pColumns,pChanges)
148150 ){
@@ -148575,11 +149153,11 @@
148575 #endif
148576
148577 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
148578 goto update_cleanup;
148579 }
148580 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
148581 goto update_cleanup;
148582 }
148583
148584 /* Allocate a cursors for the main database table and for all indices.
148585 ** The index cursors might not be used, but if they are used they
@@ -148894,16 +149472,26 @@
148894 bFinishSeek = 0;
148895 }else{
148896 /* Begin the database scan.
148897 **
148898 ** Do not consider a single-pass strategy for a multi-row update if
148899 ** there are any triggers or foreign keys to process, or rows may
148900 ** be deleted as a result of REPLACE conflict handling. Any of these
148901 ** things might disturb a cursor being used to scan through the table
148902 ** or index, causing a single-pass approach to malfunction. */
 
 
 
 
148903 flags = WHERE_ONEPASS_DESIRED;
148904 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
 
 
 
 
 
 
148905 flags |= WHERE_ONEPASS_MULTIROW;
148906 }
148907 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
148908 if( pWInfo==0 ) goto update_cleanup;
148909
@@ -150864,11 +151452,13 @@
150864 sCtx.pTab = pTab;
150865 sCtx.pVTable = pVTable;
150866 sCtx.pPrior = db->pVtabCtx;
150867 sCtx.bDeclared = 0;
150868 db->pVtabCtx = &sCtx;
 
150869 rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
 
150870 db->pVtabCtx = sCtx.pPrior;
150871 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
150872 assert( sCtx.pTab==pTab );
150873
150874 if( SQLITE_OK!=rc ){
@@ -151582,10 +152172,14 @@
151582 break;
151583 }
151584 case SQLITE_VTAB_DIRECTONLY: {
151585 p->pVTable->eVtabRisk = SQLITE_VTABRISK_High;
151586 break;
 
 
 
 
151587 }
151588 default: {
151589 rc = SQLITE_MISUSE_BKPT;
151590 break;
151591 }
@@ -152356,13 +152950,13 @@
152356 sqlite3_str_append(pStr, ")", 1);
152357 }
152358
152359 /*
152360 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152361 ** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
152362 ** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
152363 ** is added to the output to describe the table scan strategy in pLevel.
152364 **
152365 ** If an OP_Explain opcode is added to the VM, its address is returned.
152366 ** Otherwise, if no OP_Explain is coded, zero is returned.
152367 */
152368 SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152370,12 +152964,12 @@
152370 SrcList *pTabList, /* Table list this loop refers to */
152371 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152372 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152373 ){
152374 int ret = 0;
152375 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
152376 if( sqlite3ParseToplevel(pParse)->explain==2 )
152377 #endif
152378 {
152379 SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152380 Vdbe *v = pParse->pVdbe; /* VM being constructed */
152381 sqlite3 *db = pParse->db; /* Database handle */
@@ -152537,31 +153131,33 @@
152537 Vdbe *v, /* Vdbe to add scanstatus entry to */
152538 SrcList *pSrclist, /* FROM clause pLvl reads data from */
152539 WhereLevel *pLvl, /* Level to add scanstatus() entry for */
152540 int addrExplain /* Address of OP_Explain (or 0) */
152541 ){
152542 const char *zObj = 0;
152543 WhereLoop *pLoop = pLvl->pWLoop;
152544 int wsFlags = pLoop->wsFlags;
152545 int viaCoroutine = 0;
152546
152547 if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152548 zObj = pLoop->u.btree.pIndex->zName;
152549 }else{
152550 zObj = pSrclist->a[pLvl->iFrom].zName;
152551 viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152552 }
152553 sqlite3VdbeScanStatus(
152554 v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152555 );
152556
152557 if( viaCoroutine==0 ){
152558 if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152559 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152560 }
152561 if( wsFlags & WHERE_INDEXED ){
152562 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
 
 
152563 }
152564 }
152565 }
152566 #endif
152567
@@ -153254,31 +153850,29 @@
153254 ** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into
153255 ** an access of the index rather than the original table.
153256 */
153257 static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
153258 int rc = WRC_Continue;
 
153259 struct CCurHint *pHint = pWalker->u.pCCurHint;
153260 if( pExpr->op==TK_COLUMN ){
153261 if( pExpr->iTable!=pHint->iTabCur ){
153262 int reg = ++pWalker->pParse->nMem; /* Register for column value */
153263 sqlite3ExprCode(pWalker->pParse, pExpr, reg);
153264 pExpr->op = TK_REGISTER;
153265 pExpr->iTable = reg;
153266 }else if( pHint->pIdx!=0 ){
153267 pExpr->iTable = pHint->iIdxCur;
153268 pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn);
153269 assert( pExpr->iColumn>=0 );
153270 }
153271 }else if( pExpr->op==TK_AGG_FUNCTION ){
153272 /* An aggregate function in the WHERE clause of a query means this must
153273 ** be a correlated sub-query, and expression pExpr is an aggregate from
153274 ** the parent context. Do not walk the function arguments in this case.
153275 **
153276 ** todo: It should be possible to replace this node with a TK_REGISTER
153277 ** expression, as the result of the expression must be stored in a
153278 ** register at this point. The same holds for TK_AGG_COLUMN nodes. */
153279 rc = WRC_Prune;
 
 
 
 
153280 }
153281 return rc;
153282 }
153283
153284 /*
@@ -154170,11 +154764,11 @@
154170 ** of entries in the tree, so basing the number of steps to try
154171 ** on the estimated number of rows in the btree seems like a good
154172 ** guess. */
154173 addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154174 (pIdx->aiRowLogEst[0]+9)/10);
154175 if( pRangeStart ){
154176 sqlite3VdbeChangeP5(v, 1);
154177 sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154178 addrSeekScan = 0;
154179 }
154180 VdbeCoverage(v);
@@ -154211,20 +154805,11 @@
154211 */
154212 nConstraint = nEq;
154213 assert( pLevel->p2==0 );
154214 if( pRangeEnd ){
154215 Expr *pRight = pRangeEnd->pExpr->pRight;
154216 if( addrSeekScan ){
154217 /* For a seek-scan that has a range on the lowest term of the index,
154218 ** we have to make the top of the loop be code that sets the end
154219 ** condition of the range. Otherwise, the OP_SeekScan might jump
154220 ** over that initialization, leaving the range-end value set to the
154221 ** range-start value, resulting in a wrong answer.
154222 ** See ticket 5981a8c041a3c2f3 (2021-11-02).
154223 */
154224 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154225 }
154226 codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154227 whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154228 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154229 && sqlite3ExprCanBeNull(pRight)
154230 ){
@@ -154254,11 +154839,11 @@
154254 }
154255 if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154256 if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154257
154258 /* Top of the loop body */
154259 if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154260
154261 /* Check if the index cursor is past the end of the range. */
154262 if( nConstraint ){
154263 if( regBignull ){
154264 /* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156896,13 +157481,16 @@
156896 pColRef->y.pTab = pTab;
156897 pItem->colUsed |= sqlite3ExprColUsed(pColRef);
156898 pRhs = sqlite3PExpr(pParse, TK_UPLUS,
156899 sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
156900 pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
156901 if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
 
 
156902 joinType = EP_OuterON;
156903 }else{
 
156904 joinType = EP_InnerON;
156905 }
156906 sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
156907 whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
156908 }
@@ -157741,11 +158329,11 @@
157741 Parse *pParse,
157742 Index *pIdx, /* Automatic index to explain */
157743 int bPartial, /* True if pIdx is a partial index */
157744 int *pAddrExplain /* OUT: Address of OP_Explain */
157745 ){
157746 if( pParse->explain!=2 ){
157747 Table *pTab = pIdx->pTable;
157748 const char *zSep = "";
157749 char *zText = 0;
157750 int ii = 0;
157751 sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157802,11 +158390,12 @@
157802 CollSeq *pColl; /* Collating sequence to on a column */
157803 WhereLoop *pLoop; /* The Loop object */
157804 char *zNotUsed; /* Extra space on the end of pIdx */
157805 Bitmask idxCols; /* Bitmap of columns used for indexing */
157806 Bitmask extraCols; /* Bitmap of additional columns */
157807 u8 sentWarning = 0; /* True if a warnning has been issued */
 
157808 Expr *pPartial = 0; /* Partial Index Expression */
157809 int iContinue = 0; /* Jump here to skip excluded rows */
157810 SrcItem *pTabItem; /* FROM clause term being indexed */
157811 int addrCounter = 0; /* Address where integer counter is initialized */
157812 int regBase; /* Array of registers where record is assembled */
@@ -157872,11 +158461,15 @@
157872 ** original table never needs to be accessed. Automatic indices must
157873 ** be a covering index because the index will not be updated if the
157874 ** original table changes and the index and table cannot both be used
157875 ** if they go out of sync.
157876 */
157877 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
 
 
 
 
157878 mxBitCol = MIN(BMS-1,pTable->nCol);
157879 testcase( pTable->nCol==BMS-1 );
157880 testcase( pTable->nCol==BMS-2 );
157881 for(i=0; i<mxBitCol; i++){
157882 if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157908,10 +158501,20 @@
157908 pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
157909 pColl = sqlite3ExprCompareCollSeq(pParse, pX);
157910 assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
157911 pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
157912 n++;
 
 
 
 
 
 
 
 
 
 
157913 }
157914 }
157915 }
157916 assert( (u32)n==pLoop->u.btree.nEq );
157917
@@ -157940,11 +158543,12 @@
157940 assert( pLevel->iIdxCur>=0 );
157941 pLevel->iIdxCur = pParse->nTab++;
157942 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
157943 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
157944 VdbeComment((v, "for %s", pTable->zName));
157945 if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
 
157946 pLevel->regFilter = ++pParse->nMem;
157947 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
157948 }
157949
157950 /* Fill the automatic index with content */
@@ -158033,10 +158637,14 @@
158033 const WhereTerm *pWCEnd; /* Last WHERE clause term */
158034 Parse *pParse = pWInfo->pParse; /* Parsing context */
158035 Vdbe *v = pParse->pVdbe; /* VDBE under construction */
158036 WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
158037 int iCur; /* Cursor for table getting the filter */
 
 
 
 
158038
158039 assert( pLoop!=0 );
158040 assert( v!=0 );
158041 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158042
@@ -158089,13 +158697,12 @@
158089 Index *pIdx = pLoop->u.btree.pIndex;
158090 int n = pLoop->u.btree.nEq;
158091 int r1 = sqlite3GetTempRange(pParse, n);
158092 int jj;
158093 for(jj=0; jj<n; jj++){
158094 int iCol = pIdx->aiColumn[jj];
158095 assert( pIdx->pTable==pItem->pTab );
158096 sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
158097 }
158098 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158099 sqlite3ReleaseTempRange(pParse, r1, n);
158100 }
158101 sqlite3VdbeResolveLabel(v, addrCont);
@@ -158122,10 +158729,11 @@
158122 break;
158123 }
158124 }
158125 }while( iLevel < pWInfo->nLevel );
158126 sqlite3VdbeJumpHere(v, addrOnce);
 
158127 }
158128
158129
158130 #ifndef SQLITE_OMIT_VIRTUALTABLE
158131 /*
@@ -158377,10 +158985,13 @@
158377 sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc));
158378 }else{
158379 sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg);
158380 }
158381 }
 
 
 
158382 sqlite3_free(pVtab->zErrMsg);
158383 pVtab->zErrMsg = 0;
158384 return rc;
158385 }
158386 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
@@ -158420,10 +159031,11 @@
158420 UNUSED_PARAMETER( pParse );
158421 #endif
158422 assert( pRec!=0 );
158423 assert( pIdx->nSample>0 );
158424 assert( pRec->nField>0 );
 
158425
158426 /* Do a binary search to find the first sample greater than or equal
158427 ** to pRec. If pRec contains a single field, the set of samples to search
158428 ** is simply the aSample[] array. If the samples in aSample[] contain more
158429 ** than one fields, all fields following the first are ignored.
@@ -158465,11 +159077,16 @@
158465 ** appears that it should be 1 field in size. However, that would make it
158466 ** smaller than sample 1, so the binary search would not work. As a result,
158467 ** it is extended to two fields. The duplicates that this creates do not
158468 ** cause any problems.
158469 */
158470 nField = MIN(pRec->nField, pIdx->nSample);
 
 
 
 
 
158471 iCol = 0;
158472 iSample = pIdx->nSample * nField;
158473 do{
158474 int iSamp; /* Index in aSample[] of test sample */
158475 int n; /* Number of fields in test sample */
@@ -158901,11 +159518,11 @@
158901 #else
158902 UNUSED_PARAMETER(pParse);
158903 UNUSED_PARAMETER(pBuilder);
158904 assert( pLower || pUpper );
158905 #endif
158906 assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );
158907 nNew = whereRangeAdjust(pLower, nOut);
158908 nNew = whereRangeAdjust(pUpper, nNew);
158909
158910 /* TUNING: If there is both an upper and lower limit and neither limit
158911 ** has an application-defined likelihood(), assume the range is
@@ -161002,24 +161619,20 @@
161002 HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
161003 assert( pHidden->eDistinct>=0 && pHidden->eDistinct<=3 );
161004 return pHidden->eDistinct;
161005 }
161006
161007 #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
161008 && !defined(SQLITE_OMIT_VIRTUALTABLE)
161009 /*
161010 ** Cause the prepared statement that is associated with a call to
161011 ** xBestIndex to potentially use all schemas. If the statement being
161012 ** prepared is read-only, then just start read transactions on all
161013 ** schemas. But if this is a write operation, start writes on all
161014 ** schemas.
161015 **
161016 ** This is used by the (built-in) sqlite_dbpage virtual table.
161017 */
161018 SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info *pIdxInfo){
161019 HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
161020 Parse *pParse = pHidden->pParse;
161021 int nDb = pParse->db->nDb;
161022 int i;
161023 for(i=0; i<nDb; i++){
161024 sqlite3CodeVerifySchema(pParse, i);
161025 }
@@ -161027,11 +161640,10 @@
161027 for(i=0; i<nDb; i++){
161028 sqlite3BeginWriteOperation(pParse, 0, i);
161029 }
161030 }
161031 }
161032 #endif
161033
161034 /*
161035 ** Add all WhereLoop objects for a table of the join identified by
161036 ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
161037 **
@@ -162193,10 +162805,14 @@
162193 pWInfo->nOBSat = pFrom->isOrdered;
162194 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162195 if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162196 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162197 }
 
 
 
 
162198 }else{
162199 pWInfo->revMask = pFrom->revLoop;
162200 if( pWInfo->nOBSat<=0 ){
162201 pWInfo->nOBSat = 0;
162202 if( nLoop>0 ){
@@ -163122,11 +163738,11 @@
163122 for(; b; b=b>>1, n++){}
163123 sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163124 assert( n<=pTab->nCol );
163125 }
163126 #ifdef SQLITE_ENABLE_CURSOR_HINTS
163127 if( pLoop->u.btree.pIndex!=0 ){
163128 sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163129 }else
163130 #endif
163131 {
163132 sqlite3VdbeChangeP5(v, bFordelete);
@@ -163580,11 +164196,12 @@
163580 }
163581 }
163582 k = pLevel->addrBody + 1;
163583 #ifdef SQLITE_DEBUG
163584 if( db->flags & SQLITE_VdbeAddopTrace ){
163585 printf("TRANSLATE opcodes in range %d..%d\n", k, last-1);
 
163586 }
163587 /* Proof that the "+1" on the k value above is safe */
163588 pOp = sqlite3VdbeGetOp(v, k - 1);
163589 assert( pOp->opcode!=OP_Column || pOp->p1!=pLevel->iTabCur );
163590 assert( pOp->opcode!=OP_Rowid || pOp->p1!=pLevel->iTabCur );
@@ -167283,22 +167900,22 @@
167283 #define sqlite3ParserCTX_PDECL ,Parse *pParse
167284 #define sqlite3ParserCTX_PARAM ,pParse
167285 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167286 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167287 #define YYFALLBACK 1
167288 #define YYNSTATE 576
167289 #define YYNRULE 405
167290 #define YYNRULE_WITH_ACTION 342
167291 #define YYNTOKEN 185
167292 #define YY_MAX_SHIFT 575
167293 #define YY_MIN_SHIFTREDUCE 835
167294 #define YY_MAX_SHIFTREDUCE 1239
167295 #define YY_ERROR_ACTION 1240
167296 #define YY_ACCEPT_ACTION 1241
167297 #define YY_NO_ACTION 1242
167298 #define YY_MIN_REDUCE 1243
167299 #define YY_MAX_REDUCE 1647
167300 /************* End control #defines *******************************************/
167301 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167302
167303 /* Define the yytestcase() macro to be a no-op if is not already defined
167304 ** otherwise.
@@ -167361,222 +167978,222 @@
167361 ** yy_reduce_ofst[] For each state, the offset into yy_action for
167362 ** shifting non-terminals after a reduce.
167363 ** yy_default[] Default action for each state.
167364 **
167365 *********** Begin parsing tables **********************************************/
167366 #define YY_ACTTAB_COUNT (2098)
167367 static const YYACTIONTYPE yy_action[] = {
167368 /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167369 /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409,
167370 /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71,
167371 /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972,
167372 /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053,
167373 /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409,
167374 /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229,
167375 /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327,
167376 /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053,
167377 /* 90 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 118, 115,
167378 /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167379 /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167380 /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565,
167381 /* 130 */ 409, 1567, 537, 259, 226, 444, 101, 145, 449, 316,
167382 /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
167383 /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050,
167384 /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142,
167385 /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444,
167386 /* 180 */ 127, 1192, 1193, 1194, 148, 441, 440, 568, 119, 116,
167387 /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
167388 /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
167389 /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
167390 /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193,
167391 /* 230 */ 1194, 149, 1224, 409, 1224, 124, 124, 124, 124, 122,
167392 /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167393 /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80,
167394 /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124,
167395 /* 270 */ 124, 124, 1279, 522, 222, 1192, 568, 409, 224, 514,
167396 /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
167397 /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133,
167398 /* 300 */ 133, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, 1040,
167399 /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
167400 /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546,
167401 /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501,
167402 /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340,
167403 /* 350 */ 460, 328, 360, 394, 1237, 1192, 1193, 1194, 563, 568,
167404 /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
167405 /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154,
167406 /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194,
167407 /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222,
167408 /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050,
167409 /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550,
167410 /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109,
167411 /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570,
167412 /* 440 */ 569, 430, 1552, 1017, 325, 551, 1192, 270, 287, 368,
167413 /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
167414 /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120,
167415 /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27,
167416 /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901,
167417 /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516,
167418 /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51,
167419 /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040,
167420 /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135,
167421 /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120,
167422 /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561,
167423 /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217,
167424 /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167425 /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167426 /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267,
167427 /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571,
167428 /* 600 */ 1192, 571, 409, 292, 499, 957, 876, 191, 480, 316,
167429 /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
167430 /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167431 /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167432 /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192,
167433 /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194,
167434 /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217,
167435 /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167436 /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121,
167437 /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192,
167438 /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232,
167439 /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580,
167440 /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121,
167441 /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167442 /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167443 /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192,
167444 /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568,
167445 /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217,
167446 /* 780 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167447 /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
167448 /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
167449 /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297,
167450 /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200,
167451 /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121,
167452 /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167453 /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167454 /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278,
167455 /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568,
167456 /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217,
167457 /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167458 /* 900 */ 453, 1482, 13, 13, 1536, 122, 122, 122, 122, 121,
167459 /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
167460 /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212,
167461 /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1327, 9, 1196,
167462 /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
167463 /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167464 /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167465 /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245,
167466 /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643,
167467 /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240,
167468 /* 1000 */ 1325, 104, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123,
167469 /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
167470 /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284,
167471 /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311,
167472 /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538,
167473 /* 1050 */ 568, 972, 207, 568, 1027, 240, 383, 1116, 519, 122,
167474 /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167475 /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568,
167476 /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326,
167477 /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497,
167478 /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019,
167479 /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217,
167480 /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167481 /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217,
167482 /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167483 /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217,
167484 /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167485 /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121,
167486 /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568,
167487 /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121,
167488 /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642,
167489 /* 1210 */ 539, 1642, 15, 15, 892, 122, 122, 122, 122, 121,
167490 /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
167491 /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268,
167492 /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457,
167493 /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407,
167494 /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123,
167495 /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419,
167496 /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849,
167497 /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557,
167498 /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431,
167499 /* 1310 */ 568, 1158, 322, 17, 487, 1115, 58, 58, 122, 122,
167500 /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
167501 /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560,
167502 /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
167503 /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095,
167504 /* 1360 */ 568, 293, 568, 1095, 531, 568, 872, 8, 60, 60,
167505 /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
167506 /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
167507 /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
167508 /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534,
167509 /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027,
167510 /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66,
167511 /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177,
167512 /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471,
167513 /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407,
167514 /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52,
167515 /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447,
167516 /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391,
167517 /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466,
167518 /* 1500 */ 4, 568, 152, 30, 38, 568, 1132, 234, 396, 323,
167519 /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
167520 /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
167521 /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483,
167522 /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557,
167523 /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161,
167524 /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009,
167525 /* 1570 */ 473, 261, 261, 891, 890, 235, 535, 568, 1027, 568,
167526 /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
167527 /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017,
167528 /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569,
167529 /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568,
167530 /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355,
167531 /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451,
167532 /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180,
167533 /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392,
167534 /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258,
167535 /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261,
167536 /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74,
167537 /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974,
167538 /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346,
167539 /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253,
167540 /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141,
167541 /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219,
167542 /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110,
167543 /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365,
167544 /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109,
167545 /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570,
167546 /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017,
167547 /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4,
167548 /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461,
167549 /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27,
167550 /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36,
167551 /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246,
167552 /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350,
167553 /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4,
167554 /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520,
167555 /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281,
167556 /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438,
167557 /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10,
167558 /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314,
167559 /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386,
167560 /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519,
167561 /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147,
167562 /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212,
167563 /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088,
167564 /* 1960 */ 326, 180, 169, 1212, 182, 334, 238, 915, 241, 1104,
167565 /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
167566 /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247,
167567 /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489,
167568 /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19,
167569 /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159,
167570 /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174,
167571 /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260,
167572 /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25,
167573 /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055,
167574 /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022,
167575 /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925,
167576 /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
167577 /* 2090 */ 1242, 1242, 1242, 1242, 269, 1602, 1242, 1601,
167578 };
167579 static const YYCODETYPE yy_lookahead[] = {
167580 /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
167581 /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
167582 /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167784,11 +168401,11 @@
167784 /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
167785 /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
167786 /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
167787 /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
167788 /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167789 /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319,
167790 /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167791 /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167792 /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167793 /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167794 /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167803,13 +168420,13 @@
167803 /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167804 /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167805 /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167806 /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167807 /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167808 /* 2280 */ 319, 319, 319,
167809 };
167810 #define YY_SHIFT_COUNT (575)
167811 #define YY_SHIFT_MIN (0)
167812 #define YY_SHIFT_MAX (2074)
167813 static const unsigned short int yy_shift_ofst[] = {
167814 /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
167815 /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167825,16 +168442,16 @@
167825 /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167826 /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167827 /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
167828 /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
167829 /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
167830 /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468,
167831 /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
167832 /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167833 /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
167834 /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
167835 /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307,
167836 /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
167837 /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167838 /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167839 /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
167840 /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167848,12 +168465,12 @@
167848 /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
167849 /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
167850 /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
167851 /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
167852 /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
167853 /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098,
167854 /* 400 */ 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 207,
167855 /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
167856 /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
167857 /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
167858 /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
167859 /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167866,11 +168483,11 @@
167866 /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
167867 /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
167868 /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
167869 /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
167870 /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
167871 /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074,
167872 };
167873 #define YY_REDUCE_COUNT (408)
167874 #define YY_REDUCE_MIN (-271)
167875 #define YY_REDUCE_MAX (1740)
167876 static const short yy_reduce_ofst[] = {
@@ -167915,68 +168532,68 @@
167915 /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
167916 /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
167917 /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
167918 };
167919 static const YYACTIONTYPE yy_default[] = {
167920 /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475,
167921 /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240,
167922 /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240,
167923 /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240,
167924 /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240,
167925 /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403,
167926 /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469,
167927 /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240,
167928 /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167929 /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167930 /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167931 /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167932 /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167933 /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441,
167934 /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240,
167935 /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432,
167936 /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240,
167937 /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240,
167938 /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167939 /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371,
167940 /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269,
167941 /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240,
167942 /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167943 /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240,
167944 /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167945 /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167946 /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240,
167947 /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347,
167948 /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639,
167949 /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407,
167950 /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371,
167951 /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639,
167952 /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324,
167953 /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416,
167954 /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258,
167955 /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305,
167956 /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581,
167957 /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389,
167958 /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595,
167959 /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273,
167960 /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240,
167961 /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361,
167962 /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167963 /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240,
167964 /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240,
167965 /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362,
167966 /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240,
167967 /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167968 /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240,
167969 /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167970 /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240,
167971 /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167972 /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386,
167973 /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167974 /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240,
167975 /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167976 /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422,
167977 /* 570 */ 1426, 1262, 1240, 1252, 1240, 1240,
167978 };
167979 /********** End of lemon-generated parsing tables *****************************/
167980
167981 /* The next table maps tokens (terminal symbols) into fallback tokens.
167982 ** If a construct like the following:
@@ -168769,237 +169386,235 @@
168769 /* 173 */ "idlist_opt ::=",
168770 /* 174 */ "idlist_opt ::= LP idlist RP",
168771 /* 175 */ "idlist ::= idlist COMMA nm",
168772 /* 176 */ "idlist ::= nm",
168773 /* 177 */ "expr ::= LP expr RP",
168774 /* 178 */ "expr ::= ID|INDEXED",
168775 /* 179 */ "expr ::= JOIN_KW",
168776 /* 180 */ "expr ::= nm DOT nm",
168777 /* 181 */ "expr ::= nm DOT nm DOT nm",
168778 /* 182 */ "term ::= NULL|FLOAT|BLOB",
168779 /* 183 */ "term ::= STRING",
168780 /* 184 */ "term ::= INTEGER",
168781 /* 185 */ "expr ::= VARIABLE",
168782 /* 186 */ "expr ::= expr COLLATE ID|STRING",
168783 /* 187 */ "expr ::= CAST LP expr AS typetoken RP",
168784 /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
168785 /* 189 */ "expr ::= ID|INDEXED LP STAR RP",
168786 /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
168787 /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
168788 /* 192 */ "term ::= CTIME_KW",
168789 /* 193 */ "expr ::= LP nexprlist COMMA expr RP",
168790 /* 194 */ "expr ::= expr AND expr",
168791 /* 195 */ "expr ::= expr OR expr",
168792 /* 196 */ "expr ::= expr LT|GT|GE|LE expr",
168793 /* 197 */ "expr ::= expr EQ|NE expr",
168794 /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
168795 /* 199 */ "expr ::= expr PLUS|MINUS expr",
168796 /* 200 */ "expr ::= expr STAR|SLASH|REM expr",
168797 /* 201 */ "expr ::= expr CONCAT expr",
168798 /* 202 */ "likeop ::= NOT LIKE_KW|MATCH",
168799 /* 203 */ "expr ::= expr likeop expr",
168800 /* 204 */ "expr ::= expr likeop expr ESCAPE expr",
168801 /* 205 */ "expr ::= expr ISNULL|NOTNULL",
168802 /* 206 */ "expr ::= expr NOT NULL",
168803 /* 207 */ "expr ::= expr IS expr",
168804 /* 208 */ "expr ::= expr IS NOT expr",
168805 /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr",
168806 /* 210 */ "expr ::= expr IS DISTINCT FROM expr",
168807 /* 211 */ "expr ::= NOT expr",
168808 /* 212 */ "expr ::= BITNOT expr",
168809 /* 213 */ "expr ::= PLUS|MINUS expr",
168810 /* 214 */ "expr ::= expr PTR expr",
168811 /* 215 */ "between_op ::= BETWEEN",
168812 /* 216 */ "between_op ::= NOT BETWEEN",
168813 /* 217 */ "expr ::= expr between_op expr AND expr",
168814 /* 218 */ "in_op ::= IN",
168815 /* 219 */ "in_op ::= NOT IN",
168816 /* 220 */ "expr ::= expr in_op LP exprlist RP",
168817 /* 221 */ "expr ::= LP select RP",
168818 /* 222 */ "expr ::= expr in_op LP select RP",
168819 /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist",
168820 /* 224 */ "expr ::= EXISTS LP select RP",
168821 /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END",
168822 /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
168823 /* 227 */ "case_exprlist ::= WHEN expr THEN expr",
168824 /* 228 */ "case_else ::= ELSE expr",
168825 /* 229 */ "case_else ::=",
168826 /* 230 */ "case_operand ::= expr",
168827 /* 231 */ "case_operand ::=",
168828 /* 232 */ "exprlist ::=",
168829 /* 233 */ "nexprlist ::= nexprlist COMMA expr",
168830 /* 234 */ "nexprlist ::= expr",
168831 /* 235 */ "paren_exprlist ::=",
168832 /* 236 */ "paren_exprlist ::= LP exprlist RP",
168833 /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
168834 /* 238 */ "uniqueflag ::= UNIQUE",
168835 /* 239 */ "uniqueflag ::=",
168836 /* 240 */ "eidlist_opt ::=",
168837 /* 241 */ "eidlist_opt ::= LP eidlist RP",
168838 /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder",
168839 /* 243 */ "eidlist ::= nm collate sortorder",
168840 /* 244 */ "collate ::=",
168841 /* 245 */ "collate ::= COLLATE ID|STRING",
168842 /* 246 */ "cmd ::= DROP INDEX ifexists fullname",
168843 /* 247 */ "cmd ::= VACUUM vinto",
168844 /* 248 */ "cmd ::= VACUUM nm vinto",
168845 /* 249 */ "vinto ::= INTO expr",
168846 /* 250 */ "vinto ::=",
168847 /* 251 */ "cmd ::= PRAGMA nm dbnm",
168848 /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
168849 /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
168850 /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
168851 /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
168852 /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT",
168853 /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT",
168854 /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
168855 /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
168856 /* 260 */ "trigger_time ::= BEFORE|AFTER",
168857 /* 261 */ "trigger_time ::= INSTEAD OF",
168858 /* 262 */ "trigger_time ::=",
168859 /* 263 */ "trigger_event ::= DELETE|INSERT",
168860 /* 264 */ "trigger_event ::= UPDATE",
168861 /* 265 */ "trigger_event ::= UPDATE OF idlist",
168862 /* 266 */ "when_clause ::=",
168863 /* 267 */ "when_clause ::= WHEN expr",
168864 /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
168865 /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI",
168866 /* 270 */ "trnm ::= nm DOT nm",
168867 /* 271 */ "tridxby ::= INDEXED BY nm",
168868 /* 272 */ "tridxby ::= NOT INDEXED",
168869 /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
168870 /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
168871 /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
168872 /* 276 */ "trigger_cmd ::= scanpt select scanpt",
168873 /* 277 */ "expr ::= RAISE LP IGNORE RP",
168874 /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
168875 /* 279 */ "raisetype ::= ROLLBACK",
168876 /* 280 */ "raisetype ::= ABORT",
168877 /* 281 */ "raisetype ::= FAIL",
168878 /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
168879 /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
168880 /* 284 */ "cmd ::= DETACH database_kw_opt expr",
168881 /* 285 */ "key_opt ::=",
168882 /* 286 */ "key_opt ::= KEY expr",
168883 /* 287 */ "cmd ::= REINDEX",
168884 /* 288 */ "cmd ::= REINDEX nm dbnm",
168885 /* 289 */ "cmd ::= ANALYZE",
168886 /* 290 */ "cmd ::= ANALYZE nm dbnm",
168887 /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
168888 /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
168889 /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
168890 /* 294 */ "add_column_fullname ::= fullname",
168891 /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
168892 /* 296 */ "cmd ::= create_vtab",
168893 /* 297 */ "cmd ::= create_vtab LP vtabarglist RP",
168894 /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
168895 /* 299 */ "vtabarg ::=",
168896 /* 300 */ "vtabargtoken ::= ANY",
168897 /* 301 */ "vtabargtoken ::= lp anylist RP",
168898 /* 302 */ "lp ::= LP",
168899 /* 303 */ "with ::= WITH wqlist",
168900 /* 304 */ "with ::= WITH RECURSIVE wqlist",
168901 /* 305 */ "wqas ::= AS",
168902 /* 306 */ "wqas ::= AS MATERIALIZED",
168903 /* 307 */ "wqas ::= AS NOT MATERIALIZED",
168904 /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
168905 /* 309 */ "wqlist ::= wqitem",
168906 /* 310 */ "wqlist ::= wqlist COMMA wqitem",
168907 /* 311 */ "windowdefn_list ::= windowdefn",
168908 /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
168909 /* 313 */ "windowdefn ::= nm AS LP window RP",
168910 /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
168911 /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
168912 /* 316 */ "window ::= ORDER BY sortlist frame_opt",
168913 /* 317 */ "window ::= nm ORDER BY sortlist frame_opt",
168914 /* 318 */ "window ::= frame_opt",
168915 /* 319 */ "window ::= nm frame_opt",
168916 /* 320 */ "frame_opt ::=",
168917 /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
168918 /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
168919 /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
168920 /* 324 */ "frame_bound_s ::= frame_bound",
168921 /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
168922 /* 326 */ "frame_bound_e ::= frame_bound",
168923 /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
168924 /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
168925 /* 329 */ "frame_bound ::= CURRENT ROW",
168926 /* 330 */ "frame_exclude_opt ::=",
168927 /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
168928 /* 332 */ "frame_exclude ::= NO OTHERS",
168929 /* 333 */ "frame_exclude ::= CURRENT ROW",
168930 /* 334 */ "frame_exclude ::= GROUP|TIES",
168931 /* 335 */ "window_clause ::= WINDOW windowdefn_list",
168932 /* 336 */ "filter_over ::= filter_clause over_clause",
168933 /* 337 */ "filter_over ::= over_clause",
168934 /* 338 */ "filter_over ::= filter_clause",
168935 /* 339 */ "over_clause ::= OVER LP window RP",
168936 /* 340 */ "over_clause ::= OVER nm",
168937 /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP",
168938 /* 342 */ "input ::= cmdlist",
168939 /* 343 */ "cmdlist ::= cmdlist ecmd",
168940 /* 344 */ "cmdlist ::= ecmd",
168941 /* 345 */ "ecmd ::= SEMI",
168942 /* 346 */ "ecmd ::= cmdx SEMI",
168943 /* 347 */ "ecmd ::= explain cmdx SEMI",
168944 /* 348 */ "trans_opt ::=",
168945 /* 349 */ "trans_opt ::= TRANSACTION",
168946 /* 350 */ "trans_opt ::= TRANSACTION nm",
168947 /* 351 */ "savepoint_opt ::= SAVEPOINT",
168948 /* 352 */ "savepoint_opt ::=",
168949 /* 353 */ "cmd ::= create_table create_table_args",
168950 /* 354 */ "table_option_set ::= table_option",
168951 /* 355 */ "columnlist ::= columnlist COMMA columnname carglist",
168952 /* 356 */ "columnlist ::= columnname carglist",
168953 /* 357 */ "nm ::= ID|INDEXED",
168954 /* 358 */ "nm ::= STRING",
168955 /* 359 */ "nm ::= JOIN_KW",
168956 /* 360 */ "typetoken ::= typename",
168957 /* 361 */ "typename ::= ID|STRING",
168958 /* 362 */ "signed ::= plus_num",
168959 /* 363 */ "signed ::= minus_num",
168960 /* 364 */ "carglist ::= carglist ccons",
168961 /* 365 */ "carglist ::=",
168962 /* 366 */ "ccons ::= NULL onconf",
168963 /* 367 */ "ccons ::= GENERATED ALWAYS AS generated",
168964 /* 368 */ "ccons ::= AS generated",
168965 /* 369 */ "conslist_opt ::= COMMA conslist",
168966 /* 370 */ "conslist ::= conslist tconscomma tcons",
168967 /* 371 */ "conslist ::= tcons",
168968 /* 372 */ "tconscomma ::=",
168969 /* 373 */ "defer_subclause_opt ::= defer_subclause",
168970 /* 374 */ "resolvetype ::= raisetype",
168971 /* 375 */ "selectnowith ::= oneselect",
168972 /* 376 */ "oneselect ::= values",
168973 /* 377 */ "sclp ::= selcollist COMMA",
168974 /* 378 */ "as ::= ID|STRING",
168975 /* 379 */ "indexed_opt ::= indexed_by",
168976 /* 380 */ "returning ::=",
168977 /* 381 */ "expr ::= term",
168978 /* 382 */ "likeop ::= LIKE_KW|MATCH",
168979 /* 383 */ "exprlist ::= nexprlist",
168980 /* 384 */ "nmnum ::= plus_num",
168981 /* 385 */ "nmnum ::= nm",
168982 /* 386 */ "nmnum ::= ON",
168983 /* 387 */ "nmnum ::= DELETE",
168984 /* 388 */ "nmnum ::= DEFAULT",
168985 /* 389 */ "plus_num ::= INTEGER|FLOAT",
168986 /* 390 */ "foreach_clause ::=",
168987 /* 391 */ "foreach_clause ::= FOR EACH ROW",
168988 /* 392 */ "trnm ::= nm",
168989 /* 393 */ "tridxby ::=",
168990 /* 394 */ "database_kw_opt ::= DATABASE",
168991 /* 395 */ "database_kw_opt ::=",
168992 /* 396 */ "kwcolumn_opt ::=",
168993 /* 397 */ "kwcolumn_opt ::= COLUMNKW",
168994 /* 398 */ "vtabarglist ::= vtabarg",
168995 /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
168996 /* 400 */ "vtabarg ::= vtabarg vtabargtoken",
168997 /* 401 */ "anylist ::=",
168998 /* 402 */ "anylist ::= anylist LP anylist RP",
168999 /* 403 */ "anylist ::= anylist ANY",
169000 /* 404 */ "with ::=",
169001 };
169002 #endif /* NDEBUG */
169003
169004
169005 #if YYSTACKDEPTH<=0
@@ -169680,237 +170295,235 @@
169680 270, /* (173) idlist_opt ::= */
169681 270, /* (174) idlist_opt ::= LP idlist RP */
169682 263, /* (175) idlist ::= idlist COMMA nm */
169683 263, /* (176) idlist ::= nm */
169684 217, /* (177) expr ::= LP expr RP */
169685 217, /* (178) expr ::= ID|INDEXED */
169686 217, /* (179) expr ::= JOIN_KW */
169687 217, /* (180) expr ::= nm DOT nm */
169688 217, /* (181) expr ::= nm DOT nm DOT nm */
169689 216, /* (182) term ::= NULL|FLOAT|BLOB */
169690 216, /* (183) term ::= STRING */
169691 216, /* (184) term ::= INTEGER */
169692 217, /* (185) expr ::= VARIABLE */
169693 217, /* (186) expr ::= expr COLLATE ID|STRING */
169694 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
169695 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
169696 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
169697 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
169698 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
169699 216, /* (192) term ::= CTIME_KW */
169700 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
169701 217, /* (194) expr ::= expr AND expr */
169702 217, /* (195) expr ::= expr OR expr */
169703 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
169704 217, /* (197) expr ::= expr EQ|NE expr */
169705 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
169706 217, /* (199) expr ::= expr PLUS|MINUS expr */
169707 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
169708 217, /* (201) expr ::= expr CONCAT expr */
169709 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
169710 217, /* (203) expr ::= expr likeop expr */
169711 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
169712 217, /* (205) expr ::= expr ISNULL|NOTNULL */
169713 217, /* (206) expr ::= expr NOT NULL */
169714 217, /* (207) expr ::= expr IS expr */
169715 217, /* (208) expr ::= expr IS NOT expr */
169716 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
169717 217, /* (210) expr ::= expr IS DISTINCT FROM expr */
169718 217, /* (211) expr ::= NOT expr */
169719 217, /* (212) expr ::= BITNOT expr */
169720 217, /* (213) expr ::= PLUS|MINUS expr */
169721 217, /* (214) expr ::= expr PTR expr */
169722 275, /* (215) between_op ::= BETWEEN */
169723 275, /* (216) between_op ::= NOT BETWEEN */
169724 217, /* (217) expr ::= expr between_op expr AND expr */
169725 276, /* (218) in_op ::= IN */
169726 276, /* (219) in_op ::= NOT IN */
169727 217, /* (220) expr ::= expr in_op LP exprlist RP */
169728 217, /* (221) expr ::= LP select RP */
169729 217, /* (222) expr ::= expr in_op LP select RP */
169730 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
169731 217, /* (224) expr ::= EXISTS LP select RP */
169732 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
169733 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
169734 279, /* (227) case_exprlist ::= WHEN expr THEN expr */
169735 280, /* (228) case_else ::= ELSE expr */
169736 280, /* (229) case_else ::= */
169737 278, /* (230) case_operand ::= expr */
169738 278, /* (231) case_operand ::= */
169739 261, /* (232) exprlist ::= */
169740 253, /* (233) nexprlist ::= nexprlist COMMA expr */
169741 253, /* (234) nexprlist ::= expr */
169742 277, /* (235) paren_exprlist ::= */
169743 277, /* (236) paren_exprlist ::= LP exprlist RP */
169744 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
169745 281, /* (238) uniqueflag ::= UNIQUE */
169746 281, /* (239) uniqueflag ::= */
169747 221, /* (240) eidlist_opt ::= */
169748 221, /* (241) eidlist_opt ::= LP eidlist RP */
169749 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
169750 232, /* (243) eidlist ::= nm collate sortorder */
169751 282, /* (244) collate ::= */
169752 282, /* (245) collate ::= COLLATE ID|STRING */
169753 190, /* (246) cmd ::= DROP INDEX ifexists fullname */
169754 190, /* (247) cmd ::= VACUUM vinto */
169755 190, /* (248) cmd ::= VACUUM nm vinto */
169756 283, /* (249) vinto ::= INTO expr */
169757 283, /* (250) vinto ::= */
169758 190, /* (251) cmd ::= PRAGMA nm dbnm */
169759 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
169760 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
169761 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
169762 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
169763 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
169764 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
169765 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
169766 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
169767 287, /* (260) trigger_time ::= BEFORE|AFTER */
169768 287, /* (261) trigger_time ::= INSTEAD OF */
169769 287, /* (262) trigger_time ::= */
169770 288, /* (263) trigger_event ::= DELETE|INSERT */
169771 288, /* (264) trigger_event ::= UPDATE */
169772 288, /* (265) trigger_event ::= UPDATE OF idlist */
169773 290, /* (266) when_clause ::= */
169774 290, /* (267) when_clause ::= WHEN expr */
169775 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
169776 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
169777 292, /* (270) trnm ::= nm DOT nm */
169778 293, /* (271) tridxby ::= INDEXED BY nm */
169779 293, /* (272) tridxby ::= NOT INDEXED */
169780 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169781 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
169782 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
169783 291, /* (276) trigger_cmd ::= scanpt select scanpt */
169784 217, /* (277) expr ::= RAISE LP IGNORE RP */
169785 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
169786 236, /* (279) raisetype ::= ROLLBACK */
169787 236, /* (280) raisetype ::= ABORT */
169788 236, /* (281) raisetype ::= FAIL */
169789 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
169790 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
169791 190, /* (284) cmd ::= DETACH database_kw_opt expr */
169792 295, /* (285) key_opt ::= */
169793 295, /* (286) key_opt ::= KEY expr */
169794 190, /* (287) cmd ::= REINDEX */
169795 190, /* (288) cmd ::= REINDEX nm dbnm */
169796 190, /* (289) cmd ::= ANALYZE */
169797 190, /* (290) cmd ::= ANALYZE nm dbnm */
169798 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
169799 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
169800 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
169801 296, /* (294) add_column_fullname ::= fullname */
169802 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
169803 190, /* (296) cmd ::= create_vtab */
169804 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */
169805 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
169806 300, /* (299) vtabarg ::= */
169807 301, /* (300) vtabargtoken ::= ANY */
169808 301, /* (301) vtabargtoken ::= lp anylist RP */
169809 302, /* (302) lp ::= LP */
169810 266, /* (303) with ::= WITH wqlist */
169811 266, /* (304) with ::= WITH RECURSIVE wqlist */
169812 305, /* (305) wqas ::= AS */
169813 305, /* (306) wqas ::= AS MATERIALIZED */
169814 305, /* (307) wqas ::= AS NOT MATERIALIZED */
169815 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
169816 241, /* (309) wqlist ::= wqitem */
169817 241, /* (310) wqlist ::= wqlist COMMA wqitem */
169818 306, /* (311) windowdefn_list ::= windowdefn */
169819 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
169820 307, /* (313) windowdefn ::= nm AS LP window RP */
169821 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
169822 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
169823 308, /* (316) window ::= ORDER BY sortlist frame_opt */
169824 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */
169825 308, /* (318) window ::= frame_opt */
169826 308, /* (319) window ::= nm frame_opt */
169827 309, /* (320) frame_opt ::= */
169828 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
169829 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
169830 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
169831 315, /* (324) frame_bound_s ::= frame_bound */
169832 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
169833 316, /* (326) frame_bound_e ::= frame_bound */
169834 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
169835 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
169836 314, /* (329) frame_bound ::= CURRENT ROW */
169837 317, /* (330) frame_exclude_opt ::= */
169838 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
169839 318, /* (332) frame_exclude ::= NO OTHERS */
169840 318, /* (333) frame_exclude ::= CURRENT ROW */
169841 318, /* (334) frame_exclude ::= GROUP|TIES */
169842 251, /* (335) window_clause ::= WINDOW windowdefn_list */
169843 273, /* (336) filter_over ::= filter_clause over_clause */
169844 273, /* (337) filter_over ::= over_clause */
169845 273, /* (338) filter_over ::= filter_clause */
169846 312, /* (339) over_clause ::= OVER LP window RP */
169847 312, /* (340) over_clause ::= OVER nm */
169848 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
169849 185, /* (342) input ::= cmdlist */
169850 186, /* (343) cmdlist ::= cmdlist ecmd */
169851 186, /* (344) cmdlist ::= ecmd */
169852 187, /* (345) ecmd ::= SEMI */
169853 187, /* (346) ecmd ::= cmdx SEMI */
169854 187, /* (347) ecmd ::= explain cmdx SEMI */
169855 192, /* (348) trans_opt ::= */
169856 192, /* (349) trans_opt ::= TRANSACTION */
169857 192, /* (350) trans_opt ::= TRANSACTION nm */
169858 194, /* (351) savepoint_opt ::= SAVEPOINT */
169859 194, /* (352) savepoint_opt ::= */
169860 190, /* (353) cmd ::= create_table create_table_args */
169861 203, /* (354) table_option_set ::= table_option */
169862 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */
169863 201, /* (356) columnlist ::= columnname carglist */
169864 193, /* (357) nm ::= ID|INDEXED */
169865 193, /* (358) nm ::= STRING */
169866 193, /* (359) nm ::= JOIN_KW */
169867 208, /* (360) typetoken ::= typename */
169868 209, /* (361) typename ::= ID|STRING */
169869 210, /* (362) signed ::= plus_num */
169870 210, /* (363) signed ::= minus_num */
169871 207, /* (364) carglist ::= carglist ccons */
169872 207, /* (365) carglist ::= */
169873 215, /* (366) ccons ::= NULL onconf */
169874 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */
169875 215, /* (368) ccons ::= AS generated */
169876 202, /* (369) conslist_opt ::= COMMA conslist */
169877 228, /* (370) conslist ::= conslist tconscomma tcons */
169878 228, /* (371) conslist ::= tcons */
169879 229, /* (372) tconscomma ::= */
169880 233, /* (373) defer_subclause_opt ::= defer_subclause */
169881 235, /* (374) resolvetype ::= raisetype */
169882 239, /* (375) selectnowith ::= oneselect */
169883 240, /* (376) oneselect ::= values */
169884 254, /* (377) sclp ::= selcollist COMMA */
169885 255, /* (378) as ::= ID|STRING */
169886 264, /* (379) indexed_opt ::= indexed_by */
169887 272, /* (380) returning ::= */
169888 217, /* (381) expr ::= term */
169889 274, /* (382) likeop ::= LIKE_KW|MATCH */
169890 261, /* (383) exprlist ::= nexprlist */
169891 284, /* (384) nmnum ::= plus_num */
169892 284, /* (385) nmnum ::= nm */
169893 284, /* (386) nmnum ::= ON */
169894 284, /* (387) nmnum ::= DELETE */
169895 284, /* (388) nmnum ::= DEFAULT */
169896 211, /* (389) plus_num ::= INTEGER|FLOAT */
169897 289, /* (390) foreach_clause ::= */
169898 289, /* (391) foreach_clause ::= FOR EACH ROW */
169899 292, /* (392) trnm ::= nm */
169900 293, /* (393) tridxby ::= */
169901 294, /* (394) database_kw_opt ::= DATABASE */
169902 294, /* (395) database_kw_opt ::= */
169903 297, /* (396) kwcolumn_opt ::= */
169904 297, /* (397) kwcolumn_opt ::= COLUMNKW */
169905 299, /* (398) vtabarglist ::= vtabarg */
169906 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
169907 300, /* (400) vtabarg ::= vtabarg vtabargtoken */
169908 303, /* (401) anylist ::= */
169909 303, /* (402) anylist ::= anylist LP anylist RP */
169910 303, /* (403) anylist ::= anylist ANY */
169911 266, /* (404) with ::= */
169912 };
169913
169914 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
169915 ** of symbols on the right-hand side of that rule. */
169916 static const signed char yyRuleInfoNRhs[] = {
@@ -170090,237 +170703,235 @@
170090 0, /* (173) idlist_opt ::= */
170091 -3, /* (174) idlist_opt ::= LP idlist RP */
170092 -3, /* (175) idlist ::= idlist COMMA nm */
170093 -1, /* (176) idlist ::= nm */
170094 -3, /* (177) expr ::= LP expr RP */
170095 -1, /* (178) expr ::= ID|INDEXED */
170096 -1, /* (179) expr ::= JOIN_KW */
170097 -3, /* (180) expr ::= nm DOT nm */
170098 -5, /* (181) expr ::= nm DOT nm DOT nm */
170099 -1, /* (182) term ::= NULL|FLOAT|BLOB */
170100 -1, /* (183) term ::= STRING */
170101 -1, /* (184) term ::= INTEGER */
170102 -1, /* (185) expr ::= VARIABLE */
170103 -3, /* (186) expr ::= expr COLLATE ID|STRING */
170104 -6, /* (187) expr ::= CAST LP expr AS typetoken RP */
170105 -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
170106 -4, /* (189) expr ::= ID|INDEXED LP STAR RP */
170107 -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
170108 -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
170109 -1, /* (192) term ::= CTIME_KW */
170110 -5, /* (193) expr ::= LP nexprlist COMMA expr RP */
170111 -3, /* (194) expr ::= expr AND expr */
170112 -3, /* (195) expr ::= expr OR expr */
170113 -3, /* (196) expr ::= expr LT|GT|GE|LE expr */
170114 -3, /* (197) expr ::= expr EQ|NE expr */
170115 -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170116 -3, /* (199) expr ::= expr PLUS|MINUS expr */
170117 -3, /* (200) expr ::= expr STAR|SLASH|REM expr */
170118 -3, /* (201) expr ::= expr CONCAT expr */
170119 -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */
170120 -3, /* (203) expr ::= expr likeop expr */
170121 -5, /* (204) expr ::= expr likeop expr ESCAPE expr */
170122 -2, /* (205) expr ::= expr ISNULL|NOTNULL */
170123 -3, /* (206) expr ::= expr NOT NULL */
170124 -3, /* (207) expr ::= expr IS expr */
170125 -4, /* (208) expr ::= expr IS NOT expr */
170126 -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
170127 -5, /* (210) expr ::= expr IS DISTINCT FROM expr */
170128 -2, /* (211) expr ::= NOT expr */
170129 -2, /* (212) expr ::= BITNOT expr */
170130 -2, /* (213) expr ::= PLUS|MINUS expr */
170131 -3, /* (214) expr ::= expr PTR expr */
170132 -1, /* (215) between_op ::= BETWEEN */
170133 -2, /* (216) between_op ::= NOT BETWEEN */
170134 -5, /* (217) expr ::= expr between_op expr AND expr */
170135 -1, /* (218) in_op ::= IN */
170136 -2, /* (219) in_op ::= NOT IN */
170137 -5, /* (220) expr ::= expr in_op LP exprlist RP */
170138 -3, /* (221) expr ::= LP select RP */
170139 -5, /* (222) expr ::= expr in_op LP select RP */
170140 -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
170141 -4, /* (224) expr ::= EXISTS LP select RP */
170142 -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
170143 -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170144 -4, /* (227) case_exprlist ::= WHEN expr THEN expr */
170145 -2, /* (228) case_else ::= ELSE expr */
170146 0, /* (229) case_else ::= */
170147 -1, /* (230) case_operand ::= expr */
170148 0, /* (231) case_operand ::= */
170149 0, /* (232) exprlist ::= */
170150 -3, /* (233) nexprlist ::= nexprlist COMMA expr */
170151 -1, /* (234) nexprlist ::= expr */
170152 0, /* (235) paren_exprlist ::= */
170153 -3, /* (236) paren_exprlist ::= LP exprlist RP */
170154 -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170155 -1, /* (238) uniqueflag ::= UNIQUE */
170156 0, /* (239) uniqueflag ::= */
170157 0, /* (240) eidlist_opt ::= */
170158 -3, /* (241) eidlist_opt ::= LP eidlist RP */
170159 -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
170160 -3, /* (243) eidlist ::= nm collate sortorder */
170161 0, /* (244) collate ::= */
170162 -2, /* (245) collate ::= COLLATE ID|STRING */
170163 -4, /* (246) cmd ::= DROP INDEX ifexists fullname */
170164 -2, /* (247) cmd ::= VACUUM vinto */
170165 -3, /* (248) cmd ::= VACUUM nm vinto */
170166 -2, /* (249) vinto ::= INTO expr */
170167 0, /* (250) vinto ::= */
170168 -3, /* (251) cmd ::= PRAGMA nm dbnm */
170169 -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
170170 -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170171 -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
170172 -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170173 -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
170174 -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
170175 -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170176 -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170177 -1, /* (260) trigger_time ::= BEFORE|AFTER */
170178 -2, /* (261) trigger_time ::= INSTEAD OF */
170179 0, /* (262) trigger_time ::= */
170180 -1, /* (263) trigger_event ::= DELETE|INSERT */
170181 -1, /* (264) trigger_event ::= UPDATE */
170182 -3, /* (265) trigger_event ::= UPDATE OF idlist */
170183 0, /* (266) when_clause ::= */
170184 -2, /* (267) when_clause ::= WHEN expr */
170185 -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170186 -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
170187 -3, /* (270) trnm ::= nm DOT nm */
170188 -3, /* (271) tridxby ::= INDEXED BY nm */
170189 -2, /* (272) tridxby ::= NOT INDEXED */
170190 -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170191 -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170192 -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170193 -3, /* (276) trigger_cmd ::= scanpt select scanpt */
170194 -4, /* (277) expr ::= RAISE LP IGNORE RP */
170195 -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
170196 -1, /* (279) raisetype ::= ROLLBACK */
170197 -1, /* (280) raisetype ::= ABORT */
170198 -1, /* (281) raisetype ::= FAIL */
170199 -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
170200 -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170201 -3, /* (284) cmd ::= DETACH database_kw_opt expr */
170202 0, /* (285) key_opt ::= */
170203 -2, /* (286) key_opt ::= KEY expr */
170204 -1, /* (287) cmd ::= REINDEX */
170205 -3, /* (288) cmd ::= REINDEX nm dbnm */
170206 -1, /* (289) cmd ::= ANALYZE */
170207 -3, /* (290) cmd ::= ANALYZE nm dbnm */
170208 -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
170209 -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170210 -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170211 -1, /* (294) add_column_fullname ::= fullname */
170212 -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170213 -1, /* (296) cmd ::= create_vtab */
170214 -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */
170215 -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170216 0, /* (299) vtabarg ::= */
170217 -1, /* (300) vtabargtoken ::= ANY */
170218 -3, /* (301) vtabargtoken ::= lp anylist RP */
170219 -1, /* (302) lp ::= LP */
170220 -2, /* (303) with ::= WITH wqlist */
170221 -3, /* (304) with ::= WITH RECURSIVE wqlist */
170222 -1, /* (305) wqas ::= AS */
170223 -2, /* (306) wqas ::= AS MATERIALIZED */
170224 -3, /* (307) wqas ::= AS NOT MATERIALIZED */
170225 -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
170226 -1, /* (309) wqlist ::= wqitem */
170227 -3, /* (310) wqlist ::= wqlist COMMA wqitem */
170228 -1, /* (311) windowdefn_list ::= windowdefn */
170229 -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170230 -5, /* (313) windowdefn ::= nm AS LP window RP */
170231 -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170232 -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170233 -4, /* (316) window ::= ORDER BY sortlist frame_opt */
170234 -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */
170235 -1, /* (318) window ::= frame_opt */
170236 -2, /* (319) window ::= nm frame_opt */
170237 0, /* (320) frame_opt ::= */
170238 -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170239 -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170240 -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
170241 -1, /* (324) frame_bound_s ::= frame_bound */
170242 -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
170243 -1, /* (326) frame_bound_e ::= frame_bound */
170244 -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
170245 -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
170246 -2, /* (329) frame_bound ::= CURRENT ROW */
170247 0, /* (330) frame_exclude_opt ::= */
170248 -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
170249 -2, /* (332) frame_exclude ::= NO OTHERS */
170250 -2, /* (333) frame_exclude ::= CURRENT ROW */
170251 -1, /* (334) frame_exclude ::= GROUP|TIES */
170252 -2, /* (335) window_clause ::= WINDOW windowdefn_list */
170253 -2, /* (336) filter_over ::= filter_clause over_clause */
170254 -1, /* (337) filter_over ::= over_clause */
170255 -1, /* (338) filter_over ::= filter_clause */
170256 -4, /* (339) over_clause ::= OVER LP window RP */
170257 -2, /* (340) over_clause ::= OVER nm */
170258 -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
170259 -1, /* (342) input ::= cmdlist */
170260 -2, /* (343) cmdlist ::= cmdlist ecmd */
170261 -1, /* (344) cmdlist ::= ecmd */
170262 -1, /* (345) ecmd ::= SEMI */
170263 -2, /* (346) ecmd ::= cmdx SEMI */
170264 -3, /* (347) ecmd ::= explain cmdx SEMI */
170265 0, /* (348) trans_opt ::= */
170266 -1, /* (349) trans_opt ::= TRANSACTION */
170267 -2, /* (350) trans_opt ::= TRANSACTION nm */
170268 -1, /* (351) savepoint_opt ::= SAVEPOINT */
170269 0, /* (352) savepoint_opt ::= */
170270 -2, /* (353) cmd ::= create_table create_table_args */
170271 -1, /* (354) table_option_set ::= table_option */
170272 -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */
170273 -2, /* (356) columnlist ::= columnname carglist */
170274 -1, /* (357) nm ::= ID|INDEXED */
170275 -1, /* (358) nm ::= STRING */
170276 -1, /* (359) nm ::= JOIN_KW */
170277 -1, /* (360) typetoken ::= typename */
170278 -1, /* (361) typename ::= ID|STRING */
170279 -1, /* (362) signed ::= plus_num */
170280 -1, /* (363) signed ::= minus_num */
170281 -2, /* (364) carglist ::= carglist ccons */
170282 0, /* (365) carglist ::= */
170283 -2, /* (366) ccons ::= NULL onconf */
170284 -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */
170285 -2, /* (368) ccons ::= AS generated */
170286 -2, /* (369) conslist_opt ::= COMMA conslist */
170287 -3, /* (370) conslist ::= conslist tconscomma tcons */
170288 -1, /* (371) conslist ::= tcons */
170289 0, /* (372) tconscomma ::= */
170290 -1, /* (373) defer_subclause_opt ::= defer_subclause */
170291 -1, /* (374) resolvetype ::= raisetype */
170292 -1, /* (375) selectnowith ::= oneselect */
170293 -1, /* (376) oneselect ::= values */
170294 -2, /* (377) sclp ::= selcollist COMMA */
170295 -1, /* (378) as ::= ID|STRING */
170296 -1, /* (379) indexed_opt ::= indexed_by */
170297 0, /* (380) returning ::= */
170298 -1, /* (381) expr ::= term */
170299 -1, /* (382) likeop ::= LIKE_KW|MATCH */
170300 -1, /* (383) exprlist ::= nexprlist */
170301 -1, /* (384) nmnum ::= plus_num */
170302 -1, /* (385) nmnum ::= nm */
170303 -1, /* (386) nmnum ::= ON */
170304 -1, /* (387) nmnum ::= DELETE */
170305 -1, /* (388) nmnum ::= DEFAULT */
170306 -1, /* (389) plus_num ::= INTEGER|FLOAT */
170307 0, /* (390) foreach_clause ::= */
170308 -3, /* (391) foreach_clause ::= FOR EACH ROW */
170309 -1, /* (392) trnm ::= nm */
170310 0, /* (393) tridxby ::= */
170311 -1, /* (394) database_kw_opt ::= DATABASE */
170312 0, /* (395) database_kw_opt ::= */
170313 0, /* (396) kwcolumn_opt ::= */
170314 -1, /* (397) kwcolumn_opt ::= COLUMNKW */
170315 -1, /* (398) vtabarglist ::= vtabarg */
170316 -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
170317 -2, /* (400) vtabarg ::= vtabarg vtabargtoken */
170318 0, /* (401) anylist ::= */
170319 -4, /* (402) anylist ::= anylist LP anylist RP */
170320 -2, /* (403) anylist ::= anylist ANY */
170321 0, /* (404) with ::= */
170322 };
170323
170324 static void yy_accept(yyParser*); /* Forward Declaration */
170325
170326 /*
@@ -170376,11 +170987,11 @@
170376 {yymsp[1].minor.yy394 = TK_DEFERRED;}
170377 break;
170378 case 5: /* transtype ::= DEFERRED */
170379 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170380 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170381 case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323);
170382 {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170383 break;
170384 case 8: /* cmd ::= COMMIT|END trans_opt */
170385 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170386 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170413,11 +171024,11 @@
170413 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
170414 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
170415 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
170416 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
170417 case 98: /* distinct ::= */ yytestcase(yyruleno==98);
170418 case 244: /* collate ::= */ yytestcase(yyruleno==244);
170419 {yymsp[1].minor.yy394 = 0;}
170420 break;
170421 case 16: /* ifnotexists ::= IF NOT EXISTS */
170422 {yymsp[-2].minor.yy394 = 1;}
170423 break;
@@ -170597,13 +171208,13 @@
170597 case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
170598 {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
170599 break;
170600 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
170601 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
170602 case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216);
170603 case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219);
170604 case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245);
170605 {yymsp[-1].minor.yy394 = 1;}
170606 break;
170607 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
170608 {yymsp[-1].minor.yy394 = 0;}
170609 break;
@@ -170749,13 +171360,13 @@
170749 {yymsp[0].minor.yy394 = SF_All;}
170750 break;
170751 case 99: /* sclp ::= */
170752 case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
170753 case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
170754 case 232: /* exprlist ::= */ yytestcase(yyruleno==232);
170755 case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235);
170756 case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240);
170757 {yymsp[1].minor.yy322 = 0;}
170758 break;
170759 case 100: /* selcollist ::= sclp scanpt expr scanpt as */
170760 {
170761 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170777,12 +171388,12 @@
170777 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
170778 }
170779 break;
170780 case 103: /* as ::= AS nm */
170781 case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
170782 case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170783 case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257);
170784 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
170785 break;
170786 case 105: /* from ::= */
170787 case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
170788 {yymsp[1].minor.yy131 = 0;}
@@ -170950,20 +171561,20 @@
170950 break;
170951 case 144: /* having_opt ::= */
170952 case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
170953 case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
170954 case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
170955 case 229: /* case_else ::= */ yytestcase(yyruleno==229);
170956 case 231: /* case_operand ::= */ yytestcase(yyruleno==231);
170957 case 250: /* vinto ::= */ yytestcase(yyruleno==250);
170958 {yymsp[1].minor.yy528 = 0;}
170959 break;
170960 case 145: /* having_opt ::= HAVING expr */
170961 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
170962 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
170963 case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228);
170964 case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249);
170965 {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
170966 break;
170967 case 147: /* limit_opt ::= LIMIT expr */
170968 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
170969 break;
@@ -171071,23 +171682,22 @@
171071 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171072 break;
171073 case 177: /* expr ::= LP expr RP */
171074 {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171075 break;
171076 case 178: /* expr ::= ID|INDEXED */
171077 case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
171078 {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171079 break;
171080 case 180: /* expr ::= nm DOT nm */
171081 {
171082 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171083 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171084 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171085 }
171086 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171087 break;
171088 case 181: /* expr ::= nm DOT nm DOT nm */
171089 {
171090 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171091 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171092 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171093 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171096,22 +171706,22 @@
171096 }
171097 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171098 }
171099 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171100 break;
171101 case 182: /* term ::= NULL|FLOAT|BLOB */
171102 case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
171103 {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171104 break;
171105 case 184: /* term ::= INTEGER */
171106 {
171107 yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171108 if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171109 }
171110 yymsp[0].minor.yy528 = yylhsminor.yy528;
171111 break;
171112 case 185: /* expr ::= VARIABLE */
171113 {
171114 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171115 u32 n = yymsp[0].minor.yy0.n;
171116 yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171117 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171129,54 +171739,54 @@
171129 if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171130 }
171131 }
171132 }
171133 break;
171134 case 186: /* expr ::= expr COLLATE ID|STRING */
171135 {
171136 yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171137 }
171138 break;
171139 case 187: /* expr ::= CAST LP expr AS typetoken RP */
171140 {
171141 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171142 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171143 }
171144 break;
171145 case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
171146 {
171147 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171148 }
171149 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171150 break;
171151 case 189: /* expr ::= ID|INDEXED LP STAR RP */
171152 {
171153 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171154 }
171155 yymsp[-3].minor.yy528 = yylhsminor.yy528;
171156 break;
171157 case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
171158 {
171159 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171160 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171161 }
171162 yymsp[-5].minor.yy528 = yylhsminor.yy528;
171163 break;
171164 case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
171165 {
171166 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171167 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171168 }
171169 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171170 break;
171171 case 192: /* term ::= CTIME_KW */
171172 {
171173 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171174 }
171175 yymsp[0].minor.yy528 = yylhsminor.yy528;
171176 break;
171177 case 193: /* expr ::= LP nexprlist COMMA expr RP */
171178 {
171179 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171180 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171181 if( yymsp[-4].minor.yy528 ){
171182 yymsp[-4].minor.yy528->x.pList = pList;
@@ -171186,26 +171796,26 @@
171186 }else{
171187 sqlite3ExprListDelete(pParse->db, pList);
171188 }
171189 }
171190 break;
171191 case 194: /* expr ::= expr AND expr */
171192 {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171193 break;
171194 case 195: /* expr ::= expr OR expr */
171195 case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
171196 case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
171197 case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
171198 case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
171199 case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
171200 case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
171201 {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171202 break;
171203 case 202: /* likeop ::= NOT LIKE_KW|MATCH */
171204 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171205 break;
171206 case 203: /* expr ::= expr likeop expr */
171207 {
171208 ExprList *pList;
171209 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171210 yymsp[-1].minor.yy0.n &= 0x7fffffff;
171211 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171213,11 +171823,11 @@
171213 yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171214 if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171215 if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171216 }
171217 break;
171218 case 204: /* expr ::= expr likeop expr ESCAPE expr */
171219 {
171220 ExprList *pList;
171221 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171222 yymsp[-3].minor.yy0.n &= 0x7fffffff;
171223 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171226,63 +171836,63 @@
171226 yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171227 if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171228 if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171229 }
171230 break;
171231 case 205: /* expr ::= expr ISNULL|NOTNULL */
171232 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171233 break;
171234 case 206: /* expr ::= expr NOT NULL */
171235 {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171236 break;
171237 case 207: /* expr ::= expr IS expr */
171238 {
171239 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171240 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171241 }
171242 break;
171243 case 208: /* expr ::= expr IS NOT expr */
171244 {
171245 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171246 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171247 }
171248 break;
171249 case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */
171250 {
171251 yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171252 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171253 }
171254 break;
171255 case 210: /* expr ::= expr IS DISTINCT FROM expr */
171256 {
171257 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171258 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171259 }
171260 break;
171261 case 211: /* expr ::= NOT expr */
171262 case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212);
171263 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171264 break;
171265 case 213: /* expr ::= PLUS|MINUS expr */
171266 {
171267 yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171268 /*A-overwrites-B*/
171269 }
171270 break;
171271 case 214: /* expr ::= expr PTR expr */
171272 {
171273 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171274 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171275 yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171276 }
171277 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171278 break;
171279 case 215: /* between_op ::= BETWEEN */
171280 case 218: /* in_op ::= IN */ yytestcase(yyruleno==218);
171281 {yymsp[0].minor.yy394 = 0;}
171282 break;
171283 case 217: /* expr ::= expr between_op expr AND expr */
171284 {
171285 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171286 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171287 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171288 if( yymsp[-4].minor.yy528 ){
@@ -171291,11 +171901,11 @@
171291 sqlite3ExprListDelete(pParse->db, pList);
171292 }
171293 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171294 }
171295 break;
171296 case 220: /* expr ::= expr in_op LP exprlist RP */
171297 {
171298 if( yymsp[-1].minor.yy322==0 ){
171299 /* Expressions of the form
171300 **
171301 ** expr1 IN ()
@@ -171337,41 +171947,41 @@
171337 }
171338 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171339 }
171340 }
171341 break;
171342 case 221: /* expr ::= LP select RP */
171343 {
171344 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171345 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171346 }
171347 break;
171348 case 222: /* expr ::= expr in_op LP select RP */
171349 {
171350 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171351 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171352 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171353 }
171354 break;
171355 case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */
171356 {
171357 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171358 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171359 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171360 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171361 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171362 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171363 }
171364 break;
171365 case 224: /* expr ::= EXISTS LP select RP */
171366 {
171367 Expr *p;
171368 p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171369 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171370 }
171371 break;
171372 case 225: /* expr ::= CASE case_operand case_exprlist case_else END */
171373 {
171374 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171375 if( yymsp[-4].minor.yy528 ){
171376 yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171377 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171379,406 +171989,406 @@
171379 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171380 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171381 }
171382 }
171383 break;
171384 case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171385 {
171386 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171387 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171388 }
171389 break;
171390 case 227: /* case_exprlist ::= WHEN expr THEN expr */
171391 {
171392 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171393 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
171394 }
171395 break;
171396 case 230: /* case_operand ::= expr */
171397 {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
171398 break;
171399 case 233: /* nexprlist ::= nexprlist COMMA expr */
171400 {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
171401 break;
171402 case 234: /* nexprlist ::= expr */
171403 {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
171404 break;
171405 case 236: /* paren_exprlist ::= LP exprlist RP */
171406 case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241);
171407 {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
171408 break;
171409 case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
171410 {
171411 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
171412 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
171413 &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
171414 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
171415 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
171416 }
171417 }
171418 break;
171419 case 238: /* uniqueflag ::= UNIQUE */
171420 case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280);
171421 {yymsp[0].minor.yy394 = OE_Abort;}
171422 break;
171423 case 239: /* uniqueflag ::= */
171424 {yymsp[1].minor.yy394 = OE_None;}
171425 break;
171426 case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */
171427 {
171428 yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
171429 }
171430 break;
171431 case 243: /* eidlist ::= nm collate sortorder */
171432 {
171433 yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
171434 }
171435 break;
171436 case 246: /* cmd ::= DROP INDEX ifexists fullname */
171437 {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
171438 break;
171439 case 247: /* cmd ::= VACUUM vinto */
171440 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
171441 break;
171442 case 248: /* cmd ::= VACUUM nm vinto */
171443 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
171444 break;
171445 case 251: /* cmd ::= PRAGMA nm dbnm */
171446 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
171447 break;
171448 case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171449 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
171450 break;
171451 case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171452 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
171453 break;
171454 case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171455 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
171456 break;
171457 case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171458 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
171459 break;
171460 case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171461 {
171462 Token all;
171463 all.z = yymsp[-3].minor.yy0.z;
171464 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
171465 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
171466 }
171467 break;
171468 case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
171469 {
171470 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
171471 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
171472 }
171473 break;
171474 case 260: /* trigger_time ::= BEFORE|AFTER */
171475 { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
171476 break;
171477 case 261: /* trigger_time ::= INSTEAD OF */
171478 { yymsp[-1].minor.yy394 = TK_INSTEAD;}
171479 break;
171480 case 262: /* trigger_time ::= */
171481 { yymsp[1].minor.yy394 = TK_BEFORE; }
171482 break;
171483 case 263: /* trigger_event ::= DELETE|INSERT */
171484 case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264);
171485 {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
171486 break;
171487 case 265: /* trigger_event ::= UPDATE OF idlist */
171488 {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
171489 break;
171490 case 266: /* when_clause ::= */
171491 case 285: /* key_opt ::= */ yytestcase(yyruleno==285);
171492 { yymsp[1].minor.yy528 = 0; }
171493 break;
171494 case 267: /* when_clause ::= WHEN expr */
171495 case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286);
171496 { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
171497 break;
171498 case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171499 {
171500 assert( yymsp[-2].minor.yy33!=0 );
171501 yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
171502 yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
171503 }
171504 break;
171505 case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */
171506 {
171507 assert( yymsp[-1].minor.yy33!=0 );
171508 yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
171509 }
171510 break;
171511 case 270: /* trnm ::= nm DOT nm */
171512 {
171513 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
171514 sqlite3ErrorMsg(pParse,
171515 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
171516 "statements within triggers");
171517 }
171518 break;
171519 case 271: /* tridxby ::= INDEXED BY nm */
171520 {
171521 sqlite3ErrorMsg(pParse,
171522 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
171523 "within triggers");
171524 }
171525 break;
171526 case 272: /* tridxby ::= NOT INDEXED */
171527 {
171528 sqlite3ErrorMsg(pParse,
171529 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
171530 "within triggers");
171531 }
171532 break;
171533 case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171534 {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
171535 yymsp[-8].minor.yy33 = yylhsminor.yy33;
171536 break;
171537 case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
171538 {
171539 yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
171540 }
171541 yymsp[-7].minor.yy33 = yylhsminor.yy33;
171542 break;
171543 case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171544 {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
171545 yymsp[-5].minor.yy33 = yylhsminor.yy33;
171546 break;
171547 case 276: /* trigger_cmd ::= scanpt select scanpt */
171548 {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
171549 yymsp[-2].minor.yy33 = yylhsminor.yy33;
171550 break;
171551 case 277: /* expr ::= RAISE LP IGNORE RP */
171552 {
171553 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
171554 if( yymsp[-3].minor.yy528 ){
171555 yymsp[-3].minor.yy528->affExpr = OE_Ignore;
171556 }
171557 }
171558 break;
171559 case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */
171560 {
171561 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
171562 if( yymsp[-5].minor.yy528 ) {
171563 yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
171564 }
171565 }
171566 break;
171567 case 279: /* raisetype ::= ROLLBACK */
171568 {yymsp[0].minor.yy394 = OE_Rollback;}
171569 break;
171570 case 281: /* raisetype ::= FAIL */
171571 {yymsp[0].minor.yy394 = OE_Fail;}
171572 break;
171573 case 282: /* cmd ::= DROP TRIGGER ifexists fullname */
171574 {
171575 sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
171576 }
171577 break;
171578 case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
171579 {
171580 sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
171581 }
171582 break;
171583 case 284: /* cmd ::= DETACH database_kw_opt expr */
171584 {
171585 sqlite3Detach(pParse, yymsp[0].minor.yy528);
171586 }
171587 break;
171588 case 287: /* cmd ::= REINDEX */
171589 {sqlite3Reindex(pParse, 0, 0);}
171590 break;
171591 case 288: /* cmd ::= REINDEX nm dbnm */
171592 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171593 break;
171594 case 289: /* cmd ::= ANALYZE */
171595 {sqlite3Analyze(pParse, 0, 0);}
171596 break;
171597 case 290: /* cmd ::= ANALYZE nm dbnm */
171598 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171599 break;
171600 case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
171601 {
171602 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
171603 }
171604 break;
171605 case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
171606 {
171607 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
171608 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
171609 }
171610 break;
171611 case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
171612 {
171613 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
171614 }
171615 break;
171616 case 294: /* add_column_fullname ::= fullname */
171617 {
171618 disableLookaside(pParse);
171619 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
171620 }
171621 break;
171622 case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
171623 {
171624 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
171625 }
171626 break;
171627 case 296: /* cmd ::= create_vtab */
171628 {sqlite3VtabFinishParse(pParse,0);}
171629 break;
171630 case 297: /* cmd ::= create_vtab LP vtabarglist RP */
171631 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
171632 break;
171633 case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
171634 {
171635 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
171636 }
171637 break;
171638 case 299: /* vtabarg ::= */
171639 {sqlite3VtabArgInit(pParse);}
171640 break;
171641 case 300: /* vtabargtoken ::= ANY */
171642 case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301);
171643 case 302: /* lp ::= LP */ yytestcase(yyruleno==302);
171644 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
171645 break;
171646 case 303: /* with ::= WITH wqlist */
171647 case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304);
171648 { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
171649 break;
171650 case 305: /* wqas ::= AS */
171651 {yymsp[0].minor.yy516 = M10d_Any;}
171652 break;
171653 case 306: /* wqas ::= AS MATERIALIZED */
171654 {yymsp[-1].minor.yy516 = M10d_Yes;}
171655 break;
171656 case 307: /* wqas ::= AS NOT MATERIALIZED */
171657 {yymsp[-2].minor.yy516 = M10d_No;}
171658 break;
171659 case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */
171660 {
171661 yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
171662 }
171663 break;
171664 case 309: /* wqlist ::= wqitem */
171665 {
171666 yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
171667 }
171668 break;
171669 case 310: /* wqlist ::= wqlist COMMA wqitem */
171670 {
171671 yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
171672 }
171673 break;
171674 case 311: /* windowdefn_list ::= windowdefn */
171675 { yylhsminor.yy41 = yymsp[0].minor.yy41; }
171676 yymsp[0].minor.yy41 = yylhsminor.yy41;
171677 break;
171678 case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
171679 {
171680 assert( yymsp[0].minor.yy41!=0 );
171681 sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
171682 yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
171683 yylhsminor.yy41 = yymsp[0].minor.yy41;
171684 }
171685 yymsp[-2].minor.yy41 = yylhsminor.yy41;
171686 break;
171687 case 313: /* windowdefn ::= nm AS LP window RP */
171688 {
171689 if( ALWAYS(yymsp[-1].minor.yy41) ){
171690 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
171691 }
171692 yylhsminor.yy41 = yymsp[-1].minor.yy41;
171693 }
171694 yymsp[-4].minor.yy41 = yylhsminor.yy41;
171695 break;
171696 case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
171697 {
171698 yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
171699 }
171700 break;
171701 case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
171702 {
171703 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
171704 }
171705 yymsp[-5].minor.yy41 = yylhsminor.yy41;
171706 break;
171707 case 316: /* window ::= ORDER BY sortlist frame_opt */
171708 {
171709 yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
171710 }
171711 break;
171712 case 317: /* window ::= nm ORDER BY sortlist frame_opt */
171713 {
171714 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
171715 }
171716 yymsp[-4].minor.yy41 = yylhsminor.yy41;
171717 break;
171718 case 318: /* window ::= frame_opt */
171719 case 337: /* filter_over ::= over_clause */ yytestcase(yyruleno==337);
171720 {
171721 yylhsminor.yy41 = yymsp[0].minor.yy41;
171722 }
171723 yymsp[0].minor.yy41 = yylhsminor.yy41;
171724 break;
171725 case 319: /* window ::= nm frame_opt */
171726 {
171727 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
171728 }
171729 yymsp[-1].minor.yy41 = yylhsminor.yy41;
171730 break;
171731 case 320: /* frame_opt ::= */
171732 {
171733 yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
171734 }
171735 break;
171736 case 321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
171737 {
171738 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
171739 }
171740 yymsp[-2].minor.yy41 = yylhsminor.yy41;
171741 break;
171742 case 322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
171743 {
171744 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
171745 }
171746 yymsp[-5].minor.yy41 = yylhsminor.yy41;
171747 break;
171748 case 324: /* frame_bound_s ::= frame_bound */
171749 case 326: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==326);
171750 {yylhsminor.yy595 = yymsp[0].minor.yy595;}
171751 yymsp[0].minor.yy595 = yylhsminor.yy595;
171752 break;
171753 case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */
171754 case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327);
171755 case 329: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==329);
171756 {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
171757 yymsp[-1].minor.yy595 = yylhsminor.yy595;
171758 break;
171759 case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */
171760 {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
171761 yymsp[-1].minor.yy595 = yylhsminor.yy595;
171762 break;
171763 case 330: /* frame_exclude_opt ::= */
171764 {yymsp[1].minor.yy516 = 0;}
171765 break;
171766 case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
171767 {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
171768 break;
171769 case 332: /* frame_exclude ::= NO OTHERS */
171770 case 333: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==333);
171771 {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
171772 break;
171773 case 334: /* frame_exclude ::= GROUP|TIES */
171774 {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
171775 break;
171776 case 335: /* window_clause ::= WINDOW windowdefn_list */
171777 { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
171778 break;
171779 case 336: /* filter_over ::= filter_clause over_clause */
171780 {
171781 if( yymsp[0].minor.yy41 ){
171782 yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
171783 }else{
171784 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171785,11 +172395,11 @@
171785 }
171786 yylhsminor.yy41 = yymsp[0].minor.yy41;
171787 }
171788 yymsp[-1].minor.yy41 = yylhsminor.yy41;
171789 break;
171790 case 338: /* filter_over ::= filter_clause */
171791 {
171792 yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171793 if( yylhsminor.yy41 ){
171794 yylhsminor.yy41->eFrmType = TK_FILTER;
171795 yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171797,91 +172407,90 @@
171797 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
171798 }
171799 }
171800 yymsp[0].minor.yy41 = yylhsminor.yy41;
171801 break;
171802 case 339: /* over_clause ::= OVER LP window RP */
171803 {
171804 yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
171805 assert( yymsp[-3].minor.yy41!=0 );
171806 }
171807 break;
171808 case 340: /* over_clause ::= OVER nm */
171809 {
171810 yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171811 if( yymsp[-1].minor.yy41 ){
171812 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
171813 }
171814 }
171815 break;
171816 case 341: /* filter_clause ::= FILTER LP WHERE expr RP */
171817 { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
171818 break;
171819 default:
171820 /* (342) input ::= cmdlist */ yytestcase(yyruleno==342);
171821 /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343);
171822 /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344);
171823 /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345);
171824 /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346);
171825 /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347);
171826 /* (348) trans_opt ::= */ yytestcase(yyruleno==348);
171827 /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349);
171828 /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350);
171829 /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351);
171830 /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352);
171831 /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353);
171832 /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354);
171833 /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355);
171834 /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356);
171835 /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357);
171836 /* (358) nm ::= STRING */ yytestcase(yyruleno==358);
171837 /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359);
171838 /* (360) typetoken ::= typename */ yytestcase(yyruleno==360);
171839 /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361);
171840 /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362);
171841 /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363);
171842 /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364);
171843 /* (365) carglist ::= */ yytestcase(yyruleno==365);
171844 /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366);
171845 /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367);
171846 /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368);
171847 /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369);
171848 /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370);
171849 /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371);
171850 /* (372) tconscomma ::= */ yytestcase(yyruleno==372);
171851 /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373);
171852 /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374);
171853 /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375);
171854 /* (376) oneselect ::= values */ yytestcase(yyruleno==376);
171855 /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377);
171856 /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378);
171857 /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379);
171858 /* (380) returning ::= */ yytestcase(yyruleno==380);
171859 /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381);
171860 /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382);
171861 /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383);
171862 /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384);
171863 /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385);
171864 /* (386) nmnum ::= ON */ yytestcase(yyruleno==386);
171865 /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387);
171866 /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388);
171867 /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389);
171868 /* (390) foreach_clause ::= */ yytestcase(yyruleno==390);
171869 /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391);
171870 /* (392) trnm ::= nm */ yytestcase(yyruleno==392);
171871 /* (393) tridxby ::= */ yytestcase(yyruleno==393);
171872 /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394);
171873 /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395);
171874 /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396);
171875 /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397);
171876 /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398);
171877 /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399);
171878 /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400);
171879 /* (401) anylist ::= */ yytestcase(yyruleno==401);
171880 /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402);
171881 /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403);
171882 /* (404) with ::= */ yytestcase(yyruleno==404);
171883 break;
171884 /********** End reduce actions ************************************************/
171885 };
171886 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
171887 yygoto = yyRuleInfoLhs[yyruleno];
@@ -172453,11 +173062,11 @@
172453 132, 0, 98, 38, 39, 0, 20, 45, 117, 93,
172454 };
172455 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
172456 ** then the i-th keyword has no more hash collisions. Otherwise,
172457 ** the next keyword with the same hash is aKWHash[i]-1. */
172458 static const unsigned char aKWNext[147] = {
172459 0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0,
172460 0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0,
172461 141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0,
172462 138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
172463 0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -172468,11 +173077,11 @@
172468 112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0,
172469 99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0,
172470 102, 0, 0, 87,
172471 };
172472 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
172473 static const unsigned char aKWLen[147] = {
172474 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
172475 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
172476 6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
172477 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
172478 2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
@@ -172484,11 +173093,11 @@
172484 4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2,
172485 2, 9, 3, 7,
172486 };
172487 /* aKWOffset[i] is the index into zKWText[] of the start of
172488 ** the text for the i-th keyword. */
172489 static const unsigned short int aKWOffset[147] = {
172490 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
172491 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
172492 86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
172493 129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
172494 184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
@@ -172499,11 +173108,11 @@
172499 520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579,
172500 585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645,
172501 648, 650, 655, 659,
172502 };
172503 /* aKWCode[i] is the parser symbol code for the i-th keyword */
172504 static const unsigned char aKWCode[147] = {
172505 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
172506 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
172507 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
172508 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
172509 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -172668,11 +173277,11 @@
172668 static int keywordCode(const char *z, int n, int *pType){
172669 int i, j;
172670 const char *zKW;
172671 if( n>=2 ){
172672 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
172673 for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
172674 if( aKWLen[i]!=n ) continue;
172675 zKW = &zKWText[aKWOffset[i]];
172676 #ifdef SQLITE_ASCII
172677 if( (z[0]&~0x20)!=zKW[0] ) continue;
172678 if( (z[1]&~0x20)!=zKW[1] ) continue;
@@ -172684,157 +173293,157 @@
172684 if( toupper(z[1])!=zKW[1] ) continue;
172685 j = 2;
172686 while( j<n && toupper(z[j])==zKW[j] ){ j++; }
172687 #endif
172688 if( j<n ) continue;
172689 testcase( i==0 ); /* REINDEX */
172690 testcase( i==1 ); /* INDEXED */
172691 testcase( i==2 ); /* INDEX */
172692 testcase( i==3 ); /* DESC */
172693 testcase( i==4 ); /* ESCAPE */
172694 testcase( i==5 ); /* EACH */
172695 testcase( i==6 ); /* CHECK */
172696 testcase( i==7 ); /* KEY */
172697 testcase( i==8 ); /* BEFORE */
172698 testcase( i==9 ); /* FOREIGN */
172699 testcase( i==10 ); /* FOR */
172700 testcase( i==11 ); /* IGNORE */
172701 testcase( i==12 ); /* REGEXP */
172702 testcase( i==13 ); /* EXPLAIN */
172703 testcase( i==14 ); /* INSTEAD */
172704 testcase( i==15 ); /* ADD */
172705 testcase( i==16 ); /* DATABASE */
172706 testcase( i==17 ); /* AS */
172707 testcase( i==18 ); /* SELECT */
172708 testcase( i==19 ); /* TABLE */
172709 testcase( i==20 ); /* LEFT */
172710 testcase( i==21 ); /* THEN */
172711 testcase( i==22 ); /* END */
172712 testcase( i==23 ); /* DEFERRABLE */
172713 testcase( i==24 ); /* ELSE */
172714 testcase( i==25 ); /* EXCLUDE */
172715 testcase( i==26 ); /* DELETE */
172716 testcase( i==27 ); /* TEMPORARY */
172717 testcase( i==28 ); /* TEMP */
172718 testcase( i==29 ); /* OR */
172719 testcase( i==30 ); /* ISNULL */
172720 testcase( i==31 ); /* NULLS */
172721 testcase( i==32 ); /* SAVEPOINT */
172722 testcase( i==33 ); /* INTERSECT */
172723 testcase( i==34 ); /* TIES */
172724 testcase( i==35 ); /* NOTNULL */
172725 testcase( i==36 ); /* NOT */
172726 testcase( i==37 ); /* NO */
172727 testcase( i==38 ); /* NULL */
172728 testcase( i==39 ); /* LIKE */
172729 testcase( i==40 ); /* EXCEPT */
172730 testcase( i==41 ); /* TRANSACTION */
172731 testcase( i==42 ); /* ACTION */
172732 testcase( i==43 ); /* ON */
172733 testcase( i==44 ); /* NATURAL */
172734 testcase( i==45 ); /* ALTER */
172735 testcase( i==46 ); /* RAISE */
172736 testcase( i==47 ); /* EXCLUSIVE */
172737 testcase( i==48 ); /* EXISTS */
172738 testcase( i==49 ); /* CONSTRAINT */
172739 testcase( i==50 ); /* INTO */
172740 testcase( i==51 ); /* OFFSET */
172741 testcase( i==52 ); /* OF */
172742 testcase( i==53 ); /* SET */
172743 testcase( i==54 ); /* TRIGGER */
172744 testcase( i==55 ); /* RANGE */
172745 testcase( i==56 ); /* GENERATED */
172746 testcase( i==57 ); /* DETACH */
172747 testcase( i==58 ); /* HAVING */
172748 testcase( i==59 ); /* GLOB */
172749 testcase( i==60 ); /* BEGIN */
172750 testcase( i==61 ); /* INNER */
172751 testcase( i==62 ); /* REFERENCES */
172752 testcase( i==63 ); /* UNIQUE */
172753 testcase( i==64 ); /* QUERY */
172754 testcase( i==65 ); /* WITHOUT */
172755 testcase( i==66 ); /* WITH */
172756 testcase( i==67 ); /* OUTER */
172757 testcase( i==68 ); /* RELEASE */
172758 testcase( i==69 ); /* ATTACH */
172759 testcase( i==70 ); /* BETWEEN */
172760 testcase( i==71 ); /* NOTHING */
172761 testcase( i==72 ); /* GROUPS */
172762 testcase( i==73 ); /* GROUP */
172763 testcase( i==74 ); /* CASCADE */
172764 testcase( i==75 ); /* ASC */
172765 testcase( i==76 ); /* DEFAULT */
172766 testcase( i==77 ); /* CASE */
172767 testcase( i==78 ); /* COLLATE */
172768 testcase( i==79 ); /* CREATE */
172769 testcase( i==80 ); /* CURRENT_DATE */
172770 testcase( i==81 ); /* IMMEDIATE */
172771 testcase( i==82 ); /* JOIN */
172772 testcase( i==83 ); /* INSERT */
172773 testcase( i==84 ); /* MATCH */
172774 testcase( i==85 ); /* PLAN */
172775 testcase( i==86 ); /* ANALYZE */
172776 testcase( i==87 ); /* PRAGMA */
172777 testcase( i==88 ); /* MATERIALIZED */
172778 testcase( i==89 ); /* DEFERRED */
172779 testcase( i==90 ); /* DISTINCT */
172780 testcase( i==91 ); /* IS */
172781 testcase( i==92 ); /* UPDATE */
172782 testcase( i==93 ); /* VALUES */
172783 testcase( i==94 ); /* VIRTUAL */
172784 testcase( i==95 ); /* ALWAYS */
172785 testcase( i==96 ); /* WHEN */
172786 testcase( i==97 ); /* WHERE */
172787 testcase( i==98 ); /* RECURSIVE */
172788 testcase( i==99 ); /* ABORT */
172789 testcase( i==100 ); /* AFTER */
172790 testcase( i==101 ); /* RENAME */
172791 testcase( i==102 ); /* AND */
172792 testcase( i==103 ); /* DROP */
172793 testcase( i==104 ); /* PARTITION */
172794 testcase( i==105 ); /* AUTOINCREMENT */
172795 testcase( i==106 ); /* TO */
172796 testcase( i==107 ); /* IN */
172797 testcase( i==108 ); /* CAST */
172798 testcase( i==109 ); /* COLUMN */
172799 testcase( i==110 ); /* COMMIT */
172800 testcase( i==111 ); /* CONFLICT */
172801 testcase( i==112 ); /* CROSS */
172802 testcase( i==113 ); /* CURRENT_TIMESTAMP */
172803 testcase( i==114 ); /* CURRENT_TIME */
172804 testcase( i==115 ); /* CURRENT */
172805 testcase( i==116 ); /* PRECEDING */
172806 testcase( i==117 ); /* FAIL */
172807 testcase( i==118 ); /* LAST */
172808 testcase( i==119 ); /* FILTER */
172809 testcase( i==120 ); /* REPLACE */
172810 testcase( i==121 ); /* FIRST */
172811 testcase( i==122 ); /* FOLLOWING */
172812 testcase( i==123 ); /* FROM */
172813 testcase( i==124 ); /* FULL */
172814 testcase( i==125 ); /* LIMIT */
172815 testcase( i==126 ); /* IF */
172816 testcase( i==127 ); /* ORDER */
172817 testcase( i==128 ); /* RESTRICT */
172818 testcase( i==129 ); /* OTHERS */
172819 testcase( i==130 ); /* OVER */
172820 testcase( i==131 ); /* RETURNING */
172821 testcase( i==132 ); /* RIGHT */
172822 testcase( i==133 ); /* ROLLBACK */
172823 testcase( i==134 ); /* ROWS */
172824 testcase( i==135 ); /* ROW */
172825 testcase( i==136 ); /* UNBOUNDED */
172826 testcase( i==137 ); /* UNION */
172827 testcase( i==138 ); /* USING */
172828 testcase( i==139 ); /* VACUUM */
172829 testcase( i==140 ); /* VIEW */
172830 testcase( i==141 ); /* WINDOW */
172831 testcase( i==142 ); /* DO */
172832 testcase( i==143 ); /* BY */
172833 testcase( i==144 ); /* INITIALLY */
172834 testcase( i==145 ); /* ALL */
172835 testcase( i==146 ); /* PRIMARY */
172836 *pType = aKWCode[i];
172837 break;
172838 }
172839 }
172840 return n;
@@ -172845,10 +173454,11 @@
172845 return id;
172846 }
172847 #define SQLITE_N_KEYWORD 147
172848 SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
172849 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
 
172850 *pzName = zKWText + aKWOffset[i];
172851 *pnName = aKWLen[i];
172852 return SQLITE_OK;
172853 }
172854 SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; }
@@ -174383,13 +174993,25 @@
174383 */
174384 SQLITE_API int sqlite3_config(int op, ...){
174385 va_list ap;
174386 int rc = SQLITE_OK;
174387
174388 /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
174389 ** the SQLite library is in use. */
174390 if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;
 
 
 
 
 
 
 
 
 
 
 
 
174391
174392 va_start(ap, op);
174393 switch( op ){
174394
174395 /* Mutex configuration options are only available in a threadsafe
@@ -174454,10 +175076,11 @@
174454 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
174455 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
174456 break;
174457 }
174458 case SQLITE_CONFIG_MEMSTATUS: {
 
174459 /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
174460 ** single argument of type int, interpreted as a boolean, which enables
174461 ** or disables the collection of memory allocation statistics. */
174462 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
174463 break;
@@ -174577,12 +175200,14 @@
174577 /* MSVC is picky about pulling func ptrs from va lists.
174578 ** http://support.microsoft.com/kb/47961
174579 ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
174580 */
174581 typedef void(*LOGFUNC_t)(void*,int,const char*);
174582 sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
174583 sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
 
 
174584 break;
174585 }
174586
174587 /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
174588 ** can be changed at start-time using the
@@ -174592,11 +175217,12 @@
174592 case SQLITE_CONFIG_URI: {
174593 /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
174594 ** argument of type int. If non-zero, then URI handling is globally
174595 ** enabled. If the parameter is zero, then URI handling is globally
174596 ** disabled. */
174597 sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
 
174598 break;
174599 }
174600
174601 case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
174602 /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174907,10 +175533,12 @@
174907 { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
174908 { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
174909 { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
174910 { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
174911 { SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
 
 
174912 };
174913 unsigned int i;
174914 rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
174915 for(i=0; i<ArraySize(aFlagOp); i++){
174916 if( aFlagOp[i].op==op ){
@@ -176892,13 +177520,13 @@
176892 char c;
176893 int nUri = sqlite3Strlen30(zUri);
176894
176895 assert( *pzErrMsg==0 );
176896
176897 if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
176898 || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
176899 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
176900 ){
176901 char *zOpt;
176902 int eState; /* Parser state when parsing URI */
176903 int iIn; /* Input character index */
176904 int iOut = 0; /* Output character index */
@@ -177300,10 +177928,13 @@
177300 #if defined(SQLITE_DEFAULT_DEFENSIVE)
177301 | SQLITE_Defensive
177302 #endif
177303 #if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177304 | SQLITE_LegacyAlter
 
 
 
177305 #endif
177306 ;
177307 sqlite3HashInit(&db->aCollSeq);
177308 #ifndef SQLITE_OMIT_VIRTUALTABLE
177309 sqlite3HashInit(&db->aModule);
@@ -193069,20 +193700,22 @@
193069 static int fts3MsrBufferData(
193070 Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193071 char *pList,
193072 i64 nList
193073 ){
193074 if( nList>pMsr->nBuffer ){
193075 char *pNew;
193076 pMsr->nBuffer = nList*2;
193077 pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
193078 if( !pNew ) return SQLITE_NOMEM;
193079 pMsr->aBuffer = pNew;
 
193080 }
193081
193082 assert( nList>0 );
193083 memcpy(pMsr->aBuffer, pList, nList);
 
193084 return SQLITE_OK;
193085 }
193086
193087 SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193088 Fts3Table *p, /* Virtual table handle */
@@ -199070,12 +199703,15 @@
199070 switch( sqlite3_value_type(pValue) ){
199071 case SQLITE_NULL: {
199072 jsonAppendRaw(p, "null", 4);
199073 break;
199074 }
199075 case SQLITE_INTEGER:
199076 case SQLITE_FLOAT: {
 
 
 
 
199077 const char *z = (const char*)sqlite3_value_text(pValue);
199078 u32 n = (u32)sqlite3_value_bytes(pValue);
199079 jsonAppendRaw(p, z, n);
199080 break;
199081 }
@@ -199517,10 +200153,31 @@
199517 int i;
199518 for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0;
199519 return 1;
199520 }
199521
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199522 /*
199523 ** Parse a single JSON value which begins at pParse->zJson[i]. Return the
199524 ** index of the first character past the end of the value parsed.
199525 **
199526 ** Return negative for a syntax error. Special cases: return -2 if the
@@ -199662,10 +200319,28 @@
199662 c = z[j+1];
199663 }
199664 if( c<'0' || c>'9' ) return -1;
199665 continue;
199666 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199667 break;
199668 }
199669 if( z[j-1]<'0' ) return -1;
199670 jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT,
199671 j - i, &z[i]);
@@ -199675,10 +200350,24 @@
199675 }else if( c==']' ){
199676 return -3; /* End of [...] */
199677 }else if( c==0 ){
199678 return 0; /* End of file */
199679 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199680 return -1; /* Syntax error */
199681 }
199682 }
199683
199684 /*
@@ -212497,19 +213186,28 @@
212497
212498 iOff = (i64)(pFrame->iDbPage-1) * p->pgsz;
212499 p->rc = pDb->pMethods->xWrite(pDb, p->aBuf, p->pgsz, iOff);
212500 }
212501
 
 
 
 
 
212502
212503 /*
212504 ** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if
212505 ** successful, or an SQLite error code otherwise.
212506 */
212507 static int rbuLockDatabase(sqlite3 *db){
212508 int rc = SQLITE_OK;
212509 sqlite3_file *fd = 0;
212510 sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd);
 
 
 
 
212511
212512 if( fd->pMethods ){
212513 rc = fd->pMethods->xLock(fd, SQLITE_LOCK_SHARED);
212514 if( rc==SQLITE_OK ){
212515 rc = fd->pMethods->xLock(fd, SQLITE_LOCK_EXCLUSIVE);
@@ -215744,10 +216442,11 @@
215744 (void)argc;
215745 (void)argv;
215746 (void)pzErr;
215747
215748 sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
 
215749 rc = sqlite3_declare_vtab(db,
215750 "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
215751 if( rc==SQLITE_OK ){
215752 pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable));
215753 if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
@@ -215827,11 +216526,10 @@
215827 && pIdxInfo->aOrderBy[0].iColumn<=0
215828 && pIdxInfo->aOrderBy[0].desc==0
215829 ){
215830 pIdxInfo->orderByConsumed = 1;
215831 }
215832 sqlite3VtabUsesAllSchemas(pIdxInfo);
215833 return SQLITE_OK;
215834 }
215835
215836 /*
215837 ** Open a new dbpagevfs cursor.
@@ -218216,13 +218914,14 @@
218216 SessionBuffer *p,
218217 const char *zStr,
218218 int *pRc
218219 ){
218220 int nStr = sqlite3Strlen30(zStr);
218221 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218222 memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218223 p->nBuf += nStr;
 
218224 }
218225 }
218226
218227 /*
218228 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218239,10 +218938,31 @@
218239 ){
218240 char aBuf[24];
218241 sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218242 sessionAppendStr(p, aBuf, pRc);
218243 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218244
218245 /*
218246 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
218247 ** called. Otherwise, append the string zStr enclosed in quotes (") and
218248 ** with any embedded quote characters escaped to the buffer. No
@@ -218254,11 +218974,11 @@
218254 static void sessionAppendIdent(
218255 SessionBuffer *p, /* Buffer to a append to */
218256 const char *zStr, /* String to quote, escape and append */
218257 int *pRc /* IN/OUT: Error code */
218258 ){
218259 int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1;
218260 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218261 char *zOut = (char *)&p->aBuf[p->nBuf];
218262 const char *zIn = zStr;
218263 *zOut++ = '"';
218264 while( *zIn ){
@@ -218265,10 +218985,11 @@
218265 if( *zIn=='"' ) *zOut++ = '"';
218266 *zOut++ = *(zIn++);
218267 }
218268 *zOut++ = '"';
218269 p->nBuf = (int)((u8 *)zOut - p->aBuf);
 
218270 }
218271 }
218272
218273 /*
218274 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218489,33 +219210,82 @@
218489
218490 /*
218491 ** Formulate and prepare a SELECT statement to retrieve a row from table
218492 ** zTab in database zDb based on its primary key. i.e.
218493 **
218494 ** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ...
 
 
 
 
 
 
218495 */
218496 static int sessionSelectStmt(
218497 sqlite3 *db, /* Database handle */
 
218498 const char *zDb, /* Database name */
218499 const char *zTab, /* Table name */
218500 int nCol, /* Number of columns in table */
218501 const char **azCol, /* Names of table columns */
218502 u8 *abPK, /* PRIMARY KEY array */
218503 sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
218504 ){
218505 int rc = SQLITE_OK;
218506 char *zSql = 0;
 
 
218507 int nSql = -1;
 
218508
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218509 if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
218510 zSql = sqlite3_mprintf(
218511 "SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
218512 "idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
218513 );
218514 if( zSql==0 ) rc = SQLITE_NOMEM;
218515 }else{
218516 int i;
218517 const char *zSep = "";
218518 SessionBuffer buf = {0, 0, 0};
218519
218520 sessionAppendStr(&buf, "SELECT * FROM ", &rc);
218521 sessionAppendIdent(&buf, zDb, &rc);
@@ -218532,15 +219302,19 @@
218532 }
218533 }
218534 zSql = (char*)buf.aBuf;
218535 nSql = buf.nBuf;
218536 }
 
218537
218538 if( rc==SQLITE_OK ){
218539 rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
218540 }
218541 sqlite3_free(zSql);
 
 
 
218542 return rc;
218543 }
218544
218545 /*
218546 ** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218696,11 +219470,12 @@
218696 sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
218697
218698 /* Build and compile a statement to execute: */
218699 if( rc==SQLITE_OK ){
218700 rc = sessionSelectStmt(
218701 db, pSession->zDb, zName, nCol, azCol, abPK, &pSel);
 
218702 }
218703
218704 nNoop = buf.nBuf;
218705 for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
218706 SessionChange *p; /* Used to iterate through changes */
@@ -219885,10 +220660,11 @@
219885 int bInvertConstraints; /* Invert when iterating constraints buffer */
219886 SessionBuffer constraints; /* Deferred constraints are stored here */
219887 SessionBuffer rebase; /* Rebase information (if any) here */
219888 u8 bRebaseStarted; /* If table header is already in rebase */
219889 u8 bRebase; /* True to collect rebase information */
 
219890 };
219891
219892 /* Number of prepared UPDATE statements to cache. */
219893 #define SESSION_UPDATE_CACHE_SZ 12
219894
@@ -220135,12 +220911,13 @@
220135 static int sessionSelectRow(
220136 sqlite3 *db, /* Database handle */
220137 const char *zTab, /* Table name */
220138 SessionApplyCtx *p /* Session changeset-apply context */
220139 ){
220140 return sessionSelectStmt(
220141 db, "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect);
 
220142 }
220143
220144 /*
220145 ** Formulate and prepare an INSERT statement to add a record to table zTab.
220146 ** For example:
@@ -220295,23 +221072,36 @@
220295 ** new.* record to the SELECT statement. Or, if it points to a DELETE or
220296 ** UPDATE, bind values from the old.* record.
220297 */
220298 static int sessionSeekToRow(
220299 sqlite3_changeset_iter *pIter, /* Changeset iterator */
220300 u8 *abPK, /* Primary key flags array */
220301 sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
220302 ){
 
220303 int rc; /* Return code */
220304 int nCol; /* Number of columns in table */
220305 int op; /* Changset operation (SQLITE_UPDATE etc.) */
220306 const char *zDummy; /* Unused */
220307
 
220308 sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
220309 rc = sessionBindRow(pIter,
220310 op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
220311 nCol, abPK, pSelect
220312 );
 
 
 
 
 
 
 
 
 
 
 
 
220313
220314 if( rc==SQLITE_OK ){
220315 rc = sqlite3_step(pSelect);
220316 if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
220317 }
@@ -220423,20 +221213,26 @@
220423 assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
220424 assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
220425
220426 /* Bind the new.* PRIMARY KEY values to the SELECT statement. */
220427 if( pbReplace ){
220428 rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
220429 }else{
220430 rc = SQLITE_OK;
220431 }
220432
220433 if( rc==SQLITE_ROW ){
220434 /* There exists another row with the new.* primary key. */
220435 pIter->pConflict = p->pSelect;
220436 res = xConflict(pCtx, eType, pIter);
220437 pIter->pConflict = 0;
 
 
 
 
 
 
220438 rc = sqlite3_reset(p->pSelect);
220439 }else if( rc==SQLITE_OK ){
220440 if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
220441 /* Instead of invoking the conflict handler, append the change blob
220442 ** to the SessionApplyCtx.constraints buffer. */
@@ -220540,11 +221336,11 @@
220540 }
220541 if( rc!=SQLITE_OK ) return rc;
220542
220543 sqlite3_step(p->pDelete);
220544 rc = sqlite3_reset(p->pDelete);
220545 if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){
220546 rc = sessionConflictHandler(
220547 SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
220548 );
220549 }else if( (rc&0xff)==SQLITE_CONSTRAINT ){
220550 rc = sessionConflictHandler(
@@ -220597,11 +221393,11 @@
220597 assert( op==SQLITE_INSERT );
220598 if( p->bStat1 ){
220599 /* Check if there is a conflicting row. For sqlite_stat1, this needs
220600 ** to be done using a SELECT, as there is no PRIMARY KEY in the
220601 ** database schema to throw an exception if a duplicate is inserted. */
220602 rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
220603 if( rc==SQLITE_ROW ){
220604 rc = SQLITE_CONSTRAINT;
220605 sqlite3_reset(p->pSelect);
220606 }
220607 }
@@ -220774,10 +221570,11 @@
220774
220775 pIter->in.bNoDiscard = 1;
220776 memset(&sApply, 0, sizeof(sApply));
220777 sApply.bRebase = (ppRebase && pnRebase);
220778 sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
 
220779 sqlite3_mutex_enter(sqlite3_db_mutex(db));
220780 if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
220781 rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
220782 }
220783 if( rc==SQLITE_OK ){
@@ -225030,11 +225827,11 @@
225030 UNUSED_PARAM2(pToken, nToken);
225031
225032 if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
225033 iPos = p->iPos++;
225034
225035 if( p->iRangeEnd>0 ){
225036 if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
225037 if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
225038 }
225039
225040 if( iPos==p->iter.iStart ){
@@ -225042,11 +225839,11 @@
225042 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225043 p->iOff = iStartOff;
225044 }
225045
225046 if( iPos==p->iter.iEnd ){
225047 if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){
225048 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225049 }
225050 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225051 fts5HighlightAppend(&rc, p, p->zClose, -1);
225052 p->iOff = iEndOff;
@@ -225053,11 +225850,11 @@
225053 if( rc==SQLITE_OK ){
225054 rc = fts5CInstIterNext(&p->iter);
225055 }
225056 }
225057
225058 if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
225059 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225060 p->iOff = iEndOff;
225061 if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225062 fts5HighlightAppend(&rc, p, p->zClose, -1);
225063 }
@@ -225088,10 +225885,11 @@
225088
225089 iCol = sqlite3_value_int(apVal[0]);
225090 memset(&ctx, 0, sizeof(HighlightContext));
225091 ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225092 ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
 
225093 rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225094
225095 if( ctx.zIn ){
225096 if( rc==SQLITE_OK ){
225097 rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225273,10 +226071,11 @@
225273 nCol = pApi->xColumnCount(pFts);
225274 memset(&ctx, 0, sizeof(HighlightContext));
225275 iCol = sqlite3_value_int(apVal[0]);
225276 ctx.zOpen = fts5ValueToText(apVal[1]);
225277 ctx.zClose = fts5ValueToText(apVal[2]);
 
225278 zEllips = fts5ValueToText(apVal[3]);
225279 nToken = sqlite3_value_int(apVal[4]);
225280
225281 iBestCol = (iCol>=0 ? iCol : 0);
225282 nPhrase = pApi->xPhraseCount(pFts);
@@ -240222,11 +241021,11 @@
240222 int nArg, /* Number of args */
240223 sqlite3_value **apUnused /* Function arguments */
240224 ){
240225 assert( nArg==0 );
240226 UNUSED_PARAM2(nArg, apUnused);
240227 sqlite3_result_text(pCtx, "fts5: 2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730", -1, SQLITE_TRANSIENT);
240228 }
240229
240230 /*
240231 ** Return true if zName is the extension on one of the shadow tables used
240232 ** by this module.
240233
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.42.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.42.0"
456 #define SQLITE_VERSION_NUMBER 3042000
457 #define SQLITE_SOURCE_ID "2023-04-10 18:44:00 4c5a3c5fb351cc1c2ce16c33314ce19c53531f09263f87456283d9d756002f9d"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -1959,23 +1959,26 @@
1959 **
1960 ** <b>The sqlite3_config() interface is not threadsafe. The application
1961 ** must ensure that no other SQLite interfaces are invoked by other
1962 ** threads while sqlite3_config() is running.</b>
1963 **
 
 
 
 
 
 
 
 
1964 ** The first argument to sqlite3_config() is an integer
1965 ** [configuration option] that determines
1966 ** what property of SQLite is to be configured. Subsequent arguments
1967 ** vary depending on the [configuration option]
1968 ** in the first argument.
1969 **
1970 ** For most configuration options, the sqlite3_config() interface
1971 ** may only be invoked prior to library initialization using
1972 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1973 ** The exceptional configuration options that may be invoked at any time
1974 ** are called "anytime configuration options".
1975 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1976 ** [sqlite3_shutdown()] with a first argument that is not an anytime
1977 ** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1978 ** Note, however, that ^sqlite3_config() can be called as part of the
1979 ** implementation of an application-defined [sqlite3_os_init()].
1980 **
1981 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1982 ** ^If the option is unknown or SQLite is unable to set the option
1983 ** then this routine returns a non-zero [error code].
1984 */
@@ -2079,10 +2082,27 @@
2082 ** CAPI3REF: Configuration Options
2083 ** KEYWORDS: {configuration option}
2084 **
2085 ** These constants are the available integer configuration options that
2086 ** can be passed as the first argument to the [sqlite3_config()] interface.
2087 **
2088 ** Most of the configuration options for sqlite3_config()
2089 ** will only work if invoked prior to [sqlite3_initialize()] or after
2090 ** [sqlite3_shutdown()]. The few exceptions to this rule are called
2091 ** "anytime configuration options".
2092 ** ^Calling [sqlite3_config()] with a first argument that is not an
2093 ** anytime configuration option in between calls to [sqlite3_initialize()] and
2094 ** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
2095 **
2096 ** The set of anytime configuration options can change (by insertions
2097 ** and/or deletions) from one release of SQLite to the next.
2098 ** As of SQLite version 3.42.0, the complete set of anytime configuration
2099 ** options is:
2100 ** <ul>
2101 ** <li> SQLITE_CONFIG_LOG
2102 ** <li> SQLITE_CONFIG_PCACHE_HDRSZ
2103 ** </ul>
2104 **
2105 ** New configuration options may be added in future releases of SQLite.
2106 ** Existing configuration options might be discontinued. Applications
2107 ** should check the return code from [sqlite3_config()] to make sure that
2108 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2740,10 +2760,30 @@
2760 ** the [VACUUM] command will fail with an obscure error when attempting to
2761 ** process a table with generated columns and a descending index. This is
2762 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2763 ** either generated columns or decending indexes.
2764 ** </dd>
2765 **
2766 ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2767 ** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2768 ** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2769 ** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2770 ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2771 ** statistics. For statistics to be collected, the flag must be set on
2772 ** the database handle both when the SQL statement is prepared and when it
2773 ** is stepped. The flag is set (collection of statistics is enabled)
2774 ** by default.</dd>
2775 **
2776 ** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2777 ** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2778 ** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2779 ** in which tables and indexes are scanned so that the scans start at the end
2780 ** and work toward the beginning rather than starting at the beginning and
2781 ** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2782 ** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2783 ** is useful for application testing.</dd>
2784 **
2785 ** </dl>
2786 */
2787 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2788 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2789 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2760,11 +2800,13 @@
2800 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2801 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2802 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2803 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2804 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2805 #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
2806 #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2807 #define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
2808
2809 /*
2810 ** CAPI3REF: Enable Or Disable Extended Result Codes
2811 ** METHOD: sqlite3
2812 **
@@ -9868,22 +9910,32 @@
9910 ** </dd>
9911 **
9912 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
9913 ** <dd>Calls of the form
9914 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9915 ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9916 ** identify that virtual table as being safe to use from within triggers
9917 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
9918 ** virtual table can do no serious harm even if it is controlled by a
9919 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
9920 ** flag unless absolutely necessary.
9921 ** </dd>
9922 **
9923 ** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt>
9924 ** <dd>Calls of the form
9925 ** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
9926 ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9927 ** instruct the query planner to begin at least a read transaction on
9928 ** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the
9929 ** virtual table is used.
9930 ** </dd>
9931 ** </dl>
9932 */
9933 #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
9934 #define SQLITE_VTAB_INNOCUOUS 2
9935 #define SQLITE_VTAB_DIRECTONLY 3
9936 #define SQLITE_VTAB_USES_ALL_SCHEMAS 4
9937
9938 /*
9939 ** CAPI3REF: Determine The Virtual Table Conflict Policy
9940 **
9941 ** This function may only be called from within a call to the [xUpdate] method
@@ -12217,13 +12269,27 @@
12269 **
12270 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
12271 ** Invert the changeset before applying it. This is equivalent to inverting
12272 ** a changeset using sqlite3changeset_invert() before applying it. It is
12273 ** an error to specify this flag with a patchset.
12274 **
12275 ** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
12276 ** Do not invoke the conflict handler callback for any changes that
12277 ** would not actually modify the database even if they were applied.
12278 ** Specifically, this means that the conflict handler is not invoked
12279 ** for:
12280 ** <ul>
12281 ** <li>a delete change if the row being deleted cannot be found,
12282 ** <li>an update change if the modified fields are already set to
12283 ** their new values in the conflicting row, or
12284 ** <li>an insert change if all fields of the conflicting row match
12285 ** the row being inserted.
12286 ** </ul>
12287 */
12288 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
12289 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
12290 #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
12291
12292 /*
12293 ** CAPI3REF: Constants Passed To The Conflict Handler
12294 **
12295 ** Values that may be passed as the second argument to a conflict-handler.
@@ -13516,12 +13582,12 @@
13582 #pragma warn -csu /* Comparing signed and unsigned */
13583 #pragma warn -spa /* Suspicious pointer arithmetic */
13584 #endif
13585
13586 /*
13587 ** A few places in the code require atomic load/store of aligned
13588 ** integer values.
13589 */
13590 #ifndef __has_extension
13591 # define __has_extension(x) 0 /* compatibility with non-clang compilers */
13592 #endif
13593 #if GCC_VERSION>=4007000 || __has_extension(c_atomic)
@@ -13573,19 +13639,26 @@
13639 # define SQLITE_INT_TO_PTR(X) ((void*)(X))
13640 # define SQLITE_PTR_TO_INT(X) ((int)(X))
13641 #endif
13642
13643 /*
13644 ** Macros to hint to the compiler that a function should or should not be
13645 ** inlined.
13646 */
13647 #if defined(__GNUC__)
13648 # define SQLITE_NOINLINE __attribute__((noinline))
13649 # define SQLITE_INLINE __attribute__((always_inline)) inline
13650 #elif defined(_MSC_VER) && _MSC_VER>=1310
13651 # define SQLITE_NOINLINE __declspec(noinline)
13652 # define SQLITE_INLINE __forceinline
13653 #else
13654 # define SQLITE_NOINLINE
13655 # define SQLITE_INLINE
13656 #endif
13657 #if defined(SQLITE_COVERAGE_TEST)
13658 # undef SQLITE_INLINE
13659 # define SQLITE_INLINE
13660 #endif
13661
13662 /*
13663 ** Make sure that the compiler intrinsics we desire are enabled when
13664 ** compiling with an appropriate version of MSVC unless prevented by
@@ -16541,10 +16614,14 @@
16614 #endif
16615
16616 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
16617 SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*);
16618 #endif
16619
16620 #if defined(SQLITE_ENABLE_CURSOR_HINTS) && defined(SQLITE_DEBUG)
16621 SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr);
16622 #endif
16623
16624 #endif /* SQLITE_VDBE_H */
16625
16626 /************** End of vdbe.h ************************************************/
16627 /************** Continuing where we left off in sqliteInt.h ******************/
@@ -16590,11 +16667,11 @@
16667 /**********************************************************************
16668 ** Elements above, except pCache, are public. All that follow are
16669 ** private to pcache.c and should not be accessed by other modules.
16670 ** pCache is grouped with the public elements for efficiency.
16671 */
16672 i64 nRef; /* Number of users of this page */
16673 PgHdr *pDirtyNext; /* Next element in list of dirty pages */
16674 PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
16675 /* NB: pDirtyNext and pDirtyPrev are undefined if the
16676 ** PgHdr object is not dirty */
16677 };
@@ -16671,16 +16748,16 @@
16748
16749 /* Discard the contents of the cache */
16750 SQLITE_PRIVATE void sqlite3PcacheClear(PCache*);
16751
16752 /* Return the total number of outstanding page references */
16753 SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache*);
16754
16755 /* Increment the reference count of an existing page */
16756 SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);
16757
16758 SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr*);
16759
16760 /* Return the total number of pages stored in the cache */
16761 SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);
16762
16763 #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
@@ -17251,11 +17328,11 @@
17328 #define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
17329 ** vtabs in the schema definition */
17330 #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
17331 /* result set is empty */
17332 #define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
17333 #define SQLITE_StmtScanStatus 0x00000400 /* Enable stmt_scanstats() counters */
17334 #define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
17335 #define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
17336 #define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
17337 #define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
17338 #define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
@@ -17277,10 +17354,11 @@
17354 #define SQLITE_EnableView 0x80000000 /* Enable the use of views */
17355 #define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
17356 /* DELETE, or UPDATE and return */
17357 /* the count using a callback. */
17358 #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
17359 #define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
17360
17361 /* Flags used only if debugging */
17362 #ifdef SQLITE_DEBUG
17363 #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
17364 #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -17333,10 +17411,11 @@
17411 #define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */
17412 #define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
17413 /* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
17414 #define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
17415 #define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
17416 #define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */
17417 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
17418
17419 /*
17420 ** Macros for testing whether or not optimizations are enabled or disabled.
17421 */
@@ -17804,10 +17883,11 @@
17883 sqlite3 *db; /* Database connection associated with this table */
17884 Module *pMod; /* Pointer to module implementation */
17885 sqlite3_vtab *pVtab; /* Pointer to vtab instance */
17886 int nRef; /* Number of pointers to this structure */
17887 u8 bConstraint; /* True if constraints are supported */
17888 u8 bAllSchemas; /* True if might use any attached schema */
17889 u8 eVtabRisk; /* Riskiness of allowing hacker access */
17890 int iSavepoint; /* Depth of the SAVEPOINT stack */
17891 VTable *pNext; /* Next in linked list (see above) */
17892 };
17893
@@ -18835,11 +18915,11 @@
18915 #define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */
18916 #define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */
18917 #define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
18918 #define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
18919 #define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
18920 #define NC_Subquery 0x000040 /* A subquery has been seen */
18921 #define NC_UEList 0x000080 /* True if uNC.pEList is used */
18922 #define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
18923 #define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
18924 #define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */
18925 #define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */
@@ -19207,10 +19287,13 @@
19287 u8 prepFlags; /* SQLITE_PREPARE_* flags */
19288 u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
19289 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
19290 u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
19291 #endif
19292 #ifdef SQLITE_DEBUG
19293 u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
19294 #endif
19295 int nRangeReg; /* Size of the temporary register block */
19296 int iRangeReg; /* First register in temporary register block */
19297 int nErr; /* Number of errors seen */
19298 int nTab; /* Number of previously allocated VDBE cursors */
19299 int nMem; /* Number of memory cells used so far */
@@ -19667,10 +19750,11 @@
19750 struct RenameCtx *pRename; /* RENAME COLUMN context */
19751 struct Table *pTab; /* Table of generated column */
19752 struct CoveringIndexCheck *pCovIdxCk; /* Check for covering index */
19753 SrcItem *pSrcItem; /* A single FROM clause item */
19754 DbFixer *pFix; /* See sqlite3FixSelect() */
19755 Mem *aMem; /* See sqlite3BtreeCursorHint() */
19756 } u;
19757 };
19758
19759 /*
19760 ** The following structure contains information used by the sqliteFix...
@@ -20138,10 +20222,14 @@
20222 SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
20223 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
20224 SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
20225 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
20226 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
20227 SQLITE_PRIVATE void sqlite3TouchRegister(Parse*,int);
20228 #if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
20229 SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse*,int);
20230 #endif
20231 #ifdef SQLITE_DEBUG
20232 SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
20233 #endif
20234 SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
20235 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20288,11 +20376,11 @@
20376 SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
20377 SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
20378 Expr*,ExprList*,u32,Expr*);
20379 SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
20380 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20381 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*);
20382 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
20383 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
20384 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
20385 #endif
20386 SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -20825,14 +20913,11 @@
20913 SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
20914 SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
20915 SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *);
20916
20917 SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20918 SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse*);
 
 
 
20919 SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
20920 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
20921 SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
20922 SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*);
20923 SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*);
@@ -21074,10 +21159,16 @@
21159 #if defined(VDBE_PROFILE) \
21160 || defined(SQLITE_PERFORMANCE_TRACE) \
21161 || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
21162 SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
21163 #endif
21164
21165 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
21166 # define IS_STMT_SCANSTATUS(db) (db->flags & SQLITE_StmtScanStatus)
21167 #else
21168 # define IS_STMT_SCANSTATUS(db) 0
21169 #endif
21170
21171 #endif /* SQLITEINT_H */
21172
21173 /************** End of sqliteInt.h *******************************************/
21174 /************** Begin file os_common.h ***************************************/
@@ -22264,11 +22355,11 @@
22355 0, /* xAltLocaltime */
22356 0x7ffffffe, /* iOnceResetThreshold */
22357 SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
22358 0, /* iPrngSeed */
22359 #ifdef SQLITE_DEBUG
22360 {0,0,0,0,0,0}, /* aTune */
22361 #endif
22362 };
22363
22364 /*
22365 ** Hash table for global functions - functions common to all
@@ -30069,10 +30160,24 @@
30160 *val = (*val - d)*10.0;
30161 return (char)digit;
30162 }
30163 #endif /* SQLITE_OMIT_FLOATING_POINT */
30164
30165 #ifndef SQLITE_OMIT_FLOATING_POINT
30166 /*
30167 ** "*val" is a u64. *msd is a divisor used to extract the
30168 ** most significant digit of *val. Extract that most significant
30169 ** digit and return it.
30170 */
30171 static char et_getdigit_int(u64 *val, u64 *msd){
30172 u64 x = (*val)/(*msd);
30173 *val -= x*(*msd);
30174 if( *msd>=10 ) *msd /= 10;
30175 return '0' + (char)(x & 15);
30176 }
30177 #endif /* SQLITE_OMIT_FLOATING_POINT */
30178
30179 /*
30180 ** Set the StrAccum object to an error mode.
30181 */
30182 SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
30183 assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30161,10 +30266,12 @@
30266 etByte xtype = etINVALID; /* Conversion paradigm */
30267 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
30268 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
30269 sqlite_uint64 longvalue; /* Value for integer types */
30270 LONGDOUBLE_TYPE realvalue; /* Value for real types */
30271 sqlite_uint64 msd; /* Divisor to get most-significant-digit
30272 ** of longvalue */
30273 const et_info *infop; /* Pointer to the appropriate info structure */
30274 char *zOut; /* Rendering buffer */
30275 int nOut; /* Size of the rendering buffer */
30276 char *zExtra = 0; /* Malloced memory used by some conversion */
30277 #ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30467,56 +30574,82 @@
30574 realvalue = -realvalue;
30575 prefix = '-';
30576 }else{
30577 prefix = flag_prefix;
30578 }
30579 exp = 0;
30580 if( xtype==etGENERIC && precision>0 ) precision--;
30581 testcase( precision>0xfff );
30582 if( realvalue<1.0e+16
30583 && realvalue==(LONGDOUBLE_TYPE)(longvalue = (u64)realvalue)
30584 ){
30585 /* Number is a pure integer that can be represented as u64 */
30586 for(msd=1; msd*10<=longvalue; msd *= 10, exp++){}
30587 if( exp>precision && xtype!=etFLOAT ){
30588 u64 rnd = msd/2;
30589 int kk = precision;
30590 while( kk-- > 0 ){ rnd /= 10; }
30591 longvalue += rnd;
30592 }
30593 }else{
30594 msd = 0;
30595 longvalue = 0; /* To prevent a compiler warning */
30596 idx = precision & 0xfff;
30597 rounder = arRound[idx%10];
30598 while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30599 if( xtype==etFLOAT ){
30600 double rx = (double)realvalue;
30601 sqlite3_uint64 u;
30602 int ex;
30603 memcpy(&u, &rx, sizeof(u));
30604 ex = -1023 + (int)((u>>52)&0x7ff);
30605 if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30606 realvalue += rounder;
30607 }
30608 if( sqlite3IsNaN((double)realvalue) ){
30609 if( flag_zeropad ){
30610 bufpt = "null";
30611 length = 4;
30612 }else{
30613 bufpt = "NaN";
30614 length = 3;
30615 }
30616 break;
30617 }
30618
30619 /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30620 if( ALWAYS(realvalue>0.0) ){
30621 LONGDOUBLE_TYPE scale = 1.0;
30622 while( realvalue>=1e100*scale && exp<=350){ scale*=1e100;exp+=100;}
30623 while( realvalue>=1e10*scale && exp<=350 ){ scale*=1e10; exp+=10; }
30624 while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30625 realvalue /= scale;
30626 while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30627 while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30628 if( exp>350 ){
30629 if( flag_zeropad ){
30630 realvalue = 9.0;
30631 exp = 999;
30632 }else{
30633 bufpt = buf;
30634 buf[0] = prefix;
30635 memcpy(buf+(prefix!=0),"Inf",4);
30636 length = 3+(prefix!=0);
30637 break;
30638 }
30639 }
30640 if( xtype!=etFLOAT ){
30641 realvalue += rounder;
30642 if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30643 }
30644 }
30645 }
30646
30647 /*
30648 ** If the field type is etGENERIC, then convert to either etEXP
30649 ** or etFLOAT, as appropriate.
30650 */
 
 
 
 
30651 if( xtype==etGENERIC ){
30652 flag_rtz = !flag_alternateform;
30653 if( exp<-4 || exp>precision ){
30654 xtype = etEXP;
30655 }else{
@@ -30529,28 +30662,33 @@
30662 if( xtype==etEXP ){
30663 e2 = 0;
30664 }else{
30665 e2 = exp;
30666 }
30667 nsd = 16 + flag_altform2*10;
30668 bufpt = buf;
30669 {
30670 i64 szBufNeeded; /* Size of a temporary buffer needed */
30671 szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30672 if( szBufNeeded > etBUFSIZE ){
30673 bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
30674 if( bufpt==0 ) return;
30675 }
30676 }
30677 zOut = bufpt;
 
30678 flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
30679 /* The sign in front of the number */
30680 if( prefix ){
30681 *(bufpt++) = prefix;
30682 }
30683 /* Digits prior to the decimal point */
30684 if( e2<0 ){
30685 *(bufpt++) = '0';
30686 }else if( msd>0 ){
30687 for(; e2>=0; e2--){
30688 *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30689 }
30690 }else{
30691 for(; e2>=0; e2--){
30692 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30693 }
30694 }
@@ -30563,12 +30701,18 @@
30701 for(e2++; e2<0; precision--, e2++){
30702 assert( precision>0 );
30703 *(bufpt++) = '0';
30704 }
30705 /* Significant digits after the decimal point */
30706 if( msd>0 ){
30707 while( (precision--)>0 ){
30708 *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30709 }
30710 }else{
30711 while( (precision--)>0 ){
30712 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30713 }
30714 }
30715 /* Remove trailing zeros and the "." if no digits follow the "." */
30716 if( flag_rtz && flag_dp ){
30717 while( bufpt[-1]=='0' ) *(--bufpt) = 0;
30718 assert( bufpt>zOut );
@@ -31245,16 +31389,26 @@
31389 sqlite3_str_vappendf(&acc, zFormat, ap);
31390 zBuf[acc.nChar] = 0;
31391 return zBuf;
31392 }
31393 SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31394 StrAccum acc;
31395 va_list ap;
31396 if( n<=0 ) return zBuf;
31397 #ifdef SQLITE_ENABLE_API_ARMOR
31398 if( zBuf==0 || zFormat==0 ) {
31399 (void)SQLITE_MISUSE_BKPT;
31400 if( zBuf ) zBuf[0] = 0;
31401 return zBuf;
31402 }
31403 #endif
31404 sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
31405 va_start(ap,zFormat);
31406 sqlite3_str_vappendf(&acc, zFormat, ap);
31407 va_end(ap);
31408 zBuf[acc.nChar] = 0;
31409 return zBuf;
31410 }
31411
31412 /*
31413 ** This is the routine that actually formats the sqlite3_log() message.
31414 ** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52652,11 +52806,11 @@
52806 ** pointers).
52807 */
52808 struct PCache {
52809 PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
52810 PgHdr *pSynced; /* Last synced page in dirty page list */
52811 i64 nRefSum; /* Sum of ref counts over all pages */
52812 int szCache; /* Configured cache size */
52813 int szSpill; /* Size before spilling occurs */
52814 int szPage; /* Size of every page in this cache */
52815 int szExtra; /* Size of extra space for each page */
52816 u8 bPurgeable; /* True if pages are on backing store */
@@ -52682,11 +52836,11 @@
52836 static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
52837 PgHdr *pPg;
52838 unsigned char *a;
52839 int j;
52840 pPg = (PgHdr*)pLower->pExtra;
52841 printf("%3lld: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52842 a = (unsigned char *)pLower->pBuf;
52843 for(j=0; j<12; j++) printf("%02x", a[j]);
52844 printf(" ptr %p\n", pPg);
52845 }
52846 static void pcacheDump(PCache *pCache){
@@ -53426,18 +53580,18 @@
53580 ** Return the total number of references to all pages held by the cache.
53581 **
53582 ** This is not the total number of pages referenced, but the sum of the
53583 ** reference count for all pages.
53584 */
53585 SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache *pCache){
53586 return pCache->nRefSum;
53587 }
53588
53589 /*
53590 ** Return the number of references to the page supplied as an argument.
53591 */
53592 SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr *p){
53593 return p->nRef;
53594 }
53595
53596 /*
53597 ** Return the total number of pages in the cache.
@@ -68091,12 +68245,13 @@
68245 int mxErr; /* Stop accumulating errors when this reaches zero */
68246 int nErr; /* Number of messages written to zErrMsg so far */
68247 int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
68248 u32 nStep; /* Number of steps into the integrity_check process */
68249 const char *zPfx; /* Error message prefix */
68250 Pgno v0; /* Value for first %u substitution in zPfx (root page) */
68251 Pgno v1; /* Value for second %u substitution in zPfx (current pg) */
68252 int v2; /* Value for third %d substitution in zPfx */
68253 StrAccum errMsg; /* Accumulate the error message text here */
68254 u32 *heap; /* Min-heap used for analyzing cell coverage */
68255 sqlite3 *db; /* Database connection running the check */
68256 };
68257
@@ -68555,12 +68710,12 @@
68710 */
68711 #ifdef SQLITE_DEBUG
68712 int corruptPageError(int lineno, MemPage *p){
68713 char *zMsg;
68714 sqlite3BeginBenignMalloc();
68715 zMsg = sqlite3_mprintf("database corruption page %u of %s",
68716 p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
68717 );
68718 sqlite3EndBenignMalloc();
68719 if( zMsg ){
68720 sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
68721 }
@@ -69365,12 +69520,29 @@
69520 ** and number of the varargs parameters) is determined by the eHintType
69521 ** parameter. See the definitions of the BTREE_HINT_* macros for details.
69522 */
69523 SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){
69524 /* Used only by system that substitute their own storage engine */
69525 #ifdef SQLITE_DEBUG
69526 if( ALWAYS(eHintType==BTREE_HINT_RANGE) ){
69527 va_list ap;
69528 Expr *pExpr;
69529 Walker w;
69530 memset(&w, 0, sizeof(w));
69531 w.xExprCallback = sqlite3CursorRangeHintExprCheck;
69532 va_start(ap, eHintType);
69533 pExpr = va_arg(ap, Expr*);
69534 w.u.aMem = va_arg(ap, Mem*);
69535 va_end(ap);
69536 assert( pExpr!=0 );
69537 assert( w.u.aMem!=0 );
69538 sqlite3WalkExpr(&w, pExpr);
69539 }
69540 #endif /* SQLITE_DEBUG */
69541 }
69542 #endif /* SQLITE_ENABLE_CURSOR_HINTS */
69543
69544
69545 /*
69546 ** Provide flag hints to the cursor.
69547 */
69548 SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){
@@ -69451,11 +69623,11 @@
69623 }
69624 assert( offset <= (int)pBt->usableSize-5 );
69625 pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
69626
69627 if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69628 TRACE(("PTRMAP_UPDATE: %u->(%u,%u)\n", key, eType, parent));
69629 *pRC= rc = sqlite3PagerWrite(pDbPage);
69630 if( rc==SQLITE_OK ){
69631 pPtrmap[offset] = eType;
69632 put4byte(&pPtrmap[offset+1], parent);
69633 }
@@ -69650,31 +69822,35 @@
69822 ** This routine is a high-runner.
69823 */
69824 iKey = *pIter;
69825 if( iKey>=0x80 ){
69826 u8 x;
69827 iKey = (iKey<<7) ^ (x = *++pIter);
69828 if( x>=0x80 ){
69829 iKey = (iKey<<7) ^ (x = *++pIter);
69830 if( x>=0x80 ){
69831 iKey = (iKey<<7) ^ 0x10204000 ^ (x = *++pIter);
69832 if( x>=0x80 ){
69833 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69834 if( x>=0x80 ){
69835 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69836 if( x>=0x80 ){
69837 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69838 if( x>=0x80 ){
69839 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69840 if( x>=0x80 ){
69841 iKey = (iKey<<8) ^ 0x8000 ^ (*++pIter);
69842 }
69843 }
69844 }
69845 }
69846 }
69847 }else{
69848 iKey ^= 0x204000;
69849 }
69850 }else{
69851 iKey ^= 0x4000;
69852 }
69853 }
69854 pIter++;
69855
69856 pInfo->nKey = *(i64*)&iKey;
@@ -69747,14 +69923,57 @@
69923 ** data header and the local payload, but not any overflow page or
69924 ** the space used by the cell pointer.
69925 **
69926 ** cellSizePtrNoPayload() => table internal nodes
69927 ** cellSizePtrTableLeaf() => table leaf nodes
69928 ** cellSizePtr() => index internal nodes
69929 ** cellSizeIdxLeaf() => index leaf nodes
69930 */
69931 static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69932 u8 *pIter = pCell + 4; /* For looping over bytes of pCell */
69933 u8 *pEnd; /* End mark for a varint */
69934 u32 nSize; /* Size value to return */
69935
69936 #ifdef SQLITE_DEBUG
69937 /* The value returned by this function should always be the same as
69938 ** the (CellInfo.nSize) value found by doing a full parse of the
69939 ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
69940 ** this function verifies that this invariant is not violated. */
69941 CellInfo debuginfo;
69942 pPage->xParseCell(pPage, pCell, &debuginfo);
69943 #endif
69944
69945 assert( pPage->childPtrSize==4 );
69946 nSize = *pIter;
69947 if( nSize>=0x80 ){
69948 pEnd = &pIter[8];
69949 nSize &= 0x7f;
69950 do{
69951 nSize = (nSize<<7) | (*++pIter & 0x7f);
69952 }while( *(pIter)>=0x80 && pIter<pEnd );
69953 }
69954 pIter++;
69955 testcase( nSize==pPage->maxLocal );
69956 testcase( nSize==(u32)pPage->maxLocal+1 );
69957 if( nSize<=pPage->maxLocal ){
69958 nSize += (u32)(pIter - pCell);
69959 assert( nSize>4 );
69960 }else{
69961 int minLocal = pPage->minLocal;
69962 nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
69963 testcase( nSize==pPage->maxLocal );
69964 testcase( nSize==(u32)pPage->maxLocal+1 );
69965 if( nSize>pPage->maxLocal ){
69966 nSize = minLocal;
69967 }
69968 nSize += 4 + (u16)(pIter - pCell);
69969 }
69970 assert( nSize==debuginfo.nSize || CORRUPT_DB );
69971 return (u16)nSize;
69972 }
69973 static u16 cellSizePtrIdxLeaf(MemPage *pPage, u8 *pCell){
69974 u8 *pIter = pCell; /* For looping over bytes of pCell */
69975 u8 *pEnd; /* End mark for a varint */
69976 u32 nSize; /* Size value to return */
69977
69978 #ifdef SQLITE_DEBUG
69979 /* The value returned by this function should always be the same as
@@ -69763,10 +69982,11 @@
69982 ** this function verifies that this invariant is not violated. */
69983 CellInfo debuginfo;
69984 pPage->xParseCell(pPage, pCell, &debuginfo);
69985 #endif
69986
69987 assert( pPage->childPtrSize==0 );
69988 nSize = *pIter;
69989 if( nSize>=0x80 ){
69990 pEnd = &pIter[8];
69991 nSize &= 0x7f;
69992 do{
@@ -69999,14 +70219,14 @@
70219 testcase( pc==iCellFirst );
70220 testcase( pc==iCellLast );
70221 /* These conditions have already been verified in btreeInitPage()
70222 ** if PRAGMA cell_size_check=ON.
70223 */
70224 if( pc>iCellLast ){
70225 return SQLITE_CORRUPT_PAGE(pPage);
70226 }
70227 assert( pc>=0 && pc<=iCellLast );
70228 size = pPage->xCellSize(pPage, &src[pc]);
70229 cbrk -= size;
70230 if( cbrk<iCellStart || pc+size>usableSize ){
70231 return SQLITE_CORRUPT_PAGE(pPage);
70232 }
@@ -70117,11 +70337,11 @@
70337 ** all the space together, however. This routine will avoid using
70338 ** the first two bytes past the cell pointer area since presumably this
70339 ** allocation is being made in order to insert a new cell, so we will
70340 ** also end up needing a new cell pointer.
70341 */
70342 static SQLITE_INLINE int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
70343 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
70344 u8 * const data = pPage->aData; /* Local cache of pPage->aData */
70345 int top; /* First byte of cell content area */
70346 int rc = SQLITE_OK; /* Integer return code */
70347 u8 *pTmp; /* Temp ptr into data[] */
@@ -70143,17 +70363,18 @@
70363 ** then the cell content offset of an empty page wants to be 65536.
70364 ** However, that integer is too large to be stored in a 2-byte unsigned
70365 ** integer, so a value of 0 is used in its place. */
70366 pTmp = &data[hdr+5];
70367 top = get2byte(pTmp);
 
70368 if( gap>top ){
70369 if( top==0 && pPage->pBt->usableSize==65536 ){
70370 top = 65536;
70371 }else{
70372 return SQLITE_CORRUPT_PAGE(pPage);
70373 }
70374 }else if( top>(int)pPage->pBt->usableSize ){
70375 return SQLITE_CORRUPT_PAGE(pPage);
70376 }
70377
70378 /* If there is enough space between gap and top for one more cell pointer,
70379 ** and if the freelist is not empty, then search the
70380 ** freelist looking for a slot big enough to satisfy the request.
@@ -70232,11 +70453,11 @@
70453 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
70454 assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
70455 assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
70456 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
70457 assert( iSize>=4 ); /* Minimum cell size is 4 */
70458 assert( CORRUPT_DB || iStart<=pPage->pBt->usableSize-4 );
70459
70460 /* The list of freeblocks must be in ascending order. Find the
70461 ** spot on the list where iStart should be inserted.
70462 */
70463 hdr = pPage->hdrOffset;
@@ -70289,10 +70510,15 @@
70510 if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
70511 data[hdr+7] -= nFrag;
70512 }
70513 pTmp = &data[hdr+5];
70514 x = get2byte(pTmp);
70515 if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
70516 /* Overwrite deleted information with zeros when the secure_delete
70517 ** option is enabled */
70518 memset(&data[iStart], 0, iSize);
70519 }
70520 if( iStart<=x ){
70521 /* The new freeblock is at the beginning of the cell content area,
70522 ** so just extend the cell content area rather than create another
70523 ** freelist entry */
70524 if( iStart<x ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -70300,18 +70526,13 @@
70526 put2byte(&data[hdr+1], iFreeBlk);
70527 put2byte(&data[hdr+5], iEnd);
70528 }else{
70529 /* Insert the new freeblock into the freelist */
70530 put2byte(&data[iPtr], iStart);
70531 put2byte(&data[iStart], iFreeBlk);
70532 put2byte(&data[iStart+2], iSize);
70533 }
 
 
 
 
 
70534 pPage->nFree += iOrigSize;
70535 return SQLITE_OK;
70536 }
70537
70538 /*
@@ -70344,18 +70565,18 @@
70565 pPage->maxLocal = pBt->maxLeaf;
70566 pPage->minLocal = pBt->minLeaf;
70567 }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
70568 pPage->intKey = 0;
70569 pPage->intKeyLeaf = 0;
70570 pPage->xCellSize = cellSizePtrIdxLeaf;
70571 pPage->xParseCell = btreeParseCellPtrIndex;
70572 pPage->maxLocal = pBt->maxLocal;
70573 pPage->minLocal = pBt->minLocal;
70574 }else{
70575 pPage->intKey = 0;
70576 pPage->intKeyLeaf = 0;
70577 pPage->xCellSize = cellSizePtrIdxLeaf;
70578 pPage->xParseCell = btreeParseCellPtrIndex;
70579 return SQLITE_CORRUPT_PAGE(pPage);
70580 }
70581 }else{
70582 pPage->childPtrSize = 4;
@@ -72217,11 +72438,11 @@
72438 assert( sqlite3_mutex_held(pBt->mutex) );
72439 assert( pDbPage->pBt==pBt );
72440 if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
72441
72442 /* Move page iDbPage from its current location to page number iFreePage */
72443 TRACE(("AUTOVACUUM: Moving %u to free page %u (ptr page %u type %u)\n",
72444 iDbPage, iFreePage, iPtrPage, eType));
72445 rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
72446 if( rc!=SQLITE_OK ){
72447 return rc;
72448 }
@@ -74503,11 +74724,12 @@
74724 }
74725 }
74726
74727 pPage = pCur->pPage;
74728 idx = ++pCur->ix;
74729 if( sqlite3FaultSim(412) ) pPage->isInit = 0;
74730 if( !pPage->isInit ){
74731 return SQLITE_CORRUPT_BKPT;
74732 }
74733
74734 if( idx>=pPage->nCell ){
74735 if( !pPage->leaf ){
@@ -74766,11 +74988,11 @@
74988 }
74989 *pPgno = iTrunk;
74990 memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
74991 *ppPage = pTrunk;
74992 pTrunk = 0;
74993 TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
74994 }else if( k>(u32)(pBt->usableSize/4 - 2) ){
74995 /* Value of k is out of range. Database corruption */
74996 rc = SQLITE_CORRUPT_PGNO(iTrunk);
74997 goto end_allocate_page;
74998 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74832,11 +75054,11 @@
75054 }
75055 put4byte(&pPrevTrunk->aData[0], iNewTrunk);
75056 }
75057 }
75058 pTrunk = 0;
75059 TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
75060 #endif
75061 }else if( k>0 ){
75062 /* Extract a leaf from the trunk */
75063 u32 closest;
75064 Pgno iPage;
@@ -74877,12 +75099,12 @@
75099 if( !searchList
75100 || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
75101 ){
75102 int noContent;
75103 *pPgno = iPage;
75104 TRACE(("ALLOCATE: %u was leaf %u of %u on trunk %u"
75105 ": %u more free pages\n",
75106 *pPgno, closest+1, k, pTrunk->pgno, n-1));
75107 rc = sqlite3PagerWrite(pTrunk->pDbPage);
75108 if( rc ) goto end_allocate_page;
75109 if( closest<k-1 ){
75110 memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74934,11 +75156,11 @@
75156 /* If *pPgno refers to a pointer-map page, allocate two new pages
75157 ** at the end of the file instead of one. The first allocated page
75158 ** becomes a new pointer-map page, the second is used by the caller.
75159 */
75160 MemPage *pPg = 0;
75161 TRACE(("ALLOCATE: %u from end of file (pointer-map page)\n", pBt->nPage));
75162 assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
75163 rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
75164 if( rc==SQLITE_OK ){
75165 rc = sqlite3PagerWrite(pPg->pDbPage);
75166 releasePage(pPg);
@@ -74957,11 +75179,11 @@
75179 rc = sqlite3PagerWrite((*ppPage)->pDbPage);
75180 if( rc!=SQLITE_OK ){
75181 releasePage(*ppPage);
75182 *ppPage = 0;
75183 }
75184 TRACE(("ALLOCATE: %u from end of file\n", *pPgno));
75185 }
75186
75187 assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
75188
75189 end_allocate_page:
@@ -75085,11 +75307,11 @@
75307 if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
75308 sqlite3PagerDontWrite(pPage->pDbPage);
75309 }
75310 rc = btreeSetHasContent(pBt, iPage);
75311 }
75312 TRACE(("FREE-PAGE: %u leaf on trunk page %u\n",pPage->pgno,pTrunk->pgno));
75313 goto freepage_out;
75314 }
75315 }
75316
75317 /* If control flows to this point, then it was not possible to add the
@@ -75106,11 +75328,11 @@
75328 goto freepage_out;
75329 }
75330 put4byte(pPage->aData, iTrunk);
75331 put4byte(&pPage->aData[4], 0);
75332 put4byte(&pPage1->aData[32], iPage);
75333 TRACE(("FREE-PAGE: %u new trunk page replacing %u\n", pPage->pgno, iTrunk));
75334
75335 freepage_out:
75336 if( pPage ){
75337 pPage->isInit = 0;
75338 }
@@ -75465,10 +75687,18 @@
75687 ** pTemp is not null. Regardless of pTemp, allocate a new entry
75688 ** in pPage->apOvfl[] and make it point to the cell content (either
75689 ** in pTemp or the original pCell) and also record its index.
75690 ** Allocating a new entry in pPage->aCell[] implies that
75691 ** pPage->nOverflow is incremented.
75692 **
75693 ** The insertCellFast() routine below works exactly the same as
75694 ** insertCell() except that it lacks the pTemp and iChild parameters
75695 ** which are assumed zero. Other than that, the two routines are the
75696 ** same.
75697 **
75698 ** Fixes or enhancements to this routine should be reflected in
75699 ** insertCellFast()!
75700 */
75701 static int insertCell(
75702 MemPage *pPage, /* Page into which we are copying */
75703 int i, /* New cell becomes the i-th cell of the page */
75704 u8 *pCell, /* Content of the new cell */
@@ -75487,18 +75717,107 @@
75717 assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
75718 assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
75719 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
75720 assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
75721 assert( pPage->nFree>=0 );
75722 assert( iChild>0 );
75723 if( pPage->nOverflow || sz+2>pPage->nFree ){
75724 if( pTemp ){
75725 memcpy(pTemp, pCell, sz);
75726 pCell = pTemp;
75727 }
75728 put4byte(pCell, iChild);
75729 j = pPage->nOverflow++;
75730 /* Comparison against ArraySize-1 since we hold back one extra slot
75731 ** as a contingency. In other words, never need more than 3 overflow
75732 ** slots but 4 are allocated, just to be safe. */
75733 assert( j < ArraySize(pPage->apOvfl)-1 );
75734 pPage->apOvfl[j] = pCell;
75735 pPage->aiOvfl[j] = (u16)i;
75736
75737 /* When multiple overflows occur, they are always sequential and in
75738 ** sorted order. This invariants arise because multiple overflows can
75739 ** only occur when inserting divider cells into the parent page during
75740 ** balancing, and the dividers are adjacent and sorted.
75741 */
75742 assert( j==0 || pPage->aiOvfl[j-1]<(u16)i ); /* Overflows in sorted order */
75743 assert( j==0 || i==pPage->aiOvfl[j-1]+1 ); /* Overflows are sequential */
75744 }else{
75745 int rc = sqlite3PagerWrite(pPage->pDbPage);
75746 if( NEVER(rc!=SQLITE_OK) ){
75747 return rc;
75748 }
75749 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
75750 data = pPage->aData;
75751 assert( &data[pPage->cellOffset]==pPage->aCellIdx );
75752 rc = allocateSpace(pPage, sz, &idx);
75753 if( rc ){ return rc; }
75754 /* The allocateSpace() routine guarantees the following properties
75755 ** if it returns successfully */
75756 assert( idx >= 0 );
75757 assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
75758 assert( idx+sz <= (int)pPage->pBt->usableSize );
75759 pPage->nFree -= (u16)(2 + sz);
75760 /* In a corrupt database where an entry in the cell index section of
75761 ** a btree page has a value of 3 or less, the pCell value might point
75762 ** as many as 4 bytes in front of the start of the aData buffer for
75763 ** the source page. Make sure this does not cause problems by not
75764 ** reading the first 4 bytes */
75765 memcpy(&data[idx+4], pCell+4, sz-4);
75766 put4byte(&data[idx], iChild);
75767 pIns = pPage->aCellIdx + i*2;
75768 memmove(pIns+2, pIns, 2*(pPage->nCell - i));
75769 put2byte(pIns, idx);
75770 pPage->nCell++;
75771 /* increment the cell count */
75772 if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
75773 assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB );
75774 #ifndef SQLITE_OMIT_AUTOVACUUM
75775 if( pPage->pBt->autoVacuum ){
75776 int rc2 = SQLITE_OK;
75777 /* The cell may contain a pointer to an overflow page. If so, write
75778 ** the entry for the overflow page into the pointer map.
75779 */
75780 ptrmapPutOvflPtr(pPage, pPage, pCell, &rc2);
75781 if( rc2 ) return rc2;
75782 }
75783 #endif
75784 }
75785 return SQLITE_OK;
75786 }
75787
75788 /*
75789 ** This variant of insertCell() assumes that the pTemp and iChild
75790 ** parameters are both zero. Use this variant in sqlite3BtreeInsert()
75791 ** for performance improvement, and also so that this variant is only
75792 ** called from that one place, and is thus inlined, and thus runs must
75793 ** faster.
75794 **
75795 ** Fixes or enhancements to this routine should be reflected into
75796 ** the insertCell() routine.
75797 */
75798 static int insertCellFast(
75799 MemPage *pPage, /* Page into which we are copying */
75800 int i, /* New cell becomes the i-th cell of the page */
75801 u8 *pCell, /* Content of the new cell */
75802 int sz /* Bytes of content in pCell */
75803 ){
75804 int idx = 0; /* Where to write new cell content in data[] */
75805 int j; /* Loop counter */
75806 u8 *data; /* The content of the whole page */
75807 u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */
75808
75809 assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
75810 assert( MX_CELL(pPage->pBt)<=10921 );
75811 assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB );
75812 assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
75813 assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
75814 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
75815 assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
75816 assert( pPage->nFree>=0 );
75817 assert( pPage->nOverflow==0 );
75818 if( sz+2>pPage->nFree ){
75819 j = pPage->nOverflow++;
75820 /* Comparison against ArraySize-1 since we hold back one extra slot
75821 ** as a contingency. In other words, never need more than 3 overflow
75822 ** slots but 4 are allocated, just to be safe. */
75823 assert( j < ArraySize(pPage->apOvfl)-1 );
@@ -75526,21 +75845,11 @@
75845 ** if it returns successfully */
75846 assert( idx >= 0 );
75847 assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
75848 assert( idx+sz <= (int)pPage->pBt->usableSize );
75849 pPage->nFree -= (u16)(2 + sz);
75850 memcpy(&data[idx], pCell, sz);
 
 
 
 
 
 
 
 
 
 
75851 pIns = pPage->aCellIdx + i*2;
75852 memmove(pIns+2, pIns, 2*(pPage->nCell - i));
75853 put2byte(pIns, idx);
75854 pPage->nCell++;
75855 /* increment the cell count */
@@ -75721,11 +76030,11 @@
76030 int k; /* Current slot in pCArray->apEnd[] */
76031 u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
76032
76033 assert( i<iEnd );
76034 j = get2byte(&aData[hdr+5]);
76035 if( NEVER(j>(u32)usableSize) ){ j = 0; }
76036 memcpy(&pTmp[j], &aData[j], usableSize - j);
76037
76038 for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
76039 pSrcEnd = pCArray->apEnd[k];
76040
@@ -75865,46 +76174,54 @@
76174 ){
76175 u8 * const aData = pPg->aData;
76176 u8 * const pEnd = &aData[pPg->pBt->usableSize];
76177 u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
76178 int nRet = 0;
76179 int i, j;
76180 int iEnd = iFirst + nCell;
76181 int nFree = 0;
76182 int aOfst[10];
76183 int aAfter[10];
76184
76185 for(i=iFirst; i<iEnd; i++){
76186 u8 *pCell = pCArray->apCell[i];
76187 if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
76188 int sz;
76189 int iAfter;
76190 int iOfst;
76191 /* No need to use cachedCellSize() here. The sizes of all cells that
76192 ** are to be freed have already been computing while deciding which
76193 ** cells need freeing */
76194 sz = pCArray->szCell[i]; assert( sz>0 );
76195 iOfst = (u16)(pCell - aData);
76196 iAfter = iOfst+sz;
76197 for(j=0; j<nFree; j++){
76198 if( aOfst[j]==iAfter ){
76199 aOfst[j] = iOfst;
76200 break;
76201 }else if( aAfter[j]==iOfst ){
76202 aAfter[j] = iAfter;
76203 break;
76204 }
76205 }
76206 if( j>=nFree ){
76207 if( nFree>=sizeof(aOfst)/sizeof(aOfst[0]) ){
76208 for(j=0; j<nFree; j++){
76209 freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]);
76210 }
76211 nFree = 0;
76212 }
76213 aOfst[nFree] = iOfst;
76214 aAfter[nFree] = iAfter;
76215 if( &aData[iAfter]>pEnd ) return 0;
76216 nFree++;
76217 }
76218 nRet++;
76219 }
76220 }
76221 for(j=0; j<nFree; j++){
76222 freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]);
 
76223 }
76224 return nRet;
76225 }
76226
76227 /*
@@ -75955,11 +76272,11 @@
76272 nCell -= nTail;
76273 }
76274
76275 pData = &aData[get2byteNotZero(&aData[hdr+5])];
76276 if( pData<pBegin ) goto editpage_fail;
76277 if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail;
76278
76279 /* Add cells to the start of the page */
76280 if( iNew<iOld ){
76281 int nAdd = MIN(nNew,iOld-iNew);
76282 assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -76692,11 +77009,11 @@
77009 ** (2) pPage is a virtual root page. A virtual root page is when
77010 ** the real root page is page 1 and we are the only child of
77011 ** that page.
77012 */
77013 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
77014 TRACE(("BALANCE: old: %u(nc=%u) %u(nc=%u) %u(nc=%u)\n",
77015 apOld[0]->pgno, apOld[0]->nCell,
77016 nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
77017 nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
77018 ));
77019
@@ -76776,12 +77093,12 @@
77093 apNew[i]->pgno = pgnoB;
77094 apNew[iB]->pgno = pgnoA;
77095 }
77096 }
77097
77098 TRACE(("BALANCE: new: %u(%u nc=%u) %u(%u nc=%u) %u(%u nc=%u) "
77099 "%u(%u nc=%u) %u(%u nc=%u)\n",
77100 apNew[0]->pgno, szNew[0], cntNew[0],
77101 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
77102 nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
77103 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
77104 nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77022,11 +77339,11 @@
77339 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
77340 }
77341 }
77342
77343 assert( pParent->isInit );
77344 TRACE(("BALANCE: finished: old=%u new=%u cells=%u\n",
77345 nOld, nNew, b.nCell));
77346
77347 /* Free any old pages that were not reused as new pages.
77348 */
77349 for(i=nNew; i<nOld; i++){
@@ -77107,11 +77424,11 @@
77424 }
77425 assert( sqlite3PagerIswriteable(pChild->pDbPage) );
77426 assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
77427 assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
77428
77429 TRACE(("BALANCE: copy root %u into %u\n", pRoot->pgno, pChild->pgno));
77430
77431 /* Copy the overflow cells from pRoot to pChild */
77432 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
77433 pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
77434 memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77605,11 +77922,11 @@
77922 rc = btreeComputeFreeSpace(pPage);
77923 }
77924 if( rc ) return rc;
77925 }
77926
77927 TRACE(("INSERT: table=%u nkey=%lld ndata=%u page=%u %s\n",
77928 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
77929 loc==0 ? "overwrite" : "new entry"));
77930 assert( pPage->isInit || CORRUPT_DB );
77931 newCell = p->pBt->pTmpSpace;
77932 assert( newCell!=0 );
@@ -77632,10 +77949,11 @@
77949 if( rc ) goto end_insert;
77950 }
77951 assert( szNew==pPage->xCellSize(pPage, newCell) );
77952 assert( szNew <= MX_CELL_SIZE(p->pBt) );
77953 idx = pCur->ix;
77954 pCur->info.nSize = 0;
77955 if( loc==0 ){
77956 CellInfo info;
77957 assert( idx>=0 );
77958 if( idx>=pPage->nCell ){
77959 return SQLITE_CORRUPT_BKPT;
@@ -77680,11 +77998,11 @@
77998 idx = ++pCur->ix;
77999 pCur->curFlags &= ~BTCF_ValidNKey;
78000 }else{
78001 assert( pPage->leaf );
78002 }
78003 rc = insertCellFast(pPage, idx, newCell, szNew);
78004 assert( pPage->nOverflow==0 || rc==SQLITE_OK );
78005 assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );
78006
78007 /* If no error has occurred and pPage has an overflow cell, call balance()
78008 ** to redistribute the cells within the tree. Since balance() may move
@@ -77704,11 +78022,10 @@
78022 ** the b-tree if possible. If the cursor is left pointing to the last
78023 ** entry in the table, and the next row inserted has an integer key
78024 ** larger than the largest existing key, it is possible to insert the
78025 ** row without seeking the cursor. This can be a big performance boost.
78026 */
 
78027 if( pPage->nOverflow ){
78028 assert( rc==SQLITE_OK );
78029 pCur->curFlags &= ~(BTCF_ValidNKey);
78030 rc = balance(pCur);
78031
@@ -77904,10 +78221,13 @@
78221 return SQLITE_CORRUPT_BKPT;
78222 }
78223 pCell = findCell(pPage, iCellIdx);
78224 if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
78225 return SQLITE_CORRUPT_BKPT;
78226 }
78227 if( pCell<&pPage->aCellIdx[pPage->nCell] ){
78228 return SQLITE_CORRUPT_BKPT;
78229 }
78230
78231 /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
78232 ** be preserved following this delete operation. If the current delete
78233 ** will cause a b-tree rebalance, then this is done by saving the cursor
@@ -78653,11 +78973,12 @@
78973 va_start(ap, zFormat);
78974 if( pCheck->errMsg.nChar ){
78975 sqlite3_str_append(&pCheck->errMsg, "\n", 1);
78976 }
78977 if( pCheck->zPfx ){
78978 sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx,
78979 pCheck->v0, pCheck->v1, pCheck->v2);
78980 }
78981 sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
78982 va_end(ap);
78983 if( pCheck->errMsg.accError==SQLITE_NOMEM ){
78984 checkOom(pCheck);
@@ -78693,15 +79014,15 @@
79014 **
79015 ** Also check that the page number is in bounds.
79016 */
79017 static int checkRef(IntegrityCk *pCheck, Pgno iPage){
79018 if( iPage>pCheck->nPage || iPage==0 ){
79019 checkAppendMsg(pCheck, "invalid page number %u", iPage);
79020 return 1;
79021 }
79022 if( getPageReferenced(pCheck, iPage) ){
79023 checkAppendMsg(pCheck, "2nd reference to page %u", iPage);
79024 return 1;
79025 }
79026 setPageReferenced(pCheck, iPage);
79027 return 0;
79028 }
@@ -78723,17 +79044,17 @@
79044 Pgno iPtrmapParent;
79045
79046 rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
79047 if( rc!=SQLITE_OK ){
79048 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
79049 checkAppendMsg(pCheck, "Failed to read ptrmap key=%u", iChild);
79050 return;
79051 }
79052
79053 if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
79054 checkAppendMsg(pCheck,
79055 "Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)",
79056 iChild, eType, iParent, ePtrmapType, iPtrmapParent);
79057 }
79058 }
79059 #endif
79060
@@ -78754,11 +79075,11 @@
79075 DbPage *pOvflPage;
79076 unsigned char *pOvflData;
79077 if( checkRef(pCheck, iPage) ) break;
79078 N--;
79079 if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
79080 checkAppendMsg(pCheck, "failed to get page %u", iPage);
79081 break;
79082 }
79083 pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
79084 if( isFreeList ){
79085 u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78767,11 +79088,11 @@
79088 checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
79089 }
79090 #endif
79091 if( n>pCheck->pBt->usableSize/4-2 ){
79092 checkAppendMsg(pCheck,
79093 "freelist leaf count too big on page %u", iPage);
79094 N--;
79095 }else{
79096 for(i=0; i<(int)n; i++){
79097 Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
79098 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78799,11 +79120,11 @@
79120 iPage = get4byte(pOvflData);
79121 sqlite3PagerUnref(pOvflPage);
79122 }
79123 if( N && nErrAtStart==pCheck->nErr ){
79124 checkAppendMsg(pCheck,
79125 "%s is %u but should be %u",
79126 isFreeList ? "size" : "overflow list length",
79127 expected-N, expected);
79128 }
79129 }
79130 #endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78914,12 +79235,12 @@
79235 if( pCheck->mxErr==0 ) goto end_of_check;
79236 pBt = pCheck->pBt;
79237 usableSize = pBt->usableSize;
79238 if( iPage==0 ) return 0;
79239 if( checkRef(pCheck, iPage) ) return 0;
79240 pCheck->zPfx = "Tree %u page %u: ";
79241 pCheck->v0 = pCheck->v1 = iPage;
79242 if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
79243 checkAppendMsg(pCheck,
79244 "unable to get the page. error code=%d", rc);
79245 goto end_of_check;
79246 }
@@ -78941,11 +79262,11 @@
79262 }
79263 data = pPage->aData;
79264 hdr = pPage->hdrOffset;
79265
79266 /* Set up for cell analysis */
79267 pCheck->zPfx = "Tree %u page %u cell %u: ";
79268 contentOffset = get2byteNotZero(&data[hdr+5]);
79269 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
79270
79271 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
79272 ** number of cells on the page. */
@@ -78961,11 +79282,11 @@
79282 if( !pPage->leaf ){
79283 /* Analyze the right-child page of internal pages */
79284 pgno = get4byte(&data[hdr+8]);
79285 #ifndef SQLITE_OMIT_AUTOVACUUM
79286 if( pBt->autoVacuum ){
79287 pCheck->zPfx = "Tree %u page %u right child: ";
79288 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
79289 }
79290 #endif
79291 depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
79292 keyCanBeEqual = 0;
@@ -78985,11 +79306,11 @@
79306 pCheck->v2 = i;
79307 assert( pCellIdx==&data[cellStart + i*2] );
79308 pc = get2byteAligned(pCellIdx);
79309 pCellIdx -= 2;
79310 if( pc<contentOffset || pc>usableSize-4 ){
79311 checkAppendMsg(pCheck, "Offset %u out of range %u..%u",
79312 pc, contentOffset, usableSize-4);
79313 doCoverageCheck = 0;
79314 continue;
79315 }
79316 pCell = &data[pc];
@@ -79117,11 +79438,11 @@
79438 ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
79439 ** number of fragmented free bytes within the cell content area.
79440 */
79441 if( heap[0]==0 && nFrag!=data[hdr+7] ){
79442 checkAppendMsg(pCheck,
79443 "Fragmentation of %u bytes reported as %u on page %u",
79444 nFrag, data[hdr+7], iPage);
79445 }
79446 }
79447
79448 end_of_check:
@@ -79214,11 +79535,11 @@
79535 if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
79536
79537 /* Check the integrity of the freelist
79538 */
79539 if( bCkFreelist ){
79540 sCheck.zPfx = "Freelist: ";
79541 checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
79542 get4byte(&pBt->pPage1->aData[36]));
79543 sCheck.zPfx = 0;
79544 }
79545
@@ -79231,11 +79552,11 @@
79552 Pgno mxInHdr;
79553 for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
79554 mxInHdr = get4byte(&pBt->pPage1->aData[52]);
79555 if( mx!=mxInHdr ){
79556 checkAppendMsg(&sCheck,
79557 "max rootpage (%u) disagrees with header (%u)",
79558 mx, mxInHdr
79559 );
79560 }
79561 }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
79562 checkAppendMsg(&sCheck,
@@ -79262,23 +79583,23 @@
79583 */
79584 if( !bPartial ){
79585 for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
79586 #ifdef SQLITE_OMIT_AUTOVACUUM
79587 if( getPageReferenced(&sCheck, i)==0 ){
79588 checkAppendMsg(&sCheck, "Page %u: never used", i);
79589 }
79590 #else
79591 /* If the database supports auto-vacuum, make sure no tables contain
79592 ** references to pointer-map pages.
79593 */
79594 if( getPageReferenced(&sCheck, i)==0 &&
79595 (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79596 checkAppendMsg(&sCheck, "Page %u: never used", i);
79597 }
79598 if( getPageReferenced(&sCheck, i)!=0 &&
79599 (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79600 checkAppendMsg(&sCheck, "Page %u: pointer map referenced", i);
79601 }
79602 #endif
79603 }
79604 }
79605
@@ -80806,11 +81127,11 @@
81127 return SQLITE_NOMEM_BKPT;
81128 }
81129
81130 vdbeMemRenderNum(nByte, pMem->z, pMem);
81131 assert( pMem->z!=0 );
81132 assert( pMem->n==(int)sqlite3Strlen30NN(pMem->z) );
81133 pMem->enc = SQLITE_UTF8;
81134 pMem->flags |= MEM_Str|MEM_Term;
81135 if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
81136 sqlite3VdbeChangeEncoding(pMem, enc);
81137 return SQLITE_OK;
@@ -81850,10 +82171,13 @@
82171 assert( ExprUseXList(p) );
82172 pList = p->x.pList;
82173 if( pList ) nVal = pList->nExpr;
82174 assert( !ExprHasProperty(p, EP_IntValue) );
82175 pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0);
82176 #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
82177 if( pFunc==0 ) return SQLITE_OK;
82178 #endif
82179 assert( pFunc );
82180 if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
82181 || (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
82182 ){
82183 return SQLITE_OK;
@@ -81886,20 +82210,15 @@
82210 rc = ctx.isError;
82211 sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
82212 }else{
82213 sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
82214 assert( rc==SQLITE_OK );
 
 
 
 
82215 rc = sqlite3VdbeChangeEncoding(pVal, enc);
82216 if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){
82217 rc = SQLITE_TOOBIG;
82218 pCtx->pParse->nErr++;
82219 }
 
82220 }
82221
82222 value_from_function_out:
82223 if( rc!=SQLITE_OK ){
82224 pVal = 0;
@@ -81959,10 +82278,17 @@
82278 assert( !ExprHasProperty(pExpr, EP_IntValue) );
82279 aff = sqlite3AffinityType(pExpr->u.zToken,0);
82280 rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
82281 testcase( rc!=SQLITE_OK );
82282 if( *ppVal ){
82283 #ifdef SQLITE_ENABLE_STAT4
82284 rc = ExpandBlob(*ppVal);
82285 #else
82286 /* zero-blobs only come from functions, not literal values. And
82287 ** functions are only processed under STAT4 */
82288 assert( (ppVal[0][0].flags & MEM_Zero)==0 );
82289 #endif
82290 sqlite3VdbeMemCast(*ppVal, aff, enc);
82291 sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
82292 }
82293 return rc;
82294 }
@@ -82805,14 +83131,14 @@
83131 ** If the bPush flag is true, then make this opcode the parent for
83132 ** subsequent Explains until sqlite3VdbeExplainPop() is called.
83133 */
83134 SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
83135 int addr = 0;
83136 #if !defined(SQLITE_DEBUG)
83137 /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
83138 ** But omit them (for performance) during production builds */
83139 if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
83140 #endif
83141 {
83142 char *zMsg;
83143 Vdbe *v;
83144 va_list ap;
@@ -83484,22 +83810,24 @@
83810 int addrLoop, /* Address of loop counter */
83811 int addrVisit, /* Address of rows visited counter */
83812 LogEst nEst, /* Estimated number of output rows */
83813 const char *zName /* Name of table or index being scanned */
83814 ){
83815 if( IS_STMT_SCANSTATUS(p->db) ){
83816 sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83817 ScanStatus *aNew;
83818 aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83819 if( aNew ){
83820 ScanStatus *pNew = &aNew[p->nScan++];
83821 memset(pNew, 0, sizeof(ScanStatus));
83822 pNew->addrExplain = addrExplain;
83823 pNew->addrLoop = addrLoop;
83824 pNew->addrVisit = addrVisit;
83825 pNew->nEst = nEst;
83826 pNew->zName = sqlite3DbStrDup(p->db, zName);
83827 p->aScan = aNew;
83828 }
83829 }
83830 }
83831
83832 /*
83833 ** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83512,24 +83840,26 @@
83840 Vdbe *p,
83841 int addrExplain,
83842 int addrStart,
83843 int addrEnd
83844 ){
83845 if( IS_STMT_SCANSTATUS(p->db) ){
83846 ScanStatus *pScan = 0;
83847 int ii;
83848 for(ii=p->nScan-1; ii>=0; ii--){
83849 pScan = &p->aScan[ii];
83850 if( pScan->addrExplain==addrExplain ) break;
83851 pScan = 0;
83852 }
83853 if( pScan ){
83854 if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83855 for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83856 if( pScan->aAddrRange[ii]==0 ){
83857 pScan->aAddrRange[ii] = addrStart;
83858 pScan->aAddrRange[ii+1] = addrEnd;
83859 break;
83860 }
83861 }
83862 }
83863 }
83864 }
83865
@@ -83542,23 +83872,25 @@
83872 Vdbe *p,
83873 int addrExplain,
83874 int addrLoop,
83875 int addrVisit
83876 ){
83877 if( IS_STMT_SCANSTATUS(p->db) ){
83878 ScanStatus *pScan = 0;
83879 int ii;
83880 for(ii=p->nScan-1; ii>=0; ii--){
83881 pScan = &p->aScan[ii];
83882 if( pScan->addrExplain==addrExplain ) break;
83883 pScan = 0;
83884 }
83885 if( pScan ){
83886 pScan->addrLoop = addrLoop;
83887 pScan->addrVisit = addrVisit;
83888 }
83889 }
83890 }
83891 #endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */
83892
83893
83894 /*
83895 ** Change the value of the opcode, or P1, P2, P3, or P5 operands
83896 ** for a specific instruction.
@@ -85682,10 +86014,12 @@
86014 db->nDeferredCons = 0;
86015 db->nDeferredImmCons = 0;
86016 db->flags &= ~(u64)SQLITE_DeferFKs;
86017 sqlite3CommitInternalChanges(db);
86018 }
86019 }else if( p->rc==SQLITE_SCHEMA && db->nVdbeActive>1 ){
86020 p->nChange = 0;
86021 }else{
86022 sqlite3RollbackAll(db, SQLITE_OK);
86023 p->nChange = 0;
86024 }
86025 db->nStatement = 0;
@@ -86000,13 +86334,13 @@
86334 vdbeFreeOpArray(db, p->aOp, p->nOp);
86335 if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
86336 #ifdef SQLITE_ENABLE_NORMALIZE
86337 sqlite3DbFree(db, p->zNormSql);
86338 {
86339 DblquoteStr *pThis, *pNxt;
86340 for(pThis=p->pDblStr; pThis; pThis=pNxt){
86341 pNxt = pThis->pNextStr;
86342 sqlite3DbFree(db, pThis);
86343 }
86344 }
86345 #endif
86346 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -87629,10 +87963,24 @@
87963 return 0;
87964 }
87965 return 1;
87966 }
87967
87968 #if defined(SQLITE_ENABLE_CURSOR_HINTS) && defined(SQLITE_DEBUG)
87969 /*
87970 ** This Walker callback is used to help verify that calls to
87971 ** sqlite3BtreeCursorHint() with opcode BTREE_HINT_RANGE have
87972 ** byte-code register values correctly initialized.
87973 */
87974 SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr){
87975 if( pExpr->op==TK_REGISTER ){
87976 assert( (pWalker->u.aMem[pExpr->iTable].flags & MEM_Undefined)==0 );
87977 }
87978 return WRC_Continue;
87979 }
87980 #endif /* SQLITE_ENABLE_CURSOR_HINTS && SQLITE_DEBUG */
87981
87982 #ifndef SQLITE_OMIT_VIRTUALTABLE
87983 /*
87984 ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
87985 ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
87986 ** in memory obtained from sqlite3DbMalloc).
@@ -88015,11 +88363,11 @@
88363 SQLITE_NULL, /* 0x1d (not possible) */
88364 SQLITE_INTEGER, /* 0x1e (not possible) */
88365 SQLITE_NULL, /* 0x1f (not possible) */
88366 SQLITE_FLOAT, /* 0x20 INTREAL */
88367 SQLITE_NULL, /* 0x21 (not possible) */
88368 SQLITE_FLOAT, /* 0x22 INTREAL + TEXT */
88369 SQLITE_NULL, /* 0x23 (not possible) */
88370 SQLITE_FLOAT, /* 0x24 (not possible) */
88371 SQLITE_NULL, /* 0x25 (not possible) */
88372 SQLITE_FLOAT, /* 0x26 (not possible) */
88373 SQLITE_NULL, /* 0x27 (not possible) */
@@ -89882,19 +90230,28 @@
90230 int iScanStatusOp, /* Which metric to return */
90231 int flags,
90232 void *pOut /* OUT: Write the answer here */
90233 ){
90234 Vdbe *p = (Vdbe*)pStmt;
90235 VdbeOp *aOp = p->aOp;
90236 int nOp = p->nOp;
90237 ScanStatus *pScan = 0;
90238 int idx;
90239
90240 if( p->pFrame ){
90241 VdbeFrame *pFrame;
90242 for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
90243 aOp = pFrame->aOp;
90244 nOp = pFrame->nOp;
90245 }
90246
90247 if( iScan<0 ){
90248 int ii;
90249 if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
90250 i64 res = 0;
90251 for(ii=0; ii<nOp; ii++){
90252 res += aOp[ii].nCycle;
90253 }
90254 *(i64*)pOut = res;
90255 return 0;
90256 }
90257 return 1;
@@ -89916,19 +90273,19 @@
90273 if( idx>=p->nScan ) return 1;
90274
90275 switch( iScanStatusOp ){
90276 case SQLITE_SCANSTAT_NLOOP: {
90277 if( pScan->addrLoop>0 ){
90278 *(sqlite3_int64*)pOut = aOp[pScan->addrLoop].nExec;
90279 }else{
90280 *(sqlite3_int64*)pOut = -1;
90281 }
90282 break;
90283 }
90284 case SQLITE_SCANSTAT_NVISIT: {
90285 if( pScan->addrVisit>0 ){
90286 *(sqlite3_int64*)pOut = aOp[pScan->addrVisit].nExec;
90287 }else{
90288 *(sqlite3_int64*)pOut = -1;
90289 }
90290 break;
90291 }
@@ -89946,27 +90303,27 @@
90303 *(const char**)pOut = pScan->zName;
90304 break;
90305 }
90306 case SQLITE_SCANSTAT_EXPLAIN: {
90307 if( pScan->addrExplain ){
90308 *(const char**)pOut = aOp[ pScan->addrExplain ].p4.z;
90309 }else{
90310 *(const char**)pOut = 0;
90311 }
90312 break;
90313 }
90314 case SQLITE_SCANSTAT_SELECTID: {
90315 if( pScan->addrExplain ){
90316 *(int*)pOut = aOp[ pScan->addrExplain ].p1;
90317 }else{
90318 *(int*)pOut = -1;
90319 }
90320 break;
90321 }
90322 case SQLITE_SCANSTAT_PARENTID: {
90323 if( pScan->addrExplain ){
90324 *(int*)pOut = aOp[ pScan->addrExplain ].p2;
90325 }else{
90326 *(int*)pOut = -1;
90327 }
90328 break;
90329 }
@@ -89980,22 +90337,22 @@
90337 int iIns = pScan->aAddrRange[ii];
90338 int iEnd = pScan->aAddrRange[ii+1];
90339 if( iIns==0 ) break;
90340 if( iIns>0 ){
90341 while( iIns<=iEnd ){
90342 res += aOp[iIns].nCycle;
90343 iIns++;
90344 }
90345 }else{
90346 int iOp;
90347 for(iOp=0; iOp<nOp; iOp++){
90348 Op *pOp = &aOp[iOp];
90349 if( pOp->p1!=iEnd ) continue;
90350 if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
90351 continue;
90352 }
90353 res += aOp[iOp].nCycle;
90354 }
90355 }
90356 }
90357 }
90358 *(i64*)pOut = res;
@@ -90914,11 +91271,14 @@
91271 if( p->flags & (MEM_Int|MEM_IntReal) ){
91272 h += p->u.i;
91273 }else if( p->flags & MEM_Real ){
91274 h += sqlite3VdbeIntValue(p);
91275 }else if( p->flags & (MEM_Str|MEM_Blob) ){
91276 /* All strings have the same hash and all blobs have the same hash,
91277 ** though, at least, those hashes are different from each other and
91278 ** from NULL. */
91279 h += 4093 + (p->flags & (MEM_Str|MEM_Blob));
91280 }
91281 }
91282 return h;
91283 }
91284
@@ -90964,10 +91324,11 @@
91324 Mem *pIn2 = 0; /* 2nd input operand */
91325 Mem *pIn3 = 0; /* 3rd input operand */
91326 Mem *pOut = 0; /* Output operand */
91327 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
91328 u64 *pnCycle = 0;
91329 int bStmtScanStatus = IS_STMT_SCANSTATUS(db)!=0;
91330 #endif
91331 /*** INSERT STACK UNION HERE ***/
91332
91333 assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
91334 if( DbMaskNonZero(p->lockMask) ){
@@ -91028,17 +91389,21 @@
91389 ** jumps to abort_due_to_error. */
91390 assert( rc==SQLITE_OK );
91391
91392 assert( pOp>=aOp && pOp<&aOp[p->nOp]);
91393 nVmStep++;
91394
91395 #if defined(VDBE_PROFILE)
91396 pOp->nExec++;
91397 pnCycle = &pOp->nCycle;
91398 if( sqlite3NProfileCnt==0 ) *pnCycle -= sqlite3Hwtime();
91399 #elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
91400 if( bStmtScanStatus ){
91401 pOp->nExec++;
91402 pnCycle = &pOp->nCycle;
91403 *pnCycle -= sqlite3Hwtime();
91404 }
91405 #endif
91406
91407 /* Only allow tracing if SQLITE_DEBUG is defined.
91408 */
91409 #ifdef SQLITE_DEBUG
@@ -92848,10 +93213,16 @@
93213 ** from the value in that register.
93214 **
93215 ** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant
93216 ** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04.
93217 ** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10.
93218 **
93219 ** WARNING: This opcode does not reliably distinguish between NULL and REAL
93220 ** when P1>=0. If the database contains a NaN value, this opcode will think
93221 ** that the datatype is REAL when it should be NULL. When P1<0 and the value
93222 ** is already stored in register P3, then this opcode does reliably
93223 ** distinguish between NULL and REAL. The problem only arises then P1>=0.
93224 **
93225 ** Take the jump to address P2 if and only if the datatype of the
93226 ** value determined by P1 and P3 corresponds to one of the bits in the
93227 ** P5 bitmask.
93228 **
@@ -95196,10 +95567,11 @@
95567 #endif
95568 VdbeBranchTaken(0,3);
95569 break;
95570 }
95571 nStep--;
95572 pC->cacheStatus = CACHE_STALE;
95573 rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
95574 if( rc ){
95575 if( rc==SQLITE_DONE ){
95576 rc = SQLITE_OK;
95577 goto seekscan_search_fail;
@@ -97848,10 +98220,11 @@
98220 sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
98221 goto abort_due_to_error;
98222 }
98223 sqlite3VdbeChangeEncoding(pMem, encoding);
98224 UPDATE_MAX_BLOBSIZE(pMem);
98225 REGISTER_TRACE((int)(pMem-aMem), pMem);
98226 break;
98227 }
98228
98229 #ifndef SQLITE_OMIT_WAL
98230 /* Opcode: Checkpoint P1 P2 P3 * *
@@ -98986,12 +99359,14 @@
99359
99360 #if defined(VDBE_PROFILE)
99361 *pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
99362 pnCycle = 0;
99363 #elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
99364 if( pnCycle ){
99365 *pnCycle += sqlite3Hwtime();
99366 pnCycle = 0;
99367 }
99368 #endif
99369
99370 /* The following code adds nothing to the actual functionality
99371 ** of the program. It is only here for testing and debugging.
99372 ** On the other hand, it does burn CPU cycles every time through
@@ -104013,11 +104388,12 @@
104388 if( pParse->pTriggerTab!=0 ){
104389 int op = pParse->eTriggerOp;
104390 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
104391 if( pParse->bReturning ){
104392 if( (pNC->ncFlags & NC_UBaseReg)!=0
104393 && ALWAYS(zTab==0
104394 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
104395 ){
104396 pExpr->iTable = op!=TK_DELETE;
104397 pTab = pParse->pTriggerTab;
104398 }
104399 }else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
@@ -104798,12 +105174,12 @@
105174 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
105175 }
105176 assert( pNC->nRef>=nRef );
105177 if( nRef!=pNC->nRef ){
105178 ExprSetProperty(pExpr, EP_VarSelect);
 
105179 }
105180 pNC->ncFlags |= NC_Subquery;
105181 }
105182 break;
105183 }
105184 case TK_VARIABLE: {
105185 testcase( pNC->ncFlags & NC_IsCheck );
@@ -105987,15 +106363,14 @@
106363 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
106364 p = p->pLeft;
106365 }else{
106366 Expr *pNext = p->pRight;
106367 /* The Expr.x union is never used at the same time as Expr.pRight */
106368 assert( !ExprUseXList(p) || p->x.pList==0 || p->pRight==0 );
106369 if( ExprUseXList(p) && p->x.pList!=0 && !db->mallocFailed ){
 
106370 int i;
106371 for(i=0; i<p->x.pList->nExpr; i++){
106372 if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
106373 pNext = p->x.pList->a[i].pExpr;
106374 break;
106375 }
106376 }
@@ -108359,11 +108734,11 @@
108734
108735 /*
108736 ** pX is the RHS of an IN operator. If pX is a SELECT statement
108737 ** that can be simplified to a direct table access, then return
108738 ** a pointer to the SELECT statement. If pX is not a SELECT statement,
108739 ** or if the SELECT statement needs to be materialized into a transient
108740 ** table, then return NULL.
108741 */
108742 #ifndef SQLITE_OMIT_SUBQUERY
108743 static Select *isCandidateForInOpt(const Expr *pX){
108744 Select *p;
@@ -108645,11 +109020,10 @@
109020 Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
109021 Expr *pRhs = pEList->a[i].pExpr;
109022 CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
109023 int j;
109024
 
109025 for(j=0; j<nExpr; j++){
109026 if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
109027 assert( pIdx->azColl[j] );
109028 if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
109029 continue;
@@ -109548,10 +109922,11 @@
109922 Column *pCol, /* The generated column */
109923 int regOut /* Put the result in this register */
109924 ){
109925 int iAddr;
109926 Vdbe *v = pParse->pVdbe;
109927 int nErr = pParse->nErr;
109928 assert( v!=0 );
109929 assert( pParse->iSelfTab!=0 );
109930 if( pParse->iSelfTab>0 ){
109931 iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109932 }else{
@@ -109560,10 +109935,11 @@
109935 sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109936 if( pCol->affinity>=SQLITE_AFF_TEXT ){
109937 sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109938 }
109939 if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
109940 if( pParse->nErr>nErr ) pParse->db->errByteOffset = -1;
109941 }
109942 #endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109943
109944 /*
109945 ** Generate code to extract the value of the iCol-th column of a table.
@@ -109576,10 +109952,11 @@
109952 int regOut /* Extract the value into this register */
109953 ){
109954 Column *pCol;
109955 assert( v!=0 );
109956 assert( pTab!=0 );
109957 assert( iCol!=XN_EXPR );
109958 if( iCol<0 || iCol==pTab->iPKey ){
109959 sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109960 VdbeComment((v, "%s.rowid", pTab->zName));
109961 }else{
109962 int op;
@@ -109928,11 +110305,23 @@
110305 switch( op ){
110306 case TK_AGG_COLUMN: {
110307 AggInfo *pAggInfo = pExpr->pAggInfo;
110308 struct AggInfo_col *pCol;
110309 assert( pAggInfo!=0 );
110310 assert( pExpr->iAgg>=0 );
110311 if( pExpr->iAgg>=pAggInfo->nColumn ){
110312 /* Happens when the left table of a RIGHT JOIN is null and
110313 ** is using an expression index */
110314 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
110315 #ifdef SQLITE_VDBE_COVERAGE
110316 /* Verify that the OP_Null above is exercised by tests
110317 ** tag-20230325-2 */
110318 sqlite3VdbeAddOp2(v, OP_NotNull, target, 1);
110319 VdbeCoverageNeverTaken(v);
110320 #endif
110321 break;
110322 }
110323 pCol = &pAggInfo->aCol[pExpr->iAgg];
110324 if( !pAggInfo->directMode ){
110325 return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
110326 }else if( pAggInfo->useSortingIdx ){
110327 Table *pTab = pCol->pTab;
@@ -110103,15 +110492,12 @@
110492 return pExpr->iTable;
110493 }
110494 #ifndef SQLITE_OMIT_CAST
110495 case TK_CAST: {
110496 /* Expressions of the form: CAST(pLeft AS token) */
110497 sqlite3ExprCode(pParse, pExpr->pLeft, target);
110498 assert( inReg==target );
 
 
 
110499 assert( !ExprHasProperty(pExpr, EP_IntValue) );
110500 sqlite3VdbeAddOp2(v, OP_Cast, target,
110501 sqlite3AffinityType(pExpr->u.zToken, 0));
110502 return inReg;
110503 }
@@ -110446,17 +110832,13 @@
110832 ** "SOFT-COLLATE" that is added to constraints that are pushed down
110833 ** from outer queries into sub-queries by the push-down optimization.
110834 ** Clear subtypes as subtypes may not cross a subquery boundary.
110835 */
110836 assert( pExpr->pLeft );
110837 sqlite3ExprCode(pParse, pExpr->pLeft, target);
110838 sqlite3VdbeAddOp1(v, OP_ClrSubtype, target);
110839 return target;
 
 
 
 
110840 }else{
110841 pExpr = pExpr->pLeft;
110842 goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110843 }
110844 }
@@ -110562,16 +110944,13 @@
110944 ** (1) Temporarily disable factoring of constant expressions
110945 ** (2) Make sure the computed value really is stored in register
110946 ** "target" and not someplace else.
110947 */
110948 pParse->okConstFactor = 0; /* note (1) above */
110949 sqlite3ExprCode(pParse, pExpr->pLeft, target);
110950 assert( target==inReg );
110951 pParse->okConstFactor = okConstFactor;
 
 
 
 
110952 sqlite3VdbeJumpHere(v, addrINR);
110953 break;
110954 }
110955
110956 /*
@@ -110805,11 +111184,13 @@
111184 assert( pParse->pVdbe!=0 || pParse->db->mallocFailed );
111185 if( pParse->pVdbe==0 ) return;
111186 inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);
111187 if( inReg!=target ){
111188 u8 op;
111189 if( ALWAYS(pExpr)
111190 && (ExprHasProperty(pExpr,EP_Subquery) || pExpr->op==TK_REGISTER)
111191 ){
111192 op = OP_Copy;
111193 }else{
111194 op = OP_SCopy;
111195 }
111196 sqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target);
@@ -111990,23 +112371,26 @@
112371 ){
112372 AggInfo *pAggInfo = pExpr->pAggInfo;
112373 int iAgg = pExpr->iAgg;
112374 Parse *pParse = pWalker->pParse;
112375 sqlite3 *db = pParse->db;
112376 assert( iAgg>=0 );
112377 if( pExpr->op!=TK_AGG_FUNCTION ){
112378 if( ALWAYS(iAgg<pAggInfo->nColumn)
112379 && pAggInfo->aCol[iAgg].pCExpr==pExpr
112380 ){
112381 pExpr = sqlite3ExprDup(db, pExpr, 0);
112382 if( pExpr ){
112383 pAggInfo->aCol[iAgg].pCExpr = pExpr;
112384 sqlite3ExprDeferredDelete(pParse, pExpr);
112385 }
112386 }
112387 }else{
112388 assert( pExpr->op==TK_AGG_FUNCTION );
112389 if( ALWAYS(iAgg<pAggInfo->nFunc)
112390 && pAggInfo->aFunc[iAgg].pFExpr==pExpr
112391 ){
112392 pExpr = sqlite3ExprDup(db, pExpr, 0);
112393 if( pExpr ){
112394 pAggInfo->aFunc[iAgg].pFExpr = pExpr;
112395 sqlite3ExprDeferredDelete(pParse, pExpr);
112396 }
@@ -112152,11 +112536,16 @@
112536 if( iDataCur<0 ) continue;
112537 if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112538 }
112539 if( pIEpr==0 ) break;
112540 if( NEVER(!ExprUseYTab(pExpr)) ) break;
112541 for(i=0; i<pSrcList->nSrc; i++){
112542 if( pSrcList->a[0].iCursor==pIEpr->iDataCur ) break;
112543 }
112544 if( i>=pSrcList->nSrc ) break;
112545 if( NEVER(pExpr->pAggInfo!=0) ) break; /* Resolved by outer context */
112546 if( pParse->nErr ){ return WRC_Abort; }
112547
112548 /* If we reach this point, it means that expression pExpr can be
112549 ** translated into a reference to an index column as described by
112550 ** pIEpr.
112551 */
@@ -112163,10 +112552,13 @@
112552 memset(&tmp, 0, sizeof(tmp));
112553 tmp.op = TK_AGG_COLUMN;
112554 tmp.iTable = pIEpr->iIdxCur;
112555 tmp.iColumn = pIEpr->iIdxCol;
112556 findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
112557 if( pParse->nErr ){ return WRC_Abort; }
112558 assert( pAggInfo->aCol!=0 );
112559 assert( tmp.iAgg<pAggInfo->nColumn );
112560 pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112561 pExpr->pAggInfo = pAggInfo;
112562 pExpr->iAgg = tmp.iAgg;
112563 return WRC_Prune;
112564 }
@@ -112339,10 +112731,41 @@
112731 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112732 pParse->nTempReg = 0;
112733 pParse->nRangeReg = 0;
112734 }
112735
112736 /*
112737 ** Make sure sufficient registers have been allocated so that
112738 ** iReg is a valid register number.
112739 */
112740 SQLITE_PRIVATE void sqlite3TouchRegister(Parse *pParse, int iReg){
112741 if( pParse->nMem<iReg ) pParse->nMem = iReg;
112742 }
112743
112744 #if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
112745 /*
112746 ** Return the latest reusable register in the set of all registers.
112747 ** The value returned is no less than iMin. If any register iMin or
112748 ** greater is in permanent use, then return one more than that last
112749 ** permanent register.
112750 */
112751 SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse *pParse, int iMin){
112752 const ExprList *pList = pParse->pConstExpr;
112753 if( pList ){
112754 int i;
112755 for(i=0; i<pList->nExpr; i++){
112756 if( pList->a[i].u.iConstExprReg>=iMin ){
112757 iMin = pList->a[i].u.iConstExprReg + 1;
112758 }
112759 }
112760 }
112761 pParse->nTempReg = 0;
112762 pParse->nRangeReg = 0;
112763 return iMin;
112764 }
112765 #endif /* SQLITE_ENABLE_STAT4 || SQLITE_DEBUG */
112766
112767 /*
112768 ** Validate that no temporary register falls within the range of
112769 ** iFirst..iLast, inclusive. This routine is only call from within assert()
112770 ** statements.
112771 */
@@ -112357,10 +112780,18 @@
112780 }
112781 for(i=0; i<pParse->nTempReg; i++){
112782 if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112783 return 0;
112784 }
112785 }
112786 if( pParse->pConstExpr ){
112787 ExprList *pList = pParse->pConstExpr;
112788 for(i=0; i<pList->nExpr; i++){
112789 int iReg = pList->a[i].u.iConstExprReg;
112790 if( iReg==0 ) continue;
112791 if( iReg>=iFirst && iReg<=iLast ) return 0;
112792 }
112793 }
112794 return 1;
112795 }
112796 #endif /* SQLITE_DEBUG */
112797
@@ -115641,15 +116072,19 @@
116072 int regTemp2 = iMem++; /* Second temporary use register */
116073 int regTabname = iMem++; /* Register containing table name */
116074 int regIdxname = iMem++; /* Register containing index name */
116075 int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
116076 int regPrev = iMem; /* MUST BE LAST (see below) */
116077 #ifdef SQLITE_ENABLE_STAT4
116078 int doOnce = 1; /* Flag for a one-time computation */
116079 #endif
116080 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
116081 Table *pStat1 = 0;
116082 #endif
116083
116084 sqlite3TouchRegister(pParse, iMem);
116085 assert( sqlite3NoTempsInRange(pParse, regNewRowid, iMem) );
116086 v = sqlite3GetVdbe(pParse);
116087 if( v==0 || NEVER(pTab==0) ){
116088 return;
116089 }
116090 if( !IsOrdinaryTable(pTab) ){
@@ -115751,11 +116186,11 @@
116186
116187 /* Make sure there are enough memory cells allocated to accommodate
116188 ** the regPrev array and a trailing rowid (the rowid slot is required
116189 ** when building a record to insert into the sample column of
116190 ** the sqlite_stat4 table. */
116191 sqlite3TouchRegister(pParse, regPrev+nColTest);
116192
116193 /* Open a read-only cursor on the index being analyzed. */
116194 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
116195 sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
116196 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115923,11 +116358,39 @@
116358 int regSampleRowid = regCol + nCol;
116359 int addrNext;
116360 int addrIsNull;
116361 u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
116362
116363 if( doOnce ){
116364 int mxCol = nCol;
116365 Index *pX;
116366
116367 /* Compute the maximum number of columns in any index */
116368 for(pX=pTab->pIndex; pX; pX=pX->pNext){
116369 int nColX; /* Number of columns in pX */
116370 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pX) ){
116371 nColX = pX->nKeyCol;
116372 }else{
116373 nColX = pX->nColumn;
116374 }
116375 if( nColX>mxCol ) mxCol = nColX;
116376 }
116377
116378 /* Allocate space to compute results for the largest index */
116379 sqlite3TouchRegister(pParse, regCol+mxCol);
116380 doOnce = 0;
116381 #ifdef SQLITE_DEBUG
116382 /* Verify that the call to sqlite3ClearTempRegCache() below
116383 ** really is needed.
116384 ** https://sqlite.org/forum/forumpost/83cb4a95a0 (2023-03-25)
116385 */
116386 testcase( !sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116387 #endif
116388 sqlite3ClearTempRegCache(pParse); /* tag-20230325-1 */
116389 assert( sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116390 }
116391 assert( sqlite3NoTempsInRange(pParse, regEq, regCol+nCol) );
116392
116393 addrNext = sqlite3VdbeCurrentAddr(v);
116394 callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
116395 addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
116396 VdbeCoverage(v);
@@ -116004,10 +116467,15 @@
116467 iTab = pParse->nTab;
116468 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
116469 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
116470 Table *pTab = (Table*)sqliteHashData(k);
116471 analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
116472 #ifdef SQLITE_ENABLE_STAT4
116473 iMem = sqlite3FirstAvailableRegister(pParse, iMem);
116474 #else
116475 assert( iMem==sqlite3FirstAvailableRegister(pParse,iMem) );
116476 #endif
116477 }
116478 loadAnalysis(pParse, iDb);
116479 }
116480
116481 /*
@@ -118931,11 +119399,11 @@
119399 Hash *pHash;
119400 sqlite3 *db = pParse->db;
119401 if( pParse->pNewTrigger ){
119402 sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
119403 }else{
119404 assert( pParse->bReturning==0 || pParse->ifNotExists );
119405 }
119406 pParse->bReturning = 1;
119407 pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
119408 if( pRet==0 ){
119409 sqlite3ExprListDelete(db, pList);
@@ -118957,11 +119425,12 @@
119425 pRet->retTrig.step_list = &pRet->retTStep;
119426 pRet->retTStep.op = TK_RETURNING;
119427 pRet->retTStep.pTrig = &pRet->retTrig;
119428 pRet->retTStep.pExprList = pList;
119429 pHash = &(db->aDb[1].pSchema->trigHash);
119430 assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0
119431 || pParse->nErr || pParse->ifNotExists );
119432 if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
119433 ==&pRet->retTrig ){
119434 sqlite3OomFault(db);
119435 }
119436 }
@@ -123830,17 +124299,19 @@
124299 **
124300 ** If pTab is not writable -> generate an error message and return 1.
124301 ** If pTab is writable but other errors have occurred -> return 1.
124302 ** If pTab is writable and no prior errors -> return 0;
124303 */
124304 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, Trigger *pTrigger){
124305 if( tabIsReadOnly(pParse, pTab) ){
124306 sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
124307 return 1;
124308 }
124309 #ifndef SQLITE_OMIT_VIEW
124310 if( IsView(pTab)
124311 && (pTrigger==0 || (pTrigger->bReturning && pTrigger->pNext==0))
124312 ){
124313 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
124314 return 1;
124315 }
124316 #endif
124317 return 0;
@@ -124090,11 +124561,11 @@
124561 */
124562 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124563 goto delete_from_cleanup;
124564 }
124565
124566 if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
124567 goto delete_from_cleanup;
124568 }
124569 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124570 assert( iDb<db->nDb );
124571 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -124199,11 +124670,11 @@
124670 }
124671 }else
124672 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124673 {
124674 u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124675 if( sNC.ncFlags & NC_Subquery ) bComplex = 1;
124676 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124677 if( HasRowid(pTab) ){
124678 /* For a rowid table, initialize the RowSet to an empty set */
124679 pPk = 0;
124680 nPk = 1;
@@ -128787,49 +129258,51 @@
129258 **
129259 ** Memory for the buffer containing the column index affinity string
129260 ** is managed along with the rest of the Index structure. It will be
129261 ** released when sqlite3DeleteIndex() is called.
129262 */
129263 static SQLITE_NOINLINE const char *computeIndexAffStr(sqlite3 *db, Index *pIdx){
129264 /* The first time a column affinity string for a particular index is
129265 ** required, it is allocated and populated here. It is then stored as
129266 ** a member of the Index structure for subsequent use.
129267 **
129268 ** The column affinity string will eventually be deleted by
129269 ** sqliteDeleteIndex() when the Index structure itself is cleaned
129270 ** up.
129271 */
129272 int n;
129273 Table *pTab = pIdx->pTable;
129274 pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
129275 if( !pIdx->zColAff ){
129276 sqlite3OomFault(db);
129277 return 0;
129278 }
129279 for(n=0; n<pIdx->nColumn; n++){
129280 i16 x = pIdx->aiColumn[n];
129281 char aff;
129282 if( x>=0 ){
129283 aff = pTab->aCol[x].affinity;
129284 }else if( x==XN_ROWID ){
129285 aff = SQLITE_AFF_INTEGER;
129286 }else{
129287 assert( x==XN_EXPR );
129288 assert( pIdx->bHasExpr );
129289 assert( pIdx->aColExpr!=0 );
129290 aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
129291 }
129292 if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
129293 if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
129294 pIdx->zColAff[n] = aff;
129295 }
129296 pIdx->zColAff[n] = 0;
129297 return pIdx->zColAff;
129298 }
129299 SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
129300 if( !pIdx->zColAff ) return computeIndexAffStr(db, pIdx);
129301 return pIdx->zColAff;
129302 }
129303
129304
129305 /*
129306 ** Compute an affinity string for a table. Space is obtained
129307 ** from sqlite3DbMalloc(). The caller is responsible for freeing
129308 ** the space when done.
@@ -129511,11 +129984,11 @@
129984 goto insert_cleanup;
129985 }
129986
129987 /* Cannot insert into a read-only table.
129988 */
129989 if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
129990 goto insert_cleanup;
129991 }
129992
129993 /* Allocate a VDBE
129994 */
@@ -129958,11 +130431,11 @@
130431 sqlite3VdbeJumpHere(v, addr1);
130432 sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
130433 }
130434
130435 /* Copy the new data already generated. */
130436 assert( pTab->nNVCol>0 || pParse->nErr>0 );
130437 sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
130438
130439 #ifndef SQLITE_OMIT_GENERATED_COLUMNS
130440 /* Compute the new value for generated columns after all other
130441 ** columns have already been computed. This must be done after
@@ -133321,19 +133794,25 @@
133794 zEntry = zProc ? zProc : "sqlite3_extension_init";
133795
133796 /* tag-20210611-1. Some dlopen() implementations will segfault if given
133797 ** an oversize filename. Most filesystems have a pathname limit of 4K,
133798 ** so limit the extension filename length to about twice that.
133799 ** https://sqlite.org/forum/forumpost/08a0d6d9bf
133800 **
133801 ** Later (2023-03-25): Save an extra 6 bytes for the filename suffix.
133802 ** See https://sqlite.org/forum/forumpost/24083b579d.
133803 */
133804 if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133805
133806 handle = sqlite3OsDlOpen(pVfs, zFile);
133807 #if SQLITE_OS_UNIX || SQLITE_OS_WIN
133808 for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133809 char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133810 if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133811 if( nMsg+strlen(azEndings[ii])+1<=SQLITE_MAX_PATHLEN ){
133812 handle = sqlite3OsDlOpen(pVfs, zAltFile);
133813 }
133814 sqlite3_free(zAltFile);
133815 }
133816 #endif
133817 if( handle==0 ) goto extension_not_found;
133818 xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135824,11 +136303,11 @@
136303 if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
136304 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
136305 zDb = db->aDb[iDb].zDbSName;
136306 sqlite3CodeVerifySchema(pParse, iDb);
136307 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
136308 sqlite3TouchRegister(pParse, pTab->nCol+regRow);
136309 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
136310 sqlite3VdbeLoadString(v, regResult, pTab->zName);
136311 assert( IsOrdinaryTable(pTab) );
136312 for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
136313 pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135865,11 +136344,11 @@
136344
136345 /* Generate code to read the child key values into registers
136346 ** regRow..regRow+n. If any of the child key values are NULL, this
136347 ** row cannot cause an FK violation. Jump directly to addrOk in
136348 ** this case. */
136349 sqlite3TouchRegister(pParse, regRow + pFK->nCol);
136350 for(j=0; j<pFK->nCol; j++){
136351 int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
136352 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
136353 sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
136354 }
@@ -135994,10 +136473,11 @@
136473
136474 if( OMIT_TEMPDB && i==1 ) continue;
136475 if( iDb>=0 && i!=iDb ) continue;
136476
136477 sqlite3CodeVerifySchema(pParse, i);
136478 pParse->okConstFactor = 0; /* tag-20230327-1 */
136479
136480 /* Do an integrity check of the B-Tree
136481 **
136482 ** Begin by finding the root pages numbers
136483 ** for all tables and indices in the database.
@@ -136029,11 +136509,11 @@
136509 }
136510 }
136511 aRoot[0] = cnt;
136512
136513 /* Make sure sufficient number of registers have been allocated */
136514 sqlite3TouchRegister(pParse, 8+mxIdx);
136515 sqlite3ClearTempRegCache(pParse);
136516
136517 /* Do the b-tree integrity checks */
136518 sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136519 sqlite3VdbeChangeP5(v, (u8)i);
@@ -136179,19 +136659,33 @@
136659
136660 labelError = sqlite3VdbeMakeLabel(pParse);
136661 labelOk = sqlite3VdbeMakeLabel(pParse);
136662 if( pCol->notNull ){
136663 /* (1) NOT NULL columns may not contain a NULL */
136664 int jmp3;
136665 int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
 
136666 VdbeCoverage(v);
136667 if( p1<0 ){
136668 sqlite3VdbeChangeP5(v, 0x0f); /* INT, REAL, TEXT, or BLOB */
136669 jmp3 = jmp2;
136670 }else{
136671 sqlite3VdbeChangeP5(v, 0x0d); /* INT, TEXT, or BLOB */
136672 /* OP_IsType does not detect NaN values in the database file
136673 ** which should be treated as a NULL. So if the header type
136674 ** is REAL, we have to load the actual data using OP_Column
136675 ** to reliably determine if the value is a NULL. */
136676 sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3);
136677 jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk);
136678 VdbeCoverage(v);
136679 }
136680 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136681 pCol->zCnName);
136682 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136683 if( doTypeCheck ){
136684 sqlite3VdbeGoto(v, labelError);
136685 sqlite3VdbeJumpHere(v, jmp2);
136686 sqlite3VdbeJumpHere(v, jmp3);
136687 }else{
136688 /* VDBE byte code will fall thru */
136689 }
136690 }
136691 if( bStrict && doTypeCheck ){
@@ -136295,11 +136789,11 @@
136789 ** any extra bytes at the end. Verify that this is the case. */
136790 if( HasRowid(pTab) ){
136791 int jmp7;
136792 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3);
136793 jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1);
136794 VdbeCoverageNeverNull(v);
136795 sqlite3VdbeLoadString(v, 3,
136796 "rowid not at end-of-record for row ");
136797 sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
136798 sqlite3VdbeLoadString(v, 4, " of index ");
136799 sqlite3VdbeGoto(v, jmp5-1);
@@ -142129,11 +142623,13 @@
142623 assert( pExpr->pRight==0 );
142624 if( sqlite3ExprIsVector(pCopy) ){
142625 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142626 }else{
142627 sqlite3 *db = pSubst->pParse->db;
142628 if( pSubst->isOuterJoin
142629 && (pCopy->op!=TK_COLUMN || pCopy->iTable!=pSubst->iNewTable)
142630 ){
142631 memset(&ifNullRow, 0, sizeof(ifNullRow));
142632 ifNullRow.op = TK_IF_NULL_ROW;
142633 ifNullRow.pLeft = pCopy;
142634 ifNullRow.iTable = pSubst->iNewTable;
142635 ifNullRow.iColumn = -99;
@@ -142506,12 +143002,11 @@
143002 ** (17f) the subquery must not be the RHS of a LEFT JOIN.
143003 ** (17g) either the subquery is the first element of the outer
143004 ** query or there are no RIGHT or FULL JOINs in any arm
143005 ** of the subquery. (This is a duplicate of condition (27b).)
143006 ** (17h) The corresponding result set expressions in all arms of the
143007 ** compound must have the same affinity.
 
143008 **
143009 ** The parent and sub-query may contain WHERE clauses. Subject to
143010 ** rules (11), (13) and (14), they may also contain ORDER BY,
143011 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
143012 ** operator other than UNION ALL because all the other compound
@@ -143375,14 +143870,10 @@
143870 **
143871 ** (8) If the subquery is a compound that uses UNION, INTERSECT,
143872 ** or EXCEPT, then all of the result set columns for all arms of
143873 ** the compound must use the BINARY collating sequence.
143874 **
 
 
 
 
143875 **
143876 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
143877 ** terms are duplicated into the subquery.
143878 */
143879 static int pushDownWhereTerms(
@@ -143409,13 +143900,10 @@
143900 }
143901 #ifndef SQLITE_OMIT_WINDOWFUNC
143902 if( pSel->pWin ) return 0; /* restriction (6b) */
143903 #endif
143904 }
 
 
 
143905 if( notUnionAll ){
143906 /* If any of the compound arms are connected using UNION, INTERSECT,
143907 ** or EXCEPT, then we must ensure that none of the columns use a
143908 ** non-BINARY collating sequence. */
143909 for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143502,10 +143990,80 @@
143990 }
143991 }
143992 return nChng;
143993 }
143994 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
143995
143996 /*
143997 ** Check to see if a subquery contains result-set columns that are
143998 ** never used. If it does, change the value of those result-set columns
143999 ** to NULL so that they do not cause unnecessary work to compute.
144000 **
144001 ** Return the number of column that were changed to NULL.
144002 */
144003 static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
144004 int nCol;
144005 Select *pSub; /* The subquery to be simplified */
144006 Select *pX; /* For looping over compound elements of pSub */
144007 Table *pTab; /* The table that describes the subquery */
144008 int j; /* Column number */
144009 int nChng = 0; /* Number of columns converted to NULL */
144010 Bitmask colUsed; /* Columns that may not be NULLed out */
144011
144012 assert( pItem!=0 );
144013 if( pItem->fg.isCorrelated || pItem->fg.isCte ){
144014 return 0;
144015 }
144016 assert( pItem->pTab!=0 );
144017 pTab = pItem->pTab;
144018 assert( pItem->pSelect!=0 );
144019 pSub = pItem->pSelect;
144020 assert( pSub->pEList->nExpr==pTab->nCol );
144021 if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
144022 testcase( pSub->selFlags & SF_Distinct );
144023 testcase( pSub->selFlags & SF_Aggregate );
144024 return 0;
144025 }
144026 for(pX=pSub; pX; pX=pX->pPrior){
144027 if( pX->pPrior && pX->op!=TK_ALL ){
144028 /* This optimization does not work for compound subqueries that
144029 ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
144030 return 0;
144031 }
144032 if( pX->pWin ){
144033 /* This optimization does not work for subqueries that use window
144034 ** functions. */
144035 return 0;
144036 }
144037 }
144038 colUsed = pItem->colUsed;
144039 if( pSub->pOrderBy ){
144040 ExprList *pList = pSub->pOrderBy;
144041 for(j=0; j<pList->nExpr; j++){
144042 u16 iCol = pList->a[j].u.x.iOrderByCol;
144043 if( iCol>0 ){
144044 iCol--;
144045 colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
144046 }
144047 }
144048 }
144049 nCol = pTab->nCol;
144050 for(j=0; j<nCol; j++){
144051 Bitmask m = j<BMS-1 ? MASKBIT(j) : TOPBIT;
144052 if( (m & colUsed)!=0 ) continue;
144053 for(pX=pSub; pX; pX=pX->pPrior) {
144054 Expr *pY = pX->pEList->a[j].pExpr;
144055 if( pY->op==TK_NULL ) continue;
144056 pY->op = TK_NULL;
144057 ExprClearProperty(pY, EP_Skip|EP_Unlikely);
144058 pX->selFlags |= SF_PushDown;
144059 nChng++;
144060 }
144061 }
144062 return nChng;
144063 }
144064
144065
144066 /*
144067 ** The pFunc is the only aggregate function in the query. Check to see
144068 ** if the query is a candidate for the min/max optimization.
144069 **
@@ -144688,15 +145246,17 @@
145246 if( pExpr->pAggInfo==0 ) return WRC_Continue;
145247 if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
145248 if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
145249 if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
145250 pAggInfo = pExpr->pAggInfo;
145251 if( NEVER(pExpr->iAgg>=pAggInfo->nColumn) ) return WRC_Continue;
145252 assert( pExpr->iAgg>=0 );
145253 pCol = &pAggInfo->aCol[pExpr->iAgg];
145254 pExpr->op = TK_AGG_COLUMN;
145255 pExpr->iTable = pCol->iTable;
145256 pExpr->iColumn = pCol->iColumn;
145257 ExprClearProperty(pExpr, EP_Skip|EP_Collate);
145258 return WRC_Prune;
145259 }
145260
145261 /*
145262 ** Convert every pAggInfo->aFunc[].pExpr such that any node within
@@ -145046,11 +145606,10 @@
145606 sqlite3DbFree(db, p->aCol);
145607 sqlite3DbFree(db, p->aFunc);
145608 sqlite3DbFreeNN(db, p);
145609 }
145610
 
145611 /*
145612 ** Attempt to transform a query of the form
145613 **
145614 ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145615 **
@@ -145074,10 +145633,11 @@
145633 Expr *pCount;
145634 sqlite3 *db;
145635 if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145636 if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145637 if( p->pWhere ) return 0;
145638 if( p->pHaving ) return 0;
145639 if( p->pGroupBy ) return 0;
145640 if( p->pOrderBy ) return 0;
145641 pExpr = p->pEList->a[0].pExpr;
145642 if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145643 assert( ExprUseUToken(pExpr) );
@@ -145093,11 +145653,12 @@
145653 do{
145654 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145655 if( pSub->pWhere ) return 0; /* No WHERE clause */
145656 if( pSub->pLimit ) return 0; /* No LIMIT clause */
145657 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145658 assert( pSub->pHaving==0 ); /* Due to the previous */
145659 pSub = pSub->pPrior; /* Repeat over compound */
145660 }while( pSub );
145661
145662 /* If we reach this point then it is OK to perform the transformation */
145663
145664 db = pParse->db;
@@ -145136,11 +145697,10 @@
145697 sqlite3TreeViewSelect(0, p, 0);
145698 }
145699 #endif
145700 return 1;
145701 }
 
145702
145703 /*
145704 ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145705 ** as pSrcItem but has the same alias as p0, then return true.
145706 ** Otherwise return false.
@@ -145525,18 +146085,16 @@
146085 #endif
146086 }else{
146087 TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
146088 }
146089
 
146090 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
146091 && countOfViewOptimization(pParse, p)
146092 ){
146093 if( db->mallocFailed ) goto select_end;
146094 pTabList = p->pSrc;
146095 }
 
146096
146097 /* For each term in the FROM clause, do two things:
146098 ** (1) Authorized unreferenced tables
146099 ** (2) Generate code for all sub-queries
146100 */
@@ -145604,10 +146162,26 @@
146162 #endif
146163 assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
146164 }else{
146165 TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
146166 }
146167
146168 /* Convert unused result columns of the subquery into simple NULL
146169 ** expressions, to avoid unneeded searching and computation.
146170 */
146171 if( OptimizationEnabled(db, SQLITE_NullUnusedCols)
146172 && disableUnusedSubqueryResultColumns(pItem)
146173 ){
146174 #if TREETRACE_ENABLED
146175 if( sqlite3TreeTrace & 0x4000 ){
146176 TREETRACE(0x4000,pParse,p,
146177 ("Change unused result columns to NULL for subquery %d:\n",
146178 pSub->selId));
146179 sqlite3TreeViewSelect(0, p, 0);
146180 }
146181 #endif
146182 }
146183
146184 zSavedAuthContext = pParse->zAuthContext;
146185 pParse->zAuthContext = pItem->zName;
146186
146187 /* Generate code to implement the subquery
@@ -146891,10 +147465,11 @@
147465 if( !noErr ){
147466 sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
147467 }else{
147468 assert( !db->init.busy );
147469 sqlite3CodeVerifySchema(pParse, iDb);
147470 VVA_ONLY( pParse->ifNotExists = 1; )
147471 }
147472 goto trigger_cleanup;
147473 }
147474 }
147475
@@ -148141,10 +148716,13 @@
148716 const int op = pChanges ? TK_UPDATE : TK_DELETE;
148717 u32 mask = 0;
148718 Trigger *p;
148719
148720 assert( isNew==1 || isNew==0 );
148721 if( IsView(pTab) ){
148722 return 0xffffffff;
148723 }
148724 for(p=pTrigger; p; p=p->pNext){
148725 if( p->op==op
148726 && (tr_tm&p->tr_tm)
148727 && checkColumnOverlap(p->pColumns,pChanges)
148728 ){
@@ -148575,11 +149153,11 @@
149153 #endif
149154
149155 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
149156 goto update_cleanup;
149157 }
149158 if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
149159 goto update_cleanup;
149160 }
149161
149162 /* Allocate a cursors for the main database table and for all indices.
149163 ** The index cursors might not be used, but if they are used they
@@ -148894,16 +149472,26 @@
149472 bFinishSeek = 0;
149473 }else{
149474 /* Begin the database scan.
149475 **
149476 ** Do not consider a single-pass strategy for a multi-row update if
149477 ** there is anything that might disrupt the cursor being used to do
149478 ** the UPDATE:
149479 ** (1) This is a nested UPDATE
149480 ** (2) There are triggers
149481 ** (3) There are FOREIGN KEY constraints
149482 ** (4) There are REPLACE conflict handlers
149483 ** (5) There are subqueries in the WHERE clause
149484 */
149485 flags = WHERE_ONEPASS_DESIRED;
149486 if( !pParse->nested
149487 && !pTrigger
149488 && !hasFK
149489 && !chngKey
149490 && !bReplace
149491 && (sNC.ncFlags & NC_Subquery)==0
149492 ){
149493 flags |= WHERE_ONEPASS_MULTIROW;
149494 }
149495 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
149496 if( pWInfo==0 ) goto update_cleanup;
149497
@@ -150864,11 +151452,13 @@
151452 sCtx.pTab = pTab;
151453 sCtx.pVTable = pVTable;
151454 sCtx.pPrior = db->pVtabCtx;
151455 sCtx.bDeclared = 0;
151456 db->pVtabCtx = &sCtx;
151457 pTab->nTabRef++;
151458 rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
151459 sqlite3DeleteTable(db, pTab);
151460 db->pVtabCtx = sCtx.pPrior;
151461 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
151462 assert( sCtx.pTab==pTab );
151463
151464 if( SQLITE_OK!=rc ){
@@ -151582,10 +152172,14 @@
152172 break;
152173 }
152174 case SQLITE_VTAB_DIRECTONLY: {
152175 p->pVTable->eVtabRisk = SQLITE_VTABRISK_High;
152176 break;
152177 }
152178 case SQLITE_VTAB_USES_ALL_SCHEMAS: {
152179 p->pVTable->bAllSchemas = 1;
152180 break;
152181 }
152182 default: {
152183 rc = SQLITE_MISUSE_BKPT;
152184 break;
152185 }
@@ -152356,13 +152950,13 @@
152950 sqlite3_str_append(pStr, ")", 1);
152951 }
152952
152953 /*
152954 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152955 ** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG
152956 ** was defined at compile-time. If it is not a no-op, a single OP_Explain
152957 ** opcode is added to the output to describe the table scan strategy in pLevel.
152958 **
152959 ** If an OP_Explain opcode is added to the VM, its address is returned.
152960 ** Otherwise, if no OP_Explain is coded, zero is returned.
152961 */
152962 SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152370,12 +152964,12 @@
152964 SrcList *pTabList, /* Table list this loop refers to */
152965 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152966 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152967 ){
152968 int ret = 0;
152969 #if !defined(SQLITE_DEBUG)
152970 if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
152971 #endif
152972 {
152973 SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152974 Vdbe *v = pParse->pVdbe; /* VM being constructed */
152975 sqlite3 *db = pParse->db; /* Database handle */
@@ -152537,31 +153131,33 @@
153131 Vdbe *v, /* Vdbe to add scanstatus entry to */
153132 SrcList *pSrclist, /* FROM clause pLvl reads data from */
153133 WhereLevel *pLvl, /* Level to add scanstatus() entry for */
153134 int addrExplain /* Address of OP_Explain (or 0) */
153135 ){
153136 if( IS_STMT_SCANSTATUS( sqlite3VdbeDb(v) ) ){
153137 const char *zObj = 0;
153138 WhereLoop *pLoop = pLvl->pWLoop;
153139 int wsFlags = pLoop->wsFlags;
153140 int viaCoroutine = 0;
153141
153142 if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
153143 zObj = pLoop->u.btree.pIndex->zName;
153144 }else{
153145 zObj = pSrclist->a[pLvl->iFrom].zName;
153146 viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
153147 }
153148 sqlite3VdbeScanStatus(
153149 v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
153150 );
153151
153152 if( viaCoroutine==0 ){
153153 if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
153154 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
153155 }
153156 if( wsFlags & WHERE_INDEXED ){
153157 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
153158 }
153159 }
153160 }
153161 }
153162 #endif
153163
@@ -153254,31 +153850,29 @@
153850 ** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into
153851 ** an access of the index rather than the original table.
153852 */
153853 static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
153854 int rc = WRC_Continue;
153855 int reg;
153856 struct CCurHint *pHint = pWalker->u.pCCurHint;
153857 if( pExpr->op==TK_COLUMN ){
153858 if( pExpr->iTable!=pHint->iTabCur ){
153859 reg = ++pWalker->pParse->nMem; /* Register for column value */
153860 reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
153861 pExpr->op = TK_REGISTER;
153862 pExpr->iTable = reg;
153863 }else if( pHint->pIdx!=0 ){
153864 pExpr->iTable = pHint->iIdxCur;
153865 pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn);
153866 assert( pExpr->iColumn>=0 );
153867 }
153868 }else if( pExpr->pAggInfo ){
 
 
 
 
 
 
 
153869 rc = WRC_Prune;
153870 reg = ++pWalker->pParse->nMem; /* Register for column value */
153871 reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
153872 pExpr->op = TK_REGISTER;
153873 pExpr->iTable = reg;
153874 }
153875 return rc;
153876 }
153877
153878 /*
@@ -154170,11 +154764,11 @@
154764 ** of entries in the tree, so basing the number of steps to try
154765 ** on the estimated number of rows in the btree seems like a good
154766 ** guess. */
154767 addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154768 (pIdx->aiRowLogEst[0]+9)/10);
154769 if( pRangeStart || pRangeEnd ){
154770 sqlite3VdbeChangeP5(v, 1);
154771 sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154772 addrSeekScan = 0;
154773 }
154774 VdbeCoverage(v);
@@ -154211,20 +154805,11 @@
154805 */
154806 nConstraint = nEq;
154807 assert( pLevel->p2==0 );
154808 if( pRangeEnd ){
154809 Expr *pRight = pRangeEnd->pExpr->pRight;
154810 assert( addrSeekScan==0 );
 
 
 
 
 
 
 
 
 
154811 codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154812 whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154813 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154814 && sqlite3ExprCanBeNull(pRight)
154815 ){
@@ -154254,11 +154839,11 @@
154839 }
154840 if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154841 if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154842
154843 /* Top of the loop body */
154844 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154845
154846 /* Check if the index cursor is past the end of the range. */
154847 if( nConstraint ){
154848 if( regBignull ){
154849 /* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156896,13 +157481,16 @@
157481 pColRef->y.pTab = pTab;
157482 pItem->colUsed |= sqlite3ExprColUsed(pColRef);
157483 pRhs = sqlite3PExpr(pParse, TK_UPLUS,
157484 sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
157485 pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
157486 if( pItem->fg.jointype & (JT_LEFT|JT_RIGHT) ){
157487 testcase( pItem->fg.jointype & JT_LEFT ); /* testtag-20230227a */
157488 testcase( pItem->fg.jointype & JT_RIGHT ); /* testtag-20230227b */
157489 joinType = EP_OuterON;
157490 }else{
157491 testcase( pItem->fg.jointype & JT_LTORJ ); /* testtag-20230227c */
157492 joinType = EP_InnerON;
157493 }
157494 sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
157495 whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
157496 }
@@ -157741,11 +158329,11 @@
158329 Parse *pParse,
158330 Index *pIdx, /* Automatic index to explain */
158331 int bPartial, /* True if pIdx is a partial index */
158332 int *pAddrExplain /* OUT: Address of OP_Explain */
158333 ){
158334 if( IS_STMT_SCANSTATUS(pParse->db) && pParse->explain!=2 ){
158335 Table *pTab = pIdx->pTable;
158336 const char *zSep = "";
158337 char *zText = 0;
158338 int ii = 0;
158339 sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157802,11 +158390,12 @@
158390 CollSeq *pColl; /* Collating sequence to on a column */
158391 WhereLoop *pLoop; /* The Loop object */
158392 char *zNotUsed; /* Extra space on the end of pIdx */
158393 Bitmask idxCols; /* Bitmap of columns used for indexing */
158394 Bitmask extraCols; /* Bitmap of additional columns */
158395 u8 sentWarning = 0; /* True if a warning has been issued */
158396 u8 useBloomFilter = 0; /* True to also add a Bloom filter */
158397 Expr *pPartial = 0; /* Partial Index Expression */
158398 int iContinue = 0; /* Jump here to skip excluded rows */
158399 SrcItem *pTabItem; /* FROM clause term being indexed */
158400 int addrCounter = 0; /* Address where integer counter is initialized */
158401 int regBase; /* Array of registers where record is assembled */
@@ -157872,11 +158461,15 @@
158461 ** original table never needs to be accessed. Automatic indices must
158462 ** be a covering index because the index will not be updated if the
158463 ** original table changes and the index and table cannot both be used
158464 ** if they go out of sync.
158465 */
158466 if( IsView(pTable) ){
158467 extraCols = ALLBITS;
158468 }else{
158469 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
158470 }
158471 mxBitCol = MIN(BMS-1,pTable->nCol);
158472 testcase( pTable->nCol==BMS-1 );
158473 testcase( pTable->nCol==BMS-2 );
158474 for(i=0; i<mxBitCol; i++){
158475 if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157908,10 +158501,20 @@
158501 pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
158502 pColl = sqlite3ExprCompareCollSeq(pParse, pX);
158503 assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
158504 pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
158505 n++;
158506 if( ALWAYS(pX->pLeft!=0)
158507 && sqlite3ExprAffinity(pX->pLeft)!=SQLITE_AFF_TEXT
158508 ){
158509 /* TUNING: only use a Bloom filter on an automatic index
158510 ** if one or more key columns has the ability to hold numeric
158511 ** values, since strings all have the same hash in the Bloom
158512 ** filter implementation and hence a Bloom filter on a text column
158513 ** is not usually helpful. */
158514 useBloomFilter = 1;
158515 }
158516 }
158517 }
158518 }
158519 assert( (u32)n==pLoop->u.btree.nEq );
158520
@@ -157940,11 +158543,12 @@
158543 assert( pLevel->iIdxCur>=0 );
158544 pLevel->iIdxCur = pParse->nTab++;
158545 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
158546 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
158547 VdbeComment((v, "for %s", pTable->zName));
158548 if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) && useBloomFilter ){
158549 sqlite3WhereExplainBloomFilter(pParse, pWC->pWInfo, pLevel);
158550 pLevel->regFilter = ++pParse->nMem;
158551 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
158552 }
158553
158554 /* Fill the automatic index with content */
@@ -158033,10 +158637,14 @@
158637 const WhereTerm *pWCEnd; /* Last WHERE clause term */
158638 Parse *pParse = pWInfo->pParse; /* Parsing context */
158639 Vdbe *v = pParse->pVdbe; /* VDBE under construction */
158640 WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
158641 int iCur; /* Cursor for table getting the filter */
158642 IndexedExpr *saved_pIdxEpr; /* saved copy of Parse.pIdxEpr */
158643
158644 saved_pIdxEpr = pParse->pIdxEpr;
158645 pParse->pIdxEpr = 0;
158646
158647 assert( pLoop!=0 );
158648 assert( v!=0 );
158649 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158650
@@ -158089,13 +158697,12 @@
158697 Index *pIdx = pLoop->u.btree.pIndex;
158698 int n = pLoop->u.btree.nEq;
158699 int r1 = sqlite3GetTempRange(pParse, n);
158700 int jj;
158701 for(jj=0; jj<n; jj++){
 
158702 assert( pIdx->pTable==pItem->pTab );
158703 sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iCur, jj, r1+jj);
158704 }
158705 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158706 sqlite3ReleaseTempRange(pParse, r1, n);
158707 }
158708 sqlite3VdbeResolveLabel(v, addrCont);
@@ -158122,10 +158729,11 @@
158729 break;
158730 }
158731 }
158732 }while( iLevel < pWInfo->nLevel );
158733 sqlite3VdbeJumpHere(v, addrOnce);
158734 pParse->pIdxEpr = saved_pIdxEpr;
158735 }
158736
158737
158738 #ifndef SQLITE_OMIT_VIRTUALTABLE
158739 /*
@@ -158377,10 +158985,13 @@
158985 sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc));
158986 }else{
158987 sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg);
158988 }
158989 }
158990 if( pTab->u.vtab.p->bAllSchemas ){
158991 sqlite3VtabUsesAllSchemas(pParse);
158992 }
158993 sqlite3_free(pVtab->zErrMsg);
158994 pVtab->zErrMsg = 0;
158995 return rc;
158996 }
158997 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
@@ -158420,10 +159031,11 @@
159031 UNUSED_PARAMETER( pParse );
159032 #endif
159033 assert( pRec!=0 );
159034 assert( pIdx->nSample>0 );
159035 assert( pRec->nField>0 );
159036
159037
159038 /* Do a binary search to find the first sample greater than or equal
159039 ** to pRec. If pRec contains a single field, the set of samples to search
159040 ** is simply the aSample[] array. If the samples in aSample[] contain more
159041 ** than one fields, all fields following the first are ignored.
@@ -158465,11 +159077,16 @@
159077 ** appears that it should be 1 field in size. However, that would make it
159078 ** smaller than sample 1, so the binary search would not work. As a result,
159079 ** it is extended to two fields. The duplicates that this creates do not
159080 ** cause any problems.
159081 */
159082 if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
159083 nField = pIdx->nKeyCol;
159084 }else{
159085 nField = pIdx->nColumn;
159086 }
159087 nField = MIN(pRec->nField, nField);
159088 iCol = 0;
159089 iSample = pIdx->nSample * nField;
159090 do{
159091 int iSamp; /* Index in aSample[] of test sample */
159092 int n; /* Number of fields in test sample */
@@ -158901,11 +159518,11 @@
159518 #else
159519 UNUSED_PARAMETER(pParse);
159520 UNUSED_PARAMETER(pBuilder);
159521 assert( pLower || pUpper );
159522 #endif
159523 assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 || pParse->nErr>0 );
159524 nNew = whereRangeAdjust(pLower, nOut);
159525 nNew = whereRangeAdjust(pUpper, nNew);
159526
159527 /* TUNING: If there is both an upper and lower limit and neither limit
159528 ** has an application-defined likelihood(), assume the range is
@@ -161002,24 +161619,20 @@
161619 HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
161620 assert( pHidden->eDistinct>=0 && pHidden->eDistinct<=3 );
161621 return pHidden->eDistinct;
161622 }
161623
 
 
161624 /*
161625 ** Cause the prepared statement that is associated with a call to
161626 ** xBestIndex to potentially use all schemas. If the statement being
161627 ** prepared is read-only, then just start read transactions on all
161628 ** schemas. But if this is a write operation, start writes on all
161629 ** schemas.
161630 **
161631 ** This is used by the (built-in) sqlite_dbpage virtual table.
161632 */
161633 SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse *pParse){
 
 
161634 int nDb = pParse->db->nDb;
161635 int i;
161636 for(i=0; i<nDb; i++){
161637 sqlite3CodeVerifySchema(pParse, i);
161638 }
@@ -161027,11 +161640,10 @@
161640 for(i=0; i<nDb; i++){
161641 sqlite3BeginWriteOperation(pParse, 0, i);
161642 }
161643 }
161644 }
 
161645
161646 /*
161647 ** Add all WhereLoop objects for a table of the join identified by
161648 ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
161649 **
@@ -162193,10 +162805,14 @@
162805 pWInfo->nOBSat = pFrom->isOrdered;
162806 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162807 if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162808 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162809 }
162810 if( pWInfo->pSelect->pOrderBy
162811 && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){
162812 pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr;
162813 }
162814 }else{
162815 pWInfo->revMask = pFrom->revLoop;
162816 if( pWInfo->nOBSat<=0 ){
162817 pWInfo->nOBSat = 0;
162818 if( nLoop>0 ){
@@ -163122,11 +163738,11 @@
163738 for(; b; b=b>>1, n++){}
163739 sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163740 assert( n<=pTab->nCol );
163741 }
163742 #ifdef SQLITE_ENABLE_CURSOR_HINTS
163743 if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){
163744 sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163745 }else
163746 #endif
163747 {
163748 sqlite3VdbeChangeP5(v, bFordelete);
@@ -163580,11 +164196,12 @@
164196 }
164197 }
164198 k = pLevel->addrBody + 1;
164199 #ifdef SQLITE_DEBUG
164200 if( db->flags & SQLITE_VdbeAddopTrace ){
164201 printf("TRANSLATE cursor %d->%d in opcode range %d..%d\n",
164202 pLevel->iTabCur, pLevel->iIdxCur, k, last-1);
164203 }
164204 /* Proof that the "+1" on the k value above is safe */
164205 pOp = sqlite3VdbeGetOp(v, k - 1);
164206 assert( pOp->opcode!=OP_Column || pOp->p1!=pLevel->iTabCur );
164207 assert( pOp->opcode!=OP_Rowid || pOp->p1!=pLevel->iTabCur );
@@ -167283,22 +167900,22 @@
167900 #define sqlite3ParserCTX_PDECL ,Parse *pParse
167901 #define sqlite3ParserCTX_PARAM ,pParse
167902 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167903 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167904 #define YYFALLBACK 1
167905 #define YYNSTATE 575
167906 #define YYNRULE 403
167907 #define YYNRULE_WITH_ACTION 341
167908 #define YYNTOKEN 185
167909 #define YY_MAX_SHIFT 574
167910 #define YY_MIN_SHIFTREDUCE 833
167911 #define YY_MAX_SHIFTREDUCE 1235
167912 #define YY_ERROR_ACTION 1236
167913 #define YY_ACCEPT_ACTION 1237
167914 #define YY_NO_ACTION 1238
167915 #define YY_MIN_REDUCE 1239
167916 #define YY_MAX_REDUCE 1641
167917 /************* End control #defines *******************************************/
167918 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167919
167920 /* Define the yytestcase() macro to be a no-op if is not already defined
167921 ** otherwise.
@@ -167361,222 +167978,222 @@
167978 ** yy_reduce_ofst[] For each state, the offset into yy_action for
167979 ** shifting non-terminals after a reduce.
167980 ** yy_default[] Default action for each state.
167981 **
167982 *********** Begin parsing tables **********************************************/
167983 #define YY_ACTTAB_COUNT (2096)
167984 static const YYACTIONTYPE yy_action[] = {
167985 /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167986 /* 10 */ 568, 1310, 377, 1289, 408, 562, 562, 562, 568, 409,
167987 /* 20 */ 378, 1310, 1272, 41, 41, 41, 41, 208, 1521, 71,
167988 /* 30 */ 71, 969, 419, 41, 41, 491, 303, 279, 303, 970,
167989 /* 40 */ 397, 71, 71, 125, 126, 80, 1213, 1213, 1047, 1050,
167990 /* 50 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 476, 409,
167991 /* 60 */ 1237, 1, 1, 574, 2, 1241, 550, 118, 115, 229,
167992 /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1323,
167993 /* 80 */ 417, 523, 142, 125, 126, 80, 1213, 1213, 1047, 1050,
167994 /* 90 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 118, 115,
167995 /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167996 /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167997 /* 120 */ 442, 1562, 376, 1564, 1189, 375, 1160, 565, 1160, 565,
167998 /* 130 */ 409, 1562, 537, 259, 226, 444, 101, 145, 449, 316,
167999 /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
168000 /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1213, 1213, 1047,
168001 /* 160 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 142,
168002 /* 170 */ 294, 1189, 339, 448, 120, 120, 120, 119, 116, 444,
168003 /* 180 */ 127, 1189, 1190, 1189, 148, 441, 440, 568, 119, 116,
168004 /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
168005 /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
168006 /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
168007 /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1189, 1190,
168008 /* 230 */ 1189, 149, 1220, 409, 1220, 124, 124, 124, 124, 122,
168009 /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
168010 /* 250 */ 444, 465, 342, 1034, 1034, 1048, 1051, 125, 126, 80,
168011 /* 260 */ 1213, 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124,
168012 /* 270 */ 124, 124, 1275, 522, 222, 1189, 568, 409, 224, 514,
168013 /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
168014 /* 290 */ 120, 120, 119, 116, 444, 1005, 16, 16, 1189, 133,
168015 /* 300 */ 133, 125, 126, 80, 1213, 1213, 1047, 1050, 1037, 1037,
168016 /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
168017 /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1038, 546,
168018 /* 330 */ 1189, 373, 1189, 1190, 1189, 252, 1429, 399, 504, 501,
168019 /* 340 */ 500, 111, 560, 566, 4, 924, 924, 433, 499, 340,
168020 /* 350 */ 460, 328, 360, 394, 1233, 1189, 1190, 1189, 563, 568,
168021 /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
168022 /* 370 */ 116, 444, 284, 284, 369, 1575, 1601, 441, 440, 154,
168023 /* 380 */ 409, 445, 71, 71, 1282, 565, 1217, 1189, 1190, 1189,
168024 /* 390 */ 85, 1219, 271, 557, 543, 515, 1556, 568, 98, 1218,
168025 /* 400 */ 6, 1274, 472, 142, 125, 126, 80, 1213, 1213, 1047,
168026 /* 410 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 550,
168027 /* 420 */ 13, 13, 1024, 507, 1220, 1189, 1220, 549, 109, 109,
168028 /* 430 */ 222, 568, 1234, 175, 568, 427, 110, 197, 445, 569,
168029 /* 440 */ 445, 430, 1547, 1014, 325, 551, 1189, 270, 287, 368,
168030 /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
168031 /* 460 */ 316, 559, 1607, 122, 122, 122, 122, 121, 121, 120,
168032 /* 470 */ 120, 120, 119, 116, 444, 1014, 1014, 1016, 1017, 27,
168033 /* 480 */ 284, 284, 1189, 1190, 1189, 1155, 568, 1606, 409, 899,
168034 /* 490 */ 190, 550, 356, 565, 550, 935, 533, 517, 1155, 516,
168035 /* 500 */ 413, 1155, 552, 1189, 1190, 1189, 568, 544, 1549, 51,
168036 /* 510 */ 51, 214, 125, 126, 80, 1213, 1213, 1047, 1050, 1037,
168037 /* 520 */ 1037, 123, 123, 124, 124, 124, 124, 1189, 474, 135,
168038 /* 530 */ 135, 409, 284, 284, 1485, 505, 121, 121, 120, 120,
168039 /* 540 */ 120, 119, 116, 444, 1005, 565, 518, 217, 541, 1556,
168040 /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1213, 1213,
168041 /* 560 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
168042 /* 570 */ 1550, 122, 122, 122, 122, 121, 121, 120, 120, 120,
168043 /* 580 */ 119, 116, 444, 485, 1189, 1190, 1189, 482, 281, 1263,
168044 /* 590 */ 955, 252, 1189, 373, 504, 501, 500, 1189, 340, 570,
168045 /* 600 */ 1189, 570, 409, 292, 499, 955, 874, 191, 480, 316,
168046 /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
168047 /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168048 /* 630 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168049 /* 640 */ 124, 409, 394, 1133, 1189, 867, 100, 284, 284, 1189,
168050 /* 650 */ 1190, 1189, 373, 1090, 1189, 1190, 1189, 1189, 1190, 1189,
168051 /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1213, 1213,
168052 /* 670 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
168053 /* 680 */ 1428, 957, 568, 228, 956, 122, 122, 122, 122, 121,
168054 /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1155, 228, 1189,
168055 /* 700 */ 157, 1189, 1190, 1189, 1548, 13, 13, 301, 955, 1228,
168056 /* 710 */ 1155, 153, 409, 1155, 373, 1578, 1173, 5, 369, 1575,
168057 /* 720 */ 429, 1234, 3, 955, 122, 122, 122, 122, 121, 121,
168058 /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168059 /* 740 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168060 /* 750 */ 124, 409, 208, 567, 1189, 1025, 1189, 1190, 1189, 1189,
168061 /* 760 */ 388, 850, 155, 1547, 286, 402, 1095, 1095, 488, 568,
168062 /* 770 */ 465, 342, 1315, 1315, 1547, 125, 126, 80, 1213, 1213,
168063 /* 780 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
168064 /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
168065 /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
168066 /* 810 */ 528, 1189, 1190, 1189, 13, 13, 1189, 1190, 1189, 1293,
168067 /* 820 */ 463, 1263, 409, 1313, 1313, 1547, 1010, 453, 452, 200,
168068 /* 830 */ 299, 71, 71, 1261, 122, 122, 122, 122, 121, 121,
168069 /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168070 /* 850 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168071 /* 860 */ 124, 409, 227, 1070, 1155, 284, 284, 419, 312, 278,
168072 /* 870 */ 278, 285, 285, 1415, 406, 405, 382, 1155, 565, 568,
168073 /* 880 */ 1155, 1192, 565, 1595, 565, 125, 126, 80, 1213, 1213,
168074 /* 890 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
168075 /* 900 */ 453, 1477, 13, 13, 1531, 122, 122, 122, 122, 121,
168076 /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
168077 /* 920 */ 1581, 574, 2, 1241, 838, 839, 840, 1557, 317, 1208,
168078 /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1323, 9, 1192,
168079 /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
168080 /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
168081 /* 960 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168082 /* 970 */ 124, 568, 284, 284, 568, 1209, 409, 573, 313, 1241,
168083 /* 980 */ 349, 1292, 352, 419, 317, 565, 146, 491, 525, 1637,
168084 /* 990 */ 395, 371, 491, 1323, 70, 70, 1291, 71, 71, 240,
168085 /* 1000 */ 1321, 104, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123,
168086 /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
168087 /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1111, 284, 284,
168088 /* 1030 */ 428, 448, 1520, 1209, 439, 284, 284, 1484, 1348, 311,
168089 /* 1040 */ 474, 565, 1112, 969, 491, 491, 217, 1259, 565, 1533,
168090 /* 1050 */ 568, 970, 207, 568, 1024, 240, 383, 1113, 519, 122,
168091 /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
168092 /* 1070 */ 444, 1015, 107, 71, 71, 1014, 13, 13, 910, 568,
168093 /* 1080 */ 1490, 568, 284, 284, 97, 526, 491, 448, 911, 1322,
168094 /* 1090 */ 1318, 545, 409, 284, 284, 565, 151, 209, 1490, 1492,
168095 /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1014, 1014, 1016,
168096 /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1213,
168097 /* 1120 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168098 /* 1130 */ 124, 347, 409, 862, 1529, 1209, 125, 126, 80, 1213,
168099 /* 1140 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168100 /* 1150 */ 124, 1134, 1635, 474, 1635, 371, 125, 114, 80, 1213,
168101 /* 1160 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
168102 /* 1170 */ 124, 1490, 329, 474, 331, 122, 122, 122, 122, 121,
168103 /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1415, 568,
168104 /* 1190 */ 1290, 862, 464, 1209, 436, 122, 122, 122, 122, 121,
168105 /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1134, 1636,
168106 /* 1210 */ 539, 1636, 15, 15, 890, 122, 122, 122, 122, 121,
168107 /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
168108 /* 1230 */ 1132, 1415, 1554, 1555, 1327, 409, 6, 6, 1166, 1264,
168109 /* 1240 */ 415, 320, 284, 284, 1415, 508, 565, 525, 300, 457,
168110 /* 1250 */ 43, 43, 568, 891, 12, 565, 330, 478, 425, 407,
168111 /* 1260 */ 126, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123, 123,
168112 /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1189, 1415,
168113 /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1132, 1553, 847,
168114 /* 1290 */ 1166, 407, 6, 568, 321, 1155, 470, 44, 44, 1552,
168115 /* 1300 */ 1111, 426, 234, 6, 323, 256, 540, 256, 1155, 431,
168116 /* 1310 */ 568, 1155, 322, 17, 487, 1112, 58, 58, 122, 122,
168117 /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
168118 /* 1330 */ 1113, 216, 481, 59, 59, 1189, 1190, 1189, 111, 560,
168119 /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
168120 /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1092,
168121 /* 1360 */ 568, 293, 568, 1092, 531, 568, 870, 8, 60, 60,
168122 /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
168123 /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
168124 /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
168125 /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1024, 568, 534,
168126 /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1024,
168127 /* 1420 */ 568, 512, 930, 870, 1015, 109, 109, 929, 1014, 66,
168128 /* 1430 */ 66, 131, 131, 110, 451, 445, 569, 445, 416, 177,
168129 /* 1440 */ 1014, 132, 132, 67, 67, 568, 467, 568, 930, 471,
168130 /* 1450 */ 1360, 283, 226, 929, 315, 1359, 407, 568, 459, 407,
168131 /* 1460 */ 1014, 1014, 1016, 239, 407, 86, 213, 1346, 52, 52,
168132 /* 1470 */ 68, 68, 1014, 1014, 1016, 1017, 27, 1580, 1177, 447,
168133 /* 1480 */ 69, 69, 288, 97, 108, 1536, 106, 392, 392, 391,
168134 /* 1490 */ 273, 389, 568, 877, 847, 881, 568, 111, 560, 466,
168135 /* 1500 */ 4, 568, 152, 30, 38, 568, 1129, 234, 396, 323,
168136 /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
168137 /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
168138 /* 1530 */ 568, 289, 1509, 568, 31, 1508, 568, 445, 338, 483,
168139 /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1077, 557,
168140 /* 1550 */ 445, 877, 1356, 134, 134, 168, 73, 73, 141, 161,
168141 /* 1560 */ 161, 1569, 557, 535, 568, 319, 568, 348, 536, 1007,
168142 /* 1570 */ 473, 261, 261, 889, 888, 235, 535, 568, 1024, 568,
168143 /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
168144 /* 1590 */ 130, 1024, 110, 366, 445, 569, 445, 109, 109, 1014,
168145 /* 1600 */ 162, 162, 156, 156, 568, 110, 1077, 445, 569, 445,
168146 /* 1610 */ 410, 351, 1014, 568, 353, 316, 559, 568, 343, 568,
168147 /* 1620 */ 100, 497, 357, 258, 100, 896, 897, 140, 140, 355,
168148 /* 1630 */ 1306, 1014, 1014, 1016, 1017, 27, 139, 139, 362, 451,
168149 /* 1640 */ 137, 137, 138, 138, 1014, 1014, 1016, 1017, 27, 1177,
168150 /* 1650 */ 447, 568, 372, 288, 111, 560, 1018, 4, 392, 392,
168151 /* 1660 */ 391, 273, 389, 568, 1138, 847, 568, 1073, 568, 258,
168152 /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 960, 234, 261,
168153 /* 1680 */ 323, 111, 560, 927, 4, 113, 77, 77, 322, 74,
168154 /* 1690 */ 74, 42, 42, 1369, 445, 48, 48, 1414, 563, 972,
168155 /* 1700 */ 973, 1089, 1088, 1089, 1088, 860, 557, 150, 928, 1342,
168156 /* 1710 */ 113, 1354, 554, 1419, 1018, 1271, 1262, 1250, 236, 1249,
168157 /* 1720 */ 1251, 445, 1588, 1339, 308, 276, 168, 309, 11, 141,
168158 /* 1730 */ 393, 310, 232, 557, 1401, 1024, 335, 291, 1396, 219,
168159 /* 1740 */ 336, 109, 109, 934, 297, 1406, 235, 341, 477, 110,
168160 /* 1750 */ 502, 445, 569, 445, 1389, 1405, 1014, 400, 1289, 365,
168161 /* 1760 */ 223, 1481, 1024, 1480, 1351, 1352, 1350, 1349, 109, 109,
168162 /* 1770 */ 204, 1591, 1228, 558, 265, 218, 110, 205, 445, 569,
168163 /* 1780 */ 445, 410, 387, 1014, 1528, 179, 316, 559, 1014, 1014,
168164 /* 1790 */ 1016, 1017, 27, 230, 1526, 1225, 79, 560, 85, 4,
168165 /* 1800 */ 418, 215, 548, 81, 84, 188, 1402, 173, 181, 461,
168166 /* 1810 */ 451, 35, 462, 563, 183, 1014, 1014, 1016, 1017, 27,
168167 /* 1820 */ 184, 1486, 185, 186, 495, 242, 98, 398, 1408, 36,
168168 /* 1830 */ 1407, 484, 91, 469, 401, 1410, 445, 192, 1475, 246,
168169 /* 1840 */ 1497, 490, 346, 277, 248, 196, 493, 511, 557, 350,
168170 /* 1850 */ 1252, 249, 250, 403, 1309, 1308, 111, 560, 432, 4,
168171 /* 1860 */ 1307, 1300, 93, 1605, 881, 1604, 224, 404, 434, 520,
168172 /* 1870 */ 263, 435, 1574, 563, 1279, 1278, 364, 1024, 306, 1277,
168173 /* 1880 */ 264, 1603, 1560, 109, 109, 370, 1299, 307, 1559, 438,
168174 /* 1890 */ 128, 110, 1374, 445, 569, 445, 445, 546, 1014, 10,
168175 /* 1900 */ 1461, 105, 381, 1373, 34, 571, 99, 1332, 557, 314,
168176 /* 1910 */ 1183, 530, 272, 274, 379, 210, 1331, 547, 385, 386,
168177 /* 1920 */ 275, 572, 1247, 1242, 411, 412, 1513, 165, 178, 1514,
168178 /* 1930 */ 1014, 1014, 1016, 1017, 27, 1512, 1511, 1024, 78, 147,
168179 /* 1940 */ 166, 220, 221, 109, 109, 834, 304, 167, 446, 212,
168180 /* 1950 */ 318, 110, 231, 445, 569, 445, 144, 1087, 1014, 1085,
168181 /* 1960 */ 326, 180, 169, 1208, 182, 334, 238, 913, 241, 1101,
168182 /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
168183 /* 1980 */ 172, 1104, 243, 1100, 244, 158, 18, 245, 345, 247,
168184 /* 1990 */ 1014, 1014, 1016, 1017, 27, 261, 1093, 193, 1222, 489,
168185 /* 2000 */ 194, 37, 366, 849, 494, 251, 195, 506, 92, 19,
168186 /* 2010 */ 498, 358, 20, 503, 879, 361, 94, 892, 305, 159,
168187 /* 2020 */ 513, 39, 95, 1171, 160, 1053, 964, 1140, 96, 174,
168188 /* 2030 */ 1139, 225, 280, 282, 198, 958, 113, 1161, 1157, 260,
168189 /* 2040 */ 21, 22, 23, 1159, 1165, 1164, 1145, 24, 33, 25,
168190 /* 2050 */ 202, 542, 26, 100, 1068, 102, 1054, 103, 7, 1052,
168191 /* 2060 */ 1056, 1110, 1057, 1109, 266, 267, 28, 40, 390, 1019,
168192 /* 2070 */ 861, 112, 29, 564, 1179, 1178, 268, 176, 143, 923,
168193 /* 2080 */ 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
168194 /* 2090 */ 1238, 1238, 1238, 1238, 269, 1596,
168195 };
168196 static const YYCODETYPE yy_lookahead[] = {
168197 /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
168198 /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
168199 /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167784,11 +168401,11 @@
168401 /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
168402 /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
168403 /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
168404 /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
168405 /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168406 /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 319, 319, 319,
168407 /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168408 /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168409 /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168410 /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168411 /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167803,13 +168420,13 @@
168420 /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168421 /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168422 /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168423 /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168424 /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168425 /* 2280 */ 319,
168426 };
168427 #define YY_SHIFT_COUNT (574)
168428 #define YY_SHIFT_MIN (0)
168429 #define YY_SHIFT_MAX (2074)
168430 static const unsigned short int yy_shift_ofst[] = {
168431 /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
168432 /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167825,16 +168442,16 @@
168442 /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
168443 /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
168444 /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
168445 /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
168446 /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
168447 /* 160 */ 113, 22, 22, 2096, 2096, 328, 328, 328, 239, 468,
168448 /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
168449 /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
168450 /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
168451 /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
168452 /* 210 */ 67, 1274, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 1307,
168453 /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
168454 /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
168455 /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
168456 /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
168457 /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167848,12 +168465,12 @@
168465 /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
168466 /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
168467 /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
168468 /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
168469 /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
168470 /* 390 */ 1897, 1914, 1914, 1914, 2096, 2096, 2096, 2096, 2096, 2096,
168471 /* 400 */ 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 207,
168472 /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
168473 /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
168474 /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
168475 /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
168476 /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167866,11 +168483,11 @@
168483 /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
168484 /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
168485 /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
168486 /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
168487 /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
168488 /* 570 */ 2052, 2055, 2053, 2073, 2074,
168489 };
168490 #define YY_REDUCE_COUNT (408)
168491 #define YY_REDUCE_MIN (-271)
168492 #define YY_REDUCE_MAX (1740)
168493 static const short yy_reduce_ofst[] = {
@@ -167915,68 +168532,68 @@
168532 /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
168533 /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
168534 /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
168535 };
168536 static const YYACTIONTYPE yy_default[] = {
168537 /* 0 */ 1641, 1641, 1641, 1470, 1236, 1347, 1236, 1236, 1236, 1470,
168538 /* 10 */ 1470, 1470, 1236, 1377, 1377, 1523, 1269, 1236, 1236, 1236,
168539 /* 20 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1469, 1236, 1236,
168540 /* 30 */ 1236, 1236, 1558, 1558, 1236, 1236, 1236, 1236, 1236, 1236,
168541 /* 40 */ 1236, 1236, 1386, 1236, 1393, 1236, 1236, 1236, 1236, 1236,
168542 /* 50 */ 1471, 1472, 1236, 1236, 1236, 1522, 1524, 1487, 1400, 1399,
168543 /* 60 */ 1398, 1397, 1505, 1365, 1391, 1384, 1388, 1465, 1466, 1464,
168544 /* 70 */ 1468, 1472, 1471, 1236, 1387, 1433, 1449, 1432, 1236, 1236,
168545 /* 80 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168546 /* 90 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168547 /* 100 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168548 /* 110 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168549 /* 120 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168550 /* 130 */ 1441, 1448, 1447, 1446, 1455, 1445, 1442, 1435, 1434, 1436,
168551 /* 140 */ 1437, 1236, 1236, 1260, 1236, 1236, 1257, 1311, 1236, 1236,
168552 /* 150 */ 1236, 1236, 1236, 1542, 1541, 1236, 1438, 1236, 1269, 1427,
168553 /* 160 */ 1426, 1452, 1439, 1451, 1450, 1530, 1594, 1593, 1488, 1236,
168554 /* 170 */ 1236, 1236, 1236, 1236, 1236, 1558, 1236, 1236, 1236, 1236,
168555 /* 180 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168556 /* 190 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1367,
168557 /* 200 */ 1558, 1558, 1236, 1269, 1558, 1558, 1368, 1368, 1265, 1265,
168558 /* 210 */ 1371, 1236, 1537, 1338, 1338, 1338, 1338, 1347, 1338, 1236,
168559 /* 220 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168560 /* 230 */ 1236, 1236, 1236, 1236, 1527, 1525, 1236, 1236, 1236, 1236,
168561 /* 240 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168562 /* 250 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168563 /* 260 */ 1236, 1236, 1236, 1343, 1236, 1236, 1236, 1236, 1236, 1236,
168564 /* 270 */ 1236, 1236, 1236, 1236, 1236, 1587, 1236, 1500, 1325, 1343,
168565 /* 280 */ 1343, 1343, 1343, 1345, 1326, 1324, 1337, 1270, 1243, 1633,
168566 /* 290 */ 1403, 1392, 1344, 1392, 1630, 1390, 1403, 1403, 1390, 1403,
168567 /* 300 */ 1344, 1630, 1286, 1609, 1281, 1377, 1377, 1377, 1367, 1367,
168568 /* 310 */ 1367, 1367, 1371, 1371, 1467, 1344, 1337, 1236, 1633, 1633,
168569 /* 320 */ 1353, 1353, 1632, 1632, 1353, 1488, 1617, 1412, 1314, 1320,
168570 /* 330 */ 1320, 1320, 1320, 1353, 1254, 1390, 1617, 1617, 1390, 1412,
168571 /* 340 */ 1314, 1390, 1314, 1390, 1353, 1254, 1504, 1627, 1353, 1254,
168572 /* 350 */ 1478, 1353, 1254, 1353, 1254, 1478, 1312, 1312, 1312, 1301,
168573 /* 360 */ 1236, 1236, 1478, 1312, 1286, 1312, 1301, 1312, 1312, 1576,
168574 /* 370 */ 1236, 1482, 1482, 1478, 1353, 1568, 1568, 1380, 1380, 1385,
168575 /* 380 */ 1371, 1473, 1353, 1236, 1385, 1383, 1381, 1390, 1304, 1590,
168576 /* 390 */ 1590, 1586, 1586, 1586, 1638, 1638, 1537, 1602, 1269, 1269,
168577 /* 400 */ 1269, 1269, 1602, 1288, 1288, 1270, 1270, 1269, 1602, 1236,
168578 /* 410 */ 1236, 1236, 1236, 1236, 1236, 1597, 1236, 1532, 1489, 1357,
168579 /* 420 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168580 /* 430 */ 1236, 1236, 1236, 1236, 1543, 1236, 1236, 1236, 1236, 1236,
168581 /* 440 */ 1236, 1236, 1236, 1236, 1236, 1417, 1236, 1239, 1534, 1236,
168582 /* 450 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1394, 1395, 1358,
168583 /* 460 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1409, 1236, 1236,
168584 /* 470 */ 1236, 1404, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168585 /* 480 */ 1629, 1236, 1236, 1236, 1236, 1236, 1236, 1503, 1502, 1236,
168586 /* 490 */ 1236, 1355, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168587 /* 500 */ 1236, 1236, 1236, 1236, 1236, 1284, 1236, 1236, 1236, 1236,
168588 /* 510 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168589 /* 520 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1382,
168590 /* 530 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168591 /* 540 */ 1236, 1236, 1236, 1236, 1573, 1372, 1236, 1236, 1236, 1236,
168592 /* 550 */ 1620, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168593 /* 560 */ 1236, 1236, 1236, 1236, 1236, 1613, 1328, 1418, 1236, 1421,
168594 /* 570 */ 1258, 1236, 1248, 1236, 1236,
168595 };
168596 /********** End of lemon-generated parsing tables *****************************/
168597
168598 /* The next table maps tokens (terminal symbols) into fallback tokens.
168599 ** If a construct like the following:
@@ -168769,237 +169386,235 @@
169386 /* 173 */ "idlist_opt ::=",
169387 /* 174 */ "idlist_opt ::= LP idlist RP",
169388 /* 175 */ "idlist ::= idlist COMMA nm",
169389 /* 176 */ "idlist ::= nm",
169390 /* 177 */ "expr ::= LP expr RP",
169391 /* 178 */ "expr ::= ID|INDEXED|JOIN_KW",
169392 /* 179 */ "expr ::= nm DOT nm",
169393 /* 180 */ "expr ::= nm DOT nm DOT nm",
169394 /* 181 */ "term ::= NULL|FLOAT|BLOB",
169395 /* 182 */ "term ::= STRING",
169396 /* 183 */ "term ::= INTEGER",
169397 /* 184 */ "expr ::= VARIABLE",
169398 /* 185 */ "expr ::= expr COLLATE ID|STRING",
169399 /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
169400 /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP",
169401 /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP",
169402 /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over",
169403 /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over",
169404 /* 191 */ "term ::= CTIME_KW",
169405 /* 192 */ "expr ::= LP nexprlist COMMA expr RP",
169406 /* 193 */ "expr ::= expr AND expr",
169407 /* 194 */ "expr ::= expr OR expr",
169408 /* 195 */ "expr ::= expr LT|GT|GE|LE expr",
169409 /* 196 */ "expr ::= expr EQ|NE expr",
169410 /* 197 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
169411 /* 198 */ "expr ::= expr PLUS|MINUS expr",
169412 /* 199 */ "expr ::= expr STAR|SLASH|REM expr",
169413 /* 200 */ "expr ::= expr CONCAT expr",
169414 /* 201 */ "likeop ::= NOT LIKE_KW|MATCH",
169415 /* 202 */ "expr ::= expr likeop expr",
169416 /* 203 */ "expr ::= expr likeop expr ESCAPE expr",
169417 /* 204 */ "expr ::= expr ISNULL|NOTNULL",
169418 /* 205 */ "expr ::= expr NOT NULL",
169419 /* 206 */ "expr ::= expr IS expr",
169420 /* 207 */ "expr ::= expr IS NOT expr",
169421 /* 208 */ "expr ::= expr IS NOT DISTINCT FROM expr",
169422 /* 209 */ "expr ::= expr IS DISTINCT FROM expr",
169423 /* 210 */ "expr ::= NOT expr",
169424 /* 211 */ "expr ::= BITNOT expr",
169425 /* 212 */ "expr ::= PLUS|MINUS expr",
169426 /* 213 */ "expr ::= expr PTR expr",
169427 /* 214 */ "between_op ::= BETWEEN",
169428 /* 215 */ "between_op ::= NOT BETWEEN",
169429 /* 216 */ "expr ::= expr between_op expr AND expr",
169430 /* 217 */ "in_op ::= IN",
169431 /* 218 */ "in_op ::= NOT IN",
169432 /* 219 */ "expr ::= expr in_op LP exprlist RP",
169433 /* 220 */ "expr ::= LP select RP",
169434 /* 221 */ "expr ::= expr in_op LP select RP",
169435 /* 222 */ "expr ::= expr in_op nm dbnm paren_exprlist",
169436 /* 223 */ "expr ::= EXISTS LP select RP",
169437 /* 224 */ "expr ::= CASE case_operand case_exprlist case_else END",
169438 /* 225 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
169439 /* 226 */ "case_exprlist ::= WHEN expr THEN expr",
169440 /* 227 */ "case_else ::= ELSE expr",
169441 /* 228 */ "case_else ::=",
169442 /* 229 */ "case_operand ::= expr",
169443 /* 230 */ "case_operand ::=",
169444 /* 231 */ "exprlist ::=",
169445 /* 232 */ "nexprlist ::= nexprlist COMMA expr",
169446 /* 233 */ "nexprlist ::= expr",
169447 /* 234 */ "paren_exprlist ::=",
169448 /* 235 */ "paren_exprlist ::= LP exprlist RP",
169449 /* 236 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
169450 /* 237 */ "uniqueflag ::= UNIQUE",
169451 /* 238 */ "uniqueflag ::=",
169452 /* 239 */ "eidlist_opt ::=",
169453 /* 240 */ "eidlist_opt ::= LP eidlist RP",
169454 /* 241 */ "eidlist ::= eidlist COMMA nm collate sortorder",
169455 /* 242 */ "eidlist ::= nm collate sortorder",
169456 /* 243 */ "collate ::=",
169457 /* 244 */ "collate ::= COLLATE ID|STRING",
169458 /* 245 */ "cmd ::= DROP INDEX ifexists fullname",
169459 /* 246 */ "cmd ::= VACUUM vinto",
169460 /* 247 */ "cmd ::= VACUUM nm vinto",
169461 /* 248 */ "vinto ::= INTO expr",
169462 /* 249 */ "vinto ::=",
169463 /* 250 */ "cmd ::= PRAGMA nm dbnm",
169464 /* 251 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
169465 /* 252 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
169466 /* 253 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
169467 /* 254 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
169468 /* 255 */ "plus_num ::= PLUS INTEGER|FLOAT",
169469 /* 256 */ "minus_num ::= MINUS INTEGER|FLOAT",
169470 /* 257 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
169471 /* 258 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
169472 /* 259 */ "trigger_time ::= BEFORE|AFTER",
169473 /* 260 */ "trigger_time ::= INSTEAD OF",
169474 /* 261 */ "trigger_time ::=",
169475 /* 262 */ "trigger_event ::= DELETE|INSERT",
169476 /* 263 */ "trigger_event ::= UPDATE",
169477 /* 264 */ "trigger_event ::= UPDATE OF idlist",
169478 /* 265 */ "when_clause ::=",
169479 /* 266 */ "when_clause ::= WHEN expr",
169480 /* 267 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
169481 /* 268 */ "trigger_cmd_list ::= trigger_cmd SEMI",
169482 /* 269 */ "trnm ::= nm DOT nm",
169483 /* 270 */ "tridxby ::= INDEXED BY nm",
169484 /* 271 */ "tridxby ::= NOT INDEXED",
169485 /* 272 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
169486 /* 273 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
169487 /* 274 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
169488 /* 275 */ "trigger_cmd ::= scanpt select scanpt",
169489 /* 276 */ "expr ::= RAISE LP IGNORE RP",
169490 /* 277 */ "expr ::= RAISE LP raisetype COMMA nm RP",
169491 /* 278 */ "raisetype ::= ROLLBACK",
169492 /* 279 */ "raisetype ::= ABORT",
169493 /* 280 */ "raisetype ::= FAIL",
169494 /* 281 */ "cmd ::= DROP TRIGGER ifexists fullname",
169495 /* 282 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
169496 /* 283 */ "cmd ::= DETACH database_kw_opt expr",
169497 /* 284 */ "key_opt ::=",
169498 /* 285 */ "key_opt ::= KEY expr",
169499 /* 286 */ "cmd ::= REINDEX",
169500 /* 287 */ "cmd ::= REINDEX nm dbnm",
169501 /* 288 */ "cmd ::= ANALYZE",
169502 /* 289 */ "cmd ::= ANALYZE nm dbnm",
169503 /* 290 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
169504 /* 291 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
169505 /* 292 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
169506 /* 293 */ "add_column_fullname ::= fullname",
169507 /* 294 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
169508 /* 295 */ "cmd ::= create_vtab",
169509 /* 296 */ "cmd ::= create_vtab LP vtabarglist RP",
169510 /* 297 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
169511 /* 298 */ "vtabarg ::=",
169512 /* 299 */ "vtabargtoken ::= ANY",
169513 /* 300 */ "vtabargtoken ::= lp anylist RP",
169514 /* 301 */ "lp ::= LP",
169515 /* 302 */ "with ::= WITH wqlist",
169516 /* 303 */ "with ::= WITH RECURSIVE wqlist",
169517 /* 304 */ "wqas ::= AS",
169518 /* 305 */ "wqas ::= AS MATERIALIZED",
169519 /* 306 */ "wqas ::= AS NOT MATERIALIZED",
169520 /* 307 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
169521 /* 308 */ "wqlist ::= wqitem",
169522 /* 309 */ "wqlist ::= wqlist COMMA wqitem",
169523 /* 310 */ "windowdefn_list ::= windowdefn",
169524 /* 311 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
169525 /* 312 */ "windowdefn ::= nm AS LP window RP",
169526 /* 313 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
169527 /* 314 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
169528 /* 315 */ "window ::= ORDER BY sortlist frame_opt",
169529 /* 316 */ "window ::= nm ORDER BY sortlist frame_opt",
169530 /* 317 */ "window ::= frame_opt",
169531 /* 318 */ "window ::= nm frame_opt",
169532 /* 319 */ "frame_opt ::=",
169533 /* 320 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
169534 /* 321 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
169535 /* 322 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
169536 /* 323 */ "frame_bound_s ::= frame_bound",
169537 /* 324 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
169538 /* 325 */ "frame_bound_e ::= frame_bound",
169539 /* 326 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
169540 /* 327 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
169541 /* 328 */ "frame_bound ::= CURRENT ROW",
169542 /* 329 */ "frame_exclude_opt ::=",
169543 /* 330 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
169544 /* 331 */ "frame_exclude ::= NO OTHERS",
169545 /* 332 */ "frame_exclude ::= CURRENT ROW",
169546 /* 333 */ "frame_exclude ::= GROUP|TIES",
169547 /* 334 */ "window_clause ::= WINDOW windowdefn_list",
169548 /* 335 */ "filter_over ::= filter_clause over_clause",
169549 /* 336 */ "filter_over ::= over_clause",
169550 /* 337 */ "filter_over ::= filter_clause",
169551 /* 338 */ "over_clause ::= OVER LP window RP",
169552 /* 339 */ "over_clause ::= OVER nm",
169553 /* 340 */ "filter_clause ::= FILTER LP WHERE expr RP",
169554 /* 341 */ "input ::= cmdlist",
169555 /* 342 */ "cmdlist ::= cmdlist ecmd",
169556 /* 343 */ "cmdlist ::= ecmd",
169557 /* 344 */ "ecmd ::= SEMI",
169558 /* 345 */ "ecmd ::= cmdx SEMI",
169559 /* 346 */ "ecmd ::= explain cmdx SEMI",
169560 /* 347 */ "trans_opt ::=",
169561 /* 348 */ "trans_opt ::= TRANSACTION",
169562 /* 349 */ "trans_opt ::= TRANSACTION nm",
169563 /* 350 */ "savepoint_opt ::= SAVEPOINT",
169564 /* 351 */ "savepoint_opt ::=",
169565 /* 352 */ "cmd ::= create_table create_table_args",
169566 /* 353 */ "table_option_set ::= table_option",
169567 /* 354 */ "columnlist ::= columnlist COMMA columnname carglist",
169568 /* 355 */ "columnlist ::= columnname carglist",
169569 /* 356 */ "nm ::= ID|INDEXED|JOIN_KW",
169570 /* 357 */ "nm ::= STRING",
169571 /* 358 */ "typetoken ::= typename",
169572 /* 359 */ "typename ::= ID|STRING",
169573 /* 360 */ "signed ::= plus_num",
169574 /* 361 */ "signed ::= minus_num",
169575 /* 362 */ "carglist ::= carglist ccons",
169576 /* 363 */ "carglist ::=",
169577 /* 364 */ "ccons ::= NULL onconf",
169578 /* 365 */ "ccons ::= GENERATED ALWAYS AS generated",
169579 /* 366 */ "ccons ::= AS generated",
169580 /* 367 */ "conslist_opt ::= COMMA conslist",
169581 /* 368 */ "conslist ::= conslist tconscomma tcons",
169582 /* 369 */ "conslist ::= tcons",
169583 /* 370 */ "tconscomma ::=",
169584 /* 371 */ "defer_subclause_opt ::= defer_subclause",
169585 /* 372 */ "resolvetype ::= raisetype",
169586 /* 373 */ "selectnowith ::= oneselect",
169587 /* 374 */ "oneselect ::= values",
169588 /* 375 */ "sclp ::= selcollist COMMA",
169589 /* 376 */ "as ::= ID|STRING",
169590 /* 377 */ "indexed_opt ::= indexed_by",
169591 /* 378 */ "returning ::=",
169592 /* 379 */ "expr ::= term",
169593 /* 380 */ "likeop ::= LIKE_KW|MATCH",
169594 /* 381 */ "exprlist ::= nexprlist",
169595 /* 382 */ "nmnum ::= plus_num",
169596 /* 383 */ "nmnum ::= nm",
169597 /* 384 */ "nmnum ::= ON",
169598 /* 385 */ "nmnum ::= DELETE",
169599 /* 386 */ "nmnum ::= DEFAULT",
169600 /* 387 */ "plus_num ::= INTEGER|FLOAT",
169601 /* 388 */ "foreach_clause ::=",
169602 /* 389 */ "foreach_clause ::= FOR EACH ROW",
169603 /* 390 */ "trnm ::= nm",
169604 /* 391 */ "tridxby ::=",
169605 /* 392 */ "database_kw_opt ::= DATABASE",
169606 /* 393 */ "database_kw_opt ::=",
169607 /* 394 */ "kwcolumn_opt ::=",
169608 /* 395 */ "kwcolumn_opt ::= COLUMNKW",
169609 /* 396 */ "vtabarglist ::= vtabarg",
169610 /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
169611 /* 398 */ "vtabarg ::= vtabarg vtabargtoken",
169612 /* 399 */ "anylist ::=",
169613 /* 400 */ "anylist ::= anylist LP anylist RP",
169614 /* 401 */ "anylist ::= anylist ANY",
169615 /* 402 */ "with ::=",
 
 
169616 };
169617 #endif /* NDEBUG */
169618
169619
169620 #if YYSTACKDEPTH<=0
@@ -169680,237 +170295,235 @@
170295 270, /* (173) idlist_opt ::= */
170296 270, /* (174) idlist_opt ::= LP idlist RP */
170297 263, /* (175) idlist ::= idlist COMMA nm */
170298 263, /* (176) idlist ::= nm */
170299 217, /* (177) expr ::= LP expr RP */
170300 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170301 217, /* (179) expr ::= nm DOT nm */
170302 217, /* (180) expr ::= nm DOT nm DOT nm */
170303 216, /* (181) term ::= NULL|FLOAT|BLOB */
170304 216, /* (182) term ::= STRING */
170305 216, /* (183) term ::= INTEGER */
170306 217, /* (184) expr ::= VARIABLE */
170307 217, /* (185) expr ::= expr COLLATE ID|STRING */
170308 217, /* (186) expr ::= CAST LP expr AS typetoken RP */
170309 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170310 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170311 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170312 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170313 216, /* (191) term ::= CTIME_KW */
170314 217, /* (192) expr ::= LP nexprlist COMMA expr RP */
170315 217, /* (193) expr ::= expr AND expr */
170316 217, /* (194) expr ::= expr OR expr */
170317 217, /* (195) expr ::= expr LT|GT|GE|LE expr */
170318 217, /* (196) expr ::= expr EQ|NE expr */
170319 217, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170320 217, /* (198) expr ::= expr PLUS|MINUS expr */
170321 217, /* (199) expr ::= expr STAR|SLASH|REM expr */
170322 217, /* (200) expr ::= expr CONCAT expr */
170323 274, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170324 217, /* (202) expr ::= expr likeop expr */
170325 217, /* (203) expr ::= expr likeop expr ESCAPE expr */
170326 217, /* (204) expr ::= expr ISNULL|NOTNULL */
170327 217, /* (205) expr ::= expr NOT NULL */
170328 217, /* (206) expr ::= expr IS expr */
170329 217, /* (207) expr ::= expr IS NOT expr */
170330 217, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170331 217, /* (209) expr ::= expr IS DISTINCT FROM expr */
170332 217, /* (210) expr ::= NOT expr */
170333 217, /* (211) expr ::= BITNOT expr */
170334 217, /* (212) expr ::= PLUS|MINUS expr */
170335 217, /* (213) expr ::= expr PTR expr */
170336 275, /* (214) between_op ::= BETWEEN */
170337 275, /* (215) between_op ::= NOT BETWEEN */
170338 217, /* (216) expr ::= expr between_op expr AND expr */
170339 276, /* (217) in_op ::= IN */
170340 276, /* (218) in_op ::= NOT IN */
170341 217, /* (219) expr ::= expr in_op LP exprlist RP */
170342 217, /* (220) expr ::= LP select RP */
170343 217, /* (221) expr ::= expr in_op LP select RP */
170344 217, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170345 217, /* (223) expr ::= EXISTS LP select RP */
170346 217, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170347 279, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170348 279, /* (226) case_exprlist ::= WHEN expr THEN expr */
170349 280, /* (227) case_else ::= ELSE expr */
170350 280, /* (228) case_else ::= */
170351 278, /* (229) case_operand ::= expr */
170352 278, /* (230) case_operand ::= */
170353 261, /* (231) exprlist ::= */
170354 253, /* (232) nexprlist ::= nexprlist COMMA expr */
170355 253, /* (233) nexprlist ::= expr */
170356 277, /* (234) paren_exprlist ::= */
170357 277, /* (235) paren_exprlist ::= LP exprlist RP */
170358 190, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170359 281, /* (237) uniqueflag ::= UNIQUE */
170360 281, /* (238) uniqueflag ::= */
170361 221, /* (239) eidlist_opt ::= */
170362 221, /* (240) eidlist_opt ::= LP eidlist RP */
170363 232, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170364 232, /* (242) eidlist ::= nm collate sortorder */
170365 282, /* (243) collate ::= */
170366 282, /* (244) collate ::= COLLATE ID|STRING */
170367 190, /* (245) cmd ::= DROP INDEX ifexists fullname */
170368 190, /* (246) cmd ::= VACUUM vinto */
170369 190, /* (247) cmd ::= VACUUM nm vinto */
170370 283, /* (248) vinto ::= INTO expr */
170371 283, /* (249) vinto ::= */
170372 190, /* (250) cmd ::= PRAGMA nm dbnm */
170373 190, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170374 190, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170375 190, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170376 190, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170377 211, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170378 212, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170379 190, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170380 285, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170381 287, /* (259) trigger_time ::= BEFORE|AFTER */
170382 287, /* (260) trigger_time ::= INSTEAD OF */
170383 287, /* (261) trigger_time ::= */
170384 288, /* (262) trigger_event ::= DELETE|INSERT */
170385 288, /* (263) trigger_event ::= UPDATE */
170386 288, /* (264) trigger_event ::= UPDATE OF idlist */
170387 290, /* (265) when_clause ::= */
170388 290, /* (266) when_clause ::= WHEN expr */
170389 286, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170390 286, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170391 292, /* (269) trnm ::= nm DOT nm */
170392 293, /* (270) tridxby ::= INDEXED BY nm */
170393 293, /* (271) tridxby ::= NOT INDEXED */
170394 291, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170395 291, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170396 291, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170397 291, /* (275) trigger_cmd ::= scanpt select scanpt */
170398 217, /* (276) expr ::= RAISE LP IGNORE RP */
170399 217, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170400 236, /* (278) raisetype ::= ROLLBACK */
170401 236, /* (279) raisetype ::= ABORT */
170402 236, /* (280) raisetype ::= FAIL */
170403 190, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170404 190, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170405 190, /* (283) cmd ::= DETACH database_kw_opt expr */
170406 295, /* (284) key_opt ::= */
170407 295, /* (285) key_opt ::= KEY expr */
170408 190, /* (286) cmd ::= REINDEX */
170409 190, /* (287) cmd ::= REINDEX nm dbnm */
170410 190, /* (288) cmd ::= ANALYZE */
170411 190, /* (289) cmd ::= ANALYZE nm dbnm */
170412 190, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170413 190, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170414 190, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170415 296, /* (293) add_column_fullname ::= fullname */
170416 190, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170417 190, /* (295) cmd ::= create_vtab */
170418 190, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170419 298, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170420 300, /* (298) vtabarg ::= */
170421 301, /* (299) vtabargtoken ::= ANY */
170422 301, /* (300) vtabargtoken ::= lp anylist RP */
170423 302, /* (301) lp ::= LP */
170424 266, /* (302) with ::= WITH wqlist */
170425 266, /* (303) with ::= WITH RECURSIVE wqlist */
170426 305, /* (304) wqas ::= AS */
170427 305, /* (305) wqas ::= AS MATERIALIZED */
170428 305, /* (306) wqas ::= AS NOT MATERIALIZED */
170429 304, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170430 241, /* (308) wqlist ::= wqitem */
170431 241, /* (309) wqlist ::= wqlist COMMA wqitem */
170432 306, /* (310) windowdefn_list ::= windowdefn */
170433 306, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170434 307, /* (312) windowdefn ::= nm AS LP window RP */
170435 308, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170436 308, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170437 308, /* (315) window ::= ORDER BY sortlist frame_opt */
170438 308, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170439 308, /* (317) window ::= frame_opt */
170440 308, /* (318) window ::= nm frame_opt */
170441 309, /* (319) frame_opt ::= */
170442 309, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170443 309, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170444 313, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170445 315, /* (323) frame_bound_s ::= frame_bound */
170446 315, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170447 316, /* (325) frame_bound_e ::= frame_bound */
170448 316, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170449 314, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170450 314, /* (328) frame_bound ::= CURRENT ROW */
170451 317, /* (329) frame_exclude_opt ::= */
170452 317, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170453 318, /* (331) frame_exclude ::= NO OTHERS */
170454 318, /* (332) frame_exclude ::= CURRENT ROW */
170455 318, /* (333) frame_exclude ::= GROUP|TIES */
170456 251, /* (334) window_clause ::= WINDOW windowdefn_list */
170457 273, /* (335) filter_over ::= filter_clause over_clause */
170458 273, /* (336) filter_over ::= over_clause */
170459 273, /* (337) filter_over ::= filter_clause */
170460 312, /* (338) over_clause ::= OVER LP window RP */
170461 312, /* (339) over_clause ::= OVER nm */
170462 311, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170463 185, /* (341) input ::= cmdlist */
170464 186, /* (342) cmdlist ::= cmdlist ecmd */
170465 186, /* (343) cmdlist ::= ecmd */
170466 187, /* (344) ecmd ::= SEMI */
170467 187, /* (345) ecmd ::= cmdx SEMI */
170468 187, /* (346) ecmd ::= explain cmdx SEMI */
170469 192, /* (347) trans_opt ::= */
170470 192, /* (348) trans_opt ::= TRANSACTION */
170471 192, /* (349) trans_opt ::= TRANSACTION nm */
170472 194, /* (350) savepoint_opt ::= SAVEPOINT */
170473 194, /* (351) savepoint_opt ::= */
170474 190, /* (352) cmd ::= create_table create_table_args */
170475 203, /* (353) table_option_set ::= table_option */
170476 201, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170477 201, /* (355) columnlist ::= columnname carglist */
170478 193, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170479 193, /* (357) nm ::= STRING */
170480 208, /* (358) typetoken ::= typename */
170481 209, /* (359) typename ::= ID|STRING */
170482 210, /* (360) signed ::= plus_num */
170483 210, /* (361) signed ::= minus_num */
170484 207, /* (362) carglist ::= carglist ccons */
170485 207, /* (363) carglist ::= */
170486 215, /* (364) ccons ::= NULL onconf */
170487 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170488 215, /* (366) ccons ::= AS generated */
170489 202, /* (367) conslist_opt ::= COMMA conslist */
170490 228, /* (368) conslist ::= conslist tconscomma tcons */
170491 228, /* (369) conslist ::= tcons */
170492 229, /* (370) tconscomma ::= */
170493 233, /* (371) defer_subclause_opt ::= defer_subclause */
170494 235, /* (372) resolvetype ::= raisetype */
170495 239, /* (373) selectnowith ::= oneselect */
170496 240, /* (374) oneselect ::= values */
170497 254, /* (375) sclp ::= selcollist COMMA */
170498 255, /* (376) as ::= ID|STRING */
170499 264, /* (377) indexed_opt ::= indexed_by */
170500 272, /* (378) returning ::= */
170501 217, /* (379) expr ::= term */
170502 274, /* (380) likeop ::= LIKE_KW|MATCH */
170503 261, /* (381) exprlist ::= nexprlist */
170504 284, /* (382) nmnum ::= plus_num */
170505 284, /* (383) nmnum ::= nm */
170506 284, /* (384) nmnum ::= ON */
170507 284, /* (385) nmnum ::= DELETE */
170508 284, /* (386) nmnum ::= DEFAULT */
170509 211, /* (387) plus_num ::= INTEGER|FLOAT */
170510 289, /* (388) foreach_clause ::= */
170511 289, /* (389) foreach_clause ::= FOR EACH ROW */
170512 292, /* (390) trnm ::= nm */
170513 293, /* (391) tridxby ::= */
170514 294, /* (392) database_kw_opt ::= DATABASE */
170515 294, /* (393) database_kw_opt ::= */
170516 297, /* (394) kwcolumn_opt ::= */
170517 297, /* (395) kwcolumn_opt ::= COLUMNKW */
170518 299, /* (396) vtabarglist ::= vtabarg */
170519 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170520 300, /* (398) vtabarg ::= vtabarg vtabargtoken */
170521 303, /* (399) anylist ::= */
170522 303, /* (400) anylist ::= anylist LP anylist RP */
170523 303, /* (401) anylist ::= anylist ANY */
170524 266, /* (402) with ::= */
 
 
170525 };
170526
170527 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
170528 ** of symbols on the right-hand side of that rule. */
170529 static const signed char yyRuleInfoNRhs[] = {
@@ -170090,237 +170703,235 @@
170703 0, /* (173) idlist_opt ::= */
170704 -3, /* (174) idlist_opt ::= LP idlist RP */
170705 -3, /* (175) idlist ::= idlist COMMA nm */
170706 -1, /* (176) idlist ::= nm */
170707 -3, /* (177) expr ::= LP expr RP */
170708 -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170709 -3, /* (179) expr ::= nm DOT nm */
170710 -5, /* (180) expr ::= nm DOT nm DOT nm */
170711 -1, /* (181) term ::= NULL|FLOAT|BLOB */
170712 -1, /* (182) term ::= STRING */
170713 -1, /* (183) term ::= INTEGER */
170714 -1, /* (184) expr ::= VARIABLE */
170715 -3, /* (185) expr ::= expr COLLATE ID|STRING */
170716 -6, /* (186) expr ::= CAST LP expr AS typetoken RP */
170717 -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170718 -4, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170719 -6, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170720 -5, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170721 -1, /* (191) term ::= CTIME_KW */
170722 -5, /* (192) expr ::= LP nexprlist COMMA expr RP */
170723 -3, /* (193) expr ::= expr AND expr */
170724 -3, /* (194) expr ::= expr OR expr */
170725 -3, /* (195) expr ::= expr LT|GT|GE|LE expr */
170726 -3, /* (196) expr ::= expr EQ|NE expr */
170727 -3, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170728 -3, /* (198) expr ::= expr PLUS|MINUS expr */
170729 -3, /* (199) expr ::= expr STAR|SLASH|REM expr */
170730 -3, /* (200) expr ::= expr CONCAT expr */
170731 -2, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170732 -3, /* (202) expr ::= expr likeop expr */
170733 -5, /* (203) expr ::= expr likeop expr ESCAPE expr */
170734 -2, /* (204) expr ::= expr ISNULL|NOTNULL */
170735 -3, /* (205) expr ::= expr NOT NULL */
170736 -3, /* (206) expr ::= expr IS expr */
170737 -4, /* (207) expr ::= expr IS NOT expr */
170738 -6, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170739 -5, /* (209) expr ::= expr IS DISTINCT FROM expr */
170740 -2, /* (210) expr ::= NOT expr */
170741 -2, /* (211) expr ::= BITNOT expr */
170742 -2, /* (212) expr ::= PLUS|MINUS expr */
170743 -3, /* (213) expr ::= expr PTR expr */
170744 -1, /* (214) between_op ::= BETWEEN */
170745 -2, /* (215) between_op ::= NOT BETWEEN */
170746 -5, /* (216) expr ::= expr between_op expr AND expr */
170747 -1, /* (217) in_op ::= IN */
170748 -2, /* (218) in_op ::= NOT IN */
170749 -5, /* (219) expr ::= expr in_op LP exprlist RP */
170750 -3, /* (220) expr ::= LP select RP */
170751 -5, /* (221) expr ::= expr in_op LP select RP */
170752 -5, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170753 -4, /* (223) expr ::= EXISTS LP select RP */
170754 -5, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170755 -5, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170756 -4, /* (226) case_exprlist ::= WHEN expr THEN expr */
170757 -2, /* (227) case_else ::= ELSE expr */
170758 0, /* (228) case_else ::= */
170759 -1, /* (229) case_operand ::= expr */
170760 0, /* (230) case_operand ::= */
170761 0, /* (231) exprlist ::= */
170762 -3, /* (232) nexprlist ::= nexprlist COMMA expr */
170763 -1, /* (233) nexprlist ::= expr */
170764 0, /* (234) paren_exprlist ::= */
170765 -3, /* (235) paren_exprlist ::= LP exprlist RP */
170766 -12, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170767 -1, /* (237) uniqueflag ::= UNIQUE */
170768 0, /* (238) uniqueflag ::= */
170769 0, /* (239) eidlist_opt ::= */
170770 -3, /* (240) eidlist_opt ::= LP eidlist RP */
170771 -5, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170772 -3, /* (242) eidlist ::= nm collate sortorder */
170773 0, /* (243) collate ::= */
170774 -2, /* (244) collate ::= COLLATE ID|STRING */
170775 -4, /* (245) cmd ::= DROP INDEX ifexists fullname */
170776 -2, /* (246) cmd ::= VACUUM vinto */
170777 -3, /* (247) cmd ::= VACUUM nm vinto */
170778 -2, /* (248) vinto ::= INTO expr */
170779 0, /* (249) vinto ::= */
170780 -3, /* (250) cmd ::= PRAGMA nm dbnm */
170781 -5, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170782 -6, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170783 -5, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170784 -6, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170785 -2, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170786 -2, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170787 -5, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170788 -11, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170789 -1, /* (259) trigger_time ::= BEFORE|AFTER */
170790 -2, /* (260) trigger_time ::= INSTEAD OF */
170791 0, /* (261) trigger_time ::= */
170792 -1, /* (262) trigger_event ::= DELETE|INSERT */
170793 -1, /* (263) trigger_event ::= UPDATE */
170794 -3, /* (264) trigger_event ::= UPDATE OF idlist */
170795 0, /* (265) when_clause ::= */
170796 -2, /* (266) when_clause ::= WHEN expr */
170797 -3, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170798 -2, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170799 -3, /* (269) trnm ::= nm DOT nm */
170800 -3, /* (270) tridxby ::= INDEXED BY nm */
170801 -2, /* (271) tridxby ::= NOT INDEXED */
170802 -9, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170803 -8, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170804 -6, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170805 -3, /* (275) trigger_cmd ::= scanpt select scanpt */
170806 -4, /* (276) expr ::= RAISE LP IGNORE RP */
170807 -6, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170808 -1, /* (278) raisetype ::= ROLLBACK */
170809 -1, /* (279) raisetype ::= ABORT */
170810 -1, /* (280) raisetype ::= FAIL */
170811 -4, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170812 -6, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170813 -3, /* (283) cmd ::= DETACH database_kw_opt expr */
170814 0, /* (284) key_opt ::= */
170815 -2, /* (285) key_opt ::= KEY expr */
170816 -1, /* (286) cmd ::= REINDEX */
170817 -3, /* (287) cmd ::= REINDEX nm dbnm */
170818 -1, /* (288) cmd ::= ANALYZE */
170819 -3, /* (289) cmd ::= ANALYZE nm dbnm */
170820 -6, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170821 -7, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170822 -6, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170823 -1, /* (293) add_column_fullname ::= fullname */
170824 -8, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170825 -1, /* (295) cmd ::= create_vtab */
170826 -4, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170827 -8, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170828 0, /* (298) vtabarg ::= */
170829 -1, /* (299) vtabargtoken ::= ANY */
170830 -3, /* (300) vtabargtoken ::= lp anylist RP */
170831 -1, /* (301) lp ::= LP */
170832 -2, /* (302) with ::= WITH wqlist */
170833 -3, /* (303) with ::= WITH RECURSIVE wqlist */
170834 -1, /* (304) wqas ::= AS */
170835 -2, /* (305) wqas ::= AS MATERIALIZED */
170836 -3, /* (306) wqas ::= AS NOT MATERIALIZED */
170837 -6, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170838 -1, /* (308) wqlist ::= wqitem */
170839 -3, /* (309) wqlist ::= wqlist COMMA wqitem */
170840 -1, /* (310) windowdefn_list ::= windowdefn */
170841 -3, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170842 -5, /* (312) windowdefn ::= nm AS LP window RP */
170843 -5, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170844 -6, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170845 -4, /* (315) window ::= ORDER BY sortlist frame_opt */
170846 -5, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170847 -1, /* (317) window ::= frame_opt */
170848 -2, /* (318) window ::= nm frame_opt */
170849 0, /* (319) frame_opt ::= */
170850 -3, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170851 -6, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170852 -1, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170853 -1, /* (323) frame_bound_s ::= frame_bound */
170854 -2, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170855 -1, /* (325) frame_bound_e ::= frame_bound */
170856 -2, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170857 -2, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170858 -2, /* (328) frame_bound ::= CURRENT ROW */
170859 0, /* (329) frame_exclude_opt ::= */
170860 -2, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170861 -2, /* (331) frame_exclude ::= NO OTHERS */
170862 -2, /* (332) frame_exclude ::= CURRENT ROW */
170863 -1, /* (333) frame_exclude ::= GROUP|TIES */
170864 -2, /* (334) window_clause ::= WINDOW windowdefn_list */
170865 -2, /* (335) filter_over ::= filter_clause over_clause */
170866 -1, /* (336) filter_over ::= over_clause */
170867 -1, /* (337) filter_over ::= filter_clause */
170868 -4, /* (338) over_clause ::= OVER LP window RP */
170869 -2, /* (339) over_clause ::= OVER nm */
170870 -5, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170871 -1, /* (341) input ::= cmdlist */
170872 -2, /* (342) cmdlist ::= cmdlist ecmd */
170873 -1, /* (343) cmdlist ::= ecmd */
170874 -1, /* (344) ecmd ::= SEMI */
170875 -2, /* (345) ecmd ::= cmdx SEMI */
170876 -3, /* (346) ecmd ::= explain cmdx SEMI */
170877 0, /* (347) trans_opt ::= */
170878 -1, /* (348) trans_opt ::= TRANSACTION */
170879 -2, /* (349) trans_opt ::= TRANSACTION nm */
170880 -1, /* (350) savepoint_opt ::= SAVEPOINT */
170881 0, /* (351) savepoint_opt ::= */
170882 -2, /* (352) cmd ::= create_table create_table_args */
170883 -1, /* (353) table_option_set ::= table_option */
170884 -4, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170885 -2, /* (355) columnlist ::= columnname carglist */
170886 -1, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170887 -1, /* (357) nm ::= STRING */
170888 -1, /* (358) typetoken ::= typename */
170889 -1, /* (359) typename ::= ID|STRING */
170890 -1, /* (360) signed ::= plus_num */
170891 -1, /* (361) signed ::= minus_num */
170892 -2, /* (362) carglist ::= carglist ccons */
170893 0, /* (363) carglist ::= */
170894 -2, /* (364) ccons ::= NULL onconf */
170895 -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170896 -2, /* (366) ccons ::= AS generated */
170897 -2, /* (367) conslist_opt ::= COMMA conslist */
170898 -3, /* (368) conslist ::= conslist tconscomma tcons */
170899 -1, /* (369) conslist ::= tcons */
170900 0, /* (370) tconscomma ::= */
170901 -1, /* (371) defer_subclause_opt ::= defer_subclause */
170902 -1, /* (372) resolvetype ::= raisetype */
170903 -1, /* (373) selectnowith ::= oneselect */
170904 -1, /* (374) oneselect ::= values */
170905 -2, /* (375) sclp ::= selcollist COMMA */
170906 -1, /* (376) as ::= ID|STRING */
170907 -1, /* (377) indexed_opt ::= indexed_by */
170908 0, /* (378) returning ::= */
170909 -1, /* (379) expr ::= term */
170910 -1, /* (380) likeop ::= LIKE_KW|MATCH */
170911 -1, /* (381) exprlist ::= nexprlist */
170912 -1, /* (382) nmnum ::= plus_num */
170913 -1, /* (383) nmnum ::= nm */
170914 -1, /* (384) nmnum ::= ON */
170915 -1, /* (385) nmnum ::= DELETE */
170916 -1, /* (386) nmnum ::= DEFAULT */
170917 -1, /* (387) plus_num ::= INTEGER|FLOAT */
170918 0, /* (388) foreach_clause ::= */
170919 -3, /* (389) foreach_clause ::= FOR EACH ROW */
170920 -1, /* (390) trnm ::= nm */
170921 0, /* (391) tridxby ::= */
170922 -1, /* (392) database_kw_opt ::= DATABASE */
170923 0, /* (393) database_kw_opt ::= */
170924 0, /* (394) kwcolumn_opt ::= */
170925 -1, /* (395) kwcolumn_opt ::= COLUMNKW */
170926 -1, /* (396) vtabarglist ::= vtabarg */
170927 -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170928 -2, /* (398) vtabarg ::= vtabarg vtabargtoken */
170929 0, /* (399) anylist ::= */
170930 -4, /* (400) anylist ::= anylist LP anylist RP */
170931 -2, /* (401) anylist ::= anylist ANY */
170932 0, /* (402) with ::= */
 
 
170933 };
170934
170935 static void yy_accept(yyParser*); /* Forward Declaration */
170936
170937 /*
@@ -170376,11 +170987,11 @@
170987 {yymsp[1].minor.yy394 = TK_DEFERRED;}
170988 break;
170989 case 5: /* transtype ::= DEFERRED */
170990 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170991 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170992 case 322: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==322);
170993 {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170994 break;
170995 case 8: /* cmd ::= COMMIT|END trans_opt */
170996 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170997 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170413,11 +171024,11 @@
171024 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
171025 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
171026 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
171027 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
171028 case 98: /* distinct ::= */ yytestcase(yyruleno==98);
171029 case 243: /* collate ::= */ yytestcase(yyruleno==243);
171030 {yymsp[1].minor.yy394 = 0;}
171031 break;
171032 case 16: /* ifnotexists ::= IF NOT EXISTS */
171033 {yymsp[-2].minor.yy394 = 1;}
171034 break;
@@ -170597,13 +171208,13 @@
171208 case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
171209 {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
171210 break;
171211 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
171212 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
171213 case 215: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==215);
171214 case 218: /* in_op ::= NOT IN */ yytestcase(yyruleno==218);
171215 case 244: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==244);
171216 {yymsp[-1].minor.yy394 = 1;}
171217 break;
171218 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
171219 {yymsp[-1].minor.yy394 = 0;}
171220 break;
@@ -170749,13 +171360,13 @@
171360 {yymsp[0].minor.yy394 = SF_All;}
171361 break;
171362 case 99: /* sclp ::= */
171363 case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
171364 case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
171365 case 231: /* exprlist ::= */ yytestcase(yyruleno==231);
171366 case 234: /* paren_exprlist ::= */ yytestcase(yyruleno==234);
171367 case 239: /* eidlist_opt ::= */ yytestcase(yyruleno==239);
171368 {yymsp[1].minor.yy322 = 0;}
171369 break;
171370 case 100: /* selcollist ::= sclp scanpt expr scanpt as */
171371 {
171372 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170777,12 +171388,12 @@
171388 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
171389 }
171390 break;
171391 case 103: /* as ::= AS nm */
171392 case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
171393 case 255: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==255);
171394 case 256: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
171395 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
171396 break;
171397 case 105: /* from ::= */
171398 case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
171399 {yymsp[1].minor.yy131 = 0;}
@@ -170950,20 +171561,20 @@
171561 break;
171562 case 144: /* having_opt ::= */
171563 case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
171564 case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
171565 case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
171566 case 228: /* case_else ::= */ yytestcase(yyruleno==228);
171567 case 230: /* case_operand ::= */ yytestcase(yyruleno==230);
171568 case 249: /* vinto ::= */ yytestcase(yyruleno==249);
171569 {yymsp[1].minor.yy528 = 0;}
171570 break;
171571 case 145: /* having_opt ::= HAVING expr */
171572 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
171573 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
171574 case 227: /* case_else ::= ELSE expr */ yytestcase(yyruleno==227);
171575 case 248: /* vinto ::= INTO expr */ yytestcase(yyruleno==248);
171576 {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
171577 break;
171578 case 147: /* limit_opt ::= LIMIT expr */
171579 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
171580 break;
@@ -171071,23 +171682,22 @@
171682 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171683 break;
171684 case 177: /* expr ::= LP expr RP */
171685 {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171686 break;
171687 case 178: /* expr ::= ID|INDEXED|JOIN_KW */
 
171688 {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171689 break;
171690 case 179: /* expr ::= nm DOT nm */
171691 {
171692 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171693 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171694 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171695 }
171696 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171697 break;
171698 case 180: /* expr ::= nm DOT nm DOT nm */
171699 {
171700 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171701 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171702 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171703 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171096,22 +171706,22 @@
171706 }
171707 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171708 }
171709 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171710 break;
171711 case 181: /* term ::= NULL|FLOAT|BLOB */
171712 case 182: /* term ::= STRING */ yytestcase(yyruleno==182);
171713 {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171714 break;
171715 case 183: /* term ::= INTEGER */
171716 {
171717 yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171718 if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171719 }
171720 yymsp[0].minor.yy528 = yylhsminor.yy528;
171721 break;
171722 case 184: /* expr ::= VARIABLE */
171723 {
171724 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171725 u32 n = yymsp[0].minor.yy0.n;
171726 yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171727 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171129,54 +171739,54 @@
171739 if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171740 }
171741 }
171742 }
171743 break;
171744 case 185: /* expr ::= expr COLLATE ID|STRING */
171745 {
171746 yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171747 }
171748 break;
171749 case 186: /* expr ::= CAST LP expr AS typetoken RP */
171750 {
171751 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171752 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171753 }
171754 break;
171755 case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
171756 {
171757 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171758 }
171759 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171760 break;
171761 case 188: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
171762 {
171763 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171764 }
171765 yymsp[-3].minor.yy528 = yylhsminor.yy528;
171766 break;
171767 case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
171768 {
171769 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171770 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171771 }
171772 yymsp[-5].minor.yy528 = yylhsminor.yy528;
171773 break;
171774 case 190: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
171775 {
171776 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171777 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171778 }
171779 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171780 break;
171781 case 191: /* term ::= CTIME_KW */
171782 {
171783 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171784 }
171785 yymsp[0].minor.yy528 = yylhsminor.yy528;
171786 break;
171787 case 192: /* expr ::= LP nexprlist COMMA expr RP */
171788 {
171789 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171790 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171791 if( yymsp[-4].minor.yy528 ){
171792 yymsp[-4].minor.yy528->x.pList = pList;
@@ -171186,26 +171796,26 @@
171796 }else{
171797 sqlite3ExprListDelete(pParse->db, pList);
171798 }
171799 }
171800 break;
171801 case 193: /* expr ::= expr AND expr */
171802 {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171803 break;
171804 case 194: /* expr ::= expr OR expr */
171805 case 195: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==195);
171806 case 196: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==196);
171807 case 197: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==197);
171808 case 198: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==198);
171809 case 199: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==199);
171810 case 200: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==200);
171811 {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171812 break;
171813 case 201: /* likeop ::= NOT LIKE_KW|MATCH */
171814 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171815 break;
171816 case 202: /* expr ::= expr likeop expr */
171817 {
171818 ExprList *pList;
171819 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171820 yymsp[-1].minor.yy0.n &= 0x7fffffff;
171821 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171213,11 +171823,11 @@
171823 yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171824 if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171825 if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171826 }
171827 break;
171828 case 203: /* expr ::= expr likeop expr ESCAPE expr */
171829 {
171830 ExprList *pList;
171831 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171832 yymsp[-3].minor.yy0.n &= 0x7fffffff;
171833 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171226,63 +171836,63 @@
171836 yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171837 if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171838 if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171839 }
171840 break;
171841 case 204: /* expr ::= expr ISNULL|NOTNULL */
171842 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171843 break;
171844 case 205: /* expr ::= expr NOT NULL */
171845 {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171846 break;
171847 case 206: /* expr ::= expr IS expr */
171848 {
171849 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171850 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171851 }
171852 break;
171853 case 207: /* expr ::= expr IS NOT expr */
171854 {
171855 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171856 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171857 }
171858 break;
171859 case 208: /* expr ::= expr IS NOT DISTINCT FROM expr */
171860 {
171861 yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171862 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171863 }
171864 break;
171865 case 209: /* expr ::= expr IS DISTINCT FROM expr */
171866 {
171867 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171868 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171869 }
171870 break;
171871 case 210: /* expr ::= NOT expr */
171872 case 211: /* expr ::= BITNOT expr */ yytestcase(yyruleno==211);
171873 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171874 break;
171875 case 212: /* expr ::= PLUS|MINUS expr */
171876 {
171877 yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171878 /*A-overwrites-B*/
171879 }
171880 break;
171881 case 213: /* expr ::= expr PTR expr */
171882 {
171883 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171884 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171885 yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171886 }
171887 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171888 break;
171889 case 214: /* between_op ::= BETWEEN */
171890 case 217: /* in_op ::= IN */ yytestcase(yyruleno==217);
171891 {yymsp[0].minor.yy394 = 0;}
171892 break;
171893 case 216: /* expr ::= expr between_op expr AND expr */
171894 {
171895 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171896 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171897 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171898 if( yymsp[-4].minor.yy528 ){
@@ -171291,11 +171901,11 @@
171901 sqlite3ExprListDelete(pParse->db, pList);
171902 }
171903 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171904 }
171905 break;
171906 case 219: /* expr ::= expr in_op LP exprlist RP */
171907 {
171908 if( yymsp[-1].minor.yy322==0 ){
171909 /* Expressions of the form
171910 **
171911 ** expr1 IN ()
@@ -171337,41 +171947,41 @@
171947 }
171948 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171949 }
171950 }
171951 break;
171952 case 220: /* expr ::= LP select RP */
171953 {
171954 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171955 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171956 }
171957 break;
171958 case 221: /* expr ::= expr in_op LP select RP */
171959 {
171960 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171961 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171962 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171963 }
171964 break;
171965 case 222: /* expr ::= expr in_op nm dbnm paren_exprlist */
171966 {
171967 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171968 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171969 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171970 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171971 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171972 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171973 }
171974 break;
171975 case 223: /* expr ::= EXISTS LP select RP */
171976 {
171977 Expr *p;
171978 p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171979 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171980 }
171981 break;
171982 case 224: /* expr ::= CASE case_operand case_exprlist case_else END */
171983 {
171984 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171985 if( yymsp[-4].minor.yy528 ){
171986 yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171987 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171379,406 +171989,406 @@
171989 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171990 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171991 }
171992 }
171993 break;
171994 case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171995 {
171996 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171997 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171998 }
171999 break;
172000 case 226: /* case_exprlist ::= WHEN expr THEN expr */
172001 {
172002 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
172003 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
172004 }
172005 break;
172006 case 229: /* case_operand ::= expr */
172007 {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
172008 break;
172009 case 232: /* nexprlist ::= nexprlist COMMA expr */
172010 {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
172011 break;
172012 case 233: /* nexprlist ::= expr */
172013 {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
172014 break;
172015 case 235: /* paren_exprlist ::= LP exprlist RP */
172016 case 240: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==240);
172017 {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
172018 break;
172019 case 236: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
172020 {
172021 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
172022 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
172023 &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
172024 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
172025 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
172026 }
172027 }
172028 break;
172029 case 237: /* uniqueflag ::= UNIQUE */
172030 case 279: /* raisetype ::= ABORT */ yytestcase(yyruleno==279);
172031 {yymsp[0].minor.yy394 = OE_Abort;}
172032 break;
172033 case 238: /* uniqueflag ::= */
172034 {yymsp[1].minor.yy394 = OE_None;}
172035 break;
172036 case 241: /* eidlist ::= eidlist COMMA nm collate sortorder */
172037 {
172038 yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
172039 }
172040 break;
172041 case 242: /* eidlist ::= nm collate sortorder */
172042 {
172043 yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
172044 }
172045 break;
172046 case 245: /* cmd ::= DROP INDEX ifexists fullname */
172047 {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
172048 break;
172049 case 246: /* cmd ::= VACUUM vinto */
172050 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
172051 break;
172052 case 247: /* cmd ::= VACUUM nm vinto */
172053 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
172054 break;
172055 case 250: /* cmd ::= PRAGMA nm dbnm */
172056 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
172057 break;
172058 case 251: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
172059 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
172060 break;
172061 case 252: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
172062 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
172063 break;
172064 case 253: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
172065 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
172066 break;
172067 case 254: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
172068 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
172069 break;
172070 case 257: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
172071 {
172072 Token all;
172073 all.z = yymsp[-3].minor.yy0.z;
172074 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
172075 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
172076 }
172077 break;
172078 case 258: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
172079 {
172080 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
172081 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
172082 }
172083 break;
172084 case 259: /* trigger_time ::= BEFORE|AFTER */
172085 { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
172086 break;
172087 case 260: /* trigger_time ::= INSTEAD OF */
172088 { yymsp[-1].minor.yy394 = TK_INSTEAD;}
172089 break;
172090 case 261: /* trigger_time ::= */
172091 { yymsp[1].minor.yy394 = TK_BEFORE; }
172092 break;
172093 case 262: /* trigger_event ::= DELETE|INSERT */
172094 case 263: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==263);
172095 {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
172096 break;
172097 case 264: /* trigger_event ::= UPDATE OF idlist */
172098 {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
172099 break;
172100 case 265: /* when_clause ::= */
172101 case 284: /* key_opt ::= */ yytestcase(yyruleno==284);
172102 { yymsp[1].minor.yy528 = 0; }
172103 break;
172104 case 266: /* when_clause ::= WHEN expr */
172105 case 285: /* key_opt ::= KEY expr */ yytestcase(yyruleno==285);
172106 { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
172107 break;
172108 case 267: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
172109 {
172110 assert( yymsp[-2].minor.yy33!=0 );
172111 yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
172112 yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
172113 }
172114 break;
172115 case 268: /* trigger_cmd_list ::= trigger_cmd SEMI */
172116 {
172117 assert( yymsp[-1].minor.yy33!=0 );
172118 yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
172119 }
172120 break;
172121 case 269: /* trnm ::= nm DOT nm */
172122 {
172123 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
172124 sqlite3ErrorMsg(pParse,
172125 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
172126 "statements within triggers");
172127 }
172128 break;
172129 case 270: /* tridxby ::= INDEXED BY nm */
172130 {
172131 sqlite3ErrorMsg(pParse,
172132 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
172133 "within triggers");
172134 }
172135 break;
172136 case 271: /* tridxby ::= NOT INDEXED */
172137 {
172138 sqlite3ErrorMsg(pParse,
172139 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
172140 "within triggers");
172141 }
172142 break;
172143 case 272: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
172144 {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
172145 yymsp[-8].minor.yy33 = yylhsminor.yy33;
172146 break;
172147 case 273: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
172148 {
172149 yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
172150 }
172151 yymsp[-7].minor.yy33 = yylhsminor.yy33;
172152 break;
172153 case 274: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
172154 {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
172155 yymsp[-5].minor.yy33 = yylhsminor.yy33;
172156 break;
172157 case 275: /* trigger_cmd ::= scanpt select scanpt */
172158 {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
172159 yymsp[-2].minor.yy33 = yylhsminor.yy33;
172160 break;
172161 case 276: /* expr ::= RAISE LP IGNORE RP */
172162 {
172163 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
172164 if( yymsp[-3].minor.yy528 ){
172165 yymsp[-3].minor.yy528->affExpr = OE_Ignore;
172166 }
172167 }
172168 break;
172169 case 277: /* expr ::= RAISE LP raisetype COMMA nm RP */
172170 {
172171 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
172172 if( yymsp[-5].minor.yy528 ) {
172173 yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
172174 }
172175 }
172176 break;
172177 case 278: /* raisetype ::= ROLLBACK */
172178 {yymsp[0].minor.yy394 = OE_Rollback;}
172179 break;
172180 case 280: /* raisetype ::= FAIL */
172181 {yymsp[0].minor.yy394 = OE_Fail;}
172182 break;
172183 case 281: /* cmd ::= DROP TRIGGER ifexists fullname */
172184 {
172185 sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
172186 }
172187 break;
172188 case 282: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
172189 {
172190 sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
172191 }
172192 break;
172193 case 283: /* cmd ::= DETACH database_kw_opt expr */
172194 {
172195 sqlite3Detach(pParse, yymsp[0].minor.yy528);
172196 }
172197 break;
172198 case 286: /* cmd ::= REINDEX */
172199 {sqlite3Reindex(pParse, 0, 0);}
172200 break;
172201 case 287: /* cmd ::= REINDEX nm dbnm */
172202 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
172203 break;
172204 case 288: /* cmd ::= ANALYZE */
172205 {sqlite3Analyze(pParse, 0, 0);}
172206 break;
172207 case 289: /* cmd ::= ANALYZE nm dbnm */
172208 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
172209 break;
172210 case 290: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
172211 {
172212 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
172213 }
172214 break;
172215 case 291: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
172216 {
172217 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
172218 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
172219 }
172220 break;
172221 case 292: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
172222 {
172223 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
172224 }
172225 break;
172226 case 293: /* add_column_fullname ::= fullname */
172227 {
172228 disableLookaside(pParse);
172229 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
172230 }
172231 break;
172232 case 294: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
172233 {
172234 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
172235 }
172236 break;
172237 case 295: /* cmd ::= create_vtab */
172238 {sqlite3VtabFinishParse(pParse,0);}
172239 break;
172240 case 296: /* cmd ::= create_vtab LP vtabarglist RP */
172241 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
172242 break;
172243 case 297: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
172244 {
172245 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
172246 }
172247 break;
172248 case 298: /* vtabarg ::= */
172249 {sqlite3VtabArgInit(pParse);}
172250 break;
172251 case 299: /* vtabargtoken ::= ANY */
172252 case 300: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==300);
172253 case 301: /* lp ::= LP */ yytestcase(yyruleno==301);
172254 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
172255 break;
172256 case 302: /* with ::= WITH wqlist */
172257 case 303: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==303);
172258 { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
172259 break;
172260 case 304: /* wqas ::= AS */
172261 {yymsp[0].minor.yy516 = M10d_Any;}
172262 break;
172263 case 305: /* wqas ::= AS MATERIALIZED */
172264 {yymsp[-1].minor.yy516 = M10d_Yes;}
172265 break;
172266 case 306: /* wqas ::= AS NOT MATERIALIZED */
172267 {yymsp[-2].minor.yy516 = M10d_No;}
172268 break;
172269 case 307: /* wqitem ::= nm eidlist_opt wqas LP select RP */
172270 {
172271 yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
172272 }
172273 break;
172274 case 308: /* wqlist ::= wqitem */
172275 {
172276 yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
172277 }
172278 break;
172279 case 309: /* wqlist ::= wqlist COMMA wqitem */
172280 {
172281 yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
172282 }
172283 break;
172284 case 310: /* windowdefn_list ::= windowdefn */
172285 { yylhsminor.yy41 = yymsp[0].minor.yy41; }
172286 yymsp[0].minor.yy41 = yylhsminor.yy41;
172287 break;
172288 case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
172289 {
172290 assert( yymsp[0].minor.yy41!=0 );
172291 sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
172292 yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
172293 yylhsminor.yy41 = yymsp[0].minor.yy41;
172294 }
172295 yymsp[-2].minor.yy41 = yylhsminor.yy41;
172296 break;
172297 case 312: /* windowdefn ::= nm AS LP window RP */
172298 {
172299 if( ALWAYS(yymsp[-1].minor.yy41) ){
172300 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
172301 }
172302 yylhsminor.yy41 = yymsp[-1].minor.yy41;
172303 }
172304 yymsp[-4].minor.yy41 = yylhsminor.yy41;
172305 break;
172306 case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
172307 {
172308 yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
172309 }
172310 break;
172311 case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
172312 {
172313 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
172314 }
172315 yymsp[-5].minor.yy41 = yylhsminor.yy41;
172316 break;
172317 case 315: /* window ::= ORDER BY sortlist frame_opt */
172318 {
172319 yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
172320 }
172321 break;
172322 case 316: /* window ::= nm ORDER BY sortlist frame_opt */
172323 {
172324 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
172325 }
172326 yymsp[-4].minor.yy41 = yylhsminor.yy41;
172327 break;
172328 case 317: /* window ::= frame_opt */
172329 case 336: /* filter_over ::= over_clause */ yytestcase(yyruleno==336);
172330 {
172331 yylhsminor.yy41 = yymsp[0].minor.yy41;
172332 }
172333 yymsp[0].minor.yy41 = yylhsminor.yy41;
172334 break;
172335 case 318: /* window ::= nm frame_opt */
172336 {
172337 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
172338 }
172339 yymsp[-1].minor.yy41 = yylhsminor.yy41;
172340 break;
172341 case 319: /* frame_opt ::= */
172342 {
172343 yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
172344 }
172345 break;
172346 case 320: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
172347 {
172348 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
172349 }
172350 yymsp[-2].minor.yy41 = yylhsminor.yy41;
172351 break;
172352 case 321: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
172353 {
172354 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
172355 }
172356 yymsp[-5].minor.yy41 = yylhsminor.yy41;
172357 break;
172358 case 323: /* frame_bound_s ::= frame_bound */
172359 case 325: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==325);
172360 {yylhsminor.yy595 = yymsp[0].minor.yy595;}
172361 yymsp[0].minor.yy595 = yylhsminor.yy595;
172362 break;
172363 case 324: /* frame_bound_s ::= UNBOUNDED PRECEDING */
172364 case 326: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==326);
172365 case 328: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==328);
172366 {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
172367 yymsp[-1].minor.yy595 = yylhsminor.yy595;
172368 break;
172369 case 327: /* frame_bound ::= expr PRECEDING|FOLLOWING */
172370 {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
172371 yymsp[-1].minor.yy595 = yylhsminor.yy595;
172372 break;
172373 case 329: /* frame_exclude_opt ::= */
172374 {yymsp[1].minor.yy516 = 0;}
172375 break;
172376 case 330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
172377 {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
172378 break;
172379 case 331: /* frame_exclude ::= NO OTHERS */
172380 case 332: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==332);
172381 {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
172382 break;
172383 case 333: /* frame_exclude ::= GROUP|TIES */
172384 {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
172385 break;
172386 case 334: /* window_clause ::= WINDOW windowdefn_list */
172387 { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
172388 break;
172389 case 335: /* filter_over ::= filter_clause over_clause */
172390 {
172391 if( yymsp[0].minor.yy41 ){
172392 yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
172393 }else{
172394 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171785,11 +172395,11 @@
172395 }
172396 yylhsminor.yy41 = yymsp[0].minor.yy41;
172397 }
172398 yymsp[-1].minor.yy41 = yylhsminor.yy41;
172399 break;
172400 case 337: /* filter_over ::= filter_clause */
172401 {
172402 yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
172403 if( yylhsminor.yy41 ){
172404 yylhsminor.yy41->eFrmType = TK_FILTER;
172405 yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171797,91 +172407,90 @@
172407 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
172408 }
172409 }
172410 yymsp[0].minor.yy41 = yylhsminor.yy41;
172411 break;
172412 case 338: /* over_clause ::= OVER LP window RP */
172413 {
172414 yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
172415 assert( yymsp[-3].minor.yy41!=0 );
172416 }
172417 break;
172418 case 339: /* over_clause ::= OVER nm */
172419 {
172420 yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
172421 if( yymsp[-1].minor.yy41 ){
172422 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
172423 }
172424 }
172425 break;
172426 case 340: /* filter_clause ::= FILTER LP WHERE expr RP */
172427 { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
172428 break;
172429 default:
172430 /* (341) input ::= cmdlist */ yytestcase(yyruleno==341);
172431 /* (342) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==342);
172432 /* (343) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=343);
172433 /* (344) ecmd ::= SEMI */ yytestcase(yyruleno==344);
172434 /* (345) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==345);
172435 /* (346) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=346);
172436 /* (347) trans_opt ::= */ yytestcase(yyruleno==347);
172437 /* (348) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==348);
172438 /* (349) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==349);
172439 /* (350) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==350);
172440 /* (351) savepoint_opt ::= */ yytestcase(yyruleno==351);
172441 /* (352) cmd ::= create_table create_table_args */ yytestcase(yyruleno==352);
172442 /* (353) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=353);
172443 /* (354) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==354);
172444 /* (355) columnlist ::= columnname carglist */ yytestcase(yyruleno==355);
172445 /* (356) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==356);
172446 /* (357) nm ::= STRING */ yytestcase(yyruleno==357);
172447 /* (358) typetoken ::= typename */ yytestcase(yyruleno==358);
172448 /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359);
172449 /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
172450 /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361);
172451 /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362);
172452 /* (363) carglist ::= */ yytestcase(yyruleno==363);
172453 /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364);
172454 /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365);
172455 /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366);
172456 /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367);
172457 /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368);
172458 /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369);
172459 /* (370) tconscomma ::= */ yytestcase(yyruleno==370);
172460 /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371);
172461 /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372);
172462 /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373);
172463 /* (374) oneselect ::= values */ yytestcase(yyruleno==374);
172464 /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375);
172465 /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376);
172466 /* (377) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=377);
172467 /* (378) returning ::= */ yytestcase(yyruleno==378);
172468 /* (379) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=379);
172469 /* (380) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==380);
172470 /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381);
172471 /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382);
172472 /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383);
172473 /* (384) nmnum ::= ON */ yytestcase(yyruleno==384);
172474 /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385);
172475 /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386);
172476 /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387);
172477 /* (388) foreach_clause ::= */ yytestcase(yyruleno==388);
172478 /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389);
172479 /* (390) trnm ::= nm */ yytestcase(yyruleno==390);
172480 /* (391) tridxby ::= */ yytestcase(yyruleno==391);
172481 /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392);
172482 /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393);
172483 /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394);
172484 /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395);
172485 /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396);
172486 /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397);
172487 /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398);
172488 /* (399) anylist ::= */ yytestcase(yyruleno==399);
172489 /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400);
172490 /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401);
172491 /* (402) with ::= */ yytestcase(yyruleno==402);
 
172492 break;
172493 /********** End reduce actions ************************************************/
172494 };
172495 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
172496 yygoto = yyRuleInfoLhs[yyruleno];
@@ -172453,11 +173062,11 @@
173062 132, 0, 98, 38, 39, 0, 20, 45, 117, 93,
173063 };
173064 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
173065 ** then the i-th keyword has no more hash collisions. Otherwise,
173066 ** the next keyword with the same hash is aKWHash[i]-1. */
173067 static const unsigned char aKWNext[148] = {0,
173068 0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0,
173069 0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0,
173070 141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0,
173071 138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
173072 0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -172468,11 +173077,11 @@
173077 112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0,
173078 99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0,
173079 102, 0, 0, 87,
173080 };
173081 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
173082 static const unsigned char aKWLen[148] = {0,
173083 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
173084 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
173085 6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
173086 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
173087 2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
@@ -172484,11 +173093,11 @@
173093 4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2,
173094 2, 9, 3, 7,
173095 };
173096 /* aKWOffset[i] is the index into zKWText[] of the start of
173097 ** the text for the i-th keyword. */
173098 static const unsigned short int aKWOffset[148] = {0,
173099 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
173100 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
173101 86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
173102 129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
173103 184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
@@ -172499,11 +173108,11 @@
173108 520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579,
173109 585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645,
173110 648, 650, 655, 659,
173111 };
173112 /* aKWCode[i] is the parser symbol code for the i-th keyword */
173113 static const unsigned char aKWCode[148] = {0,
173114 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
173115 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
173116 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
173117 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
173118 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -172668,11 +173277,11 @@
173277 static int keywordCode(const char *z, int n, int *pType){
173278 int i, j;
173279 const char *zKW;
173280 if( n>=2 ){
173281 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
173282 for(i=(int)aKWHash[i]; i>0; i=aKWNext[i]){
173283 if( aKWLen[i]!=n ) continue;
173284 zKW = &zKWText[aKWOffset[i]];
173285 #ifdef SQLITE_ASCII
173286 if( (z[0]&~0x20)!=zKW[0] ) continue;
173287 if( (z[1]&~0x20)!=zKW[1] ) continue;
@@ -172684,157 +173293,157 @@
173293 if( toupper(z[1])!=zKW[1] ) continue;
173294 j = 2;
173295 while( j<n && toupper(z[j])==zKW[j] ){ j++; }
173296 #endif
173297 if( j<n ) continue;
173298 testcase( i==1 ); /* REINDEX */
173299 testcase( i==2 ); /* INDEXED */
173300 testcase( i==3 ); /* INDEX */
173301 testcase( i==4 ); /* DESC */
173302 testcase( i==5 ); /* ESCAPE */
173303 testcase( i==6 ); /* EACH */
173304 testcase( i==7 ); /* CHECK */
173305 testcase( i==8 ); /* KEY */
173306 testcase( i==9 ); /* BEFORE */
173307 testcase( i==10 ); /* FOREIGN */
173308 testcase( i==11 ); /* FOR */
173309 testcase( i==12 ); /* IGNORE */
173310 testcase( i==13 ); /* REGEXP */
173311 testcase( i==14 ); /* EXPLAIN */
173312 testcase( i==15 ); /* INSTEAD */
173313 testcase( i==16 ); /* ADD */
173314 testcase( i==17 ); /* DATABASE */
173315 testcase( i==18 ); /* AS */
173316 testcase( i==19 ); /* SELECT */
173317 testcase( i==20 ); /* TABLE */
173318 testcase( i==21 ); /* LEFT */
173319 testcase( i==22 ); /* THEN */
173320 testcase( i==23 ); /* END */
173321 testcase( i==24 ); /* DEFERRABLE */
173322 testcase( i==25 ); /* ELSE */
173323 testcase( i==26 ); /* EXCLUDE */
173324 testcase( i==27 ); /* DELETE */
173325 testcase( i==28 ); /* TEMPORARY */
173326 testcase( i==29 ); /* TEMP */
173327 testcase( i==30 ); /* OR */
173328 testcase( i==31 ); /* ISNULL */
173329 testcase( i==32 ); /* NULLS */
173330 testcase( i==33 ); /* SAVEPOINT */
173331 testcase( i==34 ); /* INTERSECT */
173332 testcase( i==35 ); /* TIES */
173333 testcase( i==36 ); /* NOTNULL */
173334 testcase( i==37 ); /* NOT */
173335 testcase( i==38 ); /* NO */
173336 testcase( i==39 ); /* NULL */
173337 testcase( i==40 ); /* LIKE */
173338 testcase( i==41 ); /* EXCEPT */
173339 testcase( i==42 ); /* TRANSACTION */
173340 testcase( i==43 ); /* ACTION */
173341 testcase( i==44 ); /* ON */
173342 testcase( i==45 ); /* NATURAL */
173343 testcase( i==46 ); /* ALTER */
173344 testcase( i==47 ); /* RAISE */
173345 testcase( i==48 ); /* EXCLUSIVE */
173346 testcase( i==49 ); /* EXISTS */
173347 testcase( i==50 ); /* CONSTRAINT */
173348 testcase( i==51 ); /* INTO */
173349 testcase( i==52 ); /* OFFSET */
173350 testcase( i==53 ); /* OF */
173351 testcase( i==54 ); /* SET */
173352 testcase( i==55 ); /* TRIGGER */
173353 testcase( i==56 ); /* RANGE */
173354 testcase( i==57 ); /* GENERATED */
173355 testcase( i==58 ); /* DETACH */
173356 testcase( i==59 ); /* HAVING */
173357 testcase( i==60 ); /* GLOB */
173358 testcase( i==61 ); /* BEGIN */
173359 testcase( i==62 ); /* INNER */
173360 testcase( i==63 ); /* REFERENCES */
173361 testcase( i==64 ); /* UNIQUE */
173362 testcase( i==65 ); /* QUERY */
173363 testcase( i==66 ); /* WITHOUT */
173364 testcase( i==67 ); /* WITH */
173365 testcase( i==68 ); /* OUTER */
173366 testcase( i==69 ); /* RELEASE */
173367 testcase( i==70 ); /* ATTACH */
173368 testcase( i==71 ); /* BETWEEN */
173369 testcase( i==72 ); /* NOTHING */
173370 testcase( i==73 ); /* GROUPS */
173371 testcase( i==74 ); /* GROUP */
173372 testcase( i==75 ); /* CASCADE */
173373 testcase( i==76 ); /* ASC */
173374 testcase( i==77 ); /* DEFAULT */
173375 testcase( i==78 ); /* CASE */
173376 testcase( i==79 ); /* COLLATE */
173377 testcase( i==80 ); /* CREATE */
173378 testcase( i==81 ); /* CURRENT_DATE */
173379 testcase( i==82 ); /* IMMEDIATE */
173380 testcase( i==83 ); /* JOIN */
173381 testcase( i==84 ); /* INSERT */
173382 testcase( i==85 ); /* MATCH */
173383 testcase( i==86 ); /* PLAN */
173384 testcase( i==87 ); /* ANALYZE */
173385 testcase( i==88 ); /* PRAGMA */
173386 testcase( i==89 ); /* MATERIALIZED */
173387 testcase( i==90 ); /* DEFERRED */
173388 testcase( i==91 ); /* DISTINCT */
173389 testcase( i==92 ); /* IS */
173390 testcase( i==93 ); /* UPDATE */
173391 testcase( i==94 ); /* VALUES */
173392 testcase( i==95 ); /* VIRTUAL */
173393 testcase( i==96 ); /* ALWAYS */
173394 testcase( i==97 ); /* WHEN */
173395 testcase( i==98 ); /* WHERE */
173396 testcase( i==99 ); /* RECURSIVE */
173397 testcase( i==100 ); /* ABORT */
173398 testcase( i==101 ); /* AFTER */
173399 testcase( i==102 ); /* RENAME */
173400 testcase( i==103 ); /* AND */
173401 testcase( i==104 ); /* DROP */
173402 testcase( i==105 ); /* PARTITION */
173403 testcase( i==106 ); /* AUTOINCREMENT */
173404 testcase( i==107 ); /* TO */
173405 testcase( i==108 ); /* IN */
173406 testcase( i==109 ); /* CAST */
173407 testcase( i==110 ); /* COLUMN */
173408 testcase( i==111 ); /* COMMIT */
173409 testcase( i==112 ); /* CONFLICT */
173410 testcase( i==113 ); /* CROSS */
173411 testcase( i==114 ); /* CURRENT_TIMESTAMP */
173412 testcase( i==115 ); /* CURRENT_TIME */
173413 testcase( i==116 ); /* CURRENT */
173414 testcase( i==117 ); /* PRECEDING */
173415 testcase( i==118 ); /* FAIL */
173416 testcase( i==119 ); /* LAST */
173417 testcase( i==120 ); /* FILTER */
173418 testcase( i==121 ); /* REPLACE */
173419 testcase( i==122 ); /* FIRST */
173420 testcase( i==123 ); /* FOLLOWING */
173421 testcase( i==124 ); /* FROM */
173422 testcase( i==125 ); /* FULL */
173423 testcase( i==126 ); /* LIMIT */
173424 testcase( i==127 ); /* IF */
173425 testcase( i==128 ); /* ORDER */
173426 testcase( i==129 ); /* RESTRICT */
173427 testcase( i==130 ); /* OTHERS */
173428 testcase( i==131 ); /* OVER */
173429 testcase( i==132 ); /* RETURNING */
173430 testcase( i==133 ); /* RIGHT */
173431 testcase( i==134 ); /* ROLLBACK */
173432 testcase( i==135 ); /* ROWS */
173433 testcase( i==136 ); /* ROW */
173434 testcase( i==137 ); /* UNBOUNDED */
173435 testcase( i==138 ); /* UNION */
173436 testcase( i==139 ); /* USING */
173437 testcase( i==140 ); /* VACUUM */
173438 testcase( i==141 ); /* VIEW */
173439 testcase( i==142 ); /* WINDOW */
173440 testcase( i==143 ); /* DO */
173441 testcase( i==144 ); /* BY */
173442 testcase( i==145 ); /* INITIALLY */
173443 testcase( i==146 ); /* ALL */
173444 testcase( i==147 ); /* PRIMARY */
173445 *pType = aKWCode[i];
173446 break;
173447 }
173448 }
173449 return n;
@@ -172845,10 +173454,11 @@
173454 return id;
173455 }
173456 #define SQLITE_N_KEYWORD 147
173457 SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
173458 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
173459 i++;
173460 *pzName = zKWText + aKWOffset[i];
173461 *pnName = aKWLen[i];
173462 return SQLITE_OK;
173463 }
173464 SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; }
@@ -174383,13 +174993,25 @@
174993 */
174994 SQLITE_API int sqlite3_config(int op, ...){
174995 va_list ap;
174996 int rc = SQLITE_OK;
174997
174998 /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while
174999 ** the SQLite library is in use. Except, a few selected opcodes
175000 ** are allowed.
175001 */
175002 if( sqlite3GlobalConfig.isInit ){
175003 static const u64 mAnytimeConfigOption = 0
175004 | MASKBIT64( SQLITE_CONFIG_LOG )
175005 | MASKBIT64( SQLITE_CONFIG_PCACHE_HDRSZ )
175006 ;
175007 if( op<0 || op>63 || (MASKBIT64(op) & mAnytimeConfigOption)==0 ){
175008 return SQLITE_MISUSE_BKPT;
175009 }
175010 testcase( op==SQLITE_CONFIG_LOG );
175011 testcase( op==SQLITE_CONFIG_PCACHE_HDRSZ );
175012 }
175013
175014 va_start(ap, op);
175015 switch( op ){
175016
175017 /* Mutex configuration options are only available in a threadsafe
@@ -174454,10 +175076,11 @@
175076 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
175077 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
175078 break;
175079 }
175080 case SQLITE_CONFIG_MEMSTATUS: {
175081 assert( !sqlite3GlobalConfig.isInit ); /* Cannot change at runtime */
175082 /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
175083 ** single argument of type int, interpreted as a boolean, which enables
175084 ** or disables the collection of memory allocation statistics. */
175085 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
175086 break;
@@ -174577,12 +175200,14 @@
175200 /* MSVC is picky about pulling func ptrs from va lists.
175201 ** http://support.microsoft.com/kb/47961
175202 ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
175203 */
175204 typedef void(*LOGFUNC_t)(void*,int,const char*);
175205 LOGFUNC_t xLog = va_arg(ap, LOGFUNC_t);
175206 void *pLogArg = va_arg(ap, void*);
175207 AtomicStore(&sqlite3GlobalConfig.xLog, xLog);
175208 AtomicStore(&sqlite3GlobalConfig.pLogArg, pLogArg);
175209 break;
175210 }
175211
175212 /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
175213 ** can be changed at start-time using the
@@ -174592,11 +175217,12 @@
175217 case SQLITE_CONFIG_URI: {
175218 /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
175219 ** argument of type int. If non-zero, then URI handling is globally
175220 ** enabled. If the parameter is zero, then URI handling is globally
175221 ** disabled. */
175222 int bOpenUri = va_arg(ap, int);
175223 AtomicStore(&sqlite3GlobalConfig.bOpenUri, bOpenUri);
175224 break;
175225 }
175226
175227 case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
175228 /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174907,10 +175533,12 @@
175533 { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
175534 { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
175535 { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
175536 { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
175537 { SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
175538 { SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus },
175539 { SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder },
175540 };
175541 unsigned int i;
175542 rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
175543 for(i=0; i<ArraySize(aFlagOp); i++){
175544 if( aFlagOp[i].op==op ){
@@ -176892,13 +177520,13 @@
177520 char c;
177521 int nUri = sqlite3Strlen30(zUri);
177522
177523 assert( *pzErrMsg==0 );
177524
177525 if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
177526 || AtomicLoad(&sqlite3GlobalConfig.bOpenUri)) /* IMP: R-51689-46548 */
177527 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
177528 ){
177529 char *zOpt;
177530 int eState; /* Parser state when parsing URI */
177531 int iIn; /* Input character index */
177532 int iOut = 0; /* Output character index */
@@ -177300,10 +177928,13 @@
177928 #if defined(SQLITE_DEFAULT_DEFENSIVE)
177929 | SQLITE_Defensive
177930 #endif
177931 #if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177932 | SQLITE_LegacyAlter
177933 #endif
177934 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
177935 | SQLITE_StmtScanStatus
177936 #endif
177937 ;
177938 sqlite3HashInit(&db->aCollSeq);
177939 #ifndef SQLITE_OMIT_VIRTUALTABLE
177940 sqlite3HashInit(&db->aModule);
@@ -193069,20 +193700,22 @@
193700 static int fts3MsrBufferData(
193701 Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193702 char *pList,
193703 i64 nList
193704 ){
193705 if( (nList+FTS3_NODE_PADDING)>pMsr->nBuffer ){
193706 char *pNew;
193707 int nNew = nList*2 + FTS3_NODE_PADDING;
193708 pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, nNew);
193709 if( !pNew ) return SQLITE_NOMEM;
193710 pMsr->aBuffer = pNew;
193711 pMsr->nBuffer = nNew;
193712 }
193713
193714 assert( nList>0 );
193715 memcpy(pMsr->aBuffer, pList, nList);
193716 memset(&pMsr->aBuffer[nList], 0, FTS3_NODE_PADDING);
193717 return SQLITE_OK;
193718 }
193719
193720 SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193721 Fts3Table *p, /* Virtual table handle */
@@ -199070,12 +199703,15 @@
199703 switch( sqlite3_value_type(pValue) ){
199704 case SQLITE_NULL: {
199705 jsonAppendRaw(p, "null", 4);
199706 break;
199707 }
 
199708 case SQLITE_FLOAT: {
199709 jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue));
199710 break;
199711 }
199712 case SQLITE_INTEGER: {
199713 const char *z = (const char*)sqlite3_value_text(pValue);
199714 u32 n = (u32)sqlite3_value_bytes(pValue);
199715 jsonAppendRaw(p, z, n);
199716 break;
199717 }
@@ -199517,10 +200153,31 @@
200153 int i;
200154 for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0;
200155 return 1;
200156 }
200157
200158 #ifdef SQLITE_ENABLE_JSON_NAN_INF
200159 /*
200160 ** Extra floating-point literals to allow in JSON.
200161 */
200162 static const struct NanInfName {
200163 char c1;
200164 char c2;
200165 char n;
200166 char eType;
200167 char nRepl;
200168 char *zMatch;
200169 char *zRepl;
200170 } aNanInfName[] = {
200171 { 'i', 'I', 3, JSON_REAL, 7, "inf", "9.0e999" },
200172 { 'i', 'I', 8, JSON_REAL, 7, "infinity", "9.0e999" },
200173 { 'n', 'N', 3, JSON_NULL, 4, "NaN", "null" },
200174 { 'q', 'Q', 4, JSON_NULL, 4, "QNaN", "null" },
200175 { 's', 'S', 4, JSON_NULL, 4, "SNaN", "null" },
200176 };
200177 #endif /* SQLITE_ENABLE_JSON_NAN_INF */
200178
200179 /*
200180 ** Parse a single JSON value which begins at pParse->zJson[i]. Return the
200181 ** index of the first character past the end of the value parsed.
200182 **
200183 ** Return negative for a syntax error. Special cases: return -2 if the
@@ -199662,10 +200319,28 @@
200319 c = z[j+1];
200320 }
200321 if( c<'0' || c>'9' ) return -1;
200322 continue;
200323 }
200324 #ifdef SQLITE_ENABLE_JSON_NAN_INF
200325 /* Non-standard JSON: Allow "-Inf" (in any case)
200326 ** to be understood as floating point literals. */
200327 if( (c=='i' || c=='I')
200328 && j==i+1
200329 && z[i]=='-'
200330 && sqlite3StrNICmp(&z[j], "inf",3)==0
200331 ){
200332 if( !sqlite3Isalnum(z[j+3]) ){
200333 jsonParseAddNode(pParse, JSON_REAL, 8, "-9.0e999");
200334 return i+4;
200335 }else if( (sqlite3StrNICmp(&z[j],"infinity",8)==0 &&
200336 !sqlite3Isalnum(z[j+8])) ){
200337 jsonParseAddNode(pParse, JSON_REAL, 8, "-9.0e999");
200338 return i+9;
200339 }
200340 }
200341 #endif
200342 break;
200343 }
200344 if( z[j-1]<'0' ) return -1;
200345 jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT,
200346 j - i, &z[i]);
@@ -199675,10 +200350,24 @@
200350 }else if( c==']' ){
200351 return -3; /* End of [...] */
200352 }else if( c==0 ){
200353 return 0; /* End of file */
200354 }else{
200355 #ifdef SQLITE_ENABLE_JSON_NAN_INF
200356 int k, nn;
200357 for(k=0; k<sizeof(aNanInfName)/sizeof(aNanInfName[0]); k++){
200358 if( c!=aNanInfName[k].c1 && c!=aNanInfName[k].c2 ) continue;
200359 nn = aNanInfName[k].n;
200360 if( sqlite3StrNICmp(&z[i], aNanInfName[k].zMatch, nn)!=0 ){
200361 continue;
200362 }
200363 if( sqlite3Isalnum(z[i+nn]) ) continue;
200364 jsonParseAddNode(pParse, aNanInfName[k].eType,
200365 aNanInfName[k].nRepl, aNanInfName[k].zRepl);
200366 return i + nn;
200367 }
200368 #endif
200369 return -1; /* Syntax error */
200370 }
200371 }
200372
200373 /*
@@ -212497,19 +213186,28 @@
213186
213187 iOff = (i64)(pFrame->iDbPage-1) * p->pgsz;
213188 p->rc = pDb->pMethods->xWrite(pDb, p->aBuf, p->pgsz, iOff);
213189 }
213190
213191 /*
213192 ** This value is copied from the definition of ZIPVFS_CTRL_FILE_POINTER
213193 ** in zipvfs.h.
213194 */
213195 #define RBU_ZIPVFS_CTRL_FILE_POINTER 230439
213196
213197 /*
213198 ** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if
213199 ** successful, or an SQLite error code otherwise.
213200 */
213201 static int rbuLockDatabase(sqlite3 *db){
213202 int rc = SQLITE_OK;
213203 sqlite3_file *fd = 0;
213204
213205 sqlite3_file_control(db, "main", RBU_ZIPVFS_CTRL_FILE_POINTER, &fd);
213206 if( fd==0 ){
213207 sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd);
213208 }
213209
213210 if( fd->pMethods ){
213211 rc = fd->pMethods->xLock(fd, SQLITE_LOCK_SHARED);
213212 if( rc==SQLITE_OK ){
213213 rc = fd->pMethods->xLock(fd, SQLITE_LOCK_EXCLUSIVE);
@@ -215744,10 +216442,11 @@
216442 (void)argc;
216443 (void)argv;
216444 (void)pzErr;
216445
216446 sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
216447 sqlite3_vtab_config(db, SQLITE_VTAB_USES_ALL_SCHEMAS);
216448 rc = sqlite3_declare_vtab(db,
216449 "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
216450 if( rc==SQLITE_OK ){
216451 pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable));
216452 if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
@@ -215827,11 +216526,10 @@
216526 && pIdxInfo->aOrderBy[0].iColumn<=0
216527 && pIdxInfo->aOrderBy[0].desc==0
216528 ){
216529 pIdxInfo->orderByConsumed = 1;
216530 }
 
216531 return SQLITE_OK;
216532 }
216533
216534 /*
216535 ** Open a new dbpagevfs cursor.
@@ -218216,13 +218914,14 @@
218914 SessionBuffer *p,
218915 const char *zStr,
218916 int *pRc
218917 ){
218918 int nStr = sqlite3Strlen30(zStr);
218919 if( 0==sessionBufferGrow(p, nStr+1, pRc) ){
218920 memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218921 p->nBuf += nStr;
218922 p->aBuf[p->nBuf] = 0x00;
218923 }
218924 }
218925
218926 /*
218927 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218239,10 +218938,31 @@
218938 ){
218939 char aBuf[24];
218940 sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218941 sessionAppendStr(p, aBuf, pRc);
218942 }
218943
218944 static void sessionAppendPrintf(
218945 SessionBuffer *p, /* Buffer to append to */
218946 int *pRc,
218947 const char *zFmt,
218948 ...
218949 ){
218950 if( *pRc==SQLITE_OK ){
218951 char *zApp = 0;
218952 va_list ap;
218953 va_start(ap, zFmt);
218954 zApp = sqlite3_vmprintf(zFmt, ap);
218955 if( zApp==0 ){
218956 *pRc = SQLITE_NOMEM;
218957 }else{
218958 sessionAppendStr(p, zApp, pRc);
218959 }
218960 va_end(ap);
218961 sqlite3_free(zApp);
218962 }
218963 }
218964
218965 /*
218966 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
218967 ** called. Otherwise, append the string zStr enclosed in quotes (") and
218968 ** with any embedded quote characters escaped to the buffer. No
@@ -218254,11 +218974,11 @@
218974 static void sessionAppendIdent(
218975 SessionBuffer *p, /* Buffer to a append to */
218976 const char *zStr, /* String to quote, escape and append */
218977 int *pRc /* IN/OUT: Error code */
218978 ){
218979 int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2;
218980 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218981 char *zOut = (char *)&p->aBuf[p->nBuf];
218982 const char *zIn = zStr;
218983 *zOut++ = '"';
218984 while( *zIn ){
@@ -218265,10 +218985,11 @@
218985 if( *zIn=='"' ) *zOut++ = '"';
218986 *zOut++ = *(zIn++);
218987 }
218988 *zOut++ = '"';
218989 p->nBuf = (int)((u8 *)zOut - p->aBuf);
218990 p->aBuf[p->nBuf] = 0x00;
218991 }
218992 }
218993
218994 /*
218995 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218489,33 +219210,82 @@
219210
219211 /*
219212 ** Formulate and prepare a SELECT statement to retrieve a row from table
219213 ** zTab in database zDb based on its primary key. i.e.
219214 **
219215 ** SELECT *, <noop-test> FROM zDb.zTab WHERE (pk1, pk2,...) IS (?1, ?2,...)
219216 **
219217 ** where <noop-test> is:
219218 **
219219 ** 1 AND (?A OR ?1 IS <column>) AND ...
219220 **
219221 ** for each non-pk <column>.
219222 */
219223 static int sessionSelectStmt(
219224 sqlite3 *db, /* Database handle */
219225 int bIgnoreNoop,
219226 const char *zDb, /* Database name */
219227 const char *zTab, /* Table name */
219228 int nCol, /* Number of columns in table */
219229 const char **azCol, /* Names of table columns */
219230 u8 *abPK, /* PRIMARY KEY array */
219231 sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
219232 ){
219233 int rc = SQLITE_OK;
219234 char *zSql = 0;
219235 const char *zSep = "";
219236 const char *zCols = "*";
219237 int nSql = -1;
219238 int i;
219239
219240 SessionBuffer nooptest = {0, 0, 0};
219241 SessionBuffer pkfield = {0, 0, 0};
219242 SessionBuffer pkvar = {0, 0, 0};
219243
219244 sessionAppendStr(&nooptest, ", 1", &rc);
219245
219246 if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
219247 sessionAppendStr(&nooptest, " AND (?6 OR ?3 IS stat)", &rc);
219248 sessionAppendStr(&pkfield, "tbl, idx", &rc);
219249 sessionAppendStr(&pkvar,
219250 "?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc
219251 );
219252 zCols = "tbl, ?2, stat";
219253 }else{
219254 for(i=0; i<nCol; i++){
219255
219256 if( abPK[i] ){
219257 sessionAppendStr(&pkfield, zSep, &rc);
219258 sessionAppendStr(&pkvar, zSep, &rc);
219259 zSep = ", ";
219260 sessionAppendIdent(&pkfield, azCol[i], &rc);
219261 sessionAppendPrintf(&pkvar, &rc, "?%d", i+1);
219262 }else{
219263 sessionAppendPrintf(&nooptest, &rc,
219264 " AND (?%d OR ?%d IS %w.%w)", i+1+nCol, i+1, zTab, azCol[i]
219265 );
219266 }
219267 }
219268 }
219269
219270 if( rc==SQLITE_OK ){
219271 zSql = sqlite3_mprintf(
219272 "SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)",
219273 zCols, (bIgnoreNoop ? (char*)nooptest.aBuf : ""),
219274 zDb, zTab, (char*)pkfield.aBuf, (char*)pkvar.aBuf
219275 );
219276 if( zSql==0 ) rc = SQLITE_NOMEM;
219277 }
219278
219279 #if 0
219280 if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
219281 zSql = sqlite3_mprintf(
219282 "SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
219283 "idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
219284 );
219285 if( zSql==0 ) rc = SQLITE_NOMEM;
219286 }else{
 
219287 const char *zSep = "";
219288 SessionBuffer buf = {0, 0, 0};
219289
219290 sessionAppendStr(&buf, "SELECT * FROM ", &rc);
219291 sessionAppendIdent(&buf, zDb, &rc);
@@ -218532,15 +219302,19 @@
219302 }
219303 }
219304 zSql = (char*)buf.aBuf;
219305 nSql = buf.nBuf;
219306 }
219307 #endif
219308
219309 if( rc==SQLITE_OK ){
219310 rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
219311 }
219312 sqlite3_free(zSql);
219313 sqlite3_free(nooptest.aBuf);
219314 sqlite3_free(pkfield.aBuf);
219315 sqlite3_free(pkvar.aBuf);
219316 return rc;
219317 }
219318
219319 /*
219320 ** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218696,11 +219470,12 @@
219470 sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
219471
219472 /* Build and compile a statement to execute: */
219473 if( rc==SQLITE_OK ){
219474 rc = sessionSelectStmt(
219475 db, 0, pSession->zDb, zName, nCol, azCol, abPK, &pSel
219476 );
219477 }
219478
219479 nNoop = buf.nBuf;
219480 for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
219481 SessionChange *p; /* Used to iterate through changes */
@@ -219885,10 +220660,11 @@
220660 int bInvertConstraints; /* Invert when iterating constraints buffer */
220661 SessionBuffer constraints; /* Deferred constraints are stored here */
220662 SessionBuffer rebase; /* Rebase information (if any) here */
220663 u8 bRebaseStarted; /* If table header is already in rebase */
220664 u8 bRebase; /* True to collect rebase information */
220665 u8 bIgnoreNoop; /* True to ignore no-op conflicts */
220666 };
220667
220668 /* Number of prepared UPDATE statements to cache. */
220669 #define SESSION_UPDATE_CACHE_SZ 12
220670
@@ -220135,12 +220911,13 @@
220911 static int sessionSelectRow(
220912 sqlite3 *db, /* Database handle */
220913 const char *zTab, /* Table name */
220914 SessionApplyCtx *p /* Session changeset-apply context */
220915 ){
220916 return sessionSelectStmt(db, p->bIgnoreNoop,
220917 "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect
220918 );
220919 }
220920
220921 /*
220922 ** Formulate and prepare an INSERT statement to add a record to table zTab.
220923 ** For example:
@@ -220295,23 +221072,36 @@
221072 ** new.* record to the SELECT statement. Or, if it points to a DELETE or
221073 ** UPDATE, bind values from the old.* record.
221074 */
221075 static int sessionSeekToRow(
221076 sqlite3_changeset_iter *pIter, /* Changeset iterator */
221077 SessionApplyCtx *p
 
221078 ){
221079 sqlite3_stmt *pSelect = p->pSelect;
221080 int rc; /* Return code */
221081 int nCol; /* Number of columns in table */
221082 int op; /* Changset operation (SQLITE_UPDATE etc.) */
221083 const char *zDummy; /* Unused */
221084
221085 sqlite3_clear_bindings(pSelect);
221086 sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
221087 rc = sessionBindRow(pIter,
221088 op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
221089 nCol, p->abPK, pSelect
221090 );
221091
221092 if( op!=SQLITE_DELETE && p->bIgnoreNoop ){
221093 int ii;
221094 for(ii=0; rc==SQLITE_OK && ii<nCol; ii++){
221095 if( p->abPK[ii]==0 ){
221096 sqlite3_value *pVal = 0;
221097 sqlite3changeset_new(pIter, ii, &pVal);
221098 sqlite3_bind_int(pSelect, ii+1+nCol, (pVal==0));
221099 if( pVal ) rc = sessionBindValue(pSelect, ii+1, pVal);
221100 }
221101 }
221102 }
221103
221104 if( rc==SQLITE_OK ){
221105 rc = sqlite3_step(pSelect);
221106 if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
221107 }
@@ -220423,20 +221213,26 @@
221213 assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
221214 assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
221215
221216 /* Bind the new.* PRIMARY KEY values to the SELECT statement. */
221217 if( pbReplace ){
221218 rc = sessionSeekToRow(pIter, p);
221219 }else{
221220 rc = SQLITE_OK;
221221 }
221222
221223 if( rc==SQLITE_ROW ){
221224 /* There exists another row with the new.* primary key. */
221225 if( p->bIgnoreNoop
221226 && sqlite3_column_int(p->pSelect, sqlite3_column_count(p->pSelect)-1)
221227 ){
221228 res = SQLITE_CHANGESET_OMIT;
221229 }else{
221230 pIter->pConflict = p->pSelect;
221231 res = xConflict(pCtx, eType, pIter);
221232 pIter->pConflict = 0;
221233 }
221234 rc = sqlite3_reset(p->pSelect);
221235 }else if( rc==SQLITE_OK ){
221236 if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
221237 /* Instead of invoking the conflict handler, append the change blob
221238 ** to the SessionApplyCtx.constraints buffer. */
@@ -220540,11 +221336,11 @@
221336 }
221337 if( rc!=SQLITE_OK ) return rc;
221338
221339 sqlite3_step(p->pDelete);
221340 rc = sqlite3_reset(p->pDelete);
221341 if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 && p->bIgnoreNoop==0 ){
221342 rc = sessionConflictHandler(
221343 SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
221344 );
221345 }else if( (rc&0xff)==SQLITE_CONSTRAINT ){
221346 rc = sessionConflictHandler(
@@ -220597,11 +221393,11 @@
221393 assert( op==SQLITE_INSERT );
221394 if( p->bStat1 ){
221395 /* Check if there is a conflicting row. For sqlite_stat1, this needs
221396 ** to be done using a SELECT, as there is no PRIMARY KEY in the
221397 ** database schema to throw an exception if a duplicate is inserted. */
221398 rc = sessionSeekToRow(pIter, p);
221399 if( rc==SQLITE_ROW ){
221400 rc = SQLITE_CONSTRAINT;
221401 sqlite3_reset(p->pSelect);
221402 }
221403 }
@@ -220774,10 +221570,11 @@
221570
221571 pIter->in.bNoDiscard = 1;
221572 memset(&sApply, 0, sizeof(sApply));
221573 sApply.bRebase = (ppRebase && pnRebase);
221574 sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
221575 sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP);
221576 sqlite3_mutex_enter(sqlite3_db_mutex(db));
221577 if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
221578 rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
221579 }
221580 if( rc==SQLITE_OK ){
@@ -225030,11 +225827,11 @@
225827 UNUSED_PARAM2(pToken, nToken);
225828
225829 if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
225830 iPos = p->iPos++;
225831
225832 if( p->iRangeEnd>=0 ){
225833 if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
225834 if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
225835 }
225836
225837 if( iPos==p->iter.iStart ){
@@ -225042,11 +225839,11 @@
225839 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225840 p->iOff = iStartOff;
225841 }
225842
225843 if( iPos==p->iter.iEnd ){
225844 if( p->iRangeEnd>=0 && p->iter.iStart<p->iRangeStart ){
225845 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225846 }
225847 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225848 fts5HighlightAppend(&rc, p, p->zClose, -1);
225849 p->iOff = iEndOff;
@@ -225053,11 +225850,11 @@
225850 if( rc==SQLITE_OK ){
225851 rc = fts5CInstIterNext(&p->iter);
225852 }
225853 }
225854
225855 if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){
225856 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225857 p->iOff = iEndOff;
225858 if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225859 fts5HighlightAppend(&rc, p, p->zClose, -1);
225860 }
@@ -225088,10 +225885,11 @@
225885
225886 iCol = sqlite3_value_int(apVal[0]);
225887 memset(&ctx, 0, sizeof(HighlightContext));
225888 ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225889 ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
225890 ctx.iRangeEnd = -1;
225891 rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225892
225893 if( ctx.zIn ){
225894 if( rc==SQLITE_OK ){
225895 rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225273,10 +226071,11 @@
226071 nCol = pApi->xColumnCount(pFts);
226072 memset(&ctx, 0, sizeof(HighlightContext));
226073 iCol = sqlite3_value_int(apVal[0]);
226074 ctx.zOpen = fts5ValueToText(apVal[1]);
226075 ctx.zClose = fts5ValueToText(apVal[2]);
226076 ctx.iRangeEnd = -1;
226077 zEllips = fts5ValueToText(apVal[3]);
226078 nToken = sqlite3_value_int(apVal[4]);
226079
226080 iBestCol = (iCol>=0 ? iCol : 0);
226081 nPhrase = pApi->xPhraseCount(pFts);
@@ -240222,11 +241021,11 @@
241021 int nArg, /* Number of args */
241022 sqlite3_value **apUnused /* Function arguments */
241023 ){
241024 assert( nArg==0 );
241025 UNUSED_PARAM2(nArg, apUnused);
241026 sqlite3_result_text(pCtx, "fts5: 2023-04-10 13:20:51 49ba030080dd00b4fdf788fd3da057b333e705fa0fe37d653e2461bf96ca3785", -1, SQLITE_TRANSIENT);
241027 }
241028
241029 /*
241030 ** Return true if zName is the extension on one of the shadow tables used
241031 ** by this module.
241032
+79 -13
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144144
**
145145
** See also: [sqlite3_libversion()],
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149
-#define SQLITE_VERSION "3.41.1"
150
-#define SQLITE_VERSION_NUMBER 3041001
151
-#define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
149
+#define SQLITE_VERSION "3.42.0"
150
+#define SQLITE_VERSION_NUMBER 3042000
151
+#define SQLITE_SOURCE_ID "2023-04-10 18:44:00 4c5a3c5fb351cc1c2ce16c33314ce19c53531f09263f87456283d9d756002f9d"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -1653,23 +1653,26 @@
16531653
**
16541654
** <b>The sqlite3_config() interface is not threadsafe. The application
16551655
** must ensure that no other SQLite interfaces are invoked by other
16561656
** threads while sqlite3_config() is running.</b>
16571657
**
1658
-** The sqlite3_config() interface
1659
-** may only be invoked prior to library initialization using
1660
-** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1661
-** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1662
-** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1663
-** Note, however, that ^sqlite3_config() can be called as part of the
1664
-** implementation of an application-defined [sqlite3_os_init()].
1665
-**
16661658
** The first argument to sqlite3_config() is an integer
16671659
** [configuration option] that determines
16681660
** what property of SQLite is to be configured. Subsequent arguments
16691661
** vary depending on the [configuration option]
16701662
** in the first argument.
1663
+**
1664
+** For most configuration options, the sqlite3_config() interface
1665
+** may only be invoked prior to library initialization using
1666
+** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1667
+** The exceptional configuration options that may be invoked at any time
1668
+** are called "anytime configuration options".
1669
+** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1670
+** [sqlite3_shutdown()] with a first argument that is not an anytime
1671
+** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1672
+** Note, however, that ^sqlite3_config() can be called as part of the
1673
+** implementation of an application-defined [sqlite3_os_init()].
16711674
**
16721675
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
16731676
** ^If the option is unknown or SQLite is unable to set the option
16741677
** then this routine returns a non-zero [error code].
16751678
*/
@@ -1773,10 +1776,27 @@
17731776
** CAPI3REF: Configuration Options
17741777
** KEYWORDS: {configuration option}
17751778
**
17761779
** These constants are the available integer configuration options that
17771780
** can be passed as the first argument to the [sqlite3_config()] interface.
1781
+**
1782
+** Most of the configuration options for sqlite3_config()
1783
+** will only work if invoked prior to [sqlite3_initialize()] or after
1784
+** [sqlite3_shutdown()]. The few exceptions to this rule are called
1785
+** "anytime configuration options".
1786
+** ^Calling [sqlite3_config()] with a first argument that is not an
1787
+** anytime configuration option in between calls to [sqlite3_initialize()] and
1788
+** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
1789
+**
1790
+** The set of anytime configuration options can change (by insertions
1791
+** and/or deletions) from one release of SQLite to the next.
1792
+** As of SQLite version 3.42.0, the complete set of anytime configuration
1793
+** options is:
1794
+** <ul>
1795
+** <li> SQLITE_CONFIG_LOG
1796
+** <li> SQLITE_CONFIG_PCACHE_HDRSZ
1797
+** </ul>
17781798
**
17791799
** New configuration options may be added in future releases of SQLite.
17801800
** Existing configuration options might be discontinued. Applications
17811801
** should check the return code from [sqlite3_config()] to make sure that
17821802
** the call worked. The [sqlite3_config()] interface will return a
@@ -2434,10 +2454,30 @@
24342454
** the [VACUUM] command will fail with an obscure error when attempting to
24352455
** process a table with generated columns and a descending index. This is
24362456
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
24372457
** either generated columns or decending indexes.
24382458
** </dd>
2459
+**
2460
+** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2461
+** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2462
+** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2463
+** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2464
+** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2465
+** statistics. For statistics to be collected, the flag must be set on
2466
+** the database handle both when the SQL statement is prepared and when it
2467
+** is stepped. The flag is set (collection of statistics is enabled)
2468
+** by default.</dd>
2469
+**
2470
+** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2471
+** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2472
+** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2473
+** in which tables and indexes are scanned so that the scans start at the end
2474
+** and work toward the beginning rather than starting at the beginning and
2475
+** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2476
+** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2477
+** is useful for application testing.</dd>
2478
+**
24392479
** </dl>
24402480
*/
24412481
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
24422482
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
24432483
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2454,11 +2494,13 @@
24542494
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
24552495
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
24562496
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
24572497
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
24582498
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2459
-#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
2499
+#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
2500
+#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2501
+#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
24602502
24612503
/*
24622504
** CAPI3REF: Enable Or Disable Extended Result Codes
24632505
** METHOD: sqlite3
24642506
**
@@ -9562,22 +9604,32 @@
95629604
** </dd>
95639605
**
95649606
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
95659607
** <dd>Calls of the form
95669608
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9567
-** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
9609
+** the [xConnect] or [xCreate] methods of a [virtual table] implementation
95689610
** identify that virtual table as being safe to use from within triggers
95699611
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
95709612
** virtual table can do no serious harm even if it is controlled by a
95719613
** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
95729614
** flag unless absolutely necessary.
95739615
** </dd>
9616
+**
9617
+** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt>
9618
+** <dd>Calls of the form
9619
+** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
9620
+** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9621
+** instruct the query planner to begin at least a read transaction on
9622
+** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the
9623
+** virtual table is used.
9624
+** </dd>
95749625
** </dl>
95759626
*/
95769627
#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
95779628
#define SQLITE_VTAB_INNOCUOUS 2
95789629
#define SQLITE_VTAB_DIRECTONLY 3
9630
+#define SQLITE_VTAB_USES_ALL_SCHEMAS 4
95799631
95809632
/*
95819633
** CAPI3REF: Determine The Virtual Table Conflict Policy
95829634
**
95839635
** This function may only be called from within a call to the [xUpdate] method
@@ -11911,13 +11963,27 @@
1191111963
**
1191211964
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
1191311965
** Invert the changeset before applying it. This is equivalent to inverting
1191411966
** a changeset using sqlite3changeset_invert() before applying it. It is
1191511967
** an error to specify this flag with a patchset.
11968
+**
11969
+** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
11970
+** Do not invoke the conflict handler callback for any changes that
11971
+** would not actually modify the database even if they were applied.
11972
+** Specifically, this means that the conflict handler is not invoked
11973
+** for:
11974
+** <ul>
11975
+** <li>a delete change if the row being deleted cannot be found,
11976
+** <li>an update change if the modified fields are already set to
11977
+** their new values in the conflicting row, or
11978
+** <li>an insert change if all fields of the conflicting row match
11979
+** the row being inserted.
11980
+** </ul>
1191611981
*/
1191711982
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
1191811983
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
11984
+#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
1191911985
1192011986
/*
1192111987
** CAPI3REF: Constants Passed To The Conflict Handler
1192211988
**
1192311989
** Values that may be passed as the second argument to a conflict-handler.
1192411990
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.41.1"
150 #define SQLITE_VERSION_NUMBER 3041001
151 #define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -1653,23 +1653,26 @@
1653 **
1654 ** <b>The sqlite3_config() interface is not threadsafe. The application
1655 ** must ensure that no other SQLite interfaces are invoked by other
1656 ** threads while sqlite3_config() is running.</b>
1657 **
1658 ** The sqlite3_config() interface
1659 ** may only be invoked prior to library initialization using
1660 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1661 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1662 ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1663 ** Note, however, that ^sqlite3_config() can be called as part of the
1664 ** implementation of an application-defined [sqlite3_os_init()].
1665 **
1666 ** The first argument to sqlite3_config() is an integer
1667 ** [configuration option] that determines
1668 ** what property of SQLite is to be configured. Subsequent arguments
1669 ** vary depending on the [configuration option]
1670 ** in the first argument.
 
 
 
 
 
 
 
 
 
 
 
1671 **
1672 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1673 ** ^If the option is unknown or SQLite is unable to set the option
1674 ** then this routine returns a non-zero [error code].
1675 */
@@ -1773,10 +1776,27 @@
1773 ** CAPI3REF: Configuration Options
1774 ** KEYWORDS: {configuration option}
1775 **
1776 ** These constants are the available integer configuration options that
1777 ** can be passed as the first argument to the [sqlite3_config()] interface.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1778 **
1779 ** New configuration options may be added in future releases of SQLite.
1780 ** Existing configuration options might be discontinued. Applications
1781 ** should check the return code from [sqlite3_config()] to make sure that
1782 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2434,10 +2454,30 @@
2434 ** the [VACUUM] command will fail with an obscure error when attempting to
2435 ** process a table with generated columns and a descending index. This is
2436 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2437 ** either generated columns or decending indexes.
2438 ** </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2439 ** </dl>
2440 */
2441 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2442 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2443 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2454,11 +2494,13 @@
2454 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2455 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2456 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2457 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2458 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2459 #define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
 
 
2460
2461 /*
2462 ** CAPI3REF: Enable Or Disable Extended Result Codes
2463 ** METHOD: sqlite3
2464 **
@@ -9562,22 +9604,32 @@
9562 ** </dd>
9563 **
9564 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
9565 ** <dd>Calls of the form
9566 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9567 ** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
9568 ** identify that virtual table as being safe to use from within triggers
9569 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
9570 ** virtual table can do no serious harm even if it is controlled by a
9571 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
9572 ** flag unless absolutely necessary.
9573 ** </dd>
 
 
 
 
 
 
 
 
 
9574 ** </dl>
9575 */
9576 #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
9577 #define SQLITE_VTAB_INNOCUOUS 2
9578 #define SQLITE_VTAB_DIRECTONLY 3
 
9579
9580 /*
9581 ** CAPI3REF: Determine The Virtual Table Conflict Policy
9582 **
9583 ** This function may only be called from within a call to the [xUpdate] method
@@ -11911,13 +11963,27 @@
11911 **
11912 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
11913 ** Invert the changeset before applying it. This is equivalent to inverting
11914 ** a changeset using sqlite3changeset_invert() before applying it. It is
11915 ** an error to specify this flag with a patchset.
 
 
 
 
 
 
 
 
 
 
 
 
 
11916 */
11917 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
11918 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
 
11919
11920 /*
11921 ** CAPI3REF: Constants Passed To The Conflict Handler
11922 **
11923 ** Values that may be passed as the second argument to a conflict-handler.
11924
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.42.0"
150 #define SQLITE_VERSION_NUMBER 3042000
151 #define SQLITE_SOURCE_ID "2023-04-10 18:44:00 4c5a3c5fb351cc1c2ce16c33314ce19c53531f09263f87456283d9d756002f9d"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -1653,23 +1653,26 @@
1653 **
1654 ** <b>The sqlite3_config() interface is not threadsafe. The application
1655 ** must ensure that no other SQLite interfaces are invoked by other
1656 ** threads while sqlite3_config() is running.</b>
1657 **
 
 
 
 
 
 
 
 
1658 ** The first argument to sqlite3_config() is an integer
1659 ** [configuration option] that determines
1660 ** what property of SQLite is to be configured. Subsequent arguments
1661 ** vary depending on the [configuration option]
1662 ** in the first argument.
1663 **
1664 ** For most configuration options, the sqlite3_config() interface
1665 ** may only be invoked prior to library initialization using
1666 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1667 ** The exceptional configuration options that may be invoked at any time
1668 ** are called "anytime configuration options".
1669 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1670 ** [sqlite3_shutdown()] with a first argument that is not an anytime
1671 ** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1672 ** Note, however, that ^sqlite3_config() can be called as part of the
1673 ** implementation of an application-defined [sqlite3_os_init()].
1674 **
1675 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1676 ** ^If the option is unknown or SQLite is unable to set the option
1677 ** then this routine returns a non-zero [error code].
1678 */
@@ -1773,10 +1776,27 @@
1776 ** CAPI3REF: Configuration Options
1777 ** KEYWORDS: {configuration option}
1778 **
1779 ** These constants are the available integer configuration options that
1780 ** can be passed as the first argument to the [sqlite3_config()] interface.
1781 **
1782 ** Most of the configuration options for sqlite3_config()
1783 ** will only work if invoked prior to [sqlite3_initialize()] or after
1784 ** [sqlite3_shutdown()]. The few exceptions to this rule are called
1785 ** "anytime configuration options".
1786 ** ^Calling [sqlite3_config()] with a first argument that is not an
1787 ** anytime configuration option in between calls to [sqlite3_initialize()] and
1788 ** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
1789 **
1790 ** The set of anytime configuration options can change (by insertions
1791 ** and/or deletions) from one release of SQLite to the next.
1792 ** As of SQLite version 3.42.0, the complete set of anytime configuration
1793 ** options is:
1794 ** <ul>
1795 ** <li> SQLITE_CONFIG_LOG
1796 ** <li> SQLITE_CONFIG_PCACHE_HDRSZ
1797 ** </ul>
1798 **
1799 ** New configuration options may be added in future releases of SQLite.
1800 ** Existing configuration options might be discontinued. Applications
1801 ** should check the return code from [sqlite3_config()] to make sure that
1802 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2434,10 +2454,30 @@
2454 ** the [VACUUM] command will fail with an obscure error when attempting to
2455 ** process a table with generated columns and a descending index. This is
2456 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2457 ** either generated columns or decending indexes.
2458 ** </dd>
2459 **
2460 ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2461 ** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2462 ** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2463 ** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2464 ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2465 ** statistics. For statistics to be collected, the flag must be set on
2466 ** the database handle both when the SQL statement is prepared and when it
2467 ** is stepped. The flag is set (collection of statistics is enabled)
2468 ** by default.</dd>
2469 **
2470 ** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2471 ** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2472 ** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2473 ** in which tables and indexes are scanned so that the scans start at the end
2474 ** and work toward the beginning rather than starting at the beginning and
2475 ** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2476 ** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2477 ** is useful for application testing.</dd>
2478 **
2479 ** </dl>
2480 */
2481 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2482 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2483 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2454,11 +2494,13 @@
2494 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2495 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2496 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2497 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2498 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2499 #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
2500 #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2501 #define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
2502
2503 /*
2504 ** CAPI3REF: Enable Or Disable Extended Result Codes
2505 ** METHOD: sqlite3
2506 **
@@ -9562,22 +9604,32 @@
9604 ** </dd>
9605 **
9606 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
9607 ** <dd>Calls of the form
9608 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9609 ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9610 ** identify that virtual table as being safe to use from within triggers
9611 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
9612 ** virtual table can do no serious harm even if it is controlled by a
9613 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
9614 ** flag unless absolutely necessary.
9615 ** </dd>
9616 **
9617 ** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt>
9618 ** <dd>Calls of the form
9619 ** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
9620 ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9621 ** instruct the query planner to begin at least a read transaction on
9622 ** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the
9623 ** virtual table is used.
9624 ** </dd>
9625 ** </dl>
9626 */
9627 #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
9628 #define SQLITE_VTAB_INNOCUOUS 2
9629 #define SQLITE_VTAB_DIRECTONLY 3
9630 #define SQLITE_VTAB_USES_ALL_SCHEMAS 4
9631
9632 /*
9633 ** CAPI3REF: Determine The Virtual Table Conflict Policy
9634 **
9635 ** This function may only be called from within a call to the [xUpdate] method
@@ -11911,13 +11963,27 @@
11963 **
11964 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
11965 ** Invert the changeset before applying it. This is equivalent to inverting
11966 ** a changeset using sqlite3changeset_invert() before applying it. It is
11967 ** an error to specify this flag with a patchset.
11968 **
11969 ** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
11970 ** Do not invoke the conflict handler callback for any changes that
11971 ** would not actually modify the database even if they were applied.
11972 ** Specifically, this means that the conflict handler is not invoked
11973 ** for:
11974 ** <ul>
11975 ** <li>a delete change if the row being deleted cannot be found,
11976 ** <li>an update change if the modified fields are already set to
11977 ** their new values in the conflicting row, or
11978 ** <li>an insert change if all fields of the conflicting row match
11979 ** the row being inserted.
11980 ** </ul>
11981 */
11982 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
11983 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
11984 #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
11985
11986 /*
11987 ** CAPI3REF: Constants Passed To The Conflict Handler
11988 **
11989 ** Values that may be passed as the second argument to a conflict-handler.
11990
--- skins/ardoise/css.txt
+++ skins/ardoise/css.txt
@@ -307,10 +307,15 @@
307307
text-decoration: none;
308308
text-align: center;
309309
white-space: nowrap;
310310
cursor: pointer
311311
}
312
+input[type=submit]:disabled {
313
+ color: rgb(70,70,70);
314
+ background-color: rgb(153,153,153);
315
+}
316
+
312317
@media (min-width:550px) {
313318
.container {
314319
width: 95%
315320
}
316321
.column,
317322
--- skins/ardoise/css.txt
+++ skins/ardoise/css.txt
@@ -307,10 +307,15 @@
307 text-decoration: none;
308 text-align: center;
309 white-space: nowrap;
310 cursor: pointer
311 }
 
 
 
 
 
312 @media (min-width:550px) {
313 .container {
314 width: 95%
315 }
316 .column,
317
--- skins/ardoise/css.txt
+++ skins/ardoise/css.txt
@@ -307,10 +307,15 @@
307 text-decoration: none;
308 text-align: center;
309 white-space: nowrap;
310 cursor: pointer
311 }
312 input[type=submit]:disabled {
313 color: rgb(70,70,70);
314 background-color: rgb(153,153,153);
315 }
316
317 @media (min-width:550px) {
318 .container {
319 width: 95%
320 }
321 .column,
322
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -562,10 +562,15 @@
562562
input[type="submit"]:focus {
563563
color: white !important;
564564
background-color: #648898;
565565
border-color: #648898;
566566
}
567
+
568
+input[type="submit"]:disabled {
569
+ color: rgb(128,128,128);
570
+ background-color: rgb(153,153,153);
571
+}
567572
568573
569574
/* Forms
570575
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
571576
input[type="email"],
572577
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -562,10 +562,15 @@
562 input[type="submit"]:focus {
563 color: white !important;
564 background-color: #648898;
565 border-color: #648898;
566 }
 
 
 
 
 
567
568
569 /* Forms
570 ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
571 input[type="email"],
572
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -562,10 +562,15 @@
562 input[type="submit"]:focus {
563 color: white !important;
564 background-color: #648898;
565 border-color: #648898;
566 }
567
568 input[type="submit"]:disabled {
569 color: rgb(128,128,128);
570 background-color: rgb(153,153,153);
571 }
572
573
574 /* Forms
575 ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
576 input[type="email"],
577
--- skins/darkmode/css.txt
+++ skins/darkmode/css.txt
@@ -125,10 +125,14 @@
125125
input[type=reset]:hover,
126126
input[type=submit]:hover {
127127
background-color: #FF4500f0;
128128
color: rgba(24,24,24,0.8);
129129
outline: 0
130
+}
131
+input[type=submit]:disabled {
132
+ color: #363636;
133
+ background-color: #707070;
130134
}
131135
.button:focus,
132136
button:focus,
133137
input[type=button]:focus,
134138
input[type=reset]:focus,
135139
--- skins/darkmode/css.txt
+++ skins/darkmode/css.txt
@@ -125,10 +125,14 @@
125 input[type=reset]:hover,
126 input[type=submit]:hover {
127 background-color: #FF4500f0;
128 color: rgba(24,24,24,0.8);
129 outline: 0
 
 
 
 
130 }
131 .button:focus,
132 button:focus,
133 input[type=button]:focus,
134 input[type=reset]:focus,
135
--- skins/darkmode/css.txt
+++ skins/darkmode/css.txt
@@ -125,10 +125,14 @@
125 input[type=reset]:hover,
126 input[type=submit]:hover {
127 background-color: #FF4500f0;
128 color: rgba(24,24,24,0.8);
129 outline: 0
130 }
131 input[type=submit]:disabled {
132 color: #363636;
133 background-color: #707070;
134 }
135 .button:focus,
136 button:focus,
137 input[type=button]:focus,
138 input[type=reset]:focus,
139
--- src/capabilities.c
+++ src/capabilities.c
@@ -387,11 +387,11 @@
387387
" SELECT 'New User Default', %Q, 110, 1"
388388
" UNION ALL"
389389
" SELECT 'Regular User', fullcap(capunion(cap)), 200, count(*) FROM user"
390390
" WHERE cap NOT GLOB '*[as]*' AND login NOT IN (SELECT id FROM t)"
391391
" UNION ALL"
392
- " SELECT 'Adminstrator', fullcap(capunion(cap)), 300, count(*) FROM user"
392
+ " SELECT 'Administrator', fullcap(capunion(cap)), 300, count(*) FROM user"
393393
" WHERE cap GLOB '*[as]*'"
394394
" ORDER BY 3 ASC",
395395
zSelfCap, hasPubPages, zSelfCap
396396
);
397397
@ <table id='capabilitySummary' cellpadding="0" cellspacing="0" border="1">
398398
--- src/capabilities.c
+++ src/capabilities.c
@@ -387,11 +387,11 @@
387 " SELECT 'New User Default', %Q, 110, 1"
388 " UNION ALL"
389 " SELECT 'Regular User', fullcap(capunion(cap)), 200, count(*) FROM user"
390 " WHERE cap NOT GLOB '*[as]*' AND login NOT IN (SELECT id FROM t)"
391 " UNION ALL"
392 " SELECT 'Adminstrator', fullcap(capunion(cap)), 300, count(*) FROM user"
393 " WHERE cap GLOB '*[as]*'"
394 " ORDER BY 3 ASC",
395 zSelfCap, hasPubPages, zSelfCap
396 );
397 @ <table id='capabilitySummary' cellpadding="0" cellspacing="0" border="1">
398
--- src/capabilities.c
+++ src/capabilities.c
@@ -387,11 +387,11 @@
387 " SELECT 'New User Default', %Q, 110, 1"
388 " UNION ALL"
389 " SELECT 'Regular User', fullcap(capunion(cap)), 200, count(*) FROM user"
390 " WHERE cap NOT GLOB '*[as]*' AND login NOT IN (SELECT id FROM t)"
391 " UNION ALL"
392 " SELECT 'Administrator', fullcap(capunion(cap)), 300, count(*) FROM user"
393 " WHERE cap GLOB '*[as]*'"
394 " ORDER BY 3 ASC",
395 zSelfCap, hasPubPages, zSelfCap
396 );
397 @ <table id='capabilitySummary' cellpadding="0" cellspacing="0" border="1">
398
+1 -1
--- src/dispatch.c
+++ src/dispatch.c
@@ -705,11 +705,11 @@
705705
static int edit_distance(const char *zA, const char *zB){
706706
int nA = (int)strlen(zA);
707707
int nB = (int)strlen(zB);
708708
int i, j, m;
709709
int p0, p1, c0;
710
- int a[100];
710
+ int a[100] = {0};
711711
static const int incr = 4;
712712
713713
for(j=0; j<nB; j++) a[j] = 1;
714714
for(i=0; i<nA; i++){
715715
p0 = i==0 ? 0 : i*incr-1;
716716
--- src/dispatch.c
+++ src/dispatch.c
@@ -705,11 +705,11 @@
705 static int edit_distance(const char *zA, const char *zB){
706 int nA = (int)strlen(zA);
707 int nB = (int)strlen(zB);
708 int i, j, m;
709 int p0, p1, c0;
710 int a[100];
711 static const int incr = 4;
712
713 for(j=0; j<nB; j++) a[j] = 1;
714 for(i=0; i<nA; i++){
715 p0 = i==0 ? 0 : i*incr-1;
716
--- src/dispatch.c
+++ src/dispatch.c
@@ -705,11 +705,11 @@
705 static int edit_distance(const char *zA, const char *zB){
706 int nA = (int)strlen(zA);
707 int nB = (int)strlen(zB);
708 int i, j, m;
709 int p0, p1, c0;
710 int a[100] = {0};
711 static const int incr = 4;
712
713 for(j=0; j<nB; j++) a[j] = 1;
714 for(i=0; i<nA; i++){
715 p0 = i==0 ? 0 : i*incr-1;
716
+1 -1
--- src/http.c
+++ src/http.c
@@ -108,11 +108,11 @@
108108
zProjectCode = db_get("parent-project-code", 0);
109109
}else{
110110
zProjectCode = db_get("project-code", 0);
111111
}
112112
zPw = sha1_shared_secret(zPw, zLogin, zProjectCode);
113
- if( g.url.pwConfig!=0 ){
113
+ if( g.url.pwConfig!=0 && (g.url.flags & URL_REMEMBER_PW)!=0 ){
114114
char *x = obscure(zPw);
115115
db_set(g.url.pwConfig/*works-like:"x"*/, x, 0);
116116
fossil_free(x);
117117
}
118118
fossil_free(g.url.passwd);
119119
--- src/http.c
+++ src/http.c
@@ -108,11 +108,11 @@
108 zProjectCode = db_get("parent-project-code", 0);
109 }else{
110 zProjectCode = db_get("project-code", 0);
111 }
112 zPw = sha1_shared_secret(zPw, zLogin, zProjectCode);
113 if( g.url.pwConfig!=0 ){
114 char *x = obscure(zPw);
115 db_set(g.url.pwConfig/*works-like:"x"*/, x, 0);
116 fossil_free(x);
117 }
118 fossil_free(g.url.passwd);
119
--- src/http.c
+++ src/http.c
@@ -108,11 +108,11 @@
108 zProjectCode = db_get("parent-project-code", 0);
109 }else{
110 zProjectCode = db_get("project-code", 0);
111 }
112 zPw = sha1_shared_secret(zPw, zLogin, zProjectCode);
113 if( g.url.pwConfig!=0 && (g.url.flags & URL_REMEMBER_PW)!=0 ){
114 char *x = obscure(zPw);
115 db_set(g.url.pwConfig/*works-like:"x"*/, x, 0);
116 fossil_free(x);
117 }
118 fossil_free(g.url.passwd);
119
+94
--- src/name.c
+++ src/name.c
@@ -243,10 +243,104 @@
243243
" ORDER BY event.mtime DESC LIMIT 1"
244244
") LIMIT 1;",
245245
zType, zTag, zTag, zType
246246
);
247247
}
248
+
249
+/*
250
+** Find the RID for a check-in that is the most recent check-in with
251
+** tag zTag that occurs on or prior to rDate.
252
+**
253
+** See also the performance note on most_recent_event_with_tag() which
254
+** applies to this routine too.
255
+*/
256
+int last_checkin_with_tag_before_date(const char *zTag, double rLimit){
257
+ Stmt s;
258
+ int rid = 0;
259
+ if( strncmp(zTag, "tag:", 4)==0 ) zTag += 4;
260
+ db_prepare(&s,
261
+ "SELECT objid FROM ("
262
+ /* Q1: Begin by looking for the tag in the 30 most recent events */
263
+ "SELECT objid"
264
+ " FROM (SELECT * FROM event WHERE mtime<=:datelimit"
265
+ " ORDER BY mtime DESC LIMIT 30) AS ex"
266
+ " WHERE type='ci'"
267
+ " AND EXISTS(SELECT 1 FROM tagxref, tag"
268
+ " WHERE tag.tagname='sym-%q'"
269
+ " AND tagxref.tagid=tag.tagid"
270
+ " AND tagxref.tagtype>0"
271
+ " AND tagxref.rid=ex.objid)"
272
+ " ORDER BY mtime DESC LIMIT 1"
273
+ ") UNION ALL SELECT * FROM ("
274
+ /* Q2: If the tag is not found in the 30 most recent events, then using
275
+ ** the tagxref table to index for the tag */
276
+ "SELECT event.objid"
277
+ " FROM tag, tagxref, event"
278
+ " WHERE tag.tagname='sym-%q'"
279
+ " AND tagxref.tagid=tag.tagid"
280
+ " AND tagxref.tagtype>0"
281
+ " AND event.objid=tagxref.rid"
282
+ " AND event.type='ci'"
283
+ " AND event.mtime<=:datelimit"
284
+ " ORDER BY event.mtime DESC LIMIT 1"
285
+ ") LIMIT 1;",
286
+ zTag, zTag
287
+ );
288
+ db_bind_double(&s, ":datelimit", rLimit);
289
+ if( db_step(&s)==SQLITE_ROW ){
290
+ rid = db_column_int(&s,0);
291
+ }
292
+ db_finalize(&s);
293
+ return rid;
294
+}
295
+
296
+/*
297
+** Find the RID of the first check-in (chronologically) after rStart that
298
+** has tag zTag.
299
+**
300
+** See also the performance note on most_recent_event_with_tag() which
301
+** applies to this routine too.
302
+*/
303
+int first_checkin_with_tag_after_date(const char *zTag, double rStart){
304
+ Stmt s;
305
+ int rid = 0;
306
+ if( strncmp(zTag, "tag:", 4)==0 ) zTag += 4;
307
+ db_prepare(&s,
308
+ "SELECT objid FROM ("
309
+ /* Q1: Begin by looking for the tag in the 30 most recent events */
310
+ "SELECT objid"
311
+ " FROM (SELECT * FROM event WHERE mtime>=:startdate"
312
+ " ORDER BY mtime LIMIT 30) AS ex"
313
+ " WHERE type='ci'"
314
+ " AND EXISTS(SELECT 1 FROM tagxref, tag"
315
+ " WHERE tag.tagname='sym-%q'"
316
+ " AND tagxref.tagid=tag.tagid"
317
+ " AND tagxref.tagtype>0"
318
+ " AND tagxref.rid=ex.objid)"
319
+ " ORDER BY mtime LIMIT 1"
320
+ ") UNION ALL SELECT * FROM ("
321
+ /* Q2: If the tag is not found in the 30 most recent events, then using
322
+ ** the tagxref table to index for the tag */
323
+ "SELECT event.objid"
324
+ " FROM tag, tagxref, event"
325
+ " WHERE tag.tagname='sym-%q'"
326
+ " AND tagxref.tagid=tag.tagid"
327
+ " AND tagxref.tagtype>0"
328
+ " AND event.objid=tagxref.rid"
329
+ " AND event.type='ci'"
330
+ " AND event.mtime>=:startdate"
331
+ " ORDER BY event.mtime LIMIT 1"
332
+ ") LIMIT 1;",
333
+ zTag, zTag
334
+ );
335
+ db_bind_double(&s, ":startdate", rStart);
336
+ if( db_step(&s)==SQLITE_ROW ){
337
+ rid = db_column_int(&s,0);
338
+ }
339
+ db_finalize(&s);
340
+ return rid;
341
+}
248342
249343
/*
250344
** Return true if character "c" is a character that might have been
251345
** accidentally appended to the end of a URL.
252346
*/
253347
--- src/name.c
+++ src/name.c
@@ -243,10 +243,104 @@
243 " ORDER BY event.mtime DESC LIMIT 1"
244 ") LIMIT 1;",
245 zType, zTag, zTag, zType
246 );
247 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
249 /*
250 ** Return true if character "c" is a character that might have been
251 ** accidentally appended to the end of a URL.
252 */
253
--- src/name.c
+++ src/name.c
@@ -243,10 +243,104 @@
243 " ORDER BY event.mtime DESC LIMIT 1"
244 ") LIMIT 1;",
245 zType, zTag, zTag, zType
246 );
247 }
248
249 /*
250 ** Find the RID for a check-in that is the most recent check-in with
251 ** tag zTag that occurs on or prior to rDate.
252 **
253 ** See also the performance note on most_recent_event_with_tag() which
254 ** applies to this routine too.
255 */
256 int last_checkin_with_tag_before_date(const char *zTag, double rLimit){
257 Stmt s;
258 int rid = 0;
259 if( strncmp(zTag, "tag:", 4)==0 ) zTag += 4;
260 db_prepare(&s,
261 "SELECT objid FROM ("
262 /* Q1: Begin by looking for the tag in the 30 most recent events */
263 "SELECT objid"
264 " FROM (SELECT * FROM event WHERE mtime<=:datelimit"
265 " ORDER BY mtime DESC LIMIT 30) AS ex"
266 " WHERE type='ci'"
267 " AND EXISTS(SELECT 1 FROM tagxref, tag"
268 " WHERE tag.tagname='sym-%q'"
269 " AND tagxref.tagid=tag.tagid"
270 " AND tagxref.tagtype>0"
271 " AND tagxref.rid=ex.objid)"
272 " ORDER BY mtime DESC LIMIT 1"
273 ") UNION ALL SELECT * FROM ("
274 /* Q2: If the tag is not found in the 30 most recent events, then using
275 ** the tagxref table to index for the tag */
276 "SELECT event.objid"
277 " FROM tag, tagxref, event"
278 " WHERE tag.tagname='sym-%q'"
279 " AND tagxref.tagid=tag.tagid"
280 " AND tagxref.tagtype>0"
281 " AND event.objid=tagxref.rid"
282 " AND event.type='ci'"
283 " AND event.mtime<=:datelimit"
284 " ORDER BY event.mtime DESC LIMIT 1"
285 ") LIMIT 1;",
286 zTag, zTag
287 );
288 db_bind_double(&s, ":datelimit", rLimit);
289 if( db_step(&s)==SQLITE_ROW ){
290 rid = db_column_int(&s,0);
291 }
292 db_finalize(&s);
293 return rid;
294 }
295
296 /*
297 ** Find the RID of the first check-in (chronologically) after rStart that
298 ** has tag zTag.
299 **
300 ** See also the performance note on most_recent_event_with_tag() which
301 ** applies to this routine too.
302 */
303 int first_checkin_with_tag_after_date(const char *zTag, double rStart){
304 Stmt s;
305 int rid = 0;
306 if( strncmp(zTag, "tag:", 4)==0 ) zTag += 4;
307 db_prepare(&s,
308 "SELECT objid FROM ("
309 /* Q1: Begin by looking for the tag in the 30 most recent events */
310 "SELECT objid"
311 " FROM (SELECT * FROM event WHERE mtime>=:startdate"
312 " ORDER BY mtime LIMIT 30) AS ex"
313 " WHERE type='ci'"
314 " AND EXISTS(SELECT 1 FROM tagxref, tag"
315 " WHERE tag.tagname='sym-%q'"
316 " AND tagxref.tagid=tag.tagid"
317 " AND tagxref.tagtype>0"
318 " AND tagxref.rid=ex.objid)"
319 " ORDER BY mtime LIMIT 1"
320 ") UNION ALL SELECT * FROM ("
321 /* Q2: If the tag is not found in the 30 most recent events, then using
322 ** the tagxref table to index for the tag */
323 "SELECT event.objid"
324 " FROM tag, tagxref, event"
325 " WHERE tag.tagname='sym-%q'"
326 " AND tagxref.tagid=tag.tagid"
327 " AND tagxref.tagtype>0"
328 " AND event.objid=tagxref.rid"
329 " AND event.type='ci'"
330 " AND event.mtime>=:startdate"
331 " ORDER BY event.mtime LIMIT 1"
332 ") LIMIT 1;",
333 zTag, zTag
334 );
335 db_bind_double(&s, ":startdate", rStart);
336 if( db_step(&s)==SQLITE_ROW ){
337 rid = db_column_int(&s,0);
338 }
339 db_finalize(&s);
340 return rid;
341 }
342
343 /*
344 ** Return true if character "c" is a character that might have been
345 ** accidentally appended to the end of a URL.
346 */
347
+60 -3
--- src/timeline.c
+++ src/timeline.c
@@ -1566,10 +1566,11 @@
15661566
** n1=COUNT Same as "n" but doesn't set the display-preference cookie
15671567
** Use "n1=COUNT" for a one-time display change
15681568
** p=CHECKIN Parents and ancestors of CHECKIN
15691569
** bt=PRIOR ... going back to PRIOR
15701570
** d=CHECKIN Children and descendants of CHECKIN
1571
+** ft=DESCENDANT ... going forward to DESCENDANT
15711572
** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
15721573
** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
15731574
** bt=CHECKIN In conjunction with p=CX, this means show all
15741575
** ancestors of CX going back to the time of CHECKIN.
15751576
** All qualifying check-ins are shown unless there
@@ -2089,11 +2090,13 @@
20892090
/* If p= or d= is present, ignore all other parameters other than n= */
20902091
char *zUuid;
20912092
const char *zCiName;
20922093
int np = 0, nd;
20932094
const char *zBackTo = 0;
2095
+ const char *zFwdTo = 0;
20942096
int ridBackTo = 0;
2097
+ int ridFwdTo = 0;
20952098
20962099
tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS;
20972100
if( p_rid && d_rid ){
20982101
if( p_rid!=d_rid ) p_rid = d_rid;
20992102
if( !haveParameterN ) nEntry = 10;
@@ -2106,11 +2109,43 @@
21062109
zCiName = pd_rid ? P("pd") : p_rid ? P("p") : P("d");
21072110
if( zCiName==0 ) zCiName = zUuid;
21082111
blob_append_sql(&sql, " AND event.objid IN ok");
21092112
nd = 0;
21102113
if( d_rid ){
2111
- compute_descendants(d_rid, nEntry==0 ? 0 : nEntry+1);
2114
+ Stmt s;
2115
+ double rStopTime = 9e99;
2116
+ zFwdTo = P("ft");
2117
+ if( zFwdTo ){
2118
+ double rStartDate = db_double(0.0,
2119
+ "SELECT mtime FROM event WHERE objid=%d", d_rid);
2120
+ ridFwdTo = first_checkin_with_tag_after_date(zFwdTo, rStartDate);
2121
+ if( ridFwdTo==0 ){
2122
+ ridFwdTo = name_to_typed_rid(zBackTo,"ci");
2123
+ }
2124
+ if( ridFwdTo ){
2125
+ if( !haveParameterN ) nEntry = 0;
2126
+ rStopTime = db_double(9e99,
2127
+ "SELECT mtime FROM event WHERE objid=%d", ridFwdTo);
2128
+ }
2129
+ }
2130
+ db_prepare(&s,
2131
+ "WITH RECURSIVE"
2132
+ " dx(rid,mtime) AS ("
2133
+ " SELECT %d, 0"
2134
+ " UNION"
2135
+ " SELECT plink.cid, plink.mtime FROM dx, plink"
2136
+ " WHERE plink.pid=dx.rid"
2137
+ " AND (:stop>=8e99 OR plink.mtime<=:stop)"
2138
+ " ORDER BY 2"
2139
+ " )"
2140
+ "INSERT OR IGNORE INTO ok SELECT rid FROM dx LIMIT %d",
2141
+ d_rid, nEntry<=0 ? -1 : nEntry+1
2142
+ );
2143
+ db_bind_double(&s, ":stop", rStopTime);
2144
+ db_step(&s);
2145
+ db_finalize(&s);
2146
+ /* compute_descendants(d_rid, nEntry==0 ? 0 : nEntry+1); */
21122147
nd = db_int(0, "SELECT count(*)-1 FROM ok");
21132148
if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
21142149
if( nd>0 || p_rid==0 ){
21152150
blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
21162151
}
@@ -2117,12 +2152,19 @@
21172152
if( useDividers && !selectedRid ) selectedRid = d_rid;
21182153
db_multi_exec("DELETE FROM ok");
21192154
}
21202155
if( p_rid ){
21212156
zBackTo = P("bt");
2122
- ridBackTo = zBackTo ? name_to_typed_rid(zBackTo,"ci") : 0;
2123
- if( ridBackTo && !haveParameterN ) nEntry = 0;
2157
+ if( zBackTo ){
2158
+ double rDateLimit = db_double(0.0,
2159
+ "SELECT mtime FROM event WHERE objid=%d", p_rid);
2160
+ ridBackTo = last_checkin_with_tag_before_date(zBackTo, rDateLimit);
2161
+ if( ridBackTo==0 ){
2162
+ ridBackTo = name_to_typed_rid(zBackTo,"ci");
2163
+ }
2164
+ if( ridBackTo && !haveParameterN ) nEntry = 0;
2165
+ }
21242166
compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0, ridBackTo);
21252167
np = db_int(0, "SELECT count(*)-1 FROM ok");
21262168
if( np>0 || nd==0 ){
21272169
if( nd>0 ) blob_appendf(&desc, " and ");
21282170
blob_appendf(&desc, "%d ancestor%s", np, (1==np)?"":"s");
@@ -2141,10 +2183,25 @@
21412183
href("%R/info?name=%h",zCiName), zCiName,
21422184
href("%R/info?name=%h",zBackTo), zBackTo);
21432185
}else{
21442186
blob_appendf(&desc, " back to %z%h</a>",
21452187
href("%R/info?name=%h",zBackTo), zBackTo);
2188
+ if( ridFwdTo && zFwdTo ){
2189
+ blob_appendf(&desc, " and up to %z%h</a>",
2190
+ href("%R/info?name=%h",zFwdTo), zFwdTo);
2191
+ }
2192
+ }
2193
+ }else if( ridFwdTo ){
2194
+ if( nd==0 ){
2195
+ blob_reset(&desc);
2196
+ blob_appendf(&desc,
2197
+ "Check-in %z%h</a> only (%z%h</a> is not an descendant)",
2198
+ href("%R/info?name=%h",zCiName), zCiName,
2199
+ href("%R/info?name=%h",zFwdTo), zFwdTo);
2200
+ }else{
2201
+ blob_appendf(&desc, " up to %z%h</a>",
2202
+ href("%R/info?name=%h",zFwdTo), zFwdTo);
21462203
}
21472204
}
21482205
if( d_rid ){
21492206
if( p_rid ){
21502207
/* If both p= and d= are set, we don't have the uuid of d yet. */
21512208
--- src/timeline.c
+++ src/timeline.c
@@ -1566,10 +1566,11 @@
1566 ** n1=COUNT Same as "n" but doesn't set the display-preference cookie
1567 ** Use "n1=COUNT" for a one-time display change
1568 ** p=CHECKIN Parents and ancestors of CHECKIN
1569 ** bt=PRIOR ... going back to PRIOR
1570 ** d=CHECKIN Children and descendants of CHECKIN
 
1571 ** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
1572 ** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
1573 ** bt=CHECKIN In conjunction with p=CX, this means show all
1574 ** ancestors of CX going back to the time of CHECKIN.
1575 ** All qualifying check-ins are shown unless there
@@ -2089,11 +2090,13 @@
2089 /* If p= or d= is present, ignore all other parameters other than n= */
2090 char *zUuid;
2091 const char *zCiName;
2092 int np = 0, nd;
2093 const char *zBackTo = 0;
 
2094 int ridBackTo = 0;
 
2095
2096 tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS;
2097 if( p_rid && d_rid ){
2098 if( p_rid!=d_rid ) p_rid = d_rid;
2099 if( !haveParameterN ) nEntry = 10;
@@ -2106,11 +2109,43 @@
2106 zCiName = pd_rid ? P("pd") : p_rid ? P("p") : P("d");
2107 if( zCiName==0 ) zCiName = zUuid;
2108 blob_append_sql(&sql, " AND event.objid IN ok");
2109 nd = 0;
2110 if( d_rid ){
2111 compute_descendants(d_rid, nEntry==0 ? 0 : nEntry+1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2112 nd = db_int(0, "SELECT count(*)-1 FROM ok");
2113 if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
2114 if( nd>0 || p_rid==0 ){
2115 blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
2116 }
@@ -2117,12 +2152,19 @@
2117 if( useDividers && !selectedRid ) selectedRid = d_rid;
2118 db_multi_exec("DELETE FROM ok");
2119 }
2120 if( p_rid ){
2121 zBackTo = P("bt");
2122 ridBackTo = zBackTo ? name_to_typed_rid(zBackTo,"ci") : 0;
2123 if( ridBackTo && !haveParameterN ) nEntry = 0;
 
 
 
 
 
 
 
2124 compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0, ridBackTo);
2125 np = db_int(0, "SELECT count(*)-1 FROM ok");
2126 if( np>0 || nd==0 ){
2127 if( nd>0 ) blob_appendf(&desc, " and ");
2128 blob_appendf(&desc, "%d ancestor%s", np, (1==np)?"":"s");
@@ -2141,10 +2183,25 @@
2141 href("%R/info?name=%h",zCiName), zCiName,
2142 href("%R/info?name=%h",zBackTo), zBackTo);
2143 }else{
2144 blob_appendf(&desc, " back to %z%h</a>",
2145 href("%R/info?name=%h",zBackTo), zBackTo);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2146 }
2147 }
2148 if( d_rid ){
2149 if( p_rid ){
2150 /* If both p= and d= are set, we don't have the uuid of d yet. */
2151
--- src/timeline.c
+++ src/timeline.c
@@ -1566,10 +1566,11 @@
1566 ** n1=COUNT Same as "n" but doesn't set the display-preference cookie
1567 ** Use "n1=COUNT" for a one-time display change
1568 ** p=CHECKIN Parents and ancestors of CHECKIN
1569 ** bt=PRIOR ... going back to PRIOR
1570 ** d=CHECKIN Children and descendants of CHECKIN
1571 ** ft=DESCENDANT ... going forward to DESCENDANT
1572 ** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
1573 ** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
1574 ** bt=CHECKIN In conjunction with p=CX, this means show all
1575 ** ancestors of CX going back to the time of CHECKIN.
1576 ** All qualifying check-ins are shown unless there
@@ -2089,11 +2090,13 @@
2090 /* If p= or d= is present, ignore all other parameters other than n= */
2091 char *zUuid;
2092 const char *zCiName;
2093 int np = 0, nd;
2094 const char *zBackTo = 0;
2095 const char *zFwdTo = 0;
2096 int ridBackTo = 0;
2097 int ridFwdTo = 0;
2098
2099 tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS;
2100 if( p_rid && d_rid ){
2101 if( p_rid!=d_rid ) p_rid = d_rid;
2102 if( !haveParameterN ) nEntry = 10;
@@ -2106,11 +2109,43 @@
2109 zCiName = pd_rid ? P("pd") : p_rid ? P("p") : P("d");
2110 if( zCiName==0 ) zCiName = zUuid;
2111 blob_append_sql(&sql, " AND event.objid IN ok");
2112 nd = 0;
2113 if( d_rid ){
2114 Stmt s;
2115 double rStopTime = 9e99;
2116 zFwdTo = P("ft");
2117 if( zFwdTo ){
2118 double rStartDate = db_double(0.0,
2119 "SELECT mtime FROM event WHERE objid=%d", d_rid);
2120 ridFwdTo = first_checkin_with_tag_after_date(zFwdTo, rStartDate);
2121 if( ridFwdTo==0 ){
2122 ridFwdTo = name_to_typed_rid(zBackTo,"ci");
2123 }
2124 if( ridFwdTo ){
2125 if( !haveParameterN ) nEntry = 0;
2126 rStopTime = db_double(9e99,
2127 "SELECT mtime FROM event WHERE objid=%d", ridFwdTo);
2128 }
2129 }
2130 db_prepare(&s,
2131 "WITH RECURSIVE"
2132 " dx(rid,mtime) AS ("
2133 " SELECT %d, 0"
2134 " UNION"
2135 " SELECT plink.cid, plink.mtime FROM dx, plink"
2136 " WHERE plink.pid=dx.rid"
2137 " AND (:stop>=8e99 OR plink.mtime<=:stop)"
2138 " ORDER BY 2"
2139 " )"
2140 "INSERT OR IGNORE INTO ok SELECT rid FROM dx LIMIT %d",
2141 d_rid, nEntry<=0 ? -1 : nEntry+1
2142 );
2143 db_bind_double(&s, ":stop", rStopTime);
2144 db_step(&s);
2145 db_finalize(&s);
2146 /* compute_descendants(d_rid, nEntry==0 ? 0 : nEntry+1); */
2147 nd = db_int(0, "SELECT count(*)-1 FROM ok");
2148 if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
2149 if( nd>0 || p_rid==0 ){
2150 blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
2151 }
@@ -2117,12 +2152,19 @@
2152 if( useDividers && !selectedRid ) selectedRid = d_rid;
2153 db_multi_exec("DELETE FROM ok");
2154 }
2155 if( p_rid ){
2156 zBackTo = P("bt");
2157 if( zBackTo ){
2158 double rDateLimit = db_double(0.0,
2159 "SELECT mtime FROM event WHERE objid=%d", p_rid);
2160 ridBackTo = last_checkin_with_tag_before_date(zBackTo, rDateLimit);
2161 if( ridBackTo==0 ){
2162 ridBackTo = name_to_typed_rid(zBackTo,"ci");
2163 }
2164 if( ridBackTo && !haveParameterN ) nEntry = 0;
2165 }
2166 compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0, ridBackTo);
2167 np = db_int(0, "SELECT count(*)-1 FROM ok");
2168 if( np>0 || nd==0 ){
2169 if( nd>0 ) blob_appendf(&desc, " and ");
2170 blob_appendf(&desc, "%d ancestor%s", np, (1==np)?"":"s");
@@ -2141,10 +2183,25 @@
2183 href("%R/info?name=%h",zCiName), zCiName,
2184 href("%R/info?name=%h",zBackTo), zBackTo);
2185 }else{
2186 blob_appendf(&desc, " back to %z%h</a>",
2187 href("%R/info?name=%h",zBackTo), zBackTo);
2188 if( ridFwdTo && zFwdTo ){
2189 blob_appendf(&desc, " and up to %z%h</a>",
2190 href("%R/info?name=%h",zFwdTo), zFwdTo);
2191 }
2192 }
2193 }else if( ridFwdTo ){
2194 if( nd==0 ){
2195 blob_reset(&desc);
2196 blob_appendf(&desc,
2197 "Check-in %z%h</a> only (%z%h</a> is not an descendant)",
2198 href("%R/info?name=%h",zCiName), zCiName,
2199 href("%R/info?name=%h",zFwdTo), zFwdTo);
2200 }else{
2201 blob_appendf(&desc, " up to %z%h</a>",
2202 href("%R/info?name=%h",zFwdTo), zFwdTo);
2203 }
2204 }
2205 if( d_rid ){
2206 if( p_rid ){
2207 /* If both p= and d= are set, we don't have the uuid of d yet. */
2208
+9 -3
--- src/tkt.c
+++ src/tkt.c
@@ -733,11 +733,13 @@
733733
if( g.anon.WrTkt || g.anon.ApndTkt ){
734734
style_submenu_element("Edit", "%R/tktedit/%T", PD("name",""));
735735
}
736736
if( g.perm.Hyperlink ){
737737
style_submenu_element("History", "%R/tkthistory/%T", zUuid);
738
- style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
738
+ if( g.perm.Read ){
739
+ style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
740
+ }
739741
}
740742
if( g.anon.NewTkt ){
741743
style_submenu_element("New Ticket", "%R/tktnew");
742744
}
743745
if( g.anon.ApndTkt && g.anon.Attach ){
@@ -1224,11 +1226,13 @@
12241226
return;
12251227
}
12261228
zUuid = PD("name","");
12271229
zType = PD("y","a");
12281230
if( zType[0]!='c' ){
1229
- style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
1231
+ if( g.perm.Read ){
1232
+ style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
1233
+ }
12301234
}else{
12311235
style_submenu_element("Timeline", "%R/tkttimeline/%T", zUuid);
12321236
}
12331237
style_submenu_element("History", "%R/tkthistory/%s", zUuid);
12341238
style_submenu_element("Status", "%R/info/%s", zUuid);
@@ -1282,11 +1286,13 @@
12821286
return;
12831287
}
12841288
zUuid = PD("name","");
12851289
zTitle = mprintf("History Of Ticket %h", zUuid);
12861290
style_submenu_element("Status", "%R/info/%s", zUuid);
1287
- style_submenu_element("Check-ins", "%R/tkttimeline/%s?y=ci", zUuid);
1291
+ if( g.perm.Read ){
1292
+ style_submenu_element("Check-ins", "%R/tkttimeline/%s?y=ci", zUuid);
1293
+ }
12881294
style_submenu_element("Timeline", "%R/tkttimeline/%s", zUuid);
12891295
if( P("raw")!=0 ){
12901296
style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
12911297
}else if( g.perm.Admin ){
12921298
style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
12931299
--- src/tkt.c
+++ src/tkt.c
@@ -733,11 +733,13 @@
733 if( g.anon.WrTkt || g.anon.ApndTkt ){
734 style_submenu_element("Edit", "%R/tktedit/%T", PD("name",""));
735 }
736 if( g.perm.Hyperlink ){
737 style_submenu_element("History", "%R/tkthistory/%T", zUuid);
738 style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
 
 
739 }
740 if( g.anon.NewTkt ){
741 style_submenu_element("New Ticket", "%R/tktnew");
742 }
743 if( g.anon.ApndTkt && g.anon.Attach ){
@@ -1224,11 +1226,13 @@
1224 return;
1225 }
1226 zUuid = PD("name","");
1227 zType = PD("y","a");
1228 if( zType[0]!='c' ){
1229 style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
 
 
1230 }else{
1231 style_submenu_element("Timeline", "%R/tkttimeline/%T", zUuid);
1232 }
1233 style_submenu_element("History", "%R/tkthistory/%s", zUuid);
1234 style_submenu_element("Status", "%R/info/%s", zUuid);
@@ -1282,11 +1286,13 @@
1282 return;
1283 }
1284 zUuid = PD("name","");
1285 zTitle = mprintf("History Of Ticket %h", zUuid);
1286 style_submenu_element("Status", "%R/info/%s", zUuid);
1287 style_submenu_element("Check-ins", "%R/tkttimeline/%s?y=ci", zUuid);
 
 
1288 style_submenu_element("Timeline", "%R/tkttimeline/%s", zUuid);
1289 if( P("raw")!=0 ){
1290 style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
1291 }else if( g.perm.Admin ){
1292 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
1293
--- src/tkt.c
+++ src/tkt.c
@@ -733,11 +733,13 @@
733 if( g.anon.WrTkt || g.anon.ApndTkt ){
734 style_submenu_element("Edit", "%R/tktedit/%T", PD("name",""));
735 }
736 if( g.perm.Hyperlink ){
737 style_submenu_element("History", "%R/tkthistory/%T", zUuid);
738 if( g.perm.Read ){
739 style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
740 }
741 }
742 if( g.anon.NewTkt ){
743 style_submenu_element("New Ticket", "%R/tktnew");
744 }
745 if( g.anon.ApndTkt && g.anon.Attach ){
@@ -1224,11 +1226,13 @@
1226 return;
1227 }
1228 zUuid = PD("name","");
1229 zType = PD("y","a");
1230 if( zType[0]!='c' ){
1231 if( g.perm.Read ){
1232 style_submenu_element("Check-ins", "%R/tkttimeline/%T?y=ci", zUuid);
1233 }
1234 }else{
1235 style_submenu_element("Timeline", "%R/tkttimeline/%T", zUuid);
1236 }
1237 style_submenu_element("History", "%R/tkthistory/%s", zUuid);
1238 style_submenu_element("Status", "%R/info/%s", zUuid);
@@ -1282,11 +1286,13 @@
1286 return;
1287 }
1288 zUuid = PD("name","");
1289 zTitle = mprintf("History Of Ticket %h", zUuid);
1290 style_submenu_element("Status", "%R/info/%s", zUuid);
1291 if( g.perm.Read ){
1292 style_submenu_element("Check-ins", "%R/tkttimeline/%s?y=ci", zUuid);
1293 }
1294 style_submenu_element("Timeline", "%R/tkttimeline/%s", zUuid);
1295 if( P("raw")!=0 ){
1296 style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
1297 }else if( g.perm.Admin ){
1298 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
1299
+5 -1
--- src/xfer.c
+++ src/xfer.c
@@ -354,11 +354,14 @@
354354
}else{
355355
nullContent = 1;
356356
}
357357
358358
/* The isWriter flag must be true in order to land the new file */
359
- if( !isWriter ) goto end_accept_unversioned_file;
359
+ if( !isWriter ){
360
+ blob_appendf(&pXfer->err, "Write permissions for unversioned files missing");
361
+ goto end_accept_unversioned_file;
362
+ }
360363
361364
/* Make sure we have a valid g.rcvid marker */
362365
content_rcvid_init(0);
363366
364367
/* Check to see if current content really should be overwritten. Ideally,
@@ -1307,10 +1310,11 @@
13071310
if( blob_eq(&xfer.aToken[0], "uvfile") ){
13081311
xfer_accept_unversioned_file(&xfer, g.perm.WrUnver);
13091312
if( blob_size(&xfer.err) ){
13101313
cgi_reset_content();
13111314
@ error %T(blob_str(&xfer.err))
1315
+ fossil_print("%%%%%%%% xfer.err: '%s'\n", blob_str(&xfer.err));
13121316
nErr++;
13131317
break;
13141318
}
13151319
}else
13161320
13171321
--- src/xfer.c
+++ src/xfer.c
@@ -354,11 +354,14 @@
354 }else{
355 nullContent = 1;
356 }
357
358 /* The isWriter flag must be true in order to land the new file */
359 if( !isWriter ) goto end_accept_unversioned_file;
 
 
 
360
361 /* Make sure we have a valid g.rcvid marker */
362 content_rcvid_init(0);
363
364 /* Check to see if current content really should be overwritten. Ideally,
@@ -1307,10 +1310,11 @@
1307 if( blob_eq(&xfer.aToken[0], "uvfile") ){
1308 xfer_accept_unversioned_file(&xfer, g.perm.WrUnver);
1309 if( blob_size(&xfer.err) ){
1310 cgi_reset_content();
1311 @ error %T(blob_str(&xfer.err))
 
1312 nErr++;
1313 break;
1314 }
1315 }else
1316
1317
--- src/xfer.c
+++ src/xfer.c
@@ -354,11 +354,14 @@
354 }else{
355 nullContent = 1;
356 }
357
358 /* The isWriter flag must be true in order to land the new file */
359 if( !isWriter ){
360 blob_appendf(&pXfer->err, "Write permissions for unversioned files missing");
361 goto end_accept_unversioned_file;
362 }
363
364 /* Make sure we have a valid g.rcvid marker */
365 content_rcvid_init(0);
366
367 /* Check to see if current content really should be overwritten. Ideally,
@@ -1307,10 +1310,11 @@
1310 if( blob_eq(&xfer.aToken[0], "uvfile") ){
1311 xfer_accept_unversioned_file(&xfer, g.perm.WrUnver);
1312 if( blob_size(&xfer.err) ){
1313 cgi_reset_content();
1314 @ error %T(blob_str(&xfer.err))
1315 fossil_print("%%%%%%%% xfer.err: '%s'\n", blob_str(&xfer.err));
1316 nErr++;
1317 break;
1318 }
1319 }else
1320
1321
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,9 +1,13 @@
11
<title>Change Log</title>
22
33
<h2 id='v2_22'>Changes for version 2.22 (pending)</h2>
4
-
4
+ * The stock OCI container no longer includes BusyBox, thus no longer
5
+ needs to start as root to chroot that power away. That in turn
6
+ frees us from needing to build and install the container as root,
7
+ since it no longer has to create a private <tt>/dev</tt> tree
8
+ inside the jail for Fossil's use.
59
610
<h2 id='v2_21'>Changes for version 2.21 (2023-02-25)</h2>
711
* Users can request a password reset. This feature is disabledby default. Use
812
the new [/help?cmd=self-pw-reset|self-pw-reset property] to enable it.
913
New web pages [/help?cmd=/resetpw|/resetpw] and
1014
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,9 +1,13 @@
1 <title>Change Log</title>
2
3 <h2 id='v2_22'>Changes for version 2.22 (pending)</h2>
4
 
 
 
 
5
6 <h2 id='v2_21'>Changes for version 2.21 (2023-02-25)</h2>
7 * Users can request a password reset. This feature is disabledby default. Use
8 the new [/help?cmd=self-pw-reset|self-pw-reset property] to enable it.
9 New web pages [/help?cmd=/resetpw|/resetpw] and
10
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,9 +1,13 @@
1 <title>Change Log</title>
2
3 <h2 id='v2_22'>Changes for version 2.22 (pending)</h2>
4 * The stock OCI container no longer includes BusyBox, thus no longer
5 needs to start as root to chroot that power away. That in turn
6 frees us from needing to build and install the container as root,
7 since it no longer has to create a private <tt>/dev</tt> tree
8 inside the jail for Fossil's use.
9
10 <h2 id='v2_21'>Changes for version 2.21 (2023-02-25)</h2>
11 * Users can request a password reset. This feature is disabledby default. Use
12 the new [/help?cmd=self-pw-reset|self-pw-reset property] to enable it.
13 New web pages [/help?cmd=/resetpw|/resetpw] and
14
+233 -244
--- www/containers.md
+++ www/containers.md
@@ -10,12 +10,12 @@
1010
[OCI]: https://opencontainers.org/
1111
1212
1313
## 1. Quick Start
1414
15
-Fossil ships a `Dockerfile` at the top of its source tree which you can
16
-build like so:
15
+Fossil ships a `Dockerfile` at the top of its source tree,
16
+[here][DF], which you can build like so:
1717
1818
```
1919
$ docker build -t fossil .
2020
```
2121
@@ -56,10 +56,12 @@
5656
interactive use, while the versioned ones are good for CI/CD type
5757
applications since they avoid a conflict with past versions; it lets you
5858
keep old containers around for quick roll-backs while replacing them
5959
with fresh ones.
6060
61
+[DF]: /file/Dockerfile
62
+
6163
6264
## 2. <a id="storage"></a>Repository Storage Options
6365
6466
If you want the container to serve an existing repository, there are at
6567
least two right ways to do it.
@@ -80,13 +82,13 @@
8082
8183
The simplest method is to stop the container if it was running, then
8284
say:
8385
8486
```
85
- $ docker cp /path/to/my-project.fossil fossil:/jail/museum/repo.fossil
87
+ $ docker cp /path/to/my-project.fossil fossil:/museum/repo.fossil
8688
$ docker start fossil
87
- $ docker exec fossil chown -R 499 /jail/museum
89
+ $ docker exec fossil chown -R 499 /museum
8890
```
8991
9092
That copies the local Fossil repo into the container where the server
9193
expects to find it, so that the “start” command causes it to serve from
9294
that copied-in file instead. Since it lives atop the immutable base
@@ -122,11 +124,11 @@
122124
123125
```
124126
$ docker run \
125127
--publish 9999:8080 \
126128
--name fossil-bind-mount \
127
- --volume ~/museum:/jail/museum \
129
+ --volume ~/museum:/museum \
128130
fossil
129131
```
130132
131133
Because this bind mount maps a host-side directory (`~/museum`) into the
132134
container, you don’t need to `docker cp` the repo into the container at
@@ -150,11 +152,11 @@
150152
the repository rather than a whole directory. Since Fossil repositories
151153
are specially-formatted SQLite databases, you might be wondering why we
152154
don’t say things like:
153155
154156
```
155
- --volume ~/museum/my-project.fossil:/jail/museum/repo.fossil
157
+ --volume ~/museum/my-project.fossil:/museum/repo.fossil
156158
```
157159
158160
That lets us have a convenient file name for the project outside the
159161
container while letting the configuration inside the container refer to
160162
the generic “`/museum/repo.fossil`” name. Why should we have to name
@@ -179,60 +181,154 @@
179181
[wal]: https://www.sqlite.org/wal.html
180182
181183
182184
## 3. <a id="security"></a>Security
183185
184
-### 3.1 <a id="chroot"></a>Why Chroot?
185
-
186
-A potentially surprising feature of this container is that it runs
187
-Fossil as root. Since that causes [the chroot jail feature](./chroot.md)
188
-to kick in, and a Docker container is a type of über-jail already, you
189
-may be wondering why we bother. Instead, why not either:
190
-
191
-* run `fossil server --nojail` to skip the internal chroot; or
192
-* set “`USER fossil`” in the `Dockerfile` so it starts Fossil as
193
- that user instead
194
-
195
-The reason is, although this container is quite stripped-down by today’s
196
-standards, it’s based on the [surprisingly powerful Busybox
197
-project](https://www.busybox.net/BusyBox.html). (This author made a
198
-living for years in the early 1990s using Unix systems that were less
199
-powerful than this container.) If someone ever figured out how to make a
200
-Fossil binary execute arbitrary commands on the host or to open up a
201
-remote shell, the power available to them at that point would make it
202
-likely that they’d be able to island-hop from there into the rest of
203
-your network. That power is there for you as the system administrator
204
-alone, to let you inspect the container’s runtime behavior, change
205
-things on the fly, and so forth. Fossil proper doesn’t need that power;
206
-if we take it away via this cute double-jail dance, we keep any
207
-potential attacker from making use of it should they ever get in.
208
-
209
-Having said this, know that we deem this risk low since a) it’s never
210
-happened, that we know of; and b) we haven’t enabled any of the risky
211
-features of Fossil such as [TH1 docs][th1docrisk]. Nevertheless, we
212
-believe defense-in-depth strategies are wise.
213
-
214
-If you say something like “`docker exec fossil ps`” while the system is
215
-idle, it’s likely to report a single `fossil` process running as `root`
216
-even though the chroot feature is documented as causing Fossil to drop
217
-its privileges in favor of the owner of the repository database or its
218
-containing folder. If the repo file is owned by the in-container user
219
-“`fossil`”, why is the server still running as root?
220
-
221
-It’s because you’re seeing only the parent process, which assumes it’s
222
-running on bare metal or a VM and thus may need to do rootly things like
223
-listening on port 80 or 443 before forking off any children to handle
224
-HTTP hits. Fossil’s chroot feature only takes effect in these child
225
-processes. This is why you can fix broken permissions with `chown`
226
-after the container is already running, without restarting it: each hit
227
-reevaluates the repository file permissions when deciding what user to
228
-become when dropping root privileges.
229
-
230
-[th1docrisk]: https://fossil-scm.org/forum/forumpost/42e0c16544
231
-
232
-
233
-### 3.2 <a id="caps"></a>Dropping Unnecessary Capabilities
186
+### 3.1 <a id="chroot"></a>Why Not Chroot?
187
+
188
+Prior to 2023.03.26, the stock Fossil container made use of [the chroot
189
+jail feature](./chroot.md) in order to wall away the shell and other
190
+tools provided by [BusyBox](https://www.busybox.net/BusyBox.html). This
191
+author made a living for years in the early 1990s using Unix systems
192
+that offered less power, so there was a legitimate worry that if someone
193
+ever figured out how to get a shell on one of these Fossil containers,
194
+it would constitute a powerful island from which to attack the rest of
195
+the network.
196
+
197
+The thing is, Fossil is self-contained, needing none of that power in
198
+the main-line use cases. The only reason we included BusyBox in the
199
+container at all was on the off chance that someone needed it for
200
+debugging.
201
+
202
+That justification collapsed when we realized you could restore this
203
+basic shell environment on an as-needed basis with a one-line change to
204
+the `Dockerfile`, as we show in the next section.
205
+
206
+
207
+### 3.2 <a id="run"></a>Swapping Out the Run Layer
208
+
209
+If you want a basic shell environment for temporary debugging of the
210
+running container, that’s easily added. Simply change this line in the
211
+`Dockerfile`…
212
+
213
+ FROM scratch AS run
214
+
215
+…to this:
216
+
217
+ FROM busybox AS run
218
+
219
+Rebuild, redeploy, and your Fossil container now has a BusyBox based
220
+shell environment that you can get into via:
221
+
222
+ $ docker exec -it -u fossil $(make container-version) sh
223
+
224
+(That command assumes you built the container via “`make container`” and
225
+are therefore using its versioning scheme.)
226
+
227
+Another case where you might need to replace this bare-bones “`run`”
228
+layer with something more functional is that you’re setting up [email
229
+alerts](./alerts.md) and need some way to integrate with the host’s
230
+[MTA]. There are a number of alternatives in that linked document, so
231
+for the sake of discussion, we’ll say you’ve chosen [Method
232
+2](./alerts.md#db), which requires a Tcl interpreter and its SQLite
233
+extension to push messages into the outbound email queue DB, presumably
234
+bind-mounted into the container.
235
+
236
+You can do that by replacing STAGEs 2 and 3 in the stock `Dockerfile`
237
+with this:
238
+
239
+```
240
+ ## ---------------------------------------------------------------------
241
+ ## STAGE 2: Pare that back to the bare essentials, plus Tcl.
242
+ ## ---------------------------------------------------------------------
243
+ FROM alpine AS run
244
+ ARG UID=499
245
+ ENV PATH "/sbin:/usr/sbin:/bin:/usr/bin"
246
+ COPY --from=builder /tmp/fossil /bin/
247
+ COPY tools/email-sender.tcl /bin/
248
+ RUN set -x \
249
+ && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /etc/passwd \
250
+ && echo "fossil:x:${UID}:fossil" >> /etc/group \
251
+ && install -d -m 700 -o fossil -g fossil log museum \
252
+ && apk add --no-cache tcl sqlite-tcl
253
+```
254
+
255
+Build it and test that it works like so:
256
+
257
+```
258
+ $ make container-run &&
259
+ echo 'puts [info patchlevel]' |
260
+ docker exec -i $(make container-version) tclsh
261
+ 8.6.12
262
+```
263
+
264
+You should remove the `PATH` override in the “RUN”
265
+stage, since it’s written for the case where everything is in `/bin`.
266
+With these additions, we need the longer `PATH` shown above to have
267
+ready access to them all.
268
+
269
+Another useful case to consider is that you’ve installed a [server
270
+extension](./serverext.wiki) and you need an interpreter for that
271
+script. The first option above won’t work except in the unlikely case that
272
+it’s written for one of the bare-bones script interpreters that BusyBox
273
+ships.(^BusyBox’s `/bin/sh` is based on the old 4.4BSD Lite Almquist
274
+shell, implementing little more than what POSIX specified in 1989, plus
275
+equally stripped-down versions of `awk` and `sed`.)
276
+
277
+Let’s say the extension is written in Python. While you could handle it
278
+the same way we do with the Tcl example above, Python is more
279
+popular, giving us more options. Let’s inject a Python environment into
280
+the stock Fossil container via a suitable “[distroless]” image instead:
281
+
282
+```
283
+ ## ---------------------------------------------------------------------
284
+ ## STAGE 2: Pare that back to the bare essentials, plus Python.
285
+ ## ---------------------------------------------------------------------
286
+ FROM cgr.dev/chainguard/python:latest
287
+ USER root
288
+ ARG UID=499
289
+ ENV PATH "/sbin:/usr/sbin:/bin:/usr/bin"
290
+ COPY --from=builder /tmp/fossil /bin/
291
+ COPY --from=builder /bin/busybox.static /bin/busybox
292
+ RUN [ "/bin/busybox", "--install", "/bin" ]
293
+ RUN set -x \
294
+ && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /etc/passwd \
295
+ && echo "fossil:x:${UID}:fossil" >> /etc/group \
296
+ && install -d -m 700 -o fossil -g fossil log museum
297
+```
298
+
299
+You will also have to add `busybox-static` to the APK package list in
300
+STAGE 1 for the `RUN` script at the end of that stage to work, since the
301
+[Chainguard Python image][cgimgs] lacks a shell, on purpose. The need to
302
+install root-level binaries is why we change `USER` temporarily here.
303
+
304
+Build it and test that it works like so:
305
+
306
+```
307
+ $ make container-run &&
308
+ docker exec -i $(make container-version) python --version
309
+ 3.11.2
310
+```
311
+
312
+The compensation for the hassle of using Chainguard over something more
313
+general purpose like Alpine + “`apk add python`”
314
+is huge: we no longer leave a package manager sitting around inside the
315
+container, waiting for some malefactor to figure out how to abuse it.
316
+
317
+Beware that there’s a limit to this über-jail’s ability to save you when
318
+you go and provide a more capable OS layer like this. The container
319
+layer should stop an attacker from accessing any files out on the host
320
+that you haven’t explicitly mounted into the container’s namespace, but
321
+it can’t stop them from making outbound network connections or modifying
322
+the repo DB inside the container.
323
+
324
+[cgimgs]: https://github.com/chainguard-images/images/tree/main/images
325
+[distroless]: https://www.chainguard.dev/unchained/minimal-container-images-towards-a-more-secure-future
326
+[MTA]: https://en.wikipedia.org/wiki/Message_transfer_agent
327
+
328
+
329
+### 3.3 <a id="caps"></a>Dropping Unnecessary Capabilities
234330
235331
The example commands above create the container with [a default set of
236332
Linux kernel capabilities][defcap]. Although Docker strips away almost
237333
all of the traditional root capabilities by default, and Fossil doesn’t
238334
need any of those it does take away, Docker does leave some enabled that
@@ -251,11 +347,11 @@
251347
image build process sets up all file ownership properly, to the
252348
extent that this is possible under the limitations of our
253349
automation.
254350
255351
Curiously, stripping this capability doesn’t affect your ability to
256
- run commands like “`chown -R fossil:fossil /jail/museum`” when
352
+ run commands like “`chown -R fossil:fossil /museum`” when
257353
you’re using bind mounts or external volumes — as we recommend
258354
[above](#bind-mount) — because it’s the host OS’s kernel
259355
capabilities that affect the underlying `chown(2)` call in that
260356
case, not those of the container.
261357
@@ -279,16 +375,16 @@
279375
users. You might wish for this ability as an administrator shelled
280376
into the container, but you can pass the “`docker exec --user`”
281377
option to run commands within your container as the legitimate owner
282378
of the process, removing the need for this capability.
283379
284
-* **`MKNOD`**: All device nodes are created at build time and are
285
- never changed at run time. Realize that the virtualized device nodes
286
- inside the container get mapped onto real devices on the host, so if
287
- an attacker ever got a root shell on the container, they might be
288
- able to do actual damage to the host if we didn’t preemptively strip
289
- this capability away.
380
+* **`MKNOD`**: As of 2023.03.26, the stock container uses the
381
+ runtime’s default `/dev` node tree. Prior to this, we had to create
382
+ `/dev/null` and `/dev/urandom` inside [the chroot jail](#chroot),
383
+ but even then, these device nodes were created at build time and
384
+ were never changed at run time, so we didn’t need this run-time
385
+ capability even then.
290386
291387
* **`NET_BIND_SERVICE`**: With containerized deployment, Fossil never
292388
needs the ability to bind the server to low-numbered TCP ports, not
293389
even if you’re running the server in production with TLS enabled and
294390
want the service bound to port 443. It’s perfectly fine to let the
@@ -301,15 +397,17 @@
301397
[terminating TLS with a front-end proxy](./ssl.wiki#server). You’re
302398
more likely to say something like “`-p localhost:12345:8080`” and then
303399
configure the reverse proxy to translate external HTTPS calls into
304400
HTTP directed at this internal port 12345.)
305401
306
-* **`NET_RAW`**: Fossil itself doesn’t use raw sockets, and our build
307
- process leaves out all the Busybox utilities that require them.
308
- Although that set includes common tools like `ping`, we foresee no
309
- compelling reason to use that or any of these other elided utilities
310
- — `ether-wake`, `netstat`, `traceroute`, and `udhcp` — inside the
402
+* **`NET_RAW`**: Fossil itself doesn’t use raw sockets, and while
403
+ you could [swap out the run layer](#run) for something more
404
+ functional that *does* make use of raw sockets, there’s little call
405
+ for it. The best reason I can come up with is to be able to run
406
+ utilities like `ping` and `traceroute`, but since we aren’t doing
407
+ anything clever with the networking configuration, there’s no
408
+ particularly compelling reason to run these from inside the
311409
container. If you need to ping something, do it on the host.
312410
313411
If we did not take this hard-line stance, an attacker that broke
314412
into the container and gained root privileges might use raw sockets
315413
to do a wide array of bad things to any network the container is
@@ -358,11 +456,11 @@
358456
this:
359457
360458
```
361459
$ docker build -t fossil .
362460
$ docker create --name fossil-static-tmp fossil
363
- $ docker cp fossil-static-tmp:/jail/bin/fossil .
461
+ $ docker cp fossil-static-tmp:/bin/fossil .
364462
$ docker container rm fossil-static-tmp
365463
```
366464
367465
The resulting binary is the single largest file inside that container,
368466
at about 6 MiB. (It’s built stripped.)
@@ -370,46 +468,24 @@
370468
[lsl]: https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
371469
372470
373471
## 5. <a id="args"></a>Container Build Arguments
374472
375
-### <a id="pkg-vers"></a> 5.1 Package Versions
376
-
377
-You can override the default versions of Fossil and BusyBox that get
378
-fetched in the build step. To get the latest-and-greatest of everything,
379
-you could say:
380
-
381
-```
382
- $ docker build -t fossil \
383
- --build-arg FSLVER=trunk \
384
- --build-arg BBXVER=master .
385
-```
386
-
387
-(But don’t, for reasons we will get to.)
388
-
389
-Because the BusyBox configuration file we ship was created with and
390
-tested against a specific stable release, that’s the version we pull by
391
-default. It does try to merge the defaults for any new configuration
392
-settings into the stock set, but since it’s possible this will fail, we
393
-don’t blindly update the BusyBox version merely because a new release
394
-came out. Someone needs to get around to vetting it against our stock
395
-configuration first.
396
-
397
-As for Fossil, it defaults to fetching the same version as the checkout
398
-you’re running the build command from, based on checkin ID. You could
399
-use this to get a release build, for instance:
400
-
401
-```
402
- $ docker build -t fossil \
403
- --build-arg FSLVER=version-2.20 .
473
+### <a id="pkg-vers"></a> 5.1 Fossil Version
474
+
475
+The default version of Fossil fetched in the build is the version in the
476
+checkout directory at the time you run it. You could override it to get
477
+a release build like so:
478
+
479
+```
480
+ $ docker build -t fossil --build-arg FSLVER=version-2.20 .
404481
```
405482
406483
Or equivalently, using Fossil’s `Makefile` convenience target:
407484
408485
```
409
- $ make container-image \
410
- DBFLAGS='--build-arg FSLVER=version-2.20'
486
+ $ make container-image DBFLAGS='--build-arg FSLVER=version-2.20'
411487
```
412488
413489
While you could instead use the generic
414490
“`release`” tag here, it’s better to use a specific version number
415491
since Docker caches downloaded files and tries to
@@ -468,10 +544,22 @@
468544
wish for [a static Fossil binary](#static). For those who want such a
469545
“batteries included” container, we recommend taking a look at [this
470546
alternative](https://hub.docker.com/r/duvel/fossil); needless to say,
471547
it’s inherently less secure than our stock container, but you may find
472548
the tradeoff worthwhile.
549
+
550
+### 5.4 <a id="cengine"></a>Container Engine
551
+
552
+Although the Fossil container build system defaults to Docker, we allow
553
+for use of any OCI container system that implements the same interfaces.
554
+We go into more details about this in [the next section](#light), but
555
+for now, it suffices to point out that you can switch to Podman while
556
+using our `Makefile` convenience targets unchanged by saying:
557
+
558
+```
559
+ $ make CENGINE=podman container-run
560
+```
473561
474562
475563
## 6. <a id="light"></a>Lightweight Alternatives to Docker
476564
477565
Those afflicted with sticker shock at seeing the size of a [Docker
@@ -552,161 +640,55 @@
552640
[runc]: https://github.com/opencontainers/runc
553641
554642
555643
### 6.2 <a id="podman"></a>Podman
556644
557
-A lighter-weight alternative to either of the prior options that doesn’t
645
+A lighter-weight [rootless] [drop-in replacement][whatis] that doesn’t
558646
give up the image builder is [Podman]. Initially created by
559647
Red Hat and thus popular on that family of OSes, it will run on
560648
any flavor of Linux. It can even be made to run [on macOS via Homebrew][pmmac]
561649
or [on Windows via WSL2][pmwin].
562650
563651
On Ubuntu 22.04, the installation size is about 38&nbsp;MiB, roughly a
564652
tenth the size of Docker Engine.
565653
566
-Although Podman [bills itself][whatis] as a drop-in replacement for the
567
-`docker` command and everything that sits behind it, some of the tool’s
568
-design decisions affect how our Fossil containers run, as compared to
569
-using Docker. The most important of these is that, by default, Podman
570
-wants to run your container “rootless,” meaning that it runs as a
571
-regular user. This is generally better for security, but [we dealt with
572
-that risk differently above](#chroot) already. Since neither choice is
573
-unassailably correct in all conditions, we’ll document both options
574
-here.
575
-
576
-[pmmac]: https://podman.io/getting-started/installation.html#macos
577
-[pmwin]: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md
578
-[Podman]: https://podman.io/
579
-[whatis]: https://podman.io/whatis.html
580
-
581
-
582
-#### 6.2.1 <a id="podman-rootless"></a>Fossil in a Rootless Podman Container
583
-
584
-If you build the stock Fossil container under `podman`, it will fail at
585
-two key steps:
586
-
587
-1. The `mknod` calls in the second stage, which create the `/jail/dev`
588
- nodes. For a rootless container, we want it to use the “real” `/dev`
589
- tree mounted into the container’s root filesystem instead.
590
-
591
-2. Anything that depends on the `/jail` directory and the fact that it
592
- becomes the file system’s root once the Fossil server is up and running.
593
-
594
-[The changes to fix this](/file/containers/Dockerfile-nojail.patch)
595
-aren’t complicated. Simply apply that patch to our stock `Dockerfile`
596
-and rebuild:
597
-
598
-```
599
- $ patch -p0 < containers/Dockerfile-nojail.patch
600
- $ podman build -t fossil:nojail .
601
- $ podman create \
602
- --name fossil-nojail \
603
- --publish 127.0.0.1:9999:8080 \
604
- --volume ~/museum:/museum \
605
- fossil:nojail
606
-```
607
-
608
-Do realize that by doing this, if an attacker ever managed to get shell
609
-access on your container, they’d have a BusyBox installation to play
610
-around in. That shouldn’t be enough to let them break out of the
611
-container entirely, but they’ll have powerful tools like `wget`, and
612
-they’ll be connected to the network the container runs on. Once the bad
613
-guy is inside the house, he doesn’t necessarily have to go after the
614
-residents directly to cause problems for them.
615
-
616
-
617
-#### 6.2.2 <a id="podman-rootful"></a>Fossil in a Rootful Podman Container
618
-
619
-##### Simple Method
620
-
621
-Fortunately, it’s easy enough to have it both ways. Simply run your
622
-`podman` commands as root:
623
-
624
-```
625
- $ sudo podman build -t fossil --cap-add MKNOD .
626
- $ sudo podman create \
654
+For our purposes here, the only thing that changes relative to the
655
+examples at the top of this document are the initial command:
656
+
657
+```
658
+ $ podman build -t fossil .
659
+ $ podman run --name fossil -p 9999:8080/tcp fossil
660
+```
661
+
662
+Your Linux package repo may have a `podman-docker` package which
663
+provides a “`docker`” script that calls “`podman`” for you, eliminating
664
+even the command name difference. With that installed, the `make`
665
+commands above will work with Podman as-is.
666
+
667
+The only difference that matters here is that Podman doesn’t have the
668
+same [default Linux kernel capability set](#caps) as Docker, which
669
+affects the `--cap-drop` flags recommended above to:
670
+
671
+```
672
+ $ podman create \
627673
--name fossil \
628674
--cap-drop CHOWN \
629675
--cap-drop FSETID \
630676
--cap-drop KILL \
631677
--cap-drop NET_BIND_SERVICE \
632678
--cap-drop SETFCAP \
633679
--cap-drop SETPCAP \
634680
--publish 127.0.0.1:9999:8080 \
635681
localhost/fossil
636
- $ sudo podman start fossil
637
-```
638
-
639
-It’s obvious why we have to start the container as root, but why create
640
-and build it as root, too? Isn’t that a regression from the modern
641
-practice of doing as much as possible with a normal user?
642
-
643
-We have to do the build under `sudo` in part because we’re doing rootly
644
-things with the file system image layers we’re building up. Just because
645
-it’s done inside a container runtime’s build environment doesn’t mean we
646
-can get away without root privileges to do things like create the
647
-`/jail/dev/null` node.
648
-
649
-The other reason we need “`sudo podman build`” is because it puts the result
650
-into root’s Podman image registry, where the next steps look for it.
651
-
652
-That in turn explains why we need “`sudo podman create`:” because it’s
653
-creating a container based on an image that was created by root. If you
654
-ran that step without `sudo`, it wouldn’t be able to find the image.
655
-
656
-If Docker is looking better and better to you as a result of all this,
657
-realize that it’s doing the same thing. It just hides it better by
658
-creating the `docker` group, so that when your user gets added to that
659
-group, you get silent root privilege escalation on your build machine.
660
-This is why Podman defaults to rootless containers. If you can get away
661
-with it, it’s a better way to work. We would not be recommending
662
-running `podman` under `sudo` if it didn’t buy us [something we wanted
663
-badly](#chroot).
664
-
665
-Notice that we had to add the ability to run `mknod(8)` during the
666
-build. [Podman sensibly denies this by default][nomknod], which lets us
667
-leave off the corresponding `--cap-drop` option. Podman also denies
668
-`CAP_NET_RAW` and `CAP_AUDIT_WRITE` by default, which we don’t need, so
669
-we’ve simply removed them from the `--cap-drop` list relative to the
670
-commands for Docker above.
671
-
672
-[nomknod]: https://github.com/containers/podman/issues/15626
673
-
674
-
675
-##### <a id="pm-root-workaround"></a>Building Under Docker, Running Under Podman
676
-
677
-If you have a remote host where the Fossil instance needs to run, it’s
678
-possible to get around this need to build the image as root on the
679
-remote system. You still have to build as root on the local system, but
680
-as I said above, Docker already does this. What we’re doing is shifting
681
-the risk of running as root from the public host to the local one.
682
-
683
-Once you have the image built on the local machine, create a “`fossil`”
684
-repository on your container repository of choice such as [Docker
685
-Hub](https://hub.docker.com), then say:
686
-
687
-```
688
- $ docker login
689
- $ docker tag fossil:latest mydockername/fossil:latest
690
- $ docker image push mydockername/fossil:latest
691
-```
692
-
693
-That will push the image up to your account, so that you can then switch
694
-to the remote machine and say:
695
-
696
-```
697
- $ sudo podman create \
698
- --any-options-you-like \
699
- docker.io/mydockername/fossil
700
-```
701
-
702
-This round-trip through the public image registry has another side
703
-benefit: your local system might be a lot faster than your remote one,
704
-as when the remote is a small VPS. Even with the overhead of schlepping
705
-container images across the Internet, it can be a net win in terms of
706
-build time.
707
-
682
+ $ podman start fossil
683
+```
684
+
685
+[pmmac]: https://podman.io/getting-started/installation.html#macos
686
+[pmwin]: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md
687
+[Podman]: https://podman.io/
688
+[rootless]: https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md
689
+[whatis]: https://podman.io/whatis.html
708690
709691
710692
### 6.3 <a id="nspawn"></a>`systemd-container`
711693
712694
If even the Podman stack is too big for you, the next-best option I’m
@@ -729,30 +711,38 @@
729711
“`myproject`” within `~/museum/myproject/repo.fossil`, named according
730712
to the reasons given [above](#repo-inside). We’ll make consistent use of
731713
this naming scheme in the examples below so that you will be able to
732714
replace the “`myproject`” element of the various file and path names.
733715
734
-The first configuration step is to convert the Docker container into
735
-a “machine,” as `systemd` calls it. The easiest method is:
716
+If you use [the stock `Dockerfile`][DF] to generate your
717
+base image, `nspawn` won’t recognize it as containing an OS unless you
718
+change the “`FROM scratch AS os`” line at the top of the second stage
719
+to something like this:
720
+
721
+```
722
+ FROM gcr.io/distroless/static-debian11 AS os
723
+```
724
+
725
+Using that as a base image provides all the files `nspawn` checks for to
726
+determine whether the container is sufficiently close to a Linux VM for
727
+the following step to proceed:
736728
737729
```
738730
$ make container
739731
$ docker container export $(make container-version) |
740732
machinectl import-tar - myproject
741733
```
742734
743
-Next, create `/etc/systemd/nspawn/myproject.nspawn`, containing
744
-something like:
735
+Next, create `/etc/systemd/nspawn/myproject.nspawn`:
745736
746737
----
747738
748739
```
749740
[Exec]
750
-WorkingDirectory=/jail
741
+WorkingDirectory=/
751742
Parameters=bin/fossil server \
752743
--baseurl https://example.com/myproject \
753
- --chroot /jail \
754744
--create \
755745
--jsmode bundled \
756746
--localhost \
757747
--port 9000 \
758748
--scgi \
@@ -771,11 +761,11 @@
771761
ProcessTwo=yes
772762
LinkJournal=no
773763
Timezone=no
774764
775765
[Files]
776
-Bind=/home/fossil/museum/myproject:/jail/museum
766
+Bind=/home/fossil/museum/myproject:/museum
777767
778768
[Network]
779769
VirtualEthernet=no
780770
```
781771
@@ -795,11 +785,11 @@
795785
it’ll work with the other repository service methods we’ve
796786
[documented][srv].
797787
798788
* The path in the host-side part of the `Bind` value must point at the
799789
directory containing the `repo.fossil` file referenced in said
800
- command so that `/jail/museum/repo.fossil` refers to your repo out
790
+ command so that `/museum/repo.fossil` refers to your repo out
801791
on the host for the reasons given [above](#bind-mount).
802792
803793
That being done, we also need a generic systemd unit file called
804794
`/etc/systemd/system/[email protected]`, containing:
805795
@@ -841,11 +831,10 @@
841831
the `*.nspawn` file:
842832
843833
```
844834
Parameters=bin/fossil server \
845835
--cert /path/to/cert.pem \
846
- --chroot /jail \
847836
--create \
848837
--jsmode bundled \
849838
--port 443 \
850839
--user admin \
851840
museum/repo.fossil
@@ -1015,11 +1004,11 @@
10151004
* **`machinectl poweroff`** will fail because the container
10161005
isn’t running dbus.
10171006
10181007
* **`machinectl start`** will try to find an `/sbin/init`
10191008
program in the rootfs, which we haven’t got. We could
1020
- rename `/jail/bin/fossil` to `/sbin/init` and then hack
1009
+ rename `/bin/fossil` to `/sbin/init` and then hack
10211010
the chroot scheme to match, but ick. (This, incidentally,
10221011
is why we set `ProcessTwo=yes` above even though Fossil is
10231012
perfectly capable of running as PID 1, a fact we depend on
10241013
in the other methods above.)
10251014
10261015
--- www/containers.md
+++ www/containers.md
@@ -10,12 +10,12 @@
10 [OCI]: https://opencontainers.org/
11
12
13 ## 1. Quick Start
14
15 Fossil ships a `Dockerfile` at the top of its source tree which you can
16 build like so:
17
18 ```
19 $ docker build -t fossil .
20 ```
21
@@ -56,10 +56,12 @@
56 interactive use, while the versioned ones are good for CI/CD type
57 applications since they avoid a conflict with past versions; it lets you
58 keep old containers around for quick roll-backs while replacing them
59 with fresh ones.
60
 
 
61
62 ## 2. <a id="storage"></a>Repository Storage Options
63
64 If you want the container to serve an existing repository, there are at
65 least two right ways to do it.
@@ -80,13 +82,13 @@
80
81 The simplest method is to stop the container if it was running, then
82 say:
83
84 ```
85 $ docker cp /path/to/my-project.fossil fossil:/jail/museum/repo.fossil
86 $ docker start fossil
87 $ docker exec fossil chown -R 499 /jail/museum
88 ```
89
90 That copies the local Fossil repo into the container where the server
91 expects to find it, so that the “start” command causes it to serve from
92 that copied-in file instead. Since it lives atop the immutable base
@@ -122,11 +124,11 @@
122
123 ```
124 $ docker run \
125 --publish 9999:8080 \
126 --name fossil-bind-mount \
127 --volume ~/museum:/jail/museum \
128 fossil
129 ```
130
131 Because this bind mount maps a host-side directory (`~/museum`) into the
132 container, you don’t need to `docker cp` the repo into the container at
@@ -150,11 +152,11 @@
150 the repository rather than a whole directory. Since Fossil repositories
151 are specially-formatted SQLite databases, you might be wondering why we
152 don’t say things like:
153
154 ```
155 --volume ~/museum/my-project.fossil:/jail/museum/repo.fossil
156 ```
157
158 That lets us have a convenient file name for the project outside the
159 container while letting the configuration inside the container refer to
160 the generic “`/museum/repo.fossil`” name. Why should we have to name
@@ -179,60 +181,154 @@
179 [wal]: https://www.sqlite.org/wal.html
180
181
182 ## 3. <a id="security"></a>Security
183
184 ### 3.1 <a id="chroot"></a>Why Chroot?
185
186 A potentially surprising feature of this container is that it runs
187 Fossil as root. Since that causes [the chroot jail feature](./chroot.md)
188 to kick in, and a Docker container is a type of über-jail already, you
189 may be wondering why we bother. Instead, why not either:
190
191 * run `fossil server --nojail` to skip the internal chroot; or
192 * set “`USER fossil`” in the `Dockerfile` so it starts Fossil as
193 that user instead
194
195 The reason is, although this container is quite stripped-down by today’s
196 standards, it’s based on the [surprisingly powerful Busybox
197 project](https://www.busybox.net/BusyBox.html). (This author made a
198 living for years in the early 1990s using Unix systems that were less
199 powerful than this container.) If someone ever figured out how to make a
200 Fossil binary execute arbitrary commands on the host or to open up a
201 remote shell, the power available to them at that point would make it
202 likely that they’d be able to island-hop from there into the rest of
203 your network. That power is there for you as the system administrator
204 alone, to let you inspect the container’s runtime behavior, change
205 things on the fly, and so forth. Fossil proper doesn’t need that power;
206 if we take it away via this cute double-jail dance, we keep any
207 potential attacker from making use of it should they ever get in.
208
209 Having said this, know that we deem this risk low since a) it’s never
210 happened, that we know of; and b) we haven’t enabled any of the risky
211 features of Fossil such as [TH1 docs][th1docrisk]. Nevertheless, we
212 believe defense-in-depth strategies are wise.
213
214 If you say something like “`docker exec fossil ps`” while the system is
215 idle, it’s likely to report a single `fossil` process running as `root`
216 even though the chroot feature is documented as causing Fossil to drop
217 its privileges in favor of the owner of the repository database or its
218 containing folder. If the repo file is owned by the in-container user
219 “`fossil`”, why is the server still running as root?
220
221 It’s because you’re seeing only the parent process, which assumes it’s
222 running on bare metal or a VM and thus may need to do rootly things like
223 listening on port 80 or 443 before forking off any children to handle
224 HTTP hits. Fossil’s chroot feature only takes effect in these child
225 processes. This is why you can fix broken permissions with `chown`
226 after the container is already running, without restarting it: each hit
227 reevaluates the repository file permissions when deciding what user to
228 become when dropping root privileges.
229
230 [th1docrisk]: https://fossil-scm.org/forum/forumpost/42e0c16544
231
232
233 ### 3.2 <a id="caps"></a>Dropping Unnecessary Capabilities
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
235 The example commands above create the container with [a default set of
236 Linux kernel capabilities][defcap]. Although Docker strips away almost
237 all of the traditional root capabilities by default, and Fossil doesn’t
238 need any of those it does take away, Docker does leave some enabled that
@@ -251,11 +347,11 @@
251 image build process sets up all file ownership properly, to the
252 extent that this is possible under the limitations of our
253 automation.
254
255 Curiously, stripping this capability doesn’t affect your ability to
256 run commands like “`chown -R fossil:fossil /jail/museum`” when
257 you’re using bind mounts or external volumes — as we recommend
258 [above](#bind-mount) — because it’s the host OS’s kernel
259 capabilities that affect the underlying `chown(2)` call in that
260 case, not those of the container.
261
@@ -279,16 +375,16 @@
279 users. You might wish for this ability as an administrator shelled
280 into the container, but you can pass the “`docker exec --user`”
281 option to run commands within your container as the legitimate owner
282 of the process, removing the need for this capability.
283
284 * **`MKNOD`**: All device nodes are created at build time and are
285 never changed at run time. Realize that the virtualized device nodes
286 inside the container get mapped onto real devices on the host, so if
287 an attacker ever got a root shell on the container, they might be
288 able to do actual damage to the host if we didn’t preemptively strip
289 this capability away.
290
291 * **`NET_BIND_SERVICE`**: With containerized deployment, Fossil never
292 needs the ability to bind the server to low-numbered TCP ports, not
293 even if you’re running the server in production with TLS enabled and
294 want the service bound to port 443. It’s perfectly fine to let the
@@ -301,15 +397,17 @@
301 [terminating TLS with a front-end proxy](./ssl.wiki#server). You’re
302 more likely to say something like “`-p localhost:12345:8080`” and then
303 configure the reverse proxy to translate external HTTPS calls into
304 HTTP directed at this internal port 12345.)
305
306 * **`NET_RAW`**: Fossil itself doesn’t use raw sockets, and our build
307 process leaves out all the Busybox utilities that require them.
308 Although that set includes common tools like `ping`, we foresee no
309 compelling reason to use that or any of these other elided utilities
310 — `ether-wake`, `netstat`, `traceroute`, and `udhcp` — inside the
 
 
311 container. If you need to ping something, do it on the host.
312
313 If we did not take this hard-line stance, an attacker that broke
314 into the container and gained root privileges might use raw sockets
315 to do a wide array of bad things to any network the container is
@@ -358,11 +456,11 @@
358 this:
359
360 ```
361 $ docker build -t fossil .
362 $ docker create --name fossil-static-tmp fossil
363 $ docker cp fossil-static-tmp:/jail/bin/fossil .
364 $ docker container rm fossil-static-tmp
365 ```
366
367 The resulting binary is the single largest file inside that container,
368 at about 6 MiB. (It’s built stripped.)
@@ -370,46 +468,24 @@
370 [lsl]: https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
371
372
373 ## 5. <a id="args"></a>Container Build Arguments
374
375 ### <a id="pkg-vers"></a> 5.1 Package Versions
376
377 You can override the default versions of Fossil and BusyBox that get
378 fetched in the build step. To get the latest-and-greatest of everything,
379 you could say:
380
381 ```
382 $ docker build -t fossil \
383 --build-arg FSLVER=trunk \
384 --build-arg BBXVER=master .
385 ```
386
387 (But don’t, for reasons we will get to.)
388
389 Because the BusyBox configuration file we ship was created with and
390 tested against a specific stable release, that’s the version we pull by
391 default. It does try to merge the defaults for any new configuration
392 settings into the stock set, but since it’s possible this will fail, we
393 don’t blindly update the BusyBox version merely because a new release
394 came out. Someone needs to get around to vetting it against our stock
395 configuration first.
396
397 As for Fossil, it defaults to fetching the same version as the checkout
398 you’re running the build command from, based on checkin ID. You could
399 use this to get a release build, for instance:
400
401 ```
402 $ docker build -t fossil \
403 --build-arg FSLVER=version-2.20 .
404 ```
405
406 Or equivalently, using Fossil’s `Makefile` convenience target:
407
408 ```
409 $ make container-image \
410 DBFLAGS='--build-arg FSLVER=version-2.20'
411 ```
412
413 While you could instead use the generic
414 “`release`” tag here, it’s better to use a specific version number
415 since Docker caches downloaded files and tries to
@@ -468,10 +544,22 @@
468 wish for [a static Fossil binary](#static). For those who want such a
469 “batteries included” container, we recommend taking a look at [this
470 alternative](https://hub.docker.com/r/duvel/fossil); needless to say,
471 it’s inherently less secure than our stock container, but you may find
472 the tradeoff worthwhile.
 
 
 
 
 
 
 
 
 
 
 
 
473
474
475 ## 6. <a id="light"></a>Lightweight Alternatives to Docker
476
477 Those afflicted with sticker shock at seeing the size of a [Docker
@@ -552,161 +640,55 @@
552 [runc]: https://github.com/opencontainers/runc
553
554
555 ### 6.2 <a id="podman"></a>Podman
556
557 A lighter-weight alternative to either of the prior options that doesn’t
558 give up the image builder is [Podman]. Initially created by
559 Red Hat and thus popular on that family of OSes, it will run on
560 any flavor of Linux. It can even be made to run [on macOS via Homebrew][pmmac]
561 or [on Windows via WSL2][pmwin].
562
563 On Ubuntu 22.04, the installation size is about 38&nbsp;MiB, roughly a
564 tenth the size of Docker Engine.
565
566 Although Podman [bills itself][whatis] as a drop-in replacement for the
567 `docker` command and everything that sits behind it, some of the tool’s
568 design decisions affect how our Fossil containers run, as compared to
569 using Docker. The most important of these is that, by default, Podman
570 wants to run your container “rootless,” meaning that it runs as a
571 regular user. This is generally better for security, but [we dealt with
572 that risk differently above](#chroot) already. Since neither choice is
573 unassailably correct in all conditions, we’ll document both options
574 here.
575
576 [pmmac]: https://podman.io/getting-started/installation.html#macos
577 [pmwin]: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md
578 [Podman]: https://podman.io/
579 [whatis]: https://podman.io/whatis.html
580
581
582 #### 6.2.1 <a id="podman-rootless"></a>Fossil in a Rootless Podman Container
583
584 If you build the stock Fossil container under `podman`, it will fail at
585 two key steps:
586
587 1. The `mknod` calls in the second stage, which create the `/jail/dev`
588 nodes. For a rootless container, we want it to use the “real” `/dev`
589 tree mounted into the container’s root filesystem instead.
590
591 2. Anything that depends on the `/jail` directory and the fact that it
592 becomes the file system’s root once the Fossil server is up and running.
593
594 [The changes to fix this](/file/containers/Dockerfile-nojail.patch)
595 aren’t complicated. Simply apply that patch to our stock `Dockerfile`
596 and rebuild:
597
598 ```
599 $ patch -p0 < containers/Dockerfile-nojail.patch
600 $ podman build -t fossil:nojail .
601 $ podman create \
602 --name fossil-nojail \
603 --publish 127.0.0.1:9999:8080 \
604 --volume ~/museum:/museum \
605 fossil:nojail
606 ```
607
608 Do realize that by doing this, if an attacker ever managed to get shell
609 access on your container, they’d have a BusyBox installation to play
610 around in. That shouldn’t be enough to let them break out of the
611 container entirely, but they’ll have powerful tools like `wget`, and
612 they’ll be connected to the network the container runs on. Once the bad
613 guy is inside the house, he doesn’t necessarily have to go after the
614 residents directly to cause problems for them.
615
616
617 #### 6.2.2 <a id="podman-rootful"></a>Fossil in a Rootful Podman Container
618
619 ##### Simple Method
620
621 Fortunately, it’s easy enough to have it both ways. Simply run your
622 `podman` commands as root:
623
624 ```
625 $ sudo podman build -t fossil --cap-add MKNOD .
626 $ sudo podman create \
627 --name fossil \
628 --cap-drop CHOWN \
629 --cap-drop FSETID \
630 --cap-drop KILL \
631 --cap-drop NET_BIND_SERVICE \
632 --cap-drop SETFCAP \
633 --cap-drop SETPCAP \
634 --publish 127.0.0.1:9999:8080 \
635 localhost/fossil
636 $ sudo podman start fossil
637 ```
638
639 It’s obvious why we have to start the container as root, but why create
640 and build it as root, too? Isn’t that a regression from the modern
641 practice of doing as much as possible with a normal user?
642
643 We have to do the build under `sudo` in part because we’re doing rootly
644 things with the file system image layers we’re building up. Just because
645 it’s done inside a container runtime’s build environment doesn’t mean we
646 can get away without root privileges to do things like create the
647 `/jail/dev/null` node.
648
649 The other reason we need “`sudo podman build`” is because it puts the result
650 into root’s Podman image registry, where the next steps look for it.
651
652 That in turn explains why we need “`sudo podman create`:” because it’s
653 creating a container based on an image that was created by root. If you
654 ran that step without `sudo`, it wouldn’t be able to find the image.
655
656 If Docker is looking better and better to you as a result of all this,
657 realize that it’s doing the same thing. It just hides it better by
658 creating the `docker` group, so that when your user gets added to that
659 group, you get silent root privilege escalation on your build machine.
660 This is why Podman defaults to rootless containers. If you can get away
661 with it, it’s a better way to work. We would not be recommending
662 running `podman` under `sudo` if it didn’t buy us [something we wanted
663 badly](#chroot).
664
665 Notice that we had to add the ability to run `mknod(8)` during the
666 build. [Podman sensibly denies this by default][nomknod], which lets us
667 leave off the corresponding `--cap-drop` option. Podman also denies
668 `CAP_NET_RAW` and `CAP_AUDIT_WRITE` by default, which we don’t need, so
669 we’ve simply removed them from the `--cap-drop` list relative to the
670 commands for Docker above.
671
672 [nomknod]: https://github.com/containers/podman/issues/15626
673
674
675 ##### <a id="pm-root-workaround"></a>Building Under Docker, Running Under Podman
676
677 If you have a remote host where the Fossil instance needs to run, it’s
678 possible to get around this need to build the image as root on the
679 remote system. You still have to build as root on the local system, but
680 as I said above, Docker already does this. What we’re doing is shifting
681 the risk of running as root from the public host to the local one.
682
683 Once you have the image built on the local machine, create a “`fossil`”
684 repository on your container repository of choice such as [Docker
685 Hub](https://hub.docker.com), then say:
686
687 ```
688 $ docker login
689 $ docker tag fossil:latest mydockername/fossil:latest
690 $ docker image push mydockername/fossil:latest
691 ```
692
693 That will push the image up to your account, so that you can then switch
694 to the remote machine and say:
695
696 ```
697 $ sudo podman create \
698 --any-options-you-like \
699 docker.io/mydockername/fossil
700 ```
701
702 This round-trip through the public image registry has another side
703 benefit: your local system might be a lot faster than your remote one,
704 as when the remote is a small VPS. Even with the overhead of schlepping
705 container images across the Internet, it can be a net win in terms of
706 build time.
707
708
709
710 ### 6.3 <a id="nspawn"></a>`systemd-container`
711
712 If even the Podman stack is too big for you, the next-best option I’m
@@ -729,30 +711,38 @@
729 “`myproject`” within `~/museum/myproject/repo.fossil`, named according
730 to the reasons given [above](#repo-inside). We’ll make consistent use of
731 this naming scheme in the examples below so that you will be able to
732 replace the “`myproject`” element of the various file and path names.
733
734 The first configuration step is to convert the Docker container into
735 a “machine,” as `systemd` calls it. The easiest method is:
 
 
 
 
 
 
 
 
 
 
736
737 ```
738 $ make container
739 $ docker container export $(make container-version) |
740 machinectl import-tar - myproject
741 ```
742
743 Next, create `/etc/systemd/nspawn/myproject.nspawn`, containing
744 something like:
745
746 ----
747
748 ```
749 [Exec]
750 WorkingDirectory=/jail
751 Parameters=bin/fossil server \
752 --baseurl https://example.com/myproject \
753 --chroot /jail \
754 --create \
755 --jsmode bundled \
756 --localhost \
757 --port 9000 \
758 --scgi \
@@ -771,11 +761,11 @@
771 ProcessTwo=yes
772 LinkJournal=no
773 Timezone=no
774
775 [Files]
776 Bind=/home/fossil/museum/myproject:/jail/museum
777
778 [Network]
779 VirtualEthernet=no
780 ```
781
@@ -795,11 +785,11 @@
795 it’ll work with the other repository service methods we’ve
796 [documented][srv].
797
798 * The path in the host-side part of the `Bind` value must point at the
799 directory containing the `repo.fossil` file referenced in said
800 command so that `/jail/museum/repo.fossil` refers to your repo out
801 on the host for the reasons given [above](#bind-mount).
802
803 That being done, we also need a generic systemd unit file called
804 `/etc/systemd/system/[email protected]`, containing:
805
@@ -841,11 +831,10 @@
841 the `*.nspawn` file:
842
843 ```
844 Parameters=bin/fossil server \
845 --cert /path/to/cert.pem \
846 --chroot /jail \
847 --create \
848 --jsmode bundled \
849 --port 443 \
850 --user admin \
851 museum/repo.fossil
@@ -1015,11 +1004,11 @@
1015 * **`machinectl poweroff`** will fail because the container
1016 isn’t running dbus.
1017
1018 * **`machinectl start`** will try to find an `/sbin/init`
1019 program in the rootfs, which we haven’t got. We could
1020 rename `/jail/bin/fossil` to `/sbin/init` and then hack
1021 the chroot scheme to match, but ick. (This, incidentally,
1022 is why we set `ProcessTwo=yes` above even though Fossil is
1023 perfectly capable of running as PID 1, a fact we depend on
1024 in the other methods above.)
1025
1026
--- www/containers.md
+++ www/containers.md
@@ -10,12 +10,12 @@
10 [OCI]: https://opencontainers.org/
11
12
13 ## 1. Quick Start
14
15 Fossil ships a `Dockerfile` at the top of its source tree,
16 [here][DF], which you can build like so:
17
18 ```
19 $ docker build -t fossil .
20 ```
21
@@ -56,10 +56,12 @@
56 interactive use, while the versioned ones are good for CI/CD type
57 applications since they avoid a conflict with past versions; it lets you
58 keep old containers around for quick roll-backs while replacing them
59 with fresh ones.
60
61 [DF]: /file/Dockerfile
62
63
64 ## 2. <a id="storage"></a>Repository Storage Options
65
66 If you want the container to serve an existing repository, there are at
67 least two right ways to do it.
@@ -80,13 +82,13 @@
82
83 The simplest method is to stop the container if it was running, then
84 say:
85
86 ```
87 $ docker cp /path/to/my-project.fossil fossil:/museum/repo.fossil
88 $ docker start fossil
89 $ docker exec fossil chown -R 499 /museum
90 ```
91
92 That copies the local Fossil repo into the container where the server
93 expects to find it, so that the “start” command causes it to serve from
94 that copied-in file instead. Since it lives atop the immutable base
@@ -122,11 +124,11 @@
124
125 ```
126 $ docker run \
127 --publish 9999:8080 \
128 --name fossil-bind-mount \
129 --volume ~/museum:/museum \
130 fossil
131 ```
132
133 Because this bind mount maps a host-side directory (`~/museum`) into the
134 container, you don’t need to `docker cp` the repo into the container at
@@ -150,11 +152,11 @@
152 the repository rather than a whole directory. Since Fossil repositories
153 are specially-formatted SQLite databases, you might be wondering why we
154 don’t say things like:
155
156 ```
157 --volume ~/museum/my-project.fossil:/museum/repo.fossil
158 ```
159
160 That lets us have a convenient file name for the project outside the
161 container while letting the configuration inside the container refer to
162 the generic “`/museum/repo.fossil`” name. Why should we have to name
@@ -179,60 +181,154 @@
181 [wal]: https://www.sqlite.org/wal.html
182
183
184 ## 3. <a id="security"></a>Security
185
186 ### 3.1 <a id="chroot"></a>Why Not Chroot?
187
188 Prior to 2023.03.26, the stock Fossil container made use of [the chroot
189 jail feature](./chroot.md) in order to wall away the shell and other
190 tools provided by [BusyBox](https://www.busybox.net/BusyBox.html). This
191 author made a living for years in the early 1990s using Unix systems
192 that offered less power, so there was a legitimate worry that if someone
193 ever figured out how to get a shell on one of these Fossil containers,
194 it would constitute a powerful island from which to attack the rest of
195 the network.
196
197 The thing is, Fossil is self-contained, needing none of that power in
198 the main-line use cases. The only reason we included BusyBox in the
199 container at all was on the off chance that someone needed it for
200 debugging.
201
202 That justification collapsed when we realized you could restore this
203 basic shell environment on an as-needed basis with a one-line change to
204 the `Dockerfile`, as we show in the next section.
205
206
207 ### 3.2 <a id="run"></a>Swapping Out the Run Layer
208
209 If you want a basic shell environment for temporary debugging of the
210 running container, that’s easily added. Simply change this line in the
211 `Dockerfile`…
212
213 FROM scratch AS run
214
215 …to this:
216
217 FROM busybox AS run
218
219 Rebuild, redeploy, and your Fossil container now has a BusyBox based
220 shell environment that you can get into via:
221
222 $ docker exec -it -u fossil $(make container-version) sh
223
224 (That command assumes you built the container via “`make container`” and
225 are therefore using its versioning scheme.)
226
227 Another case where you might need to replace this bare-bones “`run`”
228 layer with something more functional is that you’re setting up [email
229 alerts](./alerts.md) and need some way to integrate with the host’s
230 [MTA]. There are a number of alternatives in that linked document, so
231 for the sake of discussion, we’ll say you’ve chosen [Method
232 2](./alerts.md#db), which requires a Tcl interpreter and its SQLite
233 extension to push messages into the outbound email queue DB, presumably
234 bind-mounted into the container.
235
236 You can do that by replacing STAGEs 2 and 3 in the stock `Dockerfile`
237 with this:
238
239 ```
240 ## ---------------------------------------------------------------------
241 ## STAGE 2: Pare that back to the bare essentials, plus Tcl.
242 ## ---------------------------------------------------------------------
243 FROM alpine AS run
244 ARG UID=499
245 ENV PATH "/sbin:/usr/sbin:/bin:/usr/bin"
246 COPY --from=builder /tmp/fossil /bin/
247 COPY tools/email-sender.tcl /bin/
248 RUN set -x \
249 && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /etc/passwd \
250 && echo "fossil:x:${UID}:fossil" >> /etc/group \
251 && install -d -m 700 -o fossil -g fossil log museum \
252 && apk add --no-cache tcl sqlite-tcl
253 ```
254
255 Build it and test that it works like so:
256
257 ```
258 $ make container-run &&
259 echo 'puts [info patchlevel]' |
260 docker exec -i $(make container-version) tclsh
261 8.6.12
262 ```
263
264 You should remove the `PATH` override in the “RUN”
265 stage, since it’s written for the case where everything is in `/bin`.
266 With these additions, we need the longer `PATH` shown above to have
267 ready access to them all.
268
269 Another useful case to consider is that you’ve installed a [server
270 extension](./serverext.wiki) and you need an interpreter for that
271 script. The first option above won’t work except in the unlikely case that
272 it’s written for one of the bare-bones script interpreters that BusyBox
273 ships.(^BusyBox’s `/bin/sh` is based on the old 4.4BSD Lite Almquist
274 shell, implementing little more than what POSIX specified in 1989, plus
275 equally stripped-down versions of `awk` and `sed`.)
276
277 Let’s say the extension is written in Python. While you could handle it
278 the same way we do with the Tcl example above, Python is more
279 popular, giving us more options. Let’s inject a Python environment into
280 the stock Fossil container via a suitable “[distroless]” image instead:
281
282 ```
283 ## ---------------------------------------------------------------------
284 ## STAGE 2: Pare that back to the bare essentials, plus Python.
285 ## ---------------------------------------------------------------------
286 FROM cgr.dev/chainguard/python:latest
287 USER root
288 ARG UID=499
289 ENV PATH "/sbin:/usr/sbin:/bin:/usr/bin"
290 COPY --from=builder /tmp/fossil /bin/
291 COPY --from=builder /bin/busybox.static /bin/busybox
292 RUN [ "/bin/busybox", "--install", "/bin" ]
293 RUN set -x \
294 && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /etc/passwd \
295 && echo "fossil:x:${UID}:fossil" >> /etc/group \
296 && install -d -m 700 -o fossil -g fossil log museum
297 ```
298
299 You will also have to add `busybox-static` to the APK package list in
300 STAGE 1 for the `RUN` script at the end of that stage to work, since the
301 [Chainguard Python image][cgimgs] lacks a shell, on purpose. The need to
302 install root-level binaries is why we change `USER` temporarily here.
303
304 Build it and test that it works like so:
305
306 ```
307 $ make container-run &&
308 docker exec -i $(make container-version) python --version
309 3.11.2
310 ```
311
312 The compensation for the hassle of using Chainguard over something more
313 general purpose like Alpine + “`apk add python`”
314 is huge: we no longer leave a package manager sitting around inside the
315 container, waiting for some malefactor to figure out how to abuse it.
316
317 Beware that there’s a limit to this über-jail’s ability to save you when
318 you go and provide a more capable OS layer like this. The container
319 layer should stop an attacker from accessing any files out on the host
320 that you haven’t explicitly mounted into the container’s namespace, but
321 it can’t stop them from making outbound network connections or modifying
322 the repo DB inside the container.
323
324 [cgimgs]: https://github.com/chainguard-images/images/tree/main/images
325 [distroless]: https://www.chainguard.dev/unchained/minimal-container-images-towards-a-more-secure-future
326 [MTA]: https://en.wikipedia.org/wiki/Message_transfer_agent
327
328
329 ### 3.3 <a id="caps"></a>Dropping Unnecessary Capabilities
330
331 The example commands above create the container with [a default set of
332 Linux kernel capabilities][defcap]. Although Docker strips away almost
333 all of the traditional root capabilities by default, and Fossil doesn’t
334 need any of those it does take away, Docker does leave some enabled that
@@ -251,11 +347,11 @@
347 image build process sets up all file ownership properly, to the
348 extent that this is possible under the limitations of our
349 automation.
350
351 Curiously, stripping this capability doesn’t affect your ability to
352 run commands like “`chown -R fossil:fossil /museum`” when
353 you’re using bind mounts or external volumes — as we recommend
354 [above](#bind-mount) — because it’s the host OS’s kernel
355 capabilities that affect the underlying `chown(2)` call in that
356 case, not those of the container.
357
@@ -279,16 +375,16 @@
375 users. You might wish for this ability as an administrator shelled
376 into the container, but you can pass the “`docker exec --user`”
377 option to run commands within your container as the legitimate owner
378 of the process, removing the need for this capability.
379
380 * **`MKNOD`**: As of 2023.03.26, the stock container uses the
381 runtime’s default `/dev` node tree. Prior to this, we had to create
382 `/dev/null` and `/dev/urandom` inside [the chroot jail](#chroot),
383 but even then, these device nodes were created at build time and
384 were never changed at run time, so we didn’t need this run-time
385 capability even then.
386
387 * **`NET_BIND_SERVICE`**: With containerized deployment, Fossil never
388 needs the ability to bind the server to low-numbered TCP ports, not
389 even if you’re running the server in production with TLS enabled and
390 want the service bound to port 443. It’s perfectly fine to let the
@@ -301,15 +397,17 @@
397 [terminating TLS with a front-end proxy](./ssl.wiki#server). You’re
398 more likely to say something like “`-p localhost:12345:8080`” and then
399 configure the reverse proxy to translate external HTTPS calls into
400 HTTP directed at this internal port 12345.)
401
402 * **`NET_RAW`**: Fossil itself doesn’t use raw sockets, and while
403 you could [swap out the run layer](#run) for something more
404 functional that *does* make use of raw sockets, there’s little call
405 for it. The best reason I can come up with is to be able to run
406 utilities like `ping` and `traceroute`, but since we aren’t doing
407 anything clever with the networking configuration, there’s no
408 particularly compelling reason to run these from inside the
409 container. If you need to ping something, do it on the host.
410
411 If we did not take this hard-line stance, an attacker that broke
412 into the container and gained root privileges might use raw sockets
413 to do a wide array of bad things to any network the container is
@@ -358,11 +456,11 @@
456 this:
457
458 ```
459 $ docker build -t fossil .
460 $ docker create --name fossil-static-tmp fossil
461 $ docker cp fossil-static-tmp:/bin/fossil .
462 $ docker container rm fossil-static-tmp
463 ```
464
465 The resulting binary is the single largest file inside that container,
466 at about 6 MiB. (It’s built stripped.)
@@ -370,46 +468,24 @@
468 [lsl]: https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
469
470
471 ## 5. <a id="args"></a>Container Build Arguments
472
473 ### <a id="pkg-vers"></a> 5.1 Fossil Version
474
475 The default version of Fossil fetched in the build is the version in the
476 checkout directory at the time you run it. You could override it to get
477 a release build like so:
478
479 ```
480 $ docker build -t fossil --build-arg FSLVER=version-2.20 .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481 ```
482
483 Or equivalently, using Fossil’s `Makefile` convenience target:
484
485 ```
486 $ make container-image DBFLAGS='--build-arg FSLVER=version-2.20'
 
487 ```
488
489 While you could instead use the generic
490 “`release`” tag here, it’s better to use a specific version number
491 since Docker caches downloaded files and tries to
@@ -468,10 +544,22 @@
544 wish for [a static Fossil binary](#static). For those who want such a
545 “batteries included” container, we recommend taking a look at [this
546 alternative](https://hub.docker.com/r/duvel/fossil); needless to say,
547 it’s inherently less secure than our stock container, but you may find
548 the tradeoff worthwhile.
549
550 ### 5.4 <a id="cengine"></a>Container Engine
551
552 Although the Fossil container build system defaults to Docker, we allow
553 for use of any OCI container system that implements the same interfaces.
554 We go into more details about this in [the next section](#light), but
555 for now, it suffices to point out that you can switch to Podman while
556 using our `Makefile` convenience targets unchanged by saying:
557
558 ```
559 $ make CENGINE=podman container-run
560 ```
561
562
563 ## 6. <a id="light"></a>Lightweight Alternatives to Docker
564
565 Those afflicted with sticker shock at seeing the size of a [Docker
@@ -552,161 +640,55 @@
640 [runc]: https://github.com/opencontainers/runc
641
642
643 ### 6.2 <a id="podman"></a>Podman
644
645 A lighter-weight [rootless] [drop-in replacement][whatis] that doesn’t
646 give up the image builder is [Podman]. Initially created by
647 Red Hat and thus popular on that family of OSes, it will run on
648 any flavor of Linux. It can even be made to run [on macOS via Homebrew][pmmac]
649 or [on Windows via WSL2][pmwin].
650
651 On Ubuntu 22.04, the installation size is about 38&nbsp;MiB, roughly a
652 tenth the size of Docker Engine.
653
654 For our purposes here, the only thing that changes relative to the
655 examples at the top of this document are the initial command:
656
657 ```
658 $ podman build -t fossil .
659 $ podman run --name fossil -p 9999:8080/tcp fossil
660 ```
661
662 Your Linux package repo may have a `podman-docker` package which
663 provides a “`docker`” script that calls “`podman`” for you, eliminating
664 even the command name difference. With that installed, the `make`
665 commands above will work with Podman as-is.
666
667 The only difference that matters here is that Podman doesn’t have the
668 same [default Linux kernel capability set](#caps) as Docker, which
669 affects the `--cap-drop` flags recommended above to:
670
671 ```
672 $ podman create \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673 --name fossil \
674 --cap-drop CHOWN \
675 --cap-drop FSETID \
676 --cap-drop KILL \
677 --cap-drop NET_BIND_SERVICE \
678 --cap-drop SETFCAP \
679 --cap-drop SETPCAP \
680 --publish 127.0.0.1:9999:8080 \
681 localhost/fossil
682 $ podman start fossil
683 ```
684
685 [pmmac]: https://podman.io/getting-started/installation.html#macos
686 [pmwin]: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md
687 [Podman]: https://podman.io/
688 [rootless]: https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md
689 [whatis]: https://podman.io/whatis.html
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
690
691
692 ### 6.3 <a id="nspawn"></a>`systemd-container`
693
694 If even the Podman stack is too big for you, the next-best option I’m
@@ -729,30 +711,38 @@
711 “`myproject`” within `~/museum/myproject/repo.fossil`, named according
712 to the reasons given [above](#repo-inside). We’ll make consistent use of
713 this naming scheme in the examples below so that you will be able to
714 replace the “`myproject`” element of the various file and path names.
715
716 If you use [the stock `Dockerfile`][DF] to generate your
717 base image, `nspawn` won’t recognize it as containing an OS unless you
718 change the “`FROM scratch AS os`” line at the top of the second stage
719 to something like this:
720
721 ```
722 FROM gcr.io/distroless/static-debian11 AS os
723 ```
724
725 Using that as a base image provides all the files `nspawn` checks for to
726 determine whether the container is sufficiently close to a Linux VM for
727 the following step to proceed:
728
729 ```
730 $ make container
731 $ docker container export $(make container-version) |
732 machinectl import-tar - myproject
733 ```
734
735 Next, create `/etc/systemd/nspawn/myproject.nspawn`:
 
736
737 ----
738
739 ```
740 [Exec]
741 WorkingDirectory=/
742 Parameters=bin/fossil server \
743 --baseurl https://example.com/myproject \
 
744 --create \
745 --jsmode bundled \
746 --localhost \
747 --port 9000 \
748 --scgi \
@@ -771,11 +761,11 @@
761 ProcessTwo=yes
762 LinkJournal=no
763 Timezone=no
764
765 [Files]
766 Bind=/home/fossil/museum/myproject:/museum
767
768 [Network]
769 VirtualEthernet=no
770 ```
771
@@ -795,11 +785,11 @@
785 it’ll work with the other repository service methods we’ve
786 [documented][srv].
787
788 * The path in the host-side part of the `Bind` value must point at the
789 directory containing the `repo.fossil` file referenced in said
790 command so that `/museum/repo.fossil` refers to your repo out
791 on the host for the reasons given [above](#bind-mount).
792
793 That being done, we also need a generic systemd unit file called
794 `/etc/systemd/system/[email protected]`, containing:
795
@@ -841,11 +831,10 @@
831 the `*.nspawn` file:
832
833 ```
834 Parameters=bin/fossil server \
835 --cert /path/to/cert.pem \
 
836 --create \
837 --jsmode bundled \
838 --port 443 \
839 --user admin \
840 museum/repo.fossil
@@ -1015,11 +1004,11 @@
1004 * **`machinectl poweroff`** will fail because the container
1005 isn’t running dbus.
1006
1007 * **`machinectl start`** will try to find an `/sbin/init`
1008 program in the rootfs, which we haven’t got. We could
1009 rename `/bin/fossil` to `/sbin/init` and then hack
1010 the chroot scheme to match, but ick. (This, incidentally,
1011 is why we set `ProcessTwo=yes` above even though Fossil is
1012 perfectly capable of running as PID 1, a fact we depend on
1013 in the other methods above.)
1014
1015
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -181,22 +181,17 @@
181181
This policy is particularly useful when running Fossil inside a
182182
restrictive container, anything from [./chroot.md | classic chroot
183183
jails] to modern [https://en.wikipedia.org/wiki/OS-level_virtualization
184184
| OS-level virtualization mechanisms] such as
185185
[https://en.wikipedia.org/wiki/Docker_(software) | Docker].
186
-Our [/file?name=Dockerfile.in&ci=trunk | stock <tt>Dockerfile</tt>]
187
-creates a ~4 MiB [https://opencontainers.org | OCI] image on 64-bit Linux, including
188
-a capable [https://www.busybox.net/ | Busybox] environment for live
189
-diagnostics of the running container.
190
-
191
-Modern Linux systems tend to make full static linking
192
-[https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
193
-| difficult], but our official executables do statically link to OpenSSL
194
-to remove a version dependency, resulting in an executable that's around
195
-6 MiB, depending on the platform. ([Release Build How-To | Details].)
196
-The result is dependent only upon widespread platform libraries with
197
-stable ABIs such as glibc, zlib, etc.
186
+Our [./containers.md | stock container image] is under 8&nbsp;MB when
187
+uncompressed and running. It contains nothing but a single
188
+statically-linked binary.
189
+
190
+If you build a dynamically linked binary instead, Fossil's on-disk size
191
+drops to around 6&nbsp;MB, and it's dependent only on widespread
192
+platform libraries with stable ABIs such as glibc, zlib, and openssl.
198193
199194
Full static linking is easier on Windows, so our precompiled Windows
200195
binaries are just a ZIP archive
201196
containing only "<tt>fossil.exe</tt>". There is no "<tt>setup.exe</tt>"
202197
to run.
@@ -358,21 +353,22 @@
358353
359354
About half of Git's code is POSIX C, and about a third is POSIX shell
360355
code. This is largely why the so-called "Git for Windows" distributions
361356
(both [https://git-scm.com/download/win|first-party] and
362357
[https://gitforwindows.org/|third-party]) are actually an
363
-[http://mingw.org/wiki/msys|MSYS POSIX portability environment] bundled
358
+[https://www.msys2.org/wiki/Home/|MSYS POSIX portability environment] bundled
364359
with all of the Git stuff, because it would be too painful to port Git
365360
natively to Windows. Git is a foreign citizen on Windows, speaking to it
366361
only through a translator.⁶
367362
368363
While Fossil does lean toward POSIX norms when given a choice — LF-only
369364
line endings are treated as first-class citizens over CR+LF, for example
370365
— the Windows build of Fossil is truly native.
371366
372367
The third-party extensions to Git tend to follow this same pattern.
373
-[http://mingw.org/wiki/msys|GitLab isn't portable to Windows at all],
368
+[https://docs.gitlab.com/ee/install/install_methods.html#microsoft-windows |
369
+GitLab isn't portable to Windows at all],
374370
for example. For that matter, GitLab isn't even officially supported on
375371
macOS, the BSDs, or uncommon Linuxes! We have many users who regularly
376372
build and run Fossil on all of these systems.
377373
378374
379375
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -181,22 +181,17 @@
181 This policy is particularly useful when running Fossil inside a
182 restrictive container, anything from [./chroot.md | classic chroot
183 jails] to modern [https://en.wikipedia.org/wiki/OS-level_virtualization
184 | OS-level virtualization mechanisms] such as
185 [https://en.wikipedia.org/wiki/Docker_(software) | Docker].
186 Our [/file?name=Dockerfile.in&ci=trunk | stock <tt>Dockerfile</tt>]
187 creates a ~4 MiB [https://opencontainers.org | OCI] image on 64-bit Linux, including
188 a capable [https://www.busybox.net/ | Busybox] environment for live
189 diagnostics of the running container.
190
191 Modern Linux systems tend to make full static linking
192 [https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
193 | difficult], but our official executables do statically link to OpenSSL
194 to remove a version dependency, resulting in an executable that's around
195 6 MiB, depending on the platform. ([Release Build How-To | Details].)
196 The result is dependent only upon widespread platform libraries with
197 stable ABIs such as glibc, zlib, etc.
198
199 Full static linking is easier on Windows, so our precompiled Windows
200 binaries are just a ZIP archive
201 containing only "<tt>fossil.exe</tt>". There is no "<tt>setup.exe</tt>"
202 to run.
@@ -358,21 +353,22 @@
358
359 About half of Git's code is POSIX C, and about a third is POSIX shell
360 code. This is largely why the so-called "Git for Windows" distributions
361 (both [https://git-scm.com/download/win|first-party] and
362 [https://gitforwindows.org/|third-party]) are actually an
363 [http://mingw.org/wiki/msys|MSYS POSIX portability environment] bundled
364 with all of the Git stuff, because it would be too painful to port Git
365 natively to Windows. Git is a foreign citizen on Windows, speaking to it
366 only through a translator.⁶
367
368 While Fossil does lean toward POSIX norms when given a choice — LF-only
369 line endings are treated as first-class citizens over CR+LF, for example
370 — the Windows build of Fossil is truly native.
371
372 The third-party extensions to Git tend to follow this same pattern.
373 [http://mingw.org/wiki/msys|GitLab isn't portable to Windows at all],
 
374 for example. For that matter, GitLab isn't even officially supported on
375 macOS, the BSDs, or uncommon Linuxes! We have many users who regularly
376 build and run Fossil on all of these systems.
377
378
379
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -181,22 +181,17 @@
181 This policy is particularly useful when running Fossil inside a
182 restrictive container, anything from [./chroot.md | classic chroot
183 jails] to modern [https://en.wikipedia.org/wiki/OS-level_virtualization
184 | OS-level virtualization mechanisms] such as
185 [https://en.wikipedia.org/wiki/Docker_(software) | Docker].
186 Our [./containers.md | stock container image] is under 8&nbsp;MB when
187 uncompressed and running. It contains nothing but a single
188 statically-linked binary.
189
190 If you build a dynamically linked binary instead, Fossil's on-disk size
191 drops to around 6&nbsp;MB, and it's dependent only on widespread
192 platform libraries with stable ABIs such as glibc, zlib, and openssl.
 
 
 
 
 
193
194 Full static linking is easier on Windows, so our precompiled Windows
195 binaries are just a ZIP archive
196 containing only "<tt>fossil.exe</tt>". There is no "<tt>setup.exe</tt>"
197 to run.
@@ -358,21 +353,22 @@
353
354 About half of Git's code is POSIX C, and about a third is POSIX shell
355 code. This is largely why the so-called "Git for Windows" distributions
356 (both [https://git-scm.com/download/win|first-party] and
357 [https://gitforwindows.org/|third-party]) are actually an
358 [https://www.msys2.org/wiki/Home/|MSYS POSIX portability environment] bundled
359 with all of the Git stuff, because it would be too painful to port Git
360 natively to Windows. Git is a foreign citizen on Windows, speaking to it
361 only through a translator.⁶
362
363 While Fossil does lean toward POSIX norms when given a choice — LF-only
364 line endings are treated as first-class citizens over CR+LF, for example
365 — the Windows build of Fossil is truly native.
366
367 The third-party extensions to Git tend to follow this same pattern.
368 [https://docs.gitlab.com/ee/install/install_methods.html#microsoft-windows |
369 GitLab isn't portable to Windows at all],
370 for example. For that matter, GitLab isn't even officially supported on
371 macOS, the BSDs, or uncommon Linuxes! We have many users who regularly
372 build and run Fossil on all of these systems.
373
374
375
--- www/settings.wiki
+++ www/settings.wiki
@@ -32,14 +32,14 @@
3232
machine, largely acting to reflect your preference on how you want to
3333
use Fossil, how you communicate with the server, or options for hosting
3434
a repository on the web.
3535
3636
However, for historical reasons, some settings affect how you work with
37
-versioned files. These are <tt>allow-symlinks</tt>,
38
-<tt>binary-glob</tt>, <tt>crlf-glob</tt>, <tt>crnl-glob</tt>,
39
-<tt>empty-dirs</tt>, <tt>encoding-glob</tt>, <tt>ignore-glob</tt>,
40
-<tt>keep-glob</tt> and <tt>manifest</tt>. The most important is
37
+versioned files. These are <tt>clean-glob</tt>, <tt>binary-glob</tt>,
38
+<tt>crlf-glob</tt> (and its alias <tt>crnl-glob</tt>), <tt>empty-dirs</tt>,
39
+<tt>encoding-glob</tt>, <tt>ignore-glob</tt>, <tt>keep-glob</tt>,
40
+<tt>manifest</tt>, and <tt>mimetypes</tt>. The most important is
4141
<tt>ignore-glob</tt> which specifies which files should be ignored when
4242
looking for unmanaged files with the <tt>extras</tt> command.
4343
4444
Because these options can change over time, and the inconvenience of
4545
replicating changes, these settings are "versionable". As well as being
4646
--- www/settings.wiki
+++ www/settings.wiki
@@ -32,14 +32,14 @@
32 machine, largely acting to reflect your preference on how you want to
33 use Fossil, how you communicate with the server, or options for hosting
34 a repository on the web.
35
36 However, for historical reasons, some settings affect how you work with
37 versioned files. These are <tt>allow-symlinks</tt>,
38 <tt>binary-glob</tt>, <tt>crlf-glob</tt>, <tt>crnl-glob</tt>,
39 <tt>empty-dirs</tt>, <tt>encoding-glob</tt>, <tt>ignore-glob</tt>,
40 <tt>keep-glob</tt> and <tt>manifest</tt>. The most important is
41 <tt>ignore-glob</tt> which specifies which files should be ignored when
42 looking for unmanaged files with the <tt>extras</tt> command.
43
44 Because these options can change over time, and the inconvenience of
45 replicating changes, these settings are "versionable". As well as being
46
--- www/settings.wiki
+++ www/settings.wiki
@@ -32,14 +32,14 @@
32 machine, largely acting to reflect your preference on how you want to
33 use Fossil, how you communicate with the server, or options for hosting
34 a repository on the web.
35
36 However, for historical reasons, some settings affect how you work with
37 versioned files. These are <tt>clean-glob</tt>, <tt>binary-glob</tt>,
38 <tt>crlf-glob</tt> (and its alias <tt>crnl-glob</tt>), <tt>empty-dirs</tt>,
39 <tt>encoding-glob</tt>, <tt>ignore-glob</tt>, <tt>keep-glob</tt>,
40 <tt>manifest</tt>, and <tt>mimetypes</tt>. The most important is
41 <tt>ignore-glob</tt> which specifies which files should be ignored when
42 looking for unmanaged files with the <tt>extras</tt> command.
43
44 Because these options can change over time, and the inconvenience of
45 replicating changes, these settings are "versionable". As well as being
46

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button