Fossil SCM

Merge trunk into forumpost-locking branch.

stephan 2023-04-16 13:13 UTC forumpost-locking merge
Commit 0af371047c7c426b99ee0135727f6d09a05cd7f4d33301b421bacbc46aa1281f
+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
+2666 -1814
--- 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.0. 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.0"
456
-#define SQLITE_VERSION_NUMBER 3041000
457
-#define SQLITE_SOURCE_ID "2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d"
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 */
@@ -19154,10 +19234,11 @@
1915419234
Expr *pExpr; /* The expression contained in the index */
1915519235
int iDataCur; /* The data cursor associated with the index */
1915619236
int iIdxCur; /* The index cursor */
1915719237
int iIdxCol; /* The index column that contains value of pExpr */
1915819238
u8 bMaybeNullRow; /* True if we need an OP_IfNullRow check */
19239
+ u8 aff; /* Affinity of the pExpr expression */
1915919240
IndexedExpr *pIENext; /* Next in a list of all indexed expressions */
1916019241
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
1916119242
const char *zIdxName; /* Name of index, used only for bytecode comments */
1916219243
#endif
1916319244
};
@@ -19206,10 +19287,13 @@
1920619287
u8 prepFlags; /* SQLITE_PREPARE_* flags */
1920719288
u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
1920819289
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
1920919290
u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
1921019291
#endif
19292
+#ifdef SQLITE_DEBUG
19293
+ u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
19294
+#endif
1921119295
int nRangeReg; /* Size of the temporary register block */
1921219296
int iRangeReg; /* First register in temporary register block */
1921319297
int nErr; /* Number of errors seen */
1921419298
int nTab; /* Number of previously allocated VDBE cursors */
1921519299
int nMem; /* Number of memory cells used so far */
@@ -19666,10 +19750,11 @@
1966619750
struct RenameCtx *pRename; /* RENAME COLUMN context */
1966719751
struct Table *pTab; /* Table of generated column */
1966819752
struct CoveringIndexCheck *pCovIdxCk; /* Check for covering index */
1966919753
SrcItem *pSrcItem; /* A single FROM clause item */
1967019754
DbFixer *pFix; /* See sqlite3FixSelect() */
19755
+ Mem *aMem; /* See sqlite3BtreeCursorHint() */
1967119756
} u;
1967219757
};
1967319758
1967419759
/*
1967519760
** The following structure contains information used by the sqliteFix...
@@ -20137,10 +20222,14 @@
2013720222
SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
2013820223
SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
2013920224
SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
2014020225
SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
2014120226
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
2014220231
#ifdef SQLITE_DEBUG
2014320232
SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
2014420233
#endif
2014520234
SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
2014620235
SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20287,11 +20376,11 @@
2028720376
SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
2028820377
SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
2028920378
Expr*,ExprList*,u32,Expr*);
2029020379
SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
2029120380
SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20292
-SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
20381
+SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*);
2029320382
SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
2029420383
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
2029520384
SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
2029620385
#endif
2029720386
SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -20824,14 +20913,11 @@
2082420913
SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
2082520914
SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
2082620915
SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *);
2082720916
2082820917
SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20829
-#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
20830
- && !defined(SQLITE_OMIT_VIRTUALTABLE)
20831
-SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info*);
20832
-#endif
20918
+SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse*);
2083320919
SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
2083420920
SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
2083520921
SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
2083620922
SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*);
2083720923
SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*);
@@ -21073,10 +21159,16 @@
2107321159
#if defined(VDBE_PROFILE) \
2107421160
|| defined(SQLITE_PERFORMANCE_TRACE) \
2107521161
|| defined(SQLITE_ENABLE_STMT_SCANSTATUS)
2107621162
SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
2107721163
#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
2107821170
2107921171
#endif /* SQLITEINT_H */
2108021172
2108121173
/************** End of sqliteInt.h *******************************************/
2108221174
/************** Begin file os_common.h ***************************************/
@@ -22263,11 +22355,11 @@
2226322355
0, /* xAltLocaltime */
2226422356
0x7ffffffe, /* iOnceResetThreshold */
2226522357
SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
2226622358
0, /* iPrngSeed */
2226722359
#ifdef SQLITE_DEBUG
22268
- {0,0,0,0,0,0} /* aTune */
22360
+ {0,0,0,0,0,0}, /* aTune */
2226922361
#endif
2227022362
};
2227122363
2227222364
/*
2227322365
** Hash table for global functions - functions common to all
@@ -30068,10 +30160,24 @@
3006830160
*val = (*val - d)*10.0;
3006930161
return (char)digit;
3007030162
}
3007130163
#endif /* SQLITE_OMIT_FLOATING_POINT */
3007230164
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
+
3007330179
/*
3007430180
** Set the StrAccum object to an error mode.
3007530181
*/
3007630182
SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
3007730183
assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30160,10 +30266,12 @@
3016030266
etByte xtype = etINVALID; /* Conversion paradigm */
3016130267
u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
3016230268
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
3016330269
sqlite_uint64 longvalue; /* Value for integer types */
3016430270
LONGDOUBLE_TYPE realvalue; /* Value for real types */
30271
+ sqlite_uint64 msd; /* Divisor to get most-significant-digit
30272
+ ** of longvalue */
3016530273
const et_info *infop; /* Pointer to the appropriate info structure */
3016630274
char *zOut; /* Rendering buffer */
3016730275
int nOut; /* Size of the rendering buffer */
3016830276
char *zExtra = 0; /* Malloced memory used by some conversion */
3016930277
#ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30466,56 +30574,82 @@
3046630574
realvalue = -realvalue;
3046730575
prefix = '-';
3046830576
}else{
3046930577
prefix = flag_prefix;
3047030578
}
30579
+ exp = 0;
3047130580
if( xtype==etGENERIC && precision>0 ) precision--;
3047230581
testcase( precision>0xfff );
30473
- idx = precision & 0xfff;
30474
- rounder = arRound[idx%10];
30475
- while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30476
- if( xtype==etFLOAT ){
30477
- double rx = (double)realvalue;
30478
- sqlite3_uint64 u;
30479
- int ex;
30480
- memcpy(&u, &rx, sizeof(u));
30481
- ex = -1023 + (int)((u>>52)&0x7ff);
30482
- if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30483
- realvalue += rounder;
30484
- }
30485
- /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30486
- exp = 0;
30487
- if( sqlite3IsNaN((double)realvalue) ){
30488
- bufpt = "NaN";
30489
- length = 3;
30490
- break;
30491
- }
30492
- if( realvalue>0.0 ){
30493
- LONGDOUBLE_TYPE scale = 1.0;
30494
- while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
30495
- while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
30496
- while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30497
- realvalue /= scale;
30498
- while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30499
- while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30500
- if( exp>350 ){
30501
- bufpt = buf;
30502
- buf[0] = prefix;
30503
- memcpy(buf+(prefix!=0),"Inf",4);
30504
- length = 3+(prefix!=0);
30505
- break;
30506
- }
30507
- }
30508
- 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
+
3050930647
/*
3051030648
** If the field type is etGENERIC, then convert to either etEXP
3051130649
** or etFLOAT, as appropriate.
3051230650
*/
30513
- if( xtype!=etFLOAT ){
30514
- realvalue += rounder;
30515
- if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30516
- }
3051730651
if( xtype==etGENERIC ){
3051830652
flag_rtz = !flag_alternateform;
3051930653
if( exp<-4 || exp>precision ){
3052030654
xtype = etEXP;
3052130655
}else{
@@ -30528,28 +30662,33 @@
3052830662
if( xtype==etEXP ){
3052930663
e2 = 0;
3053030664
}else{
3053130665
e2 = exp;
3053230666
}
30667
+ nsd = 16 + flag_altform2*10;
30668
+ bufpt = buf;
3053330669
{
3053430670
i64 szBufNeeded; /* Size of a temporary buffer needed */
3053530671
szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
3053630672
if( szBufNeeded > etBUFSIZE ){
3053730673
bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
3053830674
if( bufpt==0 ) return;
3053930675
}
3054030676
}
3054130677
zOut = bufpt;
30542
- nsd = 16 + flag_altform2*10;
3054330678
flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
3054430679
/* The sign in front of the number */
3054530680
if( prefix ){
3054630681
*(bufpt++) = prefix;
3054730682
}
3054830683
/* Digits prior to the decimal point */
3054930684
if( e2<0 ){
3055030685
*(bufpt++) = '0';
30686
+ }else if( msd>0 ){
30687
+ for(; e2>=0; e2--){
30688
+ *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30689
+ }
3055130690
}else{
3055230691
for(; e2>=0; e2--){
3055330692
*(bufpt++) = et_getdigit(&realvalue,&nsd);
3055430693
}
3055530694
}
@@ -30562,12 +30701,18 @@
3056230701
for(e2++; e2<0; precision--, e2++){
3056330702
assert( precision>0 );
3056430703
*(bufpt++) = '0';
3056530704
}
3056630705
/* Significant digits after the decimal point */
30567
- while( (precision--)>0 ){
30568
- *(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
+ }
3056930714
}
3057030715
/* Remove trailing zeros and the "." if no digits follow the "." */
3057130716
if( flag_rtz && flag_dp ){
3057230717
while( bufpt[-1]=='0' ) *(--bufpt) = 0;
3057330718
assert( bufpt>zOut );
@@ -31244,16 +31389,26 @@
3124431389
sqlite3_str_vappendf(&acc, zFormat, ap);
3124531390
zBuf[acc.nChar] = 0;
3124631391
return zBuf;
3124731392
}
3124831393
SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31249
- char *z;
31394
+ StrAccum acc;
3125031395
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);
3125131405
va_start(ap,zFormat);
31252
- z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
31406
+ sqlite3_str_vappendf(&acc, zFormat, ap);
3125331407
va_end(ap);
31254
- return z;
31408
+ zBuf[acc.nChar] = 0;
31409
+ return zBuf;
3125531410
}
3125631411
3125731412
/*
3125831413
** This is the routine that actually formats the sqlite3_log() message.
3125931414
** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52651,11 +52806,11 @@
5265152806
** pointers).
5265252807
*/
5265352808
struct PCache {
5265452809
PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
5265552810
PgHdr *pSynced; /* Last synced page in dirty page list */
52656
- int nRefSum; /* Sum of ref counts over all pages */
52811
+ i64 nRefSum; /* Sum of ref counts over all pages */
5265752812
int szCache; /* Configured cache size */
5265852813
int szSpill; /* Size before spilling occurs */
5265952814
int szPage; /* Size of every page in this cache */
5266052815
int szExtra; /* Size of extra space for each page */
5266152816
u8 bPurgeable; /* True if pages are on backing store */
@@ -52681,11 +52836,11 @@
5268152836
static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
5268252837
PgHdr *pPg;
5268352838
unsigned char *a;
5268452839
int j;
5268552840
pPg = (PgHdr*)pLower->pExtra;
52686
- 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);
5268752842
a = (unsigned char *)pLower->pBuf;
5268852843
for(j=0; j<12; j++) printf("%02x", a[j]);
5268952844
printf(" ptr %p\n", pPg);
5269052845
}
5269152846
static void pcacheDump(PCache *pCache){
@@ -53425,18 +53580,18 @@
5342553580
** Return the total number of references to all pages held by the cache.
5342653581
**
5342753582
** This is not the total number of pages referenced, but the sum of the
5342853583
** reference count for all pages.
5342953584
*/
53430
-SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){
53585
+SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache *pCache){
5343153586
return pCache->nRefSum;
5343253587
}
5343353588
5343453589
/*
5343553590
** Return the number of references to the page supplied as an argument.
5343653591
*/
53437
-SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){
53592
+SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr *p){
5343853593
return p->nRef;
5343953594
}
5344053595
5344153596
/*
5344253597
** Return the total number of pages in the cache.
@@ -68090,12 +68245,13 @@
6809068245
int mxErr; /* Stop accumulating errors when this reaches zero */
6809168246
int nErr; /* Number of messages written to zErrMsg so far */
6809268247
int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
6809368248
u32 nStep; /* Number of steps into the integrity_check process */
6809468249
const char *zPfx; /* Error message prefix */
68095
- Pgno v1; /* Value for first %u substitution in zPfx */
68096
- 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 */
6809768253
StrAccum errMsg; /* Accumulate the error message text here */
6809868254
u32 *heap; /* Min-heap used for analyzing cell coverage */
6809968255
sqlite3 *db; /* Database connection running the check */
6810068256
};
6810168257
@@ -68554,12 +68710,12 @@
6855468710
*/
6855568711
#ifdef SQLITE_DEBUG
6855668712
int corruptPageError(int lineno, MemPage *p){
6855768713
char *zMsg;
6855868714
sqlite3BeginBenignMalloc();
68559
- zMsg = sqlite3_mprintf("database corruption page %d of %s",
68560
- (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)
6856168717
);
6856268718
sqlite3EndBenignMalloc();
6856368719
if( zMsg ){
6856468720
sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
6856568721
}
@@ -69364,12 +69520,29 @@
6936469520
** and number of the varargs parameters) is determined by the eHintType
6936569521
** parameter. See the definitions of the BTREE_HINT_* macros for details.
6936669522
*/
6936769523
SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){
6936869524
/* 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 */
6936969541
}
69370
-#endif
69542
+#endif /* SQLITE_ENABLE_CURSOR_HINTS */
69543
+
6937169544
6937269545
/*
6937369546
** Provide flag hints to the cursor.
6937469547
*/
6937569548
SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){
@@ -69450,11 +69623,11 @@
6945069623
}
6945169624
assert( offset <= (int)pBt->usableSize-5 );
6945269625
pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
6945369626
6945469627
if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69455
- TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
69628
+ TRACE(("PTRMAP_UPDATE: %u->(%u,%u)\n", key, eType, parent));
6945669629
*pRC= rc = sqlite3PagerWrite(pDbPage);
6945769630
if( rc==SQLITE_OK ){
6945869631
pPtrmap[offset] = eType;
6945969632
put4byte(&pPtrmap[offset+1], parent);
6946069633
}
@@ -69649,31 +69822,35 @@
6964969822
** This routine is a high-runner.
6965069823
*/
6965169824
iKey = *pIter;
6965269825
if( iKey>=0x80 ){
6965369826
u8 x;
69654
- iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
69655
- if( x>=0x80 ){
69656
- iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
69657
- if( x>=0x80 ){
69658
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69659
- if( x>=0x80 ){
69660
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69661
- if( x>=0x80 ){
69662
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69663
- if( x>=0x80 ){
69664
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69665
- if( x>=0x80 ){
69666
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69667
- if( x>=0x80 ){
69668
- iKey = (iKey<<8) | (*++pIter);
69669
- }
69670
- }
69671
- }
69672
- }
69673
- }
69674
- }
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;
6967569852
}
6967669853
}
6967769854
pIter++;
6967869855
6967969856
pInfo->nKey = *(i64*)&iKey;
@@ -69746,14 +69923,57 @@
6974669923
** data header and the local payload, but not any overflow page or
6974769924
** the space used by the cell pointer.
6974869925
**
6974969926
** cellSizePtrNoPayload() => table internal nodes
6975069927
** cellSizePtrTableLeaf() => table leaf nodes
69751
-** cellSizePtr() => all index nodes & table leaf nodes
69928
+** cellSizePtr() => index internal nodes
69929
+** cellSizeIdxLeaf() => index leaf nodes
6975269930
*/
6975369931
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69754
- 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 */
6975569975
u8 *pEnd; /* End mark for a varint */
6975669976
u32 nSize; /* Size value to return */
6975769977
6975869978
#ifdef SQLITE_DEBUG
6975969979
/* The value returned by this function should always be the same as
@@ -69762,10 +69982,11 @@
6976269982
** this function verifies that this invariant is not violated. */
6976369983
CellInfo debuginfo;
6976469984
pPage->xParseCell(pPage, pCell, &debuginfo);
6976569985
#endif
6976669986
69987
+ assert( pPage->childPtrSize==0 );
6976769988
nSize = *pIter;
6976869989
if( nSize>=0x80 ){
6976969990
pEnd = &pIter[8];
6977069991
nSize &= 0x7f;
6977169992
do{
@@ -69998,14 +70219,14 @@
6999870219
testcase( pc==iCellFirst );
6999970220
testcase( pc==iCellLast );
7000070221
/* These conditions have already been verified in btreeInitPage()
7000170222
** if PRAGMA cell_size_check=ON.
7000270223
*/
70003
- if( pc<iCellStart || pc>iCellLast ){
70224
+ if( pc>iCellLast ){
7000470225
return SQLITE_CORRUPT_PAGE(pPage);
7000570226
}
70006
- assert( pc>=iCellStart && pc<=iCellLast );
70227
+ assert( pc>=0 && pc<=iCellLast );
7000770228
size = pPage->xCellSize(pPage, &src[pc]);
7000870229
cbrk -= size;
7000970230
if( cbrk<iCellStart || pc+size>usableSize ){
7001070231
return SQLITE_CORRUPT_PAGE(pPage);
7001170232
}
@@ -70116,11 +70337,11 @@
7011670337
** all the space together, however. This routine will avoid using
7011770338
** the first two bytes past the cell pointer area since presumably this
7011870339
** allocation is being made in order to insert a new cell, so we will
7011970340
** also end up needing a new cell pointer.
7012070341
*/
70121
-static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
70342
+static SQLITE_INLINE int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
7012270343
const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
7012370344
u8 * const data = pPage->aData; /* Local cache of pPage->aData */
7012470345
int top; /* First byte of cell content area */
7012570346
int rc = SQLITE_OK; /* Integer return code */
7012670347
u8 *pTmp; /* Temp ptr into data[] */
@@ -70142,17 +70363,18 @@
7014270363
** then the cell content offset of an empty page wants to be 65536.
7014370364
** However, that integer is too large to be stored in a 2-byte unsigned
7014470365
** integer, so a value of 0 is used in its place. */
7014570366
pTmp = &data[hdr+5];
7014670367
top = get2byte(pTmp);
70147
- assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */
7014870368
if( gap>top ){
7014970369
if( top==0 && pPage->pBt->usableSize==65536 ){
7015070370
top = 65536;
7015170371
}else{
7015270372
return SQLITE_CORRUPT_PAGE(pPage);
7015370373
}
70374
+ }else if( top>(int)pPage->pBt->usableSize ){
70375
+ return SQLITE_CORRUPT_PAGE(pPage);
7015470376
}
7015570377
7015670378
/* If there is enough space between gap and top for one more cell pointer,
7015770379
** and if the freelist is not empty, then search the
7015870380
** freelist looking for a slot big enough to satisfy the request.
@@ -70231,11 +70453,11 @@
7023170453
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
7023270454
assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
7023370455
assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
7023470456
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
7023570457
assert( iSize>=4 ); /* Minimum cell size is 4 */
70236
- assert( iStart<=pPage->pBt->usableSize-4 );
70458
+ assert( CORRUPT_DB || iStart<=pPage->pBt->usableSize-4 );
7023770459
7023870460
/* The list of freeblocks must be in ascending order. Find the
7023970461
** spot on the list where iStart should be inserted.
7024070462
*/
7024170463
hdr = pPage->hdrOffset;
@@ -70288,10 +70510,15 @@
7028870510
if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
7028970511
data[hdr+7] -= nFrag;
7029070512
}
7029170513
pTmp = &data[hdr+5];
7029270514
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
+ }
7029370520
if( iStart<=x ){
7029470521
/* The new freeblock is at the beginning of the cell content area,
7029570522
** so just extend the cell content area rather than create another
7029670523
** freelist entry */
7029770524
if( iStart<x ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -70299,18 +70526,13 @@
7029970526
put2byte(&data[hdr+1], iFreeBlk);
7030070527
put2byte(&data[hdr+5], iEnd);
7030170528
}else{
7030270529
/* Insert the new freeblock into the freelist */
7030370530
put2byte(&data[iPtr], iStart);
70304
- }
70305
- if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
70306
- /* Overwrite deleted information with zeros when the secure_delete
70307
- ** option is enabled */
70308
- memset(&data[iStart], 0, iSize);
70309
- }
70310
- put2byte(&data[iStart], iFreeBlk);
70311
- put2byte(&data[iStart+2], iSize);
70531
+ put2byte(&data[iStart], iFreeBlk);
70532
+ put2byte(&data[iStart+2], iSize);
70533
+ }
7031270534
pPage->nFree += iOrigSize;
7031370535
return SQLITE_OK;
7031470536
}
7031570537
7031670538
/*
@@ -70343,18 +70565,18 @@
7034370565
pPage->maxLocal = pBt->maxLeaf;
7034470566
pPage->minLocal = pBt->minLeaf;
7034570567
}else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
7034670568
pPage->intKey = 0;
7034770569
pPage->intKeyLeaf = 0;
70348
- pPage->xCellSize = cellSizePtr;
70570
+ pPage->xCellSize = cellSizePtrIdxLeaf;
7034970571
pPage->xParseCell = btreeParseCellPtrIndex;
7035070572
pPage->maxLocal = pBt->maxLocal;
7035170573
pPage->minLocal = pBt->minLocal;
7035270574
}else{
7035370575
pPage->intKey = 0;
7035470576
pPage->intKeyLeaf = 0;
70355
- pPage->xCellSize = cellSizePtr;
70577
+ pPage->xCellSize = cellSizePtrIdxLeaf;
7035670578
pPage->xParseCell = btreeParseCellPtrIndex;
7035770579
return SQLITE_CORRUPT_PAGE(pPage);
7035870580
}
7035970581
}else{
7036070582
pPage->childPtrSize = 4;
@@ -72216,11 +72438,11 @@
7221672438
assert( sqlite3_mutex_held(pBt->mutex) );
7221772439
assert( pDbPage->pBt==pBt );
7221872440
if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
7221972441
7222072442
/* Move page iDbPage from its current location to page number iFreePage */
72221
- 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",
7222272444
iDbPage, iFreePage, iPtrPage, eType));
7222372445
rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
7222472446
if( rc!=SQLITE_OK ){
7222572447
return rc;
7222672448
}
@@ -74502,11 +74724,12 @@
7450274724
}
7450374725
}
7450474726
7450574727
pPage = pCur->pPage;
7450674728
idx = ++pCur->ix;
74507
- if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){
74729
+ if( sqlite3FaultSim(412) ) pPage->isInit = 0;
74730
+ if( !pPage->isInit ){
7450874731
return SQLITE_CORRUPT_BKPT;
7450974732
}
7451074733
7451174734
if( idx>=pPage->nCell ){
7451274735
if( !pPage->leaf ){
@@ -74765,11 +74988,11 @@
7476574988
}
7476674989
*pPgno = iTrunk;
7476774990
memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
7476874991
*ppPage = pTrunk;
7476974992
pTrunk = 0;
74770
- 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));
7477174994
}else if( k>(u32)(pBt->usableSize/4 - 2) ){
7477274995
/* Value of k is out of range. Database corruption */
7477374996
rc = SQLITE_CORRUPT_PGNO(iTrunk);
7477474997
goto end_allocate_page;
7477574998
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74831,11 +75054,11 @@
7483175054
}
7483275055
put4byte(&pPrevTrunk->aData[0], iNewTrunk);
7483375056
}
7483475057
}
7483575058
pTrunk = 0;
74836
- 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));
7483775060
#endif
7483875061
}else if( k>0 ){
7483975062
/* Extract a leaf from the trunk */
7484075063
u32 closest;
7484175064
Pgno iPage;
@@ -74876,12 +75099,12 @@
7487675099
if( !searchList
7487775100
|| (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
7487875101
){
7487975102
int noContent;
7488075103
*pPgno = iPage;
74881
- TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
74882
- ": %d more free pages\n",
75104
+ TRACE(("ALLOCATE: %u was leaf %u of %u on trunk %u"
75105
+ ": %u more free pages\n",
7488375106
*pPgno, closest+1, k, pTrunk->pgno, n-1));
7488475107
rc = sqlite3PagerWrite(pTrunk->pDbPage);
7488575108
if( rc ) goto end_allocate_page;
7488675109
if( closest<k-1 ){
7488775110
memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74933,11 +75156,11 @@
7493375156
/* If *pPgno refers to a pointer-map page, allocate two new pages
7493475157
** at the end of the file instead of one. The first allocated page
7493575158
** becomes a new pointer-map page, the second is used by the caller.
7493675159
*/
7493775160
MemPage *pPg = 0;
74938
- 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));
7493975162
assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
7494075163
rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
7494175164
if( rc==SQLITE_OK ){
7494275165
rc = sqlite3PagerWrite(pPg->pDbPage);
7494375166
releasePage(pPg);
@@ -74956,11 +75179,11 @@
7495675179
rc = sqlite3PagerWrite((*ppPage)->pDbPage);
7495775180
if( rc!=SQLITE_OK ){
7495875181
releasePage(*ppPage);
7495975182
*ppPage = 0;
7496075183
}
74961
- TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
75184
+ TRACE(("ALLOCATE: %u from end of file\n", *pPgno));
7496275185
}
7496375186
7496475187
assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
7496575188
7496675189
end_allocate_page:
@@ -75084,11 +75307,11 @@
7508475307
if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
7508575308
sqlite3PagerDontWrite(pPage->pDbPage);
7508675309
}
7508775310
rc = btreeSetHasContent(pBt, iPage);
7508875311
}
75089
- 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));
7509075313
goto freepage_out;
7509175314
}
7509275315
}
7509375316
7509475317
/* If control flows to this point, then it was not possible to add the
@@ -75105,11 +75328,11 @@
7510575328
goto freepage_out;
7510675329
}
7510775330
put4byte(pPage->aData, iTrunk);
7510875331
put4byte(&pPage->aData[4], 0);
7510975332
put4byte(&pPage1->aData[32], iPage);
75110
- 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));
7511175334
7511275335
freepage_out:
7511375336
if( pPage ){
7511475337
pPage->isInit = 0;
7511575338
}
@@ -75464,10 +75687,18 @@
7546475687
** pTemp is not null. Regardless of pTemp, allocate a new entry
7546575688
** in pPage->apOvfl[] and make it point to the cell content (either
7546675689
** in pTemp or the original pCell) and also record its index.
7546775690
** Allocating a new entry in pPage->aCell[] implies that
7546875691
** 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()!
7546975700
*/
7547075701
static int insertCell(
7547175702
MemPage *pPage, /* Page into which we are copying */
7547275703
int i, /* New cell becomes the i-th cell of the page */
7547375704
u8 *pCell, /* Content of the new cell */
@@ -75486,18 +75717,107 @@
7548675717
assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
7548775718
assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
7548875719
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
7548975720
assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
7549075721
assert( pPage->nFree>=0 );
75722
+ assert( iChild>0 );
7549175723
if( pPage->nOverflow || sz+2>pPage->nFree ){
7549275724
if( pTemp ){
7549375725
memcpy(pTemp, pCell, sz);
7549475726
pCell = pTemp;
7549575727
}
75496
- if( iChild ){
75497
- 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;
7549875748
}
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 ){
7549975819
j = pPage->nOverflow++;
7550075820
/* Comparison against ArraySize-1 since we hold back one extra slot
7550175821
** as a contingency. In other words, never need more than 3 overflow
7550275822
** slots but 4 are allocated, just to be safe. */
7550375823
assert( j < ArraySize(pPage->apOvfl)-1 );
@@ -75525,21 +75845,11 @@
7552575845
** if it returns successfully */
7552675846
assert( idx >= 0 );
7552775847
assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
7552875848
assert( idx+sz <= (int)pPage->pBt->usableSize );
7552975849
pPage->nFree -= (u16)(2 + sz);
75530
- if( iChild ){
75531
- /* In a corrupt database where an entry in the cell index section of
75532
- ** a btree page has a value of 3 or less, the pCell value might point
75533
- ** as many as 4 bytes in front of the start of the aData buffer for
75534
- ** the source page. Make sure this does not cause problems by not
75535
- ** reading the first 4 bytes */
75536
- memcpy(&data[idx+4], pCell+4, sz-4);
75537
- put4byte(&data[idx], iChild);
75538
- }else{
75539
- memcpy(&data[idx], pCell, sz);
75540
- }
75850
+ memcpy(&data[idx], pCell, sz);
7554175851
pIns = pPage->aCellIdx + i*2;
7554275852
memmove(pIns+2, pIns, 2*(pPage->nCell - i));
7554375853
put2byte(pIns, idx);
7554475854
pPage->nCell++;
7554575855
/* increment the cell count */
@@ -75720,11 +76030,11 @@
7572076030
int k; /* Current slot in pCArray->apEnd[] */
7572176031
u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
7572276032
7572376033
assert( i<iEnd );
7572476034
j = get2byte(&aData[hdr+5]);
75725
- if( j>(u32)usableSize ){ j = 0; }
76035
+ if( NEVER(j>(u32)usableSize) ){ j = 0; }
7572676036
memcpy(&pTmp[j], &aData[j], usableSize - j);
7572776037
7572876038
for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
7572976039
pSrcEnd = pCArray->apEnd[k];
7573076040
@@ -75864,46 +76174,54 @@
7586476174
){
7586576175
u8 * const aData = pPg->aData;
7586676176
u8 * const pEnd = &aData[pPg->pBt->usableSize];
7586776177
u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
7586876178
int nRet = 0;
75869
- int i;
76179
+ int i, j;
7587076180
int iEnd = iFirst + nCell;
75871
- u8 *pFree = 0; /* \__ Parameters for pending call to */
75872
- int szFree = 0; /* / freeSpace() */
76181
+ int nFree = 0;
76182
+ int aOfst[10];
76183
+ int aAfter[10];
7587376184
7587476185
for(i=iFirst; i<iEnd; i++){
7587576186
u8 *pCell = pCArray->apCell[i];
7587676187
if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
7587776188
int sz;
76189
+ int iAfter;
76190
+ int iOfst;
7587876191
/* No need to use cachedCellSize() here. The sizes of all cells that
7587976192
** are to be freed have already been computing while deciding which
7588076193
** cells need freeing */
7588176194
sz = pCArray->szCell[i]; assert( sz>0 );
75882
- if( pFree!=(pCell + sz) ){
75883
- if( pFree ){
75884
- assert( pFree>aData && (pFree - aData)<65536 );
75885
- freeSpace(pPg, (u16)(pFree - aData), szFree);
75886
- }
75887
- pFree = pCell;
75888
- szFree = sz;
75889
- if( pFree+sz>pEnd ){
75890
- return 0;
75891
- }
75892
- }else{
75893
- /* The current cell is adjacent to and before the pFree cell.
75894
- ** Combine the two regions into one to reduce the number of calls
75895
- ** to freeSpace(). */
75896
- pFree = pCell;
75897
- 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++;
7589876217
}
7589976218
nRet++;
7590076219
}
7590176220
}
75902
- if( pFree ){
75903
- assert( pFree>aData && (pFree - aData)<65536 );
75904
- freeSpace(pPg, (u16)(pFree - aData), szFree);
76221
+ for(j=0; j<nFree; j++){
76222
+ freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]);
7590576223
}
7590676224
return nRet;
7590776225
}
7590876226
7590976227
/*
@@ -75954,11 +76272,11 @@
7595476272
nCell -= nTail;
7595576273
}
7595676274
7595776275
pData = &aData[get2byteNotZero(&aData[hdr+5])];
7595876276
if( pData<pBegin ) goto editpage_fail;
75959
- if( pData>pPg->aDataEnd ) goto editpage_fail;
76277
+ if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail;
7596076278
7596176279
/* Add cells to the start of the page */
7596276280
if( iNew<iOld ){
7596376281
int nAdd = MIN(nNew,iOld-iNew);
7596476282
assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -76691,11 +77009,11 @@
7669177009
** (2) pPage is a virtual root page. A virtual root page is when
7669277010
** the real root page is page 1 and we are the only child of
7669377011
** that page.
7669477012
*/
7669577013
assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
76696
- 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",
7669777015
apOld[0]->pgno, apOld[0]->nCell,
7669877016
nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
7669977017
nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
7670077018
));
7670177019
@@ -76775,12 +77093,12 @@
7677577093
apNew[i]->pgno = pgnoB;
7677677094
apNew[iB]->pgno = pgnoA;
7677777095
}
7677877096
}
7677977097
76780
- TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
76781
- "%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",
7678277100
apNew[0]->pgno, szNew[0], cntNew[0],
7678377101
nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
7678477102
nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
7678577103
nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
7678677104
nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77021,11 +77339,11 @@
7702177339
ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
7702277340
}
7702377341
}
7702477342
7702577343
assert( pParent->isInit );
77026
- TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
77344
+ TRACE(("BALANCE: finished: old=%u new=%u cells=%u\n",
7702777345
nOld, nNew, b.nCell));
7702877346
7702977347
/* Free any old pages that were not reused as new pages.
7703077348
*/
7703177349
for(i=nNew; i<nOld; i++){
@@ -77106,11 +77424,11 @@
7710677424
}
7710777425
assert( sqlite3PagerIswriteable(pChild->pDbPage) );
7710877426
assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
7710977427
assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
7711077428
77111
- 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));
7711277430
7711377431
/* Copy the overflow cells from pRoot to pChild */
7711477432
memcpy(pChild->aiOvfl, pRoot->aiOvfl,
7711577433
pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
7711677434
memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77604,11 +77922,11 @@
7760477922
rc = btreeComputeFreeSpace(pPage);
7760577923
}
7760677924
if( rc ) return rc;
7760777925
}
7760877926
77609
- 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",
7761077928
pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
7761177929
loc==0 ? "overwrite" : "new entry"));
7761277930
assert( pPage->isInit || CORRUPT_DB );
7761377931
newCell = p->pBt->pTmpSpace;
7761477932
assert( newCell!=0 );
@@ -77631,10 +77949,11 @@
7763177949
if( rc ) goto end_insert;
7763277950
}
7763377951
assert( szNew==pPage->xCellSize(pPage, newCell) );
7763477952
assert( szNew <= MX_CELL_SIZE(p->pBt) );
7763577953
idx = pCur->ix;
77954
+ pCur->info.nSize = 0;
7763677955
if( loc==0 ){
7763777956
CellInfo info;
7763877957
assert( idx>=0 );
7763977958
if( idx>=pPage->nCell ){
7764077959
return SQLITE_CORRUPT_BKPT;
@@ -77679,11 +77998,11 @@
7767977998
idx = ++pCur->ix;
7768077999
pCur->curFlags &= ~BTCF_ValidNKey;
7768178000
}else{
7768278001
assert( pPage->leaf );
7768378002
}
77684
- rc = insertCell(pPage, idx, newCell, szNew, 0, 0);
78003
+ rc = insertCellFast(pPage, idx, newCell, szNew);
7768578004
assert( pPage->nOverflow==0 || rc==SQLITE_OK );
7768678005
assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );
7768778006
7768878007
/* If no error has occurred and pPage has an overflow cell, call balance()
7768978008
** to redistribute the cells within the tree. Since balance() may move
@@ -77703,11 +78022,10 @@
7770378022
** the b-tree if possible. If the cursor is left pointing to the last
7770478023
** entry in the table, and the next row inserted has an integer key
7770578024
** larger than the largest existing key, it is possible to insert the
7770678025
** row without seeking the cursor. This can be a big performance boost.
7770778026
*/
77708
- pCur->info.nSize = 0;
7770978027
if( pPage->nOverflow ){
7771078028
assert( rc==SQLITE_OK );
7771178029
pCur->curFlags &= ~(BTCF_ValidNKey);
7771278030
rc = balance(pCur);
7771378031
@@ -77903,10 +78221,13 @@
7790378221
return SQLITE_CORRUPT_BKPT;
7790478222
}
7790578223
pCell = findCell(pPage, iCellIdx);
7790678224
if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
7790778225
return SQLITE_CORRUPT_BKPT;
78226
+ }
78227
+ if( pCell<&pPage->aCellIdx[pPage->nCell] ){
78228
+ return SQLITE_CORRUPT_BKPT;
7790878229
}
7790978230
7791078231
/* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
7791178232
** be preserved following this delete operation. If the current delete
7791278233
** will cause a b-tree rebalance, then this is done by saving the cursor
@@ -78652,11 +78973,12 @@
7865278973
va_start(ap, zFormat);
7865378974
if( pCheck->errMsg.nChar ){
7865478975
sqlite3_str_append(&pCheck->errMsg, "\n", 1);
7865578976
}
7865678977
if( pCheck->zPfx ){
78657
- 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);
7865878980
}
7865978981
sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
7866078982
va_end(ap);
7866178983
if( pCheck->errMsg.accError==SQLITE_NOMEM ){
7866278984
checkOom(pCheck);
@@ -78692,15 +79014,15 @@
7869279014
**
7869379015
** Also check that the page number is in bounds.
7869479016
*/
7869579017
static int checkRef(IntegrityCk *pCheck, Pgno iPage){
7869679018
if( iPage>pCheck->nPage || iPage==0 ){
78697
- checkAppendMsg(pCheck, "invalid page number %d", iPage);
79019
+ checkAppendMsg(pCheck, "invalid page number %u", iPage);
7869879020
return 1;
7869979021
}
7870079022
if( getPageReferenced(pCheck, iPage) ){
78701
- checkAppendMsg(pCheck, "2nd reference to page %d", iPage);
79023
+ checkAppendMsg(pCheck, "2nd reference to page %u", iPage);
7870279024
return 1;
7870379025
}
7870479026
setPageReferenced(pCheck, iPage);
7870579027
return 0;
7870679028
}
@@ -78722,17 +79044,17 @@
7872279044
Pgno iPtrmapParent;
7872379045
7872479046
rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
7872579047
if( rc!=SQLITE_OK ){
7872679048
if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
78727
- checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild);
79049
+ checkAppendMsg(pCheck, "Failed to read ptrmap key=%u", iChild);
7872879050
return;
7872979051
}
7873079052
7873179053
if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
7873279054
checkAppendMsg(pCheck,
78733
- "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)",
7873479056
iChild, eType, iParent, ePtrmapType, iPtrmapParent);
7873579057
}
7873679058
}
7873779059
#endif
7873879060
@@ -78753,11 +79075,11 @@
7875379075
DbPage *pOvflPage;
7875479076
unsigned char *pOvflData;
7875579077
if( checkRef(pCheck, iPage) ) break;
7875679078
N--;
7875779079
if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
78758
- checkAppendMsg(pCheck, "failed to get page %d", iPage);
79080
+ checkAppendMsg(pCheck, "failed to get page %u", iPage);
7875979081
break;
7876079082
}
7876179083
pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
7876279084
if( isFreeList ){
7876379085
u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78766,11 +79088,11 @@
7876679088
checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
7876779089
}
7876879090
#endif
7876979091
if( n>pCheck->pBt->usableSize/4-2 ){
7877079092
checkAppendMsg(pCheck,
78771
- "freelist leaf count too big on page %d", iPage);
79093
+ "freelist leaf count too big on page %u", iPage);
7877279094
N--;
7877379095
}else{
7877479096
for(i=0; i<(int)n; i++){
7877579097
Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
7877679098
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78798,11 +79120,11 @@
7879879120
iPage = get4byte(pOvflData);
7879979121
sqlite3PagerUnref(pOvflPage);
7880079122
}
7880179123
if( N && nErrAtStart==pCheck->nErr ){
7880279124
checkAppendMsg(pCheck,
78803
- "%s is %d but should be %d",
79125
+ "%s is %u but should be %u",
7880479126
isFreeList ? "size" : "overflow list length",
7880579127
expected-N, expected);
7880679128
}
7880779129
}
7880879130
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78913,12 +79235,12 @@
7891379235
if( pCheck->mxErr==0 ) goto end_of_check;
7891479236
pBt = pCheck->pBt;
7891579237
usableSize = pBt->usableSize;
7891679238
if( iPage==0 ) return 0;
7891779239
if( checkRef(pCheck, iPage) ) return 0;
78918
- pCheck->zPfx = "Page %u: ";
78919
- pCheck->v1 = iPage;
79240
+ pCheck->zPfx = "Tree %u page %u: ";
79241
+ pCheck->v0 = pCheck->v1 = iPage;
7892079242
if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
7892179243
checkAppendMsg(pCheck,
7892279244
"unable to get the page. error code=%d", rc);
7892379245
goto end_of_check;
7892479246
}
@@ -78940,11 +79262,11 @@
7894079262
}
7894179263
data = pPage->aData;
7894279264
hdr = pPage->hdrOffset;
7894379265
7894479266
/* Set up for cell analysis */
78945
- pCheck->zPfx = "On tree page %u cell %d: ";
79267
+ pCheck->zPfx = "Tree %u page %u cell %u: ";
7894679268
contentOffset = get2byteNotZero(&data[hdr+5]);
7894779269
assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
7894879270
7894979271
/* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
7895079272
** number of cells on the page. */
@@ -78960,11 +79282,11 @@
7896079282
if( !pPage->leaf ){
7896179283
/* Analyze the right-child page of internal pages */
7896279284
pgno = get4byte(&data[hdr+8]);
7896379285
#ifndef SQLITE_OMIT_AUTOVACUUM
7896479286
if( pBt->autoVacuum ){
78965
- pCheck->zPfx = "On page %u at right child: ";
79287
+ pCheck->zPfx = "Tree %u page %u right child: ";
7896679288
checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
7896779289
}
7896879290
#endif
7896979291
depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
7897079292
keyCanBeEqual = 0;
@@ -78984,11 +79306,11 @@
7898479306
pCheck->v2 = i;
7898579307
assert( pCellIdx==&data[cellStart + i*2] );
7898679308
pc = get2byteAligned(pCellIdx);
7898779309
pCellIdx -= 2;
7898879310
if( pc<contentOffset || pc>usableSize-4 ){
78989
- checkAppendMsg(pCheck, "Offset %d out of range %d..%d",
79311
+ checkAppendMsg(pCheck, "Offset %u out of range %u..%u",
7899079312
pc, contentOffset, usableSize-4);
7899179313
doCoverageCheck = 0;
7899279314
continue;
7899379315
}
7899479316
pCell = &data[pc];
@@ -79116,11 +79438,11 @@
7911679438
** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
7911779439
** number of fragmented free bytes within the cell content area.
7911879440
*/
7911979441
if( heap[0]==0 && nFrag!=data[hdr+7] ){
7912079442
checkAppendMsg(pCheck,
79121
- "Fragmentation of %d bytes reported as %d on page %u",
79443
+ "Fragmentation of %u bytes reported as %u on page %u",
7912279444
nFrag, data[hdr+7], iPage);
7912379445
}
7912479446
}
7912579447
7912679448
end_of_check:
@@ -79213,11 +79535,11 @@
7921379535
if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
7921479536
7921579537
/* Check the integrity of the freelist
7921679538
*/
7921779539
if( bCkFreelist ){
79218
- sCheck.zPfx = "Main freelist: ";
79540
+ sCheck.zPfx = "Freelist: ";
7921979541
checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
7922079542
get4byte(&pBt->pPage1->aData[36]));
7922179543
sCheck.zPfx = 0;
7922279544
}
7922379545
@@ -79230,11 +79552,11 @@
7923079552
Pgno mxInHdr;
7923179553
for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
7923279554
mxInHdr = get4byte(&pBt->pPage1->aData[52]);
7923379555
if( mx!=mxInHdr ){
7923479556
checkAppendMsg(&sCheck,
79235
- "max rootpage (%d) disagrees with header (%d)",
79557
+ "max rootpage (%u) disagrees with header (%u)",
7923679558
mx, mxInHdr
7923779559
);
7923879560
}
7923979561
}else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
7924079562
checkAppendMsg(&sCheck,
@@ -79261,23 +79583,23 @@
7926179583
*/
7926279584
if( !bPartial ){
7926379585
for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
7926479586
#ifdef SQLITE_OMIT_AUTOVACUUM
7926579587
if( getPageReferenced(&sCheck, i)==0 ){
79266
- checkAppendMsg(&sCheck, "Page %d is never used", i);
79588
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
7926779589
}
7926879590
#else
7926979591
/* If the database supports auto-vacuum, make sure no tables contain
7927079592
** references to pointer-map pages.
7927179593
*/
7927279594
if( getPageReferenced(&sCheck, i)==0 &&
7927379595
(PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79274
- checkAppendMsg(&sCheck, "Page %d is never used", i);
79596
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
7927579597
}
7927679598
if( getPageReferenced(&sCheck, i)!=0 &&
7927779599
(PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79278
- checkAppendMsg(&sCheck, "Pointer map page %d is referenced", i);
79600
+ checkAppendMsg(&sCheck, "Page %u: pointer map referenced", i);
7927979601
}
7928079602
#endif
7928179603
}
7928279604
}
7928379605
@@ -80805,11 +81127,11 @@
8080581127
return SQLITE_NOMEM_BKPT;
8080681128
}
8080781129
8080881130
vdbeMemRenderNum(nByte, pMem->z, pMem);
8080981131
assert( pMem->z!=0 );
80810
- assert( pMem->n==sqlite3Strlen30NN(pMem->z) );
81132
+ assert( pMem->n==(int)sqlite3Strlen30NN(pMem->z) );
8081181133
pMem->enc = SQLITE_UTF8;
8081281134
pMem->flags |= MEM_Str|MEM_Term;
8081381135
if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
8081481136
sqlite3VdbeChangeEncoding(pMem, enc);
8081581137
return SQLITE_OK;
@@ -81849,10 +82171,13 @@
8184982171
assert( ExprUseXList(p) );
8185082172
pList = p->x.pList;
8185182173
if( pList ) nVal = pList->nExpr;
8185282174
assert( !ExprHasProperty(p, EP_IntValue) );
8185382175
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
8185482179
assert( pFunc );
8185582180
if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
8185682181
|| (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
8185782182
){
8185882183
return SQLITE_OK;
@@ -81885,20 +82210,15 @@
8188582210
rc = ctx.isError;
8188682211
sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
8188782212
}else{
8188882213
sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
8188982214
assert( rc==SQLITE_OK );
81890
- assert( enc==pVal->enc
81891
- || (pVal->flags & MEM_Str)==0
81892
- || db->mallocFailed );
81893
-#if 0 /* Not reachable except after a prior failure */
8189482215
rc = sqlite3VdbeChangeEncoding(pVal, enc);
81895
- if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
82216
+ if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){
8189682217
rc = SQLITE_TOOBIG;
8189782218
pCtx->pParse->nErr++;
8189882219
}
81899
-#endif
8190082220
}
8190182221
8190282222
value_from_function_out:
8190382223
if( rc!=SQLITE_OK ){
8190482224
pVal = 0;
@@ -81958,10 +82278,17 @@
8195882278
assert( !ExprHasProperty(pExpr, EP_IntValue) );
8195982279
aff = sqlite3AffinityType(pExpr->u.zToken,0);
8196082280
rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
8196182281
testcase( rc!=SQLITE_OK );
8196282282
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
8196382290
sqlite3VdbeMemCast(*ppVal, aff, enc);
8196482291
sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
8196582292
}
8196682293
return rc;
8196782294
}
@@ -82804,14 +83131,14 @@
8280483131
** If the bPush flag is true, then make this opcode the parent for
8280583132
** subsequent Explains until sqlite3VdbeExplainPop() is called.
8280683133
*/
8280783134
SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
8280883135
int addr = 0;
82809
-#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
83136
+#if !defined(SQLITE_DEBUG)
8281083137
/* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
8281183138
** But omit them (for performance) during production builds */
82812
- if( pParse->explain==2 )
83139
+ if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
8281383140
#endif
8281483141
{
8281583142
char *zMsg;
8281683143
Vdbe *v;
8281783144
va_list ap;
@@ -83483,22 +83810,24 @@
8348383810
int addrLoop, /* Address of loop counter */
8348483811
int addrVisit, /* Address of rows visited counter */
8348583812
LogEst nEst, /* Estimated number of output rows */
8348683813
const char *zName /* Name of table or index being scanned */
8348783814
){
83488
- sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83489
- ScanStatus *aNew;
83490
- aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83491
- if( aNew ){
83492
- ScanStatus *pNew = &aNew[p->nScan++];
83493
- memset(pNew, 0, sizeof(ScanStatus));
83494
- pNew->addrExplain = addrExplain;
83495
- pNew->addrLoop = addrLoop;
83496
- pNew->addrVisit = addrVisit;
83497
- pNew->nEst = nEst;
83498
- pNew->zName = sqlite3DbStrDup(p->db, zName);
83499
- 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
+ }
8350083829
}
8350183830
}
8350283831
8350383832
/*
8350483833
** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83511,24 +83840,26 @@
8351183840
Vdbe *p,
8351283841
int addrExplain,
8351383842
int addrStart,
8351483843
int addrEnd
8351583844
){
83516
- ScanStatus *pScan = 0;
83517
- int ii;
83518
- for(ii=p->nScan-1; ii>=0; ii--){
83519
- pScan = &p->aScan[ii];
83520
- if( pScan->addrExplain==addrExplain ) break;
83521
- pScan = 0;
83522
- }
83523
- if( pScan ){
83524
- if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83525
- for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83526
- if( pScan->aAddrRange[ii]==0 ){
83527
- pScan->aAddrRange[ii] = addrStart;
83528
- pScan->aAddrRange[ii+1] = addrEnd;
83529
- 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
+ }
8353083861
}
8353183862
}
8353283863
}
8353383864
}
8353483865
@@ -83541,23 +83872,25 @@
8354183872
Vdbe *p,
8354283873
int addrExplain,
8354383874
int addrLoop,
8354483875
int addrVisit
8354583876
){
83546
- ScanStatus *pScan = 0;
83547
- int ii;
83548
- for(ii=p->nScan-1; ii>=0; ii--){
83549
- pScan = &p->aScan[ii];
83550
- if( pScan->addrExplain==addrExplain ) break;
83551
- pScan = 0;
83552
- }
83553
- if( pScan ){
83554
- pScan->addrLoop = addrLoop;
83555
- 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
+ }
8355683889
}
8355783890
}
83558
-#endif
83891
+#endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */
8355983892
8356083893
8356183894
/*
8356283895
** Change the value of the opcode, or P1, P2, P3, or P5 operands
8356383896
** for a specific instruction.
@@ -85681,10 +86014,12 @@
8568186014
db->nDeferredCons = 0;
8568286015
db->nDeferredImmCons = 0;
8568386016
db->flags &= ~(u64)SQLITE_DeferFKs;
8568486017
sqlite3CommitInternalChanges(db);
8568586018
}
86019
+ }else if( p->rc==SQLITE_SCHEMA && db->nVdbeActive>1 ){
86020
+ p->nChange = 0;
8568686021
}else{
8568786022
sqlite3RollbackAll(db, SQLITE_OK);
8568886023
p->nChange = 0;
8568986024
}
8569086025
db->nStatement = 0;
@@ -85999,13 +86334,13 @@
8599986334
vdbeFreeOpArray(db, p->aOp, p->nOp);
8600086335
if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
8600186336
#ifdef SQLITE_ENABLE_NORMALIZE
8600286337
sqlite3DbFree(db, p->zNormSql);
8600386338
{
86004
- DblquoteStr *pThis, *pNext;
86005
- for(pThis=p->pDblStr; pThis; pThis=pNext){
86006
- pNext = pThis->pNextStr;
86339
+ DblquoteStr *pThis, *pNxt;
86340
+ for(pThis=p->pDblStr; pThis; pThis=pNxt){
86341
+ pNxt = pThis->pNextStr;
8600786342
sqlite3DbFree(db, pThis);
8600886343
}
8600986344
}
8601086345
#endif
8601186346
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -87628,10 +87963,24 @@
8762887963
return 0;
8762987964
}
8763087965
return 1;
8763187966
}
8763287967
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
+
8763387982
#ifndef SQLITE_OMIT_VIRTUALTABLE
8763487983
/*
8763587984
** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
8763687985
** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
8763787986
** in memory obtained from sqlite3DbMalloc).
@@ -88014,11 +88363,11 @@
8801488363
SQLITE_NULL, /* 0x1d (not possible) */
8801588364
SQLITE_INTEGER, /* 0x1e (not possible) */
8801688365
SQLITE_NULL, /* 0x1f (not possible) */
8801788366
SQLITE_FLOAT, /* 0x20 INTREAL */
8801888367
SQLITE_NULL, /* 0x21 (not possible) */
88019
- SQLITE_TEXT, /* 0x22 INTREAL + TEXT */
88368
+ SQLITE_FLOAT, /* 0x22 INTREAL + TEXT */
8802088369
SQLITE_NULL, /* 0x23 (not possible) */
8802188370
SQLITE_FLOAT, /* 0x24 (not possible) */
8802288371
SQLITE_NULL, /* 0x25 (not possible) */
8802388372
SQLITE_FLOAT, /* 0x26 (not possible) */
8802488373
SQLITE_NULL, /* 0x27 (not possible) */
@@ -89881,19 +90230,28 @@
8988190230
int iScanStatusOp, /* Which metric to return */
8988290231
int flags,
8988390232
void *pOut /* OUT: Write the answer here */
8988490233
){
8988590234
Vdbe *p = (Vdbe*)pStmt;
89886
- ScanStatus *pScan;
90235
+ VdbeOp *aOp = p->aOp;
90236
+ int nOp = p->nOp;
90237
+ ScanStatus *pScan = 0;
8988790238
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
+ }
8988890246
8988990247
if( iScan<0 ){
8989090248
int ii;
8989190249
if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
8989290250
i64 res = 0;
89893
- for(ii=0; ii<p->nOp; ii++){
89894
- res += p->aOp[ii].nCycle;
90251
+ for(ii=0; ii<nOp; ii++){
90252
+ res += aOp[ii].nCycle;
8989590253
}
8989690254
*(i64*)pOut = res;
8989790255
return 0;
8989890256
}
8989990257
return 1;
@@ -89915,19 +90273,19 @@
8991590273
if( idx>=p->nScan ) return 1;
8991690274
8991790275
switch( iScanStatusOp ){
8991890276
case SQLITE_SCANSTAT_NLOOP: {
8991990277
if( pScan->addrLoop>0 ){
89920
- *(sqlite3_int64*)pOut = p->aOp[pScan->addrLoop].nExec;
90278
+ *(sqlite3_int64*)pOut = aOp[pScan->addrLoop].nExec;
8992190279
}else{
8992290280
*(sqlite3_int64*)pOut = -1;
8992390281
}
8992490282
break;
8992590283
}
8992690284
case SQLITE_SCANSTAT_NVISIT: {
8992790285
if( pScan->addrVisit>0 ){
89928
- *(sqlite3_int64*)pOut = p->aOp[pScan->addrVisit].nExec;
90286
+ *(sqlite3_int64*)pOut = aOp[pScan->addrVisit].nExec;
8992990287
}else{
8993090288
*(sqlite3_int64*)pOut = -1;
8993190289
}
8993290290
break;
8993390291
}
@@ -89945,27 +90303,27 @@
8994590303
*(const char**)pOut = pScan->zName;
8994690304
break;
8994790305
}
8994890306
case SQLITE_SCANSTAT_EXPLAIN: {
8994990307
if( pScan->addrExplain ){
89950
- *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
90308
+ *(const char**)pOut = aOp[ pScan->addrExplain ].p4.z;
8995190309
}else{
8995290310
*(const char**)pOut = 0;
8995390311
}
8995490312
break;
8995590313
}
8995690314
case SQLITE_SCANSTAT_SELECTID: {
8995790315
if( pScan->addrExplain ){
89958
- *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
90316
+ *(int*)pOut = aOp[ pScan->addrExplain ].p1;
8995990317
}else{
8996090318
*(int*)pOut = -1;
8996190319
}
8996290320
break;
8996390321
}
8996490322
case SQLITE_SCANSTAT_PARENTID: {
8996590323
if( pScan->addrExplain ){
89966
- *(int*)pOut = p->aOp[ pScan->addrExplain ].p2;
90324
+ *(int*)pOut = aOp[ pScan->addrExplain ].p2;
8996790325
}else{
8996890326
*(int*)pOut = -1;
8996990327
}
8997090328
break;
8997190329
}
@@ -89979,22 +90337,22 @@
8997990337
int iIns = pScan->aAddrRange[ii];
8998090338
int iEnd = pScan->aAddrRange[ii+1];
8998190339
if( iIns==0 ) break;
8998290340
if( iIns>0 ){
8998390341
while( iIns<=iEnd ){
89984
- res += p->aOp[iIns].nCycle;
90342
+ res += aOp[iIns].nCycle;
8998590343
iIns++;
8998690344
}
8998790345
}else{
8998890346
int iOp;
89989
- for(iOp=0; iOp<p->nOp; iOp++){
89990
- Op *pOp = &p->aOp[iOp];
90347
+ for(iOp=0; iOp<nOp; iOp++){
90348
+ Op *pOp = &aOp[iOp];
8999190349
if( pOp->p1!=iEnd ) continue;
8999290350
if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
8999390351
continue;
8999490352
}
89995
- res += p->aOp[iOp].nCycle;
90353
+ res += aOp[iOp].nCycle;
8999690354
}
8999790355
}
8999890356
}
8999990357
}
9000090358
*(i64*)pOut = res;
@@ -90913,12 +91271,14 @@
9091391271
if( p->flags & (MEM_Int|MEM_IntReal) ){
9091491272
h += p->u.i;
9091591273
}else if( p->flags & MEM_Real ){
9091691274
h += sqlite3VdbeIntValue(p);
9091791275
}else if( p->flags & (MEM_Str|MEM_Blob) ){
90918
- h += p->n;
90919
- if( p->flags & MEM_Zero ) h += p->u.nZero;
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 ){
@@ -104493,18 +104869,14 @@
104493104869
}
104494104870
sqlite3WalkExpr(pWalker, pExpr->pLeft);
104495104871
if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){
104496104872
testcase( ExprHasProperty(pExpr, EP_OuterON) );
104497104873
assert( !ExprHasProperty(pExpr, EP_IntValue) );
104498
- if( pExpr->op==TK_NOTNULL ){
104499
- pExpr->u.zToken = "true";
104500
- ExprSetProperty(pExpr, EP_IsTrue);
104501
- }else{
104502
- pExpr->u.zToken = "false";
104503
- ExprSetProperty(pExpr, EP_IsFalse);
104504
- }
104505
- pExpr->op = TK_TRUEFALSE;
104874
+ pExpr->u.iValue = (pExpr->op==TK_NOTNULL);
104875
+ pExpr->flags |= EP_IntValue;
104876
+ pExpr->op = TK_INTEGER;
104877
+
104506104878
for(i=0, p=pNC; p && i<ArraySize(anRef); p=p->pNext, i++){
104507104879
p->nRef = anRef[i];
104508104880
}
104509104881
sqlite3ExprDelete(pParse->db, pExpr->pLeft);
104510104882
pExpr->pLeft = 0;
@@ -104802,12 +105174,12 @@
104802105174
sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
104803105175
}
104804105176
assert( pNC->nRef>=nRef );
104805105177
if( nRef!=pNC->nRef ){
104806105178
ExprSetProperty(pExpr, EP_VarSelect);
104807
- pNC->ncFlags |= NC_VarSelect;
104808105179
}
105180
+ pNC->ncFlags |= NC_Subquery;
104809105181
}
104810105182
break;
104811105183
}
104812105184
case TK_VARIABLE: {
104813105185
testcase( pNC->ncFlags & NC_IsCheck );
@@ -105991,15 +106363,14 @@
105991106363
if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
105992106364
p = p->pLeft;
105993106365
}else{
105994106366
Expr *pNext = p->pRight;
105995106367
/* The Expr.x union is never used at the same time as Expr.pRight */
105996
- assert( ExprUseXList(p) );
105997
- assert( p->x.pList==0 || p->pRight==0 );
105998
- 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 ){
105999106370
int i;
106000
- for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){
106371
+ for(i=0; i<p->x.pList->nExpr; i++){
106001106372
if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
106002106373
pNext = p->x.pList->a[i].pExpr;
106003106374
break;
106004106375
}
106005106376
}
@@ -108363,11 +108734,11 @@
108363108734
108364108735
/*
108365108736
** pX is the RHS of an IN operator. If pX is a SELECT statement
108366108737
** that can be simplified to a direct table access, then return
108367108738
** a pointer to the SELECT statement. If pX is not a SELECT statement,
108368
-** 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
108369108740
** table, then return NULL.
108370108741
*/
108371108742
#ifndef SQLITE_OMIT_SUBQUERY
108372108743
static Select *isCandidateForInOpt(const Expr *pX){
108373108744
Select *p;
@@ -108649,11 +109020,10 @@
108649109020
Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
108650109021
Expr *pRhs = pEList->a[i].pExpr;
108651109022
CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
108652109023
int j;
108653109024
108654
- assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );
108655109025
for(j=0; j<nExpr; j++){
108656109026
if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
108657109027
assert( pIdx->azColl[j] );
108658109028
if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
108659109029
continue;
@@ -109552,10 +109922,11 @@
109552109922
Column *pCol, /* The generated column */
109553109923
int regOut /* Put the result in this register */
109554109924
){
109555109925
int iAddr;
109556109926
Vdbe *v = pParse->pVdbe;
109927
+ int nErr = pParse->nErr;
109557109928
assert( v!=0 );
109558109929
assert( pParse->iSelfTab!=0 );
109559109930
if( pParse->iSelfTab>0 ){
109560109931
iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109561109932
}else{
@@ -109564,10 +109935,11 @@
109564109935
sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109565109936
if( pCol->affinity>=SQLITE_AFF_TEXT ){
109566109937
sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109567109938
}
109568109939
if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
109940
+ if( pParse->nErr>nErr ) pParse->db->errByteOffset = -1;
109569109941
}
109570109942
#endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109571109943
109572109944
/*
109573109945
** Generate code to extract the value of the iCol-th column of a table.
@@ -109580,10 +109952,11 @@
109580109952
int regOut /* Extract the value into this register */
109581109953
){
109582109954
Column *pCol;
109583109955
assert( v!=0 );
109584109956
assert( pTab!=0 );
109957
+ assert( iCol!=XN_EXPR );
109585109958
if( iCol<0 || iCol==pTab->iPKey ){
109586109959
sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109587109960
VdbeComment((v, "%s.rowid", pTab->zName));
109588109961
}else{
109589109962
int op;
@@ -109846,17 +110219,28 @@
109846110219
int target /* Where to store the result of the expression */
109847110220
){
109848110221
IndexedExpr *p;
109849110222
Vdbe *v;
109850110223
for(p=pParse->pIdxEpr; p; p=p->pIENext){
110224
+ u8 exprAff;
109851110225
int iDataCur = p->iDataCur;
109852110226
if( iDataCur<0 ) continue;
109853110227
if( pParse->iSelfTab ){
109854110228
if( p->iDataCur!=pParse->iSelfTab-1 ) continue;
109855110229
iDataCur = -1;
109856110230
}
109857110231
if( sqlite3ExprCompare(0, pExpr, p->pExpr, iDataCur)!=0 ) continue;
110232
+ assert( p->aff>=SQLITE_AFF_BLOB && p->aff<=SQLITE_AFF_NUMERIC );
110233
+ exprAff = sqlite3ExprAffinity(pExpr);
110234
+ if( (exprAff<=SQLITE_AFF_BLOB && p->aff!=SQLITE_AFF_BLOB)
110235
+ || (exprAff==SQLITE_AFF_TEXT && p->aff!=SQLITE_AFF_TEXT)
110236
+ || (exprAff>=SQLITE_AFF_NUMERIC && p->aff!=SQLITE_AFF_NUMERIC)
110237
+ ){
110238
+ /* Affinity mismatch on a generated column */
110239
+ continue;
110240
+ }
110241
+
109858110242
v = pParse->pVdbe;
109859110243
assert( v!=0 );
109860110244
if( p->bMaybeNullRow ){
109861110245
/* If the index is on a NULL row due to an outer join, then we
109862110246
** cannot extract the value from the index. The value must be
@@ -109921,11 +110305,23 @@
109921110305
switch( op ){
109922110306
case TK_AGG_COLUMN: {
109923110307
AggInfo *pAggInfo = pExpr->pAggInfo;
109924110308
struct AggInfo_col *pCol;
109925110309
assert( pAggInfo!=0 );
109926
- 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
+ }
109927110323
pCol = &pAggInfo->aCol[pExpr->iAgg];
109928110324
if( !pAggInfo->directMode ){
109929110325
return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
109930110326
}else if( pAggInfo->useSortingIdx ){
109931110327
Table *pTab = pCol->pTab;
@@ -110096,15 +110492,12 @@
110096110492
return pExpr->iTable;
110097110493
}
110098110494
#ifndef SQLITE_OMIT_CAST
110099110495
case TK_CAST: {
110100110496
/* Expressions of the form: CAST(pLeft AS token) */
110101
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110102
- if( inReg!=target ){
110103
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110104
- inReg = target;
110105
- }
110497
+ sqlite3ExprCode(pParse, pExpr->pLeft, target);
110498
+ assert( inReg==target );
110106110499
assert( !ExprHasProperty(pExpr, EP_IntValue) );
110107110500
sqlite3VdbeAddOp2(v, OP_Cast, target,
110108110501
sqlite3AffinityType(pExpr->u.zToken, 0));
110109110502
return inReg;
110110110503
}
@@ -110432,21 +110825,20 @@
110432110825
case TK_BETWEEN: {
110433110826
exprCodeBetween(pParse, pExpr, target, 0, 0);
110434110827
return target;
110435110828
}
110436110829
case TK_COLLATE: {
110437
- if( !ExprHasProperty(pExpr, EP_Collate)
110438
- && ALWAYS(pExpr->pLeft)
110439
- && pExpr->pLeft->op==TK_FUNCTION
110440
- ){
110441
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110442
- if( inReg!=target ){
110443
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110444
- inReg = target;
110445
- }
110446
- sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg);
110447
- return inReg;
110830
+ if( !ExprHasProperty(pExpr, EP_Collate) ){
110831
+ /* A TK_COLLATE Expr node without the EP_Collate tag is a so-called
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;
110448110840
}else{
110449110841
pExpr = pExpr->pLeft;
110450110842
goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110451110843
}
110452110844
}
@@ -110543,20 +110935,23 @@
110543110935
target);
110544110936
inReg = target;
110545110937
break;
110546110938
}
110547110939
}
110548
- addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable);
110549
- /* Temporarily disable factoring of constant expressions, since
110550
- ** even though expressions may appear to be constant, they are not
110551
- ** really constant because they originate from the right-hand side
110552
- ** of a LEFT JOIN. */
110553
- pParse->okConstFactor = 0;
110554
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110940
+ addrINR = sqlite3VdbeAddOp3(v, OP_IfNullRow, pExpr->iTable, 0, target);
110941
+ /* The OP_IfNullRow opcode above can overwrite the result register with
110942
+ ** NULL. So we have to ensure that the result register is not a value
110943
+ ** that is suppose to be a constant. Two defenses are needed:
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 );
110555110951
pParse->okConstFactor = okConstFactor;
110556110952
sqlite3VdbeJumpHere(v, addrINR);
110557
- sqlite3VdbeChangeP3(v, addrINR, inReg);
110558110953
break;
110559110954
}
110560110955
110561110956
/*
110562110957
** Form A:
@@ -110789,11 +111184,13 @@
110789111184
assert( pParse->pVdbe!=0 || pParse->db->mallocFailed );
110790111185
if( pParse->pVdbe==0 ) return;
110791111186
inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);
110792111187
if( inReg!=target ){
110793111188
u8 op;
110794
- if( ALWAYS(pExpr) && ExprHasProperty(pExpr,EP_Subquery) ){
111189
+ if( ALWAYS(pExpr)
111190
+ && (ExprHasProperty(pExpr,EP_Subquery) || pExpr->op==TK_REGISTER)
111191
+ ){
110795111192
op = OP_Copy;
110796111193
}else{
110797111194
op = OP_SCopy;
110798111195
}
110799111196
sqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target);
@@ -111974,23 +112371,26 @@
111974112371
){
111975112372
AggInfo *pAggInfo = pExpr->pAggInfo;
111976112373
int iAgg = pExpr->iAgg;
111977112374
Parse *pParse = pWalker->pParse;
111978112375
sqlite3 *db = pParse->db;
112376
+ assert( iAgg>=0 );
111979112377
if( pExpr->op!=TK_AGG_FUNCTION ){
111980
- assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
111981
- if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
112378
+ if( ALWAYS(iAgg<pAggInfo->nColumn)
112379
+ && pAggInfo->aCol[iAgg].pCExpr==pExpr
112380
+ ){
111982112381
pExpr = sqlite3ExprDup(db, pExpr, 0);
111983112382
if( pExpr ){
111984112383
pAggInfo->aCol[iAgg].pCExpr = pExpr;
111985112384
sqlite3ExprDeferredDelete(pParse, pExpr);
111986112385
}
111987112386
}
111988112387
}else{
111989112388
assert( pExpr->op==TK_AGG_FUNCTION );
111990
- assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
111991
- if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
112389
+ if( ALWAYS(iAgg<pAggInfo->nFunc)
112390
+ && pAggInfo->aFunc[iAgg].pFExpr==pExpr
112391
+ ){
111992112392
pExpr = sqlite3ExprDup(db, pExpr, 0);
111993112393
if( pExpr ){
111994112394
pAggInfo->aFunc[iAgg].pFExpr = pExpr;
111995112395
sqlite3ExprDeferredDelete(pParse, pExpr);
111996112396
}
@@ -112136,11 +112536,16 @@
112136112536
if( iDataCur<0 ) continue;
112137112537
if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112138112538
}
112139112539
if( pIEpr==0 ) break;
112140112540
if( NEVER(!ExprUseYTab(pExpr)) ) break;
112141
- 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; }
112142112547
112143112548
/* If we reach this point, it means that expression pExpr can be
112144112549
** translated into a reference to an index column as described by
112145112550
** pIEpr.
112146112551
*/
@@ -112147,10 +112552,13 @@
112147112552
memset(&tmp, 0, sizeof(tmp));
112148112553
tmp.op = TK_AGG_COLUMN;
112149112554
tmp.iTable = pIEpr->iIdxCur;
112150112555
tmp.iColumn = pIEpr->iIdxCol;
112151112556
findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
112557
+ if( pParse->nErr ){ return WRC_Abort; }
112558
+ assert( pAggInfo->aCol!=0 );
112559
+ assert( tmp.iAgg<pAggInfo->nColumn );
112152112560
pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112153112561
pExpr->pAggInfo = pAggInfo;
112154112562
pExpr->iAgg = tmp.iAgg;
112155112563
return WRC_Prune;
112156112564
}
@@ -112323,10 +112731,41 @@
112323112731
SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112324112732
pParse->nTempReg = 0;
112325112733
pParse->nRangeReg = 0;
112326112734
}
112327112735
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
+
112328112767
/*
112329112768
** Validate that no temporary register falls within the range of
112330112769
** iFirst..iLast, inclusive. This routine is only call from within assert()
112331112770
** statements.
112332112771
*/
@@ -112341,10 +112780,18 @@
112341112780
}
112342112781
for(i=0; i<pParse->nTempReg; i++){
112343112782
if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112344112783
return 0;
112345112784
}
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
+ }
112346112793
}
112347112794
return 1;
112348112795
}
112349112796
#endif /* SQLITE_DEBUG */
112350112797
@@ -115625,15 +116072,19 @@
115625116072
int regTemp2 = iMem++; /* Second temporary use register */
115626116073
int regTabname = iMem++; /* Register containing table name */
115627116074
int regIdxname = iMem++; /* Register containing index name */
115628116075
int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
115629116076
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
115630116080
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
115631116081
Table *pStat1 = 0;
115632116082
#endif
115633116083
115634
- pParse->nMem = MAX(pParse->nMem, iMem);
116084
+ sqlite3TouchRegister(pParse, iMem);
116085
+ assert( sqlite3NoTempsInRange(pParse, regNewRowid, iMem) );
115635116086
v = sqlite3GetVdbe(pParse);
115636116087
if( v==0 || NEVER(pTab==0) ){
115637116088
return;
115638116089
}
115639116090
if( !IsOrdinaryTable(pTab) ){
@@ -115735,11 +116186,11 @@
115735116186
115736116187
/* Make sure there are enough memory cells allocated to accommodate
115737116188
** the regPrev array and a trailing rowid (the rowid slot is required
115738116189
** when building a record to insert into the sample column of
115739116190
** the sqlite_stat4 table. */
115740
- pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);
116191
+ sqlite3TouchRegister(pParse, regPrev+nColTest);
115741116192
115742116193
/* Open a read-only cursor on the index being analyzed. */
115743116194
assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
115744116195
sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
115745116196
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115907,11 +116358,39 @@
115907116358
int regSampleRowid = regCol + nCol;
115908116359
int addrNext;
115909116360
int addrIsNull;
115910116361
u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
115911116362
115912
- 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) );
115913116392
115914116393
addrNext = sqlite3VdbeCurrentAddr(v);
115915116394
callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
115916116395
addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
115917116396
VdbeCoverage(v);
@@ -115988,10 +116467,15 @@
115988116467
iTab = pParse->nTab;
115989116468
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
115990116469
for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
115991116470
Table *pTab = (Table*)sqliteHashData(k);
115992116471
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
115993116477
}
115994116478
loadAnalysis(pParse, iDb);
115995116479
}
115996116480
115997116481
/*
@@ -118915,11 +119399,11 @@
118915119399
Hash *pHash;
118916119400
sqlite3 *db = pParse->db;
118917119401
if( pParse->pNewTrigger ){
118918119402
sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
118919119403
}else{
118920
- assert( pParse->bReturning==0 );
119404
+ assert( pParse->bReturning==0 || pParse->ifNotExists );
118921119405
}
118922119406
pParse->bReturning = 1;
118923119407
pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
118924119408
if( pRet==0 ){
118925119409
sqlite3ExprListDelete(db, pList);
@@ -118941,11 +119425,12 @@
118941119425
pRet->retTrig.step_list = &pRet->retTStep;
118942119426
pRet->retTStep.op = TK_RETURNING;
118943119427
pRet->retTStep.pTrig = &pRet->retTrig;
118944119428
pRet->retTStep.pExprList = pList;
118945119429
pHash = &(db->aDb[1].pSchema->trigHash);
118946
- assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
119430
+ assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0
119431
+ || pParse->nErr || pParse->ifNotExists );
118947119432
if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
118948119433
==&pRet->retTrig ){
118949119434
sqlite3OomFault(db);
118950119435
}
118951119436
}
@@ -119476,10 +119961,11 @@
119476119961
** just a reference to another column, in order for covering index
119477119962
** optimizations to work correctly. So if the value is not an expression,
119478119963
** turn it into one by adding a unary "+" operator. */
119479119964
pExpr = sqlite3PExpr(pParse, TK_UPLUS, pExpr, 0);
119480119965
}
119966
+ if( pExpr && pExpr->op!=TK_RAISE ) pExpr->affExpr = pCol->affinity;
119481119967
sqlite3ColumnSetExpr(pParse, pTab, pCol, pExpr);
119482119968
pExpr = 0;
119483119969
goto generated_done;
119484119970
119485119971
generated_error:
@@ -123813,17 +124299,19 @@
123813124299
**
123814124300
** If pTab is not writable -> generate an error message and return 1.
123815124301
** If pTab is writable but other errors have occurred -> return 1.
123816124302
** If pTab is writable and no prior errors -> return 0;
123817124303
*/
123818
-SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
124304
+SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, Trigger *pTrigger){
123819124305
if( tabIsReadOnly(pParse, pTab) ){
123820124306
sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
123821124307
return 1;
123822124308
}
123823124309
#ifndef SQLITE_OMIT_VIEW
123824
- if( !viewOk && IsView(pTab) ){
124310
+ if( IsView(pTab)
124311
+ && (pTrigger==0 || (pTrigger->bReturning && pTrigger->pNext==0))
124312
+ ){
123825124313
sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
123826124314
return 1;
123827124315
}
123828124316
#endif
123829124317
return 0;
@@ -124073,11 +124561,11 @@
124073124561
*/
124074124562
if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124075124563
goto delete_from_cleanup;
124076124564
}
124077124565
124078
- if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
124566
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
124079124567
goto delete_from_cleanup;
124080124568
}
124081124569
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124082124570
assert( iDb<db->nDb );
124083124571
rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -124182,11 +124670,11 @@
124182124670
}
124183124671
}else
124184124672
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124185124673
{
124186124674
u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124187
- if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
124675
+ if( sNC.ncFlags & NC_Subquery ) bComplex = 1;
124188124676
wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124189124677
if( HasRowid(pTab) ){
124190124678
/* For a rowid table, initialize the RowSet to an empty set */
124191124679
pPk = 0;
124192124680
nPk = 1;
@@ -126878,10 +127366,22 @@
126878127366
** unable to take a pointer to these functions. Hence, we here wrap them
126879127367
** in our own actual functions.
126880127368
*/
126881127369
static double xCeil(double x){ return ceil(x); }
126882127370
static double xFloor(double x){ return floor(x); }
127371
+
127372
+/*
127373
+** Some systems do not have log2() and log10() in their standard math
127374
+** libraries.
127375
+*/
127376
+#if defined(HAVE_LOG10) && HAVE_LOG10==0
127377
+# define log10(X) (0.4342944819032517867*log(X))
127378
+#endif
127379
+#if defined(HAVE_LOG2) && HAVE_LOG2==0
127380
+# define log2(X) (1.442695040888963456*log(X))
127381
+#endif
127382
+
126883127383
126884127384
/*
126885127385
** Implementation of SQL functions:
126886127386
**
126887127387
** ln(X) - natural logarithm
@@ -128758,49 +129258,51 @@
128758129258
**
128759129259
** Memory for the buffer containing the column index affinity string
128760129260
** is managed along with the rest of the Index structure. It will be
128761129261
** released when sqlite3DeleteIndex() is called.
128762129262
*/
128763
-SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
128764
- if( !pIdx->zColAff ){
128765
- /* The first time a column affinity string for a particular index is
128766
- ** required, it is allocated and populated here. It is then stored as
128767
- ** a member of the Index structure for subsequent use.
128768
- **
128769
- ** The column affinity string will eventually be deleted by
128770
- ** sqliteDeleteIndex() when the Index structure itself is cleaned
128771
- ** up.
128772
- */
128773
- int n;
128774
- Table *pTab = pIdx->pTable;
128775
- pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
128776
- if( !pIdx->zColAff ){
128777
- sqlite3OomFault(db);
128778
- return 0;
128779
- }
128780
- for(n=0; n<pIdx->nColumn; n++){
128781
- i16 x = pIdx->aiColumn[n];
128782
- char aff;
128783
- if( x>=0 ){
128784
- aff = pTab->aCol[x].affinity;
128785
- }else if( x==XN_ROWID ){
128786
- aff = SQLITE_AFF_INTEGER;
128787
- }else{
128788
- assert( x==XN_EXPR );
128789
- assert( pIdx->bHasExpr );
128790
- assert( pIdx->aColExpr!=0 );
128791
- aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
128792
- }
128793
- if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
128794
- if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
128795
- pIdx->zColAff[n] = aff;
128796
- }
128797
- pIdx->zColAff[n] = 0;
128798
- }
128799
-
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);
128800129301
return pIdx->zColAff;
128801129302
}
129303
+
128802129304
128803129305
/*
128804129306
** Compute an affinity string for a table. Space is obtained
128805129307
** from sqlite3DbMalloc(). The caller is responsible for freeing
128806129308
** the space when done.
@@ -129482,11 +129984,11 @@
129482129984
goto insert_cleanup;
129483129985
}
129484129986
129485129987
/* Cannot insert into a read-only table.
129486129988
*/
129487
- if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
129989
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
129488129990
goto insert_cleanup;
129489129991
}
129490129992
129491129993
/* Allocate a VDBE
129492129994
*/
@@ -129929,11 +130431,11 @@
129929130431
sqlite3VdbeJumpHere(v, addr1);
129930130432
sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
129931130433
}
129932130434
129933130435
/* Copy the new data already generated. */
129934
- assert( pTab->nNVCol>0 );
130436
+ assert( pTab->nNVCol>0 || pParse->nErr>0 );
129935130437
sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
129936130438
129937130439
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
129938130440
/* Compute the new value for generated columns after all other
129939130441
** columns have already been computed. This must be done after
@@ -133292,19 +133794,25 @@
133292133794
zEntry = zProc ? zProc : "sqlite3_extension_init";
133293133795
133294133796
/* tag-20210611-1. Some dlopen() implementations will segfault if given
133295133797
** an oversize filename. Most filesystems have a pathname limit of 4K,
133296133798
** so limit the extension filename length to about twice that.
133297
- ** 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
+ */
133298133804
if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133299133805
133300133806
handle = sqlite3OsDlOpen(pVfs, zFile);
133301133807
#if SQLITE_OS_UNIX || SQLITE_OS_WIN
133302133808
for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133303133809
char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133304133810
if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133305
- handle = sqlite3OsDlOpen(pVfs, zAltFile);
133811
+ if( nMsg+strlen(azEndings[ii])+1<=SQLITE_MAX_PATHLEN ){
133812
+ handle = sqlite3OsDlOpen(pVfs, zAltFile);
133813
+ }
133306133814
sqlite3_free(zAltFile);
133307133815
}
133308133816
#endif
133309133817
if( handle==0 ) goto extension_not_found;
133310133818
xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135795,11 +136303,11 @@
135795136303
if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
135796136304
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135797136305
zDb = db->aDb[iDb].zDbSName;
135798136306
sqlite3CodeVerifySchema(pParse, iDb);
135799136307
sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
135800
- if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
136308
+ sqlite3TouchRegister(pParse, pTab->nCol+regRow);
135801136309
sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
135802136310
sqlite3VdbeLoadString(v, regResult, pTab->zName);
135803136311
assert( IsOrdinaryTable(pTab) );
135804136312
for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
135805136313
pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135836,11 +136344,11 @@
135836136344
135837136345
/* Generate code to read the child key values into registers
135838136346
** regRow..regRow+n. If any of the child key values are NULL, this
135839136347
** row cannot cause an FK violation. Jump directly to addrOk in
135840136348
** this case. */
135841
- if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol;
136349
+ sqlite3TouchRegister(pParse, regRow + pFK->nCol);
135842136350
for(j=0; j<pFK->nCol; j++){
135843136351
int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
135844136352
sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
135845136353
sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
135846136354
}
@@ -135965,10 +136473,11 @@
135965136473
135966136474
if( OMIT_TEMPDB && i==1 ) continue;
135967136475
if( iDb>=0 && i!=iDb ) continue;
135968136476
135969136477
sqlite3CodeVerifySchema(pParse, i);
136478
+ pParse->okConstFactor = 0; /* tag-20230327-1 */
135970136479
135971136480
/* Do an integrity check of the B-Tree
135972136481
**
135973136482
** Begin by finding the root pages numbers
135974136483
** for all tables and indices in the database.
@@ -136000,11 +136509,11 @@
136000136509
}
136001136510
}
136002136511
aRoot[0] = cnt;
136003136512
136004136513
/* Make sure sufficient number of registers have been allocated */
136005
- pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
136514
+ sqlite3TouchRegister(pParse, 8+mxIdx);
136006136515
sqlite3ClearTempRegCache(pParse);
136007136516
136008136517
/* Do the b-tree integrity checks */
136009136518
sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136010136519
sqlite3VdbeChangeP5(v, (u8)i);
@@ -136150,19 +136659,33 @@
136150136659
136151136660
labelError = sqlite3VdbeMakeLabel(pParse);
136152136661
labelOk = sqlite3VdbeMakeLabel(pParse);
136153136662
if( pCol->notNull ){
136154136663
/* (1) NOT NULL columns may not contain a NULL */
136664
+ int jmp3;
136155136665
int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
136156
- sqlite3VdbeChangeP5(v, 0x0f);
136157136666
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
+ }
136158136680
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136159136681
pCol->zCnName);
136160136682
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136161136683
if( doTypeCheck ){
136162136684
sqlite3VdbeGoto(v, labelError);
136163136685
sqlite3VdbeJumpHere(v, jmp2);
136686
+ sqlite3VdbeJumpHere(v, jmp3);
136164136687
}else{
136165136688
/* VDBE byte code will fall thru */
136166136689
}
136167136690
}
136168136691
if( bStrict && doTypeCheck ){
@@ -136257,10 +136780,27 @@
136257136780
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
136258136781
jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
136259136782
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
136260136783
jmp4 = integrityCheckResultRow(v);
136261136784
sqlite3VdbeJumpHere(v, jmp2);
136785
+
136786
+ /* The OP_IdxRowid opcode is an optimized version of OP_Column
136787
+ ** that extracts the rowid off the end of the index record.
136788
+ ** But it only works correctly if index record does not have
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);
136800
+ sqlite3VdbeJumpHere(v, jmp7);
136801
+ }
136262136802
136263136803
/* Any indexed columns with non-BINARY collations must still hold
136264136804
** the exact same text value as the table. */
136265136805
label6 = 0;
136266136806
for(kk=0; kk<pIdx->nKeyCol; kk++){
@@ -140553,12 +141093,10 @@
140553141093
p = a[i].pExpr;
140554141094
/* pCol->szEst = ... // Column size est for SELECT tables never used */
140555141095
pCol->affinity = sqlite3ExprAffinity(p);
140556141096
if( pCol->affinity<=SQLITE_AFF_NONE ){
140557141097
pCol->affinity = aff;
140558
- }else if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){
140559
- pCol->affinity = SQLITE_AFF_FLEXNUM;
140560141098
}
140561141099
if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){
140562141100
int m = 0;
140563141101
Select *pS2;
140564141102
for(m=0, pS2=pSelect->pNext; pS2; pS2=pS2->pNext){
@@ -140567,10 +141105,13 @@
140567141105
if( pCol->affinity==SQLITE_AFF_TEXT && (m&0x01)!=0 ){
140568141106
pCol->affinity = SQLITE_AFF_BLOB;
140569141107
}else
140570141108
if( pCol->affinity>=SQLITE_AFF_NUMERIC && (m&0x02)!=0 ){
140571141109
pCol->affinity = SQLITE_AFF_BLOB;
141110
+ }
141111
+ if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){
141112
+ pCol->affinity = SQLITE_AFF_FLEXNUM;
140572141113
}
140573141114
}
140574141115
zType = columnType(&sNC, p, 0, 0, 0);
140575141116
if( zType==0 || pCol->affinity!=sqlite3AffinityType(zType, 0) ){
140576141117
if( pCol->affinity==SQLITE_AFF_NUMERIC
@@ -142082,11 +142623,13 @@
142082142623
assert( pExpr->pRight==0 );
142083142624
if( sqlite3ExprIsVector(pCopy) ){
142084142625
sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142085142626
}else{
142086142627
sqlite3 *db = pSubst->pParse->db;
142087
- if( pSubst->isOuterJoin && pCopy->op!=TK_COLUMN ){
142628
+ if( pSubst->isOuterJoin
142629
+ && (pCopy->op!=TK_COLUMN || pCopy->iTable!=pSubst->iNewTable)
142630
+ ){
142088142631
memset(&ifNullRow, 0, sizeof(ifNullRow));
142089142632
ifNullRow.op = TK_IF_NULL_ROW;
142090142633
ifNullRow.pLeft = pCopy;
142091142634
ifNullRow.iTable = pSubst->iNewTable;
142092142635
ifNullRow.iColumn = -99;
@@ -142459,12 +143002,11 @@
142459143002
** (17f) the subquery must not be the RHS of a LEFT JOIN.
142460143003
** (17g) either the subquery is the first element of the outer
142461143004
** query or there are no RIGHT or FULL JOINs in any arm
142462143005
** of the subquery. (This is a duplicate of condition (27b).)
142463143006
** (17h) The corresponding result set expressions in all arms of the
142464
-** compound must have the same affinity. (See restriction (9)
142465
-** on the push-down optimization.)
143007
+** compound must have the same affinity.
142466143008
**
142467143009
** The parent and sub-query may contain WHERE clauses. Subject to
142468143010
** rules (11), (13) and (14), they may also contain ORDER BY,
142469143011
** LIMIT and OFFSET clauses. The subquery cannot use any compound
142470143012
** operator other than UNION ALL because all the other compound
@@ -143328,14 +143870,10 @@
143328143870
**
143329143871
** (8) If the subquery is a compound that uses UNION, INTERSECT,
143330143872
** or EXCEPT, then all of the result set columns for all arms of
143331143873
** the compound must use the BINARY collating sequence.
143332143874
**
143333
-** (9) If the subquery is a compound, then all arms of the compound must
143334
-** have the same affinity. (This is the same as restriction (17h)
143335
-** for query flattening.)
143336
-**
143337143875
**
143338143876
** Return 0 if no changes are made and non-zero if one or more WHERE clause
143339143877
** terms are duplicated into the subquery.
143340143878
*/
143341143879
static int pushDownWhereTerms(
@@ -143362,13 +143900,10 @@
143362143900
}
143363143901
#ifndef SQLITE_OMIT_WINDOWFUNC
143364143902
if( pSel->pWin ) return 0; /* restriction (6b) */
143365143903
#endif
143366143904
}
143367
- if( compoundHasDifferentAffinities(pSubq) ){
143368
- return 0; /* restriction (9) */
143369
- }
143370143905
if( notUnionAll ){
143371143906
/* If any of the compound arms are connected using UNION, INTERSECT,
143372143907
** or EXCEPT, then we must ensure that none of the columns use a
143373143908
** non-BINARY collating sequence. */
143374143909
for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143455,10 +143990,80 @@
143455143990
}
143456143991
}
143457143992
return nChng;
143458143993
}
143459143994
#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
+
143460144065
143461144066
/*
143462144067
** The pFunc is the only aggregate function in the query. Check to see
143463144068
** if the query is a candidate for the min/max optimization.
143464144069
**
@@ -144598,14 +145203,16 @@
144598145203
Select *pSelect, /* The SELECT statement being processed */
144599145204
AggInfo *pAggInfo, /* The aggregate info */
144600145205
NameContext *pNC /* Name context used to resolve agg-func args */
144601145206
){
144602145207
assert( pAggInfo->iFirstReg==0 );
145208
+ assert( pSelect!=0 );
145209
+ assert( pSelect->pGroupBy!=0 );
144603145210
pAggInfo->nColumn = pAggInfo->nAccumulator;
144604145211
if( ALWAYS(pAggInfo->nSortingColumn>0) ){
144605145212
if( pAggInfo->nColumn==0 ){
144606
- pAggInfo->nSortingColumn = 0;
145213
+ pAggInfo->nSortingColumn = pSelect->pGroupBy->nExpr;
144607145214
}else{
144608145215
pAggInfo->nSortingColumn =
144609145216
pAggInfo->aCol[pAggInfo->nColumn-1].iSorterColumn+1;
144610145217
}
144611145218
}
@@ -144639,15 +145246,17 @@
144639145246
if( pExpr->pAggInfo==0 ) return WRC_Continue;
144640145247
if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
144641145248
if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
144642145249
if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
144643145250
pAggInfo = pExpr->pAggInfo;
144644
- assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
145251
+ if( NEVER(pExpr->iAgg>=pAggInfo->nColumn) ) return WRC_Continue;
145252
+ assert( pExpr->iAgg>=0 );
144645145253
pCol = &pAggInfo->aCol[pExpr->iAgg];
144646145254
pExpr->op = TK_AGG_COLUMN;
144647145255
pExpr->iTable = pCol->iTable;
144648145256
pExpr->iColumn = pCol->iColumn;
145257
+ ExprClearProperty(pExpr, EP_Skip|EP_Collate);
144649145258
return WRC_Prune;
144650145259
}
144651145260
144652145261
/*
144653145262
** Convert every pAggInfo->aFunc[].pExpr such that any node within
@@ -144997,11 +145606,10 @@
144997145606
sqlite3DbFree(db, p->aCol);
144998145607
sqlite3DbFree(db, p->aFunc);
144999145608
sqlite3DbFreeNN(db, p);
145000145609
}
145001145610
145002
-#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145003145611
/*
145004145612
** Attempt to transform a query of the form
145005145613
**
145006145614
** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145007145615
**
@@ -145025,11 +145633,13 @@
145025145633
Expr *pCount;
145026145634
sqlite3 *db;
145027145635
if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145028145636
if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145029145637
if( p->pWhere ) return 0;
145638
+ if( p->pHaving ) return 0;
145030145639
if( p->pGroupBy ) return 0;
145640
+ if( p->pOrderBy ) return 0;
145031145641
pExpr = p->pEList->a[0].pExpr;
145032145642
if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145033145643
assert( ExprUseUToken(pExpr) );
145034145644
if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */
145035145645
assert( ExprUseXList(pExpr) );
@@ -145036,17 +145646,19 @@
145036145646
if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */
145037145647
if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */
145038145648
if( ExprHasProperty(pExpr, EP_WinFunc) ) return 0;/* Not a window function */
145039145649
pSub = p->pSrc->a[0].pSelect;
145040145650
if( pSub==0 ) return 0; /* The FROM is a subquery */
145041
- if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */
145651
+ if( pSub->pPrior==0 ) return 0; /* Must be a compound */
145652
+ if( pSub->selFlags & SF_CopyCte ) return 0; /* Not a CTE */
145042145653
do{
145043145654
if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145044145655
if( pSub->pWhere ) return 0; /* No WHERE clause */
145045145656
if( pSub->pLimit ) return 0; /* No LIMIT clause */
145046145657
if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145047
- pSub = pSub->pPrior; /* Repeat over compound */
145658
+ assert( pSub->pHaving==0 ); /* Due to the previous */
145659
+ pSub = pSub->pPrior; /* Repeat over compound */
145048145660
}while( pSub );
145049145661
145050145662
/* If we reach this point then it is OK to perform the transformation */
145051145663
145052145664
db = pParse->db;
@@ -145085,11 +145697,10 @@
145085145697
sqlite3TreeViewSelect(0, p, 0);
145086145698
}
145087145699
#endif
145088145700
return 1;
145089145701
}
145090
-#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
145091145702
145092145703
/*
145093145704
** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145094145705
** as pSrcItem but has the same alias as p0, then return true.
145095145706
** Otherwise return false.
@@ -145474,19 +146085,16 @@
145474146085
#endif
145475146086
}else{
145476146087
TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
145477146088
}
145478146089
145479
-#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145480146090
if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
145481146091
&& countOfViewOptimization(pParse, p)
145482146092
){
145483146093
if( db->mallocFailed ) goto select_end;
145484
- pEList = p->pEList;
145485146094
pTabList = p->pSrc;
145486146095
}
145487
-#endif
145488146096
145489146097
/* For each term in the FROM clause, do two things:
145490146098
** (1) Authorized unreferenced tables
145491146099
** (2) Generate code for all sub-queries
145492146100
*/
@@ -145554,10 +146162,26 @@
145554146162
#endif
145555146163
assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
145556146164
}else{
145557146165
TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
145558146166
}
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
+ }
145559146183
145560146184
zSavedAuthContext = pParse->zAuthContext;
145561146185
pParse->zAuthContext = pItem->zName;
145562146186
145563146187
/* Generate code to implement the subquery
@@ -146841,10 +147465,11 @@
146841147465
if( !noErr ){
146842147466
sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
146843147467
}else{
146844147468
assert( !db->init.busy );
146845147469
sqlite3CodeVerifySchema(pParse, iDb);
147470
+ VVA_ONLY( pParse->ifNotExists = 1; )
146846147471
}
146847147472
goto trigger_cleanup;
146848147473
}
146849147474
}
146850147475
@@ -147622,11 +148247,11 @@
147622148247
assert( db->mallocFailed==0 );
147623148248
sqlite3GenerateColumnNames(pParse, &sSelect);
147624148249
}
147625148250
sqlite3ExprListDelete(db, sSelect.pEList);
147626148251
pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
147627
- if( !db->mallocFailed ){
148252
+ if( pParse->nErr==0 ){
147628148253
NameContext sNC;
147629148254
memset(&sNC, 0, sizeof(sNC));
147630148255
if( pReturning->nRetCol==0 ){
147631148256
pReturning->nRetCol = pNew->nExpr;
147632148257
pReturning->iRetCur = pParse->nTab++;
@@ -148091,10 +148716,13 @@
148091148716
const int op = pChanges ? TK_UPDATE : TK_DELETE;
148092148717
u32 mask = 0;
148093148718
Trigger *p;
148094148719
148095148720
assert( isNew==1 || isNew==0 );
148721
+ if( IsView(pTab) ){
148722
+ return 0xffffffff;
148723
+ }
148096148724
for(p=pTrigger; p; p=p->pNext){
148097148725
if( p->op==op
148098148726
&& (tr_tm&p->tr_tm)
148099148727
&& checkColumnOverlap(p->pColumns,pChanges)
148100148728
){
@@ -148525,11 +149153,11 @@
148525149153
#endif
148526149154
148527149155
if( sqlite3ViewGetColumnNames(pParse, pTab) ){
148528149156
goto update_cleanup;
148529149157
}
148530
- if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
149158
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
148531149159
goto update_cleanup;
148532149160
}
148533149161
148534149162
/* Allocate a cursors for the main database table and for all indices.
148535149163
** The index cursors might not be used, but if they are used they
@@ -148844,16 +149472,26 @@
148844149472
bFinishSeek = 0;
148845149473
}else{
148846149474
/* Begin the database scan.
148847149475
**
148848149476
** Do not consider a single-pass strategy for a multi-row update if
148849
- ** there are any triggers or foreign keys to process, or rows may
148850
- ** be deleted as a result of REPLACE conflict handling. Any of these
148851
- ** things might disturb a cursor being used to scan through the table
148852
- ** 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
+ */
148853149485
flags = WHERE_ONEPASS_DESIRED;
148854
- 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
+ ){
148855149493
flags |= WHERE_ONEPASS_MULTIROW;
148856149494
}
148857149495
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
148858149496
if( pWInfo==0 ) goto update_cleanup;
148859149497
@@ -150814,11 +151452,13 @@
150814151452
sCtx.pTab = pTab;
150815151453
sCtx.pVTable = pVTable;
150816151454
sCtx.pPrior = db->pVtabCtx;
150817151455
sCtx.bDeclared = 0;
150818151456
db->pVtabCtx = &sCtx;
151457
+ pTab->nTabRef++;
150819151458
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
151459
+ sqlite3DeleteTable(db, pTab);
150820151460
db->pVtabCtx = sCtx.pPrior;
150821151461
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
150822151462
assert( sCtx.pTab==pTab );
150823151463
150824151464
if( SQLITE_OK!=rc ){
@@ -151532,10 +152172,14 @@
151532152172
break;
151533152173
}
151534152174
case SQLITE_VTAB_DIRECTONLY: {
151535152175
p->pVTable->eVtabRisk = SQLITE_VTABRISK_High;
151536152176
break;
152177
+ }
152178
+ case SQLITE_VTAB_USES_ALL_SCHEMAS: {
152179
+ p->pVTable->bAllSchemas = 1;
152180
+ break;
151537152181
}
151538152182
default: {
151539152183
rc = SQLITE_MISUSE_BKPT;
151540152184
break;
151541152185
}
@@ -152306,13 +152950,13 @@
152306152950
sqlite3_str_append(pStr, ")", 1);
152307152951
}
152308152952
152309152953
/*
152310152954
** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152311
-** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
152312
-** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
152313
-** 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.
152314152958
**
152315152959
** If an OP_Explain opcode is added to the VM, its address is returned.
152316152960
** Otherwise, if no OP_Explain is coded, zero is returned.
152317152961
*/
152318152962
SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152320,12 +152964,12 @@
152320152964
SrcList *pTabList, /* Table list this loop refers to */
152321152965
WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152322152966
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152323152967
){
152324152968
int ret = 0;
152325
-#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
152326
- if( sqlite3ParseToplevel(pParse)->explain==2 )
152969
+#if !defined(SQLITE_DEBUG)
152970
+ if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
152327152971
#endif
152328152972
{
152329152973
SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152330152974
Vdbe *v = pParse->pVdbe; /* VM being constructed */
152331152975
sqlite3 *db = pParse->db; /* Database handle */
@@ -152487,31 +153131,33 @@
152487153131
Vdbe *v, /* Vdbe to add scanstatus entry to */
152488153132
SrcList *pSrclist, /* FROM clause pLvl reads data from */
152489153133
WhereLevel *pLvl, /* Level to add scanstatus() entry for */
152490153134
int addrExplain /* Address of OP_Explain (or 0) */
152491153135
){
152492
- const char *zObj = 0;
152493
- WhereLoop *pLoop = pLvl->pWLoop;
152494
- int wsFlags = pLoop->wsFlags;
152495
- int viaCoroutine = 0;
152496
-
152497
- if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152498
- zObj = pLoop->u.btree.pIndex->zName;
152499
- }else{
152500
- zObj = pSrclist->a[pLvl->iFrom].zName;
152501
- viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152502
- }
152503
- sqlite3VdbeScanStatus(
152504
- v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152505
- );
152506
-
152507
- if( viaCoroutine==0 ){
152508
- if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152509
- sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152510
- }
152511
- if( wsFlags & WHERE_INDEXED ){
152512
- 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
+ }
152513153159
}
152514153160
}
152515153161
}
152516153162
#endif
152517153163
@@ -153204,31 +153850,29 @@
153204153850
** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into
153205153851
** an access of the index rather than the original table.
153206153852
*/
153207153853
static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
153208153854
int rc = WRC_Continue;
153855
+ int reg;
153209153856
struct CCurHint *pHint = pWalker->u.pCCurHint;
153210153857
if( pExpr->op==TK_COLUMN ){
153211153858
if( pExpr->iTable!=pHint->iTabCur ){
153212
- int reg = ++pWalker->pParse->nMem; /* Register for column value */
153213
- sqlite3ExprCode(pWalker->pParse, pExpr, reg);
153859
+ reg = ++pWalker->pParse->nMem; /* Register for column value */
153860
+ reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
153214153861
pExpr->op = TK_REGISTER;
153215153862
pExpr->iTable = reg;
153216153863
}else if( pHint->pIdx!=0 ){
153217153864
pExpr->iTable = pHint->iIdxCur;
153218153865
pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn);
153219153866
assert( pExpr->iColumn>=0 );
153220153867
}
153221
- }else if( pExpr->op==TK_AGG_FUNCTION ){
153222
- /* An aggregate function in the WHERE clause of a query means this must
153223
- ** be a correlated sub-query, and expression pExpr is an aggregate from
153224
- ** the parent context. Do not walk the function arguments in this case.
153225
- **
153226
- ** todo: It should be possible to replace this node with a TK_REGISTER
153227
- ** expression, as the result of the expression must be stored in a
153228
- ** register at this point. The same holds for TK_AGG_COLUMN nodes. */
153868
+ }else if( pExpr->pAggInfo ){
153229153869
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;
153230153874
}
153231153875
return rc;
153232153876
}
153233153877
153234153878
/*
@@ -154120,11 +154764,11 @@
154120154764
** of entries in the tree, so basing the number of steps to try
154121154765
** on the estimated number of rows in the btree seems like a good
154122154766
** guess. */
154123154767
addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154124154768
(pIdx->aiRowLogEst[0]+9)/10);
154125
- if( pRangeStart ){
154769
+ if( pRangeStart || pRangeEnd ){
154126154770
sqlite3VdbeChangeP5(v, 1);
154127154771
sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154128154772
addrSeekScan = 0;
154129154773
}
154130154774
VdbeCoverage(v);
@@ -154161,20 +154805,11 @@
154161154805
*/
154162154806
nConstraint = nEq;
154163154807
assert( pLevel->p2==0 );
154164154808
if( pRangeEnd ){
154165154809
Expr *pRight = pRangeEnd->pExpr->pRight;
154166
- if( addrSeekScan ){
154167
- /* For a seek-scan that has a range on the lowest term of the index,
154168
- ** we have to make the top of the loop be code that sets the end
154169
- ** condition of the range. Otherwise, the OP_SeekScan might jump
154170
- ** over that initialization, leaving the range-end value set to the
154171
- ** range-start value, resulting in a wrong answer.
154172
- ** See ticket 5981a8c041a3c2f3 (2021-11-02).
154173
- */
154174
- pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154175
- }
154810
+ assert( addrSeekScan==0 );
154176154811
codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154177154812
whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154178154813
if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154179154814
&& sqlite3ExprCanBeNull(pRight)
154180154815
){
@@ -154204,11 +154839,11 @@
154204154839
}
154205154840
if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154206154841
if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154207154842
154208154843
/* Top of the loop body */
154209
- if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154844
+ pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154210154845
154211154846
/* Check if the index cursor is past the end of the range. */
154212154847
if( nConstraint ){
154213154848
if( regBignull ){
154214154849
/* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156846,13 +157481,16 @@
156846157481
pColRef->y.pTab = pTab;
156847157482
pItem->colUsed |= sqlite3ExprColUsed(pColRef);
156848157483
pRhs = sqlite3PExpr(pParse, TK_UPLUS,
156849157484
sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
156850157485
pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
156851
- if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ) ){
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 */
156852157489
joinType = EP_OuterON;
156853157490
}else{
157491
+ testcase( pItem->fg.jointype & JT_LTORJ ); /* testtag-20230227c */
156854157492
joinType = EP_InnerON;
156855157493
}
156856157494
sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
156857157495
whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
156858157496
}
@@ -157691,11 +158329,11 @@
157691158329
Parse *pParse,
157692158330
Index *pIdx, /* Automatic index to explain */
157693158331
int bPartial, /* True if pIdx is a partial index */
157694158332
int *pAddrExplain /* OUT: Address of OP_Explain */
157695158333
){
157696
- if( pParse->explain!=2 ){
158334
+ if( IS_STMT_SCANSTATUS(pParse->db) && pParse->explain!=2 ){
157697158335
Table *pTab = pIdx->pTable;
157698158336
const char *zSep = "";
157699158337
char *zText = 0;
157700158338
int ii = 0;
157701158339
sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157752,11 +158390,12 @@
157752158390
CollSeq *pColl; /* Collating sequence to on a column */
157753158391
WhereLoop *pLoop; /* The Loop object */
157754158392
char *zNotUsed; /* Extra space on the end of pIdx */
157755158393
Bitmask idxCols; /* Bitmap of columns used for indexing */
157756158394
Bitmask extraCols; /* Bitmap of additional columns */
157757
- 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 */
157758158397
Expr *pPartial = 0; /* Partial Index Expression */
157759158398
int iContinue = 0; /* Jump here to skip excluded rows */
157760158399
SrcItem *pTabItem; /* FROM clause term being indexed */
157761158400
int addrCounter = 0; /* Address where integer counter is initialized */
157762158401
int regBase; /* Array of registers where record is assembled */
@@ -157822,11 +158461,15 @@
157822158461
** original table never needs to be accessed. Automatic indices must
157823158462
** be a covering index because the index will not be updated if the
157824158463
** original table changes and the index and table cannot both be used
157825158464
** if they go out of sync.
157826158465
*/
157827
- 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
+ }
157828158471
mxBitCol = MIN(BMS-1,pTable->nCol);
157829158472
testcase( pTable->nCol==BMS-1 );
157830158473
testcase( pTable->nCol==BMS-2 );
157831158474
for(i=0; i<mxBitCol; i++){
157832158475
if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157858,10 +158501,20 @@
157858158501
pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
157859158502
pColl = sqlite3ExprCompareCollSeq(pParse, pX);
157860158503
assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
157861158504
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
157862158505
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
+ }
157863158516
}
157864158517
}
157865158518
}
157866158519
assert( (u32)n==pLoop->u.btree.nEq );
157867158520
@@ -157890,11 +158543,12 @@
157890158543
assert( pLevel->iIdxCur>=0 );
157891158544
pLevel->iIdxCur = pParse->nTab++;
157892158545
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
157893158546
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
157894158547
VdbeComment((v, "for %s", pTable->zName));
157895
- if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
158548
+ if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) && useBloomFilter ){
158549
+ sqlite3WhereExplainBloomFilter(pParse, pWC->pWInfo, pLevel);
157896158550
pLevel->regFilter = ++pParse->nMem;
157897158551
sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
157898158552
}
157899158553
157900158554
/* Fill the automatic index with content */
@@ -157983,10 +158637,14 @@
157983158637
const WhereTerm *pWCEnd; /* Last WHERE clause term */
157984158638
Parse *pParse = pWInfo->pParse; /* Parsing context */
157985158639
Vdbe *v = pParse->pVdbe; /* VDBE under construction */
157986158640
WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
157987158641
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;
157988158646
157989158647
assert( pLoop!=0 );
157990158648
assert( v!=0 );
157991158649
assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
157992158650
@@ -158039,13 +158697,12 @@
158039158697
Index *pIdx = pLoop->u.btree.pIndex;
158040158698
int n = pLoop->u.btree.nEq;
158041158699
int r1 = sqlite3GetTempRange(pParse, n);
158042158700
int jj;
158043158701
for(jj=0; jj<n; jj++){
158044
- int iCol = pIdx->aiColumn[jj];
158045158702
assert( pIdx->pTable==pItem->pTab );
158046
- sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
158703
+ sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iCur, jj, r1+jj);
158047158704
}
158048158705
sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158049158706
sqlite3ReleaseTempRange(pParse, r1, n);
158050158707
}
158051158708
sqlite3VdbeResolveLabel(v, addrCont);
@@ -158072,10 +158729,11 @@
158072158729
break;
158073158730
}
158074158731
}
158075158732
}while( iLevel < pWInfo->nLevel );
158076158733
sqlite3VdbeJumpHere(v, addrOnce);
158734
+ pParse->pIdxEpr = saved_pIdxEpr;
158077158735
}
158078158736
158079158737
158080158738
#ifndef SQLITE_OMIT_VIRTUALTABLE
158081158739
/*
@@ -158327,10 +158985,13 @@
158327158985
sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc));
158328158986
}else{
158329158987
sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg);
158330158988
}
158331158989
}
158990
+ if( pTab->u.vtab.p->bAllSchemas ){
158991
+ sqlite3VtabUsesAllSchemas(pParse);
158992
+ }
158332158993
sqlite3_free(pVtab->zErrMsg);
158333158994
pVtab->zErrMsg = 0;
158334158995
return rc;
158335158996
}
158336158997
#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
@@ -158370,10 +159031,11 @@
158370159031
UNUSED_PARAMETER( pParse );
158371159032
#endif
158372159033
assert( pRec!=0 );
158373159034
assert( pIdx->nSample>0 );
158374159035
assert( pRec->nField>0 );
159036
+
158375159037
158376159038
/* Do a binary search to find the first sample greater than or equal
158377159039
** to pRec. If pRec contains a single field, the set of samples to search
158378159040
** is simply the aSample[] array. If the samples in aSample[] contain more
158379159041
** than one fields, all fields following the first are ignored.
@@ -158415,11 +159077,16 @@
158415159077
** appears that it should be 1 field in size. However, that would make it
158416159078
** smaller than sample 1, so the binary search would not work. As a result,
158417159079
** it is extended to two fields. The duplicates that this creates do not
158418159080
** cause any problems.
158419159081
*/
158420
- 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);
158421159088
iCol = 0;
158422159089
iSample = pIdx->nSample * nField;
158423159090
do{
158424159091
int iSamp; /* Index in aSample[] of test sample */
158425159092
int n; /* Number of fields in test sample */
@@ -158851,11 +159518,11 @@
158851159518
#else
158852159519
UNUSED_PARAMETER(pParse);
158853159520
UNUSED_PARAMETER(pBuilder);
158854159521
assert( pLower || pUpper );
158855159522
#endif
158856
- assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );
159523
+ assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 || pParse->nErr>0 );
158857159524
nNew = whereRangeAdjust(pLower, nOut);
158858159525
nNew = whereRangeAdjust(pUpper, nNew);
158859159526
158860159527
/* TUNING: If there is both an upper and lower limit and neither limit
158861159528
** has an application-defined likelihood(), assume the range is
@@ -160952,24 +161619,20 @@
160952161619
HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
160953161620
assert( pHidden->eDistinct>=0 && pHidden->eDistinct<=3 );
160954161621
return pHidden->eDistinct;
160955161622
}
160956161623
160957
-#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
160958
- && !defined(SQLITE_OMIT_VIRTUALTABLE)
160959161624
/*
160960161625
** Cause the prepared statement that is associated with a call to
160961161626
** xBestIndex to potentially use all schemas. If the statement being
160962161627
** prepared is read-only, then just start read transactions on all
160963161628
** schemas. But if this is a write operation, start writes on all
160964161629
** schemas.
160965161630
**
160966161631
** This is used by the (built-in) sqlite_dbpage virtual table.
160967161632
*/
160968
-SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info *pIdxInfo){
160969
- HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
160970
- Parse *pParse = pHidden->pParse;
161633
+SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse *pParse){
160971161634
int nDb = pParse->db->nDb;
160972161635
int i;
160973161636
for(i=0; i<nDb; i++){
160974161637
sqlite3CodeVerifySchema(pParse, i);
160975161638
}
@@ -160977,11 +161640,10 @@
160977161640
for(i=0; i<nDb; i++){
160978161641
sqlite3BeginWriteOperation(pParse, 0, i);
160979161642
}
160980161643
}
160981161644
}
160982
-#endif
160983161645
160984161646
/*
160985161647
** Add all WhereLoop objects for a table of the join identified by
160986161648
** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
160987161649
**
@@ -162143,10 +162805,14 @@
162143162805
pWInfo->nOBSat = pFrom->isOrdered;
162144162806
if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162145162807
if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162146162808
pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162147162809
}
162810
+ if( pWInfo->pSelect->pOrderBy
162811
+ && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){
162812
+ pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr;
162813
+ }
162148162814
}else{
162149162815
pWInfo->revMask = pFrom->revLoop;
162150162816
if( pWInfo->nOBSat<=0 ){
162151162817
pWInfo->nOBSat = 0;
162152162818
if( nLoop>0 ){
@@ -162554,10 +163220,13 @@
162554163220
p->pExpr = sqlite3ExprDup(pParse->db, pExpr, 0);
162555163221
p->iDataCur = pTabItem->iCursor;
162556163222
p->iIdxCur = iIdxCur;
162557163223
p->iIdxCol = i;
162558163224
p->bMaybeNullRow = bMaybeNullRow;
163225
+ if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){
163226
+ p->aff = pIdx->zColAff[i];
163227
+ }
162559163228
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
162560163229
p->zIdxName = pIdx->zName;
162561163230
#endif
162562163231
pParse->pIdxEpr = p;
162563163232
if( p->pIENext==0 ){
@@ -163069,11 +163738,11 @@
163069163738
for(; b; b=b>>1, n++){}
163070163739
sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163071163740
assert( n<=pTab->nCol );
163072163741
}
163073163742
#ifdef SQLITE_ENABLE_CURSOR_HINTS
163074
- if( pLoop->u.btree.pIndex!=0 ){
163743
+ if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){
163075163744
sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163076163745
}else
163077163746
#endif
163078163747
{
163079163748
sqlite3VdbeChangeP5(v, bFordelete);
@@ -163527,11 +164196,12 @@
163527164196
}
163528164197
}
163529164198
k = pLevel->addrBody + 1;
163530164199
#ifdef SQLITE_DEBUG
163531164200
if( db->flags & SQLITE_VdbeAddopTrace ){
163532
- 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);
163533164203
}
163534164204
/* Proof that the "+1" on the k value above is safe */
163535164205
pOp = sqlite3VdbeGetOp(v, k - 1);
163536164206
assert( pOp->opcode!=OP_Column || pOp->p1!=pLevel->iTabCur );
163537164207
assert( pOp->opcode!=OP_Rowid || pOp->p1!=pLevel->iTabCur );
@@ -167230,22 +167900,22 @@
167230167900
#define sqlite3ParserCTX_PDECL ,Parse *pParse
167231167901
#define sqlite3ParserCTX_PARAM ,pParse
167232167902
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167233167903
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167234167904
#define YYFALLBACK 1
167235
-#define YYNSTATE 576
167236
-#define YYNRULE 405
167237
-#define YYNRULE_WITH_ACTION 342
167905
+#define YYNSTATE 575
167906
+#define YYNRULE 403
167907
+#define YYNRULE_WITH_ACTION 341
167238167908
#define YYNTOKEN 185
167239
-#define YY_MAX_SHIFT 575
167240
-#define YY_MIN_SHIFTREDUCE 835
167241
-#define YY_MAX_SHIFTREDUCE 1239
167242
-#define YY_ERROR_ACTION 1240
167243
-#define YY_ACCEPT_ACTION 1241
167244
-#define YY_NO_ACTION 1242
167245
-#define YY_MIN_REDUCE 1243
167246
-#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
167247167917
/************* End control #defines *******************************************/
167248167918
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167249167919
167250167920
/* Define the yytestcase() macro to be a no-op if is not already defined
167251167921
** otherwise.
@@ -167308,222 +167978,222 @@
167308167978
** yy_reduce_ofst[] For each state, the offset into yy_action for
167309167979
** shifting non-terminals after a reduce.
167310167980
** yy_default[] Default action for each state.
167311167981
**
167312167982
*********** Begin parsing tables **********************************************/
167313
-#define YY_ACTTAB_COUNT (2098)
167983
+#define YY_ACTTAB_COUNT (2096)
167314167984
static const YYACTIONTYPE yy_action[] = {
167315167985
/* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167316
- /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409,
167317
- /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71,
167318
- /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972,
167319
- /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053,
167320
- /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409,
167321
- /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229,
167322
- /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327,
167323
- /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053,
167324
- /* 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,
167325167995
/* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167326167996
/* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167327
- /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565,
167328
- /* 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,
167329167999
/* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
167330
- /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050,
167331
- /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142,
167332
- /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444,
167333
- /* 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,
167334168004
/* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
167335168005
/* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
167336168006
/* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
167337
- /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193,
167338
- /* 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,
167339168009
/* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167340
- /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80,
167341
- /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124,
167342
- /* 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,
167343168013
/* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
167344
- /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133,
167345
- /* 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,
167346168016
/* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
167347
- /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546,
167348
- /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501,
167349
- /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340,
167350
- /* 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,
167351168021
/* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
167352
- /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154,
167353
- /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194,
167354
- /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222,
167355
- /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050,
167356
- /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550,
167357
- /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109,
167358
- /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570,
167359
- /* 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,
167360168030
/* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
167361
- /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120,
167362
- /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27,
167363
- /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901,
167364
- /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516,
167365
- /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51,
167366
- /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040,
167367
- /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135,
167368
- /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120,
167369
- /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561,
167370
- /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217,
167371
- /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167372
- /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167373
- /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267,
167374
- /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571,
167375
- /* 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,
167376168046
/* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
167377
- /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167378
- /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167379
- /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192,
167380
- /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194,
167381
- /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217,
167382
- /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167383
- /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121,
167384
- /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192,
167385
- /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232,
167386
- /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580,
167387
- /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121,
167388
- /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167389
- /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167390
- /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192,
167391
- /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568,
167392
- /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217,
167393
- /* 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,
167394168064
/* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
167395168065
/* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
167396
- /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297,
167397
- /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200,
167398
- /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121,
167399
- /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167400
- /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167401
- /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278,
167402
- /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568,
167403
- /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217,
167404
- /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167405
- /* 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,
167406168076
/* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
167407
- /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212,
167408
- /* 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,
167409168079
/* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
167410
- /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167411
- /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167412
- /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245,
167413
- /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643,
167414
- /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240,
167415
- /* 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,
167416168086
/* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
167417
- /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284,
167418
- /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311,
167419
- /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538,
167420
- /* 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,
167421168091
/* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167422
- /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568,
167423
- /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326,
167424
- /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497,
167425
- /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019,
167426
- /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217,
167427
- /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167428
- /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217,
167429
- /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167430
- /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217,
167431
- /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167432
- /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121,
167433
- /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568,
167434
- /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121,
167435
- /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642,
167436
- /* 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,
167437168107
/* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
167438
- /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268,
167439
- /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457,
167440
- /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407,
167441
- /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123,
167442
- /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419,
167443
- /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849,
167444
- /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557,
167445
- /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431,
167446
- /* 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,
167447168117
/* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
167448
- /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560,
168118
+ /* 1330 */ 1113, 216, 481, 59, 59, 1189, 1190, 1189, 111, 560,
167449168119
/* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
167450
- /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095,
167451
- /* 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,
167452168122
/* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
167453168123
/* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
167454168124
/* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
167455
- /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534,
167456
- /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027,
167457
- /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66,
167458
- /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177,
167459
- /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471,
167460
- /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407,
167461
- /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52,
167462
- /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447,
167463
- /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391,
167464
- /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466,
167465
- /* 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,
167466168136
/* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
167467168137
/* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
167468
- /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483,
167469
- /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557,
167470
- /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161,
167471
- /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009,
167472
- /* 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,
167473168143
/* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
167474
- /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017,
167475
- /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569,
167476
- /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568,
167477
- /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355,
167478
- /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451,
167479
- /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180,
167480
- /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392,
167481
- /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258,
167482
- /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261,
167483
- /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74,
167484
- /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974,
167485
- /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346,
167486
- /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253,
167487
- /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141,
167488
- /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219,
167489
- /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110,
167490
- /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365,
167491
- /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109,
167492
- /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570,
167493
- /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017,
167494
- /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4,
167495
- /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461,
167496
- /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27,
167497
- /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36,
167498
- /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246,
167499
- /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350,
167500
- /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4,
167501
- /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520,
167502
- /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281,
167503
- /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438,
167504
- /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10,
167505
- /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314,
167506
- /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386,
167507
- /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519,
167508
- /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147,
167509
- /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212,
167510
- /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088,
167511
- /* 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,
167512168182
/* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
167513
- /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247,
167514
- /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489,
167515
- /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19,
167516
- /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159,
167517
- /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174,
167518
- /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260,
167519
- /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25,
167520
- /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055,
167521
- /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022,
167522
- /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925,
167523
- /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
167524
- /* 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,
167525168195
};
167526168196
static const YYCODETYPE yy_lookahead[] = {
167527168197
/* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
167528168198
/* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
167529168199
/* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167731,11 +168401,11 @@
167731168401
/* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
167732168402
/* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
167733168403
/* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
167734168404
/* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
167735168405
/* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167736
- /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319,
168406
+ /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 319, 319, 319,
167737168407
/* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167738168408
/* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167739168409
/* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167740168410
/* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167741168411
/* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167750,13 +168420,13 @@
167750168420
/* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167751168421
/* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167752168422
/* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167753168423
/* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167754168424
/* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167755
- /* 2280 */ 319, 319, 319,
168425
+ /* 2280 */ 319,
167756168426
};
167757
-#define YY_SHIFT_COUNT (575)
168427
+#define YY_SHIFT_COUNT (574)
167758168428
#define YY_SHIFT_MIN (0)
167759168429
#define YY_SHIFT_MAX (2074)
167760168430
static const unsigned short int yy_shift_ofst[] = {
167761168431
/* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
167762168432
/* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167772,16 +168442,16 @@
167772168442
/* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167773168443
/* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167774168444
/* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
167775168445
/* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
167776168446
/* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
167777
- /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468,
168447
+ /* 160 */ 113, 22, 22, 2096, 2096, 328, 328, 328, 239, 468,
167778168448
/* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
167779168449
/* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167780168450
/* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
167781168451
/* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
167782
- /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307,
168452
+ /* 210 */ 67, 1274, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 1307,
167783168453
/* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
167784168454
/* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167785168455
/* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167786168456
/* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
167787168457
/* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167795,12 +168465,12 @@
167795168465
/* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
167796168466
/* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
167797168467
/* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
167798168468
/* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
167799168469
/* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
167800
- /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098,
167801
- /* 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,
167802168472
/* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
167803168473
/* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
167804168474
/* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
167805168475
/* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
167806168476
/* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167813,11 +168483,11 @@
167813168483
/* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
167814168484
/* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
167815168485
/* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
167816168486
/* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
167817168487
/* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
167818
- /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074,
168488
+ /* 570 */ 2052, 2055, 2053, 2073, 2074,
167819168489
};
167820168490
#define YY_REDUCE_COUNT (408)
167821168491
#define YY_REDUCE_MIN (-271)
167822168492
#define YY_REDUCE_MAX (1740)
167823168493
static const short yy_reduce_ofst[] = {
@@ -167862,68 +168532,68 @@
167862168532
/* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
167863168533
/* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
167864168534
/* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
167865168535
};
167866168536
static const YYACTIONTYPE yy_default[] = {
167867
- /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475,
167868
- /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240,
167869
- /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240,
167870
- /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240,
167871
- /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240,
167872
- /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403,
167873
- /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469,
167874
- /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240,
167875
- /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167876
- /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167877
- /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167878
- /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167879
- /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167880
- /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441,
167881
- /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240,
167882
- /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432,
167883
- /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240,
167884
- /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240,
167885
- /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167886
- /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371,
167887
- /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269,
167888
- /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240,
167889
- /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167890
- /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240,
167891
- /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167892
- /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167893
- /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240,
167894
- /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347,
167895
- /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639,
167896
- /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407,
167897
- /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371,
167898
- /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639,
167899
- /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324,
167900
- /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416,
167901
- /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258,
167902
- /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305,
167903
- /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581,
167904
- /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389,
167905
- /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595,
167906
- /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273,
167907
- /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240,
167908
- /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361,
167909
- /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167910
- /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240,
167911
- /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240,
167912
- /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362,
167913
- /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240,
167914
- /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167915
- /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240,
167916
- /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167917
- /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240,
167918
- /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167919
- /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386,
167920
- /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167921
- /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240,
167922
- /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167923
- /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422,
167924
- /* 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,
167925168595
};
167926168596
/********** End of lemon-generated parsing tables *****************************/
167927168597
167928168598
/* The next table maps tokens (terminal symbols) into fallback tokens.
167929168599
** If a construct like the following:
@@ -168716,237 +169386,235 @@
168716169386
/* 173 */ "idlist_opt ::=",
168717169387
/* 174 */ "idlist_opt ::= LP idlist RP",
168718169388
/* 175 */ "idlist ::= idlist COMMA nm",
168719169389
/* 176 */ "idlist ::= nm",
168720169390
/* 177 */ "expr ::= LP expr RP",
168721
- /* 178 */ "expr ::= ID|INDEXED",
168722
- /* 179 */ "expr ::= JOIN_KW",
168723
- /* 180 */ "expr ::= nm DOT nm",
168724
- /* 181 */ "expr ::= nm DOT nm DOT nm",
168725
- /* 182 */ "term ::= NULL|FLOAT|BLOB",
168726
- /* 183 */ "term ::= STRING",
168727
- /* 184 */ "term ::= INTEGER",
168728
- /* 185 */ "expr ::= VARIABLE",
168729
- /* 186 */ "expr ::= expr COLLATE ID|STRING",
168730
- /* 187 */ "expr ::= CAST LP expr AS typetoken RP",
168731
- /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
168732
- /* 189 */ "expr ::= ID|INDEXED LP STAR RP",
168733
- /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
168734
- /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
168735
- /* 192 */ "term ::= CTIME_KW",
168736
- /* 193 */ "expr ::= LP nexprlist COMMA expr RP",
168737
- /* 194 */ "expr ::= expr AND expr",
168738
- /* 195 */ "expr ::= expr OR expr",
168739
- /* 196 */ "expr ::= expr LT|GT|GE|LE expr",
168740
- /* 197 */ "expr ::= expr EQ|NE expr",
168741
- /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
168742
- /* 199 */ "expr ::= expr PLUS|MINUS expr",
168743
- /* 200 */ "expr ::= expr STAR|SLASH|REM expr",
168744
- /* 201 */ "expr ::= expr CONCAT expr",
168745
- /* 202 */ "likeop ::= NOT LIKE_KW|MATCH",
168746
- /* 203 */ "expr ::= expr likeop expr",
168747
- /* 204 */ "expr ::= expr likeop expr ESCAPE expr",
168748
- /* 205 */ "expr ::= expr ISNULL|NOTNULL",
168749
- /* 206 */ "expr ::= expr NOT NULL",
168750
- /* 207 */ "expr ::= expr IS expr",
168751
- /* 208 */ "expr ::= expr IS NOT expr",
168752
- /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr",
168753
- /* 210 */ "expr ::= expr IS DISTINCT FROM expr",
168754
- /* 211 */ "expr ::= NOT expr",
168755
- /* 212 */ "expr ::= BITNOT expr",
168756
- /* 213 */ "expr ::= PLUS|MINUS expr",
168757
- /* 214 */ "expr ::= expr PTR expr",
168758
- /* 215 */ "between_op ::= BETWEEN",
168759
- /* 216 */ "between_op ::= NOT BETWEEN",
168760
- /* 217 */ "expr ::= expr between_op expr AND expr",
168761
- /* 218 */ "in_op ::= IN",
168762
- /* 219 */ "in_op ::= NOT IN",
168763
- /* 220 */ "expr ::= expr in_op LP exprlist RP",
168764
- /* 221 */ "expr ::= LP select RP",
168765
- /* 222 */ "expr ::= expr in_op LP select RP",
168766
- /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist",
168767
- /* 224 */ "expr ::= EXISTS LP select RP",
168768
- /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END",
168769
- /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
168770
- /* 227 */ "case_exprlist ::= WHEN expr THEN expr",
168771
- /* 228 */ "case_else ::= ELSE expr",
168772
- /* 229 */ "case_else ::=",
168773
- /* 230 */ "case_operand ::= expr",
168774
- /* 231 */ "case_operand ::=",
168775
- /* 232 */ "exprlist ::=",
168776
- /* 233 */ "nexprlist ::= nexprlist COMMA expr",
168777
- /* 234 */ "nexprlist ::= expr",
168778
- /* 235 */ "paren_exprlist ::=",
168779
- /* 236 */ "paren_exprlist ::= LP exprlist RP",
168780
- /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
168781
- /* 238 */ "uniqueflag ::= UNIQUE",
168782
- /* 239 */ "uniqueflag ::=",
168783
- /* 240 */ "eidlist_opt ::=",
168784
- /* 241 */ "eidlist_opt ::= LP eidlist RP",
168785
- /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder",
168786
- /* 243 */ "eidlist ::= nm collate sortorder",
168787
- /* 244 */ "collate ::=",
168788
- /* 245 */ "collate ::= COLLATE ID|STRING",
168789
- /* 246 */ "cmd ::= DROP INDEX ifexists fullname",
168790
- /* 247 */ "cmd ::= VACUUM vinto",
168791
- /* 248 */ "cmd ::= VACUUM nm vinto",
168792
- /* 249 */ "vinto ::= INTO expr",
168793
- /* 250 */ "vinto ::=",
168794
- /* 251 */ "cmd ::= PRAGMA nm dbnm",
168795
- /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
168796
- /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
168797
- /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
168798
- /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
168799
- /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT",
168800
- /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT",
168801
- /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
168802
- /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
168803
- /* 260 */ "trigger_time ::= BEFORE|AFTER",
168804
- /* 261 */ "trigger_time ::= INSTEAD OF",
168805
- /* 262 */ "trigger_time ::=",
168806
- /* 263 */ "trigger_event ::= DELETE|INSERT",
168807
- /* 264 */ "trigger_event ::= UPDATE",
168808
- /* 265 */ "trigger_event ::= UPDATE OF idlist",
168809
- /* 266 */ "when_clause ::=",
168810
- /* 267 */ "when_clause ::= WHEN expr",
168811
- /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
168812
- /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI",
168813
- /* 270 */ "trnm ::= nm DOT nm",
168814
- /* 271 */ "tridxby ::= INDEXED BY nm",
168815
- /* 272 */ "tridxby ::= NOT INDEXED",
168816
- /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
168817
- /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
168818
- /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
168819
- /* 276 */ "trigger_cmd ::= scanpt select scanpt",
168820
- /* 277 */ "expr ::= RAISE LP IGNORE RP",
168821
- /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
168822
- /* 279 */ "raisetype ::= ROLLBACK",
168823
- /* 280 */ "raisetype ::= ABORT",
168824
- /* 281 */ "raisetype ::= FAIL",
168825
- /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
168826
- /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
168827
- /* 284 */ "cmd ::= DETACH database_kw_opt expr",
168828
- /* 285 */ "key_opt ::=",
168829
- /* 286 */ "key_opt ::= KEY expr",
168830
- /* 287 */ "cmd ::= REINDEX",
168831
- /* 288 */ "cmd ::= REINDEX nm dbnm",
168832
- /* 289 */ "cmd ::= ANALYZE",
168833
- /* 290 */ "cmd ::= ANALYZE nm dbnm",
168834
- /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
168835
- /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
168836
- /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
168837
- /* 294 */ "add_column_fullname ::= fullname",
168838
- /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
168839
- /* 296 */ "cmd ::= create_vtab",
168840
- /* 297 */ "cmd ::= create_vtab LP vtabarglist RP",
168841
- /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
168842
- /* 299 */ "vtabarg ::=",
168843
- /* 300 */ "vtabargtoken ::= ANY",
168844
- /* 301 */ "vtabargtoken ::= lp anylist RP",
168845
- /* 302 */ "lp ::= LP",
168846
- /* 303 */ "with ::= WITH wqlist",
168847
- /* 304 */ "with ::= WITH RECURSIVE wqlist",
168848
- /* 305 */ "wqas ::= AS",
168849
- /* 306 */ "wqas ::= AS MATERIALIZED",
168850
- /* 307 */ "wqas ::= AS NOT MATERIALIZED",
168851
- /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
168852
- /* 309 */ "wqlist ::= wqitem",
168853
- /* 310 */ "wqlist ::= wqlist COMMA wqitem",
168854
- /* 311 */ "windowdefn_list ::= windowdefn",
168855
- /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
168856
- /* 313 */ "windowdefn ::= nm AS LP window RP",
168857
- /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
168858
- /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
168859
- /* 316 */ "window ::= ORDER BY sortlist frame_opt",
168860
- /* 317 */ "window ::= nm ORDER BY sortlist frame_opt",
168861
- /* 318 */ "window ::= frame_opt",
168862
- /* 319 */ "window ::= nm frame_opt",
168863
- /* 320 */ "frame_opt ::=",
168864
- /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
168865
- /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
168866
- /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
168867
- /* 324 */ "frame_bound_s ::= frame_bound",
168868
- /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
168869
- /* 326 */ "frame_bound_e ::= frame_bound",
168870
- /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
168871
- /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
168872
- /* 329 */ "frame_bound ::= CURRENT ROW",
168873
- /* 330 */ "frame_exclude_opt ::=",
168874
- /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
168875
- /* 332 */ "frame_exclude ::= NO OTHERS",
168876
- /* 333 */ "frame_exclude ::= CURRENT ROW",
168877
- /* 334 */ "frame_exclude ::= GROUP|TIES",
168878
- /* 335 */ "window_clause ::= WINDOW windowdefn_list",
168879
- /* 336 */ "filter_over ::= filter_clause over_clause",
168880
- /* 337 */ "filter_over ::= over_clause",
168881
- /* 338 */ "filter_over ::= filter_clause",
168882
- /* 339 */ "over_clause ::= OVER LP window RP",
168883
- /* 340 */ "over_clause ::= OVER nm",
168884
- /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP",
168885
- /* 342 */ "input ::= cmdlist",
168886
- /* 343 */ "cmdlist ::= cmdlist ecmd",
168887
- /* 344 */ "cmdlist ::= ecmd",
168888
- /* 345 */ "ecmd ::= SEMI",
168889
- /* 346 */ "ecmd ::= cmdx SEMI",
168890
- /* 347 */ "ecmd ::= explain cmdx SEMI",
168891
- /* 348 */ "trans_opt ::=",
168892
- /* 349 */ "trans_opt ::= TRANSACTION",
168893
- /* 350 */ "trans_opt ::= TRANSACTION nm",
168894
- /* 351 */ "savepoint_opt ::= SAVEPOINT",
168895
- /* 352 */ "savepoint_opt ::=",
168896
- /* 353 */ "cmd ::= create_table create_table_args",
168897
- /* 354 */ "table_option_set ::= table_option",
168898
- /* 355 */ "columnlist ::= columnlist COMMA columnname carglist",
168899
- /* 356 */ "columnlist ::= columnname carglist",
168900
- /* 357 */ "nm ::= ID|INDEXED",
168901
- /* 358 */ "nm ::= STRING",
168902
- /* 359 */ "nm ::= JOIN_KW",
168903
- /* 360 */ "typetoken ::= typename",
168904
- /* 361 */ "typename ::= ID|STRING",
168905
- /* 362 */ "signed ::= plus_num",
168906
- /* 363 */ "signed ::= minus_num",
168907
- /* 364 */ "carglist ::= carglist ccons",
168908
- /* 365 */ "carglist ::=",
168909
- /* 366 */ "ccons ::= NULL onconf",
168910
- /* 367 */ "ccons ::= GENERATED ALWAYS AS generated",
168911
- /* 368 */ "ccons ::= AS generated",
168912
- /* 369 */ "conslist_opt ::= COMMA conslist",
168913
- /* 370 */ "conslist ::= conslist tconscomma tcons",
168914
- /* 371 */ "conslist ::= tcons",
168915
- /* 372 */ "tconscomma ::=",
168916
- /* 373 */ "defer_subclause_opt ::= defer_subclause",
168917
- /* 374 */ "resolvetype ::= raisetype",
168918
- /* 375 */ "selectnowith ::= oneselect",
168919
- /* 376 */ "oneselect ::= values",
168920
- /* 377 */ "sclp ::= selcollist COMMA",
168921
- /* 378 */ "as ::= ID|STRING",
168922
- /* 379 */ "indexed_opt ::= indexed_by",
168923
- /* 380 */ "returning ::=",
168924
- /* 381 */ "expr ::= term",
168925
- /* 382 */ "likeop ::= LIKE_KW|MATCH",
168926
- /* 383 */ "exprlist ::= nexprlist",
168927
- /* 384 */ "nmnum ::= plus_num",
168928
- /* 385 */ "nmnum ::= nm",
168929
- /* 386 */ "nmnum ::= ON",
168930
- /* 387 */ "nmnum ::= DELETE",
168931
- /* 388 */ "nmnum ::= DEFAULT",
168932
- /* 389 */ "plus_num ::= INTEGER|FLOAT",
168933
- /* 390 */ "foreach_clause ::=",
168934
- /* 391 */ "foreach_clause ::= FOR EACH ROW",
168935
- /* 392 */ "trnm ::= nm",
168936
- /* 393 */ "tridxby ::=",
168937
- /* 394 */ "database_kw_opt ::= DATABASE",
168938
- /* 395 */ "database_kw_opt ::=",
168939
- /* 396 */ "kwcolumn_opt ::=",
168940
- /* 397 */ "kwcolumn_opt ::= COLUMNKW",
168941
- /* 398 */ "vtabarglist ::= vtabarg",
168942
- /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
168943
- /* 400 */ "vtabarg ::= vtabarg vtabargtoken",
168944
- /* 401 */ "anylist ::=",
168945
- /* 402 */ "anylist ::= anylist LP anylist RP",
168946
- /* 403 */ "anylist ::= anylist ANY",
168947
- /* 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 ::=",
168948169616
};
168949169617
#endif /* NDEBUG */
168950169618
168951169619
168952169620
#if YYSTACKDEPTH<=0
@@ -169627,237 +170295,235 @@
169627170295
270, /* (173) idlist_opt ::= */
169628170296
270, /* (174) idlist_opt ::= LP idlist RP */
169629170297
263, /* (175) idlist ::= idlist COMMA nm */
169630170298
263, /* (176) idlist ::= nm */
169631170299
217, /* (177) expr ::= LP expr RP */
169632
- 217, /* (178) expr ::= ID|INDEXED */
169633
- 217, /* (179) expr ::= JOIN_KW */
169634
- 217, /* (180) expr ::= nm DOT nm */
169635
- 217, /* (181) expr ::= nm DOT nm DOT nm */
169636
- 216, /* (182) term ::= NULL|FLOAT|BLOB */
169637
- 216, /* (183) term ::= STRING */
169638
- 216, /* (184) term ::= INTEGER */
169639
- 217, /* (185) expr ::= VARIABLE */
169640
- 217, /* (186) expr ::= expr COLLATE ID|STRING */
169641
- 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
169642
- 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
169643
- 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
169644
- 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
169645
- 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
169646
- 216, /* (192) term ::= CTIME_KW */
169647
- 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
169648
- 217, /* (194) expr ::= expr AND expr */
169649
- 217, /* (195) expr ::= expr OR expr */
169650
- 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
169651
- 217, /* (197) expr ::= expr EQ|NE expr */
169652
- 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
169653
- 217, /* (199) expr ::= expr PLUS|MINUS expr */
169654
- 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
169655
- 217, /* (201) expr ::= expr CONCAT expr */
169656
- 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
169657
- 217, /* (203) expr ::= expr likeop expr */
169658
- 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
169659
- 217, /* (205) expr ::= expr ISNULL|NOTNULL */
169660
- 217, /* (206) expr ::= expr NOT NULL */
169661
- 217, /* (207) expr ::= expr IS expr */
169662
- 217, /* (208) expr ::= expr IS NOT expr */
169663
- 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
169664
- 217, /* (210) expr ::= expr IS DISTINCT FROM expr */
169665
- 217, /* (211) expr ::= NOT expr */
169666
- 217, /* (212) expr ::= BITNOT expr */
169667
- 217, /* (213) expr ::= PLUS|MINUS expr */
169668
- 217, /* (214) expr ::= expr PTR expr */
169669
- 275, /* (215) between_op ::= BETWEEN */
169670
- 275, /* (216) between_op ::= NOT BETWEEN */
169671
- 217, /* (217) expr ::= expr between_op expr AND expr */
169672
- 276, /* (218) in_op ::= IN */
169673
- 276, /* (219) in_op ::= NOT IN */
169674
- 217, /* (220) expr ::= expr in_op LP exprlist RP */
169675
- 217, /* (221) expr ::= LP select RP */
169676
- 217, /* (222) expr ::= expr in_op LP select RP */
169677
- 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
169678
- 217, /* (224) expr ::= EXISTS LP select RP */
169679
- 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
169680
- 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
169681
- 279, /* (227) case_exprlist ::= WHEN expr THEN expr */
169682
- 280, /* (228) case_else ::= ELSE expr */
169683
- 280, /* (229) case_else ::= */
169684
- 278, /* (230) case_operand ::= expr */
169685
- 278, /* (231) case_operand ::= */
169686
- 261, /* (232) exprlist ::= */
169687
- 253, /* (233) nexprlist ::= nexprlist COMMA expr */
169688
- 253, /* (234) nexprlist ::= expr */
169689
- 277, /* (235) paren_exprlist ::= */
169690
- 277, /* (236) paren_exprlist ::= LP exprlist RP */
169691
- 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
169692
- 281, /* (238) uniqueflag ::= UNIQUE */
169693
- 281, /* (239) uniqueflag ::= */
169694
- 221, /* (240) eidlist_opt ::= */
169695
- 221, /* (241) eidlist_opt ::= LP eidlist RP */
169696
- 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
169697
- 232, /* (243) eidlist ::= nm collate sortorder */
169698
- 282, /* (244) collate ::= */
169699
- 282, /* (245) collate ::= COLLATE ID|STRING */
169700
- 190, /* (246) cmd ::= DROP INDEX ifexists fullname */
169701
- 190, /* (247) cmd ::= VACUUM vinto */
169702
- 190, /* (248) cmd ::= VACUUM nm vinto */
169703
- 283, /* (249) vinto ::= INTO expr */
169704
- 283, /* (250) vinto ::= */
169705
- 190, /* (251) cmd ::= PRAGMA nm dbnm */
169706
- 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
169707
- 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
169708
- 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
169709
- 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
169710
- 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
169711
- 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
169712
- 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
169713
- 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
169714
- 287, /* (260) trigger_time ::= BEFORE|AFTER */
169715
- 287, /* (261) trigger_time ::= INSTEAD OF */
169716
- 287, /* (262) trigger_time ::= */
169717
- 288, /* (263) trigger_event ::= DELETE|INSERT */
169718
- 288, /* (264) trigger_event ::= UPDATE */
169719
- 288, /* (265) trigger_event ::= UPDATE OF idlist */
169720
- 290, /* (266) when_clause ::= */
169721
- 290, /* (267) when_clause ::= WHEN expr */
169722
- 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
169723
- 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
169724
- 292, /* (270) trnm ::= nm DOT nm */
169725
- 293, /* (271) tridxby ::= INDEXED BY nm */
169726
- 293, /* (272) tridxby ::= NOT INDEXED */
169727
- 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169728
- 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
169729
- 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
169730
- 291, /* (276) trigger_cmd ::= scanpt select scanpt */
169731
- 217, /* (277) expr ::= RAISE LP IGNORE RP */
169732
- 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
169733
- 236, /* (279) raisetype ::= ROLLBACK */
169734
- 236, /* (280) raisetype ::= ABORT */
169735
- 236, /* (281) raisetype ::= FAIL */
169736
- 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
169737
- 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
169738
- 190, /* (284) cmd ::= DETACH database_kw_opt expr */
169739
- 295, /* (285) key_opt ::= */
169740
- 295, /* (286) key_opt ::= KEY expr */
169741
- 190, /* (287) cmd ::= REINDEX */
169742
- 190, /* (288) cmd ::= REINDEX nm dbnm */
169743
- 190, /* (289) cmd ::= ANALYZE */
169744
- 190, /* (290) cmd ::= ANALYZE nm dbnm */
169745
- 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
169746
- 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
169747
- 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
169748
- 296, /* (294) add_column_fullname ::= fullname */
169749
- 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
169750
- 190, /* (296) cmd ::= create_vtab */
169751
- 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */
169752
- 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
169753
- 300, /* (299) vtabarg ::= */
169754
- 301, /* (300) vtabargtoken ::= ANY */
169755
- 301, /* (301) vtabargtoken ::= lp anylist RP */
169756
- 302, /* (302) lp ::= LP */
169757
- 266, /* (303) with ::= WITH wqlist */
169758
- 266, /* (304) with ::= WITH RECURSIVE wqlist */
169759
- 305, /* (305) wqas ::= AS */
169760
- 305, /* (306) wqas ::= AS MATERIALIZED */
169761
- 305, /* (307) wqas ::= AS NOT MATERIALIZED */
169762
- 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
169763
- 241, /* (309) wqlist ::= wqitem */
169764
- 241, /* (310) wqlist ::= wqlist COMMA wqitem */
169765
- 306, /* (311) windowdefn_list ::= windowdefn */
169766
- 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
169767
- 307, /* (313) windowdefn ::= nm AS LP window RP */
169768
- 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
169769
- 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
169770
- 308, /* (316) window ::= ORDER BY sortlist frame_opt */
169771
- 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */
169772
- 308, /* (318) window ::= frame_opt */
169773
- 308, /* (319) window ::= nm frame_opt */
169774
- 309, /* (320) frame_opt ::= */
169775
- 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
169776
- 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
169777
- 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
169778
- 315, /* (324) frame_bound_s ::= frame_bound */
169779
- 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
169780
- 316, /* (326) frame_bound_e ::= frame_bound */
169781
- 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
169782
- 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
169783
- 314, /* (329) frame_bound ::= CURRENT ROW */
169784
- 317, /* (330) frame_exclude_opt ::= */
169785
- 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
169786
- 318, /* (332) frame_exclude ::= NO OTHERS */
169787
- 318, /* (333) frame_exclude ::= CURRENT ROW */
169788
- 318, /* (334) frame_exclude ::= GROUP|TIES */
169789
- 251, /* (335) window_clause ::= WINDOW windowdefn_list */
169790
- 273, /* (336) filter_over ::= filter_clause over_clause */
169791
- 273, /* (337) filter_over ::= over_clause */
169792
- 273, /* (338) filter_over ::= filter_clause */
169793
- 312, /* (339) over_clause ::= OVER LP window RP */
169794
- 312, /* (340) over_clause ::= OVER nm */
169795
- 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
169796
- 185, /* (342) input ::= cmdlist */
169797
- 186, /* (343) cmdlist ::= cmdlist ecmd */
169798
- 186, /* (344) cmdlist ::= ecmd */
169799
- 187, /* (345) ecmd ::= SEMI */
169800
- 187, /* (346) ecmd ::= cmdx SEMI */
169801
- 187, /* (347) ecmd ::= explain cmdx SEMI */
169802
- 192, /* (348) trans_opt ::= */
169803
- 192, /* (349) trans_opt ::= TRANSACTION */
169804
- 192, /* (350) trans_opt ::= TRANSACTION nm */
169805
- 194, /* (351) savepoint_opt ::= SAVEPOINT */
169806
- 194, /* (352) savepoint_opt ::= */
169807
- 190, /* (353) cmd ::= create_table create_table_args */
169808
- 203, /* (354) table_option_set ::= table_option */
169809
- 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */
169810
- 201, /* (356) columnlist ::= columnname carglist */
169811
- 193, /* (357) nm ::= ID|INDEXED */
169812
- 193, /* (358) nm ::= STRING */
169813
- 193, /* (359) nm ::= JOIN_KW */
169814
- 208, /* (360) typetoken ::= typename */
169815
- 209, /* (361) typename ::= ID|STRING */
169816
- 210, /* (362) signed ::= plus_num */
169817
- 210, /* (363) signed ::= minus_num */
169818
- 207, /* (364) carglist ::= carglist ccons */
169819
- 207, /* (365) carglist ::= */
169820
- 215, /* (366) ccons ::= NULL onconf */
169821
- 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */
169822
- 215, /* (368) ccons ::= AS generated */
169823
- 202, /* (369) conslist_opt ::= COMMA conslist */
169824
- 228, /* (370) conslist ::= conslist tconscomma tcons */
169825
- 228, /* (371) conslist ::= tcons */
169826
- 229, /* (372) tconscomma ::= */
169827
- 233, /* (373) defer_subclause_opt ::= defer_subclause */
169828
- 235, /* (374) resolvetype ::= raisetype */
169829
- 239, /* (375) selectnowith ::= oneselect */
169830
- 240, /* (376) oneselect ::= values */
169831
- 254, /* (377) sclp ::= selcollist COMMA */
169832
- 255, /* (378) as ::= ID|STRING */
169833
- 264, /* (379) indexed_opt ::= indexed_by */
169834
- 272, /* (380) returning ::= */
169835
- 217, /* (381) expr ::= term */
169836
- 274, /* (382) likeop ::= LIKE_KW|MATCH */
169837
- 261, /* (383) exprlist ::= nexprlist */
169838
- 284, /* (384) nmnum ::= plus_num */
169839
- 284, /* (385) nmnum ::= nm */
169840
- 284, /* (386) nmnum ::= ON */
169841
- 284, /* (387) nmnum ::= DELETE */
169842
- 284, /* (388) nmnum ::= DEFAULT */
169843
- 211, /* (389) plus_num ::= INTEGER|FLOAT */
169844
- 289, /* (390) foreach_clause ::= */
169845
- 289, /* (391) foreach_clause ::= FOR EACH ROW */
169846
- 292, /* (392) trnm ::= nm */
169847
- 293, /* (393) tridxby ::= */
169848
- 294, /* (394) database_kw_opt ::= DATABASE */
169849
- 294, /* (395) database_kw_opt ::= */
169850
- 297, /* (396) kwcolumn_opt ::= */
169851
- 297, /* (397) kwcolumn_opt ::= COLUMNKW */
169852
- 299, /* (398) vtabarglist ::= vtabarg */
169853
- 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
169854
- 300, /* (400) vtabarg ::= vtabarg vtabargtoken */
169855
- 303, /* (401) anylist ::= */
169856
- 303, /* (402) anylist ::= anylist LP anylist RP */
169857
- 303, /* (403) anylist ::= anylist ANY */
169858
- 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 ::= */
169859170525
};
169860170526
169861170527
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
169862170528
** of symbols on the right-hand side of that rule. */
169863170529
static const signed char yyRuleInfoNRhs[] = {
@@ -170037,237 +170703,235 @@
170037170703
0, /* (173) idlist_opt ::= */
170038170704
-3, /* (174) idlist_opt ::= LP idlist RP */
170039170705
-3, /* (175) idlist ::= idlist COMMA nm */
170040170706
-1, /* (176) idlist ::= nm */
170041170707
-3, /* (177) expr ::= LP expr RP */
170042
- -1, /* (178) expr ::= ID|INDEXED */
170043
- -1, /* (179) expr ::= JOIN_KW */
170044
- -3, /* (180) expr ::= nm DOT nm */
170045
- -5, /* (181) expr ::= nm DOT nm DOT nm */
170046
- -1, /* (182) term ::= NULL|FLOAT|BLOB */
170047
- -1, /* (183) term ::= STRING */
170048
- -1, /* (184) term ::= INTEGER */
170049
- -1, /* (185) expr ::= VARIABLE */
170050
- -3, /* (186) expr ::= expr COLLATE ID|STRING */
170051
- -6, /* (187) expr ::= CAST LP expr AS typetoken RP */
170052
- -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
170053
- -4, /* (189) expr ::= ID|INDEXED LP STAR RP */
170054
- -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
170055
- -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
170056
- -1, /* (192) term ::= CTIME_KW */
170057
- -5, /* (193) expr ::= LP nexprlist COMMA expr RP */
170058
- -3, /* (194) expr ::= expr AND expr */
170059
- -3, /* (195) expr ::= expr OR expr */
170060
- -3, /* (196) expr ::= expr LT|GT|GE|LE expr */
170061
- -3, /* (197) expr ::= expr EQ|NE expr */
170062
- -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170063
- -3, /* (199) expr ::= expr PLUS|MINUS expr */
170064
- -3, /* (200) expr ::= expr STAR|SLASH|REM expr */
170065
- -3, /* (201) expr ::= expr CONCAT expr */
170066
- -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */
170067
- -3, /* (203) expr ::= expr likeop expr */
170068
- -5, /* (204) expr ::= expr likeop expr ESCAPE expr */
170069
- -2, /* (205) expr ::= expr ISNULL|NOTNULL */
170070
- -3, /* (206) expr ::= expr NOT NULL */
170071
- -3, /* (207) expr ::= expr IS expr */
170072
- -4, /* (208) expr ::= expr IS NOT expr */
170073
- -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
170074
- -5, /* (210) expr ::= expr IS DISTINCT FROM expr */
170075
- -2, /* (211) expr ::= NOT expr */
170076
- -2, /* (212) expr ::= BITNOT expr */
170077
- -2, /* (213) expr ::= PLUS|MINUS expr */
170078
- -3, /* (214) expr ::= expr PTR expr */
170079
- -1, /* (215) between_op ::= BETWEEN */
170080
- -2, /* (216) between_op ::= NOT BETWEEN */
170081
- -5, /* (217) expr ::= expr between_op expr AND expr */
170082
- -1, /* (218) in_op ::= IN */
170083
- -2, /* (219) in_op ::= NOT IN */
170084
- -5, /* (220) expr ::= expr in_op LP exprlist RP */
170085
- -3, /* (221) expr ::= LP select RP */
170086
- -5, /* (222) expr ::= expr in_op LP select RP */
170087
- -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
170088
- -4, /* (224) expr ::= EXISTS LP select RP */
170089
- -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
170090
- -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170091
- -4, /* (227) case_exprlist ::= WHEN expr THEN expr */
170092
- -2, /* (228) case_else ::= ELSE expr */
170093
- 0, /* (229) case_else ::= */
170094
- -1, /* (230) case_operand ::= expr */
170095
- 0, /* (231) case_operand ::= */
170096
- 0, /* (232) exprlist ::= */
170097
- -3, /* (233) nexprlist ::= nexprlist COMMA expr */
170098
- -1, /* (234) nexprlist ::= expr */
170099
- 0, /* (235) paren_exprlist ::= */
170100
- -3, /* (236) paren_exprlist ::= LP exprlist RP */
170101
- -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170102
- -1, /* (238) uniqueflag ::= UNIQUE */
170103
- 0, /* (239) uniqueflag ::= */
170104
- 0, /* (240) eidlist_opt ::= */
170105
- -3, /* (241) eidlist_opt ::= LP eidlist RP */
170106
- -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
170107
- -3, /* (243) eidlist ::= nm collate sortorder */
170108
- 0, /* (244) collate ::= */
170109
- -2, /* (245) collate ::= COLLATE ID|STRING */
170110
- -4, /* (246) cmd ::= DROP INDEX ifexists fullname */
170111
- -2, /* (247) cmd ::= VACUUM vinto */
170112
- -3, /* (248) cmd ::= VACUUM nm vinto */
170113
- -2, /* (249) vinto ::= INTO expr */
170114
- 0, /* (250) vinto ::= */
170115
- -3, /* (251) cmd ::= PRAGMA nm dbnm */
170116
- -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
170117
- -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170118
- -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
170119
- -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170120
- -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
170121
- -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
170122
- -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170123
- -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170124
- -1, /* (260) trigger_time ::= BEFORE|AFTER */
170125
- -2, /* (261) trigger_time ::= INSTEAD OF */
170126
- 0, /* (262) trigger_time ::= */
170127
- -1, /* (263) trigger_event ::= DELETE|INSERT */
170128
- -1, /* (264) trigger_event ::= UPDATE */
170129
- -3, /* (265) trigger_event ::= UPDATE OF idlist */
170130
- 0, /* (266) when_clause ::= */
170131
- -2, /* (267) when_clause ::= WHEN expr */
170132
- -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170133
- -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
170134
- -3, /* (270) trnm ::= nm DOT nm */
170135
- -3, /* (271) tridxby ::= INDEXED BY nm */
170136
- -2, /* (272) tridxby ::= NOT INDEXED */
170137
- -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170138
- -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170139
- -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170140
- -3, /* (276) trigger_cmd ::= scanpt select scanpt */
170141
- -4, /* (277) expr ::= RAISE LP IGNORE RP */
170142
- -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
170143
- -1, /* (279) raisetype ::= ROLLBACK */
170144
- -1, /* (280) raisetype ::= ABORT */
170145
- -1, /* (281) raisetype ::= FAIL */
170146
- -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
170147
- -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170148
- -3, /* (284) cmd ::= DETACH database_kw_opt expr */
170149
- 0, /* (285) key_opt ::= */
170150
- -2, /* (286) key_opt ::= KEY expr */
170151
- -1, /* (287) cmd ::= REINDEX */
170152
- -3, /* (288) cmd ::= REINDEX nm dbnm */
170153
- -1, /* (289) cmd ::= ANALYZE */
170154
- -3, /* (290) cmd ::= ANALYZE nm dbnm */
170155
- -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
170156
- -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170157
- -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170158
- -1, /* (294) add_column_fullname ::= fullname */
170159
- -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170160
- -1, /* (296) cmd ::= create_vtab */
170161
- -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */
170162
- -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170163
- 0, /* (299) vtabarg ::= */
170164
- -1, /* (300) vtabargtoken ::= ANY */
170165
- -3, /* (301) vtabargtoken ::= lp anylist RP */
170166
- -1, /* (302) lp ::= LP */
170167
- -2, /* (303) with ::= WITH wqlist */
170168
- -3, /* (304) with ::= WITH RECURSIVE wqlist */
170169
- -1, /* (305) wqas ::= AS */
170170
- -2, /* (306) wqas ::= AS MATERIALIZED */
170171
- -3, /* (307) wqas ::= AS NOT MATERIALIZED */
170172
- -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
170173
- -1, /* (309) wqlist ::= wqitem */
170174
- -3, /* (310) wqlist ::= wqlist COMMA wqitem */
170175
- -1, /* (311) windowdefn_list ::= windowdefn */
170176
- -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170177
- -5, /* (313) windowdefn ::= nm AS LP window RP */
170178
- -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170179
- -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170180
- -4, /* (316) window ::= ORDER BY sortlist frame_opt */
170181
- -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */
170182
- -1, /* (318) window ::= frame_opt */
170183
- -2, /* (319) window ::= nm frame_opt */
170184
- 0, /* (320) frame_opt ::= */
170185
- -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170186
- -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170187
- -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
170188
- -1, /* (324) frame_bound_s ::= frame_bound */
170189
- -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
170190
- -1, /* (326) frame_bound_e ::= frame_bound */
170191
- -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
170192
- -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
170193
- -2, /* (329) frame_bound ::= CURRENT ROW */
170194
- 0, /* (330) frame_exclude_opt ::= */
170195
- -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
170196
- -2, /* (332) frame_exclude ::= NO OTHERS */
170197
- -2, /* (333) frame_exclude ::= CURRENT ROW */
170198
- -1, /* (334) frame_exclude ::= GROUP|TIES */
170199
- -2, /* (335) window_clause ::= WINDOW windowdefn_list */
170200
- -2, /* (336) filter_over ::= filter_clause over_clause */
170201
- -1, /* (337) filter_over ::= over_clause */
170202
- -1, /* (338) filter_over ::= filter_clause */
170203
- -4, /* (339) over_clause ::= OVER LP window RP */
170204
- -2, /* (340) over_clause ::= OVER nm */
170205
- -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
170206
- -1, /* (342) input ::= cmdlist */
170207
- -2, /* (343) cmdlist ::= cmdlist ecmd */
170208
- -1, /* (344) cmdlist ::= ecmd */
170209
- -1, /* (345) ecmd ::= SEMI */
170210
- -2, /* (346) ecmd ::= cmdx SEMI */
170211
- -3, /* (347) ecmd ::= explain cmdx SEMI */
170212
- 0, /* (348) trans_opt ::= */
170213
- -1, /* (349) trans_opt ::= TRANSACTION */
170214
- -2, /* (350) trans_opt ::= TRANSACTION nm */
170215
- -1, /* (351) savepoint_opt ::= SAVEPOINT */
170216
- 0, /* (352) savepoint_opt ::= */
170217
- -2, /* (353) cmd ::= create_table create_table_args */
170218
- -1, /* (354) table_option_set ::= table_option */
170219
- -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */
170220
- -2, /* (356) columnlist ::= columnname carglist */
170221
- -1, /* (357) nm ::= ID|INDEXED */
170222
- -1, /* (358) nm ::= STRING */
170223
- -1, /* (359) nm ::= JOIN_KW */
170224
- -1, /* (360) typetoken ::= typename */
170225
- -1, /* (361) typename ::= ID|STRING */
170226
- -1, /* (362) signed ::= plus_num */
170227
- -1, /* (363) signed ::= minus_num */
170228
- -2, /* (364) carglist ::= carglist ccons */
170229
- 0, /* (365) carglist ::= */
170230
- -2, /* (366) ccons ::= NULL onconf */
170231
- -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */
170232
- -2, /* (368) ccons ::= AS generated */
170233
- -2, /* (369) conslist_opt ::= COMMA conslist */
170234
- -3, /* (370) conslist ::= conslist tconscomma tcons */
170235
- -1, /* (371) conslist ::= tcons */
170236
- 0, /* (372) tconscomma ::= */
170237
- -1, /* (373) defer_subclause_opt ::= defer_subclause */
170238
- -1, /* (374) resolvetype ::= raisetype */
170239
- -1, /* (375) selectnowith ::= oneselect */
170240
- -1, /* (376) oneselect ::= values */
170241
- -2, /* (377) sclp ::= selcollist COMMA */
170242
- -1, /* (378) as ::= ID|STRING */
170243
- -1, /* (379) indexed_opt ::= indexed_by */
170244
- 0, /* (380) returning ::= */
170245
- -1, /* (381) expr ::= term */
170246
- -1, /* (382) likeop ::= LIKE_KW|MATCH */
170247
- -1, /* (383) exprlist ::= nexprlist */
170248
- -1, /* (384) nmnum ::= plus_num */
170249
- -1, /* (385) nmnum ::= nm */
170250
- -1, /* (386) nmnum ::= ON */
170251
- -1, /* (387) nmnum ::= DELETE */
170252
- -1, /* (388) nmnum ::= DEFAULT */
170253
- -1, /* (389) plus_num ::= INTEGER|FLOAT */
170254
- 0, /* (390) foreach_clause ::= */
170255
- -3, /* (391) foreach_clause ::= FOR EACH ROW */
170256
- -1, /* (392) trnm ::= nm */
170257
- 0, /* (393) tridxby ::= */
170258
- -1, /* (394) database_kw_opt ::= DATABASE */
170259
- 0, /* (395) database_kw_opt ::= */
170260
- 0, /* (396) kwcolumn_opt ::= */
170261
- -1, /* (397) kwcolumn_opt ::= COLUMNKW */
170262
- -1, /* (398) vtabarglist ::= vtabarg */
170263
- -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
170264
- -2, /* (400) vtabarg ::= vtabarg vtabargtoken */
170265
- 0, /* (401) anylist ::= */
170266
- -4, /* (402) anylist ::= anylist LP anylist RP */
170267
- -2, /* (403) anylist ::= anylist ANY */
170268
- 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 ::= */
170269170933
};
170270170934
170271170935
static void yy_accept(yyParser*); /* Forward Declaration */
170272170936
170273170937
/*
@@ -170323,11 +170987,11 @@
170323170987
{yymsp[1].minor.yy394 = TK_DEFERRED;}
170324170988
break;
170325170989
case 5: /* transtype ::= DEFERRED */
170326170990
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170327170991
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170328
- case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323);
170992
+ case 322: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==322);
170329170993
{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170330170994
break;
170331170995
case 8: /* cmd ::= COMMIT|END trans_opt */
170332170996
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170333170997
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170360,11 +171024,11 @@
170360171024
case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
170361171025
case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
170362171026
case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
170363171027
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
170364171028
case 98: /* distinct ::= */ yytestcase(yyruleno==98);
170365
- case 244: /* collate ::= */ yytestcase(yyruleno==244);
171029
+ case 243: /* collate ::= */ yytestcase(yyruleno==243);
170366171030
{yymsp[1].minor.yy394 = 0;}
170367171031
break;
170368171032
case 16: /* ifnotexists ::= IF NOT EXISTS */
170369171033
{yymsp[-2].minor.yy394 = 1;}
170370171034
break;
@@ -170544,13 +171208,13 @@
170544171208
case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
170545171209
{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
170546171210
break;
170547171211
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
170548171212
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
170549
- case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216);
170550
- case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219);
170551
- 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);
170552171216
{yymsp[-1].minor.yy394 = 1;}
170553171217
break;
170554171218
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
170555171219
{yymsp[-1].minor.yy394 = 0;}
170556171220
break;
@@ -170696,13 +171360,13 @@
170696171360
{yymsp[0].minor.yy394 = SF_All;}
170697171361
break;
170698171362
case 99: /* sclp ::= */
170699171363
case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
170700171364
case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
170701
- case 232: /* exprlist ::= */ yytestcase(yyruleno==232);
170702
- case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235);
170703
- 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);
170704171368
{yymsp[1].minor.yy322 = 0;}
170705171369
break;
170706171370
case 100: /* selcollist ::= sclp scanpt expr scanpt as */
170707171371
{
170708171372
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170724,12 +171388,12 @@
170724171388
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
170725171389
}
170726171390
break;
170727171391
case 103: /* as ::= AS nm */
170728171392
case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
170729
- case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170730
- 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);
170731171395
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
170732171396
break;
170733171397
case 105: /* from ::= */
170734171398
case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
170735171399
{yymsp[1].minor.yy131 = 0;}
@@ -170897,20 +171561,20 @@
170897171561
break;
170898171562
case 144: /* having_opt ::= */
170899171563
case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
170900171564
case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
170901171565
case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
170902
- case 229: /* case_else ::= */ yytestcase(yyruleno==229);
170903
- case 231: /* case_operand ::= */ yytestcase(yyruleno==231);
170904
- 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);
170905171569
{yymsp[1].minor.yy528 = 0;}
170906171570
break;
170907171571
case 145: /* having_opt ::= HAVING expr */
170908171572
case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
170909171573
case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
170910
- case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228);
170911
- 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);
170912171576
{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
170913171577
break;
170914171578
case 147: /* limit_opt ::= LIMIT expr */
170915171579
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
170916171580
break;
@@ -171018,23 +171682,22 @@
171018171682
{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171019171683
break;
171020171684
case 177: /* expr ::= LP expr RP */
171021171685
{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171022171686
break;
171023
- case 178: /* expr ::= ID|INDEXED */
171024
- case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
171687
+ case 178: /* expr ::= ID|INDEXED|JOIN_KW */
171025171688
{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171026171689
break;
171027
- case 180: /* expr ::= nm DOT nm */
171690
+ case 179: /* expr ::= nm DOT nm */
171028171691
{
171029171692
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171030171693
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171031171694
yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171032171695
}
171033171696
yymsp[-2].minor.yy528 = yylhsminor.yy528;
171034171697
break;
171035
- case 181: /* expr ::= nm DOT nm DOT nm */
171698
+ case 180: /* expr ::= nm DOT nm DOT nm */
171036171699
{
171037171700
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171038171701
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171039171702
Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171040171703
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171043,22 +171706,22 @@
171043171706
}
171044171707
yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171045171708
}
171046171709
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171047171710
break;
171048
- case 182: /* term ::= NULL|FLOAT|BLOB */
171049
- case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
171711
+ case 181: /* term ::= NULL|FLOAT|BLOB */
171712
+ case 182: /* term ::= STRING */ yytestcase(yyruleno==182);
171050171713
{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171051171714
break;
171052
- case 184: /* term ::= INTEGER */
171715
+ case 183: /* term ::= INTEGER */
171053171716
{
171054171717
yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171055171718
if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171056171719
}
171057171720
yymsp[0].minor.yy528 = yylhsminor.yy528;
171058171721
break;
171059
- case 185: /* expr ::= VARIABLE */
171722
+ case 184: /* expr ::= VARIABLE */
171060171723
{
171061171724
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171062171725
u32 n = yymsp[0].minor.yy0.n;
171063171726
yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171064171727
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171076,54 +171739,54 @@
171076171739
if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171077171740
}
171078171741
}
171079171742
}
171080171743
break;
171081
- case 186: /* expr ::= expr COLLATE ID|STRING */
171744
+ case 185: /* expr ::= expr COLLATE ID|STRING */
171082171745
{
171083171746
yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171084171747
}
171085171748
break;
171086
- case 187: /* expr ::= CAST LP expr AS typetoken RP */
171749
+ case 186: /* expr ::= CAST LP expr AS typetoken RP */
171087171750
{
171088171751
yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171089171752
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171090171753
}
171091171754
break;
171092
- case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
171755
+ case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
171093171756
{
171094171757
yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171095171758
}
171096171759
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171097171760
break;
171098
- case 189: /* expr ::= ID|INDEXED LP STAR RP */
171761
+ case 188: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
171099171762
{
171100171763
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171101171764
}
171102171765
yymsp[-3].minor.yy528 = yylhsminor.yy528;
171103171766
break;
171104
- 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 */
171105171768
{
171106171769
yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171107171770
sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171108171771
}
171109171772
yymsp[-5].minor.yy528 = yylhsminor.yy528;
171110171773
break;
171111
- case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
171774
+ case 190: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
171112171775
{
171113171776
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171114171777
sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171115171778
}
171116171779
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171117171780
break;
171118
- case 192: /* term ::= CTIME_KW */
171781
+ case 191: /* term ::= CTIME_KW */
171119171782
{
171120171783
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171121171784
}
171122171785
yymsp[0].minor.yy528 = yylhsminor.yy528;
171123171786
break;
171124
- case 193: /* expr ::= LP nexprlist COMMA expr RP */
171787
+ case 192: /* expr ::= LP nexprlist COMMA expr RP */
171125171788
{
171126171789
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171127171790
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171128171791
if( yymsp[-4].minor.yy528 ){
171129171792
yymsp[-4].minor.yy528->x.pList = pList;
@@ -171133,26 +171796,26 @@
171133171796
}else{
171134171797
sqlite3ExprListDelete(pParse->db, pList);
171135171798
}
171136171799
}
171137171800
break;
171138
- case 194: /* expr ::= expr AND expr */
171801
+ case 193: /* expr ::= expr AND expr */
171139171802
{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171140171803
break;
171141
- case 195: /* expr ::= expr OR expr */
171142
- case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
171143
- case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
171144
- case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
171145
- case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
171146
- case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
171147
- 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);
171148171811
{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171149171812
break;
171150
- case 202: /* likeop ::= NOT LIKE_KW|MATCH */
171813
+ case 201: /* likeop ::= NOT LIKE_KW|MATCH */
171151171814
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171152171815
break;
171153
- case 203: /* expr ::= expr likeop expr */
171816
+ case 202: /* expr ::= expr likeop expr */
171154171817
{
171155171818
ExprList *pList;
171156171819
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171157171820
yymsp[-1].minor.yy0.n &= 0x7fffffff;
171158171821
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171160,11 +171823,11 @@
171160171823
yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171161171824
if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171162171825
if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171163171826
}
171164171827
break;
171165
- case 204: /* expr ::= expr likeop expr ESCAPE expr */
171828
+ case 203: /* expr ::= expr likeop expr ESCAPE expr */
171166171829
{
171167171830
ExprList *pList;
171168171831
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171169171832
yymsp[-3].minor.yy0.n &= 0x7fffffff;
171170171833
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171173,63 +171836,63 @@
171173171836
yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171174171837
if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171175171838
if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171176171839
}
171177171840
break;
171178
- case 205: /* expr ::= expr ISNULL|NOTNULL */
171841
+ case 204: /* expr ::= expr ISNULL|NOTNULL */
171179171842
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171180171843
break;
171181
- case 206: /* expr ::= expr NOT NULL */
171844
+ case 205: /* expr ::= expr NOT NULL */
171182171845
{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171183171846
break;
171184
- case 207: /* expr ::= expr IS expr */
171847
+ case 206: /* expr ::= expr IS expr */
171185171848
{
171186171849
yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171187171850
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171188171851
}
171189171852
break;
171190
- case 208: /* expr ::= expr IS NOT expr */
171853
+ case 207: /* expr ::= expr IS NOT expr */
171191171854
{
171192171855
yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171193171856
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171194171857
}
171195171858
break;
171196
- case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */
171859
+ case 208: /* expr ::= expr IS NOT DISTINCT FROM expr */
171197171860
{
171198171861
yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171199171862
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171200171863
}
171201171864
break;
171202
- case 210: /* expr ::= expr IS DISTINCT FROM expr */
171865
+ case 209: /* expr ::= expr IS DISTINCT FROM expr */
171203171866
{
171204171867
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171205171868
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171206171869
}
171207171870
break;
171208
- case 211: /* expr ::= NOT expr */
171209
- case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212);
171871
+ case 210: /* expr ::= NOT expr */
171872
+ case 211: /* expr ::= BITNOT expr */ yytestcase(yyruleno==211);
171210171873
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171211171874
break;
171212
- case 213: /* expr ::= PLUS|MINUS expr */
171875
+ case 212: /* expr ::= PLUS|MINUS expr */
171213171876
{
171214171877
yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171215171878
/*A-overwrites-B*/
171216171879
}
171217171880
break;
171218
- case 214: /* expr ::= expr PTR expr */
171881
+ case 213: /* expr ::= expr PTR expr */
171219171882
{
171220171883
ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171221171884
pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171222171885
yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171223171886
}
171224171887
yymsp[-2].minor.yy528 = yylhsminor.yy528;
171225171888
break;
171226
- case 215: /* between_op ::= BETWEEN */
171227
- case 218: /* in_op ::= IN */ yytestcase(yyruleno==218);
171889
+ case 214: /* between_op ::= BETWEEN */
171890
+ case 217: /* in_op ::= IN */ yytestcase(yyruleno==217);
171228171891
{yymsp[0].minor.yy394 = 0;}
171229171892
break;
171230
- case 217: /* expr ::= expr between_op expr AND expr */
171893
+ case 216: /* expr ::= expr between_op expr AND expr */
171231171894
{
171232171895
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171233171896
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171234171897
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171235171898
if( yymsp[-4].minor.yy528 ){
@@ -171238,11 +171901,11 @@
171238171901
sqlite3ExprListDelete(pParse->db, pList);
171239171902
}
171240171903
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171241171904
}
171242171905
break;
171243
- case 220: /* expr ::= expr in_op LP exprlist RP */
171906
+ case 219: /* expr ::= expr in_op LP exprlist RP */
171244171907
{
171245171908
if( yymsp[-1].minor.yy322==0 ){
171246171909
/* Expressions of the form
171247171910
**
171248171911
** expr1 IN ()
@@ -171284,41 +171947,41 @@
171284171947
}
171285171948
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171286171949
}
171287171950
}
171288171951
break;
171289
- case 221: /* expr ::= LP select RP */
171952
+ case 220: /* expr ::= LP select RP */
171290171953
{
171291171954
yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171292171955
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171293171956
}
171294171957
break;
171295
- case 222: /* expr ::= expr in_op LP select RP */
171958
+ case 221: /* expr ::= expr in_op LP select RP */
171296171959
{
171297171960
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171298171961
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171299171962
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171300171963
}
171301171964
break;
171302
- case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */
171965
+ case 222: /* expr ::= expr in_op nm dbnm paren_exprlist */
171303171966
{
171304171967
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171305171968
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171306171969
if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171307171970
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171308171971
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171309171972
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171310171973
}
171311171974
break;
171312
- case 224: /* expr ::= EXISTS LP select RP */
171975
+ case 223: /* expr ::= EXISTS LP select RP */
171313171976
{
171314171977
Expr *p;
171315171978
p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171316171979
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171317171980
}
171318171981
break;
171319
- case 225: /* expr ::= CASE case_operand case_exprlist case_else END */
171982
+ case 224: /* expr ::= CASE case_operand case_exprlist case_else END */
171320171983
{
171321171984
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171322171985
if( yymsp[-4].minor.yy528 ){
171323171986
yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171324171987
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171326,406 +171989,406 @@
171326171989
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171327171990
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171328171991
}
171329171992
}
171330171993
break;
171331
- case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171994
+ case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171332171995
{
171333171996
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171334171997
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171335171998
}
171336171999
break;
171337
- case 227: /* case_exprlist ::= WHEN expr THEN expr */
172000
+ case 226: /* case_exprlist ::= WHEN expr THEN expr */
171338172001
{
171339172002
yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171340172003
yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
171341172004
}
171342172005
break;
171343
- case 230: /* case_operand ::= expr */
172006
+ case 229: /* case_operand ::= expr */
171344172007
{yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
171345172008
break;
171346
- case 233: /* nexprlist ::= nexprlist COMMA expr */
172009
+ case 232: /* nexprlist ::= nexprlist COMMA expr */
171347172010
{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
171348172011
break;
171349
- case 234: /* nexprlist ::= expr */
172012
+ case 233: /* nexprlist ::= expr */
171350172013
{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
171351172014
break;
171352
- case 236: /* paren_exprlist ::= LP exprlist RP */
171353
- 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);
171354172017
{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
171355172018
break;
171356
- 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 */
171357172020
{
171358172021
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
171359172022
sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
171360172023
&yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
171361172024
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
171362172025
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
171363172026
}
171364172027
}
171365172028
break;
171366
- case 238: /* uniqueflag ::= UNIQUE */
171367
- case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280);
172029
+ case 237: /* uniqueflag ::= UNIQUE */
172030
+ case 279: /* raisetype ::= ABORT */ yytestcase(yyruleno==279);
171368172031
{yymsp[0].minor.yy394 = OE_Abort;}
171369172032
break;
171370
- case 239: /* uniqueflag ::= */
172033
+ case 238: /* uniqueflag ::= */
171371172034
{yymsp[1].minor.yy394 = OE_None;}
171372172035
break;
171373
- case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */
172036
+ case 241: /* eidlist ::= eidlist COMMA nm collate sortorder */
171374172037
{
171375172038
yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
171376172039
}
171377172040
break;
171378
- case 243: /* eidlist ::= nm collate sortorder */
172041
+ case 242: /* eidlist ::= nm collate sortorder */
171379172042
{
171380172043
yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
171381172044
}
171382172045
break;
171383
- case 246: /* cmd ::= DROP INDEX ifexists fullname */
172046
+ case 245: /* cmd ::= DROP INDEX ifexists fullname */
171384172047
{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
171385172048
break;
171386
- case 247: /* cmd ::= VACUUM vinto */
172049
+ case 246: /* cmd ::= VACUUM vinto */
171387172050
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
171388172051
break;
171389
- case 248: /* cmd ::= VACUUM nm vinto */
172052
+ case 247: /* cmd ::= VACUUM nm vinto */
171390172053
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
171391172054
break;
171392
- case 251: /* cmd ::= PRAGMA nm dbnm */
172055
+ case 250: /* cmd ::= PRAGMA nm dbnm */
171393172056
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
171394172057
break;
171395
- case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
172058
+ case 251: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171396172059
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
171397172060
break;
171398
- case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
172061
+ case 252: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171399172062
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
171400172063
break;
171401
- case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
172064
+ case 253: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171402172065
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
171403172066
break;
171404
- case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
172067
+ case 254: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171405172068
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
171406172069
break;
171407
- case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
172070
+ case 257: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171408172071
{
171409172072
Token all;
171410172073
all.z = yymsp[-3].minor.yy0.z;
171411172074
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
171412172075
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
171413172076
}
171414172077
break;
171415
- 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 */
171416172079
{
171417172080
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);
171418172081
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
171419172082
}
171420172083
break;
171421
- case 260: /* trigger_time ::= BEFORE|AFTER */
172084
+ case 259: /* trigger_time ::= BEFORE|AFTER */
171422172085
{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
171423172086
break;
171424
- case 261: /* trigger_time ::= INSTEAD OF */
172087
+ case 260: /* trigger_time ::= INSTEAD OF */
171425172088
{ yymsp[-1].minor.yy394 = TK_INSTEAD;}
171426172089
break;
171427
- case 262: /* trigger_time ::= */
172090
+ case 261: /* trigger_time ::= */
171428172091
{ yymsp[1].minor.yy394 = TK_BEFORE; }
171429172092
break;
171430
- case 263: /* trigger_event ::= DELETE|INSERT */
171431
- case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264);
172093
+ case 262: /* trigger_event ::= DELETE|INSERT */
172094
+ case 263: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==263);
171432172095
{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
171433172096
break;
171434
- case 265: /* trigger_event ::= UPDATE OF idlist */
172097
+ case 264: /* trigger_event ::= UPDATE OF idlist */
171435172098
{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
171436172099
break;
171437
- case 266: /* when_clause ::= */
171438
- case 285: /* key_opt ::= */ yytestcase(yyruleno==285);
172100
+ case 265: /* when_clause ::= */
172101
+ case 284: /* key_opt ::= */ yytestcase(yyruleno==284);
171439172102
{ yymsp[1].minor.yy528 = 0; }
171440172103
break;
171441
- case 267: /* when_clause ::= WHEN expr */
171442
- 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);
171443172106
{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
171444172107
break;
171445
- case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
172108
+ case 267: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171446172109
{
171447172110
assert( yymsp[-2].minor.yy33!=0 );
171448172111
yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
171449172112
yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
171450172113
}
171451172114
break;
171452
- case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */
172115
+ case 268: /* trigger_cmd_list ::= trigger_cmd SEMI */
171453172116
{
171454172117
assert( yymsp[-1].minor.yy33!=0 );
171455172118
yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
171456172119
}
171457172120
break;
171458
- case 270: /* trnm ::= nm DOT nm */
172121
+ case 269: /* trnm ::= nm DOT nm */
171459172122
{
171460172123
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
171461172124
sqlite3ErrorMsg(pParse,
171462172125
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
171463172126
"statements within triggers");
171464172127
}
171465172128
break;
171466
- case 271: /* tridxby ::= INDEXED BY nm */
172129
+ case 270: /* tridxby ::= INDEXED BY nm */
171467172130
{
171468172131
sqlite3ErrorMsg(pParse,
171469172132
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
171470172133
"within triggers");
171471172134
}
171472172135
break;
171473
- case 272: /* tridxby ::= NOT INDEXED */
172136
+ case 271: /* tridxby ::= NOT INDEXED */
171474172137
{
171475172138
sqlite3ErrorMsg(pParse,
171476172139
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
171477172140
"within triggers");
171478172141
}
171479172142
break;
171480
- 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 */
171481172144
{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);}
171482172145
yymsp[-8].minor.yy33 = yylhsminor.yy33;
171483172146
break;
171484
- 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 */
171485172148
{
171486172149
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*/
171487172150
}
171488172151
yymsp[-7].minor.yy33 = yylhsminor.yy33;
171489172152
break;
171490
- case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
172153
+ case 274: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171491172154
{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
171492172155
yymsp[-5].minor.yy33 = yylhsminor.yy33;
171493172156
break;
171494
- case 276: /* trigger_cmd ::= scanpt select scanpt */
172157
+ case 275: /* trigger_cmd ::= scanpt select scanpt */
171495172158
{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
171496172159
yymsp[-2].minor.yy33 = yylhsminor.yy33;
171497172160
break;
171498
- case 277: /* expr ::= RAISE LP IGNORE RP */
172161
+ case 276: /* expr ::= RAISE LP IGNORE RP */
171499172162
{
171500172163
yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
171501172164
if( yymsp[-3].minor.yy528 ){
171502172165
yymsp[-3].minor.yy528->affExpr = OE_Ignore;
171503172166
}
171504172167
}
171505172168
break;
171506
- case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */
172169
+ case 277: /* expr ::= RAISE LP raisetype COMMA nm RP */
171507172170
{
171508172171
yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
171509172172
if( yymsp[-5].minor.yy528 ) {
171510172173
yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
171511172174
}
171512172175
}
171513172176
break;
171514
- case 279: /* raisetype ::= ROLLBACK */
172177
+ case 278: /* raisetype ::= ROLLBACK */
171515172178
{yymsp[0].minor.yy394 = OE_Rollback;}
171516172179
break;
171517
- case 281: /* raisetype ::= FAIL */
172180
+ case 280: /* raisetype ::= FAIL */
171518172181
{yymsp[0].minor.yy394 = OE_Fail;}
171519172182
break;
171520
- case 282: /* cmd ::= DROP TRIGGER ifexists fullname */
172183
+ case 281: /* cmd ::= DROP TRIGGER ifexists fullname */
171521172184
{
171522172185
sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
171523172186
}
171524172187
break;
171525
- 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 */
171526172189
{
171527172190
sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
171528172191
}
171529172192
break;
171530
- case 284: /* cmd ::= DETACH database_kw_opt expr */
172193
+ case 283: /* cmd ::= DETACH database_kw_opt expr */
171531172194
{
171532172195
sqlite3Detach(pParse, yymsp[0].minor.yy528);
171533172196
}
171534172197
break;
171535
- case 287: /* cmd ::= REINDEX */
172198
+ case 286: /* cmd ::= REINDEX */
171536172199
{sqlite3Reindex(pParse, 0, 0);}
171537172200
break;
171538
- case 288: /* cmd ::= REINDEX nm dbnm */
172201
+ case 287: /* cmd ::= REINDEX nm dbnm */
171539172202
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171540172203
break;
171541
- case 289: /* cmd ::= ANALYZE */
172204
+ case 288: /* cmd ::= ANALYZE */
171542172205
{sqlite3Analyze(pParse, 0, 0);}
171543172206
break;
171544
- case 290: /* cmd ::= ANALYZE nm dbnm */
172207
+ case 289: /* cmd ::= ANALYZE nm dbnm */
171545172208
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171546172209
break;
171547
- case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
172210
+ case 290: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
171548172211
{
171549172212
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
171550172213
}
171551172214
break;
171552
- 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 */
171553172216
{
171554172217
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
171555172218
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
171556172219
}
171557172220
break;
171558
- case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
172221
+ case 292: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
171559172222
{
171560172223
sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
171561172224
}
171562172225
break;
171563
- case 294: /* add_column_fullname ::= fullname */
172226
+ case 293: /* add_column_fullname ::= fullname */
171564172227
{
171565172228
disableLookaside(pParse);
171566172229
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
171567172230
}
171568172231
break;
171569
- 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 */
171570172233
{
171571172234
sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
171572172235
}
171573172236
break;
171574
- case 296: /* cmd ::= create_vtab */
172237
+ case 295: /* cmd ::= create_vtab */
171575172238
{sqlite3VtabFinishParse(pParse,0);}
171576172239
break;
171577
- case 297: /* cmd ::= create_vtab LP vtabarglist RP */
172240
+ case 296: /* cmd ::= create_vtab LP vtabarglist RP */
171578172241
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
171579172242
break;
171580
- 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 */
171581172244
{
171582172245
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
171583172246
}
171584172247
break;
171585
- case 299: /* vtabarg ::= */
172248
+ case 298: /* vtabarg ::= */
171586172249
{sqlite3VtabArgInit(pParse);}
171587172250
break;
171588
- case 300: /* vtabargtoken ::= ANY */
171589
- case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301);
171590
- 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);
171591172254
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
171592172255
break;
171593
- case 303: /* with ::= WITH wqlist */
171594
- 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);
171595172258
{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
171596172259
break;
171597
- case 305: /* wqas ::= AS */
172260
+ case 304: /* wqas ::= AS */
171598172261
{yymsp[0].minor.yy516 = M10d_Any;}
171599172262
break;
171600
- case 306: /* wqas ::= AS MATERIALIZED */
172263
+ case 305: /* wqas ::= AS MATERIALIZED */
171601172264
{yymsp[-1].minor.yy516 = M10d_Yes;}
171602172265
break;
171603
- case 307: /* wqas ::= AS NOT MATERIALIZED */
172266
+ case 306: /* wqas ::= AS NOT MATERIALIZED */
171604172267
{yymsp[-2].minor.yy516 = M10d_No;}
171605172268
break;
171606
- case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */
172269
+ case 307: /* wqitem ::= nm eidlist_opt wqas LP select RP */
171607172270
{
171608172271
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*/
171609172272
}
171610172273
break;
171611
- case 309: /* wqlist ::= wqitem */
172274
+ case 308: /* wqlist ::= wqitem */
171612172275
{
171613172276
yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
171614172277
}
171615172278
break;
171616
- case 310: /* wqlist ::= wqlist COMMA wqitem */
172279
+ case 309: /* wqlist ::= wqlist COMMA wqitem */
171617172280
{
171618172281
yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
171619172282
}
171620172283
break;
171621
- case 311: /* windowdefn_list ::= windowdefn */
172284
+ case 310: /* windowdefn_list ::= windowdefn */
171622172285
{ yylhsminor.yy41 = yymsp[0].minor.yy41; }
171623172286
yymsp[0].minor.yy41 = yylhsminor.yy41;
171624172287
break;
171625
- case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
172288
+ case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
171626172289
{
171627172290
assert( yymsp[0].minor.yy41!=0 );
171628172291
sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
171629172292
yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
171630172293
yylhsminor.yy41 = yymsp[0].minor.yy41;
171631172294
}
171632172295
yymsp[-2].minor.yy41 = yylhsminor.yy41;
171633172296
break;
171634
- case 313: /* windowdefn ::= nm AS LP window RP */
172297
+ case 312: /* windowdefn ::= nm AS LP window RP */
171635172298
{
171636172299
if( ALWAYS(yymsp[-1].minor.yy41) ){
171637172300
yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
171638172301
}
171639172302
yylhsminor.yy41 = yymsp[-1].minor.yy41;
171640172303
}
171641172304
yymsp[-4].minor.yy41 = yylhsminor.yy41;
171642172305
break;
171643
- case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
172306
+ case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
171644172307
{
171645172308
yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
171646172309
}
171647172310
break;
171648
- case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
172311
+ case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
171649172312
{
171650172313
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
171651172314
}
171652172315
yymsp[-5].minor.yy41 = yylhsminor.yy41;
171653172316
break;
171654
- case 316: /* window ::= ORDER BY sortlist frame_opt */
172317
+ case 315: /* window ::= ORDER BY sortlist frame_opt */
171655172318
{
171656172319
yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
171657172320
}
171658172321
break;
171659
- case 317: /* window ::= nm ORDER BY sortlist frame_opt */
172322
+ case 316: /* window ::= nm ORDER BY sortlist frame_opt */
171660172323
{
171661172324
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
171662172325
}
171663172326
yymsp[-4].minor.yy41 = yylhsminor.yy41;
171664172327
break;
171665
- case 318: /* window ::= frame_opt */
171666
- 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);
171667172330
{
171668172331
yylhsminor.yy41 = yymsp[0].minor.yy41;
171669172332
}
171670172333
yymsp[0].minor.yy41 = yylhsminor.yy41;
171671172334
break;
171672
- case 319: /* window ::= nm frame_opt */
172335
+ case 318: /* window ::= nm frame_opt */
171673172336
{
171674172337
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
171675172338
}
171676172339
yymsp[-1].minor.yy41 = yylhsminor.yy41;
171677172340
break;
171678
- case 320: /* frame_opt ::= */
172341
+ case 319: /* frame_opt ::= */
171679172342
{
171680172343
yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
171681172344
}
171682172345
break;
171683
- 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 */
171684172347
{
171685172348
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);
171686172349
}
171687172350
yymsp[-2].minor.yy41 = yylhsminor.yy41;
171688172351
break;
171689
- 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 */
171690172353
{
171691172354
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);
171692172355
}
171693172356
yymsp[-5].minor.yy41 = yylhsminor.yy41;
171694172357
break;
171695
- case 324: /* frame_bound_s ::= frame_bound */
171696
- 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);
171697172360
{yylhsminor.yy595 = yymsp[0].minor.yy595;}
171698172361
yymsp[0].minor.yy595 = yylhsminor.yy595;
171699172362
break;
171700
- case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */
171701
- case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327);
171702
- 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);
171703172366
{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
171704172367
yymsp[-1].minor.yy595 = yylhsminor.yy595;
171705172368
break;
171706
- case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */
172369
+ case 327: /* frame_bound ::= expr PRECEDING|FOLLOWING */
171707172370
{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
171708172371
yymsp[-1].minor.yy595 = yylhsminor.yy595;
171709172372
break;
171710
- case 330: /* frame_exclude_opt ::= */
172373
+ case 329: /* frame_exclude_opt ::= */
171711172374
{yymsp[1].minor.yy516 = 0;}
171712172375
break;
171713
- case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
172376
+ case 330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
171714172377
{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
171715172378
break;
171716
- case 332: /* frame_exclude ::= NO OTHERS */
171717
- 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);
171718172381
{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
171719172382
break;
171720
- case 334: /* frame_exclude ::= GROUP|TIES */
172383
+ case 333: /* frame_exclude ::= GROUP|TIES */
171721172384
{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
171722172385
break;
171723
- case 335: /* window_clause ::= WINDOW windowdefn_list */
172386
+ case 334: /* window_clause ::= WINDOW windowdefn_list */
171724172387
{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
171725172388
break;
171726
- case 336: /* filter_over ::= filter_clause over_clause */
172389
+ case 335: /* filter_over ::= filter_clause over_clause */
171727172390
{
171728172391
if( yymsp[0].minor.yy41 ){
171729172392
yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
171730172393
}else{
171731172394
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171732,11 +172395,11 @@
171732172395
}
171733172396
yylhsminor.yy41 = yymsp[0].minor.yy41;
171734172397
}
171735172398
yymsp[-1].minor.yy41 = yylhsminor.yy41;
171736172399
break;
171737
- case 338: /* filter_over ::= filter_clause */
172400
+ case 337: /* filter_over ::= filter_clause */
171738172401
{
171739172402
yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171740172403
if( yylhsminor.yy41 ){
171741172404
yylhsminor.yy41->eFrmType = TK_FILTER;
171742172405
yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171744,91 +172407,90 @@
171744172407
sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
171745172408
}
171746172409
}
171747172410
yymsp[0].minor.yy41 = yylhsminor.yy41;
171748172411
break;
171749
- case 339: /* over_clause ::= OVER LP window RP */
172412
+ case 338: /* over_clause ::= OVER LP window RP */
171750172413
{
171751172414
yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
171752172415
assert( yymsp[-3].minor.yy41!=0 );
171753172416
}
171754172417
break;
171755
- case 340: /* over_clause ::= OVER nm */
172418
+ case 339: /* over_clause ::= OVER nm */
171756172419
{
171757172420
yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171758172421
if( yymsp[-1].minor.yy41 ){
171759172422
yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
171760172423
}
171761172424
}
171762172425
break;
171763
- case 341: /* filter_clause ::= FILTER LP WHERE expr RP */
172426
+ case 340: /* filter_clause ::= FILTER LP WHERE expr RP */
171764172427
{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
171765172428
break;
171766172429
default:
171767
- /* (342) input ::= cmdlist */ yytestcase(yyruleno==342);
171768
- /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343);
171769
- /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344);
171770
- /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345);
171771
- /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346);
171772
- /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347);
171773
- /* (348) trans_opt ::= */ yytestcase(yyruleno==348);
171774
- /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349);
171775
- /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350);
171776
- /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351);
171777
- /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352);
171778
- /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353);
171779
- /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354);
171780
- /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355);
171781
- /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356);
171782
- /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357);
171783
- /* (358) nm ::= STRING */ yytestcase(yyruleno==358);
171784
- /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359);
171785
- /* (360) typetoken ::= typename */ yytestcase(yyruleno==360);
171786
- /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361);
171787
- /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362);
171788
- /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363);
171789
- /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364);
171790
- /* (365) carglist ::= */ yytestcase(yyruleno==365);
171791
- /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366);
171792
- /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367);
171793
- /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368);
171794
- /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369);
171795
- /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370);
171796
- /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371);
171797
- /* (372) tconscomma ::= */ yytestcase(yyruleno==372);
171798
- /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373);
171799
- /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374);
171800
- /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375);
171801
- /* (376) oneselect ::= values */ yytestcase(yyruleno==376);
171802
- /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377);
171803
- /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378);
171804
- /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379);
171805
- /* (380) returning ::= */ yytestcase(yyruleno==380);
171806
- /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381);
171807
- /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382);
171808
- /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383);
171809
- /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384);
171810
- /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385);
171811
- /* (386) nmnum ::= ON */ yytestcase(yyruleno==386);
171812
- /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387);
171813
- /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388);
171814
- /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389);
171815
- /* (390) foreach_clause ::= */ yytestcase(yyruleno==390);
171816
- /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391);
171817
- /* (392) trnm ::= nm */ yytestcase(yyruleno==392);
171818
- /* (393) tridxby ::= */ yytestcase(yyruleno==393);
171819
- /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394);
171820
- /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395);
171821
- /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396);
171822
- /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397);
171823
- /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398);
171824
- /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399);
171825
- /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400);
171826
- /* (401) anylist ::= */ yytestcase(yyruleno==401);
171827
- /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402);
171828
- /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403);
171829
- /* (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);
171830172492
break;
171831172493
/********** End reduce actions ************************************************/
171832172494
};
171833172495
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
171834172496
yygoto = yyRuleInfoLhs[yyruleno];
@@ -172400,11 +173062,11 @@
172400173062
132, 0, 98, 38, 39, 0, 20, 45, 117, 93,
172401173063
};
172402173064
/* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
172403173065
** then the i-th keyword has no more hash collisions. Otherwise,
172404173066
** the next keyword with the same hash is aKWHash[i]-1. */
172405
-static const unsigned char aKWNext[147] = {
173067
+static const unsigned char aKWNext[148] = {0,
172406173068
0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0,
172407173069
0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0,
172408173070
141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0,
172409173071
138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
172410173072
0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -172415,11 +173077,11 @@
172415173077
112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0,
172416173078
99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0,
172417173079
102, 0, 0, 87,
172418173080
};
172419173081
/* aKWLen[i] is the length (in bytes) of the i-th keyword */
172420
-static const unsigned char aKWLen[147] = {
173082
+static const unsigned char aKWLen[148] = {0,
172421173083
7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
172422173084
7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
172423173085
6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
172424173086
4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
172425173087
2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
@@ -172431,11 +173093,11 @@
172431173093
4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2,
172432173094
2, 9, 3, 7,
172433173095
};
172434173096
/* aKWOffset[i] is the index into zKWText[] of the start of
172435173097
** the text for the i-th keyword. */
172436
-static const unsigned short int aKWOffset[147] = {
173098
+static const unsigned short int aKWOffset[148] = {0,
172437173099
0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
172438173100
36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
172439173101
86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
172440173102
129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
172441173103
184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
@@ -172446,11 +173108,11 @@
172446173108
520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579,
172447173109
585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645,
172448173110
648, 650, 655, 659,
172449173111
};
172450173112
/* aKWCode[i] is the parser symbol code for the i-th keyword */
172451
-static const unsigned char aKWCode[147] = {
173113
+static const unsigned char aKWCode[148] = {0,
172452173114
TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
172453173115
TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
172454173116
TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
172455173117
TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
172456173118
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -172615,11 +173277,11 @@
172615173277
static int keywordCode(const char *z, int n, int *pType){
172616173278
int i, j;
172617173279
const char *zKW;
172618173280
if( n>=2 ){
172619173281
i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
172620
- for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
173282
+ for(i=(int)aKWHash[i]; i>0; i=aKWNext[i]){
172621173283
if( aKWLen[i]!=n ) continue;
172622173284
zKW = &zKWText[aKWOffset[i]];
172623173285
#ifdef SQLITE_ASCII
172624173286
if( (z[0]&~0x20)!=zKW[0] ) continue;
172625173287
if( (z[1]&~0x20)!=zKW[1] ) continue;
@@ -172631,157 +173293,157 @@
172631173293
if( toupper(z[1])!=zKW[1] ) continue;
172632173294
j = 2;
172633173295
while( j<n && toupper(z[j])==zKW[j] ){ j++; }
172634173296
#endif
172635173297
if( j<n ) continue;
172636
- testcase( i==0 ); /* REINDEX */
172637
- testcase( i==1 ); /* INDEXED */
172638
- testcase( i==2 ); /* INDEX */
172639
- testcase( i==3 ); /* DESC */
172640
- testcase( i==4 ); /* ESCAPE */
172641
- testcase( i==5 ); /* EACH */
172642
- testcase( i==6 ); /* CHECK */
172643
- testcase( i==7 ); /* KEY */
172644
- testcase( i==8 ); /* BEFORE */
172645
- testcase( i==9 ); /* FOREIGN */
172646
- testcase( i==10 ); /* FOR */
172647
- testcase( i==11 ); /* IGNORE */
172648
- testcase( i==12 ); /* REGEXP */
172649
- testcase( i==13 ); /* EXPLAIN */
172650
- testcase( i==14 ); /* INSTEAD */
172651
- testcase( i==15 ); /* ADD */
172652
- testcase( i==16 ); /* DATABASE */
172653
- testcase( i==17 ); /* AS */
172654
- testcase( i==18 ); /* SELECT */
172655
- testcase( i==19 ); /* TABLE */
172656
- testcase( i==20 ); /* LEFT */
172657
- testcase( i==21 ); /* THEN */
172658
- testcase( i==22 ); /* END */
172659
- testcase( i==23 ); /* DEFERRABLE */
172660
- testcase( i==24 ); /* ELSE */
172661
- testcase( i==25 ); /* EXCLUDE */
172662
- testcase( i==26 ); /* DELETE */
172663
- testcase( i==27 ); /* TEMPORARY */
172664
- testcase( i==28 ); /* TEMP */
172665
- testcase( i==29 ); /* OR */
172666
- testcase( i==30 ); /* ISNULL */
172667
- testcase( i==31 ); /* NULLS */
172668
- testcase( i==32 ); /* SAVEPOINT */
172669
- testcase( i==33 ); /* INTERSECT */
172670
- testcase( i==34 ); /* TIES */
172671
- testcase( i==35 ); /* NOTNULL */
172672
- testcase( i==36 ); /* NOT */
172673
- testcase( i==37 ); /* NO */
172674
- testcase( i==38 ); /* NULL */
172675
- testcase( i==39 ); /* LIKE */
172676
- testcase( i==40 ); /* EXCEPT */
172677
- testcase( i==41 ); /* TRANSACTION */
172678
- testcase( i==42 ); /* ACTION */
172679
- testcase( i==43 ); /* ON */
172680
- testcase( i==44 ); /* NATURAL */
172681
- testcase( i==45 ); /* ALTER */
172682
- testcase( i==46 ); /* RAISE */
172683
- testcase( i==47 ); /* EXCLUSIVE */
172684
- testcase( i==48 ); /* EXISTS */
172685
- testcase( i==49 ); /* CONSTRAINT */
172686
- testcase( i==50 ); /* INTO */
172687
- testcase( i==51 ); /* OFFSET */
172688
- testcase( i==52 ); /* OF */
172689
- testcase( i==53 ); /* SET */
172690
- testcase( i==54 ); /* TRIGGER */
172691
- testcase( i==55 ); /* RANGE */
172692
- testcase( i==56 ); /* GENERATED */
172693
- testcase( i==57 ); /* DETACH */
172694
- testcase( i==58 ); /* HAVING */
172695
- testcase( i==59 ); /* GLOB */
172696
- testcase( i==60 ); /* BEGIN */
172697
- testcase( i==61 ); /* INNER */
172698
- testcase( i==62 ); /* REFERENCES */
172699
- testcase( i==63 ); /* UNIQUE */
172700
- testcase( i==64 ); /* QUERY */
172701
- testcase( i==65 ); /* WITHOUT */
172702
- testcase( i==66 ); /* WITH */
172703
- testcase( i==67 ); /* OUTER */
172704
- testcase( i==68 ); /* RELEASE */
172705
- testcase( i==69 ); /* ATTACH */
172706
- testcase( i==70 ); /* BETWEEN */
172707
- testcase( i==71 ); /* NOTHING */
172708
- testcase( i==72 ); /* GROUPS */
172709
- testcase( i==73 ); /* GROUP */
172710
- testcase( i==74 ); /* CASCADE */
172711
- testcase( i==75 ); /* ASC */
172712
- testcase( i==76 ); /* DEFAULT */
172713
- testcase( i==77 ); /* CASE */
172714
- testcase( i==78 ); /* COLLATE */
172715
- testcase( i==79 ); /* CREATE */
172716
- testcase( i==80 ); /* CURRENT_DATE */
172717
- testcase( i==81 ); /* IMMEDIATE */
172718
- testcase( i==82 ); /* JOIN */
172719
- testcase( i==83 ); /* INSERT */
172720
- testcase( i==84 ); /* MATCH */
172721
- testcase( i==85 ); /* PLAN */
172722
- testcase( i==86 ); /* ANALYZE */
172723
- testcase( i==87 ); /* PRAGMA */
172724
- testcase( i==88 ); /* MATERIALIZED */
172725
- testcase( i==89 ); /* DEFERRED */
172726
- testcase( i==90 ); /* DISTINCT */
172727
- testcase( i==91 ); /* IS */
172728
- testcase( i==92 ); /* UPDATE */
172729
- testcase( i==93 ); /* VALUES */
172730
- testcase( i==94 ); /* VIRTUAL */
172731
- testcase( i==95 ); /* ALWAYS */
172732
- testcase( i==96 ); /* WHEN */
172733
- testcase( i==97 ); /* WHERE */
172734
- testcase( i==98 ); /* RECURSIVE */
172735
- testcase( i==99 ); /* ABORT */
172736
- testcase( i==100 ); /* AFTER */
172737
- testcase( i==101 ); /* RENAME */
172738
- testcase( i==102 ); /* AND */
172739
- testcase( i==103 ); /* DROP */
172740
- testcase( i==104 ); /* PARTITION */
172741
- testcase( i==105 ); /* AUTOINCREMENT */
172742
- testcase( i==106 ); /* TO */
172743
- testcase( i==107 ); /* IN */
172744
- testcase( i==108 ); /* CAST */
172745
- testcase( i==109 ); /* COLUMN */
172746
- testcase( i==110 ); /* COMMIT */
172747
- testcase( i==111 ); /* CONFLICT */
172748
- testcase( i==112 ); /* CROSS */
172749
- testcase( i==113 ); /* CURRENT_TIMESTAMP */
172750
- testcase( i==114 ); /* CURRENT_TIME */
172751
- testcase( i==115 ); /* CURRENT */
172752
- testcase( i==116 ); /* PRECEDING */
172753
- testcase( i==117 ); /* FAIL */
172754
- testcase( i==118 ); /* LAST */
172755
- testcase( i==119 ); /* FILTER */
172756
- testcase( i==120 ); /* REPLACE */
172757
- testcase( i==121 ); /* FIRST */
172758
- testcase( i==122 ); /* FOLLOWING */
172759
- testcase( i==123 ); /* FROM */
172760
- testcase( i==124 ); /* FULL */
172761
- testcase( i==125 ); /* LIMIT */
172762
- testcase( i==126 ); /* IF */
172763
- testcase( i==127 ); /* ORDER */
172764
- testcase( i==128 ); /* RESTRICT */
172765
- testcase( i==129 ); /* OTHERS */
172766
- testcase( i==130 ); /* OVER */
172767
- testcase( i==131 ); /* RETURNING */
172768
- testcase( i==132 ); /* RIGHT */
172769
- testcase( i==133 ); /* ROLLBACK */
172770
- testcase( i==134 ); /* ROWS */
172771
- testcase( i==135 ); /* ROW */
172772
- testcase( i==136 ); /* UNBOUNDED */
172773
- testcase( i==137 ); /* UNION */
172774
- testcase( i==138 ); /* USING */
172775
- testcase( i==139 ); /* VACUUM */
172776
- testcase( i==140 ); /* VIEW */
172777
- testcase( i==141 ); /* WINDOW */
172778
- testcase( i==142 ); /* DO */
172779
- testcase( i==143 ); /* BY */
172780
- testcase( i==144 ); /* INITIALLY */
172781
- testcase( i==145 ); /* ALL */
172782
- 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 */
172783173445
*pType = aKWCode[i];
172784173446
break;
172785173447
}
172786173448
}
172787173449
return n;
@@ -172792,10 +173454,11 @@
172792173454
return id;
172793173455
}
172794173456
#define SQLITE_N_KEYWORD 147
172795173457
SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
172796173458
if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
173459
+ i++;
172797173460
*pzName = zKWText + aKWOffset[i];
172798173461
*pnName = aKWLen[i];
172799173462
return SQLITE_OK;
172800173463
}
172801173464
SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; }
@@ -174330,13 +174993,25 @@
174330174993
*/
174331174994
SQLITE_API int sqlite3_config(int op, ...){
174332174995
va_list ap;
174333174996
int rc = SQLITE_OK;
174334174997
174335
- /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
174336
- ** the SQLite library is in use. */
174337
- 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
+ }
174338175013
174339175014
va_start(ap, op);
174340175015
switch( op ){
174341175016
174342175017
/* Mutex configuration options are only available in a threadsafe
@@ -174401,10 +175076,11 @@
174401175076
if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
174402175077
*va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
174403175078
break;
174404175079
}
174405175080
case SQLITE_CONFIG_MEMSTATUS: {
175081
+ assert( !sqlite3GlobalConfig.isInit ); /* Cannot change at runtime */
174406175082
/* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
174407175083
** single argument of type int, interpreted as a boolean, which enables
174408175084
** or disables the collection of memory allocation statistics. */
174409175085
sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
174410175086
break;
@@ -174524,12 +175200,14 @@
174524175200
/* MSVC is picky about pulling func ptrs from va lists.
174525175201
** http://support.microsoft.com/kb/47961
174526175202
** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
174527175203
*/
174528175204
typedef void(*LOGFUNC_t)(void*,int,const char*);
174529
- sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
174530
- 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);
174531175209
break;
174532175210
}
174533175211
174534175212
/* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
174535175213
** can be changed at start-time using the
@@ -174539,11 +175217,12 @@
174539175217
case SQLITE_CONFIG_URI: {
174540175218
/* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
174541175219
** argument of type int. If non-zero, then URI handling is globally
174542175220
** enabled. If the parameter is zero, then URI handling is globally
174543175221
** disabled. */
174544
- sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
175222
+ int bOpenUri = va_arg(ap, int);
175223
+ AtomicStore(&sqlite3GlobalConfig.bOpenUri, bOpenUri);
174545175224
break;
174546175225
}
174547175226
174548175227
case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
174549175228
/* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174854,10 +175533,12 @@
174854175533
{ SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
174855175534
{ SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
174856175535
{ SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
174857175536
{ SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
174858175537
{ SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
175538
+ { SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus },
175539
+ { SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder },
174859175540
};
174860175541
unsigned int i;
174861175542
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
174862175543
for(i=0; i<ArraySize(aFlagOp); i++){
174863175544
if( aFlagOp[i].op==op ){
@@ -176839,13 +177520,13 @@
176839177520
char c;
176840177521
int nUri = sqlite3Strlen30(zUri);
176841177522
176842177523
assert( *pzErrMsg==0 );
176843177524
176844
- if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
176845
- || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
176846
- && 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 */
176847177528
){
176848177529
char *zOpt;
176849177530
int eState; /* Parser state when parsing URI */
176850177531
int iIn; /* Input character index */
176851177532
int iOut = 0; /* Output character index */
@@ -177247,10 +177928,13 @@
177247177928
#if defined(SQLITE_DEFAULT_DEFENSIVE)
177248177929
| SQLITE_Defensive
177249177930
#endif
177250177931
#if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177251177932
| SQLITE_LegacyAlter
177933
+#endif
177934
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
177935
+ | SQLITE_StmtScanStatus
177252177936
#endif
177253177937
;
177254177938
sqlite3HashInit(&db->aCollSeq);
177255177939
#ifndef SQLITE_OMIT_VIRTUALTABLE
177256177940
sqlite3HashInit(&db->aModule);
@@ -193016,20 +193700,22 @@
193016193700
static int fts3MsrBufferData(
193017193701
Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193018193702
char *pList,
193019193703
i64 nList
193020193704
){
193021
- if( nList>pMsr->nBuffer ){
193705
+ if( (nList+FTS3_NODE_PADDING)>pMsr->nBuffer ){
193022193706
char *pNew;
193023
- pMsr->nBuffer = nList*2;
193024
- pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
193707
+ int nNew = nList*2 + FTS3_NODE_PADDING;
193708
+ pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, nNew);
193025193709
if( !pNew ) return SQLITE_NOMEM;
193026193710
pMsr->aBuffer = pNew;
193711
+ pMsr->nBuffer = nNew;
193027193712
}
193028193713
193029193714
assert( nList>0 );
193030193715
memcpy(pMsr->aBuffer, pList, nList);
193716
+ memset(&pMsr->aBuffer[nList], 0, FTS3_NODE_PADDING);
193031193717
return SQLITE_OK;
193032193718
}
193033193719
193034193720
SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193035193721
Fts3Table *p, /* Virtual table handle */
@@ -199017,12 +199703,15 @@
199017199703
switch( sqlite3_value_type(pValue) ){
199018199704
case SQLITE_NULL: {
199019199705
jsonAppendRaw(p, "null", 4);
199020199706
break;
199021199707
}
199022
- case SQLITE_INTEGER:
199023199708
case SQLITE_FLOAT: {
199709
+ jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue));
199710
+ break;
199711
+ }
199712
+ case SQLITE_INTEGER: {
199024199713
const char *z = (const char*)sqlite3_value_text(pValue);
199025199714
u32 n = (u32)sqlite3_value_bytes(pValue);
199026199715
jsonAppendRaw(p, z, n);
199027199716
break;
199028199717
}
@@ -199464,10 +200153,31 @@
199464200153
int i;
199465200154
for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0;
199466200155
return 1;
199467200156
}
199468200157
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
+
199469200179
/*
199470200180
** Parse a single JSON value which begins at pParse->zJson[i]. Return the
199471200181
** index of the first character past the end of the value parsed.
199472200182
**
199473200183
** Return negative for a syntax error. Special cases: return -2 if the
@@ -199609,10 +200319,28 @@
199609200319
c = z[j+1];
199610200320
}
199611200321
if( c<'0' || c>'9' ) return -1;
199612200322
continue;
199613200323
}
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
199614200342
break;
199615200343
}
199616200344
if( z[j-1]<'0' ) return -1;
199617200345
jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT,
199618200346
j - i, &z[i]);
@@ -199622,10 +200350,24 @@
199622200350
}else if( c==']' ){
199623200351
return -3; /* End of [...] */
199624200352
}else if( c==0 ){
199625200353
return 0; /* End of file */
199626200354
}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
199627200369
return -1; /* Syntax error */
199628200370
}
199629200371
}
199630200372
199631200373
/*
@@ -212444,19 +213186,28 @@
212444213186
212445213187
iOff = (i64)(pFrame->iDbPage-1) * p->pgsz;
212446213188
p->rc = pDb->pMethods->xWrite(pDb, p->aBuf, p->pgsz, iOff);
212447213189
}
212448213190
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
212449213196
212450213197
/*
212451213198
** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if
212452213199
** successful, or an SQLite error code otherwise.
212453213200
*/
212454213201
static int rbuLockDatabase(sqlite3 *db){
212455213202
int rc = SQLITE_OK;
212456213203
sqlite3_file *fd = 0;
212457
- 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
+ }
212458213209
212459213210
if( fd->pMethods ){
212460213211
rc = fd->pMethods->xLock(fd, SQLITE_LOCK_SHARED);
212461213212
if( rc==SQLITE_OK ){
212462213213
rc = fd->pMethods->xLock(fd, SQLITE_LOCK_EXCLUSIVE);
@@ -215691,10 +216442,11 @@
215691216442
(void)argc;
215692216443
(void)argv;
215693216444
(void)pzErr;
215694216445
215695216446
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
216447
+ sqlite3_vtab_config(db, SQLITE_VTAB_USES_ALL_SCHEMAS);
215696216448
rc = sqlite3_declare_vtab(db,
215697216449
"CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
215698216450
if( rc==SQLITE_OK ){
215699216451
pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable));
215700216452
if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
@@ -215774,11 +216526,10 @@
215774216526
&& pIdxInfo->aOrderBy[0].iColumn<=0
215775216527
&& pIdxInfo->aOrderBy[0].desc==0
215776216528
){
215777216529
pIdxInfo->orderByConsumed = 1;
215778216530
}
215779
- sqlite3VtabUsesAllSchemas(pIdxInfo);
215780216531
return SQLITE_OK;
215781216532
}
215782216533
215783216534
/*
215784216535
** Open a new dbpagevfs cursor.
@@ -218163,13 +218914,14 @@
218163218914
SessionBuffer *p,
218164218915
const char *zStr,
218165218916
int *pRc
218166218917
){
218167218918
int nStr = sqlite3Strlen30(zStr);
218168
- if( 0==sessionBufferGrow(p, nStr, pRc) ){
218919
+ if( 0==sessionBufferGrow(p, nStr+1, pRc) ){
218169218920
memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218170218921
p->nBuf += nStr;
218922
+ p->aBuf[p->nBuf] = 0x00;
218171218923
}
218172218924
}
218173218925
218174218926
/*
218175218927
** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218186,10 +218938,31 @@
218186218938
){
218187218939
char aBuf[24];
218188218940
sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218189218941
sessionAppendStr(p, aBuf, pRc);
218190218942
}
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
+}
218191218964
218192218965
/*
218193218966
** This function is a no-op if *pRc is other than SQLITE_OK when it is
218194218967
** called. Otherwise, append the string zStr enclosed in quotes (") and
218195218968
** with any embedded quote characters escaped to the buffer. No
@@ -218201,11 +218974,11 @@
218201218974
static void sessionAppendIdent(
218202218975
SessionBuffer *p, /* Buffer to a append to */
218203218976
const char *zStr, /* String to quote, escape and append */
218204218977
int *pRc /* IN/OUT: Error code */
218205218978
){
218206
- int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1;
218979
+ int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2;
218207218980
if( 0==sessionBufferGrow(p, nStr, pRc) ){
218208218981
char *zOut = (char *)&p->aBuf[p->nBuf];
218209218982
const char *zIn = zStr;
218210218983
*zOut++ = '"';
218211218984
while( *zIn ){
@@ -218212,10 +218985,11 @@
218212218985
if( *zIn=='"' ) *zOut++ = '"';
218213218986
*zOut++ = *(zIn++);
218214218987
}
218215218988
*zOut++ = '"';
218216218989
p->nBuf = (int)((u8 *)zOut - p->aBuf);
218990
+ p->aBuf[p->nBuf] = 0x00;
218217218991
}
218218218992
}
218219218993
218220218994
/*
218221218995
** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218436,33 +219210,82 @@
218436219210
218437219211
/*
218438219212
** Formulate and prepare a SELECT statement to retrieve a row from table
218439219213
** zTab in database zDb based on its primary key. i.e.
218440219214
**
218441
-** 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>.
218442219222
*/
218443219223
static int sessionSelectStmt(
218444219224
sqlite3 *db, /* Database handle */
219225
+ int bIgnoreNoop,
218445219226
const char *zDb, /* Database name */
218446219227
const char *zTab, /* Table name */
218447219228
int nCol, /* Number of columns in table */
218448219229
const char **azCol, /* Names of table columns */
218449219230
u8 *abPK, /* PRIMARY KEY array */
218450219231
sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
218451219232
){
218452219233
int rc = SQLITE_OK;
218453219234
char *zSql = 0;
219235
+ const char *zSep = "";
219236
+ const char *zCols = "*";
218454219237
int nSql = -1;
219238
+ int i;
218455219239
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
218456219280
if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
218457219281
zSql = sqlite3_mprintf(
218458219282
"SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
218459219283
"idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
218460219284
);
218461219285
if( zSql==0 ) rc = SQLITE_NOMEM;
218462219286
}else{
218463
- int i;
218464219287
const char *zSep = "";
218465219288
SessionBuffer buf = {0, 0, 0};
218466219289
218467219290
sessionAppendStr(&buf, "SELECT * FROM ", &rc);
218468219291
sessionAppendIdent(&buf, zDb, &rc);
@@ -218479,15 +219302,19 @@
218479219302
}
218480219303
}
218481219304
zSql = (char*)buf.aBuf;
218482219305
nSql = buf.nBuf;
218483219306
}
219307
+#endif
218484219308
218485219309
if( rc==SQLITE_OK ){
218486219310
rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
218487219311
}
218488219312
sqlite3_free(zSql);
219313
+ sqlite3_free(nooptest.aBuf);
219314
+ sqlite3_free(pkfield.aBuf);
219315
+ sqlite3_free(pkvar.aBuf);
218489219316
return rc;
218490219317
}
218491219318
218492219319
/*
218493219320
** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218643,11 +219470,12 @@
218643219470
sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
218644219471
218645219472
/* Build and compile a statement to execute: */
218646219473
if( rc==SQLITE_OK ){
218647219474
rc = sessionSelectStmt(
218648
- db, pSession->zDb, zName, nCol, azCol, abPK, &pSel);
219475
+ db, 0, pSession->zDb, zName, nCol, azCol, abPK, &pSel
219476
+ );
218649219477
}
218650219478
218651219479
nNoop = buf.nBuf;
218652219480
for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
218653219481
SessionChange *p; /* Used to iterate through changes */
@@ -219832,10 +220660,11 @@
219832220660
int bInvertConstraints; /* Invert when iterating constraints buffer */
219833220661
SessionBuffer constraints; /* Deferred constraints are stored here */
219834220662
SessionBuffer rebase; /* Rebase information (if any) here */
219835220663
u8 bRebaseStarted; /* If table header is already in rebase */
219836220664
u8 bRebase; /* True to collect rebase information */
220665
+ u8 bIgnoreNoop; /* True to ignore no-op conflicts */
219837220666
};
219838220667
219839220668
/* Number of prepared UPDATE statements to cache. */
219840220669
#define SESSION_UPDATE_CACHE_SZ 12
219841220670
@@ -220082,12 +220911,13 @@
220082220911
static int sessionSelectRow(
220083220912
sqlite3 *db, /* Database handle */
220084220913
const char *zTab, /* Table name */
220085220914
SessionApplyCtx *p /* Session changeset-apply context */
220086220915
){
220087
- return sessionSelectStmt(
220088
- 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
+ );
220089220919
}
220090220920
220091220921
/*
220092220922
** Formulate and prepare an INSERT statement to add a record to table zTab.
220093220923
** For example:
@@ -220242,23 +221072,36 @@
220242221072
** new.* record to the SELECT statement. Or, if it points to a DELETE or
220243221073
** UPDATE, bind values from the old.* record.
220244221074
*/
220245221075
static int sessionSeekToRow(
220246221076
sqlite3_changeset_iter *pIter, /* Changeset iterator */
220247
- u8 *abPK, /* Primary key flags array */
220248
- sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
221077
+ SessionApplyCtx *p
220249221078
){
221079
+ sqlite3_stmt *pSelect = p->pSelect;
220250221080
int rc; /* Return code */
220251221081
int nCol; /* Number of columns in table */
220252221082
int op; /* Changset operation (SQLITE_UPDATE etc.) */
220253221083
const char *zDummy; /* Unused */
220254221084
221085
+ sqlite3_clear_bindings(pSelect);
220255221086
sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
220256221087
rc = sessionBindRow(pIter,
220257221088
op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
220258
- nCol, abPK, pSelect
221089
+ nCol, p->abPK, pSelect
220259221090
);
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
+ }
220260221103
220261221104
if( rc==SQLITE_OK ){
220262221105
rc = sqlite3_step(pSelect);
220263221106
if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
220264221107
}
@@ -220370,20 +221213,26 @@
220370221213
assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
220371221214
assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
220372221215
220373221216
/* Bind the new.* PRIMARY KEY values to the SELECT statement. */
220374221217
if( pbReplace ){
220375
- rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
221218
+ rc = sessionSeekToRow(pIter, p);
220376221219
}else{
220377221220
rc = SQLITE_OK;
220378221221
}
220379221222
220380221223
if( rc==SQLITE_ROW ){
220381221224
/* There exists another row with the new.* primary key. */
220382
- pIter->pConflict = p->pSelect;
220383
- res = xConflict(pCtx, eType, pIter);
220384
- 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
+ }
220385221234
rc = sqlite3_reset(p->pSelect);
220386221235
}else if( rc==SQLITE_OK ){
220387221236
if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
220388221237
/* Instead of invoking the conflict handler, append the change blob
220389221238
** to the SessionApplyCtx.constraints buffer. */
@@ -220487,11 +221336,11 @@
220487221336
}
220488221337
if( rc!=SQLITE_OK ) return rc;
220489221338
220490221339
sqlite3_step(p->pDelete);
220491221340
rc = sqlite3_reset(p->pDelete);
220492
- if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){
221341
+ if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 && p->bIgnoreNoop==0 ){
220493221342
rc = sessionConflictHandler(
220494221343
SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
220495221344
);
220496221345
}else if( (rc&0xff)==SQLITE_CONSTRAINT ){
220497221346
rc = sessionConflictHandler(
@@ -220544,11 +221393,11 @@
220544221393
assert( op==SQLITE_INSERT );
220545221394
if( p->bStat1 ){
220546221395
/* Check if there is a conflicting row. For sqlite_stat1, this needs
220547221396
** to be done using a SELECT, as there is no PRIMARY KEY in the
220548221397
** database schema to throw an exception if a duplicate is inserted. */
220549
- rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
221398
+ rc = sessionSeekToRow(pIter, p);
220550221399
if( rc==SQLITE_ROW ){
220551221400
rc = SQLITE_CONSTRAINT;
220552221401
sqlite3_reset(p->pSelect);
220553221402
}
220554221403
}
@@ -220721,10 +221570,11 @@
220721221570
220722221571
pIter->in.bNoDiscard = 1;
220723221572
memset(&sApply, 0, sizeof(sApply));
220724221573
sApply.bRebase = (ppRebase && pnRebase);
220725221574
sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
221575
+ sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP);
220726221576
sqlite3_mutex_enter(sqlite3_db_mutex(db));
220727221577
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
220728221578
rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
220729221579
}
220730221580
if( rc==SQLITE_OK ){
@@ -224977,11 +225827,11 @@
224977225827
UNUSED_PARAM2(pToken, nToken);
224978225828
224979225829
if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
224980225830
iPos = p->iPos++;
224981225831
224982
- if( p->iRangeEnd>0 ){
225832
+ if( p->iRangeEnd>=0 ){
224983225833
if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
224984225834
if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
224985225835
}
224986225836
224987225837
if( iPos==p->iter.iStart ){
@@ -224989,11 +225839,11 @@
224989225839
fts5HighlightAppend(&rc, p, p->zOpen, -1);
224990225840
p->iOff = iStartOff;
224991225841
}
224992225842
224993225843
if( iPos==p->iter.iEnd ){
224994
- if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){
225844
+ if( p->iRangeEnd>=0 && p->iter.iStart<p->iRangeStart ){
224995225845
fts5HighlightAppend(&rc, p, p->zOpen, -1);
224996225846
}
224997225847
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
224998225848
fts5HighlightAppend(&rc, p, p->zClose, -1);
224999225849
p->iOff = iEndOff;
@@ -225000,11 +225850,11 @@
225000225850
if( rc==SQLITE_OK ){
225001225851
rc = fts5CInstIterNext(&p->iter);
225002225852
}
225003225853
}
225004225854
225005
- if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
225855
+ if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){
225006225856
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225007225857
p->iOff = iEndOff;
225008225858
if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225009225859
fts5HighlightAppend(&rc, p, p->zClose, -1);
225010225860
}
@@ -225035,10 +225885,11 @@
225035225885
225036225886
iCol = sqlite3_value_int(apVal[0]);
225037225887
memset(&ctx, 0, sizeof(HighlightContext));
225038225888
ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225039225889
ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
225890
+ ctx.iRangeEnd = -1;
225040225891
rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225041225892
225042225893
if( ctx.zIn ){
225043225894
if( rc==SQLITE_OK ){
225044225895
rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225220,10 +226071,11 @@
225220226071
nCol = pApi->xColumnCount(pFts);
225221226072
memset(&ctx, 0, sizeof(HighlightContext));
225222226073
iCol = sqlite3_value_int(apVal[0]);
225223226074
ctx.zOpen = fts5ValueToText(apVal[1]);
225224226075
ctx.zClose = fts5ValueToText(apVal[2]);
226076
+ ctx.iRangeEnd = -1;
225225226077
zEllips = fts5ValueToText(apVal[3]);
225226226078
nToken = sqlite3_value_int(apVal[4]);
225227226079
225228226080
iBestCol = (iCol>=0 ? iCol : 0);
225229226081
nPhrase = pApi->xPhraseCount(pFts);
@@ -240169,11 +241021,11 @@
240169241021
int nArg, /* Number of args */
240170241022
sqlite3_value **apUnused /* Function arguments */
240171241023
){
240172241024
assert( nArg==0 );
240173241025
UNUSED_PARAM2(nArg, apUnused);
240174
- sqlite3_result_text(pCtx, "fts5: 2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d", -1, SQLITE_TRANSIENT);
241026
+ sqlite3_result_text(pCtx, "fts5: 2023-04-10 13:20:51 49ba030080dd00b4fdf788fd3da057b333e705fa0fe37d653e2461bf96ca3785", -1, SQLITE_TRANSIENT);
240175241027
}
240176241028
240177241029
/*
240178241030
** Return true if zName is the extension on one of the shadow tables used
240179241031
** by this module.
240180241032
--- 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.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.41.0"
456 #define SQLITE_VERSION_NUMBER 3041000
457 #define SQLITE_SOURCE_ID "2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d"
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 */
@@ -19154,10 +19234,11 @@
19154 Expr *pExpr; /* The expression contained in the index */
19155 int iDataCur; /* The data cursor associated with the index */
19156 int iIdxCur; /* The index cursor */
19157 int iIdxCol; /* The index column that contains value of pExpr */
19158 u8 bMaybeNullRow; /* True if we need an OP_IfNullRow check */
 
19159 IndexedExpr *pIENext; /* Next in a list of all indexed expressions */
19160 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
19161 const char *zIdxName; /* Name of index, used only for bytecode comments */
19162 #endif
19163 };
@@ -19206,10 +19287,13 @@
19206 u8 prepFlags; /* SQLITE_PREPARE_* flags */
19207 u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
19208 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
19209 u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
19210 #endif
 
 
 
19211 int nRangeReg; /* Size of the temporary register block */
19212 int iRangeReg; /* First register in temporary register block */
19213 int nErr; /* Number of errors seen */
19214 int nTab; /* Number of previously allocated VDBE cursors */
19215 int nMem; /* Number of memory cells used so far */
@@ -19666,10 +19750,11 @@
19666 struct RenameCtx *pRename; /* RENAME COLUMN context */
19667 struct Table *pTab; /* Table of generated column */
19668 struct CoveringIndexCheck *pCovIdxCk; /* Check for covering index */
19669 SrcItem *pSrcItem; /* A single FROM clause item */
19670 DbFixer *pFix; /* See sqlite3FixSelect() */
 
19671 } u;
19672 };
19673
19674 /*
19675 ** The following structure contains information used by the sqliteFix...
@@ -20137,10 +20222,14 @@
20137 SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
20138 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
20139 SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
20140 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
20141 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
 
 
 
 
20142 #ifdef SQLITE_DEBUG
20143 SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
20144 #endif
20145 SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
20146 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20287,11 +20376,11 @@
20287 SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
20288 SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
20289 Expr*,ExprList*,u32,Expr*);
20290 SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
20291 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20292 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
20293 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
20294 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
20295 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
20296 #endif
20297 SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -20824,14 +20913,11 @@
20824 SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
20825 SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
20826 SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *);
20827
20828 SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20829 #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
20830 && !defined(SQLITE_OMIT_VIRTUALTABLE)
20831 SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info*);
20832 #endif
20833 SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
20834 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
20835 SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
20836 SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*);
20837 SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*);
@@ -21073,10 +21159,16 @@
21073 #if defined(VDBE_PROFILE) \
21074 || defined(SQLITE_PERFORMANCE_TRACE) \
21075 || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
21076 SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
21077 #endif
 
 
 
 
 
 
21078
21079 #endif /* SQLITEINT_H */
21080
21081 /************** End of sqliteInt.h *******************************************/
21082 /************** Begin file os_common.h ***************************************/
@@ -22263,11 +22355,11 @@
22263 0, /* xAltLocaltime */
22264 0x7ffffffe, /* iOnceResetThreshold */
22265 SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
22266 0, /* iPrngSeed */
22267 #ifdef SQLITE_DEBUG
22268 {0,0,0,0,0,0} /* aTune */
22269 #endif
22270 };
22271
22272 /*
22273 ** Hash table for global functions - functions common to all
@@ -30068,10 +30160,24 @@
30068 *val = (*val - d)*10.0;
30069 return (char)digit;
30070 }
30071 #endif /* SQLITE_OMIT_FLOATING_POINT */
30072
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30073 /*
30074 ** Set the StrAccum object to an error mode.
30075 */
30076 SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
30077 assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30160,10 +30266,12 @@
30160 etByte xtype = etINVALID; /* Conversion paradigm */
30161 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
30162 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
30163 sqlite_uint64 longvalue; /* Value for integer types */
30164 LONGDOUBLE_TYPE realvalue; /* Value for real types */
 
 
30165 const et_info *infop; /* Pointer to the appropriate info structure */
30166 char *zOut; /* Rendering buffer */
30167 int nOut; /* Size of the rendering buffer */
30168 char *zExtra = 0; /* Malloced memory used by some conversion */
30169 #ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30466,56 +30574,82 @@
30466 realvalue = -realvalue;
30467 prefix = '-';
30468 }else{
30469 prefix = flag_prefix;
30470 }
 
30471 if( xtype==etGENERIC && precision>0 ) precision--;
30472 testcase( precision>0xfff );
30473 idx = precision & 0xfff;
30474 rounder = arRound[idx%10];
30475 while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30476 if( xtype==etFLOAT ){
30477 double rx = (double)realvalue;
30478 sqlite3_uint64 u;
30479 int ex;
30480 memcpy(&u, &rx, sizeof(u));
30481 ex = -1023 + (int)((u>>52)&0x7ff);
30482 if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30483 realvalue += rounder;
30484 }
30485 /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30486 exp = 0;
30487 if( sqlite3IsNaN((double)realvalue) ){
30488 bufpt = "NaN";
30489 length = 3;
30490 break;
30491 }
30492 if( realvalue>0.0 ){
30493 LONGDOUBLE_TYPE scale = 1.0;
30494 while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
30495 while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
30496 while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30497 realvalue /= scale;
30498 while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30499 while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30500 if( exp>350 ){
30501 bufpt = buf;
30502 buf[0] = prefix;
30503 memcpy(buf+(prefix!=0),"Inf",4);
30504 length = 3+(prefix!=0);
30505 break;
30506 }
30507 }
30508 bufpt = buf;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30509 /*
30510 ** If the field type is etGENERIC, then convert to either etEXP
30511 ** or etFLOAT, as appropriate.
30512 */
30513 if( xtype!=etFLOAT ){
30514 realvalue += rounder;
30515 if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30516 }
30517 if( xtype==etGENERIC ){
30518 flag_rtz = !flag_alternateform;
30519 if( exp<-4 || exp>precision ){
30520 xtype = etEXP;
30521 }else{
@@ -30528,28 +30662,33 @@
30528 if( xtype==etEXP ){
30529 e2 = 0;
30530 }else{
30531 e2 = exp;
30532 }
 
 
30533 {
30534 i64 szBufNeeded; /* Size of a temporary buffer needed */
30535 szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30536 if( szBufNeeded > etBUFSIZE ){
30537 bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
30538 if( bufpt==0 ) return;
30539 }
30540 }
30541 zOut = bufpt;
30542 nsd = 16 + flag_altform2*10;
30543 flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
30544 /* The sign in front of the number */
30545 if( prefix ){
30546 *(bufpt++) = prefix;
30547 }
30548 /* Digits prior to the decimal point */
30549 if( e2<0 ){
30550 *(bufpt++) = '0';
 
 
 
 
30551 }else{
30552 for(; e2>=0; e2--){
30553 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30554 }
30555 }
@@ -30562,12 +30701,18 @@
30562 for(e2++; e2<0; precision--, e2++){
30563 assert( precision>0 );
30564 *(bufpt++) = '0';
30565 }
30566 /* Significant digits after the decimal point */
30567 while( (precision--)>0 ){
30568 *(bufpt++) = et_getdigit(&realvalue,&nsd);
 
 
 
 
 
 
30569 }
30570 /* Remove trailing zeros and the "." if no digits follow the "." */
30571 if( flag_rtz && flag_dp ){
30572 while( bufpt[-1]=='0' ) *(--bufpt) = 0;
30573 assert( bufpt>zOut );
@@ -31244,16 +31389,26 @@
31244 sqlite3_str_vappendf(&acc, zFormat, ap);
31245 zBuf[acc.nChar] = 0;
31246 return zBuf;
31247 }
31248 SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31249 char *z;
31250 va_list ap;
 
 
 
 
 
 
 
 
 
31251 va_start(ap,zFormat);
31252 z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
31253 va_end(ap);
31254 return z;
 
31255 }
31256
31257 /*
31258 ** This is the routine that actually formats the sqlite3_log() message.
31259 ** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52651,11 +52806,11 @@
52651 ** pointers).
52652 */
52653 struct PCache {
52654 PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
52655 PgHdr *pSynced; /* Last synced page in dirty page list */
52656 int nRefSum; /* Sum of ref counts over all pages */
52657 int szCache; /* Configured cache size */
52658 int szSpill; /* Size before spilling occurs */
52659 int szPage; /* Size of every page in this cache */
52660 int szExtra; /* Size of extra space for each page */
52661 u8 bPurgeable; /* True if pages are on backing store */
@@ -52681,11 +52836,11 @@
52681 static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
52682 PgHdr *pPg;
52683 unsigned char *a;
52684 int j;
52685 pPg = (PgHdr*)pLower->pExtra;
52686 printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52687 a = (unsigned char *)pLower->pBuf;
52688 for(j=0; j<12; j++) printf("%02x", a[j]);
52689 printf(" ptr %p\n", pPg);
52690 }
52691 static void pcacheDump(PCache *pCache){
@@ -53425,18 +53580,18 @@
53425 ** Return the total number of references to all pages held by the cache.
53426 **
53427 ** This is not the total number of pages referenced, but the sum of the
53428 ** reference count for all pages.
53429 */
53430 SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){
53431 return pCache->nRefSum;
53432 }
53433
53434 /*
53435 ** Return the number of references to the page supplied as an argument.
53436 */
53437 SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){
53438 return p->nRef;
53439 }
53440
53441 /*
53442 ** Return the total number of pages in the cache.
@@ -68090,12 +68245,13 @@
68090 int mxErr; /* Stop accumulating errors when this reaches zero */
68091 int nErr; /* Number of messages written to zErrMsg so far */
68092 int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
68093 u32 nStep; /* Number of steps into the integrity_check process */
68094 const char *zPfx; /* Error message prefix */
68095 Pgno v1; /* Value for first %u substitution in zPfx */
68096 int v2; /* Value for second %d substitution in zPfx */
 
68097 StrAccum errMsg; /* Accumulate the error message text here */
68098 u32 *heap; /* Min-heap used for analyzing cell coverage */
68099 sqlite3 *db; /* Database connection running the check */
68100 };
68101
@@ -68554,12 +68710,12 @@
68554 */
68555 #ifdef SQLITE_DEBUG
68556 int corruptPageError(int lineno, MemPage *p){
68557 char *zMsg;
68558 sqlite3BeginBenignMalloc();
68559 zMsg = sqlite3_mprintf("database corruption page %d of %s",
68560 (int)p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
68561 );
68562 sqlite3EndBenignMalloc();
68563 if( zMsg ){
68564 sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
68565 }
@@ -69364,12 +69520,29 @@
69364 ** and number of the varargs parameters) is determined by the eHintType
69365 ** parameter. See the definitions of the BTREE_HINT_* macros for details.
69366 */
69367 SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){
69368 /* Used only by system that substitute their own storage engine */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69369 }
69370 #endif
 
69371
69372 /*
69373 ** Provide flag hints to the cursor.
69374 */
69375 SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){
@@ -69450,11 +69623,11 @@
69450 }
69451 assert( offset <= (int)pBt->usableSize-5 );
69452 pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
69453
69454 if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69455 TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
69456 *pRC= rc = sqlite3PagerWrite(pDbPage);
69457 if( rc==SQLITE_OK ){
69458 pPtrmap[offset] = eType;
69459 put4byte(&pPtrmap[offset+1], parent);
69460 }
@@ -69649,31 +69822,35 @@
69649 ** This routine is a high-runner.
69650 */
69651 iKey = *pIter;
69652 if( iKey>=0x80 ){
69653 u8 x;
69654 iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
69655 if( x>=0x80 ){
69656 iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
69657 if( x>=0x80 ){
69658 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69659 if( x>=0x80 ){
69660 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69661 if( x>=0x80 ){
69662 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69663 if( x>=0x80 ){
69664 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69665 if( x>=0x80 ){
69666 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69667 if( x>=0x80 ){
69668 iKey = (iKey<<8) | (*++pIter);
69669 }
69670 }
69671 }
69672 }
69673 }
69674 }
 
 
 
 
69675 }
69676 }
69677 pIter++;
69678
69679 pInfo->nKey = *(i64*)&iKey;
@@ -69746,14 +69923,57 @@
69746 ** data header and the local payload, but not any overflow page or
69747 ** the space used by the cell pointer.
69748 **
69749 ** cellSizePtrNoPayload() => table internal nodes
69750 ** cellSizePtrTableLeaf() => table leaf nodes
69751 ** cellSizePtr() => all index nodes & table leaf nodes
 
69752 */
69753 static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69754 u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69755 u8 *pEnd; /* End mark for a varint */
69756 u32 nSize; /* Size value to return */
69757
69758 #ifdef SQLITE_DEBUG
69759 /* The value returned by this function should always be the same as
@@ -69762,10 +69982,11 @@
69762 ** this function verifies that this invariant is not violated. */
69763 CellInfo debuginfo;
69764 pPage->xParseCell(pPage, pCell, &debuginfo);
69765 #endif
69766
 
69767 nSize = *pIter;
69768 if( nSize>=0x80 ){
69769 pEnd = &pIter[8];
69770 nSize &= 0x7f;
69771 do{
@@ -69998,14 +70219,14 @@
69998 testcase( pc==iCellFirst );
69999 testcase( pc==iCellLast );
70000 /* These conditions have already been verified in btreeInitPage()
70001 ** if PRAGMA cell_size_check=ON.
70002 */
70003 if( pc<iCellStart || pc>iCellLast ){
70004 return SQLITE_CORRUPT_PAGE(pPage);
70005 }
70006 assert( pc>=iCellStart && pc<=iCellLast );
70007 size = pPage->xCellSize(pPage, &src[pc]);
70008 cbrk -= size;
70009 if( cbrk<iCellStart || pc+size>usableSize ){
70010 return SQLITE_CORRUPT_PAGE(pPage);
70011 }
@@ -70116,11 +70337,11 @@
70116 ** all the space together, however. This routine will avoid using
70117 ** the first two bytes past the cell pointer area since presumably this
70118 ** allocation is being made in order to insert a new cell, so we will
70119 ** also end up needing a new cell pointer.
70120 */
70121 static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
70122 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
70123 u8 * const data = pPage->aData; /* Local cache of pPage->aData */
70124 int top; /* First byte of cell content area */
70125 int rc = SQLITE_OK; /* Integer return code */
70126 u8 *pTmp; /* Temp ptr into data[] */
@@ -70142,17 +70363,18 @@
70142 ** then the cell content offset of an empty page wants to be 65536.
70143 ** However, that integer is too large to be stored in a 2-byte unsigned
70144 ** integer, so a value of 0 is used in its place. */
70145 pTmp = &data[hdr+5];
70146 top = get2byte(pTmp);
70147 assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */
70148 if( gap>top ){
70149 if( top==0 && pPage->pBt->usableSize==65536 ){
70150 top = 65536;
70151 }else{
70152 return SQLITE_CORRUPT_PAGE(pPage);
70153 }
 
 
70154 }
70155
70156 /* If there is enough space between gap and top for one more cell pointer,
70157 ** and if the freelist is not empty, then search the
70158 ** freelist looking for a slot big enough to satisfy the request.
@@ -70231,11 +70453,11 @@
70231 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
70232 assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
70233 assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
70234 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
70235 assert( iSize>=4 ); /* Minimum cell size is 4 */
70236 assert( iStart<=pPage->pBt->usableSize-4 );
70237
70238 /* The list of freeblocks must be in ascending order. Find the
70239 ** spot on the list where iStart should be inserted.
70240 */
70241 hdr = pPage->hdrOffset;
@@ -70288,10 +70510,15 @@
70288 if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
70289 data[hdr+7] -= nFrag;
70290 }
70291 pTmp = &data[hdr+5];
70292 x = get2byte(pTmp);
 
 
 
 
 
70293 if( iStart<=x ){
70294 /* The new freeblock is at the beginning of the cell content area,
70295 ** so just extend the cell content area rather than create another
70296 ** freelist entry */
70297 if( iStart<x ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -70299,18 +70526,13 @@
70299 put2byte(&data[hdr+1], iFreeBlk);
70300 put2byte(&data[hdr+5], iEnd);
70301 }else{
70302 /* Insert the new freeblock into the freelist */
70303 put2byte(&data[iPtr], iStart);
70304 }
70305 if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
70306 /* Overwrite deleted information with zeros when the secure_delete
70307 ** option is enabled */
70308 memset(&data[iStart], 0, iSize);
70309 }
70310 put2byte(&data[iStart], iFreeBlk);
70311 put2byte(&data[iStart+2], iSize);
70312 pPage->nFree += iOrigSize;
70313 return SQLITE_OK;
70314 }
70315
70316 /*
@@ -70343,18 +70565,18 @@
70343 pPage->maxLocal = pBt->maxLeaf;
70344 pPage->minLocal = pBt->minLeaf;
70345 }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
70346 pPage->intKey = 0;
70347 pPage->intKeyLeaf = 0;
70348 pPage->xCellSize = cellSizePtr;
70349 pPage->xParseCell = btreeParseCellPtrIndex;
70350 pPage->maxLocal = pBt->maxLocal;
70351 pPage->minLocal = pBt->minLocal;
70352 }else{
70353 pPage->intKey = 0;
70354 pPage->intKeyLeaf = 0;
70355 pPage->xCellSize = cellSizePtr;
70356 pPage->xParseCell = btreeParseCellPtrIndex;
70357 return SQLITE_CORRUPT_PAGE(pPage);
70358 }
70359 }else{
70360 pPage->childPtrSize = 4;
@@ -72216,11 +72438,11 @@
72216 assert( sqlite3_mutex_held(pBt->mutex) );
72217 assert( pDbPage->pBt==pBt );
72218 if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
72219
72220 /* Move page iDbPage from its current location to page number iFreePage */
72221 TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n",
72222 iDbPage, iFreePage, iPtrPage, eType));
72223 rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
72224 if( rc!=SQLITE_OK ){
72225 return rc;
72226 }
@@ -74502,11 +74724,12 @@
74502 }
74503 }
74504
74505 pPage = pCur->pPage;
74506 idx = ++pCur->ix;
74507 if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){
 
74508 return SQLITE_CORRUPT_BKPT;
74509 }
74510
74511 if( idx>=pPage->nCell ){
74512 if( !pPage->leaf ){
@@ -74765,11 +74988,11 @@
74765 }
74766 *pPgno = iTrunk;
74767 memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
74768 *ppPage = pTrunk;
74769 pTrunk = 0;
74770 TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74771 }else if( k>(u32)(pBt->usableSize/4 - 2) ){
74772 /* Value of k is out of range. Database corruption */
74773 rc = SQLITE_CORRUPT_PGNO(iTrunk);
74774 goto end_allocate_page;
74775 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74831,11 +75054,11 @@
74831 }
74832 put4byte(&pPrevTrunk->aData[0], iNewTrunk);
74833 }
74834 }
74835 pTrunk = 0;
74836 TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74837 #endif
74838 }else if( k>0 ){
74839 /* Extract a leaf from the trunk */
74840 u32 closest;
74841 Pgno iPage;
@@ -74876,12 +75099,12 @@
74876 if( !searchList
74877 || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
74878 ){
74879 int noContent;
74880 *pPgno = iPage;
74881 TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
74882 ": %d more free pages\n",
74883 *pPgno, closest+1, k, pTrunk->pgno, n-1));
74884 rc = sqlite3PagerWrite(pTrunk->pDbPage);
74885 if( rc ) goto end_allocate_page;
74886 if( closest<k-1 ){
74887 memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74933,11 +75156,11 @@
74933 /* If *pPgno refers to a pointer-map page, allocate two new pages
74934 ** at the end of the file instead of one. The first allocated page
74935 ** becomes a new pointer-map page, the second is used by the caller.
74936 */
74937 MemPage *pPg = 0;
74938 TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
74939 assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
74940 rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
74941 if( rc==SQLITE_OK ){
74942 rc = sqlite3PagerWrite(pPg->pDbPage);
74943 releasePage(pPg);
@@ -74956,11 +75179,11 @@
74956 rc = sqlite3PagerWrite((*ppPage)->pDbPage);
74957 if( rc!=SQLITE_OK ){
74958 releasePage(*ppPage);
74959 *ppPage = 0;
74960 }
74961 TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
74962 }
74963
74964 assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
74965
74966 end_allocate_page:
@@ -75084,11 +75307,11 @@
75084 if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
75085 sqlite3PagerDontWrite(pPage->pDbPage);
75086 }
75087 rc = btreeSetHasContent(pBt, iPage);
75088 }
75089 TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
75090 goto freepage_out;
75091 }
75092 }
75093
75094 /* If control flows to this point, then it was not possible to add the
@@ -75105,11 +75328,11 @@
75105 goto freepage_out;
75106 }
75107 put4byte(pPage->aData, iTrunk);
75108 put4byte(&pPage->aData[4], 0);
75109 put4byte(&pPage1->aData[32], iPage);
75110 TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk));
75111
75112 freepage_out:
75113 if( pPage ){
75114 pPage->isInit = 0;
75115 }
@@ -75464,10 +75687,18 @@
75464 ** pTemp is not null. Regardless of pTemp, allocate a new entry
75465 ** in pPage->apOvfl[] and make it point to the cell content (either
75466 ** in pTemp or the original pCell) and also record its index.
75467 ** Allocating a new entry in pPage->aCell[] implies that
75468 ** pPage->nOverflow is incremented.
 
 
 
 
 
 
 
 
75469 */
75470 static int insertCell(
75471 MemPage *pPage, /* Page into which we are copying */
75472 int i, /* New cell becomes the i-th cell of the page */
75473 u8 *pCell, /* Content of the new cell */
@@ -75486,18 +75717,107 @@
75486 assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
75487 assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
75488 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
75489 assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
75490 assert( pPage->nFree>=0 );
 
75491 if( pPage->nOverflow || sz+2>pPage->nFree ){
75492 if( pTemp ){
75493 memcpy(pTemp, pCell, sz);
75494 pCell = pTemp;
75495 }
75496 if( iChild ){
75497 put4byte(pCell, iChild);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75498 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75499 j = pPage->nOverflow++;
75500 /* Comparison against ArraySize-1 since we hold back one extra slot
75501 ** as a contingency. In other words, never need more than 3 overflow
75502 ** slots but 4 are allocated, just to be safe. */
75503 assert( j < ArraySize(pPage->apOvfl)-1 );
@@ -75525,21 +75845,11 @@
75525 ** if it returns successfully */
75526 assert( idx >= 0 );
75527 assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
75528 assert( idx+sz <= (int)pPage->pBt->usableSize );
75529 pPage->nFree -= (u16)(2 + sz);
75530 if( iChild ){
75531 /* In a corrupt database where an entry in the cell index section of
75532 ** a btree page has a value of 3 or less, the pCell value might point
75533 ** as many as 4 bytes in front of the start of the aData buffer for
75534 ** the source page. Make sure this does not cause problems by not
75535 ** reading the first 4 bytes */
75536 memcpy(&data[idx+4], pCell+4, sz-4);
75537 put4byte(&data[idx], iChild);
75538 }else{
75539 memcpy(&data[idx], pCell, sz);
75540 }
75541 pIns = pPage->aCellIdx + i*2;
75542 memmove(pIns+2, pIns, 2*(pPage->nCell - i));
75543 put2byte(pIns, idx);
75544 pPage->nCell++;
75545 /* increment the cell count */
@@ -75720,11 +76030,11 @@
75720 int k; /* Current slot in pCArray->apEnd[] */
75721 u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
75722
75723 assert( i<iEnd );
75724 j = get2byte(&aData[hdr+5]);
75725 if( j>(u32)usableSize ){ j = 0; }
75726 memcpy(&pTmp[j], &aData[j], usableSize - j);
75727
75728 for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
75729 pSrcEnd = pCArray->apEnd[k];
75730
@@ -75864,46 +76174,54 @@
75864 ){
75865 u8 * const aData = pPg->aData;
75866 u8 * const pEnd = &aData[pPg->pBt->usableSize];
75867 u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
75868 int nRet = 0;
75869 int i;
75870 int iEnd = iFirst + nCell;
75871 u8 *pFree = 0; /* \__ Parameters for pending call to */
75872 int szFree = 0; /* / freeSpace() */
 
75873
75874 for(i=iFirst; i<iEnd; i++){
75875 u8 *pCell = pCArray->apCell[i];
75876 if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
75877 int sz;
 
 
75878 /* No need to use cachedCellSize() here. The sizes of all cells that
75879 ** are to be freed have already been computing while deciding which
75880 ** cells need freeing */
75881 sz = pCArray->szCell[i]; assert( sz>0 );
75882 if( pFree!=(pCell + sz) ){
75883 if( pFree ){
75884 assert( pFree>aData && (pFree - aData)<65536 );
75885 freeSpace(pPg, (u16)(pFree - aData), szFree);
75886 }
75887 pFree = pCell;
75888 szFree = sz;
75889 if( pFree+sz>pEnd ){
75890 return 0;
75891 }
75892 }else{
75893 /* The current cell is adjacent to and before the pFree cell.
75894 ** Combine the two regions into one to reduce the number of calls
75895 ** to freeSpace(). */
75896 pFree = pCell;
75897 szFree += sz;
 
 
 
 
 
 
75898 }
75899 nRet++;
75900 }
75901 }
75902 if( pFree ){
75903 assert( pFree>aData && (pFree - aData)<65536 );
75904 freeSpace(pPg, (u16)(pFree - aData), szFree);
75905 }
75906 return nRet;
75907 }
75908
75909 /*
@@ -75954,11 +76272,11 @@
75954 nCell -= nTail;
75955 }
75956
75957 pData = &aData[get2byteNotZero(&aData[hdr+5])];
75958 if( pData<pBegin ) goto editpage_fail;
75959 if( pData>pPg->aDataEnd ) goto editpage_fail;
75960
75961 /* Add cells to the start of the page */
75962 if( iNew<iOld ){
75963 int nAdd = MIN(nNew,iOld-iNew);
75964 assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -76691,11 +77009,11 @@
76691 ** (2) pPage is a virtual root page. A virtual root page is when
76692 ** the real root page is page 1 and we are the only child of
76693 ** that page.
76694 */
76695 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
76696 TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n",
76697 apOld[0]->pgno, apOld[0]->nCell,
76698 nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
76699 nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
76700 ));
76701
@@ -76775,12 +77093,12 @@
76775 apNew[i]->pgno = pgnoB;
76776 apNew[iB]->pgno = pgnoA;
76777 }
76778 }
76779
76780 TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
76781 "%d(%d nc=%d) %d(%d nc=%d)\n",
76782 apNew[0]->pgno, szNew[0], cntNew[0],
76783 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
76784 nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
76785 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
76786 nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77021,11 +77339,11 @@
77021 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
77022 }
77023 }
77024
77025 assert( pParent->isInit );
77026 TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
77027 nOld, nNew, b.nCell));
77028
77029 /* Free any old pages that were not reused as new pages.
77030 */
77031 for(i=nNew; i<nOld; i++){
@@ -77106,11 +77424,11 @@
77106 }
77107 assert( sqlite3PagerIswriteable(pChild->pDbPage) );
77108 assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
77109 assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
77110
77111 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
77112
77113 /* Copy the overflow cells from pRoot to pChild */
77114 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
77115 pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
77116 memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77604,11 +77922,11 @@
77604 rc = btreeComputeFreeSpace(pPage);
77605 }
77606 if( rc ) return rc;
77607 }
77608
77609 TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
77610 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
77611 loc==0 ? "overwrite" : "new entry"));
77612 assert( pPage->isInit || CORRUPT_DB );
77613 newCell = p->pBt->pTmpSpace;
77614 assert( newCell!=0 );
@@ -77631,10 +77949,11 @@
77631 if( rc ) goto end_insert;
77632 }
77633 assert( szNew==pPage->xCellSize(pPage, newCell) );
77634 assert( szNew <= MX_CELL_SIZE(p->pBt) );
77635 idx = pCur->ix;
 
77636 if( loc==0 ){
77637 CellInfo info;
77638 assert( idx>=0 );
77639 if( idx>=pPage->nCell ){
77640 return SQLITE_CORRUPT_BKPT;
@@ -77679,11 +77998,11 @@
77679 idx = ++pCur->ix;
77680 pCur->curFlags &= ~BTCF_ValidNKey;
77681 }else{
77682 assert( pPage->leaf );
77683 }
77684 rc = insertCell(pPage, idx, newCell, szNew, 0, 0);
77685 assert( pPage->nOverflow==0 || rc==SQLITE_OK );
77686 assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );
77687
77688 /* If no error has occurred and pPage has an overflow cell, call balance()
77689 ** to redistribute the cells within the tree. Since balance() may move
@@ -77703,11 +78022,10 @@
77703 ** the b-tree if possible. If the cursor is left pointing to the last
77704 ** entry in the table, and the next row inserted has an integer key
77705 ** larger than the largest existing key, it is possible to insert the
77706 ** row without seeking the cursor. This can be a big performance boost.
77707 */
77708 pCur->info.nSize = 0;
77709 if( pPage->nOverflow ){
77710 assert( rc==SQLITE_OK );
77711 pCur->curFlags &= ~(BTCF_ValidNKey);
77712 rc = balance(pCur);
77713
@@ -77903,10 +78221,13 @@
77903 return SQLITE_CORRUPT_BKPT;
77904 }
77905 pCell = findCell(pPage, iCellIdx);
77906 if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
77907 return SQLITE_CORRUPT_BKPT;
 
 
 
77908 }
77909
77910 /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
77911 ** be preserved following this delete operation. If the current delete
77912 ** will cause a b-tree rebalance, then this is done by saving the cursor
@@ -78652,11 +78973,12 @@
78652 va_start(ap, zFormat);
78653 if( pCheck->errMsg.nChar ){
78654 sqlite3_str_append(&pCheck->errMsg, "\n", 1);
78655 }
78656 if( pCheck->zPfx ){
78657 sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2);
 
78658 }
78659 sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
78660 va_end(ap);
78661 if( pCheck->errMsg.accError==SQLITE_NOMEM ){
78662 checkOom(pCheck);
@@ -78692,15 +79014,15 @@
78692 **
78693 ** Also check that the page number is in bounds.
78694 */
78695 static int checkRef(IntegrityCk *pCheck, Pgno iPage){
78696 if( iPage>pCheck->nPage || iPage==0 ){
78697 checkAppendMsg(pCheck, "invalid page number %d", iPage);
78698 return 1;
78699 }
78700 if( getPageReferenced(pCheck, iPage) ){
78701 checkAppendMsg(pCheck, "2nd reference to page %d", iPage);
78702 return 1;
78703 }
78704 setPageReferenced(pCheck, iPage);
78705 return 0;
78706 }
@@ -78722,17 +79044,17 @@
78722 Pgno iPtrmapParent;
78723
78724 rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
78725 if( rc!=SQLITE_OK ){
78726 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
78727 checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild);
78728 return;
78729 }
78730
78731 if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
78732 checkAppendMsg(pCheck,
78733 "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)",
78734 iChild, eType, iParent, ePtrmapType, iPtrmapParent);
78735 }
78736 }
78737 #endif
78738
@@ -78753,11 +79075,11 @@
78753 DbPage *pOvflPage;
78754 unsigned char *pOvflData;
78755 if( checkRef(pCheck, iPage) ) break;
78756 N--;
78757 if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
78758 checkAppendMsg(pCheck, "failed to get page %d", iPage);
78759 break;
78760 }
78761 pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
78762 if( isFreeList ){
78763 u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78766,11 +79088,11 @@
78766 checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
78767 }
78768 #endif
78769 if( n>pCheck->pBt->usableSize/4-2 ){
78770 checkAppendMsg(pCheck,
78771 "freelist leaf count too big on page %d", iPage);
78772 N--;
78773 }else{
78774 for(i=0; i<(int)n; i++){
78775 Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
78776 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78798,11 +79120,11 @@
78798 iPage = get4byte(pOvflData);
78799 sqlite3PagerUnref(pOvflPage);
78800 }
78801 if( N && nErrAtStart==pCheck->nErr ){
78802 checkAppendMsg(pCheck,
78803 "%s is %d but should be %d",
78804 isFreeList ? "size" : "overflow list length",
78805 expected-N, expected);
78806 }
78807 }
78808 #endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78913,12 +79235,12 @@
78913 if( pCheck->mxErr==0 ) goto end_of_check;
78914 pBt = pCheck->pBt;
78915 usableSize = pBt->usableSize;
78916 if( iPage==0 ) return 0;
78917 if( checkRef(pCheck, iPage) ) return 0;
78918 pCheck->zPfx = "Page %u: ";
78919 pCheck->v1 = iPage;
78920 if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
78921 checkAppendMsg(pCheck,
78922 "unable to get the page. error code=%d", rc);
78923 goto end_of_check;
78924 }
@@ -78940,11 +79262,11 @@
78940 }
78941 data = pPage->aData;
78942 hdr = pPage->hdrOffset;
78943
78944 /* Set up for cell analysis */
78945 pCheck->zPfx = "On tree page %u cell %d: ";
78946 contentOffset = get2byteNotZero(&data[hdr+5]);
78947 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
78948
78949 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
78950 ** number of cells on the page. */
@@ -78960,11 +79282,11 @@
78960 if( !pPage->leaf ){
78961 /* Analyze the right-child page of internal pages */
78962 pgno = get4byte(&data[hdr+8]);
78963 #ifndef SQLITE_OMIT_AUTOVACUUM
78964 if( pBt->autoVacuum ){
78965 pCheck->zPfx = "On page %u at right child: ";
78966 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
78967 }
78968 #endif
78969 depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
78970 keyCanBeEqual = 0;
@@ -78984,11 +79306,11 @@
78984 pCheck->v2 = i;
78985 assert( pCellIdx==&data[cellStart + i*2] );
78986 pc = get2byteAligned(pCellIdx);
78987 pCellIdx -= 2;
78988 if( pc<contentOffset || pc>usableSize-4 ){
78989 checkAppendMsg(pCheck, "Offset %d out of range %d..%d",
78990 pc, contentOffset, usableSize-4);
78991 doCoverageCheck = 0;
78992 continue;
78993 }
78994 pCell = &data[pc];
@@ -79116,11 +79438,11 @@
79116 ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
79117 ** number of fragmented free bytes within the cell content area.
79118 */
79119 if( heap[0]==0 && nFrag!=data[hdr+7] ){
79120 checkAppendMsg(pCheck,
79121 "Fragmentation of %d bytes reported as %d on page %u",
79122 nFrag, data[hdr+7], iPage);
79123 }
79124 }
79125
79126 end_of_check:
@@ -79213,11 +79535,11 @@
79213 if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
79214
79215 /* Check the integrity of the freelist
79216 */
79217 if( bCkFreelist ){
79218 sCheck.zPfx = "Main freelist: ";
79219 checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
79220 get4byte(&pBt->pPage1->aData[36]));
79221 sCheck.zPfx = 0;
79222 }
79223
@@ -79230,11 +79552,11 @@
79230 Pgno mxInHdr;
79231 for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
79232 mxInHdr = get4byte(&pBt->pPage1->aData[52]);
79233 if( mx!=mxInHdr ){
79234 checkAppendMsg(&sCheck,
79235 "max rootpage (%d) disagrees with header (%d)",
79236 mx, mxInHdr
79237 );
79238 }
79239 }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
79240 checkAppendMsg(&sCheck,
@@ -79261,23 +79583,23 @@
79261 */
79262 if( !bPartial ){
79263 for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
79264 #ifdef SQLITE_OMIT_AUTOVACUUM
79265 if( getPageReferenced(&sCheck, i)==0 ){
79266 checkAppendMsg(&sCheck, "Page %d is never used", i);
79267 }
79268 #else
79269 /* If the database supports auto-vacuum, make sure no tables contain
79270 ** references to pointer-map pages.
79271 */
79272 if( getPageReferenced(&sCheck, i)==0 &&
79273 (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79274 checkAppendMsg(&sCheck, "Page %d is never used", i);
79275 }
79276 if( getPageReferenced(&sCheck, i)!=0 &&
79277 (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79278 checkAppendMsg(&sCheck, "Pointer map page %d is referenced", i);
79279 }
79280 #endif
79281 }
79282 }
79283
@@ -80805,11 +81127,11 @@
80805 return SQLITE_NOMEM_BKPT;
80806 }
80807
80808 vdbeMemRenderNum(nByte, pMem->z, pMem);
80809 assert( pMem->z!=0 );
80810 assert( pMem->n==sqlite3Strlen30NN(pMem->z) );
80811 pMem->enc = SQLITE_UTF8;
80812 pMem->flags |= MEM_Str|MEM_Term;
80813 if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
80814 sqlite3VdbeChangeEncoding(pMem, enc);
80815 return SQLITE_OK;
@@ -81849,10 +82171,13 @@
81849 assert( ExprUseXList(p) );
81850 pList = p->x.pList;
81851 if( pList ) nVal = pList->nExpr;
81852 assert( !ExprHasProperty(p, EP_IntValue) );
81853 pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0);
 
 
 
81854 assert( pFunc );
81855 if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
81856 || (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
81857 ){
81858 return SQLITE_OK;
@@ -81885,20 +82210,15 @@
81885 rc = ctx.isError;
81886 sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
81887 }else{
81888 sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
81889 assert( rc==SQLITE_OK );
81890 assert( enc==pVal->enc
81891 || (pVal->flags & MEM_Str)==0
81892 || db->mallocFailed );
81893 #if 0 /* Not reachable except after a prior failure */
81894 rc = sqlite3VdbeChangeEncoding(pVal, enc);
81895 if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
81896 rc = SQLITE_TOOBIG;
81897 pCtx->pParse->nErr++;
81898 }
81899 #endif
81900 }
81901
81902 value_from_function_out:
81903 if( rc!=SQLITE_OK ){
81904 pVal = 0;
@@ -81958,10 +82278,17 @@
81958 assert( !ExprHasProperty(pExpr, EP_IntValue) );
81959 aff = sqlite3AffinityType(pExpr->u.zToken,0);
81960 rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
81961 testcase( rc!=SQLITE_OK );
81962 if( *ppVal ){
 
 
 
 
 
 
 
81963 sqlite3VdbeMemCast(*ppVal, aff, enc);
81964 sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
81965 }
81966 return rc;
81967 }
@@ -82804,14 +83131,14 @@
82804 ** If the bPush flag is true, then make this opcode the parent for
82805 ** subsequent Explains until sqlite3VdbeExplainPop() is called.
82806 */
82807 SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
82808 int addr = 0;
82809 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
82810 /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
82811 ** But omit them (for performance) during production builds */
82812 if( pParse->explain==2 )
82813 #endif
82814 {
82815 char *zMsg;
82816 Vdbe *v;
82817 va_list ap;
@@ -83483,22 +83810,24 @@
83483 int addrLoop, /* Address of loop counter */
83484 int addrVisit, /* Address of rows visited counter */
83485 LogEst nEst, /* Estimated number of output rows */
83486 const char *zName /* Name of table or index being scanned */
83487 ){
83488 sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83489 ScanStatus *aNew;
83490 aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83491 if( aNew ){
83492 ScanStatus *pNew = &aNew[p->nScan++];
83493 memset(pNew, 0, sizeof(ScanStatus));
83494 pNew->addrExplain = addrExplain;
83495 pNew->addrLoop = addrLoop;
83496 pNew->addrVisit = addrVisit;
83497 pNew->nEst = nEst;
83498 pNew->zName = sqlite3DbStrDup(p->db, zName);
83499 p->aScan = aNew;
 
 
83500 }
83501 }
83502
83503 /*
83504 ** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83511,24 +83840,26 @@
83511 Vdbe *p,
83512 int addrExplain,
83513 int addrStart,
83514 int addrEnd
83515 ){
83516 ScanStatus *pScan = 0;
83517 int ii;
83518 for(ii=p->nScan-1; ii>=0; ii--){
83519 pScan = &p->aScan[ii];
83520 if( pScan->addrExplain==addrExplain ) break;
83521 pScan = 0;
83522 }
83523 if( pScan ){
83524 if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83525 for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83526 if( pScan->aAddrRange[ii]==0 ){
83527 pScan->aAddrRange[ii] = addrStart;
83528 pScan->aAddrRange[ii+1] = addrEnd;
83529 break;
 
 
83530 }
83531 }
83532 }
83533 }
83534
@@ -83541,23 +83872,25 @@
83541 Vdbe *p,
83542 int addrExplain,
83543 int addrLoop,
83544 int addrVisit
83545 ){
83546 ScanStatus *pScan = 0;
83547 int ii;
83548 for(ii=p->nScan-1; ii>=0; ii--){
83549 pScan = &p->aScan[ii];
83550 if( pScan->addrExplain==addrExplain ) break;
83551 pScan = 0;
83552 }
83553 if( pScan ){
83554 pScan->addrLoop = addrLoop;
83555 pScan->addrVisit = addrVisit;
 
 
83556 }
83557 }
83558 #endif
83559
83560
83561 /*
83562 ** Change the value of the opcode, or P1, P2, P3, or P5 operands
83563 ** for a specific instruction.
@@ -85681,10 +86014,12 @@
85681 db->nDeferredCons = 0;
85682 db->nDeferredImmCons = 0;
85683 db->flags &= ~(u64)SQLITE_DeferFKs;
85684 sqlite3CommitInternalChanges(db);
85685 }
 
 
85686 }else{
85687 sqlite3RollbackAll(db, SQLITE_OK);
85688 p->nChange = 0;
85689 }
85690 db->nStatement = 0;
@@ -85999,13 +86334,13 @@
85999 vdbeFreeOpArray(db, p->aOp, p->nOp);
86000 if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
86001 #ifdef SQLITE_ENABLE_NORMALIZE
86002 sqlite3DbFree(db, p->zNormSql);
86003 {
86004 DblquoteStr *pThis, *pNext;
86005 for(pThis=p->pDblStr; pThis; pThis=pNext){
86006 pNext = pThis->pNextStr;
86007 sqlite3DbFree(db, pThis);
86008 }
86009 }
86010 #endif
86011 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -87628,10 +87963,24 @@
87628 return 0;
87629 }
87630 return 1;
87631 }
87632
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87633 #ifndef SQLITE_OMIT_VIRTUALTABLE
87634 /*
87635 ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
87636 ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
87637 ** in memory obtained from sqlite3DbMalloc).
@@ -88014,11 +88363,11 @@
88014 SQLITE_NULL, /* 0x1d (not possible) */
88015 SQLITE_INTEGER, /* 0x1e (not possible) */
88016 SQLITE_NULL, /* 0x1f (not possible) */
88017 SQLITE_FLOAT, /* 0x20 INTREAL */
88018 SQLITE_NULL, /* 0x21 (not possible) */
88019 SQLITE_TEXT, /* 0x22 INTREAL + TEXT */
88020 SQLITE_NULL, /* 0x23 (not possible) */
88021 SQLITE_FLOAT, /* 0x24 (not possible) */
88022 SQLITE_NULL, /* 0x25 (not possible) */
88023 SQLITE_FLOAT, /* 0x26 (not possible) */
88024 SQLITE_NULL, /* 0x27 (not possible) */
@@ -89881,19 +90230,28 @@
89881 int iScanStatusOp, /* Which metric to return */
89882 int flags,
89883 void *pOut /* OUT: Write the answer here */
89884 ){
89885 Vdbe *p = (Vdbe*)pStmt;
89886 ScanStatus *pScan;
 
 
89887 int idx;
 
 
 
 
 
 
 
89888
89889 if( iScan<0 ){
89890 int ii;
89891 if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
89892 i64 res = 0;
89893 for(ii=0; ii<p->nOp; ii++){
89894 res += p->aOp[ii].nCycle;
89895 }
89896 *(i64*)pOut = res;
89897 return 0;
89898 }
89899 return 1;
@@ -89915,19 +90273,19 @@
89915 if( idx>=p->nScan ) return 1;
89916
89917 switch( iScanStatusOp ){
89918 case SQLITE_SCANSTAT_NLOOP: {
89919 if( pScan->addrLoop>0 ){
89920 *(sqlite3_int64*)pOut = p->aOp[pScan->addrLoop].nExec;
89921 }else{
89922 *(sqlite3_int64*)pOut = -1;
89923 }
89924 break;
89925 }
89926 case SQLITE_SCANSTAT_NVISIT: {
89927 if( pScan->addrVisit>0 ){
89928 *(sqlite3_int64*)pOut = p->aOp[pScan->addrVisit].nExec;
89929 }else{
89930 *(sqlite3_int64*)pOut = -1;
89931 }
89932 break;
89933 }
@@ -89945,27 +90303,27 @@
89945 *(const char**)pOut = pScan->zName;
89946 break;
89947 }
89948 case SQLITE_SCANSTAT_EXPLAIN: {
89949 if( pScan->addrExplain ){
89950 *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
89951 }else{
89952 *(const char**)pOut = 0;
89953 }
89954 break;
89955 }
89956 case SQLITE_SCANSTAT_SELECTID: {
89957 if( pScan->addrExplain ){
89958 *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
89959 }else{
89960 *(int*)pOut = -1;
89961 }
89962 break;
89963 }
89964 case SQLITE_SCANSTAT_PARENTID: {
89965 if( pScan->addrExplain ){
89966 *(int*)pOut = p->aOp[ pScan->addrExplain ].p2;
89967 }else{
89968 *(int*)pOut = -1;
89969 }
89970 break;
89971 }
@@ -89979,22 +90337,22 @@
89979 int iIns = pScan->aAddrRange[ii];
89980 int iEnd = pScan->aAddrRange[ii+1];
89981 if( iIns==0 ) break;
89982 if( iIns>0 ){
89983 while( iIns<=iEnd ){
89984 res += p->aOp[iIns].nCycle;
89985 iIns++;
89986 }
89987 }else{
89988 int iOp;
89989 for(iOp=0; iOp<p->nOp; iOp++){
89990 Op *pOp = &p->aOp[iOp];
89991 if( pOp->p1!=iEnd ) continue;
89992 if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
89993 continue;
89994 }
89995 res += p->aOp[iOp].nCycle;
89996 }
89997 }
89998 }
89999 }
90000 *(i64*)pOut = res;
@@ -90913,12 +91271,14 @@
90913 if( p->flags & (MEM_Int|MEM_IntReal) ){
90914 h += p->u.i;
90915 }else if( p->flags & MEM_Real ){
90916 h += sqlite3VdbeIntValue(p);
90917 }else if( p->flags & (MEM_Str|MEM_Blob) ){
90918 h += p->n;
90919 if( p->flags & MEM_Zero ) h += p->u.nZero;
 
 
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 ){
@@ -104493,18 +104869,14 @@
104493 }
104494 sqlite3WalkExpr(pWalker, pExpr->pLeft);
104495 if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){
104496 testcase( ExprHasProperty(pExpr, EP_OuterON) );
104497 assert( !ExprHasProperty(pExpr, EP_IntValue) );
104498 if( pExpr->op==TK_NOTNULL ){
104499 pExpr->u.zToken = "true";
104500 ExprSetProperty(pExpr, EP_IsTrue);
104501 }else{
104502 pExpr->u.zToken = "false";
104503 ExprSetProperty(pExpr, EP_IsFalse);
104504 }
104505 pExpr->op = TK_TRUEFALSE;
104506 for(i=0, p=pNC; p && i<ArraySize(anRef); p=p->pNext, i++){
104507 p->nRef = anRef[i];
104508 }
104509 sqlite3ExprDelete(pParse->db, pExpr->pLeft);
104510 pExpr->pLeft = 0;
@@ -104802,12 +105174,12 @@
104802 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
104803 }
104804 assert( pNC->nRef>=nRef );
104805 if( nRef!=pNC->nRef ){
104806 ExprSetProperty(pExpr, EP_VarSelect);
104807 pNC->ncFlags |= NC_VarSelect;
104808 }
 
104809 }
104810 break;
104811 }
104812 case TK_VARIABLE: {
104813 testcase( pNC->ncFlags & NC_IsCheck );
@@ -105991,15 +106363,14 @@
105991 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
105992 p = p->pLeft;
105993 }else{
105994 Expr *pNext = p->pRight;
105995 /* The Expr.x union is never used at the same time as Expr.pRight */
105996 assert( ExprUseXList(p) );
105997 assert( p->x.pList==0 || p->pRight==0 );
105998 if( p->x.pList!=0 && !db->mallocFailed ){
105999 int i;
106000 for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){
106001 if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
106002 pNext = p->x.pList->a[i].pExpr;
106003 break;
106004 }
106005 }
@@ -108363,11 +108734,11 @@
108363
108364 /*
108365 ** pX is the RHS of an IN operator. If pX is a SELECT statement
108366 ** that can be simplified to a direct table access, then return
108367 ** a pointer to the SELECT statement. If pX is not a SELECT statement,
108368 ** or if the SELECT statement needs to be manifested into a transient
108369 ** table, then return NULL.
108370 */
108371 #ifndef SQLITE_OMIT_SUBQUERY
108372 static Select *isCandidateForInOpt(const Expr *pX){
108373 Select *p;
@@ -108649,11 +109020,10 @@
108649 Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
108650 Expr *pRhs = pEList->a[i].pExpr;
108651 CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
108652 int j;
108653
108654 assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );
108655 for(j=0; j<nExpr; j++){
108656 if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
108657 assert( pIdx->azColl[j] );
108658 if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
108659 continue;
@@ -109552,10 +109922,11 @@
109552 Column *pCol, /* The generated column */
109553 int regOut /* Put the result in this register */
109554 ){
109555 int iAddr;
109556 Vdbe *v = pParse->pVdbe;
 
109557 assert( v!=0 );
109558 assert( pParse->iSelfTab!=0 );
109559 if( pParse->iSelfTab>0 ){
109560 iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109561 }else{
@@ -109564,10 +109935,11 @@
109564 sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109565 if( pCol->affinity>=SQLITE_AFF_TEXT ){
109566 sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109567 }
109568 if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
 
109569 }
109570 #endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109571
109572 /*
109573 ** Generate code to extract the value of the iCol-th column of a table.
@@ -109580,10 +109952,11 @@
109580 int regOut /* Extract the value into this register */
109581 ){
109582 Column *pCol;
109583 assert( v!=0 );
109584 assert( pTab!=0 );
 
109585 if( iCol<0 || iCol==pTab->iPKey ){
109586 sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109587 VdbeComment((v, "%s.rowid", pTab->zName));
109588 }else{
109589 int op;
@@ -109846,17 +110219,28 @@
109846 int target /* Where to store the result of the expression */
109847 ){
109848 IndexedExpr *p;
109849 Vdbe *v;
109850 for(p=pParse->pIdxEpr; p; p=p->pIENext){
 
109851 int iDataCur = p->iDataCur;
109852 if( iDataCur<0 ) continue;
109853 if( pParse->iSelfTab ){
109854 if( p->iDataCur!=pParse->iSelfTab-1 ) continue;
109855 iDataCur = -1;
109856 }
109857 if( sqlite3ExprCompare(0, pExpr, p->pExpr, iDataCur)!=0 ) continue;
 
 
 
 
 
 
 
 
 
 
109858 v = pParse->pVdbe;
109859 assert( v!=0 );
109860 if( p->bMaybeNullRow ){
109861 /* If the index is on a NULL row due to an outer join, then we
109862 ** cannot extract the value from the index. The value must be
@@ -109921,11 +110305,23 @@
109921 switch( op ){
109922 case TK_AGG_COLUMN: {
109923 AggInfo *pAggInfo = pExpr->pAggInfo;
109924 struct AggInfo_col *pCol;
109925 assert( pAggInfo!=0 );
109926 assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
 
 
 
 
 
 
 
 
 
 
 
 
109927 pCol = &pAggInfo->aCol[pExpr->iAgg];
109928 if( !pAggInfo->directMode ){
109929 return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
109930 }else if( pAggInfo->useSortingIdx ){
109931 Table *pTab = pCol->pTab;
@@ -110096,15 +110492,12 @@
110096 return pExpr->iTable;
110097 }
110098 #ifndef SQLITE_OMIT_CAST
110099 case TK_CAST: {
110100 /* Expressions of the form: CAST(pLeft AS token) */
110101 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110102 if( inReg!=target ){
110103 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110104 inReg = target;
110105 }
110106 assert( !ExprHasProperty(pExpr, EP_IntValue) );
110107 sqlite3VdbeAddOp2(v, OP_Cast, target,
110108 sqlite3AffinityType(pExpr->u.zToken, 0));
110109 return inReg;
110110 }
@@ -110432,21 +110825,20 @@
110432 case TK_BETWEEN: {
110433 exprCodeBetween(pParse, pExpr, target, 0, 0);
110434 return target;
110435 }
110436 case TK_COLLATE: {
110437 if( !ExprHasProperty(pExpr, EP_Collate)
110438 && ALWAYS(pExpr->pLeft)
110439 && pExpr->pLeft->op==TK_FUNCTION
110440 ){
110441 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110442 if( inReg!=target ){
110443 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110444 inReg = target;
110445 }
110446 sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg);
110447 return inReg;
110448 }else{
110449 pExpr = pExpr->pLeft;
110450 goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110451 }
110452 }
@@ -110543,20 +110935,23 @@
110543 target);
110544 inReg = target;
110545 break;
110546 }
110547 }
110548 addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable);
110549 /* Temporarily disable factoring of constant expressions, since
110550 ** even though expressions may appear to be constant, they are not
110551 ** really constant because they originate from the right-hand side
110552 ** of a LEFT JOIN. */
110553 pParse->okConstFactor = 0;
110554 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
 
 
 
 
110555 pParse->okConstFactor = okConstFactor;
110556 sqlite3VdbeJumpHere(v, addrINR);
110557 sqlite3VdbeChangeP3(v, addrINR, inReg);
110558 break;
110559 }
110560
110561 /*
110562 ** Form A:
@@ -110789,11 +111184,13 @@
110789 assert( pParse->pVdbe!=0 || pParse->db->mallocFailed );
110790 if( pParse->pVdbe==0 ) return;
110791 inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);
110792 if( inReg!=target ){
110793 u8 op;
110794 if( ALWAYS(pExpr) && ExprHasProperty(pExpr,EP_Subquery) ){
 
 
110795 op = OP_Copy;
110796 }else{
110797 op = OP_SCopy;
110798 }
110799 sqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target);
@@ -111974,23 +112371,26 @@
111974 ){
111975 AggInfo *pAggInfo = pExpr->pAggInfo;
111976 int iAgg = pExpr->iAgg;
111977 Parse *pParse = pWalker->pParse;
111978 sqlite3 *db = pParse->db;
 
111979 if( pExpr->op!=TK_AGG_FUNCTION ){
111980 assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
111981 if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
 
111982 pExpr = sqlite3ExprDup(db, pExpr, 0);
111983 if( pExpr ){
111984 pAggInfo->aCol[iAgg].pCExpr = pExpr;
111985 sqlite3ExprDeferredDelete(pParse, pExpr);
111986 }
111987 }
111988 }else{
111989 assert( pExpr->op==TK_AGG_FUNCTION );
111990 assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
111991 if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
 
111992 pExpr = sqlite3ExprDup(db, pExpr, 0);
111993 if( pExpr ){
111994 pAggInfo->aFunc[iAgg].pFExpr = pExpr;
111995 sqlite3ExprDeferredDelete(pParse, pExpr);
111996 }
@@ -112136,11 +112536,16 @@
112136 if( iDataCur<0 ) continue;
112137 if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112138 }
112139 if( pIEpr==0 ) break;
112140 if( NEVER(!ExprUseYTab(pExpr)) ) break;
112141 if( pExpr->pAggInfo!=0 ) break; /* Already resolved by outer context */
 
 
 
 
 
112142
112143 /* If we reach this point, it means that expression pExpr can be
112144 ** translated into a reference to an index column as described by
112145 ** pIEpr.
112146 */
@@ -112147,10 +112552,13 @@
112147 memset(&tmp, 0, sizeof(tmp));
112148 tmp.op = TK_AGG_COLUMN;
112149 tmp.iTable = pIEpr->iIdxCur;
112150 tmp.iColumn = pIEpr->iIdxCol;
112151 findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
 
 
 
112152 pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112153 pExpr->pAggInfo = pAggInfo;
112154 pExpr->iAgg = tmp.iAgg;
112155 return WRC_Prune;
112156 }
@@ -112323,10 +112731,41 @@
112323 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112324 pParse->nTempReg = 0;
112325 pParse->nRangeReg = 0;
112326 }
112327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112328 /*
112329 ** Validate that no temporary register falls within the range of
112330 ** iFirst..iLast, inclusive. This routine is only call from within assert()
112331 ** statements.
112332 */
@@ -112341,10 +112780,18 @@
112341 }
112342 for(i=0; i<pParse->nTempReg; i++){
112343 if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112344 return 0;
112345 }
 
 
 
 
 
 
 
 
112346 }
112347 return 1;
112348 }
112349 #endif /* SQLITE_DEBUG */
112350
@@ -115625,15 +116072,19 @@
115625 int regTemp2 = iMem++; /* Second temporary use register */
115626 int regTabname = iMem++; /* Register containing table name */
115627 int regIdxname = iMem++; /* Register containing index name */
115628 int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
115629 int regPrev = iMem; /* MUST BE LAST (see below) */
 
 
 
115630 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
115631 Table *pStat1 = 0;
115632 #endif
115633
115634 pParse->nMem = MAX(pParse->nMem, iMem);
 
115635 v = sqlite3GetVdbe(pParse);
115636 if( v==0 || NEVER(pTab==0) ){
115637 return;
115638 }
115639 if( !IsOrdinaryTable(pTab) ){
@@ -115735,11 +116186,11 @@
115735
115736 /* Make sure there are enough memory cells allocated to accommodate
115737 ** the regPrev array and a trailing rowid (the rowid slot is required
115738 ** when building a record to insert into the sample column of
115739 ** the sqlite_stat4 table. */
115740 pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);
115741
115742 /* Open a read-only cursor on the index being analyzed. */
115743 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
115744 sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
115745 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115907,11 +116358,39 @@
115907 int regSampleRowid = regCol + nCol;
115908 int addrNext;
115909 int addrIsNull;
115910 u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
115911
115912 pParse->nMem = MAX(pParse->nMem, regCol+nCol);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115913
115914 addrNext = sqlite3VdbeCurrentAddr(v);
115915 callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
115916 addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
115917 VdbeCoverage(v);
@@ -115988,10 +116467,15 @@
115988 iTab = pParse->nTab;
115989 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
115990 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
115991 Table *pTab = (Table*)sqliteHashData(k);
115992 analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
 
 
 
 
 
115993 }
115994 loadAnalysis(pParse, iDb);
115995 }
115996
115997 /*
@@ -118915,11 +119399,11 @@
118915 Hash *pHash;
118916 sqlite3 *db = pParse->db;
118917 if( pParse->pNewTrigger ){
118918 sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
118919 }else{
118920 assert( pParse->bReturning==0 );
118921 }
118922 pParse->bReturning = 1;
118923 pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
118924 if( pRet==0 ){
118925 sqlite3ExprListDelete(db, pList);
@@ -118941,11 +119425,12 @@
118941 pRet->retTrig.step_list = &pRet->retTStep;
118942 pRet->retTStep.op = TK_RETURNING;
118943 pRet->retTStep.pTrig = &pRet->retTrig;
118944 pRet->retTStep.pExprList = pList;
118945 pHash = &(db->aDb[1].pSchema->trigHash);
118946 assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
 
118947 if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
118948 ==&pRet->retTrig ){
118949 sqlite3OomFault(db);
118950 }
118951 }
@@ -119476,10 +119961,11 @@
119476 ** just a reference to another column, in order for covering index
119477 ** optimizations to work correctly. So if the value is not an expression,
119478 ** turn it into one by adding a unary "+" operator. */
119479 pExpr = sqlite3PExpr(pParse, TK_UPLUS, pExpr, 0);
119480 }
 
119481 sqlite3ColumnSetExpr(pParse, pTab, pCol, pExpr);
119482 pExpr = 0;
119483 goto generated_done;
119484
119485 generated_error:
@@ -123813,17 +124299,19 @@
123813 **
123814 ** If pTab is not writable -> generate an error message and return 1.
123815 ** If pTab is writable but other errors have occurred -> return 1.
123816 ** If pTab is writable and no prior errors -> return 0;
123817 */
123818 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
123819 if( tabIsReadOnly(pParse, pTab) ){
123820 sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
123821 return 1;
123822 }
123823 #ifndef SQLITE_OMIT_VIEW
123824 if( !viewOk && IsView(pTab) ){
 
 
123825 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
123826 return 1;
123827 }
123828 #endif
123829 return 0;
@@ -124073,11 +124561,11 @@
124073 */
124074 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124075 goto delete_from_cleanup;
124076 }
124077
124078 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
124079 goto delete_from_cleanup;
124080 }
124081 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124082 assert( iDb<db->nDb );
124083 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -124182,11 +124670,11 @@
124182 }
124183 }else
124184 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124185 {
124186 u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124187 if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
124188 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124189 if( HasRowid(pTab) ){
124190 /* For a rowid table, initialize the RowSet to an empty set */
124191 pPk = 0;
124192 nPk = 1;
@@ -126878,10 +127366,22 @@
126878 ** unable to take a pointer to these functions. Hence, we here wrap them
126879 ** in our own actual functions.
126880 */
126881 static double xCeil(double x){ return ceil(x); }
126882 static double xFloor(double x){ return floor(x); }
 
 
 
 
 
 
 
 
 
 
 
 
126883
126884 /*
126885 ** Implementation of SQL functions:
126886 **
126887 ** ln(X) - natural logarithm
@@ -128758,49 +129258,51 @@
128758 **
128759 ** Memory for the buffer containing the column index affinity string
128760 ** is managed along with the rest of the Index structure. It will be
128761 ** released when sqlite3DeleteIndex() is called.
128762 */
128763 SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
128764 if( !pIdx->zColAff ){
128765 /* The first time a column affinity string for a particular index is
128766 ** required, it is allocated and populated here. It is then stored as
128767 ** a member of the Index structure for subsequent use.
128768 **
128769 ** The column affinity string will eventually be deleted by
128770 ** sqliteDeleteIndex() when the Index structure itself is cleaned
128771 ** up.
128772 */
128773 int n;
128774 Table *pTab = pIdx->pTable;
128775 pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
128776 if( !pIdx->zColAff ){
128777 sqlite3OomFault(db);
128778 return 0;
128779 }
128780 for(n=0; n<pIdx->nColumn; n++){
128781 i16 x = pIdx->aiColumn[n];
128782 char aff;
128783 if( x>=0 ){
128784 aff = pTab->aCol[x].affinity;
128785 }else if( x==XN_ROWID ){
128786 aff = SQLITE_AFF_INTEGER;
128787 }else{
128788 assert( x==XN_EXPR );
128789 assert( pIdx->bHasExpr );
128790 assert( pIdx->aColExpr!=0 );
128791 aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
128792 }
128793 if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
128794 if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
128795 pIdx->zColAff[n] = aff;
128796 }
128797 pIdx->zColAff[n] = 0;
128798 }
128799
 
128800 return pIdx->zColAff;
128801 }
 
128802
128803 /*
128804 ** Compute an affinity string for a table. Space is obtained
128805 ** from sqlite3DbMalloc(). The caller is responsible for freeing
128806 ** the space when done.
@@ -129482,11 +129984,11 @@
129482 goto insert_cleanup;
129483 }
129484
129485 /* Cannot insert into a read-only table.
129486 */
129487 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
129488 goto insert_cleanup;
129489 }
129490
129491 /* Allocate a VDBE
129492 */
@@ -129929,11 +130431,11 @@
129929 sqlite3VdbeJumpHere(v, addr1);
129930 sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
129931 }
129932
129933 /* Copy the new data already generated. */
129934 assert( pTab->nNVCol>0 );
129935 sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
129936
129937 #ifndef SQLITE_OMIT_GENERATED_COLUMNS
129938 /* Compute the new value for generated columns after all other
129939 ** columns have already been computed. This must be done after
@@ -133292,19 +133794,25 @@
133292 zEntry = zProc ? zProc : "sqlite3_extension_init";
133293
133294 /* tag-20210611-1. Some dlopen() implementations will segfault if given
133295 ** an oversize filename. Most filesystems have a pathname limit of 4K,
133296 ** so limit the extension filename length to about twice that.
133297 ** https://sqlite.org/forum/forumpost/08a0d6d9bf */
 
 
 
 
133298 if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133299
133300 handle = sqlite3OsDlOpen(pVfs, zFile);
133301 #if SQLITE_OS_UNIX || SQLITE_OS_WIN
133302 for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133303 char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133304 if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133305 handle = sqlite3OsDlOpen(pVfs, zAltFile);
 
 
133306 sqlite3_free(zAltFile);
133307 }
133308 #endif
133309 if( handle==0 ) goto extension_not_found;
133310 xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135795,11 +136303,11 @@
135795 if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
135796 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135797 zDb = db->aDb[iDb].zDbSName;
135798 sqlite3CodeVerifySchema(pParse, iDb);
135799 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
135800 if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
135801 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
135802 sqlite3VdbeLoadString(v, regResult, pTab->zName);
135803 assert( IsOrdinaryTable(pTab) );
135804 for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
135805 pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135836,11 +136344,11 @@
135836
135837 /* Generate code to read the child key values into registers
135838 ** regRow..regRow+n. If any of the child key values are NULL, this
135839 ** row cannot cause an FK violation. Jump directly to addrOk in
135840 ** this case. */
135841 if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol;
135842 for(j=0; j<pFK->nCol; j++){
135843 int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
135844 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
135845 sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
135846 }
@@ -135965,10 +136473,11 @@
135965
135966 if( OMIT_TEMPDB && i==1 ) continue;
135967 if( iDb>=0 && i!=iDb ) continue;
135968
135969 sqlite3CodeVerifySchema(pParse, i);
 
135970
135971 /* Do an integrity check of the B-Tree
135972 **
135973 ** Begin by finding the root pages numbers
135974 ** for all tables and indices in the database.
@@ -136000,11 +136509,11 @@
136000 }
136001 }
136002 aRoot[0] = cnt;
136003
136004 /* Make sure sufficient number of registers have been allocated */
136005 pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
136006 sqlite3ClearTempRegCache(pParse);
136007
136008 /* Do the b-tree integrity checks */
136009 sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136010 sqlite3VdbeChangeP5(v, (u8)i);
@@ -136150,19 +136659,33 @@
136150
136151 labelError = sqlite3VdbeMakeLabel(pParse);
136152 labelOk = sqlite3VdbeMakeLabel(pParse);
136153 if( pCol->notNull ){
136154 /* (1) NOT NULL columns may not contain a NULL */
 
136155 int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
136156 sqlite3VdbeChangeP5(v, 0x0f);
136157 VdbeCoverage(v);
 
 
 
 
 
 
 
 
 
 
 
 
 
136158 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136159 pCol->zCnName);
136160 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136161 if( doTypeCheck ){
136162 sqlite3VdbeGoto(v, labelError);
136163 sqlite3VdbeJumpHere(v, jmp2);
 
136164 }else{
136165 /* VDBE byte code will fall thru */
136166 }
136167 }
136168 if( bStrict && doTypeCheck ){
@@ -136257,10 +136780,27 @@
136257 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
136258 jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
136259 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
136260 jmp4 = integrityCheckResultRow(v);
136261 sqlite3VdbeJumpHere(v, jmp2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136262
136263 /* Any indexed columns with non-BINARY collations must still hold
136264 ** the exact same text value as the table. */
136265 label6 = 0;
136266 for(kk=0; kk<pIdx->nKeyCol; kk++){
@@ -140553,12 +141093,10 @@
140553 p = a[i].pExpr;
140554 /* pCol->szEst = ... // Column size est for SELECT tables never used */
140555 pCol->affinity = sqlite3ExprAffinity(p);
140556 if( pCol->affinity<=SQLITE_AFF_NONE ){
140557 pCol->affinity = aff;
140558 }else if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){
140559 pCol->affinity = SQLITE_AFF_FLEXNUM;
140560 }
140561 if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){
140562 int m = 0;
140563 Select *pS2;
140564 for(m=0, pS2=pSelect->pNext; pS2; pS2=pS2->pNext){
@@ -140567,10 +141105,13 @@
140567 if( pCol->affinity==SQLITE_AFF_TEXT && (m&0x01)!=0 ){
140568 pCol->affinity = SQLITE_AFF_BLOB;
140569 }else
140570 if( pCol->affinity>=SQLITE_AFF_NUMERIC && (m&0x02)!=0 ){
140571 pCol->affinity = SQLITE_AFF_BLOB;
 
 
 
140572 }
140573 }
140574 zType = columnType(&sNC, p, 0, 0, 0);
140575 if( zType==0 || pCol->affinity!=sqlite3AffinityType(zType, 0) ){
140576 if( pCol->affinity==SQLITE_AFF_NUMERIC
@@ -142082,11 +142623,13 @@
142082 assert( pExpr->pRight==0 );
142083 if( sqlite3ExprIsVector(pCopy) ){
142084 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142085 }else{
142086 sqlite3 *db = pSubst->pParse->db;
142087 if( pSubst->isOuterJoin && pCopy->op!=TK_COLUMN ){
 
 
142088 memset(&ifNullRow, 0, sizeof(ifNullRow));
142089 ifNullRow.op = TK_IF_NULL_ROW;
142090 ifNullRow.pLeft = pCopy;
142091 ifNullRow.iTable = pSubst->iNewTable;
142092 ifNullRow.iColumn = -99;
@@ -142459,12 +143002,11 @@
142459 ** (17f) the subquery must not be the RHS of a LEFT JOIN.
142460 ** (17g) either the subquery is the first element of the outer
142461 ** query or there are no RIGHT or FULL JOINs in any arm
142462 ** of the subquery. (This is a duplicate of condition (27b).)
142463 ** (17h) The corresponding result set expressions in all arms of the
142464 ** compound must have the same affinity. (See restriction (9)
142465 ** on the push-down optimization.)
142466 **
142467 ** The parent and sub-query may contain WHERE clauses. Subject to
142468 ** rules (11), (13) and (14), they may also contain ORDER BY,
142469 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
142470 ** operator other than UNION ALL because all the other compound
@@ -143328,14 +143870,10 @@
143328 **
143329 ** (8) If the subquery is a compound that uses UNION, INTERSECT,
143330 ** or EXCEPT, then all of the result set columns for all arms of
143331 ** the compound must use the BINARY collating sequence.
143332 **
143333 ** (9) If the subquery is a compound, then all arms of the compound must
143334 ** have the same affinity. (This is the same as restriction (17h)
143335 ** for query flattening.)
143336 **
143337 **
143338 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
143339 ** terms are duplicated into the subquery.
143340 */
143341 static int pushDownWhereTerms(
@@ -143362,13 +143900,10 @@
143362 }
143363 #ifndef SQLITE_OMIT_WINDOWFUNC
143364 if( pSel->pWin ) return 0; /* restriction (6b) */
143365 #endif
143366 }
143367 if( compoundHasDifferentAffinities(pSubq) ){
143368 return 0; /* restriction (9) */
143369 }
143370 if( notUnionAll ){
143371 /* If any of the compound arms are connected using UNION, INTERSECT,
143372 ** or EXCEPT, then we must ensure that none of the columns use a
143373 ** non-BINARY collating sequence. */
143374 for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143455,10 +143990,80 @@
143455 }
143456 }
143457 return nChng;
143458 }
143459 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143460
143461 /*
143462 ** The pFunc is the only aggregate function in the query. Check to see
143463 ** if the query is a candidate for the min/max optimization.
143464 **
@@ -144598,14 +145203,16 @@
144598 Select *pSelect, /* The SELECT statement being processed */
144599 AggInfo *pAggInfo, /* The aggregate info */
144600 NameContext *pNC /* Name context used to resolve agg-func args */
144601 ){
144602 assert( pAggInfo->iFirstReg==0 );
 
 
144603 pAggInfo->nColumn = pAggInfo->nAccumulator;
144604 if( ALWAYS(pAggInfo->nSortingColumn>0) ){
144605 if( pAggInfo->nColumn==0 ){
144606 pAggInfo->nSortingColumn = 0;
144607 }else{
144608 pAggInfo->nSortingColumn =
144609 pAggInfo->aCol[pAggInfo->nColumn-1].iSorterColumn+1;
144610 }
144611 }
@@ -144639,15 +145246,17 @@
144639 if( pExpr->pAggInfo==0 ) return WRC_Continue;
144640 if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
144641 if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
144642 if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
144643 pAggInfo = pExpr->pAggInfo;
144644 assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
 
144645 pCol = &pAggInfo->aCol[pExpr->iAgg];
144646 pExpr->op = TK_AGG_COLUMN;
144647 pExpr->iTable = pCol->iTable;
144648 pExpr->iColumn = pCol->iColumn;
 
144649 return WRC_Prune;
144650 }
144651
144652 /*
144653 ** Convert every pAggInfo->aFunc[].pExpr such that any node within
@@ -144997,11 +145606,10 @@
144997 sqlite3DbFree(db, p->aCol);
144998 sqlite3DbFree(db, p->aFunc);
144999 sqlite3DbFreeNN(db, p);
145000 }
145001
145002 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145003 /*
145004 ** Attempt to transform a query of the form
145005 **
145006 ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145007 **
@@ -145025,11 +145633,13 @@
145025 Expr *pCount;
145026 sqlite3 *db;
145027 if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145028 if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145029 if( p->pWhere ) return 0;
 
145030 if( p->pGroupBy ) return 0;
 
145031 pExpr = p->pEList->a[0].pExpr;
145032 if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145033 assert( ExprUseUToken(pExpr) );
145034 if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */
145035 assert( ExprUseXList(pExpr) );
@@ -145036,17 +145646,19 @@
145036 if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */
145037 if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */
145038 if( ExprHasProperty(pExpr, EP_WinFunc) ) return 0;/* Not a window function */
145039 pSub = p->pSrc->a[0].pSelect;
145040 if( pSub==0 ) return 0; /* The FROM is a subquery */
145041 if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */
 
145042 do{
145043 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145044 if( pSub->pWhere ) return 0; /* No WHERE clause */
145045 if( pSub->pLimit ) return 0; /* No LIMIT clause */
145046 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145047 pSub = pSub->pPrior; /* Repeat over compound */
 
145048 }while( pSub );
145049
145050 /* If we reach this point then it is OK to perform the transformation */
145051
145052 db = pParse->db;
@@ -145085,11 +145697,10 @@
145085 sqlite3TreeViewSelect(0, p, 0);
145086 }
145087 #endif
145088 return 1;
145089 }
145090 #endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
145091
145092 /*
145093 ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145094 ** as pSrcItem but has the same alias as p0, then return true.
145095 ** Otherwise return false.
@@ -145474,19 +146085,16 @@
145474 #endif
145475 }else{
145476 TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
145477 }
145478
145479 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145480 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
145481 && countOfViewOptimization(pParse, p)
145482 ){
145483 if( db->mallocFailed ) goto select_end;
145484 pEList = p->pEList;
145485 pTabList = p->pSrc;
145486 }
145487 #endif
145488
145489 /* For each term in the FROM clause, do two things:
145490 ** (1) Authorized unreferenced tables
145491 ** (2) Generate code for all sub-queries
145492 */
@@ -145554,10 +146162,26 @@
145554 #endif
145555 assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
145556 }else{
145557 TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
145558 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145559
145560 zSavedAuthContext = pParse->zAuthContext;
145561 pParse->zAuthContext = pItem->zName;
145562
145563 /* Generate code to implement the subquery
@@ -146841,10 +147465,11 @@
146841 if( !noErr ){
146842 sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
146843 }else{
146844 assert( !db->init.busy );
146845 sqlite3CodeVerifySchema(pParse, iDb);
 
146846 }
146847 goto trigger_cleanup;
146848 }
146849 }
146850
@@ -147622,11 +148247,11 @@
147622 assert( db->mallocFailed==0 );
147623 sqlite3GenerateColumnNames(pParse, &sSelect);
147624 }
147625 sqlite3ExprListDelete(db, sSelect.pEList);
147626 pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
147627 if( !db->mallocFailed ){
147628 NameContext sNC;
147629 memset(&sNC, 0, sizeof(sNC));
147630 if( pReturning->nRetCol==0 ){
147631 pReturning->nRetCol = pNew->nExpr;
147632 pReturning->iRetCur = pParse->nTab++;
@@ -148091,10 +148716,13 @@
148091 const int op = pChanges ? TK_UPDATE : TK_DELETE;
148092 u32 mask = 0;
148093 Trigger *p;
148094
148095 assert( isNew==1 || isNew==0 );
 
 
 
148096 for(p=pTrigger; p; p=p->pNext){
148097 if( p->op==op
148098 && (tr_tm&p->tr_tm)
148099 && checkColumnOverlap(p->pColumns,pChanges)
148100 ){
@@ -148525,11 +149153,11 @@
148525 #endif
148526
148527 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
148528 goto update_cleanup;
148529 }
148530 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
148531 goto update_cleanup;
148532 }
148533
148534 /* Allocate a cursors for the main database table and for all indices.
148535 ** The index cursors might not be used, but if they are used they
@@ -148844,16 +149472,26 @@
148844 bFinishSeek = 0;
148845 }else{
148846 /* Begin the database scan.
148847 **
148848 ** Do not consider a single-pass strategy for a multi-row update if
148849 ** there are any triggers or foreign keys to process, or rows may
148850 ** be deleted as a result of REPLACE conflict handling. Any of these
148851 ** things might disturb a cursor being used to scan through the table
148852 ** or index, causing a single-pass approach to malfunction. */
 
 
 
 
148853 flags = WHERE_ONEPASS_DESIRED;
148854 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
 
 
 
 
 
 
148855 flags |= WHERE_ONEPASS_MULTIROW;
148856 }
148857 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
148858 if( pWInfo==0 ) goto update_cleanup;
148859
@@ -150814,11 +151452,13 @@
150814 sCtx.pTab = pTab;
150815 sCtx.pVTable = pVTable;
150816 sCtx.pPrior = db->pVtabCtx;
150817 sCtx.bDeclared = 0;
150818 db->pVtabCtx = &sCtx;
 
150819 rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
 
150820 db->pVtabCtx = sCtx.pPrior;
150821 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
150822 assert( sCtx.pTab==pTab );
150823
150824 if( SQLITE_OK!=rc ){
@@ -151532,10 +152172,14 @@
151532 break;
151533 }
151534 case SQLITE_VTAB_DIRECTONLY: {
151535 p->pVTable->eVtabRisk = SQLITE_VTABRISK_High;
151536 break;
 
 
 
 
151537 }
151538 default: {
151539 rc = SQLITE_MISUSE_BKPT;
151540 break;
151541 }
@@ -152306,13 +152950,13 @@
152306 sqlite3_str_append(pStr, ")", 1);
152307 }
152308
152309 /*
152310 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152311 ** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
152312 ** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
152313 ** is added to the output to describe the table scan strategy in pLevel.
152314 **
152315 ** If an OP_Explain opcode is added to the VM, its address is returned.
152316 ** Otherwise, if no OP_Explain is coded, zero is returned.
152317 */
152318 SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152320,12 +152964,12 @@
152320 SrcList *pTabList, /* Table list this loop refers to */
152321 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152322 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152323 ){
152324 int ret = 0;
152325 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
152326 if( sqlite3ParseToplevel(pParse)->explain==2 )
152327 #endif
152328 {
152329 SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152330 Vdbe *v = pParse->pVdbe; /* VM being constructed */
152331 sqlite3 *db = pParse->db; /* Database handle */
@@ -152487,31 +153131,33 @@
152487 Vdbe *v, /* Vdbe to add scanstatus entry to */
152488 SrcList *pSrclist, /* FROM clause pLvl reads data from */
152489 WhereLevel *pLvl, /* Level to add scanstatus() entry for */
152490 int addrExplain /* Address of OP_Explain (or 0) */
152491 ){
152492 const char *zObj = 0;
152493 WhereLoop *pLoop = pLvl->pWLoop;
152494 int wsFlags = pLoop->wsFlags;
152495 int viaCoroutine = 0;
152496
152497 if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152498 zObj = pLoop->u.btree.pIndex->zName;
152499 }else{
152500 zObj = pSrclist->a[pLvl->iFrom].zName;
152501 viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152502 }
152503 sqlite3VdbeScanStatus(
152504 v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152505 );
152506
152507 if( viaCoroutine==0 ){
152508 if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152509 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152510 }
152511 if( wsFlags & WHERE_INDEXED ){
152512 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
 
 
152513 }
152514 }
152515 }
152516 #endif
152517
@@ -153204,31 +153850,29 @@
153204 ** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into
153205 ** an access of the index rather than the original table.
153206 */
153207 static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
153208 int rc = WRC_Continue;
 
153209 struct CCurHint *pHint = pWalker->u.pCCurHint;
153210 if( pExpr->op==TK_COLUMN ){
153211 if( pExpr->iTable!=pHint->iTabCur ){
153212 int reg = ++pWalker->pParse->nMem; /* Register for column value */
153213 sqlite3ExprCode(pWalker->pParse, pExpr, reg);
153214 pExpr->op = TK_REGISTER;
153215 pExpr->iTable = reg;
153216 }else if( pHint->pIdx!=0 ){
153217 pExpr->iTable = pHint->iIdxCur;
153218 pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn);
153219 assert( pExpr->iColumn>=0 );
153220 }
153221 }else if( pExpr->op==TK_AGG_FUNCTION ){
153222 /* An aggregate function in the WHERE clause of a query means this must
153223 ** be a correlated sub-query, and expression pExpr is an aggregate from
153224 ** the parent context. Do not walk the function arguments in this case.
153225 **
153226 ** todo: It should be possible to replace this node with a TK_REGISTER
153227 ** expression, as the result of the expression must be stored in a
153228 ** register at this point. The same holds for TK_AGG_COLUMN nodes. */
153229 rc = WRC_Prune;
 
 
 
 
153230 }
153231 return rc;
153232 }
153233
153234 /*
@@ -154120,11 +154764,11 @@
154120 ** of entries in the tree, so basing the number of steps to try
154121 ** on the estimated number of rows in the btree seems like a good
154122 ** guess. */
154123 addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154124 (pIdx->aiRowLogEst[0]+9)/10);
154125 if( pRangeStart ){
154126 sqlite3VdbeChangeP5(v, 1);
154127 sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154128 addrSeekScan = 0;
154129 }
154130 VdbeCoverage(v);
@@ -154161,20 +154805,11 @@
154161 */
154162 nConstraint = nEq;
154163 assert( pLevel->p2==0 );
154164 if( pRangeEnd ){
154165 Expr *pRight = pRangeEnd->pExpr->pRight;
154166 if( addrSeekScan ){
154167 /* For a seek-scan that has a range on the lowest term of the index,
154168 ** we have to make the top of the loop be code that sets the end
154169 ** condition of the range. Otherwise, the OP_SeekScan might jump
154170 ** over that initialization, leaving the range-end value set to the
154171 ** range-start value, resulting in a wrong answer.
154172 ** See ticket 5981a8c041a3c2f3 (2021-11-02).
154173 */
154174 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154175 }
154176 codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154177 whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154178 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154179 && sqlite3ExprCanBeNull(pRight)
154180 ){
@@ -154204,11 +154839,11 @@
154204 }
154205 if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154206 if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154207
154208 /* Top of the loop body */
154209 if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154210
154211 /* Check if the index cursor is past the end of the range. */
154212 if( nConstraint ){
154213 if( regBignull ){
154214 /* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156846,13 +157481,16 @@
156846 pColRef->y.pTab = pTab;
156847 pItem->colUsed |= sqlite3ExprColUsed(pColRef);
156848 pRhs = sqlite3PExpr(pParse, TK_UPLUS,
156849 sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
156850 pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
156851 if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ) ){
 
 
156852 joinType = EP_OuterON;
156853 }else{
 
156854 joinType = EP_InnerON;
156855 }
156856 sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
156857 whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
156858 }
@@ -157691,11 +158329,11 @@
157691 Parse *pParse,
157692 Index *pIdx, /* Automatic index to explain */
157693 int bPartial, /* True if pIdx is a partial index */
157694 int *pAddrExplain /* OUT: Address of OP_Explain */
157695 ){
157696 if( pParse->explain!=2 ){
157697 Table *pTab = pIdx->pTable;
157698 const char *zSep = "";
157699 char *zText = 0;
157700 int ii = 0;
157701 sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157752,11 +158390,12 @@
157752 CollSeq *pColl; /* Collating sequence to on a column */
157753 WhereLoop *pLoop; /* The Loop object */
157754 char *zNotUsed; /* Extra space on the end of pIdx */
157755 Bitmask idxCols; /* Bitmap of columns used for indexing */
157756 Bitmask extraCols; /* Bitmap of additional columns */
157757 u8 sentWarning = 0; /* True if a warnning has been issued */
 
157758 Expr *pPartial = 0; /* Partial Index Expression */
157759 int iContinue = 0; /* Jump here to skip excluded rows */
157760 SrcItem *pTabItem; /* FROM clause term being indexed */
157761 int addrCounter = 0; /* Address where integer counter is initialized */
157762 int regBase; /* Array of registers where record is assembled */
@@ -157822,11 +158461,15 @@
157822 ** original table never needs to be accessed. Automatic indices must
157823 ** be a covering index because the index will not be updated if the
157824 ** original table changes and the index and table cannot both be used
157825 ** if they go out of sync.
157826 */
157827 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
 
 
 
 
157828 mxBitCol = MIN(BMS-1,pTable->nCol);
157829 testcase( pTable->nCol==BMS-1 );
157830 testcase( pTable->nCol==BMS-2 );
157831 for(i=0; i<mxBitCol; i++){
157832 if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157858,10 +158501,20 @@
157858 pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
157859 pColl = sqlite3ExprCompareCollSeq(pParse, pX);
157860 assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
157861 pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
157862 n++;
 
 
 
 
 
 
 
 
 
 
157863 }
157864 }
157865 }
157866 assert( (u32)n==pLoop->u.btree.nEq );
157867
@@ -157890,11 +158543,12 @@
157890 assert( pLevel->iIdxCur>=0 );
157891 pLevel->iIdxCur = pParse->nTab++;
157892 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
157893 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
157894 VdbeComment((v, "for %s", pTable->zName));
157895 if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
 
157896 pLevel->regFilter = ++pParse->nMem;
157897 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
157898 }
157899
157900 /* Fill the automatic index with content */
@@ -157983,10 +158637,14 @@
157983 const WhereTerm *pWCEnd; /* Last WHERE clause term */
157984 Parse *pParse = pWInfo->pParse; /* Parsing context */
157985 Vdbe *v = pParse->pVdbe; /* VDBE under construction */
157986 WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
157987 int iCur; /* Cursor for table getting the filter */
 
 
 
 
157988
157989 assert( pLoop!=0 );
157990 assert( v!=0 );
157991 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
157992
@@ -158039,13 +158697,12 @@
158039 Index *pIdx = pLoop->u.btree.pIndex;
158040 int n = pLoop->u.btree.nEq;
158041 int r1 = sqlite3GetTempRange(pParse, n);
158042 int jj;
158043 for(jj=0; jj<n; jj++){
158044 int iCol = pIdx->aiColumn[jj];
158045 assert( pIdx->pTable==pItem->pTab );
158046 sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
158047 }
158048 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158049 sqlite3ReleaseTempRange(pParse, r1, n);
158050 }
158051 sqlite3VdbeResolveLabel(v, addrCont);
@@ -158072,10 +158729,11 @@
158072 break;
158073 }
158074 }
158075 }while( iLevel < pWInfo->nLevel );
158076 sqlite3VdbeJumpHere(v, addrOnce);
 
158077 }
158078
158079
158080 #ifndef SQLITE_OMIT_VIRTUALTABLE
158081 /*
@@ -158327,10 +158985,13 @@
158327 sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc));
158328 }else{
158329 sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg);
158330 }
158331 }
 
 
 
158332 sqlite3_free(pVtab->zErrMsg);
158333 pVtab->zErrMsg = 0;
158334 return rc;
158335 }
158336 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
@@ -158370,10 +159031,11 @@
158370 UNUSED_PARAMETER( pParse );
158371 #endif
158372 assert( pRec!=0 );
158373 assert( pIdx->nSample>0 );
158374 assert( pRec->nField>0 );
 
158375
158376 /* Do a binary search to find the first sample greater than or equal
158377 ** to pRec. If pRec contains a single field, the set of samples to search
158378 ** is simply the aSample[] array. If the samples in aSample[] contain more
158379 ** than one fields, all fields following the first are ignored.
@@ -158415,11 +159077,16 @@
158415 ** appears that it should be 1 field in size. However, that would make it
158416 ** smaller than sample 1, so the binary search would not work. As a result,
158417 ** it is extended to two fields. The duplicates that this creates do not
158418 ** cause any problems.
158419 */
158420 nField = MIN(pRec->nField, pIdx->nSample);
 
 
 
 
 
158421 iCol = 0;
158422 iSample = pIdx->nSample * nField;
158423 do{
158424 int iSamp; /* Index in aSample[] of test sample */
158425 int n; /* Number of fields in test sample */
@@ -158851,11 +159518,11 @@
158851 #else
158852 UNUSED_PARAMETER(pParse);
158853 UNUSED_PARAMETER(pBuilder);
158854 assert( pLower || pUpper );
158855 #endif
158856 assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );
158857 nNew = whereRangeAdjust(pLower, nOut);
158858 nNew = whereRangeAdjust(pUpper, nNew);
158859
158860 /* TUNING: If there is both an upper and lower limit and neither limit
158861 ** has an application-defined likelihood(), assume the range is
@@ -160952,24 +161619,20 @@
160952 HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
160953 assert( pHidden->eDistinct>=0 && pHidden->eDistinct<=3 );
160954 return pHidden->eDistinct;
160955 }
160956
160957 #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
160958 && !defined(SQLITE_OMIT_VIRTUALTABLE)
160959 /*
160960 ** Cause the prepared statement that is associated with a call to
160961 ** xBestIndex to potentially use all schemas. If the statement being
160962 ** prepared is read-only, then just start read transactions on all
160963 ** schemas. But if this is a write operation, start writes on all
160964 ** schemas.
160965 **
160966 ** This is used by the (built-in) sqlite_dbpage virtual table.
160967 */
160968 SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info *pIdxInfo){
160969 HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
160970 Parse *pParse = pHidden->pParse;
160971 int nDb = pParse->db->nDb;
160972 int i;
160973 for(i=0; i<nDb; i++){
160974 sqlite3CodeVerifySchema(pParse, i);
160975 }
@@ -160977,11 +161640,10 @@
160977 for(i=0; i<nDb; i++){
160978 sqlite3BeginWriteOperation(pParse, 0, i);
160979 }
160980 }
160981 }
160982 #endif
160983
160984 /*
160985 ** Add all WhereLoop objects for a table of the join identified by
160986 ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
160987 **
@@ -162143,10 +162805,14 @@
162143 pWInfo->nOBSat = pFrom->isOrdered;
162144 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162145 if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162146 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162147 }
 
 
 
 
162148 }else{
162149 pWInfo->revMask = pFrom->revLoop;
162150 if( pWInfo->nOBSat<=0 ){
162151 pWInfo->nOBSat = 0;
162152 if( nLoop>0 ){
@@ -162554,10 +163220,13 @@
162554 p->pExpr = sqlite3ExprDup(pParse->db, pExpr, 0);
162555 p->iDataCur = pTabItem->iCursor;
162556 p->iIdxCur = iIdxCur;
162557 p->iIdxCol = i;
162558 p->bMaybeNullRow = bMaybeNullRow;
 
 
 
162559 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
162560 p->zIdxName = pIdx->zName;
162561 #endif
162562 pParse->pIdxEpr = p;
162563 if( p->pIENext==0 ){
@@ -163069,11 +163738,11 @@
163069 for(; b; b=b>>1, n++){}
163070 sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163071 assert( n<=pTab->nCol );
163072 }
163073 #ifdef SQLITE_ENABLE_CURSOR_HINTS
163074 if( pLoop->u.btree.pIndex!=0 ){
163075 sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163076 }else
163077 #endif
163078 {
163079 sqlite3VdbeChangeP5(v, bFordelete);
@@ -163527,11 +164196,12 @@
163527 }
163528 }
163529 k = pLevel->addrBody + 1;
163530 #ifdef SQLITE_DEBUG
163531 if( db->flags & SQLITE_VdbeAddopTrace ){
163532 printf("TRANSLATE opcodes in range %d..%d\n", k, last-1);
 
163533 }
163534 /* Proof that the "+1" on the k value above is safe */
163535 pOp = sqlite3VdbeGetOp(v, k - 1);
163536 assert( pOp->opcode!=OP_Column || pOp->p1!=pLevel->iTabCur );
163537 assert( pOp->opcode!=OP_Rowid || pOp->p1!=pLevel->iTabCur );
@@ -167230,22 +167900,22 @@
167230 #define sqlite3ParserCTX_PDECL ,Parse *pParse
167231 #define sqlite3ParserCTX_PARAM ,pParse
167232 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167233 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167234 #define YYFALLBACK 1
167235 #define YYNSTATE 576
167236 #define YYNRULE 405
167237 #define YYNRULE_WITH_ACTION 342
167238 #define YYNTOKEN 185
167239 #define YY_MAX_SHIFT 575
167240 #define YY_MIN_SHIFTREDUCE 835
167241 #define YY_MAX_SHIFTREDUCE 1239
167242 #define YY_ERROR_ACTION 1240
167243 #define YY_ACCEPT_ACTION 1241
167244 #define YY_NO_ACTION 1242
167245 #define YY_MIN_REDUCE 1243
167246 #define YY_MAX_REDUCE 1647
167247 /************* End control #defines *******************************************/
167248 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167249
167250 /* Define the yytestcase() macro to be a no-op if is not already defined
167251 ** otherwise.
@@ -167308,222 +167978,222 @@
167308 ** yy_reduce_ofst[] For each state, the offset into yy_action for
167309 ** shifting non-terminals after a reduce.
167310 ** yy_default[] Default action for each state.
167311 **
167312 *********** Begin parsing tables **********************************************/
167313 #define YY_ACTTAB_COUNT (2098)
167314 static const YYACTIONTYPE yy_action[] = {
167315 /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167316 /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409,
167317 /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71,
167318 /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972,
167319 /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053,
167320 /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409,
167321 /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229,
167322 /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327,
167323 /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053,
167324 /* 90 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 118, 115,
167325 /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167326 /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167327 /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565,
167328 /* 130 */ 409, 1567, 537, 259, 226, 444, 101, 145, 449, 316,
167329 /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
167330 /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050,
167331 /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142,
167332 /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444,
167333 /* 180 */ 127, 1192, 1193, 1194, 148, 441, 440, 568, 119, 116,
167334 /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
167335 /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
167336 /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
167337 /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193,
167338 /* 230 */ 1194, 149, 1224, 409, 1224, 124, 124, 124, 124, 122,
167339 /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167340 /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80,
167341 /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124,
167342 /* 270 */ 124, 124, 1279, 522, 222, 1192, 568, 409, 224, 514,
167343 /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
167344 /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133,
167345 /* 300 */ 133, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, 1040,
167346 /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
167347 /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546,
167348 /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501,
167349 /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340,
167350 /* 350 */ 460, 328, 360, 394, 1237, 1192, 1193, 1194, 563, 568,
167351 /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
167352 /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154,
167353 /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194,
167354 /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222,
167355 /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050,
167356 /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550,
167357 /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109,
167358 /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570,
167359 /* 440 */ 569, 430, 1552, 1017, 325, 551, 1192, 270, 287, 368,
167360 /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
167361 /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120,
167362 /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27,
167363 /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901,
167364 /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516,
167365 /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51,
167366 /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040,
167367 /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135,
167368 /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120,
167369 /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561,
167370 /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217,
167371 /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167372 /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167373 /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267,
167374 /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571,
167375 /* 600 */ 1192, 571, 409, 292, 499, 957, 876, 191, 480, 316,
167376 /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
167377 /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167378 /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167379 /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192,
167380 /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194,
167381 /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217,
167382 /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167383 /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121,
167384 /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192,
167385 /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232,
167386 /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580,
167387 /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121,
167388 /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167389 /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167390 /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192,
167391 /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568,
167392 /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217,
167393 /* 780 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167394 /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
167395 /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
167396 /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297,
167397 /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200,
167398 /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121,
167399 /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167400 /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167401 /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278,
167402 /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568,
167403 /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217,
167404 /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167405 /* 900 */ 453, 1482, 13, 13, 1536, 122, 122, 122, 122, 121,
167406 /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
167407 /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212,
167408 /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1327, 9, 1196,
167409 /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
167410 /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167411 /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167412 /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245,
167413 /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643,
167414 /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240,
167415 /* 1000 */ 1325, 104, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123,
167416 /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
167417 /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284,
167418 /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311,
167419 /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538,
167420 /* 1050 */ 568, 972, 207, 568, 1027, 240, 383, 1116, 519, 122,
167421 /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167422 /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568,
167423 /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326,
167424 /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497,
167425 /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019,
167426 /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217,
167427 /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167428 /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217,
167429 /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167430 /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217,
167431 /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167432 /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121,
167433 /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568,
167434 /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121,
167435 /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642,
167436 /* 1210 */ 539, 1642, 15, 15, 892, 122, 122, 122, 122, 121,
167437 /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
167438 /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268,
167439 /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457,
167440 /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407,
167441 /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123,
167442 /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419,
167443 /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849,
167444 /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557,
167445 /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431,
167446 /* 1310 */ 568, 1158, 322, 17, 487, 1115, 58, 58, 122, 122,
167447 /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
167448 /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560,
167449 /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
167450 /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095,
167451 /* 1360 */ 568, 293, 568, 1095, 531, 568, 872, 8, 60, 60,
167452 /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
167453 /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
167454 /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
167455 /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534,
167456 /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027,
167457 /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66,
167458 /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177,
167459 /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471,
167460 /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407,
167461 /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52,
167462 /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447,
167463 /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391,
167464 /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466,
167465 /* 1500 */ 4, 568, 152, 30, 38, 568, 1132, 234, 396, 323,
167466 /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
167467 /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
167468 /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483,
167469 /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557,
167470 /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161,
167471 /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009,
167472 /* 1570 */ 473, 261, 261, 891, 890, 235, 535, 568, 1027, 568,
167473 /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
167474 /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017,
167475 /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569,
167476 /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568,
167477 /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355,
167478 /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451,
167479 /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180,
167480 /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392,
167481 /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258,
167482 /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261,
167483 /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74,
167484 /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974,
167485 /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346,
167486 /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253,
167487 /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141,
167488 /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219,
167489 /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110,
167490 /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365,
167491 /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109,
167492 /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570,
167493 /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017,
167494 /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4,
167495 /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461,
167496 /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27,
167497 /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36,
167498 /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246,
167499 /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350,
167500 /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4,
167501 /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520,
167502 /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281,
167503 /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438,
167504 /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10,
167505 /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314,
167506 /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386,
167507 /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519,
167508 /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147,
167509 /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212,
167510 /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088,
167511 /* 1960 */ 326, 180, 169, 1212, 182, 334, 238, 915, 241, 1104,
167512 /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
167513 /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247,
167514 /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489,
167515 /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19,
167516 /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159,
167517 /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174,
167518 /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260,
167519 /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25,
167520 /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055,
167521 /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022,
167522 /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925,
167523 /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
167524 /* 2090 */ 1242, 1242, 1242, 1242, 269, 1602, 1242, 1601,
167525 };
167526 static const YYCODETYPE yy_lookahead[] = {
167527 /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
167528 /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
167529 /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167731,11 +168401,11 @@
167731 /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
167732 /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
167733 /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
167734 /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
167735 /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167736 /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319,
167737 /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167738 /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167739 /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167740 /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167741 /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167750,13 +168420,13 @@
167750 /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167751 /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167752 /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167753 /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167754 /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167755 /* 2280 */ 319, 319, 319,
167756 };
167757 #define YY_SHIFT_COUNT (575)
167758 #define YY_SHIFT_MIN (0)
167759 #define YY_SHIFT_MAX (2074)
167760 static const unsigned short int yy_shift_ofst[] = {
167761 /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
167762 /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167772,16 +168442,16 @@
167772 /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167773 /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167774 /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
167775 /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
167776 /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
167777 /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468,
167778 /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
167779 /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167780 /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
167781 /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
167782 /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307,
167783 /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
167784 /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167785 /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167786 /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
167787 /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167795,12 +168465,12 @@
167795 /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
167796 /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
167797 /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
167798 /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
167799 /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
167800 /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098,
167801 /* 400 */ 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 207,
167802 /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
167803 /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
167804 /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
167805 /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
167806 /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167813,11 +168483,11 @@
167813 /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
167814 /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
167815 /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
167816 /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
167817 /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
167818 /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074,
167819 };
167820 #define YY_REDUCE_COUNT (408)
167821 #define YY_REDUCE_MIN (-271)
167822 #define YY_REDUCE_MAX (1740)
167823 static const short yy_reduce_ofst[] = {
@@ -167862,68 +168532,68 @@
167862 /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
167863 /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
167864 /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
167865 };
167866 static const YYACTIONTYPE yy_default[] = {
167867 /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475,
167868 /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240,
167869 /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240,
167870 /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240,
167871 /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240,
167872 /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403,
167873 /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469,
167874 /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240,
167875 /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167876 /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167877 /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167878 /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167879 /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167880 /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441,
167881 /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240,
167882 /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432,
167883 /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240,
167884 /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240,
167885 /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167886 /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371,
167887 /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269,
167888 /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240,
167889 /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167890 /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240,
167891 /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167892 /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167893 /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240,
167894 /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347,
167895 /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639,
167896 /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407,
167897 /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371,
167898 /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639,
167899 /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324,
167900 /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416,
167901 /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258,
167902 /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305,
167903 /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581,
167904 /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389,
167905 /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595,
167906 /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273,
167907 /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240,
167908 /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361,
167909 /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167910 /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240,
167911 /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240,
167912 /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362,
167913 /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240,
167914 /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167915 /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240,
167916 /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167917 /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240,
167918 /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167919 /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386,
167920 /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167921 /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240,
167922 /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167923 /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422,
167924 /* 570 */ 1426, 1262, 1240, 1252, 1240, 1240,
167925 };
167926 /********** End of lemon-generated parsing tables *****************************/
167927
167928 /* The next table maps tokens (terminal symbols) into fallback tokens.
167929 ** If a construct like the following:
@@ -168716,237 +169386,235 @@
168716 /* 173 */ "idlist_opt ::=",
168717 /* 174 */ "idlist_opt ::= LP idlist RP",
168718 /* 175 */ "idlist ::= idlist COMMA nm",
168719 /* 176 */ "idlist ::= nm",
168720 /* 177 */ "expr ::= LP expr RP",
168721 /* 178 */ "expr ::= ID|INDEXED",
168722 /* 179 */ "expr ::= JOIN_KW",
168723 /* 180 */ "expr ::= nm DOT nm",
168724 /* 181 */ "expr ::= nm DOT nm DOT nm",
168725 /* 182 */ "term ::= NULL|FLOAT|BLOB",
168726 /* 183 */ "term ::= STRING",
168727 /* 184 */ "term ::= INTEGER",
168728 /* 185 */ "expr ::= VARIABLE",
168729 /* 186 */ "expr ::= expr COLLATE ID|STRING",
168730 /* 187 */ "expr ::= CAST LP expr AS typetoken RP",
168731 /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
168732 /* 189 */ "expr ::= ID|INDEXED LP STAR RP",
168733 /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
168734 /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
168735 /* 192 */ "term ::= CTIME_KW",
168736 /* 193 */ "expr ::= LP nexprlist COMMA expr RP",
168737 /* 194 */ "expr ::= expr AND expr",
168738 /* 195 */ "expr ::= expr OR expr",
168739 /* 196 */ "expr ::= expr LT|GT|GE|LE expr",
168740 /* 197 */ "expr ::= expr EQ|NE expr",
168741 /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
168742 /* 199 */ "expr ::= expr PLUS|MINUS expr",
168743 /* 200 */ "expr ::= expr STAR|SLASH|REM expr",
168744 /* 201 */ "expr ::= expr CONCAT expr",
168745 /* 202 */ "likeop ::= NOT LIKE_KW|MATCH",
168746 /* 203 */ "expr ::= expr likeop expr",
168747 /* 204 */ "expr ::= expr likeop expr ESCAPE expr",
168748 /* 205 */ "expr ::= expr ISNULL|NOTNULL",
168749 /* 206 */ "expr ::= expr NOT NULL",
168750 /* 207 */ "expr ::= expr IS expr",
168751 /* 208 */ "expr ::= expr IS NOT expr",
168752 /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr",
168753 /* 210 */ "expr ::= expr IS DISTINCT FROM expr",
168754 /* 211 */ "expr ::= NOT expr",
168755 /* 212 */ "expr ::= BITNOT expr",
168756 /* 213 */ "expr ::= PLUS|MINUS expr",
168757 /* 214 */ "expr ::= expr PTR expr",
168758 /* 215 */ "between_op ::= BETWEEN",
168759 /* 216 */ "between_op ::= NOT BETWEEN",
168760 /* 217 */ "expr ::= expr between_op expr AND expr",
168761 /* 218 */ "in_op ::= IN",
168762 /* 219 */ "in_op ::= NOT IN",
168763 /* 220 */ "expr ::= expr in_op LP exprlist RP",
168764 /* 221 */ "expr ::= LP select RP",
168765 /* 222 */ "expr ::= expr in_op LP select RP",
168766 /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist",
168767 /* 224 */ "expr ::= EXISTS LP select RP",
168768 /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END",
168769 /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
168770 /* 227 */ "case_exprlist ::= WHEN expr THEN expr",
168771 /* 228 */ "case_else ::= ELSE expr",
168772 /* 229 */ "case_else ::=",
168773 /* 230 */ "case_operand ::= expr",
168774 /* 231 */ "case_operand ::=",
168775 /* 232 */ "exprlist ::=",
168776 /* 233 */ "nexprlist ::= nexprlist COMMA expr",
168777 /* 234 */ "nexprlist ::= expr",
168778 /* 235 */ "paren_exprlist ::=",
168779 /* 236 */ "paren_exprlist ::= LP exprlist RP",
168780 /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
168781 /* 238 */ "uniqueflag ::= UNIQUE",
168782 /* 239 */ "uniqueflag ::=",
168783 /* 240 */ "eidlist_opt ::=",
168784 /* 241 */ "eidlist_opt ::= LP eidlist RP",
168785 /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder",
168786 /* 243 */ "eidlist ::= nm collate sortorder",
168787 /* 244 */ "collate ::=",
168788 /* 245 */ "collate ::= COLLATE ID|STRING",
168789 /* 246 */ "cmd ::= DROP INDEX ifexists fullname",
168790 /* 247 */ "cmd ::= VACUUM vinto",
168791 /* 248 */ "cmd ::= VACUUM nm vinto",
168792 /* 249 */ "vinto ::= INTO expr",
168793 /* 250 */ "vinto ::=",
168794 /* 251 */ "cmd ::= PRAGMA nm dbnm",
168795 /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
168796 /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
168797 /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
168798 /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
168799 /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT",
168800 /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT",
168801 /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
168802 /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
168803 /* 260 */ "trigger_time ::= BEFORE|AFTER",
168804 /* 261 */ "trigger_time ::= INSTEAD OF",
168805 /* 262 */ "trigger_time ::=",
168806 /* 263 */ "trigger_event ::= DELETE|INSERT",
168807 /* 264 */ "trigger_event ::= UPDATE",
168808 /* 265 */ "trigger_event ::= UPDATE OF idlist",
168809 /* 266 */ "when_clause ::=",
168810 /* 267 */ "when_clause ::= WHEN expr",
168811 /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
168812 /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI",
168813 /* 270 */ "trnm ::= nm DOT nm",
168814 /* 271 */ "tridxby ::= INDEXED BY nm",
168815 /* 272 */ "tridxby ::= NOT INDEXED",
168816 /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
168817 /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
168818 /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
168819 /* 276 */ "trigger_cmd ::= scanpt select scanpt",
168820 /* 277 */ "expr ::= RAISE LP IGNORE RP",
168821 /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
168822 /* 279 */ "raisetype ::= ROLLBACK",
168823 /* 280 */ "raisetype ::= ABORT",
168824 /* 281 */ "raisetype ::= FAIL",
168825 /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
168826 /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
168827 /* 284 */ "cmd ::= DETACH database_kw_opt expr",
168828 /* 285 */ "key_opt ::=",
168829 /* 286 */ "key_opt ::= KEY expr",
168830 /* 287 */ "cmd ::= REINDEX",
168831 /* 288 */ "cmd ::= REINDEX nm dbnm",
168832 /* 289 */ "cmd ::= ANALYZE",
168833 /* 290 */ "cmd ::= ANALYZE nm dbnm",
168834 /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
168835 /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
168836 /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
168837 /* 294 */ "add_column_fullname ::= fullname",
168838 /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
168839 /* 296 */ "cmd ::= create_vtab",
168840 /* 297 */ "cmd ::= create_vtab LP vtabarglist RP",
168841 /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
168842 /* 299 */ "vtabarg ::=",
168843 /* 300 */ "vtabargtoken ::= ANY",
168844 /* 301 */ "vtabargtoken ::= lp anylist RP",
168845 /* 302 */ "lp ::= LP",
168846 /* 303 */ "with ::= WITH wqlist",
168847 /* 304 */ "with ::= WITH RECURSIVE wqlist",
168848 /* 305 */ "wqas ::= AS",
168849 /* 306 */ "wqas ::= AS MATERIALIZED",
168850 /* 307 */ "wqas ::= AS NOT MATERIALIZED",
168851 /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
168852 /* 309 */ "wqlist ::= wqitem",
168853 /* 310 */ "wqlist ::= wqlist COMMA wqitem",
168854 /* 311 */ "windowdefn_list ::= windowdefn",
168855 /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
168856 /* 313 */ "windowdefn ::= nm AS LP window RP",
168857 /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
168858 /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
168859 /* 316 */ "window ::= ORDER BY sortlist frame_opt",
168860 /* 317 */ "window ::= nm ORDER BY sortlist frame_opt",
168861 /* 318 */ "window ::= frame_opt",
168862 /* 319 */ "window ::= nm frame_opt",
168863 /* 320 */ "frame_opt ::=",
168864 /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
168865 /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
168866 /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
168867 /* 324 */ "frame_bound_s ::= frame_bound",
168868 /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
168869 /* 326 */ "frame_bound_e ::= frame_bound",
168870 /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
168871 /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
168872 /* 329 */ "frame_bound ::= CURRENT ROW",
168873 /* 330 */ "frame_exclude_opt ::=",
168874 /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
168875 /* 332 */ "frame_exclude ::= NO OTHERS",
168876 /* 333 */ "frame_exclude ::= CURRENT ROW",
168877 /* 334 */ "frame_exclude ::= GROUP|TIES",
168878 /* 335 */ "window_clause ::= WINDOW windowdefn_list",
168879 /* 336 */ "filter_over ::= filter_clause over_clause",
168880 /* 337 */ "filter_over ::= over_clause",
168881 /* 338 */ "filter_over ::= filter_clause",
168882 /* 339 */ "over_clause ::= OVER LP window RP",
168883 /* 340 */ "over_clause ::= OVER nm",
168884 /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP",
168885 /* 342 */ "input ::= cmdlist",
168886 /* 343 */ "cmdlist ::= cmdlist ecmd",
168887 /* 344 */ "cmdlist ::= ecmd",
168888 /* 345 */ "ecmd ::= SEMI",
168889 /* 346 */ "ecmd ::= cmdx SEMI",
168890 /* 347 */ "ecmd ::= explain cmdx SEMI",
168891 /* 348 */ "trans_opt ::=",
168892 /* 349 */ "trans_opt ::= TRANSACTION",
168893 /* 350 */ "trans_opt ::= TRANSACTION nm",
168894 /* 351 */ "savepoint_opt ::= SAVEPOINT",
168895 /* 352 */ "savepoint_opt ::=",
168896 /* 353 */ "cmd ::= create_table create_table_args",
168897 /* 354 */ "table_option_set ::= table_option",
168898 /* 355 */ "columnlist ::= columnlist COMMA columnname carglist",
168899 /* 356 */ "columnlist ::= columnname carglist",
168900 /* 357 */ "nm ::= ID|INDEXED",
168901 /* 358 */ "nm ::= STRING",
168902 /* 359 */ "nm ::= JOIN_KW",
168903 /* 360 */ "typetoken ::= typename",
168904 /* 361 */ "typename ::= ID|STRING",
168905 /* 362 */ "signed ::= plus_num",
168906 /* 363 */ "signed ::= minus_num",
168907 /* 364 */ "carglist ::= carglist ccons",
168908 /* 365 */ "carglist ::=",
168909 /* 366 */ "ccons ::= NULL onconf",
168910 /* 367 */ "ccons ::= GENERATED ALWAYS AS generated",
168911 /* 368 */ "ccons ::= AS generated",
168912 /* 369 */ "conslist_opt ::= COMMA conslist",
168913 /* 370 */ "conslist ::= conslist tconscomma tcons",
168914 /* 371 */ "conslist ::= tcons",
168915 /* 372 */ "tconscomma ::=",
168916 /* 373 */ "defer_subclause_opt ::= defer_subclause",
168917 /* 374 */ "resolvetype ::= raisetype",
168918 /* 375 */ "selectnowith ::= oneselect",
168919 /* 376 */ "oneselect ::= values",
168920 /* 377 */ "sclp ::= selcollist COMMA",
168921 /* 378 */ "as ::= ID|STRING",
168922 /* 379 */ "indexed_opt ::= indexed_by",
168923 /* 380 */ "returning ::=",
168924 /* 381 */ "expr ::= term",
168925 /* 382 */ "likeop ::= LIKE_KW|MATCH",
168926 /* 383 */ "exprlist ::= nexprlist",
168927 /* 384 */ "nmnum ::= plus_num",
168928 /* 385 */ "nmnum ::= nm",
168929 /* 386 */ "nmnum ::= ON",
168930 /* 387 */ "nmnum ::= DELETE",
168931 /* 388 */ "nmnum ::= DEFAULT",
168932 /* 389 */ "plus_num ::= INTEGER|FLOAT",
168933 /* 390 */ "foreach_clause ::=",
168934 /* 391 */ "foreach_clause ::= FOR EACH ROW",
168935 /* 392 */ "trnm ::= nm",
168936 /* 393 */ "tridxby ::=",
168937 /* 394 */ "database_kw_opt ::= DATABASE",
168938 /* 395 */ "database_kw_opt ::=",
168939 /* 396 */ "kwcolumn_opt ::=",
168940 /* 397 */ "kwcolumn_opt ::= COLUMNKW",
168941 /* 398 */ "vtabarglist ::= vtabarg",
168942 /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
168943 /* 400 */ "vtabarg ::= vtabarg vtabargtoken",
168944 /* 401 */ "anylist ::=",
168945 /* 402 */ "anylist ::= anylist LP anylist RP",
168946 /* 403 */ "anylist ::= anylist ANY",
168947 /* 404 */ "with ::=",
168948 };
168949 #endif /* NDEBUG */
168950
168951
168952 #if YYSTACKDEPTH<=0
@@ -169627,237 +170295,235 @@
169627 270, /* (173) idlist_opt ::= */
169628 270, /* (174) idlist_opt ::= LP idlist RP */
169629 263, /* (175) idlist ::= idlist COMMA nm */
169630 263, /* (176) idlist ::= nm */
169631 217, /* (177) expr ::= LP expr RP */
169632 217, /* (178) expr ::= ID|INDEXED */
169633 217, /* (179) expr ::= JOIN_KW */
169634 217, /* (180) expr ::= nm DOT nm */
169635 217, /* (181) expr ::= nm DOT nm DOT nm */
169636 216, /* (182) term ::= NULL|FLOAT|BLOB */
169637 216, /* (183) term ::= STRING */
169638 216, /* (184) term ::= INTEGER */
169639 217, /* (185) expr ::= VARIABLE */
169640 217, /* (186) expr ::= expr COLLATE ID|STRING */
169641 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
169642 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
169643 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
169644 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
169645 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
169646 216, /* (192) term ::= CTIME_KW */
169647 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
169648 217, /* (194) expr ::= expr AND expr */
169649 217, /* (195) expr ::= expr OR expr */
169650 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
169651 217, /* (197) expr ::= expr EQ|NE expr */
169652 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
169653 217, /* (199) expr ::= expr PLUS|MINUS expr */
169654 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
169655 217, /* (201) expr ::= expr CONCAT expr */
169656 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
169657 217, /* (203) expr ::= expr likeop expr */
169658 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
169659 217, /* (205) expr ::= expr ISNULL|NOTNULL */
169660 217, /* (206) expr ::= expr NOT NULL */
169661 217, /* (207) expr ::= expr IS expr */
169662 217, /* (208) expr ::= expr IS NOT expr */
169663 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
169664 217, /* (210) expr ::= expr IS DISTINCT FROM expr */
169665 217, /* (211) expr ::= NOT expr */
169666 217, /* (212) expr ::= BITNOT expr */
169667 217, /* (213) expr ::= PLUS|MINUS expr */
169668 217, /* (214) expr ::= expr PTR expr */
169669 275, /* (215) between_op ::= BETWEEN */
169670 275, /* (216) between_op ::= NOT BETWEEN */
169671 217, /* (217) expr ::= expr between_op expr AND expr */
169672 276, /* (218) in_op ::= IN */
169673 276, /* (219) in_op ::= NOT IN */
169674 217, /* (220) expr ::= expr in_op LP exprlist RP */
169675 217, /* (221) expr ::= LP select RP */
169676 217, /* (222) expr ::= expr in_op LP select RP */
169677 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
169678 217, /* (224) expr ::= EXISTS LP select RP */
169679 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
169680 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
169681 279, /* (227) case_exprlist ::= WHEN expr THEN expr */
169682 280, /* (228) case_else ::= ELSE expr */
169683 280, /* (229) case_else ::= */
169684 278, /* (230) case_operand ::= expr */
169685 278, /* (231) case_operand ::= */
169686 261, /* (232) exprlist ::= */
169687 253, /* (233) nexprlist ::= nexprlist COMMA expr */
169688 253, /* (234) nexprlist ::= expr */
169689 277, /* (235) paren_exprlist ::= */
169690 277, /* (236) paren_exprlist ::= LP exprlist RP */
169691 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
169692 281, /* (238) uniqueflag ::= UNIQUE */
169693 281, /* (239) uniqueflag ::= */
169694 221, /* (240) eidlist_opt ::= */
169695 221, /* (241) eidlist_opt ::= LP eidlist RP */
169696 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
169697 232, /* (243) eidlist ::= nm collate sortorder */
169698 282, /* (244) collate ::= */
169699 282, /* (245) collate ::= COLLATE ID|STRING */
169700 190, /* (246) cmd ::= DROP INDEX ifexists fullname */
169701 190, /* (247) cmd ::= VACUUM vinto */
169702 190, /* (248) cmd ::= VACUUM nm vinto */
169703 283, /* (249) vinto ::= INTO expr */
169704 283, /* (250) vinto ::= */
169705 190, /* (251) cmd ::= PRAGMA nm dbnm */
169706 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
169707 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
169708 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
169709 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
169710 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
169711 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
169712 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
169713 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
169714 287, /* (260) trigger_time ::= BEFORE|AFTER */
169715 287, /* (261) trigger_time ::= INSTEAD OF */
169716 287, /* (262) trigger_time ::= */
169717 288, /* (263) trigger_event ::= DELETE|INSERT */
169718 288, /* (264) trigger_event ::= UPDATE */
169719 288, /* (265) trigger_event ::= UPDATE OF idlist */
169720 290, /* (266) when_clause ::= */
169721 290, /* (267) when_clause ::= WHEN expr */
169722 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
169723 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
169724 292, /* (270) trnm ::= nm DOT nm */
169725 293, /* (271) tridxby ::= INDEXED BY nm */
169726 293, /* (272) tridxby ::= NOT INDEXED */
169727 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169728 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
169729 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
169730 291, /* (276) trigger_cmd ::= scanpt select scanpt */
169731 217, /* (277) expr ::= RAISE LP IGNORE RP */
169732 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
169733 236, /* (279) raisetype ::= ROLLBACK */
169734 236, /* (280) raisetype ::= ABORT */
169735 236, /* (281) raisetype ::= FAIL */
169736 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
169737 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
169738 190, /* (284) cmd ::= DETACH database_kw_opt expr */
169739 295, /* (285) key_opt ::= */
169740 295, /* (286) key_opt ::= KEY expr */
169741 190, /* (287) cmd ::= REINDEX */
169742 190, /* (288) cmd ::= REINDEX nm dbnm */
169743 190, /* (289) cmd ::= ANALYZE */
169744 190, /* (290) cmd ::= ANALYZE nm dbnm */
169745 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
169746 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
169747 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
169748 296, /* (294) add_column_fullname ::= fullname */
169749 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
169750 190, /* (296) cmd ::= create_vtab */
169751 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */
169752 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
169753 300, /* (299) vtabarg ::= */
169754 301, /* (300) vtabargtoken ::= ANY */
169755 301, /* (301) vtabargtoken ::= lp anylist RP */
169756 302, /* (302) lp ::= LP */
169757 266, /* (303) with ::= WITH wqlist */
169758 266, /* (304) with ::= WITH RECURSIVE wqlist */
169759 305, /* (305) wqas ::= AS */
169760 305, /* (306) wqas ::= AS MATERIALIZED */
169761 305, /* (307) wqas ::= AS NOT MATERIALIZED */
169762 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
169763 241, /* (309) wqlist ::= wqitem */
169764 241, /* (310) wqlist ::= wqlist COMMA wqitem */
169765 306, /* (311) windowdefn_list ::= windowdefn */
169766 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
169767 307, /* (313) windowdefn ::= nm AS LP window RP */
169768 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
169769 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
169770 308, /* (316) window ::= ORDER BY sortlist frame_opt */
169771 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */
169772 308, /* (318) window ::= frame_opt */
169773 308, /* (319) window ::= nm frame_opt */
169774 309, /* (320) frame_opt ::= */
169775 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
169776 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
169777 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
169778 315, /* (324) frame_bound_s ::= frame_bound */
169779 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
169780 316, /* (326) frame_bound_e ::= frame_bound */
169781 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
169782 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
169783 314, /* (329) frame_bound ::= CURRENT ROW */
169784 317, /* (330) frame_exclude_opt ::= */
169785 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
169786 318, /* (332) frame_exclude ::= NO OTHERS */
169787 318, /* (333) frame_exclude ::= CURRENT ROW */
169788 318, /* (334) frame_exclude ::= GROUP|TIES */
169789 251, /* (335) window_clause ::= WINDOW windowdefn_list */
169790 273, /* (336) filter_over ::= filter_clause over_clause */
169791 273, /* (337) filter_over ::= over_clause */
169792 273, /* (338) filter_over ::= filter_clause */
169793 312, /* (339) over_clause ::= OVER LP window RP */
169794 312, /* (340) over_clause ::= OVER nm */
169795 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
169796 185, /* (342) input ::= cmdlist */
169797 186, /* (343) cmdlist ::= cmdlist ecmd */
169798 186, /* (344) cmdlist ::= ecmd */
169799 187, /* (345) ecmd ::= SEMI */
169800 187, /* (346) ecmd ::= cmdx SEMI */
169801 187, /* (347) ecmd ::= explain cmdx SEMI */
169802 192, /* (348) trans_opt ::= */
169803 192, /* (349) trans_opt ::= TRANSACTION */
169804 192, /* (350) trans_opt ::= TRANSACTION nm */
169805 194, /* (351) savepoint_opt ::= SAVEPOINT */
169806 194, /* (352) savepoint_opt ::= */
169807 190, /* (353) cmd ::= create_table create_table_args */
169808 203, /* (354) table_option_set ::= table_option */
169809 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */
169810 201, /* (356) columnlist ::= columnname carglist */
169811 193, /* (357) nm ::= ID|INDEXED */
169812 193, /* (358) nm ::= STRING */
169813 193, /* (359) nm ::= JOIN_KW */
169814 208, /* (360) typetoken ::= typename */
169815 209, /* (361) typename ::= ID|STRING */
169816 210, /* (362) signed ::= plus_num */
169817 210, /* (363) signed ::= minus_num */
169818 207, /* (364) carglist ::= carglist ccons */
169819 207, /* (365) carglist ::= */
169820 215, /* (366) ccons ::= NULL onconf */
169821 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */
169822 215, /* (368) ccons ::= AS generated */
169823 202, /* (369) conslist_opt ::= COMMA conslist */
169824 228, /* (370) conslist ::= conslist tconscomma tcons */
169825 228, /* (371) conslist ::= tcons */
169826 229, /* (372) tconscomma ::= */
169827 233, /* (373) defer_subclause_opt ::= defer_subclause */
169828 235, /* (374) resolvetype ::= raisetype */
169829 239, /* (375) selectnowith ::= oneselect */
169830 240, /* (376) oneselect ::= values */
169831 254, /* (377) sclp ::= selcollist COMMA */
169832 255, /* (378) as ::= ID|STRING */
169833 264, /* (379) indexed_opt ::= indexed_by */
169834 272, /* (380) returning ::= */
169835 217, /* (381) expr ::= term */
169836 274, /* (382) likeop ::= LIKE_KW|MATCH */
169837 261, /* (383) exprlist ::= nexprlist */
169838 284, /* (384) nmnum ::= plus_num */
169839 284, /* (385) nmnum ::= nm */
169840 284, /* (386) nmnum ::= ON */
169841 284, /* (387) nmnum ::= DELETE */
169842 284, /* (388) nmnum ::= DEFAULT */
169843 211, /* (389) plus_num ::= INTEGER|FLOAT */
169844 289, /* (390) foreach_clause ::= */
169845 289, /* (391) foreach_clause ::= FOR EACH ROW */
169846 292, /* (392) trnm ::= nm */
169847 293, /* (393) tridxby ::= */
169848 294, /* (394) database_kw_opt ::= DATABASE */
169849 294, /* (395) database_kw_opt ::= */
169850 297, /* (396) kwcolumn_opt ::= */
169851 297, /* (397) kwcolumn_opt ::= COLUMNKW */
169852 299, /* (398) vtabarglist ::= vtabarg */
169853 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
169854 300, /* (400) vtabarg ::= vtabarg vtabargtoken */
169855 303, /* (401) anylist ::= */
169856 303, /* (402) anylist ::= anylist LP anylist RP */
169857 303, /* (403) anylist ::= anylist ANY */
169858 266, /* (404) with ::= */
169859 };
169860
169861 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
169862 ** of symbols on the right-hand side of that rule. */
169863 static const signed char yyRuleInfoNRhs[] = {
@@ -170037,237 +170703,235 @@
170037 0, /* (173) idlist_opt ::= */
170038 -3, /* (174) idlist_opt ::= LP idlist RP */
170039 -3, /* (175) idlist ::= idlist COMMA nm */
170040 -1, /* (176) idlist ::= nm */
170041 -3, /* (177) expr ::= LP expr RP */
170042 -1, /* (178) expr ::= ID|INDEXED */
170043 -1, /* (179) expr ::= JOIN_KW */
170044 -3, /* (180) expr ::= nm DOT nm */
170045 -5, /* (181) expr ::= nm DOT nm DOT nm */
170046 -1, /* (182) term ::= NULL|FLOAT|BLOB */
170047 -1, /* (183) term ::= STRING */
170048 -1, /* (184) term ::= INTEGER */
170049 -1, /* (185) expr ::= VARIABLE */
170050 -3, /* (186) expr ::= expr COLLATE ID|STRING */
170051 -6, /* (187) expr ::= CAST LP expr AS typetoken RP */
170052 -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
170053 -4, /* (189) expr ::= ID|INDEXED LP STAR RP */
170054 -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
170055 -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
170056 -1, /* (192) term ::= CTIME_KW */
170057 -5, /* (193) expr ::= LP nexprlist COMMA expr RP */
170058 -3, /* (194) expr ::= expr AND expr */
170059 -3, /* (195) expr ::= expr OR expr */
170060 -3, /* (196) expr ::= expr LT|GT|GE|LE expr */
170061 -3, /* (197) expr ::= expr EQ|NE expr */
170062 -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170063 -3, /* (199) expr ::= expr PLUS|MINUS expr */
170064 -3, /* (200) expr ::= expr STAR|SLASH|REM expr */
170065 -3, /* (201) expr ::= expr CONCAT expr */
170066 -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */
170067 -3, /* (203) expr ::= expr likeop expr */
170068 -5, /* (204) expr ::= expr likeop expr ESCAPE expr */
170069 -2, /* (205) expr ::= expr ISNULL|NOTNULL */
170070 -3, /* (206) expr ::= expr NOT NULL */
170071 -3, /* (207) expr ::= expr IS expr */
170072 -4, /* (208) expr ::= expr IS NOT expr */
170073 -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
170074 -5, /* (210) expr ::= expr IS DISTINCT FROM expr */
170075 -2, /* (211) expr ::= NOT expr */
170076 -2, /* (212) expr ::= BITNOT expr */
170077 -2, /* (213) expr ::= PLUS|MINUS expr */
170078 -3, /* (214) expr ::= expr PTR expr */
170079 -1, /* (215) between_op ::= BETWEEN */
170080 -2, /* (216) between_op ::= NOT BETWEEN */
170081 -5, /* (217) expr ::= expr between_op expr AND expr */
170082 -1, /* (218) in_op ::= IN */
170083 -2, /* (219) in_op ::= NOT IN */
170084 -5, /* (220) expr ::= expr in_op LP exprlist RP */
170085 -3, /* (221) expr ::= LP select RP */
170086 -5, /* (222) expr ::= expr in_op LP select RP */
170087 -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
170088 -4, /* (224) expr ::= EXISTS LP select RP */
170089 -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
170090 -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170091 -4, /* (227) case_exprlist ::= WHEN expr THEN expr */
170092 -2, /* (228) case_else ::= ELSE expr */
170093 0, /* (229) case_else ::= */
170094 -1, /* (230) case_operand ::= expr */
170095 0, /* (231) case_operand ::= */
170096 0, /* (232) exprlist ::= */
170097 -3, /* (233) nexprlist ::= nexprlist COMMA expr */
170098 -1, /* (234) nexprlist ::= expr */
170099 0, /* (235) paren_exprlist ::= */
170100 -3, /* (236) paren_exprlist ::= LP exprlist RP */
170101 -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170102 -1, /* (238) uniqueflag ::= UNIQUE */
170103 0, /* (239) uniqueflag ::= */
170104 0, /* (240) eidlist_opt ::= */
170105 -3, /* (241) eidlist_opt ::= LP eidlist RP */
170106 -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
170107 -3, /* (243) eidlist ::= nm collate sortorder */
170108 0, /* (244) collate ::= */
170109 -2, /* (245) collate ::= COLLATE ID|STRING */
170110 -4, /* (246) cmd ::= DROP INDEX ifexists fullname */
170111 -2, /* (247) cmd ::= VACUUM vinto */
170112 -3, /* (248) cmd ::= VACUUM nm vinto */
170113 -2, /* (249) vinto ::= INTO expr */
170114 0, /* (250) vinto ::= */
170115 -3, /* (251) cmd ::= PRAGMA nm dbnm */
170116 -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
170117 -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170118 -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
170119 -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170120 -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
170121 -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
170122 -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170123 -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170124 -1, /* (260) trigger_time ::= BEFORE|AFTER */
170125 -2, /* (261) trigger_time ::= INSTEAD OF */
170126 0, /* (262) trigger_time ::= */
170127 -1, /* (263) trigger_event ::= DELETE|INSERT */
170128 -1, /* (264) trigger_event ::= UPDATE */
170129 -3, /* (265) trigger_event ::= UPDATE OF idlist */
170130 0, /* (266) when_clause ::= */
170131 -2, /* (267) when_clause ::= WHEN expr */
170132 -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170133 -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
170134 -3, /* (270) trnm ::= nm DOT nm */
170135 -3, /* (271) tridxby ::= INDEXED BY nm */
170136 -2, /* (272) tridxby ::= NOT INDEXED */
170137 -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170138 -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170139 -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170140 -3, /* (276) trigger_cmd ::= scanpt select scanpt */
170141 -4, /* (277) expr ::= RAISE LP IGNORE RP */
170142 -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
170143 -1, /* (279) raisetype ::= ROLLBACK */
170144 -1, /* (280) raisetype ::= ABORT */
170145 -1, /* (281) raisetype ::= FAIL */
170146 -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
170147 -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170148 -3, /* (284) cmd ::= DETACH database_kw_opt expr */
170149 0, /* (285) key_opt ::= */
170150 -2, /* (286) key_opt ::= KEY expr */
170151 -1, /* (287) cmd ::= REINDEX */
170152 -3, /* (288) cmd ::= REINDEX nm dbnm */
170153 -1, /* (289) cmd ::= ANALYZE */
170154 -3, /* (290) cmd ::= ANALYZE nm dbnm */
170155 -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
170156 -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170157 -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170158 -1, /* (294) add_column_fullname ::= fullname */
170159 -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170160 -1, /* (296) cmd ::= create_vtab */
170161 -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */
170162 -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170163 0, /* (299) vtabarg ::= */
170164 -1, /* (300) vtabargtoken ::= ANY */
170165 -3, /* (301) vtabargtoken ::= lp anylist RP */
170166 -1, /* (302) lp ::= LP */
170167 -2, /* (303) with ::= WITH wqlist */
170168 -3, /* (304) with ::= WITH RECURSIVE wqlist */
170169 -1, /* (305) wqas ::= AS */
170170 -2, /* (306) wqas ::= AS MATERIALIZED */
170171 -3, /* (307) wqas ::= AS NOT MATERIALIZED */
170172 -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
170173 -1, /* (309) wqlist ::= wqitem */
170174 -3, /* (310) wqlist ::= wqlist COMMA wqitem */
170175 -1, /* (311) windowdefn_list ::= windowdefn */
170176 -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170177 -5, /* (313) windowdefn ::= nm AS LP window RP */
170178 -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170179 -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170180 -4, /* (316) window ::= ORDER BY sortlist frame_opt */
170181 -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */
170182 -1, /* (318) window ::= frame_opt */
170183 -2, /* (319) window ::= nm frame_opt */
170184 0, /* (320) frame_opt ::= */
170185 -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170186 -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170187 -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
170188 -1, /* (324) frame_bound_s ::= frame_bound */
170189 -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
170190 -1, /* (326) frame_bound_e ::= frame_bound */
170191 -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
170192 -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
170193 -2, /* (329) frame_bound ::= CURRENT ROW */
170194 0, /* (330) frame_exclude_opt ::= */
170195 -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
170196 -2, /* (332) frame_exclude ::= NO OTHERS */
170197 -2, /* (333) frame_exclude ::= CURRENT ROW */
170198 -1, /* (334) frame_exclude ::= GROUP|TIES */
170199 -2, /* (335) window_clause ::= WINDOW windowdefn_list */
170200 -2, /* (336) filter_over ::= filter_clause over_clause */
170201 -1, /* (337) filter_over ::= over_clause */
170202 -1, /* (338) filter_over ::= filter_clause */
170203 -4, /* (339) over_clause ::= OVER LP window RP */
170204 -2, /* (340) over_clause ::= OVER nm */
170205 -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
170206 -1, /* (342) input ::= cmdlist */
170207 -2, /* (343) cmdlist ::= cmdlist ecmd */
170208 -1, /* (344) cmdlist ::= ecmd */
170209 -1, /* (345) ecmd ::= SEMI */
170210 -2, /* (346) ecmd ::= cmdx SEMI */
170211 -3, /* (347) ecmd ::= explain cmdx SEMI */
170212 0, /* (348) trans_opt ::= */
170213 -1, /* (349) trans_opt ::= TRANSACTION */
170214 -2, /* (350) trans_opt ::= TRANSACTION nm */
170215 -1, /* (351) savepoint_opt ::= SAVEPOINT */
170216 0, /* (352) savepoint_opt ::= */
170217 -2, /* (353) cmd ::= create_table create_table_args */
170218 -1, /* (354) table_option_set ::= table_option */
170219 -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */
170220 -2, /* (356) columnlist ::= columnname carglist */
170221 -1, /* (357) nm ::= ID|INDEXED */
170222 -1, /* (358) nm ::= STRING */
170223 -1, /* (359) nm ::= JOIN_KW */
170224 -1, /* (360) typetoken ::= typename */
170225 -1, /* (361) typename ::= ID|STRING */
170226 -1, /* (362) signed ::= plus_num */
170227 -1, /* (363) signed ::= minus_num */
170228 -2, /* (364) carglist ::= carglist ccons */
170229 0, /* (365) carglist ::= */
170230 -2, /* (366) ccons ::= NULL onconf */
170231 -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */
170232 -2, /* (368) ccons ::= AS generated */
170233 -2, /* (369) conslist_opt ::= COMMA conslist */
170234 -3, /* (370) conslist ::= conslist tconscomma tcons */
170235 -1, /* (371) conslist ::= tcons */
170236 0, /* (372) tconscomma ::= */
170237 -1, /* (373) defer_subclause_opt ::= defer_subclause */
170238 -1, /* (374) resolvetype ::= raisetype */
170239 -1, /* (375) selectnowith ::= oneselect */
170240 -1, /* (376) oneselect ::= values */
170241 -2, /* (377) sclp ::= selcollist COMMA */
170242 -1, /* (378) as ::= ID|STRING */
170243 -1, /* (379) indexed_opt ::= indexed_by */
170244 0, /* (380) returning ::= */
170245 -1, /* (381) expr ::= term */
170246 -1, /* (382) likeop ::= LIKE_KW|MATCH */
170247 -1, /* (383) exprlist ::= nexprlist */
170248 -1, /* (384) nmnum ::= plus_num */
170249 -1, /* (385) nmnum ::= nm */
170250 -1, /* (386) nmnum ::= ON */
170251 -1, /* (387) nmnum ::= DELETE */
170252 -1, /* (388) nmnum ::= DEFAULT */
170253 -1, /* (389) plus_num ::= INTEGER|FLOAT */
170254 0, /* (390) foreach_clause ::= */
170255 -3, /* (391) foreach_clause ::= FOR EACH ROW */
170256 -1, /* (392) trnm ::= nm */
170257 0, /* (393) tridxby ::= */
170258 -1, /* (394) database_kw_opt ::= DATABASE */
170259 0, /* (395) database_kw_opt ::= */
170260 0, /* (396) kwcolumn_opt ::= */
170261 -1, /* (397) kwcolumn_opt ::= COLUMNKW */
170262 -1, /* (398) vtabarglist ::= vtabarg */
170263 -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
170264 -2, /* (400) vtabarg ::= vtabarg vtabargtoken */
170265 0, /* (401) anylist ::= */
170266 -4, /* (402) anylist ::= anylist LP anylist RP */
170267 -2, /* (403) anylist ::= anylist ANY */
170268 0, /* (404) with ::= */
170269 };
170270
170271 static void yy_accept(yyParser*); /* Forward Declaration */
170272
170273 /*
@@ -170323,11 +170987,11 @@
170323 {yymsp[1].minor.yy394 = TK_DEFERRED;}
170324 break;
170325 case 5: /* transtype ::= DEFERRED */
170326 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170327 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170328 case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323);
170329 {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170330 break;
170331 case 8: /* cmd ::= COMMIT|END trans_opt */
170332 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170333 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170360,11 +171024,11 @@
170360 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
170361 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
170362 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
170363 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
170364 case 98: /* distinct ::= */ yytestcase(yyruleno==98);
170365 case 244: /* collate ::= */ yytestcase(yyruleno==244);
170366 {yymsp[1].minor.yy394 = 0;}
170367 break;
170368 case 16: /* ifnotexists ::= IF NOT EXISTS */
170369 {yymsp[-2].minor.yy394 = 1;}
170370 break;
@@ -170544,13 +171208,13 @@
170544 case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
170545 {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
170546 break;
170547 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
170548 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
170549 case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216);
170550 case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219);
170551 case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245);
170552 {yymsp[-1].minor.yy394 = 1;}
170553 break;
170554 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
170555 {yymsp[-1].minor.yy394 = 0;}
170556 break;
@@ -170696,13 +171360,13 @@
170696 {yymsp[0].minor.yy394 = SF_All;}
170697 break;
170698 case 99: /* sclp ::= */
170699 case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
170700 case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
170701 case 232: /* exprlist ::= */ yytestcase(yyruleno==232);
170702 case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235);
170703 case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240);
170704 {yymsp[1].minor.yy322 = 0;}
170705 break;
170706 case 100: /* selcollist ::= sclp scanpt expr scanpt as */
170707 {
170708 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170724,12 +171388,12 @@
170724 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
170725 }
170726 break;
170727 case 103: /* as ::= AS nm */
170728 case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
170729 case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170730 case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257);
170731 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
170732 break;
170733 case 105: /* from ::= */
170734 case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
170735 {yymsp[1].minor.yy131 = 0;}
@@ -170897,20 +171561,20 @@
170897 break;
170898 case 144: /* having_opt ::= */
170899 case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
170900 case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
170901 case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
170902 case 229: /* case_else ::= */ yytestcase(yyruleno==229);
170903 case 231: /* case_operand ::= */ yytestcase(yyruleno==231);
170904 case 250: /* vinto ::= */ yytestcase(yyruleno==250);
170905 {yymsp[1].minor.yy528 = 0;}
170906 break;
170907 case 145: /* having_opt ::= HAVING expr */
170908 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
170909 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
170910 case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228);
170911 case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249);
170912 {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
170913 break;
170914 case 147: /* limit_opt ::= LIMIT expr */
170915 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
170916 break;
@@ -171018,23 +171682,22 @@
171018 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171019 break;
171020 case 177: /* expr ::= LP expr RP */
171021 {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171022 break;
171023 case 178: /* expr ::= ID|INDEXED */
171024 case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
171025 {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171026 break;
171027 case 180: /* expr ::= nm DOT nm */
171028 {
171029 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171030 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171031 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171032 }
171033 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171034 break;
171035 case 181: /* expr ::= nm DOT nm DOT nm */
171036 {
171037 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171038 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171039 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171040 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171043,22 +171706,22 @@
171043 }
171044 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171045 }
171046 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171047 break;
171048 case 182: /* term ::= NULL|FLOAT|BLOB */
171049 case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
171050 {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171051 break;
171052 case 184: /* term ::= INTEGER */
171053 {
171054 yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171055 if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171056 }
171057 yymsp[0].minor.yy528 = yylhsminor.yy528;
171058 break;
171059 case 185: /* expr ::= VARIABLE */
171060 {
171061 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171062 u32 n = yymsp[0].minor.yy0.n;
171063 yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171064 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171076,54 +171739,54 @@
171076 if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171077 }
171078 }
171079 }
171080 break;
171081 case 186: /* expr ::= expr COLLATE ID|STRING */
171082 {
171083 yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171084 }
171085 break;
171086 case 187: /* expr ::= CAST LP expr AS typetoken RP */
171087 {
171088 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171089 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171090 }
171091 break;
171092 case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
171093 {
171094 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171095 }
171096 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171097 break;
171098 case 189: /* expr ::= ID|INDEXED LP STAR RP */
171099 {
171100 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171101 }
171102 yymsp[-3].minor.yy528 = yylhsminor.yy528;
171103 break;
171104 case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
171105 {
171106 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171107 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171108 }
171109 yymsp[-5].minor.yy528 = yylhsminor.yy528;
171110 break;
171111 case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
171112 {
171113 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171114 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171115 }
171116 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171117 break;
171118 case 192: /* term ::= CTIME_KW */
171119 {
171120 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171121 }
171122 yymsp[0].minor.yy528 = yylhsminor.yy528;
171123 break;
171124 case 193: /* expr ::= LP nexprlist COMMA expr RP */
171125 {
171126 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171127 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171128 if( yymsp[-4].minor.yy528 ){
171129 yymsp[-4].minor.yy528->x.pList = pList;
@@ -171133,26 +171796,26 @@
171133 }else{
171134 sqlite3ExprListDelete(pParse->db, pList);
171135 }
171136 }
171137 break;
171138 case 194: /* expr ::= expr AND expr */
171139 {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171140 break;
171141 case 195: /* expr ::= expr OR expr */
171142 case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
171143 case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
171144 case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
171145 case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
171146 case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
171147 case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
171148 {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171149 break;
171150 case 202: /* likeop ::= NOT LIKE_KW|MATCH */
171151 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171152 break;
171153 case 203: /* expr ::= expr likeop expr */
171154 {
171155 ExprList *pList;
171156 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171157 yymsp[-1].minor.yy0.n &= 0x7fffffff;
171158 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171160,11 +171823,11 @@
171160 yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171161 if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171162 if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171163 }
171164 break;
171165 case 204: /* expr ::= expr likeop expr ESCAPE expr */
171166 {
171167 ExprList *pList;
171168 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171169 yymsp[-3].minor.yy0.n &= 0x7fffffff;
171170 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171173,63 +171836,63 @@
171173 yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171174 if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171175 if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171176 }
171177 break;
171178 case 205: /* expr ::= expr ISNULL|NOTNULL */
171179 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171180 break;
171181 case 206: /* expr ::= expr NOT NULL */
171182 {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171183 break;
171184 case 207: /* expr ::= expr IS expr */
171185 {
171186 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171187 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171188 }
171189 break;
171190 case 208: /* expr ::= expr IS NOT expr */
171191 {
171192 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171193 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171194 }
171195 break;
171196 case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */
171197 {
171198 yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171199 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171200 }
171201 break;
171202 case 210: /* expr ::= expr IS DISTINCT FROM expr */
171203 {
171204 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171205 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171206 }
171207 break;
171208 case 211: /* expr ::= NOT expr */
171209 case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212);
171210 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171211 break;
171212 case 213: /* expr ::= PLUS|MINUS expr */
171213 {
171214 yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171215 /*A-overwrites-B*/
171216 }
171217 break;
171218 case 214: /* expr ::= expr PTR expr */
171219 {
171220 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171221 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171222 yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171223 }
171224 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171225 break;
171226 case 215: /* between_op ::= BETWEEN */
171227 case 218: /* in_op ::= IN */ yytestcase(yyruleno==218);
171228 {yymsp[0].minor.yy394 = 0;}
171229 break;
171230 case 217: /* expr ::= expr between_op expr AND expr */
171231 {
171232 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171233 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171234 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171235 if( yymsp[-4].minor.yy528 ){
@@ -171238,11 +171901,11 @@
171238 sqlite3ExprListDelete(pParse->db, pList);
171239 }
171240 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171241 }
171242 break;
171243 case 220: /* expr ::= expr in_op LP exprlist RP */
171244 {
171245 if( yymsp[-1].minor.yy322==0 ){
171246 /* Expressions of the form
171247 **
171248 ** expr1 IN ()
@@ -171284,41 +171947,41 @@
171284 }
171285 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171286 }
171287 }
171288 break;
171289 case 221: /* expr ::= LP select RP */
171290 {
171291 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171292 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171293 }
171294 break;
171295 case 222: /* expr ::= expr in_op LP select RP */
171296 {
171297 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171298 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171299 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171300 }
171301 break;
171302 case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */
171303 {
171304 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171305 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171306 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171307 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171308 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171309 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171310 }
171311 break;
171312 case 224: /* expr ::= EXISTS LP select RP */
171313 {
171314 Expr *p;
171315 p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171316 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171317 }
171318 break;
171319 case 225: /* expr ::= CASE case_operand case_exprlist case_else END */
171320 {
171321 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171322 if( yymsp[-4].minor.yy528 ){
171323 yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171324 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171326,406 +171989,406 @@
171326 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171327 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171328 }
171329 }
171330 break;
171331 case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171332 {
171333 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171334 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171335 }
171336 break;
171337 case 227: /* case_exprlist ::= WHEN expr THEN expr */
171338 {
171339 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171340 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
171341 }
171342 break;
171343 case 230: /* case_operand ::= expr */
171344 {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
171345 break;
171346 case 233: /* nexprlist ::= nexprlist COMMA expr */
171347 {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
171348 break;
171349 case 234: /* nexprlist ::= expr */
171350 {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
171351 break;
171352 case 236: /* paren_exprlist ::= LP exprlist RP */
171353 case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241);
171354 {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
171355 break;
171356 case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
171357 {
171358 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
171359 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
171360 &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
171361 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
171362 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
171363 }
171364 }
171365 break;
171366 case 238: /* uniqueflag ::= UNIQUE */
171367 case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280);
171368 {yymsp[0].minor.yy394 = OE_Abort;}
171369 break;
171370 case 239: /* uniqueflag ::= */
171371 {yymsp[1].minor.yy394 = OE_None;}
171372 break;
171373 case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */
171374 {
171375 yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
171376 }
171377 break;
171378 case 243: /* eidlist ::= nm collate sortorder */
171379 {
171380 yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
171381 }
171382 break;
171383 case 246: /* cmd ::= DROP INDEX ifexists fullname */
171384 {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
171385 break;
171386 case 247: /* cmd ::= VACUUM vinto */
171387 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
171388 break;
171389 case 248: /* cmd ::= VACUUM nm vinto */
171390 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
171391 break;
171392 case 251: /* cmd ::= PRAGMA nm dbnm */
171393 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
171394 break;
171395 case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171396 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
171397 break;
171398 case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171399 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
171400 break;
171401 case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171402 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
171403 break;
171404 case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171405 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
171406 break;
171407 case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171408 {
171409 Token all;
171410 all.z = yymsp[-3].minor.yy0.z;
171411 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
171412 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
171413 }
171414 break;
171415 case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
171416 {
171417 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);
171418 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
171419 }
171420 break;
171421 case 260: /* trigger_time ::= BEFORE|AFTER */
171422 { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
171423 break;
171424 case 261: /* trigger_time ::= INSTEAD OF */
171425 { yymsp[-1].minor.yy394 = TK_INSTEAD;}
171426 break;
171427 case 262: /* trigger_time ::= */
171428 { yymsp[1].minor.yy394 = TK_BEFORE; }
171429 break;
171430 case 263: /* trigger_event ::= DELETE|INSERT */
171431 case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264);
171432 {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
171433 break;
171434 case 265: /* trigger_event ::= UPDATE OF idlist */
171435 {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
171436 break;
171437 case 266: /* when_clause ::= */
171438 case 285: /* key_opt ::= */ yytestcase(yyruleno==285);
171439 { yymsp[1].minor.yy528 = 0; }
171440 break;
171441 case 267: /* when_clause ::= WHEN expr */
171442 case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286);
171443 { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
171444 break;
171445 case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171446 {
171447 assert( yymsp[-2].minor.yy33!=0 );
171448 yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
171449 yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
171450 }
171451 break;
171452 case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */
171453 {
171454 assert( yymsp[-1].minor.yy33!=0 );
171455 yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
171456 }
171457 break;
171458 case 270: /* trnm ::= nm DOT nm */
171459 {
171460 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
171461 sqlite3ErrorMsg(pParse,
171462 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
171463 "statements within triggers");
171464 }
171465 break;
171466 case 271: /* tridxby ::= INDEXED BY nm */
171467 {
171468 sqlite3ErrorMsg(pParse,
171469 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
171470 "within triggers");
171471 }
171472 break;
171473 case 272: /* tridxby ::= NOT INDEXED */
171474 {
171475 sqlite3ErrorMsg(pParse,
171476 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
171477 "within triggers");
171478 }
171479 break;
171480 case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171481 {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);}
171482 yymsp[-8].minor.yy33 = yylhsminor.yy33;
171483 break;
171484 case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
171485 {
171486 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*/
171487 }
171488 yymsp[-7].minor.yy33 = yylhsminor.yy33;
171489 break;
171490 case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171491 {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
171492 yymsp[-5].minor.yy33 = yylhsminor.yy33;
171493 break;
171494 case 276: /* trigger_cmd ::= scanpt select scanpt */
171495 {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
171496 yymsp[-2].minor.yy33 = yylhsminor.yy33;
171497 break;
171498 case 277: /* expr ::= RAISE LP IGNORE RP */
171499 {
171500 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
171501 if( yymsp[-3].minor.yy528 ){
171502 yymsp[-3].minor.yy528->affExpr = OE_Ignore;
171503 }
171504 }
171505 break;
171506 case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */
171507 {
171508 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
171509 if( yymsp[-5].minor.yy528 ) {
171510 yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
171511 }
171512 }
171513 break;
171514 case 279: /* raisetype ::= ROLLBACK */
171515 {yymsp[0].minor.yy394 = OE_Rollback;}
171516 break;
171517 case 281: /* raisetype ::= FAIL */
171518 {yymsp[0].minor.yy394 = OE_Fail;}
171519 break;
171520 case 282: /* cmd ::= DROP TRIGGER ifexists fullname */
171521 {
171522 sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
171523 }
171524 break;
171525 case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
171526 {
171527 sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
171528 }
171529 break;
171530 case 284: /* cmd ::= DETACH database_kw_opt expr */
171531 {
171532 sqlite3Detach(pParse, yymsp[0].minor.yy528);
171533 }
171534 break;
171535 case 287: /* cmd ::= REINDEX */
171536 {sqlite3Reindex(pParse, 0, 0);}
171537 break;
171538 case 288: /* cmd ::= REINDEX nm dbnm */
171539 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171540 break;
171541 case 289: /* cmd ::= ANALYZE */
171542 {sqlite3Analyze(pParse, 0, 0);}
171543 break;
171544 case 290: /* cmd ::= ANALYZE nm dbnm */
171545 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171546 break;
171547 case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
171548 {
171549 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
171550 }
171551 break;
171552 case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
171553 {
171554 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
171555 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
171556 }
171557 break;
171558 case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
171559 {
171560 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
171561 }
171562 break;
171563 case 294: /* add_column_fullname ::= fullname */
171564 {
171565 disableLookaside(pParse);
171566 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
171567 }
171568 break;
171569 case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
171570 {
171571 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
171572 }
171573 break;
171574 case 296: /* cmd ::= create_vtab */
171575 {sqlite3VtabFinishParse(pParse,0);}
171576 break;
171577 case 297: /* cmd ::= create_vtab LP vtabarglist RP */
171578 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
171579 break;
171580 case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
171581 {
171582 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
171583 }
171584 break;
171585 case 299: /* vtabarg ::= */
171586 {sqlite3VtabArgInit(pParse);}
171587 break;
171588 case 300: /* vtabargtoken ::= ANY */
171589 case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301);
171590 case 302: /* lp ::= LP */ yytestcase(yyruleno==302);
171591 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
171592 break;
171593 case 303: /* with ::= WITH wqlist */
171594 case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304);
171595 { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
171596 break;
171597 case 305: /* wqas ::= AS */
171598 {yymsp[0].minor.yy516 = M10d_Any;}
171599 break;
171600 case 306: /* wqas ::= AS MATERIALIZED */
171601 {yymsp[-1].minor.yy516 = M10d_Yes;}
171602 break;
171603 case 307: /* wqas ::= AS NOT MATERIALIZED */
171604 {yymsp[-2].minor.yy516 = M10d_No;}
171605 break;
171606 case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */
171607 {
171608 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*/
171609 }
171610 break;
171611 case 309: /* wqlist ::= wqitem */
171612 {
171613 yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
171614 }
171615 break;
171616 case 310: /* wqlist ::= wqlist COMMA wqitem */
171617 {
171618 yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
171619 }
171620 break;
171621 case 311: /* windowdefn_list ::= windowdefn */
171622 { yylhsminor.yy41 = yymsp[0].minor.yy41; }
171623 yymsp[0].minor.yy41 = yylhsminor.yy41;
171624 break;
171625 case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
171626 {
171627 assert( yymsp[0].minor.yy41!=0 );
171628 sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
171629 yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
171630 yylhsminor.yy41 = yymsp[0].minor.yy41;
171631 }
171632 yymsp[-2].minor.yy41 = yylhsminor.yy41;
171633 break;
171634 case 313: /* windowdefn ::= nm AS LP window RP */
171635 {
171636 if( ALWAYS(yymsp[-1].minor.yy41) ){
171637 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
171638 }
171639 yylhsminor.yy41 = yymsp[-1].minor.yy41;
171640 }
171641 yymsp[-4].minor.yy41 = yylhsminor.yy41;
171642 break;
171643 case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
171644 {
171645 yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
171646 }
171647 break;
171648 case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
171649 {
171650 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
171651 }
171652 yymsp[-5].minor.yy41 = yylhsminor.yy41;
171653 break;
171654 case 316: /* window ::= ORDER BY sortlist frame_opt */
171655 {
171656 yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
171657 }
171658 break;
171659 case 317: /* window ::= nm ORDER BY sortlist frame_opt */
171660 {
171661 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
171662 }
171663 yymsp[-4].minor.yy41 = yylhsminor.yy41;
171664 break;
171665 case 318: /* window ::= frame_opt */
171666 case 337: /* filter_over ::= over_clause */ yytestcase(yyruleno==337);
171667 {
171668 yylhsminor.yy41 = yymsp[0].minor.yy41;
171669 }
171670 yymsp[0].minor.yy41 = yylhsminor.yy41;
171671 break;
171672 case 319: /* window ::= nm frame_opt */
171673 {
171674 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
171675 }
171676 yymsp[-1].minor.yy41 = yylhsminor.yy41;
171677 break;
171678 case 320: /* frame_opt ::= */
171679 {
171680 yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
171681 }
171682 break;
171683 case 321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
171684 {
171685 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);
171686 }
171687 yymsp[-2].minor.yy41 = yylhsminor.yy41;
171688 break;
171689 case 322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
171690 {
171691 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);
171692 }
171693 yymsp[-5].minor.yy41 = yylhsminor.yy41;
171694 break;
171695 case 324: /* frame_bound_s ::= frame_bound */
171696 case 326: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==326);
171697 {yylhsminor.yy595 = yymsp[0].minor.yy595;}
171698 yymsp[0].minor.yy595 = yylhsminor.yy595;
171699 break;
171700 case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */
171701 case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327);
171702 case 329: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==329);
171703 {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
171704 yymsp[-1].minor.yy595 = yylhsminor.yy595;
171705 break;
171706 case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */
171707 {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
171708 yymsp[-1].minor.yy595 = yylhsminor.yy595;
171709 break;
171710 case 330: /* frame_exclude_opt ::= */
171711 {yymsp[1].minor.yy516 = 0;}
171712 break;
171713 case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
171714 {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
171715 break;
171716 case 332: /* frame_exclude ::= NO OTHERS */
171717 case 333: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==333);
171718 {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
171719 break;
171720 case 334: /* frame_exclude ::= GROUP|TIES */
171721 {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
171722 break;
171723 case 335: /* window_clause ::= WINDOW windowdefn_list */
171724 { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
171725 break;
171726 case 336: /* filter_over ::= filter_clause over_clause */
171727 {
171728 if( yymsp[0].minor.yy41 ){
171729 yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
171730 }else{
171731 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171732,11 +172395,11 @@
171732 }
171733 yylhsminor.yy41 = yymsp[0].minor.yy41;
171734 }
171735 yymsp[-1].minor.yy41 = yylhsminor.yy41;
171736 break;
171737 case 338: /* filter_over ::= filter_clause */
171738 {
171739 yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171740 if( yylhsminor.yy41 ){
171741 yylhsminor.yy41->eFrmType = TK_FILTER;
171742 yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171744,91 +172407,90 @@
171744 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
171745 }
171746 }
171747 yymsp[0].minor.yy41 = yylhsminor.yy41;
171748 break;
171749 case 339: /* over_clause ::= OVER LP window RP */
171750 {
171751 yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
171752 assert( yymsp[-3].minor.yy41!=0 );
171753 }
171754 break;
171755 case 340: /* over_clause ::= OVER nm */
171756 {
171757 yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171758 if( yymsp[-1].minor.yy41 ){
171759 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
171760 }
171761 }
171762 break;
171763 case 341: /* filter_clause ::= FILTER LP WHERE expr RP */
171764 { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
171765 break;
171766 default:
171767 /* (342) input ::= cmdlist */ yytestcase(yyruleno==342);
171768 /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343);
171769 /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344);
171770 /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345);
171771 /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346);
171772 /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347);
171773 /* (348) trans_opt ::= */ yytestcase(yyruleno==348);
171774 /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349);
171775 /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350);
171776 /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351);
171777 /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352);
171778 /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353);
171779 /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354);
171780 /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355);
171781 /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356);
171782 /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357);
171783 /* (358) nm ::= STRING */ yytestcase(yyruleno==358);
171784 /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359);
171785 /* (360) typetoken ::= typename */ yytestcase(yyruleno==360);
171786 /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361);
171787 /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362);
171788 /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363);
171789 /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364);
171790 /* (365) carglist ::= */ yytestcase(yyruleno==365);
171791 /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366);
171792 /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367);
171793 /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368);
171794 /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369);
171795 /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370);
171796 /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371);
171797 /* (372) tconscomma ::= */ yytestcase(yyruleno==372);
171798 /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373);
171799 /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374);
171800 /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375);
171801 /* (376) oneselect ::= values */ yytestcase(yyruleno==376);
171802 /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377);
171803 /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378);
171804 /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379);
171805 /* (380) returning ::= */ yytestcase(yyruleno==380);
171806 /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381);
171807 /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382);
171808 /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383);
171809 /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384);
171810 /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385);
171811 /* (386) nmnum ::= ON */ yytestcase(yyruleno==386);
171812 /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387);
171813 /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388);
171814 /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389);
171815 /* (390) foreach_clause ::= */ yytestcase(yyruleno==390);
171816 /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391);
171817 /* (392) trnm ::= nm */ yytestcase(yyruleno==392);
171818 /* (393) tridxby ::= */ yytestcase(yyruleno==393);
171819 /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394);
171820 /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395);
171821 /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396);
171822 /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397);
171823 /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398);
171824 /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399);
171825 /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400);
171826 /* (401) anylist ::= */ yytestcase(yyruleno==401);
171827 /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402);
171828 /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403);
171829 /* (404) with ::= */ yytestcase(yyruleno==404);
171830 break;
171831 /********** End reduce actions ************************************************/
171832 };
171833 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
171834 yygoto = yyRuleInfoLhs[yyruleno];
@@ -172400,11 +173062,11 @@
172400 132, 0, 98, 38, 39, 0, 20, 45, 117, 93,
172401 };
172402 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
172403 ** then the i-th keyword has no more hash collisions. Otherwise,
172404 ** the next keyword with the same hash is aKWHash[i]-1. */
172405 static const unsigned char aKWNext[147] = {
172406 0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0,
172407 0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0,
172408 141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0,
172409 138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
172410 0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -172415,11 +173077,11 @@
172415 112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0,
172416 99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0,
172417 102, 0, 0, 87,
172418 };
172419 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
172420 static const unsigned char aKWLen[147] = {
172421 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
172422 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
172423 6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
172424 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
172425 2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
@@ -172431,11 +173093,11 @@
172431 4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2,
172432 2, 9, 3, 7,
172433 };
172434 /* aKWOffset[i] is the index into zKWText[] of the start of
172435 ** the text for the i-th keyword. */
172436 static const unsigned short int aKWOffset[147] = {
172437 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
172438 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
172439 86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
172440 129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
172441 184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
@@ -172446,11 +173108,11 @@
172446 520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579,
172447 585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645,
172448 648, 650, 655, 659,
172449 };
172450 /* aKWCode[i] is the parser symbol code for the i-th keyword */
172451 static const unsigned char aKWCode[147] = {
172452 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
172453 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
172454 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
172455 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
172456 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -172615,11 +173277,11 @@
172615 static int keywordCode(const char *z, int n, int *pType){
172616 int i, j;
172617 const char *zKW;
172618 if( n>=2 ){
172619 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
172620 for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
172621 if( aKWLen[i]!=n ) continue;
172622 zKW = &zKWText[aKWOffset[i]];
172623 #ifdef SQLITE_ASCII
172624 if( (z[0]&~0x20)!=zKW[0] ) continue;
172625 if( (z[1]&~0x20)!=zKW[1] ) continue;
@@ -172631,157 +173293,157 @@
172631 if( toupper(z[1])!=zKW[1] ) continue;
172632 j = 2;
172633 while( j<n && toupper(z[j])==zKW[j] ){ j++; }
172634 #endif
172635 if( j<n ) continue;
172636 testcase( i==0 ); /* REINDEX */
172637 testcase( i==1 ); /* INDEXED */
172638 testcase( i==2 ); /* INDEX */
172639 testcase( i==3 ); /* DESC */
172640 testcase( i==4 ); /* ESCAPE */
172641 testcase( i==5 ); /* EACH */
172642 testcase( i==6 ); /* CHECK */
172643 testcase( i==7 ); /* KEY */
172644 testcase( i==8 ); /* BEFORE */
172645 testcase( i==9 ); /* FOREIGN */
172646 testcase( i==10 ); /* FOR */
172647 testcase( i==11 ); /* IGNORE */
172648 testcase( i==12 ); /* REGEXP */
172649 testcase( i==13 ); /* EXPLAIN */
172650 testcase( i==14 ); /* INSTEAD */
172651 testcase( i==15 ); /* ADD */
172652 testcase( i==16 ); /* DATABASE */
172653 testcase( i==17 ); /* AS */
172654 testcase( i==18 ); /* SELECT */
172655 testcase( i==19 ); /* TABLE */
172656 testcase( i==20 ); /* LEFT */
172657 testcase( i==21 ); /* THEN */
172658 testcase( i==22 ); /* END */
172659 testcase( i==23 ); /* DEFERRABLE */
172660 testcase( i==24 ); /* ELSE */
172661 testcase( i==25 ); /* EXCLUDE */
172662 testcase( i==26 ); /* DELETE */
172663 testcase( i==27 ); /* TEMPORARY */
172664 testcase( i==28 ); /* TEMP */
172665 testcase( i==29 ); /* OR */
172666 testcase( i==30 ); /* ISNULL */
172667 testcase( i==31 ); /* NULLS */
172668 testcase( i==32 ); /* SAVEPOINT */
172669 testcase( i==33 ); /* INTERSECT */
172670 testcase( i==34 ); /* TIES */
172671 testcase( i==35 ); /* NOTNULL */
172672 testcase( i==36 ); /* NOT */
172673 testcase( i==37 ); /* NO */
172674 testcase( i==38 ); /* NULL */
172675 testcase( i==39 ); /* LIKE */
172676 testcase( i==40 ); /* EXCEPT */
172677 testcase( i==41 ); /* TRANSACTION */
172678 testcase( i==42 ); /* ACTION */
172679 testcase( i==43 ); /* ON */
172680 testcase( i==44 ); /* NATURAL */
172681 testcase( i==45 ); /* ALTER */
172682 testcase( i==46 ); /* RAISE */
172683 testcase( i==47 ); /* EXCLUSIVE */
172684 testcase( i==48 ); /* EXISTS */
172685 testcase( i==49 ); /* CONSTRAINT */
172686 testcase( i==50 ); /* INTO */
172687 testcase( i==51 ); /* OFFSET */
172688 testcase( i==52 ); /* OF */
172689 testcase( i==53 ); /* SET */
172690 testcase( i==54 ); /* TRIGGER */
172691 testcase( i==55 ); /* RANGE */
172692 testcase( i==56 ); /* GENERATED */
172693 testcase( i==57 ); /* DETACH */
172694 testcase( i==58 ); /* HAVING */
172695 testcase( i==59 ); /* GLOB */
172696 testcase( i==60 ); /* BEGIN */
172697 testcase( i==61 ); /* INNER */
172698 testcase( i==62 ); /* REFERENCES */
172699 testcase( i==63 ); /* UNIQUE */
172700 testcase( i==64 ); /* QUERY */
172701 testcase( i==65 ); /* WITHOUT */
172702 testcase( i==66 ); /* WITH */
172703 testcase( i==67 ); /* OUTER */
172704 testcase( i==68 ); /* RELEASE */
172705 testcase( i==69 ); /* ATTACH */
172706 testcase( i==70 ); /* BETWEEN */
172707 testcase( i==71 ); /* NOTHING */
172708 testcase( i==72 ); /* GROUPS */
172709 testcase( i==73 ); /* GROUP */
172710 testcase( i==74 ); /* CASCADE */
172711 testcase( i==75 ); /* ASC */
172712 testcase( i==76 ); /* DEFAULT */
172713 testcase( i==77 ); /* CASE */
172714 testcase( i==78 ); /* COLLATE */
172715 testcase( i==79 ); /* CREATE */
172716 testcase( i==80 ); /* CURRENT_DATE */
172717 testcase( i==81 ); /* IMMEDIATE */
172718 testcase( i==82 ); /* JOIN */
172719 testcase( i==83 ); /* INSERT */
172720 testcase( i==84 ); /* MATCH */
172721 testcase( i==85 ); /* PLAN */
172722 testcase( i==86 ); /* ANALYZE */
172723 testcase( i==87 ); /* PRAGMA */
172724 testcase( i==88 ); /* MATERIALIZED */
172725 testcase( i==89 ); /* DEFERRED */
172726 testcase( i==90 ); /* DISTINCT */
172727 testcase( i==91 ); /* IS */
172728 testcase( i==92 ); /* UPDATE */
172729 testcase( i==93 ); /* VALUES */
172730 testcase( i==94 ); /* VIRTUAL */
172731 testcase( i==95 ); /* ALWAYS */
172732 testcase( i==96 ); /* WHEN */
172733 testcase( i==97 ); /* WHERE */
172734 testcase( i==98 ); /* RECURSIVE */
172735 testcase( i==99 ); /* ABORT */
172736 testcase( i==100 ); /* AFTER */
172737 testcase( i==101 ); /* RENAME */
172738 testcase( i==102 ); /* AND */
172739 testcase( i==103 ); /* DROP */
172740 testcase( i==104 ); /* PARTITION */
172741 testcase( i==105 ); /* AUTOINCREMENT */
172742 testcase( i==106 ); /* TO */
172743 testcase( i==107 ); /* IN */
172744 testcase( i==108 ); /* CAST */
172745 testcase( i==109 ); /* COLUMN */
172746 testcase( i==110 ); /* COMMIT */
172747 testcase( i==111 ); /* CONFLICT */
172748 testcase( i==112 ); /* CROSS */
172749 testcase( i==113 ); /* CURRENT_TIMESTAMP */
172750 testcase( i==114 ); /* CURRENT_TIME */
172751 testcase( i==115 ); /* CURRENT */
172752 testcase( i==116 ); /* PRECEDING */
172753 testcase( i==117 ); /* FAIL */
172754 testcase( i==118 ); /* LAST */
172755 testcase( i==119 ); /* FILTER */
172756 testcase( i==120 ); /* REPLACE */
172757 testcase( i==121 ); /* FIRST */
172758 testcase( i==122 ); /* FOLLOWING */
172759 testcase( i==123 ); /* FROM */
172760 testcase( i==124 ); /* FULL */
172761 testcase( i==125 ); /* LIMIT */
172762 testcase( i==126 ); /* IF */
172763 testcase( i==127 ); /* ORDER */
172764 testcase( i==128 ); /* RESTRICT */
172765 testcase( i==129 ); /* OTHERS */
172766 testcase( i==130 ); /* OVER */
172767 testcase( i==131 ); /* RETURNING */
172768 testcase( i==132 ); /* RIGHT */
172769 testcase( i==133 ); /* ROLLBACK */
172770 testcase( i==134 ); /* ROWS */
172771 testcase( i==135 ); /* ROW */
172772 testcase( i==136 ); /* UNBOUNDED */
172773 testcase( i==137 ); /* UNION */
172774 testcase( i==138 ); /* USING */
172775 testcase( i==139 ); /* VACUUM */
172776 testcase( i==140 ); /* VIEW */
172777 testcase( i==141 ); /* WINDOW */
172778 testcase( i==142 ); /* DO */
172779 testcase( i==143 ); /* BY */
172780 testcase( i==144 ); /* INITIALLY */
172781 testcase( i==145 ); /* ALL */
172782 testcase( i==146 ); /* PRIMARY */
172783 *pType = aKWCode[i];
172784 break;
172785 }
172786 }
172787 return n;
@@ -172792,10 +173454,11 @@
172792 return id;
172793 }
172794 #define SQLITE_N_KEYWORD 147
172795 SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
172796 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
 
172797 *pzName = zKWText + aKWOffset[i];
172798 *pnName = aKWLen[i];
172799 return SQLITE_OK;
172800 }
172801 SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; }
@@ -174330,13 +174993,25 @@
174330 */
174331 SQLITE_API int sqlite3_config(int op, ...){
174332 va_list ap;
174333 int rc = SQLITE_OK;
174334
174335 /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
174336 ** the SQLite library is in use. */
174337 if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;
 
 
 
 
 
 
 
 
 
 
 
 
174338
174339 va_start(ap, op);
174340 switch( op ){
174341
174342 /* Mutex configuration options are only available in a threadsafe
@@ -174401,10 +175076,11 @@
174401 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
174402 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
174403 break;
174404 }
174405 case SQLITE_CONFIG_MEMSTATUS: {
 
174406 /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
174407 ** single argument of type int, interpreted as a boolean, which enables
174408 ** or disables the collection of memory allocation statistics. */
174409 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
174410 break;
@@ -174524,12 +175200,14 @@
174524 /* MSVC is picky about pulling func ptrs from va lists.
174525 ** http://support.microsoft.com/kb/47961
174526 ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
174527 */
174528 typedef void(*LOGFUNC_t)(void*,int,const char*);
174529 sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
174530 sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
 
 
174531 break;
174532 }
174533
174534 /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
174535 ** can be changed at start-time using the
@@ -174539,11 +175217,12 @@
174539 case SQLITE_CONFIG_URI: {
174540 /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
174541 ** argument of type int. If non-zero, then URI handling is globally
174542 ** enabled. If the parameter is zero, then URI handling is globally
174543 ** disabled. */
174544 sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
 
174545 break;
174546 }
174547
174548 case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
174549 /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174854,10 +175533,12 @@
174854 { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
174855 { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
174856 { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
174857 { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
174858 { SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
 
 
174859 };
174860 unsigned int i;
174861 rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
174862 for(i=0; i<ArraySize(aFlagOp); i++){
174863 if( aFlagOp[i].op==op ){
@@ -176839,13 +177520,13 @@
176839 char c;
176840 int nUri = sqlite3Strlen30(zUri);
176841
176842 assert( *pzErrMsg==0 );
176843
176844 if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
176845 || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
176846 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
176847 ){
176848 char *zOpt;
176849 int eState; /* Parser state when parsing URI */
176850 int iIn; /* Input character index */
176851 int iOut = 0; /* Output character index */
@@ -177247,10 +177928,13 @@
177247 #if defined(SQLITE_DEFAULT_DEFENSIVE)
177248 | SQLITE_Defensive
177249 #endif
177250 #if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177251 | SQLITE_LegacyAlter
 
 
 
177252 #endif
177253 ;
177254 sqlite3HashInit(&db->aCollSeq);
177255 #ifndef SQLITE_OMIT_VIRTUALTABLE
177256 sqlite3HashInit(&db->aModule);
@@ -193016,20 +193700,22 @@
193016 static int fts3MsrBufferData(
193017 Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193018 char *pList,
193019 i64 nList
193020 ){
193021 if( nList>pMsr->nBuffer ){
193022 char *pNew;
193023 pMsr->nBuffer = nList*2;
193024 pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
193025 if( !pNew ) return SQLITE_NOMEM;
193026 pMsr->aBuffer = pNew;
 
193027 }
193028
193029 assert( nList>0 );
193030 memcpy(pMsr->aBuffer, pList, nList);
 
193031 return SQLITE_OK;
193032 }
193033
193034 SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193035 Fts3Table *p, /* Virtual table handle */
@@ -199017,12 +199703,15 @@
199017 switch( sqlite3_value_type(pValue) ){
199018 case SQLITE_NULL: {
199019 jsonAppendRaw(p, "null", 4);
199020 break;
199021 }
199022 case SQLITE_INTEGER:
199023 case SQLITE_FLOAT: {
 
 
 
 
199024 const char *z = (const char*)sqlite3_value_text(pValue);
199025 u32 n = (u32)sqlite3_value_bytes(pValue);
199026 jsonAppendRaw(p, z, n);
199027 break;
199028 }
@@ -199464,10 +200153,31 @@
199464 int i;
199465 for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0;
199466 return 1;
199467 }
199468
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199469 /*
199470 ** Parse a single JSON value which begins at pParse->zJson[i]. Return the
199471 ** index of the first character past the end of the value parsed.
199472 **
199473 ** Return negative for a syntax error. Special cases: return -2 if the
@@ -199609,10 +200319,28 @@
199609 c = z[j+1];
199610 }
199611 if( c<'0' || c>'9' ) return -1;
199612 continue;
199613 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199614 break;
199615 }
199616 if( z[j-1]<'0' ) return -1;
199617 jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT,
199618 j - i, &z[i]);
@@ -199622,10 +200350,24 @@
199622 }else if( c==']' ){
199623 return -3; /* End of [...] */
199624 }else if( c==0 ){
199625 return 0; /* End of file */
199626 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199627 return -1; /* Syntax error */
199628 }
199629 }
199630
199631 /*
@@ -212444,19 +213186,28 @@
212444
212445 iOff = (i64)(pFrame->iDbPage-1) * p->pgsz;
212446 p->rc = pDb->pMethods->xWrite(pDb, p->aBuf, p->pgsz, iOff);
212447 }
212448
 
 
 
 
 
212449
212450 /*
212451 ** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if
212452 ** successful, or an SQLite error code otherwise.
212453 */
212454 static int rbuLockDatabase(sqlite3 *db){
212455 int rc = SQLITE_OK;
212456 sqlite3_file *fd = 0;
212457 sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd);
 
 
 
 
212458
212459 if( fd->pMethods ){
212460 rc = fd->pMethods->xLock(fd, SQLITE_LOCK_SHARED);
212461 if( rc==SQLITE_OK ){
212462 rc = fd->pMethods->xLock(fd, SQLITE_LOCK_EXCLUSIVE);
@@ -215691,10 +216442,11 @@
215691 (void)argc;
215692 (void)argv;
215693 (void)pzErr;
215694
215695 sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
 
215696 rc = sqlite3_declare_vtab(db,
215697 "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
215698 if( rc==SQLITE_OK ){
215699 pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable));
215700 if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
@@ -215774,11 +216526,10 @@
215774 && pIdxInfo->aOrderBy[0].iColumn<=0
215775 && pIdxInfo->aOrderBy[0].desc==0
215776 ){
215777 pIdxInfo->orderByConsumed = 1;
215778 }
215779 sqlite3VtabUsesAllSchemas(pIdxInfo);
215780 return SQLITE_OK;
215781 }
215782
215783 /*
215784 ** Open a new dbpagevfs cursor.
@@ -218163,13 +218914,14 @@
218163 SessionBuffer *p,
218164 const char *zStr,
218165 int *pRc
218166 ){
218167 int nStr = sqlite3Strlen30(zStr);
218168 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218169 memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218170 p->nBuf += nStr;
 
218171 }
218172 }
218173
218174 /*
218175 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218186,10 +218938,31 @@
218186 ){
218187 char aBuf[24];
218188 sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218189 sessionAppendStr(p, aBuf, pRc);
218190 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218191
218192 /*
218193 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
218194 ** called. Otherwise, append the string zStr enclosed in quotes (") and
218195 ** with any embedded quote characters escaped to the buffer. No
@@ -218201,11 +218974,11 @@
218201 static void sessionAppendIdent(
218202 SessionBuffer *p, /* Buffer to a append to */
218203 const char *zStr, /* String to quote, escape and append */
218204 int *pRc /* IN/OUT: Error code */
218205 ){
218206 int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1;
218207 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218208 char *zOut = (char *)&p->aBuf[p->nBuf];
218209 const char *zIn = zStr;
218210 *zOut++ = '"';
218211 while( *zIn ){
@@ -218212,10 +218985,11 @@
218212 if( *zIn=='"' ) *zOut++ = '"';
218213 *zOut++ = *(zIn++);
218214 }
218215 *zOut++ = '"';
218216 p->nBuf = (int)((u8 *)zOut - p->aBuf);
 
218217 }
218218 }
218219
218220 /*
218221 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218436,33 +219210,82 @@
218436
218437 /*
218438 ** Formulate and prepare a SELECT statement to retrieve a row from table
218439 ** zTab in database zDb based on its primary key. i.e.
218440 **
218441 ** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ...
 
 
 
 
 
 
218442 */
218443 static int sessionSelectStmt(
218444 sqlite3 *db, /* Database handle */
 
218445 const char *zDb, /* Database name */
218446 const char *zTab, /* Table name */
218447 int nCol, /* Number of columns in table */
218448 const char **azCol, /* Names of table columns */
218449 u8 *abPK, /* PRIMARY KEY array */
218450 sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
218451 ){
218452 int rc = SQLITE_OK;
218453 char *zSql = 0;
 
 
218454 int nSql = -1;
 
218455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218456 if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
218457 zSql = sqlite3_mprintf(
218458 "SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
218459 "idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
218460 );
218461 if( zSql==0 ) rc = SQLITE_NOMEM;
218462 }else{
218463 int i;
218464 const char *zSep = "";
218465 SessionBuffer buf = {0, 0, 0};
218466
218467 sessionAppendStr(&buf, "SELECT * FROM ", &rc);
218468 sessionAppendIdent(&buf, zDb, &rc);
@@ -218479,15 +219302,19 @@
218479 }
218480 }
218481 zSql = (char*)buf.aBuf;
218482 nSql = buf.nBuf;
218483 }
 
218484
218485 if( rc==SQLITE_OK ){
218486 rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
218487 }
218488 sqlite3_free(zSql);
 
 
 
218489 return rc;
218490 }
218491
218492 /*
218493 ** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218643,11 +219470,12 @@
218643 sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
218644
218645 /* Build and compile a statement to execute: */
218646 if( rc==SQLITE_OK ){
218647 rc = sessionSelectStmt(
218648 db, pSession->zDb, zName, nCol, azCol, abPK, &pSel);
 
218649 }
218650
218651 nNoop = buf.nBuf;
218652 for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
218653 SessionChange *p; /* Used to iterate through changes */
@@ -219832,10 +220660,11 @@
219832 int bInvertConstraints; /* Invert when iterating constraints buffer */
219833 SessionBuffer constraints; /* Deferred constraints are stored here */
219834 SessionBuffer rebase; /* Rebase information (if any) here */
219835 u8 bRebaseStarted; /* If table header is already in rebase */
219836 u8 bRebase; /* True to collect rebase information */
 
219837 };
219838
219839 /* Number of prepared UPDATE statements to cache. */
219840 #define SESSION_UPDATE_CACHE_SZ 12
219841
@@ -220082,12 +220911,13 @@
220082 static int sessionSelectRow(
220083 sqlite3 *db, /* Database handle */
220084 const char *zTab, /* Table name */
220085 SessionApplyCtx *p /* Session changeset-apply context */
220086 ){
220087 return sessionSelectStmt(
220088 db, "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect);
 
220089 }
220090
220091 /*
220092 ** Formulate and prepare an INSERT statement to add a record to table zTab.
220093 ** For example:
@@ -220242,23 +221072,36 @@
220242 ** new.* record to the SELECT statement. Or, if it points to a DELETE or
220243 ** UPDATE, bind values from the old.* record.
220244 */
220245 static int sessionSeekToRow(
220246 sqlite3_changeset_iter *pIter, /* Changeset iterator */
220247 u8 *abPK, /* Primary key flags array */
220248 sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
220249 ){
 
220250 int rc; /* Return code */
220251 int nCol; /* Number of columns in table */
220252 int op; /* Changset operation (SQLITE_UPDATE etc.) */
220253 const char *zDummy; /* Unused */
220254
 
220255 sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
220256 rc = sessionBindRow(pIter,
220257 op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
220258 nCol, abPK, pSelect
220259 );
 
 
 
 
 
 
 
 
 
 
 
 
220260
220261 if( rc==SQLITE_OK ){
220262 rc = sqlite3_step(pSelect);
220263 if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
220264 }
@@ -220370,20 +221213,26 @@
220370 assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
220371 assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
220372
220373 /* Bind the new.* PRIMARY KEY values to the SELECT statement. */
220374 if( pbReplace ){
220375 rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
220376 }else{
220377 rc = SQLITE_OK;
220378 }
220379
220380 if( rc==SQLITE_ROW ){
220381 /* There exists another row with the new.* primary key. */
220382 pIter->pConflict = p->pSelect;
220383 res = xConflict(pCtx, eType, pIter);
220384 pIter->pConflict = 0;
 
 
 
 
 
 
220385 rc = sqlite3_reset(p->pSelect);
220386 }else if( rc==SQLITE_OK ){
220387 if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
220388 /* Instead of invoking the conflict handler, append the change blob
220389 ** to the SessionApplyCtx.constraints buffer. */
@@ -220487,11 +221336,11 @@
220487 }
220488 if( rc!=SQLITE_OK ) return rc;
220489
220490 sqlite3_step(p->pDelete);
220491 rc = sqlite3_reset(p->pDelete);
220492 if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){
220493 rc = sessionConflictHandler(
220494 SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
220495 );
220496 }else if( (rc&0xff)==SQLITE_CONSTRAINT ){
220497 rc = sessionConflictHandler(
@@ -220544,11 +221393,11 @@
220544 assert( op==SQLITE_INSERT );
220545 if( p->bStat1 ){
220546 /* Check if there is a conflicting row. For sqlite_stat1, this needs
220547 ** to be done using a SELECT, as there is no PRIMARY KEY in the
220548 ** database schema to throw an exception if a duplicate is inserted. */
220549 rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
220550 if( rc==SQLITE_ROW ){
220551 rc = SQLITE_CONSTRAINT;
220552 sqlite3_reset(p->pSelect);
220553 }
220554 }
@@ -220721,10 +221570,11 @@
220721
220722 pIter->in.bNoDiscard = 1;
220723 memset(&sApply, 0, sizeof(sApply));
220724 sApply.bRebase = (ppRebase && pnRebase);
220725 sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
 
220726 sqlite3_mutex_enter(sqlite3_db_mutex(db));
220727 if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
220728 rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
220729 }
220730 if( rc==SQLITE_OK ){
@@ -224977,11 +225827,11 @@
224977 UNUSED_PARAM2(pToken, nToken);
224978
224979 if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
224980 iPos = p->iPos++;
224981
224982 if( p->iRangeEnd>0 ){
224983 if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
224984 if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
224985 }
224986
224987 if( iPos==p->iter.iStart ){
@@ -224989,11 +225839,11 @@
224989 fts5HighlightAppend(&rc, p, p->zOpen, -1);
224990 p->iOff = iStartOff;
224991 }
224992
224993 if( iPos==p->iter.iEnd ){
224994 if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){
224995 fts5HighlightAppend(&rc, p, p->zOpen, -1);
224996 }
224997 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
224998 fts5HighlightAppend(&rc, p, p->zClose, -1);
224999 p->iOff = iEndOff;
@@ -225000,11 +225850,11 @@
225000 if( rc==SQLITE_OK ){
225001 rc = fts5CInstIterNext(&p->iter);
225002 }
225003 }
225004
225005 if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
225006 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225007 p->iOff = iEndOff;
225008 if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225009 fts5HighlightAppend(&rc, p, p->zClose, -1);
225010 }
@@ -225035,10 +225885,11 @@
225035
225036 iCol = sqlite3_value_int(apVal[0]);
225037 memset(&ctx, 0, sizeof(HighlightContext));
225038 ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225039 ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
 
225040 rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225041
225042 if( ctx.zIn ){
225043 if( rc==SQLITE_OK ){
225044 rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225220,10 +226071,11 @@
225220 nCol = pApi->xColumnCount(pFts);
225221 memset(&ctx, 0, sizeof(HighlightContext));
225222 iCol = sqlite3_value_int(apVal[0]);
225223 ctx.zOpen = fts5ValueToText(apVal[1]);
225224 ctx.zClose = fts5ValueToText(apVal[2]);
 
225225 zEllips = fts5ValueToText(apVal[3]);
225226 nToken = sqlite3_value_int(apVal[4]);
225227
225228 iBestCol = (iCol>=0 ? iCol : 0);
225229 nPhrase = pApi->xPhraseCount(pFts);
@@ -240169,11 +241021,11 @@
240169 int nArg, /* Number of args */
240170 sqlite3_value **apUnused /* Function arguments */
240171 ){
240172 assert( nArg==0 );
240173 UNUSED_PARAM2(nArg, apUnused);
240174 sqlite3_result_text(pCtx, "fts5: 2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d", -1, SQLITE_TRANSIENT);
240175 }
240176
240177 /*
240178 ** Return true if zName is the extension on one of the shadow tables used
240179 ** by this module.
240180
--- 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 */
@@ -19154,10 +19234,11 @@
19234 Expr *pExpr; /* The expression contained in the index */
19235 int iDataCur; /* The data cursor associated with the index */
19236 int iIdxCur; /* The index cursor */
19237 int iIdxCol; /* The index column that contains value of pExpr */
19238 u8 bMaybeNullRow; /* True if we need an OP_IfNullRow check */
19239 u8 aff; /* Affinity of the pExpr expression */
19240 IndexedExpr *pIENext; /* Next in a list of all indexed expressions */
19241 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
19242 const char *zIdxName; /* Name of index, used only for bytecode comments */
19243 #endif
19244 };
@@ -19206,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 */
@@ -19666,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...
@@ -20137,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*);
@@ -20287,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*);
@@ -20824,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*);
@@ -21073,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 ***************************************/
@@ -22263,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
@@ -30068,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 );
@@ -30160,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
@@ -30466,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{
@@ -30528,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 }
@@ -30562,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 );
@@ -31244,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
@@ -52651,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 */
@@ -52681,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){
@@ -53425,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.
@@ -68090,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
@@ -68554,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 }
@@ -69364,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){
@@ -69450,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 }
@@ -69649,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;
@@ -69746,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
@@ -69762,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{
@@ -69998,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 }
@@ -70116,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[] */
@@ -70142,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.
@@ -70231,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;
@@ -70288,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);
@@ -70299,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 /*
@@ -70343,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;
@@ -72216,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 }
@@ -74502,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 ){
@@ -74765,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
@@ -74831,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;
@@ -74876,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);
@@ -74933,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);
@@ -74956,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:
@@ -75084,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
@@ -75105,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 }
@@ -75464,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 */
@@ -75486,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 );
@@ -75525,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 */
@@ -75720,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
@@ -75864,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 /*
@@ -75954,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 );
@@ -76691,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
@@ -76775,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,
@@ -77021,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++){
@@ -77106,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,
@@ -77604,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 );
@@ -77631,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;
@@ -77679,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
@@ -77703,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
@@ -77903,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
@@ -78652,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);
@@ -78692,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 }
@@ -78722,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
@@ -78753,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]);
@@ -78766,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
@@ -78798,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 */
@@ -78913,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 }
@@ -78940,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. */
@@ -78960,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;
@@ -78984,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];
@@ -79116,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:
@@ -79213,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
@@ -79230,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,
@@ -79261,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
@@ -80805,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;
@@ -81849,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;
@@ -81885,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;
@@ -81958,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 }
@@ -82804,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;
@@ -83483,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
@@ -83511,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
@@ -83541,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.
@@ -85681,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;
@@ -85999,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
@@ -87628,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).
@@ -88014,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) */
@@ -89881,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;
@@ -89915,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 }
@@ -89945,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 }
@@ -89979,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;
@@ -90913,12 +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 ){
@@ -104493,18 +104869,14 @@
104869 }
104870 sqlite3WalkExpr(pWalker, pExpr->pLeft);
104871 if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){
104872 testcase( ExprHasProperty(pExpr, EP_OuterON) );
104873 assert( !ExprHasProperty(pExpr, EP_IntValue) );
104874 pExpr->u.iValue = (pExpr->op==TK_NOTNULL);
104875 pExpr->flags |= EP_IntValue;
104876 pExpr->op = TK_INTEGER;
104877
 
 
 
 
104878 for(i=0, p=pNC; p && i<ArraySize(anRef); p=p->pNext, i++){
104879 p->nRef = anRef[i];
104880 }
104881 sqlite3ExprDelete(pParse->db, pExpr->pLeft);
104882 pExpr->pLeft = 0;
@@ -104802,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 );
@@ -105991,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 }
@@ -108363,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;
@@ -108649,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;
@@ -109552,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{
@@ -109564,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.
@@ -109580,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;
@@ -109846,17 +110219,28 @@
110219 int target /* Where to store the result of the expression */
110220 ){
110221 IndexedExpr *p;
110222 Vdbe *v;
110223 for(p=pParse->pIdxEpr; p; p=p->pIENext){
110224 u8 exprAff;
110225 int iDataCur = p->iDataCur;
110226 if( iDataCur<0 ) continue;
110227 if( pParse->iSelfTab ){
110228 if( p->iDataCur!=pParse->iSelfTab-1 ) continue;
110229 iDataCur = -1;
110230 }
110231 if( sqlite3ExprCompare(0, pExpr, p->pExpr, iDataCur)!=0 ) continue;
110232 assert( p->aff>=SQLITE_AFF_BLOB && p->aff<=SQLITE_AFF_NUMERIC );
110233 exprAff = sqlite3ExprAffinity(pExpr);
110234 if( (exprAff<=SQLITE_AFF_BLOB && p->aff!=SQLITE_AFF_BLOB)
110235 || (exprAff==SQLITE_AFF_TEXT && p->aff!=SQLITE_AFF_TEXT)
110236 || (exprAff>=SQLITE_AFF_NUMERIC && p->aff!=SQLITE_AFF_NUMERIC)
110237 ){
110238 /* Affinity mismatch on a generated column */
110239 continue;
110240 }
110241
110242 v = pParse->pVdbe;
110243 assert( v!=0 );
110244 if( p->bMaybeNullRow ){
110245 /* If the index is on a NULL row due to an outer join, then we
110246 ** cannot extract the value from the index. The value must be
@@ -109921,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;
@@ -110096,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 }
@@ -110432,21 +110825,20 @@
110825 case TK_BETWEEN: {
110826 exprCodeBetween(pParse, pExpr, target, 0, 0);
110827 return target;
110828 }
110829 case TK_COLLATE: {
110830 if( !ExprHasProperty(pExpr, EP_Collate) ){
110831 /* A TK_COLLATE Expr node without the EP_Collate tag is a so-called
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 }
@@ -110543,20 +110935,23 @@
110935 target);
110936 inReg = target;
110937 break;
110938 }
110939 }
110940 addrINR = sqlite3VdbeAddOp3(v, OP_IfNullRow, pExpr->iTable, 0, target);
110941 /* The OP_IfNullRow opcode above can overwrite the result register with
110942 ** NULL. So we have to ensure that the result register is not a value
110943 ** that is suppose to be a constant. Two defenses are needed:
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 /*
110957 ** Form A:
@@ -110789,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);
@@ -111974,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 }
@@ -112136,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 */
@@ -112147,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 }
@@ -112323,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 */
@@ -112341,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
@@ -115625,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) ){
@@ -115735,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);
@@ -115907,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);
@@ -115988,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 /*
@@ -118915,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);
@@ -118941,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 }
@@ -119476,10 +119961,11 @@
119961 ** just a reference to another column, in order for covering index
119962 ** optimizations to work correctly. So if the value is not an expression,
119963 ** turn it into one by adding a unary "+" operator. */
119964 pExpr = sqlite3PExpr(pParse, TK_UPLUS, pExpr, 0);
119965 }
119966 if( pExpr && pExpr->op!=TK_RAISE ) pExpr->affExpr = pCol->affinity;
119967 sqlite3ColumnSetExpr(pParse, pTab, pCol, pExpr);
119968 pExpr = 0;
119969 goto generated_done;
119970
119971 generated_error:
@@ -123813,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;
@@ -124073,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,
@@ -124182,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;
@@ -126878,10 +127366,22 @@
127366 ** unable to take a pointer to these functions. Hence, we here wrap them
127367 ** in our own actual functions.
127368 */
127369 static double xCeil(double x){ return ceil(x); }
127370 static double xFloor(double x){ return floor(x); }
127371
127372 /*
127373 ** Some systems do not have log2() and log10() in their standard math
127374 ** libraries.
127375 */
127376 #if defined(HAVE_LOG10) && HAVE_LOG10==0
127377 # define log10(X) (0.4342944819032517867*log(X))
127378 #endif
127379 #if defined(HAVE_LOG2) && HAVE_LOG2==0
127380 # define log2(X) (1.442695040888963456*log(X))
127381 #endif
127382
127383
127384 /*
127385 ** Implementation of SQL functions:
127386 **
127387 ** ln(X) - natural logarithm
@@ -128758,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.
@@ -129482,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 */
@@ -129929,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
@@ -133292,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);
@@ -135795,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);
@@ -135836,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 }
@@ -135965,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.
@@ -136000,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);
@@ -136150,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 ){
@@ -136257,10 +136780,27 @@
136780 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
136781 jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
136782 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
136783 jmp4 = integrityCheckResultRow(v);
136784 sqlite3VdbeJumpHere(v, jmp2);
136785
136786 /* The OP_IdxRowid opcode is an optimized version of OP_Column
136787 ** that extracts the rowid off the end of the index record.
136788 ** But it only works correctly if index record does not have
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);
136800 sqlite3VdbeJumpHere(v, jmp7);
136801 }
136802
136803 /* Any indexed columns with non-BINARY collations must still hold
136804 ** the exact same text value as the table. */
136805 label6 = 0;
136806 for(kk=0; kk<pIdx->nKeyCol; kk++){
@@ -140553,12 +141093,10 @@
141093 p = a[i].pExpr;
141094 /* pCol->szEst = ... // Column size est for SELECT tables never used */
141095 pCol->affinity = sqlite3ExprAffinity(p);
141096 if( pCol->affinity<=SQLITE_AFF_NONE ){
141097 pCol->affinity = aff;
 
 
141098 }
141099 if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){
141100 int m = 0;
141101 Select *pS2;
141102 for(m=0, pS2=pSelect->pNext; pS2; pS2=pS2->pNext){
@@ -140567,10 +141105,13 @@
141105 if( pCol->affinity==SQLITE_AFF_TEXT && (m&0x01)!=0 ){
141106 pCol->affinity = SQLITE_AFF_BLOB;
141107 }else
141108 if( pCol->affinity>=SQLITE_AFF_NUMERIC && (m&0x02)!=0 ){
141109 pCol->affinity = SQLITE_AFF_BLOB;
141110 }
141111 if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){
141112 pCol->affinity = SQLITE_AFF_FLEXNUM;
141113 }
141114 }
141115 zType = columnType(&sNC, p, 0, 0, 0);
141116 if( zType==0 || pCol->affinity!=sqlite3AffinityType(zType, 0) ){
141117 if( pCol->affinity==SQLITE_AFF_NUMERIC
@@ -142082,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;
@@ -142459,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
@@ -143328,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(
@@ -143362,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){
@@ -143455,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 **
@@ -144598,14 +145203,16 @@
145203 Select *pSelect, /* The SELECT statement being processed */
145204 AggInfo *pAggInfo, /* The aggregate info */
145205 NameContext *pNC /* Name context used to resolve agg-func args */
145206 ){
145207 assert( pAggInfo->iFirstReg==0 );
145208 assert( pSelect!=0 );
145209 assert( pSelect->pGroupBy!=0 );
145210 pAggInfo->nColumn = pAggInfo->nAccumulator;
145211 if( ALWAYS(pAggInfo->nSortingColumn>0) ){
145212 if( pAggInfo->nColumn==0 ){
145213 pAggInfo->nSortingColumn = pSelect->pGroupBy->nExpr;
145214 }else{
145215 pAggInfo->nSortingColumn =
145216 pAggInfo->aCol[pAggInfo->nColumn-1].iSorterColumn+1;
145217 }
145218 }
@@ -144639,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
@@ -144997,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 **
@@ -145025,11 +145633,13 @@
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) );
145644 if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */
145645 assert( ExprUseXList(pExpr) );
@@ -145036,17 +145646,19 @@
145646 if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */
145647 if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */
145648 if( ExprHasProperty(pExpr, EP_WinFunc) ) return 0;/* Not a window function */
145649 pSub = p->pSrc->a[0].pSelect;
145650 if( pSub==0 ) return 0; /* The FROM is a subquery */
145651 if( pSub->pPrior==0 ) return 0; /* Must be a compound */
145652 if( pSub->selFlags & SF_CopyCte ) return 0; /* Not a CTE */
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;
@@ -145085,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.
@@ -145474,19 +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 */
@@ -145554,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
@@ -146841,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
@@ -147622,11 +148247,11 @@
148247 assert( db->mallocFailed==0 );
148248 sqlite3GenerateColumnNames(pParse, &sSelect);
148249 }
148250 sqlite3ExprListDelete(db, sSelect.pEList);
148251 pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
148252 if( pParse->nErr==0 ){
148253 NameContext sNC;
148254 memset(&sNC, 0, sizeof(sNC));
148255 if( pReturning->nRetCol==0 ){
148256 pReturning->nRetCol = pNew->nExpr;
148257 pReturning->iRetCur = pParse->nTab++;
@@ -148091,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 ){
@@ -148525,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
@@ -148844,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
@@ -150814,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 ){
@@ -151532,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 }
@@ -152306,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(
@@ -152320,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 */
@@ -152487,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
@@ -153204,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 /*
@@ -154120,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);
@@ -154161,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 ){
@@ -154204,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 */
@@ -156846,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 }
@@ -157691,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);
@@ -157752,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 */
@@ -157822,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++;
@@ -157858,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
@@ -157890,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 */
@@ -157983,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
@@ -158039,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);
@@ -158072,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 /*
@@ -158327,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) */
@@ -158370,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.
@@ -158415,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 */
@@ -158851,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
@@ -160952,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 }
@@ -160977,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 **
@@ -162143,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 ){
@@ -162554,10 +163220,13 @@
163220 p->pExpr = sqlite3ExprDup(pParse->db, pExpr, 0);
163221 p->iDataCur = pTabItem->iCursor;
163222 p->iIdxCur = iIdxCur;
163223 p->iIdxCol = i;
163224 p->bMaybeNullRow = bMaybeNullRow;
163225 if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){
163226 p->aff = pIdx->zColAff[i];
163227 }
163228 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
163229 p->zIdxName = pIdx->zName;
163230 #endif
163231 pParse->pIdxEpr = p;
163232 if( p->pIENext==0 ){
@@ -163069,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);
@@ -163527,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 );
@@ -167230,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.
@@ -167308,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,
@@ -167731,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,
@@ -167750,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,
@@ -167772,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,
@@ -167795,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,
@@ -167813,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[] = {
@@ -167862,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:
@@ -168716,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
@@ -169627,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[] = {
@@ -170037,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 /*
@@ -170323,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);}
@@ -170360,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;
@@ -170544,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;
@@ -170696,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);
@@ -170724,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;}
@@ -170897,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;
@@ -171018,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);
@@ -171043,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);
@@ -171076,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;
@@ -171133,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);
@@ -171160,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);
@@ -171173,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 ){
@@ -171238,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 ()
@@ -171284,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);
@@ -171326,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);
@@ -171732,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;
@@ -171744,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];
@@ -172400,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,
@@ -172415,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,
@@ -172431,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,
@@ -172446,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,
@@ -172615,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;
@@ -172631,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;
@@ -172792,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; }
@@ -174330,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
@@ -174401,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;
@@ -174524,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
@@ -174539,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
@@ -174854,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 ){
@@ -176839,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 */
@@ -177247,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);
@@ -193016,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 */
@@ -199017,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 }
@@ -199464,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
@@ -199609,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]);
@@ -199622,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 /*
@@ -212444,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);
@@ -215691,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;
@@ -215774,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.
@@ -218163,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
@@ -218186,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
@@ -218201,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 ){
@@ -218212,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
@@ -218436,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);
@@ -218479,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
@@ -218643,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 */
@@ -219832,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
@@ -220082,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:
@@ -220242,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 }
@@ -220370,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. */
@@ -220487,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(
@@ -220544,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 }
@@ -220721,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 ){
@@ -224977,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 ){
@@ -224989,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;
@@ -225000,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 }
@@ -225035,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);
@@ -225220,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);
@@ -240169,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.0"
150
-#define SQLITE_VERSION_NUMBER 3041000
151
-#define SQLITE_SOURCE_ID "2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d"
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.0"
150 #define SQLITE_VERSION_NUMBER 3041000
151 #define SQLITE_SOURCE_ID "2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d"
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
+1 -1
--- skins/README.md
+++ skins/README.md
@@ -21,11 +21,11 @@
2121
2222
2. Add files skins/newskin/css.txt, skins/newskin/details.txt,
2323
skins/newskin/footer.txt, skins/newskin/header.txt, and
2424
skins/newskin/js.txt. Be sure to "fossil add" these files.
2525
26
- 3. Go to the src/ directory and rerun "tclsh makemake.tcl". This
26
+ 3. Go to the tools/ directory and rerun "tclsh makemake.tcl". This
2727
step rebuilds the various makefiles so that they have dependencies
2828
on the skin files you just installed.
2929
3030
4. Edit the BuiltinSkin[] array near the top of the src/skins.c source
3131
file so that it describes and references the "newskin" skin.
3232
--- skins/README.md
+++ skins/README.md
@@ -21,11 +21,11 @@
21
22 2. Add files skins/newskin/css.txt, skins/newskin/details.txt,
23 skins/newskin/footer.txt, skins/newskin/header.txt, and
24 skins/newskin/js.txt. Be sure to "fossil add" these files.
25
26 3. Go to the src/ directory and rerun "tclsh makemake.tcl". This
27 step rebuilds the various makefiles so that they have dependencies
28 on the skin files you just installed.
29
30 4. Edit the BuiltinSkin[] array near the top of the src/skins.c source
31 file so that it describes and references the "newskin" skin.
32
--- skins/README.md
+++ skins/README.md
@@ -21,11 +21,11 @@
21
22 2. Add files skins/newskin/css.txt, skins/newskin/details.txt,
23 skins/newskin/footer.txt, skins/newskin/header.txt, and
24 skins/newskin/js.txt. Be sure to "fossil add" these files.
25
26 3. Go to the tools/ directory and rerun "tclsh makemake.tcl". This
27 step rebuilds the various makefiles so that they have dependencies
28 on the skin files you just installed.
29
30 4. Edit the BuiltinSkin[] array near the top of the src/skins.c source
31 file so that it describes and references the "newskin" skin.
32
--- 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,
@@ -1406,10 +1411,13 @@
14061411
display: table;
14071412
clear: both
14081413
}
14091414
div.forumSel {
14101415
background-color: #3a3a3a;
1416
+}
1417
+body.forum .forumPosts.fileage a:visited {
1418
+ color: rgb(72, 144, 224);
14111419
}
14121420
.debug {
14131421
background-color: #330;
14141422
border: 2px solid #aa0;
14151423
}
14161424
--- 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,
@@ -1406,10 +1411,13 @@
1406 display: table;
1407 clear: both
1408 }
1409 div.forumSel {
1410 background-color: #3a3a3a;
 
 
 
1411 }
1412 .debug {
1413 background-color: #330;
1414 border: 2px solid #aa0;
1415 }
1416
--- 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,
@@ -1406,10 +1411,13 @@
1411 display: table;
1412 clear: both
1413 }
1414 div.forumSel {
1415 background-color: #3a3a3a;
1416 }
1417 body.forum .forumPosts.fileage a:visited {
1418 color: rgb(72, 144, 224);
1419 }
1420 .debug {
1421 background-color: #330;
1422 border: 2px solid #aa0;
1423 }
1424
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -563,10 +563,15 @@
563563
color: white !important;
564564
background-color: #648898;
565565
border-color: #648898;
566566
}
567567
568
+input[type="submit"]:disabled {
569
+ color: rgb(128,128,128);
570
+ background-color: rgb(153,153,153);
571
+}
572
+
568573
569574
/* Forms
570575
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
571576
input[type="email"],
572577
input[type="number"],
@@ -1114,11 +1119,11 @@
11141119
span.timelineComment {
11151120
padding: 0px 5px;
11161121
}
11171122
11181123
1119
-/* Login/Loguot
1124
+/* Login/Logout
11201125
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
11211126
table.login_out {
11221127
}
11231128
11241129
table.login_out .login_out_label {
@@ -1266,5 +1271,9 @@
12661271
.u-cf {
12671272
content: "";
12681273
display: table;
12691274
clear: both;
12701275
}
1276
+
1277
+body.forum .forumPosts.fileage a:visited {
1278
+ color: #648999;
1279
+}
12711280
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -563,10 +563,15 @@
563 color: white !important;
564 background-color: #648898;
565 border-color: #648898;
566 }
567
 
 
 
 
 
568
569 /* Forms
570 ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
571 input[type="email"],
572 input[type="number"],
@@ -1114,11 +1119,11 @@
1114 span.timelineComment {
1115 padding: 0px 5px;
1116 }
1117
1118
1119 /* Login/Loguot
1120 ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
1121 table.login_out {
1122 }
1123
1124 table.login_out .login_out_label {
@@ -1266,5 +1271,9 @@
1266 .u-cf {
1267 content: "";
1268 display: table;
1269 clear: both;
1270 }
 
 
 
 
1271
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -563,10 +563,15 @@
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 input[type="number"],
@@ -1114,11 +1119,11 @@
1119 span.timelineComment {
1120 padding: 0px 5px;
1121 }
1122
1123
1124 /* Login/Logout
1125 ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
1126 table.login_out {
1127 }
1128
1129 table.login_out .login_out_label {
@@ -1266,5 +1271,9 @@
1271 .u-cf {
1272 content: "";
1273 display: table;
1274 clear: both;
1275 }
1276
1277 body.forum .forumPosts.fileage a:visited {
1278 color: #648999;
1279 }
1280
--- skins/darkmode/css.txt
+++ skins/darkmode/css.txt
@@ -126,10 +126,14 @@
126126
input[type=submit]:hover {
127127
background-color: #FF4500f0;
128128
color: rgba(24,24,24,0.8);
129129
outline: 0
130130
}
131
+input[type=submit]:disabled {
132
+ color: #363636;
133
+ background-color: #707070;
134
+}
131135
.button:focus,
132136
button:focus,
133137
input[type=button]:focus,
134138
input[type=reset]:focus,
135139
input[type=submit]:focus {
@@ -556,19 +560,31 @@
556560
body.forum .debug {
557561
background-color: #FF4500f0;
558562
color: rgba(24,24,24,0.8);
559563
}
560564
561
-body.forum .fileage tr:hover {
565
+body.forum .forumPosts.fileage tr:hover {
566
+ background-color: #333;
567
+ color: rgba(24,24,24,0.8);
568
+}
569
+body.forum .forumPosts.fileage tr:hover {
562570
background-color: #333;
563571
color: rgba(24,24,24,0.8);
572
+}
573
+body.forum .forumPosts.fileage tr:hover > td:nth-child(1),
574
+body.forum .forumPosts.fileage tr:hover > td:nth-child(3) {
575
+ color: #ffffffe0;
564576
}
565577
566578
body.forum .forumPostBody > div blockquote {
567579
border: 1px inset;
568580
padding: 0 0.5em;
569581
}
582
+
583
+body.forum .forumPosts.fileage a:visited {
584
+ color: rgba(98, 150, 205, 0.9);
585
+}
570586
571587
body.report table.report tr td { color: black }
572588
body.report table.report a { color: blue }
573589
body.tkt td.tktDspValue { color: black }
574590
body.tkt td.tktDspValue a { color: blue }
575591
--- skins/darkmode/css.txt
+++ skins/darkmode/css.txt
@@ -126,10 +126,14 @@
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 input[type=submit]:focus {
@@ -556,19 +560,31 @@
556 body.forum .debug {
557 background-color: #FF4500f0;
558 color: rgba(24,24,24,0.8);
559 }
560
561 body.forum .fileage tr:hover {
 
 
 
 
562 background-color: #333;
563 color: rgba(24,24,24,0.8);
 
 
 
 
564 }
565
566 body.forum .forumPostBody > div blockquote {
567 border: 1px inset;
568 padding: 0 0.5em;
569 }
 
 
 
 
570
571 body.report table.report tr td { color: black }
572 body.report table.report a { color: blue }
573 body.tkt td.tktDspValue { color: black }
574 body.tkt td.tktDspValue a { color: blue }
575
--- skins/darkmode/css.txt
+++ skins/darkmode/css.txt
@@ -126,10 +126,14 @@
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 input[type=submit]:focus {
@@ -556,19 +560,31 @@
560 body.forum .debug {
561 background-color: #FF4500f0;
562 color: rgba(24,24,24,0.8);
563 }
564
565 body.forum .forumPosts.fileage tr:hover {
566 background-color: #333;
567 color: rgba(24,24,24,0.8);
568 }
569 body.forum .forumPosts.fileage tr:hover {
570 background-color: #333;
571 color: rgba(24,24,24,0.8);
572 }
573 body.forum .forumPosts.fileage tr:hover > td:nth-child(1),
574 body.forum .forumPosts.fileage tr:hover > td:nth-child(3) {
575 color: #ffffffe0;
576 }
577
578 body.forum .forumPostBody > div blockquote {
579 border: 1px inset;
580 padding: 0 0.5em;
581 }
582
583 body.forum .forumPosts.fileage a:visited {
584 color: rgba(98, 150, 205, 0.9);
585 }
586
587 body.report table.report tr td { color: black }
588 body.report table.report a { color: blue }
589 body.tkt td.tktDspValue { color: black }
590 body.tkt td.tktDspValue a { color: blue }
591
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -398,10 +398,13 @@
398398
div.forumSel {
399399
background-color: #808080;
400400
}
401401
div.forumObs {
402402
color: white;
403
+}
404
+body.forum .forumPosts.fileage a:visited {
405
+ color: rgba(176,176,176,1.0);
403406
}
404407
405408
.fileage td {
406409
font-family: "courier new";
407410
}
408411
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -398,10 +398,13 @@
398 div.forumSel {
399 background-color: #808080;
400 }
401 div.forumObs {
402 color: white;
 
 
 
403 }
404
405 .fileage td {
406 font-family: "courier new";
407 }
408
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -398,10 +398,13 @@
398 div.forumSel {
399 background-color: #808080;
400 }
401 div.forumObs {
402 color: white;
403 }
404 body.forum .forumPosts.fileage a:visited {
405 color: rgba(176,176,176,1.0);
406 }
407
408 .fileage td {
409 font-family: "courier new";
410 }
411
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1142,10 +1142,17 @@
11421142
border-width: 1pt;
11431143
border-style: solid;
11441144
padding: 0 0.5em;
11451145
border-radius: 0.25em;
11461146
}
1147
+
1148
+body.forum .forumPosts.fileage a {
1149
+ color: #60c0ff;
1150
+}
1151
+body.forum .forumPosts.fileage a:visited {
1152
+ color: #40a0ff;
1153
+}
11471154
11481155
.debug {
11491156
color: black;
11501157
}
11511158
11521159
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1142,10 +1142,17 @@
1142 border-width: 1pt;
1143 border-style: solid;
1144 padding: 0 0.5em;
1145 border-radius: 0.25em;
1146 }
 
 
 
 
 
 
 
1147
1148 .debug {
1149 color: black;
1150 }
1151
1152
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1142,10 +1142,17 @@
1142 border-width: 1pt;
1143 border-style: solid;
1144 padding: 0 0.5em;
1145 border-radius: 0.25em;
1146 }
1147
1148 body.forum .forumPosts.fileage a {
1149 color: #60c0ff;
1150 }
1151 body.forum .forumPosts.fileage a:visited {
1152 color: #40a0ff;
1153 }
1154
1155 .debug {
1156 color: black;
1157 }
1158
1159
+5 -4
--- src/alerts.c
+++ src/alerts.c
@@ -19,11 +19,11 @@
1919
**
2020
** Are you looking for the code that reads and writes the internet
2121
** email protocol? That is not here. See the "smtp.c" file instead.
2222
** Yes, the choice of source code filenames is not the greatest, but
2323
** it is not so bad that changing them seems justified.
24
-*/
24
+*/
2525
#include "config.h"
2626
#include "alerts.h"
2727
#include <assert.h>
2828
#include <time.h>
2929
@@ -59,21 +59,21 @@
5959
@ subscriberId INTEGER PRIMARY KEY, -- numeric subscriber ID. Internal use
6060
@ subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE, -- UUID for subscriber
6161
@ semail TEXT UNIQUE COLLATE nocase,-- email address
6262
@ suname TEXT, -- corresponding USER entry
6363
@ sverified BOOLEAN DEFAULT true, -- email address verified
64
-@ sdonotcall BOOLEAN, -- true for Do Not Call
64
+@ sdonotcall BOOLEAN, -- true for Do Not Call
6565
@ sdigest BOOLEAN, -- true for daily digests only
6666
@ ssub TEXT, -- baseline subscriptions
6767
@ sctime INTDATE, -- When this entry was created. unixtime
6868
@ mtime INTDATE, -- Last change. unixtime
6969
@ smip TEXT, -- IP address of last change
7070
@ lastContact INT -- Last contact. days since 1970
7171
@ );
7272
@ CREATE INDEX repository.subscriberUname
7373
@ ON subscriber(suname) WHERE suname IS NOT NULL;
74
-@
74
+@
7575
@ DROP TABLE IF EXISTS repository.pending_alert;
7676
@ -- Email notifications that need to be sent.
7777
@ --
7878
@ -- The first character of the eventid determines the event type.
7979
@ -- Remaining characters determine the specific event. For example,
@@ -615,11 +615,12 @@
615615
const char *zRelay = 0;
616616
emailerGetSetting(p, &zRelay, "email-send-relayhost");
617617
if( zRelay ){
618618
u32 smtpFlags = SMTP_DIRECT;
619619
if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
620
- p->pSmtp = smtp_session_new(p->zFrom, zRelay, smtpFlags);
620
+ p->pSmtp = smtp_session_new(domain_of_addr(p->zFrom), zRelay,
621
+ smtpFlags);
621622
smtp_client_startup(p->pSmtp);
622623
}
623624
}
624625
return p;
625626
}
626627
--- src/alerts.c
+++ src/alerts.c
@@ -19,11 +19,11 @@
19 **
20 ** Are you looking for the code that reads and writes the internet
21 ** email protocol? That is not here. See the "smtp.c" file instead.
22 ** Yes, the choice of source code filenames is not the greatest, but
23 ** it is not so bad that changing them seems justified.
24 */
25 #include "config.h"
26 #include "alerts.h"
27 #include <assert.h>
28 #include <time.h>
29
@@ -59,21 +59,21 @@
59 @ subscriberId INTEGER PRIMARY KEY, -- numeric subscriber ID. Internal use
60 @ subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE, -- UUID for subscriber
61 @ semail TEXT UNIQUE COLLATE nocase,-- email address
62 @ suname TEXT, -- corresponding USER entry
63 @ sverified BOOLEAN DEFAULT true, -- email address verified
64 @ sdonotcall BOOLEAN, -- true for Do Not Call
65 @ sdigest BOOLEAN, -- true for daily digests only
66 @ ssub TEXT, -- baseline subscriptions
67 @ sctime INTDATE, -- When this entry was created. unixtime
68 @ mtime INTDATE, -- Last change. unixtime
69 @ smip TEXT, -- IP address of last change
70 @ lastContact INT -- Last contact. days since 1970
71 @ );
72 @ CREATE INDEX repository.subscriberUname
73 @ ON subscriber(suname) WHERE suname IS NOT NULL;
74 @
75 @ DROP TABLE IF EXISTS repository.pending_alert;
76 @ -- Email notifications that need to be sent.
77 @ --
78 @ -- The first character of the eventid determines the event type.
79 @ -- Remaining characters determine the specific event. For example,
@@ -615,11 +615,12 @@
615 const char *zRelay = 0;
616 emailerGetSetting(p, &zRelay, "email-send-relayhost");
617 if( zRelay ){
618 u32 smtpFlags = SMTP_DIRECT;
619 if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
620 p->pSmtp = smtp_session_new(p->zFrom, zRelay, smtpFlags);
 
621 smtp_client_startup(p->pSmtp);
622 }
623 }
624 return p;
625 }
626
--- src/alerts.c
+++ src/alerts.c
@@ -19,11 +19,11 @@
19 **
20 ** Are you looking for the code that reads and writes the internet
21 ** email protocol? That is not here. See the "smtp.c" file instead.
22 ** Yes, the choice of source code filenames is not the greatest, but
23 ** it is not so bad that changing them seems justified.
24 */
25 #include "config.h"
26 #include "alerts.h"
27 #include <assert.h>
28 #include <time.h>
29
@@ -59,21 +59,21 @@
59 @ subscriberId INTEGER PRIMARY KEY, -- numeric subscriber ID. Internal use
60 @ subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE, -- UUID for subscriber
61 @ semail TEXT UNIQUE COLLATE nocase,-- email address
62 @ suname TEXT, -- corresponding USER entry
63 @ sverified BOOLEAN DEFAULT true, -- email address verified
64 @ sdonotcall BOOLEAN, -- true for Do Not Call
65 @ sdigest BOOLEAN, -- true for daily digests only
66 @ ssub TEXT, -- baseline subscriptions
67 @ sctime INTDATE, -- When this entry was created. unixtime
68 @ mtime INTDATE, -- Last change. unixtime
69 @ smip TEXT, -- IP address of last change
70 @ lastContact INT -- Last contact. days since 1970
71 @ );
72 @ CREATE INDEX repository.subscriberUname
73 @ ON subscriber(suname) WHERE suname IS NOT NULL;
74 @
75 @ DROP TABLE IF EXISTS repository.pending_alert;
76 @ -- Email notifications that need to be sent.
77 @ --
78 @ -- The first character of the eventid determines the event type.
79 @ -- Remaining characters determine the specific event. For example,
@@ -615,11 +615,12 @@
615 const char *zRelay = 0;
616 emailerGetSetting(p, &zRelay, "email-send-relayhost");
617 if( zRelay ){
618 u32 smtpFlags = SMTP_DIRECT;
619 if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
620 p->pSmtp = smtp_session_new(domain_of_addr(p->zFrom), zRelay,
621 smtpFlags);
622 smtp_client_startup(p->pSmtp);
623 }
624 }
625 return p;
626 }
627
+59 -29
--- src/backlink.c
+++ src/backlink.c
@@ -252,49 +252,79 @@
252252
253253
backlink_create(p, zTarget, nTarget);
254254
return 1;
255255
}
256256
257
-/* No-op routine for the rendering callbacks that we do not need */
258
-static void mkdn_noop0(Blob *x){ return; }
259
-static int mkdn_noop1(Blob *x){ return 1; }
257
+/* No-op routines for the rendering callbacks that we do not need */
258
+static void mkdn_noop_prolog(Blob *b, void *v){ return; }
259
+static void (*mkdn_noop_epilog)(Blob*, void*) = mkdn_noop_prolog;
260
+static void mkdn_noop_footnotes(Blob *b1, const Blob *b2, void *v){ return; }
261
+static void mkdn_noop_blockcode(Blob *b1, Blob *b2, void *v){ return; }
262
+static void (*mkdn_noop_blockquote)(Blob*, Blob*, void*) = mkdn_noop_blockcode;
263
+static void (*mkdn_noop_blockhtml)(Blob*, Blob*, void*) = mkdn_noop_blockcode;
264
+static void mkdn_noop_header(Blob *b1, Blob *b2, int i, void *v){ return; }
265
+static void (*mkdn_noop_hrule)(Blob*, void*) = mkdn_noop_prolog;
266
+static void (*mkdn_noop_list)(Blob*, Blob*, int, void*) = mkdn_noop_header;
267
+static void (*mkdn_noop_listitem)(Blob*, Blob*, int, void*) = mkdn_noop_header;
268
+static void (*mkdn_noop_paragraph)(Blob*, Blob*, void*) = mkdn_noop_blockcode;
269
+static void mkdn_noop_table(Blob *b1, Blob *b2, Blob *b3, void *v){ return; }
270
+static void (*mkdn_noop_table_cell)(Blob*, Blob*, int,
271
+ void*) = mkdn_noop_header;
272
+static void (*mkdn_noop_table_row)(Blob*, Blob*, int,
273
+ void*) = mkdn_noop_header;
274
+static void mkdn_noop_footnoteitm(Blob *b1, const Blob *b2, int i1, int i2,
275
+ void *v){ return; }
276
+static int mkdn_noop_autolink(Blob *b1, Blob *b2, enum mkd_autolink e,
277
+ void *v){ return 1; }
278
+static int mkdn_noop_codespan(Blob *b1, Blob *b2, int i, void *v){ return 1; }
279
+static int mkdn_noop_emphasis(Blob *b1, Blob *b2, char c, void *v){ return 1; }
280
+static int (*mkdn_noop_dbl_emphas)(Blob*, Blob*, char,
281
+ void*) = mkdn_noop_emphasis;
282
+static int mkdn_noop_image(Blob *b1, Blob *b2, Blob *b3, Blob *b4,
283
+ void *v){ return 1; }
284
+static int mkdn_noop_linebreak(Blob *b1, void *v){ return 1; }
285
+static int mkdn_noop_r_html_tag(Blob *b1, Blob *b2, void *v){ return 1; }
286
+static int (*mkdn_noop_tri_emphas)(Blob*, Blob*, char,
287
+ void*) = mkdn_noop_emphasis;
288
+static int mkdn_noop_footnoteref(Blob *b1, const Blob *b2, const Blob *b3,
289
+ int i1, int i2, void *v){ return 1; }
260290
261291
/*
262292
** Scan markdown text and add self-hyperlinks to the BACKLINK table.
263293
*/
264294
void markdown_extract_links(
265295
char *zInputText,
266296
Backlink *p
267297
){
268298
struct mkd_renderer html_renderer = {
269
- /* prolog */ (void(*)(Blob*,void*))mkdn_noop0,
270
- /* epilog */ (void(*)(Blob*,void*))mkdn_noop0,
271
- /* footnotes */ (void(*)(Blob*,const Blob*, void*))mkdn_noop0,
272
-
273
- /* blockcode */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
274
- /* blockquote */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
275
- /* blockhtml */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
276
- /* header */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
277
- /* hrule */ (void(*)(Blob*,void*))mkdn_noop0,
278
- /* list */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
279
- /* listitem */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
280
- /* paragraph */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
281
- /* table */ (void(*)(Blob*,Blob*,Blob*,void*))mkdn_noop0,
282
- /* table_cell */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
283
- /* table_row */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
284
- /* footnoteitm*/ (void(*)(Blob*,const Blob*,int,int,void*))mkdn_noop0,
285
-
286
- /* autolink */ (int(*)(Blob*,Blob*,enum mkd_autolink,void*))mkdn_noop1,
287
- /* codespan */ (int(*)(Blob*,Blob*,int,void*))mkdn_noop1,
288
- /* dbl_emphas */ (int(*)(Blob*,Blob*,char,void*))mkdn_noop1,
289
- /* emphasis */ (int(*)(Blob*,Blob*,char,void*))mkdn_noop1,
290
- /* image */ (int(*)(Blob*,Blob*,Blob*,Blob*,void*))mkdn_noop1,
291
- /* linebreak */ (int(*)(Blob*,void*))mkdn_noop1,
299
+ /* prolog */ mkdn_noop_prolog,
300
+ /* epilog */ mkdn_noop_epilog,
301
+ /* footnotes */ mkdn_noop_footnotes,
302
+
303
+ /* blockcode */ mkdn_noop_blockcode,
304
+ /* blockquote */ mkdn_noop_blockquote,
305
+ /* blockhtml */ mkdn_noop_blockhtml,
306
+ /* header */ mkdn_noop_header,
307
+ /* hrule */ mkdn_noop_hrule,
308
+ /* list */ mkdn_noop_list,
309
+ /* listitem */ mkdn_noop_listitem,
310
+ /* paragraph */ mkdn_noop_paragraph,
311
+ /* table */ mkdn_noop_table,
312
+ /* table_cell */ mkdn_noop_table_cell,
313
+ /* table_row */ mkdn_noop_table_row,
314
+ /* footnoteitm*/ mkdn_noop_footnoteitm,
315
+
316
+ /* autolink */ mkdn_noop_autolink,
317
+ /* codespan */ mkdn_noop_codespan,
318
+ /* dbl_emphas */ mkdn_noop_dbl_emphas,
319
+ /* emphasis */ mkdn_noop_emphasis,
320
+ /* image */ mkdn_noop_image,
321
+ /* linebreak */ mkdn_noop_linebreak,
292322
/* link */ backlink_md_link,
293
- /* r_html_tag */ (int(*)(Blob*,Blob*,void*))mkdn_noop1,
294
- /* tri_emphas */ (int(*)(Blob*,Blob*,char,void*))mkdn_noop1,
295
- /* footnoteref*/ (int(*)(Blob*,const Blob*,const Blob*,int,int,void*))mkdn_noop1,
323
+ /* r_html_tag */ mkdn_noop_r_html_tag,
324
+ /* tri_emphas */ mkdn_noop_tri_emphas,
325
+ /* footnoteref*/ mkdn_noop_footnoteref,
296326
297327
0, /* entity */
298328
0, /* normal_text */
299329
"*_", /* emphasis characters */
300330
0 /* client data */
301331
--- src/backlink.c
+++ src/backlink.c
@@ -252,49 +252,79 @@
252
253 backlink_create(p, zTarget, nTarget);
254 return 1;
255 }
256
257 /* No-op routine for the rendering callbacks that we do not need */
258 static void mkdn_noop0(Blob *x){ return; }
259 static int mkdn_noop1(Blob *x){ return 1; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
261 /*
262 ** Scan markdown text and add self-hyperlinks to the BACKLINK table.
263 */
264 void markdown_extract_links(
265 char *zInputText,
266 Backlink *p
267 ){
268 struct mkd_renderer html_renderer = {
269 /* prolog */ (void(*)(Blob*,void*))mkdn_noop0,
270 /* epilog */ (void(*)(Blob*,void*))mkdn_noop0,
271 /* footnotes */ (void(*)(Blob*,const Blob*, void*))mkdn_noop0,
272
273 /* blockcode */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
274 /* blockquote */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
275 /* blockhtml */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
276 /* header */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
277 /* hrule */ (void(*)(Blob*,void*))mkdn_noop0,
278 /* list */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
279 /* listitem */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
280 /* paragraph */ (void(*)(Blob*,Blob*,void*))mkdn_noop0,
281 /* table */ (void(*)(Blob*,Blob*,Blob*,void*))mkdn_noop0,
282 /* table_cell */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
283 /* table_row */ (void(*)(Blob*,Blob*,int,void*))mkdn_noop0,
284 /* footnoteitm*/ (void(*)(Blob*,const Blob*,int,int,void*))mkdn_noop0,
285
286 /* autolink */ (int(*)(Blob*,Blob*,enum mkd_autolink,void*))mkdn_noop1,
287 /* codespan */ (int(*)(Blob*,Blob*,int,void*))mkdn_noop1,
288 /* dbl_emphas */ (int(*)(Blob*,Blob*,char,void*))mkdn_noop1,
289 /* emphasis */ (int(*)(Blob*,Blob*,char,void*))mkdn_noop1,
290 /* image */ (int(*)(Blob*,Blob*,Blob*,Blob*,void*))mkdn_noop1,
291 /* linebreak */ (int(*)(Blob*,void*))mkdn_noop1,
292 /* link */ backlink_md_link,
293 /* r_html_tag */ (int(*)(Blob*,Blob*,void*))mkdn_noop1,
294 /* tri_emphas */ (int(*)(Blob*,Blob*,char,void*))mkdn_noop1,
295 /* footnoteref*/ (int(*)(Blob*,const Blob*,const Blob*,int,int,void*))mkdn_noop1,
296
297 0, /* entity */
298 0, /* normal_text */
299 "*_", /* emphasis characters */
300 0 /* client data */
301
--- src/backlink.c
+++ src/backlink.c
@@ -252,49 +252,79 @@
252
253 backlink_create(p, zTarget, nTarget);
254 return 1;
255 }
256
257 /* No-op routines for the rendering callbacks that we do not need */
258 static void mkdn_noop_prolog(Blob *b, void *v){ return; }
259 static void (*mkdn_noop_epilog)(Blob*, void*) = mkdn_noop_prolog;
260 static void mkdn_noop_footnotes(Blob *b1, const Blob *b2, void *v){ return; }
261 static void mkdn_noop_blockcode(Blob *b1, Blob *b2, void *v){ return; }
262 static void (*mkdn_noop_blockquote)(Blob*, Blob*, void*) = mkdn_noop_blockcode;
263 static void (*mkdn_noop_blockhtml)(Blob*, Blob*, void*) = mkdn_noop_blockcode;
264 static void mkdn_noop_header(Blob *b1, Blob *b2, int i, void *v){ return; }
265 static void (*mkdn_noop_hrule)(Blob*, void*) = mkdn_noop_prolog;
266 static void (*mkdn_noop_list)(Blob*, Blob*, int, void*) = mkdn_noop_header;
267 static void (*mkdn_noop_listitem)(Blob*, Blob*, int, void*) = mkdn_noop_header;
268 static void (*mkdn_noop_paragraph)(Blob*, Blob*, void*) = mkdn_noop_blockcode;
269 static void mkdn_noop_table(Blob *b1, Blob *b2, Blob *b3, void *v){ return; }
270 static void (*mkdn_noop_table_cell)(Blob*, Blob*, int,
271 void*) = mkdn_noop_header;
272 static void (*mkdn_noop_table_row)(Blob*, Blob*, int,
273 void*) = mkdn_noop_header;
274 static void mkdn_noop_footnoteitm(Blob *b1, const Blob *b2, int i1, int i2,
275 void *v){ return; }
276 static int mkdn_noop_autolink(Blob *b1, Blob *b2, enum mkd_autolink e,
277 void *v){ return 1; }
278 static int mkdn_noop_codespan(Blob *b1, Blob *b2, int i, void *v){ return 1; }
279 static int mkdn_noop_emphasis(Blob *b1, Blob *b2, char c, void *v){ return 1; }
280 static int (*mkdn_noop_dbl_emphas)(Blob*, Blob*, char,
281 void*) = mkdn_noop_emphasis;
282 static int mkdn_noop_image(Blob *b1, Blob *b2, Blob *b3, Blob *b4,
283 void *v){ return 1; }
284 static int mkdn_noop_linebreak(Blob *b1, void *v){ return 1; }
285 static int mkdn_noop_r_html_tag(Blob *b1, Blob *b2, void *v){ return 1; }
286 static int (*mkdn_noop_tri_emphas)(Blob*, Blob*, char,
287 void*) = mkdn_noop_emphasis;
288 static int mkdn_noop_footnoteref(Blob *b1, const Blob *b2, const Blob *b3,
289 int i1, int i2, void *v){ return 1; }
290
291 /*
292 ** Scan markdown text and add self-hyperlinks to the BACKLINK table.
293 */
294 void markdown_extract_links(
295 char *zInputText,
296 Backlink *p
297 ){
298 struct mkd_renderer html_renderer = {
299 /* prolog */ mkdn_noop_prolog,
300 /* epilog */ mkdn_noop_epilog,
301 /* footnotes */ mkdn_noop_footnotes,
302
303 /* blockcode */ mkdn_noop_blockcode,
304 /* blockquote */ mkdn_noop_blockquote,
305 /* blockhtml */ mkdn_noop_blockhtml,
306 /* header */ mkdn_noop_header,
307 /* hrule */ mkdn_noop_hrule,
308 /* list */ mkdn_noop_list,
309 /* listitem */ mkdn_noop_listitem,
310 /* paragraph */ mkdn_noop_paragraph,
311 /* table */ mkdn_noop_table,
312 /* table_cell */ mkdn_noop_table_cell,
313 /* table_row */ mkdn_noop_table_row,
314 /* footnoteitm*/ mkdn_noop_footnoteitm,
315
316 /* autolink */ mkdn_noop_autolink,
317 /* codespan */ mkdn_noop_codespan,
318 /* dbl_emphas */ mkdn_noop_dbl_emphas,
319 /* emphasis */ mkdn_noop_emphasis,
320 /* image */ mkdn_noop_image,
321 /* linebreak */ mkdn_noop_linebreak,
322 /* link */ backlink_md_link,
323 /* r_html_tag */ mkdn_noop_r_html_tag,
324 /* tri_emphas */ mkdn_noop_tri_emphas,
325 /* footnoteref*/ mkdn_noop_footnoteref,
326
327 0, /* entity */
328 0, /* normal_text */
329 "*_", /* emphasis characters */
330 0 /* client data */
331
--- 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/db.c
+++ src/db.c
@@ -2728,11 +2728,11 @@
27282728
" WHERE login=%Q", fossil_random_password(10), zUser
27292729
);
27302730
if( !setupUserOnly ){
27312731
db_multi_exec(
27322732
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
2733
- " VALUES('anonymous',hex(randomblob(8)),'hmnc','Anon');"
2733
+ " VALUES('anonymous',hex(randomblob(8)),'hz','Anon');"
27342734
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
27352735
" VALUES('nobody','','gjorz','Nobody');"
27362736
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
27372737
" VALUES('developer','','ei','Dev');"
27382738
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
27392739
--- src/db.c
+++ src/db.c
@@ -2728,11 +2728,11 @@
2728 " WHERE login=%Q", fossil_random_password(10), zUser
2729 );
2730 if( !setupUserOnly ){
2731 db_multi_exec(
2732 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2733 " VALUES('anonymous',hex(randomblob(8)),'hmnc','Anon');"
2734 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2735 " VALUES('nobody','','gjorz','Nobody');"
2736 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2737 " VALUES('developer','','ei','Dev');"
2738 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2739
--- src/db.c
+++ src/db.c
@@ -2728,11 +2728,11 @@
2728 " WHERE login=%Q", fossil_random_password(10), zUser
2729 );
2730 if( !setupUserOnly ){
2731 db_multi_exec(
2732 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2733 " VALUES('anonymous',hex(randomblob(8)),'hz','Anon');"
2734 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2735 " VALUES('nobody','','gjorz','Nobody');"
2736 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2737 " VALUES('developer','','ei','Dev');"
2738 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2739
+1 -1
--- src/db.c
+++ src/db.c
@@ -2728,11 +2728,11 @@
27282728
" WHERE login=%Q", fossil_random_password(10), zUser
27292729
);
27302730
if( !setupUserOnly ){
27312731
db_multi_exec(
27322732
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
2733
- " VALUES('anonymous',hex(randomblob(8)),'hmnc','Anon');"
2733
+ " VALUES('anonymous',hex(randomblob(8)),'hz','Anon');"
27342734
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
27352735
" VALUES('nobody','','gjorz','Nobody');"
27362736
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
27372737
" VALUES('developer','','ei','Dev');"
27382738
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
27392739
--- src/db.c
+++ src/db.c
@@ -2728,11 +2728,11 @@
2728 " WHERE login=%Q", fossil_random_password(10), zUser
2729 );
2730 if( !setupUserOnly ){
2731 db_multi_exec(
2732 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2733 " VALUES('anonymous',hex(randomblob(8)),'hmnc','Anon');"
2734 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2735 " VALUES('nobody','','gjorz','Nobody');"
2736 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2737 " VALUES('developer','','ei','Dev');"
2738 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2739
--- src/db.c
+++ src/db.c
@@ -2728,11 +2728,11 @@
2728 " WHERE login=%Q", fossil_random_password(10), zUser
2729 );
2730 if( !setupUserOnly ){
2731 db_multi_exec(
2732 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2733 " VALUES('anonymous',hex(randomblob(8)),'hz','Anon');"
2734 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2735 " VALUES('nobody','','gjorz','Nobody');"
2736 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2737 " VALUES('developer','','ei','Dev');"
2738 "INSERT OR IGNORE INTO user(login,pw,cap,info)"
2739
+3 -3
--- src/diff.c
+++ src/diff.c
@@ -2886,12 +2886,12 @@
28862886
*/
28872887
int diff_context_lines(DiffConfig *pCfg){
28882888
const int dflt = 5;
28892889
if(pCfg!=0){
28902890
int n = pCfg->nContext;
2891
- if( n<=0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892
- return n;
2891
+ if( n==0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892
+ return n<0 ? 0x7ffffff : n;
28932893
}else{
28942894
return dflt;
28952895
}
28962896
}
28972897
@@ -3147,11 +3147,11 @@
31473147
/* Undocumented and unsupported flags used for development
31483148
** debugging and analysis: */
31493149
if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
31503150
if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
31513151
}
3152
- if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
3152
+ if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){
31533153
pCfg->nContext = f;
31543154
diffFlags |= DIFF_CONTEXT_EX;
31553155
}
31563156
if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
31573157
pCfg->wColumn = f;
31583158
--- src/diff.c
+++ src/diff.c
@@ -2886,12 +2886,12 @@
2886 */
2887 int diff_context_lines(DiffConfig *pCfg){
2888 const int dflt = 5;
2889 if(pCfg!=0){
2890 int n = pCfg->nContext;
2891 if( n<=0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892 return n;
2893 }else{
2894 return dflt;
2895 }
2896 }
2897
@@ -3147,11 +3147,11 @@
3147 /* Undocumented and unsupported flags used for development
3148 ** debugging and analysis: */
3149 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3150 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3151 }
3152 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
3153 pCfg->nContext = f;
3154 diffFlags |= DIFF_CONTEXT_EX;
3155 }
3156 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
3157 pCfg->wColumn = f;
3158
--- src/diff.c
+++ src/diff.c
@@ -2886,12 +2886,12 @@
2886 */
2887 int diff_context_lines(DiffConfig *pCfg){
2888 const int dflt = 5;
2889 if(pCfg!=0){
2890 int n = pCfg->nContext;
2891 if( n==0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892 return n<0 ? 0x7ffffff : n;
2893 }else{
2894 return dflt;
2895 }
2896 }
2897
@@ -3147,11 +3147,11 @@
3147 /* Undocumented and unsupported flags used for development
3148 ** debugging and analysis: */
3149 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3150 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3151 }
3152 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){
3153 pCfg->nContext = f;
3154 diffFlags |= DIFF_CONTEXT_EX;
3155 }
3156 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
3157 pCfg->wColumn = f;
3158
+3 -2
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -368,11 +368,11 @@
368368
if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
369369
tempDiffFilename = fossil_temp_filename();
370370
tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
371371
diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
372372
if( diffOut==0 ){
373
- fossil_fatal("unable to create temporary file \"%s\"",
373
+ fossil_fatal("unable to create temporary file \"%s\"",
374374
tempDiffFilename);
375375
}
376376
#ifndef _WIN32
377377
signal(SIGINT, diff_www_interrupt);
378378
#else
@@ -1076,11 +1076,12 @@
10761076
** --brief Show filenames only
10771077
** -b|--browser Show the diff output in a web-browser
10781078
** --by Shorthand for "--browser -y"
10791079
** -ci|--checkin VERSION Show diff of all changes in VERSION
10801080
** --command PROG External diff program. Overrides "diff-command"
1081
-** -c|--context N Show N lines of context around each change
1081
+** -c|--context N Show N lines of context around each change, with
1082
+** negative N meaning show all content
10821083
** --diff-binary BOOL Include binary files with external commands
10831084
** --exec-abs-paths Force absolute path names on external commands
10841085
** --exec-rel-paths Force relative path names on external commands
10851086
** -r|--from VERSION Select VERSION as source for the diff
10861087
** -w|--ignore-all-space Ignore white space when comparing lines
10871088
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -368,11 +368,11 @@
368 if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
369 tempDiffFilename = fossil_temp_filename();
370 tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
371 diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
372 if( diffOut==0 ){
373 fossil_fatal("unable to create temporary file \"%s\"",
374 tempDiffFilename);
375 }
376 #ifndef _WIN32
377 signal(SIGINT, diff_www_interrupt);
378 #else
@@ -1076,11 +1076,12 @@
1076 ** --brief Show filenames only
1077 ** -b|--browser Show the diff output in a web-browser
1078 ** --by Shorthand for "--browser -y"
1079 ** -ci|--checkin VERSION Show diff of all changes in VERSION
1080 ** --command PROG External diff program. Overrides "diff-command"
1081 ** -c|--context N Show N lines of context around each change
 
1082 ** --diff-binary BOOL Include binary files with external commands
1083 ** --exec-abs-paths Force absolute path names on external commands
1084 ** --exec-rel-paths Force relative path names on external commands
1085 ** -r|--from VERSION Select VERSION as source for the diff
1086 ** -w|--ignore-all-space Ignore white space when comparing lines
1087
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -368,11 +368,11 @@
368 if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
369 tempDiffFilename = fossil_temp_filename();
370 tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
371 diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
372 if( diffOut==0 ){
373 fossil_fatal("unable to create temporary file \"%s\"",
374 tempDiffFilename);
375 }
376 #ifndef _WIN32
377 signal(SIGINT, diff_www_interrupt);
378 #else
@@ -1076,11 +1076,12 @@
1076 ** --brief Show filenames only
1077 ** -b|--browser Show the diff output in a web-browser
1078 ** --by Shorthand for "--browser -y"
1079 ** -ci|--checkin VERSION Show diff of all changes in VERSION
1080 ** --command PROG External diff program. Overrides "diff-command"
1081 ** -c|--context N Show N lines of context around each change, with
1082 ** negative N meaning show all content
1083 ** --diff-binary BOOL Include binary files with external commands
1084 ** --exec-abs-paths Force absolute path names on external commands
1085 ** --exec-rel-paths Force relative path names on external commands
1086 ** -r|--from VERSION Select VERSION as source for the diff
1087 ** -w|--ignore-all-space Ignore white space when comparing lines
1088
+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
--- src/file.c
+++ src/file.c
@@ -59,10 +59,11 @@
5959
** RepoFILE Like SymFILE if allow-symlinks is true, or like
6060
** ExtFILE if allow-symlinks is false. In other words,
6161
** symbolic links are only recognized as something different
6262
** from files or directories if allow-symlinks is true.
6363
*/
64
+#include <stdlib.h>
6465
#define ExtFILE 0 /* Always follow symlinks */
6566
#define RepoFILE 1 /* Follow symlinks if and only if allow-symlinks is OFF */
6667
#define SymFILE 2 /* Never follow symlinks */
6768
6869
#include <dirent.h>
6970
--- src/file.c
+++ src/file.c
@@ -59,10 +59,11 @@
59 ** RepoFILE Like SymFILE if allow-symlinks is true, or like
60 ** ExtFILE if allow-symlinks is false. In other words,
61 ** symbolic links are only recognized as something different
62 ** from files or directories if allow-symlinks is true.
63 */
 
64 #define ExtFILE 0 /* Always follow symlinks */
65 #define RepoFILE 1 /* Follow symlinks if and only if allow-symlinks is OFF */
66 #define SymFILE 2 /* Never follow symlinks */
67
68 #include <dirent.h>
69
--- src/file.c
+++ src/file.c
@@ -59,10 +59,11 @@
59 ** RepoFILE Like SymFILE if allow-symlinks is true, or like
60 ** ExtFILE if allow-symlinks is false. In other words,
61 ** symbolic links are only recognized as something different
62 ** from files or directories if allow-symlinks is true.
63 */
64 #include <stdlib.h>
65 #define ExtFILE 0 /* Always follow symlinks */
66 #define RepoFILE 1 /* Follow symlinks if and only if allow-symlinks is OFF */
67 #define SymFILE 2 /* Never follow symlinks */
68
69 #include <dirent.h>
70
+14 -3
--- src/finfo.c
+++ src/finfo.c
@@ -272,30 +272,41 @@
272272
** Print on standard output the content of one or more files as they exist
273273
** in the repository. The version currently checked out is shown by default.
274274
** Other versions may be specified using the -r option.
275275
**
276276
** Options:
277
-** -R|--repository REPO Extract artifacts from repository REPO
278
-** -r VERSION The specific check-in containing the file
277
+** -o|--out OUTFILE For exactly one given FILENAME, write to OUTFILE
278
+** -R|--repository REPO Extract artifacts from repository REPO
279
+** -r VERSION The specific check-in containing the file
279280
**
280281
** See also: [[finfo]]
281282
*/
282283
void cat_cmd(void){
283284
int i;
284285
Blob content, fname;
285286
const char *zRev;
287
+ const char *zFileName;
286288
db_find_and_open_repository(0, 0);
287289
zRev = find_option("r","r",1);
290
+ zFileName = find_option("out","o",1);
288291
289292
/* We should be done with options.. */
290293
verify_all_options();
294
+
295
+ if ( zFileName && g.argc>3 ){
296
+ fossil_fatal("output file can only be given when retrieving a single file");
297
+ }
291298
292299
for(i=2; i<g.argc; i++){
293300
file_tree_name(g.argv[i], &fname, 0, 1);
294301
blob_zero(&content);
295302
historical_blob(zRev, blob_str(&fname), &content, 1);
296
- blob_write_to_file(&content, "-");
303
+ if ( g.argc==3 && zFileName ){
304
+ blob_write_to_file(&content, zFileName);
305
+ }else{
306
+ blob_write_to_file(&content, "-");
307
+ }
297308
blob_reset(&fname);
298309
blob_reset(&content);
299310
}
300311
}
301312
302313
--- src/finfo.c
+++ src/finfo.c
@@ -272,30 +272,41 @@
272 ** Print on standard output the content of one or more files as they exist
273 ** in the repository. The version currently checked out is shown by default.
274 ** Other versions may be specified using the -r option.
275 **
276 ** Options:
277 ** -R|--repository REPO Extract artifacts from repository REPO
278 ** -r VERSION The specific check-in containing the file
 
279 **
280 ** See also: [[finfo]]
281 */
282 void cat_cmd(void){
283 int i;
284 Blob content, fname;
285 const char *zRev;
 
286 db_find_and_open_repository(0, 0);
287 zRev = find_option("r","r",1);
 
288
289 /* We should be done with options.. */
290 verify_all_options();
 
 
 
 
291
292 for(i=2; i<g.argc; i++){
293 file_tree_name(g.argv[i], &fname, 0, 1);
294 blob_zero(&content);
295 historical_blob(zRev, blob_str(&fname), &content, 1);
296 blob_write_to_file(&content, "-");
 
 
 
 
297 blob_reset(&fname);
298 blob_reset(&content);
299 }
300 }
301
302
--- src/finfo.c
+++ src/finfo.c
@@ -272,30 +272,41 @@
272 ** Print on standard output the content of one or more files as they exist
273 ** in the repository. The version currently checked out is shown by default.
274 ** Other versions may be specified using the -r option.
275 **
276 ** Options:
277 ** -o|--out OUTFILE For exactly one given FILENAME, write to OUTFILE
278 ** -R|--repository REPO Extract artifacts from repository REPO
279 ** -r VERSION The specific check-in containing the file
280 **
281 ** See also: [[finfo]]
282 */
283 void cat_cmd(void){
284 int i;
285 Blob content, fname;
286 const char *zRev;
287 const char *zFileName;
288 db_find_and_open_repository(0, 0);
289 zRev = find_option("r","r",1);
290 zFileName = find_option("out","o",1);
291
292 /* We should be done with options.. */
293 verify_all_options();
294
295 if ( zFileName && g.argc>3 ){
296 fossil_fatal("output file can only be given when retrieving a single file");
297 }
298
299 for(i=2; i<g.argc; i++){
300 file_tree_name(g.argv[i], &fname, 0, 1);
301 blob_zero(&content);
302 historical_blob(zRev, blob_str(&fname), &content, 1);
303 if ( g.argc==3 && zFileName ){
304 blob_write_to_file(&content, zFileName);
305 }else{
306 blob_write_to_file(&content, "-");
307 }
308 blob_reset(&fname);
309 blob_reset(&content);
310 }
311 }
312
313
+17 -2
--- src/forum.c
+++ src/forum.c
@@ -1704,13 +1704,15 @@
17041704
** x=X Skip the first X threads
17051705
** s=Y Search for term Y.
17061706
*/
17071707
void forum_main_page(void){
17081708
Stmt q;
1709
- int iLimit, iOfst, iCnt;
1709
+ int iLimit = 0, iOfst, iCnt;
17101710
int srchFlags;
17111711
const int isSearch = P("s")!=0;
1712
+ char const *zLimit = 0;
1713
+
17121714
login_check_credentials();
17131715
srchFlags = search_restrict(SRCH_FORUM);
17141716
if( !g.perm.RdForum ){
17151717
login_needed(g.anon.RdForum);
17161718
return;
@@ -1735,11 +1737,24 @@
17351737
style_submenu_element("Recent Threads","%R/forum");
17361738
style_finish_page();
17371739
return;
17381740
}
17391741
}
1740
- iLimit = atoi(PD("n","25"));
1742
+ cookie_read_parameter("n","forum-n");
1743
+ zLimit = P("n");
1744
+ if( zLimit!=0 ){
1745
+ iLimit = atoi(zLimit);
1746
+ if( iLimit>=0 && P("udc")!=0 ){
1747
+ cookie_write_parameter("n","forum-n",0);
1748
+ }
1749
+ }
1750
+ if( iLimit<=0 ){
1751
+ cgi_replace_query_parameter("n", fossil_strdup("25"))
1752
+ /*for the sake of Max, below*/;
1753
+ iLimit = 25;
1754
+ }
1755
+ style_submenu_entry("n","Max:",4,0);
17411756
iOfst = atoi(PD("x","0"));
17421757
iCnt = 0;
17431758
if( db_table_exists("repository","forumpost") ){
17441759
db_prepare(&q,
17451760
"WITH thread(age,duration,cnt,root,last) AS ("
17461761
--- src/forum.c
+++ src/forum.c
@@ -1704,13 +1704,15 @@
1704 ** x=X Skip the first X threads
1705 ** s=Y Search for term Y.
1706 */
1707 void forum_main_page(void){
1708 Stmt q;
1709 int iLimit, iOfst, iCnt;
1710 int srchFlags;
1711 const int isSearch = P("s")!=0;
 
 
1712 login_check_credentials();
1713 srchFlags = search_restrict(SRCH_FORUM);
1714 if( !g.perm.RdForum ){
1715 login_needed(g.anon.RdForum);
1716 return;
@@ -1735,11 +1737,24 @@
1735 style_submenu_element("Recent Threads","%R/forum");
1736 style_finish_page();
1737 return;
1738 }
1739 }
1740 iLimit = atoi(PD("n","25"));
 
 
 
 
 
 
 
 
 
 
 
 
 
1741 iOfst = atoi(PD("x","0"));
1742 iCnt = 0;
1743 if( db_table_exists("repository","forumpost") ){
1744 db_prepare(&q,
1745 "WITH thread(age,duration,cnt,root,last) AS ("
1746
--- src/forum.c
+++ src/forum.c
@@ -1704,13 +1704,15 @@
1704 ** x=X Skip the first X threads
1705 ** s=Y Search for term Y.
1706 */
1707 void forum_main_page(void){
1708 Stmt q;
1709 int iLimit = 0, iOfst, iCnt;
1710 int srchFlags;
1711 const int isSearch = P("s")!=0;
1712 char const *zLimit = 0;
1713
1714 login_check_credentials();
1715 srchFlags = search_restrict(SRCH_FORUM);
1716 if( !g.perm.RdForum ){
1717 login_needed(g.anon.RdForum);
1718 return;
@@ -1735,11 +1737,24 @@
1737 style_submenu_element("Recent Threads","%R/forum");
1738 style_finish_page();
1739 return;
1740 }
1741 }
1742 cookie_read_parameter("n","forum-n");
1743 zLimit = P("n");
1744 if( zLimit!=0 ){
1745 iLimit = atoi(zLimit);
1746 if( iLimit>=0 && P("udc")!=0 ){
1747 cookie_write_parameter("n","forum-n",0);
1748 }
1749 }
1750 if( iLimit<=0 ){
1751 cgi_replace_query_parameter("n", fossil_strdup("25"))
1752 /*for the sake of Max, below*/;
1753 iLimit = 25;
1754 }
1755 style_submenu_entry("n","Max:",4,0);
1756 iOfst = atoi(PD("x","0"));
1757 iCnt = 0;
1758 if( db_table_exists("repository","forumpost") ){
1759 db_prepare(&q,
1760 "WITH thread(age,duration,cnt,root,last) AS ("
1761
+17 -2
--- src/forum.c
+++ src/forum.c
@@ -1704,13 +1704,15 @@
17041704
** x=X Skip the first X threads
17051705
** s=Y Search for term Y.
17061706
*/
17071707
void forum_main_page(void){
17081708
Stmt q;
1709
- int iLimit, iOfst, iCnt;
1709
+ int iLimit = 0, iOfst, iCnt;
17101710
int srchFlags;
17111711
const int isSearch = P("s")!=0;
1712
+ char const *zLimit = 0;
1713
+
17121714
login_check_credentials();
17131715
srchFlags = search_restrict(SRCH_FORUM);
17141716
if( !g.perm.RdForum ){
17151717
login_needed(g.anon.RdForum);
17161718
return;
@@ -1735,11 +1737,24 @@
17351737
style_submenu_element("Recent Threads","%R/forum");
17361738
style_finish_page();
17371739
return;
17381740
}
17391741
}
1740
- iLimit = atoi(PD("n","25"));
1742
+ cookie_read_parameter("n","forum-n");
1743
+ zLimit = P("n");
1744
+ if( zLimit!=0 ){
1745
+ iLimit = atoi(zLimit);
1746
+ if( iLimit>=0 && P("udc")!=0 ){
1747
+ cookie_write_parameter("n","forum-n",0);
1748
+ }
1749
+ }
1750
+ if( iLimit<=0 ){
1751
+ cgi_replace_query_parameter("n", fossil_strdup("25"))
1752
+ /*for the sake of Max, below*/;
1753
+ iLimit = 25;
1754
+ }
1755
+ style_submenu_entry("n","Max:",4,0);
17411756
iOfst = atoi(PD("x","0"));
17421757
iCnt = 0;
17431758
if( db_table_exists("repository","forumpost") ){
17441759
db_prepare(&q,
17451760
"WITH thread(age,duration,cnt,root,last) AS ("
17461761
--- src/forum.c
+++ src/forum.c
@@ -1704,13 +1704,15 @@
1704 ** x=X Skip the first X threads
1705 ** s=Y Search for term Y.
1706 */
1707 void forum_main_page(void){
1708 Stmt q;
1709 int iLimit, iOfst, iCnt;
1710 int srchFlags;
1711 const int isSearch = P("s")!=0;
 
 
1712 login_check_credentials();
1713 srchFlags = search_restrict(SRCH_FORUM);
1714 if( !g.perm.RdForum ){
1715 login_needed(g.anon.RdForum);
1716 return;
@@ -1735,11 +1737,24 @@
1735 style_submenu_element("Recent Threads","%R/forum");
1736 style_finish_page();
1737 return;
1738 }
1739 }
1740 iLimit = atoi(PD("n","25"));
 
 
 
 
 
 
 
 
 
 
 
 
 
1741 iOfst = atoi(PD("x","0"));
1742 iCnt = 0;
1743 if( db_table_exists("repository","forumpost") ){
1744 db_prepare(&q,
1745 "WITH thread(age,duration,cnt,root,last) AS ("
1746
--- src/forum.c
+++ src/forum.c
@@ -1704,13 +1704,15 @@
1704 ** x=X Skip the first X threads
1705 ** s=Y Search for term Y.
1706 */
1707 void forum_main_page(void){
1708 Stmt q;
1709 int iLimit = 0, iOfst, iCnt;
1710 int srchFlags;
1711 const int isSearch = P("s")!=0;
1712 char const *zLimit = 0;
1713
1714 login_check_credentials();
1715 srchFlags = search_restrict(SRCH_FORUM);
1716 if( !g.perm.RdForum ){
1717 login_needed(g.anon.RdForum);
1718 return;
@@ -1735,11 +1737,24 @@
1737 style_submenu_element("Recent Threads","%R/forum");
1738 style_finish_page();
1739 return;
1740 }
1741 }
1742 cookie_read_parameter("n","forum-n");
1743 zLimit = P("n");
1744 if( zLimit!=0 ){
1745 iLimit = atoi(zLimit);
1746 if( iLimit>=0 && P("udc")!=0 ){
1747 cookie_write_parameter("n","forum-n",0);
1748 }
1749 }
1750 if( iLimit<=0 ){
1751 cgi_replace_query_parameter("n", fossil_strdup("25"))
1752 /*for the sake of Max, below*/;
1753 iLimit = 25;
1754 }
1755 style_submenu_entry("n","Max:",4,0);
1756 iOfst = atoi(PD("x","0"));
1757 iCnt = 0;
1758 if( db_table_exists("repository","forumpost") ){
1759 db_prepare(&q,
1760 "WITH thread(age,duration,cnt,root,last) AS ("
1761
+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
+9 -2
--- src/main.c
+++ src/main.c
@@ -136,10 +136,11 @@
136136
};
137137
#endif
138138
139139
struct Global {
140140
int argc; char **argv; /* Command-line arguments to the program */
141
+ char **argvOrig; /* Original g.argv prior to removing options */
141142
char *nameOfExe; /* Full path of executable. */
142143
const char *zErrlog; /* Log errors to this file, if not NULL */
143144
const char *zPhase; /* Phase of operation, for use by the error log
144145
** and for deriving $canonical_page TH1 variable */
145146
int isConst; /* True if the output is unchanging & cacheable */
@@ -444,11 +445,15 @@
444445
** introduces some weird corner cases, as covered in forum thread
445446
** 4382bbc66757c39f. e.g. (fossil -U -- --args ...) is handled
446447
** differently when we stop at "--" here. */
447448
if( fossil_strcmp(z, "args")==0 ) break;
448449
}
449
- if( (int)i>=g.argc-1 ) return;
450
+ if( (int)i>=g.argc-1 ){
451
+ g.argvOrig = fossil_malloc( sizeof(char*)*(g.argc+1) );
452
+ memcpy(g.argvOrig, g.argv, sizeof(g.argv[0])*(g.argc+1));
453
+ return;
454
+ }
450455
451456
zFileName = g.argv[i+1];
452457
if( strcmp(zFileName,"-")==0 ){
453458
inFile = stdin;
454459
}else if( !file_isfile(zFileName, ExtFILE) ){
@@ -467,11 +472,11 @@
467472
blob_to_utf8_no_bom(&file, 1);
468473
z = blob_str(&file);
469474
for(k=0, nLine=1; z[k]; k++) if( z[k]=='\n' ) nLine++;
470475
if( nLine>100000000 ) fossil_fatal("too many command-line arguments");
471476
nArg = g.argc + nLine*2;
472
- newArgv = fossil_malloc( sizeof(char*)*nArg );
477
+ newArgv = fossil_malloc( sizeof(char*)*nArg*2 + 2);
473478
for(j=0; j<i; j++) newArgv[j] = g.argv[j];
474479
475480
blob_rewind(&file);
476481
while( nLine-->0 && (n = blob_line(&file, &line))>0 ){
477482
/* Reminder: ^^^ nLine check avoids that embedded NUL bytes in the
@@ -510,10 +515,12 @@
510515
i += 2;
511516
while( (int)i<g.argc ) newArgv[j++] = g.argv[i++];
512517
newArgv[j] = 0;
513518
g.argc = j;
514519
g.argv = newArgv;
520
+ g.argvOrig = &g.argv[j+1];
521
+ memcpy(g.argvOrig, g.argv, sizeof(g.argv[0])*(j+1));
515522
}
516523
517524
#ifdef FOSSIL_ENABLE_TCL
518525
/*
519526
** Make a deep copy of the provided argument array and return it.
520527
--- src/main.c
+++ src/main.c
@@ -136,10 +136,11 @@
136 };
137 #endif
138
139 struct Global {
140 int argc; char **argv; /* Command-line arguments to the program */
 
141 char *nameOfExe; /* Full path of executable. */
142 const char *zErrlog; /* Log errors to this file, if not NULL */
143 const char *zPhase; /* Phase of operation, for use by the error log
144 ** and for deriving $canonical_page TH1 variable */
145 int isConst; /* True if the output is unchanging & cacheable */
@@ -444,11 +445,15 @@
444 ** introduces some weird corner cases, as covered in forum thread
445 ** 4382bbc66757c39f. e.g. (fossil -U -- --args ...) is handled
446 ** differently when we stop at "--" here. */
447 if( fossil_strcmp(z, "args")==0 ) break;
448 }
449 if( (int)i>=g.argc-1 ) return;
 
 
 
 
450
451 zFileName = g.argv[i+1];
452 if( strcmp(zFileName,"-")==0 ){
453 inFile = stdin;
454 }else if( !file_isfile(zFileName, ExtFILE) ){
@@ -467,11 +472,11 @@
467 blob_to_utf8_no_bom(&file, 1);
468 z = blob_str(&file);
469 for(k=0, nLine=1; z[k]; k++) if( z[k]=='\n' ) nLine++;
470 if( nLine>100000000 ) fossil_fatal("too many command-line arguments");
471 nArg = g.argc + nLine*2;
472 newArgv = fossil_malloc( sizeof(char*)*nArg );
473 for(j=0; j<i; j++) newArgv[j] = g.argv[j];
474
475 blob_rewind(&file);
476 while( nLine-->0 && (n = blob_line(&file, &line))>0 ){
477 /* Reminder: ^^^ nLine check avoids that embedded NUL bytes in the
@@ -510,10 +515,12 @@
510 i += 2;
511 while( (int)i<g.argc ) newArgv[j++] = g.argv[i++];
512 newArgv[j] = 0;
513 g.argc = j;
514 g.argv = newArgv;
 
 
515 }
516
517 #ifdef FOSSIL_ENABLE_TCL
518 /*
519 ** Make a deep copy of the provided argument array and return it.
520
--- src/main.c
+++ src/main.c
@@ -136,10 +136,11 @@
136 };
137 #endif
138
139 struct Global {
140 int argc; char **argv; /* Command-line arguments to the program */
141 char **argvOrig; /* Original g.argv prior to removing options */
142 char *nameOfExe; /* Full path of executable. */
143 const char *zErrlog; /* Log errors to this file, if not NULL */
144 const char *zPhase; /* Phase of operation, for use by the error log
145 ** and for deriving $canonical_page TH1 variable */
146 int isConst; /* True if the output is unchanging & cacheable */
@@ -444,11 +445,15 @@
445 ** introduces some weird corner cases, as covered in forum thread
446 ** 4382bbc66757c39f. e.g. (fossil -U -- --args ...) is handled
447 ** differently when we stop at "--" here. */
448 if( fossil_strcmp(z, "args")==0 ) break;
449 }
450 if( (int)i>=g.argc-1 ){
451 g.argvOrig = fossil_malloc( sizeof(char*)*(g.argc+1) );
452 memcpy(g.argvOrig, g.argv, sizeof(g.argv[0])*(g.argc+1));
453 return;
454 }
455
456 zFileName = g.argv[i+1];
457 if( strcmp(zFileName,"-")==0 ){
458 inFile = stdin;
459 }else if( !file_isfile(zFileName, ExtFILE) ){
@@ -467,11 +472,11 @@
472 blob_to_utf8_no_bom(&file, 1);
473 z = blob_str(&file);
474 for(k=0, nLine=1; z[k]; k++) if( z[k]=='\n' ) nLine++;
475 if( nLine>100000000 ) fossil_fatal("too many command-line arguments");
476 nArg = g.argc + nLine*2;
477 newArgv = fossil_malloc( sizeof(char*)*nArg*2 + 2);
478 for(j=0; j<i; j++) newArgv[j] = g.argv[j];
479
480 blob_rewind(&file);
481 while( nLine-->0 && (n = blob_line(&file, &line))>0 ){
482 /* Reminder: ^^^ nLine check avoids that embedded NUL bytes in the
@@ -510,10 +515,12 @@
515 i += 2;
516 while( (int)i<g.argc ) newArgv[j++] = g.argv[i++];
517 newArgv[j] = 0;
518 g.argc = j;
519 g.argv = newArgv;
520 g.argvOrig = &g.argv[j+1];
521 memcpy(g.argvOrig, g.argv, sizeof(g.argv[0])*(j+1));
522 }
523
524 #ifdef FOSSIL_ENABLE_TCL
525 /*
526 ** Make a deep copy of the provided argument array and return it.
527
--- src/markdown.c
+++ src/markdown.c
@@ -112,24 +112,10 @@
112112
#define MKD_CELL_ALIGN_RIGHT 2
113113
#define MKD_CELL_ALIGN_CENTER 3 /* LEFT | RIGHT */
114114
#define MKD_CELL_ALIGN_MASK 3
115115
#define MKD_CELL_HEAD 4
116116
117
-
118
-
119
-/**********************
120
- * EXPORTED FUNCTIONS *
121
- **********************/
122
-
123
-/*
124
-** markdown -- parses the input buffer and renders it into the output buffer.
125
-*/
126
-void markdown(
127
- struct Blob *ob,
128
- const struct Blob *ib,
129
- const struct mkd_renderer *rndr);
130
-
131117
132118
#endif /* INTERFACE */
133119
134120
#define BLOB_COUNT(pBlob,el_type) (blob_size(pBlob)/sizeof(el_type))
135121
#define COUNT_FOOTNOTES(pBlob) BLOB_COUNT(pBlob,struct footnote)
136122
--- src/markdown.c
+++ src/markdown.c
@@ -112,24 +112,10 @@
112 #define MKD_CELL_ALIGN_RIGHT 2
113 #define MKD_CELL_ALIGN_CENTER 3 /* LEFT | RIGHT */
114 #define MKD_CELL_ALIGN_MASK 3
115 #define MKD_CELL_HEAD 4
116
117
118
119 /**********************
120 * EXPORTED FUNCTIONS *
121 **********************/
122
123 /*
124 ** markdown -- parses the input buffer and renders it into the output buffer.
125 */
126 void markdown(
127 struct Blob *ob,
128 const struct Blob *ib,
129 const struct mkd_renderer *rndr);
130
131
132 #endif /* INTERFACE */
133
134 #define BLOB_COUNT(pBlob,el_type) (blob_size(pBlob)/sizeof(el_type))
135 #define COUNT_FOOTNOTES(pBlob) BLOB_COUNT(pBlob,struct footnote)
136
--- src/markdown.c
+++ src/markdown.c
@@ -112,24 +112,10 @@
112 #define MKD_CELL_ALIGN_RIGHT 2
113 #define MKD_CELL_ALIGN_CENTER 3 /* LEFT | RIGHT */
114 #define MKD_CELL_ALIGN_MASK 3
115 #define MKD_CELL_HEAD 4
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
118 #endif /* INTERFACE */
119
120 #define BLOB_COUNT(pBlob,el_type) (blob_size(pBlob)/sizeof(el_type))
121 #define COUNT_FOOTNOTES(pBlob) BLOB_COUNT(pBlob,struct footnote)
122
+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
+30 -13
--- src/rebuild.c
+++ src/rebuild.c
@@ -605,26 +605,43 @@
605605
**
606606
** The name for this command is stolen from the "git repack" command that
607607
** does approximately the same thing in Git.
608608
*/
609609
void repack_command(void){
610
- char *azNewArgv[5];
611
- char **azOldArgv = g.argv;
610
+ i64 nByte = 0;
611
+ int nDelta = 0;
612
+ int runVacuum = 0;
612613
verify_all_options();
613
- if( g.argc!=2 && g.argc!=3 ){
614
+ if( g.argc==3 ){
615
+ db_open_repository(g.argv[2]);
616
+ }else if( g.argc==2 ){
617
+ db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
618
+ if( g.argc!=2 ){
619
+ usage("?REPOSITORY-FILENAME?");
620
+ }
621
+ db_close(1);
622
+ db_open_repository(g.zRepositoryName);
623
+ }else{
614624
usage("?REPOSITORY-FILENAME?");
615625
}
616
- azNewArgv[0] = g.argv[0];
617
- azNewArgv[1] = "rebuild";
618
- azNewArgv[2] = "--compress-only";
619
- azNewArgv[3] = g.argv[2];
620
- azNewArgv[4] = 0;
621
- g.argc++;
622
- g.argv = azNewArgv;
623
- rebuild_database();
624
- g.argc--;
625
- g.argv = azOldArgv;
626
+ db_unprotect(PROTECT_ALL);
627
+ nByte = extra_deltification(&nDelta);
628
+ if( nDelta>0 ){
629
+ if( nDelta==1 ){
630
+ fossil_print("1 new delta saves %,lld bytes\n", nByte);
631
+ }else{
632
+ fossil_print("%d new deltas save %,lld bytes\n", nDelta, nByte);
633
+ }
634
+ runVacuum = 1;
635
+ }else{
636
+ fossil_print("no new compression opportunities found\n");
637
+ }
638
+ if( runVacuum ){
639
+ fossil_print("Vacuuming the database... "); fflush(stdout);
640
+ db_multi_exec("VACUUM");
641
+ fossil_print("done\n");
642
+ }
626643
}
627644
628645
629646
/*
630647
** COMMAND: rebuild
631648
--- src/rebuild.c
+++ src/rebuild.c
@@ -605,26 +605,43 @@
605 **
606 ** The name for this command is stolen from the "git repack" command that
607 ** does approximately the same thing in Git.
608 */
609 void repack_command(void){
610 char *azNewArgv[5];
611 char **azOldArgv = g.argv;
 
612 verify_all_options();
613 if( g.argc!=2 && g.argc!=3 ){
 
 
 
 
 
 
 
 
 
614 usage("?REPOSITORY-FILENAME?");
615 }
616 azNewArgv[0] = g.argv[0];
617 azNewArgv[1] = "rebuild";
618 azNewArgv[2] = "--compress-only";
619 azNewArgv[3] = g.argv[2];
620 azNewArgv[4] = 0;
621 g.argc++;
622 g.argv = azNewArgv;
623 rebuild_database();
624 g.argc--;
625 g.argv = azOldArgv;
 
 
 
 
 
 
 
626 }
627
628
629 /*
630 ** COMMAND: rebuild
631
--- src/rebuild.c
+++ src/rebuild.c
@@ -605,26 +605,43 @@
605 **
606 ** The name for this command is stolen from the "git repack" command that
607 ** does approximately the same thing in Git.
608 */
609 void repack_command(void){
610 i64 nByte = 0;
611 int nDelta = 0;
612 int runVacuum = 0;
613 verify_all_options();
614 if( g.argc==3 ){
615 db_open_repository(g.argv[2]);
616 }else if( g.argc==2 ){
617 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
618 if( g.argc!=2 ){
619 usage("?REPOSITORY-FILENAME?");
620 }
621 db_close(1);
622 db_open_repository(g.zRepositoryName);
623 }else{
624 usage("?REPOSITORY-FILENAME?");
625 }
626 db_unprotect(PROTECT_ALL);
627 nByte = extra_deltification(&nDelta);
628 if( nDelta>0 ){
629 if( nDelta==1 ){
630 fossil_print("1 new delta saves %,lld bytes\n", nByte);
631 }else{
632 fossil_print("%d new deltas save %,lld bytes\n", nDelta, nByte);
633 }
634 runVacuum = 1;
635 }else{
636 fossil_print("no new compression opportunities found\n");
637 }
638 if( runVacuum ){
639 fossil_print("Vacuuming the database... "); fflush(stdout);
640 db_multi_exec("VACUUM");
641 fossil_print("done\n");
642 }
643 }
644
645
646 /*
647 ** COMMAND: rebuild
648
+6 -3
--- src/schema.c
+++ src/schema.c
@@ -391,14 +391,17 @@
391391
@ -- have values assigned to them. So we are not really dealing with
392392
@ -- tags here. These are really properties. But we are going to
393393
@ -- keep calling them tags because in many cases the value is ignored.
394394
@ --
395395
@ CREATE TABLE tagxref(
396
-@ tagid INTEGER REFERENCES tag, -- The tag that added or removed
396
+@ tagid INTEGER REFERENCES tag, -- The tag being added, removed,
397
+@ -- or propagated
397398
@ tagtype INTEGER, -- 0:-,cancel 1:+,single 2:*,propagate
398
-@ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
399
-@ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
399
+@ srcid INTEGER REFERENCES blob, -- Artifact tag originates from, or
400
+@ -- 0 for propagated tags
401
+@ origid INTEGER REFERENCES blob, -- Artifact holding propagated tag
402
+@ -- (any artifact type with a P-card)
400403
@ value TEXT, -- Value of the tag. Might be NULL.
401404
@ mtime TIMESTAMP, -- Time of addition or removal. Julian day
402405
@ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
403406
@ UNIQUE(rid, tagid)
404407
@ );
405408
--- src/schema.c
+++ src/schema.c
@@ -391,14 +391,17 @@
391 @ -- have values assigned to them. So we are not really dealing with
392 @ -- tags here. These are really properties. But we are going to
393 @ -- keep calling them tags because in many cases the value is ignored.
394 @ --
395 @ CREATE TABLE tagxref(
396 @ tagid INTEGER REFERENCES tag, -- The tag that added or removed
 
397 @ tagtype INTEGER, -- 0:-,cancel 1:+,single 2:*,propagate
398 @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
399 @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
 
 
400 @ value TEXT, -- Value of the tag. Might be NULL.
401 @ mtime TIMESTAMP, -- Time of addition or removal. Julian day
402 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
403 @ UNIQUE(rid, tagid)
404 @ );
405
--- src/schema.c
+++ src/schema.c
@@ -391,14 +391,17 @@
391 @ -- have values assigned to them. So we are not really dealing with
392 @ -- tags here. These are really properties. But we are going to
393 @ -- keep calling them tags because in many cases the value is ignored.
394 @ --
395 @ CREATE TABLE tagxref(
396 @ tagid INTEGER REFERENCES tag, -- The tag being added, removed,
397 @ -- or propagated
398 @ tagtype INTEGER, -- 0:-,cancel 1:+,single 2:*,propagate
399 @ srcid INTEGER REFERENCES blob, -- Artifact tag originates from, or
400 @ -- 0 for propagated tags
401 @ origid INTEGER REFERENCES blob, -- Artifact holding propagated tag
402 @ -- (any artifact type with a P-card)
403 @ value TEXT, -- Value of the tag. Might be NULL.
404 @ mtime TIMESTAMP, -- Time of addition or removal. Julian day
405 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
406 @ UNIQUE(rid, tagid)
407 @ );
408
--- src/security_audit.c
+++ src/security_audit.c
@@ -100,12 +100,13 @@
100100
const char *zReadCap; /* Capabilities of user group "reader" */
101101
const char *zPubPages; /* GLOB pattern for public pages */
102102
const char *zSelfCap; /* Capabilities of self-registered users */
103103
int hasSelfReg = 0; /* True if able to self-register */
104104
const char *zPublicUrl; /* Canonical access URL */
105
+ Blob cmd;
105106
char *z;
106
- int n;
107
+ int n, i;
107108
CapabilityString *pCap;
108109
char **azCSP; /* Parsed content security policy */
109110
110111
login_check_credentials();
111112
if( !g.perm.Admin ){
@@ -691,10 +692,21 @@
691692
@ </pre></blockquote>
692693
@ </p>
693694
table_of_public_phantoms();
694695
@ </li>
695696
}
697
+
698
+ blob_init(&cmd, 0, 0);
699
+ for(i=0; g.argvOrig[i]!=0; i++){
700
+ blob_append_escaped_arg(&cmd, g.argvOrig[i], 0);
701
+ }
702
+ @ <li><p>
703
+ @ The command that generated this page:
704
+ @ <blockquote>
705
+ @ <tt>%h(blob_str(&cmd))</tt>
706
+ @ </blockquote></li>
707
+ blob_zero(&cmd);
696708
697709
@ </ol>
698710
style_finish_page();
699711
}
700712
701713
--- src/security_audit.c
+++ src/security_audit.c
@@ -100,12 +100,13 @@
100 const char *zReadCap; /* Capabilities of user group "reader" */
101 const char *zPubPages; /* GLOB pattern for public pages */
102 const char *zSelfCap; /* Capabilities of self-registered users */
103 int hasSelfReg = 0; /* True if able to self-register */
104 const char *zPublicUrl; /* Canonical access URL */
 
105 char *z;
106 int n;
107 CapabilityString *pCap;
108 char **azCSP; /* Parsed content security policy */
109
110 login_check_credentials();
111 if( !g.perm.Admin ){
@@ -691,10 +692,21 @@
691 @ </pre></blockquote>
692 @ </p>
693 table_of_public_phantoms();
694 @ </li>
695 }
 
 
 
 
 
 
 
 
 
 
 
696
697 @ </ol>
698 style_finish_page();
699 }
700
701
--- src/security_audit.c
+++ src/security_audit.c
@@ -100,12 +100,13 @@
100 const char *zReadCap; /* Capabilities of user group "reader" */
101 const char *zPubPages; /* GLOB pattern for public pages */
102 const char *zSelfCap; /* Capabilities of self-registered users */
103 int hasSelfReg = 0; /* True if able to self-register */
104 const char *zPublicUrl; /* Canonical access URL */
105 Blob cmd;
106 char *z;
107 int n, i;
108 CapabilityString *pCap;
109 char **azCSP; /* Parsed content security policy */
110
111 login_check_credentials();
112 if( !g.perm.Admin ){
@@ -691,10 +692,21 @@
692 @ </pre></blockquote>
693 @ </p>
694 table_of_public_phantoms();
695 @ </li>
696 }
697
698 blob_init(&cmd, 0, 0);
699 for(i=0; g.argvOrig[i]!=0; i++){
700 blob_append_escaped_arg(&cmd, g.argvOrig[i], 0);
701 }
702 @ <li><p>
703 @ The command that generated this page:
704 @ <blockquote>
705 @ <tt>%h(blob_str(&cmd))</tt>
706 @ </blockquote></li>
707 blob_zero(&cmd);
708
709 @ </ol>
710 style_finish_page();
711 }
712
713
+5 -4
--- src/smtp.c
+++ src/smtp.c
@@ -577,13 +577,14 @@
577577
return 0;
578578
}
579579
580580
/*
581581
** The input is a base email address of the form "local@domain".
582
-** Return a pointer to just the "domain" part.
582
+** Return a pointer to just the "domain" part, or 0 if the string
583
+** contains no "@".
583584
*/
584
-static const char *domainOfAddr(const char *z){
585
+const char *domain_of_addr(const char *z){
585586
while( z[0] && z[0]!='@' ) z++;
586587
if( z[0]==0 ) return 0;
587588
return z+1;
588589
}
589590
@@ -623,16 +624,16 @@
623624
if( g.argc<5 ) usage("EMAIL FROM TO ...");
624625
blob_read_from_file(&body, g.argv[2], ExtFILE);
625626
zFrom = g.argv[3];
626627
nTo = g.argc-4;
627628
azTo = (const char**)g.argv+4;
628
- zFromDomain = domainOfAddr(zFrom);
629
+ zFromDomain = domain_of_addr(zFrom);
629630
if( zRelay!=0 && zRelay[0]!= 0) {
630631
smtpFlags |= SMTP_DIRECT;
631632
zToDomain = zRelay;
632633
}else{
633
- zToDomain = domainOfAddr(azTo[0]);
634
+ zToDomain = domain_of_addr(azTo[0]);
634635
}
635636
p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort);
636637
if( p->zErr ){
637638
fossil_fatal("%s", p->zErr);
638639
}
639640
--- src/smtp.c
+++ src/smtp.c
@@ -577,13 +577,14 @@
577 return 0;
578 }
579
580 /*
581 ** The input is a base email address of the form "local@domain".
582 ** Return a pointer to just the "domain" part.
 
583 */
584 static const char *domainOfAddr(const char *z){
585 while( z[0] && z[0]!='@' ) z++;
586 if( z[0]==0 ) return 0;
587 return z+1;
588 }
589
@@ -623,16 +624,16 @@
623 if( g.argc<5 ) usage("EMAIL FROM TO ...");
624 blob_read_from_file(&body, g.argv[2], ExtFILE);
625 zFrom = g.argv[3];
626 nTo = g.argc-4;
627 azTo = (const char**)g.argv+4;
628 zFromDomain = domainOfAddr(zFrom);
629 if( zRelay!=0 && zRelay[0]!= 0) {
630 smtpFlags |= SMTP_DIRECT;
631 zToDomain = zRelay;
632 }else{
633 zToDomain = domainOfAddr(azTo[0]);
634 }
635 p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort);
636 if( p->zErr ){
637 fossil_fatal("%s", p->zErr);
638 }
639
--- src/smtp.c
+++ src/smtp.c
@@ -577,13 +577,14 @@
577 return 0;
578 }
579
580 /*
581 ** The input is a base email address of the form "local@domain".
582 ** Return a pointer to just the "domain" part, or 0 if the string
583 ** contains no "@".
584 */
585 const char *domain_of_addr(const char *z){
586 while( z[0] && z[0]!='@' ) z++;
587 if( z[0]==0 ) return 0;
588 return z+1;
589 }
590
@@ -623,16 +624,16 @@
624 if( g.argc<5 ) usage("EMAIL FROM TO ...");
625 blob_read_from_file(&body, g.argv[2], ExtFILE);
626 zFrom = g.argv[3];
627 nTo = g.argc-4;
628 azTo = (const char**)g.argv+4;
629 zFromDomain = domain_of_addr(zFrom);
630 if( zRelay!=0 && zRelay[0]!= 0) {
631 smtpFlags |= SMTP_DIRECT;
632 zToDomain = zRelay;
633 }else{
634 zToDomain = domain_of_addr(azTo[0]);
635 }
636 p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort);
637 if( p->zErr ){
638 fossil_fatal("%s", p->zErr);
639 }
640
+10
--- src/style.c
+++ src/style.c
@@ -1461,10 +1461,20 @@
14611461
#ifndef _WIN32
14621462
@ RSS = %.2f(fossil_rss()/1000000.0) MB</br />
14631463
#endif
14641464
@ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br />
14651465
@ fossil_exe_id() = %h(fossil_exe_id())<br />
1466
+ if( g.perm.Admin ){
1467
+ int k;
1468
+ for(k=0; g.argvOrig[k]; k++){
1469
+ Blob t;
1470
+ blob_init(&t, 0, 0);
1471
+ blob_append_escaped_arg(&t, g.argvOrig[k], 0);
1472
+ @ argv[%d(k)] = %h(blob_str(&t))<br />
1473
+ blob_zero(&t);
1474
+ }
1475
+ }
14661476
@ <hr />
14671477
P("HTTP_USER_AGENT");
14681478
P("SERVER_SOFTWARE");
14691479
cgi_print_all(showAll, 0);
14701480
if( showAll && blob_size(&g.httpHeader)>0 ){
14711481
--- src/style.c
+++ src/style.c
@@ -1461,10 +1461,20 @@
1461 #ifndef _WIN32
1462 @ RSS = %.2f(fossil_rss()/1000000.0) MB</br />
1463 #endif
1464 @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br />
1465 @ fossil_exe_id() = %h(fossil_exe_id())<br />
 
 
 
 
 
 
 
 
 
 
1466 @ <hr />
1467 P("HTTP_USER_AGENT");
1468 P("SERVER_SOFTWARE");
1469 cgi_print_all(showAll, 0);
1470 if( showAll && blob_size(&g.httpHeader)>0 ){
1471
--- src/style.c
+++ src/style.c
@@ -1461,10 +1461,20 @@
1461 #ifndef _WIN32
1462 @ RSS = %.2f(fossil_rss()/1000000.0) MB</br />
1463 #endif
1464 @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br />
1465 @ fossil_exe_id() = %h(fossil_exe_id())<br />
1466 if( g.perm.Admin ){
1467 int k;
1468 for(k=0; g.argvOrig[k]; k++){
1469 Blob t;
1470 blob_init(&t, 0, 0);
1471 blob_append_escaped_arg(&t, g.argvOrig[k], 0);
1472 @ argv[%d(k)] = %h(blob_str(&t))<br />
1473 blob_zero(&t);
1474 }
1475 }
1476 @ <hr />
1477 P("HTTP_USER_AGENT");
1478 P("SERVER_SOFTWARE");
1479 cgi_print_all(showAll, 0);
1480 if( showAll && blob_size(&g.httpHeader)>0 ){
1481
--- src/style.chat.css
+++ src/style.chat.css
@@ -37,11 +37,13 @@
3737
padding: 0.25em 0.5em;
3838
margin-top: 0;
3939
min-width: 9em /*avoid unsightly "underlap" with the neighboring
4040
.message-widget-tab element*/;
4141
white-space: normal;
42
+ word-break: break-word /* so that full hashes wrap on narrow screens */;
4243
}
44
+
4345
body.chat .message-widget-content.wide {
4446
/* Special case for when embedding content which we really want to
4547
expand, namely iframes. */
4648
width: 98%;
4749
}
4850
--- src/style.chat.css
+++ src/style.chat.css
@@ -37,11 +37,13 @@
37 padding: 0.25em 0.5em;
38 margin-top: 0;
39 min-width: 9em /*avoid unsightly "underlap" with the neighboring
40 .message-widget-tab element*/;
41 white-space: normal;
 
42 }
 
43 body.chat .message-widget-content.wide {
44 /* Special case for when embedding content which we really want to
45 expand, namely iframes. */
46 width: 98%;
47 }
48
--- src/style.chat.css
+++ src/style.chat.css
@@ -37,11 +37,13 @@
37 padding: 0.25em 0.5em;
38 margin-top: 0;
39 min-width: 9em /*avoid unsightly "underlap" with the neighboring
40 .message-widget-tab element*/;
41 white-space: normal;
42 word-break: break-word /* so that full hashes wrap on narrow screens */;
43 }
44
45 body.chat .message-widget-content.wide {
46 /* Special case for when embedding content which we really want to
47 expand, namely iframes. */
48 width: 98%;
49 }
50
+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
+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
--- src/unversioned.c
+++ src/unversioned.c
@@ -280,10 +280,11 @@
280280
**
281281
** sync ?URL? Synchronize the state of all unversioned files with
282282
** the remote repository URL. The most recent version
283283
** of each file is propagated to all repositories and
284284
** all prior versions are permanently forgotten.
285
+** The remote account requires the 'y' capability.
285286
**
286287
** Options:
287288
** -v|--verbose Extra diagnostic output
288289
** -n|--dry-run Show what would have happened
289290
**
@@ -464,11 +465,11 @@
464465
}
465466
}
466467
db_finalize(&q);
467468
sqlite3_free(zPattern);
468469
}else if( memcmp(zCmd, "revert", nCmd)==0 ){
469
- unsigned syncFlags =
470
+ unsigned syncFlags =
470471
unversioned_sync_flags(SYNC_UNVERSIONED|SYNC_UV_REVERT);
471472
g.argv[1] = "sync";
472473
g.argv[2] = "--uv-noop";
473474
sync_unversioned(syncFlags);
474475
}else if( memcmp(zCmd, "remove", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0
475476
--- src/unversioned.c
+++ src/unversioned.c
@@ -280,10 +280,11 @@
280 **
281 ** sync ?URL? Synchronize the state of all unversioned files with
282 ** the remote repository URL. The most recent version
283 ** of each file is propagated to all repositories and
284 ** all prior versions are permanently forgotten.
 
285 **
286 ** Options:
287 ** -v|--verbose Extra diagnostic output
288 ** -n|--dry-run Show what would have happened
289 **
@@ -464,11 +465,11 @@
464 }
465 }
466 db_finalize(&q);
467 sqlite3_free(zPattern);
468 }else if( memcmp(zCmd, "revert", nCmd)==0 ){
469 unsigned syncFlags =
470 unversioned_sync_flags(SYNC_UNVERSIONED|SYNC_UV_REVERT);
471 g.argv[1] = "sync";
472 g.argv[2] = "--uv-noop";
473 sync_unversioned(syncFlags);
474 }else if( memcmp(zCmd, "remove", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0
475
--- src/unversioned.c
+++ src/unversioned.c
@@ -280,10 +280,11 @@
280 **
281 ** sync ?URL? Synchronize the state of all unversioned files with
282 ** the remote repository URL. The most recent version
283 ** of each file is propagated to all repositories and
284 ** all prior versions are permanently forgotten.
285 ** The remote account requires the 'y' capability.
286 **
287 ** Options:
288 ** -v|--verbose Extra diagnostic output
289 ** -n|--dry-run Show what would have happened
290 **
@@ -464,11 +465,11 @@
465 }
466 }
467 db_finalize(&q);
468 sqlite3_free(zPattern);
469 }else if( memcmp(zCmd, "revert", nCmd)==0 ){
470 unsigned syncFlags =
471 unversioned_sync_flags(SYNC_UNVERSIONED|SYNC_UV_REVERT);
472 g.argv[1] = "sync";
473 g.argv[2] = "--uv-noop";
474 sync_unversioned(syncFlags);
475 }else if( memcmp(zCmd, "remove", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0
476
--- src/winhttp.c
+++ src/winhttp.c
@@ -570,10 +570,12 @@
570570
DualSocket ds;
571571
int idCnt = 0;
572572
int iPort = mnPort;
573573
Blob options;
574574
wchar_t zTmpPath[MAX_PATH];
575
+ char *zTempSubDirPath;
576
+ const char *zTempSubDir = "fossil";
575577
const char *zSkin;
576578
#if USE_SEE
577579
const char *zSavedKey = 0;
578580
size_t savedKeySize = 0;
579581
#endif
@@ -661,10 +663,16 @@
661663
}
662664
}
663665
if( !GetTempPathW(MAX_PATH, zTmpPath) ){
664666
fossil_panic("unable to get path to the temporary directory.");
665667
}
668
+ /* Use a subdirectory for temp files (can then be excluded from virus scan) */
669
+ zTempSubDirPath = mprintf("%s%s\\",fossil_path_to_utf8(zTmpPath),zTempSubDir);
670
+ if ( !file_mkdir(zTempSubDirPath, ExtFILE, 0) ||
671
+ file_isdir(zTempSubDirPath, ExtFILE)==1 ){
672
+ wcscpy(zTmpPath, fossil_utf8_to_path(zTempSubDirPath, 1));
673
+ }
666674
if( g.fHttpTrace ){
667675
zTempPrefix = mprintf("httptrace");
668676
}else{
669677
zTempPrefix = mprintf("%sfossil_server_P%d",
670678
fossil_unicode_to_utf8(zTmpPath), iPort);
671679
--- src/winhttp.c
+++ src/winhttp.c
@@ -570,10 +570,12 @@
570 DualSocket ds;
571 int idCnt = 0;
572 int iPort = mnPort;
573 Blob options;
574 wchar_t zTmpPath[MAX_PATH];
 
 
575 const char *zSkin;
576 #if USE_SEE
577 const char *zSavedKey = 0;
578 size_t savedKeySize = 0;
579 #endif
@@ -661,10 +663,16 @@
661 }
662 }
663 if( !GetTempPathW(MAX_PATH, zTmpPath) ){
664 fossil_panic("unable to get path to the temporary directory.");
665 }
 
 
 
 
 
 
666 if( g.fHttpTrace ){
667 zTempPrefix = mprintf("httptrace");
668 }else{
669 zTempPrefix = mprintf("%sfossil_server_P%d",
670 fossil_unicode_to_utf8(zTmpPath), iPort);
671
--- src/winhttp.c
+++ src/winhttp.c
@@ -570,10 +570,12 @@
570 DualSocket ds;
571 int idCnt = 0;
572 int iPort = mnPort;
573 Blob options;
574 wchar_t zTmpPath[MAX_PATH];
575 char *zTempSubDirPath;
576 const char *zTempSubDir = "fossil";
577 const char *zSkin;
578 #if USE_SEE
579 const char *zSavedKey = 0;
580 size_t savedKeySize = 0;
581 #endif
@@ -661,10 +663,16 @@
663 }
664 }
665 if( !GetTempPathW(MAX_PATH, zTmpPath) ){
666 fossil_panic("unable to get path to the temporary directory.");
667 }
668 /* Use a subdirectory for temp files (can then be excluded from virus scan) */
669 zTempSubDirPath = mprintf("%s%s\\",fossil_path_to_utf8(zTmpPath),zTempSubDir);
670 if ( !file_mkdir(zTempSubDirPath, ExtFILE, 0) ||
671 file_isdir(zTempSubDirPath, ExtFILE)==1 ){
672 wcscpy(zTmpPath, fossil_utf8_to_path(zTempSubDirPath, 1));
673 }
674 if( g.fHttpTrace ){
675 zTempPrefix = mprintf("httptrace");
676 }else{
677 zTempPrefix = mprintf("%sfossil_server_P%d",
678 fossil_unicode_to_utf8(zTmpPath), iPort);
679
+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
+6 -3
--- www/build.wiki
+++ www/build.wiki
@@ -111,13 +111,16 @@
111111
112112
<p>For more advanced use cases, see the [./ssl.wiki#openssl-bin|OpenSSL
113113
discussion in the "TLS and Fossil" document].</p>
114114
115115
<li><p>
116
-To build a statically linked binary (suitable for use inside a chroot
117
-jail) add the <b>--static</b> option. (See the [#docker | Docker section
118
-below].)
116
+To build a statically linked binary, you can <i>try</i> adding
117
+the <b>--static</b> option, but
118
+[https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
119
+| it may well not work]. If your platform of choice is affected by this,
120
+the simplest workaround we're aware of is to build a Fossil container,
121
+then [./containers.md#static | extract the static executable from it].
119122
120123
<li><p>
121124
To enable the native [./th1.md#tclEval | Tcl integration feature] feature,
122125
add the <b>--with-tcl=1</b> and <b>--with-tcl-private-stubs=1</b> options.
123126
124127
--- www/build.wiki
+++ www/build.wiki
@@ -111,13 +111,16 @@
111
112 <p>For more advanced use cases, see the [./ssl.wiki#openssl-bin|OpenSSL
113 discussion in the "TLS and Fossil" document].</p>
114
115 <li><p>
116 To build a statically linked binary (suitable for use inside a chroot
117 jail) add the <b>--static</b> option. (See the [#docker | Docker section
118 below].)
 
 
 
119
120 <li><p>
121 To enable the native [./th1.md#tclEval | Tcl integration feature] feature,
122 add the <b>--with-tcl=1</b> and <b>--with-tcl-private-stubs=1</b> options.
123
124
--- www/build.wiki
+++ www/build.wiki
@@ -111,13 +111,16 @@
111
112 <p>For more advanced use cases, see the [./ssl.wiki#openssl-bin|OpenSSL
113 discussion in the "TLS and Fossil" document].</p>
114
115 <li><p>
116 To build a statically linked binary, you can <i>try</i> adding
117 the <b>--static</b> option, but
118 [https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
119 | it may well not work]. If your platform of choice is affected by this,
120 the simplest workaround we're aware of is to build a Fossil container,
121 then [./containers.md#static | extract the static executable from it].
122
123 <li><p>
124 To enable the native [./th1.md#tclEval | Tcl integration feature] feature,
125 add the <b>--with-tcl=1</b> and <b>--with-tcl-private-stubs=1</b> options.
126
127
--- www/caps/index.md
+++ www/caps/index.md
@@ -1,11 +1,15 @@
1
-# Administering User Capabilities
1
+# Administering User Capabilities (a.k.a. Permissions)
22
33
Fossil includes a powerful [role-based access control system][rbac]
4
-which affects which users have which capabilities within a given
5
-[served][svr] Fossil repository. We call this the capability system, or
6
-“caps” for short.
4
+which affects which users have which capabilities(^Some parts of the
5
+Fossil code call these “permissions” instead, but since there is [a
6
+clear and present risk of confusion](#webonly) with operating system
7
+level file permissions in this context, we avoid using that term for
8
+Fossil’s RBAC capability flags in these pages.) within a given
9
+[served][svr] Fossil repository. We call this the “caps” system for
10
+short.
711
812
Fossil stores a user’s caps as an unordered string of ASCII characters,
913
one capability per, [currently](./impl.md#choices) limited to
1014
[alphanumerics][an]. Caps are case-sensitive: “**A**” and “**a**” are
1115
different user capabilities.
1216
--- www/caps/index.md
+++ www/caps/index.md
@@ -1,11 +1,15 @@
1 # Administering User Capabilities
2
3 Fossil includes a powerful [role-based access control system][rbac]
4 which affects which users have which capabilities within a given
5 [served][svr] Fossil repository. We call this the capability system, or
6 “caps” for short.
 
 
 
 
7
8 Fossil stores a user’s caps as an unordered string of ASCII characters,
9 one capability per, [currently](./impl.md#choices) limited to
10 [alphanumerics][an]. Caps are case-sensitive: “**A**” and “**a**” are
11 different user capabilities.
12
--- www/caps/index.md
+++ www/caps/index.md
@@ -1,11 +1,15 @@
1 # Administering User Capabilities (a.k.a. Permissions)
2
3 Fossil includes a powerful [role-based access control system][rbac]
4 which affects which users have which capabilities(^Some parts of the
5 Fossil code call these “permissions” instead, but since there is [a
6 clear and present risk of confusion](#webonly) with operating system
7 level file permissions in this context, we avoid using that term for
8 Fossil’s RBAC capability flags in these pages.) within a given
9 [served][svr] Fossil repository. We call this the “caps” system for
10 short.
11
12 Fossil stores a user’s caps as an unordered string of ASCII characters,
13 one capability per, [currently](./impl.md#choices) limited to
14 [alphanumerics][an]. Caps are case-sensitive: “**A**” and “**a**” are
15 different user capabilities.
16
--- 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
+236 -245
--- 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
@@ -350,64 +448,44 @@
350448
we’ve got everything reduced to the two key static binaries — Fossil and
351449
BusyBox — we throw all the rest of it away.
352450
353451
A secondary benefit falls out of this process for free: it’s arguably
354452
the easiest way to build a purely static Fossil binary for Linux. Most
355
-modern Linux distros make this surprisingly difficult, but Alpine’s
453
+modern Linux distros make this [surprisingly difficult][lsl], but Alpine’s
356454
back-to-basics nature makes static builds work the way they used to,
357455
back in the day. If that’s all you’re after, you can do so as easily as
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.)
369467
468
+[lsl]: https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
469
+
370470
371471
## 5. <a id="args"></a>Container Build Arguments
372472
373
-### <a id="pkg-vers"></a> 5.1 Package Versions
374
-
375
-You can override the default versions of Fossil and BusyBox that get
376
-fetched in the build step. To get the latest-and-greatest of everything,
377
-you could say:
378
-
379
-```
380
- $ docker build -t fossil \
381
- --build-arg FSLVER=trunk \
382
- --build-arg BBXVER=master .
383
-```
384
-
385
-(But don’t, for reasons we will get to.)
386
-
387
-Because the BusyBox configuration file we ship was created with and
388
-tested against a specific stable release, that’s the version we pull by
389
-default. It does try to merge the defaults for any new configuration
390
-settings into the stock set, but since it’s possible this will fail, we
391
-don’t blindly update the BusyBox version merely because a new release
392
-came out. Someone needs to get around to vetting it against our stock
393
-configuration first.
394
-
395
-As for Fossil, it defaults to fetching the same version as the checkout
396
-you’re running the build command from, based on checkin ID. You could
397
-use this to get a release build, for instance:
398
-
399
-```
400
- $ docker build -t fossil \
401
- --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 .
402481
```
403482
404483
Or equivalently, using Fossil’s `Makefile` convenience target:
405484
406485
```
407
- $ make container-image \
408
- DBFLAGS='--build-arg FSLVER=version-2.20'
486
+ $ make container-image DBFLAGS='--build-arg FSLVER=version-2.20'
409487
```
410488
411489
While you could instead use the generic
412490
“`release`” tag here, it’s better to use a specific version number
413491
since Docker caches downloaded files and tries to
@@ -466,10 +544,22 @@
466544
wish for [a static Fossil binary](#static). For those who want such a
467545
“batteries included” container, we recommend taking a look at [this
468546
alternative](https://hub.docker.com/r/duvel/fossil); needless to say,
469547
it’s inherently less secure than our stock container, but you may find
470548
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
+```
471561
472562
473563
## 6. <a id="light"></a>Lightweight Alternatives to Docker
474564
475565
Those afflicted with sticker shock at seeing the size of a [Docker
@@ -550,161 +640,55 @@
550640
[runc]: https://github.com/opencontainers/runc
551641
552642
553643
### 6.2 <a id="podman"></a>Podman
554644
555
-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
556646
give up the image builder is [Podman]. Initially created by
557647
Red Hat and thus popular on that family of OSes, it will run on
558648
any flavor of Linux. It can even be made to run [on macOS via Homebrew][pmmac]
559649
or [on Windows via WSL2][pmwin].
560650
561651
On Ubuntu 22.04, the installation size is about 38&nbsp;MiB, roughly a
562652
tenth the size of Docker Engine.
563653
564
-Although Podman [bills itself][whatis] as a drop-in replacement for the
565
-`docker` command and everything that sits behind it, some of the tool’s
566
-design decisions affect how our Fossil containers run, as compared to
567
-using Docker. The most important of these is that, by default, Podman
568
-wants to run your container “rootless,” meaning that it runs as a
569
-regular user. This is generally better for security, but [we dealt with
570
-that risk differently above](#chroot) already. Since neither choice is
571
-unassailably correct in all conditions, we’ll document both options
572
-here.
573
-
574
-[pmmac]: https://podman.io/getting-started/installation.html#macos
575
-[pmwin]: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md
576
-[Podman]: https://podman.io/
577
-[whatis]: https://podman.io/whatis.html
578
-
579
-
580
-#### 6.2.1 <a id="podman-rootless"></a>Fossil in a Rootless Podman Container
581
-
582
-If you build the stock Fossil container under `podman`, it will fail at
583
-two key steps:
584
-
585
-1. The `mknod` calls in the second stage, which create the `/jail/dev`
586
- nodes. For a rootless container, we want it to use the “real” `/dev`
587
- tree mounted into the container’s root filesystem instead.
588
-
589
-2. Anything that depends on the `/jail` directory and the fact that it
590
- becomes the file system’s root once the Fossil server is up and running.
591
-
592
-[The changes to fix this](/file/containers/Dockerfile-nojail.patch)
593
-aren’t complicated. Simply apply that patch to our stock `Dockerfile`
594
-and rebuild:
595
-
596
-```
597
- $ patch -p0 < containers/Dockerfile-nojail.patch
598
- $ podman build -t fossil:nojail .
599
- $ podman create \
600
- --name fossil-nojail \
601
- --publish 127.0.0.1:9999:8080 \
602
- --volume ~/museum:/museum \
603
- fossil:nojail
604
-```
605
-
606
-Do realize that by doing this, if an attacker ever managed to get shell
607
-access on your container, they’d have a BusyBox installation to play
608
-around in. That shouldn’t be enough to let them break out of the
609
-container entirely, but they’ll have powerful tools like `wget`, and
610
-they’ll be connected to the network the container runs on. Once the bad
611
-guy is inside the house, he doesn’t necessarily have to go after the
612
-residents directly to cause problems for them.
613
-
614
-
615
-#### 6.2.2 <a id="podman-rootful"></a>Fossil in a Rootful Podman Container
616
-
617
-##### Simple Method
618
-
619
-Fortunately, it’s easy enough to have it both ways. Simply run your
620
-`podman` commands as root:
621
-
622
-```
623
- $ sudo podman build -t fossil --cap-add MKNOD .
624
- $ 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 \
625673
--name fossil \
626674
--cap-drop CHOWN \
627675
--cap-drop FSETID \
628676
--cap-drop KILL \
629677
--cap-drop NET_BIND_SERVICE \
630678
--cap-drop SETFCAP \
631679
--cap-drop SETPCAP \
632680
--publish 127.0.0.1:9999:8080 \
633681
localhost/fossil
634
- $ sudo podman start fossil
635
-```
636
-
637
-It’s obvious why we have to start the container as root, but why create
638
-and build it as root, too? Isn’t that a regression from the modern
639
-practice of doing as much as possible with a normal user?
640
-
641
-We have to do the build under `sudo` in part because we’re doing rootly
642
-things with the file system image layers we’re building up. Just because
643
-it’s done inside a container runtime’s build environment doesn’t mean we
644
-can get away without root privileges to do things like create the
645
-`/jail/dev/null` node.
646
-
647
-The other reason we need “`sudo podman build`” is because it puts the result
648
-into root’s Podman image registry, where the next steps look for it.
649
-
650
-That in turn explains why we need “`sudo podman create`:” because it’s
651
-creating a container based on an image that was created by root. If you
652
-ran that step without `sudo`, it wouldn’t be able to find the image.
653
-
654
-If Docker is looking better and better to you as a result of all this,
655
-realize that it’s doing the same thing. It just hides it better by
656
-creating the `docker` group, so that when your user gets added to that
657
-group, you get silent root privilege escalation on your build machine.
658
-This is why Podman defaults to rootless containers. If you can get away
659
-with it, it’s a better way to work. We would not be recommending
660
-running `podman` under `sudo` if it didn’t buy us [something we wanted
661
-badly](#chroot).
662
-
663
-Notice that we had to add the ability to run `mknod(8)` during the
664
-build. [Podman sensibly denies this by default][nomknod], which lets us
665
-leave off the corresponding `--cap-drop` option. Podman also denies
666
-`CAP_NET_RAW` and `CAP_AUDIT_WRITE` by default, which we don’t need, so
667
-we’ve simply removed them from the `--cap-drop` list relative to the
668
-commands for Docker above.
669
-
670
-[nomknod]: https://github.com/containers/podman/issues/15626
671
-
672
-
673
-##### <a id="pm-root-workaround"></a>Building Under Docker, Running Under Podman
674
-
675
-If you have a remote host where the Fossil instance needs to run, it’s
676
-possible to get around this need to build the image as root on the
677
-remote system. You still have to build as root on the local system, but
678
-as I said above, Docker already does this. What we’re doing is shifting
679
-the risk of running as root from the public host to the local one.
680
-
681
-Once you have the image built on the local machine, create a “`fossil`”
682
-repository on your container repository of choice such as [Docker
683
-Hub](https://hub.docker.com), then say:
684
-
685
-```
686
- $ docker login
687
- $ docker tag fossil:latest mydockername/fossil:latest
688
- $ docker image push mydockername/fossil:latest
689
-```
690
-
691
-That will push the image up to your account, so that you can then switch
692
-to the remote machine and say:
693
-
694
-```
695
- $ sudo podman create \
696
- --any-options-you-like \
697
- docker.io/mydockername/fossil
698
-```
699
-
700
-This round-trip through the public image registry has another side
701
-benefit: your local system might be a lot faster than your remote one,
702
-as when the remote is a small VPS. Even with the overhead of schlepping
703
-container images across the Internet, it can be a net win in terms of
704
-build time.
705
-
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
706690
707691
708692
### 6.3 <a id="nspawn"></a>`systemd-container`
709693
710694
If even the Podman stack is too big for you, the next-best option I’m
@@ -727,30 +711,38 @@
727711
“`myproject`” within `~/museum/myproject/repo.fossil`, named according
728712
to the reasons given [above](#repo-inside). We’ll make consistent use of
729713
this naming scheme in the examples below so that you will be able to
730714
replace the “`myproject`” element of the various file and path names.
731715
732
-The first configuration step is to convert the Docker container into
733
-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:
734728
735729
```
736730
$ make container
737731
$ docker container export $(make container-version) |
738732
machinectl import-tar - myproject
739733
```
740734
741
-Next, create `/etc/systemd/nspawn/myproject.nspawn`, containing
742
-something like:
735
+Next, create `/etc/systemd/nspawn/myproject.nspawn`:
743736
744737
----
745738
746739
```
747740
[Exec]
748
-WorkingDirectory=/jail
741
+WorkingDirectory=/
749742
Parameters=bin/fossil server \
750743
--baseurl https://example.com/myproject \
751
- --chroot /jail \
752744
--create \
753745
--jsmode bundled \
754746
--localhost \
755747
--port 9000 \
756748
--scgi \
@@ -769,11 +761,11 @@
769761
ProcessTwo=yes
770762
LinkJournal=no
771763
Timezone=no
772764
773765
[Files]
774
-Bind=/home/fossil/museum/myproject:/jail/museum
766
+Bind=/home/fossil/museum/myproject:/museum
775767
776768
[Network]
777769
VirtualEthernet=no
778770
```
779771
@@ -793,11 +785,11 @@
793785
it’ll work with the other repository service methods we’ve
794786
[documented][srv].
795787
796788
* The path in the host-side part of the `Bind` value must point at the
797789
directory containing the `repo.fossil` file referenced in said
798
- command so that `/jail/museum/repo.fossil` refers to your repo out
790
+ command so that `/museum/repo.fossil` refers to your repo out
799791
on the host for the reasons given [above](#bind-mount).
800792
801793
That being done, we also need a generic systemd unit file called
802794
`/etc/systemd/system/[email protected]`, containing:
803795
@@ -839,11 +831,10 @@
839831
the `*.nspawn` file:
840832
841833
```
842834
Parameters=bin/fossil server \
843835
--cert /path/to/cert.pem \
844
- --chroot /jail \
845836
--create \
846837
--jsmode bundled \
847838
--port 443 \
848839
--user admin \
849840
museum/repo.fossil
@@ -1013,11 +1004,11 @@
10131004
* **`machinectl poweroff`** will fail because the container
10141005
isn’t running dbus.
10151006
10161007
* **`machinectl start`** will try to find an `/sbin/init`
10171008
program in the rootfs, which we haven’t got. We could
1018
- rename `/jail/bin/fossil` to `/sbin/init` and then hack
1009
+ rename `/bin/fossil` to `/sbin/init` and then hack
10191010
the chroot scheme to match, but ick. (This, incidentally,
10201011
is why we set `ProcessTwo=yes` above even though Fossil is
10211012
perfectly capable of running as PID 1, a fact we depend on
10221013
in the other methods above.)
10231014
10241015
--- 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
@@ -350,64 +448,44 @@
350 we’ve got everything reduced to the two key static binaries — Fossil and
351 BusyBox — we throw all the rest of it away.
352
353 A secondary benefit falls out of this process for free: it’s arguably
354 the easiest way to build a purely static Fossil binary for Linux. Most
355 modern Linux distros make this surprisingly difficult, but Alpine’s
356 back-to-basics nature makes static builds work the way they used to,
357 back in the day. If that’s all you’re after, you can do so as easily as
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.)
369
 
 
370
371 ## 5. <a id="args"></a>Container Build Arguments
372
373 ### <a id="pkg-vers"></a> 5.1 Package Versions
374
375 You can override the default versions of Fossil and BusyBox that get
376 fetched in the build step. To get the latest-and-greatest of everything,
377 you could say:
378
379 ```
380 $ docker build -t fossil \
381 --build-arg FSLVER=trunk \
382 --build-arg BBXVER=master .
383 ```
384
385 (But don’t, for reasons we will get to.)
386
387 Because the BusyBox configuration file we ship was created with and
388 tested against a specific stable release, that’s the version we pull by
389 default. It does try to merge the defaults for any new configuration
390 settings into the stock set, but since it’s possible this will fail, we
391 don’t blindly update the BusyBox version merely because a new release
392 came out. Someone needs to get around to vetting it against our stock
393 configuration first.
394
395 As for Fossil, it defaults to fetching the same version as the checkout
396 you’re running the build command from, based on checkin ID. You could
397 use this to get a release build, for instance:
398
399 ```
400 $ docker build -t fossil \
401 --build-arg FSLVER=version-2.20 .
402 ```
403
404 Or equivalently, using Fossil’s `Makefile` convenience target:
405
406 ```
407 $ make container-image \
408 DBFLAGS='--build-arg FSLVER=version-2.20'
409 ```
410
411 While you could instead use the generic
412 “`release`” tag here, it’s better to use a specific version number
413 since Docker caches downloaded files and tries to
@@ -466,10 +544,22 @@
466 wish for [a static Fossil binary](#static). For those who want such a
467 “batteries included” container, we recommend taking a look at [this
468 alternative](https://hub.docker.com/r/duvel/fossil); needless to say,
469 it’s inherently less secure than our stock container, but you may find
470 the tradeoff worthwhile.
 
 
 
 
 
 
 
 
 
 
 
 
471
472
473 ## 6. <a id="light"></a>Lightweight Alternatives to Docker
474
475 Those afflicted with sticker shock at seeing the size of a [Docker
@@ -550,161 +640,55 @@
550 [runc]: https://github.com/opencontainers/runc
551
552
553 ### 6.2 <a id="podman"></a>Podman
554
555 A lighter-weight alternative to either of the prior options that doesn’t
556 give up the image builder is [Podman]. Initially created by
557 Red Hat and thus popular on that family of OSes, it will run on
558 any flavor of Linux. It can even be made to run [on macOS via Homebrew][pmmac]
559 or [on Windows via WSL2][pmwin].
560
561 On Ubuntu 22.04, the installation size is about 38&nbsp;MiB, roughly a
562 tenth the size of Docker Engine.
563
564 Although Podman [bills itself][whatis] as a drop-in replacement for the
565 `docker` command and everything that sits behind it, some of the tool’s
566 design decisions affect how our Fossil containers run, as compared to
567 using Docker. The most important of these is that, by default, Podman
568 wants to run your container “rootless,” meaning that it runs as a
569 regular user. This is generally better for security, but [we dealt with
570 that risk differently above](#chroot) already. Since neither choice is
571 unassailably correct in all conditions, we’ll document both options
572 here.
573
574 [pmmac]: https://podman.io/getting-started/installation.html#macos
575 [pmwin]: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md
576 [Podman]: https://podman.io/
577 [whatis]: https://podman.io/whatis.html
578
579
580 #### 6.2.1 <a id="podman-rootless"></a>Fossil in a Rootless Podman Container
581
582 If you build the stock Fossil container under `podman`, it will fail at
583 two key steps:
584
585 1. The `mknod` calls in the second stage, which create the `/jail/dev`
586 nodes. For a rootless container, we want it to use the “real” `/dev`
587 tree mounted into the container’s root filesystem instead.
588
589 2. Anything that depends on the `/jail` directory and the fact that it
590 becomes the file system’s root once the Fossil server is up and running.
591
592 [The changes to fix this](/file/containers/Dockerfile-nojail.patch)
593 aren’t complicated. Simply apply that patch to our stock `Dockerfile`
594 and rebuild:
595
596 ```
597 $ patch -p0 < containers/Dockerfile-nojail.patch
598 $ podman build -t fossil:nojail .
599 $ podman create \
600 --name fossil-nojail \
601 --publish 127.0.0.1:9999:8080 \
602 --volume ~/museum:/museum \
603 fossil:nojail
604 ```
605
606 Do realize that by doing this, if an attacker ever managed to get shell
607 access on your container, they’d have a BusyBox installation to play
608 around in. That shouldn’t be enough to let them break out of the
609 container entirely, but they’ll have powerful tools like `wget`, and
610 they’ll be connected to the network the container runs on. Once the bad
611 guy is inside the house, he doesn’t necessarily have to go after the
612 residents directly to cause problems for them.
613
614
615 #### 6.2.2 <a id="podman-rootful"></a>Fossil in a Rootful Podman Container
616
617 ##### Simple Method
618
619 Fortunately, it’s easy enough to have it both ways. Simply run your
620 `podman` commands as root:
621
622 ```
623 $ sudo podman build -t fossil --cap-add MKNOD .
624 $ sudo podman create \
625 --name fossil \
626 --cap-drop CHOWN \
627 --cap-drop FSETID \
628 --cap-drop KILL \
629 --cap-drop NET_BIND_SERVICE \
630 --cap-drop SETFCAP \
631 --cap-drop SETPCAP \
632 --publish 127.0.0.1:9999:8080 \
633 localhost/fossil
634 $ sudo podman start fossil
635 ```
636
637 It’s obvious why we have to start the container as root, but why create
638 and build it as root, too? Isn’t that a regression from the modern
639 practice of doing as much as possible with a normal user?
640
641 We have to do the build under `sudo` in part because we’re doing rootly
642 things with the file system image layers we’re building up. Just because
643 it’s done inside a container runtime’s build environment doesn’t mean we
644 can get away without root privileges to do things like create the
645 `/jail/dev/null` node.
646
647 The other reason we need “`sudo podman build`” is because it puts the result
648 into root’s Podman image registry, where the next steps look for it.
649
650 That in turn explains why we need “`sudo podman create`:” because it’s
651 creating a container based on an image that was created by root. If you
652 ran that step without `sudo`, it wouldn’t be able to find the image.
653
654 If Docker is looking better and better to you as a result of all this,
655 realize that it’s doing the same thing. It just hides it better by
656 creating the `docker` group, so that when your user gets added to that
657 group, you get silent root privilege escalation on your build machine.
658 This is why Podman defaults to rootless containers. If you can get away
659 with it, it’s a better way to work. We would not be recommending
660 running `podman` under `sudo` if it didn’t buy us [something we wanted
661 badly](#chroot).
662
663 Notice that we had to add the ability to run `mknod(8)` during the
664 build. [Podman sensibly denies this by default][nomknod], which lets us
665 leave off the corresponding `--cap-drop` option. Podman also denies
666 `CAP_NET_RAW` and `CAP_AUDIT_WRITE` by default, which we don’t need, so
667 we’ve simply removed them from the `--cap-drop` list relative to the
668 commands for Docker above.
669
670 [nomknod]: https://github.com/containers/podman/issues/15626
671
672
673 ##### <a id="pm-root-workaround"></a>Building Under Docker, Running Under Podman
674
675 If you have a remote host where the Fossil instance needs to run, it’s
676 possible to get around this need to build the image as root on the
677 remote system. You still have to build as root on the local system, but
678 as I said above, Docker already does this. What we’re doing is shifting
679 the risk of running as root from the public host to the local one.
680
681 Once you have the image built on the local machine, create a “`fossil`”
682 repository on your container repository of choice such as [Docker
683 Hub](https://hub.docker.com), then say:
684
685 ```
686 $ docker login
687 $ docker tag fossil:latest mydockername/fossil:latest
688 $ docker image push mydockername/fossil:latest
689 ```
690
691 That will push the image up to your account, so that you can then switch
692 to the remote machine and say:
693
694 ```
695 $ sudo podman create \
696 --any-options-you-like \
697 docker.io/mydockername/fossil
698 ```
699
700 This round-trip through the public image registry has another side
701 benefit: your local system might be a lot faster than your remote one,
702 as when the remote is a small VPS. Even with the overhead of schlepping
703 container images across the Internet, it can be a net win in terms of
704 build time.
705
706
707
708 ### 6.3 <a id="nspawn"></a>`systemd-container`
709
710 If even the Podman stack is too big for you, the next-best option I’m
@@ -727,30 +711,38 @@
727 “`myproject`” within `~/museum/myproject/repo.fossil`, named according
728 to the reasons given [above](#repo-inside). We’ll make consistent use of
729 this naming scheme in the examples below so that you will be able to
730 replace the “`myproject`” element of the various file and path names.
731
732 The first configuration step is to convert the Docker container into
733 a “machine,” as `systemd` calls it. The easiest method is:
 
 
 
 
 
 
 
 
 
 
734
735 ```
736 $ make container
737 $ docker container export $(make container-version) |
738 machinectl import-tar - myproject
739 ```
740
741 Next, create `/etc/systemd/nspawn/myproject.nspawn`, containing
742 something like:
743
744 ----
745
746 ```
747 [Exec]
748 WorkingDirectory=/jail
749 Parameters=bin/fossil server \
750 --baseurl https://example.com/myproject \
751 --chroot /jail \
752 --create \
753 --jsmode bundled \
754 --localhost \
755 --port 9000 \
756 --scgi \
@@ -769,11 +761,11 @@
769 ProcessTwo=yes
770 LinkJournal=no
771 Timezone=no
772
773 [Files]
774 Bind=/home/fossil/museum/myproject:/jail/museum
775
776 [Network]
777 VirtualEthernet=no
778 ```
779
@@ -793,11 +785,11 @@
793 it’ll work with the other repository service methods we’ve
794 [documented][srv].
795
796 * The path in the host-side part of the `Bind` value must point at the
797 directory containing the `repo.fossil` file referenced in said
798 command so that `/jail/museum/repo.fossil` refers to your repo out
799 on the host for the reasons given [above](#bind-mount).
800
801 That being done, we also need a generic systemd unit file called
802 `/etc/systemd/system/[email protected]`, containing:
803
@@ -839,11 +831,10 @@
839 the `*.nspawn` file:
840
841 ```
842 Parameters=bin/fossil server \
843 --cert /path/to/cert.pem \
844 --chroot /jail \
845 --create \
846 --jsmode bundled \
847 --port 443 \
848 --user admin \
849 museum/repo.fossil
@@ -1013,11 +1004,11 @@
1013 * **`machinectl poweroff`** will fail because the container
1014 isn’t running dbus.
1015
1016 * **`machinectl start`** will try to find an `/sbin/init`
1017 program in the rootfs, which we haven’t got. We could
1018 rename `/jail/bin/fossil` to `/sbin/init` and then hack
1019 the chroot scheme to match, but ick. (This, incidentally,
1020 is why we set `ProcessTwo=yes` above even though Fossil is
1021 perfectly capable of running as PID 1, a fact we depend on
1022 in the other methods above.)
1023
1024
--- 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
@@ -350,64 +448,44 @@
448 we’ve got everything reduced to the two key static binaries — Fossil and
449 BusyBox — we throw all the rest of it away.
450
451 A secondary benefit falls out of this process for free: it’s arguably
452 the easiest way to build a purely static Fossil binary for Linux. Most
453 modern Linux distros make this [surprisingly difficult][lsl], but Alpine’s
454 back-to-basics nature makes static builds work the way they used to,
455 back in the day. If that’s all you’re after, you can do so as easily as
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.)
467
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
@@ -466,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
@@ -550,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
@@ -727,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 \
@@ -769,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
@@ -793,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
@@ -839,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
@@ -1013,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
+116 -24
--- www/glossary.md
+++ www/glossary.md
@@ -199,58 +199,135 @@
199199
move right 0.05
200200
box invis "clones of Fossil itself, SQLite, etc." ljust
201201
```
202202
203203
[asdis]: /help?cmd=autosync
204
-[backup]: ./backup.md
205
-[CAP]: ./cap-theorem.md
206
-[cloned]: /help?cmd=clone
207
-[pull]: /help?cmd=pull
208
-[push]: /help?cmd=push
209
-[svrcmd]: /help?cmd=server
210
-[sync]: /help?cmd=sync
204
+[backup]: ./backup.md
205
+[CAP]: ./cap-theorem.md
206
+[cloned]: /help?cmd=clone
207
+[pull]: /help?cmd=pull
208
+[push]: /help?cmd=push
209
+[svrcmd]: /help?cmd=server
210
+[sync]: /help?cmd=sync
211
+
212
+[repository]: #repo
213
+[repositories]: #repo
214
+
215
+
216
+## Version / Revision / Hash / UUID <a id="version" name="hash"></a>
217
+
218
+These terms all mean the same thing: a long hexadecimal
219
+[SHA hash value](./hashes.md) that uniquely identifies a particular
220
+[check-in](#ci).
221
+
222
+We’ve listed the alternatives in decreasing preference order:
223
+
224
+* **Version** and **revision** are near-synonyms in common usage.
225
+ Fossil’s code and documentation use both interchangeably because
226
+ Fossil was created to manage the development of the SQLite project,
227
+ which formerly used [CVS], the Concurrent Versions System. CVS in
228
+ turn started out as a front-end to [RCS], the Revision Control
229
+ System, but even though CVS uses “version” in its name, it numbers
230
+ check-ins using a system derived from RCS’s scheme, which it calls
231
+ “Revisions” in user-facing output. Fossil inherits this confusion
232
+ honestly.
233
+
234
+* **Hash** refers to the [SHA1 or SHA3-256 hash](./hashes.md) of the
235
+ content of the checked-in data, uniquely identifying that version of
236
+ the managed files. It is a strictly correct synonym, used more often
237
+ in low-level contexts than the term “version.”
238
+
239
+* **UUID** is a deprecated term still found in many parts of the
240
+ Fossil internals and (decreasingly) its documentation. The problem
241
+ with using this as a synonym for a Fossil-managed version of the
242
+ managed files is that there are [standards][UUID] defining the
243
+ format of a “UUID,” none of which Fossil follows, not even the
244
+ [version 4][ruuid] (random) format, the type of UUID closest in
245
+ meaning and usage to a Fossil hash.(^A pre-Fossil 2.0 style SHA1
246
+ hash is 160 bits, not the 128 bits many people expect for a proper
247
+ UUID, and even if you truncate it to 128 bits to create a “good
248
+ enough” version prefix, the 6 bits reserved in the UUID format for
249
+ the variant code cannot make a correct declaration except by a
250
+ random 1:64 chance. The SHA3-256 option allowed in Fossil 2.0 and
251
+ higher doesn’t help with this confusion, making a Fossil version
252
+ hash twice as large as a proper UUID. Alas, the term will never be
253
+ fully obliterated from use since there are columns in the Fossil
254
+ repository format that use the obsolete term; we cannot change this
255
+ without breaking backwards compatibility.)
256
+
257
+You will find all of these synonyms used in the Fossil documentation.
258
+Some day we may settle on a single term, but it doesn’t seem likely.
259
+
260
+[CVS]: https://en.wikipedia.org/wiki/Concurrent_Versions_System
261
+[hash]: #version
262
+[RCS]: https://en.wikipedia.org/wiki/Revision_Control_System
263
+[ruuid]: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
264
+[snfs]: https://en.wikipedia.org/wiki/Snapshot_(computer_storage)#File_systems
265
+[UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
266
+[version]: #version
211267
212268
213269
## Check-in <a id="check-in" name="ci"></a>
214270
215
-A version of the project’s files that have been committed to the
216
-repository. It is a snapshot of the project at an instant in time, as
217
-seen from a single [check-out’s](#co) perspective. Synonyms: version,
218
-snapshot, revision, commit. Sometimes styled “`CHECKIN`”, especially in
219
-command documentation where any [valid checkin name][ciname] can be
220
-used.
221
-
222
-* The long list of synonyms is confusing to new Fossil users,
223
- particularly the noun sense of the word “commit,” but it’s easy
271
+A [version] of the project’s files that have been committed to the
272
+[repository]; as such, it is sometimes called a “commit” instead. A
273
+check-in is a snapshot of the project at an instant in time, as seen from
274
+a single [check-out’s](#co) perspective. It is sometimes styled
275
+“`CHECKIN`”, especially in command documentation where any
276
+[valid check-in name][ciname] can be used.
277
+
278
+* There is a harmless conflation of terms here: any of the various
279
+ synonyms for [version] may be used where “check-in” is more accurate,
280
+ and vice versa, because there is a 1:1 relation between them. A
281
+ check-in *has* a version, but a version suffices to uniquely look up
282
+ a particular commit.[^snapshot]
283
+
284
+* Combining both sets of synonyms results in a list of terms that is
285
+ confusing to new Fossil users, but it’s easy
224286
enough to internalize the concepts. [Committing][commit] creates a
225287
*commit.* It may also be said to create a checked-in *version* of a
226288
particular *revision* of the project’s files, thus creating an
227289
immutable *snapshot* of the project’s state at the time of the
228290
commit. Fossil users find each of these different words for the
229291
same concept useful for expressive purposes among ourselves, but to
230292
Fossil proper, they all mean the same thing.
231293
232
- You will find all of these synonyms used in the Fossil documentation.
233
- Some day we may settle on a single term, but it doesn’t seem likely.
234
-
235294
* Check-ins are immutable.
236295
237296
* Check-ins exist only inside the repository. Contrast a
238297
[check-out](#co).
239298
240
-* Check-ins may have [one or more names][ciname], but only the SHA
241
- hash is globally unique, across all time; we call it the check-in’s
299
+* Check-ins may have [one or more names][ciname], but only the
300
+ [hash] is globally unique, across all time; we call it the check-in’s
242301
canonical name. The other names are either imprecise, contextual, or
243
- change their meaning over time and across [repositories](#repo).
302
+ change their meaning over time and across [repositories].
303
+
304
+[^snapshot]: You may sometimes see the term “snapshot” used as a synonym
305
+ for a check-in or the version number identifying said check-in. We
306
+ must warn against this usage because there is a potential confusion
307
+ here: [the `stash` command][stash] uses the term “snapshot,” as does
308
+ [the `undo` system][undo] to make a distinction with check-ins.
309
+ Nevertheless, there is a conceptual overlap here between Fossil and
310
+ systems that do use the term “snapshot,” the primary distinction being
311
+ that Fossil will capture only changes to files you’ve [added][add] to
312
+ the [repository], not to everything in [the check-out directory](#co)
313
+ at the time of the snapshot. (Thus [the `extras` command][extras].)
314
+ Contrast a snapshot taken by a virtual machine system or a
315
+ [snapshotting file system][snfs], which captures changes to everything
316
+ on the managed storage volume.
244317
318
+[add]: /help?cmd=add
245319
[ciname]: ./checkin_names.wiki
320
+[extras]: /help?cmd=extras
321
+[stash]: /help?cmd=stash
322
+[undo]: /help?cmd=undo
246323
247324
248325
249326
## Check-out <a id="check-out" name="co"></a>
250327
251
-A set of files extracted from a [repository](#repo) that represent a
328
+A set of files extracted from a [repository] that represent a
252329
particular [check-in](#ci) of the [project](#project).
253330
254331
* Unlike a check-in, a check-out is mutable. It may start out as a
255332
version of a particular check-in extracted from the repository, but
256333
the user is then free to make modifications to the checked-out
@@ -263,11 +340,11 @@
263340
264341
* Check-outs relate to repositories in a one-to-many fashion: it is
265342
common to have a single repo clone on a machine but to have it
266343
[open] in [multiple working directories][mwd]. Check-out directories
267344
are associated with the repos they were created from by settings
268
- stored in the check-out drectory. This is in the `.fslckout` file on
345
+ stored in the check-out directory. This is in the `.fslckout` file on
269346
POSIX type systems, but for historical compatibility reasons, it’s
270347
called `_FOSSIL_` by native Windows builds of Fossil.
271348
272349
(Contrast the Cygwin and WSL Fossil binaries, which use POSIX file
273350
naming rules.)
@@ -372,6 +449,21 @@
372449
[fef]: ./fileedit-page.md
373450
[fshr]: ./selfhost.wiki
374451
[wiki]: ./wikitheory.wiki
375452
376453
454
+## <a id="cap"></a>Capability
455
+
456
+Fossil includes a powerful [role-based access control system][rbac]
457
+which affects which users have permission to do certain things within a given
458
+[repository]. You can read more about this complex topic
459
+[here](./caps/).
460
+
461
+Some people — and indeed certain parts of Fossil’s own code — use the
462
+term “permissions” instead, but since [operating system file permissions
463
+also play into this](./caps/#webonly), we prefer the term “capabilities”
464
+(or “caps” for short) when talking about Fossil’s RBAC system to avoid a
465
+confusion here.
466
+
467
+[rbac]: https://en.wikipedia.org/wiki/Role-based_access_control
468
+
377469
<div style="height:50em" id="this-space-intentionally-left-blank"></div>
378470
--- www/glossary.md
+++ www/glossary.md
@@ -199,58 +199,135 @@
199 move right 0.05
200 box invis "clones of Fossil itself, SQLite, etc." ljust
201 ```
202
203 [asdis]: /help?cmd=autosync
204 [backup]: ./backup.md
205 [CAP]: ./cap-theorem.md
206 [cloned]: /help?cmd=clone
207 [pull]: /help?cmd=pull
208 [push]: /help?cmd=push
209 [svrcmd]: /help?cmd=server
210 [sync]: /help?cmd=sync
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
212
213 ## Check-in <a id="check-in" name="ci"></a>
214
215 A version of the project’s files that have been committed to the
216 repository. It is a snapshot of the project at an instant in time, as
217 seen from a single [check-out’s](#co) perspective. Synonyms: version,
218 snapshot, revision, commit. Sometimes styled “`CHECKIN`”, especially in
219 command documentation where any [valid checkin name][ciname] can be
220 used.
221
222 * The long list of synonyms is confusing to new Fossil users,
223 particularly the noun sense of the word “commit,” but it’s easy
 
 
 
 
 
 
224 enough to internalize the concepts. [Committing][commit] creates a
225 *commit.* It may also be said to create a checked-in *version* of a
226 particular *revision* of the project’s files, thus creating an
227 immutable *snapshot* of the project’s state at the time of the
228 commit. Fossil users find each of these different words for the
229 same concept useful for expressive purposes among ourselves, but to
230 Fossil proper, they all mean the same thing.
231
232 You will find all of these synonyms used in the Fossil documentation.
233 Some day we may settle on a single term, but it doesn’t seem likely.
234
235 * Check-ins are immutable.
236
237 * Check-ins exist only inside the repository. Contrast a
238 [check-out](#co).
239
240 * Check-ins may have [one or more names][ciname], but only the SHA
241 hash is globally unique, across all time; we call it the check-in’s
242 canonical name. The other names are either imprecise, contextual, or
243 change their meaning over time and across [repositories](#repo).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245 [ciname]: ./checkin_names.wiki
 
 
 
246
247
248
249 ## Check-out <a id="check-out" name="co"></a>
250
251 A set of files extracted from a [repository](#repo) that represent a
252 particular [check-in](#ci) of the [project](#project).
253
254 * Unlike a check-in, a check-out is mutable. It may start out as a
255 version of a particular check-in extracted from the repository, but
256 the user is then free to make modifications to the checked-out
@@ -263,11 +340,11 @@
263
264 * Check-outs relate to repositories in a one-to-many fashion: it is
265 common to have a single repo clone on a machine but to have it
266 [open] in [multiple working directories][mwd]. Check-out directories
267 are associated with the repos they were created from by settings
268 stored in the check-out drectory. This is in the `.fslckout` file on
269 POSIX type systems, but for historical compatibility reasons, it’s
270 called `_FOSSIL_` by native Windows builds of Fossil.
271
272 (Contrast the Cygwin and WSL Fossil binaries, which use POSIX file
273 naming rules.)
@@ -372,6 +449,21 @@
372 [fef]: ./fileedit-page.md
373 [fshr]: ./selfhost.wiki
374 [wiki]: ./wikitheory.wiki
375
376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377 <div style="height:50em" id="this-space-intentionally-left-blank"></div>
378
--- www/glossary.md
+++ www/glossary.md
@@ -199,58 +199,135 @@
199 move right 0.05
200 box invis "clones of Fossil itself, SQLite, etc." ljust
201 ```
202
203 [asdis]: /help?cmd=autosync
204 [backup]: ./backup.md
205 [CAP]: ./cap-theorem.md
206 [cloned]: /help?cmd=clone
207 [pull]: /help?cmd=pull
208 [push]: /help?cmd=push
209 [svrcmd]: /help?cmd=server
210 [sync]: /help?cmd=sync
211
212 [repository]: #repo
213 [repositories]: #repo
214
215
216 ## Version / Revision / Hash / UUID <a id="version" name="hash"></a>
217
218 These terms all mean the same thing: a long hexadecimal
219 [SHA hash value](./hashes.md) that uniquely identifies a particular
220 [check-in](#ci).
221
222 We’ve listed the alternatives in decreasing preference order:
223
224 * **Version** and **revision** are near-synonyms in common usage.
225 Fossil’s code and documentation use both interchangeably because
226 Fossil was created to manage the development of the SQLite project,
227 which formerly used [CVS], the Concurrent Versions System. CVS in
228 turn started out as a front-end to [RCS], the Revision Control
229 System, but even though CVS uses “version” in its name, it numbers
230 check-ins using a system derived from RCS’s scheme, which it calls
231 “Revisions” in user-facing output. Fossil inherits this confusion
232 honestly.
233
234 * **Hash** refers to the [SHA1 or SHA3-256 hash](./hashes.md) of the
235 content of the checked-in data, uniquely identifying that version of
236 the managed files. It is a strictly correct synonym, used more often
237 in low-level contexts than the term “version.”
238
239 * **UUID** is a deprecated term still found in many parts of the
240 Fossil internals and (decreasingly) its documentation. The problem
241 with using this as a synonym for a Fossil-managed version of the
242 managed files is that there are [standards][UUID] defining the
243 format of a “UUID,” none of which Fossil follows, not even the
244 [version 4][ruuid] (random) format, the type of UUID closest in
245 meaning and usage to a Fossil hash.(^A pre-Fossil 2.0 style SHA1
246 hash is 160 bits, not the 128 bits many people expect for a proper
247 UUID, and even if you truncate it to 128 bits to create a “good
248 enough” version prefix, the 6 bits reserved in the UUID format for
249 the variant code cannot make a correct declaration except by a
250 random 1:64 chance. The SHA3-256 option allowed in Fossil 2.0 and
251 higher doesn’t help with this confusion, making a Fossil version
252 hash twice as large as a proper UUID. Alas, the term will never be
253 fully obliterated from use since there are columns in the Fossil
254 repository format that use the obsolete term; we cannot change this
255 without breaking backwards compatibility.)
256
257 You will find all of these synonyms used in the Fossil documentation.
258 Some day we may settle on a single term, but it doesn’t seem likely.
259
260 [CVS]: https://en.wikipedia.org/wiki/Concurrent_Versions_System
261 [hash]: #version
262 [RCS]: https://en.wikipedia.org/wiki/Revision_Control_System
263 [ruuid]: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
264 [snfs]: https://en.wikipedia.org/wiki/Snapshot_(computer_storage)#File_systems
265 [UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
266 [version]: #version
267
268
269 ## Check-in <a id="check-in" name="ci"></a>
270
271 A [version] of the project’s files that have been committed to the
272 [repository]; as such, it is sometimes called a “commit” instead. A
273 check-in is a snapshot of the project at an instant in time, as seen from
274 a single [check-out’s](#co) perspective. It is sometimes styled
275 “`CHECKIN`”, especially in command documentation where any
276 [valid check-in name][ciname] can be used.
277
278 * There is a harmless conflation of terms here: any of the various
279 synonyms for [version] may be used where “check-in” is more accurate,
280 and vice versa, because there is a 1:1 relation between them. A
281 check-in *has* a version, but a version suffices to uniquely look up
282 a particular commit.[^snapshot]
283
284 * Combining both sets of synonyms results in a list of terms that is
285 confusing to new Fossil users, but it’s easy
286 enough to internalize the concepts. [Committing][commit] creates a
287 *commit.* It may also be said to create a checked-in *version* of a
288 particular *revision* of the project’s files, thus creating an
289 immutable *snapshot* of the project’s state at the time of the
290 commit. Fossil users find each of these different words for the
291 same concept useful for expressive purposes among ourselves, but to
292 Fossil proper, they all mean the same thing.
293
 
 
 
294 * Check-ins are immutable.
295
296 * Check-ins exist only inside the repository. Contrast a
297 [check-out](#co).
298
299 * Check-ins may have [one or more names][ciname], but only the
300 [hash] is globally unique, across all time; we call it the check-in’s
301 canonical name. The other names are either imprecise, contextual, or
302 change their meaning over time and across [repositories].
303
304 [^snapshot]: You may sometimes see the term “snapshot” used as a synonym
305 for a check-in or the version number identifying said check-in. We
306 must warn against this usage because there is a potential confusion
307 here: [the `stash` command][stash] uses the term “snapshot,” as does
308 [the `undo` system][undo] to make a distinction with check-ins.
309 Nevertheless, there is a conceptual overlap here between Fossil and
310 systems that do use the term “snapshot,” the primary distinction being
311 that Fossil will capture only changes to files you’ve [added][add] to
312 the [repository], not to everything in [the check-out directory](#co)
313 at the time of the snapshot. (Thus [the `extras` command][extras].)
314 Contrast a snapshot taken by a virtual machine system or a
315 [snapshotting file system][snfs], which captures changes to everything
316 on the managed storage volume.
317
318 [add]: /help?cmd=add
319 [ciname]: ./checkin_names.wiki
320 [extras]: /help?cmd=extras
321 [stash]: /help?cmd=stash
322 [undo]: /help?cmd=undo
323
324
325
326 ## Check-out <a id="check-out" name="co"></a>
327
328 A set of files extracted from a [repository] that represent a
329 particular [check-in](#ci) of the [project](#project).
330
331 * Unlike a check-in, a check-out is mutable. It may start out as a
332 version of a particular check-in extracted from the repository, but
333 the user is then free to make modifications to the checked-out
@@ -263,11 +340,11 @@
340
341 * Check-outs relate to repositories in a one-to-many fashion: it is
342 common to have a single repo clone on a machine but to have it
343 [open] in [multiple working directories][mwd]. Check-out directories
344 are associated with the repos they were created from by settings
345 stored in the check-out directory. This is in the `.fslckout` file on
346 POSIX type systems, but for historical compatibility reasons, it’s
347 called `_FOSSIL_` by native Windows builds of Fossil.
348
349 (Contrast the Cygwin and WSL Fossil binaries, which use POSIX file
350 naming rules.)
@@ -372,6 +449,21 @@
449 [fef]: ./fileedit-page.md
450 [fshr]: ./selfhost.wiki
451 [wiki]: ./wikitheory.wiki
452
453
454 ## <a id="cap"></a>Capability
455
456 Fossil includes a powerful [role-based access control system][rbac]
457 which affects which users have permission to do certain things within a given
458 [repository]. You can read more about this complex topic
459 [here](./caps/).
460
461 Some people — and indeed certain parts of Fossil’s own code — use the
462 term “permissions” instead, but since [operating system file permissions
463 also play into this](./caps/#webonly), we prefer the term “capabilities”
464 (or “caps” for short) when talking about Fossil’s RBAC system to avoid a
465 confusion here.
466
467 [rbac]: https://en.wikipedia.org/wiki/Role-based_access_control
468
469 <div style="height:50em" id="this-space-intentionally-left-blank"></div>
470
+1 -1
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -23,11 +23,11 @@
2323
blockchain.md {Is Fossil A Blockchain?}
2424
branching.wiki {Branching, Forking, Merging, and Tagging}
2525
bugtheory.wiki {Bug Tracking In Fossil}
2626
build.wiki {Compiling and Installing Fossil}
2727
cap-theorem.md {Fossil and the CAP Theorem}
28
- caps/ {Administering User Capabilities}
28
+ caps/ {Administering User Capabilities (a.k.a. Permissions)}
2929
caps/admin-v-setup.md {Differences Between Setup and Admin Users}
3030
caps/ref.html {User Capability Reference}
3131
cgi.wiki {CGI Script Configuration Options}
3232
changes.wiki {Fossil Changelog}
3333
chat.md {Fossil Chat}
3434
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -23,11 +23,11 @@
23 blockchain.md {Is Fossil A Blockchain?}
24 branching.wiki {Branching, Forking, Merging, and Tagging}
25 bugtheory.wiki {Bug Tracking In Fossil}
26 build.wiki {Compiling and Installing Fossil}
27 cap-theorem.md {Fossil and the CAP Theorem}
28 caps/ {Administering User Capabilities}
29 caps/admin-v-setup.md {Differences Between Setup and Admin Users}
30 caps/ref.html {User Capability Reference}
31 cgi.wiki {CGI Script Configuration Options}
32 changes.wiki {Fossil Changelog}
33 chat.md {Fossil Chat}
34
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -23,11 +23,11 @@
23 blockchain.md {Is Fossil A Blockchain?}
24 branching.wiki {Branching, Forking, Merging, and Tagging}
25 bugtheory.wiki {Bug Tracking In Fossil}
26 build.wiki {Compiling and Installing Fossil}
27 cap-theorem.md {Fossil and the CAP Theorem}
28 caps/ {Administering User Capabilities (a.k.a. Permissions)}
29 caps/admin-v-setup.md {Differences Between Setup and Admin Users}
30 caps/ref.html {User Capability Reference}
31 cgi.wiki {CGI Script Configuration Options}
32 changes.wiki {Fossil Changelog}
33 chat.md {Fossil Chat}
34
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -24,11 +24,11 @@
2424
<h2 id="pindex">Other Documents:</h2>
2525
<ul>
2626
<li><a href="tech_overview.wiki">A Technical Overview Of The Design And Implementation Of Fossil</a></li>
2727
<li><a href="serverext.wiki">Adding Extensions To A Fossil Server Using CGI Scripts</a></li>
2828
<li><a href="adding_code.wiki">Adding New Features To Fossil</a></li>
29
-<li><a href="caps/">Administering User Capabilities</a></li>
29
+<li><a href="caps/">Administering User Capabilities (a.k.a. Permissions)</a></li>
3030
<li><a href="backup.md">Backing Up a Remote Fossil Repository</a></li>
3131
<li><a href="whyusefossil.wiki">Benefits Of Version Control</a></li>
3232
<li><a href="branching.wiki">Branching, Forking, Merging, and Tagging</a></li>
3333
<li><a href="bugtheory.wiki">Bug Tracking In Fossil</a></li>
3434
<li><a href="cgi.wiki">CGI Script Configuration Options</a></li>
3535
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -24,11 +24,11 @@
24 <h2 id="pindex">Other Documents:</h2>
25 <ul>
26 <li><a href="tech_overview.wiki">A Technical Overview Of The Design And Implementation Of Fossil</a></li>
27 <li><a href="serverext.wiki">Adding Extensions To A Fossil Server Using CGI Scripts</a></li>
28 <li><a href="adding_code.wiki">Adding New Features To Fossil</a></li>
29 <li><a href="caps/">Administering User Capabilities</a></li>
30 <li><a href="backup.md">Backing Up a Remote Fossil Repository</a></li>
31 <li><a href="whyusefossil.wiki">Benefits Of Version Control</a></li>
32 <li><a href="branching.wiki">Branching, Forking, Merging, and Tagging</a></li>
33 <li><a href="bugtheory.wiki">Bug Tracking In Fossil</a></li>
34 <li><a href="cgi.wiki">CGI Script Configuration Options</a></li>
35
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -24,11 +24,11 @@
24 <h2 id="pindex">Other Documents:</h2>
25 <ul>
26 <li><a href="tech_overview.wiki">A Technical Overview Of The Design And Implementation Of Fossil</a></li>
27 <li><a href="serverext.wiki">Adding Extensions To A Fossil Server Using CGI Scripts</a></li>
28 <li><a href="adding_code.wiki">Adding New Features To Fossil</a></li>
29 <li><a href="caps/">Administering User Capabilities (a.k.a. Permissions)</a></li>
30 <li><a href="backup.md">Backing Up a Remote Fossil Repository</a></li>
31 <li><a href="whyusefossil.wiki">Benefits Of Version Control</a></li>
32 <li><a href="branching.wiki">Branching, Forking, Merging, and Tagging</a></li>
33 <li><a href="bugtheory.wiki">Bug Tracking In Fossil</a></li>
34 <li><a href="cgi.wiki">CGI Script Configuration Options</a></li>
35
--- www/server/windows/service.md
+++ www/server/windows/service.md
@@ -46,10 +46,22 @@
4646
4747
```
4848
fossil winsrv create --repository D:/Path/to/Repos --repolist
4949
```
5050
51
+### Choice of Directory Considerations
52
+
53
+When the Fossil server will be used at times that files may be locked
54
+during virus scanning, it is prudent to arrange that its directory used
55
+for temporary files is exempted from such scanning. Ordinarily, this
56
+will be a subdirectory named "fossil" in the temporary directory given
57
+by the Windows GetTempPath(...) API, [namely](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw#remarks)
58
+the value of the first existing environment variable from `%TMP%`, `%TEMP%`,
59
+`%USERPROFILE%`, and `%SystemRoot%`; you can look for their actual values in
60
+your system by accessing the `/test_env` webpage.
61
+Excluding this subdirectory will avoid certain rare failures where the
62
+fossil.exe process is unable to use the directory normally during a scan.
5163
5264
### <a id='PowerShell'></a>Advanced service installation using PowerShell
5365
5466
As great as `fossil winsrv` is, it does not have one to one reflection of all of
5567
the `fossil server` [options](/help?cmd=server). When you need to use some of
5668
--- www/server/windows/service.md
+++ www/server/windows/service.md
@@ -46,10 +46,22 @@
46
47 ```
48 fossil winsrv create --repository D:/Path/to/Repos --repolist
49 ```
50
 
 
 
 
 
 
 
 
 
 
 
 
51
52 ### <a id='PowerShell'></a>Advanced service installation using PowerShell
53
54 As great as `fossil winsrv` is, it does not have one to one reflection of all of
55 the `fossil server` [options](/help?cmd=server). When you need to use some of
56
--- www/server/windows/service.md
+++ www/server/windows/service.md
@@ -46,10 +46,22 @@
46
47 ```
48 fossil winsrv create --repository D:/Path/to/Repos --repolist
49 ```
50
51 ### Choice of Directory Considerations
52
53 When the Fossil server will be used at times that files may be locked
54 during virus scanning, it is prudent to arrange that its directory used
55 for temporary files is exempted from such scanning. Ordinarily, this
56 will be a subdirectory named "fossil" in the temporary directory given
57 by the Windows GetTempPath(...) API, [namely](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw#remarks)
58 the value of the first existing environment variable from `%TMP%`, `%TEMP%`,
59 `%USERPROFILE%`, and `%SystemRoot%`; you can look for their actual values in
60 your system by accessing the `/test_env` webpage.
61 Excluding this subdirectory will avoid certain rare failures where the
62 fossil.exe process is unable to use the directory normally during a scan.
63
64 ### <a id='PowerShell'></a>Advanced service installation using PowerShell
65
66 As great as `fossil winsrv` is, it does not have one to one reflection of all of
67 the `fossil server` [options](/help?cmd=server). When you need to use some of
68
--- 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