Fossil SCM

Sync with trunk.

florian 2026-01-10 14:16 UTC standard-cli-colors merge
Commit ceee00be59bb7e844b801bc7f4b5fabe6bdc250b6e5c579e34927bd5b308442b
118 files changed +2 -2 +7 -7 +12 -1 +1140 -519 +2565 -2637 +37 -15 +2 -2 +1 -1 +8 -7 +18 -5 +1 -1 +1 -1 +6 -6 +7 -7 +1 -1 +2 -2 +3 -3 +10 -9 +26 -2 +32 -16 +16 -19 +1 -1 +3 -3 +1 -1 +1 -1 +4 -4 +9 -9 +22 -5 +2 -2 +1 -1 +1 -1 +5 -5 +116 -64 +116 -64 +1 -1 +2 -2 +1 -1 +3 -3 +1 -1 +1 -1 +4 -4 +1 -1 +1 -1 +54 -8 +1 -1 +1 -1 +1 -1 +2 -2 +1 -1 +2 -2 +1 -1 +1 -1 +1 -1 +35 -15 +12 -1 +26 -80 +4 -4 +1 -1 +1 -1 +16 -10 +18 -10 +18 -10 +2 +3 -4 +4 -4 +1 -1 +3 -3 +2 -2 +1 -1 +1 -1 +7 -7 +3 -3 +1 -1 +3 -3 +2 -2 +2 -2 +39 -10 +43 -11 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +10 -5 +23 -1 +17 -5 +21 -23 +3 -3 +1 -1 +1 -1 +1 -1 +5 -5 +12 -12 +2 -2 +1 -1 +2 -2 +1 -1 +3 -3 +4 -1 +1 -1 +7 -4 +1 -1 +5 -5 +5 -5 +1 -1 +18 -6 +7 -4 +7 -4 +3 -3 +1 -1 +1 +61 -23 +2 -2 +2 +2 +7 -2 +1 -1
~ Makefile.in ~ extsrc/cson_amalgamation.c ~ extsrc/qrf.h ~ extsrc/shell.c ~ extsrc/sqlite3.c ~ extsrc/sqlite3.h ~ src/add.c ~ src/ajax.c ~ src/alerts.c ~ src/allrepo.c ~ src/backlink.c ~ src/bisect.c ~ src/blob.c ~ src/branch.c ~ src/builtin.c ~ src/cache.c ~ src/captcha.c ~ src/cgi.c ~ src/chat.c ~ src/checkin.c ~ src/checkout.c ~ src/color.c ~ src/comformat.c ~ src/config.h ~ src/configure.c ~ src/content.c ~ src/db.c ~ src/default.css ~ src/delta.c ~ src/descendants.c ~ src/diff.c ~ src/diffcmd.c ~ src/dispatch.c ~ src/dispatch.c ~ src/event.c ~ src/export.c ~ src/file.c ~ src/fileedit.c ~ src/forum.c ~ src/fossil.confirmer.js ~ src/fossil.diff.js ~ src/fossil.dom.js ~ src/fossil.fetch.js ~ src/fossil.page.chat.js ~ src/fossil.page.fileedit.js ~ src/fossil.page.wikiedit.js ~ src/fossil.pikchr.js ~ src/fossil.wikiedit-wysiwyg.js ~ src/fshell.c ~ src/glob.c ~ src/graph.c ~ src/hname.c ~ src/hook.c ~ src/http.c ~ src/http_socket.c ~ src/http_ssl.c ~ src/json.c ~ src/json_report.c ~ src/json_status.c ~ src/login.c ~ src/main.c ~ src/main.c ~ src/main.mk ~ src/manifest.c ~ src/markdown.c ~ src/match.c ~ src/merge.c ~ src/merge3.c ~ src/name.c ~ src/piechart.c ~ src/printf.c ~ src/purge.c ~ src/report.c ~ src/schema.c ~ src/search.c ~ src/search.c ~ src/security_audit.c ~ src/setup.c ~ src/setupuser.c ~ src/sha1.c ~ src/skins.c ~ src/smtp.c ~ src/sqlcmd.c ~ src/stat.c ~ src/style.c ~ src/style.chat.css ~ src/sync.c ~ src/tag.c ~ src/tar.c ~ src/terminal.c ~ src/terminal.c ~ src/th.c ~ src/th_main.c ~ src/timeline.c ~ src/tkt.c ~ src/tktsetup.c ~ src/undo.c ~ src/unicode.c ~ src/update.c ~ src/url.c ~ src/user.c ~ src/util.c ~ src/wiki.c ~ src/wikiformat.c ~ src/wikiformat.c ~ src/winhttp.c ~ src/xfer.c ~ src/xsystem.c ~ src/xsystem.c ~ src/zip.c ~ tools/codecheck1.c ~ tools/makemake.tcl ~ tools/mkindex.c ~ win/Makefile.dmc ~ win/Makefile.mingw ~ win/Makefile.msc ~ www/changes.wiki ~ www/serverext.wiki
+2 -2
--- Makefile.in
+++ Makefile.in
@@ -75,11 +75,11 @@
7575
#
7676
# APPNAME = fossil-fuzz
7777
# may be more appropriate for fuzzing.
7878
7979
#### Emscripten stuff for optionally doing in-tree builds
80
-# of any WASM components. We store precompiled WASM in the the SCM, so
80
+# of any WASM components. We store precompiled WASM in the SCM, so
8181
# this is only useful for people who actively work on WASM
8282
# components. EMSDK_ENV refers to the "environment" script which comes
8383
# with the Emscripten SDK package:
8484
# https://emscripten.org/docs/getting_started/downloads.html
8585
EMSDK_HOME = @EMSDK_HOME@
@@ -114,11 +114,11 @@
114114
#
115115
# The "touch" is necessary to avoid a make loop due to a new upstream
116116
# feature in autosetup (GH 0a71e3c3b7) which rewrites *.in outputs only
117117
# if doing so will write different contents; otherwise, it leaves them
118118
# alone so the mtime doesn't change. This means that if you change one
119
-# our depdendencies besides Makefile.in, we'll reconfigure but Makefile
119
+# of our dependencies besides Makefile.in, we'll reconfigure but Makefile
120120
# won't change, so this rule will remain out of date, so we'll reconfig
121121
# but Makefile won't change, so we'll reconfig but... endlessly.
122122
#
123123
# This is also why we repeat the reconfig target's command here instead
124124
# of delegating to it with "$(MAKE) reconfig": having children running
125125
--- Makefile.in
+++ Makefile.in
@@ -75,11 +75,11 @@
75 #
76 # APPNAME = fossil-fuzz
77 # may be more appropriate for fuzzing.
78
79 #### Emscripten stuff for optionally doing in-tree builds
80 # of any WASM components. We store precompiled WASM in the the SCM, so
81 # this is only useful for people who actively work on WASM
82 # components. EMSDK_ENV refers to the "environment" script which comes
83 # with the Emscripten SDK package:
84 # https://emscripten.org/docs/getting_started/downloads.html
85 EMSDK_HOME = @EMSDK_HOME@
@@ -114,11 +114,11 @@
114 #
115 # The "touch" is necessary to avoid a make loop due to a new upstream
116 # feature in autosetup (GH 0a71e3c3b7) which rewrites *.in outputs only
117 # if doing so will write different contents; otherwise, it leaves them
118 # alone so the mtime doesn't change. This means that if you change one
119 # our depdendencies besides Makefile.in, we'll reconfigure but Makefile
120 # won't change, so this rule will remain out of date, so we'll reconfig
121 # but Makefile won't change, so we'll reconfig but... endlessly.
122 #
123 # This is also why we repeat the reconfig target's command here instead
124 # of delegating to it with "$(MAKE) reconfig": having children running
125
--- Makefile.in
+++ Makefile.in
@@ -75,11 +75,11 @@
75 #
76 # APPNAME = fossil-fuzz
77 # may be more appropriate for fuzzing.
78
79 #### Emscripten stuff for optionally doing in-tree builds
80 # of any WASM components. We store precompiled WASM in the SCM, so
81 # this is only useful for people who actively work on WASM
82 # components. EMSDK_ENV refers to the "environment" script which comes
83 # with the Emscripten SDK package:
84 # https://emscripten.org/docs/getting_started/downloads.html
85 EMSDK_HOME = @EMSDK_HOME@
@@ -114,11 +114,11 @@
114 #
115 # The "touch" is necessary to avoid a make loop due to a new upstream
116 # feature in autosetup (GH 0a71e3c3b7) which rewrites *.in outputs only
117 # if doing so will write different contents; otherwise, it leaves them
118 # alone so the mtime doesn't change. This means that if you change one
119 # of our dependencies besides Makefile.in, we'll reconfigure but Makefile
120 # won't change, so this rule will remain out of date, so we'll reconfig
121 # but Makefile won't change, so we'll reconfig but... endlessly.
122 #
123 # This is also why we repeat the reconfig target's command here instead
124 # of delegating to it with "$(MAKE) reconfig": having children running
125
--- extsrc/cson_amalgamation.c
+++ extsrc/cson_amalgamation.c
@@ -13,20 +13,20 @@
1313
#include <stddef.h>
1414
1515
/* Windows DLL stuff */
1616
#ifdef JSON_PARSER_DLL
1717
# ifdef _MSC_VER
18
-# ifdef JSON_PARSER_DLL_EXPORTS
19
-# define JSON_PARSER_DLL_API __declspec(dllexport)
20
-# else
21
-# define JSON_PARSER_DLL_API __declspec(dllimport)
22
-# endif
18
+# ifdef JSON_PARSER_DLL_EXPORTS
19
+# define JSON_PARSER_DLL_API __declspec(dllexport)
20
+# else
21
+# define JSON_PARSER_DLL_API __declspec(dllimport)
22
+# endif
2323
# else
24
-# define JSON_PARSER_DLL_API
24
+# define JSON_PARSER_DLL_API
2525
# endif
2626
#else
27
-# define JSON_PARSER_DLL_API
27
+# define JSON_PARSER_DLL_API
2828
#endif
2929
3030
/* Determine the integer type use to parse non-floating point numbers */
3131
#ifdef _WIN32
3232
typedef __int64 JSON_int_t;
3333
--- extsrc/cson_amalgamation.c
+++ extsrc/cson_amalgamation.c
@@ -13,20 +13,20 @@
13 #include <stddef.h>
14
15 /* Windows DLL stuff */
16 #ifdef JSON_PARSER_DLL
17 # ifdef _MSC_VER
18 # ifdef JSON_PARSER_DLL_EXPORTS
19 # define JSON_PARSER_DLL_API __declspec(dllexport)
20 # else
21 # define JSON_PARSER_DLL_API __declspec(dllimport)
22 # endif
23 # else
24 # define JSON_PARSER_DLL_API
25 # endif
26 #else
27 # define JSON_PARSER_DLL_API
28 #endif
29
30 /* Determine the integer type use to parse non-floating point numbers */
31 #ifdef _WIN32
32 typedef __int64 JSON_int_t;
33
--- extsrc/cson_amalgamation.c
+++ extsrc/cson_amalgamation.c
@@ -13,20 +13,20 @@
13 #include <stddef.h>
14
15 /* Windows DLL stuff */
16 #ifdef JSON_PARSER_DLL
17 # ifdef _MSC_VER
18 # ifdef JSON_PARSER_DLL_EXPORTS
19 # define JSON_PARSER_DLL_API __declspec(dllexport)
20 # else
21 # define JSON_PARSER_DLL_API __declspec(dllimport)
22 # endif
23 # else
24 # define JSON_PARSER_DLL_API
25 # endif
26 #else
27 # define JSON_PARSER_DLL_API
28 #endif
29
30 /* Determine the integer type use to parse non-floating point numbers */
31 #ifdef _WIN32
32 typedef __int64 JSON_int_t;
33
+12 -1
--- extsrc/qrf.h
+++ extsrc/qrf.h
@@ -35,13 +35,15 @@
3535
unsigned char bWordWrap; /* Try to wrap on word boundaries */
3636
unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
3737
unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
3838
unsigned char eTitleAlign; /* Alignment for column headers */
3939
unsigned char bSplitColumn; /* Wrap single-column output into many columns */
40
+ unsigned char bBorder; /* Show outer border in Box and Table styles */
4041
short int nWrap; /* Wrap columns wider than this */
4142
short int nScreenWidth; /* Maximum overall table width */
4243
short int nLineLimit; /* Maximum number of lines for any row */
44
+ short int nTitleLimit; /* Maximum number of characters in a title */
4345
int nCharLimit; /* Maximum number of characters in a cell */
4446
int nWidth; /* Number of entries in aWidth[] */
4547
int nAlign; /* Number of entries in aAlignment[] */
4648
short int *aWidth; /* Column widths */
4749
unsigned char *aAlign; /* Column alignments */
@@ -106,10 +108,11 @@
106108
#define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
107109
#define QRF_TEXT_Csv 3 /* CSV-style quoting */
108110
#define QRF_TEXT_Html 4 /* HTML-style quoting */
109111
#define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
110112
#define QRF_TEXT_Json 6 /* JSON quoting */
113
+#define QRF_TEXT_Relaxed 7 /* Relaxed SQL quoting */
111114
112115
/*
113116
** Quoting styles for BLOBs
114117
** Allowed values for sqlite3_qrf_spec.eBlob
115118
*/
@@ -173,17 +176,25 @@
173176
/*
174177
** Return an estimate of the width, in columns, for the single Unicode
175178
** character c. For normal characters, the answer is always 1. But the
176179
** estimate might be 0 or 2 for zero-width and double-width characters.
177180
**
178
-** Different display devices display unicode using different widths. So
181
+** Different devices display unicode using different widths. So
179182
** it is impossible to know that true display width with 100% accuracy.
180183
** Inaccuracies in the width estimates might cause columns to be misaligned.
181184
** Unfortunately, there is nothing we can do about that.
182185
*/
183186
int sqlite3_qrf_wcwidth(int c);
184187
188
+/*
189
+** Return an estimate of the number of display columns used by the
190
+** string in the argument. The width of individual characters is
191
+** determined as for sqlite3_qrf_wcwidth(). VT100 escape code sequences
192
+** are assigned a width of zero.
193
+*/
194
+size_t sqlite3_qrf_wcswidth(const char*);
195
+
185196
186197
#ifdef __cplusplus
187198
}
188199
#endif
189200
#endif /* !defined(SQLITE_QRF_H) */
190201
--- extsrc/qrf.h
+++ extsrc/qrf.h
@@ -35,13 +35,15 @@
35 unsigned char bWordWrap; /* Try to wrap on word boundaries */
36 unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
37 unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
38 unsigned char eTitleAlign; /* Alignment for column headers */
39 unsigned char bSplitColumn; /* Wrap single-column output into many columns */
 
40 short int nWrap; /* Wrap columns wider than this */
41 short int nScreenWidth; /* Maximum overall table width */
42 short int nLineLimit; /* Maximum number of lines for any row */
 
43 int nCharLimit; /* Maximum number of characters in a cell */
44 int nWidth; /* Number of entries in aWidth[] */
45 int nAlign; /* Number of entries in aAlignment[] */
46 short int *aWidth; /* Column widths */
47 unsigned char *aAlign; /* Column alignments */
@@ -106,10 +108,11 @@
106 #define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
107 #define QRF_TEXT_Csv 3 /* CSV-style quoting */
108 #define QRF_TEXT_Html 4 /* HTML-style quoting */
109 #define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
110 #define QRF_TEXT_Json 6 /* JSON quoting */
 
111
112 /*
113 ** Quoting styles for BLOBs
114 ** Allowed values for sqlite3_qrf_spec.eBlob
115 */
@@ -173,17 +176,25 @@
173 /*
174 ** Return an estimate of the width, in columns, for the single Unicode
175 ** character c. For normal characters, the answer is always 1. But the
176 ** estimate might be 0 or 2 for zero-width and double-width characters.
177 **
178 ** Different display devices display unicode using different widths. So
179 ** it is impossible to know that true display width with 100% accuracy.
180 ** Inaccuracies in the width estimates might cause columns to be misaligned.
181 ** Unfortunately, there is nothing we can do about that.
182 */
183 int sqlite3_qrf_wcwidth(int c);
184
 
 
 
 
 
 
 
 
185
186 #ifdef __cplusplus
187 }
188 #endif
189 #endif /* !defined(SQLITE_QRF_H) */
190
--- extsrc/qrf.h
+++ extsrc/qrf.h
@@ -35,13 +35,15 @@
35 unsigned char bWordWrap; /* Try to wrap on word boundaries */
36 unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
37 unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
38 unsigned char eTitleAlign; /* Alignment for column headers */
39 unsigned char bSplitColumn; /* Wrap single-column output into many columns */
40 unsigned char bBorder; /* Show outer border in Box and Table styles */
41 short int nWrap; /* Wrap columns wider than this */
42 short int nScreenWidth; /* Maximum overall table width */
43 short int nLineLimit; /* Maximum number of lines for any row */
44 short int nTitleLimit; /* Maximum number of characters in a title */
45 int nCharLimit; /* Maximum number of characters in a cell */
46 int nWidth; /* Number of entries in aWidth[] */
47 int nAlign; /* Number of entries in aAlignment[] */
48 short int *aWidth; /* Column widths */
49 unsigned char *aAlign; /* Column alignments */
@@ -106,10 +108,11 @@
108 #define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
109 #define QRF_TEXT_Csv 3 /* CSV-style quoting */
110 #define QRF_TEXT_Html 4 /* HTML-style quoting */
111 #define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
112 #define QRF_TEXT_Json 6 /* JSON quoting */
113 #define QRF_TEXT_Relaxed 7 /* Relaxed SQL quoting */
114
115 /*
116 ** Quoting styles for BLOBs
117 ** Allowed values for sqlite3_qrf_spec.eBlob
118 */
@@ -173,17 +176,25 @@
176 /*
177 ** Return an estimate of the width, in columns, for the single Unicode
178 ** character c. For normal characters, the answer is always 1. But the
179 ** estimate might be 0 or 2 for zero-width and double-width characters.
180 **
181 ** Different devices display unicode using different widths. So
182 ** it is impossible to know that true display width with 100% accuracy.
183 ** Inaccuracies in the width estimates might cause columns to be misaligned.
184 ** Unfortunately, there is nothing we can do about that.
185 */
186 int sqlite3_qrf_wcwidth(int c);
187
188 /*
189 ** Return an estimate of the number of display columns used by the
190 ** string in the argument. The width of individual characters is
191 ** determined as for sqlite3_qrf_wcwidth(). VT100 escape code sequences
192 ** are assigned a width of zero.
193 */
194 size_t sqlite3_qrf_wcswidth(const char*);
195
196
197 #ifdef __cplusplus
198 }
199 #endif
200 #endif /* !defined(SQLITE_QRF_H) */
201
+1140 -519
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -35,11 +35,11 @@
3535
** ext/recover/sqlite3recover.h
3636
** src/shell.c.in
3737
**
3838
** To modify this program, get a copy of the canonical SQLite source tree,
3939
** edit the src/shell.c.in file and/or some of the other files that are
40
-** listed above, then rerun the rerun "make shell.c".
40
+** listed above, then rerun the command "make shell.c".
4141
*/
4242
/************************* Begin src/shell.c.in ******************/
4343
/*
4444
** 2001 September 15
4545
**
@@ -49,11 +49,11 @@
4949
** May you do good and not evil.
5050
** May you find forgiveness for yourself and forgive others.
5151
** May you share freely, never taking more than you give.
5252
**
5353
*************************************************************************
54
-** This file contains code to implement the "sqlite" command line
54
+** This file contains code to implement the "sqlite3" command line
5555
** utility for accessing SQLite databases.
5656
*/
5757
#if (defined(_WIN32) || defined(WIN32)) && !defined(_CRT_SECURE_NO_WARNINGS)
5858
/* This needs to come before any includes for MSVC compiler */
5959
#define _CRT_SECURE_NO_WARNINGS
@@ -71,26 +71,22 @@
7171
# define SHELL_STRINGIFY(f) SHELL_STRINGIFY_(f)
7272
#ifdef SQLITE_CUSTOM_INCLUDE
7373
# include SHELL_STRINGIFY(SQLITE_CUSTOM_INCLUDE)
7474
#endif
7575
76
-/*
77
-** Determine if we are dealing with WinRT, which provides only a subset of
78
-** the full Win32 API.
79
-*/
80
-#if !defined(SQLITE_OS_WINRT)
81
-# define SQLITE_OS_WINRT 0
82
-#endif
83
-
8476
/*
8577
** If SQLITE_SHELL_FIDDLE is defined then the shell is modified
8678
** somewhat for use as a WASM module in a web browser. This flag
8779
** should only be used when building the "fiddle" web application, as
8880
** the browser-mode build has much different user input requirements
8981
** and this build mode rewires the user input subsystem to account for
9082
** that.
9183
*/
84
+#if defined(SQLITE_SHELL_FIDDLE)
85
+# undef SQLITE_OMIT_LOAD_EXTENSION
86
+# define SQLITE_OMIT_LOAD_EXTENSION 1
87
+#endif
9288
9389
/*
9490
** Warning pragmas copied from msvc.h in the core.
9591
*/
9692
#if defined(_MSC_VER)
@@ -218,13 +214,10 @@
218214
# define deliberate_fall_through
219215
# endif
220216
#endif
221217
222218
#if defined(_WIN32) || defined(WIN32)
223
-# if SQLITE_OS_WINRT
224
-# define SQLITE_OMIT_POPEN 1
225
-# else
226219
# include <io.h>
227220
# include <fcntl.h>
228221
# define isatty(h) _isatty(h)
229222
# ifndef access
230223
# define access(f,m) _access((f),(m))
@@ -235,11 +228,10 @@
235228
# ifndef strdup
236229
# define strdup _strdup
237230
# endif
238231
# undef pclose
239232
# define pclose _pclose
240
-# endif
241233
#else
242234
/* Make sure isatty() has a prototype. */
243235
extern int isatty(int);
244236
245237
# if !defined(__RTP__) && !defined(_WRS_KERNEL) && !defined(SQLITE_WASI)
@@ -266,13 +258,10 @@
266258
#define ToLower(X) (char)tolower((unsigned char)X)
267259
#define IsAlnum(X) isalnum((unsigned char)X)
268260
#define IsAlpha(X) isalpha((unsigned char)X)
269261
270262
#if defined(_WIN32) || defined(WIN32)
271
-#if SQLITE_OS_WINRT
272
-#include <intrin.h>
273
-#endif
274263
#undef WIN32_LEAN_AND_MEAN
275264
#define WIN32_LEAN_AND_MEAN
276265
#include <windows.h>
277266
278267
/* string conversion routines only needed on Win32 */
@@ -704,13 +693,15 @@
704693
unsigned char bWordWrap; /* Try to wrap on word boundaries */
705694
unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
706695
unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
707696
unsigned char eTitleAlign; /* Alignment for column headers */
708697
unsigned char bSplitColumn; /* Wrap single-column output into many columns */
698
+ unsigned char bBorder; /* Show outer border in Box and Table styles */
709699
short int nWrap; /* Wrap columns wider than this */
710700
short int nScreenWidth; /* Maximum overall table width */
711701
short int nLineLimit; /* Maximum number of lines for any row */
702
+ short int nTitleLimit; /* Maximum number of characters in a title */
712703
int nCharLimit; /* Maximum number of characters in a cell */
713704
int nWidth; /* Number of entries in aWidth[] */
714705
int nAlign; /* Number of entries in aAlignment[] */
715706
short int *aWidth; /* Column widths */
716707
unsigned char *aAlign; /* Column alignments */
@@ -775,10 +766,11 @@
775766
#define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
776767
#define QRF_TEXT_Csv 3 /* CSV-style quoting */
777768
#define QRF_TEXT_Html 4 /* HTML-style quoting */
778769
#define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
779770
#define QRF_TEXT_Json 6 /* JSON quoting */
771
+#define QRF_TEXT_Relaxed 7 /* Relaxed SQL quoting */
780772
781773
/*
782774
** Quoting styles for BLOBs
783775
** Allowed values for sqlite3_qrf_spec.eBlob
784776
*/
@@ -842,17 +834,25 @@
842834
/*
843835
** Return an estimate of the width, in columns, for the single Unicode
844836
** character c. For normal characters, the answer is always 1. But the
845837
** estimate might be 0 or 2 for zero-width and double-width characters.
846838
**
847
-** Different display devices display unicode using different widths. So
839
+** Different devices display unicode using different widths. So
848840
** it is impossible to know that true display width with 100% accuracy.
849841
** Inaccuracies in the width estimates might cause columns to be misaligned.
850842
** Unfortunately, there is nothing we can do about that.
851843
*/
852844
int sqlite3_qrf_wcwidth(int c);
853845
846
+/*
847
+** Return an estimate of the number of display columns used by the
848
+** string in the argument. The width of individual characters is
849
+** determined as for sqlite3_qrf_wcwidth(). VT100 escape code sequences
850
+** are assigned a width of zero.
851
+*/
852
+size_t sqlite3_qrf_wcswidth(const char*);
853
+
854854
855855
#ifdef __cplusplus
856856
}
857857
#endif
858858
#endif /* !defined(SQLITE_QRF_H) */
@@ -915,11 +915,11 @@
915915
int mxWidth; /* Screen width */
916916
int mxHeight; /* nLineLimit */
917917
union {
918918
struct { /* Content for QRF_STYLE_Line */
919919
int mxColWth; /* Maximum display width of any column */
920
- const char **azCol; /* Names of output columns (MODE_Line) */
920
+ char **azCol; /* Names of output columns (MODE_Line) */
921921
} sLine;
922922
qrfEQPGraph *pGraph; /* EQP graph (Eqp, Stats, and StatsEst) */
923923
struct { /* Content for QRF_STYLE_Explain */
924924
int nIndent; /* Slots allocated for aiIndent */
925925
int iIndent; /* Current slot */
@@ -961,10 +961,19 @@
961961
#define qrfSpace(x) ((qrfCType[(unsigned char)x]&1)!=0)
962962
#define qrfDigit(x) ((qrfCType[(unsigned char)x]&2)!=0)
963963
#define qrfAlpha(x) ((qrfCType[(unsigned char)x]&4)!=0)
964964
#define qrfAlnum(x) ((qrfCType[(unsigned char)x]&6)!=0)
965965
966
+#ifndef deliberate_fall_through
967
+/* Quiet some compilers about some of our intentional code. */
968
+# if defined(GCC_VERSION) && GCC_VERSION>=7000000
969
+# define deliberate_fall_through __attribute__((fallthrough));
970
+# else
971
+# define deliberate_fall_through
972
+# endif
973
+#endif
974
+
966975
/*
967976
** Set an error code and error message.
968977
*/
969978
static void qrfError(
970979
Qrf *p, /* Query result state */
@@ -990,10 +999,19 @@
990999
*/
9911000
static void qrfOom(Qrf *p){
9921001
qrfError(p, SQLITE_NOMEM, "out of memory");
9931002
}
9941003
1004
+/*
1005
+** Transfer any error in pStr over into p.
1006
+*/
1007
+static void qrfStrErr(Qrf *p, sqlite3_str *pStr){
1008
+ int rc = pStr ? sqlite3_str_errcode(pStr) : 0;
1009
+ if( rc ){
1010
+ qrfError(p, rc, sqlite3_errstr(rc));
1011
+ }
1012
+}
9951013
9961014
9971015
/*
9981016
** Add a new entry to the EXPLAIN QUERY PLAN data
9991017
*/
@@ -1212,11 +1230,13 @@
12121230
sqlite3_str_reset(pLine);
12131231
}else{
12141232
qrfEqpAppend(p, iId, iPid, zo);
12151233
}
12161234
}
1235
+ qrfStrErr(p, pLine);
12171236
sqlite3_free(sqlite3_str_finish(pLine));
1237
+ qrfStrErr(p, pStats);
12181238
sqlite3_free(sqlite3_str_finish(pStats));
12191239
#endif
12201240
}
12211241
12221242
@@ -1287,11 +1307,11 @@
12871307
{1, 0x00ece}, {0, 0x00f18}, {1, 0x00f1a}, {0, 0x00f35}, {1, 0x00f36},
12881308
{0, 0x00f37}, {1, 0x00f38}, {0, 0x00f39}, {1, 0x00f3a}, {0, 0x00f71},
12891309
{1, 0x00f7f}, {0, 0x00f80}, {1, 0x00f85}, {0, 0x00f86}, {1, 0x00f88},
12901310
{0, 0x00f90}, {1, 0x00f98}, {0, 0x00f99}, {1, 0x00fbd}, {0, 0x00fc6},
12911311
{1, 0x00fc7}, {0, 0x0102d}, {1, 0x01031}, {0, 0x01032}, {1, 0x01033},
1292
- {0, 0x01036}, {1, 0x01038}, {0, 0x01039}, {1, 0x0103a}, {0, 0x01058},
1312
+ {0, 0x01036}, {1, 0x0103b}, {0, 0x01058},
12931313
{1, 0x0105a}, {2, 0x01100}, {0, 0x01160}, {1, 0x01200}, {0, 0x0135f},
12941314
{1, 0x01360}, {0, 0x01712}, {1, 0x01715}, {0, 0x01732}, {1, 0x01735},
12951315
{0, 0x01752}, {1, 0x01754}, {0, 0x01772}, {1, 0x01774}, {0, 0x017b4},
12961316
{1, 0x017b6}, {0, 0x017b7}, {1, 0x017be}, {0, 0x017c6}, {1, 0x017c7},
12971317
{0, 0x017c9}, {1, 0x017d4}, {0, 0x017dd}, {1, 0x017de}, {0, 0x0180b},
@@ -1330,11 +1350,11 @@
13301350
*/
13311351
int sqlite3_qrf_wcwidth(int c){
13321352
int iFirst, iLast;
13331353
13341354
/* Fast path for common characters */
1335
- if( c<=0x300 ) return 1;
1355
+ if( c<0x300 ) return 1;
13361356
13371357
/* The general case */
13381358
iFirst = 0;
13391359
iLast = sizeof(aQrfUWidth)/sizeof(aQrfUWidth[0]) - 1;
13401360
while( iFirst<iLast-1 ){
@@ -1396,17 +1416,24 @@
13961416
return i+1;
13971417
}
13981418
13991419
/*
14001420
** Return the length of a string in display characters.
1401
-** Multibyte UTF8 characters count as a single character
1402
-** for single-width characters, or as two characters for
1403
-** double-width characters.
1421
+**
1422
+** Most characters of the input string count as 1, including
1423
+** multi-byte UTF8 characters. However, zero-width unicode
1424
+** characters and VT100 escape sequences count as zero, and
1425
+** double-width characters count as two.
1426
+**
1427
+** The definition of "zero-width" and "double-width" characters
1428
+** is not precise. It depends on the output device, to some extent,
1429
+** and it varies according to the Unicode version. This routine
1430
+** makes the best guess that it can.
14041431
*/
1405
-static int qrfDisplayLength(const char *zIn){
1432
+size_t sqlite3_qrf_wcswidth(const char *zIn){
14061433
const unsigned char *z = (const unsigned char*)zIn;
1407
- int n = 0;
1434
+ size_t n = 0;
14081435
while( *z ){
14091436
if( z[0]<' ' ){
14101437
int k;
14111438
if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
14121439
z += k;
@@ -1436,15 +1463,18 @@
14361463
** Write the number of newlines into *pnNL. So, *pnNL will
14371464
** return 0 if everything fits on one line, or positive it
14381465
** it will need to be split.
14391466
*/
14401467
static int qrfDisplayWidth(const char *zIn, sqlite3_int64 nByte, int *pnNL){
1441
- const unsigned char *z = (const unsigned char*)zIn;
1442
- const unsigned char *zEnd = &z[nByte];
1468
+ const unsigned char *z;
1469
+ const unsigned char *zEnd;
14431470
int mx = 0;
14441471
int n = 0;
14451472
int nNL = 0;
1473
+ if( zIn==0 ) zIn = "";
1474
+ z = (const unsigned char*)zIn;
1475
+ zEnd = &z[nByte];
14461476
while( z<zEnd ){
14471477
if( z[0]<' ' ){
14481478
int k;
14491479
if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
14501480
z += k;
@@ -1551,10 +1581,51 @@
15511581
zOut[j++] = '^';
15521582
zOut[j++] = 0x40+c;
15531583
}
15541584
}
15551585
}
1586
+
1587
+/*
1588
+** Determine if the string z[] can be shown as plain text. Return true
1589
+** if z[] is unambiguously text. Return false if z[] needs to be
1590
+** quoted.
1591
+**
1592
+** All of the following must be true in order for z[] to be relaxable:
1593
+**
1594
+** (1) z[] does not begin or end with ' or whitespace
1595
+** (2) z[] is not the same as the NULL rendering
1596
+** (3) z[] does not looks like a numeric literal
1597
+*/
1598
+static int qrfRelaxable(Qrf *p, const char *z){
1599
+ size_t i, n;
1600
+ if( z[0]=='\'' || qrfSpace(z[0]) ) return 0;
1601
+ if( z[0]==0 ){
1602
+ return (p->spec.zNull!=0 && p->spec.zNull[0]!=0);
1603
+ }
1604
+ n = strlen(z);
1605
+ if( n==0 || z[n-1]=='\'' || qrfSpace(z[n-1]) ) return 0;
1606
+ if( p->spec.zNull && strcmp(p->spec.zNull,z)==0 ) return 0;
1607
+ i = (z[0]=='-' || z[0]=='+');
1608
+ if( strcmp(z+i,"Inf")==0 ) return 0;
1609
+ if( !qrfDigit(z[i]) ) return 1;
1610
+ i++;
1611
+ while( qrfDigit(z[i]) ){ i++; }
1612
+ if( z[i]==0 ) return 0;
1613
+ if( z[i]=='.' ){
1614
+ i++;
1615
+ while( qrfDigit(z[i]) ){ i++; }
1616
+ if( z[i]==0 ) return 0;
1617
+ }
1618
+ if( z[i]=='e' || z[i]=='E' ){
1619
+ i++;
1620
+ if( z[i]=='+' || z[i]=='-' ){ i++; }
1621
+ if( !qrfDigit(z[i]) ) return 1;
1622
+ i++;
1623
+ while( qrfDigit(z[i]) ){ i++; }
1624
+ }
1625
+ return z[i]!=0;
1626
+}
15561627
15571628
/*
15581629
** If a field contains any character identified by a 1 in the following
15591630
** array, then the string must be quoted for CSV.
15601631
*/
@@ -1581,10 +1652,16 @@
15811652
** Encode text appropriately and append it to pOut.
15821653
*/
15831654
static void qrfEncodeText(Qrf *p, sqlite3_str *pOut, const char *zTxt){
15841655
int iStart = sqlite3_str_length(pOut);
15851656
switch( p->spec.eText ){
1657
+ case QRF_TEXT_Relaxed:
1658
+ if( qrfRelaxable(p, zTxt) ){
1659
+ sqlite3_str_appendall(pOut, zTxt);
1660
+ break;
1661
+ }
1662
+ deliberate_fall_through; /* FALLTHRU */
15861663
case QRF_TEXT_Sql: {
15871664
if( p->spec.eEsc==QRF_ESC_Off ){
15881665
sqlite3_str_appendf(pOut, "%Q", zTxt);
15891666
}else{
15901667
sqlite3_str_appendf(pOut, "%#Q", zTxt);
@@ -1739,10 +1816,57 @@
17391816
return (const char*)sqlite3_column_text(p->pJTrans, 0);
17401817
}else{
17411818
return 0;
17421819
}
17431820
}
1821
+
1822
+/*
1823
+** Adjust the input string zIn[] such that it is no more than N display
1824
+** characters wide. If it is wider than that, then truncate and add
1825
+** ellipsis. Or if zIn[] contains a \r or \n, truncate at that point,
1826
+** adding ellipsis. Embedded tabs in zIn[] are converted into ordinary
1827
+** spaces.
1828
+**
1829
+** Return this display width of the modified title string.
1830
+*/
1831
+static int qrfTitleLimit(char *zIn, int N){
1832
+ unsigned char *z = (unsigned char*)zIn;
1833
+ int n = 0;
1834
+ unsigned char *zEllipsis = 0;
1835
+ while( 1 /*exit-by-break*/ ){
1836
+ if( z[0]<' ' ){
1837
+ int k;
1838
+ if( z[0]==0 ){
1839
+ zEllipsis = 0;
1840
+ break;
1841
+ }else if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
1842
+ z += k;
1843
+ }else if( z[0]=='\t' ){
1844
+ z[0] = ' ';
1845
+ }else if( z[0]=='\n' || z[0]=='\r' ){
1846
+ z[0] = ' ';
1847
+ }else{
1848
+ z++;
1849
+ }
1850
+ }else if( (0x80&z[0])==0 ){
1851
+ if( n>=(N-3) && zEllipsis==0 ) zEllipsis = z;
1852
+ if( n==N ){ z[0] = 0; break; }
1853
+ n++;
1854
+ z++;
1855
+ }else{
1856
+ int u = 0;
1857
+ int len = sqlite3_qrf_decode_utf8(z, &u);
1858
+ if( n+len>(N-3) && zEllipsis==0 ) zEllipsis = z;
1859
+ if( n+len>N ){ z[0] = 0; break; }
1860
+ z += len;
1861
+ n += sqlite3_qrf_wcwidth(u);
1862
+ }
1863
+ }
1864
+ if( zEllipsis && N>=3 ) memcpy(zEllipsis,"...",4);
1865
+ return n;
1866
+}
1867
+
17441868
17451869
/*
17461870
** Render value pVal into pOut
17471871
*/
17481872
static void qrfRenderValue(Qrf *p, sqlite3_str *pOut, int iCol){
@@ -2124,40 +2248,10 @@
21242248
}
21252249
}
21262250
sqlite3_str_append(pOut, (const char*)z, i);
21272251
}
21282252
2129
-/*
2130
-** Output horizontally justified text into pOut. The text is the
2131
-** first nVal bytes of zVal. Include nWS bytes of whitespace, either
2132
-** split between both sides, or on the left, or on the right, depending
2133
-** on eAlign.
2134
-*/
2135
-static void qrfPrintAligned(
2136
- sqlite3_str *pOut, /* Append text here */
2137
- const char *zVal, /* Text to append */
2138
- int nVal, /* Use only the first nVal bytes of zVal[] */
2139
- int nWS, /* Whitespace for horizonal alignment */
2140
- unsigned char eAlign /* Alignment type */
2141
-){
2142
- eAlign &= QRF_ALIGN_HMASK;
2143
- if( eAlign==QRF_ALIGN_Center ){
2144
- /* Center the text */
2145
- sqlite3_str_appendchar(pOut, nWS/2, ' ');
2146
- qrfAppendWithTabs(pOut, zVal, nVal);
2147
- sqlite3_str_appendchar(pOut, nWS - nWS/2, ' ');
2148
- }else if( eAlign==QRF_ALIGN_Right){
2149
- /* Right justify the text */
2150
- sqlite3_str_appendchar(pOut, nWS, ' ');
2151
- qrfAppendWithTabs(pOut, zVal, nVal);
2152
- }else{
2153
- /* Left justify the next */
2154
- qrfAppendWithTabs(pOut, zVal, nVal);
2155
- sqlite3_str_appendchar(pOut, nWS, ' ');
2156
- }
2157
-}
2158
-
21592253
/*
21602254
** GCC does not define the offsetof() macro so we'll have to do it
21612255
** ourselves.
21622256
*/
21632257
#ifndef offsetof
@@ -2177,27 +2271,60 @@
21772271
sqlite3_int64 nRow; /* Number of rows */
21782272
sqlite3_int64 nAlloc; /* Number of cells allocated */
21792273
sqlite3_int64 n; /* Number of cells. nCol*nRow */
21802274
char **az; /* Content of all cells */
21812275
int *aiWth; /* Width of each cell */
2276
+ unsigned char *abNum; /* True for each numeric cell */
21822277
struct qrfPerCol { /* Per-column data */
21832278
char *z; /* Cache of text for current row */
21842279
int w; /* Computed width of this column */
21852280
int mxW; /* Maximum natural (unwrapped) width */
21862281
unsigned char e; /* Alignment */
21872282
unsigned char fx; /* Width is fixed */
2283
+ unsigned char bNum; /* True if is numeric */
21882284
} *a; /* One per column */
21892285
};
2286
+
2287
+/*
2288
+** Output horizontally justified text into pOut. The text is the
2289
+** first nVal bytes of zVal. Include nWS bytes of whitespace, either
2290
+** split between both sides, or on the left, or on the right, depending
2291
+** on eAlign.
2292
+*/
2293
+static void qrfPrintAligned(
2294
+ sqlite3_str *pOut, /* Append text here */
2295
+ struct qrfPerCol *pCol, /* Information about the text to print */
2296
+ int nVal, /* Use only the first nVal bytes of zVal[] */
2297
+ int nWS /* Whitespace for horizonal alignment */
2298
+){
2299
+ unsigned char eAlign = pCol->e & QRF_ALIGN_HMASK;
2300
+ if( eAlign==QRF_Auto && pCol->bNum ) eAlign = QRF_ALIGN_Right;
2301
+ if( eAlign==QRF_ALIGN_Center ){
2302
+ /* Center the text */
2303
+ sqlite3_str_appendchar(pOut, nWS/2, ' ');
2304
+ qrfAppendWithTabs(pOut, pCol->z, nVal);
2305
+ sqlite3_str_appendchar(pOut, nWS - nWS/2, ' ');
2306
+ }else if( eAlign==QRF_ALIGN_Right ){
2307
+ /* Right justify the text */
2308
+ sqlite3_str_appendchar(pOut, nWS, ' ');
2309
+ qrfAppendWithTabs(pOut, pCol->z, nVal);
2310
+ }else{
2311
+ /* Left justify the text */
2312
+ qrfAppendWithTabs(pOut, pCol->z, nVal);
2313
+ sqlite3_str_appendchar(pOut, nWS, ' ');
2314
+ }
2315
+}
21902316
21912317
/*
21922318
** Free all the memory allocates in the qrfColData object
21932319
*/
21942320
static void qrfColDataFree(qrfColData *p){
21952321
sqlite3_int64 i;
21962322
for(i=0; i<p->n; i++) sqlite3_free(p->az[i]);
21972323
sqlite3_free(p->az);
21982324
sqlite3_free(p->aiWth);
2325
+ sqlite3_free(p->abNum);
21992326
sqlite3_free(p->a);
22002327
memset(p, 0, sizeof(*p));
22012328
}
22022329
22032330
/*
@@ -2205,10 +2332,11 @@
22052332
** Return non-zero if a memory allocation fails.
22062333
*/
22072334
static int qrfColDataEnlarge(qrfColData *p){
22082335
char **azData;
22092336
int *aiWth;
2337
+ unsigned char *abNum;
22102338
p->nAlloc = 2*p->nAlloc + 10*p->nCol;
22112339
azData = sqlite3_realloc64(p->az, p->nAlloc*sizeof(char*));
22122340
if( azData==0 ){
22132341
qrfOom(p->p);
22142342
qrfColDataFree(p);
@@ -2220,26 +2348,38 @@
22202348
qrfOom(p->p);
22212349
qrfColDataFree(p);
22222350
return 1;
22232351
}
22242352
p->aiWth = aiWth;
2353
+ abNum = sqlite3_realloc64(p->abNum, p->nAlloc);
2354
+ if( abNum==0 ){
2355
+ qrfOom(p->p);
2356
+ qrfColDataFree(p);
2357
+ return 1;
2358
+ }
2359
+ p->abNum = abNum;
22252360
return 0;
22262361
}
22272362
22282363
/*
22292364
** Print a markdown or table-style row separator using ascii-art
22302365
*/
22312366
static void qrfRowSeparator(sqlite3_str *pOut, qrfColData *p, char cSep){
22322367
int i;
22332368
if( p->nCol>0 ){
2234
- sqlite3_str_append(pOut, &cSep, 1);
2369
+ int useBorder = p->p->spec.bBorder!=QRF_No;
2370
+ if( useBorder ){
2371
+ sqlite3_str_append(pOut, &cSep, 1);
2372
+ }
22352373
sqlite3_str_appendchar(pOut, p->a[0].w+p->nMargin, '-');
22362374
for(i=1; i<p->nCol; i++){
22372375
sqlite3_str_append(pOut, &cSep, 1);
22382376
sqlite3_str_appendchar(pOut, p->a[i].w+p->nMargin, '-');
22392377
}
2240
- sqlite3_str_append(pOut, &cSep, 1);
2378
+ if( useBorder ){
2379
+ sqlite3_str_append(pOut, &cSep, 1);
2380
+ }
22412381
}
22422382
sqlite3_str_append(pOut, "\n", 1);
22432383
}
22442384
22452385
/*
@@ -2265,24 +2405,37 @@
22652405
#define BOX_134 "\342\224\244" /* U+2524 -| */
22662406
#define BOX_234 "\342\224\254" /* U+252c -,- */
22672407
#define BOX_124 "\342\224\264" /* U+2534 -'- */
22682408
#define BOX_1234 "\342\224\274" /* U+253c -|- */
22692409
2410
+/* Rounded corners: */
2411
+#define BOX_R12 "\342\225\260" /* U+2570 '- */
2412
+#define BOX_R23 "\342\225\255" /* U+256d ,- */
2413
+#define BOX_R34 "\342\225\256" /* U+256e -, */
2414
+#define BOX_R14 "\342\225\257" /* U+256f -' */
2415
+
2416
+/* Doubled horizontal lines: */
2417
+#define DBL_24 "\342\225\220" /* U+2550 === */
2418
+#define DBL_123 "\342\225\236" /* U+255e |= */
2419
+#define DBL_134 "\342\225\241" /* U+2561 =| */
2420
+#define DBL_1234 "\342\225\252" /* U+256a =|= */
2421
+
22702422
/* Draw horizontal line N characters long using unicode box
22712423
** characters
22722424
*/
2273
-static void qrfBoxLine(sqlite3_str *pOut, int N){
2274
- const char zDash[] =
2275
- BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24
2276
- BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24;
2277
- const int nDash = sizeof(zDash) - 1;
2425
+static void qrfBoxLine(sqlite3_str *pOut, int N, int bDbl){
2426
+ const char *azDash[2] = {
2427
+ BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24,
2428
+ DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24
2429
+ };/* 0 1 2 3 4 5 6 7 8 9 */
2430
+ const int nDash = 30;
22782431
N *= 3;
22792432
while( N>nDash ){
2280
- sqlite3_str_append(pOut, zDash, nDash);
2433
+ sqlite3_str_append(pOut, azDash[bDbl], nDash);
22812434
N -= nDash;
22822435
}
2283
- sqlite3_str_append(pOut, zDash, N);
2436
+ sqlite3_str_append(pOut, azDash[bDbl], N);
22842437
}
22852438
22862439
/*
22872440
** Draw a horizontal separator for a QRF_STYLE_Box table.
22882441
*/
@@ -2289,21 +2442,27 @@
22892442
static void qrfBoxSeparator(
22902443
sqlite3_str *pOut,
22912444
qrfColData *p,
22922445
const char *zSep1,
22932446
const char *zSep2,
2294
- const char *zSep3
2447
+ const char *zSep3,
2448
+ int bDbl
22952449
){
22962450
int i;
22972451
if( p->nCol>0 ){
2298
- sqlite3_str_appendall(pOut, zSep1);
2299
- qrfBoxLine(pOut, p->a[0].w+p->nMargin);
2452
+ int useBorder = p->p->spec.bBorder!=QRF_No;
2453
+ if( useBorder ){
2454
+ sqlite3_str_appendall(pOut, zSep1);
2455
+ }
2456
+ qrfBoxLine(pOut, p->a[0].w+p->nMargin, bDbl);
23002457
for(i=1; i<p->nCol; i++){
23012458
sqlite3_str_appendall(pOut, zSep2);
2302
- qrfBoxLine(pOut, p->a[i].w+p->nMargin);
2459
+ qrfBoxLine(pOut, p->a[i].w+p->nMargin, bDbl);
23032460
}
2304
- sqlite3_str_appendall(pOut, zSep3);
2461
+ if( useBorder ){
2462
+ sqlite3_str_appendall(pOut, zSep3);
2463
+ }
23052464
}
23062465
sqlite3_str_append(pOut, "\n", 1);
23072466
}
23082467
23092468
/*
@@ -2382,10 +2541,11 @@
23822541
static void qrfSplitColumn(qrfColData *pData, Qrf *p){
23832542
int nCol = 1;
23842543
int *aw = 0;
23852544
char **az = 0;
23862545
int *aiWth = 0;
2546
+ unsigned char *abNum = 0;
23872547
int nColNext = 2;
23882548
int w;
23892549
struct qrfPerCol *a = 0;
23902550
sqlite3_int64 nRow = 1;
23912551
sqlite3_int64 i;
@@ -2419,35 +2579,47 @@
24192579
if( a==0 ){
24202580
sqlite3_free(az);
24212581
sqlite3_free(aiWth);
24222582
qrfOom(p);
24232583
return;
2584
+ }
2585
+ abNum = sqlite3_malloc64( nRow*nCol );
2586
+ if( abNum==0 ){
2587
+ sqlite3_free(az);
2588
+ sqlite3_free(aiWth);
2589
+ sqlite3_free(a);
2590
+ qrfOom(p);
2591
+ return;
24242592
}
24252593
for(i=0; i<pData->n; i++){
24262594
sqlite3_int64 j = (i%nRow)*nCol + (i/nRow);
24272595
az[j] = pData->az[i];
2596
+ abNum[j]= pData->abNum[i];
24282597
pData->az[i] = 0;
24292598
aiWth[j] = pData->aiWth[i];
24302599
}
24312600
while( i<nRow*nCol ){
24322601
sqlite3_int64 j = (i%nRow)*nCol + (i/nRow);
24332602
az[j] = sqlite3_mprintf("");
24342603
if( az[j]==0 ) qrfOom(p);
24352604
aiWth[j] = 0;
2605
+ abNum[j] = 0;
24362606
i++;
24372607
}
24382608
for(i=0; i<nCol; i++){
24392609
a[i].fx = a[i].mxW = a[i].w = aw[i];
24402610
a[i].e = pData->a[0].e;
24412611
}
24422612
sqlite3_free(pData->az);
24432613
sqlite3_free(pData->aiWth);
24442614
sqlite3_free(pData->a);
2615
+ sqlite3_free(pData->abNum);
24452616
sqlite3_free(aw);
24462617
pData->az = az;
24472618
pData->aiWth = aiWth;
24482619
pData->a = a;
2620
+ pData->abNum = abNum;
24492621
pData->nCol = nCol;
24502622
pData->n = pData->nAlloc = nRow*nCol;
24512623
for(i=w=0; i<nCol; i++) w += a[i].w;
24522624
pData->nMargin = (p->spec.nScreenWidth - w)/(nCol - 1);
24532625
if( pData->nMargin>5 ) pData->nMargin = 5;
@@ -2467,10 +2639,11 @@
24672639
if( p->spec.nScreenWidth==0 ) return;
24682640
if( p->spec.eStyle==QRF_STYLE_Column ){
24692641
sepW = pData->nCol*2 - 2;
24702642
}else{
24712643
sepW = pData->nCol*3 + 1;
2644
+ if( p->spec.bBorder==QRF_No ) sepW -= 2;
24722645
}
24732646
nCol = pData->nCol;
24742647
for(i=sumW=0; i<nCol; i++) sumW += pData->a[i].w;
24752648
if( p->spec.nScreenWidth >= sumW+sepW ) return;
24762649
@@ -2478,10 +2651,11 @@
24782651
pData->nMargin = 0;
24792652
if( p->spec.eStyle==QRF_STYLE_Column ){
24802653
sepW = pData->nCol - 1;
24812654
}else{
24822655
sepW = pData->nCol + 1;
2656
+ if( p->spec.bBorder==QRF_No ) sepW -= 2;
24832657
}
24842658
targetW = p->spec.nScreenWidth - sepW;
24852659
24862660
#define MIN_SQUOZE 8
24872661
#define MIN_EX_SQUOZE 16
@@ -2550,10 +2724,11 @@
25502724
}
25512725
25522726
/* Initialize the data container */
25532727
memset(&data, 0, sizeof(data));
25542728
data.nCol = p->nCol;
2729
+ data.p = p;
25552730
data.a = sqlite3_malloc64( nColumn*sizeof(struct qrfPerCol) );
25562731
if( data.a==0 ){
25572732
qrfOom(p);
25582733
return;
25592734
}
@@ -2563,19 +2738,27 @@
25632738
25642739
/* Load the column header names and all cell content into data */
25652740
if( p->spec.bTitles==QRF_Yes ){
25662741
unsigned char saved_eText = p->spec.eText;
25672742
p->spec.eText = p->spec.eTitle;
2743
+ memset(data.abNum, 0, nColumn);
25682744
for(i=0; i<nColumn; i++){
25692745
const char *z = (const char*)sqlite3_column_name(p->pStmt,i);
25702746
int nNL = 0;
25712747
int n, w;
25722748
pStr = sqlite3_str_new(p->db);
25732749
qrfEncodeText(p, pStr, z ? z : "");
25742750
n = sqlite3_str_length(pStr);
2751
+ qrfStrErr(p, pStr);
25752752
z = data.az[data.n] = sqlite3_str_finish(pStr);
2576
- data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
2753
+ if( p->spec.nTitleLimit ){
2754
+ nNL = 0;
2755
+ data.aiWth[data.n] = w = qrfTitleLimit(data.az[data.n],
2756
+ p->spec.nTitleLimit );
2757
+ }else{
2758
+ data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
2759
+ }
25772760
data.n++;
25782761
if( w>data.a[i].mxW ) data.a[i].mxW = w;
25792762
if( nNL ) data.bMultiRow = 1;
25802763
}
25812764
p->spec.eText = saved_eText;
@@ -2587,14 +2770,17 @@
25872770
}
25882771
for(i=0; i<nColumn; i++){
25892772
char *z;
25902773
int nNL = 0;
25912774
int n, w;
2775
+ int eType = sqlite3_column_type(p->pStmt,i);
25922776
pStr = sqlite3_str_new(p->db);
25932777
qrfRenderValue(p, pStr, i);
25942778
n = sqlite3_str_length(pStr);
2779
+ qrfStrErr(p, pStr);
25952780
z = data.az[data.n] = sqlite3_str_finish(pStr);
2781
+ data.abNum[data.n] = eType==SQLITE_INTEGER || eType==SQLITE_FLOAT;
25962782
data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
25972783
data.n++;
25982784
if( w>data.a[i].mxW ) data.a[i].mxW = w;
25992785
if( nNL ) data.bMultiRow = 1;
26002786
}
@@ -2680,11 +2866,16 @@
26802866
}else{
26812867
rowStart = BOX_13;
26822868
colSep = BOX_13;
26832869
rowSep = BOX_13 "\n";
26842870
}
2685
- qrfBoxSeparator(p->pOut, &data, BOX_23, BOX_234, BOX_34);
2871
+ if( p->spec.bBorder==QRF_No){
2872
+ rowStart += 3;
2873
+ rowSep = "\n";
2874
+ }else{
2875
+ qrfBoxSeparator(p->pOut, &data, BOX_R23, BOX_234, BOX_R34, 0);
2876
+ }
26862877
break;
26872878
case QRF_STYLE_Table:
26882879
if( data.nMargin ){
26892880
rowStart = "| ";
26902881
colSep = " | ";
@@ -2692,11 +2883,16 @@
26922883
}else{
26932884
rowStart = "|";
26942885
colSep = "|";
26952886
rowSep = "|\n";
26962887
}
2697
- qrfRowSeparator(p->pOut, &data, '+');
2888
+ if( p->spec.bBorder==QRF_No ){
2889
+ rowStart += 1;
2890
+ rowSep = "\n";
2891
+ }else{
2892
+ qrfRowSeparator(p->pOut, &data, '+');
2893
+ }
26982894
break;
26992895
case QRF_STYLE_Column: {
27002896
static const char zSpace[] = " ";
27012897
rowStart = "";
27022898
if( data.nMargin<2 ){
@@ -2724,20 +2920,32 @@
27242920
szRowStart = (int)strlen(rowStart);
27252921
szRowSep = (int)strlen(rowSep);
27262922
szColSep = (int)strlen(colSep);
27272923
27282924
bWW = (p->spec.bWordWrap==QRF_Yes && data.bMultiRow);
2729
- bRTrim = (p->spec.eStyle==QRF_STYLE_Column);
2730
- for(i=0; i<data.n; i+=nColumn){
2925
+ if( p->spec.eStyle==QRF_STYLE_Column
2926
+ || (p->spec.bBorder==QRF_No
2927
+ && (p->spec.eStyle==QRF_STYLE_Box || p->spec.eStyle==QRF_STYLE_Table)
2928
+ )
2929
+ ){
2930
+ bRTrim = 1;
2931
+ }else{
2932
+ bRTrim = 0;
2933
+ }
2934
+ for(i=0; i<data.n && sqlite3_str_errcode(p->pOut)==SQLITE_OK; i+=nColumn){
27312935
int bMore;
27322936
int nRow = 0;
27332937
27342938
/* Draw a single row of the table. This might be the title line
27352939
** (if there is a title line) or a row in the body of the table.
27362940
** The column number will be j. The row number is i/nColumn.
27372941
*/
2738
- for(j=0; j<nColumn; j++){ data.a[j].z = data.az[i+j]; }
2942
+ for(j=0; j<nColumn; j++){
2943
+ data.a[j].z = data.az[i+j];
2944
+ if( data.a[j].z==0 ) data.a[j].z = "";
2945
+ data.a[j].bNum = data.abNum[i+j];
2946
+ }
27392947
do{
27402948
sqlite3_str_append(p->pOut, rowStart, szRowStart);
27412949
bMore = 0;
27422950
for(j=0; j<nColumn; j++){
27432951
int nThis = 0;
@@ -2744,11 +2952,11 @@
27442952
int nWide = 0;
27452953
int iNext = 0;
27462954
int nWS;
27472955
qrfWrapLine(data.a[j].z, data.a[j].w, bWW, &nThis, &nWide, &iNext);
27482956
nWS = data.a[j].w - nWide;
2749
- qrfPrintAligned(p->pOut, data.a[j].z, nThis, nWS, data.a[j].e);
2957
+ qrfPrintAligned(p->pOut, &data.a[j], nThis, nWS);
27502958
data.a[j].z += iNext;
27512959
if( data.a[j].z[0]!=0 ){
27522960
bMore = 1;
27532961
}
27542962
if( j<nColumn-1 ){
@@ -2766,11 +2974,12 @@
27662974
if( data.a[j].z[0]==0 ){
27672975
sqlite3_str_appendchar(p->pOut, data.a[j].w, ' ');
27682976
}else{
27692977
int nE = 3;
27702978
if( nE>data.a[j].w ) nE = data.a[j].w;
2771
- qrfPrintAligned(p->pOut, "...", nE, data.a[j].w-nE, data.a[j].e);
2979
+ data.a[j].z = "...";
2980
+ qrfPrintAligned(p->pOut, &data.a[j], nE, data.a[j].w-nE);
27722981
}
27732982
if( j<nColumn-1 ){
27742983
sqlite3_str_append(p->pOut, colSep, szColSep);
27752984
}else{
27762985
if( bRTrim ) qrfRTrim(p->pOut);
@@ -2794,12 +3003,14 @@
27943003
qrfRowSeparator(p->pOut, &data, '+');
27953004
}
27963005
break;
27973006
}
27983007
case QRF_STYLE_Box: {
2799
- if( isTitleDataSeparator || data.bMultiRow ){
2800
- qrfBoxSeparator(p->pOut, &data, BOX_123, BOX_1234, BOX_134);
3008
+ if( isTitleDataSeparator ){
3009
+ qrfBoxSeparator(p->pOut, &data, DBL_123, DBL_1234, DBL_134, 1);
3010
+ }else if( data.bMultiRow ){
3011
+ qrfBoxSeparator(p->pOut, &data, BOX_123, BOX_1234, BOX_134, 0);
28013012
}
28023013
break;
28033014
}
28043015
case QRF_STYLE_Markdown: {
28053016
if( isTitleDataSeparator ){
@@ -2827,17 +3038,19 @@
28273038
}
28283039
}
28293040
}
28303041
28313042
/* Draw the line across the bottom of the table */
2832
- switch( p->spec.eStyle ){
2833
- case QRF_STYLE_Box:
2834
- qrfBoxSeparator(p->pOut, &data, BOX_12, BOX_124, BOX_14);
2835
- break;
2836
- case QRF_STYLE_Table:
2837
- qrfRowSeparator(p->pOut, &data, '+');
2838
- break;
3043
+ if( p->spec.bBorder!=QRF_No ){
3044
+ switch( p->spec.eStyle ){
3045
+ case QRF_STYLE_Box:
3046
+ qrfBoxSeparator(p->pOut, &data, BOX_R12, BOX_124, BOX_R14, 0);
3047
+ break;
3048
+ case QRF_STYLE_Table:
3049
+ qrfRowSeparator(p->pOut, &data, '+');
3050
+ break;
3051
+ }
28393052
}
28403053
qrfWrite(p);
28413054
28423055
qrfColDataFree(&data);
28433056
return;
@@ -2903,11 +3116,11 @@
29033116
assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 0), "addr" ) );
29043117
assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 1), "opcode" ) );
29053118
assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 2), "p1" ) );
29063119
assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 3), "p2" ) );
29073120
2908
- for(iOp=0; SQLITE_ROW==sqlite3_step(p->pStmt); iOp++){
3121
+ for(iOp=0; SQLITE_ROW==sqlite3_step(p->pStmt) && !p->iErr; iOp++){
29093122
int iAddr = sqlite3_column_int(p->pStmt, 0);
29103123
const char *zOp = (const char*)sqlite3_column_text(p->pStmt, 1);
29113124
int p1 = sqlite3_column_int(p->pStmt, 2);
29123125
int p2 = sqlite3_column_int(p->pStmt, 3);
29133126
@@ -2960,11 +3173,11 @@
29603173
nWidth = sizeof(aScanExpWidth)/sizeof(int);
29613174
iIndent = 3;
29623175
}
29633176
if( nArg>nWidth ) nArg = nWidth;
29643177
2965
- for(iOp=0; sqlite3_step(p->pStmt)==SQLITE_ROW; iOp++){
3178
+ for(iOp=0; sqlite3_step(p->pStmt)==SQLITE_ROW && !p->iErr; iOp++){
29663179
/* If this is the first row seen, print out the headers */
29673180
if( iOp==0 ){
29683181
for(i=0; i<nArg; i++){
29693182
const char *zCol = sqlite3_column_name(p->pStmt, aMap[i]);
29703183
qrfWidthPrint(p,p->pOut, aWidth[i], zCol);
@@ -2989,11 +3202,11 @@
29893202
int w = aWidth[i];
29903203
const char *zVal = (const char*)sqlite3_column_text(p->pStmt, aMap[i]);
29913204
int len;
29923205
if( i==nArg-1 ) w = 0;
29933206
if( zVal==0 ) zVal = "";
2994
- len = qrfDisplayLength(zVal);
3207
+ len = (int)sqlite3_qrf_wcswidth(zVal);
29953208
if( len>w ){
29963209
w = len;
29973210
zSep = " ";
29983211
}
29993212
if( i==iIndent && aiIndent && iOp<nIndent ){
@@ -3168,34 +3381,40 @@
31683381
}
31693382
case QRF_STYLE_Line: {
31703383
sqlite3_str *pVal;
31713384
int mxW;
31723385
int bWW;
3386
+ int nSep;
31733387
if( p->u.sLine.azCol==0 ){
31743388
p->u.sLine.azCol = sqlite3_malloc64( p->nCol*sizeof(char*) );
31753389
if( p->u.sLine.azCol==0 ){
31763390
qrfOom(p);
31773391
break;
31783392
}
31793393
p->u.sLine.mxColWth = 0;
31803394
for(i=0; i<p->nCol; i++){
31813395
int sz;
3182
- p->u.sLine.azCol[i] = sqlite3_column_name(p->pStmt, i);
3183
- if( p->u.sLine.azCol[i]==0 ) p->u.sLine.azCol[i] = "unknown";
3184
- sz = qrfDisplayLength(p->u.sLine.azCol[i]);
3396
+ const char *zCName = sqlite3_column_name(p->pStmt, i);
3397
+ if( zCName==0 ) zCName = "unknown";
3398
+ p->u.sLine.azCol[i] = sqlite3_mprintf("%s", zCName);
3399
+ if( p->spec.nTitleLimit>0 ){
3400
+ (void)qrfTitleLimit(p->u.sLine.azCol[i], p->spec.nTitleLimit);
3401
+ }
3402
+ sz = (int)sqlite3_qrf_wcswidth(p->u.sLine.azCol[i]);
31853403
if( sz > p->u.sLine.mxColWth ) p->u.sLine.mxColWth = sz;
31863404
}
31873405
}
31883406
if( p->nRow ) sqlite3_str_append(p->pOut, "\n", 1);
31893407
pVal = sqlite3_str_new(p->db);
3190
- mxW = p->mxWidth - (3 + p->u.sLine.mxColWth);
3408
+ nSep = (int)strlen(p->spec.zColumnSep);
3409
+ mxW = p->mxWidth - (nSep + p->u.sLine.mxColWth);
31913410
bWW = p->spec.bWordWrap==QRF_Yes;
31923411
for(i=0; i<p->nCol; i++){
31933412
const char *zVal;
31943413
int cnt = 0;
31953414
qrfWidthPrint(p, p->pOut, -p->u.sLine.mxColWth, p->u.sLine.azCol[i]);
3196
- sqlite3_str_append(p->pOut, " = ", 3);
3415
+ sqlite3_str_append(p->pOut, p->spec.zColumnSep, nSep);
31973416
qrfRenderValue(p, pVal, i);
31983417
zVal = sqlite3_str_value(pVal);
31993418
if( zVal==0 ) zVal = "";
32003419
do{
32013420
int nThis, nWide, iNext;
@@ -3210,10 +3429,11 @@
32103429
sqlite3_str_append(p->pOut, "\n", 1);
32113430
zVal += iNext;
32123431
}while( zVal[0] );
32133432
sqlite3_str_reset(pVal);
32143433
}
3434
+ qrfStrErr(p, pVal);
32153435
sqlite3_free(sqlite3_str_finish(pVal));
32163436
qrfWrite(p);
32173437
break;
32183438
}
32193439
case QRF_STYLE_Eqp: {
@@ -3273,11 +3493,11 @@
32733493
p->pOut = sqlite3_str_new(p->db);
32743494
if( p->pOut==0 ){
32753495
qrfOom(p);
32763496
return;
32773497
}
3278
- p->iErr = 0;
3498
+ p->iErr = SQLITE_OK;
32793499
p->nCol = sqlite3_column_count(p->pStmt);
32803500
p->nRow = 0;
32813501
sz = sizeof(sqlite3_qrf_spec);
32823502
memcpy(&p->spec, pSpec, sz);
32833503
if( p->spec.zNull==0 ) p->spec.zNull = "";
@@ -3285,12 +3505,12 @@
32853505
if( p->mxWidth<=0 ) p->mxWidth = QRF_MAX_WIDTH;
32863506
p->mxHeight = p->spec.nLineLimit;
32873507
if( p->mxHeight<=0 ) p->mxHeight = 2147483647;
32883508
if( p->spec.eStyle>QRF_STYLE_Table ) p->spec.eStyle = QRF_Auto;
32893509
if( p->spec.eEsc>QRF_ESC_Symbol ) p->spec.eEsc = QRF_Auto;
3290
- if( p->spec.eText>QRF_TEXT_Json ) p->spec.eText = QRF_Auto;
3291
- if( p->spec.eTitle>QRF_TEXT_Json ) p->spec.eTitle = QRF_Auto;
3510
+ if( p->spec.eText>QRF_TEXT_Relaxed ) p->spec.eText = QRF_Auto;
3511
+ if( p->spec.eTitle>QRF_TEXT_Relaxed ) p->spec.eTitle = QRF_Auto;
32923512
if( p->spec.eBlob>QRF_BLOB_Size ) p->spec.eBlob = QRF_Auto;
32933513
qrf_reinit:
32943514
switch( p->spec.eStyle ){
32953515
case QRF_Auto: {
32963516
switch( sqlite3_stmt_isexplain(pStmt) ){
@@ -3321,10 +3541,16 @@
33213541
p->spec.zNull = "NULL";
33223542
if( p->spec.zTableName==0 || p->spec.zTableName[0]==0 ){
33233543
p->spec.zTableName = "tab";
33243544
}
33253545
break;
3546
+ }
3547
+ case QRF_STYLE_Line: {
3548
+ if( p->spec.zColumnSep==0 ){
3549
+ p->spec.zColumnSep = ": ";
3550
+ }
3551
+ break;
33263552
}
33273553
case QRF_STYLE_Csv: {
33283554
p->spec.eStyle = QRF_STYLE_List;
33293555
p->spec.eText = QRF_TEXT_Csv;
33303556
p->spec.zColumnSep = ",";
@@ -3430,11 +3656,15 @@
34303656
qrfWrite(p);
34313657
}
34323658
break;
34333659
}
34343660
case QRF_STYLE_Line: {
3435
- if( p->u.sLine.azCol ) sqlite3_free(p->u.sLine.azCol);
3661
+ if( p->u.sLine.azCol ){
3662
+ int i;
3663
+ for(i=0; i<p->nCol; i++) sqlite3_free(p->u.sLine.azCol[i]);
3664
+ sqlite3_free(p->u.sLine.azCol);
3665
+ }
34363666
break;
34373667
}
34383668
case QRF_STYLE_Stats:
34393669
case QRF_STYLE_StatsEst:
34403670
case QRF_STYLE_Eqp: {
@@ -3441,10 +3671,11 @@
34413671
qrfEqpRender(p, 0);
34423672
qrfWrite(p);
34433673
break;
34443674
}
34453675
}
3676
+ qrfStrErr(p, p->pOut);
34463677
if( p->spec.pzOutput ){
34473678
if( p->spec.pzOutput[0] ){
34483679
sqlite3_int64 n, sz;
34493680
char *zCombined;
34503681
sz = strlen(p->spec.pzOutput[0]);
@@ -3624,11 +3855,11 @@
36243855
36253856
/* Return the current wall-clock time in microseconds since the
36263857
** Unix epoch (1970-01-01T00:00:00Z)
36273858
*/
36283859
static sqlite3_int64 timeOfDay(void){
3629
-#if defined(_WIN64)
3860
+#if defined(_WIN64) && _WIN32_WINNT >= _WIN32_WINNT_WIN8
36303861
sqlite3_uint64 t;
36313862
FILETIME tm;
36323863
GetSystemTimePreciseAsFileTime(&tm);
36333864
t = ((u64)tm.dwHighDateTime<<32) | (u64)tm.dwLowDateTime;
36343865
t += 116444736000000000LL;
@@ -3724,11 +3955,10 @@
37243955
*/
37253956
static int hasTimer(void){
37263957
if( getProcessTimesAddr ){
37273958
return 1;
37283959
} else {
3729
-#if !SQLITE_OS_WINRT
37303960
/* GetProcessTimes() isn't supported in WIN95 and some other Windows
37313961
** versions. See if the version we are running on has it, and if it
37323962
** does, save off a pointer to it and the current process handle.
37333963
*/
37343964
hProcess = GetCurrentProcess();
@@ -3741,11 +3971,10 @@
37413971
return 1;
37423972
}
37433973
FreeLibrary(hinstLib);
37443974
}
37453975
}
3746
-#endif
37473976
}
37483977
return 0;
37493978
}
37503979
37513980
/*
@@ -3860,10 +4089,18 @@
38604089
#define PROMPT_LEN_MAX 128
38614090
/* First line prompt. default: "sqlite> " */
38624091
static char mainPrompt[PROMPT_LEN_MAX];
38634092
/* Continuation prompt. default: " ...> " */
38644093
static char continuePrompt[PROMPT_LEN_MAX];
4094
+
4095
+/*
4096
+** Write I/O traces to the following stream.
4097
+*/
4098
+#ifdef SQLITE_ENABLE_IOTRACE
4099
+static FILE *iotrace = 0;
4100
+#endif
4101
+
38654102
38664103
/* This is variant of the standard-library strncpy() routine with the
38674104
** one change that the destination string is always zero-terminated, even
38684105
** if there is no zero-terminator in the first n-1 characters of the source
38694106
** string.
@@ -3980,17 +4217,10 @@
39804217
*/
39814218
static void shell_check_oom(const void *p){
39824219
if( p==0 ) shell_out_of_memory();
39834220
}
39844221
3985
-/*
3986
-** Write I/O traces to the following stream.
3987
-*/
3988
-#ifdef SQLITE_ENABLE_IOTRACE
3989
-static FILE *iotrace = 0;
3990
-#endif
3991
-
39924222
/*
39934223
** This routine works like printf in that its first argument is a
39944224
** format string and subsequent arguments are values to be substituted
39954225
** in place of % fields. The result of formatting this string
39964226
** is written to iotrace.
@@ -6013,17 +6243,20 @@
60136243
}
60146244
/* End of the hashing logic
60156245
*****************************************************************************/
60166246
60176247
/*
6018
-** Implementation of the sha1(X) function.
6248
+** Two SQL functions: sha1(X) and sha1b(X).
60196249
**
6020
-** Return a lower-case hexadecimal rendering of the SHA1 hash of the
6021
-** argument X. If X is a BLOB, it is hashed as is. For all other
6250
+** sha1(X) returns a lower-case hexadecimal rendering of the SHA1 hash
6251
+** of the argument X. If X is a BLOB, it is hashed as is. For all other
60226252
** types of input, X is converted into a UTF-8 string and the string
6023
-** is hash without the trailing 0x00 terminator. The hash of a NULL
6253
+** is hashed without the trailing 0x00 terminator. The hash of a NULL
60246254
** value is NULL.
6255
+**
6256
+** sha1b(X) is the same except that it returns a 20-byte BLOB containing
6257
+** the binary hash instead of a hexadecimal string.
60256258
*/
60266259
static void sha1Func(
60276260
sqlite3_context *context,
60286261
int argc,
60296262
sqlite3_value **argv
@@ -6040,15 +6273,17 @@
60406273
hash_step(&cx, sqlite3_value_blob(argv[0]), nByte);
60416274
}else{
60426275
hash_step(&cx, sqlite3_value_text(argv[0]), nByte);
60436276
}
60446277
if( sqlite3_user_data(context)!=0 ){
6278
+ /* sha1b() - binary result */
60456279
hash_finish(&cx, zOut, 1);
60466280
sqlite3_result_blob(context, zOut, 20, SQLITE_TRANSIENT);
60476281
}else{
6282
+ /* sha1() - hexadecimal text result */
60486283
hash_finish(&cx, zOut, 0);
6049
- sqlite3_result_blob(context, zOut, 40, SQLITE_TRANSIENT);
6284
+ sqlite3_result_text(context, zOut, 40, SQLITE_TRANSIENT);
60506285
}
60516286
}
60526287
60536288
/*
60546289
** Implementation of the sha1_query(SQL) function.
@@ -8136,13 +8371,13 @@
81368371
}else if( e<-10000 ){
81378372
e = -10000;
81388373
}
81398374
81408375
if( m<0 ){
8376
+ if( m<(-9223372036854775807LL) ) return;
81418377
isNeg = 1;
81428378
m = -m;
8143
- if( m<0 ) return;
81448379
}else if( m==0 && e>-1000 && e<1000 ){
81458380
sqlite3_result_double(context, 0.0);
81468381
return;
81478382
}
81488383
while( (m>>32)&0xffe00000 ){
@@ -9259,11 +9494,11 @@
92599494
** (X) match X
92609495
** X|Y X or Y
92619496
** ^X X occurring at the beginning of the string
92629497
** X$ X occurring at the end of the string
92639498
** . Match any single character
9264
-** \c Character c where c is one of \{}()[]|*+?.
9499
+** \c Character c where c is one of \{}()[]|*+?-.
92659500
** \c C-language escapes for c in afnrtv. ex: \t or \n
92669501
** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX
92679502
** \xXX Where XX is exactly 2 hex digits, unicode value XX
92689503
** [abc] Any single character from the set abc
92699504
** [^abc] Any single character not in the set abc
@@ -9644,11 +9879,11 @@
96449879
96459880
/* A backslash character has been seen, read the next character and
96469881
** return its interpretation.
96479882
*/
96489883
static unsigned re_esc_char(ReCompiled *p){
9649
- static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]";
9884
+ static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]-";
96509885
static const char zTrans[] = "\a\f\n\r\t\v";
96519886
int i, v = 0;
96529887
char c;
96539888
if( p->sIn.i>=p->sIn.mx ) return 0;
96549889
c = p->sIn.z[p->sIn.i];
@@ -9967,15 +10202,22 @@
996710202
}
996810203
return pRe->zErr;
996910204
}
997010205
997110206
/*
9972
-** Compute a reasonable limit on the length of the REGEXP NFA.
10207
+** The value of LIMIT_MAX_PATTERN_LENGTH.
997310208
*/
997410209
static int re_maxlen(sqlite3_context *context){
997510210
sqlite3 *db = sqlite3_context_db_handle(context);
9976
- return 75 + sqlite3_limit(db, SQLITE_LIMIT_LIKE_PATTERN_LENGTH,-1)/2;
10211
+ return sqlite3_limit(db, SQLITE_LIMIT_LIKE_PATTERN_LENGTH,-1);
10212
+}
10213
+
10214
+/*
10215
+** Maximum NFA size given a maximum pattern length.
10216
+*/
10217
+static int re_maxnfa(int mxlen){
10218
+ return 75+mxlen/2;
997710219
}
997810220
997910221
/*
998010222
** Implementation of the regexp() SQL function. This function implements
998110223
** the build-in REGEXP operator. The first argument to the function is the
@@ -9997,14 +10239,21 @@
999710239
int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
999810240
999910241
(void)argc; /* Unused */
1000010242
pRe = sqlite3_get_auxdata(context, 0);
1000110243
if( pRe==0 ){
10244
+ int mxLen = re_maxlen(context);
10245
+ int nPattern;
1000210246
zPattern = (const char*)sqlite3_value_text(argv[0]);
1000310247
if( zPattern==0 ) return;
10004
- zErr = re_compile(&pRe, zPattern, re_maxlen(context),
10005
- sqlite3_user_data(context)!=0);
10248
+ nPattern = sqlite3_value_bytes(argv[0]);
10249
+ if( nPattern>mxLen ){
10250
+ zErr = "REGEXP pattern too big";
10251
+ }else{
10252
+ zErr = re_compile(&pRe, zPattern, re_maxnfa(mxLen),
10253
+ sqlite3_user_data(context)!=0);
10254
+ }
1000610255
if( zErr ){
1000710256
re_free(pRe);
1000810257
sqlite3_result_error(context, zErr, -1);
1000910258
return;
1001010259
}
@@ -10066,11 +10315,11 @@
1006610315
"ATSTART",
1006710316
};
1006810317
1006910318
zPattern = (const char*)sqlite3_value_text(argv[0]);
1007010319
if( zPattern==0 ) return;
10071
- zErr = re_compile(&pRe, zPattern, re_maxlen(context),
10320
+ zErr = re_compile(&pRe, zPattern, re_maxnfa(re_maxlen(context)),
1007210321
sqlite3_user_data(context)!=0);
1007310322
if( zErr ){
1007410323
re_free(pRe);
1007510324
sqlite3_result_error(context, zErr, -1);
1007610325
return;
@@ -10474,10 +10723,11 @@
1047410723
if( b1==0 ) return 1;
1047510724
sz = MultiByteToWideChar(CP_UTF8, 0, zPath, sz, b1, sz);
1047610725
b1[sz] = 0;
1047710726
rc = _wstat(b1, pStatBuf);
1047810727
if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
10728
+ sqlite3_free(b1);
1047910729
return rc;
1048010730
#else
1048110731
return stat(zPath, pStatBuf);
1048210732
#endif
1048310733
}
@@ -10604,11 +10854,10 @@
1060410854
}
1060510855
}
1060610856
1060710857
if( mtime>=0 ){
1060810858
#if defined(_WIN32)
10609
-#if !SQLITE_OS_WINRT
1061010859
/* Windows */
1061110860
FILETIME lastAccess;
1061210861
FILETIME lastWrite;
1061310862
SYSTEMTIME currentTime;
1061410863
LONGLONG intervals;
@@ -10635,11 +10884,10 @@
1063510884
CloseHandle(hFile);
1063610885
return !bResult;
1063710886
}else{
1063810887
return 1;
1063910888
}
10640
-#endif
1064110889
#elif defined(AT_FDCWD) && 0 /* utimensat() is not universally available */
1064210890
/* Recent unix */
1064310891
struct timespec times[2];
1064410892
times[0].tv_nsec = times[1].tv_nsec = 0;
1064510893
times[0].tv_sec = time(0);
@@ -13337,11 +13585,11 @@
1333713585
rc = zipfileReadData(
1333813586
pFile, aRead, nExtra+nFile, iOff+ZIPFILE_CDS_FIXED_SZ, pzErr
1333913587
);
1334013588
}else{
1334113589
aRead = (u8*)&aBlob[iOff + ZIPFILE_CDS_FIXED_SZ];
13342
- if( (iOff + ZIPFILE_LFH_FIXED_SZ + nFile + nExtra)>nBlob ){
13590
+ if( (iOff + ZIPFILE_CDS_FIXED_SZ + nFile + nExtra)>nBlob ){
1334313591
rc = zipfileCorrupt(pzErr);
1334413592
}
1334513593
}
1334613594
}
1334713595
@@ -13362,15 +13610,16 @@
1336213610
ZipfileLFH lfh;
1336313611
if( pFile ){
1336413612
rc = zipfileReadData(pFile, aRead, szFix, pNew->cds.iOffset, pzErr);
1336513613
}else{
1336613614
aRead = (u8*)&aBlob[pNew->cds.iOffset];
13367
- if( (pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ)>nBlob ){
13615
+ if( (pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ)>(unsigned)nBlob ){
1336813616
rc = zipfileCorrupt(pzErr);
1336913617
}
1337013618
}
1337113619
13620
+ memset(&lfh, 0, sizeof(lfh));
1337213621
if( rc==SQLITE_OK ) rc = zipfileReadLFH(aRead, &lfh);
1337313622
if( rc==SQLITE_OK ){
1337413623
pNew->iDataOff = pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ;
1337513624
pNew->iDataOff += lfh.nFile + lfh.nExtra;
1337613625
if( aBlob && pNew->cds.szCompressed ){
@@ -13470,11 +13719,11 @@
1347013719
}else{
1347113720
err = inflate(&str, Z_NO_FLUSH);
1347213721
if( err!=Z_STREAM_END ){
1347313722
zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
1347413723
}else{
13475
- sqlite3_result_blob(pCtx, aRes, nOut, zipfileFree);
13724
+ sqlite3_result_blob(pCtx, aRes, (int)str.total_out, zipfileFree);
1347613725
aRes = 0;
1347713726
}
1347813727
}
1347913728
sqlite3_free(aRes);
1348013729
inflateEnd(&str);
@@ -23948,28 +24197,28 @@
2394824197
u8 autoExplain; /* Automatically turn on .explain mode */
2394924198
u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to each SQL stmt */
2395024199
u8 autoEQPtrace; /* autoEQP is in trace mode */
2395124200
u8 scanstatsOn; /* True to display scan stats before each finalize */
2395224201
u8 bAutoScreenWidth; /* Using the TTY to determine screen width */
23953
- u8 mFlags; /* MFLG_ECHO and/or MFLG_CRLF */
24202
+ u8 mFlags; /* MFLG_ECHO, MFLG_CRLF, etc. */
2395424203
u8 eMode; /* One of the MODE_ values */
2395524204
sqlite3_qrf_spec spec; /* Spec to be passed into QRF */
2395624205
} Mode;
2395724206
2395824207
/* Flags for Mode.mFlags */
2395924208
#define MFLG_ECHO 0x01 /* Echo inputs to output */
2396024209
#define MFLG_CRLF 0x02 /* Use CR/LF output line endings */
24210
+#define MFLG_HDR 0x04 /* .header used to change headers on/off */
2396124211
2396224212
2396324213
/*
2396424214
** State information about the database connection is contained in an
2396524215
** instance of the following structure.
2396624216
*/
2396724217
typedef struct ShellState ShellState;
2396824218
struct ShellState {
2396924219
sqlite3 *db; /* The database */
23970
- int iCompat; /* Compatibility date YYYYMMDD */
2397124220
u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
2397224221
u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
2397324222
u8 nEqpLevel; /* Depth of the EQP output graph */
2397424223
u8 eTraceType; /* SHELL_TRACE_* value for type of trace */
2397524224
u8 bSafeMode; /* True to prohibit unsafe operations */
@@ -24078,11 +24327,11 @@
2407824327
2407924328
/* Names of values for Mode.spec.eEsc and Mode.spec.eText
2408024329
*/
2408124330
static const char *qrfEscNames[] = { "auto", "off", "ascii", "symbol" };
2408224331
static const char *qrfQuoteNames[] =
24083
- { "off","off","sql","hex","csv","tcl","json"};
24332
+ { "off","off","sql","hex","csv","tcl","json","relaxed"};
2408424333
2408524334
/*
2408624335
** These are the allowed shellFlgs values
2408724336
*/
2408824337
#define SHFLG_Pagecache 0x00000001 /* The --pagecache option is used */
@@ -24120,19 +24369,20 @@
2412024369
#define MODE_Json 10 /* Output JSON */
2412124370
#define MODE_Line 11 /* One column per line. Blank line between records */
2412224371
#define MODE_List 12 /* One record per line with a separator */
2412324372
#define MODE_Markdown 13 /* Markdown formatting */
2412424373
#define MODE_Off 14 /* No query output shown */
24125
-#define MODE_QBox 15 /* BOX with SQL-quoted content */
24126
-#define MODE_Quote 16 /* Quote values as for SQL */
24127
-#define MODE_Split 17 /* Split-column mode */
24128
-#define MODE_Table 18 /* MySQL-style table formatting */
24129
-#define MODE_Tabs 19 /* Tab-separated values */
24130
-#define MODE_Tcl 20 /* Space-separated list of TCL strings */
24131
-#define MODE_Www 21 /* Full web-page output */
24132
-
24133
-#define MODE_BUILTIN 21 /* Maximum built-in mode */
24374
+#define MODE_Psql 15 /* Similar to psql */
24375
+#define MODE_QBox 16 /* BOX with SQL-quoted content */
24376
+#define MODE_Quote 17 /* Quote values as for SQL */
24377
+#define MODE_Split 18 /* Split-column mode */
24378
+#define MODE_Table 19 /* MySQL-style table formatting */
24379
+#define MODE_Tabs 20 /* Tab-separated values */
24380
+#define MODE_Tcl 21 /* Space-separated list of TCL strings */
24381
+#define MODE_Www 22 /* Full web-page output */
24382
+
24383
+#define MODE_BUILTIN 22 /* Maximum built-in mode */
2413424384
#define MODE_BATCH 50 /* Default mode for batch processing */
2413524385
#define MODE_TTY 51 /* Default mode for interactive processing */
2413624386
#define MODE_USER 75 /* First user-defined mode */
2413724387
#define MODE_N_USER 25 /* Maximum number of user-defined modes */
2413824388
@@ -24149,43 +24399,45 @@
2414924399
unsigned char eHdr; /* Default header encoding. */
2415024400
unsigned char eBlob; /* Default blob encoding. */
2415124401
unsigned char bHdr; /* Show headers by default. 0: n/a, 1: no 2: yes */
2415224402
unsigned char eStyle; /* Underlying QRF style */
2415324403
unsigned char eCx; /* 0: other, 1: line, 2: columnar */
24404
+ unsigned char mFlg; /* Flags. 1=border-off 2=split-column */
2415424405
};
2415524406
2415624407
/* String constants used by built-in modes */
2415724408
static const char *aModeStr[] =
2415824409
/* 0 1 2 3 4 5 6 7 8 */
2415924410
{ 0, "\n", "|", " ", ",", "\r\n", "\036", "\037", "\t",
24160
- "", "NULL", "null", "\"\"" };
24161
- /* 9 10 11 12 */
24411
+ "", "NULL", "null", "\"\"", ": ", };
24412
+ /* 9 10 11 12 13 */
2416224413
2416324414
static const ModeInfo aModeInfo[] = {
24164
-/* zName eCSep eRSep eNull eText eHdr eBlob bHdr eStyle eCx */
24165
- { "ascii", 7, 6, 9, 1, 1, 0, 1, 12, 0 },
24166
- { "box", 0, 0, 9, 1, 1, 0, 2, 1, 2 },
24167
- { "c", 4, 1, 10, 5, 5, 4, 1, 12, 0 },
24168
- { "column", 0, 0, 9, 1, 1, 0, 2, 2, 2 },
24169
- { "count", 0, 0, 0, 0, 0, 0, 0, 3, 0 },
24170
- { "csv", 4, 5, 9, 3, 3, 0, 1, 12, 0 },
24171
- { "html", 0, 0, 9, 4, 4, 0, 2, 7, 0 },
24172
- { "insert", 0, 0, 10, 2, 2, 0, 1, 8, 0 },
24173
- { "jatom", 4, 1, 11, 6, 6, 0, 1, 12, 0 },
24174
- { "jobject", 0, 1, 11, 6, 6, 0, 0, 10, 0 },
24175
- { "json", 0, 0, 11, 6, 6, 0, 0, 9, 0 },
24176
- { "line", 0, 1, 9, 1, 1, 0, 0, 11, 1 },
24177
- { "list", 2, 1, 9, 1, 1, 0, 1, 12, 0 },
24178
- { "markdown", 0, 0, 9, 1, 1, 0, 2, 13, 2 },
24179
- { "off", 0, 0, 0, 0, 0, 0, 0, 14, 0 },
24180
- { "qbox", 0, 0, 10, 2, 1, 0, 2, 1, 2 },
24181
- { "quote", 4, 1, 10, 2, 2, 0, 1, 12, 0 },
24182
- { "split", 0, 0, 9, 1, 1, 0, 1, 2, 2 },
24183
- { "table", 0, 0, 9, 1, 1, 0, 2, 19, 2 },
24184
- { "tabs", 8, 1, 9, 3, 3, 0, 1, 12, 0 },
24185
- { "tcl", 3, 1, 12, 5, 5, 4, 1, 12, 0 },
24186
- { "www", 0, 0, 9, 4, 4, 0, 2, 7, 0 }
24415
+/* zName eCSep eRSep eNull eText eHdr eBlob bHdr eStyle eCx mFlg */
24416
+ { "ascii", 7, 6, 9, 1, 1, 0, 1, 12, 0, 0 },
24417
+ { "box", 0, 0, 9, 1, 1, 0, 2, 1, 2, 0 },
24418
+ { "c", 4, 1, 10, 5, 5, 4, 1, 12, 0, 0 },
24419
+ { "column", 0, 0, 9, 1, 1, 0, 2, 2, 2, 0 },
24420
+ { "count", 0, 0, 0, 0, 0, 0, 0, 3, 0, 0 },
24421
+ { "csv", 4, 5, 9, 3, 3, 0, 1, 12, 0, 0 },
24422
+ { "html", 0, 0, 9, 4, 4, 0, 2, 7, 0, 0 },
24423
+ { "insert", 0, 0, 10, 2, 2, 0, 1, 8, 0, 0 },
24424
+ { "jatom", 4, 1, 11, 6, 6, 0, 1, 12, 0, 0 },
24425
+ { "jobject", 0, 1, 11, 6, 6, 0, 0, 10, 0, 0 },
24426
+ { "json", 0, 0, 11, 6, 6, 0, 0, 9, 0, 0 },
24427
+ { "line", 13, 1, 9, 1, 1, 0, 0, 11, 1, 0 },
24428
+ { "list", 2, 1, 9, 1, 1, 0, 1, 12, 0, 0 },
24429
+ { "markdown", 0, 0, 9, 1, 1, 0, 2, 13, 2, 0 },
24430
+ { "off", 0, 0, 0, 0, 0, 0, 0, 14, 0, 0 },
24431
+ { "psql", 0, 0, 9, 1, 1, 0, 2, 19, 2, 1 },
24432
+ { "qbox", 0, 0, 10, 2, 1, 0, 2, 1, 2, 0 },
24433
+ { "quote", 4, 1, 10, 2, 2, 0, 1, 12, 0, 0 },
24434
+ { "split", 0, 0, 9, 1, 1, 0, 1, 2, 2, 2 },
24435
+ { "table", 0, 0, 9, 1, 1, 0, 2, 19, 2, 0 },
24436
+ { "tabs", 8, 1, 9, 3, 3, 0, 1, 12, 0, 0 },
24437
+ { "tcl", 3, 1, 12, 5, 5, 4, 1, 12, 0, 0 },
24438
+ { "www", 0, 0, 9, 4, 4, 0, 2, 7, 0, 0 }
2418724439
}; /* | / / | / / | | \
2418824440
** | / / | / / | | \_ 2: columnar
2418924441
** Index into aModeStr[] | / / | | 1: line
2419024442
** | / / | | 0: other
2419124443
** | / / | \
@@ -24212,10 +24464,23 @@
2421224464
#define SEP_Comma ","
2421324465
#define SEP_CrLf "\r\n"
2421424466
#define SEP_Unit "\x1F"
2421524467
#define SEP_Record "\x1E"
2421624468
24469
+/*
24470
+** Default values for the various QRF limits
24471
+*/
24472
+#ifndef DFLT_CHAR_LIMIT
24473
+# define DFLT_CHAR_LIMIT 300
24474
+#endif
24475
+#ifndef DFLT_LINE_LIMIT
24476
+# define DFLT_LINE_LIMIT 5
24477
+#endif
24478
+#ifndef DFLT_TITLE_LIMIT
24479
+# define DFLT_TITLE_LIMIT 20
24480
+#endif
24481
+
2421724482
/*
2421824483
** Limit input nesting via .read or any other input redirect.
2421924484
** It's not too expensive, so a generous allowance can be made.
2422024485
*/
2422124486
#define MAX_INPUT_NESTING 25
@@ -24305,13 +24570,20 @@
2430524570
if( pI->eCSep ) modeSetStr(&pM->spec.zColumnSep, aModeStr[pI->eCSep]);
2430624571
if( pI->eRSep ) modeSetStr(&pM->spec.zRowSep, aModeStr[pI->eRSep]);
2430724572
if( pI->eNull ) modeSetStr(&pM->spec.zNull, aModeStr[pI->eNull]);
2430824573
pM->spec.eText = pI->eText;
2430924574
pM->spec.eBlob = pI->eBlob;
24310
- pM->spec.bTitles = pI->bHdr;
24575
+ if( (pM->mFlags & MFLG_HDR)==0 ){
24576
+ pM->spec.bTitles = pI->bHdr;
24577
+ }
2431124578
pM->spec.eTitle = pI->eHdr;
24312
- if( eMode==MODE_Split ){
24579
+ if( pI->mFlg & 0x01 ){
24580
+ pM->spec.bBorder = QRF_No;
24581
+ }else{
24582
+ pM->spec.bBorder = QRF_Auto;
24583
+ }
24584
+ if( pI->mFlg & 0x02 ){
2431324585
pM->spec.bSplitColumn = QRF_Yes;
2431424586
pM->bAutoScreenWidth = 1;
2431524587
}else{
2431624588
pM->spec.bSplitColumn = QRF_No;
2431724589
}
@@ -24326,26 +24598,27 @@
2432624598
}else if( eMode==MODE_TTY ){
2432724599
u8 mFlags = p->mode.mFlags;
2432824600
modeFree(&p->mode);
2432924601
modeChange(p, MODE_QBox);
2433024602
p->mode.bAutoScreenWidth = 1;
24331
- p->mode.spec.nCharLimit = 300;
24332
- p->mode.spec.nLineLimit = 5;
24603
+ p->mode.spec.eText = QRF_TEXT_Relaxed;
24604
+ p->mode.spec.nCharLimit = DFLT_CHAR_LIMIT;
24605
+ p->mode.spec.nLineLimit = DFLT_LINE_LIMIT;
2433324606
p->mode.spec.bTextJsonb = QRF_Yes;
24607
+ p->mode.spec.nTitleLimit = DFLT_TITLE_LIMIT;
2433424608
p->mode.mFlags = mFlags;
2433524609
}
2433624610
}
2433724611
2433824612
/*
24339
-** Set the mode to the default according to p->iCompat. It assumed
24340
-** that the mode has already been freed and zeroed prior to calling
24341
-** this routine.
24613
+** Set the mode to the default. It assumed that the mode has
24614
+** already been freed and zeroed prior to calling this routine.
2434224615
*/
2434324616
static void modeDefault(ShellState *p){
2434424617
p->mode.spec.iVersion = 1;
2434524618
p->mode.autoExplain = 1;
24346
- if( p->iCompat>=20251115 && (stdin_is_interactive || stdout_is_console) ){
24619
+ if( stdin_is_interactive || stdout_is_console ){
2434724620
modeChange(p, MODE_TTY);
2434824621
}else{
2434924622
modeChange(p, MODE_BATCH);
2435024623
}
2435124624
}
@@ -25075,10 +25348,12 @@
2507525348
z[j] = 0;
2507625349
if( strlen30(z)>=79 ){
2507725350
for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */
2507825351
if( c==cEnd ){
2507925352
cEnd = 0;
25353
+ }else if( cEnd!=0){
25354
+ /* No-op */
2508025355
}else if( c=='"' || c=='\'' || c=='`' ){
2508125356
cEnd = c;
2508225357
}else if( c=='[' ){
2508325358
cEnd = ']';
2508425359
}else if( c=='-' && z[i+1]=='-' ){
@@ -25889,10 +26164,11 @@
2588926164
if( pArg->mode.bAutoScreenWidth ){
2589026165
spec.nScreenWidth = shellScreenWidth();
2589126166
}
2589226167
if( spec.eBlob==QRF_BLOB_Auto ){
2589326168
switch( spec.eText ){
26169
+ case QRF_TEXT_Relaxed: /* fall through */
2589426170
case QRF_TEXT_Sql: spec.eBlob = QRF_BLOB_Sql; break;
2589526171
case QRF_TEXT_Json: spec.eBlob = QRF_BLOB_Json; break;
2589626172
default: spec.eBlob = QRF_BLOB_Text; break;
2589726173
}
2589826174
}
@@ -25902,11 +26178,11 @@
2590226178
rc = expertHandleSQL(pArg, zSql, pzErrMsg);
2590326179
return expertFinish(pArg, (rc!=SQLITE_OK), pzErrMsg);
2590426180
}
2590526181
#endif
2590626182
25907
- while( zSql[0] && (SQLITE_OK == rc) ){
26183
+ while( zSql && zSql[0] && (SQLITE_OK == rc) ){
2590826184
static const char *zStmtSql;
2590926185
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
2591026186
if( SQLITE_OK != rc ){
2591126187
if( pzErrMsg ){
2591226188
*pzErrMsg = save_err_msg(db, "in prepare", rc, zSql);
@@ -26365,12 +26641,12 @@
2636526641
".bail on|off Stop after hitting an error. Default OFF",
2636626642
#ifndef SQLITE_SHELL_FIDDLE
2636726643
".cd DIRECTORY Change the working directory to DIRECTORY",
2636826644
#endif
2636926645
".changes on|off Show number of rows changed by SQL",
26646
+ ".check OPTIONS ... Verify the results of a .testcase",
2637026647
#ifndef SQLITE_SHELL_FIDDLE
26371
- ".check GLOB Fail if output since .testcase does not match",
2637226648
".clone NEWDB Clone data into NEWDB from the existing database",
2637326649
#endif
2637426650
".connection [close] [#] Open or close an auxiliary database connection",
2637526651
".crlf ?on|off? Whether or not to use \\r\\n line endings",
2637626652
".databases List names and files of attached databases",
@@ -26546,13 +26822,11 @@
2654626822
" vmstep Show the virtual machine step count only",
2654726823
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
2654826824
".system CMD ARGS... Run CMD ARGS... in a system shell",
2654926825
#endif
2655026826
".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
26551
-#ifndef SQLITE_SHELL_FIDDLE
26552
- ",testcase NAME Begin redirecting output to 'testcase-out.txt'",
26553
-#endif
26827
+ ".testcase NAME Begin a test case.",
2655426828
",testctrl CMD ... Run various sqlite3_test_control() operations",
2655526829
" Run \".testctrl\" with no arguments for details",
2655626830
".timeout MS Try opening locked tables for MS milliseconds",
2655726831
".timer on|off Turn SQL timer on or off",
2655826832
#ifndef SQLITE_OMIT_TRACE
@@ -26597,19 +26871,31 @@
2659726871
"USAGE: .import [OPTIONS] FILE TABLE\n"
2659826872
"\n"
2659926873
"Import CSV or similar text from FILE into TABLE. If TABLE does\n"
2660026874
"not exist, it is created using the first row of FILE as the column\n"
2660126875
"names. If FILE begins with \"|\" then it is a command that is run\n"
26602
-"and the output from the command is used as the input data.\n"
26876
+"and the output from the command is used as the input data. If\n"
26877
+"FILE begins with \"<<\" followed by a label, then content is read from\n"
26878
+"the script until the first line that matches the label.\n"
26879
+"\n"
26880
+"The content of FILE is interpreted using RFC-4180 (\"CSV\") quoting\n"
26881
+"rules unless the current mode is \"ascii\" or \"tabs\" or unless one\n"
26882
+"the --ascii option is used.\n"
2660326883
"\n"
26604
-"FILE is assumed to be in a CSV format, unless the current mode\n"
26605
-"is \"ascii\" or \"tabs\" or unless one of the options below specify\n"
26606
-"an alternative.\n"
26884
+"The column and row separators must be single ASCII characters. If\n"
26885
+"multiple characters or a Unicode character are specified for the\n"
26886
+"separators, then only the first byte of the separator is used. Except,\n"
26887
+"if the row separator is \\n and the mode is not --ascii, then \\r\\n is\n"
26888
+"understood as a row separator too.\n"
2660726889
"\n"
2660826890
"Options:\n"
26609
-" --ascii Use \\037 and \\036 as column and row separators on input\n"
26891
+" --ascii Do not use RFC-4180 quoting. Use \\037 and \\036\n"
26892
+" as column and row separators on input, unless other\n"
26893
+" delimiters are specified using --colsep and/or --rowsep\n"
26894
+" --colsep CHAR Use CHAR as the column separator.\n"
2661026895
" --csv Input is standard RFC-4180 CSV.\n"
26896
+" --rowsep CHAR Use CHAR as the row separator.\n"
2661126897
" --schema S When creating TABLE, put it in schema S\n"
2661226898
" --skip N Ignore the first N rows of input\n"
2661326899
" -v Verbose mode\n"
2661426900
},
2661526901
{ ".mode",
@@ -26625,10 +26911,11 @@
2662526911
" meaning \"left\", \"centered\", and \"right\", with\n"
2662626912
" one letter per column starting from the left.\n"
2662726913
" Unspecified alignment defaults to 'L'.\n"
2662826914
" --blob-quote ARG ARG can be \"auto\", \"text\", \"sql\", \"hex\", \"tcl\",\n"
2662926915
" \"json\", or \"size\". Default is \"auto\".\n"
26916
+" --border on|off Show outer border on \"box\" and \"table\" modes.\n"
2663026917
" --charlimit N Set the maximum number of output characters to\n"
2663126918
" show for any single SQL value to N. Longer values\n"
2663226919
" truncated. Zero means \"no limit\".\n"
2663326920
" --colsep STRING Use STRING as the column separator\n"
2663426921
" --escape ESC Enable/disable escaping of control characters\n"
@@ -26636,19 +26923,22 @@
2663626923
" or \"symbol\".\n"
2663726924
" --linelimit N Set the maximum number of output lines to show for\n"
2663826925
" any single SQL value to N. Longer values are\n"
2663926926
" truncated. Zero means \"no limit\". Only works\n"
2664026927
" in \"line\" mode and in columnar modes.\n"
26641
-" --limits L,C Shorthand for \"--linelimit L --charlimit C\".\n"
26642
-" Or \"off\" to mean \"0,0\". Or \"on\" for \"5,300\".\n"
26928
+" --limits L,C,T Shorthand for \"--linelimit L --charlimit C\n"
26929
+" --titlelimit T\". The \",T\" can be omitted in which\n"
26930
+" case the --titlelimit is unchanged. The argument\n"
26931
+" can also be \"off\" to mean \"0,0,0\" or \"on\" to\n"
26932
+" mean \"5,300,20\".\n"
2664326933
" --list List available modes\n"
2664426934
" --null STRING Render SQL NULL values as the given string\n"
2664526935
" --once Setting changes to the right are reverted after\n"
2664626936
" the next SQL command.\n"
2664726937
" --quote ARG Enable/disable quoting of text. ARG can be\n"
26648
-" \"off\", \"on\", \"sql\", \"csv\", \"html\", \"tcl\",\n"
26649
-" or \"json\". \"off\" means show the text as-is.\n"
26938
+" \"off\", \"on\", \"sql\", \"relaxed\", \"csv\", \"html\",\n"
26939
+" \"tcl\", or \"json\". \"off\" means show the text as-is.\n"
2665026940
" \"on\" is an alias for \"sql\".\n"
2665126941
" --reset Changes all mode settings back to their default.\n"
2665226942
" --rowsep STRING Use STRING as the row separator\n"
2665326943
" --sw|--screenwidth N Declare the screen width of the output device\n"
2665426944
" to be N characters. An attempt may be made to\n"
@@ -26659,10 +26949,11 @@
2665926949
" --tag NAME Save mode to the left as NAME.\n"
2666026950
" --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON.\n"
2666126951
" --title ARG Whether or not to show column headers, and if so\n"
2666226952
" how to encode them. ARG can be \"off\", \"on\",\n"
2666326953
" \"sql\", \"csv\", \"html\", \"tcl\", or \"json\".\n"
26954
+" --titlelimit N Limit the length of column titles to N characters.\n"
2666426955
" -v|--verbose Verbose output\n"
2666526956
" --widths LIST Set the columns widths for columnar modes. The\n"
2666626957
" argument is a list of integers, one for each\n"
2666726958
" column. A \"0\" width means use a dynamic width\n"
2666826959
" based on the actual width of data. If there are\n"
@@ -26686,23 +26977,17 @@
2668626977
" --bom Prepend a byte-order mark to the output\n"
2668726978
" -e Accumulate output in a temporary text file then\n"
2668826979
" launch a text editor when the redirection ends.\n"
2668926980
" --error-prefix X Use X as the left-margin prefix for error messages.\n"
2669026981
" Set to an empty string to restore the default.\n"
26691
-" --glob GLOB Raise an error if the memory buffer does not match\n"
26692
-" the GLOB pattern.\n"
26693
-" --keep Continue using the same \"memory\" buffer. Do not\n"
26694
-" reset it or delete it. Useful in combination with\n"
26695
-" --glob, --not-glob, and/or --verify.\n"
26696
-" ---notglob GLOB Raise an error if the memory buffer does not match\n"
26697
-" the GLOB pattern.\n"
26982
+" --keep Keep redirecting output to its current destination.\n"
26983
+" Use this option in combination with --show or\n"
26984
+" with --error-prefix when you do not want to stop\n"
26985
+" a current redirection.\n"
2669826986
" --plain Use plain text rather than HTML tables with -w\n"
26699
-" --show Write the memory buffer to the screen, for debugging.\n"
26700
-" --verify ENDMARK Read subsequent lines of text until the first line\n"
26701
-" that matches ENDMARK. Discard the ENDMARK. Compare\n"
26702
-" the text against the accumulated output in memory and\n"
26703
-" raise an error if there are any differences.\n"
26987
+" --show Show output text captured by .testcase or by\n"
26988
+" redirecting to \"memory\".\n"
2670426989
" -w Show the output in a web browser. Output is\n"
2670526990
" written into a temporary HTML file until the\n"
2670626991
" redirect ends, then the web browser is launched.\n"
2670726992
" Query results are shown as HTML tables, unless\n"
2670826993
" the --plain is used too.\n"
@@ -26726,10 +27011,39 @@
2672627011
" file in a web browser\n"
2672727012
" -x Show the output in a spreadsheet. Output is\n"
2672827013
" written to a temp file as CSV then the spreadsheet\n"
2672927014
" is launched when\n"
2673027015
},
27016
+ { ".check",
27017
+"USAGE: .check [OPTIONS] PATTERN\n"
27018
+"\n"
27019
+"Verify results of commands since the most recent .testcase command.\n"
27020
+"Restore output to the console, unless --keep is used.\n"
27021
+"\n"
27022
+"If PATTERN starts with \"<<ENDMARK\" then the actual pattern is taken from\n"
27023
+"subsequent lines of text up to the first line that begins with ENDMARK.\n"
27024
+"All pattern lines and the ENDMARK are discarded.\n"
27025
+"\n"
27026
+"Options:\n"
27027
+" --exact Do an exact comparison including leading and\n"
27028
+" trailing whitespace.\n"
27029
+" --glob Treat PATTERN as a GLOB\n"
27030
+" --keep Do not reset the testcase. More .check commands\n"
27031
+" will follow.\n"
27032
+" --notglob Output should not match PATTERN\n"
27033
+" --show Write testcase output to the screen, for debugging.\n"
27034
+ },
27035
+ { ".testcase",
27036
+"USAGE: .testcase [OPTIONS] NAME\n"
27037
+"\n"
27038
+"Start a new test case identified by NAME. All output\n"
27039
+"through the next \".check\" command is captured for comparison. See the\n"
27040
+"\".check\" commandn for additional informatioon.\n"
27041
+"\n"
27042
+"Options:\n"
27043
+" --error-prefix TEXT Change error message prefix text to TEXT\n"
27044
+ },
2673127045
};
2673227046
2673327047
/*
2673427048
** Return a pointer to usage text for zCmd, or NULL if none exists.
2673527049
*/
@@ -26949,10 +27263,56 @@
2694927263
if( sqlite3_strglob(pSession->azFilter[i], zTab)==0 ) return 0;
2695027264
}
2695127265
return 1;
2695227266
}
2695327267
#endif
27268
+
27269
+/*
27270
+** Return the size of the named file in bytes. Or return a negative
27271
+** number if the file does not exist.
27272
+*/
27273
+static sqlite3_int64 fileSize(const char *zFile){
27274
+#if defined(_WIN32) || defined(WIN32)
27275
+ struct _stat64 x;
27276
+ if( _stat64(zFile, &x)!=0 ) return -1;
27277
+ return (sqlite3_int64)x.st_size;
27278
+#else
27279
+ struct stat x;
27280
+ if( stat(zFile, &x)!=0 ) return -1;
27281
+ return (sqlite3_int64)x.st_size;
27282
+#endif
27283
+}
27284
+
27285
+/*
27286
+** Return true if zFile is an SQLite database.
27287
+**
27288
+** Algorithm:
27289
+** * If the file does not exist -> return false
27290
+** * If the size of the file is not a multiple of 512 -> return false
27291
+** * If sqlite3_open() fails -> return false
27292
+** * if sqlite3_prepare() or sqlite3_step() fails -> return false
27293
+** * Otherwise -> return true
27294
+*/
27295
+static int isDatabaseFile(const char *zFile, int openFlags){
27296
+ sqlite3 *db = 0;
27297
+ sqlite3_stmt *pStmt = 0;
27298
+ int rc;
27299
+ sqlite3_int64 sz = fileSize(zFile);
27300
+ if( sz<512 || (sz%512)!=0 ) return 0;
27301
+ if( sqlite3_open_v2(zFile, &db, openFlags, 0)==SQLITE_OK
27302
+ && sqlite3_prepare_v2(db,"SELECT count(*) FROM sqlite_schema",-1,&pStmt,0)
27303
+ ==SQLITE_OK
27304
+ && sqlite3_step(pStmt)==SQLITE_ROW
27305
+ ){
27306
+ rc = 1;
27307
+ }else{
27308
+ rc = 0;
27309
+ }
27310
+ sqlite3_finalize(pStmt);
27311
+ sqlite3_close(db);
27312
+ return rc;
27313
+}
2695427314
2695527315
/*
2695627316
** Try to deduce the type of file for zName based on its content. Return
2695727317
** one of the SHELL_OPEN_* constants.
2695827318
**
@@ -26962,24 +27322,16 @@
2696227322
** the type cannot be determined from content.
2696327323
*/
2696427324
int deduceDatabaseType(const char *zName, int dfltZip, int openFlags){
2696527325
FILE *f;
2696627326
size_t n;
26967
- sqlite3 *db = 0;
26968
- sqlite3_stmt *pStmt = 0;
2696927327
int rc = SHELL_OPEN_UNSPEC;
2697027328
char zBuf[100];
2697127329
if( access(zName,0)!=0 ) goto database_type_by_name;
26972
- if( sqlite3_open_v2(zName, &db, openFlags, 0)==SQLITE_OK
26973
- && sqlite3_prepare_v2(db,"SELECT count(*) FROM sqlite_schema",-1,&pStmt,0)
26974
- ==SQLITE_OK
26975
- && sqlite3_step(pStmt)==SQLITE_ROW
26976
- ){
27330
+ if( isDatabaseFile(zName, openFlags) ){
2697727331
rc = SHELL_OPEN_NORMAL;
2697827332
}
26979
- sqlite3_finalize(pStmt);
26980
- sqlite3_close(db);
2698127333
if( rc==SHELL_OPEN_NORMAL ) return SHELL_OPEN_NORMAL;
2698227334
f = sqlite3_fopen(zName, "rb");
2698327335
if( f==0 ) goto database_type_by_name;
2698427336
n = fread(zBuf, 16, 1, f);
2698527337
if( n==1 && memcmp(zBuf, "SQLite format 3", 16)==0 ){
@@ -27009,10 +27361,37 @@
2700927361
}else{
2701027362
rc = SHELL_OPEN_NORMAL;
2701127363
}
2701227364
return rc;
2701327365
}
27366
+
27367
+/*
27368
+** If the text in z[] is the name of a readable file and that file appears
27369
+** to contain SQL text and/or dot-commands, then return true. If z[] is
27370
+** not a file, or if the file is unreadable, or if the file is a database
27371
+** or anything else that is not SQL text and dot-commands, then return false.
27372
+**
27373
+** If the bLeaveUninit flag is set, then be sure to leave SQLite in an
27374
+** uninitialized state. This means invoking sqlite3_shutdown() after any
27375
+** SQLite API is used.
27376
+**
27377
+** Some amount of guesswork is involved in this decision.
27378
+*/
27379
+static int isScriptFile(const char *z, int bLeaveUninit){
27380
+ sqlite3_int64 sz = fileSize(z);
27381
+ if( sz<=0 ) return 0;
27382
+ if( (sz%512)==0 ){
27383
+ int rc = isDatabaseFile(z, SQLITE_OPEN_READONLY);
27384
+ if( bLeaveUninit ){
27385
+ sqlite3_shutdown();
27386
+ }
27387
+ if( rc ) return 0; /* Is a database */
27388
+ }
27389
+ if( sqlite3_strlike("%.sql",z,0)==0 ) return 1;
27390
+ if( sqlite3_strlike("%.txt",z,0)==0 ) return 1;
27391
+ return 0;
27392
+}
2701427393
2701527394
#ifndef SQLITE_OMIT_DESERIALIZE
2701627395
/*
2701727396
** Reconstruct an in-memory database using the output from the "dbtotxt"
2701827397
** program. Read content from the file in p->aAuxDb[].zDbFilename.
@@ -27655,11 +28034,13 @@
2765528034
typedef struct ImportCtx ImportCtx;
2765628035
struct ImportCtx {
2765728036
const char *zFile; /* Name of the input file */
2765828037
FILE *in; /* Read the CSV text from this input stream */
2765928038
int (SQLITE_CDECL *xCloser)(FILE*); /* Func to close in */
28039
+ char *zIn; /* Input text */
2766028040
char *z; /* Accumulated text for a field */
28041
+ i64 nUsed; /* Bytes of zIn[] used so far */
2766128042
i64 n; /* Number of bytes in z */
2766228043
i64 nAlloc; /* Space allocated for z[] */
2766328044
int nLine; /* Current line number */
2766428045
int nRow; /* Number of rows imported */
2766528046
int nErr; /* Number of errors encountered */
@@ -27675,13 +28056,32 @@
2767528056
p->xCloser(p->in);
2767628057
p->in = 0;
2767728058
}
2767828059
sqlite3_free(p->z);
2767928060
p->z = 0;
28061
+ if( p->zIn ){
28062
+ sqlite3_free(p->zIn);
28063
+ p->zIn = 0;
28064
+ }
2768028065
}
2768128066
27682
-/* Append a single byte to z[] */
28067
+/* Read a single character of the .import input text. Return EOF
28068
+** at end-of-file.
28069
+*/
28070
+static int import_getc(ImportCtx *p){
28071
+ if( p->in ){
28072
+ return fgetc(p->in);
28073
+ }else if( p->zIn && p->zIn[p->nUsed]!=0 ){
28074
+ return p->zIn[p->nUsed++];
28075
+ }else{
28076
+ return EOF;
28077
+ }
28078
+}
28079
+
28080
+/* Append a single byte to the field value begin constructed
28081
+** in the p->z[] buffer
28082
+*/
2768328083
static void import_append_char(ImportCtx *p, int c){
2768428084
if( p->n+1>=p->nAlloc ){
2768528085
p->nAlloc += p->nAlloc + 100;
2768628086
p->z = sqlite3_realloc64(p->z, p->nAlloc);
2768728087
shell_check_oom(p->z);
@@ -27693,12 +28093,12 @@
2769328093
** with the option of having a separator other than ",".
2769428094
**
2769528095
** + Input comes from p->in.
2769628096
** + Store results in p->z of length p->n. Space to hold p->z comes
2769728097
** from sqlite3_malloc64().
27698
-** + Use p->cSep as the column separator. The default is ",".
27699
-** + Use p->rSep as the row separator. The default is "\n".
28098
+** + Use p->cColSep as the column separator. The default is ",".
28099
+** + Use p->cRowSep as the row separator. The default is "\n".
2770028100
** + Keep track of the line number in p->nLine.
2770128101
** + Store the character that terminates the field in p->cTerm. Store
2770228102
** EOF on end-of-file.
2770328103
** + Report syntax errors on stderr
2770428104
*/
@@ -27705,11 +28105,11 @@
2770528105
static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
2770628106
int c;
2770728107
int cSep = (u8)p->cColSep;
2770828108
int rSep = (u8)p->cRowSep;
2770928109
p->n = 0;
27710
- c = fgetc(p->in);
28110
+ c = import_getc(p);
2771128111
if( c==EOF || seenInterrupt ){
2771228112
p->cTerm = EOF;
2771328113
return 0;
2771428114
}
2771528115
if( c=='"' ){
@@ -27716,11 +28116,11 @@
2771628116
int pc, ppc;
2771728117
int startLine = p->nLine;
2771828118
int cQuote = c;
2771928119
pc = ppc = 0;
2772028120
while( 1 ){
27721
- c = fgetc(p->in);
28121
+ c = import_getc(p);
2772228122
if( c==rSep ) p->nLine++;
2772328123
if( c==cQuote ){
2772428124
if( pc==cQuote ){
2772528125
pc = 0;
2772628126
continue;
@@ -27752,24 +28152,24 @@
2775228152
}else{
2775328153
/* If this is the first field being parsed and it begins with the
2775428154
** UTF-8 BOM (0xEF BB BF) then skip the BOM */
2775528155
if( (c&0xff)==0xef && p->bNotFirst==0 ){
2775628156
import_append_char(p, c);
27757
- c = fgetc(p->in);
28157
+ c = import_getc(p);
2775828158
if( (c&0xff)==0xbb ){
2775928159
import_append_char(p, c);
27760
- c = fgetc(p->in);
28160
+ c = import_getc(p);
2776128161
if( (c&0xff)==0xbf ){
2776228162
p->bNotFirst = 1;
2776328163
p->n = 0;
2776428164
return csv_read_one_field(p);
2776528165
}
2776628166
}
2776728167
}
2776828168
while( c!=EOF && c!=cSep && c!=rSep ){
2776928169
import_append_char(p, c);
27770
- c = fgetc(p->in);
28170
+ c = import_getc(p);
2777128171
}
2777228172
if( c==rSep ){
2777328173
p->nLine++;
2777428174
if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
2777528175
}
@@ -27783,12 +28183,12 @@
2778328183
/* Read a single field of ASCII delimited text.
2778428184
**
2778528185
** + Input comes from p->in.
2778628186
** + Store results in p->z of length p->n. Space to hold p->z comes
2778728187
** from sqlite3_malloc64().
27788
-** + Use p->cSep as the column separator. The default is "\x1F".
27789
-** + Use p->rSep as the row separator. The default is "\x1E".
28188
+** + Use p->cColSep as the column separator. The default is "\x1F".
28189
+** + Use p->cRowSep as the row separator. The default is "\x1E".
2779028190
** + Keep track of the row number in p->nLine.
2779128191
** + Store the character that terminates the field in p->cTerm. Store
2779228192
** EOF on end-of-file.
2779328193
** + Report syntax errors on stderr
2779428194
*/
@@ -27795,18 +28195,18 @@
2779528195
static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
2779628196
int c;
2779728197
int cSep = (u8)p->cColSep;
2779828198
int rSep = (u8)p->cRowSep;
2779928199
p->n = 0;
27800
- c = fgetc(p->in);
28200
+ c = import_getc(p);
2780128201
if( c==EOF || seenInterrupt ){
2780228202
p->cTerm = EOF;
2780328203
return 0;
2780428204
}
2780528205
while( c!=EOF && c!=cSep && c!=rSep ){
2780628206
import_append_char(p, c);
27807
- c = fgetc(p->in);
28207
+ c = import_getc(p);
2780828208
}
2780928209
if( c==rSep ){
2781028210
p->nLine++;
2781128211
}
2781228212
p->cTerm = c;
@@ -29721,11 +30121,13 @@
2972130121
2972230122
p = sqlite3_recover_init_sql(
2972330123
pState->db, "main", recoverSqlCb, (void*)pState
2972430124
);
2972530125
29726
- sqlite3_recover_config(p, 789, (void*)zRecoveryDb); /* Debug use only */
30126
+ if( !pState->bSafeMode ){
30127
+ sqlite3_recover_config(p, 789, (void*)zRecoveryDb); /* Debug use only */
30128
+ }
2972730129
sqlite3_recover_config(p, SQLITE_RECOVER_LOST_AND_FOUND, (void*)zLAF);
2972830130
sqlite3_recover_config(p, SQLITE_RECOVER_ROWIDS, (void*)&bRowids);
2972930131
sqlite3_recover_config(p, SQLITE_RECOVER_FREELIST_CORRUPT,(void*)&bFreelist);
2973030132
2973130133
cli_printf(pState->out, ".dbconfig defensive off\n");
@@ -30105,19 +30507,31 @@
3010530507
** USAGE: .import [OPTIONS] FILE TABLE
3010630508
**
3010730509
** Import CSV or similar text from FILE into TABLE. If TABLE does
3010830510
** not exist, it is created using the first row of FILE as the column
3010930511
** names. If FILE begins with "|" then it is a command that is run
30110
-** and the output from the command is used as the input data.
30512
+** and the output from the command is used as the input data. If
30513
+** FILE begins with "<<" followed by a label, then content is read from
30514
+** the script until the first line that matches the label.
30515
+**
30516
+** The content of FILE is interpreted using RFC-4180 ("CSV") quoting
30517
+** rules unless the current mode is "ascii" or "tabs" or unless one
30518
+** the --ascii option is used.
3011130519
**
30112
-** FILE is assumed to be in a CSV format, unless the current mode
30113
-** is "ascii" or "tabs" or unless one of the options below specify
30114
-** an alternative.
30520
+** The column and row separators must be single ASCII characters. If
30521
+** multiple characters or a Unicode character are specified for the
30522
+** separators, then only the first byte of the separator is used. Except,
30523
+** if the row separator is \n and the mode is not --ascii, then \r\n is
30524
+** understood as a row separator too.
3011530525
**
3011630526
** Options:
30117
-** --ascii Use \037 and \036 as column and row separators on input
30527
+** --ascii Do not use RFC-4180 quoting. Use \037 and \036
30528
+** as column and row separators on input, unless other
30529
+** delimiters are specified using --colsep and/or --rowsep
30530
+** --colsep CHAR Use CHAR as the column separator.
3011830531
** --csv Input is standard RFC-4180 CSV.
30532
+** --rowsep CHAR Use CHAR as the row separator.
3011930533
** --schema S When creating TABLE, put it in schema S
3012030534
** --skip N Ignore the first N rows of input
3012130535
** -v Verbose mode
3012230536
*/
3012330537
static int dotCmdImport(ShellState *p){
@@ -30129,17 +30543,16 @@
3012930543
sqlite3_stmt *pStmt = NULL; /* A statement */
3013030544
int nCol; /* Number of columns in the table */
3013130545
i64 nByte; /* Number of bytes in an SQL string */
3013230546
int i, j; /* Loop counters */
3013330547
int needCommit; /* True to COMMIT or ROLLBACK at end */
30134
- int nSep; /* Number of bytes in spec.zColumnSep */
3013530548
char *zSql = 0; /* An SQL statement */
3013630549
ImportCtx sCtx; /* Reader context */
3013730550
char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */
3013830551
int eVerbose = 0; /* Larger for more console output */
3013930552
i64 nSkip = 0; /* Initial lines to skip */
30140
- int useOutputMode = 1; /* Use output mode to determine separators */
30553
+ i64 iLineOffset = 0; /* Offset to the first line of input */
3014130554
char *zCreate = 0; /* CREATE TABLE statement text */
3014230555
int rc; /* Result code */
3014330556
3014430557
failIfSafeMode(p, "cannot run .import in safe mode");
3014530558
memset(&sCtx, 0, sizeof(sCtx));
@@ -30165,70 +30578,67 @@
3016530578
}else if( cli_strcmp(z,"-schema")==0 && i<nArg-1 ){
3016630579
zSchema = azArg[++i];
3016730580
}else if( cli_strcmp(z,"-skip")==0 && i<nArg-1 ){
3016830581
nSkip = integerValue(azArg[++i]);
3016930582
}else if( cli_strcmp(z,"-ascii")==0 ){
30170
- sCtx.cColSep = SEP_Unit[0];
30171
- sCtx.cRowSep = SEP_Record[0];
30583
+ if( sCtx.cColSep==0 ) sCtx.cColSep = SEP_Unit[0];
30584
+ if( sCtx.cRowSep==0 ) sCtx.cRowSep = SEP_Record[0];
3017230585
xRead = ascii_read_one_field;
30173
- useOutputMode = 0;
3017430586
}else if( cli_strcmp(z,"-csv")==0 ){
30175
- sCtx.cColSep = ',';
30176
- sCtx.cRowSep = '\n';
30587
+ if( sCtx.cColSep==0 ) sCtx.cColSep = ',';
30588
+ if( sCtx.cRowSep==0 ) sCtx.cRowSep = '\n';
3017730589
xRead = csv_read_one_field;
30178
- useOutputMode = 0;
30590
+ }else if( cli_strcmp(z,"-colsep")==0 ){
30591
+ if( i==nArg-1 ){
30592
+ dotCmdError(p, i, "missing argument", 0);
30593
+ return 1;
30594
+ }
30595
+ i++;
30596
+ sCtx.cColSep = azArg[i][0];
30597
+ }else if( cli_strcmp(z,"-rowsep")==0 ){
30598
+ if( i==nArg-1 ){
30599
+ dotCmdError(p, i, "missing argument", 0);
30600
+ return 1;
30601
+ }
30602
+ i++;
30603
+ sCtx.cRowSep = azArg[i][0];
3017930604
}else{
3018030605
dotCmdError(p, i, "unknown option", 0);
3018130606
return 1;
3018230607
}
3018330608
}
3018430609
if( zTable==0 ){
30185
- cli_printf(p->out, "ERROR: missing %s argument\n",
30610
+ dotCmdError(p, nArg, 0, "Missing %s argument\n",
3018630611
zFile==0 ? "FILE" : "TABLE");
3018730612
return 1;
3018830613
}
3018930614
seenInterrupt = 0;
3019030615
open_db(p, 0);
30191
- if( useOutputMode ){
30192
- /* If neither the --csv or --ascii options are specified, then set
30193
- ** the column and row separator characters from the output mode. */
30194
- if( p->mode.spec.zColumnSep==0 ){
30195
- modeSetStr(&p->mode.spec.zColumnSep, ",");
30196
- nSep = 1;
30197
- }else if( (nSep = strlen30(p->mode.spec.zColumnSep))==0 ){
30198
- eputz("Error: non-null column separator required for import\n");
30199
- return 1;
30200
- }
30201
- if( nSep>1 ){
30202
- eputz("Error: multi-character column separators not allowed"
30203
- " for import\n");
30204
- return 1;
30205
- }
30206
- if( p->mode.spec.zRowSep==0 ){
30207
- modeSetStr(&p->mode.spec.zRowSep, "\n");
30208
- nSep = 1;
30209
- }else if( (nSep = strlen30(p->mode.spec.zRowSep))==0 ){
30210
- eputz("Error: non-null row separator required for import\n");
30211
- return 1;
30212
- }
30213
- if( nSep==2 && p->mode.eMode==MODE_Csv
30214
- && cli_strcmp(p->mode.spec.zRowSep,SEP_CrLf)==0
30215
- ){
30216
- /* When importing CSV (only), if the row separator is set to the
30217
- ** default output row separator, change it to the default input
30218
- ** row separator. This avoids having to maintain different input
30219
- ** and output row separators. */
30220
- modeSetStr(&p->mode.spec.zRowSep, SEP_Row);
30221
- nSep = strlen30(p->mode.spec.zRowSep);
30222
- }
30223
- if( nSep>1 ){
30224
- eputz("Error: multi-character row separators not allowed"
30225
- " for import\n");
30226
- return 1;
30227
- }
30228
- sCtx.cColSep = (u8)p->mode.spec.zColumnSep[0];
30229
- sCtx.cRowSep = (u8)p->mode.spec.zRowSep[0];
30616
+ if( sCtx.cColSep==0 ){
30617
+ if( p->mode.spec.zColumnSep && p->mode.spec.zColumnSep[0]!=0 ){
30618
+ sCtx.cColSep = p->mode.spec.zColumnSep[0];
30619
+ }else{
30620
+ sCtx.cColSep = ',';
30621
+ }
30622
+ }
30623
+ if( (sCtx.cColSep & 0x80)!=0 ){
30624
+ eputz("Error: .import column separator must be ASCII\n");
30625
+ return 1;
30626
+ }
30627
+ if( sCtx.cRowSep==0 ){
30628
+ if( p->mode.spec.zRowSep && p->mode.spec.zRowSep[0]!=0 ){
30629
+ sCtx.cRowSep = p->mode.spec.zRowSep[0];
30630
+ }else{
30631
+ sCtx.cRowSep = '\n';
30632
+ }
30633
+ }
30634
+ if( sCtx.cRowSep=='\r' && xRead!=ascii_read_one_field ){
30635
+ sCtx.cRowSep = '\n';
30636
+ }
30637
+ if( (sCtx.cRowSep & 0x80)!=0 ){
30638
+ eputz("Error: .import row separator must be ASCII\n");
30639
+ return 1;
3023030640
}
3023130641
sCtx.zFile = zFile;
3023230642
sCtx.nLine = 1;
3023330643
if( sCtx.zFile[0]=='|' ){
3023430644
#ifdef SQLITE_OMIT_POPEN
@@ -30237,19 +30647,58 @@
3023730647
#else
3023830648
sCtx.in = sqlite3_popen(sCtx.zFile+1, "r");
3023930649
sCtx.zFile = "<pipe>";
3024030650
sCtx.xCloser = pclose;
3024130651
#endif
30652
+ }else if( sCtx.zFile[0]=='<' && sCtx.zFile[1]=='<' && sCtx.zFile[2]!=0 ){
30653
+ /* Input text comes from subsequent lines of script until the zFile
30654
+ ** delimiter */
30655
+ int nEndMark = strlen30(zFile)-2;
30656
+ char *zEndMark = &zFile[2];
30657
+ sqlite3_str *pContent = sqlite3_str_new(p->db);
30658
+ int ckEnd = 1;
30659
+ i64 iStart = p->lineno;
30660
+ char zLine[2000];
30661
+ sCtx.zFile = p->zInFile;
30662
+ sCtx.nLine = p->lineno+1;
30663
+ iLineOffset = p->lineno;
30664
+ while( sqlite3_fgets(zLine,sizeof(zLine),p->in) ){
30665
+ if( ckEnd && cli_strncmp(zLine,zEndMark,nEndMark)==0 ){
30666
+ ckEnd = 2;
30667
+ if( strchr(zLine,'\n') ) p->lineno++;
30668
+ break;
30669
+ }
30670
+ if( strchr(zLine,'\n') ){
30671
+ p->lineno++;
30672
+ ckEnd = 1;
30673
+ }else{
30674
+ ckEnd = 0;
30675
+ }
30676
+ sqlite3_str_appendall(pContent, zLine);
30677
+ }
30678
+ sCtx.zIn = sqlite3_str_finish(pContent);
30679
+ if( sCtx.zIn==0 ){
30680
+ sCtx.zIn = sqlite3_mprintf("");
30681
+ }
30682
+ if( ckEnd<2 ){
30683
+ i64 savedLn = p->lineno;
30684
+ p->lineno = iStart;
30685
+ dotCmdError(p, 0, 0,"Content terminator \"%s\" not found.",zEndMark);
30686
+ p->lineno = savedLn;
30687
+ import_cleanup(&sCtx);
30688
+ return 1;
30689
+ }
3024230690
}else{
3024330691
sCtx.in = sqlite3_fopen(sCtx.zFile, "rb");
3024430692
sCtx.xCloser = fclose;
3024530693
}
30246
- if( sCtx.in==0 ){
30247
- cli_printf(stderr,"Error: cannot open \"%s\"\n", zFile);
30694
+ if( sCtx.in==0 && sCtx.zIn==0 ){
30695
+ dotCmdError(p, 0, 0, "cannot open \"%s\"", zFile);
30696
+ import_cleanup(&sCtx);
3024830697
return 1;
3024930698
}
30250
- if( eVerbose>=2 || (eVerbose>=1 && useOutputMode) ){
30699
+ if( eVerbose>=1 ){
3025130700
char zSep[2];
3025230701
zSep[1] = 0;
3025330702
zSep[0] = sCtx.cColSep;
3025430703
cli_puts("Column separator ", p->out);
3025530704
output_c_string(p->out, zSep);
@@ -30402,10 +30851,14 @@
3040230851
if( z==0 && (xRead==csv_read_one_field) && i==nCol-1 && i>0 ){
3040330852
z = "";
3040430853
}
3040530854
sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
3040630855
if( i<nCol-1 && sCtx.cTerm!=sCtx.cColSep ){
30856
+ if( i==0 && (strcmp(z,"\n")==0 || strcmp(z,"\r\n")==0) ){
30857
+ /* Ignore trailing \n or \r\n when some other row separator */
30858
+ break;
30859
+ }
3040730860
cli_printf(stderr,"%s:%d: expected %d columns but found %d"
3040830861
" - filling the rest with NULL\n",
3040930862
sCtx.zFile, startLine, nCol, i+1);
3041030863
i += 2;
3041130864
while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
@@ -30425,10 +30878,11 @@
3042530878
rc = sqlite3_reset(pStmt);
3042630879
if( rc!=SQLITE_OK ){
3042730880
cli_printf(stderr,"%s:%d: INSERT failed: %s\n",
3042830881
sCtx.zFile, startLine, sqlite3_errmsg(p->db));
3042930882
sCtx.nErr++;
30883
+ if( bail_on_error ) break;
3043030884
}else{
3043130885
sCtx.nRow++;
3043230886
}
3043330887
}
3043430888
}while( sCtx.cTerm!=EOF );
@@ -30437,13 +30891,13 @@
3043730891
sqlite3_finalize(pStmt);
3043830892
if( needCommit ) sqlite3_exec(p->db, "COMMIT", 0, 0, 0);
3043930893
if( eVerbose>0 ){
3044030894
cli_printf(p->out,
3044130895
"Added %d rows with %d errors using %d lines of input\n",
30442
- sCtx.nRow, sCtx.nErr, sCtx.nLine-1);
30896
+ sCtx.nRow, sCtx.nErr, sCtx.nLine-1-iLineOffset);
3044330897
}
30444
- return 0;
30898
+ return sCtx.nErr ? 1 : 0;
3044530899
}
3044630900
3044730901
3044830902
/*
3044930903
** This function computes what to show the user about the configured
@@ -30508,10 +30962,11 @@
3050830962
** meaning "left", "centered", and "right", with
3050930963
** one letter per column starting from the left.
3051030964
** Unspecified alignment defaults to 'L'.
3051130965
** --blob-quote ARG ARG can be "auto", "text", "sql", "hex", "tcl",
3051230966
** "json", or "size". Default is "auto".
30967
+** --border on|off Show outer border on "box" and "table" modes.
3051330968
** --charlimit N Set the maximum number of output characters to
3051430969
** show for any single SQL value to N. Longer values
3051530970
** truncated. Zero means "no limit".
3051630971
** --colsep STRING Use STRING as the column separator
3051730972
** --escape ESC Enable/disable escaping of control characters
@@ -30519,19 +30974,22 @@
3051930974
** or "symbol".
3052030975
** --linelimit N Set the maximum number of output lines to show for
3052130976
** any single SQL value to N. Longer values are
3052230977
** truncated. Zero means "no limit". Only works
3052330978
** in "line" mode and in columnar modes.
30524
-** --limits L,C Shorthand for "--linelimit L --charlimit C".
30525
-** Or "off" to mean "0,0". Or "on" for "5,300".
30979
+** --limits L,C,T Shorthand for "--linelimit L --charlimit C
30980
+** --titlelimit T". The ",T" can be omitted in which
30981
+** case the --titlelimit is unchanged. The argument
30982
+** can also be "off" to mean "0,0,0" or "on" to
30983
+** mean "5,300,20".
3052630984
** --list List available modes
3052730985
** --null STRING Render SQL NULL values as the given string
3052830986
** --once Setting changes to the right are reverted after
3052930987
** the next SQL command.
3053030988
** --quote ARG Enable/disable quoting of text. ARG can be
30531
-** "off", "on", "sql", "csv", "html", "tcl",
30532
-** or "json". "off" means show the text as-is.
30989
+** "off", "on", "sql", "relaxed", "csv", "html",
30990
+** "tcl", or "json". "off" means show the text as-is.
3053330991
** "on" is an alias for "sql".
3053430992
** --reset Changes all mode settings back to their default.
3053530993
** --rowsep STRING Use STRING as the row separator
3053630994
** --sw|--screenwidth N Declare the screen width of the output device
3053730995
** to be N characters. An attempt may be made to
@@ -30542,10 +31000,11 @@
3054231000
** --tag NAME Save mode to the left as NAME.
3054331001
** --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON.
3054431002
** --title ARG Whether or not to show column headers, and if so
3054531003
** how to encode them. ARG can be "off", "on",
3054631004
** "sql", "csv", "html", "tcl", or "json".
31005
+** --titlelimit N Limit the length of column titles to N characters.
3054731006
** -v|--verbose Verbose output
3054831007
** --widths LIST Set the columns widths for columnar modes. The
3054931008
** argument is a list of integers, one for each
3055031009
** column. A "0" width means use a dynamic width
3055131010
** based on the actual width of data. If there are
@@ -30626,21 +31085,31 @@
3062631085
** Must match QRF_BLOB_xxxx values. See also tag-20251124a */
3062731086
if( k>=0 ){
3062831087
p->mode.spec.eBlob = k & 0xff;
3062931088
}
3063031089
chng = 1;
30631
- }else if( 0<=(k=pickStr(z,0,"-charlimit","-linelimit","")) ){
31090
+ }else if( optionMatch(z,"border") ){
31091
+ if( (++i)>=nArg ){
31092
+ dotCmdError(p, i-1, "missing argument", 0);
31093
+ return 1;
31094
+ }
31095
+ k = pickStr(azArg[i], 0, "auto", "off", "on", "");
31096
+ if( k>=0 ){
31097
+ p->mode.spec.bBorder = k & 0x3;
31098
+ }
31099
+ chng = 1;
31100
+ }else if( 0<=(k=pickStr(z,0,"-charlimit","-linelimit","-titlelimit","")) ){
3063231101
int w; /* 0 1 */
3063331102
if( i+1>=nArg ){
3063431103
dotCmdError(p, i, "missing argument", 0);
3063531104
return 1;
3063631105
}
3063731106
w = integerValue(azArg[++i]);
30638
- if( k==0 ){
30639
- p->mode.spec.nCharLimit = w;
30640
- }else{
30641
- p->mode.spec.nLineLimit = w;
31107
+ switch( k ){
31108
+ case 0: p->mode.spec.nCharLimit = w; break;
31109
+ case 1: p->mode.spec.nLineLimit = w; break;
31110
+ default: p->mode.spec.nTitleLimit = w; break;
3064231111
}
3064331112
chng = 1;
3064431113
}else if( 0<=(k=pickStr(z,0,"-tablename","-rowsep","-colsep","-null","")) ){
3064531114
/* 0 1 2 3 */
3064631115
if( i+1>=nArg ){
@@ -30675,25 +31144,28 @@
3067531144
dotCmdError(p, i-1, "missing argument", 0);
3067631145
return 1;
3067731146
}
3067831147
k = pickStr(azArg[i],0,"on","off","");
3067931148
if( k==0 ){
30680
- p->mode.spec.nLineLimit = 5;
30681
- p->mode.spec.nCharLimit = 300;
31149
+ p->mode.spec.nLineLimit = DFLT_LINE_LIMIT;
31150
+ p->mode.spec.nCharLimit = DFLT_CHAR_LIMIT;
31151
+ p->mode.spec.nTitleLimit = DFLT_TITLE_LIMIT;
3068231152
}else if( k==1 ){
3068331153
p->mode.spec.nLineLimit = 0;
3068431154
p->mode.spec.nCharLimit = 0;
31155
+ p->mode.spec.nTitleLimit = 0;
3068531156
}else{
30686
- int L, C;
30687
- int nNum = sscanf(azArg[i], "%d,%d", &L, &C);
30688
- if( nNum!=2 || L<0 || C<0 ){
30689
- dotCmdError(p, i, "bad argument", "Should be \"L,C\" where L and C"
30690
- " are unsigned integers");
31157
+ int L, C, T = 0;
31158
+ int nNum = sscanf(azArg[i], "%d,%d,%d", &L, &C, &T);
31159
+ if( nNum<2 || L<0 || C<0 || T<0){
31160
+ dotCmdError(p, i, "bad argument", "Should be \"L,C,T\" where L, C"
31161
+ " and T are unsigned integers");
3069131162
return 1;
3069231163
}
3069331164
p->mode.spec.nLineLimit = L;
3069431165
p->mode.spec.nCharLimit = C;
31166
+ if( nNum==3 ) p->mode.spec.nTitleLimit = T;
3069531167
}
3069631168
chng = 1;
3069731169
}else if( optionMatch(z,"list") ){
3069831170
int ii;
3069931171
cli_puts("available modes:", p->out);
@@ -30726,13 +31198,14 @@
3072631198
** how to set quoting. */
3072731199
i++;
3072831200
if( (k = pickStr(azArg[i],0,"no","yes","0","1",""))>=0 ){
3072931201
k &= 1; /* 0 for "off". 1 for "on". */
3073031202
}else{
30731
- char *zErr = 0; /* 0 1 2 3 4 5 6 */
30732
- k = pickStr(azArg[i],&zErr,"off","on","sql","csv","html","tcl","json",
30733
- "");
31203
+ char *zErr = 0;
31204
+ k = pickStr(azArg[i],&zErr,
31205
+ "off","on","sql","csv","html","tcl","json","relaxed","");
31206
+ /* 0 1 2 3 4 5 6 7 */
3073431207
if( k<0 ){
3073531208
dotCmdError(p, i, "unknown", "%z", zErr);
3073631209
return 1;
3073731210
}
3073831211
}
@@ -30757,10 +31230,13 @@
3075731230
p->mode.spec.eText = QRF_TEXT_Tcl;
3075831231
break;
3075931232
case 6: /* json */
3076031233
p->mode.spec.eText = QRF_TEXT_Json;
3076131234
break;
31235
+ case 7: /* relaxed */
31236
+ p->mode.spec.eText = QRF_TEXT_Relaxed;
31237
+ break;
3076231238
default: /* off */
3076331239
p->mode.spec.eText = QRF_TEXT_Plain;
3076431240
break;
3076531241
}
3076631242
chng = 1;
@@ -30832,10 +31308,11 @@
3083231308
if( k<0 ){
3083331309
dotCmdError(p, i, "bad --titles value","%z", zErr);
3083431310
return 1;
3083531311
}
3083631312
p->mode.spec.bTitles = k>=1 ? QRF_Yes : QRF_No;
31313
+ p->mode.mFlags &= ~MFLG_HDR;
3083731314
p->mode.spec.eTitle = k>1 ? k-1 : aModeInfo[p->mode.eMode].eHdr;
3083831315
chng = 1;
3083931316
}else if( optionMatch(z,"widths") || optionMatch(z,"width") ){
3084031317
int nWidth = 0;
3084131318
short int *aWidth;
@@ -30847,16 +31324,16 @@
3084731324
zW = azArg[++i];
3084831325
/* Every width value takes at least 2 bytes in the input string to
3084931326
** specify, so strlen(zW) bytes should be plenty of space to hold the
3085031327
** result. */
3085131328
aWidth = malloc( strlen(zW) );
30852
- while( isspace(zW[0]) ) zW++;
31329
+ while( IsSpace(zW[0]) ) zW++;
3085331330
while( zW[0] ){
3085431331
int w = 0;
3085531332
int nDigit = 0;
30856
- k = zW[0]=='-' && isdigit(zW[1]);
30857
- while( isdigit(zW[k]) ){
31333
+ k = zW[0]=='-' && IsDigit(zW[1]);
31334
+ while( IsDigit(zW[k]) ){
3085831335
w = w*10 + zW[k] - '0';
3085931336
if( w>QRF_MAX_WIDTH ){
3086031337
dotCmdError(p,i+1,"width too big",
3086131338
"Maximum column width is %d", QRF_MAX_WIDTH);
3086231339
free(aWidth);
@@ -30873,11 +31350,11 @@
3087331350
}
3087431351
if( zW[0]=='-' ) w = -w;
3087531352
aWidth[nWidth++] = w;
3087631353
zW += k;
3087731354
if( zW[0]==',' ) zW++;
30878
- while( isspace(zW[0]) ) zW++;
31355
+ while( IsSpace(zW[0]) ) zW++;
3087931356
}
3088031357
free(p->mode.spec.aWidth);
3088131358
p->mode.spec.aWidth = aWidth;
3088231359
p->mode.spec.nWidth = nWidth;
3088331360
chng = 1;
@@ -30928,39 +31405,52 @@
3092831405
unsigned char a = p->mode.spec.aAlign[ii];
3092931406
sqlite3_str_appendchar(pDesc, 1, "LLCR"[a&3]);
3093031407
}
3093131408
sqlite3_str_append(pDesc, "\"", 1);
3093231409
}
31410
+ if( bAll
31411
+ || (p->mode.spec.bBorder==QRF_No) != ((pI->mFlg&1)!=0)
31412
+ ){
31413
+ sqlite3_str_appendf(pDesc," --border %s",
31414
+ p->mode.spec.bBorder==QRF_No ? "off" : "on");
31415
+ }
3093331416
if( bAll || p->mode.spec.eBlob!=QRF_BLOB_Auto ){
3093431417
const char *azBQuote[] =
3093531418
{ "auto", "text", "sql", "hex", "tcl", "json", "size" };
3093631419
/* 0 1 2 3 4 5 6
3093731420
** Must match QRF_BLOB_xxxx values. See all instances of tag-20251124a */
3093831421
u8 e = p->mode.spec.eBlob;
3093931422
sqlite3_str_appendf(pDesc, " --blob-quote %s", azBQuote[e]);
3094031423
}
30941
- if( !bAll && p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit>0 ){
30942
- sqlite3_str_appendf(pDesc, " --charlimit %d",p->mode.spec.nCharLimit);
30943
- }
3094431424
zSetting = aModeStr[pI->eCSep];
3094531425
if( bAll || (zSetting && cli_strcmp(zSetting,p->mode.spec.zColumnSep)!=0) ){
3094631426
sqlite3_str_appendf(pDesc, " --colsep ");
3094731427
append_c_string(pDesc, p->mode.spec.zColumnSep);
3094831428
}
3094931429
if( bAll || p->mode.spec.eEsc!=QRF_Auto ){
3095031430
sqlite3_str_appendf(pDesc, " --escape %s",qrfEscNames[p->mode.spec.eEsc]);
3095131431
}
30952
- if( bAll || (p->mode.spec.nLineLimit>0 && p->mode.spec.nCharLimit>0) ){
30953
- if( p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit==0 ){
31432
+ if( bAll
31433
+ || (p->mode.spec.nLineLimit>0 && pI->eCx>0)
31434
+ || p->mode.spec.nCharLimit>0
31435
+ || (p->mode.spec.nTitleLimit>0 && pI->eCx>0)
31436
+ ){
31437
+ if( p->mode.spec.nLineLimit==0
31438
+ && p->mode.spec.nCharLimit==0
31439
+ && p->mode.spec.nTitleLimit==0
31440
+ ){
3095431441
sqlite3_str_appendf(pDesc, " --limits off");
31442
+ }else if( p->mode.spec.nLineLimit==DFLT_LINE_LIMIT
31443
+ && p->mode.spec.nCharLimit==DFLT_CHAR_LIMIT
31444
+ && p->mode.spec.nTitleLimit==DFLT_TITLE_LIMIT
31445
+ ){
31446
+ sqlite3_str_appendf(pDesc, " --limits on");
3095531447
}else{
30956
- sqlite3_str_appendf(pDesc, " --limits %d,%d",
30957
- p->mode.spec.nLineLimit, p->mode.spec.nCharLimit);
31448
+ sqlite3_str_appendf(pDesc, " --limits %d,%d,%d",
31449
+ p->mode.spec.nLineLimit, p->mode.spec.nCharLimit,
31450
+ p->mode.spec.nTitleLimit);
3095831451
}
30959
- }else
30960
- if( p->mode.spec.nCharLimit==0 && p->mode.spec.nLineLimit>0 && pI->eCx>0 ){
30961
- sqlite3_str_appendf(pDesc, " --linelimit %d",p->mode.spec.nLineLimit);
3096231452
}
3096331453
zSetting = aModeStr[pI->eNull];
3096431454
if( bAll || (zSetting && cli_strcmp(zSetting,p->mode.spec.zNull)!=0) ){
3096531455
sqlite3_str_appendf(pDesc, " --null ");
3096631456
append_c_string(pDesc, p->mode.spec.zNull);
@@ -30977,13 +31467,13 @@
3097731467
}
3097831468
if( bAll
3097931469
|| (pI->eCx && (p->mode.spec.nScreenWidth>0 || p->mode.bAutoScreenWidth))
3098031470
){
3098131471
if( p->mode.bAutoScreenWidth ){
30982
- sqlite3_str_appendall(pDesc, " --screenwidth auto");
31472
+ sqlite3_str_appendall(pDesc, " --sw auto");
3098331473
}else{
30984
- sqlite3_str_appendf(pDesc," --screenwidth %d",
31474
+ sqlite3_str_appendf(pDesc," --sw %d",
3098531475
p->mode.spec.nScreenWidth);
3098631476
}
3098731477
}
3098831478
if( bAll || p->mode.eMode==MODE_Insert ){
3098931479
sqlite3_str_appendf(pDesc," --tablename ");
@@ -31023,11 +31513,11 @@
3102331513
sqlite3_str_appendf(pDesc, " --wrap %d", p->mode.spec.nWrap);
3102431514
}
3102531515
if( !bAll ) sqlite3_str_append(pDesc, " --ww", 5);
3102631516
}
3102731517
zDesc = sqlite3_str_finish(pDesc);
31028
- cli_printf(p->out, "current output mode: %s\n", zDesc);
31518
+ cli_printf(p->out, ".mode %s\n", zDesc);
3102931519
fflush(p->out);
3103031520
sqlite3_free(zDesc);
3103131521
}
3103231522
return 0;
3103331523
}
@@ -31047,23 +31537,17 @@
3104731537
** --bom Prepend a byte-order mark to the output
3104831538
** -e Accumulate output in a temporary text file then
3104931539
** launch a text editor when the redirection ends.
3105031540
** --error-prefix X Use X as the left-margin prefix for error messages.
3105131541
** Set to an empty string to restore the default.
31052
-** --glob GLOB Raise an error if the memory buffer does not match
31053
-** the GLOB pattern.
31054
-** --keep Continue using the same "memory" buffer. Do not
31055
-** reset it or delete it. Useful in combination with
31056
-** --glob, --not-glob, and/or --verify.
31057
-** ---notglob GLOB Raise an error if the memory buffer does not match
31058
-** the GLOB pattern.
31542
+** --keep Keep redirecting output to its current destination.
31543
+** Use this option in combination with --show or
31544
+** with --error-prefix when you do not want to stop
31545
+** a current redirection.
3105931546
** --plain Use plain text rather than HTML tables with -w
31060
-** --show Write the memory buffer to the screen, for debugging.
31061
-** --verify ENDMARK Read subsequent lines of text until the first line
31062
-** that matches ENDMARK. Discard the ENDMARK. Compare
31063
-** the text against the accumulated output in memory and
31064
-** raise an error if there are any differences.
31547
+** --show Show output text captured by .testcase or by
31548
+** redirecting to "memory".
3106531549
** -w Show the output in a web browser. Output is
3106631550
** written into a temporary HTML file until the
3106731551
** redirect ends, then the web browser is launched.
3106831552
** Query results are shown as HTML tables, unless
3106931553
** the --plain is used too.
@@ -31101,13 +31585,11 @@
3110131585
char *zFile = 0; /* The FILE argument */
3110231586
int i; /* Loop counter */
3110331587
int eMode = 0; /* 0: .outout/.once, 'x'=.excel, 'w'=.www */
3110431588
int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
3110531589
int bPlain = 0; /* --plain option */
31106
- int bKeep = 0; /* --keep option */
31107
- char *zCheck = 0; /* Argument to --glob, --notglob, --verify */
31108
- int eCheck = 0; /* 1: --glob, 2: --notglob, 3: --verify */
31590
+ int bKeep = 0; /* Keep redirecting */
3110931591
static const char *zBomUtf8 = "\357\273\277";
3111031592
const char *zBom = 0;
3111131593
char c = azArg[0][0];
3111231594
int n = strlen30(azArg[0]);
3111331595
@@ -31129,36 +31611,21 @@
3112931611
zBom = zBomUtf8;
3113031612
}else if( cli_strcmp(z,"-plain")==0 ){
3113131613
bPlain = 1;
3113231614
}else if( c=='o' && z[0]=='1' && z[1]!=0 && z[2]==0
3113331615
&& (z[1]=='x' || z[1]=='e' || z[1]=='w') ){
31134
- if( bKeep || eMode || eCheck ){
31616
+ if( bKeep || eMode ){
3113531617
dotCmdError(p, i, "incompatible with prior options",0);
3113631618
goto dotCmdOutput_error;
3113731619
}
3113831620
eMode = z[1];
31139
- }else if( cli_strcmp(z,"-keep")==0 ){
31140
- bKeep = 1;
3114131621
}else if( cli_strcmp(z,"-show")==0 ){
3114231622
if( cli_output_capture ){
3114331623
sqlite3_fprintf(stdout, "%s", sqlite3_str_value(cli_output_capture));
3114431624
}
31625
+ }else if( cli_strcmp(z,"-keep")==0 ){
3114531626
bKeep = 1;
31146
- }else if( cli_strcmp(z,"-glob")==0
31147
- || cli_strcmp(z,"-notglob")==0
31148
- || cli_strcmp(z,"-verify")==0
31149
- ){
31150
- if( eCheck || eMode ){
31151
- dotCmdError(p, i, "incompatible with prior options",0);
31152
- goto dotCmdOutput_error;
31153
- }
31154
- if( i+1>=nArg ){
31155
- dotCmdError(p, i, "missing argument", 0);
31156
- goto dotCmdOutput_error;
31157
- }
31158
- zCheck = azArg[++i];
31159
- eCheck = z[1]=='g' ? 1 : z[1]=='n' ? 2 : 3;
3116031627
}else if( optionMatch(z,"error-prefix") ){
3116131628
if( i+1>=nArg ){
3116231629
dotCmdError(p, i, "missing argument", 0);
3116331630
return 1;
3116431631
}
@@ -31169,11 +31636,11 @@
3116931636
dotCmdError(p, i, "unknown option", 0);
3117031637
sqlite3_free(zFile);
3117131638
return 1;
3117231639
}
3117331640
}else if( zFile==0 && eMode==0 ){
31174
- if( bKeep || eCheck ){
31641
+ if( bKeep ){
3117531642
dotCmdError(p, i, "incompatible with prior options",0);
3117631643
goto dotCmdOutput_error;
3117731644
}
3117831645
if( cli_strcmp(z, "memory")==0 && bOnce ){
3117931646
dotCmdError(p, 0, "cannot redirect to \"memory\"", 0);
@@ -31205,53 +31672,10 @@
3120531672
if( bOnce ){
3120631673
p->nPopOutput = 2;
3120731674
}else{
3120831675
p->nPopOutput = 0;
3120931676
}
31210
- if( eCheck ){
31211
- char *zTest;
31212
- if( cli_output_capture ){
31213
- zTest = sqlite3_str_value(cli_output_capture);
31214
- }else{
31215
- zTest = "";
31216
- }
31217
- p->nTestRun++;
31218
- if( eCheck==3 ){
31219
- int nCheck = strlen30(zCheck);
31220
- sqlite3_str *pPattern = sqlite3_str_new(p->db);
31221
- char *zPattern;
31222
- sqlite3_int64 iStart = p->lineno;
31223
- char zLine[2000];
31224
- while( sqlite3_fgets(zLine,sizeof(zLine),p->in) ){
31225
- if( strchr(zLine,'\n') ) p->lineno++;
31226
- if( cli_strncmp(zCheck,zLine,nCheck)==0 ) break;
31227
- sqlite3_str_appendall(pPattern, zLine);
31228
- }
31229
- zPattern = sqlite3_str_finish(pPattern);
31230
- if( cli_strcmp(zPattern,zTest)!=0 ){
31231
- sqlite3_fprintf(stderr,
31232
- "%s:%lld: --verify does matches prior output\n",
31233
- p->zInFile, iStart);
31234
- p->nTestErr++;
31235
- }
31236
- sqlite3_free(zPattern);
31237
- }else{
31238
- char *zGlob = sqlite3_mprintf("*%s*", zCheck);
31239
- if( eCheck==1 && sqlite3_strglob(zGlob, zTest)!=0 ){
31240
- sqlite3_fprintf(stderr,
31241
- "%s:%lld: --glob \"%s\" does not match prior output\n",
31242
- p->zInFile, p->lineno, zCheck);
31243
- p->nTestErr++;
31244
- }else if( eCheck==2 && sqlite3_strglob(zGlob, zTest)==0 ){
31245
- sqlite3_fprintf(stderr,
31246
- "%s:%lld: --notglob \"%s\" matches prior output\n",
31247
- p->zInFile, p->lineno, zCheck);
31248
- p->nTestErr++;
31249
- }
31250
- sqlite3_free(zGlob);
31251
- }
31252
- }
3125331677
if( !bKeep ) output_reset(p);
3125431678
#ifndef SQLITE_NOHAVE_SYSTEM
3125531679
if( eMode=='e' || eMode=='x' || eMode=='w' ){
3125631680
p->doXdgOpen = 1;
3125731681
modePush(p);
@@ -31328,10 +31752,199 @@
3132831752
3132931753
dotCmdOutput_error:
3133031754
sqlite3_free(zFile);
3133131755
return 1;
3133231756
}
31757
+
31758
+/*
31759
+** DOT-COMMAND: .check
31760
+** USAGE: .check [OPTIONS] PATTERN
31761
+**
31762
+** Verify results of commands since the most recent .testcase command.
31763
+** Restore output to the console, unless --keep is used.
31764
+**
31765
+** If PATTERN starts with "<<ENDMARK" then the actual pattern is taken from
31766
+** subsequent lines of text up to the first line that begins with ENDMARK.
31767
+** All pattern lines and the ENDMARK are discarded.
31768
+**
31769
+** Options:
31770
+** --exact Do an exact comparison including leading and
31771
+** trailing whitespace.
31772
+** --glob Treat PATTERN as a GLOB
31773
+** --keep Do not reset the testcase. More .check commands
31774
+** will follow.
31775
+** --notglob Output should not match PATTERN
31776
+** --show Write testcase output to the screen, for debugging.
31777
+*/
31778
+static int dotCmdCheck(ShellState *p){
31779
+ int nArg = p->dot.nArg; /* Number of arguments */
31780
+ char **azArg = p->dot.azArg; /* Text of the arguments */
31781
+ int i; /* Loop counter */
31782
+ int k; /* Result of pickStr() */
31783
+ char *zTest; /* Textcase result */
31784
+ int bKeep = 0; /* --keep option */
31785
+ char *zCheck = 0; /* PATTERN argument */
31786
+ char *zPattern = 0; /* Actual test pattern */
31787
+ int eCheck = 0; /* 1: --glob, 2: --notglob, 3: --exact */
31788
+ int isOk; /* True if results are OK */
31789
+ sqlite3_int64 iStart = p->lineno; /* Line number of .check statement */
31790
+
31791
+ if( p->zTestcase[0]==0 ){
31792
+ dotCmdError(p, 0, "no .testcase is active", 0);
31793
+ return 1;
31794
+ }
31795
+ for(i=1; i<nArg; i++){
31796
+ char *z = azArg[i];
31797
+ if( z[0]=='-' && z[1]=='-' && z[2]!=0 ) z++;
31798
+ if( cli_strcmp(z,"-keep")==0 ){
31799
+ bKeep = 1;
31800
+ }else if( cli_strcmp(z,"-show")==0 ){
31801
+ if( cli_output_capture ){
31802
+ sqlite3_fprintf(stdout, "%s", sqlite3_str_value(cli_output_capture));
31803
+ }
31804
+ bKeep = 1;
31805
+ }else if( z[0]=='-'
31806
+ && (k = pickStr(&z[1],0,"glob","notglob","exact",""))>=0
31807
+ ){
31808
+ if( eCheck && eCheck!=k+1 ){
31809
+ dotCmdError(p, i, "incompatible with prior options",0);
31810
+ return 1;
31811
+ }
31812
+ eCheck = k+1;
31813
+ }else if( zCheck ){
31814
+ dotCmdError(p, i, "unknown option", 0);
31815
+ return 1;
31816
+ }else{
31817
+ zCheck = azArg[i];
31818
+ }
31819
+ }
31820
+ if( zCheck==0 ){
31821
+ dotCmdError(p, 0, "no PATTERN specified", 0);
31822
+ return 1;
31823
+ }
31824
+ if( cli_output_capture && sqlite3_str_length(cli_output_capture) ){
31825
+ zTest = sqlite3_str_value(cli_output_capture);
31826
+ shell_check_oom(zTest);
31827
+ }else{
31828
+ zTest = "";
31829
+ }
31830
+ p->nTestRun++;
31831
+ if( zCheck[0]=='<' && zCheck[1]=='<' && zCheck[2]!=0 ){
31832
+ int nCheck = strlen30(zCheck);
31833
+ sqlite3_str *pPattern = sqlite3_str_new(p->db);
31834
+ char zLine[2000];
31835
+ while( sqlite3_fgets(zLine,sizeof(zLine),p->in) ){
31836
+ if( strchr(zLine,'\n') ) p->lineno++;
31837
+ if( cli_strncmp(&zCheck[2],zLine,nCheck-2)==0 ) break;
31838
+ sqlite3_str_appendall(pPattern, zLine);
31839
+ }
31840
+ zPattern = sqlite3_str_finish(pPattern);
31841
+ if( zPattern==0 ){
31842
+ zPattern = sqlite3_mprintf("");
31843
+ }
31844
+ }else{
31845
+ zPattern = zCheck;
31846
+ }
31847
+ shell_check_oom(zPattern);
31848
+ switch( eCheck ){
31849
+ case 1: {
31850
+ char *zGlob = sqlite3_mprintf("*%s*", zPattern);
31851
+ isOk = testcase_glob(zGlob, zTest)!=0;
31852
+ sqlite3_free(zGlob);
31853
+ break;
31854
+ }
31855
+ case 2: {
31856
+ char *zGlob = sqlite3_mprintf("*%s*", zPattern);
31857
+ isOk = testcase_glob(zGlob, zTest)==0;
31858
+ sqlite3_free(zGlob);
31859
+ break;
31860
+ }
31861
+ case 3: {
31862
+ isOk = cli_strcmp(zTest,zPattern)==0;
31863
+ break;
31864
+ }
31865
+ default: {
31866
+ /* Skip leading and trailing \n and \r on both pattern and test output */
31867
+ const char *z1 = zPattern;
31868
+ const char *z2 = zTest;
31869
+ size_t n1, n2;
31870
+ while( z1[0]=='\n' || z1[0]=='\r' ) z1++;
31871
+ n1 = strlen(z1);
31872
+ while( n1>0 && (z1[n1-1]=='\n' || z1[n1-1]=='\r') ) n1--;
31873
+ while( z2[0]=='\n' || z2[0]=='\r' ) z2++;
31874
+ n2 = strlen(z2);
31875
+ while( n2>0 && (z2[n2-1]=='\n' || z2[n2-1]=='\r') ) n2--;
31876
+ isOk = n1==n2 && memcmp(z1,z2,n1)==0;
31877
+ break;
31878
+ }
31879
+ }
31880
+ if( !isOk ){
31881
+ sqlite3_fprintf(stderr,
31882
+ "%s:%lld: .check failed for testcase %s\n",
31883
+ p->zInFile, iStart, p->zTestcase);
31884
+ p->nTestErr++;
31885
+ sqlite3_fprintf(stderr, "Expected: [%s]\n", zPattern);
31886
+ sqlite3_fprintf(stderr, "Got: [%s]\n", zTest);
31887
+ }
31888
+ if( zPattern!=zCheck ){
31889
+ sqlite3_free(zPattern);
31890
+ }
31891
+ if( !bKeep ){
31892
+ output_reset(p);
31893
+ p->zTestcase[0] = 0;
31894
+ }
31895
+ return 0;
31896
+}
31897
+
31898
+/*
31899
+** DOT-COMMAND: .testcase
31900
+** USAGE: .testcase [OPTIONS] NAME
31901
+**
31902
+** Start a new test case identified by NAME. All output
31903
+** through the next ".check" command is captured for comparison. See the
31904
+** ".check" commandn for additional informatioon.
31905
+**
31906
+** Options:
31907
+** --error-prefix TEXT Change error message prefix text to TEXT
31908
+*/
31909
+static int dotCmdTestcase(ShellState *p){
31910
+ int nArg = p->dot.nArg; /* Number of arguments */
31911
+ char **azArg = p->dot.azArg; /* Text of the arguments */
31912
+ int i; /* Loop counter */
31913
+ const char *zName = 0; /* Testcase name */
31914
+
31915
+ for(i=1; i<nArg; i++){
31916
+ char *z = azArg[i];
31917
+ if( z[0]=='-' && z[1]=='-' && z[2]!=0 ) z++;
31918
+ if( optionMatch(z,"error-prefix") ){
31919
+ if( i+1>=nArg ){
31920
+ dotCmdError(p, i, "missing argument", 0);
31921
+ return 1;
31922
+ }
31923
+ free(p->zErrPrefix);
31924
+ i++;
31925
+ p->zErrPrefix = azArg[i][0]==0 ? 0 : strdup(azArg[i]);
31926
+ }else if( zName ){
31927
+ dotCmdError(p, i, "unknown option", 0);
31928
+ return 1;
31929
+ }else{
31930
+ zName = azArg[i];
31931
+ }
31932
+ }
31933
+ output_reset(p);
31934
+ if( cli_output_capture ){
31935
+ sqlite3_str_free(cli_output_capture);
31936
+ }
31937
+ cli_output_capture = sqlite3_str_new(0);
31938
+ if( zName ){
31939
+ sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", zName);
31940
+ }else{
31941
+ sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s:%lld",
31942
+ p->zInFile, p->lineno);
31943
+ }
31944
+ return 0;
31945
+}
3133331946
3133431947
/*
3133531948
** Enlarge the space allocated in p->dot so that it can hold more
3133631949
** than nArg parsed command-line arguments.
3133731950
*/
@@ -31360,11 +31973,11 @@
3136031973
free(p->dot.zCopy);
3136131974
z = p->dot.zCopy = strdup(zLine);
3136231975
shell_check_oom(z);
3136331976
szLine = strlen(z);
3136431977
while( szLine>0 && IsSpace(z[szLine-1]) ) szLine--;
31365
- if( szLine>0 && z[szLine-1]==';' && p->iCompat>=20251115 ){
31978
+ if( szLine>0 && z[szLine-1]==';' ){
3136631979
szLine--;
3136731980
while( szLine>0 && IsSpace(z[szLine-1]) ) szLine--;
3136831981
}
3136931982
z[szLine] = 0;
3137031983
parseDotRealloc(p, 2);
@@ -31580,35 +32193,17 @@
3158032193
eputz("Usage: .changes on|off\n");
3158132194
rc = 1;
3158232195
}
3158332196
}else
3158432197
31585
-#ifndef SQLITE_SHELL_FIDDLE
3158632198
/* Cancel output redirection, if it is currently set (by .testcase)
3158732199
** Then read the content of the testcase-out.txt file and compare against
3158832200
** azArg[1]. If there are differences, report an error and exit.
3158932201
*/
3159032202
if( c=='c' && n>=3 && cli_strncmp(azArg[0], "check", n)==0 ){
31591
- char *zRes = 0;
31592
- output_reset(p);
31593
- if( nArg!=2 ){
31594
- eputz("Usage: .check GLOB-PATTERN\n");
31595
- rc = 2;
31596
- }else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
31597
- rc = 2;
31598
- }else if( testcase_glob(azArg[1],zRes)==0 ){
31599
- cli_printf(stderr,
31600
- "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
31601
- p->zTestcase, azArg[1], zRes);
31602
- rc = 1;
31603
- }else{
31604
- cli_printf(p->out, "testcase-%s ok\n", p->zTestcase);
31605
- p->nCheck++;
31606
- }
31607
- sqlite3_free(zRes);
32203
+ rc = dotCmdCheck(p);
3160832204
}else
31609
-#endif /* !defined(SQLITE_SHELL_FIDDLE) */
3161032205
3161132206
#ifndef SQLITE_SHELL_FIDDLE
3161232207
if( c=='c' && cli_strncmp(azArg[0], "clone", n)==0 ){
3161332208
failIfSafeMode(p, "cannot run .clone in safe mode");
3161432209
if( nArg==2 ){
@@ -32187,10 +32782,11 @@
3218732782
}else
3218832783
3218932784
if( c=='h' && cli_strncmp(azArg[0], "headers", n)==0 ){
3219032785
if( nArg==2 ){
3219132786
p->mode.spec.bTitles = booleanValue(azArg[1]) ? QRF_Yes : QRF_No;
32787
+ p->mode.mFlags |= MFLG_HDR;
3219232788
p->mode.spec.eTitle = aModeInfo[p->mode.eMode].eHdr;
3219332789
}else{
3219432790
eputz("Usage: .headers on|off\n");
3219532791
rc = 1;
3219632792
}
@@ -32240,14 +32836,14 @@
3224032836
sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1);
3224132837
goto meta_command_exit;
3224232838
}
3224332839
zSql = sqlite3_mprintf(
3224432840
"SELECT rootpage, 0 FROM sqlite_schema"
32245
- " WHERE name='%q' AND type='index'"
32841
+ " WHERE type='index' AND lower(name)=lower('%q')"
3224632842
"UNION ALL "
3224732843
"SELECT rootpage, 1 FROM sqlite_schema"
32248
- " WHERE name='%q' AND type='table'"
32844
+ " WHERE type='table' AND lower(name)=lower('%q')"
3224932845
" AND sql LIKE '%%without%%rowid%%'",
3225032846
azArg[1], azArg[1]
3225132847
);
3225232848
sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
3225332849
sqlite3_free(zSql);
@@ -32401,13 +32997,14 @@
3240132997
goto meta_command_exit;
3240232998
}
3240332999
if( nArg==3 ){
3240433000
sqlite3_limit(p->db, aLimit[iLimit].limitCode,
3240533001
(int)integerValue(azArg[2]));
33002
+ }else{
33003
+ cli_printf(stdout, "%20s %d\n", aLimit[iLimit].zLimitName,
33004
+ sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1));
3240633005
}
32407
- cli_printf(stdout, "%20s %d\n", aLimit[iLimit].zLimitName,
32408
- sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1));
3240933006
}
3241033007
}else
3241133008
3241233009
if( c=='l' && n>2 && cli_strncmp(azArg[0], "lint", n)==0 ){
3241333010
open_db(p, 0);
@@ -32493,21 +33090,23 @@
3249333090
int iName = 1; /* Index in azArg[] of the filename */
3249433091
int newFlag = 0; /* True to delete file before opening */
3249533092
int openMode = SHELL_OPEN_UNSPEC;
3249633093
int openFlags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
3249733094
33095
+ if( p->bSafeMode ) openFlags = SQLITE_OPEN_READONLY;
33096
+
3249833097
/* Check for command-line arguments */
3249933098
for(iName=1; iName<nArg; iName++){
3250033099
const char *z = azArg[iName];
3250133100
#ifndef SQLITE_SHELL_FIDDLE
3250233101
if( optionMatch(z,"new") ){
3250333102
newFlag = 1;
3250433103
#ifdef SQLITE_HAVE_ZLIB
32505
- }else if( optionMatch(z, "zip") ){
33104
+ }else if( optionMatch(z, "zip") && !p->bSafeMode ){
3250633105
openMode = SHELL_OPEN_ZIPFILE;
3250733106
#endif
32508
- }else if( optionMatch(z, "append") ){
33107
+ }else if( optionMatch(z, "append") && !p->bSafeMode ){
3250933108
openMode = SHELL_OPEN_APPENDVFS;
3251033109
}else if( optionMatch(z, "readonly") ){
3251133110
openFlags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
3251233111
openFlags |= SQLITE_OPEN_READONLY;
3251333112
}else if( optionMatch(z, "exclusive") ){
@@ -32950,21 +33549,22 @@
3295033549
|| sqlite3_strlike(zName, "sqlite_schema", '\\')==0
3295133550
|| sqlite3_strlike(zName,"sqlite_temp_master", '\\')==0
3295233551
|| sqlite3_strlike(zName,"sqlite_temp_schema", '\\')==0;
3295333552
if( isSchema ){
3295433553
cli_printf(p->out,
32955
- "CREATE TABLE %s (\n"
33554
+ "CREATE TABLE %ssqlite_schema (\n"
3295633555
" type text,\n"
3295733556
" name text,\n"
3295833557
" tbl_name text,\n"
3295933558
" rootpage integer,\n"
3296033559
" sql text\n"
32961
- ");\n", zName);
33560
+ ");\n",
33561
+ sqlite3_strlike("sqlite_t%",zName,0)==0 ? "temp." : ""
33562
+ );
3296233563
}
3296333564
}
32964
- rc = sqlite3_prepare_v2(p->db, "SELECT name FROM pragma_database_list",
32965
- -1, &pStmt, 0);
33565
+ rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
3296633566
if( rc ){
3296733567
shellDatabaseError(p->db);
3296833568
sqlite3_finalize(pStmt);
3296933569
3297033570
rc = 1;
@@ -32972,11 +33572,11 @@
3297233572
}
3297333573
pSql = sqlite3_str_new(p->db);
3297433574
sqlite3_str_appendf(pSql, "SELECT sql FROM", 0);
3297533575
iSchema = 0;
3297633576
while( sqlite3_step(pStmt)==SQLITE_ROW ){
32977
- const char *zDb = (const char*)sqlite3_column_text(pStmt, 0);
33577
+ const char *zDb = (const char*)sqlite3_column_text(pStmt, 1);
3297833578
char zScNum[30];
3297933579
sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema);
3298033580
sqlite3_str_appendall(pSql, zDiv);
3298133581
zDiv = " UNION ALL ";
3298233582
if( sqlite3_stricmp(zDb, "main")==0 ){
@@ -32992,11 +33592,12 @@
3299233592
" AS sql, type, tbl_name, name, rowid, %d AS snum, %Q as sname",
3299333593
++iSchema, zDb);
3299433594
sqlite3_str_appendf(pSql," FROM \"%w\".sqlite_schema", zDb);
3299533595
}
3299633596
sqlite3_finalize(pStmt);
32997
-#ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS
33597
+#if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) \
33598
+ && !defined(SQLITE_OMIT_VIRTUALTABLE)
3299833599
if( zName ){
3299933600
sqlite3_str_appendall(pSql,
3300033601
" UNION ALL SELECT shell_module_schema(name),"
3300133602
" 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list");
3300233603
}
@@ -33016,11 +33617,11 @@
3301633617
}else{
3301733618
sqlite3_str_appendf(pSql, " LIKE %Q ESCAPE '\\' AND ", zName);
3301833619
}
3301933620
}
3302033621
if( bNoSystemTabs ){
33021
- sqlite3_str_appendf(pSql, " name NOT LIKE 'sqlite__%%' ESCALE '_' AND ");
33622
+ sqlite3_str_appendf(pSql, " name NOT LIKE 'sqlite__%%' ESCAPE '_' AND ");
3302233623
}
3302333624
sqlite3_str_appendf(pSql, "sql IS NOT NULL ORDER BY snum, rowid");
3302433625
if( bDebug ){
3302533626
cli_printf(p->out, "SQL: %s;\n", sqlite3_str_value(pSql));
3302633627
}else{
@@ -33734,25 +34335,15 @@
3373434335
sqlite3_str_free(pSql);
3373534336
modePop(p);
3373634337
if( rc ) return shellDatabaseError(p->db);
3373734338
}else
3373834339
33739
-#ifndef SQLITE_SHELL_FIDDLE
33740
- /* Begin redirecting output to the file "testcase-out.txt" */
34340
+ /* Set the p->zTestcase name and begin redirecting output into
34341
+ ** the cli_output_capture sqlite3_str */
3374134342
if( c=='t' && cli_strcmp(azArg[0],"testcase")==0 ){
33742
- output_reset(p);
33743
- p->out = output_file_open(p, "testcase-out.txt");
33744
- if( p->out==0 ){
33745
- eputz("Error: cannot open 'testcase-out.txt'\n");
33746
- }
33747
- if( nArg>=2 ){
33748
- sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]);
33749
- }else{
33750
- sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
33751
- }
34343
+ rc = dotCmdTestcase(p);
3375234344
}else
33753
-#endif /* !defined(SQLITE_SHELL_FIDDLE) */
3375434345
3375534346
#ifndef SQLITE_UNTESTABLE
3375634347
if( c=='t' && n>=8 && cli_strncmp(azArg[0], "testctrl", n)==0 ){
3375734348
static const struct {
3375834349
const char *zCtrlName; /* Name of a test-control option */
@@ -35068,11 +35659,10 @@
3506835659
" -bail stop after hitting an error\n"
3506935660
" -batch force batch I/O\n"
3507035661
" -box set output mode to 'box'\n"
3507135662
" -cmd COMMAND run \"COMMAND\" before reading stdin\n"
3507235663
" -column set output mode to 'column'\n"
35073
- " -compat YYYYMMDD set default options for date YYYYMMDD\n"
3507435664
" -csv set output mode to 'csv'\n"
3507535665
#if !defined(SQLITE_OMIT_DESERIALIZE)
3507635666
" -deserialize open the database using sqlite3_deserialize()\n"
3507735667
#endif
3507835668
" -echo print inputs before execution\n"
@@ -35152,15 +35742,10 @@
3515235742
/*
3515335743
** Initialize the state information in data
3515435744
*/
3515535745
static void main_init(ShellState *p) {
3515635746
memset(p, 0, sizeof(*p));
35157
-#if defined(COMPATIBILITY_DATE)
35158
- p->iCompat = COMPATIBILITY_DATE;
35159
-#else
35160
- p->iCompat = 20251116;
35161
-#endif
3516235747
p->pAuxDb = &p->aAuxDb[0];
3516335748
p->shellFlgs = SHFLG_Lookaside;
3516435749
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, p);
3516535750
#if !defined(SQLITE_SHELL_FIDDLE)
3516635751
verify_uninitialized();
@@ -35174,22 +35759,18 @@
3517435759
/*
3517535760
** Output text to the console in a font that attracts extra attention.
3517635761
*/
3517735762
#if defined(_WIN32) || defined(WIN32)
3517835763
static void printBold(const char *zText){
35179
-#if !SQLITE_OS_WINRT
3518035764
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
3518135765
CONSOLE_SCREEN_BUFFER_INFO defaultScreenInfo;
3518235766
GetConsoleScreenBufferInfo(out, &defaultScreenInfo);
3518335767
SetConsoleTextAttribute(out,
3518435768
FOREGROUND_RED|FOREGROUND_INTENSITY
3518535769
);
35186
-#endif
3518735770
sputz(stdout, zText);
35188
-#if !SQLITE_OS_WINRT
3518935771
SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes);
35190
-#endif
3519135772
}
3519235773
#else
3519335774
static void printBold(const char *zText){
3519435775
cli_printf(stdout, "\033[1m%s\033[0m", zText);
3519535776
}
@@ -35219,29 +35800,65 @@
3521935800
cli_puts(z, p->out);
3522035801
fflush(p->out);
3522135802
return 1;
3522235803
}
3522335804
35224
-#ifndef SQLITE_SHELL_IS_UTF8
35225
-# if (defined(_WIN32) || defined(WIN32)) \
35226
- && (defined(_MSC_VER) || (defined(UNICODE) && defined(__GNUC__)))
35227
-# define SQLITE_SHELL_IS_UTF8 (0)
35228
-# else
35229
-# define SQLITE_SHELL_IS_UTF8 (1)
35230
-# endif
35231
-#endif
35232
-
35805
+/* Alternative name to the entry point for Fiddle */
3523335806
#ifdef SQLITE_SHELL_FIDDLE
3523435807
# define main fiddle_main
3523535808
#endif
3523635809
35237
-#if SQLITE_SHELL_IS_UTF8
35238
-int SQLITE_CDECL main(int argc, char **argv){
35239
-#else
35810
+/* Use the wmain() entry point on Windows. Translate arguments to
35811
+** UTF8, then invoke the traditional main() entry point which is
35812
+** renamed using a #define to utf8_main() .
35813
+*/
35814
+#if defined(_WIN32) && !defined(main)
35815
+# define main utf8_main /* Rename entry point to utf_main() */
35816
+int SQLITE_CDECL utf8_main(int,char**); /* Forward declaration */
3524035817
int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
35241
- char **argv;
35242
-#endif
35818
+ int rc, i;
35819
+ char **argv = malloc( sizeof(char*) * (argc+1) );
35820
+ char **orig = argv;
35821
+ if( argv==0 ){
35822
+ fprintf(stderr, "malloc failed\n");
35823
+ exit(1);
35824
+ }
35825
+ for(i=0; i<argc; i++){
35826
+ int nByte = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, 0, 0, 0, 0);
35827
+ if( nByte==0 ){
35828
+ argv[i] = 0;
35829
+ }else{
35830
+ argv[i] = malloc( nByte );
35831
+ if( argv[i]==0 ){
35832
+ fprintf(stderr, "malloc failed\n");
35833
+ exit(1);
35834
+ }
35835
+ nByte = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, argv[i],nByte,0,0);
35836
+ if( nByte==0 ){
35837
+ free(argv[i]);
35838
+ argv[i] = 0;
35839
+ }
35840
+ }
35841
+ }
35842
+ argv[argc] = 0;
35843
+ rc = utf8_main(argc, argv);
35844
+ for(i=0; i<argc; i++) free(orig[i]);
35845
+ free(argv);
35846
+ return rc;
35847
+}
35848
+#endif /* WIN32 */
35849
+
35850
+/*
35851
+** This is the main entry point for the process. Everything starts here.
35852
+**
35853
+** The "main" identifier may have been #defined to something else:
35854
+**
35855
+** utf8_main On Windows
35856
+** fiddle_main In Fiddle
35857
+** sqlite3_shell Other projects that use shell.c as a subroutine
35858
+*/
35859
+int SQLITE_CDECL main(int argc, char **argv){
3524335860
#ifdef SQLITE_DEBUG
3524435861
sqlite3_int64 mem_main_enter = 0;
3524535862
#endif
3524635863
char *zErrMsg = 0;
3524735864
#ifdef SQLITE_SHELL_FIDDLE
@@ -35259,14 +35876,10 @@
3525935876
int nOptsEnd = argc;
3526035877
int bEnableVfstrace = 0;
3526135878
char **azCmd = 0;
3526235879
int *aiCmd = 0;
3526335880
const char *zVfs = 0; /* Value of -vfs command-line option */
35264
-#if !SQLITE_SHELL_IS_UTF8
35265
- char **argvToFree = 0;
35266
- int argcToFree = 0;
35267
-#endif
3526835881
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
3526935882
3527035883
#ifdef SQLITE_SHELL_FIDDLE
3527135884
stdin_is_interactive = 0;
3527235885
stdout_is_console = 1;
@@ -35291,15 +35904,11 @@
3529135904
){
3529235905
exit(1);
3529335906
}
3529435907
}else{
3529535908
#if defined(_WIN32) || defined(WIN32)
35296
-#if SQLITE_OS_WINRT
35297
- __debugbreak();
35298
-#else
3529935909
DebugBreak();
35300
-#endif
3530135910
#elif defined(SIGTRAP)
3530235911
raise(SIGTRAP);
3530335912
#endif
3530435913
}
3530535914
}
@@ -35321,36 +35930,10 @@
3532135930
exit(1);
3532235931
}
3532335932
#endif
3532435933
main_init(&data);
3532535934
35326
- /* On Windows, we must translate command-line arguments into UTF-8.
35327
- ** The SQLite memory allocator subsystem has to be enabled in order to
35328
- ** do this. But we want to run an sqlite3_shutdown() afterwards so that
35329
- ** subsequent sqlite3_config() calls will work. So copy all results into
35330
- ** memory that does not come from the SQLite memory allocator.
35331
- */
35332
-#if !SQLITE_SHELL_IS_UTF8
35333
- sqlite3_initialize();
35334
- argvToFree = malloc(sizeof(argv[0])*argc*2);
35335
- shell_check_oom(argvToFree);
35336
- argcToFree = argc;
35337
- argv = argvToFree + argc;
35338
- for(i=0; i<argc; i++){
35339
- char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
35340
- i64 n;
35341
- shell_check_oom(z);
35342
- n = strlen(z);
35343
- argv[i] = malloc( n+1 );
35344
- shell_check_oom(argv[i]);
35345
- memcpy(argv[i], z, n+1);
35346
- argvToFree[i] = argv[i];
35347
- sqlite3_free(z);
35348
- }
35349
- sqlite3_shutdown();
35350
-#endif
35351
-
3535235935
assert( argc>=1 && argv && argv[0] );
3535335936
Argv0 = argv[0];
3535435937
3535535938
#ifdef SQLITE_SHELL_DBNAME_PROC
3535635939
{
@@ -35362,11 +35945,11 @@
3536235945
SQLITE_SHELL_DBNAME_PROC(&data.pAuxDb->zDbFilename);
3536335946
warnInmemoryDb = 0;
3536435947
}
3536535948
#endif
3536635949
35367
- /* Do an initial pass through the command-line argument to locate
35950
+ /* Do an initial pass through the command-line arguments to locate
3536835951
** the name of the database file, the name of the initialization file,
3536935952
** the size of the alternative malloc heap, options affecting commands
3537035953
** or SQL run from the command line, and the first command to execute.
3537135954
*/
3537235955
#ifndef SQLITE_SHELL_FIDDLE
@@ -35374,11 +35957,11 @@
3537435957
#endif
3537535958
for(i=1; i<argc; i++){
3537635959
char *z;
3537735960
z = argv[i];
3537835961
if( z[0]!='-' || i>nOptsEnd ){
35379
- if( data.aAuxDb->zDbFilename==0 ){
35962
+ if( data.aAuxDb->zDbFilename==0 && !isScriptFile(z,1) ){
3538035963
data.aAuxDb->zDbFilename = z;
3538135964
}else{
3538235965
/* Excess arguments are interpreted as SQL (or dot-commands) and
3538335966
** mean that nothing is read from stdin */
3538435967
readStdin = 0;
@@ -35419,15 +36002,10 @@
3541936002
if( n<2 ){
3542036003
sqlite3_fprintf(stderr,"minimum --screenwidth is 2\n");
3542136004
exit(1);
3542236005
}
3542336006
stdout_tty_width = n;
35424
- }else if( cli_strcmp(z,"-compat")==0 ){
35425
- data.iCompat = atoi(cmdline_option_value(argc, argv, ++i));
35426
- modeFree(&data.mode);
35427
- memset(&data.mode, 0, sizeof(data.mode));
35428
- modeDefault(&data);
3542936007
}else if( cli_strcmp(z,"-utf8")==0 ){
3543036008
}else if( cli_strcmp(z,"-no-utf8")==0 ){
3543136009
}else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
3543236010
int val = 0;
3543336011
sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW, &val);
@@ -35547,10 +36125,20 @@
3554736125
}else if( cli_strcmp(z,"-safe")==0 ){
3554836126
/* no-op - catch this on the second pass */
3554936127
}else if( cli_strcmp(z,"-escape")==0 && i+1<argc ){
3555036128
/* skip over the argument */
3555136129
i++;
36130
+ }else if( cli_strcmp(z,"-test-argv")==0 ){
36131
+ /* Undocumented test option. Print the values in argv[] and exit.
36132
+ ** Use this to verify that any translation of the argv[], for example
36133
+ ** on Windows that receives wargv[] from the OS and must convert
36134
+ ** to UTF8 prior to calling this routine. */
36135
+ int kk;
36136
+ for(kk=0; kk<argc; kk++){
36137
+ sqlite3_fprintf(stdout,"argv[%d] = \"%s\"\n", kk, argv[kk]);
36138
+ }
36139
+ return 0;
3555236140
}
3555336141
}
3555436142
#ifndef SQLITE_SHELL_FIDDLE
3555536143
if( !bEnableVfstrace ) verify_uninitialized();
3555636144
#endif
@@ -35573,11 +36161,30 @@
3557336161
3557436162
if( zVfs ){
3557536163
sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
3557636164
if( pVfs ){
3557736165
sqlite3_vfs_register(pVfs, 1);
35578
- }else{
36166
+ }
36167
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
36168
+ else if( access(zVfs,0)==0 ){
36169
+ /* If the VFS name is not the name of an existing VFS, but it is
36170
+ ** the name of a file, then try to load that file as an extension.
36171
+ ** Presumably the extension implements the desired VFS. */
36172
+ sqlite3 *db = 0;
36173
+ char *zErr = 0;
36174
+ sqlite3_open(":memory:", &db);
36175
+ sqlite3_enable_load_extension(db, 1);
36176
+ rc = sqlite3_load_extension(db, zVfs, 0, &zErr);
36177
+ sqlite3_close(db);
36178
+ if( (rc&0xff)!=SQLITE_OK ){
36179
+ cli_printf(stderr, "could not load extension VFS \"%s\": %s\n",
36180
+ zVfs, zErr);
36181
+ exit(1);
36182
+ }
36183
+ }
36184
+#endif
36185
+ else{
3557936186
cli_printf(stderr,"no such VFS: \"%s\"\n", zVfs);
3558036187
exit(1);
3558136188
}
3558236189
}
3558336190
@@ -35586,11 +36193,12 @@
3558636193
data.pAuxDb->zDbFilename = ":memory:";
3558736194
warnInmemoryDb = argc==1;
3558836195
#else
3558936196
cli_printf(stderr,
3559036197
"%s: Error: no database filename specified\n", Argv0);
35591
- return 1;
36198
+ rc = 1;
36199
+ goto shell_main_exit;
3559236200
#endif
3559336201
}
3559436202
data.out = stdout;
3559536203
if( bEnableVfstrace ){
3559636204
vfstrace_register("trace",0,vfstraceOut, &data, 1);
@@ -35613,11 +36221,11 @@
3561336221
** is given on the command line, look for a file named ~/.sqliterc and
3561436222
** try to process it.
3561536223
*/
3561636224
if( !noInit ) process_sqliterc(&data,zInitFile);
3561736225
35618
- /* Make a second pass through the command-line argument and set
36226
+ /* Make a second pass through the command-line arguments and set
3561936227
** options. This second pass is delayed until after the initialization
3562036228
** file is processed so that the command-line arguments will override
3562136229
** settings in the initialization file.
3562236230
*/
3562336231
for(i=1; i<argc; i++){
@@ -35640,10 +36248,12 @@
3564036248
modeChange(&data, MODE_Json);
3564136249
}else if( cli_strcmp(z,"-markdown")==0 ){
3564236250
modeChange(&data, MODE_Markdown);
3564336251
}else if( cli_strcmp(z,"-table")==0 ){
3564436252
modeChange(&data, MODE_Table);
36253
+ }else if( cli_strcmp(z,"-psql")==0 ){
36254
+ modeChange(&data, MODE_Psql);
3564536255
}else if( cli_strcmp(z,"-box")==0 ){
3564636256
modeChange(&data, MODE_Box);
3564736257
}else if( cli_strcmp(z,"-csv")==0 ){
3564836258
modeChange(&data, MODE_Csv);
3564936259
}else if( cli_strcmp(z,"-escape")==0 && i+1<argc ){
@@ -35726,22 +36336,21 @@
3572636336
}else if( cli_strcmp(z,"-bail")==0 ){
3572736337
/* No-op. The bail_on_error flag should already be set. */
3572836338
}else if( cli_strcmp(z,"-version")==0 ){
3572936339
cli_printf(stdout, "%s %s (%d-bit)\n",
3573036340
sqlite3_libversion(), sqlite3_sourceid(), 8*(int)sizeof(char*));
35731
- return 0;
36341
+ rc = 0;
36342
+ goto shell_main_exit;
3573236343
}else if( cli_strcmp(z,"-interactive")==0 ){
3573336344
/* Need to check for interactive override here to so that it can
3573436345
** affect console setup (for Windows only) and testing thereof.
3573536346
*/
3573636347
stdin_is_interactive = 1;
3573736348
}else if( cli_strcmp(z,"-batch")==0 ){
3573836349
/* already handled */
3573936350
}else if( cli_strcmp(z,"-screenwidth")==0 ){
3574036351
i++;
35741
- }else if( cli_strcmp(z,"-compat")==0 ){
35742
- i++;
3574336352
}else if( cli_strcmp(z,"-utf8")==0 ){
3574436353
/* already handled */
3574536354
}else if( cli_strcmp(z,"-no-utf8")==0 ){
3574636355
/* already handled */
3574736356
}else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
@@ -35783,29 +36392,33 @@
3578336392
** we retain the goofy behavior for historical compatibility. */
3578436393
if( i==argc-1 ) break;
3578536394
z = cmdline_option_value(argc,argv,++i);
3578636395
if( z[0]=='.' ){
3578736396
rc = do_meta_command(z, &data);
35788
- if( rc && bail_on_error ) return rc==2 ? 0 : rc;
36397
+ if( rc && bail_on_error ){
36398
+ if( rc==2 ) rc = 0;
36399
+ goto shell_main_exit;
36400
+ }
3578936401
}else{
3579036402
open_db(&data, 0);
3579136403
rc = shell_exec(&data, z, &zErrMsg);
3579236404
if( zErrMsg!=0 ){
3579336405
shellEmitError(zErrMsg);
3579436406
sqlite3_free(zErrMsg);
35795
- if( bail_on_error ) return rc!=0 ? rc : 1;
36407
+ if( !rc ) rc = 1;
3579636408
}else if( rc!=0 ){
3579736409
cli_printf(stderr,"Error: unable to process SQL \"%s\"\n", z);
35798
- if( bail_on_error ) return rc;
3579936410
}
36411
+ if( bail_on_error ) goto shell_main_exit;
3580036412
}
3580136413
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
3580236414
}else if( cli_strncmp(z, "-A", 2)==0 ){
3580336415
if( nCmd>0 ){
3580436416
cli_printf(stderr,"Error: cannot mix regular SQL or dot-commands"
3580536417
" with \"%s\"\n", z);
35806
- return 1;
36418
+ rc = 1;
36419
+ goto shell_main_exit;
3580736420
}
3580836421
open_db(&data, OPEN_DB_ZIPFILE);
3580936422
if( z[2] ){
3581036423
argv[i] = &z[2];
3581136424
arDotCommand(&data, 1, argv+(i-1), argc-(i-1));
@@ -35821,11 +36434,12 @@
3582136434
}else if( cli_strcmp(z,"-unsafe-testing")==0 ){
3582236435
/* Acted upon in first pass. */
3582336436
}else{
3582436437
cli_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
3582536438
eputz("Use -help for a list of options.\n");
35826
- return 1;
36439
+ rc = 1;
36440
+ goto shell_main_exit;
3582736441
}
3582836442
}
3582936443
3583036444
if( !readStdin ){
3583136445
/* Run all arguments that do not begin with '-' as if they were separate
@@ -35832,11 +36446,22 @@
3583236446
** command-line inputs, except for the argToSkip argument which contains
3583336447
** the database filename.
3583436448
*/
3583536449
for(i=0; i<nCmd; i++){
3583636450
echo_group_input(&data, azCmd[i]);
35837
- if( azCmd[i][0]=='.' ){
36451
+ if( isScriptFile(azCmd[i],0) ){
36452
+ FILE *inSaved = data.in;
36453
+ i64 savedLineno = data.lineno;
36454
+ int res = 1;
36455
+ if( (data.in = openChrSource(azCmd[i]))!=0 ){
36456
+ res = process_input(&data, azCmd[i]);
36457
+ fclose(data.in);
36458
+ }
36459
+ data.in = inSaved;
36460
+ data.lineno = savedLineno;
36461
+ if( res ) i = nCmd;
36462
+ }else if( azCmd[i][0]=='.' ){
3583836463
char *zErrCtx = malloc( 64 );
3583936464
shell_check_oom(zErrCtx);
3584036465
sqlite3_snprintf(64,zErrCtx,"argv[%i]:",aiCmd[i]);
3584136466
data.zInFile = "<cmdline>";
3584236467
data.zErrPrefix = zErrCtx;
@@ -35947,14 +36572,10 @@
3594736572
}
3594836573
find_home_dir(1);
3594936574
output_reset(&data);
3595036575
data.doXdgOpen = 0;
3595136576
clearTempFile(&data);
35952
-#if !SQLITE_SHELL_IS_UTF8
35953
- for(i=0; i<argcToFree; i++) free(argvToFree[i]);
35954
- free(argvToFree);
35955
-#endif
3595636577
modeFree(&data.mode);
3595736578
if( data.nSavedModes ){
3595836579
int ii;
3595936580
for(ii=0; ii<data.nSavedModes; ii++){
3596036581
modeFree(&data.aSavedModes[ii].mode);
3596136582
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -35,11 +35,11 @@
35 ** ext/recover/sqlite3recover.h
36 ** src/shell.c.in
37 **
38 ** To modify this program, get a copy of the canonical SQLite source tree,
39 ** edit the src/shell.c.in file and/or some of the other files that are
40 ** listed above, then rerun the rerun "make shell.c".
41 */
42 /************************* Begin src/shell.c.in ******************/
43 /*
44 ** 2001 September 15
45 **
@@ -49,11 +49,11 @@
49 ** May you do good and not evil.
50 ** May you find forgiveness for yourself and forgive others.
51 ** May you share freely, never taking more than you give.
52 **
53 *************************************************************************
54 ** This file contains code to implement the "sqlite" command line
55 ** utility for accessing SQLite databases.
56 */
57 #if (defined(_WIN32) || defined(WIN32)) && !defined(_CRT_SECURE_NO_WARNINGS)
58 /* This needs to come before any includes for MSVC compiler */
59 #define _CRT_SECURE_NO_WARNINGS
@@ -71,26 +71,22 @@
71 # define SHELL_STRINGIFY(f) SHELL_STRINGIFY_(f)
72 #ifdef SQLITE_CUSTOM_INCLUDE
73 # include SHELL_STRINGIFY(SQLITE_CUSTOM_INCLUDE)
74 #endif
75
76 /*
77 ** Determine if we are dealing with WinRT, which provides only a subset of
78 ** the full Win32 API.
79 */
80 #if !defined(SQLITE_OS_WINRT)
81 # define SQLITE_OS_WINRT 0
82 #endif
83
84 /*
85 ** If SQLITE_SHELL_FIDDLE is defined then the shell is modified
86 ** somewhat for use as a WASM module in a web browser. This flag
87 ** should only be used when building the "fiddle" web application, as
88 ** the browser-mode build has much different user input requirements
89 ** and this build mode rewires the user input subsystem to account for
90 ** that.
91 */
 
 
 
 
92
93 /*
94 ** Warning pragmas copied from msvc.h in the core.
95 */
96 #if defined(_MSC_VER)
@@ -218,13 +214,10 @@
218 # define deliberate_fall_through
219 # endif
220 #endif
221
222 #if defined(_WIN32) || defined(WIN32)
223 # if SQLITE_OS_WINRT
224 # define SQLITE_OMIT_POPEN 1
225 # else
226 # include <io.h>
227 # include <fcntl.h>
228 # define isatty(h) _isatty(h)
229 # ifndef access
230 # define access(f,m) _access((f),(m))
@@ -235,11 +228,10 @@
235 # ifndef strdup
236 # define strdup _strdup
237 # endif
238 # undef pclose
239 # define pclose _pclose
240 # endif
241 #else
242 /* Make sure isatty() has a prototype. */
243 extern int isatty(int);
244
245 # if !defined(__RTP__) && !defined(_WRS_KERNEL) && !defined(SQLITE_WASI)
@@ -266,13 +258,10 @@
266 #define ToLower(X) (char)tolower((unsigned char)X)
267 #define IsAlnum(X) isalnum((unsigned char)X)
268 #define IsAlpha(X) isalpha((unsigned char)X)
269
270 #if defined(_WIN32) || defined(WIN32)
271 #if SQLITE_OS_WINRT
272 #include <intrin.h>
273 #endif
274 #undef WIN32_LEAN_AND_MEAN
275 #define WIN32_LEAN_AND_MEAN
276 #include <windows.h>
277
278 /* string conversion routines only needed on Win32 */
@@ -704,13 +693,15 @@
704 unsigned char bWordWrap; /* Try to wrap on word boundaries */
705 unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
706 unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
707 unsigned char eTitleAlign; /* Alignment for column headers */
708 unsigned char bSplitColumn; /* Wrap single-column output into many columns */
 
709 short int nWrap; /* Wrap columns wider than this */
710 short int nScreenWidth; /* Maximum overall table width */
711 short int nLineLimit; /* Maximum number of lines for any row */
 
712 int nCharLimit; /* Maximum number of characters in a cell */
713 int nWidth; /* Number of entries in aWidth[] */
714 int nAlign; /* Number of entries in aAlignment[] */
715 short int *aWidth; /* Column widths */
716 unsigned char *aAlign; /* Column alignments */
@@ -775,10 +766,11 @@
775 #define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
776 #define QRF_TEXT_Csv 3 /* CSV-style quoting */
777 #define QRF_TEXT_Html 4 /* HTML-style quoting */
778 #define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
779 #define QRF_TEXT_Json 6 /* JSON quoting */
 
780
781 /*
782 ** Quoting styles for BLOBs
783 ** Allowed values for sqlite3_qrf_spec.eBlob
784 */
@@ -842,17 +834,25 @@
842 /*
843 ** Return an estimate of the width, in columns, for the single Unicode
844 ** character c. For normal characters, the answer is always 1. But the
845 ** estimate might be 0 or 2 for zero-width and double-width characters.
846 **
847 ** Different display devices display unicode using different widths. So
848 ** it is impossible to know that true display width with 100% accuracy.
849 ** Inaccuracies in the width estimates might cause columns to be misaligned.
850 ** Unfortunately, there is nothing we can do about that.
851 */
852 int sqlite3_qrf_wcwidth(int c);
853
 
 
 
 
 
 
 
 
854
855 #ifdef __cplusplus
856 }
857 #endif
858 #endif /* !defined(SQLITE_QRF_H) */
@@ -915,11 +915,11 @@
915 int mxWidth; /* Screen width */
916 int mxHeight; /* nLineLimit */
917 union {
918 struct { /* Content for QRF_STYLE_Line */
919 int mxColWth; /* Maximum display width of any column */
920 const char **azCol; /* Names of output columns (MODE_Line) */
921 } sLine;
922 qrfEQPGraph *pGraph; /* EQP graph (Eqp, Stats, and StatsEst) */
923 struct { /* Content for QRF_STYLE_Explain */
924 int nIndent; /* Slots allocated for aiIndent */
925 int iIndent; /* Current slot */
@@ -961,10 +961,19 @@
961 #define qrfSpace(x) ((qrfCType[(unsigned char)x]&1)!=0)
962 #define qrfDigit(x) ((qrfCType[(unsigned char)x]&2)!=0)
963 #define qrfAlpha(x) ((qrfCType[(unsigned char)x]&4)!=0)
964 #define qrfAlnum(x) ((qrfCType[(unsigned char)x]&6)!=0)
965
 
 
 
 
 
 
 
 
 
966 /*
967 ** Set an error code and error message.
968 */
969 static void qrfError(
970 Qrf *p, /* Query result state */
@@ -990,10 +999,19 @@
990 */
991 static void qrfOom(Qrf *p){
992 qrfError(p, SQLITE_NOMEM, "out of memory");
993 }
994
 
 
 
 
 
 
 
 
 
995
996
997 /*
998 ** Add a new entry to the EXPLAIN QUERY PLAN data
999 */
@@ -1212,11 +1230,13 @@
1212 sqlite3_str_reset(pLine);
1213 }else{
1214 qrfEqpAppend(p, iId, iPid, zo);
1215 }
1216 }
 
1217 sqlite3_free(sqlite3_str_finish(pLine));
 
1218 sqlite3_free(sqlite3_str_finish(pStats));
1219 #endif
1220 }
1221
1222
@@ -1287,11 +1307,11 @@
1287 {1, 0x00ece}, {0, 0x00f18}, {1, 0x00f1a}, {0, 0x00f35}, {1, 0x00f36},
1288 {0, 0x00f37}, {1, 0x00f38}, {0, 0x00f39}, {1, 0x00f3a}, {0, 0x00f71},
1289 {1, 0x00f7f}, {0, 0x00f80}, {1, 0x00f85}, {0, 0x00f86}, {1, 0x00f88},
1290 {0, 0x00f90}, {1, 0x00f98}, {0, 0x00f99}, {1, 0x00fbd}, {0, 0x00fc6},
1291 {1, 0x00fc7}, {0, 0x0102d}, {1, 0x01031}, {0, 0x01032}, {1, 0x01033},
1292 {0, 0x01036}, {1, 0x01038}, {0, 0x01039}, {1, 0x0103a}, {0, 0x01058},
1293 {1, 0x0105a}, {2, 0x01100}, {0, 0x01160}, {1, 0x01200}, {0, 0x0135f},
1294 {1, 0x01360}, {0, 0x01712}, {1, 0x01715}, {0, 0x01732}, {1, 0x01735},
1295 {0, 0x01752}, {1, 0x01754}, {0, 0x01772}, {1, 0x01774}, {0, 0x017b4},
1296 {1, 0x017b6}, {0, 0x017b7}, {1, 0x017be}, {0, 0x017c6}, {1, 0x017c7},
1297 {0, 0x017c9}, {1, 0x017d4}, {0, 0x017dd}, {1, 0x017de}, {0, 0x0180b},
@@ -1330,11 +1350,11 @@
1330 */
1331 int sqlite3_qrf_wcwidth(int c){
1332 int iFirst, iLast;
1333
1334 /* Fast path for common characters */
1335 if( c<=0x300 ) return 1;
1336
1337 /* The general case */
1338 iFirst = 0;
1339 iLast = sizeof(aQrfUWidth)/sizeof(aQrfUWidth[0]) - 1;
1340 while( iFirst<iLast-1 ){
@@ -1396,17 +1416,24 @@
1396 return i+1;
1397 }
1398
1399 /*
1400 ** Return the length of a string in display characters.
1401 ** Multibyte UTF8 characters count as a single character
1402 ** for single-width characters, or as two characters for
1403 ** double-width characters.
 
 
 
 
 
 
 
1404 */
1405 static int qrfDisplayLength(const char *zIn){
1406 const unsigned char *z = (const unsigned char*)zIn;
1407 int n = 0;
1408 while( *z ){
1409 if( z[0]<' ' ){
1410 int k;
1411 if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
1412 z += k;
@@ -1436,15 +1463,18 @@
1436 ** Write the number of newlines into *pnNL. So, *pnNL will
1437 ** return 0 if everything fits on one line, or positive it
1438 ** it will need to be split.
1439 */
1440 static int qrfDisplayWidth(const char *zIn, sqlite3_int64 nByte, int *pnNL){
1441 const unsigned char *z = (const unsigned char*)zIn;
1442 const unsigned char *zEnd = &z[nByte];
1443 int mx = 0;
1444 int n = 0;
1445 int nNL = 0;
 
 
 
1446 while( z<zEnd ){
1447 if( z[0]<' ' ){
1448 int k;
1449 if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
1450 z += k;
@@ -1551,10 +1581,51 @@
1551 zOut[j++] = '^';
1552 zOut[j++] = 0x40+c;
1553 }
1554 }
1555 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1556
1557 /*
1558 ** If a field contains any character identified by a 1 in the following
1559 ** array, then the string must be quoted for CSV.
1560 */
@@ -1581,10 +1652,16 @@
1581 ** Encode text appropriately and append it to pOut.
1582 */
1583 static void qrfEncodeText(Qrf *p, sqlite3_str *pOut, const char *zTxt){
1584 int iStart = sqlite3_str_length(pOut);
1585 switch( p->spec.eText ){
 
 
 
 
 
 
1586 case QRF_TEXT_Sql: {
1587 if( p->spec.eEsc==QRF_ESC_Off ){
1588 sqlite3_str_appendf(pOut, "%Q", zTxt);
1589 }else{
1590 sqlite3_str_appendf(pOut, "%#Q", zTxt);
@@ -1739,10 +1816,57 @@
1739 return (const char*)sqlite3_column_text(p->pJTrans, 0);
1740 }else{
1741 return 0;
1742 }
1743 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1744
1745 /*
1746 ** Render value pVal into pOut
1747 */
1748 static void qrfRenderValue(Qrf *p, sqlite3_str *pOut, int iCol){
@@ -2124,40 +2248,10 @@
2124 }
2125 }
2126 sqlite3_str_append(pOut, (const char*)z, i);
2127 }
2128
2129 /*
2130 ** Output horizontally justified text into pOut. The text is the
2131 ** first nVal bytes of zVal. Include nWS bytes of whitespace, either
2132 ** split between both sides, or on the left, or on the right, depending
2133 ** on eAlign.
2134 */
2135 static void qrfPrintAligned(
2136 sqlite3_str *pOut, /* Append text here */
2137 const char *zVal, /* Text to append */
2138 int nVal, /* Use only the first nVal bytes of zVal[] */
2139 int nWS, /* Whitespace for horizonal alignment */
2140 unsigned char eAlign /* Alignment type */
2141 ){
2142 eAlign &= QRF_ALIGN_HMASK;
2143 if( eAlign==QRF_ALIGN_Center ){
2144 /* Center the text */
2145 sqlite3_str_appendchar(pOut, nWS/2, ' ');
2146 qrfAppendWithTabs(pOut, zVal, nVal);
2147 sqlite3_str_appendchar(pOut, nWS - nWS/2, ' ');
2148 }else if( eAlign==QRF_ALIGN_Right){
2149 /* Right justify the text */
2150 sqlite3_str_appendchar(pOut, nWS, ' ');
2151 qrfAppendWithTabs(pOut, zVal, nVal);
2152 }else{
2153 /* Left justify the next */
2154 qrfAppendWithTabs(pOut, zVal, nVal);
2155 sqlite3_str_appendchar(pOut, nWS, ' ');
2156 }
2157 }
2158
2159 /*
2160 ** GCC does not define the offsetof() macro so we'll have to do it
2161 ** ourselves.
2162 */
2163 #ifndef offsetof
@@ -2177,27 +2271,60 @@
2177 sqlite3_int64 nRow; /* Number of rows */
2178 sqlite3_int64 nAlloc; /* Number of cells allocated */
2179 sqlite3_int64 n; /* Number of cells. nCol*nRow */
2180 char **az; /* Content of all cells */
2181 int *aiWth; /* Width of each cell */
 
2182 struct qrfPerCol { /* Per-column data */
2183 char *z; /* Cache of text for current row */
2184 int w; /* Computed width of this column */
2185 int mxW; /* Maximum natural (unwrapped) width */
2186 unsigned char e; /* Alignment */
2187 unsigned char fx; /* Width is fixed */
 
2188 } *a; /* One per column */
2189 };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2190
2191 /*
2192 ** Free all the memory allocates in the qrfColData object
2193 */
2194 static void qrfColDataFree(qrfColData *p){
2195 sqlite3_int64 i;
2196 for(i=0; i<p->n; i++) sqlite3_free(p->az[i]);
2197 sqlite3_free(p->az);
2198 sqlite3_free(p->aiWth);
 
2199 sqlite3_free(p->a);
2200 memset(p, 0, sizeof(*p));
2201 }
2202
2203 /*
@@ -2205,10 +2332,11 @@
2205 ** Return non-zero if a memory allocation fails.
2206 */
2207 static int qrfColDataEnlarge(qrfColData *p){
2208 char **azData;
2209 int *aiWth;
 
2210 p->nAlloc = 2*p->nAlloc + 10*p->nCol;
2211 azData = sqlite3_realloc64(p->az, p->nAlloc*sizeof(char*));
2212 if( azData==0 ){
2213 qrfOom(p->p);
2214 qrfColDataFree(p);
@@ -2220,26 +2348,38 @@
2220 qrfOom(p->p);
2221 qrfColDataFree(p);
2222 return 1;
2223 }
2224 p->aiWth = aiWth;
 
 
 
 
 
 
 
2225 return 0;
2226 }
2227
2228 /*
2229 ** Print a markdown or table-style row separator using ascii-art
2230 */
2231 static void qrfRowSeparator(sqlite3_str *pOut, qrfColData *p, char cSep){
2232 int i;
2233 if( p->nCol>0 ){
2234 sqlite3_str_append(pOut, &cSep, 1);
 
 
 
2235 sqlite3_str_appendchar(pOut, p->a[0].w+p->nMargin, '-');
2236 for(i=1; i<p->nCol; i++){
2237 sqlite3_str_append(pOut, &cSep, 1);
2238 sqlite3_str_appendchar(pOut, p->a[i].w+p->nMargin, '-');
2239 }
2240 sqlite3_str_append(pOut, &cSep, 1);
 
 
2241 }
2242 sqlite3_str_append(pOut, "\n", 1);
2243 }
2244
2245 /*
@@ -2265,24 +2405,37 @@
2265 #define BOX_134 "\342\224\244" /* U+2524 -| */
2266 #define BOX_234 "\342\224\254" /* U+252c -,- */
2267 #define BOX_124 "\342\224\264" /* U+2534 -'- */
2268 #define BOX_1234 "\342\224\274" /* U+253c -|- */
2269
 
 
 
 
 
 
 
 
 
 
 
 
2270 /* Draw horizontal line N characters long using unicode box
2271 ** characters
2272 */
2273 static void qrfBoxLine(sqlite3_str *pOut, int N){
2274 const char zDash[] =
2275 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24
2276 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24;
2277 const int nDash = sizeof(zDash) - 1;
 
2278 N *= 3;
2279 while( N>nDash ){
2280 sqlite3_str_append(pOut, zDash, nDash);
2281 N -= nDash;
2282 }
2283 sqlite3_str_append(pOut, zDash, N);
2284 }
2285
2286 /*
2287 ** Draw a horizontal separator for a QRF_STYLE_Box table.
2288 */
@@ -2289,21 +2442,27 @@
2289 static void qrfBoxSeparator(
2290 sqlite3_str *pOut,
2291 qrfColData *p,
2292 const char *zSep1,
2293 const char *zSep2,
2294 const char *zSep3
 
2295 ){
2296 int i;
2297 if( p->nCol>0 ){
2298 sqlite3_str_appendall(pOut, zSep1);
2299 qrfBoxLine(pOut, p->a[0].w+p->nMargin);
 
 
 
2300 for(i=1; i<p->nCol; i++){
2301 sqlite3_str_appendall(pOut, zSep2);
2302 qrfBoxLine(pOut, p->a[i].w+p->nMargin);
2303 }
2304 sqlite3_str_appendall(pOut, zSep3);
 
 
2305 }
2306 sqlite3_str_append(pOut, "\n", 1);
2307 }
2308
2309 /*
@@ -2382,10 +2541,11 @@
2382 static void qrfSplitColumn(qrfColData *pData, Qrf *p){
2383 int nCol = 1;
2384 int *aw = 0;
2385 char **az = 0;
2386 int *aiWth = 0;
 
2387 int nColNext = 2;
2388 int w;
2389 struct qrfPerCol *a = 0;
2390 sqlite3_int64 nRow = 1;
2391 sqlite3_int64 i;
@@ -2419,35 +2579,47 @@
2419 if( a==0 ){
2420 sqlite3_free(az);
2421 sqlite3_free(aiWth);
2422 qrfOom(p);
2423 return;
 
 
 
 
 
 
 
 
2424 }
2425 for(i=0; i<pData->n; i++){
2426 sqlite3_int64 j = (i%nRow)*nCol + (i/nRow);
2427 az[j] = pData->az[i];
 
2428 pData->az[i] = 0;
2429 aiWth[j] = pData->aiWth[i];
2430 }
2431 while( i<nRow*nCol ){
2432 sqlite3_int64 j = (i%nRow)*nCol + (i/nRow);
2433 az[j] = sqlite3_mprintf("");
2434 if( az[j]==0 ) qrfOom(p);
2435 aiWth[j] = 0;
 
2436 i++;
2437 }
2438 for(i=0; i<nCol; i++){
2439 a[i].fx = a[i].mxW = a[i].w = aw[i];
2440 a[i].e = pData->a[0].e;
2441 }
2442 sqlite3_free(pData->az);
2443 sqlite3_free(pData->aiWth);
2444 sqlite3_free(pData->a);
 
2445 sqlite3_free(aw);
2446 pData->az = az;
2447 pData->aiWth = aiWth;
2448 pData->a = a;
 
2449 pData->nCol = nCol;
2450 pData->n = pData->nAlloc = nRow*nCol;
2451 for(i=w=0; i<nCol; i++) w += a[i].w;
2452 pData->nMargin = (p->spec.nScreenWidth - w)/(nCol - 1);
2453 if( pData->nMargin>5 ) pData->nMargin = 5;
@@ -2467,10 +2639,11 @@
2467 if( p->spec.nScreenWidth==0 ) return;
2468 if( p->spec.eStyle==QRF_STYLE_Column ){
2469 sepW = pData->nCol*2 - 2;
2470 }else{
2471 sepW = pData->nCol*3 + 1;
 
2472 }
2473 nCol = pData->nCol;
2474 for(i=sumW=0; i<nCol; i++) sumW += pData->a[i].w;
2475 if( p->spec.nScreenWidth >= sumW+sepW ) return;
2476
@@ -2478,10 +2651,11 @@
2478 pData->nMargin = 0;
2479 if( p->spec.eStyle==QRF_STYLE_Column ){
2480 sepW = pData->nCol - 1;
2481 }else{
2482 sepW = pData->nCol + 1;
 
2483 }
2484 targetW = p->spec.nScreenWidth - sepW;
2485
2486 #define MIN_SQUOZE 8
2487 #define MIN_EX_SQUOZE 16
@@ -2550,10 +2724,11 @@
2550 }
2551
2552 /* Initialize the data container */
2553 memset(&data, 0, sizeof(data));
2554 data.nCol = p->nCol;
 
2555 data.a = sqlite3_malloc64( nColumn*sizeof(struct qrfPerCol) );
2556 if( data.a==0 ){
2557 qrfOom(p);
2558 return;
2559 }
@@ -2563,19 +2738,27 @@
2563
2564 /* Load the column header names and all cell content into data */
2565 if( p->spec.bTitles==QRF_Yes ){
2566 unsigned char saved_eText = p->spec.eText;
2567 p->spec.eText = p->spec.eTitle;
 
2568 for(i=0; i<nColumn; i++){
2569 const char *z = (const char*)sqlite3_column_name(p->pStmt,i);
2570 int nNL = 0;
2571 int n, w;
2572 pStr = sqlite3_str_new(p->db);
2573 qrfEncodeText(p, pStr, z ? z : "");
2574 n = sqlite3_str_length(pStr);
 
2575 z = data.az[data.n] = sqlite3_str_finish(pStr);
2576 data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
 
 
 
 
 
 
2577 data.n++;
2578 if( w>data.a[i].mxW ) data.a[i].mxW = w;
2579 if( nNL ) data.bMultiRow = 1;
2580 }
2581 p->spec.eText = saved_eText;
@@ -2587,14 +2770,17 @@
2587 }
2588 for(i=0; i<nColumn; i++){
2589 char *z;
2590 int nNL = 0;
2591 int n, w;
 
2592 pStr = sqlite3_str_new(p->db);
2593 qrfRenderValue(p, pStr, i);
2594 n = sqlite3_str_length(pStr);
 
2595 z = data.az[data.n] = sqlite3_str_finish(pStr);
 
2596 data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
2597 data.n++;
2598 if( w>data.a[i].mxW ) data.a[i].mxW = w;
2599 if( nNL ) data.bMultiRow = 1;
2600 }
@@ -2680,11 +2866,16 @@
2680 }else{
2681 rowStart = BOX_13;
2682 colSep = BOX_13;
2683 rowSep = BOX_13 "\n";
2684 }
2685 qrfBoxSeparator(p->pOut, &data, BOX_23, BOX_234, BOX_34);
 
 
 
 
 
2686 break;
2687 case QRF_STYLE_Table:
2688 if( data.nMargin ){
2689 rowStart = "| ";
2690 colSep = " | ";
@@ -2692,11 +2883,16 @@
2692 }else{
2693 rowStart = "|";
2694 colSep = "|";
2695 rowSep = "|\n";
2696 }
2697 qrfRowSeparator(p->pOut, &data, '+');
 
 
 
 
 
2698 break;
2699 case QRF_STYLE_Column: {
2700 static const char zSpace[] = " ";
2701 rowStart = "";
2702 if( data.nMargin<2 ){
@@ -2724,20 +2920,32 @@
2724 szRowStart = (int)strlen(rowStart);
2725 szRowSep = (int)strlen(rowSep);
2726 szColSep = (int)strlen(colSep);
2727
2728 bWW = (p->spec.bWordWrap==QRF_Yes && data.bMultiRow);
2729 bRTrim = (p->spec.eStyle==QRF_STYLE_Column);
2730 for(i=0; i<data.n; i+=nColumn){
 
 
 
 
 
 
 
 
2731 int bMore;
2732 int nRow = 0;
2733
2734 /* Draw a single row of the table. This might be the title line
2735 ** (if there is a title line) or a row in the body of the table.
2736 ** The column number will be j. The row number is i/nColumn.
2737 */
2738 for(j=0; j<nColumn; j++){ data.a[j].z = data.az[i+j]; }
 
 
 
 
2739 do{
2740 sqlite3_str_append(p->pOut, rowStart, szRowStart);
2741 bMore = 0;
2742 for(j=0; j<nColumn; j++){
2743 int nThis = 0;
@@ -2744,11 +2952,11 @@
2744 int nWide = 0;
2745 int iNext = 0;
2746 int nWS;
2747 qrfWrapLine(data.a[j].z, data.a[j].w, bWW, &nThis, &nWide, &iNext);
2748 nWS = data.a[j].w - nWide;
2749 qrfPrintAligned(p->pOut, data.a[j].z, nThis, nWS, data.a[j].e);
2750 data.a[j].z += iNext;
2751 if( data.a[j].z[0]!=0 ){
2752 bMore = 1;
2753 }
2754 if( j<nColumn-1 ){
@@ -2766,11 +2974,12 @@
2766 if( data.a[j].z[0]==0 ){
2767 sqlite3_str_appendchar(p->pOut, data.a[j].w, ' ');
2768 }else{
2769 int nE = 3;
2770 if( nE>data.a[j].w ) nE = data.a[j].w;
2771 qrfPrintAligned(p->pOut, "...", nE, data.a[j].w-nE, data.a[j].e);
 
2772 }
2773 if( j<nColumn-1 ){
2774 sqlite3_str_append(p->pOut, colSep, szColSep);
2775 }else{
2776 if( bRTrim ) qrfRTrim(p->pOut);
@@ -2794,12 +3003,14 @@
2794 qrfRowSeparator(p->pOut, &data, '+');
2795 }
2796 break;
2797 }
2798 case QRF_STYLE_Box: {
2799 if( isTitleDataSeparator || data.bMultiRow ){
2800 qrfBoxSeparator(p->pOut, &data, BOX_123, BOX_1234, BOX_134);
 
 
2801 }
2802 break;
2803 }
2804 case QRF_STYLE_Markdown: {
2805 if( isTitleDataSeparator ){
@@ -2827,17 +3038,19 @@
2827 }
2828 }
2829 }
2830
2831 /* Draw the line across the bottom of the table */
2832 switch( p->spec.eStyle ){
2833 case QRF_STYLE_Box:
2834 qrfBoxSeparator(p->pOut, &data, BOX_12, BOX_124, BOX_14);
2835 break;
2836 case QRF_STYLE_Table:
2837 qrfRowSeparator(p->pOut, &data, '+');
2838 break;
 
 
2839 }
2840 qrfWrite(p);
2841
2842 qrfColDataFree(&data);
2843 return;
@@ -2903,11 +3116,11 @@
2903 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 0), "addr" ) );
2904 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 1), "opcode" ) );
2905 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 2), "p1" ) );
2906 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 3), "p2" ) );
2907
2908 for(iOp=0; SQLITE_ROW==sqlite3_step(p->pStmt); iOp++){
2909 int iAddr = sqlite3_column_int(p->pStmt, 0);
2910 const char *zOp = (const char*)sqlite3_column_text(p->pStmt, 1);
2911 int p1 = sqlite3_column_int(p->pStmt, 2);
2912 int p2 = sqlite3_column_int(p->pStmt, 3);
2913
@@ -2960,11 +3173,11 @@
2960 nWidth = sizeof(aScanExpWidth)/sizeof(int);
2961 iIndent = 3;
2962 }
2963 if( nArg>nWidth ) nArg = nWidth;
2964
2965 for(iOp=0; sqlite3_step(p->pStmt)==SQLITE_ROW; iOp++){
2966 /* If this is the first row seen, print out the headers */
2967 if( iOp==0 ){
2968 for(i=0; i<nArg; i++){
2969 const char *zCol = sqlite3_column_name(p->pStmt, aMap[i]);
2970 qrfWidthPrint(p,p->pOut, aWidth[i], zCol);
@@ -2989,11 +3202,11 @@
2989 int w = aWidth[i];
2990 const char *zVal = (const char*)sqlite3_column_text(p->pStmt, aMap[i]);
2991 int len;
2992 if( i==nArg-1 ) w = 0;
2993 if( zVal==0 ) zVal = "";
2994 len = qrfDisplayLength(zVal);
2995 if( len>w ){
2996 w = len;
2997 zSep = " ";
2998 }
2999 if( i==iIndent && aiIndent && iOp<nIndent ){
@@ -3168,34 +3381,40 @@
3168 }
3169 case QRF_STYLE_Line: {
3170 sqlite3_str *pVal;
3171 int mxW;
3172 int bWW;
 
3173 if( p->u.sLine.azCol==0 ){
3174 p->u.sLine.azCol = sqlite3_malloc64( p->nCol*sizeof(char*) );
3175 if( p->u.sLine.azCol==0 ){
3176 qrfOom(p);
3177 break;
3178 }
3179 p->u.sLine.mxColWth = 0;
3180 for(i=0; i<p->nCol; i++){
3181 int sz;
3182 p->u.sLine.azCol[i] = sqlite3_column_name(p->pStmt, i);
3183 if( p->u.sLine.azCol[i]==0 ) p->u.sLine.azCol[i] = "unknown";
3184 sz = qrfDisplayLength(p->u.sLine.azCol[i]);
 
 
 
 
3185 if( sz > p->u.sLine.mxColWth ) p->u.sLine.mxColWth = sz;
3186 }
3187 }
3188 if( p->nRow ) sqlite3_str_append(p->pOut, "\n", 1);
3189 pVal = sqlite3_str_new(p->db);
3190 mxW = p->mxWidth - (3 + p->u.sLine.mxColWth);
 
3191 bWW = p->spec.bWordWrap==QRF_Yes;
3192 for(i=0; i<p->nCol; i++){
3193 const char *zVal;
3194 int cnt = 0;
3195 qrfWidthPrint(p, p->pOut, -p->u.sLine.mxColWth, p->u.sLine.azCol[i]);
3196 sqlite3_str_append(p->pOut, " = ", 3);
3197 qrfRenderValue(p, pVal, i);
3198 zVal = sqlite3_str_value(pVal);
3199 if( zVal==0 ) zVal = "";
3200 do{
3201 int nThis, nWide, iNext;
@@ -3210,10 +3429,11 @@
3210 sqlite3_str_append(p->pOut, "\n", 1);
3211 zVal += iNext;
3212 }while( zVal[0] );
3213 sqlite3_str_reset(pVal);
3214 }
 
3215 sqlite3_free(sqlite3_str_finish(pVal));
3216 qrfWrite(p);
3217 break;
3218 }
3219 case QRF_STYLE_Eqp: {
@@ -3273,11 +3493,11 @@
3273 p->pOut = sqlite3_str_new(p->db);
3274 if( p->pOut==0 ){
3275 qrfOom(p);
3276 return;
3277 }
3278 p->iErr = 0;
3279 p->nCol = sqlite3_column_count(p->pStmt);
3280 p->nRow = 0;
3281 sz = sizeof(sqlite3_qrf_spec);
3282 memcpy(&p->spec, pSpec, sz);
3283 if( p->spec.zNull==0 ) p->spec.zNull = "";
@@ -3285,12 +3505,12 @@
3285 if( p->mxWidth<=0 ) p->mxWidth = QRF_MAX_WIDTH;
3286 p->mxHeight = p->spec.nLineLimit;
3287 if( p->mxHeight<=0 ) p->mxHeight = 2147483647;
3288 if( p->spec.eStyle>QRF_STYLE_Table ) p->spec.eStyle = QRF_Auto;
3289 if( p->spec.eEsc>QRF_ESC_Symbol ) p->spec.eEsc = QRF_Auto;
3290 if( p->spec.eText>QRF_TEXT_Json ) p->spec.eText = QRF_Auto;
3291 if( p->spec.eTitle>QRF_TEXT_Json ) p->spec.eTitle = QRF_Auto;
3292 if( p->spec.eBlob>QRF_BLOB_Size ) p->spec.eBlob = QRF_Auto;
3293 qrf_reinit:
3294 switch( p->spec.eStyle ){
3295 case QRF_Auto: {
3296 switch( sqlite3_stmt_isexplain(pStmt) ){
@@ -3321,10 +3541,16 @@
3321 p->spec.zNull = "NULL";
3322 if( p->spec.zTableName==0 || p->spec.zTableName[0]==0 ){
3323 p->spec.zTableName = "tab";
3324 }
3325 break;
 
 
 
 
 
 
3326 }
3327 case QRF_STYLE_Csv: {
3328 p->spec.eStyle = QRF_STYLE_List;
3329 p->spec.eText = QRF_TEXT_Csv;
3330 p->spec.zColumnSep = ",";
@@ -3430,11 +3656,15 @@
3430 qrfWrite(p);
3431 }
3432 break;
3433 }
3434 case QRF_STYLE_Line: {
3435 if( p->u.sLine.azCol ) sqlite3_free(p->u.sLine.azCol);
 
 
 
 
3436 break;
3437 }
3438 case QRF_STYLE_Stats:
3439 case QRF_STYLE_StatsEst:
3440 case QRF_STYLE_Eqp: {
@@ -3441,10 +3671,11 @@
3441 qrfEqpRender(p, 0);
3442 qrfWrite(p);
3443 break;
3444 }
3445 }
 
3446 if( p->spec.pzOutput ){
3447 if( p->spec.pzOutput[0] ){
3448 sqlite3_int64 n, sz;
3449 char *zCombined;
3450 sz = strlen(p->spec.pzOutput[0]);
@@ -3624,11 +3855,11 @@
3624
3625 /* Return the current wall-clock time in microseconds since the
3626 ** Unix epoch (1970-01-01T00:00:00Z)
3627 */
3628 static sqlite3_int64 timeOfDay(void){
3629 #if defined(_WIN64)
3630 sqlite3_uint64 t;
3631 FILETIME tm;
3632 GetSystemTimePreciseAsFileTime(&tm);
3633 t = ((u64)tm.dwHighDateTime<<32) | (u64)tm.dwLowDateTime;
3634 t += 116444736000000000LL;
@@ -3724,11 +3955,10 @@
3724 */
3725 static int hasTimer(void){
3726 if( getProcessTimesAddr ){
3727 return 1;
3728 } else {
3729 #if !SQLITE_OS_WINRT
3730 /* GetProcessTimes() isn't supported in WIN95 and some other Windows
3731 ** versions. See if the version we are running on has it, and if it
3732 ** does, save off a pointer to it and the current process handle.
3733 */
3734 hProcess = GetCurrentProcess();
@@ -3741,11 +3971,10 @@
3741 return 1;
3742 }
3743 FreeLibrary(hinstLib);
3744 }
3745 }
3746 #endif
3747 }
3748 return 0;
3749 }
3750
3751 /*
@@ -3860,10 +4089,18 @@
3860 #define PROMPT_LEN_MAX 128
3861 /* First line prompt. default: "sqlite> " */
3862 static char mainPrompt[PROMPT_LEN_MAX];
3863 /* Continuation prompt. default: " ...> " */
3864 static char continuePrompt[PROMPT_LEN_MAX];
 
 
 
 
 
 
 
 
3865
3866 /* This is variant of the standard-library strncpy() routine with the
3867 ** one change that the destination string is always zero-terminated, even
3868 ** if there is no zero-terminator in the first n-1 characters of the source
3869 ** string.
@@ -3980,17 +4217,10 @@
3980 */
3981 static void shell_check_oom(const void *p){
3982 if( p==0 ) shell_out_of_memory();
3983 }
3984
3985 /*
3986 ** Write I/O traces to the following stream.
3987 */
3988 #ifdef SQLITE_ENABLE_IOTRACE
3989 static FILE *iotrace = 0;
3990 #endif
3991
3992 /*
3993 ** This routine works like printf in that its first argument is a
3994 ** format string and subsequent arguments are values to be substituted
3995 ** in place of % fields. The result of formatting this string
3996 ** is written to iotrace.
@@ -6013,17 +6243,20 @@
6013 }
6014 /* End of the hashing logic
6015 *****************************************************************************/
6016
6017 /*
6018 ** Implementation of the sha1(X) function.
6019 **
6020 ** Return a lower-case hexadecimal rendering of the SHA1 hash of the
6021 ** argument X. If X is a BLOB, it is hashed as is. For all other
6022 ** types of input, X is converted into a UTF-8 string and the string
6023 ** is hash without the trailing 0x00 terminator. The hash of a NULL
6024 ** value is NULL.
 
 
 
6025 */
6026 static void sha1Func(
6027 sqlite3_context *context,
6028 int argc,
6029 sqlite3_value **argv
@@ -6040,15 +6273,17 @@
6040 hash_step(&cx, sqlite3_value_blob(argv[0]), nByte);
6041 }else{
6042 hash_step(&cx, sqlite3_value_text(argv[0]), nByte);
6043 }
6044 if( sqlite3_user_data(context)!=0 ){
 
6045 hash_finish(&cx, zOut, 1);
6046 sqlite3_result_blob(context, zOut, 20, SQLITE_TRANSIENT);
6047 }else{
 
6048 hash_finish(&cx, zOut, 0);
6049 sqlite3_result_blob(context, zOut, 40, SQLITE_TRANSIENT);
6050 }
6051 }
6052
6053 /*
6054 ** Implementation of the sha1_query(SQL) function.
@@ -8136,13 +8371,13 @@
8136 }else if( e<-10000 ){
8137 e = -10000;
8138 }
8139
8140 if( m<0 ){
 
8141 isNeg = 1;
8142 m = -m;
8143 if( m<0 ) return;
8144 }else if( m==0 && e>-1000 && e<1000 ){
8145 sqlite3_result_double(context, 0.0);
8146 return;
8147 }
8148 while( (m>>32)&0xffe00000 ){
@@ -9259,11 +9494,11 @@
9259 ** (X) match X
9260 ** X|Y X or Y
9261 ** ^X X occurring at the beginning of the string
9262 ** X$ X occurring at the end of the string
9263 ** . Match any single character
9264 ** \c Character c where c is one of \{}()[]|*+?.
9265 ** \c C-language escapes for c in afnrtv. ex: \t or \n
9266 ** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX
9267 ** \xXX Where XX is exactly 2 hex digits, unicode value XX
9268 ** [abc] Any single character from the set abc
9269 ** [^abc] Any single character not in the set abc
@@ -9644,11 +9879,11 @@
9644
9645 /* A backslash character has been seen, read the next character and
9646 ** return its interpretation.
9647 */
9648 static unsigned re_esc_char(ReCompiled *p){
9649 static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]";
9650 static const char zTrans[] = "\a\f\n\r\t\v";
9651 int i, v = 0;
9652 char c;
9653 if( p->sIn.i>=p->sIn.mx ) return 0;
9654 c = p->sIn.z[p->sIn.i];
@@ -9967,15 +10202,22 @@
9967 }
9968 return pRe->zErr;
9969 }
9970
9971 /*
9972 ** Compute a reasonable limit on the length of the REGEXP NFA.
9973 */
9974 static int re_maxlen(sqlite3_context *context){
9975 sqlite3 *db = sqlite3_context_db_handle(context);
9976 return 75 + sqlite3_limit(db, SQLITE_LIMIT_LIKE_PATTERN_LENGTH,-1)/2;
 
 
 
 
 
 
 
9977 }
9978
9979 /*
9980 ** Implementation of the regexp() SQL function. This function implements
9981 ** the build-in REGEXP operator. The first argument to the function is the
@@ -9997,14 +10239,21 @@
9997 int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
9998
9999 (void)argc; /* Unused */
10000 pRe = sqlite3_get_auxdata(context, 0);
10001 if( pRe==0 ){
 
 
10002 zPattern = (const char*)sqlite3_value_text(argv[0]);
10003 if( zPattern==0 ) return;
10004 zErr = re_compile(&pRe, zPattern, re_maxlen(context),
10005 sqlite3_user_data(context)!=0);
 
 
 
 
 
10006 if( zErr ){
10007 re_free(pRe);
10008 sqlite3_result_error(context, zErr, -1);
10009 return;
10010 }
@@ -10066,11 +10315,11 @@
10066 "ATSTART",
10067 };
10068
10069 zPattern = (const char*)sqlite3_value_text(argv[0]);
10070 if( zPattern==0 ) return;
10071 zErr = re_compile(&pRe, zPattern, re_maxlen(context),
10072 sqlite3_user_data(context)!=0);
10073 if( zErr ){
10074 re_free(pRe);
10075 sqlite3_result_error(context, zErr, -1);
10076 return;
@@ -10474,10 +10723,11 @@
10474 if( b1==0 ) return 1;
10475 sz = MultiByteToWideChar(CP_UTF8, 0, zPath, sz, b1, sz);
10476 b1[sz] = 0;
10477 rc = _wstat(b1, pStatBuf);
10478 if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
 
10479 return rc;
10480 #else
10481 return stat(zPath, pStatBuf);
10482 #endif
10483 }
@@ -10604,11 +10854,10 @@
10604 }
10605 }
10606
10607 if( mtime>=0 ){
10608 #if defined(_WIN32)
10609 #if !SQLITE_OS_WINRT
10610 /* Windows */
10611 FILETIME lastAccess;
10612 FILETIME lastWrite;
10613 SYSTEMTIME currentTime;
10614 LONGLONG intervals;
@@ -10635,11 +10884,10 @@
10635 CloseHandle(hFile);
10636 return !bResult;
10637 }else{
10638 return 1;
10639 }
10640 #endif
10641 #elif defined(AT_FDCWD) && 0 /* utimensat() is not universally available */
10642 /* Recent unix */
10643 struct timespec times[2];
10644 times[0].tv_nsec = times[1].tv_nsec = 0;
10645 times[0].tv_sec = time(0);
@@ -13337,11 +13585,11 @@
13337 rc = zipfileReadData(
13338 pFile, aRead, nExtra+nFile, iOff+ZIPFILE_CDS_FIXED_SZ, pzErr
13339 );
13340 }else{
13341 aRead = (u8*)&aBlob[iOff + ZIPFILE_CDS_FIXED_SZ];
13342 if( (iOff + ZIPFILE_LFH_FIXED_SZ + nFile + nExtra)>nBlob ){
13343 rc = zipfileCorrupt(pzErr);
13344 }
13345 }
13346 }
13347
@@ -13362,15 +13610,16 @@
13362 ZipfileLFH lfh;
13363 if( pFile ){
13364 rc = zipfileReadData(pFile, aRead, szFix, pNew->cds.iOffset, pzErr);
13365 }else{
13366 aRead = (u8*)&aBlob[pNew->cds.iOffset];
13367 if( (pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ)>nBlob ){
13368 rc = zipfileCorrupt(pzErr);
13369 }
13370 }
13371
 
13372 if( rc==SQLITE_OK ) rc = zipfileReadLFH(aRead, &lfh);
13373 if( rc==SQLITE_OK ){
13374 pNew->iDataOff = pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ;
13375 pNew->iDataOff += lfh.nFile + lfh.nExtra;
13376 if( aBlob && pNew->cds.szCompressed ){
@@ -13470,11 +13719,11 @@
13470 }else{
13471 err = inflate(&str, Z_NO_FLUSH);
13472 if( err!=Z_STREAM_END ){
13473 zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
13474 }else{
13475 sqlite3_result_blob(pCtx, aRes, nOut, zipfileFree);
13476 aRes = 0;
13477 }
13478 }
13479 sqlite3_free(aRes);
13480 inflateEnd(&str);
@@ -23948,28 +24197,28 @@
23948 u8 autoExplain; /* Automatically turn on .explain mode */
23949 u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to each SQL stmt */
23950 u8 autoEQPtrace; /* autoEQP is in trace mode */
23951 u8 scanstatsOn; /* True to display scan stats before each finalize */
23952 u8 bAutoScreenWidth; /* Using the TTY to determine screen width */
23953 u8 mFlags; /* MFLG_ECHO and/or MFLG_CRLF */
23954 u8 eMode; /* One of the MODE_ values */
23955 sqlite3_qrf_spec spec; /* Spec to be passed into QRF */
23956 } Mode;
23957
23958 /* Flags for Mode.mFlags */
23959 #define MFLG_ECHO 0x01 /* Echo inputs to output */
23960 #define MFLG_CRLF 0x02 /* Use CR/LF output line endings */
 
23961
23962
23963 /*
23964 ** State information about the database connection is contained in an
23965 ** instance of the following structure.
23966 */
23967 typedef struct ShellState ShellState;
23968 struct ShellState {
23969 sqlite3 *db; /* The database */
23970 int iCompat; /* Compatibility date YYYYMMDD */
23971 u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
23972 u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
23973 u8 nEqpLevel; /* Depth of the EQP output graph */
23974 u8 eTraceType; /* SHELL_TRACE_* value for type of trace */
23975 u8 bSafeMode; /* True to prohibit unsafe operations */
@@ -24078,11 +24327,11 @@
24078
24079 /* Names of values for Mode.spec.eEsc and Mode.spec.eText
24080 */
24081 static const char *qrfEscNames[] = { "auto", "off", "ascii", "symbol" };
24082 static const char *qrfQuoteNames[] =
24083 { "off","off","sql","hex","csv","tcl","json"};
24084
24085 /*
24086 ** These are the allowed shellFlgs values
24087 */
24088 #define SHFLG_Pagecache 0x00000001 /* The --pagecache option is used */
@@ -24120,19 +24369,20 @@
24120 #define MODE_Json 10 /* Output JSON */
24121 #define MODE_Line 11 /* One column per line. Blank line between records */
24122 #define MODE_List 12 /* One record per line with a separator */
24123 #define MODE_Markdown 13 /* Markdown formatting */
24124 #define MODE_Off 14 /* No query output shown */
24125 #define MODE_QBox 15 /* BOX with SQL-quoted content */
24126 #define MODE_Quote 16 /* Quote values as for SQL */
24127 #define MODE_Split 17 /* Split-column mode */
24128 #define MODE_Table 18 /* MySQL-style table formatting */
24129 #define MODE_Tabs 19 /* Tab-separated values */
24130 #define MODE_Tcl 20 /* Space-separated list of TCL strings */
24131 #define MODE_Www 21 /* Full web-page output */
24132
24133 #define MODE_BUILTIN 21 /* Maximum built-in mode */
 
24134 #define MODE_BATCH 50 /* Default mode for batch processing */
24135 #define MODE_TTY 51 /* Default mode for interactive processing */
24136 #define MODE_USER 75 /* First user-defined mode */
24137 #define MODE_N_USER 25 /* Maximum number of user-defined modes */
24138
@@ -24149,43 +24399,45 @@
24149 unsigned char eHdr; /* Default header encoding. */
24150 unsigned char eBlob; /* Default blob encoding. */
24151 unsigned char bHdr; /* Show headers by default. 0: n/a, 1: no 2: yes */
24152 unsigned char eStyle; /* Underlying QRF style */
24153 unsigned char eCx; /* 0: other, 1: line, 2: columnar */
 
24154 };
24155
24156 /* String constants used by built-in modes */
24157 static const char *aModeStr[] =
24158 /* 0 1 2 3 4 5 6 7 8 */
24159 { 0, "\n", "|", " ", ",", "\r\n", "\036", "\037", "\t",
24160 "", "NULL", "null", "\"\"" };
24161 /* 9 10 11 12 */
24162
24163 static const ModeInfo aModeInfo[] = {
24164 /* zName eCSep eRSep eNull eText eHdr eBlob bHdr eStyle eCx */
24165 { "ascii", 7, 6, 9, 1, 1, 0, 1, 12, 0 },
24166 { "box", 0, 0, 9, 1, 1, 0, 2, 1, 2 },
24167 { "c", 4, 1, 10, 5, 5, 4, 1, 12, 0 },
24168 { "column", 0, 0, 9, 1, 1, 0, 2, 2, 2 },
24169 { "count", 0, 0, 0, 0, 0, 0, 0, 3, 0 },
24170 { "csv", 4, 5, 9, 3, 3, 0, 1, 12, 0 },
24171 { "html", 0, 0, 9, 4, 4, 0, 2, 7, 0 },
24172 { "insert", 0, 0, 10, 2, 2, 0, 1, 8, 0 },
24173 { "jatom", 4, 1, 11, 6, 6, 0, 1, 12, 0 },
24174 { "jobject", 0, 1, 11, 6, 6, 0, 0, 10, 0 },
24175 { "json", 0, 0, 11, 6, 6, 0, 0, 9, 0 },
24176 { "line", 0, 1, 9, 1, 1, 0, 0, 11, 1 },
24177 { "list", 2, 1, 9, 1, 1, 0, 1, 12, 0 },
24178 { "markdown", 0, 0, 9, 1, 1, 0, 2, 13, 2 },
24179 { "off", 0, 0, 0, 0, 0, 0, 0, 14, 0 },
24180 { "qbox", 0, 0, 10, 2, 1, 0, 2, 1, 2 },
24181 { "quote", 4, 1, 10, 2, 2, 0, 1, 12, 0 },
24182 { "split", 0, 0, 9, 1, 1, 0, 1, 2, 2 },
24183 { "table", 0, 0, 9, 1, 1, 0, 2, 19, 2 },
24184 { "tabs", 8, 1, 9, 3, 3, 0, 1, 12, 0 },
24185 { "tcl", 3, 1, 12, 5, 5, 4, 1, 12, 0 },
24186 { "www", 0, 0, 9, 4, 4, 0, 2, 7, 0 }
 
24187 }; /* | / / | / / | | \
24188 ** | / / | / / | | \_ 2: columnar
24189 ** Index into aModeStr[] | / / | | 1: line
24190 ** | / / | | 0: other
24191 ** | / / | \
@@ -24212,10 +24464,23 @@
24212 #define SEP_Comma ","
24213 #define SEP_CrLf "\r\n"
24214 #define SEP_Unit "\x1F"
24215 #define SEP_Record "\x1E"
24216
 
 
 
 
 
 
 
 
 
 
 
 
 
24217 /*
24218 ** Limit input nesting via .read or any other input redirect.
24219 ** It's not too expensive, so a generous allowance can be made.
24220 */
24221 #define MAX_INPUT_NESTING 25
@@ -24305,13 +24570,20 @@
24305 if( pI->eCSep ) modeSetStr(&pM->spec.zColumnSep, aModeStr[pI->eCSep]);
24306 if( pI->eRSep ) modeSetStr(&pM->spec.zRowSep, aModeStr[pI->eRSep]);
24307 if( pI->eNull ) modeSetStr(&pM->spec.zNull, aModeStr[pI->eNull]);
24308 pM->spec.eText = pI->eText;
24309 pM->spec.eBlob = pI->eBlob;
24310 pM->spec.bTitles = pI->bHdr;
 
 
24311 pM->spec.eTitle = pI->eHdr;
24312 if( eMode==MODE_Split ){
 
 
 
 
 
24313 pM->spec.bSplitColumn = QRF_Yes;
24314 pM->bAutoScreenWidth = 1;
24315 }else{
24316 pM->spec.bSplitColumn = QRF_No;
24317 }
@@ -24326,26 +24598,27 @@
24326 }else if( eMode==MODE_TTY ){
24327 u8 mFlags = p->mode.mFlags;
24328 modeFree(&p->mode);
24329 modeChange(p, MODE_QBox);
24330 p->mode.bAutoScreenWidth = 1;
24331 p->mode.spec.nCharLimit = 300;
24332 p->mode.spec.nLineLimit = 5;
 
24333 p->mode.spec.bTextJsonb = QRF_Yes;
 
24334 p->mode.mFlags = mFlags;
24335 }
24336 }
24337
24338 /*
24339 ** Set the mode to the default according to p->iCompat. It assumed
24340 ** that the mode has already been freed and zeroed prior to calling
24341 ** this routine.
24342 */
24343 static void modeDefault(ShellState *p){
24344 p->mode.spec.iVersion = 1;
24345 p->mode.autoExplain = 1;
24346 if( p->iCompat>=20251115 && (stdin_is_interactive || stdout_is_console) ){
24347 modeChange(p, MODE_TTY);
24348 }else{
24349 modeChange(p, MODE_BATCH);
24350 }
24351 }
@@ -25075,10 +25348,12 @@
25075 z[j] = 0;
25076 if( strlen30(z)>=79 ){
25077 for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */
25078 if( c==cEnd ){
25079 cEnd = 0;
 
 
25080 }else if( c=='"' || c=='\'' || c=='`' ){
25081 cEnd = c;
25082 }else if( c=='[' ){
25083 cEnd = ']';
25084 }else if( c=='-' && z[i+1]=='-' ){
@@ -25889,10 +26164,11 @@
25889 if( pArg->mode.bAutoScreenWidth ){
25890 spec.nScreenWidth = shellScreenWidth();
25891 }
25892 if( spec.eBlob==QRF_BLOB_Auto ){
25893 switch( spec.eText ){
 
25894 case QRF_TEXT_Sql: spec.eBlob = QRF_BLOB_Sql; break;
25895 case QRF_TEXT_Json: spec.eBlob = QRF_BLOB_Json; break;
25896 default: spec.eBlob = QRF_BLOB_Text; break;
25897 }
25898 }
@@ -25902,11 +26178,11 @@
25902 rc = expertHandleSQL(pArg, zSql, pzErrMsg);
25903 return expertFinish(pArg, (rc!=SQLITE_OK), pzErrMsg);
25904 }
25905 #endif
25906
25907 while( zSql[0] && (SQLITE_OK == rc) ){
25908 static const char *zStmtSql;
25909 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
25910 if( SQLITE_OK != rc ){
25911 if( pzErrMsg ){
25912 *pzErrMsg = save_err_msg(db, "in prepare", rc, zSql);
@@ -26365,12 +26641,12 @@
26365 ".bail on|off Stop after hitting an error. Default OFF",
26366 #ifndef SQLITE_SHELL_FIDDLE
26367 ".cd DIRECTORY Change the working directory to DIRECTORY",
26368 #endif
26369 ".changes on|off Show number of rows changed by SQL",
 
26370 #ifndef SQLITE_SHELL_FIDDLE
26371 ".check GLOB Fail if output since .testcase does not match",
26372 ".clone NEWDB Clone data into NEWDB from the existing database",
26373 #endif
26374 ".connection [close] [#] Open or close an auxiliary database connection",
26375 ".crlf ?on|off? Whether or not to use \\r\\n line endings",
26376 ".databases List names and files of attached databases",
@@ -26546,13 +26822,11 @@
26546 " vmstep Show the virtual machine step count only",
26547 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
26548 ".system CMD ARGS... Run CMD ARGS... in a system shell",
26549 #endif
26550 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
26551 #ifndef SQLITE_SHELL_FIDDLE
26552 ",testcase NAME Begin redirecting output to 'testcase-out.txt'",
26553 #endif
26554 ",testctrl CMD ... Run various sqlite3_test_control() operations",
26555 " Run \".testctrl\" with no arguments for details",
26556 ".timeout MS Try opening locked tables for MS milliseconds",
26557 ".timer on|off Turn SQL timer on or off",
26558 #ifndef SQLITE_OMIT_TRACE
@@ -26597,19 +26871,31 @@
26597 "USAGE: .import [OPTIONS] FILE TABLE\n"
26598 "\n"
26599 "Import CSV or similar text from FILE into TABLE. If TABLE does\n"
26600 "not exist, it is created using the first row of FILE as the column\n"
26601 "names. If FILE begins with \"|\" then it is a command that is run\n"
26602 "and the output from the command is used as the input data.\n"
 
 
 
 
 
 
26603 "\n"
26604 "FILE is assumed to be in a CSV format, unless the current mode\n"
26605 "is \"ascii\" or \"tabs\" or unless one of the options below specify\n"
26606 "an alternative.\n"
 
 
26607 "\n"
26608 "Options:\n"
26609 " --ascii Use \\037 and \\036 as column and row separators on input\n"
 
 
 
26610 " --csv Input is standard RFC-4180 CSV.\n"
 
26611 " --schema S When creating TABLE, put it in schema S\n"
26612 " --skip N Ignore the first N rows of input\n"
26613 " -v Verbose mode\n"
26614 },
26615 { ".mode",
@@ -26625,10 +26911,11 @@
26625 " meaning \"left\", \"centered\", and \"right\", with\n"
26626 " one letter per column starting from the left.\n"
26627 " Unspecified alignment defaults to 'L'.\n"
26628 " --blob-quote ARG ARG can be \"auto\", \"text\", \"sql\", \"hex\", \"tcl\",\n"
26629 " \"json\", or \"size\". Default is \"auto\".\n"
 
26630 " --charlimit N Set the maximum number of output characters to\n"
26631 " show for any single SQL value to N. Longer values\n"
26632 " truncated. Zero means \"no limit\".\n"
26633 " --colsep STRING Use STRING as the column separator\n"
26634 " --escape ESC Enable/disable escaping of control characters\n"
@@ -26636,19 +26923,22 @@
26636 " or \"symbol\".\n"
26637 " --linelimit N Set the maximum number of output lines to show for\n"
26638 " any single SQL value to N. Longer values are\n"
26639 " truncated. Zero means \"no limit\". Only works\n"
26640 " in \"line\" mode and in columnar modes.\n"
26641 " --limits L,C Shorthand for \"--linelimit L --charlimit C\".\n"
26642 " Or \"off\" to mean \"0,0\". Or \"on\" for \"5,300\".\n"
 
 
 
26643 " --list List available modes\n"
26644 " --null STRING Render SQL NULL values as the given string\n"
26645 " --once Setting changes to the right are reverted after\n"
26646 " the next SQL command.\n"
26647 " --quote ARG Enable/disable quoting of text. ARG can be\n"
26648 " \"off\", \"on\", \"sql\", \"csv\", \"html\", \"tcl\",\n"
26649 " or \"json\". \"off\" means show the text as-is.\n"
26650 " \"on\" is an alias for \"sql\".\n"
26651 " --reset Changes all mode settings back to their default.\n"
26652 " --rowsep STRING Use STRING as the row separator\n"
26653 " --sw|--screenwidth N Declare the screen width of the output device\n"
26654 " to be N characters. An attempt may be made to\n"
@@ -26659,10 +26949,11 @@
26659 " --tag NAME Save mode to the left as NAME.\n"
26660 " --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON.\n"
26661 " --title ARG Whether or not to show column headers, and if so\n"
26662 " how to encode them. ARG can be \"off\", \"on\",\n"
26663 " \"sql\", \"csv\", \"html\", \"tcl\", or \"json\".\n"
 
26664 " -v|--verbose Verbose output\n"
26665 " --widths LIST Set the columns widths for columnar modes. The\n"
26666 " argument is a list of integers, one for each\n"
26667 " column. A \"0\" width means use a dynamic width\n"
26668 " based on the actual width of data. If there are\n"
@@ -26686,23 +26977,17 @@
26686 " --bom Prepend a byte-order mark to the output\n"
26687 " -e Accumulate output in a temporary text file then\n"
26688 " launch a text editor when the redirection ends.\n"
26689 " --error-prefix X Use X as the left-margin prefix for error messages.\n"
26690 " Set to an empty string to restore the default.\n"
26691 " --glob GLOB Raise an error if the memory buffer does not match\n"
26692 " the GLOB pattern.\n"
26693 " --keep Continue using the same \"memory\" buffer. Do not\n"
26694 " reset it or delete it. Useful in combination with\n"
26695 " --glob, --not-glob, and/or --verify.\n"
26696 " ---notglob GLOB Raise an error if the memory buffer does not match\n"
26697 " the GLOB pattern.\n"
26698 " --plain Use plain text rather than HTML tables with -w\n"
26699 " --show Write the memory buffer to the screen, for debugging.\n"
26700 " --verify ENDMARK Read subsequent lines of text until the first line\n"
26701 " that matches ENDMARK. Discard the ENDMARK. Compare\n"
26702 " the text against the accumulated output in memory and\n"
26703 " raise an error if there are any differences.\n"
26704 " -w Show the output in a web browser. Output is\n"
26705 " written into a temporary HTML file until the\n"
26706 " redirect ends, then the web browser is launched.\n"
26707 " Query results are shown as HTML tables, unless\n"
26708 " the --plain is used too.\n"
@@ -26726,10 +27011,39 @@
26726 " file in a web browser\n"
26727 " -x Show the output in a spreadsheet. Output is\n"
26728 " written to a temp file as CSV then the spreadsheet\n"
26729 " is launched when\n"
26730 },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26731 };
26732
26733 /*
26734 ** Return a pointer to usage text for zCmd, or NULL if none exists.
26735 */
@@ -26949,10 +27263,56 @@
26949 if( sqlite3_strglob(pSession->azFilter[i], zTab)==0 ) return 0;
26950 }
26951 return 1;
26952 }
26953 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26954
26955 /*
26956 ** Try to deduce the type of file for zName based on its content. Return
26957 ** one of the SHELL_OPEN_* constants.
26958 **
@@ -26962,24 +27322,16 @@
26962 ** the type cannot be determined from content.
26963 */
26964 int deduceDatabaseType(const char *zName, int dfltZip, int openFlags){
26965 FILE *f;
26966 size_t n;
26967 sqlite3 *db = 0;
26968 sqlite3_stmt *pStmt = 0;
26969 int rc = SHELL_OPEN_UNSPEC;
26970 char zBuf[100];
26971 if( access(zName,0)!=0 ) goto database_type_by_name;
26972 if( sqlite3_open_v2(zName, &db, openFlags, 0)==SQLITE_OK
26973 && sqlite3_prepare_v2(db,"SELECT count(*) FROM sqlite_schema",-1,&pStmt,0)
26974 ==SQLITE_OK
26975 && sqlite3_step(pStmt)==SQLITE_ROW
26976 ){
26977 rc = SHELL_OPEN_NORMAL;
26978 }
26979 sqlite3_finalize(pStmt);
26980 sqlite3_close(db);
26981 if( rc==SHELL_OPEN_NORMAL ) return SHELL_OPEN_NORMAL;
26982 f = sqlite3_fopen(zName, "rb");
26983 if( f==0 ) goto database_type_by_name;
26984 n = fread(zBuf, 16, 1, f);
26985 if( n==1 && memcmp(zBuf, "SQLite format 3", 16)==0 ){
@@ -27009,10 +27361,37 @@
27009 }else{
27010 rc = SHELL_OPEN_NORMAL;
27011 }
27012 return rc;
27013 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27014
27015 #ifndef SQLITE_OMIT_DESERIALIZE
27016 /*
27017 ** Reconstruct an in-memory database using the output from the "dbtotxt"
27018 ** program. Read content from the file in p->aAuxDb[].zDbFilename.
@@ -27655,11 +28034,13 @@
27655 typedef struct ImportCtx ImportCtx;
27656 struct ImportCtx {
27657 const char *zFile; /* Name of the input file */
27658 FILE *in; /* Read the CSV text from this input stream */
27659 int (SQLITE_CDECL *xCloser)(FILE*); /* Func to close in */
 
27660 char *z; /* Accumulated text for a field */
 
27661 i64 n; /* Number of bytes in z */
27662 i64 nAlloc; /* Space allocated for z[] */
27663 int nLine; /* Current line number */
27664 int nRow; /* Number of rows imported */
27665 int nErr; /* Number of errors encountered */
@@ -27675,13 +28056,32 @@
27675 p->xCloser(p->in);
27676 p->in = 0;
27677 }
27678 sqlite3_free(p->z);
27679 p->z = 0;
 
 
 
 
27680 }
27681
27682 /* Append a single byte to z[] */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27683 static void import_append_char(ImportCtx *p, int c){
27684 if( p->n+1>=p->nAlloc ){
27685 p->nAlloc += p->nAlloc + 100;
27686 p->z = sqlite3_realloc64(p->z, p->nAlloc);
27687 shell_check_oom(p->z);
@@ -27693,12 +28093,12 @@
27693 ** with the option of having a separator other than ",".
27694 **
27695 ** + Input comes from p->in.
27696 ** + Store results in p->z of length p->n. Space to hold p->z comes
27697 ** from sqlite3_malloc64().
27698 ** + Use p->cSep as the column separator. The default is ",".
27699 ** + Use p->rSep as the row separator. The default is "\n".
27700 ** + Keep track of the line number in p->nLine.
27701 ** + Store the character that terminates the field in p->cTerm. Store
27702 ** EOF on end-of-file.
27703 ** + Report syntax errors on stderr
27704 */
@@ -27705,11 +28105,11 @@
27705 static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
27706 int c;
27707 int cSep = (u8)p->cColSep;
27708 int rSep = (u8)p->cRowSep;
27709 p->n = 0;
27710 c = fgetc(p->in);
27711 if( c==EOF || seenInterrupt ){
27712 p->cTerm = EOF;
27713 return 0;
27714 }
27715 if( c=='"' ){
@@ -27716,11 +28116,11 @@
27716 int pc, ppc;
27717 int startLine = p->nLine;
27718 int cQuote = c;
27719 pc = ppc = 0;
27720 while( 1 ){
27721 c = fgetc(p->in);
27722 if( c==rSep ) p->nLine++;
27723 if( c==cQuote ){
27724 if( pc==cQuote ){
27725 pc = 0;
27726 continue;
@@ -27752,24 +28152,24 @@
27752 }else{
27753 /* If this is the first field being parsed and it begins with the
27754 ** UTF-8 BOM (0xEF BB BF) then skip the BOM */
27755 if( (c&0xff)==0xef && p->bNotFirst==0 ){
27756 import_append_char(p, c);
27757 c = fgetc(p->in);
27758 if( (c&0xff)==0xbb ){
27759 import_append_char(p, c);
27760 c = fgetc(p->in);
27761 if( (c&0xff)==0xbf ){
27762 p->bNotFirst = 1;
27763 p->n = 0;
27764 return csv_read_one_field(p);
27765 }
27766 }
27767 }
27768 while( c!=EOF && c!=cSep && c!=rSep ){
27769 import_append_char(p, c);
27770 c = fgetc(p->in);
27771 }
27772 if( c==rSep ){
27773 p->nLine++;
27774 if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
27775 }
@@ -27783,12 +28183,12 @@
27783 /* Read a single field of ASCII delimited text.
27784 **
27785 ** + Input comes from p->in.
27786 ** + Store results in p->z of length p->n. Space to hold p->z comes
27787 ** from sqlite3_malloc64().
27788 ** + Use p->cSep as the column separator. The default is "\x1F".
27789 ** + Use p->rSep as the row separator. The default is "\x1E".
27790 ** + Keep track of the row number in p->nLine.
27791 ** + Store the character that terminates the field in p->cTerm. Store
27792 ** EOF on end-of-file.
27793 ** + Report syntax errors on stderr
27794 */
@@ -27795,18 +28195,18 @@
27795 static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
27796 int c;
27797 int cSep = (u8)p->cColSep;
27798 int rSep = (u8)p->cRowSep;
27799 p->n = 0;
27800 c = fgetc(p->in);
27801 if( c==EOF || seenInterrupt ){
27802 p->cTerm = EOF;
27803 return 0;
27804 }
27805 while( c!=EOF && c!=cSep && c!=rSep ){
27806 import_append_char(p, c);
27807 c = fgetc(p->in);
27808 }
27809 if( c==rSep ){
27810 p->nLine++;
27811 }
27812 p->cTerm = c;
@@ -29721,11 +30121,13 @@
29721
29722 p = sqlite3_recover_init_sql(
29723 pState->db, "main", recoverSqlCb, (void*)pState
29724 );
29725
29726 sqlite3_recover_config(p, 789, (void*)zRecoveryDb); /* Debug use only */
 
 
29727 sqlite3_recover_config(p, SQLITE_RECOVER_LOST_AND_FOUND, (void*)zLAF);
29728 sqlite3_recover_config(p, SQLITE_RECOVER_ROWIDS, (void*)&bRowids);
29729 sqlite3_recover_config(p, SQLITE_RECOVER_FREELIST_CORRUPT,(void*)&bFreelist);
29730
29731 cli_printf(pState->out, ".dbconfig defensive off\n");
@@ -30105,19 +30507,31 @@
30105 ** USAGE: .import [OPTIONS] FILE TABLE
30106 **
30107 ** Import CSV or similar text from FILE into TABLE. If TABLE does
30108 ** not exist, it is created using the first row of FILE as the column
30109 ** names. If FILE begins with "|" then it is a command that is run
30110 ** and the output from the command is used as the input data.
 
 
 
 
 
 
30111 **
30112 ** FILE is assumed to be in a CSV format, unless the current mode
30113 ** is "ascii" or "tabs" or unless one of the options below specify
30114 ** an alternative.
 
 
30115 **
30116 ** Options:
30117 ** --ascii Use \037 and \036 as column and row separators on input
 
 
 
30118 ** --csv Input is standard RFC-4180 CSV.
 
30119 ** --schema S When creating TABLE, put it in schema S
30120 ** --skip N Ignore the first N rows of input
30121 ** -v Verbose mode
30122 */
30123 static int dotCmdImport(ShellState *p){
@@ -30129,17 +30543,16 @@
30129 sqlite3_stmt *pStmt = NULL; /* A statement */
30130 int nCol; /* Number of columns in the table */
30131 i64 nByte; /* Number of bytes in an SQL string */
30132 int i, j; /* Loop counters */
30133 int needCommit; /* True to COMMIT or ROLLBACK at end */
30134 int nSep; /* Number of bytes in spec.zColumnSep */
30135 char *zSql = 0; /* An SQL statement */
30136 ImportCtx sCtx; /* Reader context */
30137 char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */
30138 int eVerbose = 0; /* Larger for more console output */
30139 i64 nSkip = 0; /* Initial lines to skip */
30140 int useOutputMode = 1; /* Use output mode to determine separators */
30141 char *zCreate = 0; /* CREATE TABLE statement text */
30142 int rc; /* Result code */
30143
30144 failIfSafeMode(p, "cannot run .import in safe mode");
30145 memset(&sCtx, 0, sizeof(sCtx));
@@ -30165,70 +30578,67 @@
30165 }else if( cli_strcmp(z,"-schema")==0 && i<nArg-1 ){
30166 zSchema = azArg[++i];
30167 }else if( cli_strcmp(z,"-skip")==0 && i<nArg-1 ){
30168 nSkip = integerValue(azArg[++i]);
30169 }else if( cli_strcmp(z,"-ascii")==0 ){
30170 sCtx.cColSep = SEP_Unit[0];
30171 sCtx.cRowSep = SEP_Record[0];
30172 xRead = ascii_read_one_field;
30173 useOutputMode = 0;
30174 }else if( cli_strcmp(z,"-csv")==0 ){
30175 sCtx.cColSep = ',';
30176 sCtx.cRowSep = '\n';
30177 xRead = csv_read_one_field;
30178 useOutputMode = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
30179 }else{
30180 dotCmdError(p, i, "unknown option", 0);
30181 return 1;
30182 }
30183 }
30184 if( zTable==0 ){
30185 cli_printf(p->out, "ERROR: missing %s argument\n",
30186 zFile==0 ? "FILE" : "TABLE");
30187 return 1;
30188 }
30189 seenInterrupt = 0;
30190 open_db(p, 0);
30191 if( useOutputMode ){
30192 /* If neither the --csv or --ascii options are specified, then set
30193 ** the column and row separator characters from the output mode. */
30194 if( p->mode.spec.zColumnSep==0 ){
30195 modeSetStr(&p->mode.spec.zColumnSep, ",");
30196 nSep = 1;
30197 }else if( (nSep = strlen30(p->mode.spec.zColumnSep))==0 ){
30198 eputz("Error: non-null column separator required for import\n");
30199 return 1;
30200 }
30201 if( nSep>1 ){
30202 eputz("Error: multi-character column separators not allowed"
30203 " for import\n");
30204 return 1;
30205 }
30206 if( p->mode.spec.zRowSep==0 ){
30207 modeSetStr(&p->mode.spec.zRowSep, "\n");
30208 nSep = 1;
30209 }else if( (nSep = strlen30(p->mode.spec.zRowSep))==0 ){
30210 eputz("Error: non-null row separator required for import\n");
30211 return 1;
30212 }
30213 if( nSep==2 && p->mode.eMode==MODE_Csv
30214 && cli_strcmp(p->mode.spec.zRowSep,SEP_CrLf)==0
30215 ){
30216 /* When importing CSV (only), if the row separator is set to the
30217 ** default output row separator, change it to the default input
30218 ** row separator. This avoids having to maintain different input
30219 ** and output row separators. */
30220 modeSetStr(&p->mode.spec.zRowSep, SEP_Row);
30221 nSep = strlen30(p->mode.spec.zRowSep);
30222 }
30223 if( nSep>1 ){
30224 eputz("Error: multi-character row separators not allowed"
30225 " for import\n");
30226 return 1;
30227 }
30228 sCtx.cColSep = (u8)p->mode.spec.zColumnSep[0];
30229 sCtx.cRowSep = (u8)p->mode.spec.zRowSep[0];
30230 }
30231 sCtx.zFile = zFile;
30232 sCtx.nLine = 1;
30233 if( sCtx.zFile[0]=='|' ){
30234 #ifdef SQLITE_OMIT_POPEN
@@ -30237,19 +30647,58 @@
30237 #else
30238 sCtx.in = sqlite3_popen(sCtx.zFile+1, "r");
30239 sCtx.zFile = "<pipe>";
30240 sCtx.xCloser = pclose;
30241 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30242 }else{
30243 sCtx.in = sqlite3_fopen(sCtx.zFile, "rb");
30244 sCtx.xCloser = fclose;
30245 }
30246 if( sCtx.in==0 ){
30247 cli_printf(stderr,"Error: cannot open \"%s\"\n", zFile);
 
30248 return 1;
30249 }
30250 if( eVerbose>=2 || (eVerbose>=1 && useOutputMode) ){
30251 char zSep[2];
30252 zSep[1] = 0;
30253 zSep[0] = sCtx.cColSep;
30254 cli_puts("Column separator ", p->out);
30255 output_c_string(p->out, zSep);
@@ -30402,10 +30851,14 @@
30402 if( z==0 && (xRead==csv_read_one_field) && i==nCol-1 && i>0 ){
30403 z = "";
30404 }
30405 sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
30406 if( i<nCol-1 && sCtx.cTerm!=sCtx.cColSep ){
 
 
 
 
30407 cli_printf(stderr,"%s:%d: expected %d columns but found %d"
30408 " - filling the rest with NULL\n",
30409 sCtx.zFile, startLine, nCol, i+1);
30410 i += 2;
30411 while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
@@ -30425,10 +30878,11 @@
30425 rc = sqlite3_reset(pStmt);
30426 if( rc!=SQLITE_OK ){
30427 cli_printf(stderr,"%s:%d: INSERT failed: %s\n",
30428 sCtx.zFile, startLine, sqlite3_errmsg(p->db));
30429 sCtx.nErr++;
 
30430 }else{
30431 sCtx.nRow++;
30432 }
30433 }
30434 }while( sCtx.cTerm!=EOF );
@@ -30437,13 +30891,13 @@
30437 sqlite3_finalize(pStmt);
30438 if( needCommit ) sqlite3_exec(p->db, "COMMIT", 0, 0, 0);
30439 if( eVerbose>0 ){
30440 cli_printf(p->out,
30441 "Added %d rows with %d errors using %d lines of input\n",
30442 sCtx.nRow, sCtx.nErr, sCtx.nLine-1);
30443 }
30444 return 0;
30445 }
30446
30447
30448 /*
30449 ** This function computes what to show the user about the configured
@@ -30508,10 +30962,11 @@
30508 ** meaning "left", "centered", and "right", with
30509 ** one letter per column starting from the left.
30510 ** Unspecified alignment defaults to 'L'.
30511 ** --blob-quote ARG ARG can be "auto", "text", "sql", "hex", "tcl",
30512 ** "json", or "size". Default is "auto".
 
30513 ** --charlimit N Set the maximum number of output characters to
30514 ** show for any single SQL value to N. Longer values
30515 ** truncated. Zero means "no limit".
30516 ** --colsep STRING Use STRING as the column separator
30517 ** --escape ESC Enable/disable escaping of control characters
@@ -30519,19 +30974,22 @@
30519 ** or "symbol".
30520 ** --linelimit N Set the maximum number of output lines to show for
30521 ** any single SQL value to N. Longer values are
30522 ** truncated. Zero means "no limit". Only works
30523 ** in "line" mode and in columnar modes.
30524 ** --limits L,C Shorthand for "--linelimit L --charlimit C".
30525 ** Or "off" to mean "0,0". Or "on" for "5,300".
 
 
 
30526 ** --list List available modes
30527 ** --null STRING Render SQL NULL values as the given string
30528 ** --once Setting changes to the right are reverted after
30529 ** the next SQL command.
30530 ** --quote ARG Enable/disable quoting of text. ARG can be
30531 ** "off", "on", "sql", "csv", "html", "tcl",
30532 ** or "json". "off" means show the text as-is.
30533 ** "on" is an alias for "sql".
30534 ** --reset Changes all mode settings back to their default.
30535 ** --rowsep STRING Use STRING as the row separator
30536 ** --sw|--screenwidth N Declare the screen width of the output device
30537 ** to be N characters. An attempt may be made to
@@ -30542,10 +31000,11 @@
30542 ** --tag NAME Save mode to the left as NAME.
30543 ** --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON.
30544 ** --title ARG Whether or not to show column headers, and if so
30545 ** how to encode them. ARG can be "off", "on",
30546 ** "sql", "csv", "html", "tcl", or "json".
 
30547 ** -v|--verbose Verbose output
30548 ** --widths LIST Set the columns widths for columnar modes. The
30549 ** argument is a list of integers, one for each
30550 ** column. A "0" width means use a dynamic width
30551 ** based on the actual width of data. If there are
@@ -30626,21 +31085,31 @@
30626 ** Must match QRF_BLOB_xxxx values. See also tag-20251124a */
30627 if( k>=0 ){
30628 p->mode.spec.eBlob = k & 0xff;
30629 }
30630 chng = 1;
30631 }else if( 0<=(k=pickStr(z,0,"-charlimit","-linelimit","")) ){
 
 
 
 
 
 
 
 
 
 
30632 int w; /* 0 1 */
30633 if( i+1>=nArg ){
30634 dotCmdError(p, i, "missing argument", 0);
30635 return 1;
30636 }
30637 w = integerValue(azArg[++i]);
30638 if( k==0 ){
30639 p->mode.spec.nCharLimit = w;
30640 }else{
30641 p->mode.spec.nLineLimit = w;
30642 }
30643 chng = 1;
30644 }else if( 0<=(k=pickStr(z,0,"-tablename","-rowsep","-colsep","-null","")) ){
30645 /* 0 1 2 3 */
30646 if( i+1>=nArg ){
@@ -30675,25 +31144,28 @@
30675 dotCmdError(p, i-1, "missing argument", 0);
30676 return 1;
30677 }
30678 k = pickStr(azArg[i],0,"on","off","");
30679 if( k==0 ){
30680 p->mode.spec.nLineLimit = 5;
30681 p->mode.spec.nCharLimit = 300;
 
30682 }else if( k==1 ){
30683 p->mode.spec.nLineLimit = 0;
30684 p->mode.spec.nCharLimit = 0;
 
30685 }else{
30686 int L, C;
30687 int nNum = sscanf(azArg[i], "%d,%d", &L, &C);
30688 if( nNum!=2 || L<0 || C<0 ){
30689 dotCmdError(p, i, "bad argument", "Should be \"L,C\" where L and C"
30690 " are unsigned integers");
30691 return 1;
30692 }
30693 p->mode.spec.nLineLimit = L;
30694 p->mode.spec.nCharLimit = C;
 
30695 }
30696 chng = 1;
30697 }else if( optionMatch(z,"list") ){
30698 int ii;
30699 cli_puts("available modes:", p->out);
@@ -30726,13 +31198,14 @@
30726 ** how to set quoting. */
30727 i++;
30728 if( (k = pickStr(azArg[i],0,"no","yes","0","1",""))>=0 ){
30729 k &= 1; /* 0 for "off". 1 for "on". */
30730 }else{
30731 char *zErr = 0; /* 0 1 2 3 4 5 6 */
30732 k = pickStr(azArg[i],&zErr,"off","on","sql","csv","html","tcl","json",
30733 "");
 
30734 if( k<0 ){
30735 dotCmdError(p, i, "unknown", "%z", zErr);
30736 return 1;
30737 }
30738 }
@@ -30757,10 +31230,13 @@
30757 p->mode.spec.eText = QRF_TEXT_Tcl;
30758 break;
30759 case 6: /* json */
30760 p->mode.spec.eText = QRF_TEXT_Json;
30761 break;
 
 
 
30762 default: /* off */
30763 p->mode.spec.eText = QRF_TEXT_Plain;
30764 break;
30765 }
30766 chng = 1;
@@ -30832,10 +31308,11 @@
30832 if( k<0 ){
30833 dotCmdError(p, i, "bad --titles value","%z", zErr);
30834 return 1;
30835 }
30836 p->mode.spec.bTitles = k>=1 ? QRF_Yes : QRF_No;
 
30837 p->mode.spec.eTitle = k>1 ? k-1 : aModeInfo[p->mode.eMode].eHdr;
30838 chng = 1;
30839 }else if( optionMatch(z,"widths") || optionMatch(z,"width") ){
30840 int nWidth = 0;
30841 short int *aWidth;
@@ -30847,16 +31324,16 @@
30847 zW = azArg[++i];
30848 /* Every width value takes at least 2 bytes in the input string to
30849 ** specify, so strlen(zW) bytes should be plenty of space to hold the
30850 ** result. */
30851 aWidth = malloc( strlen(zW) );
30852 while( isspace(zW[0]) ) zW++;
30853 while( zW[0] ){
30854 int w = 0;
30855 int nDigit = 0;
30856 k = zW[0]=='-' && isdigit(zW[1]);
30857 while( isdigit(zW[k]) ){
30858 w = w*10 + zW[k] - '0';
30859 if( w>QRF_MAX_WIDTH ){
30860 dotCmdError(p,i+1,"width too big",
30861 "Maximum column width is %d", QRF_MAX_WIDTH);
30862 free(aWidth);
@@ -30873,11 +31350,11 @@
30873 }
30874 if( zW[0]=='-' ) w = -w;
30875 aWidth[nWidth++] = w;
30876 zW += k;
30877 if( zW[0]==',' ) zW++;
30878 while( isspace(zW[0]) ) zW++;
30879 }
30880 free(p->mode.spec.aWidth);
30881 p->mode.spec.aWidth = aWidth;
30882 p->mode.spec.nWidth = nWidth;
30883 chng = 1;
@@ -30928,39 +31405,52 @@
30928 unsigned char a = p->mode.spec.aAlign[ii];
30929 sqlite3_str_appendchar(pDesc, 1, "LLCR"[a&3]);
30930 }
30931 sqlite3_str_append(pDesc, "\"", 1);
30932 }
 
 
 
 
 
 
30933 if( bAll || p->mode.spec.eBlob!=QRF_BLOB_Auto ){
30934 const char *azBQuote[] =
30935 { "auto", "text", "sql", "hex", "tcl", "json", "size" };
30936 /* 0 1 2 3 4 5 6
30937 ** Must match QRF_BLOB_xxxx values. See all instances of tag-20251124a */
30938 u8 e = p->mode.spec.eBlob;
30939 sqlite3_str_appendf(pDesc, " --blob-quote %s", azBQuote[e]);
30940 }
30941 if( !bAll && p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit>0 ){
30942 sqlite3_str_appendf(pDesc, " --charlimit %d",p->mode.spec.nCharLimit);
30943 }
30944 zSetting = aModeStr[pI->eCSep];
30945 if( bAll || (zSetting && cli_strcmp(zSetting,p->mode.spec.zColumnSep)!=0) ){
30946 sqlite3_str_appendf(pDesc, " --colsep ");
30947 append_c_string(pDesc, p->mode.spec.zColumnSep);
30948 }
30949 if( bAll || p->mode.spec.eEsc!=QRF_Auto ){
30950 sqlite3_str_appendf(pDesc, " --escape %s",qrfEscNames[p->mode.spec.eEsc]);
30951 }
30952 if( bAll || (p->mode.spec.nLineLimit>0 && p->mode.spec.nCharLimit>0) ){
30953 if( p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit==0 ){
 
 
 
 
 
 
 
30954 sqlite3_str_appendf(pDesc, " --limits off");
 
 
 
 
 
30955 }else{
30956 sqlite3_str_appendf(pDesc, " --limits %d,%d",
30957 p->mode.spec.nLineLimit, p->mode.spec.nCharLimit);
 
30958 }
30959 }else
30960 if( p->mode.spec.nCharLimit==0 && p->mode.spec.nLineLimit>0 && pI->eCx>0 ){
30961 sqlite3_str_appendf(pDesc, " --linelimit %d",p->mode.spec.nLineLimit);
30962 }
30963 zSetting = aModeStr[pI->eNull];
30964 if( bAll || (zSetting && cli_strcmp(zSetting,p->mode.spec.zNull)!=0) ){
30965 sqlite3_str_appendf(pDesc, " --null ");
30966 append_c_string(pDesc, p->mode.spec.zNull);
@@ -30977,13 +31467,13 @@
30977 }
30978 if( bAll
30979 || (pI->eCx && (p->mode.spec.nScreenWidth>0 || p->mode.bAutoScreenWidth))
30980 ){
30981 if( p->mode.bAutoScreenWidth ){
30982 sqlite3_str_appendall(pDesc, " --screenwidth auto");
30983 }else{
30984 sqlite3_str_appendf(pDesc," --screenwidth %d",
30985 p->mode.spec.nScreenWidth);
30986 }
30987 }
30988 if( bAll || p->mode.eMode==MODE_Insert ){
30989 sqlite3_str_appendf(pDesc," --tablename ");
@@ -31023,11 +31513,11 @@
31023 sqlite3_str_appendf(pDesc, " --wrap %d", p->mode.spec.nWrap);
31024 }
31025 if( !bAll ) sqlite3_str_append(pDesc, " --ww", 5);
31026 }
31027 zDesc = sqlite3_str_finish(pDesc);
31028 cli_printf(p->out, "current output mode: %s\n", zDesc);
31029 fflush(p->out);
31030 sqlite3_free(zDesc);
31031 }
31032 return 0;
31033 }
@@ -31047,23 +31537,17 @@
31047 ** --bom Prepend a byte-order mark to the output
31048 ** -e Accumulate output in a temporary text file then
31049 ** launch a text editor when the redirection ends.
31050 ** --error-prefix X Use X as the left-margin prefix for error messages.
31051 ** Set to an empty string to restore the default.
31052 ** --glob GLOB Raise an error if the memory buffer does not match
31053 ** the GLOB pattern.
31054 ** --keep Continue using the same "memory" buffer. Do not
31055 ** reset it or delete it. Useful in combination with
31056 ** --glob, --not-glob, and/or --verify.
31057 ** ---notglob GLOB Raise an error if the memory buffer does not match
31058 ** the GLOB pattern.
31059 ** --plain Use plain text rather than HTML tables with -w
31060 ** --show Write the memory buffer to the screen, for debugging.
31061 ** --verify ENDMARK Read subsequent lines of text until the first line
31062 ** that matches ENDMARK. Discard the ENDMARK. Compare
31063 ** the text against the accumulated output in memory and
31064 ** raise an error if there are any differences.
31065 ** -w Show the output in a web browser. Output is
31066 ** written into a temporary HTML file until the
31067 ** redirect ends, then the web browser is launched.
31068 ** Query results are shown as HTML tables, unless
31069 ** the --plain is used too.
@@ -31101,13 +31585,11 @@
31101 char *zFile = 0; /* The FILE argument */
31102 int i; /* Loop counter */
31103 int eMode = 0; /* 0: .outout/.once, 'x'=.excel, 'w'=.www */
31104 int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
31105 int bPlain = 0; /* --plain option */
31106 int bKeep = 0; /* --keep option */
31107 char *zCheck = 0; /* Argument to --glob, --notglob, --verify */
31108 int eCheck = 0; /* 1: --glob, 2: --notglob, 3: --verify */
31109 static const char *zBomUtf8 = "\357\273\277";
31110 const char *zBom = 0;
31111 char c = azArg[0][0];
31112 int n = strlen30(azArg[0]);
31113
@@ -31129,36 +31611,21 @@
31129 zBom = zBomUtf8;
31130 }else if( cli_strcmp(z,"-plain")==0 ){
31131 bPlain = 1;
31132 }else if( c=='o' && z[0]=='1' && z[1]!=0 && z[2]==0
31133 && (z[1]=='x' || z[1]=='e' || z[1]=='w') ){
31134 if( bKeep || eMode || eCheck ){
31135 dotCmdError(p, i, "incompatible with prior options",0);
31136 goto dotCmdOutput_error;
31137 }
31138 eMode = z[1];
31139 }else if( cli_strcmp(z,"-keep")==0 ){
31140 bKeep = 1;
31141 }else if( cli_strcmp(z,"-show")==0 ){
31142 if( cli_output_capture ){
31143 sqlite3_fprintf(stdout, "%s", sqlite3_str_value(cli_output_capture));
31144 }
 
31145 bKeep = 1;
31146 }else if( cli_strcmp(z,"-glob")==0
31147 || cli_strcmp(z,"-notglob")==0
31148 || cli_strcmp(z,"-verify")==0
31149 ){
31150 if( eCheck || eMode ){
31151 dotCmdError(p, i, "incompatible with prior options",0);
31152 goto dotCmdOutput_error;
31153 }
31154 if( i+1>=nArg ){
31155 dotCmdError(p, i, "missing argument", 0);
31156 goto dotCmdOutput_error;
31157 }
31158 zCheck = azArg[++i];
31159 eCheck = z[1]=='g' ? 1 : z[1]=='n' ? 2 : 3;
31160 }else if( optionMatch(z,"error-prefix") ){
31161 if( i+1>=nArg ){
31162 dotCmdError(p, i, "missing argument", 0);
31163 return 1;
31164 }
@@ -31169,11 +31636,11 @@
31169 dotCmdError(p, i, "unknown option", 0);
31170 sqlite3_free(zFile);
31171 return 1;
31172 }
31173 }else if( zFile==0 && eMode==0 ){
31174 if( bKeep || eCheck ){
31175 dotCmdError(p, i, "incompatible with prior options",0);
31176 goto dotCmdOutput_error;
31177 }
31178 if( cli_strcmp(z, "memory")==0 && bOnce ){
31179 dotCmdError(p, 0, "cannot redirect to \"memory\"", 0);
@@ -31205,53 +31672,10 @@
31205 if( bOnce ){
31206 p->nPopOutput = 2;
31207 }else{
31208 p->nPopOutput = 0;
31209 }
31210 if( eCheck ){
31211 char *zTest;
31212 if( cli_output_capture ){
31213 zTest = sqlite3_str_value(cli_output_capture);
31214 }else{
31215 zTest = "";
31216 }
31217 p->nTestRun++;
31218 if( eCheck==3 ){
31219 int nCheck = strlen30(zCheck);
31220 sqlite3_str *pPattern = sqlite3_str_new(p->db);
31221 char *zPattern;
31222 sqlite3_int64 iStart = p->lineno;
31223 char zLine[2000];
31224 while( sqlite3_fgets(zLine,sizeof(zLine),p->in) ){
31225 if( strchr(zLine,'\n') ) p->lineno++;
31226 if( cli_strncmp(zCheck,zLine,nCheck)==0 ) break;
31227 sqlite3_str_appendall(pPattern, zLine);
31228 }
31229 zPattern = sqlite3_str_finish(pPattern);
31230 if( cli_strcmp(zPattern,zTest)!=0 ){
31231 sqlite3_fprintf(stderr,
31232 "%s:%lld: --verify does matches prior output\n",
31233 p->zInFile, iStart);
31234 p->nTestErr++;
31235 }
31236 sqlite3_free(zPattern);
31237 }else{
31238 char *zGlob = sqlite3_mprintf("*%s*", zCheck);
31239 if( eCheck==1 && sqlite3_strglob(zGlob, zTest)!=0 ){
31240 sqlite3_fprintf(stderr,
31241 "%s:%lld: --glob \"%s\" does not match prior output\n",
31242 p->zInFile, p->lineno, zCheck);
31243 p->nTestErr++;
31244 }else if( eCheck==2 && sqlite3_strglob(zGlob, zTest)==0 ){
31245 sqlite3_fprintf(stderr,
31246 "%s:%lld: --notglob \"%s\" matches prior output\n",
31247 p->zInFile, p->lineno, zCheck);
31248 p->nTestErr++;
31249 }
31250 sqlite3_free(zGlob);
31251 }
31252 }
31253 if( !bKeep ) output_reset(p);
31254 #ifndef SQLITE_NOHAVE_SYSTEM
31255 if( eMode=='e' || eMode=='x' || eMode=='w' ){
31256 p->doXdgOpen = 1;
31257 modePush(p);
@@ -31328,10 +31752,199 @@
31328
31329 dotCmdOutput_error:
31330 sqlite3_free(zFile);
31331 return 1;
31332 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31333
31334 /*
31335 ** Enlarge the space allocated in p->dot so that it can hold more
31336 ** than nArg parsed command-line arguments.
31337 */
@@ -31360,11 +31973,11 @@
31360 free(p->dot.zCopy);
31361 z = p->dot.zCopy = strdup(zLine);
31362 shell_check_oom(z);
31363 szLine = strlen(z);
31364 while( szLine>0 && IsSpace(z[szLine-1]) ) szLine--;
31365 if( szLine>0 && z[szLine-1]==';' && p->iCompat>=20251115 ){
31366 szLine--;
31367 while( szLine>0 && IsSpace(z[szLine-1]) ) szLine--;
31368 }
31369 z[szLine] = 0;
31370 parseDotRealloc(p, 2);
@@ -31580,35 +32193,17 @@
31580 eputz("Usage: .changes on|off\n");
31581 rc = 1;
31582 }
31583 }else
31584
31585 #ifndef SQLITE_SHELL_FIDDLE
31586 /* Cancel output redirection, if it is currently set (by .testcase)
31587 ** Then read the content of the testcase-out.txt file and compare against
31588 ** azArg[1]. If there are differences, report an error and exit.
31589 */
31590 if( c=='c' && n>=3 && cli_strncmp(azArg[0], "check", n)==0 ){
31591 char *zRes = 0;
31592 output_reset(p);
31593 if( nArg!=2 ){
31594 eputz("Usage: .check GLOB-PATTERN\n");
31595 rc = 2;
31596 }else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
31597 rc = 2;
31598 }else if( testcase_glob(azArg[1],zRes)==0 ){
31599 cli_printf(stderr,
31600 "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
31601 p->zTestcase, azArg[1], zRes);
31602 rc = 1;
31603 }else{
31604 cli_printf(p->out, "testcase-%s ok\n", p->zTestcase);
31605 p->nCheck++;
31606 }
31607 sqlite3_free(zRes);
31608 }else
31609 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
31610
31611 #ifndef SQLITE_SHELL_FIDDLE
31612 if( c=='c' && cli_strncmp(azArg[0], "clone", n)==0 ){
31613 failIfSafeMode(p, "cannot run .clone in safe mode");
31614 if( nArg==2 ){
@@ -32187,10 +32782,11 @@
32187 }else
32188
32189 if( c=='h' && cli_strncmp(azArg[0], "headers", n)==0 ){
32190 if( nArg==2 ){
32191 p->mode.spec.bTitles = booleanValue(azArg[1]) ? QRF_Yes : QRF_No;
 
32192 p->mode.spec.eTitle = aModeInfo[p->mode.eMode].eHdr;
32193 }else{
32194 eputz("Usage: .headers on|off\n");
32195 rc = 1;
32196 }
@@ -32240,14 +32836,14 @@
32240 sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1);
32241 goto meta_command_exit;
32242 }
32243 zSql = sqlite3_mprintf(
32244 "SELECT rootpage, 0 FROM sqlite_schema"
32245 " WHERE name='%q' AND type='index'"
32246 "UNION ALL "
32247 "SELECT rootpage, 1 FROM sqlite_schema"
32248 " WHERE name='%q' AND type='table'"
32249 " AND sql LIKE '%%without%%rowid%%'",
32250 azArg[1], azArg[1]
32251 );
32252 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
32253 sqlite3_free(zSql);
@@ -32401,13 +32997,14 @@
32401 goto meta_command_exit;
32402 }
32403 if( nArg==3 ){
32404 sqlite3_limit(p->db, aLimit[iLimit].limitCode,
32405 (int)integerValue(azArg[2]));
 
 
 
32406 }
32407 cli_printf(stdout, "%20s %d\n", aLimit[iLimit].zLimitName,
32408 sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1));
32409 }
32410 }else
32411
32412 if( c=='l' && n>2 && cli_strncmp(azArg[0], "lint", n)==0 ){
32413 open_db(p, 0);
@@ -32493,21 +33090,23 @@
32493 int iName = 1; /* Index in azArg[] of the filename */
32494 int newFlag = 0; /* True to delete file before opening */
32495 int openMode = SHELL_OPEN_UNSPEC;
32496 int openFlags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
32497
 
 
32498 /* Check for command-line arguments */
32499 for(iName=1; iName<nArg; iName++){
32500 const char *z = azArg[iName];
32501 #ifndef SQLITE_SHELL_FIDDLE
32502 if( optionMatch(z,"new") ){
32503 newFlag = 1;
32504 #ifdef SQLITE_HAVE_ZLIB
32505 }else if( optionMatch(z, "zip") ){
32506 openMode = SHELL_OPEN_ZIPFILE;
32507 #endif
32508 }else if( optionMatch(z, "append") ){
32509 openMode = SHELL_OPEN_APPENDVFS;
32510 }else if( optionMatch(z, "readonly") ){
32511 openFlags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
32512 openFlags |= SQLITE_OPEN_READONLY;
32513 }else if( optionMatch(z, "exclusive") ){
@@ -32950,21 +33549,22 @@
32950 || sqlite3_strlike(zName, "sqlite_schema", '\\')==0
32951 || sqlite3_strlike(zName,"sqlite_temp_master", '\\')==0
32952 || sqlite3_strlike(zName,"sqlite_temp_schema", '\\')==0;
32953 if( isSchema ){
32954 cli_printf(p->out,
32955 "CREATE TABLE %s (\n"
32956 " type text,\n"
32957 " name text,\n"
32958 " tbl_name text,\n"
32959 " rootpage integer,\n"
32960 " sql text\n"
32961 ");\n", zName);
 
 
32962 }
32963 }
32964 rc = sqlite3_prepare_v2(p->db, "SELECT name FROM pragma_database_list",
32965 -1, &pStmt, 0);
32966 if( rc ){
32967 shellDatabaseError(p->db);
32968 sqlite3_finalize(pStmt);
32969
32970 rc = 1;
@@ -32972,11 +33572,11 @@
32972 }
32973 pSql = sqlite3_str_new(p->db);
32974 sqlite3_str_appendf(pSql, "SELECT sql FROM", 0);
32975 iSchema = 0;
32976 while( sqlite3_step(pStmt)==SQLITE_ROW ){
32977 const char *zDb = (const char*)sqlite3_column_text(pStmt, 0);
32978 char zScNum[30];
32979 sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema);
32980 sqlite3_str_appendall(pSql, zDiv);
32981 zDiv = " UNION ALL ";
32982 if( sqlite3_stricmp(zDb, "main")==0 ){
@@ -32992,11 +33592,12 @@
32992 " AS sql, type, tbl_name, name, rowid, %d AS snum, %Q as sname",
32993 ++iSchema, zDb);
32994 sqlite3_str_appendf(pSql," FROM \"%w\".sqlite_schema", zDb);
32995 }
32996 sqlite3_finalize(pStmt);
32997 #ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS
 
32998 if( zName ){
32999 sqlite3_str_appendall(pSql,
33000 " UNION ALL SELECT shell_module_schema(name),"
33001 " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list");
33002 }
@@ -33016,11 +33617,11 @@
33016 }else{
33017 sqlite3_str_appendf(pSql, " LIKE %Q ESCAPE '\\' AND ", zName);
33018 }
33019 }
33020 if( bNoSystemTabs ){
33021 sqlite3_str_appendf(pSql, " name NOT LIKE 'sqlite__%%' ESCALE '_' AND ");
33022 }
33023 sqlite3_str_appendf(pSql, "sql IS NOT NULL ORDER BY snum, rowid");
33024 if( bDebug ){
33025 cli_printf(p->out, "SQL: %s;\n", sqlite3_str_value(pSql));
33026 }else{
@@ -33734,25 +34335,15 @@
33734 sqlite3_str_free(pSql);
33735 modePop(p);
33736 if( rc ) return shellDatabaseError(p->db);
33737 }else
33738
33739 #ifndef SQLITE_SHELL_FIDDLE
33740 /* Begin redirecting output to the file "testcase-out.txt" */
33741 if( c=='t' && cli_strcmp(azArg[0],"testcase")==0 ){
33742 output_reset(p);
33743 p->out = output_file_open(p, "testcase-out.txt");
33744 if( p->out==0 ){
33745 eputz("Error: cannot open 'testcase-out.txt'\n");
33746 }
33747 if( nArg>=2 ){
33748 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]);
33749 }else{
33750 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
33751 }
33752 }else
33753 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
33754
33755 #ifndef SQLITE_UNTESTABLE
33756 if( c=='t' && n>=8 && cli_strncmp(azArg[0], "testctrl", n)==0 ){
33757 static const struct {
33758 const char *zCtrlName; /* Name of a test-control option */
@@ -35068,11 +35659,10 @@
35068 " -bail stop after hitting an error\n"
35069 " -batch force batch I/O\n"
35070 " -box set output mode to 'box'\n"
35071 " -cmd COMMAND run \"COMMAND\" before reading stdin\n"
35072 " -column set output mode to 'column'\n"
35073 " -compat YYYYMMDD set default options for date YYYYMMDD\n"
35074 " -csv set output mode to 'csv'\n"
35075 #if !defined(SQLITE_OMIT_DESERIALIZE)
35076 " -deserialize open the database using sqlite3_deserialize()\n"
35077 #endif
35078 " -echo print inputs before execution\n"
@@ -35152,15 +35742,10 @@
35152 /*
35153 ** Initialize the state information in data
35154 */
35155 static void main_init(ShellState *p) {
35156 memset(p, 0, sizeof(*p));
35157 #if defined(COMPATIBILITY_DATE)
35158 p->iCompat = COMPATIBILITY_DATE;
35159 #else
35160 p->iCompat = 20251116;
35161 #endif
35162 p->pAuxDb = &p->aAuxDb[0];
35163 p->shellFlgs = SHFLG_Lookaside;
35164 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, p);
35165 #if !defined(SQLITE_SHELL_FIDDLE)
35166 verify_uninitialized();
@@ -35174,22 +35759,18 @@
35174 /*
35175 ** Output text to the console in a font that attracts extra attention.
35176 */
35177 #if defined(_WIN32) || defined(WIN32)
35178 static void printBold(const char *zText){
35179 #if !SQLITE_OS_WINRT
35180 HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
35181 CONSOLE_SCREEN_BUFFER_INFO defaultScreenInfo;
35182 GetConsoleScreenBufferInfo(out, &defaultScreenInfo);
35183 SetConsoleTextAttribute(out,
35184 FOREGROUND_RED|FOREGROUND_INTENSITY
35185 );
35186 #endif
35187 sputz(stdout, zText);
35188 #if !SQLITE_OS_WINRT
35189 SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes);
35190 #endif
35191 }
35192 #else
35193 static void printBold(const char *zText){
35194 cli_printf(stdout, "\033[1m%s\033[0m", zText);
35195 }
@@ -35219,29 +35800,65 @@
35219 cli_puts(z, p->out);
35220 fflush(p->out);
35221 return 1;
35222 }
35223
35224 #ifndef SQLITE_SHELL_IS_UTF8
35225 # if (defined(_WIN32) || defined(WIN32)) \
35226 && (defined(_MSC_VER) || (defined(UNICODE) && defined(__GNUC__)))
35227 # define SQLITE_SHELL_IS_UTF8 (0)
35228 # else
35229 # define SQLITE_SHELL_IS_UTF8 (1)
35230 # endif
35231 #endif
35232
35233 #ifdef SQLITE_SHELL_FIDDLE
35234 # define main fiddle_main
35235 #endif
35236
35237 #if SQLITE_SHELL_IS_UTF8
35238 int SQLITE_CDECL main(int argc, char **argv){
35239 #else
 
 
 
 
35240 int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
35241 char **argv;
35242 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35243 #ifdef SQLITE_DEBUG
35244 sqlite3_int64 mem_main_enter = 0;
35245 #endif
35246 char *zErrMsg = 0;
35247 #ifdef SQLITE_SHELL_FIDDLE
@@ -35259,14 +35876,10 @@
35259 int nOptsEnd = argc;
35260 int bEnableVfstrace = 0;
35261 char **azCmd = 0;
35262 int *aiCmd = 0;
35263 const char *zVfs = 0; /* Value of -vfs command-line option */
35264 #if !SQLITE_SHELL_IS_UTF8
35265 char **argvToFree = 0;
35266 int argcToFree = 0;
35267 #endif
35268 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
35269
35270 #ifdef SQLITE_SHELL_FIDDLE
35271 stdin_is_interactive = 0;
35272 stdout_is_console = 1;
@@ -35291,15 +35904,11 @@
35291 ){
35292 exit(1);
35293 }
35294 }else{
35295 #if defined(_WIN32) || defined(WIN32)
35296 #if SQLITE_OS_WINRT
35297 __debugbreak();
35298 #else
35299 DebugBreak();
35300 #endif
35301 #elif defined(SIGTRAP)
35302 raise(SIGTRAP);
35303 #endif
35304 }
35305 }
@@ -35321,36 +35930,10 @@
35321 exit(1);
35322 }
35323 #endif
35324 main_init(&data);
35325
35326 /* On Windows, we must translate command-line arguments into UTF-8.
35327 ** The SQLite memory allocator subsystem has to be enabled in order to
35328 ** do this. But we want to run an sqlite3_shutdown() afterwards so that
35329 ** subsequent sqlite3_config() calls will work. So copy all results into
35330 ** memory that does not come from the SQLite memory allocator.
35331 */
35332 #if !SQLITE_SHELL_IS_UTF8
35333 sqlite3_initialize();
35334 argvToFree = malloc(sizeof(argv[0])*argc*2);
35335 shell_check_oom(argvToFree);
35336 argcToFree = argc;
35337 argv = argvToFree + argc;
35338 for(i=0; i<argc; i++){
35339 char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
35340 i64 n;
35341 shell_check_oom(z);
35342 n = strlen(z);
35343 argv[i] = malloc( n+1 );
35344 shell_check_oom(argv[i]);
35345 memcpy(argv[i], z, n+1);
35346 argvToFree[i] = argv[i];
35347 sqlite3_free(z);
35348 }
35349 sqlite3_shutdown();
35350 #endif
35351
35352 assert( argc>=1 && argv && argv[0] );
35353 Argv0 = argv[0];
35354
35355 #ifdef SQLITE_SHELL_DBNAME_PROC
35356 {
@@ -35362,11 +35945,11 @@
35362 SQLITE_SHELL_DBNAME_PROC(&data.pAuxDb->zDbFilename);
35363 warnInmemoryDb = 0;
35364 }
35365 #endif
35366
35367 /* Do an initial pass through the command-line argument to locate
35368 ** the name of the database file, the name of the initialization file,
35369 ** the size of the alternative malloc heap, options affecting commands
35370 ** or SQL run from the command line, and the first command to execute.
35371 */
35372 #ifndef SQLITE_SHELL_FIDDLE
@@ -35374,11 +35957,11 @@
35374 #endif
35375 for(i=1; i<argc; i++){
35376 char *z;
35377 z = argv[i];
35378 if( z[0]!='-' || i>nOptsEnd ){
35379 if( data.aAuxDb->zDbFilename==0 ){
35380 data.aAuxDb->zDbFilename = z;
35381 }else{
35382 /* Excess arguments are interpreted as SQL (or dot-commands) and
35383 ** mean that nothing is read from stdin */
35384 readStdin = 0;
@@ -35419,15 +36002,10 @@
35419 if( n<2 ){
35420 sqlite3_fprintf(stderr,"minimum --screenwidth is 2\n");
35421 exit(1);
35422 }
35423 stdout_tty_width = n;
35424 }else if( cli_strcmp(z,"-compat")==0 ){
35425 data.iCompat = atoi(cmdline_option_value(argc, argv, ++i));
35426 modeFree(&data.mode);
35427 memset(&data.mode, 0, sizeof(data.mode));
35428 modeDefault(&data);
35429 }else if( cli_strcmp(z,"-utf8")==0 ){
35430 }else if( cli_strcmp(z,"-no-utf8")==0 ){
35431 }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
35432 int val = 0;
35433 sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW, &val);
@@ -35547,10 +36125,20 @@
35547 }else if( cli_strcmp(z,"-safe")==0 ){
35548 /* no-op - catch this on the second pass */
35549 }else if( cli_strcmp(z,"-escape")==0 && i+1<argc ){
35550 /* skip over the argument */
35551 i++;
 
 
 
 
 
 
 
 
 
 
35552 }
35553 }
35554 #ifndef SQLITE_SHELL_FIDDLE
35555 if( !bEnableVfstrace ) verify_uninitialized();
35556 #endif
@@ -35573,11 +36161,30 @@
35573
35574 if( zVfs ){
35575 sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
35576 if( pVfs ){
35577 sqlite3_vfs_register(pVfs, 1);
35578 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35579 cli_printf(stderr,"no such VFS: \"%s\"\n", zVfs);
35580 exit(1);
35581 }
35582 }
35583
@@ -35586,11 +36193,12 @@
35586 data.pAuxDb->zDbFilename = ":memory:";
35587 warnInmemoryDb = argc==1;
35588 #else
35589 cli_printf(stderr,
35590 "%s: Error: no database filename specified\n", Argv0);
35591 return 1;
 
35592 #endif
35593 }
35594 data.out = stdout;
35595 if( bEnableVfstrace ){
35596 vfstrace_register("trace",0,vfstraceOut, &data, 1);
@@ -35613,11 +36221,11 @@
35613 ** is given on the command line, look for a file named ~/.sqliterc and
35614 ** try to process it.
35615 */
35616 if( !noInit ) process_sqliterc(&data,zInitFile);
35617
35618 /* Make a second pass through the command-line argument and set
35619 ** options. This second pass is delayed until after the initialization
35620 ** file is processed so that the command-line arguments will override
35621 ** settings in the initialization file.
35622 */
35623 for(i=1; i<argc; i++){
@@ -35640,10 +36248,12 @@
35640 modeChange(&data, MODE_Json);
35641 }else if( cli_strcmp(z,"-markdown")==0 ){
35642 modeChange(&data, MODE_Markdown);
35643 }else if( cli_strcmp(z,"-table")==0 ){
35644 modeChange(&data, MODE_Table);
 
 
35645 }else if( cli_strcmp(z,"-box")==0 ){
35646 modeChange(&data, MODE_Box);
35647 }else if( cli_strcmp(z,"-csv")==0 ){
35648 modeChange(&data, MODE_Csv);
35649 }else if( cli_strcmp(z,"-escape")==0 && i+1<argc ){
@@ -35726,22 +36336,21 @@
35726 }else if( cli_strcmp(z,"-bail")==0 ){
35727 /* No-op. The bail_on_error flag should already be set. */
35728 }else if( cli_strcmp(z,"-version")==0 ){
35729 cli_printf(stdout, "%s %s (%d-bit)\n",
35730 sqlite3_libversion(), sqlite3_sourceid(), 8*(int)sizeof(char*));
35731 return 0;
 
35732 }else if( cli_strcmp(z,"-interactive")==0 ){
35733 /* Need to check for interactive override here to so that it can
35734 ** affect console setup (for Windows only) and testing thereof.
35735 */
35736 stdin_is_interactive = 1;
35737 }else if( cli_strcmp(z,"-batch")==0 ){
35738 /* already handled */
35739 }else if( cli_strcmp(z,"-screenwidth")==0 ){
35740 i++;
35741 }else if( cli_strcmp(z,"-compat")==0 ){
35742 i++;
35743 }else if( cli_strcmp(z,"-utf8")==0 ){
35744 /* already handled */
35745 }else if( cli_strcmp(z,"-no-utf8")==0 ){
35746 /* already handled */
35747 }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
@@ -35783,29 +36392,33 @@
35783 ** we retain the goofy behavior for historical compatibility. */
35784 if( i==argc-1 ) break;
35785 z = cmdline_option_value(argc,argv,++i);
35786 if( z[0]=='.' ){
35787 rc = do_meta_command(z, &data);
35788 if( rc && bail_on_error ) return rc==2 ? 0 : rc;
 
 
 
35789 }else{
35790 open_db(&data, 0);
35791 rc = shell_exec(&data, z, &zErrMsg);
35792 if( zErrMsg!=0 ){
35793 shellEmitError(zErrMsg);
35794 sqlite3_free(zErrMsg);
35795 if( bail_on_error ) return rc!=0 ? rc : 1;
35796 }else if( rc!=0 ){
35797 cli_printf(stderr,"Error: unable to process SQL \"%s\"\n", z);
35798 if( bail_on_error ) return rc;
35799 }
 
35800 }
35801 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
35802 }else if( cli_strncmp(z, "-A", 2)==0 ){
35803 if( nCmd>0 ){
35804 cli_printf(stderr,"Error: cannot mix regular SQL or dot-commands"
35805 " with \"%s\"\n", z);
35806 return 1;
 
35807 }
35808 open_db(&data, OPEN_DB_ZIPFILE);
35809 if( z[2] ){
35810 argv[i] = &z[2];
35811 arDotCommand(&data, 1, argv+(i-1), argc-(i-1));
@@ -35821,11 +36434,12 @@
35821 }else if( cli_strcmp(z,"-unsafe-testing")==0 ){
35822 /* Acted upon in first pass. */
35823 }else{
35824 cli_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
35825 eputz("Use -help for a list of options.\n");
35826 return 1;
 
35827 }
35828 }
35829
35830 if( !readStdin ){
35831 /* Run all arguments that do not begin with '-' as if they were separate
@@ -35832,11 +36446,22 @@
35832 ** command-line inputs, except for the argToSkip argument which contains
35833 ** the database filename.
35834 */
35835 for(i=0; i<nCmd; i++){
35836 echo_group_input(&data, azCmd[i]);
35837 if( azCmd[i][0]=='.' ){
 
 
 
 
 
 
 
 
 
 
 
35838 char *zErrCtx = malloc( 64 );
35839 shell_check_oom(zErrCtx);
35840 sqlite3_snprintf(64,zErrCtx,"argv[%i]:",aiCmd[i]);
35841 data.zInFile = "<cmdline>";
35842 data.zErrPrefix = zErrCtx;
@@ -35947,14 +36572,10 @@
35947 }
35948 find_home_dir(1);
35949 output_reset(&data);
35950 data.doXdgOpen = 0;
35951 clearTempFile(&data);
35952 #if !SQLITE_SHELL_IS_UTF8
35953 for(i=0; i<argcToFree; i++) free(argvToFree[i]);
35954 free(argvToFree);
35955 #endif
35956 modeFree(&data.mode);
35957 if( data.nSavedModes ){
35958 int ii;
35959 for(ii=0; ii<data.nSavedModes; ii++){
35960 modeFree(&data.aSavedModes[ii].mode);
35961
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -35,11 +35,11 @@
35 ** ext/recover/sqlite3recover.h
36 ** src/shell.c.in
37 **
38 ** To modify this program, get a copy of the canonical SQLite source tree,
39 ** edit the src/shell.c.in file and/or some of the other files that are
40 ** listed above, then rerun the command "make shell.c".
41 */
42 /************************* Begin src/shell.c.in ******************/
43 /*
44 ** 2001 September 15
45 **
@@ -49,11 +49,11 @@
49 ** May you do good and not evil.
50 ** May you find forgiveness for yourself and forgive others.
51 ** May you share freely, never taking more than you give.
52 **
53 *************************************************************************
54 ** This file contains code to implement the "sqlite3" command line
55 ** utility for accessing SQLite databases.
56 */
57 #if (defined(_WIN32) || defined(WIN32)) && !defined(_CRT_SECURE_NO_WARNINGS)
58 /* This needs to come before any includes for MSVC compiler */
59 #define _CRT_SECURE_NO_WARNINGS
@@ -71,26 +71,22 @@
71 # define SHELL_STRINGIFY(f) SHELL_STRINGIFY_(f)
72 #ifdef SQLITE_CUSTOM_INCLUDE
73 # include SHELL_STRINGIFY(SQLITE_CUSTOM_INCLUDE)
74 #endif
75
 
 
 
 
 
 
 
 
76 /*
77 ** If SQLITE_SHELL_FIDDLE is defined then the shell is modified
78 ** somewhat for use as a WASM module in a web browser. This flag
79 ** should only be used when building the "fiddle" web application, as
80 ** the browser-mode build has much different user input requirements
81 ** and this build mode rewires the user input subsystem to account for
82 ** that.
83 */
84 #if defined(SQLITE_SHELL_FIDDLE)
85 # undef SQLITE_OMIT_LOAD_EXTENSION
86 # define SQLITE_OMIT_LOAD_EXTENSION 1
87 #endif
88
89 /*
90 ** Warning pragmas copied from msvc.h in the core.
91 */
92 #if defined(_MSC_VER)
@@ -218,13 +214,10 @@
214 # define deliberate_fall_through
215 # endif
216 #endif
217
218 #if defined(_WIN32) || defined(WIN32)
 
 
 
219 # include <io.h>
220 # include <fcntl.h>
221 # define isatty(h) _isatty(h)
222 # ifndef access
223 # define access(f,m) _access((f),(m))
@@ -235,11 +228,10 @@
228 # ifndef strdup
229 # define strdup _strdup
230 # endif
231 # undef pclose
232 # define pclose _pclose
 
233 #else
234 /* Make sure isatty() has a prototype. */
235 extern int isatty(int);
236
237 # if !defined(__RTP__) && !defined(_WRS_KERNEL) && !defined(SQLITE_WASI)
@@ -266,13 +258,10 @@
258 #define ToLower(X) (char)tolower((unsigned char)X)
259 #define IsAlnum(X) isalnum((unsigned char)X)
260 #define IsAlpha(X) isalpha((unsigned char)X)
261
262 #if defined(_WIN32) || defined(WIN32)
 
 
 
263 #undef WIN32_LEAN_AND_MEAN
264 #define WIN32_LEAN_AND_MEAN
265 #include <windows.h>
266
267 /* string conversion routines only needed on Win32 */
@@ -704,13 +693,15 @@
693 unsigned char bWordWrap; /* Try to wrap on word boundaries */
694 unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
695 unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
696 unsigned char eTitleAlign; /* Alignment for column headers */
697 unsigned char bSplitColumn; /* Wrap single-column output into many columns */
698 unsigned char bBorder; /* Show outer border in Box and Table styles */
699 short int nWrap; /* Wrap columns wider than this */
700 short int nScreenWidth; /* Maximum overall table width */
701 short int nLineLimit; /* Maximum number of lines for any row */
702 short int nTitleLimit; /* Maximum number of characters in a title */
703 int nCharLimit; /* Maximum number of characters in a cell */
704 int nWidth; /* Number of entries in aWidth[] */
705 int nAlign; /* Number of entries in aAlignment[] */
706 short int *aWidth; /* Column widths */
707 unsigned char *aAlign; /* Column alignments */
@@ -775,10 +766,11 @@
766 #define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
767 #define QRF_TEXT_Csv 3 /* CSV-style quoting */
768 #define QRF_TEXT_Html 4 /* HTML-style quoting */
769 #define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
770 #define QRF_TEXT_Json 6 /* JSON quoting */
771 #define QRF_TEXT_Relaxed 7 /* Relaxed SQL quoting */
772
773 /*
774 ** Quoting styles for BLOBs
775 ** Allowed values for sqlite3_qrf_spec.eBlob
776 */
@@ -842,17 +834,25 @@
834 /*
835 ** Return an estimate of the width, in columns, for the single Unicode
836 ** character c. For normal characters, the answer is always 1. But the
837 ** estimate might be 0 or 2 for zero-width and double-width characters.
838 **
839 ** Different devices display unicode using different widths. So
840 ** it is impossible to know that true display width with 100% accuracy.
841 ** Inaccuracies in the width estimates might cause columns to be misaligned.
842 ** Unfortunately, there is nothing we can do about that.
843 */
844 int sqlite3_qrf_wcwidth(int c);
845
846 /*
847 ** Return an estimate of the number of display columns used by the
848 ** string in the argument. The width of individual characters is
849 ** determined as for sqlite3_qrf_wcwidth(). VT100 escape code sequences
850 ** are assigned a width of zero.
851 */
852 size_t sqlite3_qrf_wcswidth(const char*);
853
854
855 #ifdef __cplusplus
856 }
857 #endif
858 #endif /* !defined(SQLITE_QRF_H) */
@@ -915,11 +915,11 @@
915 int mxWidth; /* Screen width */
916 int mxHeight; /* nLineLimit */
917 union {
918 struct { /* Content for QRF_STYLE_Line */
919 int mxColWth; /* Maximum display width of any column */
920 char **azCol; /* Names of output columns (MODE_Line) */
921 } sLine;
922 qrfEQPGraph *pGraph; /* EQP graph (Eqp, Stats, and StatsEst) */
923 struct { /* Content for QRF_STYLE_Explain */
924 int nIndent; /* Slots allocated for aiIndent */
925 int iIndent; /* Current slot */
@@ -961,10 +961,19 @@
961 #define qrfSpace(x) ((qrfCType[(unsigned char)x]&1)!=0)
962 #define qrfDigit(x) ((qrfCType[(unsigned char)x]&2)!=0)
963 #define qrfAlpha(x) ((qrfCType[(unsigned char)x]&4)!=0)
964 #define qrfAlnum(x) ((qrfCType[(unsigned char)x]&6)!=0)
965
966 #ifndef deliberate_fall_through
967 /* Quiet some compilers about some of our intentional code. */
968 # if defined(GCC_VERSION) && GCC_VERSION>=7000000
969 # define deliberate_fall_through __attribute__((fallthrough));
970 # else
971 # define deliberate_fall_through
972 # endif
973 #endif
974
975 /*
976 ** Set an error code and error message.
977 */
978 static void qrfError(
979 Qrf *p, /* Query result state */
@@ -990,10 +999,19 @@
999 */
1000 static void qrfOom(Qrf *p){
1001 qrfError(p, SQLITE_NOMEM, "out of memory");
1002 }
1003
1004 /*
1005 ** Transfer any error in pStr over into p.
1006 */
1007 static void qrfStrErr(Qrf *p, sqlite3_str *pStr){
1008 int rc = pStr ? sqlite3_str_errcode(pStr) : 0;
1009 if( rc ){
1010 qrfError(p, rc, sqlite3_errstr(rc));
1011 }
1012 }
1013
1014
1015 /*
1016 ** Add a new entry to the EXPLAIN QUERY PLAN data
1017 */
@@ -1212,11 +1230,13 @@
1230 sqlite3_str_reset(pLine);
1231 }else{
1232 qrfEqpAppend(p, iId, iPid, zo);
1233 }
1234 }
1235 qrfStrErr(p, pLine);
1236 sqlite3_free(sqlite3_str_finish(pLine));
1237 qrfStrErr(p, pStats);
1238 sqlite3_free(sqlite3_str_finish(pStats));
1239 #endif
1240 }
1241
1242
@@ -1287,11 +1307,11 @@
1307 {1, 0x00ece}, {0, 0x00f18}, {1, 0x00f1a}, {0, 0x00f35}, {1, 0x00f36},
1308 {0, 0x00f37}, {1, 0x00f38}, {0, 0x00f39}, {1, 0x00f3a}, {0, 0x00f71},
1309 {1, 0x00f7f}, {0, 0x00f80}, {1, 0x00f85}, {0, 0x00f86}, {1, 0x00f88},
1310 {0, 0x00f90}, {1, 0x00f98}, {0, 0x00f99}, {1, 0x00fbd}, {0, 0x00fc6},
1311 {1, 0x00fc7}, {0, 0x0102d}, {1, 0x01031}, {0, 0x01032}, {1, 0x01033},
1312 {0, 0x01036}, {1, 0x0103b}, {0, 0x01058},
1313 {1, 0x0105a}, {2, 0x01100}, {0, 0x01160}, {1, 0x01200}, {0, 0x0135f},
1314 {1, 0x01360}, {0, 0x01712}, {1, 0x01715}, {0, 0x01732}, {1, 0x01735},
1315 {0, 0x01752}, {1, 0x01754}, {0, 0x01772}, {1, 0x01774}, {0, 0x017b4},
1316 {1, 0x017b6}, {0, 0x017b7}, {1, 0x017be}, {0, 0x017c6}, {1, 0x017c7},
1317 {0, 0x017c9}, {1, 0x017d4}, {0, 0x017dd}, {1, 0x017de}, {0, 0x0180b},
@@ -1330,11 +1350,11 @@
1350 */
1351 int sqlite3_qrf_wcwidth(int c){
1352 int iFirst, iLast;
1353
1354 /* Fast path for common characters */
1355 if( c<0x300 ) return 1;
1356
1357 /* The general case */
1358 iFirst = 0;
1359 iLast = sizeof(aQrfUWidth)/sizeof(aQrfUWidth[0]) - 1;
1360 while( iFirst<iLast-1 ){
@@ -1396,17 +1416,24 @@
1416 return i+1;
1417 }
1418
1419 /*
1420 ** Return the length of a string in display characters.
1421 **
1422 ** Most characters of the input string count as 1, including
1423 ** multi-byte UTF8 characters. However, zero-width unicode
1424 ** characters and VT100 escape sequences count as zero, and
1425 ** double-width characters count as two.
1426 **
1427 ** The definition of "zero-width" and "double-width" characters
1428 ** is not precise. It depends on the output device, to some extent,
1429 ** and it varies according to the Unicode version. This routine
1430 ** makes the best guess that it can.
1431 */
1432 size_t sqlite3_qrf_wcswidth(const char *zIn){
1433 const unsigned char *z = (const unsigned char*)zIn;
1434 size_t n = 0;
1435 while( *z ){
1436 if( z[0]<' ' ){
1437 int k;
1438 if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
1439 z += k;
@@ -1436,15 +1463,18 @@
1463 ** Write the number of newlines into *pnNL. So, *pnNL will
1464 ** return 0 if everything fits on one line, or positive it
1465 ** it will need to be split.
1466 */
1467 static int qrfDisplayWidth(const char *zIn, sqlite3_int64 nByte, int *pnNL){
1468 const unsigned char *z;
1469 const unsigned char *zEnd;
1470 int mx = 0;
1471 int n = 0;
1472 int nNL = 0;
1473 if( zIn==0 ) zIn = "";
1474 z = (const unsigned char*)zIn;
1475 zEnd = &z[nByte];
1476 while( z<zEnd ){
1477 if( z[0]<' ' ){
1478 int k;
1479 if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
1480 z += k;
@@ -1551,10 +1581,51 @@
1581 zOut[j++] = '^';
1582 zOut[j++] = 0x40+c;
1583 }
1584 }
1585 }
1586
1587 /*
1588 ** Determine if the string z[] can be shown as plain text. Return true
1589 ** if z[] is unambiguously text. Return false if z[] needs to be
1590 ** quoted.
1591 **
1592 ** All of the following must be true in order for z[] to be relaxable:
1593 **
1594 ** (1) z[] does not begin or end with ' or whitespace
1595 ** (2) z[] is not the same as the NULL rendering
1596 ** (3) z[] does not looks like a numeric literal
1597 */
1598 static int qrfRelaxable(Qrf *p, const char *z){
1599 size_t i, n;
1600 if( z[0]=='\'' || qrfSpace(z[0]) ) return 0;
1601 if( z[0]==0 ){
1602 return (p->spec.zNull!=0 && p->spec.zNull[0]!=0);
1603 }
1604 n = strlen(z);
1605 if( n==0 || z[n-1]=='\'' || qrfSpace(z[n-1]) ) return 0;
1606 if( p->spec.zNull && strcmp(p->spec.zNull,z)==0 ) return 0;
1607 i = (z[0]=='-' || z[0]=='+');
1608 if( strcmp(z+i,"Inf")==0 ) return 0;
1609 if( !qrfDigit(z[i]) ) return 1;
1610 i++;
1611 while( qrfDigit(z[i]) ){ i++; }
1612 if( z[i]==0 ) return 0;
1613 if( z[i]=='.' ){
1614 i++;
1615 while( qrfDigit(z[i]) ){ i++; }
1616 if( z[i]==0 ) return 0;
1617 }
1618 if( z[i]=='e' || z[i]=='E' ){
1619 i++;
1620 if( z[i]=='+' || z[i]=='-' ){ i++; }
1621 if( !qrfDigit(z[i]) ) return 1;
1622 i++;
1623 while( qrfDigit(z[i]) ){ i++; }
1624 }
1625 return z[i]!=0;
1626 }
1627
1628 /*
1629 ** If a field contains any character identified by a 1 in the following
1630 ** array, then the string must be quoted for CSV.
1631 */
@@ -1581,10 +1652,16 @@
1652 ** Encode text appropriately and append it to pOut.
1653 */
1654 static void qrfEncodeText(Qrf *p, sqlite3_str *pOut, const char *zTxt){
1655 int iStart = sqlite3_str_length(pOut);
1656 switch( p->spec.eText ){
1657 case QRF_TEXT_Relaxed:
1658 if( qrfRelaxable(p, zTxt) ){
1659 sqlite3_str_appendall(pOut, zTxt);
1660 break;
1661 }
1662 deliberate_fall_through; /* FALLTHRU */
1663 case QRF_TEXT_Sql: {
1664 if( p->spec.eEsc==QRF_ESC_Off ){
1665 sqlite3_str_appendf(pOut, "%Q", zTxt);
1666 }else{
1667 sqlite3_str_appendf(pOut, "%#Q", zTxt);
@@ -1739,10 +1816,57 @@
1816 return (const char*)sqlite3_column_text(p->pJTrans, 0);
1817 }else{
1818 return 0;
1819 }
1820 }
1821
1822 /*
1823 ** Adjust the input string zIn[] such that it is no more than N display
1824 ** characters wide. If it is wider than that, then truncate and add
1825 ** ellipsis. Or if zIn[] contains a \r or \n, truncate at that point,
1826 ** adding ellipsis. Embedded tabs in zIn[] are converted into ordinary
1827 ** spaces.
1828 **
1829 ** Return this display width of the modified title string.
1830 */
1831 static int qrfTitleLimit(char *zIn, int N){
1832 unsigned char *z = (unsigned char*)zIn;
1833 int n = 0;
1834 unsigned char *zEllipsis = 0;
1835 while( 1 /*exit-by-break*/ ){
1836 if( z[0]<' ' ){
1837 int k;
1838 if( z[0]==0 ){
1839 zEllipsis = 0;
1840 break;
1841 }else if( z[0]=='\033' && (k = qrfIsVt100(z))>0 ){
1842 z += k;
1843 }else if( z[0]=='\t' ){
1844 z[0] = ' ';
1845 }else if( z[0]=='\n' || z[0]=='\r' ){
1846 z[0] = ' ';
1847 }else{
1848 z++;
1849 }
1850 }else if( (0x80&z[0])==0 ){
1851 if( n>=(N-3) && zEllipsis==0 ) zEllipsis = z;
1852 if( n==N ){ z[0] = 0; break; }
1853 n++;
1854 z++;
1855 }else{
1856 int u = 0;
1857 int len = sqlite3_qrf_decode_utf8(z, &u);
1858 if( n+len>(N-3) && zEllipsis==0 ) zEllipsis = z;
1859 if( n+len>N ){ z[0] = 0; break; }
1860 z += len;
1861 n += sqlite3_qrf_wcwidth(u);
1862 }
1863 }
1864 if( zEllipsis && N>=3 ) memcpy(zEllipsis,"...",4);
1865 return n;
1866 }
1867
1868
1869 /*
1870 ** Render value pVal into pOut
1871 */
1872 static void qrfRenderValue(Qrf *p, sqlite3_str *pOut, int iCol){
@@ -2124,40 +2248,10 @@
2248 }
2249 }
2250 sqlite3_str_append(pOut, (const char*)z, i);
2251 }
2252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2253 /*
2254 ** GCC does not define the offsetof() macro so we'll have to do it
2255 ** ourselves.
2256 */
2257 #ifndef offsetof
@@ -2177,27 +2271,60 @@
2271 sqlite3_int64 nRow; /* Number of rows */
2272 sqlite3_int64 nAlloc; /* Number of cells allocated */
2273 sqlite3_int64 n; /* Number of cells. nCol*nRow */
2274 char **az; /* Content of all cells */
2275 int *aiWth; /* Width of each cell */
2276 unsigned char *abNum; /* True for each numeric cell */
2277 struct qrfPerCol { /* Per-column data */
2278 char *z; /* Cache of text for current row */
2279 int w; /* Computed width of this column */
2280 int mxW; /* Maximum natural (unwrapped) width */
2281 unsigned char e; /* Alignment */
2282 unsigned char fx; /* Width is fixed */
2283 unsigned char bNum; /* True if is numeric */
2284 } *a; /* One per column */
2285 };
2286
2287 /*
2288 ** Output horizontally justified text into pOut. The text is the
2289 ** first nVal bytes of zVal. Include nWS bytes of whitespace, either
2290 ** split between both sides, or on the left, or on the right, depending
2291 ** on eAlign.
2292 */
2293 static void qrfPrintAligned(
2294 sqlite3_str *pOut, /* Append text here */
2295 struct qrfPerCol *pCol, /* Information about the text to print */
2296 int nVal, /* Use only the first nVal bytes of zVal[] */
2297 int nWS /* Whitespace for horizonal alignment */
2298 ){
2299 unsigned char eAlign = pCol->e & QRF_ALIGN_HMASK;
2300 if( eAlign==QRF_Auto && pCol->bNum ) eAlign = QRF_ALIGN_Right;
2301 if( eAlign==QRF_ALIGN_Center ){
2302 /* Center the text */
2303 sqlite3_str_appendchar(pOut, nWS/2, ' ');
2304 qrfAppendWithTabs(pOut, pCol->z, nVal);
2305 sqlite3_str_appendchar(pOut, nWS - nWS/2, ' ');
2306 }else if( eAlign==QRF_ALIGN_Right ){
2307 /* Right justify the text */
2308 sqlite3_str_appendchar(pOut, nWS, ' ');
2309 qrfAppendWithTabs(pOut, pCol->z, nVal);
2310 }else{
2311 /* Left justify the text */
2312 qrfAppendWithTabs(pOut, pCol->z, nVal);
2313 sqlite3_str_appendchar(pOut, nWS, ' ');
2314 }
2315 }
2316
2317 /*
2318 ** Free all the memory allocates in the qrfColData object
2319 */
2320 static void qrfColDataFree(qrfColData *p){
2321 sqlite3_int64 i;
2322 for(i=0; i<p->n; i++) sqlite3_free(p->az[i]);
2323 sqlite3_free(p->az);
2324 sqlite3_free(p->aiWth);
2325 sqlite3_free(p->abNum);
2326 sqlite3_free(p->a);
2327 memset(p, 0, sizeof(*p));
2328 }
2329
2330 /*
@@ -2205,10 +2332,11 @@
2332 ** Return non-zero if a memory allocation fails.
2333 */
2334 static int qrfColDataEnlarge(qrfColData *p){
2335 char **azData;
2336 int *aiWth;
2337 unsigned char *abNum;
2338 p->nAlloc = 2*p->nAlloc + 10*p->nCol;
2339 azData = sqlite3_realloc64(p->az, p->nAlloc*sizeof(char*));
2340 if( azData==0 ){
2341 qrfOom(p->p);
2342 qrfColDataFree(p);
@@ -2220,26 +2348,38 @@
2348 qrfOom(p->p);
2349 qrfColDataFree(p);
2350 return 1;
2351 }
2352 p->aiWth = aiWth;
2353 abNum = sqlite3_realloc64(p->abNum, p->nAlloc);
2354 if( abNum==0 ){
2355 qrfOom(p->p);
2356 qrfColDataFree(p);
2357 return 1;
2358 }
2359 p->abNum = abNum;
2360 return 0;
2361 }
2362
2363 /*
2364 ** Print a markdown or table-style row separator using ascii-art
2365 */
2366 static void qrfRowSeparator(sqlite3_str *pOut, qrfColData *p, char cSep){
2367 int i;
2368 if( p->nCol>0 ){
2369 int useBorder = p->p->spec.bBorder!=QRF_No;
2370 if( useBorder ){
2371 sqlite3_str_append(pOut, &cSep, 1);
2372 }
2373 sqlite3_str_appendchar(pOut, p->a[0].w+p->nMargin, '-');
2374 for(i=1; i<p->nCol; i++){
2375 sqlite3_str_append(pOut, &cSep, 1);
2376 sqlite3_str_appendchar(pOut, p->a[i].w+p->nMargin, '-');
2377 }
2378 if( useBorder ){
2379 sqlite3_str_append(pOut, &cSep, 1);
2380 }
2381 }
2382 sqlite3_str_append(pOut, "\n", 1);
2383 }
2384
2385 /*
@@ -2265,24 +2405,37 @@
2405 #define BOX_134 "\342\224\244" /* U+2524 -| */
2406 #define BOX_234 "\342\224\254" /* U+252c -,- */
2407 #define BOX_124 "\342\224\264" /* U+2534 -'- */
2408 #define BOX_1234 "\342\224\274" /* U+253c -|- */
2409
2410 /* Rounded corners: */
2411 #define BOX_R12 "\342\225\260" /* U+2570 '- */
2412 #define BOX_R23 "\342\225\255" /* U+256d ,- */
2413 #define BOX_R34 "\342\225\256" /* U+256e -, */
2414 #define BOX_R14 "\342\225\257" /* U+256f -' */
2415
2416 /* Doubled horizontal lines: */
2417 #define DBL_24 "\342\225\220" /* U+2550 === */
2418 #define DBL_123 "\342\225\236" /* U+255e |= */
2419 #define DBL_134 "\342\225\241" /* U+2561 =| */
2420 #define DBL_1234 "\342\225\252" /* U+256a =|= */
2421
2422 /* Draw horizontal line N characters long using unicode box
2423 ** characters
2424 */
2425 static void qrfBoxLine(sqlite3_str *pOut, int N, int bDbl){
2426 const char *azDash[2] = {
2427 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24,
2428 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24
2429 };/* 0 1 2 3 4 5 6 7 8 9 */
2430 const int nDash = 30;
2431 N *= 3;
2432 while( N>nDash ){
2433 sqlite3_str_append(pOut, azDash[bDbl], nDash);
2434 N -= nDash;
2435 }
2436 sqlite3_str_append(pOut, azDash[bDbl], N);
2437 }
2438
2439 /*
2440 ** Draw a horizontal separator for a QRF_STYLE_Box table.
2441 */
@@ -2289,21 +2442,27 @@
2442 static void qrfBoxSeparator(
2443 sqlite3_str *pOut,
2444 qrfColData *p,
2445 const char *zSep1,
2446 const char *zSep2,
2447 const char *zSep3,
2448 int bDbl
2449 ){
2450 int i;
2451 if( p->nCol>0 ){
2452 int useBorder = p->p->spec.bBorder!=QRF_No;
2453 if( useBorder ){
2454 sqlite3_str_appendall(pOut, zSep1);
2455 }
2456 qrfBoxLine(pOut, p->a[0].w+p->nMargin, bDbl);
2457 for(i=1; i<p->nCol; i++){
2458 sqlite3_str_appendall(pOut, zSep2);
2459 qrfBoxLine(pOut, p->a[i].w+p->nMargin, bDbl);
2460 }
2461 if( useBorder ){
2462 sqlite3_str_appendall(pOut, zSep3);
2463 }
2464 }
2465 sqlite3_str_append(pOut, "\n", 1);
2466 }
2467
2468 /*
@@ -2382,10 +2541,11 @@
2541 static void qrfSplitColumn(qrfColData *pData, Qrf *p){
2542 int nCol = 1;
2543 int *aw = 0;
2544 char **az = 0;
2545 int *aiWth = 0;
2546 unsigned char *abNum = 0;
2547 int nColNext = 2;
2548 int w;
2549 struct qrfPerCol *a = 0;
2550 sqlite3_int64 nRow = 1;
2551 sqlite3_int64 i;
@@ -2419,35 +2579,47 @@
2579 if( a==0 ){
2580 sqlite3_free(az);
2581 sqlite3_free(aiWth);
2582 qrfOom(p);
2583 return;
2584 }
2585 abNum = sqlite3_malloc64( nRow*nCol );
2586 if( abNum==0 ){
2587 sqlite3_free(az);
2588 sqlite3_free(aiWth);
2589 sqlite3_free(a);
2590 qrfOom(p);
2591 return;
2592 }
2593 for(i=0; i<pData->n; i++){
2594 sqlite3_int64 j = (i%nRow)*nCol + (i/nRow);
2595 az[j] = pData->az[i];
2596 abNum[j]= pData->abNum[i];
2597 pData->az[i] = 0;
2598 aiWth[j] = pData->aiWth[i];
2599 }
2600 while( i<nRow*nCol ){
2601 sqlite3_int64 j = (i%nRow)*nCol + (i/nRow);
2602 az[j] = sqlite3_mprintf("");
2603 if( az[j]==0 ) qrfOom(p);
2604 aiWth[j] = 0;
2605 abNum[j] = 0;
2606 i++;
2607 }
2608 for(i=0; i<nCol; i++){
2609 a[i].fx = a[i].mxW = a[i].w = aw[i];
2610 a[i].e = pData->a[0].e;
2611 }
2612 sqlite3_free(pData->az);
2613 sqlite3_free(pData->aiWth);
2614 sqlite3_free(pData->a);
2615 sqlite3_free(pData->abNum);
2616 sqlite3_free(aw);
2617 pData->az = az;
2618 pData->aiWth = aiWth;
2619 pData->a = a;
2620 pData->abNum = abNum;
2621 pData->nCol = nCol;
2622 pData->n = pData->nAlloc = nRow*nCol;
2623 for(i=w=0; i<nCol; i++) w += a[i].w;
2624 pData->nMargin = (p->spec.nScreenWidth - w)/(nCol - 1);
2625 if( pData->nMargin>5 ) pData->nMargin = 5;
@@ -2467,10 +2639,11 @@
2639 if( p->spec.nScreenWidth==0 ) return;
2640 if( p->spec.eStyle==QRF_STYLE_Column ){
2641 sepW = pData->nCol*2 - 2;
2642 }else{
2643 sepW = pData->nCol*3 + 1;
2644 if( p->spec.bBorder==QRF_No ) sepW -= 2;
2645 }
2646 nCol = pData->nCol;
2647 for(i=sumW=0; i<nCol; i++) sumW += pData->a[i].w;
2648 if( p->spec.nScreenWidth >= sumW+sepW ) return;
2649
@@ -2478,10 +2651,11 @@
2651 pData->nMargin = 0;
2652 if( p->spec.eStyle==QRF_STYLE_Column ){
2653 sepW = pData->nCol - 1;
2654 }else{
2655 sepW = pData->nCol + 1;
2656 if( p->spec.bBorder==QRF_No ) sepW -= 2;
2657 }
2658 targetW = p->spec.nScreenWidth - sepW;
2659
2660 #define MIN_SQUOZE 8
2661 #define MIN_EX_SQUOZE 16
@@ -2550,10 +2724,11 @@
2724 }
2725
2726 /* Initialize the data container */
2727 memset(&data, 0, sizeof(data));
2728 data.nCol = p->nCol;
2729 data.p = p;
2730 data.a = sqlite3_malloc64( nColumn*sizeof(struct qrfPerCol) );
2731 if( data.a==0 ){
2732 qrfOom(p);
2733 return;
2734 }
@@ -2563,19 +2738,27 @@
2738
2739 /* Load the column header names and all cell content into data */
2740 if( p->spec.bTitles==QRF_Yes ){
2741 unsigned char saved_eText = p->spec.eText;
2742 p->spec.eText = p->spec.eTitle;
2743 memset(data.abNum, 0, nColumn);
2744 for(i=0; i<nColumn; i++){
2745 const char *z = (const char*)sqlite3_column_name(p->pStmt,i);
2746 int nNL = 0;
2747 int n, w;
2748 pStr = sqlite3_str_new(p->db);
2749 qrfEncodeText(p, pStr, z ? z : "");
2750 n = sqlite3_str_length(pStr);
2751 qrfStrErr(p, pStr);
2752 z = data.az[data.n] = sqlite3_str_finish(pStr);
2753 if( p->spec.nTitleLimit ){
2754 nNL = 0;
2755 data.aiWth[data.n] = w = qrfTitleLimit(data.az[data.n],
2756 p->spec.nTitleLimit );
2757 }else{
2758 data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
2759 }
2760 data.n++;
2761 if( w>data.a[i].mxW ) data.a[i].mxW = w;
2762 if( nNL ) data.bMultiRow = 1;
2763 }
2764 p->spec.eText = saved_eText;
@@ -2587,14 +2770,17 @@
2770 }
2771 for(i=0; i<nColumn; i++){
2772 char *z;
2773 int nNL = 0;
2774 int n, w;
2775 int eType = sqlite3_column_type(p->pStmt,i);
2776 pStr = sqlite3_str_new(p->db);
2777 qrfRenderValue(p, pStr, i);
2778 n = sqlite3_str_length(pStr);
2779 qrfStrErr(p, pStr);
2780 z = data.az[data.n] = sqlite3_str_finish(pStr);
2781 data.abNum[data.n] = eType==SQLITE_INTEGER || eType==SQLITE_FLOAT;
2782 data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
2783 data.n++;
2784 if( w>data.a[i].mxW ) data.a[i].mxW = w;
2785 if( nNL ) data.bMultiRow = 1;
2786 }
@@ -2680,11 +2866,16 @@
2866 }else{
2867 rowStart = BOX_13;
2868 colSep = BOX_13;
2869 rowSep = BOX_13 "\n";
2870 }
2871 if( p->spec.bBorder==QRF_No){
2872 rowStart += 3;
2873 rowSep = "\n";
2874 }else{
2875 qrfBoxSeparator(p->pOut, &data, BOX_R23, BOX_234, BOX_R34, 0);
2876 }
2877 break;
2878 case QRF_STYLE_Table:
2879 if( data.nMargin ){
2880 rowStart = "| ";
2881 colSep = " | ";
@@ -2692,11 +2883,16 @@
2883 }else{
2884 rowStart = "|";
2885 colSep = "|";
2886 rowSep = "|\n";
2887 }
2888 if( p->spec.bBorder==QRF_No ){
2889 rowStart += 1;
2890 rowSep = "\n";
2891 }else{
2892 qrfRowSeparator(p->pOut, &data, '+');
2893 }
2894 break;
2895 case QRF_STYLE_Column: {
2896 static const char zSpace[] = " ";
2897 rowStart = "";
2898 if( data.nMargin<2 ){
@@ -2724,20 +2920,32 @@
2920 szRowStart = (int)strlen(rowStart);
2921 szRowSep = (int)strlen(rowSep);
2922 szColSep = (int)strlen(colSep);
2923
2924 bWW = (p->spec.bWordWrap==QRF_Yes && data.bMultiRow);
2925 if( p->spec.eStyle==QRF_STYLE_Column
2926 || (p->spec.bBorder==QRF_No
2927 && (p->spec.eStyle==QRF_STYLE_Box || p->spec.eStyle==QRF_STYLE_Table)
2928 )
2929 ){
2930 bRTrim = 1;
2931 }else{
2932 bRTrim = 0;
2933 }
2934 for(i=0; i<data.n && sqlite3_str_errcode(p->pOut)==SQLITE_OK; i+=nColumn){
2935 int bMore;
2936 int nRow = 0;
2937
2938 /* Draw a single row of the table. This might be the title line
2939 ** (if there is a title line) or a row in the body of the table.
2940 ** The column number will be j. The row number is i/nColumn.
2941 */
2942 for(j=0; j<nColumn; j++){
2943 data.a[j].z = data.az[i+j];
2944 if( data.a[j].z==0 ) data.a[j].z = "";
2945 data.a[j].bNum = data.abNum[i+j];
2946 }
2947 do{
2948 sqlite3_str_append(p->pOut, rowStart, szRowStart);
2949 bMore = 0;
2950 for(j=0; j<nColumn; j++){
2951 int nThis = 0;
@@ -2744,11 +2952,11 @@
2952 int nWide = 0;
2953 int iNext = 0;
2954 int nWS;
2955 qrfWrapLine(data.a[j].z, data.a[j].w, bWW, &nThis, &nWide, &iNext);
2956 nWS = data.a[j].w - nWide;
2957 qrfPrintAligned(p->pOut, &data.a[j], nThis, nWS);
2958 data.a[j].z += iNext;
2959 if( data.a[j].z[0]!=0 ){
2960 bMore = 1;
2961 }
2962 if( j<nColumn-1 ){
@@ -2766,11 +2974,12 @@
2974 if( data.a[j].z[0]==0 ){
2975 sqlite3_str_appendchar(p->pOut, data.a[j].w, ' ');
2976 }else{
2977 int nE = 3;
2978 if( nE>data.a[j].w ) nE = data.a[j].w;
2979 data.a[j].z = "...";
2980 qrfPrintAligned(p->pOut, &data.a[j], nE, data.a[j].w-nE);
2981 }
2982 if( j<nColumn-1 ){
2983 sqlite3_str_append(p->pOut, colSep, szColSep);
2984 }else{
2985 if( bRTrim ) qrfRTrim(p->pOut);
@@ -2794,12 +3003,14 @@
3003 qrfRowSeparator(p->pOut, &data, '+');
3004 }
3005 break;
3006 }
3007 case QRF_STYLE_Box: {
3008 if( isTitleDataSeparator ){
3009 qrfBoxSeparator(p->pOut, &data, DBL_123, DBL_1234, DBL_134, 1);
3010 }else if( data.bMultiRow ){
3011 qrfBoxSeparator(p->pOut, &data, BOX_123, BOX_1234, BOX_134, 0);
3012 }
3013 break;
3014 }
3015 case QRF_STYLE_Markdown: {
3016 if( isTitleDataSeparator ){
@@ -2827,17 +3038,19 @@
3038 }
3039 }
3040 }
3041
3042 /* Draw the line across the bottom of the table */
3043 if( p->spec.bBorder!=QRF_No ){
3044 switch( p->spec.eStyle ){
3045 case QRF_STYLE_Box:
3046 qrfBoxSeparator(p->pOut, &data, BOX_R12, BOX_124, BOX_R14, 0);
3047 break;
3048 case QRF_STYLE_Table:
3049 qrfRowSeparator(p->pOut, &data, '+');
3050 break;
3051 }
3052 }
3053 qrfWrite(p);
3054
3055 qrfColDataFree(&data);
3056 return;
@@ -2903,11 +3116,11 @@
3116 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 0), "addr" ) );
3117 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 1), "opcode" ) );
3118 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 2), "p1" ) );
3119 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 3), "p2" ) );
3120
3121 for(iOp=0; SQLITE_ROW==sqlite3_step(p->pStmt) && !p->iErr; iOp++){
3122 int iAddr = sqlite3_column_int(p->pStmt, 0);
3123 const char *zOp = (const char*)sqlite3_column_text(p->pStmt, 1);
3124 int p1 = sqlite3_column_int(p->pStmt, 2);
3125 int p2 = sqlite3_column_int(p->pStmt, 3);
3126
@@ -2960,11 +3173,11 @@
3173 nWidth = sizeof(aScanExpWidth)/sizeof(int);
3174 iIndent = 3;
3175 }
3176 if( nArg>nWidth ) nArg = nWidth;
3177
3178 for(iOp=0; sqlite3_step(p->pStmt)==SQLITE_ROW && !p->iErr; iOp++){
3179 /* If this is the first row seen, print out the headers */
3180 if( iOp==0 ){
3181 for(i=0; i<nArg; i++){
3182 const char *zCol = sqlite3_column_name(p->pStmt, aMap[i]);
3183 qrfWidthPrint(p,p->pOut, aWidth[i], zCol);
@@ -2989,11 +3202,11 @@
3202 int w = aWidth[i];
3203 const char *zVal = (const char*)sqlite3_column_text(p->pStmt, aMap[i]);
3204 int len;
3205 if( i==nArg-1 ) w = 0;
3206 if( zVal==0 ) zVal = "";
3207 len = (int)sqlite3_qrf_wcswidth(zVal);
3208 if( len>w ){
3209 w = len;
3210 zSep = " ";
3211 }
3212 if( i==iIndent && aiIndent && iOp<nIndent ){
@@ -3168,34 +3381,40 @@
3381 }
3382 case QRF_STYLE_Line: {
3383 sqlite3_str *pVal;
3384 int mxW;
3385 int bWW;
3386 int nSep;
3387 if( p->u.sLine.azCol==0 ){
3388 p->u.sLine.azCol = sqlite3_malloc64( p->nCol*sizeof(char*) );
3389 if( p->u.sLine.azCol==0 ){
3390 qrfOom(p);
3391 break;
3392 }
3393 p->u.sLine.mxColWth = 0;
3394 for(i=0; i<p->nCol; i++){
3395 int sz;
3396 const char *zCName = sqlite3_column_name(p->pStmt, i);
3397 if( zCName==0 ) zCName = "unknown";
3398 p->u.sLine.azCol[i] = sqlite3_mprintf("%s", zCName);
3399 if( p->spec.nTitleLimit>0 ){
3400 (void)qrfTitleLimit(p->u.sLine.azCol[i], p->spec.nTitleLimit);
3401 }
3402 sz = (int)sqlite3_qrf_wcswidth(p->u.sLine.azCol[i]);
3403 if( sz > p->u.sLine.mxColWth ) p->u.sLine.mxColWth = sz;
3404 }
3405 }
3406 if( p->nRow ) sqlite3_str_append(p->pOut, "\n", 1);
3407 pVal = sqlite3_str_new(p->db);
3408 nSep = (int)strlen(p->spec.zColumnSep);
3409 mxW = p->mxWidth - (nSep + p->u.sLine.mxColWth);
3410 bWW = p->spec.bWordWrap==QRF_Yes;
3411 for(i=0; i<p->nCol; i++){
3412 const char *zVal;
3413 int cnt = 0;
3414 qrfWidthPrint(p, p->pOut, -p->u.sLine.mxColWth, p->u.sLine.azCol[i]);
3415 sqlite3_str_append(p->pOut, p->spec.zColumnSep, nSep);
3416 qrfRenderValue(p, pVal, i);
3417 zVal = sqlite3_str_value(pVal);
3418 if( zVal==0 ) zVal = "";
3419 do{
3420 int nThis, nWide, iNext;
@@ -3210,10 +3429,11 @@
3429 sqlite3_str_append(p->pOut, "\n", 1);
3430 zVal += iNext;
3431 }while( zVal[0] );
3432 sqlite3_str_reset(pVal);
3433 }
3434 qrfStrErr(p, pVal);
3435 sqlite3_free(sqlite3_str_finish(pVal));
3436 qrfWrite(p);
3437 break;
3438 }
3439 case QRF_STYLE_Eqp: {
@@ -3273,11 +3493,11 @@
3493 p->pOut = sqlite3_str_new(p->db);
3494 if( p->pOut==0 ){
3495 qrfOom(p);
3496 return;
3497 }
3498 p->iErr = SQLITE_OK;
3499 p->nCol = sqlite3_column_count(p->pStmt);
3500 p->nRow = 0;
3501 sz = sizeof(sqlite3_qrf_spec);
3502 memcpy(&p->spec, pSpec, sz);
3503 if( p->spec.zNull==0 ) p->spec.zNull = "";
@@ -3285,12 +3505,12 @@
3505 if( p->mxWidth<=0 ) p->mxWidth = QRF_MAX_WIDTH;
3506 p->mxHeight = p->spec.nLineLimit;
3507 if( p->mxHeight<=0 ) p->mxHeight = 2147483647;
3508 if( p->spec.eStyle>QRF_STYLE_Table ) p->spec.eStyle = QRF_Auto;
3509 if( p->spec.eEsc>QRF_ESC_Symbol ) p->spec.eEsc = QRF_Auto;
3510 if( p->spec.eText>QRF_TEXT_Relaxed ) p->spec.eText = QRF_Auto;
3511 if( p->spec.eTitle>QRF_TEXT_Relaxed ) p->spec.eTitle = QRF_Auto;
3512 if( p->spec.eBlob>QRF_BLOB_Size ) p->spec.eBlob = QRF_Auto;
3513 qrf_reinit:
3514 switch( p->spec.eStyle ){
3515 case QRF_Auto: {
3516 switch( sqlite3_stmt_isexplain(pStmt) ){
@@ -3321,10 +3541,16 @@
3541 p->spec.zNull = "NULL";
3542 if( p->spec.zTableName==0 || p->spec.zTableName[0]==0 ){
3543 p->spec.zTableName = "tab";
3544 }
3545 break;
3546 }
3547 case QRF_STYLE_Line: {
3548 if( p->spec.zColumnSep==0 ){
3549 p->spec.zColumnSep = ": ";
3550 }
3551 break;
3552 }
3553 case QRF_STYLE_Csv: {
3554 p->spec.eStyle = QRF_STYLE_List;
3555 p->spec.eText = QRF_TEXT_Csv;
3556 p->spec.zColumnSep = ",";
@@ -3430,11 +3656,15 @@
3656 qrfWrite(p);
3657 }
3658 break;
3659 }
3660 case QRF_STYLE_Line: {
3661 if( p->u.sLine.azCol ){
3662 int i;
3663 for(i=0; i<p->nCol; i++) sqlite3_free(p->u.sLine.azCol[i]);
3664 sqlite3_free(p->u.sLine.azCol);
3665 }
3666 break;
3667 }
3668 case QRF_STYLE_Stats:
3669 case QRF_STYLE_StatsEst:
3670 case QRF_STYLE_Eqp: {
@@ -3441,10 +3671,11 @@
3671 qrfEqpRender(p, 0);
3672 qrfWrite(p);
3673 break;
3674 }
3675 }
3676 qrfStrErr(p, p->pOut);
3677 if( p->spec.pzOutput ){
3678 if( p->spec.pzOutput[0] ){
3679 sqlite3_int64 n, sz;
3680 char *zCombined;
3681 sz = strlen(p->spec.pzOutput[0]);
@@ -3624,11 +3855,11 @@
3855
3856 /* Return the current wall-clock time in microseconds since the
3857 ** Unix epoch (1970-01-01T00:00:00Z)
3858 */
3859 static sqlite3_int64 timeOfDay(void){
3860 #if defined(_WIN64) && _WIN32_WINNT >= _WIN32_WINNT_WIN8
3861 sqlite3_uint64 t;
3862 FILETIME tm;
3863 GetSystemTimePreciseAsFileTime(&tm);
3864 t = ((u64)tm.dwHighDateTime<<32) | (u64)tm.dwLowDateTime;
3865 t += 116444736000000000LL;
@@ -3724,11 +3955,10 @@
3955 */
3956 static int hasTimer(void){
3957 if( getProcessTimesAddr ){
3958 return 1;
3959 } else {
 
3960 /* GetProcessTimes() isn't supported in WIN95 and some other Windows
3961 ** versions. See if the version we are running on has it, and if it
3962 ** does, save off a pointer to it and the current process handle.
3963 */
3964 hProcess = GetCurrentProcess();
@@ -3741,11 +3971,10 @@
3971 return 1;
3972 }
3973 FreeLibrary(hinstLib);
3974 }
3975 }
 
3976 }
3977 return 0;
3978 }
3979
3980 /*
@@ -3860,10 +4089,18 @@
4089 #define PROMPT_LEN_MAX 128
4090 /* First line prompt. default: "sqlite> " */
4091 static char mainPrompt[PROMPT_LEN_MAX];
4092 /* Continuation prompt. default: " ...> " */
4093 static char continuePrompt[PROMPT_LEN_MAX];
4094
4095 /*
4096 ** Write I/O traces to the following stream.
4097 */
4098 #ifdef SQLITE_ENABLE_IOTRACE
4099 static FILE *iotrace = 0;
4100 #endif
4101
4102
4103 /* This is variant of the standard-library strncpy() routine with the
4104 ** one change that the destination string is always zero-terminated, even
4105 ** if there is no zero-terminator in the first n-1 characters of the source
4106 ** string.
@@ -3980,17 +4217,10 @@
4217 */
4218 static void shell_check_oom(const void *p){
4219 if( p==0 ) shell_out_of_memory();
4220 }
4221
 
 
 
 
 
 
 
4222 /*
4223 ** This routine works like printf in that its first argument is a
4224 ** format string and subsequent arguments are values to be substituted
4225 ** in place of % fields. The result of formatting this string
4226 ** is written to iotrace.
@@ -6013,17 +6243,20 @@
6243 }
6244 /* End of the hashing logic
6245 *****************************************************************************/
6246
6247 /*
6248 ** Two SQL functions: sha1(X) and sha1b(X).
6249 **
6250 ** sha1(X) returns a lower-case hexadecimal rendering of the SHA1 hash
6251 ** of the argument X. If X is a BLOB, it is hashed as is. For all other
6252 ** types of input, X is converted into a UTF-8 string and the string
6253 ** is hashed without the trailing 0x00 terminator. The hash of a NULL
6254 ** value is NULL.
6255 **
6256 ** sha1b(X) is the same except that it returns a 20-byte BLOB containing
6257 ** the binary hash instead of a hexadecimal string.
6258 */
6259 static void sha1Func(
6260 sqlite3_context *context,
6261 int argc,
6262 sqlite3_value **argv
@@ -6040,15 +6273,17 @@
6273 hash_step(&cx, sqlite3_value_blob(argv[0]), nByte);
6274 }else{
6275 hash_step(&cx, sqlite3_value_text(argv[0]), nByte);
6276 }
6277 if( sqlite3_user_data(context)!=0 ){
6278 /* sha1b() - binary result */
6279 hash_finish(&cx, zOut, 1);
6280 sqlite3_result_blob(context, zOut, 20, SQLITE_TRANSIENT);
6281 }else{
6282 /* sha1() - hexadecimal text result */
6283 hash_finish(&cx, zOut, 0);
6284 sqlite3_result_text(context, zOut, 40, SQLITE_TRANSIENT);
6285 }
6286 }
6287
6288 /*
6289 ** Implementation of the sha1_query(SQL) function.
@@ -8136,13 +8371,13 @@
8371 }else if( e<-10000 ){
8372 e = -10000;
8373 }
8374
8375 if( m<0 ){
8376 if( m<(-9223372036854775807LL) ) return;
8377 isNeg = 1;
8378 m = -m;
 
8379 }else if( m==0 && e>-1000 && e<1000 ){
8380 sqlite3_result_double(context, 0.0);
8381 return;
8382 }
8383 while( (m>>32)&0xffe00000 ){
@@ -9259,11 +9494,11 @@
9494 ** (X) match X
9495 ** X|Y X or Y
9496 ** ^X X occurring at the beginning of the string
9497 ** X$ X occurring at the end of the string
9498 ** . Match any single character
9499 ** \c Character c where c is one of \{}()[]|*+?-.
9500 ** \c C-language escapes for c in afnrtv. ex: \t or \n
9501 ** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX
9502 ** \xXX Where XX is exactly 2 hex digits, unicode value XX
9503 ** [abc] Any single character from the set abc
9504 ** [^abc] Any single character not in the set abc
@@ -9644,11 +9879,11 @@
9879
9880 /* A backslash character has been seen, read the next character and
9881 ** return its interpretation.
9882 */
9883 static unsigned re_esc_char(ReCompiled *p){
9884 static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]-";
9885 static const char zTrans[] = "\a\f\n\r\t\v";
9886 int i, v = 0;
9887 char c;
9888 if( p->sIn.i>=p->sIn.mx ) return 0;
9889 c = p->sIn.z[p->sIn.i];
@@ -9967,15 +10202,22 @@
10202 }
10203 return pRe->zErr;
10204 }
10205
10206 /*
10207 ** The value of LIMIT_MAX_PATTERN_LENGTH.
10208 */
10209 static int re_maxlen(sqlite3_context *context){
10210 sqlite3 *db = sqlite3_context_db_handle(context);
10211 return sqlite3_limit(db, SQLITE_LIMIT_LIKE_PATTERN_LENGTH,-1);
10212 }
10213
10214 /*
10215 ** Maximum NFA size given a maximum pattern length.
10216 */
10217 static int re_maxnfa(int mxlen){
10218 return 75+mxlen/2;
10219 }
10220
10221 /*
10222 ** Implementation of the regexp() SQL function. This function implements
10223 ** the build-in REGEXP operator. The first argument to the function is the
@@ -9997,14 +10239,21 @@
10239 int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
10240
10241 (void)argc; /* Unused */
10242 pRe = sqlite3_get_auxdata(context, 0);
10243 if( pRe==0 ){
10244 int mxLen = re_maxlen(context);
10245 int nPattern;
10246 zPattern = (const char*)sqlite3_value_text(argv[0]);
10247 if( zPattern==0 ) return;
10248 nPattern = sqlite3_value_bytes(argv[0]);
10249 if( nPattern>mxLen ){
10250 zErr = "REGEXP pattern too big";
10251 }else{
10252 zErr = re_compile(&pRe, zPattern, re_maxnfa(mxLen),
10253 sqlite3_user_data(context)!=0);
10254 }
10255 if( zErr ){
10256 re_free(pRe);
10257 sqlite3_result_error(context, zErr, -1);
10258 return;
10259 }
@@ -10066,11 +10315,11 @@
10315 "ATSTART",
10316 };
10317
10318 zPattern = (const char*)sqlite3_value_text(argv[0]);
10319 if( zPattern==0 ) return;
10320 zErr = re_compile(&pRe, zPattern, re_maxnfa(re_maxlen(context)),
10321 sqlite3_user_data(context)!=0);
10322 if( zErr ){
10323 re_free(pRe);
10324 sqlite3_result_error(context, zErr, -1);
10325 return;
@@ -10474,10 +10723,11 @@
10723 if( b1==0 ) return 1;
10724 sz = MultiByteToWideChar(CP_UTF8, 0, zPath, sz, b1, sz);
10725 b1[sz] = 0;
10726 rc = _wstat(b1, pStatBuf);
10727 if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
10728 sqlite3_free(b1);
10729 return rc;
10730 #else
10731 return stat(zPath, pStatBuf);
10732 #endif
10733 }
@@ -10604,11 +10854,10 @@
10854 }
10855 }
10856
10857 if( mtime>=0 ){
10858 #if defined(_WIN32)
 
10859 /* Windows */
10860 FILETIME lastAccess;
10861 FILETIME lastWrite;
10862 SYSTEMTIME currentTime;
10863 LONGLONG intervals;
@@ -10635,11 +10884,10 @@
10884 CloseHandle(hFile);
10885 return !bResult;
10886 }else{
10887 return 1;
10888 }
 
10889 #elif defined(AT_FDCWD) && 0 /* utimensat() is not universally available */
10890 /* Recent unix */
10891 struct timespec times[2];
10892 times[0].tv_nsec = times[1].tv_nsec = 0;
10893 times[0].tv_sec = time(0);
@@ -13337,11 +13585,11 @@
13585 rc = zipfileReadData(
13586 pFile, aRead, nExtra+nFile, iOff+ZIPFILE_CDS_FIXED_SZ, pzErr
13587 );
13588 }else{
13589 aRead = (u8*)&aBlob[iOff + ZIPFILE_CDS_FIXED_SZ];
13590 if( (iOff + ZIPFILE_CDS_FIXED_SZ + nFile + nExtra)>nBlob ){
13591 rc = zipfileCorrupt(pzErr);
13592 }
13593 }
13594 }
13595
@@ -13362,15 +13610,16 @@
13610 ZipfileLFH lfh;
13611 if( pFile ){
13612 rc = zipfileReadData(pFile, aRead, szFix, pNew->cds.iOffset, pzErr);
13613 }else{
13614 aRead = (u8*)&aBlob[pNew->cds.iOffset];
13615 if( (pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ)>(unsigned)nBlob ){
13616 rc = zipfileCorrupt(pzErr);
13617 }
13618 }
13619
13620 memset(&lfh, 0, sizeof(lfh));
13621 if( rc==SQLITE_OK ) rc = zipfileReadLFH(aRead, &lfh);
13622 if( rc==SQLITE_OK ){
13623 pNew->iDataOff = pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ;
13624 pNew->iDataOff += lfh.nFile + lfh.nExtra;
13625 if( aBlob && pNew->cds.szCompressed ){
@@ -13470,11 +13719,11 @@
13719 }else{
13720 err = inflate(&str, Z_NO_FLUSH);
13721 if( err!=Z_STREAM_END ){
13722 zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
13723 }else{
13724 sqlite3_result_blob(pCtx, aRes, (int)str.total_out, zipfileFree);
13725 aRes = 0;
13726 }
13727 }
13728 sqlite3_free(aRes);
13729 inflateEnd(&str);
@@ -23948,28 +24197,28 @@
24197 u8 autoExplain; /* Automatically turn on .explain mode */
24198 u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to each SQL stmt */
24199 u8 autoEQPtrace; /* autoEQP is in trace mode */
24200 u8 scanstatsOn; /* True to display scan stats before each finalize */
24201 u8 bAutoScreenWidth; /* Using the TTY to determine screen width */
24202 u8 mFlags; /* MFLG_ECHO, MFLG_CRLF, etc. */
24203 u8 eMode; /* One of the MODE_ values */
24204 sqlite3_qrf_spec spec; /* Spec to be passed into QRF */
24205 } Mode;
24206
24207 /* Flags for Mode.mFlags */
24208 #define MFLG_ECHO 0x01 /* Echo inputs to output */
24209 #define MFLG_CRLF 0x02 /* Use CR/LF output line endings */
24210 #define MFLG_HDR 0x04 /* .header used to change headers on/off */
24211
24212
24213 /*
24214 ** State information about the database connection is contained in an
24215 ** instance of the following structure.
24216 */
24217 typedef struct ShellState ShellState;
24218 struct ShellState {
24219 sqlite3 *db; /* The database */
 
24220 u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
24221 u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
24222 u8 nEqpLevel; /* Depth of the EQP output graph */
24223 u8 eTraceType; /* SHELL_TRACE_* value for type of trace */
24224 u8 bSafeMode; /* True to prohibit unsafe operations */
@@ -24078,11 +24327,11 @@
24327
24328 /* Names of values for Mode.spec.eEsc and Mode.spec.eText
24329 */
24330 static const char *qrfEscNames[] = { "auto", "off", "ascii", "symbol" };
24331 static const char *qrfQuoteNames[] =
24332 { "off","off","sql","hex","csv","tcl","json","relaxed"};
24333
24334 /*
24335 ** These are the allowed shellFlgs values
24336 */
24337 #define SHFLG_Pagecache 0x00000001 /* The --pagecache option is used */
@@ -24120,19 +24369,20 @@
24369 #define MODE_Json 10 /* Output JSON */
24370 #define MODE_Line 11 /* One column per line. Blank line between records */
24371 #define MODE_List 12 /* One record per line with a separator */
24372 #define MODE_Markdown 13 /* Markdown formatting */
24373 #define MODE_Off 14 /* No query output shown */
24374 #define MODE_Psql 15 /* Similar to psql */
24375 #define MODE_QBox 16 /* BOX with SQL-quoted content */
24376 #define MODE_Quote 17 /* Quote values as for SQL */
24377 #define MODE_Split 18 /* Split-column mode */
24378 #define MODE_Table 19 /* MySQL-style table formatting */
24379 #define MODE_Tabs 20 /* Tab-separated values */
24380 #define MODE_Tcl 21 /* Space-separated list of TCL strings */
24381 #define MODE_Www 22 /* Full web-page output */
24382
24383 #define MODE_BUILTIN 22 /* Maximum built-in mode */
24384 #define MODE_BATCH 50 /* Default mode for batch processing */
24385 #define MODE_TTY 51 /* Default mode for interactive processing */
24386 #define MODE_USER 75 /* First user-defined mode */
24387 #define MODE_N_USER 25 /* Maximum number of user-defined modes */
24388
@@ -24149,43 +24399,45 @@
24399 unsigned char eHdr; /* Default header encoding. */
24400 unsigned char eBlob; /* Default blob encoding. */
24401 unsigned char bHdr; /* Show headers by default. 0: n/a, 1: no 2: yes */
24402 unsigned char eStyle; /* Underlying QRF style */
24403 unsigned char eCx; /* 0: other, 1: line, 2: columnar */
24404 unsigned char mFlg; /* Flags. 1=border-off 2=split-column */
24405 };
24406
24407 /* String constants used by built-in modes */
24408 static const char *aModeStr[] =
24409 /* 0 1 2 3 4 5 6 7 8 */
24410 { 0, "\n", "|", " ", ",", "\r\n", "\036", "\037", "\t",
24411 "", "NULL", "null", "\"\"", ": ", };
24412 /* 9 10 11 12 13 */
24413
24414 static const ModeInfo aModeInfo[] = {
24415 /* zName eCSep eRSep eNull eText eHdr eBlob bHdr eStyle eCx mFlg */
24416 { "ascii", 7, 6, 9, 1, 1, 0, 1, 12, 0, 0 },
24417 { "box", 0, 0, 9, 1, 1, 0, 2, 1, 2, 0 },
24418 { "c", 4, 1, 10, 5, 5, 4, 1, 12, 0, 0 },
24419 { "column", 0, 0, 9, 1, 1, 0, 2, 2, 2, 0 },
24420 { "count", 0, 0, 0, 0, 0, 0, 0, 3, 0, 0 },
24421 { "csv", 4, 5, 9, 3, 3, 0, 1, 12, 0, 0 },
24422 { "html", 0, 0, 9, 4, 4, 0, 2, 7, 0, 0 },
24423 { "insert", 0, 0, 10, 2, 2, 0, 1, 8, 0, 0 },
24424 { "jatom", 4, 1, 11, 6, 6, 0, 1, 12, 0, 0 },
24425 { "jobject", 0, 1, 11, 6, 6, 0, 0, 10, 0, 0 },
24426 { "json", 0, 0, 11, 6, 6, 0, 0, 9, 0, 0 },
24427 { "line", 13, 1, 9, 1, 1, 0, 0, 11, 1, 0 },
24428 { "list", 2, 1, 9, 1, 1, 0, 1, 12, 0, 0 },
24429 { "markdown", 0, 0, 9, 1, 1, 0, 2, 13, 2, 0 },
24430 { "off", 0, 0, 0, 0, 0, 0, 0, 14, 0, 0 },
24431 { "psql", 0, 0, 9, 1, 1, 0, 2, 19, 2, 1 },
24432 { "qbox", 0, 0, 10, 2, 1, 0, 2, 1, 2, 0 },
24433 { "quote", 4, 1, 10, 2, 2, 0, 1, 12, 0, 0 },
24434 { "split", 0, 0, 9, 1, 1, 0, 1, 2, 2, 2 },
24435 { "table", 0, 0, 9, 1, 1, 0, 2, 19, 2, 0 },
24436 { "tabs", 8, 1, 9, 3, 3, 0, 1, 12, 0, 0 },
24437 { "tcl", 3, 1, 12, 5, 5, 4, 1, 12, 0, 0 },
24438 { "www", 0, 0, 9, 4, 4, 0, 2, 7, 0, 0 }
24439 }; /* | / / | / / | | \
24440 ** | / / | / / | | \_ 2: columnar
24441 ** Index into aModeStr[] | / / | | 1: line
24442 ** | / / | | 0: other
24443 ** | / / | \
@@ -24212,10 +24464,23 @@
24464 #define SEP_Comma ","
24465 #define SEP_CrLf "\r\n"
24466 #define SEP_Unit "\x1F"
24467 #define SEP_Record "\x1E"
24468
24469 /*
24470 ** Default values for the various QRF limits
24471 */
24472 #ifndef DFLT_CHAR_LIMIT
24473 # define DFLT_CHAR_LIMIT 300
24474 #endif
24475 #ifndef DFLT_LINE_LIMIT
24476 # define DFLT_LINE_LIMIT 5
24477 #endif
24478 #ifndef DFLT_TITLE_LIMIT
24479 # define DFLT_TITLE_LIMIT 20
24480 #endif
24481
24482 /*
24483 ** Limit input nesting via .read or any other input redirect.
24484 ** It's not too expensive, so a generous allowance can be made.
24485 */
24486 #define MAX_INPUT_NESTING 25
@@ -24305,13 +24570,20 @@
24570 if( pI->eCSep ) modeSetStr(&pM->spec.zColumnSep, aModeStr[pI->eCSep]);
24571 if( pI->eRSep ) modeSetStr(&pM->spec.zRowSep, aModeStr[pI->eRSep]);
24572 if( pI->eNull ) modeSetStr(&pM->spec.zNull, aModeStr[pI->eNull]);
24573 pM->spec.eText = pI->eText;
24574 pM->spec.eBlob = pI->eBlob;
24575 if( (pM->mFlags & MFLG_HDR)==0 ){
24576 pM->spec.bTitles = pI->bHdr;
24577 }
24578 pM->spec.eTitle = pI->eHdr;
24579 if( pI->mFlg & 0x01 ){
24580 pM->spec.bBorder = QRF_No;
24581 }else{
24582 pM->spec.bBorder = QRF_Auto;
24583 }
24584 if( pI->mFlg & 0x02 ){
24585 pM->spec.bSplitColumn = QRF_Yes;
24586 pM->bAutoScreenWidth = 1;
24587 }else{
24588 pM->spec.bSplitColumn = QRF_No;
24589 }
@@ -24326,26 +24598,27 @@
24598 }else if( eMode==MODE_TTY ){
24599 u8 mFlags = p->mode.mFlags;
24600 modeFree(&p->mode);
24601 modeChange(p, MODE_QBox);
24602 p->mode.bAutoScreenWidth = 1;
24603 p->mode.spec.eText = QRF_TEXT_Relaxed;
24604 p->mode.spec.nCharLimit = DFLT_CHAR_LIMIT;
24605 p->mode.spec.nLineLimit = DFLT_LINE_LIMIT;
24606 p->mode.spec.bTextJsonb = QRF_Yes;
24607 p->mode.spec.nTitleLimit = DFLT_TITLE_LIMIT;
24608 p->mode.mFlags = mFlags;
24609 }
24610 }
24611
24612 /*
24613 ** Set the mode to the default. It assumed that the mode has
24614 ** already been freed and zeroed prior to calling this routine.
 
24615 */
24616 static void modeDefault(ShellState *p){
24617 p->mode.spec.iVersion = 1;
24618 p->mode.autoExplain = 1;
24619 if( stdin_is_interactive || stdout_is_console ){
24620 modeChange(p, MODE_TTY);
24621 }else{
24622 modeChange(p, MODE_BATCH);
24623 }
24624 }
@@ -25075,10 +25348,12 @@
25348 z[j] = 0;
25349 if( strlen30(z)>=79 ){
25350 for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */
25351 if( c==cEnd ){
25352 cEnd = 0;
25353 }else if( cEnd!=0){
25354 /* No-op */
25355 }else if( c=='"' || c=='\'' || c=='`' ){
25356 cEnd = c;
25357 }else if( c=='[' ){
25358 cEnd = ']';
25359 }else if( c=='-' && z[i+1]=='-' ){
@@ -25889,10 +26164,11 @@
26164 if( pArg->mode.bAutoScreenWidth ){
26165 spec.nScreenWidth = shellScreenWidth();
26166 }
26167 if( spec.eBlob==QRF_BLOB_Auto ){
26168 switch( spec.eText ){
26169 case QRF_TEXT_Relaxed: /* fall through */
26170 case QRF_TEXT_Sql: spec.eBlob = QRF_BLOB_Sql; break;
26171 case QRF_TEXT_Json: spec.eBlob = QRF_BLOB_Json; break;
26172 default: spec.eBlob = QRF_BLOB_Text; break;
26173 }
26174 }
@@ -25902,11 +26178,11 @@
26178 rc = expertHandleSQL(pArg, zSql, pzErrMsg);
26179 return expertFinish(pArg, (rc!=SQLITE_OK), pzErrMsg);
26180 }
26181 #endif
26182
26183 while( zSql && zSql[0] && (SQLITE_OK == rc) ){
26184 static const char *zStmtSql;
26185 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
26186 if( SQLITE_OK != rc ){
26187 if( pzErrMsg ){
26188 *pzErrMsg = save_err_msg(db, "in prepare", rc, zSql);
@@ -26365,12 +26641,12 @@
26641 ".bail on|off Stop after hitting an error. Default OFF",
26642 #ifndef SQLITE_SHELL_FIDDLE
26643 ".cd DIRECTORY Change the working directory to DIRECTORY",
26644 #endif
26645 ".changes on|off Show number of rows changed by SQL",
26646 ".check OPTIONS ... Verify the results of a .testcase",
26647 #ifndef SQLITE_SHELL_FIDDLE
 
26648 ".clone NEWDB Clone data into NEWDB from the existing database",
26649 #endif
26650 ".connection [close] [#] Open or close an auxiliary database connection",
26651 ".crlf ?on|off? Whether or not to use \\r\\n line endings",
26652 ".databases List names and files of attached databases",
@@ -26546,13 +26822,11 @@
26822 " vmstep Show the virtual machine step count only",
26823 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
26824 ".system CMD ARGS... Run CMD ARGS... in a system shell",
26825 #endif
26826 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
26827 ".testcase NAME Begin a test case.",
 
 
26828 ",testctrl CMD ... Run various sqlite3_test_control() operations",
26829 " Run \".testctrl\" with no arguments for details",
26830 ".timeout MS Try opening locked tables for MS milliseconds",
26831 ".timer on|off Turn SQL timer on or off",
26832 #ifndef SQLITE_OMIT_TRACE
@@ -26597,19 +26871,31 @@
26871 "USAGE: .import [OPTIONS] FILE TABLE\n"
26872 "\n"
26873 "Import CSV or similar text from FILE into TABLE. If TABLE does\n"
26874 "not exist, it is created using the first row of FILE as the column\n"
26875 "names. If FILE begins with \"|\" then it is a command that is run\n"
26876 "and the output from the command is used as the input data. If\n"
26877 "FILE begins with \"<<\" followed by a label, then content is read from\n"
26878 "the script until the first line that matches the label.\n"
26879 "\n"
26880 "The content of FILE is interpreted using RFC-4180 (\"CSV\") quoting\n"
26881 "rules unless the current mode is \"ascii\" or \"tabs\" or unless one\n"
26882 "the --ascii option is used.\n"
26883 "\n"
26884 "The column and row separators must be single ASCII characters. If\n"
26885 "multiple characters or a Unicode character are specified for the\n"
26886 "separators, then only the first byte of the separator is used. Except,\n"
26887 "if the row separator is \\n and the mode is not --ascii, then \\r\\n is\n"
26888 "understood as a row separator too.\n"
26889 "\n"
26890 "Options:\n"
26891 " --ascii Do not use RFC-4180 quoting. Use \\037 and \\036\n"
26892 " as column and row separators on input, unless other\n"
26893 " delimiters are specified using --colsep and/or --rowsep\n"
26894 " --colsep CHAR Use CHAR as the column separator.\n"
26895 " --csv Input is standard RFC-4180 CSV.\n"
26896 " --rowsep CHAR Use CHAR as the row separator.\n"
26897 " --schema S When creating TABLE, put it in schema S\n"
26898 " --skip N Ignore the first N rows of input\n"
26899 " -v Verbose mode\n"
26900 },
26901 { ".mode",
@@ -26625,10 +26911,11 @@
26911 " meaning \"left\", \"centered\", and \"right\", with\n"
26912 " one letter per column starting from the left.\n"
26913 " Unspecified alignment defaults to 'L'.\n"
26914 " --blob-quote ARG ARG can be \"auto\", \"text\", \"sql\", \"hex\", \"tcl\",\n"
26915 " \"json\", or \"size\". Default is \"auto\".\n"
26916 " --border on|off Show outer border on \"box\" and \"table\" modes.\n"
26917 " --charlimit N Set the maximum number of output characters to\n"
26918 " show for any single SQL value to N. Longer values\n"
26919 " truncated. Zero means \"no limit\".\n"
26920 " --colsep STRING Use STRING as the column separator\n"
26921 " --escape ESC Enable/disable escaping of control characters\n"
@@ -26636,19 +26923,22 @@
26923 " or \"symbol\".\n"
26924 " --linelimit N Set the maximum number of output lines to show for\n"
26925 " any single SQL value to N. Longer values are\n"
26926 " truncated. Zero means \"no limit\". Only works\n"
26927 " in \"line\" mode and in columnar modes.\n"
26928 " --limits L,C,T Shorthand for \"--linelimit L --charlimit C\n"
26929 " --titlelimit T\". The \",T\" can be omitted in which\n"
26930 " case the --titlelimit is unchanged. The argument\n"
26931 " can also be \"off\" to mean \"0,0,0\" or \"on\" to\n"
26932 " mean \"5,300,20\".\n"
26933 " --list List available modes\n"
26934 " --null STRING Render SQL NULL values as the given string\n"
26935 " --once Setting changes to the right are reverted after\n"
26936 " the next SQL command.\n"
26937 " --quote ARG Enable/disable quoting of text. ARG can be\n"
26938 " \"off\", \"on\", \"sql\", \"relaxed\", \"csv\", \"html\",\n"
26939 " \"tcl\", or \"json\". \"off\" means show the text as-is.\n"
26940 " \"on\" is an alias for \"sql\".\n"
26941 " --reset Changes all mode settings back to their default.\n"
26942 " --rowsep STRING Use STRING as the row separator\n"
26943 " --sw|--screenwidth N Declare the screen width of the output device\n"
26944 " to be N characters. An attempt may be made to\n"
@@ -26659,10 +26949,11 @@
26949 " --tag NAME Save mode to the left as NAME.\n"
26950 " --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON.\n"
26951 " --title ARG Whether or not to show column headers, and if so\n"
26952 " how to encode them. ARG can be \"off\", \"on\",\n"
26953 " \"sql\", \"csv\", \"html\", \"tcl\", or \"json\".\n"
26954 " --titlelimit N Limit the length of column titles to N characters.\n"
26955 " -v|--verbose Verbose output\n"
26956 " --widths LIST Set the columns widths for columnar modes. The\n"
26957 " argument is a list of integers, one for each\n"
26958 " column. A \"0\" width means use a dynamic width\n"
26959 " based on the actual width of data. If there are\n"
@@ -26686,23 +26977,17 @@
26977 " --bom Prepend a byte-order mark to the output\n"
26978 " -e Accumulate output in a temporary text file then\n"
26979 " launch a text editor when the redirection ends.\n"
26980 " --error-prefix X Use X as the left-margin prefix for error messages.\n"
26981 " Set to an empty string to restore the default.\n"
26982 " --keep Keep redirecting output to its current destination.\n"
26983 " Use this option in combination with --show or\n"
26984 " with --error-prefix when you do not want to stop\n"
26985 " a current redirection.\n"
 
 
 
26986 " --plain Use plain text rather than HTML tables with -w\n"
26987 " --show Show output text captured by .testcase or by\n"
26988 " redirecting to \"memory\".\n"
 
 
 
26989 " -w Show the output in a web browser. Output is\n"
26990 " written into a temporary HTML file until the\n"
26991 " redirect ends, then the web browser is launched.\n"
26992 " Query results are shown as HTML tables, unless\n"
26993 " the --plain is used too.\n"
@@ -26726,10 +27011,39 @@
27011 " file in a web browser\n"
27012 " -x Show the output in a spreadsheet. Output is\n"
27013 " written to a temp file as CSV then the spreadsheet\n"
27014 " is launched when\n"
27015 },
27016 { ".check",
27017 "USAGE: .check [OPTIONS] PATTERN\n"
27018 "\n"
27019 "Verify results of commands since the most recent .testcase command.\n"
27020 "Restore output to the console, unless --keep is used.\n"
27021 "\n"
27022 "If PATTERN starts with \"<<ENDMARK\" then the actual pattern is taken from\n"
27023 "subsequent lines of text up to the first line that begins with ENDMARK.\n"
27024 "All pattern lines and the ENDMARK are discarded.\n"
27025 "\n"
27026 "Options:\n"
27027 " --exact Do an exact comparison including leading and\n"
27028 " trailing whitespace.\n"
27029 " --glob Treat PATTERN as a GLOB\n"
27030 " --keep Do not reset the testcase. More .check commands\n"
27031 " will follow.\n"
27032 " --notglob Output should not match PATTERN\n"
27033 " --show Write testcase output to the screen, for debugging.\n"
27034 },
27035 { ".testcase",
27036 "USAGE: .testcase [OPTIONS] NAME\n"
27037 "\n"
27038 "Start a new test case identified by NAME. All output\n"
27039 "through the next \".check\" command is captured for comparison. See the\n"
27040 "\".check\" commandn for additional informatioon.\n"
27041 "\n"
27042 "Options:\n"
27043 " --error-prefix TEXT Change error message prefix text to TEXT\n"
27044 },
27045 };
27046
27047 /*
27048 ** Return a pointer to usage text for zCmd, or NULL if none exists.
27049 */
@@ -26949,10 +27263,56 @@
27263 if( sqlite3_strglob(pSession->azFilter[i], zTab)==0 ) return 0;
27264 }
27265 return 1;
27266 }
27267 #endif
27268
27269 /*
27270 ** Return the size of the named file in bytes. Or return a negative
27271 ** number if the file does not exist.
27272 */
27273 static sqlite3_int64 fileSize(const char *zFile){
27274 #if defined(_WIN32) || defined(WIN32)
27275 struct _stat64 x;
27276 if( _stat64(zFile, &x)!=0 ) return -1;
27277 return (sqlite3_int64)x.st_size;
27278 #else
27279 struct stat x;
27280 if( stat(zFile, &x)!=0 ) return -1;
27281 return (sqlite3_int64)x.st_size;
27282 #endif
27283 }
27284
27285 /*
27286 ** Return true if zFile is an SQLite database.
27287 **
27288 ** Algorithm:
27289 ** * If the file does not exist -> return false
27290 ** * If the size of the file is not a multiple of 512 -> return false
27291 ** * If sqlite3_open() fails -> return false
27292 ** * if sqlite3_prepare() or sqlite3_step() fails -> return false
27293 ** * Otherwise -> return true
27294 */
27295 static int isDatabaseFile(const char *zFile, int openFlags){
27296 sqlite3 *db = 0;
27297 sqlite3_stmt *pStmt = 0;
27298 int rc;
27299 sqlite3_int64 sz = fileSize(zFile);
27300 if( sz<512 || (sz%512)!=0 ) return 0;
27301 if( sqlite3_open_v2(zFile, &db, openFlags, 0)==SQLITE_OK
27302 && sqlite3_prepare_v2(db,"SELECT count(*) FROM sqlite_schema",-1,&pStmt,0)
27303 ==SQLITE_OK
27304 && sqlite3_step(pStmt)==SQLITE_ROW
27305 ){
27306 rc = 1;
27307 }else{
27308 rc = 0;
27309 }
27310 sqlite3_finalize(pStmt);
27311 sqlite3_close(db);
27312 return rc;
27313 }
27314
27315 /*
27316 ** Try to deduce the type of file for zName based on its content. Return
27317 ** one of the SHELL_OPEN_* constants.
27318 **
@@ -26962,24 +27322,16 @@
27322 ** the type cannot be determined from content.
27323 */
27324 int deduceDatabaseType(const char *zName, int dfltZip, int openFlags){
27325 FILE *f;
27326 size_t n;
 
 
27327 int rc = SHELL_OPEN_UNSPEC;
27328 char zBuf[100];
27329 if( access(zName,0)!=0 ) goto database_type_by_name;
27330 if( isDatabaseFile(zName, openFlags) ){
 
 
 
 
27331 rc = SHELL_OPEN_NORMAL;
27332 }
 
 
27333 if( rc==SHELL_OPEN_NORMAL ) return SHELL_OPEN_NORMAL;
27334 f = sqlite3_fopen(zName, "rb");
27335 if( f==0 ) goto database_type_by_name;
27336 n = fread(zBuf, 16, 1, f);
27337 if( n==1 && memcmp(zBuf, "SQLite format 3", 16)==0 ){
@@ -27009,10 +27361,37 @@
27361 }else{
27362 rc = SHELL_OPEN_NORMAL;
27363 }
27364 return rc;
27365 }
27366
27367 /*
27368 ** If the text in z[] is the name of a readable file and that file appears
27369 ** to contain SQL text and/or dot-commands, then return true. If z[] is
27370 ** not a file, or if the file is unreadable, or if the file is a database
27371 ** or anything else that is not SQL text and dot-commands, then return false.
27372 **
27373 ** If the bLeaveUninit flag is set, then be sure to leave SQLite in an
27374 ** uninitialized state. This means invoking sqlite3_shutdown() after any
27375 ** SQLite API is used.
27376 **
27377 ** Some amount of guesswork is involved in this decision.
27378 */
27379 static int isScriptFile(const char *z, int bLeaveUninit){
27380 sqlite3_int64 sz = fileSize(z);
27381 if( sz<=0 ) return 0;
27382 if( (sz%512)==0 ){
27383 int rc = isDatabaseFile(z, SQLITE_OPEN_READONLY);
27384 if( bLeaveUninit ){
27385 sqlite3_shutdown();
27386 }
27387 if( rc ) return 0; /* Is a database */
27388 }
27389 if( sqlite3_strlike("%.sql",z,0)==0 ) return 1;
27390 if( sqlite3_strlike("%.txt",z,0)==0 ) return 1;
27391 return 0;
27392 }
27393
27394 #ifndef SQLITE_OMIT_DESERIALIZE
27395 /*
27396 ** Reconstruct an in-memory database using the output from the "dbtotxt"
27397 ** program. Read content from the file in p->aAuxDb[].zDbFilename.
@@ -27655,11 +28034,13 @@
28034 typedef struct ImportCtx ImportCtx;
28035 struct ImportCtx {
28036 const char *zFile; /* Name of the input file */
28037 FILE *in; /* Read the CSV text from this input stream */
28038 int (SQLITE_CDECL *xCloser)(FILE*); /* Func to close in */
28039 char *zIn; /* Input text */
28040 char *z; /* Accumulated text for a field */
28041 i64 nUsed; /* Bytes of zIn[] used so far */
28042 i64 n; /* Number of bytes in z */
28043 i64 nAlloc; /* Space allocated for z[] */
28044 int nLine; /* Current line number */
28045 int nRow; /* Number of rows imported */
28046 int nErr; /* Number of errors encountered */
@@ -27675,13 +28056,32 @@
28056 p->xCloser(p->in);
28057 p->in = 0;
28058 }
28059 sqlite3_free(p->z);
28060 p->z = 0;
28061 if( p->zIn ){
28062 sqlite3_free(p->zIn);
28063 p->zIn = 0;
28064 }
28065 }
28066
28067 /* Read a single character of the .import input text. Return EOF
28068 ** at end-of-file.
28069 */
28070 static int import_getc(ImportCtx *p){
28071 if( p->in ){
28072 return fgetc(p->in);
28073 }else if( p->zIn && p->zIn[p->nUsed]!=0 ){
28074 return p->zIn[p->nUsed++];
28075 }else{
28076 return EOF;
28077 }
28078 }
28079
28080 /* Append a single byte to the field value begin constructed
28081 ** in the p->z[] buffer
28082 */
28083 static void import_append_char(ImportCtx *p, int c){
28084 if( p->n+1>=p->nAlloc ){
28085 p->nAlloc += p->nAlloc + 100;
28086 p->z = sqlite3_realloc64(p->z, p->nAlloc);
28087 shell_check_oom(p->z);
@@ -27693,12 +28093,12 @@
28093 ** with the option of having a separator other than ",".
28094 **
28095 ** + Input comes from p->in.
28096 ** + Store results in p->z of length p->n. Space to hold p->z comes
28097 ** from sqlite3_malloc64().
28098 ** + Use p->cColSep as the column separator. The default is ",".
28099 ** + Use p->cRowSep as the row separator. The default is "\n".
28100 ** + Keep track of the line number in p->nLine.
28101 ** + Store the character that terminates the field in p->cTerm. Store
28102 ** EOF on end-of-file.
28103 ** + Report syntax errors on stderr
28104 */
@@ -27705,11 +28105,11 @@
28105 static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
28106 int c;
28107 int cSep = (u8)p->cColSep;
28108 int rSep = (u8)p->cRowSep;
28109 p->n = 0;
28110 c = import_getc(p);
28111 if( c==EOF || seenInterrupt ){
28112 p->cTerm = EOF;
28113 return 0;
28114 }
28115 if( c=='"' ){
@@ -27716,11 +28116,11 @@
28116 int pc, ppc;
28117 int startLine = p->nLine;
28118 int cQuote = c;
28119 pc = ppc = 0;
28120 while( 1 ){
28121 c = import_getc(p);
28122 if( c==rSep ) p->nLine++;
28123 if( c==cQuote ){
28124 if( pc==cQuote ){
28125 pc = 0;
28126 continue;
@@ -27752,24 +28152,24 @@
28152 }else{
28153 /* If this is the first field being parsed and it begins with the
28154 ** UTF-8 BOM (0xEF BB BF) then skip the BOM */
28155 if( (c&0xff)==0xef && p->bNotFirst==0 ){
28156 import_append_char(p, c);
28157 c = import_getc(p);
28158 if( (c&0xff)==0xbb ){
28159 import_append_char(p, c);
28160 c = import_getc(p);
28161 if( (c&0xff)==0xbf ){
28162 p->bNotFirst = 1;
28163 p->n = 0;
28164 return csv_read_one_field(p);
28165 }
28166 }
28167 }
28168 while( c!=EOF && c!=cSep && c!=rSep ){
28169 import_append_char(p, c);
28170 c = import_getc(p);
28171 }
28172 if( c==rSep ){
28173 p->nLine++;
28174 if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
28175 }
@@ -27783,12 +28183,12 @@
28183 /* Read a single field of ASCII delimited text.
28184 **
28185 ** + Input comes from p->in.
28186 ** + Store results in p->z of length p->n. Space to hold p->z comes
28187 ** from sqlite3_malloc64().
28188 ** + Use p->cColSep as the column separator. The default is "\x1F".
28189 ** + Use p->cRowSep as the row separator. The default is "\x1E".
28190 ** + Keep track of the row number in p->nLine.
28191 ** + Store the character that terminates the field in p->cTerm. Store
28192 ** EOF on end-of-file.
28193 ** + Report syntax errors on stderr
28194 */
@@ -27795,18 +28195,18 @@
28195 static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
28196 int c;
28197 int cSep = (u8)p->cColSep;
28198 int rSep = (u8)p->cRowSep;
28199 p->n = 0;
28200 c = import_getc(p);
28201 if( c==EOF || seenInterrupt ){
28202 p->cTerm = EOF;
28203 return 0;
28204 }
28205 while( c!=EOF && c!=cSep && c!=rSep ){
28206 import_append_char(p, c);
28207 c = import_getc(p);
28208 }
28209 if( c==rSep ){
28210 p->nLine++;
28211 }
28212 p->cTerm = c;
@@ -29721,11 +30121,13 @@
30121
30122 p = sqlite3_recover_init_sql(
30123 pState->db, "main", recoverSqlCb, (void*)pState
30124 );
30125
30126 if( !pState->bSafeMode ){
30127 sqlite3_recover_config(p, 789, (void*)zRecoveryDb); /* Debug use only */
30128 }
30129 sqlite3_recover_config(p, SQLITE_RECOVER_LOST_AND_FOUND, (void*)zLAF);
30130 sqlite3_recover_config(p, SQLITE_RECOVER_ROWIDS, (void*)&bRowids);
30131 sqlite3_recover_config(p, SQLITE_RECOVER_FREELIST_CORRUPT,(void*)&bFreelist);
30132
30133 cli_printf(pState->out, ".dbconfig defensive off\n");
@@ -30105,19 +30507,31 @@
30507 ** USAGE: .import [OPTIONS] FILE TABLE
30508 **
30509 ** Import CSV or similar text from FILE into TABLE. If TABLE does
30510 ** not exist, it is created using the first row of FILE as the column
30511 ** names. If FILE begins with "|" then it is a command that is run
30512 ** and the output from the command is used as the input data. If
30513 ** FILE begins with "<<" followed by a label, then content is read from
30514 ** the script until the first line that matches the label.
30515 **
30516 ** The content of FILE is interpreted using RFC-4180 ("CSV") quoting
30517 ** rules unless the current mode is "ascii" or "tabs" or unless one
30518 ** the --ascii option is used.
30519 **
30520 ** The column and row separators must be single ASCII characters. If
30521 ** multiple characters or a Unicode character are specified for the
30522 ** separators, then only the first byte of the separator is used. Except,
30523 ** if the row separator is \n and the mode is not --ascii, then \r\n is
30524 ** understood as a row separator too.
30525 **
30526 ** Options:
30527 ** --ascii Do not use RFC-4180 quoting. Use \037 and \036
30528 ** as column and row separators on input, unless other
30529 ** delimiters are specified using --colsep and/or --rowsep
30530 ** --colsep CHAR Use CHAR as the column separator.
30531 ** --csv Input is standard RFC-4180 CSV.
30532 ** --rowsep CHAR Use CHAR as the row separator.
30533 ** --schema S When creating TABLE, put it in schema S
30534 ** --skip N Ignore the first N rows of input
30535 ** -v Verbose mode
30536 */
30537 static int dotCmdImport(ShellState *p){
@@ -30129,17 +30543,16 @@
30543 sqlite3_stmt *pStmt = NULL; /* A statement */
30544 int nCol; /* Number of columns in the table */
30545 i64 nByte; /* Number of bytes in an SQL string */
30546 int i, j; /* Loop counters */
30547 int needCommit; /* True to COMMIT or ROLLBACK at end */
 
30548 char *zSql = 0; /* An SQL statement */
30549 ImportCtx sCtx; /* Reader context */
30550 char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */
30551 int eVerbose = 0; /* Larger for more console output */
30552 i64 nSkip = 0; /* Initial lines to skip */
30553 i64 iLineOffset = 0; /* Offset to the first line of input */
30554 char *zCreate = 0; /* CREATE TABLE statement text */
30555 int rc; /* Result code */
30556
30557 failIfSafeMode(p, "cannot run .import in safe mode");
30558 memset(&sCtx, 0, sizeof(sCtx));
@@ -30165,70 +30578,67 @@
30578 }else if( cli_strcmp(z,"-schema")==0 && i<nArg-1 ){
30579 zSchema = azArg[++i];
30580 }else if( cli_strcmp(z,"-skip")==0 && i<nArg-1 ){
30581 nSkip = integerValue(azArg[++i]);
30582 }else if( cli_strcmp(z,"-ascii")==0 ){
30583 if( sCtx.cColSep==0 ) sCtx.cColSep = SEP_Unit[0];
30584 if( sCtx.cRowSep==0 ) sCtx.cRowSep = SEP_Record[0];
30585 xRead = ascii_read_one_field;
 
30586 }else if( cli_strcmp(z,"-csv")==0 ){
30587 if( sCtx.cColSep==0 ) sCtx.cColSep = ',';
30588 if( sCtx.cRowSep==0 ) sCtx.cRowSep = '\n';
30589 xRead = csv_read_one_field;
30590 }else if( cli_strcmp(z,"-colsep")==0 ){
30591 if( i==nArg-1 ){
30592 dotCmdError(p, i, "missing argument", 0);
30593 return 1;
30594 }
30595 i++;
30596 sCtx.cColSep = azArg[i][0];
30597 }else if( cli_strcmp(z,"-rowsep")==0 ){
30598 if( i==nArg-1 ){
30599 dotCmdError(p, i, "missing argument", 0);
30600 return 1;
30601 }
30602 i++;
30603 sCtx.cRowSep = azArg[i][0];
30604 }else{
30605 dotCmdError(p, i, "unknown option", 0);
30606 return 1;
30607 }
30608 }
30609 if( zTable==0 ){
30610 dotCmdError(p, nArg, 0, "Missing %s argument\n",
30611 zFile==0 ? "FILE" : "TABLE");
30612 return 1;
30613 }
30614 seenInterrupt = 0;
30615 open_db(p, 0);
30616 if( sCtx.cColSep==0 ){
30617 if( p->mode.spec.zColumnSep && p->mode.spec.zColumnSep[0]!=0 ){
30618 sCtx.cColSep = p->mode.spec.zColumnSep[0];
30619 }else{
30620 sCtx.cColSep = ',';
30621 }
30622 }
30623 if( (sCtx.cColSep & 0x80)!=0 ){
30624 eputz("Error: .import column separator must be ASCII\n");
30625 return 1;
30626 }
30627 if( sCtx.cRowSep==0 ){
30628 if( p->mode.spec.zRowSep && p->mode.spec.zRowSep[0]!=0 ){
30629 sCtx.cRowSep = p->mode.spec.zRowSep[0];
30630 }else{
30631 sCtx.cRowSep = '\n';
30632 }
30633 }
30634 if( sCtx.cRowSep=='\r' && xRead!=ascii_read_one_field ){
30635 sCtx.cRowSep = '\n';
30636 }
30637 if( (sCtx.cRowSep & 0x80)!=0 ){
30638 eputz("Error: .import row separator must be ASCII\n");
30639 return 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30640 }
30641 sCtx.zFile = zFile;
30642 sCtx.nLine = 1;
30643 if( sCtx.zFile[0]=='|' ){
30644 #ifdef SQLITE_OMIT_POPEN
@@ -30237,19 +30647,58 @@
30647 #else
30648 sCtx.in = sqlite3_popen(sCtx.zFile+1, "r");
30649 sCtx.zFile = "<pipe>";
30650 sCtx.xCloser = pclose;
30651 #endif
30652 }else if( sCtx.zFile[0]=='<' && sCtx.zFile[1]=='<' && sCtx.zFile[2]!=0 ){
30653 /* Input text comes from subsequent lines of script until the zFile
30654 ** delimiter */
30655 int nEndMark = strlen30(zFile)-2;
30656 char *zEndMark = &zFile[2];
30657 sqlite3_str *pContent = sqlite3_str_new(p->db);
30658 int ckEnd = 1;
30659 i64 iStart = p->lineno;
30660 char zLine[2000];
30661 sCtx.zFile = p->zInFile;
30662 sCtx.nLine = p->lineno+1;
30663 iLineOffset = p->lineno;
30664 while( sqlite3_fgets(zLine,sizeof(zLine),p->in) ){
30665 if( ckEnd && cli_strncmp(zLine,zEndMark,nEndMark)==0 ){
30666 ckEnd = 2;
30667 if( strchr(zLine,'\n') ) p->lineno++;
30668 break;
30669 }
30670 if( strchr(zLine,'\n') ){
30671 p->lineno++;
30672 ckEnd = 1;
30673 }else{
30674 ckEnd = 0;
30675 }
30676 sqlite3_str_appendall(pContent, zLine);
30677 }
30678 sCtx.zIn = sqlite3_str_finish(pContent);
30679 if( sCtx.zIn==0 ){
30680 sCtx.zIn = sqlite3_mprintf("");
30681 }
30682 if( ckEnd<2 ){
30683 i64 savedLn = p->lineno;
30684 p->lineno = iStart;
30685 dotCmdError(p, 0, 0,"Content terminator \"%s\" not found.",zEndMark);
30686 p->lineno = savedLn;
30687 import_cleanup(&sCtx);
30688 return 1;
30689 }
30690 }else{
30691 sCtx.in = sqlite3_fopen(sCtx.zFile, "rb");
30692 sCtx.xCloser = fclose;
30693 }
30694 if( sCtx.in==0 && sCtx.zIn==0 ){
30695 dotCmdError(p, 0, 0, "cannot open \"%s\"", zFile);
30696 import_cleanup(&sCtx);
30697 return 1;
30698 }
30699 if( eVerbose>=1 ){
30700 char zSep[2];
30701 zSep[1] = 0;
30702 zSep[0] = sCtx.cColSep;
30703 cli_puts("Column separator ", p->out);
30704 output_c_string(p->out, zSep);
@@ -30402,10 +30851,14 @@
30851 if( z==0 && (xRead==csv_read_one_field) && i==nCol-1 && i>0 ){
30852 z = "";
30853 }
30854 sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
30855 if( i<nCol-1 && sCtx.cTerm!=sCtx.cColSep ){
30856 if( i==0 && (strcmp(z,"\n")==0 || strcmp(z,"\r\n")==0) ){
30857 /* Ignore trailing \n or \r\n when some other row separator */
30858 break;
30859 }
30860 cli_printf(stderr,"%s:%d: expected %d columns but found %d"
30861 " - filling the rest with NULL\n",
30862 sCtx.zFile, startLine, nCol, i+1);
30863 i += 2;
30864 while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
@@ -30425,10 +30878,11 @@
30878 rc = sqlite3_reset(pStmt);
30879 if( rc!=SQLITE_OK ){
30880 cli_printf(stderr,"%s:%d: INSERT failed: %s\n",
30881 sCtx.zFile, startLine, sqlite3_errmsg(p->db));
30882 sCtx.nErr++;
30883 if( bail_on_error ) break;
30884 }else{
30885 sCtx.nRow++;
30886 }
30887 }
30888 }while( sCtx.cTerm!=EOF );
@@ -30437,13 +30891,13 @@
30891 sqlite3_finalize(pStmt);
30892 if( needCommit ) sqlite3_exec(p->db, "COMMIT", 0, 0, 0);
30893 if( eVerbose>0 ){
30894 cli_printf(p->out,
30895 "Added %d rows with %d errors using %d lines of input\n",
30896 sCtx.nRow, sCtx.nErr, sCtx.nLine-1-iLineOffset);
30897 }
30898 return sCtx.nErr ? 1 : 0;
30899 }
30900
30901
30902 /*
30903 ** This function computes what to show the user about the configured
@@ -30508,10 +30962,11 @@
30962 ** meaning "left", "centered", and "right", with
30963 ** one letter per column starting from the left.
30964 ** Unspecified alignment defaults to 'L'.
30965 ** --blob-quote ARG ARG can be "auto", "text", "sql", "hex", "tcl",
30966 ** "json", or "size". Default is "auto".
30967 ** --border on|off Show outer border on "box" and "table" modes.
30968 ** --charlimit N Set the maximum number of output characters to
30969 ** show for any single SQL value to N. Longer values
30970 ** truncated. Zero means "no limit".
30971 ** --colsep STRING Use STRING as the column separator
30972 ** --escape ESC Enable/disable escaping of control characters
@@ -30519,19 +30974,22 @@
30974 ** or "symbol".
30975 ** --linelimit N Set the maximum number of output lines to show for
30976 ** any single SQL value to N. Longer values are
30977 ** truncated. Zero means "no limit". Only works
30978 ** in "line" mode and in columnar modes.
30979 ** --limits L,C,T Shorthand for "--linelimit L --charlimit C
30980 ** --titlelimit T". The ",T" can be omitted in which
30981 ** case the --titlelimit is unchanged. The argument
30982 ** can also be "off" to mean "0,0,0" or "on" to
30983 ** mean "5,300,20".
30984 ** --list List available modes
30985 ** --null STRING Render SQL NULL values as the given string
30986 ** --once Setting changes to the right are reverted after
30987 ** the next SQL command.
30988 ** --quote ARG Enable/disable quoting of text. ARG can be
30989 ** "off", "on", "sql", "relaxed", "csv", "html",
30990 ** "tcl", or "json". "off" means show the text as-is.
30991 ** "on" is an alias for "sql".
30992 ** --reset Changes all mode settings back to their default.
30993 ** --rowsep STRING Use STRING as the row separator
30994 ** --sw|--screenwidth N Declare the screen width of the output device
30995 ** to be N characters. An attempt may be made to
@@ -30542,10 +31000,11 @@
31000 ** --tag NAME Save mode to the left as NAME.
31001 ** --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON.
31002 ** --title ARG Whether or not to show column headers, and if so
31003 ** how to encode them. ARG can be "off", "on",
31004 ** "sql", "csv", "html", "tcl", or "json".
31005 ** --titlelimit N Limit the length of column titles to N characters.
31006 ** -v|--verbose Verbose output
31007 ** --widths LIST Set the columns widths for columnar modes. The
31008 ** argument is a list of integers, one for each
31009 ** column. A "0" width means use a dynamic width
31010 ** based on the actual width of data. If there are
@@ -30626,21 +31085,31 @@
31085 ** Must match QRF_BLOB_xxxx values. See also tag-20251124a */
31086 if( k>=0 ){
31087 p->mode.spec.eBlob = k & 0xff;
31088 }
31089 chng = 1;
31090 }else if( optionMatch(z,"border") ){
31091 if( (++i)>=nArg ){
31092 dotCmdError(p, i-1, "missing argument", 0);
31093 return 1;
31094 }
31095 k = pickStr(azArg[i], 0, "auto", "off", "on", "");
31096 if( k>=0 ){
31097 p->mode.spec.bBorder = k & 0x3;
31098 }
31099 chng = 1;
31100 }else if( 0<=(k=pickStr(z,0,"-charlimit","-linelimit","-titlelimit","")) ){
31101 int w; /* 0 1 */
31102 if( i+1>=nArg ){
31103 dotCmdError(p, i, "missing argument", 0);
31104 return 1;
31105 }
31106 w = integerValue(azArg[++i]);
31107 switch( k ){
31108 case 0: p->mode.spec.nCharLimit = w; break;
31109 case 1: p->mode.spec.nLineLimit = w; break;
31110 default: p->mode.spec.nTitleLimit = w; break;
31111 }
31112 chng = 1;
31113 }else if( 0<=(k=pickStr(z,0,"-tablename","-rowsep","-colsep","-null","")) ){
31114 /* 0 1 2 3 */
31115 if( i+1>=nArg ){
@@ -30675,25 +31144,28 @@
31144 dotCmdError(p, i-1, "missing argument", 0);
31145 return 1;
31146 }
31147 k = pickStr(azArg[i],0,"on","off","");
31148 if( k==0 ){
31149 p->mode.spec.nLineLimit = DFLT_LINE_LIMIT;
31150 p->mode.spec.nCharLimit = DFLT_CHAR_LIMIT;
31151 p->mode.spec.nTitleLimit = DFLT_TITLE_LIMIT;
31152 }else if( k==1 ){
31153 p->mode.spec.nLineLimit = 0;
31154 p->mode.spec.nCharLimit = 0;
31155 p->mode.spec.nTitleLimit = 0;
31156 }else{
31157 int L, C, T = 0;
31158 int nNum = sscanf(azArg[i], "%d,%d,%d", &L, &C, &T);
31159 if( nNum<2 || L<0 || C<0 || T<0){
31160 dotCmdError(p, i, "bad argument", "Should be \"L,C,T\" where L, C"
31161 " and T are unsigned integers");
31162 return 1;
31163 }
31164 p->mode.spec.nLineLimit = L;
31165 p->mode.spec.nCharLimit = C;
31166 if( nNum==3 ) p->mode.spec.nTitleLimit = T;
31167 }
31168 chng = 1;
31169 }else if( optionMatch(z,"list") ){
31170 int ii;
31171 cli_puts("available modes:", p->out);
@@ -30726,13 +31198,14 @@
31198 ** how to set quoting. */
31199 i++;
31200 if( (k = pickStr(azArg[i],0,"no","yes","0","1",""))>=0 ){
31201 k &= 1; /* 0 for "off". 1 for "on". */
31202 }else{
31203 char *zErr = 0;
31204 k = pickStr(azArg[i],&zErr,
31205 "off","on","sql","csv","html","tcl","json","relaxed","");
31206 /* 0 1 2 3 4 5 6 7 */
31207 if( k<0 ){
31208 dotCmdError(p, i, "unknown", "%z", zErr);
31209 return 1;
31210 }
31211 }
@@ -30757,10 +31230,13 @@
31230 p->mode.spec.eText = QRF_TEXT_Tcl;
31231 break;
31232 case 6: /* json */
31233 p->mode.spec.eText = QRF_TEXT_Json;
31234 break;
31235 case 7: /* relaxed */
31236 p->mode.spec.eText = QRF_TEXT_Relaxed;
31237 break;
31238 default: /* off */
31239 p->mode.spec.eText = QRF_TEXT_Plain;
31240 break;
31241 }
31242 chng = 1;
@@ -30832,10 +31308,11 @@
31308 if( k<0 ){
31309 dotCmdError(p, i, "bad --titles value","%z", zErr);
31310 return 1;
31311 }
31312 p->mode.spec.bTitles = k>=1 ? QRF_Yes : QRF_No;
31313 p->mode.mFlags &= ~MFLG_HDR;
31314 p->mode.spec.eTitle = k>1 ? k-1 : aModeInfo[p->mode.eMode].eHdr;
31315 chng = 1;
31316 }else if( optionMatch(z,"widths") || optionMatch(z,"width") ){
31317 int nWidth = 0;
31318 short int *aWidth;
@@ -30847,16 +31324,16 @@
31324 zW = azArg[++i];
31325 /* Every width value takes at least 2 bytes in the input string to
31326 ** specify, so strlen(zW) bytes should be plenty of space to hold the
31327 ** result. */
31328 aWidth = malloc( strlen(zW) );
31329 while( IsSpace(zW[0]) ) zW++;
31330 while( zW[0] ){
31331 int w = 0;
31332 int nDigit = 0;
31333 k = zW[0]=='-' && IsDigit(zW[1]);
31334 while( IsDigit(zW[k]) ){
31335 w = w*10 + zW[k] - '0';
31336 if( w>QRF_MAX_WIDTH ){
31337 dotCmdError(p,i+1,"width too big",
31338 "Maximum column width is %d", QRF_MAX_WIDTH);
31339 free(aWidth);
@@ -30873,11 +31350,11 @@
31350 }
31351 if( zW[0]=='-' ) w = -w;
31352 aWidth[nWidth++] = w;
31353 zW += k;
31354 if( zW[0]==',' ) zW++;
31355 while( IsSpace(zW[0]) ) zW++;
31356 }
31357 free(p->mode.spec.aWidth);
31358 p->mode.spec.aWidth = aWidth;
31359 p->mode.spec.nWidth = nWidth;
31360 chng = 1;
@@ -30928,39 +31405,52 @@
31405 unsigned char a = p->mode.spec.aAlign[ii];
31406 sqlite3_str_appendchar(pDesc, 1, "LLCR"[a&3]);
31407 }
31408 sqlite3_str_append(pDesc, "\"", 1);
31409 }
31410 if( bAll
31411 || (p->mode.spec.bBorder==QRF_No) != ((pI->mFlg&1)!=0)
31412 ){
31413 sqlite3_str_appendf(pDesc," --border %s",
31414 p->mode.spec.bBorder==QRF_No ? "off" : "on");
31415 }
31416 if( bAll || p->mode.spec.eBlob!=QRF_BLOB_Auto ){
31417 const char *azBQuote[] =
31418 { "auto", "text", "sql", "hex", "tcl", "json", "size" };
31419 /* 0 1 2 3 4 5 6
31420 ** Must match QRF_BLOB_xxxx values. See all instances of tag-20251124a */
31421 u8 e = p->mode.spec.eBlob;
31422 sqlite3_str_appendf(pDesc, " --blob-quote %s", azBQuote[e]);
31423 }
 
 
 
31424 zSetting = aModeStr[pI->eCSep];
31425 if( bAll || (zSetting && cli_strcmp(zSetting,p->mode.spec.zColumnSep)!=0) ){
31426 sqlite3_str_appendf(pDesc, " --colsep ");
31427 append_c_string(pDesc, p->mode.spec.zColumnSep);
31428 }
31429 if( bAll || p->mode.spec.eEsc!=QRF_Auto ){
31430 sqlite3_str_appendf(pDesc, " --escape %s",qrfEscNames[p->mode.spec.eEsc]);
31431 }
31432 if( bAll
31433 || (p->mode.spec.nLineLimit>0 && pI->eCx>0)
31434 || p->mode.spec.nCharLimit>0
31435 || (p->mode.spec.nTitleLimit>0 && pI->eCx>0)
31436 ){
31437 if( p->mode.spec.nLineLimit==0
31438 && p->mode.spec.nCharLimit==0
31439 && p->mode.spec.nTitleLimit==0
31440 ){
31441 sqlite3_str_appendf(pDesc, " --limits off");
31442 }else if( p->mode.spec.nLineLimit==DFLT_LINE_LIMIT
31443 && p->mode.spec.nCharLimit==DFLT_CHAR_LIMIT
31444 && p->mode.spec.nTitleLimit==DFLT_TITLE_LIMIT
31445 ){
31446 sqlite3_str_appendf(pDesc, " --limits on");
31447 }else{
31448 sqlite3_str_appendf(pDesc, " --limits %d,%d,%d",
31449 p->mode.spec.nLineLimit, p->mode.spec.nCharLimit,
31450 p->mode.spec.nTitleLimit);
31451 }
 
 
 
31452 }
31453 zSetting = aModeStr[pI->eNull];
31454 if( bAll || (zSetting && cli_strcmp(zSetting,p->mode.spec.zNull)!=0) ){
31455 sqlite3_str_appendf(pDesc, " --null ");
31456 append_c_string(pDesc, p->mode.spec.zNull);
@@ -30977,13 +31467,13 @@
31467 }
31468 if( bAll
31469 || (pI->eCx && (p->mode.spec.nScreenWidth>0 || p->mode.bAutoScreenWidth))
31470 ){
31471 if( p->mode.bAutoScreenWidth ){
31472 sqlite3_str_appendall(pDesc, " --sw auto");
31473 }else{
31474 sqlite3_str_appendf(pDesc," --sw %d",
31475 p->mode.spec.nScreenWidth);
31476 }
31477 }
31478 if( bAll || p->mode.eMode==MODE_Insert ){
31479 sqlite3_str_appendf(pDesc," --tablename ");
@@ -31023,11 +31513,11 @@
31513 sqlite3_str_appendf(pDesc, " --wrap %d", p->mode.spec.nWrap);
31514 }
31515 if( !bAll ) sqlite3_str_append(pDesc, " --ww", 5);
31516 }
31517 zDesc = sqlite3_str_finish(pDesc);
31518 cli_printf(p->out, ".mode %s\n", zDesc);
31519 fflush(p->out);
31520 sqlite3_free(zDesc);
31521 }
31522 return 0;
31523 }
@@ -31047,23 +31537,17 @@
31537 ** --bom Prepend a byte-order mark to the output
31538 ** -e Accumulate output in a temporary text file then
31539 ** launch a text editor when the redirection ends.
31540 ** --error-prefix X Use X as the left-margin prefix for error messages.
31541 ** Set to an empty string to restore the default.
31542 ** --keep Keep redirecting output to its current destination.
31543 ** Use this option in combination with --show or
31544 ** with --error-prefix when you do not want to stop
31545 ** a current redirection.
 
 
 
31546 ** --plain Use plain text rather than HTML tables with -w
31547 ** --show Show output text captured by .testcase or by
31548 ** redirecting to "memory".
 
 
 
31549 ** -w Show the output in a web browser. Output is
31550 ** written into a temporary HTML file until the
31551 ** redirect ends, then the web browser is launched.
31552 ** Query results are shown as HTML tables, unless
31553 ** the --plain is used too.
@@ -31101,13 +31585,11 @@
31585 char *zFile = 0; /* The FILE argument */
31586 int i; /* Loop counter */
31587 int eMode = 0; /* 0: .outout/.once, 'x'=.excel, 'w'=.www */
31588 int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
31589 int bPlain = 0; /* --plain option */
31590 int bKeep = 0; /* Keep redirecting */
 
 
31591 static const char *zBomUtf8 = "\357\273\277";
31592 const char *zBom = 0;
31593 char c = azArg[0][0];
31594 int n = strlen30(azArg[0]);
31595
@@ -31129,36 +31611,21 @@
31611 zBom = zBomUtf8;
31612 }else if( cli_strcmp(z,"-plain")==0 ){
31613 bPlain = 1;
31614 }else if( c=='o' && z[0]=='1' && z[1]!=0 && z[2]==0
31615 && (z[1]=='x' || z[1]=='e' || z[1]=='w') ){
31616 if( bKeep || eMode ){
31617 dotCmdError(p, i, "incompatible with prior options",0);
31618 goto dotCmdOutput_error;
31619 }
31620 eMode = z[1];
 
 
31621 }else if( cli_strcmp(z,"-show")==0 ){
31622 if( cli_output_capture ){
31623 sqlite3_fprintf(stdout, "%s", sqlite3_str_value(cli_output_capture));
31624 }
31625 }else if( cli_strcmp(z,"-keep")==0 ){
31626 bKeep = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31627 }else if( optionMatch(z,"error-prefix") ){
31628 if( i+1>=nArg ){
31629 dotCmdError(p, i, "missing argument", 0);
31630 return 1;
31631 }
@@ -31169,11 +31636,11 @@
31636 dotCmdError(p, i, "unknown option", 0);
31637 sqlite3_free(zFile);
31638 return 1;
31639 }
31640 }else if( zFile==0 && eMode==0 ){
31641 if( bKeep ){
31642 dotCmdError(p, i, "incompatible with prior options",0);
31643 goto dotCmdOutput_error;
31644 }
31645 if( cli_strcmp(z, "memory")==0 && bOnce ){
31646 dotCmdError(p, 0, "cannot redirect to \"memory\"", 0);
@@ -31205,53 +31672,10 @@
31672 if( bOnce ){
31673 p->nPopOutput = 2;
31674 }else{
31675 p->nPopOutput = 0;
31676 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31677 if( !bKeep ) output_reset(p);
31678 #ifndef SQLITE_NOHAVE_SYSTEM
31679 if( eMode=='e' || eMode=='x' || eMode=='w' ){
31680 p->doXdgOpen = 1;
31681 modePush(p);
@@ -31328,10 +31752,199 @@
31752
31753 dotCmdOutput_error:
31754 sqlite3_free(zFile);
31755 return 1;
31756 }
31757
31758 /*
31759 ** DOT-COMMAND: .check
31760 ** USAGE: .check [OPTIONS] PATTERN
31761 **
31762 ** Verify results of commands since the most recent .testcase command.
31763 ** Restore output to the console, unless --keep is used.
31764 **
31765 ** If PATTERN starts with "<<ENDMARK" then the actual pattern is taken from
31766 ** subsequent lines of text up to the first line that begins with ENDMARK.
31767 ** All pattern lines and the ENDMARK are discarded.
31768 **
31769 ** Options:
31770 ** --exact Do an exact comparison including leading and
31771 ** trailing whitespace.
31772 ** --glob Treat PATTERN as a GLOB
31773 ** --keep Do not reset the testcase. More .check commands
31774 ** will follow.
31775 ** --notglob Output should not match PATTERN
31776 ** --show Write testcase output to the screen, for debugging.
31777 */
31778 static int dotCmdCheck(ShellState *p){
31779 int nArg = p->dot.nArg; /* Number of arguments */
31780 char **azArg = p->dot.azArg; /* Text of the arguments */
31781 int i; /* Loop counter */
31782 int k; /* Result of pickStr() */
31783 char *zTest; /* Textcase result */
31784 int bKeep = 0; /* --keep option */
31785 char *zCheck = 0; /* PATTERN argument */
31786 char *zPattern = 0; /* Actual test pattern */
31787 int eCheck = 0; /* 1: --glob, 2: --notglob, 3: --exact */
31788 int isOk; /* True if results are OK */
31789 sqlite3_int64 iStart = p->lineno; /* Line number of .check statement */
31790
31791 if( p->zTestcase[0]==0 ){
31792 dotCmdError(p, 0, "no .testcase is active", 0);
31793 return 1;
31794 }
31795 for(i=1; i<nArg; i++){
31796 char *z = azArg[i];
31797 if( z[0]=='-' && z[1]=='-' && z[2]!=0 ) z++;
31798 if( cli_strcmp(z,"-keep")==0 ){
31799 bKeep = 1;
31800 }else if( cli_strcmp(z,"-show")==0 ){
31801 if( cli_output_capture ){
31802 sqlite3_fprintf(stdout, "%s", sqlite3_str_value(cli_output_capture));
31803 }
31804 bKeep = 1;
31805 }else if( z[0]=='-'
31806 && (k = pickStr(&z[1],0,"glob","notglob","exact",""))>=0
31807 ){
31808 if( eCheck && eCheck!=k+1 ){
31809 dotCmdError(p, i, "incompatible with prior options",0);
31810 return 1;
31811 }
31812 eCheck = k+1;
31813 }else if( zCheck ){
31814 dotCmdError(p, i, "unknown option", 0);
31815 return 1;
31816 }else{
31817 zCheck = azArg[i];
31818 }
31819 }
31820 if( zCheck==0 ){
31821 dotCmdError(p, 0, "no PATTERN specified", 0);
31822 return 1;
31823 }
31824 if( cli_output_capture && sqlite3_str_length(cli_output_capture) ){
31825 zTest = sqlite3_str_value(cli_output_capture);
31826 shell_check_oom(zTest);
31827 }else{
31828 zTest = "";
31829 }
31830 p->nTestRun++;
31831 if( zCheck[0]=='<' && zCheck[1]=='<' && zCheck[2]!=0 ){
31832 int nCheck = strlen30(zCheck);
31833 sqlite3_str *pPattern = sqlite3_str_new(p->db);
31834 char zLine[2000];
31835 while( sqlite3_fgets(zLine,sizeof(zLine),p->in) ){
31836 if( strchr(zLine,'\n') ) p->lineno++;
31837 if( cli_strncmp(&zCheck[2],zLine,nCheck-2)==0 ) break;
31838 sqlite3_str_appendall(pPattern, zLine);
31839 }
31840 zPattern = sqlite3_str_finish(pPattern);
31841 if( zPattern==0 ){
31842 zPattern = sqlite3_mprintf("");
31843 }
31844 }else{
31845 zPattern = zCheck;
31846 }
31847 shell_check_oom(zPattern);
31848 switch( eCheck ){
31849 case 1: {
31850 char *zGlob = sqlite3_mprintf("*%s*", zPattern);
31851 isOk = testcase_glob(zGlob, zTest)!=0;
31852 sqlite3_free(zGlob);
31853 break;
31854 }
31855 case 2: {
31856 char *zGlob = sqlite3_mprintf("*%s*", zPattern);
31857 isOk = testcase_glob(zGlob, zTest)==0;
31858 sqlite3_free(zGlob);
31859 break;
31860 }
31861 case 3: {
31862 isOk = cli_strcmp(zTest,zPattern)==0;
31863 break;
31864 }
31865 default: {
31866 /* Skip leading and trailing \n and \r on both pattern and test output */
31867 const char *z1 = zPattern;
31868 const char *z2 = zTest;
31869 size_t n1, n2;
31870 while( z1[0]=='\n' || z1[0]=='\r' ) z1++;
31871 n1 = strlen(z1);
31872 while( n1>0 && (z1[n1-1]=='\n' || z1[n1-1]=='\r') ) n1--;
31873 while( z2[0]=='\n' || z2[0]=='\r' ) z2++;
31874 n2 = strlen(z2);
31875 while( n2>0 && (z2[n2-1]=='\n' || z2[n2-1]=='\r') ) n2--;
31876 isOk = n1==n2 && memcmp(z1,z2,n1)==0;
31877 break;
31878 }
31879 }
31880 if( !isOk ){
31881 sqlite3_fprintf(stderr,
31882 "%s:%lld: .check failed for testcase %s\n",
31883 p->zInFile, iStart, p->zTestcase);
31884 p->nTestErr++;
31885 sqlite3_fprintf(stderr, "Expected: [%s]\n", zPattern);
31886 sqlite3_fprintf(stderr, "Got: [%s]\n", zTest);
31887 }
31888 if( zPattern!=zCheck ){
31889 sqlite3_free(zPattern);
31890 }
31891 if( !bKeep ){
31892 output_reset(p);
31893 p->zTestcase[0] = 0;
31894 }
31895 return 0;
31896 }
31897
31898 /*
31899 ** DOT-COMMAND: .testcase
31900 ** USAGE: .testcase [OPTIONS] NAME
31901 **
31902 ** Start a new test case identified by NAME. All output
31903 ** through the next ".check" command is captured for comparison. See the
31904 ** ".check" commandn for additional informatioon.
31905 **
31906 ** Options:
31907 ** --error-prefix TEXT Change error message prefix text to TEXT
31908 */
31909 static int dotCmdTestcase(ShellState *p){
31910 int nArg = p->dot.nArg; /* Number of arguments */
31911 char **azArg = p->dot.azArg; /* Text of the arguments */
31912 int i; /* Loop counter */
31913 const char *zName = 0; /* Testcase name */
31914
31915 for(i=1; i<nArg; i++){
31916 char *z = azArg[i];
31917 if( z[0]=='-' && z[1]=='-' && z[2]!=0 ) z++;
31918 if( optionMatch(z,"error-prefix") ){
31919 if( i+1>=nArg ){
31920 dotCmdError(p, i, "missing argument", 0);
31921 return 1;
31922 }
31923 free(p->zErrPrefix);
31924 i++;
31925 p->zErrPrefix = azArg[i][0]==0 ? 0 : strdup(azArg[i]);
31926 }else if( zName ){
31927 dotCmdError(p, i, "unknown option", 0);
31928 return 1;
31929 }else{
31930 zName = azArg[i];
31931 }
31932 }
31933 output_reset(p);
31934 if( cli_output_capture ){
31935 sqlite3_str_free(cli_output_capture);
31936 }
31937 cli_output_capture = sqlite3_str_new(0);
31938 if( zName ){
31939 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", zName);
31940 }else{
31941 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s:%lld",
31942 p->zInFile, p->lineno);
31943 }
31944 return 0;
31945 }
31946
31947 /*
31948 ** Enlarge the space allocated in p->dot so that it can hold more
31949 ** than nArg parsed command-line arguments.
31950 */
@@ -31360,11 +31973,11 @@
31973 free(p->dot.zCopy);
31974 z = p->dot.zCopy = strdup(zLine);
31975 shell_check_oom(z);
31976 szLine = strlen(z);
31977 while( szLine>0 && IsSpace(z[szLine-1]) ) szLine--;
31978 if( szLine>0 && z[szLine-1]==';' ){
31979 szLine--;
31980 while( szLine>0 && IsSpace(z[szLine-1]) ) szLine--;
31981 }
31982 z[szLine] = 0;
31983 parseDotRealloc(p, 2);
@@ -31580,35 +32193,17 @@
32193 eputz("Usage: .changes on|off\n");
32194 rc = 1;
32195 }
32196 }else
32197
 
32198 /* Cancel output redirection, if it is currently set (by .testcase)
32199 ** Then read the content of the testcase-out.txt file and compare against
32200 ** azArg[1]. If there are differences, report an error and exit.
32201 */
32202 if( c=='c' && n>=3 && cli_strncmp(azArg[0], "check", n)==0 ){
32203 rc = dotCmdCheck(p);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32204 }else
 
32205
32206 #ifndef SQLITE_SHELL_FIDDLE
32207 if( c=='c' && cli_strncmp(azArg[0], "clone", n)==0 ){
32208 failIfSafeMode(p, "cannot run .clone in safe mode");
32209 if( nArg==2 ){
@@ -32187,10 +32782,11 @@
32782 }else
32783
32784 if( c=='h' && cli_strncmp(azArg[0], "headers", n)==0 ){
32785 if( nArg==2 ){
32786 p->mode.spec.bTitles = booleanValue(azArg[1]) ? QRF_Yes : QRF_No;
32787 p->mode.mFlags |= MFLG_HDR;
32788 p->mode.spec.eTitle = aModeInfo[p->mode.eMode].eHdr;
32789 }else{
32790 eputz("Usage: .headers on|off\n");
32791 rc = 1;
32792 }
@@ -32240,14 +32836,14 @@
32836 sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1);
32837 goto meta_command_exit;
32838 }
32839 zSql = sqlite3_mprintf(
32840 "SELECT rootpage, 0 FROM sqlite_schema"
32841 " WHERE type='index' AND lower(name)=lower('%q')"
32842 "UNION ALL "
32843 "SELECT rootpage, 1 FROM sqlite_schema"
32844 " WHERE type='table' AND lower(name)=lower('%q')"
32845 " AND sql LIKE '%%without%%rowid%%'",
32846 azArg[1], azArg[1]
32847 );
32848 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
32849 sqlite3_free(zSql);
@@ -32401,13 +32997,14 @@
32997 goto meta_command_exit;
32998 }
32999 if( nArg==3 ){
33000 sqlite3_limit(p->db, aLimit[iLimit].limitCode,
33001 (int)integerValue(azArg[2]));
33002 }else{
33003 cli_printf(stdout, "%20s %d\n", aLimit[iLimit].zLimitName,
33004 sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1));
33005 }
 
 
33006 }
33007 }else
33008
33009 if( c=='l' && n>2 && cli_strncmp(azArg[0], "lint", n)==0 ){
33010 open_db(p, 0);
@@ -32493,21 +33090,23 @@
33090 int iName = 1; /* Index in azArg[] of the filename */
33091 int newFlag = 0; /* True to delete file before opening */
33092 int openMode = SHELL_OPEN_UNSPEC;
33093 int openFlags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
33094
33095 if( p->bSafeMode ) openFlags = SQLITE_OPEN_READONLY;
33096
33097 /* Check for command-line arguments */
33098 for(iName=1; iName<nArg; iName++){
33099 const char *z = azArg[iName];
33100 #ifndef SQLITE_SHELL_FIDDLE
33101 if( optionMatch(z,"new") ){
33102 newFlag = 1;
33103 #ifdef SQLITE_HAVE_ZLIB
33104 }else if( optionMatch(z, "zip") && !p->bSafeMode ){
33105 openMode = SHELL_OPEN_ZIPFILE;
33106 #endif
33107 }else if( optionMatch(z, "append") && !p->bSafeMode ){
33108 openMode = SHELL_OPEN_APPENDVFS;
33109 }else if( optionMatch(z, "readonly") ){
33110 openFlags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
33111 openFlags |= SQLITE_OPEN_READONLY;
33112 }else if( optionMatch(z, "exclusive") ){
@@ -32950,21 +33549,22 @@
33549 || sqlite3_strlike(zName, "sqlite_schema", '\\')==0
33550 || sqlite3_strlike(zName,"sqlite_temp_master", '\\')==0
33551 || sqlite3_strlike(zName,"sqlite_temp_schema", '\\')==0;
33552 if( isSchema ){
33553 cli_printf(p->out,
33554 "CREATE TABLE %ssqlite_schema (\n"
33555 " type text,\n"
33556 " name text,\n"
33557 " tbl_name text,\n"
33558 " rootpage integer,\n"
33559 " sql text\n"
33560 ");\n",
33561 sqlite3_strlike("sqlite_t%",zName,0)==0 ? "temp." : ""
33562 );
33563 }
33564 }
33565 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
 
33566 if( rc ){
33567 shellDatabaseError(p->db);
33568 sqlite3_finalize(pStmt);
33569
33570 rc = 1;
@@ -32972,11 +33572,11 @@
33572 }
33573 pSql = sqlite3_str_new(p->db);
33574 sqlite3_str_appendf(pSql, "SELECT sql FROM", 0);
33575 iSchema = 0;
33576 while( sqlite3_step(pStmt)==SQLITE_ROW ){
33577 const char *zDb = (const char*)sqlite3_column_text(pStmt, 1);
33578 char zScNum[30];
33579 sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema);
33580 sqlite3_str_appendall(pSql, zDiv);
33581 zDiv = " UNION ALL ";
33582 if( sqlite3_stricmp(zDb, "main")==0 ){
@@ -32992,11 +33592,12 @@
33592 " AS sql, type, tbl_name, name, rowid, %d AS snum, %Q as sname",
33593 ++iSchema, zDb);
33594 sqlite3_str_appendf(pSql," FROM \"%w\".sqlite_schema", zDb);
33595 }
33596 sqlite3_finalize(pStmt);
33597 #if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) \
33598 && !defined(SQLITE_OMIT_VIRTUALTABLE)
33599 if( zName ){
33600 sqlite3_str_appendall(pSql,
33601 " UNION ALL SELECT shell_module_schema(name),"
33602 " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list");
33603 }
@@ -33016,11 +33617,11 @@
33617 }else{
33618 sqlite3_str_appendf(pSql, " LIKE %Q ESCAPE '\\' AND ", zName);
33619 }
33620 }
33621 if( bNoSystemTabs ){
33622 sqlite3_str_appendf(pSql, " name NOT LIKE 'sqlite__%%' ESCAPE '_' AND ");
33623 }
33624 sqlite3_str_appendf(pSql, "sql IS NOT NULL ORDER BY snum, rowid");
33625 if( bDebug ){
33626 cli_printf(p->out, "SQL: %s;\n", sqlite3_str_value(pSql));
33627 }else{
@@ -33734,25 +34335,15 @@
34335 sqlite3_str_free(pSql);
34336 modePop(p);
34337 if( rc ) return shellDatabaseError(p->db);
34338 }else
34339
34340 /* Set the p->zTestcase name and begin redirecting output into
34341 ** the cli_output_capture sqlite3_str */
34342 if( c=='t' && cli_strcmp(azArg[0],"testcase")==0 ){
34343 rc = dotCmdTestcase(p);
 
 
 
 
 
 
 
 
 
34344 }else
 
34345
34346 #ifndef SQLITE_UNTESTABLE
34347 if( c=='t' && n>=8 && cli_strncmp(azArg[0], "testctrl", n)==0 ){
34348 static const struct {
34349 const char *zCtrlName; /* Name of a test-control option */
@@ -35068,11 +35659,10 @@
35659 " -bail stop after hitting an error\n"
35660 " -batch force batch I/O\n"
35661 " -box set output mode to 'box'\n"
35662 " -cmd COMMAND run \"COMMAND\" before reading stdin\n"
35663 " -column set output mode to 'column'\n"
 
35664 " -csv set output mode to 'csv'\n"
35665 #if !defined(SQLITE_OMIT_DESERIALIZE)
35666 " -deserialize open the database using sqlite3_deserialize()\n"
35667 #endif
35668 " -echo print inputs before execution\n"
@@ -35152,15 +35742,10 @@
35742 /*
35743 ** Initialize the state information in data
35744 */
35745 static void main_init(ShellState *p) {
35746 memset(p, 0, sizeof(*p));
 
 
 
 
 
35747 p->pAuxDb = &p->aAuxDb[0];
35748 p->shellFlgs = SHFLG_Lookaside;
35749 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, p);
35750 #if !defined(SQLITE_SHELL_FIDDLE)
35751 verify_uninitialized();
@@ -35174,22 +35759,18 @@
35759 /*
35760 ** Output text to the console in a font that attracts extra attention.
35761 */
35762 #if defined(_WIN32) || defined(WIN32)
35763 static void printBold(const char *zText){
 
35764 HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
35765 CONSOLE_SCREEN_BUFFER_INFO defaultScreenInfo;
35766 GetConsoleScreenBufferInfo(out, &defaultScreenInfo);
35767 SetConsoleTextAttribute(out,
35768 FOREGROUND_RED|FOREGROUND_INTENSITY
35769 );
 
35770 sputz(stdout, zText);
 
35771 SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes);
 
35772 }
35773 #else
35774 static void printBold(const char *zText){
35775 cli_printf(stdout, "\033[1m%s\033[0m", zText);
35776 }
@@ -35219,29 +35800,65 @@
35800 cli_puts(z, p->out);
35801 fflush(p->out);
35802 return 1;
35803 }
35804
35805 /* Alternative name to the entry point for Fiddle */
 
 
 
 
 
 
 
 
35806 #ifdef SQLITE_SHELL_FIDDLE
35807 # define main fiddle_main
35808 #endif
35809
35810 /* Use the wmain() entry point on Windows. Translate arguments to
35811 ** UTF8, then invoke the traditional main() entry point which is
35812 ** renamed using a #define to utf8_main() .
35813 */
35814 #if defined(_WIN32) && !defined(main)
35815 # define main utf8_main /* Rename entry point to utf_main() */
35816 int SQLITE_CDECL utf8_main(int,char**); /* Forward declaration */
35817 int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
35818 int rc, i;
35819 char **argv = malloc( sizeof(char*) * (argc+1) );
35820 char **orig = argv;
35821 if( argv==0 ){
35822 fprintf(stderr, "malloc failed\n");
35823 exit(1);
35824 }
35825 for(i=0; i<argc; i++){
35826 int nByte = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, 0, 0, 0, 0);
35827 if( nByte==0 ){
35828 argv[i] = 0;
35829 }else{
35830 argv[i] = malloc( nByte );
35831 if( argv[i]==0 ){
35832 fprintf(stderr, "malloc failed\n");
35833 exit(1);
35834 }
35835 nByte = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, argv[i],nByte,0,0);
35836 if( nByte==0 ){
35837 free(argv[i]);
35838 argv[i] = 0;
35839 }
35840 }
35841 }
35842 argv[argc] = 0;
35843 rc = utf8_main(argc, argv);
35844 for(i=0; i<argc; i++) free(orig[i]);
35845 free(argv);
35846 return rc;
35847 }
35848 #endif /* WIN32 */
35849
35850 /*
35851 ** This is the main entry point for the process. Everything starts here.
35852 **
35853 ** The "main" identifier may have been #defined to something else:
35854 **
35855 ** utf8_main On Windows
35856 ** fiddle_main In Fiddle
35857 ** sqlite3_shell Other projects that use shell.c as a subroutine
35858 */
35859 int SQLITE_CDECL main(int argc, char **argv){
35860 #ifdef SQLITE_DEBUG
35861 sqlite3_int64 mem_main_enter = 0;
35862 #endif
35863 char *zErrMsg = 0;
35864 #ifdef SQLITE_SHELL_FIDDLE
@@ -35259,14 +35876,10 @@
35876 int nOptsEnd = argc;
35877 int bEnableVfstrace = 0;
35878 char **azCmd = 0;
35879 int *aiCmd = 0;
35880 const char *zVfs = 0; /* Value of -vfs command-line option */
 
 
 
 
35881 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
35882
35883 #ifdef SQLITE_SHELL_FIDDLE
35884 stdin_is_interactive = 0;
35885 stdout_is_console = 1;
@@ -35291,15 +35904,11 @@
35904 ){
35905 exit(1);
35906 }
35907 }else{
35908 #if defined(_WIN32) || defined(WIN32)
 
 
 
35909 DebugBreak();
 
35910 #elif defined(SIGTRAP)
35911 raise(SIGTRAP);
35912 #endif
35913 }
35914 }
@@ -35321,36 +35930,10 @@
35930 exit(1);
35931 }
35932 #endif
35933 main_init(&data);
35934
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35935 assert( argc>=1 && argv && argv[0] );
35936 Argv0 = argv[0];
35937
35938 #ifdef SQLITE_SHELL_DBNAME_PROC
35939 {
@@ -35362,11 +35945,11 @@
35945 SQLITE_SHELL_DBNAME_PROC(&data.pAuxDb->zDbFilename);
35946 warnInmemoryDb = 0;
35947 }
35948 #endif
35949
35950 /* Do an initial pass through the command-line arguments to locate
35951 ** the name of the database file, the name of the initialization file,
35952 ** the size of the alternative malloc heap, options affecting commands
35953 ** or SQL run from the command line, and the first command to execute.
35954 */
35955 #ifndef SQLITE_SHELL_FIDDLE
@@ -35374,11 +35957,11 @@
35957 #endif
35958 for(i=1; i<argc; i++){
35959 char *z;
35960 z = argv[i];
35961 if( z[0]!='-' || i>nOptsEnd ){
35962 if( data.aAuxDb->zDbFilename==0 && !isScriptFile(z,1) ){
35963 data.aAuxDb->zDbFilename = z;
35964 }else{
35965 /* Excess arguments are interpreted as SQL (or dot-commands) and
35966 ** mean that nothing is read from stdin */
35967 readStdin = 0;
@@ -35419,15 +36002,10 @@
36002 if( n<2 ){
36003 sqlite3_fprintf(stderr,"minimum --screenwidth is 2\n");
36004 exit(1);
36005 }
36006 stdout_tty_width = n;
 
 
 
 
 
36007 }else if( cli_strcmp(z,"-utf8")==0 ){
36008 }else if( cli_strcmp(z,"-no-utf8")==0 ){
36009 }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
36010 int val = 0;
36011 sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW, &val);
@@ -35547,10 +36125,20 @@
36125 }else if( cli_strcmp(z,"-safe")==0 ){
36126 /* no-op - catch this on the second pass */
36127 }else if( cli_strcmp(z,"-escape")==0 && i+1<argc ){
36128 /* skip over the argument */
36129 i++;
36130 }else if( cli_strcmp(z,"-test-argv")==0 ){
36131 /* Undocumented test option. Print the values in argv[] and exit.
36132 ** Use this to verify that any translation of the argv[], for example
36133 ** on Windows that receives wargv[] from the OS and must convert
36134 ** to UTF8 prior to calling this routine. */
36135 int kk;
36136 for(kk=0; kk<argc; kk++){
36137 sqlite3_fprintf(stdout,"argv[%d] = \"%s\"\n", kk, argv[kk]);
36138 }
36139 return 0;
36140 }
36141 }
36142 #ifndef SQLITE_SHELL_FIDDLE
36143 if( !bEnableVfstrace ) verify_uninitialized();
36144 #endif
@@ -35573,11 +36161,30 @@
36161
36162 if( zVfs ){
36163 sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
36164 if( pVfs ){
36165 sqlite3_vfs_register(pVfs, 1);
36166 }
36167 #if !defined(SQLITE_OMIT_LOAD_EXTENSION)
36168 else if( access(zVfs,0)==0 ){
36169 /* If the VFS name is not the name of an existing VFS, but it is
36170 ** the name of a file, then try to load that file as an extension.
36171 ** Presumably the extension implements the desired VFS. */
36172 sqlite3 *db = 0;
36173 char *zErr = 0;
36174 sqlite3_open(":memory:", &db);
36175 sqlite3_enable_load_extension(db, 1);
36176 rc = sqlite3_load_extension(db, zVfs, 0, &zErr);
36177 sqlite3_close(db);
36178 if( (rc&0xff)!=SQLITE_OK ){
36179 cli_printf(stderr, "could not load extension VFS \"%s\": %s\n",
36180 zVfs, zErr);
36181 exit(1);
36182 }
36183 }
36184 #endif
36185 else{
36186 cli_printf(stderr,"no such VFS: \"%s\"\n", zVfs);
36187 exit(1);
36188 }
36189 }
36190
@@ -35586,11 +36193,12 @@
36193 data.pAuxDb->zDbFilename = ":memory:";
36194 warnInmemoryDb = argc==1;
36195 #else
36196 cli_printf(stderr,
36197 "%s: Error: no database filename specified\n", Argv0);
36198 rc = 1;
36199 goto shell_main_exit;
36200 #endif
36201 }
36202 data.out = stdout;
36203 if( bEnableVfstrace ){
36204 vfstrace_register("trace",0,vfstraceOut, &data, 1);
@@ -35613,11 +36221,11 @@
36221 ** is given on the command line, look for a file named ~/.sqliterc and
36222 ** try to process it.
36223 */
36224 if( !noInit ) process_sqliterc(&data,zInitFile);
36225
36226 /* Make a second pass through the command-line arguments and set
36227 ** options. This second pass is delayed until after the initialization
36228 ** file is processed so that the command-line arguments will override
36229 ** settings in the initialization file.
36230 */
36231 for(i=1; i<argc; i++){
@@ -35640,10 +36248,12 @@
36248 modeChange(&data, MODE_Json);
36249 }else if( cli_strcmp(z,"-markdown")==0 ){
36250 modeChange(&data, MODE_Markdown);
36251 }else if( cli_strcmp(z,"-table")==0 ){
36252 modeChange(&data, MODE_Table);
36253 }else if( cli_strcmp(z,"-psql")==0 ){
36254 modeChange(&data, MODE_Psql);
36255 }else if( cli_strcmp(z,"-box")==0 ){
36256 modeChange(&data, MODE_Box);
36257 }else if( cli_strcmp(z,"-csv")==0 ){
36258 modeChange(&data, MODE_Csv);
36259 }else if( cli_strcmp(z,"-escape")==0 && i+1<argc ){
@@ -35726,22 +36336,21 @@
36336 }else if( cli_strcmp(z,"-bail")==0 ){
36337 /* No-op. The bail_on_error flag should already be set. */
36338 }else if( cli_strcmp(z,"-version")==0 ){
36339 cli_printf(stdout, "%s %s (%d-bit)\n",
36340 sqlite3_libversion(), sqlite3_sourceid(), 8*(int)sizeof(char*));
36341 rc = 0;
36342 goto shell_main_exit;
36343 }else if( cli_strcmp(z,"-interactive")==0 ){
36344 /* Need to check for interactive override here to so that it can
36345 ** affect console setup (for Windows only) and testing thereof.
36346 */
36347 stdin_is_interactive = 1;
36348 }else if( cli_strcmp(z,"-batch")==0 ){
36349 /* already handled */
36350 }else if( cli_strcmp(z,"-screenwidth")==0 ){
36351 i++;
 
 
36352 }else if( cli_strcmp(z,"-utf8")==0 ){
36353 /* already handled */
36354 }else if( cli_strcmp(z,"-no-utf8")==0 ){
36355 /* already handled */
36356 }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
@@ -35783,29 +36392,33 @@
36392 ** we retain the goofy behavior for historical compatibility. */
36393 if( i==argc-1 ) break;
36394 z = cmdline_option_value(argc,argv,++i);
36395 if( z[0]=='.' ){
36396 rc = do_meta_command(z, &data);
36397 if( rc && bail_on_error ){
36398 if( rc==2 ) rc = 0;
36399 goto shell_main_exit;
36400 }
36401 }else{
36402 open_db(&data, 0);
36403 rc = shell_exec(&data, z, &zErrMsg);
36404 if( zErrMsg!=0 ){
36405 shellEmitError(zErrMsg);
36406 sqlite3_free(zErrMsg);
36407 if( !rc ) rc = 1;
36408 }else if( rc!=0 ){
36409 cli_printf(stderr,"Error: unable to process SQL \"%s\"\n", z);
 
36410 }
36411 if( bail_on_error ) goto shell_main_exit;
36412 }
36413 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
36414 }else if( cli_strncmp(z, "-A", 2)==0 ){
36415 if( nCmd>0 ){
36416 cli_printf(stderr,"Error: cannot mix regular SQL or dot-commands"
36417 " with \"%s\"\n", z);
36418 rc = 1;
36419 goto shell_main_exit;
36420 }
36421 open_db(&data, OPEN_DB_ZIPFILE);
36422 if( z[2] ){
36423 argv[i] = &z[2];
36424 arDotCommand(&data, 1, argv+(i-1), argc-(i-1));
@@ -35821,11 +36434,12 @@
36434 }else if( cli_strcmp(z,"-unsafe-testing")==0 ){
36435 /* Acted upon in first pass. */
36436 }else{
36437 cli_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
36438 eputz("Use -help for a list of options.\n");
36439 rc = 1;
36440 goto shell_main_exit;
36441 }
36442 }
36443
36444 if( !readStdin ){
36445 /* Run all arguments that do not begin with '-' as if they were separate
@@ -35832,11 +36446,22 @@
36446 ** command-line inputs, except for the argToSkip argument which contains
36447 ** the database filename.
36448 */
36449 for(i=0; i<nCmd; i++){
36450 echo_group_input(&data, azCmd[i]);
36451 if( isScriptFile(azCmd[i],0) ){
36452 FILE *inSaved = data.in;
36453 i64 savedLineno = data.lineno;
36454 int res = 1;
36455 if( (data.in = openChrSource(azCmd[i]))!=0 ){
36456 res = process_input(&data, azCmd[i]);
36457 fclose(data.in);
36458 }
36459 data.in = inSaved;
36460 data.lineno = savedLineno;
36461 if( res ) i = nCmd;
36462 }else if( azCmd[i][0]=='.' ){
36463 char *zErrCtx = malloc( 64 );
36464 shell_check_oom(zErrCtx);
36465 sqlite3_snprintf(64,zErrCtx,"argv[%i]:",aiCmd[i]);
36466 data.zInFile = "<cmdline>";
36467 data.zErrPrefix = zErrCtx;
@@ -35947,14 +36572,10 @@
36572 }
36573 find_home_dir(1);
36574 output_reset(&data);
36575 data.doXdgOpen = 0;
36576 clearTempFile(&data);
 
 
 
 
36577 modeFree(&data.mode);
36578 if( data.nSavedModes ){
36579 int ii;
36580 for(ii=0; ii<data.nSavedModes; ii++){
36581 modeFree(&data.aSavedModes[ii].mode);
36582
+2565 -2637
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21
-** 5804ba4874cc41b11e8bb559d5533283c289 with changes in files:
21
+** 9adab8b2bef4130abd358d53384cb5f4dd69 with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467467
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468468
** [sqlite_version()] and [sqlite_source_id()].
469469
*/
470470
#define SQLITE_VERSION "3.52.0"
471471
#define SQLITE_VERSION_NUMBER 3052000
472
-#define SQLITE_SOURCE_ID "2025-11-25 18:20:33 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911"
472
+#define SQLITE_SOURCE_ID "2026-01-09 00:41:35 9adab8b2bef4130abd358d53384cb5f4dd691b808336bb7102793b0165b1c516"
473473
#define SQLITE_SCM_BRANCH "trunk"
474474
#define SQLITE_SCM_TAGS ""
475
-#define SQLITE_SCM_DATETIME "2025-11-25T18:20:33.534Z"
475
+#define SQLITE_SCM_DATETIME "2026-01-09T00:41:35.433Z"
476476
477477
/*
478478
** CAPI3REF: Run-Time Library Version Numbers
479479
** KEYWORDS: sqlite3_version sqlite3_sourceid
480480
**
@@ -1809,11 +1809,11 @@
18091809
** ^SQLite will use the xCurrentTimeInt64() method to get the current
18101810
** date and time if that method is available (if iVersion is 2 or
18111811
** greater and the function pointer is not NULL) and will fall back
18121812
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
18131813
**
1814
-** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
1814
+** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
18151815
** are not used by the SQLite core. These optional interfaces are provided
18161816
** by some VFSes to facilitate testing of the VFS code. By overriding
18171817
** system calls with functions under its control, a test program can
18181818
** simulate faults and error conditions that would otherwise be difficult
18191819
** or impossible to induce. The set of system calls that can be overridden
@@ -4493,10 +4493,11 @@
44934493
** <li> sqlite3_errcode()
44944494
** <li> sqlite3_extended_errcode()
44954495
** <li> sqlite3_errmsg()
44964496
** <li> sqlite3_errmsg16()
44974497
** <li> sqlite3_error_offset()
4498
+** <li> sqlite3_db_handle()
44984499
** </ul>
44994500
**
45004501
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
45014502
** text that describes the error, as either UTF-8 or UTF-16 respectively,
45024503
** or NULL if no error message is available.
@@ -4751,16 +4752,32 @@
47514752
** compiles to see if some SQL syntax is well-formed, without generating
47524753
** messages on the global error log when it is not. If the test compile
47534754
** fails, the sqlite3_prepare_v3() call returns the same error indications
47544755
** with or without this flag; it just omits the call to [sqlite3_log()] that
47554756
** logs the error.
4757
+**
4758
+** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt>
4759
+** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to behave as if
4760
+** the SQL statement is part of a database schema. This makes a difference
4761
+** when the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] option is set to off.
4762
+** When this option is used and SQLITE_DBCONFIG_TRUSTED_SCHEMA is off,
4763
+** SQL functions may not be called unless they are tagged with
4764
+** [SQLITE_INNOCUOUS] and virtual tables may not be used unless tagged
4765
+** with [SQLITE_VTAB_INNOCUOUS]. Use the SQLITE_PREPARE_FROM_DDL option
4766
+** when preparing SQL that is derived from parts of the database
4767
+** schema. In particular, virtual table implementations that
4768
+** run SQL statements based on the arguments to their CREATE VIRTUAL
4769
+** TABLE statement should use [sqlite3_prepare_v3()] and set the
4770
+** SQLITE_PREPARE_FROM_DLL flag to prevent bypass of the
4771
+** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks.
47564772
** </dl>
47574773
*/
47584774
#define SQLITE_PREPARE_PERSISTENT 0x01
47594775
#define SQLITE_PREPARE_NORMALIZE 0x02
47604776
#define SQLITE_PREPARE_NO_VTAB 0x04
47614777
#define SQLITE_PREPARE_DONT_LOG 0x10
4778
+#define SQLITE_PREPARE_FROM_DDL 0x20
47624779
47634780
/*
47644781
** CAPI3REF: Compiling An SQL Statement
47654782
** KEYWORDS: {SQL statement compiler}
47664783
** METHOD: sqlite3
@@ -4770,12 +4787,13 @@
47704787
** program using one of these routines. Or, in other words, these routines
47714788
** are constructors for the [prepared statement] object.
47724789
**
47734790
** The preferred routine to use is [sqlite3_prepare_v2()]. The
47744791
** [sqlite3_prepare()] interface is legacy and should be avoided.
4775
-** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
4776
-** for special purposes.
4792
+** [sqlite3_prepare_v3()] has an extra
4793
+** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is some times
4794
+** needed for special purpose or to pass along security restrictions.
47774795
**
47784796
** The use of the UTF-8 interfaces is preferred, as SQLite currently
47794797
** does all parsing using UTF-8. The UTF-16 interfaces are provided
47804798
** as a convenience. The UTF-16 interfaces work by converting the
47814799
** input text into UTF-8, then invoking the corresponding UTF-8 interface.
@@ -6605,14 +6623,18 @@
66056623
** use for client data is to provide a mechanism for wrapper libraries
66066624
** to store additional information about an SQLite database connection.
66076625
**
66086626
** There is no limit (other than available memory) on the number of different
66096627
** client data pointers (with different names) that can be attached to a
6610
-** single database connection. However, the implementation is optimized
6611
-** for the case of having only one or two different client data names.
6612
-** Applications and wrapper libraries are discouraged from using more than
6613
-** one client data name each.
6628
+** single database connection. However, the current implementation stores
6629
+** the content on a linked list. Insert and retrieval performance will
6630
+** be proportional to the number of entries. The design use case, and
6631
+** the use case for which the implementation is optimized, is
6632
+** that an application will store only small number of client data names,
6633
+** typically just one or two. This interface is not intended to be a
6634
+** generalized key/value store for thousands or millions of keys. It
6635
+** will work for that, but performance might be disappointing.
66146636
**
66156637
** There is no way to enumerate the client data pointers
66166638
** associated with a database connection. The N parameter can be thought
66176639
** of as a secret key such that only code that knows the secret key is able
66186640
** to access the associated data.
@@ -7745,22 +7767,22 @@
77457767
** ^This interface loads an SQLite extension library from the named file.
77467768
**
77477769
** ^The sqlite3_load_extension() interface attempts to load an
77487770
** [SQLite extension] library contained in the file zFile. If
77497771
** the file cannot be loaded directly, attempts are made to load
7750
-** with various operating-system specific extensions added.
7772
+** with various operating-system specific filename extensions added.
77517773
** So for example, if "samplelib" cannot be loaded, then names like
77527774
** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
77537775
** be tried also.
77547776
**
77557777
** ^The entry point is zProc.
77567778
** ^(zProc may be 0, in which case SQLite will try to come up with an
77577779
** entry point name on its own. It first tries "sqlite3_extension_init".
7758
-** If that does not work, it constructs a name "sqlite3_X_init" where
7759
-** X consists of the lower-case equivalent of all ASCII alphabetic
7760
-** characters in the filename from the last "/" to the first following
7761
-** "." and omitting any initial "lib".)^
7780
+** If that does not work, it tries names of the form "sqlite3_X_init"
7781
+** where X consists of the lower-case equivalent of all ASCII alphabetic
7782
+** characters or all ASCII alphanumeric characters in the filename from
7783
+** the last "/" to the first following "." and omitting any initial "lib".)^
77627784
** ^The sqlite3_load_extension() interface returns
77637785
** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
77647786
** ^If an error occurs and pzErrMsg is not 0, then the
77657787
** [sqlite3_load_extension()] interface shall attempt to
77667788
** fill *pzErrMsg with error message text stored in memory
@@ -9049,11 +9071,11 @@
90499071
** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
90509072
** that contains the constructed string. The calling application should
90519073
** pass the returned value to [sqlite3_free()] to avoid a memory leak.
90529074
** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
90539075
** errors were encountered during construction of the string. ^The
9054
-** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
9076
+** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
90559077
** string in [sqlite3_str] object X is zero bytes long.
90569078
**
90579079
** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
90589080
** X and the string content it contains. Calling sqlite3_str_free(X) is
90599081
** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
@@ -14386,10 +14408,13 @@
1438614408
** The maximum length of a single SQL statement in bytes.
1438714409
**
1438814410
** It used to be the case that setting this value to zero would
1438914411
** turn the limit off. That is no longer true. It is not possible
1439014412
** to turn this limit off.
14413
+**
14414
+** The hard limit is the largest possible 32-bit signed integer less
14415
+** 1024, or 2147482624.
1439114416
*/
1439214417
#ifndef SQLITE_MAX_SQL_LENGTH
1439314418
# define SQLITE_MAX_SQL_LENGTH 1000000000
1439414419
#endif
1439514420
@@ -17525,11 +17550,11 @@
1752517550
1752617551
/*
1752717552
** Additional non-public SQLITE_PREPARE_* flags
1752817553
*/
1752917554
#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
17530
-#define SQLITE_PREPARE_MASK 0x1f /* Mask of public flags */
17555
+#define SQLITE_PREPARE_MASK 0x3f /* Mask of public flags */
1753117556
1753217557
/*
1753317558
** Prototypes for the VDBE interface. See comments on the implementation
1753417559
** for a description of what each of these routines does.
1753517560
*/
@@ -20765,23 +20790,23 @@
2076520790
**
2076620791
** (op == TK_INSERT)
2076720792
** orconf -> stores the ON CONFLICT algorithm
2076820793
** pSelect -> The content to be inserted - either a SELECT statement or
2076920794
** a VALUES clause.
20770
-** zTarget -> Dequoted name of the table to insert into.
20795
+** pSrc -> Table to insert into.
2077120796
** pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
2077220797
** statement, then this stores the column-names to be
2077320798
** inserted into.
2077420799
** pUpsert -> The ON CONFLICT clauses for an Upsert
2077520800
**
2077620801
** (op == TK_DELETE)
20777
-** zTarget -> Dequoted name of the table to delete from.
20802
+** pSrc -> Table to delete from
2077820803
** pWhere -> The WHERE clause of the DELETE statement if one is specified.
2077920804
** Otherwise NULL.
2078020805
**
2078120806
** (op == TK_UPDATE)
20782
-** zTarget -> Dequoted name of the table to update.
20807
+** pSrc -> Table to update, followed by any FROM clause tables.
2078320808
** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
2078420809
** Otherwise NULL.
2078520810
** pExprList -> A list of the columns to update and the expressions to update
2078620811
** them to. See sqlite3Update() documentation of "pChanges"
2078720812
** argument.
@@ -20797,12 +20822,11 @@
2079720822
u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT,
2079820823
** or TK_RETURNING */
2079920824
u8 orconf; /* OE_Rollback etc. */
2080020825
Trigger *pTrig; /* The trigger that this step is a part of */
2080120826
Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
20802
- char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
20803
- SrcList *pFrom; /* FROM clause for UPDATE statement (if any) */
20827
+ SrcList *pSrc; /* Table to insert/update/delete */
2080420828
Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
2080520829
ExprList *pExprList; /* SET clause for UPDATE, or RETURNING clause */
2080620830
IdList *pIdList; /* Column names for INSERT */
2080720831
Upsert *pUpsert; /* Upsert clauses on an INSERT */
2080820832
char *zSpan; /* Original SQL text of this command */
@@ -21547,10 +21571,11 @@
2154721571
#ifdef SQLITE_DEBUG
2154821572
SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
2154921573
#endif
2155021574
SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
2155121575
SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
21576
+SQLITE_PRIVATE Expr *sqlite3ExprInt32(sqlite3*,int);
2155221577
SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
2155321578
SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
2155421579
SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
2155521580
SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
2155621581
SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*);
@@ -21865,21 +21890,20 @@
2186521890
SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int);
2186621891
void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
2186721892
SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
2186821893
SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
2186921894
const char*,const char*);
21870
-SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,Token*, IdList*,
21895
+SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,SrcList*, IdList*,
2187121896
Select*,u8,Upsert*,
2187221897
const char*,const char*);
21873
-SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,Token*,SrcList*,ExprList*,
21898
+SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,SrcList*,SrcList*,ExprList*,
2187421899
Expr*, u8, const char*,const char*);
21875
-SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,Token*, Expr*,
21900
+SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,SrcList*, Expr*,
2187621901
const char*,const char*);
2187721902
SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*);
2187821903
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
2187921904
SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);
21880
-SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(Parse*, TriggerStep*);
2188121905
# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
2188221906
# define sqlite3IsToplevel(p) ((p)->pToplevel==0)
2188321907
#else
2188421908
# define sqlite3TriggersExist(B,C,D,E,F) 0
2188521909
# define sqlite3DeleteTrigger(A,B)
@@ -21889,11 +21913,10 @@
2188921913
# define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)
2189021914
# define sqlite3TriggerList(X, Y) 0
2189121915
# define sqlite3ParseToplevel(p) p
2189221916
# define sqlite3IsToplevel(p) 1
2189321917
# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
21894
-# define sqlite3TriggerStepSrc(A,B) 0
2189521918
#endif
2189621919
2189721920
SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
2189821921
SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
2189921922
SQLITE_PRIVATE void sqlite3SrcItemColumnUsed(SrcItem*,int);
@@ -30648,18 +30671,10 @@
3064830671
# define SQLITE_OS_WINCE 1
3064930672
#else
3065030673
# define SQLITE_OS_WINCE 0
3065130674
#endif
3065230675
30653
-/*
30654
-** Determine if we are dealing with WinRT, which provides only a subset of
30655
-** the full Win32 API.
30656
-*/
30657
-#if !defined(SQLITE_OS_WINRT)
30658
-# define SQLITE_OS_WINRT 0
30659
-#endif
30660
-
3066130676
/*
3066230677
** For WinCE, some API function parameters do not appear to be declared as
3066330678
** volatile.
3066430679
*/
3066530680
#if SQLITE_OS_WINCE
@@ -30670,11 +30685,11 @@
3067030685
3067130686
/*
3067230687
** For some Windows sub-platforms, the _beginthreadex() / _endthreadex()
3067330688
** functions are not available (e.g. those not using MSVC, Cygwin, etc).
3067430689
*/
30675
-#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
30690
+#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && \
3067630691
SQLITE_THREADSAFE>0 && !defined(__CYGWIN__)
3067730692
# define SQLITE_OS_WIN_THREADS 1
3067830693
#else
3067930694
# define SQLITE_OS_WIN_THREADS 0
3068030695
#endif
@@ -30787,15 +30802,11 @@
3078730802
static int winMutexInit(void){
3078830803
/* The first to increment to 1 does actual initialization */
3078930804
if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
3079030805
int i;
3079130806
for(i=0; i<ArraySize(winMutex_staticMutexes); i++){
30792
-#if SQLITE_OS_WINRT
30793
- InitializeCriticalSectionEx(&winMutex_staticMutexes[i].mutex, 0, 0);
30794
-#else
3079530807
InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
30796
-#endif
3079730808
}
3079830809
winMutex_isInit = 1;
3079930810
}else{
3080030811
/* Another thread is (in the process of) initializing the static
3080130812
** mutexes */
@@ -30881,15 +30892,11 @@
3088130892
#ifdef SQLITE_DEBUG
3088230893
#ifdef SQLITE_WIN32_MUTEX_TRACE_DYNAMIC
3088330894
p->trace = 1;
3088430895
#endif
3088530896
#endif
30886
-#if SQLITE_OS_WINRT
30887
- InitializeCriticalSectionEx(&p->mutex, 0, 0);
30888
-#else
3088930897
InitializeCriticalSection(&p->mutex);
30890
-#endif
3089130898
}
3089230899
break;
3089330900
}
3089430901
default: {
3089530902
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -38298,11 +38305,11 @@
3829838305
3829938306
/*****************************************************************************
3830038307
** Debugging logic
3830138308
*/
3830238309
38303
-/* SQLITE_KV_TRACE() is used for tracing calls to kvstorage routines. */
38310
+/* SQLITE_KV_TRACE() is used for tracing calls to kvrecord routines. */
3830438311
#if 0
3830538312
#define SQLITE_KV_TRACE(X) printf X
3830638313
#else
3830738314
#define SQLITE_KV_TRACE(X)
3830838315
#endif
@@ -38312,18 +38319,22 @@
3831238319
#define SQLITE_KV_LOG(X) printf X
3831338320
#else
3831438321
#define SQLITE_KV_LOG(X)
3831538322
#endif
3831638323
38317
-
3831838324
/*
3831938325
** Forward declaration of objects used by this VFS implementation
3832038326
*/
3832138327
typedef struct KVVfsFile KVVfsFile;
3832238328
3832338329
/* A single open file. There are only two files represented by this
3832438330
** VFS - the database and the rollback journal.
38331
+**
38332
+** Maintenance reminder: if this struct changes in any way, the JSON
38333
+** rendering of its structure must be updated in
38334
+** sqlite3-wasm.c:sqlite3__wasm_enum_json(). There are no binary
38335
+** compatibility concerns, so it does not need an iVersion member.
3832538336
*/
3832638337
struct KVVfsFile {
3832738338
sqlite3_file base; /* IO methods */
3832838339
const char *zClass; /* Storage class */
3832938340
int isJournal; /* True if this is a journal file */
@@ -38369,11 +38380,11 @@
3836938380
static int kvvfsSleep(sqlite3_vfs*, int microseconds);
3837038381
static int kvvfsCurrentTime(sqlite3_vfs*, double*);
3837138382
static int kvvfsCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
3837238383
3837338384
static sqlite3_vfs sqlite3OsKvvfsObject = {
38374
- 1, /* iVersion */
38385
+ 2, /* iVersion */
3837538386
sizeof(KVVfsFile), /* szOsFile */
3837638387
1024, /* mxPathname */
3837738388
0, /* pNext */
3837838389
"kvvfs", /* zName */
3837938390
0, /* pAppData */
@@ -38445,42 +38456,56 @@
3844538456
#include <sys/stat.h>
3844638457
#include <unistd.h>
3844738458
3844838459
/* Forward declarations for the low-level storage engine
3844938460
*/
38450
-static int kvstorageWrite(const char*, const char *zKey, const char *zData);
38451
-static int kvstorageDelete(const char*, const char *zKey);
38452
-static int kvstorageRead(const char*, const char *zKey, char *zBuf, int nBuf);
38453
-#define KVSTORAGE_KEY_SZ 32
38461
+#ifndef SQLITE_WASM
38462
+/* In WASM builds these are implemented in JS. */
38463
+static int kvrecordWrite(const char*, const char *zKey, const char *zData);
38464
+static int kvrecordDelete(const char*, const char *zKey);
38465
+static int kvrecordRead(const char*, const char *zKey, char *zBuf, int nBuf);
38466
+#endif
38467
+#ifndef KVRECORD_KEY_SZ
38468
+#define KVRECORD_KEY_SZ 32
38469
+#endif
3845438470
3845538471
/* Expand the key name with an appropriate prefix and put the result
3845638472
** in zKeyOut[]. The zKeyOut[] buffer is assumed to hold at least
38457
-** KVSTORAGE_KEY_SZ bytes.
38473
+** KVRECORD_KEY_SZ bytes.
3845838474
*/
38459
-static void kvstorageMakeKey(
38475
+static void kvrecordMakeKey(
3846038476
const char *zClass,
3846138477
const char *zKeyIn,
3846238478
char *zKeyOut
3846338479
){
38464
- sqlite3_snprintf(KVSTORAGE_KEY_SZ, zKeyOut, "kvvfs-%s-%s", zClass, zKeyIn);
38480
+ assert( zKeyIn );
38481
+ assert( zKeyOut );
38482
+ assert( zClass );
38483
+ sqlite3_snprintf(KVRECORD_KEY_SZ, zKeyOut, "kvvfs-%s-%s",
38484
+ zClass, zKeyIn);
3846538485
}
3846638486
38487
+#ifndef SQLITE_WASM
38488
+/* In WASM builds do not define APIs which use fopen(), fwrite(),
38489
+** and the like because those APIs are a portability issue for
38490
+** WASM.
38491
+*/
3846738492
/* Write content into a key. zClass is the particular namespace of the
3846838493
** underlying key/value store to use - either "local" or "session".
3846938494
**
3847038495
** Both zKey and zData are zero-terminated pure text strings.
3847138496
**
3847238497
** Return the number of errors.
3847338498
*/
38474
-static int kvstorageWrite(
38499
+static int kvrecordWrite(
3847538500
const char *zClass,
3847638501
const char *zKey,
3847738502
const char *zData
3847838503
){
3847938504
FILE *fd;
38480
- char zXKey[KVSTORAGE_KEY_SZ];
38481
- kvstorageMakeKey(zClass, zKey, zXKey);
38505
+ char zXKey[KVRECORD_KEY_SZ];
38506
+ kvrecordMakeKey(zClass, zKey, zXKey);
3848238507
fd = fopen(zXKey, "wb");
3848338508
if( fd ){
3848438509
SQLITE_KV_TRACE(("KVVFS-WRITE %-15s (%d) %.50s%s\n", zXKey,
3848538510
(int)strlen(zData), zData,
3848638511
strlen(zData)>50 ? "..." : ""));
@@ -38494,13 +38519,13 @@
3849438519
3849538520
/* Delete a key (with its corresponding data) from the key/value
3849638521
** namespace given by zClass. If the key does not previously exist,
3849738522
** this routine is a no-op.
3849838523
*/
38499
-static int kvstorageDelete(const char *zClass, const char *zKey){
38500
- char zXKey[KVSTORAGE_KEY_SZ];
38501
- kvstorageMakeKey(zClass, zKey, zXKey);
38524
+static int kvrecordDelete(const char *zClass, const char *zKey){
38525
+ char zXKey[KVRECORD_KEY_SZ];
38526
+ kvrecordMakeKey(zClass, zKey, zXKey);
3850238527
unlink(zXKey);
3850338528
SQLITE_KV_TRACE(("KVVFS-DELETE %-15s\n", zXKey));
3850438529
return 0;
3850538530
}
3850638531
@@ -38517,20 +38542,20 @@
3851738542
** If nBuf<=0 then this routine simply returns the size of the data
3851838543
** without actually reading it. Similarly, if nBuf==1 then it
3851938544
** zero-terminates zBuf at zBuf[0] and returns the size of the data
3852038545
** without reading it.
3852138546
*/
38522
-static int kvstorageRead(
38547
+static int kvrecordRead(
3852338548
const char *zClass,
3852438549
const char *zKey,
3852538550
char *zBuf,
3852638551
int nBuf
3852738552
){
3852838553
FILE *fd;
3852938554
struct stat buf;
38530
- char zXKey[KVSTORAGE_KEY_SZ];
38531
- kvstorageMakeKey(zClass, zKey, zXKey);
38555
+ char zXKey[KVRECORD_KEY_SZ];
38556
+ kvrecordMakeKey(zClass, zKey, zXKey);
3853238557
if( access(zXKey, R_OK)!=0
3853338558
|| stat(zXKey, &buf)!=0
3853438559
|| !S_ISREG(buf.st_mode)
3853538560
){
3853638561
SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
@@ -38558,27 +38583,39 @@
3855838583
SQLITE_KV_TRACE(("KVVFS-READ %-15s (%lld) %.50s%s\n", zXKey,
3855938584
n, zBuf, n>50 ? "..." : ""));
3856038585
return (int)n;
3856138586
}
3856238587
}
38588
+#endif /* #ifndef SQLITE_WASM */
38589
+
3856338590
3856438591
/*
3856538592
** An internal level of indirection which enables us to replace the
3856638593
** kvvfs i/o methods with JavaScript implementations in WASM builds.
3856738594
** Maintenance reminder: if this struct changes in any way, the JSON
3856838595
** rendering of its structure must be updated in
3856938596
** sqlite3-wasm.c:sqlite3__wasm_enum_json(). There are no binary
38570
-** compatibility concerns, so it does not need an iVersion
38571
-** member.
38597
+** compatibility concerns, so it does not need an iVersion member.
3857238598
*/
3857338599
typedef struct sqlite3_kvvfs_methods sqlite3_kvvfs_methods;
3857438600
struct sqlite3_kvvfs_methods {
38575
- int (*xRead)(const char *zClass, const char *zKey, char *zBuf, int nBuf);
38576
- int (*xWrite)(const char *zClass, const char *zKey, const char *zData);
38577
- int (*xDelete)(const char *zClass, const char *zKey);
38601
+ int (*xRcrdRead)(const char*, const char *zKey, char *zBuf, int nBuf);
38602
+ int (*xRcrdWrite)(const char*, const char *zKey, const char *zData);
38603
+ int (*xRcrdDelete)(const char*, const char *zKey);
3857838604
const int nKeySize;
38605
+ const int nBufferSize;
38606
+#ifndef SQLITE_WASM
38607
+# define MAYBE_CONST const
38608
+#else
38609
+# define MAYBE_CONST
38610
+#endif
38611
+ MAYBE_CONST sqlite3_vfs * pVfs;
38612
+ MAYBE_CONST sqlite3_io_methods *pIoDb;
38613
+ MAYBE_CONST sqlite3_io_methods *pIoJrnl;
38614
+#undef MAYBE_CONST
3857938615
};
38616
+
3858038617
3858138618
/*
3858238619
** This object holds the kvvfs I/O methods which may be swapped out
3858338620
** for JavaScript-side implementations in WASM builds. In such builds
3858438621
** it cannot be const, but in native builds it should be so that
@@ -38590,14 +38627,24 @@
3859038627
*/
3859138628
#ifndef SQLITE_WASM
3859238629
const
3859338630
#endif
3859438631
SQLITE_PRIVATE sqlite3_kvvfs_methods sqlite3KvvfsMethods = {
38595
-kvstorageRead,
38596
-kvstorageWrite,
38597
-kvstorageDelete,
38598
-KVSTORAGE_KEY_SZ
38632
+#ifndef SQLITE_WASM
38633
+ .xRcrdRead = kvrecordRead,
38634
+ .xRcrdWrite = kvrecordWrite,
38635
+ .xRcrdDelete = kvrecordDelete,
38636
+#else
38637
+ .xRcrdRead = 0,
38638
+ .xRcrdWrite = 0,
38639
+ .xRcrdDelete = 0,
38640
+#endif
38641
+ .nKeySize = KVRECORD_KEY_SZ,
38642
+ .nBufferSize = SQLITE_KVOS_SZ,
38643
+ .pVfs = &sqlite3OsKvvfsObject,
38644
+ .pIoDb = &kvvfs_db_io_methods,
38645
+ .pIoJrnl = &kvvfs_jrnl_io_methods
3859938646
};
3860038647
3860138648
/****** Utility subroutines ************************************************/
3860238649
3860338650
/*
@@ -38620,11 +38667,14 @@
3862038667
**
3862138668
** * Because there is no overlap between the encoding characters
3862238669
** of hexadecimal and base-26 numbers, it is always clear where
3862338670
** one stops and the next begins.
3862438671
*/
38625
-static int kvvfsEncode(const char *aData, int nData, char *aOut){
38672
+#ifndef SQLITE_WASM
38673
+static
38674
+#endif
38675
+int kvvfsEncode(const char *aData, int nData, char *aOut){
3862638676
int i, j;
3862738677
const unsigned char *a = (const unsigned char*)aData;
3862838678
for(i=j=0; i<nData; i++){
3862938679
unsigned char c = a[i];
3863038680
if( c!=0 ){
@@ -38671,13 +38721,17 @@
3867138721
3867238722
/*
3867338723
** Decode the text encoding back to binary. The binary content is
3867438724
** written into pOut, which must be at least nOut bytes in length.
3867538725
**
38676
-** The return value is the number of bytes actually written into aOut[].
38726
+** The return value is the number of bytes actually written into aOut[], or
38727
+** -1 for malformed inputs.
3867738728
*/
38678
-static int kvvfsDecode(const char *a, char *aOut, int nOut){
38729
+#ifndef SQLITE_WASM
38730
+static
38731
+#endif
38732
+int kvvfsDecode(const char *a, char *aOut, int nOut){
3867938733
int i, j;
3868038734
int c;
3868138735
const unsigned char *aIn = (const unsigned char*)a;
3868238736
i = 0;
3868338737
j = 0;
@@ -38698,11 +38752,11 @@
3869838752
j += n;
3869938753
if( c==0 || mult==1 ) break; /* progress stalled if mult==1 */
3870038754
}else{
3870138755
aOut[j] = c<<4;
3870238756
c = kvvfsHexValue[aIn[++i]];
38703
- if( c<0 ) break;
38757
+ if( c<0 ) return -1 /* hex bytes are always in pairs */;
3870438758
aOut[j++] += c;
3870538759
i++;
3870638760
}
3870738761
}
3870838762
return j;
@@ -38751,17 +38805,18 @@
3875138805
** Read or write the "sz" element, containing the database file size.
3875238806
*/
3875338807
static sqlite3_int64 kvvfsReadFileSize(KVVfsFile *pFile){
3875438808
char zData[50];
3875538809
zData[0] = 0;
38756
- sqlite3KvvfsMethods.xRead(pFile->zClass, "sz", zData, sizeof(zData)-1);
38810
+ sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "sz", zData,
38811
+ sizeof(zData)-1);
3875738812
return strtoll(zData, 0, 0);
3875838813
}
3875938814
static int kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){
3876038815
char zData[50];
3876138816
sqlite3_snprintf(sizeof(zData), zData, "%lld", sz);
38762
- return sqlite3KvvfsMethods.xWrite(pFile->zClass, "sz", zData);
38817
+ return sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, "sz", zData);
3876338818
}
3876438819
3876538820
/****** sqlite3_io_methods methods ******************************************/
3876638821
3876738822
/*
@@ -38772,10 +38827,13 @@
3877238827
3877338828
SQLITE_KV_LOG(("xClose %s %s\n", pFile->zClass,
3877438829
pFile->isJournal ? "journal" : "db"));
3877538830
sqlite3_free(pFile->aJrnl);
3877638831
sqlite3_free(pFile->aData);
38832
+#ifdef SQLITE_WASM
38833
+ memset(pFile, 0, sizeof(*pFile));
38834
+#endif
3877738835
return SQLITE_OK;
3877838836
}
3877938837
3878038838
/*
3878138839
** Read from the -journal file.
@@ -38788,20 +38846,26 @@
3878838846
){
3878938847
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
3879038848
assert( pFile->isJournal );
3879138849
SQLITE_KV_LOG(("xRead('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
3879238850
if( pFile->aJrnl==0 ){
38793
- int szTxt = kvstorageRead(pFile->zClass, "jrnl", 0, 0);
38851
+ int rc;
38852
+ int szTxt = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "jrnl",
38853
+ 0, 0);
3879438854
char *aTxt;
3879538855
if( szTxt<=4 ){
3879638856
return SQLITE_IOERR;
3879738857
}
3879838858
aTxt = sqlite3_malloc64( szTxt+1 );
3879938859
if( aTxt==0 ) return SQLITE_NOMEM;
38800
- kvstorageRead(pFile->zClass, "jrnl", aTxt, szTxt+1);
38801
- kvvfsDecodeJournal(pFile, aTxt, szTxt);
38860
+ rc = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "jrnl",
38861
+ aTxt, szTxt+1);
38862
+ if( rc>=0 ){
38863
+ kvvfsDecodeJournal(pFile, aTxt, szTxt);
38864
+ }
3880238865
sqlite3_free(aTxt);
38866
+ if( rc ) return rc;
3880338867
if( pFile->aJrnl==0 ) return SQLITE_IOERR;
3880438868
}
3880538869
if( iOfst+iAmt>pFile->nJrnl ){
3880638870
return SQLITE_IOERR_SHORT_READ;
3880738871
}
@@ -38837,12 +38901,12 @@
3883738901
pgno = 1 + iOfst/iAmt;
3883838902
}else{
3883938903
pgno = 1;
3884038904
}
3884138905
sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
38842
- got = sqlite3KvvfsMethods.xRead(pFile->zClass, zKey,
38843
- aData, SQLITE_KVOS_SZ-1);
38906
+ got = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, zKey,
38907
+ aData, SQLITE_KVOS_SZ-1);
3884438908
if( got<0 ){
3884538909
n = 0;
3884638910
}else{
3884738911
aData[got] = 0;
3884838912
if( iOfst+iAmt<512 ){
@@ -38906,35 +38970,36 @@
3890638970
){
3890738971
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
3890838972
unsigned int pgno;
3890938973
char zKey[30];
3891038974
char *aData = pFile->aData;
38975
+ int rc;
3891138976
SQLITE_KV_LOG(("xWrite('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
3891238977
assert( iAmt>=512 && iAmt<=65536 );
3891338978
assert( (iAmt & (iAmt-1))==0 );
3891438979
assert( pFile->szPage<0 || pFile->szPage==iAmt );
3891538980
pFile->szPage = iAmt;
3891638981
pgno = 1 + iOfst/iAmt;
3891738982
sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
3891838983
kvvfsEncode(zBuf, iAmt, aData);
38919
- if( sqlite3KvvfsMethods.xWrite(pFile->zClass, zKey, aData) ){
38920
- return SQLITE_IOERR;
38984
+ rc = sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, zKey, aData);
38985
+ if( 0==rc ){
38986
+ if( iOfst+iAmt > pFile->szDb ){
38987
+ pFile->szDb = iOfst + iAmt;
38988
+ }
3892138989
}
38922
- if( iOfst+iAmt > pFile->szDb ){
38923
- pFile->szDb = iOfst + iAmt;
38924
- }
38925
- return SQLITE_OK;
38990
+ return rc;
3892638991
}
3892738992
3892838993
/*
3892938994
** Truncate an kvvfs-file.
3893038995
*/
3893138996
static int kvvfsTruncateJrnl(sqlite3_file *pProtoFile, sqlite_int64 size){
3893238997
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
3893338998
SQLITE_KV_LOG(("xTruncate('%s-journal',%lld)\n", pFile->zClass, size));
3893438999
assert( size==0 );
38935
- sqlite3KvvfsMethods.xDelete(pFile->zClass, "jrnl");
39000
+ sqlite3KvvfsMethods.xRcrdDelete(pFile->zClass, "jrnl");
3893639001
sqlite3_free(pFile->aJrnl);
3893739002
pFile->aJrnl = 0;
3893839003
pFile->nJrnl = 0;
3893939004
return SQLITE_OK;
3894039005
}
@@ -38949,11 +39014,11 @@
3894939014
SQLITE_KV_LOG(("xTruncate('%s-db',%lld)\n", pFile->zClass, size));
3895039015
pgno = 1 + size/pFile->szPage;
3895139016
pgnoMax = 2 + pFile->szDb/pFile->szPage;
3895239017
while( pgno<=pgnoMax ){
3895339018
sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
38954
- sqlite3KvvfsMethods.xDelete(pFile->zClass, zKey);
39019
+ sqlite3KvvfsMethods.xRcrdDelete(pFile->zClass, zKey);
3895539020
pgno++;
3895639021
}
3895739022
pFile->szDb = size;
3895839023
return kvvfsWriteFileSize(pFile, size) ? SQLITE_IOERR : SQLITE_OK;
3895939024
}
@@ -38981,11 +39046,11 @@
3898139046
zOut[i++] = 'a' + (n%26);
3898239047
n /= 26;
3898339048
}while( n>0 );
3898439049
zOut[i++] = ' ';
3898539050
kvvfsEncode(pFile->aJrnl, pFile->nJrnl, &zOut[i]);
38986
- i = sqlite3KvvfsMethods.xWrite(pFile->zClass, "jrnl", zOut);
39051
+ i = sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, "jrnl", zOut);
3898739052
sqlite3_free(zOut);
3898839053
return i ? SQLITE_IOERR : SQLITE_OK;
3898939054
}
3899039055
static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
3899139056
return SQLITE_OK;
@@ -39095,53 +39160,56 @@
3909539160
int *pOutFlags
3909639161
){
3909739162
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
3909839163
if( zName==0 ) zName = "";
3909939164
SQLITE_KV_LOG(("xOpen(\"%s\")\n", zName));
39100
- if( strcmp(zName, "local")==0
39101
- || strcmp(zName, "session")==0
39102
- ){
39103
- pFile->isJournal = 0;
39104
- pFile->base.pMethods = &kvvfs_db_io_methods;
39105
- }else
39106
- if( strcmp(zName, "local-journal")==0
39107
- || strcmp(zName, "session-journal")==0
39108
- ){
39165
+ assert(!pFile->zClass);
39166
+ assert(!pFile->aData);
39167
+ assert(!pFile->aJrnl);
39168
+ assert(!pFile->nJrnl);
39169
+ assert(!pFile->base.pMethods);
39170
+ pFile->szPage = -1;
39171
+ pFile->szDb = -1;
39172
+ if( 0==sqlite3_strglob("*-journal", zName) ){
3910939173
pFile->isJournal = 1;
3911039174
pFile->base.pMethods = &kvvfs_jrnl_io_methods;
39175
+ if( 0==strcmp("session-journal",zName) ){
39176
+ pFile->zClass = "session";
39177
+ }else if( 0==strcmp("local-journal",zName) ){
39178
+ pFile->zClass = "local";
39179
+ }
3911139180
}else{
39112
- return SQLITE_CANTOPEN;
39181
+ pFile->isJournal = 0;
39182
+ pFile->base.pMethods = &kvvfs_db_io_methods;
3911339183
}
39114
- if( zName[0]=='s' ){
39115
- pFile->zClass = "session";
39116
- }else{
39117
- pFile->zClass = "local";
39184
+ if( !pFile->zClass ){
39185
+ pFile->zClass = zName;
3911839186
}
3911939187
pFile->aData = sqlite3_malloc64(SQLITE_KVOS_SZ);
3912039188
if( pFile->aData==0 ){
3912139189
return SQLITE_NOMEM;
3912239190
}
39123
- pFile->aJrnl = 0;
39124
- pFile->nJrnl = 0;
39125
- pFile->szPage = -1;
39126
- pFile->szDb = -1;
3912739191
return SQLITE_OK;
3912839192
}
3912939193
3913039194
/*
3913139195
** Delete the file located at zPath. If the dirSync argument is true,
3913239196
** ensure the file-system modifications are synced to disk before
3913339197
** returning.
3913439198
*/
3913539199
static int kvvfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
39200
+ int rc /* The JS impl can fail with OOM in argument conversion */;
3913639201
if( strcmp(zPath, "local-journal")==0 ){
39137
- sqlite3KvvfsMethods.xDelete("local", "jrnl");
39202
+ rc = sqlite3KvvfsMethods.xRcrdDelete("local", "jrnl");
3913839203
}else
3913939204
if( strcmp(zPath, "session-journal")==0 ){
39140
- sqlite3KvvfsMethods.xDelete("session", "jrnl");
39205
+ rc = sqlite3KvvfsMethods.xRcrdDelete("session", "jrnl");
3914139206
}
39142
- return SQLITE_OK;
39207
+ else{
39208
+ rc = 0;
39209
+ }
39210
+ return rc;
3914339211
}
3914439212
3914539213
/*
3914639214
** Test for access permissions. Return true if the requested permission
3914739215
** is available, or false otherwise.
@@ -39151,25 +39219,46 @@
3915139219
const char *zPath,
3915239220
int flags,
3915339221
int *pResOut
3915439222
){
3915539223
SQLITE_KV_LOG(("xAccess(\"%s\")\n", zPath));
39224
+#if 0 && defined(SQLITE_WASM)
39225
+ /*
39226
+ ** This is not having the desired effect in the JS bindings.
39227
+ ** It's ostensibly the same logic as the #else block, but
39228
+ ** it's not behaving that way.
39229
+ **
39230
+ ** In JS we map all zPaths to Storage objects, and -journal files
39231
+ ** are mapped to the storage for the main db (which is is exactly
39232
+ ** what the mapping of "local-journal" -> "local" is doing).
39233
+ */
39234
+ const char *zKey = (0==sqlite3_strglob("*-journal", zPath))
39235
+ ? "jrnl" : "sz";
39236
+ *pResOut =
39237
+ sqlite3KvvfsMethods.xRcrdRead(zPath, zKey, 0, 0)>0;
39238
+#else
3915639239
if( strcmp(zPath, "local-journal")==0 ){
39157
- *pResOut = sqlite3KvvfsMethods.xRead("local", "jrnl", 0, 0)>0;
39240
+ *pResOut =
39241
+ sqlite3KvvfsMethods.xRcrdRead("local", "jrnl", 0, 0)>0;
3915839242
}else
3915939243
if( strcmp(zPath, "session-journal")==0 ){
39160
- *pResOut = sqlite3KvvfsMethods.xRead("session", "jrnl", 0, 0)>0;
39244
+ *pResOut =
39245
+ sqlite3KvvfsMethods.xRcrdRead("session", "jrnl", 0, 0)>0;
3916139246
}else
3916239247
if( strcmp(zPath, "local")==0 ){
39163
- *pResOut = sqlite3KvvfsMethods.xRead("local", "sz", 0, 0)>0;
39248
+ *pResOut =
39249
+ sqlite3KvvfsMethods.xRcrdRead("local", "sz", 0, 0)>0;
3916439250
}else
3916539251
if( strcmp(zPath, "session")==0 ){
39166
- *pResOut = sqlite3KvvfsMethods.xRead("session", "sz", 0, 0)>0;
39252
+ *pResOut =
39253
+ sqlite3KvvfsMethods.xRcrdRead("session", "sz", 0, 0)>0;
3916739254
}else
3916839255
{
3916939256
*pResOut = 0;
3917039257
}
39258
+ /*all current JS tests avoid triggering: assert( *pResOut == 0 ); */
39259
+#endif
3917139260
SQLITE_KV_LOG(("xAccess returns %d\n",*pResOut));
3917239261
return SQLITE_OK;
3917339262
}
3917439263
3917539264
/*
@@ -41286,15 +41375,21 @@
4128641375
}else{
4128741376
pFile->eFileLock = SHARED_LOCK;
4128841377
pInode->nLock++;
4128941378
pInode->nShared = 1;
4129041379
}
41291
- }else if( (eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1)
41292
- || unixIsSharingShmNode(pFile)
41293
- ){
41380
+ }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
4129441381
/* We are trying for an exclusive lock but another thread in this
4129541382
** same process is still holding a shared lock. */
41383
+ rc = SQLITE_BUSY;
41384
+ }else if( unixIsSharingShmNode(pFile) ){
41385
+ /* We are in WAL mode and attempting to delete the SHM and WAL
41386
+ ** files due to closing the connection or changing out of WAL mode,
41387
+ ** but another process still holds locks on the SHM file, thus
41388
+ ** indicating that database locks have been broken, perhaps due
41389
+ ** to a rogue close(open(dbFile)) or similar.
41390
+ */
4129641391
rc = SQLITE_BUSY;
4129741392
}else{
4129841393
/* The request was for a RESERVED or EXCLUSIVE lock. It is
4129941394
** assumed that there is a SHARED or greater lock on the file
4130041395
** already.
@@ -43930,30 +44025,25 @@
4393044025
** connection from running "PRAGMA journal_mode=DELETE" in order to take
4393144026
** the database out of WAL mode, which is perhaps more serious, but is
4393244027
** still not a disaster.
4393344028
*/
4393444029
static int unixIsSharingShmNode(unixFile *pFile){
43935
- int rc;
4393644030
unixShmNode *pShmNode;
44031
+ struct flock lock;
4393744032
if( pFile->pShm==0 ) return 0;
4393844033
if( pFile->ctrlFlags & UNIXFILE_EXCL ) return 0;
4393944034
pShmNode = pFile->pShm->pShmNode;
43940
- rc = 1;
43941
- unixEnterMutex();
43942
- if( ALWAYS(pShmNode->nRef==1) ){
43943
- struct flock lock;
43944
- lock.l_whence = SEEK_SET;
43945
- lock.l_start = UNIX_SHM_DMS;
43946
- lock.l_len = 1;
43947
- lock.l_type = F_WRLCK;
43948
- osFcntl(pShmNode->hShm, F_GETLK, &lock);
43949
- if( lock.l_type==F_UNLCK ){
43950
- rc = 0;
43951
- }
43952
- }
43953
- unixLeaveMutex();
43954
- return rc;
44035
+#if SQLITE_ATOMIC_INTRINSICS
44036
+ assert( AtomicLoad(&pShmNode->nRef)==1 );
44037
+#endif
44038
+ memset(&lock, 0, sizeof(lock));
44039
+ lock.l_whence = SEEK_SET;
44040
+ lock.l_start = UNIX_SHM_DMS;
44041
+ lock.l_len = 1;
44042
+ lock.l_type = F_WRLCK;
44043
+ osFcntl(pShmNode->hShm, F_GETLK, &lock);
44044
+ return (lock.l_type!=F_UNLCK);
4395544045
}
4395644046
4395744047
/*
4395844048
** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
4395944049
**
@@ -47893,19 +47983,19 @@
4789347983
4789447984
/*
4789547985
** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
4789647986
** based on the sub-platform)?
4789747987
*/
47898
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
47988
+#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_ANSI)
4789947989
# define SQLITE_WIN32_HAS_ANSI
4790047990
#endif
4790147991
4790247992
/*
4790347993
** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
4790447994
** based on the sub-platform)?
4790547995
*/
47906
-#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT || SQLITE_OS_WINRT) && \
47996
+#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT) && \
4790747997
!defined(SQLITE_WIN32_NO_WIDE)
4790847998
# define SQLITE_WIN32_HAS_WIDE
4790947999
#endif
4791048000
4791148001
/*
@@ -48040,20 +48130,11 @@
4804048130
** mode or memory mapped files (e.g. these APIs are available in the Windows
4804148131
** CE SDK; however, they are not present in the header file)?
4804248132
*/
4804348133
#if SQLITE_WIN32_FILEMAPPING_API && \
4804448134
(!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48045
-/*
48046
-** Two of the file mapping APIs are different under WinRT. Figure out which
48047
-** set we need.
48048
-*/
48049
-#if SQLITE_OS_WINRT
48050
-WINBASEAPI HANDLE WINAPI CreateFileMappingFromApp(HANDLE, \
48051
- LPSECURITY_ATTRIBUTES, ULONG, ULONG64, LPCWSTR);
48052
-
48053
-WINBASEAPI LPVOID WINAPI MapViewOfFileFromApp(HANDLE, ULONG, ULONG64, SIZE_T);
48054
-#else
48135
+
4805548136
#if defined(SQLITE_WIN32_HAS_ANSI)
4805648137
WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE, LPSECURITY_ATTRIBUTES, \
4805748138
DWORD, DWORD, DWORD, LPCSTR);
4805848139
#endif /* defined(SQLITE_WIN32_HAS_ANSI) */
4805948140
@@ -48061,11 +48142,10 @@
4806148142
WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE, LPSECURITY_ATTRIBUTES, \
4806248143
DWORD, DWORD, DWORD, LPCWSTR);
4806348144
#endif /* defined(SQLITE_WIN32_HAS_WIDE) */
4806448145
4806548146
WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, SIZE_T);
48066
-#endif /* SQLITE_OS_WINRT */
4806748147
4806848148
/*
4806948149
** These file mapping APIs are common to both Win32 and WinRT.
4807048150
*/
4807148151
@@ -48352,11 +48432,11 @@
4835248432
4835348433
/*
4835448434
** This function is not available on Windows CE or WinRT.
4835548435
*/
4835648436
48357
-#if SQLITE_OS_WINCE || SQLITE_OS_WINRT
48437
+#if SQLITE_OS_WINCE
4835848438
# define osAreFileApisANSI() 1
4835948439
#endif
4836048440
4836148441
/*
4836248442
** Many system calls are accessed through pointer-to-functions so that
@@ -48367,11 +48447,11 @@
4836748447
static struct win_syscall {
4836848448
const char *zName; /* Name of the system call */
4836948449
sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
4837048450
sqlite3_syscall_ptr pDefault; /* Default value */
4837148451
} aSyscall[] = {
48372
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48452
+#if !SQLITE_OS_WINCE
4837348453
{ "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 },
4837448454
#else
4837548455
{ "AreFileApisANSI", (SYSCALL)0, 0 },
4837648456
#endif
4837748457
@@ -48406,20 +48486,20 @@
4840648486
#endif
4840748487
4840848488
#define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \
4840948489
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent)
4841048490
48411
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48491
+#if defined(SQLITE_WIN32_HAS_WIDE)
4841248492
{ "CreateFileW", (SYSCALL)CreateFileW, 0 },
4841348493
#else
4841448494
{ "CreateFileW", (SYSCALL)0, 0 },
4841548495
#endif
4841648496
4841748497
#define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
4841848498
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
4841948499
48420
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \
48500
+#if defined(SQLITE_WIN32_HAS_ANSI) && \
4842148501
(!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) && \
4842248502
SQLITE_WIN32_CREATEFILEMAPPINGA
4842348503
{ "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
4842448504
#else
4842548505
{ "CreateFileMappingA", (SYSCALL)0, 0 },
@@ -48426,21 +48506,21 @@
4842648506
#endif
4842748507
4842848508
#define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
4842948509
DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
4843048510
48431
-#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
48432
- (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
48511
+#if (SQLITE_OS_WINCE || defined(SQLITE_WIN32_HAS_WIDE)) && \
48512
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
4843348513
{ "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
4843448514
#else
4843548515
{ "CreateFileMappingW", (SYSCALL)0, 0 },
4843648516
#endif
4843748517
4843848518
#define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
4843948519
DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent)
4844048520
48441
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48521
+#if defined(SQLITE_WIN32_HAS_WIDE)
4844248522
{ "CreateMutexW", (SYSCALL)CreateMutexW, 0 },
4844348523
#else
4844448524
{ "CreateMutexW", (SYSCALL)0, 0 },
4844548525
#endif
4844648526
@@ -48522,11 +48602,11 @@
4852248602
#endif
4852348603
4852448604
#define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \
4852548605
LPDWORD))aSyscall[18].pCurrent)
4852648606
48527
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48607
+#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
4852848608
{ "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 },
4852948609
#else
4853048610
{ "GetDiskFreeSpaceW", (SYSCALL)0, 0 },
4853148611
#endif
4853248612
@@ -48539,11 +48619,11 @@
4853948619
{ "GetFileAttributesA", (SYSCALL)0, 0 },
4854048620
#endif
4854148621
4854248622
#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent)
4854348623
48544
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48624
+#if defined(SQLITE_WIN32_HAS_WIDE)
4854548625
{ "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 },
4854648626
#else
4854748627
{ "GetFileAttributesW", (SYSCALL)0, 0 },
4854848628
#endif
4854948629
@@ -48556,15 +48636,11 @@
4855648636
#endif
4855748637
4855848638
#define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \
4855948639
LPVOID))aSyscall[22].pCurrent)
4856048640
48561
-#if !SQLITE_OS_WINRT
4856248641
{ "GetFileSize", (SYSCALL)GetFileSize, 0 },
48563
-#else
48564
- { "GetFileSize", (SYSCALL)0, 0 },
48565
-#endif
4856648642
4856748643
#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent)
4856848644
4856948645
#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI)
4857048646
{ "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 },
@@ -48573,11 +48649,11 @@
4857348649
#endif
4857448650
4857548651
#define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \
4857648652
LPSTR*))aSyscall[24].pCurrent)
4857748653
48578
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48654
+#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
4857948655
{ "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 },
4858048656
#else
4858148657
{ "GetFullPathNameW", (SYSCALL)0, 0 },
4858248658
#endif
4858348659
@@ -48608,20 +48684,14 @@
4860848684
#endif
4860948685
4861048686
#define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \
4861148687
LPCSTR))aSyscall[27].pCurrent)
4861248688
48613
-#if !SQLITE_OS_WINRT
4861448689
{ "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 },
48615
-#else
48616
- { "GetSystemInfo", (SYSCALL)0, 0 },
48617
-#endif
48618
-
4861948690
#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent)
4862048691
4862148692
{ "GetSystemTime", (SYSCALL)GetSystemTime, 0 },
48622
-
4862348693
#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent)
4862448694
4862548695
#if !SQLITE_OS_WINCE
4862648696
{ "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 },
4862748697
#else
@@ -48637,23 +48707,19 @@
4863748707
{ "GetTempPathA", (SYSCALL)0, 0 },
4863848708
#endif
4863948709
4864048710
#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent)
4864148711
48642
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48712
+#if defined(SQLITE_WIN32_HAS_WIDE)
4864348713
{ "GetTempPathW", (SYSCALL)GetTempPathW, 0 },
4864448714
#else
4864548715
{ "GetTempPathW", (SYSCALL)0, 0 },
4864648716
#endif
4864748717
4864848718
#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent)
4864948719
48650
-#if !SQLITE_OS_WINRT
4865148720
{ "GetTickCount", (SYSCALL)GetTickCount, 0 },
48652
-#else
48653
- { "GetTickCount", (SYSCALL)0, 0 },
48654
-#endif
4865548721
4865648722
#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)
4865748723
4865848724
#if defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_GETVERSIONEX
4865948725
{ "GetVersionExA", (SYSCALL)GetVersionExA, 0 },
@@ -48662,11 +48728,11 @@
4866248728
#endif
4866348729
4866448730
#define osGetVersionExA ((BOOL(WINAPI*)( \
4866548731
LPOSVERSIONINFOA))aSyscall[34].pCurrent)
4866648732
48667
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
48733
+#if defined(SQLITE_WIN32_HAS_WIDE) && \
4866848734
SQLITE_WIN32_GETVERSIONEX
4866948735
{ "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
4867048736
#else
4867148737
{ "GetVersionExW", (SYSCALL)0, 0 },
4867248738
#endif
@@ -48677,24 +48743,16 @@
4867748743
{ "HeapAlloc", (SYSCALL)HeapAlloc, 0 },
4867848744
4867948745
#define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \
4868048746
SIZE_T))aSyscall[36].pCurrent)
4868148747
48682
-#if !SQLITE_OS_WINRT
4868348748
{ "HeapCreate", (SYSCALL)HeapCreate, 0 },
48684
-#else
48685
- { "HeapCreate", (SYSCALL)0, 0 },
48686
-#endif
4868748749
4868848750
#define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \
4868948751
SIZE_T))aSyscall[37].pCurrent)
4869048752
48691
-#if !SQLITE_OS_WINRT
4869248753
{ "HeapDestroy", (SYSCALL)HeapDestroy, 0 },
48693
-#else
48694
- { "HeapDestroy", (SYSCALL)0, 0 },
48695
-#endif
4869648754
4869748755
#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent)
4869848756
4869948757
{ "HeapFree", (SYSCALL)HeapFree, 0 },
4870048758
@@ -48708,20 +48766,16 @@
4870848766
{ "HeapSize", (SYSCALL)HeapSize, 0 },
4870948767
4871048768
#define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \
4871148769
LPCVOID))aSyscall[41].pCurrent)
4871248770
48713
-#if !SQLITE_OS_WINRT
4871448771
{ "HeapValidate", (SYSCALL)HeapValidate, 0 },
48715
-#else
48716
- { "HeapValidate", (SYSCALL)0, 0 },
48717
-#endif
4871848772
4871948773
#define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \
4872048774
LPCVOID))aSyscall[42].pCurrent)
4872148775
48722
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48776
+#if !SQLITE_OS_WINCE
4872348777
{ "HeapCompact", (SYSCALL)HeapCompact, 0 },
4872448778
#else
4872548779
{ "HeapCompact", (SYSCALL)0, 0 },
4872648780
#endif
4872748781
@@ -48733,28 +48787,24 @@
4873348787
{ "LoadLibraryA", (SYSCALL)0, 0 },
4873448788
#endif
4873548789
4873648790
#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
4873748791
48738
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
48792
+#if defined(SQLITE_WIN32_HAS_WIDE) && \
4873948793
!defined(SQLITE_OMIT_LOAD_EXTENSION)
4874048794
{ "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 },
4874148795
#else
4874248796
{ "LoadLibraryW", (SYSCALL)0, 0 },
4874348797
#endif
4874448798
4874548799
#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent)
4874648800
48747
-#if !SQLITE_OS_WINRT
4874848801
{ "LocalFree", (SYSCALL)LocalFree, 0 },
48749
-#else
48750
- { "LocalFree", (SYSCALL)0, 0 },
48751
-#endif
4875248802
4875348803
#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent)
4875448804
48755
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48805
+#if !SQLITE_OS_WINCE
4875648806
{ "LockFile", (SYSCALL)LockFile, 0 },
4875748807
#else
4875848808
{ "LockFile", (SYSCALL)0, 0 },
4875948809
#endif
4876048810
@@ -48772,12 +48822,11 @@
4877248822
#ifndef osLockFileEx
4877348823
#define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
4877448824
LPOVERLAPPED))aSyscall[48].pCurrent)
4877548825
#endif
4877648826
48777
-#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && \
48778
- (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
48827
+#if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
4877948828
{ "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
4878048829
#else
4878148830
{ "MapViewOfFile", (SYSCALL)0, 0 },
4878248831
#endif
4878348832
@@ -48801,33 +48850,25 @@
4880148850
4880248851
{ "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 },
4880348852
4880448853
#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent)
4880548854
48806
-#if !SQLITE_OS_WINRT
4880748855
{ "SetFilePointer", (SYSCALL)SetFilePointer, 0 },
48808
-#else
48809
- { "SetFilePointer", (SYSCALL)0, 0 },
48810
-#endif
4881148856
4881248857
#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
4881348858
DWORD))aSyscall[54].pCurrent)
4881448859
48815
-#if !SQLITE_OS_WINRT
4881648860
{ "Sleep", (SYSCALL)Sleep, 0 },
48817
-#else
48818
- { "Sleep", (SYSCALL)0, 0 },
48819
-#endif
4882048861
4882148862
#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent)
4882248863
4882348864
{ "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 },
4882448865
4882548866
#define osSystemTimeToFileTime ((BOOL(WINAPI*)(const SYSTEMTIME*, \
4882648867
LPFILETIME))aSyscall[56].pCurrent)
4882748868
48828
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48869
+#if !SQLITE_OS_WINCE
4882948870
{ "UnlockFile", (SYSCALL)UnlockFile, 0 },
4883048871
#else
4883148872
{ "UnlockFile", (SYSCALL)0, 0 },
4883248873
#endif
4883348874
@@ -48861,129 +48902,54 @@
4886148902
{ "WriteFile", (SYSCALL)WriteFile, 0 },
4886248903
4886348904
#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
4886448905
LPOVERLAPPED))aSyscall[61].pCurrent)
4886548906
48866
-#if SQLITE_OS_WINRT
48867
- { "CreateEventExW", (SYSCALL)CreateEventExW, 0 },
48868
-#else
48869
- { "CreateEventExW", (SYSCALL)0, 0 },
48870
-#endif
48871
-
48872
-#define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \
48873
- DWORD,DWORD))aSyscall[62].pCurrent)
48874
-
4887548907
/*
4887648908
** For WaitForSingleObject(), MSDN says:
4887748909
**
4887848910
** Minimum supported client: Windows XP [desktop apps | UWP apps]
4887948911
** Minimum supported server: Windows Server 2003 [desktop apps | UWP apps]
4888048912
*/
4888148913
{ "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 },
4888248914
4888348915
#define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \
48884
- DWORD))aSyscall[63].pCurrent)
48916
+ DWORD))aSyscall[62].pCurrent)
4888548917
4888648918
#if !SQLITE_OS_WINCE
4888748919
{ "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 },
4888848920
#else
4888948921
{ "WaitForSingleObjectEx", (SYSCALL)0, 0 },
4889048922
#endif
4889148923
4889248924
#define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \
48893
- BOOL))aSyscall[64].pCurrent)
48894
-
48895
-#if SQLITE_OS_WINRT
48896
- { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 },
48897
-#else
48898
- { "SetFilePointerEx", (SYSCALL)0, 0 },
48899
-#endif
48900
-
48901
-#define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \
48902
- PLARGE_INTEGER,DWORD))aSyscall[65].pCurrent)
48903
-
48904
-#if SQLITE_OS_WINRT
48905
- { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 },
48906
-#else
48907
- { "GetFileInformationByHandleEx", (SYSCALL)0, 0 },
48908
-#endif
48909
-
48910
-#define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \
48911
- FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent)
48912
-
48913
-#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48914
- { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
48915
-#else
48916
- { "MapViewOfFileFromApp", (SYSCALL)0, 0 },
48917
-#endif
48918
-
48919
-#define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \
48920
- SIZE_T))aSyscall[67].pCurrent)
48921
-
48922
-#if SQLITE_OS_WINRT
48923
- { "CreateFile2", (SYSCALL)CreateFile2, 0 },
48924
-#else
48925
- { "CreateFile2", (SYSCALL)0, 0 },
48926
-#endif
48927
-
48928
-#define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \
48929
- LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[68].pCurrent)
48930
-
48931
-#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_LOAD_EXTENSION)
48932
- { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 },
48933
-#else
48934
- { "LoadPackagedLibrary", (SYSCALL)0, 0 },
48935
-#endif
48936
-
48937
-#define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \
48938
- DWORD))aSyscall[69].pCurrent)
48939
-
48940
-#if SQLITE_OS_WINRT
48941
- { "GetTickCount64", (SYSCALL)GetTickCount64, 0 },
48942
-#else
48943
- { "GetTickCount64", (SYSCALL)0, 0 },
48944
-#endif
48945
-
48946
-#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[70].pCurrent)
48947
-
48948
-#if SQLITE_OS_WINRT
48949
- { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 },
48950
-#else
48951
- { "GetNativeSystemInfo", (SYSCALL)0, 0 },
48952
-#endif
48925
+ BOOL))aSyscall[63].pCurrent)
48926
+
48927
+ { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 },
4895348928
4895448929
#define osGetNativeSystemInfo ((VOID(WINAPI*)( \
48955
- LPSYSTEM_INFO))aSyscall[71].pCurrent)
48930
+ LPSYSTEM_INFO))aSyscall[64].pCurrent)
4895648931
4895748932
#if defined(SQLITE_WIN32_HAS_ANSI)
4895848933
{ "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 },
4895948934
#else
4896048935
{ "OutputDebugStringA", (SYSCALL)0, 0 },
4896148936
#endif
4896248937
48963
-#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[72].pCurrent)
48938
+#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[65].pCurrent)
4896448939
4896548940
#if defined(SQLITE_WIN32_HAS_WIDE)
4896648941
{ "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 },
4896748942
#else
4896848943
{ "OutputDebugStringW", (SYSCALL)0, 0 },
4896948944
#endif
4897048945
48971
-#define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[73].pCurrent)
48946
+#define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[66].pCurrent)
4897248947
4897348948
{ "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
4897448949
48975
-#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent)
48976
-
48977
-#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48978
- { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 },
48979
-#else
48980
- { "CreateFileMappingFromApp", (SYSCALL)0, 0 },
48981
-#endif
48982
-
48983
-#define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \
48984
- LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[75].pCurrent)
48950
+#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[67].pCurrent)
4898548951
4898648952
/*
4898748953
** NOTE: On some sub-platforms, the InterlockedCompareExchange "function"
4898848954
** is really just a macro that uses a compiler intrinsic (e.g. x64).
4898948955
** So do not try to make this is into a redefinable interface.
@@ -48994,38 +48960,38 @@
4899448960
#define osInterlockedCompareExchange InterlockedCompareExchange
4899548961
#else
4899648962
{ "InterlockedCompareExchange", (SYSCALL)InterlockedCompareExchange, 0 },
4899748963
4899848964
#define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG \
48999
- SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[76].pCurrent)
48965
+ SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[68].pCurrent)
4900048966
#endif /* defined(InterlockedCompareExchange) */
4900148967
49002
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
48968
+#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
4900348969
{ "UuidCreate", (SYSCALL)UuidCreate, 0 },
4900448970
#else
4900548971
{ "UuidCreate", (SYSCALL)0, 0 },
4900648972
#endif
4900748973
49008
-#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[77].pCurrent)
48974
+#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[69].pCurrent)
4900948975
49010
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
48976
+#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
4901148977
{ "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
4901248978
#else
4901348979
{ "UuidCreateSequential", (SYSCALL)0, 0 },
4901448980
#endif
4901548981
4901648982
#define osUuidCreateSequential \
49017
- ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[78].pCurrent)
48983
+ ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[70].pCurrent)
4901848984
4901948985
#if !defined(SQLITE_NO_SYNC) && SQLITE_MAX_MMAP_SIZE>0
4902048986
{ "FlushViewOfFile", (SYSCALL)FlushViewOfFile, 0 },
4902148987
#else
4902248988
{ "FlushViewOfFile", (SYSCALL)0, 0 },
4902348989
#endif
4902448990
4902548991
#define osFlushViewOfFile \
49026
- ((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[79].pCurrent)
48992
+ ((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[71].pCurrent)
4902748993
4902848994
/*
4902948995
** If SQLITE_ENABLE_SETLK_TIMEOUT is defined, we require CreateEvent()
4903048996
** to implement blocking locks with timeouts. MSDN says:
4903148997
**
@@ -49038,11 +49004,11 @@
4903849004
{ "CreateEvent", (SYSCALL)0, 0 },
4903949005
#endif
4904049006
4904149007
#define osCreateEvent ( \
4904249008
(HANDLE(WINAPI*) (LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR)) \
49043
- aSyscall[80].pCurrent \
49009
+ aSyscall[72].pCurrent \
4904449010
)
4904549011
4904649012
/*
4904749013
** If SQLITE_ENABLE_SETLK_TIMEOUT is defined, we require CancelIo()
4904849014
** for the case where a timeout expires and a lock request must be
@@ -49055,68 +49021,68 @@
4905549021
{ "CancelIo", (SYSCALL)CancelIo, 0 },
4905649022
#else
4905749023
{ "CancelIo", (SYSCALL)0, 0 },
4905849024
#endif
4905949025
49060
-#define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[81].pCurrent)
49026
+#define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[73].pCurrent)
4906149027
4906249028
#if defined(SQLITE_WIN32_HAS_WIDE) && defined(_WIN32)
4906349029
{ "GetModuleHandleW", (SYSCALL)GetModuleHandleW, 0 },
4906449030
#else
4906549031
{ "GetModuleHandleW", (SYSCALL)0, 0 },
4906649032
#endif
4906749033
49068
-#define osGetModuleHandleW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[82].pCurrent)
49034
+#define osGetModuleHandleW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[74].pCurrent)
4906949035
4907049036
#ifndef _WIN32
4907149037
{ "getenv", (SYSCALL)getenv, 0 },
4907249038
#else
4907349039
{ "getenv", (SYSCALL)0, 0 },
4907449040
#endif
4907549041
49076
-#define osGetenv ((const char *(*)(const char *))aSyscall[83].pCurrent)
49042
+#define osGetenv ((const char *(*)(const char *))aSyscall[75].pCurrent)
4907749043
4907849044
#ifndef _WIN32
4907949045
{ "getcwd", (SYSCALL)getcwd, 0 },
4908049046
#else
4908149047
{ "getcwd", (SYSCALL)0, 0 },
4908249048
#endif
4908349049
49084
-#define osGetcwd ((char*(*)(char*,size_t))aSyscall[84].pCurrent)
49050
+#define osGetcwd ((char*(*)(char*,size_t))aSyscall[76].pCurrent)
4908549051
4908649052
#ifndef _WIN32
4908749053
{ "readlink", (SYSCALL)readlink, 0 },
4908849054
#else
4908949055
{ "readlink", (SYSCALL)0, 0 },
4909049056
#endif
4909149057
49092
-#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[85].pCurrent)
49058
+#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[77].pCurrent)
4909349059
4909449060
#ifndef _WIN32
4909549061
{ "lstat", (SYSCALL)lstat, 0 },
4909649062
#else
4909749063
{ "lstat", (SYSCALL)0, 0 },
4909849064
#endif
4909949065
49100
-#define osLstat ((int(*)(const char*,struct stat*))aSyscall[86].pCurrent)
49066
+#define osLstat ((int(*)(const char*,struct stat*))aSyscall[78].pCurrent)
4910149067
4910249068
#ifndef _WIN32
4910349069
{ "__errno", (SYSCALL)__errno, 0 },
4910449070
#else
4910549071
{ "__errno", (SYSCALL)0, 0 },
4910649072
#endif
4910749073
49108
-#define osErrno (*((int*(*)(void))aSyscall[87].pCurrent)())
49074
+#define osErrno (*((int*(*)(void))aSyscall[79].pCurrent)())
4910949075
4911049076
#ifndef _WIN32
4911149077
{ "cygwin_conv_path", (SYSCALL)cygwin_conv_path, 0 },
4911249078
#else
4911349079
{ "cygwin_conv_path", (SYSCALL)0, 0 },
4911449080
#endif
4911549081
4911649082
#define osCygwin_conv_path ((size_t(*)(unsigned int, \
49117
- const void *, void *, size_t))aSyscall[88].pCurrent)
49083
+ const void *, void *, size_t))aSyscall[80].pCurrent)
4911849084
4911949085
}; /* End of the overrideable system calls */
4912049086
4912149087
/*
4912249088
** This is the xSetSystemCall() method of sqlite3_vfs for all of the
@@ -49216,14 +49182,14 @@
4921649182
4921749183
winMemAssertMagic();
4921849184
hHeap = winMemGetHeap();
4921949185
assert( hHeap!=0 );
4922049186
assert( hHeap!=INVALID_HANDLE_VALUE );
49221
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49187
+#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
4922249188
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
4922349189
#endif
49224
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
49190
+#if !SQLITE_OS_WINCE
4922549191
if( (nLargest=osHeapCompact(hHeap, SQLITE_WIN32_HEAP_FLAGS))==0 ){
4922649192
DWORD lastErrno = osGetLastError();
4922749193
if( lastErrno==NO_ERROR ){
4922849194
sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p",
4922949195
(void*)hHeap);
@@ -49332,32 +49298,15 @@
4933249298
}
4933349299
#endif
4933449300
}
4933549301
#endif /* _WIN32 */
4933649302
49337
-/*
49338
-** The following routine suspends the current thread for at least ms
49339
-** milliseconds. This is equivalent to the Win32 Sleep() interface.
49340
-*/
49341
-#if SQLITE_OS_WINRT
49342
-static HANDLE sleepObj = NULL;
49343
-#endif
49344
-
4934549303
SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){
49346
-#if SQLITE_OS_WINRT
49347
- if ( sleepObj==NULL ){
49348
- sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
49349
- SYNCHRONIZE);
49350
- }
49351
- assert( sleepObj!=NULL );
49352
- osWaitForSingleObjectEx(sleepObj, milliseconds, FALSE);
49353
-#else
4935449304
osSleep(milliseconds);
49355
-#endif
4935649305
}
4935749306
49358
-#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
49307
+#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && \
4935949308
SQLITE_THREADSAFE>0
4936049309
SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){
4936149310
DWORD rc;
4936249311
while( (rc = osWaitForSingleObjectEx(hObject, INFINITE,
4936349312
TRUE))==WAIT_IO_COMPLETION ){}
@@ -49377,11 +49326,11 @@
4937749326
** the LockFileEx() API.
4937849327
*/
4937949328
4938049329
#if !SQLITE_WIN32_GETVERSIONEX
4938149330
# define osIsNT() (1)
49382
-#elif SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI)
49331
+#elif SQLITE_OS_WINCE || !defined(SQLITE_WIN32_HAS_ANSI)
4938349332
# define osIsNT() (1)
4938449333
#elif !defined(SQLITE_WIN32_HAS_WIDE)
4938549334
# define osIsNT() (0)
4938649335
#else
4938749336
# define osIsNT() ((sqlite3_os_type==2) || sqlite3_win32_is_nt())
@@ -49390,17 +49339,11 @@
4939049339
/*
4939149340
** This function determines if the machine is running a version of Windows
4939249341
** based on the NT kernel.
4939349342
*/
4939449343
SQLITE_API int sqlite3_win32_is_nt(void){
49395
-#if SQLITE_OS_WINRT
49396
- /*
49397
- ** NOTE: The WinRT sub-platform is always assumed to be based on the NT
49398
- ** kernel.
49399
- */
49400
- return 1;
49401
-#elif SQLITE_WIN32_GETVERSIONEX
49344
+#if SQLITE_WIN32_GETVERSIONEX
4940249345
if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){
4940349346
#if defined(SQLITE_WIN32_HAS_ANSI)
4940449347
OSVERSIONINFOA sInfo;
4940549348
sInfo.dwOSVersionInfoSize = sizeof(sInfo);
4940649349
osGetVersionExA(&sInfo);
@@ -49438,11 +49381,11 @@
4943849381
4943949382
winMemAssertMagic();
4944049383
hHeap = winMemGetHeap();
4944149384
assert( hHeap!=0 );
4944249385
assert( hHeap!=INVALID_HANDLE_VALUE );
49443
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49386
+#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
4944449387
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
4944549388
#endif
4944649389
assert( nBytes>=0 );
4944749390
p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
4944849391
if( !p ){
@@ -49460,11 +49403,11 @@
4946049403
4946149404
winMemAssertMagic();
4946249405
hHeap = winMemGetHeap();
4946349406
assert( hHeap!=0 );
4946449407
assert( hHeap!=INVALID_HANDLE_VALUE );
49465
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49408
+#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
4946649409
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
4946749410
#endif
4946849411
if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
4946949412
if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){
4947049413
sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p",
@@ -49481,11 +49424,11 @@
4948149424
4948249425
winMemAssertMagic();
4948349426
hHeap = winMemGetHeap();
4948449427
assert( hHeap!=0 );
4948549428
assert( hHeap!=INVALID_HANDLE_VALUE );
49486
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49429
+#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
4948749430
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
4948849431
#endif
4948949432
assert( nBytes>=0 );
4949049433
if( !pPrior ){
4949149434
p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
@@ -49509,11 +49452,11 @@
4950949452
4951049453
winMemAssertMagic();
4951149454
hHeap = winMemGetHeap();
4951249455
assert( hHeap!=0 );
4951349456
assert( hHeap!=INVALID_HANDLE_VALUE );
49514
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49457
+#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
4951549458
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, p) );
4951649459
#endif
4951749460
if( !p ) return 0;
4951849461
n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p);
4951949462
if( n==(SIZE_T)-1 ){
@@ -49539,11 +49482,11 @@
4953949482
4954049483
if( !pWinMemData ) return SQLITE_ERROR;
4954149484
assert( pWinMemData->magic1==WINMEM_MAGIC1 );
4954249485
assert( pWinMemData->magic2==WINMEM_MAGIC2 );
4954349486
49544
-#if !SQLITE_OS_WINRT && SQLITE_WIN32_HEAP_CREATE
49487
+#if SQLITE_WIN32_HEAP_CREATE
4954549488
if( !pWinMemData->hHeap ){
4954649489
DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE;
4954749490
DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap;
4954849491
if( dwMaximumSize==0 ){
4954949492
dwMaximumSize = SQLITE_WIN32_HEAP_MAX_SIZE;
@@ -49572,11 +49515,11 @@
4957249515
pWinMemData->bOwned = FALSE;
4957349516
assert( !pWinMemData->bOwned );
4957449517
#endif
4957549518
assert( pWinMemData->hHeap!=0 );
4957649519
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
49577
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49520
+#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
4957849521
assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
4957949522
#endif
4958049523
return SQLITE_OK;
4958149524
}
4958249525
@@ -49590,11 +49533,11 @@
4959049533
assert( pWinMemData->magic1==WINMEM_MAGIC1 );
4959149534
assert( pWinMemData->magic2==WINMEM_MAGIC2 );
4959249535
4959349536
if( pWinMemData->hHeap ){
4959449537
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
49595
-#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49538
+#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
4959649539
assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
4959749540
#endif
4959849541
if( pWinMemData->bOwned ){
4959949542
if( !osHeapDestroy(pWinMemData->hHeap) ){
4960049543
sqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p",
@@ -49971,21 +49914,10 @@
4997149914
*/
4997249915
DWORD dwLen = 0;
4997349916
char *zOut = 0;
4997449917
4997549918
if( osIsNT() ){
49976
-#if SQLITE_OS_WINRT
49977
- WCHAR zTempWide[SQLITE_WIN32_MAX_ERRMSG_CHARS+1];
49978
- dwLen = osFormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
49979
- FORMAT_MESSAGE_IGNORE_INSERTS,
49980
- NULL,
49981
- lastErrno,
49982
- 0,
49983
- zTempWide,
49984
- SQLITE_WIN32_MAX_ERRMSG_CHARS,
49985
- 0);
49986
-#else
4998749919
LPWSTR zTempWide = NULL;
4998849920
dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
4998949921
FORMAT_MESSAGE_FROM_SYSTEM |
4999049922
FORMAT_MESSAGE_IGNORE_INSERTS,
4999149923
NULL,
@@ -49992,20 +49924,17 @@
4999249924
lastErrno,
4999349925
0,
4999449926
(LPWSTR) &zTempWide,
4999549927
0,
4999649928
0);
49997
-#endif
4999849929
if( dwLen > 0 ){
4999949930
/* allocate a buffer and convert to UTF8 */
5000049931
sqlite3BeginBenignMalloc();
5000149932
zOut = winUnicodeToUtf8(zTempWide);
5000249933
sqlite3EndBenignMalloc();
50003
-#if !SQLITE_OS_WINRT
5000449934
/* free the system buffer allocated by FormatMessage */
5000549935
osLocalFree(zTempWide);
50006
-#endif
5000749936
}
5000849937
}
5000949938
#ifdef SQLITE_WIN32_HAS_ANSI
5001049939
else{
5001149940
char *zTemp = NULL;
@@ -50662,11 +50591,10 @@
5066250591
** error code.
5066350592
*/
5066450593
static int winHandleSeek(HANDLE h, sqlite3_int64 iOffset){
5066550594
int rc = SQLITE_OK; /* Return value */
5066650595
50667
-#if !SQLITE_OS_WINRT
5066850596
LONG upperBits; /* Most sig. 32 bits of new offset */
5066950597
LONG lowerBits; /* Least sig. 32 bits of new offset */
5067050598
DWORD dwRet; /* Value returned by SetFilePointer() */
5067150599
5067250600
upperBits = (LONG)((iOffset>>32) & 0x7fffffff);
@@ -50684,24 +50612,11 @@
5068450612
DWORD lastErrno = osGetLastError();
5068550613
if( lastErrno!=NO_ERROR ){
5068650614
rc = SQLITE_IOERR_SEEK;
5068750615
}
5068850616
}
50689
-#else
50690
- /* This implementation works for WinRT. */
50691
- LARGE_INTEGER x; /* The new offset */
50692
- BOOL bRet; /* Value returned by SetFilePointerEx() */
50693
-
50694
- x.QuadPart = iOffset;
50695
- bRet = osSetFilePointerEx(h, x, 0, FILE_BEGIN);
50696
-
50697
- if(!bRet){
50698
- rc = SQLITE_IOERR_SEEK;
50699
- }
50700
-#endif
50701
-
50702
- OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset, sqlite3ErrName(rc)));
50617
+ OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset,sqlite3ErrName(rc)));
5070350618
return rc;
5070450619
}
5070550620
5070650621
/*
5070750622
** Move the current position of the file handle passed as the first
@@ -50998,32 +50913,19 @@
5099850913
** Determine the size in bytes of the file opened by the handle passed as
5099950914
** the first argument.
5100050915
*/
5100150916
static int winHandleSize(HANDLE h, sqlite3_int64 *pnByte){
5100250917
int rc = SQLITE_OK;
51003
-
51004
-#if SQLITE_OS_WINRT
51005
- FILE_STANDARD_INFO info;
51006
- BOOL b;
51007
- b = osGetFileInformationByHandleEx(h, FileStandardInfo, &info, sizeof(info));
51008
- if( b ){
51009
- *pnByte = info.EndOfFile.QuadPart;
51010
- }else{
51011
- rc = SQLITE_IOERR_FSTAT;
51012
- }
51013
-#else
5101450918
DWORD upperBits = 0;
5101550919
DWORD lowerBits = 0;
5101650920
5101750921
assert( pnByte );
5101850922
lowerBits = osGetFileSize(h, &upperBits);
5101950923
*pnByte = (((sqlite3_int64)upperBits)<<32) + lowerBits;
5102050924
if( lowerBits==INVALID_FILE_SIZE && osGetLastError()!=NO_ERROR ){
5102150925
rc = SQLITE_IOERR_FSTAT;
5102250926
}
51023
-#endif
51024
-
5102550927
return rc;
5102650928
}
5102750929
5102850930
/*
5102950931
** Close the handle passed as the only argument.
@@ -51218,24 +51120,10 @@
5121851120
5121951121
assert( id!=0 );
5122051122
assert( pSize!=0 );
5122151123
SimulateIOError(return SQLITE_IOERR_FSTAT);
5122251124
OSTRACE(("SIZE file=%p, pSize=%p\n", pFile->h, pSize));
51223
-
51224
-#if SQLITE_OS_WINRT
51225
- {
51226
- FILE_STANDARD_INFO info;
51227
- if( osGetFileInformationByHandleEx(pFile->h, FileStandardInfo,
51228
- &info, sizeof(info)) ){
51229
- *pSize = info.EndOfFile.QuadPart;
51230
- }else{
51231
- pFile->lastErrno = osGetLastError();
51232
- rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
51233
- "winFileSize", pFile->zPath);
51234
- }
51235
- }
51236
-#else
5123751125
{
5123851126
DWORD upperBits;
5123951127
DWORD lowerBits;
5124051128
DWORD lastErrno;
5124151129
@@ -51246,11 +51134,10 @@
5124651134
pFile->lastErrno = lastErrno;
5124751135
rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
5124851136
"winFileSize", pFile->zPath);
5124951137
}
5125051138
}
51251
-#endif
5125251139
OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n",
5125351140
pFile->h, pSize, *pSize, sqlite3ErrName(rc)));
5125451141
return rc;
5125551142
}
5125651143
@@ -52208,33 +52095,18 @@
5220852095
5220952096
/* TODO: platforms.
5221052097
** TODO: retry-on-ioerr.
5221152098
*/
5221252099
if( osIsNT() ){
52213
-#if SQLITE_OS_WINRT
52214
- CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
52215
- memset(&extendedParameters, 0, sizeof(extendedParameters));
52216
- extendedParameters.dwSize = sizeof(extendedParameters);
52217
- extendedParameters.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
52218
- extendedParameters.dwFileFlags = flag_overlapped;
52219
- extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
52220
- h = osCreateFile2((LPCWSTR)zConverted,
52221
- (GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)),/* dwDesiredAccess */
52222
- FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */
52223
- OPEN_ALWAYS, /* dwCreationDisposition */
52224
- &extendedParameters
52225
- );
52226
-#else
5222752100
h = osCreateFileW((LPCWSTR)zConverted, /* lpFileName */
5222852101
(GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)), /* dwDesiredAccess */
5222952102
FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */
5223052103
NULL, /* lpSecurityAttributes */
5223152104
OPEN_ALWAYS, /* dwCreationDisposition */
5223252105
FILE_ATTRIBUTE_NORMAL|flag_overlapped,
5223352106
NULL
5223452107
);
52235
-#endif
5223652108
}else{
5223752109
/* Due to pre-processor directives earlier in this file,
5223852110
** SQLITE_WIN32_HAS_ANSI is always defined if osIsNT() is false. */
5223952111
#ifdef SQLITE_WIN32_HAS_ANSI
5224052112
h = osCreateFileA((LPCSTR)zConverted,
@@ -52698,13 +52570,11 @@
5269852570
5269952571
while( pShmNode->nRegion<=iRegion ){
5270052572
HANDLE hMap = NULL; /* file-mapping handle */
5270152573
void *pMap = 0; /* Mapped memory region */
5270252574
52703
-#if SQLITE_OS_WINRT
52704
- hMap = osCreateFileMappingFromApp(hShared, NULL, protect, nByte, NULL);
52705
-#elif defined(SQLITE_WIN32_HAS_WIDE)
52575
+#if defined(SQLITE_WIN32_HAS_WIDE)
5270652576
hMap = osCreateFileMappingW(hShared, NULL, protect, 0, nByte, NULL);
5270752577
#elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
5270852578
hMap = osCreateFileMappingA(hShared, NULL, protect, 0, nByte, NULL);
5270952579
#endif
5271052580
@@ -52712,19 +52582,13 @@
5271252582
osGetCurrentProcessId(), pShmNode->nRegion, nByte,
5271352583
hMap ? "ok" : "failed"));
5271452584
if( hMap ){
5271552585
int iOffset = pShmNode->nRegion*szRegion;
5271652586
int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;
52717
-#if SQLITE_OS_WINRT
52718
- pMap = osMapViewOfFileFromApp(hMap, flags,
52719
- iOffset - iOffsetShift, szRegion + iOffsetShift
52720
- );
52721
-#else
5272252587
pMap = osMapViewOfFile(hMap, flags,
5272352588
0, iOffset - iOffsetShift, szRegion + iOffsetShift
5272452589
);
52725
-#endif
5272652590
OSTRACE(("SHM-MAP-MAP pid=%lu, region=%d, offset=%d, size=%d, rc=%s\n",
5272752591
osGetCurrentProcessId(), pShmNode->nRegion, iOffset,
5272852592
szRegion, pMap ? "ok" : "failed"));
5272952593
}
5273052594
if( !pMap ){
@@ -52853,13 +52717,11 @@
5285352717
if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
5285452718
protect = PAGE_READWRITE;
5285552719
flags |= FILE_MAP_WRITE;
5285652720
}
5285752721
#endif
52858
-#if SQLITE_OS_WINRT
52859
- pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
52860
-#elif defined(SQLITE_WIN32_HAS_WIDE)
52722
+#if defined(SQLITE_WIN32_HAS_WIDE)
5286152723
pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
5286252724
(DWORD)((nMap>>32) & 0xffffffff),
5286352725
(DWORD)(nMap & 0xffffffff), NULL);
5286452726
#elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
5286552727
pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect,
@@ -52875,15 +52737,11 @@
5287552737
osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
5287652738
return SQLITE_OK;
5287752739
}
5287852740
assert( (nMap % winSysInfo.dwPageSize)==0 );
5287952741
assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
52880
-#if SQLITE_OS_WINRT
52881
- pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
52882
-#else
5288352742
pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
52884
-#endif
5288552743
if( pNew==NULL ){
5288652744
osCloseHandle(pFd->hMap);
5288752745
pFd->hMap = NULL;
5288852746
pFd->lastErrno = osGetLastError();
5288952747
rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
@@ -53214,11 +53072,10 @@
5321453072
}
5321553073
}
5321653074
}
5321753075
#endif
5321853076
53219
-#if !SQLITE_OS_WINRT && defined(_WIN32)
5322053077
else if( osIsNT() ){
5322153078
char *zMulti;
5322253079
LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) );
5322353080
if( !zWidePath ){
5322453081
sqlite3_free(zBuf);
@@ -53268,11 +53125,10 @@
5326853125
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
5326953126
return SQLITE_IOERR_NOMEM_BKPT;
5327053127
}
5327153128
}
5327253129
#endif /* SQLITE_WIN32_HAS_ANSI */
53273
-#endif /* !SQLITE_OS_WINRT */
5327453130
5327553131
/*
5327653132
** Check to make sure the temporary directory ends with an appropriate
5327753133
** separator. If it does not and there is not enough space left to add
5327853134
** one, fail.
@@ -53443,17 +53299,10 @@
5344353299
5344453300
assert( pFile!=0 );
5344553301
memset(pFile, 0, sizeof(winFile));
5344653302
pFile->h = INVALID_HANDLE_VALUE;
5344753303
53448
-#if SQLITE_OS_WINRT
53449
- if( !zUtf8Name && !sqlite3_temp_directory ){
53450
- sqlite3_log(SQLITE_ERROR,
53451
- "sqlite3_temp_directory variable should be set for WinRT");
53452
- }
53453
-#endif
53454
-
5345553304
/* If the second argument to this function is NULL, generate a
5345653305
** temporary file name to use
5345753306
*/
5345853307
if( !zUtf8Name ){
5345953308
assert( isDelete && !isOpenJournal );
@@ -53532,35 +53381,10 @@
5353253381
#if SQLITE_OS_WINCE
5353353382
dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
5353453383
#endif
5353553384
5353653385
if( osIsNT() ){
53537
-#if SQLITE_OS_WINRT
53538
- CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
53539
- extendedParameters.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
53540
- extendedParameters.dwFileAttributes =
53541
- dwFlagsAndAttributes & FILE_ATTRIBUTE_MASK;
53542
- extendedParameters.dwFileFlags = dwFlagsAndAttributes & FILE_FLAG_MASK;
53543
- extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
53544
- extendedParameters.lpSecurityAttributes = NULL;
53545
- extendedParameters.hTemplateFile = NULL;
53546
- do{
53547
- h = osCreateFile2((LPCWSTR)zConverted,
53548
- dwDesiredAccess,
53549
- dwShareMode,
53550
- dwCreationDisposition,
53551
- &extendedParameters);
53552
- if( h!=INVALID_HANDLE_VALUE ) break;
53553
- if( isReadWrite ){
53554
- int rc2;
53555
- sqlite3BeginBenignMalloc();
53556
- rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO);
53557
- sqlite3EndBenignMalloc();
53558
- if( rc2==SQLITE_OK && isRO ) break;
53559
- }
53560
- }while( winRetryIoerr(&cnt, &lastErrno) );
53561
-#else
5356253386
do{
5356353387
h = osCreateFileW((LPCWSTR)zConverted,
5356453388
dwDesiredAccess,
5356553389
dwShareMode, NULL,
5356653390
dwCreationDisposition,
@@ -53573,11 +53397,10 @@
5357353397
rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO);
5357453398
sqlite3EndBenignMalloc();
5357553399
if( rc2==SQLITE_OK && isRO ) break;
5357653400
}
5357753401
}while( winRetryIoerr(&cnt, &lastErrno) );
53578
-#endif
5357953402
}
5358053403
#ifdef SQLITE_WIN32_HAS_ANSI
5358153404
else{
5358253405
do{
5358353406
h = osCreateFileA((LPCSTR)zConverted,
@@ -53710,29 +53533,11 @@
5371053533
OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
5371153534
return SQLITE_IOERR_NOMEM_BKPT;
5371253535
}
5371353536
if( osIsNT() ){
5371453537
do {
53715
-#if SQLITE_OS_WINRT
53716
- WIN32_FILE_ATTRIBUTE_DATA sAttrData;
53717
- memset(&sAttrData, 0, sizeof(sAttrData));
53718
- if ( osGetFileAttributesExW(zConverted, GetFileExInfoStandard,
53719
- &sAttrData) ){
53720
- attr = sAttrData.dwFileAttributes;
53721
- }else{
53722
- lastErrno = osGetLastError();
53723
- if( lastErrno==ERROR_FILE_NOT_FOUND
53724
- || lastErrno==ERROR_PATH_NOT_FOUND ){
53725
- rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
53726
- }else{
53727
- rc = SQLITE_ERROR;
53728
- }
53729
- break;
53730
- }
53731
-#else
5373253538
attr = osGetFileAttributesW(zConverted);
53733
-#endif
5373453539
if ( attr==INVALID_FILE_ATTRIBUTES ){
5373553540
lastErrno = osGetLastError();
5373653541
if( lastErrno==ERROR_FILE_NOT_FOUND
5373753542
|| lastErrno==ERROR_PATH_NOT_FOUND ){
5373853543
rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
@@ -53851,10 +53656,11 @@
5385153656
attr = INVALID_FILE_ATTRIBUTES;
5385253657
}else{
5385353658
attr = sAttrData.dwFileAttributes;
5385453659
}
5385553660
}else{
53661
+ if( noRetry ) lastErrno = osGetLastError();
5385653662
winLogIoerr(cnt, __LINE__);
5385753663
if( lastErrno!=ERROR_FILE_NOT_FOUND && lastErrno!=ERROR_PATH_NOT_FOUND ){
5385853664
sqlite3_free(zConverted);
5385953665
return winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess",
5386053666
zFilename);
@@ -54019,11 +53825,11 @@
5401953825
sqlite3_vfs *pVfs, /* Pointer to vfs object */
5402053826
const char *zRelative, /* Possibly relative input path */
5402153827
int nFull, /* Size of output buffer in bytes */
5402253828
char *zFull /* Output buffer */
5402353829
){
54024
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
53830
+#if !SQLITE_OS_WINCE
5402553831
int nByte;
5402653832
void *zConverted;
5402753833
char *zOut;
5402853834
#endif
5402953835
@@ -54108,11 +53914,11 @@
5410853914
return rc;
5410953915
}
5411053916
}
5411153917
#endif /* __CYGWIN__ */
5411253918
54113
-#if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && defined(_WIN32)
53919
+#if SQLITE_OS_WINCE && defined(_WIN32)
5411453920
SimulateIOError( return SQLITE_ERROR );
5411553921
/* WinCE has no concept of a relative pathname, or so I am told. */
5411653922
/* WinRT has no way to convert a relative path to an absolute one. */
5411753923
if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){
5411853924
/*
@@ -54127,11 +53933,11 @@
5412753933
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative);
5412853934
}
5412953935
return SQLITE_OK;
5413053936
#endif
5413153937
54132
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
53938
+#if !SQLITE_OS_WINCE
5413353939
#if defined(_WIN32)
5413453940
/* It's odd to simulate an io-error here, but really this is just
5413553941
** using the io-error infrastructure to test that SQLite handles this
5413653942
** function failing. This function could fail if, for example, the
5413753943
** current working directory has been unlinked.
@@ -54259,15 +54065,11 @@
5425954065
if( zConverted==0 ){
5426054066
OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0));
5426154067
return 0;
5426254068
}
5426354069
if( osIsNT() ){
54264
-#if SQLITE_OS_WINRT
54265
- h = osLoadPackagedLibrary((LPCWSTR)zConverted, 0);
54266
-#else
5426754070
h = osLoadLibraryW((LPCWSTR)zConverted);
54268
-#endif
5426954071
}
5427054072
#ifdef SQLITE_WIN32_HAS_ANSI
5427154073
else{
5427254074
h = osLoadLibraryA((char*)zConverted);
5427354075
}
@@ -54345,37 +54147,30 @@
5434554147
}
5434654148
{
5434754149
DWORD pid = osGetCurrentProcessId();
5434854150
xorMemory(&e, (unsigned char*)&pid, sizeof(DWORD));
5434954151
}
54350
-#if SQLITE_OS_WINRT
54351
- {
54352
- ULONGLONG cnt = osGetTickCount64();
54353
- xorMemory(&e, (unsigned char*)&cnt, sizeof(ULONGLONG));
54354
- }
54355
-#else
5435654152
{
5435754153
DWORD cnt = osGetTickCount();
5435854154
xorMemory(&e, (unsigned char*)&cnt, sizeof(DWORD));
5435954155
}
54360
-#endif /* SQLITE_OS_WINRT */
5436154156
{
5436254157
LARGE_INTEGER i;
5436354158
osQueryPerformanceCounter(&i);
5436454159
xorMemory(&e, (unsigned char*)&i, sizeof(LARGE_INTEGER));
5436554160
}
54366
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
54161
+#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
5436754162
{
5436854163
UUID id;
5436954164
memset(&id, 0, sizeof(UUID));
5437054165
osUuidCreate(&id);
5437154166
xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
5437254167
memset(&id, 0, sizeof(UUID));
5437354168
osUuidCreateSequential(&id);
5437454169
xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
5437554170
}
54376
-#endif /* !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID */
54171
+#endif /* !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID */
5437754172
return e.nXor>nBuf ? nBuf : e.nXor;
5437854173
#endif /* defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) */
5437954174
}
5438054175
5438154176
@@ -54602,19 +54397,20 @@
5460254397
};
5460354398
#endif
5460454399
5460554400
/* Double-check that the aSyscall[] array has been constructed
5460654401
** correctly. See ticket [bb3a86e890c8e96ab] */
54607
- assert( ArraySize(aSyscall)==89 );
54402
+ assert( ArraySize(aSyscall)==81 );
54403
+ assert( strcmp(aSyscall[0].zName,"AreFileApisANSI")==0 );
54404
+ assert( strcmp(aSyscall[20].zName,"GetFileAttributesA")==0 );
54405
+ assert( strcmp(aSyscall[40].zName,"HeapReAlloc")==0 );
54406
+ assert( strcmp(aSyscall[60].zName,"WideCharToMultiByte")==0 );
54407
+ assert( strcmp(aSyscall[80].zName,"cygwin_conv_path")==0 );
5460854408
5460954409
/* get memory map allocation granularity */
5461054410
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
54611
-#if SQLITE_OS_WINRT
54612
- osGetNativeSystemInfo(&winSysInfo);
54613
-#else
5461454411
osGetSystemInfo(&winSysInfo);
54615
-#endif
5461654412
assert( winSysInfo.dwAllocationGranularity>0 );
5461754413
assert( winSysInfo.dwPageSize>0 );
5461854414
5461954415
sqlite3_vfs_register(&winVfs, 1);
5462054416
@@ -54634,21 +54430,13 @@
5463454430
5463554431
return SQLITE_OK;
5463654432
}
5463754433
5463854434
SQLITE_API int sqlite3_os_end(void){
54639
-#if SQLITE_OS_WINRT
54640
- if( sleepObj!=NULL ){
54641
- osCloseHandle(sleepObj);
54642
- sleepObj = NULL;
54643
- }
54644
-#endif
54645
-
5464654435
#ifndef SQLITE_OMIT_WAL
5464754436
winBigLock = 0;
5464854437
#endif
54649
-
5465054438
return SQLITE_OK;
5465154439
}
5465254440
5465354441
#endif /* SQLITE_OS_WIN */
5465454442
@@ -110848,14 +110636,12 @@
110848110636
}
110849110637
if( iCol>0 ){
110850110638
/* Convert the ORDER BY term into an integer column number iCol,
110851110639
** taking care to preserve the COLLATE clause if it exists. */
110852110640
if( !IN_RENAME_OBJECT ){
110853
- Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
110641
+ Expr *pNew = sqlite3ExprInt32(db, iCol);
110854110642
if( pNew==0 ) return 1;
110855
- pNew->flags |= EP_IntValue;
110856
- pNew->u.iValue = iCol;
110857110643
if( pItem->pExpr==pE ){
110858110644
pItem->pExpr = pNew;
110859110645
}else{
110860110646
Expr *pParent = pItem->pExpr;
110861110647
assert( pParent->op==TK_COLLATE );
@@ -111205,14 +110991,10 @@
111205110991
}
111206110992
}
111207110993
}
111208110994
#endif
111209110995
111210
- /* The ORDER BY and GROUP BY clauses may not refer to terms in
111211
- ** outer queries
111212
- */
111213
- sNC.pNext = 0;
111214110996
sNC.ncFlags |= NC_AllowAgg|NC_AllowWin;
111215110997
111216110998
/* If this is a converted compound query, move the ORDER BY clause from
111217110999
** the sub-query back to the parent query. At this point each term
111218111000
** within the ORDER BY clause has been transformed to an integer value.
@@ -112447,38 +112229,26 @@
112447112229
int op, /* Expression opcode */
112448112230
const Token *pToken, /* Token argument. Might be NULL */
112449112231
int dequote /* True to dequote */
112450112232
){
112451112233
Expr *pNew;
112452
- int nExtra = 0;
112453
- int iValue = 0;
112234
+ int nExtra = pToken ? pToken->n+1 : 0;
112454112235
112455112236
assert( db!=0 );
112456
- if( pToken ){
112457
- if( op!=TK_INTEGER || pToken->z==0
112458
- || sqlite3GetInt32(pToken->z, &iValue)==0 ){
112459
- nExtra = pToken->n+1; /* tag-20240227-a */
112460
- assert( iValue>=0 );
112461
- }
112462
- }
112463112237
pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
112464112238
if( pNew ){
112465112239
memset(pNew, 0, sizeof(Expr));
112466112240
pNew->op = (u8)op;
112467112241
pNew->iAgg = -1;
112468
- if( pToken ){
112469
- if( nExtra==0 ){
112470
- pNew->flags |= EP_IntValue|EP_Leaf|(iValue?EP_IsTrue:EP_IsFalse);
112471
- pNew->u.iValue = iValue;
112472
- }else{
112473
- pNew->u.zToken = (char*)&pNew[1];
112474
- assert( pToken->z!=0 || pToken->n==0 );
112475
- if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
112476
- pNew->u.zToken[pToken->n] = 0;
112477
- if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
112478
- sqlite3DequoteExpr(pNew);
112479
- }
112242
+ if( nExtra ){
112243
+ assert( pToken!=0 );
112244
+ pNew->u.zToken = (char*)&pNew[1];
112245
+ assert( pToken->z!=0 || pToken->n==0 );
112246
+ if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
112247
+ pNew->u.zToken[pToken->n] = 0;
112248
+ if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
112249
+ sqlite3DequoteExpr(pNew);
112480112250
}
112481112251
}
112482112252
#if SQLITE_MAX_EXPR_DEPTH>0
112483112253
pNew->nHeight = 1;
112484112254
#endif
@@ -112498,10 +112268,28 @@
112498112268
Token x;
112499112269
x.z = zToken;
112500112270
x.n = sqlite3Strlen30(zToken);
112501112271
return sqlite3ExprAlloc(db, op, &x, 0);
112502112272
}
112273
+
112274
+/*
112275
+** Allocate an expression for a 32-bit signed integer literal.
112276
+*/
112277
+SQLITE_PRIVATE Expr *sqlite3ExprInt32(sqlite3 *db, int iVal){
112278
+ Expr *pNew = sqlite3DbMallocRawNN(db, sizeof(Expr));
112279
+ if( pNew ){
112280
+ memset(pNew, 0, sizeof(Expr));
112281
+ pNew->op = TK_INTEGER;
112282
+ pNew->iAgg = -1;
112283
+ pNew->flags = EP_IntValue|EP_Leaf|(iVal?EP_IsTrue:EP_IsFalse);
112284
+ pNew->u.iValue = iVal;
112285
+#if SQLITE_MAX_EXPR_DEPTH>0
112286
+ pNew->nHeight = 1;
112287
+#endif
112288
+ }
112289
+ return pNew;
112290
+}
112503112291
112504112292
/*
112505112293
** Attach subtrees pLeft and pRight to the Expr node pRoot.
112506112294
**
112507112295
** If pRoot==NULL that means that a memory allocation error has occurred.
@@ -112661,11 +112449,11 @@
112661112449
if( (f&(EP_OuterON|EP_InnerON|EP_IsFalse|EP_HasFunc))==EP_IsFalse
112662112450
&& !IN_RENAME_OBJECT
112663112451
){
112664112452
sqlite3ExprDeferredDelete(pParse, pLeft);
112665112453
sqlite3ExprDeferredDelete(pParse, pRight);
112666
- return sqlite3Expr(db, TK_INTEGER, "0");
112454
+ return sqlite3ExprInt32(db, 0);
112667112455
}else{
112668112456
return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
112669112457
}
112670112458
}
112671112459
}
@@ -112786,11 +112574,13 @@
112786112574
const Expr *pExpr, /* The function invocation */
112787112575
const FuncDef *pDef /* The function being invoked */
112788112576
){
112789112577
assert( !IN_RENAME_OBJECT );
112790112578
assert( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 );
112791
- if( ExprHasProperty(pExpr, EP_FromDDL) ){
112579
+ if( ExprHasProperty(pExpr, EP_FromDDL)
112580
+ || pParse->prepFlags & SQLITE_PREPARE_FROM_DDL
112581
+ ){
112792112582
if( (pDef->funcFlags & SQLITE_FUNC_DIRECT)!=0
112793112583
|| (pParse->db->flags & SQLITE_TrustedSchema)==0
112794112584
){
112795112585
/* Functions prohibited in triggers and views if:
112796112586
** (1) tagged with SQLITE_DIRECTONLY
@@ -114136,11 +113926,11 @@
114136113926
return w.eCode;
114137113927
}
114138113928
114139113929
/*
114140113930
** Walk an expression tree. Return non-zero if the expression is constant
114141
-** and 0 if it involves variables or function calls.
113931
+** or return zero if the expression involves variables or function calls.
114142113932
**
114143113933
** For the purposes of this function, a double-quoted string (ex: "abc")
114144113934
** is considered a variable but a single-quoted string (ex: 'abc') is
114145113935
** a constant.
114146113936
**
@@ -115403,13 +115193,26 @@
115403115193
nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
115404115194
sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);
115405115195
pParse->nMem += nReg;
115406115196
if( pExpr->op==TK_SELECT ){
115407115197
dest.eDest = SRT_Mem;
115408
- dest.iSdst = dest.iSDParm;
115198
+ if( (pSel->selFlags&SF_Distinct) && pSel->pLimit && pSel->pLimit->pRight ){
115199
+ /* If there is both a DISTINCT and an OFFSET clause, then allocate
115200
+ ** a separate dest.iSdst array for sqlite3Select() and other
115201
+ ** routines to populate. In this case results will be copied over
115202
+ ** into the dest.iSDParm array only after OFFSET processing. This
115203
+ ** ensures that in the case where OFFSET excludes all rows, the
115204
+ ** dest.iSDParm array is not left populated with the contents of the
115205
+ ** last row visited - it should be all NULLs if all rows were
115206
+ ** excluded by OFFSET. */
115207
+ dest.iSdst = pParse->nMem+1;
115208
+ pParse->nMem += nReg;
115209
+ }else{
115210
+ dest.iSdst = dest.iSDParm;
115211
+ }
115409115212
dest.nSdst = nReg;
115410
- sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1);
115213
+ sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, pParse->nMem);
115411115214
VdbeComment((v, "Init subquery result"));
115412115215
}else{
115413115216
dest.eDest = SRT_Exists;
115414115217
sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm);
115415115218
VdbeComment((v, "Init EXISTS result"));
@@ -115421,11 +115224,11 @@
115421115224
Expr *pLeft = pSel->pLimit->pLeft;
115422115225
if( ExprHasProperty(pLeft, EP_IntValue)==0
115423115226
|| (pLeft->u.iValue!=1 && pLeft->u.iValue!=0)
115424115227
){
115425115228
sqlite3 *db = pParse->db;
115426
- pLimit = sqlite3Expr(db, TK_INTEGER, "0");
115229
+ pLimit = sqlite3ExprInt32(db, 0);
115427115230
if( pLimit ){
115428115231
pLimit->affExpr = SQLITE_AFF_NUMERIC;
115429115232
pLimit = sqlite3PExpr(pParse, TK_NE,
115430115233
sqlite3ExprDup(db, pLeft, 0), pLimit);
115431115234
}
@@ -115432,11 +115235,11 @@
115432115235
sqlite3ExprDeferredDelete(pParse, pLeft);
115433115236
pSel->pLimit->pLeft = pLimit;
115434115237
}
115435115238
}else{
115436115239
/* If there is no pre-existing limit add a limit of 1 */
115437
- pLimit = sqlite3Expr(pParse->db, TK_INTEGER, "1");
115240
+ pLimit = sqlite3ExprInt32(pParse->db, 1);
115438115241
pSel->pLimit = sqlite3PExpr(pParse, TK_LIMIT, pLimit, 0);
115439115242
}
115440115243
pSel->iLimit = 0;
115441115244
if( sqlite3Select(pParse, pSel, &dest) ){
115442115245
pExpr->op2 = pExpr->op;
@@ -120551,12 +120354,12 @@
120551120354
for(pStep=pNew->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext){
120552120355
if( pStep->pSelect ){
120553120356
sqlite3SelectPrep(pParse, pStep->pSelect, &sNC);
120554120357
if( pParse->nErr ) rc = pParse->rc;
120555120358
}
120556
- if( rc==SQLITE_OK && pStep->zTarget ){
120557
- SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
120359
+ if( rc==SQLITE_OK && pStep->pSrc ){
120360
+ SrcList *pSrc = sqlite3SrcListDup(db, pStep->pSrc, 0);
120558120361
if( pSrc ){
120559120362
Select *pSel = sqlite3SelectNew(
120560120363
pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
120561120364
);
120562120365
if( pSel==0 ){
@@ -120580,14 +120383,14 @@
120580120383
assert( pSrc==pSel->pSrc );
120581120384
if( pStep->pExprList ) pSel->pEList = 0;
120582120385
pSel->pSrc = 0;
120583120386
sqlite3SelectDelete(db, pSel);
120584120387
}
120585
- if( pStep->pFrom ){
120388
+ if( ALWAYS(pStep->pSrc) ){
120586120389
int i;
120587
- for(i=0; i<pStep->pFrom->nSrc && rc==SQLITE_OK; i++){
120588
- SrcItem *p = &pStep->pFrom->a[i];
120390
+ for(i=0; i<pStep->pSrc->nSrc && rc==SQLITE_OK; i++){
120391
+ SrcItem *p = &pStep->pSrc->a[i];
120589120392
if( p->fg.isSubquery ){
120590120393
assert( p->u4.pSubq!=0 );
120591120394
sqlite3SelectPrep(pParse, p->u4.pSubq->pSelect, 0);
120592120395
}
120593120396
}
@@ -120652,17 +120455,17 @@
120652120455
sqlite3WalkExprList(pWalker, pUpsert->pUpsertTarget);
120653120456
sqlite3WalkExprList(pWalker, pUpsert->pUpsertSet);
120654120457
sqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere);
120655120458
sqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere);
120656120459
}
120657
- if( pStep->pFrom ){
120460
+ if( pStep->pSrc ){
120658120461
int i;
120659
- SrcList *pFrom = pStep->pFrom;
120660
- for(i=0; i<pFrom->nSrc; i++){
120661
- if( pFrom->a[i].fg.isSubquery ){
120662
- assert( pFrom->a[i].u4.pSubq!=0 );
120663
- sqlite3WalkSelect(pWalker, pFrom->a[i].u4.pSubq->pSelect);
120462
+ SrcList *pSrc = pStep->pSrc;
120463
+ for(i=0; i<pSrc->nSrc; i++){
120464
+ if( pSrc->a[i].fg.isSubquery ){
120465
+ assert( pSrc->a[i].u4.pSubq!=0 );
120466
+ sqlite3WalkSelect(pWalker, pSrc->a[i].u4.pSubq->pSelect);
120664120467
}
120665120468
}
120666120469
}
120667120470
}
120668120471
}
@@ -120829,12 +120632,12 @@
120829120632
TriggerStep *pStep;
120830120633
rc = renameResolveTrigger(&sParse);
120831120634
if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
120832120635
120833120636
for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){
120834
- if( pStep->zTarget ){
120835
- Table *pTarget = sqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb);
120637
+ if( pStep->pSrc ){
120638
+ Table *pTarget = sqlite3LocateTableItem(&sParse, 0, &pStep->pSrc->a[0]);
120836120639
if( pTarget==pTab ){
120837120640
if( pStep->pUpsert ){
120838120641
ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet;
120839120642
renameColumnElistNames(&sParse, &sCtx, pUpsertSet, zOld);
120840120643
}
@@ -120841,11 +120644,10 @@
120841120644
renameColumnIdlistNames(&sParse, &sCtx, pStep->pIdList, zOld);
120842120645
renameColumnElistNames(&sParse, &sCtx, pStep->pExprList, zOld);
120843120646
}
120844120647
}
120845120648
}
120846
-
120847120649
120848120650
/* Find tokens to edit in UPDATE OF clause */
120849120651
if( sParse.pTriggerTab==pTab ){
120850120652
renameColumnIdlistNames(&sParse, &sCtx,sParse.pNewTrigger->pColumns,zOld);
120851120653
}
@@ -121044,17 +120846,14 @@
121044120846
if( isLegacy==0 ){
121045120847
rc = renameResolveTrigger(&sParse);
121046120848
if( rc==SQLITE_OK ){
121047120849
renameWalkTrigger(&sWalker, pTrigger);
121048120850
for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
121049
- if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
121050
- renameTokenFind(&sParse, &sCtx, pStep->zTarget);
121051
- }
121052
- if( pStep->pFrom ){
120851
+ if( pStep->pSrc ){
121053120852
int i;
121054
- for(i=0; i<pStep->pFrom->nSrc; i++){
121055
- SrcItem *pItem = &pStep->pFrom->a[i];
120853
+ for(i=0; i<pStep->pSrc->nSrc; i++){
120854
+ SrcItem *pItem = &pStep->pSrc->a[i];
121056120855
if( 0==sqlite3_stricmp(pItem->zName, zOld) ){
121057120856
renameTokenFind(&sParse, &sCtx, pItem->zName);
121058120857
}
121059120858
}
121060120859
}
@@ -121297,10 +121096,61 @@
121297121096
#ifndef SQLITE_OMIT_AUTHORIZATION
121298121097
db->xAuth = xAuth;
121299121098
#endif
121300121099
}
121301121100
121101
+
121102
+/*
121103
+** Return the number of bytes until the end of the next non-whitespace and
121104
+** non-comment token. For the purpose of this function, a "(" token includes
121105
+** all of the bytes through and including the matching ")", or until the
121106
+** first illegal token, whichever comes first.
121107
+**
121108
+** Write the token type into *piToken.
121109
+**
121110
+** The value returned is the number of bytes in the token itself plus
121111
+** the number of bytes of leading whitespace and comments skipped plus
121112
+** all bytes through the next matching ")" if the token is TK_LP.
121113
+**
121114
+** Example: (Note: '.' used in place of '*' in the example z[] text)
121115
+**
121116
+** ,--------- *piToken := TK_RP
121117
+** v
121118
+** z[] = " /.comment./ --comment\n (two three four) five"
121119
+** | |
121120
+** |<-------------------------------------->|
121121
+** |
121122
+** `--- return value
121123
+*/
121124
+static int getConstraintToken(const u8 *z, int *piToken){
121125
+ int iOff = 0;
121126
+ int t = 0;
121127
+ do {
121128
+ iOff += sqlite3GetToken(&z[iOff], &t);
121129
+ }while( t==TK_SPACE || t==TK_COMMENT );
121130
+
121131
+ *piToken = t;
121132
+
121133
+ if( t==TK_LP ){
121134
+ int nNest = 1;
121135
+ while( nNest>0 ){
121136
+ iOff += sqlite3GetToken(&z[iOff], &t);
121137
+ if( t==TK_LP ){
121138
+ nNest++;
121139
+ }else if( t==TK_RP ){
121140
+ t = TK_LP;
121141
+ nNest--;
121142
+ }else if( t==TK_ILLEGAL ){
121143
+ break;
121144
+ }
121145
+ }
121146
+ }
121147
+
121148
+ *piToken = t;
121149
+ return iOff;
121150
+}
121151
+
121302121152
/*
121303121153
** The implementation of internal UDF sqlite_drop_column().
121304121154
**
121305121155
** Arguments:
121306121156
**
@@ -121341,19 +121191,28 @@
121341121191
/* This can happen if the sqlite_schema table is corrupt */
121342121192
rc = SQLITE_CORRUPT_BKPT;
121343121193
goto drop_column_done;
121344121194
}
121345121195
121346
- pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zCnName);
121347121196
if( iCol<pTab->nCol-1 ){
121348121197
RenameToken *pEnd;
121198
+ pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zCnName);
121349121199
pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zCnName);
121350121200
zEnd = (const char*)pEnd->t.z;
121351121201
}else{
121202
+ int eTok;
121352121203
assert( IsOrdinaryTable(pTab) );
121204
+ assert( iCol!=0 );
121205
+ /* Point pCol->t.z at the "," immediately preceding the definition of
121206
+ ** the column being dropped. To do this, start at the name of the
121207
+ ** previous column, and tokenize until the next ",". */
121208
+ pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol-1].zCnName);
121209
+ do {
121210
+ pCol->t.z += getConstraintToken((const u8*)pCol->t.z, &eTok);
121211
+ }while( eTok!=TK_COMMA );
121212
+ pCol->t.z--;
121353121213
zEnd = (const char*)&zSql[pTab->u.tab.addColOffset];
121354
- while( ALWAYS(pCol->t.z[0]!=0) && pCol->t.z[0]!=',' ) pCol->t.z--;
121355121214
}
121356121215
121357121216
zNew = sqlite3MPrintf(db, "%.*s%s", pCol->t.z-zSql, zSql, zEnd);
121358121217
sqlite3_result_text(context, zNew, -1, SQLITE_TRANSIENT);
121359121218
sqlite3_free(zNew);
@@ -121533,60 +121392,10 @@
121533121392
}
121534121393
return nRet;
121535121394
}
121536121395
121537121396
121538
-/*
121539
-** Return the number of bytes until the end of the next non-whitespace and
121540
-** non-comment token. For the purpose of this function, a "(" token includes
121541
-** all of the bytes through and including the matching ")", or until the
121542
-** first illegal token, whichever comes first.
121543
-**
121544
-** Write the token type into *piToken.
121545
-**
121546
-** The value returned is the number of bytes in the token itself plus
121547
-** the number of bytes of leading whitespace and comments skipped plus
121548
-** all bytes through the next matching ")" if the token is TK_LP.
121549
-**
121550
-** Example: (Note: '.' used in place of '*' in the example z[] text)
121551
-**
121552
-** ,--------- *piToken := TK_RP
121553
-** v
121554
-** z[] = " /.comment./ --comment\n (two three four) five"
121555
-** | |
121556
-** |<-------------------------------------->|
121557
-** |
121558
-** `--- return value
121559
-*/
121560
-static int getConstraintToken(const u8 *z, int *piToken){
121561
- int iOff = 0;
121562
- int t = 0;
121563
- do {
121564
- iOff += sqlite3GetToken(&z[iOff], &t);
121565
- }while( t==TK_SPACE || t==TK_COMMENT );
121566
-
121567
- *piToken = t;
121568
-
121569
- if( t==TK_LP ){
121570
- int nNest = 1;
121571
- while( nNest>0 ){
121572
- iOff += sqlite3GetToken(&z[iOff], &t);
121573
- if( t==TK_LP ){
121574
- nNest++;
121575
- }else if( t==TK_RP ){
121576
- t = TK_LP;
121577
- nNest--;
121578
- }else if( t==TK_ILLEGAL ){
121579
- break;
121580
- }
121581
- }
121582
- }
121583
-
121584
- *piToken = t;
121585
- return iOff;
121586
-}
121587
-
121588121397
/*
121589121398
** Argument z points into the body of a constraint - specifically the
121590121399
** second token of the constraint definition. For a named constraint,
121591121400
** z points to the first token past the CONSTRAINT keyword. For an
121592121401
** unnamed NOT NULL constraint, z points to the first byte past the NOT
@@ -121632,17 +121441,22 @@
121632121441
** non-zero if they differ. Normally return SQLITE_OK, except if there
121633121442
** is an OOM, set the OOM error condition on ctx and return SQLITE_NOMEM.
121634121443
*/
121635121444
static int quotedCompare(
121636121445
sqlite3_context *ctx, /* Function context on which to report errors */
121446
+ int t, /* Token type */
121637121447
const u8 *zQuote, /* Possibly quoted text. Not zero-terminated. */
121638121448
int nQuote, /* Length of zQuote in bytes */
121639121449
const u8 *zCmp, /* Zero-terminated, unquoted name to compare against */
121640121450
int *pRes /* OUT: Set to 0 if equal, non-zero if unequal */
121641121451
){
121642121452
char *zCopy = 0; /* De-quoted, zero-terminated copy of zQuote[] */
121643121453
121454
+ if( t==TK_ILLEGAL ){
121455
+ *pRes = 1;
121456
+ return SQLITE_OK;
121457
+ }
121644121458
zCopy = sqlite3MallocZero(nQuote+1);
121645121459
if( zCopy==0 ){
121646121460
sqlite3_result_error_nomem(ctx);
121647121461
return SQLITE_NOMEM_BKPT;
121648121462
}
@@ -121737,11 +121551,11 @@
121737121551
121738121552
/* Compare the next token - which may be quoted - with the name of
121739121553
** the constraint being dropped. */
121740121554
nTok = getConstraintToken(&zSql[iOff], &t);
121741121555
if( zCons ){
121742
- if( quotedCompare(ctx, &zSql[iOff], nTok, zCons, &cmp) ) return;
121556
+ if( quotedCompare(ctx, t, &zSql[iOff], nTok, zCons, &cmp) ) return;
121743121557
}
121744121558
iOff += nTok;
121745121559
121746121560
/* The next token is usually the first token of the constraint
121747121561
** definition. This is enough to tell the type of the constraint -
@@ -122131,11 +121945,11 @@
122131121945
if( t==TK_CONSTRAINT ){
122132121946
int nTok = 0;
122133121947
int cmp = 0;
122134121948
iOff += getWhitespace(&zSql[iOff]);
122135121949
nTok = getConstraintToken(&zSql[iOff], &t);
122136
- if( quotedCompare(ctx, &zSql[iOff], nTok, zCons, &cmp) ) return;
121950
+ if( quotedCompare(ctx, t, &zSql[iOff], nTok, zCons, &cmp) ) return;
122137121951
if( cmp==0 ){
122138121952
sqlite3_result_int(ctx, 1);
122139121953
return;
122140121954
}
122141121955
}else if( t==TK_ILLEGAL ){
@@ -124842,11 +124656,11 @@
124842124656
){
124843124657
while( pStep ){
124844124658
if( sqlite3WalkSelect(&pFix->w, pStep->pSelect)
124845124659
|| sqlite3WalkExpr(&pFix->w, pStep->pWhere)
124846124660
|| sqlite3WalkExprList(&pFix->w, pStep->pExprList)
124847
- || sqlite3FixSrcList(pFix, pStep->pFrom)
124661
+ || sqlite3FixSrcList(pFix, pStep->pSrc)
124848124662
){
124849124663
return 1;
124850124664
}
124851124665
#ifndef SQLITE_OMIT_UPSERT
124852124666
{
@@ -131588,11 +131402,11 @@
131588131402
** * Do not allow DELETE, INSERT, or UPDATE of SQLITE_VTAB_DIRECTONLY
131589131403
** virtual tables
131590131404
** * Only allow DELETE, INSERT, or UPDATE of non-SQLITE_VTAB_INNOCUOUS
131591131405
** virtual tables if PRAGMA trusted_schema=ON.
131592131406
*/
131593
- if( pParse->pToplevel!=0
131407
+ if( (pParse->pToplevel!=0 || (pParse->prepFlags & SQLITE_PREPARE_FROM_DDL))
131594131408
&& pTab->u.vtab.p->eVtabRisk >
131595131409
((pParse->db->flags & SQLITE_TrustedSchema)!=0)
131596131410
){
131597131411
sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"",
131598131412
pTab->zName);
@@ -136687,10 +136501,11 @@
136687136501
** the lookaside buffer belonging to database handle dbMem.
136688136502
*/
136689136503
static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){
136690136504
if( p ){
136691136505
TriggerStep *pStep = p->step_list;
136506
+ sqlite3SrcListDelete(dbMem, pStep->pSrc);
136692136507
sqlite3ExprDelete(dbMem, pStep->pWhere);
136693136508
sqlite3ExprListDelete(dbMem, pStep->pExprList);
136694136509
sqlite3SelectDelete(dbMem, pStep->pSelect);
136695136510
sqlite3ExprDelete(dbMem, p->pWhen);
136696136511
sqlite3DbFree(dbMem, p);
@@ -137353,18 +137168,18 @@
137353137168
/* Disable lookaside memory allocation */
137354137169
DisableLookaside;
137355137170
137356137171
pTrigger = (Trigger *)sqlite3DbMallocZero(db,
137357137172
sizeof(Trigger) + /* struct Trigger */
137358
- sizeof(TriggerStep) + /* Single step in trigger program */
137359
- nFrom + 1 /* Space for pStep->zTarget */
137173
+ sizeof(TriggerStep) /* Single step in trigger program */
137360137174
);
137361137175
if( pTrigger ){
137362137176
pStep = pTrigger->step_list = (TriggerStep *)&pTrigger[1];
137363
- pStep->zTarget = (char *)&pStep[1];
137364
- memcpy((char *)pStep->zTarget, zFrom, nFrom);
137365
-
137177
+ pStep->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
137178
+ if( pStep->pSrc ){
137179
+ pStep->pSrc->a[0].zName = sqlite3DbStrNDup(db, zFrom, nFrom);
137180
+ }
137366137181
pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
137367137182
pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE);
137368137183
pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
137369137184
if( pWhen ){
137370137185
pWhen = sqlite3PExpr(pParse, TK_NOT, pWhen, 0);
@@ -142392,37 +142207,46 @@
142392142207
142393142208
/* If no entry point was specified and the default legacy
142394142209
** entry point name "sqlite3_extension_init" was not found, then
142395142210
** construct an entry point name "sqlite3_X_init" where the X is
142396142211
** replaced by the lowercase value of every ASCII alphabetic
142397
- ** character in the filename after the last "/" upto the first ".",
142398
- ** and eliding the first three characters if they are "lib".
142212
+ ** character in the filename after the last "/" up to the first ".",
142213
+ ** and skipping the first three characters if they are "lib".
142399142214
** Examples:
142400142215
**
142401142216
** /usr/local/lib/libExample5.4.3.so ==> sqlite3_example_init
142402142217
** C:/lib/mathfuncs.dll ==> sqlite3_mathfuncs_init
142218
+ **
142219
+ ** If that still finds no entry point, repeat a second time but this
142220
+ ** time include both alphabetic and numeric characters up to the first
142221
+ ** ".". Example:
142222
+ **
142223
+ ** /usr/local/lib/libExample5.4.3.so ==> sqlite3_example5_init
142403142224
*/
142404142225
if( xInit==0 && zProc==0 ){
142405142226
int iFile, iEntry, c;
142406142227
int ncFile = sqlite3Strlen30(zFile);
142228
+ int cnt = 0;
142407142229
zAltEntry = sqlite3_malloc64(ncFile+30);
142408142230
if( zAltEntry==0 ){
142409142231
sqlite3OsDlClose(pVfs, handle);
142410142232
return SQLITE_NOMEM_BKPT;
142411142233
}
142412
- memcpy(zAltEntry, "sqlite3_", 8);
142413
- for(iFile=ncFile-1; iFile>=0 && !DirSep(zFile[iFile]); iFile--){}
142414
- iFile++;
142415
- if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
142416
- for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
142417
- if( sqlite3Isalpha(c) ){
142418
- zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];
142419
- }
142420
- }
142421
- memcpy(zAltEntry+iEntry, "_init", 6);
142422
- zEntry = zAltEntry;
142423
- xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
142234
+ do{
142235
+ memcpy(zAltEntry, "sqlite3_", 8);
142236
+ for(iFile=ncFile-1; iFile>=0 && !DirSep(zFile[iFile]); iFile--){}
142237
+ iFile++;
142238
+ if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
142239
+ for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
142240
+ if( sqlite3Isalpha(c) || (cnt && sqlite3Isdigit(c)) ){
142241
+ zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];
142242
+ }
142243
+ }
142244
+ memcpy(zAltEntry+iEntry, "_init", 6);
142245
+ zEntry = zAltEntry;
142246
+ xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
142247
+ }while( xInit==0 && (++cnt)<2 );
142424142248
}
142425142249
if( xInit==0 ){
142426142250
if( pzErrMsg ){
142427142251
nMsg += strlen(zEntry) + 300;
142428142252
*pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg);
@@ -148998,13 +148822,18 @@
148998148822
case SRT_Mem: {
148999148823
if( pSort ){
149000148824
assert( nResultCol<=pDest->nSdst );
149001148825
pushOntoSorter(
149002148826
pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg);
148827
+ pDest->iSDParm = regResult;
149003148828
}else{
149004148829
assert( nResultCol==pDest->nSdst );
149005
- assert( regResult==iParm );
148830
+ if( regResult!=iParm ){
148831
+ /* This occurs in cases where the SELECT had both a DISTINCT and
148832
+ ** an OFFSET clause. */
148833
+ sqlite3VdbeAddOp3(v, OP_Copy, regResult, iParm, nResultCol-1);
148834
+ }
149006148835
/* The LIMIT clause will jump out of the loop for us */
149007148836
}
149008148837
break;
149009148838
}
149010148839
#endif /* #ifndef SQLITE_OMIT_SUBQUERY */
@@ -151165,14 +150994,12 @@
151165150994
assert( pItem!=0 );
151166150995
assert( pItem->u.x.iOrderByCol>0 );
151167150996
if( pItem->u.x.iOrderByCol==i ) break;
151168150997
}
151169150998
if( j==nOrderBy ){
151170
- Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
150999
+ Expr *pNew = sqlite3ExprInt32(db, i);
151171151000
if( pNew==0 ) return SQLITE_NOMEM_BKPT;
151172
- pNew->flags |= EP_IntValue;
151173
- pNew->u.iValue = i;
151174151001
p->pOrderBy = pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
151175151002
if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i;
151176151003
}
151177151004
}
151178151005
}
@@ -153731,11 +153558,11 @@
153731153558
}
153732153559
sqlite3SrcItemAttachSubquery(pParse, pFrom, pTab->u.view.pSelect, 1);
153733153560
}
153734153561
#ifndef SQLITE_OMIT_VIRTUALTABLE
153735153562
else if( ALWAYS(IsVirtual(pTab))
153736
- && pFrom->fg.fromDDL
153563
+ && (pFrom->fg.fromDDL || (pParse->prepFlags & SQLITE_PREPARE_FROM_DDL))
153737153564
&& ALWAYS(pTab->u.vtab.p!=0)
153738153565
&& pTab->u.vtab.p->eVtabRisk > ((db->flags & SQLITE_TrustedSchema)!=0)
153739153566
){
153740153567
sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"",
153741153568
pTab->zName);
@@ -154684,11 +154511,11 @@
154684154511
if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy)
154685154512
&& ExprAlwaysFalse(pExpr)==0
154686154513
&& pExpr->pAggInfo==0
154687154514
){
154688154515
sqlite3 *db = pWalker->pParse->db;
154689
- Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1");
154516
+ Expr *pNew = sqlite3ExprInt32(db, 1);
154690154517
if( pNew ){
154691154518
Expr *pWhere = pS->pWhere;
154692154519
SWAP(Expr, *pNew, *pExpr);
154693154520
pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew);
154694154521
pS->pWhere = pNew;
@@ -155015,16 +154842,28 @@
155015154842
Expr *pSubWhere = pSub->pWhere;
155016154843
if( pSub->pSrc->nSrc==1
155017154844
&& (pSub->selFlags & SF_Aggregate)==0
155018154845
&& !pSub->pSrc->a[0].fg.isSubquery
155019154846
&& pSub->pLimit==0
154847
+ && pSub->pPrior==0
155020154848
){
154849
+ /* Before combining the sub-select with the parent, renumber the
154850
+ ** cursor used by the subselect. This is because the EXISTS expression
154851
+ ** might be a copy of another EXISTS expression from somewhere
154852
+ ** else in the tree, and in this case it is important that it use
154853
+ ** a unique cursor number. */
154854
+ sqlite3 *db = pParse->db;
154855
+ int *aCsrMap = sqlite3DbMallocZero(db, (pParse->nTab+2)*sizeof(int));
154856
+ if( aCsrMap==0 ) return;
154857
+ aCsrMap[0] = (pParse->nTab+1);
154858
+ renumberCursors(pParse, pSub, -1, aCsrMap);
154859
+ sqlite3DbFree(db, aCsrMap);
154860
+
155021154861
memset(pWhere, 0, sizeof(*pWhere));
155022154862
pWhere->op = TK_INTEGER;
155023154863
pWhere->u.iValue = 1;
155024154864
ExprSetProperty(pWhere, EP_IntValue);
155025
-
155026154865
assert( p->pWhere!=0 );
155027154866
pSub->pSrc->a[0].fg.fromExists = 1;
155028154867
pSub->pSrc->a[0].fg.jointype |= JT_CROSS;
155029154868
p->pSrc = sqlite3SrcListAppendList(pParse, p->pSrc, pSub->pSrc);
155030154869
if( pSubWhere ){
@@ -155152,10 +154991,34 @@
155152154991
memset(&sCtx, 0, sizeof(sCtx));
155153154992
sCtx.pSrc = pSelect->pSrc;
155154154993
sqlite3WalkExprNN(&w, pSelect->pWhere);
155155154994
pSelect->selFlags &= ~SF_OnToWhere;
155156154995
}
154996
+
154997
+/*
154998
+** If p2 exists and p1 and p2 have the same number of terms, then change
154999
+** every term of p1 to have the same sort order as p2 and return true.
155000
+**
155001
+** If p2 is NULL or p1 and p2 are different lengths, then make no changes
155002
+** and return false.
155003
+**
155004
+** p1 must be non-NULL.
155005
+*/
155006
+static int sqlite3CopySortOrder(ExprList *p1, ExprList *p2){
155007
+ assert( p1 );
155008
+ if( p2 && p1->nExpr==p2->nExpr ){
155009
+ int ii;
155010
+ for(ii=0; ii<p1->nExpr; ii++){
155011
+ u8 sortFlags;
155012
+ sortFlags = p2->a[ii].fg.sortFlags & KEYINFO_ORDER_DESC;
155013
+ p1->a[ii].fg.sortFlags = sortFlags;
155014
+ }
155015
+ return 1;
155016
+ }else{
155017
+ return 0;
155018
+ }
155019
+}
155157155020
155158155021
/*
155159155022
** Generate byte-code for the SELECT statement given in the p argument.
155160155023
**
155161155024
** The results are returned according to the SelectDest structure.
@@ -155805,11 +155668,12 @@
155805155668
** used for both the ORDER BY and DISTINCT processing. As originally
155806155669
** written the query must use a temp-table for at least one of the ORDER
155807155670
** BY and DISTINCT, and an index or separate temp-table for the other.
155808155671
*/
155809155672
if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct
155810
- && sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0
155673
+ && sqlite3CopySortOrder(pEList, sSort.pOrderBy)
155674
+ && sqlite3ExprListCompare(pEList, sSort.pOrderBy, -1)==0
155811155675
&& OptimizationEnabled(db, SQLITE_GroupByOrder)
155812155676
#ifndef SQLITE_OMIT_WINDOWFUNC
155813155677
&& p->pWin==0
155814155678
#endif
155815155679
){
@@ -156019,25 +155883,14 @@
156019155883
** in the correct order. It also may not - the GROUP BY might use a
156020155884
** database index that causes rows to be grouped together as required
156021155885
** but not actually sorted. Either way, record the fact that the
156022155886
** ORDER BY and GROUP BY clauses are the same by setting the orderByGrp
156023155887
** variable. */
156024
- if( sSort.pOrderBy && pGroupBy->nExpr==sSort.pOrderBy->nExpr ){
156025
- int ii;
156026
- /* The GROUP BY processing doesn't care whether rows are delivered in
156027
- ** ASC or DESC order - only that each group is returned contiguously.
156028
- ** So set the ASC/DESC flags in the GROUP BY to match those in the
156029
- ** ORDER BY to maximize the chances of rows being delivered in an
156030
- ** order that makes the ORDER BY redundant. */
156031
- for(ii=0; ii<pGroupBy->nExpr; ii++){
156032
- u8 sortFlags;
156033
- sortFlags = sSort.pOrderBy->a[ii].fg.sortFlags & KEYINFO_ORDER_DESC;
156034
- pGroupBy->a[ii].fg.sortFlags = sortFlags;
156035
- }
156036
- if( sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){
156037
- orderByGrp = 1;
156038
- }
155888
+ if( sqlite3CopySortOrder(pGroupBy, sSort.pOrderBy)
155889
+ && sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0
155890
+ ){
155891
+ orderByGrp = 1;
156039155892
}
156040155893
}else{
156041155894
assert( 0==sqlite3LogEst(1) );
156042155895
p->nSelectRow = 0;
156043155896
}
@@ -156843,11 +156696,11 @@
156843156696
sqlite3ExprDelete(db, pTmp->pWhere);
156844156697
sqlite3ExprListDelete(db, pTmp->pExprList);
156845156698
sqlite3SelectDelete(db, pTmp->pSelect);
156846156699
sqlite3IdListDelete(db, pTmp->pIdList);
156847156700
sqlite3UpsertDelete(db, pTmp->pUpsert);
156848
- sqlite3SrcListDelete(db, pTmp->pFrom);
156701
+ sqlite3SrcListDelete(db, pTmp->pSrc);
156849156702
sqlite3DbFree(db, pTmp->zSpan);
156850156703
156851156704
sqlite3DbFree(db, pTmp);
156852156705
}
156853156706
}
@@ -157032,15 +156885,20 @@
157032156885
}
157033156886
goto trigger_cleanup;
157034156887
}
157035156888
}
157036156889
156890
+ /* NB: The SQLITE_ALLOW_TRIGGERS_ON_SYSTEM_TABLES compile-time option is
156891
+ ** experimental and unsupported. Do not use it unless understand the
156892
+ ** implications and you cannot get by without this capability. */
156893
+#if !defined(SQLITE_ALLOW_TRIGGERS_ON_SYSTEM_TABLES) /* Experimental */
157037156894
/* Do not create a trigger on a system table */
157038156895
if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
157039156896
sqlite3ErrorMsg(pParse, "cannot create trigger on system table");
157040156897
goto trigger_cleanup;
157041156898
}
156899
+#endif
157042156900
157043156901
/* INSTEAD of triggers are only for views and views only support INSTEAD
157044156902
** of triggers.
157045156903
*/
157046156904
if( IsView(pTab) && tr_tm!=TK_INSTEAD ){
@@ -157182,16 +157040,16 @@
157182157040
** are read-only, and the trigger makes a change to a shadow table,
157183157041
** then raise an error - do not allow the trigger to be created. */
157184157042
if( sqlite3ReadOnlyShadowTables(db) ){
157185157043
TriggerStep *pStep;
157186157044
for(pStep=pTrig->step_list; pStep; pStep=pStep->pNext){
157187
- if( pStep->zTarget!=0
157188
- && sqlite3ShadowTableName(db, pStep->zTarget)
157045
+ if( pStep->pSrc!=0
157046
+ && sqlite3ShadowTableName(db, pStep->pSrc->a[0].zName)
157189157047
){
157190157048
sqlite3ErrorMsg(pParse,
157191157049
"trigger \"%s\" may not write to shadow table \"%s\"",
157192
- pTrig->zName, pStep->zTarget);
157050
+ pTrig->zName, pStep->pSrc->a[0].zName);
157193157051
goto triggerfinish_cleanup;
157194157052
}
157195157053
}
157196157054
}
157197157055
@@ -157278,30 +157136,43 @@
157278157136
** If an OOM error occurs, NULL is returned and db->mallocFailed is set.
157279157137
*/
157280157138
static TriggerStep *triggerStepAllocate(
157281157139
Parse *pParse, /* Parser context */
157282157140
u8 op, /* Trigger opcode */
157283
- Token *pName, /* The target name */
157141
+ SrcList *pTabList, /* Target table */
157284157142
const char *zStart, /* Start of SQL text */
157285157143
const char *zEnd /* End of SQL text */
157286157144
){
157145
+ Trigger *pNew = pParse->pNewTrigger;
157287157146
sqlite3 *db = pParse->db;
157288
- TriggerStep *pTriggerStep;
157289
-
157290
- if( pParse->nErr ) return 0;
157291
- pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1);
157292
- if( pTriggerStep ){
157293
- char *z = (char*)&pTriggerStep[1];
157294
- memcpy(z, pName->z, pName->n);
157295
- sqlite3Dequote(z);
157296
- pTriggerStep->zTarget = z;
157297
- pTriggerStep->op = op;
157298
- pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd);
157299
- if( IN_RENAME_OBJECT ){
157300
- sqlite3RenameTokenMap(pParse, pTriggerStep->zTarget, pName);
157301
- }
157302
- }
157147
+ TriggerStep *pTriggerStep = 0;
157148
+
157149
+ if( pParse->nErr==0 ){
157150
+ if( pNew
157151
+ && pNew->pSchema!=db->aDb[1].pSchema
157152
+ && pTabList->a[0].u4.zDatabase
157153
+ ){
157154
+ sqlite3ErrorMsg(pParse,
157155
+ "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
157156
+ "statements within triggers");
157157
+ }else{
157158
+ pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));
157159
+ if( pTriggerStep ){
157160
+ pTriggerStep->pSrc = sqlite3SrcListDup(db, pTabList, EXPRDUP_REDUCE);
157161
+ pTriggerStep->op = op;
157162
+ pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd);
157163
+ if( pTriggerStep->pSrc && IN_RENAME_OBJECT ){
157164
+ sqlite3RenameTokenRemap(pParse,
157165
+ pTriggerStep->pSrc->a[0].zName,
157166
+ pTabList->a[0].zName
157167
+ );
157168
+ }
157169
+ }
157170
+ }
157171
+ }
157172
+
157173
+ sqlite3SrcListDelete(db, pTabList);
157303157174
return pTriggerStep;
157304157175
}
157305157176
157306157177
/*
157307157178
** Build a trigger step out of an INSERT statement. Return a pointer
@@ -157310,11 +157181,11 @@
157310157181
** The parser calls this routine when it sees an INSERT inside the
157311157182
** body of a trigger.
157312157183
*/
157313157184
SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(
157314157185
Parse *pParse, /* Parser */
157315
- Token *pTableName, /* Name of the table into which we insert */
157186
+ SrcList *pTabList, /* Table to INSERT into */
157316157187
IdList *pColumn, /* List of columns in pTableName to insert into */
157317157188
Select *pSelect, /* A SELECT statement that supplies values */
157318157189
u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
157319157190
Upsert *pUpsert, /* ON CONFLICT clauses for upsert */
157320157191
const char *zStart, /* Start of SQL text */
@@ -157323,11 +157194,11 @@
157323157194
sqlite3 *db = pParse->db;
157324157195
TriggerStep *pTriggerStep;
157325157196
157326157197
assert(pSelect != 0 || db->mallocFailed);
157327157198
157328
- pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTableName,zStart,zEnd);
157199
+ pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTabList, zStart, zEnd);
157329157200
if( pTriggerStep ){
157330157201
if( IN_RENAME_OBJECT ){
157331157202
pTriggerStep->pSelect = pSelect;
157332157203
pSelect = 0;
157333157204
}else{
@@ -157355,11 +157226,11 @@
157355157226
** a pointer to that trigger step. The parser calls this routine when it
157356157227
** sees an UPDATE statement inside the body of a CREATE TRIGGER.
157357157228
*/
157358157229
SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(
157359157230
Parse *pParse, /* Parser */
157360
- Token *pTableName, /* Name of the table to be updated */
157231
+ SrcList *pTabList, /* Name of the table to be updated */
157361157232
SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */
157362157233
ExprList *pEList, /* The SET clause: list of column and new values */
157363157234
Expr *pWhere, /* The WHERE clause */
157364157235
u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
157365157236
const char *zStart, /* Start of SQL text */
@@ -157366,25 +157237,40 @@
157366157237
const char *zEnd /* End of SQL text */
157367157238
){
157368157239
sqlite3 *db = pParse->db;
157369157240
TriggerStep *pTriggerStep;
157370157241
157371
- pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTableName,zStart,zEnd);
157242
+ pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTabList, zStart, zEnd);
157372157243
if( pTriggerStep ){
157244
+ SrcList *pFromDup = 0;
157373157245
if( IN_RENAME_OBJECT ){
157374157246
pTriggerStep->pExprList = pEList;
157375157247
pTriggerStep->pWhere = pWhere;
157376
- pTriggerStep->pFrom = pFrom;
157248
+ pFromDup = pFrom;
157377157249
pEList = 0;
157378157250
pWhere = 0;
157379157251
pFrom = 0;
157380157252
}else{
157381157253
pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE);
157382157254
pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
157383
- pTriggerStep->pFrom = sqlite3SrcListDup(db, pFrom, EXPRDUP_REDUCE);
157255
+ pFromDup = sqlite3SrcListDup(db, pFrom, EXPRDUP_REDUCE);
157384157256
}
157385157257
pTriggerStep->orconf = orconf;
157258
+
157259
+ if( pFromDup && !IN_RENAME_OBJECT){
157260
+ Select *pSub;
157261
+ Token as = {0, 0};
157262
+ pSub = sqlite3SelectNew(pParse, 0, pFromDup, 0,0,0,0, SF_NestedFrom, 0);
157263
+ pFromDup = sqlite3SrcListAppendFromTerm(pParse, 0, 0, 0, &as, pSub ,0);
157264
+ }
157265
+ if( pFromDup && pTriggerStep->pSrc ){
157266
+ pTriggerStep->pSrc = sqlite3SrcListAppendList(
157267
+ pParse, pTriggerStep->pSrc, pFromDup
157268
+ );
157269
+ }else{
157270
+ sqlite3SrcListDelete(db, pFromDup);
157271
+ }
157386157272
}
157387157273
sqlite3ExprListDelete(db, pEList);
157388157274
sqlite3ExprDelete(db, pWhere);
157389157275
sqlite3SrcListDelete(db, pFrom);
157390157276
return pTriggerStep;
@@ -157395,19 +157281,19 @@
157395157281
** a pointer to that trigger step. The parser calls this routine when it
157396157282
** sees a DELETE statement inside the body of a CREATE TRIGGER.
157397157283
*/
157398157284
SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(
157399157285
Parse *pParse, /* Parser */
157400
- Token *pTableName, /* The table from which rows are deleted */
157286
+ SrcList *pTabList, /* The table from which rows are deleted */
157401157287
Expr *pWhere, /* The WHERE clause */
157402157288
const char *zStart, /* Start of SQL text */
157403157289
const char *zEnd /* End of SQL text */
157404157290
){
157405157291
sqlite3 *db = pParse->db;
157406157292
TriggerStep *pTriggerStep;
157407157293
157408
- pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTableName,zStart,zEnd);
157294
+ pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTabList, zStart, zEnd);
157409157295
if( pTriggerStep ){
157410157296
if( IN_RENAME_OBJECT ){
157411157297
pTriggerStep->pWhere = pWhere;
157412157298
pWhere = 0;
157413157299
}else{
@@ -157665,56 +157551,10 @@
157665157551
return 0;
157666157552
}
157667157553
return triggersReallyExist(pParse,pTab,op,pChanges,pMask);
157668157554
}
157669157555
157670
-/*
157671
-** Convert the pStep->zTarget string into a SrcList and return a pointer
157672
-** to that SrcList.
157673
-**
157674
-** This routine adds a specific database name, if needed, to the target when
157675
-** forming the SrcList. This prevents a trigger in one database from
157676
-** referring to a target in another database. An exception is when the
157677
-** trigger is in TEMP in which case it can refer to any other database it
157678
-** wants.
157679
-*/
157680
-SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(
157681
- Parse *pParse, /* The parsing context */
157682
- TriggerStep *pStep /* The trigger containing the target token */
157683
-){
157684
- sqlite3 *db = pParse->db;
157685
- SrcList *pSrc; /* SrcList to be returned */
157686
- char *zName = sqlite3DbStrDup(db, pStep->zTarget);
157687
- pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
157688
- assert( pSrc==0 || pSrc->nSrc==1 );
157689
- assert( zName || pSrc==0 );
157690
- if( pSrc ){
157691
- Schema *pSchema = pStep->pTrig->pSchema;
157692
- pSrc->a[0].zName = zName;
157693
- if( pSchema!=db->aDb[1].pSchema ){
157694
- assert( pSrc->a[0].fg.fixedSchema || pSrc->a[0].u4.zDatabase==0 );
157695
- pSrc->a[0].u4.pSchema = pSchema;
157696
- pSrc->a[0].fg.fixedSchema = 1;
157697
- }
157698
- if( pStep->pFrom ){
157699
- SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0);
157700
- if( pDup && pDup->nSrc>1 && !IN_RENAME_OBJECT ){
157701
- Select *pSubquery;
157702
- Token as;
157703
- pSubquery = sqlite3SelectNew(pParse,0,pDup,0,0,0,0,SF_NestedFrom,0);
157704
- as.n = 0;
157705
- as.z = 0;
157706
- pDup = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
157707
- }
157708
- pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
157709
- }
157710
- }else{
157711
- sqlite3DbFree(db, zName);
157712
- }
157713
- return pSrc;
157714
-}
157715
-
157716157556
/*
157717157557
** Return true if the pExpr term from the RETURNING clause argument
157718157558
** list is of the form "*". Raise an error if the terms if of the
157719157559
** form "table.*".
157720157560
*/
@@ -157976,21 +157816,21 @@
157976157816
#endif
157977157817
157978157818
switch( pStep->op ){
157979157819
case TK_UPDATE: {
157980157820
sqlite3Update(pParse,
157981
- sqlite3TriggerStepSrc(pParse, pStep),
157821
+ sqlite3SrcListDup(db, pStep->pSrc, 0),
157982157822
sqlite3ExprListDup(db, pStep->pExprList, 0),
157983157823
sqlite3ExprDup(db, pStep->pWhere, 0),
157984157824
pParse->eOrconf, 0, 0, 0
157985157825
);
157986157826
sqlite3VdbeAddOp0(v, OP_ResetCount);
157987157827
break;
157988157828
}
157989157829
case TK_INSERT: {
157990157830
sqlite3Insert(pParse,
157991
- sqlite3TriggerStepSrc(pParse, pStep),
157831
+ sqlite3SrcListDup(db, pStep->pSrc, 0),
157992157832
sqlite3SelectDup(db, pStep->pSelect, 0),
157993157833
sqlite3IdListDup(db, pStep->pIdList),
157994157834
pParse->eOrconf,
157995157835
sqlite3UpsertDup(db, pStep->pUpsert)
157996157836
);
@@ -157997,11 +157837,11 @@
157997157837
sqlite3VdbeAddOp0(v, OP_ResetCount);
157998157838
break;
157999157839
}
158000157840
case TK_DELETE: {
158001157841
sqlite3DeleteFrom(pParse,
158002
- sqlite3TriggerStepSrc(pParse, pStep),
157842
+ sqlite3SrcListDup(db, pStep->pSrc, 0),
158003157843
sqlite3ExprDup(db, pStep->pWhere, 0), 0, 0
158004157844
);
158005157845
sqlite3VdbeAddOp0(v, OP_ResetCount);
158006157846
break;
158007157847
}
@@ -160319,13 +160159,15 @@
160319160159
if( rc!=SQLITE_OK ) goto end_of_vacuum;
160320160160
assert( (db->nDb-1)==nDb );
160321160161
pDb = &db->aDb[nDb];
160322160162
assert( strcmp(pDb->zDbSName,zDbVacuum)==0 );
160323160163
pTemp = pDb->pBt;
160164
+ nRes = sqlite3BtreeGetRequestedReserve(pMain);
160324160165
if( pOut ){
160325160166
sqlite3_file *id = sqlite3PagerFile(sqlite3BtreePager(pTemp));
160326160167
i64 sz = 0;
160168
+ const char *zFilename;
160327160169
if( id->pMethods!=0 && (sqlite3OsFileSize(id, &sz)!=SQLITE_OK || sz>0) ){
160328160170
rc = SQLITE_ERROR;
160329160171
sqlite3SetString(pzErrMsg, db, "output file already exists");
160330160172
goto end_of_vacuum;
160331160173
}
@@ -160333,12 +160175,20 @@
160333160175
160334160176
/* For a VACUUM INTO, the pager-flags are set to the same values as
160335160177
** they are for the database being vacuumed, except that PAGER_CACHESPILL
160336160178
** is always set. */
160337160179
pgflags = db->aDb[iDb].safety_level | (db->flags & PAGER_FLAGS_MASK);
160180
+
160181
+ /* If the VACUUM INTO target file is a URI filename and if the
160182
+ ** "reserve=N" query parameter is present, reset the reserve to the
160183
+ ** amount specified, if the amount is within range */
160184
+ zFilename = sqlite3BtreeGetFilename(pTemp);
160185
+ if( ALWAYS(zFilename) ){
160186
+ int nNew = (int)sqlite3_uri_int64(zFilename, "reserve", nRes);
160187
+ if( nNew>=0 && nNew<=255 ) nRes = nNew;
160188
+ }
160338160189
}
160339
- nRes = sqlite3BtreeGetRequestedReserve(pMain);
160340160190
160341160191
sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);
160342160192
sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));
160343160193
sqlite3BtreeSetPagerFlags(pTemp, pgflags|PAGER_CACHESPILL);
160344160194
@@ -167114,17 +166964,15 @@
167114166964
sqlite3 *db = pParse->db;
167115166965
Expr *pNew;
167116166966
int iVal = 0;
167117166967
167118166968
if( sqlite3ExprIsInteger(pExpr, &iVal, pParse) && iVal>=0 ){
167119
- Expr *pVal = sqlite3Expr(db, TK_INTEGER, 0);
166969
+ Expr *pVal = sqlite3ExprInt32(db, iVal);
167120166970
if( pVal==0 ) return;
167121
- ExprSetProperty(pVal, EP_IntValue);
167122
- pVal->u.iValue = iVal;
167123166971
pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
167124166972
}else{
167125
- Expr *pVal = sqlite3Expr(db, TK_REGISTER, 0);
166973
+ Expr *pVal = sqlite3ExprAlloc(db, TK_REGISTER, 0, 0);
167126166974
if( pVal==0 ) return;
167127166975
pVal->iTable = iReg;
167128166976
pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
167129166977
}
167130166978
if( pNew ){
@@ -168947,15 +168795,18 @@
168947168795
168948168796
/* No matches cause a break out of the loop */
168949168797
break;
168950168798
}
168951168799
if( i==n ){
168800
+ int bSortByGroup = (pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0;
168952168801
nOrderBy = n;
168953168802
if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) && !pSrc->fg.rowidUsed ){
168954
- eDistinct = 2 + ((pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0);
168803
+ eDistinct = 2 + bSortByGroup;
168955168804
}else if( pWInfo->wctrlFlags & WHERE_GROUPBY ){
168956
- eDistinct = 1;
168805
+ eDistinct = 1 - bSortByGroup;
168806
+ }else if( pWInfo->wctrlFlags & WHERE_WANT_DISTINCT ){
168807
+ eDistinct = 3;
168957168808
}
168958168809
}
168959168810
}
168960168811
168961168812
/* Allocate the sqlite3_index_info structure
@@ -172533,13 +172384,11 @@
172533172384
if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue;
172534172385
}else{
172535172386
pLoop = pLast;
172536172387
}
172537172388
if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){
172538
- if( pLoop->u.vtab.isOrdered
172539
- && ((wctrlFlags&(WHERE_DISTINCTBY|WHERE_SORTBYGROUP))!=WHERE_DISTINCTBY)
172540
- ){
172389
+ if( pLoop->u.vtab.isOrdered && pWInfo->pOrderBy==pOrderBy ){
172541172390
obSat = obDone;
172542172391
}else{
172543172392
/* No further ORDER BY terms may be matched. So this call should
172544172393
** return >=0, not -1. Clear isOrderDistinct to ensure it does so. */
172545172394
isOrderDistinct = 0;
@@ -173876,10 +173725,11 @@
173876173725
pWInfo->revMask = (m1 & pWInfo->revMask) | ((pWInfo->revMask>>1) & ~m1);
173877173726
notReady &= ~pLoop->maskSelf;
173878173727
for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
173879173728
if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
173880173729
pTerm->wtFlags |= TERM_CODED;
173730
+ pTerm->prereqAll = 0;
173881173731
}
173882173732
}
173883173733
if( i!=pWInfo->nLevel-1 ){
173884173734
int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
173885173735
memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
@@ -174813,10 +174663,13 @@
174813174663
WhereLoop *pLoop;
174814174664
SrcList *pTabList = pWInfo->pTabList;
174815174665
sqlite3 *db = pParse->db;
174816174666
int iEnd = sqlite3VdbeCurrentAddr(v);
174817174667
int nRJ = 0;
174668
+#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174669
+ int addrSeek = 0;
174670
+#endif
174818174671
174819174672
/* Generate loop termination code.
174820174673
*/
174821174674
VdbeModuleComment((v, "End WHERE-core"));
174822174675
for(i=pWInfo->nLevel-1; i>=0; i--){
@@ -174825,20 +174678,22 @@
174825174678
if( pLevel->pRJ ){
174826174679
/* Terminate the subroutine that forms the interior of the loop of
174827174680
** the RIGHT JOIN table */
174828174681
WhereRightJoin *pRJ = pLevel->pRJ;
174829174682
sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174830
- pLevel->addrCont = 0;
174683
+ /* Replace addrCont with a new label that will never be used, just so
174684
+ ** the subsequent call to resolve pLevel->addrCont will have something
174685
+ ** to resolve. */
174686
+ pLevel->addrCont = sqlite3VdbeMakeLabel(pParse);
174831174687
pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
174832174688
sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
174833174689
VdbeCoverage(v);
174834174690
nRJ++;
174835174691
}
174836174692
pLoop = pLevel->pWLoop;
174837174693
if( pLevel->op!=OP_Noop ){
174838174694
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174839
- int addrSeek = 0;
174840174695
Index *pIdx;
174841174696
int n;
174842174697
if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
174843174698
&& i==pWInfo->nLevel-1 /* Ticket [ef9318757b152e3] 2017-10-21 */
174844174699
&& (pLoop->wsFlags & WHERE_INDEXED)!=0
@@ -174857,29 +174712,30 @@
174857174712
VdbeCoverageIf(v, op==OP_SeekLT);
174858174713
VdbeCoverageIf(v, op==OP_SeekGT);
174859174714
sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
174860174715
}
174861174716
#endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
174862
- if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
174863
- /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
174864
- ** loop(s) will be the inner-most loops of the join. There might be
174865
- ** multiple EXISTS loops, but they will all be nested, and the join
174866
- ** order will not have been changed by the query planner. If the
174867
- ** inner-most EXISTS loop sees a single successful row, it should
174868
- ** break out of *all* EXISTS loops. But only the inner-most of the
174869
- ** nested EXISTS loops should do this breakout. */
174870
- int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
174871
- while( nOuter<i ){
174872
- if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
174873
- nOuter++;
174874
- }
174875
- testcase( nOuter>0 );
174876
- sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
174877
- VdbeComment((v, "EXISTS break"));
174878
- }
174879
- /* The common case: Advance to the next row */
174880
- if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174717
+ }
174718
+ if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
174719
+ /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
174720
+ ** loop(s) will be the inner-most loops of the join. There might be
174721
+ ** multiple EXISTS loops, but they will all be nested, and the join
174722
+ ** order will not have been changed by the query planner. If the
174723
+ ** inner-most EXISTS loop sees a single successful row, it should
174724
+ ** break out of *all* EXISTS loops. But only the inner-most of the
174725
+ ** nested EXISTS loops should do this breakout. */
174726
+ int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
174727
+ while( nOuter<i ){
174728
+ if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
174729
+ nOuter++;
174730
+ }
174731
+ testcase( nOuter>0 );
174732
+ sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
174733
+ VdbeComment((v, "EXISTS break"));
174734
+ }
174735
+ sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174736
+ if( pLevel->op!=OP_Noop ){
174881174737
sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);
174882174738
sqlite3VdbeChangeP5(v, pLevel->p5);
174883174739
VdbeCoverage(v);
174884174740
VdbeCoverageIf(v, pLevel->op==OP_Next);
174885174741
VdbeCoverageIf(v, pLevel->op==OP_Prev);
@@ -174888,14 +174744,15 @@
174888174744
sqlite3VdbeResolveLabel(v, pLevel->addrBignull);
174889174745
sqlite3VdbeAddOp2(v, OP_DecrJumpZero, pLevel->regBignull, pLevel->p2-1);
174890174746
VdbeCoverage(v);
174891174747
}
174892174748
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174893
- if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek);
174749
+ if( addrSeek ){
174750
+ sqlite3VdbeJumpHere(v, addrSeek);
174751
+ addrSeek = 0;
174752
+ }
174894174753
#endif
174895
- }else if( pLevel->addrCont ){
174896
- sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174897174754
}
174898174755
if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){
174899174756
struct InLoop *pIn;
174900174757
int j;
174901174758
sqlite3VdbeResolveLabel(v, pLevel->addrNxt);
@@ -175888,11 +175745,11 @@
175888175745
pWin->eFrmType = aUp[i].eFrmType;
175889175746
pWin->eStart = aUp[i].eStart;
175890175747
pWin->eEnd = aUp[i].eEnd;
175891175748
pWin->eExclude = 0;
175892175749
if( pWin->eStart==TK_FOLLOWING ){
175893
- pWin->pStart = sqlite3Expr(db, TK_INTEGER, "1");
175750
+ pWin->pStart = sqlite3ExprInt32(db, 1);
175894175751
}
175895175752
break;
175896175753
}
175897175754
}
175898175755
}
@@ -176233,13 +176090,11 @@
176233176090
** selected (e.g. "SELECT row_number() OVER () FROM t1"), it is possible
176234176091
** that pSublist is still NULL here. Add a constant expression here to
176235176092
** keep everything legal in this case.
176236176093
*/
176237176094
if( pSublist==0 ){
176238
- pSublist = sqlite3ExprListAppend(pParse, 0,
176239
- sqlite3Expr(db, TK_INTEGER, "0")
176240
- );
176095
+ pSublist = sqlite3ExprListAppend(pParse, 0, sqlite3ExprInt32(db, 0));
176241176096
}
176242176097
176243176098
pSub = sqlite3SelectNew(
176244176099
pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
176245176100
);
@@ -178514,19 +178369,50 @@
178514178369
}
178515178370
return p;
178516178371
}
178517178372
178518178373
178519
- /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
178520
- ** unary TK_ISNULL or TK_NOTNULL expression. */
178521
- static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
178522
- sqlite3 *db = pParse->db;
178523
- if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){
178524
- pA->op = (u8)op;
178525
- sqlite3ExprDelete(db, pA->pRight);
178526
- pA->pRight = 0;
178527
- }
178374
+ /* Create a TK_ISNULL or TK_NOTNULL expression, perhaps optimized to
178375
+ ** to TK_TRUEFALSE, if possible */
178376
+ static Expr *sqlite3PExprIsNull(
178377
+ Parse *pParse, /* Parsing context */
178378
+ int op, /* TK_ISNULL or TK_NOTNULL */
178379
+ Expr *pLeft /* Operand */
178380
+ ){
178381
+ Expr *p = pLeft;
178382
+ assert( op==TK_ISNULL || op==TK_NOTNULL );
178383
+ assert( pLeft!=0 );
178384
+ while( p->op==TK_UPLUS || p->op==TK_UMINUS ){
178385
+ p = p->pLeft;
178386
+ assert( p!=0 );
178387
+ }
178388
+ switch( p->op ){
178389
+ case TK_INTEGER:
178390
+ case TK_STRING:
178391
+ case TK_FLOAT:
178392
+ case TK_BLOB:
178393
+ sqlite3ExprDeferredDelete(pParse, pLeft);
178394
+ return sqlite3ExprInt32(pParse->db, op==TK_NOTNULL);
178395
+ default:
178396
+ break;
178397
+ }
178398
+ return sqlite3PExpr(pParse, op, pLeft, 0);
178399
+ }
178400
+
178401
+ /* Create a TK_IS or TK_ISNOT operator, perhaps optimized to
178402
+ ** TK_ISNULL or TK_NOTNULL or TK_TRUEFALSE. */
178403
+ static Expr *sqlite3PExprIs(
178404
+ Parse *pParse, /* Parsing context */
178405
+ int op, /* TK_IS or TK_ISNOT */
178406
+ Expr *pLeft, /* Left operand */
178407
+ Expr *pRight /* Right operand */
178408
+ ){
178409
+ if( pRight && pRight->op==TK_NULL ){
178410
+ sqlite3ExprDeferredDelete(pParse, pRight);
178411
+ return sqlite3PExprIsNull(pParse, op==TK_IS ? TK_ISNULL : TK_NOTNULL, pLeft);
178412
+ }
178413
+ return sqlite3PExpr(pParse, op, pLeft, pRight);
178528178414
}
178529178415
178530178416
/* Add a single new term to an ExprList that is used to store a
178531178417
** list of identifiers. Report an error if the ID list contains
178532178418
** a COLLATE clause or an ASC or DESC keyword, except ignore the
@@ -178805,35 +178691,35 @@
178805178691
#ifndef INTERFACE
178806178692
# define INTERFACE 1
178807178693
#endif
178808178694
/************* Begin control #defines *****************************************/
178809178695
#define YYCODETYPE unsigned short int
178810
-#define YYNOCODE 323
178696
+#define YYNOCODE 322
178811178697
#define YYACTIONTYPE unsigned short int
178812178698
#define YYWILDCARD 102
178813178699
#define sqlite3ParserTOKENTYPE Token
178814178700
typedef union {
178815178701
int yyinit;
178816178702
sqlite3ParserTOKENTYPE yy0;
178817
- u32 yy9;
178818
- struct TrigEvent yy28;
178819
- With* yy125;
178820
- IdList* yy204;
178821
- struct FrameBound yy205;
178822
- TriggerStep* yy319;
178823
- const char* yy342;
178824
- Cte* yy361;
178825
- ExprList* yy402;
178826
- Upsert* yy403;
178827
- OnOrUsing yy421;
178828
- u8 yy444;
178829
- struct {int value; int mask;} yy481;
178830
- Window* yy483;
178831
- int yy502;
178832
- SrcList* yy563;
178833
- Expr* yy590;
178834
- Select* yy637;
178703
+ ExprList* yy14;
178704
+ With* yy59;
178705
+ Cte* yy67;
178706
+ Upsert* yy122;
178707
+ IdList* yy132;
178708
+ int yy144;
178709
+ const char* yy168;
178710
+ SrcList* yy203;
178711
+ Window* yy211;
178712
+ OnOrUsing yy269;
178713
+ struct TrigEvent yy286;
178714
+ struct {int value; int mask;} yy383;
178715
+ u32 yy391;
178716
+ TriggerStep* yy427;
178717
+ Expr* yy454;
178718
+ u8 yy462;
178719
+ struct FrameBound yy509;
178720
+ Select* yy555;
178835178721
} YYMINORTYPE;
178836178722
#ifndef YYSTACKDEPTH
178837178723
#define YYSTACKDEPTH 50
178838178724
#endif
178839178725
#define sqlite3ParserARG_SDECL
@@ -178857,24 +178743,24 @@
178857178743
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
178858178744
#undef YYERRORSYMBOL
178859178745
#undef YYERRSYMDT
178860178746
#undef YYFALLBACK
178861178747
#define YYFALLBACK 1
178862
-#define YYNSTATE 602
178863
-#define YYNRULE 414
178864
-#define YYNRULE_WITH_ACTION 349
178748
+#define YYNSTATE 600
178749
+#define YYNRULE 412
178750
+#define YYNRULE_WITH_ACTION 348
178865178751
#define YYNTOKEN 187
178866
-#define YY_MAX_SHIFT 601
178867
-#define YY_MIN_SHIFTREDUCE 870
178868
-#define YY_MAX_SHIFTREDUCE 1283
178869
-#define YY_ERROR_ACTION 1284
178870
-#define YY_ACCEPT_ACTION 1285
178871
-#define YY_NO_ACTION 1286
178872
-#define YY_MIN_REDUCE 1287
178873
-#define YY_MAX_REDUCE 1700
178752
+#define YY_MAX_SHIFT 599
178753
+#define YY_MIN_SHIFTREDUCE 867
178754
+#define YY_MAX_SHIFTREDUCE 1278
178755
+#define YY_ERROR_ACTION 1279
178756
+#define YY_ACCEPT_ACTION 1280
178757
+#define YY_NO_ACTION 1281
178758
+#define YY_MIN_REDUCE 1282
178759
+#define YY_MAX_REDUCE 1693
178874178760
#define YY_MIN_DSTRCTR 206
178875
-#define YY_MAX_DSTRCTR 320
178761
+#define YY_MAX_DSTRCTR 319
178876178762
/************* End control #defines *******************************************/
178877178763
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
178878178764
178879178765
/* Define the yytestcase() macro to be a no-op if is not already defined
178880178766
** otherwise.
@@ -178955,491 +178841,491 @@
178955178841
** yy_default[] Default action for each state.
178956178842
**
178957178843
*********** Begin parsing tables **********************************************/
178958178844
#define YY_ACTTAB_COUNT (2379)
178959178845
static const YYACTIONTYPE yy_action[] = {
178960
- /* 0 */ 134, 131, 238, 291, 291, 1358, 595, 1337, 479, 483,
178961
- /* 10 */ 595, 436, 595, 393, 595, 1358, 592, 595, 581, 425,
178962
- /* 20 */ 423, 1572, 134, 131, 238, 543, 479, 478, 577, 84,
178963
- /* 30 */ 84, 1008, 304, 51, 51, 51, 51, 63, 63, 1009,
178964
- /* 40 */ 84, 84, 1132, 141, 142, 93, 1132, 1258, 1258, 1088,
178965
- /* 50 */ 1091, 1078, 1078, 139, 139, 140, 140, 140, 140, 425,
178966
- /* 60 */ 297, 297, 1481, 297, 297, 569, 555, 297, 297, 134,
178967
- /* 70 */ 131, 238, 1130, 592, 544, 581, 592, 576, 581, 512,
178968
- /* 80 */ 592, 343, 581, 141, 142, 93, 578, 1258, 1258, 1088,
178969
- /* 90 */ 1091, 1078, 1078, 139, 139, 140, 140, 140, 140, 6,
178970
- /* 100 */ 479, 385, 1630, 138, 138, 138, 138, 137, 137, 136,
178971
- /* 110 */ 136, 136, 135, 132, 464, 1363, 1363, 595, 1044, 1603,
178972
- /* 120 */ 1285, 1, 1, 601, 2, 1289, 44, 1204, 231, 1204,
178973
- /* 130 */ 331, 425, 158, 1617, 392, 1617, 563, 116, 500, 1371,
178974
- /* 140 */ 84, 84, 569, 138, 138, 138, 138, 137, 137, 136,
178975
- /* 150 */ 136, 136, 135, 132, 464, 141, 142, 93, 517, 1258,
178976
- /* 160 */ 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140,
178977
- /* 170 */ 140, 1234, 356, 212, 297, 297, 464, 576, 490, 1234,
178978
- /* 180 */ 570, 570, 143, 330, 586, 1320, 550, 592, 1199, 581,
178979
- /* 190 */ 491, 358, 45, 140, 140, 140, 140, 133, 394, 566,
178980
- /* 200 */ 1323, 1199, 253, 426, 1199, 137, 137, 136, 136, 136,
178981
- /* 210 */ 135, 132, 464, 292, 306, 138, 138, 138, 138, 137,
178982
- /* 220 */ 137, 136, 136, 136, 135, 132, 464, 1322, 1234, 1235,
178983
- /* 230 */ 1234, 1605, 413, 389, 468, 425, 1234, 1235, 1234, 491,
178984
- /* 240 */ 358, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178985
- /* 250 */ 135, 132, 464, 113, 134, 131, 238, 557, 1606, 141,
178986
- /* 260 */ 142, 93, 595, 1258, 1258, 1088, 1091, 1078, 1078, 139,
178987
- /* 270 */ 139, 140, 140, 140, 140, 134, 131, 238, 1612, 425,
178988
- /* 280 */ 502, 185, 7, 334, 97, 19, 19, 994, 140, 140,
178989
- /* 290 */ 140, 140, 136, 136, 136, 135, 132, 464, 1179, 1692,
178990
- /* 300 */ 209, 1692, 1610, 141, 142, 93, 7, 1258, 1258, 1088,
178991
- /* 310 */ 1091, 1078, 1078, 139, 139, 140, 140, 140, 140, 138,
178846
+ /* 0 */ 134, 131, 238, 290, 290, 1353, 593, 1332, 478, 1606,
178847
+ /* 10 */ 593, 1315, 593, 7, 593, 1353, 590, 593, 579, 424,
178848
+ /* 20 */ 1566, 134, 131, 238, 1318, 541, 478, 477, 575, 84,
178849
+ /* 30 */ 84, 1005, 303, 84, 84, 51, 51, 63, 63, 1006,
178850
+ /* 40 */ 84, 84, 498, 141, 142, 93, 442, 1254, 1254, 1085,
178851
+ /* 50 */ 1088, 1075, 1075, 139, 139, 140, 140, 140, 140, 424,
178852
+ /* 60 */ 296, 296, 498, 296, 296, 567, 553, 296, 296, 1306,
178853
+ /* 70 */ 574, 1358, 1358, 590, 542, 579, 590, 574, 579, 548,
178854
+ /* 80 */ 590, 1304, 579, 141, 142, 93, 576, 1254, 1254, 1085,
178855
+ /* 90 */ 1088, 1075, 1075, 139, 139, 140, 140, 140, 140, 399,
178856
+ /* 100 */ 478, 395, 6, 138, 138, 138, 138, 137, 137, 136,
178857
+ /* 110 */ 136, 136, 135, 132, 463, 44, 342, 593, 305, 1127,
178858
+ /* 120 */ 1280, 1, 1, 599, 2, 1284, 598, 1200, 1284, 1200,
178859
+ /* 130 */ 330, 424, 158, 330, 1613, 158, 390, 116, 308, 1366,
178860
+ /* 140 */ 51, 51, 1366, 138, 138, 138, 138, 137, 137, 136,
178861
+ /* 150 */ 136, 136, 135, 132, 463, 141, 142, 93, 515, 1254,
178862
+ /* 160 */ 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140,
178863
+ /* 170 */ 140, 1230, 329, 584, 296, 296, 212, 296, 296, 568,
178864
+ /* 180 */ 568, 488, 143, 1072, 1072, 1086, 1089, 590, 1195, 579,
178865
+ /* 190 */ 590, 340, 579, 140, 140, 140, 140, 133, 392, 564,
178866
+ /* 200 */ 536, 1195, 250, 425, 1195, 250, 137, 137, 136, 136,
178867
+ /* 210 */ 136, 135, 132, 463, 291, 138, 138, 138, 138, 137,
178868
+ /* 220 */ 137, 136, 136, 136, 135, 132, 463, 966, 1230, 1231,
178869
+ /* 230 */ 1230, 412, 965, 467, 412, 424, 467, 489, 357, 1611,
178870
+ /* 240 */ 391, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178871
+ /* 250 */ 135, 132, 463, 463, 134, 131, 238, 555, 1076, 141,
178872
+ /* 260 */ 142, 93, 593, 1254, 1254, 1085, 1088, 1075, 1075, 139,
178873
+ /* 270 */ 139, 140, 140, 140, 140, 1317, 134, 131, 238, 424,
178874
+ /* 280 */ 549, 1597, 1531, 333, 97, 83, 83, 140, 140, 140,
178875
+ /* 290 */ 140, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178876
+ /* 300 */ 135, 132, 463, 141, 142, 93, 1657, 1254, 1254, 1085,
178877
+ /* 310 */ 1088, 1075, 1075, 139, 139, 140, 140, 140, 140, 138,
178992178878
/* 320 */ 138, 138, 138, 137, 137, 136, 136, 136, 135, 132,
178993
- /* 330 */ 464, 1663, 1234, 589, 589, 589, 138, 138, 138, 138,
178994
- /* 340 */ 137, 137, 136, 136, 136, 135, 132, 464, 138, 138,
178995
- /* 350 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
178996
- /* 360 */ 275, 595, 430, 138, 138, 138, 138, 137, 137, 136,
178997
- /* 370 */ 136, 136, 135, 132, 464, 400, 1234, 396, 1177, 461,
178998
- /* 380 */ 460, 237, 1611, 425, 51, 51, 7, 335, 1263, 1234,
178999
- /* 390 */ 1235, 1234, 1311, 1265, 549, 145, 1254, 283, 542, 542,
179000
- /* 400 */ 595, 1264, 597, 7, 597, 927, 994, 141, 142, 93,
179001
- /* 410 */ 506, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140,
179002
- /* 420 */ 140, 140, 140, 19, 19, 44, 1266, 425, 1266, 297,
179003
- /* 430 */ 297, 1234, 98, 1234, 1235, 1234, 265, 534, 439, 530,
179004
- /* 440 */ 527, 526, 592, 1633, 581, 928, 511, 272, 235, 525,
179005
- /* 450 */ 508, 141, 142, 93, 1254, 1258, 1258, 1088, 1091, 1078,
179006
- /* 460 */ 1078, 139, 139, 140, 140, 140, 140, 138, 138, 138,
179007
- /* 470 */ 138, 137, 137, 136, 136, 136, 135, 132, 464, 595,
179008
- /* 480 */ 422, 421, 330, 586, 1619, 517, 391, 517, 1234, 1235,
179009
- /* 490 */ 1234, 1274, 127, 587, 265, 4, 1311, 530, 527, 526,
179010
- /* 500 */ 595, 448, 84, 84, 594, 595, 572, 525, 1309, 590,
179011
- /* 510 */ 308, 138, 138, 138, 138, 137, 137, 136, 136, 136,
179012
- /* 520 */ 135, 132, 464, 19, 19, 161, 1234, 390, 19, 19,
179013
- /* 530 */ 1571, 425, 1535, 465, 1637, 601, 2, 1289, 444, 576,
179014
- /* 540 */ 330, 586, 331, 446, 158, 584, 1274, 481, 575, 595,
179015
- /* 550 */ 240, 1371, 506, 551, 1234, 141, 142, 93, 313, 1258,
179016
- /* 560 */ 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140,
179017
- /* 570 */ 140, 160, 83, 83, 1065, 974, 135, 132, 464, 595,
179018
- /* 580 */ 125, 125, 973, 1234, 1235, 1234, 297, 297, 126, 517,
179019
- /* 590 */ 465, 596, 465, 297, 297, 1053, 1234, 1369, 387, 592,
179020
- /* 600 */ 1234, 581, 84, 84, 517, 242, 592, 1465, 581, 46,
179021
- /* 610 */ 473, 1234, 1235, 1234, 253, 138, 138, 138, 138, 137,
179022
- /* 620 */ 137, 136, 136, 136, 135, 132, 464, 1053, 1053, 1055,
179023
- /* 630 */ 1056, 35, 297, 297, 1370, 399, 425, 445, 996, 576,
179024
- /* 640 */ 372, 415, 233, 541, 413, 592, 468, 581, 452, 1366,
179025
- /* 650 */ 112, 552, 355, 1234, 1235, 1234, 1218, 1234, 1235, 1234,
179026
- /* 660 */ 141, 142, 93, 223, 1258, 1258, 1088, 1091, 1078, 1078,
179027
- /* 670 */ 139, 139, 140, 140, 140, 140, 297, 297, 441, 553,
179028
- /* 680 */ 425, 298, 298, 1375, 531, 330, 586, 1199, 115, 592,
179029
- /* 690 */ 1465, 581, 100, 1480, 592, 592, 581, 581, 559, 1307,
179030
- /* 700 */ 1199, 907, 545, 1199, 141, 142, 93, 498, 1258, 1258,
179031
- /* 710 */ 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140, 140,
178879
+ /* 330 */ 463, 591, 1230, 958, 958, 138, 138, 138, 138, 137,
178880
+ /* 340 */ 137, 136, 136, 136, 135, 132, 463, 44, 398, 547,
178881
+ /* 350 */ 1306, 136, 136, 136, 135, 132, 463, 386, 593, 442,
178882
+ /* 360 */ 595, 145, 595, 138, 138, 138, 138, 137, 137, 136,
178883
+ /* 370 */ 136, 136, 135, 132, 463, 500, 1230, 112, 550, 460,
178884
+ /* 380 */ 459, 51, 51, 424, 296, 296, 479, 334, 1259, 1230,
178885
+ /* 390 */ 1231, 1230, 1599, 1261, 388, 312, 444, 590, 246, 579,
178886
+ /* 400 */ 546, 1260, 271, 235, 329, 584, 551, 141, 142, 93,
178887
+ /* 410 */ 429, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140,
178888
+ /* 420 */ 140, 140, 140, 22, 22, 1230, 1262, 424, 1262, 216,
178889
+ /* 430 */ 296, 296, 98, 1230, 1231, 1230, 264, 884, 45, 528,
178890
+ /* 440 */ 525, 524, 1041, 590, 1269, 579, 421, 420, 393, 523,
178891
+ /* 450 */ 44, 141, 142, 93, 498, 1254, 1254, 1085, 1088, 1075,
178892
+ /* 460 */ 1075, 139, 139, 140, 140, 140, 140, 138, 138, 138,
178893
+ /* 470 */ 138, 137, 137, 136, 136, 136, 135, 132, 463, 593,
178894
+ /* 480 */ 1611, 561, 1230, 1231, 1230, 23, 264, 515, 200, 528,
178895
+ /* 490 */ 525, 524, 127, 585, 509, 4, 355, 487, 506, 523,
178896
+ /* 500 */ 593, 498, 84, 84, 134, 131, 238, 329, 584, 588,
178897
+ /* 510 */ 1627, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178898
+ /* 520 */ 135, 132, 463, 19, 19, 435, 1230, 1460, 297, 297,
178899
+ /* 530 */ 311, 424, 1565, 464, 1631, 599, 2, 1284, 437, 574,
178900
+ /* 540 */ 1107, 590, 330, 579, 158, 582, 489, 357, 573, 593,
178901
+ /* 550 */ 592, 1366, 409, 1274, 1230, 141, 142, 93, 1364, 1254,
178902
+ /* 560 */ 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140,
178903
+ /* 570 */ 140, 389, 84, 84, 1062, 567, 1230, 313, 1523, 593,
178904
+ /* 580 */ 125, 125, 970, 1230, 1231, 1230, 296, 296, 126, 46,
178905
+ /* 590 */ 464, 594, 464, 296, 296, 1050, 1230, 218, 439, 590,
178906
+ /* 600 */ 1604, 579, 84, 84, 7, 403, 590, 515, 579, 325,
178907
+ /* 610 */ 417, 1230, 1231, 1230, 250, 138, 138, 138, 138, 137,
178908
+ /* 620 */ 137, 136, 136, 136, 135, 132, 463, 1050, 1050, 1052,
178909
+ /* 630 */ 1053, 35, 1275, 1230, 1231, 1230, 424, 1370, 993, 574,
178910
+ /* 640 */ 371, 414, 274, 412, 1597, 467, 1302, 552, 451, 590,
178911
+ /* 650 */ 543, 579, 1530, 1230, 1231, 1230, 1214, 201, 409, 1174,
178912
+ /* 660 */ 141, 142, 93, 223, 1254, 1254, 1085, 1088, 1075, 1075,
178913
+ /* 670 */ 139, 139, 140, 140, 140, 140, 296, 296, 1250, 593,
178914
+ /* 680 */ 424, 296, 296, 236, 529, 296, 296, 515, 100, 590,
178915
+ /* 690 */ 1600, 579, 48, 1605, 590, 1230, 579, 7, 590, 577,
178916
+ /* 700 */ 579, 904, 84, 84, 141, 142, 93, 496, 1254, 1254,
178917
+ /* 710 */ 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140, 140,
179032178918
/* 720 */ 138, 138, 138, 138, 137, 137, 136, 136, 136, 135,
179033
- /* 730 */ 132, 464, 385, 1630, 297, 297, 470, 297, 297, 472,
179034
- /* 740 */ 200, 579, 1065, 201, 44, 127, 587, 592, 4, 581,
179035
- /* 750 */ 592, 1044, 581, 482, 40, 500, 558, 482, 907, 1054,
179036
- /* 760 */ 1479, 442, 590, 1053, 138, 138, 138, 138, 137, 137,
179037
- /* 770 */ 136, 136, 136, 135, 132, 464, 297, 297, 1234, 1657,
179038
- /* 780 */ 492, 1234, 1603, 480, 425, 506, 465, 1330, 911, 592,
179039
- /* 790 */ 918, 581, 1234, 1361, 1361, 1053, 1053, 1055, 584, 385,
179040
- /* 800 */ 1630, 330, 586, 353, 5, 356, 486, 344, 141, 142,
179041
- /* 810 */ 93, 185, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139,
179042
- /* 820 */ 140, 140, 140, 140, 1218, 1694, 411, 1065, 425, 1234,
179043
- /* 830 */ 48, 309, 904, 125, 125, 1234, 1235, 1234, 1234, 1235,
179044
- /* 840 */ 1234, 126, 1234, 465, 596, 465, 348, 517, 1053, 1234,
179045
- /* 850 */ 1235, 1234, 141, 142, 93, 3, 1258, 1258, 1088, 1091,
179046
- /* 860 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 138, 138,
179047
- /* 870 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
179048
- /* 880 */ 1053, 1053, 1055, 1056, 35, 315, 1234, 1235, 1234, 1234,
179049
- /* 890 */ 1065, 1237, 363, 1234, 1604, 887, 389, 341, 500, 1234,
179050
- /* 900 */ 1235, 1234, 595, 1075, 1075, 1089, 1092, 1054, 345, 1218,
179051
- /* 910 */ 347, 1053, 138, 138, 138, 138, 137, 137, 136, 136,
179052
- /* 920 */ 136, 135, 132, 464, 436, 19, 19, 370, 567, 567,
179053
- /* 930 */ 595, 554, 425, 7, 1398, 325, 1217, 462, 462, 462,
179054
- /* 940 */ 316, 1582, 432, 1053, 1053, 1055, 1234, 1235, 1234, 1237,
179055
- /* 950 */ 1234, 1235, 1234, 84, 84, 489, 141, 142, 93, 595,
179056
- /* 960 */ 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140,
179057
- /* 970 */ 140, 140, 1218, 995, 312, 383, 425, 600, 1079, 1289,
179058
- /* 980 */ 1066, 115, 19, 19, 331, 382, 158, 1603, 1536, 365,
179059
- /* 990 */ 326, 368, 346, 1371, 216, 461, 460, 451, 1110, 236,
179060
- /* 1000 */ 141, 142, 93, 1465, 1258, 1258, 1088, 1091, 1078, 1078,
178919
+ /* 730 */ 132, 463, 1365, 1230, 296, 296, 1250, 115, 1275, 326,
178920
+ /* 740 */ 233, 539, 1062, 40, 282, 127, 585, 590, 4, 579,
178921
+ /* 750 */ 329, 584, 1230, 1231, 1230, 1598, 593, 388, 904, 1051,
178922
+ /* 760 */ 1356, 1356, 588, 1050, 138, 138, 138, 138, 137, 137,
178923
+ /* 770 */ 136, 136, 136, 135, 132, 463, 185, 593, 1230, 19,
178924
+ /* 780 */ 19, 1230, 971, 1597, 424, 1651, 464, 129, 908, 1195,
178925
+ /* 790 */ 1230, 1231, 1230, 1325, 443, 1050, 1050, 1052, 582, 1603,
178926
+ /* 800 */ 149, 149, 1195, 7, 5, 1195, 1687, 410, 141, 142,
178927
+ /* 810 */ 93, 1536, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139,
178928
+ /* 820 */ 140, 140, 140, 140, 1214, 397, 593, 1062, 424, 1536,
178929
+ /* 830 */ 1538, 50, 901, 125, 125, 1230, 1231, 1230, 1230, 1231,
178930
+ /* 840 */ 1230, 126, 1230, 464, 594, 464, 515, 1230, 1050, 84,
178931
+ /* 850 */ 84, 3, 141, 142, 93, 924, 1254, 1254, 1085, 1088,
178932
+ /* 860 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 138, 138,
178933
+ /* 870 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 463,
178934
+ /* 880 */ 1050, 1050, 1052, 1053, 35, 442, 457, 532, 433, 1230,
178935
+ /* 890 */ 1062, 1361, 540, 540, 1598, 925, 388, 7, 1129, 1230,
178936
+ /* 900 */ 1231, 1230, 1129, 1536, 1230, 1231, 1230, 1051, 570, 1214,
178937
+ /* 910 */ 593, 1050, 138, 138, 138, 138, 137, 137, 136, 136,
178938
+ /* 920 */ 136, 135, 132, 463, 6, 185, 1195, 1230, 231, 593,
178939
+ /* 930 */ 382, 992, 424, 151, 151, 510, 1213, 557, 482, 1195,
178940
+ /* 940 */ 381, 160, 1195, 1050, 1050, 1052, 1230, 1231, 1230, 422,
178941
+ /* 950 */ 593, 447, 84, 84, 593, 217, 141, 142, 93, 593,
178942
+ /* 960 */ 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140,
178943
+ /* 970 */ 140, 140, 1214, 19, 19, 593, 424, 19, 19, 442,
178944
+ /* 980 */ 1063, 442, 19, 19, 1230, 1231, 1230, 515, 445, 458,
178945
+ /* 990 */ 1597, 386, 315, 1175, 1685, 556, 1685, 450, 84, 84,
178946
+ /* 1000 */ 141, 142, 93, 505, 1254, 1254, 1085, 1088, 1075, 1075,
179061178947
/* 1010 */ 139, 139, 140, 140, 140, 140, 138, 138, 138, 138,
179062
- /* 1020 */ 137, 137, 136, 136, 136, 135, 132, 464, 297, 297,
179063
- /* 1030 */ 595, 500, 1008, 1199, 595, 50, 1528, 398, 218, 218,
179064
- /* 1040 */ 1009, 592, 1266, 581, 1266, 450, 1199, 404, 522, 1199,
179065
- /* 1050 */ 376, 424, 418, 84, 84, 595, 253, 19, 19, 548,
178948
+ /* 1020 */ 137, 137, 136, 136, 136, 135, 132, 463, 442, 1147,
178949
+ /* 1030 */ 454, 1597, 362, 1041, 593, 462, 1460, 1233, 47, 1393,
178950
+ /* 1040 */ 324, 565, 565, 115, 1148, 449, 7, 460, 459, 307,
178951
+ /* 1050 */ 375, 354, 593, 113, 593, 329, 584, 19, 19, 1149,
179066178952
/* 1060 */ 138, 138, 138, 138, 137, 137, 136, 136, 136, 135,
179067
- /* 1070 */ 132, 464, 210, 317, 443, 317, 269, 307, 19, 19,
179068
- /* 1080 */ 425, 307, 22, 22, 1049, 294, 413, 994, 468, 593,
179069
- /* 1090 */ 327, 961, 961, 571, 269, 1603, 1603, 595, 231, 1604,
179070
- /* 1100 */ 425, 389, 410, 1279, 141, 142, 93, 314, 1258, 1258,
179071
- /* 1110 */ 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140, 140,
179072
- /* 1120 */ 84, 84, 533, 387, 141, 142, 93, 434, 1258, 1258,
179073
- /* 1130 */ 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140, 140,
179074
- /* 1140 */ 447, 1541, 1585, 47, 49, 431, 282, 300, 384, 536,
179075
- /* 1150 */ 379, 535, 270, 595, 436, 595, 1465, 458, 375, 1541,
179076
- /* 1160 */ 1543, 375, 455, 431, 138, 138, 138, 138, 137, 137,
179077
- /* 1170 */ 136, 136, 136, 135, 132, 464, 84, 84, 84, 84,
179078
- /* 1180 */ 595, 237, 1280, 1583, 138, 138, 138, 138, 137, 137,
179079
- /* 1190 */ 136, 136, 136, 135, 132, 464, 1179, 1693, 10, 1693,
179080
- /* 1200 */ 275, 565, 1151, 149, 149, 475, 994, 1604, 1604, 389,
179081
- /* 1210 */ 389, 1465, 1199, 459, 425, 463, 226, 1152, 1150, 1609,
179082
- /* 1220 */ 564, 303, 1608, 7, 217, 1199, 7, 513, 1199, 1210,
179083
- /* 1230 */ 1312, 432, 1153, 1541, 425, 1662, 1254, 936, 141, 142,
179084
- /* 1240 */ 93, 119, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139,
179085
- /* 1250 */ 140, 140, 140, 140, 583, 302, 538, 1396, 141, 142,
179086
- /* 1260 */ 93, 6, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139,
179087
- /* 1270 */ 140, 140, 140, 140, 588, 432, 1177, 1135, 1135, 514,
179088
- /* 1280 */ 1151, 1210, 456, 969, 333, 288, 433, 187, 968, 595,
179089
- /* 1290 */ 129, 595, 547, 595, 1254, 1152, 1341, 551, 138, 138,
179090
- /* 1300 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
179091
- /* 1310 */ 1153, 595, 151, 151, 53, 53, 54, 54, 138, 138,
179092
- /* 1320 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
179093
- /* 1330 */ 504, 595, 947, 595, 68, 68, 595, 296, 235, 595,
179094
- /* 1340 */ 507, 595, 948, 595, 101, 222, 595, 484, 425, 875,
179095
- /* 1350 */ 876, 877, 215, 219, 69, 69, 21, 21, 423, 55,
179096
- /* 1360 */ 55, 1584, 70, 70, 56, 56, 71, 71, 425, 72,
179097
- /* 1370 */ 72, 1183, 141, 142, 93, 123, 1258, 1258, 1088, 1091,
179098
- /* 1380 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 425, 268,
179099
- /* 1390 */ 267, 266, 141, 142, 93, 552, 1258, 1258, 1088, 1091,
179100
- /* 1400 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 23, 163,
179101
- /* 1410 */ 496, 572, 141, 130, 93, 476, 1258, 1258, 1088, 1091,
179102
- /* 1420 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 505, 124,
179103
- /* 1430 */ 1580, 121, 138, 138, 138, 138, 137, 137, 136, 136,
179104
- /* 1440 */ 136, 135, 132, 464, 595, 225, 595, 899, 437, 246,
179105
- /* 1450 */ 336, 1253, 138, 138, 138, 138, 137, 137, 136, 136,
179106
- /* 1460 */ 136, 135, 132, 464, 595, 1340, 595, 73, 73, 74,
179107
- /* 1470 */ 74, 337, 138, 138, 138, 138, 137, 137, 136, 136,
179108
- /* 1480 */ 136, 135, 132, 464, 38, 595, 493, 75, 75, 57,
179109
- /* 1490 */ 57, 595, 425, 410, 1178, 1274, 497, 423, 250, 969,
179110
- /* 1500 */ 329, 164, 914, 16, 968, 899, 1117, 423, 58, 58,
179111
- /* 1510 */ 595, 423, 425, 595, 59, 59, 39, 142, 93, 340,
179112
- /* 1520 */ 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140,
179113
- /* 1530 */ 140, 140, 595, 61, 61, 595, 62, 62, 93, 595,
179114
- /* 1540 */ 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140,
179115
- /* 1550 */ 140, 140, 1410, 926, 925, 76, 76, 1409, 77, 77,
179116
- /* 1560 */ 914, 485, 78, 78, 1117, 1174, 595, 412, 595, 226,
179117
- /* 1570 */ 595, 127, 587, 1280, 4, 1592, 138, 138, 138, 138,
179118
- /* 1580 */ 137, 137, 136, 136, 136, 135, 132, 464, 590, 20,
179119
- /* 1590 */ 20, 79, 79, 147, 147, 595, 138, 138, 138, 138,
179120
- /* 1600 */ 137, 137, 136, 136, 136, 135, 132, 464, 595, 354,
179121
- /* 1610 */ 169, 115, 465, 595, 349, 595, 252, 595, 148, 148,
179122
- /* 1620 */ 595, 1046, 595, 274, 584, 494, 112, 499, 595, 274,
179123
- /* 1630 */ 1560, 80, 80, 595, 44, 1559, 64, 64, 81, 81,
179124
- /* 1640 */ 65, 65, 595, 82, 82, 66, 66, 509, 310, 595,
179125
- /* 1650 */ 360, 173, 173, 1065, 595, 553, 174, 174, 595, 125,
179126
- /* 1660 */ 125, 501, 595, 274, 1406, 89, 89, 126, 299, 465,
179127
- /* 1670 */ 596, 465, 67, 67, 1053, 595, 364, 85, 85, 595,
179128
- /* 1680 */ 1057, 150, 150, 933, 934, 86, 86, 127, 587, 367,
179129
- /* 1690 */ 4, 330, 586, 359, 523, 115, 271, 369, 171, 171,
179130
- /* 1700 */ 1011, 1012, 152, 152, 590, 1339, 1053, 1053, 1055, 1056,
179131
- /* 1710 */ 35, 371, 373, 595, 115, 1354, 1338, 9, 595, 168,
179132
- /* 1720 */ 595, 115, 595, 1113, 595, 271, 595, 378, 465, 595,
179133
- /* 1730 */ 388, 1419, 595, 539, 595, 1218, 146, 146, 1057, 1464,
179134
- /* 1740 */ 584, 172, 172, 165, 165, 156, 156, 155, 155, 153,
179135
- /* 1750 */ 153, 1392, 154, 154, 561, 88, 88, 90, 90, 560,
179136
- /* 1760 */ 127, 587, 1129, 4, 1129, 999, 208, 274, 595, 1065,
179137
- /* 1770 */ 595, 967, 595, 129, 1404, 125, 125, 590, 964, 1128,
179138
- /* 1780 */ 129, 1128, 897, 126, 162, 465, 596, 465, 1651, 582,
179139
- /* 1790 */ 1053, 87, 87, 52, 52, 60, 60, 966, 1624, 129,
179140
- /* 1800 */ 1469, 465, 1319, 243, 1310, 1298, 1297, 1299, 1644, 170,
179141
- /* 1810 */ 518, 1389, 289, 584, 12, 322, 323, 324, 228, 409,
179142
- /* 1820 */ 1451, 305, 1053, 1053, 1055, 1056, 35, 561, 241, 351,
179143
- /* 1830 */ 245, 1446, 562, 127, 587, 357, 4, 1439, 352, 311,
179144
- /* 1840 */ 1456, 503, 1065, 528, 1455, 416, 232, 1401, 125, 125,
179145
- /* 1850 */ 590, 1218, 381, 1532, 1337, 1531, 126, 1402, 465, 596,
179146
- /* 1860 */ 465, 1400, 1399, 1053, 585, 213, 403, 227, 214, 537,
179147
- /* 1870 */ 1647, 1587, 1274, 1589, 465, 1588, 239, 278, 1271, 1579,
179148
- /* 1880 */ 1577, 96, 435, 100, 224, 198, 584, 1537, 183, 99,
179149
- /* 1890 */ 191, 487, 488, 1452, 521, 1053, 1053, 1055, 1056, 35,
179150
- /* 1900 */ 561, 13, 193, 194, 195, 560, 196, 255, 113, 414,
179151
- /* 1910 */ 1458, 1457, 14, 510, 495, 1065, 259, 1460, 202, 106,
179152
- /* 1920 */ 516, 125, 125, 417, 1218, 290, 1548, 1526, 261, 126,
179153
- /* 1930 */ 206, 465, 596, 465, 362, 519, 1053, 419, 366, 262,
179154
- /* 1940 */ 1357, 1300, 1356, 449, 263, 1355, 1348, 108, 918, 1327,
179155
- /* 1950 */ 1661, 420, 1660, 233, 1326, 453, 1629, 380, 546, 1347,
179156
- /* 1960 */ 1325, 454, 277, 276, 1659, 1615, 1614, 457, 1053, 1053,
179157
- /* 1970 */ 1055, 1056, 35, 1636, 1222, 467, 320, 321, 301, 386,
179158
- /* 1980 */ 144, 1424, 572, 408, 408, 407, 285, 405, 11, 1423,
179159
- /* 1990 */ 884, 397, 120, 127, 587, 220, 4, 1218, 1380, 1513,
179160
- /* 2000 */ 395, 114, 1379, 247, 42, 339, 556, 598, 1228, 284,
179161
- /* 2010 */ 590, 401, 402, 338, 286, 287, 328, 599, 1295, 1290,
179162
- /* 2020 */ 1564, 175, 428, 1565, 429, 1563, 176, 871, 159, 177,
179163
- /* 2030 */ 1562, 318, 229, 466, 465, 230, 221, 91, 332, 469,
179164
- /* 2040 */ 1169, 471, 474, 94, 249, 189, 584, 95, 244, 1127,
179165
- /* 2050 */ 188, 1125, 178, 342, 190, 43, 1253, 179, 251, 950,
179166
- /* 2060 */ 254, 350, 192, 1141, 197, 180, 181, 438, 182, 440,
179167
- /* 2070 */ 102, 103, 248, 104, 199, 1065, 1144, 256, 105, 1140,
179168
- /* 2080 */ 257, 125, 125, 24, 166, 258, 361, 1133, 274, 126,
179169
- /* 2090 */ 515, 465, 596, 465, 260, 15, 1053, 204, 264, 382,
179170
- /* 2100 */ 886, 92, 587, 1268, 4, 203, 520, 427, 205, 524,
179171
- /* 2110 */ 107, 25, 330, 586, 374, 574, 26, 916, 590, 529,
179172
- /* 2120 */ 377, 929, 109, 319, 167, 110, 27, 184, 1053, 1053,
179173
- /* 2130 */ 1055, 1056, 35, 540, 532, 1215, 477, 1094, 111, 1185,
179174
- /* 2140 */ 17, 234, 465, 293, 1184, 295, 207, 997, 129, 273,
179175
- /* 2150 */ 1205, 28, 1003, 29, 584, 30, 1201, 1218, 1208, 31,
179176
- /* 2160 */ 1203, 1209, 32, 1190, 41, 568, 33, 34, 211, 115,
179177
- /* 2170 */ 8, 1108, 1095, 1093, 1097, 1098, 279, 580, 122, 1149,
179178
- /* 2180 */ 36, 117, 18, 1065, 1058, 118, 898, 128, 37, 125,
179179
- /* 2190 */ 125, 406, 591, 186, 960, 280, 281, 126, 1652, 465,
179180
- /* 2200 */ 596, 465, 1222, 467, 1053, 157, 301, 1224, 1223, 1286,
179181
- /* 2210 */ 1286, 408, 408, 407, 285, 405, 1286, 1286, 884, 1286,
179182
- /* 2220 */ 301, 1286, 1286, 573, 1286, 408, 408, 407, 285, 405,
179183
- /* 2230 */ 1286, 247, 884, 339, 1286, 1286, 1053, 1053, 1055, 1056,
179184
- /* 2240 */ 35, 338, 1286, 1286, 1286, 247, 1286, 339, 1286, 1286,
179185
- /* 2250 */ 1286, 1286, 1286, 1286, 1286, 338, 1286, 1286, 1286, 1286,
179186
- /* 2260 */ 1286, 1286, 1286, 1286, 1286, 1218, 1286, 1286, 1286, 1286,
179187
- /* 2270 */ 1286, 1286, 249, 1286, 1286, 1286, 1286, 1286, 1286, 1286,
179188
- /* 2280 */ 178, 1286, 1286, 43, 1286, 1286, 249, 1286, 1286, 1286,
179189
- /* 2290 */ 1286, 1286, 1286, 1286, 178, 1286, 1286, 43, 1286, 1286,
179190
- /* 2300 */ 248, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286,
179191
- /* 2310 */ 1286, 1286, 1286, 1286, 248, 1286, 1286, 1286, 1286, 1286,
179192
- /* 2320 */ 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286,
179193
- /* 2330 */ 1286, 1286, 1286, 1286, 1286, 427, 1286, 1286, 1286, 1286,
179194
- /* 2340 */ 330, 586, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 427,
179195
- /* 2350 */ 1286, 1286, 1286, 1286, 330, 586, 1286, 1286, 1286, 1286,
179196
- /* 2360 */ 1286, 1286, 1286, 1286, 477, 1286, 1286, 1286, 1286, 1286,
179197
- /* 2370 */ 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 477,
178953
+ /* 1070 */ 132, 463, 209, 1173, 563, 19, 19, 19, 19, 49,
178954
+ /* 1080 */ 424, 944, 1175, 1686, 1046, 1686, 218, 355, 484, 343,
178955
+ /* 1090 */ 210, 945, 569, 562, 1262, 1233, 1262, 490, 314, 423,
178956
+ /* 1100 */ 424, 1598, 1206, 388, 141, 142, 93, 440, 1254, 1254,
178957
+ /* 1110 */ 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140, 140,
178958
+ /* 1120 */ 352, 316, 531, 316, 141, 142, 93, 549, 1254, 1254,
178959
+ /* 1130 */ 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140, 140,
178960
+ /* 1140 */ 446, 10, 1598, 274, 388, 915, 281, 299, 383, 534,
178961
+ /* 1150 */ 378, 533, 269, 593, 1206, 587, 587, 587, 374, 293,
178962
+ /* 1160 */ 1579, 991, 1173, 302, 138, 138, 138, 138, 137, 137,
178963
+ /* 1170 */ 136, 136, 136, 135, 132, 463, 53, 53, 520, 1250,
178964
+ /* 1180 */ 593, 1147, 1576, 431, 138, 138, 138, 138, 137, 137,
178965
+ /* 1190 */ 136, 136, 136, 135, 132, 463, 1148, 301, 593, 1577,
178966
+ /* 1200 */ 593, 1307, 431, 54, 54, 593, 268, 593, 461, 461,
178967
+ /* 1210 */ 461, 1149, 347, 492, 424, 135, 132, 463, 1146, 1195,
178968
+ /* 1220 */ 474, 68, 68, 69, 69, 550, 332, 287, 21, 21,
178969
+ /* 1230 */ 55, 55, 1195, 581, 424, 1195, 309, 1250, 141, 142,
178970
+ /* 1240 */ 93, 119, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139,
178971
+ /* 1250 */ 140, 140, 140, 140, 593, 237, 480, 1476, 141, 142,
178972
+ /* 1260 */ 93, 593, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139,
178973
+ /* 1270 */ 140, 140, 140, 140, 344, 430, 346, 70, 70, 494,
178974
+ /* 1280 */ 991, 1132, 1132, 512, 56, 56, 1269, 593, 268, 593,
178975
+ /* 1290 */ 369, 374, 593, 481, 215, 384, 1624, 481, 138, 138,
178976
+ /* 1300 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 463,
178977
+ /* 1310 */ 71, 71, 72, 72, 225, 73, 73, 593, 138, 138,
178978
+ /* 1320 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 463,
178979
+ /* 1330 */ 586, 431, 593, 872, 873, 874, 593, 911, 593, 1602,
178980
+ /* 1340 */ 74, 74, 593, 7, 1460, 242, 593, 306, 424, 1578,
178981
+ /* 1350 */ 472, 306, 364, 219, 367, 75, 75, 430, 345, 57,
178982
+ /* 1360 */ 57, 58, 58, 432, 187, 59, 59, 593, 424, 61,
178983
+ /* 1370 */ 61, 1475, 141, 142, 93, 123, 1254, 1254, 1085, 1088,
178984
+ /* 1380 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 424, 570,
178985
+ /* 1390 */ 62, 62, 141, 142, 93, 911, 1254, 1254, 1085, 1088,
178986
+ /* 1400 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 161, 384,
178987
+ /* 1410 */ 1624, 1474, 141, 130, 93, 441, 1254, 1254, 1085, 1088,
178988
+ /* 1420 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 267, 266,
178989
+ /* 1430 */ 265, 1460, 138, 138, 138, 138, 137, 137, 136, 136,
178990
+ /* 1440 */ 136, 135, 132, 463, 593, 1336, 593, 1269, 1460, 384,
178991
+ /* 1450 */ 1624, 231, 138, 138, 138, 138, 137, 137, 136, 136,
178992
+ /* 1460 */ 136, 135, 132, 463, 593, 163, 593, 76, 76, 77,
178993
+ /* 1470 */ 77, 593, 138, 138, 138, 138, 137, 137, 136, 136,
178994
+ /* 1480 */ 136, 135, 132, 463, 475, 593, 483, 78, 78, 20,
178995
+ /* 1490 */ 20, 1249, 424, 491, 79, 79, 495, 422, 295, 235,
178996
+ /* 1500 */ 1574, 38, 511, 896, 422, 335, 240, 422, 147, 147,
178997
+ /* 1510 */ 112, 593, 424, 593, 101, 222, 991, 142, 93, 455,
178998
+ /* 1520 */ 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140,
178999
+ /* 1530 */ 140, 140, 593, 39, 148, 148, 80, 80, 93, 551,
179000
+ /* 1540 */ 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140,
179001
+ /* 1550 */ 140, 140, 328, 923, 922, 64, 64, 502, 1656, 1005,
179002
+ /* 1560 */ 933, 896, 124, 422, 121, 254, 593, 1006, 593, 226,
179003
+ /* 1570 */ 593, 127, 585, 164, 4, 16, 138, 138, 138, 138,
179004
+ /* 1580 */ 137, 137, 136, 136, 136, 135, 132, 463, 588, 81,
179005
+ /* 1590 */ 81, 65, 65, 82, 82, 593, 138, 138, 138, 138,
179006
+ /* 1600 */ 137, 137, 136, 136, 136, 135, 132, 463, 593, 226,
179007
+ /* 1610 */ 237, 966, 464, 593, 298, 593, 965, 593, 66, 66,
179008
+ /* 1620 */ 593, 1170, 593, 411, 582, 353, 469, 115, 593, 471,
179009
+ /* 1630 */ 169, 173, 173, 593, 44, 991, 174, 174, 89, 89,
179010
+ /* 1640 */ 67, 67, 593, 85, 85, 150, 150, 1114, 1043, 593,
179011
+ /* 1650 */ 273, 86, 86, 1062, 593, 503, 171, 171, 593, 125,
179012
+ /* 1660 */ 125, 497, 593, 273, 336, 152, 152, 126, 1335, 464,
179013
+ /* 1670 */ 594, 464, 146, 146, 1050, 593, 545, 172, 172, 593,
179014
+ /* 1680 */ 1054, 165, 165, 256, 339, 156, 156, 127, 585, 1586,
179015
+ /* 1690 */ 4, 329, 584, 499, 358, 273, 115, 348, 155, 155,
179016
+ /* 1700 */ 930, 931, 153, 153, 588, 1114, 1050, 1050, 1052, 1053,
179017
+ /* 1710 */ 35, 1554, 521, 593, 270, 1008, 1009, 9, 593, 372,
179018
+ /* 1720 */ 593, 115, 593, 168, 593, 115, 593, 1110, 464, 270,
179019
+ /* 1730 */ 996, 964, 273, 129, 1645, 1214, 154, 154, 1054, 1404,
179020
+ /* 1740 */ 582, 88, 88, 90, 90, 87, 87, 52, 52, 60,
179021
+ /* 1750 */ 60, 1405, 504, 537, 559, 1179, 961, 507, 129, 558,
179022
+ /* 1760 */ 127, 585, 1126, 4, 1126, 1125, 894, 1125, 162, 1062,
179023
+ /* 1770 */ 963, 359, 129, 1401, 363, 125, 125, 588, 366, 368,
179024
+ /* 1780 */ 370, 1349, 1334, 126, 1333, 464, 594, 464, 377, 387,
179025
+ /* 1790 */ 1050, 1391, 1414, 1618, 1459, 1387, 1399, 208, 580, 1464,
179026
+ /* 1800 */ 1314, 464, 243, 516, 1305, 1293, 1384, 1292, 1294, 1638,
179027
+ /* 1810 */ 288, 170, 228, 582, 12, 408, 321, 322, 241, 323,
179028
+ /* 1820 */ 245, 1446, 1050, 1050, 1052, 1053, 35, 559, 304, 350,
179029
+ /* 1830 */ 351, 501, 560, 127, 585, 1441, 4, 1451, 1434, 310,
179030
+ /* 1840 */ 1450, 526, 1062, 1332, 415, 380, 232, 1527, 125, 125,
179031
+ /* 1850 */ 588, 1214, 1396, 356, 1526, 583, 126, 1397, 464, 594,
179032
+ /* 1860 */ 464, 1641, 535, 1050, 1581, 1395, 1269, 1583, 1582, 213,
179033
+ /* 1870 */ 402, 277, 214, 227, 464, 1573, 239, 1571, 1266, 1394,
179034
+ /* 1880 */ 434, 198, 100, 224, 96, 183, 582, 191, 485, 193,
179035
+ /* 1890 */ 486, 194, 195, 196, 519, 1050, 1050, 1052, 1053, 35,
179036
+ /* 1900 */ 559, 113, 252, 413, 1447, 558, 493, 13, 1455, 416,
179037
+ /* 1910 */ 1453, 1452, 14, 202, 1521, 1062, 1532, 508, 258, 106,
179038
+ /* 1920 */ 514, 125, 125, 99, 1214, 1543, 289, 260, 206, 126,
179039
+ /* 1930 */ 365, 464, 594, 464, 361, 517, 1050, 261, 448, 1295,
179040
+ /* 1940 */ 262, 418, 1352, 1351, 108, 1350, 1655, 1654, 1343, 915,
179041
+ /* 1950 */ 419, 1322, 233, 452, 319, 379, 1321, 453, 1623, 320,
179042
+ /* 1960 */ 1320, 275, 1653, 544, 276, 1609, 1608, 1342, 1050, 1050,
179043
+ /* 1970 */ 1052, 1053, 35, 1630, 1218, 466, 385, 456, 300, 1419,
179044
+ /* 1980 */ 144, 1418, 570, 407, 407, 406, 284, 404, 11, 1508,
179045
+ /* 1990 */ 881, 396, 120, 127, 585, 394, 4, 1214, 327, 114,
179046
+ /* 2000 */ 1375, 1374, 220, 247, 400, 338, 401, 554, 42, 1224,
179047
+ /* 2010 */ 588, 596, 283, 337, 285, 286, 188, 597, 1290, 1285,
179048
+ /* 2020 */ 175, 1558, 176, 1559, 1557, 1556, 159, 317, 229, 177,
179049
+ /* 2030 */ 868, 230, 91, 465, 464, 221, 331, 468, 1165, 470,
179050
+ /* 2040 */ 473, 94, 244, 95, 249, 189, 582, 1124, 1122, 341,
179051
+ /* 2050 */ 427, 190, 178, 1249, 179, 43, 192, 947, 349, 428,
179052
+ /* 2060 */ 1138, 197, 251, 180, 181, 436, 102, 182, 438, 103,
179053
+ /* 2070 */ 104, 199, 248, 1140, 253, 1062, 105, 255, 1137, 166,
179054
+ /* 2080 */ 24, 125, 125, 257, 1264, 273, 360, 513, 259, 126,
179055
+ /* 2090 */ 15, 464, 594, 464, 204, 883, 1050, 518, 263, 373,
179056
+ /* 2100 */ 381, 92, 585, 1130, 4, 203, 205, 426, 107, 522,
179057
+ /* 2110 */ 25, 26, 329, 584, 913, 572, 527, 376, 588, 926,
179058
+ /* 2120 */ 530, 109, 184, 318, 167, 110, 27, 538, 1050, 1050,
179059
+ /* 2130 */ 1052, 1053, 35, 1211, 1091, 17, 476, 111, 1181, 234,
179060
+ /* 2140 */ 292, 1180, 464, 294, 207, 994, 129, 1201, 272, 1000,
179061
+ /* 2150 */ 28, 1197, 29, 30, 582, 1199, 1205, 1214, 31, 1204,
179062
+ /* 2160 */ 32, 1186, 41, 566, 33, 1105, 211, 8, 115, 1092,
179063
+ /* 2170 */ 1090, 1094, 34, 278, 578, 1095, 117, 122, 118, 1145,
179064
+ /* 2180 */ 36, 18, 128, 1062, 1055, 895, 957, 37, 589, 125,
179065
+ /* 2190 */ 125, 279, 186, 280, 1646, 157, 405, 126, 1220, 464,
179066
+ /* 2200 */ 594, 464, 1218, 466, 1050, 1219, 300, 1281, 1281, 1281,
179067
+ /* 2210 */ 1281, 407, 407, 406, 284, 404, 1281, 1281, 881, 1281,
179068
+ /* 2220 */ 300, 1281, 1281, 571, 1281, 407, 407, 406, 284, 404,
179069
+ /* 2230 */ 1281, 247, 881, 338, 1281, 1281, 1050, 1050, 1052, 1053,
179070
+ /* 2240 */ 35, 337, 1281, 1281, 1281, 247, 1281, 338, 1281, 1281,
179071
+ /* 2250 */ 1281, 1281, 1281, 1281, 1281, 337, 1281, 1281, 1281, 1281,
179072
+ /* 2260 */ 1281, 1281, 1281, 1281, 1281, 1214, 1281, 1281, 1281, 1281,
179073
+ /* 2270 */ 1281, 1281, 249, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
179074
+ /* 2280 */ 178, 1281, 1281, 43, 1281, 1281, 249, 1281, 1281, 1281,
179075
+ /* 2290 */ 1281, 1281, 1281, 1281, 178, 1281, 1281, 43, 1281, 1281,
179076
+ /* 2300 */ 248, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
179077
+ /* 2310 */ 1281, 1281, 1281, 1281, 248, 1281, 1281, 1281, 1281, 1281,
179078
+ /* 2320 */ 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
179079
+ /* 2330 */ 1281, 1281, 1281, 1281, 1281, 426, 1281, 1281, 1281, 1281,
179080
+ /* 2340 */ 329, 584, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 426,
179081
+ /* 2350 */ 1281, 1281, 1281, 1281, 329, 584, 1281, 1281, 1281, 1281,
179082
+ /* 2360 */ 1281, 1281, 1281, 1281, 476, 1281, 1281, 1281, 1281, 1281,
179083
+ /* 2370 */ 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 476,
179198179084
};
179199179085
static const YYCODETYPE yy_lookahead[] = {
179200
- /* 0 */ 277, 278, 279, 241, 242, 225, 195, 227, 195, 246,
179201
- /* 10 */ 195, 195, 195, 221, 195, 235, 254, 195, 256, 19,
179202
- /* 20 */ 257, 298, 277, 278, 279, 206, 213, 214, 206, 218,
179086
+ /* 0 */ 277, 278, 279, 241, 242, 225, 195, 227, 195, 312,
179087
+ /* 10 */ 195, 218, 195, 316, 195, 235, 254, 195, 256, 19,
179088
+ /* 20 */ 297, 277, 278, 279, 218, 206, 213, 214, 206, 218,
179203179089
/* 30 */ 219, 31, 206, 218, 219, 218, 219, 218, 219, 39,
179204
- /* 40 */ 218, 219, 29, 43, 44, 45, 33, 47, 48, 49,
179090
+ /* 40 */ 218, 219, 195, 43, 44, 45, 195, 47, 48, 49,
179205179091
/* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 19,
179206
- /* 60 */ 241, 242, 276, 241, 242, 195, 255, 241, 242, 277,
179207
- /* 70 */ 278, 279, 11, 254, 255, 256, 254, 255, 256, 66,
179208
- /* 80 */ 254, 265, 256, 43, 44, 45, 264, 47, 48, 49,
179209
- /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 215,
179210
- /* 100 */ 287, 315, 316, 103, 104, 105, 106, 107, 108, 109,
179211
- /* 110 */ 110, 111, 112, 113, 114, 237, 238, 195, 74, 195,
179212
- /* 120 */ 187, 188, 189, 190, 191, 192, 82, 87, 25, 89,
179213
- /* 130 */ 197, 19, 199, 318, 319, 318, 319, 25, 195, 206,
179214
- /* 140 */ 218, 219, 195, 103, 104, 105, 106, 107, 108, 109,
179092
+ /* 60 */ 241, 242, 195, 241, 242, 195, 255, 241, 242, 195,
179093
+ /* 70 */ 255, 237, 238, 254, 255, 256, 254, 255, 256, 264,
179094
+ /* 80 */ 254, 207, 256, 43, 44, 45, 264, 47, 48, 49,
179095
+ /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 251,
179096
+ /* 100 */ 287, 253, 215, 103, 104, 105, 106, 107, 108, 109,
179097
+ /* 110 */ 110, 111, 112, 113, 114, 82, 265, 195, 271, 11,
179098
+ /* 120 */ 187, 188, 189, 190, 191, 192, 190, 87, 192, 89,
179099
+ /* 130 */ 197, 19, 199, 197, 317, 199, 319, 25, 271, 206,
179100
+ /* 140 */ 218, 219, 206, 103, 104, 105, 106, 107, 108, 109,
179215179101
/* 150 */ 110, 111, 112, 113, 114, 43, 44, 45, 195, 47,
179216179102
/* 160 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
179217
- /* 170 */ 58, 60, 128, 289, 241, 242, 114, 255, 294, 60,
179218
- /* 180 */ 310, 311, 70, 139, 140, 218, 264, 254, 77, 256,
179219
- /* 190 */ 129, 130, 73, 55, 56, 57, 58, 59, 221, 88,
179220
- /* 200 */ 218, 90, 269, 240, 93, 107, 108, 109, 110, 111,
179221
- /* 210 */ 112, 113, 114, 215, 271, 103, 104, 105, 106, 107,
179222
- /* 220 */ 108, 109, 110, 111, 112, 113, 114, 218, 117, 118,
179223
- /* 230 */ 119, 307, 299, 309, 301, 19, 117, 118, 119, 129,
179224
- /* 240 */ 130, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179225
- /* 250 */ 112, 113, 114, 150, 277, 278, 279, 146, 311, 43,
179103
+ /* 170 */ 58, 60, 139, 140, 241, 242, 289, 241, 242, 309,
179104
+ /* 180 */ 310, 294, 70, 47, 48, 49, 50, 254, 77, 256,
179105
+ /* 190 */ 254, 195, 256, 55, 56, 57, 58, 59, 221, 88,
179106
+ /* 200 */ 109, 90, 269, 240, 93, 269, 107, 108, 109, 110,
179107
+ /* 210 */ 111, 112, 113, 114, 215, 103, 104, 105, 106, 107,
179108
+ /* 220 */ 108, 109, 110, 111, 112, 113, 114, 136, 117, 118,
179109
+ /* 230 */ 119, 298, 141, 300, 298, 19, 300, 129, 130, 317,
179110
+ /* 240 */ 318, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179111
+ /* 250 */ 112, 113, 114, 114, 277, 278, 279, 146, 122, 43,
179226179112
/* 260 */ 44, 45, 195, 47, 48, 49, 50, 51, 52, 53,
179227
- /* 270 */ 54, 55, 56, 57, 58, 277, 278, 279, 313, 19,
179228
- /* 280 */ 195, 195, 317, 23, 68, 218, 219, 25, 55, 56,
179229
- /* 290 */ 57, 58, 109, 110, 111, 112, 113, 114, 22, 23,
179230
- /* 300 */ 233, 25, 313, 43, 44, 45, 317, 47, 48, 49,
179113
+ /* 270 */ 54, 55, 56, 57, 58, 218, 277, 278, 279, 19,
179114
+ /* 280 */ 19, 195, 286, 23, 68, 218, 219, 55, 56, 57,
179115
+ /* 290 */ 58, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179116
+ /* 300 */ 112, 113, 114, 43, 44, 45, 232, 47, 48, 49,
179231179117
/* 310 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 103,
179232179118
/* 320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
179233
- /* 330 */ 114, 232, 60, 212, 213, 214, 103, 104, 105, 106,
179234
- /* 340 */ 107, 108, 109, 110, 111, 112, 113, 114, 103, 104,
179235
- /* 350 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179236
- /* 360 */ 24, 195, 200, 103, 104, 105, 106, 107, 108, 109,
179237
- /* 370 */ 110, 111, 112, 113, 114, 251, 60, 253, 102, 107,
179238
- /* 380 */ 108, 119, 313, 19, 218, 219, 317, 23, 116, 117,
179239
- /* 390 */ 118, 119, 195, 121, 206, 22, 60, 26, 312, 313,
179240
- /* 400 */ 195, 129, 205, 317, 207, 35, 144, 43, 44, 45,
179241
- /* 410 */ 195, 47, 48, 49, 50, 51, 52, 53, 54, 55,
179242
- /* 420 */ 56, 57, 58, 218, 219, 82, 154, 19, 156, 241,
179243
- /* 430 */ 242, 60, 24, 117, 118, 119, 120, 67, 233, 123,
179244
- /* 440 */ 124, 125, 254, 195, 256, 75, 284, 259, 260, 133,
179245
- /* 450 */ 288, 43, 44, 45, 118, 47, 48, 49, 50, 51,
179119
+ /* 330 */ 114, 135, 60, 137, 138, 103, 104, 105, 106, 107,
179120
+ /* 340 */ 108, 109, 110, 111, 112, 113, 114, 82, 281, 206,
179121
+ /* 350 */ 195, 109, 110, 111, 112, 113, 114, 195, 195, 195,
179122
+ /* 360 */ 205, 22, 207, 103, 104, 105, 106, 107, 108, 109,
179123
+ /* 370 */ 110, 111, 112, 113, 114, 195, 60, 116, 117, 107,
179124
+ /* 380 */ 108, 218, 219, 19, 241, 242, 121, 23, 116, 117,
179125
+ /* 390 */ 118, 119, 306, 121, 308, 206, 234, 254, 15, 256,
179126
+ /* 400 */ 195, 129, 259, 260, 139, 140, 145, 43, 44, 45,
179127
+ /* 410 */ 200, 47, 48, 49, 50, 51, 52, 53, 54, 55,
179128
+ /* 420 */ 56, 57, 58, 218, 219, 60, 154, 19, 156, 265,
179129
+ /* 430 */ 241, 242, 24, 117, 118, 119, 120, 21, 73, 123,
179130
+ /* 440 */ 124, 125, 74, 254, 61, 256, 107, 108, 221, 133,
179131
+ /* 450 */ 82, 43, 44, 45, 195, 47, 48, 49, 50, 51,
179246179132
/* 460 */ 52, 53, 54, 55, 56, 57, 58, 103, 104, 105,
179247179133
/* 470 */ 106, 107, 108, 109, 110, 111, 112, 113, 114, 195,
179248
- /* 480 */ 107, 108, 139, 140, 318, 195, 320, 195, 117, 118,
179249
- /* 490 */ 119, 61, 19, 20, 120, 22, 195, 123, 124, 125,
179250
- /* 500 */ 195, 131, 218, 219, 195, 195, 146, 133, 207, 36,
179251
- /* 510 */ 295, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179252
- /* 520 */ 112, 113, 114, 218, 219, 165, 60, 195, 218, 219,
179253
- /* 530 */ 240, 19, 240, 60, 189, 190, 191, 192, 233, 255,
179254
- /* 540 */ 139, 140, 197, 233, 199, 72, 61, 272, 264, 195,
179255
- /* 550 */ 120, 206, 195, 19, 60, 43, 44, 45, 206, 47,
179134
+ /* 480 */ 317, 318, 117, 118, 119, 22, 120, 195, 22, 123,
179135
+ /* 490 */ 124, 125, 19, 20, 284, 22, 128, 81, 288, 133,
179136
+ /* 500 */ 195, 195, 218, 219, 277, 278, 279, 139, 140, 36,
179137
+ /* 510 */ 195, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179138
+ /* 520 */ 112, 113, 114, 218, 219, 62, 60, 195, 241, 242,
179139
+ /* 530 */ 271, 19, 240, 60, 189, 190, 191, 192, 233, 255,
179140
+ /* 540 */ 124, 254, 197, 256, 199, 72, 129, 130, 264, 195,
179141
+ /* 550 */ 195, 206, 22, 23, 60, 43, 44, 45, 206, 47,
179256179142
/* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
179257
- /* 570 */ 58, 25, 218, 219, 101, 109, 112, 113, 114, 195,
179258
- /* 580 */ 107, 108, 109, 117, 118, 119, 241, 242, 115, 195,
179259
- /* 590 */ 117, 118, 119, 241, 242, 122, 60, 206, 195, 254,
179260
- /* 600 */ 60, 256, 218, 219, 195, 120, 254, 195, 256, 73,
179261
- /* 610 */ 125, 117, 118, 119, 269, 103, 104, 105, 106, 107,
179143
+ /* 570 */ 58, 195, 218, 219, 101, 195, 60, 271, 162, 195,
179144
+ /* 580 */ 107, 108, 109, 117, 118, 119, 241, 242, 115, 73,
179145
+ /* 590 */ 117, 118, 119, 241, 242, 122, 60, 195, 266, 254,
179146
+ /* 600 */ 312, 256, 218, 219, 316, 203, 254, 195, 256, 255,
179147
+ /* 610 */ 208, 117, 118, 119, 269, 103, 104, 105, 106, 107,
179262179148
/* 620 */ 108, 109, 110, 111, 112, 113, 114, 154, 155, 156,
179263
- /* 630 */ 157, 158, 241, 242, 240, 281, 19, 234, 144, 255,
179264
- /* 640 */ 23, 206, 166, 167, 299, 254, 301, 256, 264, 240,
179265
- /* 650 */ 116, 117, 295, 117, 118, 119, 183, 117, 118, 119,
179149
+ /* 630 */ 157, 158, 102, 117, 118, 119, 19, 242, 144, 255,
179150
+ /* 640 */ 23, 206, 24, 298, 195, 300, 206, 195, 264, 254,
179151
+ /* 650 */ 206, 256, 240, 117, 118, 119, 183, 22, 22, 23,
179266179152
/* 660 */ 43, 44, 45, 151, 47, 48, 49, 50, 51, 52,
179267
- /* 670 */ 53, 54, 55, 56, 57, 58, 241, 242, 266, 145,
179268
- /* 680 */ 19, 241, 242, 242, 23, 139, 140, 77, 25, 254,
179269
- /* 690 */ 195, 256, 152, 276, 254, 254, 256, 256, 88, 206,
179270
- /* 700 */ 90, 60, 206, 93, 43, 44, 45, 272, 47, 48,
179153
+ /* 670 */ 53, 54, 55, 56, 57, 58, 241, 242, 60, 195,
179154
+ /* 680 */ 19, 241, 242, 195, 23, 241, 242, 195, 152, 254,
179155
+ /* 690 */ 310, 256, 243, 312, 254, 60, 256, 316, 254, 206,
179156
+ /* 700 */ 256, 60, 218, 219, 43, 44, 45, 272, 47, 48,
179271179157
/* 710 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179272179158
/* 720 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
179273
- /* 730 */ 113, 114, 315, 316, 241, 242, 131, 241, 242, 134,
179274
- /* 740 */ 22, 206, 101, 22, 82, 19, 20, 254, 22, 256,
179275
- /* 750 */ 254, 74, 256, 263, 22, 195, 146, 267, 117, 118,
179276
- /* 760 */ 276, 266, 36, 122, 103, 104, 105, 106, 107, 108,
179277
- /* 770 */ 109, 110, 111, 112, 113, 114, 241, 242, 60, 217,
179278
- /* 780 */ 130, 60, 195, 121, 19, 195, 60, 225, 23, 254,
179279
- /* 790 */ 127, 256, 60, 237, 238, 154, 155, 156, 72, 315,
179280
- /* 800 */ 316, 139, 140, 153, 22, 128, 129, 130, 43, 44,
179159
+ /* 730 */ 113, 114, 240, 60, 241, 242, 118, 25, 102, 255,
179160
+ /* 740 */ 166, 167, 101, 22, 26, 19, 20, 254, 22, 256,
179161
+ /* 750 */ 139, 140, 117, 118, 119, 306, 195, 308, 117, 118,
179162
+ /* 760 */ 237, 238, 36, 122, 103, 104, 105, 106, 107, 108,
179163
+ /* 770 */ 109, 110, 111, 112, 113, 114, 195, 195, 60, 218,
179164
+ /* 780 */ 219, 60, 109, 195, 19, 217, 60, 25, 23, 77,
179165
+ /* 790 */ 117, 118, 119, 225, 233, 154, 155, 156, 72, 312,
179166
+ /* 800 */ 218, 219, 90, 316, 22, 93, 303, 304, 43, 44,
179281179167
/* 810 */ 45, 195, 47, 48, 49, 50, 51, 52, 53, 54,
179282
- /* 820 */ 55, 56, 57, 58, 183, 304, 305, 101, 19, 60,
179283
- /* 830 */ 243, 271, 23, 107, 108, 117, 118, 119, 117, 118,
179284
- /* 840 */ 119, 115, 60, 117, 118, 119, 16, 195, 122, 117,
179285
- /* 850 */ 118, 119, 43, 44, 45, 22, 47, 48, 49, 50,
179168
+ /* 820 */ 55, 56, 57, 58, 183, 195, 195, 101, 19, 213,
179169
+ /* 830 */ 214, 243, 23, 107, 108, 117, 118, 119, 117, 118,
179170
+ /* 840 */ 119, 115, 60, 117, 118, 119, 195, 60, 122, 218,
179171
+ /* 850 */ 219, 22, 43, 44, 45, 35, 47, 48, 49, 50,
179286179172
/* 860 */ 51, 52, 53, 54, 55, 56, 57, 58, 103, 104,
179287179173
/* 870 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179288
- /* 880 */ 154, 155, 156, 157, 158, 295, 117, 118, 119, 60,
179289
- /* 890 */ 101, 60, 240, 60, 307, 21, 309, 195, 195, 117,
179290
- /* 900 */ 118, 119, 195, 47, 48, 49, 50, 118, 78, 183,
179291
- /* 910 */ 80, 122, 103, 104, 105, 106, 107, 108, 109, 110,
179292
- /* 920 */ 111, 112, 113, 114, 195, 218, 219, 16, 312, 313,
179293
- /* 930 */ 195, 195, 19, 317, 262, 263, 23, 212, 213, 214,
179294
- /* 940 */ 233, 210, 211, 154, 155, 156, 117, 118, 119, 118,
179295
- /* 950 */ 117, 118, 119, 218, 219, 81, 43, 44, 45, 195,
179174
+ /* 880 */ 154, 155, 156, 157, 158, 195, 255, 67, 195, 60,
179175
+ /* 890 */ 101, 240, 311, 312, 306, 75, 308, 316, 29, 117,
179176
+ /* 900 */ 118, 119, 33, 287, 117, 118, 119, 118, 146, 183,
179177
+ /* 910 */ 195, 122, 103, 104, 105, 106, 107, 108, 109, 110,
179178
+ /* 920 */ 111, 112, 113, 114, 215, 195, 77, 60, 25, 195,
179179
+ /* 930 */ 122, 144, 19, 218, 219, 66, 23, 88, 246, 90,
179180
+ /* 940 */ 132, 25, 93, 154, 155, 156, 117, 118, 119, 257,
179181
+ /* 950 */ 195, 131, 218, 219, 195, 265, 43, 44, 45, 195,
179296179182
/* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179297
- /* 970 */ 57, 58, 183, 144, 271, 122, 19, 190, 122, 192,
179298
- /* 980 */ 23, 25, 218, 219, 197, 132, 199, 195, 286, 78,
179299
- /* 990 */ 255, 80, 162, 206, 265, 107, 108, 233, 124, 195,
179300
- /* 1000 */ 43, 44, 45, 195, 47, 48, 49, 50, 51, 52,
179183
+ /* 970 */ 57, 58, 183, 218, 219, 195, 19, 218, 219, 195,
179184
+ /* 980 */ 23, 195, 218, 219, 117, 118, 119, 195, 233, 255,
179185
+ /* 990 */ 195, 195, 233, 22, 23, 146, 25, 233, 218, 219,
179186
+ /* 1000 */ 43, 44, 45, 294, 47, 48, 49, 50, 51, 52,
179301179187
/* 1010 */ 53, 54, 55, 56, 57, 58, 103, 104, 105, 106,
179302
- /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 114, 241, 242,
179303
- /* 1030 */ 195, 195, 31, 77, 195, 243, 162, 195, 195, 195,
179304
- /* 1040 */ 39, 254, 154, 256, 156, 19, 90, 203, 19, 93,
179305
- /* 1050 */ 24, 208, 208, 218, 219, 195, 269, 218, 219, 195,
179188
+ /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 12,
179189
+ /* 1030 */ 234, 195, 240, 74, 195, 255, 195, 60, 243, 262,
179190
+ /* 1040 */ 263, 311, 312, 25, 27, 19, 316, 107, 108, 265,
179191
+ /* 1050 */ 24, 265, 195, 150, 195, 139, 140, 218, 219, 42,
179306179192
/* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
179307
- /* 1070 */ 113, 114, 233, 230, 266, 232, 47, 263, 218, 219,
179308
- /* 1080 */ 19, 267, 218, 219, 23, 23, 299, 25, 301, 135,
179309
- /* 1090 */ 255, 137, 138, 233, 47, 195, 195, 195, 25, 307,
179310
- /* 1100 */ 19, 309, 22, 23, 43, 44, 45, 271, 47, 48,
179193
+ /* 1070 */ 113, 114, 233, 102, 67, 218, 219, 218, 219, 243,
179194
+ /* 1080 */ 19, 64, 22, 23, 23, 25, 195, 128, 129, 130,
179195
+ /* 1090 */ 233, 74, 233, 86, 154, 118, 156, 130, 265, 208,
179196
+ /* 1100 */ 19, 306, 95, 308, 43, 44, 45, 266, 47, 48,
179311179197
/* 1110 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179312
- /* 1120 */ 218, 219, 96, 195, 43, 44, 45, 195, 47, 48,
179198
+ /* 1120 */ 153, 230, 96, 232, 43, 44, 45, 19, 47, 48,
179313179199
/* 1130 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179314
- /* 1140 */ 114, 195, 195, 243, 243, 116, 120, 121, 122, 123,
179315
- /* 1150 */ 124, 125, 126, 195, 195, 195, 195, 255, 132, 213,
179316
- /* 1160 */ 214, 132, 234, 116, 103, 104, 105, 106, 107, 108,
179317
- /* 1170 */ 109, 110, 111, 112, 113, 114, 218, 219, 218, 219,
179318
- /* 1180 */ 195, 119, 102, 195, 103, 104, 105, 106, 107, 108,
179319
- /* 1190 */ 109, 110, 111, 112, 113, 114, 22, 23, 22, 25,
179320
- /* 1200 */ 24, 67, 12, 218, 219, 195, 144, 307, 307, 309,
179321
- /* 1210 */ 309, 195, 77, 255, 19, 255, 143, 27, 23, 313,
179322
- /* 1220 */ 86, 100, 313, 317, 265, 90, 317, 266, 93, 95,
179323
- /* 1230 */ 210, 211, 42, 287, 19, 23, 60, 25, 43, 44,
179200
+ /* 1140 */ 114, 22, 306, 24, 308, 127, 120, 121, 122, 123,
179201
+ /* 1150 */ 124, 125, 126, 195, 147, 212, 213, 214, 132, 23,
179202
+ /* 1160 */ 195, 25, 102, 100, 103, 104, 105, 106, 107, 108,
179203
+ /* 1170 */ 109, 110, 111, 112, 113, 114, 218, 219, 19, 60,
179204
+ /* 1180 */ 195, 12, 210, 211, 103, 104, 105, 106, 107, 108,
179205
+ /* 1190 */ 109, 110, 111, 112, 113, 114, 27, 134, 195, 195,
179206
+ /* 1200 */ 195, 210, 211, 218, 219, 195, 47, 195, 212, 213,
179207
+ /* 1210 */ 214, 42, 16, 130, 19, 112, 113, 114, 23, 77,
179208
+ /* 1220 */ 195, 218, 219, 218, 219, 117, 163, 164, 218, 219,
179209
+ /* 1230 */ 218, 219, 90, 64, 19, 93, 153, 118, 43, 44,
179324179210
/* 1240 */ 45, 160, 47, 48, 49, 50, 51, 52, 53, 54,
179325
- /* 1250 */ 55, 56, 57, 58, 64, 134, 109, 261, 43, 44,
179326
- /* 1260 */ 45, 215, 47, 48, 49, 50, 51, 52, 53, 54,
179327
- /* 1270 */ 55, 56, 57, 58, 210, 211, 102, 128, 129, 130,
179328
- /* 1280 */ 12, 147, 266, 136, 163, 164, 302, 303, 141, 195,
179329
- /* 1290 */ 25, 195, 19, 195, 118, 27, 228, 19, 103, 104,
179211
+ /* 1250 */ 55, 56, 57, 58, 195, 119, 272, 276, 43, 44,
179212
+ /* 1260 */ 45, 195, 47, 48, 49, 50, 51, 52, 53, 54,
179213
+ /* 1270 */ 55, 56, 57, 58, 78, 116, 80, 218, 219, 116,
179214
+ /* 1280 */ 144, 128, 129, 130, 218, 219, 61, 195, 47, 195,
179215
+ /* 1290 */ 16, 132, 195, 263, 195, 314, 315, 267, 103, 104,
179330179216
/* 1300 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179331
- /* 1310 */ 42, 195, 218, 219, 218, 219, 218, 219, 103, 104,
179217
+ /* 1310 */ 218, 219, 218, 219, 151, 218, 219, 195, 103, 104,
179332179218
/* 1320 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179333
- /* 1330 */ 19, 195, 64, 195, 218, 219, 195, 259, 260, 195,
179334
- /* 1340 */ 294, 195, 74, 195, 150, 151, 195, 246, 19, 7,
179335
- /* 1350 */ 8, 9, 195, 24, 218, 219, 218, 219, 257, 218,
179336
- /* 1360 */ 219, 195, 218, 219, 218, 219, 218, 219, 19, 218,
179337
- /* 1370 */ 219, 98, 43, 44, 45, 160, 47, 48, 49, 50,
179338
- /* 1380 */ 51, 52, 53, 54, 55, 56, 57, 58, 19, 128,
179339
- /* 1390 */ 129, 130, 43, 44, 45, 117, 47, 48, 49, 50,
179340
- /* 1400 */ 51, 52, 53, 54, 55, 56, 57, 58, 22, 22,
179341
- /* 1410 */ 116, 146, 43, 44, 45, 195, 47, 48, 49, 50,
179342
- /* 1420 */ 51, 52, 53, 54, 55, 56, 57, 58, 117, 159,
179343
- /* 1430 */ 195, 161, 103, 104, 105, 106, 107, 108, 109, 110,
179344
- /* 1440 */ 111, 112, 113, 114, 195, 151, 195, 60, 62, 15,
179345
- /* 1450 */ 195, 25, 103, 104, 105, 106, 107, 108, 109, 110,
179346
- /* 1460 */ 111, 112, 113, 114, 195, 228, 195, 218, 219, 218,
179219
+ /* 1330 */ 210, 211, 195, 7, 8, 9, 195, 60, 195, 312,
179220
+ /* 1340 */ 218, 219, 195, 316, 195, 120, 195, 263, 19, 195,
179221
+ /* 1350 */ 125, 267, 78, 24, 80, 218, 219, 116, 162, 218,
179222
+ /* 1360 */ 219, 218, 219, 301, 302, 218, 219, 195, 19, 218,
179223
+ /* 1370 */ 219, 276, 43, 44, 45, 160, 47, 48, 49, 50,
179224
+ /* 1380 */ 51, 52, 53, 54, 55, 56, 57, 58, 19, 146,
179225
+ /* 1390 */ 218, 219, 43, 44, 45, 118, 47, 48, 49, 50,
179226
+ /* 1400 */ 51, 52, 53, 54, 55, 56, 57, 58, 165, 314,
179227
+ /* 1410 */ 315, 276, 43, 44, 45, 266, 47, 48, 49, 50,
179228
+ /* 1420 */ 51, 52, 53, 54, 55, 56, 57, 58, 128, 129,
179229
+ /* 1430 */ 130, 195, 103, 104, 105, 106, 107, 108, 109, 110,
179230
+ /* 1440 */ 111, 112, 113, 114, 195, 228, 195, 61, 195, 314,
179231
+ /* 1450 */ 315, 25, 103, 104, 105, 106, 107, 108, 109, 110,
179232
+ /* 1460 */ 111, 112, 113, 114, 195, 22, 195, 218, 219, 218,
179347179233
/* 1470 */ 219, 195, 103, 104, 105, 106, 107, 108, 109, 110,
179348
- /* 1480 */ 111, 112, 113, 114, 22, 195, 246, 218, 219, 218,
179349
- /* 1490 */ 219, 195, 19, 22, 23, 61, 246, 257, 24, 136,
179350
- /* 1500 */ 246, 22, 60, 24, 141, 118, 60, 257, 218, 219,
179351
- /* 1510 */ 195, 257, 19, 195, 218, 219, 54, 44, 45, 195,
179234
+ /* 1480 */ 111, 112, 113, 114, 195, 195, 246, 218, 219, 218,
179235
+ /* 1490 */ 219, 25, 19, 246, 218, 219, 246, 257, 259, 260,
179236
+ /* 1500 */ 195, 22, 266, 60, 257, 195, 120, 257, 218, 219,
179237
+ /* 1510 */ 116, 195, 19, 195, 150, 151, 25, 44, 45, 266,
179352179238
/* 1520 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179353
- /* 1530 */ 57, 58, 195, 218, 219, 195, 218, 219, 45, 195,
179239
+ /* 1530 */ 57, 58, 195, 54, 218, 219, 218, 219, 45, 145,
179354179240
/* 1540 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179355
- /* 1550 */ 57, 58, 195, 121, 122, 218, 219, 195, 218, 219,
179356
- /* 1560 */ 118, 195, 218, 219, 118, 23, 195, 25, 195, 143,
179357
- /* 1570 */ 195, 19, 20, 102, 22, 195, 103, 104, 105, 106,
179241
+ /* 1550 */ 57, 58, 246, 121, 122, 218, 219, 19, 23, 31,
179242
+ /* 1560 */ 25, 118, 159, 257, 161, 24, 195, 39, 195, 143,
179243
+ /* 1570 */ 195, 19, 20, 22, 22, 24, 103, 104, 105, 106,
179358179244
/* 1580 */ 107, 108, 109, 110, 111, 112, 113, 114, 36, 218,
179359179245
/* 1590 */ 219, 218, 219, 218, 219, 195, 103, 104, 105, 106,
179360
- /* 1600 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 23,
179361
- /* 1610 */ 23, 25, 60, 195, 195, 195, 142, 195, 218, 219,
179362
- /* 1620 */ 195, 23, 195, 25, 72, 130, 116, 23, 195, 25,
179363
- /* 1630 */ 195, 218, 219, 195, 82, 195, 218, 219, 218, 219,
179364
- /* 1640 */ 218, 219, 195, 218, 219, 218, 219, 195, 153, 195,
179365
- /* 1650 */ 195, 218, 219, 101, 195, 145, 218, 219, 195, 107,
179366
- /* 1660 */ 108, 23, 195, 25, 195, 218, 219, 115, 22, 117,
179367
- /* 1670 */ 118, 119, 218, 219, 122, 195, 195, 218, 219, 195,
179368
- /* 1680 */ 60, 218, 219, 7, 8, 218, 219, 19, 20, 195,
179246
+ /* 1600 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 143,
179247
+ /* 1610 */ 119, 136, 60, 195, 22, 195, 141, 195, 218, 219,
179248
+ /* 1620 */ 195, 23, 195, 25, 72, 23, 131, 25, 195, 134,
179249
+ /* 1630 */ 23, 218, 219, 195, 82, 144, 218, 219, 218, 219,
179250
+ /* 1640 */ 218, 219, 195, 218, 219, 218, 219, 60, 23, 195,
179251
+ /* 1650 */ 25, 218, 219, 101, 195, 117, 218, 219, 195, 107,
179252
+ /* 1660 */ 108, 23, 195, 25, 195, 218, 219, 115, 228, 117,
179253
+ /* 1670 */ 118, 119, 218, 219, 122, 195, 19, 218, 219, 195,
179254
+ /* 1680 */ 60, 218, 219, 142, 195, 218, 219, 19, 20, 195,
179369179255
/* 1690 */ 22, 139, 140, 23, 23, 25, 25, 195, 218, 219,
179370
- /* 1700 */ 84, 85, 218, 219, 36, 228, 154, 155, 156, 157,
179371
- /* 1710 */ 158, 195, 23, 195, 25, 195, 195, 49, 195, 23,
179372
- /* 1720 */ 195, 25, 195, 23, 195, 25, 195, 195, 60, 195,
179373
- /* 1730 */ 195, 195, 195, 146, 195, 183, 218, 219, 118, 195,
179256
+ /* 1700 */ 7, 8, 218, 219, 36, 118, 154, 155, 156, 157,
179257
+ /* 1710 */ 158, 195, 23, 195, 25, 84, 85, 49, 195, 23,
179258
+ /* 1720 */ 195, 25, 195, 23, 195, 25, 195, 23, 60, 25,
179259
+ /* 1730 */ 23, 23, 25, 25, 142, 183, 218, 219, 118, 195,
179374179260
/* 1740 */ 72, 218, 219, 218, 219, 218, 219, 218, 219, 218,
179375
- /* 1750 */ 219, 195, 218, 219, 86, 218, 219, 218, 219, 91,
179376
- /* 1760 */ 19, 20, 154, 22, 156, 23, 258, 25, 195, 101,
179377
- /* 1770 */ 195, 23, 195, 25, 195, 107, 108, 36, 23, 154,
179378
- /* 1780 */ 25, 156, 23, 115, 25, 117, 118, 119, 142, 238,
179379
- /* 1790 */ 122, 218, 219, 218, 219, 218, 219, 23, 322, 25,
179380
- /* 1800 */ 195, 60, 195, 300, 195, 195, 195, 195, 195, 244,
179381
- /* 1810 */ 291, 258, 290, 72, 245, 258, 258, 258, 216, 193,
179382
- /* 1820 */ 274, 247, 154, 155, 156, 157, 158, 86, 300, 296,
179383
- /* 1830 */ 300, 270, 91, 19, 20, 247, 22, 270, 248, 248,
179384
- /* 1840 */ 274, 296, 101, 222, 274, 274, 231, 262, 107, 108,
179385
- /* 1850 */ 36, 183, 221, 221, 227, 221, 115, 262, 117, 118,
179386
- /* 1860 */ 119, 262, 262, 122, 283, 251, 247, 245, 251, 116,
179387
- /* 1870 */ 198, 220, 61, 220, 60, 220, 300, 142, 38, 202,
179388
- /* 1880 */ 202, 297, 202, 152, 151, 22, 72, 286, 43, 297,
179389
- /* 1890 */ 236, 18, 202, 275, 18, 154, 155, 156, 157, 158,
179390
- /* 1900 */ 86, 273, 239, 239, 239, 91, 239, 201, 150, 248,
179391
- /* 1910 */ 275, 275, 273, 202, 248, 101, 201, 236, 236, 159,
179392
- /* 1920 */ 63, 107, 108, 248, 183, 202, 293, 248, 201, 115,
179393
- /* 1930 */ 22, 117, 118, 119, 292, 223, 122, 223, 202, 201,
179394
- /* 1940 */ 220, 202, 220, 65, 201, 220, 229, 22, 127, 220,
179395
- /* 1950 */ 226, 223, 226, 166, 222, 24, 316, 220, 308, 229,
179396
- /* 1960 */ 220, 114, 92, 202, 220, 321, 321, 83, 154, 155,
179397
- /* 1970 */ 156, 157, 158, 0, 1, 2, 285, 285, 5, 223,
179398
- /* 1980 */ 149, 268, 146, 10, 11, 12, 13, 14, 22, 268,
179399
- /* 1990 */ 17, 202, 159, 19, 20, 250, 22, 183, 252, 280,
179400
- /* 2000 */ 251, 148, 252, 30, 25, 32, 147, 204, 13, 196,
179401
- /* 2010 */ 36, 249, 248, 40, 196, 6, 282, 194, 194, 194,
179402
- /* 2020 */ 215, 209, 306, 215, 306, 215, 209, 4, 224, 209,
179403
- /* 2030 */ 215, 224, 216, 3, 60, 216, 22, 215, 122, 19,
179404
- /* 2040 */ 122, 19, 125, 22, 71, 16, 72, 22, 15, 23,
179405
- /* 2050 */ 303, 23, 79, 140, 152, 82, 25, 131, 24, 20,
179406
- /* 2060 */ 145, 16, 143, 1, 143, 131, 131, 62, 131, 37,
179407
- /* 2070 */ 54, 54, 99, 54, 152, 101, 117, 34, 54, 1,
179408
- /* 2080 */ 142, 107, 108, 22, 5, 116, 162, 69, 25, 115,
179409
- /* 2090 */ 41, 117, 118, 119, 142, 24, 122, 116, 126, 132,
179410
- /* 2100 */ 20, 19, 20, 76, 22, 69, 19, 134, 22, 68,
179411
- /* 2110 */ 22, 22, 139, 140, 23, 141, 22, 60, 36, 68,
179412
- /* 2120 */ 24, 28, 22, 68, 23, 150, 34, 37, 154, 155,
179413
- /* 2130 */ 156, 157, 158, 22, 97, 23, 163, 23, 25, 23,
179414
- /* 2140 */ 22, 142, 60, 23, 98, 23, 22, 144, 25, 34,
179415
- /* 2150 */ 76, 34, 117, 34, 72, 34, 89, 183, 94, 34,
179416
- /* 2160 */ 87, 76, 34, 23, 22, 24, 34, 22, 25, 25,
179417
- /* 2170 */ 44, 23, 23, 23, 23, 11, 22, 25, 25, 23,
179418
- /* 2180 */ 22, 143, 22, 101, 23, 143, 23, 22, 22, 107,
179419
- /* 2190 */ 108, 15, 25, 25, 136, 142, 142, 115, 142, 117,
179420
- /* 2200 */ 118, 119, 1, 2, 122, 23, 5, 1, 1, 323,
179421
- /* 2210 */ 323, 10, 11, 12, 13, 14, 323, 323, 17, 323,
179422
- /* 2220 */ 5, 323, 323, 141, 323, 10, 11, 12, 13, 14,
179423
- /* 2230 */ 323, 30, 17, 32, 323, 323, 154, 155, 156, 157,
179424
- /* 2240 */ 158, 40, 323, 323, 323, 30, 323, 32, 323, 323,
179425
- /* 2250 */ 323, 323, 323, 323, 323, 40, 323, 323, 323, 323,
179426
- /* 2260 */ 323, 323, 323, 323, 323, 183, 323, 323, 323, 323,
179427
- /* 2270 */ 323, 323, 71, 323, 323, 323, 323, 323, 323, 323,
179428
- /* 2280 */ 79, 323, 323, 82, 323, 323, 71, 323, 323, 323,
179429
- /* 2290 */ 323, 323, 323, 323, 79, 323, 323, 82, 323, 323,
179430
- /* 2300 */ 99, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179431
- /* 2310 */ 323, 323, 323, 323, 99, 323, 323, 323, 323, 323,
179432
- /* 2320 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179433
- /* 2330 */ 323, 323, 323, 323, 323, 134, 323, 323, 323, 323,
179434
- /* 2340 */ 139, 140, 323, 323, 323, 323, 323, 323, 323, 134,
179435
- /* 2350 */ 323, 323, 323, 323, 139, 140, 323, 323, 323, 323,
179436
- /* 2360 */ 323, 323, 323, 323, 163, 323, 323, 323, 323, 323,
179437
- /* 2370 */ 323, 323, 323, 323, 323, 323, 323, 323, 163, 323,
179438
- /* 2380 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179439
- /* 2390 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179440
- /* 2400 */ 323, 323, 323, 323, 323, 323, 323, 323, 187, 187,
179261
+ /* 1750 */ 219, 195, 195, 146, 86, 98, 23, 195, 25, 91,
179262
+ /* 1760 */ 19, 20, 154, 22, 156, 154, 23, 156, 25, 101,
179263
+ /* 1770 */ 23, 195, 25, 195, 195, 107, 108, 36, 195, 195,
179264
+ /* 1780 */ 195, 195, 228, 115, 195, 117, 118, 119, 195, 195,
179265
+ /* 1790 */ 122, 261, 195, 321, 195, 195, 195, 258, 238, 195,
179266
+ /* 1800 */ 195, 60, 299, 291, 195, 195, 258, 195, 195, 195,
179267
+ /* 1810 */ 290, 244, 216, 72, 245, 193, 258, 258, 299, 258,
179268
+ /* 1820 */ 299, 274, 154, 155, 156, 157, 158, 86, 247, 295,
179269
+ /* 1830 */ 248, 295, 91, 19, 20, 270, 22, 274, 270, 248,
179270
+ /* 1840 */ 274, 222, 101, 227, 274, 221, 231, 221, 107, 108,
179271
+ /* 1850 */ 36, 183, 262, 247, 221, 283, 115, 262, 117, 118,
179272
+ /* 1860 */ 119, 198, 116, 122, 220, 262, 61, 220, 220, 251,
179273
+ /* 1870 */ 247, 142, 251, 245, 60, 202, 299, 202, 38, 262,
179274
+ /* 1880 */ 202, 22, 152, 151, 296, 43, 72, 236, 18, 239,
179275
+ /* 1890 */ 202, 239, 239, 239, 18, 154, 155, 156, 157, 158,
179276
+ /* 1900 */ 86, 150, 201, 248, 275, 91, 248, 273, 236, 248,
179277
+ /* 1910 */ 275, 275, 273, 236, 248, 101, 286, 202, 201, 159,
179278
+ /* 1920 */ 63, 107, 108, 296, 183, 293, 202, 201, 22, 115,
179279
+ /* 1930 */ 202, 117, 118, 119, 292, 223, 122, 201, 65, 202,
179280
+ /* 1940 */ 201, 223, 220, 220, 22, 220, 226, 226, 229, 127,
179281
+ /* 1950 */ 223, 220, 166, 24, 285, 220, 222, 114, 315, 285,
179282
+ /* 1960 */ 220, 202, 220, 307, 92, 320, 320, 229, 154, 155,
179283
+ /* 1970 */ 156, 157, 158, 0, 1, 2, 223, 83, 5, 268,
179284
+ /* 1980 */ 149, 268, 146, 10, 11, 12, 13, 14, 22, 280,
179285
+ /* 1990 */ 17, 202, 159, 19, 20, 251, 22, 183, 282, 148,
179286
+ /* 2000 */ 252, 252, 250, 30, 249, 32, 248, 147, 25, 13,
179287
+ /* 2010 */ 36, 204, 196, 40, 196, 6, 302, 194, 194, 194,
179288
+ /* 2020 */ 209, 215, 209, 215, 215, 215, 224, 224, 216, 209,
179289
+ /* 2030 */ 4, 216, 215, 3, 60, 22, 122, 19, 122, 19,
179290
+ /* 2040 */ 125, 22, 15, 22, 71, 16, 72, 23, 23, 140,
179291
+ /* 2050 */ 305, 152, 79, 25, 131, 82, 143, 20, 16, 305,
179292
+ /* 2060 */ 1, 143, 145, 131, 131, 62, 54, 131, 37, 54,
179293
+ /* 2070 */ 54, 152, 99, 117, 34, 101, 54, 24, 1, 5,
179294
+ /* 2080 */ 22, 107, 108, 116, 76, 25, 162, 41, 142, 115,
179295
+ /* 2090 */ 24, 117, 118, 119, 116, 20, 122, 19, 126, 23,
179296
+ /* 2100 */ 132, 19, 20, 69, 22, 69, 22, 134, 22, 68,
179297
+ /* 2110 */ 22, 22, 139, 140, 60, 141, 68, 24, 36, 28,
179298
+ /* 2120 */ 97, 22, 37, 68, 23, 150, 34, 22, 154, 155,
179299
+ /* 2130 */ 156, 157, 158, 23, 23, 22, 163, 25, 23, 142,
179300
+ /* 2140 */ 23, 98, 60, 23, 22, 144, 25, 76, 34, 117,
179301
+ /* 2150 */ 34, 89, 34, 34, 72, 87, 76, 183, 34, 94,
179302
+ /* 2160 */ 34, 23, 22, 24, 34, 23, 25, 44, 25, 23,
179303
+ /* 2170 */ 23, 23, 22, 22, 25, 11, 143, 25, 143, 23,
179304
+ /* 2180 */ 22, 22, 22, 101, 23, 23, 136, 22, 25, 107,
179305
+ /* 2190 */ 108, 142, 25, 142, 142, 23, 15, 115, 1, 117,
179306
+ /* 2200 */ 118, 119, 1, 2, 122, 1, 5, 322, 322, 322,
179307
+ /* 2210 */ 322, 10, 11, 12, 13, 14, 322, 322, 17, 322,
179308
+ /* 2220 */ 5, 322, 322, 141, 322, 10, 11, 12, 13, 14,
179309
+ /* 2230 */ 322, 30, 17, 32, 322, 322, 154, 155, 156, 157,
179310
+ /* 2240 */ 158, 40, 322, 322, 322, 30, 322, 32, 322, 322,
179311
+ /* 2250 */ 322, 322, 322, 322, 322, 40, 322, 322, 322, 322,
179312
+ /* 2260 */ 322, 322, 322, 322, 322, 183, 322, 322, 322, 322,
179313
+ /* 2270 */ 322, 322, 71, 322, 322, 322, 322, 322, 322, 322,
179314
+ /* 2280 */ 79, 322, 322, 82, 322, 322, 71, 322, 322, 322,
179315
+ /* 2290 */ 322, 322, 322, 322, 79, 322, 322, 82, 322, 322,
179316
+ /* 2300 */ 99, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179317
+ /* 2310 */ 322, 322, 322, 322, 99, 322, 322, 322, 322, 322,
179318
+ /* 2320 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179319
+ /* 2330 */ 322, 322, 322, 322, 322, 134, 322, 322, 322, 322,
179320
+ /* 2340 */ 139, 140, 322, 322, 322, 322, 322, 322, 322, 134,
179321
+ /* 2350 */ 322, 322, 322, 322, 139, 140, 322, 322, 322, 322,
179322
+ /* 2360 */ 322, 322, 322, 322, 163, 322, 322, 322, 322, 322,
179323
+ /* 2370 */ 322, 322, 322, 322, 322, 322, 322, 322, 163, 322,
179324
+ /* 2380 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179325
+ /* 2390 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179326
+ /* 2400 */ 322, 322, 322, 322, 322, 322, 322, 322, 187, 187,
179441179327
/* 2410 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179442179328
/* 2420 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179443179329
/* 2430 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179444179330
/* 2440 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179445179331
/* 2450 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
@@ -179453,186 +179339,184 @@
179453179339
/* 2530 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179454179340
/* 2540 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179455179341
/* 2550 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179456179342
/* 2560 */ 187, 187, 187, 187, 187, 187,
179457179343
};
179458
-#define YY_SHIFT_COUNT (601)
179344
+#define YY_SHIFT_COUNT (599)
179459179345
#define YY_SHIFT_MIN (0)
179460179346
#define YY_SHIFT_MAX (2215)
179461179347
static const unsigned short int yy_shift_ofst[] = {
179462
- /* 0 */ 2201, 1973, 2215, 1552, 1552, 343, 44, 1668, 1741, 1814,
179463
- /* 10 */ 726, 726, 726, 662, 343, 343, 343, 343, 343, 0,
179348
+ /* 0 */ 2201, 1973, 2215, 1552, 1552, 33, 368, 1668, 1741, 1814,
179349
+ /* 10 */ 726, 726, 726, 265, 33, 33, 33, 33, 33, 0,
179464179350
/* 20 */ 0, 216, 1349, 726, 726, 726, 726, 726, 726, 726,
179465179351
/* 30 */ 726, 726, 726, 726, 726, 726, 726, 726, 272, 272,
179466
- /* 40 */ 111, 111, 316, 119, 536, 769, 769, 546, 546, 546,
179467
- /* 50 */ 546, 40, 112, 260, 364, 408, 512, 617, 661, 765,
179352
+ /* 40 */ 111, 111, 316, 365, 516, 867, 867, 916, 916, 916,
179353
+ /* 50 */ 916, 40, 112, 260, 364, 408, 512, 617, 661, 765,
179468179354
/* 60 */ 809, 913, 957, 1061, 1081, 1195, 1215, 1329, 1349, 1349,
179469179355
/* 70 */ 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349,
179470179356
/* 80 */ 1349, 1349, 1349, 1349, 1349, 1349, 1369, 1349, 1473, 1493,
179471179357
/* 90 */ 1493, 473, 1974, 2082, 726, 726, 726, 726, 726, 726,
179472179358
/* 100 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179473179359
/* 110 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179474179360
/* 120 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179475179361
/* 130 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179476
- /* 140 */ 726, 726, 726, 726, 726, 726, 138, 233, 233, 233,
179477
- /* 150 */ 233, 233, 233, 233, 245, 98, 183, 371, 874, 1029,
179478
- /* 160 */ 769, 769, 888, 888, 769, 464, 110, 476, 476, 476,
179479
- /* 170 */ 401, 62, 62, 2379, 2379, 1026, 1026, 1026, 540, 718,
179480
- /* 180 */ 718, 718, 718, 1268, 1268, 610, 371, 276, 1174, 769,
179481
- /* 190 */ 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
179482
- /* 200 */ 769, 769, 769, 769, 769, 769, 769, 769, 534, 956,
179483
- /* 210 */ 956, 769, 61, 1135, 1135, 831, 1278, 1278, 831, 831,
179484
- /* 220 */ 360, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 641, 789,
179485
- /* 230 */ 789, 721, 374, 732, 466, 782, 494, 829, 833, 769,
179486
- /* 240 */ 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
179487
- /* 250 */ 769, 769, 769, 677, 769, 769, 769, 769, 769, 769,
179488
- /* 260 */ 769, 769, 769, 769, 769, 769, 370, 370, 370, 769,
179489
- /* 270 */ 769, 769, 1062, 769, 769, 769, 1176, 1134, 769, 1190,
179490
- /* 280 */ 769, 769, 769, 769, 769, 769, 769, 769, 485, 1149,
179491
- /* 290 */ 13, 954, 336, 336, 336, 336, 262, 954, 954, 1147,
179492
- /* 300 */ 373, 1342, 430, 1434, 1294, 1194, 1073, 1194, 1311, 103,
179493
- /* 310 */ 1294, 1294, 103, 1294, 1073, 1311, 663, 1212, 1047, 1001,
179494
- /* 320 */ 1001, 1001, 1510, 1510, 1510, 1510, 1265, 1265, 1270, 1426,
179495
- /* 330 */ 1363, 1479, 1753, 1811, 1753, 1753, 1735, 1735, 1840, 1840,
179496
- /* 340 */ 1735, 1731, 1733, 1863, 1845, 1873, 1873, 1873, 1873, 1735,
179497
- /* 350 */ 1876, 1758, 1733, 1733, 1758, 1863, 1845, 1758, 1845, 1758,
179498
- /* 360 */ 1735, 1876, 1760, 1857, 1735, 1876, 1908, 1735, 1876, 1735,
179499
- /* 370 */ 1876, 1908, 1753, 1753, 1753, 1878, 1925, 1925, 1908, 1753,
179500
- /* 380 */ 1821, 1753, 1878, 1753, 1753, 1787, 1931, 1847, 1847, 1908,
179501
- /* 390 */ 1735, 1870, 1870, 1884, 1884, 1831, 1836, 1966, 1735, 1833,
179502
- /* 400 */ 1831, 1853, 1859, 1758, 1979, 1995, 1995, 2009, 2009, 2009,
179362
+ /* 140 */ 726, 726, 726, 726, 726, 726, 138, 232, 232, 232,
179363
+ /* 150 */ 232, 232, 232, 232, 188, 99, 242, 718, 416, 1159,
179364
+ /* 160 */ 867, 867, 940, 940, 867, 1103, 417, 574, 574, 574,
179365
+ /* 170 */ 611, 139, 139, 2379, 2379, 1026, 1026, 1026, 536, 466,
179366
+ /* 180 */ 466, 466, 466, 1017, 1017, 849, 718, 971, 1060, 867,
179367
+ /* 190 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867,
179368
+ /* 200 */ 867, 867, 867, 867, 867, 867, 867, 867, 261, 712,
179369
+ /* 210 */ 712, 867, 108, 1142, 1142, 977, 1108, 1108, 977, 977,
179370
+ /* 220 */ 1243, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 641, 789,
179371
+ /* 230 */ 789, 635, 366, 721, 673, 782, 494, 787, 829, 867,
179372
+ /* 240 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867,
179373
+ /* 250 */ 959, 867, 867, 867, 867, 867, 867, 867, 867, 867,
179374
+ /* 260 */ 867, 867, 867, 867, 867, 820, 820, 820, 867, 867,
179375
+ /* 270 */ 867, 1136, 867, 867, 867, 1119, 1007, 867, 1169, 867,
179376
+ /* 280 */ 867, 867, 867, 867, 867, 867, 867, 1225, 1153, 869,
179377
+ /* 290 */ 196, 618, 618, 618, 618, 1491, 196, 196, 91, 339,
179378
+ /* 300 */ 1326, 1386, 383, 1163, 1364, 1426, 1364, 1538, 903, 1163,
179379
+ /* 310 */ 1163, 903, 1163, 1426, 1538, 1018, 1535, 1241, 1528, 1528,
179380
+ /* 320 */ 1528, 1394, 1394, 1394, 1394, 762, 762, 1403, 1466, 1475,
179381
+ /* 330 */ 1551, 1746, 1805, 1746, 1746, 1729, 1729, 1840, 1840, 1729,
179382
+ /* 340 */ 1730, 1732, 1859, 1842, 1870, 1870, 1870, 1870, 1729, 1876,
179383
+ /* 350 */ 1751, 1732, 1732, 1751, 1859, 1842, 1751, 1842, 1751, 1729,
179384
+ /* 360 */ 1876, 1760, 1857, 1729, 1876, 1906, 1729, 1876, 1729, 1876,
179385
+ /* 370 */ 1906, 1746, 1746, 1746, 1873, 1922, 1922, 1906, 1746, 1822,
179386
+ /* 380 */ 1746, 1873, 1746, 1746, 1786, 1929, 1843, 1843, 1906, 1729,
179387
+ /* 390 */ 1872, 1872, 1894, 1894, 1831, 1836, 1966, 1729, 1833, 1831,
179388
+ /* 400 */ 1851, 1860, 1751, 1983, 1996, 1996, 2009, 2009, 2009, 2379,
179503179389
/* 410 */ 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379,
179504
- /* 420 */ 2379, 2379, 2379, 2379, 2379, 856, 1121, 830, 1080, 1471,
179505
- /* 430 */ 911, 1261, 1387, 1542, 605, 1462, 1474, 650, 1495, 1586,
179506
- /* 440 */ 1386, 1598, 1604, 1638, 1670, 1671, 1689, 1442, 1432, 1676,
179507
- /* 450 */ 853, 1696, 1587, 1273, 1446, 1700, 1742, 1616, 1748, 1755,
179508
- /* 460 */ 1608, 1625, 1759, 1774, 1620, 1646, 2023, 2030, 2014, 1916,
179509
- /* 470 */ 2020, 1918, 2022, 2021, 2025, 1917, 2033, 2029, 2026, 2028,
179510
- /* 480 */ 1913, 1902, 1926, 2031, 2031, 2034, 1919, 2039, 1915, 2045,
179511
- /* 490 */ 2062, 1921, 1934, 2031, 1935, 2005, 2032, 2031, 1922, 2016,
179512
- /* 500 */ 2017, 2019, 2024, 1937, 1959, 2043, 1938, 2078, 2079, 2061,
179513
- /* 510 */ 1969, 1924, 2018, 2063, 2036, 2027, 2049, 1952, 1981, 2071,
179514
- /* 520 */ 2080, 2087, 1967, 1972, 2086, 2041, 2088, 2089, 2091, 2094,
179515
- /* 530 */ 2051, 2057, 2096, 2037, 2093, 2100, 2055, 2090, 2101, 2092,
179516
- /* 540 */ 1975, 2111, 2112, 2114, 2113, 2116, 2118, 2046, 1999, 2120,
179517
- /* 550 */ 2122, 2035, 2115, 2124, 2003, 2123, 2117, 2119, 2121, 2125,
179518
- /* 560 */ 2067, 2074, 2073, 2126, 2085, 2064, 2128, 2140, 2142, 2141,
179519
- /* 570 */ 2143, 2144, 2132, 2038, 2042, 2148, 2123, 2149, 2150, 2151,
179520
- /* 580 */ 2145, 2152, 2153, 2156, 2154, 2164, 2158, 2160, 2161, 2163,
179521
- /* 590 */ 2165, 2166, 2167, 2058, 2053, 2054, 2056, 2168, 2182, 2176,
179522
- /* 600 */ 2206, 2207,
179390
+ /* 420 */ 2379, 2379, 2379, 2379, 136, 1063, 1196, 530, 636, 1274,
179391
+ /* 430 */ 1300, 1443, 1598, 1495, 1479, 967, 1083, 1602, 463, 1625,
179392
+ /* 440 */ 1638, 1670, 1541, 1671, 1689, 1696, 1277, 1432, 1693, 808,
179393
+ /* 450 */ 1700, 1607, 1657, 1587, 1704, 1707, 1631, 1708, 1733, 1608,
179394
+ /* 460 */ 1611, 1743, 1747, 1620, 1592, 2026, 2030, 2013, 1914, 2018,
179395
+ /* 470 */ 1916, 2020, 2019, 2021, 1915, 2027, 2029, 2024, 2025, 1909,
179396
+ /* 480 */ 1899, 1923, 2028, 2028, 1913, 2037, 1917, 2042, 2059, 1918,
179397
+ /* 490 */ 1932, 2028, 1933, 2003, 2031, 2028, 1919, 2012, 2015, 2016,
179398
+ /* 500 */ 2022, 1936, 1956, 2040, 2053, 2077, 2074, 2058, 1967, 1924,
179399
+ /* 510 */ 2034, 2060, 2036, 2008, 2046, 1946, 1978, 2066, 2075, 2078,
179400
+ /* 520 */ 1968, 1972, 2084, 2041, 2086, 2088, 2076, 2089, 2048, 2054,
179401
+ /* 530 */ 2093, 2023, 2091, 2099, 2055, 2085, 2101, 2092, 1975, 2105,
179402
+ /* 540 */ 2110, 2111, 2112, 2115, 2113, 2043, 1997, 2117, 2120, 2032,
179403
+ /* 550 */ 2114, 2122, 2001, 2121, 2116, 2118, 2119, 2124, 2062, 2071,
179404
+ /* 560 */ 2068, 2123, 2080, 2065, 2126, 2138, 2140, 2139, 2141, 2143,
179405
+ /* 570 */ 2130, 2033, 2035, 2142, 2121, 2146, 2147, 2148, 2150, 2149,
179406
+ /* 580 */ 2152, 2156, 2151, 2164, 2158, 2159, 2161, 2162, 2160, 2165,
179407
+ /* 590 */ 2163, 2050, 2049, 2051, 2052, 2167, 2172, 2181, 2197, 2204,
179523179408
};
179524
-#define YY_REDUCE_COUNT (424)
179525
-#define YY_REDUCE_MIN (-277)
179409
+#define YY_REDUCE_COUNT (423)
179410
+#define YY_REDUCE_MIN (-303)
179526179411
#define YY_REDUCE_MAX (1825)
179527179412
static const short yy_reduce_ofst[] = {
179528
- /* 0 */ -67, 345, 787, -178, -181, 188, 435, -185, 166, -183,
179529
- /* 10 */ -78, 284, 384, -174, 352, 391, 493, 496, 535, -208,
179530
- /* 20 */ -23, -277, -2, 205, 305, 310, 707, 764, -189, 67,
179531
- /* 30 */ 839, 735, 835, 860, 902, 354, 958, 960, -187, 946,
179532
- /* 40 */ 86, 616, 843, 587, 792, 900, 901, -238, 440, -238,
179533
- /* 50 */ 440, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179534
- /* 60 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179535
- /* 70 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179536
- /* 80 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179537
- /* 90 */ -255, 864, 985, 1094, 1096, 1098, 1116, 1136, 1138, 1141,
179538
- /* 100 */ 1144, 1146, 1148, 1151, 1249, 1251, 1269, 1271, 1290, 1296,
179539
- /* 110 */ 1315, 1318, 1337, 1340, 1344, 1371, 1373, 1375, 1400, 1413,
179540
- /* 120 */ 1418, 1420, 1422, 1425, 1427, 1433, 1438, 1447, 1454, 1459,
179541
- /* 130 */ 1463, 1467, 1480, 1484, 1518, 1523, 1525, 1527, 1529, 1531,
179542
- /* 140 */ 1534, 1537, 1539, 1573, 1575, 1577, -255, -255, -255, -255,
179543
- /* 150 */ -255, -255, -255, -255, -255, -255, -255, 197, 162, -220,
179544
- /* 160 */ -76, -130, 121, 725, 844, -255, -116, -214, 417, 484,
179545
- /* 170 */ 441, -255, -255, -255, -255, 562, 562, 562, 702, -57,
179546
- /* 180 */ 560, 703, 836, -122, 556, -35, 301, 521, 521, -37,
179547
- /* 190 */ -184, 729, 959, 290, 292, 394, 409, 215, 412, 357,
179548
- /* 200 */ 495, 808, 590, 961, 652, 403, 928, 1016, 672, -11,
179549
- /* 210 */ 69, -53, 1046, 906, 909, 731, 490, 814, 1020, 1064,
179550
- /* 220 */ 124, 984, -237, 1101, 1240, 1250, 1078, 1254, -33, -18,
179551
- /* 230 */ 9, 85, 99, 248, 309, 332, 736, 804, 842, 932,
179552
- /* 240 */ 947, 988, 1010, 1157, 1166, 1220, 1235, 1255, 1276, 1324,
179553
- /* 250 */ 1357, 1362, 1366, 275, 1380, 1419, 1435, 1440, 1452, 1455,
179554
- /* 260 */ 1469, 1481, 1494, 1502, 1516, 1520, 1068, 1237, 1477, 1521,
179555
- /* 270 */ 1532, 1535, 996, 1536, 1544, 1556, 1508, 1476, 1579, 1551,
179556
- /* 280 */ 1605, 309, 1607, 1609, 1610, 1611, 1612, 1613, 1503, 1519,
179557
- /* 290 */ 1522, 1565, 1553, 1557, 1558, 1559, 996, 1565, 1565, 1569,
179558
- /* 300 */ 1602, 1626, 1528, 1530, 1546, 1561, 1574, 1567, 1533, 1590,
179559
- /* 310 */ 1566, 1570, 1591, 1571, 1588, 1545, 1621, 1615, 1627, 1631,
179560
- /* 320 */ 1632, 1634, 1585, 1595, 1599, 1600, 1614, 1617, 1581, 1619,
179561
- /* 330 */ 1622, 1672, 1651, 1576, 1653, 1655, 1677, 1678, 1584, 1592,
179562
- /* 340 */ 1680, 1601, 1618, 1628, 1654, 1663, 1664, 1665, 1667, 1690,
179563
- /* 350 */ 1706, 1661, 1635, 1636, 1666, 1639, 1681, 1675, 1682, 1679,
179564
- /* 360 */ 1711, 1715, 1633, 1642, 1723, 1727, 1712, 1736, 1738, 1739,
179565
- /* 370 */ 1743, 1714, 1720, 1722, 1725, 1717, 1724, 1726, 1728, 1729,
179566
- /* 380 */ 1732, 1737, 1730, 1740, 1744, 1640, 1650, 1691, 1692, 1756,
179567
- /* 390 */ 1761, 1644, 1645, 1713, 1721, 1746, 1749, 1719, 1789, 1734,
179568
- /* 400 */ 1750, 1745, 1762, 1764, 1803, 1813, 1818, 1823, 1824, 1825,
179569
- /* 410 */ 1716, 1718, 1747, 1812, 1805, 1808, 1810, 1815, 1817, 1804,
179570
- /* 420 */ 1807, 1816, 1819, 1822, 1820,
179413
+ /* 0 */ -67, 345, -64, -178, -181, 143, 435, -78, -183, 163,
179414
+ /* 10 */ -185, 284, 384, -174, 189, 352, 440, 444, 493, -23,
179415
+ /* 20 */ 227, -277, -1, 305, 561, 755, 759, 764, -189, 839,
179416
+ /* 30 */ 857, 354, 484, 859, 631, 67, 734, 780, -187, 616,
179417
+ /* 40 */ 581, 730, 891, 449, 588, 795, 836, -238, 287, -238,
179418
+ /* 50 */ 287, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179419
+ /* 60 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179420
+ /* 70 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179421
+ /* 80 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179422
+ /* 90 */ -256, 205, 582, 715, 958, 985, 1003, 1005, 1010, 1012,
179423
+ /* 100 */ 1059, 1066, 1092, 1094, 1097, 1122, 1137, 1141, 1143, 1147,
179424
+ /* 110 */ 1151, 1172, 1249, 1251, 1269, 1271, 1276, 1290, 1316, 1318,
179425
+ /* 120 */ 1337, 1371, 1373, 1375, 1400, 1413, 1418, 1420, 1422, 1425,
179426
+ /* 130 */ 1427, 1433, 1438, 1447, 1454, 1459, 1463, 1467, 1480, 1484,
179427
+ /* 140 */ 1518, 1523, 1525, 1527, 1529, 1531, -256, -256, -256, -256,
179428
+ /* 150 */ -256, -256, -256, -256, -256, -256, -256, 155, 210, -220,
179429
+ /* 160 */ 86, -130, 943, 996, 402, -256, -113, 981, 1095, 1135,
179430
+ /* 170 */ 395, -256, -256, -256, -256, 568, 568, 568, -4, -153,
179431
+ /* 180 */ -133, 259, 306, -166, 523, -303, -126, 503, 503, -37,
179432
+ /* 190 */ -149, 164, 690, 292, 412, 492, 651, 784, 332, 786,
179433
+ /* 200 */ 841, 1149, 833, 1236, 792, 162, 796, 1253, 777, 288,
179434
+ /* 210 */ 381, 380, 709, 487, 1027, 972, 1030, 1084, 991, 1120,
179435
+ /* 220 */ -152, 1062, 692, 1240, 1247, 1250, 1239, 1306, -207, -194,
179436
+ /* 230 */ 57, 180, 74, 315, 355, 376, 452, 488, 630, 693,
179437
+ /* 240 */ 965, 1004, 1025, 1099, 1154, 1289, 1305, 1310, 1469, 1489,
179438
+ /* 250 */ 984, 1494, 1502, 1516, 1544, 1556, 1557, 1562, 1576, 1578,
179439
+ /* 260 */ 1579, 1583, 1584, 1585, 1586, 1217, 1440, 1554, 1589, 1593,
179440
+ /* 270 */ 1594, 1530, 1597, 1599, 1600, 1539, 1472, 1601, 1560, 1604,
179441
+ /* 280 */ 355, 1605, 1609, 1610, 1612, 1613, 1614, 1503, 1512, 1520,
179442
+ /* 290 */ 1567, 1548, 1558, 1559, 1561, 1530, 1567, 1567, 1569, 1596,
179443
+ /* 300 */ 1622, 1519, 1521, 1547, 1565, 1581, 1568, 1534, 1582, 1563,
179444
+ /* 310 */ 1566, 1591, 1570, 1606, 1536, 1619, 1615, 1616, 1624, 1626,
179445
+ /* 320 */ 1633, 1590, 1595, 1603, 1617, 1618, 1621, 1572, 1623, 1628,
179446
+ /* 330 */ 1663, 1644, 1577, 1647, 1648, 1673, 1675, 1588, 1627, 1678,
179447
+ /* 340 */ 1630, 1629, 1634, 1651, 1650, 1652, 1653, 1654, 1688, 1701,
179448
+ /* 350 */ 1655, 1635, 1636, 1658, 1639, 1672, 1661, 1677, 1666, 1715,
179449
+ /* 360 */ 1717, 1632, 1642, 1724, 1726, 1712, 1728, 1736, 1737, 1739,
179450
+ /* 370 */ 1718, 1722, 1723, 1725, 1719, 1720, 1721, 1727, 1731, 1734,
179451
+ /* 380 */ 1735, 1738, 1740, 1742, 1643, 1656, 1669, 1674, 1753, 1759,
179452
+ /* 390 */ 1645, 1646, 1711, 1713, 1748, 1744, 1709, 1789, 1716, 1749,
179453
+ /* 400 */ 1752, 1755, 1758, 1807, 1816, 1818, 1823, 1824, 1825, 1745,
179454
+ /* 410 */ 1754, 1714, 1811, 1806, 1808, 1809, 1810, 1813, 1802, 1803,
179455
+ /* 420 */ 1812, 1815, 1817, 1820,
179571179456
};
179572179457
static const YYACTIONTYPE yy_default[] = {
179573
- /* 0 */ 1698, 1698, 1698, 1521, 1284, 1397, 1284, 1284, 1284, 1284,
179574
- /* 10 */ 1521, 1521, 1521, 1284, 1284, 1284, 1284, 1284, 1284, 1427,
179575
- /* 20 */ 1427, 1574, 1317, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179576
- /* 30 */ 1284, 1284, 1284, 1284, 1284, 1520, 1284, 1284, 1284, 1284,
179577
- /* 40 */ 1613, 1613, 1284, 1284, 1284, 1284, 1284, 1598, 1597, 1284,
179578
- /* 50 */ 1284, 1284, 1436, 1284, 1284, 1284, 1443, 1284, 1284, 1284,
179579
- /* 60 */ 1284, 1284, 1522, 1523, 1284, 1284, 1284, 1284, 1573, 1575,
179580
- /* 70 */ 1538, 1450, 1449, 1448, 1447, 1556, 1415, 1441, 1434, 1438,
179581
- /* 80 */ 1517, 1518, 1516, 1676, 1523, 1522, 1284, 1437, 1485, 1501,
179582
- /* 90 */ 1484, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179583
- /* 100 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179584
- /* 110 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179585
- /* 120 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179586
- /* 130 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179587
- /* 140 */ 1284, 1284, 1284, 1284, 1284, 1284, 1493, 1500, 1499, 1498,
179588
- /* 150 */ 1507, 1497, 1494, 1487, 1486, 1488, 1489, 1308, 1305, 1359,
179589
- /* 160 */ 1284, 1284, 1284, 1284, 1284, 1490, 1317, 1478, 1477, 1476,
179590
- /* 170 */ 1284, 1504, 1491, 1503, 1502, 1581, 1650, 1649, 1539, 1284,
179591
- /* 180 */ 1284, 1284, 1284, 1284, 1284, 1613, 1284, 1284, 1284, 1284,
179592
- /* 190 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179593
- /* 200 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1417, 1613,
179594
- /* 210 */ 1613, 1284, 1317, 1613, 1613, 1313, 1418, 1418, 1313, 1313,
179595
- /* 220 */ 1421, 1593, 1388, 1388, 1388, 1388, 1397, 1388, 1284, 1284,
179596
- /* 230 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179597
- /* 240 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1578, 1576, 1284,
179598
- /* 250 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179599
- /* 260 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179600
- /* 270 */ 1284, 1284, 1284, 1284, 1284, 1284, 1393, 1284, 1284, 1284,
179601
- /* 280 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1643, 1690, 1284,
179602
- /* 290 */ 1551, 1373, 1393, 1393, 1393, 1393, 1395, 1374, 1372, 1387,
179603
- /* 300 */ 1318, 1291, 1690, 1690, 1453, 1442, 1394, 1442, 1687, 1440,
179604
- /* 310 */ 1453, 1453, 1440, 1453, 1394, 1687, 1334, 1665, 1329, 1427,
179605
- /* 320 */ 1427, 1427, 1417, 1417, 1417, 1417, 1421, 1421, 1519, 1394,
179606
- /* 330 */ 1387, 1284, 1360, 1690, 1360, 1360, 1403, 1403, 1689, 1689,
179607
- /* 340 */ 1403, 1539, 1673, 1462, 1362, 1368, 1368, 1368, 1368, 1403,
179608
- /* 350 */ 1302, 1440, 1673, 1673, 1440, 1462, 1362, 1440, 1362, 1440,
179609
- /* 360 */ 1403, 1302, 1555, 1684, 1403, 1302, 1529, 1403, 1302, 1403,
179610
- /* 370 */ 1302, 1529, 1360, 1360, 1360, 1349, 1284, 1284, 1529, 1360,
179611
- /* 380 */ 1334, 1360, 1349, 1360, 1360, 1631, 1284, 1533, 1533, 1529,
179612
- /* 390 */ 1403, 1623, 1623, 1430, 1430, 1435, 1421, 1524, 1403, 1284,
179613
- /* 400 */ 1435, 1433, 1431, 1440, 1352, 1646, 1646, 1642, 1642, 1642,
179614
- /* 410 */ 1695, 1695, 1593, 1658, 1317, 1317, 1317, 1317, 1658, 1336,
179615
- /* 420 */ 1336, 1318, 1318, 1317, 1658, 1284, 1284, 1284, 1284, 1284,
179616
- /* 430 */ 1284, 1284, 1653, 1284, 1284, 1540, 1407, 1284, 1284, 1284,
179617
- /* 440 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179618
- /* 450 */ 1284, 1284, 1284, 1599, 1284, 1284, 1284, 1284, 1284, 1284,
179619
- /* 460 */ 1284, 1284, 1284, 1284, 1284, 1467, 1284, 1287, 1590, 1284,
179620
- /* 470 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179621
- /* 480 */ 1284, 1284, 1284, 1444, 1445, 1408, 1284, 1284, 1284, 1284,
179622
- /* 490 */ 1284, 1284, 1284, 1459, 1284, 1284, 1284, 1454, 1284, 1284,
179623
- /* 500 */ 1284, 1284, 1284, 1284, 1284, 1284, 1686, 1284, 1284, 1284,
179624
- /* 510 */ 1284, 1284, 1284, 1554, 1553, 1284, 1284, 1405, 1284, 1284,
179625
- /* 520 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179626
- /* 530 */ 1284, 1332, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179627
- /* 540 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179628
- /* 550 */ 1284, 1284, 1284, 1284, 1284, 1432, 1284, 1284, 1284, 1284,
179629
- /* 560 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179630
- /* 570 */ 1628, 1422, 1284, 1284, 1284, 1284, 1677, 1284, 1284, 1284,
179631
- /* 580 */ 1284, 1382, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179632
- /* 590 */ 1284, 1284, 1669, 1376, 1468, 1284, 1471, 1306, 1284, 1296,
179633
- /* 600 */ 1284, 1284,
179458
+ /* 0 */ 1691, 1691, 1691, 1516, 1279, 1392, 1279, 1279, 1279, 1279,
179459
+ /* 10 */ 1516, 1516, 1516, 1279, 1279, 1279, 1279, 1279, 1279, 1422,
179460
+ /* 20 */ 1422, 1568, 1312, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179461
+ /* 30 */ 1279, 1279, 1279, 1279, 1279, 1515, 1279, 1279, 1279, 1279,
179462
+ /* 40 */ 1607, 1607, 1279, 1279, 1279, 1279, 1279, 1592, 1591, 1279,
179463
+ /* 50 */ 1279, 1279, 1431, 1279, 1279, 1279, 1438, 1279, 1279, 1279,
179464
+ /* 60 */ 1279, 1279, 1517, 1518, 1279, 1279, 1279, 1279, 1567, 1569,
179465
+ /* 70 */ 1533, 1445, 1444, 1443, 1442, 1551, 1410, 1436, 1429, 1433,
179466
+ /* 80 */ 1512, 1513, 1511, 1670, 1518, 1517, 1279, 1432, 1480, 1496,
179467
+ /* 90 */ 1479, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179468
+ /* 100 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179469
+ /* 110 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179470
+ /* 120 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179471
+ /* 130 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179472
+ /* 140 */ 1279, 1279, 1279, 1279, 1279, 1279, 1488, 1495, 1494, 1493,
179473
+ /* 150 */ 1502, 1492, 1489, 1482, 1481, 1483, 1484, 1303, 1300, 1354,
179474
+ /* 160 */ 1279, 1279, 1279, 1279, 1279, 1485, 1312, 1473, 1472, 1471,
179475
+ /* 170 */ 1279, 1499, 1486, 1498, 1497, 1575, 1644, 1643, 1534, 1279,
179476
+ /* 180 */ 1279, 1279, 1279, 1279, 1279, 1607, 1279, 1279, 1279, 1279,
179477
+ /* 190 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179478
+ /* 200 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1412, 1607,
179479
+ /* 210 */ 1607, 1279, 1312, 1607, 1607, 1308, 1413, 1413, 1308, 1308,
179480
+ /* 220 */ 1416, 1587, 1383, 1383, 1383, 1383, 1392, 1383, 1279, 1279,
179481
+ /* 230 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179482
+ /* 240 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1572, 1570, 1279,
179483
+ /* 250 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179484
+ /* 260 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179485
+ /* 270 */ 1279, 1279, 1279, 1279, 1279, 1388, 1279, 1279, 1279, 1279,
179486
+ /* 280 */ 1279, 1279, 1279, 1279, 1279, 1279, 1637, 1683, 1279, 1546,
179487
+ /* 290 */ 1368, 1388, 1388, 1388, 1388, 1390, 1369, 1367, 1382, 1313,
179488
+ /* 300 */ 1286, 1683, 1683, 1448, 1437, 1389, 1437, 1680, 1435, 1448,
179489
+ /* 310 */ 1448, 1435, 1448, 1389, 1680, 1329, 1659, 1324, 1422, 1422,
179490
+ /* 320 */ 1422, 1412, 1412, 1412, 1412, 1416, 1416, 1514, 1389, 1382,
179491
+ /* 330 */ 1279, 1355, 1683, 1355, 1355, 1398, 1398, 1682, 1682, 1398,
179492
+ /* 340 */ 1534, 1667, 1457, 1357, 1363, 1363, 1363, 1363, 1398, 1297,
179493
+ /* 350 */ 1435, 1667, 1667, 1435, 1457, 1357, 1435, 1357, 1435, 1398,
179494
+ /* 360 */ 1297, 1550, 1678, 1398, 1297, 1524, 1398, 1297, 1398, 1297,
179495
+ /* 370 */ 1524, 1355, 1355, 1355, 1344, 1279, 1279, 1524, 1355, 1329,
179496
+ /* 380 */ 1355, 1344, 1355, 1355, 1625, 1279, 1528, 1528, 1524, 1398,
179497
+ /* 390 */ 1617, 1617, 1425, 1425, 1430, 1416, 1519, 1398, 1279, 1430,
179498
+ /* 400 */ 1428, 1426, 1435, 1347, 1640, 1640, 1636, 1636, 1636, 1688,
179499
+ /* 410 */ 1688, 1587, 1652, 1312, 1312, 1312, 1312, 1652, 1331, 1331,
179500
+ /* 420 */ 1313, 1313, 1312, 1652, 1279, 1279, 1279, 1279, 1279, 1279,
179501
+ /* 430 */ 1279, 1647, 1279, 1279, 1535, 1279, 1279, 1279, 1279, 1279,
179502
+ /* 440 */ 1279, 1279, 1402, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179503
+ /* 450 */ 1279, 1279, 1593, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179504
+ /* 460 */ 1279, 1279, 1279, 1279, 1462, 1279, 1282, 1584, 1279, 1279,
179505
+ /* 470 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179506
+ /* 480 */ 1279, 1279, 1439, 1440, 1279, 1279, 1279, 1279, 1279, 1279,
179507
+ /* 490 */ 1279, 1454, 1279, 1279, 1279, 1449, 1279, 1279, 1279, 1279,
179508
+ /* 500 */ 1279, 1279, 1279, 1279, 1403, 1279, 1279, 1279, 1279, 1279,
179509
+ /* 510 */ 1279, 1549, 1548, 1279, 1279, 1400, 1279, 1279, 1279, 1279,
179510
+ /* 520 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1327,
179511
+ /* 530 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179512
+ /* 540 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179513
+ /* 550 */ 1279, 1279, 1279, 1427, 1279, 1279, 1279, 1279, 1279, 1279,
179514
+ /* 560 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1622, 1417,
179515
+ /* 570 */ 1279, 1279, 1279, 1279, 1671, 1279, 1279, 1279, 1279, 1377,
179516
+ /* 580 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179517
+ /* 590 */ 1663, 1371, 1463, 1279, 1466, 1301, 1279, 1291, 1279, 1279,
179634179518
};
179635179519
/********** End of lemon-generated parsing tables *****************************/
179636179520
179637179521
/* The next table maps tokens (terminal symbols) into fallback tokens.
179638179522
** If a construct like the following:
@@ -180213,38 +180097,37 @@
180213180097
/* 290 */ "trigger_time",
180214180098
/* 291 */ "trigger_event",
180215180099
/* 292 */ "foreach_clause",
180216180100
/* 293 */ "when_clause",
180217180101
/* 294 */ "trigger_cmd",
180218
- /* 295 */ "trnm",
180219
- /* 296 */ "tridxby",
180220
- /* 297 */ "database_kw_opt",
180221
- /* 298 */ "key_opt",
180222
- /* 299 */ "alter_add",
180223
- /* 300 */ "kwcolumn_opt",
180224
- /* 301 */ "create_vtab",
180225
- /* 302 */ "vtabarglist",
180226
- /* 303 */ "vtabarg",
180227
- /* 304 */ "vtabargtoken",
180228
- /* 305 */ "lp",
180229
- /* 306 */ "anylist",
180230
- /* 307 */ "wqitem",
180231
- /* 308 */ "wqas",
180232
- /* 309 */ "withnm",
180233
- /* 310 */ "windowdefn_list",
180234
- /* 311 */ "windowdefn",
180235
- /* 312 */ "window",
180236
- /* 313 */ "frame_opt",
180237
- /* 314 */ "part_opt",
180238
- /* 315 */ "filter_clause",
180239
- /* 316 */ "over_clause",
180240
- /* 317 */ "range_or_rows",
180241
- /* 318 */ "frame_bound",
180242
- /* 319 */ "frame_bound_s",
180243
- /* 320 */ "frame_bound_e",
180244
- /* 321 */ "frame_exclude_opt",
180245
- /* 322 */ "frame_exclude",
180102
+ /* 295 */ "tridxby",
180103
+ /* 296 */ "database_kw_opt",
180104
+ /* 297 */ "key_opt",
180105
+ /* 298 */ "alter_add",
180106
+ /* 299 */ "kwcolumn_opt",
180107
+ /* 300 */ "create_vtab",
180108
+ /* 301 */ "vtabarglist",
180109
+ /* 302 */ "vtabarg",
180110
+ /* 303 */ "vtabargtoken",
180111
+ /* 304 */ "lp",
180112
+ /* 305 */ "anylist",
180113
+ /* 306 */ "wqitem",
180114
+ /* 307 */ "wqas",
180115
+ /* 308 */ "withnm",
180116
+ /* 309 */ "windowdefn_list",
180117
+ /* 310 */ "windowdefn",
180118
+ /* 311 */ "window",
180119
+ /* 312 */ "frame_opt",
180120
+ /* 313 */ "part_opt",
180121
+ /* 314 */ "filter_clause",
180122
+ /* 315 */ "over_clause",
180123
+ /* 316 */ "range_or_rows",
180124
+ /* 317 */ "frame_bound",
180125
+ /* 318 */ "frame_bound_s",
180126
+ /* 319 */ "frame_bound_e",
180127
+ /* 320 */ "frame_exclude_opt",
180128
+ /* 321 */ "frame_exclude",
180246180129
};
180247180130
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
180248180131
180249180132
#ifndef NDEBUG
180250180133
/* For tracing reduce actions, the names of all rules are required.
@@ -180370,12 +180253,12 @@
180370180253
/* 117 */ "dbnm ::= DOT nm",
180371180254
/* 118 */ "fullname ::= nm",
180372180255
/* 119 */ "fullname ::= nm DOT nm",
180373180256
/* 120 */ "xfullname ::= nm",
180374180257
/* 121 */ "xfullname ::= nm DOT nm",
180375
- /* 122 */ "xfullname ::= nm DOT nm AS nm",
180376
- /* 123 */ "xfullname ::= nm AS nm",
180258
+ /* 122 */ "xfullname ::= nm AS nm",
180259
+ /* 123 */ "xfullname ::= nm DOT nm AS nm",
180377180260
/* 124 */ "joinop ::= COMMA|JOIN",
180378180261
/* 125 */ "joinop ::= JOIN_KW JOIN",
180379180262
/* 126 */ "joinop ::= JOIN_KW nm JOIN",
180380180263
/* 127 */ "joinop ::= JOIN_KW nm nm JOIN",
180381180264
/* 128 */ "on_using ::= ON expr",
@@ -180520,152 +180403,150 @@
180520180403
/* 267 */ "trigger_event ::= UPDATE OF idlist",
180521180404
/* 268 */ "when_clause ::=",
180522180405
/* 269 */ "when_clause ::= WHEN expr",
180523180406
/* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
180524180407
/* 271 */ "trigger_cmd_list ::= trigger_cmd SEMI",
180525
- /* 272 */ "trnm ::= nm DOT nm",
180526
- /* 273 */ "tridxby ::= INDEXED BY nm",
180527
- /* 274 */ "tridxby ::= NOT INDEXED",
180528
- /* 275 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
180529
- /* 276 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
180530
- /* 277 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
180531
- /* 278 */ "trigger_cmd ::= scanpt select scanpt",
180532
- /* 279 */ "expr ::= RAISE LP IGNORE RP",
180533
- /* 280 */ "expr ::= RAISE LP raisetype COMMA expr RP",
180534
- /* 281 */ "raisetype ::= ROLLBACK",
180535
- /* 282 */ "raisetype ::= ABORT",
180536
- /* 283 */ "raisetype ::= FAIL",
180537
- /* 284 */ "cmd ::= DROP TRIGGER ifexists fullname",
180538
- /* 285 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
180539
- /* 286 */ "cmd ::= DETACH database_kw_opt expr",
180540
- /* 287 */ "key_opt ::=",
180541
- /* 288 */ "key_opt ::= KEY expr",
180542
- /* 289 */ "cmd ::= REINDEX",
180543
- /* 290 */ "cmd ::= REINDEX nm dbnm",
180544
- /* 291 */ "cmd ::= ANALYZE",
180545
- /* 292 */ "cmd ::= ANALYZE nm dbnm",
180546
- /* 293 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
180547
- /* 294 */ "cmd ::= alter_add carglist",
180548
- /* 295 */ "alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken",
180549
- /* 296 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
180550
- /* 297 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
180551
- /* 298 */ "cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm",
180552
- /* 299 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL",
180553
- /* 300 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf",
180554
- /* 301 */ "cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf",
180555
- /* 302 */ "cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf",
180556
- /* 303 */ "cmd ::= create_vtab",
180557
- /* 304 */ "cmd ::= create_vtab LP vtabarglist RP",
180558
- /* 305 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
180559
- /* 306 */ "vtabarg ::=",
180560
- /* 307 */ "vtabargtoken ::= ANY",
180561
- /* 308 */ "vtabargtoken ::= lp anylist RP",
180562
- /* 309 */ "lp ::= LP",
180563
- /* 310 */ "with ::= WITH wqlist",
180564
- /* 311 */ "with ::= WITH RECURSIVE wqlist",
180565
- /* 312 */ "wqas ::= AS",
180566
- /* 313 */ "wqas ::= AS MATERIALIZED",
180567
- /* 314 */ "wqas ::= AS NOT MATERIALIZED",
180568
- /* 315 */ "wqitem ::= withnm eidlist_opt wqas LP select RP",
180569
- /* 316 */ "withnm ::= nm",
180570
- /* 317 */ "wqlist ::= wqitem",
180571
- /* 318 */ "wqlist ::= wqlist COMMA wqitem",
180572
- /* 319 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
180573
- /* 320 */ "windowdefn ::= nm AS LP window RP",
180574
- /* 321 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
180575
- /* 322 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
180576
- /* 323 */ "window ::= ORDER BY sortlist frame_opt",
180577
- /* 324 */ "window ::= nm ORDER BY sortlist frame_opt",
180578
- /* 325 */ "window ::= nm frame_opt",
180579
- /* 326 */ "frame_opt ::=",
180580
- /* 327 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
180581
- /* 328 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
180582
- /* 329 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
180583
- /* 330 */ "frame_bound_s ::= frame_bound",
180584
- /* 331 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
180585
- /* 332 */ "frame_bound_e ::= frame_bound",
180586
- /* 333 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
180587
- /* 334 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
180588
- /* 335 */ "frame_bound ::= CURRENT ROW",
180589
- /* 336 */ "frame_exclude_opt ::=",
180590
- /* 337 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
180591
- /* 338 */ "frame_exclude ::= NO OTHERS",
180592
- /* 339 */ "frame_exclude ::= CURRENT ROW",
180593
- /* 340 */ "frame_exclude ::= GROUP|TIES",
180594
- /* 341 */ "window_clause ::= WINDOW windowdefn_list",
180595
- /* 342 */ "filter_over ::= filter_clause over_clause",
180596
- /* 343 */ "filter_over ::= over_clause",
180597
- /* 344 */ "filter_over ::= filter_clause",
180598
- /* 345 */ "over_clause ::= OVER LP window RP",
180599
- /* 346 */ "over_clause ::= OVER nm",
180600
- /* 347 */ "filter_clause ::= FILTER LP WHERE expr RP",
180601
- /* 348 */ "term ::= QNUMBER",
180602
- /* 349 */ "input ::= cmdlist",
180603
- /* 350 */ "cmdlist ::= cmdlist ecmd",
180604
- /* 351 */ "cmdlist ::= ecmd",
180605
- /* 352 */ "ecmd ::= SEMI",
180606
- /* 353 */ "ecmd ::= cmdx SEMI",
180607
- /* 354 */ "ecmd ::= explain cmdx SEMI",
180608
- /* 355 */ "trans_opt ::=",
180609
- /* 356 */ "trans_opt ::= TRANSACTION",
180610
- /* 357 */ "trans_opt ::= TRANSACTION nm",
180611
- /* 358 */ "savepoint_opt ::= SAVEPOINT",
180612
- /* 359 */ "savepoint_opt ::=",
180613
- /* 360 */ "cmd ::= create_table create_table_args",
180614
- /* 361 */ "table_option_set ::= table_option",
180615
- /* 362 */ "columnlist ::= columnlist COMMA columnname carglist",
180616
- /* 363 */ "columnlist ::= columnname carglist",
180617
- /* 364 */ "nm ::= ID|INDEXED|JOIN_KW",
180618
- /* 365 */ "nm ::= STRING",
180619
- /* 366 */ "typetoken ::= typename",
180620
- /* 367 */ "typename ::= ID|STRING",
180621
- /* 368 */ "signed ::= plus_num",
180622
- /* 369 */ "signed ::= minus_num",
180623
- /* 370 */ "carglist ::= carglist ccons",
180624
- /* 371 */ "carglist ::=",
180625
- /* 372 */ "ccons ::= NULL onconf",
180626
- /* 373 */ "ccons ::= GENERATED ALWAYS AS generated",
180627
- /* 374 */ "ccons ::= AS generated",
180628
- /* 375 */ "conslist_opt ::= COMMA conslist",
180629
- /* 376 */ "conslist ::= conslist tconscomma tcons",
180630
- /* 377 */ "conslist ::= tcons",
180631
- /* 378 */ "tconscomma ::=",
180632
- /* 379 */ "defer_subclause_opt ::= defer_subclause",
180633
- /* 380 */ "resolvetype ::= raisetype",
180634
- /* 381 */ "selectnowith ::= oneselect",
180635
- /* 382 */ "oneselect ::= values",
180636
- /* 383 */ "sclp ::= selcollist COMMA",
180637
- /* 384 */ "as ::= ID|STRING",
180638
- /* 385 */ "indexed_opt ::= indexed_by",
180639
- /* 386 */ "returning ::=",
180640
- /* 387 */ "expr ::= term",
180641
- /* 388 */ "likeop ::= LIKE_KW|MATCH",
180642
- /* 389 */ "case_operand ::= expr",
180643
- /* 390 */ "exprlist ::= nexprlist",
180644
- /* 391 */ "nmnum ::= plus_num",
180645
- /* 392 */ "nmnum ::= nm",
180646
- /* 393 */ "nmnum ::= ON",
180647
- /* 394 */ "nmnum ::= DELETE",
180648
- /* 395 */ "nmnum ::= DEFAULT",
180649
- /* 396 */ "plus_num ::= INTEGER|FLOAT",
180650
- /* 397 */ "foreach_clause ::=",
180651
- /* 398 */ "foreach_clause ::= FOR EACH ROW",
180652
- /* 399 */ "trnm ::= nm",
180653
- /* 400 */ "tridxby ::=",
180654
- /* 401 */ "database_kw_opt ::= DATABASE",
180655
- /* 402 */ "database_kw_opt ::=",
180656
- /* 403 */ "kwcolumn_opt ::=",
180657
- /* 404 */ "kwcolumn_opt ::= COLUMNKW",
180658
- /* 405 */ "vtabarglist ::= vtabarg",
180659
- /* 406 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
180660
- /* 407 */ "vtabarg ::= vtabarg vtabargtoken",
180661
- /* 408 */ "anylist ::=",
180662
- /* 409 */ "anylist ::= anylist LP anylist RP",
180663
- /* 410 */ "anylist ::= anylist ANY",
180664
- /* 411 */ "with ::=",
180665
- /* 412 */ "windowdefn_list ::= windowdefn",
180666
- /* 413 */ "window ::= frame_opt",
180408
+ /* 272 */ "tridxby ::= INDEXED BY nm",
180409
+ /* 273 */ "tridxby ::= NOT INDEXED",
180410
+ /* 274 */ "trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt",
180411
+ /* 275 */ "trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt",
180412
+ /* 276 */ "trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt",
180413
+ /* 277 */ "trigger_cmd ::= scanpt select scanpt",
180414
+ /* 278 */ "expr ::= RAISE LP IGNORE RP",
180415
+ /* 279 */ "expr ::= RAISE LP raisetype COMMA expr RP",
180416
+ /* 280 */ "raisetype ::= ROLLBACK",
180417
+ /* 281 */ "raisetype ::= ABORT",
180418
+ /* 282 */ "raisetype ::= FAIL",
180419
+ /* 283 */ "cmd ::= DROP TRIGGER ifexists fullname",
180420
+ /* 284 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
180421
+ /* 285 */ "cmd ::= DETACH database_kw_opt expr",
180422
+ /* 286 */ "key_opt ::=",
180423
+ /* 287 */ "key_opt ::= KEY expr",
180424
+ /* 288 */ "cmd ::= REINDEX",
180425
+ /* 289 */ "cmd ::= REINDEX nm dbnm",
180426
+ /* 290 */ "cmd ::= ANALYZE",
180427
+ /* 291 */ "cmd ::= ANALYZE nm dbnm",
180428
+ /* 292 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
180429
+ /* 293 */ "cmd ::= alter_add carglist",
180430
+ /* 294 */ "alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken",
180431
+ /* 295 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
180432
+ /* 296 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
180433
+ /* 297 */ "cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm",
180434
+ /* 298 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL",
180435
+ /* 299 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf",
180436
+ /* 300 */ "cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf",
180437
+ /* 301 */ "cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf",
180438
+ /* 302 */ "cmd ::= create_vtab",
180439
+ /* 303 */ "cmd ::= create_vtab LP vtabarglist RP",
180440
+ /* 304 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
180441
+ /* 305 */ "vtabarg ::=",
180442
+ /* 306 */ "vtabargtoken ::= ANY",
180443
+ /* 307 */ "vtabargtoken ::= lp anylist RP",
180444
+ /* 308 */ "lp ::= LP",
180445
+ /* 309 */ "with ::= WITH wqlist",
180446
+ /* 310 */ "with ::= WITH RECURSIVE wqlist",
180447
+ /* 311 */ "wqas ::= AS",
180448
+ /* 312 */ "wqas ::= AS MATERIALIZED",
180449
+ /* 313 */ "wqas ::= AS NOT MATERIALIZED",
180450
+ /* 314 */ "wqitem ::= withnm eidlist_opt wqas LP select RP",
180451
+ /* 315 */ "withnm ::= nm",
180452
+ /* 316 */ "wqlist ::= wqitem",
180453
+ /* 317 */ "wqlist ::= wqlist COMMA wqitem",
180454
+ /* 318 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
180455
+ /* 319 */ "windowdefn ::= nm AS LP window RP",
180456
+ /* 320 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
180457
+ /* 321 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
180458
+ /* 322 */ "window ::= ORDER BY sortlist frame_opt",
180459
+ /* 323 */ "window ::= nm ORDER BY sortlist frame_opt",
180460
+ /* 324 */ "window ::= nm frame_opt",
180461
+ /* 325 */ "frame_opt ::=",
180462
+ /* 326 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
180463
+ /* 327 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
180464
+ /* 328 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
180465
+ /* 329 */ "frame_bound_s ::= frame_bound",
180466
+ /* 330 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
180467
+ /* 331 */ "frame_bound_e ::= frame_bound",
180468
+ /* 332 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
180469
+ /* 333 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
180470
+ /* 334 */ "frame_bound ::= CURRENT ROW",
180471
+ /* 335 */ "frame_exclude_opt ::=",
180472
+ /* 336 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
180473
+ /* 337 */ "frame_exclude ::= NO OTHERS",
180474
+ /* 338 */ "frame_exclude ::= CURRENT ROW",
180475
+ /* 339 */ "frame_exclude ::= GROUP|TIES",
180476
+ /* 340 */ "window_clause ::= WINDOW windowdefn_list",
180477
+ /* 341 */ "filter_over ::= filter_clause over_clause",
180478
+ /* 342 */ "filter_over ::= over_clause",
180479
+ /* 343 */ "filter_over ::= filter_clause",
180480
+ /* 344 */ "over_clause ::= OVER LP window RP",
180481
+ /* 345 */ "over_clause ::= OVER nm",
180482
+ /* 346 */ "filter_clause ::= FILTER LP WHERE expr RP",
180483
+ /* 347 */ "term ::= QNUMBER",
180484
+ /* 348 */ "input ::= cmdlist",
180485
+ /* 349 */ "cmdlist ::= cmdlist ecmd",
180486
+ /* 350 */ "cmdlist ::= ecmd",
180487
+ /* 351 */ "ecmd ::= SEMI",
180488
+ /* 352 */ "ecmd ::= cmdx SEMI",
180489
+ /* 353 */ "ecmd ::= explain cmdx SEMI",
180490
+ /* 354 */ "trans_opt ::=",
180491
+ /* 355 */ "trans_opt ::= TRANSACTION",
180492
+ /* 356 */ "trans_opt ::= TRANSACTION nm",
180493
+ /* 357 */ "savepoint_opt ::= SAVEPOINT",
180494
+ /* 358 */ "savepoint_opt ::=",
180495
+ /* 359 */ "cmd ::= create_table create_table_args",
180496
+ /* 360 */ "table_option_set ::= table_option",
180497
+ /* 361 */ "columnlist ::= columnlist COMMA columnname carglist",
180498
+ /* 362 */ "columnlist ::= columnname carglist",
180499
+ /* 363 */ "nm ::= ID|INDEXED|JOIN_KW",
180500
+ /* 364 */ "nm ::= STRING",
180501
+ /* 365 */ "typetoken ::= typename",
180502
+ /* 366 */ "typename ::= ID|STRING",
180503
+ /* 367 */ "signed ::= plus_num",
180504
+ /* 368 */ "signed ::= minus_num",
180505
+ /* 369 */ "carglist ::= carglist ccons",
180506
+ /* 370 */ "carglist ::=",
180507
+ /* 371 */ "ccons ::= NULL onconf",
180508
+ /* 372 */ "ccons ::= GENERATED ALWAYS AS generated",
180509
+ /* 373 */ "ccons ::= AS generated",
180510
+ /* 374 */ "conslist_opt ::= COMMA conslist",
180511
+ /* 375 */ "conslist ::= conslist tconscomma tcons",
180512
+ /* 376 */ "conslist ::= tcons",
180513
+ /* 377 */ "tconscomma ::=",
180514
+ /* 378 */ "defer_subclause_opt ::= defer_subclause",
180515
+ /* 379 */ "resolvetype ::= raisetype",
180516
+ /* 380 */ "selectnowith ::= oneselect",
180517
+ /* 381 */ "oneselect ::= values",
180518
+ /* 382 */ "sclp ::= selcollist COMMA",
180519
+ /* 383 */ "as ::= ID|STRING",
180520
+ /* 384 */ "indexed_opt ::= indexed_by",
180521
+ /* 385 */ "returning ::=",
180522
+ /* 386 */ "expr ::= term",
180523
+ /* 387 */ "likeop ::= LIKE_KW|MATCH",
180524
+ /* 388 */ "case_operand ::= expr",
180525
+ /* 389 */ "exprlist ::= nexprlist",
180526
+ /* 390 */ "nmnum ::= plus_num",
180527
+ /* 391 */ "nmnum ::= nm",
180528
+ /* 392 */ "nmnum ::= ON",
180529
+ /* 393 */ "nmnum ::= DELETE",
180530
+ /* 394 */ "nmnum ::= DEFAULT",
180531
+ /* 395 */ "plus_num ::= INTEGER|FLOAT",
180532
+ /* 396 */ "foreach_clause ::=",
180533
+ /* 397 */ "foreach_clause ::= FOR EACH ROW",
180534
+ /* 398 */ "tridxby ::=",
180535
+ /* 399 */ "database_kw_opt ::= DATABASE",
180536
+ /* 400 */ "database_kw_opt ::=",
180537
+ /* 401 */ "kwcolumn_opt ::=",
180538
+ /* 402 */ "kwcolumn_opt ::= COLUMNKW",
180539
+ /* 403 */ "vtabarglist ::= vtabarg",
180540
+ /* 404 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
180541
+ /* 405 */ "vtabarg ::= vtabarg vtabargtoken",
180542
+ /* 406 */ "anylist ::=",
180543
+ /* 407 */ "anylist ::= anylist LP anylist RP",
180544
+ /* 408 */ "anylist ::= anylist ANY",
180545
+ /* 409 */ "with ::=",
180546
+ /* 410 */ "windowdefn_list ::= windowdefn",
180547
+ /* 411 */ "window ::= frame_opt",
180667180548
};
180668180549
#endif /* NDEBUG */
180669180550
180670180551
180671180552
#if YYGROWABLESTACK
@@ -180800,11 +180681,11 @@
180800180681
case 241: /* selectnowith */
180801180682
case 242: /* oneselect */
180802180683
case 254: /* values */
180803180684
case 256: /* mvalues */
180804180685
{
180805
-sqlite3SelectDelete(pParse->db, (yypminor->yy637));
180686
+sqlite3SelectDelete(pParse->db, (yypminor->yy555));
180806180687
}
180807180688
break;
180808180689
case 218: /* term */
180809180690
case 219: /* expr */
180810180691
case 248: /* where_opt */
@@ -180812,14 +180693,14 @@
180812180693
case 270: /* where_opt_ret */
180813180694
case 281: /* case_operand */
180814180695
case 283: /* case_else */
180815180696
case 286: /* vinto */
180816180697
case 293: /* when_clause */
180817
- case 298: /* key_opt */
180818
- case 315: /* filter_clause */
180698
+ case 297: /* key_opt */
180699
+ case 314: /* filter_clause */
180819180700
{
180820
-sqlite3ExprDelete(pParse->db, (yypminor->yy590));
180701
+sqlite3ExprDelete(pParse->db, (yypminor->yy454));
180821180702
}
180822180703
break;
180823180704
case 223: /* eidlist_opt */
180824180705
case 233: /* sortlist */
180825180706
case 234: /* eidlist */
@@ -180830,66 +180711,66 @@
180830180711
case 257: /* sclp */
180831180712
case 264: /* exprlist */
180832180713
case 271: /* setlist */
180833180714
case 280: /* paren_exprlist */
180834180715
case 282: /* case_exprlist */
180835
- case 314: /* part_opt */
180716
+ case 313: /* part_opt */
180836180717
{
180837
-sqlite3ExprListDelete(pParse->db, (yypminor->yy402));
180718
+sqlite3ExprListDelete(pParse->db, (yypminor->yy14));
180838180719
}
180839180720
break;
180840180721
case 240: /* fullname */
180841180722
case 247: /* from */
180842180723
case 259: /* seltablist */
180843180724
case 260: /* stl_prefix */
180844180725
case 265: /* xfullname */
180845180726
{
180846
-sqlite3SrcListDelete(pParse->db, (yypminor->yy563));
180727
+sqlite3SrcListDelete(pParse->db, (yypminor->yy203));
180847180728
}
180848180729
break;
180849180730
case 243: /* wqlist */
180850180731
{
180851
-sqlite3WithDelete(pParse->db, (yypminor->yy125));
180732
+sqlite3WithDelete(pParse->db, (yypminor->yy59));
180852180733
}
180853180734
break;
180854180735
case 253: /* window_clause */
180855
- case 310: /* windowdefn_list */
180736
+ case 309: /* windowdefn_list */
180856180737
{
180857
-sqlite3WindowListDelete(pParse->db, (yypminor->yy483));
180738
+sqlite3WindowListDelete(pParse->db, (yypminor->yy211));
180858180739
}
180859180740
break;
180860180741
case 266: /* idlist */
180861180742
case 273: /* idlist_opt */
180862180743
{
180863
-sqlite3IdListDelete(pParse->db, (yypminor->yy204));
180744
+sqlite3IdListDelete(pParse->db, (yypminor->yy132));
180864180745
}
180865180746
break;
180866180747
case 276: /* filter_over */
180867
- case 311: /* windowdefn */
180868
- case 312: /* window */
180869
- case 313: /* frame_opt */
180870
- case 316: /* over_clause */
180748
+ case 310: /* windowdefn */
180749
+ case 311: /* window */
180750
+ case 312: /* frame_opt */
180751
+ case 315: /* over_clause */
180871180752
{
180872
-sqlite3WindowDelete(pParse->db, (yypminor->yy483));
180753
+sqlite3WindowDelete(pParse->db, (yypminor->yy211));
180873180754
}
180874180755
break;
180875180756
case 289: /* trigger_cmd_list */
180876180757
case 294: /* trigger_cmd */
180877180758
{
180878
-sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy319));
180759
+sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427));
180879180760
}
180880180761
break;
180881180762
case 291: /* trigger_event */
180882180763
{
180883
-sqlite3IdListDelete(pParse->db, (yypminor->yy28).b);
180764
+sqlite3IdListDelete(pParse->db, (yypminor->yy286).b);
180884180765
}
180885180766
break;
180886
- case 318: /* frame_bound */
180887
- case 319: /* frame_bound_s */
180888
- case 320: /* frame_bound_e */
180767
+ case 317: /* frame_bound */
180768
+ case 318: /* frame_bound_s */
180769
+ case 319: /* frame_bound_e */
180889180770
{
180890
-sqlite3ExprDelete(pParse->db, (yypminor->yy205).pExpr);
180771
+sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr);
180891180772
}
180892180773
break;
180893180774
/********* End destructor definitions *****************************************/
180894180775
default: break; /* If no destructor action specified: do nothing */
180895180776
}
@@ -181311,12 +181192,12 @@
181311181192
202, /* (117) dbnm ::= DOT nm */
181312181193
240, /* (118) fullname ::= nm */
181313181194
240, /* (119) fullname ::= nm DOT nm */
181314181195
265, /* (120) xfullname ::= nm */
181315181196
265, /* (121) xfullname ::= nm DOT nm */
181316
- 265, /* (122) xfullname ::= nm DOT nm AS nm */
181317
- 265, /* (123) xfullname ::= nm AS nm */
181197
+ 265, /* (122) xfullname ::= nm AS nm */
181198
+ 265, /* (123) xfullname ::= nm DOT nm AS nm */
181318181199
261, /* (124) joinop ::= COMMA|JOIN */
181319181200
261, /* (125) joinop ::= JOIN_KW JOIN */
181320181201
261, /* (126) joinop ::= JOIN_KW nm JOIN */
181321181202
261, /* (127) joinop ::= JOIN_KW nm nm JOIN */
181322181203
262, /* (128) on_using ::= ON expr */
@@ -181461,152 +181342,150 @@
181461181342
291, /* (267) trigger_event ::= UPDATE OF idlist */
181462181343
293, /* (268) when_clause ::= */
181463181344
293, /* (269) when_clause ::= WHEN expr */
181464181345
289, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
181465181346
289, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
181466
- 295, /* (272) trnm ::= nm DOT nm */
181467
- 296, /* (273) tridxby ::= INDEXED BY nm */
181468
- 296, /* (274) tridxby ::= NOT INDEXED */
181469
- 294, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
181470
- 294, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
181471
- 294, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
181472
- 294, /* (278) trigger_cmd ::= scanpt select scanpt */
181473
- 219, /* (279) expr ::= RAISE LP IGNORE RP */
181474
- 219, /* (280) expr ::= RAISE LP raisetype COMMA expr RP */
181475
- 238, /* (281) raisetype ::= ROLLBACK */
181476
- 238, /* (282) raisetype ::= ABORT */
181477
- 238, /* (283) raisetype ::= FAIL */
181478
- 192, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
181479
- 192, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181480
- 192, /* (286) cmd ::= DETACH database_kw_opt expr */
181481
- 298, /* (287) key_opt ::= */
181482
- 298, /* (288) key_opt ::= KEY expr */
181483
- 192, /* (289) cmd ::= REINDEX */
181484
- 192, /* (290) cmd ::= REINDEX nm dbnm */
181485
- 192, /* (291) cmd ::= ANALYZE */
181486
- 192, /* (292) cmd ::= ANALYZE nm dbnm */
181487
- 192, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
181488
- 192, /* (294) cmd ::= alter_add carglist */
181489
- 299, /* (295) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181490
- 192, /* (296) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181491
- 192, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181492
- 192, /* (298) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181493
- 192, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181494
- 192, /* (300) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181495
- 192, /* (301) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181496
- 192, /* (302) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181497
- 192, /* (303) cmd ::= create_vtab */
181498
- 192, /* (304) cmd ::= create_vtab LP vtabarglist RP */
181499
- 301, /* (305) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181500
- 303, /* (306) vtabarg ::= */
181501
- 304, /* (307) vtabargtoken ::= ANY */
181502
- 304, /* (308) vtabargtoken ::= lp anylist RP */
181503
- 305, /* (309) lp ::= LP */
181504
- 269, /* (310) with ::= WITH wqlist */
181505
- 269, /* (311) with ::= WITH RECURSIVE wqlist */
181506
- 308, /* (312) wqas ::= AS */
181507
- 308, /* (313) wqas ::= AS MATERIALIZED */
181508
- 308, /* (314) wqas ::= AS NOT MATERIALIZED */
181509
- 307, /* (315) wqitem ::= withnm eidlist_opt wqas LP select RP */
181510
- 309, /* (316) withnm ::= nm */
181511
- 243, /* (317) wqlist ::= wqitem */
181512
- 243, /* (318) wqlist ::= wqlist COMMA wqitem */
181513
- 310, /* (319) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181514
- 311, /* (320) windowdefn ::= nm AS LP window RP */
181515
- 312, /* (321) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181516
- 312, /* (322) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181517
- 312, /* (323) window ::= ORDER BY sortlist frame_opt */
181518
- 312, /* (324) window ::= nm ORDER BY sortlist frame_opt */
181519
- 312, /* (325) window ::= nm frame_opt */
181520
- 313, /* (326) frame_opt ::= */
181521
- 313, /* (327) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181522
- 313, /* (328) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181523
- 317, /* (329) range_or_rows ::= RANGE|ROWS|GROUPS */
181524
- 319, /* (330) frame_bound_s ::= frame_bound */
181525
- 319, /* (331) frame_bound_s ::= UNBOUNDED PRECEDING */
181526
- 320, /* (332) frame_bound_e ::= frame_bound */
181527
- 320, /* (333) frame_bound_e ::= UNBOUNDED FOLLOWING */
181528
- 318, /* (334) frame_bound ::= expr PRECEDING|FOLLOWING */
181529
- 318, /* (335) frame_bound ::= CURRENT ROW */
181530
- 321, /* (336) frame_exclude_opt ::= */
181531
- 321, /* (337) frame_exclude_opt ::= EXCLUDE frame_exclude */
181532
- 322, /* (338) frame_exclude ::= NO OTHERS */
181533
- 322, /* (339) frame_exclude ::= CURRENT ROW */
181534
- 322, /* (340) frame_exclude ::= GROUP|TIES */
181535
- 253, /* (341) window_clause ::= WINDOW windowdefn_list */
181536
- 276, /* (342) filter_over ::= filter_clause over_clause */
181537
- 276, /* (343) filter_over ::= over_clause */
181538
- 276, /* (344) filter_over ::= filter_clause */
181539
- 316, /* (345) over_clause ::= OVER LP window RP */
181540
- 316, /* (346) over_clause ::= OVER nm */
181541
- 315, /* (347) filter_clause ::= FILTER LP WHERE expr RP */
181542
- 218, /* (348) term ::= QNUMBER */
181543
- 187, /* (349) input ::= cmdlist */
181544
- 188, /* (350) cmdlist ::= cmdlist ecmd */
181545
- 188, /* (351) cmdlist ::= ecmd */
181546
- 189, /* (352) ecmd ::= SEMI */
181547
- 189, /* (353) ecmd ::= cmdx SEMI */
181548
- 189, /* (354) ecmd ::= explain cmdx SEMI */
181549
- 194, /* (355) trans_opt ::= */
181550
- 194, /* (356) trans_opt ::= TRANSACTION */
181551
- 194, /* (357) trans_opt ::= TRANSACTION nm */
181552
- 196, /* (358) savepoint_opt ::= SAVEPOINT */
181553
- 196, /* (359) savepoint_opt ::= */
181554
- 192, /* (360) cmd ::= create_table create_table_args */
181555
- 205, /* (361) table_option_set ::= table_option */
181556
- 203, /* (362) columnlist ::= columnlist COMMA columnname carglist */
181557
- 203, /* (363) columnlist ::= columnname carglist */
181558
- 195, /* (364) nm ::= ID|INDEXED|JOIN_KW */
181559
- 195, /* (365) nm ::= STRING */
181560
- 210, /* (366) typetoken ::= typename */
181561
- 211, /* (367) typename ::= ID|STRING */
181562
- 212, /* (368) signed ::= plus_num */
181563
- 212, /* (369) signed ::= minus_num */
181564
- 209, /* (370) carglist ::= carglist ccons */
181565
- 209, /* (371) carglist ::= */
181566
- 217, /* (372) ccons ::= NULL onconf */
181567
- 217, /* (373) ccons ::= GENERATED ALWAYS AS generated */
181568
- 217, /* (374) ccons ::= AS generated */
181569
- 204, /* (375) conslist_opt ::= COMMA conslist */
181570
- 230, /* (376) conslist ::= conslist tconscomma tcons */
181571
- 230, /* (377) conslist ::= tcons */
181572
- 231, /* (378) tconscomma ::= */
181573
- 235, /* (379) defer_subclause_opt ::= defer_subclause */
181574
- 237, /* (380) resolvetype ::= raisetype */
181575
- 241, /* (381) selectnowith ::= oneselect */
181576
- 242, /* (382) oneselect ::= values */
181577
- 257, /* (383) sclp ::= selcollist COMMA */
181578
- 258, /* (384) as ::= ID|STRING */
181579
- 267, /* (385) indexed_opt ::= indexed_by */
181580
- 275, /* (386) returning ::= */
181581
- 219, /* (387) expr ::= term */
181582
- 277, /* (388) likeop ::= LIKE_KW|MATCH */
181583
- 281, /* (389) case_operand ::= expr */
181584
- 264, /* (390) exprlist ::= nexprlist */
181585
- 287, /* (391) nmnum ::= plus_num */
181586
- 287, /* (392) nmnum ::= nm */
181587
- 287, /* (393) nmnum ::= ON */
181588
- 287, /* (394) nmnum ::= DELETE */
181589
- 287, /* (395) nmnum ::= DEFAULT */
181590
- 213, /* (396) plus_num ::= INTEGER|FLOAT */
181591
- 292, /* (397) foreach_clause ::= */
181592
- 292, /* (398) foreach_clause ::= FOR EACH ROW */
181593
- 295, /* (399) trnm ::= nm */
181594
- 296, /* (400) tridxby ::= */
181595
- 297, /* (401) database_kw_opt ::= DATABASE */
181596
- 297, /* (402) database_kw_opt ::= */
181597
- 300, /* (403) kwcolumn_opt ::= */
181598
- 300, /* (404) kwcolumn_opt ::= COLUMNKW */
181599
- 302, /* (405) vtabarglist ::= vtabarg */
181600
- 302, /* (406) vtabarglist ::= vtabarglist COMMA vtabarg */
181601
- 303, /* (407) vtabarg ::= vtabarg vtabargtoken */
181602
- 306, /* (408) anylist ::= */
181603
- 306, /* (409) anylist ::= anylist LP anylist RP */
181604
- 306, /* (410) anylist ::= anylist ANY */
181605
- 269, /* (411) with ::= */
181606
- 310, /* (412) windowdefn_list ::= windowdefn */
181607
- 312, /* (413) window ::= frame_opt */
181347
+ 295, /* (272) tridxby ::= INDEXED BY nm */
181348
+ 295, /* (273) tridxby ::= NOT INDEXED */
181349
+ 294, /* (274) trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt */
181350
+ 294, /* (275) trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt */
181351
+ 294, /* (276) trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt */
181352
+ 294, /* (277) trigger_cmd ::= scanpt select scanpt */
181353
+ 219, /* (278) expr ::= RAISE LP IGNORE RP */
181354
+ 219, /* (279) expr ::= RAISE LP raisetype COMMA expr RP */
181355
+ 238, /* (280) raisetype ::= ROLLBACK */
181356
+ 238, /* (281) raisetype ::= ABORT */
181357
+ 238, /* (282) raisetype ::= FAIL */
181358
+ 192, /* (283) cmd ::= DROP TRIGGER ifexists fullname */
181359
+ 192, /* (284) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181360
+ 192, /* (285) cmd ::= DETACH database_kw_opt expr */
181361
+ 297, /* (286) key_opt ::= */
181362
+ 297, /* (287) key_opt ::= KEY expr */
181363
+ 192, /* (288) cmd ::= REINDEX */
181364
+ 192, /* (289) cmd ::= REINDEX nm dbnm */
181365
+ 192, /* (290) cmd ::= ANALYZE */
181366
+ 192, /* (291) cmd ::= ANALYZE nm dbnm */
181367
+ 192, /* (292) cmd ::= ALTER TABLE fullname RENAME TO nm */
181368
+ 192, /* (293) cmd ::= alter_add carglist */
181369
+ 298, /* (294) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181370
+ 192, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181371
+ 192, /* (296) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181372
+ 192, /* (297) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181373
+ 192, /* (298) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181374
+ 192, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181375
+ 192, /* (300) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181376
+ 192, /* (301) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181377
+ 192, /* (302) cmd ::= create_vtab */
181378
+ 192, /* (303) cmd ::= create_vtab LP vtabarglist RP */
181379
+ 300, /* (304) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181380
+ 302, /* (305) vtabarg ::= */
181381
+ 303, /* (306) vtabargtoken ::= ANY */
181382
+ 303, /* (307) vtabargtoken ::= lp anylist RP */
181383
+ 304, /* (308) lp ::= LP */
181384
+ 269, /* (309) with ::= WITH wqlist */
181385
+ 269, /* (310) with ::= WITH RECURSIVE wqlist */
181386
+ 307, /* (311) wqas ::= AS */
181387
+ 307, /* (312) wqas ::= AS MATERIALIZED */
181388
+ 307, /* (313) wqas ::= AS NOT MATERIALIZED */
181389
+ 306, /* (314) wqitem ::= withnm eidlist_opt wqas LP select RP */
181390
+ 308, /* (315) withnm ::= nm */
181391
+ 243, /* (316) wqlist ::= wqitem */
181392
+ 243, /* (317) wqlist ::= wqlist COMMA wqitem */
181393
+ 309, /* (318) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181394
+ 310, /* (319) windowdefn ::= nm AS LP window RP */
181395
+ 311, /* (320) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181396
+ 311, /* (321) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181397
+ 311, /* (322) window ::= ORDER BY sortlist frame_opt */
181398
+ 311, /* (323) window ::= nm ORDER BY sortlist frame_opt */
181399
+ 311, /* (324) window ::= nm frame_opt */
181400
+ 312, /* (325) frame_opt ::= */
181401
+ 312, /* (326) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181402
+ 312, /* (327) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181403
+ 316, /* (328) range_or_rows ::= RANGE|ROWS|GROUPS */
181404
+ 318, /* (329) frame_bound_s ::= frame_bound */
181405
+ 318, /* (330) frame_bound_s ::= UNBOUNDED PRECEDING */
181406
+ 319, /* (331) frame_bound_e ::= frame_bound */
181407
+ 319, /* (332) frame_bound_e ::= UNBOUNDED FOLLOWING */
181408
+ 317, /* (333) frame_bound ::= expr PRECEDING|FOLLOWING */
181409
+ 317, /* (334) frame_bound ::= CURRENT ROW */
181410
+ 320, /* (335) frame_exclude_opt ::= */
181411
+ 320, /* (336) frame_exclude_opt ::= EXCLUDE frame_exclude */
181412
+ 321, /* (337) frame_exclude ::= NO OTHERS */
181413
+ 321, /* (338) frame_exclude ::= CURRENT ROW */
181414
+ 321, /* (339) frame_exclude ::= GROUP|TIES */
181415
+ 253, /* (340) window_clause ::= WINDOW windowdefn_list */
181416
+ 276, /* (341) filter_over ::= filter_clause over_clause */
181417
+ 276, /* (342) filter_over ::= over_clause */
181418
+ 276, /* (343) filter_over ::= filter_clause */
181419
+ 315, /* (344) over_clause ::= OVER LP window RP */
181420
+ 315, /* (345) over_clause ::= OVER nm */
181421
+ 314, /* (346) filter_clause ::= FILTER LP WHERE expr RP */
181422
+ 218, /* (347) term ::= QNUMBER */
181423
+ 187, /* (348) input ::= cmdlist */
181424
+ 188, /* (349) cmdlist ::= cmdlist ecmd */
181425
+ 188, /* (350) cmdlist ::= ecmd */
181426
+ 189, /* (351) ecmd ::= SEMI */
181427
+ 189, /* (352) ecmd ::= cmdx SEMI */
181428
+ 189, /* (353) ecmd ::= explain cmdx SEMI */
181429
+ 194, /* (354) trans_opt ::= */
181430
+ 194, /* (355) trans_opt ::= TRANSACTION */
181431
+ 194, /* (356) trans_opt ::= TRANSACTION nm */
181432
+ 196, /* (357) savepoint_opt ::= SAVEPOINT */
181433
+ 196, /* (358) savepoint_opt ::= */
181434
+ 192, /* (359) cmd ::= create_table create_table_args */
181435
+ 205, /* (360) table_option_set ::= table_option */
181436
+ 203, /* (361) columnlist ::= columnlist COMMA columnname carglist */
181437
+ 203, /* (362) columnlist ::= columnname carglist */
181438
+ 195, /* (363) nm ::= ID|INDEXED|JOIN_KW */
181439
+ 195, /* (364) nm ::= STRING */
181440
+ 210, /* (365) typetoken ::= typename */
181441
+ 211, /* (366) typename ::= ID|STRING */
181442
+ 212, /* (367) signed ::= plus_num */
181443
+ 212, /* (368) signed ::= minus_num */
181444
+ 209, /* (369) carglist ::= carglist ccons */
181445
+ 209, /* (370) carglist ::= */
181446
+ 217, /* (371) ccons ::= NULL onconf */
181447
+ 217, /* (372) ccons ::= GENERATED ALWAYS AS generated */
181448
+ 217, /* (373) ccons ::= AS generated */
181449
+ 204, /* (374) conslist_opt ::= COMMA conslist */
181450
+ 230, /* (375) conslist ::= conslist tconscomma tcons */
181451
+ 230, /* (376) conslist ::= tcons */
181452
+ 231, /* (377) tconscomma ::= */
181453
+ 235, /* (378) defer_subclause_opt ::= defer_subclause */
181454
+ 237, /* (379) resolvetype ::= raisetype */
181455
+ 241, /* (380) selectnowith ::= oneselect */
181456
+ 242, /* (381) oneselect ::= values */
181457
+ 257, /* (382) sclp ::= selcollist COMMA */
181458
+ 258, /* (383) as ::= ID|STRING */
181459
+ 267, /* (384) indexed_opt ::= indexed_by */
181460
+ 275, /* (385) returning ::= */
181461
+ 219, /* (386) expr ::= term */
181462
+ 277, /* (387) likeop ::= LIKE_KW|MATCH */
181463
+ 281, /* (388) case_operand ::= expr */
181464
+ 264, /* (389) exprlist ::= nexprlist */
181465
+ 287, /* (390) nmnum ::= plus_num */
181466
+ 287, /* (391) nmnum ::= nm */
181467
+ 287, /* (392) nmnum ::= ON */
181468
+ 287, /* (393) nmnum ::= DELETE */
181469
+ 287, /* (394) nmnum ::= DEFAULT */
181470
+ 213, /* (395) plus_num ::= INTEGER|FLOAT */
181471
+ 292, /* (396) foreach_clause ::= */
181472
+ 292, /* (397) foreach_clause ::= FOR EACH ROW */
181473
+ 295, /* (398) tridxby ::= */
181474
+ 296, /* (399) database_kw_opt ::= DATABASE */
181475
+ 296, /* (400) database_kw_opt ::= */
181476
+ 299, /* (401) kwcolumn_opt ::= */
181477
+ 299, /* (402) kwcolumn_opt ::= COLUMNKW */
181478
+ 301, /* (403) vtabarglist ::= vtabarg */
181479
+ 301, /* (404) vtabarglist ::= vtabarglist COMMA vtabarg */
181480
+ 302, /* (405) vtabarg ::= vtabarg vtabargtoken */
181481
+ 305, /* (406) anylist ::= */
181482
+ 305, /* (407) anylist ::= anylist LP anylist RP */
181483
+ 305, /* (408) anylist ::= anylist ANY */
181484
+ 269, /* (409) with ::= */
181485
+ 309, /* (410) windowdefn_list ::= windowdefn */
181486
+ 311, /* (411) window ::= frame_opt */
181608181487
};
181609181488
181610181489
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
181611181490
** of symbols on the right-hand side of that rule. */
181612181491
static const signed char yyRuleInfoNRhs[] = {
@@ -181730,12 +181609,12 @@
181730181609
-2, /* (117) dbnm ::= DOT nm */
181731181610
-1, /* (118) fullname ::= nm */
181732181611
-3, /* (119) fullname ::= nm DOT nm */
181733181612
-1, /* (120) xfullname ::= nm */
181734181613
-3, /* (121) xfullname ::= nm DOT nm */
181735
- -5, /* (122) xfullname ::= nm DOT nm AS nm */
181736
- -3, /* (123) xfullname ::= nm AS nm */
181614
+ -3, /* (122) xfullname ::= nm AS nm */
181615
+ -5, /* (123) xfullname ::= nm DOT nm AS nm */
181737181616
-1, /* (124) joinop ::= COMMA|JOIN */
181738181617
-2, /* (125) joinop ::= JOIN_KW JOIN */
181739181618
-3, /* (126) joinop ::= JOIN_KW nm JOIN */
181740181619
-4, /* (127) joinop ::= JOIN_KW nm nm JOIN */
181741181620
-2, /* (128) on_using ::= ON expr */
@@ -181880,152 +181759,150 @@
181880181759
-3, /* (267) trigger_event ::= UPDATE OF idlist */
181881181760
0, /* (268) when_clause ::= */
181882181761
-2, /* (269) when_clause ::= WHEN expr */
181883181762
-3, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
181884181763
-2, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
181885
- -3, /* (272) trnm ::= nm DOT nm */
181886
- -3, /* (273) tridxby ::= INDEXED BY nm */
181887
- -2, /* (274) tridxby ::= NOT INDEXED */
181888
- -9, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
181889
- -8, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
181890
- -6, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
181891
- -3, /* (278) trigger_cmd ::= scanpt select scanpt */
181892
- -4, /* (279) expr ::= RAISE LP IGNORE RP */
181893
- -6, /* (280) expr ::= RAISE LP raisetype COMMA expr RP */
181894
- -1, /* (281) raisetype ::= ROLLBACK */
181895
- -1, /* (282) raisetype ::= ABORT */
181896
- -1, /* (283) raisetype ::= FAIL */
181897
- -4, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
181898
- -6, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181899
- -3, /* (286) cmd ::= DETACH database_kw_opt expr */
181900
- 0, /* (287) key_opt ::= */
181901
- -2, /* (288) key_opt ::= KEY expr */
181902
- -1, /* (289) cmd ::= REINDEX */
181903
- -3, /* (290) cmd ::= REINDEX nm dbnm */
181904
- -1, /* (291) cmd ::= ANALYZE */
181905
- -3, /* (292) cmd ::= ANALYZE nm dbnm */
181906
- -6, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
181907
- -2, /* (294) cmd ::= alter_add carglist */
181908
- -7, /* (295) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181909
- -6, /* (296) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181910
- -8, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181911
- -6, /* (298) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181912
- -9, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181913
- -10, /* (300) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181914
- -11, /* (301) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181915
- -9, /* (302) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181916
- -1, /* (303) cmd ::= create_vtab */
181917
- -4, /* (304) cmd ::= create_vtab LP vtabarglist RP */
181918
- -8, /* (305) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181919
- 0, /* (306) vtabarg ::= */
181920
- -1, /* (307) vtabargtoken ::= ANY */
181921
- -3, /* (308) vtabargtoken ::= lp anylist RP */
181922
- -1, /* (309) lp ::= LP */
181923
- -2, /* (310) with ::= WITH wqlist */
181924
- -3, /* (311) with ::= WITH RECURSIVE wqlist */
181925
- -1, /* (312) wqas ::= AS */
181926
- -2, /* (313) wqas ::= AS MATERIALIZED */
181927
- -3, /* (314) wqas ::= AS NOT MATERIALIZED */
181928
- -6, /* (315) wqitem ::= withnm eidlist_opt wqas LP select RP */
181929
- -1, /* (316) withnm ::= nm */
181930
- -1, /* (317) wqlist ::= wqitem */
181931
- -3, /* (318) wqlist ::= wqlist COMMA wqitem */
181932
- -3, /* (319) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181933
- -5, /* (320) windowdefn ::= nm AS LP window RP */
181934
- -5, /* (321) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181935
- -6, /* (322) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181936
- -4, /* (323) window ::= ORDER BY sortlist frame_opt */
181937
- -5, /* (324) window ::= nm ORDER BY sortlist frame_opt */
181938
- -2, /* (325) window ::= nm frame_opt */
181939
- 0, /* (326) frame_opt ::= */
181940
- -3, /* (327) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181941
- -6, /* (328) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181942
- -1, /* (329) range_or_rows ::= RANGE|ROWS|GROUPS */
181943
- -1, /* (330) frame_bound_s ::= frame_bound */
181944
- -2, /* (331) frame_bound_s ::= UNBOUNDED PRECEDING */
181945
- -1, /* (332) frame_bound_e ::= frame_bound */
181946
- -2, /* (333) frame_bound_e ::= UNBOUNDED FOLLOWING */
181947
- -2, /* (334) frame_bound ::= expr PRECEDING|FOLLOWING */
181948
- -2, /* (335) frame_bound ::= CURRENT ROW */
181949
- 0, /* (336) frame_exclude_opt ::= */
181950
- -2, /* (337) frame_exclude_opt ::= EXCLUDE frame_exclude */
181951
- -2, /* (338) frame_exclude ::= NO OTHERS */
181952
- -2, /* (339) frame_exclude ::= CURRENT ROW */
181953
- -1, /* (340) frame_exclude ::= GROUP|TIES */
181954
- -2, /* (341) window_clause ::= WINDOW windowdefn_list */
181955
- -2, /* (342) filter_over ::= filter_clause over_clause */
181956
- -1, /* (343) filter_over ::= over_clause */
181957
- -1, /* (344) filter_over ::= filter_clause */
181958
- -4, /* (345) over_clause ::= OVER LP window RP */
181959
- -2, /* (346) over_clause ::= OVER nm */
181960
- -5, /* (347) filter_clause ::= FILTER LP WHERE expr RP */
181961
- -1, /* (348) term ::= QNUMBER */
181962
- -1, /* (349) input ::= cmdlist */
181963
- -2, /* (350) cmdlist ::= cmdlist ecmd */
181964
- -1, /* (351) cmdlist ::= ecmd */
181965
- -1, /* (352) ecmd ::= SEMI */
181966
- -2, /* (353) ecmd ::= cmdx SEMI */
181967
- -3, /* (354) ecmd ::= explain cmdx SEMI */
181968
- 0, /* (355) trans_opt ::= */
181969
- -1, /* (356) trans_opt ::= TRANSACTION */
181970
- -2, /* (357) trans_opt ::= TRANSACTION nm */
181971
- -1, /* (358) savepoint_opt ::= SAVEPOINT */
181972
- 0, /* (359) savepoint_opt ::= */
181973
- -2, /* (360) cmd ::= create_table create_table_args */
181974
- -1, /* (361) table_option_set ::= table_option */
181975
- -4, /* (362) columnlist ::= columnlist COMMA columnname carglist */
181976
- -2, /* (363) columnlist ::= columnname carglist */
181977
- -1, /* (364) nm ::= ID|INDEXED|JOIN_KW */
181978
- -1, /* (365) nm ::= STRING */
181979
- -1, /* (366) typetoken ::= typename */
181980
- -1, /* (367) typename ::= ID|STRING */
181981
- -1, /* (368) signed ::= plus_num */
181982
- -1, /* (369) signed ::= minus_num */
181983
- -2, /* (370) carglist ::= carglist ccons */
181984
- 0, /* (371) carglist ::= */
181985
- -2, /* (372) ccons ::= NULL onconf */
181986
- -4, /* (373) ccons ::= GENERATED ALWAYS AS generated */
181987
- -2, /* (374) ccons ::= AS generated */
181988
- -2, /* (375) conslist_opt ::= COMMA conslist */
181989
- -3, /* (376) conslist ::= conslist tconscomma tcons */
181990
- -1, /* (377) conslist ::= tcons */
181991
- 0, /* (378) tconscomma ::= */
181992
- -1, /* (379) defer_subclause_opt ::= defer_subclause */
181993
- -1, /* (380) resolvetype ::= raisetype */
181994
- -1, /* (381) selectnowith ::= oneselect */
181995
- -1, /* (382) oneselect ::= values */
181996
- -2, /* (383) sclp ::= selcollist COMMA */
181997
- -1, /* (384) as ::= ID|STRING */
181998
- -1, /* (385) indexed_opt ::= indexed_by */
181999
- 0, /* (386) returning ::= */
182000
- -1, /* (387) expr ::= term */
182001
- -1, /* (388) likeop ::= LIKE_KW|MATCH */
182002
- -1, /* (389) case_operand ::= expr */
182003
- -1, /* (390) exprlist ::= nexprlist */
182004
- -1, /* (391) nmnum ::= plus_num */
182005
- -1, /* (392) nmnum ::= nm */
182006
- -1, /* (393) nmnum ::= ON */
182007
- -1, /* (394) nmnum ::= DELETE */
182008
- -1, /* (395) nmnum ::= DEFAULT */
182009
- -1, /* (396) plus_num ::= INTEGER|FLOAT */
182010
- 0, /* (397) foreach_clause ::= */
182011
- -3, /* (398) foreach_clause ::= FOR EACH ROW */
182012
- -1, /* (399) trnm ::= nm */
182013
- 0, /* (400) tridxby ::= */
182014
- -1, /* (401) database_kw_opt ::= DATABASE */
182015
- 0, /* (402) database_kw_opt ::= */
182016
- 0, /* (403) kwcolumn_opt ::= */
182017
- -1, /* (404) kwcolumn_opt ::= COLUMNKW */
182018
- -1, /* (405) vtabarglist ::= vtabarg */
182019
- -3, /* (406) vtabarglist ::= vtabarglist COMMA vtabarg */
182020
- -2, /* (407) vtabarg ::= vtabarg vtabargtoken */
182021
- 0, /* (408) anylist ::= */
182022
- -4, /* (409) anylist ::= anylist LP anylist RP */
182023
- -2, /* (410) anylist ::= anylist ANY */
182024
- 0, /* (411) with ::= */
182025
- -1, /* (412) windowdefn_list ::= windowdefn */
182026
- -1, /* (413) window ::= frame_opt */
181764
+ -3, /* (272) tridxby ::= INDEXED BY nm */
181765
+ -2, /* (273) tridxby ::= NOT INDEXED */
181766
+ -9, /* (274) trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt */
181767
+ -8, /* (275) trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt */
181768
+ -6, /* (276) trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt */
181769
+ -3, /* (277) trigger_cmd ::= scanpt select scanpt */
181770
+ -4, /* (278) expr ::= RAISE LP IGNORE RP */
181771
+ -6, /* (279) expr ::= RAISE LP raisetype COMMA expr RP */
181772
+ -1, /* (280) raisetype ::= ROLLBACK */
181773
+ -1, /* (281) raisetype ::= ABORT */
181774
+ -1, /* (282) raisetype ::= FAIL */
181775
+ -4, /* (283) cmd ::= DROP TRIGGER ifexists fullname */
181776
+ -6, /* (284) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181777
+ -3, /* (285) cmd ::= DETACH database_kw_opt expr */
181778
+ 0, /* (286) key_opt ::= */
181779
+ -2, /* (287) key_opt ::= KEY expr */
181780
+ -1, /* (288) cmd ::= REINDEX */
181781
+ -3, /* (289) cmd ::= REINDEX nm dbnm */
181782
+ -1, /* (290) cmd ::= ANALYZE */
181783
+ -3, /* (291) cmd ::= ANALYZE nm dbnm */
181784
+ -6, /* (292) cmd ::= ALTER TABLE fullname RENAME TO nm */
181785
+ -2, /* (293) cmd ::= alter_add carglist */
181786
+ -7, /* (294) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181787
+ -6, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181788
+ -8, /* (296) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181789
+ -6, /* (297) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181790
+ -9, /* (298) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181791
+ -10, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181792
+ -11, /* (300) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181793
+ -9, /* (301) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181794
+ -1, /* (302) cmd ::= create_vtab */
181795
+ -4, /* (303) cmd ::= create_vtab LP vtabarglist RP */
181796
+ -8, /* (304) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181797
+ 0, /* (305) vtabarg ::= */
181798
+ -1, /* (306) vtabargtoken ::= ANY */
181799
+ -3, /* (307) vtabargtoken ::= lp anylist RP */
181800
+ -1, /* (308) lp ::= LP */
181801
+ -2, /* (309) with ::= WITH wqlist */
181802
+ -3, /* (310) with ::= WITH RECURSIVE wqlist */
181803
+ -1, /* (311) wqas ::= AS */
181804
+ -2, /* (312) wqas ::= AS MATERIALIZED */
181805
+ -3, /* (313) wqas ::= AS NOT MATERIALIZED */
181806
+ -6, /* (314) wqitem ::= withnm eidlist_opt wqas LP select RP */
181807
+ -1, /* (315) withnm ::= nm */
181808
+ -1, /* (316) wqlist ::= wqitem */
181809
+ -3, /* (317) wqlist ::= wqlist COMMA wqitem */
181810
+ -3, /* (318) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181811
+ -5, /* (319) windowdefn ::= nm AS LP window RP */
181812
+ -5, /* (320) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181813
+ -6, /* (321) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181814
+ -4, /* (322) window ::= ORDER BY sortlist frame_opt */
181815
+ -5, /* (323) window ::= nm ORDER BY sortlist frame_opt */
181816
+ -2, /* (324) window ::= nm frame_opt */
181817
+ 0, /* (325) frame_opt ::= */
181818
+ -3, /* (326) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181819
+ -6, /* (327) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181820
+ -1, /* (328) range_or_rows ::= RANGE|ROWS|GROUPS */
181821
+ -1, /* (329) frame_bound_s ::= frame_bound */
181822
+ -2, /* (330) frame_bound_s ::= UNBOUNDED PRECEDING */
181823
+ -1, /* (331) frame_bound_e ::= frame_bound */
181824
+ -2, /* (332) frame_bound_e ::= UNBOUNDED FOLLOWING */
181825
+ -2, /* (333) frame_bound ::= expr PRECEDING|FOLLOWING */
181826
+ -2, /* (334) frame_bound ::= CURRENT ROW */
181827
+ 0, /* (335) frame_exclude_opt ::= */
181828
+ -2, /* (336) frame_exclude_opt ::= EXCLUDE frame_exclude */
181829
+ -2, /* (337) frame_exclude ::= NO OTHERS */
181830
+ -2, /* (338) frame_exclude ::= CURRENT ROW */
181831
+ -1, /* (339) frame_exclude ::= GROUP|TIES */
181832
+ -2, /* (340) window_clause ::= WINDOW windowdefn_list */
181833
+ -2, /* (341) filter_over ::= filter_clause over_clause */
181834
+ -1, /* (342) filter_over ::= over_clause */
181835
+ -1, /* (343) filter_over ::= filter_clause */
181836
+ -4, /* (344) over_clause ::= OVER LP window RP */
181837
+ -2, /* (345) over_clause ::= OVER nm */
181838
+ -5, /* (346) filter_clause ::= FILTER LP WHERE expr RP */
181839
+ -1, /* (347) term ::= QNUMBER */
181840
+ -1, /* (348) input ::= cmdlist */
181841
+ -2, /* (349) cmdlist ::= cmdlist ecmd */
181842
+ -1, /* (350) cmdlist ::= ecmd */
181843
+ -1, /* (351) ecmd ::= SEMI */
181844
+ -2, /* (352) ecmd ::= cmdx SEMI */
181845
+ -3, /* (353) ecmd ::= explain cmdx SEMI */
181846
+ 0, /* (354) trans_opt ::= */
181847
+ -1, /* (355) trans_opt ::= TRANSACTION */
181848
+ -2, /* (356) trans_opt ::= TRANSACTION nm */
181849
+ -1, /* (357) savepoint_opt ::= SAVEPOINT */
181850
+ 0, /* (358) savepoint_opt ::= */
181851
+ -2, /* (359) cmd ::= create_table create_table_args */
181852
+ -1, /* (360) table_option_set ::= table_option */
181853
+ -4, /* (361) columnlist ::= columnlist COMMA columnname carglist */
181854
+ -2, /* (362) columnlist ::= columnname carglist */
181855
+ -1, /* (363) nm ::= ID|INDEXED|JOIN_KW */
181856
+ -1, /* (364) nm ::= STRING */
181857
+ -1, /* (365) typetoken ::= typename */
181858
+ -1, /* (366) typename ::= ID|STRING */
181859
+ -1, /* (367) signed ::= plus_num */
181860
+ -1, /* (368) signed ::= minus_num */
181861
+ -2, /* (369) carglist ::= carglist ccons */
181862
+ 0, /* (370) carglist ::= */
181863
+ -2, /* (371) ccons ::= NULL onconf */
181864
+ -4, /* (372) ccons ::= GENERATED ALWAYS AS generated */
181865
+ -2, /* (373) ccons ::= AS generated */
181866
+ -2, /* (374) conslist_opt ::= COMMA conslist */
181867
+ -3, /* (375) conslist ::= conslist tconscomma tcons */
181868
+ -1, /* (376) conslist ::= tcons */
181869
+ 0, /* (377) tconscomma ::= */
181870
+ -1, /* (378) defer_subclause_opt ::= defer_subclause */
181871
+ -1, /* (379) resolvetype ::= raisetype */
181872
+ -1, /* (380) selectnowith ::= oneselect */
181873
+ -1, /* (381) oneselect ::= values */
181874
+ -2, /* (382) sclp ::= selcollist COMMA */
181875
+ -1, /* (383) as ::= ID|STRING */
181876
+ -1, /* (384) indexed_opt ::= indexed_by */
181877
+ 0, /* (385) returning ::= */
181878
+ -1, /* (386) expr ::= term */
181879
+ -1, /* (387) likeop ::= LIKE_KW|MATCH */
181880
+ -1, /* (388) case_operand ::= expr */
181881
+ -1, /* (389) exprlist ::= nexprlist */
181882
+ -1, /* (390) nmnum ::= plus_num */
181883
+ -1, /* (391) nmnum ::= nm */
181884
+ -1, /* (392) nmnum ::= ON */
181885
+ -1, /* (393) nmnum ::= DELETE */
181886
+ -1, /* (394) nmnum ::= DEFAULT */
181887
+ -1, /* (395) plus_num ::= INTEGER|FLOAT */
181888
+ 0, /* (396) foreach_clause ::= */
181889
+ -3, /* (397) foreach_clause ::= FOR EACH ROW */
181890
+ 0, /* (398) tridxby ::= */
181891
+ -1, /* (399) database_kw_opt ::= DATABASE */
181892
+ 0, /* (400) database_kw_opt ::= */
181893
+ 0, /* (401) kwcolumn_opt ::= */
181894
+ -1, /* (402) kwcolumn_opt ::= COLUMNKW */
181895
+ -1, /* (403) vtabarglist ::= vtabarg */
181896
+ -3, /* (404) vtabarglist ::= vtabarglist COMMA vtabarg */
181897
+ -2, /* (405) vtabarg ::= vtabarg vtabargtoken */
181898
+ 0, /* (406) anylist ::= */
181899
+ -4, /* (407) anylist ::= anylist LP anylist RP */
181900
+ -2, /* (408) anylist ::= anylist ANY */
181901
+ 0, /* (409) with ::= */
181902
+ -1, /* (410) windowdefn_list ::= windowdefn */
181903
+ -1, /* (411) window ::= frame_opt */
182027181904
};
182028181905
182029181906
static void yy_accept(yyParser*); /* Forward Declaration */
182030181907
182031181908
/*
@@ -182073,20 +181950,20 @@
182073181950
break;
182074181951
case 2: /* cmdx ::= cmd */
182075181952
{ sqlite3FinishCoding(pParse); }
182076181953
break;
182077181954
case 3: /* cmd ::= BEGIN transtype trans_opt */
182078
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy502);}
181955
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);}
182079181956
break;
182080181957
case 4: /* transtype ::= */
182081
-{yymsp[1].minor.yy502 = TK_DEFERRED;}
181958
+{yymsp[1].minor.yy144 = TK_DEFERRED;}
182082181959
break;
182083181960
case 5: /* transtype ::= DEFERRED */
182084181961
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
182085181962
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
182086
- case 329: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==329);
182087
-{yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/}
181963
+ case 328: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==328);
181964
+{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/}
182088181965
break;
182089181966
case 8: /* cmd ::= COMMIT|END trans_opt */
182090181967
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
182091181968
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
182092181969
break;
@@ -182105,11 +181982,11 @@
182105181982
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
182106181983
}
182107181984
break;
182108181985
case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
182109181986
{
182110
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy502,0,0,yymsp[-2].minor.yy502);
181987
+ sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144);
182111181988
}
182112181989
break;
182113181990
case 14: /* createkw ::= CREATE */
182114181991
{
182115181992
disableLookaside(pParse);
@@ -182121,56 +181998,56 @@
182121181998
case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
182122181999
case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
182123182000
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
182124182001
case 100: /* distinct ::= */ yytestcase(yyruleno==100);
182125182002
case 246: /* collate ::= */ yytestcase(yyruleno==246);
182126
-{yymsp[1].minor.yy502 = 0;}
182003
+{yymsp[1].minor.yy144 = 0;}
182127182004
break;
182128182005
case 16: /* ifnotexists ::= IF NOT EXISTS */
182129
-{yymsp[-2].minor.yy502 = 1;}
182006
+{yymsp[-2].minor.yy144 = 1;}
182130182007
break;
182131182008
case 17: /* temp ::= TEMP */
182132
-{yymsp[0].minor.yy502 = pParse->db->init.busy==0;}
182009
+{yymsp[0].minor.yy144 = pParse->db->init.busy==0;}
182133182010
break;
182134182011
case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
182135182012
{
182136
- sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy9,0);
182013
+ sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0);
182137182014
}
182138182015
break;
182139182016
case 20: /* create_table_args ::= AS select */
182140182017
{
182141
- sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy637);
182142
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy637);
182018
+ sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555);
182019
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
182143182020
}
182144182021
break;
182145182022
case 21: /* table_option_set ::= */
182146
-{yymsp[1].minor.yy9 = 0;}
182023
+{yymsp[1].minor.yy391 = 0;}
182147182024
break;
182148182025
case 22: /* table_option_set ::= table_option_set COMMA table_option */
182149
-{yylhsminor.yy9 = yymsp[-2].minor.yy9|yymsp[0].minor.yy9;}
182150
- yymsp[-2].minor.yy9 = yylhsminor.yy9;
182026
+{yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;}
182027
+ yymsp[-2].minor.yy391 = yylhsminor.yy391;
182151182028
break;
182152182029
case 23: /* table_option ::= WITHOUT nm */
182153182030
{
182154182031
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
182155
- yymsp[-1].minor.yy9 = TF_WithoutRowid | TF_NoVisibleRowid;
182032
+ yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid;
182156182033
}else{
182157
- yymsp[-1].minor.yy9 = 0;
182034
+ yymsp[-1].minor.yy391 = 0;
182158182035
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
182159182036
}
182160182037
}
182161182038
break;
182162182039
case 24: /* table_option ::= nm */
182163182040
{
182164182041
if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
182165
- yylhsminor.yy9 = TF_Strict;
182042
+ yylhsminor.yy391 = TF_Strict;
182166182043
}else{
182167
- yylhsminor.yy9 = 0;
182044
+ yylhsminor.yy391 = 0;
182168182045
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
182169182046
}
182170182047
}
182171
- yymsp[0].minor.yy9 = yylhsminor.yy9;
182048
+ yymsp[0].minor.yy391 = yylhsminor.yy391;
182172182049
break;
182173182050
case 25: /* columnname ::= nm typetoken */
182174182051
{sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
182175182052
break;
182176182053
case 26: /* typetoken ::= */
@@ -182192,11 +182069,11 @@
182192182069
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
182193182070
break;
182194182071
case 30: /* scanpt ::= */
182195182072
{
182196182073
assert( yyLookahead!=YYNOCODE );
182197
- yymsp[1].minor.yy342 = yyLookaheadToken.z;
182074
+ yymsp[1].minor.yy168 = yyLookaheadToken.z;
182198182075
}
182199182076
break;
182200182077
case 31: /* scantok ::= */
182201182078
{
182202182079
assert( yyLookahead!=YYNOCODE );
@@ -182206,21 +182083,21 @@
182206182083
case 32: /* ccons ::= CONSTRAINT nm */
182207182084
case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
182208182085
{ASSERT_IS_CREATE; pParse->u1.cr.constraintName = yymsp[0].minor.yy0;}
182209182086
break;
182210182087
case 33: /* ccons ::= DEFAULT scantok term */
182211
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy590,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182088
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182212182089
break;
182213182090
case 34: /* ccons ::= DEFAULT LP expr RP */
182214
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy590,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
182091
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
182215182092
break;
182216182093
case 35: /* ccons ::= DEFAULT PLUS scantok term */
182217
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy590,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182094
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182218182095
break;
182219182096
case 36: /* ccons ::= DEFAULT MINUS scantok term */
182220182097
{
182221
- Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy590, 0);
182098
+ Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0);
182222182099
sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
182223182100
}
182224182101
break;
182225182102
case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
182226182103
{
@@ -182231,262 +182108,262 @@
182231182108
}
182232182109
sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
182233182110
}
182234182111
break;
182235182112
case 38: /* ccons ::= NOT NULL onconf */
182236
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy502);}
182113
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);}
182237182114
break;
182238182115
case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
182239
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy502,yymsp[0].minor.yy502,yymsp[-2].minor.yy502);}
182116
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);}
182240182117
break;
182241182118
case 40: /* ccons ::= UNIQUE onconf */
182242
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy502,0,0,0,0,
182119
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0,
182243182120
SQLITE_IDXTYPE_UNIQUE);}
182244182121
break;
182245182122
case 41: /* ccons ::= CHECK LP expr RP */
182246
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy590,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
182123
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
182247182124
break;
182248182125
case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
182249
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy402,yymsp[0].minor.yy502);}
182126
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);}
182250182127
break;
182251182128
case 43: /* ccons ::= defer_subclause */
182252
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy502);}
182129
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);}
182253182130
break;
182254182131
case 44: /* ccons ::= COLLATE ID|STRING */
182255182132
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
182256182133
break;
182257182134
case 45: /* generated ::= LP expr RP */
182258
-{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy590,0);}
182135
+{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);}
182259182136
break;
182260182137
case 46: /* generated ::= LP expr RP ID */
182261
-{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy590,&yymsp[0].minor.yy0);}
182138
+{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);}
182262182139
break;
182263182140
case 48: /* autoinc ::= AUTOINCR */
182264
-{yymsp[0].minor.yy502 = 1;}
182141
+{yymsp[0].minor.yy144 = 1;}
182265182142
break;
182266182143
case 49: /* refargs ::= */
182267
-{ yymsp[1].minor.yy502 = OE_None*0x0101; /* EV: R-19803-45884 */}
182144
+{ yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */}
182268182145
break;
182269182146
case 50: /* refargs ::= refargs refarg */
182270
-{ yymsp[-1].minor.yy502 = (yymsp[-1].minor.yy502 & ~yymsp[0].minor.yy481.mask) | yymsp[0].minor.yy481.value; }
182147
+{ yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; }
182271182148
break;
182272182149
case 51: /* refarg ::= MATCH nm */
182273
-{ yymsp[-1].minor.yy481.value = 0; yymsp[-1].minor.yy481.mask = 0x000000; }
182150
+{ yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; }
182274182151
break;
182275182152
case 52: /* refarg ::= ON INSERT refact */
182276
-{ yymsp[-2].minor.yy481.value = 0; yymsp[-2].minor.yy481.mask = 0x000000; }
182153
+{ yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; }
182277182154
break;
182278182155
case 53: /* refarg ::= ON DELETE refact */
182279
-{ yymsp[-2].minor.yy481.value = yymsp[0].minor.yy502; yymsp[-2].minor.yy481.mask = 0x0000ff; }
182156
+{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; }
182280182157
break;
182281182158
case 54: /* refarg ::= ON UPDATE refact */
182282
-{ yymsp[-2].minor.yy481.value = yymsp[0].minor.yy502<<8; yymsp[-2].minor.yy481.mask = 0x00ff00; }
182159
+{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; }
182283182160
break;
182284182161
case 55: /* refact ::= SET NULL */
182285
-{ yymsp[-1].minor.yy502 = OE_SetNull; /* EV: R-33326-45252 */}
182162
+{ yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */}
182286182163
break;
182287182164
case 56: /* refact ::= SET DEFAULT */
182288
-{ yymsp[-1].minor.yy502 = OE_SetDflt; /* EV: R-33326-45252 */}
182165
+{ yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */}
182289182166
break;
182290182167
case 57: /* refact ::= CASCADE */
182291
-{ yymsp[0].minor.yy502 = OE_Cascade; /* EV: R-33326-45252 */}
182168
+{ yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */}
182292182169
break;
182293182170
case 58: /* refact ::= RESTRICT */
182294
-{ yymsp[0].minor.yy502 = OE_Restrict; /* EV: R-33326-45252 */}
182171
+{ yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */}
182295182172
break;
182296182173
case 59: /* refact ::= NO ACTION */
182297
-{ yymsp[-1].minor.yy502 = OE_None; /* EV: R-33326-45252 */}
182174
+{ yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */}
182298182175
break;
182299182176
case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
182300
-{yymsp[-2].minor.yy502 = 0;}
182177
+{yymsp[-2].minor.yy144 = 0;}
182301182178
break;
182302182179
case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
182303182180
case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
182304182181
case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
182305
-{yymsp[-1].minor.yy502 = yymsp[0].minor.yy502;}
182182
+{yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;}
182306182183
break;
182307182184
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
182308182185
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
182309182186
case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
182310182187
case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
182311182188
case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
182312
-{yymsp[-1].minor.yy502 = 1;}
182189
+{yymsp[-1].minor.yy144 = 1;}
182313182190
break;
182314182191
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
182315
-{yymsp[-1].minor.yy502 = 0;}
182192
+{yymsp[-1].minor.yy144 = 0;}
182316182193
break;
182317182194
case 66: /* tconscomma ::= COMMA */
182318182195
{ASSERT_IS_CREATE; pParse->u1.cr.constraintName.n = 0;}
182319182196
break;
182320182197
case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
182321
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy402,yymsp[0].minor.yy502,yymsp[-2].minor.yy502,0);}
182198
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);}
182322182199
break;
182323182200
case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
182324
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy402,yymsp[0].minor.yy502,0,0,0,0,
182201
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0,
182325182202
SQLITE_IDXTYPE_UNIQUE);}
182326182203
break;
182327182204
case 70: /* tcons ::= CHECK LP expr RP onconf */
182328
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy590,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
182205
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
182329182206
break;
182330182207
case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
182331182208
{
182332
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy402, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy402, yymsp[-1].minor.yy502);
182333
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy502);
182209
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144);
182210
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144);
182334182211
}
182335182212
break;
182336182213
case 73: /* onconf ::= */
182337182214
case 75: /* orconf ::= */ yytestcase(yyruleno==75);
182338
-{yymsp[1].minor.yy502 = OE_Default;}
182215
+{yymsp[1].minor.yy144 = OE_Default;}
182339182216
break;
182340182217
case 74: /* onconf ::= ON CONFLICT resolvetype */
182341
-{yymsp[-2].minor.yy502 = yymsp[0].minor.yy502;}
182218
+{yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;}
182342182219
break;
182343182220
case 77: /* resolvetype ::= IGNORE */
182344
-{yymsp[0].minor.yy502 = OE_Ignore;}
182221
+{yymsp[0].minor.yy144 = OE_Ignore;}
182345182222
break;
182346182223
case 78: /* resolvetype ::= REPLACE */
182347182224
case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
182348
-{yymsp[0].minor.yy502 = OE_Replace;}
182225
+{yymsp[0].minor.yy144 = OE_Replace;}
182349182226
break;
182350182227
case 79: /* cmd ::= DROP TABLE ifexists fullname */
182351182228
{
182352
- sqlite3DropTable(pParse, yymsp[0].minor.yy563, 0, yymsp[-1].minor.yy502);
182229
+ sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144);
182353182230
}
182354182231
break;
182355182232
case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
182356182233
{
182357
- sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy402, yymsp[0].minor.yy637, yymsp[-7].minor.yy502, yymsp[-5].minor.yy502);
182234
+ sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144);
182358182235
}
182359182236
break;
182360182237
case 83: /* cmd ::= DROP VIEW ifexists fullname */
182361182238
{
182362
- sqlite3DropTable(pParse, yymsp[0].minor.yy563, 1, yymsp[-1].minor.yy502);
182239
+ sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144);
182363182240
}
182364182241
break;
182365182242
case 84: /* cmd ::= select */
182366182243
{
182367182244
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
182368182245
if( (pParse->db->mDbFlags & DBFLAG_EncodingFixed)!=0
182369182246
|| sqlite3ReadSchema(pParse)==SQLITE_OK
182370182247
){
182371
- sqlite3Select(pParse, yymsp[0].minor.yy637, &dest);
182248
+ sqlite3Select(pParse, yymsp[0].minor.yy555, &dest);
182372182249
}
182373
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy637);
182250
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
182374182251
}
182375182252
break;
182376182253
case 85: /* select ::= WITH wqlist selectnowith */
182377
-{yymsp[-2].minor.yy637 = attachWithToSelect(pParse,yymsp[0].minor.yy637,yymsp[-1].minor.yy125);}
182254
+{yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
182378182255
break;
182379182256
case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
182380
-{yymsp[-3].minor.yy637 = attachWithToSelect(pParse,yymsp[0].minor.yy637,yymsp[-1].minor.yy125);}
182257
+{yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
182381182258
break;
182382182259
case 87: /* select ::= selectnowith */
182383182260
{
182384
- Select *p = yymsp[0].minor.yy637;
182261
+ Select *p = yymsp[0].minor.yy555;
182385182262
if( p ){
182386182263
parserDoubleLinkSelect(pParse, p);
182387182264
}
182388182265
}
182389182266
break;
182390182267
case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
182391182268
{
182392
- Select *pRhs = yymsp[0].minor.yy637;
182393
- Select *pLhs = yymsp[-2].minor.yy637;
182269
+ Select *pRhs = yymsp[0].minor.yy555;
182270
+ Select *pLhs = yymsp[-2].minor.yy555;
182394182271
if( pRhs && pRhs->pPrior ){
182395182272
SrcList *pFrom;
182396182273
Token x;
182397182274
x.n = 0;
182398182275
parserDoubleLinkSelect(pParse, pRhs);
182399182276
pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0);
182400182277
pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
182401182278
}
182402182279
if( pRhs ){
182403
- pRhs->op = (u8)yymsp[-1].minor.yy502;
182280
+ pRhs->op = (u8)yymsp[-1].minor.yy144;
182404182281
pRhs->pPrior = pLhs;
182405182282
if( ALWAYS(pLhs) ) pLhs->selFlags &= ~(u32)SF_MultiValue;
182406182283
pRhs->selFlags &= ~(u32)SF_MultiValue;
182407
- if( yymsp[-1].minor.yy502!=TK_ALL ) pParse->hasCompound = 1;
182284
+ if( yymsp[-1].minor.yy144!=TK_ALL ) pParse->hasCompound = 1;
182408182285
}else{
182409182286
sqlite3SelectDelete(pParse->db, pLhs);
182410182287
}
182411
- yymsp[-2].minor.yy637 = pRhs;
182288
+ yymsp[-2].minor.yy555 = pRhs;
182412182289
}
182413182290
break;
182414182291
case 89: /* multiselect_op ::= UNION */
182415182292
case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
182416
-{yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-OP*/}
182293
+{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/}
182417182294
break;
182418182295
case 90: /* multiselect_op ::= UNION ALL */
182419
-{yymsp[-1].minor.yy502 = TK_ALL;}
182296
+{yymsp[-1].minor.yy144 = TK_ALL;}
182420182297
break;
182421182298
case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
182422182299
{
182423
- yymsp[-8].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy402,yymsp[-5].minor.yy563,yymsp[-4].minor.yy590,yymsp[-3].minor.yy402,yymsp[-2].minor.yy590,yymsp[-1].minor.yy402,yymsp[-7].minor.yy502,yymsp[0].minor.yy590);
182300
+ yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454);
182424182301
}
182425182302
break;
182426182303
case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
182427182304
{
182428
- yymsp[-9].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy402,yymsp[-6].minor.yy563,yymsp[-5].minor.yy590,yymsp[-4].minor.yy402,yymsp[-3].minor.yy590,yymsp[-1].minor.yy402,yymsp[-8].minor.yy502,yymsp[0].minor.yy590);
182429
- if( yymsp[-9].minor.yy637 ){
182430
- yymsp[-9].minor.yy637->pWinDefn = yymsp[-2].minor.yy483;
182305
+ yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454);
182306
+ if( yymsp[-9].minor.yy555 ){
182307
+ yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211;
182431182308
}else{
182432
- sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy483);
182309
+ sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211);
182433182310
}
182434182311
}
182435182312
break;
182436182313
case 94: /* values ::= VALUES LP nexprlist RP */
182437182314
{
182438
- yymsp[-3].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy402,0,0,0,0,0,SF_Values,0);
182315
+ yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0);
182439182316
}
182440182317
break;
182441182318
case 95: /* oneselect ::= mvalues */
182442182319
{
182443
- sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy637);
182320
+ sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555);
182444182321
}
182445182322
break;
182446182323
case 96: /* mvalues ::= values COMMA LP nexprlist RP */
182447182324
case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
182448182325
{
182449
- yymsp[-4].minor.yy637 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy637, yymsp[-1].minor.yy402);
182326
+ yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14);
182450182327
}
182451182328
break;
182452182329
case 98: /* distinct ::= DISTINCT */
182453
-{yymsp[0].minor.yy502 = SF_Distinct;}
182330
+{yymsp[0].minor.yy144 = SF_Distinct;}
182454182331
break;
182455182332
case 99: /* distinct ::= ALL */
182456
-{yymsp[0].minor.yy502 = SF_All;}
182333
+{yymsp[0].minor.yy144 = SF_All;}
182457182334
break;
182458182335
case 101: /* sclp ::= */
182459182336
case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
182460182337
case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144);
182461182338
case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
182462182339
case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
182463182340
case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
182464
-{yymsp[1].minor.yy402 = 0;}
182341
+{yymsp[1].minor.yy14 = 0;}
182465182342
break;
182466182343
case 102: /* selcollist ::= sclp scanpt expr scanpt as */
182467182344
{
182468
- yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy402, yymsp[-2].minor.yy590);
182469
- if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy402, &yymsp[0].minor.yy0, 1);
182470
- sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy402,yymsp[-3].minor.yy342,yymsp[-1].minor.yy342);
182345
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
182346
+ if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1);
182347
+ sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168);
182471182348
}
182472182349
break;
182473182350
case 103: /* selcollist ::= sclp scanpt STAR */
182474182351
{
182475182352
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
182476182353
sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
182477
- yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy402, p);
182354
+ yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p);
182478182355
}
182479182356
break;
182480182357
case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
182481182358
{
182482182359
Expr *pRight, *pLeft, *pDot;
182483182360
pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
182484182361
sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
182485182362
pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
182486182363
pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
182487
- yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, pDot);
182364
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot);
182488182365
}
182489182366
break;
182490182367
case 105: /* as ::= AS nm */
182491182368
case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117);
182492182369
case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258);
@@ -182493,54 +182370,54 @@
182493182370
case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259);
182494182371
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
182495182372
break;
182496182373
case 107: /* from ::= */
182497182374
case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
182498
-{yymsp[1].minor.yy563 = 0;}
182375
+{yymsp[1].minor.yy203 = 0;}
182499182376
break;
182500182377
case 108: /* from ::= FROM seltablist */
182501182378
{
182502
- yymsp[-1].minor.yy563 = yymsp[0].minor.yy563;
182503
- sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy563);
182379
+ yymsp[-1].minor.yy203 = yymsp[0].minor.yy203;
182380
+ sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203);
182504182381
}
182505182382
break;
182506182383
case 109: /* stl_prefix ::= seltablist joinop */
182507182384
{
182508
- if( ALWAYS(yymsp[-1].minor.yy563 && yymsp[-1].minor.yy563->nSrc>0) ) yymsp[-1].minor.yy563->a[yymsp[-1].minor.yy563->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy502;
182385
+ if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144;
182509182386
}
182510182387
break;
182511182388
case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
182512182389
{
182513
- yymsp[-4].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy563,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
182390
+ yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
182514182391
}
182515182392
break;
182516182393
case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
182517182394
{
182518
- yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy421);
182519
- sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy563, &yymsp[-1].minor.yy0);
182395
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269);
182396
+ sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0);
182520182397
}
182521182398
break;
182522182399
case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
182523182400
{
182524
- yymsp[-7].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy563,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
182525
- sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy563, yymsp[-3].minor.yy402);
182401
+ yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
182402
+ sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14);
182526182403
}
182527182404
break;
182528182405
case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
182529182406
{
182530
- yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy637,&yymsp[0].minor.yy421);
182407
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269);
182531182408
}
182532182409
break;
182533182410
case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
182534182411
{
182535
- if( yymsp[-5].minor.yy563==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy421.pOn==0 && yymsp[0].minor.yy421.pUsing==0 ){
182536
- yymsp[-5].minor.yy563 = yymsp[-3].minor.yy563;
182537
- }else if( ALWAYS(yymsp[-3].minor.yy563!=0) && yymsp[-3].minor.yy563->nSrc==1 ){
182538
- yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
182539
- if( yymsp[-5].minor.yy563 ){
182540
- SrcItem *pNew = &yymsp[-5].minor.yy563->a[yymsp[-5].minor.yy563->nSrc-1];
182541
- SrcItem *pOld = yymsp[-3].minor.yy563->a;
182412
+ if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){
182413
+ yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203;
182414
+ }else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){
182415
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
182416
+ if( yymsp[-5].minor.yy203 ){
182417
+ SrcItem *pNew = &yymsp[-5].minor.yy203->a[yymsp[-5].minor.yy203->nSrc-1];
182418
+ SrcItem *pOld = yymsp[-3].minor.yy203->a;
182542182419
assert( pOld->fg.fixedSchema==0 );
182543182420
pNew->zName = pOld->zName;
182544182421
assert( pOld->fg.fixedSchema==0 );
182545182422
if( pOld->fg.isSubquery ){
182546182423
pNew->fg.isSubquery = 1;
@@ -182561,249 +182438,259 @@
182561182438
pOld->fg.isTabFunc = 0;
182562182439
pNew->fg.isTabFunc = 1;
182563182440
}
182564182441
pOld->zName = 0;
182565182442
}
182566
- sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy563);
182443
+ sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy203);
182567182444
}else{
182568182445
Select *pSubquery;
182569
- sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy563);
182570
- pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy563,0,0,0,0,SF_NestedFrom,0);
182571
- yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy421);
182446
+ sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203);
182447
+ pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0);
182448
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269);
182572182449
}
182573182450
}
182574182451
break;
182575182452
case 116: /* dbnm ::= */
182576182453
case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131);
182577182454
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
182578182455
break;
182579182456
case 118: /* fullname ::= nm */
182457
+ case 120: /* xfullname ::= nm */ yytestcase(yyruleno==120);
182580182458
{
182581
- yylhsminor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
182582
- if( IN_RENAME_OBJECT && yylhsminor.yy563 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy563->a[0].zName, &yymsp[0].minor.yy0);
182459
+ yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
182460
+ if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
182583182461
}
182584
- yymsp[0].minor.yy563 = yylhsminor.yy563;
182462
+ yymsp[0].minor.yy203 = yylhsminor.yy203;
182585182463
break;
182586182464
case 119: /* fullname ::= nm DOT nm */
182587
-{
182588
- yylhsminor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
182589
- if( IN_RENAME_OBJECT && yylhsminor.yy563 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy563->a[0].zName, &yymsp[0].minor.yy0);
182590
-}
182591
- yymsp[-2].minor.yy563 = yylhsminor.yy563;
182592
- break;
182593
- case 120: /* xfullname ::= nm */
182594
-{yymsp[0].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
182595
- break;
182596
- case 121: /* xfullname ::= nm DOT nm */
182597
-{yymsp[-2].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
182598
- break;
182599
- case 122: /* xfullname ::= nm DOT nm AS nm */
182600
-{
182601
- yymsp[-4].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
182602
- if( yymsp[-4].minor.yy563 ) yymsp[-4].minor.yy563->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182603
-}
182604
- break;
182605
- case 123: /* xfullname ::= nm AS nm */
182606
-{
182607
- yymsp[-2].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
182608
- if( yymsp[-2].minor.yy563 ) yymsp[-2].minor.yy563->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182609
-}
182465
+ case 121: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==121);
182466
+{
182467
+ yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
182468
+ if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
182469
+}
182470
+ yymsp[-2].minor.yy203 = yylhsminor.yy203;
182471
+ break;
182472
+ case 122: /* xfullname ::= nm AS nm */
182473
+{
182474
+ yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0);
182475
+ if( yylhsminor.yy203 ){
182476
+ if( IN_RENAME_OBJECT ){
182477
+ sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[-2].minor.yy0);
182478
+ }else{
182479
+ yylhsminor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182480
+ }
182481
+ }
182482
+}
182483
+ yymsp[-2].minor.yy203 = yylhsminor.yy203;
182484
+ break;
182485
+ case 123: /* xfullname ::= nm DOT nm AS nm */
182486
+{
182487
+ yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0);
182488
+ if( yylhsminor.yy203 ){
182489
+ if( IN_RENAME_OBJECT ){
182490
+ sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[-2].minor.yy0);
182491
+ }else{
182492
+ yylhsminor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182493
+ }
182494
+ }
182495
+}
182496
+ yymsp[-4].minor.yy203 = yylhsminor.yy203;
182610182497
break;
182611182498
case 124: /* joinop ::= COMMA|JOIN */
182612
-{ yymsp[0].minor.yy502 = JT_INNER; }
182499
+{ yymsp[0].minor.yy144 = JT_INNER; }
182613182500
break;
182614182501
case 125: /* joinop ::= JOIN_KW JOIN */
182615
-{yymsp[-1].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
182502
+{yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
182616182503
break;
182617182504
case 126: /* joinop ::= JOIN_KW nm JOIN */
182618
-{yymsp[-2].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
182505
+{yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
182619182506
break;
182620182507
case 127: /* joinop ::= JOIN_KW nm nm JOIN */
182621
-{yymsp[-3].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
182508
+{yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
182622182509
break;
182623182510
case 128: /* on_using ::= ON expr */
182624
-{yymsp[-1].minor.yy421.pOn = yymsp[0].minor.yy590; yymsp[-1].minor.yy421.pUsing = 0;}
182511
+{yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;}
182625182512
break;
182626182513
case 129: /* on_using ::= USING LP idlist RP */
182627
-{yymsp[-3].minor.yy421.pOn = 0; yymsp[-3].minor.yy421.pUsing = yymsp[-1].minor.yy204;}
182514
+{yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;}
182628182515
break;
182629182516
case 130: /* on_using ::= */
182630
-{yymsp[1].minor.yy421.pOn = 0; yymsp[1].minor.yy421.pUsing = 0;}
182517
+{yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;}
182631182518
break;
182632182519
case 132: /* indexed_by ::= INDEXED BY nm */
182633182520
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
182634182521
break;
182635182522
case 133: /* indexed_by ::= NOT INDEXED */
182636182523
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
182637182524
break;
182638182525
case 135: /* orderby_opt ::= ORDER BY sortlist */
182639182526
case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
182640
-{yymsp[-2].minor.yy402 = yymsp[0].minor.yy402;}
182527
+{yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;}
182641182528
break;
182642182529
case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
182643182530
{
182644
- yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402,yymsp[-2].minor.yy590);
182645
- sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy402,yymsp[-1].minor.yy502,yymsp[0].minor.yy502);
182531
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454);
182532
+ sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
182646182533
}
182647182534
break;
182648182535
case 137: /* sortlist ::= expr sortorder nulls */
182649182536
{
182650
- yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy590); /*A-overwrites-Y*/
182651
- sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy402,yymsp[-1].minor.yy502,yymsp[0].minor.yy502);
182537
+ yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/
182538
+ sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
182652182539
}
182653182540
break;
182654182541
case 138: /* sortorder ::= ASC */
182655
-{yymsp[0].minor.yy502 = SQLITE_SO_ASC;}
182542
+{yymsp[0].minor.yy144 = SQLITE_SO_ASC;}
182656182543
break;
182657182544
case 139: /* sortorder ::= DESC */
182658
-{yymsp[0].minor.yy502 = SQLITE_SO_DESC;}
182545
+{yymsp[0].minor.yy144 = SQLITE_SO_DESC;}
182659182546
break;
182660182547
case 140: /* sortorder ::= */
182661182548
case 143: /* nulls ::= */ yytestcase(yyruleno==143);
182662
-{yymsp[1].minor.yy502 = SQLITE_SO_UNDEFINED;}
182549
+{yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;}
182663182550
break;
182664182551
case 141: /* nulls ::= NULLS FIRST */
182665
-{yymsp[-1].minor.yy502 = SQLITE_SO_ASC;}
182552
+{yymsp[-1].minor.yy144 = SQLITE_SO_ASC;}
182666182553
break;
182667182554
case 142: /* nulls ::= NULLS LAST */
182668
-{yymsp[-1].minor.yy502 = SQLITE_SO_DESC;}
182555
+{yymsp[-1].minor.yy144 = SQLITE_SO_DESC;}
182669182556
break;
182670182557
case 146: /* having_opt ::= */
182671182558
case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
182672182559
case 153: /* where_opt ::= */ yytestcase(yyruleno==153);
182673182560
case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155);
182674182561
case 232: /* case_else ::= */ yytestcase(yyruleno==232);
182675182562
case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
182676182563
case 252: /* vinto ::= */ yytestcase(yyruleno==252);
182677
-{yymsp[1].minor.yy590 = 0;}
182564
+{yymsp[1].minor.yy454 = 0;}
182678182565
break;
182679182566
case 147: /* having_opt ::= HAVING expr */
182680182567
case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
182681182568
case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
182682182569
case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
182683182570
case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
182684
-{yymsp[-1].minor.yy590 = yymsp[0].minor.yy590;}
182571
+{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
182685182572
break;
182686182573
case 149: /* limit_opt ::= LIMIT expr */
182687
-{yymsp[-1].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy590,0);}
182574
+{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);}
182688182575
break;
182689182576
case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
182690
-{yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
182577
+{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
182691182578
break;
182692182579
case 151: /* limit_opt ::= LIMIT expr COMMA expr */
182693
-{yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy590,yymsp[-2].minor.yy590);}
182580
+{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);}
182694182581
break;
182695182582
case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
182696182583
{
182697
- sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy563, &yymsp[-1].minor.yy0);
182698
- sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy563,yymsp[0].minor.yy590,0,0);
182584
+ sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0);
182585
+ sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0);
182699182586
}
182700182587
break;
182701182588
case 157: /* where_opt_ret ::= RETURNING selcollist */
182702
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy402); yymsp[-1].minor.yy590 = 0;}
182589
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;}
182703182590
break;
182704182591
case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
182705
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy402); yymsp[-3].minor.yy590 = yymsp[-2].minor.yy590;}
182592
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;}
182706182593
break;
182707182594
case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
182708182595
{
182709
- sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy563, &yymsp[-4].minor.yy0);
182710
- sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy402,"set list");
182711
- if( yymsp[-1].minor.yy563 ){
182712
- SrcList *pFromClause = yymsp[-1].minor.yy563;
182596
+ sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0);
182597
+ sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list");
182598
+ if( yymsp[-1].minor.yy203 ){
182599
+ SrcList *pFromClause = yymsp[-1].minor.yy203;
182713182600
if( pFromClause->nSrc>1 ){
182714182601
Select *pSubquery;
182715182602
Token as;
182716182603
pSubquery = sqlite3SelectNew(pParse,0,pFromClause,0,0,0,0,SF_NestedFrom,0);
182717182604
as.n = 0;
182718182605
as.z = 0;
182719182606
pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
182720182607
}
182721
- yymsp[-5].minor.yy563 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy563, pFromClause);
182608
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause);
182722182609
}
182723
- sqlite3Update(pParse,yymsp[-5].minor.yy563,yymsp[-2].minor.yy402,yymsp[0].minor.yy590,yymsp[-6].minor.yy502,0,0,0);
182610
+ sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0);
182724182611
}
182725182612
break;
182726182613
case 160: /* setlist ::= setlist COMMA nm EQ expr */
182727182614
{
182728
- yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy402, yymsp[0].minor.yy590);
182729
- sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy402, &yymsp[-2].minor.yy0, 1);
182615
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
182616
+ sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1);
182730182617
}
182731182618
break;
182732182619
case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
182733182620
{
182734
- yymsp[-6].minor.yy402 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy402, yymsp[-3].minor.yy204, yymsp[0].minor.yy590);
182621
+ yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
182735182622
}
182736182623
break;
182737182624
case 162: /* setlist ::= nm EQ expr */
182738182625
{
182739
- yylhsminor.yy402 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy590);
182740
- sqlite3ExprListSetName(pParse, yylhsminor.yy402, &yymsp[-2].minor.yy0, 1);
182626
+ yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454);
182627
+ sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1);
182741182628
}
182742
- yymsp[-2].minor.yy402 = yylhsminor.yy402;
182629
+ yymsp[-2].minor.yy14 = yylhsminor.yy14;
182743182630
break;
182744182631
case 163: /* setlist ::= LP idlist RP EQ expr */
182745182632
{
182746
- yymsp[-4].minor.yy402 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy204, yymsp[0].minor.yy590);
182633
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
182747182634
}
182748182635
break;
182749182636
case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
182750182637
{
182751
- sqlite3Insert(pParse, yymsp[-3].minor.yy563, yymsp[-1].minor.yy637, yymsp[-2].minor.yy204, yymsp[-5].minor.yy502, yymsp[0].minor.yy403);
182638
+ sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122);
182752182639
}
182753182640
break;
182754182641
case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
182755182642
{
182756
- sqlite3Insert(pParse, yymsp[-4].minor.yy563, 0, yymsp[-3].minor.yy204, yymsp[-6].minor.yy502, 0);
182643
+ sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0);
182757182644
}
182758182645
break;
182759182646
case 166: /* upsert ::= */
182760
-{ yymsp[1].minor.yy403 = 0; }
182647
+{ yymsp[1].minor.yy122 = 0; }
182761182648
break;
182762182649
case 167: /* upsert ::= RETURNING selcollist */
182763
-{ yymsp[-1].minor.yy403 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy402); }
182650
+{ yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); }
182764182651
break;
182765182652
case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
182766
-{ yymsp[-11].minor.yy403 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy402,yymsp[-6].minor.yy590,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590,yymsp[0].minor.yy403);}
182653
+{ yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);}
182767182654
break;
182768182655
case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
182769
-{ yymsp[-8].minor.yy403 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy402,yymsp[-3].minor.yy590,0,0,yymsp[0].minor.yy403); }
182656
+{ yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); }
182770182657
break;
182771182658
case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
182772
-{ yymsp[-4].minor.yy403 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
182659
+{ yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
182773182660
break;
182774182661
case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
182775
-{ yymsp[-7].minor.yy403 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590,0);}
182662
+{ yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);}
182776182663
break;
182777182664
case 172: /* returning ::= RETURNING selcollist */
182778
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy402);}
182665
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy14);}
182779182666
break;
182780182667
case 175: /* idlist_opt ::= */
182781
-{yymsp[1].minor.yy204 = 0;}
182668
+{yymsp[1].minor.yy132 = 0;}
182782182669
break;
182783182670
case 176: /* idlist_opt ::= LP idlist RP */
182784
-{yymsp[-2].minor.yy204 = yymsp[-1].minor.yy204;}
182671
+{yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;}
182785182672
break;
182786182673
case 177: /* idlist ::= idlist COMMA nm */
182787
-{yymsp[-2].minor.yy204 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy204,&yymsp[0].minor.yy0);}
182674
+{yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);}
182788182675
break;
182789182676
case 178: /* idlist ::= nm */
182790
-{yymsp[0].minor.yy204 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
182677
+{yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
182791182678
break;
182792182679
case 179: /* expr ::= LP expr RP */
182793
-{yymsp[-2].minor.yy590 = yymsp[-1].minor.yy590;}
182680
+{yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;}
182794182681
break;
182795182682
case 180: /* expr ::= ID|INDEXED|JOIN_KW */
182796
-{yymsp[0].minor.yy590=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182683
+{yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182797182684
break;
182798182685
case 181: /* expr ::= nm DOT nm */
182799182686
{
182800182687
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
182801182688
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
182802
- yylhsminor.yy590 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
182689
+ yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
182803182690
}
182804
- yymsp[-2].minor.yy590 = yylhsminor.yy590;
182691
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
182805182692
break;
182806182693
case 182: /* expr ::= nm DOT nm DOT nm */
182807182694
{
182808182695
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
182809182696
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
@@ -182810,236 +182697,237 @@
182810182697
Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
182811182698
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
182812182699
if( IN_RENAME_OBJECT ){
182813182700
sqlite3RenameTokenRemap(pParse, 0, temp1);
182814182701
}
182815
- yylhsminor.yy590 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
182702
+ yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
182816182703
}
182817
- yymsp[-4].minor.yy590 = yylhsminor.yy590;
182704
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
182818182705
break;
182819182706
case 183: /* term ::= NULL|FLOAT|BLOB */
182820182707
case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
182821
-{yymsp[0].minor.yy590=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182708
+{yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182822182709
break;
182823182710
case 185: /* term ::= INTEGER */
182824182711
{
182825
- yylhsminor.yy590 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
182826
- if( yylhsminor.yy590 ) yylhsminor.yy590->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
182712
+ int iValue;
182713
+ if( sqlite3GetInt32(yymsp[0].minor.yy0.z, &iValue)==0 ){
182714
+ yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 0);
182715
+ }else{
182716
+ yylhsminor.yy454 = sqlite3ExprInt32(pParse->db, iValue);
182717
+ }
182718
+ if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
182827182719
}
182828
- yymsp[0].minor.yy590 = yylhsminor.yy590;
182720
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
182829182721
break;
182830182722
case 186: /* expr ::= VARIABLE */
182831182723
{
182832182724
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
182833182725
u32 n = yymsp[0].minor.yy0.n;
182834
- yymsp[0].minor.yy590 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
182835
- sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy590, n);
182726
+ yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
182727
+ sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n);
182836182728
}else{
182837182729
/* When doing a nested parse, one can include terms in an expression
182838182730
** that look like this: #1 #2 ... These terms refer to registers
182839182731
** in the virtual machine. #N is the N-th register. */
182840182732
Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
182841182733
assert( t.n>=2 );
182842182734
if( pParse->nested==0 ){
182843182735
parserSyntaxError(pParse, &t);
182844
- yymsp[0].minor.yy590 = 0;
182736
+ yymsp[0].minor.yy454 = 0;
182845182737
}else{
182846
- yymsp[0].minor.yy590 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
182847
- if( yymsp[0].minor.yy590 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy590->iTable);
182738
+ yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
182739
+ if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable);
182848182740
}
182849182741
}
182850182742
}
182851182743
break;
182852182744
case 187: /* expr ::= expr COLLATE ID|STRING */
182853182745
{
182854
- yymsp[-2].minor.yy590 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy590, &yymsp[0].minor.yy0, 1);
182746
+ yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1);
182855182747
}
182856182748
break;
182857182749
case 188: /* expr ::= CAST LP expr AS typetoken RP */
182858182750
{
182859
- yymsp[-5].minor.yy590 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
182860
- sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy590, yymsp[-3].minor.yy590, 0);
182751
+ yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
182752
+ sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0);
182861182753
}
182862182754
break;
182863182755
case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
182864182756
{
182865
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy402, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy502);
182757
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144);
182866182758
}
182867
- yymsp[-4].minor.yy590 = yylhsminor.yy590;
182759
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
182868182760
break;
182869182761
case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
182870182762
{
182871
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy402, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy502);
182872
- sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy590, yymsp[-1].minor.yy402);
182763
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144);
182764
+ sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14);
182873182765
}
182874
- yymsp[-7].minor.yy590 = yylhsminor.yy590;
182766
+ yymsp[-7].minor.yy454 = yylhsminor.yy454;
182875182767
break;
182876182768
case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
182877182769
{
182878
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
182770
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
182879182771
}
182880
- yymsp[-3].minor.yy590 = yylhsminor.yy590;
182772
+ yymsp[-3].minor.yy454 = yylhsminor.yy454;
182881182773
break;
182882182774
case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
182883182775
{
182884
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy402, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy502);
182885
- sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
182776
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144);
182777
+ sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
182886182778
}
182887
- yymsp[-5].minor.yy590 = yylhsminor.yy590;
182779
+ yymsp[-5].minor.yy454 = yylhsminor.yy454;
182888182780
break;
182889182781
case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
182890182782
{
182891
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy402, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy502);
182892
- sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
182893
- sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy590, yymsp[-2].minor.yy402);
182783
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144);
182784
+ sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
182785
+ sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14);
182894182786
}
182895
- yymsp[-8].minor.yy590 = yylhsminor.yy590;
182787
+ yymsp[-8].minor.yy454 = yylhsminor.yy454;
182896182788
break;
182897182789
case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
182898182790
{
182899
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
182900
- sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
182791
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
182792
+ sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
182901182793
}
182902
- yymsp[-4].minor.yy590 = yylhsminor.yy590;
182794
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
182903182795
break;
182904182796
case 195: /* term ::= CTIME_KW */
182905182797
{
182906
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
182798
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
182907182799
}
182908
- yymsp[0].minor.yy590 = yylhsminor.yy590;
182800
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
182909182801
break;
182910182802
case 196: /* expr ::= LP nexprlist COMMA expr RP */
182911182803
{
182912
- ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy402, yymsp[-1].minor.yy590);
182913
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
182914
- if( yymsp[-4].minor.yy590 ){
182915
- yymsp[-4].minor.yy590->x.pList = pList;
182804
+ ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454);
182805
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
182806
+ if( yymsp[-4].minor.yy454 ){
182807
+ yymsp[-4].minor.yy454->x.pList = pList;
182916182808
if( ALWAYS(pList->nExpr) ){
182917
- yymsp[-4].minor.yy590->flags |= pList->a[0].pExpr->flags & EP_Propagate;
182809
+ yymsp[-4].minor.yy454->flags |= pList->a[0].pExpr->flags & EP_Propagate;
182918182810
}
182919182811
}else{
182920182812
sqlite3ExprListDelete(pParse->db, pList);
182921182813
}
182922182814
}
182923182815
break;
182924182816
case 197: /* expr ::= expr AND expr */
182925
-{yymsp[-2].minor.yy590=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
182817
+{yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
182926182818
break;
182927182819
case 198: /* expr ::= expr OR expr */
182928182820
case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
182929182821
case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200);
182930182822
case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201);
182931182823
case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
182932182824
case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
182933182825
case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
182934
-{yymsp[-2].minor.yy590=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
182826
+{yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
182935182827
break;
182936182828
case 205: /* likeop ::= NOT LIKE_KW|MATCH */
182937182829
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
182938182830
break;
182939182831
case 206: /* expr ::= expr likeop expr */
182940182832
{
182941182833
ExprList *pList;
182942182834
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
182943182835
yymsp[-1].minor.yy0.n &= 0x7fffffff;
182944
- pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy590);
182945
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy590);
182946
- yymsp[-2].minor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
182947
- if( bNot ) yymsp[-2].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy590, 0);
182948
- if( yymsp[-2].minor.yy590 ) yymsp[-2].minor.yy590->flags |= EP_InfixFunc;
182836
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454);
182837
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454);
182838
+ yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
182839
+ if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0);
182840
+ if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc;
182949182841
}
182950182842
break;
182951182843
case 207: /* expr ::= expr likeop expr ESCAPE expr */
182952182844
{
182953182845
ExprList *pList;
182954182846
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
182955182847
yymsp[-3].minor.yy0.n &= 0x7fffffff;
182956
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
182957
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy590);
182958
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy590);
182959
- yymsp[-4].minor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
182960
- if( bNot ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
182961
- if( yymsp[-4].minor.yy590 ) yymsp[-4].minor.yy590->flags |= EP_InfixFunc;
182848
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
182849
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy454);
182850
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
182851
+ yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
182852
+ if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
182853
+ if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc;
182962182854
}
182963182855
break;
182964182856
case 208: /* expr ::= expr ISNULL|NOTNULL */
182965
-{yymsp[-1].minor.yy590 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy590,0);}
182857
+{yymsp[-1].minor.yy454 = sqlite3PExprIsNull(pParse,yymsp[0].major,yymsp[-1].minor.yy454);}
182966182858
break;
182967182859
case 209: /* expr ::= expr NOT NULL */
182968
-{yymsp[-2].minor.yy590 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy590,0);}
182860
+{yymsp[-2].minor.yy454 = sqlite3PExprIsNull(pParse,TK_NOTNULL,yymsp[-2].minor.yy454);}
182969182861
break;
182970182862
case 210: /* expr ::= expr IS expr */
182971182863
{
182972
- yymsp[-2].minor.yy590 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);
182973
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-2].minor.yy590, TK_ISNULL);
182864
+ yymsp[-2].minor.yy454 = sqlite3PExprIs(pParse, TK_IS, yymsp[-2].minor.yy454, yymsp[0].minor.yy454);
182974182865
}
182975182866
break;
182976182867
case 211: /* expr ::= expr IS NOT expr */
182977182868
{
182978
- yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy590,yymsp[0].minor.yy590);
182979
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-3].minor.yy590, TK_NOTNULL);
182869
+ yymsp[-3].minor.yy454 = sqlite3PExprIs(pParse, TK_ISNOT, yymsp[-3].minor.yy454, yymsp[0].minor.yy454);
182980182870
}
182981182871
break;
182982182872
case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
182983182873
{
182984
- yymsp[-5].minor.yy590 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy590,yymsp[0].minor.yy590);
182985
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-5].minor.yy590, TK_ISNULL);
182874
+ yymsp[-5].minor.yy454 = sqlite3PExprIs(pParse, TK_IS, yymsp[-5].minor.yy454, yymsp[0].minor.yy454);
182986182875
}
182987182876
break;
182988182877
case 213: /* expr ::= expr IS DISTINCT FROM expr */
182989182878
{
182990
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy590,yymsp[0].minor.yy590);
182991
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-4].minor.yy590, TK_NOTNULL);
182879
+ yymsp[-4].minor.yy454 = sqlite3PExprIs(pParse, TK_ISNOT, yymsp[-4].minor.yy454, yymsp[0].minor.yy454);
182992182880
}
182993182881
break;
182994182882
case 214: /* expr ::= NOT expr */
182995182883
case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
182996
-{yymsp[-1].minor.yy590 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy590, 0);/*A-overwrites-B*/}
182884
+{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/}
182997182885
break;
182998182886
case 216: /* expr ::= PLUS|MINUS expr */
182999182887
{
183000
- Expr *p = yymsp[0].minor.yy590;
182888
+ Expr *p = yymsp[0].minor.yy454;
183001182889
u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
183002182890
assert( TK_UPLUS>TK_PLUS );
183003182891
assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
183004182892
if( p && p->op==TK_UPLUS ){
183005182893
p->op = op;
183006
- yymsp[-1].minor.yy590 = p;
182894
+ yymsp[-1].minor.yy454 = p;
183007182895
}else{
183008
- yymsp[-1].minor.yy590 = sqlite3PExpr(pParse, op, p, 0);
182896
+ yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0);
183009182897
/*A-overwrites-B*/
183010182898
}
183011182899
}
183012182900
break;
183013182901
case 217: /* expr ::= expr PTR expr */
183014182902
{
183015
- ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy590);
183016
- pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy590);
183017
- yylhsminor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
182903
+ ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454);
182904
+ pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454);
182905
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
183018182906
}
183019
- yymsp[-2].minor.yy590 = yylhsminor.yy590;
182907
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
183020182908
break;
183021182909
case 218: /* between_op ::= BETWEEN */
183022182910
case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
183023
-{yymsp[0].minor.yy502 = 0;}
182911
+{yymsp[0].minor.yy144 = 0;}
183024182912
break;
183025182913
case 220: /* expr ::= expr between_op expr AND expr */
183026182914
{
183027
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
183028
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy590);
183029
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy590, 0);
183030
- if( yymsp[-4].minor.yy590 ){
183031
- yymsp[-4].minor.yy590->x.pList = pList;
182915
+ ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
182916
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
182917
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
182918
+ if( yymsp[-4].minor.yy454 ){
182919
+ yymsp[-4].minor.yy454->x.pList = pList;
183032182920
}else{
183033182921
sqlite3ExprListDelete(pParse->db, pList);
183034182922
}
183035
- if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
182923
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
183036182924
}
183037182925
break;
183038182926
case 223: /* expr ::= expr in_op LP exprlist RP */
183039182927
{
183040
- if( yymsp[-1].minor.yy402==0 ){
182928
+ if( yymsp[-1].minor.yy14==0 ){
183041182929
/* Expressions of the form
183042182930
**
183043182931
** expr1 IN ()
183044182932
** expr1 NOT IN ()
183045182933
**
@@ -183048,149 +182936,149 @@
183048182936
** Except, do not apply this optimization if expr1 contains a function
183049182937
** because that function might be an aggregate (we don't know yet whether
183050182938
** it is or not) and if it is an aggregate, that could change the meaning
183051182939
** of the whole query.
183052182940
*/
183053
- Expr *pB = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy502 ? "true" : "false");
182941
+ Expr *pB = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy144 ? "true" : "false");
183054182942
if( pB ) sqlite3ExprIdToTrueFalse(pB);
183055
- if( !ExprHasProperty(yymsp[-4].minor.yy590, EP_HasFunc) ){
183056
- sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy590);
183057
- yymsp[-4].minor.yy590 = pB;
182943
+ if( !ExprHasProperty(yymsp[-4].minor.yy454, EP_HasFunc) ){
182944
+ sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy454);
182945
+ yymsp[-4].minor.yy454 = pB;
183058182946
}else{
183059
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, yymsp[-3].minor.yy502 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy590);
182947
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, yymsp[-3].minor.yy144 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy454);
183060182948
}
183061182949
}else{
183062
- Expr *pRHS = yymsp[-1].minor.yy402->a[0].pExpr;
183063
- if( yymsp[-1].minor.yy402->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy590->op!=TK_VECTOR ){
183064
- yymsp[-1].minor.yy402->a[0].pExpr = 0;
183065
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
182950
+ Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr;
182951
+ if( yymsp[-1].minor.yy14->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy454->op!=TK_VECTOR ){
182952
+ yymsp[-1].minor.yy14->a[0].pExpr = 0;
182953
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
183066182954
pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
183067
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy590, pRHS);
183068
- }else if( yymsp[-1].minor.yy402->nExpr==1 && pRHS->op==TK_SELECT ){
183069
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183070
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pRHS->x.pSelect);
182955
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS);
182956
+ }else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){
182957
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
182958
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pRHS->x.pSelect);
183071182959
pRHS->x.pSelect = 0;
183072
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
182960
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
183073182961
}else{
183074
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183075
- if( yymsp[-4].minor.yy590==0 ){
183076
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
183077
- }else if( yymsp[-4].minor.yy590->pLeft->op==TK_VECTOR ){
183078
- int nExpr = yymsp[-4].minor.yy590->pLeft->x.pList->nExpr;
183079
- Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy402);
182962
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
182963
+ if( yymsp[-4].minor.yy454==0 ){
182964
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
182965
+ }else if( yymsp[-4].minor.yy454->pLeft->op==TK_VECTOR ){
182966
+ int nExpr = yymsp[-4].minor.yy454->pLeft->x.pList->nExpr;
182967
+ Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy14);
183080182968
if( pSelectRHS ){
183081182969
parserDoubleLinkSelect(pParse, pSelectRHS);
183082
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pSelectRHS);
182970
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelectRHS);
183083182971
}
183084182972
}else{
183085
- yymsp[-4].minor.yy590->x.pList = yymsp[-1].minor.yy402;
183086
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy590);
182973
+ yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy14;
182974
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
183087182975
}
183088182976
}
183089
- if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
182977
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
183090182978
}
183091182979
}
183092182980
break;
183093182981
case 224: /* expr ::= LP select RP */
183094182982
{
183095
- yymsp[-2].minor.yy590 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
183096
- sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy590, yymsp[-1].minor.yy637);
182983
+ yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
182984
+ sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555);
183097182985
}
183098182986
break;
183099182987
case 225: /* expr ::= expr in_op LP select RP */
183100182988
{
183101
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183102
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, yymsp[-1].minor.yy637);
183103
- if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
182989
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
182990
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555);
182991
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
183104182992
}
183105182993
break;
183106182994
case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
183107182995
{
183108182996
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
183109182997
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
183110
- if( yymsp[0].minor.yy402 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy402);
183111
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183112
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pSelect);
183113
- if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
182998
+ if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14);
182999
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
183000
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect);
183001
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
183114183002
}
183115183003
break;
183116183004
case 227: /* expr ::= EXISTS LP select RP */
183117183005
{
183118183006
Expr *p;
183119
- p = yymsp[-3].minor.yy590 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
183120
- sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy637);
183007
+ p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
183008
+ sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555);
183121183009
}
183122183010
break;
183123183011
case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
183124183012
{
183125
- yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy590, 0);
183126
- if( yymsp[-4].minor.yy590 ){
183127
- yymsp[-4].minor.yy590->x.pList = yymsp[-1].minor.yy590 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590) : yymsp[-2].minor.yy402;
183128
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy590);
183013
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0);
183014
+ if( yymsp[-4].minor.yy454 ){
183015
+ yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14;
183016
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
183129183017
}else{
183130
- sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy402);
183131
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy590);
183018
+ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14);
183019
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
183132183020
}
183133183021
}
183134183022
break;
183135183023
case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
183136183024
{
183137
- yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, yymsp[-2].minor.yy590);
183138
- yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, yymsp[0].minor.yy590);
183025
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
183026
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
183139183027
}
183140183028
break;
183141183029
case 230: /* case_exprlist ::= WHEN expr THEN expr */
183142183030
{
183143
- yymsp[-3].minor.yy402 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
183144
- yymsp[-3].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy402, yymsp[0].minor.yy590);
183031
+ yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
183032
+ yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454);
183145183033
}
183146183034
break;
183147183035
case 235: /* nexprlist ::= nexprlist COMMA expr */
183148
-{yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy402,yymsp[0].minor.yy590);}
183036
+{yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);}
183149183037
break;
183150183038
case 236: /* nexprlist ::= expr */
183151
-{yymsp[0].minor.yy402 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy590); /*A-overwrites-Y*/}
183039
+{yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/}
183152183040
break;
183153183041
case 238: /* paren_exprlist ::= LP exprlist RP */
183154183042
case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
183155
-{yymsp[-2].minor.yy402 = yymsp[-1].minor.yy402;}
183043
+{yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;}
183156183044
break;
183157183045
case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
183158183046
{
183159183047
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
183160
- sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy402, yymsp[-10].minor.yy502,
183161
- &yymsp[-11].minor.yy0, yymsp[0].minor.yy590, SQLITE_SO_ASC, yymsp[-8].minor.yy502, SQLITE_IDXTYPE_APPDEF);
183048
+ sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144,
183049
+ &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF);
183162183050
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
183163183051
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
183164183052
}
183165183053
}
183166183054
break;
183167183055
case 240: /* uniqueflag ::= UNIQUE */
183168
- case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282);
183169
-{yymsp[0].minor.yy502 = OE_Abort;}
183056
+ case 281: /* raisetype ::= ABORT */ yytestcase(yyruleno==281);
183057
+{yymsp[0].minor.yy144 = OE_Abort;}
183170183058
break;
183171183059
case 241: /* uniqueflag ::= */
183172
-{yymsp[1].minor.yy502 = OE_None;}
183060
+{yymsp[1].minor.yy144 = OE_None;}
183173183061
break;
183174183062
case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
183175183063
{
183176
- yymsp[-4].minor.yy402 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy402, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502);
183064
+ yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144);
183177183065
}
183178183066
break;
183179183067
case 245: /* eidlist ::= nm collate sortorder */
183180183068
{
183181
- yymsp[-2].minor.yy402 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502); /*A-overwrites-Y*/
183069
+ yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/
183182183070
}
183183183071
break;
183184183072
case 248: /* cmd ::= DROP INDEX ifexists fullname */
183185
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy563, yymsp[-1].minor.yy502);}
183073
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);}
183186183074
break;
183187183075
case 249: /* cmd ::= VACUUM vinto */
183188
-{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy590);}
183076
+{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);}
183189183077
break;
183190183078
case 250: /* cmd ::= VACUUM nm vinto */
183191
-{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy590);}
183079
+{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);}
183192183080
break;
183193183081
case 253: /* cmd ::= PRAGMA nm dbnm */
183194183082
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
183195183083
break;
183196183084
case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
@@ -183208,468 +183096,457 @@
183208183096
case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
183209183097
{
183210183098
Token all;
183211183099
all.z = yymsp[-3].minor.yy0.z;
183212183100
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
183213
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy319, &all);
183101
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all);
183214183102
}
183215183103
break;
183216183104
case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
183217183105
{
183218
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy502, yymsp[-4].minor.yy28.a, yymsp[-4].minor.yy28.b, yymsp[-2].minor.yy563, yymsp[0].minor.yy590, yymsp[-10].minor.yy502, yymsp[-8].minor.yy502);
183106
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144);
183219183107
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
183220183108
#ifdef SQLITE_DEBUG
183221183109
assert( pParse->isCreate ); /* Set by createkw reduce action */
183222183110
pParse->isCreate = 0; /* But, should not be set for CREATE TRIGGER */
183223183111
#endif
183224183112
}
183225183113
break;
183226183114
case 262: /* trigger_time ::= BEFORE|AFTER */
183227
-{ yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/ }
183115
+{ yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ }
183228183116
break;
183229183117
case 263: /* trigger_time ::= INSTEAD OF */
183230
-{ yymsp[-1].minor.yy502 = TK_INSTEAD;}
183118
+{ yymsp[-1].minor.yy144 = TK_INSTEAD;}
183231183119
break;
183232183120
case 264: /* trigger_time ::= */
183233
-{ yymsp[1].minor.yy502 = TK_BEFORE; }
183121
+{ yymsp[1].minor.yy144 = TK_BEFORE; }
183234183122
break;
183235183123
case 265: /* trigger_event ::= DELETE|INSERT */
183236183124
case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
183237
-{yymsp[0].minor.yy28.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy28.b = 0;}
183125
+{yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;}
183238183126
break;
183239183127
case 267: /* trigger_event ::= UPDATE OF idlist */
183240
-{yymsp[-2].minor.yy28.a = TK_UPDATE; yymsp[-2].minor.yy28.b = yymsp[0].minor.yy204;}
183128
+{yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;}
183241183129
break;
183242183130
case 268: /* when_clause ::= */
183243
- case 287: /* key_opt ::= */ yytestcase(yyruleno==287);
183244
-{ yymsp[1].minor.yy590 = 0; }
183131
+ case 286: /* key_opt ::= */ yytestcase(yyruleno==286);
183132
+{ yymsp[1].minor.yy454 = 0; }
183245183133
break;
183246183134
case 269: /* when_clause ::= WHEN expr */
183247
- case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288);
183248
-{ yymsp[-1].minor.yy590 = yymsp[0].minor.yy590; }
183135
+ case 287: /* key_opt ::= KEY expr */ yytestcase(yyruleno==287);
183136
+{ yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; }
183249183137
break;
183250183138
case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
183251183139
{
183252
- assert( yymsp[-2].minor.yy319!=0 );
183253
- yymsp[-2].minor.yy319->pLast->pNext = yymsp[-1].minor.yy319;
183254
- yymsp[-2].minor.yy319->pLast = yymsp[-1].minor.yy319;
183140
+ yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427;
183141
+ yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427;
183255183142
}
183256183143
break;
183257183144
case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
183258183145
{
183259
- assert( yymsp[-1].minor.yy319!=0 );
183260
- yymsp[-1].minor.yy319->pLast = yymsp[-1].minor.yy319;
183146
+ yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427;
183261183147
}
183262183148
break;
183263
- case 272: /* trnm ::= nm DOT nm */
183264
-{
183265
- yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
183266
- sqlite3ErrorMsg(pParse,
183267
- "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
183268
- "statements within triggers");
183269
-}
183270
- break;
183271
- case 273: /* tridxby ::= INDEXED BY nm */
183149
+ case 272: /* tridxby ::= INDEXED BY nm */
183272183150
{
183273183151
sqlite3ErrorMsg(pParse,
183274183152
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
183275183153
"within triggers");
183276183154
}
183277183155
break;
183278
- case 274: /* tridxby ::= NOT INDEXED */
183156
+ case 273: /* tridxby ::= NOT INDEXED */
183279183157
{
183280183158
sqlite3ErrorMsg(pParse,
183281183159
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
183282183160
"within triggers");
183283183161
}
183284183162
break;
183285
- case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
183286
-{yylhsminor.yy319 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy563, yymsp[-3].minor.yy402, yymsp[-1].minor.yy590, yymsp[-7].minor.yy502, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy342);}
183287
- yymsp[-8].minor.yy319 = yylhsminor.yy319;
183288
- break;
183289
- case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
183290
-{
183291
- yylhsminor.yy319 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy204,yymsp[-2].minor.yy637,yymsp[-6].minor.yy502,yymsp[-1].minor.yy403,yymsp[-7].minor.yy342,yymsp[0].minor.yy342);/*yylhsminor.yy319-overwrites-yymsp[-6].minor.yy502*/
183292
-}
183293
- yymsp[-7].minor.yy319 = yylhsminor.yy319;
183294
- break;
183295
- case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
183296
-{yylhsminor.yy319 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy590, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy342);}
183297
- yymsp[-5].minor.yy319 = yylhsminor.yy319;
183298
- break;
183299
- case 278: /* trigger_cmd ::= scanpt select scanpt */
183300
-{yylhsminor.yy319 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy637, yymsp[-2].minor.yy342, yymsp[0].minor.yy342); /*yylhsminor.yy319-overwrites-yymsp[-1].minor.yy637*/}
183301
- yymsp[-2].minor.yy319 = yylhsminor.yy319;
183302
- break;
183303
- case 279: /* expr ::= RAISE LP IGNORE RP */
183304
-{
183305
- yymsp[-3].minor.yy590 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
183306
- if( yymsp[-3].minor.yy590 ){
183307
- yymsp[-3].minor.yy590->affExpr = OE_Ignore;
183308
- }
183309
-}
183310
- break;
183311
- case 280: /* expr ::= RAISE LP raisetype COMMA expr RP */
183312
-{
183313
- yymsp[-5].minor.yy590 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy590, 0);
183314
- if( yymsp[-5].minor.yy590 ) {
183315
- yymsp[-5].minor.yy590->affExpr = (char)yymsp[-3].minor.yy502;
183316
- }
183317
-}
183318
- break;
183319
- case 281: /* raisetype ::= ROLLBACK */
183320
-{yymsp[0].minor.yy502 = OE_Rollback;}
183321
- break;
183322
- case 283: /* raisetype ::= FAIL */
183323
-{yymsp[0].minor.yy502 = OE_Fail;}
183324
- break;
183325
- case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
183326
-{
183327
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy563,yymsp[-1].minor.yy502);
183328
-}
183329
- break;
183330
- case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
183331
-{
183332
- sqlite3Attach(pParse, yymsp[-3].minor.yy590, yymsp[-1].minor.yy590, yymsp[0].minor.yy590);
183333
-}
183334
- break;
183335
- case 286: /* cmd ::= DETACH database_kw_opt expr */
183336
-{
183337
- sqlite3Detach(pParse, yymsp[0].minor.yy590);
183338
-}
183339
- break;
183340
- case 289: /* cmd ::= REINDEX */
183163
+ case 274: /* trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt */
183164
+{yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, yymsp[-6].minor.yy203, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);}
183165
+ yymsp[-8].minor.yy427 = yylhsminor.yy427;
183166
+ break;
183167
+ case 275: /* trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt */
183168
+{
183169
+ yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,yymsp[-4].minor.yy203,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/
183170
+}
183171
+ yymsp[-7].minor.yy427 = yylhsminor.yy427;
183172
+ break;
183173
+ case 276: /* trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt */
183174
+{yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);}
183175
+ yymsp[-5].minor.yy427 = yylhsminor.yy427;
183176
+ break;
183177
+ case 277: /* trigger_cmd ::= scanpt select scanpt */
183178
+{yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/}
183179
+ yymsp[-2].minor.yy427 = yylhsminor.yy427;
183180
+ break;
183181
+ case 278: /* expr ::= RAISE LP IGNORE RP */
183182
+{
183183
+ yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
183184
+ if( yymsp[-3].minor.yy454 ){
183185
+ yymsp[-3].minor.yy454->affExpr = OE_Ignore;
183186
+ }
183187
+}
183188
+ break;
183189
+ case 279: /* expr ::= RAISE LP raisetype COMMA expr RP */
183190
+{
183191
+ yymsp[-5].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy454, 0);
183192
+ if( yymsp[-5].minor.yy454 ) {
183193
+ yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144;
183194
+ }
183195
+}
183196
+ break;
183197
+ case 280: /* raisetype ::= ROLLBACK */
183198
+{yymsp[0].minor.yy144 = OE_Rollback;}
183199
+ break;
183200
+ case 282: /* raisetype ::= FAIL */
183201
+{yymsp[0].minor.yy144 = OE_Fail;}
183202
+ break;
183203
+ case 283: /* cmd ::= DROP TRIGGER ifexists fullname */
183204
+{
183205
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144);
183206
+}
183207
+ break;
183208
+ case 284: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
183209
+{
183210
+ sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454);
183211
+}
183212
+ break;
183213
+ case 285: /* cmd ::= DETACH database_kw_opt expr */
183214
+{
183215
+ sqlite3Detach(pParse, yymsp[0].minor.yy454);
183216
+}
183217
+ break;
183218
+ case 288: /* cmd ::= REINDEX */
183341183219
{sqlite3Reindex(pParse, 0, 0);}
183342183220
break;
183343
- case 290: /* cmd ::= REINDEX nm dbnm */
183221
+ case 289: /* cmd ::= REINDEX nm dbnm */
183344183222
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
183345183223
break;
183346
- case 291: /* cmd ::= ANALYZE */
183224
+ case 290: /* cmd ::= ANALYZE */
183347183225
{sqlite3Analyze(pParse, 0, 0);}
183348183226
break;
183349
- case 292: /* cmd ::= ANALYZE nm dbnm */
183227
+ case 291: /* cmd ::= ANALYZE nm dbnm */
183350183228
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
183351183229
break;
183352
- case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
183230
+ case 292: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
183353183231
{
183354
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy563,&yymsp[0].minor.yy0);
183232
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0);
183355183233
}
183356183234
break;
183357
- case 294: /* cmd ::= alter_add carglist */
183235
+ case 293: /* cmd ::= alter_add carglist */
183358183236
{
183359183237
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
183360183238
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
183361183239
}
183362183240
break;
183363
- case 295: /* alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
183241
+ case 294: /* alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
183364183242
{
183365183243
disableLookaside(pParse);
183366
- sqlite3AlterBeginAddColumn(pParse, yymsp[-4].minor.yy563);
183244
+ sqlite3AlterBeginAddColumn(pParse, yymsp[-4].minor.yy203);
183367183245
sqlite3AddColumn(pParse, yymsp[-1].minor.yy0, yymsp[0].minor.yy0);
183368183246
yymsp[-6].minor.yy0 = yymsp[-1].minor.yy0;
183369183247
}
183370183248
break;
183371
- case 296: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
183372
-{
183373
- sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy563, &yymsp[0].minor.yy0);
183374
-}
183375
- break;
183376
- case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
183377
-{
183378
- sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy563, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
183379
-}
183380
- break;
183381
- case 298: /* cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
183382
-{
183383
- sqlite3AlterDropConstraint(pParse, yymsp[-3].minor.yy563, &yymsp[0].minor.yy0, 0);
183384
-}
183385
- break;
183386
- case 299: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
183387
-{
183388
- sqlite3AlterDropConstraint(pParse, yymsp[-6].minor.yy563, 0, &yymsp[-3].minor.yy0);
183389
-}
183390
- break;
183391
- case 300: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
183392
-{
183393
- sqlite3AlterSetNotNull(pParse, yymsp[-7].minor.yy563, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0);
183394
-}
183395
- break;
183396
- case 301: /* cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
183397
-{
183398
- sqlite3AlterAddConstraint(pParse, yymsp[-8].minor.yy563, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183399
-}
183400
- yy_destructor(yypParser,219,&yymsp[-2].minor);
183401
- break;
183402
- case 302: /* cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
183403
-{
183404
- sqlite3AlterAddConstraint(pParse, yymsp[-6].minor.yy563, &yymsp[-4].minor.yy0, 0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183405
-}
183406
- yy_destructor(yypParser,219,&yymsp[-2].minor);
183407
- break;
183408
- case 303: /* cmd ::= create_vtab */
183409
-{sqlite3VtabFinishParse(pParse,0);}
183410
- break;
183411
- case 304: /* cmd ::= create_vtab LP vtabarglist RP */
183412
-{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
183413
- break;
183414
- case 305: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
183415
-{
183416
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy502);
183417
-}
183418
- break;
183419
- case 306: /* vtabarg ::= */
183420
-{sqlite3VtabArgInit(pParse);}
183421
- break;
183422
- case 307: /* vtabargtoken ::= ANY */
183423
- case 308: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==308);
183424
- case 309: /* lp ::= LP */ yytestcase(yyruleno==309);
183425
-{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
183426
- break;
183427
- case 310: /* with ::= WITH wqlist */
183428
- case 311: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==311);
183429
-{ sqlite3WithPush(pParse, yymsp[0].minor.yy125, 1); }
183430
- break;
183431
- case 312: /* wqas ::= AS */
183432
-{yymsp[0].minor.yy444 = M10d_Any;}
183433
- break;
183434
- case 313: /* wqas ::= AS MATERIALIZED */
183435
-{yymsp[-1].minor.yy444 = M10d_Yes;}
183436
- break;
183437
- case 314: /* wqas ::= AS NOT MATERIALIZED */
183438
-{yymsp[-2].minor.yy444 = M10d_No;}
183439
- break;
183440
- case 315: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
183441
-{
183442
- yymsp[-5].minor.yy361 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy402, yymsp[-1].minor.yy637, yymsp[-3].minor.yy444); /*A-overwrites-X*/
183443
-}
183444
- break;
183445
- case 316: /* withnm ::= nm */
183446
-{pParse->bHasWith = 1;}
183447
- break;
183448
- case 317: /* wqlist ::= wqitem */
183449
-{
183450
- yymsp[0].minor.yy125 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy361); /*A-overwrites-X*/
183451
-}
183452
- break;
183453
- case 318: /* wqlist ::= wqlist COMMA wqitem */
183454
-{
183455
- yymsp[-2].minor.yy125 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy125, yymsp[0].minor.yy361);
183456
-}
183457
- break;
183458
- case 319: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
183459
-{
183460
- assert( yymsp[0].minor.yy483!=0 );
183461
- sqlite3WindowChain(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy483);
183462
- yymsp[0].minor.yy483->pNextWin = yymsp[-2].minor.yy483;
183463
- yylhsminor.yy483 = yymsp[0].minor.yy483;
183464
-}
183465
- yymsp[-2].minor.yy483 = yylhsminor.yy483;
183466
- break;
183467
- case 320: /* windowdefn ::= nm AS LP window RP */
183468
-{
183469
- if( ALWAYS(yymsp[-1].minor.yy483) ){
183470
- yymsp[-1].minor.yy483->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
183471
- }
183472
- yylhsminor.yy483 = yymsp[-1].minor.yy483;
183473
-}
183474
- yymsp[-4].minor.yy483 = yylhsminor.yy483;
183475
- break;
183476
- case 321: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
183477
-{
183478
- yymsp[-4].minor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy402, yymsp[-1].minor.yy402, 0);
183479
-}
183480
- break;
183481
- case 322: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
183482
-{
183483
- yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy402, yymsp[-1].minor.yy402, &yymsp[-5].minor.yy0);
183484
-}
183485
- yymsp[-5].minor.yy483 = yylhsminor.yy483;
183486
- break;
183487
- case 323: /* window ::= ORDER BY sortlist frame_opt */
183488
-{
183489
- yymsp[-3].minor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy402, 0);
183490
-}
183491
- break;
183492
- case 324: /* window ::= nm ORDER BY sortlist frame_opt */
183493
-{
183494
- yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy402, &yymsp[-4].minor.yy0);
183495
-}
183496
- yymsp[-4].minor.yy483 = yylhsminor.yy483;
183497
- break;
183498
- case 325: /* window ::= nm frame_opt */
183499
-{
183500
- yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, 0, &yymsp[-1].minor.yy0);
183501
-}
183502
- yymsp[-1].minor.yy483 = yylhsminor.yy483;
183503
- break;
183504
- case 326: /* frame_opt ::= */
183505
-{
183506
- yymsp[1].minor.yy483 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
183507
-}
183508
- break;
183509
- case 327: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
183510
-{
183511
- yylhsminor.yy483 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy502, yymsp[-1].minor.yy205.eType, yymsp[-1].minor.yy205.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy444);
183512
-}
183513
- yymsp[-2].minor.yy483 = yylhsminor.yy483;
183514
- break;
183515
- case 328: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
183516
-{
183517
- yylhsminor.yy483 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy502, yymsp[-3].minor.yy205.eType, yymsp[-3].minor.yy205.pExpr, yymsp[-1].minor.yy205.eType, yymsp[-1].minor.yy205.pExpr, yymsp[0].minor.yy444);
183518
-}
183519
- yymsp[-5].minor.yy483 = yylhsminor.yy483;
183520
- break;
183521
- case 330: /* frame_bound_s ::= frame_bound */
183522
- case 332: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==332);
183523
-{yylhsminor.yy205 = yymsp[0].minor.yy205;}
183524
- yymsp[0].minor.yy205 = yylhsminor.yy205;
183525
- break;
183526
- case 331: /* frame_bound_s ::= UNBOUNDED PRECEDING */
183527
- case 333: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==333);
183528
- case 335: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==335);
183529
-{yylhsminor.yy205.eType = yymsp[-1].major; yylhsminor.yy205.pExpr = 0;}
183530
- yymsp[-1].minor.yy205 = yylhsminor.yy205;
183531
- break;
183532
- case 334: /* frame_bound ::= expr PRECEDING|FOLLOWING */
183533
-{yylhsminor.yy205.eType = yymsp[0].major; yylhsminor.yy205.pExpr = yymsp[-1].minor.yy590;}
183534
- yymsp[-1].minor.yy205 = yylhsminor.yy205;
183535
- break;
183536
- case 336: /* frame_exclude_opt ::= */
183537
-{yymsp[1].minor.yy444 = 0;}
183538
- break;
183539
- case 337: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
183540
-{yymsp[-1].minor.yy444 = yymsp[0].minor.yy444;}
183541
- break;
183542
- case 338: /* frame_exclude ::= NO OTHERS */
183543
- case 339: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==339);
183544
-{yymsp[-1].minor.yy444 = yymsp[-1].major; /*A-overwrites-X*/}
183545
- break;
183546
- case 340: /* frame_exclude ::= GROUP|TIES */
183547
-{yymsp[0].minor.yy444 = yymsp[0].major; /*A-overwrites-X*/}
183548
- break;
183549
- case 341: /* window_clause ::= WINDOW windowdefn_list */
183550
-{ yymsp[-1].minor.yy483 = yymsp[0].minor.yy483; }
183551
- break;
183552
- case 342: /* filter_over ::= filter_clause over_clause */
183553
-{
183554
- if( yymsp[0].minor.yy483 ){
183555
- yymsp[0].minor.yy483->pFilter = yymsp[-1].minor.yy590;
183556
- }else{
183557
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy590);
183558
- }
183559
- yylhsminor.yy483 = yymsp[0].minor.yy483;
183560
-}
183561
- yymsp[-1].minor.yy483 = yylhsminor.yy483;
183562
- break;
183563
- case 343: /* filter_over ::= over_clause */
183564
-{
183565
- yylhsminor.yy483 = yymsp[0].minor.yy483;
183566
-}
183567
- yymsp[0].minor.yy483 = yylhsminor.yy483;
183568
- break;
183569
- case 344: /* filter_over ::= filter_clause */
183570
-{
183571
- yylhsminor.yy483 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183572
- if( yylhsminor.yy483 ){
183573
- yylhsminor.yy483->eFrmType = TK_FILTER;
183574
- yylhsminor.yy483->pFilter = yymsp[0].minor.yy590;
183575
- }else{
183576
- sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy590);
183577
- }
183578
-}
183579
- yymsp[0].minor.yy483 = yylhsminor.yy483;
183580
- break;
183581
- case 345: /* over_clause ::= OVER LP window RP */
183582
-{
183583
- yymsp[-3].minor.yy483 = yymsp[-1].minor.yy483;
183584
- assert( yymsp[-3].minor.yy483!=0 );
183585
-}
183586
- break;
183587
- case 346: /* over_clause ::= OVER nm */
183588
-{
183589
- yymsp[-1].minor.yy483 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183590
- if( yymsp[-1].minor.yy483 ){
183591
- yymsp[-1].minor.yy483->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
183592
- }
183593
-}
183594
- break;
183595
- case 347: /* filter_clause ::= FILTER LP WHERE expr RP */
183596
-{ yymsp[-4].minor.yy590 = yymsp[-1].minor.yy590; }
183597
- break;
183598
- case 348: /* term ::= QNUMBER */
183599
-{
183600
- yylhsminor.yy590=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
183601
- sqlite3DequoteNumber(pParse, yylhsminor.yy590);
183602
-}
183603
- yymsp[0].minor.yy590 = yylhsminor.yy590;
183604
- break;
183605
- default:
183606
- /* (349) input ::= cmdlist */ yytestcase(yyruleno==349);
183607
- /* (350) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==350);
183608
- /* (351) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=351);
183609
- /* (352) ecmd ::= SEMI */ yytestcase(yyruleno==352);
183610
- /* (353) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==353);
183611
- /* (354) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=354);
183612
- /* (355) trans_opt ::= */ yytestcase(yyruleno==355);
183613
- /* (356) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==356);
183614
- /* (357) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==357);
183615
- /* (358) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==358);
183616
- /* (359) savepoint_opt ::= */ yytestcase(yyruleno==359);
183617
- /* (360) cmd ::= create_table create_table_args */ yytestcase(yyruleno==360);
183618
- /* (361) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=361);
183619
- /* (362) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==362);
183620
- /* (363) columnlist ::= columnname carglist */ yytestcase(yyruleno==363);
183621
- /* (364) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==364);
183622
- /* (365) nm ::= STRING */ yytestcase(yyruleno==365);
183623
- /* (366) typetoken ::= typename */ yytestcase(yyruleno==366);
183624
- /* (367) typename ::= ID|STRING */ yytestcase(yyruleno==367);
183625
- /* (368) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=368);
183626
- /* (369) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=369);
183627
- /* (370) carglist ::= carglist ccons */ yytestcase(yyruleno==370);
183628
- /* (371) carglist ::= */ yytestcase(yyruleno==371);
183629
- /* (372) ccons ::= NULL onconf */ yytestcase(yyruleno==372);
183630
- /* (373) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==373);
183631
- /* (374) ccons ::= AS generated */ yytestcase(yyruleno==374);
183632
- /* (375) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==375);
183633
- /* (376) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==376);
183634
- /* (377) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=377);
183635
- /* (378) tconscomma ::= */ yytestcase(yyruleno==378);
183636
- /* (379) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=379);
183637
- /* (380) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=380);
183638
- /* (381) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=381);
183639
- /* (382) oneselect ::= values */ yytestcase(yyruleno==382);
183640
- /* (383) sclp ::= selcollist COMMA */ yytestcase(yyruleno==383);
183641
- /* (384) as ::= ID|STRING */ yytestcase(yyruleno==384);
183642
- /* (385) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=385);
183643
- /* (386) returning ::= */ yytestcase(yyruleno==386);
183644
- /* (387) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=387);
183645
- /* (388) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==388);
183646
- /* (389) case_operand ::= expr */ yytestcase(yyruleno==389);
183647
- /* (390) exprlist ::= nexprlist */ yytestcase(yyruleno==390);
183648
- /* (391) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=391);
183649
- /* (392) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=392);
183650
- /* (393) nmnum ::= ON */ yytestcase(yyruleno==393);
183651
- /* (394) nmnum ::= DELETE */ yytestcase(yyruleno==394);
183652
- /* (395) nmnum ::= DEFAULT */ yytestcase(yyruleno==395);
183653
- /* (396) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==396);
183654
- /* (397) foreach_clause ::= */ yytestcase(yyruleno==397);
183655
- /* (398) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==398);
183656
- /* (399) trnm ::= nm */ yytestcase(yyruleno==399);
183657
- /* (400) tridxby ::= */ yytestcase(yyruleno==400);
183658
- /* (401) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==401);
183659
- /* (402) database_kw_opt ::= */ yytestcase(yyruleno==402);
183660
- /* (403) kwcolumn_opt ::= */ yytestcase(yyruleno==403);
183661
- /* (404) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==404);
183662
- /* (405) vtabarglist ::= vtabarg */ yytestcase(yyruleno==405);
183663
- /* (406) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==406);
183664
- /* (407) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==407);
183665
- /* (408) anylist ::= */ yytestcase(yyruleno==408);
183666
- /* (409) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==409);
183667
- /* (410) anylist ::= anylist ANY */ yytestcase(yyruleno==410);
183668
- /* (411) with ::= */ yytestcase(yyruleno==411);
183669
- /* (412) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=412);
183670
- /* (413) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=413);
183249
+ case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
183250
+{
183251
+ sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0);
183252
+}
183253
+ break;
183254
+ case 296: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
183255
+{
183256
+ sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
183257
+}
183258
+ break;
183259
+ case 297: /* cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
183260
+{
183261
+ sqlite3AlterDropConstraint(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0, 0);
183262
+}
183263
+ break;
183264
+ case 298: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
183265
+{
183266
+ sqlite3AlterDropConstraint(pParse, yymsp[-6].minor.yy203, 0, &yymsp[-3].minor.yy0);
183267
+}
183268
+ break;
183269
+ case 299: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
183270
+{
183271
+ sqlite3AlterSetNotNull(pParse, yymsp[-7].minor.yy203, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0);
183272
+}
183273
+ break;
183274
+ case 300: /* cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
183275
+{
183276
+ sqlite3AlterAddConstraint(pParse, yymsp[-8].minor.yy203, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183277
+}
183278
+ yy_destructor(yypParser,219,&yymsp[-2].minor);
183279
+ break;
183280
+ case 301: /* cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
183281
+{
183282
+ sqlite3AlterAddConstraint(pParse, yymsp[-6].minor.yy203, &yymsp[-4].minor.yy0, 0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183283
+}
183284
+ yy_destructor(yypParser,219,&yymsp[-2].minor);
183285
+ break;
183286
+ case 302: /* cmd ::= create_vtab */
183287
+{sqlite3VtabFinishParse(pParse,0);}
183288
+ break;
183289
+ case 303: /* cmd ::= create_vtab LP vtabarglist RP */
183290
+{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
183291
+ break;
183292
+ case 304: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
183293
+{
183294
+ sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144);
183295
+}
183296
+ break;
183297
+ case 305: /* vtabarg ::= */
183298
+{sqlite3VtabArgInit(pParse);}
183299
+ break;
183300
+ case 306: /* vtabargtoken ::= ANY */
183301
+ case 307: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==307);
183302
+ case 308: /* lp ::= LP */ yytestcase(yyruleno==308);
183303
+{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
183304
+ break;
183305
+ case 309: /* with ::= WITH wqlist */
183306
+ case 310: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==310);
183307
+{ sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); }
183308
+ break;
183309
+ case 311: /* wqas ::= AS */
183310
+{yymsp[0].minor.yy462 = M10d_Any;}
183311
+ break;
183312
+ case 312: /* wqas ::= AS MATERIALIZED */
183313
+{yymsp[-1].minor.yy462 = M10d_Yes;}
183314
+ break;
183315
+ case 313: /* wqas ::= AS NOT MATERIALIZED */
183316
+{yymsp[-2].minor.yy462 = M10d_No;}
183317
+ break;
183318
+ case 314: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
183319
+{
183320
+ yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/
183321
+}
183322
+ break;
183323
+ case 315: /* withnm ::= nm */
183324
+{pParse->bHasWith = 1;}
183325
+ break;
183326
+ case 316: /* wqlist ::= wqitem */
183327
+{
183328
+ yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/
183329
+}
183330
+ break;
183331
+ case 317: /* wqlist ::= wqlist COMMA wqitem */
183332
+{
183333
+ yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67);
183334
+}
183335
+ break;
183336
+ case 318: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
183337
+{
183338
+ assert( yymsp[0].minor.yy211!=0 );
183339
+ sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211);
183340
+ yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211;
183341
+ yylhsminor.yy211 = yymsp[0].minor.yy211;
183342
+}
183343
+ yymsp[-2].minor.yy211 = yylhsminor.yy211;
183344
+ break;
183345
+ case 319: /* windowdefn ::= nm AS LP window RP */
183346
+{
183347
+ if( ALWAYS(yymsp[-1].minor.yy211) ){
183348
+ yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
183349
+ }
183350
+ yylhsminor.yy211 = yymsp[-1].minor.yy211;
183351
+}
183352
+ yymsp[-4].minor.yy211 = yylhsminor.yy211;
183353
+ break;
183354
+ case 320: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
183355
+{
183356
+ yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0);
183357
+}
183358
+ break;
183359
+ case 321: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
183360
+{
183361
+ yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0);
183362
+}
183363
+ yymsp[-5].minor.yy211 = yylhsminor.yy211;
183364
+ break;
183365
+ case 322: /* window ::= ORDER BY sortlist frame_opt */
183366
+{
183367
+ yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0);
183368
+}
183369
+ break;
183370
+ case 323: /* window ::= nm ORDER BY sortlist frame_opt */
183371
+{
183372
+ yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0);
183373
+}
183374
+ yymsp[-4].minor.yy211 = yylhsminor.yy211;
183375
+ break;
183376
+ case 324: /* window ::= nm frame_opt */
183377
+{
183378
+ yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0);
183379
+}
183380
+ yymsp[-1].minor.yy211 = yylhsminor.yy211;
183381
+ break;
183382
+ case 325: /* frame_opt ::= */
183383
+{
183384
+ yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
183385
+}
183386
+ break;
183387
+ case 326: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
183388
+{
183389
+ yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462);
183390
+}
183391
+ yymsp[-2].minor.yy211 = yylhsminor.yy211;
183392
+ break;
183393
+ case 327: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
183394
+{
183395
+ yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462);
183396
+}
183397
+ yymsp[-5].minor.yy211 = yylhsminor.yy211;
183398
+ break;
183399
+ case 329: /* frame_bound_s ::= frame_bound */
183400
+ case 331: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==331);
183401
+{yylhsminor.yy509 = yymsp[0].minor.yy509;}
183402
+ yymsp[0].minor.yy509 = yylhsminor.yy509;
183403
+ break;
183404
+ case 330: /* frame_bound_s ::= UNBOUNDED PRECEDING */
183405
+ case 332: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==332);
183406
+ case 334: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==334);
183407
+{yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;}
183408
+ yymsp[-1].minor.yy509 = yylhsminor.yy509;
183409
+ break;
183410
+ case 333: /* frame_bound ::= expr PRECEDING|FOLLOWING */
183411
+{yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;}
183412
+ yymsp[-1].minor.yy509 = yylhsminor.yy509;
183413
+ break;
183414
+ case 335: /* frame_exclude_opt ::= */
183415
+{yymsp[1].minor.yy462 = 0;}
183416
+ break;
183417
+ case 336: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
183418
+{yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;}
183419
+ break;
183420
+ case 337: /* frame_exclude ::= NO OTHERS */
183421
+ case 338: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==338);
183422
+{yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/}
183423
+ break;
183424
+ case 339: /* frame_exclude ::= GROUP|TIES */
183425
+{yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/}
183426
+ break;
183427
+ case 340: /* window_clause ::= WINDOW windowdefn_list */
183428
+{ yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; }
183429
+ break;
183430
+ case 341: /* filter_over ::= filter_clause over_clause */
183431
+{
183432
+ if( yymsp[0].minor.yy211 ){
183433
+ yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454;
183434
+ }else{
183435
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
183436
+ }
183437
+ yylhsminor.yy211 = yymsp[0].minor.yy211;
183438
+}
183439
+ yymsp[-1].minor.yy211 = yylhsminor.yy211;
183440
+ break;
183441
+ case 342: /* filter_over ::= over_clause */
183442
+{
183443
+ yylhsminor.yy211 = yymsp[0].minor.yy211;
183444
+}
183445
+ yymsp[0].minor.yy211 = yylhsminor.yy211;
183446
+ break;
183447
+ case 343: /* filter_over ::= filter_clause */
183448
+{
183449
+ yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183450
+ if( yylhsminor.yy211 ){
183451
+ yylhsminor.yy211->eFrmType = TK_FILTER;
183452
+ yylhsminor.yy211->pFilter = yymsp[0].minor.yy454;
183453
+ }else{
183454
+ sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454);
183455
+ }
183456
+}
183457
+ yymsp[0].minor.yy211 = yylhsminor.yy211;
183458
+ break;
183459
+ case 344: /* over_clause ::= OVER LP window RP */
183460
+{
183461
+ yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211;
183462
+ assert( yymsp[-3].minor.yy211!=0 );
183463
+}
183464
+ break;
183465
+ case 345: /* over_clause ::= OVER nm */
183466
+{
183467
+ yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183468
+ if( yymsp[-1].minor.yy211 ){
183469
+ yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
183470
+ }
183471
+}
183472
+ break;
183473
+ case 346: /* filter_clause ::= FILTER LP WHERE expr RP */
183474
+{ yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; }
183475
+ break;
183476
+ case 347: /* term ::= QNUMBER */
183477
+{
183478
+ yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
183479
+ sqlite3DequoteNumber(pParse, yylhsminor.yy454);
183480
+}
183481
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
183482
+ break;
183483
+ default:
183484
+ /* (348) input ::= cmdlist */ yytestcase(yyruleno==348);
183485
+ /* (349) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==349);
183486
+ /* (350) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=350);
183487
+ /* (351) ecmd ::= SEMI */ yytestcase(yyruleno==351);
183488
+ /* (352) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==352);
183489
+ /* (353) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=353);
183490
+ /* (354) trans_opt ::= */ yytestcase(yyruleno==354);
183491
+ /* (355) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==355);
183492
+ /* (356) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==356);
183493
+ /* (357) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==357);
183494
+ /* (358) savepoint_opt ::= */ yytestcase(yyruleno==358);
183495
+ /* (359) cmd ::= create_table create_table_args */ yytestcase(yyruleno==359);
183496
+ /* (360) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=360);
183497
+ /* (361) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==361);
183498
+ /* (362) columnlist ::= columnname carglist */ yytestcase(yyruleno==362);
183499
+ /* (363) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==363);
183500
+ /* (364) nm ::= STRING */ yytestcase(yyruleno==364);
183501
+ /* (365) typetoken ::= typename */ yytestcase(yyruleno==365);
183502
+ /* (366) typename ::= ID|STRING */ yytestcase(yyruleno==366);
183503
+ /* (367) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=367);
183504
+ /* (368) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=368);
183505
+ /* (369) carglist ::= carglist ccons */ yytestcase(yyruleno==369);
183506
+ /* (370) carglist ::= */ yytestcase(yyruleno==370);
183507
+ /* (371) ccons ::= NULL onconf */ yytestcase(yyruleno==371);
183508
+ /* (372) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==372);
183509
+ /* (373) ccons ::= AS generated */ yytestcase(yyruleno==373);
183510
+ /* (374) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==374);
183511
+ /* (375) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==375);
183512
+ /* (376) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=376);
183513
+ /* (377) tconscomma ::= */ yytestcase(yyruleno==377);
183514
+ /* (378) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=378);
183515
+ /* (379) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=379);
183516
+ /* (380) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=380);
183517
+ /* (381) oneselect ::= values */ yytestcase(yyruleno==381);
183518
+ /* (382) sclp ::= selcollist COMMA */ yytestcase(yyruleno==382);
183519
+ /* (383) as ::= ID|STRING */ yytestcase(yyruleno==383);
183520
+ /* (384) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=384);
183521
+ /* (385) returning ::= */ yytestcase(yyruleno==385);
183522
+ /* (386) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=386);
183523
+ /* (387) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==387);
183524
+ /* (388) case_operand ::= expr */ yytestcase(yyruleno==388);
183525
+ /* (389) exprlist ::= nexprlist */ yytestcase(yyruleno==389);
183526
+ /* (390) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=390);
183527
+ /* (391) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=391);
183528
+ /* (392) nmnum ::= ON */ yytestcase(yyruleno==392);
183529
+ /* (393) nmnum ::= DELETE */ yytestcase(yyruleno==393);
183530
+ /* (394) nmnum ::= DEFAULT */ yytestcase(yyruleno==394);
183531
+ /* (395) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==395);
183532
+ /* (396) foreach_clause ::= */ yytestcase(yyruleno==396);
183533
+ /* (397) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==397);
183534
+ /* (398) tridxby ::= */ yytestcase(yyruleno==398);
183535
+ /* (399) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==399);
183536
+ /* (400) database_kw_opt ::= */ yytestcase(yyruleno==400);
183537
+ /* (401) kwcolumn_opt ::= */ yytestcase(yyruleno==401);
183538
+ /* (402) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==402);
183539
+ /* (403) vtabarglist ::= vtabarg */ yytestcase(yyruleno==403);
183540
+ /* (404) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==404);
183541
+ /* (405) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==405);
183542
+ /* (406) anylist ::= */ yytestcase(yyruleno==406);
183543
+ /* (407) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==407);
183544
+ /* (408) anylist ::= anylist ANY */ yytestcase(yyruleno==408);
183545
+ /* (409) with ::= */ yytestcase(yyruleno==409);
183546
+ /* (410) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=410);
183547
+ /* (411) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=411);
183671183548
break;
183672183549
/********** End reduce actions ************************************************/
183673183550
};
183674183551
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
183675183552
yygoto = yyRuleInfoLhs[yyruleno];
@@ -184444,12 +184321,12 @@
184444184321
** 126: UPDATE UNIQUE
184445184322
*/
184446184323
/* Check to see if z[0..n-1] is a keyword. If it is, write the
184447184324
** parser symbol code for that keyword into *pType. Always
184448184325
** return the integer n (the length of the token). */
184449
-static int keywordCode(const char *z, int n, int *pType){
184450
- int i, j;
184326
+static i64 keywordCode(const char *z, i64 n, int *pType){
184327
+ i64 i, j;
184451184328
const char *zKW;
184452184329
assert( n>=2 );
184453184330
i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
184454184331
for(i=(int)aKWHash[i]; i>0; i=aKWNext[i]){
184455184332
if( aKWLen[i]!=n ) continue;
@@ -184999,11 +184876,11 @@
184999184876
for(i=1; sqlite3Isdigit(z[i]); i++){}
185000184877
return i;
185001184878
}
185002184879
case CC_DOLLAR:
185003184880
case CC_VARALPHA: {
185004
- int n = 0;
184881
+ i64 n = 0;
185005184882
testcase( z[0]=='$' ); testcase( z[0]=='@' );
185006184883
testcase( z[0]==':' ); testcase( z[0]=='#' );
185007184884
*tokenType = TK_VARIABLE;
185008184885
for(i=1; (c=z[i])!=0; i++){
185009184886
if( IdChar(c) ){
@@ -185095,11 +184972,11 @@
185095184972
void *pEngine; /* The LEMON-generated LALR(1) parser */
185096184973
i64 n = 0; /* Length of the next token token */
185097184974
int tokenType; /* type of the next token */
185098184975
int lastTokenParsed = -1; /* type of the previous token */
185099184976
sqlite3 *db = pParse->db; /* The database connection */
185100
- int mxSqlLen; /* Max length of an SQL string */
184977
+ i64 mxSqlLen; /* Max length of an SQL string */
185101184978
Parse *pParentParse = 0; /* Outer parse context, if any */
185102184979
#ifdef sqlite3Parser_ENGINEALWAYSONSTACK
185103184980
yyParser sEngine; /* Space to hold the Lemon-generated Parser object */
185104184981
#endif
185105184982
VVA_ONLY( u8 startedWithOom = db->mallocFailed );
@@ -188342,15 +188219,16 @@
188342188219
188343188220
/* Initialize the output variables to -1 in case an error occurs. */
188344188221
if( pnLog ) *pnLog = -1;
188345188222
if( pnCkpt ) *pnCkpt = -1;
188346188223
188224
+ assert( SQLITE_CHECKPOINT_NOOP==-1 );
188347188225
assert( SQLITE_CHECKPOINT_PASSIVE==0 );
188348188226
assert( SQLITE_CHECKPOINT_FULL==1 );
188349188227
assert( SQLITE_CHECKPOINT_RESTART==2 );
188350188228
assert( SQLITE_CHECKPOINT_TRUNCATE==3 );
188351
- if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_TRUNCATE ){
188229
+ if( eMode<SQLITE_CHECKPOINT_NOOP || eMode>SQLITE_CHECKPOINT_TRUNCATE ){
188352188230
/* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint
188353188231
** mode: */
188354188232
return SQLITE_MISUSE_BKPT;
188355188233
}
188356188234
@@ -188724,10 +188602,13 @@
188724188602
#if SQLITE_MAX_SQL_LENGTH<100
188725188603
# error SQLITE_MAX_SQL_LENGTH must be at least 100
188726188604
#endif
188727188605
#if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH
188728188606
# error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH
188607
+#endif
188608
+#if SQLITE_MAX_SQL_LENGTH>2147482624 /* 1024 less than 2^31 */
188609
+# error SQLITE_MAX_SQL_LENGTH must not be greater than 2147482624
188729188610
#endif
188730188611
#if SQLITE_MAX_COMPOUND_SELECT<2
188731188612
# error SQLITE_MAX_COMPOUND_SELECT must be at least 2
188732188613
#endif
188733188614
#if SQLITE_MAX_VDBE_OP<40
@@ -192464,10 +192345,19 @@
192464192345
SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table*,int,int);
192465192346
192466192347
#define fts3GetVarint32(p, piVal) ( \
192467192348
(*(u8*)(p)&0x80) ? sqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \
192468192349
)
192350
+
192351
+SQLITE_PRIVATE int sqlite3Fts3PrepareStmt(
192352
+ Fts3Table *p, /* Prepare for this connection */
192353
+ const char *zSql, /* SQL to prepare */
192354
+ int bPersist, /* True to set SQLITE_PREPARE_PERSISTENT */
192355
+ int bAllowVtab, /* True to omit SQLITE_PREPARE_NO_VTAB */
192356
+ sqlite3_stmt **pp /* OUT: Prepared statement */
192357
+);
192358
+
192469192359
192470192360
/* fts3.c */
192471192361
SQLITE_PRIVATE void sqlite3Fts3ErrMsg(char**,const char*,...);
192472192362
SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64);
192473192363
SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *);
@@ -194072,13 +193962,11 @@
194072193962
p->pSeekStmt = 0;
194073193963
}else{
194074193964
zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
194075193965
if( !zSql ) return SQLITE_NOMEM;
194076193966
p->bLock++;
194077
- rc = sqlite3_prepare_v3(
194078
- p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0
194079
- );
193967
+ rc = sqlite3Fts3PrepareStmt(p, zSql, 1, 1, &pCsr->pStmt);
194080193968
p->bLock--;
194081193969
sqlite3_free(zSql);
194082193970
}
194083193971
if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
194084193972
}
@@ -195649,13 +195537,11 @@
195649195537
p->zReadExprlist, (pCsr->bDesc ? "DESC" : "ASC")
195650195538
);
195651195539
}
195652195540
if( zSql ){
195653195541
p->bLock++;
195654
- rc = sqlite3_prepare_v3(
195655
- p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0
195656
- );
195542
+ rc = sqlite3Fts3PrepareStmt(p, zSql, 1, 1, &pCsr->pStmt);
195657195543
p->bLock--;
195658195544
sqlite3_free(zSql);
195659195545
}else{
195660195546
rc = SQLITE_NOMEM;
195661195547
}
@@ -196274,10 +196160,11 @@
196274196160
int rc = SQLITE_OK;
196275196161
int bOk = 0;
196276196162
196277196163
UNUSED_PARAMETER(isQuick);
196278196164
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
196165
+ assert( pVtab->zErrMsg==0 || rc!=SQLITE_OK );
196279196166
assert( rc!=SQLITE_CORRUPT_VTAB );
196280196167
if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){
196281196168
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
196282196169
" FTS%d table %s.%s: %s",
196283196170
p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc));
@@ -202885,10 +202772,28 @@
202885202772
#define SQL_SELECT_MXLEVEL 36
202886202773
202887202774
#define SQL_SELECT_LEVEL_RANGE2 37
202888202775
#define SQL_UPDATE_LEVEL_IDX 38
202889202776
#define SQL_UPDATE_LEVEL 39
202777
+
202778
+/*
202779
+** Wrapper around sqlite3_prepare_v3() to ensure that SQLITE_PREPARE_FROM_DDL
202780
+** is always set.
202781
+*/
202782
+SQLITE_PRIVATE int sqlite3Fts3PrepareStmt(
202783
+ Fts3Table *p, /* Prepare for this connection */
202784
+ const char *zSql, /* SQL to prepare */
202785
+ int bPersist, /* True to set SQLITE_PREPARE_PERSISTENT */
202786
+ int bAllowVtab, /* True to omit SQLITE_PREPARE_NO_VTAB */
202787
+ sqlite3_stmt **pp /* OUT: Prepared statement */
202788
+){
202789
+ int f = SQLITE_PREPARE_FROM_DDL
202790
+ |((bAllowVtab==0) ? SQLITE_PREPARE_NO_VTAB : 0)
202791
+ |(bPersist ? SQLITE_PREPARE_PERSISTENT : 0);
202792
+
202793
+ return sqlite3_prepare_v3(p->db, zSql, -1, f, pp, NULL);
202794
+}
202890202795
202891202796
/*
202892202797
** This function is used to obtain an SQLite prepared statement handle
202893202798
** for the statement identified by the second argument. If successful,
202894202799
** *pp is set to the requested statement handle and SQLITE_OK returned.
@@ -203011,24 +202916,24 @@
203011202916
assert( SizeofArray(azSql)==SizeofArray(p->aStmt) );
203012202917
assert( eStmt<SizeofArray(azSql) && eStmt>=0 );
203013202918
203014202919
pStmt = p->aStmt[eStmt];
203015202920
if( !pStmt ){
203016
- int f = SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB;
202921
+ int bAllowVtab = 0;
203017202922
char *zSql;
203018202923
if( eStmt==SQL_CONTENT_INSERT ){
203019202924
zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist);
203020202925
}else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){
203021
- f &= ~SQLITE_PREPARE_NO_VTAB;
202926
+ bAllowVtab = 1;
203022202927
zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist);
203023202928
}else{
203024202929
zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName);
203025202930
}
203026202931
if( !zSql ){
203027202932
rc = SQLITE_NOMEM;
203028202933
}else{
203029
- rc = sqlite3_prepare_v3(p->db, zSql, -1, f, &pStmt, NULL);
202934
+ rc = sqlite3Fts3PrepareStmt(p, zSql, 1, bAllowVtab, &pStmt);
203030202935
sqlite3_free(zSql);
203031202936
assert( rc==SQLITE_OK || pStmt==0 );
203032202937
p->aStmt[eStmt] = pStmt;
203033202938
}
203034202939
}
@@ -203373,11 +203278,13 @@
203373203278
PendingList *pList;
203374203279
int rc = SQLITE_OK;
203375203280
203376203281
pList = (PendingList *)fts3HashFind(pHash, zToken, nToken);
203377203282
if( pList ){
203378
- p->nPendingData -= (pList->nData + nToken + sizeof(Fts3HashElem));
203283
+ assert( (i64)pList->nData+(i64)nToken+(i64)sizeof(Fts3HashElem)
203284
+ <= (i64)p->nPendingData );
203285
+ p->nPendingData -= (int)(pList->nData + nToken + sizeof(Fts3HashElem));
203379203286
}
203380203287
if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){
203381203288
if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){
203382203289
/* Malloc failed while inserting the new entry. This can only
203383203290
** happen if there was no previous entry for this token.
@@ -203386,11 +203293,13 @@
203386203293
sqlite3_free(pList);
203387203294
rc = SQLITE_NOMEM;
203388203295
}
203389203296
}
203390203297
if( rc==SQLITE_OK ){
203391
- p->nPendingData += (pList->nData + nToken + sizeof(Fts3HashElem));
203298
+ assert( (i64)p->nPendingData + pList->nData + nToken
203299
+ + sizeof(Fts3HashElem) <= 0x3fffffff );
203300
+ p->nPendingData += (int)(pList->nData + nToken + sizeof(Fts3HashElem));
203392203301
}
203393203302
return rc;
203394203303
}
203395203304
203396203305
/*
@@ -206187,11 +206096,11 @@
206187206096
/* Compose and prepare an SQL statement to loop through the content table */
206188206097
char *zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist);
206189206098
if( !zSql ){
206190206099
rc = SQLITE_NOMEM;
206191206100
}else{
206192
- rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
206101
+ rc = sqlite3Fts3PrepareStmt(p, zSql, 0, 1, &pStmt);
206193206102
sqlite3_free(zSql);
206194206103
}
206195206104
206196206105
if( rc==SQLITE_OK ){
206197206106
sqlite3_int64 nByte = sizeof(u32) * ((sqlite3_int64)p->nColumn+1)*3;
@@ -207940,11 +207849,11 @@
207940207849
207941207850
zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist);
207942207851
if( !zSql ){
207943207852
rc = SQLITE_NOMEM;
207944207853
}else{
207945
- rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
207854
+ rc = sqlite3Fts3PrepareStmt(p, zSql, 0, 1, &pStmt);
207946207855
sqlite3_free(zSql);
207947207856
}
207948207857
207949207858
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
207950207859
i64 iDocid = sqlite3_column_int64(pStmt, 0);
@@ -220394,11 +220303,11 @@
220394220303
tree.nBytesPerCell = 8 + 8 * tree.nDim;
220395220304
node.zData = (u8 *)sqlite3_value_blob(apArg[1]);
220396220305
if( node.zData==0 ) return;
220397220306
nData = sqlite3_value_bytes(apArg[1]);
220398220307
if( nData<4 ) return;
220399
- if( nData<NCELL(&node)*tree.nBytesPerCell ) return;
220308
+ if( nData<4+NCELL(&node)*tree.nBytesPerCell ) return;
220400220309
220401220310
pOut = sqlite3_str_new(0);
220402220311
for(ii=0; ii<NCELL(&node); ii++){
220403220312
RtreeCell cell;
220404220313
int jj;
@@ -225066,11 +224975,11 @@
225066224975
total += cnt;
225067224976
if( total>limit ){
225068224977
/* ERROR: copy exceeds output file size */
225069224978
return -1;
225070224979
}
225071
- if( (int)(ofst+cnt) > lenSrc ){
224980
+ if( (u64)ofst+(u64)cnt > (u64)lenSrc ){
225072224981
/* ERROR: copy extends past end of input */
225073224982
return -1;
225074224983
}
225075224984
memcpy(zOut, &zSrc[ofst], cnt);
225076224985
zOut += cnt;
@@ -239475,11 +239384,17 @@
239475239384
# define FLEXARRAY
239476239385
#else
239477239386
# define FLEXARRAY 1
239478239387
#endif
239479239388
239480
-#endif
239389
+#endif /* SQLITE_AMALGAMATION */
239390
+
239391
+/*
239392
+** Constants for the largest and smallest possible 32-bit signed integers.
239393
+*/
239394
+# define LARGEST_INT32 ((int)(0x7fffffff))
239395
+# define SMALLEST_INT32 ((int)((-1) - LARGEST_INT32))
239481239396
239482239397
/* Truncate very long tokens to this many bytes. Hard limit is
239483239398
** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset
239484239399
** field that occurs at the start of each leaf page (see fts5_index.c). */
239485239400
#define FTS5_MAX_TOKEN_SIZE 32768
@@ -250200,10 +250115,11 @@
250200250115
250201250116
ASSERT_SZLEAF_OK(pIter->pLeaf);
250202250117
while( 1 ){
250203250118
u64 iDelta = 0;
250204250119
250120
+ if( i>=n ) break;
250205250121
if( eDetail==FTS5_DETAIL_NONE ){
250206250122
/* todo */
250207250123
if( i<n && a[i]==0 ){
250208250124
i++;
250209250125
if( i<n && a[i]==0 ) i++;
@@ -254056,11 +253972,11 @@
254056253972
if( nMerge<0 ){
254057253973
Fts5Structure *pNew = fts5IndexOptimizeStruct(p, pStruct);
254058253974
fts5StructureRelease(pStruct);
254059253975
pStruct = pNew;
254060253976
nMin = 1;
254061
- nMerge = nMerge*-1;
253977
+ nMerge = (nMerge==SMALLEST_INT32 ? LARGEST_INT32 : (nMerge*-1));
254062253978
}
254063253979
if( pStruct && pStruct->nLevel ){
254064253980
if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){
254065253981
fts5StructureWrite(p, pStruct);
254066253982
}
@@ -259746,10 +259662,11 @@
259746259662
}
259747259663
}
259748259664
}
259749259665
259750259666
update_out:
259667
+ sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
259751259668
pTab->p.pConfig->pzErrmsg = 0;
259752259669
return rc;
259753259670
}
259754259671
259755259672
/*
@@ -261263,11 +261180,11 @@
261263261180
int nArg, /* Number of args */
261264261181
sqlite3_value **apUnused /* Function arguments */
261265261182
){
261266261183
assert( nArg==0 );
261267261184
UNUSED_PARAM2(nArg, apUnused);
261268
- sqlite3_result_text(pCtx, "fts5: 2025-11-25 18:20:33 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911", -1, SQLITE_TRANSIENT);
261185
+ sqlite3_result_text(pCtx, "fts5: 2026-01-09 00:41:35 9adab8b2bef4130abd358d53384cb5f4dd691b808336bb7102793b0165b1c516", -1, SQLITE_TRANSIENT);
261269261186
}
261270261187
261271261188
/*
261272261189
** Implementation of fts5_locale(LOCALE, TEXT) function.
261273261190
**
@@ -266084,20 +266001,31 @@
266084266001
266085266002
*ppCsr = (sqlite3_vtab_cursor*)pCsr;
266086266003
return rc;
266087266004
}
266088266005
266006
+/*
266007
+** Restore cursor pCsr to the state it was in immediately after being
266008
+** created by the xOpen() method.
266009
+*/
266089266010
static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
266011
+ int nCol = pCsr->pFts5->pConfig->nCol;
266090266012
pCsr->rowid = 0;
266091266013
sqlite3Fts5IterClose(pCsr->pIter);
266092266014
sqlite3Fts5StructureRelease(pCsr->pStruct);
266093266015
pCsr->pStruct = 0;
266094266016
pCsr->pIter = 0;
266095266017
sqlite3_free(pCsr->zLeTerm);
266096266018
pCsr->nLeTerm = -1;
266097266019
pCsr->zLeTerm = 0;
266098266020
pCsr->bEof = 0;
266021
+ pCsr->iCol = 0;
266022
+ pCsr->iInstPos = 0;
266023
+ pCsr->iInstOff = 0;
266024
+ pCsr->colUsed = 0;
266025
+ memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
266026
+ memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
266099266027
}
266100266028
266101266029
/*
266102266030
** Close the cursor. For additional information see the documentation
266103266031
** on the xClose method of the virtual table interface.
266104266032
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** 5804ba4874cc41b11e8bb559d5533283c289 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.52.0"
471 #define SQLITE_VERSION_NUMBER 3052000
472 #define SQLITE_SOURCE_ID "2025-11-25 18:20:33 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2025-11-25T18:20:33.534Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -1809,11 +1809,11 @@
1809 ** ^SQLite will use the xCurrentTimeInt64() method to get the current
1810 ** date and time if that method is available (if iVersion is 2 or
1811 ** greater and the function pointer is not NULL) and will fall back
1812 ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
1813 **
1814 ** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
1815 ** are not used by the SQLite core. These optional interfaces are provided
1816 ** by some VFSes to facilitate testing of the VFS code. By overriding
1817 ** system calls with functions under its control, a test program can
1818 ** simulate faults and error conditions that would otherwise be difficult
1819 ** or impossible to induce. The set of system calls that can be overridden
@@ -4493,10 +4493,11 @@
4493 ** <li> sqlite3_errcode()
4494 ** <li> sqlite3_extended_errcode()
4495 ** <li> sqlite3_errmsg()
4496 ** <li> sqlite3_errmsg16()
4497 ** <li> sqlite3_error_offset()
 
4498 ** </ul>
4499 **
4500 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
4501 ** text that describes the error, as either UTF-8 or UTF-16 respectively,
4502 ** or NULL if no error message is available.
@@ -4751,16 +4752,32 @@
4751 ** compiles to see if some SQL syntax is well-formed, without generating
4752 ** messages on the global error log when it is not. If the test compile
4753 ** fails, the sqlite3_prepare_v3() call returns the same error indications
4754 ** with or without this flag; it just omits the call to [sqlite3_log()] that
4755 ** logs the error.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4756 ** </dl>
4757 */
4758 #define SQLITE_PREPARE_PERSISTENT 0x01
4759 #define SQLITE_PREPARE_NORMALIZE 0x02
4760 #define SQLITE_PREPARE_NO_VTAB 0x04
4761 #define SQLITE_PREPARE_DONT_LOG 0x10
 
4762
4763 /*
4764 ** CAPI3REF: Compiling An SQL Statement
4765 ** KEYWORDS: {SQL statement compiler}
4766 ** METHOD: sqlite3
@@ -4770,12 +4787,13 @@
4770 ** program using one of these routines. Or, in other words, these routines
4771 ** are constructors for the [prepared statement] object.
4772 **
4773 ** The preferred routine to use is [sqlite3_prepare_v2()]. The
4774 ** [sqlite3_prepare()] interface is legacy and should be avoided.
4775 ** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
4776 ** for special purposes.
 
4777 **
4778 ** The use of the UTF-8 interfaces is preferred, as SQLite currently
4779 ** does all parsing using UTF-8. The UTF-16 interfaces are provided
4780 ** as a convenience. The UTF-16 interfaces work by converting the
4781 ** input text into UTF-8, then invoking the corresponding UTF-8 interface.
@@ -6605,14 +6623,18 @@
6605 ** use for client data is to provide a mechanism for wrapper libraries
6606 ** to store additional information about an SQLite database connection.
6607 **
6608 ** There is no limit (other than available memory) on the number of different
6609 ** client data pointers (with different names) that can be attached to a
6610 ** single database connection. However, the implementation is optimized
6611 ** for the case of having only one or two different client data names.
6612 ** Applications and wrapper libraries are discouraged from using more than
6613 ** one client data name each.
 
 
 
 
6614 **
6615 ** There is no way to enumerate the client data pointers
6616 ** associated with a database connection. The N parameter can be thought
6617 ** of as a secret key such that only code that knows the secret key is able
6618 ** to access the associated data.
@@ -7745,22 +7767,22 @@
7745 ** ^This interface loads an SQLite extension library from the named file.
7746 **
7747 ** ^The sqlite3_load_extension() interface attempts to load an
7748 ** [SQLite extension] library contained in the file zFile. If
7749 ** the file cannot be loaded directly, attempts are made to load
7750 ** with various operating-system specific extensions added.
7751 ** So for example, if "samplelib" cannot be loaded, then names like
7752 ** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
7753 ** be tried also.
7754 **
7755 ** ^The entry point is zProc.
7756 ** ^(zProc may be 0, in which case SQLite will try to come up with an
7757 ** entry point name on its own. It first tries "sqlite3_extension_init".
7758 ** If that does not work, it constructs a name "sqlite3_X_init" where
7759 ** X consists of the lower-case equivalent of all ASCII alphabetic
7760 ** characters in the filename from the last "/" to the first following
7761 ** "." and omitting any initial "lib".)^
7762 ** ^The sqlite3_load_extension() interface returns
7763 ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
7764 ** ^If an error occurs and pzErrMsg is not 0, then the
7765 ** [sqlite3_load_extension()] interface shall attempt to
7766 ** fill *pzErrMsg with error message text stored in memory
@@ -9049,11 +9071,11 @@
9049 ** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
9050 ** that contains the constructed string. The calling application should
9051 ** pass the returned value to [sqlite3_free()] to avoid a memory leak.
9052 ** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
9053 ** errors were encountered during construction of the string. ^The
9054 ** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
9055 ** string in [sqlite3_str] object X is zero bytes long.
9056 **
9057 ** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
9058 ** X and the string content it contains. Calling sqlite3_str_free(X) is
9059 ** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
@@ -14386,10 +14408,13 @@
14386 ** The maximum length of a single SQL statement in bytes.
14387 **
14388 ** It used to be the case that setting this value to zero would
14389 ** turn the limit off. That is no longer true. It is not possible
14390 ** to turn this limit off.
 
 
 
14391 */
14392 #ifndef SQLITE_MAX_SQL_LENGTH
14393 # define SQLITE_MAX_SQL_LENGTH 1000000000
14394 #endif
14395
@@ -17525,11 +17550,11 @@
17525
17526 /*
17527 ** Additional non-public SQLITE_PREPARE_* flags
17528 */
17529 #define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
17530 #define SQLITE_PREPARE_MASK 0x1f /* Mask of public flags */
17531
17532 /*
17533 ** Prototypes for the VDBE interface. See comments on the implementation
17534 ** for a description of what each of these routines does.
17535 */
@@ -20765,23 +20790,23 @@
20765 **
20766 ** (op == TK_INSERT)
20767 ** orconf -> stores the ON CONFLICT algorithm
20768 ** pSelect -> The content to be inserted - either a SELECT statement or
20769 ** a VALUES clause.
20770 ** zTarget -> Dequoted name of the table to insert into.
20771 ** pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
20772 ** statement, then this stores the column-names to be
20773 ** inserted into.
20774 ** pUpsert -> The ON CONFLICT clauses for an Upsert
20775 **
20776 ** (op == TK_DELETE)
20777 ** zTarget -> Dequoted name of the table to delete from.
20778 ** pWhere -> The WHERE clause of the DELETE statement if one is specified.
20779 ** Otherwise NULL.
20780 **
20781 ** (op == TK_UPDATE)
20782 ** zTarget -> Dequoted name of the table to update.
20783 ** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
20784 ** Otherwise NULL.
20785 ** pExprList -> A list of the columns to update and the expressions to update
20786 ** them to. See sqlite3Update() documentation of "pChanges"
20787 ** argument.
@@ -20797,12 +20822,11 @@
20797 u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT,
20798 ** or TK_RETURNING */
20799 u8 orconf; /* OE_Rollback etc. */
20800 Trigger *pTrig; /* The trigger that this step is a part of */
20801 Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
20802 char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
20803 SrcList *pFrom; /* FROM clause for UPDATE statement (if any) */
20804 Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
20805 ExprList *pExprList; /* SET clause for UPDATE, or RETURNING clause */
20806 IdList *pIdList; /* Column names for INSERT */
20807 Upsert *pUpsert; /* Upsert clauses on an INSERT */
20808 char *zSpan; /* Original SQL text of this command */
@@ -21547,10 +21571,11 @@
21547 #ifdef SQLITE_DEBUG
21548 SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
21549 #endif
21550 SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
21551 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
 
21552 SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
21553 SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
21554 SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
21555 SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
21556 SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*);
@@ -21865,21 +21890,20 @@
21865 SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int);
21866 void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
21867 SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
21868 SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
21869 const char*,const char*);
21870 SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,Token*, IdList*,
21871 Select*,u8,Upsert*,
21872 const char*,const char*);
21873 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,Token*,SrcList*,ExprList*,
21874 Expr*, u8, const char*,const char*);
21875 SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,Token*, Expr*,
21876 const char*,const char*);
21877 SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*);
21878 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
21879 SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);
21880 SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(Parse*, TriggerStep*);
21881 # define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
21882 # define sqlite3IsToplevel(p) ((p)->pToplevel==0)
21883 #else
21884 # define sqlite3TriggersExist(B,C,D,E,F) 0
21885 # define sqlite3DeleteTrigger(A,B)
@@ -21889,11 +21913,10 @@
21889 # define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)
21890 # define sqlite3TriggerList(X, Y) 0
21891 # define sqlite3ParseToplevel(p) p
21892 # define sqlite3IsToplevel(p) 1
21893 # define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
21894 # define sqlite3TriggerStepSrc(A,B) 0
21895 #endif
21896
21897 SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
21898 SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
21899 SQLITE_PRIVATE void sqlite3SrcItemColumnUsed(SrcItem*,int);
@@ -30648,18 +30671,10 @@
30648 # define SQLITE_OS_WINCE 1
30649 #else
30650 # define SQLITE_OS_WINCE 0
30651 #endif
30652
30653 /*
30654 ** Determine if we are dealing with WinRT, which provides only a subset of
30655 ** the full Win32 API.
30656 */
30657 #if !defined(SQLITE_OS_WINRT)
30658 # define SQLITE_OS_WINRT 0
30659 #endif
30660
30661 /*
30662 ** For WinCE, some API function parameters do not appear to be declared as
30663 ** volatile.
30664 */
30665 #if SQLITE_OS_WINCE
@@ -30670,11 +30685,11 @@
30670
30671 /*
30672 ** For some Windows sub-platforms, the _beginthreadex() / _endthreadex()
30673 ** functions are not available (e.g. those not using MSVC, Cygwin, etc).
30674 */
30675 #if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
30676 SQLITE_THREADSAFE>0 && !defined(__CYGWIN__)
30677 # define SQLITE_OS_WIN_THREADS 1
30678 #else
30679 # define SQLITE_OS_WIN_THREADS 0
30680 #endif
@@ -30787,15 +30802,11 @@
30787 static int winMutexInit(void){
30788 /* The first to increment to 1 does actual initialization */
30789 if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
30790 int i;
30791 for(i=0; i<ArraySize(winMutex_staticMutexes); i++){
30792 #if SQLITE_OS_WINRT
30793 InitializeCriticalSectionEx(&winMutex_staticMutexes[i].mutex, 0, 0);
30794 #else
30795 InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
30796 #endif
30797 }
30798 winMutex_isInit = 1;
30799 }else{
30800 /* Another thread is (in the process of) initializing the static
30801 ** mutexes */
@@ -30881,15 +30892,11 @@
30881 #ifdef SQLITE_DEBUG
30882 #ifdef SQLITE_WIN32_MUTEX_TRACE_DYNAMIC
30883 p->trace = 1;
30884 #endif
30885 #endif
30886 #if SQLITE_OS_WINRT
30887 InitializeCriticalSectionEx(&p->mutex, 0, 0);
30888 #else
30889 InitializeCriticalSection(&p->mutex);
30890 #endif
30891 }
30892 break;
30893 }
30894 default: {
30895 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -38298,11 +38305,11 @@
38298
38299 /*****************************************************************************
38300 ** Debugging logic
38301 */
38302
38303 /* SQLITE_KV_TRACE() is used for tracing calls to kvstorage routines. */
38304 #if 0
38305 #define SQLITE_KV_TRACE(X) printf X
38306 #else
38307 #define SQLITE_KV_TRACE(X)
38308 #endif
@@ -38312,18 +38319,22 @@
38312 #define SQLITE_KV_LOG(X) printf X
38313 #else
38314 #define SQLITE_KV_LOG(X)
38315 #endif
38316
38317
38318 /*
38319 ** Forward declaration of objects used by this VFS implementation
38320 */
38321 typedef struct KVVfsFile KVVfsFile;
38322
38323 /* A single open file. There are only two files represented by this
38324 ** VFS - the database and the rollback journal.
 
 
 
 
 
38325 */
38326 struct KVVfsFile {
38327 sqlite3_file base; /* IO methods */
38328 const char *zClass; /* Storage class */
38329 int isJournal; /* True if this is a journal file */
@@ -38369,11 +38380,11 @@
38369 static int kvvfsSleep(sqlite3_vfs*, int microseconds);
38370 static int kvvfsCurrentTime(sqlite3_vfs*, double*);
38371 static int kvvfsCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
38372
38373 static sqlite3_vfs sqlite3OsKvvfsObject = {
38374 1, /* iVersion */
38375 sizeof(KVVfsFile), /* szOsFile */
38376 1024, /* mxPathname */
38377 0, /* pNext */
38378 "kvvfs", /* zName */
38379 0, /* pAppData */
@@ -38445,42 +38456,56 @@
38445 #include <sys/stat.h>
38446 #include <unistd.h>
38447
38448 /* Forward declarations for the low-level storage engine
38449 */
38450 static int kvstorageWrite(const char*, const char *zKey, const char *zData);
38451 static int kvstorageDelete(const char*, const char *zKey);
38452 static int kvstorageRead(const char*, const char *zKey, char *zBuf, int nBuf);
38453 #define KVSTORAGE_KEY_SZ 32
 
 
 
 
 
38454
38455 /* Expand the key name with an appropriate prefix and put the result
38456 ** in zKeyOut[]. The zKeyOut[] buffer is assumed to hold at least
38457 ** KVSTORAGE_KEY_SZ bytes.
38458 */
38459 static void kvstorageMakeKey(
38460 const char *zClass,
38461 const char *zKeyIn,
38462 char *zKeyOut
38463 ){
38464 sqlite3_snprintf(KVSTORAGE_KEY_SZ, zKeyOut, "kvvfs-%s-%s", zClass, zKeyIn);
 
 
 
 
38465 }
38466
 
 
 
 
 
38467 /* Write content into a key. zClass is the particular namespace of the
38468 ** underlying key/value store to use - either "local" or "session".
38469 **
38470 ** Both zKey and zData are zero-terminated pure text strings.
38471 **
38472 ** Return the number of errors.
38473 */
38474 static int kvstorageWrite(
38475 const char *zClass,
38476 const char *zKey,
38477 const char *zData
38478 ){
38479 FILE *fd;
38480 char zXKey[KVSTORAGE_KEY_SZ];
38481 kvstorageMakeKey(zClass, zKey, zXKey);
38482 fd = fopen(zXKey, "wb");
38483 if( fd ){
38484 SQLITE_KV_TRACE(("KVVFS-WRITE %-15s (%d) %.50s%s\n", zXKey,
38485 (int)strlen(zData), zData,
38486 strlen(zData)>50 ? "..." : ""));
@@ -38494,13 +38519,13 @@
38494
38495 /* Delete a key (with its corresponding data) from the key/value
38496 ** namespace given by zClass. If the key does not previously exist,
38497 ** this routine is a no-op.
38498 */
38499 static int kvstorageDelete(const char *zClass, const char *zKey){
38500 char zXKey[KVSTORAGE_KEY_SZ];
38501 kvstorageMakeKey(zClass, zKey, zXKey);
38502 unlink(zXKey);
38503 SQLITE_KV_TRACE(("KVVFS-DELETE %-15s\n", zXKey));
38504 return 0;
38505 }
38506
@@ -38517,20 +38542,20 @@
38517 ** If nBuf<=0 then this routine simply returns the size of the data
38518 ** without actually reading it. Similarly, if nBuf==1 then it
38519 ** zero-terminates zBuf at zBuf[0] and returns the size of the data
38520 ** without reading it.
38521 */
38522 static int kvstorageRead(
38523 const char *zClass,
38524 const char *zKey,
38525 char *zBuf,
38526 int nBuf
38527 ){
38528 FILE *fd;
38529 struct stat buf;
38530 char zXKey[KVSTORAGE_KEY_SZ];
38531 kvstorageMakeKey(zClass, zKey, zXKey);
38532 if( access(zXKey, R_OK)!=0
38533 || stat(zXKey, &buf)!=0
38534 || !S_ISREG(buf.st_mode)
38535 ){
38536 SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
@@ -38558,27 +38583,39 @@
38558 SQLITE_KV_TRACE(("KVVFS-READ %-15s (%lld) %.50s%s\n", zXKey,
38559 n, zBuf, n>50 ? "..." : ""));
38560 return (int)n;
38561 }
38562 }
 
 
38563
38564 /*
38565 ** An internal level of indirection which enables us to replace the
38566 ** kvvfs i/o methods with JavaScript implementations in WASM builds.
38567 ** Maintenance reminder: if this struct changes in any way, the JSON
38568 ** rendering of its structure must be updated in
38569 ** sqlite3-wasm.c:sqlite3__wasm_enum_json(). There are no binary
38570 ** compatibility concerns, so it does not need an iVersion
38571 ** member.
38572 */
38573 typedef struct sqlite3_kvvfs_methods sqlite3_kvvfs_methods;
38574 struct sqlite3_kvvfs_methods {
38575 int (*xRead)(const char *zClass, const char *zKey, char *zBuf, int nBuf);
38576 int (*xWrite)(const char *zClass, const char *zKey, const char *zData);
38577 int (*xDelete)(const char *zClass, const char *zKey);
38578 const int nKeySize;
 
 
 
 
 
 
 
 
 
 
38579 };
 
38580
38581 /*
38582 ** This object holds the kvvfs I/O methods which may be swapped out
38583 ** for JavaScript-side implementations in WASM builds. In such builds
38584 ** it cannot be const, but in native builds it should be so that
@@ -38590,14 +38627,24 @@
38590 */
38591 #ifndef SQLITE_WASM
38592 const
38593 #endif
38594 SQLITE_PRIVATE sqlite3_kvvfs_methods sqlite3KvvfsMethods = {
38595 kvstorageRead,
38596 kvstorageWrite,
38597 kvstorageDelete,
38598 KVSTORAGE_KEY_SZ
 
 
 
 
 
 
 
 
 
 
38599 };
38600
38601 /****** Utility subroutines ************************************************/
38602
38603 /*
@@ -38620,11 +38667,14 @@
38620 **
38621 ** * Because there is no overlap between the encoding characters
38622 ** of hexadecimal and base-26 numbers, it is always clear where
38623 ** one stops and the next begins.
38624 */
38625 static int kvvfsEncode(const char *aData, int nData, char *aOut){
 
 
 
38626 int i, j;
38627 const unsigned char *a = (const unsigned char*)aData;
38628 for(i=j=0; i<nData; i++){
38629 unsigned char c = a[i];
38630 if( c!=0 ){
@@ -38671,13 +38721,17 @@
38671
38672 /*
38673 ** Decode the text encoding back to binary. The binary content is
38674 ** written into pOut, which must be at least nOut bytes in length.
38675 **
38676 ** The return value is the number of bytes actually written into aOut[].
 
38677 */
38678 static int kvvfsDecode(const char *a, char *aOut, int nOut){
 
 
 
38679 int i, j;
38680 int c;
38681 const unsigned char *aIn = (const unsigned char*)a;
38682 i = 0;
38683 j = 0;
@@ -38698,11 +38752,11 @@
38698 j += n;
38699 if( c==0 || mult==1 ) break; /* progress stalled if mult==1 */
38700 }else{
38701 aOut[j] = c<<4;
38702 c = kvvfsHexValue[aIn[++i]];
38703 if( c<0 ) break;
38704 aOut[j++] += c;
38705 i++;
38706 }
38707 }
38708 return j;
@@ -38751,17 +38805,18 @@
38751 ** Read or write the "sz" element, containing the database file size.
38752 */
38753 static sqlite3_int64 kvvfsReadFileSize(KVVfsFile *pFile){
38754 char zData[50];
38755 zData[0] = 0;
38756 sqlite3KvvfsMethods.xRead(pFile->zClass, "sz", zData, sizeof(zData)-1);
 
38757 return strtoll(zData, 0, 0);
38758 }
38759 static int kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){
38760 char zData[50];
38761 sqlite3_snprintf(sizeof(zData), zData, "%lld", sz);
38762 return sqlite3KvvfsMethods.xWrite(pFile->zClass, "sz", zData);
38763 }
38764
38765 /****** sqlite3_io_methods methods ******************************************/
38766
38767 /*
@@ -38772,10 +38827,13 @@
38772
38773 SQLITE_KV_LOG(("xClose %s %s\n", pFile->zClass,
38774 pFile->isJournal ? "journal" : "db"));
38775 sqlite3_free(pFile->aJrnl);
38776 sqlite3_free(pFile->aData);
 
 
 
38777 return SQLITE_OK;
38778 }
38779
38780 /*
38781 ** Read from the -journal file.
@@ -38788,20 +38846,26 @@
38788 ){
38789 KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
38790 assert( pFile->isJournal );
38791 SQLITE_KV_LOG(("xRead('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
38792 if( pFile->aJrnl==0 ){
38793 int szTxt = kvstorageRead(pFile->zClass, "jrnl", 0, 0);
 
 
38794 char *aTxt;
38795 if( szTxt<=4 ){
38796 return SQLITE_IOERR;
38797 }
38798 aTxt = sqlite3_malloc64( szTxt+1 );
38799 if( aTxt==0 ) return SQLITE_NOMEM;
38800 kvstorageRead(pFile->zClass, "jrnl", aTxt, szTxt+1);
38801 kvvfsDecodeJournal(pFile, aTxt, szTxt);
 
 
 
38802 sqlite3_free(aTxt);
 
38803 if( pFile->aJrnl==0 ) return SQLITE_IOERR;
38804 }
38805 if( iOfst+iAmt>pFile->nJrnl ){
38806 return SQLITE_IOERR_SHORT_READ;
38807 }
@@ -38837,12 +38901,12 @@
38837 pgno = 1 + iOfst/iAmt;
38838 }else{
38839 pgno = 1;
38840 }
38841 sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
38842 got = sqlite3KvvfsMethods.xRead(pFile->zClass, zKey,
38843 aData, SQLITE_KVOS_SZ-1);
38844 if( got<0 ){
38845 n = 0;
38846 }else{
38847 aData[got] = 0;
38848 if( iOfst+iAmt<512 ){
@@ -38906,35 +38970,36 @@
38906 ){
38907 KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
38908 unsigned int pgno;
38909 char zKey[30];
38910 char *aData = pFile->aData;
 
38911 SQLITE_KV_LOG(("xWrite('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
38912 assert( iAmt>=512 && iAmt<=65536 );
38913 assert( (iAmt & (iAmt-1))==0 );
38914 assert( pFile->szPage<0 || pFile->szPage==iAmt );
38915 pFile->szPage = iAmt;
38916 pgno = 1 + iOfst/iAmt;
38917 sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
38918 kvvfsEncode(zBuf, iAmt, aData);
38919 if( sqlite3KvvfsMethods.xWrite(pFile->zClass, zKey, aData) ){
38920 return SQLITE_IOERR;
 
 
 
38921 }
38922 if( iOfst+iAmt > pFile->szDb ){
38923 pFile->szDb = iOfst + iAmt;
38924 }
38925 return SQLITE_OK;
38926 }
38927
38928 /*
38929 ** Truncate an kvvfs-file.
38930 */
38931 static int kvvfsTruncateJrnl(sqlite3_file *pProtoFile, sqlite_int64 size){
38932 KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
38933 SQLITE_KV_LOG(("xTruncate('%s-journal',%lld)\n", pFile->zClass, size));
38934 assert( size==0 );
38935 sqlite3KvvfsMethods.xDelete(pFile->zClass, "jrnl");
38936 sqlite3_free(pFile->aJrnl);
38937 pFile->aJrnl = 0;
38938 pFile->nJrnl = 0;
38939 return SQLITE_OK;
38940 }
@@ -38949,11 +39014,11 @@
38949 SQLITE_KV_LOG(("xTruncate('%s-db',%lld)\n", pFile->zClass, size));
38950 pgno = 1 + size/pFile->szPage;
38951 pgnoMax = 2 + pFile->szDb/pFile->szPage;
38952 while( pgno<=pgnoMax ){
38953 sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
38954 sqlite3KvvfsMethods.xDelete(pFile->zClass, zKey);
38955 pgno++;
38956 }
38957 pFile->szDb = size;
38958 return kvvfsWriteFileSize(pFile, size) ? SQLITE_IOERR : SQLITE_OK;
38959 }
@@ -38981,11 +39046,11 @@
38981 zOut[i++] = 'a' + (n%26);
38982 n /= 26;
38983 }while( n>0 );
38984 zOut[i++] = ' ';
38985 kvvfsEncode(pFile->aJrnl, pFile->nJrnl, &zOut[i]);
38986 i = sqlite3KvvfsMethods.xWrite(pFile->zClass, "jrnl", zOut);
38987 sqlite3_free(zOut);
38988 return i ? SQLITE_IOERR : SQLITE_OK;
38989 }
38990 static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
38991 return SQLITE_OK;
@@ -39095,53 +39160,56 @@
39095 int *pOutFlags
39096 ){
39097 KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
39098 if( zName==0 ) zName = "";
39099 SQLITE_KV_LOG(("xOpen(\"%s\")\n", zName));
39100 if( strcmp(zName, "local")==0
39101 || strcmp(zName, "session")==0
39102 ){
39103 pFile->isJournal = 0;
39104 pFile->base.pMethods = &kvvfs_db_io_methods;
39105 }else
39106 if( strcmp(zName, "local-journal")==0
39107 || strcmp(zName, "session-journal")==0
39108 ){
39109 pFile->isJournal = 1;
39110 pFile->base.pMethods = &kvvfs_jrnl_io_methods;
 
 
 
 
 
39111 }else{
39112 return SQLITE_CANTOPEN;
 
39113 }
39114 if( zName[0]=='s' ){
39115 pFile->zClass = "session";
39116 }else{
39117 pFile->zClass = "local";
39118 }
39119 pFile->aData = sqlite3_malloc64(SQLITE_KVOS_SZ);
39120 if( pFile->aData==0 ){
39121 return SQLITE_NOMEM;
39122 }
39123 pFile->aJrnl = 0;
39124 pFile->nJrnl = 0;
39125 pFile->szPage = -1;
39126 pFile->szDb = -1;
39127 return SQLITE_OK;
39128 }
39129
39130 /*
39131 ** Delete the file located at zPath. If the dirSync argument is true,
39132 ** ensure the file-system modifications are synced to disk before
39133 ** returning.
39134 */
39135 static int kvvfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
 
39136 if( strcmp(zPath, "local-journal")==0 ){
39137 sqlite3KvvfsMethods.xDelete("local", "jrnl");
39138 }else
39139 if( strcmp(zPath, "session-journal")==0 ){
39140 sqlite3KvvfsMethods.xDelete("session", "jrnl");
39141 }
39142 return SQLITE_OK;
 
 
 
39143 }
39144
39145 /*
39146 ** Test for access permissions. Return true if the requested permission
39147 ** is available, or false otherwise.
@@ -39151,25 +39219,46 @@
39151 const char *zPath,
39152 int flags,
39153 int *pResOut
39154 ){
39155 SQLITE_KV_LOG(("xAccess(\"%s\")\n", zPath));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39156 if( strcmp(zPath, "local-journal")==0 ){
39157 *pResOut = sqlite3KvvfsMethods.xRead("local", "jrnl", 0, 0)>0;
 
39158 }else
39159 if( strcmp(zPath, "session-journal")==0 ){
39160 *pResOut = sqlite3KvvfsMethods.xRead("session", "jrnl", 0, 0)>0;
 
39161 }else
39162 if( strcmp(zPath, "local")==0 ){
39163 *pResOut = sqlite3KvvfsMethods.xRead("local", "sz", 0, 0)>0;
 
39164 }else
39165 if( strcmp(zPath, "session")==0 ){
39166 *pResOut = sqlite3KvvfsMethods.xRead("session", "sz", 0, 0)>0;
 
39167 }else
39168 {
39169 *pResOut = 0;
39170 }
 
 
39171 SQLITE_KV_LOG(("xAccess returns %d\n",*pResOut));
39172 return SQLITE_OK;
39173 }
39174
39175 /*
@@ -41286,15 +41375,21 @@
41286 }else{
41287 pFile->eFileLock = SHARED_LOCK;
41288 pInode->nLock++;
41289 pInode->nShared = 1;
41290 }
41291 }else if( (eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1)
41292 || unixIsSharingShmNode(pFile)
41293 ){
41294 /* We are trying for an exclusive lock but another thread in this
41295 ** same process is still holding a shared lock. */
 
 
 
 
 
 
 
 
41296 rc = SQLITE_BUSY;
41297 }else{
41298 /* The request was for a RESERVED or EXCLUSIVE lock. It is
41299 ** assumed that there is a SHARED or greater lock on the file
41300 ** already.
@@ -43930,30 +44025,25 @@
43930 ** connection from running "PRAGMA journal_mode=DELETE" in order to take
43931 ** the database out of WAL mode, which is perhaps more serious, but is
43932 ** still not a disaster.
43933 */
43934 static int unixIsSharingShmNode(unixFile *pFile){
43935 int rc;
43936 unixShmNode *pShmNode;
 
43937 if( pFile->pShm==0 ) return 0;
43938 if( pFile->ctrlFlags & UNIXFILE_EXCL ) return 0;
43939 pShmNode = pFile->pShm->pShmNode;
43940 rc = 1;
43941 unixEnterMutex();
43942 if( ALWAYS(pShmNode->nRef==1) ){
43943 struct flock lock;
43944 lock.l_whence = SEEK_SET;
43945 lock.l_start = UNIX_SHM_DMS;
43946 lock.l_len = 1;
43947 lock.l_type = F_WRLCK;
43948 osFcntl(pShmNode->hShm, F_GETLK, &lock);
43949 if( lock.l_type==F_UNLCK ){
43950 rc = 0;
43951 }
43952 }
43953 unixLeaveMutex();
43954 return rc;
43955 }
43956
43957 /*
43958 ** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
43959 **
@@ -47893,19 +47983,19 @@
47893
47894 /*
47895 ** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
47896 ** based on the sub-platform)?
47897 */
47898 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
47899 # define SQLITE_WIN32_HAS_ANSI
47900 #endif
47901
47902 /*
47903 ** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
47904 ** based on the sub-platform)?
47905 */
47906 #if (SQLITE_OS_WINCE || SQLITE_OS_WINNT || SQLITE_OS_WINRT) && \
47907 !defined(SQLITE_WIN32_NO_WIDE)
47908 # define SQLITE_WIN32_HAS_WIDE
47909 #endif
47910
47911 /*
@@ -48040,20 +48130,11 @@
48040 ** mode or memory mapped files (e.g. these APIs are available in the Windows
48041 ** CE SDK; however, they are not present in the header file)?
48042 */
48043 #if SQLITE_WIN32_FILEMAPPING_API && \
48044 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48045 /*
48046 ** Two of the file mapping APIs are different under WinRT. Figure out which
48047 ** set we need.
48048 */
48049 #if SQLITE_OS_WINRT
48050 WINBASEAPI HANDLE WINAPI CreateFileMappingFromApp(HANDLE, \
48051 LPSECURITY_ATTRIBUTES, ULONG, ULONG64, LPCWSTR);
48052
48053 WINBASEAPI LPVOID WINAPI MapViewOfFileFromApp(HANDLE, ULONG, ULONG64, SIZE_T);
48054 #else
48055 #if defined(SQLITE_WIN32_HAS_ANSI)
48056 WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE, LPSECURITY_ATTRIBUTES, \
48057 DWORD, DWORD, DWORD, LPCSTR);
48058 #endif /* defined(SQLITE_WIN32_HAS_ANSI) */
48059
@@ -48061,11 +48142,10 @@
48061 WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE, LPSECURITY_ATTRIBUTES, \
48062 DWORD, DWORD, DWORD, LPCWSTR);
48063 #endif /* defined(SQLITE_WIN32_HAS_WIDE) */
48064
48065 WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, SIZE_T);
48066 #endif /* SQLITE_OS_WINRT */
48067
48068 /*
48069 ** These file mapping APIs are common to both Win32 and WinRT.
48070 */
48071
@@ -48352,11 +48432,11 @@
48352
48353 /*
48354 ** This function is not available on Windows CE or WinRT.
48355 */
48356
48357 #if SQLITE_OS_WINCE || SQLITE_OS_WINRT
48358 # define osAreFileApisANSI() 1
48359 #endif
48360
48361 /*
48362 ** Many system calls are accessed through pointer-to-functions so that
@@ -48367,11 +48447,11 @@
48367 static struct win_syscall {
48368 const char *zName; /* Name of the system call */
48369 sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
48370 sqlite3_syscall_ptr pDefault; /* Default value */
48371 } aSyscall[] = {
48372 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48373 { "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 },
48374 #else
48375 { "AreFileApisANSI", (SYSCALL)0, 0 },
48376 #endif
48377
@@ -48406,20 +48486,20 @@
48406 #endif
48407
48408 #define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \
48409 LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent)
48410
48411 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48412 { "CreateFileW", (SYSCALL)CreateFileW, 0 },
48413 #else
48414 { "CreateFileW", (SYSCALL)0, 0 },
48415 #endif
48416
48417 #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
48418 LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
48419
48420 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \
48421 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) && \
48422 SQLITE_WIN32_CREATEFILEMAPPINGA
48423 { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
48424 #else
48425 { "CreateFileMappingA", (SYSCALL)0, 0 },
@@ -48426,21 +48506,21 @@
48426 #endif
48427
48428 #define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
48429 DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
48430
48431 #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
48432 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
48433 { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
48434 #else
48435 { "CreateFileMappingW", (SYSCALL)0, 0 },
48436 #endif
48437
48438 #define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
48439 DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent)
48440
48441 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48442 { "CreateMutexW", (SYSCALL)CreateMutexW, 0 },
48443 #else
48444 { "CreateMutexW", (SYSCALL)0, 0 },
48445 #endif
48446
@@ -48522,11 +48602,11 @@
48522 #endif
48523
48524 #define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \
48525 LPDWORD))aSyscall[18].pCurrent)
48526
48527 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48528 { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 },
48529 #else
48530 { "GetDiskFreeSpaceW", (SYSCALL)0, 0 },
48531 #endif
48532
@@ -48539,11 +48619,11 @@
48539 { "GetFileAttributesA", (SYSCALL)0, 0 },
48540 #endif
48541
48542 #define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent)
48543
48544 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48545 { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 },
48546 #else
48547 { "GetFileAttributesW", (SYSCALL)0, 0 },
48548 #endif
48549
@@ -48556,15 +48636,11 @@
48556 #endif
48557
48558 #define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \
48559 LPVOID))aSyscall[22].pCurrent)
48560
48561 #if !SQLITE_OS_WINRT
48562 { "GetFileSize", (SYSCALL)GetFileSize, 0 },
48563 #else
48564 { "GetFileSize", (SYSCALL)0, 0 },
48565 #endif
48566
48567 #define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent)
48568
48569 #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI)
48570 { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 },
@@ -48573,11 +48649,11 @@
48573 #endif
48574
48575 #define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \
48576 LPSTR*))aSyscall[24].pCurrent)
48577
48578 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48579 { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 },
48580 #else
48581 { "GetFullPathNameW", (SYSCALL)0, 0 },
48582 #endif
48583
@@ -48608,20 +48684,14 @@
48608 #endif
48609
48610 #define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \
48611 LPCSTR))aSyscall[27].pCurrent)
48612
48613 #if !SQLITE_OS_WINRT
48614 { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 },
48615 #else
48616 { "GetSystemInfo", (SYSCALL)0, 0 },
48617 #endif
48618
48619 #define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent)
48620
48621 { "GetSystemTime", (SYSCALL)GetSystemTime, 0 },
48622
48623 #define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent)
48624
48625 #if !SQLITE_OS_WINCE
48626 { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 },
48627 #else
@@ -48637,23 +48707,19 @@
48637 { "GetTempPathA", (SYSCALL)0, 0 },
48638 #endif
48639
48640 #define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent)
48641
48642 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
48643 { "GetTempPathW", (SYSCALL)GetTempPathW, 0 },
48644 #else
48645 { "GetTempPathW", (SYSCALL)0, 0 },
48646 #endif
48647
48648 #define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent)
48649
48650 #if !SQLITE_OS_WINRT
48651 { "GetTickCount", (SYSCALL)GetTickCount, 0 },
48652 #else
48653 { "GetTickCount", (SYSCALL)0, 0 },
48654 #endif
48655
48656 #define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)
48657
48658 #if defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_GETVERSIONEX
48659 { "GetVersionExA", (SYSCALL)GetVersionExA, 0 },
@@ -48662,11 +48728,11 @@
48662 #endif
48663
48664 #define osGetVersionExA ((BOOL(WINAPI*)( \
48665 LPOSVERSIONINFOA))aSyscall[34].pCurrent)
48666
48667 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
48668 SQLITE_WIN32_GETVERSIONEX
48669 { "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
48670 #else
48671 { "GetVersionExW", (SYSCALL)0, 0 },
48672 #endif
@@ -48677,24 +48743,16 @@
48677 { "HeapAlloc", (SYSCALL)HeapAlloc, 0 },
48678
48679 #define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \
48680 SIZE_T))aSyscall[36].pCurrent)
48681
48682 #if !SQLITE_OS_WINRT
48683 { "HeapCreate", (SYSCALL)HeapCreate, 0 },
48684 #else
48685 { "HeapCreate", (SYSCALL)0, 0 },
48686 #endif
48687
48688 #define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \
48689 SIZE_T))aSyscall[37].pCurrent)
48690
48691 #if !SQLITE_OS_WINRT
48692 { "HeapDestroy", (SYSCALL)HeapDestroy, 0 },
48693 #else
48694 { "HeapDestroy", (SYSCALL)0, 0 },
48695 #endif
48696
48697 #define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent)
48698
48699 { "HeapFree", (SYSCALL)HeapFree, 0 },
48700
@@ -48708,20 +48766,16 @@
48708 { "HeapSize", (SYSCALL)HeapSize, 0 },
48709
48710 #define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \
48711 LPCVOID))aSyscall[41].pCurrent)
48712
48713 #if !SQLITE_OS_WINRT
48714 { "HeapValidate", (SYSCALL)HeapValidate, 0 },
48715 #else
48716 { "HeapValidate", (SYSCALL)0, 0 },
48717 #endif
48718
48719 #define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \
48720 LPCVOID))aSyscall[42].pCurrent)
48721
48722 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48723 { "HeapCompact", (SYSCALL)HeapCompact, 0 },
48724 #else
48725 { "HeapCompact", (SYSCALL)0, 0 },
48726 #endif
48727
@@ -48733,28 +48787,24 @@
48733 { "LoadLibraryA", (SYSCALL)0, 0 },
48734 #endif
48735
48736 #define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
48737
48738 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
48739 !defined(SQLITE_OMIT_LOAD_EXTENSION)
48740 { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 },
48741 #else
48742 { "LoadLibraryW", (SYSCALL)0, 0 },
48743 #endif
48744
48745 #define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent)
48746
48747 #if !SQLITE_OS_WINRT
48748 { "LocalFree", (SYSCALL)LocalFree, 0 },
48749 #else
48750 { "LocalFree", (SYSCALL)0, 0 },
48751 #endif
48752
48753 #define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent)
48754
48755 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48756 { "LockFile", (SYSCALL)LockFile, 0 },
48757 #else
48758 { "LockFile", (SYSCALL)0, 0 },
48759 #endif
48760
@@ -48772,12 +48822,11 @@
48772 #ifndef osLockFileEx
48773 #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
48774 LPOVERLAPPED))aSyscall[48].pCurrent)
48775 #endif
48776
48777 #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && \
48778 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
48779 { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
48780 #else
48781 { "MapViewOfFile", (SYSCALL)0, 0 },
48782 #endif
48783
@@ -48801,33 +48850,25 @@
48801
48802 { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 },
48803
48804 #define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent)
48805
48806 #if !SQLITE_OS_WINRT
48807 { "SetFilePointer", (SYSCALL)SetFilePointer, 0 },
48808 #else
48809 { "SetFilePointer", (SYSCALL)0, 0 },
48810 #endif
48811
48812 #define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
48813 DWORD))aSyscall[54].pCurrent)
48814
48815 #if !SQLITE_OS_WINRT
48816 { "Sleep", (SYSCALL)Sleep, 0 },
48817 #else
48818 { "Sleep", (SYSCALL)0, 0 },
48819 #endif
48820
48821 #define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent)
48822
48823 { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 },
48824
48825 #define osSystemTimeToFileTime ((BOOL(WINAPI*)(const SYSTEMTIME*, \
48826 LPFILETIME))aSyscall[56].pCurrent)
48827
48828 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
48829 { "UnlockFile", (SYSCALL)UnlockFile, 0 },
48830 #else
48831 { "UnlockFile", (SYSCALL)0, 0 },
48832 #endif
48833
@@ -48861,129 +48902,54 @@
48861 { "WriteFile", (SYSCALL)WriteFile, 0 },
48862
48863 #define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
48864 LPOVERLAPPED))aSyscall[61].pCurrent)
48865
48866 #if SQLITE_OS_WINRT
48867 { "CreateEventExW", (SYSCALL)CreateEventExW, 0 },
48868 #else
48869 { "CreateEventExW", (SYSCALL)0, 0 },
48870 #endif
48871
48872 #define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \
48873 DWORD,DWORD))aSyscall[62].pCurrent)
48874
48875 /*
48876 ** For WaitForSingleObject(), MSDN says:
48877 **
48878 ** Minimum supported client: Windows XP [desktop apps | UWP apps]
48879 ** Minimum supported server: Windows Server 2003 [desktop apps | UWP apps]
48880 */
48881 { "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 },
48882
48883 #define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \
48884 DWORD))aSyscall[63].pCurrent)
48885
48886 #if !SQLITE_OS_WINCE
48887 { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 },
48888 #else
48889 { "WaitForSingleObjectEx", (SYSCALL)0, 0 },
48890 #endif
48891
48892 #define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \
48893 BOOL))aSyscall[64].pCurrent)
48894
48895 #if SQLITE_OS_WINRT
48896 { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 },
48897 #else
48898 { "SetFilePointerEx", (SYSCALL)0, 0 },
48899 #endif
48900
48901 #define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \
48902 PLARGE_INTEGER,DWORD))aSyscall[65].pCurrent)
48903
48904 #if SQLITE_OS_WINRT
48905 { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 },
48906 #else
48907 { "GetFileInformationByHandleEx", (SYSCALL)0, 0 },
48908 #endif
48909
48910 #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \
48911 FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent)
48912
48913 #if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48914 { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
48915 #else
48916 { "MapViewOfFileFromApp", (SYSCALL)0, 0 },
48917 #endif
48918
48919 #define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \
48920 SIZE_T))aSyscall[67].pCurrent)
48921
48922 #if SQLITE_OS_WINRT
48923 { "CreateFile2", (SYSCALL)CreateFile2, 0 },
48924 #else
48925 { "CreateFile2", (SYSCALL)0, 0 },
48926 #endif
48927
48928 #define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \
48929 LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[68].pCurrent)
48930
48931 #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_LOAD_EXTENSION)
48932 { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 },
48933 #else
48934 { "LoadPackagedLibrary", (SYSCALL)0, 0 },
48935 #endif
48936
48937 #define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \
48938 DWORD))aSyscall[69].pCurrent)
48939
48940 #if SQLITE_OS_WINRT
48941 { "GetTickCount64", (SYSCALL)GetTickCount64, 0 },
48942 #else
48943 { "GetTickCount64", (SYSCALL)0, 0 },
48944 #endif
48945
48946 #define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[70].pCurrent)
48947
48948 #if SQLITE_OS_WINRT
48949 { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 },
48950 #else
48951 { "GetNativeSystemInfo", (SYSCALL)0, 0 },
48952 #endif
48953
48954 #define osGetNativeSystemInfo ((VOID(WINAPI*)( \
48955 LPSYSTEM_INFO))aSyscall[71].pCurrent)
48956
48957 #if defined(SQLITE_WIN32_HAS_ANSI)
48958 { "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 },
48959 #else
48960 { "OutputDebugStringA", (SYSCALL)0, 0 },
48961 #endif
48962
48963 #define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[72].pCurrent)
48964
48965 #if defined(SQLITE_WIN32_HAS_WIDE)
48966 { "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 },
48967 #else
48968 { "OutputDebugStringW", (SYSCALL)0, 0 },
48969 #endif
48970
48971 #define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[73].pCurrent)
48972
48973 { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
48974
48975 #define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent)
48976
48977 #if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48978 { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 },
48979 #else
48980 { "CreateFileMappingFromApp", (SYSCALL)0, 0 },
48981 #endif
48982
48983 #define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \
48984 LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[75].pCurrent)
48985
48986 /*
48987 ** NOTE: On some sub-platforms, the InterlockedCompareExchange "function"
48988 ** is really just a macro that uses a compiler intrinsic (e.g. x64).
48989 ** So do not try to make this is into a redefinable interface.
@@ -48994,38 +48960,38 @@
48994 #define osInterlockedCompareExchange InterlockedCompareExchange
48995 #else
48996 { "InterlockedCompareExchange", (SYSCALL)InterlockedCompareExchange, 0 },
48997
48998 #define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG \
48999 SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[76].pCurrent)
49000 #endif /* defined(InterlockedCompareExchange) */
49001
49002 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
49003 { "UuidCreate", (SYSCALL)UuidCreate, 0 },
49004 #else
49005 { "UuidCreate", (SYSCALL)0, 0 },
49006 #endif
49007
49008 #define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[77].pCurrent)
49009
49010 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
49011 { "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
49012 #else
49013 { "UuidCreateSequential", (SYSCALL)0, 0 },
49014 #endif
49015
49016 #define osUuidCreateSequential \
49017 ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[78].pCurrent)
49018
49019 #if !defined(SQLITE_NO_SYNC) && SQLITE_MAX_MMAP_SIZE>0
49020 { "FlushViewOfFile", (SYSCALL)FlushViewOfFile, 0 },
49021 #else
49022 { "FlushViewOfFile", (SYSCALL)0, 0 },
49023 #endif
49024
49025 #define osFlushViewOfFile \
49026 ((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[79].pCurrent)
49027
49028 /*
49029 ** If SQLITE_ENABLE_SETLK_TIMEOUT is defined, we require CreateEvent()
49030 ** to implement blocking locks with timeouts. MSDN says:
49031 **
@@ -49038,11 +49004,11 @@
49038 { "CreateEvent", (SYSCALL)0, 0 },
49039 #endif
49040
49041 #define osCreateEvent ( \
49042 (HANDLE(WINAPI*) (LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR)) \
49043 aSyscall[80].pCurrent \
49044 )
49045
49046 /*
49047 ** If SQLITE_ENABLE_SETLK_TIMEOUT is defined, we require CancelIo()
49048 ** for the case where a timeout expires and a lock request must be
@@ -49055,68 +49021,68 @@
49055 { "CancelIo", (SYSCALL)CancelIo, 0 },
49056 #else
49057 { "CancelIo", (SYSCALL)0, 0 },
49058 #endif
49059
49060 #define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[81].pCurrent)
49061
49062 #if defined(SQLITE_WIN32_HAS_WIDE) && defined(_WIN32)
49063 { "GetModuleHandleW", (SYSCALL)GetModuleHandleW, 0 },
49064 #else
49065 { "GetModuleHandleW", (SYSCALL)0, 0 },
49066 #endif
49067
49068 #define osGetModuleHandleW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[82].pCurrent)
49069
49070 #ifndef _WIN32
49071 { "getenv", (SYSCALL)getenv, 0 },
49072 #else
49073 { "getenv", (SYSCALL)0, 0 },
49074 #endif
49075
49076 #define osGetenv ((const char *(*)(const char *))aSyscall[83].pCurrent)
49077
49078 #ifndef _WIN32
49079 { "getcwd", (SYSCALL)getcwd, 0 },
49080 #else
49081 { "getcwd", (SYSCALL)0, 0 },
49082 #endif
49083
49084 #define osGetcwd ((char*(*)(char*,size_t))aSyscall[84].pCurrent)
49085
49086 #ifndef _WIN32
49087 { "readlink", (SYSCALL)readlink, 0 },
49088 #else
49089 { "readlink", (SYSCALL)0, 0 },
49090 #endif
49091
49092 #define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[85].pCurrent)
49093
49094 #ifndef _WIN32
49095 { "lstat", (SYSCALL)lstat, 0 },
49096 #else
49097 { "lstat", (SYSCALL)0, 0 },
49098 #endif
49099
49100 #define osLstat ((int(*)(const char*,struct stat*))aSyscall[86].pCurrent)
49101
49102 #ifndef _WIN32
49103 { "__errno", (SYSCALL)__errno, 0 },
49104 #else
49105 { "__errno", (SYSCALL)0, 0 },
49106 #endif
49107
49108 #define osErrno (*((int*(*)(void))aSyscall[87].pCurrent)())
49109
49110 #ifndef _WIN32
49111 { "cygwin_conv_path", (SYSCALL)cygwin_conv_path, 0 },
49112 #else
49113 { "cygwin_conv_path", (SYSCALL)0, 0 },
49114 #endif
49115
49116 #define osCygwin_conv_path ((size_t(*)(unsigned int, \
49117 const void *, void *, size_t))aSyscall[88].pCurrent)
49118
49119 }; /* End of the overrideable system calls */
49120
49121 /*
49122 ** This is the xSetSystemCall() method of sqlite3_vfs for all of the
@@ -49216,14 +49182,14 @@
49216
49217 winMemAssertMagic();
49218 hHeap = winMemGetHeap();
49219 assert( hHeap!=0 );
49220 assert( hHeap!=INVALID_HANDLE_VALUE );
49221 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49222 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49223 #endif
49224 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
49225 if( (nLargest=osHeapCompact(hHeap, SQLITE_WIN32_HEAP_FLAGS))==0 ){
49226 DWORD lastErrno = osGetLastError();
49227 if( lastErrno==NO_ERROR ){
49228 sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p",
49229 (void*)hHeap);
@@ -49332,32 +49298,15 @@
49332 }
49333 #endif
49334 }
49335 #endif /* _WIN32 */
49336
49337 /*
49338 ** The following routine suspends the current thread for at least ms
49339 ** milliseconds. This is equivalent to the Win32 Sleep() interface.
49340 */
49341 #if SQLITE_OS_WINRT
49342 static HANDLE sleepObj = NULL;
49343 #endif
49344
49345 SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){
49346 #if SQLITE_OS_WINRT
49347 if ( sleepObj==NULL ){
49348 sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
49349 SYNCHRONIZE);
49350 }
49351 assert( sleepObj!=NULL );
49352 osWaitForSingleObjectEx(sleepObj, milliseconds, FALSE);
49353 #else
49354 osSleep(milliseconds);
49355 #endif
49356 }
49357
49358 #if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
49359 SQLITE_THREADSAFE>0
49360 SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){
49361 DWORD rc;
49362 while( (rc = osWaitForSingleObjectEx(hObject, INFINITE,
49363 TRUE))==WAIT_IO_COMPLETION ){}
@@ -49377,11 +49326,11 @@
49377 ** the LockFileEx() API.
49378 */
49379
49380 #if !SQLITE_WIN32_GETVERSIONEX
49381 # define osIsNT() (1)
49382 #elif SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI)
49383 # define osIsNT() (1)
49384 #elif !defined(SQLITE_WIN32_HAS_WIDE)
49385 # define osIsNT() (0)
49386 #else
49387 # define osIsNT() ((sqlite3_os_type==2) || sqlite3_win32_is_nt())
@@ -49390,17 +49339,11 @@
49390 /*
49391 ** This function determines if the machine is running a version of Windows
49392 ** based on the NT kernel.
49393 */
49394 SQLITE_API int sqlite3_win32_is_nt(void){
49395 #if SQLITE_OS_WINRT
49396 /*
49397 ** NOTE: The WinRT sub-platform is always assumed to be based on the NT
49398 ** kernel.
49399 */
49400 return 1;
49401 #elif SQLITE_WIN32_GETVERSIONEX
49402 if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){
49403 #if defined(SQLITE_WIN32_HAS_ANSI)
49404 OSVERSIONINFOA sInfo;
49405 sInfo.dwOSVersionInfoSize = sizeof(sInfo);
49406 osGetVersionExA(&sInfo);
@@ -49438,11 +49381,11 @@
49438
49439 winMemAssertMagic();
49440 hHeap = winMemGetHeap();
49441 assert( hHeap!=0 );
49442 assert( hHeap!=INVALID_HANDLE_VALUE );
49443 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49444 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49445 #endif
49446 assert( nBytes>=0 );
49447 p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
49448 if( !p ){
@@ -49460,11 +49403,11 @@
49460
49461 winMemAssertMagic();
49462 hHeap = winMemGetHeap();
49463 assert( hHeap!=0 );
49464 assert( hHeap!=INVALID_HANDLE_VALUE );
49465 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49466 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
49467 #endif
49468 if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
49469 if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){
49470 sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p",
@@ -49481,11 +49424,11 @@
49481
49482 winMemAssertMagic();
49483 hHeap = winMemGetHeap();
49484 assert( hHeap!=0 );
49485 assert( hHeap!=INVALID_HANDLE_VALUE );
49486 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49487 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
49488 #endif
49489 assert( nBytes>=0 );
49490 if( !pPrior ){
49491 p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
@@ -49509,11 +49452,11 @@
49509
49510 winMemAssertMagic();
49511 hHeap = winMemGetHeap();
49512 assert( hHeap!=0 );
49513 assert( hHeap!=INVALID_HANDLE_VALUE );
49514 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49515 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, p) );
49516 #endif
49517 if( !p ) return 0;
49518 n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p);
49519 if( n==(SIZE_T)-1 ){
@@ -49539,11 +49482,11 @@
49539
49540 if( !pWinMemData ) return SQLITE_ERROR;
49541 assert( pWinMemData->magic1==WINMEM_MAGIC1 );
49542 assert( pWinMemData->magic2==WINMEM_MAGIC2 );
49543
49544 #if !SQLITE_OS_WINRT && SQLITE_WIN32_HEAP_CREATE
49545 if( !pWinMemData->hHeap ){
49546 DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE;
49547 DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap;
49548 if( dwMaximumSize==0 ){
49549 dwMaximumSize = SQLITE_WIN32_HEAP_MAX_SIZE;
@@ -49572,11 +49515,11 @@
49572 pWinMemData->bOwned = FALSE;
49573 assert( !pWinMemData->bOwned );
49574 #endif
49575 assert( pWinMemData->hHeap!=0 );
49576 assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
49577 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49578 assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49579 #endif
49580 return SQLITE_OK;
49581 }
49582
@@ -49590,11 +49533,11 @@
49590 assert( pWinMemData->magic1==WINMEM_MAGIC1 );
49591 assert( pWinMemData->magic2==WINMEM_MAGIC2 );
49592
49593 if( pWinMemData->hHeap ){
49594 assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
49595 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
49596 assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49597 #endif
49598 if( pWinMemData->bOwned ){
49599 if( !osHeapDestroy(pWinMemData->hHeap) ){
49600 sqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p",
@@ -49971,21 +49914,10 @@
49971 */
49972 DWORD dwLen = 0;
49973 char *zOut = 0;
49974
49975 if( osIsNT() ){
49976 #if SQLITE_OS_WINRT
49977 WCHAR zTempWide[SQLITE_WIN32_MAX_ERRMSG_CHARS+1];
49978 dwLen = osFormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
49979 FORMAT_MESSAGE_IGNORE_INSERTS,
49980 NULL,
49981 lastErrno,
49982 0,
49983 zTempWide,
49984 SQLITE_WIN32_MAX_ERRMSG_CHARS,
49985 0);
49986 #else
49987 LPWSTR zTempWide = NULL;
49988 dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
49989 FORMAT_MESSAGE_FROM_SYSTEM |
49990 FORMAT_MESSAGE_IGNORE_INSERTS,
49991 NULL,
@@ -49992,20 +49924,17 @@
49992 lastErrno,
49993 0,
49994 (LPWSTR) &zTempWide,
49995 0,
49996 0);
49997 #endif
49998 if( dwLen > 0 ){
49999 /* allocate a buffer and convert to UTF8 */
50000 sqlite3BeginBenignMalloc();
50001 zOut = winUnicodeToUtf8(zTempWide);
50002 sqlite3EndBenignMalloc();
50003 #if !SQLITE_OS_WINRT
50004 /* free the system buffer allocated by FormatMessage */
50005 osLocalFree(zTempWide);
50006 #endif
50007 }
50008 }
50009 #ifdef SQLITE_WIN32_HAS_ANSI
50010 else{
50011 char *zTemp = NULL;
@@ -50662,11 +50591,10 @@
50662 ** error code.
50663 */
50664 static int winHandleSeek(HANDLE h, sqlite3_int64 iOffset){
50665 int rc = SQLITE_OK; /* Return value */
50666
50667 #if !SQLITE_OS_WINRT
50668 LONG upperBits; /* Most sig. 32 bits of new offset */
50669 LONG lowerBits; /* Least sig. 32 bits of new offset */
50670 DWORD dwRet; /* Value returned by SetFilePointer() */
50671
50672 upperBits = (LONG)((iOffset>>32) & 0x7fffffff);
@@ -50684,24 +50612,11 @@
50684 DWORD lastErrno = osGetLastError();
50685 if( lastErrno!=NO_ERROR ){
50686 rc = SQLITE_IOERR_SEEK;
50687 }
50688 }
50689 #else
50690 /* This implementation works for WinRT. */
50691 LARGE_INTEGER x; /* The new offset */
50692 BOOL bRet; /* Value returned by SetFilePointerEx() */
50693
50694 x.QuadPart = iOffset;
50695 bRet = osSetFilePointerEx(h, x, 0, FILE_BEGIN);
50696
50697 if(!bRet){
50698 rc = SQLITE_IOERR_SEEK;
50699 }
50700 #endif
50701
50702 OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset, sqlite3ErrName(rc)));
50703 return rc;
50704 }
50705
50706 /*
50707 ** Move the current position of the file handle passed as the first
@@ -50998,32 +50913,19 @@
50998 ** Determine the size in bytes of the file opened by the handle passed as
50999 ** the first argument.
51000 */
51001 static int winHandleSize(HANDLE h, sqlite3_int64 *pnByte){
51002 int rc = SQLITE_OK;
51003
51004 #if SQLITE_OS_WINRT
51005 FILE_STANDARD_INFO info;
51006 BOOL b;
51007 b = osGetFileInformationByHandleEx(h, FileStandardInfo, &info, sizeof(info));
51008 if( b ){
51009 *pnByte = info.EndOfFile.QuadPart;
51010 }else{
51011 rc = SQLITE_IOERR_FSTAT;
51012 }
51013 #else
51014 DWORD upperBits = 0;
51015 DWORD lowerBits = 0;
51016
51017 assert( pnByte );
51018 lowerBits = osGetFileSize(h, &upperBits);
51019 *pnByte = (((sqlite3_int64)upperBits)<<32) + lowerBits;
51020 if( lowerBits==INVALID_FILE_SIZE && osGetLastError()!=NO_ERROR ){
51021 rc = SQLITE_IOERR_FSTAT;
51022 }
51023 #endif
51024
51025 return rc;
51026 }
51027
51028 /*
51029 ** Close the handle passed as the only argument.
@@ -51218,24 +51120,10 @@
51218
51219 assert( id!=0 );
51220 assert( pSize!=0 );
51221 SimulateIOError(return SQLITE_IOERR_FSTAT);
51222 OSTRACE(("SIZE file=%p, pSize=%p\n", pFile->h, pSize));
51223
51224 #if SQLITE_OS_WINRT
51225 {
51226 FILE_STANDARD_INFO info;
51227 if( osGetFileInformationByHandleEx(pFile->h, FileStandardInfo,
51228 &info, sizeof(info)) ){
51229 *pSize = info.EndOfFile.QuadPart;
51230 }else{
51231 pFile->lastErrno = osGetLastError();
51232 rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
51233 "winFileSize", pFile->zPath);
51234 }
51235 }
51236 #else
51237 {
51238 DWORD upperBits;
51239 DWORD lowerBits;
51240 DWORD lastErrno;
51241
@@ -51246,11 +51134,10 @@
51246 pFile->lastErrno = lastErrno;
51247 rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
51248 "winFileSize", pFile->zPath);
51249 }
51250 }
51251 #endif
51252 OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n",
51253 pFile->h, pSize, *pSize, sqlite3ErrName(rc)));
51254 return rc;
51255 }
51256
@@ -52208,33 +52095,18 @@
52208
52209 /* TODO: platforms.
52210 ** TODO: retry-on-ioerr.
52211 */
52212 if( osIsNT() ){
52213 #if SQLITE_OS_WINRT
52214 CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
52215 memset(&extendedParameters, 0, sizeof(extendedParameters));
52216 extendedParameters.dwSize = sizeof(extendedParameters);
52217 extendedParameters.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
52218 extendedParameters.dwFileFlags = flag_overlapped;
52219 extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
52220 h = osCreateFile2((LPCWSTR)zConverted,
52221 (GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)),/* dwDesiredAccess */
52222 FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */
52223 OPEN_ALWAYS, /* dwCreationDisposition */
52224 &extendedParameters
52225 );
52226 #else
52227 h = osCreateFileW((LPCWSTR)zConverted, /* lpFileName */
52228 (GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)), /* dwDesiredAccess */
52229 FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */
52230 NULL, /* lpSecurityAttributes */
52231 OPEN_ALWAYS, /* dwCreationDisposition */
52232 FILE_ATTRIBUTE_NORMAL|flag_overlapped,
52233 NULL
52234 );
52235 #endif
52236 }else{
52237 /* Due to pre-processor directives earlier in this file,
52238 ** SQLITE_WIN32_HAS_ANSI is always defined if osIsNT() is false. */
52239 #ifdef SQLITE_WIN32_HAS_ANSI
52240 h = osCreateFileA((LPCSTR)zConverted,
@@ -52698,13 +52570,11 @@
52698
52699 while( pShmNode->nRegion<=iRegion ){
52700 HANDLE hMap = NULL; /* file-mapping handle */
52701 void *pMap = 0; /* Mapped memory region */
52702
52703 #if SQLITE_OS_WINRT
52704 hMap = osCreateFileMappingFromApp(hShared, NULL, protect, nByte, NULL);
52705 #elif defined(SQLITE_WIN32_HAS_WIDE)
52706 hMap = osCreateFileMappingW(hShared, NULL, protect, 0, nByte, NULL);
52707 #elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
52708 hMap = osCreateFileMappingA(hShared, NULL, protect, 0, nByte, NULL);
52709 #endif
52710
@@ -52712,19 +52582,13 @@
52712 osGetCurrentProcessId(), pShmNode->nRegion, nByte,
52713 hMap ? "ok" : "failed"));
52714 if( hMap ){
52715 int iOffset = pShmNode->nRegion*szRegion;
52716 int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;
52717 #if SQLITE_OS_WINRT
52718 pMap = osMapViewOfFileFromApp(hMap, flags,
52719 iOffset - iOffsetShift, szRegion + iOffsetShift
52720 );
52721 #else
52722 pMap = osMapViewOfFile(hMap, flags,
52723 0, iOffset - iOffsetShift, szRegion + iOffsetShift
52724 );
52725 #endif
52726 OSTRACE(("SHM-MAP-MAP pid=%lu, region=%d, offset=%d, size=%d, rc=%s\n",
52727 osGetCurrentProcessId(), pShmNode->nRegion, iOffset,
52728 szRegion, pMap ? "ok" : "failed"));
52729 }
52730 if( !pMap ){
@@ -52853,13 +52717,11 @@
52853 if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
52854 protect = PAGE_READWRITE;
52855 flags |= FILE_MAP_WRITE;
52856 }
52857 #endif
52858 #if SQLITE_OS_WINRT
52859 pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
52860 #elif defined(SQLITE_WIN32_HAS_WIDE)
52861 pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
52862 (DWORD)((nMap>>32) & 0xffffffff),
52863 (DWORD)(nMap & 0xffffffff), NULL);
52864 #elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
52865 pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect,
@@ -52875,15 +52737,11 @@
52875 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
52876 return SQLITE_OK;
52877 }
52878 assert( (nMap % winSysInfo.dwPageSize)==0 );
52879 assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
52880 #if SQLITE_OS_WINRT
52881 pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
52882 #else
52883 pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
52884 #endif
52885 if( pNew==NULL ){
52886 osCloseHandle(pFd->hMap);
52887 pFd->hMap = NULL;
52888 pFd->lastErrno = osGetLastError();
52889 rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
@@ -53214,11 +53072,10 @@
53214 }
53215 }
53216 }
53217 #endif
53218
53219 #if !SQLITE_OS_WINRT && defined(_WIN32)
53220 else if( osIsNT() ){
53221 char *zMulti;
53222 LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) );
53223 if( !zWidePath ){
53224 sqlite3_free(zBuf);
@@ -53268,11 +53125,10 @@
53268 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
53269 return SQLITE_IOERR_NOMEM_BKPT;
53270 }
53271 }
53272 #endif /* SQLITE_WIN32_HAS_ANSI */
53273 #endif /* !SQLITE_OS_WINRT */
53274
53275 /*
53276 ** Check to make sure the temporary directory ends with an appropriate
53277 ** separator. If it does not and there is not enough space left to add
53278 ** one, fail.
@@ -53443,17 +53299,10 @@
53443
53444 assert( pFile!=0 );
53445 memset(pFile, 0, sizeof(winFile));
53446 pFile->h = INVALID_HANDLE_VALUE;
53447
53448 #if SQLITE_OS_WINRT
53449 if( !zUtf8Name && !sqlite3_temp_directory ){
53450 sqlite3_log(SQLITE_ERROR,
53451 "sqlite3_temp_directory variable should be set for WinRT");
53452 }
53453 #endif
53454
53455 /* If the second argument to this function is NULL, generate a
53456 ** temporary file name to use
53457 */
53458 if( !zUtf8Name ){
53459 assert( isDelete && !isOpenJournal );
@@ -53532,35 +53381,10 @@
53532 #if SQLITE_OS_WINCE
53533 dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
53534 #endif
53535
53536 if( osIsNT() ){
53537 #if SQLITE_OS_WINRT
53538 CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
53539 extendedParameters.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
53540 extendedParameters.dwFileAttributes =
53541 dwFlagsAndAttributes & FILE_ATTRIBUTE_MASK;
53542 extendedParameters.dwFileFlags = dwFlagsAndAttributes & FILE_FLAG_MASK;
53543 extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
53544 extendedParameters.lpSecurityAttributes = NULL;
53545 extendedParameters.hTemplateFile = NULL;
53546 do{
53547 h = osCreateFile2((LPCWSTR)zConverted,
53548 dwDesiredAccess,
53549 dwShareMode,
53550 dwCreationDisposition,
53551 &extendedParameters);
53552 if( h!=INVALID_HANDLE_VALUE ) break;
53553 if( isReadWrite ){
53554 int rc2;
53555 sqlite3BeginBenignMalloc();
53556 rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO);
53557 sqlite3EndBenignMalloc();
53558 if( rc2==SQLITE_OK && isRO ) break;
53559 }
53560 }while( winRetryIoerr(&cnt, &lastErrno) );
53561 #else
53562 do{
53563 h = osCreateFileW((LPCWSTR)zConverted,
53564 dwDesiredAccess,
53565 dwShareMode, NULL,
53566 dwCreationDisposition,
@@ -53573,11 +53397,10 @@
53573 rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO);
53574 sqlite3EndBenignMalloc();
53575 if( rc2==SQLITE_OK && isRO ) break;
53576 }
53577 }while( winRetryIoerr(&cnt, &lastErrno) );
53578 #endif
53579 }
53580 #ifdef SQLITE_WIN32_HAS_ANSI
53581 else{
53582 do{
53583 h = osCreateFileA((LPCSTR)zConverted,
@@ -53710,29 +53533,11 @@
53710 OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
53711 return SQLITE_IOERR_NOMEM_BKPT;
53712 }
53713 if( osIsNT() ){
53714 do {
53715 #if SQLITE_OS_WINRT
53716 WIN32_FILE_ATTRIBUTE_DATA sAttrData;
53717 memset(&sAttrData, 0, sizeof(sAttrData));
53718 if ( osGetFileAttributesExW(zConverted, GetFileExInfoStandard,
53719 &sAttrData) ){
53720 attr = sAttrData.dwFileAttributes;
53721 }else{
53722 lastErrno = osGetLastError();
53723 if( lastErrno==ERROR_FILE_NOT_FOUND
53724 || lastErrno==ERROR_PATH_NOT_FOUND ){
53725 rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
53726 }else{
53727 rc = SQLITE_ERROR;
53728 }
53729 break;
53730 }
53731 #else
53732 attr = osGetFileAttributesW(zConverted);
53733 #endif
53734 if ( attr==INVALID_FILE_ATTRIBUTES ){
53735 lastErrno = osGetLastError();
53736 if( lastErrno==ERROR_FILE_NOT_FOUND
53737 || lastErrno==ERROR_PATH_NOT_FOUND ){
53738 rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
@@ -53851,10 +53656,11 @@
53851 attr = INVALID_FILE_ATTRIBUTES;
53852 }else{
53853 attr = sAttrData.dwFileAttributes;
53854 }
53855 }else{
 
53856 winLogIoerr(cnt, __LINE__);
53857 if( lastErrno!=ERROR_FILE_NOT_FOUND && lastErrno!=ERROR_PATH_NOT_FOUND ){
53858 sqlite3_free(zConverted);
53859 return winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess",
53860 zFilename);
@@ -54019,11 +53825,11 @@
54019 sqlite3_vfs *pVfs, /* Pointer to vfs object */
54020 const char *zRelative, /* Possibly relative input path */
54021 int nFull, /* Size of output buffer in bytes */
54022 char *zFull /* Output buffer */
54023 ){
54024 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
54025 int nByte;
54026 void *zConverted;
54027 char *zOut;
54028 #endif
54029
@@ -54108,11 +53914,11 @@
54108 return rc;
54109 }
54110 }
54111 #endif /* __CYGWIN__ */
54112
54113 #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && defined(_WIN32)
54114 SimulateIOError( return SQLITE_ERROR );
54115 /* WinCE has no concept of a relative pathname, or so I am told. */
54116 /* WinRT has no way to convert a relative path to an absolute one. */
54117 if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){
54118 /*
@@ -54127,11 +53933,11 @@
54127 sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative);
54128 }
54129 return SQLITE_OK;
54130 #endif
54131
54132 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
54133 #if defined(_WIN32)
54134 /* It's odd to simulate an io-error here, but really this is just
54135 ** using the io-error infrastructure to test that SQLite handles this
54136 ** function failing. This function could fail if, for example, the
54137 ** current working directory has been unlinked.
@@ -54259,15 +54065,11 @@
54259 if( zConverted==0 ){
54260 OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0));
54261 return 0;
54262 }
54263 if( osIsNT() ){
54264 #if SQLITE_OS_WINRT
54265 h = osLoadPackagedLibrary((LPCWSTR)zConverted, 0);
54266 #else
54267 h = osLoadLibraryW((LPCWSTR)zConverted);
54268 #endif
54269 }
54270 #ifdef SQLITE_WIN32_HAS_ANSI
54271 else{
54272 h = osLoadLibraryA((char*)zConverted);
54273 }
@@ -54345,37 +54147,30 @@
54345 }
54346 {
54347 DWORD pid = osGetCurrentProcessId();
54348 xorMemory(&e, (unsigned char*)&pid, sizeof(DWORD));
54349 }
54350 #if SQLITE_OS_WINRT
54351 {
54352 ULONGLONG cnt = osGetTickCount64();
54353 xorMemory(&e, (unsigned char*)&cnt, sizeof(ULONGLONG));
54354 }
54355 #else
54356 {
54357 DWORD cnt = osGetTickCount();
54358 xorMemory(&e, (unsigned char*)&cnt, sizeof(DWORD));
54359 }
54360 #endif /* SQLITE_OS_WINRT */
54361 {
54362 LARGE_INTEGER i;
54363 osQueryPerformanceCounter(&i);
54364 xorMemory(&e, (unsigned char*)&i, sizeof(LARGE_INTEGER));
54365 }
54366 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
54367 {
54368 UUID id;
54369 memset(&id, 0, sizeof(UUID));
54370 osUuidCreate(&id);
54371 xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
54372 memset(&id, 0, sizeof(UUID));
54373 osUuidCreateSequential(&id);
54374 xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
54375 }
54376 #endif /* !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID */
54377 return e.nXor>nBuf ? nBuf : e.nXor;
54378 #endif /* defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) */
54379 }
54380
54381
@@ -54602,19 +54397,20 @@
54602 };
54603 #endif
54604
54605 /* Double-check that the aSyscall[] array has been constructed
54606 ** correctly. See ticket [bb3a86e890c8e96ab] */
54607 assert( ArraySize(aSyscall)==89 );
 
 
 
 
 
54608
54609 /* get memory map allocation granularity */
54610 memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
54611 #if SQLITE_OS_WINRT
54612 osGetNativeSystemInfo(&winSysInfo);
54613 #else
54614 osGetSystemInfo(&winSysInfo);
54615 #endif
54616 assert( winSysInfo.dwAllocationGranularity>0 );
54617 assert( winSysInfo.dwPageSize>0 );
54618
54619 sqlite3_vfs_register(&winVfs, 1);
54620
@@ -54634,21 +54430,13 @@
54634
54635 return SQLITE_OK;
54636 }
54637
54638 SQLITE_API int sqlite3_os_end(void){
54639 #if SQLITE_OS_WINRT
54640 if( sleepObj!=NULL ){
54641 osCloseHandle(sleepObj);
54642 sleepObj = NULL;
54643 }
54644 #endif
54645
54646 #ifndef SQLITE_OMIT_WAL
54647 winBigLock = 0;
54648 #endif
54649
54650 return SQLITE_OK;
54651 }
54652
54653 #endif /* SQLITE_OS_WIN */
54654
@@ -110848,14 +110636,12 @@
110848 }
110849 if( iCol>0 ){
110850 /* Convert the ORDER BY term into an integer column number iCol,
110851 ** taking care to preserve the COLLATE clause if it exists. */
110852 if( !IN_RENAME_OBJECT ){
110853 Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
110854 if( pNew==0 ) return 1;
110855 pNew->flags |= EP_IntValue;
110856 pNew->u.iValue = iCol;
110857 if( pItem->pExpr==pE ){
110858 pItem->pExpr = pNew;
110859 }else{
110860 Expr *pParent = pItem->pExpr;
110861 assert( pParent->op==TK_COLLATE );
@@ -111205,14 +110991,10 @@
111205 }
111206 }
111207 }
111208 #endif
111209
111210 /* The ORDER BY and GROUP BY clauses may not refer to terms in
111211 ** outer queries
111212 */
111213 sNC.pNext = 0;
111214 sNC.ncFlags |= NC_AllowAgg|NC_AllowWin;
111215
111216 /* If this is a converted compound query, move the ORDER BY clause from
111217 ** the sub-query back to the parent query. At this point each term
111218 ** within the ORDER BY clause has been transformed to an integer value.
@@ -112447,38 +112229,26 @@
112447 int op, /* Expression opcode */
112448 const Token *pToken, /* Token argument. Might be NULL */
112449 int dequote /* True to dequote */
112450 ){
112451 Expr *pNew;
112452 int nExtra = 0;
112453 int iValue = 0;
112454
112455 assert( db!=0 );
112456 if( pToken ){
112457 if( op!=TK_INTEGER || pToken->z==0
112458 || sqlite3GetInt32(pToken->z, &iValue)==0 ){
112459 nExtra = pToken->n+1; /* tag-20240227-a */
112460 assert( iValue>=0 );
112461 }
112462 }
112463 pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
112464 if( pNew ){
112465 memset(pNew, 0, sizeof(Expr));
112466 pNew->op = (u8)op;
112467 pNew->iAgg = -1;
112468 if( pToken ){
112469 if( nExtra==0 ){
112470 pNew->flags |= EP_IntValue|EP_Leaf|(iValue?EP_IsTrue:EP_IsFalse);
112471 pNew->u.iValue = iValue;
112472 }else{
112473 pNew->u.zToken = (char*)&pNew[1];
112474 assert( pToken->z!=0 || pToken->n==0 );
112475 if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
112476 pNew->u.zToken[pToken->n] = 0;
112477 if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
112478 sqlite3DequoteExpr(pNew);
112479 }
112480 }
112481 }
112482 #if SQLITE_MAX_EXPR_DEPTH>0
112483 pNew->nHeight = 1;
112484 #endif
@@ -112498,10 +112268,28 @@
112498 Token x;
112499 x.z = zToken;
112500 x.n = sqlite3Strlen30(zToken);
112501 return sqlite3ExprAlloc(db, op, &x, 0);
112502 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112503
112504 /*
112505 ** Attach subtrees pLeft and pRight to the Expr node pRoot.
112506 **
112507 ** If pRoot==NULL that means that a memory allocation error has occurred.
@@ -112661,11 +112449,11 @@
112661 if( (f&(EP_OuterON|EP_InnerON|EP_IsFalse|EP_HasFunc))==EP_IsFalse
112662 && !IN_RENAME_OBJECT
112663 ){
112664 sqlite3ExprDeferredDelete(pParse, pLeft);
112665 sqlite3ExprDeferredDelete(pParse, pRight);
112666 return sqlite3Expr(db, TK_INTEGER, "0");
112667 }else{
112668 return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
112669 }
112670 }
112671 }
@@ -112786,11 +112574,13 @@
112786 const Expr *pExpr, /* The function invocation */
112787 const FuncDef *pDef /* The function being invoked */
112788 ){
112789 assert( !IN_RENAME_OBJECT );
112790 assert( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 );
112791 if( ExprHasProperty(pExpr, EP_FromDDL) ){
 
 
112792 if( (pDef->funcFlags & SQLITE_FUNC_DIRECT)!=0
112793 || (pParse->db->flags & SQLITE_TrustedSchema)==0
112794 ){
112795 /* Functions prohibited in triggers and views if:
112796 ** (1) tagged with SQLITE_DIRECTONLY
@@ -114136,11 +113926,11 @@
114136 return w.eCode;
114137 }
114138
114139 /*
114140 ** Walk an expression tree. Return non-zero if the expression is constant
114141 ** and 0 if it involves variables or function calls.
114142 **
114143 ** For the purposes of this function, a double-quoted string (ex: "abc")
114144 ** is considered a variable but a single-quoted string (ex: 'abc') is
114145 ** a constant.
114146 **
@@ -115403,13 +115193,26 @@
115403 nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
115404 sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);
115405 pParse->nMem += nReg;
115406 if( pExpr->op==TK_SELECT ){
115407 dest.eDest = SRT_Mem;
115408 dest.iSdst = dest.iSDParm;
 
 
 
 
 
 
 
 
 
 
 
 
 
115409 dest.nSdst = nReg;
115410 sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1);
115411 VdbeComment((v, "Init subquery result"));
115412 }else{
115413 dest.eDest = SRT_Exists;
115414 sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm);
115415 VdbeComment((v, "Init EXISTS result"));
@@ -115421,11 +115224,11 @@
115421 Expr *pLeft = pSel->pLimit->pLeft;
115422 if( ExprHasProperty(pLeft, EP_IntValue)==0
115423 || (pLeft->u.iValue!=1 && pLeft->u.iValue!=0)
115424 ){
115425 sqlite3 *db = pParse->db;
115426 pLimit = sqlite3Expr(db, TK_INTEGER, "0");
115427 if( pLimit ){
115428 pLimit->affExpr = SQLITE_AFF_NUMERIC;
115429 pLimit = sqlite3PExpr(pParse, TK_NE,
115430 sqlite3ExprDup(db, pLeft, 0), pLimit);
115431 }
@@ -115432,11 +115235,11 @@
115432 sqlite3ExprDeferredDelete(pParse, pLeft);
115433 pSel->pLimit->pLeft = pLimit;
115434 }
115435 }else{
115436 /* If there is no pre-existing limit add a limit of 1 */
115437 pLimit = sqlite3Expr(pParse->db, TK_INTEGER, "1");
115438 pSel->pLimit = sqlite3PExpr(pParse, TK_LIMIT, pLimit, 0);
115439 }
115440 pSel->iLimit = 0;
115441 if( sqlite3Select(pParse, pSel, &dest) ){
115442 pExpr->op2 = pExpr->op;
@@ -120551,12 +120354,12 @@
120551 for(pStep=pNew->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext){
120552 if( pStep->pSelect ){
120553 sqlite3SelectPrep(pParse, pStep->pSelect, &sNC);
120554 if( pParse->nErr ) rc = pParse->rc;
120555 }
120556 if( rc==SQLITE_OK && pStep->zTarget ){
120557 SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
120558 if( pSrc ){
120559 Select *pSel = sqlite3SelectNew(
120560 pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
120561 );
120562 if( pSel==0 ){
@@ -120580,14 +120383,14 @@
120580 assert( pSrc==pSel->pSrc );
120581 if( pStep->pExprList ) pSel->pEList = 0;
120582 pSel->pSrc = 0;
120583 sqlite3SelectDelete(db, pSel);
120584 }
120585 if( pStep->pFrom ){
120586 int i;
120587 for(i=0; i<pStep->pFrom->nSrc && rc==SQLITE_OK; i++){
120588 SrcItem *p = &pStep->pFrom->a[i];
120589 if( p->fg.isSubquery ){
120590 assert( p->u4.pSubq!=0 );
120591 sqlite3SelectPrep(pParse, p->u4.pSubq->pSelect, 0);
120592 }
120593 }
@@ -120652,17 +120455,17 @@
120652 sqlite3WalkExprList(pWalker, pUpsert->pUpsertTarget);
120653 sqlite3WalkExprList(pWalker, pUpsert->pUpsertSet);
120654 sqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere);
120655 sqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere);
120656 }
120657 if( pStep->pFrom ){
120658 int i;
120659 SrcList *pFrom = pStep->pFrom;
120660 for(i=0; i<pFrom->nSrc; i++){
120661 if( pFrom->a[i].fg.isSubquery ){
120662 assert( pFrom->a[i].u4.pSubq!=0 );
120663 sqlite3WalkSelect(pWalker, pFrom->a[i].u4.pSubq->pSelect);
120664 }
120665 }
120666 }
120667 }
120668 }
@@ -120829,12 +120632,12 @@
120829 TriggerStep *pStep;
120830 rc = renameResolveTrigger(&sParse);
120831 if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
120832
120833 for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){
120834 if( pStep->zTarget ){
120835 Table *pTarget = sqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb);
120836 if( pTarget==pTab ){
120837 if( pStep->pUpsert ){
120838 ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet;
120839 renameColumnElistNames(&sParse, &sCtx, pUpsertSet, zOld);
120840 }
@@ -120841,11 +120644,10 @@
120841 renameColumnIdlistNames(&sParse, &sCtx, pStep->pIdList, zOld);
120842 renameColumnElistNames(&sParse, &sCtx, pStep->pExprList, zOld);
120843 }
120844 }
120845 }
120846
120847
120848 /* Find tokens to edit in UPDATE OF clause */
120849 if( sParse.pTriggerTab==pTab ){
120850 renameColumnIdlistNames(&sParse, &sCtx,sParse.pNewTrigger->pColumns,zOld);
120851 }
@@ -121044,17 +120846,14 @@
121044 if( isLegacy==0 ){
121045 rc = renameResolveTrigger(&sParse);
121046 if( rc==SQLITE_OK ){
121047 renameWalkTrigger(&sWalker, pTrigger);
121048 for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
121049 if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
121050 renameTokenFind(&sParse, &sCtx, pStep->zTarget);
121051 }
121052 if( pStep->pFrom ){
121053 int i;
121054 for(i=0; i<pStep->pFrom->nSrc; i++){
121055 SrcItem *pItem = &pStep->pFrom->a[i];
121056 if( 0==sqlite3_stricmp(pItem->zName, zOld) ){
121057 renameTokenFind(&sParse, &sCtx, pItem->zName);
121058 }
121059 }
121060 }
@@ -121297,10 +121096,61 @@
121297 #ifndef SQLITE_OMIT_AUTHORIZATION
121298 db->xAuth = xAuth;
121299 #endif
121300 }
121301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121302 /*
121303 ** The implementation of internal UDF sqlite_drop_column().
121304 **
121305 ** Arguments:
121306 **
@@ -121341,19 +121191,28 @@
121341 /* This can happen if the sqlite_schema table is corrupt */
121342 rc = SQLITE_CORRUPT_BKPT;
121343 goto drop_column_done;
121344 }
121345
121346 pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zCnName);
121347 if( iCol<pTab->nCol-1 ){
121348 RenameToken *pEnd;
 
121349 pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zCnName);
121350 zEnd = (const char*)pEnd->t.z;
121351 }else{
 
121352 assert( IsOrdinaryTable(pTab) );
 
 
 
 
 
 
 
 
 
121353 zEnd = (const char*)&zSql[pTab->u.tab.addColOffset];
121354 while( ALWAYS(pCol->t.z[0]!=0) && pCol->t.z[0]!=',' ) pCol->t.z--;
121355 }
121356
121357 zNew = sqlite3MPrintf(db, "%.*s%s", pCol->t.z-zSql, zSql, zEnd);
121358 sqlite3_result_text(context, zNew, -1, SQLITE_TRANSIENT);
121359 sqlite3_free(zNew);
@@ -121533,60 +121392,10 @@
121533 }
121534 return nRet;
121535 }
121536
121537
121538 /*
121539 ** Return the number of bytes until the end of the next non-whitespace and
121540 ** non-comment token. For the purpose of this function, a "(" token includes
121541 ** all of the bytes through and including the matching ")", or until the
121542 ** first illegal token, whichever comes first.
121543 **
121544 ** Write the token type into *piToken.
121545 **
121546 ** The value returned is the number of bytes in the token itself plus
121547 ** the number of bytes of leading whitespace and comments skipped plus
121548 ** all bytes through the next matching ")" if the token is TK_LP.
121549 **
121550 ** Example: (Note: '.' used in place of '*' in the example z[] text)
121551 **
121552 ** ,--------- *piToken := TK_RP
121553 ** v
121554 ** z[] = " /.comment./ --comment\n (two three four) five"
121555 ** | |
121556 ** |<-------------------------------------->|
121557 ** |
121558 ** `--- return value
121559 */
121560 static int getConstraintToken(const u8 *z, int *piToken){
121561 int iOff = 0;
121562 int t = 0;
121563 do {
121564 iOff += sqlite3GetToken(&z[iOff], &t);
121565 }while( t==TK_SPACE || t==TK_COMMENT );
121566
121567 *piToken = t;
121568
121569 if( t==TK_LP ){
121570 int nNest = 1;
121571 while( nNest>0 ){
121572 iOff += sqlite3GetToken(&z[iOff], &t);
121573 if( t==TK_LP ){
121574 nNest++;
121575 }else if( t==TK_RP ){
121576 t = TK_LP;
121577 nNest--;
121578 }else if( t==TK_ILLEGAL ){
121579 break;
121580 }
121581 }
121582 }
121583
121584 *piToken = t;
121585 return iOff;
121586 }
121587
121588 /*
121589 ** Argument z points into the body of a constraint - specifically the
121590 ** second token of the constraint definition. For a named constraint,
121591 ** z points to the first token past the CONSTRAINT keyword. For an
121592 ** unnamed NOT NULL constraint, z points to the first byte past the NOT
@@ -121632,17 +121441,22 @@
121632 ** non-zero if they differ. Normally return SQLITE_OK, except if there
121633 ** is an OOM, set the OOM error condition on ctx and return SQLITE_NOMEM.
121634 */
121635 static int quotedCompare(
121636 sqlite3_context *ctx, /* Function context on which to report errors */
 
121637 const u8 *zQuote, /* Possibly quoted text. Not zero-terminated. */
121638 int nQuote, /* Length of zQuote in bytes */
121639 const u8 *zCmp, /* Zero-terminated, unquoted name to compare against */
121640 int *pRes /* OUT: Set to 0 if equal, non-zero if unequal */
121641 ){
121642 char *zCopy = 0; /* De-quoted, zero-terminated copy of zQuote[] */
121643
 
 
 
 
121644 zCopy = sqlite3MallocZero(nQuote+1);
121645 if( zCopy==0 ){
121646 sqlite3_result_error_nomem(ctx);
121647 return SQLITE_NOMEM_BKPT;
121648 }
@@ -121737,11 +121551,11 @@
121737
121738 /* Compare the next token - which may be quoted - with the name of
121739 ** the constraint being dropped. */
121740 nTok = getConstraintToken(&zSql[iOff], &t);
121741 if( zCons ){
121742 if( quotedCompare(ctx, &zSql[iOff], nTok, zCons, &cmp) ) return;
121743 }
121744 iOff += nTok;
121745
121746 /* The next token is usually the first token of the constraint
121747 ** definition. This is enough to tell the type of the constraint -
@@ -122131,11 +121945,11 @@
122131 if( t==TK_CONSTRAINT ){
122132 int nTok = 0;
122133 int cmp = 0;
122134 iOff += getWhitespace(&zSql[iOff]);
122135 nTok = getConstraintToken(&zSql[iOff], &t);
122136 if( quotedCompare(ctx, &zSql[iOff], nTok, zCons, &cmp) ) return;
122137 if( cmp==0 ){
122138 sqlite3_result_int(ctx, 1);
122139 return;
122140 }
122141 }else if( t==TK_ILLEGAL ){
@@ -124842,11 +124656,11 @@
124842 ){
124843 while( pStep ){
124844 if( sqlite3WalkSelect(&pFix->w, pStep->pSelect)
124845 || sqlite3WalkExpr(&pFix->w, pStep->pWhere)
124846 || sqlite3WalkExprList(&pFix->w, pStep->pExprList)
124847 || sqlite3FixSrcList(pFix, pStep->pFrom)
124848 ){
124849 return 1;
124850 }
124851 #ifndef SQLITE_OMIT_UPSERT
124852 {
@@ -131588,11 +131402,11 @@
131588 ** * Do not allow DELETE, INSERT, or UPDATE of SQLITE_VTAB_DIRECTONLY
131589 ** virtual tables
131590 ** * Only allow DELETE, INSERT, or UPDATE of non-SQLITE_VTAB_INNOCUOUS
131591 ** virtual tables if PRAGMA trusted_schema=ON.
131592 */
131593 if( pParse->pToplevel!=0
131594 && pTab->u.vtab.p->eVtabRisk >
131595 ((pParse->db->flags & SQLITE_TrustedSchema)!=0)
131596 ){
131597 sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"",
131598 pTab->zName);
@@ -136687,10 +136501,11 @@
136687 ** the lookaside buffer belonging to database handle dbMem.
136688 */
136689 static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){
136690 if( p ){
136691 TriggerStep *pStep = p->step_list;
 
136692 sqlite3ExprDelete(dbMem, pStep->pWhere);
136693 sqlite3ExprListDelete(dbMem, pStep->pExprList);
136694 sqlite3SelectDelete(dbMem, pStep->pSelect);
136695 sqlite3ExprDelete(dbMem, p->pWhen);
136696 sqlite3DbFree(dbMem, p);
@@ -137353,18 +137168,18 @@
137353 /* Disable lookaside memory allocation */
137354 DisableLookaside;
137355
137356 pTrigger = (Trigger *)sqlite3DbMallocZero(db,
137357 sizeof(Trigger) + /* struct Trigger */
137358 sizeof(TriggerStep) + /* Single step in trigger program */
137359 nFrom + 1 /* Space for pStep->zTarget */
137360 );
137361 if( pTrigger ){
137362 pStep = pTrigger->step_list = (TriggerStep *)&pTrigger[1];
137363 pStep->zTarget = (char *)&pStep[1];
137364 memcpy((char *)pStep->zTarget, zFrom, nFrom);
137365
 
137366 pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
137367 pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE);
137368 pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
137369 if( pWhen ){
137370 pWhen = sqlite3PExpr(pParse, TK_NOT, pWhen, 0);
@@ -142392,37 +142207,46 @@
142392
142393 /* If no entry point was specified and the default legacy
142394 ** entry point name "sqlite3_extension_init" was not found, then
142395 ** construct an entry point name "sqlite3_X_init" where the X is
142396 ** replaced by the lowercase value of every ASCII alphabetic
142397 ** character in the filename after the last "/" upto the first ".",
142398 ** and eliding the first three characters if they are "lib".
142399 ** Examples:
142400 **
142401 ** /usr/local/lib/libExample5.4.3.so ==> sqlite3_example_init
142402 ** C:/lib/mathfuncs.dll ==> sqlite3_mathfuncs_init
 
 
 
 
 
 
142403 */
142404 if( xInit==0 && zProc==0 ){
142405 int iFile, iEntry, c;
142406 int ncFile = sqlite3Strlen30(zFile);
 
142407 zAltEntry = sqlite3_malloc64(ncFile+30);
142408 if( zAltEntry==0 ){
142409 sqlite3OsDlClose(pVfs, handle);
142410 return SQLITE_NOMEM_BKPT;
142411 }
142412 memcpy(zAltEntry, "sqlite3_", 8);
142413 for(iFile=ncFile-1; iFile>=0 && !DirSep(zFile[iFile]); iFile--){}
142414 iFile++;
142415 if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
142416 for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
142417 if( sqlite3Isalpha(c) ){
142418 zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];
142419 }
142420 }
142421 memcpy(zAltEntry+iEntry, "_init", 6);
142422 zEntry = zAltEntry;
142423 xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
 
 
142424 }
142425 if( xInit==0 ){
142426 if( pzErrMsg ){
142427 nMsg += strlen(zEntry) + 300;
142428 *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg);
@@ -148998,13 +148822,18 @@
148998 case SRT_Mem: {
148999 if( pSort ){
149000 assert( nResultCol<=pDest->nSdst );
149001 pushOntoSorter(
149002 pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg);
 
149003 }else{
149004 assert( nResultCol==pDest->nSdst );
149005 assert( regResult==iParm );
 
 
 
 
149006 /* The LIMIT clause will jump out of the loop for us */
149007 }
149008 break;
149009 }
149010 #endif /* #ifndef SQLITE_OMIT_SUBQUERY */
@@ -151165,14 +150994,12 @@
151165 assert( pItem!=0 );
151166 assert( pItem->u.x.iOrderByCol>0 );
151167 if( pItem->u.x.iOrderByCol==i ) break;
151168 }
151169 if( j==nOrderBy ){
151170 Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
151171 if( pNew==0 ) return SQLITE_NOMEM_BKPT;
151172 pNew->flags |= EP_IntValue;
151173 pNew->u.iValue = i;
151174 p->pOrderBy = pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
151175 if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i;
151176 }
151177 }
151178 }
@@ -153731,11 +153558,11 @@
153731 }
153732 sqlite3SrcItemAttachSubquery(pParse, pFrom, pTab->u.view.pSelect, 1);
153733 }
153734 #ifndef SQLITE_OMIT_VIRTUALTABLE
153735 else if( ALWAYS(IsVirtual(pTab))
153736 && pFrom->fg.fromDDL
153737 && ALWAYS(pTab->u.vtab.p!=0)
153738 && pTab->u.vtab.p->eVtabRisk > ((db->flags & SQLITE_TrustedSchema)!=0)
153739 ){
153740 sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"",
153741 pTab->zName);
@@ -154684,11 +154511,11 @@
154684 if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy)
154685 && ExprAlwaysFalse(pExpr)==0
154686 && pExpr->pAggInfo==0
154687 ){
154688 sqlite3 *db = pWalker->pParse->db;
154689 Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1");
154690 if( pNew ){
154691 Expr *pWhere = pS->pWhere;
154692 SWAP(Expr, *pNew, *pExpr);
154693 pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew);
154694 pS->pWhere = pNew;
@@ -155015,16 +154842,28 @@
155015 Expr *pSubWhere = pSub->pWhere;
155016 if( pSub->pSrc->nSrc==1
155017 && (pSub->selFlags & SF_Aggregate)==0
155018 && !pSub->pSrc->a[0].fg.isSubquery
155019 && pSub->pLimit==0
 
155020 ){
 
 
 
 
 
 
 
 
 
 
 
 
155021 memset(pWhere, 0, sizeof(*pWhere));
155022 pWhere->op = TK_INTEGER;
155023 pWhere->u.iValue = 1;
155024 ExprSetProperty(pWhere, EP_IntValue);
155025
155026 assert( p->pWhere!=0 );
155027 pSub->pSrc->a[0].fg.fromExists = 1;
155028 pSub->pSrc->a[0].fg.jointype |= JT_CROSS;
155029 p->pSrc = sqlite3SrcListAppendList(pParse, p->pSrc, pSub->pSrc);
155030 if( pSubWhere ){
@@ -155152,10 +154991,34 @@
155152 memset(&sCtx, 0, sizeof(sCtx));
155153 sCtx.pSrc = pSelect->pSrc;
155154 sqlite3WalkExprNN(&w, pSelect->pWhere);
155155 pSelect->selFlags &= ~SF_OnToWhere;
155156 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155157
155158 /*
155159 ** Generate byte-code for the SELECT statement given in the p argument.
155160 **
155161 ** The results are returned according to the SelectDest structure.
@@ -155805,11 +155668,12 @@
155805 ** used for both the ORDER BY and DISTINCT processing. As originally
155806 ** written the query must use a temp-table for at least one of the ORDER
155807 ** BY and DISTINCT, and an index or separate temp-table for the other.
155808 */
155809 if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct
155810 && sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0
 
155811 && OptimizationEnabled(db, SQLITE_GroupByOrder)
155812 #ifndef SQLITE_OMIT_WINDOWFUNC
155813 && p->pWin==0
155814 #endif
155815 ){
@@ -156019,25 +155883,14 @@
156019 ** in the correct order. It also may not - the GROUP BY might use a
156020 ** database index that causes rows to be grouped together as required
156021 ** but not actually sorted. Either way, record the fact that the
156022 ** ORDER BY and GROUP BY clauses are the same by setting the orderByGrp
156023 ** variable. */
156024 if( sSort.pOrderBy && pGroupBy->nExpr==sSort.pOrderBy->nExpr ){
156025 int ii;
156026 /* The GROUP BY processing doesn't care whether rows are delivered in
156027 ** ASC or DESC order - only that each group is returned contiguously.
156028 ** So set the ASC/DESC flags in the GROUP BY to match those in the
156029 ** ORDER BY to maximize the chances of rows being delivered in an
156030 ** order that makes the ORDER BY redundant. */
156031 for(ii=0; ii<pGroupBy->nExpr; ii++){
156032 u8 sortFlags;
156033 sortFlags = sSort.pOrderBy->a[ii].fg.sortFlags & KEYINFO_ORDER_DESC;
156034 pGroupBy->a[ii].fg.sortFlags = sortFlags;
156035 }
156036 if( sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){
156037 orderByGrp = 1;
156038 }
156039 }
156040 }else{
156041 assert( 0==sqlite3LogEst(1) );
156042 p->nSelectRow = 0;
156043 }
@@ -156843,11 +156696,11 @@
156843 sqlite3ExprDelete(db, pTmp->pWhere);
156844 sqlite3ExprListDelete(db, pTmp->pExprList);
156845 sqlite3SelectDelete(db, pTmp->pSelect);
156846 sqlite3IdListDelete(db, pTmp->pIdList);
156847 sqlite3UpsertDelete(db, pTmp->pUpsert);
156848 sqlite3SrcListDelete(db, pTmp->pFrom);
156849 sqlite3DbFree(db, pTmp->zSpan);
156850
156851 sqlite3DbFree(db, pTmp);
156852 }
156853 }
@@ -157032,15 +156885,20 @@
157032 }
157033 goto trigger_cleanup;
157034 }
157035 }
157036
 
 
 
 
157037 /* Do not create a trigger on a system table */
157038 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
157039 sqlite3ErrorMsg(pParse, "cannot create trigger on system table");
157040 goto trigger_cleanup;
157041 }
 
157042
157043 /* INSTEAD of triggers are only for views and views only support INSTEAD
157044 ** of triggers.
157045 */
157046 if( IsView(pTab) && tr_tm!=TK_INSTEAD ){
@@ -157182,16 +157040,16 @@
157182 ** are read-only, and the trigger makes a change to a shadow table,
157183 ** then raise an error - do not allow the trigger to be created. */
157184 if( sqlite3ReadOnlyShadowTables(db) ){
157185 TriggerStep *pStep;
157186 for(pStep=pTrig->step_list; pStep; pStep=pStep->pNext){
157187 if( pStep->zTarget!=0
157188 && sqlite3ShadowTableName(db, pStep->zTarget)
157189 ){
157190 sqlite3ErrorMsg(pParse,
157191 "trigger \"%s\" may not write to shadow table \"%s\"",
157192 pTrig->zName, pStep->zTarget);
157193 goto triggerfinish_cleanup;
157194 }
157195 }
157196 }
157197
@@ -157278,30 +157136,43 @@
157278 ** If an OOM error occurs, NULL is returned and db->mallocFailed is set.
157279 */
157280 static TriggerStep *triggerStepAllocate(
157281 Parse *pParse, /* Parser context */
157282 u8 op, /* Trigger opcode */
157283 Token *pName, /* The target name */
157284 const char *zStart, /* Start of SQL text */
157285 const char *zEnd /* End of SQL text */
157286 ){
 
157287 sqlite3 *db = pParse->db;
157288 TriggerStep *pTriggerStep;
157289
157290 if( pParse->nErr ) return 0;
157291 pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1);
157292 if( pTriggerStep ){
157293 char *z = (char*)&pTriggerStep[1];
157294 memcpy(z, pName->z, pName->n);
157295 sqlite3Dequote(z);
157296 pTriggerStep->zTarget = z;
157297 pTriggerStep->op = op;
157298 pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd);
157299 if( IN_RENAME_OBJECT ){
157300 sqlite3RenameTokenMap(pParse, pTriggerStep->zTarget, pName);
157301 }
157302 }
 
 
 
 
 
 
 
 
 
 
 
 
157303 return pTriggerStep;
157304 }
157305
157306 /*
157307 ** Build a trigger step out of an INSERT statement. Return a pointer
@@ -157310,11 +157181,11 @@
157310 ** The parser calls this routine when it sees an INSERT inside the
157311 ** body of a trigger.
157312 */
157313 SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(
157314 Parse *pParse, /* Parser */
157315 Token *pTableName, /* Name of the table into which we insert */
157316 IdList *pColumn, /* List of columns in pTableName to insert into */
157317 Select *pSelect, /* A SELECT statement that supplies values */
157318 u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
157319 Upsert *pUpsert, /* ON CONFLICT clauses for upsert */
157320 const char *zStart, /* Start of SQL text */
@@ -157323,11 +157194,11 @@
157323 sqlite3 *db = pParse->db;
157324 TriggerStep *pTriggerStep;
157325
157326 assert(pSelect != 0 || db->mallocFailed);
157327
157328 pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTableName,zStart,zEnd);
157329 if( pTriggerStep ){
157330 if( IN_RENAME_OBJECT ){
157331 pTriggerStep->pSelect = pSelect;
157332 pSelect = 0;
157333 }else{
@@ -157355,11 +157226,11 @@
157355 ** a pointer to that trigger step. The parser calls this routine when it
157356 ** sees an UPDATE statement inside the body of a CREATE TRIGGER.
157357 */
157358 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(
157359 Parse *pParse, /* Parser */
157360 Token *pTableName, /* Name of the table to be updated */
157361 SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */
157362 ExprList *pEList, /* The SET clause: list of column and new values */
157363 Expr *pWhere, /* The WHERE clause */
157364 u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
157365 const char *zStart, /* Start of SQL text */
@@ -157366,25 +157237,40 @@
157366 const char *zEnd /* End of SQL text */
157367 ){
157368 sqlite3 *db = pParse->db;
157369 TriggerStep *pTriggerStep;
157370
157371 pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTableName,zStart,zEnd);
157372 if( pTriggerStep ){
 
157373 if( IN_RENAME_OBJECT ){
157374 pTriggerStep->pExprList = pEList;
157375 pTriggerStep->pWhere = pWhere;
157376 pTriggerStep->pFrom = pFrom;
157377 pEList = 0;
157378 pWhere = 0;
157379 pFrom = 0;
157380 }else{
157381 pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE);
157382 pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
157383 pTriggerStep->pFrom = sqlite3SrcListDup(db, pFrom, EXPRDUP_REDUCE);
157384 }
157385 pTriggerStep->orconf = orconf;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157386 }
157387 sqlite3ExprListDelete(db, pEList);
157388 sqlite3ExprDelete(db, pWhere);
157389 sqlite3SrcListDelete(db, pFrom);
157390 return pTriggerStep;
@@ -157395,19 +157281,19 @@
157395 ** a pointer to that trigger step. The parser calls this routine when it
157396 ** sees a DELETE statement inside the body of a CREATE TRIGGER.
157397 */
157398 SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(
157399 Parse *pParse, /* Parser */
157400 Token *pTableName, /* The table from which rows are deleted */
157401 Expr *pWhere, /* The WHERE clause */
157402 const char *zStart, /* Start of SQL text */
157403 const char *zEnd /* End of SQL text */
157404 ){
157405 sqlite3 *db = pParse->db;
157406 TriggerStep *pTriggerStep;
157407
157408 pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTableName,zStart,zEnd);
157409 if( pTriggerStep ){
157410 if( IN_RENAME_OBJECT ){
157411 pTriggerStep->pWhere = pWhere;
157412 pWhere = 0;
157413 }else{
@@ -157665,56 +157551,10 @@
157665 return 0;
157666 }
157667 return triggersReallyExist(pParse,pTab,op,pChanges,pMask);
157668 }
157669
157670 /*
157671 ** Convert the pStep->zTarget string into a SrcList and return a pointer
157672 ** to that SrcList.
157673 **
157674 ** This routine adds a specific database name, if needed, to the target when
157675 ** forming the SrcList. This prevents a trigger in one database from
157676 ** referring to a target in another database. An exception is when the
157677 ** trigger is in TEMP in which case it can refer to any other database it
157678 ** wants.
157679 */
157680 SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(
157681 Parse *pParse, /* The parsing context */
157682 TriggerStep *pStep /* The trigger containing the target token */
157683 ){
157684 sqlite3 *db = pParse->db;
157685 SrcList *pSrc; /* SrcList to be returned */
157686 char *zName = sqlite3DbStrDup(db, pStep->zTarget);
157687 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
157688 assert( pSrc==0 || pSrc->nSrc==1 );
157689 assert( zName || pSrc==0 );
157690 if( pSrc ){
157691 Schema *pSchema = pStep->pTrig->pSchema;
157692 pSrc->a[0].zName = zName;
157693 if( pSchema!=db->aDb[1].pSchema ){
157694 assert( pSrc->a[0].fg.fixedSchema || pSrc->a[0].u4.zDatabase==0 );
157695 pSrc->a[0].u4.pSchema = pSchema;
157696 pSrc->a[0].fg.fixedSchema = 1;
157697 }
157698 if( pStep->pFrom ){
157699 SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0);
157700 if( pDup && pDup->nSrc>1 && !IN_RENAME_OBJECT ){
157701 Select *pSubquery;
157702 Token as;
157703 pSubquery = sqlite3SelectNew(pParse,0,pDup,0,0,0,0,SF_NestedFrom,0);
157704 as.n = 0;
157705 as.z = 0;
157706 pDup = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
157707 }
157708 pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
157709 }
157710 }else{
157711 sqlite3DbFree(db, zName);
157712 }
157713 return pSrc;
157714 }
157715
157716 /*
157717 ** Return true if the pExpr term from the RETURNING clause argument
157718 ** list is of the form "*". Raise an error if the terms if of the
157719 ** form "table.*".
157720 */
@@ -157976,21 +157816,21 @@
157976 #endif
157977
157978 switch( pStep->op ){
157979 case TK_UPDATE: {
157980 sqlite3Update(pParse,
157981 sqlite3TriggerStepSrc(pParse, pStep),
157982 sqlite3ExprListDup(db, pStep->pExprList, 0),
157983 sqlite3ExprDup(db, pStep->pWhere, 0),
157984 pParse->eOrconf, 0, 0, 0
157985 );
157986 sqlite3VdbeAddOp0(v, OP_ResetCount);
157987 break;
157988 }
157989 case TK_INSERT: {
157990 sqlite3Insert(pParse,
157991 sqlite3TriggerStepSrc(pParse, pStep),
157992 sqlite3SelectDup(db, pStep->pSelect, 0),
157993 sqlite3IdListDup(db, pStep->pIdList),
157994 pParse->eOrconf,
157995 sqlite3UpsertDup(db, pStep->pUpsert)
157996 );
@@ -157997,11 +157837,11 @@
157997 sqlite3VdbeAddOp0(v, OP_ResetCount);
157998 break;
157999 }
158000 case TK_DELETE: {
158001 sqlite3DeleteFrom(pParse,
158002 sqlite3TriggerStepSrc(pParse, pStep),
158003 sqlite3ExprDup(db, pStep->pWhere, 0), 0, 0
158004 );
158005 sqlite3VdbeAddOp0(v, OP_ResetCount);
158006 break;
158007 }
@@ -160319,13 +160159,15 @@
160319 if( rc!=SQLITE_OK ) goto end_of_vacuum;
160320 assert( (db->nDb-1)==nDb );
160321 pDb = &db->aDb[nDb];
160322 assert( strcmp(pDb->zDbSName,zDbVacuum)==0 );
160323 pTemp = pDb->pBt;
 
160324 if( pOut ){
160325 sqlite3_file *id = sqlite3PagerFile(sqlite3BtreePager(pTemp));
160326 i64 sz = 0;
 
160327 if( id->pMethods!=0 && (sqlite3OsFileSize(id, &sz)!=SQLITE_OK || sz>0) ){
160328 rc = SQLITE_ERROR;
160329 sqlite3SetString(pzErrMsg, db, "output file already exists");
160330 goto end_of_vacuum;
160331 }
@@ -160333,12 +160175,20 @@
160333
160334 /* For a VACUUM INTO, the pager-flags are set to the same values as
160335 ** they are for the database being vacuumed, except that PAGER_CACHESPILL
160336 ** is always set. */
160337 pgflags = db->aDb[iDb].safety_level | (db->flags & PAGER_FLAGS_MASK);
 
 
 
 
 
 
 
 
 
160338 }
160339 nRes = sqlite3BtreeGetRequestedReserve(pMain);
160340
160341 sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);
160342 sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));
160343 sqlite3BtreeSetPagerFlags(pTemp, pgflags|PAGER_CACHESPILL);
160344
@@ -167114,17 +166964,15 @@
167114 sqlite3 *db = pParse->db;
167115 Expr *pNew;
167116 int iVal = 0;
167117
167118 if( sqlite3ExprIsInteger(pExpr, &iVal, pParse) && iVal>=0 ){
167119 Expr *pVal = sqlite3Expr(db, TK_INTEGER, 0);
167120 if( pVal==0 ) return;
167121 ExprSetProperty(pVal, EP_IntValue);
167122 pVal->u.iValue = iVal;
167123 pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
167124 }else{
167125 Expr *pVal = sqlite3Expr(db, TK_REGISTER, 0);
167126 if( pVal==0 ) return;
167127 pVal->iTable = iReg;
167128 pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
167129 }
167130 if( pNew ){
@@ -168947,15 +168795,18 @@
168947
168948 /* No matches cause a break out of the loop */
168949 break;
168950 }
168951 if( i==n ){
 
168952 nOrderBy = n;
168953 if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) && !pSrc->fg.rowidUsed ){
168954 eDistinct = 2 + ((pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0);
168955 }else if( pWInfo->wctrlFlags & WHERE_GROUPBY ){
168956 eDistinct = 1;
 
 
168957 }
168958 }
168959 }
168960
168961 /* Allocate the sqlite3_index_info structure
@@ -172533,13 +172384,11 @@
172533 if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue;
172534 }else{
172535 pLoop = pLast;
172536 }
172537 if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){
172538 if( pLoop->u.vtab.isOrdered
172539 && ((wctrlFlags&(WHERE_DISTINCTBY|WHERE_SORTBYGROUP))!=WHERE_DISTINCTBY)
172540 ){
172541 obSat = obDone;
172542 }else{
172543 /* No further ORDER BY terms may be matched. So this call should
172544 ** return >=0, not -1. Clear isOrderDistinct to ensure it does so. */
172545 isOrderDistinct = 0;
@@ -173876,10 +173725,11 @@
173876 pWInfo->revMask = (m1 & pWInfo->revMask) | ((pWInfo->revMask>>1) & ~m1);
173877 notReady &= ~pLoop->maskSelf;
173878 for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
173879 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
173880 pTerm->wtFlags |= TERM_CODED;
 
173881 }
173882 }
173883 if( i!=pWInfo->nLevel-1 ){
173884 int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
173885 memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
@@ -174813,10 +174663,13 @@
174813 WhereLoop *pLoop;
174814 SrcList *pTabList = pWInfo->pTabList;
174815 sqlite3 *db = pParse->db;
174816 int iEnd = sqlite3VdbeCurrentAddr(v);
174817 int nRJ = 0;
 
 
 
174818
174819 /* Generate loop termination code.
174820 */
174821 VdbeModuleComment((v, "End WHERE-core"));
174822 for(i=pWInfo->nLevel-1; i>=0; i--){
@@ -174825,20 +174678,22 @@
174825 if( pLevel->pRJ ){
174826 /* Terminate the subroutine that forms the interior of the loop of
174827 ** the RIGHT JOIN table */
174828 WhereRightJoin *pRJ = pLevel->pRJ;
174829 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174830 pLevel->addrCont = 0;
 
 
 
174831 pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
174832 sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
174833 VdbeCoverage(v);
174834 nRJ++;
174835 }
174836 pLoop = pLevel->pWLoop;
174837 if( pLevel->op!=OP_Noop ){
174838 #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174839 int addrSeek = 0;
174840 Index *pIdx;
174841 int n;
174842 if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
174843 && i==pWInfo->nLevel-1 /* Ticket [ef9318757b152e3] 2017-10-21 */
174844 && (pLoop->wsFlags & WHERE_INDEXED)!=0
@@ -174857,29 +174712,30 @@
174857 VdbeCoverageIf(v, op==OP_SeekLT);
174858 VdbeCoverageIf(v, op==OP_SeekGT);
174859 sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
174860 }
174861 #endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
174862 if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
174863 /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
174864 ** loop(s) will be the inner-most loops of the join. There might be
174865 ** multiple EXISTS loops, but they will all be nested, and the join
174866 ** order will not have been changed by the query planner. If the
174867 ** inner-most EXISTS loop sees a single successful row, it should
174868 ** break out of *all* EXISTS loops. But only the inner-most of the
174869 ** nested EXISTS loops should do this breakout. */
174870 int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
174871 while( nOuter<i ){
174872 if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
174873 nOuter++;
174874 }
174875 testcase( nOuter>0 );
174876 sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
174877 VdbeComment((v, "EXISTS break"));
174878 }
174879 /* The common case: Advance to the next row */
174880 if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont);
 
174881 sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);
174882 sqlite3VdbeChangeP5(v, pLevel->p5);
174883 VdbeCoverage(v);
174884 VdbeCoverageIf(v, pLevel->op==OP_Next);
174885 VdbeCoverageIf(v, pLevel->op==OP_Prev);
@@ -174888,14 +174744,15 @@
174888 sqlite3VdbeResolveLabel(v, pLevel->addrBignull);
174889 sqlite3VdbeAddOp2(v, OP_DecrJumpZero, pLevel->regBignull, pLevel->p2-1);
174890 VdbeCoverage(v);
174891 }
174892 #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174893 if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek);
 
 
 
174894 #endif
174895 }else if( pLevel->addrCont ){
174896 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174897 }
174898 if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){
174899 struct InLoop *pIn;
174900 int j;
174901 sqlite3VdbeResolveLabel(v, pLevel->addrNxt);
@@ -175888,11 +175745,11 @@
175888 pWin->eFrmType = aUp[i].eFrmType;
175889 pWin->eStart = aUp[i].eStart;
175890 pWin->eEnd = aUp[i].eEnd;
175891 pWin->eExclude = 0;
175892 if( pWin->eStart==TK_FOLLOWING ){
175893 pWin->pStart = sqlite3Expr(db, TK_INTEGER, "1");
175894 }
175895 break;
175896 }
175897 }
175898 }
@@ -176233,13 +176090,11 @@
176233 ** selected (e.g. "SELECT row_number() OVER () FROM t1"), it is possible
176234 ** that pSublist is still NULL here. Add a constant expression here to
176235 ** keep everything legal in this case.
176236 */
176237 if( pSublist==0 ){
176238 pSublist = sqlite3ExprListAppend(pParse, 0,
176239 sqlite3Expr(db, TK_INTEGER, "0")
176240 );
176241 }
176242
176243 pSub = sqlite3SelectNew(
176244 pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
176245 );
@@ -178514,19 +178369,50 @@
178514 }
178515 return p;
178516 }
178517
178518
178519 /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
178520 ** unary TK_ISNULL or TK_NOTNULL expression. */
178521 static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
178522 sqlite3 *db = pParse->db;
178523 if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){
178524 pA->op = (u8)op;
178525 sqlite3ExprDelete(db, pA->pRight);
178526 pA->pRight = 0;
178527 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178528 }
178529
178530 /* Add a single new term to an ExprList that is used to store a
178531 ** list of identifiers. Report an error if the ID list contains
178532 ** a COLLATE clause or an ASC or DESC keyword, except ignore the
@@ -178805,35 +178691,35 @@
178805 #ifndef INTERFACE
178806 # define INTERFACE 1
178807 #endif
178808 /************* Begin control #defines *****************************************/
178809 #define YYCODETYPE unsigned short int
178810 #define YYNOCODE 323
178811 #define YYACTIONTYPE unsigned short int
178812 #define YYWILDCARD 102
178813 #define sqlite3ParserTOKENTYPE Token
178814 typedef union {
178815 int yyinit;
178816 sqlite3ParserTOKENTYPE yy0;
178817 u32 yy9;
178818 struct TrigEvent yy28;
178819 With* yy125;
178820 IdList* yy204;
178821 struct FrameBound yy205;
178822 TriggerStep* yy319;
178823 const char* yy342;
178824 Cte* yy361;
178825 ExprList* yy402;
178826 Upsert* yy403;
178827 OnOrUsing yy421;
178828 u8 yy444;
178829 struct {int value; int mask;} yy481;
178830 Window* yy483;
178831 int yy502;
178832 SrcList* yy563;
178833 Expr* yy590;
178834 Select* yy637;
178835 } YYMINORTYPE;
178836 #ifndef YYSTACKDEPTH
178837 #define YYSTACKDEPTH 50
178838 #endif
178839 #define sqlite3ParserARG_SDECL
@@ -178857,24 +178743,24 @@
178857 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
178858 #undef YYERRORSYMBOL
178859 #undef YYERRSYMDT
178860 #undef YYFALLBACK
178861 #define YYFALLBACK 1
178862 #define YYNSTATE 602
178863 #define YYNRULE 414
178864 #define YYNRULE_WITH_ACTION 349
178865 #define YYNTOKEN 187
178866 #define YY_MAX_SHIFT 601
178867 #define YY_MIN_SHIFTREDUCE 870
178868 #define YY_MAX_SHIFTREDUCE 1283
178869 #define YY_ERROR_ACTION 1284
178870 #define YY_ACCEPT_ACTION 1285
178871 #define YY_NO_ACTION 1286
178872 #define YY_MIN_REDUCE 1287
178873 #define YY_MAX_REDUCE 1700
178874 #define YY_MIN_DSTRCTR 206
178875 #define YY_MAX_DSTRCTR 320
178876 /************* End control #defines *******************************************/
178877 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
178878
178879 /* Define the yytestcase() macro to be a no-op if is not already defined
178880 ** otherwise.
@@ -178955,491 +178841,491 @@
178955 ** yy_default[] Default action for each state.
178956 **
178957 *********** Begin parsing tables **********************************************/
178958 #define YY_ACTTAB_COUNT (2379)
178959 static const YYACTIONTYPE yy_action[] = {
178960 /* 0 */ 134, 131, 238, 291, 291, 1358, 595, 1337, 479, 483,
178961 /* 10 */ 595, 436, 595, 393, 595, 1358, 592, 595, 581, 425,
178962 /* 20 */ 423, 1572, 134, 131, 238, 543, 479, 478, 577, 84,
178963 /* 30 */ 84, 1008, 304, 51, 51, 51, 51, 63, 63, 1009,
178964 /* 40 */ 84, 84, 1132, 141, 142, 93, 1132, 1258, 1258, 1088,
178965 /* 50 */ 1091, 1078, 1078, 139, 139, 140, 140, 140, 140, 425,
178966 /* 60 */ 297, 297, 1481, 297, 297, 569, 555, 297, 297, 134,
178967 /* 70 */ 131, 238, 1130, 592, 544, 581, 592, 576, 581, 512,
178968 /* 80 */ 592, 343, 581, 141, 142, 93, 578, 1258, 1258, 1088,
178969 /* 90 */ 1091, 1078, 1078, 139, 139, 140, 140, 140, 140, 6,
178970 /* 100 */ 479, 385, 1630, 138, 138, 138, 138, 137, 137, 136,
178971 /* 110 */ 136, 136, 135, 132, 464, 1363, 1363, 595, 1044, 1603,
178972 /* 120 */ 1285, 1, 1, 601, 2, 1289, 44, 1204, 231, 1204,
178973 /* 130 */ 331, 425, 158, 1617, 392, 1617, 563, 116, 500, 1371,
178974 /* 140 */ 84, 84, 569, 138, 138, 138, 138, 137, 137, 136,
178975 /* 150 */ 136, 136, 135, 132, 464, 141, 142, 93, 517, 1258,
178976 /* 160 */ 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140,
178977 /* 170 */ 140, 1234, 356, 212, 297, 297, 464, 576, 490, 1234,
178978 /* 180 */ 570, 570, 143, 330, 586, 1320, 550, 592, 1199, 581,
178979 /* 190 */ 491, 358, 45, 140, 140, 140, 140, 133, 394, 566,
178980 /* 200 */ 1323, 1199, 253, 426, 1199, 137, 137, 136, 136, 136,
178981 /* 210 */ 135, 132, 464, 292, 306, 138, 138, 138, 138, 137,
178982 /* 220 */ 137, 136, 136, 136, 135, 132, 464, 1322, 1234, 1235,
178983 /* 230 */ 1234, 1605, 413, 389, 468, 425, 1234, 1235, 1234, 491,
178984 /* 240 */ 358, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178985 /* 250 */ 135, 132, 464, 113, 134, 131, 238, 557, 1606, 141,
178986 /* 260 */ 142, 93, 595, 1258, 1258, 1088, 1091, 1078, 1078, 139,
178987 /* 270 */ 139, 140, 140, 140, 140, 134, 131, 238, 1612, 425,
178988 /* 280 */ 502, 185, 7, 334, 97, 19, 19, 994, 140, 140,
178989 /* 290 */ 140, 140, 136, 136, 136, 135, 132, 464, 1179, 1692,
178990 /* 300 */ 209, 1692, 1610, 141, 142, 93, 7, 1258, 1258, 1088,
178991 /* 310 */ 1091, 1078, 1078, 139, 139, 140, 140, 140, 140, 138,
178992 /* 320 */ 138, 138, 138, 137, 137, 136, 136, 136, 135, 132,
178993 /* 330 */ 464, 1663, 1234, 589, 589, 589, 138, 138, 138, 138,
178994 /* 340 */ 137, 137, 136, 136, 136, 135, 132, 464, 138, 138,
178995 /* 350 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
178996 /* 360 */ 275, 595, 430, 138, 138, 138, 138, 137, 137, 136,
178997 /* 370 */ 136, 136, 135, 132, 464, 400, 1234, 396, 1177, 461,
178998 /* 380 */ 460, 237, 1611, 425, 51, 51, 7, 335, 1263, 1234,
178999 /* 390 */ 1235, 1234, 1311, 1265, 549, 145, 1254, 283, 542, 542,
179000 /* 400 */ 595, 1264, 597, 7, 597, 927, 994, 141, 142, 93,
179001 /* 410 */ 506, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140,
179002 /* 420 */ 140, 140, 140, 19, 19, 44, 1266, 425, 1266, 297,
179003 /* 430 */ 297, 1234, 98, 1234, 1235, 1234, 265, 534, 439, 530,
179004 /* 440 */ 527, 526, 592, 1633, 581, 928, 511, 272, 235, 525,
179005 /* 450 */ 508, 141, 142, 93, 1254, 1258, 1258, 1088, 1091, 1078,
179006 /* 460 */ 1078, 139, 139, 140, 140, 140, 140, 138, 138, 138,
179007 /* 470 */ 138, 137, 137, 136, 136, 136, 135, 132, 464, 595,
179008 /* 480 */ 422, 421, 330, 586, 1619, 517, 391, 517, 1234, 1235,
179009 /* 490 */ 1234, 1274, 127, 587, 265, 4, 1311, 530, 527, 526,
179010 /* 500 */ 595, 448, 84, 84, 594, 595, 572, 525, 1309, 590,
179011 /* 510 */ 308, 138, 138, 138, 138, 137, 137, 136, 136, 136,
179012 /* 520 */ 135, 132, 464, 19, 19, 161, 1234, 390, 19, 19,
179013 /* 530 */ 1571, 425, 1535, 465, 1637, 601, 2, 1289, 444, 576,
179014 /* 540 */ 330, 586, 331, 446, 158, 584, 1274, 481, 575, 595,
179015 /* 550 */ 240, 1371, 506, 551, 1234, 141, 142, 93, 313, 1258,
179016 /* 560 */ 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140,
179017 /* 570 */ 140, 160, 83, 83, 1065, 974, 135, 132, 464, 595,
179018 /* 580 */ 125, 125, 973, 1234, 1235, 1234, 297, 297, 126, 517,
179019 /* 590 */ 465, 596, 465, 297, 297, 1053, 1234, 1369, 387, 592,
179020 /* 600 */ 1234, 581, 84, 84, 517, 242, 592, 1465, 581, 46,
179021 /* 610 */ 473, 1234, 1235, 1234, 253, 138, 138, 138, 138, 137,
179022 /* 620 */ 137, 136, 136, 136, 135, 132, 464, 1053, 1053, 1055,
179023 /* 630 */ 1056, 35, 297, 297, 1370, 399, 425, 445, 996, 576,
179024 /* 640 */ 372, 415, 233, 541, 413, 592, 468, 581, 452, 1366,
179025 /* 650 */ 112, 552, 355, 1234, 1235, 1234, 1218, 1234, 1235, 1234,
179026 /* 660 */ 141, 142, 93, 223, 1258, 1258, 1088, 1091, 1078, 1078,
179027 /* 670 */ 139, 139, 140, 140, 140, 140, 297, 297, 441, 553,
179028 /* 680 */ 425, 298, 298, 1375, 531, 330, 586, 1199, 115, 592,
179029 /* 690 */ 1465, 581, 100, 1480, 592, 592, 581, 581, 559, 1307,
179030 /* 700 */ 1199, 907, 545, 1199, 141, 142, 93, 498, 1258, 1258,
179031 /* 710 */ 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140, 140,
179032 /* 720 */ 138, 138, 138, 138, 137, 137, 136, 136, 136, 135,
179033 /* 730 */ 132, 464, 385, 1630, 297, 297, 470, 297, 297, 472,
179034 /* 740 */ 200, 579, 1065, 201, 44, 127, 587, 592, 4, 581,
179035 /* 750 */ 592, 1044, 581, 482, 40, 500, 558, 482, 907, 1054,
179036 /* 760 */ 1479, 442, 590, 1053, 138, 138, 138, 138, 137, 137,
179037 /* 770 */ 136, 136, 136, 135, 132, 464, 297, 297, 1234, 1657,
179038 /* 780 */ 492, 1234, 1603, 480, 425, 506, 465, 1330, 911, 592,
179039 /* 790 */ 918, 581, 1234, 1361, 1361, 1053, 1053, 1055, 584, 385,
179040 /* 800 */ 1630, 330, 586, 353, 5, 356, 486, 344, 141, 142,
179041 /* 810 */ 93, 185, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139,
179042 /* 820 */ 140, 140, 140, 140, 1218, 1694, 411, 1065, 425, 1234,
179043 /* 830 */ 48, 309, 904, 125, 125, 1234, 1235, 1234, 1234, 1235,
179044 /* 840 */ 1234, 126, 1234, 465, 596, 465, 348, 517, 1053, 1234,
179045 /* 850 */ 1235, 1234, 141, 142, 93, 3, 1258, 1258, 1088, 1091,
179046 /* 860 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 138, 138,
179047 /* 870 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
179048 /* 880 */ 1053, 1053, 1055, 1056, 35, 315, 1234, 1235, 1234, 1234,
179049 /* 890 */ 1065, 1237, 363, 1234, 1604, 887, 389, 341, 500, 1234,
179050 /* 900 */ 1235, 1234, 595, 1075, 1075, 1089, 1092, 1054, 345, 1218,
179051 /* 910 */ 347, 1053, 138, 138, 138, 138, 137, 137, 136, 136,
179052 /* 920 */ 136, 135, 132, 464, 436, 19, 19, 370, 567, 567,
179053 /* 930 */ 595, 554, 425, 7, 1398, 325, 1217, 462, 462, 462,
179054 /* 940 */ 316, 1582, 432, 1053, 1053, 1055, 1234, 1235, 1234, 1237,
179055 /* 950 */ 1234, 1235, 1234, 84, 84, 489, 141, 142, 93, 595,
179056 /* 960 */ 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140,
179057 /* 970 */ 140, 140, 1218, 995, 312, 383, 425, 600, 1079, 1289,
179058 /* 980 */ 1066, 115, 19, 19, 331, 382, 158, 1603, 1536, 365,
179059 /* 990 */ 326, 368, 346, 1371, 216, 461, 460, 451, 1110, 236,
179060 /* 1000 */ 141, 142, 93, 1465, 1258, 1258, 1088, 1091, 1078, 1078,
179061 /* 1010 */ 139, 139, 140, 140, 140, 140, 138, 138, 138, 138,
179062 /* 1020 */ 137, 137, 136, 136, 136, 135, 132, 464, 297, 297,
179063 /* 1030 */ 595, 500, 1008, 1199, 595, 50, 1528, 398, 218, 218,
179064 /* 1040 */ 1009, 592, 1266, 581, 1266, 450, 1199, 404, 522, 1199,
179065 /* 1050 */ 376, 424, 418, 84, 84, 595, 253, 19, 19, 548,
179066 /* 1060 */ 138, 138, 138, 138, 137, 137, 136, 136, 136, 135,
179067 /* 1070 */ 132, 464, 210, 317, 443, 317, 269, 307, 19, 19,
179068 /* 1080 */ 425, 307, 22, 22, 1049, 294, 413, 994, 468, 593,
179069 /* 1090 */ 327, 961, 961, 571, 269, 1603, 1603, 595, 231, 1604,
179070 /* 1100 */ 425, 389, 410, 1279, 141, 142, 93, 314, 1258, 1258,
179071 /* 1110 */ 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140, 140,
179072 /* 1120 */ 84, 84, 533, 387, 141, 142, 93, 434, 1258, 1258,
179073 /* 1130 */ 1088, 1091, 1078, 1078, 139, 139, 140, 140, 140, 140,
179074 /* 1140 */ 447, 1541, 1585, 47, 49, 431, 282, 300, 384, 536,
179075 /* 1150 */ 379, 535, 270, 595, 436, 595, 1465, 458, 375, 1541,
179076 /* 1160 */ 1543, 375, 455, 431, 138, 138, 138, 138, 137, 137,
179077 /* 1170 */ 136, 136, 136, 135, 132, 464, 84, 84, 84, 84,
179078 /* 1180 */ 595, 237, 1280, 1583, 138, 138, 138, 138, 137, 137,
179079 /* 1190 */ 136, 136, 136, 135, 132, 464, 1179, 1693, 10, 1693,
179080 /* 1200 */ 275, 565, 1151, 149, 149, 475, 994, 1604, 1604, 389,
179081 /* 1210 */ 389, 1465, 1199, 459, 425, 463, 226, 1152, 1150, 1609,
179082 /* 1220 */ 564, 303, 1608, 7, 217, 1199, 7, 513, 1199, 1210,
179083 /* 1230 */ 1312, 432, 1153, 1541, 425, 1662, 1254, 936, 141, 142,
179084 /* 1240 */ 93, 119, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139,
179085 /* 1250 */ 140, 140, 140, 140, 583, 302, 538, 1396, 141, 142,
179086 /* 1260 */ 93, 6, 1258, 1258, 1088, 1091, 1078, 1078, 139, 139,
179087 /* 1270 */ 140, 140, 140, 140, 588, 432, 1177, 1135, 1135, 514,
179088 /* 1280 */ 1151, 1210, 456, 969, 333, 288, 433, 187, 968, 595,
179089 /* 1290 */ 129, 595, 547, 595, 1254, 1152, 1341, 551, 138, 138,
179090 /* 1300 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
179091 /* 1310 */ 1153, 595, 151, 151, 53, 53, 54, 54, 138, 138,
179092 /* 1320 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 464,
179093 /* 1330 */ 504, 595, 947, 595, 68, 68, 595, 296, 235, 595,
179094 /* 1340 */ 507, 595, 948, 595, 101, 222, 595, 484, 425, 875,
179095 /* 1350 */ 876, 877, 215, 219, 69, 69, 21, 21, 423, 55,
179096 /* 1360 */ 55, 1584, 70, 70, 56, 56, 71, 71, 425, 72,
179097 /* 1370 */ 72, 1183, 141, 142, 93, 123, 1258, 1258, 1088, 1091,
179098 /* 1380 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 425, 268,
179099 /* 1390 */ 267, 266, 141, 142, 93, 552, 1258, 1258, 1088, 1091,
179100 /* 1400 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 23, 163,
179101 /* 1410 */ 496, 572, 141, 130, 93, 476, 1258, 1258, 1088, 1091,
179102 /* 1420 */ 1078, 1078, 139, 139, 140, 140, 140, 140, 505, 124,
179103 /* 1430 */ 1580, 121, 138, 138, 138, 138, 137, 137, 136, 136,
179104 /* 1440 */ 136, 135, 132, 464, 595, 225, 595, 899, 437, 246,
179105 /* 1450 */ 336, 1253, 138, 138, 138, 138, 137, 137, 136, 136,
179106 /* 1460 */ 136, 135, 132, 464, 595, 1340, 595, 73, 73, 74,
179107 /* 1470 */ 74, 337, 138, 138, 138, 138, 137, 137, 136, 136,
179108 /* 1480 */ 136, 135, 132, 464, 38, 595, 493, 75, 75, 57,
179109 /* 1490 */ 57, 595, 425, 410, 1178, 1274, 497, 423, 250, 969,
179110 /* 1500 */ 329, 164, 914, 16, 968, 899, 1117, 423, 58, 58,
179111 /* 1510 */ 595, 423, 425, 595, 59, 59, 39, 142, 93, 340,
179112 /* 1520 */ 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140,
179113 /* 1530 */ 140, 140, 595, 61, 61, 595, 62, 62, 93, 595,
179114 /* 1540 */ 1258, 1258, 1088, 1091, 1078, 1078, 139, 139, 140, 140,
179115 /* 1550 */ 140, 140, 1410, 926, 925, 76, 76, 1409, 77, 77,
179116 /* 1560 */ 914, 485, 78, 78, 1117, 1174, 595, 412, 595, 226,
179117 /* 1570 */ 595, 127, 587, 1280, 4, 1592, 138, 138, 138, 138,
179118 /* 1580 */ 137, 137, 136, 136, 136, 135, 132, 464, 590, 20,
179119 /* 1590 */ 20, 79, 79, 147, 147, 595, 138, 138, 138, 138,
179120 /* 1600 */ 137, 137, 136, 136, 136, 135, 132, 464, 595, 354,
179121 /* 1610 */ 169, 115, 465, 595, 349, 595, 252, 595, 148, 148,
179122 /* 1620 */ 595, 1046, 595, 274, 584, 494, 112, 499, 595, 274,
179123 /* 1630 */ 1560, 80, 80, 595, 44, 1559, 64, 64, 81, 81,
179124 /* 1640 */ 65, 65, 595, 82, 82, 66, 66, 509, 310, 595,
179125 /* 1650 */ 360, 173, 173, 1065, 595, 553, 174, 174, 595, 125,
179126 /* 1660 */ 125, 501, 595, 274, 1406, 89, 89, 126, 299, 465,
179127 /* 1670 */ 596, 465, 67, 67, 1053, 595, 364, 85, 85, 595,
179128 /* 1680 */ 1057, 150, 150, 933, 934, 86, 86, 127, 587, 367,
179129 /* 1690 */ 4, 330, 586, 359, 523, 115, 271, 369, 171, 171,
179130 /* 1700 */ 1011, 1012, 152, 152, 590, 1339, 1053, 1053, 1055, 1056,
179131 /* 1710 */ 35, 371, 373, 595, 115, 1354, 1338, 9, 595, 168,
179132 /* 1720 */ 595, 115, 595, 1113, 595, 271, 595, 378, 465, 595,
179133 /* 1730 */ 388, 1419, 595, 539, 595, 1218, 146, 146, 1057, 1464,
179134 /* 1740 */ 584, 172, 172, 165, 165, 156, 156, 155, 155, 153,
179135 /* 1750 */ 153, 1392, 154, 154, 561, 88, 88, 90, 90, 560,
179136 /* 1760 */ 127, 587, 1129, 4, 1129, 999, 208, 274, 595, 1065,
179137 /* 1770 */ 595, 967, 595, 129, 1404, 125, 125, 590, 964, 1128,
179138 /* 1780 */ 129, 1128, 897, 126, 162, 465, 596, 465, 1651, 582,
179139 /* 1790 */ 1053, 87, 87, 52, 52, 60, 60, 966, 1624, 129,
179140 /* 1800 */ 1469, 465, 1319, 243, 1310, 1298, 1297, 1299, 1644, 170,
179141 /* 1810 */ 518, 1389, 289, 584, 12, 322, 323, 324, 228, 409,
179142 /* 1820 */ 1451, 305, 1053, 1053, 1055, 1056, 35, 561, 241, 351,
179143 /* 1830 */ 245, 1446, 562, 127, 587, 357, 4, 1439, 352, 311,
179144 /* 1840 */ 1456, 503, 1065, 528, 1455, 416, 232, 1401, 125, 125,
179145 /* 1850 */ 590, 1218, 381, 1532, 1337, 1531, 126, 1402, 465, 596,
179146 /* 1860 */ 465, 1400, 1399, 1053, 585, 213, 403, 227, 214, 537,
179147 /* 1870 */ 1647, 1587, 1274, 1589, 465, 1588, 239, 278, 1271, 1579,
179148 /* 1880 */ 1577, 96, 435, 100, 224, 198, 584, 1537, 183, 99,
179149 /* 1890 */ 191, 487, 488, 1452, 521, 1053, 1053, 1055, 1056, 35,
179150 /* 1900 */ 561, 13, 193, 194, 195, 560, 196, 255, 113, 414,
179151 /* 1910 */ 1458, 1457, 14, 510, 495, 1065, 259, 1460, 202, 106,
179152 /* 1920 */ 516, 125, 125, 417, 1218, 290, 1548, 1526, 261, 126,
179153 /* 1930 */ 206, 465, 596, 465, 362, 519, 1053, 419, 366, 262,
179154 /* 1940 */ 1357, 1300, 1356, 449, 263, 1355, 1348, 108, 918, 1327,
179155 /* 1950 */ 1661, 420, 1660, 233, 1326, 453, 1629, 380, 546, 1347,
179156 /* 1960 */ 1325, 454, 277, 276, 1659, 1615, 1614, 457, 1053, 1053,
179157 /* 1970 */ 1055, 1056, 35, 1636, 1222, 467, 320, 321, 301, 386,
179158 /* 1980 */ 144, 1424, 572, 408, 408, 407, 285, 405, 11, 1423,
179159 /* 1990 */ 884, 397, 120, 127, 587, 220, 4, 1218, 1380, 1513,
179160 /* 2000 */ 395, 114, 1379, 247, 42, 339, 556, 598, 1228, 284,
179161 /* 2010 */ 590, 401, 402, 338, 286, 287, 328, 599, 1295, 1290,
179162 /* 2020 */ 1564, 175, 428, 1565, 429, 1563, 176, 871, 159, 177,
179163 /* 2030 */ 1562, 318, 229, 466, 465, 230, 221, 91, 332, 469,
179164 /* 2040 */ 1169, 471, 474, 94, 249, 189, 584, 95, 244, 1127,
179165 /* 2050 */ 188, 1125, 178, 342, 190, 43, 1253, 179, 251, 950,
179166 /* 2060 */ 254, 350, 192, 1141, 197, 180, 181, 438, 182, 440,
179167 /* 2070 */ 102, 103, 248, 104, 199, 1065, 1144, 256, 105, 1140,
179168 /* 2080 */ 257, 125, 125, 24, 166, 258, 361, 1133, 274, 126,
179169 /* 2090 */ 515, 465, 596, 465, 260, 15, 1053, 204, 264, 382,
179170 /* 2100 */ 886, 92, 587, 1268, 4, 203, 520, 427, 205, 524,
179171 /* 2110 */ 107, 25, 330, 586, 374, 574, 26, 916, 590, 529,
179172 /* 2120 */ 377, 929, 109, 319, 167, 110, 27, 184, 1053, 1053,
179173 /* 2130 */ 1055, 1056, 35, 540, 532, 1215, 477, 1094, 111, 1185,
179174 /* 2140 */ 17, 234, 465, 293, 1184, 295, 207, 997, 129, 273,
179175 /* 2150 */ 1205, 28, 1003, 29, 584, 30, 1201, 1218, 1208, 31,
179176 /* 2160 */ 1203, 1209, 32, 1190, 41, 568, 33, 34, 211, 115,
179177 /* 2170 */ 8, 1108, 1095, 1093, 1097, 1098, 279, 580, 122, 1149,
179178 /* 2180 */ 36, 117, 18, 1065, 1058, 118, 898, 128, 37, 125,
179179 /* 2190 */ 125, 406, 591, 186, 960, 280, 281, 126, 1652, 465,
179180 /* 2200 */ 596, 465, 1222, 467, 1053, 157, 301, 1224, 1223, 1286,
179181 /* 2210 */ 1286, 408, 408, 407, 285, 405, 1286, 1286, 884, 1286,
179182 /* 2220 */ 301, 1286, 1286, 573, 1286, 408, 408, 407, 285, 405,
179183 /* 2230 */ 1286, 247, 884, 339, 1286, 1286, 1053, 1053, 1055, 1056,
179184 /* 2240 */ 35, 338, 1286, 1286, 1286, 247, 1286, 339, 1286, 1286,
179185 /* 2250 */ 1286, 1286, 1286, 1286, 1286, 338, 1286, 1286, 1286, 1286,
179186 /* 2260 */ 1286, 1286, 1286, 1286, 1286, 1218, 1286, 1286, 1286, 1286,
179187 /* 2270 */ 1286, 1286, 249, 1286, 1286, 1286, 1286, 1286, 1286, 1286,
179188 /* 2280 */ 178, 1286, 1286, 43, 1286, 1286, 249, 1286, 1286, 1286,
179189 /* 2290 */ 1286, 1286, 1286, 1286, 178, 1286, 1286, 43, 1286, 1286,
179190 /* 2300 */ 248, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286,
179191 /* 2310 */ 1286, 1286, 1286, 1286, 248, 1286, 1286, 1286, 1286, 1286,
179192 /* 2320 */ 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286,
179193 /* 2330 */ 1286, 1286, 1286, 1286, 1286, 427, 1286, 1286, 1286, 1286,
179194 /* 2340 */ 330, 586, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 427,
179195 /* 2350 */ 1286, 1286, 1286, 1286, 330, 586, 1286, 1286, 1286, 1286,
179196 /* 2360 */ 1286, 1286, 1286, 1286, 477, 1286, 1286, 1286, 1286, 1286,
179197 /* 2370 */ 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 477,
179198 };
179199 static const YYCODETYPE yy_lookahead[] = {
179200 /* 0 */ 277, 278, 279, 241, 242, 225, 195, 227, 195, 246,
179201 /* 10 */ 195, 195, 195, 221, 195, 235, 254, 195, 256, 19,
179202 /* 20 */ 257, 298, 277, 278, 279, 206, 213, 214, 206, 218,
179203 /* 30 */ 219, 31, 206, 218, 219, 218, 219, 218, 219, 39,
179204 /* 40 */ 218, 219, 29, 43, 44, 45, 33, 47, 48, 49,
179205 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 19,
179206 /* 60 */ 241, 242, 276, 241, 242, 195, 255, 241, 242, 277,
179207 /* 70 */ 278, 279, 11, 254, 255, 256, 254, 255, 256, 66,
179208 /* 80 */ 254, 265, 256, 43, 44, 45, 264, 47, 48, 49,
179209 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 215,
179210 /* 100 */ 287, 315, 316, 103, 104, 105, 106, 107, 108, 109,
179211 /* 110 */ 110, 111, 112, 113, 114, 237, 238, 195, 74, 195,
179212 /* 120 */ 187, 188, 189, 190, 191, 192, 82, 87, 25, 89,
179213 /* 130 */ 197, 19, 199, 318, 319, 318, 319, 25, 195, 206,
179214 /* 140 */ 218, 219, 195, 103, 104, 105, 106, 107, 108, 109,
179215 /* 150 */ 110, 111, 112, 113, 114, 43, 44, 45, 195, 47,
179216 /* 160 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
179217 /* 170 */ 58, 60, 128, 289, 241, 242, 114, 255, 294, 60,
179218 /* 180 */ 310, 311, 70, 139, 140, 218, 264, 254, 77, 256,
179219 /* 190 */ 129, 130, 73, 55, 56, 57, 58, 59, 221, 88,
179220 /* 200 */ 218, 90, 269, 240, 93, 107, 108, 109, 110, 111,
179221 /* 210 */ 112, 113, 114, 215, 271, 103, 104, 105, 106, 107,
179222 /* 220 */ 108, 109, 110, 111, 112, 113, 114, 218, 117, 118,
179223 /* 230 */ 119, 307, 299, 309, 301, 19, 117, 118, 119, 129,
179224 /* 240 */ 130, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179225 /* 250 */ 112, 113, 114, 150, 277, 278, 279, 146, 311, 43,
179226 /* 260 */ 44, 45, 195, 47, 48, 49, 50, 51, 52, 53,
179227 /* 270 */ 54, 55, 56, 57, 58, 277, 278, 279, 313, 19,
179228 /* 280 */ 195, 195, 317, 23, 68, 218, 219, 25, 55, 56,
179229 /* 290 */ 57, 58, 109, 110, 111, 112, 113, 114, 22, 23,
179230 /* 300 */ 233, 25, 313, 43, 44, 45, 317, 47, 48, 49,
179231 /* 310 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 103,
179232 /* 320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
179233 /* 330 */ 114, 232, 60, 212, 213, 214, 103, 104, 105, 106,
179234 /* 340 */ 107, 108, 109, 110, 111, 112, 113, 114, 103, 104,
179235 /* 350 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179236 /* 360 */ 24, 195, 200, 103, 104, 105, 106, 107, 108, 109,
179237 /* 370 */ 110, 111, 112, 113, 114, 251, 60, 253, 102, 107,
179238 /* 380 */ 108, 119, 313, 19, 218, 219, 317, 23, 116, 117,
179239 /* 390 */ 118, 119, 195, 121, 206, 22, 60, 26, 312, 313,
179240 /* 400 */ 195, 129, 205, 317, 207, 35, 144, 43, 44, 45,
179241 /* 410 */ 195, 47, 48, 49, 50, 51, 52, 53, 54, 55,
179242 /* 420 */ 56, 57, 58, 218, 219, 82, 154, 19, 156, 241,
179243 /* 430 */ 242, 60, 24, 117, 118, 119, 120, 67, 233, 123,
179244 /* 440 */ 124, 125, 254, 195, 256, 75, 284, 259, 260, 133,
179245 /* 450 */ 288, 43, 44, 45, 118, 47, 48, 49, 50, 51,
179246 /* 460 */ 52, 53, 54, 55, 56, 57, 58, 103, 104, 105,
179247 /* 470 */ 106, 107, 108, 109, 110, 111, 112, 113, 114, 195,
179248 /* 480 */ 107, 108, 139, 140, 318, 195, 320, 195, 117, 118,
179249 /* 490 */ 119, 61, 19, 20, 120, 22, 195, 123, 124, 125,
179250 /* 500 */ 195, 131, 218, 219, 195, 195, 146, 133, 207, 36,
179251 /* 510 */ 295, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179252 /* 520 */ 112, 113, 114, 218, 219, 165, 60, 195, 218, 219,
179253 /* 530 */ 240, 19, 240, 60, 189, 190, 191, 192, 233, 255,
179254 /* 540 */ 139, 140, 197, 233, 199, 72, 61, 272, 264, 195,
179255 /* 550 */ 120, 206, 195, 19, 60, 43, 44, 45, 206, 47,
179256 /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
179257 /* 570 */ 58, 25, 218, 219, 101, 109, 112, 113, 114, 195,
179258 /* 580 */ 107, 108, 109, 117, 118, 119, 241, 242, 115, 195,
179259 /* 590 */ 117, 118, 119, 241, 242, 122, 60, 206, 195, 254,
179260 /* 600 */ 60, 256, 218, 219, 195, 120, 254, 195, 256, 73,
179261 /* 610 */ 125, 117, 118, 119, 269, 103, 104, 105, 106, 107,
179262 /* 620 */ 108, 109, 110, 111, 112, 113, 114, 154, 155, 156,
179263 /* 630 */ 157, 158, 241, 242, 240, 281, 19, 234, 144, 255,
179264 /* 640 */ 23, 206, 166, 167, 299, 254, 301, 256, 264, 240,
179265 /* 650 */ 116, 117, 295, 117, 118, 119, 183, 117, 118, 119,
179266 /* 660 */ 43, 44, 45, 151, 47, 48, 49, 50, 51, 52,
179267 /* 670 */ 53, 54, 55, 56, 57, 58, 241, 242, 266, 145,
179268 /* 680 */ 19, 241, 242, 242, 23, 139, 140, 77, 25, 254,
179269 /* 690 */ 195, 256, 152, 276, 254, 254, 256, 256, 88, 206,
179270 /* 700 */ 90, 60, 206, 93, 43, 44, 45, 272, 47, 48,
179271 /* 710 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179272 /* 720 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
179273 /* 730 */ 113, 114, 315, 316, 241, 242, 131, 241, 242, 134,
179274 /* 740 */ 22, 206, 101, 22, 82, 19, 20, 254, 22, 256,
179275 /* 750 */ 254, 74, 256, 263, 22, 195, 146, 267, 117, 118,
179276 /* 760 */ 276, 266, 36, 122, 103, 104, 105, 106, 107, 108,
179277 /* 770 */ 109, 110, 111, 112, 113, 114, 241, 242, 60, 217,
179278 /* 780 */ 130, 60, 195, 121, 19, 195, 60, 225, 23, 254,
179279 /* 790 */ 127, 256, 60, 237, 238, 154, 155, 156, 72, 315,
179280 /* 800 */ 316, 139, 140, 153, 22, 128, 129, 130, 43, 44,
179281 /* 810 */ 45, 195, 47, 48, 49, 50, 51, 52, 53, 54,
179282 /* 820 */ 55, 56, 57, 58, 183, 304, 305, 101, 19, 60,
179283 /* 830 */ 243, 271, 23, 107, 108, 117, 118, 119, 117, 118,
179284 /* 840 */ 119, 115, 60, 117, 118, 119, 16, 195, 122, 117,
179285 /* 850 */ 118, 119, 43, 44, 45, 22, 47, 48, 49, 50,
179286 /* 860 */ 51, 52, 53, 54, 55, 56, 57, 58, 103, 104,
179287 /* 870 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179288 /* 880 */ 154, 155, 156, 157, 158, 295, 117, 118, 119, 60,
179289 /* 890 */ 101, 60, 240, 60, 307, 21, 309, 195, 195, 117,
179290 /* 900 */ 118, 119, 195, 47, 48, 49, 50, 118, 78, 183,
179291 /* 910 */ 80, 122, 103, 104, 105, 106, 107, 108, 109, 110,
179292 /* 920 */ 111, 112, 113, 114, 195, 218, 219, 16, 312, 313,
179293 /* 930 */ 195, 195, 19, 317, 262, 263, 23, 212, 213, 214,
179294 /* 940 */ 233, 210, 211, 154, 155, 156, 117, 118, 119, 118,
179295 /* 950 */ 117, 118, 119, 218, 219, 81, 43, 44, 45, 195,
179296 /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179297 /* 970 */ 57, 58, 183, 144, 271, 122, 19, 190, 122, 192,
179298 /* 980 */ 23, 25, 218, 219, 197, 132, 199, 195, 286, 78,
179299 /* 990 */ 255, 80, 162, 206, 265, 107, 108, 233, 124, 195,
179300 /* 1000 */ 43, 44, 45, 195, 47, 48, 49, 50, 51, 52,
179301 /* 1010 */ 53, 54, 55, 56, 57, 58, 103, 104, 105, 106,
179302 /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 114, 241, 242,
179303 /* 1030 */ 195, 195, 31, 77, 195, 243, 162, 195, 195, 195,
179304 /* 1040 */ 39, 254, 154, 256, 156, 19, 90, 203, 19, 93,
179305 /* 1050 */ 24, 208, 208, 218, 219, 195, 269, 218, 219, 195,
179306 /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
179307 /* 1070 */ 113, 114, 233, 230, 266, 232, 47, 263, 218, 219,
179308 /* 1080 */ 19, 267, 218, 219, 23, 23, 299, 25, 301, 135,
179309 /* 1090 */ 255, 137, 138, 233, 47, 195, 195, 195, 25, 307,
179310 /* 1100 */ 19, 309, 22, 23, 43, 44, 45, 271, 47, 48,
179311 /* 1110 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179312 /* 1120 */ 218, 219, 96, 195, 43, 44, 45, 195, 47, 48,
179313 /* 1130 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179314 /* 1140 */ 114, 195, 195, 243, 243, 116, 120, 121, 122, 123,
179315 /* 1150 */ 124, 125, 126, 195, 195, 195, 195, 255, 132, 213,
179316 /* 1160 */ 214, 132, 234, 116, 103, 104, 105, 106, 107, 108,
179317 /* 1170 */ 109, 110, 111, 112, 113, 114, 218, 219, 218, 219,
179318 /* 1180 */ 195, 119, 102, 195, 103, 104, 105, 106, 107, 108,
179319 /* 1190 */ 109, 110, 111, 112, 113, 114, 22, 23, 22, 25,
179320 /* 1200 */ 24, 67, 12, 218, 219, 195, 144, 307, 307, 309,
179321 /* 1210 */ 309, 195, 77, 255, 19, 255, 143, 27, 23, 313,
179322 /* 1220 */ 86, 100, 313, 317, 265, 90, 317, 266, 93, 95,
179323 /* 1230 */ 210, 211, 42, 287, 19, 23, 60, 25, 43, 44,
179324 /* 1240 */ 45, 160, 47, 48, 49, 50, 51, 52, 53, 54,
179325 /* 1250 */ 55, 56, 57, 58, 64, 134, 109, 261, 43, 44,
179326 /* 1260 */ 45, 215, 47, 48, 49, 50, 51, 52, 53, 54,
179327 /* 1270 */ 55, 56, 57, 58, 210, 211, 102, 128, 129, 130,
179328 /* 1280 */ 12, 147, 266, 136, 163, 164, 302, 303, 141, 195,
179329 /* 1290 */ 25, 195, 19, 195, 118, 27, 228, 19, 103, 104,
179330 /* 1300 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179331 /* 1310 */ 42, 195, 218, 219, 218, 219, 218, 219, 103, 104,
179332 /* 1320 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179333 /* 1330 */ 19, 195, 64, 195, 218, 219, 195, 259, 260, 195,
179334 /* 1340 */ 294, 195, 74, 195, 150, 151, 195, 246, 19, 7,
179335 /* 1350 */ 8, 9, 195, 24, 218, 219, 218, 219, 257, 218,
179336 /* 1360 */ 219, 195, 218, 219, 218, 219, 218, 219, 19, 218,
179337 /* 1370 */ 219, 98, 43, 44, 45, 160, 47, 48, 49, 50,
179338 /* 1380 */ 51, 52, 53, 54, 55, 56, 57, 58, 19, 128,
179339 /* 1390 */ 129, 130, 43, 44, 45, 117, 47, 48, 49, 50,
179340 /* 1400 */ 51, 52, 53, 54, 55, 56, 57, 58, 22, 22,
179341 /* 1410 */ 116, 146, 43, 44, 45, 195, 47, 48, 49, 50,
179342 /* 1420 */ 51, 52, 53, 54, 55, 56, 57, 58, 117, 159,
179343 /* 1430 */ 195, 161, 103, 104, 105, 106, 107, 108, 109, 110,
179344 /* 1440 */ 111, 112, 113, 114, 195, 151, 195, 60, 62, 15,
179345 /* 1450 */ 195, 25, 103, 104, 105, 106, 107, 108, 109, 110,
179346 /* 1460 */ 111, 112, 113, 114, 195, 228, 195, 218, 219, 218,
179347 /* 1470 */ 219, 195, 103, 104, 105, 106, 107, 108, 109, 110,
179348 /* 1480 */ 111, 112, 113, 114, 22, 195, 246, 218, 219, 218,
179349 /* 1490 */ 219, 195, 19, 22, 23, 61, 246, 257, 24, 136,
179350 /* 1500 */ 246, 22, 60, 24, 141, 118, 60, 257, 218, 219,
179351 /* 1510 */ 195, 257, 19, 195, 218, 219, 54, 44, 45, 195,
179352 /* 1520 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179353 /* 1530 */ 57, 58, 195, 218, 219, 195, 218, 219, 45, 195,
179354 /* 1540 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179355 /* 1550 */ 57, 58, 195, 121, 122, 218, 219, 195, 218, 219,
179356 /* 1560 */ 118, 195, 218, 219, 118, 23, 195, 25, 195, 143,
179357 /* 1570 */ 195, 19, 20, 102, 22, 195, 103, 104, 105, 106,
179358 /* 1580 */ 107, 108, 109, 110, 111, 112, 113, 114, 36, 218,
179359 /* 1590 */ 219, 218, 219, 218, 219, 195, 103, 104, 105, 106,
179360 /* 1600 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 23,
179361 /* 1610 */ 23, 25, 60, 195, 195, 195, 142, 195, 218, 219,
179362 /* 1620 */ 195, 23, 195, 25, 72, 130, 116, 23, 195, 25,
179363 /* 1630 */ 195, 218, 219, 195, 82, 195, 218, 219, 218, 219,
179364 /* 1640 */ 218, 219, 195, 218, 219, 218, 219, 195, 153, 195,
179365 /* 1650 */ 195, 218, 219, 101, 195, 145, 218, 219, 195, 107,
179366 /* 1660 */ 108, 23, 195, 25, 195, 218, 219, 115, 22, 117,
179367 /* 1670 */ 118, 119, 218, 219, 122, 195, 195, 218, 219, 195,
179368 /* 1680 */ 60, 218, 219, 7, 8, 218, 219, 19, 20, 195,
179369 /* 1690 */ 22, 139, 140, 23, 23, 25, 25, 195, 218, 219,
179370 /* 1700 */ 84, 85, 218, 219, 36, 228, 154, 155, 156, 157,
179371 /* 1710 */ 158, 195, 23, 195, 25, 195, 195, 49, 195, 23,
179372 /* 1720 */ 195, 25, 195, 23, 195, 25, 195, 195, 60, 195,
179373 /* 1730 */ 195, 195, 195, 146, 195, 183, 218, 219, 118, 195,
179374 /* 1740 */ 72, 218, 219, 218, 219, 218, 219, 218, 219, 218,
179375 /* 1750 */ 219, 195, 218, 219, 86, 218, 219, 218, 219, 91,
179376 /* 1760 */ 19, 20, 154, 22, 156, 23, 258, 25, 195, 101,
179377 /* 1770 */ 195, 23, 195, 25, 195, 107, 108, 36, 23, 154,
179378 /* 1780 */ 25, 156, 23, 115, 25, 117, 118, 119, 142, 238,
179379 /* 1790 */ 122, 218, 219, 218, 219, 218, 219, 23, 322, 25,
179380 /* 1800 */ 195, 60, 195, 300, 195, 195, 195, 195, 195, 244,
179381 /* 1810 */ 291, 258, 290, 72, 245, 258, 258, 258, 216, 193,
179382 /* 1820 */ 274, 247, 154, 155, 156, 157, 158, 86, 300, 296,
179383 /* 1830 */ 300, 270, 91, 19, 20, 247, 22, 270, 248, 248,
179384 /* 1840 */ 274, 296, 101, 222, 274, 274, 231, 262, 107, 108,
179385 /* 1850 */ 36, 183, 221, 221, 227, 221, 115, 262, 117, 118,
179386 /* 1860 */ 119, 262, 262, 122, 283, 251, 247, 245, 251, 116,
179387 /* 1870 */ 198, 220, 61, 220, 60, 220, 300, 142, 38, 202,
179388 /* 1880 */ 202, 297, 202, 152, 151, 22, 72, 286, 43, 297,
179389 /* 1890 */ 236, 18, 202, 275, 18, 154, 155, 156, 157, 158,
179390 /* 1900 */ 86, 273, 239, 239, 239, 91, 239, 201, 150, 248,
179391 /* 1910 */ 275, 275, 273, 202, 248, 101, 201, 236, 236, 159,
179392 /* 1920 */ 63, 107, 108, 248, 183, 202, 293, 248, 201, 115,
179393 /* 1930 */ 22, 117, 118, 119, 292, 223, 122, 223, 202, 201,
179394 /* 1940 */ 220, 202, 220, 65, 201, 220, 229, 22, 127, 220,
179395 /* 1950 */ 226, 223, 226, 166, 222, 24, 316, 220, 308, 229,
179396 /* 1960 */ 220, 114, 92, 202, 220, 321, 321, 83, 154, 155,
179397 /* 1970 */ 156, 157, 158, 0, 1, 2, 285, 285, 5, 223,
179398 /* 1980 */ 149, 268, 146, 10, 11, 12, 13, 14, 22, 268,
179399 /* 1990 */ 17, 202, 159, 19, 20, 250, 22, 183, 252, 280,
179400 /* 2000 */ 251, 148, 252, 30, 25, 32, 147, 204, 13, 196,
179401 /* 2010 */ 36, 249, 248, 40, 196, 6, 282, 194, 194, 194,
179402 /* 2020 */ 215, 209, 306, 215, 306, 215, 209, 4, 224, 209,
179403 /* 2030 */ 215, 224, 216, 3, 60, 216, 22, 215, 122, 19,
179404 /* 2040 */ 122, 19, 125, 22, 71, 16, 72, 22, 15, 23,
179405 /* 2050 */ 303, 23, 79, 140, 152, 82, 25, 131, 24, 20,
179406 /* 2060 */ 145, 16, 143, 1, 143, 131, 131, 62, 131, 37,
179407 /* 2070 */ 54, 54, 99, 54, 152, 101, 117, 34, 54, 1,
179408 /* 2080 */ 142, 107, 108, 22, 5, 116, 162, 69, 25, 115,
179409 /* 2090 */ 41, 117, 118, 119, 142, 24, 122, 116, 126, 132,
179410 /* 2100 */ 20, 19, 20, 76, 22, 69, 19, 134, 22, 68,
179411 /* 2110 */ 22, 22, 139, 140, 23, 141, 22, 60, 36, 68,
179412 /* 2120 */ 24, 28, 22, 68, 23, 150, 34, 37, 154, 155,
179413 /* 2130 */ 156, 157, 158, 22, 97, 23, 163, 23, 25, 23,
179414 /* 2140 */ 22, 142, 60, 23, 98, 23, 22, 144, 25, 34,
179415 /* 2150 */ 76, 34, 117, 34, 72, 34, 89, 183, 94, 34,
179416 /* 2160 */ 87, 76, 34, 23, 22, 24, 34, 22, 25, 25,
179417 /* 2170 */ 44, 23, 23, 23, 23, 11, 22, 25, 25, 23,
179418 /* 2180 */ 22, 143, 22, 101, 23, 143, 23, 22, 22, 107,
179419 /* 2190 */ 108, 15, 25, 25, 136, 142, 142, 115, 142, 117,
179420 /* 2200 */ 118, 119, 1, 2, 122, 23, 5, 1, 1, 323,
179421 /* 2210 */ 323, 10, 11, 12, 13, 14, 323, 323, 17, 323,
179422 /* 2220 */ 5, 323, 323, 141, 323, 10, 11, 12, 13, 14,
179423 /* 2230 */ 323, 30, 17, 32, 323, 323, 154, 155, 156, 157,
179424 /* 2240 */ 158, 40, 323, 323, 323, 30, 323, 32, 323, 323,
179425 /* 2250 */ 323, 323, 323, 323, 323, 40, 323, 323, 323, 323,
179426 /* 2260 */ 323, 323, 323, 323, 323, 183, 323, 323, 323, 323,
179427 /* 2270 */ 323, 323, 71, 323, 323, 323, 323, 323, 323, 323,
179428 /* 2280 */ 79, 323, 323, 82, 323, 323, 71, 323, 323, 323,
179429 /* 2290 */ 323, 323, 323, 323, 79, 323, 323, 82, 323, 323,
179430 /* 2300 */ 99, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179431 /* 2310 */ 323, 323, 323, 323, 99, 323, 323, 323, 323, 323,
179432 /* 2320 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179433 /* 2330 */ 323, 323, 323, 323, 323, 134, 323, 323, 323, 323,
179434 /* 2340 */ 139, 140, 323, 323, 323, 323, 323, 323, 323, 134,
179435 /* 2350 */ 323, 323, 323, 323, 139, 140, 323, 323, 323, 323,
179436 /* 2360 */ 323, 323, 323, 323, 163, 323, 323, 323, 323, 323,
179437 /* 2370 */ 323, 323, 323, 323, 323, 323, 323, 323, 163, 323,
179438 /* 2380 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179439 /* 2390 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
179440 /* 2400 */ 323, 323, 323, 323, 323, 323, 323, 323, 187, 187,
179441 /* 2410 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179442 /* 2420 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179443 /* 2430 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179444 /* 2440 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179445 /* 2450 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
@@ -179453,186 +179339,184 @@
179453 /* 2530 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179454 /* 2540 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179455 /* 2550 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179456 /* 2560 */ 187, 187, 187, 187, 187, 187,
179457 };
179458 #define YY_SHIFT_COUNT (601)
179459 #define YY_SHIFT_MIN (0)
179460 #define YY_SHIFT_MAX (2215)
179461 static const unsigned short int yy_shift_ofst[] = {
179462 /* 0 */ 2201, 1973, 2215, 1552, 1552, 343, 44, 1668, 1741, 1814,
179463 /* 10 */ 726, 726, 726, 662, 343, 343, 343, 343, 343, 0,
179464 /* 20 */ 0, 216, 1349, 726, 726, 726, 726, 726, 726, 726,
179465 /* 30 */ 726, 726, 726, 726, 726, 726, 726, 726, 272, 272,
179466 /* 40 */ 111, 111, 316, 119, 536, 769, 769, 546, 546, 546,
179467 /* 50 */ 546, 40, 112, 260, 364, 408, 512, 617, 661, 765,
179468 /* 60 */ 809, 913, 957, 1061, 1081, 1195, 1215, 1329, 1349, 1349,
179469 /* 70 */ 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349,
179470 /* 80 */ 1349, 1349, 1349, 1349, 1349, 1349, 1369, 1349, 1473, 1493,
179471 /* 90 */ 1493, 473, 1974, 2082, 726, 726, 726, 726, 726, 726,
179472 /* 100 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179473 /* 110 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179474 /* 120 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179475 /* 130 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179476 /* 140 */ 726, 726, 726, 726, 726, 726, 138, 233, 233, 233,
179477 /* 150 */ 233, 233, 233, 233, 245, 98, 183, 371, 874, 1029,
179478 /* 160 */ 769, 769, 888, 888, 769, 464, 110, 476, 476, 476,
179479 /* 170 */ 401, 62, 62, 2379, 2379, 1026, 1026, 1026, 540, 718,
179480 /* 180 */ 718, 718, 718, 1268, 1268, 610, 371, 276, 1174, 769,
179481 /* 190 */ 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
179482 /* 200 */ 769, 769, 769, 769, 769, 769, 769, 769, 534, 956,
179483 /* 210 */ 956, 769, 61, 1135, 1135, 831, 1278, 1278, 831, 831,
179484 /* 220 */ 360, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 641, 789,
179485 /* 230 */ 789, 721, 374, 732, 466, 782, 494, 829, 833, 769,
179486 /* 240 */ 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
179487 /* 250 */ 769, 769, 769, 677, 769, 769, 769, 769, 769, 769,
179488 /* 260 */ 769, 769, 769, 769, 769, 769, 370, 370, 370, 769,
179489 /* 270 */ 769, 769, 1062, 769, 769, 769, 1176, 1134, 769, 1190,
179490 /* 280 */ 769, 769, 769, 769, 769, 769, 769, 769, 485, 1149,
179491 /* 290 */ 13, 954, 336, 336, 336, 336, 262, 954, 954, 1147,
179492 /* 300 */ 373, 1342, 430, 1434, 1294, 1194, 1073, 1194, 1311, 103,
179493 /* 310 */ 1294, 1294, 103, 1294, 1073, 1311, 663, 1212, 1047, 1001,
179494 /* 320 */ 1001, 1001, 1510, 1510, 1510, 1510, 1265, 1265, 1270, 1426,
179495 /* 330 */ 1363, 1479, 1753, 1811, 1753, 1753, 1735, 1735, 1840, 1840,
179496 /* 340 */ 1735, 1731, 1733, 1863, 1845, 1873, 1873, 1873, 1873, 1735,
179497 /* 350 */ 1876, 1758, 1733, 1733, 1758, 1863, 1845, 1758, 1845, 1758,
179498 /* 360 */ 1735, 1876, 1760, 1857, 1735, 1876, 1908, 1735, 1876, 1735,
179499 /* 370 */ 1876, 1908, 1753, 1753, 1753, 1878, 1925, 1925, 1908, 1753,
179500 /* 380 */ 1821, 1753, 1878, 1753, 1753, 1787, 1931, 1847, 1847, 1908,
179501 /* 390 */ 1735, 1870, 1870, 1884, 1884, 1831, 1836, 1966, 1735, 1833,
179502 /* 400 */ 1831, 1853, 1859, 1758, 1979, 1995, 1995, 2009, 2009, 2009,
179503 /* 410 */ 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379,
179504 /* 420 */ 2379, 2379, 2379, 2379, 2379, 856, 1121, 830, 1080, 1471,
179505 /* 430 */ 911, 1261, 1387, 1542, 605, 1462, 1474, 650, 1495, 1586,
179506 /* 440 */ 1386, 1598, 1604, 1638, 1670, 1671, 1689, 1442, 1432, 1676,
179507 /* 450 */ 853, 1696, 1587, 1273, 1446, 1700, 1742, 1616, 1748, 1755,
179508 /* 460 */ 1608, 1625, 1759, 1774, 1620, 1646, 2023, 2030, 2014, 1916,
179509 /* 470 */ 2020, 1918, 2022, 2021, 2025, 1917, 2033, 2029, 2026, 2028,
179510 /* 480 */ 1913, 1902, 1926, 2031, 2031, 2034, 1919, 2039, 1915, 2045,
179511 /* 490 */ 2062, 1921, 1934, 2031, 1935, 2005, 2032, 2031, 1922, 2016,
179512 /* 500 */ 2017, 2019, 2024, 1937, 1959, 2043, 1938, 2078, 2079, 2061,
179513 /* 510 */ 1969, 1924, 2018, 2063, 2036, 2027, 2049, 1952, 1981, 2071,
179514 /* 520 */ 2080, 2087, 1967, 1972, 2086, 2041, 2088, 2089, 2091, 2094,
179515 /* 530 */ 2051, 2057, 2096, 2037, 2093, 2100, 2055, 2090, 2101, 2092,
179516 /* 540 */ 1975, 2111, 2112, 2114, 2113, 2116, 2118, 2046, 1999, 2120,
179517 /* 550 */ 2122, 2035, 2115, 2124, 2003, 2123, 2117, 2119, 2121, 2125,
179518 /* 560 */ 2067, 2074, 2073, 2126, 2085, 2064, 2128, 2140, 2142, 2141,
179519 /* 570 */ 2143, 2144, 2132, 2038, 2042, 2148, 2123, 2149, 2150, 2151,
179520 /* 580 */ 2145, 2152, 2153, 2156, 2154, 2164, 2158, 2160, 2161, 2163,
179521 /* 590 */ 2165, 2166, 2167, 2058, 2053, 2054, 2056, 2168, 2182, 2176,
179522 /* 600 */ 2206, 2207,
179523 };
179524 #define YY_REDUCE_COUNT (424)
179525 #define YY_REDUCE_MIN (-277)
179526 #define YY_REDUCE_MAX (1825)
179527 static const short yy_reduce_ofst[] = {
179528 /* 0 */ -67, 345, 787, -178, -181, 188, 435, -185, 166, -183,
179529 /* 10 */ -78, 284, 384, -174, 352, 391, 493, 496, 535, -208,
179530 /* 20 */ -23, -277, -2, 205, 305, 310, 707, 764, -189, 67,
179531 /* 30 */ 839, 735, 835, 860, 902, 354, 958, 960, -187, 946,
179532 /* 40 */ 86, 616, 843, 587, 792, 900, 901, -238, 440, -238,
179533 /* 50 */ 440, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179534 /* 60 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179535 /* 70 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179536 /* 80 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
179537 /* 90 */ -255, 864, 985, 1094, 1096, 1098, 1116, 1136, 1138, 1141,
179538 /* 100 */ 1144, 1146, 1148, 1151, 1249, 1251, 1269, 1271, 1290, 1296,
179539 /* 110 */ 1315, 1318, 1337, 1340, 1344, 1371, 1373, 1375, 1400, 1413,
179540 /* 120 */ 1418, 1420, 1422, 1425, 1427, 1433, 1438, 1447, 1454, 1459,
179541 /* 130 */ 1463, 1467, 1480, 1484, 1518, 1523, 1525, 1527, 1529, 1531,
179542 /* 140 */ 1534, 1537, 1539, 1573, 1575, 1577, -255, -255, -255, -255,
179543 /* 150 */ -255, -255, -255, -255, -255, -255, -255, 197, 162, -220,
179544 /* 160 */ -76, -130, 121, 725, 844, -255, -116, -214, 417, 484,
179545 /* 170 */ 441, -255, -255, -255, -255, 562, 562, 562, 702, -57,
179546 /* 180 */ 560, 703, 836, -122, 556, -35, 301, 521, 521, -37,
179547 /* 190 */ -184, 729, 959, 290, 292, 394, 409, 215, 412, 357,
179548 /* 200 */ 495, 808, 590, 961, 652, 403, 928, 1016, 672, -11,
179549 /* 210 */ 69, -53, 1046, 906, 909, 731, 490, 814, 1020, 1064,
179550 /* 220 */ 124, 984, -237, 1101, 1240, 1250, 1078, 1254, -33, -18,
179551 /* 230 */ 9, 85, 99, 248, 309, 332, 736, 804, 842, 932,
179552 /* 240 */ 947, 988, 1010, 1157, 1166, 1220, 1235, 1255, 1276, 1324,
179553 /* 250 */ 1357, 1362, 1366, 275, 1380, 1419, 1435, 1440, 1452, 1455,
179554 /* 260 */ 1469, 1481, 1494, 1502, 1516, 1520, 1068, 1237, 1477, 1521,
179555 /* 270 */ 1532, 1535, 996, 1536, 1544, 1556, 1508, 1476, 1579, 1551,
179556 /* 280 */ 1605, 309, 1607, 1609, 1610, 1611, 1612, 1613, 1503, 1519,
179557 /* 290 */ 1522, 1565, 1553, 1557, 1558, 1559, 996, 1565, 1565, 1569,
179558 /* 300 */ 1602, 1626, 1528, 1530, 1546, 1561, 1574, 1567, 1533, 1590,
179559 /* 310 */ 1566, 1570, 1591, 1571, 1588, 1545, 1621, 1615, 1627, 1631,
179560 /* 320 */ 1632, 1634, 1585, 1595, 1599, 1600, 1614, 1617, 1581, 1619,
179561 /* 330 */ 1622, 1672, 1651, 1576, 1653, 1655, 1677, 1678, 1584, 1592,
179562 /* 340 */ 1680, 1601, 1618, 1628, 1654, 1663, 1664, 1665, 1667, 1690,
179563 /* 350 */ 1706, 1661, 1635, 1636, 1666, 1639, 1681, 1675, 1682, 1679,
179564 /* 360 */ 1711, 1715, 1633, 1642, 1723, 1727, 1712, 1736, 1738, 1739,
179565 /* 370 */ 1743, 1714, 1720, 1722, 1725, 1717, 1724, 1726, 1728, 1729,
179566 /* 380 */ 1732, 1737, 1730, 1740, 1744, 1640, 1650, 1691, 1692, 1756,
179567 /* 390 */ 1761, 1644, 1645, 1713, 1721, 1746, 1749, 1719, 1789, 1734,
179568 /* 400 */ 1750, 1745, 1762, 1764, 1803, 1813, 1818, 1823, 1824, 1825,
179569 /* 410 */ 1716, 1718, 1747, 1812, 1805, 1808, 1810, 1815, 1817, 1804,
179570 /* 420 */ 1807, 1816, 1819, 1822, 1820,
179571 };
179572 static const YYACTIONTYPE yy_default[] = {
179573 /* 0 */ 1698, 1698, 1698, 1521, 1284, 1397, 1284, 1284, 1284, 1284,
179574 /* 10 */ 1521, 1521, 1521, 1284, 1284, 1284, 1284, 1284, 1284, 1427,
179575 /* 20 */ 1427, 1574, 1317, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179576 /* 30 */ 1284, 1284, 1284, 1284, 1284, 1520, 1284, 1284, 1284, 1284,
179577 /* 40 */ 1613, 1613, 1284, 1284, 1284, 1284, 1284, 1598, 1597, 1284,
179578 /* 50 */ 1284, 1284, 1436, 1284, 1284, 1284, 1443, 1284, 1284, 1284,
179579 /* 60 */ 1284, 1284, 1522, 1523, 1284, 1284, 1284, 1284, 1573, 1575,
179580 /* 70 */ 1538, 1450, 1449, 1448, 1447, 1556, 1415, 1441, 1434, 1438,
179581 /* 80 */ 1517, 1518, 1516, 1676, 1523, 1522, 1284, 1437, 1485, 1501,
179582 /* 90 */ 1484, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179583 /* 100 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179584 /* 110 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179585 /* 120 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179586 /* 130 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179587 /* 140 */ 1284, 1284, 1284, 1284, 1284, 1284, 1493, 1500, 1499, 1498,
179588 /* 150 */ 1507, 1497, 1494, 1487, 1486, 1488, 1489, 1308, 1305, 1359,
179589 /* 160 */ 1284, 1284, 1284, 1284, 1284, 1490, 1317, 1478, 1477, 1476,
179590 /* 170 */ 1284, 1504, 1491, 1503, 1502, 1581, 1650, 1649, 1539, 1284,
179591 /* 180 */ 1284, 1284, 1284, 1284, 1284, 1613, 1284, 1284, 1284, 1284,
179592 /* 190 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179593 /* 200 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1417, 1613,
179594 /* 210 */ 1613, 1284, 1317, 1613, 1613, 1313, 1418, 1418, 1313, 1313,
179595 /* 220 */ 1421, 1593, 1388, 1388, 1388, 1388, 1397, 1388, 1284, 1284,
179596 /* 230 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179597 /* 240 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1578, 1576, 1284,
179598 /* 250 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179599 /* 260 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179600 /* 270 */ 1284, 1284, 1284, 1284, 1284, 1284, 1393, 1284, 1284, 1284,
179601 /* 280 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1643, 1690, 1284,
179602 /* 290 */ 1551, 1373, 1393, 1393, 1393, 1393, 1395, 1374, 1372, 1387,
179603 /* 300 */ 1318, 1291, 1690, 1690, 1453, 1442, 1394, 1442, 1687, 1440,
179604 /* 310 */ 1453, 1453, 1440, 1453, 1394, 1687, 1334, 1665, 1329, 1427,
179605 /* 320 */ 1427, 1427, 1417, 1417, 1417, 1417, 1421, 1421, 1519, 1394,
179606 /* 330 */ 1387, 1284, 1360, 1690, 1360, 1360, 1403, 1403, 1689, 1689,
179607 /* 340 */ 1403, 1539, 1673, 1462, 1362, 1368, 1368, 1368, 1368, 1403,
179608 /* 350 */ 1302, 1440, 1673, 1673, 1440, 1462, 1362, 1440, 1362, 1440,
179609 /* 360 */ 1403, 1302, 1555, 1684, 1403, 1302, 1529, 1403, 1302, 1403,
179610 /* 370 */ 1302, 1529, 1360, 1360, 1360, 1349, 1284, 1284, 1529, 1360,
179611 /* 380 */ 1334, 1360, 1349, 1360, 1360, 1631, 1284, 1533, 1533, 1529,
179612 /* 390 */ 1403, 1623, 1623, 1430, 1430, 1435, 1421, 1524, 1403, 1284,
179613 /* 400 */ 1435, 1433, 1431, 1440, 1352, 1646, 1646, 1642, 1642, 1642,
179614 /* 410 */ 1695, 1695, 1593, 1658, 1317, 1317, 1317, 1317, 1658, 1336,
179615 /* 420 */ 1336, 1318, 1318, 1317, 1658, 1284, 1284, 1284, 1284, 1284,
179616 /* 430 */ 1284, 1284, 1653, 1284, 1284, 1540, 1407, 1284, 1284, 1284,
179617 /* 440 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179618 /* 450 */ 1284, 1284, 1284, 1599, 1284, 1284, 1284, 1284, 1284, 1284,
179619 /* 460 */ 1284, 1284, 1284, 1284, 1284, 1467, 1284, 1287, 1590, 1284,
179620 /* 470 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179621 /* 480 */ 1284, 1284, 1284, 1444, 1445, 1408, 1284, 1284, 1284, 1284,
179622 /* 490 */ 1284, 1284, 1284, 1459, 1284, 1284, 1284, 1454, 1284, 1284,
179623 /* 500 */ 1284, 1284, 1284, 1284, 1284, 1284, 1686, 1284, 1284, 1284,
179624 /* 510 */ 1284, 1284, 1284, 1554, 1553, 1284, 1284, 1405, 1284, 1284,
179625 /* 520 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179626 /* 530 */ 1284, 1332, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179627 /* 540 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179628 /* 550 */ 1284, 1284, 1284, 1284, 1284, 1432, 1284, 1284, 1284, 1284,
179629 /* 560 */ 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179630 /* 570 */ 1628, 1422, 1284, 1284, 1284, 1284, 1677, 1284, 1284, 1284,
179631 /* 580 */ 1284, 1382, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284,
179632 /* 590 */ 1284, 1284, 1669, 1376, 1468, 1284, 1471, 1306, 1284, 1296,
179633 /* 600 */ 1284, 1284,
179634 };
179635 /********** End of lemon-generated parsing tables *****************************/
179636
179637 /* The next table maps tokens (terminal symbols) into fallback tokens.
179638 ** If a construct like the following:
@@ -180213,38 +180097,37 @@
180213 /* 290 */ "trigger_time",
180214 /* 291 */ "trigger_event",
180215 /* 292 */ "foreach_clause",
180216 /* 293 */ "when_clause",
180217 /* 294 */ "trigger_cmd",
180218 /* 295 */ "trnm",
180219 /* 296 */ "tridxby",
180220 /* 297 */ "database_kw_opt",
180221 /* 298 */ "key_opt",
180222 /* 299 */ "alter_add",
180223 /* 300 */ "kwcolumn_opt",
180224 /* 301 */ "create_vtab",
180225 /* 302 */ "vtabarglist",
180226 /* 303 */ "vtabarg",
180227 /* 304 */ "vtabargtoken",
180228 /* 305 */ "lp",
180229 /* 306 */ "anylist",
180230 /* 307 */ "wqitem",
180231 /* 308 */ "wqas",
180232 /* 309 */ "withnm",
180233 /* 310 */ "windowdefn_list",
180234 /* 311 */ "windowdefn",
180235 /* 312 */ "window",
180236 /* 313 */ "frame_opt",
180237 /* 314 */ "part_opt",
180238 /* 315 */ "filter_clause",
180239 /* 316 */ "over_clause",
180240 /* 317 */ "range_or_rows",
180241 /* 318 */ "frame_bound",
180242 /* 319 */ "frame_bound_s",
180243 /* 320 */ "frame_bound_e",
180244 /* 321 */ "frame_exclude_opt",
180245 /* 322 */ "frame_exclude",
180246 };
180247 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
180248
180249 #ifndef NDEBUG
180250 /* For tracing reduce actions, the names of all rules are required.
@@ -180370,12 +180253,12 @@
180370 /* 117 */ "dbnm ::= DOT nm",
180371 /* 118 */ "fullname ::= nm",
180372 /* 119 */ "fullname ::= nm DOT nm",
180373 /* 120 */ "xfullname ::= nm",
180374 /* 121 */ "xfullname ::= nm DOT nm",
180375 /* 122 */ "xfullname ::= nm DOT nm AS nm",
180376 /* 123 */ "xfullname ::= nm AS nm",
180377 /* 124 */ "joinop ::= COMMA|JOIN",
180378 /* 125 */ "joinop ::= JOIN_KW JOIN",
180379 /* 126 */ "joinop ::= JOIN_KW nm JOIN",
180380 /* 127 */ "joinop ::= JOIN_KW nm nm JOIN",
180381 /* 128 */ "on_using ::= ON expr",
@@ -180520,152 +180403,150 @@
180520 /* 267 */ "trigger_event ::= UPDATE OF idlist",
180521 /* 268 */ "when_clause ::=",
180522 /* 269 */ "when_clause ::= WHEN expr",
180523 /* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
180524 /* 271 */ "trigger_cmd_list ::= trigger_cmd SEMI",
180525 /* 272 */ "trnm ::= nm DOT nm",
180526 /* 273 */ "tridxby ::= INDEXED BY nm",
180527 /* 274 */ "tridxby ::= NOT INDEXED",
180528 /* 275 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
180529 /* 276 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
180530 /* 277 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
180531 /* 278 */ "trigger_cmd ::= scanpt select scanpt",
180532 /* 279 */ "expr ::= RAISE LP IGNORE RP",
180533 /* 280 */ "expr ::= RAISE LP raisetype COMMA expr RP",
180534 /* 281 */ "raisetype ::= ROLLBACK",
180535 /* 282 */ "raisetype ::= ABORT",
180536 /* 283 */ "raisetype ::= FAIL",
180537 /* 284 */ "cmd ::= DROP TRIGGER ifexists fullname",
180538 /* 285 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
180539 /* 286 */ "cmd ::= DETACH database_kw_opt expr",
180540 /* 287 */ "key_opt ::=",
180541 /* 288 */ "key_opt ::= KEY expr",
180542 /* 289 */ "cmd ::= REINDEX",
180543 /* 290 */ "cmd ::= REINDEX nm dbnm",
180544 /* 291 */ "cmd ::= ANALYZE",
180545 /* 292 */ "cmd ::= ANALYZE nm dbnm",
180546 /* 293 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
180547 /* 294 */ "cmd ::= alter_add carglist",
180548 /* 295 */ "alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken",
180549 /* 296 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
180550 /* 297 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
180551 /* 298 */ "cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm",
180552 /* 299 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL",
180553 /* 300 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf",
180554 /* 301 */ "cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf",
180555 /* 302 */ "cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf",
180556 /* 303 */ "cmd ::= create_vtab",
180557 /* 304 */ "cmd ::= create_vtab LP vtabarglist RP",
180558 /* 305 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
180559 /* 306 */ "vtabarg ::=",
180560 /* 307 */ "vtabargtoken ::= ANY",
180561 /* 308 */ "vtabargtoken ::= lp anylist RP",
180562 /* 309 */ "lp ::= LP",
180563 /* 310 */ "with ::= WITH wqlist",
180564 /* 311 */ "with ::= WITH RECURSIVE wqlist",
180565 /* 312 */ "wqas ::= AS",
180566 /* 313 */ "wqas ::= AS MATERIALIZED",
180567 /* 314 */ "wqas ::= AS NOT MATERIALIZED",
180568 /* 315 */ "wqitem ::= withnm eidlist_opt wqas LP select RP",
180569 /* 316 */ "withnm ::= nm",
180570 /* 317 */ "wqlist ::= wqitem",
180571 /* 318 */ "wqlist ::= wqlist COMMA wqitem",
180572 /* 319 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
180573 /* 320 */ "windowdefn ::= nm AS LP window RP",
180574 /* 321 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
180575 /* 322 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
180576 /* 323 */ "window ::= ORDER BY sortlist frame_opt",
180577 /* 324 */ "window ::= nm ORDER BY sortlist frame_opt",
180578 /* 325 */ "window ::= nm frame_opt",
180579 /* 326 */ "frame_opt ::=",
180580 /* 327 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
180581 /* 328 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
180582 /* 329 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
180583 /* 330 */ "frame_bound_s ::= frame_bound",
180584 /* 331 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
180585 /* 332 */ "frame_bound_e ::= frame_bound",
180586 /* 333 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
180587 /* 334 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
180588 /* 335 */ "frame_bound ::= CURRENT ROW",
180589 /* 336 */ "frame_exclude_opt ::=",
180590 /* 337 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
180591 /* 338 */ "frame_exclude ::= NO OTHERS",
180592 /* 339 */ "frame_exclude ::= CURRENT ROW",
180593 /* 340 */ "frame_exclude ::= GROUP|TIES",
180594 /* 341 */ "window_clause ::= WINDOW windowdefn_list",
180595 /* 342 */ "filter_over ::= filter_clause over_clause",
180596 /* 343 */ "filter_over ::= over_clause",
180597 /* 344 */ "filter_over ::= filter_clause",
180598 /* 345 */ "over_clause ::= OVER LP window RP",
180599 /* 346 */ "over_clause ::= OVER nm",
180600 /* 347 */ "filter_clause ::= FILTER LP WHERE expr RP",
180601 /* 348 */ "term ::= QNUMBER",
180602 /* 349 */ "input ::= cmdlist",
180603 /* 350 */ "cmdlist ::= cmdlist ecmd",
180604 /* 351 */ "cmdlist ::= ecmd",
180605 /* 352 */ "ecmd ::= SEMI",
180606 /* 353 */ "ecmd ::= cmdx SEMI",
180607 /* 354 */ "ecmd ::= explain cmdx SEMI",
180608 /* 355 */ "trans_opt ::=",
180609 /* 356 */ "trans_opt ::= TRANSACTION",
180610 /* 357 */ "trans_opt ::= TRANSACTION nm",
180611 /* 358 */ "savepoint_opt ::= SAVEPOINT",
180612 /* 359 */ "savepoint_opt ::=",
180613 /* 360 */ "cmd ::= create_table create_table_args",
180614 /* 361 */ "table_option_set ::= table_option",
180615 /* 362 */ "columnlist ::= columnlist COMMA columnname carglist",
180616 /* 363 */ "columnlist ::= columnname carglist",
180617 /* 364 */ "nm ::= ID|INDEXED|JOIN_KW",
180618 /* 365 */ "nm ::= STRING",
180619 /* 366 */ "typetoken ::= typename",
180620 /* 367 */ "typename ::= ID|STRING",
180621 /* 368 */ "signed ::= plus_num",
180622 /* 369 */ "signed ::= minus_num",
180623 /* 370 */ "carglist ::= carglist ccons",
180624 /* 371 */ "carglist ::=",
180625 /* 372 */ "ccons ::= NULL onconf",
180626 /* 373 */ "ccons ::= GENERATED ALWAYS AS generated",
180627 /* 374 */ "ccons ::= AS generated",
180628 /* 375 */ "conslist_opt ::= COMMA conslist",
180629 /* 376 */ "conslist ::= conslist tconscomma tcons",
180630 /* 377 */ "conslist ::= tcons",
180631 /* 378 */ "tconscomma ::=",
180632 /* 379 */ "defer_subclause_opt ::= defer_subclause",
180633 /* 380 */ "resolvetype ::= raisetype",
180634 /* 381 */ "selectnowith ::= oneselect",
180635 /* 382 */ "oneselect ::= values",
180636 /* 383 */ "sclp ::= selcollist COMMA",
180637 /* 384 */ "as ::= ID|STRING",
180638 /* 385 */ "indexed_opt ::= indexed_by",
180639 /* 386 */ "returning ::=",
180640 /* 387 */ "expr ::= term",
180641 /* 388 */ "likeop ::= LIKE_KW|MATCH",
180642 /* 389 */ "case_operand ::= expr",
180643 /* 390 */ "exprlist ::= nexprlist",
180644 /* 391 */ "nmnum ::= plus_num",
180645 /* 392 */ "nmnum ::= nm",
180646 /* 393 */ "nmnum ::= ON",
180647 /* 394 */ "nmnum ::= DELETE",
180648 /* 395 */ "nmnum ::= DEFAULT",
180649 /* 396 */ "plus_num ::= INTEGER|FLOAT",
180650 /* 397 */ "foreach_clause ::=",
180651 /* 398 */ "foreach_clause ::= FOR EACH ROW",
180652 /* 399 */ "trnm ::= nm",
180653 /* 400 */ "tridxby ::=",
180654 /* 401 */ "database_kw_opt ::= DATABASE",
180655 /* 402 */ "database_kw_opt ::=",
180656 /* 403 */ "kwcolumn_opt ::=",
180657 /* 404 */ "kwcolumn_opt ::= COLUMNKW",
180658 /* 405 */ "vtabarglist ::= vtabarg",
180659 /* 406 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
180660 /* 407 */ "vtabarg ::= vtabarg vtabargtoken",
180661 /* 408 */ "anylist ::=",
180662 /* 409 */ "anylist ::= anylist LP anylist RP",
180663 /* 410 */ "anylist ::= anylist ANY",
180664 /* 411 */ "with ::=",
180665 /* 412 */ "windowdefn_list ::= windowdefn",
180666 /* 413 */ "window ::= frame_opt",
180667 };
180668 #endif /* NDEBUG */
180669
180670
180671 #if YYGROWABLESTACK
@@ -180800,11 +180681,11 @@
180800 case 241: /* selectnowith */
180801 case 242: /* oneselect */
180802 case 254: /* values */
180803 case 256: /* mvalues */
180804 {
180805 sqlite3SelectDelete(pParse->db, (yypminor->yy637));
180806 }
180807 break;
180808 case 218: /* term */
180809 case 219: /* expr */
180810 case 248: /* where_opt */
@@ -180812,14 +180693,14 @@
180812 case 270: /* where_opt_ret */
180813 case 281: /* case_operand */
180814 case 283: /* case_else */
180815 case 286: /* vinto */
180816 case 293: /* when_clause */
180817 case 298: /* key_opt */
180818 case 315: /* filter_clause */
180819 {
180820 sqlite3ExprDelete(pParse->db, (yypminor->yy590));
180821 }
180822 break;
180823 case 223: /* eidlist_opt */
180824 case 233: /* sortlist */
180825 case 234: /* eidlist */
@@ -180830,66 +180711,66 @@
180830 case 257: /* sclp */
180831 case 264: /* exprlist */
180832 case 271: /* setlist */
180833 case 280: /* paren_exprlist */
180834 case 282: /* case_exprlist */
180835 case 314: /* part_opt */
180836 {
180837 sqlite3ExprListDelete(pParse->db, (yypminor->yy402));
180838 }
180839 break;
180840 case 240: /* fullname */
180841 case 247: /* from */
180842 case 259: /* seltablist */
180843 case 260: /* stl_prefix */
180844 case 265: /* xfullname */
180845 {
180846 sqlite3SrcListDelete(pParse->db, (yypminor->yy563));
180847 }
180848 break;
180849 case 243: /* wqlist */
180850 {
180851 sqlite3WithDelete(pParse->db, (yypminor->yy125));
180852 }
180853 break;
180854 case 253: /* window_clause */
180855 case 310: /* windowdefn_list */
180856 {
180857 sqlite3WindowListDelete(pParse->db, (yypminor->yy483));
180858 }
180859 break;
180860 case 266: /* idlist */
180861 case 273: /* idlist_opt */
180862 {
180863 sqlite3IdListDelete(pParse->db, (yypminor->yy204));
180864 }
180865 break;
180866 case 276: /* filter_over */
180867 case 311: /* windowdefn */
180868 case 312: /* window */
180869 case 313: /* frame_opt */
180870 case 316: /* over_clause */
180871 {
180872 sqlite3WindowDelete(pParse->db, (yypminor->yy483));
180873 }
180874 break;
180875 case 289: /* trigger_cmd_list */
180876 case 294: /* trigger_cmd */
180877 {
180878 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy319));
180879 }
180880 break;
180881 case 291: /* trigger_event */
180882 {
180883 sqlite3IdListDelete(pParse->db, (yypminor->yy28).b);
180884 }
180885 break;
180886 case 318: /* frame_bound */
180887 case 319: /* frame_bound_s */
180888 case 320: /* frame_bound_e */
180889 {
180890 sqlite3ExprDelete(pParse->db, (yypminor->yy205).pExpr);
180891 }
180892 break;
180893 /********* End destructor definitions *****************************************/
180894 default: break; /* If no destructor action specified: do nothing */
180895 }
@@ -181311,12 +181192,12 @@
181311 202, /* (117) dbnm ::= DOT nm */
181312 240, /* (118) fullname ::= nm */
181313 240, /* (119) fullname ::= nm DOT nm */
181314 265, /* (120) xfullname ::= nm */
181315 265, /* (121) xfullname ::= nm DOT nm */
181316 265, /* (122) xfullname ::= nm DOT nm AS nm */
181317 265, /* (123) xfullname ::= nm AS nm */
181318 261, /* (124) joinop ::= COMMA|JOIN */
181319 261, /* (125) joinop ::= JOIN_KW JOIN */
181320 261, /* (126) joinop ::= JOIN_KW nm JOIN */
181321 261, /* (127) joinop ::= JOIN_KW nm nm JOIN */
181322 262, /* (128) on_using ::= ON expr */
@@ -181461,152 +181342,150 @@
181461 291, /* (267) trigger_event ::= UPDATE OF idlist */
181462 293, /* (268) when_clause ::= */
181463 293, /* (269) when_clause ::= WHEN expr */
181464 289, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
181465 289, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
181466 295, /* (272) trnm ::= nm DOT nm */
181467 296, /* (273) tridxby ::= INDEXED BY nm */
181468 296, /* (274) tridxby ::= NOT INDEXED */
181469 294, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
181470 294, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
181471 294, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
181472 294, /* (278) trigger_cmd ::= scanpt select scanpt */
181473 219, /* (279) expr ::= RAISE LP IGNORE RP */
181474 219, /* (280) expr ::= RAISE LP raisetype COMMA expr RP */
181475 238, /* (281) raisetype ::= ROLLBACK */
181476 238, /* (282) raisetype ::= ABORT */
181477 238, /* (283) raisetype ::= FAIL */
181478 192, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
181479 192, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181480 192, /* (286) cmd ::= DETACH database_kw_opt expr */
181481 298, /* (287) key_opt ::= */
181482 298, /* (288) key_opt ::= KEY expr */
181483 192, /* (289) cmd ::= REINDEX */
181484 192, /* (290) cmd ::= REINDEX nm dbnm */
181485 192, /* (291) cmd ::= ANALYZE */
181486 192, /* (292) cmd ::= ANALYZE nm dbnm */
181487 192, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
181488 192, /* (294) cmd ::= alter_add carglist */
181489 299, /* (295) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181490 192, /* (296) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181491 192, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181492 192, /* (298) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181493 192, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181494 192, /* (300) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181495 192, /* (301) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181496 192, /* (302) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181497 192, /* (303) cmd ::= create_vtab */
181498 192, /* (304) cmd ::= create_vtab LP vtabarglist RP */
181499 301, /* (305) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181500 303, /* (306) vtabarg ::= */
181501 304, /* (307) vtabargtoken ::= ANY */
181502 304, /* (308) vtabargtoken ::= lp anylist RP */
181503 305, /* (309) lp ::= LP */
181504 269, /* (310) with ::= WITH wqlist */
181505 269, /* (311) with ::= WITH RECURSIVE wqlist */
181506 308, /* (312) wqas ::= AS */
181507 308, /* (313) wqas ::= AS MATERIALIZED */
181508 308, /* (314) wqas ::= AS NOT MATERIALIZED */
181509 307, /* (315) wqitem ::= withnm eidlist_opt wqas LP select RP */
181510 309, /* (316) withnm ::= nm */
181511 243, /* (317) wqlist ::= wqitem */
181512 243, /* (318) wqlist ::= wqlist COMMA wqitem */
181513 310, /* (319) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181514 311, /* (320) windowdefn ::= nm AS LP window RP */
181515 312, /* (321) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181516 312, /* (322) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181517 312, /* (323) window ::= ORDER BY sortlist frame_opt */
181518 312, /* (324) window ::= nm ORDER BY sortlist frame_opt */
181519 312, /* (325) window ::= nm frame_opt */
181520 313, /* (326) frame_opt ::= */
181521 313, /* (327) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181522 313, /* (328) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181523 317, /* (329) range_or_rows ::= RANGE|ROWS|GROUPS */
181524 319, /* (330) frame_bound_s ::= frame_bound */
181525 319, /* (331) frame_bound_s ::= UNBOUNDED PRECEDING */
181526 320, /* (332) frame_bound_e ::= frame_bound */
181527 320, /* (333) frame_bound_e ::= UNBOUNDED FOLLOWING */
181528 318, /* (334) frame_bound ::= expr PRECEDING|FOLLOWING */
181529 318, /* (335) frame_bound ::= CURRENT ROW */
181530 321, /* (336) frame_exclude_opt ::= */
181531 321, /* (337) frame_exclude_opt ::= EXCLUDE frame_exclude */
181532 322, /* (338) frame_exclude ::= NO OTHERS */
181533 322, /* (339) frame_exclude ::= CURRENT ROW */
181534 322, /* (340) frame_exclude ::= GROUP|TIES */
181535 253, /* (341) window_clause ::= WINDOW windowdefn_list */
181536 276, /* (342) filter_over ::= filter_clause over_clause */
181537 276, /* (343) filter_over ::= over_clause */
181538 276, /* (344) filter_over ::= filter_clause */
181539 316, /* (345) over_clause ::= OVER LP window RP */
181540 316, /* (346) over_clause ::= OVER nm */
181541 315, /* (347) filter_clause ::= FILTER LP WHERE expr RP */
181542 218, /* (348) term ::= QNUMBER */
181543 187, /* (349) input ::= cmdlist */
181544 188, /* (350) cmdlist ::= cmdlist ecmd */
181545 188, /* (351) cmdlist ::= ecmd */
181546 189, /* (352) ecmd ::= SEMI */
181547 189, /* (353) ecmd ::= cmdx SEMI */
181548 189, /* (354) ecmd ::= explain cmdx SEMI */
181549 194, /* (355) trans_opt ::= */
181550 194, /* (356) trans_opt ::= TRANSACTION */
181551 194, /* (357) trans_opt ::= TRANSACTION nm */
181552 196, /* (358) savepoint_opt ::= SAVEPOINT */
181553 196, /* (359) savepoint_opt ::= */
181554 192, /* (360) cmd ::= create_table create_table_args */
181555 205, /* (361) table_option_set ::= table_option */
181556 203, /* (362) columnlist ::= columnlist COMMA columnname carglist */
181557 203, /* (363) columnlist ::= columnname carglist */
181558 195, /* (364) nm ::= ID|INDEXED|JOIN_KW */
181559 195, /* (365) nm ::= STRING */
181560 210, /* (366) typetoken ::= typename */
181561 211, /* (367) typename ::= ID|STRING */
181562 212, /* (368) signed ::= plus_num */
181563 212, /* (369) signed ::= minus_num */
181564 209, /* (370) carglist ::= carglist ccons */
181565 209, /* (371) carglist ::= */
181566 217, /* (372) ccons ::= NULL onconf */
181567 217, /* (373) ccons ::= GENERATED ALWAYS AS generated */
181568 217, /* (374) ccons ::= AS generated */
181569 204, /* (375) conslist_opt ::= COMMA conslist */
181570 230, /* (376) conslist ::= conslist tconscomma tcons */
181571 230, /* (377) conslist ::= tcons */
181572 231, /* (378) tconscomma ::= */
181573 235, /* (379) defer_subclause_opt ::= defer_subclause */
181574 237, /* (380) resolvetype ::= raisetype */
181575 241, /* (381) selectnowith ::= oneselect */
181576 242, /* (382) oneselect ::= values */
181577 257, /* (383) sclp ::= selcollist COMMA */
181578 258, /* (384) as ::= ID|STRING */
181579 267, /* (385) indexed_opt ::= indexed_by */
181580 275, /* (386) returning ::= */
181581 219, /* (387) expr ::= term */
181582 277, /* (388) likeop ::= LIKE_KW|MATCH */
181583 281, /* (389) case_operand ::= expr */
181584 264, /* (390) exprlist ::= nexprlist */
181585 287, /* (391) nmnum ::= plus_num */
181586 287, /* (392) nmnum ::= nm */
181587 287, /* (393) nmnum ::= ON */
181588 287, /* (394) nmnum ::= DELETE */
181589 287, /* (395) nmnum ::= DEFAULT */
181590 213, /* (396) plus_num ::= INTEGER|FLOAT */
181591 292, /* (397) foreach_clause ::= */
181592 292, /* (398) foreach_clause ::= FOR EACH ROW */
181593 295, /* (399) trnm ::= nm */
181594 296, /* (400) tridxby ::= */
181595 297, /* (401) database_kw_opt ::= DATABASE */
181596 297, /* (402) database_kw_opt ::= */
181597 300, /* (403) kwcolumn_opt ::= */
181598 300, /* (404) kwcolumn_opt ::= COLUMNKW */
181599 302, /* (405) vtabarglist ::= vtabarg */
181600 302, /* (406) vtabarglist ::= vtabarglist COMMA vtabarg */
181601 303, /* (407) vtabarg ::= vtabarg vtabargtoken */
181602 306, /* (408) anylist ::= */
181603 306, /* (409) anylist ::= anylist LP anylist RP */
181604 306, /* (410) anylist ::= anylist ANY */
181605 269, /* (411) with ::= */
181606 310, /* (412) windowdefn_list ::= windowdefn */
181607 312, /* (413) window ::= frame_opt */
181608 };
181609
181610 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
181611 ** of symbols on the right-hand side of that rule. */
181612 static const signed char yyRuleInfoNRhs[] = {
@@ -181730,12 +181609,12 @@
181730 -2, /* (117) dbnm ::= DOT nm */
181731 -1, /* (118) fullname ::= nm */
181732 -3, /* (119) fullname ::= nm DOT nm */
181733 -1, /* (120) xfullname ::= nm */
181734 -3, /* (121) xfullname ::= nm DOT nm */
181735 -5, /* (122) xfullname ::= nm DOT nm AS nm */
181736 -3, /* (123) xfullname ::= nm AS nm */
181737 -1, /* (124) joinop ::= COMMA|JOIN */
181738 -2, /* (125) joinop ::= JOIN_KW JOIN */
181739 -3, /* (126) joinop ::= JOIN_KW nm JOIN */
181740 -4, /* (127) joinop ::= JOIN_KW nm nm JOIN */
181741 -2, /* (128) on_using ::= ON expr */
@@ -181880,152 +181759,150 @@
181880 -3, /* (267) trigger_event ::= UPDATE OF idlist */
181881 0, /* (268) when_clause ::= */
181882 -2, /* (269) when_clause ::= WHEN expr */
181883 -3, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
181884 -2, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
181885 -3, /* (272) trnm ::= nm DOT nm */
181886 -3, /* (273) tridxby ::= INDEXED BY nm */
181887 -2, /* (274) tridxby ::= NOT INDEXED */
181888 -9, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
181889 -8, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
181890 -6, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
181891 -3, /* (278) trigger_cmd ::= scanpt select scanpt */
181892 -4, /* (279) expr ::= RAISE LP IGNORE RP */
181893 -6, /* (280) expr ::= RAISE LP raisetype COMMA expr RP */
181894 -1, /* (281) raisetype ::= ROLLBACK */
181895 -1, /* (282) raisetype ::= ABORT */
181896 -1, /* (283) raisetype ::= FAIL */
181897 -4, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
181898 -6, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181899 -3, /* (286) cmd ::= DETACH database_kw_opt expr */
181900 0, /* (287) key_opt ::= */
181901 -2, /* (288) key_opt ::= KEY expr */
181902 -1, /* (289) cmd ::= REINDEX */
181903 -3, /* (290) cmd ::= REINDEX nm dbnm */
181904 -1, /* (291) cmd ::= ANALYZE */
181905 -3, /* (292) cmd ::= ANALYZE nm dbnm */
181906 -6, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
181907 -2, /* (294) cmd ::= alter_add carglist */
181908 -7, /* (295) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181909 -6, /* (296) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181910 -8, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181911 -6, /* (298) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181912 -9, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181913 -10, /* (300) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181914 -11, /* (301) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181915 -9, /* (302) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181916 -1, /* (303) cmd ::= create_vtab */
181917 -4, /* (304) cmd ::= create_vtab LP vtabarglist RP */
181918 -8, /* (305) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181919 0, /* (306) vtabarg ::= */
181920 -1, /* (307) vtabargtoken ::= ANY */
181921 -3, /* (308) vtabargtoken ::= lp anylist RP */
181922 -1, /* (309) lp ::= LP */
181923 -2, /* (310) with ::= WITH wqlist */
181924 -3, /* (311) with ::= WITH RECURSIVE wqlist */
181925 -1, /* (312) wqas ::= AS */
181926 -2, /* (313) wqas ::= AS MATERIALIZED */
181927 -3, /* (314) wqas ::= AS NOT MATERIALIZED */
181928 -6, /* (315) wqitem ::= withnm eidlist_opt wqas LP select RP */
181929 -1, /* (316) withnm ::= nm */
181930 -1, /* (317) wqlist ::= wqitem */
181931 -3, /* (318) wqlist ::= wqlist COMMA wqitem */
181932 -3, /* (319) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181933 -5, /* (320) windowdefn ::= nm AS LP window RP */
181934 -5, /* (321) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181935 -6, /* (322) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181936 -4, /* (323) window ::= ORDER BY sortlist frame_opt */
181937 -5, /* (324) window ::= nm ORDER BY sortlist frame_opt */
181938 -2, /* (325) window ::= nm frame_opt */
181939 0, /* (326) frame_opt ::= */
181940 -3, /* (327) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181941 -6, /* (328) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181942 -1, /* (329) range_or_rows ::= RANGE|ROWS|GROUPS */
181943 -1, /* (330) frame_bound_s ::= frame_bound */
181944 -2, /* (331) frame_bound_s ::= UNBOUNDED PRECEDING */
181945 -1, /* (332) frame_bound_e ::= frame_bound */
181946 -2, /* (333) frame_bound_e ::= UNBOUNDED FOLLOWING */
181947 -2, /* (334) frame_bound ::= expr PRECEDING|FOLLOWING */
181948 -2, /* (335) frame_bound ::= CURRENT ROW */
181949 0, /* (336) frame_exclude_opt ::= */
181950 -2, /* (337) frame_exclude_opt ::= EXCLUDE frame_exclude */
181951 -2, /* (338) frame_exclude ::= NO OTHERS */
181952 -2, /* (339) frame_exclude ::= CURRENT ROW */
181953 -1, /* (340) frame_exclude ::= GROUP|TIES */
181954 -2, /* (341) window_clause ::= WINDOW windowdefn_list */
181955 -2, /* (342) filter_over ::= filter_clause over_clause */
181956 -1, /* (343) filter_over ::= over_clause */
181957 -1, /* (344) filter_over ::= filter_clause */
181958 -4, /* (345) over_clause ::= OVER LP window RP */
181959 -2, /* (346) over_clause ::= OVER nm */
181960 -5, /* (347) filter_clause ::= FILTER LP WHERE expr RP */
181961 -1, /* (348) term ::= QNUMBER */
181962 -1, /* (349) input ::= cmdlist */
181963 -2, /* (350) cmdlist ::= cmdlist ecmd */
181964 -1, /* (351) cmdlist ::= ecmd */
181965 -1, /* (352) ecmd ::= SEMI */
181966 -2, /* (353) ecmd ::= cmdx SEMI */
181967 -3, /* (354) ecmd ::= explain cmdx SEMI */
181968 0, /* (355) trans_opt ::= */
181969 -1, /* (356) trans_opt ::= TRANSACTION */
181970 -2, /* (357) trans_opt ::= TRANSACTION nm */
181971 -1, /* (358) savepoint_opt ::= SAVEPOINT */
181972 0, /* (359) savepoint_opt ::= */
181973 -2, /* (360) cmd ::= create_table create_table_args */
181974 -1, /* (361) table_option_set ::= table_option */
181975 -4, /* (362) columnlist ::= columnlist COMMA columnname carglist */
181976 -2, /* (363) columnlist ::= columnname carglist */
181977 -1, /* (364) nm ::= ID|INDEXED|JOIN_KW */
181978 -1, /* (365) nm ::= STRING */
181979 -1, /* (366) typetoken ::= typename */
181980 -1, /* (367) typename ::= ID|STRING */
181981 -1, /* (368) signed ::= plus_num */
181982 -1, /* (369) signed ::= minus_num */
181983 -2, /* (370) carglist ::= carglist ccons */
181984 0, /* (371) carglist ::= */
181985 -2, /* (372) ccons ::= NULL onconf */
181986 -4, /* (373) ccons ::= GENERATED ALWAYS AS generated */
181987 -2, /* (374) ccons ::= AS generated */
181988 -2, /* (375) conslist_opt ::= COMMA conslist */
181989 -3, /* (376) conslist ::= conslist tconscomma tcons */
181990 -1, /* (377) conslist ::= tcons */
181991 0, /* (378) tconscomma ::= */
181992 -1, /* (379) defer_subclause_opt ::= defer_subclause */
181993 -1, /* (380) resolvetype ::= raisetype */
181994 -1, /* (381) selectnowith ::= oneselect */
181995 -1, /* (382) oneselect ::= values */
181996 -2, /* (383) sclp ::= selcollist COMMA */
181997 -1, /* (384) as ::= ID|STRING */
181998 -1, /* (385) indexed_opt ::= indexed_by */
181999 0, /* (386) returning ::= */
182000 -1, /* (387) expr ::= term */
182001 -1, /* (388) likeop ::= LIKE_KW|MATCH */
182002 -1, /* (389) case_operand ::= expr */
182003 -1, /* (390) exprlist ::= nexprlist */
182004 -1, /* (391) nmnum ::= plus_num */
182005 -1, /* (392) nmnum ::= nm */
182006 -1, /* (393) nmnum ::= ON */
182007 -1, /* (394) nmnum ::= DELETE */
182008 -1, /* (395) nmnum ::= DEFAULT */
182009 -1, /* (396) plus_num ::= INTEGER|FLOAT */
182010 0, /* (397) foreach_clause ::= */
182011 -3, /* (398) foreach_clause ::= FOR EACH ROW */
182012 -1, /* (399) trnm ::= nm */
182013 0, /* (400) tridxby ::= */
182014 -1, /* (401) database_kw_opt ::= DATABASE */
182015 0, /* (402) database_kw_opt ::= */
182016 0, /* (403) kwcolumn_opt ::= */
182017 -1, /* (404) kwcolumn_opt ::= COLUMNKW */
182018 -1, /* (405) vtabarglist ::= vtabarg */
182019 -3, /* (406) vtabarglist ::= vtabarglist COMMA vtabarg */
182020 -2, /* (407) vtabarg ::= vtabarg vtabargtoken */
182021 0, /* (408) anylist ::= */
182022 -4, /* (409) anylist ::= anylist LP anylist RP */
182023 -2, /* (410) anylist ::= anylist ANY */
182024 0, /* (411) with ::= */
182025 -1, /* (412) windowdefn_list ::= windowdefn */
182026 -1, /* (413) window ::= frame_opt */
182027 };
182028
182029 static void yy_accept(yyParser*); /* Forward Declaration */
182030
182031 /*
@@ -182073,20 +181950,20 @@
182073 break;
182074 case 2: /* cmdx ::= cmd */
182075 { sqlite3FinishCoding(pParse); }
182076 break;
182077 case 3: /* cmd ::= BEGIN transtype trans_opt */
182078 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy502);}
182079 break;
182080 case 4: /* transtype ::= */
182081 {yymsp[1].minor.yy502 = TK_DEFERRED;}
182082 break;
182083 case 5: /* transtype ::= DEFERRED */
182084 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
182085 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
182086 case 329: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==329);
182087 {yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/}
182088 break;
182089 case 8: /* cmd ::= COMMIT|END trans_opt */
182090 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
182091 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
182092 break;
@@ -182105,11 +181982,11 @@
182105 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
182106 }
182107 break;
182108 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
182109 {
182110 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy502,0,0,yymsp[-2].minor.yy502);
182111 }
182112 break;
182113 case 14: /* createkw ::= CREATE */
182114 {
182115 disableLookaside(pParse);
@@ -182121,56 +181998,56 @@
182121 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
182122 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
182123 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
182124 case 100: /* distinct ::= */ yytestcase(yyruleno==100);
182125 case 246: /* collate ::= */ yytestcase(yyruleno==246);
182126 {yymsp[1].minor.yy502 = 0;}
182127 break;
182128 case 16: /* ifnotexists ::= IF NOT EXISTS */
182129 {yymsp[-2].minor.yy502 = 1;}
182130 break;
182131 case 17: /* temp ::= TEMP */
182132 {yymsp[0].minor.yy502 = pParse->db->init.busy==0;}
182133 break;
182134 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
182135 {
182136 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy9,0);
182137 }
182138 break;
182139 case 20: /* create_table_args ::= AS select */
182140 {
182141 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy637);
182142 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy637);
182143 }
182144 break;
182145 case 21: /* table_option_set ::= */
182146 {yymsp[1].minor.yy9 = 0;}
182147 break;
182148 case 22: /* table_option_set ::= table_option_set COMMA table_option */
182149 {yylhsminor.yy9 = yymsp[-2].minor.yy9|yymsp[0].minor.yy9;}
182150 yymsp[-2].minor.yy9 = yylhsminor.yy9;
182151 break;
182152 case 23: /* table_option ::= WITHOUT nm */
182153 {
182154 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
182155 yymsp[-1].minor.yy9 = TF_WithoutRowid | TF_NoVisibleRowid;
182156 }else{
182157 yymsp[-1].minor.yy9 = 0;
182158 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
182159 }
182160 }
182161 break;
182162 case 24: /* table_option ::= nm */
182163 {
182164 if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
182165 yylhsminor.yy9 = TF_Strict;
182166 }else{
182167 yylhsminor.yy9 = 0;
182168 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
182169 }
182170 }
182171 yymsp[0].minor.yy9 = yylhsminor.yy9;
182172 break;
182173 case 25: /* columnname ::= nm typetoken */
182174 {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
182175 break;
182176 case 26: /* typetoken ::= */
@@ -182192,11 +182069,11 @@
182192 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
182193 break;
182194 case 30: /* scanpt ::= */
182195 {
182196 assert( yyLookahead!=YYNOCODE );
182197 yymsp[1].minor.yy342 = yyLookaheadToken.z;
182198 }
182199 break;
182200 case 31: /* scantok ::= */
182201 {
182202 assert( yyLookahead!=YYNOCODE );
@@ -182206,21 +182083,21 @@
182206 case 32: /* ccons ::= CONSTRAINT nm */
182207 case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
182208 {ASSERT_IS_CREATE; pParse->u1.cr.constraintName = yymsp[0].minor.yy0;}
182209 break;
182210 case 33: /* ccons ::= DEFAULT scantok term */
182211 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy590,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182212 break;
182213 case 34: /* ccons ::= DEFAULT LP expr RP */
182214 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy590,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
182215 break;
182216 case 35: /* ccons ::= DEFAULT PLUS scantok term */
182217 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy590,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182218 break;
182219 case 36: /* ccons ::= DEFAULT MINUS scantok term */
182220 {
182221 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy590, 0);
182222 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
182223 }
182224 break;
182225 case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
182226 {
@@ -182231,262 +182108,262 @@
182231 }
182232 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
182233 }
182234 break;
182235 case 38: /* ccons ::= NOT NULL onconf */
182236 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy502);}
182237 break;
182238 case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
182239 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy502,yymsp[0].minor.yy502,yymsp[-2].minor.yy502);}
182240 break;
182241 case 40: /* ccons ::= UNIQUE onconf */
182242 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy502,0,0,0,0,
182243 SQLITE_IDXTYPE_UNIQUE);}
182244 break;
182245 case 41: /* ccons ::= CHECK LP expr RP */
182246 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy590,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
182247 break;
182248 case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
182249 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy402,yymsp[0].minor.yy502);}
182250 break;
182251 case 43: /* ccons ::= defer_subclause */
182252 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy502);}
182253 break;
182254 case 44: /* ccons ::= COLLATE ID|STRING */
182255 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
182256 break;
182257 case 45: /* generated ::= LP expr RP */
182258 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy590,0);}
182259 break;
182260 case 46: /* generated ::= LP expr RP ID */
182261 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy590,&yymsp[0].minor.yy0);}
182262 break;
182263 case 48: /* autoinc ::= AUTOINCR */
182264 {yymsp[0].minor.yy502 = 1;}
182265 break;
182266 case 49: /* refargs ::= */
182267 { yymsp[1].minor.yy502 = OE_None*0x0101; /* EV: R-19803-45884 */}
182268 break;
182269 case 50: /* refargs ::= refargs refarg */
182270 { yymsp[-1].minor.yy502 = (yymsp[-1].minor.yy502 & ~yymsp[0].minor.yy481.mask) | yymsp[0].minor.yy481.value; }
182271 break;
182272 case 51: /* refarg ::= MATCH nm */
182273 { yymsp[-1].minor.yy481.value = 0; yymsp[-1].minor.yy481.mask = 0x000000; }
182274 break;
182275 case 52: /* refarg ::= ON INSERT refact */
182276 { yymsp[-2].minor.yy481.value = 0; yymsp[-2].minor.yy481.mask = 0x000000; }
182277 break;
182278 case 53: /* refarg ::= ON DELETE refact */
182279 { yymsp[-2].minor.yy481.value = yymsp[0].minor.yy502; yymsp[-2].minor.yy481.mask = 0x0000ff; }
182280 break;
182281 case 54: /* refarg ::= ON UPDATE refact */
182282 { yymsp[-2].minor.yy481.value = yymsp[0].minor.yy502<<8; yymsp[-2].minor.yy481.mask = 0x00ff00; }
182283 break;
182284 case 55: /* refact ::= SET NULL */
182285 { yymsp[-1].minor.yy502 = OE_SetNull; /* EV: R-33326-45252 */}
182286 break;
182287 case 56: /* refact ::= SET DEFAULT */
182288 { yymsp[-1].minor.yy502 = OE_SetDflt; /* EV: R-33326-45252 */}
182289 break;
182290 case 57: /* refact ::= CASCADE */
182291 { yymsp[0].minor.yy502 = OE_Cascade; /* EV: R-33326-45252 */}
182292 break;
182293 case 58: /* refact ::= RESTRICT */
182294 { yymsp[0].minor.yy502 = OE_Restrict; /* EV: R-33326-45252 */}
182295 break;
182296 case 59: /* refact ::= NO ACTION */
182297 { yymsp[-1].minor.yy502 = OE_None; /* EV: R-33326-45252 */}
182298 break;
182299 case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
182300 {yymsp[-2].minor.yy502 = 0;}
182301 break;
182302 case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
182303 case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
182304 case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
182305 {yymsp[-1].minor.yy502 = yymsp[0].minor.yy502;}
182306 break;
182307 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
182308 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
182309 case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
182310 case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
182311 case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
182312 {yymsp[-1].minor.yy502 = 1;}
182313 break;
182314 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
182315 {yymsp[-1].minor.yy502 = 0;}
182316 break;
182317 case 66: /* tconscomma ::= COMMA */
182318 {ASSERT_IS_CREATE; pParse->u1.cr.constraintName.n = 0;}
182319 break;
182320 case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
182321 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy402,yymsp[0].minor.yy502,yymsp[-2].minor.yy502,0);}
182322 break;
182323 case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
182324 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy402,yymsp[0].minor.yy502,0,0,0,0,
182325 SQLITE_IDXTYPE_UNIQUE);}
182326 break;
182327 case 70: /* tcons ::= CHECK LP expr RP onconf */
182328 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy590,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
182329 break;
182330 case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
182331 {
182332 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy402, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy402, yymsp[-1].minor.yy502);
182333 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy502);
182334 }
182335 break;
182336 case 73: /* onconf ::= */
182337 case 75: /* orconf ::= */ yytestcase(yyruleno==75);
182338 {yymsp[1].minor.yy502 = OE_Default;}
182339 break;
182340 case 74: /* onconf ::= ON CONFLICT resolvetype */
182341 {yymsp[-2].minor.yy502 = yymsp[0].minor.yy502;}
182342 break;
182343 case 77: /* resolvetype ::= IGNORE */
182344 {yymsp[0].minor.yy502 = OE_Ignore;}
182345 break;
182346 case 78: /* resolvetype ::= REPLACE */
182347 case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
182348 {yymsp[0].minor.yy502 = OE_Replace;}
182349 break;
182350 case 79: /* cmd ::= DROP TABLE ifexists fullname */
182351 {
182352 sqlite3DropTable(pParse, yymsp[0].minor.yy563, 0, yymsp[-1].minor.yy502);
182353 }
182354 break;
182355 case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
182356 {
182357 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy402, yymsp[0].minor.yy637, yymsp[-7].minor.yy502, yymsp[-5].minor.yy502);
182358 }
182359 break;
182360 case 83: /* cmd ::= DROP VIEW ifexists fullname */
182361 {
182362 sqlite3DropTable(pParse, yymsp[0].minor.yy563, 1, yymsp[-1].minor.yy502);
182363 }
182364 break;
182365 case 84: /* cmd ::= select */
182366 {
182367 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
182368 if( (pParse->db->mDbFlags & DBFLAG_EncodingFixed)!=0
182369 || sqlite3ReadSchema(pParse)==SQLITE_OK
182370 ){
182371 sqlite3Select(pParse, yymsp[0].minor.yy637, &dest);
182372 }
182373 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy637);
182374 }
182375 break;
182376 case 85: /* select ::= WITH wqlist selectnowith */
182377 {yymsp[-2].minor.yy637 = attachWithToSelect(pParse,yymsp[0].minor.yy637,yymsp[-1].minor.yy125);}
182378 break;
182379 case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
182380 {yymsp[-3].minor.yy637 = attachWithToSelect(pParse,yymsp[0].minor.yy637,yymsp[-1].minor.yy125);}
182381 break;
182382 case 87: /* select ::= selectnowith */
182383 {
182384 Select *p = yymsp[0].minor.yy637;
182385 if( p ){
182386 parserDoubleLinkSelect(pParse, p);
182387 }
182388 }
182389 break;
182390 case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
182391 {
182392 Select *pRhs = yymsp[0].minor.yy637;
182393 Select *pLhs = yymsp[-2].minor.yy637;
182394 if( pRhs && pRhs->pPrior ){
182395 SrcList *pFrom;
182396 Token x;
182397 x.n = 0;
182398 parserDoubleLinkSelect(pParse, pRhs);
182399 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0);
182400 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
182401 }
182402 if( pRhs ){
182403 pRhs->op = (u8)yymsp[-1].minor.yy502;
182404 pRhs->pPrior = pLhs;
182405 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~(u32)SF_MultiValue;
182406 pRhs->selFlags &= ~(u32)SF_MultiValue;
182407 if( yymsp[-1].minor.yy502!=TK_ALL ) pParse->hasCompound = 1;
182408 }else{
182409 sqlite3SelectDelete(pParse->db, pLhs);
182410 }
182411 yymsp[-2].minor.yy637 = pRhs;
182412 }
182413 break;
182414 case 89: /* multiselect_op ::= UNION */
182415 case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
182416 {yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-OP*/}
182417 break;
182418 case 90: /* multiselect_op ::= UNION ALL */
182419 {yymsp[-1].minor.yy502 = TK_ALL;}
182420 break;
182421 case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
182422 {
182423 yymsp[-8].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy402,yymsp[-5].minor.yy563,yymsp[-4].minor.yy590,yymsp[-3].minor.yy402,yymsp[-2].minor.yy590,yymsp[-1].minor.yy402,yymsp[-7].minor.yy502,yymsp[0].minor.yy590);
182424 }
182425 break;
182426 case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
182427 {
182428 yymsp[-9].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy402,yymsp[-6].minor.yy563,yymsp[-5].minor.yy590,yymsp[-4].minor.yy402,yymsp[-3].minor.yy590,yymsp[-1].minor.yy402,yymsp[-8].minor.yy502,yymsp[0].minor.yy590);
182429 if( yymsp[-9].minor.yy637 ){
182430 yymsp[-9].minor.yy637->pWinDefn = yymsp[-2].minor.yy483;
182431 }else{
182432 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy483);
182433 }
182434 }
182435 break;
182436 case 94: /* values ::= VALUES LP nexprlist RP */
182437 {
182438 yymsp[-3].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy402,0,0,0,0,0,SF_Values,0);
182439 }
182440 break;
182441 case 95: /* oneselect ::= mvalues */
182442 {
182443 sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy637);
182444 }
182445 break;
182446 case 96: /* mvalues ::= values COMMA LP nexprlist RP */
182447 case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
182448 {
182449 yymsp[-4].minor.yy637 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy637, yymsp[-1].minor.yy402);
182450 }
182451 break;
182452 case 98: /* distinct ::= DISTINCT */
182453 {yymsp[0].minor.yy502 = SF_Distinct;}
182454 break;
182455 case 99: /* distinct ::= ALL */
182456 {yymsp[0].minor.yy502 = SF_All;}
182457 break;
182458 case 101: /* sclp ::= */
182459 case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
182460 case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144);
182461 case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
182462 case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
182463 case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
182464 {yymsp[1].minor.yy402 = 0;}
182465 break;
182466 case 102: /* selcollist ::= sclp scanpt expr scanpt as */
182467 {
182468 yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy402, yymsp[-2].minor.yy590);
182469 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy402, &yymsp[0].minor.yy0, 1);
182470 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy402,yymsp[-3].minor.yy342,yymsp[-1].minor.yy342);
182471 }
182472 break;
182473 case 103: /* selcollist ::= sclp scanpt STAR */
182474 {
182475 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
182476 sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
182477 yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy402, p);
182478 }
182479 break;
182480 case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
182481 {
182482 Expr *pRight, *pLeft, *pDot;
182483 pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
182484 sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
182485 pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
182486 pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
182487 yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, pDot);
182488 }
182489 break;
182490 case 105: /* as ::= AS nm */
182491 case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117);
182492 case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258);
@@ -182493,54 +182370,54 @@
182493 case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259);
182494 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
182495 break;
182496 case 107: /* from ::= */
182497 case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
182498 {yymsp[1].minor.yy563 = 0;}
182499 break;
182500 case 108: /* from ::= FROM seltablist */
182501 {
182502 yymsp[-1].minor.yy563 = yymsp[0].minor.yy563;
182503 sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy563);
182504 }
182505 break;
182506 case 109: /* stl_prefix ::= seltablist joinop */
182507 {
182508 if( ALWAYS(yymsp[-1].minor.yy563 && yymsp[-1].minor.yy563->nSrc>0) ) yymsp[-1].minor.yy563->a[yymsp[-1].minor.yy563->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy502;
182509 }
182510 break;
182511 case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
182512 {
182513 yymsp[-4].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy563,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
182514 }
182515 break;
182516 case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
182517 {
182518 yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy421);
182519 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy563, &yymsp[-1].minor.yy0);
182520 }
182521 break;
182522 case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
182523 {
182524 yymsp[-7].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy563,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
182525 sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy563, yymsp[-3].minor.yy402);
182526 }
182527 break;
182528 case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
182529 {
182530 yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy637,&yymsp[0].minor.yy421);
182531 }
182532 break;
182533 case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
182534 {
182535 if( yymsp[-5].minor.yy563==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy421.pOn==0 && yymsp[0].minor.yy421.pUsing==0 ){
182536 yymsp[-5].minor.yy563 = yymsp[-3].minor.yy563;
182537 }else if( ALWAYS(yymsp[-3].minor.yy563!=0) && yymsp[-3].minor.yy563->nSrc==1 ){
182538 yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
182539 if( yymsp[-5].minor.yy563 ){
182540 SrcItem *pNew = &yymsp[-5].minor.yy563->a[yymsp[-5].minor.yy563->nSrc-1];
182541 SrcItem *pOld = yymsp[-3].minor.yy563->a;
182542 assert( pOld->fg.fixedSchema==0 );
182543 pNew->zName = pOld->zName;
182544 assert( pOld->fg.fixedSchema==0 );
182545 if( pOld->fg.isSubquery ){
182546 pNew->fg.isSubquery = 1;
@@ -182561,249 +182438,259 @@
182561 pOld->fg.isTabFunc = 0;
182562 pNew->fg.isTabFunc = 1;
182563 }
182564 pOld->zName = 0;
182565 }
182566 sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy563);
182567 }else{
182568 Select *pSubquery;
182569 sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy563);
182570 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy563,0,0,0,0,SF_NestedFrom,0);
182571 yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy421);
182572 }
182573 }
182574 break;
182575 case 116: /* dbnm ::= */
182576 case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131);
182577 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
182578 break;
182579 case 118: /* fullname ::= nm */
 
182580 {
182581 yylhsminor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
182582 if( IN_RENAME_OBJECT && yylhsminor.yy563 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy563->a[0].zName, &yymsp[0].minor.yy0);
182583 }
182584 yymsp[0].minor.yy563 = yylhsminor.yy563;
182585 break;
182586 case 119: /* fullname ::= nm DOT nm */
182587 {
182588 yylhsminor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
182589 if( IN_RENAME_OBJECT && yylhsminor.yy563 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy563->a[0].zName, &yymsp[0].minor.yy0);
182590 }
182591 yymsp[-2].minor.yy563 = yylhsminor.yy563;
182592 break;
182593 case 120: /* xfullname ::= nm */
182594 {yymsp[0].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
182595 break;
182596 case 121: /* xfullname ::= nm DOT nm */
182597 {yymsp[-2].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
182598 break;
182599 case 122: /* xfullname ::= nm DOT nm AS nm */
182600 {
182601 yymsp[-4].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
182602 if( yymsp[-4].minor.yy563 ) yymsp[-4].minor.yy563->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182603 }
182604 break;
182605 case 123: /* xfullname ::= nm AS nm */
182606 {
182607 yymsp[-2].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
182608 if( yymsp[-2].minor.yy563 ) yymsp[-2].minor.yy563->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182609 }
 
 
 
 
 
 
 
 
 
182610 break;
182611 case 124: /* joinop ::= COMMA|JOIN */
182612 { yymsp[0].minor.yy502 = JT_INNER; }
182613 break;
182614 case 125: /* joinop ::= JOIN_KW JOIN */
182615 {yymsp[-1].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
182616 break;
182617 case 126: /* joinop ::= JOIN_KW nm JOIN */
182618 {yymsp[-2].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
182619 break;
182620 case 127: /* joinop ::= JOIN_KW nm nm JOIN */
182621 {yymsp[-3].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
182622 break;
182623 case 128: /* on_using ::= ON expr */
182624 {yymsp[-1].minor.yy421.pOn = yymsp[0].minor.yy590; yymsp[-1].minor.yy421.pUsing = 0;}
182625 break;
182626 case 129: /* on_using ::= USING LP idlist RP */
182627 {yymsp[-3].minor.yy421.pOn = 0; yymsp[-3].minor.yy421.pUsing = yymsp[-1].minor.yy204;}
182628 break;
182629 case 130: /* on_using ::= */
182630 {yymsp[1].minor.yy421.pOn = 0; yymsp[1].minor.yy421.pUsing = 0;}
182631 break;
182632 case 132: /* indexed_by ::= INDEXED BY nm */
182633 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
182634 break;
182635 case 133: /* indexed_by ::= NOT INDEXED */
182636 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
182637 break;
182638 case 135: /* orderby_opt ::= ORDER BY sortlist */
182639 case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
182640 {yymsp[-2].minor.yy402 = yymsp[0].minor.yy402;}
182641 break;
182642 case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
182643 {
182644 yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402,yymsp[-2].minor.yy590);
182645 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy402,yymsp[-1].minor.yy502,yymsp[0].minor.yy502);
182646 }
182647 break;
182648 case 137: /* sortlist ::= expr sortorder nulls */
182649 {
182650 yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy590); /*A-overwrites-Y*/
182651 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy402,yymsp[-1].minor.yy502,yymsp[0].minor.yy502);
182652 }
182653 break;
182654 case 138: /* sortorder ::= ASC */
182655 {yymsp[0].minor.yy502 = SQLITE_SO_ASC;}
182656 break;
182657 case 139: /* sortorder ::= DESC */
182658 {yymsp[0].minor.yy502 = SQLITE_SO_DESC;}
182659 break;
182660 case 140: /* sortorder ::= */
182661 case 143: /* nulls ::= */ yytestcase(yyruleno==143);
182662 {yymsp[1].minor.yy502 = SQLITE_SO_UNDEFINED;}
182663 break;
182664 case 141: /* nulls ::= NULLS FIRST */
182665 {yymsp[-1].minor.yy502 = SQLITE_SO_ASC;}
182666 break;
182667 case 142: /* nulls ::= NULLS LAST */
182668 {yymsp[-1].minor.yy502 = SQLITE_SO_DESC;}
182669 break;
182670 case 146: /* having_opt ::= */
182671 case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
182672 case 153: /* where_opt ::= */ yytestcase(yyruleno==153);
182673 case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155);
182674 case 232: /* case_else ::= */ yytestcase(yyruleno==232);
182675 case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
182676 case 252: /* vinto ::= */ yytestcase(yyruleno==252);
182677 {yymsp[1].minor.yy590 = 0;}
182678 break;
182679 case 147: /* having_opt ::= HAVING expr */
182680 case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
182681 case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
182682 case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
182683 case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
182684 {yymsp[-1].minor.yy590 = yymsp[0].minor.yy590;}
182685 break;
182686 case 149: /* limit_opt ::= LIMIT expr */
182687 {yymsp[-1].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy590,0);}
182688 break;
182689 case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
182690 {yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
182691 break;
182692 case 151: /* limit_opt ::= LIMIT expr COMMA expr */
182693 {yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy590,yymsp[-2].minor.yy590);}
182694 break;
182695 case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
182696 {
182697 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy563, &yymsp[-1].minor.yy0);
182698 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy563,yymsp[0].minor.yy590,0,0);
182699 }
182700 break;
182701 case 157: /* where_opt_ret ::= RETURNING selcollist */
182702 {sqlite3AddReturning(pParse,yymsp[0].minor.yy402); yymsp[-1].minor.yy590 = 0;}
182703 break;
182704 case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
182705 {sqlite3AddReturning(pParse,yymsp[0].minor.yy402); yymsp[-3].minor.yy590 = yymsp[-2].minor.yy590;}
182706 break;
182707 case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
182708 {
182709 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy563, &yymsp[-4].minor.yy0);
182710 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy402,"set list");
182711 if( yymsp[-1].minor.yy563 ){
182712 SrcList *pFromClause = yymsp[-1].minor.yy563;
182713 if( pFromClause->nSrc>1 ){
182714 Select *pSubquery;
182715 Token as;
182716 pSubquery = sqlite3SelectNew(pParse,0,pFromClause,0,0,0,0,SF_NestedFrom,0);
182717 as.n = 0;
182718 as.z = 0;
182719 pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
182720 }
182721 yymsp[-5].minor.yy563 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy563, pFromClause);
182722 }
182723 sqlite3Update(pParse,yymsp[-5].minor.yy563,yymsp[-2].minor.yy402,yymsp[0].minor.yy590,yymsp[-6].minor.yy502,0,0,0);
182724 }
182725 break;
182726 case 160: /* setlist ::= setlist COMMA nm EQ expr */
182727 {
182728 yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy402, yymsp[0].minor.yy590);
182729 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy402, &yymsp[-2].minor.yy0, 1);
182730 }
182731 break;
182732 case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
182733 {
182734 yymsp[-6].minor.yy402 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy402, yymsp[-3].minor.yy204, yymsp[0].minor.yy590);
182735 }
182736 break;
182737 case 162: /* setlist ::= nm EQ expr */
182738 {
182739 yylhsminor.yy402 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy590);
182740 sqlite3ExprListSetName(pParse, yylhsminor.yy402, &yymsp[-2].minor.yy0, 1);
182741 }
182742 yymsp[-2].minor.yy402 = yylhsminor.yy402;
182743 break;
182744 case 163: /* setlist ::= LP idlist RP EQ expr */
182745 {
182746 yymsp[-4].minor.yy402 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy204, yymsp[0].minor.yy590);
182747 }
182748 break;
182749 case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
182750 {
182751 sqlite3Insert(pParse, yymsp[-3].minor.yy563, yymsp[-1].minor.yy637, yymsp[-2].minor.yy204, yymsp[-5].minor.yy502, yymsp[0].minor.yy403);
182752 }
182753 break;
182754 case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
182755 {
182756 sqlite3Insert(pParse, yymsp[-4].minor.yy563, 0, yymsp[-3].minor.yy204, yymsp[-6].minor.yy502, 0);
182757 }
182758 break;
182759 case 166: /* upsert ::= */
182760 { yymsp[1].minor.yy403 = 0; }
182761 break;
182762 case 167: /* upsert ::= RETURNING selcollist */
182763 { yymsp[-1].minor.yy403 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy402); }
182764 break;
182765 case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
182766 { yymsp[-11].minor.yy403 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy402,yymsp[-6].minor.yy590,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590,yymsp[0].minor.yy403);}
182767 break;
182768 case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
182769 { yymsp[-8].minor.yy403 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy402,yymsp[-3].minor.yy590,0,0,yymsp[0].minor.yy403); }
182770 break;
182771 case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
182772 { yymsp[-4].minor.yy403 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
182773 break;
182774 case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
182775 { yymsp[-7].minor.yy403 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590,0);}
182776 break;
182777 case 172: /* returning ::= RETURNING selcollist */
182778 {sqlite3AddReturning(pParse,yymsp[0].minor.yy402);}
182779 break;
182780 case 175: /* idlist_opt ::= */
182781 {yymsp[1].minor.yy204 = 0;}
182782 break;
182783 case 176: /* idlist_opt ::= LP idlist RP */
182784 {yymsp[-2].minor.yy204 = yymsp[-1].minor.yy204;}
182785 break;
182786 case 177: /* idlist ::= idlist COMMA nm */
182787 {yymsp[-2].minor.yy204 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy204,&yymsp[0].minor.yy0);}
182788 break;
182789 case 178: /* idlist ::= nm */
182790 {yymsp[0].minor.yy204 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
182791 break;
182792 case 179: /* expr ::= LP expr RP */
182793 {yymsp[-2].minor.yy590 = yymsp[-1].minor.yy590;}
182794 break;
182795 case 180: /* expr ::= ID|INDEXED|JOIN_KW */
182796 {yymsp[0].minor.yy590=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182797 break;
182798 case 181: /* expr ::= nm DOT nm */
182799 {
182800 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
182801 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
182802 yylhsminor.yy590 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
182803 }
182804 yymsp[-2].minor.yy590 = yylhsminor.yy590;
182805 break;
182806 case 182: /* expr ::= nm DOT nm DOT nm */
182807 {
182808 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
182809 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
@@ -182810,236 +182697,237 @@
182810 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
182811 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
182812 if( IN_RENAME_OBJECT ){
182813 sqlite3RenameTokenRemap(pParse, 0, temp1);
182814 }
182815 yylhsminor.yy590 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
182816 }
182817 yymsp[-4].minor.yy590 = yylhsminor.yy590;
182818 break;
182819 case 183: /* term ::= NULL|FLOAT|BLOB */
182820 case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
182821 {yymsp[0].minor.yy590=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182822 break;
182823 case 185: /* term ::= INTEGER */
182824 {
182825 yylhsminor.yy590 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
182826 if( yylhsminor.yy590 ) yylhsminor.yy590->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
 
 
 
 
 
182827 }
182828 yymsp[0].minor.yy590 = yylhsminor.yy590;
182829 break;
182830 case 186: /* expr ::= VARIABLE */
182831 {
182832 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
182833 u32 n = yymsp[0].minor.yy0.n;
182834 yymsp[0].minor.yy590 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
182835 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy590, n);
182836 }else{
182837 /* When doing a nested parse, one can include terms in an expression
182838 ** that look like this: #1 #2 ... These terms refer to registers
182839 ** in the virtual machine. #N is the N-th register. */
182840 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
182841 assert( t.n>=2 );
182842 if( pParse->nested==0 ){
182843 parserSyntaxError(pParse, &t);
182844 yymsp[0].minor.yy590 = 0;
182845 }else{
182846 yymsp[0].minor.yy590 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
182847 if( yymsp[0].minor.yy590 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy590->iTable);
182848 }
182849 }
182850 }
182851 break;
182852 case 187: /* expr ::= expr COLLATE ID|STRING */
182853 {
182854 yymsp[-2].minor.yy590 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy590, &yymsp[0].minor.yy0, 1);
182855 }
182856 break;
182857 case 188: /* expr ::= CAST LP expr AS typetoken RP */
182858 {
182859 yymsp[-5].minor.yy590 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
182860 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy590, yymsp[-3].minor.yy590, 0);
182861 }
182862 break;
182863 case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
182864 {
182865 yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy402, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy502);
182866 }
182867 yymsp[-4].minor.yy590 = yylhsminor.yy590;
182868 break;
182869 case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
182870 {
182871 yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy402, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy502);
182872 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy590, yymsp[-1].minor.yy402);
182873 }
182874 yymsp[-7].minor.yy590 = yylhsminor.yy590;
182875 break;
182876 case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
182877 {
182878 yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
182879 }
182880 yymsp[-3].minor.yy590 = yylhsminor.yy590;
182881 break;
182882 case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
182883 {
182884 yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy402, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy502);
182885 sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
182886 }
182887 yymsp[-5].minor.yy590 = yylhsminor.yy590;
182888 break;
182889 case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
182890 {
182891 yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy402, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy502);
182892 sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
182893 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy590, yymsp[-2].minor.yy402);
182894 }
182895 yymsp[-8].minor.yy590 = yylhsminor.yy590;
182896 break;
182897 case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
182898 {
182899 yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
182900 sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
182901 }
182902 yymsp[-4].minor.yy590 = yylhsminor.yy590;
182903 break;
182904 case 195: /* term ::= CTIME_KW */
182905 {
182906 yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
182907 }
182908 yymsp[0].minor.yy590 = yylhsminor.yy590;
182909 break;
182910 case 196: /* expr ::= LP nexprlist COMMA expr RP */
182911 {
182912 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy402, yymsp[-1].minor.yy590);
182913 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
182914 if( yymsp[-4].minor.yy590 ){
182915 yymsp[-4].minor.yy590->x.pList = pList;
182916 if( ALWAYS(pList->nExpr) ){
182917 yymsp[-4].minor.yy590->flags |= pList->a[0].pExpr->flags & EP_Propagate;
182918 }
182919 }else{
182920 sqlite3ExprListDelete(pParse->db, pList);
182921 }
182922 }
182923 break;
182924 case 197: /* expr ::= expr AND expr */
182925 {yymsp[-2].minor.yy590=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
182926 break;
182927 case 198: /* expr ::= expr OR expr */
182928 case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
182929 case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200);
182930 case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201);
182931 case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
182932 case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
182933 case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
182934 {yymsp[-2].minor.yy590=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
182935 break;
182936 case 205: /* likeop ::= NOT LIKE_KW|MATCH */
182937 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
182938 break;
182939 case 206: /* expr ::= expr likeop expr */
182940 {
182941 ExprList *pList;
182942 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
182943 yymsp[-1].minor.yy0.n &= 0x7fffffff;
182944 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy590);
182945 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy590);
182946 yymsp[-2].minor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
182947 if( bNot ) yymsp[-2].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy590, 0);
182948 if( yymsp[-2].minor.yy590 ) yymsp[-2].minor.yy590->flags |= EP_InfixFunc;
182949 }
182950 break;
182951 case 207: /* expr ::= expr likeop expr ESCAPE expr */
182952 {
182953 ExprList *pList;
182954 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
182955 yymsp[-3].minor.yy0.n &= 0x7fffffff;
182956 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
182957 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy590);
182958 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy590);
182959 yymsp[-4].minor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
182960 if( bNot ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
182961 if( yymsp[-4].minor.yy590 ) yymsp[-4].minor.yy590->flags |= EP_InfixFunc;
182962 }
182963 break;
182964 case 208: /* expr ::= expr ISNULL|NOTNULL */
182965 {yymsp[-1].minor.yy590 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy590,0);}
182966 break;
182967 case 209: /* expr ::= expr NOT NULL */
182968 {yymsp[-2].minor.yy590 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy590,0);}
182969 break;
182970 case 210: /* expr ::= expr IS expr */
182971 {
182972 yymsp[-2].minor.yy590 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);
182973 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-2].minor.yy590, TK_ISNULL);
182974 }
182975 break;
182976 case 211: /* expr ::= expr IS NOT expr */
182977 {
182978 yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy590,yymsp[0].minor.yy590);
182979 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-3].minor.yy590, TK_NOTNULL);
182980 }
182981 break;
182982 case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
182983 {
182984 yymsp[-5].minor.yy590 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy590,yymsp[0].minor.yy590);
182985 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-5].minor.yy590, TK_ISNULL);
182986 }
182987 break;
182988 case 213: /* expr ::= expr IS DISTINCT FROM expr */
182989 {
182990 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy590,yymsp[0].minor.yy590);
182991 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-4].minor.yy590, TK_NOTNULL);
182992 }
182993 break;
182994 case 214: /* expr ::= NOT expr */
182995 case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
182996 {yymsp[-1].minor.yy590 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy590, 0);/*A-overwrites-B*/}
182997 break;
182998 case 216: /* expr ::= PLUS|MINUS expr */
182999 {
183000 Expr *p = yymsp[0].minor.yy590;
183001 u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
183002 assert( TK_UPLUS>TK_PLUS );
183003 assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
183004 if( p && p->op==TK_UPLUS ){
183005 p->op = op;
183006 yymsp[-1].minor.yy590 = p;
183007 }else{
183008 yymsp[-1].minor.yy590 = sqlite3PExpr(pParse, op, p, 0);
183009 /*A-overwrites-B*/
183010 }
183011 }
183012 break;
183013 case 217: /* expr ::= expr PTR expr */
183014 {
183015 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy590);
183016 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy590);
183017 yylhsminor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
183018 }
183019 yymsp[-2].minor.yy590 = yylhsminor.yy590;
183020 break;
183021 case 218: /* between_op ::= BETWEEN */
183022 case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
183023 {yymsp[0].minor.yy502 = 0;}
183024 break;
183025 case 220: /* expr ::= expr between_op expr AND expr */
183026 {
183027 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
183028 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy590);
183029 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy590, 0);
183030 if( yymsp[-4].minor.yy590 ){
183031 yymsp[-4].minor.yy590->x.pList = pList;
183032 }else{
183033 sqlite3ExprListDelete(pParse->db, pList);
183034 }
183035 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
183036 }
183037 break;
183038 case 223: /* expr ::= expr in_op LP exprlist RP */
183039 {
183040 if( yymsp[-1].minor.yy402==0 ){
183041 /* Expressions of the form
183042 **
183043 ** expr1 IN ()
183044 ** expr1 NOT IN ()
183045 **
@@ -183048,149 +182936,149 @@
183048 ** Except, do not apply this optimization if expr1 contains a function
183049 ** because that function might be an aggregate (we don't know yet whether
183050 ** it is or not) and if it is an aggregate, that could change the meaning
183051 ** of the whole query.
183052 */
183053 Expr *pB = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy502 ? "true" : "false");
183054 if( pB ) sqlite3ExprIdToTrueFalse(pB);
183055 if( !ExprHasProperty(yymsp[-4].minor.yy590, EP_HasFunc) ){
183056 sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy590);
183057 yymsp[-4].minor.yy590 = pB;
183058 }else{
183059 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, yymsp[-3].minor.yy502 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy590);
183060 }
183061 }else{
183062 Expr *pRHS = yymsp[-1].minor.yy402->a[0].pExpr;
183063 if( yymsp[-1].minor.yy402->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy590->op!=TK_VECTOR ){
183064 yymsp[-1].minor.yy402->a[0].pExpr = 0;
183065 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
183066 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
183067 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy590, pRHS);
183068 }else if( yymsp[-1].minor.yy402->nExpr==1 && pRHS->op==TK_SELECT ){
183069 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183070 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pRHS->x.pSelect);
183071 pRHS->x.pSelect = 0;
183072 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
183073 }else{
183074 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183075 if( yymsp[-4].minor.yy590==0 ){
183076 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
183077 }else if( yymsp[-4].minor.yy590->pLeft->op==TK_VECTOR ){
183078 int nExpr = yymsp[-4].minor.yy590->pLeft->x.pList->nExpr;
183079 Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy402);
183080 if( pSelectRHS ){
183081 parserDoubleLinkSelect(pParse, pSelectRHS);
183082 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pSelectRHS);
183083 }
183084 }else{
183085 yymsp[-4].minor.yy590->x.pList = yymsp[-1].minor.yy402;
183086 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy590);
183087 }
183088 }
183089 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
183090 }
183091 }
183092 break;
183093 case 224: /* expr ::= LP select RP */
183094 {
183095 yymsp[-2].minor.yy590 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
183096 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy590, yymsp[-1].minor.yy637);
183097 }
183098 break;
183099 case 225: /* expr ::= expr in_op LP select RP */
183100 {
183101 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183102 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, yymsp[-1].minor.yy637);
183103 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
183104 }
183105 break;
183106 case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
183107 {
183108 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
183109 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
183110 if( yymsp[0].minor.yy402 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy402);
183111 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
183112 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pSelect);
183113 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
183114 }
183115 break;
183116 case 227: /* expr ::= EXISTS LP select RP */
183117 {
183118 Expr *p;
183119 p = yymsp[-3].minor.yy590 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
183120 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy637);
183121 }
183122 break;
183123 case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
183124 {
183125 yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy590, 0);
183126 if( yymsp[-4].minor.yy590 ){
183127 yymsp[-4].minor.yy590->x.pList = yymsp[-1].minor.yy590 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590) : yymsp[-2].minor.yy402;
183128 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy590);
183129 }else{
183130 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy402);
183131 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy590);
183132 }
183133 }
183134 break;
183135 case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
183136 {
183137 yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, yymsp[-2].minor.yy590);
183138 yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, yymsp[0].minor.yy590);
183139 }
183140 break;
183141 case 230: /* case_exprlist ::= WHEN expr THEN expr */
183142 {
183143 yymsp[-3].minor.yy402 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
183144 yymsp[-3].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy402, yymsp[0].minor.yy590);
183145 }
183146 break;
183147 case 235: /* nexprlist ::= nexprlist COMMA expr */
183148 {yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy402,yymsp[0].minor.yy590);}
183149 break;
183150 case 236: /* nexprlist ::= expr */
183151 {yymsp[0].minor.yy402 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy590); /*A-overwrites-Y*/}
183152 break;
183153 case 238: /* paren_exprlist ::= LP exprlist RP */
183154 case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
183155 {yymsp[-2].minor.yy402 = yymsp[-1].minor.yy402;}
183156 break;
183157 case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
183158 {
183159 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
183160 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy402, yymsp[-10].minor.yy502,
183161 &yymsp[-11].minor.yy0, yymsp[0].minor.yy590, SQLITE_SO_ASC, yymsp[-8].minor.yy502, SQLITE_IDXTYPE_APPDEF);
183162 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
183163 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
183164 }
183165 }
183166 break;
183167 case 240: /* uniqueflag ::= UNIQUE */
183168 case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282);
183169 {yymsp[0].minor.yy502 = OE_Abort;}
183170 break;
183171 case 241: /* uniqueflag ::= */
183172 {yymsp[1].minor.yy502 = OE_None;}
183173 break;
183174 case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
183175 {
183176 yymsp[-4].minor.yy402 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy402, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502);
183177 }
183178 break;
183179 case 245: /* eidlist ::= nm collate sortorder */
183180 {
183181 yymsp[-2].minor.yy402 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502); /*A-overwrites-Y*/
183182 }
183183 break;
183184 case 248: /* cmd ::= DROP INDEX ifexists fullname */
183185 {sqlite3DropIndex(pParse, yymsp[0].minor.yy563, yymsp[-1].minor.yy502);}
183186 break;
183187 case 249: /* cmd ::= VACUUM vinto */
183188 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy590);}
183189 break;
183190 case 250: /* cmd ::= VACUUM nm vinto */
183191 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy590);}
183192 break;
183193 case 253: /* cmd ::= PRAGMA nm dbnm */
183194 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
183195 break;
183196 case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
@@ -183208,468 +183096,457 @@
183208 case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
183209 {
183210 Token all;
183211 all.z = yymsp[-3].minor.yy0.z;
183212 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
183213 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy319, &all);
183214 }
183215 break;
183216 case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
183217 {
183218 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy502, yymsp[-4].minor.yy28.a, yymsp[-4].minor.yy28.b, yymsp[-2].minor.yy563, yymsp[0].minor.yy590, yymsp[-10].minor.yy502, yymsp[-8].minor.yy502);
183219 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
183220 #ifdef SQLITE_DEBUG
183221 assert( pParse->isCreate ); /* Set by createkw reduce action */
183222 pParse->isCreate = 0; /* But, should not be set for CREATE TRIGGER */
183223 #endif
183224 }
183225 break;
183226 case 262: /* trigger_time ::= BEFORE|AFTER */
183227 { yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/ }
183228 break;
183229 case 263: /* trigger_time ::= INSTEAD OF */
183230 { yymsp[-1].minor.yy502 = TK_INSTEAD;}
183231 break;
183232 case 264: /* trigger_time ::= */
183233 { yymsp[1].minor.yy502 = TK_BEFORE; }
183234 break;
183235 case 265: /* trigger_event ::= DELETE|INSERT */
183236 case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
183237 {yymsp[0].minor.yy28.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy28.b = 0;}
183238 break;
183239 case 267: /* trigger_event ::= UPDATE OF idlist */
183240 {yymsp[-2].minor.yy28.a = TK_UPDATE; yymsp[-2].minor.yy28.b = yymsp[0].minor.yy204;}
183241 break;
183242 case 268: /* when_clause ::= */
183243 case 287: /* key_opt ::= */ yytestcase(yyruleno==287);
183244 { yymsp[1].minor.yy590 = 0; }
183245 break;
183246 case 269: /* when_clause ::= WHEN expr */
183247 case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288);
183248 { yymsp[-1].minor.yy590 = yymsp[0].minor.yy590; }
183249 break;
183250 case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
183251 {
183252 assert( yymsp[-2].minor.yy319!=0 );
183253 yymsp[-2].minor.yy319->pLast->pNext = yymsp[-1].minor.yy319;
183254 yymsp[-2].minor.yy319->pLast = yymsp[-1].minor.yy319;
183255 }
183256 break;
183257 case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
183258 {
183259 assert( yymsp[-1].minor.yy319!=0 );
183260 yymsp[-1].minor.yy319->pLast = yymsp[-1].minor.yy319;
183261 }
183262 break;
183263 case 272: /* trnm ::= nm DOT nm */
183264 {
183265 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
183266 sqlite3ErrorMsg(pParse,
183267 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
183268 "statements within triggers");
183269 }
183270 break;
183271 case 273: /* tridxby ::= INDEXED BY nm */
183272 {
183273 sqlite3ErrorMsg(pParse,
183274 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
183275 "within triggers");
183276 }
183277 break;
183278 case 274: /* tridxby ::= NOT INDEXED */
183279 {
183280 sqlite3ErrorMsg(pParse,
183281 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
183282 "within triggers");
183283 }
183284 break;
183285 case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
183286 {yylhsminor.yy319 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy563, yymsp[-3].minor.yy402, yymsp[-1].minor.yy590, yymsp[-7].minor.yy502, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy342);}
183287 yymsp[-8].minor.yy319 = yylhsminor.yy319;
183288 break;
183289 case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
183290 {
183291 yylhsminor.yy319 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy204,yymsp[-2].minor.yy637,yymsp[-6].minor.yy502,yymsp[-1].minor.yy403,yymsp[-7].minor.yy342,yymsp[0].minor.yy342);/*yylhsminor.yy319-overwrites-yymsp[-6].minor.yy502*/
183292 }
183293 yymsp[-7].minor.yy319 = yylhsminor.yy319;
183294 break;
183295 case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
183296 {yylhsminor.yy319 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy590, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy342);}
183297 yymsp[-5].minor.yy319 = yylhsminor.yy319;
183298 break;
183299 case 278: /* trigger_cmd ::= scanpt select scanpt */
183300 {yylhsminor.yy319 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy637, yymsp[-2].minor.yy342, yymsp[0].minor.yy342); /*yylhsminor.yy319-overwrites-yymsp[-1].minor.yy637*/}
183301 yymsp[-2].minor.yy319 = yylhsminor.yy319;
183302 break;
183303 case 279: /* expr ::= RAISE LP IGNORE RP */
183304 {
183305 yymsp[-3].minor.yy590 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
183306 if( yymsp[-3].minor.yy590 ){
183307 yymsp[-3].minor.yy590->affExpr = OE_Ignore;
183308 }
183309 }
183310 break;
183311 case 280: /* expr ::= RAISE LP raisetype COMMA expr RP */
183312 {
183313 yymsp[-5].minor.yy590 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy590, 0);
183314 if( yymsp[-5].minor.yy590 ) {
183315 yymsp[-5].minor.yy590->affExpr = (char)yymsp[-3].minor.yy502;
183316 }
183317 }
183318 break;
183319 case 281: /* raisetype ::= ROLLBACK */
183320 {yymsp[0].minor.yy502 = OE_Rollback;}
183321 break;
183322 case 283: /* raisetype ::= FAIL */
183323 {yymsp[0].minor.yy502 = OE_Fail;}
183324 break;
183325 case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
183326 {
183327 sqlite3DropTrigger(pParse,yymsp[0].minor.yy563,yymsp[-1].minor.yy502);
183328 }
183329 break;
183330 case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
183331 {
183332 sqlite3Attach(pParse, yymsp[-3].minor.yy590, yymsp[-1].minor.yy590, yymsp[0].minor.yy590);
183333 }
183334 break;
183335 case 286: /* cmd ::= DETACH database_kw_opt expr */
183336 {
183337 sqlite3Detach(pParse, yymsp[0].minor.yy590);
183338 }
183339 break;
183340 case 289: /* cmd ::= REINDEX */
183341 {sqlite3Reindex(pParse, 0, 0);}
183342 break;
183343 case 290: /* cmd ::= REINDEX nm dbnm */
183344 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
183345 break;
183346 case 291: /* cmd ::= ANALYZE */
183347 {sqlite3Analyze(pParse, 0, 0);}
183348 break;
183349 case 292: /* cmd ::= ANALYZE nm dbnm */
183350 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
183351 break;
183352 case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
183353 {
183354 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy563,&yymsp[0].minor.yy0);
183355 }
183356 break;
183357 case 294: /* cmd ::= alter_add carglist */
183358 {
183359 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
183360 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
183361 }
183362 break;
183363 case 295: /* alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
183364 {
183365 disableLookaside(pParse);
183366 sqlite3AlterBeginAddColumn(pParse, yymsp[-4].minor.yy563);
183367 sqlite3AddColumn(pParse, yymsp[-1].minor.yy0, yymsp[0].minor.yy0);
183368 yymsp[-6].minor.yy0 = yymsp[-1].minor.yy0;
183369 }
183370 break;
183371 case 296: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
183372 {
183373 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy563, &yymsp[0].minor.yy0);
183374 }
183375 break;
183376 case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
183377 {
183378 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy563, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
183379 }
183380 break;
183381 case 298: /* cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
183382 {
183383 sqlite3AlterDropConstraint(pParse, yymsp[-3].minor.yy563, &yymsp[0].minor.yy0, 0);
183384 }
183385 break;
183386 case 299: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
183387 {
183388 sqlite3AlterDropConstraint(pParse, yymsp[-6].minor.yy563, 0, &yymsp[-3].minor.yy0);
183389 }
183390 break;
183391 case 300: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
183392 {
183393 sqlite3AlterSetNotNull(pParse, yymsp[-7].minor.yy563, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0);
183394 }
183395 break;
183396 case 301: /* cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
183397 {
183398 sqlite3AlterAddConstraint(pParse, yymsp[-8].minor.yy563, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183399 }
183400 yy_destructor(yypParser,219,&yymsp[-2].minor);
183401 break;
183402 case 302: /* cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
183403 {
183404 sqlite3AlterAddConstraint(pParse, yymsp[-6].minor.yy563, &yymsp[-4].minor.yy0, 0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183405 }
183406 yy_destructor(yypParser,219,&yymsp[-2].minor);
183407 break;
183408 case 303: /* cmd ::= create_vtab */
183409 {sqlite3VtabFinishParse(pParse,0);}
183410 break;
183411 case 304: /* cmd ::= create_vtab LP vtabarglist RP */
183412 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
183413 break;
183414 case 305: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
183415 {
183416 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy502);
183417 }
183418 break;
183419 case 306: /* vtabarg ::= */
183420 {sqlite3VtabArgInit(pParse);}
183421 break;
183422 case 307: /* vtabargtoken ::= ANY */
183423 case 308: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==308);
183424 case 309: /* lp ::= LP */ yytestcase(yyruleno==309);
183425 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
183426 break;
183427 case 310: /* with ::= WITH wqlist */
183428 case 311: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==311);
183429 { sqlite3WithPush(pParse, yymsp[0].minor.yy125, 1); }
183430 break;
183431 case 312: /* wqas ::= AS */
183432 {yymsp[0].minor.yy444 = M10d_Any;}
183433 break;
183434 case 313: /* wqas ::= AS MATERIALIZED */
183435 {yymsp[-1].minor.yy444 = M10d_Yes;}
183436 break;
183437 case 314: /* wqas ::= AS NOT MATERIALIZED */
183438 {yymsp[-2].minor.yy444 = M10d_No;}
183439 break;
183440 case 315: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
183441 {
183442 yymsp[-5].minor.yy361 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy402, yymsp[-1].minor.yy637, yymsp[-3].minor.yy444); /*A-overwrites-X*/
183443 }
183444 break;
183445 case 316: /* withnm ::= nm */
183446 {pParse->bHasWith = 1;}
183447 break;
183448 case 317: /* wqlist ::= wqitem */
183449 {
183450 yymsp[0].minor.yy125 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy361); /*A-overwrites-X*/
183451 }
183452 break;
183453 case 318: /* wqlist ::= wqlist COMMA wqitem */
183454 {
183455 yymsp[-2].minor.yy125 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy125, yymsp[0].minor.yy361);
183456 }
183457 break;
183458 case 319: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
183459 {
183460 assert( yymsp[0].minor.yy483!=0 );
183461 sqlite3WindowChain(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy483);
183462 yymsp[0].minor.yy483->pNextWin = yymsp[-2].minor.yy483;
183463 yylhsminor.yy483 = yymsp[0].minor.yy483;
183464 }
183465 yymsp[-2].minor.yy483 = yylhsminor.yy483;
183466 break;
183467 case 320: /* windowdefn ::= nm AS LP window RP */
183468 {
183469 if( ALWAYS(yymsp[-1].minor.yy483) ){
183470 yymsp[-1].minor.yy483->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
183471 }
183472 yylhsminor.yy483 = yymsp[-1].minor.yy483;
183473 }
183474 yymsp[-4].minor.yy483 = yylhsminor.yy483;
183475 break;
183476 case 321: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
183477 {
183478 yymsp[-4].minor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy402, yymsp[-1].minor.yy402, 0);
183479 }
183480 break;
183481 case 322: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
183482 {
183483 yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy402, yymsp[-1].minor.yy402, &yymsp[-5].minor.yy0);
183484 }
183485 yymsp[-5].minor.yy483 = yylhsminor.yy483;
183486 break;
183487 case 323: /* window ::= ORDER BY sortlist frame_opt */
183488 {
183489 yymsp[-3].minor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy402, 0);
183490 }
183491 break;
183492 case 324: /* window ::= nm ORDER BY sortlist frame_opt */
183493 {
183494 yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy402, &yymsp[-4].minor.yy0);
183495 }
183496 yymsp[-4].minor.yy483 = yylhsminor.yy483;
183497 break;
183498 case 325: /* window ::= nm frame_opt */
183499 {
183500 yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, 0, &yymsp[-1].minor.yy0);
183501 }
183502 yymsp[-1].minor.yy483 = yylhsminor.yy483;
183503 break;
183504 case 326: /* frame_opt ::= */
183505 {
183506 yymsp[1].minor.yy483 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
183507 }
183508 break;
183509 case 327: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
183510 {
183511 yylhsminor.yy483 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy502, yymsp[-1].minor.yy205.eType, yymsp[-1].minor.yy205.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy444);
183512 }
183513 yymsp[-2].minor.yy483 = yylhsminor.yy483;
183514 break;
183515 case 328: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
183516 {
183517 yylhsminor.yy483 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy502, yymsp[-3].minor.yy205.eType, yymsp[-3].minor.yy205.pExpr, yymsp[-1].minor.yy205.eType, yymsp[-1].minor.yy205.pExpr, yymsp[0].minor.yy444);
183518 }
183519 yymsp[-5].minor.yy483 = yylhsminor.yy483;
183520 break;
183521 case 330: /* frame_bound_s ::= frame_bound */
183522 case 332: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==332);
183523 {yylhsminor.yy205 = yymsp[0].minor.yy205;}
183524 yymsp[0].minor.yy205 = yylhsminor.yy205;
183525 break;
183526 case 331: /* frame_bound_s ::= UNBOUNDED PRECEDING */
183527 case 333: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==333);
183528 case 335: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==335);
183529 {yylhsminor.yy205.eType = yymsp[-1].major; yylhsminor.yy205.pExpr = 0;}
183530 yymsp[-1].minor.yy205 = yylhsminor.yy205;
183531 break;
183532 case 334: /* frame_bound ::= expr PRECEDING|FOLLOWING */
183533 {yylhsminor.yy205.eType = yymsp[0].major; yylhsminor.yy205.pExpr = yymsp[-1].minor.yy590;}
183534 yymsp[-1].minor.yy205 = yylhsminor.yy205;
183535 break;
183536 case 336: /* frame_exclude_opt ::= */
183537 {yymsp[1].minor.yy444 = 0;}
183538 break;
183539 case 337: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
183540 {yymsp[-1].minor.yy444 = yymsp[0].minor.yy444;}
183541 break;
183542 case 338: /* frame_exclude ::= NO OTHERS */
183543 case 339: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==339);
183544 {yymsp[-1].minor.yy444 = yymsp[-1].major; /*A-overwrites-X*/}
183545 break;
183546 case 340: /* frame_exclude ::= GROUP|TIES */
183547 {yymsp[0].minor.yy444 = yymsp[0].major; /*A-overwrites-X*/}
183548 break;
183549 case 341: /* window_clause ::= WINDOW windowdefn_list */
183550 { yymsp[-1].minor.yy483 = yymsp[0].minor.yy483; }
183551 break;
183552 case 342: /* filter_over ::= filter_clause over_clause */
183553 {
183554 if( yymsp[0].minor.yy483 ){
183555 yymsp[0].minor.yy483->pFilter = yymsp[-1].minor.yy590;
183556 }else{
183557 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy590);
183558 }
183559 yylhsminor.yy483 = yymsp[0].minor.yy483;
183560 }
183561 yymsp[-1].minor.yy483 = yylhsminor.yy483;
183562 break;
183563 case 343: /* filter_over ::= over_clause */
183564 {
183565 yylhsminor.yy483 = yymsp[0].minor.yy483;
183566 }
183567 yymsp[0].minor.yy483 = yylhsminor.yy483;
183568 break;
183569 case 344: /* filter_over ::= filter_clause */
183570 {
183571 yylhsminor.yy483 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183572 if( yylhsminor.yy483 ){
183573 yylhsminor.yy483->eFrmType = TK_FILTER;
183574 yylhsminor.yy483->pFilter = yymsp[0].minor.yy590;
183575 }else{
183576 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy590);
183577 }
183578 }
183579 yymsp[0].minor.yy483 = yylhsminor.yy483;
183580 break;
183581 case 345: /* over_clause ::= OVER LP window RP */
183582 {
183583 yymsp[-3].minor.yy483 = yymsp[-1].minor.yy483;
183584 assert( yymsp[-3].minor.yy483!=0 );
183585 }
183586 break;
183587 case 346: /* over_clause ::= OVER nm */
183588 {
183589 yymsp[-1].minor.yy483 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183590 if( yymsp[-1].minor.yy483 ){
183591 yymsp[-1].minor.yy483->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
183592 }
183593 }
183594 break;
183595 case 347: /* filter_clause ::= FILTER LP WHERE expr RP */
183596 { yymsp[-4].minor.yy590 = yymsp[-1].minor.yy590; }
183597 break;
183598 case 348: /* term ::= QNUMBER */
183599 {
183600 yylhsminor.yy590=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
183601 sqlite3DequoteNumber(pParse, yylhsminor.yy590);
183602 }
183603 yymsp[0].minor.yy590 = yylhsminor.yy590;
183604 break;
183605 default:
183606 /* (349) input ::= cmdlist */ yytestcase(yyruleno==349);
183607 /* (350) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==350);
183608 /* (351) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=351);
183609 /* (352) ecmd ::= SEMI */ yytestcase(yyruleno==352);
183610 /* (353) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==353);
183611 /* (354) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=354);
183612 /* (355) trans_opt ::= */ yytestcase(yyruleno==355);
183613 /* (356) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==356);
183614 /* (357) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==357);
183615 /* (358) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==358);
183616 /* (359) savepoint_opt ::= */ yytestcase(yyruleno==359);
183617 /* (360) cmd ::= create_table create_table_args */ yytestcase(yyruleno==360);
183618 /* (361) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=361);
183619 /* (362) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==362);
183620 /* (363) columnlist ::= columnname carglist */ yytestcase(yyruleno==363);
183621 /* (364) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==364);
183622 /* (365) nm ::= STRING */ yytestcase(yyruleno==365);
183623 /* (366) typetoken ::= typename */ yytestcase(yyruleno==366);
183624 /* (367) typename ::= ID|STRING */ yytestcase(yyruleno==367);
183625 /* (368) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=368);
183626 /* (369) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=369);
183627 /* (370) carglist ::= carglist ccons */ yytestcase(yyruleno==370);
183628 /* (371) carglist ::= */ yytestcase(yyruleno==371);
183629 /* (372) ccons ::= NULL onconf */ yytestcase(yyruleno==372);
183630 /* (373) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==373);
183631 /* (374) ccons ::= AS generated */ yytestcase(yyruleno==374);
183632 /* (375) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==375);
183633 /* (376) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==376);
183634 /* (377) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=377);
183635 /* (378) tconscomma ::= */ yytestcase(yyruleno==378);
183636 /* (379) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=379);
183637 /* (380) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=380);
183638 /* (381) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=381);
183639 /* (382) oneselect ::= values */ yytestcase(yyruleno==382);
183640 /* (383) sclp ::= selcollist COMMA */ yytestcase(yyruleno==383);
183641 /* (384) as ::= ID|STRING */ yytestcase(yyruleno==384);
183642 /* (385) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=385);
183643 /* (386) returning ::= */ yytestcase(yyruleno==386);
183644 /* (387) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=387);
183645 /* (388) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==388);
183646 /* (389) case_operand ::= expr */ yytestcase(yyruleno==389);
183647 /* (390) exprlist ::= nexprlist */ yytestcase(yyruleno==390);
183648 /* (391) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=391);
183649 /* (392) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=392);
183650 /* (393) nmnum ::= ON */ yytestcase(yyruleno==393);
183651 /* (394) nmnum ::= DELETE */ yytestcase(yyruleno==394);
183652 /* (395) nmnum ::= DEFAULT */ yytestcase(yyruleno==395);
183653 /* (396) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==396);
183654 /* (397) foreach_clause ::= */ yytestcase(yyruleno==397);
183655 /* (398) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==398);
183656 /* (399) trnm ::= nm */ yytestcase(yyruleno==399);
183657 /* (400) tridxby ::= */ yytestcase(yyruleno==400);
183658 /* (401) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==401);
183659 /* (402) database_kw_opt ::= */ yytestcase(yyruleno==402);
183660 /* (403) kwcolumn_opt ::= */ yytestcase(yyruleno==403);
183661 /* (404) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==404);
183662 /* (405) vtabarglist ::= vtabarg */ yytestcase(yyruleno==405);
183663 /* (406) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==406);
183664 /* (407) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==407);
183665 /* (408) anylist ::= */ yytestcase(yyruleno==408);
183666 /* (409) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==409);
183667 /* (410) anylist ::= anylist ANY */ yytestcase(yyruleno==410);
183668 /* (411) with ::= */ yytestcase(yyruleno==411);
183669 /* (412) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=412);
183670 /* (413) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=413);
183671 break;
183672 /********** End reduce actions ************************************************/
183673 };
183674 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
183675 yygoto = yyRuleInfoLhs[yyruleno];
@@ -184444,12 +184321,12 @@
184444 ** 126: UPDATE UNIQUE
184445 */
184446 /* Check to see if z[0..n-1] is a keyword. If it is, write the
184447 ** parser symbol code for that keyword into *pType. Always
184448 ** return the integer n (the length of the token). */
184449 static int keywordCode(const char *z, int n, int *pType){
184450 int i, j;
184451 const char *zKW;
184452 assert( n>=2 );
184453 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
184454 for(i=(int)aKWHash[i]; i>0; i=aKWNext[i]){
184455 if( aKWLen[i]!=n ) continue;
@@ -184999,11 +184876,11 @@
184999 for(i=1; sqlite3Isdigit(z[i]); i++){}
185000 return i;
185001 }
185002 case CC_DOLLAR:
185003 case CC_VARALPHA: {
185004 int n = 0;
185005 testcase( z[0]=='$' ); testcase( z[0]=='@' );
185006 testcase( z[0]==':' ); testcase( z[0]=='#' );
185007 *tokenType = TK_VARIABLE;
185008 for(i=1; (c=z[i])!=0; i++){
185009 if( IdChar(c) ){
@@ -185095,11 +184972,11 @@
185095 void *pEngine; /* The LEMON-generated LALR(1) parser */
185096 i64 n = 0; /* Length of the next token token */
185097 int tokenType; /* type of the next token */
185098 int lastTokenParsed = -1; /* type of the previous token */
185099 sqlite3 *db = pParse->db; /* The database connection */
185100 int mxSqlLen; /* Max length of an SQL string */
185101 Parse *pParentParse = 0; /* Outer parse context, if any */
185102 #ifdef sqlite3Parser_ENGINEALWAYSONSTACK
185103 yyParser sEngine; /* Space to hold the Lemon-generated Parser object */
185104 #endif
185105 VVA_ONLY( u8 startedWithOom = db->mallocFailed );
@@ -188342,15 +188219,16 @@
188342
188343 /* Initialize the output variables to -1 in case an error occurs. */
188344 if( pnLog ) *pnLog = -1;
188345 if( pnCkpt ) *pnCkpt = -1;
188346
 
188347 assert( SQLITE_CHECKPOINT_PASSIVE==0 );
188348 assert( SQLITE_CHECKPOINT_FULL==1 );
188349 assert( SQLITE_CHECKPOINT_RESTART==2 );
188350 assert( SQLITE_CHECKPOINT_TRUNCATE==3 );
188351 if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_TRUNCATE ){
188352 /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint
188353 ** mode: */
188354 return SQLITE_MISUSE_BKPT;
188355 }
188356
@@ -188724,10 +188602,13 @@
188724 #if SQLITE_MAX_SQL_LENGTH<100
188725 # error SQLITE_MAX_SQL_LENGTH must be at least 100
188726 #endif
188727 #if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH
188728 # error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH
 
 
 
188729 #endif
188730 #if SQLITE_MAX_COMPOUND_SELECT<2
188731 # error SQLITE_MAX_COMPOUND_SELECT must be at least 2
188732 #endif
188733 #if SQLITE_MAX_VDBE_OP<40
@@ -192464,10 +192345,19 @@
192464 SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table*,int,int);
192465
192466 #define fts3GetVarint32(p, piVal) ( \
192467 (*(u8*)(p)&0x80) ? sqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \
192468 )
 
 
 
 
 
 
 
 
 
192469
192470 /* fts3.c */
192471 SQLITE_PRIVATE void sqlite3Fts3ErrMsg(char**,const char*,...);
192472 SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64);
192473 SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *);
@@ -194072,13 +193962,11 @@
194072 p->pSeekStmt = 0;
194073 }else{
194074 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
194075 if( !zSql ) return SQLITE_NOMEM;
194076 p->bLock++;
194077 rc = sqlite3_prepare_v3(
194078 p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0
194079 );
194080 p->bLock--;
194081 sqlite3_free(zSql);
194082 }
194083 if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
194084 }
@@ -195649,13 +195537,11 @@
195649 p->zReadExprlist, (pCsr->bDesc ? "DESC" : "ASC")
195650 );
195651 }
195652 if( zSql ){
195653 p->bLock++;
195654 rc = sqlite3_prepare_v3(
195655 p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0
195656 );
195657 p->bLock--;
195658 sqlite3_free(zSql);
195659 }else{
195660 rc = SQLITE_NOMEM;
195661 }
@@ -196274,10 +196160,11 @@
196274 int rc = SQLITE_OK;
196275 int bOk = 0;
196276
196277 UNUSED_PARAMETER(isQuick);
196278 rc = sqlite3Fts3IntegrityCheck(p, &bOk);
 
196279 assert( rc!=SQLITE_CORRUPT_VTAB );
196280 if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){
196281 *pzErr = sqlite3_mprintf("unable to validate the inverted index for"
196282 " FTS%d table %s.%s: %s",
196283 p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc));
@@ -202885,10 +202772,28 @@
202885 #define SQL_SELECT_MXLEVEL 36
202886
202887 #define SQL_SELECT_LEVEL_RANGE2 37
202888 #define SQL_UPDATE_LEVEL_IDX 38
202889 #define SQL_UPDATE_LEVEL 39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202890
202891 /*
202892 ** This function is used to obtain an SQLite prepared statement handle
202893 ** for the statement identified by the second argument. If successful,
202894 ** *pp is set to the requested statement handle and SQLITE_OK returned.
@@ -203011,24 +202916,24 @@
203011 assert( SizeofArray(azSql)==SizeofArray(p->aStmt) );
203012 assert( eStmt<SizeofArray(azSql) && eStmt>=0 );
203013
203014 pStmt = p->aStmt[eStmt];
203015 if( !pStmt ){
203016 int f = SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB;
203017 char *zSql;
203018 if( eStmt==SQL_CONTENT_INSERT ){
203019 zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist);
203020 }else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){
203021 f &= ~SQLITE_PREPARE_NO_VTAB;
203022 zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist);
203023 }else{
203024 zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName);
203025 }
203026 if( !zSql ){
203027 rc = SQLITE_NOMEM;
203028 }else{
203029 rc = sqlite3_prepare_v3(p->db, zSql, -1, f, &pStmt, NULL);
203030 sqlite3_free(zSql);
203031 assert( rc==SQLITE_OK || pStmt==0 );
203032 p->aStmt[eStmt] = pStmt;
203033 }
203034 }
@@ -203373,11 +203278,13 @@
203373 PendingList *pList;
203374 int rc = SQLITE_OK;
203375
203376 pList = (PendingList *)fts3HashFind(pHash, zToken, nToken);
203377 if( pList ){
203378 p->nPendingData -= (pList->nData + nToken + sizeof(Fts3HashElem));
 
 
203379 }
203380 if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){
203381 if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){
203382 /* Malloc failed while inserting the new entry. This can only
203383 ** happen if there was no previous entry for this token.
@@ -203386,11 +203293,13 @@
203386 sqlite3_free(pList);
203387 rc = SQLITE_NOMEM;
203388 }
203389 }
203390 if( rc==SQLITE_OK ){
203391 p->nPendingData += (pList->nData + nToken + sizeof(Fts3HashElem));
 
 
203392 }
203393 return rc;
203394 }
203395
203396 /*
@@ -206187,11 +206096,11 @@
206187 /* Compose and prepare an SQL statement to loop through the content table */
206188 char *zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist);
206189 if( !zSql ){
206190 rc = SQLITE_NOMEM;
206191 }else{
206192 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
206193 sqlite3_free(zSql);
206194 }
206195
206196 if( rc==SQLITE_OK ){
206197 sqlite3_int64 nByte = sizeof(u32) * ((sqlite3_int64)p->nColumn+1)*3;
@@ -207940,11 +207849,11 @@
207940
207941 zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist);
207942 if( !zSql ){
207943 rc = SQLITE_NOMEM;
207944 }else{
207945 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
207946 sqlite3_free(zSql);
207947 }
207948
207949 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
207950 i64 iDocid = sqlite3_column_int64(pStmt, 0);
@@ -220394,11 +220303,11 @@
220394 tree.nBytesPerCell = 8 + 8 * tree.nDim;
220395 node.zData = (u8 *)sqlite3_value_blob(apArg[1]);
220396 if( node.zData==0 ) return;
220397 nData = sqlite3_value_bytes(apArg[1]);
220398 if( nData<4 ) return;
220399 if( nData<NCELL(&node)*tree.nBytesPerCell ) return;
220400
220401 pOut = sqlite3_str_new(0);
220402 for(ii=0; ii<NCELL(&node); ii++){
220403 RtreeCell cell;
220404 int jj;
@@ -225066,11 +224975,11 @@
225066 total += cnt;
225067 if( total>limit ){
225068 /* ERROR: copy exceeds output file size */
225069 return -1;
225070 }
225071 if( (int)(ofst+cnt) > lenSrc ){
225072 /* ERROR: copy extends past end of input */
225073 return -1;
225074 }
225075 memcpy(zOut, &zSrc[ofst], cnt);
225076 zOut += cnt;
@@ -239475,11 +239384,17 @@
239475 # define FLEXARRAY
239476 #else
239477 # define FLEXARRAY 1
239478 #endif
239479
239480 #endif
 
 
 
 
 
 
239481
239482 /* Truncate very long tokens to this many bytes. Hard limit is
239483 ** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset
239484 ** field that occurs at the start of each leaf page (see fts5_index.c). */
239485 #define FTS5_MAX_TOKEN_SIZE 32768
@@ -250200,10 +250115,11 @@
250200
250201 ASSERT_SZLEAF_OK(pIter->pLeaf);
250202 while( 1 ){
250203 u64 iDelta = 0;
250204
 
250205 if( eDetail==FTS5_DETAIL_NONE ){
250206 /* todo */
250207 if( i<n && a[i]==0 ){
250208 i++;
250209 if( i<n && a[i]==0 ) i++;
@@ -254056,11 +253972,11 @@
254056 if( nMerge<0 ){
254057 Fts5Structure *pNew = fts5IndexOptimizeStruct(p, pStruct);
254058 fts5StructureRelease(pStruct);
254059 pStruct = pNew;
254060 nMin = 1;
254061 nMerge = nMerge*-1;
254062 }
254063 if( pStruct && pStruct->nLevel ){
254064 if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){
254065 fts5StructureWrite(p, pStruct);
254066 }
@@ -259746,10 +259662,11 @@
259746 }
259747 }
259748 }
259749
259750 update_out:
 
259751 pTab->p.pConfig->pzErrmsg = 0;
259752 return rc;
259753 }
259754
259755 /*
@@ -261263,11 +261180,11 @@
261263 int nArg, /* Number of args */
261264 sqlite3_value **apUnused /* Function arguments */
261265 ){
261266 assert( nArg==0 );
261267 UNUSED_PARAM2(nArg, apUnused);
261268 sqlite3_result_text(pCtx, "fts5: 2025-11-25 18:20:33 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911", -1, SQLITE_TRANSIENT);
261269 }
261270
261271 /*
261272 ** Implementation of fts5_locale(LOCALE, TEXT) function.
261273 **
@@ -266084,20 +266001,31 @@
266084
266085 *ppCsr = (sqlite3_vtab_cursor*)pCsr;
266086 return rc;
266087 }
266088
 
 
 
 
266089 static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
 
266090 pCsr->rowid = 0;
266091 sqlite3Fts5IterClose(pCsr->pIter);
266092 sqlite3Fts5StructureRelease(pCsr->pStruct);
266093 pCsr->pStruct = 0;
266094 pCsr->pIter = 0;
266095 sqlite3_free(pCsr->zLeTerm);
266096 pCsr->nLeTerm = -1;
266097 pCsr->zLeTerm = 0;
266098 pCsr->bEof = 0;
 
 
 
 
 
 
266099 }
266100
266101 /*
266102 ** Close the cursor. For additional information see the documentation
266103 ** on the xClose method of the virtual table interface.
266104
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** 9adab8b2bef4130abd358d53384cb5f4dd69 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.52.0"
471 #define SQLITE_VERSION_NUMBER 3052000
472 #define SQLITE_SOURCE_ID "2026-01-09 00:41:35 9adab8b2bef4130abd358d53384cb5f4dd691b808336bb7102793b0165b1c516"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-01-09T00:41:35.433Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -1809,11 +1809,11 @@
1809 ** ^SQLite will use the xCurrentTimeInt64() method to get the current
1810 ** date and time if that method is available (if iVersion is 2 or
1811 ** greater and the function pointer is not NULL) and will fall back
1812 ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
1813 **
1814 ** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
1815 ** are not used by the SQLite core. These optional interfaces are provided
1816 ** by some VFSes to facilitate testing of the VFS code. By overriding
1817 ** system calls with functions under its control, a test program can
1818 ** simulate faults and error conditions that would otherwise be difficult
1819 ** or impossible to induce. The set of system calls that can be overridden
@@ -4493,10 +4493,11 @@
4493 ** <li> sqlite3_errcode()
4494 ** <li> sqlite3_extended_errcode()
4495 ** <li> sqlite3_errmsg()
4496 ** <li> sqlite3_errmsg16()
4497 ** <li> sqlite3_error_offset()
4498 ** <li> sqlite3_db_handle()
4499 ** </ul>
4500 **
4501 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
4502 ** text that describes the error, as either UTF-8 or UTF-16 respectively,
4503 ** or NULL if no error message is available.
@@ -4751,16 +4752,32 @@
4752 ** compiles to see if some SQL syntax is well-formed, without generating
4753 ** messages on the global error log when it is not. If the test compile
4754 ** fails, the sqlite3_prepare_v3() call returns the same error indications
4755 ** with or without this flag; it just omits the call to [sqlite3_log()] that
4756 ** logs the error.
4757 **
4758 ** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt>
4759 ** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to behave as if
4760 ** the SQL statement is part of a database schema. This makes a difference
4761 ** when the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] option is set to off.
4762 ** When this option is used and SQLITE_DBCONFIG_TRUSTED_SCHEMA is off,
4763 ** SQL functions may not be called unless they are tagged with
4764 ** [SQLITE_INNOCUOUS] and virtual tables may not be used unless tagged
4765 ** with [SQLITE_VTAB_INNOCUOUS]. Use the SQLITE_PREPARE_FROM_DDL option
4766 ** when preparing SQL that is derived from parts of the database
4767 ** schema. In particular, virtual table implementations that
4768 ** run SQL statements based on the arguments to their CREATE VIRTUAL
4769 ** TABLE statement should use [sqlite3_prepare_v3()] and set the
4770 ** SQLITE_PREPARE_FROM_DLL flag to prevent bypass of the
4771 ** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks.
4772 ** </dl>
4773 */
4774 #define SQLITE_PREPARE_PERSISTENT 0x01
4775 #define SQLITE_PREPARE_NORMALIZE 0x02
4776 #define SQLITE_PREPARE_NO_VTAB 0x04
4777 #define SQLITE_PREPARE_DONT_LOG 0x10
4778 #define SQLITE_PREPARE_FROM_DDL 0x20
4779
4780 /*
4781 ** CAPI3REF: Compiling An SQL Statement
4782 ** KEYWORDS: {SQL statement compiler}
4783 ** METHOD: sqlite3
@@ -4770,12 +4787,13 @@
4787 ** program using one of these routines. Or, in other words, these routines
4788 ** are constructors for the [prepared statement] object.
4789 **
4790 ** The preferred routine to use is [sqlite3_prepare_v2()]. The
4791 ** [sqlite3_prepare()] interface is legacy and should be avoided.
4792 ** [sqlite3_prepare_v3()] has an extra
4793 ** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is some times
4794 ** needed for special purpose or to pass along security restrictions.
4795 **
4796 ** The use of the UTF-8 interfaces is preferred, as SQLite currently
4797 ** does all parsing using UTF-8. The UTF-16 interfaces are provided
4798 ** as a convenience. The UTF-16 interfaces work by converting the
4799 ** input text into UTF-8, then invoking the corresponding UTF-8 interface.
@@ -6605,14 +6623,18 @@
6623 ** use for client data is to provide a mechanism for wrapper libraries
6624 ** to store additional information about an SQLite database connection.
6625 **
6626 ** There is no limit (other than available memory) on the number of different
6627 ** client data pointers (with different names) that can be attached to a
6628 ** single database connection. However, the current implementation stores
6629 ** the content on a linked list. Insert and retrieval performance will
6630 ** be proportional to the number of entries. The design use case, and
6631 ** the use case for which the implementation is optimized, is
6632 ** that an application will store only small number of client data names,
6633 ** typically just one or two. This interface is not intended to be a
6634 ** generalized key/value store for thousands or millions of keys. It
6635 ** will work for that, but performance might be disappointing.
6636 **
6637 ** There is no way to enumerate the client data pointers
6638 ** associated with a database connection. The N parameter can be thought
6639 ** of as a secret key such that only code that knows the secret key is able
6640 ** to access the associated data.
@@ -7745,22 +7767,22 @@
7767 ** ^This interface loads an SQLite extension library from the named file.
7768 **
7769 ** ^The sqlite3_load_extension() interface attempts to load an
7770 ** [SQLite extension] library contained in the file zFile. If
7771 ** the file cannot be loaded directly, attempts are made to load
7772 ** with various operating-system specific filename extensions added.
7773 ** So for example, if "samplelib" cannot be loaded, then names like
7774 ** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
7775 ** be tried also.
7776 **
7777 ** ^The entry point is zProc.
7778 ** ^(zProc may be 0, in which case SQLite will try to come up with an
7779 ** entry point name on its own. It first tries "sqlite3_extension_init".
7780 ** If that does not work, it tries names of the form "sqlite3_X_init"
7781 ** where X consists of the lower-case equivalent of all ASCII alphabetic
7782 ** characters or all ASCII alphanumeric characters in the filename from
7783 ** the last "/" to the first following "." and omitting any initial "lib".)^
7784 ** ^The sqlite3_load_extension() interface returns
7785 ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
7786 ** ^If an error occurs and pzErrMsg is not 0, then the
7787 ** [sqlite3_load_extension()] interface shall attempt to
7788 ** fill *pzErrMsg with error message text stored in memory
@@ -9049,11 +9071,11 @@
9071 ** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
9072 ** that contains the constructed string. The calling application should
9073 ** pass the returned value to [sqlite3_free()] to avoid a memory leak.
9074 ** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
9075 ** errors were encountered during construction of the string. ^The
9076 ** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
9077 ** string in [sqlite3_str] object X is zero bytes long.
9078 **
9079 ** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
9080 ** X and the string content it contains. Calling sqlite3_str_free(X) is
9081 ** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
@@ -14386,10 +14408,13 @@
14408 ** The maximum length of a single SQL statement in bytes.
14409 **
14410 ** It used to be the case that setting this value to zero would
14411 ** turn the limit off. That is no longer true. It is not possible
14412 ** to turn this limit off.
14413 **
14414 ** The hard limit is the largest possible 32-bit signed integer less
14415 ** 1024, or 2147482624.
14416 */
14417 #ifndef SQLITE_MAX_SQL_LENGTH
14418 # define SQLITE_MAX_SQL_LENGTH 1000000000
14419 #endif
14420
@@ -17525,11 +17550,11 @@
17550
17551 /*
17552 ** Additional non-public SQLITE_PREPARE_* flags
17553 */
17554 #define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
17555 #define SQLITE_PREPARE_MASK 0x3f /* Mask of public flags */
17556
17557 /*
17558 ** Prototypes for the VDBE interface. See comments on the implementation
17559 ** for a description of what each of these routines does.
17560 */
@@ -20765,23 +20790,23 @@
20790 **
20791 ** (op == TK_INSERT)
20792 ** orconf -> stores the ON CONFLICT algorithm
20793 ** pSelect -> The content to be inserted - either a SELECT statement or
20794 ** a VALUES clause.
20795 ** pSrc -> Table to insert into.
20796 ** pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
20797 ** statement, then this stores the column-names to be
20798 ** inserted into.
20799 ** pUpsert -> The ON CONFLICT clauses for an Upsert
20800 **
20801 ** (op == TK_DELETE)
20802 ** pSrc -> Table to delete from
20803 ** pWhere -> The WHERE clause of the DELETE statement if one is specified.
20804 ** Otherwise NULL.
20805 **
20806 ** (op == TK_UPDATE)
20807 ** pSrc -> Table to update, followed by any FROM clause tables.
20808 ** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
20809 ** Otherwise NULL.
20810 ** pExprList -> A list of the columns to update and the expressions to update
20811 ** them to. See sqlite3Update() documentation of "pChanges"
20812 ** argument.
@@ -20797,12 +20822,11 @@
20822 u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT,
20823 ** or TK_RETURNING */
20824 u8 orconf; /* OE_Rollback etc. */
20825 Trigger *pTrig; /* The trigger that this step is a part of */
20826 Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
20827 SrcList *pSrc; /* Table to insert/update/delete */
 
20828 Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
20829 ExprList *pExprList; /* SET clause for UPDATE, or RETURNING clause */
20830 IdList *pIdList; /* Column names for INSERT */
20831 Upsert *pUpsert; /* Upsert clauses on an INSERT */
20832 char *zSpan; /* Original SQL text of this command */
@@ -21547,10 +21571,11 @@
21571 #ifdef SQLITE_DEBUG
21572 SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
21573 #endif
21574 SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
21575 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
21576 SQLITE_PRIVATE Expr *sqlite3ExprInt32(sqlite3*,int);
21577 SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
21578 SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
21579 SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
21580 SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
21581 SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*);
@@ -21865,21 +21890,20 @@
21890 SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int);
21891 void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
21892 SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
21893 SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
21894 const char*,const char*);
21895 SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,SrcList*, IdList*,
21896 Select*,u8,Upsert*,
21897 const char*,const char*);
21898 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,SrcList*,SrcList*,ExprList*,
21899 Expr*, u8, const char*,const char*);
21900 SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,SrcList*, Expr*,
21901 const char*,const char*);
21902 SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*);
21903 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
21904 SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);
 
21905 # define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
21906 # define sqlite3IsToplevel(p) ((p)->pToplevel==0)
21907 #else
21908 # define sqlite3TriggersExist(B,C,D,E,F) 0
21909 # define sqlite3DeleteTrigger(A,B)
@@ -21889,11 +21913,10 @@
21913 # define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)
21914 # define sqlite3TriggerList(X, Y) 0
21915 # define sqlite3ParseToplevel(p) p
21916 # define sqlite3IsToplevel(p) 1
21917 # define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
 
21918 #endif
21919
21920 SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
21921 SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
21922 SQLITE_PRIVATE void sqlite3SrcItemColumnUsed(SrcItem*,int);
@@ -30648,18 +30671,10 @@
30671 # define SQLITE_OS_WINCE 1
30672 #else
30673 # define SQLITE_OS_WINCE 0
30674 #endif
30675
 
 
 
 
 
 
 
 
30676 /*
30677 ** For WinCE, some API function parameters do not appear to be declared as
30678 ** volatile.
30679 */
30680 #if SQLITE_OS_WINCE
@@ -30670,11 +30685,11 @@
30685
30686 /*
30687 ** For some Windows sub-platforms, the _beginthreadex() / _endthreadex()
30688 ** functions are not available (e.g. those not using MSVC, Cygwin, etc).
30689 */
30690 #if SQLITE_OS_WIN && !SQLITE_OS_WINCE && \
30691 SQLITE_THREADSAFE>0 && !defined(__CYGWIN__)
30692 # define SQLITE_OS_WIN_THREADS 1
30693 #else
30694 # define SQLITE_OS_WIN_THREADS 0
30695 #endif
@@ -30787,15 +30802,11 @@
30802 static int winMutexInit(void){
30803 /* The first to increment to 1 does actual initialization */
30804 if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
30805 int i;
30806 for(i=0; i<ArraySize(winMutex_staticMutexes); i++){
 
 
 
30807 InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
 
30808 }
30809 winMutex_isInit = 1;
30810 }else{
30811 /* Another thread is (in the process of) initializing the static
30812 ** mutexes */
@@ -30881,15 +30892,11 @@
30892 #ifdef SQLITE_DEBUG
30893 #ifdef SQLITE_WIN32_MUTEX_TRACE_DYNAMIC
30894 p->trace = 1;
30895 #endif
30896 #endif
 
 
 
30897 InitializeCriticalSection(&p->mutex);
 
30898 }
30899 break;
30900 }
30901 default: {
30902 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -38298,11 +38305,11 @@
38305
38306 /*****************************************************************************
38307 ** Debugging logic
38308 */
38309
38310 /* SQLITE_KV_TRACE() is used for tracing calls to kvrecord routines. */
38311 #if 0
38312 #define SQLITE_KV_TRACE(X) printf X
38313 #else
38314 #define SQLITE_KV_TRACE(X)
38315 #endif
@@ -38312,18 +38319,22 @@
38319 #define SQLITE_KV_LOG(X) printf X
38320 #else
38321 #define SQLITE_KV_LOG(X)
38322 #endif
38323
 
38324 /*
38325 ** Forward declaration of objects used by this VFS implementation
38326 */
38327 typedef struct KVVfsFile KVVfsFile;
38328
38329 /* A single open file. There are only two files represented by this
38330 ** VFS - the database and the rollback journal.
38331 **
38332 ** Maintenance reminder: if this struct changes in any way, the JSON
38333 ** rendering of its structure must be updated in
38334 ** sqlite3-wasm.c:sqlite3__wasm_enum_json(). There are no binary
38335 ** compatibility concerns, so it does not need an iVersion member.
38336 */
38337 struct KVVfsFile {
38338 sqlite3_file base; /* IO methods */
38339 const char *zClass; /* Storage class */
38340 int isJournal; /* True if this is a journal file */
@@ -38369,11 +38380,11 @@
38380 static int kvvfsSleep(sqlite3_vfs*, int microseconds);
38381 static int kvvfsCurrentTime(sqlite3_vfs*, double*);
38382 static int kvvfsCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
38383
38384 static sqlite3_vfs sqlite3OsKvvfsObject = {
38385 2, /* iVersion */
38386 sizeof(KVVfsFile), /* szOsFile */
38387 1024, /* mxPathname */
38388 0, /* pNext */
38389 "kvvfs", /* zName */
38390 0, /* pAppData */
@@ -38445,42 +38456,56 @@
38456 #include <sys/stat.h>
38457 #include <unistd.h>
38458
38459 /* Forward declarations for the low-level storage engine
38460 */
38461 #ifndef SQLITE_WASM
38462 /* In WASM builds these are implemented in JS. */
38463 static int kvrecordWrite(const char*, const char *zKey, const char *zData);
38464 static int kvrecordDelete(const char*, const char *zKey);
38465 static int kvrecordRead(const char*, const char *zKey, char *zBuf, int nBuf);
38466 #endif
38467 #ifndef KVRECORD_KEY_SZ
38468 #define KVRECORD_KEY_SZ 32
38469 #endif
38470
38471 /* Expand the key name with an appropriate prefix and put the result
38472 ** in zKeyOut[]. The zKeyOut[] buffer is assumed to hold at least
38473 ** KVRECORD_KEY_SZ bytes.
38474 */
38475 static void kvrecordMakeKey(
38476 const char *zClass,
38477 const char *zKeyIn,
38478 char *zKeyOut
38479 ){
38480 assert( zKeyIn );
38481 assert( zKeyOut );
38482 assert( zClass );
38483 sqlite3_snprintf(KVRECORD_KEY_SZ, zKeyOut, "kvvfs-%s-%s",
38484 zClass, zKeyIn);
38485 }
38486
38487 #ifndef SQLITE_WASM
38488 /* In WASM builds do not define APIs which use fopen(), fwrite(),
38489 ** and the like because those APIs are a portability issue for
38490 ** WASM.
38491 */
38492 /* Write content into a key. zClass is the particular namespace of the
38493 ** underlying key/value store to use - either "local" or "session".
38494 **
38495 ** Both zKey and zData are zero-terminated pure text strings.
38496 **
38497 ** Return the number of errors.
38498 */
38499 static int kvrecordWrite(
38500 const char *zClass,
38501 const char *zKey,
38502 const char *zData
38503 ){
38504 FILE *fd;
38505 char zXKey[KVRECORD_KEY_SZ];
38506 kvrecordMakeKey(zClass, zKey, zXKey);
38507 fd = fopen(zXKey, "wb");
38508 if( fd ){
38509 SQLITE_KV_TRACE(("KVVFS-WRITE %-15s (%d) %.50s%s\n", zXKey,
38510 (int)strlen(zData), zData,
38511 strlen(zData)>50 ? "..." : ""));
@@ -38494,13 +38519,13 @@
38519
38520 /* Delete a key (with its corresponding data) from the key/value
38521 ** namespace given by zClass. If the key does not previously exist,
38522 ** this routine is a no-op.
38523 */
38524 static int kvrecordDelete(const char *zClass, const char *zKey){
38525 char zXKey[KVRECORD_KEY_SZ];
38526 kvrecordMakeKey(zClass, zKey, zXKey);
38527 unlink(zXKey);
38528 SQLITE_KV_TRACE(("KVVFS-DELETE %-15s\n", zXKey));
38529 return 0;
38530 }
38531
@@ -38517,20 +38542,20 @@
38542 ** If nBuf<=0 then this routine simply returns the size of the data
38543 ** without actually reading it. Similarly, if nBuf==1 then it
38544 ** zero-terminates zBuf at zBuf[0] and returns the size of the data
38545 ** without reading it.
38546 */
38547 static int kvrecordRead(
38548 const char *zClass,
38549 const char *zKey,
38550 char *zBuf,
38551 int nBuf
38552 ){
38553 FILE *fd;
38554 struct stat buf;
38555 char zXKey[KVRECORD_KEY_SZ];
38556 kvrecordMakeKey(zClass, zKey, zXKey);
38557 if( access(zXKey, R_OK)!=0
38558 || stat(zXKey, &buf)!=0
38559 || !S_ISREG(buf.st_mode)
38560 ){
38561 SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
@@ -38558,27 +38583,39 @@
38583 SQLITE_KV_TRACE(("KVVFS-READ %-15s (%lld) %.50s%s\n", zXKey,
38584 n, zBuf, n>50 ? "..." : ""));
38585 return (int)n;
38586 }
38587 }
38588 #endif /* #ifndef SQLITE_WASM */
38589
38590
38591 /*
38592 ** An internal level of indirection which enables us to replace the
38593 ** kvvfs i/o methods with JavaScript implementations in WASM builds.
38594 ** Maintenance reminder: if this struct changes in any way, the JSON
38595 ** rendering of its structure must be updated in
38596 ** sqlite3-wasm.c:sqlite3__wasm_enum_json(). There are no binary
38597 ** compatibility concerns, so it does not need an iVersion member.
 
38598 */
38599 typedef struct sqlite3_kvvfs_methods sqlite3_kvvfs_methods;
38600 struct sqlite3_kvvfs_methods {
38601 int (*xRcrdRead)(const char*, const char *zKey, char *zBuf, int nBuf);
38602 int (*xRcrdWrite)(const char*, const char *zKey, const char *zData);
38603 int (*xRcrdDelete)(const char*, const char *zKey);
38604 const int nKeySize;
38605 const int nBufferSize;
38606 #ifndef SQLITE_WASM
38607 # define MAYBE_CONST const
38608 #else
38609 # define MAYBE_CONST
38610 #endif
38611 MAYBE_CONST sqlite3_vfs * pVfs;
38612 MAYBE_CONST sqlite3_io_methods *pIoDb;
38613 MAYBE_CONST sqlite3_io_methods *pIoJrnl;
38614 #undef MAYBE_CONST
38615 };
38616
38617
38618 /*
38619 ** This object holds the kvvfs I/O methods which may be swapped out
38620 ** for JavaScript-side implementations in WASM builds. In such builds
38621 ** it cannot be const, but in native builds it should be so that
@@ -38590,14 +38627,24 @@
38627 */
38628 #ifndef SQLITE_WASM
38629 const
38630 #endif
38631 SQLITE_PRIVATE sqlite3_kvvfs_methods sqlite3KvvfsMethods = {
38632 #ifndef SQLITE_WASM
38633 .xRcrdRead = kvrecordRead,
38634 .xRcrdWrite = kvrecordWrite,
38635 .xRcrdDelete = kvrecordDelete,
38636 #else
38637 .xRcrdRead = 0,
38638 .xRcrdWrite = 0,
38639 .xRcrdDelete = 0,
38640 #endif
38641 .nKeySize = KVRECORD_KEY_SZ,
38642 .nBufferSize = SQLITE_KVOS_SZ,
38643 .pVfs = &sqlite3OsKvvfsObject,
38644 .pIoDb = &kvvfs_db_io_methods,
38645 .pIoJrnl = &kvvfs_jrnl_io_methods
38646 };
38647
38648 /****** Utility subroutines ************************************************/
38649
38650 /*
@@ -38620,11 +38667,14 @@
38667 **
38668 ** * Because there is no overlap between the encoding characters
38669 ** of hexadecimal and base-26 numbers, it is always clear where
38670 ** one stops and the next begins.
38671 */
38672 #ifndef SQLITE_WASM
38673 static
38674 #endif
38675 int kvvfsEncode(const char *aData, int nData, char *aOut){
38676 int i, j;
38677 const unsigned char *a = (const unsigned char*)aData;
38678 for(i=j=0; i<nData; i++){
38679 unsigned char c = a[i];
38680 if( c!=0 ){
@@ -38671,13 +38721,17 @@
38721
38722 /*
38723 ** Decode the text encoding back to binary. The binary content is
38724 ** written into pOut, which must be at least nOut bytes in length.
38725 **
38726 ** The return value is the number of bytes actually written into aOut[], or
38727 ** -1 for malformed inputs.
38728 */
38729 #ifndef SQLITE_WASM
38730 static
38731 #endif
38732 int kvvfsDecode(const char *a, char *aOut, int nOut){
38733 int i, j;
38734 int c;
38735 const unsigned char *aIn = (const unsigned char*)a;
38736 i = 0;
38737 j = 0;
@@ -38698,11 +38752,11 @@
38752 j += n;
38753 if( c==0 || mult==1 ) break; /* progress stalled if mult==1 */
38754 }else{
38755 aOut[j] = c<<4;
38756 c = kvvfsHexValue[aIn[++i]];
38757 if( c<0 ) return -1 /* hex bytes are always in pairs */;
38758 aOut[j++] += c;
38759 i++;
38760 }
38761 }
38762 return j;
@@ -38751,17 +38805,18 @@
38805 ** Read or write the "sz" element, containing the database file size.
38806 */
38807 static sqlite3_int64 kvvfsReadFileSize(KVVfsFile *pFile){
38808 char zData[50];
38809 zData[0] = 0;
38810 sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "sz", zData,
38811 sizeof(zData)-1);
38812 return strtoll(zData, 0, 0);
38813 }
38814 static int kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){
38815 char zData[50];
38816 sqlite3_snprintf(sizeof(zData), zData, "%lld", sz);
38817 return sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, "sz", zData);
38818 }
38819
38820 /****** sqlite3_io_methods methods ******************************************/
38821
38822 /*
@@ -38772,10 +38827,13 @@
38827
38828 SQLITE_KV_LOG(("xClose %s %s\n", pFile->zClass,
38829 pFile->isJournal ? "journal" : "db"));
38830 sqlite3_free(pFile->aJrnl);
38831 sqlite3_free(pFile->aData);
38832 #ifdef SQLITE_WASM
38833 memset(pFile, 0, sizeof(*pFile));
38834 #endif
38835 return SQLITE_OK;
38836 }
38837
38838 /*
38839 ** Read from the -journal file.
@@ -38788,20 +38846,26 @@
38846 ){
38847 KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
38848 assert( pFile->isJournal );
38849 SQLITE_KV_LOG(("xRead('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
38850 if( pFile->aJrnl==0 ){
38851 int rc;
38852 int szTxt = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "jrnl",
38853 0, 0);
38854 char *aTxt;
38855 if( szTxt<=4 ){
38856 return SQLITE_IOERR;
38857 }
38858 aTxt = sqlite3_malloc64( szTxt+1 );
38859 if( aTxt==0 ) return SQLITE_NOMEM;
38860 rc = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "jrnl",
38861 aTxt, szTxt+1);
38862 if( rc>=0 ){
38863 kvvfsDecodeJournal(pFile, aTxt, szTxt);
38864 }
38865 sqlite3_free(aTxt);
38866 if( rc ) return rc;
38867 if( pFile->aJrnl==0 ) return SQLITE_IOERR;
38868 }
38869 if( iOfst+iAmt>pFile->nJrnl ){
38870 return SQLITE_IOERR_SHORT_READ;
38871 }
@@ -38837,12 +38901,12 @@
38901 pgno = 1 + iOfst/iAmt;
38902 }else{
38903 pgno = 1;
38904 }
38905 sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
38906 got = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, zKey,
38907 aData, SQLITE_KVOS_SZ-1);
38908 if( got<0 ){
38909 n = 0;
38910 }else{
38911 aData[got] = 0;
38912 if( iOfst+iAmt<512 ){
@@ -38906,35 +38970,36 @@
38970 ){
38971 KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
38972 unsigned int pgno;
38973 char zKey[30];
38974 char *aData = pFile->aData;
38975 int rc;
38976 SQLITE_KV_LOG(("xWrite('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
38977 assert( iAmt>=512 && iAmt<=65536 );
38978 assert( (iAmt & (iAmt-1))==0 );
38979 assert( pFile->szPage<0 || pFile->szPage==iAmt );
38980 pFile->szPage = iAmt;
38981 pgno = 1 + iOfst/iAmt;
38982 sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
38983 kvvfsEncode(zBuf, iAmt, aData);
38984 rc = sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, zKey, aData);
38985 if( 0==rc ){
38986 if( iOfst+iAmt > pFile->szDb ){
38987 pFile->szDb = iOfst + iAmt;
38988 }
38989 }
38990 return rc;
 
 
 
38991 }
38992
38993 /*
38994 ** Truncate an kvvfs-file.
38995 */
38996 static int kvvfsTruncateJrnl(sqlite3_file *pProtoFile, sqlite_int64 size){
38997 KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
38998 SQLITE_KV_LOG(("xTruncate('%s-journal',%lld)\n", pFile->zClass, size));
38999 assert( size==0 );
39000 sqlite3KvvfsMethods.xRcrdDelete(pFile->zClass, "jrnl");
39001 sqlite3_free(pFile->aJrnl);
39002 pFile->aJrnl = 0;
39003 pFile->nJrnl = 0;
39004 return SQLITE_OK;
39005 }
@@ -38949,11 +39014,11 @@
39014 SQLITE_KV_LOG(("xTruncate('%s-db',%lld)\n", pFile->zClass, size));
39015 pgno = 1 + size/pFile->szPage;
39016 pgnoMax = 2 + pFile->szDb/pFile->szPage;
39017 while( pgno<=pgnoMax ){
39018 sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
39019 sqlite3KvvfsMethods.xRcrdDelete(pFile->zClass, zKey);
39020 pgno++;
39021 }
39022 pFile->szDb = size;
39023 return kvvfsWriteFileSize(pFile, size) ? SQLITE_IOERR : SQLITE_OK;
39024 }
@@ -38981,11 +39046,11 @@
39046 zOut[i++] = 'a' + (n%26);
39047 n /= 26;
39048 }while( n>0 );
39049 zOut[i++] = ' ';
39050 kvvfsEncode(pFile->aJrnl, pFile->nJrnl, &zOut[i]);
39051 i = sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, "jrnl", zOut);
39052 sqlite3_free(zOut);
39053 return i ? SQLITE_IOERR : SQLITE_OK;
39054 }
39055 static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
39056 return SQLITE_OK;
@@ -39095,53 +39160,56 @@
39160 int *pOutFlags
39161 ){
39162 KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
39163 if( zName==0 ) zName = "";
39164 SQLITE_KV_LOG(("xOpen(\"%s\")\n", zName));
39165 assert(!pFile->zClass);
39166 assert(!pFile->aData);
39167 assert(!pFile->aJrnl);
39168 assert(!pFile->nJrnl);
39169 assert(!pFile->base.pMethods);
39170 pFile->szPage = -1;
39171 pFile->szDb = -1;
39172 if( 0==sqlite3_strglob("*-journal", zName) ){
 
39173 pFile->isJournal = 1;
39174 pFile->base.pMethods = &kvvfs_jrnl_io_methods;
39175 if( 0==strcmp("session-journal",zName) ){
39176 pFile->zClass = "session";
39177 }else if( 0==strcmp("local-journal",zName) ){
39178 pFile->zClass = "local";
39179 }
39180 }else{
39181 pFile->isJournal = 0;
39182 pFile->base.pMethods = &kvvfs_db_io_methods;
39183 }
39184 if( !pFile->zClass ){
39185 pFile->zClass = zName;
 
 
39186 }
39187 pFile->aData = sqlite3_malloc64(SQLITE_KVOS_SZ);
39188 if( pFile->aData==0 ){
39189 return SQLITE_NOMEM;
39190 }
 
 
 
 
39191 return SQLITE_OK;
39192 }
39193
39194 /*
39195 ** Delete the file located at zPath. If the dirSync argument is true,
39196 ** ensure the file-system modifications are synced to disk before
39197 ** returning.
39198 */
39199 static int kvvfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
39200 int rc /* The JS impl can fail with OOM in argument conversion */;
39201 if( strcmp(zPath, "local-journal")==0 ){
39202 rc = sqlite3KvvfsMethods.xRcrdDelete("local", "jrnl");
39203 }else
39204 if( strcmp(zPath, "session-journal")==0 ){
39205 rc = sqlite3KvvfsMethods.xRcrdDelete("session", "jrnl");
39206 }
39207 else{
39208 rc = 0;
39209 }
39210 return rc;
39211 }
39212
39213 /*
39214 ** Test for access permissions. Return true if the requested permission
39215 ** is available, or false otherwise.
@@ -39151,25 +39219,46 @@
39219 const char *zPath,
39220 int flags,
39221 int *pResOut
39222 ){
39223 SQLITE_KV_LOG(("xAccess(\"%s\")\n", zPath));
39224 #if 0 && defined(SQLITE_WASM)
39225 /*
39226 ** This is not having the desired effect in the JS bindings.
39227 ** It's ostensibly the same logic as the #else block, but
39228 ** it's not behaving that way.
39229 **
39230 ** In JS we map all zPaths to Storage objects, and -journal files
39231 ** are mapped to the storage for the main db (which is is exactly
39232 ** what the mapping of "local-journal" -> "local" is doing).
39233 */
39234 const char *zKey = (0==sqlite3_strglob("*-journal", zPath))
39235 ? "jrnl" : "sz";
39236 *pResOut =
39237 sqlite3KvvfsMethods.xRcrdRead(zPath, zKey, 0, 0)>0;
39238 #else
39239 if( strcmp(zPath, "local-journal")==0 ){
39240 *pResOut =
39241 sqlite3KvvfsMethods.xRcrdRead("local", "jrnl", 0, 0)>0;
39242 }else
39243 if( strcmp(zPath, "session-journal")==0 ){
39244 *pResOut =
39245 sqlite3KvvfsMethods.xRcrdRead("session", "jrnl", 0, 0)>0;
39246 }else
39247 if( strcmp(zPath, "local")==0 ){
39248 *pResOut =
39249 sqlite3KvvfsMethods.xRcrdRead("local", "sz", 0, 0)>0;
39250 }else
39251 if( strcmp(zPath, "session")==0 ){
39252 *pResOut =
39253 sqlite3KvvfsMethods.xRcrdRead("session", "sz", 0, 0)>0;
39254 }else
39255 {
39256 *pResOut = 0;
39257 }
39258 /*all current JS tests avoid triggering: assert( *pResOut == 0 ); */
39259 #endif
39260 SQLITE_KV_LOG(("xAccess returns %d\n",*pResOut));
39261 return SQLITE_OK;
39262 }
39263
39264 /*
@@ -41286,15 +41375,21 @@
41375 }else{
41376 pFile->eFileLock = SHARED_LOCK;
41377 pInode->nLock++;
41378 pInode->nShared = 1;
41379 }
41380 }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
 
 
41381 /* We are trying for an exclusive lock but another thread in this
41382 ** same process is still holding a shared lock. */
41383 rc = SQLITE_BUSY;
41384 }else if( unixIsSharingShmNode(pFile) ){
41385 /* We are in WAL mode and attempting to delete the SHM and WAL
41386 ** files due to closing the connection or changing out of WAL mode,
41387 ** but another process still holds locks on the SHM file, thus
41388 ** indicating that database locks have been broken, perhaps due
41389 ** to a rogue close(open(dbFile)) or similar.
41390 */
41391 rc = SQLITE_BUSY;
41392 }else{
41393 /* The request was for a RESERVED or EXCLUSIVE lock. It is
41394 ** assumed that there is a SHARED or greater lock on the file
41395 ** already.
@@ -43930,30 +44025,25 @@
44025 ** connection from running "PRAGMA journal_mode=DELETE" in order to take
44026 ** the database out of WAL mode, which is perhaps more serious, but is
44027 ** still not a disaster.
44028 */
44029 static int unixIsSharingShmNode(unixFile *pFile){
 
44030 unixShmNode *pShmNode;
44031 struct flock lock;
44032 if( pFile->pShm==0 ) return 0;
44033 if( pFile->ctrlFlags & UNIXFILE_EXCL ) return 0;
44034 pShmNode = pFile->pShm->pShmNode;
44035 #if SQLITE_ATOMIC_INTRINSICS
44036 assert( AtomicLoad(&pShmNode->nRef)==1 );
44037 #endif
44038 memset(&lock, 0, sizeof(lock));
44039 lock.l_whence = SEEK_SET;
44040 lock.l_start = UNIX_SHM_DMS;
44041 lock.l_len = 1;
44042 lock.l_type = F_WRLCK;
44043 osFcntl(pShmNode->hShm, F_GETLK, &lock);
44044 return (lock.l_type!=F_UNLCK);
 
 
 
 
 
44045 }
44046
44047 /*
44048 ** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
44049 **
@@ -47893,19 +47983,19 @@
47983
47984 /*
47985 ** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
47986 ** based on the sub-platform)?
47987 */
47988 #if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_ANSI)
47989 # define SQLITE_WIN32_HAS_ANSI
47990 #endif
47991
47992 /*
47993 ** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
47994 ** based on the sub-platform)?
47995 */
47996 #if (SQLITE_OS_WINCE || SQLITE_OS_WINNT) && \
47997 !defined(SQLITE_WIN32_NO_WIDE)
47998 # define SQLITE_WIN32_HAS_WIDE
47999 #endif
48000
48001 /*
@@ -48040,20 +48130,11 @@
48130 ** mode or memory mapped files (e.g. these APIs are available in the Windows
48131 ** CE SDK; however, they are not present in the header file)?
48132 */
48133 #if SQLITE_WIN32_FILEMAPPING_API && \
48134 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48135
 
 
 
 
 
 
 
 
 
48136 #if defined(SQLITE_WIN32_HAS_ANSI)
48137 WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE, LPSECURITY_ATTRIBUTES, \
48138 DWORD, DWORD, DWORD, LPCSTR);
48139 #endif /* defined(SQLITE_WIN32_HAS_ANSI) */
48140
@@ -48061,11 +48142,10 @@
48142 WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE, LPSECURITY_ATTRIBUTES, \
48143 DWORD, DWORD, DWORD, LPCWSTR);
48144 #endif /* defined(SQLITE_WIN32_HAS_WIDE) */
48145
48146 WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, SIZE_T);
 
48147
48148 /*
48149 ** These file mapping APIs are common to both Win32 and WinRT.
48150 */
48151
@@ -48352,11 +48432,11 @@
48432
48433 /*
48434 ** This function is not available on Windows CE or WinRT.
48435 */
48436
48437 #if SQLITE_OS_WINCE
48438 # define osAreFileApisANSI() 1
48439 #endif
48440
48441 /*
48442 ** Many system calls are accessed through pointer-to-functions so that
@@ -48367,11 +48447,11 @@
48447 static struct win_syscall {
48448 const char *zName; /* Name of the system call */
48449 sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
48450 sqlite3_syscall_ptr pDefault; /* Default value */
48451 } aSyscall[] = {
48452 #if !SQLITE_OS_WINCE
48453 { "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 },
48454 #else
48455 { "AreFileApisANSI", (SYSCALL)0, 0 },
48456 #endif
48457
@@ -48406,20 +48486,20 @@
48486 #endif
48487
48488 #define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \
48489 LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent)
48490
48491 #if defined(SQLITE_WIN32_HAS_WIDE)
48492 { "CreateFileW", (SYSCALL)CreateFileW, 0 },
48493 #else
48494 { "CreateFileW", (SYSCALL)0, 0 },
48495 #endif
48496
48497 #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
48498 LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
48499
48500 #if defined(SQLITE_WIN32_HAS_ANSI) && \
48501 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) && \
48502 SQLITE_WIN32_CREATEFILEMAPPINGA
48503 { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
48504 #else
48505 { "CreateFileMappingA", (SYSCALL)0, 0 },
@@ -48426,21 +48506,21 @@
48506 #endif
48507
48508 #define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
48509 DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
48510
48511 #if (SQLITE_OS_WINCE || defined(SQLITE_WIN32_HAS_WIDE)) && \
48512 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
48513 { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
48514 #else
48515 { "CreateFileMappingW", (SYSCALL)0, 0 },
48516 #endif
48517
48518 #define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
48519 DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent)
48520
48521 #if defined(SQLITE_WIN32_HAS_WIDE)
48522 { "CreateMutexW", (SYSCALL)CreateMutexW, 0 },
48523 #else
48524 { "CreateMutexW", (SYSCALL)0, 0 },
48525 #endif
48526
@@ -48522,11 +48602,11 @@
48602 #endif
48603
48604 #define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \
48605 LPDWORD))aSyscall[18].pCurrent)
48606
48607 #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
48608 { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 },
48609 #else
48610 { "GetDiskFreeSpaceW", (SYSCALL)0, 0 },
48611 #endif
48612
@@ -48539,11 +48619,11 @@
48619 { "GetFileAttributesA", (SYSCALL)0, 0 },
48620 #endif
48621
48622 #define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent)
48623
48624 #if defined(SQLITE_WIN32_HAS_WIDE)
48625 { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 },
48626 #else
48627 { "GetFileAttributesW", (SYSCALL)0, 0 },
48628 #endif
48629
@@ -48556,15 +48636,11 @@
48636 #endif
48637
48638 #define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \
48639 LPVOID))aSyscall[22].pCurrent)
48640
 
48641 { "GetFileSize", (SYSCALL)GetFileSize, 0 },
 
 
 
48642
48643 #define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent)
48644
48645 #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI)
48646 { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 },
@@ -48573,11 +48649,11 @@
48649 #endif
48650
48651 #define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \
48652 LPSTR*))aSyscall[24].pCurrent)
48653
48654 #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
48655 { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 },
48656 #else
48657 { "GetFullPathNameW", (SYSCALL)0, 0 },
48658 #endif
48659
@@ -48608,20 +48684,14 @@
48684 #endif
48685
48686 #define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \
48687 LPCSTR))aSyscall[27].pCurrent)
48688
 
48689 { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 },
 
 
 
 
48690 #define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent)
48691
48692 { "GetSystemTime", (SYSCALL)GetSystemTime, 0 },
 
48693 #define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent)
48694
48695 #if !SQLITE_OS_WINCE
48696 { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 },
48697 #else
@@ -48637,23 +48707,19 @@
48707 { "GetTempPathA", (SYSCALL)0, 0 },
48708 #endif
48709
48710 #define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent)
48711
48712 #if defined(SQLITE_WIN32_HAS_WIDE)
48713 { "GetTempPathW", (SYSCALL)GetTempPathW, 0 },
48714 #else
48715 { "GetTempPathW", (SYSCALL)0, 0 },
48716 #endif
48717
48718 #define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent)
48719
 
48720 { "GetTickCount", (SYSCALL)GetTickCount, 0 },
 
 
 
48721
48722 #define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)
48723
48724 #if defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_GETVERSIONEX
48725 { "GetVersionExA", (SYSCALL)GetVersionExA, 0 },
@@ -48662,11 +48728,11 @@
48728 #endif
48729
48730 #define osGetVersionExA ((BOOL(WINAPI*)( \
48731 LPOSVERSIONINFOA))aSyscall[34].pCurrent)
48732
48733 #if defined(SQLITE_WIN32_HAS_WIDE) && \
48734 SQLITE_WIN32_GETVERSIONEX
48735 { "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
48736 #else
48737 { "GetVersionExW", (SYSCALL)0, 0 },
48738 #endif
@@ -48677,24 +48743,16 @@
48743 { "HeapAlloc", (SYSCALL)HeapAlloc, 0 },
48744
48745 #define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \
48746 SIZE_T))aSyscall[36].pCurrent)
48747
 
48748 { "HeapCreate", (SYSCALL)HeapCreate, 0 },
 
 
 
48749
48750 #define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \
48751 SIZE_T))aSyscall[37].pCurrent)
48752
 
48753 { "HeapDestroy", (SYSCALL)HeapDestroy, 0 },
 
 
 
48754
48755 #define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent)
48756
48757 { "HeapFree", (SYSCALL)HeapFree, 0 },
48758
@@ -48708,20 +48766,16 @@
48766 { "HeapSize", (SYSCALL)HeapSize, 0 },
48767
48768 #define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \
48769 LPCVOID))aSyscall[41].pCurrent)
48770
 
48771 { "HeapValidate", (SYSCALL)HeapValidate, 0 },
 
 
 
48772
48773 #define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \
48774 LPCVOID))aSyscall[42].pCurrent)
48775
48776 #if !SQLITE_OS_WINCE
48777 { "HeapCompact", (SYSCALL)HeapCompact, 0 },
48778 #else
48779 { "HeapCompact", (SYSCALL)0, 0 },
48780 #endif
48781
@@ -48733,28 +48787,24 @@
48787 { "LoadLibraryA", (SYSCALL)0, 0 },
48788 #endif
48789
48790 #define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
48791
48792 #if defined(SQLITE_WIN32_HAS_WIDE) && \
48793 !defined(SQLITE_OMIT_LOAD_EXTENSION)
48794 { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 },
48795 #else
48796 { "LoadLibraryW", (SYSCALL)0, 0 },
48797 #endif
48798
48799 #define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent)
48800
 
48801 { "LocalFree", (SYSCALL)LocalFree, 0 },
 
 
 
48802
48803 #define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent)
48804
48805 #if !SQLITE_OS_WINCE
48806 { "LockFile", (SYSCALL)LockFile, 0 },
48807 #else
48808 { "LockFile", (SYSCALL)0, 0 },
48809 #endif
48810
@@ -48772,12 +48822,11 @@
48822 #ifndef osLockFileEx
48823 #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
48824 LPOVERLAPPED))aSyscall[48].pCurrent)
48825 #endif
48826
48827 #if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
 
48828 { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
48829 #else
48830 { "MapViewOfFile", (SYSCALL)0, 0 },
48831 #endif
48832
@@ -48801,33 +48850,25 @@
48850
48851 { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 },
48852
48853 #define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent)
48854
 
48855 { "SetFilePointer", (SYSCALL)SetFilePointer, 0 },
 
 
 
48856
48857 #define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
48858 DWORD))aSyscall[54].pCurrent)
48859
 
48860 { "Sleep", (SYSCALL)Sleep, 0 },
 
 
 
48861
48862 #define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent)
48863
48864 { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 },
48865
48866 #define osSystemTimeToFileTime ((BOOL(WINAPI*)(const SYSTEMTIME*, \
48867 LPFILETIME))aSyscall[56].pCurrent)
48868
48869 #if !SQLITE_OS_WINCE
48870 { "UnlockFile", (SYSCALL)UnlockFile, 0 },
48871 #else
48872 { "UnlockFile", (SYSCALL)0, 0 },
48873 #endif
48874
@@ -48861,129 +48902,54 @@
48902 { "WriteFile", (SYSCALL)WriteFile, 0 },
48903
48904 #define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
48905 LPOVERLAPPED))aSyscall[61].pCurrent)
48906
 
 
 
 
 
 
 
 
 
48907 /*
48908 ** For WaitForSingleObject(), MSDN says:
48909 **
48910 ** Minimum supported client: Windows XP [desktop apps | UWP apps]
48911 ** Minimum supported server: Windows Server 2003 [desktop apps | UWP apps]
48912 */
48913 { "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 },
48914
48915 #define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \
48916 DWORD))aSyscall[62].pCurrent)
48917
48918 #if !SQLITE_OS_WINCE
48919 { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 },
48920 #else
48921 { "WaitForSingleObjectEx", (SYSCALL)0, 0 },
48922 #endif
48923
48924 #define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \
48925 BOOL))aSyscall[63].pCurrent)
48926
48927 { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48928
48929 #define osGetNativeSystemInfo ((VOID(WINAPI*)( \
48930 LPSYSTEM_INFO))aSyscall[64].pCurrent)
48931
48932 #if defined(SQLITE_WIN32_HAS_ANSI)
48933 { "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 },
48934 #else
48935 { "OutputDebugStringA", (SYSCALL)0, 0 },
48936 #endif
48937
48938 #define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[65].pCurrent)
48939
48940 #if defined(SQLITE_WIN32_HAS_WIDE)
48941 { "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 },
48942 #else
48943 { "OutputDebugStringW", (SYSCALL)0, 0 },
48944 #endif
48945
48946 #define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[66].pCurrent)
48947
48948 { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
48949
48950 #define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[67].pCurrent)
 
 
 
 
 
 
 
 
 
48951
48952 /*
48953 ** NOTE: On some sub-platforms, the InterlockedCompareExchange "function"
48954 ** is really just a macro that uses a compiler intrinsic (e.g. x64).
48955 ** So do not try to make this is into a redefinable interface.
@@ -48994,38 +48960,38 @@
48960 #define osInterlockedCompareExchange InterlockedCompareExchange
48961 #else
48962 { "InterlockedCompareExchange", (SYSCALL)InterlockedCompareExchange, 0 },
48963
48964 #define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG \
48965 SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[68].pCurrent)
48966 #endif /* defined(InterlockedCompareExchange) */
48967
48968 #if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
48969 { "UuidCreate", (SYSCALL)UuidCreate, 0 },
48970 #else
48971 { "UuidCreate", (SYSCALL)0, 0 },
48972 #endif
48973
48974 #define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[69].pCurrent)
48975
48976 #if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
48977 { "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
48978 #else
48979 { "UuidCreateSequential", (SYSCALL)0, 0 },
48980 #endif
48981
48982 #define osUuidCreateSequential \
48983 ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[70].pCurrent)
48984
48985 #if !defined(SQLITE_NO_SYNC) && SQLITE_MAX_MMAP_SIZE>0
48986 { "FlushViewOfFile", (SYSCALL)FlushViewOfFile, 0 },
48987 #else
48988 { "FlushViewOfFile", (SYSCALL)0, 0 },
48989 #endif
48990
48991 #define osFlushViewOfFile \
48992 ((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[71].pCurrent)
48993
48994 /*
48995 ** If SQLITE_ENABLE_SETLK_TIMEOUT is defined, we require CreateEvent()
48996 ** to implement blocking locks with timeouts. MSDN says:
48997 **
@@ -49038,11 +49004,11 @@
49004 { "CreateEvent", (SYSCALL)0, 0 },
49005 #endif
49006
49007 #define osCreateEvent ( \
49008 (HANDLE(WINAPI*) (LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR)) \
49009 aSyscall[72].pCurrent \
49010 )
49011
49012 /*
49013 ** If SQLITE_ENABLE_SETLK_TIMEOUT is defined, we require CancelIo()
49014 ** for the case where a timeout expires and a lock request must be
@@ -49055,68 +49021,68 @@
49021 { "CancelIo", (SYSCALL)CancelIo, 0 },
49022 #else
49023 { "CancelIo", (SYSCALL)0, 0 },
49024 #endif
49025
49026 #define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[73].pCurrent)
49027
49028 #if defined(SQLITE_WIN32_HAS_WIDE) && defined(_WIN32)
49029 { "GetModuleHandleW", (SYSCALL)GetModuleHandleW, 0 },
49030 #else
49031 { "GetModuleHandleW", (SYSCALL)0, 0 },
49032 #endif
49033
49034 #define osGetModuleHandleW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[74].pCurrent)
49035
49036 #ifndef _WIN32
49037 { "getenv", (SYSCALL)getenv, 0 },
49038 #else
49039 { "getenv", (SYSCALL)0, 0 },
49040 #endif
49041
49042 #define osGetenv ((const char *(*)(const char *))aSyscall[75].pCurrent)
49043
49044 #ifndef _WIN32
49045 { "getcwd", (SYSCALL)getcwd, 0 },
49046 #else
49047 { "getcwd", (SYSCALL)0, 0 },
49048 #endif
49049
49050 #define osGetcwd ((char*(*)(char*,size_t))aSyscall[76].pCurrent)
49051
49052 #ifndef _WIN32
49053 { "readlink", (SYSCALL)readlink, 0 },
49054 #else
49055 { "readlink", (SYSCALL)0, 0 },
49056 #endif
49057
49058 #define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[77].pCurrent)
49059
49060 #ifndef _WIN32
49061 { "lstat", (SYSCALL)lstat, 0 },
49062 #else
49063 { "lstat", (SYSCALL)0, 0 },
49064 #endif
49065
49066 #define osLstat ((int(*)(const char*,struct stat*))aSyscall[78].pCurrent)
49067
49068 #ifndef _WIN32
49069 { "__errno", (SYSCALL)__errno, 0 },
49070 #else
49071 { "__errno", (SYSCALL)0, 0 },
49072 #endif
49073
49074 #define osErrno (*((int*(*)(void))aSyscall[79].pCurrent)())
49075
49076 #ifndef _WIN32
49077 { "cygwin_conv_path", (SYSCALL)cygwin_conv_path, 0 },
49078 #else
49079 { "cygwin_conv_path", (SYSCALL)0, 0 },
49080 #endif
49081
49082 #define osCygwin_conv_path ((size_t(*)(unsigned int, \
49083 const void *, void *, size_t))aSyscall[80].pCurrent)
49084
49085 }; /* End of the overrideable system calls */
49086
49087 /*
49088 ** This is the xSetSystemCall() method of sqlite3_vfs for all of the
@@ -49216,14 +49182,14 @@
49182
49183 winMemAssertMagic();
49184 hHeap = winMemGetHeap();
49185 assert( hHeap!=0 );
49186 assert( hHeap!=INVALID_HANDLE_VALUE );
49187 #if defined(SQLITE_WIN32_MALLOC_VALIDATE)
49188 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49189 #endif
49190 #if !SQLITE_OS_WINCE
49191 if( (nLargest=osHeapCompact(hHeap, SQLITE_WIN32_HEAP_FLAGS))==0 ){
49192 DWORD lastErrno = osGetLastError();
49193 if( lastErrno==NO_ERROR ){
49194 sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p",
49195 (void*)hHeap);
@@ -49332,32 +49298,15 @@
49298 }
49299 #endif
49300 }
49301 #endif /* _WIN32 */
49302
 
 
 
 
 
 
 
 
49303 SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){
 
 
 
 
 
 
 
 
49304 osSleep(milliseconds);
 
49305 }
49306
49307 #if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && \
49308 SQLITE_THREADSAFE>0
49309 SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){
49310 DWORD rc;
49311 while( (rc = osWaitForSingleObjectEx(hObject, INFINITE,
49312 TRUE))==WAIT_IO_COMPLETION ){}
@@ -49377,11 +49326,11 @@
49326 ** the LockFileEx() API.
49327 */
49328
49329 #if !SQLITE_WIN32_GETVERSIONEX
49330 # define osIsNT() (1)
49331 #elif SQLITE_OS_WINCE || !defined(SQLITE_WIN32_HAS_ANSI)
49332 # define osIsNT() (1)
49333 #elif !defined(SQLITE_WIN32_HAS_WIDE)
49334 # define osIsNT() (0)
49335 #else
49336 # define osIsNT() ((sqlite3_os_type==2) || sqlite3_win32_is_nt())
@@ -49390,17 +49339,11 @@
49339 /*
49340 ** This function determines if the machine is running a version of Windows
49341 ** based on the NT kernel.
49342 */
49343 SQLITE_API int sqlite3_win32_is_nt(void){
49344 #if SQLITE_WIN32_GETVERSIONEX
 
 
 
 
 
 
49345 if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){
49346 #if defined(SQLITE_WIN32_HAS_ANSI)
49347 OSVERSIONINFOA sInfo;
49348 sInfo.dwOSVersionInfoSize = sizeof(sInfo);
49349 osGetVersionExA(&sInfo);
@@ -49438,11 +49381,11 @@
49381
49382 winMemAssertMagic();
49383 hHeap = winMemGetHeap();
49384 assert( hHeap!=0 );
49385 assert( hHeap!=INVALID_HANDLE_VALUE );
49386 #if defined(SQLITE_WIN32_MALLOC_VALIDATE)
49387 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49388 #endif
49389 assert( nBytes>=0 );
49390 p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
49391 if( !p ){
@@ -49460,11 +49403,11 @@
49403
49404 winMemAssertMagic();
49405 hHeap = winMemGetHeap();
49406 assert( hHeap!=0 );
49407 assert( hHeap!=INVALID_HANDLE_VALUE );
49408 #if defined(SQLITE_WIN32_MALLOC_VALIDATE)
49409 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
49410 #endif
49411 if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
49412 if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){
49413 sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p",
@@ -49481,11 +49424,11 @@
49424
49425 winMemAssertMagic();
49426 hHeap = winMemGetHeap();
49427 assert( hHeap!=0 );
49428 assert( hHeap!=INVALID_HANDLE_VALUE );
49429 #if defined(SQLITE_WIN32_MALLOC_VALIDATE)
49430 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
49431 #endif
49432 assert( nBytes>=0 );
49433 if( !pPrior ){
49434 p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
@@ -49509,11 +49452,11 @@
49452
49453 winMemAssertMagic();
49454 hHeap = winMemGetHeap();
49455 assert( hHeap!=0 );
49456 assert( hHeap!=INVALID_HANDLE_VALUE );
49457 #if defined(SQLITE_WIN32_MALLOC_VALIDATE)
49458 assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, p) );
49459 #endif
49460 if( !p ) return 0;
49461 n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p);
49462 if( n==(SIZE_T)-1 ){
@@ -49539,11 +49482,11 @@
49482
49483 if( !pWinMemData ) return SQLITE_ERROR;
49484 assert( pWinMemData->magic1==WINMEM_MAGIC1 );
49485 assert( pWinMemData->magic2==WINMEM_MAGIC2 );
49486
49487 #if SQLITE_WIN32_HEAP_CREATE
49488 if( !pWinMemData->hHeap ){
49489 DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE;
49490 DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap;
49491 if( dwMaximumSize==0 ){
49492 dwMaximumSize = SQLITE_WIN32_HEAP_MAX_SIZE;
@@ -49572,11 +49515,11 @@
49515 pWinMemData->bOwned = FALSE;
49516 assert( !pWinMemData->bOwned );
49517 #endif
49518 assert( pWinMemData->hHeap!=0 );
49519 assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
49520 #if defined(SQLITE_WIN32_MALLOC_VALIDATE)
49521 assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49522 #endif
49523 return SQLITE_OK;
49524 }
49525
@@ -49590,11 +49533,11 @@
49533 assert( pWinMemData->magic1==WINMEM_MAGIC1 );
49534 assert( pWinMemData->magic2==WINMEM_MAGIC2 );
49535
49536 if( pWinMemData->hHeap ){
49537 assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
49538 #if defined(SQLITE_WIN32_MALLOC_VALIDATE)
49539 assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
49540 #endif
49541 if( pWinMemData->bOwned ){
49542 if( !osHeapDestroy(pWinMemData->hHeap) ){
49543 sqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p",
@@ -49971,21 +49914,10 @@
49914 */
49915 DWORD dwLen = 0;
49916 char *zOut = 0;
49917
49918 if( osIsNT() ){
 
 
 
 
 
 
 
 
 
 
 
49919 LPWSTR zTempWide = NULL;
49920 dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
49921 FORMAT_MESSAGE_FROM_SYSTEM |
49922 FORMAT_MESSAGE_IGNORE_INSERTS,
49923 NULL,
@@ -49992,20 +49924,17 @@
49924 lastErrno,
49925 0,
49926 (LPWSTR) &zTempWide,
49927 0,
49928 0);
 
49929 if( dwLen > 0 ){
49930 /* allocate a buffer and convert to UTF8 */
49931 sqlite3BeginBenignMalloc();
49932 zOut = winUnicodeToUtf8(zTempWide);
49933 sqlite3EndBenignMalloc();
 
49934 /* free the system buffer allocated by FormatMessage */
49935 osLocalFree(zTempWide);
 
49936 }
49937 }
49938 #ifdef SQLITE_WIN32_HAS_ANSI
49939 else{
49940 char *zTemp = NULL;
@@ -50662,11 +50591,10 @@
50591 ** error code.
50592 */
50593 static int winHandleSeek(HANDLE h, sqlite3_int64 iOffset){
50594 int rc = SQLITE_OK; /* Return value */
50595
 
50596 LONG upperBits; /* Most sig. 32 bits of new offset */
50597 LONG lowerBits; /* Least sig. 32 bits of new offset */
50598 DWORD dwRet; /* Value returned by SetFilePointer() */
50599
50600 upperBits = (LONG)((iOffset>>32) & 0x7fffffff);
@@ -50684,24 +50612,11 @@
50612 DWORD lastErrno = osGetLastError();
50613 if( lastErrno!=NO_ERROR ){
50614 rc = SQLITE_IOERR_SEEK;
50615 }
50616 }
50617 OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset,sqlite3ErrName(rc)));
 
 
 
 
 
 
 
 
 
 
 
 
 
50618 return rc;
50619 }
50620
50621 /*
50622 ** Move the current position of the file handle passed as the first
@@ -50998,32 +50913,19 @@
50913 ** Determine the size in bytes of the file opened by the handle passed as
50914 ** the first argument.
50915 */
50916 static int winHandleSize(HANDLE h, sqlite3_int64 *pnByte){
50917 int rc = SQLITE_OK;
 
 
 
 
 
 
 
 
 
 
 
50918 DWORD upperBits = 0;
50919 DWORD lowerBits = 0;
50920
50921 assert( pnByte );
50922 lowerBits = osGetFileSize(h, &upperBits);
50923 *pnByte = (((sqlite3_int64)upperBits)<<32) + lowerBits;
50924 if( lowerBits==INVALID_FILE_SIZE && osGetLastError()!=NO_ERROR ){
50925 rc = SQLITE_IOERR_FSTAT;
50926 }
 
 
50927 return rc;
50928 }
50929
50930 /*
50931 ** Close the handle passed as the only argument.
@@ -51218,24 +51120,10 @@
51120
51121 assert( id!=0 );
51122 assert( pSize!=0 );
51123 SimulateIOError(return SQLITE_IOERR_FSTAT);
51124 OSTRACE(("SIZE file=%p, pSize=%p\n", pFile->h, pSize));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51125 {
51126 DWORD upperBits;
51127 DWORD lowerBits;
51128 DWORD lastErrno;
51129
@@ -51246,11 +51134,10 @@
51134 pFile->lastErrno = lastErrno;
51135 rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
51136 "winFileSize", pFile->zPath);
51137 }
51138 }
 
51139 OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n",
51140 pFile->h, pSize, *pSize, sqlite3ErrName(rc)));
51141 return rc;
51142 }
51143
@@ -52208,33 +52095,18 @@
52095
52096 /* TODO: platforms.
52097 ** TODO: retry-on-ioerr.
52098 */
52099 if( osIsNT() ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52100 h = osCreateFileW((LPCWSTR)zConverted, /* lpFileName */
52101 (GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)), /* dwDesiredAccess */
52102 FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */
52103 NULL, /* lpSecurityAttributes */
52104 OPEN_ALWAYS, /* dwCreationDisposition */
52105 FILE_ATTRIBUTE_NORMAL|flag_overlapped,
52106 NULL
52107 );
 
52108 }else{
52109 /* Due to pre-processor directives earlier in this file,
52110 ** SQLITE_WIN32_HAS_ANSI is always defined if osIsNT() is false. */
52111 #ifdef SQLITE_WIN32_HAS_ANSI
52112 h = osCreateFileA((LPCSTR)zConverted,
@@ -52698,13 +52570,11 @@
52570
52571 while( pShmNode->nRegion<=iRegion ){
52572 HANDLE hMap = NULL; /* file-mapping handle */
52573 void *pMap = 0; /* Mapped memory region */
52574
52575 #if defined(SQLITE_WIN32_HAS_WIDE)
 
 
52576 hMap = osCreateFileMappingW(hShared, NULL, protect, 0, nByte, NULL);
52577 #elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
52578 hMap = osCreateFileMappingA(hShared, NULL, protect, 0, nByte, NULL);
52579 #endif
52580
@@ -52712,19 +52582,13 @@
52582 osGetCurrentProcessId(), pShmNode->nRegion, nByte,
52583 hMap ? "ok" : "failed"));
52584 if( hMap ){
52585 int iOffset = pShmNode->nRegion*szRegion;
52586 int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;
 
 
 
 
 
52587 pMap = osMapViewOfFile(hMap, flags,
52588 0, iOffset - iOffsetShift, szRegion + iOffsetShift
52589 );
 
52590 OSTRACE(("SHM-MAP-MAP pid=%lu, region=%d, offset=%d, size=%d, rc=%s\n",
52591 osGetCurrentProcessId(), pShmNode->nRegion, iOffset,
52592 szRegion, pMap ? "ok" : "failed"));
52593 }
52594 if( !pMap ){
@@ -52853,13 +52717,11 @@
52717 if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
52718 protect = PAGE_READWRITE;
52719 flags |= FILE_MAP_WRITE;
52720 }
52721 #endif
52722 #if defined(SQLITE_WIN32_HAS_WIDE)
 
 
52723 pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
52724 (DWORD)((nMap>>32) & 0xffffffff),
52725 (DWORD)(nMap & 0xffffffff), NULL);
52726 #elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
52727 pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect,
@@ -52875,15 +52737,11 @@
52737 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
52738 return SQLITE_OK;
52739 }
52740 assert( (nMap % winSysInfo.dwPageSize)==0 );
52741 assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
 
 
 
52742 pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
 
52743 if( pNew==NULL ){
52744 osCloseHandle(pFd->hMap);
52745 pFd->hMap = NULL;
52746 pFd->lastErrno = osGetLastError();
52747 rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
@@ -53214,11 +53072,10 @@
53072 }
53073 }
53074 }
53075 #endif
53076
 
53077 else if( osIsNT() ){
53078 char *zMulti;
53079 LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) );
53080 if( !zWidePath ){
53081 sqlite3_free(zBuf);
@@ -53268,11 +53125,10 @@
53125 OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
53126 return SQLITE_IOERR_NOMEM_BKPT;
53127 }
53128 }
53129 #endif /* SQLITE_WIN32_HAS_ANSI */
 
53130
53131 /*
53132 ** Check to make sure the temporary directory ends with an appropriate
53133 ** separator. If it does not and there is not enough space left to add
53134 ** one, fail.
@@ -53443,17 +53299,10 @@
53299
53300 assert( pFile!=0 );
53301 memset(pFile, 0, sizeof(winFile));
53302 pFile->h = INVALID_HANDLE_VALUE;
53303
 
 
 
 
 
 
 
53304 /* If the second argument to this function is NULL, generate a
53305 ** temporary file name to use
53306 */
53307 if( !zUtf8Name ){
53308 assert( isDelete && !isOpenJournal );
@@ -53532,35 +53381,10 @@
53381 #if SQLITE_OS_WINCE
53382 dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
53383 #endif
53384
53385 if( osIsNT() ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53386 do{
53387 h = osCreateFileW((LPCWSTR)zConverted,
53388 dwDesiredAccess,
53389 dwShareMode, NULL,
53390 dwCreationDisposition,
@@ -53573,11 +53397,10 @@
53397 rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO);
53398 sqlite3EndBenignMalloc();
53399 if( rc2==SQLITE_OK && isRO ) break;
53400 }
53401 }while( winRetryIoerr(&cnt, &lastErrno) );
 
53402 }
53403 #ifdef SQLITE_WIN32_HAS_ANSI
53404 else{
53405 do{
53406 h = osCreateFileA((LPCSTR)zConverted,
@@ -53710,29 +53533,11 @@
53533 OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
53534 return SQLITE_IOERR_NOMEM_BKPT;
53535 }
53536 if( osIsNT() ){
53537 do {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53538 attr = osGetFileAttributesW(zConverted);
 
53539 if ( attr==INVALID_FILE_ATTRIBUTES ){
53540 lastErrno = osGetLastError();
53541 if( lastErrno==ERROR_FILE_NOT_FOUND
53542 || lastErrno==ERROR_PATH_NOT_FOUND ){
53543 rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
@@ -53851,10 +53656,11 @@
53656 attr = INVALID_FILE_ATTRIBUTES;
53657 }else{
53658 attr = sAttrData.dwFileAttributes;
53659 }
53660 }else{
53661 if( noRetry ) lastErrno = osGetLastError();
53662 winLogIoerr(cnt, __LINE__);
53663 if( lastErrno!=ERROR_FILE_NOT_FOUND && lastErrno!=ERROR_PATH_NOT_FOUND ){
53664 sqlite3_free(zConverted);
53665 return winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess",
53666 zFilename);
@@ -54019,11 +53825,11 @@
53825 sqlite3_vfs *pVfs, /* Pointer to vfs object */
53826 const char *zRelative, /* Possibly relative input path */
53827 int nFull, /* Size of output buffer in bytes */
53828 char *zFull /* Output buffer */
53829 ){
53830 #if !SQLITE_OS_WINCE
53831 int nByte;
53832 void *zConverted;
53833 char *zOut;
53834 #endif
53835
@@ -54108,11 +53914,11 @@
53914 return rc;
53915 }
53916 }
53917 #endif /* __CYGWIN__ */
53918
53919 #if SQLITE_OS_WINCE && defined(_WIN32)
53920 SimulateIOError( return SQLITE_ERROR );
53921 /* WinCE has no concept of a relative pathname, or so I am told. */
53922 /* WinRT has no way to convert a relative path to an absolute one. */
53923 if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){
53924 /*
@@ -54127,11 +53933,11 @@
53933 sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative);
53934 }
53935 return SQLITE_OK;
53936 #endif
53937
53938 #if !SQLITE_OS_WINCE
53939 #if defined(_WIN32)
53940 /* It's odd to simulate an io-error here, but really this is just
53941 ** using the io-error infrastructure to test that SQLite handles this
53942 ** function failing. This function could fail if, for example, the
53943 ** current working directory has been unlinked.
@@ -54259,15 +54065,11 @@
54065 if( zConverted==0 ){
54066 OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0));
54067 return 0;
54068 }
54069 if( osIsNT() ){
 
 
 
54070 h = osLoadLibraryW((LPCWSTR)zConverted);
 
54071 }
54072 #ifdef SQLITE_WIN32_HAS_ANSI
54073 else{
54074 h = osLoadLibraryA((char*)zConverted);
54075 }
@@ -54345,37 +54147,30 @@
54147 }
54148 {
54149 DWORD pid = osGetCurrentProcessId();
54150 xorMemory(&e, (unsigned char*)&pid, sizeof(DWORD));
54151 }
 
 
 
 
 
 
54152 {
54153 DWORD cnt = osGetTickCount();
54154 xorMemory(&e, (unsigned char*)&cnt, sizeof(DWORD));
54155 }
 
54156 {
54157 LARGE_INTEGER i;
54158 osQueryPerformanceCounter(&i);
54159 xorMemory(&e, (unsigned char*)&i, sizeof(LARGE_INTEGER));
54160 }
54161 #if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
54162 {
54163 UUID id;
54164 memset(&id, 0, sizeof(UUID));
54165 osUuidCreate(&id);
54166 xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
54167 memset(&id, 0, sizeof(UUID));
54168 osUuidCreateSequential(&id);
54169 xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
54170 }
54171 #endif /* !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID */
54172 return e.nXor>nBuf ? nBuf : e.nXor;
54173 #endif /* defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) */
54174 }
54175
54176
@@ -54602,19 +54397,20 @@
54397 };
54398 #endif
54399
54400 /* Double-check that the aSyscall[] array has been constructed
54401 ** correctly. See ticket [bb3a86e890c8e96ab] */
54402 assert( ArraySize(aSyscall)==81 );
54403 assert( strcmp(aSyscall[0].zName,"AreFileApisANSI")==0 );
54404 assert( strcmp(aSyscall[20].zName,"GetFileAttributesA")==0 );
54405 assert( strcmp(aSyscall[40].zName,"HeapReAlloc")==0 );
54406 assert( strcmp(aSyscall[60].zName,"WideCharToMultiByte")==0 );
54407 assert( strcmp(aSyscall[80].zName,"cygwin_conv_path")==0 );
54408
54409 /* get memory map allocation granularity */
54410 memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
 
 
 
54411 osGetSystemInfo(&winSysInfo);
 
54412 assert( winSysInfo.dwAllocationGranularity>0 );
54413 assert( winSysInfo.dwPageSize>0 );
54414
54415 sqlite3_vfs_register(&winVfs, 1);
54416
@@ -54634,21 +54430,13 @@
54430
54431 return SQLITE_OK;
54432 }
54433
54434 SQLITE_API int sqlite3_os_end(void){
 
 
 
 
 
 
 
54435 #ifndef SQLITE_OMIT_WAL
54436 winBigLock = 0;
54437 #endif
 
54438 return SQLITE_OK;
54439 }
54440
54441 #endif /* SQLITE_OS_WIN */
54442
@@ -110848,14 +110636,12 @@
110636 }
110637 if( iCol>0 ){
110638 /* Convert the ORDER BY term into an integer column number iCol,
110639 ** taking care to preserve the COLLATE clause if it exists. */
110640 if( !IN_RENAME_OBJECT ){
110641 Expr *pNew = sqlite3ExprInt32(db, iCol);
110642 if( pNew==0 ) return 1;
 
 
110643 if( pItem->pExpr==pE ){
110644 pItem->pExpr = pNew;
110645 }else{
110646 Expr *pParent = pItem->pExpr;
110647 assert( pParent->op==TK_COLLATE );
@@ -111205,14 +110991,10 @@
110991 }
110992 }
110993 }
110994 #endif
110995
 
 
 
 
110996 sNC.ncFlags |= NC_AllowAgg|NC_AllowWin;
110997
110998 /* If this is a converted compound query, move the ORDER BY clause from
110999 ** the sub-query back to the parent query. At this point each term
111000 ** within the ORDER BY clause has been transformed to an integer value.
@@ -112447,38 +112229,26 @@
112229 int op, /* Expression opcode */
112230 const Token *pToken, /* Token argument. Might be NULL */
112231 int dequote /* True to dequote */
112232 ){
112233 Expr *pNew;
112234 int nExtra = pToken ? pToken->n+1 : 0;
 
112235
112236 assert( db!=0 );
 
 
 
 
 
 
 
112237 pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
112238 if( pNew ){
112239 memset(pNew, 0, sizeof(Expr));
112240 pNew->op = (u8)op;
112241 pNew->iAgg = -1;
112242 if( nExtra ){
112243 assert( pToken!=0 );
112244 pNew->u.zToken = (char*)&pNew[1];
112245 assert( pToken->z!=0 || pToken->n==0 );
112246 if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
112247 pNew->u.zToken[pToken->n] = 0;
112248 if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
112249 sqlite3DequoteExpr(pNew);
 
 
 
 
112250 }
112251 }
112252 #if SQLITE_MAX_EXPR_DEPTH>0
112253 pNew->nHeight = 1;
112254 #endif
@@ -112498,10 +112268,28 @@
112268 Token x;
112269 x.z = zToken;
112270 x.n = sqlite3Strlen30(zToken);
112271 return sqlite3ExprAlloc(db, op, &x, 0);
112272 }
112273
112274 /*
112275 ** Allocate an expression for a 32-bit signed integer literal.
112276 */
112277 SQLITE_PRIVATE Expr *sqlite3ExprInt32(sqlite3 *db, int iVal){
112278 Expr *pNew = sqlite3DbMallocRawNN(db, sizeof(Expr));
112279 if( pNew ){
112280 memset(pNew, 0, sizeof(Expr));
112281 pNew->op = TK_INTEGER;
112282 pNew->iAgg = -1;
112283 pNew->flags = EP_IntValue|EP_Leaf|(iVal?EP_IsTrue:EP_IsFalse);
112284 pNew->u.iValue = iVal;
112285 #if SQLITE_MAX_EXPR_DEPTH>0
112286 pNew->nHeight = 1;
112287 #endif
112288 }
112289 return pNew;
112290 }
112291
112292 /*
112293 ** Attach subtrees pLeft and pRight to the Expr node pRoot.
112294 **
112295 ** If pRoot==NULL that means that a memory allocation error has occurred.
@@ -112661,11 +112449,11 @@
112449 if( (f&(EP_OuterON|EP_InnerON|EP_IsFalse|EP_HasFunc))==EP_IsFalse
112450 && !IN_RENAME_OBJECT
112451 ){
112452 sqlite3ExprDeferredDelete(pParse, pLeft);
112453 sqlite3ExprDeferredDelete(pParse, pRight);
112454 return sqlite3ExprInt32(db, 0);
112455 }else{
112456 return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
112457 }
112458 }
112459 }
@@ -112786,11 +112574,13 @@
112574 const Expr *pExpr, /* The function invocation */
112575 const FuncDef *pDef /* The function being invoked */
112576 ){
112577 assert( !IN_RENAME_OBJECT );
112578 assert( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 );
112579 if( ExprHasProperty(pExpr, EP_FromDDL)
112580 || pParse->prepFlags & SQLITE_PREPARE_FROM_DDL
112581 ){
112582 if( (pDef->funcFlags & SQLITE_FUNC_DIRECT)!=0
112583 || (pParse->db->flags & SQLITE_TrustedSchema)==0
112584 ){
112585 /* Functions prohibited in triggers and views if:
112586 ** (1) tagged with SQLITE_DIRECTONLY
@@ -114136,11 +113926,11 @@
113926 return w.eCode;
113927 }
113928
113929 /*
113930 ** Walk an expression tree. Return non-zero if the expression is constant
113931 ** or return zero if the expression involves variables or function calls.
113932 **
113933 ** For the purposes of this function, a double-quoted string (ex: "abc")
113934 ** is considered a variable but a single-quoted string (ex: 'abc') is
113935 ** a constant.
113936 **
@@ -115403,13 +115193,26 @@
115193 nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
115194 sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);
115195 pParse->nMem += nReg;
115196 if( pExpr->op==TK_SELECT ){
115197 dest.eDest = SRT_Mem;
115198 if( (pSel->selFlags&SF_Distinct) && pSel->pLimit && pSel->pLimit->pRight ){
115199 /* If there is both a DISTINCT and an OFFSET clause, then allocate
115200 ** a separate dest.iSdst array for sqlite3Select() and other
115201 ** routines to populate. In this case results will be copied over
115202 ** into the dest.iSDParm array only after OFFSET processing. This
115203 ** ensures that in the case where OFFSET excludes all rows, the
115204 ** dest.iSDParm array is not left populated with the contents of the
115205 ** last row visited - it should be all NULLs if all rows were
115206 ** excluded by OFFSET. */
115207 dest.iSdst = pParse->nMem+1;
115208 pParse->nMem += nReg;
115209 }else{
115210 dest.iSdst = dest.iSDParm;
115211 }
115212 dest.nSdst = nReg;
115213 sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, pParse->nMem);
115214 VdbeComment((v, "Init subquery result"));
115215 }else{
115216 dest.eDest = SRT_Exists;
115217 sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm);
115218 VdbeComment((v, "Init EXISTS result"));
@@ -115421,11 +115224,11 @@
115224 Expr *pLeft = pSel->pLimit->pLeft;
115225 if( ExprHasProperty(pLeft, EP_IntValue)==0
115226 || (pLeft->u.iValue!=1 && pLeft->u.iValue!=0)
115227 ){
115228 sqlite3 *db = pParse->db;
115229 pLimit = sqlite3ExprInt32(db, 0);
115230 if( pLimit ){
115231 pLimit->affExpr = SQLITE_AFF_NUMERIC;
115232 pLimit = sqlite3PExpr(pParse, TK_NE,
115233 sqlite3ExprDup(db, pLeft, 0), pLimit);
115234 }
@@ -115432,11 +115235,11 @@
115235 sqlite3ExprDeferredDelete(pParse, pLeft);
115236 pSel->pLimit->pLeft = pLimit;
115237 }
115238 }else{
115239 /* If there is no pre-existing limit add a limit of 1 */
115240 pLimit = sqlite3ExprInt32(pParse->db, 1);
115241 pSel->pLimit = sqlite3PExpr(pParse, TK_LIMIT, pLimit, 0);
115242 }
115243 pSel->iLimit = 0;
115244 if( sqlite3Select(pParse, pSel, &dest) ){
115245 pExpr->op2 = pExpr->op;
@@ -120551,12 +120354,12 @@
120354 for(pStep=pNew->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext){
120355 if( pStep->pSelect ){
120356 sqlite3SelectPrep(pParse, pStep->pSelect, &sNC);
120357 if( pParse->nErr ) rc = pParse->rc;
120358 }
120359 if( rc==SQLITE_OK && pStep->pSrc ){
120360 SrcList *pSrc = sqlite3SrcListDup(db, pStep->pSrc, 0);
120361 if( pSrc ){
120362 Select *pSel = sqlite3SelectNew(
120363 pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
120364 );
120365 if( pSel==0 ){
@@ -120580,14 +120383,14 @@
120383 assert( pSrc==pSel->pSrc );
120384 if( pStep->pExprList ) pSel->pEList = 0;
120385 pSel->pSrc = 0;
120386 sqlite3SelectDelete(db, pSel);
120387 }
120388 if( ALWAYS(pStep->pSrc) ){
120389 int i;
120390 for(i=0; i<pStep->pSrc->nSrc && rc==SQLITE_OK; i++){
120391 SrcItem *p = &pStep->pSrc->a[i];
120392 if( p->fg.isSubquery ){
120393 assert( p->u4.pSubq!=0 );
120394 sqlite3SelectPrep(pParse, p->u4.pSubq->pSelect, 0);
120395 }
120396 }
@@ -120652,17 +120455,17 @@
120455 sqlite3WalkExprList(pWalker, pUpsert->pUpsertTarget);
120456 sqlite3WalkExprList(pWalker, pUpsert->pUpsertSet);
120457 sqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere);
120458 sqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere);
120459 }
120460 if( pStep->pSrc ){
120461 int i;
120462 SrcList *pSrc = pStep->pSrc;
120463 for(i=0; i<pSrc->nSrc; i++){
120464 if( pSrc->a[i].fg.isSubquery ){
120465 assert( pSrc->a[i].u4.pSubq!=0 );
120466 sqlite3WalkSelect(pWalker, pSrc->a[i].u4.pSubq->pSelect);
120467 }
120468 }
120469 }
120470 }
120471 }
@@ -120829,12 +120632,12 @@
120632 TriggerStep *pStep;
120633 rc = renameResolveTrigger(&sParse);
120634 if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
120635
120636 for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){
120637 if( pStep->pSrc ){
120638 Table *pTarget = sqlite3LocateTableItem(&sParse, 0, &pStep->pSrc->a[0]);
120639 if( pTarget==pTab ){
120640 if( pStep->pUpsert ){
120641 ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet;
120642 renameColumnElistNames(&sParse, &sCtx, pUpsertSet, zOld);
120643 }
@@ -120841,11 +120644,10 @@
120644 renameColumnIdlistNames(&sParse, &sCtx, pStep->pIdList, zOld);
120645 renameColumnElistNames(&sParse, &sCtx, pStep->pExprList, zOld);
120646 }
120647 }
120648 }
 
120649
120650 /* Find tokens to edit in UPDATE OF clause */
120651 if( sParse.pTriggerTab==pTab ){
120652 renameColumnIdlistNames(&sParse, &sCtx,sParse.pNewTrigger->pColumns,zOld);
120653 }
@@ -121044,17 +120846,14 @@
120846 if( isLegacy==0 ){
120847 rc = renameResolveTrigger(&sParse);
120848 if( rc==SQLITE_OK ){
120849 renameWalkTrigger(&sWalker, pTrigger);
120850 for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
120851 if( pStep->pSrc ){
 
 
 
120852 int i;
120853 for(i=0; i<pStep->pSrc->nSrc; i++){
120854 SrcItem *pItem = &pStep->pSrc->a[i];
120855 if( 0==sqlite3_stricmp(pItem->zName, zOld) ){
120856 renameTokenFind(&sParse, &sCtx, pItem->zName);
120857 }
120858 }
120859 }
@@ -121297,10 +121096,61 @@
121096 #ifndef SQLITE_OMIT_AUTHORIZATION
121097 db->xAuth = xAuth;
121098 #endif
121099 }
121100
121101
121102 /*
121103 ** Return the number of bytes until the end of the next non-whitespace and
121104 ** non-comment token. For the purpose of this function, a "(" token includes
121105 ** all of the bytes through and including the matching ")", or until the
121106 ** first illegal token, whichever comes first.
121107 **
121108 ** Write the token type into *piToken.
121109 **
121110 ** The value returned is the number of bytes in the token itself plus
121111 ** the number of bytes of leading whitespace and comments skipped plus
121112 ** all bytes through the next matching ")" if the token is TK_LP.
121113 **
121114 ** Example: (Note: '.' used in place of '*' in the example z[] text)
121115 **
121116 ** ,--------- *piToken := TK_RP
121117 ** v
121118 ** z[] = " /.comment./ --comment\n (two three four) five"
121119 ** | |
121120 ** |<-------------------------------------->|
121121 ** |
121122 ** `--- return value
121123 */
121124 static int getConstraintToken(const u8 *z, int *piToken){
121125 int iOff = 0;
121126 int t = 0;
121127 do {
121128 iOff += sqlite3GetToken(&z[iOff], &t);
121129 }while( t==TK_SPACE || t==TK_COMMENT );
121130
121131 *piToken = t;
121132
121133 if( t==TK_LP ){
121134 int nNest = 1;
121135 while( nNest>0 ){
121136 iOff += sqlite3GetToken(&z[iOff], &t);
121137 if( t==TK_LP ){
121138 nNest++;
121139 }else if( t==TK_RP ){
121140 t = TK_LP;
121141 nNest--;
121142 }else if( t==TK_ILLEGAL ){
121143 break;
121144 }
121145 }
121146 }
121147
121148 *piToken = t;
121149 return iOff;
121150 }
121151
121152 /*
121153 ** The implementation of internal UDF sqlite_drop_column().
121154 **
121155 ** Arguments:
121156 **
@@ -121341,19 +121191,28 @@
121191 /* This can happen if the sqlite_schema table is corrupt */
121192 rc = SQLITE_CORRUPT_BKPT;
121193 goto drop_column_done;
121194 }
121195
 
121196 if( iCol<pTab->nCol-1 ){
121197 RenameToken *pEnd;
121198 pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zCnName);
121199 pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zCnName);
121200 zEnd = (const char*)pEnd->t.z;
121201 }else{
121202 int eTok;
121203 assert( IsOrdinaryTable(pTab) );
121204 assert( iCol!=0 );
121205 /* Point pCol->t.z at the "," immediately preceding the definition of
121206 ** the column being dropped. To do this, start at the name of the
121207 ** previous column, and tokenize until the next ",". */
121208 pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol-1].zCnName);
121209 do {
121210 pCol->t.z += getConstraintToken((const u8*)pCol->t.z, &eTok);
121211 }while( eTok!=TK_COMMA );
121212 pCol->t.z--;
121213 zEnd = (const char*)&zSql[pTab->u.tab.addColOffset];
 
121214 }
121215
121216 zNew = sqlite3MPrintf(db, "%.*s%s", pCol->t.z-zSql, zSql, zEnd);
121217 sqlite3_result_text(context, zNew, -1, SQLITE_TRANSIENT);
121218 sqlite3_free(zNew);
@@ -121533,60 +121392,10 @@
121392 }
121393 return nRet;
121394 }
121395
121396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121397 /*
121398 ** Argument z points into the body of a constraint - specifically the
121399 ** second token of the constraint definition. For a named constraint,
121400 ** z points to the first token past the CONSTRAINT keyword. For an
121401 ** unnamed NOT NULL constraint, z points to the first byte past the NOT
@@ -121632,17 +121441,22 @@
121441 ** non-zero if they differ. Normally return SQLITE_OK, except if there
121442 ** is an OOM, set the OOM error condition on ctx and return SQLITE_NOMEM.
121443 */
121444 static int quotedCompare(
121445 sqlite3_context *ctx, /* Function context on which to report errors */
121446 int t, /* Token type */
121447 const u8 *zQuote, /* Possibly quoted text. Not zero-terminated. */
121448 int nQuote, /* Length of zQuote in bytes */
121449 const u8 *zCmp, /* Zero-terminated, unquoted name to compare against */
121450 int *pRes /* OUT: Set to 0 if equal, non-zero if unequal */
121451 ){
121452 char *zCopy = 0; /* De-quoted, zero-terminated copy of zQuote[] */
121453
121454 if( t==TK_ILLEGAL ){
121455 *pRes = 1;
121456 return SQLITE_OK;
121457 }
121458 zCopy = sqlite3MallocZero(nQuote+1);
121459 if( zCopy==0 ){
121460 sqlite3_result_error_nomem(ctx);
121461 return SQLITE_NOMEM_BKPT;
121462 }
@@ -121737,11 +121551,11 @@
121551
121552 /* Compare the next token - which may be quoted - with the name of
121553 ** the constraint being dropped. */
121554 nTok = getConstraintToken(&zSql[iOff], &t);
121555 if( zCons ){
121556 if( quotedCompare(ctx, t, &zSql[iOff], nTok, zCons, &cmp) ) return;
121557 }
121558 iOff += nTok;
121559
121560 /* The next token is usually the first token of the constraint
121561 ** definition. This is enough to tell the type of the constraint -
@@ -122131,11 +121945,11 @@
121945 if( t==TK_CONSTRAINT ){
121946 int nTok = 0;
121947 int cmp = 0;
121948 iOff += getWhitespace(&zSql[iOff]);
121949 nTok = getConstraintToken(&zSql[iOff], &t);
121950 if( quotedCompare(ctx, t, &zSql[iOff], nTok, zCons, &cmp) ) return;
121951 if( cmp==0 ){
121952 sqlite3_result_int(ctx, 1);
121953 return;
121954 }
121955 }else if( t==TK_ILLEGAL ){
@@ -124842,11 +124656,11 @@
124656 ){
124657 while( pStep ){
124658 if( sqlite3WalkSelect(&pFix->w, pStep->pSelect)
124659 || sqlite3WalkExpr(&pFix->w, pStep->pWhere)
124660 || sqlite3WalkExprList(&pFix->w, pStep->pExprList)
124661 || sqlite3FixSrcList(pFix, pStep->pSrc)
124662 ){
124663 return 1;
124664 }
124665 #ifndef SQLITE_OMIT_UPSERT
124666 {
@@ -131588,11 +131402,11 @@
131402 ** * Do not allow DELETE, INSERT, or UPDATE of SQLITE_VTAB_DIRECTONLY
131403 ** virtual tables
131404 ** * Only allow DELETE, INSERT, or UPDATE of non-SQLITE_VTAB_INNOCUOUS
131405 ** virtual tables if PRAGMA trusted_schema=ON.
131406 */
131407 if( (pParse->pToplevel!=0 || (pParse->prepFlags & SQLITE_PREPARE_FROM_DDL))
131408 && pTab->u.vtab.p->eVtabRisk >
131409 ((pParse->db->flags & SQLITE_TrustedSchema)!=0)
131410 ){
131411 sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"",
131412 pTab->zName);
@@ -136687,10 +136501,11 @@
136501 ** the lookaside buffer belonging to database handle dbMem.
136502 */
136503 static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){
136504 if( p ){
136505 TriggerStep *pStep = p->step_list;
136506 sqlite3SrcListDelete(dbMem, pStep->pSrc);
136507 sqlite3ExprDelete(dbMem, pStep->pWhere);
136508 sqlite3ExprListDelete(dbMem, pStep->pExprList);
136509 sqlite3SelectDelete(dbMem, pStep->pSelect);
136510 sqlite3ExprDelete(dbMem, p->pWhen);
136511 sqlite3DbFree(dbMem, p);
@@ -137353,18 +137168,18 @@
137168 /* Disable lookaside memory allocation */
137169 DisableLookaside;
137170
137171 pTrigger = (Trigger *)sqlite3DbMallocZero(db,
137172 sizeof(Trigger) + /* struct Trigger */
137173 sizeof(TriggerStep) /* Single step in trigger program */
 
137174 );
137175 if( pTrigger ){
137176 pStep = pTrigger->step_list = (TriggerStep *)&pTrigger[1];
137177 pStep->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
137178 if( pStep->pSrc ){
137179 pStep->pSrc->a[0].zName = sqlite3DbStrNDup(db, zFrom, nFrom);
137180 }
137181 pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
137182 pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE);
137183 pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
137184 if( pWhen ){
137185 pWhen = sqlite3PExpr(pParse, TK_NOT, pWhen, 0);
@@ -142392,37 +142207,46 @@
142207
142208 /* If no entry point was specified and the default legacy
142209 ** entry point name "sqlite3_extension_init" was not found, then
142210 ** construct an entry point name "sqlite3_X_init" where the X is
142211 ** replaced by the lowercase value of every ASCII alphabetic
142212 ** character in the filename after the last "/" up to the first ".",
142213 ** and skipping the first three characters if they are "lib".
142214 ** Examples:
142215 **
142216 ** /usr/local/lib/libExample5.4.3.so ==> sqlite3_example_init
142217 ** C:/lib/mathfuncs.dll ==> sqlite3_mathfuncs_init
142218 **
142219 ** If that still finds no entry point, repeat a second time but this
142220 ** time include both alphabetic and numeric characters up to the first
142221 ** ".". Example:
142222 **
142223 ** /usr/local/lib/libExample5.4.3.so ==> sqlite3_example5_init
142224 */
142225 if( xInit==0 && zProc==0 ){
142226 int iFile, iEntry, c;
142227 int ncFile = sqlite3Strlen30(zFile);
142228 int cnt = 0;
142229 zAltEntry = sqlite3_malloc64(ncFile+30);
142230 if( zAltEntry==0 ){
142231 sqlite3OsDlClose(pVfs, handle);
142232 return SQLITE_NOMEM_BKPT;
142233 }
142234 do{
142235 memcpy(zAltEntry, "sqlite3_", 8);
142236 for(iFile=ncFile-1; iFile>=0 && !DirSep(zFile[iFile]); iFile--){}
142237 iFile++;
142238 if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
142239 for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
142240 if( sqlite3Isalpha(c) || (cnt && sqlite3Isdigit(c)) ){
142241 zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];
142242 }
142243 }
142244 memcpy(zAltEntry+iEntry, "_init", 6);
142245 zEntry = zAltEntry;
142246 xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
142247 }while( xInit==0 && (++cnt)<2 );
142248 }
142249 if( xInit==0 ){
142250 if( pzErrMsg ){
142251 nMsg += strlen(zEntry) + 300;
142252 *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg);
@@ -148998,13 +148822,18 @@
148822 case SRT_Mem: {
148823 if( pSort ){
148824 assert( nResultCol<=pDest->nSdst );
148825 pushOntoSorter(
148826 pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg);
148827 pDest->iSDParm = regResult;
148828 }else{
148829 assert( nResultCol==pDest->nSdst );
148830 if( regResult!=iParm ){
148831 /* This occurs in cases where the SELECT had both a DISTINCT and
148832 ** an OFFSET clause. */
148833 sqlite3VdbeAddOp3(v, OP_Copy, regResult, iParm, nResultCol-1);
148834 }
148835 /* The LIMIT clause will jump out of the loop for us */
148836 }
148837 break;
148838 }
148839 #endif /* #ifndef SQLITE_OMIT_SUBQUERY */
@@ -151165,14 +150994,12 @@
150994 assert( pItem!=0 );
150995 assert( pItem->u.x.iOrderByCol>0 );
150996 if( pItem->u.x.iOrderByCol==i ) break;
150997 }
150998 if( j==nOrderBy ){
150999 Expr *pNew = sqlite3ExprInt32(db, i);
151000 if( pNew==0 ) return SQLITE_NOMEM_BKPT;
 
 
151001 p->pOrderBy = pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
151002 if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i;
151003 }
151004 }
151005 }
@@ -153731,11 +153558,11 @@
153558 }
153559 sqlite3SrcItemAttachSubquery(pParse, pFrom, pTab->u.view.pSelect, 1);
153560 }
153561 #ifndef SQLITE_OMIT_VIRTUALTABLE
153562 else if( ALWAYS(IsVirtual(pTab))
153563 && (pFrom->fg.fromDDL || (pParse->prepFlags & SQLITE_PREPARE_FROM_DDL))
153564 && ALWAYS(pTab->u.vtab.p!=0)
153565 && pTab->u.vtab.p->eVtabRisk > ((db->flags & SQLITE_TrustedSchema)!=0)
153566 ){
153567 sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"",
153568 pTab->zName);
@@ -154684,11 +154511,11 @@
154511 if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy)
154512 && ExprAlwaysFalse(pExpr)==0
154513 && pExpr->pAggInfo==0
154514 ){
154515 sqlite3 *db = pWalker->pParse->db;
154516 Expr *pNew = sqlite3ExprInt32(db, 1);
154517 if( pNew ){
154518 Expr *pWhere = pS->pWhere;
154519 SWAP(Expr, *pNew, *pExpr);
154520 pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew);
154521 pS->pWhere = pNew;
@@ -155015,16 +154842,28 @@
154842 Expr *pSubWhere = pSub->pWhere;
154843 if( pSub->pSrc->nSrc==1
154844 && (pSub->selFlags & SF_Aggregate)==0
154845 && !pSub->pSrc->a[0].fg.isSubquery
154846 && pSub->pLimit==0
154847 && pSub->pPrior==0
154848 ){
154849 /* Before combining the sub-select with the parent, renumber the
154850 ** cursor used by the subselect. This is because the EXISTS expression
154851 ** might be a copy of another EXISTS expression from somewhere
154852 ** else in the tree, and in this case it is important that it use
154853 ** a unique cursor number. */
154854 sqlite3 *db = pParse->db;
154855 int *aCsrMap = sqlite3DbMallocZero(db, (pParse->nTab+2)*sizeof(int));
154856 if( aCsrMap==0 ) return;
154857 aCsrMap[0] = (pParse->nTab+1);
154858 renumberCursors(pParse, pSub, -1, aCsrMap);
154859 sqlite3DbFree(db, aCsrMap);
154860
154861 memset(pWhere, 0, sizeof(*pWhere));
154862 pWhere->op = TK_INTEGER;
154863 pWhere->u.iValue = 1;
154864 ExprSetProperty(pWhere, EP_IntValue);
 
154865 assert( p->pWhere!=0 );
154866 pSub->pSrc->a[0].fg.fromExists = 1;
154867 pSub->pSrc->a[0].fg.jointype |= JT_CROSS;
154868 p->pSrc = sqlite3SrcListAppendList(pParse, p->pSrc, pSub->pSrc);
154869 if( pSubWhere ){
@@ -155152,10 +154991,34 @@
154991 memset(&sCtx, 0, sizeof(sCtx));
154992 sCtx.pSrc = pSelect->pSrc;
154993 sqlite3WalkExprNN(&w, pSelect->pWhere);
154994 pSelect->selFlags &= ~SF_OnToWhere;
154995 }
154996
154997 /*
154998 ** If p2 exists and p1 and p2 have the same number of terms, then change
154999 ** every term of p1 to have the same sort order as p2 and return true.
155000 **
155001 ** If p2 is NULL or p1 and p2 are different lengths, then make no changes
155002 ** and return false.
155003 **
155004 ** p1 must be non-NULL.
155005 */
155006 static int sqlite3CopySortOrder(ExprList *p1, ExprList *p2){
155007 assert( p1 );
155008 if( p2 && p1->nExpr==p2->nExpr ){
155009 int ii;
155010 for(ii=0; ii<p1->nExpr; ii++){
155011 u8 sortFlags;
155012 sortFlags = p2->a[ii].fg.sortFlags & KEYINFO_ORDER_DESC;
155013 p1->a[ii].fg.sortFlags = sortFlags;
155014 }
155015 return 1;
155016 }else{
155017 return 0;
155018 }
155019 }
155020
155021 /*
155022 ** Generate byte-code for the SELECT statement given in the p argument.
155023 **
155024 ** The results are returned according to the SelectDest structure.
@@ -155805,11 +155668,12 @@
155668 ** used for both the ORDER BY and DISTINCT processing. As originally
155669 ** written the query must use a temp-table for at least one of the ORDER
155670 ** BY and DISTINCT, and an index or separate temp-table for the other.
155671 */
155672 if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct
155673 && sqlite3CopySortOrder(pEList, sSort.pOrderBy)
155674 && sqlite3ExprListCompare(pEList, sSort.pOrderBy, -1)==0
155675 && OptimizationEnabled(db, SQLITE_GroupByOrder)
155676 #ifndef SQLITE_OMIT_WINDOWFUNC
155677 && p->pWin==0
155678 #endif
155679 ){
@@ -156019,25 +155883,14 @@
155883 ** in the correct order. It also may not - the GROUP BY might use a
155884 ** database index that causes rows to be grouped together as required
155885 ** but not actually sorted. Either way, record the fact that the
155886 ** ORDER BY and GROUP BY clauses are the same by setting the orderByGrp
155887 ** variable. */
155888 if( sqlite3CopySortOrder(pGroupBy, sSort.pOrderBy)
155889 && sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0
155890 ){
155891 orderByGrp = 1;
 
 
 
 
 
 
 
 
 
 
 
155892 }
155893 }else{
155894 assert( 0==sqlite3LogEst(1) );
155895 p->nSelectRow = 0;
155896 }
@@ -156843,11 +156696,11 @@
156696 sqlite3ExprDelete(db, pTmp->pWhere);
156697 sqlite3ExprListDelete(db, pTmp->pExprList);
156698 sqlite3SelectDelete(db, pTmp->pSelect);
156699 sqlite3IdListDelete(db, pTmp->pIdList);
156700 sqlite3UpsertDelete(db, pTmp->pUpsert);
156701 sqlite3SrcListDelete(db, pTmp->pSrc);
156702 sqlite3DbFree(db, pTmp->zSpan);
156703
156704 sqlite3DbFree(db, pTmp);
156705 }
156706 }
@@ -157032,15 +156885,20 @@
156885 }
156886 goto trigger_cleanup;
156887 }
156888 }
156889
156890 /* NB: The SQLITE_ALLOW_TRIGGERS_ON_SYSTEM_TABLES compile-time option is
156891 ** experimental and unsupported. Do not use it unless understand the
156892 ** implications and you cannot get by without this capability. */
156893 #if !defined(SQLITE_ALLOW_TRIGGERS_ON_SYSTEM_TABLES) /* Experimental */
156894 /* Do not create a trigger on a system table */
156895 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
156896 sqlite3ErrorMsg(pParse, "cannot create trigger on system table");
156897 goto trigger_cleanup;
156898 }
156899 #endif
156900
156901 /* INSTEAD of triggers are only for views and views only support INSTEAD
156902 ** of triggers.
156903 */
156904 if( IsView(pTab) && tr_tm!=TK_INSTEAD ){
@@ -157182,16 +157040,16 @@
157040 ** are read-only, and the trigger makes a change to a shadow table,
157041 ** then raise an error - do not allow the trigger to be created. */
157042 if( sqlite3ReadOnlyShadowTables(db) ){
157043 TriggerStep *pStep;
157044 for(pStep=pTrig->step_list; pStep; pStep=pStep->pNext){
157045 if( pStep->pSrc!=0
157046 && sqlite3ShadowTableName(db, pStep->pSrc->a[0].zName)
157047 ){
157048 sqlite3ErrorMsg(pParse,
157049 "trigger \"%s\" may not write to shadow table \"%s\"",
157050 pTrig->zName, pStep->pSrc->a[0].zName);
157051 goto triggerfinish_cleanup;
157052 }
157053 }
157054 }
157055
@@ -157278,30 +157136,43 @@
157136 ** If an OOM error occurs, NULL is returned and db->mallocFailed is set.
157137 */
157138 static TriggerStep *triggerStepAllocate(
157139 Parse *pParse, /* Parser context */
157140 u8 op, /* Trigger opcode */
157141 SrcList *pTabList, /* Target table */
157142 const char *zStart, /* Start of SQL text */
157143 const char *zEnd /* End of SQL text */
157144 ){
157145 Trigger *pNew = pParse->pNewTrigger;
157146 sqlite3 *db = pParse->db;
157147 TriggerStep *pTriggerStep = 0;
157148
157149 if( pParse->nErr==0 ){
157150 if( pNew
157151 && pNew->pSchema!=db->aDb[1].pSchema
157152 && pTabList->a[0].u4.zDatabase
157153 ){
157154 sqlite3ErrorMsg(pParse,
157155 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
157156 "statements within triggers");
157157 }else{
157158 pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));
157159 if( pTriggerStep ){
157160 pTriggerStep->pSrc = sqlite3SrcListDup(db, pTabList, EXPRDUP_REDUCE);
157161 pTriggerStep->op = op;
157162 pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd);
157163 if( pTriggerStep->pSrc && IN_RENAME_OBJECT ){
157164 sqlite3RenameTokenRemap(pParse,
157165 pTriggerStep->pSrc->a[0].zName,
157166 pTabList->a[0].zName
157167 );
157168 }
157169 }
157170 }
157171 }
157172
157173 sqlite3SrcListDelete(db, pTabList);
157174 return pTriggerStep;
157175 }
157176
157177 /*
157178 ** Build a trigger step out of an INSERT statement. Return a pointer
@@ -157310,11 +157181,11 @@
157181 ** The parser calls this routine when it sees an INSERT inside the
157182 ** body of a trigger.
157183 */
157184 SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(
157185 Parse *pParse, /* Parser */
157186 SrcList *pTabList, /* Table to INSERT into */
157187 IdList *pColumn, /* List of columns in pTableName to insert into */
157188 Select *pSelect, /* A SELECT statement that supplies values */
157189 u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
157190 Upsert *pUpsert, /* ON CONFLICT clauses for upsert */
157191 const char *zStart, /* Start of SQL text */
@@ -157323,11 +157194,11 @@
157194 sqlite3 *db = pParse->db;
157195 TriggerStep *pTriggerStep;
157196
157197 assert(pSelect != 0 || db->mallocFailed);
157198
157199 pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTabList, zStart, zEnd);
157200 if( pTriggerStep ){
157201 if( IN_RENAME_OBJECT ){
157202 pTriggerStep->pSelect = pSelect;
157203 pSelect = 0;
157204 }else{
@@ -157355,11 +157226,11 @@
157226 ** a pointer to that trigger step. The parser calls this routine when it
157227 ** sees an UPDATE statement inside the body of a CREATE TRIGGER.
157228 */
157229 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(
157230 Parse *pParse, /* Parser */
157231 SrcList *pTabList, /* Name of the table to be updated */
157232 SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */
157233 ExprList *pEList, /* The SET clause: list of column and new values */
157234 Expr *pWhere, /* The WHERE clause */
157235 u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
157236 const char *zStart, /* Start of SQL text */
@@ -157366,25 +157237,40 @@
157237 const char *zEnd /* End of SQL text */
157238 ){
157239 sqlite3 *db = pParse->db;
157240 TriggerStep *pTriggerStep;
157241
157242 pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTabList, zStart, zEnd);
157243 if( pTriggerStep ){
157244 SrcList *pFromDup = 0;
157245 if( IN_RENAME_OBJECT ){
157246 pTriggerStep->pExprList = pEList;
157247 pTriggerStep->pWhere = pWhere;
157248 pFromDup = pFrom;
157249 pEList = 0;
157250 pWhere = 0;
157251 pFrom = 0;
157252 }else{
157253 pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE);
157254 pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
157255 pFromDup = sqlite3SrcListDup(db, pFrom, EXPRDUP_REDUCE);
157256 }
157257 pTriggerStep->orconf = orconf;
157258
157259 if( pFromDup && !IN_RENAME_OBJECT){
157260 Select *pSub;
157261 Token as = {0, 0};
157262 pSub = sqlite3SelectNew(pParse, 0, pFromDup, 0,0,0,0, SF_NestedFrom, 0);
157263 pFromDup = sqlite3SrcListAppendFromTerm(pParse, 0, 0, 0, &as, pSub ,0);
157264 }
157265 if( pFromDup && pTriggerStep->pSrc ){
157266 pTriggerStep->pSrc = sqlite3SrcListAppendList(
157267 pParse, pTriggerStep->pSrc, pFromDup
157268 );
157269 }else{
157270 sqlite3SrcListDelete(db, pFromDup);
157271 }
157272 }
157273 sqlite3ExprListDelete(db, pEList);
157274 sqlite3ExprDelete(db, pWhere);
157275 sqlite3SrcListDelete(db, pFrom);
157276 return pTriggerStep;
@@ -157395,19 +157281,19 @@
157281 ** a pointer to that trigger step. The parser calls this routine when it
157282 ** sees a DELETE statement inside the body of a CREATE TRIGGER.
157283 */
157284 SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(
157285 Parse *pParse, /* Parser */
157286 SrcList *pTabList, /* The table from which rows are deleted */
157287 Expr *pWhere, /* The WHERE clause */
157288 const char *zStart, /* Start of SQL text */
157289 const char *zEnd /* End of SQL text */
157290 ){
157291 sqlite3 *db = pParse->db;
157292 TriggerStep *pTriggerStep;
157293
157294 pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTabList, zStart, zEnd);
157295 if( pTriggerStep ){
157296 if( IN_RENAME_OBJECT ){
157297 pTriggerStep->pWhere = pWhere;
157298 pWhere = 0;
157299 }else{
@@ -157665,56 +157551,10 @@
157551 return 0;
157552 }
157553 return triggersReallyExist(pParse,pTab,op,pChanges,pMask);
157554 }
157555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157556 /*
157557 ** Return true if the pExpr term from the RETURNING clause argument
157558 ** list is of the form "*". Raise an error if the terms if of the
157559 ** form "table.*".
157560 */
@@ -157976,21 +157816,21 @@
157816 #endif
157817
157818 switch( pStep->op ){
157819 case TK_UPDATE: {
157820 sqlite3Update(pParse,
157821 sqlite3SrcListDup(db, pStep->pSrc, 0),
157822 sqlite3ExprListDup(db, pStep->pExprList, 0),
157823 sqlite3ExprDup(db, pStep->pWhere, 0),
157824 pParse->eOrconf, 0, 0, 0
157825 );
157826 sqlite3VdbeAddOp0(v, OP_ResetCount);
157827 break;
157828 }
157829 case TK_INSERT: {
157830 sqlite3Insert(pParse,
157831 sqlite3SrcListDup(db, pStep->pSrc, 0),
157832 sqlite3SelectDup(db, pStep->pSelect, 0),
157833 sqlite3IdListDup(db, pStep->pIdList),
157834 pParse->eOrconf,
157835 sqlite3UpsertDup(db, pStep->pUpsert)
157836 );
@@ -157997,11 +157837,11 @@
157837 sqlite3VdbeAddOp0(v, OP_ResetCount);
157838 break;
157839 }
157840 case TK_DELETE: {
157841 sqlite3DeleteFrom(pParse,
157842 sqlite3SrcListDup(db, pStep->pSrc, 0),
157843 sqlite3ExprDup(db, pStep->pWhere, 0), 0, 0
157844 );
157845 sqlite3VdbeAddOp0(v, OP_ResetCount);
157846 break;
157847 }
@@ -160319,13 +160159,15 @@
160159 if( rc!=SQLITE_OK ) goto end_of_vacuum;
160160 assert( (db->nDb-1)==nDb );
160161 pDb = &db->aDb[nDb];
160162 assert( strcmp(pDb->zDbSName,zDbVacuum)==0 );
160163 pTemp = pDb->pBt;
160164 nRes = sqlite3BtreeGetRequestedReserve(pMain);
160165 if( pOut ){
160166 sqlite3_file *id = sqlite3PagerFile(sqlite3BtreePager(pTemp));
160167 i64 sz = 0;
160168 const char *zFilename;
160169 if( id->pMethods!=0 && (sqlite3OsFileSize(id, &sz)!=SQLITE_OK || sz>0) ){
160170 rc = SQLITE_ERROR;
160171 sqlite3SetString(pzErrMsg, db, "output file already exists");
160172 goto end_of_vacuum;
160173 }
@@ -160333,12 +160175,20 @@
160175
160176 /* For a VACUUM INTO, the pager-flags are set to the same values as
160177 ** they are for the database being vacuumed, except that PAGER_CACHESPILL
160178 ** is always set. */
160179 pgflags = db->aDb[iDb].safety_level | (db->flags & PAGER_FLAGS_MASK);
160180
160181 /* If the VACUUM INTO target file is a URI filename and if the
160182 ** "reserve=N" query parameter is present, reset the reserve to the
160183 ** amount specified, if the amount is within range */
160184 zFilename = sqlite3BtreeGetFilename(pTemp);
160185 if( ALWAYS(zFilename) ){
160186 int nNew = (int)sqlite3_uri_int64(zFilename, "reserve", nRes);
160187 if( nNew>=0 && nNew<=255 ) nRes = nNew;
160188 }
160189 }
 
160190
160191 sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);
160192 sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));
160193 sqlite3BtreeSetPagerFlags(pTemp, pgflags|PAGER_CACHESPILL);
160194
@@ -167114,17 +166964,15 @@
166964 sqlite3 *db = pParse->db;
166965 Expr *pNew;
166966 int iVal = 0;
166967
166968 if( sqlite3ExprIsInteger(pExpr, &iVal, pParse) && iVal>=0 ){
166969 Expr *pVal = sqlite3ExprInt32(db, iVal);
166970 if( pVal==0 ) return;
 
 
166971 pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
166972 }else{
166973 Expr *pVal = sqlite3ExprAlloc(db, TK_REGISTER, 0, 0);
166974 if( pVal==0 ) return;
166975 pVal->iTable = iReg;
166976 pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
166977 }
166978 if( pNew ){
@@ -168947,15 +168795,18 @@
168795
168796 /* No matches cause a break out of the loop */
168797 break;
168798 }
168799 if( i==n ){
168800 int bSortByGroup = (pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0;
168801 nOrderBy = n;
168802 if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) && !pSrc->fg.rowidUsed ){
168803 eDistinct = 2 + bSortByGroup;
168804 }else if( pWInfo->wctrlFlags & WHERE_GROUPBY ){
168805 eDistinct = 1 - bSortByGroup;
168806 }else if( pWInfo->wctrlFlags & WHERE_WANT_DISTINCT ){
168807 eDistinct = 3;
168808 }
168809 }
168810 }
168811
168812 /* Allocate the sqlite3_index_info structure
@@ -172533,13 +172384,11 @@
172384 if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue;
172385 }else{
172386 pLoop = pLast;
172387 }
172388 if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){
172389 if( pLoop->u.vtab.isOrdered && pWInfo->pOrderBy==pOrderBy ){
 
 
172390 obSat = obDone;
172391 }else{
172392 /* No further ORDER BY terms may be matched. So this call should
172393 ** return >=0, not -1. Clear isOrderDistinct to ensure it does so. */
172394 isOrderDistinct = 0;
@@ -173876,10 +173725,11 @@
173725 pWInfo->revMask = (m1 & pWInfo->revMask) | ((pWInfo->revMask>>1) & ~m1);
173726 notReady &= ~pLoop->maskSelf;
173727 for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
173728 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
173729 pTerm->wtFlags |= TERM_CODED;
173730 pTerm->prereqAll = 0;
173731 }
173732 }
173733 if( i!=pWInfo->nLevel-1 ){
173734 int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
173735 memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
@@ -174813,10 +174663,13 @@
174663 WhereLoop *pLoop;
174664 SrcList *pTabList = pWInfo->pTabList;
174665 sqlite3 *db = pParse->db;
174666 int iEnd = sqlite3VdbeCurrentAddr(v);
174667 int nRJ = 0;
174668 #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174669 int addrSeek = 0;
174670 #endif
174671
174672 /* Generate loop termination code.
174673 */
174674 VdbeModuleComment((v, "End WHERE-core"));
174675 for(i=pWInfo->nLevel-1; i>=0; i--){
@@ -174825,20 +174678,22 @@
174678 if( pLevel->pRJ ){
174679 /* Terminate the subroutine that forms the interior of the loop of
174680 ** the RIGHT JOIN table */
174681 WhereRightJoin *pRJ = pLevel->pRJ;
174682 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174683 /* Replace addrCont with a new label that will never be used, just so
174684 ** the subsequent call to resolve pLevel->addrCont will have something
174685 ** to resolve. */
174686 pLevel->addrCont = sqlite3VdbeMakeLabel(pParse);
174687 pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
174688 sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
174689 VdbeCoverage(v);
174690 nRJ++;
174691 }
174692 pLoop = pLevel->pWLoop;
174693 if( pLevel->op!=OP_Noop ){
174694 #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
 
174695 Index *pIdx;
174696 int n;
174697 if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
174698 && i==pWInfo->nLevel-1 /* Ticket [ef9318757b152e3] 2017-10-21 */
174699 && (pLoop->wsFlags & WHERE_INDEXED)!=0
@@ -174857,29 +174712,30 @@
174712 VdbeCoverageIf(v, op==OP_SeekLT);
174713 VdbeCoverageIf(v, op==OP_SeekGT);
174714 sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
174715 }
174716 #endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
174717 }
174718 if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
174719 /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
174720 ** loop(s) will be the inner-most loops of the join. There might be
174721 ** multiple EXISTS loops, but they will all be nested, and the join
174722 ** order will not have been changed by the query planner. If the
174723 ** inner-most EXISTS loop sees a single successful row, it should
174724 ** break out of *all* EXISTS loops. But only the inner-most of the
174725 ** nested EXISTS loops should do this breakout. */
174726 int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
174727 while( nOuter<i ){
174728 if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
174729 nOuter++;
174730 }
174731 testcase( nOuter>0 );
174732 sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
174733 VdbeComment((v, "EXISTS break"));
174734 }
174735 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174736 if( pLevel->op!=OP_Noop ){
174737 sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);
174738 sqlite3VdbeChangeP5(v, pLevel->p5);
174739 VdbeCoverage(v);
174740 VdbeCoverageIf(v, pLevel->op==OP_Next);
174741 VdbeCoverageIf(v, pLevel->op==OP_Prev);
@@ -174888,14 +174744,15 @@
174744 sqlite3VdbeResolveLabel(v, pLevel->addrBignull);
174745 sqlite3VdbeAddOp2(v, OP_DecrJumpZero, pLevel->regBignull, pLevel->p2-1);
174746 VdbeCoverage(v);
174747 }
174748 #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174749 if( addrSeek ){
174750 sqlite3VdbeJumpHere(v, addrSeek);
174751 addrSeek = 0;
174752 }
174753 #endif
 
 
174754 }
174755 if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){
174756 struct InLoop *pIn;
174757 int j;
174758 sqlite3VdbeResolveLabel(v, pLevel->addrNxt);
@@ -175888,11 +175745,11 @@
175745 pWin->eFrmType = aUp[i].eFrmType;
175746 pWin->eStart = aUp[i].eStart;
175747 pWin->eEnd = aUp[i].eEnd;
175748 pWin->eExclude = 0;
175749 if( pWin->eStart==TK_FOLLOWING ){
175750 pWin->pStart = sqlite3ExprInt32(db, 1);
175751 }
175752 break;
175753 }
175754 }
175755 }
@@ -176233,13 +176090,11 @@
176090 ** selected (e.g. "SELECT row_number() OVER () FROM t1"), it is possible
176091 ** that pSublist is still NULL here. Add a constant expression here to
176092 ** keep everything legal in this case.
176093 */
176094 if( pSublist==0 ){
176095 pSublist = sqlite3ExprListAppend(pParse, 0, sqlite3ExprInt32(db, 0));
 
 
176096 }
176097
176098 pSub = sqlite3SelectNew(
176099 pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
176100 );
@@ -178514,19 +178369,50 @@
178369 }
178370 return p;
178371 }
178372
178373
178374 /* Create a TK_ISNULL or TK_NOTNULL expression, perhaps optimized to
178375 ** to TK_TRUEFALSE, if possible */
178376 static Expr *sqlite3PExprIsNull(
178377 Parse *pParse, /* Parsing context */
178378 int op, /* TK_ISNULL or TK_NOTNULL */
178379 Expr *pLeft /* Operand */
178380 ){
178381 Expr *p = pLeft;
178382 assert( op==TK_ISNULL || op==TK_NOTNULL );
178383 assert( pLeft!=0 );
178384 while( p->op==TK_UPLUS || p->op==TK_UMINUS ){
178385 p = p->pLeft;
178386 assert( p!=0 );
178387 }
178388 switch( p->op ){
178389 case TK_INTEGER:
178390 case TK_STRING:
178391 case TK_FLOAT:
178392 case TK_BLOB:
178393 sqlite3ExprDeferredDelete(pParse, pLeft);
178394 return sqlite3ExprInt32(pParse->db, op==TK_NOTNULL);
178395 default:
178396 break;
178397 }
178398 return sqlite3PExpr(pParse, op, pLeft, 0);
178399 }
178400
178401 /* Create a TK_IS or TK_ISNOT operator, perhaps optimized to
178402 ** TK_ISNULL or TK_NOTNULL or TK_TRUEFALSE. */
178403 static Expr *sqlite3PExprIs(
178404 Parse *pParse, /* Parsing context */
178405 int op, /* TK_IS or TK_ISNOT */
178406 Expr *pLeft, /* Left operand */
178407 Expr *pRight /* Right operand */
178408 ){
178409 if( pRight && pRight->op==TK_NULL ){
178410 sqlite3ExprDeferredDelete(pParse, pRight);
178411 return sqlite3PExprIsNull(pParse, op==TK_IS ? TK_ISNULL : TK_NOTNULL, pLeft);
178412 }
178413 return sqlite3PExpr(pParse, op, pLeft, pRight);
178414 }
178415
178416 /* Add a single new term to an ExprList that is used to store a
178417 ** list of identifiers. Report an error if the ID list contains
178418 ** a COLLATE clause or an ASC or DESC keyword, except ignore the
@@ -178805,35 +178691,35 @@
178691 #ifndef INTERFACE
178692 # define INTERFACE 1
178693 #endif
178694 /************* Begin control #defines *****************************************/
178695 #define YYCODETYPE unsigned short int
178696 #define YYNOCODE 322
178697 #define YYACTIONTYPE unsigned short int
178698 #define YYWILDCARD 102
178699 #define sqlite3ParserTOKENTYPE Token
178700 typedef union {
178701 int yyinit;
178702 sqlite3ParserTOKENTYPE yy0;
178703 ExprList* yy14;
178704 With* yy59;
178705 Cte* yy67;
178706 Upsert* yy122;
178707 IdList* yy132;
178708 int yy144;
178709 const char* yy168;
178710 SrcList* yy203;
178711 Window* yy211;
178712 OnOrUsing yy269;
178713 struct TrigEvent yy286;
178714 struct {int value; int mask;} yy383;
178715 u32 yy391;
178716 TriggerStep* yy427;
178717 Expr* yy454;
178718 u8 yy462;
178719 struct FrameBound yy509;
178720 Select* yy555;
178721 } YYMINORTYPE;
178722 #ifndef YYSTACKDEPTH
178723 #define YYSTACKDEPTH 50
178724 #endif
178725 #define sqlite3ParserARG_SDECL
@@ -178857,24 +178743,24 @@
178743 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
178744 #undef YYERRORSYMBOL
178745 #undef YYERRSYMDT
178746 #undef YYFALLBACK
178747 #define YYFALLBACK 1
178748 #define YYNSTATE 600
178749 #define YYNRULE 412
178750 #define YYNRULE_WITH_ACTION 348
178751 #define YYNTOKEN 187
178752 #define YY_MAX_SHIFT 599
178753 #define YY_MIN_SHIFTREDUCE 867
178754 #define YY_MAX_SHIFTREDUCE 1278
178755 #define YY_ERROR_ACTION 1279
178756 #define YY_ACCEPT_ACTION 1280
178757 #define YY_NO_ACTION 1281
178758 #define YY_MIN_REDUCE 1282
178759 #define YY_MAX_REDUCE 1693
178760 #define YY_MIN_DSTRCTR 206
178761 #define YY_MAX_DSTRCTR 319
178762 /************* End control #defines *******************************************/
178763 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
178764
178765 /* Define the yytestcase() macro to be a no-op if is not already defined
178766 ** otherwise.
@@ -178955,491 +178841,491 @@
178841 ** yy_default[] Default action for each state.
178842 **
178843 *********** Begin parsing tables **********************************************/
178844 #define YY_ACTTAB_COUNT (2379)
178845 static const YYACTIONTYPE yy_action[] = {
178846 /* 0 */ 134, 131, 238, 290, 290, 1353, 593, 1332, 478, 1606,
178847 /* 10 */ 593, 1315, 593, 7, 593, 1353, 590, 593, 579, 424,
178848 /* 20 */ 1566, 134, 131, 238, 1318, 541, 478, 477, 575, 84,
178849 /* 30 */ 84, 1005, 303, 84, 84, 51, 51, 63, 63, 1006,
178850 /* 40 */ 84, 84, 498, 141, 142, 93, 442, 1254, 1254, 1085,
178851 /* 50 */ 1088, 1075, 1075, 139, 139, 140, 140, 140, 140, 424,
178852 /* 60 */ 296, 296, 498, 296, 296, 567, 553, 296, 296, 1306,
178853 /* 70 */ 574, 1358, 1358, 590, 542, 579, 590, 574, 579, 548,
178854 /* 80 */ 590, 1304, 579, 141, 142, 93, 576, 1254, 1254, 1085,
178855 /* 90 */ 1088, 1075, 1075, 139, 139, 140, 140, 140, 140, 399,
178856 /* 100 */ 478, 395, 6, 138, 138, 138, 138, 137, 137, 136,
178857 /* 110 */ 136, 136, 135, 132, 463, 44, 342, 593, 305, 1127,
178858 /* 120 */ 1280, 1, 1, 599, 2, 1284, 598, 1200, 1284, 1200,
178859 /* 130 */ 330, 424, 158, 330, 1613, 158, 390, 116, 308, 1366,
178860 /* 140 */ 51, 51, 1366, 138, 138, 138, 138, 137, 137, 136,
178861 /* 150 */ 136, 136, 135, 132, 463, 141, 142, 93, 515, 1254,
178862 /* 160 */ 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140,
178863 /* 170 */ 140, 1230, 329, 584, 296, 296, 212, 296, 296, 568,
178864 /* 180 */ 568, 488, 143, 1072, 1072, 1086, 1089, 590, 1195, 579,
178865 /* 190 */ 590, 340, 579, 140, 140, 140, 140, 133, 392, 564,
178866 /* 200 */ 536, 1195, 250, 425, 1195, 250, 137, 137, 136, 136,
178867 /* 210 */ 136, 135, 132, 463, 291, 138, 138, 138, 138, 137,
178868 /* 220 */ 137, 136, 136, 136, 135, 132, 463, 966, 1230, 1231,
178869 /* 230 */ 1230, 412, 965, 467, 412, 424, 467, 489, 357, 1611,
178870 /* 240 */ 391, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178871 /* 250 */ 135, 132, 463, 463, 134, 131, 238, 555, 1076, 141,
178872 /* 260 */ 142, 93, 593, 1254, 1254, 1085, 1088, 1075, 1075, 139,
178873 /* 270 */ 139, 140, 140, 140, 140, 1317, 134, 131, 238, 424,
178874 /* 280 */ 549, 1597, 1531, 333, 97, 83, 83, 140, 140, 140,
178875 /* 290 */ 140, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178876 /* 300 */ 135, 132, 463, 141, 142, 93, 1657, 1254, 1254, 1085,
178877 /* 310 */ 1088, 1075, 1075, 139, 139, 140, 140, 140, 140, 138,
178878 /* 320 */ 138, 138, 138, 137, 137, 136, 136, 136, 135, 132,
178879 /* 330 */ 463, 591, 1230, 958, 958, 138, 138, 138, 138, 137,
178880 /* 340 */ 137, 136, 136, 136, 135, 132, 463, 44, 398, 547,
178881 /* 350 */ 1306, 136, 136, 136, 135, 132, 463, 386, 593, 442,
178882 /* 360 */ 595, 145, 595, 138, 138, 138, 138, 137, 137, 136,
178883 /* 370 */ 136, 136, 135, 132, 463, 500, 1230, 112, 550, 460,
178884 /* 380 */ 459, 51, 51, 424, 296, 296, 479, 334, 1259, 1230,
178885 /* 390 */ 1231, 1230, 1599, 1261, 388, 312, 444, 590, 246, 579,
178886 /* 400 */ 546, 1260, 271, 235, 329, 584, 551, 141, 142, 93,
178887 /* 410 */ 429, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140,
178888 /* 420 */ 140, 140, 140, 22, 22, 1230, 1262, 424, 1262, 216,
178889 /* 430 */ 296, 296, 98, 1230, 1231, 1230, 264, 884, 45, 528,
178890 /* 440 */ 525, 524, 1041, 590, 1269, 579, 421, 420, 393, 523,
178891 /* 450 */ 44, 141, 142, 93, 498, 1254, 1254, 1085, 1088, 1075,
178892 /* 460 */ 1075, 139, 139, 140, 140, 140, 140, 138, 138, 138,
178893 /* 470 */ 138, 137, 137, 136, 136, 136, 135, 132, 463, 593,
178894 /* 480 */ 1611, 561, 1230, 1231, 1230, 23, 264, 515, 200, 528,
178895 /* 490 */ 525, 524, 127, 585, 509, 4, 355, 487, 506, 523,
178896 /* 500 */ 593, 498, 84, 84, 134, 131, 238, 329, 584, 588,
178897 /* 510 */ 1627, 138, 138, 138, 138, 137, 137, 136, 136, 136,
178898 /* 520 */ 135, 132, 463, 19, 19, 435, 1230, 1460, 297, 297,
178899 /* 530 */ 311, 424, 1565, 464, 1631, 599, 2, 1284, 437, 574,
178900 /* 540 */ 1107, 590, 330, 579, 158, 582, 489, 357, 573, 593,
178901 /* 550 */ 592, 1366, 409, 1274, 1230, 141, 142, 93, 1364, 1254,
178902 /* 560 */ 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140,
178903 /* 570 */ 140, 389, 84, 84, 1062, 567, 1230, 313, 1523, 593,
178904 /* 580 */ 125, 125, 970, 1230, 1231, 1230, 296, 296, 126, 46,
178905 /* 590 */ 464, 594, 464, 296, 296, 1050, 1230, 218, 439, 590,
178906 /* 600 */ 1604, 579, 84, 84, 7, 403, 590, 515, 579, 325,
178907 /* 610 */ 417, 1230, 1231, 1230, 250, 138, 138, 138, 138, 137,
178908 /* 620 */ 137, 136, 136, 136, 135, 132, 463, 1050, 1050, 1052,
178909 /* 630 */ 1053, 35, 1275, 1230, 1231, 1230, 424, 1370, 993, 574,
178910 /* 640 */ 371, 414, 274, 412, 1597, 467, 1302, 552, 451, 590,
178911 /* 650 */ 543, 579, 1530, 1230, 1231, 1230, 1214, 201, 409, 1174,
178912 /* 660 */ 141, 142, 93, 223, 1254, 1254, 1085, 1088, 1075, 1075,
178913 /* 670 */ 139, 139, 140, 140, 140, 140, 296, 296, 1250, 593,
178914 /* 680 */ 424, 296, 296, 236, 529, 296, 296, 515, 100, 590,
178915 /* 690 */ 1600, 579, 48, 1605, 590, 1230, 579, 7, 590, 577,
178916 /* 700 */ 579, 904, 84, 84, 141, 142, 93, 496, 1254, 1254,
178917 /* 710 */ 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140, 140,
178918 /* 720 */ 138, 138, 138, 138, 137, 137, 136, 136, 136, 135,
178919 /* 730 */ 132, 463, 1365, 1230, 296, 296, 1250, 115, 1275, 326,
178920 /* 740 */ 233, 539, 1062, 40, 282, 127, 585, 590, 4, 579,
178921 /* 750 */ 329, 584, 1230, 1231, 1230, 1598, 593, 388, 904, 1051,
178922 /* 760 */ 1356, 1356, 588, 1050, 138, 138, 138, 138, 137, 137,
178923 /* 770 */ 136, 136, 136, 135, 132, 463, 185, 593, 1230, 19,
178924 /* 780 */ 19, 1230, 971, 1597, 424, 1651, 464, 129, 908, 1195,
178925 /* 790 */ 1230, 1231, 1230, 1325, 443, 1050, 1050, 1052, 582, 1603,
178926 /* 800 */ 149, 149, 1195, 7, 5, 1195, 1687, 410, 141, 142,
178927 /* 810 */ 93, 1536, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139,
178928 /* 820 */ 140, 140, 140, 140, 1214, 397, 593, 1062, 424, 1536,
178929 /* 830 */ 1538, 50, 901, 125, 125, 1230, 1231, 1230, 1230, 1231,
178930 /* 840 */ 1230, 126, 1230, 464, 594, 464, 515, 1230, 1050, 84,
178931 /* 850 */ 84, 3, 141, 142, 93, 924, 1254, 1254, 1085, 1088,
178932 /* 860 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 138, 138,
178933 /* 870 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 463,
178934 /* 880 */ 1050, 1050, 1052, 1053, 35, 442, 457, 532, 433, 1230,
178935 /* 890 */ 1062, 1361, 540, 540, 1598, 925, 388, 7, 1129, 1230,
178936 /* 900 */ 1231, 1230, 1129, 1536, 1230, 1231, 1230, 1051, 570, 1214,
178937 /* 910 */ 593, 1050, 138, 138, 138, 138, 137, 137, 136, 136,
178938 /* 920 */ 136, 135, 132, 463, 6, 185, 1195, 1230, 231, 593,
178939 /* 930 */ 382, 992, 424, 151, 151, 510, 1213, 557, 482, 1195,
178940 /* 940 */ 381, 160, 1195, 1050, 1050, 1052, 1230, 1231, 1230, 422,
178941 /* 950 */ 593, 447, 84, 84, 593, 217, 141, 142, 93, 593,
178942 /* 960 */ 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140,
178943 /* 970 */ 140, 140, 1214, 19, 19, 593, 424, 19, 19, 442,
178944 /* 980 */ 1063, 442, 19, 19, 1230, 1231, 1230, 515, 445, 458,
178945 /* 990 */ 1597, 386, 315, 1175, 1685, 556, 1685, 450, 84, 84,
178946 /* 1000 */ 141, 142, 93, 505, 1254, 1254, 1085, 1088, 1075, 1075,
178947 /* 1010 */ 139, 139, 140, 140, 140, 140, 138, 138, 138, 138,
178948 /* 1020 */ 137, 137, 136, 136, 136, 135, 132, 463, 442, 1147,
178949 /* 1030 */ 454, 1597, 362, 1041, 593, 462, 1460, 1233, 47, 1393,
178950 /* 1040 */ 324, 565, 565, 115, 1148, 449, 7, 460, 459, 307,
178951 /* 1050 */ 375, 354, 593, 113, 593, 329, 584, 19, 19, 1149,
178952 /* 1060 */ 138, 138, 138, 138, 137, 137, 136, 136, 136, 135,
178953 /* 1070 */ 132, 463, 209, 1173, 563, 19, 19, 19, 19, 49,
178954 /* 1080 */ 424, 944, 1175, 1686, 1046, 1686, 218, 355, 484, 343,
178955 /* 1090 */ 210, 945, 569, 562, 1262, 1233, 1262, 490, 314, 423,
178956 /* 1100 */ 424, 1598, 1206, 388, 141, 142, 93, 440, 1254, 1254,
178957 /* 1110 */ 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140, 140,
178958 /* 1120 */ 352, 316, 531, 316, 141, 142, 93, 549, 1254, 1254,
178959 /* 1130 */ 1085, 1088, 1075, 1075, 139, 139, 140, 140, 140, 140,
178960 /* 1140 */ 446, 10, 1598, 274, 388, 915, 281, 299, 383, 534,
178961 /* 1150 */ 378, 533, 269, 593, 1206, 587, 587, 587, 374, 293,
178962 /* 1160 */ 1579, 991, 1173, 302, 138, 138, 138, 138, 137, 137,
178963 /* 1170 */ 136, 136, 136, 135, 132, 463, 53, 53, 520, 1250,
178964 /* 1180 */ 593, 1147, 1576, 431, 138, 138, 138, 138, 137, 137,
178965 /* 1190 */ 136, 136, 136, 135, 132, 463, 1148, 301, 593, 1577,
178966 /* 1200 */ 593, 1307, 431, 54, 54, 593, 268, 593, 461, 461,
178967 /* 1210 */ 461, 1149, 347, 492, 424, 135, 132, 463, 1146, 1195,
178968 /* 1220 */ 474, 68, 68, 69, 69, 550, 332, 287, 21, 21,
178969 /* 1230 */ 55, 55, 1195, 581, 424, 1195, 309, 1250, 141, 142,
178970 /* 1240 */ 93, 119, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139,
178971 /* 1250 */ 140, 140, 140, 140, 593, 237, 480, 1476, 141, 142,
178972 /* 1260 */ 93, 593, 1254, 1254, 1085, 1088, 1075, 1075, 139, 139,
178973 /* 1270 */ 140, 140, 140, 140, 344, 430, 346, 70, 70, 494,
178974 /* 1280 */ 991, 1132, 1132, 512, 56, 56, 1269, 593, 268, 593,
178975 /* 1290 */ 369, 374, 593, 481, 215, 384, 1624, 481, 138, 138,
178976 /* 1300 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 463,
178977 /* 1310 */ 71, 71, 72, 72, 225, 73, 73, 593, 138, 138,
178978 /* 1320 */ 138, 138, 137, 137, 136, 136, 136, 135, 132, 463,
178979 /* 1330 */ 586, 431, 593, 872, 873, 874, 593, 911, 593, 1602,
178980 /* 1340 */ 74, 74, 593, 7, 1460, 242, 593, 306, 424, 1578,
178981 /* 1350 */ 472, 306, 364, 219, 367, 75, 75, 430, 345, 57,
178982 /* 1360 */ 57, 58, 58, 432, 187, 59, 59, 593, 424, 61,
178983 /* 1370 */ 61, 1475, 141, 142, 93, 123, 1254, 1254, 1085, 1088,
178984 /* 1380 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 424, 570,
178985 /* 1390 */ 62, 62, 141, 142, 93, 911, 1254, 1254, 1085, 1088,
178986 /* 1400 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 161, 384,
178987 /* 1410 */ 1624, 1474, 141, 130, 93, 441, 1254, 1254, 1085, 1088,
178988 /* 1420 */ 1075, 1075, 139, 139, 140, 140, 140, 140, 267, 266,
178989 /* 1430 */ 265, 1460, 138, 138, 138, 138, 137, 137, 136, 136,
178990 /* 1440 */ 136, 135, 132, 463, 593, 1336, 593, 1269, 1460, 384,
178991 /* 1450 */ 1624, 231, 138, 138, 138, 138, 137, 137, 136, 136,
178992 /* 1460 */ 136, 135, 132, 463, 593, 163, 593, 76, 76, 77,
178993 /* 1470 */ 77, 593, 138, 138, 138, 138, 137, 137, 136, 136,
178994 /* 1480 */ 136, 135, 132, 463, 475, 593, 483, 78, 78, 20,
178995 /* 1490 */ 20, 1249, 424, 491, 79, 79, 495, 422, 295, 235,
178996 /* 1500 */ 1574, 38, 511, 896, 422, 335, 240, 422, 147, 147,
178997 /* 1510 */ 112, 593, 424, 593, 101, 222, 991, 142, 93, 455,
178998 /* 1520 */ 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140,
178999 /* 1530 */ 140, 140, 593, 39, 148, 148, 80, 80, 93, 551,
179000 /* 1540 */ 1254, 1254, 1085, 1088, 1075, 1075, 139, 139, 140, 140,
179001 /* 1550 */ 140, 140, 328, 923, 922, 64, 64, 502, 1656, 1005,
179002 /* 1560 */ 933, 896, 124, 422, 121, 254, 593, 1006, 593, 226,
179003 /* 1570 */ 593, 127, 585, 164, 4, 16, 138, 138, 138, 138,
179004 /* 1580 */ 137, 137, 136, 136, 136, 135, 132, 463, 588, 81,
179005 /* 1590 */ 81, 65, 65, 82, 82, 593, 138, 138, 138, 138,
179006 /* 1600 */ 137, 137, 136, 136, 136, 135, 132, 463, 593, 226,
179007 /* 1610 */ 237, 966, 464, 593, 298, 593, 965, 593, 66, 66,
179008 /* 1620 */ 593, 1170, 593, 411, 582, 353, 469, 115, 593, 471,
179009 /* 1630 */ 169, 173, 173, 593, 44, 991, 174, 174, 89, 89,
179010 /* 1640 */ 67, 67, 593, 85, 85, 150, 150, 1114, 1043, 593,
179011 /* 1650 */ 273, 86, 86, 1062, 593, 503, 171, 171, 593, 125,
179012 /* 1660 */ 125, 497, 593, 273, 336, 152, 152, 126, 1335, 464,
179013 /* 1670 */ 594, 464, 146, 146, 1050, 593, 545, 172, 172, 593,
179014 /* 1680 */ 1054, 165, 165, 256, 339, 156, 156, 127, 585, 1586,
179015 /* 1690 */ 4, 329, 584, 499, 358, 273, 115, 348, 155, 155,
179016 /* 1700 */ 930, 931, 153, 153, 588, 1114, 1050, 1050, 1052, 1053,
179017 /* 1710 */ 35, 1554, 521, 593, 270, 1008, 1009, 9, 593, 372,
179018 /* 1720 */ 593, 115, 593, 168, 593, 115, 593, 1110, 464, 270,
179019 /* 1730 */ 996, 964, 273, 129, 1645, 1214, 154, 154, 1054, 1404,
179020 /* 1740 */ 582, 88, 88, 90, 90, 87, 87, 52, 52, 60,
179021 /* 1750 */ 60, 1405, 504, 537, 559, 1179, 961, 507, 129, 558,
179022 /* 1760 */ 127, 585, 1126, 4, 1126, 1125, 894, 1125, 162, 1062,
179023 /* 1770 */ 963, 359, 129, 1401, 363, 125, 125, 588, 366, 368,
179024 /* 1780 */ 370, 1349, 1334, 126, 1333, 464, 594, 464, 377, 387,
179025 /* 1790 */ 1050, 1391, 1414, 1618, 1459, 1387, 1399, 208, 580, 1464,
179026 /* 1800 */ 1314, 464, 243, 516, 1305, 1293, 1384, 1292, 1294, 1638,
179027 /* 1810 */ 288, 170, 228, 582, 12, 408, 321, 322, 241, 323,
179028 /* 1820 */ 245, 1446, 1050, 1050, 1052, 1053, 35, 559, 304, 350,
179029 /* 1830 */ 351, 501, 560, 127, 585, 1441, 4, 1451, 1434, 310,
179030 /* 1840 */ 1450, 526, 1062, 1332, 415, 380, 232, 1527, 125, 125,
179031 /* 1850 */ 588, 1214, 1396, 356, 1526, 583, 126, 1397, 464, 594,
179032 /* 1860 */ 464, 1641, 535, 1050, 1581, 1395, 1269, 1583, 1582, 213,
179033 /* 1870 */ 402, 277, 214, 227, 464, 1573, 239, 1571, 1266, 1394,
179034 /* 1880 */ 434, 198, 100, 224, 96, 183, 582, 191, 485, 193,
179035 /* 1890 */ 486, 194, 195, 196, 519, 1050, 1050, 1052, 1053, 35,
179036 /* 1900 */ 559, 113, 252, 413, 1447, 558, 493, 13, 1455, 416,
179037 /* 1910 */ 1453, 1452, 14, 202, 1521, 1062, 1532, 508, 258, 106,
179038 /* 1920 */ 514, 125, 125, 99, 1214, 1543, 289, 260, 206, 126,
179039 /* 1930 */ 365, 464, 594, 464, 361, 517, 1050, 261, 448, 1295,
179040 /* 1940 */ 262, 418, 1352, 1351, 108, 1350, 1655, 1654, 1343, 915,
179041 /* 1950 */ 419, 1322, 233, 452, 319, 379, 1321, 453, 1623, 320,
179042 /* 1960 */ 1320, 275, 1653, 544, 276, 1609, 1608, 1342, 1050, 1050,
179043 /* 1970 */ 1052, 1053, 35, 1630, 1218, 466, 385, 456, 300, 1419,
179044 /* 1980 */ 144, 1418, 570, 407, 407, 406, 284, 404, 11, 1508,
179045 /* 1990 */ 881, 396, 120, 127, 585, 394, 4, 1214, 327, 114,
179046 /* 2000 */ 1375, 1374, 220, 247, 400, 338, 401, 554, 42, 1224,
179047 /* 2010 */ 588, 596, 283, 337, 285, 286, 188, 597, 1290, 1285,
179048 /* 2020 */ 175, 1558, 176, 1559, 1557, 1556, 159, 317, 229, 177,
179049 /* 2030 */ 868, 230, 91, 465, 464, 221, 331, 468, 1165, 470,
179050 /* 2040 */ 473, 94, 244, 95, 249, 189, 582, 1124, 1122, 341,
179051 /* 2050 */ 427, 190, 178, 1249, 179, 43, 192, 947, 349, 428,
179052 /* 2060 */ 1138, 197, 251, 180, 181, 436, 102, 182, 438, 103,
179053 /* 2070 */ 104, 199, 248, 1140, 253, 1062, 105, 255, 1137, 166,
179054 /* 2080 */ 24, 125, 125, 257, 1264, 273, 360, 513, 259, 126,
179055 /* 2090 */ 15, 464, 594, 464, 204, 883, 1050, 518, 263, 373,
179056 /* 2100 */ 381, 92, 585, 1130, 4, 203, 205, 426, 107, 522,
179057 /* 2110 */ 25, 26, 329, 584, 913, 572, 527, 376, 588, 926,
179058 /* 2120 */ 530, 109, 184, 318, 167, 110, 27, 538, 1050, 1050,
179059 /* 2130 */ 1052, 1053, 35, 1211, 1091, 17, 476, 111, 1181, 234,
179060 /* 2140 */ 292, 1180, 464, 294, 207, 994, 129, 1201, 272, 1000,
179061 /* 2150 */ 28, 1197, 29, 30, 582, 1199, 1205, 1214, 31, 1204,
179062 /* 2160 */ 32, 1186, 41, 566, 33, 1105, 211, 8, 115, 1092,
179063 /* 2170 */ 1090, 1094, 34, 278, 578, 1095, 117, 122, 118, 1145,
179064 /* 2180 */ 36, 18, 128, 1062, 1055, 895, 957, 37, 589, 125,
179065 /* 2190 */ 125, 279, 186, 280, 1646, 157, 405, 126, 1220, 464,
179066 /* 2200 */ 594, 464, 1218, 466, 1050, 1219, 300, 1281, 1281, 1281,
179067 /* 2210 */ 1281, 407, 407, 406, 284, 404, 1281, 1281, 881, 1281,
179068 /* 2220 */ 300, 1281, 1281, 571, 1281, 407, 407, 406, 284, 404,
179069 /* 2230 */ 1281, 247, 881, 338, 1281, 1281, 1050, 1050, 1052, 1053,
179070 /* 2240 */ 35, 337, 1281, 1281, 1281, 247, 1281, 338, 1281, 1281,
179071 /* 2250 */ 1281, 1281, 1281, 1281, 1281, 337, 1281, 1281, 1281, 1281,
179072 /* 2260 */ 1281, 1281, 1281, 1281, 1281, 1214, 1281, 1281, 1281, 1281,
179073 /* 2270 */ 1281, 1281, 249, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
179074 /* 2280 */ 178, 1281, 1281, 43, 1281, 1281, 249, 1281, 1281, 1281,
179075 /* 2290 */ 1281, 1281, 1281, 1281, 178, 1281, 1281, 43, 1281, 1281,
179076 /* 2300 */ 248, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
179077 /* 2310 */ 1281, 1281, 1281, 1281, 248, 1281, 1281, 1281, 1281, 1281,
179078 /* 2320 */ 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
179079 /* 2330 */ 1281, 1281, 1281, 1281, 1281, 426, 1281, 1281, 1281, 1281,
179080 /* 2340 */ 329, 584, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 426,
179081 /* 2350 */ 1281, 1281, 1281, 1281, 329, 584, 1281, 1281, 1281, 1281,
179082 /* 2360 */ 1281, 1281, 1281, 1281, 476, 1281, 1281, 1281, 1281, 1281,
179083 /* 2370 */ 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 476,
179084 };
179085 static const YYCODETYPE yy_lookahead[] = {
179086 /* 0 */ 277, 278, 279, 241, 242, 225, 195, 227, 195, 312,
179087 /* 10 */ 195, 218, 195, 316, 195, 235, 254, 195, 256, 19,
179088 /* 20 */ 297, 277, 278, 279, 218, 206, 213, 214, 206, 218,
179089 /* 30 */ 219, 31, 206, 218, 219, 218, 219, 218, 219, 39,
179090 /* 40 */ 218, 219, 195, 43, 44, 45, 195, 47, 48, 49,
179091 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 19,
179092 /* 60 */ 241, 242, 195, 241, 242, 195, 255, 241, 242, 195,
179093 /* 70 */ 255, 237, 238, 254, 255, 256, 254, 255, 256, 264,
179094 /* 80 */ 254, 207, 256, 43, 44, 45, 264, 47, 48, 49,
179095 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 251,
179096 /* 100 */ 287, 253, 215, 103, 104, 105, 106, 107, 108, 109,
179097 /* 110 */ 110, 111, 112, 113, 114, 82, 265, 195, 271, 11,
179098 /* 120 */ 187, 188, 189, 190, 191, 192, 190, 87, 192, 89,
179099 /* 130 */ 197, 19, 199, 197, 317, 199, 319, 25, 271, 206,
179100 /* 140 */ 218, 219, 206, 103, 104, 105, 106, 107, 108, 109,
179101 /* 150 */ 110, 111, 112, 113, 114, 43, 44, 45, 195, 47,
179102 /* 160 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
179103 /* 170 */ 58, 60, 139, 140, 241, 242, 289, 241, 242, 309,
179104 /* 180 */ 310, 294, 70, 47, 48, 49, 50, 254, 77, 256,
179105 /* 190 */ 254, 195, 256, 55, 56, 57, 58, 59, 221, 88,
179106 /* 200 */ 109, 90, 269, 240, 93, 269, 107, 108, 109, 110,
179107 /* 210 */ 111, 112, 113, 114, 215, 103, 104, 105, 106, 107,
179108 /* 220 */ 108, 109, 110, 111, 112, 113, 114, 136, 117, 118,
179109 /* 230 */ 119, 298, 141, 300, 298, 19, 300, 129, 130, 317,
179110 /* 240 */ 318, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179111 /* 250 */ 112, 113, 114, 114, 277, 278, 279, 146, 122, 43,
179112 /* 260 */ 44, 45, 195, 47, 48, 49, 50, 51, 52, 53,
179113 /* 270 */ 54, 55, 56, 57, 58, 218, 277, 278, 279, 19,
179114 /* 280 */ 19, 195, 286, 23, 68, 218, 219, 55, 56, 57,
179115 /* 290 */ 58, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179116 /* 300 */ 112, 113, 114, 43, 44, 45, 232, 47, 48, 49,
179117 /* 310 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 103,
179118 /* 320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
179119 /* 330 */ 114, 135, 60, 137, 138, 103, 104, 105, 106, 107,
179120 /* 340 */ 108, 109, 110, 111, 112, 113, 114, 82, 281, 206,
179121 /* 350 */ 195, 109, 110, 111, 112, 113, 114, 195, 195, 195,
179122 /* 360 */ 205, 22, 207, 103, 104, 105, 106, 107, 108, 109,
179123 /* 370 */ 110, 111, 112, 113, 114, 195, 60, 116, 117, 107,
179124 /* 380 */ 108, 218, 219, 19, 241, 242, 121, 23, 116, 117,
179125 /* 390 */ 118, 119, 306, 121, 308, 206, 234, 254, 15, 256,
179126 /* 400 */ 195, 129, 259, 260, 139, 140, 145, 43, 44, 45,
179127 /* 410 */ 200, 47, 48, 49, 50, 51, 52, 53, 54, 55,
179128 /* 420 */ 56, 57, 58, 218, 219, 60, 154, 19, 156, 265,
179129 /* 430 */ 241, 242, 24, 117, 118, 119, 120, 21, 73, 123,
179130 /* 440 */ 124, 125, 74, 254, 61, 256, 107, 108, 221, 133,
179131 /* 450 */ 82, 43, 44, 45, 195, 47, 48, 49, 50, 51,
179132 /* 460 */ 52, 53, 54, 55, 56, 57, 58, 103, 104, 105,
179133 /* 470 */ 106, 107, 108, 109, 110, 111, 112, 113, 114, 195,
179134 /* 480 */ 317, 318, 117, 118, 119, 22, 120, 195, 22, 123,
179135 /* 490 */ 124, 125, 19, 20, 284, 22, 128, 81, 288, 133,
179136 /* 500 */ 195, 195, 218, 219, 277, 278, 279, 139, 140, 36,
179137 /* 510 */ 195, 103, 104, 105, 106, 107, 108, 109, 110, 111,
179138 /* 520 */ 112, 113, 114, 218, 219, 62, 60, 195, 241, 242,
179139 /* 530 */ 271, 19, 240, 60, 189, 190, 191, 192, 233, 255,
179140 /* 540 */ 124, 254, 197, 256, 199, 72, 129, 130, 264, 195,
179141 /* 550 */ 195, 206, 22, 23, 60, 43, 44, 45, 206, 47,
179142 /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
179143 /* 570 */ 58, 195, 218, 219, 101, 195, 60, 271, 162, 195,
179144 /* 580 */ 107, 108, 109, 117, 118, 119, 241, 242, 115, 73,
179145 /* 590 */ 117, 118, 119, 241, 242, 122, 60, 195, 266, 254,
179146 /* 600 */ 312, 256, 218, 219, 316, 203, 254, 195, 256, 255,
179147 /* 610 */ 208, 117, 118, 119, 269, 103, 104, 105, 106, 107,
179148 /* 620 */ 108, 109, 110, 111, 112, 113, 114, 154, 155, 156,
179149 /* 630 */ 157, 158, 102, 117, 118, 119, 19, 242, 144, 255,
179150 /* 640 */ 23, 206, 24, 298, 195, 300, 206, 195, 264, 254,
179151 /* 650 */ 206, 256, 240, 117, 118, 119, 183, 22, 22, 23,
179152 /* 660 */ 43, 44, 45, 151, 47, 48, 49, 50, 51, 52,
179153 /* 670 */ 53, 54, 55, 56, 57, 58, 241, 242, 60, 195,
179154 /* 680 */ 19, 241, 242, 195, 23, 241, 242, 195, 152, 254,
179155 /* 690 */ 310, 256, 243, 312, 254, 60, 256, 316, 254, 206,
179156 /* 700 */ 256, 60, 218, 219, 43, 44, 45, 272, 47, 48,
179157 /* 710 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179158 /* 720 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
179159 /* 730 */ 113, 114, 240, 60, 241, 242, 118, 25, 102, 255,
179160 /* 740 */ 166, 167, 101, 22, 26, 19, 20, 254, 22, 256,
179161 /* 750 */ 139, 140, 117, 118, 119, 306, 195, 308, 117, 118,
179162 /* 760 */ 237, 238, 36, 122, 103, 104, 105, 106, 107, 108,
179163 /* 770 */ 109, 110, 111, 112, 113, 114, 195, 195, 60, 218,
179164 /* 780 */ 219, 60, 109, 195, 19, 217, 60, 25, 23, 77,
179165 /* 790 */ 117, 118, 119, 225, 233, 154, 155, 156, 72, 312,
179166 /* 800 */ 218, 219, 90, 316, 22, 93, 303, 304, 43, 44,
179167 /* 810 */ 45, 195, 47, 48, 49, 50, 51, 52, 53, 54,
179168 /* 820 */ 55, 56, 57, 58, 183, 195, 195, 101, 19, 213,
179169 /* 830 */ 214, 243, 23, 107, 108, 117, 118, 119, 117, 118,
179170 /* 840 */ 119, 115, 60, 117, 118, 119, 195, 60, 122, 218,
179171 /* 850 */ 219, 22, 43, 44, 45, 35, 47, 48, 49, 50,
179172 /* 860 */ 51, 52, 53, 54, 55, 56, 57, 58, 103, 104,
179173 /* 870 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179174 /* 880 */ 154, 155, 156, 157, 158, 195, 255, 67, 195, 60,
179175 /* 890 */ 101, 240, 311, 312, 306, 75, 308, 316, 29, 117,
179176 /* 900 */ 118, 119, 33, 287, 117, 118, 119, 118, 146, 183,
179177 /* 910 */ 195, 122, 103, 104, 105, 106, 107, 108, 109, 110,
179178 /* 920 */ 111, 112, 113, 114, 215, 195, 77, 60, 25, 195,
179179 /* 930 */ 122, 144, 19, 218, 219, 66, 23, 88, 246, 90,
179180 /* 940 */ 132, 25, 93, 154, 155, 156, 117, 118, 119, 257,
179181 /* 950 */ 195, 131, 218, 219, 195, 265, 43, 44, 45, 195,
179182 /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179183 /* 970 */ 57, 58, 183, 218, 219, 195, 19, 218, 219, 195,
179184 /* 980 */ 23, 195, 218, 219, 117, 118, 119, 195, 233, 255,
179185 /* 990 */ 195, 195, 233, 22, 23, 146, 25, 233, 218, 219,
179186 /* 1000 */ 43, 44, 45, 294, 47, 48, 49, 50, 51, 52,
179187 /* 1010 */ 53, 54, 55, 56, 57, 58, 103, 104, 105, 106,
179188 /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 12,
179189 /* 1030 */ 234, 195, 240, 74, 195, 255, 195, 60, 243, 262,
179190 /* 1040 */ 263, 311, 312, 25, 27, 19, 316, 107, 108, 265,
179191 /* 1050 */ 24, 265, 195, 150, 195, 139, 140, 218, 219, 42,
179192 /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
179193 /* 1070 */ 113, 114, 233, 102, 67, 218, 219, 218, 219, 243,
179194 /* 1080 */ 19, 64, 22, 23, 23, 25, 195, 128, 129, 130,
179195 /* 1090 */ 233, 74, 233, 86, 154, 118, 156, 130, 265, 208,
179196 /* 1100 */ 19, 306, 95, 308, 43, 44, 45, 266, 47, 48,
179197 /* 1110 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179198 /* 1120 */ 153, 230, 96, 232, 43, 44, 45, 19, 47, 48,
179199 /* 1130 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
179200 /* 1140 */ 114, 22, 306, 24, 308, 127, 120, 121, 122, 123,
179201 /* 1150 */ 124, 125, 126, 195, 147, 212, 213, 214, 132, 23,
179202 /* 1160 */ 195, 25, 102, 100, 103, 104, 105, 106, 107, 108,
179203 /* 1170 */ 109, 110, 111, 112, 113, 114, 218, 219, 19, 60,
179204 /* 1180 */ 195, 12, 210, 211, 103, 104, 105, 106, 107, 108,
179205 /* 1190 */ 109, 110, 111, 112, 113, 114, 27, 134, 195, 195,
179206 /* 1200 */ 195, 210, 211, 218, 219, 195, 47, 195, 212, 213,
179207 /* 1210 */ 214, 42, 16, 130, 19, 112, 113, 114, 23, 77,
179208 /* 1220 */ 195, 218, 219, 218, 219, 117, 163, 164, 218, 219,
179209 /* 1230 */ 218, 219, 90, 64, 19, 93, 153, 118, 43, 44,
179210 /* 1240 */ 45, 160, 47, 48, 49, 50, 51, 52, 53, 54,
179211 /* 1250 */ 55, 56, 57, 58, 195, 119, 272, 276, 43, 44,
179212 /* 1260 */ 45, 195, 47, 48, 49, 50, 51, 52, 53, 54,
179213 /* 1270 */ 55, 56, 57, 58, 78, 116, 80, 218, 219, 116,
179214 /* 1280 */ 144, 128, 129, 130, 218, 219, 61, 195, 47, 195,
179215 /* 1290 */ 16, 132, 195, 263, 195, 314, 315, 267, 103, 104,
179216 /* 1300 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179217 /* 1310 */ 218, 219, 218, 219, 151, 218, 219, 195, 103, 104,
179218 /* 1320 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
179219 /* 1330 */ 210, 211, 195, 7, 8, 9, 195, 60, 195, 312,
179220 /* 1340 */ 218, 219, 195, 316, 195, 120, 195, 263, 19, 195,
179221 /* 1350 */ 125, 267, 78, 24, 80, 218, 219, 116, 162, 218,
179222 /* 1360 */ 219, 218, 219, 301, 302, 218, 219, 195, 19, 218,
179223 /* 1370 */ 219, 276, 43, 44, 45, 160, 47, 48, 49, 50,
179224 /* 1380 */ 51, 52, 53, 54, 55, 56, 57, 58, 19, 146,
179225 /* 1390 */ 218, 219, 43, 44, 45, 118, 47, 48, 49, 50,
179226 /* 1400 */ 51, 52, 53, 54, 55, 56, 57, 58, 165, 314,
179227 /* 1410 */ 315, 276, 43, 44, 45, 266, 47, 48, 49, 50,
179228 /* 1420 */ 51, 52, 53, 54, 55, 56, 57, 58, 128, 129,
179229 /* 1430 */ 130, 195, 103, 104, 105, 106, 107, 108, 109, 110,
179230 /* 1440 */ 111, 112, 113, 114, 195, 228, 195, 61, 195, 314,
179231 /* 1450 */ 315, 25, 103, 104, 105, 106, 107, 108, 109, 110,
179232 /* 1460 */ 111, 112, 113, 114, 195, 22, 195, 218, 219, 218,
179233 /* 1470 */ 219, 195, 103, 104, 105, 106, 107, 108, 109, 110,
179234 /* 1480 */ 111, 112, 113, 114, 195, 195, 246, 218, 219, 218,
179235 /* 1490 */ 219, 25, 19, 246, 218, 219, 246, 257, 259, 260,
179236 /* 1500 */ 195, 22, 266, 60, 257, 195, 120, 257, 218, 219,
179237 /* 1510 */ 116, 195, 19, 195, 150, 151, 25, 44, 45, 266,
179238 /* 1520 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179239 /* 1530 */ 57, 58, 195, 54, 218, 219, 218, 219, 45, 145,
179240 /* 1540 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
179241 /* 1550 */ 57, 58, 246, 121, 122, 218, 219, 19, 23, 31,
179242 /* 1560 */ 25, 118, 159, 257, 161, 24, 195, 39, 195, 143,
179243 /* 1570 */ 195, 19, 20, 22, 22, 24, 103, 104, 105, 106,
179244 /* 1580 */ 107, 108, 109, 110, 111, 112, 113, 114, 36, 218,
179245 /* 1590 */ 219, 218, 219, 218, 219, 195, 103, 104, 105, 106,
179246 /* 1600 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 143,
179247 /* 1610 */ 119, 136, 60, 195, 22, 195, 141, 195, 218, 219,
179248 /* 1620 */ 195, 23, 195, 25, 72, 23, 131, 25, 195, 134,
179249 /* 1630 */ 23, 218, 219, 195, 82, 144, 218, 219, 218, 219,
179250 /* 1640 */ 218, 219, 195, 218, 219, 218, 219, 60, 23, 195,
179251 /* 1650 */ 25, 218, 219, 101, 195, 117, 218, 219, 195, 107,
179252 /* 1660 */ 108, 23, 195, 25, 195, 218, 219, 115, 228, 117,
179253 /* 1670 */ 118, 119, 218, 219, 122, 195, 19, 218, 219, 195,
179254 /* 1680 */ 60, 218, 219, 142, 195, 218, 219, 19, 20, 195,
179255 /* 1690 */ 22, 139, 140, 23, 23, 25, 25, 195, 218, 219,
179256 /* 1700 */ 7, 8, 218, 219, 36, 118, 154, 155, 156, 157,
179257 /* 1710 */ 158, 195, 23, 195, 25, 84, 85, 49, 195, 23,
179258 /* 1720 */ 195, 25, 195, 23, 195, 25, 195, 23, 60, 25,
179259 /* 1730 */ 23, 23, 25, 25, 142, 183, 218, 219, 118, 195,
179260 /* 1740 */ 72, 218, 219, 218, 219, 218, 219, 218, 219, 218,
179261 /* 1750 */ 219, 195, 195, 146, 86, 98, 23, 195, 25, 91,
179262 /* 1760 */ 19, 20, 154, 22, 156, 154, 23, 156, 25, 101,
179263 /* 1770 */ 23, 195, 25, 195, 195, 107, 108, 36, 195, 195,
179264 /* 1780 */ 195, 195, 228, 115, 195, 117, 118, 119, 195, 195,
179265 /* 1790 */ 122, 261, 195, 321, 195, 195, 195, 258, 238, 195,
179266 /* 1800 */ 195, 60, 299, 291, 195, 195, 258, 195, 195, 195,
179267 /* 1810 */ 290, 244, 216, 72, 245, 193, 258, 258, 299, 258,
179268 /* 1820 */ 299, 274, 154, 155, 156, 157, 158, 86, 247, 295,
179269 /* 1830 */ 248, 295, 91, 19, 20, 270, 22, 274, 270, 248,
179270 /* 1840 */ 274, 222, 101, 227, 274, 221, 231, 221, 107, 108,
179271 /* 1850 */ 36, 183, 262, 247, 221, 283, 115, 262, 117, 118,
179272 /* 1860 */ 119, 198, 116, 122, 220, 262, 61, 220, 220, 251,
179273 /* 1870 */ 247, 142, 251, 245, 60, 202, 299, 202, 38, 262,
179274 /* 1880 */ 202, 22, 152, 151, 296, 43, 72, 236, 18, 239,
179275 /* 1890 */ 202, 239, 239, 239, 18, 154, 155, 156, 157, 158,
179276 /* 1900 */ 86, 150, 201, 248, 275, 91, 248, 273, 236, 248,
179277 /* 1910 */ 275, 275, 273, 236, 248, 101, 286, 202, 201, 159,
179278 /* 1920 */ 63, 107, 108, 296, 183, 293, 202, 201, 22, 115,
179279 /* 1930 */ 202, 117, 118, 119, 292, 223, 122, 201, 65, 202,
179280 /* 1940 */ 201, 223, 220, 220, 22, 220, 226, 226, 229, 127,
179281 /* 1950 */ 223, 220, 166, 24, 285, 220, 222, 114, 315, 285,
179282 /* 1960 */ 220, 202, 220, 307, 92, 320, 320, 229, 154, 155,
179283 /* 1970 */ 156, 157, 158, 0, 1, 2, 223, 83, 5, 268,
179284 /* 1980 */ 149, 268, 146, 10, 11, 12, 13, 14, 22, 280,
179285 /* 1990 */ 17, 202, 159, 19, 20, 251, 22, 183, 282, 148,
179286 /* 2000 */ 252, 252, 250, 30, 249, 32, 248, 147, 25, 13,
179287 /* 2010 */ 36, 204, 196, 40, 196, 6, 302, 194, 194, 194,
179288 /* 2020 */ 209, 215, 209, 215, 215, 215, 224, 224, 216, 209,
179289 /* 2030 */ 4, 216, 215, 3, 60, 22, 122, 19, 122, 19,
179290 /* 2040 */ 125, 22, 15, 22, 71, 16, 72, 23, 23, 140,
179291 /* 2050 */ 305, 152, 79, 25, 131, 82, 143, 20, 16, 305,
179292 /* 2060 */ 1, 143, 145, 131, 131, 62, 54, 131, 37, 54,
179293 /* 2070 */ 54, 152, 99, 117, 34, 101, 54, 24, 1, 5,
179294 /* 2080 */ 22, 107, 108, 116, 76, 25, 162, 41, 142, 115,
179295 /* 2090 */ 24, 117, 118, 119, 116, 20, 122, 19, 126, 23,
179296 /* 2100 */ 132, 19, 20, 69, 22, 69, 22, 134, 22, 68,
179297 /* 2110 */ 22, 22, 139, 140, 60, 141, 68, 24, 36, 28,
179298 /* 2120 */ 97, 22, 37, 68, 23, 150, 34, 22, 154, 155,
179299 /* 2130 */ 156, 157, 158, 23, 23, 22, 163, 25, 23, 142,
179300 /* 2140 */ 23, 98, 60, 23, 22, 144, 25, 76, 34, 117,
179301 /* 2150 */ 34, 89, 34, 34, 72, 87, 76, 183, 34, 94,
179302 /* 2160 */ 34, 23, 22, 24, 34, 23, 25, 44, 25, 23,
179303 /* 2170 */ 23, 23, 22, 22, 25, 11, 143, 25, 143, 23,
179304 /* 2180 */ 22, 22, 22, 101, 23, 23, 136, 22, 25, 107,
179305 /* 2190 */ 108, 142, 25, 142, 142, 23, 15, 115, 1, 117,
179306 /* 2200 */ 118, 119, 1, 2, 122, 1, 5, 322, 322, 322,
179307 /* 2210 */ 322, 10, 11, 12, 13, 14, 322, 322, 17, 322,
179308 /* 2220 */ 5, 322, 322, 141, 322, 10, 11, 12, 13, 14,
179309 /* 2230 */ 322, 30, 17, 32, 322, 322, 154, 155, 156, 157,
179310 /* 2240 */ 158, 40, 322, 322, 322, 30, 322, 32, 322, 322,
179311 /* 2250 */ 322, 322, 322, 322, 322, 40, 322, 322, 322, 322,
179312 /* 2260 */ 322, 322, 322, 322, 322, 183, 322, 322, 322, 322,
179313 /* 2270 */ 322, 322, 71, 322, 322, 322, 322, 322, 322, 322,
179314 /* 2280 */ 79, 322, 322, 82, 322, 322, 71, 322, 322, 322,
179315 /* 2290 */ 322, 322, 322, 322, 79, 322, 322, 82, 322, 322,
179316 /* 2300 */ 99, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179317 /* 2310 */ 322, 322, 322, 322, 99, 322, 322, 322, 322, 322,
179318 /* 2320 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179319 /* 2330 */ 322, 322, 322, 322, 322, 134, 322, 322, 322, 322,
179320 /* 2340 */ 139, 140, 322, 322, 322, 322, 322, 322, 322, 134,
179321 /* 2350 */ 322, 322, 322, 322, 139, 140, 322, 322, 322, 322,
179322 /* 2360 */ 322, 322, 322, 322, 163, 322, 322, 322, 322, 322,
179323 /* 2370 */ 322, 322, 322, 322, 322, 322, 322, 322, 163, 322,
179324 /* 2380 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179325 /* 2390 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
179326 /* 2400 */ 322, 322, 322, 322, 322, 322, 322, 322, 187, 187,
179327 /* 2410 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179328 /* 2420 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179329 /* 2430 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179330 /* 2440 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179331 /* 2450 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
@@ -179453,186 +179339,184 @@
179339 /* 2530 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179340 /* 2540 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179341 /* 2550 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
179342 /* 2560 */ 187, 187, 187, 187, 187, 187,
179343 };
179344 #define YY_SHIFT_COUNT (599)
179345 #define YY_SHIFT_MIN (0)
179346 #define YY_SHIFT_MAX (2215)
179347 static const unsigned short int yy_shift_ofst[] = {
179348 /* 0 */ 2201, 1973, 2215, 1552, 1552, 33, 368, 1668, 1741, 1814,
179349 /* 10 */ 726, 726, 726, 265, 33, 33, 33, 33, 33, 0,
179350 /* 20 */ 0, 216, 1349, 726, 726, 726, 726, 726, 726, 726,
179351 /* 30 */ 726, 726, 726, 726, 726, 726, 726, 726, 272, 272,
179352 /* 40 */ 111, 111, 316, 365, 516, 867, 867, 916, 916, 916,
179353 /* 50 */ 916, 40, 112, 260, 364, 408, 512, 617, 661, 765,
179354 /* 60 */ 809, 913, 957, 1061, 1081, 1195, 1215, 1329, 1349, 1349,
179355 /* 70 */ 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349,
179356 /* 80 */ 1349, 1349, 1349, 1349, 1349, 1349, 1369, 1349, 1473, 1493,
179357 /* 90 */ 1493, 473, 1974, 2082, 726, 726, 726, 726, 726, 726,
179358 /* 100 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179359 /* 110 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179360 /* 120 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179361 /* 130 */ 726, 726, 726, 726, 726, 726, 726, 726, 726, 726,
179362 /* 140 */ 726, 726, 726, 726, 726, 726, 138, 232, 232, 232,
179363 /* 150 */ 232, 232, 232, 232, 188, 99, 242, 718, 416, 1159,
179364 /* 160 */ 867, 867, 940, 940, 867, 1103, 417, 574, 574, 574,
179365 /* 170 */ 611, 139, 139, 2379, 2379, 1026, 1026, 1026, 536, 466,
179366 /* 180 */ 466, 466, 466, 1017, 1017, 849, 718, 971, 1060, 867,
179367 /* 190 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867,
179368 /* 200 */ 867, 867, 867, 867, 867, 867, 867, 867, 261, 712,
179369 /* 210 */ 712, 867, 108, 1142, 1142, 977, 1108, 1108, 977, 977,
179370 /* 220 */ 1243, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 641, 789,
179371 /* 230 */ 789, 635, 366, 721, 673, 782, 494, 787, 829, 867,
179372 /* 240 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867,
179373 /* 250 */ 959, 867, 867, 867, 867, 867, 867, 867, 867, 867,
179374 /* 260 */ 867, 867, 867, 867, 867, 820, 820, 820, 867, 867,
179375 /* 270 */ 867, 1136, 867, 867, 867, 1119, 1007, 867, 1169, 867,
179376 /* 280 */ 867, 867, 867, 867, 867, 867, 867, 1225, 1153, 869,
179377 /* 290 */ 196, 618, 618, 618, 618, 1491, 196, 196, 91, 339,
179378 /* 300 */ 1326, 1386, 383, 1163, 1364, 1426, 1364, 1538, 903, 1163,
179379 /* 310 */ 1163, 903, 1163, 1426, 1538, 1018, 1535, 1241, 1528, 1528,
179380 /* 320 */ 1528, 1394, 1394, 1394, 1394, 762, 762, 1403, 1466, 1475,
179381 /* 330 */ 1551, 1746, 1805, 1746, 1746, 1729, 1729, 1840, 1840, 1729,
179382 /* 340 */ 1730, 1732, 1859, 1842, 1870, 1870, 1870, 1870, 1729, 1876,
179383 /* 350 */ 1751, 1732, 1732, 1751, 1859, 1842, 1751, 1842, 1751, 1729,
179384 /* 360 */ 1876, 1760, 1857, 1729, 1876, 1906, 1729, 1876, 1729, 1876,
179385 /* 370 */ 1906, 1746, 1746, 1746, 1873, 1922, 1922, 1906, 1746, 1822,
179386 /* 380 */ 1746, 1873, 1746, 1746, 1786, 1929, 1843, 1843, 1906, 1729,
179387 /* 390 */ 1872, 1872, 1894, 1894, 1831, 1836, 1966, 1729, 1833, 1831,
179388 /* 400 */ 1851, 1860, 1751, 1983, 1996, 1996, 2009, 2009, 2009, 2379,
179389 /* 410 */ 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379,
179390 /* 420 */ 2379, 2379, 2379, 2379, 136, 1063, 1196, 530, 636, 1274,
179391 /* 430 */ 1300, 1443, 1598, 1495, 1479, 967, 1083, 1602, 463, 1625,
179392 /* 440 */ 1638, 1670, 1541, 1671, 1689, 1696, 1277, 1432, 1693, 808,
179393 /* 450 */ 1700, 1607, 1657, 1587, 1704, 1707, 1631, 1708, 1733, 1608,
179394 /* 460 */ 1611, 1743, 1747, 1620, 1592, 2026, 2030, 2013, 1914, 2018,
179395 /* 470 */ 1916, 2020, 2019, 2021, 1915, 2027, 2029, 2024, 2025, 1909,
179396 /* 480 */ 1899, 1923, 2028, 2028, 1913, 2037, 1917, 2042, 2059, 1918,
179397 /* 490 */ 1932, 2028, 1933, 2003, 2031, 2028, 1919, 2012, 2015, 2016,
179398 /* 500 */ 2022, 1936, 1956, 2040, 2053, 2077, 2074, 2058, 1967, 1924,
179399 /* 510 */ 2034, 2060, 2036, 2008, 2046, 1946, 1978, 2066, 2075, 2078,
179400 /* 520 */ 1968, 1972, 2084, 2041, 2086, 2088, 2076, 2089, 2048, 2054,
179401 /* 530 */ 2093, 2023, 2091, 2099, 2055, 2085, 2101, 2092, 1975, 2105,
179402 /* 540 */ 2110, 2111, 2112, 2115, 2113, 2043, 1997, 2117, 2120, 2032,
179403 /* 550 */ 2114, 2122, 2001, 2121, 2116, 2118, 2119, 2124, 2062, 2071,
179404 /* 560 */ 2068, 2123, 2080, 2065, 2126, 2138, 2140, 2139, 2141, 2143,
179405 /* 570 */ 2130, 2033, 2035, 2142, 2121, 2146, 2147, 2148, 2150, 2149,
179406 /* 580 */ 2152, 2156, 2151, 2164, 2158, 2159, 2161, 2162, 2160, 2165,
179407 /* 590 */ 2163, 2050, 2049, 2051, 2052, 2167, 2172, 2181, 2197, 2204,
 
179408 };
179409 #define YY_REDUCE_COUNT (423)
179410 #define YY_REDUCE_MIN (-303)
179411 #define YY_REDUCE_MAX (1825)
179412 static const short yy_reduce_ofst[] = {
179413 /* 0 */ -67, 345, -64, -178, -181, 143, 435, -78, -183, 163,
179414 /* 10 */ -185, 284, 384, -174, 189, 352, 440, 444, 493, -23,
179415 /* 20 */ 227, -277, -1, 305, 561, 755, 759, 764, -189, 839,
179416 /* 30 */ 857, 354, 484, 859, 631, 67, 734, 780, -187, 616,
179417 /* 40 */ 581, 730, 891, 449, 588, 795, 836, -238, 287, -238,
179418 /* 50 */ 287, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179419 /* 60 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179420 /* 70 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179421 /* 80 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,
179422 /* 90 */ -256, 205, 582, 715, 958, 985, 1003, 1005, 1010, 1012,
179423 /* 100 */ 1059, 1066, 1092, 1094, 1097, 1122, 1137, 1141, 1143, 1147,
179424 /* 110 */ 1151, 1172, 1249, 1251, 1269, 1271, 1276, 1290, 1316, 1318,
179425 /* 120 */ 1337, 1371, 1373, 1375, 1400, 1413, 1418, 1420, 1422, 1425,
179426 /* 130 */ 1427, 1433, 1438, 1447, 1454, 1459, 1463, 1467, 1480, 1484,
179427 /* 140 */ 1518, 1523, 1525, 1527, 1529, 1531, -256, -256, -256, -256,
179428 /* 150 */ -256, -256, -256, -256, -256, -256, -256, 155, 210, -220,
179429 /* 160 */ 86, -130, 943, 996, 402, -256, -113, 981, 1095, 1135,
179430 /* 170 */ 395, -256, -256, -256, -256, 568, 568, 568, -4, -153,
179431 /* 180 */ -133, 259, 306, -166, 523, -303, -126, 503, 503, -37,
179432 /* 190 */ -149, 164, 690, 292, 412, 492, 651, 784, 332, 786,
179433 /* 200 */ 841, 1149, 833, 1236, 792, 162, 796, 1253, 777, 288,
179434 /* 210 */ 381, 380, 709, 487, 1027, 972, 1030, 1084, 991, 1120,
179435 /* 220 */ -152, 1062, 692, 1240, 1247, 1250, 1239, 1306, -207, -194,
179436 /* 230 */ 57, 180, 74, 315, 355, 376, 452, 488, 630, 693,
179437 /* 240 */ 965, 1004, 1025, 1099, 1154, 1289, 1305, 1310, 1469, 1489,
179438 /* 250 */ 984, 1494, 1502, 1516, 1544, 1556, 1557, 1562, 1576, 1578,
179439 /* 260 */ 1579, 1583, 1584, 1585, 1586, 1217, 1440, 1554, 1589, 1593,
179440 /* 270 */ 1594, 1530, 1597, 1599, 1600, 1539, 1472, 1601, 1560, 1604,
179441 /* 280 */ 355, 1605, 1609, 1610, 1612, 1613, 1614, 1503, 1512, 1520,
179442 /* 290 */ 1567, 1548, 1558, 1559, 1561, 1530, 1567, 1567, 1569, 1596,
179443 /* 300 */ 1622, 1519, 1521, 1547, 1565, 1581, 1568, 1534, 1582, 1563,
179444 /* 310 */ 1566, 1591, 1570, 1606, 1536, 1619, 1615, 1616, 1624, 1626,
179445 /* 320 */ 1633, 1590, 1595, 1603, 1617, 1618, 1621, 1572, 1623, 1628,
179446 /* 330 */ 1663, 1644, 1577, 1647, 1648, 1673, 1675, 1588, 1627, 1678,
179447 /* 340 */ 1630, 1629, 1634, 1651, 1650, 1652, 1653, 1654, 1688, 1701,
179448 /* 350 */ 1655, 1635, 1636, 1658, 1639, 1672, 1661, 1677, 1666, 1715,
179449 /* 360 */ 1717, 1632, 1642, 1724, 1726, 1712, 1728, 1736, 1737, 1739,
179450 /* 370 */ 1718, 1722, 1723, 1725, 1719, 1720, 1721, 1727, 1731, 1734,
179451 /* 380 */ 1735, 1738, 1740, 1742, 1643, 1656, 1669, 1674, 1753, 1759,
179452 /* 390 */ 1645, 1646, 1711, 1713, 1748, 1744, 1709, 1789, 1716, 1749,
179453 /* 400 */ 1752, 1755, 1758, 1807, 1816, 1818, 1823, 1824, 1825, 1745,
179454 /* 410 */ 1754, 1714, 1811, 1806, 1808, 1809, 1810, 1813, 1802, 1803,
179455 /* 420 */ 1812, 1815, 1817, 1820,
179456 };
179457 static const YYACTIONTYPE yy_default[] = {
179458 /* 0 */ 1691, 1691, 1691, 1516, 1279, 1392, 1279, 1279, 1279, 1279,
179459 /* 10 */ 1516, 1516, 1516, 1279, 1279, 1279, 1279, 1279, 1279, 1422,
179460 /* 20 */ 1422, 1568, 1312, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179461 /* 30 */ 1279, 1279, 1279, 1279, 1279, 1515, 1279, 1279, 1279, 1279,
179462 /* 40 */ 1607, 1607, 1279, 1279, 1279, 1279, 1279, 1592, 1591, 1279,
179463 /* 50 */ 1279, 1279, 1431, 1279, 1279, 1279, 1438, 1279, 1279, 1279,
179464 /* 60 */ 1279, 1279, 1517, 1518, 1279, 1279, 1279, 1279, 1567, 1569,
179465 /* 70 */ 1533, 1445, 1444, 1443, 1442, 1551, 1410, 1436, 1429, 1433,
179466 /* 80 */ 1512, 1513, 1511, 1670, 1518, 1517, 1279, 1432, 1480, 1496,
179467 /* 90 */ 1479, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179468 /* 100 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179469 /* 110 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179470 /* 120 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179471 /* 130 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179472 /* 140 */ 1279, 1279, 1279, 1279, 1279, 1279, 1488, 1495, 1494, 1493,
179473 /* 150 */ 1502, 1492, 1489, 1482, 1481, 1483, 1484, 1303, 1300, 1354,
179474 /* 160 */ 1279, 1279, 1279, 1279, 1279, 1485, 1312, 1473, 1472, 1471,
179475 /* 170 */ 1279, 1499, 1486, 1498, 1497, 1575, 1644, 1643, 1534, 1279,
179476 /* 180 */ 1279, 1279, 1279, 1279, 1279, 1607, 1279, 1279, 1279, 1279,
179477 /* 190 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179478 /* 200 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1412, 1607,
179479 /* 210 */ 1607, 1279, 1312, 1607, 1607, 1308, 1413, 1413, 1308, 1308,
179480 /* 220 */ 1416, 1587, 1383, 1383, 1383, 1383, 1392, 1383, 1279, 1279,
179481 /* 230 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179482 /* 240 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1572, 1570, 1279,
179483 /* 250 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179484 /* 260 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179485 /* 270 */ 1279, 1279, 1279, 1279, 1279, 1388, 1279, 1279, 1279, 1279,
179486 /* 280 */ 1279, 1279, 1279, 1279, 1279, 1279, 1637, 1683, 1279, 1546,
179487 /* 290 */ 1368, 1388, 1388, 1388, 1388, 1390, 1369, 1367, 1382, 1313,
179488 /* 300 */ 1286, 1683, 1683, 1448, 1437, 1389, 1437, 1680, 1435, 1448,
179489 /* 310 */ 1448, 1435, 1448, 1389, 1680, 1329, 1659, 1324, 1422, 1422,
179490 /* 320 */ 1422, 1412, 1412, 1412, 1412, 1416, 1416, 1514, 1389, 1382,
179491 /* 330 */ 1279, 1355, 1683, 1355, 1355, 1398, 1398, 1682, 1682, 1398,
179492 /* 340 */ 1534, 1667, 1457, 1357, 1363, 1363, 1363, 1363, 1398, 1297,
179493 /* 350 */ 1435, 1667, 1667, 1435, 1457, 1357, 1435, 1357, 1435, 1398,
179494 /* 360 */ 1297, 1550, 1678, 1398, 1297, 1524, 1398, 1297, 1398, 1297,
179495 /* 370 */ 1524, 1355, 1355, 1355, 1344, 1279, 1279, 1524, 1355, 1329,
179496 /* 380 */ 1355, 1344, 1355, 1355, 1625, 1279, 1528, 1528, 1524, 1398,
179497 /* 390 */ 1617, 1617, 1425, 1425, 1430, 1416, 1519, 1398, 1279, 1430,
179498 /* 400 */ 1428, 1426, 1435, 1347, 1640, 1640, 1636, 1636, 1636, 1688,
179499 /* 410 */ 1688, 1587, 1652, 1312, 1312, 1312, 1312, 1652, 1331, 1331,
179500 /* 420 */ 1313, 1313, 1312, 1652, 1279, 1279, 1279, 1279, 1279, 1279,
179501 /* 430 */ 1279, 1647, 1279, 1279, 1535, 1279, 1279, 1279, 1279, 1279,
179502 /* 440 */ 1279, 1279, 1402, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179503 /* 450 */ 1279, 1279, 1593, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179504 /* 460 */ 1279, 1279, 1279, 1279, 1462, 1279, 1282, 1584, 1279, 1279,
179505 /* 470 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179506 /* 480 */ 1279, 1279, 1439, 1440, 1279, 1279, 1279, 1279, 1279, 1279,
179507 /* 490 */ 1279, 1454, 1279, 1279, 1279, 1449, 1279, 1279, 1279, 1279,
179508 /* 500 */ 1279, 1279, 1279, 1279, 1403, 1279, 1279, 1279, 1279, 1279,
179509 /* 510 */ 1279, 1549, 1548, 1279, 1279, 1400, 1279, 1279, 1279, 1279,
179510 /* 520 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1327,
179511 /* 530 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179512 /* 540 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179513 /* 550 */ 1279, 1279, 1279, 1427, 1279, 1279, 1279, 1279, 1279, 1279,
179514 /* 560 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1622, 1417,
179515 /* 570 */ 1279, 1279, 1279, 1279, 1671, 1279, 1279, 1279, 1279, 1377,
179516 /* 580 */ 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279, 1279,
179517 /* 590 */ 1663, 1371, 1463, 1279, 1466, 1301, 1279, 1291, 1279, 1279,
 
179518 };
179519 /********** End of lemon-generated parsing tables *****************************/
179520
179521 /* The next table maps tokens (terminal symbols) into fallback tokens.
179522 ** If a construct like the following:
@@ -180213,38 +180097,37 @@
180097 /* 290 */ "trigger_time",
180098 /* 291 */ "trigger_event",
180099 /* 292 */ "foreach_clause",
180100 /* 293 */ "when_clause",
180101 /* 294 */ "trigger_cmd",
180102 /* 295 */ "tridxby",
180103 /* 296 */ "database_kw_opt",
180104 /* 297 */ "key_opt",
180105 /* 298 */ "alter_add",
180106 /* 299 */ "kwcolumn_opt",
180107 /* 300 */ "create_vtab",
180108 /* 301 */ "vtabarglist",
180109 /* 302 */ "vtabarg",
180110 /* 303 */ "vtabargtoken",
180111 /* 304 */ "lp",
180112 /* 305 */ "anylist",
180113 /* 306 */ "wqitem",
180114 /* 307 */ "wqas",
180115 /* 308 */ "withnm",
180116 /* 309 */ "windowdefn_list",
180117 /* 310 */ "windowdefn",
180118 /* 311 */ "window",
180119 /* 312 */ "frame_opt",
180120 /* 313 */ "part_opt",
180121 /* 314 */ "filter_clause",
180122 /* 315 */ "over_clause",
180123 /* 316 */ "range_or_rows",
180124 /* 317 */ "frame_bound",
180125 /* 318 */ "frame_bound_s",
180126 /* 319 */ "frame_bound_e",
180127 /* 320 */ "frame_exclude_opt",
180128 /* 321 */ "frame_exclude",
 
180129 };
180130 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
180131
180132 #ifndef NDEBUG
180133 /* For tracing reduce actions, the names of all rules are required.
@@ -180370,12 +180253,12 @@
180253 /* 117 */ "dbnm ::= DOT nm",
180254 /* 118 */ "fullname ::= nm",
180255 /* 119 */ "fullname ::= nm DOT nm",
180256 /* 120 */ "xfullname ::= nm",
180257 /* 121 */ "xfullname ::= nm DOT nm",
180258 /* 122 */ "xfullname ::= nm AS nm",
180259 /* 123 */ "xfullname ::= nm DOT nm AS nm",
180260 /* 124 */ "joinop ::= COMMA|JOIN",
180261 /* 125 */ "joinop ::= JOIN_KW JOIN",
180262 /* 126 */ "joinop ::= JOIN_KW nm JOIN",
180263 /* 127 */ "joinop ::= JOIN_KW nm nm JOIN",
180264 /* 128 */ "on_using ::= ON expr",
@@ -180520,152 +180403,150 @@
180403 /* 267 */ "trigger_event ::= UPDATE OF idlist",
180404 /* 268 */ "when_clause ::=",
180405 /* 269 */ "when_clause ::= WHEN expr",
180406 /* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
180407 /* 271 */ "trigger_cmd_list ::= trigger_cmd SEMI",
180408 /* 272 */ "tridxby ::= INDEXED BY nm",
180409 /* 273 */ "tridxby ::= NOT INDEXED",
180410 /* 274 */ "trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt",
180411 /* 275 */ "trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt",
180412 /* 276 */ "trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt",
180413 /* 277 */ "trigger_cmd ::= scanpt select scanpt",
180414 /* 278 */ "expr ::= RAISE LP IGNORE RP",
180415 /* 279 */ "expr ::= RAISE LP raisetype COMMA expr RP",
180416 /* 280 */ "raisetype ::= ROLLBACK",
180417 /* 281 */ "raisetype ::= ABORT",
180418 /* 282 */ "raisetype ::= FAIL",
180419 /* 283 */ "cmd ::= DROP TRIGGER ifexists fullname",
180420 /* 284 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
180421 /* 285 */ "cmd ::= DETACH database_kw_opt expr",
180422 /* 286 */ "key_opt ::=",
180423 /* 287 */ "key_opt ::= KEY expr",
180424 /* 288 */ "cmd ::= REINDEX",
180425 /* 289 */ "cmd ::= REINDEX nm dbnm",
180426 /* 290 */ "cmd ::= ANALYZE",
180427 /* 291 */ "cmd ::= ANALYZE nm dbnm",
180428 /* 292 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
180429 /* 293 */ "cmd ::= alter_add carglist",
180430 /* 294 */ "alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken",
180431 /* 295 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
180432 /* 296 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
180433 /* 297 */ "cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm",
180434 /* 298 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL",
180435 /* 299 */ "cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf",
180436 /* 300 */ "cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf",
180437 /* 301 */ "cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf",
180438 /* 302 */ "cmd ::= create_vtab",
180439 /* 303 */ "cmd ::= create_vtab LP vtabarglist RP",
180440 /* 304 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
180441 /* 305 */ "vtabarg ::=",
180442 /* 306 */ "vtabargtoken ::= ANY",
180443 /* 307 */ "vtabargtoken ::= lp anylist RP",
180444 /* 308 */ "lp ::= LP",
180445 /* 309 */ "with ::= WITH wqlist",
180446 /* 310 */ "with ::= WITH RECURSIVE wqlist",
180447 /* 311 */ "wqas ::= AS",
180448 /* 312 */ "wqas ::= AS MATERIALIZED",
180449 /* 313 */ "wqas ::= AS NOT MATERIALIZED",
180450 /* 314 */ "wqitem ::= withnm eidlist_opt wqas LP select RP",
180451 /* 315 */ "withnm ::= nm",
180452 /* 316 */ "wqlist ::= wqitem",
180453 /* 317 */ "wqlist ::= wqlist COMMA wqitem",
180454 /* 318 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
180455 /* 319 */ "windowdefn ::= nm AS LP window RP",
180456 /* 320 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
180457 /* 321 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
180458 /* 322 */ "window ::= ORDER BY sortlist frame_opt",
180459 /* 323 */ "window ::= nm ORDER BY sortlist frame_opt",
180460 /* 324 */ "window ::= nm frame_opt",
180461 /* 325 */ "frame_opt ::=",
180462 /* 326 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
180463 /* 327 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
180464 /* 328 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
180465 /* 329 */ "frame_bound_s ::= frame_bound",
180466 /* 330 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
180467 /* 331 */ "frame_bound_e ::= frame_bound",
180468 /* 332 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
180469 /* 333 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
180470 /* 334 */ "frame_bound ::= CURRENT ROW",
180471 /* 335 */ "frame_exclude_opt ::=",
180472 /* 336 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
180473 /* 337 */ "frame_exclude ::= NO OTHERS",
180474 /* 338 */ "frame_exclude ::= CURRENT ROW",
180475 /* 339 */ "frame_exclude ::= GROUP|TIES",
180476 /* 340 */ "window_clause ::= WINDOW windowdefn_list",
180477 /* 341 */ "filter_over ::= filter_clause over_clause",
180478 /* 342 */ "filter_over ::= over_clause",
180479 /* 343 */ "filter_over ::= filter_clause",
180480 /* 344 */ "over_clause ::= OVER LP window RP",
180481 /* 345 */ "over_clause ::= OVER nm",
180482 /* 346 */ "filter_clause ::= FILTER LP WHERE expr RP",
180483 /* 347 */ "term ::= QNUMBER",
180484 /* 348 */ "input ::= cmdlist",
180485 /* 349 */ "cmdlist ::= cmdlist ecmd",
180486 /* 350 */ "cmdlist ::= ecmd",
180487 /* 351 */ "ecmd ::= SEMI",
180488 /* 352 */ "ecmd ::= cmdx SEMI",
180489 /* 353 */ "ecmd ::= explain cmdx SEMI",
180490 /* 354 */ "trans_opt ::=",
180491 /* 355 */ "trans_opt ::= TRANSACTION",
180492 /* 356 */ "trans_opt ::= TRANSACTION nm",
180493 /* 357 */ "savepoint_opt ::= SAVEPOINT",
180494 /* 358 */ "savepoint_opt ::=",
180495 /* 359 */ "cmd ::= create_table create_table_args",
180496 /* 360 */ "table_option_set ::= table_option",
180497 /* 361 */ "columnlist ::= columnlist COMMA columnname carglist",
180498 /* 362 */ "columnlist ::= columnname carglist",
180499 /* 363 */ "nm ::= ID|INDEXED|JOIN_KW",
180500 /* 364 */ "nm ::= STRING",
180501 /* 365 */ "typetoken ::= typename",
180502 /* 366 */ "typename ::= ID|STRING",
180503 /* 367 */ "signed ::= plus_num",
180504 /* 368 */ "signed ::= minus_num",
180505 /* 369 */ "carglist ::= carglist ccons",
180506 /* 370 */ "carglist ::=",
180507 /* 371 */ "ccons ::= NULL onconf",
180508 /* 372 */ "ccons ::= GENERATED ALWAYS AS generated",
180509 /* 373 */ "ccons ::= AS generated",
180510 /* 374 */ "conslist_opt ::= COMMA conslist",
180511 /* 375 */ "conslist ::= conslist tconscomma tcons",
180512 /* 376 */ "conslist ::= tcons",
180513 /* 377 */ "tconscomma ::=",
180514 /* 378 */ "defer_subclause_opt ::= defer_subclause",
180515 /* 379 */ "resolvetype ::= raisetype",
180516 /* 380 */ "selectnowith ::= oneselect",
180517 /* 381 */ "oneselect ::= values",
180518 /* 382 */ "sclp ::= selcollist COMMA",
180519 /* 383 */ "as ::= ID|STRING",
180520 /* 384 */ "indexed_opt ::= indexed_by",
180521 /* 385 */ "returning ::=",
180522 /* 386 */ "expr ::= term",
180523 /* 387 */ "likeop ::= LIKE_KW|MATCH",
180524 /* 388 */ "case_operand ::= expr",
180525 /* 389 */ "exprlist ::= nexprlist",
180526 /* 390 */ "nmnum ::= plus_num",
180527 /* 391 */ "nmnum ::= nm",
180528 /* 392 */ "nmnum ::= ON",
180529 /* 393 */ "nmnum ::= DELETE",
180530 /* 394 */ "nmnum ::= DEFAULT",
180531 /* 395 */ "plus_num ::= INTEGER|FLOAT",
180532 /* 396 */ "foreach_clause ::=",
180533 /* 397 */ "foreach_clause ::= FOR EACH ROW",
180534 /* 398 */ "tridxby ::=",
180535 /* 399 */ "database_kw_opt ::= DATABASE",
180536 /* 400 */ "database_kw_opt ::=",
180537 /* 401 */ "kwcolumn_opt ::=",
180538 /* 402 */ "kwcolumn_opt ::= COLUMNKW",
180539 /* 403 */ "vtabarglist ::= vtabarg",
180540 /* 404 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
180541 /* 405 */ "vtabarg ::= vtabarg vtabargtoken",
180542 /* 406 */ "anylist ::=",
180543 /* 407 */ "anylist ::= anylist LP anylist RP",
180544 /* 408 */ "anylist ::= anylist ANY",
180545 /* 409 */ "with ::=",
180546 /* 410 */ "windowdefn_list ::= windowdefn",
180547 /* 411 */ "window ::= frame_opt",
 
 
180548 };
180549 #endif /* NDEBUG */
180550
180551
180552 #if YYGROWABLESTACK
@@ -180800,11 +180681,11 @@
180681 case 241: /* selectnowith */
180682 case 242: /* oneselect */
180683 case 254: /* values */
180684 case 256: /* mvalues */
180685 {
180686 sqlite3SelectDelete(pParse->db, (yypminor->yy555));
180687 }
180688 break;
180689 case 218: /* term */
180690 case 219: /* expr */
180691 case 248: /* where_opt */
@@ -180812,14 +180693,14 @@
180693 case 270: /* where_opt_ret */
180694 case 281: /* case_operand */
180695 case 283: /* case_else */
180696 case 286: /* vinto */
180697 case 293: /* when_clause */
180698 case 297: /* key_opt */
180699 case 314: /* filter_clause */
180700 {
180701 sqlite3ExprDelete(pParse->db, (yypminor->yy454));
180702 }
180703 break;
180704 case 223: /* eidlist_opt */
180705 case 233: /* sortlist */
180706 case 234: /* eidlist */
@@ -180830,66 +180711,66 @@
180711 case 257: /* sclp */
180712 case 264: /* exprlist */
180713 case 271: /* setlist */
180714 case 280: /* paren_exprlist */
180715 case 282: /* case_exprlist */
180716 case 313: /* part_opt */
180717 {
180718 sqlite3ExprListDelete(pParse->db, (yypminor->yy14));
180719 }
180720 break;
180721 case 240: /* fullname */
180722 case 247: /* from */
180723 case 259: /* seltablist */
180724 case 260: /* stl_prefix */
180725 case 265: /* xfullname */
180726 {
180727 sqlite3SrcListDelete(pParse->db, (yypminor->yy203));
180728 }
180729 break;
180730 case 243: /* wqlist */
180731 {
180732 sqlite3WithDelete(pParse->db, (yypminor->yy59));
180733 }
180734 break;
180735 case 253: /* window_clause */
180736 case 309: /* windowdefn_list */
180737 {
180738 sqlite3WindowListDelete(pParse->db, (yypminor->yy211));
180739 }
180740 break;
180741 case 266: /* idlist */
180742 case 273: /* idlist_opt */
180743 {
180744 sqlite3IdListDelete(pParse->db, (yypminor->yy132));
180745 }
180746 break;
180747 case 276: /* filter_over */
180748 case 310: /* windowdefn */
180749 case 311: /* window */
180750 case 312: /* frame_opt */
180751 case 315: /* over_clause */
180752 {
180753 sqlite3WindowDelete(pParse->db, (yypminor->yy211));
180754 }
180755 break;
180756 case 289: /* trigger_cmd_list */
180757 case 294: /* trigger_cmd */
180758 {
180759 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427));
180760 }
180761 break;
180762 case 291: /* trigger_event */
180763 {
180764 sqlite3IdListDelete(pParse->db, (yypminor->yy286).b);
180765 }
180766 break;
180767 case 317: /* frame_bound */
180768 case 318: /* frame_bound_s */
180769 case 319: /* frame_bound_e */
180770 {
180771 sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr);
180772 }
180773 break;
180774 /********* End destructor definitions *****************************************/
180775 default: break; /* If no destructor action specified: do nothing */
180776 }
@@ -181311,12 +181192,12 @@
181192 202, /* (117) dbnm ::= DOT nm */
181193 240, /* (118) fullname ::= nm */
181194 240, /* (119) fullname ::= nm DOT nm */
181195 265, /* (120) xfullname ::= nm */
181196 265, /* (121) xfullname ::= nm DOT nm */
181197 265, /* (122) xfullname ::= nm AS nm */
181198 265, /* (123) xfullname ::= nm DOT nm AS nm */
181199 261, /* (124) joinop ::= COMMA|JOIN */
181200 261, /* (125) joinop ::= JOIN_KW JOIN */
181201 261, /* (126) joinop ::= JOIN_KW nm JOIN */
181202 261, /* (127) joinop ::= JOIN_KW nm nm JOIN */
181203 262, /* (128) on_using ::= ON expr */
@@ -181461,152 +181342,150 @@
181342 291, /* (267) trigger_event ::= UPDATE OF idlist */
181343 293, /* (268) when_clause ::= */
181344 293, /* (269) when_clause ::= WHEN expr */
181345 289, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
181346 289, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
181347 295, /* (272) tridxby ::= INDEXED BY nm */
181348 295, /* (273) tridxby ::= NOT INDEXED */
181349 294, /* (274) trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt */
181350 294, /* (275) trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt */
181351 294, /* (276) trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt */
181352 294, /* (277) trigger_cmd ::= scanpt select scanpt */
181353 219, /* (278) expr ::= RAISE LP IGNORE RP */
181354 219, /* (279) expr ::= RAISE LP raisetype COMMA expr RP */
181355 238, /* (280) raisetype ::= ROLLBACK */
181356 238, /* (281) raisetype ::= ABORT */
181357 238, /* (282) raisetype ::= FAIL */
181358 192, /* (283) cmd ::= DROP TRIGGER ifexists fullname */
181359 192, /* (284) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181360 192, /* (285) cmd ::= DETACH database_kw_opt expr */
181361 297, /* (286) key_opt ::= */
181362 297, /* (287) key_opt ::= KEY expr */
181363 192, /* (288) cmd ::= REINDEX */
181364 192, /* (289) cmd ::= REINDEX nm dbnm */
181365 192, /* (290) cmd ::= ANALYZE */
181366 192, /* (291) cmd ::= ANALYZE nm dbnm */
181367 192, /* (292) cmd ::= ALTER TABLE fullname RENAME TO nm */
181368 192, /* (293) cmd ::= alter_add carglist */
181369 298, /* (294) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181370 192, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181371 192, /* (296) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181372 192, /* (297) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181373 192, /* (298) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181374 192, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181375 192, /* (300) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181376 192, /* (301) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181377 192, /* (302) cmd ::= create_vtab */
181378 192, /* (303) cmd ::= create_vtab LP vtabarglist RP */
181379 300, /* (304) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181380 302, /* (305) vtabarg ::= */
181381 303, /* (306) vtabargtoken ::= ANY */
181382 303, /* (307) vtabargtoken ::= lp anylist RP */
181383 304, /* (308) lp ::= LP */
181384 269, /* (309) with ::= WITH wqlist */
181385 269, /* (310) with ::= WITH RECURSIVE wqlist */
181386 307, /* (311) wqas ::= AS */
181387 307, /* (312) wqas ::= AS MATERIALIZED */
181388 307, /* (313) wqas ::= AS NOT MATERIALIZED */
181389 306, /* (314) wqitem ::= withnm eidlist_opt wqas LP select RP */
181390 308, /* (315) withnm ::= nm */
181391 243, /* (316) wqlist ::= wqitem */
181392 243, /* (317) wqlist ::= wqlist COMMA wqitem */
181393 309, /* (318) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181394 310, /* (319) windowdefn ::= nm AS LP window RP */
181395 311, /* (320) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181396 311, /* (321) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181397 311, /* (322) window ::= ORDER BY sortlist frame_opt */
181398 311, /* (323) window ::= nm ORDER BY sortlist frame_opt */
181399 311, /* (324) window ::= nm frame_opt */
181400 312, /* (325) frame_opt ::= */
181401 312, /* (326) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181402 312, /* (327) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181403 316, /* (328) range_or_rows ::= RANGE|ROWS|GROUPS */
181404 318, /* (329) frame_bound_s ::= frame_bound */
181405 318, /* (330) frame_bound_s ::= UNBOUNDED PRECEDING */
181406 319, /* (331) frame_bound_e ::= frame_bound */
181407 319, /* (332) frame_bound_e ::= UNBOUNDED FOLLOWING */
181408 317, /* (333) frame_bound ::= expr PRECEDING|FOLLOWING */
181409 317, /* (334) frame_bound ::= CURRENT ROW */
181410 320, /* (335) frame_exclude_opt ::= */
181411 320, /* (336) frame_exclude_opt ::= EXCLUDE frame_exclude */
181412 321, /* (337) frame_exclude ::= NO OTHERS */
181413 321, /* (338) frame_exclude ::= CURRENT ROW */
181414 321, /* (339) frame_exclude ::= GROUP|TIES */
181415 253, /* (340) window_clause ::= WINDOW windowdefn_list */
181416 276, /* (341) filter_over ::= filter_clause over_clause */
181417 276, /* (342) filter_over ::= over_clause */
181418 276, /* (343) filter_over ::= filter_clause */
181419 315, /* (344) over_clause ::= OVER LP window RP */
181420 315, /* (345) over_clause ::= OVER nm */
181421 314, /* (346) filter_clause ::= FILTER LP WHERE expr RP */
181422 218, /* (347) term ::= QNUMBER */
181423 187, /* (348) input ::= cmdlist */
181424 188, /* (349) cmdlist ::= cmdlist ecmd */
181425 188, /* (350) cmdlist ::= ecmd */
181426 189, /* (351) ecmd ::= SEMI */
181427 189, /* (352) ecmd ::= cmdx SEMI */
181428 189, /* (353) ecmd ::= explain cmdx SEMI */
181429 194, /* (354) trans_opt ::= */
181430 194, /* (355) trans_opt ::= TRANSACTION */
181431 194, /* (356) trans_opt ::= TRANSACTION nm */
181432 196, /* (357) savepoint_opt ::= SAVEPOINT */
181433 196, /* (358) savepoint_opt ::= */
181434 192, /* (359) cmd ::= create_table create_table_args */
181435 205, /* (360) table_option_set ::= table_option */
181436 203, /* (361) columnlist ::= columnlist COMMA columnname carglist */
181437 203, /* (362) columnlist ::= columnname carglist */
181438 195, /* (363) nm ::= ID|INDEXED|JOIN_KW */
181439 195, /* (364) nm ::= STRING */
181440 210, /* (365) typetoken ::= typename */
181441 211, /* (366) typename ::= ID|STRING */
181442 212, /* (367) signed ::= plus_num */
181443 212, /* (368) signed ::= minus_num */
181444 209, /* (369) carglist ::= carglist ccons */
181445 209, /* (370) carglist ::= */
181446 217, /* (371) ccons ::= NULL onconf */
181447 217, /* (372) ccons ::= GENERATED ALWAYS AS generated */
181448 217, /* (373) ccons ::= AS generated */
181449 204, /* (374) conslist_opt ::= COMMA conslist */
181450 230, /* (375) conslist ::= conslist tconscomma tcons */
181451 230, /* (376) conslist ::= tcons */
181452 231, /* (377) tconscomma ::= */
181453 235, /* (378) defer_subclause_opt ::= defer_subclause */
181454 237, /* (379) resolvetype ::= raisetype */
181455 241, /* (380) selectnowith ::= oneselect */
181456 242, /* (381) oneselect ::= values */
181457 257, /* (382) sclp ::= selcollist COMMA */
181458 258, /* (383) as ::= ID|STRING */
181459 267, /* (384) indexed_opt ::= indexed_by */
181460 275, /* (385) returning ::= */
181461 219, /* (386) expr ::= term */
181462 277, /* (387) likeop ::= LIKE_KW|MATCH */
181463 281, /* (388) case_operand ::= expr */
181464 264, /* (389) exprlist ::= nexprlist */
181465 287, /* (390) nmnum ::= plus_num */
181466 287, /* (391) nmnum ::= nm */
181467 287, /* (392) nmnum ::= ON */
181468 287, /* (393) nmnum ::= DELETE */
181469 287, /* (394) nmnum ::= DEFAULT */
181470 213, /* (395) plus_num ::= INTEGER|FLOAT */
181471 292, /* (396) foreach_clause ::= */
181472 292, /* (397) foreach_clause ::= FOR EACH ROW */
181473 295, /* (398) tridxby ::= */
181474 296, /* (399) database_kw_opt ::= DATABASE */
181475 296, /* (400) database_kw_opt ::= */
181476 299, /* (401) kwcolumn_opt ::= */
181477 299, /* (402) kwcolumn_opt ::= COLUMNKW */
181478 301, /* (403) vtabarglist ::= vtabarg */
181479 301, /* (404) vtabarglist ::= vtabarglist COMMA vtabarg */
181480 302, /* (405) vtabarg ::= vtabarg vtabargtoken */
181481 305, /* (406) anylist ::= */
181482 305, /* (407) anylist ::= anylist LP anylist RP */
181483 305, /* (408) anylist ::= anylist ANY */
181484 269, /* (409) with ::= */
181485 309, /* (410) windowdefn_list ::= windowdefn */
181486 311, /* (411) window ::= frame_opt */
 
 
181487 };
181488
181489 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
181490 ** of symbols on the right-hand side of that rule. */
181491 static const signed char yyRuleInfoNRhs[] = {
@@ -181730,12 +181609,12 @@
181609 -2, /* (117) dbnm ::= DOT nm */
181610 -1, /* (118) fullname ::= nm */
181611 -3, /* (119) fullname ::= nm DOT nm */
181612 -1, /* (120) xfullname ::= nm */
181613 -3, /* (121) xfullname ::= nm DOT nm */
181614 -3, /* (122) xfullname ::= nm AS nm */
181615 -5, /* (123) xfullname ::= nm DOT nm AS nm */
181616 -1, /* (124) joinop ::= COMMA|JOIN */
181617 -2, /* (125) joinop ::= JOIN_KW JOIN */
181618 -3, /* (126) joinop ::= JOIN_KW nm JOIN */
181619 -4, /* (127) joinop ::= JOIN_KW nm nm JOIN */
181620 -2, /* (128) on_using ::= ON expr */
@@ -181880,152 +181759,150 @@
181759 -3, /* (267) trigger_event ::= UPDATE OF idlist */
181760 0, /* (268) when_clause ::= */
181761 -2, /* (269) when_clause ::= WHEN expr */
181762 -3, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
181763 -2, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
181764 -3, /* (272) tridxby ::= INDEXED BY nm */
181765 -2, /* (273) tridxby ::= NOT INDEXED */
181766 -9, /* (274) trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt */
181767 -8, /* (275) trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt */
181768 -6, /* (276) trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt */
181769 -3, /* (277) trigger_cmd ::= scanpt select scanpt */
181770 -4, /* (278) expr ::= RAISE LP IGNORE RP */
181771 -6, /* (279) expr ::= RAISE LP raisetype COMMA expr RP */
181772 -1, /* (280) raisetype ::= ROLLBACK */
181773 -1, /* (281) raisetype ::= ABORT */
181774 -1, /* (282) raisetype ::= FAIL */
181775 -4, /* (283) cmd ::= DROP TRIGGER ifexists fullname */
181776 -6, /* (284) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
181777 -3, /* (285) cmd ::= DETACH database_kw_opt expr */
181778 0, /* (286) key_opt ::= */
181779 -2, /* (287) key_opt ::= KEY expr */
181780 -1, /* (288) cmd ::= REINDEX */
181781 -3, /* (289) cmd ::= REINDEX nm dbnm */
181782 -1, /* (290) cmd ::= ANALYZE */
181783 -3, /* (291) cmd ::= ANALYZE nm dbnm */
181784 -6, /* (292) cmd ::= ALTER TABLE fullname RENAME TO nm */
181785 -2, /* (293) cmd ::= alter_add carglist */
181786 -7, /* (294) alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
181787 -6, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
181788 -8, /* (296) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
181789 -6, /* (297) cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
181790 -9, /* (298) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
181791 -10, /* (299) cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
181792 -11, /* (300) cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
181793 -9, /* (301) cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
181794 -1, /* (302) cmd ::= create_vtab */
181795 -4, /* (303) cmd ::= create_vtab LP vtabarglist RP */
181796 -8, /* (304) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
181797 0, /* (305) vtabarg ::= */
181798 -1, /* (306) vtabargtoken ::= ANY */
181799 -3, /* (307) vtabargtoken ::= lp anylist RP */
181800 -1, /* (308) lp ::= LP */
181801 -2, /* (309) with ::= WITH wqlist */
181802 -3, /* (310) with ::= WITH RECURSIVE wqlist */
181803 -1, /* (311) wqas ::= AS */
181804 -2, /* (312) wqas ::= AS MATERIALIZED */
181805 -3, /* (313) wqas ::= AS NOT MATERIALIZED */
181806 -6, /* (314) wqitem ::= withnm eidlist_opt wqas LP select RP */
181807 -1, /* (315) withnm ::= nm */
181808 -1, /* (316) wqlist ::= wqitem */
181809 -3, /* (317) wqlist ::= wqlist COMMA wqitem */
181810 -3, /* (318) windowdefn_list ::= windowdefn_list COMMA windowdefn */
181811 -5, /* (319) windowdefn ::= nm AS LP window RP */
181812 -5, /* (320) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
181813 -6, /* (321) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
181814 -4, /* (322) window ::= ORDER BY sortlist frame_opt */
181815 -5, /* (323) window ::= nm ORDER BY sortlist frame_opt */
181816 -2, /* (324) window ::= nm frame_opt */
181817 0, /* (325) frame_opt ::= */
181818 -3, /* (326) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
181819 -6, /* (327) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
181820 -1, /* (328) range_or_rows ::= RANGE|ROWS|GROUPS */
181821 -1, /* (329) frame_bound_s ::= frame_bound */
181822 -2, /* (330) frame_bound_s ::= UNBOUNDED PRECEDING */
181823 -1, /* (331) frame_bound_e ::= frame_bound */
181824 -2, /* (332) frame_bound_e ::= UNBOUNDED FOLLOWING */
181825 -2, /* (333) frame_bound ::= expr PRECEDING|FOLLOWING */
181826 -2, /* (334) frame_bound ::= CURRENT ROW */
181827 0, /* (335) frame_exclude_opt ::= */
181828 -2, /* (336) frame_exclude_opt ::= EXCLUDE frame_exclude */
181829 -2, /* (337) frame_exclude ::= NO OTHERS */
181830 -2, /* (338) frame_exclude ::= CURRENT ROW */
181831 -1, /* (339) frame_exclude ::= GROUP|TIES */
181832 -2, /* (340) window_clause ::= WINDOW windowdefn_list */
181833 -2, /* (341) filter_over ::= filter_clause over_clause */
181834 -1, /* (342) filter_over ::= over_clause */
181835 -1, /* (343) filter_over ::= filter_clause */
181836 -4, /* (344) over_clause ::= OVER LP window RP */
181837 -2, /* (345) over_clause ::= OVER nm */
181838 -5, /* (346) filter_clause ::= FILTER LP WHERE expr RP */
181839 -1, /* (347) term ::= QNUMBER */
181840 -1, /* (348) input ::= cmdlist */
181841 -2, /* (349) cmdlist ::= cmdlist ecmd */
181842 -1, /* (350) cmdlist ::= ecmd */
181843 -1, /* (351) ecmd ::= SEMI */
181844 -2, /* (352) ecmd ::= cmdx SEMI */
181845 -3, /* (353) ecmd ::= explain cmdx SEMI */
181846 0, /* (354) trans_opt ::= */
181847 -1, /* (355) trans_opt ::= TRANSACTION */
181848 -2, /* (356) trans_opt ::= TRANSACTION nm */
181849 -1, /* (357) savepoint_opt ::= SAVEPOINT */
181850 0, /* (358) savepoint_opt ::= */
181851 -2, /* (359) cmd ::= create_table create_table_args */
181852 -1, /* (360) table_option_set ::= table_option */
181853 -4, /* (361) columnlist ::= columnlist COMMA columnname carglist */
181854 -2, /* (362) columnlist ::= columnname carglist */
181855 -1, /* (363) nm ::= ID|INDEXED|JOIN_KW */
181856 -1, /* (364) nm ::= STRING */
181857 -1, /* (365) typetoken ::= typename */
181858 -1, /* (366) typename ::= ID|STRING */
181859 -1, /* (367) signed ::= plus_num */
181860 -1, /* (368) signed ::= minus_num */
181861 -2, /* (369) carglist ::= carglist ccons */
181862 0, /* (370) carglist ::= */
181863 -2, /* (371) ccons ::= NULL onconf */
181864 -4, /* (372) ccons ::= GENERATED ALWAYS AS generated */
181865 -2, /* (373) ccons ::= AS generated */
181866 -2, /* (374) conslist_opt ::= COMMA conslist */
181867 -3, /* (375) conslist ::= conslist tconscomma tcons */
181868 -1, /* (376) conslist ::= tcons */
181869 0, /* (377) tconscomma ::= */
181870 -1, /* (378) defer_subclause_opt ::= defer_subclause */
181871 -1, /* (379) resolvetype ::= raisetype */
181872 -1, /* (380) selectnowith ::= oneselect */
181873 -1, /* (381) oneselect ::= values */
181874 -2, /* (382) sclp ::= selcollist COMMA */
181875 -1, /* (383) as ::= ID|STRING */
181876 -1, /* (384) indexed_opt ::= indexed_by */
181877 0, /* (385) returning ::= */
181878 -1, /* (386) expr ::= term */
181879 -1, /* (387) likeop ::= LIKE_KW|MATCH */
181880 -1, /* (388) case_operand ::= expr */
181881 -1, /* (389) exprlist ::= nexprlist */
181882 -1, /* (390) nmnum ::= plus_num */
181883 -1, /* (391) nmnum ::= nm */
181884 -1, /* (392) nmnum ::= ON */
181885 -1, /* (393) nmnum ::= DELETE */
181886 -1, /* (394) nmnum ::= DEFAULT */
181887 -1, /* (395) plus_num ::= INTEGER|FLOAT */
181888 0, /* (396) foreach_clause ::= */
181889 -3, /* (397) foreach_clause ::= FOR EACH ROW */
181890 0, /* (398) tridxby ::= */
181891 -1, /* (399) database_kw_opt ::= DATABASE */
181892 0, /* (400) database_kw_opt ::= */
181893 0, /* (401) kwcolumn_opt ::= */
181894 -1, /* (402) kwcolumn_opt ::= COLUMNKW */
181895 -1, /* (403) vtabarglist ::= vtabarg */
181896 -3, /* (404) vtabarglist ::= vtabarglist COMMA vtabarg */
181897 -2, /* (405) vtabarg ::= vtabarg vtabargtoken */
181898 0, /* (406) anylist ::= */
181899 -4, /* (407) anylist ::= anylist LP anylist RP */
181900 -2, /* (408) anylist ::= anylist ANY */
181901 0, /* (409) with ::= */
181902 -1, /* (410) windowdefn_list ::= windowdefn */
181903 -1, /* (411) window ::= frame_opt */
 
 
181904 };
181905
181906 static void yy_accept(yyParser*); /* Forward Declaration */
181907
181908 /*
@@ -182073,20 +181950,20 @@
181950 break;
181951 case 2: /* cmdx ::= cmd */
181952 { sqlite3FinishCoding(pParse); }
181953 break;
181954 case 3: /* cmd ::= BEGIN transtype trans_opt */
181955 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);}
181956 break;
181957 case 4: /* transtype ::= */
181958 {yymsp[1].minor.yy144 = TK_DEFERRED;}
181959 break;
181960 case 5: /* transtype ::= DEFERRED */
181961 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
181962 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
181963 case 328: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==328);
181964 {yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/}
181965 break;
181966 case 8: /* cmd ::= COMMIT|END trans_opt */
181967 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
181968 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
181969 break;
@@ -182105,11 +181982,11 @@
181982 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
181983 }
181984 break;
181985 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
181986 {
181987 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144);
181988 }
181989 break;
181990 case 14: /* createkw ::= CREATE */
181991 {
181992 disableLookaside(pParse);
@@ -182121,56 +181998,56 @@
181998 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
181999 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
182000 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
182001 case 100: /* distinct ::= */ yytestcase(yyruleno==100);
182002 case 246: /* collate ::= */ yytestcase(yyruleno==246);
182003 {yymsp[1].minor.yy144 = 0;}
182004 break;
182005 case 16: /* ifnotexists ::= IF NOT EXISTS */
182006 {yymsp[-2].minor.yy144 = 1;}
182007 break;
182008 case 17: /* temp ::= TEMP */
182009 {yymsp[0].minor.yy144 = pParse->db->init.busy==0;}
182010 break;
182011 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
182012 {
182013 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0);
182014 }
182015 break;
182016 case 20: /* create_table_args ::= AS select */
182017 {
182018 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555);
182019 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
182020 }
182021 break;
182022 case 21: /* table_option_set ::= */
182023 {yymsp[1].minor.yy391 = 0;}
182024 break;
182025 case 22: /* table_option_set ::= table_option_set COMMA table_option */
182026 {yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;}
182027 yymsp[-2].minor.yy391 = yylhsminor.yy391;
182028 break;
182029 case 23: /* table_option ::= WITHOUT nm */
182030 {
182031 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
182032 yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid;
182033 }else{
182034 yymsp[-1].minor.yy391 = 0;
182035 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
182036 }
182037 }
182038 break;
182039 case 24: /* table_option ::= nm */
182040 {
182041 if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
182042 yylhsminor.yy391 = TF_Strict;
182043 }else{
182044 yylhsminor.yy391 = 0;
182045 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
182046 }
182047 }
182048 yymsp[0].minor.yy391 = yylhsminor.yy391;
182049 break;
182050 case 25: /* columnname ::= nm typetoken */
182051 {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
182052 break;
182053 case 26: /* typetoken ::= */
@@ -182192,11 +182069,11 @@
182069 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
182070 break;
182071 case 30: /* scanpt ::= */
182072 {
182073 assert( yyLookahead!=YYNOCODE );
182074 yymsp[1].minor.yy168 = yyLookaheadToken.z;
182075 }
182076 break;
182077 case 31: /* scantok ::= */
182078 {
182079 assert( yyLookahead!=YYNOCODE );
@@ -182206,21 +182083,21 @@
182083 case 32: /* ccons ::= CONSTRAINT nm */
182084 case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
182085 {ASSERT_IS_CREATE; pParse->u1.cr.constraintName = yymsp[0].minor.yy0;}
182086 break;
182087 case 33: /* ccons ::= DEFAULT scantok term */
182088 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182089 break;
182090 case 34: /* ccons ::= DEFAULT LP expr RP */
182091 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
182092 break;
182093 case 35: /* ccons ::= DEFAULT PLUS scantok term */
182094 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
182095 break;
182096 case 36: /* ccons ::= DEFAULT MINUS scantok term */
182097 {
182098 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0);
182099 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
182100 }
182101 break;
182102 case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
182103 {
@@ -182231,262 +182108,262 @@
182108 }
182109 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
182110 }
182111 break;
182112 case 38: /* ccons ::= NOT NULL onconf */
182113 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);}
182114 break;
182115 case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
182116 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);}
182117 break;
182118 case 40: /* ccons ::= UNIQUE onconf */
182119 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0,
182120 SQLITE_IDXTYPE_UNIQUE);}
182121 break;
182122 case 41: /* ccons ::= CHECK LP expr RP */
182123 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
182124 break;
182125 case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
182126 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);}
182127 break;
182128 case 43: /* ccons ::= defer_subclause */
182129 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);}
182130 break;
182131 case 44: /* ccons ::= COLLATE ID|STRING */
182132 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
182133 break;
182134 case 45: /* generated ::= LP expr RP */
182135 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);}
182136 break;
182137 case 46: /* generated ::= LP expr RP ID */
182138 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);}
182139 break;
182140 case 48: /* autoinc ::= AUTOINCR */
182141 {yymsp[0].minor.yy144 = 1;}
182142 break;
182143 case 49: /* refargs ::= */
182144 { yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */}
182145 break;
182146 case 50: /* refargs ::= refargs refarg */
182147 { yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; }
182148 break;
182149 case 51: /* refarg ::= MATCH nm */
182150 { yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; }
182151 break;
182152 case 52: /* refarg ::= ON INSERT refact */
182153 { yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; }
182154 break;
182155 case 53: /* refarg ::= ON DELETE refact */
182156 { yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; }
182157 break;
182158 case 54: /* refarg ::= ON UPDATE refact */
182159 { yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; }
182160 break;
182161 case 55: /* refact ::= SET NULL */
182162 { yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */}
182163 break;
182164 case 56: /* refact ::= SET DEFAULT */
182165 { yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */}
182166 break;
182167 case 57: /* refact ::= CASCADE */
182168 { yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */}
182169 break;
182170 case 58: /* refact ::= RESTRICT */
182171 { yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */}
182172 break;
182173 case 59: /* refact ::= NO ACTION */
182174 { yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */}
182175 break;
182176 case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
182177 {yymsp[-2].minor.yy144 = 0;}
182178 break;
182179 case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
182180 case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
182181 case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
182182 {yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;}
182183 break;
182184 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
182185 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
182186 case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
182187 case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
182188 case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
182189 {yymsp[-1].minor.yy144 = 1;}
182190 break;
182191 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
182192 {yymsp[-1].minor.yy144 = 0;}
182193 break;
182194 case 66: /* tconscomma ::= COMMA */
182195 {ASSERT_IS_CREATE; pParse->u1.cr.constraintName.n = 0;}
182196 break;
182197 case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
182198 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);}
182199 break;
182200 case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
182201 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0,
182202 SQLITE_IDXTYPE_UNIQUE);}
182203 break;
182204 case 70: /* tcons ::= CHECK LP expr RP onconf */
182205 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
182206 break;
182207 case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
182208 {
182209 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144);
182210 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144);
182211 }
182212 break;
182213 case 73: /* onconf ::= */
182214 case 75: /* orconf ::= */ yytestcase(yyruleno==75);
182215 {yymsp[1].minor.yy144 = OE_Default;}
182216 break;
182217 case 74: /* onconf ::= ON CONFLICT resolvetype */
182218 {yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;}
182219 break;
182220 case 77: /* resolvetype ::= IGNORE */
182221 {yymsp[0].minor.yy144 = OE_Ignore;}
182222 break;
182223 case 78: /* resolvetype ::= REPLACE */
182224 case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
182225 {yymsp[0].minor.yy144 = OE_Replace;}
182226 break;
182227 case 79: /* cmd ::= DROP TABLE ifexists fullname */
182228 {
182229 sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144);
182230 }
182231 break;
182232 case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
182233 {
182234 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144);
182235 }
182236 break;
182237 case 83: /* cmd ::= DROP VIEW ifexists fullname */
182238 {
182239 sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144);
182240 }
182241 break;
182242 case 84: /* cmd ::= select */
182243 {
182244 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
182245 if( (pParse->db->mDbFlags & DBFLAG_EncodingFixed)!=0
182246 || sqlite3ReadSchema(pParse)==SQLITE_OK
182247 ){
182248 sqlite3Select(pParse, yymsp[0].minor.yy555, &dest);
182249 }
182250 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
182251 }
182252 break;
182253 case 85: /* select ::= WITH wqlist selectnowith */
182254 {yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
182255 break;
182256 case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
182257 {yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
182258 break;
182259 case 87: /* select ::= selectnowith */
182260 {
182261 Select *p = yymsp[0].minor.yy555;
182262 if( p ){
182263 parserDoubleLinkSelect(pParse, p);
182264 }
182265 }
182266 break;
182267 case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
182268 {
182269 Select *pRhs = yymsp[0].minor.yy555;
182270 Select *pLhs = yymsp[-2].minor.yy555;
182271 if( pRhs && pRhs->pPrior ){
182272 SrcList *pFrom;
182273 Token x;
182274 x.n = 0;
182275 parserDoubleLinkSelect(pParse, pRhs);
182276 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0);
182277 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
182278 }
182279 if( pRhs ){
182280 pRhs->op = (u8)yymsp[-1].minor.yy144;
182281 pRhs->pPrior = pLhs;
182282 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~(u32)SF_MultiValue;
182283 pRhs->selFlags &= ~(u32)SF_MultiValue;
182284 if( yymsp[-1].minor.yy144!=TK_ALL ) pParse->hasCompound = 1;
182285 }else{
182286 sqlite3SelectDelete(pParse->db, pLhs);
182287 }
182288 yymsp[-2].minor.yy555 = pRhs;
182289 }
182290 break;
182291 case 89: /* multiselect_op ::= UNION */
182292 case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
182293 {yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/}
182294 break;
182295 case 90: /* multiselect_op ::= UNION ALL */
182296 {yymsp[-1].minor.yy144 = TK_ALL;}
182297 break;
182298 case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
182299 {
182300 yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454);
182301 }
182302 break;
182303 case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
182304 {
182305 yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454);
182306 if( yymsp[-9].minor.yy555 ){
182307 yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211;
182308 }else{
182309 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211);
182310 }
182311 }
182312 break;
182313 case 94: /* values ::= VALUES LP nexprlist RP */
182314 {
182315 yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0);
182316 }
182317 break;
182318 case 95: /* oneselect ::= mvalues */
182319 {
182320 sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555);
182321 }
182322 break;
182323 case 96: /* mvalues ::= values COMMA LP nexprlist RP */
182324 case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
182325 {
182326 yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14);
182327 }
182328 break;
182329 case 98: /* distinct ::= DISTINCT */
182330 {yymsp[0].minor.yy144 = SF_Distinct;}
182331 break;
182332 case 99: /* distinct ::= ALL */
182333 {yymsp[0].minor.yy144 = SF_All;}
182334 break;
182335 case 101: /* sclp ::= */
182336 case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
182337 case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144);
182338 case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
182339 case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
182340 case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
182341 {yymsp[1].minor.yy14 = 0;}
182342 break;
182343 case 102: /* selcollist ::= sclp scanpt expr scanpt as */
182344 {
182345 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
182346 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1);
182347 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168);
182348 }
182349 break;
182350 case 103: /* selcollist ::= sclp scanpt STAR */
182351 {
182352 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
182353 sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
182354 yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p);
182355 }
182356 break;
182357 case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
182358 {
182359 Expr *pRight, *pLeft, *pDot;
182360 pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
182361 sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
182362 pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
182363 pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
182364 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot);
182365 }
182366 break;
182367 case 105: /* as ::= AS nm */
182368 case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117);
182369 case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258);
@@ -182493,54 +182370,54 @@
182370 case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259);
182371 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
182372 break;
182373 case 107: /* from ::= */
182374 case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
182375 {yymsp[1].minor.yy203 = 0;}
182376 break;
182377 case 108: /* from ::= FROM seltablist */
182378 {
182379 yymsp[-1].minor.yy203 = yymsp[0].minor.yy203;
182380 sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203);
182381 }
182382 break;
182383 case 109: /* stl_prefix ::= seltablist joinop */
182384 {
182385 if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144;
182386 }
182387 break;
182388 case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
182389 {
182390 yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
182391 }
182392 break;
182393 case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
182394 {
182395 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269);
182396 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0);
182397 }
182398 break;
182399 case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
182400 {
182401 yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
182402 sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14);
182403 }
182404 break;
182405 case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
182406 {
182407 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269);
182408 }
182409 break;
182410 case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
182411 {
182412 if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){
182413 yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203;
182414 }else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){
182415 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
182416 if( yymsp[-5].minor.yy203 ){
182417 SrcItem *pNew = &yymsp[-5].minor.yy203->a[yymsp[-5].minor.yy203->nSrc-1];
182418 SrcItem *pOld = yymsp[-3].minor.yy203->a;
182419 assert( pOld->fg.fixedSchema==0 );
182420 pNew->zName = pOld->zName;
182421 assert( pOld->fg.fixedSchema==0 );
182422 if( pOld->fg.isSubquery ){
182423 pNew->fg.isSubquery = 1;
@@ -182561,249 +182438,259 @@
182438 pOld->fg.isTabFunc = 0;
182439 pNew->fg.isTabFunc = 1;
182440 }
182441 pOld->zName = 0;
182442 }
182443 sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy203);
182444 }else{
182445 Select *pSubquery;
182446 sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203);
182447 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0);
182448 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269);
182449 }
182450 }
182451 break;
182452 case 116: /* dbnm ::= */
182453 case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131);
182454 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
182455 break;
182456 case 118: /* fullname ::= nm */
182457 case 120: /* xfullname ::= nm */ yytestcase(yyruleno==120);
182458 {
182459 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
182460 if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
182461 }
182462 yymsp[0].minor.yy203 = yylhsminor.yy203;
182463 break;
182464 case 119: /* fullname ::= nm DOT nm */
182465 case 121: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==121);
182466 {
182467 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
182468 if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
182469 }
182470 yymsp[-2].minor.yy203 = yylhsminor.yy203;
182471 break;
182472 case 122: /* xfullname ::= nm AS nm */
182473 {
182474 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0);
182475 if( yylhsminor.yy203 ){
182476 if( IN_RENAME_OBJECT ){
182477 sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[-2].minor.yy0);
182478 }else{
182479 yylhsminor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182480 }
182481 }
182482 }
182483 yymsp[-2].minor.yy203 = yylhsminor.yy203;
182484 break;
182485 case 123: /* xfullname ::= nm DOT nm AS nm */
182486 {
182487 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0);
182488 if( yylhsminor.yy203 ){
182489 if( IN_RENAME_OBJECT ){
182490 sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[-2].minor.yy0);
182491 }else{
182492 yylhsminor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
182493 }
182494 }
182495 }
182496 yymsp[-4].minor.yy203 = yylhsminor.yy203;
182497 break;
182498 case 124: /* joinop ::= COMMA|JOIN */
182499 { yymsp[0].minor.yy144 = JT_INNER; }
182500 break;
182501 case 125: /* joinop ::= JOIN_KW JOIN */
182502 {yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
182503 break;
182504 case 126: /* joinop ::= JOIN_KW nm JOIN */
182505 {yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
182506 break;
182507 case 127: /* joinop ::= JOIN_KW nm nm JOIN */
182508 {yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
182509 break;
182510 case 128: /* on_using ::= ON expr */
182511 {yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;}
182512 break;
182513 case 129: /* on_using ::= USING LP idlist RP */
182514 {yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;}
182515 break;
182516 case 130: /* on_using ::= */
182517 {yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;}
182518 break;
182519 case 132: /* indexed_by ::= INDEXED BY nm */
182520 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
182521 break;
182522 case 133: /* indexed_by ::= NOT INDEXED */
182523 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
182524 break;
182525 case 135: /* orderby_opt ::= ORDER BY sortlist */
182526 case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
182527 {yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;}
182528 break;
182529 case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
182530 {
182531 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454);
182532 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
182533 }
182534 break;
182535 case 137: /* sortlist ::= expr sortorder nulls */
182536 {
182537 yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/
182538 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
182539 }
182540 break;
182541 case 138: /* sortorder ::= ASC */
182542 {yymsp[0].minor.yy144 = SQLITE_SO_ASC;}
182543 break;
182544 case 139: /* sortorder ::= DESC */
182545 {yymsp[0].minor.yy144 = SQLITE_SO_DESC;}
182546 break;
182547 case 140: /* sortorder ::= */
182548 case 143: /* nulls ::= */ yytestcase(yyruleno==143);
182549 {yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;}
182550 break;
182551 case 141: /* nulls ::= NULLS FIRST */
182552 {yymsp[-1].minor.yy144 = SQLITE_SO_ASC;}
182553 break;
182554 case 142: /* nulls ::= NULLS LAST */
182555 {yymsp[-1].minor.yy144 = SQLITE_SO_DESC;}
182556 break;
182557 case 146: /* having_opt ::= */
182558 case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
182559 case 153: /* where_opt ::= */ yytestcase(yyruleno==153);
182560 case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155);
182561 case 232: /* case_else ::= */ yytestcase(yyruleno==232);
182562 case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
182563 case 252: /* vinto ::= */ yytestcase(yyruleno==252);
182564 {yymsp[1].minor.yy454 = 0;}
182565 break;
182566 case 147: /* having_opt ::= HAVING expr */
182567 case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
182568 case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
182569 case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
182570 case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
182571 {yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
182572 break;
182573 case 149: /* limit_opt ::= LIMIT expr */
182574 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);}
182575 break;
182576 case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
182577 {yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
182578 break;
182579 case 151: /* limit_opt ::= LIMIT expr COMMA expr */
182580 {yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);}
182581 break;
182582 case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
182583 {
182584 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0);
182585 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0);
182586 }
182587 break;
182588 case 157: /* where_opt_ret ::= RETURNING selcollist */
182589 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;}
182590 break;
182591 case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
182592 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;}
182593 break;
182594 case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
182595 {
182596 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0);
182597 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list");
182598 if( yymsp[-1].minor.yy203 ){
182599 SrcList *pFromClause = yymsp[-1].minor.yy203;
182600 if( pFromClause->nSrc>1 ){
182601 Select *pSubquery;
182602 Token as;
182603 pSubquery = sqlite3SelectNew(pParse,0,pFromClause,0,0,0,0,SF_NestedFrom,0);
182604 as.n = 0;
182605 as.z = 0;
182606 pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
182607 }
182608 yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause);
182609 }
182610 sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0);
182611 }
182612 break;
182613 case 160: /* setlist ::= setlist COMMA nm EQ expr */
182614 {
182615 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
182616 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1);
182617 }
182618 break;
182619 case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
182620 {
182621 yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
182622 }
182623 break;
182624 case 162: /* setlist ::= nm EQ expr */
182625 {
182626 yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454);
182627 sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1);
182628 }
182629 yymsp[-2].minor.yy14 = yylhsminor.yy14;
182630 break;
182631 case 163: /* setlist ::= LP idlist RP EQ expr */
182632 {
182633 yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
182634 }
182635 break;
182636 case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
182637 {
182638 sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122);
182639 }
182640 break;
182641 case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
182642 {
182643 sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0);
182644 }
182645 break;
182646 case 166: /* upsert ::= */
182647 { yymsp[1].minor.yy122 = 0; }
182648 break;
182649 case 167: /* upsert ::= RETURNING selcollist */
182650 { yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); }
182651 break;
182652 case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
182653 { yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);}
182654 break;
182655 case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
182656 { yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); }
182657 break;
182658 case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
182659 { yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
182660 break;
182661 case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
182662 { yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);}
182663 break;
182664 case 172: /* returning ::= RETURNING selcollist */
182665 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14);}
182666 break;
182667 case 175: /* idlist_opt ::= */
182668 {yymsp[1].minor.yy132 = 0;}
182669 break;
182670 case 176: /* idlist_opt ::= LP idlist RP */
182671 {yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;}
182672 break;
182673 case 177: /* idlist ::= idlist COMMA nm */
182674 {yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);}
182675 break;
182676 case 178: /* idlist ::= nm */
182677 {yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
182678 break;
182679 case 179: /* expr ::= LP expr RP */
182680 {yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;}
182681 break;
182682 case 180: /* expr ::= ID|INDEXED|JOIN_KW */
182683 {yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182684 break;
182685 case 181: /* expr ::= nm DOT nm */
182686 {
182687 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
182688 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
182689 yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
182690 }
182691 yymsp[-2].minor.yy454 = yylhsminor.yy454;
182692 break;
182693 case 182: /* expr ::= nm DOT nm DOT nm */
182694 {
182695 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
182696 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
@@ -182810,236 +182697,237 @@
182697 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
182698 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
182699 if( IN_RENAME_OBJECT ){
182700 sqlite3RenameTokenRemap(pParse, 0, temp1);
182701 }
182702 yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
182703 }
182704 yymsp[-4].minor.yy454 = yylhsminor.yy454;
182705 break;
182706 case 183: /* term ::= NULL|FLOAT|BLOB */
182707 case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
182708 {yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
182709 break;
182710 case 185: /* term ::= INTEGER */
182711 {
182712 int iValue;
182713 if( sqlite3GetInt32(yymsp[0].minor.yy0.z, &iValue)==0 ){
182714 yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 0);
182715 }else{
182716 yylhsminor.yy454 = sqlite3ExprInt32(pParse->db, iValue);
182717 }
182718 if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
182719 }
182720 yymsp[0].minor.yy454 = yylhsminor.yy454;
182721 break;
182722 case 186: /* expr ::= VARIABLE */
182723 {
182724 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
182725 u32 n = yymsp[0].minor.yy0.n;
182726 yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
182727 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n);
182728 }else{
182729 /* When doing a nested parse, one can include terms in an expression
182730 ** that look like this: #1 #2 ... These terms refer to registers
182731 ** in the virtual machine. #N is the N-th register. */
182732 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
182733 assert( t.n>=2 );
182734 if( pParse->nested==0 ){
182735 parserSyntaxError(pParse, &t);
182736 yymsp[0].minor.yy454 = 0;
182737 }else{
182738 yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
182739 if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable);
182740 }
182741 }
182742 }
182743 break;
182744 case 187: /* expr ::= expr COLLATE ID|STRING */
182745 {
182746 yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1);
182747 }
182748 break;
182749 case 188: /* expr ::= CAST LP expr AS typetoken RP */
182750 {
182751 yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
182752 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0);
182753 }
182754 break;
182755 case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
182756 {
182757 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144);
182758 }
182759 yymsp[-4].minor.yy454 = yylhsminor.yy454;
182760 break;
182761 case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
182762 {
182763 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144);
182764 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14);
182765 }
182766 yymsp[-7].minor.yy454 = yylhsminor.yy454;
182767 break;
182768 case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
182769 {
182770 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
182771 }
182772 yymsp[-3].minor.yy454 = yylhsminor.yy454;
182773 break;
182774 case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
182775 {
182776 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144);
182777 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
182778 }
182779 yymsp[-5].minor.yy454 = yylhsminor.yy454;
182780 break;
182781 case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
182782 {
182783 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144);
182784 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
182785 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14);
182786 }
182787 yymsp[-8].minor.yy454 = yylhsminor.yy454;
182788 break;
182789 case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
182790 {
182791 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
182792 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
182793 }
182794 yymsp[-4].minor.yy454 = yylhsminor.yy454;
182795 break;
182796 case 195: /* term ::= CTIME_KW */
182797 {
182798 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
182799 }
182800 yymsp[0].minor.yy454 = yylhsminor.yy454;
182801 break;
182802 case 196: /* expr ::= LP nexprlist COMMA expr RP */
182803 {
182804 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454);
182805 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
182806 if( yymsp[-4].minor.yy454 ){
182807 yymsp[-4].minor.yy454->x.pList = pList;
182808 if( ALWAYS(pList->nExpr) ){
182809 yymsp[-4].minor.yy454->flags |= pList->a[0].pExpr->flags & EP_Propagate;
182810 }
182811 }else{
182812 sqlite3ExprListDelete(pParse->db, pList);
182813 }
182814 }
182815 break;
182816 case 197: /* expr ::= expr AND expr */
182817 {yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
182818 break;
182819 case 198: /* expr ::= expr OR expr */
182820 case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
182821 case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200);
182822 case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201);
182823 case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
182824 case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
182825 case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
182826 {yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
182827 break;
182828 case 205: /* likeop ::= NOT LIKE_KW|MATCH */
182829 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
182830 break;
182831 case 206: /* expr ::= expr likeop expr */
182832 {
182833 ExprList *pList;
182834 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
182835 yymsp[-1].minor.yy0.n &= 0x7fffffff;
182836 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454);
182837 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454);
182838 yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
182839 if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0);
182840 if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc;
182841 }
182842 break;
182843 case 207: /* expr ::= expr likeop expr ESCAPE expr */
182844 {
182845 ExprList *pList;
182846 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
182847 yymsp[-3].minor.yy0.n &= 0x7fffffff;
182848 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
182849 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy454);
182850 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
182851 yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
182852 if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
182853 if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc;
182854 }
182855 break;
182856 case 208: /* expr ::= expr ISNULL|NOTNULL */
182857 {yymsp[-1].minor.yy454 = sqlite3PExprIsNull(pParse,yymsp[0].major,yymsp[-1].minor.yy454);}
182858 break;
182859 case 209: /* expr ::= expr NOT NULL */
182860 {yymsp[-2].minor.yy454 = sqlite3PExprIsNull(pParse,TK_NOTNULL,yymsp[-2].minor.yy454);}
182861 break;
182862 case 210: /* expr ::= expr IS expr */
182863 {
182864 yymsp[-2].minor.yy454 = sqlite3PExprIs(pParse, TK_IS, yymsp[-2].minor.yy454, yymsp[0].minor.yy454);
 
182865 }
182866 break;
182867 case 211: /* expr ::= expr IS NOT expr */
182868 {
182869 yymsp[-3].minor.yy454 = sqlite3PExprIs(pParse, TK_ISNOT, yymsp[-3].minor.yy454, yymsp[0].minor.yy454);
 
182870 }
182871 break;
182872 case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
182873 {
182874 yymsp[-5].minor.yy454 = sqlite3PExprIs(pParse, TK_IS, yymsp[-5].minor.yy454, yymsp[0].minor.yy454);
 
182875 }
182876 break;
182877 case 213: /* expr ::= expr IS DISTINCT FROM expr */
182878 {
182879 yymsp[-4].minor.yy454 = sqlite3PExprIs(pParse, TK_ISNOT, yymsp[-4].minor.yy454, yymsp[0].minor.yy454);
 
182880 }
182881 break;
182882 case 214: /* expr ::= NOT expr */
182883 case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
182884 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/}
182885 break;
182886 case 216: /* expr ::= PLUS|MINUS expr */
182887 {
182888 Expr *p = yymsp[0].minor.yy454;
182889 u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
182890 assert( TK_UPLUS>TK_PLUS );
182891 assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
182892 if( p && p->op==TK_UPLUS ){
182893 p->op = op;
182894 yymsp[-1].minor.yy454 = p;
182895 }else{
182896 yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0);
182897 /*A-overwrites-B*/
182898 }
182899 }
182900 break;
182901 case 217: /* expr ::= expr PTR expr */
182902 {
182903 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454);
182904 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454);
182905 yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
182906 }
182907 yymsp[-2].minor.yy454 = yylhsminor.yy454;
182908 break;
182909 case 218: /* between_op ::= BETWEEN */
182910 case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
182911 {yymsp[0].minor.yy144 = 0;}
182912 break;
182913 case 220: /* expr ::= expr between_op expr AND expr */
182914 {
182915 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
182916 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
182917 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
182918 if( yymsp[-4].minor.yy454 ){
182919 yymsp[-4].minor.yy454->x.pList = pList;
182920 }else{
182921 sqlite3ExprListDelete(pParse->db, pList);
182922 }
182923 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
182924 }
182925 break;
182926 case 223: /* expr ::= expr in_op LP exprlist RP */
182927 {
182928 if( yymsp[-1].minor.yy14==0 ){
182929 /* Expressions of the form
182930 **
182931 ** expr1 IN ()
182932 ** expr1 NOT IN ()
182933 **
@@ -183048,149 +182936,149 @@
182936 ** Except, do not apply this optimization if expr1 contains a function
182937 ** because that function might be an aggregate (we don't know yet whether
182938 ** it is or not) and if it is an aggregate, that could change the meaning
182939 ** of the whole query.
182940 */
182941 Expr *pB = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy144 ? "true" : "false");
182942 if( pB ) sqlite3ExprIdToTrueFalse(pB);
182943 if( !ExprHasProperty(yymsp[-4].minor.yy454, EP_HasFunc) ){
182944 sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy454);
182945 yymsp[-4].minor.yy454 = pB;
182946 }else{
182947 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, yymsp[-3].minor.yy144 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy454);
182948 }
182949 }else{
182950 Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr;
182951 if( yymsp[-1].minor.yy14->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy454->op!=TK_VECTOR ){
182952 yymsp[-1].minor.yy14->a[0].pExpr = 0;
182953 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
182954 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
182955 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS);
182956 }else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){
182957 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
182958 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pRHS->x.pSelect);
182959 pRHS->x.pSelect = 0;
182960 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
182961 }else{
182962 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
182963 if( yymsp[-4].minor.yy454==0 ){
182964 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
182965 }else if( yymsp[-4].minor.yy454->pLeft->op==TK_VECTOR ){
182966 int nExpr = yymsp[-4].minor.yy454->pLeft->x.pList->nExpr;
182967 Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy14);
182968 if( pSelectRHS ){
182969 parserDoubleLinkSelect(pParse, pSelectRHS);
182970 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelectRHS);
182971 }
182972 }else{
182973 yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy14;
182974 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
182975 }
182976 }
182977 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
182978 }
182979 }
182980 break;
182981 case 224: /* expr ::= LP select RP */
182982 {
182983 yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
182984 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555);
182985 }
182986 break;
182987 case 225: /* expr ::= expr in_op LP select RP */
182988 {
182989 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
182990 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555);
182991 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
182992 }
182993 break;
182994 case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
182995 {
182996 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
182997 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
182998 if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14);
182999 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
183000 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect);
183001 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
183002 }
183003 break;
183004 case 227: /* expr ::= EXISTS LP select RP */
183005 {
183006 Expr *p;
183007 p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
183008 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555);
183009 }
183010 break;
183011 case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
183012 {
183013 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0);
183014 if( yymsp[-4].minor.yy454 ){
183015 yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14;
183016 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
183017 }else{
183018 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14);
183019 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
183020 }
183021 }
183022 break;
183023 case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
183024 {
183025 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
183026 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
183027 }
183028 break;
183029 case 230: /* case_exprlist ::= WHEN expr THEN expr */
183030 {
183031 yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
183032 yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454);
183033 }
183034 break;
183035 case 235: /* nexprlist ::= nexprlist COMMA expr */
183036 {yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);}
183037 break;
183038 case 236: /* nexprlist ::= expr */
183039 {yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/}
183040 break;
183041 case 238: /* paren_exprlist ::= LP exprlist RP */
183042 case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
183043 {yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;}
183044 break;
183045 case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
183046 {
183047 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
183048 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144,
183049 &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF);
183050 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
183051 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
183052 }
183053 }
183054 break;
183055 case 240: /* uniqueflag ::= UNIQUE */
183056 case 281: /* raisetype ::= ABORT */ yytestcase(yyruleno==281);
183057 {yymsp[0].minor.yy144 = OE_Abort;}
183058 break;
183059 case 241: /* uniqueflag ::= */
183060 {yymsp[1].minor.yy144 = OE_None;}
183061 break;
183062 case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
183063 {
183064 yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144);
183065 }
183066 break;
183067 case 245: /* eidlist ::= nm collate sortorder */
183068 {
183069 yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/
183070 }
183071 break;
183072 case 248: /* cmd ::= DROP INDEX ifexists fullname */
183073 {sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);}
183074 break;
183075 case 249: /* cmd ::= VACUUM vinto */
183076 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);}
183077 break;
183078 case 250: /* cmd ::= VACUUM nm vinto */
183079 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);}
183080 break;
183081 case 253: /* cmd ::= PRAGMA nm dbnm */
183082 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
183083 break;
183084 case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
@@ -183208,468 +183096,457 @@
183096 case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
183097 {
183098 Token all;
183099 all.z = yymsp[-3].minor.yy0.z;
183100 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
183101 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all);
183102 }
183103 break;
183104 case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
183105 {
183106 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144);
183107 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
183108 #ifdef SQLITE_DEBUG
183109 assert( pParse->isCreate ); /* Set by createkw reduce action */
183110 pParse->isCreate = 0; /* But, should not be set for CREATE TRIGGER */
183111 #endif
183112 }
183113 break;
183114 case 262: /* trigger_time ::= BEFORE|AFTER */
183115 { yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ }
183116 break;
183117 case 263: /* trigger_time ::= INSTEAD OF */
183118 { yymsp[-1].minor.yy144 = TK_INSTEAD;}
183119 break;
183120 case 264: /* trigger_time ::= */
183121 { yymsp[1].minor.yy144 = TK_BEFORE; }
183122 break;
183123 case 265: /* trigger_event ::= DELETE|INSERT */
183124 case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
183125 {yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;}
183126 break;
183127 case 267: /* trigger_event ::= UPDATE OF idlist */
183128 {yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;}
183129 break;
183130 case 268: /* when_clause ::= */
183131 case 286: /* key_opt ::= */ yytestcase(yyruleno==286);
183132 { yymsp[1].minor.yy454 = 0; }
183133 break;
183134 case 269: /* when_clause ::= WHEN expr */
183135 case 287: /* key_opt ::= KEY expr */ yytestcase(yyruleno==287);
183136 { yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; }
183137 break;
183138 case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
183139 {
183140 yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427;
183141 yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427;
 
183142 }
183143 break;
183144 case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
183145 {
183146 yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427;
 
183147 }
183148 break;
183149 case 272: /* tridxby ::= INDEXED BY nm */
 
 
 
 
 
 
 
 
183150 {
183151 sqlite3ErrorMsg(pParse,
183152 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
183153 "within triggers");
183154 }
183155 break;
183156 case 273: /* tridxby ::= NOT INDEXED */
183157 {
183158 sqlite3ErrorMsg(pParse,
183159 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
183160 "within triggers");
183161 }
183162 break;
183163 case 274: /* trigger_cmd ::= UPDATE orconf xfullname tridxby SET setlist from where_opt scanpt */
183164 {yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, yymsp[-6].minor.yy203, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);}
183165 yymsp[-8].minor.yy427 = yylhsminor.yy427;
183166 break;
183167 case 275: /* trigger_cmd ::= scanpt insert_cmd INTO xfullname idlist_opt select upsert scanpt */
183168 {
183169 yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,yymsp[-4].minor.yy203,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/
183170 }
183171 yymsp[-7].minor.yy427 = yylhsminor.yy427;
183172 break;
183173 case 276: /* trigger_cmd ::= DELETE FROM xfullname tridxby where_opt scanpt */
183174 {yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);}
183175 yymsp[-5].minor.yy427 = yylhsminor.yy427;
183176 break;
183177 case 277: /* trigger_cmd ::= scanpt select scanpt */
183178 {yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/}
183179 yymsp[-2].minor.yy427 = yylhsminor.yy427;
183180 break;
183181 case 278: /* expr ::= RAISE LP IGNORE RP */
183182 {
183183 yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
183184 if( yymsp[-3].minor.yy454 ){
183185 yymsp[-3].minor.yy454->affExpr = OE_Ignore;
183186 }
183187 }
183188 break;
183189 case 279: /* expr ::= RAISE LP raisetype COMMA expr RP */
183190 {
183191 yymsp[-5].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy454, 0);
183192 if( yymsp[-5].minor.yy454 ) {
183193 yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144;
183194 }
183195 }
183196 break;
183197 case 280: /* raisetype ::= ROLLBACK */
183198 {yymsp[0].minor.yy144 = OE_Rollback;}
183199 break;
183200 case 282: /* raisetype ::= FAIL */
183201 {yymsp[0].minor.yy144 = OE_Fail;}
183202 break;
183203 case 283: /* cmd ::= DROP TRIGGER ifexists fullname */
183204 {
183205 sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144);
183206 }
183207 break;
183208 case 284: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
183209 {
183210 sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454);
183211 }
183212 break;
183213 case 285: /* cmd ::= DETACH database_kw_opt expr */
183214 {
183215 sqlite3Detach(pParse, yymsp[0].minor.yy454);
183216 }
183217 break;
183218 case 288: /* cmd ::= REINDEX */
183219 {sqlite3Reindex(pParse, 0, 0);}
183220 break;
183221 case 289: /* cmd ::= REINDEX nm dbnm */
183222 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
183223 break;
183224 case 290: /* cmd ::= ANALYZE */
183225 {sqlite3Analyze(pParse, 0, 0);}
183226 break;
183227 case 291: /* cmd ::= ANALYZE nm dbnm */
183228 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
183229 break;
183230 case 292: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
183231 {
183232 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0);
183233 }
183234 break;
183235 case 293: /* cmd ::= alter_add carglist */
183236 {
183237 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
183238 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
183239 }
183240 break;
183241 case 294: /* alter_add ::= ALTER TABLE fullname ADD kwcolumn_opt nm typetoken */
183242 {
183243 disableLookaside(pParse);
183244 sqlite3AlterBeginAddColumn(pParse, yymsp[-4].minor.yy203);
183245 sqlite3AddColumn(pParse, yymsp[-1].minor.yy0, yymsp[0].minor.yy0);
183246 yymsp[-6].minor.yy0 = yymsp[-1].minor.yy0;
183247 }
183248 break;
183249 case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
183250 {
183251 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0);
183252 }
183253 break;
183254 case 296: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
183255 {
183256 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
183257 }
183258 break;
183259 case 297: /* cmd ::= ALTER TABLE fullname DROP CONSTRAINT nm */
183260 {
183261 sqlite3AlterDropConstraint(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0, 0);
183262 }
183263 break;
183264 case 298: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm DROP NOT NULL */
183265 {
183266 sqlite3AlterDropConstraint(pParse, yymsp[-6].minor.yy203, 0, &yymsp[-3].minor.yy0);
183267 }
183268 break;
183269 case 299: /* cmd ::= ALTER TABLE fullname ALTER kwcolumn_opt nm SET NOT NULL onconf */
183270 {
183271 sqlite3AlterSetNotNull(pParse, yymsp[-7].minor.yy203, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0);
183272 }
183273 break;
183274 case 300: /* cmd ::= ALTER TABLE fullname ADD CONSTRAINT nm CHECK LP expr RP onconf */
183275 {
183276 sqlite3AlterAddConstraint(pParse, yymsp[-8].minor.yy203, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183277 }
183278 yy_destructor(yypParser,219,&yymsp[-2].minor);
183279 break;
183280 case 301: /* cmd ::= ALTER TABLE fullname ADD CHECK LP expr RP onconf */
183281 {
183282 sqlite3AlterAddConstraint(pParse, yymsp[-6].minor.yy203, &yymsp[-4].minor.yy0, 0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1));
183283 }
183284 yy_destructor(yypParser,219,&yymsp[-2].minor);
183285 break;
183286 case 302: /* cmd ::= create_vtab */
183287 {sqlite3VtabFinishParse(pParse,0);}
183288 break;
183289 case 303: /* cmd ::= create_vtab LP vtabarglist RP */
183290 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
183291 break;
183292 case 304: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
183293 {
183294 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144);
183295 }
183296 break;
183297 case 305: /* vtabarg ::= */
183298 {sqlite3VtabArgInit(pParse);}
183299 break;
183300 case 306: /* vtabargtoken ::= ANY */
183301 case 307: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==307);
183302 case 308: /* lp ::= LP */ yytestcase(yyruleno==308);
183303 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
183304 break;
183305 case 309: /* with ::= WITH wqlist */
183306 case 310: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==310);
183307 { sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); }
183308 break;
183309 case 311: /* wqas ::= AS */
183310 {yymsp[0].minor.yy462 = M10d_Any;}
183311 break;
183312 case 312: /* wqas ::= AS MATERIALIZED */
183313 {yymsp[-1].minor.yy462 = M10d_Yes;}
183314 break;
183315 case 313: /* wqas ::= AS NOT MATERIALIZED */
183316 {yymsp[-2].minor.yy462 = M10d_No;}
183317 break;
183318 case 314: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
183319 {
183320 yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/
183321 }
183322 break;
183323 case 315: /* withnm ::= nm */
183324 {pParse->bHasWith = 1;}
183325 break;
183326 case 316: /* wqlist ::= wqitem */
183327 {
183328 yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/
183329 }
183330 break;
183331 case 317: /* wqlist ::= wqlist COMMA wqitem */
183332 {
183333 yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67);
183334 }
183335 break;
183336 case 318: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
183337 {
183338 assert( yymsp[0].minor.yy211!=0 );
183339 sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211);
183340 yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211;
183341 yylhsminor.yy211 = yymsp[0].minor.yy211;
183342 }
183343 yymsp[-2].minor.yy211 = yylhsminor.yy211;
183344 break;
183345 case 319: /* windowdefn ::= nm AS LP window RP */
183346 {
183347 if( ALWAYS(yymsp[-1].minor.yy211) ){
183348 yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
183349 }
183350 yylhsminor.yy211 = yymsp[-1].minor.yy211;
183351 }
183352 yymsp[-4].minor.yy211 = yylhsminor.yy211;
183353 break;
183354 case 320: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
183355 {
183356 yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0);
183357 }
183358 break;
183359 case 321: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
183360 {
183361 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0);
183362 }
183363 yymsp[-5].minor.yy211 = yylhsminor.yy211;
183364 break;
183365 case 322: /* window ::= ORDER BY sortlist frame_opt */
183366 {
183367 yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0);
183368 }
183369 break;
183370 case 323: /* window ::= nm ORDER BY sortlist frame_opt */
183371 {
183372 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0);
183373 }
183374 yymsp[-4].minor.yy211 = yylhsminor.yy211;
183375 break;
183376 case 324: /* window ::= nm frame_opt */
183377 {
183378 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0);
183379 }
183380 yymsp[-1].minor.yy211 = yylhsminor.yy211;
183381 break;
183382 case 325: /* frame_opt ::= */
183383 {
183384 yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
183385 }
183386 break;
183387 case 326: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
183388 {
183389 yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462);
183390 }
183391 yymsp[-2].minor.yy211 = yylhsminor.yy211;
183392 break;
183393 case 327: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
183394 {
183395 yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462);
183396 }
183397 yymsp[-5].minor.yy211 = yylhsminor.yy211;
183398 break;
183399 case 329: /* frame_bound_s ::= frame_bound */
183400 case 331: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==331);
183401 {yylhsminor.yy509 = yymsp[0].minor.yy509;}
183402 yymsp[0].minor.yy509 = yylhsminor.yy509;
183403 break;
183404 case 330: /* frame_bound_s ::= UNBOUNDED PRECEDING */
183405 case 332: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==332);
183406 case 334: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==334);
183407 {yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;}
183408 yymsp[-1].minor.yy509 = yylhsminor.yy509;
183409 break;
183410 case 333: /* frame_bound ::= expr PRECEDING|FOLLOWING */
183411 {yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;}
183412 yymsp[-1].minor.yy509 = yylhsminor.yy509;
183413 break;
183414 case 335: /* frame_exclude_opt ::= */
183415 {yymsp[1].minor.yy462 = 0;}
183416 break;
183417 case 336: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
183418 {yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;}
183419 break;
183420 case 337: /* frame_exclude ::= NO OTHERS */
183421 case 338: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==338);
183422 {yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/}
183423 break;
183424 case 339: /* frame_exclude ::= GROUP|TIES */
183425 {yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/}
183426 break;
183427 case 340: /* window_clause ::= WINDOW windowdefn_list */
183428 { yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; }
183429 break;
183430 case 341: /* filter_over ::= filter_clause over_clause */
183431 {
183432 if( yymsp[0].minor.yy211 ){
183433 yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454;
183434 }else{
183435 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
183436 }
183437 yylhsminor.yy211 = yymsp[0].minor.yy211;
183438 }
183439 yymsp[-1].minor.yy211 = yylhsminor.yy211;
183440 break;
183441 case 342: /* filter_over ::= over_clause */
183442 {
183443 yylhsminor.yy211 = yymsp[0].minor.yy211;
183444 }
183445 yymsp[0].minor.yy211 = yylhsminor.yy211;
183446 break;
183447 case 343: /* filter_over ::= filter_clause */
183448 {
183449 yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183450 if( yylhsminor.yy211 ){
183451 yylhsminor.yy211->eFrmType = TK_FILTER;
183452 yylhsminor.yy211->pFilter = yymsp[0].minor.yy454;
183453 }else{
183454 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454);
183455 }
183456 }
183457 yymsp[0].minor.yy211 = yylhsminor.yy211;
183458 break;
183459 case 344: /* over_clause ::= OVER LP window RP */
183460 {
183461 yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211;
183462 assert( yymsp[-3].minor.yy211!=0 );
183463 }
183464 break;
183465 case 345: /* over_clause ::= OVER nm */
183466 {
183467 yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
183468 if( yymsp[-1].minor.yy211 ){
183469 yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
183470 }
183471 }
183472 break;
183473 case 346: /* filter_clause ::= FILTER LP WHERE expr RP */
183474 { yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; }
183475 break;
183476 case 347: /* term ::= QNUMBER */
183477 {
183478 yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
183479 sqlite3DequoteNumber(pParse, yylhsminor.yy454);
183480 }
183481 yymsp[0].minor.yy454 = yylhsminor.yy454;
183482 break;
183483 default:
183484 /* (348) input ::= cmdlist */ yytestcase(yyruleno==348);
183485 /* (349) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==349);
183486 /* (350) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=350);
183487 /* (351) ecmd ::= SEMI */ yytestcase(yyruleno==351);
183488 /* (352) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==352);
183489 /* (353) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=353);
183490 /* (354) trans_opt ::= */ yytestcase(yyruleno==354);
183491 /* (355) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==355);
183492 /* (356) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==356);
183493 /* (357) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==357);
183494 /* (358) savepoint_opt ::= */ yytestcase(yyruleno==358);
183495 /* (359) cmd ::= create_table create_table_args */ yytestcase(yyruleno==359);
183496 /* (360) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=360);
183497 /* (361) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==361);
183498 /* (362) columnlist ::= columnname carglist */ yytestcase(yyruleno==362);
183499 /* (363) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==363);
183500 /* (364) nm ::= STRING */ yytestcase(yyruleno==364);
183501 /* (365) typetoken ::= typename */ yytestcase(yyruleno==365);
183502 /* (366) typename ::= ID|STRING */ yytestcase(yyruleno==366);
183503 /* (367) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=367);
183504 /* (368) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=368);
183505 /* (369) carglist ::= carglist ccons */ yytestcase(yyruleno==369);
183506 /* (370) carglist ::= */ yytestcase(yyruleno==370);
183507 /* (371) ccons ::= NULL onconf */ yytestcase(yyruleno==371);
183508 /* (372) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==372);
183509 /* (373) ccons ::= AS generated */ yytestcase(yyruleno==373);
183510 /* (374) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==374);
183511 /* (375) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==375);
183512 /* (376) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=376);
183513 /* (377) tconscomma ::= */ yytestcase(yyruleno==377);
183514 /* (378) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=378);
183515 /* (379) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=379);
183516 /* (380) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=380);
183517 /* (381) oneselect ::= values */ yytestcase(yyruleno==381);
183518 /* (382) sclp ::= selcollist COMMA */ yytestcase(yyruleno==382);
183519 /* (383) as ::= ID|STRING */ yytestcase(yyruleno==383);
183520 /* (384) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=384);
183521 /* (385) returning ::= */ yytestcase(yyruleno==385);
183522 /* (386) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=386);
183523 /* (387) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==387);
183524 /* (388) case_operand ::= expr */ yytestcase(yyruleno==388);
183525 /* (389) exprlist ::= nexprlist */ yytestcase(yyruleno==389);
183526 /* (390) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=390);
183527 /* (391) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=391);
183528 /* (392) nmnum ::= ON */ yytestcase(yyruleno==392);
183529 /* (393) nmnum ::= DELETE */ yytestcase(yyruleno==393);
183530 /* (394) nmnum ::= DEFAULT */ yytestcase(yyruleno==394);
183531 /* (395) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==395);
183532 /* (396) foreach_clause ::= */ yytestcase(yyruleno==396);
183533 /* (397) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==397);
183534 /* (398) tridxby ::= */ yytestcase(yyruleno==398);
183535 /* (399) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==399);
183536 /* (400) database_kw_opt ::= */ yytestcase(yyruleno==400);
183537 /* (401) kwcolumn_opt ::= */ yytestcase(yyruleno==401);
183538 /* (402) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==402);
183539 /* (403) vtabarglist ::= vtabarg */ yytestcase(yyruleno==403);
183540 /* (404) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==404);
183541 /* (405) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==405);
183542 /* (406) anylist ::= */ yytestcase(yyruleno==406);
183543 /* (407) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==407);
183544 /* (408) anylist ::= anylist ANY */ yytestcase(yyruleno==408);
183545 /* (409) with ::= */ yytestcase(yyruleno==409);
183546 /* (410) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=410);
183547 /* (411) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=411);
 
183548 break;
183549 /********** End reduce actions ************************************************/
183550 };
183551 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
183552 yygoto = yyRuleInfoLhs[yyruleno];
@@ -184444,12 +184321,12 @@
184321 ** 126: UPDATE UNIQUE
184322 */
184323 /* Check to see if z[0..n-1] is a keyword. If it is, write the
184324 ** parser symbol code for that keyword into *pType. Always
184325 ** return the integer n (the length of the token). */
184326 static i64 keywordCode(const char *z, i64 n, int *pType){
184327 i64 i, j;
184328 const char *zKW;
184329 assert( n>=2 );
184330 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
184331 for(i=(int)aKWHash[i]; i>0; i=aKWNext[i]){
184332 if( aKWLen[i]!=n ) continue;
@@ -184999,11 +184876,11 @@
184876 for(i=1; sqlite3Isdigit(z[i]); i++){}
184877 return i;
184878 }
184879 case CC_DOLLAR:
184880 case CC_VARALPHA: {
184881 i64 n = 0;
184882 testcase( z[0]=='$' ); testcase( z[0]=='@' );
184883 testcase( z[0]==':' ); testcase( z[0]=='#' );
184884 *tokenType = TK_VARIABLE;
184885 for(i=1; (c=z[i])!=0; i++){
184886 if( IdChar(c) ){
@@ -185095,11 +184972,11 @@
184972 void *pEngine; /* The LEMON-generated LALR(1) parser */
184973 i64 n = 0; /* Length of the next token token */
184974 int tokenType; /* type of the next token */
184975 int lastTokenParsed = -1; /* type of the previous token */
184976 sqlite3 *db = pParse->db; /* The database connection */
184977 i64 mxSqlLen; /* Max length of an SQL string */
184978 Parse *pParentParse = 0; /* Outer parse context, if any */
184979 #ifdef sqlite3Parser_ENGINEALWAYSONSTACK
184980 yyParser sEngine; /* Space to hold the Lemon-generated Parser object */
184981 #endif
184982 VVA_ONLY( u8 startedWithOom = db->mallocFailed );
@@ -188342,15 +188219,16 @@
188219
188220 /* Initialize the output variables to -1 in case an error occurs. */
188221 if( pnLog ) *pnLog = -1;
188222 if( pnCkpt ) *pnCkpt = -1;
188223
188224 assert( SQLITE_CHECKPOINT_NOOP==-1 );
188225 assert( SQLITE_CHECKPOINT_PASSIVE==0 );
188226 assert( SQLITE_CHECKPOINT_FULL==1 );
188227 assert( SQLITE_CHECKPOINT_RESTART==2 );
188228 assert( SQLITE_CHECKPOINT_TRUNCATE==3 );
188229 if( eMode<SQLITE_CHECKPOINT_NOOP || eMode>SQLITE_CHECKPOINT_TRUNCATE ){
188230 /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint
188231 ** mode: */
188232 return SQLITE_MISUSE_BKPT;
188233 }
188234
@@ -188724,10 +188602,13 @@
188602 #if SQLITE_MAX_SQL_LENGTH<100
188603 # error SQLITE_MAX_SQL_LENGTH must be at least 100
188604 #endif
188605 #if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH
188606 # error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH
188607 #endif
188608 #if SQLITE_MAX_SQL_LENGTH>2147482624 /* 1024 less than 2^31 */
188609 # error SQLITE_MAX_SQL_LENGTH must not be greater than 2147482624
188610 #endif
188611 #if SQLITE_MAX_COMPOUND_SELECT<2
188612 # error SQLITE_MAX_COMPOUND_SELECT must be at least 2
188613 #endif
188614 #if SQLITE_MAX_VDBE_OP<40
@@ -192464,10 +192345,19 @@
192345 SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table*,int,int);
192346
192347 #define fts3GetVarint32(p, piVal) ( \
192348 (*(u8*)(p)&0x80) ? sqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \
192349 )
192350
192351 SQLITE_PRIVATE int sqlite3Fts3PrepareStmt(
192352 Fts3Table *p, /* Prepare for this connection */
192353 const char *zSql, /* SQL to prepare */
192354 int bPersist, /* True to set SQLITE_PREPARE_PERSISTENT */
192355 int bAllowVtab, /* True to omit SQLITE_PREPARE_NO_VTAB */
192356 sqlite3_stmt **pp /* OUT: Prepared statement */
192357 );
192358
192359
192360 /* fts3.c */
192361 SQLITE_PRIVATE void sqlite3Fts3ErrMsg(char**,const char*,...);
192362 SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64);
192363 SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *);
@@ -194072,13 +193962,11 @@
193962 p->pSeekStmt = 0;
193963 }else{
193964 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
193965 if( !zSql ) return SQLITE_NOMEM;
193966 p->bLock++;
193967 rc = sqlite3Fts3PrepareStmt(p, zSql, 1, 1, &pCsr->pStmt);
 
 
193968 p->bLock--;
193969 sqlite3_free(zSql);
193970 }
193971 if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
193972 }
@@ -195649,13 +195537,11 @@
195537 p->zReadExprlist, (pCsr->bDesc ? "DESC" : "ASC")
195538 );
195539 }
195540 if( zSql ){
195541 p->bLock++;
195542 rc = sqlite3Fts3PrepareStmt(p, zSql, 1, 1, &pCsr->pStmt);
 
 
195543 p->bLock--;
195544 sqlite3_free(zSql);
195545 }else{
195546 rc = SQLITE_NOMEM;
195547 }
@@ -196274,10 +196160,11 @@
196160 int rc = SQLITE_OK;
196161 int bOk = 0;
196162
196163 UNUSED_PARAMETER(isQuick);
196164 rc = sqlite3Fts3IntegrityCheck(p, &bOk);
196165 assert( pVtab->zErrMsg==0 || rc!=SQLITE_OK );
196166 assert( rc!=SQLITE_CORRUPT_VTAB );
196167 if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){
196168 *pzErr = sqlite3_mprintf("unable to validate the inverted index for"
196169 " FTS%d table %s.%s: %s",
196170 p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc));
@@ -202885,10 +202772,28 @@
202772 #define SQL_SELECT_MXLEVEL 36
202773
202774 #define SQL_SELECT_LEVEL_RANGE2 37
202775 #define SQL_UPDATE_LEVEL_IDX 38
202776 #define SQL_UPDATE_LEVEL 39
202777
202778 /*
202779 ** Wrapper around sqlite3_prepare_v3() to ensure that SQLITE_PREPARE_FROM_DDL
202780 ** is always set.
202781 */
202782 SQLITE_PRIVATE int sqlite3Fts3PrepareStmt(
202783 Fts3Table *p, /* Prepare for this connection */
202784 const char *zSql, /* SQL to prepare */
202785 int bPersist, /* True to set SQLITE_PREPARE_PERSISTENT */
202786 int bAllowVtab, /* True to omit SQLITE_PREPARE_NO_VTAB */
202787 sqlite3_stmt **pp /* OUT: Prepared statement */
202788 ){
202789 int f = SQLITE_PREPARE_FROM_DDL
202790 |((bAllowVtab==0) ? SQLITE_PREPARE_NO_VTAB : 0)
202791 |(bPersist ? SQLITE_PREPARE_PERSISTENT : 0);
202792
202793 return sqlite3_prepare_v3(p->db, zSql, -1, f, pp, NULL);
202794 }
202795
202796 /*
202797 ** This function is used to obtain an SQLite prepared statement handle
202798 ** for the statement identified by the second argument. If successful,
202799 ** *pp is set to the requested statement handle and SQLITE_OK returned.
@@ -203011,24 +202916,24 @@
202916 assert( SizeofArray(azSql)==SizeofArray(p->aStmt) );
202917 assert( eStmt<SizeofArray(azSql) && eStmt>=0 );
202918
202919 pStmt = p->aStmt[eStmt];
202920 if( !pStmt ){
202921 int bAllowVtab = 0;
202922 char *zSql;
202923 if( eStmt==SQL_CONTENT_INSERT ){
202924 zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist);
202925 }else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){
202926 bAllowVtab = 1;
202927 zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist);
202928 }else{
202929 zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName);
202930 }
202931 if( !zSql ){
202932 rc = SQLITE_NOMEM;
202933 }else{
202934 rc = sqlite3Fts3PrepareStmt(p, zSql, 1, bAllowVtab, &pStmt);
202935 sqlite3_free(zSql);
202936 assert( rc==SQLITE_OK || pStmt==0 );
202937 p->aStmt[eStmt] = pStmt;
202938 }
202939 }
@@ -203373,11 +203278,13 @@
203278 PendingList *pList;
203279 int rc = SQLITE_OK;
203280
203281 pList = (PendingList *)fts3HashFind(pHash, zToken, nToken);
203282 if( pList ){
203283 assert( (i64)pList->nData+(i64)nToken+(i64)sizeof(Fts3HashElem)
203284 <= (i64)p->nPendingData );
203285 p->nPendingData -= (int)(pList->nData + nToken + sizeof(Fts3HashElem));
203286 }
203287 if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){
203288 if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){
203289 /* Malloc failed while inserting the new entry. This can only
203290 ** happen if there was no previous entry for this token.
@@ -203386,11 +203293,13 @@
203293 sqlite3_free(pList);
203294 rc = SQLITE_NOMEM;
203295 }
203296 }
203297 if( rc==SQLITE_OK ){
203298 assert( (i64)p->nPendingData + pList->nData + nToken
203299 + sizeof(Fts3HashElem) <= 0x3fffffff );
203300 p->nPendingData += (int)(pList->nData + nToken + sizeof(Fts3HashElem));
203301 }
203302 return rc;
203303 }
203304
203305 /*
@@ -206187,11 +206096,11 @@
206096 /* Compose and prepare an SQL statement to loop through the content table */
206097 char *zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist);
206098 if( !zSql ){
206099 rc = SQLITE_NOMEM;
206100 }else{
206101 rc = sqlite3Fts3PrepareStmt(p, zSql, 0, 1, &pStmt);
206102 sqlite3_free(zSql);
206103 }
206104
206105 if( rc==SQLITE_OK ){
206106 sqlite3_int64 nByte = sizeof(u32) * ((sqlite3_int64)p->nColumn+1)*3;
@@ -207940,11 +207849,11 @@
207849
207850 zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist);
207851 if( !zSql ){
207852 rc = SQLITE_NOMEM;
207853 }else{
207854 rc = sqlite3Fts3PrepareStmt(p, zSql, 0, 1, &pStmt);
207855 sqlite3_free(zSql);
207856 }
207857
207858 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
207859 i64 iDocid = sqlite3_column_int64(pStmt, 0);
@@ -220394,11 +220303,11 @@
220303 tree.nBytesPerCell = 8 + 8 * tree.nDim;
220304 node.zData = (u8 *)sqlite3_value_blob(apArg[1]);
220305 if( node.zData==0 ) return;
220306 nData = sqlite3_value_bytes(apArg[1]);
220307 if( nData<4 ) return;
220308 if( nData<4+NCELL(&node)*tree.nBytesPerCell ) return;
220309
220310 pOut = sqlite3_str_new(0);
220311 for(ii=0; ii<NCELL(&node); ii++){
220312 RtreeCell cell;
220313 int jj;
@@ -225066,11 +224975,11 @@
224975 total += cnt;
224976 if( total>limit ){
224977 /* ERROR: copy exceeds output file size */
224978 return -1;
224979 }
224980 if( (u64)ofst+(u64)cnt > (u64)lenSrc ){
224981 /* ERROR: copy extends past end of input */
224982 return -1;
224983 }
224984 memcpy(zOut, &zSrc[ofst], cnt);
224985 zOut += cnt;
@@ -239475,11 +239384,17 @@
239384 # define FLEXARRAY
239385 #else
239386 # define FLEXARRAY 1
239387 #endif
239388
239389 #endif /* SQLITE_AMALGAMATION */
239390
239391 /*
239392 ** Constants for the largest and smallest possible 32-bit signed integers.
239393 */
239394 # define LARGEST_INT32 ((int)(0x7fffffff))
239395 # define SMALLEST_INT32 ((int)((-1) - LARGEST_INT32))
239396
239397 /* Truncate very long tokens to this many bytes. Hard limit is
239398 ** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset
239399 ** field that occurs at the start of each leaf page (see fts5_index.c). */
239400 #define FTS5_MAX_TOKEN_SIZE 32768
@@ -250200,10 +250115,11 @@
250115
250116 ASSERT_SZLEAF_OK(pIter->pLeaf);
250117 while( 1 ){
250118 u64 iDelta = 0;
250119
250120 if( i>=n ) break;
250121 if( eDetail==FTS5_DETAIL_NONE ){
250122 /* todo */
250123 if( i<n && a[i]==0 ){
250124 i++;
250125 if( i<n && a[i]==0 ) i++;
@@ -254056,11 +253972,11 @@
253972 if( nMerge<0 ){
253973 Fts5Structure *pNew = fts5IndexOptimizeStruct(p, pStruct);
253974 fts5StructureRelease(pStruct);
253975 pStruct = pNew;
253976 nMin = 1;
253977 nMerge = (nMerge==SMALLEST_INT32 ? LARGEST_INT32 : (nMerge*-1));
253978 }
253979 if( pStruct && pStruct->nLevel ){
253980 if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){
253981 fts5StructureWrite(p, pStruct);
253982 }
@@ -259746,10 +259662,11 @@
259662 }
259663 }
259664 }
259665
259666 update_out:
259667 sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
259668 pTab->p.pConfig->pzErrmsg = 0;
259669 return rc;
259670 }
259671
259672 /*
@@ -261263,11 +261180,11 @@
261180 int nArg, /* Number of args */
261181 sqlite3_value **apUnused /* Function arguments */
261182 ){
261183 assert( nArg==0 );
261184 UNUSED_PARAM2(nArg, apUnused);
261185 sqlite3_result_text(pCtx, "fts5: 2026-01-09 00:41:35 9adab8b2bef4130abd358d53384cb5f4dd691b808336bb7102793b0165b1c516", -1, SQLITE_TRANSIENT);
261186 }
261187
261188 /*
261189 ** Implementation of fts5_locale(LOCALE, TEXT) function.
261190 **
@@ -266084,20 +266001,31 @@
266001
266002 *ppCsr = (sqlite3_vtab_cursor*)pCsr;
266003 return rc;
266004 }
266005
266006 /*
266007 ** Restore cursor pCsr to the state it was in immediately after being
266008 ** created by the xOpen() method.
266009 */
266010 static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
266011 int nCol = pCsr->pFts5->pConfig->nCol;
266012 pCsr->rowid = 0;
266013 sqlite3Fts5IterClose(pCsr->pIter);
266014 sqlite3Fts5StructureRelease(pCsr->pStruct);
266015 pCsr->pStruct = 0;
266016 pCsr->pIter = 0;
266017 sqlite3_free(pCsr->zLeTerm);
266018 pCsr->nLeTerm = -1;
266019 pCsr->zLeTerm = 0;
266020 pCsr->bEof = 0;
266021 pCsr->iCol = 0;
266022 pCsr->iInstPos = 0;
266023 pCsr->iInstOff = 0;
266024 pCsr->colUsed = 0;
266025 memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
266026 memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
266027 }
266028
266029 /*
266030 ** Close the cursor. For additional information see the documentation
266031 ** on the xClose method of the virtual table interface.
266032
+37 -15
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.52.0"
150150
#define SQLITE_VERSION_NUMBER 3052000
151
-#define SQLITE_SOURCE_ID "2025-11-25 18:20:33 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911"
151
+#define SQLITE_SOURCE_ID "2026-01-09 00:41:35 9adab8b2bef4130abd358d53384cb5f4dd691b808336bb7102793b0165b1c516"
152152
#define SQLITE_SCM_BRANCH "trunk"
153153
#define SQLITE_SCM_TAGS ""
154
-#define SQLITE_SCM_DATETIME "2025-11-25T18:20:33.534Z"
154
+#define SQLITE_SCM_DATETIME "2026-01-09T00:41:35.433Z"
155155
156156
/*
157157
** CAPI3REF: Run-Time Library Version Numbers
158158
** KEYWORDS: sqlite3_version sqlite3_sourceid
159159
**
@@ -1488,11 +1488,11 @@
14881488
** ^SQLite will use the xCurrentTimeInt64() method to get the current
14891489
** date and time if that method is available (if iVersion is 2 or
14901490
** greater and the function pointer is not NULL) and will fall back
14911491
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
14921492
**
1493
-** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
1493
+** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
14941494
** are not used by the SQLite core. These optional interfaces are provided
14951495
** by some VFSes to facilitate testing of the VFS code. By overriding
14961496
** system calls with functions under its control, a test program can
14971497
** simulate faults and error conditions that would otherwise be difficult
14981498
** or impossible to induce. The set of system calls that can be overridden
@@ -4172,10 +4172,11 @@
41724172
** <li> sqlite3_errcode()
41734173
** <li> sqlite3_extended_errcode()
41744174
** <li> sqlite3_errmsg()
41754175
** <li> sqlite3_errmsg16()
41764176
** <li> sqlite3_error_offset()
4177
+** <li> sqlite3_db_handle()
41774178
** </ul>
41784179
**
41794180
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
41804181
** text that describes the error, as either UTF-8 or UTF-16 respectively,
41814182
** or NULL if no error message is available.
@@ -4430,16 +4431,32 @@
44304431
** compiles to see if some SQL syntax is well-formed, without generating
44314432
** messages on the global error log when it is not. If the test compile
44324433
** fails, the sqlite3_prepare_v3() call returns the same error indications
44334434
** with or without this flag; it just omits the call to [sqlite3_log()] that
44344435
** logs the error.
4436
+**
4437
+** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt>
4438
+** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to behave as if
4439
+** the SQL statement is part of a database schema. This makes a difference
4440
+** when the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] option is set to off.
4441
+** When this option is used and SQLITE_DBCONFIG_TRUSTED_SCHEMA is off,
4442
+** SQL functions may not be called unless they are tagged with
4443
+** [SQLITE_INNOCUOUS] and virtual tables may not be used unless tagged
4444
+** with [SQLITE_VTAB_INNOCUOUS]. Use the SQLITE_PREPARE_FROM_DDL option
4445
+** when preparing SQL that is derived from parts of the database
4446
+** schema. In particular, virtual table implementations that
4447
+** run SQL statements based on the arguments to their CREATE VIRTUAL
4448
+** TABLE statement should use [sqlite3_prepare_v3()] and set the
4449
+** SQLITE_PREPARE_FROM_DLL flag to prevent bypass of the
4450
+** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks.
44354451
** </dl>
44364452
*/
44374453
#define SQLITE_PREPARE_PERSISTENT 0x01
44384454
#define SQLITE_PREPARE_NORMALIZE 0x02
44394455
#define SQLITE_PREPARE_NO_VTAB 0x04
44404456
#define SQLITE_PREPARE_DONT_LOG 0x10
4457
+#define SQLITE_PREPARE_FROM_DDL 0x20
44414458
44424459
/*
44434460
** CAPI3REF: Compiling An SQL Statement
44444461
** KEYWORDS: {SQL statement compiler}
44454462
** METHOD: sqlite3
@@ -4449,12 +4466,13 @@
44494466
** program using one of these routines. Or, in other words, these routines
44504467
** are constructors for the [prepared statement] object.
44514468
**
44524469
** The preferred routine to use is [sqlite3_prepare_v2()]. The
44534470
** [sqlite3_prepare()] interface is legacy and should be avoided.
4454
-** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
4455
-** for special purposes.
4471
+** [sqlite3_prepare_v3()] has an extra
4472
+** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is some times
4473
+** needed for special purpose or to pass along security restrictions.
44564474
**
44574475
** The use of the UTF-8 interfaces is preferred, as SQLite currently
44584476
** does all parsing using UTF-8. The UTF-16 interfaces are provided
44594477
** as a convenience. The UTF-16 interfaces work by converting the
44604478
** input text into UTF-8, then invoking the corresponding UTF-8 interface.
@@ -6284,14 +6302,18 @@
62846302
** use for client data is to provide a mechanism for wrapper libraries
62856303
** to store additional information about an SQLite database connection.
62866304
**
62876305
** There is no limit (other than available memory) on the number of different
62886306
** client data pointers (with different names) that can be attached to a
6289
-** single database connection. However, the implementation is optimized
6290
-** for the case of having only one or two different client data names.
6291
-** Applications and wrapper libraries are discouraged from using more than
6292
-** one client data name each.
6307
+** single database connection. However, the current implementation stores
6308
+** the content on a linked list. Insert and retrieval performance will
6309
+** be proportional to the number of entries. The design use case, and
6310
+** the use case for which the implementation is optimized, is
6311
+** that an application will store only small number of client data names,
6312
+** typically just one or two. This interface is not intended to be a
6313
+** generalized key/value store for thousands or millions of keys. It
6314
+** will work for that, but performance might be disappointing.
62936315
**
62946316
** There is no way to enumerate the client data pointers
62956317
** associated with a database connection. The N parameter can be thought
62966318
** of as a secret key such that only code that knows the secret key is able
62976319
** to access the associated data.
@@ -7424,22 +7446,22 @@
74247446
** ^This interface loads an SQLite extension library from the named file.
74257447
**
74267448
** ^The sqlite3_load_extension() interface attempts to load an
74277449
** [SQLite extension] library contained in the file zFile. If
74287450
** the file cannot be loaded directly, attempts are made to load
7429
-** with various operating-system specific extensions added.
7451
+** with various operating-system specific filename extensions added.
74307452
** So for example, if "samplelib" cannot be loaded, then names like
74317453
** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
74327454
** be tried also.
74337455
**
74347456
** ^The entry point is zProc.
74357457
** ^(zProc may be 0, in which case SQLite will try to come up with an
74367458
** entry point name on its own. It first tries "sqlite3_extension_init".
7437
-** If that does not work, it constructs a name "sqlite3_X_init" where
7438
-** X consists of the lower-case equivalent of all ASCII alphabetic
7439
-** characters in the filename from the last "/" to the first following
7440
-** "." and omitting any initial "lib".)^
7459
+** If that does not work, it tries names of the form "sqlite3_X_init"
7460
+** where X consists of the lower-case equivalent of all ASCII alphabetic
7461
+** characters or all ASCII alphanumeric characters in the filename from
7462
+** the last "/" to the first following "." and omitting any initial "lib".)^
74417463
** ^The sqlite3_load_extension() interface returns
74427464
** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
74437465
** ^If an error occurs and pzErrMsg is not 0, then the
74447466
** [sqlite3_load_extension()] interface shall attempt to
74457467
** fill *pzErrMsg with error message text stored in memory
@@ -8728,11 +8750,11 @@
87288750
** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
87298751
** that contains the constructed string. The calling application should
87308752
** pass the returned value to [sqlite3_free()] to avoid a memory leak.
87318753
** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
87328754
** errors were encountered during construction of the string. ^The
8733
-** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
8755
+** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
87348756
** string in [sqlite3_str] object X is zero bytes long.
87358757
**
87368758
** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
87378759
** X and the string content it contains. Calling sqlite3_str_free(X) is
87388760
** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
87398761
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.52.0"
150 #define SQLITE_VERSION_NUMBER 3052000
151 #define SQLITE_SOURCE_ID "2025-11-25 18:20:33 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2025-11-25T18:20:33.534Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
@@ -1488,11 +1488,11 @@
1488 ** ^SQLite will use the xCurrentTimeInt64() method to get the current
1489 ** date and time if that method is available (if iVersion is 2 or
1490 ** greater and the function pointer is not NULL) and will fall back
1491 ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
1492 **
1493 ** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
1494 ** are not used by the SQLite core. These optional interfaces are provided
1495 ** by some VFSes to facilitate testing of the VFS code. By overriding
1496 ** system calls with functions under its control, a test program can
1497 ** simulate faults and error conditions that would otherwise be difficult
1498 ** or impossible to induce. The set of system calls that can be overridden
@@ -4172,10 +4172,11 @@
4172 ** <li> sqlite3_errcode()
4173 ** <li> sqlite3_extended_errcode()
4174 ** <li> sqlite3_errmsg()
4175 ** <li> sqlite3_errmsg16()
4176 ** <li> sqlite3_error_offset()
 
4177 ** </ul>
4178 **
4179 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
4180 ** text that describes the error, as either UTF-8 or UTF-16 respectively,
4181 ** or NULL if no error message is available.
@@ -4430,16 +4431,32 @@
4430 ** compiles to see if some SQL syntax is well-formed, without generating
4431 ** messages on the global error log when it is not. If the test compile
4432 ** fails, the sqlite3_prepare_v3() call returns the same error indications
4433 ** with or without this flag; it just omits the call to [sqlite3_log()] that
4434 ** logs the error.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4435 ** </dl>
4436 */
4437 #define SQLITE_PREPARE_PERSISTENT 0x01
4438 #define SQLITE_PREPARE_NORMALIZE 0x02
4439 #define SQLITE_PREPARE_NO_VTAB 0x04
4440 #define SQLITE_PREPARE_DONT_LOG 0x10
 
4441
4442 /*
4443 ** CAPI3REF: Compiling An SQL Statement
4444 ** KEYWORDS: {SQL statement compiler}
4445 ** METHOD: sqlite3
@@ -4449,12 +4466,13 @@
4449 ** program using one of these routines. Or, in other words, these routines
4450 ** are constructors for the [prepared statement] object.
4451 **
4452 ** The preferred routine to use is [sqlite3_prepare_v2()]. The
4453 ** [sqlite3_prepare()] interface is legacy and should be avoided.
4454 ** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
4455 ** for special purposes.
 
4456 **
4457 ** The use of the UTF-8 interfaces is preferred, as SQLite currently
4458 ** does all parsing using UTF-8. The UTF-16 interfaces are provided
4459 ** as a convenience. The UTF-16 interfaces work by converting the
4460 ** input text into UTF-8, then invoking the corresponding UTF-8 interface.
@@ -6284,14 +6302,18 @@
6284 ** use for client data is to provide a mechanism for wrapper libraries
6285 ** to store additional information about an SQLite database connection.
6286 **
6287 ** There is no limit (other than available memory) on the number of different
6288 ** client data pointers (with different names) that can be attached to a
6289 ** single database connection. However, the implementation is optimized
6290 ** for the case of having only one or two different client data names.
6291 ** Applications and wrapper libraries are discouraged from using more than
6292 ** one client data name each.
 
 
 
 
6293 **
6294 ** There is no way to enumerate the client data pointers
6295 ** associated with a database connection. The N parameter can be thought
6296 ** of as a secret key such that only code that knows the secret key is able
6297 ** to access the associated data.
@@ -7424,22 +7446,22 @@
7424 ** ^This interface loads an SQLite extension library from the named file.
7425 **
7426 ** ^The sqlite3_load_extension() interface attempts to load an
7427 ** [SQLite extension] library contained in the file zFile. If
7428 ** the file cannot be loaded directly, attempts are made to load
7429 ** with various operating-system specific extensions added.
7430 ** So for example, if "samplelib" cannot be loaded, then names like
7431 ** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
7432 ** be tried also.
7433 **
7434 ** ^The entry point is zProc.
7435 ** ^(zProc may be 0, in which case SQLite will try to come up with an
7436 ** entry point name on its own. It first tries "sqlite3_extension_init".
7437 ** If that does not work, it constructs a name "sqlite3_X_init" where
7438 ** X consists of the lower-case equivalent of all ASCII alphabetic
7439 ** characters in the filename from the last "/" to the first following
7440 ** "." and omitting any initial "lib".)^
7441 ** ^The sqlite3_load_extension() interface returns
7442 ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
7443 ** ^If an error occurs and pzErrMsg is not 0, then the
7444 ** [sqlite3_load_extension()] interface shall attempt to
7445 ** fill *pzErrMsg with error message text stored in memory
@@ -8728,11 +8750,11 @@
8728 ** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
8729 ** that contains the constructed string. The calling application should
8730 ** pass the returned value to [sqlite3_free()] to avoid a memory leak.
8731 ** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
8732 ** errors were encountered during construction of the string. ^The
8733 ** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
8734 ** string in [sqlite3_str] object X is zero bytes long.
8735 **
8736 ** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
8737 ** X and the string content it contains. Calling sqlite3_str_free(X) is
8738 ** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
8739
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.52.0"
150 #define SQLITE_VERSION_NUMBER 3052000
151 #define SQLITE_SOURCE_ID "2026-01-09 00:41:35 9adab8b2bef4130abd358d53384cb5f4dd691b808336bb7102793b0165b1c516"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-01-09T00:41:35.433Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
@@ -1488,11 +1488,11 @@
1488 ** ^SQLite will use the xCurrentTimeInt64() method to get the current
1489 ** date and time if that method is available (if iVersion is 2 or
1490 ** greater and the function pointer is not NULL) and will fall back
1491 ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
1492 **
1493 ** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
1494 ** are not used by the SQLite core. These optional interfaces are provided
1495 ** by some VFSes to facilitate testing of the VFS code. By overriding
1496 ** system calls with functions under its control, a test program can
1497 ** simulate faults and error conditions that would otherwise be difficult
1498 ** or impossible to induce. The set of system calls that can be overridden
@@ -4172,10 +4172,11 @@
4172 ** <li> sqlite3_errcode()
4173 ** <li> sqlite3_extended_errcode()
4174 ** <li> sqlite3_errmsg()
4175 ** <li> sqlite3_errmsg16()
4176 ** <li> sqlite3_error_offset()
4177 ** <li> sqlite3_db_handle()
4178 ** </ul>
4179 **
4180 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
4181 ** text that describes the error, as either UTF-8 or UTF-16 respectively,
4182 ** or NULL if no error message is available.
@@ -4430,16 +4431,32 @@
4431 ** compiles to see if some SQL syntax is well-formed, without generating
4432 ** messages on the global error log when it is not. If the test compile
4433 ** fails, the sqlite3_prepare_v3() call returns the same error indications
4434 ** with or without this flag; it just omits the call to [sqlite3_log()] that
4435 ** logs the error.
4436 **
4437 ** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt>
4438 ** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to behave as if
4439 ** the SQL statement is part of a database schema. This makes a difference
4440 ** when the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] option is set to off.
4441 ** When this option is used and SQLITE_DBCONFIG_TRUSTED_SCHEMA is off,
4442 ** SQL functions may not be called unless they are tagged with
4443 ** [SQLITE_INNOCUOUS] and virtual tables may not be used unless tagged
4444 ** with [SQLITE_VTAB_INNOCUOUS]. Use the SQLITE_PREPARE_FROM_DDL option
4445 ** when preparing SQL that is derived from parts of the database
4446 ** schema. In particular, virtual table implementations that
4447 ** run SQL statements based on the arguments to their CREATE VIRTUAL
4448 ** TABLE statement should use [sqlite3_prepare_v3()] and set the
4449 ** SQLITE_PREPARE_FROM_DLL flag to prevent bypass of the
4450 ** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks.
4451 ** </dl>
4452 */
4453 #define SQLITE_PREPARE_PERSISTENT 0x01
4454 #define SQLITE_PREPARE_NORMALIZE 0x02
4455 #define SQLITE_PREPARE_NO_VTAB 0x04
4456 #define SQLITE_PREPARE_DONT_LOG 0x10
4457 #define SQLITE_PREPARE_FROM_DDL 0x20
4458
4459 /*
4460 ** CAPI3REF: Compiling An SQL Statement
4461 ** KEYWORDS: {SQL statement compiler}
4462 ** METHOD: sqlite3
@@ -4449,12 +4466,13 @@
4466 ** program using one of these routines. Or, in other words, these routines
4467 ** are constructors for the [prepared statement] object.
4468 **
4469 ** The preferred routine to use is [sqlite3_prepare_v2()]. The
4470 ** [sqlite3_prepare()] interface is legacy and should be avoided.
4471 ** [sqlite3_prepare_v3()] has an extra
4472 ** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is some times
4473 ** needed for special purpose or to pass along security restrictions.
4474 **
4475 ** The use of the UTF-8 interfaces is preferred, as SQLite currently
4476 ** does all parsing using UTF-8. The UTF-16 interfaces are provided
4477 ** as a convenience. The UTF-16 interfaces work by converting the
4478 ** input text into UTF-8, then invoking the corresponding UTF-8 interface.
@@ -6284,14 +6302,18 @@
6302 ** use for client data is to provide a mechanism for wrapper libraries
6303 ** to store additional information about an SQLite database connection.
6304 **
6305 ** There is no limit (other than available memory) on the number of different
6306 ** client data pointers (with different names) that can be attached to a
6307 ** single database connection. However, the current implementation stores
6308 ** the content on a linked list. Insert and retrieval performance will
6309 ** be proportional to the number of entries. The design use case, and
6310 ** the use case for which the implementation is optimized, is
6311 ** that an application will store only small number of client data names,
6312 ** typically just one or two. This interface is not intended to be a
6313 ** generalized key/value store for thousands or millions of keys. It
6314 ** will work for that, but performance might be disappointing.
6315 **
6316 ** There is no way to enumerate the client data pointers
6317 ** associated with a database connection. The N parameter can be thought
6318 ** of as a secret key such that only code that knows the secret key is able
6319 ** to access the associated data.
@@ -7424,22 +7446,22 @@
7446 ** ^This interface loads an SQLite extension library from the named file.
7447 **
7448 ** ^The sqlite3_load_extension() interface attempts to load an
7449 ** [SQLite extension] library contained in the file zFile. If
7450 ** the file cannot be loaded directly, attempts are made to load
7451 ** with various operating-system specific filename extensions added.
7452 ** So for example, if "samplelib" cannot be loaded, then names like
7453 ** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
7454 ** be tried also.
7455 **
7456 ** ^The entry point is zProc.
7457 ** ^(zProc may be 0, in which case SQLite will try to come up with an
7458 ** entry point name on its own. It first tries "sqlite3_extension_init".
7459 ** If that does not work, it tries names of the form "sqlite3_X_init"
7460 ** where X consists of the lower-case equivalent of all ASCII alphabetic
7461 ** characters or all ASCII alphanumeric characters in the filename from
7462 ** the last "/" to the first following "." and omitting any initial "lib".)^
7463 ** ^The sqlite3_load_extension() interface returns
7464 ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
7465 ** ^If an error occurs and pzErrMsg is not 0, then the
7466 ** [sqlite3_load_extension()] interface shall attempt to
7467 ** fill *pzErrMsg with error message text stored in memory
@@ -8728,11 +8750,11 @@
8750 ** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
8751 ** that contains the constructed string. The calling application should
8752 ** pass the returned value to [sqlite3_free()] to avoid a memory leak.
8753 ** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
8754 ** errors were encountered during construction of the string. ^The
8755 ** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
8756 ** string in [sqlite3_str] object X is zero bytes long.
8757 **
8758 ** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
8759 ** X and the string content it contains. Calling sqlite3_str_free(X) is
8760 ** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
8761
+2 -2
--- src/add.c
+++ src/add.c
@@ -353,11 +353,11 @@
353353
** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
354354
** option does not appear on the command line then the "ignore-glob" setting
355355
** is used. If the --clean option does not appear on the command line then
356356
** the "clean-glob" setting is used.
357357
**
358
-** When attempting to explicitly add files on the commandline, and if those
358
+** When attempting to explicitly add files on the command line, and if those
359359
** match "ignore-glob", a confirmation is asked first. This can be prevented
360360
** using the -f|--force option.
361361
**
362362
** The --case-sensitive option determines whether or not filenames should
363363
** be treated case sensitive or not. If the option is not given, the default
@@ -476,11 +476,11 @@
476476
}
477477
glob_free(pIgnore);
478478
glob_free(pClean);
479479
480480
/** Check for Windows-reserved names and warn or exit, as
481
- ** appopriate. Note that the 'add' internal machinery already
481
+ ** appropriate. Note that the 'add' internal machinery already
482482
** _silently_ skips over any names for which
483483
** file_is_reserved_name() returns true or which is in the
484484
** fossil_reserved_name() list. We do not need to warn for those,
485485
** as they're outright verboten. */
486486
if(db_exists("SELECT 1 FROM sfile WHERE win_reserved(pathname)")){
487487
--- src/add.c
+++ src/add.c
@@ -353,11 +353,11 @@
353 ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
354 ** option does not appear on the command line then the "ignore-glob" setting
355 ** is used. If the --clean option does not appear on the command line then
356 ** the "clean-glob" setting is used.
357 **
358 ** When attempting to explicitly add files on the commandline, and if those
359 ** match "ignore-glob", a confirmation is asked first. This can be prevented
360 ** using the -f|--force option.
361 **
362 ** The --case-sensitive option determines whether or not filenames should
363 ** be treated case sensitive or not. If the option is not given, the default
@@ -476,11 +476,11 @@
476 }
477 glob_free(pIgnore);
478 glob_free(pClean);
479
480 /** Check for Windows-reserved names and warn or exit, as
481 ** appopriate. Note that the 'add' internal machinery already
482 ** _silently_ skips over any names for which
483 ** file_is_reserved_name() returns true or which is in the
484 ** fossil_reserved_name() list. We do not need to warn for those,
485 ** as they're outright verboten. */
486 if(db_exists("SELECT 1 FROM sfile WHERE win_reserved(pathname)")){
487
--- src/add.c
+++ src/add.c
@@ -353,11 +353,11 @@
353 ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
354 ** option does not appear on the command line then the "ignore-glob" setting
355 ** is used. If the --clean option does not appear on the command line then
356 ** the "clean-glob" setting is used.
357 **
358 ** When attempting to explicitly add files on the command line, and if those
359 ** match "ignore-glob", a confirmation is asked first. This can be prevented
360 ** using the -f|--force option.
361 **
362 ** The --case-sensitive option determines whether or not filenames should
363 ** be treated case sensitive or not. If the option is not given, the default
@@ -476,11 +476,11 @@
476 }
477 glob_free(pIgnore);
478 glob_free(pClean);
479
480 /** Check for Windows-reserved names and warn or exit, as
481 ** appropriate. Note that the 'add' internal machinery already
482 ** _silently_ skips over any names for which
483 ** file_is_reserved_name() returns true or which is in the
484 ** fossil_reserved_name() list. We do not need to warn for those,
485 ** as they're outright verboten. */
486 if(db_exists("SELECT 1 FROM sfile WHERE win_reserved(pathname)")){
487
+1 -1
--- src/ajax.c
+++ src/ajax.c
@@ -395,11 +395,11 @@
395395
const AjaxRoute routes[] = {
396396
/* Keep these sorted by zName (for bsearch()) */
397397
{"preview-text", ajax_route_preview_text, 0, 1
398398
/* Note that this does not require write permissions in the repo.
399399
** It should arguably require write permissions but doing means
400
- ** that /chat does not work without checkin permissions:
400
+ ** that /chat does not work without check-in permissions:
401401
**
402402
** https://fossil-scm.org/forum/forumpost/ed4a762b3a557898
403403
**
404404
** This particular route is used by /fileedit and /chat, whereas
405405
** /wikiedit uses a simpler wiki-specific route.
406406
--- src/ajax.c
+++ src/ajax.c
@@ -395,11 +395,11 @@
395 const AjaxRoute routes[] = {
396 /* Keep these sorted by zName (for bsearch()) */
397 {"preview-text", ajax_route_preview_text, 0, 1
398 /* Note that this does not require write permissions in the repo.
399 ** It should arguably require write permissions but doing means
400 ** that /chat does not work without checkin permissions:
401 **
402 ** https://fossil-scm.org/forum/forumpost/ed4a762b3a557898
403 **
404 ** This particular route is used by /fileedit and /chat, whereas
405 ** /wikiedit uses a simpler wiki-specific route.
406
--- src/ajax.c
+++ src/ajax.c
@@ -395,11 +395,11 @@
395 const AjaxRoute routes[] = {
396 /* Keep these sorted by zName (for bsearch()) */
397 {"preview-text", ajax_route_preview_text, 0, 1
398 /* Note that this does not require write permissions in the repo.
399 ** It should arguably require write permissions but doing means
400 ** that /chat does not work without check-in permissions:
401 **
402 ** https://fossil-scm.org/forum/forumpost/ed4a762b3a557898
403 **
404 ** This particular route is used by /fileedit and /chat, whereas
405 ** /wikiedit uses a simpler wiki-specific route.
406
+8 -7
--- src/alerts.c
+++ src/alerts.c
@@ -159,10 +159,11 @@
159159
if( db_table_exists("temp","deferred_chat_events")
160160
&& db_table_exists("repository","chat")
161161
){
162162
const char *zChatUser = db_get("chat-timeline-user", 0);
163163
if( zChatUser && zChatUser[0] ){
164
+ chat_create_tables(); /* Make sure TEMP TRIGGERs for FTS exist */
164165
db_multi_exec(
165166
"INSERT INTO chat(mtime,lmtime,xfrom,xmsg)"
166167
" SELECT julianday(), "
167168
" strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime'),"
168169
" %Q,"
@@ -663,11 +664,11 @@
663664
return p;
664665
}
665666
666667
/*
667668
** Scan the header of the email message in pMsg looking for the
668
-** (first) occurrance of zField. Fill pValue with the content of
669
+** (first) occurrence of zField. Fill pValue with the content of
669670
** that field.
670671
**
671672
** This routine initializes pValue. Any prior content of pValue is
672673
** discarded (leaked).
673674
**
@@ -709,11 +710,11 @@
709710
/*
710711
** Determine whether or not the input string is a valid email address.
711712
** Only look at character up to but not including the first \000 or
712713
** the first cTerm character, whichever comes first.
713714
**
714
-** Return the length of the email addresss string in bytes if the email
715
+** Return the length of the email address string in bytes if the email
715716
** address is valid. If the email address is misformed, return 0.
716717
*/
717718
int email_address_is_valid(const char *z, char cTerm){
718719
int i;
719720
int nAt = 0;
@@ -2258,11 +2259,11 @@
22582259
** Users visit this page to be delisted from email alerts.
22592260
**
22602261
** If a valid subscriber code is supplied in the name= query parameter,
22612262
** then that subscriber is delisted.
22622263
**
2263
-** Otherwise, If the users is logged in, then they are redirected
2264
+** Otherwise, if the users are logged in, then they are redirected
22642265
** to the /alerts page where they have an unsubscribe button.
22652266
**
22662267
** Non-logged-in users with no name= query parameter are invited to enter
22672268
** an email address to which will be sent the unsubscribe link that
22682269
** contains the correct subscriber code.
@@ -2605,11 +2606,11 @@
26052606
/*
26062607
** Compute a string that is appropriate for the EmailEvent.zPriors field
26072608
** for a particular forum post.
26082609
**
26092610
** This string is an encode list of sender names and rids for all ancestors
2610
-** of the fpdi post - the post that fpid answer, the post that that parent
2611
+** of the fpid post - the post that fpid answers, the post that parent
26112612
** post answers, and so forth back up to the root post. Duplicates sender
26122613
** names are omitted.
26132614
**
26142615
** The EmailEvent.zPriors field is used to screen events for people who
26152616
** only want to see replies to their own posts or to specific posts.
@@ -2954,12 +2955,12 @@
29542955
Blob *pBody, /* Write email body here */
29552956
const char *zCode, /* The subscriber code */
29562957
int lastContact, /* Last contact (days since 1970) */
29572958
const char *zEAddr, /* Subscriber email address. Send to this. */
29582959
const char *zSub, /* Subscription codes */
2959
- const char *zRepoName, /* Name of the sending Fossil repostory */
2960
- const char *zUrl /* URL for the sending Fossil repostory */
2960
+ const char *zRepoName, /* Name of the sending Fossil repository */
2961
+ const char *zUrl /* URL for the sending Fossil repository */
29612962
){
29622963
blob_appendf(pHdr,"To: <%s>\r\n", zEAddr);
29632964
blob_appendf(pHdr,"Subject: %s Subscription to %s expires soon\r\n",
29642965
zRepoName, zUrl);
29652966
blob_appendf(pBody,
@@ -3465,11 +3466,11 @@
34653466
@ </form>
34663467
style_finish_page();
34673468
}
34683469
34693470
/*
3470
-** Send an annoucement message described by query parameter.
3471
+** Send an announcement message described by query parameter.
34713472
** Permission to do this has already been verified.
34723473
*/
34733474
static char *alert_send_announcement(void){
34743475
AlertSender *pSender;
34753476
char *zErr;
34763477
--- src/alerts.c
+++ src/alerts.c
@@ -159,10 +159,11 @@
159 if( db_table_exists("temp","deferred_chat_events")
160 && db_table_exists("repository","chat")
161 ){
162 const char *zChatUser = db_get("chat-timeline-user", 0);
163 if( zChatUser && zChatUser[0] ){
 
164 db_multi_exec(
165 "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)"
166 " SELECT julianday(), "
167 " strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime'),"
168 " %Q,"
@@ -663,11 +664,11 @@
663 return p;
664 }
665
666 /*
667 ** Scan the header of the email message in pMsg looking for the
668 ** (first) occurrance of zField. Fill pValue with the content of
669 ** that field.
670 **
671 ** This routine initializes pValue. Any prior content of pValue is
672 ** discarded (leaked).
673 **
@@ -709,11 +710,11 @@
709 /*
710 ** Determine whether or not the input string is a valid email address.
711 ** Only look at character up to but not including the first \000 or
712 ** the first cTerm character, whichever comes first.
713 **
714 ** Return the length of the email addresss string in bytes if the email
715 ** address is valid. If the email address is misformed, return 0.
716 */
717 int email_address_is_valid(const char *z, char cTerm){
718 int i;
719 int nAt = 0;
@@ -2258,11 +2259,11 @@
2258 ** Users visit this page to be delisted from email alerts.
2259 **
2260 ** If a valid subscriber code is supplied in the name= query parameter,
2261 ** then that subscriber is delisted.
2262 **
2263 ** Otherwise, If the users is logged in, then they are redirected
2264 ** to the /alerts page where they have an unsubscribe button.
2265 **
2266 ** Non-logged-in users with no name= query parameter are invited to enter
2267 ** an email address to which will be sent the unsubscribe link that
2268 ** contains the correct subscriber code.
@@ -2605,11 +2606,11 @@
2605 /*
2606 ** Compute a string that is appropriate for the EmailEvent.zPriors field
2607 ** for a particular forum post.
2608 **
2609 ** This string is an encode list of sender names and rids for all ancestors
2610 ** of the fpdi post - the post that fpid answer, the post that that parent
2611 ** post answers, and so forth back up to the root post. Duplicates sender
2612 ** names are omitted.
2613 **
2614 ** The EmailEvent.zPriors field is used to screen events for people who
2615 ** only want to see replies to their own posts or to specific posts.
@@ -2954,12 +2955,12 @@
2954 Blob *pBody, /* Write email body here */
2955 const char *zCode, /* The subscriber code */
2956 int lastContact, /* Last contact (days since 1970) */
2957 const char *zEAddr, /* Subscriber email address. Send to this. */
2958 const char *zSub, /* Subscription codes */
2959 const char *zRepoName, /* Name of the sending Fossil repostory */
2960 const char *zUrl /* URL for the sending Fossil repostory */
2961 ){
2962 blob_appendf(pHdr,"To: <%s>\r\n", zEAddr);
2963 blob_appendf(pHdr,"Subject: %s Subscription to %s expires soon\r\n",
2964 zRepoName, zUrl);
2965 blob_appendf(pBody,
@@ -3465,11 +3466,11 @@
3465 @ </form>
3466 style_finish_page();
3467 }
3468
3469 /*
3470 ** Send an annoucement message described by query parameter.
3471 ** Permission to do this has already been verified.
3472 */
3473 static char *alert_send_announcement(void){
3474 AlertSender *pSender;
3475 char *zErr;
3476
--- src/alerts.c
+++ src/alerts.c
@@ -159,10 +159,11 @@
159 if( db_table_exists("temp","deferred_chat_events")
160 && db_table_exists("repository","chat")
161 ){
162 const char *zChatUser = db_get("chat-timeline-user", 0);
163 if( zChatUser && zChatUser[0] ){
164 chat_create_tables(); /* Make sure TEMP TRIGGERs for FTS exist */
165 db_multi_exec(
166 "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)"
167 " SELECT julianday(), "
168 " strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime'),"
169 " %Q,"
@@ -663,11 +664,11 @@
664 return p;
665 }
666
667 /*
668 ** Scan the header of the email message in pMsg looking for the
669 ** (first) occurrence of zField. Fill pValue with the content of
670 ** that field.
671 **
672 ** This routine initializes pValue. Any prior content of pValue is
673 ** discarded (leaked).
674 **
@@ -709,11 +710,11 @@
710 /*
711 ** Determine whether or not the input string is a valid email address.
712 ** Only look at character up to but not including the first \000 or
713 ** the first cTerm character, whichever comes first.
714 **
715 ** Return the length of the email address string in bytes if the email
716 ** address is valid. If the email address is misformed, return 0.
717 */
718 int email_address_is_valid(const char *z, char cTerm){
719 int i;
720 int nAt = 0;
@@ -2258,11 +2259,11 @@
2259 ** Users visit this page to be delisted from email alerts.
2260 **
2261 ** If a valid subscriber code is supplied in the name= query parameter,
2262 ** then that subscriber is delisted.
2263 **
2264 ** Otherwise, if the users are logged in, then they are redirected
2265 ** to the /alerts page where they have an unsubscribe button.
2266 **
2267 ** Non-logged-in users with no name= query parameter are invited to enter
2268 ** an email address to which will be sent the unsubscribe link that
2269 ** contains the correct subscriber code.
@@ -2605,11 +2606,11 @@
2606 /*
2607 ** Compute a string that is appropriate for the EmailEvent.zPriors field
2608 ** for a particular forum post.
2609 **
2610 ** This string is an encode list of sender names and rids for all ancestors
2611 ** of the fpid post - the post that fpid answers, the post that parent
2612 ** post answers, and so forth back up to the root post. Duplicates sender
2613 ** names are omitted.
2614 **
2615 ** The EmailEvent.zPriors field is used to screen events for people who
2616 ** only want to see replies to their own posts or to specific posts.
@@ -2954,12 +2955,12 @@
2955 Blob *pBody, /* Write email body here */
2956 const char *zCode, /* The subscriber code */
2957 int lastContact, /* Last contact (days since 1970) */
2958 const char *zEAddr, /* Subscriber email address. Send to this. */
2959 const char *zSub, /* Subscription codes */
2960 const char *zRepoName, /* Name of the sending Fossil repository */
2961 const char *zUrl /* URL for the sending Fossil repository */
2962 ){
2963 blob_appendf(pHdr,"To: <%s>\r\n", zEAddr);
2964 blob_appendf(pHdr,"Subject: %s Subscription to %s expires soon\r\n",
2965 zRepoName, zUrl);
2966 blob_appendf(pBody,
@@ -3465,11 +3466,11 @@
3466 @ </form>
3467 style_finish_page();
3468 }
3469
3470 /*
3471 ** Send an announcement message described by query parameter.
3472 ** Permission to do this has already been verified.
3473 */
3474 static char *alert_send_announcement(void){
3475 AlertSender *pSender;
3476 char *zErr;
3477
+18 -5
--- src/allrepo.c
+++ src/allrepo.c
@@ -157,19 +157,22 @@
157157
** when one of the following commands are run against the repository:
158158
** clone, info, pull, push, or sync. Even previously ignored repositories
159159
** are added back to the list of repositories by these commands.
160160
**
161161
** Options:
162
-** --dry-run If given, display instead of run actions
162
+** --dry-run Just display commands that would have run
163163
** --showfile Show the repository or check-out being operated upon
164164
** --stop-on-error Halt immediately if any subprocess fails
165
+** -s|--stop Shorthand for "--stop-on-error"
165166
*/
166167
void all_cmd(void){
167168
Stmt q;
168169
const char *zCmd;
169
- char *zSyscmd;
170
+ char *zSyscmd = 0;
170171
Blob extra;
172
+ int bHalted = 0;
173
+ int rc = 0;
171174
int useCheckouts = 0;
172175
int quiet = 0;
173176
int dryRunFlag = 0;
174177
int showFile = find_option("showfile",0,0)!=0;
175178
int stopOnError;
@@ -176,10 +179,11 @@
176179
int nToDel = 0;
177180
int showLabel = 0;
178181
179182
(void)find_option("dontstop",0,0); /* Legacy. Now the default */
180183
stopOnError = find_option("stop-on-error",0,0)!=0;
184
+ if( find_option("stop","s",0)!=0 ) stopOnError = 1;
181185
dryRunFlag = find_option("dry-run","n",0)!=0;
182186
if( !dryRunFlag ){
183187
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
184188
}
185189
@@ -330,10 +334,12 @@
330334
zCmd = "sync -autourl -R";
331335
collect_argument(&extra, "share-links",0);
332336
collect_argument(&extra, "verbose","v");
333337
collect_argument(&extra, "unversioned","u");
334338
collect_argument(&extra, "all",0);
339
+ collect_argument(&extra, "quiet","q");
340
+ collect_argument(&extra, "ping",0);
335341
}else if( fossil_strcmp(zCmd, "test-integrity")==0 ){
336342
collect_argument(&extra, "db-only", "d");
337343
collect_argument(&extra, "parse", 0);
338344
collect_argument(&extra, "quick", "q");
339345
zCmd = "test-integrity";
@@ -465,11 +471,10 @@
465471
" ORDER BY 1"
466472
);
467473
}
468474
db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
469475
while( db_step(&q)==SQLITE_ROW ){
470
- int rc;
471476
const char *zFilename = db_column_text(&q, 0);
472477
const char *zInode = db_column_text(&q,2);
473478
#if !USE_SEE
474479
if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
475480
#endif
@@ -502,18 +507,21 @@
502507
if( !quiet || dryRunFlag ){
503508
fossil_print("%s\n", zSyscmd);
504509
fflush(stdout);
505510
}
506511
rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
507
- free(zSyscmd);
508512
if( rc ){
509
- if( stopOnError ) break;
513
+ if( stopOnError ){
514
+ bHalted = 1;
515
+ break;
516
+ }
510517
/* If there is an error, pause briefly, but do not stop. The brief
511518
** pause is so that if the prior command failed with Ctrl-C then there
512519
** will be time to stop the whole thing with a second Ctrl-C. */
513520
sqlite3_sleep(330);
514521
}
522
+ fossil_free(zSyscmd);
515523
}
516524
db_finalize(&q);
517525
518526
blob_reset(&extra);
519527
@@ -528,6 +536,11 @@
528536
db_unprotect(PROTECT_CONFIG);
529537
db_multi_exec("%s", zSql /*safe-for-%s*/ );
530538
db_protect_pop();
531539
}
532540
}
541
+
542
+ if( stopOnError && bHalted ){
543
+ fossil_fatal("STOPPED: non-zero result code (%d) from\nSTOPPED: %s",
544
+ rc, zSyscmd);
545
+ }
533546
}
534547
--- src/allrepo.c
+++ src/allrepo.c
@@ -157,19 +157,22 @@
157 ** when one of the following commands are run against the repository:
158 ** clone, info, pull, push, or sync. Even previously ignored repositories
159 ** are added back to the list of repositories by these commands.
160 **
161 ** Options:
162 ** --dry-run If given, display instead of run actions
163 ** --showfile Show the repository or check-out being operated upon
164 ** --stop-on-error Halt immediately if any subprocess fails
 
165 */
166 void all_cmd(void){
167 Stmt q;
168 const char *zCmd;
169 char *zSyscmd;
170 Blob extra;
 
 
171 int useCheckouts = 0;
172 int quiet = 0;
173 int dryRunFlag = 0;
174 int showFile = find_option("showfile",0,0)!=0;
175 int stopOnError;
@@ -176,10 +179,11 @@
176 int nToDel = 0;
177 int showLabel = 0;
178
179 (void)find_option("dontstop",0,0); /* Legacy. Now the default */
180 stopOnError = find_option("stop-on-error",0,0)!=0;
 
181 dryRunFlag = find_option("dry-run","n",0)!=0;
182 if( !dryRunFlag ){
183 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
184 }
185
@@ -330,10 +334,12 @@
330 zCmd = "sync -autourl -R";
331 collect_argument(&extra, "share-links",0);
332 collect_argument(&extra, "verbose","v");
333 collect_argument(&extra, "unversioned","u");
334 collect_argument(&extra, "all",0);
 
 
335 }else if( fossil_strcmp(zCmd, "test-integrity")==0 ){
336 collect_argument(&extra, "db-only", "d");
337 collect_argument(&extra, "parse", 0);
338 collect_argument(&extra, "quick", "q");
339 zCmd = "test-integrity";
@@ -465,11 +471,10 @@
465 " ORDER BY 1"
466 );
467 }
468 db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
469 while( db_step(&q)==SQLITE_ROW ){
470 int rc;
471 const char *zFilename = db_column_text(&q, 0);
472 const char *zInode = db_column_text(&q,2);
473 #if !USE_SEE
474 if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
475 #endif
@@ -502,18 +507,21 @@
502 if( !quiet || dryRunFlag ){
503 fossil_print("%s\n", zSyscmd);
504 fflush(stdout);
505 }
506 rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
507 free(zSyscmd);
508 if( rc ){
509 if( stopOnError ) break;
 
 
 
510 /* If there is an error, pause briefly, but do not stop. The brief
511 ** pause is so that if the prior command failed with Ctrl-C then there
512 ** will be time to stop the whole thing with a second Ctrl-C. */
513 sqlite3_sleep(330);
514 }
 
515 }
516 db_finalize(&q);
517
518 blob_reset(&extra);
519
@@ -528,6 +536,11 @@
528 db_unprotect(PROTECT_CONFIG);
529 db_multi_exec("%s", zSql /*safe-for-%s*/ );
530 db_protect_pop();
531 }
532 }
 
 
 
 
 
533 }
534
--- src/allrepo.c
+++ src/allrepo.c
@@ -157,19 +157,22 @@
157 ** when one of the following commands are run against the repository:
158 ** clone, info, pull, push, or sync. Even previously ignored repositories
159 ** are added back to the list of repositories by these commands.
160 **
161 ** Options:
162 ** --dry-run Just display commands that would have run
163 ** --showfile Show the repository or check-out being operated upon
164 ** --stop-on-error Halt immediately if any subprocess fails
165 ** -s|--stop Shorthand for "--stop-on-error"
166 */
167 void all_cmd(void){
168 Stmt q;
169 const char *zCmd;
170 char *zSyscmd = 0;
171 Blob extra;
172 int bHalted = 0;
173 int rc = 0;
174 int useCheckouts = 0;
175 int quiet = 0;
176 int dryRunFlag = 0;
177 int showFile = find_option("showfile",0,0)!=0;
178 int stopOnError;
@@ -176,10 +179,11 @@
179 int nToDel = 0;
180 int showLabel = 0;
181
182 (void)find_option("dontstop",0,0); /* Legacy. Now the default */
183 stopOnError = find_option("stop-on-error",0,0)!=0;
184 if( find_option("stop","s",0)!=0 ) stopOnError = 1;
185 dryRunFlag = find_option("dry-run","n",0)!=0;
186 if( !dryRunFlag ){
187 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
188 }
189
@@ -330,10 +334,12 @@
334 zCmd = "sync -autourl -R";
335 collect_argument(&extra, "share-links",0);
336 collect_argument(&extra, "verbose","v");
337 collect_argument(&extra, "unversioned","u");
338 collect_argument(&extra, "all",0);
339 collect_argument(&extra, "quiet","q");
340 collect_argument(&extra, "ping",0);
341 }else if( fossil_strcmp(zCmd, "test-integrity")==0 ){
342 collect_argument(&extra, "db-only", "d");
343 collect_argument(&extra, "parse", 0);
344 collect_argument(&extra, "quick", "q");
345 zCmd = "test-integrity";
@@ -465,11 +471,10 @@
471 " ORDER BY 1"
472 );
473 }
474 db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
475 while( db_step(&q)==SQLITE_ROW ){
 
476 const char *zFilename = db_column_text(&q, 0);
477 const char *zInode = db_column_text(&q,2);
478 #if !USE_SEE
479 if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
480 #endif
@@ -502,18 +507,21 @@
507 if( !quiet || dryRunFlag ){
508 fossil_print("%s\n", zSyscmd);
509 fflush(stdout);
510 }
511 rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
 
512 if( rc ){
513 if( stopOnError ){
514 bHalted = 1;
515 break;
516 }
517 /* If there is an error, pause briefly, but do not stop. The brief
518 ** pause is so that if the prior command failed with Ctrl-C then there
519 ** will be time to stop the whole thing with a second Ctrl-C. */
520 sqlite3_sleep(330);
521 }
522 fossil_free(zSyscmd);
523 }
524 db_finalize(&q);
525
526 blob_reset(&extra);
527
@@ -528,6 +536,11 @@
536 db_unprotect(PROTECT_CONFIG);
537 db_multi_exec("%s", zSql /*safe-for-%s*/ );
538 db_protect_pop();
539 }
540 }
541
542 if( stopOnError && bHalted ){
543 fossil_fatal("STOPPED: non-zero result code (%d) from\nSTOPPED: %s",
544 rc, zSyscmd);
545 }
546 }
547
+1 -1
--- src/backlink.c
+++ src/backlink.c
@@ -338,11 +338,11 @@
338338
blob_reset(&in);
339339
}
340340
341341
/*
342342
** Transform mimetype string into an integer code.
343
-** NOTE: In the sake of compatability empty string is parsed as MT_UNKNOWN;
343
+** NOTE: In the sake of compatibility empty string is parsed as MT_UNKNOWN;
344344
** it is yet unclear whether it can safely be changed to MT_NONE.
345345
*/
346346
int parse_mimetype(const char* zMimetype){
347347
if( zMimetype==0 ) return MT_NONE;
348348
if( strstr(zMimetype,"wiki")!=0 ) return MT_WIKI;
349349
--- src/backlink.c
+++ src/backlink.c
@@ -338,11 +338,11 @@
338 blob_reset(&in);
339 }
340
341 /*
342 ** Transform mimetype string into an integer code.
343 ** NOTE: In the sake of compatability empty string is parsed as MT_UNKNOWN;
344 ** it is yet unclear whether it can safely be changed to MT_NONE.
345 */
346 int parse_mimetype(const char* zMimetype){
347 if( zMimetype==0 ) return MT_NONE;
348 if( strstr(zMimetype,"wiki")!=0 ) return MT_WIKI;
349
--- src/backlink.c
+++ src/backlink.c
@@ -338,11 +338,11 @@
338 blob_reset(&in);
339 }
340
341 /*
342 ** Transform mimetype string into an integer code.
343 ** NOTE: In the sake of compatibility empty string is parsed as MT_UNKNOWN;
344 ** it is yet unclear whether it can safely be changed to MT_NONE.
345 */
346 int parse_mimetype(const char* zMimetype){
347 if( zMimetype==0 ) return MT_NONE;
348 if( strstr(zMimetype,"wiki")!=0 ) return MT_WIKI;
349
+1 -1
--- src/bisect.c
+++ src/bisect.c
@@ -171,11 +171,11 @@
171171
172172
/*
173173
** Append a new entry to the bisect log. Update the bisect-good or
174174
** bisect-bad values as appropriate.
175175
**
176
-** The bisect-log consists of a list of token. Each token is an
176
+** The bisect-log consists of a list of tokens. Each token is an
177177
** integer RID of a check-in. The RID is negative for "bad" check-ins
178178
** and positive for "good" check-ins.
179179
*/
180180
static void bisect_append_log(int rid){
181181
if( rid<0 ){
182182
--- src/bisect.c
+++ src/bisect.c
@@ -171,11 +171,11 @@
171
172 /*
173 ** Append a new entry to the bisect log. Update the bisect-good or
174 ** bisect-bad values as appropriate.
175 **
176 ** The bisect-log consists of a list of token. Each token is an
177 ** integer RID of a check-in. The RID is negative for "bad" check-ins
178 ** and positive for "good" check-ins.
179 */
180 static void bisect_append_log(int rid){
181 if( rid<0 ){
182
--- src/bisect.c
+++ src/bisect.c
@@ -171,11 +171,11 @@
171
172 /*
173 ** Append a new entry to the bisect log. Update the bisect-good or
174 ** bisect-bad values as appropriate.
175 **
176 ** The bisect-log consists of a list of tokens. Each token is an
177 ** integer RID of a check-in. The RID is negative for "bad" check-ins
178 ** and positive for "good" check-ins.
179 */
180 static void bisect_append_log(int rid){
181 if( rid<0 ){
182
+6 -6
--- src/blob.c
+++ src/blob.c
@@ -782,11 +782,11 @@
782782
** end-of-file.
783783
**
784784
** The cursor of pFrom is left pointing at the first byte past the
785785
** \n that terminated the line.
786786
**
787
-** pTo will be an ephermeral blob. If pFrom changes, it might alter
787
+** pTo will be an ephemeral blob. If pFrom changes, it might alter
788788
** pTo as well.
789789
*/
790790
int blob_line(Blob *pFrom, Blob *pTo){
791791
char *aData = pFrom->aData;
792792
int n = pFrom->nUsed;
@@ -825,11 +825,11 @@
825825
** whitespace is ignored.
826826
**
827827
** The cursor of pFrom is left pointing at the first character past
828828
** the end of the token.
829829
**
830
-** pTo will be an ephermeral blob. If pFrom changes, it might alter
830
+** pTo will be an ephemeral blob. If pFrom changes, it might alter
831831
** pTo as well.
832832
*/
833833
int blob_token(Blob *pFrom, Blob *pTo){
834834
char *aData = pFrom->aData;
835835
int n = pFrom->nUsed;
@@ -853,11 +853,11 @@
853853
** (ignoring double '') or by the end of the string
854854
**
855855
** The cursor of pFrom is left pointing at the first character past
856856
** the end of the token.
857857
**
858
-** pTo will be an ephermeral blob. If pFrom changes, it might alter
858
+** pTo will be an ephemeral blob. If pFrom changes, it might alter
859859
** pTo as well.
860860
*/
861861
int blob_sqltoken(Blob *pFrom, Blob *pTo){
862862
char *aData = pFrom->aData;
863863
int n = pFrom->nUsed;
@@ -881,11 +881,11 @@
881881
return pTo->nUsed;
882882
}
883883
884884
/*
885885
** Extract everything from the current cursor to the end of the blob
886
-** into a new blob. The new blob is an ephemerial reference to the
886
+** into a new blob. The new blob is an ephemeral reference to the
887887
** original blob. The cursor of the original blob is unchanged.
888888
*/
889889
int blob_tail(Blob *pFrom, Blob *pTo){
890890
int iCursor = pFrom->iCursor;
891891
blob_extract(pFrom, pFrom->nUsed-pFrom->iCursor, pTo);
@@ -976,11 +976,11 @@
976976
** Options:
977977
** -y|--side-by-side Show diff of INPUTFILE and output side-by-side
978978
** -W|--width N Width of lines in side-by-side diff
979979
*/
980980
void test_strip_comment_lines_cmd(void){
981
- Blob f, h; /* unitialized */
981
+ Blob f, h; /* uninitialized */
982982
Blob out;
983983
DiffConfig dCfg;
984984
int sbs = 0;
985985
const char *z;
986986
int w = 0;
@@ -1806,11 +1806,11 @@
18061806
** unusual characters as an argument for testing.
18071807
**
18081808
** --compare HEX ASCII Verify that argument ASCII is identical to
18091809
** to decoded HEX.
18101810
**
1811
-** --fuzz N Run N fuzz cases. Each cases is a call
1811
+** --fuzz N Run N fuzz cases. Each case is a call
18121812
** to "fossil test-escaped-arg --compare HEX ARG"
18131813
** where HEX and ARG are the same argument.
18141814
** The argument is chosen at random.
18151815
*/
18161816
void test_escaped_arg_command(void){
18171817
--- src/blob.c
+++ src/blob.c
@@ -782,11 +782,11 @@
782 ** end-of-file.
783 **
784 ** The cursor of pFrom is left pointing at the first byte past the
785 ** \n that terminated the line.
786 **
787 ** pTo will be an ephermeral blob. If pFrom changes, it might alter
788 ** pTo as well.
789 */
790 int blob_line(Blob *pFrom, Blob *pTo){
791 char *aData = pFrom->aData;
792 int n = pFrom->nUsed;
@@ -825,11 +825,11 @@
825 ** whitespace is ignored.
826 **
827 ** The cursor of pFrom is left pointing at the first character past
828 ** the end of the token.
829 **
830 ** pTo will be an ephermeral blob. If pFrom changes, it might alter
831 ** pTo as well.
832 */
833 int blob_token(Blob *pFrom, Blob *pTo){
834 char *aData = pFrom->aData;
835 int n = pFrom->nUsed;
@@ -853,11 +853,11 @@
853 ** (ignoring double '') or by the end of the string
854 **
855 ** The cursor of pFrom is left pointing at the first character past
856 ** the end of the token.
857 **
858 ** pTo will be an ephermeral blob. If pFrom changes, it might alter
859 ** pTo as well.
860 */
861 int blob_sqltoken(Blob *pFrom, Blob *pTo){
862 char *aData = pFrom->aData;
863 int n = pFrom->nUsed;
@@ -881,11 +881,11 @@
881 return pTo->nUsed;
882 }
883
884 /*
885 ** Extract everything from the current cursor to the end of the blob
886 ** into a new blob. The new blob is an ephemerial reference to the
887 ** original blob. The cursor of the original blob is unchanged.
888 */
889 int blob_tail(Blob *pFrom, Blob *pTo){
890 int iCursor = pFrom->iCursor;
891 blob_extract(pFrom, pFrom->nUsed-pFrom->iCursor, pTo);
@@ -976,11 +976,11 @@
976 ** Options:
977 ** -y|--side-by-side Show diff of INPUTFILE and output side-by-side
978 ** -W|--width N Width of lines in side-by-side diff
979 */
980 void test_strip_comment_lines_cmd(void){
981 Blob f, h; /* unitialized */
982 Blob out;
983 DiffConfig dCfg;
984 int sbs = 0;
985 const char *z;
986 int w = 0;
@@ -1806,11 +1806,11 @@
1806 ** unusual characters as an argument for testing.
1807 **
1808 ** --compare HEX ASCII Verify that argument ASCII is identical to
1809 ** to decoded HEX.
1810 **
1811 ** --fuzz N Run N fuzz cases. Each cases is a call
1812 ** to "fossil test-escaped-arg --compare HEX ARG"
1813 ** where HEX and ARG are the same argument.
1814 ** The argument is chosen at random.
1815 */
1816 void test_escaped_arg_command(void){
1817
--- src/blob.c
+++ src/blob.c
@@ -782,11 +782,11 @@
782 ** end-of-file.
783 **
784 ** The cursor of pFrom is left pointing at the first byte past the
785 ** \n that terminated the line.
786 **
787 ** pTo will be an ephemeral blob. If pFrom changes, it might alter
788 ** pTo as well.
789 */
790 int blob_line(Blob *pFrom, Blob *pTo){
791 char *aData = pFrom->aData;
792 int n = pFrom->nUsed;
@@ -825,11 +825,11 @@
825 ** whitespace is ignored.
826 **
827 ** The cursor of pFrom is left pointing at the first character past
828 ** the end of the token.
829 **
830 ** pTo will be an ephemeral blob. If pFrom changes, it might alter
831 ** pTo as well.
832 */
833 int blob_token(Blob *pFrom, Blob *pTo){
834 char *aData = pFrom->aData;
835 int n = pFrom->nUsed;
@@ -853,11 +853,11 @@
853 ** (ignoring double '') or by the end of the string
854 **
855 ** The cursor of pFrom is left pointing at the first character past
856 ** the end of the token.
857 **
858 ** pTo will be an ephemeral blob. If pFrom changes, it might alter
859 ** pTo as well.
860 */
861 int blob_sqltoken(Blob *pFrom, Blob *pTo){
862 char *aData = pFrom->aData;
863 int n = pFrom->nUsed;
@@ -881,11 +881,11 @@
881 return pTo->nUsed;
882 }
883
884 /*
885 ** Extract everything from the current cursor to the end of the blob
886 ** into a new blob. The new blob is an ephemeral reference to the
887 ** original blob. The cursor of the original blob is unchanged.
888 */
889 int blob_tail(Blob *pFrom, Blob *pTo){
890 int iCursor = pFrom->iCursor;
891 blob_extract(pFrom, pFrom->nUsed-pFrom->iCursor, pTo);
@@ -976,11 +976,11 @@
976 ** Options:
977 ** -y|--side-by-side Show diff of INPUTFILE and output side-by-side
978 ** -W|--width N Width of lines in side-by-side diff
979 */
980 void test_strip_comment_lines_cmd(void){
981 Blob f, h; /* uninitialized */
982 Blob out;
983 DiffConfig dCfg;
984 int sbs = 0;
985 const char *z;
986 int w = 0;
@@ -1806,11 +1806,11 @@
1806 ** unusual characters as an argument for testing.
1807 **
1808 ** --compare HEX ASCII Verify that argument ASCII is identical to
1809 ** to decoded HEX.
1810 **
1811 ** --fuzz N Run N fuzz cases. Each case is a call
1812 ** to "fossil test-escaped-arg --compare HEX ARG"
1813 ** where HEX and ARG are the same argument.
1814 ** The argument is chosen at random.
1815 */
1816 void test_escaped_arg_command(void){
1817
+7 -7
--- src/branch.c
+++ src/branch.c
@@ -232,11 +232,11 @@
232232
**
233233
** name Name of the branch
234234
** mtime Time of last check-in on this branch
235235
** isclosed True if the branch is closed
236236
** mergeto Another branch this branch was merged into
237
-** nckin Number of checkins on this branch
237
+** nckin Number of check-ins on this branch
238238
** ckin Hash of the last check-in on this branch
239239
** isprivate True if the branch is private
240240
** bgclr Background color for this branch
241241
*/
242242
static const char createBrlistQuery[] =
@@ -558,11 +558,11 @@
558558
}
559559
560560
/*
561561
** Implementation of (branch close|reopen) subcommands. nStartAtArg is
562562
** the g.argv index to start reading branch/check-in names. The given
563
-** checkins are closed if fClose is true, else their "closed" tag (if
563
+** check-ins are closed if fClose is true, else their "closed" tag (if
564564
** any) is cancelled. Fails fatally on error.
565565
*/
566566
static void branch_cmd_close(int nStartAtArg, int fClose){
567567
int argPos = nStartAtArg; /* g.argv pos with first branch name */
568568
char * zUuid = 0; /* Resolved branch UUID. */
@@ -1116,17 +1116,17 @@
11161116
style_finish_page();
11171117
}
11181118
11191119
/*
11201120
** Generate a multichoice submenu for the few recent active branches. zName is
1121
-** the query parameter used to select the current checkin. zCI is optional and
1122
-** represent the currently selected checkin, so if it is a checkin hash
1121
+** the query parameter used to select the current check-in. zCI is optional and
1122
+** represent the currently selected check-in, so if it is a check-in hash
11231123
** instead of a branch, it can be part of the multichoice menu.
11241124
*/
11251125
void generate_branch_submenu_multichoice(
11261126
const char* zName, /* Query parameter name */
1127
- const char* zCI /* Current checkin */
1127
+ const char* zCI /* Current check-in */
11281128
){
11291129
Stmt q;
11301130
const int brFlags = BRL_ORDERBY_MTIME | BRL_OPEN_ONLY;
11311131
static const char *zBranchMenuList[32*2]; /* 2 per entries */
11321132
const int nLimit = count(zBranchMenuList)/2;
@@ -1134,18 +1134,18 @@
11341134
11351135
if( zName == 0 ) zName = "ci";
11361136
11371137
branch_prepare_list_query(&q, brFlags, 0, nLimit, 0);
11381138
zBranchMenuList[i++] = "";
1139
- zBranchMenuList[i++] = "All Checkins";
1139
+ zBranchMenuList[i++] = "All Check-ins";
11401140
11411141
if( zCI ){
11421142
zCI = fossil_strdup(zCI);
11431143
zBranchMenuList[i++] = zCI;
11441144
zBranchMenuList[i++] = zCI;
11451145
}
1146
- /* If current checkin is not "tip", add it to the list */
1146
+ /* If current check-in is not "tip", add it to the list */
11471147
if( zCI==0 || strcmp(zCI, "tip") ){
11481148
zBranchMenuList[i++] = "tip";
11491149
zBranchMenuList[i++] = "tip";
11501150
}
11511151
while( i/2 < nLimit && db_step(&q)==SQLITE_ROW ){
11521152
--- src/branch.c
+++ src/branch.c
@@ -232,11 +232,11 @@
232 **
233 ** name Name of the branch
234 ** mtime Time of last check-in on this branch
235 ** isclosed True if the branch is closed
236 ** mergeto Another branch this branch was merged into
237 ** nckin Number of checkins on this branch
238 ** ckin Hash of the last check-in on this branch
239 ** isprivate True if the branch is private
240 ** bgclr Background color for this branch
241 */
242 static const char createBrlistQuery[] =
@@ -558,11 +558,11 @@
558 }
559
560 /*
561 ** Implementation of (branch close|reopen) subcommands. nStartAtArg is
562 ** the g.argv index to start reading branch/check-in names. The given
563 ** checkins are closed if fClose is true, else their "closed" tag (if
564 ** any) is cancelled. Fails fatally on error.
565 */
566 static void branch_cmd_close(int nStartAtArg, int fClose){
567 int argPos = nStartAtArg; /* g.argv pos with first branch name */
568 char * zUuid = 0; /* Resolved branch UUID. */
@@ -1116,17 +1116,17 @@
1116 style_finish_page();
1117 }
1118
1119 /*
1120 ** Generate a multichoice submenu for the few recent active branches. zName is
1121 ** the query parameter used to select the current checkin. zCI is optional and
1122 ** represent the currently selected checkin, so if it is a checkin hash
1123 ** instead of a branch, it can be part of the multichoice menu.
1124 */
1125 void generate_branch_submenu_multichoice(
1126 const char* zName, /* Query parameter name */
1127 const char* zCI /* Current checkin */
1128 ){
1129 Stmt q;
1130 const int brFlags = BRL_ORDERBY_MTIME | BRL_OPEN_ONLY;
1131 static const char *zBranchMenuList[32*2]; /* 2 per entries */
1132 const int nLimit = count(zBranchMenuList)/2;
@@ -1134,18 +1134,18 @@
1134
1135 if( zName == 0 ) zName = "ci";
1136
1137 branch_prepare_list_query(&q, brFlags, 0, nLimit, 0);
1138 zBranchMenuList[i++] = "";
1139 zBranchMenuList[i++] = "All Checkins";
1140
1141 if( zCI ){
1142 zCI = fossil_strdup(zCI);
1143 zBranchMenuList[i++] = zCI;
1144 zBranchMenuList[i++] = zCI;
1145 }
1146 /* If current checkin is not "tip", add it to the list */
1147 if( zCI==0 || strcmp(zCI, "tip") ){
1148 zBranchMenuList[i++] = "tip";
1149 zBranchMenuList[i++] = "tip";
1150 }
1151 while( i/2 < nLimit && db_step(&q)==SQLITE_ROW ){
1152
--- src/branch.c
+++ src/branch.c
@@ -232,11 +232,11 @@
232 **
233 ** name Name of the branch
234 ** mtime Time of last check-in on this branch
235 ** isclosed True if the branch is closed
236 ** mergeto Another branch this branch was merged into
237 ** nckin Number of check-ins on this branch
238 ** ckin Hash of the last check-in on this branch
239 ** isprivate True if the branch is private
240 ** bgclr Background color for this branch
241 */
242 static const char createBrlistQuery[] =
@@ -558,11 +558,11 @@
558 }
559
560 /*
561 ** Implementation of (branch close|reopen) subcommands. nStartAtArg is
562 ** the g.argv index to start reading branch/check-in names. The given
563 ** check-ins are closed if fClose is true, else their "closed" tag (if
564 ** any) is cancelled. Fails fatally on error.
565 */
566 static void branch_cmd_close(int nStartAtArg, int fClose){
567 int argPos = nStartAtArg; /* g.argv pos with first branch name */
568 char * zUuid = 0; /* Resolved branch UUID. */
@@ -1116,17 +1116,17 @@
1116 style_finish_page();
1117 }
1118
1119 /*
1120 ** Generate a multichoice submenu for the few recent active branches. zName is
1121 ** the query parameter used to select the current check-in. zCI is optional and
1122 ** represent the currently selected check-in, so if it is a check-in hash
1123 ** instead of a branch, it can be part of the multichoice menu.
1124 */
1125 void generate_branch_submenu_multichoice(
1126 const char* zName, /* Query parameter name */
1127 const char* zCI /* Current check-in */
1128 ){
1129 Stmt q;
1130 const int brFlags = BRL_ORDERBY_MTIME | BRL_OPEN_ONLY;
1131 static const char *zBranchMenuList[32*2]; /* 2 per entries */
1132 const int nLimit = count(zBranchMenuList)/2;
@@ -1134,18 +1134,18 @@
1134
1135 if( zName == 0 ) zName = "ci";
1136
1137 branch_prepare_list_query(&q, brFlags, 0, nLimit, 0);
1138 zBranchMenuList[i++] = "";
1139 zBranchMenuList[i++] = "All Check-ins";
1140
1141 if( zCI ){
1142 zCI = fossil_strdup(zCI);
1143 zBranchMenuList[i++] = zCI;
1144 zBranchMenuList[i++] = zCI;
1145 }
1146 /* If current check-in is not "tip", add it to the list */
1147 if( zCI==0 || strcmp(zCI, "tip") ){
1148 zBranchMenuList[i++] = "tip";
1149 zBranchMenuList[i++] = "tip";
1150 }
1151 while( i/2 < nLimit && db_step(&q)==SQLITE_ROW ){
1152
+1 -1
--- src/builtin.c
+++ src/builtin.c
@@ -735,11 +735,11 @@
735735
} fjs[] = {
736736
/* This list ordering isn't strictly important. */
737737
{"confirmer", 0, 0},
738738
{"copybutton", 0, "dom\0"},
739739
{"diff", 0, "dom\0fetch\0storage\0"
740
- /* maintenance note: "diff" needs "storage" for storing the the
740
+ /* maintenance note: "diff" needs "storage" for storing the
741741
** sbs-sync-scroll toggle. */},
742742
{"dom", 0, 0},
743743
{"fetch", 0, 0},
744744
{"numbered-lines", 0, "popupwidget\0copybutton\0"},
745745
{"pikchr", 0, "dom\0"},
746746
--- src/builtin.c
+++ src/builtin.c
@@ -735,11 +735,11 @@
735 } fjs[] = {
736 /* This list ordering isn't strictly important. */
737 {"confirmer", 0, 0},
738 {"copybutton", 0, "dom\0"},
739 {"diff", 0, "dom\0fetch\0storage\0"
740 /* maintenance note: "diff" needs "storage" for storing the the
741 ** sbs-sync-scroll toggle. */},
742 {"dom", 0, 0},
743 {"fetch", 0, 0},
744 {"numbered-lines", 0, "popupwidget\0copybutton\0"},
745 {"pikchr", 0, "dom\0"},
746
--- src/builtin.c
+++ src/builtin.c
@@ -735,11 +735,11 @@
735 } fjs[] = {
736 /* This list ordering isn't strictly important. */
737 {"confirmer", 0, 0},
738 {"copybutton", 0, "dom\0"},
739 {"diff", 0, "dom\0fetch\0storage\0"
740 /* maintenance note: "diff" needs "storage" for storing the
741 ** sbs-sync-scroll toggle. */},
742 {"dom", 0, 0},
743 {"fetch", 0, 0},
744 {"numbered-lines", 0, "popupwidget\0copybutton\0"},
745 {"pikchr", 0, "dom\0"},
746
+2 -2
--- src/cache.c
+++ src/cache.c
@@ -70,11 +70,11 @@
7070
"CREATE TABLE IF NOT EXISTS blob(id INTEGER PRIMARY KEY, data BLOB);"
7171
"CREATE TABLE IF NOT EXISTS cache("
7272
"key TEXT PRIMARY KEY," /* Key used to access the cache */
7373
"id INT REFERENCES blob," /* The cache content */
7474
"sz INT," /* Size of content in bytes */
75
- "tm INT," /* Last access time (unix timestampe) */
75
+ "tm INT," /* Last access time (unix timestamp) */
7676
"nref INT" /* Number of uses */
7777
");"
7878
"CREATE TRIGGER IF NOT EXISTS cacheDel AFTER DELETE ON cache BEGIN"
7979
" DELETE FROM blob WHERE id=OLD.id;"
8080
"END;",
@@ -437,11 +437,11 @@
437437
@ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br>
438438
@ size: %,lld(sqlite3_column_int64(pStmt,1)),
439439
@ hit-count: %d(sqlite3_column_int(pStmt,2)),
440440
@ last-access: %s(sqlite3_column_text(pStmt,3))Z \
441441
if( zHash ){
442
- @ &rarr; %z(href("%R/timeline?c=%S",zHash))checkin info</a>\
442
+ @ &rarr; %z(href("%R/timeline?c=%S",zHash))check-in info</a>\
443443
fossil_free(zHash);
444444
}
445445
@ </p></li>
446446
nEntry++;
447447
}
448448
--- src/cache.c
+++ src/cache.c
@@ -70,11 +70,11 @@
70 "CREATE TABLE IF NOT EXISTS blob(id INTEGER PRIMARY KEY, data BLOB);"
71 "CREATE TABLE IF NOT EXISTS cache("
72 "key TEXT PRIMARY KEY," /* Key used to access the cache */
73 "id INT REFERENCES blob," /* The cache content */
74 "sz INT," /* Size of content in bytes */
75 "tm INT," /* Last access time (unix timestampe) */
76 "nref INT" /* Number of uses */
77 ");"
78 "CREATE TRIGGER IF NOT EXISTS cacheDel AFTER DELETE ON cache BEGIN"
79 " DELETE FROM blob WHERE id=OLD.id;"
80 "END;",
@@ -437,11 +437,11 @@
437 @ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br>
438 @ size: %,lld(sqlite3_column_int64(pStmt,1)),
439 @ hit-count: %d(sqlite3_column_int(pStmt,2)),
440 @ last-access: %s(sqlite3_column_text(pStmt,3))Z \
441 if( zHash ){
442 @ &rarr; %z(href("%R/timeline?c=%S",zHash))checkin info</a>\
443 fossil_free(zHash);
444 }
445 @ </p></li>
446 nEntry++;
447 }
448
--- src/cache.c
+++ src/cache.c
@@ -70,11 +70,11 @@
70 "CREATE TABLE IF NOT EXISTS blob(id INTEGER PRIMARY KEY, data BLOB);"
71 "CREATE TABLE IF NOT EXISTS cache("
72 "key TEXT PRIMARY KEY," /* Key used to access the cache */
73 "id INT REFERENCES blob," /* The cache content */
74 "sz INT," /* Size of content in bytes */
75 "tm INT," /* Last access time (unix timestamp) */
76 "nref INT" /* Number of uses */
77 ");"
78 "CREATE TRIGGER IF NOT EXISTS cacheDel AFTER DELETE ON cache BEGIN"
79 " DELETE FROM blob WHERE id=OLD.id;"
80 "END;",
@@ -437,11 +437,11 @@
437 @ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br>
438 @ size: %,lld(sqlite3_column_int64(pStmt,1)),
439 @ hit-count: %d(sqlite3_column_int(pStmt,2)),
440 @ last-access: %s(sqlite3_column_text(pStmt,3))Z \
441 if( zHash ){
442 @ &rarr; %z(href("%R/timeline?c=%S",zHash))check-in info</a>\
443 fossil_free(zHash);
444 }
445 @ </p></li>
446 nEntry++;
447 }
448
+3 -3
--- src/captcha.c
+++ src/captcha.c
@@ -509,11 +509,11 @@
509509
sqlite3_randomness(sizeof(x), &x);
510510
x &= 0x7fffffff;
511511
return x;
512512
}
513513
514
-/* The SQL that will rotate the the captcha-secret. */
514
+/* The SQL that will rotate the captcha-secret. */
515515
static const char captchaSecretRotationSql[] =
516516
@ SAVEPOINT rotate;
517517
@ DELETE FROM config
518518
@ WHERE name GLOB 'captcha-secret-*'
519519
@ AND mtime<unixepoch('now','-6 hours');
@@ -529,11 +529,11 @@
529529
;
530530
531531
532532
/*
533533
** Create a new random captcha-secret. Rotate the old one into
534
-** the captcha-secret-N backups. Purge captch-secret-N backups
534
+** the captcha-secret-N backups. Purge captcha-secret-N backups
535535
** older than 6 hours.
536536
**
537537
** Do this on the current database and in all other databases of
538538
** the same login group.
539539
*/
@@ -559,11 +559,11 @@
559559
fossil_free(zSql);
560560
}
561561
562562
/*
563563
** Return the value of the N-th more recent captcha-secret. The
564
-** most recent captch-secret is 0. Others are prior captcha-secrets
564
+** most recent captcha-secret is 0. Others are prior captcha-secrets
565565
** that have expired, but are retained for a limited period of time
566566
** so that pending anonymous login cookies and/or captcha dialogs
567567
** don't malfunction when the captcha-secret changes.
568568
**
569569
** Clients should start by using the 0-th captcha-secret. Only if
570570
--- src/captcha.c
+++ src/captcha.c
@@ -509,11 +509,11 @@
509 sqlite3_randomness(sizeof(x), &x);
510 x &= 0x7fffffff;
511 return x;
512 }
513
514 /* The SQL that will rotate the the captcha-secret. */
515 static const char captchaSecretRotationSql[] =
516 @ SAVEPOINT rotate;
517 @ DELETE FROM config
518 @ WHERE name GLOB 'captcha-secret-*'
519 @ AND mtime<unixepoch('now','-6 hours');
@@ -529,11 +529,11 @@
529 ;
530
531
532 /*
533 ** Create a new random captcha-secret. Rotate the old one into
534 ** the captcha-secret-N backups. Purge captch-secret-N backups
535 ** older than 6 hours.
536 **
537 ** Do this on the current database and in all other databases of
538 ** the same login group.
539 */
@@ -559,11 +559,11 @@
559 fossil_free(zSql);
560 }
561
562 /*
563 ** Return the value of the N-th more recent captcha-secret. The
564 ** most recent captch-secret is 0. Others are prior captcha-secrets
565 ** that have expired, but are retained for a limited period of time
566 ** so that pending anonymous login cookies and/or captcha dialogs
567 ** don't malfunction when the captcha-secret changes.
568 **
569 ** Clients should start by using the 0-th captcha-secret. Only if
570
--- src/captcha.c
+++ src/captcha.c
@@ -509,11 +509,11 @@
509 sqlite3_randomness(sizeof(x), &x);
510 x &= 0x7fffffff;
511 return x;
512 }
513
514 /* The SQL that will rotate the captcha-secret. */
515 static const char captchaSecretRotationSql[] =
516 @ SAVEPOINT rotate;
517 @ DELETE FROM config
518 @ WHERE name GLOB 'captcha-secret-*'
519 @ AND mtime<unixepoch('now','-6 hours');
@@ -529,11 +529,11 @@
529 ;
530
531
532 /*
533 ** Create a new random captcha-secret. Rotate the old one into
534 ** the captcha-secret-N backups. Purge captcha-secret-N backups
535 ** older than 6 hours.
536 **
537 ** Do this on the current database and in all other databases of
538 ** the same login group.
539 */
@@ -559,11 +559,11 @@
559 fossil_free(zSql);
560 }
561
562 /*
563 ** Return the value of the N-th more recent captcha-secret. The
564 ** most recent captcha-secret is 0. Others are prior captcha-secrets
565 ** that have expired, but are retained for a limited period of time
566 ** so that pending anonymous login cookies and/or captcha dialogs
567 ** don't malfunction when the captcha-secret changes.
568 **
569 ** Clients should start by using the 0-th captcha-secret. Only if
570
+10 -9
--- src/cgi.c
+++ src/cgi.c
@@ -13,11 +13,11 @@
1313
** [email protected]
1414
** http://www.hwaci.com/drh/
1515
**
1616
*******************************************************************************
1717
**
18
-** This file began as a set of C functions and procedures used intepret
18
+** This file began as a set of C functions and procedures used to interpret
1919
** CGI environment variables for Fossil web pages that were invoked by
2020
** CGI. That's where the file name comes from. But over the years it
2121
** has grown to incorporate lots of related functionality, including:
2222
**
2323
** * Interpreting CGI environment variables when Fossil is run as
@@ -146,11 +146,11 @@
146146
**
147147
** Do not confuse the content header with the HTTP header. The content header
148148
** is generated by downstream code. The HTTP header is generated by the
149149
** cgi_reply() routine below.
150150
**
151
-** The content header and contenty body are *approximately* the <head>
151
+** The content header and content body are *approximately* the <head>
152152
** element and the <body> elements for HTML replies. However this is only
153153
** approximate. The content header also includes parts of <body> that
154154
** show the banner and menu bar at the top of each page. Also note that
155155
** not all replies are HTML, but there can still be separate header and
156156
** body sections of the content.
@@ -942,22 +942,23 @@
942942
}
943943
return cnt;
944944
}
945945
946946
/*
947
-** Add an environment varaible value to the parameter set. The zName
948
-** portion is fixed but a copy is be made of zValue.
947
+** Add an environment variable value to the parameter set. The zName
948
+** portion is fixed but a copy is made of zValue.
949949
*/
950950
void cgi_setenv(const char *zName, const char *zValue){
951951
cgi_set_parameter_nocopy(zName, fossil_strdup(zValue), 0);
952952
}
953953
954954
/*
955955
** Returns true if NUL-terminated z contains any non-NUL
956956
** control characters (<0x20, 32d).
957957
*/
958
-static int contains_ctrl(const char *z){
958
+static int contains_ctrl(const char *zIn){
959
+ const unsigned char *z = (const unsigned char*)zIn;
959960
assert(z);
960961
for( ; *z>=0x20; ++z ){}
961962
return 0!=*z;
962963
}
963964
@@ -967,11 +968,11 @@
967968
** Each parameter is of the form NAME=VALUE. Both the NAME and the
968969
** VALUE may be url-encoded ("+" for space, "%HH" for other special
969970
** characters). But this routine assumes that NAME contains no
970971
** special character and therefore does not decode it.
971972
**
972
-** If NAME begins with another other than a lower-case letter then
973
+** If NAME begins with something other than a lower-case letter then
973974
** the entire NAME=VALUE term is ignored. Hence:
974975
**
975976
** * cookies and query parameters that have uppercase names
976977
** are ignored.
977978
**
@@ -1681,11 +1682,11 @@
16811682
** be extended in the future.
16821683
**
16831684
** Checks are omitted for any logged-in user.
16841685
**
16851686
** This is the primary defense against attack. Fossil should easily be
1686
-** proof against SQL injection and XSS attacks even without without this
1687
+** proof against SQL injection and XSS attacks even without this
16871688
** routine. Rather, this is an attempt to avoid denial-of-service caused
16881689
** by persistent spiders that hammer the server with dozens or hundreds of
16891690
** probes per seconds as they look for vulnerabilities. In other
16901691
** words, this is an effort to reduce the CPU load imposed by malicious
16911692
** spiders. Though those routine might help make attacks harder, it is
@@ -2553,11 +2554,11 @@
25532554
cgi_set_parameter(zHdr, zHdr+n+1);
25542555
zHdr += m+1;
25552556
nHdr -= m+1;
25562557
}
25572558
fossil_free(zToFree);
2558
- fgetc(g.httpIn); /* Read past the "," separating header from content */
2559
+ (void)fgetc(g.httpIn); /* Read past the "," separating header from content */
25592560
cgi_init();
25602561
}
25612562
25622563
#if INTERFACE
25632564
/*
@@ -2829,11 +2830,11 @@
28292830
if( fossil_system(zBrowser)<0 ){
28302831
fossil_warning("cannot start browser: %s\n", zBrowser);
28312832
}
28322833
}
28332834
2834
- /* What for incomming requests. For each request, fork() a child process
2835
+ /* What for incoming requests. For each request, fork() a child process
28352836
** to deal with that request. The child process returns. The parent
28362837
** keeps on listening and never returns.
28372838
*/
28382839
while( 1 ){
28392840
#if FOSSIL_MAX_CONNECTIONS>0
28402841
--- src/cgi.c
+++ src/cgi.c
@@ -13,11 +13,11 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file began as a set of C functions and procedures used intepret
19 ** CGI environment variables for Fossil web pages that were invoked by
20 ** CGI. That's where the file name comes from. But over the years it
21 ** has grown to incorporate lots of related functionality, including:
22 **
23 ** * Interpreting CGI environment variables when Fossil is run as
@@ -146,11 +146,11 @@
146 **
147 ** Do not confuse the content header with the HTTP header. The content header
148 ** is generated by downstream code. The HTTP header is generated by the
149 ** cgi_reply() routine below.
150 **
151 ** The content header and contenty body are *approximately* the <head>
152 ** element and the <body> elements for HTML replies. However this is only
153 ** approximate. The content header also includes parts of <body> that
154 ** show the banner and menu bar at the top of each page. Also note that
155 ** not all replies are HTML, but there can still be separate header and
156 ** body sections of the content.
@@ -942,22 +942,23 @@
942 }
943 return cnt;
944 }
945
946 /*
947 ** Add an environment varaible value to the parameter set. The zName
948 ** portion is fixed but a copy is be made of zValue.
949 */
950 void cgi_setenv(const char *zName, const char *zValue){
951 cgi_set_parameter_nocopy(zName, fossil_strdup(zValue), 0);
952 }
953
954 /*
955 ** Returns true if NUL-terminated z contains any non-NUL
956 ** control characters (<0x20, 32d).
957 */
958 static int contains_ctrl(const char *z){
 
959 assert(z);
960 for( ; *z>=0x20; ++z ){}
961 return 0!=*z;
962 }
963
@@ -967,11 +968,11 @@
967 ** Each parameter is of the form NAME=VALUE. Both the NAME and the
968 ** VALUE may be url-encoded ("+" for space, "%HH" for other special
969 ** characters). But this routine assumes that NAME contains no
970 ** special character and therefore does not decode it.
971 **
972 ** If NAME begins with another other than a lower-case letter then
973 ** the entire NAME=VALUE term is ignored. Hence:
974 **
975 ** * cookies and query parameters that have uppercase names
976 ** are ignored.
977 **
@@ -1681,11 +1682,11 @@
1681 ** be extended in the future.
1682 **
1683 ** Checks are omitted for any logged-in user.
1684 **
1685 ** This is the primary defense against attack. Fossil should easily be
1686 ** proof against SQL injection and XSS attacks even without without this
1687 ** routine. Rather, this is an attempt to avoid denial-of-service caused
1688 ** by persistent spiders that hammer the server with dozens or hundreds of
1689 ** probes per seconds as they look for vulnerabilities. In other
1690 ** words, this is an effort to reduce the CPU load imposed by malicious
1691 ** spiders. Though those routine might help make attacks harder, it is
@@ -2553,11 +2554,11 @@
2553 cgi_set_parameter(zHdr, zHdr+n+1);
2554 zHdr += m+1;
2555 nHdr -= m+1;
2556 }
2557 fossil_free(zToFree);
2558 fgetc(g.httpIn); /* Read past the "," separating header from content */
2559 cgi_init();
2560 }
2561
2562 #if INTERFACE
2563 /*
@@ -2829,11 +2830,11 @@
2829 if( fossil_system(zBrowser)<0 ){
2830 fossil_warning("cannot start browser: %s\n", zBrowser);
2831 }
2832 }
2833
2834 /* What for incomming requests. For each request, fork() a child process
2835 ** to deal with that request. The child process returns. The parent
2836 ** keeps on listening and never returns.
2837 */
2838 while( 1 ){
2839 #if FOSSIL_MAX_CONNECTIONS>0
2840
--- src/cgi.c
+++ src/cgi.c
@@ -13,11 +13,11 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file began as a set of C functions and procedures used to interpret
19 ** CGI environment variables for Fossil web pages that were invoked by
20 ** CGI. That's where the file name comes from. But over the years it
21 ** has grown to incorporate lots of related functionality, including:
22 **
23 ** * Interpreting CGI environment variables when Fossil is run as
@@ -146,11 +146,11 @@
146 **
147 ** Do not confuse the content header with the HTTP header. The content header
148 ** is generated by downstream code. The HTTP header is generated by the
149 ** cgi_reply() routine below.
150 **
151 ** The content header and content body are *approximately* the <head>
152 ** element and the <body> elements for HTML replies. However this is only
153 ** approximate. The content header also includes parts of <body> that
154 ** show the banner and menu bar at the top of each page. Also note that
155 ** not all replies are HTML, but there can still be separate header and
156 ** body sections of the content.
@@ -942,22 +942,23 @@
942 }
943 return cnt;
944 }
945
946 /*
947 ** Add an environment variable value to the parameter set. The zName
948 ** portion is fixed but a copy is made of zValue.
949 */
950 void cgi_setenv(const char *zName, const char *zValue){
951 cgi_set_parameter_nocopy(zName, fossil_strdup(zValue), 0);
952 }
953
954 /*
955 ** Returns true if NUL-terminated z contains any non-NUL
956 ** control characters (<0x20, 32d).
957 */
958 static int contains_ctrl(const char *zIn){
959 const unsigned char *z = (const unsigned char*)zIn;
960 assert(z);
961 for( ; *z>=0x20; ++z ){}
962 return 0!=*z;
963 }
964
@@ -967,11 +968,11 @@
968 ** Each parameter is of the form NAME=VALUE. Both the NAME and the
969 ** VALUE may be url-encoded ("+" for space, "%HH" for other special
970 ** characters). But this routine assumes that NAME contains no
971 ** special character and therefore does not decode it.
972 **
973 ** If NAME begins with something other than a lower-case letter then
974 ** the entire NAME=VALUE term is ignored. Hence:
975 **
976 ** * cookies and query parameters that have uppercase names
977 ** are ignored.
978 **
@@ -1681,11 +1682,11 @@
1682 ** be extended in the future.
1683 **
1684 ** Checks are omitted for any logged-in user.
1685 **
1686 ** This is the primary defense against attack. Fossil should easily be
1687 ** proof against SQL injection and XSS attacks even without this
1688 ** routine. Rather, this is an attempt to avoid denial-of-service caused
1689 ** by persistent spiders that hammer the server with dozens or hundreds of
1690 ** probes per seconds as they look for vulnerabilities. In other
1691 ** words, this is an effort to reduce the CPU load imposed by malicious
1692 ** spiders. Though those routine might help make attacks harder, it is
@@ -2553,11 +2554,11 @@
2554 cgi_set_parameter(zHdr, zHdr+n+1);
2555 zHdr += m+1;
2556 nHdr -= m+1;
2557 }
2558 fossil_free(zToFree);
2559 (void)fgetc(g.httpIn); /* Read past the "," separating header from content */
2560 cgi_init();
2561 }
2562
2563 #if INTERFACE
2564 /*
@@ -2829,11 +2830,11 @@
2830 if( fossil_system(zBrowser)<0 ){
2831 fossil_warning("cannot start browser: %s\n", zBrowser);
2832 }
2833 }
2834
2835 /* What for incoming requests. For each request, fork() a child process
2836 ** to deal with that request. The child process returns. The parent
2837 ** keeps on listening and never returns.
2838 */
2839 while( 1 ){
2840 #if FOSSIL_MAX_CONNECTIONS>0
2841
+26 -2
--- src/chat.c
+++ src/chat.c
@@ -238,10 +238,15 @@
238238
@ </div>
239239
@ <div id='chat-messages-wrapper' class='chat-view'>
240240
/* New chat messages get inserted immediately after this element */
241241
@ <span id='message-inject-point'></span>
242242
@ </div>
243
+ @ <div id='chat-zoom' class='hidden chat-view'>
244
+ @ <div id='chat-zoom-content'></div>
245
+ @ <div class='button-bar'><button class='action-close'>Close Zoom</button></div>
246
+ @ </div>
247
+ @ <span id='chat-zoom-marker' class='hidden'><!-- placeholder marker for zoomed msg --></span>
243248
fossil_free(zProjectName);
244249
fossil_free(zInputPlaceholder0);
245250
builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch",
246251
"pikchr", "confirmer", "copybutton",
247252
NULL);
@@ -291,10 +296,11 @@
291296
** chatfts1 table and recreate/reindex it. If bForce is 0, it will
292297
** only index the chat content if the chatfts1 table does not already
293298
** exist.
294299
*/
295300
void chat_rebuild_index(int bForce){
301
+ if( !db_table_exists("repository","chat") ) return;
296302
if( bForce!=0 ){
297303
db_multi_exec("DROP TABLE IF EXISTS chatfts1");
298304
}
299305
if( bForce!=0 || !db_table_exists("repository", "chatfts1") ){
300306
const int tokType = search_tokenizer_type(0);
@@ -317,11 +323,11 @@
317323
/*
318324
** Make sure the repository data tables used by chat exist. Create
319325
** them if they do not. Set up TEMP triggers (if needed) to update the
320326
** chatfts1 table as the chat table is updated.
321327
*/
322
-static void chat_create_tables(void){
328
+void chat_create_tables(void){
323329
if( !db_table_exists("repository","chat") ){
324330
db_multi_exec(zChatSchema1/*works-like:""*/);
325331
}else if( !db_table_has_column("repository","chat","lmtime") ){
326332
if( !db_table_has_column("repository","chat","mdel") ){
327333
db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT");
@@ -437,11 +443,11 @@
437443
const char *zUserName;
438444
login_check_credentials();
439445
if( 0==g.perm.Chat ) {
440446
chat_emit_permissions_error(0);
441447
return;
442
- }else if( 0==cgi_csrf_safe(1) ){
448
+ }else if( g.eAuthMethod==AUTH_COOKIE && 0==cgi_csrf_safe(1) ){
443449
chat_emit_csrf_error();
444450
return;
445451
}
446452
zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
447453
nByte = atoi(PD("file:bytes","0"));
@@ -1240,10 +1246,19 @@
12401246
**
12411247
** > fossil chat url
12421248
**
12431249
** Show the default URL used to access the chat server.
12441250
**
1251
+** > fossil chat purge
1252
+**
1253
+** Remove chat messages that are older than chat-keep-days and
1254
+** which are not one of the most recent chat-keep-count message.
1255
+**
1256
+** > fossil chat reindex
1257
+**
1258
+** Rebuild the full-text search index for chat
1259
+**
12451260
** Additional subcommands may be added in the future.
12461261
*/
12471262
void chat_command(void){
12481263
const char *zUrl = find_option("remote",0,1);
12491264
int urlFlags = 0;
@@ -1446,9 +1461,18 @@
14461461
);
14471462
}
14481463
}else if( strcmp(g.argv[2],"url")==0 ){
14491464
/* Show the URL to access chat. */
14501465
fossil_print("%s/chat\n", zUrl);
1466
+ }else if( strcmp(g.argv[2],"purge")==0 ){
1467
+ /* clear out expired chat messages: chat messages that are older then
1468
+ ** chat-keep-days and that are not one or the most recent chat-keep-count
1469
+ ** messages. */
1470
+ chat_create_tables();
1471
+ chat_purge();
1472
+ }else if( strcmp(g.argv[2],"reindex")==0 ){
1473
+ /* Rebuild the FTS5 index on chat content */
1474
+ chat_rebuild_index(1);
14511475
}else{
14521476
fossil_fatal("no such subcommand \"%s\". Use --help for help", g.argv[2]);
14531477
}
14541478
}
14551479
--- src/chat.c
+++ src/chat.c
@@ -238,10 +238,15 @@
238 @ </div>
239 @ <div id='chat-messages-wrapper' class='chat-view'>
240 /* New chat messages get inserted immediately after this element */
241 @ <span id='message-inject-point'></span>
242 @ </div>
 
 
 
 
 
243 fossil_free(zProjectName);
244 fossil_free(zInputPlaceholder0);
245 builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch",
246 "pikchr", "confirmer", "copybutton",
247 NULL);
@@ -291,10 +296,11 @@
291 ** chatfts1 table and recreate/reindex it. If bForce is 0, it will
292 ** only index the chat content if the chatfts1 table does not already
293 ** exist.
294 */
295 void chat_rebuild_index(int bForce){
 
296 if( bForce!=0 ){
297 db_multi_exec("DROP TABLE IF EXISTS chatfts1");
298 }
299 if( bForce!=0 || !db_table_exists("repository", "chatfts1") ){
300 const int tokType = search_tokenizer_type(0);
@@ -317,11 +323,11 @@
317 /*
318 ** Make sure the repository data tables used by chat exist. Create
319 ** them if they do not. Set up TEMP triggers (if needed) to update the
320 ** chatfts1 table as the chat table is updated.
321 */
322 static void chat_create_tables(void){
323 if( !db_table_exists("repository","chat") ){
324 db_multi_exec(zChatSchema1/*works-like:""*/);
325 }else if( !db_table_has_column("repository","chat","lmtime") ){
326 if( !db_table_has_column("repository","chat","mdel") ){
327 db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT");
@@ -437,11 +443,11 @@
437 const char *zUserName;
438 login_check_credentials();
439 if( 0==g.perm.Chat ) {
440 chat_emit_permissions_error(0);
441 return;
442 }else if( 0==cgi_csrf_safe(1) ){
443 chat_emit_csrf_error();
444 return;
445 }
446 zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
447 nByte = atoi(PD("file:bytes","0"));
@@ -1240,10 +1246,19 @@
1240 **
1241 ** > fossil chat url
1242 **
1243 ** Show the default URL used to access the chat server.
1244 **
 
 
 
 
 
 
 
 
 
1245 ** Additional subcommands may be added in the future.
1246 */
1247 void chat_command(void){
1248 const char *zUrl = find_option("remote",0,1);
1249 int urlFlags = 0;
@@ -1446,9 +1461,18 @@
1446 );
1447 }
1448 }else if( strcmp(g.argv[2],"url")==0 ){
1449 /* Show the URL to access chat. */
1450 fossil_print("%s/chat\n", zUrl);
 
 
 
 
 
 
 
 
 
1451 }else{
1452 fossil_fatal("no such subcommand \"%s\". Use --help for help", g.argv[2]);
1453 }
1454 }
1455
--- src/chat.c
+++ src/chat.c
@@ -238,10 +238,15 @@
238 @ </div>
239 @ <div id='chat-messages-wrapper' class='chat-view'>
240 /* New chat messages get inserted immediately after this element */
241 @ <span id='message-inject-point'></span>
242 @ </div>
243 @ <div id='chat-zoom' class='hidden chat-view'>
244 @ <div id='chat-zoom-content'></div>
245 @ <div class='button-bar'><button class='action-close'>Close Zoom</button></div>
246 @ </div>
247 @ <span id='chat-zoom-marker' class='hidden'><!-- placeholder marker for zoomed msg --></span>
248 fossil_free(zProjectName);
249 fossil_free(zInputPlaceholder0);
250 builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch",
251 "pikchr", "confirmer", "copybutton",
252 NULL);
@@ -291,10 +296,11 @@
296 ** chatfts1 table and recreate/reindex it. If bForce is 0, it will
297 ** only index the chat content if the chatfts1 table does not already
298 ** exist.
299 */
300 void chat_rebuild_index(int bForce){
301 if( !db_table_exists("repository","chat") ) return;
302 if( bForce!=0 ){
303 db_multi_exec("DROP TABLE IF EXISTS chatfts1");
304 }
305 if( bForce!=0 || !db_table_exists("repository", "chatfts1") ){
306 const int tokType = search_tokenizer_type(0);
@@ -317,11 +323,11 @@
323 /*
324 ** Make sure the repository data tables used by chat exist. Create
325 ** them if they do not. Set up TEMP triggers (if needed) to update the
326 ** chatfts1 table as the chat table is updated.
327 */
328 void chat_create_tables(void){
329 if( !db_table_exists("repository","chat") ){
330 db_multi_exec(zChatSchema1/*works-like:""*/);
331 }else if( !db_table_has_column("repository","chat","lmtime") ){
332 if( !db_table_has_column("repository","chat","mdel") ){
333 db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT");
@@ -437,11 +443,11 @@
443 const char *zUserName;
444 login_check_credentials();
445 if( 0==g.perm.Chat ) {
446 chat_emit_permissions_error(0);
447 return;
448 }else if( g.eAuthMethod==AUTH_COOKIE && 0==cgi_csrf_safe(1) ){
449 chat_emit_csrf_error();
450 return;
451 }
452 zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
453 nByte = atoi(PD("file:bytes","0"));
@@ -1240,10 +1246,19 @@
1246 **
1247 ** > fossil chat url
1248 **
1249 ** Show the default URL used to access the chat server.
1250 **
1251 ** > fossil chat purge
1252 **
1253 ** Remove chat messages that are older than chat-keep-days and
1254 ** which are not one of the most recent chat-keep-count message.
1255 **
1256 ** > fossil chat reindex
1257 **
1258 ** Rebuild the full-text search index for chat
1259 **
1260 ** Additional subcommands may be added in the future.
1261 */
1262 void chat_command(void){
1263 const char *zUrl = find_option("remote",0,1);
1264 int urlFlags = 0;
@@ -1446,9 +1461,18 @@
1461 );
1462 }
1463 }else if( strcmp(g.argv[2],"url")==0 ){
1464 /* Show the URL to access chat. */
1465 fossil_print("%s/chat\n", zUrl);
1466 }else if( strcmp(g.argv[2],"purge")==0 ){
1467 /* clear out expired chat messages: chat messages that are older then
1468 ** chat-keep-days and that are not one or the most recent chat-keep-count
1469 ** messages. */
1470 chat_create_tables();
1471 chat_purge();
1472 }else if( strcmp(g.argv[2],"reindex")==0 ){
1473 /* Rebuild the FTS5 index on chat content */
1474 chat_rebuild_index(1);
1475 }else{
1476 fossil_fatal("no such subcommand \"%s\". Use --help for help", g.argv[2]);
1477 }
1478 }
1479
+32 -16
--- src/checkin.c
+++ src/checkin.c
@@ -484,11 +484,11 @@
484484
{"no-merge", C_MERGE }, {"no-classify", C_CLASSIFY },
485485
};
486486
487487
Blob report = BLOB_INITIALIZER;
488488
enum {CHANGES, STATUS} command = *g.argv[1]=='s' ? STATUS : CHANGES;
489
- /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
489
+ /* --sha1sum is an undocumented alias for --hash for backwards compatibility */
490490
int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
491491
int showHdr = command==CHANGES && find_option("header", 0, 0);
492492
int verboseFlag = command==CHANGES && find_option("verbose", "v", 0);
493493
const char *zIgnoreFlag = find_option("ignore", 0, 1);
494494
unsigned scanFlags = 0;
@@ -718,11 +718,12 @@
718718
*/
719719
static void ls_cmd_rev(
720720
const char *zRev, /* Revision string given */
721721
int verboseFlag, /* Verbose flag given */
722722
int showAge, /* Age flag given */
723
- int showHash, /* Show hash flag given */
723
+ int showFileHash, /* Show file hash flag given */
724
+ int showCkinHash, /* Show check-in hash flag given */
724725
int timeOrder, /* Order by time flag given */
725726
int treeFmt /* Show output in the tree format */
726727
){
727728
Stmt q;
728729
char *zOrderBy = "pathname COLLATE nocase";
@@ -762,16 +763,21 @@
762763
if( timeOrder ){
763764
zOrderBy = "mtime DESC";
764765
}
765766
766767
compute_fileage(rid,0);
767
- db_prepare(&q,
768
+ db_prepare(&q,
768769
"SELECT datetime(fileage.mtime, toLocal()), fileage.pathname,\n"
769
- " blob.size, fileage.uuid\n"
770
- " FROM fileage, blob\n"
771
- " WHERE blob.rid=fileage.fid %s\n"
772
- " ORDER BY %s;", blob_sql_text(&where), zOrderBy /*safe-for-%s*/
770
+ " bfh.size, fileage.uuid %s\n"
771
+ " FROM fileage, blob bfh %s\n"
772
+ " WHERE bfh.rid=fileage.fid %s %s\n"
773
+ " ORDER BY %s;",
774
+ showCkinHash ? ", bch.uuid" : "",
775
+ showCkinHash ? ", blob bch" : "",
776
+ showCkinHash ? "\n AND bch.rid=fileage.mid" : "",
777
+ blob_sql_text(&where),
778
+ zOrderBy /*safe-for-%s*/
773779
);
774780
blob_reset(&where);
775781
if( treeFmt ) blob_init(&out, 0, 0);
776782
777783
while( db_step(&q)==SQLITE_ROW ){
@@ -779,13 +785,16 @@
779785
const char *zFile = db_column_text(&q,1);
780786
int size = db_column_int(&q,2);
781787
if( treeFmt ){
782788
blob_appendf(&out, "%s\n", zFile);
783789
}else if( verboseFlag ){
784
- if( showHash ){
785
- const char *zUuid = db_column_text(&q,3);
786
- fossil_print("%s %7d [%S] %s\n", zTime, size, zUuid, zFile);
790
+ if( showFileHash ){
791
+ const char *zUuidF = db_column_text(&q,3);
792
+ fossil_print("%s %7d [%S] %s\n", zTime, size, zUuidF, zFile);
793
+ }else if( showCkinHash ){
794
+ const char *zUuidC = db_column_text(&q,4);
795
+ fossil_print("%s %7d [%S] %s\n", zTime, size, zUuidC, zFile);
787796
}else{
788797
fossil_print("%s %7d %s\n", zTime, size, zFile);
789798
}
790799
}else if( showAge ){
791800
fossil_print("%s %s\n", zTime, zFile);
@@ -818,19 +827,21 @@
818827
** side effect of making -t sort by commit time, not modification time.
819828
**
820829
** The -v option provides extra information about each file. Without -r,
821830
** -v displays the change status, in the manner of the changes command.
822831
** With -r, -v shows the commit time and size of the checked-in files; in
823
-** this combination, it additionally shows file hashes with -h.
832
+** this combination, it additionally shows file hashes with -h, or check-in
833
+** hashes with -H (when both are given, file hashes take precedence).
824834
**
825835
** The -t option changes the sort order. Without -t, files are sorted by
826836
** path and name (case insensitive sort if -r). If neither --age nor -r
827837
** are used, -t sorts by modification time, otherwise by commit time.
828838
**
829839
** Options:
830840
** --age Show when each file was committed
831841
** -h With -v and -r, show file hashes
842
+** -H With -v and -r, show check-in hashes
832843
** --hash With -v, verify file status using hashing
833844
** rather than relying on file sizes and mtimes
834845
** -r VERSION The specific check-in to list
835846
** -R|--repository REPO Extract info from repository REPO
836847
** -t Sort output in time order
@@ -848,11 +859,12 @@
848859
int timeOrder;
849860
char *zOrderBy = "pathname";
850861
Blob where;
851862
int i;
852863
int useHash = 0;
853
- int showHash = 0;
864
+ int showFHash = 0; /* Show file hash */
865
+ int showCHash = 0; /* Show check-in hash */
854866
const char *zName;
855867
const char *zRev;
856868
857869
verboseFlag = find_option("verbose","v", 0)!=0;
858870
if( !verboseFlag ){
@@ -861,21 +873,25 @@
861873
showAge = find_option("age",0,0)!=0;
862874
zRev = find_option("r","r",1);
863875
timeOrder = find_option("t","t",0)!=0;
864876
if( verboseFlag ){
865877
useHash = find_option("hash",0,0)!=0;
866
- showHash = find_option("h","h",0)!=0;
878
+ showFHash = find_option("h","h",0)!=0;
879
+ showCHash = find_option("H","H",0)!=0;
880
+ if( showFHash ){
881
+ showCHash = 0; /* file hashes take precedence */
882
+ }
867883
}
868884
treeFmt = find_option("tree",0,0)!=0;
869885
if( treeFmt ){
870886
if( zRev==0 ) zRev = "current";
871887
}
872888
873889
if( zRev!=0 ){
874890
db_find_and_open_repository(0, 0);
875891
verify_all_options();
876
- ls_cmd_rev(zRev,verboseFlag,showAge,showHash,timeOrder,treeFmt);
892
+ ls_cmd_rev(zRev,verboseFlag,showAge,showFHash,showCHash,timeOrder,treeFmt);
877893
return;
878894
}else if( find_option("R",0,1)!=0 ){
879895
fossil_fatal("the -r is required in addition to -R");
880896
}
881897
@@ -994,11 +1010,11 @@
9941010
9951011
zRev = find_option("r","r",1);
9961012
if( zRev==0 ) zRev = "current";
9971013
db_find_and_open_repository(0, 0);
9981014
verify_all_options();
999
- ls_cmd_rev(zRev,0,0,0,0,1);
1015
+ ls_cmd_rev(zRev,0,0,0,0,0,1);
10001016
}
10011017
10021018
/*
10031019
** COMMAND: extras
10041020
**
@@ -2546,11 +2562,11 @@
25462562
char *zNewBranch = 0; /* The branch name after update */
25472563
int ckComFlgs; /* Flags passed to verify_comment() */
25482564
25492565
memset(&sCiInfo, 0, sizeof(sCiInfo));
25502566
url_proxy_options();
2551
- /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2567
+ /* --sha1sum is an undocumented alias for --hash for backwards compatibility */
25522568
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
25532569
noSign = find_option("nosign",0,0)!=0;
25542570
if( find_option("nosync",0,0) ) g.fNoSync = 1;
25552571
privateFlag = find_option("private",0,0)!=0;
25562572
forceDelta = find_option("delta",0,0)!=0;
25572573
--- src/checkin.c
+++ src/checkin.c
@@ -484,11 +484,11 @@
484 {"no-merge", C_MERGE }, {"no-classify", C_CLASSIFY },
485 };
486
487 Blob report = BLOB_INITIALIZER;
488 enum {CHANGES, STATUS} command = *g.argv[1]=='s' ? STATUS : CHANGES;
489 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
490 int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
491 int showHdr = command==CHANGES && find_option("header", 0, 0);
492 int verboseFlag = command==CHANGES && find_option("verbose", "v", 0);
493 const char *zIgnoreFlag = find_option("ignore", 0, 1);
494 unsigned scanFlags = 0;
@@ -718,11 +718,12 @@
718 */
719 static void ls_cmd_rev(
720 const char *zRev, /* Revision string given */
721 int verboseFlag, /* Verbose flag given */
722 int showAge, /* Age flag given */
723 int showHash, /* Show hash flag given */
 
724 int timeOrder, /* Order by time flag given */
725 int treeFmt /* Show output in the tree format */
726 ){
727 Stmt q;
728 char *zOrderBy = "pathname COLLATE nocase";
@@ -762,16 +763,21 @@
762 if( timeOrder ){
763 zOrderBy = "mtime DESC";
764 }
765
766 compute_fileage(rid,0);
767 db_prepare(&q,
768 "SELECT datetime(fileage.mtime, toLocal()), fileage.pathname,\n"
769 " blob.size, fileage.uuid\n"
770 " FROM fileage, blob\n"
771 " WHERE blob.rid=fileage.fid %s\n"
772 " ORDER BY %s;", blob_sql_text(&where), zOrderBy /*safe-for-%s*/
 
 
 
 
 
773 );
774 blob_reset(&where);
775 if( treeFmt ) blob_init(&out, 0, 0);
776
777 while( db_step(&q)==SQLITE_ROW ){
@@ -779,13 +785,16 @@
779 const char *zFile = db_column_text(&q,1);
780 int size = db_column_int(&q,2);
781 if( treeFmt ){
782 blob_appendf(&out, "%s\n", zFile);
783 }else if( verboseFlag ){
784 if( showHash ){
785 const char *zUuid = db_column_text(&q,3);
786 fossil_print("%s %7d [%S] %s\n", zTime, size, zUuid, zFile);
 
 
 
787 }else{
788 fossil_print("%s %7d %s\n", zTime, size, zFile);
789 }
790 }else if( showAge ){
791 fossil_print("%s %s\n", zTime, zFile);
@@ -818,19 +827,21 @@
818 ** side effect of making -t sort by commit time, not modification time.
819 **
820 ** The -v option provides extra information about each file. Without -r,
821 ** -v displays the change status, in the manner of the changes command.
822 ** With -r, -v shows the commit time and size of the checked-in files; in
823 ** this combination, it additionally shows file hashes with -h.
 
824 **
825 ** The -t option changes the sort order. Without -t, files are sorted by
826 ** path and name (case insensitive sort if -r). If neither --age nor -r
827 ** are used, -t sorts by modification time, otherwise by commit time.
828 **
829 ** Options:
830 ** --age Show when each file was committed
831 ** -h With -v and -r, show file hashes
 
832 ** --hash With -v, verify file status using hashing
833 ** rather than relying on file sizes and mtimes
834 ** -r VERSION The specific check-in to list
835 ** -R|--repository REPO Extract info from repository REPO
836 ** -t Sort output in time order
@@ -848,11 +859,12 @@
848 int timeOrder;
849 char *zOrderBy = "pathname";
850 Blob where;
851 int i;
852 int useHash = 0;
853 int showHash = 0;
 
854 const char *zName;
855 const char *zRev;
856
857 verboseFlag = find_option("verbose","v", 0)!=0;
858 if( !verboseFlag ){
@@ -861,21 +873,25 @@
861 showAge = find_option("age",0,0)!=0;
862 zRev = find_option("r","r",1);
863 timeOrder = find_option("t","t",0)!=0;
864 if( verboseFlag ){
865 useHash = find_option("hash",0,0)!=0;
866 showHash = find_option("h","h",0)!=0;
 
 
 
 
867 }
868 treeFmt = find_option("tree",0,0)!=0;
869 if( treeFmt ){
870 if( zRev==0 ) zRev = "current";
871 }
872
873 if( zRev!=0 ){
874 db_find_and_open_repository(0, 0);
875 verify_all_options();
876 ls_cmd_rev(zRev,verboseFlag,showAge,showHash,timeOrder,treeFmt);
877 return;
878 }else if( find_option("R",0,1)!=0 ){
879 fossil_fatal("the -r is required in addition to -R");
880 }
881
@@ -994,11 +1010,11 @@
994
995 zRev = find_option("r","r",1);
996 if( zRev==0 ) zRev = "current";
997 db_find_and_open_repository(0, 0);
998 verify_all_options();
999 ls_cmd_rev(zRev,0,0,0,0,1);
1000 }
1001
1002 /*
1003 ** COMMAND: extras
1004 **
@@ -2546,11 +2562,11 @@
2546 char *zNewBranch = 0; /* The branch name after update */
2547 int ckComFlgs; /* Flags passed to verify_comment() */
2548
2549 memset(&sCiInfo, 0, sizeof(sCiInfo));
2550 url_proxy_options();
2551 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2552 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
2553 noSign = find_option("nosign",0,0)!=0;
2554 if( find_option("nosync",0,0) ) g.fNoSync = 1;
2555 privateFlag = find_option("private",0,0)!=0;
2556 forceDelta = find_option("delta",0,0)!=0;
2557
--- src/checkin.c
+++ src/checkin.c
@@ -484,11 +484,11 @@
484 {"no-merge", C_MERGE }, {"no-classify", C_CLASSIFY },
485 };
486
487 Blob report = BLOB_INITIALIZER;
488 enum {CHANGES, STATUS} command = *g.argv[1]=='s' ? STATUS : CHANGES;
489 /* --sha1sum is an undocumented alias for --hash for backwards compatibility */
490 int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
491 int showHdr = command==CHANGES && find_option("header", 0, 0);
492 int verboseFlag = command==CHANGES && find_option("verbose", "v", 0);
493 const char *zIgnoreFlag = find_option("ignore", 0, 1);
494 unsigned scanFlags = 0;
@@ -718,11 +718,12 @@
718 */
719 static void ls_cmd_rev(
720 const char *zRev, /* Revision string given */
721 int verboseFlag, /* Verbose flag given */
722 int showAge, /* Age flag given */
723 int showFileHash, /* Show file hash flag given */
724 int showCkinHash, /* Show check-in hash flag given */
725 int timeOrder, /* Order by time flag given */
726 int treeFmt /* Show output in the tree format */
727 ){
728 Stmt q;
729 char *zOrderBy = "pathname COLLATE nocase";
@@ -762,16 +763,21 @@
763 if( timeOrder ){
764 zOrderBy = "mtime DESC";
765 }
766
767 compute_fileage(rid,0);
768 db_prepare(&q,
769 "SELECT datetime(fileage.mtime, toLocal()), fileage.pathname,\n"
770 " bfh.size, fileage.uuid %s\n"
771 " FROM fileage, blob bfh %s\n"
772 " WHERE bfh.rid=fileage.fid %s %s\n"
773 " ORDER BY %s;",
774 showCkinHash ? ", bch.uuid" : "",
775 showCkinHash ? ", blob bch" : "",
776 showCkinHash ? "\n AND bch.rid=fileage.mid" : "",
777 blob_sql_text(&where),
778 zOrderBy /*safe-for-%s*/
779 );
780 blob_reset(&where);
781 if( treeFmt ) blob_init(&out, 0, 0);
782
783 while( db_step(&q)==SQLITE_ROW ){
@@ -779,13 +785,16 @@
785 const char *zFile = db_column_text(&q,1);
786 int size = db_column_int(&q,2);
787 if( treeFmt ){
788 blob_appendf(&out, "%s\n", zFile);
789 }else if( verboseFlag ){
790 if( showFileHash ){
791 const char *zUuidF = db_column_text(&q,3);
792 fossil_print("%s %7d [%S] %s\n", zTime, size, zUuidF, zFile);
793 }else if( showCkinHash ){
794 const char *zUuidC = db_column_text(&q,4);
795 fossil_print("%s %7d [%S] %s\n", zTime, size, zUuidC, zFile);
796 }else{
797 fossil_print("%s %7d %s\n", zTime, size, zFile);
798 }
799 }else if( showAge ){
800 fossil_print("%s %s\n", zTime, zFile);
@@ -818,19 +827,21 @@
827 ** side effect of making -t sort by commit time, not modification time.
828 **
829 ** The -v option provides extra information about each file. Without -r,
830 ** -v displays the change status, in the manner of the changes command.
831 ** With -r, -v shows the commit time and size of the checked-in files; in
832 ** this combination, it additionally shows file hashes with -h, or check-in
833 ** hashes with -H (when both are given, file hashes take precedence).
834 **
835 ** The -t option changes the sort order. Without -t, files are sorted by
836 ** path and name (case insensitive sort if -r). If neither --age nor -r
837 ** are used, -t sorts by modification time, otherwise by commit time.
838 **
839 ** Options:
840 ** --age Show when each file was committed
841 ** -h With -v and -r, show file hashes
842 ** -H With -v and -r, show check-in hashes
843 ** --hash With -v, verify file status using hashing
844 ** rather than relying on file sizes and mtimes
845 ** -r VERSION The specific check-in to list
846 ** -R|--repository REPO Extract info from repository REPO
847 ** -t Sort output in time order
@@ -848,11 +859,12 @@
859 int timeOrder;
860 char *zOrderBy = "pathname";
861 Blob where;
862 int i;
863 int useHash = 0;
864 int showFHash = 0; /* Show file hash */
865 int showCHash = 0; /* Show check-in hash */
866 const char *zName;
867 const char *zRev;
868
869 verboseFlag = find_option("verbose","v", 0)!=0;
870 if( !verboseFlag ){
@@ -861,21 +873,25 @@
873 showAge = find_option("age",0,0)!=0;
874 zRev = find_option("r","r",1);
875 timeOrder = find_option("t","t",0)!=0;
876 if( verboseFlag ){
877 useHash = find_option("hash",0,0)!=0;
878 showFHash = find_option("h","h",0)!=0;
879 showCHash = find_option("H","H",0)!=0;
880 if( showFHash ){
881 showCHash = 0; /* file hashes take precedence */
882 }
883 }
884 treeFmt = find_option("tree",0,0)!=0;
885 if( treeFmt ){
886 if( zRev==0 ) zRev = "current";
887 }
888
889 if( zRev!=0 ){
890 db_find_and_open_repository(0, 0);
891 verify_all_options();
892 ls_cmd_rev(zRev,verboseFlag,showAge,showFHash,showCHash,timeOrder,treeFmt);
893 return;
894 }else if( find_option("R",0,1)!=0 ){
895 fossil_fatal("the -r is required in addition to -R");
896 }
897
@@ -994,11 +1010,11 @@
1010
1011 zRev = find_option("r","r",1);
1012 if( zRev==0 ) zRev = "current";
1013 db_find_and_open_repository(0, 0);
1014 verify_all_options();
1015 ls_cmd_rev(zRev,0,0,0,0,0,1);
1016 }
1017
1018 /*
1019 ** COMMAND: extras
1020 **
@@ -2546,11 +2562,11 @@
2562 char *zNewBranch = 0; /* The branch name after update */
2563 int ckComFlgs; /* Flags passed to verify_comment() */
2564
2565 memset(&sCiInfo, 0, sizeof(sCiInfo));
2566 url_proxy_options();
2567 /* --sha1sum is an undocumented alias for --hash for backwards compatibility */
2568 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
2569 noSign = find_option("nosign",0,0)!=0;
2570 if( find_option("nosync",0,0) ) g.fNoSync = 1;
2571 privateFlag = find_option("private",0,0)!=0;
2572 forceDelta = find_option("delta",0,0)!=0;
2573
+16 -19
--- src/checkout.c
+++ src/checkout.c
@@ -438,38 +438,35 @@
438438
** COMMAND: get
439439
**
440440
** Usage: %fossil get URL ?VERSION? ?OPTIONS?
441441
**
442442
** Download a single check-in from a remote repository named URL and
443
-** unpack all of the files locally. The check-in is identified by VERSION.
444
-**
445
-** URL can be a traditional URL like one of:
443
+** unpack all of the files into a subdirectory. The specific check-in
444
+** to download is identified by VERSION. If VERSION is omitted, the
445
+** latest trunk check-in is used. The URL can be a traditional "https:",
446
+** "ssh:", or "file:" URL similar to the examples shown below, or it can
447
+** be the name of a local repository/
446448
**
447449
** * https://domain.com/project
448450
** * ssh://my-server/project.fossil
449451
** * file:/home/user/Fossils/project.fossil
450452
**
451
-** Or URL can be just the name of a local repository without the "file:"
452
-** prefix.
453
-**
454453
** This command works by downloading an SQL archive of the requested
455454
** check-in and then extracting all the files from the archive.
456455
**
457456
** Options:
458
-** --dest DIRECTORY Extract files into DIRECTORY. Use "--dest ."
459
-** to extract into the local directory.
460
-**
461
-** -f|--force Overwrite existing files
462
-**
463
-** --list List all the files that would have been checked
464
-** out but do not actually write anything to the
465
-** filesystem.
466
-**
467
-** --sqlar ARCHIVE Store the check-out in an SQL-archive rather
468
-** than unpacking them into separate files.
469
-**
470
-** -v|--verbose Show all files as they are extracted
457
+** --dest DIRECTORY Extract files into DIRECTORY. Use "--dest ." to
458
+** extract into the local directory. If this option is
459
+** omitted, Fossil invents a subdirectory name derived
460
+** from base filename in the URL and from the VERSION.
461
+** -f|--force Overwrite existing files
462
+** --list List all the files that would have been checked
463
+** out but do not actually write anything to the
464
+** filesystem.
465
+** --sqlar ARCHIVE Leave the check-out in an SQL-archive named ARCHIVE
466
+** rather than unpacking into separate files.
467
+** -v|--verbose Show all files as they are extracted
471468
*/
472469
void get_cmd(void){
473470
int forceFlag = find_option("force","f",0)!=0;
474471
int bVerbose = find_option("verbose","v",0)!=0;
475472
int bQuiet = find_option("quiet","q",0)!=0;
476473
--- src/checkout.c
+++ src/checkout.c
@@ -438,38 +438,35 @@
438 ** COMMAND: get
439 **
440 ** Usage: %fossil get URL ?VERSION? ?OPTIONS?
441 **
442 ** Download a single check-in from a remote repository named URL and
443 ** unpack all of the files locally. The check-in is identified by VERSION.
444 **
445 ** URL can be a traditional URL like one of:
 
 
446 **
447 ** * https://domain.com/project
448 ** * ssh://my-server/project.fossil
449 ** * file:/home/user/Fossils/project.fossil
450 **
451 ** Or URL can be just the name of a local repository without the "file:"
452 ** prefix.
453 **
454 ** This command works by downloading an SQL archive of the requested
455 ** check-in and then extracting all the files from the archive.
456 **
457 ** Options:
458 ** --dest DIRECTORY Extract files into DIRECTORY. Use "--dest ."
459 ** to extract into the local directory.
460 **
461 ** -f|--force Overwrite existing files
462 **
463 ** --list List all the files that would have been checked
464 ** out but do not actually write anything to the
465 ** filesystem.
466 **
467 ** --sqlar ARCHIVE Store the check-out in an SQL-archive rather
468 ** than unpacking them into separate files.
469 **
470 ** -v|--verbose Show all files as they are extracted
471 */
472 void get_cmd(void){
473 int forceFlag = find_option("force","f",0)!=0;
474 int bVerbose = find_option("verbose","v",0)!=0;
475 int bQuiet = find_option("quiet","q",0)!=0;
476
--- src/checkout.c
+++ src/checkout.c
@@ -438,38 +438,35 @@
438 ** COMMAND: get
439 **
440 ** Usage: %fossil get URL ?VERSION? ?OPTIONS?
441 **
442 ** Download a single check-in from a remote repository named URL and
443 ** unpack all of the files into a subdirectory. The specific check-in
444 ** to download is identified by VERSION. If VERSION is omitted, the
445 ** latest trunk check-in is used. The URL can be a traditional "https:",
446 ** "ssh:", or "file:" URL similar to the examples shown below, or it can
447 ** be the name of a local repository/
448 **
449 ** * https://domain.com/project
450 ** * ssh://my-server/project.fossil
451 ** * file:/home/user/Fossils/project.fossil
452 **
 
 
 
453 ** This command works by downloading an SQL archive of the requested
454 ** check-in and then extracting all the files from the archive.
455 **
456 ** Options:
457 ** --dest DIRECTORY Extract files into DIRECTORY. Use "--dest ." to
458 ** extract into the local directory. If this option is
459 ** omitted, Fossil invents a subdirectory name derived
460 ** from base filename in the URL and from the VERSION.
461 ** -f|--force Overwrite existing files
462 ** --list List all the files that would have been checked
463 ** out but do not actually write anything to the
464 ** filesystem.
465 ** --sqlar ARCHIVE Leave the check-out in an SQL-archive named ARCHIVE
466 ** rather than unpacking into separate files.
467 ** -v|--verbose Show all files as they are extracted
 
 
468 */
469 void get_cmd(void){
470 int forceFlag = find_option("force","f",0)!=0;
471 int bVerbose = find_option("verbose","v",0)!=0;
472 int bQuiet = find_option("quiet","q",0)!=0;
473
+1 -1
--- src/color.c
+++ src/color.c
@@ -215,11 +215,11 @@
215215
216216
/*
217217
** SETTING: raw-bgcolor boolean default=off
218218
**
219219
** Fossil usually tries to adjust user-specified background colors
220
-** for checkins so that the text is readable and so that the color
220
+** for check-ins so that the text is readable and so that the color
221221
** is not too garish. This setting disables that filter. When
222222
** this setting is on, the user-selected background colors are shown
223223
** exactly as requested.
224224
*/
225225
226226
--- src/color.c
+++ src/color.c
@@ -215,11 +215,11 @@
215
216 /*
217 ** SETTING: raw-bgcolor boolean default=off
218 **
219 ** Fossil usually tries to adjust user-specified background colors
220 ** for checkins so that the text is readable and so that the color
221 ** is not too garish. This setting disables that filter. When
222 ** this setting is on, the user-selected background colors are shown
223 ** exactly as requested.
224 */
225
226
--- src/color.c
+++ src/color.c
@@ -215,11 +215,11 @@
215
216 /*
217 ** SETTING: raw-bgcolor boolean default=off
218 **
219 ** Fossil usually tries to adjust user-specified background colors
220 ** for check-ins so that the text is readable and so that the color
221 ** is not too garish. This setting disables that filter. When
222 ** this setting is on, the user-selected background colors are shown
223 ** exactly as requested.
224 */
225
226
+3 -3
--- src/comformat.c
+++ src/comformat.c
@@ -78,11 +78,11 @@
7878
{1, 0x00ece}, {0, 0x00f18}, {1, 0x00f1a}, {0, 0x00f35}, {1, 0x00f36},
7979
{0, 0x00f37}, {1, 0x00f38}, {0, 0x00f39}, {1, 0x00f3a}, {0, 0x00f71},
8080
{1, 0x00f7f}, {0, 0x00f80}, {1, 0x00f85}, {0, 0x00f86}, {1, 0x00f88},
8181
{0, 0x00f90}, {1, 0x00f98}, {0, 0x00f99}, {1, 0x00fbd}, {0, 0x00fc6},
8282
{1, 0x00fc7}, {0, 0x0102d}, {1, 0x01031}, {0, 0x01032}, {1, 0x01033},
83
- {0, 0x01036}, {1, 0x01038}, {0, 0x01039}, {1, 0x0103a}, {0, 0x01058},
83
+ {0, 0x01036}, {1, 0x0103b}, {0, 0x01058},
8484
{1, 0x0105a}, {2, 0x01100}, {0, 0x01160}, {1, 0x01200}, {0, 0x0135f},
8585
{1, 0x01360}, {0, 0x01712}, {1, 0x01715}, {0, 0x01732}, {1, 0x01735},
8686
{0, 0x01752}, {1, 0x01754}, {0, 0x01772}, {1, 0x01774}, {0, 0x017b4},
8787
{1, 0x017b6}, {0, 0x017b7}, {1, 0x017be}, {0, 0x017c6}, {1, 0x017c7},
8888
{0, 0x017c9}, {1, 0x017d4}, {0, 0x017dd}, {1, 0x017de}, {0, 0x0180b},
@@ -121,11 +121,11 @@
121121
*/
122122
static int cli_wcwidth(int c){
123123
int iFirst, iLast;
124124
125125
/* Fast path for common characters */
126
- if( c<=0x300 ) return 1;
126
+ if( c<0x300 ) return 1;
127127
128128
/* The general case */
129129
iFirst = 0;
130130
iLast = sizeof(aUWidth)/sizeof(aUWidth[0]) - 1;
131131
while( iFirst<iLast-1 ){
@@ -750,11 +750,11 @@
750750
** handling the value of a C-card from a manifest.
751751
** --file FILE Omit the TEXT argument and read the comment text
752752
** from FILE.
753753
** --indent Number of spaces to indent (default (-1) is to
754754
** auto-detect). Zero means no indent.
755
-** --orig FILE Take the value for the ORIGTEXT argumetn from FILE.
755
+** --orig FILE Take the value for the ORIGTEXT argument from FILE.
756756
** --origbreak Attempt to break when the original comment text
757757
** is detected.
758758
** --trimcrlf Enable trimming of leading/trailing CR/LF.
759759
** --trimspace Enable trimming of leading/trailing spaces.
760760
** --whitespace Keep all internal whitespace.
761761
--- src/comformat.c
+++ src/comformat.c
@@ -78,11 +78,11 @@
78 {1, 0x00ece}, {0, 0x00f18}, {1, 0x00f1a}, {0, 0x00f35}, {1, 0x00f36},
79 {0, 0x00f37}, {1, 0x00f38}, {0, 0x00f39}, {1, 0x00f3a}, {0, 0x00f71},
80 {1, 0x00f7f}, {0, 0x00f80}, {1, 0x00f85}, {0, 0x00f86}, {1, 0x00f88},
81 {0, 0x00f90}, {1, 0x00f98}, {0, 0x00f99}, {1, 0x00fbd}, {0, 0x00fc6},
82 {1, 0x00fc7}, {0, 0x0102d}, {1, 0x01031}, {0, 0x01032}, {1, 0x01033},
83 {0, 0x01036}, {1, 0x01038}, {0, 0x01039}, {1, 0x0103a}, {0, 0x01058},
84 {1, 0x0105a}, {2, 0x01100}, {0, 0x01160}, {1, 0x01200}, {0, 0x0135f},
85 {1, 0x01360}, {0, 0x01712}, {1, 0x01715}, {0, 0x01732}, {1, 0x01735},
86 {0, 0x01752}, {1, 0x01754}, {0, 0x01772}, {1, 0x01774}, {0, 0x017b4},
87 {1, 0x017b6}, {0, 0x017b7}, {1, 0x017be}, {0, 0x017c6}, {1, 0x017c7},
88 {0, 0x017c9}, {1, 0x017d4}, {0, 0x017dd}, {1, 0x017de}, {0, 0x0180b},
@@ -121,11 +121,11 @@
121 */
122 static int cli_wcwidth(int c){
123 int iFirst, iLast;
124
125 /* Fast path for common characters */
126 if( c<=0x300 ) return 1;
127
128 /* The general case */
129 iFirst = 0;
130 iLast = sizeof(aUWidth)/sizeof(aUWidth[0]) - 1;
131 while( iFirst<iLast-1 ){
@@ -750,11 +750,11 @@
750 ** handling the value of a C-card from a manifest.
751 ** --file FILE Omit the TEXT argument and read the comment text
752 ** from FILE.
753 ** --indent Number of spaces to indent (default (-1) is to
754 ** auto-detect). Zero means no indent.
755 ** --orig FILE Take the value for the ORIGTEXT argumetn from FILE.
756 ** --origbreak Attempt to break when the original comment text
757 ** is detected.
758 ** --trimcrlf Enable trimming of leading/trailing CR/LF.
759 ** --trimspace Enable trimming of leading/trailing spaces.
760 ** --whitespace Keep all internal whitespace.
761
--- src/comformat.c
+++ src/comformat.c
@@ -78,11 +78,11 @@
78 {1, 0x00ece}, {0, 0x00f18}, {1, 0x00f1a}, {0, 0x00f35}, {1, 0x00f36},
79 {0, 0x00f37}, {1, 0x00f38}, {0, 0x00f39}, {1, 0x00f3a}, {0, 0x00f71},
80 {1, 0x00f7f}, {0, 0x00f80}, {1, 0x00f85}, {0, 0x00f86}, {1, 0x00f88},
81 {0, 0x00f90}, {1, 0x00f98}, {0, 0x00f99}, {1, 0x00fbd}, {0, 0x00fc6},
82 {1, 0x00fc7}, {0, 0x0102d}, {1, 0x01031}, {0, 0x01032}, {1, 0x01033},
83 {0, 0x01036}, {1, 0x0103b}, {0, 0x01058},
84 {1, 0x0105a}, {2, 0x01100}, {0, 0x01160}, {1, 0x01200}, {0, 0x0135f},
85 {1, 0x01360}, {0, 0x01712}, {1, 0x01715}, {0, 0x01732}, {1, 0x01735},
86 {0, 0x01752}, {1, 0x01754}, {0, 0x01772}, {1, 0x01774}, {0, 0x017b4},
87 {1, 0x017b6}, {0, 0x017b7}, {1, 0x017be}, {0, 0x017c6}, {1, 0x017c7},
88 {0, 0x017c9}, {1, 0x017d4}, {0, 0x017dd}, {1, 0x017de}, {0, 0x0180b},
@@ -121,11 +121,11 @@
121 */
122 static int cli_wcwidth(int c){
123 int iFirst, iLast;
124
125 /* Fast path for common characters */
126 if( c<0x300 ) return 1;
127
128 /* The general case */
129 iFirst = 0;
130 iLast = sizeof(aUWidth)/sizeof(aUWidth[0]) - 1;
131 while( iFirst<iLast-1 ){
@@ -750,11 +750,11 @@
750 ** handling the value of a C-card from a manifest.
751 ** --file FILE Omit the TEXT argument and read the comment text
752 ** from FILE.
753 ** --indent Number of spaces to indent (default (-1) is to
754 ** auto-detect). Zero means no indent.
755 ** --orig FILE Take the value for the ORIGTEXT argument from FILE.
756 ** --origbreak Attempt to break when the original comment text
757 ** is detected.
758 ** --trimcrlf Enable trimming of leading/trailing CR/LF.
759 ** --trimspace Enable trimming of leading/trailing spaces.
760 ** --whitespace Keep all internal whitespace.
761
+1 -1
--- src/config.h
+++ src/config.h
@@ -39,11 +39,11 @@
3939
4040
#ifdef HAVE_AUTOCONFIG_H
4141
#include "autoconfig.h"
4242
#endif
4343
44
-/* Enable the hardened SHA1 implemenation by default */
44
+/* Enable the hardened SHA1 implementation by default */
4545
#ifndef FOSSIL_HARDENED_SHA1
4646
# define FOSSIL_HARDENED_SHA1 1
4747
#endif
4848
4949
#ifndef _RC_COMPILE_
5050
--- src/config.h
+++ src/config.h
@@ -39,11 +39,11 @@
39
40 #ifdef HAVE_AUTOCONFIG_H
41 #include "autoconfig.h"
42 #endif
43
44 /* Enable the hardened SHA1 implemenation by default */
45 #ifndef FOSSIL_HARDENED_SHA1
46 # define FOSSIL_HARDENED_SHA1 1
47 #endif
48
49 #ifndef _RC_COMPILE_
50
--- src/config.h
+++ src/config.h
@@ -39,11 +39,11 @@
39
40 #ifdef HAVE_AUTOCONFIG_H
41 #include "autoconfig.h"
42 #endif
43
44 /* Enable the hardened SHA1 implementation by default */
45 #ifndef FOSSIL_HARDENED_SHA1
46 # define FOSSIL_HARDENED_SHA1 1
47 #endif
48
49 #ifndef _RC_COMPILE_
50
+1 -1
--- src/configure.c
+++ src/configure.c
@@ -376,11 +376,11 @@
376376
** NAME-specific notes:
377377
**
378378
** - /reportftm's $MTIME is in Julian, not the Unix epoch.
379379
*/
380380
void configure_receive(const char *zName, Blob *pContent, int groupMask){
381
- int checkMask; /* Masks for which we must first check existance of tables */
381
+ int checkMask; /* Masks for which we must first check existence of tables */
382382
383383
checkMask = CONFIGSET_SCRIBER;
384384
if( zName[0]=='/' ){
385385
/* The new format */
386386
char *azToken[24];
387387
--- src/configure.c
+++ src/configure.c
@@ -376,11 +376,11 @@
376 ** NAME-specific notes:
377 **
378 ** - /reportftm's $MTIME is in Julian, not the Unix epoch.
379 */
380 void configure_receive(const char *zName, Blob *pContent, int groupMask){
381 int checkMask; /* Masks for which we must first check existance of tables */
382
383 checkMask = CONFIGSET_SCRIBER;
384 if( zName[0]=='/' ){
385 /* The new format */
386 char *azToken[24];
387
--- src/configure.c
+++ src/configure.c
@@ -376,11 +376,11 @@
376 ** NAME-specific notes:
377 **
378 ** - /reportftm's $MTIME is in Julian, not the Unix epoch.
379 */
380 void configure_receive(const char *zName, Blob *pContent, int groupMask){
381 int checkMask; /* Masks for which we must first check existence of tables */
382
383 checkMask = CONFIGSET_SCRIBER;
384 if( zName[0]=='/' ){
385 /* The new format */
386 char *azToken[24];
387
+4 -4
--- src/content.c
+++ src/content.c
@@ -496,11 +496,11 @@
496496
** zUuid is the UUID of the artifact, if it is specified. When srcId is
497497
** specified then zUuid must always be specified. If srcId is zero,
498498
** and zUuid is zero then the correct zUuid is computed from pBlob.
499499
**
500500
** If the record already exists but is a phantom, the pBlob content
501
-** is inserted and the phatom becomes a real record.
501
+** is inserted and the phantom becomes a real record.
502502
**
503503
** The original content of pBlob is not disturbed. The caller continues
504504
** to be responsible for pBlob. This routine does *not* take over
505505
** responsibility for freeing pBlob.
506506
*/
@@ -651,11 +651,11 @@
651651
** pBlob is uncompressed and is not deltaed. It is exactly the content
652652
** to be inserted.
653653
**
654654
** The original content of pBlob is not disturbed. The caller continues
655655
** to be responsible for pBlob. This routine does *not* take over
656
-** responsiblity for freeing pBlob.
656
+** responsibility for freeing pBlob.
657657
*/
658658
int content_put(Blob *pBlob){
659659
return content_put_ex(pBlob, 0, 0, 0, 0);
660660
}
661661
@@ -793,11 +793,11 @@
793793
}
794794
795795
/*
796796
** Try to change the storage of rid so that it is a delta from one
797797
** of the artifacts given in aSrc[0]..aSrc[nSrc-1]. The aSrc[*] that
798
-** gives the smallest delta is choosen.
798
+** gives the smallest delta is chosen.
799799
**
800800
** If rid is already a delta from some other place then no
801801
** conversion occurs and this is a no-op unless force==1. If force==1,
802802
** then nSrc must also be 1.
803803
**
@@ -864,11 +864,11 @@
864864
int srcid = aSrc[i];
865865
if( srcid==rid ) continue;
866866
if( content_is_private(srcid) && !content_is_private(rid) ) continue;
867867
868868
/* Compute all ancestors of srcid and make sure rid is not one of them.
869
- ** If rid is an ancestor of srcid, then making rid a descendent of srcid
869
+ ** If rid is an ancestor of srcid, then making rid a descendant of srcid
870870
** would create a delta loop. */
871871
s = srcid;
872872
while( (s = delta_source_rid(s))>0 ){
873873
if( s==rid ){
874874
content_undelta(srcid);
875875
--- src/content.c
+++ src/content.c
@@ -496,11 +496,11 @@
496 ** zUuid is the UUID of the artifact, if it is specified. When srcId is
497 ** specified then zUuid must always be specified. If srcId is zero,
498 ** and zUuid is zero then the correct zUuid is computed from pBlob.
499 **
500 ** If the record already exists but is a phantom, the pBlob content
501 ** is inserted and the phatom becomes a real record.
502 **
503 ** The original content of pBlob is not disturbed. The caller continues
504 ** to be responsible for pBlob. This routine does *not* take over
505 ** responsibility for freeing pBlob.
506 */
@@ -651,11 +651,11 @@
651 ** pBlob is uncompressed and is not deltaed. It is exactly the content
652 ** to be inserted.
653 **
654 ** The original content of pBlob is not disturbed. The caller continues
655 ** to be responsible for pBlob. This routine does *not* take over
656 ** responsiblity for freeing pBlob.
657 */
658 int content_put(Blob *pBlob){
659 return content_put_ex(pBlob, 0, 0, 0, 0);
660 }
661
@@ -793,11 +793,11 @@
793 }
794
795 /*
796 ** Try to change the storage of rid so that it is a delta from one
797 ** of the artifacts given in aSrc[0]..aSrc[nSrc-1]. The aSrc[*] that
798 ** gives the smallest delta is choosen.
799 **
800 ** If rid is already a delta from some other place then no
801 ** conversion occurs and this is a no-op unless force==1. If force==1,
802 ** then nSrc must also be 1.
803 **
@@ -864,11 +864,11 @@
864 int srcid = aSrc[i];
865 if( srcid==rid ) continue;
866 if( content_is_private(srcid) && !content_is_private(rid) ) continue;
867
868 /* Compute all ancestors of srcid and make sure rid is not one of them.
869 ** If rid is an ancestor of srcid, then making rid a descendent of srcid
870 ** would create a delta loop. */
871 s = srcid;
872 while( (s = delta_source_rid(s))>0 ){
873 if( s==rid ){
874 content_undelta(srcid);
875
--- src/content.c
+++ src/content.c
@@ -496,11 +496,11 @@
496 ** zUuid is the UUID of the artifact, if it is specified. When srcId is
497 ** specified then zUuid must always be specified. If srcId is zero,
498 ** and zUuid is zero then the correct zUuid is computed from pBlob.
499 **
500 ** If the record already exists but is a phantom, the pBlob content
501 ** is inserted and the phantom becomes a real record.
502 **
503 ** The original content of pBlob is not disturbed. The caller continues
504 ** to be responsible for pBlob. This routine does *not* take over
505 ** responsibility for freeing pBlob.
506 */
@@ -651,11 +651,11 @@
651 ** pBlob is uncompressed and is not deltaed. It is exactly the content
652 ** to be inserted.
653 **
654 ** The original content of pBlob is not disturbed. The caller continues
655 ** to be responsible for pBlob. This routine does *not* take over
656 ** responsibility for freeing pBlob.
657 */
658 int content_put(Blob *pBlob){
659 return content_put_ex(pBlob, 0, 0, 0, 0);
660 }
661
@@ -793,11 +793,11 @@
793 }
794
795 /*
796 ** Try to change the storage of rid so that it is a delta from one
797 ** of the artifacts given in aSrc[0]..aSrc[nSrc-1]. The aSrc[*] that
798 ** gives the smallest delta is chosen.
799 **
800 ** If rid is already a delta from some other place then no
801 ** conversion occurs and this is a no-op unless force==1. If force==1,
802 ** then nSrc must also be 1.
803 **
@@ -864,11 +864,11 @@
864 int srcid = aSrc[i];
865 if( srcid==rid ) continue;
866 if( content_is_private(srcid) && !content_is_private(rid) ) continue;
867
868 /* Compute all ancestors of srcid and make sure rid is not one of them.
869 ** If rid is an ancestor of srcid, then making rid a descendant of srcid
870 ** would create a delta loop. */
871 s = srcid;
872 while( (s = delta_source_rid(s))>0 ){
873 if( s==rid ){
874 content_undelta(srcid);
875
+9 -9
--- src/db.c
+++ src/db.c
@@ -1718,11 +1718,11 @@
17181718
savedKeySize = n;
17191719
}
17201720
17211721
/*
17221722
** This function arranges for the database encryption key to be securely
1723
-** saved in non-pagable memory (on platforms where this is possible).
1723
+** saved in non-pageable memory (on platforms where this is possible).
17241724
*/
17251725
static void db_save_encryption_key(
17261726
Blob *pKey
17271727
){
17281728
void *p = NULL;
@@ -2531,11 +2531,11 @@
25312531
if( file_access(zDbName, F_OK) ) return 0;
25322532
lsize = file_size(zDbName, ExtFILE);
25332533
if( lsize%1024!=0 || lsize<4096 ) return 0;
25342534
db_open_or_attach(zDbName, "localdb");
25352535
2536
- /* Check to see if the check-out database has the lastest schema changes.
2536
+ /* Check to see if the check-out database has the latest schema changes.
25372537
** The most recent schema change (2019-01-19) is the addition of the
25382538
** vmerge.mhash and vfile.mhash fields. If the schema has the vmerge.mhash
25392539
** column, assume everything else is up-to-date.
25402540
*/
25412541
if( db_table_has_column("localdb","vmerge","mhash") ){
@@ -2784,11 +2784,11 @@
27842784
27852785
/* Additional checks that occur when opening the check-out database */
27862786
if( g.localOpen ){
27872787
27882788
/* If the repository database that was just opened has been
2789
- ** eplaced by a clone of the same project, with different RID
2789
+ ** replaced by a clone of the same project, with different RID
27902790
** values, then renumber the RID values stored in various tables
27912791
** of the check-out database, so that the repository and check-out
27922792
** databases align.
27932793
*/
27942794
if( !db_fingerprint_ok() ){
@@ -3655,12 +3655,12 @@
36553655
** non-versioned value exist and are not equal, then a warning message
36563656
** might be generated.
36573657
**
36583658
** zCkin is normally NULL. In that case, the versioned setting is
36593659
** take from the local check-out, if a local checkout exists, or from
3660
-** checkin named by the g.zOpenRevision global variable. If zCkin is
3661
-** not NULL, then zCkin is the name of the specific checkin from which
3660
+** check-in named by the g.zOpenRevision global variable. If zCkin is
3661
+** not NULL, then zCkin is the name of the specific check-in from which
36623662
** versioned setting value is taken. When zCkin is not NULL, the cache
36633663
** is bypassed.
36643664
*/
36653665
char *db_get_versioned(
36663666
const char *zName,
@@ -4569,11 +4569,11 @@
45694569
**
45704570
** var is the name of the internal configuration name for db_(un)set.
45714571
** If var is 0, the settings name is used.
45724572
**
45734573
** width is the length for the edit field on the behavior page, 0 is
4574
-** used for on/off checkboxes. A negative value indicates that that
4574
+** used for on/off checkboxes. A negative value indicates that the
45754575
** page should not render this setting. Such values may be rendered
45764576
** separately/manually on another page, e.g., /setup_access, and are
45774577
** exposed via the CLI settings command.
45784578
**
45794579
** The behaviour page doesn't use a special layout. It lists all
@@ -4855,11 +4855,11 @@
48554855
*/
48564856
/*
48574857
** SETTING: empty-dirs width=40 versionable block-text
48584858
** The value is a list of pathnames parsed according to the same rules as
48594859
** the *-glob settings. On update and checkout commands, if no directory
4860
-** exists with that name, an empty directory will be be created, even if
4860
+** exists with that name, an empty directory will be created, even if
48614861
** it must create one or more parent directories.
48624862
*/
48634863
/*
48644864
** SETTING: encoding-glob width=40 versionable block-text
48654865
** The VALUE of this setting is a list of GLOB patterns matching files that
@@ -5576,17 +5576,17 @@
55765576
fossil_print("Config database: %s\n", g.zConfigDbName);
55775577
}
55785578
55795579
/*
55805580
** Compute a "fingerprint" on the repository. A fingerprint is used
5581
-** to verify that that the repository has not been replaced by a clone
5581
+** to verify that the repository has not been replaced by a clone
55825582
** of the same repository. More precisely, a fingerprint is used to
55835583
** verify that the mapping between SHA3 hashes and RID values is unchanged.
55845584
**
55855585
** The check-out database ("localdb") stores RID values. When associating
55865586
** a check-out database against a repository database, it is useful to verify
5587
-** the fingerprint so that we know tha the RID values in the check-out
5587
+** the fingerprint so that we know that the RID values in the check-out
55885588
** database still correspond to the correct entries in the BLOB table of
55895589
** the repository.
55905590
**
55915591
** The fingerprint is based on the RCVFROM table. When constructing a
55925592
** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to
55935593
--- src/db.c
+++ src/db.c
@@ -1718,11 +1718,11 @@
1718 savedKeySize = n;
1719 }
1720
1721 /*
1722 ** This function arranges for the database encryption key to be securely
1723 ** saved in non-pagable memory (on platforms where this is possible).
1724 */
1725 static void db_save_encryption_key(
1726 Blob *pKey
1727 ){
1728 void *p = NULL;
@@ -2531,11 +2531,11 @@
2531 if( file_access(zDbName, F_OK) ) return 0;
2532 lsize = file_size(zDbName, ExtFILE);
2533 if( lsize%1024!=0 || lsize<4096 ) return 0;
2534 db_open_or_attach(zDbName, "localdb");
2535
2536 /* Check to see if the check-out database has the lastest schema changes.
2537 ** The most recent schema change (2019-01-19) is the addition of the
2538 ** vmerge.mhash and vfile.mhash fields. If the schema has the vmerge.mhash
2539 ** column, assume everything else is up-to-date.
2540 */
2541 if( db_table_has_column("localdb","vmerge","mhash") ){
@@ -2784,11 +2784,11 @@
2784
2785 /* Additional checks that occur when opening the check-out database */
2786 if( g.localOpen ){
2787
2788 /* If the repository database that was just opened has been
2789 ** eplaced by a clone of the same project, with different RID
2790 ** values, then renumber the RID values stored in various tables
2791 ** of the check-out database, so that the repository and check-out
2792 ** databases align.
2793 */
2794 if( !db_fingerprint_ok() ){
@@ -3655,12 +3655,12 @@
3655 ** non-versioned value exist and are not equal, then a warning message
3656 ** might be generated.
3657 **
3658 ** zCkin is normally NULL. In that case, the versioned setting is
3659 ** take from the local check-out, if a local checkout exists, or from
3660 ** checkin named by the g.zOpenRevision global variable. If zCkin is
3661 ** not NULL, then zCkin is the name of the specific checkin from which
3662 ** versioned setting value is taken. When zCkin is not NULL, the cache
3663 ** is bypassed.
3664 */
3665 char *db_get_versioned(
3666 const char *zName,
@@ -4569,11 +4569,11 @@
4569 **
4570 ** var is the name of the internal configuration name for db_(un)set.
4571 ** If var is 0, the settings name is used.
4572 **
4573 ** width is the length for the edit field on the behavior page, 0 is
4574 ** used for on/off checkboxes. A negative value indicates that that
4575 ** page should not render this setting. Such values may be rendered
4576 ** separately/manually on another page, e.g., /setup_access, and are
4577 ** exposed via the CLI settings command.
4578 **
4579 ** The behaviour page doesn't use a special layout. It lists all
@@ -4855,11 +4855,11 @@
4855 */
4856 /*
4857 ** SETTING: empty-dirs width=40 versionable block-text
4858 ** The value is a list of pathnames parsed according to the same rules as
4859 ** the *-glob settings. On update and checkout commands, if no directory
4860 ** exists with that name, an empty directory will be be created, even if
4861 ** it must create one or more parent directories.
4862 */
4863 /*
4864 ** SETTING: encoding-glob width=40 versionable block-text
4865 ** The VALUE of this setting is a list of GLOB patterns matching files that
@@ -5576,17 +5576,17 @@
5576 fossil_print("Config database: %s\n", g.zConfigDbName);
5577 }
5578
5579 /*
5580 ** Compute a "fingerprint" on the repository. A fingerprint is used
5581 ** to verify that that the repository has not been replaced by a clone
5582 ** of the same repository. More precisely, a fingerprint is used to
5583 ** verify that the mapping between SHA3 hashes and RID values is unchanged.
5584 **
5585 ** The check-out database ("localdb") stores RID values. When associating
5586 ** a check-out database against a repository database, it is useful to verify
5587 ** the fingerprint so that we know tha the RID values in the check-out
5588 ** database still correspond to the correct entries in the BLOB table of
5589 ** the repository.
5590 **
5591 ** The fingerprint is based on the RCVFROM table. When constructing a
5592 ** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to
5593
--- src/db.c
+++ src/db.c
@@ -1718,11 +1718,11 @@
1718 savedKeySize = n;
1719 }
1720
1721 /*
1722 ** This function arranges for the database encryption key to be securely
1723 ** saved in non-pageable memory (on platforms where this is possible).
1724 */
1725 static void db_save_encryption_key(
1726 Blob *pKey
1727 ){
1728 void *p = NULL;
@@ -2531,11 +2531,11 @@
2531 if( file_access(zDbName, F_OK) ) return 0;
2532 lsize = file_size(zDbName, ExtFILE);
2533 if( lsize%1024!=0 || lsize<4096 ) return 0;
2534 db_open_or_attach(zDbName, "localdb");
2535
2536 /* Check to see if the check-out database has the latest schema changes.
2537 ** The most recent schema change (2019-01-19) is the addition of the
2538 ** vmerge.mhash and vfile.mhash fields. If the schema has the vmerge.mhash
2539 ** column, assume everything else is up-to-date.
2540 */
2541 if( db_table_has_column("localdb","vmerge","mhash") ){
@@ -2784,11 +2784,11 @@
2784
2785 /* Additional checks that occur when opening the check-out database */
2786 if( g.localOpen ){
2787
2788 /* If the repository database that was just opened has been
2789 ** replaced by a clone of the same project, with different RID
2790 ** values, then renumber the RID values stored in various tables
2791 ** of the check-out database, so that the repository and check-out
2792 ** databases align.
2793 */
2794 if( !db_fingerprint_ok() ){
@@ -3655,12 +3655,12 @@
3655 ** non-versioned value exist and are not equal, then a warning message
3656 ** might be generated.
3657 **
3658 ** zCkin is normally NULL. In that case, the versioned setting is
3659 ** take from the local check-out, if a local checkout exists, or from
3660 ** check-in named by the g.zOpenRevision global variable. If zCkin is
3661 ** not NULL, then zCkin is the name of the specific check-in from which
3662 ** versioned setting value is taken. When zCkin is not NULL, the cache
3663 ** is bypassed.
3664 */
3665 char *db_get_versioned(
3666 const char *zName,
@@ -4569,11 +4569,11 @@
4569 **
4570 ** var is the name of the internal configuration name for db_(un)set.
4571 ** If var is 0, the settings name is used.
4572 **
4573 ** width is the length for the edit field on the behavior page, 0 is
4574 ** used for on/off checkboxes. A negative value indicates that the
4575 ** page should not render this setting. Such values may be rendered
4576 ** separately/manually on another page, e.g., /setup_access, and are
4577 ** exposed via the CLI settings command.
4578 **
4579 ** The behaviour page doesn't use a special layout. It lists all
@@ -4855,11 +4855,11 @@
4855 */
4856 /*
4857 ** SETTING: empty-dirs width=40 versionable block-text
4858 ** The value is a list of pathnames parsed according to the same rules as
4859 ** the *-glob settings. On update and checkout commands, if no directory
4860 ** exists with that name, an empty directory will be created, even if
4861 ** it must create one or more parent directories.
4862 */
4863 /*
4864 ** SETTING: encoding-glob width=40 versionable block-text
4865 ** The VALUE of this setting is a list of GLOB patterns matching files that
@@ -5576,17 +5576,17 @@
5576 fossil_print("Config database: %s\n", g.zConfigDbName);
5577 }
5578
5579 /*
5580 ** Compute a "fingerprint" on the repository. A fingerprint is used
5581 ** to verify that the repository has not been replaced by a clone
5582 ** of the same repository. More precisely, a fingerprint is used to
5583 ** verify that the mapping between SHA3 hashes and RID values is unchanged.
5584 **
5585 ** The check-out database ("localdb") stores RID values. When associating
5586 ** a check-out database against a repository database, it is useful to verify
5587 ** the fingerprint so that we know that the RID values in the check-out
5588 ** database still correspond to the correct entries in the BLOB table of
5589 ** the repository.
5590 **
5591 ** The fingerprint is based on the RCVFROM table. When constructing a
5592 ** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to
5593
+22 -5
--- src/default.css
+++ src/default.css
@@ -1895,15 +1895,14 @@
18951895
div.markdown ol.footnotes > li.fn-joined > sup.fn-joined,
18961896
table.numbered-lines > tbody > tr,
18971897
tr.diffskip > td.chunkctrl,
18981898
#fossil-status-bar,
18991899
.monospace {
1900
- font-family: "Source Code Pro", "Menlo", "Monaco", "Consolas",
1901
- "Andale Mono", "Ubuntu Mono", "Deja Vu Sans Mono",
1902
- "Letter Gothic", "Letter Gothic Std", "Prestige Elite Std",
1903
- "Courier", "Courier New",
1904
- monospace;
1900
+ font-family: "MesloLGSDZ Nerd Font Mono", /* 2025 hotness */
1901
+ "Source Code Pro", /* 2012 hotness */
1902
+ "Menlo", "Monaco", "SF Mono", /* Safari reverted to Courier in 2022 */
1903
+ monospace; /* let OS/browser default take over */
19051904
}
19061905
19071906
div.markdown > ol.footnotes {
19081907
font-size: 90%;
19091908
}
@@ -1976,10 +1975,28 @@
19761975
}
19771976
div.markdown span.notescope:hover,
19781977
div.markdown span.notescope:target {
19791978
border-bottom: 2px solid gold;
19801979
}
1980
+
1981
+/* Cause <dd> elements to be aligned complete to the
1982
+** right of their <dt> on help pages. */
1983
+dl.helpOptions {
1984
+ display: grid;
1985
+ grid-template-columns: max-content 1fr;
1986
+ column-gap: 1rem;
1987
+}
1988
+dl.helpOptions > dt {
1989
+ grid-column: 1;
1990
+}
1991
+dl.helpOptions > dd {
1992
+ grid-column: 2;
1993
+ margin: 0;
1994
+}
1995
+div.helpPage blockquote {
1996
+ margin-left: 0.2em;
1997
+}
19811998
19821999
/* Objects in the "desktoponly" class are invisible on mobile */
19832000
@media screen and (max-width: 600px) {
19842001
.desktoponly {
19852002
display: none;
19862003
--- src/default.css
+++ src/default.css
@@ -1895,15 +1895,14 @@
1895 div.markdown ol.footnotes > li.fn-joined > sup.fn-joined,
1896 table.numbered-lines > tbody > tr,
1897 tr.diffskip > td.chunkctrl,
1898 #fossil-status-bar,
1899 .monospace {
1900 font-family: "Source Code Pro", "Menlo", "Monaco", "Consolas",
1901 "Andale Mono", "Ubuntu Mono", "Deja Vu Sans Mono",
1902 "Letter Gothic", "Letter Gothic Std", "Prestige Elite Std",
1903 "Courier", "Courier New",
1904 monospace;
1905 }
1906
1907 div.markdown > ol.footnotes {
1908 font-size: 90%;
1909 }
@@ -1976,10 +1975,28 @@
1976 }
1977 div.markdown span.notescope:hover,
1978 div.markdown span.notescope:target {
1979 border-bottom: 2px solid gold;
1980 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1981
1982 /* Objects in the "desktoponly" class are invisible on mobile */
1983 @media screen and (max-width: 600px) {
1984 .desktoponly {
1985 display: none;
1986
--- src/default.css
+++ src/default.css
@@ -1895,15 +1895,14 @@
1895 div.markdown ol.footnotes > li.fn-joined > sup.fn-joined,
1896 table.numbered-lines > tbody > tr,
1897 tr.diffskip > td.chunkctrl,
1898 #fossil-status-bar,
1899 .monospace {
1900 font-family: "MesloLGSDZ Nerd Font Mono", /* 2025 hotness */
1901 "Source Code Pro", /* 2012 hotness */
1902 "Menlo", "Monaco", "SF Mono", /* Safari reverted to Courier in 2022 */
1903 monospace; /* let OS/browser default take over */
 
1904 }
1905
1906 div.markdown > ol.footnotes {
1907 font-size: 90%;
1908 }
@@ -1976,10 +1975,28 @@
1975 }
1976 div.markdown span.notescope:hover,
1977 div.markdown span.notescope:target {
1978 border-bottom: 2px solid gold;
1979 }
1980
1981 /* Cause <dd> elements to be aligned complete to the
1982 ** right of their <dt> on help pages. */
1983 dl.helpOptions {
1984 display: grid;
1985 grid-template-columns: max-content 1fr;
1986 column-gap: 1rem;
1987 }
1988 dl.helpOptions > dt {
1989 grid-column: 1;
1990 }
1991 dl.helpOptions > dd {
1992 grid-column: 2;
1993 margin: 0;
1994 }
1995 div.helpPage blockquote {
1996 margin-left: 0.2em;
1997 }
1998
1999 /* Objects in the "desktoponly" class are invisible on mobile */
2000 @media screen and (max-width: 600px) {
2001 .desktoponly {
2002 display: none;
2003
+2 -2
--- src/delta.c
+++ src/delta.c
@@ -316,11 +316,11 @@
316316
**
317317
** The last term is of the form
318318
**
319319
** NNN;
320320
**
321
-** In this case, NNN is a 32-bit bigendian checksum of the output file
321
+** In this case, NNN is a 32-bit big endian checksum of the output file
322322
** that can be used to verify that the delta applied correctly. All
323323
** numbers are in base-64.
324324
**
325325
** Pure text files generate a pure text delta. Binary files generate a
326326
** delta that may contain some binary data.
@@ -602,11 +602,11 @@
602602
total += cnt;
603603
if( total>limit ){
604604
/* ERROR: copy exceeds output file size */
605605
return -1;
606606
}
607
- if( (int)(ofst+cnt) > lenSrc ){
607
+ if( (u64)ofst+(u64)cnt > (u64)lenSrc ){
608608
/* ERROR: copy extends past end of input */
609609
return -1;
610610
}
611611
memcpy(zOut, &zSrc[ofst], cnt);
612612
zOut += cnt;
613613
--- src/delta.c
+++ src/delta.c
@@ -316,11 +316,11 @@
316 **
317 ** The last term is of the form
318 **
319 ** NNN;
320 **
321 ** In this case, NNN is a 32-bit bigendian checksum of the output file
322 ** that can be used to verify that the delta applied correctly. All
323 ** numbers are in base-64.
324 **
325 ** Pure text files generate a pure text delta. Binary files generate a
326 ** delta that may contain some binary data.
@@ -602,11 +602,11 @@
602 total += cnt;
603 if( total>limit ){
604 /* ERROR: copy exceeds output file size */
605 return -1;
606 }
607 if( (int)(ofst+cnt) > lenSrc ){
608 /* ERROR: copy extends past end of input */
609 return -1;
610 }
611 memcpy(zOut, &zSrc[ofst], cnt);
612 zOut += cnt;
613
--- src/delta.c
+++ src/delta.c
@@ -316,11 +316,11 @@
316 **
317 ** The last term is of the form
318 **
319 ** NNN;
320 **
321 ** In this case, NNN is a 32-bit big endian checksum of the output file
322 ** that can be used to verify that the delta applied correctly. All
323 ** numbers are in base-64.
324 **
325 ** Pure text files generate a pure text delta. Binary files generate a
326 ** delta that may contain some binary data.
@@ -602,11 +602,11 @@
602 total += cnt;
603 if( total>limit ){
604 /* ERROR: copy exceeds output file size */
605 return -1;
606 }
607 if( (u64)ofst+(u64)cnt > (u64)lenSrc ){
608 /* ERROR: copy extends past end of input */
609 return -1;
610 }
611 memcpy(zOut, &zSrc[ofst], cnt);
612 zOut += cnt;
613
--- src/descendants.c
+++ src/descendants.c
@@ -159,11 +159,11 @@
159159
}
160160
}
161161
162162
/*
163163
** If RID refers to a check-in, return the mtime of that check-in - the
164
-** julian day number of when the check-in occurred.
164
+** Julian day number of when the check-in occurred.
165165
*/
166166
double mtime_of_rid(int rid, double mtime){
167167
static Stmt q;
168168
db_static_prepare(&q,"SELECT mtime FROM event WHERE objid=:rid");
169169
db_bind_int(&q, ":rid", rid);
170170
--- src/descendants.c
+++ src/descendants.c
@@ -159,11 +159,11 @@
159 }
160 }
161
162 /*
163 ** If RID refers to a check-in, return the mtime of that check-in - the
164 ** julian day number of when the check-in occurred.
165 */
166 double mtime_of_rid(int rid, double mtime){
167 static Stmt q;
168 db_static_prepare(&q,"SELECT mtime FROM event WHERE objid=:rid");
169 db_bind_int(&q, ":rid", rid);
170
--- src/descendants.c
+++ src/descendants.c
@@ -159,11 +159,11 @@
159 }
160 }
161
162 /*
163 ** If RID refers to a check-in, return the mtime of that check-in - the
164 ** Julian day number of when the check-in occurred.
165 */
166 double mtime_of_rid(int rid, double mtime){
167 static Stmt q;
168 db_static_prepare(&q,"SELECT mtime FROM event WHERE objid=:rid");
169 db_bind_int(&q, ":rid", rid);
170
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -1045,11 +1045,11 @@
10451045
10461046
/************************* DiffBuilderDebug ********************************/
10471047
/* This version of DiffBuilder is used for debugging the diff and diff
10481048
** diff formatter logic. It is accessed using the (undocumented) --debug
10491049
** option to the diff command. The output is human-readable text that
1050
-** describes the various method calls that are invoked agains the DiffBuilder
1050
+** describes the various method calls that are invoked against the DiffBuilder
10511051
** object.
10521052
*/
10531053
static void dfdebugSkip(DiffBuilder *p, unsigned int n, int isFinal){
10541054
blob_appendf(p->pOut, "SKIP %d (%d..%d left and %d..%d right)%s\n",
10551055
n, p->lnLeft+1, p->lnLeft+n, p->lnRight+1, p->lnRight+n,
10561056
--- src/diff.c
+++ src/diff.c
@@ -1045,11 +1045,11 @@
1045
1046 /************************* DiffBuilderDebug ********************************/
1047 /* This version of DiffBuilder is used for debugging the diff and diff
1048 ** diff formatter logic. It is accessed using the (undocumented) --debug
1049 ** option to the diff command. The output is human-readable text that
1050 ** describes the various method calls that are invoked agains the DiffBuilder
1051 ** object.
1052 */
1053 static void dfdebugSkip(DiffBuilder *p, unsigned int n, int isFinal){
1054 blob_appendf(p->pOut, "SKIP %d (%d..%d left and %d..%d right)%s\n",
1055 n, p->lnLeft+1, p->lnLeft+n, p->lnRight+1, p->lnRight+n,
1056
--- src/diff.c
+++ src/diff.c
@@ -1045,11 +1045,11 @@
1045
1046 /************************* DiffBuilderDebug ********************************/
1047 /* This version of DiffBuilder is used for debugging the diff and diff
1048 ** diff formatter logic. It is accessed using the (undocumented) --debug
1049 ** option to the diff command. The output is human-readable text that
1050 ** describes the various method calls that are invoked against the DiffBuilder
1051 ** object.
1052 */
1053 static void dfdebugSkip(DiffBuilder *p, unsigned int n, int isFinal){
1054 blob_appendf(p->pOut, "SKIP %d (%d..%d left and %d..%d right)%s\n",
1055 n, p->lnLeft+1, p->lnLeft+n, p->lnRight+1, p->lnRight+n,
1056
+5 -5
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -212,11 +212,11 @@
212212
blob_appendf(pOut, "%.*c %.*s %.*c versus %.*c %.*s %.*c\n",
213213
(w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=',
214214
(w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '=');
215215
}
216216
}else{
217
- blob_appendf(pOut, "--- %s\n+++ %s\n", zLeft, zRight);
217
+ blob_appendf(pOut, "--- %s\t\n+++ %s\t\n", zLeft, zRight);
218218
}
219219
}
220220
221221
222222
/*
@@ -813,11 +813,11 @@
813813
Blob *pOut /* Blob to output diff instead of stdout */
814814
){
815815
int vid;
816816
Blob sql;
817817
Stmt q;
818
- int asNewFile; /* Treat non-existant files as empty files */
818
+ int asNewFile; /* Treat non-existent files as empty files */
819819
int isNumStat; /* True for --numstat */
820820
821821
asNewFile = (pCfg->diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT|DIFF_HTML))!=0;
822822
isNumStat = (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_TCL|DIFF_HTML))!=0;
823823
vid = db_lget_int("checkout", 0);
@@ -1329,11 +1329,11 @@
13291329
**
13301330
** The "--binary" option causes files matching the glob PATTERN to be treated
13311331
** as binary when considering if they should be used with the external diff
13321332
** program. This option overrides the "binary-glob" setting.
13331333
**
1334
-** These command show differences between managed files. Use the "fossil xdiff"
1334
+** These commands show differences between managed files. Use the "fossil xdiff"
13351335
** command to see differences in unmanaged files.
13361336
**
13371337
** Options:
13381338
** --binary PATTERN Treat files that match the glob PATTERN
13391339
** as binary
@@ -1357,12 +1357,12 @@
13571357
** --invert Invert the diff
13581358
** --json Output formatted as JSON
13591359
** -n|--linenum Show line numbers
13601360
** -N|--new-file Alias for --verbose
13611361
** -s|--numstat Show the number of added and deleted lines per
1362
-** file, omitting the diff. When combined with
1363
-** --brief, show only the total row.
1362
+** file, omitting the diff. When combined
1363
+** with --brief, show only the total row.
13641364
** -y|--side-by-side Side-by-side diff
13651365
** --strip-trailing-cr Strip trailing CR
13661366
** --tcl Tcl-formatted output used internally by --tk
13671367
** --tclsh PATH Tcl/Tk shell used for --tk (default: "tclsh")
13681368
** --tk Launch a Tcl/Tk GUI for display
13691369
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -212,11 +212,11 @@
212 blob_appendf(pOut, "%.*c %.*s %.*c versus %.*c %.*s %.*c\n",
213 (w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=',
214 (w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '=');
215 }
216 }else{
217 blob_appendf(pOut, "--- %s\n+++ %s\n", zLeft, zRight);
218 }
219 }
220
221
222 /*
@@ -813,11 +813,11 @@
813 Blob *pOut /* Blob to output diff instead of stdout */
814 ){
815 int vid;
816 Blob sql;
817 Stmt q;
818 int asNewFile; /* Treat non-existant files as empty files */
819 int isNumStat; /* True for --numstat */
820
821 asNewFile = (pCfg->diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT|DIFF_HTML))!=0;
822 isNumStat = (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_TCL|DIFF_HTML))!=0;
823 vid = db_lget_int("checkout", 0);
@@ -1329,11 +1329,11 @@
1329 **
1330 ** The "--binary" option causes files matching the glob PATTERN to be treated
1331 ** as binary when considering if they should be used with the external diff
1332 ** program. This option overrides the "binary-glob" setting.
1333 **
1334 ** These command show differences between managed files. Use the "fossil xdiff"
1335 ** command to see differences in unmanaged files.
1336 **
1337 ** Options:
1338 ** --binary PATTERN Treat files that match the glob PATTERN
1339 ** as binary
@@ -1357,12 +1357,12 @@
1357 ** --invert Invert the diff
1358 ** --json Output formatted as JSON
1359 ** -n|--linenum Show line numbers
1360 ** -N|--new-file Alias for --verbose
1361 ** -s|--numstat Show the number of added and deleted lines per
1362 ** file, omitting the diff. When combined with
1363 ** --brief, show only the total row.
1364 ** -y|--side-by-side Side-by-side diff
1365 ** --strip-trailing-cr Strip trailing CR
1366 ** --tcl Tcl-formatted output used internally by --tk
1367 ** --tclsh PATH Tcl/Tk shell used for --tk (default: "tclsh")
1368 ** --tk Launch a Tcl/Tk GUI for display
1369
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -212,11 +212,11 @@
212 blob_appendf(pOut, "%.*c %.*s %.*c versus %.*c %.*s %.*c\n",
213 (w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=',
214 (w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '=');
215 }
216 }else{
217 blob_appendf(pOut, "--- %s\t\n+++ %s\t\n", zLeft, zRight);
218 }
219 }
220
221
222 /*
@@ -813,11 +813,11 @@
813 Blob *pOut /* Blob to output diff instead of stdout */
814 ){
815 int vid;
816 Blob sql;
817 Stmt q;
818 int asNewFile; /* Treat non-existent files as empty files */
819 int isNumStat; /* True for --numstat */
820
821 asNewFile = (pCfg->diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT|DIFF_HTML))!=0;
822 isNumStat = (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_TCL|DIFF_HTML))!=0;
823 vid = db_lget_int("checkout", 0);
@@ -1329,11 +1329,11 @@
1329 **
1330 ** The "--binary" option causes files matching the glob PATTERN to be treated
1331 ** as binary when considering if they should be used with the external diff
1332 ** program. This option overrides the "binary-glob" setting.
1333 **
1334 ** These commands show differences between managed files. Use the "fossil xdiff"
1335 ** command to see differences in unmanaged files.
1336 **
1337 ** Options:
1338 ** --binary PATTERN Treat files that match the glob PATTERN
1339 ** as binary
@@ -1357,12 +1357,12 @@
1357 ** --invert Invert the diff
1358 ** --json Output formatted as JSON
1359 ** -n|--linenum Show line numbers
1360 ** -N|--new-file Alias for --verbose
1361 ** -s|--numstat Show the number of added and deleted lines per
1362 ** file, omitting the diff. When combined
1363 ** with --brief, show only the total row.
1364 ** -y|--side-by-side Side-by-side diff
1365 ** --strip-trailing-cr Strip trailing CR
1366 ** --tcl Tcl-formatted output used internally by --tk
1367 ** --tclsh PATH Tcl/Tk shell used for --tk (default: "tclsh")
1368 ** --tk Launch a Tcl/Tk GUI for display
1369
+116 -64
--- src/dispatch.c
+++ src/dispatch.c
@@ -25,11 +25,11 @@
2525
#include "dispatch.h"
2626
2727
#if INTERFACE
2828
/*
2929
** An instance of this object defines everything we need to know about an
30
-** individual command, webpage, or setting.
30
+** individual command, webpage, setting, or help topic.
3131
*/
3232
struct CmdOrPage {
3333
const char *zName; /* Name. Webpages start with "/". Commands do not */
3434
void (*xFunc)(void); /* Implementation function, or NULL for settings */
3535
const char *zHelp; /* Raw help text */
@@ -39,31 +39,32 @@
3939
4040
/***************************************************************************
4141
** These macros must match similar macros in mkindex.c
4242
** Allowed values for CmdOrPage.eCmdFlags.
4343
*/
44
-#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
45
-#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
46
-#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
47
-#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
48
-#define CMDFLAG_COMMAND 0x0010 /* A command */
49
-#define CMDFLAG_SETTING 0x0020 /* A setting */
50
-#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
51
-#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
52
-#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
53
-#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
54
-/* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
55
-#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
56
-#define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
57
-#define CMDFLAG_ALIAS 0x2000 /* Command aliases */
58
-#define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */
59
-#define CMDFLAG_ABBREVSUBCMD 0x8000 /* Help text abbreviates subcommands */
44
+#define CMDFLAG_1ST_TIER 0x000001 /* Most important commands */
45
+#define CMDFLAG_2ND_TIER 0x000002 /* Obscure and seldom used commands */
46
+#define CMDFLAG_TEST 0x000004 /* Commands for testing only */
47
+#define CMDFLAG_WEBPAGE 0x000008 /* Web pages */
48
+#define CMDFLAG_COMMAND 0x000010 /* A command */
49
+#define CMDFLAG_SETTING 0x000020 /* A setting */
50
+#define CMDFLAG_VERSIONABLE 0x000040 /* A versionable setting */
51
+#define CMDFLAG_BLOCKTEXT 0x000080 /* Multi-line text setting */
52
+#define CMDFLAG_BOOLEAN 0x000100 /* A boolean setting */
53
+#define CMDFLAG_RAWCONTENT 0x000200 /* Do not interpret POST content */
54
+/* NOTE: 0x000400 = CMDFLAG_SENSITIVE in mkindex.c! */
55
+#define CMDFLAG_HIDDEN 0x000800 /* Elide from most listings */
56
+#define CMDFLAG_LDAVG_EXEMPT 0x001000 /* Exempt from load_control() */
57
+#define CMDFLAG_ALIAS 0x002000 /* Command aliases */
58
+#define CMDFLAG_KEEPEMPTY 0x004000 /* Do not unset empty settings */
59
+#define CMDFLAG_ABBREVSUBCMD 0x008000 /* Help text abbreviates subcommands */
60
+#define CMDFLAG_TOPIC 0x010000 /* A help topic */
6061
/**************************************************************************/
6162
6263
/* Values for the 2nd parameter to dispatch_name_search() */
63
-#define CMDFLAG_ANY 0x0038 /* Match anything */
64
-#define CMDFLAG_PREFIX 0x0200 /* Prefix match is OK */
64
+#define CMDFLAG_ANY 0x010038 /* Match anything */
65
+#define CMDFLAG_PREFIX 0x000200 /* Prefix match is OK */
6566
6667
#endif /* INTERFACE */
6768
6869
/*
6970
** The page_index.h file contains the definition for aCommand[] - an array
@@ -461,11 +462,15 @@
461462
|| hasGap(zHelp+nIndent,i-nIndent) ){
462463
iLevel++;
463464
aIndent[iLevel] = nIndent;
464465
azEnd[iLevel] = zEndDL;
465466
wantP = 0;
466
- blob_append(pHtml, "<blockquote><dl>\n", -1);
467
+ if( isDT ){
468
+ blob_append(pHtml, "<blockquote><dl>\n", -1);
469
+ }else{
470
+ blob_append(pHtml, "<blockquote><dl class=\"helpOptions\">\n", -1);
471
+ }
467472
}else if( azEnd[iLevel]==zEndDL ){
468473
iLevel++;
469474
aIndent[iLevel] = nIndent;
470475
azEnd[iLevel] = zEndDD;
471476
if( wantP ){
@@ -578,10 +583,11 @@
578583
if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n");
579584
if( mask & CMDFLAG_ALIAS ) fossil_print(" * Aliases\n");
580585
if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n");
581586
if( mask & CMDFLAG_WEBPAGE ) fossil_print(" * Web pages\n");
582587
if( mask & CMDFLAG_SETTING ) fossil_print(" * Settings\n");
588
+ if( mask & CMDFLAG_TOPIC ) fossil_print(" * Help Topic\n");
583589
if( useHtml ){
584590
fossil_print("-->\n");
585591
fossil_print("<!-- start_all_help -->\n");
586592
}else{
587593
fossil_print("---\n");
@@ -644,10 +650,11 @@
644650
** Defaults to just the CLI commands. Specify --www to see only the
645651
** web pages, or --everything to see both commands and pages.
646652
**
647653
** Options:
648654
** -a|--aliases Show aliases
655
+** -c|--topics Show help topics
649656
** -e|--everything Show all commands and pages. Omit aliases to
650657
** avoid duplicates.
651658
** -h|--html Transform output to HTML
652659
** -o|--options Show global options
653660
** -r|--raw No output formatting
@@ -663,20 +670,23 @@
663670
if( find_option("www","w",0) ){
664671
mask = CMDFLAG_WEBPAGE;
665672
}
666673
if( find_option("everything","e",0) ){
667674
mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
668
- CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST;
675
+ CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC;
669676
}
670677
if( find_option("settings","s",0) ){
671678
mask = CMDFLAG_SETTING;
672679
}
673680
if( find_option("aliases","a",0) ){
674681
mask = CMDFLAG_ALIAS;
675682
}
676683
if( find_option("test","t",0) ){
677684
mask |= CMDFLAG_TEST;
685
+ }
686
+ if( find_option("topics","c",0) ){
687
+ mask |= CMDFLAG_TOPIC;
678688
}
679689
display_all_help(mask, useHtml, rawOut);
680690
}
681691
682692
/*
@@ -710,10 +720,12 @@
710720
countCmds( CMDFLAG_TEST ));
711721
fossil_print("web-pages: %4d\n",
712722
countCmds( CMDFLAG_WEBPAGE ));
713723
fossil_print("settings: %4d\n",
714724
countCmds( CMDFLAG_SETTING ));
725
+ fossil_print("help-topics: %4d\n",
726
+ countCmds( CMDFLAG_TOPIC ));
715727
fossil_print("total entries: %4d\n", MX_COMMAND);
716728
}
717729
718730
/*
719731
** Compute an estimate of the edit-distance between to input strings.
@@ -892,10 +904,12 @@
892904
/* Some of the webpages require query parameters in order to work.
893905
** @ <h1>The "<a href='%R%s(zCmd)'>%s(zCmd)</a>" page:</h1> */
894906
@ <h1>The "%h(pCmd->zName)" page:</h1>
895907
}else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_SETTING)!=0 ){
896908
@ <h1>The "%h(pCmd->zName)" setting:</h1>
909
+ }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_TOPIC)!=0 ){
910
+ @ <h1>The "%h(pCmd->zName)" help topic:</h1>
897911
}else{
898912
@ <h1>The "%h(pCmd->zName)" command:</h1>
899913
}
900914
if( rc==1 || (rc==2 && zCmd[0]=='/') ){
901915
if( zCmd && help_is_platform_command(zCmd) ){
@@ -933,11 +947,11 @@
933947
int bktHelp[FOSSIL_MX_CMDIDX][MX_HELP_DUP] = {{0}};/* Help str->commands */
934948
style_header("Help");
935949
search_screen(SRCH_HELP, 0x02);
936950
937951
@ <a name='commands'></a>
938
- @ <h1>Available commands:</h1>
952
+ @ <h1>Commands:</h1>
939953
@ <div class="columns" style="column-width: %s(zWidth);">
940954
@ <ul>
941955
/* Fill in help string buckets */
942956
for(i=0; i<MX_COMMAND; i++){
943957
if(aCommand[i].eCmdFlags & CMDFLAG_HIDDEN) continue;
@@ -946,11 +960,13 @@
946960
for(i=0; i<MX_COMMAND; i++){
947961
const char *z = aCommand[i].zName;
948962
const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
949963
const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
950964
if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
951
- if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
965
+ if( (aCommand[i].eCmdFlags & (CMDFLAG_SETTING|CMDFLAG_TOPIC))!=0 ){
966
+ continue;
967
+ }
952968
else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
953969
else if( (aCommand[i].eCmdFlags & CMDFLAG_ALIAS)!=0 ) continue;
954970
@ <li><a href="%R/help/%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a>
955971
/* Output aliases */
956972
if( occHelp[aCommand[i].iHelp] > 1 ){
@@ -978,11 +994,11 @@
978994
}
979995
980996
@ </ul></div>
981997
982998
@ <a name='webpages'></a>
983
- @ <h1>Available web UI pages:</h1>
999
+ @ <h1>Web pages:</h1>
9841000
@ <div class="columns" style="column-width: %s(zWidth);">
9851001
@ <ul>
9861002
for(i=0; i<MX_COMMAND; i++){
9871003
const char *z = aCommand[i].zName;
9881004
if( '/'!=*z ) continue;
@@ -993,33 +1009,48 @@
9931009
@ <li>%s(z+1)</li>
9941010
}
9951011
}
9961012
@ </ul></div>
9971013
998
- @ <a name='unsupported'></a>
999
- @ <h1>Unsupported commands:</h1>
1014
+ @ <a name='settings'></a>
1015
+ @ <h1>Settings:</h1>
10001016
@ <div class="columns" style="column-width: %s(zWidth);">
10011017
@ <ul>
10021018
for(i=0; i<MX_COMMAND; i++){
10031019
const char *z = aCommand[i].zName;
1004
- if( strncmp(z,"test",4)!=0 ) continue;
1020
+ if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
10051021
else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
10061022
if( aCommand[i].zHelp[0] ){
10071023
@ <li><a href="%R/help/%s(z)">%s(z)</a></li>
10081024
}else{
10091025
@ <li>%s(z)</li>
10101026
}
10111027
}
10121028
@ </ul></div>
10131029
1014
- @ <a name='settings'></a>
1015
- @ <h1>Settings:</h1>
1030
+ @ <a name='topics'></a>
1031
+ @ <h1>Other Miscellaneous Help Topics:</h1>
1032
+ @ <div class="columns" style="column-width: %s(zWidth);">
1033
+ @ <ul>
1034
+ for(i=0; i<MX_COMMAND; i++){
1035
+ const char *z = aCommand[i].zName;
1036
+ if( (aCommand[i].eCmdFlags & CMDFLAG_TOPIC)==0 ) continue;
1037
+ if( aCommand[i].zHelp[0] ){
1038
+ @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1039
+ }else{
1040
+ @ <li>%s(z)</li>
1041
+ }
1042
+ }
1043
+ @ </ul></div>
1044
+
1045
+ @ <a name='unsupported'></a>
1046
+ @ <h1>Unsupported and Testing Commands:</h1>
10161047
@ <div class="columns" style="column-width: %s(zWidth);">
10171048
@ <ul>
10181049
for(i=0; i<MX_COMMAND; i++){
10191050
const char *z = aCommand[i].zName;
1020
- if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
1051
+ if( strncmp(z,"test",4)!=0 ) continue;
10211052
else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
10221053
if( aCommand[i].zHelp[0] ){
10231054
@ <li><a href="%R/help/%s(z)">%s(z)</a></li>
10241055
}else{
10251056
@ <li>%s(z)</li>
@@ -1059,10 +1090,12 @@
10591090
zDesc = "2nd tier command";
10601091
}else if( e & CMDFLAG_ALIAS ){
10611092
zDesc = "alias";
10621093
}else if( e & CMDFLAG_TEST ){
10631094
zDesc = "test command";
1095
+ }else if( e & CMDFLAG_TOPIC ){
1096
+ zDesc = "help-topic";
10641097
}else if( e & CMDFLAG_WEBPAGE ){
10651098
if( e & CMDFLAG_RAWCONTENT ){
10661099
zDesc = "raw-content web page";
10671100
}else{
10681101
zDesc = "web page";
@@ -1155,11 +1188,11 @@
11551188
Blob *pOut, /* Write simplified help text here */
11561189
const char *zTopic, /* TOPIC */
11571190
const char *zSubtopic, /* SUBTOPIC */
11581191
int bAbbrevSubcmd /* True if z[] contains abbreviated subcommands */
11591192
){
1160
- Blob in, line; //, subsection;
1193
+ Blob in, line;/*, subsection;*/
11611194
int n = 0;
11621195
char *zQTop = re_quote(zTopic);
11631196
char *zQSub = re_quote(zSubtopic);
11641197
char *zPattern;
11651198
ReCompiled *pRe = 0;
@@ -1392,37 +1425,45 @@
13921425
multi_column_list(aCmd, nCmd);
13931426
}
13941427
}
13951428
13961429
/*
1397
-** Documentation on universal command-line options.
1430
+** TOPIC: options
1431
+**
1432
+** Command-line options common to all commands:
1433
+**
1434
+** --args FILENAME Read additional arguments and options from FILENAME
1435
+** --case-sensitive BOOL Set case sensitivity for file names
1436
+** --cgitrace Active CGI tracing
1437
+** --chdir PATH Change to PATH before performing any operations
1438
+** --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1439
+** --errorlog FILENAME Log errors to FILENAME
1440
+** -?|--help Show help on the command rather than running it
1441
+** --httptrace Trace outbound HTTP requests
1442
+** --localtime Display times using the local timezone
1443
+** --nocgi Do not act as CGI
1444
+** --no-th-hook Do not run TH1 hooks
1445
+** --quiet Reduce the amount of output
1446
+** --sqlstats Show SQL usage statistics when done
1447
+** --sqltrace Trace all SQL commands
1448
+** --sshtrace Trace SSH activity
1449
+** --ssl-identity NAME Set the SSL identity to NAME
1450
+** --systemtrace Trace calls to system()
1451
+** -U|--user USER Make the default user be USER
1452
+** --utc Display times using UTC
1453
+** --vfs NAME Cause SQLite to use the NAME VFS
1454
+**
1455
+** Additional options available on most commands that use network I/O:
1456
+**
1457
+** --accept-any-cert Disable server SSL cdert validation. Accept any SSL
1458
+** cert that the server provides. WARNING: Unsafe!
1459
+** Testing and debugging use only!
1460
+** --ipv4 Use only IPv4. Disable IPv6 support.
1461
+** --ipv6 Use only IPv6. Disable IPv4 support.
1462
+** --nosync Disable autosync for the current command.
1463
+** --proxy URL Specify the HTTP proxy to use. URL can be "off".
13981464
*/
1399
-/* @-comment: # */
1400
-static const char zOptions[] =
1401
-@ Command-line options common to all commands:
1402
-@
1403
-@ --args FILENAME Read additional arguments and options from FILENAME
1404
-@ --case-sensitive BOOL Set case sensitivity for file names
1405
-@ --cgitrace Active CGI tracing
1406
-@ --chdir PATH Change to PATH before performing any operations
1407
-@ --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1408
-@ --errorlog FILENAME Log errors to FILENAME
1409
-@ -?|--help Show help on the command rather than running it
1410
-@ --httptrace Trace outbound HTTP requests
1411
-@ --localtime Display times using the local timezone
1412
-@ --nocgi Do not act as CGI
1413
-@ --no-th-hook Do not run TH1 hooks
1414
-@ --quiet Reduce the amount of output
1415
-@ --sqlstats Show SQL usage statistics when done
1416
-@ --sqltrace Trace all SQL commands
1417
-@ --sshtrace Trace SSH activity
1418
-@ --ssl-identity NAME Set the SSL identity to NAME
1419
-@ --systemtrace Trace calls to system()
1420
-@ -U|--user USER Make the default user be USER
1421
-@ --utc Display times using UTC
1422
-@ --vfs NAME Cause SQLite to use the NAME VFS
1423
-;
14241465
14251466
/*
14261467
** COMMAND: help
14271468
**
14281469
** Usage: %fossil help [OPTIONS] [TOPIC] [SUBCOMMAND]
@@ -1499,21 +1540,26 @@
14991540
return;
15001541
}
15011542
else if( find_option("setting","s",0) ){
15021543
command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
15031544
return;
1545
+ }
1546
+ else if( find_option("topic","c",0) ){
1547
+ command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
1548
+ return;
15041549
}
15051550
else if( find_option("full","f",0) ){
15061551
fossil_print("fossil commands:\n\n");
15071552
command_list(CMDFLAG_1ST_TIER, verboseFlag, useHtml);
15081553
fossil_print("\nfossil auxiliary commands:\n\n");
15091554
command_list(CMDFLAG_2ND_TIER, verboseFlag, useHtml);
1510
- fossil_print("\n%s", zOptions);
15111555
fossil_print("\nfossil settings:\n\n");
15121556
command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
15131557
fossil_print("\nfossil web pages:\n\n");
15141558
command_list(CMDFLAG_WEBPAGE, verboseFlag, useHtml);
1559
+ fossil_print("\nfossil miscellaneous help topics:\n\n");
1560
+ command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
15151561
fossil_print("\nfossil test commands (unsupported):\n\n");
15161562
command_list(CMDFLAG_TEST, verboseFlag, useHtml);
15171563
if ( !verboseFlag ) {
15181564
fossil_print("\n");
15191565
version_cmd();
@@ -1520,18 +1566,23 @@
15201566
}
15211567
return;
15221568
}
15231569
else if( find_option("everything","e",0) ){
15241570
display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
1525
- CMDFLAG_SETTING | CMDFLAG_TEST, useHtml, 0);
1571
+ CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC,
1572
+ useHtml, 0);
15261573
return;
15271574
}
15281575
verify_all_options();
1576
+ zCmdOrPage = "help topic";
15291577
if( g.argc<3 ){
15301578
if( bOptions ){
1531
- fossil_print("%s", zOptions);
1532
- return;
1579
+ zTopic = "options";
1580
+ zSubtopic = 0;
1581
+ mask = CMDFLAG_TOPIC;
1582
+ bOptions = 0;
1583
+ goto find_and_show_help;
15331584
}
15341585
z = g.argv[0];
15351586
fossil_print(
15361587
"Usage: %s help TOPIC\n"
15371588
"Things to try:\n\n"
@@ -1551,14 +1602,13 @@
15511602
if( isPage ){
15521603
zCmdOrPage = "page";
15531604
}else if( commandsFlag ){
15541605
mask = CMDFLAG_COMMAND;
15551606
zCmdOrPage = "command";
1556
- }else{
1557
- zCmdOrPage = "command or setting";
15581607
}
1559
- rc = dispatch_name_search(g.argv[2], mask|CMDFLAG_PREFIX, &pCmd);
1608
+find_and_show_help:
1609
+ rc = dispatch_name_search(zTopic, mask|CMDFLAG_PREFIX, &pCmd);
15601610
if( rc ){
15611611
int i, n;
15621612
const char *az[5];
15631613
if( rc==1 ){
15641614
if( help_is_platform_command(g.argv[2]) ){
@@ -1796,10 +1846,12 @@
17961846
zType = "command";
17971847
}else if( pPage->eCmdFlags & CMDFLAG_WEBPAGE ){
17981848
zType = "webpage";
17991849
}else if( pPage->eCmdFlags & CMDFLAG_SETTING ){
18001850
zType = "setting";
1851
+ }else if( pPage->eCmdFlags & CMDFLAG_TOPIC ){
1852
+ zType = "help-topic";
18011853
}
18021854
sqlite3_result_text(ctx, zType, -1, SQLITE_STATIC);
18031855
break;
18041856
}
18051857
case 2: /* flags */
18061858
--- src/dispatch.c
+++ src/dispatch.c
@@ -25,11 +25,11 @@
25 #include "dispatch.h"
26
27 #if INTERFACE
28 /*
29 ** An instance of this object defines everything we need to know about an
30 ** individual command, webpage, or setting.
31 */
32 struct CmdOrPage {
33 const char *zName; /* Name. Webpages start with "/". Commands do not */
34 void (*xFunc)(void); /* Implementation function, or NULL for settings */
35 const char *zHelp; /* Raw help text */
@@ -39,31 +39,32 @@
39
40 /***************************************************************************
41 ** These macros must match similar macros in mkindex.c
42 ** Allowed values for CmdOrPage.eCmdFlags.
43 */
44 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
45 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
46 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
47 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
48 #define CMDFLAG_COMMAND 0x0010 /* A command */
49 #define CMDFLAG_SETTING 0x0020 /* A setting */
50 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
51 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
52 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
53 #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
54 /* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
55 #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
56 #define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
57 #define CMDFLAG_ALIAS 0x2000 /* Command aliases */
58 #define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */
59 #define CMDFLAG_ABBREVSUBCMD 0x8000 /* Help text abbreviates subcommands */
 
60 /**************************************************************************/
61
62 /* Values for the 2nd parameter to dispatch_name_search() */
63 #define CMDFLAG_ANY 0x0038 /* Match anything */
64 #define CMDFLAG_PREFIX 0x0200 /* Prefix match is OK */
65
66 #endif /* INTERFACE */
67
68 /*
69 ** The page_index.h file contains the definition for aCommand[] - an array
@@ -461,11 +462,15 @@
461 || hasGap(zHelp+nIndent,i-nIndent) ){
462 iLevel++;
463 aIndent[iLevel] = nIndent;
464 azEnd[iLevel] = zEndDL;
465 wantP = 0;
466 blob_append(pHtml, "<blockquote><dl>\n", -1);
 
 
 
 
467 }else if( azEnd[iLevel]==zEndDL ){
468 iLevel++;
469 aIndent[iLevel] = nIndent;
470 azEnd[iLevel] = zEndDD;
471 if( wantP ){
@@ -578,10 +583,11 @@
578 if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n");
579 if( mask & CMDFLAG_ALIAS ) fossil_print(" * Aliases\n");
580 if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n");
581 if( mask & CMDFLAG_WEBPAGE ) fossil_print(" * Web pages\n");
582 if( mask & CMDFLAG_SETTING ) fossil_print(" * Settings\n");
 
583 if( useHtml ){
584 fossil_print("-->\n");
585 fossil_print("<!-- start_all_help -->\n");
586 }else{
587 fossil_print("---\n");
@@ -644,10 +650,11 @@
644 ** Defaults to just the CLI commands. Specify --www to see only the
645 ** web pages, or --everything to see both commands and pages.
646 **
647 ** Options:
648 ** -a|--aliases Show aliases
 
649 ** -e|--everything Show all commands and pages. Omit aliases to
650 ** avoid duplicates.
651 ** -h|--html Transform output to HTML
652 ** -o|--options Show global options
653 ** -r|--raw No output formatting
@@ -663,20 +670,23 @@
663 if( find_option("www","w",0) ){
664 mask = CMDFLAG_WEBPAGE;
665 }
666 if( find_option("everything","e",0) ){
667 mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
668 CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST;
669 }
670 if( find_option("settings","s",0) ){
671 mask = CMDFLAG_SETTING;
672 }
673 if( find_option("aliases","a",0) ){
674 mask = CMDFLAG_ALIAS;
675 }
676 if( find_option("test","t",0) ){
677 mask |= CMDFLAG_TEST;
 
 
 
678 }
679 display_all_help(mask, useHtml, rawOut);
680 }
681
682 /*
@@ -710,10 +720,12 @@
710 countCmds( CMDFLAG_TEST ));
711 fossil_print("web-pages: %4d\n",
712 countCmds( CMDFLAG_WEBPAGE ));
713 fossil_print("settings: %4d\n",
714 countCmds( CMDFLAG_SETTING ));
 
 
715 fossil_print("total entries: %4d\n", MX_COMMAND);
716 }
717
718 /*
719 ** Compute an estimate of the edit-distance between to input strings.
@@ -892,10 +904,12 @@
892 /* Some of the webpages require query parameters in order to work.
893 ** @ <h1>The "<a href='%R%s(zCmd)'>%s(zCmd)</a>" page:</h1> */
894 @ <h1>The "%h(pCmd->zName)" page:</h1>
895 }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_SETTING)!=0 ){
896 @ <h1>The "%h(pCmd->zName)" setting:</h1>
 
 
897 }else{
898 @ <h1>The "%h(pCmd->zName)" command:</h1>
899 }
900 if( rc==1 || (rc==2 && zCmd[0]=='/') ){
901 if( zCmd && help_is_platform_command(zCmd) ){
@@ -933,11 +947,11 @@
933 int bktHelp[FOSSIL_MX_CMDIDX][MX_HELP_DUP] = {{0}};/* Help str->commands */
934 style_header("Help");
935 search_screen(SRCH_HELP, 0x02);
936
937 @ <a name='commands'></a>
938 @ <h1>Available commands:</h1>
939 @ <div class="columns" style="column-width: %s(zWidth);">
940 @ <ul>
941 /* Fill in help string buckets */
942 for(i=0; i<MX_COMMAND; i++){
943 if(aCommand[i].eCmdFlags & CMDFLAG_HIDDEN) continue;
@@ -946,11 +960,13 @@
946 for(i=0; i<MX_COMMAND; i++){
947 const char *z = aCommand[i].zName;
948 const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
949 const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
950 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
951 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
 
 
952 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
953 else if( (aCommand[i].eCmdFlags & CMDFLAG_ALIAS)!=0 ) continue;
954 @ <li><a href="%R/help/%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a>
955 /* Output aliases */
956 if( occHelp[aCommand[i].iHelp] > 1 ){
@@ -978,11 +994,11 @@
978 }
979
980 @ </ul></div>
981
982 @ <a name='webpages'></a>
983 @ <h1>Available web UI pages:</h1>
984 @ <div class="columns" style="column-width: %s(zWidth);">
985 @ <ul>
986 for(i=0; i<MX_COMMAND; i++){
987 const char *z = aCommand[i].zName;
988 if( '/'!=*z ) continue;
@@ -993,33 +1009,48 @@
993 @ <li>%s(z+1)</li>
994 }
995 }
996 @ </ul></div>
997
998 @ <a name='unsupported'></a>
999 @ <h1>Unsupported commands:</h1>
1000 @ <div class="columns" style="column-width: %s(zWidth);">
1001 @ <ul>
1002 for(i=0; i<MX_COMMAND; i++){
1003 const char *z = aCommand[i].zName;
1004 if( strncmp(z,"test",4)!=0 ) continue;
1005 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1006 if( aCommand[i].zHelp[0] ){
1007 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1008 }else{
1009 @ <li>%s(z)</li>
1010 }
1011 }
1012 @ </ul></div>
1013
1014 @ <a name='settings'></a>
1015 @ <h1>Settings:</h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1016 @ <div class="columns" style="column-width: %s(zWidth);">
1017 @ <ul>
1018 for(i=0; i<MX_COMMAND; i++){
1019 const char *z = aCommand[i].zName;
1020 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
1021 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1022 if( aCommand[i].zHelp[0] ){
1023 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1024 }else{
1025 @ <li>%s(z)</li>
@@ -1059,10 +1090,12 @@
1059 zDesc = "2nd tier command";
1060 }else if( e & CMDFLAG_ALIAS ){
1061 zDesc = "alias";
1062 }else if( e & CMDFLAG_TEST ){
1063 zDesc = "test command";
 
 
1064 }else if( e & CMDFLAG_WEBPAGE ){
1065 if( e & CMDFLAG_RAWCONTENT ){
1066 zDesc = "raw-content web page";
1067 }else{
1068 zDesc = "web page";
@@ -1155,11 +1188,11 @@
1155 Blob *pOut, /* Write simplified help text here */
1156 const char *zTopic, /* TOPIC */
1157 const char *zSubtopic, /* SUBTOPIC */
1158 int bAbbrevSubcmd /* True if z[] contains abbreviated subcommands */
1159 ){
1160 Blob in, line; //, subsection;
1161 int n = 0;
1162 char *zQTop = re_quote(zTopic);
1163 char *zQSub = re_quote(zSubtopic);
1164 char *zPattern;
1165 ReCompiled *pRe = 0;
@@ -1392,37 +1425,45 @@
1392 multi_column_list(aCmd, nCmd);
1393 }
1394 }
1395
1396 /*
1397 ** Documentation on universal command-line options.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1398 */
1399 /* @-comment: # */
1400 static const char zOptions[] =
1401 @ Command-line options common to all commands:
1402 @
1403 @ --args FILENAME Read additional arguments and options from FILENAME
1404 @ --case-sensitive BOOL Set case sensitivity for file names
1405 @ --cgitrace Active CGI tracing
1406 @ --chdir PATH Change to PATH before performing any operations
1407 @ --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1408 @ --errorlog FILENAME Log errors to FILENAME
1409 @ -?|--help Show help on the command rather than running it
1410 @ --httptrace Trace outbound HTTP requests
1411 @ --localtime Display times using the local timezone
1412 @ --nocgi Do not act as CGI
1413 @ --no-th-hook Do not run TH1 hooks
1414 @ --quiet Reduce the amount of output
1415 @ --sqlstats Show SQL usage statistics when done
1416 @ --sqltrace Trace all SQL commands
1417 @ --sshtrace Trace SSH activity
1418 @ --ssl-identity NAME Set the SSL identity to NAME
1419 @ --systemtrace Trace calls to system()
1420 @ -U|--user USER Make the default user be USER
1421 @ --utc Display times using UTC
1422 @ --vfs NAME Cause SQLite to use the NAME VFS
1423 ;
1424
1425 /*
1426 ** COMMAND: help
1427 **
1428 ** Usage: %fossil help [OPTIONS] [TOPIC] [SUBCOMMAND]
@@ -1499,21 +1540,26 @@
1499 return;
1500 }
1501 else if( find_option("setting","s",0) ){
1502 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1503 return;
 
 
 
 
1504 }
1505 else if( find_option("full","f",0) ){
1506 fossil_print("fossil commands:\n\n");
1507 command_list(CMDFLAG_1ST_TIER, verboseFlag, useHtml);
1508 fossil_print("\nfossil auxiliary commands:\n\n");
1509 command_list(CMDFLAG_2ND_TIER, verboseFlag, useHtml);
1510 fossil_print("\n%s", zOptions);
1511 fossil_print("\nfossil settings:\n\n");
1512 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1513 fossil_print("\nfossil web pages:\n\n");
1514 command_list(CMDFLAG_WEBPAGE, verboseFlag, useHtml);
 
 
1515 fossil_print("\nfossil test commands (unsupported):\n\n");
1516 command_list(CMDFLAG_TEST, verboseFlag, useHtml);
1517 if ( !verboseFlag ) {
1518 fossil_print("\n");
1519 version_cmd();
@@ -1520,18 +1566,23 @@
1520 }
1521 return;
1522 }
1523 else if( find_option("everything","e",0) ){
1524 display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
1525 CMDFLAG_SETTING | CMDFLAG_TEST, useHtml, 0);
 
1526 return;
1527 }
1528 verify_all_options();
 
1529 if( g.argc<3 ){
1530 if( bOptions ){
1531 fossil_print("%s", zOptions);
1532 return;
 
 
 
1533 }
1534 z = g.argv[0];
1535 fossil_print(
1536 "Usage: %s help TOPIC\n"
1537 "Things to try:\n\n"
@@ -1551,14 +1602,13 @@
1551 if( isPage ){
1552 zCmdOrPage = "page";
1553 }else if( commandsFlag ){
1554 mask = CMDFLAG_COMMAND;
1555 zCmdOrPage = "command";
1556 }else{
1557 zCmdOrPage = "command or setting";
1558 }
1559 rc = dispatch_name_search(g.argv[2], mask|CMDFLAG_PREFIX, &pCmd);
 
1560 if( rc ){
1561 int i, n;
1562 const char *az[5];
1563 if( rc==1 ){
1564 if( help_is_platform_command(g.argv[2]) ){
@@ -1796,10 +1846,12 @@
1796 zType = "command";
1797 }else if( pPage->eCmdFlags & CMDFLAG_WEBPAGE ){
1798 zType = "webpage";
1799 }else if( pPage->eCmdFlags & CMDFLAG_SETTING ){
1800 zType = "setting";
 
 
1801 }
1802 sqlite3_result_text(ctx, zType, -1, SQLITE_STATIC);
1803 break;
1804 }
1805 case 2: /* flags */
1806
--- src/dispatch.c
+++ src/dispatch.c
@@ -25,11 +25,11 @@
25 #include "dispatch.h"
26
27 #if INTERFACE
28 /*
29 ** An instance of this object defines everything we need to know about an
30 ** individual command, webpage, setting, or help topic.
31 */
32 struct CmdOrPage {
33 const char *zName; /* Name. Webpages start with "/". Commands do not */
34 void (*xFunc)(void); /* Implementation function, or NULL for settings */
35 const char *zHelp; /* Raw help text */
@@ -39,31 +39,32 @@
39
40 /***************************************************************************
41 ** These macros must match similar macros in mkindex.c
42 ** Allowed values for CmdOrPage.eCmdFlags.
43 */
44 #define CMDFLAG_1ST_TIER 0x000001 /* Most important commands */
45 #define CMDFLAG_2ND_TIER 0x000002 /* Obscure and seldom used commands */
46 #define CMDFLAG_TEST 0x000004 /* Commands for testing only */
47 #define CMDFLAG_WEBPAGE 0x000008 /* Web pages */
48 #define CMDFLAG_COMMAND 0x000010 /* A command */
49 #define CMDFLAG_SETTING 0x000020 /* A setting */
50 #define CMDFLAG_VERSIONABLE 0x000040 /* A versionable setting */
51 #define CMDFLAG_BLOCKTEXT 0x000080 /* Multi-line text setting */
52 #define CMDFLAG_BOOLEAN 0x000100 /* A boolean setting */
53 #define CMDFLAG_RAWCONTENT 0x000200 /* Do not interpret POST content */
54 /* NOTE: 0x000400 = CMDFLAG_SENSITIVE in mkindex.c! */
55 #define CMDFLAG_HIDDEN 0x000800 /* Elide from most listings */
56 #define CMDFLAG_LDAVG_EXEMPT 0x001000 /* Exempt from load_control() */
57 #define CMDFLAG_ALIAS 0x002000 /* Command aliases */
58 #define CMDFLAG_KEEPEMPTY 0x004000 /* Do not unset empty settings */
59 #define CMDFLAG_ABBREVSUBCMD 0x008000 /* Help text abbreviates subcommands */
60 #define CMDFLAG_TOPIC 0x010000 /* A help topic */
61 /**************************************************************************/
62
63 /* Values for the 2nd parameter to dispatch_name_search() */
64 #define CMDFLAG_ANY 0x010038 /* Match anything */
65 #define CMDFLAG_PREFIX 0x000200 /* Prefix match is OK */
66
67 #endif /* INTERFACE */
68
69 /*
70 ** The page_index.h file contains the definition for aCommand[] - an array
@@ -461,11 +462,15 @@
462 || hasGap(zHelp+nIndent,i-nIndent) ){
463 iLevel++;
464 aIndent[iLevel] = nIndent;
465 azEnd[iLevel] = zEndDL;
466 wantP = 0;
467 if( isDT ){
468 blob_append(pHtml, "<blockquote><dl>\n", -1);
469 }else{
470 blob_append(pHtml, "<blockquote><dl class=\"helpOptions\">\n", -1);
471 }
472 }else if( azEnd[iLevel]==zEndDL ){
473 iLevel++;
474 aIndent[iLevel] = nIndent;
475 azEnd[iLevel] = zEndDD;
476 if( wantP ){
@@ -578,10 +583,11 @@
583 if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n");
584 if( mask & CMDFLAG_ALIAS ) fossil_print(" * Aliases\n");
585 if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n");
586 if( mask & CMDFLAG_WEBPAGE ) fossil_print(" * Web pages\n");
587 if( mask & CMDFLAG_SETTING ) fossil_print(" * Settings\n");
588 if( mask & CMDFLAG_TOPIC ) fossil_print(" * Help Topic\n");
589 if( useHtml ){
590 fossil_print("-->\n");
591 fossil_print("<!-- start_all_help -->\n");
592 }else{
593 fossil_print("---\n");
@@ -644,10 +650,11 @@
650 ** Defaults to just the CLI commands. Specify --www to see only the
651 ** web pages, or --everything to see both commands and pages.
652 **
653 ** Options:
654 ** -a|--aliases Show aliases
655 ** -c|--topics Show help topics
656 ** -e|--everything Show all commands and pages. Omit aliases to
657 ** avoid duplicates.
658 ** -h|--html Transform output to HTML
659 ** -o|--options Show global options
660 ** -r|--raw No output formatting
@@ -663,20 +670,23 @@
670 if( find_option("www","w",0) ){
671 mask = CMDFLAG_WEBPAGE;
672 }
673 if( find_option("everything","e",0) ){
674 mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
675 CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC;
676 }
677 if( find_option("settings","s",0) ){
678 mask = CMDFLAG_SETTING;
679 }
680 if( find_option("aliases","a",0) ){
681 mask = CMDFLAG_ALIAS;
682 }
683 if( find_option("test","t",0) ){
684 mask |= CMDFLAG_TEST;
685 }
686 if( find_option("topics","c",0) ){
687 mask |= CMDFLAG_TOPIC;
688 }
689 display_all_help(mask, useHtml, rawOut);
690 }
691
692 /*
@@ -710,10 +720,12 @@
720 countCmds( CMDFLAG_TEST ));
721 fossil_print("web-pages: %4d\n",
722 countCmds( CMDFLAG_WEBPAGE ));
723 fossil_print("settings: %4d\n",
724 countCmds( CMDFLAG_SETTING ));
725 fossil_print("help-topics: %4d\n",
726 countCmds( CMDFLAG_TOPIC ));
727 fossil_print("total entries: %4d\n", MX_COMMAND);
728 }
729
730 /*
731 ** Compute an estimate of the edit-distance between to input strings.
@@ -892,10 +904,12 @@
904 /* Some of the webpages require query parameters in order to work.
905 ** @ <h1>The "<a href='%R%s(zCmd)'>%s(zCmd)</a>" page:</h1> */
906 @ <h1>The "%h(pCmd->zName)" page:</h1>
907 }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_SETTING)!=0 ){
908 @ <h1>The "%h(pCmd->zName)" setting:</h1>
909 }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_TOPIC)!=0 ){
910 @ <h1>The "%h(pCmd->zName)" help topic:</h1>
911 }else{
912 @ <h1>The "%h(pCmd->zName)" command:</h1>
913 }
914 if( rc==1 || (rc==2 && zCmd[0]=='/') ){
915 if( zCmd && help_is_platform_command(zCmd) ){
@@ -933,11 +947,11 @@
947 int bktHelp[FOSSIL_MX_CMDIDX][MX_HELP_DUP] = {{0}};/* Help str->commands */
948 style_header("Help");
949 search_screen(SRCH_HELP, 0x02);
950
951 @ <a name='commands'></a>
952 @ <h1>Commands:</h1>
953 @ <div class="columns" style="column-width: %s(zWidth);">
954 @ <ul>
955 /* Fill in help string buckets */
956 for(i=0; i<MX_COMMAND; i++){
957 if(aCommand[i].eCmdFlags & CMDFLAG_HIDDEN) continue;
@@ -946,11 +960,13 @@
960 for(i=0; i<MX_COMMAND; i++){
961 const char *z = aCommand[i].zName;
962 const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
963 const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
964 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
965 if( (aCommand[i].eCmdFlags & (CMDFLAG_SETTING|CMDFLAG_TOPIC))!=0 ){
966 continue;
967 }
968 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
969 else if( (aCommand[i].eCmdFlags & CMDFLAG_ALIAS)!=0 ) continue;
970 @ <li><a href="%R/help/%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a>
971 /* Output aliases */
972 if( occHelp[aCommand[i].iHelp] > 1 ){
@@ -978,11 +994,11 @@
994 }
995
996 @ </ul></div>
997
998 @ <a name='webpages'></a>
999 @ <h1>Web pages:</h1>
1000 @ <div class="columns" style="column-width: %s(zWidth);">
1001 @ <ul>
1002 for(i=0; i<MX_COMMAND; i++){
1003 const char *z = aCommand[i].zName;
1004 if( '/'!=*z ) continue;
@@ -993,33 +1009,48 @@
1009 @ <li>%s(z+1)</li>
1010 }
1011 }
1012 @ </ul></div>
1013
1014 @ <a name='settings'></a>
1015 @ <h1>Settings:</h1>
1016 @ <div class="columns" style="column-width: %s(zWidth);">
1017 @ <ul>
1018 for(i=0; i<MX_COMMAND; i++){
1019 const char *z = aCommand[i].zName;
1020 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
1021 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1022 if( aCommand[i].zHelp[0] ){
1023 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1024 }else{
1025 @ <li>%s(z)</li>
1026 }
1027 }
1028 @ </ul></div>
1029
1030 @ <a name='topics'></a>
1031 @ <h1>Other Miscellaneous Help Topics:</h1>
1032 @ <div class="columns" style="column-width: %s(zWidth);">
1033 @ <ul>
1034 for(i=0; i<MX_COMMAND; i++){
1035 const char *z = aCommand[i].zName;
1036 if( (aCommand[i].eCmdFlags & CMDFLAG_TOPIC)==0 ) continue;
1037 if( aCommand[i].zHelp[0] ){
1038 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1039 }else{
1040 @ <li>%s(z)</li>
1041 }
1042 }
1043 @ </ul></div>
1044
1045 @ <a name='unsupported'></a>
1046 @ <h1>Unsupported and Testing Commands:</h1>
1047 @ <div class="columns" style="column-width: %s(zWidth);">
1048 @ <ul>
1049 for(i=0; i<MX_COMMAND; i++){
1050 const char *z = aCommand[i].zName;
1051 if( strncmp(z,"test",4)!=0 ) continue;
1052 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1053 if( aCommand[i].zHelp[0] ){
1054 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1055 }else{
1056 @ <li>%s(z)</li>
@@ -1059,10 +1090,12 @@
1090 zDesc = "2nd tier command";
1091 }else if( e & CMDFLAG_ALIAS ){
1092 zDesc = "alias";
1093 }else if( e & CMDFLAG_TEST ){
1094 zDesc = "test command";
1095 }else if( e & CMDFLAG_TOPIC ){
1096 zDesc = "help-topic";
1097 }else if( e & CMDFLAG_WEBPAGE ){
1098 if( e & CMDFLAG_RAWCONTENT ){
1099 zDesc = "raw-content web page";
1100 }else{
1101 zDesc = "web page";
@@ -1155,11 +1188,11 @@
1188 Blob *pOut, /* Write simplified help text here */
1189 const char *zTopic, /* TOPIC */
1190 const char *zSubtopic, /* SUBTOPIC */
1191 int bAbbrevSubcmd /* True if z[] contains abbreviated subcommands */
1192 ){
1193 Blob in, line;/*, subsection;*/
1194 int n = 0;
1195 char *zQTop = re_quote(zTopic);
1196 char *zQSub = re_quote(zSubtopic);
1197 char *zPattern;
1198 ReCompiled *pRe = 0;
@@ -1392,37 +1425,45 @@
1425 multi_column_list(aCmd, nCmd);
1426 }
1427 }
1428
1429 /*
1430 ** TOPIC: options
1431 **
1432 ** Command-line options common to all commands:
1433 **
1434 ** --args FILENAME Read additional arguments and options from FILENAME
1435 ** --case-sensitive BOOL Set case sensitivity for file names
1436 ** --cgitrace Active CGI tracing
1437 ** --chdir PATH Change to PATH before performing any operations
1438 ** --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1439 ** --errorlog FILENAME Log errors to FILENAME
1440 ** -?|--help Show help on the command rather than running it
1441 ** --httptrace Trace outbound HTTP requests
1442 ** --localtime Display times using the local timezone
1443 ** --nocgi Do not act as CGI
1444 ** --no-th-hook Do not run TH1 hooks
1445 ** --quiet Reduce the amount of output
1446 ** --sqlstats Show SQL usage statistics when done
1447 ** --sqltrace Trace all SQL commands
1448 ** --sshtrace Trace SSH activity
1449 ** --ssl-identity NAME Set the SSL identity to NAME
1450 ** --systemtrace Trace calls to system()
1451 ** -U|--user USER Make the default user be USER
1452 ** --utc Display times using UTC
1453 ** --vfs NAME Cause SQLite to use the NAME VFS
1454 **
1455 ** Additional options available on most commands that use network I/O:
1456 **
1457 ** --accept-any-cert Disable server SSL cdert validation. Accept any SSL
1458 ** cert that the server provides. WARNING: Unsafe!
1459 ** Testing and debugging use only!
1460 ** --ipv4 Use only IPv4. Disable IPv6 support.
1461 ** --ipv6 Use only IPv6. Disable IPv4 support.
1462 ** --nosync Disable autosync for the current command.
1463 ** --proxy URL Specify the HTTP proxy to use. URL can be "off".
1464 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1465
1466 /*
1467 ** COMMAND: help
1468 **
1469 ** Usage: %fossil help [OPTIONS] [TOPIC] [SUBCOMMAND]
@@ -1499,21 +1540,26 @@
1540 return;
1541 }
1542 else if( find_option("setting","s",0) ){
1543 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1544 return;
1545 }
1546 else if( find_option("topic","c",0) ){
1547 command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
1548 return;
1549 }
1550 else if( find_option("full","f",0) ){
1551 fossil_print("fossil commands:\n\n");
1552 command_list(CMDFLAG_1ST_TIER, verboseFlag, useHtml);
1553 fossil_print("\nfossil auxiliary commands:\n\n");
1554 command_list(CMDFLAG_2ND_TIER, verboseFlag, useHtml);
 
1555 fossil_print("\nfossil settings:\n\n");
1556 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1557 fossil_print("\nfossil web pages:\n\n");
1558 command_list(CMDFLAG_WEBPAGE, verboseFlag, useHtml);
1559 fossil_print("\nfossil miscellaneous help topics:\n\n");
1560 command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
1561 fossil_print("\nfossil test commands (unsupported):\n\n");
1562 command_list(CMDFLAG_TEST, verboseFlag, useHtml);
1563 if ( !verboseFlag ) {
1564 fossil_print("\n");
1565 version_cmd();
@@ -1520,18 +1566,23 @@
1566 }
1567 return;
1568 }
1569 else if( find_option("everything","e",0) ){
1570 display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
1571 CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC,
1572 useHtml, 0);
1573 return;
1574 }
1575 verify_all_options();
1576 zCmdOrPage = "help topic";
1577 if( g.argc<3 ){
1578 if( bOptions ){
1579 zTopic = "options";
1580 zSubtopic = 0;
1581 mask = CMDFLAG_TOPIC;
1582 bOptions = 0;
1583 goto find_and_show_help;
1584 }
1585 z = g.argv[0];
1586 fossil_print(
1587 "Usage: %s help TOPIC\n"
1588 "Things to try:\n\n"
@@ -1551,14 +1602,13 @@
1602 if( isPage ){
1603 zCmdOrPage = "page";
1604 }else if( commandsFlag ){
1605 mask = CMDFLAG_COMMAND;
1606 zCmdOrPage = "command";
 
 
1607 }
1608 find_and_show_help:
1609 rc = dispatch_name_search(zTopic, mask|CMDFLAG_PREFIX, &pCmd);
1610 if( rc ){
1611 int i, n;
1612 const char *az[5];
1613 if( rc==1 ){
1614 if( help_is_platform_command(g.argv[2]) ){
@@ -1796,10 +1846,12 @@
1846 zType = "command";
1847 }else if( pPage->eCmdFlags & CMDFLAG_WEBPAGE ){
1848 zType = "webpage";
1849 }else if( pPage->eCmdFlags & CMDFLAG_SETTING ){
1850 zType = "setting";
1851 }else if( pPage->eCmdFlags & CMDFLAG_TOPIC ){
1852 zType = "help-topic";
1853 }
1854 sqlite3_result_text(ctx, zType, -1, SQLITE_STATIC);
1855 break;
1856 }
1857 case 2: /* flags */
1858
+116 -64
--- src/dispatch.c
+++ src/dispatch.c
@@ -25,11 +25,11 @@
2525
#include "dispatch.h"
2626
2727
#if INTERFACE
2828
/*
2929
** An instance of this object defines everything we need to know about an
30
-** individual command, webpage, or setting.
30
+** individual command, webpage, setting, or help topic.
3131
*/
3232
struct CmdOrPage {
3333
const char *zName; /* Name. Webpages start with "/". Commands do not */
3434
void (*xFunc)(void); /* Implementation function, or NULL for settings */
3535
const char *zHelp; /* Raw help text */
@@ -39,31 +39,32 @@
3939
4040
/***************************************************************************
4141
** These macros must match similar macros in mkindex.c
4242
** Allowed values for CmdOrPage.eCmdFlags.
4343
*/
44
-#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
45
-#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
46
-#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
47
-#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
48
-#define CMDFLAG_COMMAND 0x0010 /* A command */
49
-#define CMDFLAG_SETTING 0x0020 /* A setting */
50
-#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
51
-#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
52
-#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
53
-#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
54
-/* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
55
-#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
56
-#define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
57
-#define CMDFLAG_ALIAS 0x2000 /* Command aliases */
58
-#define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */
59
-#define CMDFLAG_ABBREVSUBCMD 0x8000 /* Help text abbreviates subcommands */
44
+#define CMDFLAG_1ST_TIER 0x000001 /* Most important commands */
45
+#define CMDFLAG_2ND_TIER 0x000002 /* Obscure and seldom used commands */
46
+#define CMDFLAG_TEST 0x000004 /* Commands for testing only */
47
+#define CMDFLAG_WEBPAGE 0x000008 /* Web pages */
48
+#define CMDFLAG_COMMAND 0x000010 /* A command */
49
+#define CMDFLAG_SETTING 0x000020 /* A setting */
50
+#define CMDFLAG_VERSIONABLE 0x000040 /* A versionable setting */
51
+#define CMDFLAG_BLOCKTEXT 0x000080 /* Multi-line text setting */
52
+#define CMDFLAG_BOOLEAN 0x000100 /* A boolean setting */
53
+#define CMDFLAG_RAWCONTENT 0x000200 /* Do not interpret POST content */
54
+/* NOTE: 0x000400 = CMDFLAG_SENSITIVE in mkindex.c! */
55
+#define CMDFLAG_HIDDEN 0x000800 /* Elide from most listings */
56
+#define CMDFLAG_LDAVG_EXEMPT 0x001000 /* Exempt from load_control() */
57
+#define CMDFLAG_ALIAS 0x002000 /* Command aliases */
58
+#define CMDFLAG_KEEPEMPTY 0x004000 /* Do not unset empty settings */
59
+#define CMDFLAG_ABBREVSUBCMD 0x008000 /* Help text abbreviates subcommands */
60
+#define CMDFLAG_TOPIC 0x010000 /* A help topic */
6061
/**************************************************************************/
6162
6263
/* Values for the 2nd parameter to dispatch_name_search() */
63
-#define CMDFLAG_ANY 0x0038 /* Match anything */
64
-#define CMDFLAG_PREFIX 0x0200 /* Prefix match is OK */
64
+#define CMDFLAG_ANY 0x010038 /* Match anything */
65
+#define CMDFLAG_PREFIX 0x000200 /* Prefix match is OK */
6566
6667
#endif /* INTERFACE */
6768
6869
/*
6970
** The page_index.h file contains the definition for aCommand[] - an array
@@ -461,11 +462,15 @@
461462
|| hasGap(zHelp+nIndent,i-nIndent) ){
462463
iLevel++;
463464
aIndent[iLevel] = nIndent;
464465
azEnd[iLevel] = zEndDL;
465466
wantP = 0;
466
- blob_append(pHtml, "<blockquote><dl>\n", -1);
467
+ if( isDT ){
468
+ blob_append(pHtml, "<blockquote><dl>\n", -1);
469
+ }else{
470
+ blob_append(pHtml, "<blockquote><dl class=\"helpOptions\">\n", -1);
471
+ }
467472
}else if( azEnd[iLevel]==zEndDL ){
468473
iLevel++;
469474
aIndent[iLevel] = nIndent;
470475
azEnd[iLevel] = zEndDD;
471476
if( wantP ){
@@ -578,10 +583,11 @@
578583
if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n");
579584
if( mask & CMDFLAG_ALIAS ) fossil_print(" * Aliases\n");
580585
if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n");
581586
if( mask & CMDFLAG_WEBPAGE ) fossil_print(" * Web pages\n");
582587
if( mask & CMDFLAG_SETTING ) fossil_print(" * Settings\n");
588
+ if( mask & CMDFLAG_TOPIC ) fossil_print(" * Help Topic\n");
583589
if( useHtml ){
584590
fossil_print("-->\n");
585591
fossil_print("<!-- start_all_help -->\n");
586592
}else{
587593
fossil_print("---\n");
@@ -644,10 +650,11 @@
644650
** Defaults to just the CLI commands. Specify --www to see only the
645651
** web pages, or --everything to see both commands and pages.
646652
**
647653
** Options:
648654
** -a|--aliases Show aliases
655
+** -c|--topics Show help topics
649656
** -e|--everything Show all commands and pages. Omit aliases to
650657
** avoid duplicates.
651658
** -h|--html Transform output to HTML
652659
** -o|--options Show global options
653660
** -r|--raw No output formatting
@@ -663,20 +670,23 @@
663670
if( find_option("www","w",0) ){
664671
mask = CMDFLAG_WEBPAGE;
665672
}
666673
if( find_option("everything","e",0) ){
667674
mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
668
- CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST;
675
+ CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC;
669676
}
670677
if( find_option("settings","s",0) ){
671678
mask = CMDFLAG_SETTING;
672679
}
673680
if( find_option("aliases","a",0) ){
674681
mask = CMDFLAG_ALIAS;
675682
}
676683
if( find_option("test","t",0) ){
677684
mask |= CMDFLAG_TEST;
685
+ }
686
+ if( find_option("topics","c",0) ){
687
+ mask |= CMDFLAG_TOPIC;
678688
}
679689
display_all_help(mask, useHtml, rawOut);
680690
}
681691
682692
/*
@@ -710,10 +720,12 @@
710720
countCmds( CMDFLAG_TEST ));
711721
fossil_print("web-pages: %4d\n",
712722
countCmds( CMDFLAG_WEBPAGE ));
713723
fossil_print("settings: %4d\n",
714724
countCmds( CMDFLAG_SETTING ));
725
+ fossil_print("help-topics: %4d\n",
726
+ countCmds( CMDFLAG_TOPIC ));
715727
fossil_print("total entries: %4d\n", MX_COMMAND);
716728
}
717729
718730
/*
719731
** Compute an estimate of the edit-distance between to input strings.
@@ -892,10 +904,12 @@
892904
/* Some of the webpages require query parameters in order to work.
893905
** @ <h1>The "<a href='%R%s(zCmd)'>%s(zCmd)</a>" page:</h1> */
894906
@ <h1>The "%h(pCmd->zName)" page:</h1>
895907
}else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_SETTING)!=0 ){
896908
@ <h1>The "%h(pCmd->zName)" setting:</h1>
909
+ }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_TOPIC)!=0 ){
910
+ @ <h1>The "%h(pCmd->zName)" help topic:</h1>
897911
}else{
898912
@ <h1>The "%h(pCmd->zName)" command:</h1>
899913
}
900914
if( rc==1 || (rc==2 && zCmd[0]=='/') ){
901915
if( zCmd && help_is_platform_command(zCmd) ){
@@ -933,11 +947,11 @@
933947
int bktHelp[FOSSIL_MX_CMDIDX][MX_HELP_DUP] = {{0}};/* Help str->commands */
934948
style_header("Help");
935949
search_screen(SRCH_HELP, 0x02);
936950
937951
@ <a name='commands'></a>
938
- @ <h1>Available commands:</h1>
952
+ @ <h1>Commands:</h1>
939953
@ <div class="columns" style="column-width: %s(zWidth);">
940954
@ <ul>
941955
/* Fill in help string buckets */
942956
for(i=0; i<MX_COMMAND; i++){
943957
if(aCommand[i].eCmdFlags & CMDFLAG_HIDDEN) continue;
@@ -946,11 +960,13 @@
946960
for(i=0; i<MX_COMMAND; i++){
947961
const char *z = aCommand[i].zName;
948962
const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
949963
const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
950964
if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
951
- if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
965
+ if( (aCommand[i].eCmdFlags & (CMDFLAG_SETTING|CMDFLAG_TOPIC))!=0 ){
966
+ continue;
967
+ }
952968
else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
953969
else if( (aCommand[i].eCmdFlags & CMDFLAG_ALIAS)!=0 ) continue;
954970
@ <li><a href="%R/help/%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a>
955971
/* Output aliases */
956972
if( occHelp[aCommand[i].iHelp] > 1 ){
@@ -978,11 +994,11 @@
978994
}
979995
980996
@ </ul></div>
981997
982998
@ <a name='webpages'></a>
983
- @ <h1>Available web UI pages:</h1>
999
+ @ <h1>Web pages:</h1>
9841000
@ <div class="columns" style="column-width: %s(zWidth);">
9851001
@ <ul>
9861002
for(i=0; i<MX_COMMAND; i++){
9871003
const char *z = aCommand[i].zName;
9881004
if( '/'!=*z ) continue;
@@ -993,33 +1009,48 @@
9931009
@ <li>%s(z+1)</li>
9941010
}
9951011
}
9961012
@ </ul></div>
9971013
998
- @ <a name='unsupported'></a>
999
- @ <h1>Unsupported commands:</h1>
1014
+ @ <a name='settings'></a>
1015
+ @ <h1>Settings:</h1>
10001016
@ <div class="columns" style="column-width: %s(zWidth);">
10011017
@ <ul>
10021018
for(i=0; i<MX_COMMAND; i++){
10031019
const char *z = aCommand[i].zName;
1004
- if( strncmp(z,"test",4)!=0 ) continue;
1020
+ if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
10051021
else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
10061022
if( aCommand[i].zHelp[0] ){
10071023
@ <li><a href="%R/help/%s(z)">%s(z)</a></li>
10081024
}else{
10091025
@ <li>%s(z)</li>
10101026
}
10111027
}
10121028
@ </ul></div>
10131029
1014
- @ <a name='settings'></a>
1015
- @ <h1>Settings:</h1>
1030
+ @ <a name='topics'></a>
1031
+ @ <h1>Other Miscellaneous Help Topics:</h1>
1032
+ @ <div class="columns" style="column-width: %s(zWidth);">
1033
+ @ <ul>
1034
+ for(i=0; i<MX_COMMAND; i++){
1035
+ const char *z = aCommand[i].zName;
1036
+ if( (aCommand[i].eCmdFlags & CMDFLAG_TOPIC)==0 ) continue;
1037
+ if( aCommand[i].zHelp[0] ){
1038
+ @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1039
+ }else{
1040
+ @ <li>%s(z)</li>
1041
+ }
1042
+ }
1043
+ @ </ul></div>
1044
+
1045
+ @ <a name='unsupported'></a>
1046
+ @ <h1>Unsupported and Testing Commands:</h1>
10161047
@ <div class="columns" style="column-width: %s(zWidth);">
10171048
@ <ul>
10181049
for(i=0; i<MX_COMMAND; i++){
10191050
const char *z = aCommand[i].zName;
1020
- if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
1051
+ if( strncmp(z,"test",4)!=0 ) continue;
10211052
else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
10221053
if( aCommand[i].zHelp[0] ){
10231054
@ <li><a href="%R/help/%s(z)">%s(z)</a></li>
10241055
}else{
10251056
@ <li>%s(z)</li>
@@ -1059,10 +1090,12 @@
10591090
zDesc = "2nd tier command";
10601091
}else if( e & CMDFLAG_ALIAS ){
10611092
zDesc = "alias";
10621093
}else if( e & CMDFLAG_TEST ){
10631094
zDesc = "test command";
1095
+ }else if( e & CMDFLAG_TOPIC ){
1096
+ zDesc = "help-topic";
10641097
}else if( e & CMDFLAG_WEBPAGE ){
10651098
if( e & CMDFLAG_RAWCONTENT ){
10661099
zDesc = "raw-content web page";
10671100
}else{
10681101
zDesc = "web page";
@@ -1155,11 +1188,11 @@
11551188
Blob *pOut, /* Write simplified help text here */
11561189
const char *zTopic, /* TOPIC */
11571190
const char *zSubtopic, /* SUBTOPIC */
11581191
int bAbbrevSubcmd /* True if z[] contains abbreviated subcommands */
11591192
){
1160
- Blob in, line; //, subsection;
1193
+ Blob in, line;/*, subsection;*/
11611194
int n = 0;
11621195
char *zQTop = re_quote(zTopic);
11631196
char *zQSub = re_quote(zSubtopic);
11641197
char *zPattern;
11651198
ReCompiled *pRe = 0;
@@ -1392,37 +1425,45 @@
13921425
multi_column_list(aCmd, nCmd);
13931426
}
13941427
}
13951428
13961429
/*
1397
-** Documentation on universal command-line options.
1430
+** TOPIC: options
1431
+**
1432
+** Command-line options common to all commands:
1433
+**
1434
+** --args FILENAME Read additional arguments and options from FILENAME
1435
+** --case-sensitive BOOL Set case sensitivity for file names
1436
+** --cgitrace Active CGI tracing
1437
+** --chdir PATH Change to PATH before performing any operations
1438
+** --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1439
+** --errorlog FILENAME Log errors to FILENAME
1440
+** -?|--help Show help on the command rather than running it
1441
+** --httptrace Trace outbound HTTP requests
1442
+** --localtime Display times using the local timezone
1443
+** --nocgi Do not act as CGI
1444
+** --no-th-hook Do not run TH1 hooks
1445
+** --quiet Reduce the amount of output
1446
+** --sqlstats Show SQL usage statistics when done
1447
+** --sqltrace Trace all SQL commands
1448
+** --sshtrace Trace SSH activity
1449
+** --ssl-identity NAME Set the SSL identity to NAME
1450
+** --systemtrace Trace calls to system()
1451
+** -U|--user USER Make the default user be USER
1452
+** --utc Display times using UTC
1453
+** --vfs NAME Cause SQLite to use the NAME VFS
1454
+**
1455
+** Additional options available on most commands that use network I/O:
1456
+**
1457
+** --accept-any-cert Disable server SSL cdert validation. Accept any SSL
1458
+** cert that the server provides. WARNING: Unsafe!
1459
+** Testing and debugging use only!
1460
+** --ipv4 Use only IPv4. Disable IPv6 support.
1461
+** --ipv6 Use only IPv6. Disable IPv4 support.
1462
+** --nosync Disable autosync for the current command.
1463
+** --proxy URL Specify the HTTP proxy to use. URL can be "off".
13981464
*/
1399
-/* @-comment: # */
1400
-static const char zOptions[] =
1401
-@ Command-line options common to all commands:
1402
-@
1403
-@ --args FILENAME Read additional arguments and options from FILENAME
1404
-@ --case-sensitive BOOL Set case sensitivity for file names
1405
-@ --cgitrace Active CGI tracing
1406
-@ --chdir PATH Change to PATH before performing any operations
1407
-@ --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1408
-@ --errorlog FILENAME Log errors to FILENAME
1409
-@ -?|--help Show help on the command rather than running it
1410
-@ --httptrace Trace outbound HTTP requests
1411
-@ --localtime Display times using the local timezone
1412
-@ --nocgi Do not act as CGI
1413
-@ --no-th-hook Do not run TH1 hooks
1414
-@ --quiet Reduce the amount of output
1415
-@ --sqlstats Show SQL usage statistics when done
1416
-@ --sqltrace Trace all SQL commands
1417
-@ --sshtrace Trace SSH activity
1418
-@ --ssl-identity NAME Set the SSL identity to NAME
1419
-@ --systemtrace Trace calls to system()
1420
-@ -U|--user USER Make the default user be USER
1421
-@ --utc Display times using UTC
1422
-@ --vfs NAME Cause SQLite to use the NAME VFS
1423
-;
14241465
14251466
/*
14261467
** COMMAND: help
14271468
**
14281469
** Usage: %fossil help [OPTIONS] [TOPIC] [SUBCOMMAND]
@@ -1499,21 +1540,26 @@
14991540
return;
15001541
}
15011542
else if( find_option("setting","s",0) ){
15021543
command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
15031544
return;
1545
+ }
1546
+ else if( find_option("topic","c",0) ){
1547
+ command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
1548
+ return;
15041549
}
15051550
else if( find_option("full","f",0) ){
15061551
fossil_print("fossil commands:\n\n");
15071552
command_list(CMDFLAG_1ST_TIER, verboseFlag, useHtml);
15081553
fossil_print("\nfossil auxiliary commands:\n\n");
15091554
command_list(CMDFLAG_2ND_TIER, verboseFlag, useHtml);
1510
- fossil_print("\n%s", zOptions);
15111555
fossil_print("\nfossil settings:\n\n");
15121556
command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
15131557
fossil_print("\nfossil web pages:\n\n");
15141558
command_list(CMDFLAG_WEBPAGE, verboseFlag, useHtml);
1559
+ fossil_print("\nfossil miscellaneous help topics:\n\n");
1560
+ command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
15151561
fossil_print("\nfossil test commands (unsupported):\n\n");
15161562
command_list(CMDFLAG_TEST, verboseFlag, useHtml);
15171563
if ( !verboseFlag ) {
15181564
fossil_print("\n");
15191565
version_cmd();
@@ -1520,18 +1566,23 @@
15201566
}
15211567
return;
15221568
}
15231569
else if( find_option("everything","e",0) ){
15241570
display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
1525
- CMDFLAG_SETTING | CMDFLAG_TEST, useHtml, 0);
1571
+ CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC,
1572
+ useHtml, 0);
15261573
return;
15271574
}
15281575
verify_all_options();
1576
+ zCmdOrPage = "help topic";
15291577
if( g.argc<3 ){
15301578
if( bOptions ){
1531
- fossil_print("%s", zOptions);
1532
- return;
1579
+ zTopic = "options";
1580
+ zSubtopic = 0;
1581
+ mask = CMDFLAG_TOPIC;
1582
+ bOptions = 0;
1583
+ goto find_and_show_help;
15331584
}
15341585
z = g.argv[0];
15351586
fossil_print(
15361587
"Usage: %s help TOPIC\n"
15371588
"Things to try:\n\n"
@@ -1551,14 +1602,13 @@
15511602
if( isPage ){
15521603
zCmdOrPage = "page";
15531604
}else if( commandsFlag ){
15541605
mask = CMDFLAG_COMMAND;
15551606
zCmdOrPage = "command";
1556
- }else{
1557
- zCmdOrPage = "command or setting";
15581607
}
1559
- rc = dispatch_name_search(g.argv[2], mask|CMDFLAG_PREFIX, &pCmd);
1608
+find_and_show_help:
1609
+ rc = dispatch_name_search(zTopic, mask|CMDFLAG_PREFIX, &pCmd);
15601610
if( rc ){
15611611
int i, n;
15621612
const char *az[5];
15631613
if( rc==1 ){
15641614
if( help_is_platform_command(g.argv[2]) ){
@@ -1796,10 +1846,12 @@
17961846
zType = "command";
17971847
}else if( pPage->eCmdFlags & CMDFLAG_WEBPAGE ){
17981848
zType = "webpage";
17991849
}else if( pPage->eCmdFlags & CMDFLAG_SETTING ){
18001850
zType = "setting";
1851
+ }else if( pPage->eCmdFlags & CMDFLAG_TOPIC ){
1852
+ zType = "help-topic";
18011853
}
18021854
sqlite3_result_text(ctx, zType, -1, SQLITE_STATIC);
18031855
break;
18041856
}
18051857
case 2: /* flags */
18061858
--- src/dispatch.c
+++ src/dispatch.c
@@ -25,11 +25,11 @@
25 #include "dispatch.h"
26
27 #if INTERFACE
28 /*
29 ** An instance of this object defines everything we need to know about an
30 ** individual command, webpage, or setting.
31 */
32 struct CmdOrPage {
33 const char *zName; /* Name. Webpages start with "/". Commands do not */
34 void (*xFunc)(void); /* Implementation function, or NULL for settings */
35 const char *zHelp; /* Raw help text */
@@ -39,31 +39,32 @@
39
40 /***************************************************************************
41 ** These macros must match similar macros in mkindex.c
42 ** Allowed values for CmdOrPage.eCmdFlags.
43 */
44 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
45 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
46 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
47 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
48 #define CMDFLAG_COMMAND 0x0010 /* A command */
49 #define CMDFLAG_SETTING 0x0020 /* A setting */
50 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
51 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
52 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
53 #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
54 /* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
55 #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
56 #define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
57 #define CMDFLAG_ALIAS 0x2000 /* Command aliases */
58 #define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */
59 #define CMDFLAG_ABBREVSUBCMD 0x8000 /* Help text abbreviates subcommands */
 
60 /**************************************************************************/
61
62 /* Values for the 2nd parameter to dispatch_name_search() */
63 #define CMDFLAG_ANY 0x0038 /* Match anything */
64 #define CMDFLAG_PREFIX 0x0200 /* Prefix match is OK */
65
66 #endif /* INTERFACE */
67
68 /*
69 ** The page_index.h file contains the definition for aCommand[] - an array
@@ -461,11 +462,15 @@
461 || hasGap(zHelp+nIndent,i-nIndent) ){
462 iLevel++;
463 aIndent[iLevel] = nIndent;
464 azEnd[iLevel] = zEndDL;
465 wantP = 0;
466 blob_append(pHtml, "<blockquote><dl>\n", -1);
 
 
 
 
467 }else if( azEnd[iLevel]==zEndDL ){
468 iLevel++;
469 aIndent[iLevel] = nIndent;
470 azEnd[iLevel] = zEndDD;
471 if( wantP ){
@@ -578,10 +583,11 @@
578 if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n");
579 if( mask & CMDFLAG_ALIAS ) fossil_print(" * Aliases\n");
580 if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n");
581 if( mask & CMDFLAG_WEBPAGE ) fossil_print(" * Web pages\n");
582 if( mask & CMDFLAG_SETTING ) fossil_print(" * Settings\n");
 
583 if( useHtml ){
584 fossil_print("-->\n");
585 fossil_print("<!-- start_all_help -->\n");
586 }else{
587 fossil_print("---\n");
@@ -644,10 +650,11 @@
644 ** Defaults to just the CLI commands. Specify --www to see only the
645 ** web pages, or --everything to see both commands and pages.
646 **
647 ** Options:
648 ** -a|--aliases Show aliases
 
649 ** -e|--everything Show all commands and pages. Omit aliases to
650 ** avoid duplicates.
651 ** -h|--html Transform output to HTML
652 ** -o|--options Show global options
653 ** -r|--raw No output formatting
@@ -663,20 +670,23 @@
663 if( find_option("www","w",0) ){
664 mask = CMDFLAG_WEBPAGE;
665 }
666 if( find_option("everything","e",0) ){
667 mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
668 CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST;
669 }
670 if( find_option("settings","s",0) ){
671 mask = CMDFLAG_SETTING;
672 }
673 if( find_option("aliases","a",0) ){
674 mask = CMDFLAG_ALIAS;
675 }
676 if( find_option("test","t",0) ){
677 mask |= CMDFLAG_TEST;
 
 
 
678 }
679 display_all_help(mask, useHtml, rawOut);
680 }
681
682 /*
@@ -710,10 +720,12 @@
710 countCmds( CMDFLAG_TEST ));
711 fossil_print("web-pages: %4d\n",
712 countCmds( CMDFLAG_WEBPAGE ));
713 fossil_print("settings: %4d\n",
714 countCmds( CMDFLAG_SETTING ));
 
 
715 fossil_print("total entries: %4d\n", MX_COMMAND);
716 }
717
718 /*
719 ** Compute an estimate of the edit-distance between to input strings.
@@ -892,10 +904,12 @@
892 /* Some of the webpages require query parameters in order to work.
893 ** @ <h1>The "<a href='%R%s(zCmd)'>%s(zCmd)</a>" page:</h1> */
894 @ <h1>The "%h(pCmd->zName)" page:</h1>
895 }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_SETTING)!=0 ){
896 @ <h1>The "%h(pCmd->zName)" setting:</h1>
 
 
897 }else{
898 @ <h1>The "%h(pCmd->zName)" command:</h1>
899 }
900 if( rc==1 || (rc==2 && zCmd[0]=='/') ){
901 if( zCmd && help_is_platform_command(zCmd) ){
@@ -933,11 +947,11 @@
933 int bktHelp[FOSSIL_MX_CMDIDX][MX_HELP_DUP] = {{0}};/* Help str->commands */
934 style_header("Help");
935 search_screen(SRCH_HELP, 0x02);
936
937 @ <a name='commands'></a>
938 @ <h1>Available commands:</h1>
939 @ <div class="columns" style="column-width: %s(zWidth);">
940 @ <ul>
941 /* Fill in help string buckets */
942 for(i=0; i<MX_COMMAND; i++){
943 if(aCommand[i].eCmdFlags & CMDFLAG_HIDDEN) continue;
@@ -946,11 +960,13 @@
946 for(i=0; i<MX_COMMAND; i++){
947 const char *z = aCommand[i].zName;
948 const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
949 const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
950 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
951 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue;
 
 
952 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
953 else if( (aCommand[i].eCmdFlags & CMDFLAG_ALIAS)!=0 ) continue;
954 @ <li><a href="%R/help/%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a>
955 /* Output aliases */
956 if( occHelp[aCommand[i].iHelp] > 1 ){
@@ -978,11 +994,11 @@
978 }
979
980 @ </ul></div>
981
982 @ <a name='webpages'></a>
983 @ <h1>Available web UI pages:</h1>
984 @ <div class="columns" style="column-width: %s(zWidth);">
985 @ <ul>
986 for(i=0; i<MX_COMMAND; i++){
987 const char *z = aCommand[i].zName;
988 if( '/'!=*z ) continue;
@@ -993,33 +1009,48 @@
993 @ <li>%s(z+1)</li>
994 }
995 }
996 @ </ul></div>
997
998 @ <a name='unsupported'></a>
999 @ <h1>Unsupported commands:</h1>
1000 @ <div class="columns" style="column-width: %s(zWidth);">
1001 @ <ul>
1002 for(i=0; i<MX_COMMAND; i++){
1003 const char *z = aCommand[i].zName;
1004 if( strncmp(z,"test",4)!=0 ) continue;
1005 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1006 if( aCommand[i].zHelp[0] ){
1007 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1008 }else{
1009 @ <li>%s(z)</li>
1010 }
1011 }
1012 @ </ul></div>
1013
1014 @ <a name='settings'></a>
1015 @ <h1>Settings:</h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1016 @ <div class="columns" style="column-width: %s(zWidth);">
1017 @ <ul>
1018 for(i=0; i<MX_COMMAND; i++){
1019 const char *z = aCommand[i].zName;
1020 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
1021 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1022 if( aCommand[i].zHelp[0] ){
1023 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1024 }else{
1025 @ <li>%s(z)</li>
@@ -1059,10 +1090,12 @@
1059 zDesc = "2nd tier command";
1060 }else if( e & CMDFLAG_ALIAS ){
1061 zDesc = "alias";
1062 }else if( e & CMDFLAG_TEST ){
1063 zDesc = "test command";
 
 
1064 }else if( e & CMDFLAG_WEBPAGE ){
1065 if( e & CMDFLAG_RAWCONTENT ){
1066 zDesc = "raw-content web page";
1067 }else{
1068 zDesc = "web page";
@@ -1155,11 +1188,11 @@
1155 Blob *pOut, /* Write simplified help text here */
1156 const char *zTopic, /* TOPIC */
1157 const char *zSubtopic, /* SUBTOPIC */
1158 int bAbbrevSubcmd /* True if z[] contains abbreviated subcommands */
1159 ){
1160 Blob in, line; //, subsection;
1161 int n = 0;
1162 char *zQTop = re_quote(zTopic);
1163 char *zQSub = re_quote(zSubtopic);
1164 char *zPattern;
1165 ReCompiled *pRe = 0;
@@ -1392,37 +1425,45 @@
1392 multi_column_list(aCmd, nCmd);
1393 }
1394 }
1395
1396 /*
1397 ** Documentation on universal command-line options.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1398 */
1399 /* @-comment: # */
1400 static const char zOptions[] =
1401 @ Command-line options common to all commands:
1402 @
1403 @ --args FILENAME Read additional arguments and options from FILENAME
1404 @ --case-sensitive BOOL Set case sensitivity for file names
1405 @ --cgitrace Active CGI tracing
1406 @ --chdir PATH Change to PATH before performing any operations
1407 @ --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1408 @ --errorlog FILENAME Log errors to FILENAME
1409 @ -?|--help Show help on the command rather than running it
1410 @ --httptrace Trace outbound HTTP requests
1411 @ --localtime Display times using the local timezone
1412 @ --nocgi Do not act as CGI
1413 @ --no-th-hook Do not run TH1 hooks
1414 @ --quiet Reduce the amount of output
1415 @ --sqlstats Show SQL usage statistics when done
1416 @ --sqltrace Trace all SQL commands
1417 @ --sshtrace Trace SSH activity
1418 @ --ssl-identity NAME Set the SSL identity to NAME
1419 @ --systemtrace Trace calls to system()
1420 @ -U|--user USER Make the default user be USER
1421 @ --utc Display times using UTC
1422 @ --vfs NAME Cause SQLite to use the NAME VFS
1423 ;
1424
1425 /*
1426 ** COMMAND: help
1427 **
1428 ** Usage: %fossil help [OPTIONS] [TOPIC] [SUBCOMMAND]
@@ -1499,21 +1540,26 @@
1499 return;
1500 }
1501 else if( find_option("setting","s",0) ){
1502 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1503 return;
 
 
 
 
1504 }
1505 else if( find_option("full","f",0) ){
1506 fossil_print("fossil commands:\n\n");
1507 command_list(CMDFLAG_1ST_TIER, verboseFlag, useHtml);
1508 fossil_print("\nfossil auxiliary commands:\n\n");
1509 command_list(CMDFLAG_2ND_TIER, verboseFlag, useHtml);
1510 fossil_print("\n%s", zOptions);
1511 fossil_print("\nfossil settings:\n\n");
1512 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1513 fossil_print("\nfossil web pages:\n\n");
1514 command_list(CMDFLAG_WEBPAGE, verboseFlag, useHtml);
 
 
1515 fossil_print("\nfossil test commands (unsupported):\n\n");
1516 command_list(CMDFLAG_TEST, verboseFlag, useHtml);
1517 if ( !verboseFlag ) {
1518 fossil_print("\n");
1519 version_cmd();
@@ -1520,18 +1566,23 @@
1520 }
1521 return;
1522 }
1523 else if( find_option("everything","e",0) ){
1524 display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
1525 CMDFLAG_SETTING | CMDFLAG_TEST, useHtml, 0);
 
1526 return;
1527 }
1528 verify_all_options();
 
1529 if( g.argc<3 ){
1530 if( bOptions ){
1531 fossil_print("%s", zOptions);
1532 return;
 
 
 
1533 }
1534 z = g.argv[0];
1535 fossil_print(
1536 "Usage: %s help TOPIC\n"
1537 "Things to try:\n\n"
@@ -1551,14 +1602,13 @@
1551 if( isPage ){
1552 zCmdOrPage = "page";
1553 }else if( commandsFlag ){
1554 mask = CMDFLAG_COMMAND;
1555 zCmdOrPage = "command";
1556 }else{
1557 zCmdOrPage = "command or setting";
1558 }
1559 rc = dispatch_name_search(g.argv[2], mask|CMDFLAG_PREFIX, &pCmd);
 
1560 if( rc ){
1561 int i, n;
1562 const char *az[5];
1563 if( rc==1 ){
1564 if( help_is_platform_command(g.argv[2]) ){
@@ -1796,10 +1846,12 @@
1796 zType = "command";
1797 }else if( pPage->eCmdFlags & CMDFLAG_WEBPAGE ){
1798 zType = "webpage";
1799 }else if( pPage->eCmdFlags & CMDFLAG_SETTING ){
1800 zType = "setting";
 
 
1801 }
1802 sqlite3_result_text(ctx, zType, -1, SQLITE_STATIC);
1803 break;
1804 }
1805 case 2: /* flags */
1806
--- src/dispatch.c
+++ src/dispatch.c
@@ -25,11 +25,11 @@
25 #include "dispatch.h"
26
27 #if INTERFACE
28 /*
29 ** An instance of this object defines everything we need to know about an
30 ** individual command, webpage, setting, or help topic.
31 */
32 struct CmdOrPage {
33 const char *zName; /* Name. Webpages start with "/". Commands do not */
34 void (*xFunc)(void); /* Implementation function, or NULL for settings */
35 const char *zHelp; /* Raw help text */
@@ -39,31 +39,32 @@
39
40 /***************************************************************************
41 ** These macros must match similar macros in mkindex.c
42 ** Allowed values for CmdOrPage.eCmdFlags.
43 */
44 #define CMDFLAG_1ST_TIER 0x000001 /* Most important commands */
45 #define CMDFLAG_2ND_TIER 0x000002 /* Obscure and seldom used commands */
46 #define CMDFLAG_TEST 0x000004 /* Commands for testing only */
47 #define CMDFLAG_WEBPAGE 0x000008 /* Web pages */
48 #define CMDFLAG_COMMAND 0x000010 /* A command */
49 #define CMDFLAG_SETTING 0x000020 /* A setting */
50 #define CMDFLAG_VERSIONABLE 0x000040 /* A versionable setting */
51 #define CMDFLAG_BLOCKTEXT 0x000080 /* Multi-line text setting */
52 #define CMDFLAG_BOOLEAN 0x000100 /* A boolean setting */
53 #define CMDFLAG_RAWCONTENT 0x000200 /* Do not interpret POST content */
54 /* NOTE: 0x000400 = CMDFLAG_SENSITIVE in mkindex.c! */
55 #define CMDFLAG_HIDDEN 0x000800 /* Elide from most listings */
56 #define CMDFLAG_LDAVG_EXEMPT 0x001000 /* Exempt from load_control() */
57 #define CMDFLAG_ALIAS 0x002000 /* Command aliases */
58 #define CMDFLAG_KEEPEMPTY 0x004000 /* Do not unset empty settings */
59 #define CMDFLAG_ABBREVSUBCMD 0x008000 /* Help text abbreviates subcommands */
60 #define CMDFLAG_TOPIC 0x010000 /* A help topic */
61 /**************************************************************************/
62
63 /* Values for the 2nd parameter to dispatch_name_search() */
64 #define CMDFLAG_ANY 0x010038 /* Match anything */
65 #define CMDFLAG_PREFIX 0x000200 /* Prefix match is OK */
66
67 #endif /* INTERFACE */
68
69 /*
70 ** The page_index.h file contains the definition for aCommand[] - an array
@@ -461,11 +462,15 @@
462 || hasGap(zHelp+nIndent,i-nIndent) ){
463 iLevel++;
464 aIndent[iLevel] = nIndent;
465 azEnd[iLevel] = zEndDL;
466 wantP = 0;
467 if( isDT ){
468 blob_append(pHtml, "<blockquote><dl>\n", -1);
469 }else{
470 blob_append(pHtml, "<blockquote><dl class=\"helpOptions\">\n", -1);
471 }
472 }else if( azEnd[iLevel]==zEndDL ){
473 iLevel++;
474 aIndent[iLevel] = nIndent;
475 azEnd[iLevel] = zEndDD;
476 if( wantP ){
@@ -578,10 +583,11 @@
583 if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n");
584 if( mask & CMDFLAG_ALIAS ) fossil_print(" * Aliases\n");
585 if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n");
586 if( mask & CMDFLAG_WEBPAGE ) fossil_print(" * Web pages\n");
587 if( mask & CMDFLAG_SETTING ) fossil_print(" * Settings\n");
588 if( mask & CMDFLAG_TOPIC ) fossil_print(" * Help Topic\n");
589 if( useHtml ){
590 fossil_print("-->\n");
591 fossil_print("<!-- start_all_help -->\n");
592 }else{
593 fossil_print("---\n");
@@ -644,10 +650,11 @@
650 ** Defaults to just the CLI commands. Specify --www to see only the
651 ** web pages, or --everything to see both commands and pages.
652 **
653 ** Options:
654 ** -a|--aliases Show aliases
655 ** -c|--topics Show help topics
656 ** -e|--everything Show all commands and pages. Omit aliases to
657 ** avoid duplicates.
658 ** -h|--html Transform output to HTML
659 ** -o|--options Show global options
660 ** -r|--raw No output formatting
@@ -663,20 +670,23 @@
670 if( find_option("www","w",0) ){
671 mask = CMDFLAG_WEBPAGE;
672 }
673 if( find_option("everything","e",0) ){
674 mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
675 CMDFLAG_ALIAS | CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC;
676 }
677 if( find_option("settings","s",0) ){
678 mask = CMDFLAG_SETTING;
679 }
680 if( find_option("aliases","a",0) ){
681 mask = CMDFLAG_ALIAS;
682 }
683 if( find_option("test","t",0) ){
684 mask |= CMDFLAG_TEST;
685 }
686 if( find_option("topics","c",0) ){
687 mask |= CMDFLAG_TOPIC;
688 }
689 display_all_help(mask, useHtml, rawOut);
690 }
691
692 /*
@@ -710,10 +720,12 @@
720 countCmds( CMDFLAG_TEST ));
721 fossil_print("web-pages: %4d\n",
722 countCmds( CMDFLAG_WEBPAGE ));
723 fossil_print("settings: %4d\n",
724 countCmds( CMDFLAG_SETTING ));
725 fossil_print("help-topics: %4d\n",
726 countCmds( CMDFLAG_TOPIC ));
727 fossil_print("total entries: %4d\n", MX_COMMAND);
728 }
729
730 /*
731 ** Compute an estimate of the edit-distance between to input strings.
@@ -892,10 +904,12 @@
904 /* Some of the webpages require query parameters in order to work.
905 ** @ <h1>The "<a href='%R%s(zCmd)'>%s(zCmd)</a>" page:</h1> */
906 @ <h1>The "%h(pCmd->zName)" page:</h1>
907 }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_SETTING)!=0 ){
908 @ <h1>The "%h(pCmd->zName)" setting:</h1>
909 }else if( rc==0 && (pCmd->eCmdFlags & CMDFLAG_TOPIC)!=0 ){
910 @ <h1>The "%h(pCmd->zName)" help topic:</h1>
911 }else{
912 @ <h1>The "%h(pCmd->zName)" command:</h1>
913 }
914 if( rc==1 || (rc==2 && zCmd[0]=='/') ){
915 if( zCmd && help_is_platform_command(zCmd) ){
@@ -933,11 +947,11 @@
947 int bktHelp[FOSSIL_MX_CMDIDX][MX_HELP_DUP] = {{0}};/* Help str->commands */
948 style_header("Help");
949 search_screen(SRCH_HELP, 0x02);
950
951 @ <a name='commands'></a>
952 @ <h1>Commands:</h1>
953 @ <div class="columns" style="column-width: %s(zWidth);">
954 @ <ul>
955 /* Fill in help string buckets */
956 for(i=0; i<MX_COMMAND; i++){
957 if(aCommand[i].eCmdFlags & CMDFLAG_HIDDEN) continue;
@@ -946,11 +960,13 @@
960 for(i=0; i<MX_COMMAND; i++){
961 const char *z = aCommand[i].zName;
962 const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :"";
963 const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":"";
964 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
965 if( (aCommand[i].eCmdFlags & (CMDFLAG_SETTING|CMDFLAG_TOPIC))!=0 ){
966 continue;
967 }
968 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
969 else if( (aCommand[i].eCmdFlags & CMDFLAG_ALIAS)!=0 ) continue;
970 @ <li><a href="%R/help/%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a>
971 /* Output aliases */
972 if( occHelp[aCommand[i].iHelp] > 1 ){
@@ -978,11 +994,11 @@
994 }
995
996 @ </ul></div>
997
998 @ <a name='webpages'></a>
999 @ <h1>Web pages:</h1>
1000 @ <div class="columns" style="column-width: %s(zWidth);">
1001 @ <ul>
1002 for(i=0; i<MX_COMMAND; i++){
1003 const char *z = aCommand[i].zName;
1004 if( '/'!=*z ) continue;
@@ -993,33 +1009,48 @@
1009 @ <li>%s(z+1)</li>
1010 }
1011 }
1012 @ </ul></div>
1013
1014 @ <a name='settings'></a>
1015 @ <h1>Settings:</h1>
1016 @ <div class="columns" style="column-width: %s(zWidth);">
1017 @ <ul>
1018 for(i=0; i<MX_COMMAND; i++){
1019 const char *z = aCommand[i].zName;
1020 if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)==0 ) continue;
1021 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1022 if( aCommand[i].zHelp[0] ){
1023 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1024 }else{
1025 @ <li>%s(z)</li>
1026 }
1027 }
1028 @ </ul></div>
1029
1030 @ <a name='topics'></a>
1031 @ <h1>Other Miscellaneous Help Topics:</h1>
1032 @ <div class="columns" style="column-width: %s(zWidth);">
1033 @ <ul>
1034 for(i=0; i<MX_COMMAND; i++){
1035 const char *z = aCommand[i].zName;
1036 if( (aCommand[i].eCmdFlags & CMDFLAG_TOPIC)==0 ) continue;
1037 if( aCommand[i].zHelp[0] ){
1038 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1039 }else{
1040 @ <li>%s(z)</li>
1041 }
1042 }
1043 @ </ul></div>
1044
1045 @ <a name='unsupported'></a>
1046 @ <h1>Unsupported and Testing Commands:</h1>
1047 @ <div class="columns" style="column-width: %s(zWidth);">
1048 @ <ul>
1049 for(i=0; i<MX_COMMAND; i++){
1050 const char *z = aCommand[i].zName;
1051 if( strncmp(z,"test",4)!=0 ) continue;
1052 else if( (aCommand[i].eCmdFlags & CMDFLAG_HIDDEN)!=0 ) continue;
1053 if( aCommand[i].zHelp[0] ){
1054 @ <li><a href="%R/help/%s(z)">%s(z)</a></li>
1055 }else{
1056 @ <li>%s(z)</li>
@@ -1059,10 +1090,12 @@
1090 zDesc = "2nd tier command";
1091 }else if( e & CMDFLAG_ALIAS ){
1092 zDesc = "alias";
1093 }else if( e & CMDFLAG_TEST ){
1094 zDesc = "test command";
1095 }else if( e & CMDFLAG_TOPIC ){
1096 zDesc = "help-topic";
1097 }else if( e & CMDFLAG_WEBPAGE ){
1098 if( e & CMDFLAG_RAWCONTENT ){
1099 zDesc = "raw-content web page";
1100 }else{
1101 zDesc = "web page";
@@ -1155,11 +1188,11 @@
1188 Blob *pOut, /* Write simplified help text here */
1189 const char *zTopic, /* TOPIC */
1190 const char *zSubtopic, /* SUBTOPIC */
1191 int bAbbrevSubcmd /* True if z[] contains abbreviated subcommands */
1192 ){
1193 Blob in, line;/*, subsection;*/
1194 int n = 0;
1195 char *zQTop = re_quote(zTopic);
1196 char *zQSub = re_quote(zSubtopic);
1197 char *zPattern;
1198 ReCompiled *pRe = 0;
@@ -1392,37 +1425,45 @@
1425 multi_column_list(aCmd, nCmd);
1426 }
1427 }
1428
1429 /*
1430 ** TOPIC: options
1431 **
1432 ** Command-line options common to all commands:
1433 **
1434 ** --args FILENAME Read additional arguments and options from FILENAME
1435 ** --case-sensitive BOOL Set case sensitivity for file names
1436 ** --cgitrace Active CGI tracing
1437 ** --chdir PATH Change to PATH before performing any operations
1438 ** --color WHEN Emit VT color escapes: 'never', 'always', or 'auto'
1439 ** --errorlog FILENAME Log errors to FILENAME
1440 ** -?|--help Show help on the command rather than running it
1441 ** --httptrace Trace outbound HTTP requests
1442 ** --localtime Display times using the local timezone
1443 ** --nocgi Do not act as CGI
1444 ** --no-th-hook Do not run TH1 hooks
1445 ** --quiet Reduce the amount of output
1446 ** --sqlstats Show SQL usage statistics when done
1447 ** --sqltrace Trace all SQL commands
1448 ** --sshtrace Trace SSH activity
1449 ** --ssl-identity NAME Set the SSL identity to NAME
1450 ** --systemtrace Trace calls to system()
1451 ** -U|--user USER Make the default user be USER
1452 ** --utc Display times using UTC
1453 ** --vfs NAME Cause SQLite to use the NAME VFS
1454 **
1455 ** Additional options available on most commands that use network I/O:
1456 **
1457 ** --accept-any-cert Disable server SSL cdert validation. Accept any SSL
1458 ** cert that the server provides. WARNING: Unsafe!
1459 ** Testing and debugging use only!
1460 ** --ipv4 Use only IPv4. Disable IPv6 support.
1461 ** --ipv6 Use only IPv6. Disable IPv4 support.
1462 ** --nosync Disable autosync for the current command.
1463 ** --proxy URL Specify the HTTP proxy to use. URL can be "off".
1464 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1465
1466 /*
1467 ** COMMAND: help
1468 **
1469 ** Usage: %fossil help [OPTIONS] [TOPIC] [SUBCOMMAND]
@@ -1499,21 +1540,26 @@
1540 return;
1541 }
1542 else if( find_option("setting","s",0) ){
1543 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1544 return;
1545 }
1546 else if( find_option("topic","c",0) ){
1547 command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
1548 return;
1549 }
1550 else if( find_option("full","f",0) ){
1551 fossil_print("fossil commands:\n\n");
1552 command_list(CMDFLAG_1ST_TIER, verboseFlag, useHtml);
1553 fossil_print("\nfossil auxiliary commands:\n\n");
1554 command_list(CMDFLAG_2ND_TIER, verboseFlag, useHtml);
 
1555 fossil_print("\nfossil settings:\n\n");
1556 command_list(CMDFLAG_SETTING, verboseFlag, useHtml);
1557 fossil_print("\nfossil web pages:\n\n");
1558 command_list(CMDFLAG_WEBPAGE, verboseFlag, useHtml);
1559 fossil_print("\nfossil miscellaneous help topics:\n\n");
1560 command_list(CMDFLAG_TOPIC, verboseFlag, useHtml);
1561 fossil_print("\nfossil test commands (unsupported):\n\n");
1562 command_list(CMDFLAG_TEST, verboseFlag, useHtml);
1563 if ( !verboseFlag ) {
1564 fossil_print("\n");
1565 version_cmd();
@@ -1520,18 +1566,23 @@
1566 }
1567 return;
1568 }
1569 else if( find_option("everything","e",0) ){
1570 display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE |
1571 CMDFLAG_SETTING | CMDFLAG_TEST | CMDFLAG_TOPIC,
1572 useHtml, 0);
1573 return;
1574 }
1575 verify_all_options();
1576 zCmdOrPage = "help topic";
1577 if( g.argc<3 ){
1578 if( bOptions ){
1579 zTopic = "options";
1580 zSubtopic = 0;
1581 mask = CMDFLAG_TOPIC;
1582 bOptions = 0;
1583 goto find_and_show_help;
1584 }
1585 z = g.argv[0];
1586 fossil_print(
1587 "Usage: %s help TOPIC\n"
1588 "Things to try:\n\n"
@@ -1551,14 +1602,13 @@
1602 if( isPage ){
1603 zCmdOrPage = "page";
1604 }else if( commandsFlag ){
1605 mask = CMDFLAG_COMMAND;
1606 zCmdOrPage = "command";
 
 
1607 }
1608 find_and_show_help:
1609 rc = dispatch_name_search(zTopic, mask|CMDFLAG_PREFIX, &pCmd);
1610 if( rc ){
1611 int i, n;
1612 const char *az[5];
1613 if( rc==1 ){
1614 if( help_is_platform_command(g.argv[2]) ){
@@ -1796,10 +1846,12 @@
1846 zType = "command";
1847 }else if( pPage->eCmdFlags & CMDFLAG_WEBPAGE ){
1848 zType = "webpage";
1849 }else if( pPage->eCmdFlags & CMDFLAG_SETTING ){
1850 zType = "setting";
1851 }else if( pPage->eCmdFlags & CMDFLAG_TOPIC ){
1852 zType = "help-topic";
1853 }
1854 sqlite3_result_text(ctx, zType, -1, SQLITE_STATIC);
1855 break;
1856 }
1857 case 2: /* flags */
1858
+1 -1
--- src/event.c
+++ src/event.c
@@ -425,11 +425,11 @@
425425
if( rid ){
426426
zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
427427
if( zClr && zClr[0] ){
428428
const char * zRequestMethod = P("REQUEST_METHOD");
429429
if(zRequestMethod && 'G'==zRequestMethod[0]){
430
- /* Apply saved color by defaut for GET requests
430
+ /* Apply saved color by default for GET requests
431431
** (e.g., an Edit menu link).
432432
*/
433433
zClrFlag = " checked";
434434
}
435435
}
436436
--- src/event.c
+++ src/event.c
@@ -425,11 +425,11 @@
425 if( rid ){
426 zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
427 if( zClr && zClr[0] ){
428 const char * zRequestMethod = P("REQUEST_METHOD");
429 if(zRequestMethod && 'G'==zRequestMethod[0]){
430 /* Apply saved color by defaut for GET requests
431 ** (e.g., an Edit menu link).
432 */
433 zClrFlag = " checked";
434 }
435 }
436
--- src/event.c
+++ src/event.c
@@ -425,11 +425,11 @@
425 if( rid ){
426 zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
427 if( zClr && zClr[0] ){
428 const char * zRequestMethod = P("REQUEST_METHOD");
429 if(zRequestMethod && 'G'==zRequestMethod[0]){
430 /* Apply saved color by default for GET requests
431 ** (e.g., an Edit menu link).
432 */
433 zClrFlag = " checked";
434 }
435 }
436
+2 -2
--- src/export.c
+++ src/export.c
@@ -28,11 +28,11 @@
2828
const char *zTrunkName; /* Name of trunk branch */
2929
} gexport;
3030
3131
#if INTERFACE
3232
/*
33
-** Each line in a git-fast-export "marK" file is an instance of
33
+** Each line in a git-fast-export "mark" file is an instance of
3434
** this object.
3535
*/
3636
struct mark_t {
3737
char *name; /* Name of the mark. Also starts with ":" */
3838
int rid; /* Corresponding object in the BLOB table */
@@ -759,11 +759,11 @@
759759
**
760760
** This table contains all check-ins of the repository in topological
761761
** order. "Topological order" means that every parent check-in comes
762762
** before all of its children. Topological order is *almost* the same
763763
** thing as "ORDER BY event.mtime". Differences only arise when there
764
-** are timewarps. In as much as Git hates timewarps, we have to compute
764
+** are timewarps. Inasmuch as Git hates timewarps, we have to compute
765765
** a correct topological order when doing an export.
766766
**
767767
** Since mtime is a usually already nearly in topological order, the
768768
** algorithm is to start with mtime, then make adjustments as necessary
769769
** for timewarps. This is not a great algorithm for the general case,
770770
--- src/export.c
+++ src/export.c
@@ -28,11 +28,11 @@
28 const char *zTrunkName; /* Name of trunk branch */
29 } gexport;
30
31 #if INTERFACE
32 /*
33 ** Each line in a git-fast-export "marK" file is an instance of
34 ** this object.
35 */
36 struct mark_t {
37 char *name; /* Name of the mark. Also starts with ":" */
38 int rid; /* Corresponding object in the BLOB table */
@@ -759,11 +759,11 @@
759 **
760 ** This table contains all check-ins of the repository in topological
761 ** order. "Topological order" means that every parent check-in comes
762 ** before all of its children. Topological order is *almost* the same
763 ** thing as "ORDER BY event.mtime". Differences only arise when there
764 ** are timewarps. In as much as Git hates timewarps, we have to compute
765 ** a correct topological order when doing an export.
766 **
767 ** Since mtime is a usually already nearly in topological order, the
768 ** algorithm is to start with mtime, then make adjustments as necessary
769 ** for timewarps. This is not a great algorithm for the general case,
770
--- src/export.c
+++ src/export.c
@@ -28,11 +28,11 @@
28 const char *zTrunkName; /* Name of trunk branch */
29 } gexport;
30
31 #if INTERFACE
32 /*
33 ** Each line in a git-fast-export "mark" file is an instance of
34 ** this object.
35 */
36 struct mark_t {
37 char *name; /* Name of the mark. Also starts with ":" */
38 int rid; /* Corresponding object in the BLOB table */
@@ -759,11 +759,11 @@
759 **
760 ** This table contains all check-ins of the repository in topological
761 ** order. "Topological order" means that every parent check-in comes
762 ** before all of its children. Topological order is *almost* the same
763 ** thing as "ORDER BY event.mtime". Differences only arise when there
764 ** are timewarps. Inasmuch as Git hates timewarps, we have to compute
765 ** a correct topological order when doing an export.
766 **
767 ** Since mtime is a usually already nearly in topological order, the
768 ** algorithm is to start with mtime, then make adjustments as necessary
769 ** for timewarps. This is not a great algorithm for the general case,
770
+1 -1
--- src/file.c
+++ src/file.c
@@ -51,11 +51,11 @@
5151
** a few special cases such as the "fossil test-tarball" command when we never
5252
** want to follow symlinks.
5353
**
5454
** ExtFILE Symbolic links always refer to the object to which the
5555
** link points. Symlinks are never recognized as symlinks but
56
-** instead always appear to the the target object.
56
+** instead always appear to be the target object.
5757
**
5858
** SymFILE Symbolic links always appear to be files whose name is
5959
** the target pathname of the symbolic link.
6060
**
6161
** RepoFILE Like SymFILE if allow-symlinks is true, or like
6262
--- src/file.c
+++ src/file.c
@@ -51,11 +51,11 @@
51 ** a few special cases such as the "fossil test-tarball" command when we never
52 ** want to follow symlinks.
53 **
54 ** ExtFILE Symbolic links always refer to the object to which the
55 ** link points. Symlinks are never recognized as symlinks but
56 ** instead always appear to the the target object.
57 **
58 ** SymFILE Symbolic links always appear to be files whose name is
59 ** the target pathname of the symbolic link.
60 **
61 ** RepoFILE Like SymFILE if allow-symlinks is true, or like
62
--- src/file.c
+++ src/file.c
@@ -51,11 +51,11 @@
51 ** a few special cases such as the "fossil test-tarball" command when we never
52 ** want to follow symlinks.
53 **
54 ** ExtFILE Symbolic links always refer to the object to which the
55 ** link points. Symlinks are never recognized as symlinks but
56 ** instead always appear to be the target object.
57 **
58 ** SymFILE Symbolic links always appear to be files whose name is
59 ** the target pathname of the symbolic link.
60 **
61 ** RepoFILE Like SymFILE if allow-symlinks is true, or like
62
+3 -3
--- src/fileedit.c
+++ src/fileedit.c
@@ -48,11 +48,11 @@
4848
Blob comment; /* Check-in comment text */
4949
char *zCommentMimetype; /* Mimetype of comment. May be NULL */
5050
char *zUser; /* User name */
5151
char *zDate; /* Optionally force this date string (anything
5252
supported by date_in_standard_format()).
53
- Maybe be NULL. */
53
+ May be NULL. */
5454
Blob *pMfOut; /* If not NULL, checkin_mini() will write a
5555
copy of the generated manifest here. This
5656
memory is NOT owned by CheckinMiniInfo. */
5757
int filePerm; /* Permissions (via file_perm()) of the input
5858
file. We need to store this before calling
@@ -123,11 +123,11 @@
123123
*/
124124
CIMINI_PREFER_DELTA = 1<<8,
125125
/*
126126
** A "stronger hint" to checkin_mini() to prefer creation of a delta
127127
** manifest if it at all can. It will decide not to only if creation
128
-** of a delta is not a realistic option or if it's forbitted by the
128
+** of a delta is not a realistic option or if it's forbidden by the
129129
** forbid-delta-manifests repo config option. For this to work, it
130130
** must be set together with the CIMINI_PREFER_DELTA flag, but the two
131131
** cannot be combined in this enum.
132132
**
133133
** This option is ONLY INTENDED FOR TESTING, used in bypassing
@@ -400,11 +400,11 @@
400400
** This routine uses the state from the given fully-populated pCI
401401
** argument to add pCI->fileContent to the database, and create and
402402
** save a manifest for that change. Ownership of pCI and its contents
403403
** are unchanged.
404404
**
405
-** This function may may modify pCI as follows:
405
+** This function may modify pCI as follows:
406406
**
407407
** - If one of Manifest pCI->pParent or pCI->zParentUuid are NULL,
408408
** then the other will be assigned based on its counterpart. Both
409409
** may not be NULL.
410410
**
411411
--- src/fileedit.c
+++ src/fileedit.c
@@ -48,11 +48,11 @@
48 Blob comment; /* Check-in comment text */
49 char *zCommentMimetype; /* Mimetype of comment. May be NULL */
50 char *zUser; /* User name */
51 char *zDate; /* Optionally force this date string (anything
52 supported by date_in_standard_format()).
53 Maybe be NULL. */
54 Blob *pMfOut; /* If not NULL, checkin_mini() will write a
55 copy of the generated manifest here. This
56 memory is NOT owned by CheckinMiniInfo. */
57 int filePerm; /* Permissions (via file_perm()) of the input
58 file. We need to store this before calling
@@ -123,11 +123,11 @@
123 */
124 CIMINI_PREFER_DELTA = 1<<8,
125 /*
126 ** A "stronger hint" to checkin_mini() to prefer creation of a delta
127 ** manifest if it at all can. It will decide not to only if creation
128 ** of a delta is not a realistic option or if it's forbitted by the
129 ** forbid-delta-manifests repo config option. For this to work, it
130 ** must be set together with the CIMINI_PREFER_DELTA flag, but the two
131 ** cannot be combined in this enum.
132 **
133 ** This option is ONLY INTENDED FOR TESTING, used in bypassing
@@ -400,11 +400,11 @@
400 ** This routine uses the state from the given fully-populated pCI
401 ** argument to add pCI->fileContent to the database, and create and
402 ** save a manifest for that change. Ownership of pCI and its contents
403 ** are unchanged.
404 **
405 ** This function may may modify pCI as follows:
406 **
407 ** - If one of Manifest pCI->pParent or pCI->zParentUuid are NULL,
408 ** then the other will be assigned based on its counterpart. Both
409 ** may not be NULL.
410 **
411
--- src/fileedit.c
+++ src/fileedit.c
@@ -48,11 +48,11 @@
48 Blob comment; /* Check-in comment text */
49 char *zCommentMimetype; /* Mimetype of comment. May be NULL */
50 char *zUser; /* User name */
51 char *zDate; /* Optionally force this date string (anything
52 supported by date_in_standard_format()).
53 May be NULL. */
54 Blob *pMfOut; /* If not NULL, checkin_mini() will write a
55 copy of the generated manifest here. This
56 memory is NOT owned by CheckinMiniInfo. */
57 int filePerm; /* Permissions (via file_perm()) of the input
58 file. We need to store this before calling
@@ -123,11 +123,11 @@
123 */
124 CIMINI_PREFER_DELTA = 1<<8,
125 /*
126 ** A "stronger hint" to checkin_mini() to prefer creation of a delta
127 ** manifest if it at all can. It will decide not to only if creation
128 ** of a delta is not a realistic option or if it's forbidden by the
129 ** forbid-delta-manifests repo config option. For this to work, it
130 ** must be set together with the CIMINI_PREFER_DELTA flag, but the two
131 ** cannot be combined in this enum.
132 **
133 ** This option is ONLY INTENDED FOR TESTING, used in bypassing
@@ -400,11 +400,11 @@
400 ** This routine uses the state from the given fully-populated pCI
401 ** argument to add pCI->fileContent to the database, and create and
402 ** save a manifest for that change. Ownership of pCI and its contents
403 ** are unchanged.
404 **
405 ** This function may modify pCI as follows:
406 **
407 ** - If one of Manifest pCI->pParent or pCI->zParentUuid are NULL,
408 ** then the other will be assigned based on its counterpart. Both
409 ** may not be NULL.
410 **
411
+1 -1
--- src/forum.c
+++ src/forum.c
@@ -133,11 +133,11 @@
133133
** (recursively), else they are not. When checking in-response-to
134134
** posts, the first one which is closed ends the search.
135135
**
136136
** Note that this function checks _exactly_ the given rid, whereas
137137
** forum post closure/re-opening is always applied to the head of an
138
-** edit chain so that we get consistent implied locking beheavior for
138
+** edit chain so that we get consistent implied locking behavior for
139139
** later versions and responses to arbitrary versions in the
140140
** chain. Even so, the "closed" tag is applied as a propagating tag
141141
** so will apply to all edits in a given chain.
142142
**
143143
** The return value is one of:
144144
--- src/forum.c
+++ src/forum.c
@@ -133,11 +133,11 @@
133 ** (recursively), else they are not. When checking in-response-to
134 ** posts, the first one which is closed ends the search.
135 **
136 ** Note that this function checks _exactly_ the given rid, whereas
137 ** forum post closure/re-opening is always applied to the head of an
138 ** edit chain so that we get consistent implied locking beheavior for
139 ** later versions and responses to arbitrary versions in the
140 ** chain. Even so, the "closed" tag is applied as a propagating tag
141 ** so will apply to all edits in a given chain.
142 **
143 ** The return value is one of:
144
--- src/forum.c
+++ src/forum.c
@@ -133,11 +133,11 @@
133 ** (recursively), else they are not. When checking in-response-to
134 ** posts, the first one which is closed ends the search.
135 **
136 ** Note that this function checks _exactly_ the given rid, whereas
137 ** forum post closure/re-opening is always applied to the head of an
138 ** edit chain so that we get consistent implied locking behavior for
139 ** later versions and responses to arbitrary versions in the
140 ** chain. Even so, the "closed" tag is applied as a propagating tag
141 ** so will apply to all edits in a given chain.
142 **
143 ** The return value is one of:
144
--- src/fossil.confirmer.js
+++ src/fossil.confirmer.js
@@ -168,11 +168,11 @@
168168
childs.forEach((e)=>target.appendChild(e));
169169
}
170170
}
171171
const formatCountdown = (txt, number) => txt + " ["+number+"]";
172172
if(opt.pinSize && opt.confirmText){
173
- /* Try to pin the element's width the the greater of its
173
+ /* Try to pin the element's width to the greater of its
174174
current width or its waiting-on-confirmation width
175175
to avoid layout reflow when it's activated. */
176176
const digits = (''+(opt.timeout/1000 || opt.ticks)).length;
177177
const lblLong = formatCountdown(opt.confirmText, "00000000".substr(0,digits+1));
178178
const w1 = parseInt(target.getBoundingClientRect().width);
179179
--- src/fossil.confirmer.js
+++ src/fossil.confirmer.js
@@ -168,11 +168,11 @@
168 childs.forEach((e)=>target.appendChild(e));
169 }
170 }
171 const formatCountdown = (txt, number) => txt + " ["+number+"]";
172 if(opt.pinSize && opt.confirmText){
173 /* Try to pin the element's width the the greater of its
174 current width or its waiting-on-confirmation width
175 to avoid layout reflow when it's activated. */
176 const digits = (''+(opt.timeout/1000 || opt.ticks)).length;
177 const lblLong = formatCountdown(opt.confirmText, "00000000".substr(0,digits+1));
178 const w1 = parseInt(target.getBoundingClientRect().width);
179
--- src/fossil.confirmer.js
+++ src/fossil.confirmer.js
@@ -168,11 +168,11 @@
168 childs.forEach((e)=>target.appendChild(e));
169 }
170 }
171 const formatCountdown = (txt, number) => txt + " ["+number+"]";
172 if(opt.pinSize && opt.confirmText){
173 /* Try to pin the element's width to the greater of its
174 current width or its waiting-on-confirmation width
175 to avoid layout reflow when it's activated. */
176 const digits = (''+(opt.timeout/1000 || opt.ticks)).length;
177 const lblLong = formatCountdown(opt.confirmText, "00000000".substr(0,digits+1));
178 const w1 = parseInt(target.getBoundingClientRect().width);
179
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -35,11 +35,11 @@
3535
}
3636
const D = window.fossil.dom;
3737
const allToggles = [/*collection of all diff-toggle checkboxes*/];
3838
let checkedCount =
3939
0 /* When showing more than one diff, keep track of how many
40
- "show/hide" checkboxes are are checked so we can update the
40
+ "show/hide" checkboxes are checked so we can update the
4141
"show/hide all" label dynamically. */;
4242
let btnAll /* UI control to show/hide all diffs */;
4343
/* Install a diff-toggle button for the given diff table element. */
4444
const addToggle = function(diffElem){
4545
const sib = diffElem.previousElementSibling,
@@ -106,11 +106,11 @@
106106
chunkLoadLines: (
107107
F.config.diffContextLines * 3
108108
/*per /chat discussion*/
109109
) || 20,
110110
chunkFetch: {
111
- /* Default callack handlers for Diff.fetchArtifactChunk(),
111
+ /* Default callback handlers for Diff.fetchArtifactChunk(),
112112
unless overridden by options passeed to that function. */
113113
beforesend: function(){},
114114
aftersend: function(){},
115115
onerror: function(e){
116116
console.error("XHR error: ",e);
@@ -368,11 +368,11 @@
368368
}
369369
return this;
370370
},
371371
372372
/**
373
- Callack for /jchunk responses.
373
+ Callback for /jchunk responses.
374374
*/
375375
injectResponse: function f(fetchType/*as for fetchChunk()*/,
376376
urlParam/*from fetchChunk()*/,
377377
lines/*response lines*/){
378378
if(!lines.length){
@@ -718,11 +718,11 @@
718718
: undefined;
719719
const keySbsScroll = 'sync-diff-scroll' /* F.storage key for persistent user preference */;
720720
if( eToggleParent ){
721721
/* Add a checkbox to toggle sbs scroll sync. Remember that in
722722
order to be UI-consistent in the /vdiff page we have to ensure
723
- that the checkbox is to the LEFT of of its label. We store the
723
+ that the checkbox is to the LEFT of its label. We store the
724724
sync-scroll preference in F.storage (not a cookie) so that it
725725
persists across page loads and different apps. */
726726
cbSync = D.checkbox(keySbsScroll, F.storage.getBool(keySbsScroll,true));
727727
D.append(eToggleParent, D.append(
728728
D.addClass(D.create('span'), 'input-with-label'),
729729
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -35,11 +35,11 @@
35 }
36 const D = window.fossil.dom;
37 const allToggles = [/*collection of all diff-toggle checkboxes*/];
38 let checkedCount =
39 0 /* When showing more than one diff, keep track of how many
40 "show/hide" checkboxes are are checked so we can update the
41 "show/hide all" label dynamically. */;
42 let btnAll /* UI control to show/hide all diffs */;
43 /* Install a diff-toggle button for the given diff table element. */
44 const addToggle = function(diffElem){
45 const sib = diffElem.previousElementSibling,
@@ -106,11 +106,11 @@
106 chunkLoadLines: (
107 F.config.diffContextLines * 3
108 /*per /chat discussion*/
109 ) || 20,
110 chunkFetch: {
111 /* Default callack handlers for Diff.fetchArtifactChunk(),
112 unless overridden by options passeed to that function. */
113 beforesend: function(){},
114 aftersend: function(){},
115 onerror: function(e){
116 console.error("XHR error: ",e);
@@ -368,11 +368,11 @@
368 }
369 return this;
370 },
371
372 /**
373 Callack for /jchunk responses.
374 */
375 injectResponse: function f(fetchType/*as for fetchChunk()*/,
376 urlParam/*from fetchChunk()*/,
377 lines/*response lines*/){
378 if(!lines.length){
@@ -718,11 +718,11 @@
718 : undefined;
719 const keySbsScroll = 'sync-diff-scroll' /* F.storage key for persistent user preference */;
720 if( eToggleParent ){
721 /* Add a checkbox to toggle sbs scroll sync. Remember that in
722 order to be UI-consistent in the /vdiff page we have to ensure
723 that the checkbox is to the LEFT of of its label. We store the
724 sync-scroll preference in F.storage (not a cookie) so that it
725 persists across page loads and different apps. */
726 cbSync = D.checkbox(keySbsScroll, F.storage.getBool(keySbsScroll,true));
727 D.append(eToggleParent, D.append(
728 D.addClass(D.create('span'), 'input-with-label'),
729
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -35,11 +35,11 @@
35 }
36 const D = window.fossil.dom;
37 const allToggles = [/*collection of all diff-toggle checkboxes*/];
38 let checkedCount =
39 0 /* When showing more than one diff, keep track of how many
40 "show/hide" checkboxes are checked so we can update the
41 "show/hide all" label dynamically. */;
42 let btnAll /* UI control to show/hide all diffs */;
43 /* Install a diff-toggle button for the given diff table element. */
44 const addToggle = function(diffElem){
45 const sib = diffElem.previousElementSibling,
@@ -106,11 +106,11 @@
106 chunkLoadLines: (
107 F.config.diffContextLines * 3
108 /*per /chat discussion*/
109 ) || 20,
110 chunkFetch: {
111 /* Default callback handlers for Diff.fetchArtifactChunk(),
112 unless overridden by options passeed to that function. */
113 beforesend: function(){},
114 aftersend: function(){},
115 onerror: function(e){
116 console.error("XHR error: ",e);
@@ -368,11 +368,11 @@
368 }
369 return this;
370 },
371
372 /**
373 Callback for /jchunk responses.
374 */
375 injectResponse: function f(fetchType/*as for fetchChunk()*/,
376 urlParam/*from fetchChunk()*/,
377 lines/*response lines*/){
378 if(!lines.length){
@@ -718,11 +718,11 @@
718 : undefined;
719 const keySbsScroll = 'sync-diff-scroll' /* F.storage key for persistent user preference */;
720 if( eToggleParent ){
721 /* Add a checkbox to toggle sbs scroll sync. Remember that in
722 order to be UI-consistent in the /vdiff page we have to ensure
723 that the checkbox is to the LEFT of its label. We store the
724 sync-scroll preference in F.storage (not a cookie) so that it
725 persists across page loads and different apps. */
726 cbSync = D.checkbox(keySbsScroll, F.storage.getBool(keySbsScroll,true));
727 D.append(eToggleParent, D.append(
728 D.addClass(D.create('span'), 'input-with-label'),
729
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -259,11 +259,11 @@
259259
dom.td = dom.createElemFactoryWithOptionalParent('td');
260260
dom.th = dom.createElemFactoryWithOptionalParent('th');
261261
262262
/**
263263
Creates and returns a FIELDSET element, optionaly with a LEGEND
264
- element added to it. If legendText is an HTMLElement then is is
264
+ element added to it. If legendText is an HTMLElement then it is
265265
assumed to be a LEGEND and is appended as-is, else it is assumed
266266
(if truthy) to be a value suitable for passing to
267267
dom.append(aLegendElement,...).
268268
*/
269269
dom.fieldset = function(legendText){
270270
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -259,11 +259,11 @@
259 dom.td = dom.createElemFactoryWithOptionalParent('td');
260 dom.th = dom.createElemFactoryWithOptionalParent('th');
261
262 /**
263 Creates and returns a FIELDSET element, optionaly with a LEGEND
264 element added to it. If legendText is an HTMLElement then is is
265 assumed to be a LEGEND and is appended as-is, else it is assumed
266 (if truthy) to be a value suitable for passing to
267 dom.append(aLegendElement,...).
268 */
269 dom.fieldset = function(legendText){
270
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -259,11 +259,11 @@
259 dom.td = dom.createElemFactoryWithOptionalParent('td');
260 dom.th = dom.createElemFactoryWithOptionalParent('th');
261
262 /**
263 Creates and returns a FIELDSET element, optionaly with a LEGEND
264 element added to it. If legendText is an HTMLElement then it is
265 assumed to be a LEGEND and is appended as-is, else it is assumed
266 (if truthy) to be a value suitable for passing to
267 dom.append(aLegendElement,...).
268 */
269 dom.fieldset = function(legendText){
270
--- src/fossil.fetch.js
+++ src/fossil.fetch.js
@@ -61,11 +61,11 @@
6161
reported here, else they are reported through onerror().
6262
Unfortunately, XHR fires two events for a timeout: an
6363
onreadystatechange() and an ontimeout(), in that order. From the
6464
former, however, we cannot unambiguously identify the error as
6565
having been caused by a timeout, so clients which set ontimeout()
66
- will get _two_ callback calls: one with with an HTTP error response
66
+ will get _two_ callback calls: one with an HTTP error response
6767
followed immediately by an ontimeout() response. Error objects
6868
passed to this will have (.name='timeout', .status=xhr.HttpStatus).
6969
In the context of the callback, the options object is "this", Like
7070
onerror(), any exceptions thrown by the ontimeout() handler are
7171
suppressed, but may generate a console error message. The onerror()
7272
--- src/fossil.fetch.js
+++ src/fossil.fetch.js
@@ -61,11 +61,11 @@
61 reported here, else they are reported through onerror().
62 Unfortunately, XHR fires two events for a timeout: an
63 onreadystatechange() and an ontimeout(), in that order. From the
64 former, however, we cannot unambiguously identify the error as
65 having been caused by a timeout, so clients which set ontimeout()
66 will get _two_ callback calls: one with with an HTTP error response
67 followed immediately by an ontimeout() response. Error objects
68 passed to this will have (.name='timeout', .status=xhr.HttpStatus).
69 In the context of the callback, the options object is "this", Like
70 onerror(), any exceptions thrown by the ontimeout() handler are
71 suppressed, but may generate a console error message. The onerror()
72
--- src/fossil.fetch.js
+++ src/fossil.fetch.js
@@ -61,11 +61,11 @@
61 reported here, else they are reported through onerror().
62 Unfortunately, XHR fires two events for a timeout: an
63 onreadystatechange() and an ontimeout(), in that order. From the
64 former, however, we cannot unambiguously identify the error as
65 having been caused by a timeout, so clients which set ontimeout()
66 will get _two_ callback calls: one with an HTTP error response
67 followed immediately by an ontimeout() response. Error objects
68 passed to this will have (.name='timeout', .status=xhr.HttpStatus).
69 In the context of the callback, the options object is "this", Like
70 onerror(), any exceptions thrown by the ontimeout() handler are
71 suppressed, but may generate a console error message. The onerror()
72
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -142,10 +142,13 @@
142142
loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
143143
inputArea: E1("#chat-input-area"),
144144
inputLineWrapper: E1('#chat-input-line-wrapper'),
145145
fileSelectWrapper: E1('#chat-input-file-area'),
146146
viewMessages: E1('#chat-messages-wrapper'),
147
+ viewZoom: E1('#chat-zoom'),
148
+ zoomContent: E1('#chat-zoom-content'),
149
+ zoomMarker: E1('#chat-zoom-marker'),
147150
btnSubmit: E1('#chat-button-submit'),
148151
btnAttach: E1('#chat-button-attach'),
149152
inputX: E1('#chat-input-field-x'),
150153
input1: E1('#chat-input-field-single'),
151154
inputM: E1('#chat-input-field-multi'),
@@ -354,11 +357,11 @@
354357
/** Either scrolls .message-widget element eMsg into view
355358
immediately or, if it represents an inlined image, delays
356359
the scroll until the image is loaded, at which point it will
357360
scroll to either the newest message, if one is set or to
358361
eMsg (the liklihood is good, at least on initial page load,
359
- that the the image won't be loaded until other messages have
362
+ that the image won't be loaded until other messages have
360363
been injected). */
361364
scheduleScrollOfMsg: function(eMsg){
362365
if(1===+eMsg.dataset.hasImage){
363366
eMsg.querySelector('img').addEventListener(
364367
'load', ()=>(this.e.newestMessage || eMsg).scrollIntoView(false)
@@ -590,10 +593,14 @@
590593
all other elements in that list. Returns e.
591594
*/
592595
setCurrentView: function(e){
593596
if(e===this.e.currentView){
594597
return e;
598
+ }
599
+ if( e!==this.e.viewZoom && this.e.zoomedMsg ){
600
+ this.zoomMessage(null, e);
601
+ return this.e.currentView;
595602
}
596603
this.e.views.forEach(function(E){
597604
if(e!==E) D.addClass(E,'hidden');
598605
});
599606
this.e.currentView = e;
@@ -600,10 +607,33 @@
600607
if(this.e.currentView.$beforeShow) this.e.currentView.$beforeShow();
601608
D.removeClass(e,'hidden');
602609
this.animate(this.e.currentView, 'anim-fade-in-fast');
603610
return this.e.currentView;
604611
},
612
+
613
+ /**
614
+ Makes message element eMsg the content of this.e.viewZoom.
615
+ */
616
+ zoomMessage: function(eMsg,nextView){
617
+ const marker = this.e.zoomMarker;
618
+ if( !eMsg || eMsg===this.e.zoomedMsg ){
619
+ if( this.e.zoomedMsg ){
620
+ marker.parentNode.insertBefore(this.e.zoomedMsg, marker);
621
+ delete this.e.zoomedMsg;
622
+ }
623
+ this.setCurrentView(nextView || this.e.viewMessages);
624
+ return;
625
+ }
626
+ console.log("zoom message",eMsg);
627
+ if( this.e.zoomedMsg ){
628
+ marker.parentNode.insertBefore(this.e.zoomedMsg, marker);
629
+ }
630
+ this.e.viewMessages.insertBefore(marker, eMsg);
631
+ this.e.zoomContent.appendChild(eMsg);
632
+ this.e.zoomedMsg = eMsg;
633
+ this.setCurrentView(this.e.viewZoom);
634
+ },
605635
/**
606636
Updates the "active user list" view if we are not currently
607637
batch-loading messages and if the active user list UI element
608638
is active.
609639
*/
@@ -723,11 +753,12 @@
723753
else D.addClass(e,'hidden');
724754
});
725755
if(D.attr(cs.e.inputX,'contenteditable','plaintext-only').isContentEditable){
726756
cs.$browserHasPlaintextOnly = true;
727757
}else{
728
- /* Only the Chrome family supports contenteditable=plaintext-only */
758
+ /* contenteditable="plaintext-only" is a latecomer, not
759
+ supported in FF until version 136. */
729760
cs.$browserHasPlaintextOnly = false;
730761
D.attr(cs.e.inputX,'contenteditable','true');
731762
}
732763
cs.animate.$disabled = true;
733764
F.fetch.beforesend = ()=>cs.ajaxStart();
@@ -1019,11 +1050,11 @@
10191050
if(eUser==this || !eUser) return false;
10201051
const uname = eUser.dataset.uname;
10211052
let eLast;
10221053
cs.setCurrentView(cs.e.viewMessages);
10231054
if(eUser.classList.contains('selected')){
1024
- /* If curently selected, toggle filter off */
1055
+ /* If currently selected, toggle filter off */
10251056
eUser.classList.remove('selected');
10261057
cs.setUserFilter(false);
10271058
delete f.$eSelected;
10281059
}else{
10291060
if(f.$eSelected) f.$eSelected.classList.remove('selected');
@@ -1349,15 +1380,16 @@
13491380
has since been resolved by emiting a stricter
13501381
format. */
13511382
// Date doesn't work, so dumb it down...
13521383
D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu"));
13531384
}
1354
- const toolbar = D.addClass(D.div(), 'toolbar');
1385
+ const toolbar = D.addClass(D.div(), 'toolbar', 'hide-in-zoom');
13551386
D.append(this.e, toolbar);
1387
+ const self = this;
1388
+
13561389
const btnDeleteLocal = D.button("Delete locally");
13571390
D.append(toolbar, btnDeleteLocal);
1358
- const self = this;
13591391
btnDeleteLocal.addEventListener('click', function(){
13601392
self.hide();
13611393
Chat.deleteMessageElem(eMsg)
13621394
});
13631395
if( eMsg.classList.contains('notification') ){
@@ -1381,11 +1413,11 @@
13811413
self.hide();
13821414
Chat.deleteMessage(eMsg);
13831415
}
13841416
});
13851417
}
1386
- const toolbar3 = D.addClass(D.div(), 'toolbar');
1418
+ const toolbar3 = D.addClass(D.div(), 'toolbar', 'hide-in-zoom');
13871419
D.append(this.e, toolbar3);
13881420
D.append(toolbar3, D.button(
13891421
"Locally remove all previous messages",
13901422
function(){
13911423
self.hide();
@@ -1444,10 +1476,15 @@
14441476
})
14451477
)
14461478
);
14471479
}/*jump-to button*/
14481480
}
1481
+ const btnZoom = D.button("Zoom");
1482
+ D.append(toolbar2, btnZoom);
1483
+ btnZoom.addEventListener('click', function(){
1484
+ Chat.zoomMessage(eMsg);
1485
+ });
14491486
const tab = eMsg.querySelector('.message-widget-tab');
14501487
D.append(tab, this.e);
14511488
D.removeClass(this.e, 'hidden');
14521489
Chat.animate(this.e, 'anim-fade-in-fast');
14531490
}/*refresh()*/,
@@ -1904,11 +1941,10 @@
19041941
if(13 !== ev.keyCode) return;
19051942
const text = Chat.inputValue().trim();
19061943
const ctrlMode = Chat.settings.getBool('edit-ctrl-send', false);
19071944
//console.debug("Enter key event:", ctrlMode, ev.ctrlKey, ev.shiftKey, ev);
19081945
if(ev.shiftKey){
1909
- const compactMode = Chat.settings.getBool('edit-compact-mode', false);
19101946
ev.preventDefault();
19111947
ev.stopPropagation();
19121948
/* Shift-enter will run preview mode UNLESS the input field is empty
19131949
AND (preview or search mode) is active, in which cases it will
19141950
switch back to message view. */
@@ -1915,10 +1951,11 @@
19151951
if(!text &&
19161952
(Chat.e.currentView===Chat.e.viewPreview
19171953
| Chat.e.currentView===Chat.e.viewSearch)){
19181954
Chat.setCurrentView(Chat.e.viewMessages);
19191955
}else if(!text){
1956
+ const compactMode = Chat.settings.getBool('edit-compact-mode', false);
19201957
f.$toggleCompact(compactMode);
19211958
}else if(Chat.settings.getBool('edit-shift-enter-preview', true)){
19221959
Chat.e.btnPreview.click();
19231960
}
19241961
return false;
@@ -2433,10 +2470,19 @@
24332470
ev.stopPropagation();
24342471
Chat.setCurrentView(Chat.e.viewMessages);
24352472
return false;
24362473
}, false);
24372474
})()/*search view setup*/;
2475
+
2476
+ (function(){/*Set up the zoom view */
2477
+ Chat.e.viewZoom.querySelector('button.action-close').addEventListener('click', function(ev){
2478
+ ev.preventDefault();
2479
+ ev.stopPropagation();
2480
+ Chat.zoomMessage(null);
2481
+ return false;
2482
+ }, false);
2483
+ })()/*zoom view setup*/;
24382484
24392485
/** Callback for poll() to inject new content into the page. jx ==
24402486
the response from /chat-poll. If atEnd is true, the message is
24412487
appended to the end of the chat list (for loading older
24422488
messages), else the beginning (the default). */
@@ -2810,11 +2856,11 @@
28102856
beforesend: chatPollBeforeSend,
28112857
aftersend: function(){
28122858
poll.running = false;
28132859
},
28142860
ontimeout: function(err){
2815
- f.pendingOnError = undefined /*strip preceeding non-timeout error, if any*/;
2861
+ f.pendingOnError = undefined /*strip preceding non-timeout error, if any*/;
28162862
afterPollFetch(err);
28172863
},
28182864
onerror:function(err){
28192865
Chat._isBatchLoading = false;
28202866
if(Chat.beVerbose){
28212867
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -142,10 +142,13 @@
142 loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
143 inputArea: E1("#chat-input-area"),
144 inputLineWrapper: E1('#chat-input-line-wrapper'),
145 fileSelectWrapper: E1('#chat-input-file-area'),
146 viewMessages: E1('#chat-messages-wrapper'),
 
 
 
147 btnSubmit: E1('#chat-button-submit'),
148 btnAttach: E1('#chat-button-attach'),
149 inputX: E1('#chat-input-field-x'),
150 input1: E1('#chat-input-field-single'),
151 inputM: E1('#chat-input-field-multi'),
@@ -354,11 +357,11 @@
354 /** Either scrolls .message-widget element eMsg into view
355 immediately or, if it represents an inlined image, delays
356 the scroll until the image is loaded, at which point it will
357 scroll to either the newest message, if one is set or to
358 eMsg (the liklihood is good, at least on initial page load,
359 that the the image won't be loaded until other messages have
360 been injected). */
361 scheduleScrollOfMsg: function(eMsg){
362 if(1===+eMsg.dataset.hasImage){
363 eMsg.querySelector('img').addEventListener(
364 'load', ()=>(this.e.newestMessage || eMsg).scrollIntoView(false)
@@ -590,10 +593,14 @@
590 all other elements in that list. Returns e.
591 */
592 setCurrentView: function(e){
593 if(e===this.e.currentView){
594 return e;
 
 
 
 
595 }
596 this.e.views.forEach(function(E){
597 if(e!==E) D.addClass(E,'hidden');
598 });
599 this.e.currentView = e;
@@ -600,10 +607,33 @@
600 if(this.e.currentView.$beforeShow) this.e.currentView.$beforeShow();
601 D.removeClass(e,'hidden');
602 this.animate(this.e.currentView, 'anim-fade-in-fast');
603 return this.e.currentView;
604 },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605 /**
606 Updates the "active user list" view if we are not currently
607 batch-loading messages and if the active user list UI element
608 is active.
609 */
@@ -723,11 +753,12 @@
723 else D.addClass(e,'hidden');
724 });
725 if(D.attr(cs.e.inputX,'contenteditable','plaintext-only').isContentEditable){
726 cs.$browserHasPlaintextOnly = true;
727 }else{
728 /* Only the Chrome family supports contenteditable=plaintext-only */
 
729 cs.$browserHasPlaintextOnly = false;
730 D.attr(cs.e.inputX,'contenteditable','true');
731 }
732 cs.animate.$disabled = true;
733 F.fetch.beforesend = ()=>cs.ajaxStart();
@@ -1019,11 +1050,11 @@
1019 if(eUser==this || !eUser) return false;
1020 const uname = eUser.dataset.uname;
1021 let eLast;
1022 cs.setCurrentView(cs.e.viewMessages);
1023 if(eUser.classList.contains('selected')){
1024 /* If curently selected, toggle filter off */
1025 eUser.classList.remove('selected');
1026 cs.setUserFilter(false);
1027 delete f.$eSelected;
1028 }else{
1029 if(f.$eSelected) f.$eSelected.classList.remove('selected');
@@ -1349,15 +1380,16 @@
1349 has since been resolved by emiting a stricter
1350 format. */
1351 // Date doesn't work, so dumb it down...
1352 D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu"));
1353 }
1354 const toolbar = D.addClass(D.div(), 'toolbar');
1355 D.append(this.e, toolbar);
 
 
1356 const btnDeleteLocal = D.button("Delete locally");
1357 D.append(toolbar, btnDeleteLocal);
1358 const self = this;
1359 btnDeleteLocal.addEventListener('click', function(){
1360 self.hide();
1361 Chat.deleteMessageElem(eMsg)
1362 });
1363 if( eMsg.classList.contains('notification') ){
@@ -1381,11 +1413,11 @@
1381 self.hide();
1382 Chat.deleteMessage(eMsg);
1383 }
1384 });
1385 }
1386 const toolbar3 = D.addClass(D.div(), 'toolbar');
1387 D.append(this.e, toolbar3);
1388 D.append(toolbar3, D.button(
1389 "Locally remove all previous messages",
1390 function(){
1391 self.hide();
@@ -1444,10 +1476,15 @@
1444 })
1445 )
1446 );
1447 }/*jump-to button*/
1448 }
 
 
 
 
 
1449 const tab = eMsg.querySelector('.message-widget-tab');
1450 D.append(tab, this.e);
1451 D.removeClass(this.e, 'hidden');
1452 Chat.animate(this.e, 'anim-fade-in-fast');
1453 }/*refresh()*/,
@@ -1904,11 +1941,10 @@
1904 if(13 !== ev.keyCode) return;
1905 const text = Chat.inputValue().trim();
1906 const ctrlMode = Chat.settings.getBool('edit-ctrl-send', false);
1907 //console.debug("Enter key event:", ctrlMode, ev.ctrlKey, ev.shiftKey, ev);
1908 if(ev.shiftKey){
1909 const compactMode = Chat.settings.getBool('edit-compact-mode', false);
1910 ev.preventDefault();
1911 ev.stopPropagation();
1912 /* Shift-enter will run preview mode UNLESS the input field is empty
1913 AND (preview or search mode) is active, in which cases it will
1914 switch back to message view. */
@@ -1915,10 +1951,11 @@
1915 if(!text &&
1916 (Chat.e.currentView===Chat.e.viewPreview
1917 | Chat.e.currentView===Chat.e.viewSearch)){
1918 Chat.setCurrentView(Chat.e.viewMessages);
1919 }else if(!text){
 
1920 f.$toggleCompact(compactMode);
1921 }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){
1922 Chat.e.btnPreview.click();
1923 }
1924 return false;
@@ -2433,10 +2470,19 @@
2433 ev.stopPropagation();
2434 Chat.setCurrentView(Chat.e.viewMessages);
2435 return false;
2436 }, false);
2437 })()/*search view setup*/;
 
 
 
 
 
 
 
 
 
2438
2439 /** Callback for poll() to inject new content into the page. jx ==
2440 the response from /chat-poll. If atEnd is true, the message is
2441 appended to the end of the chat list (for loading older
2442 messages), else the beginning (the default). */
@@ -2810,11 +2856,11 @@
2810 beforesend: chatPollBeforeSend,
2811 aftersend: function(){
2812 poll.running = false;
2813 },
2814 ontimeout: function(err){
2815 f.pendingOnError = undefined /*strip preceeding non-timeout error, if any*/;
2816 afterPollFetch(err);
2817 },
2818 onerror:function(err){
2819 Chat._isBatchLoading = false;
2820 if(Chat.beVerbose){
2821
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -142,10 +142,13 @@
142 loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
143 inputArea: E1("#chat-input-area"),
144 inputLineWrapper: E1('#chat-input-line-wrapper'),
145 fileSelectWrapper: E1('#chat-input-file-area'),
146 viewMessages: E1('#chat-messages-wrapper'),
147 viewZoom: E1('#chat-zoom'),
148 zoomContent: E1('#chat-zoom-content'),
149 zoomMarker: E1('#chat-zoom-marker'),
150 btnSubmit: E1('#chat-button-submit'),
151 btnAttach: E1('#chat-button-attach'),
152 inputX: E1('#chat-input-field-x'),
153 input1: E1('#chat-input-field-single'),
154 inputM: E1('#chat-input-field-multi'),
@@ -354,11 +357,11 @@
357 /** Either scrolls .message-widget element eMsg into view
358 immediately or, if it represents an inlined image, delays
359 the scroll until the image is loaded, at which point it will
360 scroll to either the newest message, if one is set or to
361 eMsg (the liklihood is good, at least on initial page load,
362 that the image won't be loaded until other messages have
363 been injected). */
364 scheduleScrollOfMsg: function(eMsg){
365 if(1===+eMsg.dataset.hasImage){
366 eMsg.querySelector('img').addEventListener(
367 'load', ()=>(this.e.newestMessage || eMsg).scrollIntoView(false)
@@ -590,10 +593,14 @@
593 all other elements in that list. Returns e.
594 */
595 setCurrentView: function(e){
596 if(e===this.e.currentView){
597 return e;
598 }
599 if( e!==this.e.viewZoom && this.e.zoomedMsg ){
600 this.zoomMessage(null, e);
601 return this.e.currentView;
602 }
603 this.e.views.forEach(function(E){
604 if(e!==E) D.addClass(E,'hidden');
605 });
606 this.e.currentView = e;
@@ -600,10 +607,33 @@
607 if(this.e.currentView.$beforeShow) this.e.currentView.$beforeShow();
608 D.removeClass(e,'hidden');
609 this.animate(this.e.currentView, 'anim-fade-in-fast');
610 return this.e.currentView;
611 },
612
613 /**
614 Makes message element eMsg the content of this.e.viewZoom.
615 */
616 zoomMessage: function(eMsg,nextView){
617 const marker = this.e.zoomMarker;
618 if( !eMsg || eMsg===this.e.zoomedMsg ){
619 if( this.e.zoomedMsg ){
620 marker.parentNode.insertBefore(this.e.zoomedMsg, marker);
621 delete this.e.zoomedMsg;
622 }
623 this.setCurrentView(nextView || this.e.viewMessages);
624 return;
625 }
626 console.log("zoom message",eMsg);
627 if( this.e.zoomedMsg ){
628 marker.parentNode.insertBefore(this.e.zoomedMsg, marker);
629 }
630 this.e.viewMessages.insertBefore(marker, eMsg);
631 this.e.zoomContent.appendChild(eMsg);
632 this.e.zoomedMsg = eMsg;
633 this.setCurrentView(this.e.viewZoom);
634 },
635 /**
636 Updates the "active user list" view if we are not currently
637 batch-loading messages and if the active user list UI element
638 is active.
639 */
@@ -723,11 +753,12 @@
753 else D.addClass(e,'hidden');
754 });
755 if(D.attr(cs.e.inputX,'contenteditable','plaintext-only').isContentEditable){
756 cs.$browserHasPlaintextOnly = true;
757 }else{
758 /* contenteditable="plaintext-only" is a latecomer, not
759 supported in FF until version 136. */
760 cs.$browserHasPlaintextOnly = false;
761 D.attr(cs.e.inputX,'contenteditable','true');
762 }
763 cs.animate.$disabled = true;
764 F.fetch.beforesend = ()=>cs.ajaxStart();
@@ -1019,11 +1050,11 @@
1050 if(eUser==this || !eUser) return false;
1051 const uname = eUser.dataset.uname;
1052 let eLast;
1053 cs.setCurrentView(cs.e.viewMessages);
1054 if(eUser.classList.contains('selected')){
1055 /* If currently selected, toggle filter off */
1056 eUser.classList.remove('selected');
1057 cs.setUserFilter(false);
1058 delete f.$eSelected;
1059 }else{
1060 if(f.$eSelected) f.$eSelected.classList.remove('selected');
@@ -1349,15 +1380,16 @@
1380 has since been resolved by emiting a stricter
1381 format. */
1382 // Date doesn't work, so dumb it down...
1383 D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu"));
1384 }
1385 const toolbar = D.addClass(D.div(), 'toolbar', 'hide-in-zoom');
1386 D.append(this.e, toolbar);
1387 const self = this;
1388
1389 const btnDeleteLocal = D.button("Delete locally");
1390 D.append(toolbar, btnDeleteLocal);
 
1391 btnDeleteLocal.addEventListener('click', function(){
1392 self.hide();
1393 Chat.deleteMessageElem(eMsg)
1394 });
1395 if( eMsg.classList.contains('notification') ){
@@ -1381,11 +1413,11 @@
1413 self.hide();
1414 Chat.deleteMessage(eMsg);
1415 }
1416 });
1417 }
1418 const toolbar3 = D.addClass(D.div(), 'toolbar', 'hide-in-zoom');
1419 D.append(this.e, toolbar3);
1420 D.append(toolbar3, D.button(
1421 "Locally remove all previous messages",
1422 function(){
1423 self.hide();
@@ -1444,10 +1476,15 @@
1476 })
1477 )
1478 );
1479 }/*jump-to button*/
1480 }
1481 const btnZoom = D.button("Zoom");
1482 D.append(toolbar2, btnZoom);
1483 btnZoom.addEventListener('click', function(){
1484 Chat.zoomMessage(eMsg);
1485 });
1486 const tab = eMsg.querySelector('.message-widget-tab');
1487 D.append(tab, this.e);
1488 D.removeClass(this.e, 'hidden');
1489 Chat.animate(this.e, 'anim-fade-in-fast');
1490 }/*refresh()*/,
@@ -1904,11 +1941,10 @@
1941 if(13 !== ev.keyCode) return;
1942 const text = Chat.inputValue().trim();
1943 const ctrlMode = Chat.settings.getBool('edit-ctrl-send', false);
1944 //console.debug("Enter key event:", ctrlMode, ev.ctrlKey, ev.shiftKey, ev);
1945 if(ev.shiftKey){
 
1946 ev.preventDefault();
1947 ev.stopPropagation();
1948 /* Shift-enter will run preview mode UNLESS the input field is empty
1949 AND (preview or search mode) is active, in which cases it will
1950 switch back to message view. */
@@ -1915,10 +1951,11 @@
1951 if(!text &&
1952 (Chat.e.currentView===Chat.e.viewPreview
1953 | Chat.e.currentView===Chat.e.viewSearch)){
1954 Chat.setCurrentView(Chat.e.viewMessages);
1955 }else if(!text){
1956 const compactMode = Chat.settings.getBool('edit-compact-mode', false);
1957 f.$toggleCompact(compactMode);
1958 }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){
1959 Chat.e.btnPreview.click();
1960 }
1961 return false;
@@ -2433,10 +2470,19 @@
2470 ev.stopPropagation();
2471 Chat.setCurrentView(Chat.e.viewMessages);
2472 return false;
2473 }, false);
2474 })()/*search view setup*/;
2475
2476 (function(){/*Set up the zoom view */
2477 Chat.e.viewZoom.querySelector('button.action-close').addEventListener('click', function(ev){
2478 ev.preventDefault();
2479 ev.stopPropagation();
2480 Chat.zoomMessage(null);
2481 return false;
2482 }, false);
2483 })()/*zoom view setup*/;
2484
2485 /** Callback for poll() to inject new content into the page. jx ==
2486 the response from /chat-poll. If atEnd is true, the message is
2487 appended to the end of the chat list (for loading older
2488 messages), else the beginning (the default). */
@@ -2810,11 +2856,11 @@
2856 beforesend: chatPollBeforeSend,
2857 aftersend: function(){
2858 poll.running = false;
2859 },
2860 ontimeout: function(err){
2861 f.pendingOnError = undefined /*strip preceding non-timeout error, if any*/;
2862 afterPollFetch(err);
2863 },
2864 onerror:function(err){
2865 Chat._isBatchLoading = false;
2866 if(Chat.beVerbose){
2867
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -1149,11 +1149,11 @@
11491149
return this;
11501150
};
11511151
11521152
/**
11531153
Fetches the page preview based on the contents and settings of
1154
- this page's input fields, and updates the UI with with the
1154
+ this page's input fields, and updates the UI with the
11551155
preview.
11561156
11571157
Returns this object, noting that the operation is async.
11581158
*/
11591159
P.preview = function f(switchToTab){
11601160
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -1149,11 +1149,11 @@
1149 return this;
1150 };
1151
1152 /**
1153 Fetches the page preview based on the contents and settings of
1154 this page's input fields, and updates the UI with with the
1155 preview.
1156
1157 Returns this object, noting that the operation is async.
1158 */
1159 P.preview = function f(switchToTab){
1160
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -1149,11 +1149,11 @@
1149 return this;
1150 };
1151
1152 /**
1153 Fetches the page preview based on the contents and settings of
1154 this page's input fields, and updates the UI with the
1155 preview.
1156
1157 Returns this object, noting that the operation is async.
1158 */
1159 P.preview = function f(switchToTab){
1160
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -1457,11 +1457,11 @@
14571457
return this;
14581458
};
14591459
14601460
/**
14611461
Fetches the page preview based on the contents and settings of
1462
- this page's input fields, and updates the UI with with the
1462
+ this page's input fields, and updates the UI with the
14631463
preview.
14641464
14651465
Returns this object, noting that the operation is async.
14661466
*/
14671467
P.preview = function f(switchToTab){
14681468
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -1457,11 +1457,11 @@
1457 return this;
1458 };
1459
1460 /**
1461 Fetches the page preview based on the contents and settings of
1462 this page's input fields, and updates the UI with with the
1463 preview.
1464
1465 Returns this object, noting that the operation is async.
1466 */
1467 P.preview = function f(switchToTab){
1468
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -1457,11 +1457,11 @@
1457 return this;
1458 };
1459
1460 /**
1461 Fetches the page preview based on the contents and settings of
1462 this page's input fields, and updates the UI with the
1463 preview.
1464
1465 Returns this object, noting that the operation is async.
1466 */
1467 P.preview = function f(switchToTab){
1468
--- src/fossil.pikchr.js
+++ src/fossil.pikchr.js
@@ -54,11 +54,11 @@
5454
meta) is handled differently everywhere. Shift is used
5555
by the browser, Ctrl doesn't work on an iMac, and Alt is
5656
intercepted by most Linux window managers to control
5757
window movement! So... we just listen for *any* of them
5858
(except Shift) and the user will need to find one which
59
- works on on their environment. */
59
+ works on their environment. */
6060
|| this.classList.contains('toggle')){
6161
this.classList.toggle('source');
6262
ev.stopPropagation();
6363
ev.preventDefault();
6464
}
6565
--- src/fossil.pikchr.js
+++ src/fossil.pikchr.js
@@ -54,11 +54,11 @@
54 meta) is handled differently everywhere. Shift is used
55 by the browser, Ctrl doesn't work on an iMac, and Alt is
56 intercepted by most Linux window managers to control
57 window movement! So... we just listen for *any* of them
58 (except Shift) and the user will need to find one which
59 works on on their environment. */
60 || this.classList.contains('toggle')){
61 this.classList.toggle('source');
62 ev.stopPropagation();
63 ev.preventDefault();
64 }
65
--- src/fossil.pikchr.js
+++ src/fossil.pikchr.js
@@ -54,11 +54,11 @@
54 meta) is handled differently everywhere. Shift is used
55 by the browser, Ctrl doesn't work on an iMac, and Alt is
56 intercepted by most Linux window managers to control
57 window movement! So... we just listen for *any* of them
58 (except Shift) and the user will need to find one which
59 works on their environment. */
60 || this.classList.contains('toggle')){
61 this.classList.toggle('source');
62 ev.stopPropagation();
63 ev.preventDefault();
64 }
65
--- src/fossil.wikiedit-wysiwyg.js
+++ src/fossil.wikiedit-wysiwyg.js
@@ -449,21 +449,21 @@
449449
oDoc.focus();
450450
}
451451
452452
////////////////////////////////////////////////////////////////////////
453453
// A hook which can be activated via a site skin to plug this editor
454
- // in to the wikiedit page.
454
+ // into the wikiedit page.
455455
F.page.wysiwyg = {
456456
// only for debugging: oDoc: oDoc,
457457
/*
458458
Replaces wikiedit's default editor widget with this wysiwyg
459459
editor.
460460
461461
Must either be called via an onPageLoad handler via the site
462462
skin's footer or else it can be called manually from the dev
463463
tools console. Calling it too early (e.g. in the page footer
464
- outside of an an onPageLoad handler) will crash because wikiedit
464
+ outside of an onPageLoad handler) will crash because wikiedit
465465
has not been initialized.
466466
*/
467467
init: function(){
468468
initDoc();
469469
const content = F.page.wikiContent() || '';
470470
--- src/fossil.wikiedit-wysiwyg.js
+++ src/fossil.wikiedit-wysiwyg.js
@@ -449,21 +449,21 @@
449 oDoc.focus();
450 }
451
452 ////////////////////////////////////////////////////////////////////////
453 // A hook which can be activated via a site skin to plug this editor
454 // in to the wikiedit page.
455 F.page.wysiwyg = {
456 // only for debugging: oDoc: oDoc,
457 /*
458 Replaces wikiedit's default editor widget with this wysiwyg
459 editor.
460
461 Must either be called via an onPageLoad handler via the site
462 skin's footer or else it can be called manually from the dev
463 tools console. Calling it too early (e.g. in the page footer
464 outside of an an onPageLoad handler) will crash because wikiedit
465 has not been initialized.
466 */
467 init: function(){
468 initDoc();
469 const content = F.page.wikiContent() || '';
470
--- src/fossil.wikiedit-wysiwyg.js
+++ src/fossil.wikiedit-wysiwyg.js
@@ -449,21 +449,21 @@
449 oDoc.focus();
450 }
451
452 ////////////////////////////////////////////////////////////////////////
453 // A hook which can be activated via a site skin to plug this editor
454 // into the wikiedit page.
455 F.page.wysiwyg = {
456 // only for debugging: oDoc: oDoc,
457 /*
458 Replaces wikiedit's default editor widget with this wysiwyg
459 editor.
460
461 Must either be called via an onPageLoad handler via the site
462 skin's footer or else it can be called manually from the dev
463 tools console. Calling it too early (e.g. in the page footer
464 outside of an onPageLoad handler) will crash because wikiedit
465 has not been initialized.
466 */
467 init: function(){
468 initDoc();
469 const content = F.page.wikiContent() || '';
470
+1 -1
--- src/fshell.c
+++ src/fshell.c
@@ -21,11 +21,11 @@
2121
** after the fashion of a standard Bourne shell and forks a child process
2222
** to run the corresponding Fossil command. This only works on Unix.
2323
**
2424
** The "fossil shell" command is intended for use with SEE-enabled fossil.
2525
** It allows multiple commands to be issued without having to reenter the
26
-** crypto phasephrase for each command.
26
+** crypto passphrase for each command.
2727
*/
2828
#include "config.h"
2929
#include "fshell.h"
3030
#include <ctype.h>
3131
3232
--- src/fshell.c
+++ src/fshell.c
@@ -21,11 +21,11 @@
21 ** after the fashion of a standard Bourne shell and forks a child process
22 ** to run the corresponding Fossil command. This only works on Unix.
23 **
24 ** The "fossil shell" command is intended for use with SEE-enabled fossil.
25 ** It allows multiple commands to be issued without having to reenter the
26 ** crypto phasephrase for each command.
27 */
28 #include "config.h"
29 #include "fshell.h"
30 #include <ctype.h>
31
32
--- src/fshell.c
+++ src/fshell.c
@@ -21,11 +21,11 @@
21 ** after the fashion of a standard Bourne shell and forks a child process
22 ** to run the corresponding Fossil command. This only works on Unix.
23 **
24 ** The "fossil shell" command is intended for use with SEE-enabled fossil.
25 ** It allows multiple commands to be issued without having to reenter the
26 ** crypto passphrase for each command.
27 */
28 #include "config.h"
29 #include "fshell.h"
30 #include <ctype.h>
31
32
+2 -2
--- src/glob.c
+++ src/glob.c
@@ -29,11 +29,11 @@
2929
** zVal: "x"
3030
** zGlobList: "*.o,*.obj"
3131
**
3232
** Result: "(x GLOB '*.o' OR x GLOB '*.obj')"
3333
**
34
-** Commas and whitespace are considered to be element delimters. Each
34
+** Commas and whitespace are considered to be element delimiters. Each
3535
** element of the GLOB list may optionally be enclosed in either '...' or
3636
** "...". This allows commas and/or whitespace to be used in the elements
3737
** themselves.
3838
**
3939
** The returned string is owned by the caller, who must fossil_free()
@@ -57,11 +57,11 @@
5757
cTerm = zGlobList[0];
5858
zGlobList++;
5959
}else{
6060
cTerm = ',';
6161
}
62
- /* Find the next delimter (or the end of the string). */
62
+ /* Find the next delimiter (or the end of the string). */
6363
for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){
6464
if( cTerm!=',' ) continue; /* If quoted, keep going. */
6565
if( fossil_isspace(zGlobList[i]) ) break; /* If space, stop. */
6666
}
6767
blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList);
6868
--- src/glob.c
+++ src/glob.c
@@ -29,11 +29,11 @@
29 ** zVal: "x"
30 ** zGlobList: "*.o,*.obj"
31 **
32 ** Result: "(x GLOB '*.o' OR x GLOB '*.obj')"
33 **
34 ** Commas and whitespace are considered to be element delimters. Each
35 ** element of the GLOB list may optionally be enclosed in either '...' or
36 ** "...". This allows commas and/or whitespace to be used in the elements
37 ** themselves.
38 **
39 ** The returned string is owned by the caller, who must fossil_free()
@@ -57,11 +57,11 @@
57 cTerm = zGlobList[0];
58 zGlobList++;
59 }else{
60 cTerm = ',';
61 }
62 /* Find the next delimter (or the end of the string). */
63 for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){
64 if( cTerm!=',' ) continue; /* If quoted, keep going. */
65 if( fossil_isspace(zGlobList[i]) ) break; /* If space, stop. */
66 }
67 blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList);
68
--- src/glob.c
+++ src/glob.c
@@ -29,11 +29,11 @@
29 ** zVal: "x"
30 ** zGlobList: "*.o,*.obj"
31 **
32 ** Result: "(x GLOB '*.o' OR x GLOB '*.obj')"
33 **
34 ** Commas and whitespace are considered to be element delimiters. Each
35 ** element of the GLOB list may optionally be enclosed in either '...' or
36 ** "...". This allows commas and/or whitespace to be used in the elements
37 ** themselves.
38 **
39 ** The returned string is owned by the caller, who must fossil_free()
@@ -57,11 +57,11 @@
57 cTerm = zGlobList[0];
58 zGlobList++;
59 }else{
60 cTerm = ',';
61 }
62 /* Find the next delimiter (or the end of the string). */
63 for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){
64 if( cTerm!=',' ) continue; /* If quoted, keep going. */
65 if( fossil_isspace(zGlobList[i]) ) break; /* If space, stop. */
66 }
67 blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList);
68
+1 -1
--- src/graph.c
+++ src/graph.c
@@ -51,11 +51,11 @@
5151
5252
/*
5353
** The type of integer identifiers for rows of the graph.
5454
**
5555
** For a normal /timeline graph, the identifiers are never that big
56
-** an an ordinary 32-bit int will work fine. But for the /finfo page,
56
+** an ordinary 32-bit int will work fine. But for the /finfo page,
5757
** the identifier is a combination of the BLOB.RID and the FILENAME.FNID
5858
** values, and so it can become quite large for repos that have both many
5959
** check-ins and many files. For this reason, we make the identifier
6060
** a 64-bit integer, to dramatically reduce the risk of an overflow.
6161
*/
6262
--- src/graph.c
+++ src/graph.c
@@ -51,11 +51,11 @@
51
52 /*
53 ** The type of integer identifiers for rows of the graph.
54 **
55 ** For a normal /timeline graph, the identifiers are never that big
56 ** an an ordinary 32-bit int will work fine. But for the /finfo page,
57 ** the identifier is a combination of the BLOB.RID and the FILENAME.FNID
58 ** values, and so it can become quite large for repos that have both many
59 ** check-ins and many files. For this reason, we make the identifier
60 ** a 64-bit integer, to dramatically reduce the risk of an overflow.
61 */
62
--- src/graph.c
+++ src/graph.c
@@ -51,11 +51,11 @@
51
52 /*
53 ** The type of integer identifiers for rows of the graph.
54 **
55 ** For a normal /timeline graph, the identifiers are never that big
56 ** an ordinary 32-bit int will work fine. But for the /finfo page,
57 ** the identifier is a combination of the BLOB.RID and the FILENAME.FNID
58 ** values, and so it can become quite large for repos that have both many
59 ** check-ins and many files. For this reason, we make the identifier
60 ** a 64-bit integer, to dramatically reduce the risk of an overflow.
61 */
62
+1 -1
--- src/hname.c
+++ src/hname.c
@@ -199,11 +199,11 @@
199199
200200
/*
201201
** Return the default hash policy for repositories that do not currently
202202
** have an assigned hash policy.
203203
**
204
-** Make the default HPOLICY_AUTO if there are SHA1 artficates but no SHA3
204
+** Make the default HPOLICY_AUTO if there are SHA1 artifacts but no SHA3
205205
** artifacts in the repository. Make the default HPOLICY_SHA3 if there
206206
** are one or more SHA3 artifacts or if the repository is initially empty.
207207
*/
208208
int hname_default_policy(void){
209209
if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40")
210210
--- src/hname.c
+++ src/hname.c
@@ -199,11 +199,11 @@
199
200 /*
201 ** Return the default hash policy for repositories that do not currently
202 ** have an assigned hash policy.
203 **
204 ** Make the default HPOLICY_AUTO if there are SHA1 artficates but no SHA3
205 ** artifacts in the repository. Make the default HPOLICY_SHA3 if there
206 ** are one or more SHA3 artifacts or if the repository is initially empty.
207 */
208 int hname_default_policy(void){
209 if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40")
210
--- src/hname.c
+++ src/hname.c
@@ -199,11 +199,11 @@
199
200 /*
201 ** Return the default hash policy for repositories that do not currently
202 ** have an assigned hash policy.
203 **
204 ** Make the default HPOLICY_AUTO if there are SHA1 artifacts but no SHA3
205 ** artifacts in the repository. Make the default HPOLICY_SHA3 if there
206 ** are one or more SHA3 artifacts or if the repository is initially empty.
207 */
208 int hname_default_policy(void){
209 if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40")
210
+1 -1
--- src/hook.c
+++ src/hook.c
@@ -29,11 +29,11 @@
2929
** }
3030
**
3131
** hook-last-rcvid The last rcvid for which post-receive hooks were
3232
** run.
3333
**
34
-** hook-embargo Do not run hooks again before this julianday.
34
+** hook-embargo Do not run hooks again before this Julian day.
3535
**
3636
** For "after-receive" hooks, a list of the received artifacts is sent
3737
** into the command via standard input. Each line of input begins with
3838
** the hash of the artifact and continues with a description of the
3939
** interpretation of the artifact.
4040
--- src/hook.c
+++ src/hook.c
@@ -29,11 +29,11 @@
29 ** }
30 **
31 ** hook-last-rcvid The last rcvid for which post-receive hooks were
32 ** run.
33 **
34 ** hook-embargo Do not run hooks again before this julianday.
35 **
36 ** For "after-receive" hooks, a list of the received artifacts is sent
37 ** into the command via standard input. Each line of input begins with
38 ** the hash of the artifact and continues with a description of the
39 ** interpretation of the artifact.
40
--- src/hook.c
+++ src/hook.c
@@ -29,11 +29,11 @@
29 ** }
30 **
31 ** hook-last-rcvid The last rcvid for which post-receive hooks were
32 ** run.
33 **
34 ** hook-embargo Do not run hooks again before this Julian day.
35 **
36 ** For "after-receive" hooks, a list of the received artifacts is sent
37 ** into the command via standard input. Each line of input begins with
38 ** the hash of the artifact and continues with a description of the
39 ** interpretation of the artifact.
40
+35 -15
--- src/http.c
+++ src/http.c
@@ -246,11 +246,11 @@
246246
}
247247
return zHttpAuth;
248248
}
249249
250250
/*
251
-** Send content pSend to the the server identified by g.url using the
251
+** Send content pSend to the server identified by g.url using the
252252
** external program given by g.zHttpCmd. Capture the reply from that
253253
** program and load it into pReply.
254254
**
255255
** This routine implements the --transport-command option for "fossil sync".
256256
*/
@@ -353,11 +353,11 @@
353353
db_finalize(&s);
354354
db_swap_connections();
355355
}
356356
}
357357
358
-/* Add an approprate PATH= argument to the SSH command under construction
358
+/* Add an appropriate PATH= argument to the SSH command under construction
359359
** in pCmd.
360360
**
361361
** About This Feature
362362
** ==================
363363
**
@@ -581,11 +581,13 @@
581581
}
582582
if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){
583583
int ii;
584584
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
585585
while( zLine[ii]==' ' ) ii++;
586
- fossil_warning("server says: %s", &zLine[ii]);
586
+ if( (mHttpFlags & HTTP_QUIET)==0 ){
587
+ fossil_warning("server says: %s", &zLine[ii]);
588
+ }
587589
goto write_err;
588590
}
589591
if( iHttpVersion==0 ){
590592
closeConnection = 1;
591593
}else{
@@ -616,11 +618,13 @@
616618
int i, j;
617619
int wasHttps;
618620
int priorUrlFlags;
619621
620622
if ( --maxRedirect == 0){
621
- fossil_warning("redirect limit exceeded");
623
+ if( (mHttpFlags & HTTP_QUIET)==0 ){
624
+ fossil_warning("redirect limit exceeded");
625
+ }
622626
goto write_err;
623627
}
624628
for(i=9; zLine[i] && zLine[i]==' '; i++){}
625629
if( zLine[i]==0 ){
626630
fossil_warning("malformed redirect: %s", zLine);
@@ -633,23 +637,29 @@
633637
}
634638
if( (mHttpFlags & HTTP_QUIET)==0 ){
635639
fossil_print("redirect with status %d to %s\n", rc, &zLine[i]);
636640
}
637641
if( g.url.isFile || g.url.isSsh ){
638
- fossil_warning("cannot redirect from %s to %s", g.url.canonical,
639
- &zLine[i]);
642
+ if( (mHttpFlags & HTTP_QUIET)==0 ){
643
+ fossil_warning("cannot redirect from %s to %s", g.url.canonical,
644
+ &zLine[i]);
645
+ }
640646
goto write_err;
641647
}
642648
wasHttps = g.url.isHttps;
643649
priorUrlFlags = g.url.flags;
644650
url_parse(&zLine[i], 0);
645651
if( wasHttps && !g.url.isHttps ){
646
- fossil_warning("cannot redirect from HTTPS to HTTP");
652
+ if( (mHttpFlags & HTTP_QUIET)==0 ){
653
+ fossil_warning("cannot redirect from HTTPS to HTTP");
654
+ }
647655
goto write_err;
648656
}
649657
if( g.url.isSsh || g.url.isFile ){
650
- fossil_warning("cannot redirect to %s", &zLine[i]);
658
+ if( (mHttpFlags & HTTP_QUIET)==0 ){
659
+ fossil_warning("cannot redirect to %s", &zLine[i]);
660
+ }
651661
goto write_err;
652662
}
653663
transport_close(&g.url);
654664
transport_global_shutdown(&g.url);
655665
fSeenHttpAuth = 0;
@@ -704,20 +714,23 @@
704714
}
705715
return rc;
706716
}else{
707717
/* The problem could not be corrected by retrying. Report the
708718
** the error. */
709
- if( g.url.isSsh && !g.fSshTrace ){
719
+ if( mHttpFlags & HTTP_QUIET ){
720
+ /* no-op */
721
+ }else if( g.url.isSsh && !g.fSshTrace ){
710722
fossil_warning("server did not reply: "
711723
" rerun with --sshtrace for diagnostics");
712724
}else{
713725
fossil_warning("server did not reply");
714726
}
715727
goto write_err;
716728
}
717729
}
718730
if( rc!=200 ){
731
+ if( mHttpFlags & HTTP_QUIET ) goto write_err;
719732
fossil_warning("\"location:\" missing from %d redirect reply", rc);
720733
goto write_err;
721734
}
722735
723736
/*
@@ -733,19 +746,21 @@
733746
iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength);
734747
if( mHttpFlags & HTTP_VERBOSE ){
735748
fossil_print("Reply received: %d of %d bytes\n", iRecvLen, iLength);
736749
}
737750
if( iRecvLen != iLength ){
751
+ if( mHttpFlags & HTTP_QUIET ) goto write_err;
738752
fossil_warning("response truncated: got %d bytes of %d",
739753
iRecvLen, iLength);
740754
goto write_err;
741755
}
742
- }else if( closeConnection ){
756
+ }else{
743757
/* Read content until end-of-file */
744758
int iRecvLen; /* Received length of the reply payload */
745759
unsigned int nReq = 1000;
746760
unsigned int nPrior = 0;
761
+ closeConnection = 1;
747762
do{
748763
nReq *= 2;
749764
blob_resize(pReply, nPrior+nReq);
750765
iRecvLen = transport_receive(&g.url, &pReply->aData[nPrior], (int)nReq);
751766
nPrior += iRecvLen;
@@ -752,13 +767,10 @@
752767
pReply->nUsed = nPrior;
753768
}while( iRecvLen==nReq && nReq<0x20000000 );
754769
if( mHttpFlags & HTTP_VERBOSE ){
755770
fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior);
756771
}
757
- }else{
758
- assert( iLength<0 && !closeConnection );
759
- fossil_warning("\"content-length\" missing from %d keep-alive reply", rc);
760772
}
761773
if( isError ){
762774
char *z;
763775
int i, j;
764776
z = blob_str(pReply);
@@ -768,11 +780,17 @@
768780
if( z[i]==0 ) break;
769781
}
770782
z[j] = z[i];
771783
}
772784
z[j] = 0;
773
- fossil_warning("server sends error: %s", z);
785
+ if( mHttpFlags & HTTP_QUIET ){
786
+ /* no-op */
787
+ }else if( mHttpFlags & HTTP_VERBOSE ){
788
+ fossil_warning("server sends error: %s", z);
789
+ }else{
790
+ fossil_warning("server sends error");
791
+ }
774792
goto write_err;
775793
}
776794
if( isCompressed ) blob_uncompress(pReply, pReply);
777795
778796
/*
@@ -794,10 +812,11 @@
794812
795813
/*
796814
** Jump to here if an error is seen.
797815
*/
798816
write_err:
817
+ g.iResultCode = 1;
799818
transport_close(&g.url);
800819
return 1;
801820
}
802821
803822
/*
@@ -843,11 +862,12 @@
843862
}
844863
if( find_option("xfer",0,0)!=0 ){
845864
mHttpFlags |= HTTP_USE_LOGIN;
846865
mHttpFlags &= ~HTTP_GENERIC;
847866
}
848
- if( find_option("ipv4",0,0) ) g.fIPv4 = 1;
867
+ if( find_option("ipv4",0,0) ) g.eIPvers = 1;
868
+ if( find_option("ipv6",0,0) ) g.eIPvers = 2;
849869
zSubpath = find_option("subpath",0,1);
850870
verify_all_options();
851871
if( g.argc<3 || g.argc>5 ){
852872
usage("URL ?PAYLOAD? ?OUTPUT?");
853873
}
854874
--- src/http.c
+++ src/http.c
@@ -246,11 +246,11 @@
246 }
247 return zHttpAuth;
248 }
249
250 /*
251 ** Send content pSend to the the server identified by g.url using the
252 ** external program given by g.zHttpCmd. Capture the reply from that
253 ** program and load it into pReply.
254 **
255 ** This routine implements the --transport-command option for "fossil sync".
256 */
@@ -353,11 +353,11 @@
353 db_finalize(&s);
354 db_swap_connections();
355 }
356 }
357
358 /* Add an approprate PATH= argument to the SSH command under construction
359 ** in pCmd.
360 **
361 ** About This Feature
362 ** ==================
363 **
@@ -581,11 +581,13 @@
581 }
582 if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){
583 int ii;
584 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
585 while( zLine[ii]==' ' ) ii++;
586 fossil_warning("server says: %s", &zLine[ii]);
 
 
587 goto write_err;
588 }
589 if( iHttpVersion==0 ){
590 closeConnection = 1;
591 }else{
@@ -616,11 +618,13 @@
616 int i, j;
617 int wasHttps;
618 int priorUrlFlags;
619
620 if ( --maxRedirect == 0){
621 fossil_warning("redirect limit exceeded");
 
 
622 goto write_err;
623 }
624 for(i=9; zLine[i] && zLine[i]==' '; i++){}
625 if( zLine[i]==0 ){
626 fossil_warning("malformed redirect: %s", zLine);
@@ -633,23 +637,29 @@
633 }
634 if( (mHttpFlags & HTTP_QUIET)==0 ){
635 fossil_print("redirect with status %d to %s\n", rc, &zLine[i]);
636 }
637 if( g.url.isFile || g.url.isSsh ){
638 fossil_warning("cannot redirect from %s to %s", g.url.canonical,
639 &zLine[i]);
 
 
640 goto write_err;
641 }
642 wasHttps = g.url.isHttps;
643 priorUrlFlags = g.url.flags;
644 url_parse(&zLine[i], 0);
645 if( wasHttps && !g.url.isHttps ){
646 fossil_warning("cannot redirect from HTTPS to HTTP");
 
 
647 goto write_err;
648 }
649 if( g.url.isSsh || g.url.isFile ){
650 fossil_warning("cannot redirect to %s", &zLine[i]);
 
 
651 goto write_err;
652 }
653 transport_close(&g.url);
654 transport_global_shutdown(&g.url);
655 fSeenHttpAuth = 0;
@@ -704,20 +714,23 @@
704 }
705 return rc;
706 }else{
707 /* The problem could not be corrected by retrying. Report the
708 ** the error. */
709 if( g.url.isSsh && !g.fSshTrace ){
 
 
710 fossil_warning("server did not reply: "
711 " rerun with --sshtrace for diagnostics");
712 }else{
713 fossil_warning("server did not reply");
714 }
715 goto write_err;
716 }
717 }
718 if( rc!=200 ){
 
719 fossil_warning("\"location:\" missing from %d redirect reply", rc);
720 goto write_err;
721 }
722
723 /*
@@ -733,19 +746,21 @@
733 iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength);
734 if( mHttpFlags & HTTP_VERBOSE ){
735 fossil_print("Reply received: %d of %d bytes\n", iRecvLen, iLength);
736 }
737 if( iRecvLen != iLength ){
 
738 fossil_warning("response truncated: got %d bytes of %d",
739 iRecvLen, iLength);
740 goto write_err;
741 }
742 }else if( closeConnection ){
743 /* Read content until end-of-file */
744 int iRecvLen; /* Received length of the reply payload */
745 unsigned int nReq = 1000;
746 unsigned int nPrior = 0;
 
747 do{
748 nReq *= 2;
749 blob_resize(pReply, nPrior+nReq);
750 iRecvLen = transport_receive(&g.url, &pReply->aData[nPrior], (int)nReq);
751 nPrior += iRecvLen;
@@ -752,13 +767,10 @@
752 pReply->nUsed = nPrior;
753 }while( iRecvLen==nReq && nReq<0x20000000 );
754 if( mHttpFlags & HTTP_VERBOSE ){
755 fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior);
756 }
757 }else{
758 assert( iLength<0 && !closeConnection );
759 fossil_warning("\"content-length\" missing from %d keep-alive reply", rc);
760 }
761 if( isError ){
762 char *z;
763 int i, j;
764 z = blob_str(pReply);
@@ -768,11 +780,17 @@
768 if( z[i]==0 ) break;
769 }
770 z[j] = z[i];
771 }
772 z[j] = 0;
773 fossil_warning("server sends error: %s", z);
 
 
 
 
 
 
774 goto write_err;
775 }
776 if( isCompressed ) blob_uncompress(pReply, pReply);
777
778 /*
@@ -794,10 +812,11 @@
794
795 /*
796 ** Jump to here if an error is seen.
797 */
798 write_err:
 
799 transport_close(&g.url);
800 return 1;
801 }
802
803 /*
@@ -843,11 +862,12 @@
843 }
844 if( find_option("xfer",0,0)!=0 ){
845 mHttpFlags |= HTTP_USE_LOGIN;
846 mHttpFlags &= ~HTTP_GENERIC;
847 }
848 if( find_option("ipv4",0,0) ) g.fIPv4 = 1;
 
849 zSubpath = find_option("subpath",0,1);
850 verify_all_options();
851 if( g.argc<3 || g.argc>5 ){
852 usage("URL ?PAYLOAD? ?OUTPUT?");
853 }
854
--- src/http.c
+++ src/http.c
@@ -246,11 +246,11 @@
246 }
247 return zHttpAuth;
248 }
249
250 /*
251 ** Send content pSend to the server identified by g.url using the
252 ** external program given by g.zHttpCmd. Capture the reply from that
253 ** program and load it into pReply.
254 **
255 ** This routine implements the --transport-command option for "fossil sync".
256 */
@@ -353,11 +353,11 @@
353 db_finalize(&s);
354 db_swap_connections();
355 }
356 }
357
358 /* Add an appropriate PATH= argument to the SSH command under construction
359 ** in pCmd.
360 **
361 ** About This Feature
362 ** ==================
363 **
@@ -581,11 +581,13 @@
581 }
582 if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){
583 int ii;
584 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
585 while( zLine[ii]==' ' ) ii++;
586 if( (mHttpFlags & HTTP_QUIET)==0 ){
587 fossil_warning("server says: %s", &zLine[ii]);
588 }
589 goto write_err;
590 }
591 if( iHttpVersion==0 ){
592 closeConnection = 1;
593 }else{
@@ -616,11 +618,13 @@
618 int i, j;
619 int wasHttps;
620 int priorUrlFlags;
621
622 if ( --maxRedirect == 0){
623 if( (mHttpFlags & HTTP_QUIET)==0 ){
624 fossil_warning("redirect limit exceeded");
625 }
626 goto write_err;
627 }
628 for(i=9; zLine[i] && zLine[i]==' '; i++){}
629 if( zLine[i]==0 ){
630 fossil_warning("malformed redirect: %s", zLine);
@@ -633,23 +637,29 @@
637 }
638 if( (mHttpFlags & HTTP_QUIET)==0 ){
639 fossil_print("redirect with status %d to %s\n", rc, &zLine[i]);
640 }
641 if( g.url.isFile || g.url.isSsh ){
642 if( (mHttpFlags & HTTP_QUIET)==0 ){
643 fossil_warning("cannot redirect from %s to %s", g.url.canonical,
644 &zLine[i]);
645 }
646 goto write_err;
647 }
648 wasHttps = g.url.isHttps;
649 priorUrlFlags = g.url.flags;
650 url_parse(&zLine[i], 0);
651 if( wasHttps && !g.url.isHttps ){
652 if( (mHttpFlags & HTTP_QUIET)==0 ){
653 fossil_warning("cannot redirect from HTTPS to HTTP");
654 }
655 goto write_err;
656 }
657 if( g.url.isSsh || g.url.isFile ){
658 if( (mHttpFlags & HTTP_QUIET)==0 ){
659 fossil_warning("cannot redirect to %s", &zLine[i]);
660 }
661 goto write_err;
662 }
663 transport_close(&g.url);
664 transport_global_shutdown(&g.url);
665 fSeenHttpAuth = 0;
@@ -704,20 +714,23 @@
714 }
715 return rc;
716 }else{
717 /* The problem could not be corrected by retrying. Report the
718 ** the error. */
719 if( mHttpFlags & HTTP_QUIET ){
720 /* no-op */
721 }else if( g.url.isSsh && !g.fSshTrace ){
722 fossil_warning("server did not reply: "
723 " rerun with --sshtrace for diagnostics");
724 }else{
725 fossil_warning("server did not reply");
726 }
727 goto write_err;
728 }
729 }
730 if( rc!=200 ){
731 if( mHttpFlags & HTTP_QUIET ) goto write_err;
732 fossil_warning("\"location:\" missing from %d redirect reply", rc);
733 goto write_err;
734 }
735
736 /*
@@ -733,19 +746,21 @@
746 iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength);
747 if( mHttpFlags & HTTP_VERBOSE ){
748 fossil_print("Reply received: %d of %d bytes\n", iRecvLen, iLength);
749 }
750 if( iRecvLen != iLength ){
751 if( mHttpFlags & HTTP_QUIET ) goto write_err;
752 fossil_warning("response truncated: got %d bytes of %d",
753 iRecvLen, iLength);
754 goto write_err;
755 }
756 }else{
757 /* Read content until end-of-file */
758 int iRecvLen; /* Received length of the reply payload */
759 unsigned int nReq = 1000;
760 unsigned int nPrior = 0;
761 closeConnection = 1;
762 do{
763 nReq *= 2;
764 blob_resize(pReply, nPrior+nReq);
765 iRecvLen = transport_receive(&g.url, &pReply->aData[nPrior], (int)nReq);
766 nPrior += iRecvLen;
@@ -752,13 +767,10 @@
767 pReply->nUsed = nPrior;
768 }while( iRecvLen==nReq && nReq<0x20000000 );
769 if( mHttpFlags & HTTP_VERBOSE ){
770 fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior);
771 }
 
 
 
772 }
773 if( isError ){
774 char *z;
775 int i, j;
776 z = blob_str(pReply);
@@ -768,11 +780,17 @@
780 if( z[i]==0 ) break;
781 }
782 z[j] = z[i];
783 }
784 z[j] = 0;
785 if( mHttpFlags & HTTP_QUIET ){
786 /* no-op */
787 }else if( mHttpFlags & HTTP_VERBOSE ){
788 fossil_warning("server sends error: %s", z);
789 }else{
790 fossil_warning("server sends error");
791 }
792 goto write_err;
793 }
794 if( isCompressed ) blob_uncompress(pReply, pReply);
795
796 /*
@@ -794,10 +812,11 @@
812
813 /*
814 ** Jump to here if an error is seen.
815 */
816 write_err:
817 g.iResultCode = 1;
818 transport_close(&g.url);
819 return 1;
820 }
821
822 /*
@@ -843,11 +862,12 @@
862 }
863 if( find_option("xfer",0,0)!=0 ){
864 mHttpFlags |= HTTP_USE_LOGIN;
865 mHttpFlags &= ~HTTP_GENERIC;
866 }
867 if( find_option("ipv4",0,0) ) g.eIPvers = 1;
868 if( find_option("ipv6",0,0) ) g.eIPvers = 2;
869 zSubpath = find_option("subpath",0,1);
870 verify_all_options();
871 if( g.argc<3 || g.argc>5 ){
872 usage("URL ?PAYLOAD? ?OUTPUT?");
873 }
874
--- src/http_socket.c
+++ src/http_socket.c
@@ -87,10 +87,17 @@
8787
char *socket_errmsg(void){
8888
char *zResult = socketErrMsg;
8989
socketErrMsg = 0;
9090
return zResult;
9191
}
92
+
93
+/*
94
+** Return the file descriptor for the open socket.
95
+*/
96
+int socket_get_fd(){
97
+ return iSocket;
98
+}
9299
93100
/*
94101
** Call this routine once before any other use of the socket interface.
95102
** This routine does initial configuration of the socket module.
96103
*/
@@ -153,11 +160,15 @@
153160
char zRemote[NI_MAXHOST];
154161
155162
socket_global_init();
156163
socket_close();
157164
memset(&hints, 0, sizeof(struct addrinfo));
158
- hints.ai_family = g.fIPv4 ? AF_INET : AF_UNSPEC;
165
+ switch( g.eIPvers ){
166
+ default: hints.ai_family = AF_UNSPEC; break;
167
+ case 1: hints.ai_family = AF_INET; break;
168
+ case 2: hints.ai_family = AF_INET6; break;
169
+ }
159170
hints.ai_socktype = SOCK_STREAM;
160171
hints.ai_protocol = IPPROTO_TCP;
161172
sqlite3_snprintf(sizeof(zPort),zPort,"%d", pUrlData->port);
162173
rc = getaddrinfo(pUrlData->name, zPort, &hints, &ai);
163174
if( rc ){
164175
--- src/http_socket.c
+++ src/http_socket.c
@@ -87,10 +87,17 @@
87 char *socket_errmsg(void){
88 char *zResult = socketErrMsg;
89 socketErrMsg = 0;
90 return zResult;
91 }
 
 
 
 
 
 
 
92
93 /*
94 ** Call this routine once before any other use of the socket interface.
95 ** This routine does initial configuration of the socket module.
96 */
@@ -153,11 +160,15 @@
153 char zRemote[NI_MAXHOST];
154
155 socket_global_init();
156 socket_close();
157 memset(&hints, 0, sizeof(struct addrinfo));
158 hints.ai_family = g.fIPv4 ? AF_INET : AF_UNSPEC;
 
 
 
 
159 hints.ai_socktype = SOCK_STREAM;
160 hints.ai_protocol = IPPROTO_TCP;
161 sqlite3_snprintf(sizeof(zPort),zPort,"%d", pUrlData->port);
162 rc = getaddrinfo(pUrlData->name, zPort, &hints, &ai);
163 if( rc ){
164
--- src/http_socket.c
+++ src/http_socket.c
@@ -87,10 +87,17 @@
87 char *socket_errmsg(void){
88 char *zResult = socketErrMsg;
89 socketErrMsg = 0;
90 return zResult;
91 }
92
93 /*
94 ** Return the file descriptor for the open socket.
95 */
96 int socket_get_fd(){
97 return iSocket;
98 }
99
100 /*
101 ** Call this routine once before any other use of the socket interface.
102 ** This routine does initial configuration of the socket module.
103 */
@@ -153,11 +160,15 @@
160 char zRemote[NI_MAXHOST];
161
162 socket_global_init();
163 socket_close();
164 memset(&hints, 0, sizeof(struct addrinfo));
165 switch( g.eIPvers ){
166 default: hints.ai_family = AF_UNSPEC; break;
167 case 1: hints.ai_family = AF_INET; break;
168 case 2: hints.ai_family = AF_INET6; break;
169 }
170 hints.ai_socktype = SOCK_STREAM;
171 hints.ai_protocol = IPPROTO_TCP;
172 sqlite3_snprintf(sizeof(zPort),zPort,"%d", pUrlData->port);
173 rc = getaddrinfo(pUrlData->name, zPort, &hints, &ai);
174 if( rc ){
175
+26 -80
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -220,15 +220,18 @@
220220
if( !ASN1_TIME_check(asn1_time) ){
221221
return mprintf("Bad time value");
222222
}else{
223223
char res[20];
224224
char *pr = res;
225
- const char *pt = (char *)asn1_time->data;
225
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
226
+ #define ASN1_STRING_get0_data ASN1_STRING_data
227
+#endif
228
+ const char *pt = (const char *)ASN1_STRING_get0_data(asn1_time);
226229
/* 0123456789 1234
227230
** UTCTime: YYMMDDHHMMSSZ (YY >= 50 ? 19YY : 20YY)
228231
** GeneralizedTime: YYYYMMDDHHMMSSZ */
229
- if( asn1_time->length < 15 ){
232
+ if( ASN1_STRING_length(asn1_time) < 15 ){
230233
/* UTCTime, fill out century digits */
231234
*pr++ = pt[0]>='5' ? '1' : '2';
232235
*pr++ = pt[0]>='5' ? '9' : '0';
233236
}else{
234237
/* GeneralizedTime, copy century digits and advance source */
@@ -267,11 +270,11 @@
267270
268271
/* Find the trust store */
269272
zFile = 0;
270273
for(i=0; zFile==0 && i<5; i++){
271274
switch( i ){
272
- case 0: /* First priority is environmentn variables */
275
+ case 0: /* First priority is environment variables */
273276
zFile = fossil_getenv(X509_get_default_cert_file_env());
274277
break;
275278
case 1:
276279
zFile = fossil_getenv(X509_get_default_cert_dir_env());
277280
break;
@@ -360,10 +363,11 @@
360363
if( sslIsInit ){
361364
SSL_CTX_free(sslCtx);
362365
ssl_clear_errmsg();
363366
sslIsInit = 0;
364367
}
368
+ socket_global_shutdown();
365369
}
366370
367371
/*
368372
** Close the currently open client SSL connection. If no connection is open,
369373
** this routine is a no-op.
@@ -372,10 +376,11 @@
372376
if( iBio!=NULL ){
373377
(void)BIO_reset(iBio);
374378
BIO_free_all(iBio);
375379
iBio = NULL;
376380
}
381
+ socket_close();
377382
}
378383
379384
/* See RFC2817 for details */
380385
static int establish_proxy_tunnel(UrlData *pUrlData, BIO *bio){
381386
int rc, httpVerMin;
@@ -447,52 +452,35 @@
447452
** Return the number of errors.
448453
*/
449454
int ssl_open_client(UrlData *pUrlData){
450455
X509 *cert;
451456
const char *zRemoteHost;
457
+ BIO *sBio;
452458
453459
ssl_global_init_client();
460
+ if( socket_open(pUrlData) ){
461
+ ssl_set_errmsg("SSL: cannot open socket (%s)", socket_errmsg());
462
+ return 1;
463
+ }
464
+ sBio = BIO_new_socket(socket_get_fd(), 0);
454465
if( pUrlData->useProxy ){
455
- int rc;
456
- char *connStr = mprintf("%s:%d", g.url.name, pUrlData->port);
457
- BIO *sBio = BIO_new_connect(connStr);
458
- if( g.fIPv4 ){
459
-#ifdef BIO_FAMILY_IPV4
460
- BIO_set_conn_ip_family(sBio, BIO_FAMILY_IPV4);
461
-#else
462
- fossil_warning("The --ipv4 option is not supported in this build\n");
463
-#endif
464
- }
465
- fossil_free(connStr);
466
- if( BIO_do_connect(sBio)<=0 ){
467
- ssl_set_errmsg("SSL: cannot connect to proxy %s:%d (%s)",
468
- pUrlData->name, pUrlData->port,
469
- ERR_reason_error_string(ERR_get_error()));
470
- ssl_close_client();
471
- return 1;
472
- }
473
- rc = establish_proxy_tunnel(pUrlData, sBio);
466
+ int rc = establish_proxy_tunnel(pUrlData, sBio);
474467
if( rc<200||rc>299 ){
475468
ssl_set_errmsg("SSL: proxy connect failed with HTTP status code %d", rc);
469
+ ssl_close_client();
476470
return 1;
477471
}
478472
479473
pUrlData->path = pUrlData->proxyUrlPath;
480
-
481
- iBio = BIO_new_ssl(sslCtx, 1);
482
- BIO_push(iBio, sBio);
483
- zRemoteHost = pUrlData->hostname;
484
- }else{
485
- iBio = BIO_new_ssl_connect(sslCtx);
486
- zRemoteHost = pUrlData->name;
487
- }
488
- if( iBio==NULL ) {
489
- ssl_set_errmsg("SSL: cannot open SSL (%s)",
490
- ERR_reason_error_string(ERR_get_error()));
491
- return 1;
492
- }
474
+ }
475
+ iBio = BIO_new_ssl(sslCtx, 1);
476
+ BIO_push(iBio, sBio);
477
+ BIO_set_ssl(sBio, ssl, BIO_NOCLOSE);
478
+ BIO_set_ssl_mode(iBio, 1);
493479
BIO_get_ssl(iBio, &ssl);
480
+
481
+ zRemoteHost = pUrlData->useProxy ? pUrlData->hostname : pUrlData->name;
494482
495483
#if (SSLEAY_VERSION_NUMBER >= 0x00908070) && !defined(OPENSSL_NO_TLSEXT)
496484
if( !SSL_set_tlsext_host_name(ssl, zRemoteHost)){
497485
fossil_warning("WARNING: failed to set server name indication (SNI), "
498486
"continuing without it.\n");
@@ -509,34 +497,14 @@
509497
}
510498
/* SSL_set_verify(ssl, SSL_VERIFY_PEER, 0); */
511499
}
512500
#endif
513501
514
- if( !pUrlData->useProxy ){
515
- char *connStr = mprintf("%s:%d", pUrlData->name, pUrlData->port);
516
- BIO_set_conn_hostname(iBio, connStr);
517
- fossil_free(connStr);
518
- if( g.fIPv4 ){
519
-#ifdef BIO_FAMILY_IPV4
520
- BIO_set_conn_ip_family(iBio, BIO_FAMILY_IPV4);
521
-#else
522
- fossil_warning("The --ipv4 option is not supported in this build\n");
523
-#endif
524
- }
525
- if( BIO_do_connect(iBio)<=0 ){
526
- ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)",
527
- pUrlData->name, pUrlData->port,
528
- ERR_reason_error_string(ERR_get_error()));
529
- ssl_close_client();
530
- return 1;
531
- }
532
- }
533
-
534
- if( BIO_do_handshake(iBio)<=0 ) {
502
+ if( BIO_do_handshake(iBio)<=0 ){
535503
ssl_set_errmsg("Error establishing SSL connection %s:%d (%s)",
536
- pUrlData->useProxy?pUrlData->hostname:pUrlData->name,
537
- pUrlData->useProxy?pUrlData->proxyOrigPort:pUrlData->port,
504
+ zRemoteHost,
505
+ pUrlData->useProxy ? pUrlData->proxyOrigPort : pUrlData->port,
538506
ERR_reason_error_string(ERR_get_error()));
539507
ssl_close_client();
540508
return 1;
541509
}
542510
/* Check if certificate is valid */
@@ -626,32 +594,10 @@
626594
}
627595
blob_reset(&ans);
628596
}
629597
}
630598
631
- /* Set the Global.zIpAddr variable to the server we are talking to.
632
- ** This is used to populate the ipaddr column of the rcvfrom table,
633
- ** if any files are received from the server.
634
- */
635
- {
636
- /* As soon as libressl implements
637
- ** BIO_ADDR_hostname_string/BIO_get_conn_address.
638
- ** check here for the correct LIBRESSL_VERSION_NUMBER too. For now: disable
639
- */
640
-#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L \
641
- && !defined(LIBRESSL_VERSION_NUMBER)
642
- char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
643
- g.zIpAddr = fossil_strdup(ip);
644
- OPENSSL_free(ip);
645
-#else
646
- /* IPv4 only code */
647
- const unsigned char *ip;
648
- ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
649
- g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
650
-#endif
651
- }
652
-
653599
X509_free(cert);
654600
return 0;
655601
}
656602
657603
/*
658604
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -220,15 +220,18 @@
220 if( !ASN1_TIME_check(asn1_time) ){
221 return mprintf("Bad time value");
222 }else{
223 char res[20];
224 char *pr = res;
225 const char *pt = (char *)asn1_time->data;
 
 
 
226 /* 0123456789 1234
227 ** UTCTime: YYMMDDHHMMSSZ (YY >= 50 ? 19YY : 20YY)
228 ** GeneralizedTime: YYYYMMDDHHMMSSZ */
229 if( asn1_time->length < 15 ){
230 /* UTCTime, fill out century digits */
231 *pr++ = pt[0]>='5' ? '1' : '2';
232 *pr++ = pt[0]>='5' ? '9' : '0';
233 }else{
234 /* GeneralizedTime, copy century digits and advance source */
@@ -267,11 +270,11 @@
267
268 /* Find the trust store */
269 zFile = 0;
270 for(i=0; zFile==0 && i<5; i++){
271 switch( i ){
272 case 0: /* First priority is environmentn variables */
273 zFile = fossil_getenv(X509_get_default_cert_file_env());
274 break;
275 case 1:
276 zFile = fossil_getenv(X509_get_default_cert_dir_env());
277 break;
@@ -360,10 +363,11 @@
360 if( sslIsInit ){
361 SSL_CTX_free(sslCtx);
362 ssl_clear_errmsg();
363 sslIsInit = 0;
364 }
 
365 }
366
367 /*
368 ** Close the currently open client SSL connection. If no connection is open,
369 ** this routine is a no-op.
@@ -372,10 +376,11 @@
372 if( iBio!=NULL ){
373 (void)BIO_reset(iBio);
374 BIO_free_all(iBio);
375 iBio = NULL;
376 }
 
377 }
378
379 /* See RFC2817 for details */
380 static int establish_proxy_tunnel(UrlData *pUrlData, BIO *bio){
381 int rc, httpVerMin;
@@ -447,52 +452,35 @@
447 ** Return the number of errors.
448 */
449 int ssl_open_client(UrlData *pUrlData){
450 X509 *cert;
451 const char *zRemoteHost;
 
452
453 ssl_global_init_client();
 
 
 
 
 
454 if( pUrlData->useProxy ){
455 int rc;
456 char *connStr = mprintf("%s:%d", g.url.name, pUrlData->port);
457 BIO *sBio = BIO_new_connect(connStr);
458 if( g.fIPv4 ){
459 #ifdef BIO_FAMILY_IPV4
460 BIO_set_conn_ip_family(sBio, BIO_FAMILY_IPV4);
461 #else
462 fossil_warning("The --ipv4 option is not supported in this build\n");
463 #endif
464 }
465 fossil_free(connStr);
466 if( BIO_do_connect(sBio)<=0 ){
467 ssl_set_errmsg("SSL: cannot connect to proxy %s:%d (%s)",
468 pUrlData->name, pUrlData->port,
469 ERR_reason_error_string(ERR_get_error()));
470 ssl_close_client();
471 return 1;
472 }
473 rc = establish_proxy_tunnel(pUrlData, sBio);
474 if( rc<200||rc>299 ){
475 ssl_set_errmsg("SSL: proxy connect failed with HTTP status code %d", rc);
 
476 return 1;
477 }
478
479 pUrlData->path = pUrlData->proxyUrlPath;
480
481 iBio = BIO_new_ssl(sslCtx, 1);
482 BIO_push(iBio, sBio);
483 zRemoteHost = pUrlData->hostname;
484 }else{
485 iBio = BIO_new_ssl_connect(sslCtx);
486 zRemoteHost = pUrlData->name;
487 }
488 if( iBio==NULL ) {
489 ssl_set_errmsg("SSL: cannot open SSL (%s)",
490 ERR_reason_error_string(ERR_get_error()));
491 return 1;
492 }
493 BIO_get_ssl(iBio, &ssl);
 
 
494
495 #if (SSLEAY_VERSION_NUMBER >= 0x00908070) && !defined(OPENSSL_NO_TLSEXT)
496 if( !SSL_set_tlsext_host_name(ssl, zRemoteHost)){
497 fossil_warning("WARNING: failed to set server name indication (SNI), "
498 "continuing without it.\n");
@@ -509,34 +497,14 @@
509 }
510 /* SSL_set_verify(ssl, SSL_VERIFY_PEER, 0); */
511 }
512 #endif
513
514 if( !pUrlData->useProxy ){
515 char *connStr = mprintf("%s:%d", pUrlData->name, pUrlData->port);
516 BIO_set_conn_hostname(iBio, connStr);
517 fossil_free(connStr);
518 if( g.fIPv4 ){
519 #ifdef BIO_FAMILY_IPV4
520 BIO_set_conn_ip_family(iBio, BIO_FAMILY_IPV4);
521 #else
522 fossil_warning("The --ipv4 option is not supported in this build\n");
523 #endif
524 }
525 if( BIO_do_connect(iBio)<=0 ){
526 ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)",
527 pUrlData->name, pUrlData->port,
528 ERR_reason_error_string(ERR_get_error()));
529 ssl_close_client();
530 return 1;
531 }
532 }
533
534 if( BIO_do_handshake(iBio)<=0 ) {
535 ssl_set_errmsg("Error establishing SSL connection %s:%d (%s)",
536 pUrlData->useProxy?pUrlData->hostname:pUrlData->name,
537 pUrlData->useProxy?pUrlData->proxyOrigPort:pUrlData->port,
538 ERR_reason_error_string(ERR_get_error()));
539 ssl_close_client();
540 return 1;
541 }
542 /* Check if certificate is valid */
@@ -626,32 +594,10 @@
626 }
627 blob_reset(&ans);
628 }
629 }
630
631 /* Set the Global.zIpAddr variable to the server we are talking to.
632 ** This is used to populate the ipaddr column of the rcvfrom table,
633 ** if any files are received from the server.
634 */
635 {
636 /* As soon as libressl implements
637 ** BIO_ADDR_hostname_string/BIO_get_conn_address.
638 ** check here for the correct LIBRESSL_VERSION_NUMBER too. For now: disable
639 */
640 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L \
641 && !defined(LIBRESSL_VERSION_NUMBER)
642 char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
643 g.zIpAddr = fossil_strdup(ip);
644 OPENSSL_free(ip);
645 #else
646 /* IPv4 only code */
647 const unsigned char *ip;
648 ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
649 g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
650 #endif
651 }
652
653 X509_free(cert);
654 return 0;
655 }
656
657 /*
658
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -220,15 +220,18 @@
220 if( !ASN1_TIME_check(asn1_time) ){
221 return mprintf("Bad time value");
222 }else{
223 char res[20];
224 char *pr = res;
225 #if OPENSSL_VERSION_NUMBER < 0x10100000L
226 #define ASN1_STRING_get0_data ASN1_STRING_data
227 #endif
228 const char *pt = (const char *)ASN1_STRING_get0_data(asn1_time);
229 /* 0123456789 1234
230 ** UTCTime: YYMMDDHHMMSSZ (YY >= 50 ? 19YY : 20YY)
231 ** GeneralizedTime: YYYYMMDDHHMMSSZ */
232 if( ASN1_STRING_length(asn1_time) < 15 ){
233 /* UTCTime, fill out century digits */
234 *pr++ = pt[0]>='5' ? '1' : '2';
235 *pr++ = pt[0]>='5' ? '9' : '0';
236 }else{
237 /* GeneralizedTime, copy century digits and advance source */
@@ -267,11 +270,11 @@
270
271 /* Find the trust store */
272 zFile = 0;
273 for(i=0; zFile==0 && i<5; i++){
274 switch( i ){
275 case 0: /* First priority is environment variables */
276 zFile = fossil_getenv(X509_get_default_cert_file_env());
277 break;
278 case 1:
279 zFile = fossil_getenv(X509_get_default_cert_dir_env());
280 break;
@@ -360,10 +363,11 @@
363 if( sslIsInit ){
364 SSL_CTX_free(sslCtx);
365 ssl_clear_errmsg();
366 sslIsInit = 0;
367 }
368 socket_global_shutdown();
369 }
370
371 /*
372 ** Close the currently open client SSL connection. If no connection is open,
373 ** this routine is a no-op.
@@ -372,10 +376,11 @@
376 if( iBio!=NULL ){
377 (void)BIO_reset(iBio);
378 BIO_free_all(iBio);
379 iBio = NULL;
380 }
381 socket_close();
382 }
383
384 /* See RFC2817 for details */
385 static int establish_proxy_tunnel(UrlData *pUrlData, BIO *bio){
386 int rc, httpVerMin;
@@ -447,52 +452,35 @@
452 ** Return the number of errors.
453 */
454 int ssl_open_client(UrlData *pUrlData){
455 X509 *cert;
456 const char *zRemoteHost;
457 BIO *sBio;
458
459 ssl_global_init_client();
460 if( socket_open(pUrlData) ){
461 ssl_set_errmsg("SSL: cannot open socket (%s)", socket_errmsg());
462 return 1;
463 }
464 sBio = BIO_new_socket(socket_get_fd(), 0);
465 if( pUrlData->useProxy ){
466 int rc = establish_proxy_tunnel(pUrlData, sBio);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467 if( rc<200||rc>299 ){
468 ssl_set_errmsg("SSL: proxy connect failed with HTTP status code %d", rc);
469 ssl_close_client();
470 return 1;
471 }
472
473 pUrlData->path = pUrlData->proxyUrlPath;
474 }
475 iBio = BIO_new_ssl(sslCtx, 1);
476 BIO_push(iBio, sBio);
477 BIO_set_ssl(sBio, ssl, BIO_NOCLOSE);
478 BIO_set_ssl_mode(iBio, 1);
 
 
 
 
 
 
 
 
479 BIO_get_ssl(iBio, &ssl);
480
481 zRemoteHost = pUrlData->useProxy ? pUrlData->hostname : pUrlData->name;
482
483 #if (SSLEAY_VERSION_NUMBER >= 0x00908070) && !defined(OPENSSL_NO_TLSEXT)
484 if( !SSL_set_tlsext_host_name(ssl, zRemoteHost)){
485 fossil_warning("WARNING: failed to set server name indication (SNI), "
486 "continuing without it.\n");
@@ -509,34 +497,14 @@
497 }
498 /* SSL_set_verify(ssl, SSL_VERIFY_PEER, 0); */
499 }
500 #endif
501
502 if( BIO_do_handshake(iBio)<=0 ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503 ssl_set_errmsg("Error establishing SSL connection %s:%d (%s)",
504 zRemoteHost,
505 pUrlData->useProxy ? pUrlData->proxyOrigPort : pUrlData->port,
506 ERR_reason_error_string(ERR_get_error()));
507 ssl_close_client();
508 return 1;
509 }
510 /* Check if certificate is valid */
@@ -626,32 +594,10 @@
594 }
595 blob_reset(&ans);
596 }
597 }
598
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599 X509_free(cert);
600 return 0;
601 }
602
603 /*
604
+4 -4
--- src/json.c
+++ src/json.c
@@ -240,11 +240,11 @@
240240
** - g.json.gc.a is NULL
241241
** - key is NULL or empty.
242242
**
243243
** Returns 0 on success.
244244
**
245
-** Ownership of v is transfered to (or shared with) g.json.gc, and v
245
+** Ownership of v is transferred to (or shared with) g.json.gc, and v
246246
** will be valid until that object is cleaned up or some internal code
247247
** incorrectly removes it from the gc (which we never do). If this
248248
** function fails, it is fatal to the app (as it indicates an
249249
** allocation error (more likely than not) or a serious internal error
250250
** such as numeric overflow).
@@ -271,11 +271,11 @@
271271
272272
273273
/*
274274
** Returns the value of json_rc_cstr(code) as a new JSON
275275
** string, which is owned by the caller and must eventually
276
-** be cson_value_free()d or transfered to a JSON container.
276
+** be cson_value_free()d or transferred to a JSON container.
277277
*/
278278
cson_value * json_rc_string( int code ){
279279
return cson_value_new_string( json_rc_cstr(code), 11 );
280280
}
281281
@@ -864,11 +864,11 @@
864864
/*
865865
** Splits zStr (which must not be NULL) into tokens separated by the
866866
** given separator character. If doDeHttp is true then each element
867867
** will be passed through dehttpize(), otherwise they are used
868868
** as-is. Note that tokenization happens before dehttpize(),
869
-** which is significant if the ENcoded tokens might contain the
869
+** which is significant if the encoded tokens might contain the
870870
** separator character.
871871
**
872872
** Each new element is appended to the given target array object,
873873
** which must not be NULL and ownership of it is not changed by this
874874
** call.
@@ -1437,11 +1437,11 @@
14371437
** If payload is not NULL and resultCode is 0 then it is set as the
14381438
** "payload" property of the returned object. If resultCode is 0 then
14391439
** it defaults to g.json.resultCode. If resultCode is (or defaults to)
14401440
** non-zero and payload is not NULL then this function calls
14411441
** cson_value_free(payload) and does not insert the payload into the
1442
-** response. In either case, ownership of payload is transfered to (or
1442
+** response. In either case, ownership of payload is transferred to (or
14431443
** shared with, if the caller holds a reference) this function.
14441444
**
14451445
** pMsg is an optional message string property (resultText) of the
14461446
** response. If resultCode is non-0 and pMsg is NULL then
14471447
** json_err_cstr() is used to get the error string. The caller may
14481448
--- src/json.c
+++ src/json.c
@@ -240,11 +240,11 @@
240 ** - g.json.gc.a is NULL
241 ** - key is NULL or empty.
242 **
243 ** Returns 0 on success.
244 **
245 ** Ownership of v is transfered to (or shared with) g.json.gc, and v
246 ** will be valid until that object is cleaned up or some internal code
247 ** incorrectly removes it from the gc (which we never do). If this
248 ** function fails, it is fatal to the app (as it indicates an
249 ** allocation error (more likely than not) or a serious internal error
250 ** such as numeric overflow).
@@ -271,11 +271,11 @@
271
272
273 /*
274 ** Returns the value of json_rc_cstr(code) as a new JSON
275 ** string, which is owned by the caller and must eventually
276 ** be cson_value_free()d or transfered to a JSON container.
277 */
278 cson_value * json_rc_string( int code ){
279 return cson_value_new_string( json_rc_cstr(code), 11 );
280 }
281
@@ -864,11 +864,11 @@
864 /*
865 ** Splits zStr (which must not be NULL) into tokens separated by the
866 ** given separator character. If doDeHttp is true then each element
867 ** will be passed through dehttpize(), otherwise they are used
868 ** as-is. Note that tokenization happens before dehttpize(),
869 ** which is significant if the ENcoded tokens might contain the
870 ** separator character.
871 **
872 ** Each new element is appended to the given target array object,
873 ** which must not be NULL and ownership of it is not changed by this
874 ** call.
@@ -1437,11 +1437,11 @@
1437 ** If payload is not NULL and resultCode is 0 then it is set as the
1438 ** "payload" property of the returned object. If resultCode is 0 then
1439 ** it defaults to g.json.resultCode. If resultCode is (or defaults to)
1440 ** non-zero and payload is not NULL then this function calls
1441 ** cson_value_free(payload) and does not insert the payload into the
1442 ** response. In either case, ownership of payload is transfered to (or
1443 ** shared with, if the caller holds a reference) this function.
1444 **
1445 ** pMsg is an optional message string property (resultText) of the
1446 ** response. If resultCode is non-0 and pMsg is NULL then
1447 ** json_err_cstr() is used to get the error string. The caller may
1448
--- src/json.c
+++ src/json.c
@@ -240,11 +240,11 @@
240 ** - g.json.gc.a is NULL
241 ** - key is NULL or empty.
242 **
243 ** Returns 0 on success.
244 **
245 ** Ownership of v is transferred to (or shared with) g.json.gc, and v
246 ** will be valid until that object is cleaned up or some internal code
247 ** incorrectly removes it from the gc (which we never do). If this
248 ** function fails, it is fatal to the app (as it indicates an
249 ** allocation error (more likely than not) or a serious internal error
250 ** such as numeric overflow).
@@ -271,11 +271,11 @@
271
272
273 /*
274 ** Returns the value of json_rc_cstr(code) as a new JSON
275 ** string, which is owned by the caller and must eventually
276 ** be cson_value_free()d or transferred to a JSON container.
277 */
278 cson_value * json_rc_string( int code ){
279 return cson_value_new_string( json_rc_cstr(code), 11 );
280 }
281
@@ -864,11 +864,11 @@
864 /*
865 ** Splits zStr (which must not be NULL) into tokens separated by the
866 ** given separator character. If doDeHttp is true then each element
867 ** will be passed through dehttpize(), otherwise they are used
868 ** as-is. Note that tokenization happens before dehttpize(),
869 ** which is significant if the encoded tokens might contain the
870 ** separator character.
871 **
872 ** Each new element is appended to the given target array object,
873 ** which must not be NULL and ownership of it is not changed by this
874 ** call.
@@ -1437,11 +1437,11 @@
1437 ** If payload is not NULL and resultCode is 0 then it is set as the
1438 ** "payload" property of the returned object. If resultCode is 0 then
1439 ** it defaults to g.json.resultCode. If resultCode is (or defaults to)
1440 ** non-zero and payload is not NULL then this function calls
1441 ** cson_value_free(payload) and does not insert the payload into the
1442 ** response. In either case, ownership of payload is transferred to (or
1443 ** shared with, if the caller holds a reference) this function.
1444 **
1445 ** pMsg is an optional message string property (resultText) of the
1446 ** response. If resultCode is non-0 and pMsg is NULL then
1447 ** json_err_cstr() is used to get the error string. The caller may
1448
--- src/json_report.c
+++ src/json_report.c
@@ -155,11 +155,11 @@
155155
**
156156
** report=int (CLI: -report # or -r #) is the report number to run.
157157
**
158158
** limit=int (CLI: -limit # or -n #) -n is for compat. with other commands.
159159
**
160
-** format=a|o Specifies result format: a=each row is an arry, o=each
160
+** format=a|o Specifies result format: a=each row is an array, o=each
161161
** row is an object. Default=o.
162162
*/
163163
static cson_value * json_report_run(void){
164164
int nReport;
165165
Stmt q = empty_Stmt;
166166
--- src/json_report.c
+++ src/json_report.c
@@ -155,11 +155,11 @@
155 **
156 ** report=int (CLI: -report # or -r #) is the report number to run.
157 **
158 ** limit=int (CLI: -limit # or -n #) -n is for compat. with other commands.
159 **
160 ** format=a|o Specifies result format: a=each row is an arry, o=each
161 ** row is an object. Default=o.
162 */
163 static cson_value * json_report_run(void){
164 int nReport;
165 Stmt q = empty_Stmt;
166
--- src/json_report.c
+++ src/json_report.c
@@ -155,11 +155,11 @@
155 **
156 ** report=int (CLI: -report # or -r #) is the report number to run.
157 **
158 ** limit=int (CLI: -limit # or -n #) -n is for compat. with other commands.
159 **
160 ** format=a|o Specifies result format: a=each row is an array, o=each
161 ** row is an object. Default=o.
162 */
163 static cson_value * json_report_run(void){
164 int nReport;
165 Stmt q = empty_Stmt;
166
--- src/json_status.c
+++ src/json_status.c
@@ -126,11 +126,11 @@
126126
zStatus = "missing";
127127
++nErr;
128128
}
129129
}else if( isChnged ){
130130
switch( isChnged ){
131
- /* These numbers from from checkin.c: status_report() */
131
+ /* These numbers from checkin.c: status_report() */
132132
case 1:
133133
if( file_contains_merge_marker(zFullName) ){
134134
zStatus = "conflict";
135135
}else{
136136
zStatus = "edited";
137137
--- src/json_status.c
+++ src/json_status.c
@@ -126,11 +126,11 @@
126 zStatus = "missing";
127 ++nErr;
128 }
129 }else if( isChnged ){
130 switch( isChnged ){
131 /* These numbers from from checkin.c: status_report() */
132 case 1:
133 if( file_contains_merge_marker(zFullName) ){
134 zStatus = "conflict";
135 }else{
136 zStatus = "edited";
137
--- src/json_status.c
+++ src/json_status.c
@@ -126,11 +126,11 @@
126 zStatus = "missing";
127 ++nErr;
128 }
129 }else if( isChnged ){
130 switch( isChnged ){
131 /* These numbers from checkin.c: status_report() */
132 case 1:
133 if( file_contains_merge_marker(zFullName) ){
134 zStatus = "conflict";
135 }else{
136 zStatus = "edited";
137
+16 -10
--- src/login.c
+++ src/login.c
@@ -199,11 +199,11 @@
199199
const char *zUsername, /* Name of user logging in */
200200
const char *zIpAddr, /* IP address from which they logged in */
201201
int bSuccess /* True if the attempt was a success */
202202
){
203203
db_unprotect(PROTECT_READONLY);
204
- if( db_get_boolean("access-log", 0) ){
204
+ if( db_get_boolean("access-log", 1) ){
205205
create_accesslog_table();
206206
db_multi_exec(
207207
"INSERT INTO accesslog(uname,ipaddr,success,mtime)"
208208
"VALUES(%Q,%Q,%d,julianday('now'));",
209209
zUsername, zIpAddr, bSuccess
@@ -293,11 +293,11 @@
293293
**
294294
** This function also updates the user.cookie, user.ipaddr,
295295
** and user.cexpire fields for the given user.
296296
**
297297
** If zDest is not NULL then the generated cookie is copied to
298
-** *zDdest and ownership is transfered to the caller (who should
298
+** *zDdest and ownership is transferred to the caller (who should
299299
** eventually pass it to free()).
300300
**
301301
** If bSessionCookie is true, the cookie will be a session cookie,
302302
** else a persistent cookie. If it's a session cookie, the
303303
** [user].[cexpire] and [user].[cookie] entries will be modified as if
@@ -379,11 +379,11 @@
379379
** If bSessionCookie is true, the cookie will be a session cookie.
380380
**
381381
** Search for tag-20250817a to find the code that recognizes this cookie.
382382
*/
383383
void login_set_anon_cookie(char **zCookieDest, int bSessionCookie){
384
- char *zNow; /* Current time (julian day number) */
384
+ char *zNow; /* Current time (Julian day number) */
385385
char *zCookie; /* The login cookie */
386386
const char *zUserAgent; /* The user agent */
387387
const char *zCookieName; /* Name of the login cookie */
388388
Blob b; /* Blob used during cookie construction */
389389
int expires = bSessionCookie ? 0 : anon_cookie_lifespan();
@@ -1371,10 +1371,11 @@
13711371
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
13721372
** g.perm Permissions granted to this user
13731373
** g.anon Permissions that would be available to anonymous
13741374
** g.isRobot True if the client is known to be a spider or robot
13751375
** g.perm Populated based on user account's capabilities
1376
+** g.eAuthMethod The mechanism used for authentication
13761377
**
13771378
*/
13781379
void login_check_credentials(void){
13791380
int uid = 0; /* User id */
13801381
const char *zCookie; /* Text of the login cookie */
@@ -1411,10 +1412,11 @@
14111412
}
14121413
g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid);
14131414
zCap = "sxy";
14141415
g.noPswd = 1;
14151416
g.isRobot = 0;
1417
+ g.eAuthMethod = AUTH_LOCAL;
14161418
zSeed = db_text("??", "SELECT uid||quote(login)||quote(pw)||quote(cookie)"
14171419
" FROM user WHERE uid=%d", uid);
14181420
login_create_csrf_secret(zSeed);
14191421
fossil_free(zSeed);
14201422
}
@@ -1490,10 +1492,11 @@
14901492
" AND octet_length(cap)>0"
14911493
" AND octet_length(pw)>0");
14921494
}
14931495
}
14941496
}
1497
+ if( uid ) g.eAuthMethod = AUTH_COOKIE;
14951498
login_create_csrf_secret(zHash);
14961499
}
14971500
14981501
/* If no user found and the REMOTE_USER environment variable is set,
14991502
** then accept the value of REMOTE_USER as the user.
@@ -1502,19 +1505,21 @@
15021505
const char *zRemoteUser = P("REMOTE_USER");
15031506
if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){
15041507
uid = db_int(0, "SELECT uid FROM user WHERE login=%Q"
15051508
" AND octet_length(cap)>0 AND octet_length(pw)>0",
15061509
zRemoteUser);
1510
+ if( uid ) g.eAuthMethod = AUTH_ENV;
15071511
}
15081512
}
15091513
15101514
/* If the request didn't provide a login cookie or the login cookie didn't
15111515
** match a known valid user, check the HTTP "Authorization" header and
15121516
** see if those credentials are valid for a known user.
15131517
*/
15141518
if( uid==0 && db_get_boolean("http_authentication_ok",0) ){
15151519
uid = login_basic_authentication(zIpAddr);
1520
+ if( uid ) g.eAuthMethod = AUTH_HTTP;
15161521
}
15171522
15181523
/* Check for magic query parameters "resid" (for the username) and
15191524
** "token" for the password. Both values (if they exist) will be
15201525
** obfuscated.
@@ -1529,10 +1534,11 @@
15291534
" WHERE login=%Q"
15301535
" AND (constant_time_cmp(pw,%Q)=0"
15311536
" OR constant_time_cmp(pw,%Q)=0)",
15321537
zUsr, zSha1Pw, zPW);
15331538
fossil_free(zSha1Pw);
1539
+ if( uid ) g.eAuthMethod = AUTH_PW;
15341540
}
15351541
}
15361542
15371543
/* If no user found yet, try to log in as "nobody" */
15381544
if( uid==0 ){
@@ -1925,11 +1931,11 @@
19251931
}
19261932
}
19271933
19281934
/*
19291935
** Call this routine if the user lacks g.perm.Hyperlink permission. If
1930
-** the anonymous user has Hyperlink permission, then paint a mesage
1936
+** the anonymous user has Hyperlink permission, then paint a message
19311937
** to inform the user that much more information is available by
19321938
** logging in as anonymous.
19331939
*/
19341940
void login_anonymous_available(void){
19351941
if( !g.perm.Hyperlink && g.anon.Hyperlink && anon_cookie_lifespan()>0 ){
@@ -1949,13 +1955,13 @@
19491955
}
19501956
19511957
/*
19521958
** Check to see if the candidate username zUserID is already used.
19531959
** Return 1 if it is already in use. Return 0 if the name is
1954
-** available for a self-registeration.
1960
+** available for a self-registration.
19551961
*/
1956
-static int login_self_choosen_userid_already_exists(const char *zUserID){
1962
+static int login_self_chosen_userid_already_exists(const char *zUserID){
19571963
int rc = db_exists(
19581964
"SELECT 1 FROM user WHERE login=%Q "
19591965
"UNION ALL "
19601966
"SELECT 1 FROM event WHERE user=%Q OR euser=%Q",
19611967
zUserID, zUserID, zUserID
@@ -2140,11 +2146,11 @@
21402146
iErrLine = 5;
21412147
zErr = "Passwords do not match";
21422148
}else if( (uid = email_address_in_use(zEAddr))!=0 ){
21432149
iErrLine = 3;
21442150
zErr = "This email address is already associated with a user";
2145
- }else if( login_self_choosen_userid_already_exists(zUserID) ){
2151
+ }else if( login_self_chosen_userid_already_exists(zUserID) ){
21462152
iErrLine = 1;
21472153
zErr = "This User ID is already taken. Choose something different.";
21482154
}else{
21492155
/* If all of the tests above have passed, that means that the submitted
21502156
** form contains valid data and we can proceed to create the new login */
@@ -2151,11 +2157,11 @@
21512157
Blob sql;
21522158
int uid;
21532159
char *zPass = sha1_shared_secret(zPasswd, zUserID, 0);
21542160
const char *zStartPerms = zPerms;
21552161
if( db_get_boolean("selfreg-verify",0) ){
2156
- /* If email verification is required for self-registration, initalize
2162
+ /* If email verification is required for self-registration, initialize
21572163
** the new user capabilities to just "7" (Sign up for email). The
21582164
** full "default-perms" permissions will be added when they click
21592165
** the verification link on the email they are sent. */
21602166
zStartPerms = "7";
21612167
}
@@ -2206,11 +2212,11 @@
22062212
);
22072213
if( db_exists("SELECT 1 FROM subscriber WHERE semail=%Q"
22082214
" AND sverified", zEAddr) ){
22092215
/* This the case where the user was formerly a verified subscriber
22102216
** and here they have also registered as a user as well. It is
2211
- ** not necessary to repeat the verfication step */
2217
+ ** not necessary to repeat the verification step */
22122218
login_redirect_to_g();
22132219
}
22142220
/* A verification email */
22152221
pSender = alert_sender_new(0,0);
22162222
blob_init(&hdr,0,0);
@@ -2377,11 +2383,11 @@
23772383
style_finish_page();
23782384
return;
23792385
}
23802386
zEAddr = PDT("ea","");
23812387
2382
- /* Verify user imputs */
2388
+ /* Verify user inputs */
23832389
if( !cgi_csrf_safe(1) || P("reqpwreset")==0 ){
23842390
/* This is the initial display of the form. No processing or error
23852391
** checking is to be done. Fall through into the form display
23862392
**
23872393
** cgi_csrf_safe(): Nothing interesting happens on this page without
23882394
--- src/login.c
+++ src/login.c
@@ -199,11 +199,11 @@
199 const char *zUsername, /* Name of user logging in */
200 const char *zIpAddr, /* IP address from which they logged in */
201 int bSuccess /* True if the attempt was a success */
202 ){
203 db_unprotect(PROTECT_READONLY);
204 if( db_get_boolean("access-log", 0) ){
205 create_accesslog_table();
206 db_multi_exec(
207 "INSERT INTO accesslog(uname,ipaddr,success,mtime)"
208 "VALUES(%Q,%Q,%d,julianday('now'));",
209 zUsername, zIpAddr, bSuccess
@@ -293,11 +293,11 @@
293 **
294 ** This function also updates the user.cookie, user.ipaddr,
295 ** and user.cexpire fields for the given user.
296 **
297 ** If zDest is not NULL then the generated cookie is copied to
298 ** *zDdest and ownership is transfered to the caller (who should
299 ** eventually pass it to free()).
300 **
301 ** If bSessionCookie is true, the cookie will be a session cookie,
302 ** else a persistent cookie. If it's a session cookie, the
303 ** [user].[cexpire] and [user].[cookie] entries will be modified as if
@@ -379,11 +379,11 @@
379 ** If bSessionCookie is true, the cookie will be a session cookie.
380 **
381 ** Search for tag-20250817a to find the code that recognizes this cookie.
382 */
383 void login_set_anon_cookie(char **zCookieDest, int bSessionCookie){
384 char *zNow; /* Current time (julian day number) */
385 char *zCookie; /* The login cookie */
386 const char *zUserAgent; /* The user agent */
387 const char *zCookieName; /* Name of the login cookie */
388 Blob b; /* Blob used during cookie construction */
389 int expires = bSessionCookie ? 0 : anon_cookie_lifespan();
@@ -1371,10 +1371,11 @@
1371 ** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
1372 ** g.perm Permissions granted to this user
1373 ** g.anon Permissions that would be available to anonymous
1374 ** g.isRobot True if the client is known to be a spider or robot
1375 ** g.perm Populated based on user account's capabilities
 
1376 **
1377 */
1378 void login_check_credentials(void){
1379 int uid = 0; /* User id */
1380 const char *zCookie; /* Text of the login cookie */
@@ -1411,10 +1412,11 @@
1411 }
1412 g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid);
1413 zCap = "sxy";
1414 g.noPswd = 1;
1415 g.isRobot = 0;
 
1416 zSeed = db_text("??", "SELECT uid||quote(login)||quote(pw)||quote(cookie)"
1417 " FROM user WHERE uid=%d", uid);
1418 login_create_csrf_secret(zSeed);
1419 fossil_free(zSeed);
1420 }
@@ -1490,10 +1492,11 @@
1490 " AND octet_length(cap)>0"
1491 " AND octet_length(pw)>0");
1492 }
1493 }
1494 }
 
1495 login_create_csrf_secret(zHash);
1496 }
1497
1498 /* If no user found and the REMOTE_USER environment variable is set,
1499 ** then accept the value of REMOTE_USER as the user.
@@ -1502,19 +1505,21 @@
1502 const char *zRemoteUser = P("REMOTE_USER");
1503 if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){
1504 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q"
1505 " AND octet_length(cap)>0 AND octet_length(pw)>0",
1506 zRemoteUser);
 
1507 }
1508 }
1509
1510 /* If the request didn't provide a login cookie or the login cookie didn't
1511 ** match a known valid user, check the HTTP "Authorization" header and
1512 ** see if those credentials are valid for a known user.
1513 */
1514 if( uid==0 && db_get_boolean("http_authentication_ok",0) ){
1515 uid = login_basic_authentication(zIpAddr);
 
1516 }
1517
1518 /* Check for magic query parameters "resid" (for the username) and
1519 ** "token" for the password. Both values (if they exist) will be
1520 ** obfuscated.
@@ -1529,10 +1534,11 @@
1529 " WHERE login=%Q"
1530 " AND (constant_time_cmp(pw,%Q)=0"
1531 " OR constant_time_cmp(pw,%Q)=0)",
1532 zUsr, zSha1Pw, zPW);
1533 fossil_free(zSha1Pw);
 
1534 }
1535 }
1536
1537 /* If no user found yet, try to log in as "nobody" */
1538 if( uid==0 ){
@@ -1925,11 +1931,11 @@
1925 }
1926 }
1927
1928 /*
1929 ** Call this routine if the user lacks g.perm.Hyperlink permission. If
1930 ** the anonymous user has Hyperlink permission, then paint a mesage
1931 ** to inform the user that much more information is available by
1932 ** logging in as anonymous.
1933 */
1934 void login_anonymous_available(void){
1935 if( !g.perm.Hyperlink && g.anon.Hyperlink && anon_cookie_lifespan()>0 ){
@@ -1949,13 +1955,13 @@
1949 }
1950
1951 /*
1952 ** Check to see if the candidate username zUserID is already used.
1953 ** Return 1 if it is already in use. Return 0 if the name is
1954 ** available for a self-registeration.
1955 */
1956 static int login_self_choosen_userid_already_exists(const char *zUserID){
1957 int rc = db_exists(
1958 "SELECT 1 FROM user WHERE login=%Q "
1959 "UNION ALL "
1960 "SELECT 1 FROM event WHERE user=%Q OR euser=%Q",
1961 zUserID, zUserID, zUserID
@@ -2140,11 +2146,11 @@
2140 iErrLine = 5;
2141 zErr = "Passwords do not match";
2142 }else if( (uid = email_address_in_use(zEAddr))!=0 ){
2143 iErrLine = 3;
2144 zErr = "This email address is already associated with a user";
2145 }else if( login_self_choosen_userid_already_exists(zUserID) ){
2146 iErrLine = 1;
2147 zErr = "This User ID is already taken. Choose something different.";
2148 }else{
2149 /* If all of the tests above have passed, that means that the submitted
2150 ** form contains valid data and we can proceed to create the new login */
@@ -2151,11 +2157,11 @@
2151 Blob sql;
2152 int uid;
2153 char *zPass = sha1_shared_secret(zPasswd, zUserID, 0);
2154 const char *zStartPerms = zPerms;
2155 if( db_get_boolean("selfreg-verify",0) ){
2156 /* If email verification is required for self-registration, initalize
2157 ** the new user capabilities to just "7" (Sign up for email). The
2158 ** full "default-perms" permissions will be added when they click
2159 ** the verification link on the email they are sent. */
2160 zStartPerms = "7";
2161 }
@@ -2206,11 +2212,11 @@
2206 );
2207 if( db_exists("SELECT 1 FROM subscriber WHERE semail=%Q"
2208 " AND sverified", zEAddr) ){
2209 /* This the case where the user was formerly a verified subscriber
2210 ** and here they have also registered as a user as well. It is
2211 ** not necessary to repeat the verfication step */
2212 login_redirect_to_g();
2213 }
2214 /* A verification email */
2215 pSender = alert_sender_new(0,0);
2216 blob_init(&hdr,0,0);
@@ -2377,11 +2383,11 @@
2377 style_finish_page();
2378 return;
2379 }
2380 zEAddr = PDT("ea","");
2381
2382 /* Verify user imputs */
2383 if( !cgi_csrf_safe(1) || P("reqpwreset")==0 ){
2384 /* This is the initial display of the form. No processing or error
2385 ** checking is to be done. Fall through into the form display
2386 **
2387 ** cgi_csrf_safe(): Nothing interesting happens on this page without
2388
--- src/login.c
+++ src/login.c
@@ -199,11 +199,11 @@
199 const char *zUsername, /* Name of user logging in */
200 const char *zIpAddr, /* IP address from which they logged in */
201 int bSuccess /* True if the attempt was a success */
202 ){
203 db_unprotect(PROTECT_READONLY);
204 if( db_get_boolean("access-log", 1) ){
205 create_accesslog_table();
206 db_multi_exec(
207 "INSERT INTO accesslog(uname,ipaddr,success,mtime)"
208 "VALUES(%Q,%Q,%d,julianday('now'));",
209 zUsername, zIpAddr, bSuccess
@@ -293,11 +293,11 @@
293 **
294 ** This function also updates the user.cookie, user.ipaddr,
295 ** and user.cexpire fields for the given user.
296 **
297 ** If zDest is not NULL then the generated cookie is copied to
298 ** *zDdest and ownership is transferred to the caller (who should
299 ** eventually pass it to free()).
300 **
301 ** If bSessionCookie is true, the cookie will be a session cookie,
302 ** else a persistent cookie. If it's a session cookie, the
303 ** [user].[cexpire] and [user].[cookie] entries will be modified as if
@@ -379,11 +379,11 @@
379 ** If bSessionCookie is true, the cookie will be a session cookie.
380 **
381 ** Search for tag-20250817a to find the code that recognizes this cookie.
382 */
383 void login_set_anon_cookie(char **zCookieDest, int bSessionCookie){
384 char *zNow; /* Current time (Julian day number) */
385 char *zCookie; /* The login cookie */
386 const char *zUserAgent; /* The user agent */
387 const char *zCookieName; /* Name of the login cookie */
388 Blob b; /* Blob used during cookie construction */
389 int expires = bSessionCookie ? 0 : anon_cookie_lifespan();
@@ -1371,10 +1371,11 @@
1371 ** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
1372 ** g.perm Permissions granted to this user
1373 ** g.anon Permissions that would be available to anonymous
1374 ** g.isRobot True if the client is known to be a spider or robot
1375 ** g.perm Populated based on user account's capabilities
1376 ** g.eAuthMethod The mechanism used for authentication
1377 **
1378 */
1379 void login_check_credentials(void){
1380 int uid = 0; /* User id */
1381 const char *zCookie; /* Text of the login cookie */
@@ -1411,10 +1412,11 @@
1412 }
1413 g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid);
1414 zCap = "sxy";
1415 g.noPswd = 1;
1416 g.isRobot = 0;
1417 g.eAuthMethod = AUTH_LOCAL;
1418 zSeed = db_text("??", "SELECT uid||quote(login)||quote(pw)||quote(cookie)"
1419 " FROM user WHERE uid=%d", uid);
1420 login_create_csrf_secret(zSeed);
1421 fossil_free(zSeed);
1422 }
@@ -1490,10 +1492,11 @@
1492 " AND octet_length(cap)>0"
1493 " AND octet_length(pw)>0");
1494 }
1495 }
1496 }
1497 if( uid ) g.eAuthMethod = AUTH_COOKIE;
1498 login_create_csrf_secret(zHash);
1499 }
1500
1501 /* If no user found and the REMOTE_USER environment variable is set,
1502 ** then accept the value of REMOTE_USER as the user.
@@ -1502,19 +1505,21 @@
1505 const char *zRemoteUser = P("REMOTE_USER");
1506 if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){
1507 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q"
1508 " AND octet_length(cap)>0 AND octet_length(pw)>0",
1509 zRemoteUser);
1510 if( uid ) g.eAuthMethod = AUTH_ENV;
1511 }
1512 }
1513
1514 /* If the request didn't provide a login cookie or the login cookie didn't
1515 ** match a known valid user, check the HTTP "Authorization" header and
1516 ** see if those credentials are valid for a known user.
1517 */
1518 if( uid==0 && db_get_boolean("http_authentication_ok",0) ){
1519 uid = login_basic_authentication(zIpAddr);
1520 if( uid ) g.eAuthMethod = AUTH_HTTP;
1521 }
1522
1523 /* Check for magic query parameters "resid" (for the username) and
1524 ** "token" for the password. Both values (if they exist) will be
1525 ** obfuscated.
@@ -1529,10 +1534,11 @@
1534 " WHERE login=%Q"
1535 " AND (constant_time_cmp(pw,%Q)=0"
1536 " OR constant_time_cmp(pw,%Q)=0)",
1537 zUsr, zSha1Pw, zPW);
1538 fossil_free(zSha1Pw);
1539 if( uid ) g.eAuthMethod = AUTH_PW;
1540 }
1541 }
1542
1543 /* If no user found yet, try to log in as "nobody" */
1544 if( uid==0 ){
@@ -1925,11 +1931,11 @@
1931 }
1932 }
1933
1934 /*
1935 ** Call this routine if the user lacks g.perm.Hyperlink permission. If
1936 ** the anonymous user has Hyperlink permission, then paint a message
1937 ** to inform the user that much more information is available by
1938 ** logging in as anonymous.
1939 */
1940 void login_anonymous_available(void){
1941 if( !g.perm.Hyperlink && g.anon.Hyperlink && anon_cookie_lifespan()>0 ){
@@ -1949,13 +1955,13 @@
1955 }
1956
1957 /*
1958 ** Check to see if the candidate username zUserID is already used.
1959 ** Return 1 if it is already in use. Return 0 if the name is
1960 ** available for a self-registration.
1961 */
1962 static int login_self_chosen_userid_already_exists(const char *zUserID){
1963 int rc = db_exists(
1964 "SELECT 1 FROM user WHERE login=%Q "
1965 "UNION ALL "
1966 "SELECT 1 FROM event WHERE user=%Q OR euser=%Q",
1967 zUserID, zUserID, zUserID
@@ -2140,11 +2146,11 @@
2146 iErrLine = 5;
2147 zErr = "Passwords do not match";
2148 }else if( (uid = email_address_in_use(zEAddr))!=0 ){
2149 iErrLine = 3;
2150 zErr = "This email address is already associated with a user";
2151 }else if( login_self_chosen_userid_already_exists(zUserID) ){
2152 iErrLine = 1;
2153 zErr = "This User ID is already taken. Choose something different.";
2154 }else{
2155 /* If all of the tests above have passed, that means that the submitted
2156 ** form contains valid data and we can proceed to create the new login */
@@ -2151,11 +2157,11 @@
2157 Blob sql;
2158 int uid;
2159 char *zPass = sha1_shared_secret(zPasswd, zUserID, 0);
2160 const char *zStartPerms = zPerms;
2161 if( db_get_boolean("selfreg-verify",0) ){
2162 /* If email verification is required for self-registration, initialize
2163 ** the new user capabilities to just "7" (Sign up for email). The
2164 ** full "default-perms" permissions will be added when they click
2165 ** the verification link on the email they are sent. */
2166 zStartPerms = "7";
2167 }
@@ -2206,11 +2212,11 @@
2212 );
2213 if( db_exists("SELECT 1 FROM subscriber WHERE semail=%Q"
2214 " AND sverified", zEAddr) ){
2215 /* This the case where the user was formerly a verified subscriber
2216 ** and here they have also registered as a user as well. It is
2217 ** not necessary to repeat the verification step */
2218 login_redirect_to_g();
2219 }
2220 /* A verification email */
2221 pSender = alert_sender_new(0,0);
2222 blob_init(&hdr,0,0);
@@ -2377,11 +2383,11 @@
2383 style_finish_page();
2384 return;
2385 }
2386 zEAddr = PDT("ea","");
2387
2388 /* Verify user inputs */
2389 if( !cgi_csrf_safe(1) || P("reqpwreset")==0 ){
2390 /* This is the initial display of the form. No processing or error
2391 ** checking is to be done. Fall through into the form display
2392 **
2393 ** cgi_csrf_safe(): Nothing interesting happens on this page without
2394
+18 -10
--- src/main.c
+++ src/main.c
@@ -63,11 +63,11 @@
6363
#ifdef HAVE_BACKTRACE
6464
# include <execinfo.h>
6565
#endif
6666
6767
/*
68
-** Default length of a timeout for serving an HTTP request. Changable
68
+** Default length of a timeout for serving an HTTP request. Changeable
6969
** using the "--timeout N" command-line option or via "timeout: N" in the
7070
** CGI script.
7171
*/
7272
#ifndef FOSSIL_DEFAULT_TIMEOUT
7373
# define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
@@ -153,10 +153,11 @@
153153
char *nameOfExe; /* Full path of executable. */
154154
const char *zErrlog; /* Log errors to this file, if not NULL */
155155
const char *zPhase; /* Phase of operation, for use by the error log
156156
** and for deriving $canonical_page TH1 variable */
157157
int isConst; /* True if the output is unchanging & cacheable */
158
+ int iResultCode; /* Process reply code for commands */
158159
const char *zVfsName; /* The VFS to use for database connections */
159160
sqlite3 *db; /* The connection to the databases */
160161
sqlite3 *dbConfig; /* Separate connection for global_config table */
161162
char *zAuxSchema; /* Main repository aux-schema */
162163
int dbIgnoreErrors; /* Ignore database errors if true */
@@ -188,11 +189,11 @@
188189
int fSshClient; /* HTTP client flags for SSH client */
189190
int fNoHttpCompress; /* Do not compress HTTP traffic (for debugging) */
190191
char *zSshCmd; /* SSH command string */
191192
const char *zHttpCmd; /* External program to do HTTP requests */
192193
int fNoSync; /* Do not do an autosync ever. --nosync */
193
- int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
194
+ int eIPvers; /* 0: any 1: ipv4-only 2: ipv6-only */
194195
char *zPath; /* Name of webpage being served (may be NULL) */
195196
char *zExtra; /* Extra path information past the webpage name */
196197
char *zBaseURL; /* Full text of the URL being served */
197198
char *zHttpsURL; /* zBaseURL translated to https: */
198199
char *zTop; /* Parent directory of zPath */
@@ -236,10 +237,17 @@
236237
* applicable when using SEE on Windows or Linux. */
237238
#endif
238239
int useLocalauth; /* No login required if from 127.0.0.1 */
239240
int noPswd; /* Logged in without password (on 127.0.0.1) */
240241
int userUid; /* Integer user id */
242
+ int eAuthMethod; /* How the user authenticated to us */
243
+# define AUTH_NONE 0 /* Not authenticated */
244
+# define AUTH_COOKIE 1 /* Authentication by cookie */
245
+# define AUTH_LOCAL 2 /* Uses loopback */
246
+# define AUTH_PW 3 /* Authentication by password */
247
+# define AUTH_ENV 4 /* Authenticated by REMOTE_USER environment var */
248
+# define AUTH_HTTP 5 /* HTTP Basic Authentication */
241249
int isRobot; /* True if the client is definitely a robot. False
242250
** negatives are common for this flag */
243251
int colorOutput; /* Control output of color VT escapes to CLI */
244252
const char *cliColor; /* VT color code for CLI highlight; default: "91" */
245253
int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -778,11 +786,11 @@
778786
if( fossil_getenv("FOSSIL_BREAK") ){
779787
if( fossil_isatty(0) && fossil_isatty(2) ){
780788
fprintf(stderr,
781789
"attach debugger to process %d and press any key to continue.\n",
782790
GETPID());
783
- fgetc(stdin);
791
+ (void)fgetc(stdin);
784792
}else{
785793
#if defined(_WIN32) || defined(WIN32)
786794
DebugBreak();
787795
#elif defined(SIGTRAP)
788796
raise(SIGTRAP);
@@ -1058,11 +1066,11 @@
10581066
if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
10591067
Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags);
10601068
}
10611069
}
10621070
#endif
1063
- fossil_exit(0);
1071
+ fossil_exit(g.iResultCode);
10641072
/*NOT_REACHED*/
10651073
return 0;
10661074
}
10671075
10681076
/*
@@ -1232,11 +1240,11 @@
12321240
** list and this function immediately returns. The effect is to treat
12331241
** all arguments after "--" as non-flags (conventionally used to
12341242
** enable passing-in of filenames which start with a dash).
12351243
**
12361244
** This function must normally only be called one time per app
1237
-** invokation. The exception is commands which process their
1245
+** invocation. The exception is commands which process their
12381246
** arguments, call this to confirm that there are no extraneous flags,
12391247
** then modify the arguments list for forwarding to another
12401248
** (sub)command (which itself will call this to confirm its own
12411249
** arguments).
12421250
*/
@@ -1444,11 +1452,11 @@
14441452
style_finish_page();
14451453
}
14461454
14471455
14481456
/*
1449
-** Set the g.zBaseURL value to the full URL for the toplevel of
1457
+** Set the g.zBaseURL value to the full URL for the top level of
14501458
** the fossil tree. Set g.zTop to g.zBaseURL without the
14511459
** leading "http://" and the host and port.
14521460
**
14531461
** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME
14541462
** environment variables. However, if zAltBase is not NULL then it
@@ -1737,11 +1745,11 @@
17371745
** iLevel. iLevel is 1 for /login pages and 2 for every other page.
17381746
*/
17391747
int fossil_redirect_to_https_if_needed(int iLevel){
17401748
if( fossil_wants_https(iLevel) ){
17411749
const char *zQS = P("QUERY_STRING");
1742
- char *zURL;
1750
+ char *zURL = 0;
17431751
if( zQS==0 || zQS[0]==0 ){
17441752
zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO"));
17451753
}else if( zQS[0]!=0 ){
17461754
zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS);
17471755
}
@@ -2918,11 +2926,11 @@
29182926
** then the server redirects (HTTP code 302) to the URL of --notfound.
29192927
** When REPOSITORY is a directory, the pathname must contain only
29202928
** alphanumerics, "_", "/", "-" and "." and no "-" may occur after a "/"
29212929
** and every "." must be surrounded on both sides by alphanumerics or else
29222930
** a 404 error is returned. Static content files in the directory are
2923
-** returned if they match comma-separate GLOB pattern specified by --files
2931
+** returned if they match comma-separated GLOB pattern specified by --files
29242932
** and do not match "*.fossil*" and have a well-known suffix.
29252933
**
29262934
** Options:
29272935
** --acme Deliver files from the ".well-known" subdirectory
29282936
** --baseurl URL Base URL (useful with reverse proxies)
@@ -2930,11 +2938,11 @@
29302938
** fullchain.pem) taken from FILE.
29312939
** --chroot DIR Use directory for chroot instead of repository path.
29322940
** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
29332941
** /doc/ckout/...
29342942
** --extroot DIR Document root for the /ext extension mechanism
2935
-** --files GLOB Comma-separate glob patterns for static file to serve
2943
+** --files GLOB Comma-separated glob patterns for static files to serve
29362944
** --host NAME DNS Hostname of the server
29372945
** --https The HTTP request originated from https but has already
29382946
** been decoded by a reverse proxy. Hence, URLs created
29392947
** by Fossil should use "https:" rather than "http:".
29402948
** --in FILE Take input from FILE instead of standard input
@@ -3151,11 +3159,11 @@
31513159
** using this command interactively over SSH. A better solution would be
31523160
** to use a different command for "ssh" sync, but we cannot do that without
31533161
** breaking legacy.
31543162
**
31553163
** Options:
3156
-** --csrf-safe N Set cgi_csrf_safe() to to return N
3164
+** --csrf-safe N Set cgi_csrf_safe() to return N
31573165
** --nobody Pretend to be user "nobody"
31583166
** --ssh-sim Pretend to be over an SSH connection
31593167
** --test Do not do special "sync" processing when operating
31603168
** over an SSH link
31613169
** --th-trace Trace TH1 execution (for debugging purposes)
31623170
--- src/main.c
+++ src/main.c
@@ -63,11 +63,11 @@
63 #ifdef HAVE_BACKTRACE
64 # include <execinfo.h>
65 #endif
66
67 /*
68 ** Default length of a timeout for serving an HTTP request. Changable
69 ** using the "--timeout N" command-line option or via "timeout: N" in the
70 ** CGI script.
71 */
72 #ifndef FOSSIL_DEFAULT_TIMEOUT
73 # define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
@@ -153,10 +153,11 @@
153 char *nameOfExe; /* Full path of executable. */
154 const char *zErrlog; /* Log errors to this file, if not NULL */
155 const char *zPhase; /* Phase of operation, for use by the error log
156 ** and for deriving $canonical_page TH1 variable */
157 int isConst; /* True if the output is unchanging & cacheable */
 
158 const char *zVfsName; /* The VFS to use for database connections */
159 sqlite3 *db; /* The connection to the databases */
160 sqlite3 *dbConfig; /* Separate connection for global_config table */
161 char *zAuxSchema; /* Main repository aux-schema */
162 int dbIgnoreErrors; /* Ignore database errors if true */
@@ -188,11 +189,11 @@
188 int fSshClient; /* HTTP client flags for SSH client */
189 int fNoHttpCompress; /* Do not compress HTTP traffic (for debugging) */
190 char *zSshCmd; /* SSH command string */
191 const char *zHttpCmd; /* External program to do HTTP requests */
192 int fNoSync; /* Do not do an autosync ever. --nosync */
193 int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
194 char *zPath; /* Name of webpage being served (may be NULL) */
195 char *zExtra; /* Extra path information past the webpage name */
196 char *zBaseURL; /* Full text of the URL being served */
197 char *zHttpsURL; /* zBaseURL translated to https: */
198 char *zTop; /* Parent directory of zPath */
@@ -236,10 +237,17 @@
236 * applicable when using SEE on Windows or Linux. */
237 #endif
238 int useLocalauth; /* No login required if from 127.0.0.1 */
239 int noPswd; /* Logged in without password (on 127.0.0.1) */
240 int userUid; /* Integer user id */
 
 
 
 
 
 
 
241 int isRobot; /* True if the client is definitely a robot. False
242 ** negatives are common for this flag */
243 int colorOutput; /* Control output of color VT escapes to CLI */
244 const char *cliColor; /* VT color code for CLI highlight; default: "91" */
245 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -778,11 +786,11 @@
778 if( fossil_getenv("FOSSIL_BREAK") ){
779 if( fossil_isatty(0) && fossil_isatty(2) ){
780 fprintf(stderr,
781 "attach debugger to process %d and press any key to continue.\n",
782 GETPID());
783 fgetc(stdin);
784 }else{
785 #if defined(_WIN32) || defined(WIN32)
786 DebugBreak();
787 #elif defined(SIGTRAP)
788 raise(SIGTRAP);
@@ -1058,11 +1066,11 @@
1058 if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1059 Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags);
1060 }
1061 }
1062 #endif
1063 fossil_exit(0);
1064 /*NOT_REACHED*/
1065 return 0;
1066 }
1067
1068 /*
@@ -1232,11 +1240,11 @@
1232 ** list and this function immediately returns. The effect is to treat
1233 ** all arguments after "--" as non-flags (conventionally used to
1234 ** enable passing-in of filenames which start with a dash).
1235 **
1236 ** This function must normally only be called one time per app
1237 ** invokation. The exception is commands which process their
1238 ** arguments, call this to confirm that there are no extraneous flags,
1239 ** then modify the arguments list for forwarding to another
1240 ** (sub)command (which itself will call this to confirm its own
1241 ** arguments).
1242 */
@@ -1444,11 +1452,11 @@
1444 style_finish_page();
1445 }
1446
1447
1448 /*
1449 ** Set the g.zBaseURL value to the full URL for the toplevel of
1450 ** the fossil tree. Set g.zTop to g.zBaseURL without the
1451 ** leading "http://" and the host and port.
1452 **
1453 ** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME
1454 ** environment variables. However, if zAltBase is not NULL then it
@@ -1737,11 +1745,11 @@
1737 ** iLevel. iLevel is 1 for /login pages and 2 for every other page.
1738 */
1739 int fossil_redirect_to_https_if_needed(int iLevel){
1740 if( fossil_wants_https(iLevel) ){
1741 const char *zQS = P("QUERY_STRING");
1742 char *zURL;
1743 if( zQS==0 || zQS[0]==0 ){
1744 zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO"));
1745 }else if( zQS[0]!=0 ){
1746 zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS);
1747 }
@@ -2918,11 +2926,11 @@
2918 ** then the server redirects (HTTP code 302) to the URL of --notfound.
2919 ** When REPOSITORY is a directory, the pathname must contain only
2920 ** alphanumerics, "_", "/", "-" and "." and no "-" may occur after a "/"
2921 ** and every "." must be surrounded on both sides by alphanumerics or else
2922 ** a 404 error is returned. Static content files in the directory are
2923 ** returned if they match comma-separate GLOB pattern specified by --files
2924 ** and do not match "*.fossil*" and have a well-known suffix.
2925 **
2926 ** Options:
2927 ** --acme Deliver files from the ".well-known" subdirectory
2928 ** --baseurl URL Base URL (useful with reverse proxies)
@@ -2930,11 +2938,11 @@
2930 ** fullchain.pem) taken from FILE.
2931 ** --chroot DIR Use directory for chroot instead of repository path.
2932 ** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
2933 ** /doc/ckout/...
2934 ** --extroot DIR Document root for the /ext extension mechanism
2935 ** --files GLOB Comma-separate glob patterns for static file to serve
2936 ** --host NAME DNS Hostname of the server
2937 ** --https The HTTP request originated from https but has already
2938 ** been decoded by a reverse proxy. Hence, URLs created
2939 ** by Fossil should use "https:" rather than "http:".
2940 ** --in FILE Take input from FILE instead of standard input
@@ -3151,11 +3159,11 @@
3151 ** using this command interactively over SSH. A better solution would be
3152 ** to use a different command for "ssh" sync, but we cannot do that without
3153 ** breaking legacy.
3154 **
3155 ** Options:
3156 ** --csrf-safe N Set cgi_csrf_safe() to to return N
3157 ** --nobody Pretend to be user "nobody"
3158 ** --ssh-sim Pretend to be over an SSH connection
3159 ** --test Do not do special "sync" processing when operating
3160 ** over an SSH link
3161 ** --th-trace Trace TH1 execution (for debugging purposes)
3162
--- src/main.c
+++ src/main.c
@@ -63,11 +63,11 @@
63 #ifdef HAVE_BACKTRACE
64 # include <execinfo.h>
65 #endif
66
67 /*
68 ** Default length of a timeout for serving an HTTP request. Changeable
69 ** using the "--timeout N" command-line option or via "timeout: N" in the
70 ** CGI script.
71 */
72 #ifndef FOSSIL_DEFAULT_TIMEOUT
73 # define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
@@ -153,10 +153,11 @@
153 char *nameOfExe; /* Full path of executable. */
154 const char *zErrlog; /* Log errors to this file, if not NULL */
155 const char *zPhase; /* Phase of operation, for use by the error log
156 ** and for deriving $canonical_page TH1 variable */
157 int isConst; /* True if the output is unchanging & cacheable */
158 int iResultCode; /* Process reply code for commands */
159 const char *zVfsName; /* The VFS to use for database connections */
160 sqlite3 *db; /* The connection to the databases */
161 sqlite3 *dbConfig; /* Separate connection for global_config table */
162 char *zAuxSchema; /* Main repository aux-schema */
163 int dbIgnoreErrors; /* Ignore database errors if true */
@@ -188,11 +189,11 @@
189 int fSshClient; /* HTTP client flags for SSH client */
190 int fNoHttpCompress; /* Do not compress HTTP traffic (for debugging) */
191 char *zSshCmd; /* SSH command string */
192 const char *zHttpCmd; /* External program to do HTTP requests */
193 int fNoSync; /* Do not do an autosync ever. --nosync */
194 int eIPvers; /* 0: any 1: ipv4-only 2: ipv6-only */
195 char *zPath; /* Name of webpage being served (may be NULL) */
196 char *zExtra; /* Extra path information past the webpage name */
197 char *zBaseURL; /* Full text of the URL being served */
198 char *zHttpsURL; /* zBaseURL translated to https: */
199 char *zTop; /* Parent directory of zPath */
@@ -236,10 +237,17 @@
237 * applicable when using SEE on Windows or Linux. */
238 #endif
239 int useLocalauth; /* No login required if from 127.0.0.1 */
240 int noPswd; /* Logged in without password (on 127.0.0.1) */
241 int userUid; /* Integer user id */
242 int eAuthMethod; /* How the user authenticated to us */
243 # define AUTH_NONE 0 /* Not authenticated */
244 # define AUTH_COOKIE 1 /* Authentication by cookie */
245 # define AUTH_LOCAL 2 /* Uses loopback */
246 # define AUTH_PW 3 /* Authentication by password */
247 # define AUTH_ENV 4 /* Authenticated by REMOTE_USER environment var */
248 # define AUTH_HTTP 5 /* HTTP Basic Authentication */
249 int isRobot; /* True if the client is definitely a robot. False
250 ** negatives are common for this flag */
251 int colorOutput; /* Control output of color VT escapes to CLI */
252 const char *cliColor; /* VT color code for CLI highlight; default: "91" */
253 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -778,11 +786,11 @@
786 if( fossil_getenv("FOSSIL_BREAK") ){
787 if( fossil_isatty(0) && fossil_isatty(2) ){
788 fprintf(stderr,
789 "attach debugger to process %d and press any key to continue.\n",
790 GETPID());
791 (void)fgetc(stdin);
792 }else{
793 #if defined(_WIN32) || defined(WIN32)
794 DebugBreak();
795 #elif defined(SIGTRAP)
796 raise(SIGTRAP);
@@ -1058,11 +1066,11 @@
1066 if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1067 Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags);
1068 }
1069 }
1070 #endif
1071 fossil_exit(g.iResultCode);
1072 /*NOT_REACHED*/
1073 return 0;
1074 }
1075
1076 /*
@@ -1232,11 +1240,11 @@
1240 ** list and this function immediately returns. The effect is to treat
1241 ** all arguments after "--" as non-flags (conventionally used to
1242 ** enable passing-in of filenames which start with a dash).
1243 **
1244 ** This function must normally only be called one time per app
1245 ** invocation. The exception is commands which process their
1246 ** arguments, call this to confirm that there are no extraneous flags,
1247 ** then modify the arguments list for forwarding to another
1248 ** (sub)command (which itself will call this to confirm its own
1249 ** arguments).
1250 */
@@ -1444,11 +1452,11 @@
1452 style_finish_page();
1453 }
1454
1455
1456 /*
1457 ** Set the g.zBaseURL value to the full URL for the top level of
1458 ** the fossil tree. Set g.zTop to g.zBaseURL without the
1459 ** leading "http://" and the host and port.
1460 **
1461 ** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME
1462 ** environment variables. However, if zAltBase is not NULL then it
@@ -1737,11 +1745,11 @@
1745 ** iLevel. iLevel is 1 for /login pages and 2 for every other page.
1746 */
1747 int fossil_redirect_to_https_if_needed(int iLevel){
1748 if( fossil_wants_https(iLevel) ){
1749 const char *zQS = P("QUERY_STRING");
1750 char *zURL = 0;
1751 if( zQS==0 || zQS[0]==0 ){
1752 zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO"));
1753 }else if( zQS[0]!=0 ){
1754 zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS);
1755 }
@@ -2918,11 +2926,11 @@
2926 ** then the server redirects (HTTP code 302) to the URL of --notfound.
2927 ** When REPOSITORY is a directory, the pathname must contain only
2928 ** alphanumerics, "_", "/", "-" and "." and no "-" may occur after a "/"
2929 ** and every "." must be surrounded on both sides by alphanumerics or else
2930 ** a 404 error is returned. Static content files in the directory are
2931 ** returned if they match comma-separated GLOB pattern specified by --files
2932 ** and do not match "*.fossil*" and have a well-known suffix.
2933 **
2934 ** Options:
2935 ** --acme Deliver files from the ".well-known" subdirectory
2936 ** --baseurl URL Base URL (useful with reverse proxies)
@@ -2930,11 +2938,11 @@
2938 ** fullchain.pem) taken from FILE.
2939 ** --chroot DIR Use directory for chroot instead of repository path.
2940 ** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
2941 ** /doc/ckout/...
2942 ** --extroot DIR Document root for the /ext extension mechanism
2943 ** --files GLOB Comma-separated glob patterns for static files to serve
2944 ** --host NAME DNS Hostname of the server
2945 ** --https The HTTP request originated from https but has already
2946 ** been decoded by a reverse proxy. Hence, URLs created
2947 ** by Fossil should use "https:" rather than "http:".
2948 ** --in FILE Take input from FILE instead of standard input
@@ -3151,11 +3159,11 @@
3159 ** using this command interactively over SSH. A better solution would be
3160 ** to use a different command for "ssh" sync, but we cannot do that without
3161 ** breaking legacy.
3162 **
3163 ** Options:
3164 ** --csrf-safe N Set cgi_csrf_safe() to return N
3165 ** --nobody Pretend to be user "nobody"
3166 ** --ssh-sim Pretend to be over an SSH connection
3167 ** --test Do not do special "sync" processing when operating
3168 ** over an SSH link
3169 ** --th-trace Trace TH1 execution (for debugging purposes)
3170
+18 -10
--- src/main.c
+++ src/main.c
@@ -63,11 +63,11 @@
6363
#ifdef HAVE_BACKTRACE
6464
# include <execinfo.h>
6565
#endif
6666
6767
/*
68
-** Default length of a timeout for serving an HTTP request. Changable
68
+** Default length of a timeout for serving an HTTP request. Changeable
6969
** using the "--timeout N" command-line option or via "timeout: N" in the
7070
** CGI script.
7171
*/
7272
#ifndef FOSSIL_DEFAULT_TIMEOUT
7373
# define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
@@ -153,10 +153,11 @@
153153
char *nameOfExe; /* Full path of executable. */
154154
const char *zErrlog; /* Log errors to this file, if not NULL */
155155
const char *zPhase; /* Phase of operation, for use by the error log
156156
** and for deriving $canonical_page TH1 variable */
157157
int isConst; /* True if the output is unchanging & cacheable */
158
+ int iResultCode; /* Process reply code for commands */
158159
const char *zVfsName; /* The VFS to use for database connections */
159160
sqlite3 *db; /* The connection to the databases */
160161
sqlite3 *dbConfig; /* Separate connection for global_config table */
161162
char *zAuxSchema; /* Main repository aux-schema */
162163
int dbIgnoreErrors; /* Ignore database errors if true */
@@ -188,11 +189,11 @@
188189
int fSshClient; /* HTTP client flags for SSH client */
189190
int fNoHttpCompress; /* Do not compress HTTP traffic (for debugging) */
190191
char *zSshCmd; /* SSH command string */
191192
const char *zHttpCmd; /* External program to do HTTP requests */
192193
int fNoSync; /* Do not do an autosync ever. --nosync */
193
- int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
194
+ int eIPvers; /* 0: any 1: ipv4-only 2: ipv6-only */
194195
char *zPath; /* Name of webpage being served (may be NULL) */
195196
char *zExtra; /* Extra path information past the webpage name */
196197
char *zBaseURL; /* Full text of the URL being served */
197198
char *zHttpsURL; /* zBaseURL translated to https: */
198199
char *zTop; /* Parent directory of zPath */
@@ -236,10 +237,17 @@
236237
* applicable when using SEE on Windows or Linux. */
237238
#endif
238239
int useLocalauth; /* No login required if from 127.0.0.1 */
239240
int noPswd; /* Logged in without password (on 127.0.0.1) */
240241
int userUid; /* Integer user id */
242
+ int eAuthMethod; /* How the user authenticated to us */
243
+# define AUTH_NONE 0 /* Not authenticated */
244
+# define AUTH_COOKIE 1 /* Authentication by cookie */
245
+# define AUTH_LOCAL 2 /* Uses loopback */
246
+# define AUTH_PW 3 /* Authentication by password */
247
+# define AUTH_ENV 4 /* Authenticated by REMOTE_USER environment var */
248
+# define AUTH_HTTP 5 /* HTTP Basic Authentication */
241249
int isRobot; /* True if the client is definitely a robot. False
242250
** negatives are common for this flag */
243251
int colorOutput; /* Control output of color VT escapes to CLI */
244252
const char *cliColor; /* VT color code for CLI highlight; default: "91" */
245253
int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -778,11 +786,11 @@
778786
if( fossil_getenv("FOSSIL_BREAK") ){
779787
if( fossil_isatty(0) && fossil_isatty(2) ){
780788
fprintf(stderr,
781789
"attach debugger to process %d and press any key to continue.\n",
782790
GETPID());
783
- fgetc(stdin);
791
+ (void)fgetc(stdin);
784792
}else{
785793
#if defined(_WIN32) || defined(WIN32)
786794
DebugBreak();
787795
#elif defined(SIGTRAP)
788796
raise(SIGTRAP);
@@ -1058,11 +1066,11 @@
10581066
if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
10591067
Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags);
10601068
}
10611069
}
10621070
#endif
1063
- fossil_exit(0);
1071
+ fossil_exit(g.iResultCode);
10641072
/*NOT_REACHED*/
10651073
return 0;
10661074
}
10671075
10681076
/*
@@ -1232,11 +1240,11 @@
12321240
** list and this function immediately returns. The effect is to treat
12331241
** all arguments after "--" as non-flags (conventionally used to
12341242
** enable passing-in of filenames which start with a dash).
12351243
**
12361244
** This function must normally only be called one time per app
1237
-** invokation. The exception is commands which process their
1245
+** invocation. The exception is commands which process their
12381246
** arguments, call this to confirm that there are no extraneous flags,
12391247
** then modify the arguments list for forwarding to another
12401248
** (sub)command (which itself will call this to confirm its own
12411249
** arguments).
12421250
*/
@@ -1444,11 +1452,11 @@
14441452
style_finish_page();
14451453
}
14461454
14471455
14481456
/*
1449
-** Set the g.zBaseURL value to the full URL for the toplevel of
1457
+** Set the g.zBaseURL value to the full URL for the top level of
14501458
** the fossil tree. Set g.zTop to g.zBaseURL without the
14511459
** leading "http://" and the host and port.
14521460
**
14531461
** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME
14541462
** environment variables. However, if zAltBase is not NULL then it
@@ -1737,11 +1745,11 @@
17371745
** iLevel. iLevel is 1 for /login pages and 2 for every other page.
17381746
*/
17391747
int fossil_redirect_to_https_if_needed(int iLevel){
17401748
if( fossil_wants_https(iLevel) ){
17411749
const char *zQS = P("QUERY_STRING");
1742
- char *zURL;
1750
+ char *zURL = 0;
17431751
if( zQS==0 || zQS[0]==0 ){
17441752
zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO"));
17451753
}else if( zQS[0]!=0 ){
17461754
zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS);
17471755
}
@@ -2918,11 +2926,11 @@
29182926
** then the server redirects (HTTP code 302) to the URL of --notfound.
29192927
** When REPOSITORY is a directory, the pathname must contain only
29202928
** alphanumerics, "_", "/", "-" and "." and no "-" may occur after a "/"
29212929
** and every "." must be surrounded on both sides by alphanumerics or else
29222930
** a 404 error is returned. Static content files in the directory are
2923
-** returned if they match comma-separate GLOB pattern specified by --files
2931
+** returned if they match comma-separated GLOB pattern specified by --files
29242932
** and do not match "*.fossil*" and have a well-known suffix.
29252933
**
29262934
** Options:
29272935
** --acme Deliver files from the ".well-known" subdirectory
29282936
** --baseurl URL Base URL (useful with reverse proxies)
@@ -2930,11 +2938,11 @@
29302938
** fullchain.pem) taken from FILE.
29312939
** --chroot DIR Use directory for chroot instead of repository path.
29322940
** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
29332941
** /doc/ckout/...
29342942
** --extroot DIR Document root for the /ext extension mechanism
2935
-** --files GLOB Comma-separate glob patterns for static file to serve
2943
+** --files GLOB Comma-separated glob patterns for static files to serve
29362944
** --host NAME DNS Hostname of the server
29372945
** --https The HTTP request originated from https but has already
29382946
** been decoded by a reverse proxy. Hence, URLs created
29392947
** by Fossil should use "https:" rather than "http:".
29402948
** --in FILE Take input from FILE instead of standard input
@@ -3151,11 +3159,11 @@
31513159
** using this command interactively over SSH. A better solution would be
31523160
** to use a different command for "ssh" sync, but we cannot do that without
31533161
** breaking legacy.
31543162
**
31553163
** Options:
3156
-** --csrf-safe N Set cgi_csrf_safe() to to return N
3164
+** --csrf-safe N Set cgi_csrf_safe() to return N
31573165
** --nobody Pretend to be user "nobody"
31583166
** --ssh-sim Pretend to be over an SSH connection
31593167
** --test Do not do special "sync" processing when operating
31603168
** over an SSH link
31613169
** --th-trace Trace TH1 execution (for debugging purposes)
31623170
--- src/main.c
+++ src/main.c
@@ -63,11 +63,11 @@
63 #ifdef HAVE_BACKTRACE
64 # include <execinfo.h>
65 #endif
66
67 /*
68 ** Default length of a timeout for serving an HTTP request. Changable
69 ** using the "--timeout N" command-line option or via "timeout: N" in the
70 ** CGI script.
71 */
72 #ifndef FOSSIL_DEFAULT_TIMEOUT
73 # define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
@@ -153,10 +153,11 @@
153 char *nameOfExe; /* Full path of executable. */
154 const char *zErrlog; /* Log errors to this file, if not NULL */
155 const char *zPhase; /* Phase of operation, for use by the error log
156 ** and for deriving $canonical_page TH1 variable */
157 int isConst; /* True if the output is unchanging & cacheable */
 
158 const char *zVfsName; /* The VFS to use for database connections */
159 sqlite3 *db; /* The connection to the databases */
160 sqlite3 *dbConfig; /* Separate connection for global_config table */
161 char *zAuxSchema; /* Main repository aux-schema */
162 int dbIgnoreErrors; /* Ignore database errors if true */
@@ -188,11 +189,11 @@
188 int fSshClient; /* HTTP client flags for SSH client */
189 int fNoHttpCompress; /* Do not compress HTTP traffic (for debugging) */
190 char *zSshCmd; /* SSH command string */
191 const char *zHttpCmd; /* External program to do HTTP requests */
192 int fNoSync; /* Do not do an autosync ever. --nosync */
193 int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
194 char *zPath; /* Name of webpage being served (may be NULL) */
195 char *zExtra; /* Extra path information past the webpage name */
196 char *zBaseURL; /* Full text of the URL being served */
197 char *zHttpsURL; /* zBaseURL translated to https: */
198 char *zTop; /* Parent directory of zPath */
@@ -236,10 +237,17 @@
236 * applicable when using SEE on Windows or Linux. */
237 #endif
238 int useLocalauth; /* No login required if from 127.0.0.1 */
239 int noPswd; /* Logged in without password (on 127.0.0.1) */
240 int userUid; /* Integer user id */
 
 
 
 
 
 
 
241 int isRobot; /* True if the client is definitely a robot. False
242 ** negatives are common for this flag */
243 int colorOutput; /* Control output of color VT escapes to CLI */
244 const char *cliColor; /* VT color code for CLI highlight; default: "91" */
245 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -778,11 +786,11 @@
778 if( fossil_getenv("FOSSIL_BREAK") ){
779 if( fossil_isatty(0) && fossil_isatty(2) ){
780 fprintf(stderr,
781 "attach debugger to process %d and press any key to continue.\n",
782 GETPID());
783 fgetc(stdin);
784 }else{
785 #if defined(_WIN32) || defined(WIN32)
786 DebugBreak();
787 #elif defined(SIGTRAP)
788 raise(SIGTRAP);
@@ -1058,11 +1066,11 @@
1058 if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1059 Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags);
1060 }
1061 }
1062 #endif
1063 fossil_exit(0);
1064 /*NOT_REACHED*/
1065 return 0;
1066 }
1067
1068 /*
@@ -1232,11 +1240,11 @@
1232 ** list and this function immediately returns. The effect is to treat
1233 ** all arguments after "--" as non-flags (conventionally used to
1234 ** enable passing-in of filenames which start with a dash).
1235 **
1236 ** This function must normally only be called one time per app
1237 ** invokation. The exception is commands which process their
1238 ** arguments, call this to confirm that there are no extraneous flags,
1239 ** then modify the arguments list for forwarding to another
1240 ** (sub)command (which itself will call this to confirm its own
1241 ** arguments).
1242 */
@@ -1444,11 +1452,11 @@
1444 style_finish_page();
1445 }
1446
1447
1448 /*
1449 ** Set the g.zBaseURL value to the full URL for the toplevel of
1450 ** the fossil tree. Set g.zTop to g.zBaseURL without the
1451 ** leading "http://" and the host and port.
1452 **
1453 ** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME
1454 ** environment variables. However, if zAltBase is not NULL then it
@@ -1737,11 +1745,11 @@
1737 ** iLevel. iLevel is 1 for /login pages and 2 for every other page.
1738 */
1739 int fossil_redirect_to_https_if_needed(int iLevel){
1740 if( fossil_wants_https(iLevel) ){
1741 const char *zQS = P("QUERY_STRING");
1742 char *zURL;
1743 if( zQS==0 || zQS[0]==0 ){
1744 zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO"));
1745 }else if( zQS[0]!=0 ){
1746 zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS);
1747 }
@@ -2918,11 +2926,11 @@
2918 ** then the server redirects (HTTP code 302) to the URL of --notfound.
2919 ** When REPOSITORY is a directory, the pathname must contain only
2920 ** alphanumerics, "_", "/", "-" and "." and no "-" may occur after a "/"
2921 ** and every "." must be surrounded on both sides by alphanumerics or else
2922 ** a 404 error is returned. Static content files in the directory are
2923 ** returned if they match comma-separate GLOB pattern specified by --files
2924 ** and do not match "*.fossil*" and have a well-known suffix.
2925 **
2926 ** Options:
2927 ** --acme Deliver files from the ".well-known" subdirectory
2928 ** --baseurl URL Base URL (useful with reverse proxies)
@@ -2930,11 +2938,11 @@
2930 ** fullchain.pem) taken from FILE.
2931 ** --chroot DIR Use directory for chroot instead of repository path.
2932 ** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
2933 ** /doc/ckout/...
2934 ** --extroot DIR Document root for the /ext extension mechanism
2935 ** --files GLOB Comma-separate glob patterns for static file to serve
2936 ** --host NAME DNS Hostname of the server
2937 ** --https The HTTP request originated from https but has already
2938 ** been decoded by a reverse proxy. Hence, URLs created
2939 ** by Fossil should use "https:" rather than "http:".
2940 ** --in FILE Take input from FILE instead of standard input
@@ -3151,11 +3159,11 @@
3151 ** using this command interactively over SSH. A better solution would be
3152 ** to use a different command for "ssh" sync, but we cannot do that without
3153 ** breaking legacy.
3154 **
3155 ** Options:
3156 ** --csrf-safe N Set cgi_csrf_safe() to to return N
3157 ** --nobody Pretend to be user "nobody"
3158 ** --ssh-sim Pretend to be over an SSH connection
3159 ** --test Do not do special "sync" processing when operating
3160 ** over an SSH link
3161 ** --th-trace Trace TH1 execution (for debugging purposes)
3162
--- src/main.c
+++ src/main.c
@@ -63,11 +63,11 @@
63 #ifdef HAVE_BACKTRACE
64 # include <execinfo.h>
65 #endif
66
67 /*
68 ** Default length of a timeout for serving an HTTP request. Changeable
69 ** using the "--timeout N" command-line option or via "timeout: N" in the
70 ** CGI script.
71 */
72 #ifndef FOSSIL_DEFAULT_TIMEOUT
73 # define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
@@ -153,10 +153,11 @@
153 char *nameOfExe; /* Full path of executable. */
154 const char *zErrlog; /* Log errors to this file, if not NULL */
155 const char *zPhase; /* Phase of operation, for use by the error log
156 ** and for deriving $canonical_page TH1 variable */
157 int isConst; /* True if the output is unchanging & cacheable */
158 int iResultCode; /* Process reply code for commands */
159 const char *zVfsName; /* The VFS to use for database connections */
160 sqlite3 *db; /* The connection to the databases */
161 sqlite3 *dbConfig; /* Separate connection for global_config table */
162 char *zAuxSchema; /* Main repository aux-schema */
163 int dbIgnoreErrors; /* Ignore database errors if true */
@@ -188,11 +189,11 @@
189 int fSshClient; /* HTTP client flags for SSH client */
190 int fNoHttpCompress; /* Do not compress HTTP traffic (for debugging) */
191 char *zSshCmd; /* SSH command string */
192 const char *zHttpCmd; /* External program to do HTTP requests */
193 int fNoSync; /* Do not do an autosync ever. --nosync */
194 int eIPvers; /* 0: any 1: ipv4-only 2: ipv6-only */
195 char *zPath; /* Name of webpage being served (may be NULL) */
196 char *zExtra; /* Extra path information past the webpage name */
197 char *zBaseURL; /* Full text of the URL being served */
198 char *zHttpsURL; /* zBaseURL translated to https: */
199 char *zTop; /* Parent directory of zPath */
@@ -236,10 +237,17 @@
237 * applicable when using SEE on Windows or Linux. */
238 #endif
239 int useLocalauth; /* No login required if from 127.0.0.1 */
240 int noPswd; /* Logged in without password (on 127.0.0.1) */
241 int userUid; /* Integer user id */
242 int eAuthMethod; /* How the user authenticated to us */
243 # define AUTH_NONE 0 /* Not authenticated */
244 # define AUTH_COOKIE 1 /* Authentication by cookie */
245 # define AUTH_LOCAL 2 /* Uses loopback */
246 # define AUTH_PW 3 /* Authentication by password */
247 # define AUTH_ENV 4 /* Authenticated by REMOTE_USER environment var */
248 # define AUTH_HTTP 5 /* HTTP Basic Authentication */
249 int isRobot; /* True if the client is definitely a robot. False
250 ** negatives are common for this flag */
251 int colorOutput; /* Control output of color VT escapes to CLI */
252 const char *cliColor; /* VT color code for CLI highlight; default: "91" */
253 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -778,11 +786,11 @@
786 if( fossil_getenv("FOSSIL_BREAK") ){
787 if( fossil_isatty(0) && fossil_isatty(2) ){
788 fprintf(stderr,
789 "attach debugger to process %d and press any key to continue.\n",
790 GETPID());
791 (void)fgetc(stdin);
792 }else{
793 #if defined(_WIN32) || defined(WIN32)
794 DebugBreak();
795 #elif defined(SIGTRAP)
796 raise(SIGTRAP);
@@ -1058,11 +1066,11 @@
1066 if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1067 Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags);
1068 }
1069 }
1070 #endif
1071 fossil_exit(g.iResultCode);
1072 /*NOT_REACHED*/
1073 return 0;
1074 }
1075
1076 /*
@@ -1232,11 +1240,11 @@
1240 ** list and this function immediately returns. The effect is to treat
1241 ** all arguments after "--" as non-flags (conventionally used to
1242 ** enable passing-in of filenames which start with a dash).
1243 **
1244 ** This function must normally only be called one time per app
1245 ** invocation. The exception is commands which process their
1246 ** arguments, call this to confirm that there are no extraneous flags,
1247 ** then modify the arguments list for forwarding to another
1248 ** (sub)command (which itself will call this to confirm its own
1249 ** arguments).
1250 */
@@ -1444,11 +1452,11 @@
1452 style_finish_page();
1453 }
1454
1455
1456 /*
1457 ** Set the g.zBaseURL value to the full URL for the top level of
1458 ** the fossil tree. Set g.zTop to g.zBaseURL without the
1459 ** leading "http://" and the host and port.
1460 **
1461 ** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME
1462 ** environment variables. However, if zAltBase is not NULL then it
@@ -1737,11 +1745,11 @@
1745 ** iLevel. iLevel is 1 for /login pages and 2 for every other page.
1746 */
1747 int fossil_redirect_to_https_if_needed(int iLevel){
1748 if( fossil_wants_https(iLevel) ){
1749 const char *zQS = P("QUERY_STRING");
1750 char *zURL = 0;
1751 if( zQS==0 || zQS[0]==0 ){
1752 zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO"));
1753 }else if( zQS[0]!=0 ){
1754 zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS);
1755 }
@@ -2918,11 +2926,11 @@
2926 ** then the server redirects (HTTP code 302) to the URL of --notfound.
2927 ** When REPOSITORY is a directory, the pathname must contain only
2928 ** alphanumerics, "_", "/", "-" and "." and no "-" may occur after a "/"
2929 ** and every "." must be surrounded on both sides by alphanumerics or else
2930 ** a 404 error is returned. Static content files in the directory are
2931 ** returned if they match comma-separated GLOB pattern specified by --files
2932 ** and do not match "*.fossil*" and have a well-known suffix.
2933 **
2934 ** Options:
2935 ** --acme Deliver files from the ".well-known" subdirectory
2936 ** --baseurl URL Base URL (useful with reverse proxies)
@@ -2930,11 +2938,11 @@
2938 ** fullchain.pem) taken from FILE.
2939 ** --chroot DIR Use directory for chroot instead of repository path.
2940 ** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
2941 ** /doc/ckout/...
2942 ** --extroot DIR Document root for the /ext extension mechanism
2943 ** --files GLOB Comma-separated glob patterns for static files to serve
2944 ** --host NAME DNS Hostname of the server
2945 ** --https The HTTP request originated from https but has already
2946 ** been decoded by a reverse proxy. Hence, URLs created
2947 ** by Fossil should use "https:" rather than "http:".
2948 ** --in FILE Take input from FILE instead of standard input
@@ -3151,11 +3159,11 @@
3159 ** using this command interactively over SSH. A better solution would be
3160 ** to use a different command for "ssh" sync, but we cannot do that without
3161 ** breaking legacy.
3162 **
3163 ** Options:
3164 ** --csrf-safe N Set cgi_csrf_safe() to return N
3165 ** --nobody Pretend to be user "nobody"
3166 ** --ssh-sim Pretend to be over an SSH connection
3167 ** --test Do not do special "sync" processing when operating
3168 ** over an SSH link
3169 ** --th-trace Trace TH1 execution (for debugging purposes)
3170
--- src/main.mk
+++ src/main.mk
@@ -662,10 +662,11 @@
662662
-DSQLITE_ENABLE_DBSTAT_VTAB \
663663
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
664664
-DSQLITE_ENABLE_FTS4 \
665665
-DSQLITE_ENABLE_FTS5 \
666666
-DSQLITE_ENABLE_MATH_FUNCTIONS \
667
+ -DSQLITE_ENABLE_PERCENTILE \
667668
-DSQLITE_ENABLE_SETLK_TIMEOUT \
668669
-DSQLITE_ENABLE_STMTVTAB \
669670
-DSQLITE_HAVE_ZLIB \
670671
-DSQLITE_ENABLE_DBPAGE_VTAB \
671672
-DSQLITE_TRUSTED_SCHEMA=0 \
@@ -689,10 +690,11 @@
689690
-DSQLITE_ENABLE_DBSTAT_VTAB \
690691
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
691692
-DSQLITE_ENABLE_FTS4 \
692693
-DSQLITE_ENABLE_FTS5 \
693694
-DSQLITE_ENABLE_MATH_FUNCTIONS \
695
+ -DSQLITE_ENABLE_PERCENTILE \
694696
-DSQLITE_ENABLE_SETLK_TIMEOUT \
695697
-DSQLITE_ENABLE_STMTVTAB \
696698
-DSQLITE_HAVE_ZLIB \
697699
-DSQLITE_ENABLE_DBPAGE_VTAB \
698700
-DSQLITE_TRUSTED_SCHEMA=0 \
699701
--- src/main.mk
+++ src/main.mk
@@ -662,10 +662,11 @@
662 -DSQLITE_ENABLE_DBSTAT_VTAB \
663 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
664 -DSQLITE_ENABLE_FTS4 \
665 -DSQLITE_ENABLE_FTS5 \
666 -DSQLITE_ENABLE_MATH_FUNCTIONS \
 
667 -DSQLITE_ENABLE_SETLK_TIMEOUT \
668 -DSQLITE_ENABLE_STMTVTAB \
669 -DSQLITE_HAVE_ZLIB \
670 -DSQLITE_ENABLE_DBPAGE_VTAB \
671 -DSQLITE_TRUSTED_SCHEMA=0 \
@@ -689,10 +690,11 @@
689 -DSQLITE_ENABLE_DBSTAT_VTAB \
690 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
691 -DSQLITE_ENABLE_FTS4 \
692 -DSQLITE_ENABLE_FTS5 \
693 -DSQLITE_ENABLE_MATH_FUNCTIONS \
 
694 -DSQLITE_ENABLE_SETLK_TIMEOUT \
695 -DSQLITE_ENABLE_STMTVTAB \
696 -DSQLITE_HAVE_ZLIB \
697 -DSQLITE_ENABLE_DBPAGE_VTAB \
698 -DSQLITE_TRUSTED_SCHEMA=0 \
699
--- src/main.mk
+++ src/main.mk
@@ -662,10 +662,11 @@
662 -DSQLITE_ENABLE_DBSTAT_VTAB \
663 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
664 -DSQLITE_ENABLE_FTS4 \
665 -DSQLITE_ENABLE_FTS5 \
666 -DSQLITE_ENABLE_MATH_FUNCTIONS \
667 -DSQLITE_ENABLE_PERCENTILE \
668 -DSQLITE_ENABLE_SETLK_TIMEOUT \
669 -DSQLITE_ENABLE_STMTVTAB \
670 -DSQLITE_HAVE_ZLIB \
671 -DSQLITE_ENABLE_DBPAGE_VTAB \
672 -DSQLITE_TRUSTED_SCHEMA=0 \
@@ -689,10 +690,11 @@
690 -DSQLITE_ENABLE_DBSTAT_VTAB \
691 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
692 -DSQLITE_ENABLE_FTS4 \
693 -DSQLITE_ENABLE_FTS5 \
694 -DSQLITE_ENABLE_MATH_FUNCTIONS \
695 -DSQLITE_ENABLE_PERCENTILE \
696 -DSQLITE_ENABLE_SETLK_TIMEOUT \
697 -DSQLITE_ENABLE_STMTVTAB \
698 -DSQLITE_HAVE_ZLIB \
699 -DSQLITE_ENABLE_DBPAGE_VTAB \
700 -DSQLITE_TRUSTED_SCHEMA=0 \
701
+3 -4
--- src/manifest.c
+++ src/manifest.c
@@ -946,12 +946,11 @@
946946
** T (+|*|-)<tagname> <uuid> ?<value>?
947947
**
948948
** Create or cancel a tag or property. The tagname is fossil-encoded.
949949
** The first character of the name must be either "+" to create a
950950
** singleton tag, "*" to create a propagating tag, or "-" to create
951
- ** anti-tag that undoes a prior "+" or blocks propagation of of
952
- ** a "*".
951
+ ** anti-tag that undoes a prior "+" or blocks propagation of a "*".
953952
**
954953
** The tag is applied to <uuid>. If <uuid> is "*" then the tag is
955954
** applied to the current manifest. If <value> is provided then
956955
** the tag is really a property with the given value.
957956
**
@@ -2994,11 +2993,11 @@
29942993
KVP_STR(1, uuid, pF->zUuid);
29952994
KVP_STR(1, perm, pF->zPerm);
29962995
KVP_STR(1, rename, pF->zPrior);
29972996
blob_append_char(b, '}');
29982997
}
2999
- /* Special case: model checkins with no F-card as having an empty
2998
+ /* Special case: model check-ins with no F-card as having an empty
30002999
** array, rather than no F-cards, to hypothetically simplify
30013000
** handling in JSON queries. */
30023001
blob_append_char(b, ']');
30033002
}
30043003
CARD_STR2(G, p->zThreadRoot);
@@ -3038,11 +3037,11 @@
30383037
blob_append_char(b, '[');
30393038
for( i = 0; i < p->nParent; ++i ){
30403039
if( i>0 ) blob_append_char(b, ',');
30413040
blob_appendf(b, "%!j", p->azParent[i]);
30423041
}
3043
- /* Special case: model checkins with no P-card as having an empty
3042
+ /* Special case: model check-ins with no P-card as having an empty
30443043
** array, as per F-cards. */
30453044
blob_append_char(b, ']');
30463045
}
30473046
if( p->nCherrypick ){
30483047
CARD_LETTER(Q);
30493048
--- src/manifest.c
+++ src/manifest.c
@@ -946,12 +946,11 @@
946 ** T (+|*|-)<tagname> <uuid> ?<value>?
947 **
948 ** Create or cancel a tag or property. The tagname is fossil-encoded.
949 ** The first character of the name must be either "+" to create a
950 ** singleton tag, "*" to create a propagating tag, or "-" to create
951 ** anti-tag that undoes a prior "+" or blocks propagation of of
952 ** a "*".
953 **
954 ** The tag is applied to <uuid>. If <uuid> is "*" then the tag is
955 ** applied to the current manifest. If <value> is provided then
956 ** the tag is really a property with the given value.
957 **
@@ -2994,11 +2993,11 @@
2994 KVP_STR(1, uuid, pF->zUuid);
2995 KVP_STR(1, perm, pF->zPerm);
2996 KVP_STR(1, rename, pF->zPrior);
2997 blob_append_char(b, '}');
2998 }
2999 /* Special case: model checkins with no F-card as having an empty
3000 ** array, rather than no F-cards, to hypothetically simplify
3001 ** handling in JSON queries. */
3002 blob_append_char(b, ']');
3003 }
3004 CARD_STR2(G, p->zThreadRoot);
@@ -3038,11 +3037,11 @@
3038 blob_append_char(b, '[');
3039 for( i = 0; i < p->nParent; ++i ){
3040 if( i>0 ) blob_append_char(b, ',');
3041 blob_appendf(b, "%!j", p->azParent[i]);
3042 }
3043 /* Special case: model checkins with no P-card as having an empty
3044 ** array, as per F-cards. */
3045 blob_append_char(b, ']');
3046 }
3047 if( p->nCherrypick ){
3048 CARD_LETTER(Q);
3049
--- src/manifest.c
+++ src/manifest.c
@@ -946,12 +946,11 @@
946 ** T (+|*|-)<tagname> <uuid> ?<value>?
947 **
948 ** Create or cancel a tag or property. The tagname is fossil-encoded.
949 ** The first character of the name must be either "+" to create a
950 ** singleton tag, "*" to create a propagating tag, or "-" to create
951 ** anti-tag that undoes a prior "+" or blocks propagation of a "*".
 
952 **
953 ** The tag is applied to <uuid>. If <uuid> is "*" then the tag is
954 ** applied to the current manifest. If <value> is provided then
955 ** the tag is really a property with the given value.
956 **
@@ -2994,11 +2993,11 @@
2993 KVP_STR(1, uuid, pF->zUuid);
2994 KVP_STR(1, perm, pF->zPerm);
2995 KVP_STR(1, rename, pF->zPrior);
2996 blob_append_char(b, '}');
2997 }
2998 /* Special case: model check-ins with no F-card as having an empty
2999 ** array, rather than no F-cards, to hypothetically simplify
3000 ** handling in JSON queries. */
3001 blob_append_char(b, ']');
3002 }
3003 CARD_STR2(G, p->zThreadRoot);
@@ -3038,11 +3037,11 @@
3037 blob_append_char(b, '[');
3038 for( i = 0; i < p->nParent; ++i ){
3039 if( i>0 ) blob_append_char(b, ',');
3040 blob_appendf(b, "%!j", p->azParent[i]);
3041 }
3042 /* Special case: model check-ins with no P-card as having an empty
3043 ** array, as per F-cards. */
3044 blob_append_char(b, ']');
3045 }
3046 if( p->nCherrypick ){
3047 CARD_LETTER(Q);
3048
+4 -4
--- src/markdown.c
+++ src/markdown.c
@@ -530,12 +530,12 @@
530530
}
531531
}
532532
533533
/*
534534
** data[*pI] should be a "`" character that introduces a code-span.
535
-** The code-span boundry mark can be any number of one or more "`"
536
-** characters. We do not know the size of the boundry marker, only
535
+** The code-span boundary mark can be any number of one or more "`"
536
+** characters. We do not know the size of the boundary marker, only
537537
** that there is at least one "`" at data[*pI].
538538
**
539539
** This routine increases *pI to move it past the code-span, including
540540
** the closing boundary mark. Or, if the code-span is unterminated,
541541
** this routine moves *pI past the opening boundary mark only.
@@ -634,11 +634,11 @@
634634
** punct alnum (*x yes no
635635
** alnum space a* no yes
636636
** alnum punct a*( no yes
637637
** alnum alnum a*x yes yes
638638
**
639
-** The following routines determine whether a delimitor is left
639
+** The following routines determine whether a delimiter is left
640640
** or right flanking.
641641
*/
642642
static int left_flanking(char before, char after){
643643
if( fossil_isspace(after) ) return 0;
644644
if( fossil_isalnum(after) ) return 1;
@@ -2533,11 +2533,11 @@
25332533
25342534
/* failfast if data is too short */
25352535
if( beg+5>=end ) return 0;
25362536
i = beg;
25372537
2538
- /* footnote definition must start at the begining of a line */
2538
+ /* footnote definition must start at the beginning of a line */
25392539
if( data[i]!='[' ) return 0;
25402540
i++;
25412541
if( data[i]!='^' ) return 0;
25422542
id_offset = ++i;
25432543
25442544
--- src/markdown.c
+++ src/markdown.c
@@ -530,12 +530,12 @@
530 }
531 }
532
533 /*
534 ** data[*pI] should be a "`" character that introduces a code-span.
535 ** The code-span boundry mark can be any number of one or more "`"
536 ** characters. We do not know the size of the boundry marker, only
537 ** that there is at least one "`" at data[*pI].
538 **
539 ** This routine increases *pI to move it past the code-span, including
540 ** the closing boundary mark. Or, if the code-span is unterminated,
541 ** this routine moves *pI past the opening boundary mark only.
@@ -634,11 +634,11 @@
634 ** punct alnum (*x yes no
635 ** alnum space a* no yes
636 ** alnum punct a*( no yes
637 ** alnum alnum a*x yes yes
638 **
639 ** The following routines determine whether a delimitor is left
640 ** or right flanking.
641 */
642 static int left_flanking(char before, char after){
643 if( fossil_isspace(after) ) return 0;
644 if( fossil_isalnum(after) ) return 1;
@@ -2533,11 +2533,11 @@
2533
2534 /* failfast if data is too short */
2535 if( beg+5>=end ) return 0;
2536 i = beg;
2537
2538 /* footnote definition must start at the begining of a line */
2539 if( data[i]!='[' ) return 0;
2540 i++;
2541 if( data[i]!='^' ) return 0;
2542 id_offset = ++i;
2543
2544
--- src/markdown.c
+++ src/markdown.c
@@ -530,12 +530,12 @@
530 }
531 }
532
533 /*
534 ** data[*pI] should be a "`" character that introduces a code-span.
535 ** The code-span boundary mark can be any number of one or more "`"
536 ** characters. We do not know the size of the boundary marker, only
537 ** that there is at least one "`" at data[*pI].
538 **
539 ** This routine increases *pI to move it past the code-span, including
540 ** the closing boundary mark. Or, if the code-span is unterminated,
541 ** this routine moves *pI past the opening boundary mark only.
@@ -634,11 +634,11 @@
634 ** punct alnum (*x yes no
635 ** alnum space a* no yes
636 ** alnum punct a*( no yes
637 ** alnum alnum a*x yes yes
638 **
639 ** The following routines determine whether a delimiter is left
640 ** or right flanking.
641 */
642 static int left_flanking(char before, char after){
643 if( fossil_isspace(after) ) return 0;
644 if( fossil_isalnum(after) ) return 1;
@@ -2533,11 +2533,11 @@
2533
2534 /* failfast if data is too short */
2535 if( beg+5>=end ) return 0;
2536 i = beg;
2537
2538 /* footnote definition must start at the beginning of a line */
2539 if( data[i]!='[' ) return 0;
2540 i++;
2541 if( data[i]!='^' ) return 0;
2542 id_offset = ++i;
2543
2544
+1 -1
--- src/match.c
+++ src/match.c
@@ -265,11 +265,11 @@
265265
** checks for integer match against the tag ID which is looked up directly by
266266
** this function. For the other modes, the returned SQL expression performs
267267
** string comparisons against the tag names, so it is necessary to join against
268268
** the tag table to access the "tagname" column.
269269
**
270
-** Each pattern is adjusted to to start with "sym-" and be anchored at end.
270
+** Each pattern is adjusted to start with "sym-" and be anchored at end.
271271
**
272272
** In MS_REGEXP mode, backslash can be used to protect delimiter characters.
273273
** The backslashes are not removed from the regular expression.
274274
**
275275
** In addition to assembling and returning an SQL expression, this function
276276
--- src/match.c
+++ src/match.c
@@ -265,11 +265,11 @@
265 ** checks for integer match against the tag ID which is looked up directly by
266 ** this function. For the other modes, the returned SQL expression performs
267 ** string comparisons against the tag names, so it is necessary to join against
268 ** the tag table to access the "tagname" column.
269 **
270 ** Each pattern is adjusted to to start with "sym-" and be anchored at end.
271 **
272 ** In MS_REGEXP mode, backslash can be used to protect delimiter characters.
273 ** The backslashes are not removed from the regular expression.
274 **
275 ** In addition to assembling and returning an SQL expression, this function
276
--- src/match.c
+++ src/match.c
@@ -265,11 +265,11 @@
265 ** checks for integer match against the tag ID which is looked up directly by
266 ** this function. For the other modes, the returned SQL expression performs
267 ** string comparisons against the tag names, so it is necessary to join against
268 ** the tag table to access the "tagname" column.
269 **
270 ** Each pattern is adjusted to start with "sym-" and be anchored at end.
271 **
272 ** In MS_REGEXP mode, backslash can be used to protect delimiter characters.
273 ** The backslashes are not removed from the regular expression.
274 **
275 ** In addition to assembling and returning an SQL expression, this function
276
+3 -3
--- src/merge.c
+++ src/merge.c
@@ -794,11 +794,11 @@
794794
char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
795795
const char *zVersion; /* The VERSION argument */
796796
int bMultiMerge = 0; /* True if there are two or more VERSION arguments */
797797
int nMerge = 0; /* Number of prior merges processed */
798798
int useUndo = 1; /* True to record changes in the undo log */
799
- Stmt q; /* SQL statment used for merge processing */
799
+ Stmt q; /* SQL statement used for merge processing */
800800
801801
802802
/* Notation:
803803
**
804804
** V The current check-out
@@ -1044,11 +1044,11 @@
10441044
}
10451045
if( showVfileFlag ) debug_show_vfile();
10461046
10471047
/*
10481048
** The vfile.pathname field is used to match files against each other. The
1049
- ** FV table contains one row for each each unique filename in
1049
+ ** FV table contains one row for each unique filename in
10501050
** in the current check-out, the pivot, and the version being merged.
10511051
*/
10521052
db_multi_exec(
10531053
"DROP TABLE IF EXISTS fv;"
10541054
"CREATE TEMP TABLE fv(\n"
@@ -1564,11 +1564,11 @@
15641564
zFullName = mprintf("%s%s", g.zLocalRoot, zName);
15651565
if( file_isfile_or_link(zFullName)
15661566
&& !db_exists("SELECT 1 FROM fv WHERE fn=%Q", zName) ){
15671567
/* Name of backup file with Original content */
15681568
char *zOrig = file_newname(zFullName, "original", 1);
1569
- /* Backup previously unanaged file before to be overwritten */
1569
+ /* Backup previously unmanaged file before being overwritten */
15701570
file_copy(zFullName, zOrig);
15711571
fossil_free(zOrig);
15721572
fossil_print("ADDED %s (overwrites an unmanaged file)", zName);
15731573
if( !dryRunFlag ) fossil_print(", original copy backed up locally");
15741574
fossil_print("\n");
15751575
--- src/merge.c
+++ src/merge.c
@@ -794,11 +794,11 @@
794 char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
795 const char *zVersion; /* The VERSION argument */
796 int bMultiMerge = 0; /* True if there are two or more VERSION arguments */
797 int nMerge = 0; /* Number of prior merges processed */
798 int useUndo = 1; /* True to record changes in the undo log */
799 Stmt q; /* SQL statment used for merge processing */
800
801
802 /* Notation:
803 **
804 ** V The current check-out
@@ -1044,11 +1044,11 @@
1044 }
1045 if( showVfileFlag ) debug_show_vfile();
1046
1047 /*
1048 ** The vfile.pathname field is used to match files against each other. The
1049 ** FV table contains one row for each each unique filename in
1050 ** in the current check-out, the pivot, and the version being merged.
1051 */
1052 db_multi_exec(
1053 "DROP TABLE IF EXISTS fv;"
1054 "CREATE TEMP TABLE fv(\n"
@@ -1564,11 +1564,11 @@
1564 zFullName = mprintf("%s%s", g.zLocalRoot, zName);
1565 if( file_isfile_or_link(zFullName)
1566 && !db_exists("SELECT 1 FROM fv WHERE fn=%Q", zName) ){
1567 /* Name of backup file with Original content */
1568 char *zOrig = file_newname(zFullName, "original", 1);
1569 /* Backup previously unanaged file before to be overwritten */
1570 file_copy(zFullName, zOrig);
1571 fossil_free(zOrig);
1572 fossil_print("ADDED %s (overwrites an unmanaged file)", zName);
1573 if( !dryRunFlag ) fossil_print(", original copy backed up locally");
1574 fossil_print("\n");
1575
--- src/merge.c
+++ src/merge.c
@@ -794,11 +794,11 @@
794 char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
795 const char *zVersion; /* The VERSION argument */
796 int bMultiMerge = 0; /* True if there are two or more VERSION arguments */
797 int nMerge = 0; /* Number of prior merges processed */
798 int useUndo = 1; /* True to record changes in the undo log */
799 Stmt q; /* SQL statement used for merge processing */
800
801
802 /* Notation:
803 **
804 ** V The current check-out
@@ -1044,11 +1044,11 @@
1044 }
1045 if( showVfileFlag ) debug_show_vfile();
1046
1047 /*
1048 ** The vfile.pathname field is used to match files against each other. The
1049 ** FV table contains one row for each unique filename in
1050 ** in the current check-out, the pivot, and the version being merged.
1051 */
1052 db_multi_exec(
1053 "DROP TABLE IF EXISTS fv;"
1054 "CREATE TEMP TABLE fv(\n"
@@ -1564,11 +1564,11 @@
1564 zFullName = mprintf("%s%s", g.zLocalRoot, zName);
1565 if( file_isfile_or_link(zFullName)
1566 && !db_exists("SELECT 1 FROM fv WHERE fn=%Q", zName) ){
1567 /* Name of backup file with Original content */
1568 char *zOrig = file_newname(zFullName, "original", 1);
1569 /* Backup previously unmanaged file before being overwritten */
1570 file_copy(zFullName, zOrig);
1571 fossil_free(zOrig);
1572 fossil_print("ADDED %s (overwrites an unmanaged file)", zName);
1573 if( !dryRunFlag ) fossil_print(", original copy backed up locally");
1574 fossil_print("\n");
1575
+2 -2
--- src/merge3.c
+++ src/merge3.c
@@ -175,11 +175,11 @@
175175
/* These are generic methods for MergeBuilder. They just output debugging
176176
** information. But some of them are useful as base methods for other useful
177177
** implementations of MergeBuilder.
178178
*/
179179
180
-/* xStart() and xEnd() are called to generate header and fotter information
180
+/* xStart() and xEnd() are called to generate header and footer information
181181
** in the output. This is a no-op in the generic implementation.
182182
*/
183183
static void dbgStartEnd(MergeBuilder *p){ (void)p; }
184184
185185
/* The next N lines of PIVOT are unchanged in both V1 and V2
@@ -716,11 +716,11 @@
716716
*/
717717
static int skip_conflict(
718718
int *aC, /* Array of integer triples describing the edit */
719719
int i, /* Index in aC[] of current location */
720720
int sz, /* Lines of A that have been skipped */
721
- unsigned int *pLn /* OUT: Lines of B to skip to keep aligment with A */
721
+ unsigned int *pLn /* OUT: Lines of B to skip to keep alignment with A */
722722
){
723723
*pLn = 0;
724724
while( sz>0 ){
725725
if( aC[i]==0 && aC[i+1]==0 && aC[i+2]==0 ) break;
726726
if( aC[i]>=sz ){
727727
--- src/merge3.c
+++ src/merge3.c
@@ -175,11 +175,11 @@
175 /* These are generic methods for MergeBuilder. They just output debugging
176 ** information. But some of them are useful as base methods for other useful
177 ** implementations of MergeBuilder.
178 */
179
180 /* xStart() and xEnd() are called to generate header and fotter information
181 ** in the output. This is a no-op in the generic implementation.
182 */
183 static void dbgStartEnd(MergeBuilder *p){ (void)p; }
184
185 /* The next N lines of PIVOT are unchanged in both V1 and V2
@@ -716,11 +716,11 @@
716 */
717 static int skip_conflict(
718 int *aC, /* Array of integer triples describing the edit */
719 int i, /* Index in aC[] of current location */
720 int sz, /* Lines of A that have been skipped */
721 unsigned int *pLn /* OUT: Lines of B to skip to keep aligment with A */
722 ){
723 *pLn = 0;
724 while( sz>0 ){
725 if( aC[i]==0 && aC[i+1]==0 && aC[i+2]==0 ) break;
726 if( aC[i]>=sz ){
727
--- src/merge3.c
+++ src/merge3.c
@@ -175,11 +175,11 @@
175 /* These are generic methods for MergeBuilder. They just output debugging
176 ** information. But some of them are useful as base methods for other useful
177 ** implementations of MergeBuilder.
178 */
179
180 /* xStart() and xEnd() are called to generate header and footer information
181 ** in the output. This is a no-op in the generic implementation.
182 */
183 static void dbgStartEnd(MergeBuilder *p){ (void)p; }
184
185 /* The next N lines of PIVOT are unchanged in both V1 and V2
@@ -716,11 +716,11 @@
716 */
717 static int skip_conflict(
718 int *aC, /* Array of integer triples describing the edit */
719 int i, /* Index in aC[] of current location */
720 int sz, /* Lines of A that have been skipped */
721 unsigned int *pLn /* OUT: Lines of B to skip to keep alignment with A */
722 ){
723 *pLn = 0;
724 while( sz>0 ){
725 if( aC[i]==0 && aC[i+1]==0 && aC[i+2]==0 ) break;
726 if( aC[i]>=sz ){
727
+1 -1
--- src/name.c
+++ src/name.c
@@ -2215,11 +2215,11 @@
22152215
** --delta Show all delta-phantoms. A delta-phantom is a
22162216
** artifact for which there is a delta but the delta
22172217
** source is a phantom.
22182218
** --list Just list the phantoms. Do not try to describe them.
22192219
*/
2220
-void test_phatoms_cmd(void){
2220
+void test_phantoms_cmd(void){
22212221
int bDelta;
22222222
int bList;
22232223
int bCount;
22242224
unsigned nPhantom = 0;
22252225
unsigned nDeltaPhantom = 0;
22262226
--- src/name.c
+++ src/name.c
@@ -2215,11 +2215,11 @@
2215 ** --delta Show all delta-phantoms. A delta-phantom is a
2216 ** artifact for which there is a delta but the delta
2217 ** source is a phantom.
2218 ** --list Just list the phantoms. Do not try to describe them.
2219 */
2220 void test_phatoms_cmd(void){
2221 int bDelta;
2222 int bList;
2223 int bCount;
2224 unsigned nPhantom = 0;
2225 unsigned nDeltaPhantom = 0;
2226
--- src/name.c
+++ src/name.c
@@ -2215,11 +2215,11 @@
2215 ** --delta Show all delta-phantoms. A delta-phantom is a
2216 ** artifact for which there is a delta but the delta
2217 ** source is a phantom.
2218 ** --list Just list the phantoms. Do not try to describe them.
2219 */
2220 void test_phantoms_cmd(void){
2221 int bDelta;
2222 int bList;
2223 int bCount;
2224 unsigned nPhantom = 0;
2225 unsigned nDeltaPhantom = 0;
2226
+1 -1
--- src/piechart.c
+++ src/piechart.c
@@ -26,11 +26,11 @@
2626
# define M_PI 3.1415926535897932385
2727
#endif
2828
2929
/*
3030
** Return an RGB color name given HSV values. The HSV values
31
-** must each be between between 0 and 255. The string
31
+** must each be between 0 and 255. The string
3232
** returned is held in a static buffer and is overwritten
3333
** on each call.
3434
*/
3535
const char *rgbName(unsigned char h, unsigned char s, unsigned char v){
3636
static char zColor[8];
3737
--- src/piechart.c
+++ src/piechart.c
@@ -26,11 +26,11 @@
26 # define M_PI 3.1415926535897932385
27 #endif
28
29 /*
30 ** Return an RGB color name given HSV values. The HSV values
31 ** must each be between between 0 and 255. The string
32 ** returned is held in a static buffer and is overwritten
33 ** on each call.
34 */
35 const char *rgbName(unsigned char h, unsigned char s, unsigned char v){
36 static char zColor[8];
37
--- src/piechart.c
+++ src/piechart.c
@@ -26,11 +26,11 @@
26 # define M_PI 3.1415926535897932385
27 #endif
28
29 /*
30 ** Return an RGB color name given HSV values. The HSV values
31 ** must each be between 0 and 255. The string
32 ** returned is held in a static buffer and is overwritten
33 ** on each call.
34 */
35 const char *rgbName(unsigned char h, unsigned char s, unsigned char v){
36 static char zColor[8];
37
+7 -7
--- src/printf.c
+++ src/printf.c
@@ -13,11 +13,11 @@
1313
** [email protected]
1414
** http://www.hwaci.com/drh/
1515
**
1616
*******************************************************************************
1717
**
18
-** This file contains implementions of routines for formatting output
18
+** This file contains implementations of routines for formatting output
1919
** (ex: mprintf()) and for output to the console.
2020
*/
2121
#include "config.h"
2222
#include "printf.h"
2323
#if defined(_WIN32)
@@ -89,11 +89,11 @@
8989
#define etBLOB 11 /* Blob objects. %b */
9090
#define etBLOBSQL 12 /* Blob objects quoted for SQL. %B */
9191
#define etSQLESCAPE 13 /* Strings with '\'' doubled. %q */
9292
#define etSQLESCAPE2 14 /* Strings with '\'' doubled and enclosed in '',
9393
NULL pointers replaced by SQL NULL. %Q */
94
-#define etSQLESCAPE3 15 /* Double '"' characters within an indentifier. %w */
94
+#define etSQLESCAPE3 15 /* Double '"' characters within an identifier. %w */
9595
#define etPOINTER 16 /* The %p conversion */
9696
#define etHTMLIZE 17 /* Make text safe for HTML */
9797
#define etHTTPIZE 18 /* Make text safe for HTTP. "/" encoded as %2f */
9898
#define etURLIZE 19 /* Make text safe for HTTP. "/" not encoded */
9999
#define etFOSSILIZE 20 /* The fossil header encoding format. */
@@ -265,12 +265,12 @@
265265
** configuration parameters.
266266
**
267267
** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
268268
** flags) and is false for plain "%W". The ! flag indicates that the
269269
** formatting is for display of a check-in comment on the timeline. Such
270
-** comments used to be renderedd differently, but ever since 2020, they
271
-** have been rendered identially, so the ! flag does not make any different
270
+** comments used to be rendered differently, but ever since 2020, they
271
+** have been rendered identically, so the ! flag does not make any different
272272
** in the output any more.
273273
*/
274274
int wiki_convert_flags(int altForm2){
275275
static int wikiFlags = 0;
276276
(void)altForm2;
@@ -456,11 +456,11 @@
456456
** flag_leftjustify TRUE if a '-' is present or if the
457457
** field width was negative.
458458
** flag_zeropad TRUE if the width began with 0.
459459
** flag_long TRUE if the letter 'l' (ell) prefixed
460460
** the conversion character.
461
- ** flag_longlong TRUE if the letter 'll' (ell ell) prefixed
461
+ ** flag_longlong TRUE if the letters 'll' (ell ell) prefixed
462462
** the conversion character.
463463
** flag_blanksign TRUE if a ' ' is present.
464464
** width The specified field width. This is
465465
** always non-negative. Zero is the default.
466466
** precision The specified precision. The default
@@ -1188,13 +1188,13 @@
11881188
**
11891189
** The main difference between fossil_fatal() and fossil_panic() is that
11901190
** fossil_panic() makes an entry in the error log whereas fossil_fatal()
11911191
** does not. On POSIX platforms, if there is not an error log, then both
11921192
** routines work similarly with respect to user-visible effects. Hence,
1193
-** the routines are interchangable for commands and only act differently
1193
+** the routines are interchangeable for commands and only act differently
11941194
** when processing web pages. On the Windows platform, fossil_panic()
1195
-** also displays a pop-up stating that an error has occured and allowing
1195
+** also displays a pop-up stating that an error has occurred and allowing
11961196
** just-in-time debugging to commence. On all platforms, fossil_panic()
11971197
** ends execution with a SIGABRT signal, bypassing atexit processing.
11981198
** This signal can also produce a core dump on POSIX platforms.
11991199
**
12001200
** Use fossil_fatal() for malformed inputs that should be reported back
12011201
--- src/printf.c
+++ src/printf.c
@@ -13,11 +13,11 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file contains implementions of routines for formatting output
19 ** (ex: mprintf()) and for output to the console.
20 */
21 #include "config.h"
22 #include "printf.h"
23 #if defined(_WIN32)
@@ -89,11 +89,11 @@
89 #define etBLOB 11 /* Blob objects. %b */
90 #define etBLOBSQL 12 /* Blob objects quoted for SQL. %B */
91 #define etSQLESCAPE 13 /* Strings with '\'' doubled. %q */
92 #define etSQLESCAPE2 14 /* Strings with '\'' doubled and enclosed in '',
93 NULL pointers replaced by SQL NULL. %Q */
94 #define etSQLESCAPE3 15 /* Double '"' characters within an indentifier. %w */
95 #define etPOINTER 16 /* The %p conversion */
96 #define etHTMLIZE 17 /* Make text safe for HTML */
97 #define etHTTPIZE 18 /* Make text safe for HTTP. "/" encoded as %2f */
98 #define etURLIZE 19 /* Make text safe for HTTP. "/" not encoded */
99 #define etFOSSILIZE 20 /* The fossil header encoding format. */
@@ -265,12 +265,12 @@
265 ** configuration parameters.
266 **
267 ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
268 ** flags) and is false for plain "%W". The ! flag indicates that the
269 ** formatting is for display of a check-in comment on the timeline. Such
270 ** comments used to be renderedd differently, but ever since 2020, they
271 ** have been rendered identially, so the ! flag does not make any different
272 ** in the output any more.
273 */
274 int wiki_convert_flags(int altForm2){
275 static int wikiFlags = 0;
276 (void)altForm2;
@@ -456,11 +456,11 @@
456 ** flag_leftjustify TRUE if a '-' is present or if the
457 ** field width was negative.
458 ** flag_zeropad TRUE if the width began with 0.
459 ** flag_long TRUE if the letter 'l' (ell) prefixed
460 ** the conversion character.
461 ** flag_longlong TRUE if the letter 'll' (ell ell) prefixed
462 ** the conversion character.
463 ** flag_blanksign TRUE if a ' ' is present.
464 ** width The specified field width. This is
465 ** always non-negative. Zero is the default.
466 ** precision The specified precision. The default
@@ -1188,13 +1188,13 @@
1188 **
1189 ** The main difference between fossil_fatal() and fossil_panic() is that
1190 ** fossil_panic() makes an entry in the error log whereas fossil_fatal()
1191 ** does not. On POSIX platforms, if there is not an error log, then both
1192 ** routines work similarly with respect to user-visible effects. Hence,
1193 ** the routines are interchangable for commands and only act differently
1194 ** when processing web pages. On the Windows platform, fossil_panic()
1195 ** also displays a pop-up stating that an error has occured and allowing
1196 ** just-in-time debugging to commence. On all platforms, fossil_panic()
1197 ** ends execution with a SIGABRT signal, bypassing atexit processing.
1198 ** This signal can also produce a core dump on POSIX platforms.
1199 **
1200 ** Use fossil_fatal() for malformed inputs that should be reported back
1201
--- src/printf.c
+++ src/printf.c
@@ -13,11 +13,11 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file contains implementations of routines for formatting output
19 ** (ex: mprintf()) and for output to the console.
20 */
21 #include "config.h"
22 #include "printf.h"
23 #if defined(_WIN32)
@@ -89,11 +89,11 @@
89 #define etBLOB 11 /* Blob objects. %b */
90 #define etBLOBSQL 12 /* Blob objects quoted for SQL. %B */
91 #define etSQLESCAPE 13 /* Strings with '\'' doubled. %q */
92 #define etSQLESCAPE2 14 /* Strings with '\'' doubled and enclosed in '',
93 NULL pointers replaced by SQL NULL. %Q */
94 #define etSQLESCAPE3 15 /* Double '"' characters within an identifier. %w */
95 #define etPOINTER 16 /* The %p conversion */
96 #define etHTMLIZE 17 /* Make text safe for HTML */
97 #define etHTTPIZE 18 /* Make text safe for HTTP. "/" encoded as %2f */
98 #define etURLIZE 19 /* Make text safe for HTTP. "/" not encoded */
99 #define etFOSSILIZE 20 /* The fossil header encoding format. */
@@ -265,12 +265,12 @@
265 ** configuration parameters.
266 **
267 ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
268 ** flags) and is false for plain "%W". The ! flag indicates that the
269 ** formatting is for display of a check-in comment on the timeline. Such
270 ** comments used to be rendered differently, but ever since 2020, they
271 ** have been rendered identically, so the ! flag does not make any different
272 ** in the output any more.
273 */
274 int wiki_convert_flags(int altForm2){
275 static int wikiFlags = 0;
276 (void)altForm2;
@@ -456,11 +456,11 @@
456 ** flag_leftjustify TRUE if a '-' is present or if the
457 ** field width was negative.
458 ** flag_zeropad TRUE if the width began with 0.
459 ** flag_long TRUE if the letter 'l' (ell) prefixed
460 ** the conversion character.
461 ** flag_longlong TRUE if the letters 'll' (ell ell) prefixed
462 ** the conversion character.
463 ** flag_blanksign TRUE if a ' ' is present.
464 ** width The specified field width. This is
465 ** always non-negative. Zero is the default.
466 ** precision The specified precision. The default
@@ -1188,13 +1188,13 @@
1188 **
1189 ** The main difference between fossil_fatal() and fossil_panic() is that
1190 ** fossil_panic() makes an entry in the error log whereas fossil_fatal()
1191 ** does not. On POSIX platforms, if there is not an error log, then both
1192 ** routines work similarly with respect to user-visible effects. Hence,
1193 ** the routines are interchangeable for commands and only act differently
1194 ** when processing web pages. On the Windows platform, fossil_panic()
1195 ** also displays a pop-up stating that an error has occurred and allowing
1196 ** just-in-time debugging to commence. On all platforms, fossil_panic()
1197 ** ends execution with a SIGABRT signal, bypassing atexit processing.
1198 ** This signal can also produce a core dump on POSIX platforms.
1199 **
1200 ** Use fossil_fatal() for malformed inputs that should be reported back
1201
+3 -3
--- src/purge.c
+++ src/purge.c
@@ -62,11 +62,11 @@
6262
#define PURGE_EXPLAIN_ONLY 0x0002 /* Show what would have happened */
6363
#define PURGE_PRINT_SUMMARY 0x0004 /* Print a summary report at end */
6464
#endif
6565
6666
/*
67
-** This routine purges multiple artifacts from the repository, transfering
67
+** This routine purges multiple artifacts from the repository, transferring
6868
** those artifacts into the PURGEITEM table.
6969
**
7070
** Prior to invoking this routine, the caller must create a (TEMP) table
7171
** named zTab that contains the RID of every artifact to be purged.
7272
**
@@ -120,11 +120,11 @@
120120
return 0;
121121
}
122122
123123
/* Make sure we are not removing a manifest that is the baseline of some
124124
** manifest that is being left behind. This step is not strictly necessary.
125
- ** is is just a safety check. */
125
+ ** It is just a safety check. */
126126
if( purge_baseline_out_from_under_delta(zTab) ){
127127
fossil_panic("attempt to purge a baseline manifest without also purging "
128128
"all of its deltas");
129129
}
130130
@@ -256,11 +256,11 @@
256256
** When bExclusive is false, then all artifacts used by the check-ins
257257
** are added even if those artifacts are also used by other check-ins
258258
** not in the set.
259259
**
260260
** The "fossil publish" command with the (undocumented) --test and
261
-** --exclusive options can be used for interactiving testing of this
261
+** --exclusive options can be used for interactive testing of this
262262
** function.
263263
*/
264264
void find_checkin_associates(const char *zTab, int bExclusive){
265265
db_begin_transaction();
266266
267267
--- src/purge.c
+++ src/purge.c
@@ -62,11 +62,11 @@
62 #define PURGE_EXPLAIN_ONLY 0x0002 /* Show what would have happened */
63 #define PURGE_PRINT_SUMMARY 0x0004 /* Print a summary report at end */
64 #endif
65
66 /*
67 ** This routine purges multiple artifacts from the repository, transfering
68 ** those artifacts into the PURGEITEM table.
69 **
70 ** Prior to invoking this routine, the caller must create a (TEMP) table
71 ** named zTab that contains the RID of every artifact to be purged.
72 **
@@ -120,11 +120,11 @@
120 return 0;
121 }
122
123 /* Make sure we are not removing a manifest that is the baseline of some
124 ** manifest that is being left behind. This step is not strictly necessary.
125 ** is is just a safety check. */
126 if( purge_baseline_out_from_under_delta(zTab) ){
127 fossil_panic("attempt to purge a baseline manifest without also purging "
128 "all of its deltas");
129 }
130
@@ -256,11 +256,11 @@
256 ** When bExclusive is false, then all artifacts used by the check-ins
257 ** are added even if those artifacts are also used by other check-ins
258 ** not in the set.
259 **
260 ** The "fossil publish" command with the (undocumented) --test and
261 ** --exclusive options can be used for interactiving testing of this
262 ** function.
263 */
264 void find_checkin_associates(const char *zTab, int bExclusive){
265 db_begin_transaction();
266
267
--- src/purge.c
+++ src/purge.c
@@ -62,11 +62,11 @@
62 #define PURGE_EXPLAIN_ONLY 0x0002 /* Show what would have happened */
63 #define PURGE_PRINT_SUMMARY 0x0004 /* Print a summary report at end */
64 #endif
65
66 /*
67 ** This routine purges multiple artifacts from the repository, transferring
68 ** those artifacts into the PURGEITEM table.
69 **
70 ** Prior to invoking this routine, the caller must create a (TEMP) table
71 ** named zTab that contains the RID of every artifact to be purged.
72 **
@@ -120,11 +120,11 @@
120 return 0;
121 }
122
123 /* Make sure we are not removing a manifest that is the baseline of some
124 ** manifest that is being left behind. This step is not strictly necessary.
125 ** It is just a safety check. */
126 if( purge_baseline_out_from_under_delta(zTab) ){
127 fossil_panic("attempt to purge a baseline manifest without also purging "
128 "all of its deltas");
129 }
130
@@ -256,11 +256,11 @@
256 ** When bExclusive is false, then all artifacts used by the check-ins
257 ** are added even if those artifacts are also used by other check-ins
258 ** not in the set.
259 **
260 ** The "fossil publish" command with the (undocumented) --test and
261 ** --exclusive options can be used for interactive testing of this
262 ** function.
263 */
264 void find_checkin_associates(const char *zTab, int bExclusive){
265 db_begin_transaction();
266
267
+1 -1
--- src/report.c
+++ src/report.c
@@ -447,11 +447,11 @@
447447
int rn;
448448
const char *zTitle; /* Title of the report */
449449
const char *z;
450450
const char *zOwner; /* Owner of the report */
451451
const char *zClrKey; /* Color key - used to add colors to lines */
452
- char *zSQL; /* The SQL text that gnerates the report */
452
+ char *zSQL; /* The SQL text that generates the report */
453453
char *zErr = 0; /* An error message */
454454
const char *zDesc; /* Extra descriptive text about the report */
455455
const char *zMimetype; /* Mimetype for zDesc */
456456
const char *zTag; /* Symbolic name for this report */
457457
int dflt = P("dflt") ? 1 : 0;
458458
--- src/report.c
+++ src/report.c
@@ -447,11 +447,11 @@
447 int rn;
448 const char *zTitle; /* Title of the report */
449 const char *z;
450 const char *zOwner; /* Owner of the report */
451 const char *zClrKey; /* Color key - used to add colors to lines */
452 char *zSQL; /* The SQL text that gnerates the report */
453 char *zErr = 0; /* An error message */
454 const char *zDesc; /* Extra descriptive text about the report */
455 const char *zMimetype; /* Mimetype for zDesc */
456 const char *zTag; /* Symbolic name for this report */
457 int dflt = P("dflt") ? 1 : 0;
458
--- src/report.c
+++ src/report.c
@@ -447,11 +447,11 @@
447 int rn;
448 const char *zTitle; /* Title of the report */
449 const char *z;
450 const char *zOwner; /* Owner of the report */
451 const char *zClrKey; /* Color key - used to add colors to lines */
452 char *zSQL; /* The SQL text that generates the report */
453 char *zErr = 0; /* An error message */
454 const char *zDesc; /* Extra descriptive text about the report */
455 const char *zMimetype; /* Mimetype for zDesc */
456 const char *zTag; /* Symbolic name for this report */
457 int dflt = P("dflt") ? 1 : 0;
458
+3 -3
--- src/schema.c
+++ src/schema.c
@@ -259,11 +259,11 @@
259259
@ -- pfnid = Parent File Name ID.
260260
@ -- isaux = pmid IS AUXiliary parent, not primary parent
261261
@ --
262262
@ -- pid==0 if the file is added by check-in mid.
263263
@ -- pid==(-1) if the file exists in a merge parents but not in the primary
264
-@ -- parent. In other words, if the file file was added by merge.
264
+@ -- parent. In other words, if the file was added by merge.
265265
@ -- fid==0 if the file is removed by check-in mid.
266266
@ --
267267
@ CREATE TABLE mlink(
268268
@ mid INTEGER, -- Check-in that contains fid
269269
@ fid INTEGER, -- New file content. 0 if deleted
@@ -365,11 +365,11 @@
365365
@ -- Each artifact can have one or more tags. A tag
366366
@ -- is defined by a row in the next table.
367367
@ --
368368
@ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of
369369
@ -- the wiki page. Tickets changes are tagged with "ticket-HASH" where
370
-@ -- HASH is the indentifier of the ticket. Tags used to assign symbolic
370
+@ -- HASH is the identifier of the ticket. Tags used to assign symbolic
371371
@ -- names to baselines are branches are of the form "sym-NAME" where
372372
@ -- NAME is the symbolic name.
373373
@ --
374374
@ CREATE TABLE tag(
375375
@ tagid INTEGER PRIMARY KEY, -- Numeric tag ID
@@ -500,11 +500,11 @@
500500
** Allowed values for MIMEtype codes
501501
*/
502502
#if INTERFACE
503503
# define MT_NONE 0 /* unspecified */
504504
# define MT_WIKI 1 /* Wiki */
505
-# define MT_MARKDOWN 2 /* Markdonw */
505
+# define MT_MARKDOWN 2 /* Markdown */
506506
# define MT_UNKNOWN 3 /* unknown */
507507
# define ValidMTC(X) ((X)>=0 && (X)<=3) /* True if MIMEtype code is valid */
508508
#endif
509509
510510
/*
511511
--- src/schema.c
+++ src/schema.c
@@ -259,11 +259,11 @@
259 @ -- pfnid = Parent File Name ID.
260 @ -- isaux = pmid IS AUXiliary parent, not primary parent
261 @ --
262 @ -- pid==0 if the file is added by check-in mid.
263 @ -- pid==(-1) if the file exists in a merge parents but not in the primary
264 @ -- parent. In other words, if the file file was added by merge.
265 @ -- fid==0 if the file is removed by check-in mid.
266 @ --
267 @ CREATE TABLE mlink(
268 @ mid INTEGER, -- Check-in that contains fid
269 @ fid INTEGER, -- New file content. 0 if deleted
@@ -365,11 +365,11 @@
365 @ -- Each artifact can have one or more tags. A tag
366 @ -- is defined by a row in the next table.
367 @ --
368 @ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of
369 @ -- the wiki page. Tickets changes are tagged with "ticket-HASH" where
370 @ -- HASH is the indentifier of the ticket. Tags used to assign symbolic
371 @ -- names to baselines are branches are of the form "sym-NAME" where
372 @ -- NAME is the symbolic name.
373 @ --
374 @ CREATE TABLE tag(
375 @ tagid INTEGER PRIMARY KEY, -- Numeric tag ID
@@ -500,11 +500,11 @@
500 ** Allowed values for MIMEtype codes
501 */
502 #if INTERFACE
503 # define MT_NONE 0 /* unspecified */
504 # define MT_WIKI 1 /* Wiki */
505 # define MT_MARKDOWN 2 /* Markdonw */
506 # define MT_UNKNOWN 3 /* unknown */
507 # define ValidMTC(X) ((X)>=0 && (X)<=3) /* True if MIMEtype code is valid */
508 #endif
509
510 /*
511
--- src/schema.c
+++ src/schema.c
@@ -259,11 +259,11 @@
259 @ -- pfnid = Parent File Name ID.
260 @ -- isaux = pmid IS AUXiliary parent, not primary parent
261 @ --
262 @ -- pid==0 if the file is added by check-in mid.
263 @ -- pid==(-1) if the file exists in a merge parents but not in the primary
264 @ -- parent. In other words, if the file was added by merge.
265 @ -- fid==0 if the file is removed by check-in mid.
266 @ --
267 @ CREATE TABLE mlink(
268 @ mid INTEGER, -- Check-in that contains fid
269 @ fid INTEGER, -- New file content. 0 if deleted
@@ -365,11 +365,11 @@
365 @ -- Each artifact can have one or more tags. A tag
366 @ -- is defined by a row in the next table.
367 @ --
368 @ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of
369 @ -- the wiki page. Tickets changes are tagged with "ticket-HASH" where
370 @ -- HASH is the identifier of the ticket. Tags used to assign symbolic
371 @ -- names to baselines are branches are of the form "sym-NAME" where
372 @ -- NAME is the symbolic name.
373 @ --
374 @ CREATE TABLE tag(
375 @ tagid INTEGER PRIMARY KEY, -- Numeric tag ID
@@ -500,11 +500,11 @@
500 ** Allowed values for MIMEtype codes
501 */
502 #if INTERFACE
503 # define MT_NONE 0 /* unspecified */
504 # define MT_WIKI 1 /* Wiki */
505 # define MT_MARKDOWN 2 /* Markdown */
506 # define MT_UNKNOWN 3 /* unknown */
507 # define ValidMTC(X) ((X)>=0 && (X)<=3) /* True if MIMEtype code is valid */
508 #endif
509
510 /*
511
+2 -2
--- src/search.c
+++ src/search.c
@@ -588,11 +588,11 @@
588588
** option is set to "never", nor the "NO_COLOR" environment variable
589589
** is set to "1".
590590
**
591591
** Options:
592592
** -a|--all Search everything
593
-** -c|--checkins Search checkin comments
593
+** -c|--checkins Search check-in comments
594594
** --docs Search embedded documentation
595595
** --forum Search forum posts
596596
** -h|--bi-help Search built-in help
597597
** -n|--limit N Limit output to N matches
598598
** --technotes Search tech notes
@@ -2863,11 +2863,11 @@
28632863
rc = fts5MatchinfoIter(pApi, pFts, p, fts5MatchinfoLocalCb);
28642864
}
28652865
if( rc!=SQLITE_OK ){
28662866
sqlite3_result_error_code(pCtx, rc);
28672867
}else{
2868
- /* No errors has occured, so return a copy of the array of integers. */
2868
+ /* No error has occurred, so return a copy of the array of integers. */
28692869
int nByte = p->nRet * sizeof(u32);
28702870
sqlite3_result_blob(pCtx, (void*)p->aRet, nByte, SQLITE_TRANSIENT);
28712871
}
28722872
}
28732873
28742874
--- src/search.c
+++ src/search.c
@@ -588,11 +588,11 @@
588 ** option is set to "never", nor the "NO_COLOR" environment variable
589 ** is set to "1".
590 **
591 ** Options:
592 ** -a|--all Search everything
593 ** -c|--checkins Search checkin comments
594 ** --docs Search embedded documentation
595 ** --forum Search forum posts
596 ** -h|--bi-help Search built-in help
597 ** -n|--limit N Limit output to N matches
598 ** --technotes Search tech notes
@@ -2863,11 +2863,11 @@
2863 rc = fts5MatchinfoIter(pApi, pFts, p, fts5MatchinfoLocalCb);
2864 }
2865 if( rc!=SQLITE_OK ){
2866 sqlite3_result_error_code(pCtx, rc);
2867 }else{
2868 /* No errors has occured, so return a copy of the array of integers. */
2869 int nByte = p->nRet * sizeof(u32);
2870 sqlite3_result_blob(pCtx, (void*)p->aRet, nByte, SQLITE_TRANSIENT);
2871 }
2872 }
2873
2874
--- src/search.c
+++ src/search.c
@@ -588,11 +588,11 @@
588 ** option is set to "never", nor the "NO_COLOR" environment variable
589 ** is set to "1".
590 **
591 ** Options:
592 ** -a|--all Search everything
593 ** -c|--checkins Search check-in comments
594 ** --docs Search embedded documentation
595 ** --forum Search forum posts
596 ** -h|--bi-help Search built-in help
597 ** -n|--limit N Limit output to N matches
598 ** --technotes Search tech notes
@@ -2863,11 +2863,11 @@
2863 rc = fts5MatchinfoIter(pApi, pFts, p, fts5MatchinfoLocalCb);
2864 }
2865 if( rc!=SQLITE_OK ){
2866 sqlite3_result_error_code(pCtx, rc);
2867 }else{
2868 /* No error has occurred, so return a copy of the array of integers. */
2869 int nByte = p->nRet * sizeof(u32);
2870 sqlite3_result_blob(pCtx, (void*)p->aRet, nByte, SQLITE_TRANSIENT);
2871 }
2872 }
2873
2874
+2 -2
--- src/search.c
+++ src/search.c
@@ -588,11 +588,11 @@
588588
** option is set to "never", nor the "NO_COLOR" environment variable
589589
** is set to "1".
590590
**
591591
** Options:
592592
** -a|--all Search everything
593
-** -c|--checkins Search checkin comments
593
+** -c|--checkins Search check-in comments
594594
** --docs Search embedded documentation
595595
** --forum Search forum posts
596596
** -h|--bi-help Search built-in help
597597
** -n|--limit N Limit output to N matches
598598
** --technotes Search tech notes
@@ -2863,11 +2863,11 @@
28632863
rc = fts5MatchinfoIter(pApi, pFts, p, fts5MatchinfoLocalCb);
28642864
}
28652865
if( rc!=SQLITE_OK ){
28662866
sqlite3_result_error_code(pCtx, rc);
28672867
}else{
2868
- /* No errors has occured, so return a copy of the array of integers. */
2868
+ /* No error has occurred, so return a copy of the array of integers. */
28692869
int nByte = p->nRet * sizeof(u32);
28702870
sqlite3_result_blob(pCtx, (void*)p->aRet, nByte, SQLITE_TRANSIENT);
28712871
}
28722872
}
28732873
28742874
--- src/search.c
+++ src/search.c
@@ -588,11 +588,11 @@
588 ** option is set to "never", nor the "NO_COLOR" environment variable
589 ** is set to "1".
590 **
591 ** Options:
592 ** -a|--all Search everything
593 ** -c|--checkins Search checkin comments
594 ** --docs Search embedded documentation
595 ** --forum Search forum posts
596 ** -h|--bi-help Search built-in help
597 ** -n|--limit N Limit output to N matches
598 ** --technotes Search tech notes
@@ -2863,11 +2863,11 @@
2863 rc = fts5MatchinfoIter(pApi, pFts, p, fts5MatchinfoLocalCb);
2864 }
2865 if( rc!=SQLITE_OK ){
2866 sqlite3_result_error_code(pCtx, rc);
2867 }else{
2868 /* No errors has occured, so return a copy of the array of integers. */
2869 int nByte = p->nRet * sizeof(u32);
2870 sqlite3_result_blob(pCtx, (void*)p->aRet, nByte, SQLITE_TRANSIENT);
2871 }
2872 }
2873
2874
--- src/search.c
+++ src/search.c
@@ -588,11 +588,11 @@
588 ** option is set to "never", nor the "NO_COLOR" environment variable
589 ** is set to "1".
590 **
591 ** Options:
592 ** -a|--all Search everything
593 ** -c|--checkins Search check-in comments
594 ** --docs Search embedded documentation
595 ** --forum Search forum posts
596 ** -h|--bi-help Search built-in help
597 ** -n|--limit N Limit output to N matches
598 ** --technotes Search tech notes
@@ -2863,11 +2863,11 @@
2863 rc = fts5MatchinfoIter(pApi, pFts, p, fts5MatchinfoLocalCb);
2864 }
2865 if( rc!=SQLITE_OK ){
2866 sqlite3_result_error_code(pCtx, rc);
2867 }else{
2868 /* No error has occurred, so return a copy of the array of integers. */
2869 int nByte = p->nRet * sizeof(u32);
2870 sqlite3_result_blob(pCtx, (void*)p->aRet, nByte, SQLITE_TRANSIENT);
2871 }
2872 }
2873
2874
--- src/security_audit.c
+++ src/security_audit.c
@@ -351,11 +351,11 @@
351351
*/
352352
if( db_exists("SELECT 1 FROM config WHERE name GLOB 'xfer-*-script'"
353353
" AND length(value)>0") ){
354354
@ <li><p><b>WARNING:</b>
355355
@ TH1 scripts might be configured to run on any sync, push, pull, or
356
- @ clone operation. See the the <a href="%R/xfersetup">/xfersetup</a>
356
+ @ clone operation. See the <a href="%R/xfersetup">/xfersetup</a>
357357
@ page for more information. These TH1 scripts are a potential
358358
@ security concern and so should be carefully audited by a human.
359359
}
360360
361361
/* The strict-manifest-syntax setting should be on. */
@@ -389,11 +389,11 @@
389389
@ <a href="setup_ulist">User Configuration</a> page in case we
390390
@ ever reuse the letter for another purpose.
391391
}
392392
393393
/* If anonymous users are allowed to create new Wiki, then
394
- ** wiki moderation should be activated to pervent spam.
394
+ ** wiki moderation should be activated to prevent spam.
395395
*/
396396
if( hasAnyCap(zAnonCap, "fk") ){
397397
if( db_get_boolean("modreq-wiki",0)==0 ){
398398
@ <li><p><b>WARNING:</b>
399399
@ Anonymous users can create or edit wiki without moderation.
@@ -837,21 +837,23 @@
837837
** y=0x008 Show POST requests from a different origin
838838
** y=0x010 Show SQLITE_AUTH and similar
839839
** y=0x020 Show SMTP error reports
840840
** y=0x040 Show TH1 vulnerability reports
841841
** y=0x080 Show SQL errors
842
-** y=0x800 Show other uncategorized messages
842
+** y=0x100 Show timeouts
843
+** y=0x200 Show WAL recoveries
844
+** y=0x8000 Show other uncategorized messages
843845
**
844846
** If y is omitted or is zero, a count of the various message types is
845847
** shown.
846848
*/
847849
void errorlog_page(void){
848850
i64 szFile;
849851
FILE *in;
850852
char *zLog;
851853
const char *zType = P("y");
852
- static const int eAllTypes = 0x8ff;
854
+ static const int eAllTypes = 0x83ff;
853855
long eType = 0;
854856
int bOutput = 0;
855857
int prevWasTime = 0;
856858
int nHack = 0;
857859
int nPanic = 0;
@@ -860,10 +862,12 @@
860862
int nXPost = 0;
861863
int nAuth = 0;
862864
int nSmtp = 0;
863865
int nVuln = 0;
864866
int nSqlErr = 0;
867
+ int nTimeout = 0;
868
+ int nRecover = 0;
865869
char z[10000];
866870
char zTime[10000];
867871
868872
login_check_credentials();
869873
if( !g.perm.Admin ){
@@ -945,11 +949,17 @@
945949
@ <li>TH1 vulnerabilities
946950
}
947951
if( eType & 0x80 ){
948952
@ <li>SQL errors
949953
}
950
- if( eType & 0x800 ){
954
+ if( eType & 0x100 ){
955
+ @ <li>Timeouts
956
+ }
957
+ if( eType & 0x200 ){
958
+ @ <li>WAL recoveries
959
+ }
960
+ if( eType & 0x8000 ){
951961
@ <li>Other uncategorized messages
952962
}
953963
@ </ul>
954964
}
955965
@ <hr>
@@ -960,19 +970,30 @@
960970
if( prevWasTime ){
961971
if( strncmp(z,"possible hack attempt - 418 ", 27)==0 ){
962972
bOutput = (eType & 0x01)!=0;
963973
nHack++;
964974
}else
965
- if( (strncmp(z,"panic: ", 7)==0 && strncmp(z+7,"Timeout",7)!=0)
966
- || strstr(z," assertion fault ")!=0
967
- ){
975
+ if( strncmp(z,"panic: ", 7)==0 ){
976
+ if( strncmp(z+7,"Timeout",7)==0 ){
977
+ bOutput = (eType & 0x100)!=0;
978
+ nTimeout++;
979
+ }else{
980
+ bOutput = (eType & 0x02)!=0;
981
+ nPanic++;
982
+ }
983
+ }else
984
+ if( strstr(z,"assertion fault")!=0 ){
968985
bOutput = (eType & 0x02)!=0;
969986
nPanic++;
970987
}else
971988
if( strncmp(z,"SMTP:", 5)==0 ){
972989
bOutput = (eType & 0x20)!=0;
973990
nSmtp++;
991
+ }else
992
+ if( sqlite3_strglob("warning: SQLITE_NOTICE(283):*",z)==0 ){
993
+ bOutput = (eType & 0x200)!=0;
994
+ nRecover++;
974995
}else
975996
if( sqlite3_strglob("warning: backoffice process * still *",z)==0 ){
976997
bOutput = (eType & 0x04)!=0;
977998
nHang++;
978999
}else
@@ -993,11 +1014,11 @@
9931014
if( strstr(z,"statement aborts at ") ){
9941015
bOutput = (eType & 0x80)!=0;
9951016
nSqlErr++;
9961017
}else
9971018
{
998
- bOutput = (eType & 0x800)!=0;
1019
+ bOutput = (eType & 0x8000)!=0;
9991020
nOther++;
10001021
}
10011022
if( bOutput ){
10021023
@ %h(zTime)\
10031024
}
@@ -1036,10 +1057,18 @@
10361057
}
10371058
if( nSqlErr>0 ){
10381059
@ <tr><td align="right">%d(nSqlErr)</td>
10391060
@ <td><a href="./errorlog?y=128">SQL Errors</a></td>
10401061
}
1062
+ if( nTimeout>0 ){
1063
+ @ <tr><td align="right">%d(nTimeout)</td>
1064
+ @ <td><a href="./errorlog?y=256">Timeouts</a></td>
1065
+ }
1066
+ if( nRecover>0 ){
1067
+ @ <tr><td align="right">%d(nRecover)</td>
1068
+ @ <td><a href="./errorlog?y=512">WAL recoveries</a></td>
1069
+ }
10411070
if( nHang>0 ){
10421071
@ <tr><td align="right">%d(nHang)</td>
10431072
@ <td><a href="./errorlog?y=4">Hung Backoffice</a></td>
10441073
}
10451074
if( nXPost>0 ){
@@ -1054,11 +1083,11 @@
10541083
@ <tr><td align="right">%d(nSmtp)</td>
10551084
@ <td><a href="./errorlog?y=32">SMTP faults</a></td>
10561085
}
10571086
if( nOther>0 ){
10581087
@ <tr><td align="right">%d(nOther)</td>
1059
- @ <td><a href="./errorlog?y=2048">Other</a></td>
1088
+ @ <td><a href="./errorlog?y=32768">Other</a></td>
10601089
}
10611090
@ <tr><td align="right">%d(nTotal)</td>
10621091
if( nTotal>0 ){
10631092
@ <td><a href="./errorlog?y=4095">All Messages</a></td>
10641093
}else{
10651094
--- src/security_audit.c
+++ src/security_audit.c
@@ -351,11 +351,11 @@
351 */
352 if( db_exists("SELECT 1 FROM config WHERE name GLOB 'xfer-*-script'"
353 " AND length(value)>0") ){
354 @ <li><p><b>WARNING:</b>
355 @ TH1 scripts might be configured to run on any sync, push, pull, or
356 @ clone operation. See the the <a href="%R/xfersetup">/xfersetup</a>
357 @ page for more information. These TH1 scripts are a potential
358 @ security concern and so should be carefully audited by a human.
359 }
360
361 /* The strict-manifest-syntax setting should be on. */
@@ -389,11 +389,11 @@
389 @ <a href="setup_ulist">User Configuration</a> page in case we
390 @ ever reuse the letter for another purpose.
391 }
392
393 /* If anonymous users are allowed to create new Wiki, then
394 ** wiki moderation should be activated to pervent spam.
395 */
396 if( hasAnyCap(zAnonCap, "fk") ){
397 if( db_get_boolean("modreq-wiki",0)==0 ){
398 @ <li><p><b>WARNING:</b>
399 @ Anonymous users can create or edit wiki without moderation.
@@ -837,21 +837,23 @@
837 ** y=0x008 Show POST requests from a different origin
838 ** y=0x010 Show SQLITE_AUTH and similar
839 ** y=0x020 Show SMTP error reports
840 ** y=0x040 Show TH1 vulnerability reports
841 ** y=0x080 Show SQL errors
842 ** y=0x800 Show other uncategorized messages
 
 
843 **
844 ** If y is omitted or is zero, a count of the various message types is
845 ** shown.
846 */
847 void errorlog_page(void){
848 i64 szFile;
849 FILE *in;
850 char *zLog;
851 const char *zType = P("y");
852 static const int eAllTypes = 0x8ff;
853 long eType = 0;
854 int bOutput = 0;
855 int prevWasTime = 0;
856 int nHack = 0;
857 int nPanic = 0;
@@ -860,10 +862,12 @@
860 int nXPost = 0;
861 int nAuth = 0;
862 int nSmtp = 0;
863 int nVuln = 0;
864 int nSqlErr = 0;
 
 
865 char z[10000];
866 char zTime[10000];
867
868 login_check_credentials();
869 if( !g.perm.Admin ){
@@ -945,11 +949,17 @@
945 @ <li>TH1 vulnerabilities
946 }
947 if( eType & 0x80 ){
948 @ <li>SQL errors
949 }
950 if( eType & 0x800 ){
 
 
 
 
 
 
951 @ <li>Other uncategorized messages
952 }
953 @ </ul>
954 }
955 @ <hr>
@@ -960,19 +970,30 @@
960 if( prevWasTime ){
961 if( strncmp(z,"possible hack attempt - 418 ", 27)==0 ){
962 bOutput = (eType & 0x01)!=0;
963 nHack++;
964 }else
965 if( (strncmp(z,"panic: ", 7)==0 && strncmp(z+7,"Timeout",7)!=0)
966 || strstr(z," assertion fault ")!=0
967 ){
 
 
 
 
 
 
 
968 bOutput = (eType & 0x02)!=0;
969 nPanic++;
970 }else
971 if( strncmp(z,"SMTP:", 5)==0 ){
972 bOutput = (eType & 0x20)!=0;
973 nSmtp++;
 
 
 
 
974 }else
975 if( sqlite3_strglob("warning: backoffice process * still *",z)==0 ){
976 bOutput = (eType & 0x04)!=0;
977 nHang++;
978 }else
@@ -993,11 +1014,11 @@
993 if( strstr(z,"statement aborts at ") ){
994 bOutput = (eType & 0x80)!=0;
995 nSqlErr++;
996 }else
997 {
998 bOutput = (eType & 0x800)!=0;
999 nOther++;
1000 }
1001 if( bOutput ){
1002 @ %h(zTime)\
1003 }
@@ -1036,10 +1057,18 @@
1036 }
1037 if( nSqlErr>0 ){
1038 @ <tr><td align="right">%d(nSqlErr)</td>
1039 @ <td><a href="./errorlog?y=128">SQL Errors</a></td>
1040 }
 
 
 
 
 
 
 
 
1041 if( nHang>0 ){
1042 @ <tr><td align="right">%d(nHang)</td>
1043 @ <td><a href="./errorlog?y=4">Hung Backoffice</a></td>
1044 }
1045 if( nXPost>0 ){
@@ -1054,11 +1083,11 @@
1054 @ <tr><td align="right">%d(nSmtp)</td>
1055 @ <td><a href="./errorlog?y=32">SMTP faults</a></td>
1056 }
1057 if( nOther>0 ){
1058 @ <tr><td align="right">%d(nOther)</td>
1059 @ <td><a href="./errorlog?y=2048">Other</a></td>
1060 }
1061 @ <tr><td align="right">%d(nTotal)</td>
1062 if( nTotal>0 ){
1063 @ <td><a href="./errorlog?y=4095">All Messages</a></td>
1064 }else{
1065
--- src/security_audit.c
+++ src/security_audit.c
@@ -351,11 +351,11 @@
351 */
352 if( db_exists("SELECT 1 FROM config WHERE name GLOB 'xfer-*-script'"
353 " AND length(value)>0") ){
354 @ <li><p><b>WARNING:</b>
355 @ TH1 scripts might be configured to run on any sync, push, pull, or
356 @ clone operation. See the <a href="%R/xfersetup">/xfersetup</a>
357 @ page for more information. These TH1 scripts are a potential
358 @ security concern and so should be carefully audited by a human.
359 }
360
361 /* The strict-manifest-syntax setting should be on. */
@@ -389,11 +389,11 @@
389 @ <a href="setup_ulist">User Configuration</a> page in case we
390 @ ever reuse the letter for another purpose.
391 }
392
393 /* If anonymous users are allowed to create new Wiki, then
394 ** wiki moderation should be activated to prevent spam.
395 */
396 if( hasAnyCap(zAnonCap, "fk") ){
397 if( db_get_boolean("modreq-wiki",0)==0 ){
398 @ <li><p><b>WARNING:</b>
399 @ Anonymous users can create or edit wiki without moderation.
@@ -837,21 +837,23 @@
837 ** y=0x008 Show POST requests from a different origin
838 ** y=0x010 Show SQLITE_AUTH and similar
839 ** y=0x020 Show SMTP error reports
840 ** y=0x040 Show TH1 vulnerability reports
841 ** y=0x080 Show SQL errors
842 ** y=0x100 Show timeouts
843 ** y=0x200 Show WAL recoveries
844 ** y=0x8000 Show other uncategorized messages
845 **
846 ** If y is omitted or is zero, a count of the various message types is
847 ** shown.
848 */
849 void errorlog_page(void){
850 i64 szFile;
851 FILE *in;
852 char *zLog;
853 const char *zType = P("y");
854 static const int eAllTypes = 0x83ff;
855 long eType = 0;
856 int bOutput = 0;
857 int prevWasTime = 0;
858 int nHack = 0;
859 int nPanic = 0;
@@ -860,10 +862,12 @@
862 int nXPost = 0;
863 int nAuth = 0;
864 int nSmtp = 0;
865 int nVuln = 0;
866 int nSqlErr = 0;
867 int nTimeout = 0;
868 int nRecover = 0;
869 char z[10000];
870 char zTime[10000];
871
872 login_check_credentials();
873 if( !g.perm.Admin ){
@@ -945,11 +949,17 @@
949 @ <li>TH1 vulnerabilities
950 }
951 if( eType & 0x80 ){
952 @ <li>SQL errors
953 }
954 if( eType & 0x100 ){
955 @ <li>Timeouts
956 }
957 if( eType & 0x200 ){
958 @ <li>WAL recoveries
959 }
960 if( eType & 0x8000 ){
961 @ <li>Other uncategorized messages
962 }
963 @ </ul>
964 }
965 @ <hr>
@@ -960,19 +970,30 @@
970 if( prevWasTime ){
971 if( strncmp(z,"possible hack attempt - 418 ", 27)==0 ){
972 bOutput = (eType & 0x01)!=0;
973 nHack++;
974 }else
975 if( strncmp(z,"panic: ", 7)==0 ){
976 if( strncmp(z+7,"Timeout",7)==0 ){
977 bOutput = (eType & 0x100)!=0;
978 nTimeout++;
979 }else{
980 bOutput = (eType & 0x02)!=0;
981 nPanic++;
982 }
983 }else
984 if( strstr(z,"assertion fault")!=0 ){
985 bOutput = (eType & 0x02)!=0;
986 nPanic++;
987 }else
988 if( strncmp(z,"SMTP:", 5)==0 ){
989 bOutput = (eType & 0x20)!=0;
990 nSmtp++;
991 }else
992 if( sqlite3_strglob("warning: SQLITE_NOTICE(283):*",z)==0 ){
993 bOutput = (eType & 0x200)!=0;
994 nRecover++;
995 }else
996 if( sqlite3_strglob("warning: backoffice process * still *",z)==0 ){
997 bOutput = (eType & 0x04)!=0;
998 nHang++;
999 }else
@@ -993,11 +1014,11 @@
1014 if( strstr(z,"statement aborts at ") ){
1015 bOutput = (eType & 0x80)!=0;
1016 nSqlErr++;
1017 }else
1018 {
1019 bOutput = (eType & 0x8000)!=0;
1020 nOther++;
1021 }
1022 if( bOutput ){
1023 @ %h(zTime)\
1024 }
@@ -1036,10 +1057,18 @@
1057 }
1058 if( nSqlErr>0 ){
1059 @ <tr><td align="right">%d(nSqlErr)</td>
1060 @ <td><a href="./errorlog?y=128">SQL Errors</a></td>
1061 }
1062 if( nTimeout>0 ){
1063 @ <tr><td align="right">%d(nTimeout)</td>
1064 @ <td><a href="./errorlog?y=256">Timeouts</a></td>
1065 }
1066 if( nRecover>0 ){
1067 @ <tr><td align="right">%d(nRecover)</td>
1068 @ <td><a href="./errorlog?y=512">WAL recoveries</a></td>
1069 }
1070 if( nHang>0 ){
1071 @ <tr><td align="right">%d(nHang)</td>
1072 @ <td><a href="./errorlog?y=4">Hung Backoffice</a></td>
1073 }
1074 if( nXPost>0 ){
@@ -1054,11 +1083,11 @@
1083 @ <tr><td align="right">%d(nSmtp)</td>
1084 @ <td><a href="./errorlog?y=32">SMTP faults</a></td>
1085 }
1086 if( nOther>0 ){
1087 @ <tr><td align="right">%d(nOther)</td>
1088 @ <td><a href="./errorlog?y=32768">Other</a></td>
1089 }
1090 @ <tr><td align="right">%d(nTotal)</td>
1091 if( nTotal>0 ){
1092 @ <td><a href="./errorlog?y=4095">All Messages</a></td>
1093 }else{
1094
+43 -11
--- src/setup.c
+++ src/setup.c
@@ -485,11 +485,11 @@
485485
@ <hr>
486486
@ <p><b>Do not allow robots access to these pages.</b><br>
487487
@ If the page name matches the GLOB pattern of this setting, and the
488488
@ users is "nobody", and the client has not previously passed a captcha
489489
@ test to show that it is not a robot, then the page is not displayed.
490
- @ A captcha test is is rendered instead.
490
+ @ A captcha test is rendered instead.
491491
@ The default value for this setting is:
492492
@ <p>
493493
@ &emsp;&emsp;&emsp;<tt>%h(robot_restrict_default())</tt>
494494
@ <p>
495495
@ Usually the tag should exactly match the page name. Exceptions:
@@ -1591,10 +1591,13 @@
15911591
}
15921592
15931593
style_set_current_feature("setup");
15941594
style_header("Chat Configuration");
15951595
db_begin_transaction();
1596
+ if( P("rbldchatidx") && cgi_csrf_safe(2) ){
1597
+ chat_rebuild_index(1);
1598
+ }
15961599
@ <form action="%R/setup_chat" method="post"><div>
15971600
login_insert_csrf_secret();
15981601
@ <input type="submit" name="submit" value="Apply Changes"></p>
15991602
@ <hr>
16001603
entry_attribute("Initial Chat History Size", 10,
@@ -1643,13 +1646,33 @@
16431646
"chat-alert-sound", "snd", azAlerts[0],
16441647
count(azAlerts)/2, azAlerts);
16451648
@ <p>The sound used in the client-side chat to indicate that a new
16461649
@ chat message has arrived.
16471650
@ (Property: "chat-alert-sound")</p>
1651
+
16481652
@ <hr/>
1649
- @ <p><input type="submit" name="submit" value="Apply Changes"></p>
1653
+ @ <p><input type="submit" name="submit" value="Apply Changes">
1654
+ @ <input type="submit" name="rbldchatidx"\
1655
+ @ value="Rebuild Full-Text Search Index"></p>
16501656
@ </div></form>
1657
+
1658
+ /* Validate the chat FTS search index */
1659
+ if( db_table_exists("repository","chatfts1") ){
1660
+ char *zMissing;
1661
+ zMissing = db_text(0,
1662
+ "SELECT group_concat(rowid,', ') FROM chat"
1663
+ " WHERE rowid NOT IN (SELECT rowid FROM chatfts1_docsize)"
1664
+ );
1665
+ if( zMissing && zMissing[0] ){
1666
+ @ <p><b>WARNING:</b> The following chat messages are missing
1667
+ @ from the full-text index. Press the "Rebuild Full-Text Search Index"
1668
+ @ button above to fix this.</p>
1669
+ @ <p>%h(zMissing)</p>
1670
+ }
1671
+ fossil_free(zMissing);
1672
+ }
1673
+
16511674
db_end_transaction(0);
16521675
@ <script nonce="%h(style_nonce())">
16531676
@ (function(){
16541677
@ var w = document.getElementById('idsnd');
16551678
@ w.onchange = function(){
@@ -2342,19 +2365,24 @@
23422365
@ <br>
23432366
onoff_attribute("Search Built-in Help Text", "search-help", "sh", 0, 0);
23442367
@ <hr>
23452368
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
23462369
@ <hr>
2347
- if( P("fts0") ){
2348
- search_drop_index();
2349
- }else if( P("fts1") ){
2350
- const char *zTokenizer = PD("ftstok","off");
2351
- search_set_tokenizer(zTokenizer);
2352
- search_drop_index();
2353
- search_create_index();
2354
- search_fill_index();
2355
- search_update_index(search_restrict(SRCH_ALL));
2370
+ if( cgi_csrf_safe(2) ){
2371
+ if( P("fts0") ){
2372
+ search_drop_index();
2373
+ }else if( P("fts1") ){
2374
+ const char *zTokenizer = PD("ftstok","off");
2375
+ search_set_tokenizer(zTokenizer);
2376
+ search_drop_index();
2377
+ search_create_index();
2378
+ search_fill_index();
2379
+ search_update_index(search_restrict(SRCH_ALL));
2380
+ }
2381
+ if( P("rbldchatidx") ){
2382
+ chat_rebuild_index(1);
2383
+ }
23562384
}
23572385
if( search_index_exists() ){
23582386
int pgsz = db_int64(0, "PRAGMA repository.page_size;");
23592387
i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
23602388
i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
@@ -2367,10 +2395,14 @@
23672395
@ but takes up space. The index is currently using about %s(zSize)
23682396
@ or %.1f(100.0*(double)nFts/(double)nTotal)%% of the repository.</p>
23692397
select_fts_tokenizer();
23702398
@ <p><input type="submit" name="fts0" value="Delete The Full-Text Index">
23712399
@ <input type="submit" name="fts1" value="Rebuild The Full-Text Index">
2400
+ if( db_table_exists("repository","chat") ){
2401
+ @ <input type="submit" name="rbldchatidx" \
2402
+ @ value="Rebuild The Chat FTS Index">
2403
+ }
23722404
style_submenu_element("FTS Index Debugging","%R/test-ftsdocs");
23732405
}else{
23742406
@ <p>The SQLite search index is disabled. All searching will be
23752407
@ a full-text scan. This usually works fine, but can be slow for
23762408
@ larger repositories.</p>
23772409
--- src/setup.c
+++ src/setup.c
@@ -485,11 +485,11 @@
485 @ <hr>
486 @ <p><b>Do not allow robots access to these pages.</b><br>
487 @ If the page name matches the GLOB pattern of this setting, and the
488 @ users is "nobody", and the client has not previously passed a captcha
489 @ test to show that it is not a robot, then the page is not displayed.
490 @ A captcha test is is rendered instead.
491 @ The default value for this setting is:
492 @ <p>
493 @ &emsp;&emsp;&emsp;<tt>%h(robot_restrict_default())</tt>
494 @ <p>
495 @ Usually the tag should exactly match the page name. Exceptions:
@@ -1591,10 +1591,13 @@
1591 }
1592
1593 style_set_current_feature("setup");
1594 style_header("Chat Configuration");
1595 db_begin_transaction();
 
 
 
1596 @ <form action="%R/setup_chat" method="post"><div>
1597 login_insert_csrf_secret();
1598 @ <input type="submit" name="submit" value="Apply Changes"></p>
1599 @ <hr>
1600 entry_attribute("Initial Chat History Size", 10,
@@ -1643,13 +1646,33 @@
1643 "chat-alert-sound", "snd", azAlerts[0],
1644 count(azAlerts)/2, azAlerts);
1645 @ <p>The sound used in the client-side chat to indicate that a new
1646 @ chat message has arrived.
1647 @ (Property: "chat-alert-sound")</p>
 
1648 @ <hr/>
1649 @ <p><input type="submit" name="submit" value="Apply Changes"></p>
 
 
1650 @ </div></form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1651 db_end_transaction(0);
1652 @ <script nonce="%h(style_nonce())">
1653 @ (function(){
1654 @ var w = document.getElementById('idsnd');
1655 @ w.onchange = function(){
@@ -2342,19 +2365,24 @@
2342 @ <br>
2343 onoff_attribute("Search Built-in Help Text", "search-help", "sh", 0, 0);
2344 @ <hr>
2345 @ <p><input type="submit" name="submit" value="Apply Changes"></p>
2346 @ <hr>
2347 if( P("fts0") ){
2348 search_drop_index();
2349 }else if( P("fts1") ){
2350 const char *zTokenizer = PD("ftstok","off");
2351 search_set_tokenizer(zTokenizer);
2352 search_drop_index();
2353 search_create_index();
2354 search_fill_index();
2355 search_update_index(search_restrict(SRCH_ALL));
 
 
 
 
 
2356 }
2357 if( search_index_exists() ){
2358 int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2359 i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2360 i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
@@ -2367,10 +2395,14 @@
2367 @ but takes up space. The index is currently using about %s(zSize)
2368 @ or %.1f(100.0*(double)nFts/(double)nTotal)%% of the repository.</p>
2369 select_fts_tokenizer();
2370 @ <p><input type="submit" name="fts0" value="Delete The Full-Text Index">
2371 @ <input type="submit" name="fts1" value="Rebuild The Full-Text Index">
 
 
 
 
2372 style_submenu_element("FTS Index Debugging","%R/test-ftsdocs");
2373 }else{
2374 @ <p>The SQLite search index is disabled. All searching will be
2375 @ a full-text scan. This usually works fine, but can be slow for
2376 @ larger repositories.</p>
2377
--- src/setup.c
+++ src/setup.c
@@ -485,11 +485,11 @@
485 @ <hr>
486 @ <p><b>Do not allow robots access to these pages.</b><br>
487 @ If the page name matches the GLOB pattern of this setting, and the
488 @ users is "nobody", and the client has not previously passed a captcha
489 @ test to show that it is not a robot, then the page is not displayed.
490 @ A captcha test is rendered instead.
491 @ The default value for this setting is:
492 @ <p>
493 @ &emsp;&emsp;&emsp;<tt>%h(robot_restrict_default())</tt>
494 @ <p>
495 @ Usually the tag should exactly match the page name. Exceptions:
@@ -1591,10 +1591,13 @@
1591 }
1592
1593 style_set_current_feature("setup");
1594 style_header("Chat Configuration");
1595 db_begin_transaction();
1596 if( P("rbldchatidx") && cgi_csrf_safe(2) ){
1597 chat_rebuild_index(1);
1598 }
1599 @ <form action="%R/setup_chat" method="post"><div>
1600 login_insert_csrf_secret();
1601 @ <input type="submit" name="submit" value="Apply Changes"></p>
1602 @ <hr>
1603 entry_attribute("Initial Chat History Size", 10,
@@ -1643,13 +1646,33 @@
1646 "chat-alert-sound", "snd", azAlerts[0],
1647 count(azAlerts)/2, azAlerts);
1648 @ <p>The sound used in the client-side chat to indicate that a new
1649 @ chat message has arrived.
1650 @ (Property: "chat-alert-sound")</p>
1651
1652 @ <hr/>
1653 @ <p><input type="submit" name="submit" value="Apply Changes">
1654 @ <input type="submit" name="rbldchatidx"\
1655 @ value="Rebuild Full-Text Search Index"></p>
1656 @ </div></form>
1657
1658 /* Validate the chat FTS search index */
1659 if( db_table_exists("repository","chatfts1") ){
1660 char *zMissing;
1661 zMissing = db_text(0,
1662 "SELECT group_concat(rowid,', ') FROM chat"
1663 " WHERE rowid NOT IN (SELECT rowid FROM chatfts1_docsize)"
1664 );
1665 if( zMissing && zMissing[0] ){
1666 @ <p><b>WARNING:</b> The following chat messages are missing
1667 @ from the full-text index. Press the "Rebuild Full-Text Search Index"
1668 @ button above to fix this.</p>
1669 @ <p>%h(zMissing)</p>
1670 }
1671 fossil_free(zMissing);
1672 }
1673
1674 db_end_transaction(0);
1675 @ <script nonce="%h(style_nonce())">
1676 @ (function(){
1677 @ var w = document.getElementById('idsnd');
1678 @ w.onchange = function(){
@@ -2342,19 +2365,24 @@
2365 @ <br>
2366 onoff_attribute("Search Built-in Help Text", "search-help", "sh", 0, 0);
2367 @ <hr>
2368 @ <p><input type="submit" name="submit" value="Apply Changes"></p>
2369 @ <hr>
2370 if( cgi_csrf_safe(2) ){
2371 if( P("fts0") ){
2372 search_drop_index();
2373 }else if( P("fts1") ){
2374 const char *zTokenizer = PD("ftstok","off");
2375 search_set_tokenizer(zTokenizer);
2376 search_drop_index();
2377 search_create_index();
2378 search_fill_index();
2379 search_update_index(search_restrict(SRCH_ALL));
2380 }
2381 if( P("rbldchatidx") ){
2382 chat_rebuild_index(1);
2383 }
2384 }
2385 if( search_index_exists() ){
2386 int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2387 i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2388 i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
@@ -2367,10 +2395,14 @@
2395 @ but takes up space. The index is currently using about %s(zSize)
2396 @ or %.1f(100.0*(double)nFts/(double)nTotal)%% of the repository.</p>
2397 select_fts_tokenizer();
2398 @ <p><input type="submit" name="fts0" value="Delete The Full-Text Index">
2399 @ <input type="submit" name="fts1" value="Rebuild The Full-Text Index">
2400 if( db_table_exists("repository","chat") ){
2401 @ <input type="submit" name="rbldchatidx" \
2402 @ value="Rebuild The Chat FTS Index">
2403 }
2404 style_submenu_element("FTS Index Debugging","%R/test-ftsdocs");
2405 }else{
2406 @ <p>The SQLite search index is disabled. All searching will be
2407 @ a full-text scan. This usually works fine, but can be slow for
2408 @ larger repositories.</p>
2409
+1 -1
--- src/setupuser.c
+++ src/setupuser.c
@@ -617,11 +617,11 @@
617617
zLogin, zLogin
618618
);
619619
zOldLogin = zLogin;
620620
}
621621
#if 0
622
- /* Problem: when renaming a user we need to update the subcriber
622
+ /* Problem: when renaming a user we need to update the subscriber
623623
** names to match but we cannot know from here if each member of
624624
** the login group has the subscriber tables, so we cannot blindly
625625
** include this SQL. */
626626
else if( fossil_strcmp(zLogin, zOldLogin)!=0
627627
&& alert_tables_exist() ){
628628
--- src/setupuser.c
+++ src/setupuser.c
@@ -617,11 +617,11 @@
617 zLogin, zLogin
618 );
619 zOldLogin = zLogin;
620 }
621 #if 0
622 /* Problem: when renaming a user we need to update the subcriber
623 ** names to match but we cannot know from here if each member of
624 ** the login group has the subscriber tables, so we cannot blindly
625 ** include this SQL. */
626 else if( fossil_strcmp(zLogin, zOldLogin)!=0
627 && alert_tables_exist() ){
628
--- src/setupuser.c
+++ src/setupuser.c
@@ -617,11 +617,11 @@
617 zLogin, zLogin
618 );
619 zOldLogin = zLogin;
620 }
621 #if 0
622 /* Problem: when renaming a user we need to update the subscriber
623 ** names to match but we cannot know from here if each member of
624 ** the login group has the subscriber tables, so we cannot blindly
625 ** include this SQL. */
626 else if( fossil_strcmp(zLogin, zOldLogin)!=0
627 && alert_tables_exist() ){
628
+1 -1
--- src/sha1.c
+++ src/sha1.c
@@ -257,11 +257,11 @@
257257
for (i = 0; i < 20; i++)
258258
digest[i] = (unsigned char)
259259
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
260260
}
261261
}
262
-#endif /* Built-in SHA1 implemenation */
262
+#endif /* Built-in SHA1 implementation */
263263
264264
/*
265265
** Convert a digest into base-16. digest should be declared as
266266
** "unsigned char digest[20]" in the calling function. The SHA1
267267
** digest is stored in the first 20 bytes. zBuf should
268268
--- src/sha1.c
+++ src/sha1.c
@@ -257,11 +257,11 @@
257 for (i = 0; i < 20; i++)
258 digest[i] = (unsigned char)
259 ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
260 }
261 }
262 #endif /* Built-in SHA1 implemenation */
263
264 /*
265 ** Convert a digest into base-16. digest should be declared as
266 ** "unsigned char digest[20]" in the calling function. The SHA1
267 ** digest is stored in the first 20 bytes. zBuf should
268
--- src/sha1.c
+++ src/sha1.c
@@ -257,11 +257,11 @@
257 for (i = 0; i < 20; i++)
258 digest[i] = (unsigned char)
259 ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
260 }
261 }
262 #endif /* Built-in SHA1 implementation */
263
264 /*
265 ** Convert a digest into base-16. digest should be declared as
266 ** "unsigned char digest[20]" in the calling function. The SHA1
267 ** digest is stored in the first 20 bytes. zBuf should
268
+1 -1
--- src/skins.c
+++ src/skins.c
@@ -162,11 +162,11 @@
162162
** 2) The "skin" display setting cookie or URL argument, in that
163163
** order. If the "skin" URL argument is provided and refers to a legal
164164
** skin then that will update the display cookie. If the skin name is
165165
** illegal it is silently ignored.
166166
**
167
-** 3) The built-in skin identfied by the "default-skin" setting, if such
167
+** 3) The built-in skin identified by the "default-skin" setting, if such
168168
** a setting exists and matches one of the built-in skin names.
169169
**
170170
** 4) Skin properties (settings "css", "details", "footer", "header",
171171
** and "js") from the CONFIG db table
172172
**
173173
--- src/skins.c
+++ src/skins.c
@@ -162,11 +162,11 @@
162 ** 2) The "skin" display setting cookie or URL argument, in that
163 ** order. If the "skin" URL argument is provided and refers to a legal
164 ** skin then that will update the display cookie. If the skin name is
165 ** illegal it is silently ignored.
166 **
167 ** 3) The built-in skin identfied by the "default-skin" setting, if such
168 ** a setting exists and matches one of the built-in skin names.
169 **
170 ** 4) Skin properties (settings "css", "details", "footer", "header",
171 ** and "js") from the CONFIG db table
172 **
173
--- src/skins.c
+++ src/skins.c
@@ -162,11 +162,11 @@
162 ** 2) The "skin" display setting cookie or URL argument, in that
163 ** order. If the "skin" URL argument is provided and refers to a legal
164 ** skin then that will update the display cookie. If the skin name is
165 ** illegal it is silently ignored.
166 **
167 ** 3) The built-in skin identified by the "default-skin" setting, if such
168 ** a setting exists and matches one of the built-in skin names.
169 **
170 ** 4) Skin properties (settings "css", "details", "footer", "header",
171 ** and "js") from the CONFIG db table
172 **
173
+1 -1
--- src/smtp.c
+++ src/smtp.c
@@ -565,11 +565,11 @@
565565
** Return 0 on success. Otherwise an error code.
566566
*/
567567
int smtp_send_msg(
568568
SmtpSession *p, /* The SMTP server to which the message is sent */
569569
const char *zFrom, /* Who the message is from */
570
- int nTo, /* Number of receipients */
570
+ int nTo, /* Number of recipients */
571571
const char **azTo, /* Email address of each recipient */
572572
const char *zMsg /* Body of the message */
573573
){
574574
int i;
575575
int iCode = 0;
576576
--- src/smtp.c
+++ src/smtp.c
@@ -565,11 +565,11 @@
565 ** Return 0 on success. Otherwise an error code.
566 */
567 int smtp_send_msg(
568 SmtpSession *p, /* The SMTP server to which the message is sent */
569 const char *zFrom, /* Who the message is from */
570 int nTo, /* Number of receipients */
571 const char **azTo, /* Email address of each recipient */
572 const char *zMsg /* Body of the message */
573 ){
574 int i;
575 int iCode = 0;
576
--- src/smtp.c
+++ src/smtp.c
@@ -565,11 +565,11 @@
565 ** Return 0 on success. Otherwise an error code.
566 */
567 int smtp_send_msg(
568 SmtpSession *p, /* The SMTP server to which the message is sent */
569 const char *zFrom, /* Who the message is from */
570 int nTo, /* Number of recipients */
571 const char **azTo, /* Email address of each recipient */
572 const char *zMsg /* Body of the message */
573 ){
574 int i;
575 int iCode = 0;
576
+1 -1
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -168,11 +168,11 @@
168168
** WARNING:
169169
** Do not instantiate these functions for any Fossil webpage or command
170170
** method other than the "fossil sql" command. If an attacker gains access
171171
** to these functions, he will be able to disable other defense mechanisms.
172172
**
173
-** This routines are for interactiving testing only. They are experimental
173
+** This routines are for interactive testing only. They are experimental
174174
** and undocumented (apart from this comments) and might go away or change
175175
** in future releases.
176176
**
177177
** 2020-11-29: These functions are now only available if the "fossil sql"
178178
** command is started with the --test option.
179179
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -168,11 +168,11 @@
168 ** WARNING:
169 ** Do not instantiate these functions for any Fossil webpage or command
170 ** method other than the "fossil sql" command. If an attacker gains access
171 ** to these functions, he will be able to disable other defense mechanisms.
172 **
173 ** This routines are for interactiving testing only. They are experimental
174 ** and undocumented (apart from this comments) and might go away or change
175 ** in future releases.
176 **
177 ** 2020-11-29: These functions are now only available if the "fossil sql"
178 ** command is started with the --test option.
179
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -168,11 +168,11 @@
168 ** WARNING:
169 ** Do not instantiate these functions for any Fossil webpage or command
170 ** method other than the "fossil sql" command. If an attacker gains access
171 ** to these functions, he will be able to disable other defense mechanisms.
172 **
173 ** This routines are for interactive testing only. They are experimental
174 ** and undocumented (apart from this comments) and might go away or change
175 ** in future releases.
176 **
177 ** 2020-11-29: These functions are now only available if the "fossil sql"
178 ** command is started with the --test option.
179
+1 -1
--- src/stat.c
+++ src/stat.c
@@ -503,11 +503,11 @@
503503
** access URL.
504504
**
505505
** Algorithm:
506506
**
507507
** The public URL is given by the email-url property. But it is only
508
-** returned if there have been one more more accesses (as recorded by
508
+** returned if there have been one or more accesses (as recorded by
509509
** "baseurl:URL" entries in the CONFIG table).
510510
*/
511511
const char *public_url(void){
512512
const char *zUrl = db_get("email-url", 0);
513513
if( zUrl==0 ) return 0;
514514
--- src/stat.c
+++ src/stat.c
@@ -503,11 +503,11 @@
503 ** access URL.
504 **
505 ** Algorithm:
506 **
507 ** The public URL is given by the email-url property. But it is only
508 ** returned if there have been one more more accesses (as recorded by
509 ** "baseurl:URL" entries in the CONFIG table).
510 */
511 const char *public_url(void){
512 const char *zUrl = db_get("email-url", 0);
513 if( zUrl==0 ) return 0;
514
--- src/stat.c
+++ src/stat.c
@@ -503,11 +503,11 @@
503 ** access URL.
504 **
505 ** Algorithm:
506 **
507 ** The public URL is given by the email-url property. But it is only
508 ** returned if there have been one or more accesses (as recorded by
509 ** "baseurl:URL" entries in the CONFIG table).
510 */
511 const char *public_url(void){
512 const char *zUrl = db_get("email-url", 0);
513 if( zUrl==0 ) return 0;
514
+10 -5
--- src/style.c
+++ src/style.c
@@ -226,11 +226,11 @@
226226
**
227227
** As a defense against robots, the action=ARG might instead by data-action=ARG
228228
** and javascript (href.js) added to the page so that the data-action= is
229229
** changed into action= after the page loads. Whether or not this happens
230230
** depends on if the user has the "h" privilege and whether or not the
231
-** auto-hyperlink setting is on. These setings determine the values of
231
+** auto-hyperlink setting is on. These settings determine the values of
232232
** variables g.perm.Hyperlink and g.jsHref.
233233
**
234234
** User has "h" auto-hyperlink g.perm.Hyperlink g.jsHref
235235
** ------------ -------------- ---------------- --------
236236
** 1: 0 0 0 0
@@ -913,14 +913,14 @@
913913
@ </script>
914914
builtin_fulfill_js_requests();
915915
}
916916
917917
/*
918
-** Transorm input string into a token that is safe for inclusion into
918
+** Transform input string into a token that is safe for inclusion into
919919
** class attribute. Digits and low-case letter are passed unchanged,
920920
** upper-case letters are transformed to low-case, everything else is
921
-** tranformed into hyphens; consequtive and pending hyphens are squeezed.
921
+** transformed into hyphens; consecutive and pending hyphens are squeezed.
922922
** If result does not fit into szOut chars then it is truncated.
923923
** Result is always terminated with null.
924924
*/
925925
void style_derive_classname(const char *zIn, char *zOut, int szOut){
926926
assert( zOut );
@@ -1219,11 +1219,11 @@
12191219
12201220
/*
12211221
** Check for "name" or "page" query parameters on an /style.css
12221222
** page request. If present, then page-specific CSS is requested,
12231223
** so add that CSS to pOut. If the "name" and "page" query parameters
1224
-** are omitted, then pOut is unchnaged.
1224
+** are omitted, then pOut is unchanged.
12251225
*/
12261226
static void page_style_css_append_page_style(Blob *pOut){
12271227
const char *zPage = PD("name",P("page"));
12281228
char * zFile;
12291229
int nFile = 0;
@@ -1252,11 +1252,11 @@
12521252
}
12531253
12541254
/*
12551255
** WEBPAGE: style.css loadavg-exempt
12561256
**
1257
-** Return the style sheet. The style sheet is assemblied from
1257
+** Return the style sheet. The style sheet is assembled from
12581258
** multiple sources, in order:
12591259
**
12601260
** (1) The built-in "default.css" style sheet containing basic defaults.
12611261
**
12621262
** (2) The page-specific style sheet taken from the built-in
@@ -1442,10 +1442,15 @@
14421442
@ g.zHttpsURL = %h(g.zHttpsURL)<br>
14431443
@ g.zTop = %h(g.zTop)<br>
14441444
@ g.zPath = %h(g.zPath)<br>
14451445
@ g.userUid = %d(g.userUid)<br>
14461446
@ g.zLogin = %h(g.zLogin)<br>
1447
+ if( g.eAuthMethod!=AUTH_NONE ){
1448
+ const char *zMethod[] = { "COOKIE", "LOCAL", "PW", "ENV", "HTTP" };
1449
+ @ g.eAuthMethod = %d(g.eAuthMethod) (%h(zMethod[g.eAuthMethod-1]))\
1450
+ @ <br>
1451
+ }
14471452
@ g.isRobot = %d(g.isRobot)<br>
14481453
@ g.jsHref = %d(g.jsHref)<br>
14491454
if( g.zLocalRoot ){
14501455
@ g.zLocalRoot = %h(g.zLocalRoot)<br>
14511456
}else{
14521457
--- src/style.c
+++ src/style.c
@@ -226,11 +226,11 @@
226 **
227 ** As a defense against robots, the action=ARG might instead by data-action=ARG
228 ** and javascript (href.js) added to the page so that the data-action= is
229 ** changed into action= after the page loads. Whether or not this happens
230 ** depends on if the user has the "h" privilege and whether or not the
231 ** auto-hyperlink setting is on. These setings determine the values of
232 ** variables g.perm.Hyperlink and g.jsHref.
233 **
234 ** User has "h" auto-hyperlink g.perm.Hyperlink g.jsHref
235 ** ------------ -------------- ---------------- --------
236 ** 1: 0 0 0 0
@@ -913,14 +913,14 @@
913 @ </script>
914 builtin_fulfill_js_requests();
915 }
916
917 /*
918 ** Transorm input string into a token that is safe for inclusion into
919 ** class attribute. Digits and low-case letter are passed unchanged,
920 ** upper-case letters are transformed to low-case, everything else is
921 ** tranformed into hyphens; consequtive and pending hyphens are squeezed.
922 ** If result does not fit into szOut chars then it is truncated.
923 ** Result is always terminated with null.
924 */
925 void style_derive_classname(const char *zIn, char *zOut, int szOut){
926 assert( zOut );
@@ -1219,11 +1219,11 @@
1219
1220 /*
1221 ** Check for "name" or "page" query parameters on an /style.css
1222 ** page request. If present, then page-specific CSS is requested,
1223 ** so add that CSS to pOut. If the "name" and "page" query parameters
1224 ** are omitted, then pOut is unchnaged.
1225 */
1226 static void page_style_css_append_page_style(Blob *pOut){
1227 const char *zPage = PD("name",P("page"));
1228 char * zFile;
1229 int nFile = 0;
@@ -1252,11 +1252,11 @@
1252 }
1253
1254 /*
1255 ** WEBPAGE: style.css loadavg-exempt
1256 **
1257 ** Return the style sheet. The style sheet is assemblied from
1258 ** multiple sources, in order:
1259 **
1260 ** (1) The built-in "default.css" style sheet containing basic defaults.
1261 **
1262 ** (2) The page-specific style sheet taken from the built-in
@@ -1442,10 +1442,15 @@
1442 @ g.zHttpsURL = %h(g.zHttpsURL)<br>
1443 @ g.zTop = %h(g.zTop)<br>
1444 @ g.zPath = %h(g.zPath)<br>
1445 @ g.userUid = %d(g.userUid)<br>
1446 @ g.zLogin = %h(g.zLogin)<br>
 
 
 
 
 
1447 @ g.isRobot = %d(g.isRobot)<br>
1448 @ g.jsHref = %d(g.jsHref)<br>
1449 if( g.zLocalRoot ){
1450 @ g.zLocalRoot = %h(g.zLocalRoot)<br>
1451 }else{
1452
--- src/style.c
+++ src/style.c
@@ -226,11 +226,11 @@
226 **
227 ** As a defense against robots, the action=ARG might instead by data-action=ARG
228 ** and javascript (href.js) added to the page so that the data-action= is
229 ** changed into action= after the page loads. Whether or not this happens
230 ** depends on if the user has the "h" privilege and whether or not the
231 ** auto-hyperlink setting is on. These settings determine the values of
232 ** variables g.perm.Hyperlink and g.jsHref.
233 **
234 ** User has "h" auto-hyperlink g.perm.Hyperlink g.jsHref
235 ** ------------ -------------- ---------------- --------
236 ** 1: 0 0 0 0
@@ -913,14 +913,14 @@
913 @ </script>
914 builtin_fulfill_js_requests();
915 }
916
917 /*
918 ** Transform input string into a token that is safe for inclusion into
919 ** class attribute. Digits and low-case letter are passed unchanged,
920 ** upper-case letters are transformed to low-case, everything else is
921 ** transformed into hyphens; consecutive and pending hyphens are squeezed.
922 ** If result does not fit into szOut chars then it is truncated.
923 ** Result is always terminated with null.
924 */
925 void style_derive_classname(const char *zIn, char *zOut, int szOut){
926 assert( zOut );
@@ -1219,11 +1219,11 @@
1219
1220 /*
1221 ** Check for "name" or "page" query parameters on an /style.css
1222 ** page request. If present, then page-specific CSS is requested,
1223 ** so add that CSS to pOut. If the "name" and "page" query parameters
1224 ** are omitted, then pOut is unchanged.
1225 */
1226 static void page_style_css_append_page_style(Blob *pOut){
1227 const char *zPage = PD("name",P("page"));
1228 char * zFile;
1229 int nFile = 0;
@@ -1252,11 +1252,11 @@
1252 }
1253
1254 /*
1255 ** WEBPAGE: style.css loadavg-exempt
1256 **
1257 ** Return the style sheet. The style sheet is assembled from
1258 ** multiple sources, in order:
1259 **
1260 ** (1) The built-in "default.css" style sheet containing basic defaults.
1261 **
1262 ** (2) The page-specific style sheet taken from the built-in
@@ -1442,10 +1442,15 @@
1442 @ g.zHttpsURL = %h(g.zHttpsURL)<br>
1443 @ g.zTop = %h(g.zTop)<br>
1444 @ g.zPath = %h(g.zPath)<br>
1445 @ g.userUid = %d(g.userUid)<br>
1446 @ g.zLogin = %h(g.zLogin)<br>
1447 if( g.eAuthMethod!=AUTH_NONE ){
1448 const char *zMethod[] = { "COOKIE", "LOCAL", "PW", "ENV", "HTTP" };
1449 @ g.eAuthMethod = %d(g.eAuthMethod) (%h(zMethod[g.eAuthMethod-1]))\
1450 @ <br>
1451 }
1452 @ g.isRobot = %d(g.isRobot)<br>
1453 @ g.jsHref = %d(g.jsHref)<br>
1454 if( g.zLocalRoot ){
1455 @ g.zLocalRoot = %h(g.zLocalRoot)<br>
1456 }else{
1457
--- src/style.chat.css
+++ src/style.chat.css
@@ -462,20 +462,42 @@
462462
Note that setting flex shrink to 0 breaks/disables scrolling!*/;
463463
margin-bottom: 0.2em;
464464
}
465465
body.chat #chat-config,
466466
body.chat #chat-search,
467
-body.chat #chat-preview {
467
+body.chat #chat-preview,
468
+body.chat #chat-zoom {
468469
/* /chat configuration widget */
469470
display: flex;
470471
flex-direction: column;
471472
overflow: auto;
472473
padding: 0;
473474
margin: 0;
474475
align-items: stretch;
475476
min-height: 6em;
476477
}
478
+body.chat #chat-zoom {
479
+ justify-content: space-between;
480
+}
481
+body.chat #chat-zoom-content {
482
+ display: flex;
483
+ overflow: auto;
484
+}
485
+body.chat #chat-zoom-content > .message-widget {
486
+ flex-grow: 1;
487
+}
488
+body.chat #chat-zoom-content > .message-widget > .message-widget-content {
489
+ width: 99%;
490
+}
491
+body.chat #chat-zoom-content > .message-widget .toolbar.hide-in-zoom {
492
+ /* The various Delete buttons misinteract with zoom mode's moving-around
493
+ of message widgets, so hide them in zoom mode. */
494
+ position: absolute !important;
495
+ opacity: 0 !important;
496
+ pointer-events: none !important;
497
+ display: none !important;
498
+}
477499
body.chat #chat-config #chat-config-options {
478500
/* /chat config options go here */
479501
flex: 1 1 auto;
480502
display: flex;
481503
flex-direction: column;
482504
--- src/style.chat.css
+++ src/style.chat.css
@@ -462,20 +462,42 @@
462 Note that setting flex shrink to 0 breaks/disables scrolling!*/;
463 margin-bottom: 0.2em;
464 }
465 body.chat #chat-config,
466 body.chat #chat-search,
467 body.chat #chat-preview {
 
468 /* /chat configuration widget */
469 display: flex;
470 flex-direction: column;
471 overflow: auto;
472 padding: 0;
473 margin: 0;
474 align-items: stretch;
475 min-height: 6em;
476 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477 body.chat #chat-config #chat-config-options {
478 /* /chat config options go here */
479 flex: 1 1 auto;
480 display: flex;
481 flex-direction: column;
482
--- src/style.chat.css
+++ src/style.chat.css
@@ -462,20 +462,42 @@
462 Note that setting flex shrink to 0 breaks/disables scrolling!*/;
463 margin-bottom: 0.2em;
464 }
465 body.chat #chat-config,
466 body.chat #chat-search,
467 body.chat #chat-preview,
468 body.chat #chat-zoom {
469 /* /chat configuration widget */
470 display: flex;
471 flex-direction: column;
472 overflow: auto;
473 padding: 0;
474 margin: 0;
475 align-items: stretch;
476 min-height: 6em;
477 }
478 body.chat #chat-zoom {
479 justify-content: space-between;
480 }
481 body.chat #chat-zoom-content {
482 display: flex;
483 overflow: auto;
484 }
485 body.chat #chat-zoom-content > .message-widget {
486 flex-grow: 1;
487 }
488 body.chat #chat-zoom-content > .message-widget > .message-widget-content {
489 width: 99%;
490 }
491 body.chat #chat-zoom-content > .message-widget .toolbar.hide-in-zoom {
492 /* The various Delete buttons misinteract with zoom mode's moving-around
493 of message widgets, so hide them in zoom mode. */
494 position: absolute !important;
495 opacity: 0 !important;
496 pointer-events: none !important;
497 display: none !important;
498 }
499 body.chat #chat-config #chat-config-options {
500 /* /chat config options go here */
501 flex: 1 1 auto;
502 display: flex;
503 flex-direction: column;
504
+17 -5
--- src/sync.c
+++ src/sync.c
@@ -23,11 +23,11 @@
2323
2424
/*
2525
** Explain what type of sync operation is about to occur
2626
*/
2727
static void sync_explain(unsigned syncFlags){
28
- if( g.url.isAlias ){
28
+ if( g.url.isAlias && (syncFlags & SYNC_QUIET)==0 ){
2929
const char *url;
3030
if( g.url.useProxy ){
3131
url = g.url.proxyUrlCanonical;
3232
}else{
3333
url = g.url.canonical;
@@ -36,10 +36,12 @@
3636
fossil_print("Sync with %s\n", url);
3737
}else if( syncFlags & SYNC_PUSH ){
3838
fossil_print("Push to %s\n", url);
3939
}else if( syncFlags & SYNC_PULL ){
4040
fossil_print("Pull from %s\n", url);
41
+ }else if( syncFlags & SYNC_PING ){
42
+ fossil_print("Ping %s\n", url);
4143
}
4244
}
4345
}
4446
4547
@@ -307,11 +309,11 @@
307309
** URL is the server name. PAYLOAD is the name of a temporary file
308310
** that will contain the xfer-protocol payload to send to the server.
309311
** REPLY is a temporary filename in which COMMAND should write the
310312
** content of the reply from the server.
311313
**
312
- ** CMD is reponsible for HTTP redirects. The following Fossil command
314
+ ** CMD is responsible for HTTP redirects. The following Fossil command
313315
** can be used for CMD to achieve a working sync:
314316
**
315317
** fossil test-httpmsg --xfer
316318
*/
317319
g.zHttpCmd = find_option("transport-command",0,1);
@@ -482,12 +484,14 @@
482484
** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol,
483485
** if required by the remote website
484486
** --ipv4 Use only IPv4, not IPv6
485487
** --no-http-compression Do not compress HTTP traffic
486488
** --once Do not remember URL for subsequent syncs
489
+** --ping Just verify that the server is alive
487490
** --proxy PROXY Use the specified HTTP proxy
488491
** --private Sync private branches too
492
+** -q|--quiet Omit all output
489493
** -R|--repository REPO Local repository to sync with
490494
** --ssl-identity FILE Local SSL credentials, if requested by remote
491495
** --ssh-command SSH Use SSH as the "ssh" command
492496
** --transport-command CMD Use external command CMD to move message
493497
** between the client and the server
@@ -502,19 +506,27 @@
502506
void sync_cmd(void){
503507
unsigned configFlags = 0;
504508
unsigned syncFlags = SYNC_PUSH|SYNC_PULL;
505509
if( find_option("unversioned","u",0)!=0 ){
506510
syncFlags |= SYNC_UNVERSIONED;
511
+ }
512
+ if( find_option("ping",0,0)!=0 ){
513
+ syncFlags = SYNC_PING;
514
+ }
515
+ if( find_option("quiet","q",0)!=0 ){
516
+ syncFlags |= SYNC_QUIET;
507517
}
508518
process_sync_args(&configFlags, &syncFlags, 0, 0);
509519
510520
/* We should be done with options.. */
511521
verify_all_options();
512522
513
- if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
514
- if( (syncFlags & SYNC_PUSH)==0 ){
515
- fossil_warning("pull only: the 'dont-push' option is set");
523
+ if( (syncFlags & SYNC_PING)==0 ){
524
+ if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
525
+ if( (syncFlags & SYNC_PUSH)==0 ){
526
+ fossil_warning("pull only: the 'dont-push' option is set");
527
+ }
516528
}
517529
client_sync_all_urls(syncFlags, configFlags, 0, 0);
518530
}
519531
520532
/*
521533
--- src/sync.c
+++ src/sync.c
@@ -23,11 +23,11 @@
23
24 /*
25 ** Explain what type of sync operation is about to occur
26 */
27 static void sync_explain(unsigned syncFlags){
28 if( g.url.isAlias ){
29 const char *url;
30 if( g.url.useProxy ){
31 url = g.url.proxyUrlCanonical;
32 }else{
33 url = g.url.canonical;
@@ -36,10 +36,12 @@
36 fossil_print("Sync with %s\n", url);
37 }else if( syncFlags & SYNC_PUSH ){
38 fossil_print("Push to %s\n", url);
39 }else if( syncFlags & SYNC_PULL ){
40 fossil_print("Pull from %s\n", url);
 
 
41 }
42 }
43 }
44
45
@@ -307,11 +309,11 @@
307 ** URL is the server name. PAYLOAD is the name of a temporary file
308 ** that will contain the xfer-protocol payload to send to the server.
309 ** REPLY is a temporary filename in which COMMAND should write the
310 ** content of the reply from the server.
311 **
312 ** CMD is reponsible for HTTP redirects. The following Fossil command
313 ** can be used for CMD to achieve a working sync:
314 **
315 ** fossil test-httpmsg --xfer
316 */
317 g.zHttpCmd = find_option("transport-command",0,1);
@@ -482,12 +484,14 @@
482 ** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol,
483 ** if required by the remote website
484 ** --ipv4 Use only IPv4, not IPv6
485 ** --no-http-compression Do not compress HTTP traffic
486 ** --once Do not remember URL for subsequent syncs
 
487 ** --proxy PROXY Use the specified HTTP proxy
488 ** --private Sync private branches too
 
489 ** -R|--repository REPO Local repository to sync with
490 ** --ssl-identity FILE Local SSL credentials, if requested by remote
491 ** --ssh-command SSH Use SSH as the "ssh" command
492 ** --transport-command CMD Use external command CMD to move message
493 ** between the client and the server
@@ -502,19 +506,27 @@
502 void sync_cmd(void){
503 unsigned configFlags = 0;
504 unsigned syncFlags = SYNC_PUSH|SYNC_PULL;
505 if( find_option("unversioned","u",0)!=0 ){
506 syncFlags |= SYNC_UNVERSIONED;
 
 
 
 
 
 
507 }
508 process_sync_args(&configFlags, &syncFlags, 0, 0);
509
510 /* We should be done with options.. */
511 verify_all_options();
512
513 if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
514 if( (syncFlags & SYNC_PUSH)==0 ){
515 fossil_warning("pull only: the 'dont-push' option is set");
 
 
516 }
517 client_sync_all_urls(syncFlags, configFlags, 0, 0);
518 }
519
520 /*
521
--- src/sync.c
+++ src/sync.c
@@ -23,11 +23,11 @@
23
24 /*
25 ** Explain what type of sync operation is about to occur
26 */
27 static void sync_explain(unsigned syncFlags){
28 if( g.url.isAlias && (syncFlags & SYNC_QUIET)==0 ){
29 const char *url;
30 if( g.url.useProxy ){
31 url = g.url.proxyUrlCanonical;
32 }else{
33 url = g.url.canonical;
@@ -36,10 +36,12 @@
36 fossil_print("Sync with %s\n", url);
37 }else if( syncFlags & SYNC_PUSH ){
38 fossil_print("Push to %s\n", url);
39 }else if( syncFlags & SYNC_PULL ){
40 fossil_print("Pull from %s\n", url);
41 }else if( syncFlags & SYNC_PING ){
42 fossil_print("Ping %s\n", url);
43 }
44 }
45 }
46
47
@@ -307,11 +309,11 @@
309 ** URL is the server name. PAYLOAD is the name of a temporary file
310 ** that will contain the xfer-protocol payload to send to the server.
311 ** REPLY is a temporary filename in which COMMAND should write the
312 ** content of the reply from the server.
313 **
314 ** CMD is responsible for HTTP redirects. The following Fossil command
315 ** can be used for CMD to achieve a working sync:
316 **
317 ** fossil test-httpmsg --xfer
318 */
319 g.zHttpCmd = find_option("transport-command",0,1);
@@ -482,12 +484,14 @@
484 ** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol,
485 ** if required by the remote website
486 ** --ipv4 Use only IPv4, not IPv6
487 ** --no-http-compression Do not compress HTTP traffic
488 ** --once Do not remember URL for subsequent syncs
489 ** --ping Just verify that the server is alive
490 ** --proxy PROXY Use the specified HTTP proxy
491 ** --private Sync private branches too
492 ** -q|--quiet Omit all output
493 ** -R|--repository REPO Local repository to sync with
494 ** --ssl-identity FILE Local SSL credentials, if requested by remote
495 ** --ssh-command SSH Use SSH as the "ssh" command
496 ** --transport-command CMD Use external command CMD to move message
497 ** between the client and the server
@@ -502,19 +506,27 @@
506 void sync_cmd(void){
507 unsigned configFlags = 0;
508 unsigned syncFlags = SYNC_PUSH|SYNC_PULL;
509 if( find_option("unversioned","u",0)!=0 ){
510 syncFlags |= SYNC_UNVERSIONED;
511 }
512 if( find_option("ping",0,0)!=0 ){
513 syncFlags = SYNC_PING;
514 }
515 if( find_option("quiet","q",0)!=0 ){
516 syncFlags |= SYNC_QUIET;
517 }
518 process_sync_args(&configFlags, &syncFlags, 0, 0);
519
520 /* We should be done with options.. */
521 verify_all_options();
522
523 if( (syncFlags & SYNC_PING)==0 ){
524 if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
525 if( (syncFlags & SYNC_PUSH)==0 ){
526 fossil_warning("pull only: the 'dont-push' option is set");
527 }
528 }
529 client_sync_all_urls(syncFlags, configFlags, 0, 0);
530 }
531
532 /*
533
+21 -23
--- src/tag.c
+++ src/tag.c
@@ -422,11 +422,11 @@
422422
**
423423
** > fossil tag cancel ?--raw? TAGNAME ARTIFACT-ID
424424
**
425425
** Remove the tag TAGNAME from the artifact referenced by
426426
** ARTIFACT-ID, and also remove the propagation of the tag to
427
-** any descendants. Use the the -n|--dry-run option to see
427
+** any descendants. Use the -n|--dry-run option to see
428428
** what would have happened. Certain tag name prefixes are
429429
** forbidden, as documented for the 'add' subcommand.
430430
**
431431
** Options:
432432
** --date-override DATETIME Set date and time deleted
@@ -587,21 +587,23 @@
587587
int fRaw = find_option("raw","",0)!=0;
588588
const char *zFindLimit = find_option("limit","n",1);
589589
const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000;
590590
const char *zType = find_option("type","t",1);
591591
Blob sql = empty_blob;
592
+ const char *zTag;
592593
if( zType==0 || zType[0]==0 ) zType = "*";
593594
if( g.argc!=4 ){
594595
usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME");
595596
}
597
+ zTag = g.argv[3];
596598
if( fRaw ){
597599
blob_append_sql(&sql,
598600
"SELECT blob.uuid FROM tagxref, blob"
599601
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
600602
" AND tagxref.tagtype>0"
601603
" AND blob.rid=tagxref.rid",
602
- g.argv[3]
604
+ zTag
603605
);
604606
if( nFindLimit>0 ){
605607
blob_append_sql(&sql, " LIMIT %d", nFindLimit);
606608
}
607609
db_prepare(&q, "%s", blob_sql_text(&sql));
@@ -609,31 +611,27 @@
609611
while( db_step(&q)==SQLITE_ROW ){
610612
fossil_print("%s\n", db_column_text(&q, 0));
611613
}
612614
db_finalize(&q);
613615
}else{
614
- int tagid = db_int(0, "SELECT tagid FROM tag "
615
- "WHERE tagname='%s%q'",
616
- (zType && 'c'==zType[0])
617
- ? "sym-" : ""/*safe-for-%s*/,
618
- g.argv[3]);
619
- if( tagid>0 ){
620
- blob_append_sql(&sql,
621
- "%s"
622
- " AND event.type GLOB '%q'"
623
- " AND blob.rid IN ("
624
- " SELECT rid FROM tagxref"
625
- " WHERE tagtype>0 AND tagid=%d"
626
- ")"
627
- " ORDER BY event.mtime DESC /*sort*/",
628
- timeline_query_for_tty(), zType, tagid
629
- );
630
- db_prepare(&q, "%s", blob_sql_text(&sql));
631
- blob_reset(&sql);
632
- print_timeline(&q, nFindLimit, 79, 0, 0);
633
- db_finalize(&q);
634
- }
616
+ blob_append_sql(&sql,
617
+ "%s"
618
+ " AND event.type GLOB '%q'"
619
+ " AND blob.rid IN ("
620
+ " SELECT rid FROM tagxref"
621
+ " WHERE tagtype>0 AND tagid IN ("
622
+ " SELECT tagid FROM tag WHERE tagname IN "
623
+ " ('%q','sym-%q','wiki-%q','tkt-%q','event-%q')"
624
+ " )"
625
+ ")"
626
+ " ORDER BY event.mtime DESC /*sort*/",
627
+ timeline_query_for_tty(), zType, zTag, zTag, zTag, zTag, zTag
628
+ );
629
+ db_prepare(&q, "%s", blob_sql_text(&sql));
630
+ blob_reset(&sql);
631
+ print_timeline(&q, nFindLimit, 79, 0, 0);
632
+ db_finalize(&q);
635633
}
636634
}else
637635
638636
if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){
639637
Stmt q;
640638
--- src/tag.c
+++ src/tag.c
@@ -422,11 +422,11 @@
422 **
423 ** > fossil tag cancel ?--raw? TAGNAME ARTIFACT-ID
424 **
425 ** Remove the tag TAGNAME from the artifact referenced by
426 ** ARTIFACT-ID, and also remove the propagation of the tag to
427 ** any descendants. Use the the -n|--dry-run option to see
428 ** what would have happened. Certain tag name prefixes are
429 ** forbidden, as documented for the 'add' subcommand.
430 **
431 ** Options:
432 ** --date-override DATETIME Set date and time deleted
@@ -587,21 +587,23 @@
587 int fRaw = find_option("raw","",0)!=0;
588 const char *zFindLimit = find_option("limit","n",1);
589 const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000;
590 const char *zType = find_option("type","t",1);
591 Blob sql = empty_blob;
 
592 if( zType==0 || zType[0]==0 ) zType = "*";
593 if( g.argc!=4 ){
594 usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME");
595 }
 
596 if( fRaw ){
597 blob_append_sql(&sql,
598 "SELECT blob.uuid FROM tagxref, blob"
599 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
600 " AND tagxref.tagtype>0"
601 " AND blob.rid=tagxref.rid",
602 g.argv[3]
603 );
604 if( nFindLimit>0 ){
605 blob_append_sql(&sql, " LIMIT %d", nFindLimit);
606 }
607 db_prepare(&q, "%s", blob_sql_text(&sql));
@@ -609,31 +611,27 @@
609 while( db_step(&q)==SQLITE_ROW ){
610 fossil_print("%s\n", db_column_text(&q, 0));
611 }
612 db_finalize(&q);
613 }else{
614 int tagid = db_int(0, "SELECT tagid FROM tag "
615 "WHERE tagname='%s%q'",
616 (zType && 'c'==zType[0])
617 ? "sym-" : ""/*safe-for-%s*/,
618 g.argv[3]);
619 if( tagid>0 ){
620 blob_append_sql(&sql,
621 "%s"
622 " AND event.type GLOB '%q'"
623 " AND blob.rid IN ("
624 " SELECT rid FROM tagxref"
625 " WHERE tagtype>0 AND tagid=%d"
626 ")"
627 " ORDER BY event.mtime DESC /*sort*/",
628 timeline_query_for_tty(), zType, tagid
629 );
630 db_prepare(&q, "%s", blob_sql_text(&sql));
631 blob_reset(&sql);
632 print_timeline(&q, nFindLimit, 79, 0, 0);
633 db_finalize(&q);
634 }
635 }
636 }else
637
638 if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){
639 Stmt q;
640
--- src/tag.c
+++ src/tag.c
@@ -422,11 +422,11 @@
422 **
423 ** > fossil tag cancel ?--raw? TAGNAME ARTIFACT-ID
424 **
425 ** Remove the tag TAGNAME from the artifact referenced by
426 ** ARTIFACT-ID, and also remove the propagation of the tag to
427 ** any descendants. Use the -n|--dry-run option to see
428 ** what would have happened. Certain tag name prefixes are
429 ** forbidden, as documented for the 'add' subcommand.
430 **
431 ** Options:
432 ** --date-override DATETIME Set date and time deleted
@@ -587,21 +587,23 @@
587 int fRaw = find_option("raw","",0)!=0;
588 const char *zFindLimit = find_option("limit","n",1);
589 const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000;
590 const char *zType = find_option("type","t",1);
591 Blob sql = empty_blob;
592 const char *zTag;
593 if( zType==0 || zType[0]==0 ) zType = "*";
594 if( g.argc!=4 ){
595 usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME");
596 }
597 zTag = g.argv[3];
598 if( fRaw ){
599 blob_append_sql(&sql,
600 "SELECT blob.uuid FROM tagxref, blob"
601 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
602 " AND tagxref.tagtype>0"
603 " AND blob.rid=tagxref.rid",
604 zTag
605 );
606 if( nFindLimit>0 ){
607 blob_append_sql(&sql, " LIMIT %d", nFindLimit);
608 }
609 db_prepare(&q, "%s", blob_sql_text(&sql));
@@ -609,31 +611,27 @@
611 while( db_step(&q)==SQLITE_ROW ){
612 fossil_print("%s\n", db_column_text(&q, 0));
613 }
614 db_finalize(&q);
615 }else{
616 blob_append_sql(&sql,
617 "%s"
618 " AND event.type GLOB '%q'"
619 " AND blob.rid IN ("
620 " SELECT rid FROM tagxref"
621 " WHERE tagtype>0 AND tagid IN ("
622 " SELECT tagid FROM tag WHERE tagname IN "
623 " ('%q','sym-%q','wiki-%q','tkt-%q','event-%q')"
624 " )"
625 ")"
626 " ORDER BY event.mtime DESC /*sort*/",
627 timeline_query_for_tty(), zType, zTag, zTag, zTag, zTag, zTag
628 );
629 db_prepare(&q, "%s", blob_sql_text(&sql));
630 blob_reset(&sql);
631 print_timeline(&q, nFindLimit, 79, 0, 0);
632 db_finalize(&q);
 
 
 
 
633 }
634 }else
635
636 if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){
637 Stmt q;
638
+3 -3
--- src/tar.c
+++ src/tar.c
@@ -809,11 +809,11 @@
809809
** /tarball/fossil-20251018193920-d6c9aee97df.tar.gz
810810
**
811811
** In other words, filename itself contains sufficient information to
812812
** uniquely identify the check-in, including a timestamp of the form
813813
** YYYYMMDDHHMMSS and a prefix of the check-in hash. The timestamp
814
-** and hash must immediately preceed the first "." in the name.
814
+** and hash must immediately precede the first "." in the name.
815815
*/
816816
char *tar_uuid_from_name(char **pzName){
817817
char *zName = *pzName; /* Original input */
818818
int n1 = 0; /* Bytes in first prefix (tag-name) */
819819
int n2 = 0; /* Bytes in second prefix (check-in-name) */
@@ -915,11 +915,11 @@
915915
** part of the name= value after the / is the download
916916
** filename. If no check-in is specified by either
917917
** name= or r=, then the name of the main branch
918918
** (usually "trunk") is used.
919919
**
920
-** in=PATTERN Only include files that match the comma-separate
920
+** in=PATTERN Only include files that match the comma-separated
921921
** list of GLOB patterns in PATTERN, as with ex=
922922
**
923923
** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
924924
** comma-separated list of GLOB patterns, where each
925925
** pattern can optionally be quoted using ".." or '..'.
@@ -1167,11 +1167,11 @@
11671167
&azItem, &anItem, &nItem);
11681168
bPlainTextCom = db_get_boolean("timeline-plaintext",0);
11691169
for(i=0; i<nItem-3; i+=4){
11701170
int cnt; /* The number of instances of zLabel to use */
11711171
char *zLabel; /* The label to match */
1172
- double rStart; /* Starting time, julian day number */
1172
+ double rStart; /* Starting time, Julian day number */
11731173
char *zComment = 0; /* Comment to apply */
11741174
if( anItem[i]==1 && azItem[i][0]=='*' ){
11751175
cnt = -1;
11761176
}else if( anItem[i]<1 ){
11771177
cnt = 0;
11781178
--- src/tar.c
+++ src/tar.c
@@ -809,11 +809,11 @@
809 ** /tarball/fossil-20251018193920-d6c9aee97df.tar.gz
810 **
811 ** In other words, filename itself contains sufficient information to
812 ** uniquely identify the check-in, including a timestamp of the form
813 ** YYYYMMDDHHMMSS and a prefix of the check-in hash. The timestamp
814 ** and hash must immediately preceed the first "." in the name.
815 */
816 char *tar_uuid_from_name(char **pzName){
817 char *zName = *pzName; /* Original input */
818 int n1 = 0; /* Bytes in first prefix (tag-name) */
819 int n2 = 0; /* Bytes in second prefix (check-in-name) */
@@ -915,11 +915,11 @@
915 ** part of the name= value after the / is the download
916 ** filename. If no check-in is specified by either
917 ** name= or r=, then the name of the main branch
918 ** (usually "trunk") is used.
919 **
920 ** in=PATTERN Only include files that match the comma-separate
921 ** list of GLOB patterns in PATTERN, as with ex=
922 **
923 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
924 ** comma-separated list of GLOB patterns, where each
925 ** pattern can optionally be quoted using ".." or '..'.
@@ -1167,11 +1167,11 @@
1167 &azItem, &anItem, &nItem);
1168 bPlainTextCom = db_get_boolean("timeline-plaintext",0);
1169 for(i=0; i<nItem-3; i+=4){
1170 int cnt; /* The number of instances of zLabel to use */
1171 char *zLabel; /* The label to match */
1172 double rStart; /* Starting time, julian day number */
1173 char *zComment = 0; /* Comment to apply */
1174 if( anItem[i]==1 && azItem[i][0]=='*' ){
1175 cnt = -1;
1176 }else if( anItem[i]<1 ){
1177 cnt = 0;
1178
--- src/tar.c
+++ src/tar.c
@@ -809,11 +809,11 @@
809 ** /tarball/fossil-20251018193920-d6c9aee97df.tar.gz
810 **
811 ** In other words, filename itself contains sufficient information to
812 ** uniquely identify the check-in, including a timestamp of the form
813 ** YYYYMMDDHHMMSS and a prefix of the check-in hash. The timestamp
814 ** and hash must immediately precede the first "." in the name.
815 */
816 char *tar_uuid_from_name(char **pzName){
817 char *zName = *pzName; /* Original input */
818 int n1 = 0; /* Bytes in first prefix (tag-name) */
819 int n2 = 0; /* Bytes in second prefix (check-in-name) */
@@ -915,11 +915,11 @@
915 ** part of the name= value after the / is the download
916 ** filename. If no check-in is specified by either
917 ** name= or r=, then the name of the main branch
918 ** (usually "trunk") is used.
919 **
920 ** in=PATTERN Only include files that match the comma-separated
921 ** list of GLOB patterns in PATTERN, as with ex=
922 **
923 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
924 ** comma-separated list of GLOB patterns, where each
925 ** pattern can optionally be quoted using ".." or '..'.
@@ -1167,11 +1167,11 @@
1167 &azItem, &anItem, &nItem);
1168 bPlainTextCom = db_get_boolean("timeline-plaintext",0);
1169 for(i=0; i<nItem-3; i+=4){
1170 int cnt; /* The number of instances of zLabel to use */
1171 char *zLabel; /* The label to match */
1172 double rStart; /* Starting time, Julian day number */
1173 char *zComment = 0; /* Comment to apply */
1174 if( anItem[i]==1 && azItem[i][0]=='*' ){
1175 cnt = -1;
1176 }else if( anItem[i]<1 ){
1177 cnt = 0;
1178
+1 -1
--- src/terminal.c
+++ src/terminal.c
@@ -53,11 +53,11 @@
5353
#endif
5454
5555
5656
/* Get the current terminal size by calling a system service.
5757
**
58
-** Return 1 on success. This sets the size parameters to the values retured by
58
+** Return 1 on success. This sets the size parameters to the values returned by
5959
** the system call, when such is supported; set the size to zero otherwise.
6060
** Return 0 on the system service call failure.
6161
**
6262
** Under Linux/bash the size info is also available from env $LINES, $COLUMNS.
6363
** Or it can be queried using tput `echo -e "lines\ncols"|tput -S`.
6464
--- src/terminal.c
+++ src/terminal.c
@@ -53,11 +53,11 @@
53 #endif
54
55
56 /* Get the current terminal size by calling a system service.
57 **
58 ** Return 1 on success. This sets the size parameters to the values retured by
59 ** the system call, when such is supported; set the size to zero otherwise.
60 ** Return 0 on the system service call failure.
61 **
62 ** Under Linux/bash the size info is also available from env $LINES, $COLUMNS.
63 ** Or it can be queried using tput `echo -e "lines\ncols"|tput -S`.
64
--- src/terminal.c
+++ src/terminal.c
@@ -53,11 +53,11 @@
53 #endif
54
55
56 /* Get the current terminal size by calling a system service.
57 **
58 ** Return 1 on success. This sets the size parameters to the values returned by
59 ** the system call, when such is supported; set the size to zero otherwise.
60 ** Return 0 on the system service call failure.
61 **
62 ** Under Linux/bash the size info is also available from env $LINES, $COLUMNS.
63 ** Or it can be queried using tput `echo -e "lines\ncols"|tput -S`.
64
+1 -1
--- src/terminal.c
+++ src/terminal.c
@@ -53,11 +53,11 @@
5353
#endif
5454
5555
5656
/* Get the current terminal size by calling a system service.
5757
**
58
-** Return 1 on success. This sets the size parameters to the values retured by
58
+** Return 1 on success. This sets the size parameters to the values returned by
5959
** the system call, when such is supported; set the size to zero otherwise.
6060
** Return 0 on the system service call failure.
6161
**
6262
** Under Linux/bash the size info is also available from env $LINES, $COLUMNS.
6363
** Or it can be queried using tput `echo -e "lines\ncols"|tput -S`.
6464
--- src/terminal.c
+++ src/terminal.c
@@ -53,11 +53,11 @@
53 #endif
54
55
56 /* Get the current terminal size by calling a system service.
57 **
58 ** Return 1 on success. This sets the size parameters to the values retured by
59 ** the system call, when such is supported; set the size to zero otherwise.
60 ** Return 0 on the system service call failure.
61 **
62 ** Under Linux/bash the size info is also available from env $LINES, $COLUMNS.
63 ** Or it can be queried using tput `echo -e "lines\ncols"|tput -S`.
64
--- src/terminal.c
+++ src/terminal.c
@@ -53,11 +53,11 @@
53 #endif
54
55
56 /* Get the current terminal size by calling a system service.
57 **
58 ** Return 1 on success. This sets the size parameters to the values returned by
59 ** the system call, when such is supported; set the size to zero otherwise.
60 ** Return 0 on the system service call failure.
61 **
62 ** Under Linux/bash the size info is also available from env $LINES, $COLUMNS.
63 ** Or it can be queried using tput `echo -e "lines\ncols"|tput -S`.
64
+1 -1
--- src/th.c
+++ src/th.c
@@ -1029,11 +1029,11 @@
10291029
** * If iFrame is negative, then the nth frame up the stack, where
10301030
** n is the absolute value of iFrame. A value of -1 means the
10311031
** calling procedure.
10321032
**
10331033
** * If iFrame is +ve, then the nth frame from the bottom of the
1034
-** stack. An iFrame value of 1 means the toplevel (global) frame.
1034
+** stack. An iFrame value of 1 means the top level (global) frame.
10351035
*/
10361036
static Th_Frame *getFrame(Th_Interp *interp, int iFrame){
10371037
Th_Frame *p = interp->pFrame;
10381038
int i;
10391039
if( iFrame>0 ){
10401040
--- src/th.c
+++ src/th.c
@@ -1029,11 +1029,11 @@
1029 ** * If iFrame is negative, then the nth frame up the stack, where
1030 ** n is the absolute value of iFrame. A value of -1 means the
1031 ** calling procedure.
1032 **
1033 ** * If iFrame is +ve, then the nth frame from the bottom of the
1034 ** stack. An iFrame value of 1 means the toplevel (global) frame.
1035 */
1036 static Th_Frame *getFrame(Th_Interp *interp, int iFrame){
1037 Th_Frame *p = interp->pFrame;
1038 int i;
1039 if( iFrame>0 ){
1040
--- src/th.c
+++ src/th.c
@@ -1029,11 +1029,11 @@
1029 ** * If iFrame is negative, then the nth frame up the stack, where
1030 ** n is the absolute value of iFrame. A value of -1 means the
1031 ** calling procedure.
1032 **
1033 ** * If iFrame is +ve, then the nth frame from the bottom of the
1034 ** stack. An iFrame value of 1 means the top level (global) frame.
1035 */
1036 static Th_Frame *getFrame(Th_Interp *interp, int iFrame){
1037 Th_Frame *p = interp->pFrame;
1038 int i;
1039 if( iFrame>0 ){
1040
+5 -5
--- src/th_main.c
+++ src/th_main.c
@@ -74,11 +74,11 @@
7474
*/
7575
#if defined(TH_MEMDEBUG)
7676
/*
7777
** Global variable counting the number of outstanding calls to malloc()
7878
** made by the th1 implementation. This is used to catch memory leaks
79
-** in the interpreter. Obviously, it also means th1 is not threadsafe.
79
+** in the interpreter. Obviously, it also means th1 is not thread-safe.
8080
*/
8181
static int nOutstandingMalloc = 0;
8282
8383
/*
8484
** Implementations of malloc() and free() to pass to the interpreter.
@@ -151,13 +151,13 @@
151151
fossil_print("\n------------------- END TRACE LOG -------------------\n");
152152
}
153153
}
154154
155155
/*
156
-** - adopted from ls_cmd_rev in checkin.c
157
-** - adopted commands/error handling for usage within th1
158
-** - interface adopted to allow result creation as TH1 List
156
+** - adapted from ls_cmd_rev in checkin.c
157
+** - adapted commands/error handling for usage within th1
158
+** - interface adapted to allow result creation as TH1 List
159159
**
160160
** Takes a check-in identifier in zRev and an optiona glob pattern in zGLOB
161161
** as parameter returns a TH list in pzList,pnList with filenames matching
162162
** glob pattern with the checking
163163
*/
@@ -1065,11 +1065,11 @@
10651065
10661066
10671067
/*
10681068
** TH1 command: anycap STRING
10691069
**
1070
-** Return true if the current user user
1070
+** Return true if the current user
10711071
** has any one of the capabilities listed in STRING.
10721072
*/
10731073
static int anycapCmd(
10741074
Th_Interp *interp,
10751075
void *p,
10761076
--- src/th_main.c
+++ src/th_main.c
@@ -74,11 +74,11 @@
74 */
75 #if defined(TH_MEMDEBUG)
76 /*
77 ** Global variable counting the number of outstanding calls to malloc()
78 ** made by the th1 implementation. This is used to catch memory leaks
79 ** in the interpreter. Obviously, it also means th1 is not threadsafe.
80 */
81 static int nOutstandingMalloc = 0;
82
83 /*
84 ** Implementations of malloc() and free() to pass to the interpreter.
@@ -151,13 +151,13 @@
151 fossil_print("\n------------------- END TRACE LOG -------------------\n");
152 }
153 }
154
155 /*
156 ** - adopted from ls_cmd_rev in checkin.c
157 ** - adopted commands/error handling for usage within th1
158 ** - interface adopted to allow result creation as TH1 List
159 **
160 ** Takes a check-in identifier in zRev and an optiona glob pattern in zGLOB
161 ** as parameter returns a TH list in pzList,pnList with filenames matching
162 ** glob pattern with the checking
163 */
@@ -1065,11 +1065,11 @@
1065
1066
1067 /*
1068 ** TH1 command: anycap STRING
1069 **
1070 ** Return true if the current user user
1071 ** has any one of the capabilities listed in STRING.
1072 */
1073 static int anycapCmd(
1074 Th_Interp *interp,
1075 void *p,
1076
--- src/th_main.c
+++ src/th_main.c
@@ -74,11 +74,11 @@
74 */
75 #if defined(TH_MEMDEBUG)
76 /*
77 ** Global variable counting the number of outstanding calls to malloc()
78 ** made by the th1 implementation. This is used to catch memory leaks
79 ** in the interpreter. Obviously, it also means th1 is not thread-safe.
80 */
81 static int nOutstandingMalloc = 0;
82
83 /*
84 ** Implementations of malloc() and free() to pass to the interpreter.
@@ -151,13 +151,13 @@
151 fossil_print("\n------------------- END TRACE LOG -------------------\n");
152 }
153 }
154
155 /*
156 ** - adapted from ls_cmd_rev in checkin.c
157 ** - adapted commands/error handling for usage within th1
158 ** - interface adapted to allow result creation as TH1 List
159 **
160 ** Takes a check-in identifier in zRev and an optiona glob pattern in zGLOB
161 ** as parameter returns a TH list in pzList,pnList with filenames matching
162 ** glob pattern with the checking
163 */
@@ -1065,11 +1065,11 @@
1065
1066
1067 /*
1068 ** TH1 command: anycap STRING
1069 **
1070 ** Return true if the current user
1071 ** has any one of the capabilities listed in STRING.
1072 */
1073 static int anycapCmd(
1074 Th_Interp *interp,
1075 void *p,
1076
+12 -12
--- src/timeline.c
+++ src/timeline.c
@@ -22,11 +22,11 @@
2222
#include <string.h>
2323
#include <time.h>
2424
#include "timeline.h"
2525
2626
/*
27
-** The value of one second in julianday notation
27
+** The value of one second in Julian day notation
2828
*/
2929
#define ONE_SECOND (1.0/86400.0)
3030
3131
/*
3232
** timeline mode options
@@ -1045,11 +1045,11 @@
10451045
** Mnemonic: "Same Branch".
10461046
** f: 0x01: a leaf node, 0x02: a closed leaf node.
10471047
** au: An array of integers that define thick-line risers for branches.
10481048
** The integers are in pairs. For each pair, the first integer is
10491049
** is the rail on which the riser should run and the second integer
1050
- ** is the id of the node upto which the riser should run. If there
1050
+ ** is the id of the node up to which the riser should run. If there
10511051
** are no risers, this array does not exist.
10521052
** mi: "merge-in". An array of integer rail positions from which
10531053
** merge arrows should be drawn into this node. If the value is
10541054
** negative, then the rail position is -1-mi[] and a thin merge-arrow
10551055
** descender is drawn to the bottom of the screen. This array is
@@ -1483,11 +1483,11 @@
14831483
14841484
/*
14851485
** Find the first check-in encountered with a particular tag
14861486
** when moving either forwards are backwards in time from a
14871487
** particular starting point (iFrom). Return the rid of that
1488
-** first check-in. If there are no check-ins in the descendent
1488
+** first check-in. If there are no check-ins in the descendant
14891489
** or ancestor set of check-in iFrom that match the tag, then
14901490
** return 0.
14911491
*/
14921492
static int timeline_endpoint(
14931493
int iFrom, /* Starting point */
@@ -1623,12 +1623,12 @@
16231623
** COMMAND: test-endpoint
16241624
**
16251625
** Usage: fossil test-endpoint BASE TAG ?OPTIONS?
16261626
**
16271627
** Show the first check-in with TAG that is a descendant or ancestor
1628
-** of BASE. The first descendant checkin is shown by default. Use
1629
-** the --backto to see the first ancestor checkin.
1628
+** of BASE. The first descendant check-in is shown by default. Use
1629
+** the --backto to see the first ancestor check-in.
16301630
**
16311631
** Options:
16321632
**
16331633
** --backto Show ancestor. Others defaults to descendants.
16341634
*/
@@ -1681,14 +1681,14 @@
16811681
** d2=CKIN2 ... Use CKIN2 if CHECKIN is not found
16821682
** ft=DESCENDANT ... going forward to DESCENDANT
16831683
** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
16841684
** dp2=CKIN2 Same as 'd2=CKIN2&p2=CKIN2'
16851685
** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
1686
-** bt=CHECKIN "Back To". Show ancenstors going back to CHECKIN
1686
+** bt=CHECKIN "Back To". Show ancestors going back to CHECKIN
16871687
** p=CX ... from CX back to time of CHECKIN
16881688
** from=CX ... path from CX back to CHECKIN
1689
-** ft=CHECKIN "Forward To": Show descendents forward to CHECKIN
1689
+** ft=CHECKIN "Forward To": Show descendants forward to CHECKIN
16901690
** d=CX ... from CX up to the time of CHECKIN
16911691
** from=CX ... path from CX up to CHECKIN
16921692
** t=TAG Show only check-ins with the given TAG
16931693
** r=TAG Same as 't=TAG&rel'. Mnemonic: "Related"
16941694
** tl=TAGLIST Same as 't=TAGLIST&ms=brlist'. Mnemonic: "Tag List"
@@ -1726,11 +1726,11 @@
17261726
** rel ... also show related checkins
17271727
** uf=FILE_HASH Show only check-ins that contain the given file version
17281728
** All qualifying check-ins are shown unless there is
17291729
** also an n= or n1= query parameter.
17301730
** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1731
-** name matches one of the comma-separate GLOBLIST
1731
+** name matches one of the comma-separated GLOBLIST
17321732
** brbg Background color determined by branch name
17331733
** ubg Background color determined by user
17341734
** deltabg Background color red for delta manifests or green
17351735
** for baseline manifests
17361736
** namechng Show only check-ins that have filename changes
@@ -1800,11 +1800,11 @@
18001800
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
18011801
int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
18021802
int forkOnly = PB("forks"); /* Show only forks and their children */
18031803
int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */
18041804
const char *zBisect = P("bid"); /* Bisect description */
1805
- int cpOnly = PB("cherrypicks"); /* Show all cherrypick checkins */
1805
+ int cpOnly = PB("cherrypicks"); /* Show all cherrypick check-ins */
18061806
int tmFlags = 0; /* Timeline flags */
18071807
const char *zThisTag = 0; /* Suppress links to this tag */
18081808
const char *zThisUser = 0; /* Suppress links to this user */
18091809
HQuery url; /* URL for various branch links */
18101810
int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
@@ -2003,11 +2003,11 @@
20032003
/* Finish preliminary processing of tag match queries. */
20042004
matchStyle = match_style(zMatchStyle, MS_EXACT);
20052005
if( zTagName ){
20062006
zType = "ci";
20072007
if( matchStyle==MS_EXACT ){
2008
- /* For exact maching, inhibit links to the selected tag. */
2008
+ /* For exact matching, inhibit links to the selected tag. */
20092009
zThisTag = zTagName;
20102010
Th_StoreUnsafe("current_checkin", zTagName);
20112011
}
20122012
20132013
/* Display a checkbox to enable/disable display of related check-ins. */
@@ -3670,11 +3670,11 @@
36703670
&& fossil_isdigit(z[0])
36713671
&& fossil_isdigit(z[5]);
36723672
}
36733673
36743674
/*
3675
-** Return true if the input string can be converted to a julianday.
3675
+** Return true if the input string can be converted to a Julian day.
36763676
*/
36773677
static int fossil_is_julianday(const char *zDate){
36783678
return db_int(0, "SELECT EXISTS (SELECT julianday(%Q) AS jd"
36793679
" WHERE jd IS NOT NULL)", zDate);
36803680
}
@@ -3728,11 +3728,11 @@
37283728
** -n|--limit N If N is positive, output the first N entries. If
37293729
** N is negative, output the first -N lines. If N is
37303730
** zero, no limit. Default is -20 meaning 20 lines.
37313731
** --offset P Skip P changes
37323732
** -p|--path PATH Output items affecting PATH only.
3733
-** PATH can be a file or a sub directory.
3733
+** PATH can be a file or a subdirectory.
37343734
** -r|--reverse Show items in chronological order.
37353735
** -R REPO_FILE Specifies the repository db to use. Default is
37363736
** the current check-out's repository.
37373737
** --sql Show the SQL used to generate the timeline
37383738
** -t|--type TYPE Output items from the given types only, such as:
37393739
--- src/timeline.c
+++ src/timeline.c
@@ -22,11 +22,11 @@
22 #include <string.h>
23 #include <time.h>
24 #include "timeline.h"
25
26 /*
27 ** The value of one second in julianday notation
28 */
29 #define ONE_SECOND (1.0/86400.0)
30
31 /*
32 ** timeline mode options
@@ -1045,11 +1045,11 @@
1045 ** Mnemonic: "Same Branch".
1046 ** f: 0x01: a leaf node, 0x02: a closed leaf node.
1047 ** au: An array of integers that define thick-line risers for branches.
1048 ** The integers are in pairs. For each pair, the first integer is
1049 ** is the rail on which the riser should run and the second integer
1050 ** is the id of the node upto which the riser should run. If there
1051 ** are no risers, this array does not exist.
1052 ** mi: "merge-in". An array of integer rail positions from which
1053 ** merge arrows should be drawn into this node. If the value is
1054 ** negative, then the rail position is -1-mi[] and a thin merge-arrow
1055 ** descender is drawn to the bottom of the screen. This array is
@@ -1483,11 +1483,11 @@
1483
1484 /*
1485 ** Find the first check-in encountered with a particular tag
1486 ** when moving either forwards are backwards in time from a
1487 ** particular starting point (iFrom). Return the rid of that
1488 ** first check-in. If there are no check-ins in the descendent
1489 ** or ancestor set of check-in iFrom that match the tag, then
1490 ** return 0.
1491 */
1492 static int timeline_endpoint(
1493 int iFrom, /* Starting point */
@@ -1623,12 +1623,12 @@
1623 ** COMMAND: test-endpoint
1624 **
1625 ** Usage: fossil test-endpoint BASE TAG ?OPTIONS?
1626 **
1627 ** Show the first check-in with TAG that is a descendant or ancestor
1628 ** of BASE. The first descendant checkin is shown by default. Use
1629 ** the --backto to see the first ancestor checkin.
1630 **
1631 ** Options:
1632 **
1633 ** --backto Show ancestor. Others defaults to descendants.
1634 */
@@ -1681,14 +1681,14 @@
1681 ** d2=CKIN2 ... Use CKIN2 if CHECKIN is not found
1682 ** ft=DESCENDANT ... going forward to DESCENDANT
1683 ** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
1684 ** dp2=CKIN2 Same as 'd2=CKIN2&p2=CKIN2'
1685 ** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
1686 ** bt=CHECKIN "Back To". Show ancenstors going back to CHECKIN
1687 ** p=CX ... from CX back to time of CHECKIN
1688 ** from=CX ... path from CX back to CHECKIN
1689 ** ft=CHECKIN "Forward To": Show descendents forward to CHECKIN
1690 ** d=CX ... from CX up to the time of CHECKIN
1691 ** from=CX ... path from CX up to CHECKIN
1692 ** t=TAG Show only check-ins with the given TAG
1693 ** r=TAG Same as 't=TAG&rel'. Mnemonic: "Related"
1694 ** tl=TAGLIST Same as 't=TAGLIST&ms=brlist'. Mnemonic: "Tag List"
@@ -1726,11 +1726,11 @@
1726 ** rel ... also show related checkins
1727 ** uf=FILE_HASH Show only check-ins that contain the given file version
1728 ** All qualifying check-ins are shown unless there is
1729 ** also an n= or n1= query parameter.
1730 ** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1731 ** name matches one of the comma-separate GLOBLIST
1732 ** brbg Background color determined by branch name
1733 ** ubg Background color determined by user
1734 ** deltabg Background color red for delta manifests or green
1735 ** for baseline manifests
1736 ** namechng Show only check-ins that have filename changes
@@ -1800,11 +1800,11 @@
1800 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1801 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1802 int forkOnly = PB("forks"); /* Show only forks and their children */
1803 int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */
1804 const char *zBisect = P("bid"); /* Bisect description */
1805 int cpOnly = PB("cherrypicks"); /* Show all cherrypick checkins */
1806 int tmFlags = 0; /* Timeline flags */
1807 const char *zThisTag = 0; /* Suppress links to this tag */
1808 const char *zThisUser = 0; /* Suppress links to this user */
1809 HQuery url; /* URL for various branch links */
1810 int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
@@ -2003,11 +2003,11 @@
2003 /* Finish preliminary processing of tag match queries. */
2004 matchStyle = match_style(zMatchStyle, MS_EXACT);
2005 if( zTagName ){
2006 zType = "ci";
2007 if( matchStyle==MS_EXACT ){
2008 /* For exact maching, inhibit links to the selected tag. */
2009 zThisTag = zTagName;
2010 Th_StoreUnsafe("current_checkin", zTagName);
2011 }
2012
2013 /* Display a checkbox to enable/disable display of related check-ins. */
@@ -3670,11 +3670,11 @@
3670 && fossil_isdigit(z[0])
3671 && fossil_isdigit(z[5]);
3672 }
3673
3674 /*
3675 ** Return true if the input string can be converted to a julianday.
3676 */
3677 static int fossil_is_julianday(const char *zDate){
3678 return db_int(0, "SELECT EXISTS (SELECT julianday(%Q) AS jd"
3679 " WHERE jd IS NOT NULL)", zDate);
3680 }
@@ -3728,11 +3728,11 @@
3728 ** -n|--limit N If N is positive, output the first N entries. If
3729 ** N is negative, output the first -N lines. If N is
3730 ** zero, no limit. Default is -20 meaning 20 lines.
3731 ** --offset P Skip P changes
3732 ** -p|--path PATH Output items affecting PATH only.
3733 ** PATH can be a file or a sub directory.
3734 ** -r|--reverse Show items in chronological order.
3735 ** -R REPO_FILE Specifies the repository db to use. Default is
3736 ** the current check-out's repository.
3737 ** --sql Show the SQL used to generate the timeline
3738 ** -t|--type TYPE Output items from the given types only, such as:
3739
--- src/timeline.c
+++ src/timeline.c
@@ -22,11 +22,11 @@
22 #include <string.h>
23 #include <time.h>
24 #include "timeline.h"
25
26 /*
27 ** The value of one second in Julian day notation
28 */
29 #define ONE_SECOND (1.0/86400.0)
30
31 /*
32 ** timeline mode options
@@ -1045,11 +1045,11 @@
1045 ** Mnemonic: "Same Branch".
1046 ** f: 0x01: a leaf node, 0x02: a closed leaf node.
1047 ** au: An array of integers that define thick-line risers for branches.
1048 ** The integers are in pairs. For each pair, the first integer is
1049 ** is the rail on which the riser should run and the second integer
1050 ** is the id of the node up to which the riser should run. If there
1051 ** are no risers, this array does not exist.
1052 ** mi: "merge-in". An array of integer rail positions from which
1053 ** merge arrows should be drawn into this node. If the value is
1054 ** negative, then the rail position is -1-mi[] and a thin merge-arrow
1055 ** descender is drawn to the bottom of the screen. This array is
@@ -1483,11 +1483,11 @@
1483
1484 /*
1485 ** Find the first check-in encountered with a particular tag
1486 ** when moving either forwards are backwards in time from a
1487 ** particular starting point (iFrom). Return the rid of that
1488 ** first check-in. If there are no check-ins in the descendant
1489 ** or ancestor set of check-in iFrom that match the tag, then
1490 ** return 0.
1491 */
1492 static int timeline_endpoint(
1493 int iFrom, /* Starting point */
@@ -1623,12 +1623,12 @@
1623 ** COMMAND: test-endpoint
1624 **
1625 ** Usage: fossil test-endpoint BASE TAG ?OPTIONS?
1626 **
1627 ** Show the first check-in with TAG that is a descendant or ancestor
1628 ** of BASE. The first descendant check-in is shown by default. Use
1629 ** the --backto to see the first ancestor check-in.
1630 **
1631 ** Options:
1632 **
1633 ** --backto Show ancestor. Others defaults to descendants.
1634 */
@@ -1681,14 +1681,14 @@
1681 ** d2=CKIN2 ... Use CKIN2 if CHECKIN is not found
1682 ** ft=DESCENDANT ... going forward to DESCENDANT
1683 ** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
1684 ** dp2=CKIN2 Same as 'd2=CKIN2&p2=CKIN2'
1685 ** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
1686 ** bt=CHECKIN "Back To". Show ancestors going back to CHECKIN
1687 ** p=CX ... from CX back to time of CHECKIN
1688 ** from=CX ... path from CX back to CHECKIN
1689 ** ft=CHECKIN "Forward To": Show descendants forward to CHECKIN
1690 ** d=CX ... from CX up to the time of CHECKIN
1691 ** from=CX ... path from CX up to CHECKIN
1692 ** t=TAG Show only check-ins with the given TAG
1693 ** r=TAG Same as 't=TAG&rel'. Mnemonic: "Related"
1694 ** tl=TAGLIST Same as 't=TAGLIST&ms=brlist'. Mnemonic: "Tag List"
@@ -1726,11 +1726,11 @@
1726 ** rel ... also show related checkins
1727 ** uf=FILE_HASH Show only check-ins that contain the given file version
1728 ** All qualifying check-ins are shown unless there is
1729 ** also an n= or n1= query parameter.
1730 ** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1731 ** name matches one of the comma-separated GLOBLIST
1732 ** brbg Background color determined by branch name
1733 ** ubg Background color determined by user
1734 ** deltabg Background color red for delta manifests or green
1735 ** for baseline manifests
1736 ** namechng Show only check-ins that have filename changes
@@ -1800,11 +1800,11 @@
1800 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1801 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1802 int forkOnly = PB("forks"); /* Show only forks and their children */
1803 int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */
1804 const char *zBisect = P("bid"); /* Bisect description */
1805 int cpOnly = PB("cherrypicks"); /* Show all cherrypick check-ins */
1806 int tmFlags = 0; /* Timeline flags */
1807 const char *zThisTag = 0; /* Suppress links to this tag */
1808 const char *zThisUser = 0; /* Suppress links to this user */
1809 HQuery url; /* URL for various branch links */
1810 int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
@@ -2003,11 +2003,11 @@
2003 /* Finish preliminary processing of tag match queries. */
2004 matchStyle = match_style(zMatchStyle, MS_EXACT);
2005 if( zTagName ){
2006 zType = "ci";
2007 if( matchStyle==MS_EXACT ){
2008 /* For exact matching, inhibit links to the selected tag. */
2009 zThisTag = zTagName;
2010 Th_StoreUnsafe("current_checkin", zTagName);
2011 }
2012
2013 /* Display a checkbox to enable/disable display of related check-ins. */
@@ -3670,11 +3670,11 @@
3670 && fossil_isdigit(z[0])
3671 && fossil_isdigit(z[5]);
3672 }
3673
3674 /*
3675 ** Return true if the input string can be converted to a Julian day.
3676 */
3677 static int fossil_is_julianday(const char *zDate){
3678 return db_int(0, "SELECT EXISTS (SELECT julianday(%Q) AS jd"
3679 " WHERE jd IS NOT NULL)", zDate);
3680 }
@@ -3728,11 +3728,11 @@
3728 ** -n|--limit N If N is positive, output the first N entries. If
3729 ** N is negative, output the first -N lines. If N is
3730 ** zero, no limit. Default is -20 meaning 20 lines.
3731 ** --offset P Skip P changes
3732 ** -p|--path PATH Output items affecting PATH only.
3733 ** PATH can be a file or a subdirectory.
3734 ** -r|--reverse Show items in chronological order.
3735 ** -R REPO_FILE Specifies the repository db to use. Default is
3736 ** the current check-out's repository.
3737 ** --sql Show the SQL used to generate the timeline
3738 ** -t|--type TYPE Output items from the given types only, such as:
3739
+2 -2
--- src/tkt.c
+++ src/tkt.c
@@ -1528,11 +1528,11 @@
15281528
** Run the ticket report, identified by the report format title
15291529
** used in the GUI. The data is written as flat file on stdout,
15301530
** using TAB as separator. The separator can be changed using
15311531
** the -l or --limit option.
15321532
**
1533
-** If TICKETFILTER is given on the commandline, the query is
1533
+** If TICKETFILTER is given on the command line, the query is
15341534
** limited with a new WHERE-condition.
15351535
** example: Report lists a column # with the uuid
15361536
** TICKETFILTER may be [#]='uuuuuuuuu'
15371537
** example: Report only lists rows with status not open
15381538
** TICKETFILTER: status != 'open'
@@ -1567,11 +1567,11 @@
15671567
** names include: type, status, subsystem, priority, severity, foundin,
15681568
** resolution, title, and comment, but other field names can be added
15691569
** or substituted in customized installations.
15701570
**
15711571
** If you use +FIELD, the VALUE is appended to the field FIELD. You
1572
-** can use more than one field/value pair on the commandline. Using
1572
+** can use more than one field/value pair on the command line. Using
15731573
** --quote enables the special character decoding as in "ticket
15741574
** show", which allows setting multiline text or text with special
15751575
** characters.
15761576
**
15771577
** > fossil ticket add FIELD VALUE ?FIELD VALUE .. ? ?-q|--quote?
15781578
--- src/tkt.c
+++ src/tkt.c
@@ -1528,11 +1528,11 @@
1528 ** Run the ticket report, identified by the report format title
1529 ** used in the GUI. The data is written as flat file on stdout,
1530 ** using TAB as separator. The separator can be changed using
1531 ** the -l or --limit option.
1532 **
1533 ** If TICKETFILTER is given on the commandline, the query is
1534 ** limited with a new WHERE-condition.
1535 ** example: Report lists a column # with the uuid
1536 ** TICKETFILTER may be [#]='uuuuuuuuu'
1537 ** example: Report only lists rows with status not open
1538 ** TICKETFILTER: status != 'open'
@@ -1567,11 +1567,11 @@
1567 ** names include: type, status, subsystem, priority, severity, foundin,
1568 ** resolution, title, and comment, but other field names can be added
1569 ** or substituted in customized installations.
1570 **
1571 ** If you use +FIELD, the VALUE is appended to the field FIELD. You
1572 ** can use more than one field/value pair on the commandline. Using
1573 ** --quote enables the special character decoding as in "ticket
1574 ** show", which allows setting multiline text or text with special
1575 ** characters.
1576 **
1577 ** > fossil ticket add FIELD VALUE ?FIELD VALUE .. ? ?-q|--quote?
1578
--- src/tkt.c
+++ src/tkt.c
@@ -1528,11 +1528,11 @@
1528 ** Run the ticket report, identified by the report format title
1529 ** used in the GUI. The data is written as flat file on stdout,
1530 ** using TAB as separator. The separator can be changed using
1531 ** the -l or --limit option.
1532 **
1533 ** If TICKETFILTER is given on the command line, the query is
1534 ** limited with a new WHERE-condition.
1535 ** example: Report lists a column # with the uuid
1536 ** TICKETFILTER may be [#]='uuuuuuuuu'
1537 ** example: Report only lists rows with status not open
1538 ** TICKETFILTER: status != 'open'
@@ -1567,11 +1567,11 @@
1567 ** names include: type, status, subsystem, priority, severity, foundin,
1568 ** resolution, title, and comment, but other field names can be added
1569 ** or substituted in customized installations.
1570 **
1571 ** If you use +FIELD, the VALUE is appended to the field FIELD. You
1572 ** can use more than one field/value pair on the command line. Using
1573 ** --quote enables the special character decoding as in "ticket
1574 ** show", which allows setting multiline text or text with special
1575 ** characters.
1576 **
1577 ** > fossil ticket add FIELD VALUE ?FIELD VALUE .. ? ?-q|--quote?
1578
+1 -1
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -1018,11 +1018,11 @@
10181018
}
10191019
10201020
/*
10211021
** WEBPAGE: tktsetup_timeline
10221022
**
1023
-** Administrative page used ot configure how tickets are
1023
+** Administrative page used to configure how tickets are
10241024
** rendered on timeline views.
10251025
*/
10261026
void tktsetup_timeline_page(void){
10271027
login_check_credentials();
10281028
if( !g.perm.Setup ){
10291029
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -1018,11 +1018,11 @@
1018 }
1019
1020 /*
1021 ** WEBPAGE: tktsetup_timeline
1022 **
1023 ** Administrative page used ot configure how tickets are
1024 ** rendered on timeline views.
1025 */
1026 void tktsetup_timeline_page(void){
1027 login_check_credentials();
1028 if( !g.perm.Setup ){
1029
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -1018,11 +1018,11 @@
1018 }
1019
1020 /*
1021 ** WEBPAGE: tktsetup_timeline
1022 **
1023 ** Administrative page used to configure how tickets are
1024 ** rendered on timeline views.
1025 */
1026 void tktsetup_timeline_page(void){
1027 login_check_credentials();
1028 if( !g.perm.Setup ){
1029
+2 -2
--- src/undo.c
+++ src/undo.c
@@ -23,11 +23,11 @@
2323
#if INTERFACE
2424
/*
2525
** Possible return values from the undo_maybe_save() routine.
2626
*/
2727
#define UNDO_NONE (0) /* Placeholder only used to initialize vars. */
28
-#define UNDO_SAVED_OK (1) /* The specified file was saved succesfully. */
28
+#define UNDO_SAVED_OK (1) /* The specified file was saved successfully. */
2929
#define UNDO_DISABLED (2) /* File not saved, subsystem is disabled. */
3030
#define UNDO_INACTIVE (3) /* File not saved, subsystem is not active. */
3131
#define UNDO_TOOBIG (4) /* File not saved, it exceeded a size limit. */
3232
#endif
3333
@@ -289,11 +289,11 @@
289289
** function instead.
290290
**
291291
** The return value of this function will always be one of the
292292
** following codes:
293293
**
294
-** UNDO_SAVED_OK: The specified file was saved succesfully.
294
+** UNDO_SAVED_OK: The specified file was saved successfully.
295295
**
296296
** UNDO_DISABLED: The specified file was NOT saved, because the
297297
** "undo subsystem" is disabled. This error may
298298
** indicate that a call to undo_disable() was
299299
** issued.
300300
--- src/undo.c
+++ src/undo.c
@@ -23,11 +23,11 @@
23 #if INTERFACE
24 /*
25 ** Possible return values from the undo_maybe_save() routine.
26 */
27 #define UNDO_NONE (0) /* Placeholder only used to initialize vars. */
28 #define UNDO_SAVED_OK (1) /* The specified file was saved succesfully. */
29 #define UNDO_DISABLED (2) /* File not saved, subsystem is disabled. */
30 #define UNDO_INACTIVE (3) /* File not saved, subsystem is not active. */
31 #define UNDO_TOOBIG (4) /* File not saved, it exceeded a size limit. */
32 #endif
33
@@ -289,11 +289,11 @@
289 ** function instead.
290 **
291 ** The return value of this function will always be one of the
292 ** following codes:
293 **
294 ** UNDO_SAVED_OK: The specified file was saved succesfully.
295 **
296 ** UNDO_DISABLED: The specified file was NOT saved, because the
297 ** "undo subsystem" is disabled. This error may
298 ** indicate that a call to undo_disable() was
299 ** issued.
300
--- src/undo.c
+++ src/undo.c
@@ -23,11 +23,11 @@
23 #if INTERFACE
24 /*
25 ** Possible return values from the undo_maybe_save() routine.
26 */
27 #define UNDO_NONE (0) /* Placeholder only used to initialize vars. */
28 #define UNDO_SAVED_OK (1) /* The specified file was saved successfully. */
29 #define UNDO_DISABLED (2) /* File not saved, subsystem is disabled. */
30 #define UNDO_INACTIVE (3) /* File not saved, subsystem is not active. */
31 #define UNDO_TOOBIG (4) /* File not saved, it exceeded a size limit. */
32 #endif
33
@@ -289,11 +289,11 @@
289 ** function instead.
290 **
291 ** The return value of this function will always be one of the
292 ** following codes:
293 **
294 ** UNDO_SAVED_OK: The specified file was saved successfully.
295 **
296 ** UNDO_DISABLED: The specified file was NOT saved, because the
297 ** "undo subsystem" is disabled. This error may
298 ** indicate that a call to undo_disable() was
299 ** issued.
300
+1 -1
--- src/unicode.c
+++ src/unicode.c
@@ -189,11 +189,11 @@
189189
/*
190190
** If the argument is a codepoint corresponding to a lowercase letter
191191
** in the ASCII range with a diacritic added, return the codepoint
192192
** of the ASCII letter only. For example, if passed 235 - "LATIN
193193
** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER
194
-** E"). The resuls of passing a codepoint that corresponds to an
194
+** E"). The results of passing a codepoint that corresponds to an
195195
** uppercase letter are undefined.
196196
*/
197197
static int unicode_remove_diacritic(int c, int bComplex){
198198
static const unsigned short aDia[] = {
199199
0, 1797, 1848, 1859, 1891, 1928, 1940, 1995,
200200
--- src/unicode.c
+++ src/unicode.c
@@ -189,11 +189,11 @@
189 /*
190 ** If the argument is a codepoint corresponding to a lowercase letter
191 ** in the ASCII range with a diacritic added, return the codepoint
192 ** of the ASCII letter only. For example, if passed 235 - "LATIN
193 ** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER
194 ** E"). The resuls of passing a codepoint that corresponds to an
195 ** uppercase letter are undefined.
196 */
197 static int unicode_remove_diacritic(int c, int bComplex){
198 static const unsigned short aDia[] = {
199 0, 1797, 1848, 1859, 1891, 1928, 1940, 1995,
200
--- src/unicode.c
+++ src/unicode.c
@@ -189,11 +189,11 @@
189 /*
190 ** If the argument is a codepoint corresponding to a lowercase letter
191 ** in the ASCII range with a diacritic added, return the codepoint
192 ** of the ASCII letter only. For example, if passed 235 - "LATIN
193 ** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER
194 ** E"). The results of passing a codepoint that corresponds to an
195 ** uppercase letter are undefined.
196 */
197 static int unicode_remove_diacritic(int c, int bComplex){
198 static const unsigned short aDia[] = {
199 0, 1797, 1848, 1859, 1891, 1928, 1940, 1995,
200
+3 -3
--- src/update.c
+++ src/update.c
@@ -88,11 +88,11 @@
8888
** The -n or --dry-run option causes this command to do a "dry run".
8989
** It prints out what would have happened but does not actually make
9090
** any changes to the current check-out or the repository.
9191
**
9292
** The -v or --verbose option prints status information about
93
-** unchanged files in addition to those file that actually do change.
93
+** unchanged files in addition to those files that actually do change.
9494
**
9595
** Options:
9696
** --case-sensitive BOOL Override case-sensitive setting
9797
** --debug Print debug information on stdout
9898
** -n|--dry-run If given, display instead of run actions
@@ -256,11 +256,11 @@
256256
fossil_fatal("missing content, unable to update");
257257
};
258258
259259
/*
260260
** The record.fn field is used to match files against each other. The
261
- ** FV table contains one row for each each unique filename in
261
+ ** FV table contains one row for each unique filename in
262262
** in the current check-out, the pivot, and the version being merged.
263263
*/
264264
db_multi_exec(
265265
"DROP TABLE IF EXISTS fv;"
266266
"CREATE TEMP TABLE fv("
@@ -451,11 +451,11 @@
451451
}else if( idt>0 && idv==0 ){
452452
/* File added in the target. */
453453
if( file_isfile_or_link(zFullPath) ){
454454
/* Name of backup file with Original content */
455455
char *zOrig = file_newname(zFullPath, "original", 1);
456
- /* Backup previously unanaged file before to be overwritten */
456
+ /* Backup previously unmanaged file before being overwritten */
457457
file_copy(zFullPath, zOrig);
458458
fossil_free(zOrig);
459459
fossil_print("ADD %s - overwrites an unmanaged file", zName);
460460
if( !dryRunFlag ) fossil_print(", original copy backed up locally");
461461
fossil_print("\n");
462462
--- src/update.c
+++ src/update.c
@@ -88,11 +88,11 @@
88 ** The -n or --dry-run option causes this command to do a "dry run".
89 ** It prints out what would have happened but does not actually make
90 ** any changes to the current check-out or the repository.
91 **
92 ** The -v or --verbose option prints status information about
93 ** unchanged files in addition to those file that actually do change.
94 **
95 ** Options:
96 ** --case-sensitive BOOL Override case-sensitive setting
97 ** --debug Print debug information on stdout
98 ** -n|--dry-run If given, display instead of run actions
@@ -256,11 +256,11 @@
256 fossil_fatal("missing content, unable to update");
257 };
258
259 /*
260 ** The record.fn field is used to match files against each other. The
261 ** FV table contains one row for each each unique filename in
262 ** in the current check-out, the pivot, and the version being merged.
263 */
264 db_multi_exec(
265 "DROP TABLE IF EXISTS fv;"
266 "CREATE TEMP TABLE fv("
@@ -451,11 +451,11 @@
451 }else if( idt>0 && idv==0 ){
452 /* File added in the target. */
453 if( file_isfile_or_link(zFullPath) ){
454 /* Name of backup file with Original content */
455 char *zOrig = file_newname(zFullPath, "original", 1);
456 /* Backup previously unanaged file before to be overwritten */
457 file_copy(zFullPath, zOrig);
458 fossil_free(zOrig);
459 fossil_print("ADD %s - overwrites an unmanaged file", zName);
460 if( !dryRunFlag ) fossil_print(", original copy backed up locally");
461 fossil_print("\n");
462
--- src/update.c
+++ src/update.c
@@ -88,11 +88,11 @@
88 ** The -n or --dry-run option causes this command to do a "dry run".
89 ** It prints out what would have happened but does not actually make
90 ** any changes to the current check-out or the repository.
91 **
92 ** The -v or --verbose option prints status information about
93 ** unchanged files in addition to those files that actually do change.
94 **
95 ** Options:
96 ** --case-sensitive BOOL Override case-sensitive setting
97 ** --debug Print debug information on stdout
98 ** -n|--dry-run If given, display instead of run actions
@@ -256,11 +256,11 @@
256 fossil_fatal("missing content, unable to update");
257 };
258
259 /*
260 ** The record.fn field is used to match files against each other. The
261 ** FV table contains one row for each unique filename in
262 ** in the current check-out, the pivot, and the version being merged.
263 */
264 db_multi_exec(
265 "DROP TABLE IF EXISTS fv;"
266 "CREATE TEMP TABLE fv("
@@ -451,11 +451,11 @@
451 }else if( idt>0 && idv==0 ){
452 /* File added in the target. */
453 if( file_isfile_or_link(zFullPath) ){
454 /* Name of backup file with Original content */
455 char *zOrig = file_newname(zFullPath, "original", 1);
456 /* Backup previously unmanaged file before being overwritten */
457 file_copy(zFullPath, zOrig);
458 fossil_free(zOrig);
459 fossil_print("ADD %s - overwrites an unmanaged file", zName);
460 if( !dryRunFlag ) fossil_print(", original copy backed up locally");
461 fossil_print("\n");
462
+4 -1
--- src/url.c
+++ src/url.c
@@ -547,20 +547,23 @@
547547
** network-related options:
548548
**
549549
** --nosync Temporarily disable "autosync"
550550
**
551551
** --ipv4 Disallow IPv6. Use only IPv4.
552
+**
553
+** --ipv6 Disallow IPv4. Use only IPv6.
552554
**
553555
** --accept-any-cert Disable server SSL cert validation. Accept
554556
** any SSL cert that the server provides.
555557
** WARNING: this option opens you up to
556558
** forged-DNS and man-in-the-middle attacks!
557559
*/
558560
void url_proxy_options(void){
559561
zProxyOpt = find_option("proxy", 0, 1);
560562
if( find_option("nosync",0,0) ) g.fNoSync = 1;
561
- if( find_option("ipv4",0,0) ) g.fIPv4 = 1;
563
+ if( find_option("ipv4",0,0) ) g.eIPvers = 1;
564
+ if( find_option("ipv6",0,0) ) g.eIPvers = 2;
562565
#ifdef FOSSIL_ENABLE_SSL
563566
if( find_option("accept-any-cert",0,0) ){
564567
ssl_disable_cert_verification();
565568
}
566569
#endif /* FOSSIL_ENABLE_SSL */
567570
--- src/url.c
+++ src/url.c
@@ -547,20 +547,23 @@
547 ** network-related options:
548 **
549 ** --nosync Temporarily disable "autosync"
550 **
551 ** --ipv4 Disallow IPv6. Use only IPv4.
 
 
552 **
553 ** --accept-any-cert Disable server SSL cert validation. Accept
554 ** any SSL cert that the server provides.
555 ** WARNING: this option opens you up to
556 ** forged-DNS and man-in-the-middle attacks!
557 */
558 void url_proxy_options(void){
559 zProxyOpt = find_option("proxy", 0, 1);
560 if( find_option("nosync",0,0) ) g.fNoSync = 1;
561 if( find_option("ipv4",0,0) ) g.fIPv4 = 1;
 
562 #ifdef FOSSIL_ENABLE_SSL
563 if( find_option("accept-any-cert",0,0) ){
564 ssl_disable_cert_verification();
565 }
566 #endif /* FOSSIL_ENABLE_SSL */
567
--- src/url.c
+++ src/url.c
@@ -547,20 +547,23 @@
547 ** network-related options:
548 **
549 ** --nosync Temporarily disable "autosync"
550 **
551 ** --ipv4 Disallow IPv6. Use only IPv4.
552 **
553 ** --ipv6 Disallow IPv4. Use only IPv6.
554 **
555 ** --accept-any-cert Disable server SSL cert validation. Accept
556 ** any SSL cert that the server provides.
557 ** WARNING: this option opens you up to
558 ** forged-DNS and man-in-the-middle attacks!
559 */
560 void url_proxy_options(void){
561 zProxyOpt = find_option("proxy", 0, 1);
562 if( find_option("nosync",0,0) ) g.fNoSync = 1;
563 if( find_option("ipv4",0,0) ) g.eIPvers = 1;
564 if( find_option("ipv6",0,0) ) g.eIPvers = 2;
565 #ifdef FOSSIL_ENABLE_SSL
566 if( find_option("accept-any-cert",0,0) ){
567 ssl_disable_cert_verification();
568 }
569 #endif /* FOSSIL_ENABLE_SSL */
570
+1 -1
--- src/user.c
+++ src/user.c
@@ -777,11 +777,11 @@
777777
if( skip ){
778778
style_submenu_element("Newer", "%R/user_log?o=%d&n=%d&y=%d",
779779
skip>=n ? skip-n : 0, n, y);
780780
}
781781
rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql));
782
- fLogEnabled = db_get_boolean("access-log", 0);
782
+ fLogEnabled = db_get_boolean("access-log", 1);
783783
@ <div align="center">User logging is %s(fLogEnabled?"on":"off").
784784
@ (Change this on the <a href="setup_settings">settings</a> page.)</div>
785785
@ <table border="1" cellpadding="5" class="sortable" align="center" \
786786
@ data-column-types='Ttt' data-init-sort='1'>
787787
@ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th>
788788
--- src/user.c
+++ src/user.c
@@ -777,11 +777,11 @@
777 if( skip ){
778 style_submenu_element("Newer", "%R/user_log?o=%d&n=%d&y=%d",
779 skip>=n ? skip-n : 0, n, y);
780 }
781 rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql));
782 fLogEnabled = db_get_boolean("access-log", 0);
783 @ <div align="center">User logging is %s(fLogEnabled?"on":"off").
784 @ (Change this on the <a href="setup_settings">settings</a> page.)</div>
785 @ <table border="1" cellpadding="5" class="sortable" align="center" \
786 @ data-column-types='Ttt' data-init-sort='1'>
787 @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th>
788
--- src/user.c
+++ src/user.c
@@ -777,11 +777,11 @@
777 if( skip ){
778 style_submenu_element("Newer", "%R/user_log?o=%d&n=%d&y=%d",
779 skip>=n ? skip-n : 0, n, y);
780 }
781 rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql));
782 fLogEnabled = db_get_boolean("access-log", 1);
783 @ <div align="center">User logging is %s(fLogEnabled?"on":"off").
784 @ (Change this on the <a href="setup_settings">settings</a> page.)</div>
785 @ <table border="1" cellpadding="5" class="sortable" align="center" \
786 @ data-column-types='Ttt' data-init-sort='1'>
787 @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th>
788
+7 -4
--- src/util.c
+++ src/util.c
@@ -234,11 +234,11 @@
234234
235235
/*
236236
** Check the input string to ensure that it is safe to pass into system().
237237
** A string is unsafe for system() on unix if it contains any of the following:
238238
**
239
-** * Any occurrance of '$' or '`' except single-quoted or after \
239
+** * Any occurrence of '$' or '`' except single-quoted or after \
240240
** * Any of the following characters, unquoted: ;|& or \n except
241241
** these characters are allowed as the very last character in the
242242
** string.
243243
** * Unbalanced single or double quotes
244244
**
@@ -671,20 +671,23 @@
671671
** (1) The value of the --editor command-line argument
672672
** (2) The local "editor" setting
673673
** (3) The global "editor" setting
674674
** (4) The VISUAL environment variable
675675
** (5) The EDITOR environment variable
676
-** (6) Any of the following programs that are available:
677
-** notepad, nano, pico, jove, edit, vi, vim, ed,
676
+** (6) Any of several common editors that might be available, such as:
677
+** notepad, nano, pico, jove, edit, vi, vim, ed
678678
**
679679
** The search only occurs once, the first time this routine is called.
680680
** Second and subsequent invocations always return the same value.
681681
*/
682682
const char *fossil_text_editor(void){
683683
static const char *zEditor = 0;
684684
const char *azStdEd[] = {
685
- "notepad", "nano", "pico", "jove", "edit", "vi", "vim", "ed"
685
+#ifdef _WIN32
686
+ "notepad",
687
+#endif
688
+ "nano", "pico", "jove", "edit", "vi", "vim", "ed"
686689
};
687690
int i = 0;
688691
if( zEditor==0 ){
689692
zEditor = find_option("editor",0,1);
690693
}
691694
--- src/util.c
+++ src/util.c
@@ -234,11 +234,11 @@
234
235 /*
236 ** Check the input string to ensure that it is safe to pass into system().
237 ** A string is unsafe for system() on unix if it contains any of the following:
238 **
239 ** * Any occurrance of '$' or '`' except single-quoted or after \
240 ** * Any of the following characters, unquoted: ;|& or \n except
241 ** these characters are allowed as the very last character in the
242 ** string.
243 ** * Unbalanced single or double quotes
244 **
@@ -671,20 +671,23 @@
671 ** (1) The value of the --editor command-line argument
672 ** (2) The local "editor" setting
673 ** (3) The global "editor" setting
674 ** (4) The VISUAL environment variable
675 ** (5) The EDITOR environment variable
676 ** (6) Any of the following programs that are available:
677 ** notepad, nano, pico, jove, edit, vi, vim, ed,
678 **
679 ** The search only occurs once, the first time this routine is called.
680 ** Second and subsequent invocations always return the same value.
681 */
682 const char *fossil_text_editor(void){
683 static const char *zEditor = 0;
684 const char *azStdEd[] = {
685 "notepad", "nano", "pico", "jove", "edit", "vi", "vim", "ed"
 
 
 
686 };
687 int i = 0;
688 if( zEditor==0 ){
689 zEditor = find_option("editor",0,1);
690 }
691
--- src/util.c
+++ src/util.c
@@ -234,11 +234,11 @@
234
235 /*
236 ** Check the input string to ensure that it is safe to pass into system().
237 ** A string is unsafe for system() on unix if it contains any of the following:
238 **
239 ** * Any occurrence of '$' or '`' except single-quoted or after \
240 ** * Any of the following characters, unquoted: ;|& or \n except
241 ** these characters are allowed as the very last character in the
242 ** string.
243 ** * Unbalanced single or double quotes
244 **
@@ -671,20 +671,23 @@
671 ** (1) The value of the --editor command-line argument
672 ** (2) The local "editor" setting
673 ** (3) The global "editor" setting
674 ** (4) The VISUAL environment variable
675 ** (5) The EDITOR environment variable
676 ** (6) Any of several common editors that might be available, such as:
677 ** notepad, nano, pico, jove, edit, vi, vim, ed
678 **
679 ** The search only occurs once, the first time this routine is called.
680 ** Second and subsequent invocations always return the same value.
681 */
682 const char *fossil_text_editor(void){
683 static const char *zEditor = 0;
684 const char *azStdEd[] = {
685 #ifdef _WIN32
686 "notepad",
687 #endif
688 "nano", "pico", "jove", "edit", "vi", "vim", "ed"
689 };
690 int i = 0;
691 if( zEditor==0 ){
692 zEditor = find_option("editor",0,1);
693 }
694
+1 -1
--- src/wiki.c
+++ src/wiki.c
@@ -2273,11 +2273,11 @@
22732273
** of timestamp with the most recent
22742274
** first.
22752275
** -a|--show-associated Show wiki pages associated with
22762276
** check-ins and branches.
22772277
** -s|--show-technote-ids The id of the tech note will be listed
2278
-** along side the timestamp. The tech note
2278
+** alongside the timestamp. The tech note
22792279
** id will be the first word on each line.
22802280
** This option only applies if the
22812281
** --technote option is also specified.
22822282
**
22832283
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
22842284
--- src/wiki.c
+++ src/wiki.c
@@ -2273,11 +2273,11 @@
2273 ** of timestamp with the most recent
2274 ** first.
2275 ** -a|--show-associated Show wiki pages associated with
2276 ** check-ins and branches.
2277 ** -s|--show-technote-ids The id of the tech note will be listed
2278 ** along side the timestamp. The tech note
2279 ** id will be the first word on each line.
2280 ** This option only applies if the
2281 ** --technote option is also specified.
2282 **
2283 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2284
--- src/wiki.c
+++ src/wiki.c
@@ -2273,11 +2273,11 @@
2273 ** of timestamp with the most recent
2274 ** first.
2275 ** -a|--show-associated Show wiki pages associated with
2276 ** check-ins and branches.
2277 ** -s|--show-technote-ids The id of the tech note will be listed
2278 ** alongside the timestamp. The tech note
2279 ** id will be the first word on each line.
2280 ** This option only applies if the
2281 ** --technote option is also specified.
2282 **
2283 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2284
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
2525
/*
2626
** Allowed wiki transformation operations
2727
*/
2828
#define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
2929
#define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30
-/* avalable for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
30
+/* available for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
3131
#define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
3232
#define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
3333
#define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
3434
#define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
3535
#define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -566,11 +566,11 @@
566566
** &
567567
** \n
568568
** [
569569
**
570570
** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI.
571
-** The "\n" is only considered interesting if the flags constains ALLOW_WIKI.
571
+** The "\n" is only considered interesting if the flags contains ALLOW_WIKI.
572572
*/
573573
static int textLength(const char *z, int flags){
574574
const char *zReject;
575575
if( flags & ALLOW_WIKI ){
576576
zReject = "<&[\n";
@@ -1811,11 +1811,11 @@
18111811
/* Enter <verbatim> processing. With verbatim enabled, all other
18121812
** markup other than the corresponding end-tag with the same ID is
18131813
** ignored.
18141814
*/
18151815
if( markup.iCode==MARKUP_VERBATIM ){
1816
- int ii; //, vAttrDidAppend=0;
1816
+ int ii; /*, vAttrDidAppend=0;*/
18171817
const char *zClass = 0;
18181818
p->zVerbatimId = 0;
18191819
p->inVerbatim = 1;
18201820
p->preVerbState = p->state;
18211821
p->state &= ~ALLOW_WIKI;
@@ -2745,11 +2745,11 @@
27452745
p->nAlloc = 0;
27462746
p->aStack = p->aSpace;
27472747
}
27482748
27492749
/*
2750
-** Push a new element onto the tag statk
2750
+** Push a new element onto the tag stack
27512751
*/
27522752
static void html_tagstack_push(HtmlTagStack *p, int e){
27532753
if( p->n>=ArraySize(p->aSpace) && p->n>=p->nAlloc ){
27542754
if( p->nAlloc==0 ){
27552755
int *aNew;
@@ -2813,11 +2813,11 @@
28132813
**
28142814
** When safe_html() is asked to sanitize some HTML, it will ignore
28152815
** any text in between two consecutive instances of the nonce. The
28162816
** nonce itself is an HTML comment so it is harmless to keep the
28172817
** nonce in the middle of the HTML stream. A different nonce is
2818
-** choosen each time Fossil is run, using a lot of randomness, so
2818
+** chosen each time Fossil is run, using a lot of randomness, so
28192819
** an attacker will be unable to guess the nonce in advance.
28202820
**
28212821
** The original use-case for this mechanism is to allow Pikchr-generated
28222822
** SVG in the middle of HTML generated from Markdown. The Markdown
28232823
** output will normally be processed by safe_html() to prevent accidental
28242824
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
25 /*
26 ** Allowed wiki transformation operations
27 */
28 #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
29 #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30 /* avalable for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
31 #define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
32 #define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -566,11 +566,11 @@
566 ** &
567 ** \n
568 ** [
569 **
570 ** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI.
571 ** The "\n" is only considered interesting if the flags constains ALLOW_WIKI.
572 */
573 static int textLength(const char *z, int flags){
574 const char *zReject;
575 if( flags & ALLOW_WIKI ){
576 zReject = "<&[\n";
@@ -1811,11 +1811,11 @@
1811 /* Enter <verbatim> processing. With verbatim enabled, all other
1812 ** markup other than the corresponding end-tag with the same ID is
1813 ** ignored.
1814 */
1815 if( markup.iCode==MARKUP_VERBATIM ){
1816 int ii; //, vAttrDidAppend=0;
1817 const char *zClass = 0;
1818 p->zVerbatimId = 0;
1819 p->inVerbatim = 1;
1820 p->preVerbState = p->state;
1821 p->state &= ~ALLOW_WIKI;
@@ -2745,11 +2745,11 @@
2745 p->nAlloc = 0;
2746 p->aStack = p->aSpace;
2747 }
2748
2749 /*
2750 ** Push a new element onto the tag statk
2751 */
2752 static void html_tagstack_push(HtmlTagStack *p, int e){
2753 if( p->n>=ArraySize(p->aSpace) && p->n>=p->nAlloc ){
2754 if( p->nAlloc==0 ){
2755 int *aNew;
@@ -2813,11 +2813,11 @@
2813 **
2814 ** When safe_html() is asked to sanitize some HTML, it will ignore
2815 ** any text in between two consecutive instances of the nonce. The
2816 ** nonce itself is an HTML comment so it is harmless to keep the
2817 ** nonce in the middle of the HTML stream. A different nonce is
2818 ** choosen each time Fossil is run, using a lot of randomness, so
2819 ** an attacker will be unable to guess the nonce in advance.
2820 **
2821 ** The original use-case for this mechanism is to allow Pikchr-generated
2822 ** SVG in the middle of HTML generated from Markdown. The Markdown
2823 ** output will normally be processed by safe_html() to prevent accidental
2824
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
25 /*
26 ** Allowed wiki transformation operations
27 */
28 #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
29 #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30 /* available for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
31 #define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
32 #define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -566,11 +566,11 @@
566 ** &
567 ** \n
568 ** [
569 **
570 ** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI.
571 ** The "\n" is only considered interesting if the flags contains ALLOW_WIKI.
572 */
573 static int textLength(const char *z, int flags){
574 const char *zReject;
575 if( flags & ALLOW_WIKI ){
576 zReject = "<&[\n";
@@ -1811,11 +1811,11 @@
1811 /* Enter <verbatim> processing. With verbatim enabled, all other
1812 ** markup other than the corresponding end-tag with the same ID is
1813 ** ignored.
1814 */
1815 if( markup.iCode==MARKUP_VERBATIM ){
1816 int ii; /*, vAttrDidAppend=0;*/
1817 const char *zClass = 0;
1818 p->zVerbatimId = 0;
1819 p->inVerbatim = 1;
1820 p->preVerbState = p->state;
1821 p->state &= ~ALLOW_WIKI;
@@ -2745,11 +2745,11 @@
2745 p->nAlloc = 0;
2746 p->aStack = p->aSpace;
2747 }
2748
2749 /*
2750 ** Push a new element onto the tag stack
2751 */
2752 static void html_tagstack_push(HtmlTagStack *p, int e){
2753 if( p->n>=ArraySize(p->aSpace) && p->n>=p->nAlloc ){
2754 if( p->nAlloc==0 ){
2755 int *aNew;
@@ -2813,11 +2813,11 @@
2813 **
2814 ** When safe_html() is asked to sanitize some HTML, it will ignore
2815 ** any text in between two consecutive instances of the nonce. The
2816 ** nonce itself is an HTML comment so it is harmless to keep the
2817 ** nonce in the middle of the HTML stream. A different nonce is
2818 ** chosen each time Fossil is run, using a lot of randomness, so
2819 ** an attacker will be unable to guess the nonce in advance.
2820 **
2821 ** The original use-case for this mechanism is to allow Pikchr-generated
2822 ** SVG in the middle of HTML generated from Markdown. The Markdown
2823 ** output will normally be processed by safe_html() to prevent accidental
2824
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
2525
/*
2626
** Allowed wiki transformation operations
2727
*/
2828
#define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
2929
#define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30
-/* avalable for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
30
+/* available for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
3131
#define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
3232
#define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
3333
#define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
3434
#define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
3535
#define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -566,11 +566,11 @@
566566
** &
567567
** \n
568568
** [
569569
**
570570
** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI.
571
-** The "\n" is only considered interesting if the flags constains ALLOW_WIKI.
571
+** The "\n" is only considered interesting if the flags contains ALLOW_WIKI.
572572
*/
573573
static int textLength(const char *z, int flags){
574574
const char *zReject;
575575
if( flags & ALLOW_WIKI ){
576576
zReject = "<&[\n";
@@ -1811,11 +1811,11 @@
18111811
/* Enter <verbatim> processing. With verbatim enabled, all other
18121812
** markup other than the corresponding end-tag with the same ID is
18131813
** ignored.
18141814
*/
18151815
if( markup.iCode==MARKUP_VERBATIM ){
1816
- int ii; //, vAttrDidAppend=0;
1816
+ int ii; /*, vAttrDidAppend=0;*/
18171817
const char *zClass = 0;
18181818
p->zVerbatimId = 0;
18191819
p->inVerbatim = 1;
18201820
p->preVerbState = p->state;
18211821
p->state &= ~ALLOW_WIKI;
@@ -2745,11 +2745,11 @@
27452745
p->nAlloc = 0;
27462746
p->aStack = p->aSpace;
27472747
}
27482748
27492749
/*
2750
-** Push a new element onto the tag statk
2750
+** Push a new element onto the tag stack
27512751
*/
27522752
static void html_tagstack_push(HtmlTagStack *p, int e){
27532753
if( p->n>=ArraySize(p->aSpace) && p->n>=p->nAlloc ){
27542754
if( p->nAlloc==0 ){
27552755
int *aNew;
@@ -2813,11 +2813,11 @@
28132813
**
28142814
** When safe_html() is asked to sanitize some HTML, it will ignore
28152815
** any text in between two consecutive instances of the nonce. The
28162816
** nonce itself is an HTML comment so it is harmless to keep the
28172817
** nonce in the middle of the HTML stream. A different nonce is
2818
-** choosen each time Fossil is run, using a lot of randomness, so
2818
+** chosen each time Fossil is run, using a lot of randomness, so
28192819
** an attacker will be unable to guess the nonce in advance.
28202820
**
28212821
** The original use-case for this mechanism is to allow Pikchr-generated
28222822
** SVG in the middle of HTML generated from Markdown. The Markdown
28232823
** output will normally be processed by safe_html() to prevent accidental
28242824
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
25 /*
26 ** Allowed wiki transformation operations
27 */
28 #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
29 #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30 /* avalable for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
31 #define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
32 #define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -566,11 +566,11 @@
566 ** &
567 ** \n
568 ** [
569 **
570 ** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI.
571 ** The "\n" is only considered interesting if the flags constains ALLOW_WIKI.
572 */
573 static int textLength(const char *z, int flags){
574 const char *zReject;
575 if( flags & ALLOW_WIKI ){
576 zReject = "<&[\n";
@@ -1811,11 +1811,11 @@
1811 /* Enter <verbatim> processing. With verbatim enabled, all other
1812 ** markup other than the corresponding end-tag with the same ID is
1813 ** ignored.
1814 */
1815 if( markup.iCode==MARKUP_VERBATIM ){
1816 int ii; //, vAttrDidAppend=0;
1817 const char *zClass = 0;
1818 p->zVerbatimId = 0;
1819 p->inVerbatim = 1;
1820 p->preVerbState = p->state;
1821 p->state &= ~ALLOW_WIKI;
@@ -2745,11 +2745,11 @@
2745 p->nAlloc = 0;
2746 p->aStack = p->aSpace;
2747 }
2748
2749 /*
2750 ** Push a new element onto the tag statk
2751 */
2752 static void html_tagstack_push(HtmlTagStack *p, int e){
2753 if( p->n>=ArraySize(p->aSpace) && p->n>=p->nAlloc ){
2754 if( p->nAlloc==0 ){
2755 int *aNew;
@@ -2813,11 +2813,11 @@
2813 **
2814 ** When safe_html() is asked to sanitize some HTML, it will ignore
2815 ** any text in between two consecutive instances of the nonce. The
2816 ** nonce itself is an HTML comment so it is harmless to keep the
2817 ** nonce in the middle of the HTML stream. A different nonce is
2818 ** choosen each time Fossil is run, using a lot of randomness, so
2819 ** an attacker will be unable to guess the nonce in advance.
2820 **
2821 ** The original use-case for this mechanism is to allow Pikchr-generated
2822 ** SVG in the middle of HTML generated from Markdown. The Markdown
2823 ** output will normally be processed by safe_html() to prevent accidental
2824
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
25 /*
26 ** Allowed wiki transformation operations
27 */
28 #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
29 #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30 /* available for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
31 #define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
32 #define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -566,11 +566,11 @@
566 ** &
567 ** \n
568 ** [
569 **
570 ** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI.
571 ** The "\n" is only considered interesting if the flags contains ALLOW_WIKI.
572 */
573 static int textLength(const char *z, int flags){
574 const char *zReject;
575 if( flags & ALLOW_WIKI ){
576 zReject = "<&[\n";
@@ -1811,11 +1811,11 @@
1811 /* Enter <verbatim> processing. With verbatim enabled, all other
1812 ** markup other than the corresponding end-tag with the same ID is
1813 ** ignored.
1814 */
1815 if( markup.iCode==MARKUP_VERBATIM ){
1816 int ii; /*, vAttrDidAppend=0;*/
1817 const char *zClass = 0;
1818 p->zVerbatimId = 0;
1819 p->inVerbatim = 1;
1820 p->preVerbState = p->state;
1821 p->state &= ~ALLOW_WIKI;
@@ -2745,11 +2745,11 @@
2745 p->nAlloc = 0;
2746 p->aStack = p->aSpace;
2747 }
2748
2749 /*
2750 ** Push a new element onto the tag stack
2751 */
2752 static void html_tagstack_push(HtmlTagStack *p, int e){
2753 if( p->n>=ArraySize(p->aSpace) && p->n>=p->nAlloc ){
2754 if( p->nAlloc==0 ){
2755 int *aNew;
@@ -2813,11 +2813,11 @@
2813 **
2814 ** When safe_html() is asked to sanitize some HTML, it will ignore
2815 ** any text in between two consecutive instances of the nonce. The
2816 ** nonce itself is an HTML comment so it is harmless to keep the
2817 ** nonce in the middle of the HTML stream. A different nonce is
2818 ** chosen each time Fossil is run, using a lot of randomness, so
2819 ** an attacker will be unable to guess the nonce in advance.
2820 **
2821 ** The original use-case for this mechanism is to allow Pikchr-generated
2822 ** SVG in the middle of HTML generated from Markdown. The Markdown
2823 ** output will normally be processed by safe_html() to prevent accidental
2824
+1 -1
--- src/winhttp.c
+++ src/winhttp.c
@@ -805,11 +805,11 @@
805805
(LPWSTR) &tmp,
806806
0,
807807
NULL
808808
);
809809
if( !nMsg ){
810
- /* No english, get what the system has available. */
810
+ /* No English, get what the system has available. */
811811
nMsg = FormatMessageW(
812812
FORMAT_MESSAGE_ALLOCATE_BUFFER |
813813
FORMAT_MESSAGE_FROM_SYSTEM |
814814
FORMAT_MESSAGE_IGNORE_INSERTS,
815815
NULL,
816816
--- src/winhttp.c
+++ src/winhttp.c
@@ -805,11 +805,11 @@
805 (LPWSTR) &tmp,
806 0,
807 NULL
808 );
809 if( !nMsg ){
810 /* No english, get what the system has available. */
811 nMsg = FormatMessageW(
812 FORMAT_MESSAGE_ALLOCATE_BUFFER |
813 FORMAT_MESSAGE_FROM_SYSTEM |
814 FORMAT_MESSAGE_IGNORE_INSERTS,
815 NULL,
816
--- src/winhttp.c
+++ src/winhttp.c
@@ -805,11 +805,11 @@
805 (LPWSTR) &tmp,
806 0,
807 NULL
808 );
809 if( !nMsg ){
810 /* No English, get what the system has available. */
811 nMsg = FormatMessageW(
812 FORMAT_MESSAGE_ALLOCATE_BUFFER |
813 FORMAT_MESSAGE_FROM_SYSTEM |
814 FORMAT_MESSAGE_IGNORE_INSERTS,
815 NULL,
816
+18 -6
--- src/xfer.c
+++ src/xfer.c
@@ -52,11 +52,11 @@
5252
int resync; /* Send igot cards for all holdings */
5353
u8 syncPrivate; /* True to enable syncing private content */
5454
u8 nextIsPrivate; /* If true, next "file" received is a private */
5555
u32 remoteVersion; /* Version of fossil running on the other side */
5656
u32 remoteDate; /* Date for specific client software edition */
57
- u32 remoteTime; /* Time of date correspoding on remoteDate */
57
+ u32 remoteTime; /* Time of date corresponding on remoteDate */
5858
time_t maxTime; /* Time when this transfer should be finished */
5959
};
6060
6161
6262
/*
@@ -1216,11 +1216,11 @@
12161216
return xfer_run_script(xfer_common_code(), 0, 0);
12171217
}
12181218
12191219
/*
12201220
** This routine makes a "syncwith:URL" entry in the CONFIG table to
1221
-** indicate that a sync is occuring with zUrl.
1221
+** indicate that a sync is occurring with zUrl.
12221222
**
12231223
** Add a "syncfrom:URL" entry instead of "syncwith:URL" if bSyncFrom is true.
12241224
*/
12251225
static void xfer_syncwith(const char *zUrl, int bSyncFrom){
12261226
UrlData x;
@@ -2049,10 +2049,12 @@
20492049
#define SYNC_CKIN_LOCK 0x02000 /* Lock the current check-in */
20502050
#define SYNC_NOHTTPCOMPRESS 0x04000 /* Do not compression HTTP messages */
20512051
#define SYNC_ALLURL 0x08000 /* The --all flag - sync to all URLs */
20522052
#define SYNC_SHARE_LINKS 0x10000 /* Request alternate repo links */
20532053
#define SYNC_XVERBOSE 0x20000 /* Extra verbose. Network traffic */
2054
+#define SYNC_PING 0x40000 /* Verify server is alive */
2055
+#define SYNC_QUIET 0x80000 /* No output */
20542056
#endif
20552057
20562058
/*
20572059
** Floating-point absolute value
20582060
*/
@@ -2115,11 +2117,12 @@
21152117
unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
21162118
const int bOutIsTty = fossil_isatty(fossil_fileno(stdout));
21172119
21182120
if( pnRcvd ) *pnRcvd = 0;
21192121
if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
2120
- if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0
2122
+ if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED|SYNC_PING))
2123
+ ==0
21212124
&& configRcvMask==0
21222125
&& configSendMask==0
21232126
){
21242127
return 0; /* Nothing to do */
21252128
}
@@ -2384,11 +2387,11 @@
23842387
zCkinLock = 0;
23852388
}else if( zClientId ){
23862389
blob_appendf(&send, "pragma ci-unlock %s\n", zClientId);
23872390
}
23882391
/* Append randomness to the end of the uplink message. This makes all
2389
- ** messages unique so that that the login-card nonce will always
2392
+ ** messages unique so that the login-card nonce will always
23902393
** be unique.
23912394
*/
23922395
zRandomness = db_text(0, "SELECT hex(randomblob(20))");
23932396
blob_appendf(&send, "# %s\n", zRandomness);
23942397
fossil_free(zRandomness);
@@ -2410,10 +2413,13 @@
24102413
mHttpFlags |= HTTP_NOCOMPRESS;
24112414
}
24122415
if( syncFlags & SYNC_XVERBOSE ){
24132416
mHttpFlags |= HTTP_VERBOSE;
24142417
}
2418
+ if( syncFlags & SYNC_QUIET ){
2419
+ mHttpFlags |= HTTP_QUIET;
2420
+ }
24152421
24162422
/* Do the round-trip to the server */
24172423
if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){
24182424
nErr++;
24192425
go = 2;
@@ -2431,10 +2437,12 @@
24312437
nArtifactSent += xfer.nFileSent + xfer.nDeltaSent;
24322438
if( syncFlags & SYNC_VERBOSE ){
24332439
fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Sent:",
24342440
blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent,
24352441
xfer.nFileSent, xfer.nDeltaSent);
2442
+ }else if( syncFlags & SYNC_QUIET ){
2443
+ /* No-op */
24362444
}else{
24372445
if( bOutIsTty!=0 ){
24382446
fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
24392447
nRoundtrip, nArtifactSent, nArtifactRcvd);
24402448
}
@@ -2954,10 +2962,12 @@
29542962
origConfigRcvMask = 0;
29552963
if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){
29562964
fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:",
29572965
blob_size(&recv), nCardRcvd,
29582966
xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
2967
+ }else if( syncFlags & SYNC_QUIET ){
2968
+ /* No-op */
29592969
}else{
29602970
if( bOutIsTty!=0 ){
29612971
fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
29622972
nRoundtrip, nArtifactSent, nArtifactRcvd);
29632973
}
@@ -3016,18 +3026,20 @@
30163026
}else if( rSkew*24.0*3600.0 < -10.0 ){
30173027
fossil_warning("*** time skew *** server is slow by %s",
30183028
db_timespan_name(-rSkew));
30193029
g.clockSkewSeen = 1;
30203030
}
3021
- if( bOutIsTty==0 ){
3031
+ if( bOutIsTty==0 && (syncFlags & SYNC_QUIET)==0 ){
30223032
fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
30233033
nRoundtrip, nArtifactSent, nArtifactRcvd);
30243034
fossil_force_newline();
30253035
}
30263036
fossil_force_newline();
30273037
if( g.zHttpCmd==0 ){
3028
- if( syncFlags & SYNC_VERBOSE ){
3038
+ if( syncFlags & SYNC_QUIET ){
3039
+ /* no-op */
3040
+ }else if( syncFlags & SYNC_VERBOSE ){
30293041
fossil_print(
30303042
"%s done, wire bytes sent: %lld received: %lld remote: %s%s\n",
30313043
zOpType, nSent, nRcvd,
30323044
(g.url.name && g.url.name[0]!='\0') ? g.url.name : "",
30333045
(g.zIpAddr && g.zIpAddr[0]!='\0'
30343046
--- src/xfer.c
+++ src/xfer.c
@@ -52,11 +52,11 @@
52 int resync; /* Send igot cards for all holdings */
53 u8 syncPrivate; /* True to enable syncing private content */
54 u8 nextIsPrivate; /* If true, next "file" received is a private */
55 u32 remoteVersion; /* Version of fossil running on the other side */
56 u32 remoteDate; /* Date for specific client software edition */
57 u32 remoteTime; /* Time of date correspoding on remoteDate */
58 time_t maxTime; /* Time when this transfer should be finished */
59 };
60
61
62 /*
@@ -1216,11 +1216,11 @@
1216 return xfer_run_script(xfer_common_code(), 0, 0);
1217 }
1218
1219 /*
1220 ** This routine makes a "syncwith:URL" entry in the CONFIG table to
1221 ** indicate that a sync is occuring with zUrl.
1222 **
1223 ** Add a "syncfrom:URL" entry instead of "syncwith:URL" if bSyncFrom is true.
1224 */
1225 static void xfer_syncwith(const char *zUrl, int bSyncFrom){
1226 UrlData x;
@@ -2049,10 +2049,12 @@
2049 #define SYNC_CKIN_LOCK 0x02000 /* Lock the current check-in */
2050 #define SYNC_NOHTTPCOMPRESS 0x04000 /* Do not compression HTTP messages */
2051 #define SYNC_ALLURL 0x08000 /* The --all flag - sync to all URLs */
2052 #define SYNC_SHARE_LINKS 0x10000 /* Request alternate repo links */
2053 #define SYNC_XVERBOSE 0x20000 /* Extra verbose. Network traffic */
 
 
2054 #endif
2055
2056 /*
2057 ** Floating-point absolute value
2058 */
@@ -2115,11 +2117,12 @@
2115 unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
2116 const int bOutIsTty = fossil_isatty(fossil_fileno(stdout));
2117
2118 if( pnRcvd ) *pnRcvd = 0;
2119 if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
2120 if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0
 
2121 && configRcvMask==0
2122 && configSendMask==0
2123 ){
2124 return 0; /* Nothing to do */
2125 }
@@ -2384,11 +2387,11 @@
2384 zCkinLock = 0;
2385 }else if( zClientId ){
2386 blob_appendf(&send, "pragma ci-unlock %s\n", zClientId);
2387 }
2388 /* Append randomness to the end of the uplink message. This makes all
2389 ** messages unique so that that the login-card nonce will always
2390 ** be unique.
2391 */
2392 zRandomness = db_text(0, "SELECT hex(randomblob(20))");
2393 blob_appendf(&send, "# %s\n", zRandomness);
2394 fossil_free(zRandomness);
@@ -2410,10 +2413,13 @@
2410 mHttpFlags |= HTTP_NOCOMPRESS;
2411 }
2412 if( syncFlags & SYNC_XVERBOSE ){
2413 mHttpFlags |= HTTP_VERBOSE;
2414 }
 
 
 
2415
2416 /* Do the round-trip to the server */
2417 if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){
2418 nErr++;
2419 go = 2;
@@ -2431,10 +2437,12 @@
2431 nArtifactSent += xfer.nFileSent + xfer.nDeltaSent;
2432 if( syncFlags & SYNC_VERBOSE ){
2433 fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Sent:",
2434 blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent,
2435 xfer.nFileSent, xfer.nDeltaSent);
 
 
2436 }else{
2437 if( bOutIsTty!=0 ){
2438 fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
2439 nRoundtrip, nArtifactSent, nArtifactRcvd);
2440 }
@@ -2954,10 +2962,12 @@
2954 origConfigRcvMask = 0;
2955 if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){
2956 fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:",
2957 blob_size(&recv), nCardRcvd,
2958 xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
 
 
2959 }else{
2960 if( bOutIsTty!=0 ){
2961 fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
2962 nRoundtrip, nArtifactSent, nArtifactRcvd);
2963 }
@@ -3016,18 +3026,20 @@
3016 }else if( rSkew*24.0*3600.0 < -10.0 ){
3017 fossil_warning("*** time skew *** server is slow by %s",
3018 db_timespan_name(-rSkew));
3019 g.clockSkewSeen = 1;
3020 }
3021 if( bOutIsTty==0 ){
3022 fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
3023 nRoundtrip, nArtifactSent, nArtifactRcvd);
3024 fossil_force_newline();
3025 }
3026 fossil_force_newline();
3027 if( g.zHttpCmd==0 ){
3028 if( syncFlags & SYNC_VERBOSE ){
 
 
3029 fossil_print(
3030 "%s done, wire bytes sent: %lld received: %lld remote: %s%s\n",
3031 zOpType, nSent, nRcvd,
3032 (g.url.name && g.url.name[0]!='\0') ? g.url.name : "",
3033 (g.zIpAddr && g.zIpAddr[0]!='\0'
3034
--- src/xfer.c
+++ src/xfer.c
@@ -52,11 +52,11 @@
52 int resync; /* Send igot cards for all holdings */
53 u8 syncPrivate; /* True to enable syncing private content */
54 u8 nextIsPrivate; /* If true, next "file" received is a private */
55 u32 remoteVersion; /* Version of fossil running on the other side */
56 u32 remoteDate; /* Date for specific client software edition */
57 u32 remoteTime; /* Time of date corresponding on remoteDate */
58 time_t maxTime; /* Time when this transfer should be finished */
59 };
60
61
62 /*
@@ -1216,11 +1216,11 @@
1216 return xfer_run_script(xfer_common_code(), 0, 0);
1217 }
1218
1219 /*
1220 ** This routine makes a "syncwith:URL" entry in the CONFIG table to
1221 ** indicate that a sync is occurring with zUrl.
1222 **
1223 ** Add a "syncfrom:URL" entry instead of "syncwith:URL" if bSyncFrom is true.
1224 */
1225 static void xfer_syncwith(const char *zUrl, int bSyncFrom){
1226 UrlData x;
@@ -2049,10 +2049,12 @@
2049 #define SYNC_CKIN_LOCK 0x02000 /* Lock the current check-in */
2050 #define SYNC_NOHTTPCOMPRESS 0x04000 /* Do not compression HTTP messages */
2051 #define SYNC_ALLURL 0x08000 /* The --all flag - sync to all URLs */
2052 #define SYNC_SHARE_LINKS 0x10000 /* Request alternate repo links */
2053 #define SYNC_XVERBOSE 0x20000 /* Extra verbose. Network traffic */
2054 #define SYNC_PING 0x40000 /* Verify server is alive */
2055 #define SYNC_QUIET 0x80000 /* No output */
2056 #endif
2057
2058 /*
2059 ** Floating-point absolute value
2060 */
@@ -2115,11 +2117,12 @@
2117 unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
2118 const int bOutIsTty = fossil_isatty(fossil_fileno(stdout));
2119
2120 if( pnRcvd ) *pnRcvd = 0;
2121 if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
2122 if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED|SYNC_PING))
2123 ==0
2124 && configRcvMask==0
2125 && configSendMask==0
2126 ){
2127 return 0; /* Nothing to do */
2128 }
@@ -2384,11 +2387,11 @@
2387 zCkinLock = 0;
2388 }else if( zClientId ){
2389 blob_appendf(&send, "pragma ci-unlock %s\n", zClientId);
2390 }
2391 /* Append randomness to the end of the uplink message. This makes all
2392 ** messages unique so that the login-card nonce will always
2393 ** be unique.
2394 */
2395 zRandomness = db_text(0, "SELECT hex(randomblob(20))");
2396 blob_appendf(&send, "# %s\n", zRandomness);
2397 fossil_free(zRandomness);
@@ -2410,10 +2413,13 @@
2413 mHttpFlags |= HTTP_NOCOMPRESS;
2414 }
2415 if( syncFlags & SYNC_XVERBOSE ){
2416 mHttpFlags |= HTTP_VERBOSE;
2417 }
2418 if( syncFlags & SYNC_QUIET ){
2419 mHttpFlags |= HTTP_QUIET;
2420 }
2421
2422 /* Do the round-trip to the server */
2423 if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){
2424 nErr++;
2425 go = 2;
@@ -2431,10 +2437,12 @@
2437 nArtifactSent += xfer.nFileSent + xfer.nDeltaSent;
2438 if( syncFlags & SYNC_VERBOSE ){
2439 fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Sent:",
2440 blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent,
2441 xfer.nFileSent, xfer.nDeltaSent);
2442 }else if( syncFlags & SYNC_QUIET ){
2443 /* No-op */
2444 }else{
2445 if( bOutIsTty!=0 ){
2446 fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
2447 nRoundtrip, nArtifactSent, nArtifactRcvd);
2448 }
@@ -2954,10 +2962,12 @@
2962 origConfigRcvMask = 0;
2963 if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){
2964 fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:",
2965 blob_size(&recv), nCardRcvd,
2966 xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
2967 }else if( syncFlags & SYNC_QUIET ){
2968 /* No-op */
2969 }else{
2970 if( bOutIsTty!=0 ){
2971 fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
2972 nRoundtrip, nArtifactSent, nArtifactRcvd);
2973 }
@@ -3016,18 +3026,20 @@
3026 }else if( rSkew*24.0*3600.0 < -10.0 ){
3027 fossil_warning("*** time skew *** server is slow by %s",
3028 db_timespan_name(-rSkew));
3029 g.clockSkewSeen = 1;
3030 }
3031 if( bOutIsTty==0 && (syncFlags & SYNC_QUIET)==0 ){
3032 fossil_print(zBriefFormat /*works-like:"%d%d%d"*/,
3033 nRoundtrip, nArtifactSent, nArtifactRcvd);
3034 fossil_force_newline();
3035 }
3036 fossil_force_newline();
3037 if( g.zHttpCmd==0 ){
3038 if( syncFlags & SYNC_QUIET ){
3039 /* no-op */
3040 }else if( syncFlags & SYNC_VERBOSE ){
3041 fossil_print(
3042 "%s done, wire bytes sent: %lld received: %lld remote: %s%s\n",
3043 zOpType, nSent, nRcvd,
3044 (g.url.name && g.url.name[0]!='\0') ? g.url.name : "",
3045 (g.zIpAddr && g.zIpAddr[0]!='\0'
3046
+7 -4
--- src/xsystem.c
+++ src/xsystem.c
@@ -31,10 +31,13 @@
3131
*/
3232
#include "config.h"
3333
#include "xsystem.h"
3434
#include "qrf.h"
3535
#include <time.h>
36
+#ifdef _WIN32
37
+# include <windows.h>
38
+#endif
3639
3740
3841
/* Date and time */
3942
void xsystem_date(int argc, char **argv){
4043
(void)argc;
@@ -41,11 +44,11 @@
4144
(void)argv;
4245
fossil_print("%z = ", cgi_iso8601_datestamp());
4346
fossil_print("%z\n", cgi_rfc822_datestamp(time(0)));
4447
}
4548
46
-/* Present working diretory */
49
+/* Present working directory */
4750
void xsystem_pwd(int argc, char **argv){
4851
char *zPwd = file_getcwd(0, 0);
4952
fossil_print("%z\n", zPwd);
5053
}
5154
@@ -168,11 +171,11 @@
168171
file_directory_list_free(azList);
169172
}
170173
}
171174
172175
/*
173
-** Return arguments to ORDER BY that will correctly sort the entires.
176
+** Return arguments to ORDER BY that will correctly sort the entries.
174177
*/
175178
static const char *xsystem_ls_orderby(int mFlags){
176179
static const char *zSortTypes[] = {
177180
"fn COLLATE NOCASE",
178181
"mtime DESC",
@@ -343,11 +346,11 @@
343346
344347
/* List files "ls"
345348
** Options:
346349
**
347350
** -a Show files that begin with "."
348
-** -C List by colums
351
+** -C List by columns
349352
** --color=WHEN Colorize output?
350353
** -d Show just directory names, not content
351354
** -l Long listing
352355
** -m Comma-separated list
353356
** -r Reverse sort
@@ -473,11 +476,11 @@
473476
/*
474477
** COMMAND: system
475478
**
476479
** Usage: %fossil system COMMAND ARGS...
477480
**
478
-** Often abbreviated as just "fossil sys", this command provides primative,
481
+** Often abbreviated as just "fossil sys", this command provides primitive,
479482
** low-level unix-like commands for use on systems that lack those commands
480483
** natively.
481484
**
482485
** Type "fossil sys help" for a list of available commands.
483486
**
484487
--- src/xsystem.c
+++ src/xsystem.c
@@ -31,10 +31,13 @@
31 */
32 #include "config.h"
33 #include "xsystem.h"
34 #include "qrf.h"
35 #include <time.h>
 
 
 
36
37
38 /* Date and time */
39 void xsystem_date(int argc, char **argv){
40 (void)argc;
@@ -41,11 +44,11 @@
41 (void)argv;
42 fossil_print("%z = ", cgi_iso8601_datestamp());
43 fossil_print("%z\n", cgi_rfc822_datestamp(time(0)));
44 }
45
46 /* Present working diretory */
47 void xsystem_pwd(int argc, char **argv){
48 char *zPwd = file_getcwd(0, 0);
49 fossil_print("%z\n", zPwd);
50 }
51
@@ -168,11 +171,11 @@
168 file_directory_list_free(azList);
169 }
170 }
171
172 /*
173 ** Return arguments to ORDER BY that will correctly sort the entires.
174 */
175 static const char *xsystem_ls_orderby(int mFlags){
176 static const char *zSortTypes[] = {
177 "fn COLLATE NOCASE",
178 "mtime DESC",
@@ -343,11 +346,11 @@
343
344 /* List files "ls"
345 ** Options:
346 **
347 ** -a Show files that begin with "."
348 ** -C List by colums
349 ** --color=WHEN Colorize output?
350 ** -d Show just directory names, not content
351 ** -l Long listing
352 ** -m Comma-separated list
353 ** -r Reverse sort
@@ -473,11 +476,11 @@
473 /*
474 ** COMMAND: system
475 **
476 ** Usage: %fossil system COMMAND ARGS...
477 **
478 ** Often abbreviated as just "fossil sys", this command provides primative,
479 ** low-level unix-like commands for use on systems that lack those commands
480 ** natively.
481 **
482 ** Type "fossil sys help" for a list of available commands.
483 **
484
--- src/xsystem.c
+++ src/xsystem.c
@@ -31,10 +31,13 @@
31 */
32 #include "config.h"
33 #include "xsystem.h"
34 #include "qrf.h"
35 #include <time.h>
36 #ifdef _WIN32
37 # include <windows.h>
38 #endif
39
40
41 /* Date and time */
42 void xsystem_date(int argc, char **argv){
43 (void)argc;
@@ -41,11 +44,11 @@
44 (void)argv;
45 fossil_print("%z = ", cgi_iso8601_datestamp());
46 fossil_print("%z\n", cgi_rfc822_datestamp(time(0)));
47 }
48
49 /* Present working directory */
50 void xsystem_pwd(int argc, char **argv){
51 char *zPwd = file_getcwd(0, 0);
52 fossil_print("%z\n", zPwd);
53 }
54
@@ -168,11 +171,11 @@
171 file_directory_list_free(azList);
172 }
173 }
174
175 /*
176 ** Return arguments to ORDER BY that will correctly sort the entries.
177 */
178 static const char *xsystem_ls_orderby(int mFlags){
179 static const char *zSortTypes[] = {
180 "fn COLLATE NOCASE",
181 "mtime DESC",
@@ -343,11 +346,11 @@
346
347 /* List files "ls"
348 ** Options:
349 **
350 ** -a Show files that begin with "."
351 ** -C List by columns
352 ** --color=WHEN Colorize output?
353 ** -d Show just directory names, not content
354 ** -l Long listing
355 ** -m Comma-separated list
356 ** -r Reverse sort
@@ -473,11 +476,11 @@
476 /*
477 ** COMMAND: system
478 **
479 ** Usage: %fossil system COMMAND ARGS...
480 **
481 ** Often abbreviated as just "fossil sys", this command provides primitive,
482 ** low-level unix-like commands for use on systems that lack those commands
483 ** natively.
484 **
485 ** Type "fossil sys help" for a list of available commands.
486 **
487
+7 -4
--- src/xsystem.c
+++ src/xsystem.c
@@ -31,10 +31,13 @@
3131
*/
3232
#include "config.h"
3333
#include "xsystem.h"
3434
#include "qrf.h"
3535
#include <time.h>
36
+#ifdef _WIN32
37
+# include <windows.h>
38
+#endif
3639
3740
3841
/* Date and time */
3942
void xsystem_date(int argc, char **argv){
4043
(void)argc;
@@ -41,11 +44,11 @@
4144
(void)argv;
4245
fossil_print("%z = ", cgi_iso8601_datestamp());
4346
fossil_print("%z\n", cgi_rfc822_datestamp(time(0)));
4447
}
4548
46
-/* Present working diretory */
49
+/* Present working directory */
4750
void xsystem_pwd(int argc, char **argv){
4851
char *zPwd = file_getcwd(0, 0);
4952
fossil_print("%z\n", zPwd);
5053
}
5154
@@ -168,11 +171,11 @@
168171
file_directory_list_free(azList);
169172
}
170173
}
171174
172175
/*
173
-** Return arguments to ORDER BY that will correctly sort the entires.
176
+** Return arguments to ORDER BY that will correctly sort the entries.
174177
*/
175178
static const char *xsystem_ls_orderby(int mFlags){
176179
static const char *zSortTypes[] = {
177180
"fn COLLATE NOCASE",
178181
"mtime DESC",
@@ -343,11 +346,11 @@
343346
344347
/* List files "ls"
345348
** Options:
346349
**
347350
** -a Show files that begin with "."
348
-** -C List by colums
351
+** -C List by columns
349352
** --color=WHEN Colorize output?
350353
** -d Show just directory names, not content
351354
** -l Long listing
352355
** -m Comma-separated list
353356
** -r Reverse sort
@@ -473,11 +476,11 @@
473476
/*
474477
** COMMAND: system
475478
**
476479
** Usage: %fossil system COMMAND ARGS...
477480
**
478
-** Often abbreviated as just "fossil sys", this command provides primative,
481
+** Often abbreviated as just "fossil sys", this command provides primitive,
479482
** low-level unix-like commands for use on systems that lack those commands
480483
** natively.
481484
**
482485
** Type "fossil sys help" for a list of available commands.
483486
**
484487
--- src/xsystem.c
+++ src/xsystem.c
@@ -31,10 +31,13 @@
31 */
32 #include "config.h"
33 #include "xsystem.h"
34 #include "qrf.h"
35 #include <time.h>
 
 
 
36
37
38 /* Date and time */
39 void xsystem_date(int argc, char **argv){
40 (void)argc;
@@ -41,11 +44,11 @@
41 (void)argv;
42 fossil_print("%z = ", cgi_iso8601_datestamp());
43 fossil_print("%z\n", cgi_rfc822_datestamp(time(0)));
44 }
45
46 /* Present working diretory */
47 void xsystem_pwd(int argc, char **argv){
48 char *zPwd = file_getcwd(0, 0);
49 fossil_print("%z\n", zPwd);
50 }
51
@@ -168,11 +171,11 @@
168 file_directory_list_free(azList);
169 }
170 }
171
172 /*
173 ** Return arguments to ORDER BY that will correctly sort the entires.
174 */
175 static const char *xsystem_ls_orderby(int mFlags){
176 static const char *zSortTypes[] = {
177 "fn COLLATE NOCASE",
178 "mtime DESC",
@@ -343,11 +346,11 @@
343
344 /* List files "ls"
345 ** Options:
346 **
347 ** -a Show files that begin with "."
348 ** -C List by colums
349 ** --color=WHEN Colorize output?
350 ** -d Show just directory names, not content
351 ** -l Long listing
352 ** -m Comma-separated list
353 ** -r Reverse sort
@@ -473,11 +476,11 @@
473 /*
474 ** COMMAND: system
475 **
476 ** Usage: %fossil system COMMAND ARGS...
477 **
478 ** Often abbreviated as just "fossil sys", this command provides primative,
479 ** low-level unix-like commands for use on systems that lack those commands
480 ** natively.
481 **
482 ** Type "fossil sys help" for a list of available commands.
483 **
484
--- src/xsystem.c
+++ src/xsystem.c
@@ -31,10 +31,13 @@
31 */
32 #include "config.h"
33 #include "xsystem.h"
34 #include "qrf.h"
35 #include <time.h>
36 #ifdef _WIN32
37 # include <windows.h>
38 #endif
39
40
41 /* Date and time */
42 void xsystem_date(int argc, char **argv){
43 (void)argc;
@@ -41,11 +44,11 @@
44 (void)argv;
45 fossil_print("%z = ", cgi_iso8601_datestamp());
46 fossil_print("%z\n", cgi_rfc822_datestamp(time(0)));
47 }
48
49 /* Present working directory */
50 void xsystem_pwd(int argc, char **argv){
51 char *zPwd = file_getcwd(0, 0);
52 fossil_print("%z\n", zPwd);
53 }
54
@@ -168,11 +171,11 @@
171 file_directory_list_free(azList);
172 }
173 }
174
175 /*
176 ** Return arguments to ORDER BY that will correctly sort the entries.
177 */
178 static const char *xsystem_ls_orderby(int mFlags){
179 static const char *zSortTypes[] = {
180 "fn COLLATE NOCASE",
181 "mtime DESC",
@@ -343,11 +346,11 @@
346
347 /* List files "ls"
348 ** Options:
349 **
350 ** -a Show files that begin with "."
351 ** -C List by columns
352 ** --color=WHEN Colorize output?
353 ** -d Show just directory names, not content
354 ** -l Long listing
355 ** -m Comma-separated list
356 ** -r Reverse sort
@@ -473,11 +476,11 @@
476 /*
477 ** COMMAND: system
478 **
479 ** Usage: %fossil system COMMAND ARGS...
480 **
481 ** Often abbreviated as just "fossil sys", this command provides primitive,
482 ** low-level unix-like commands for use on systems that lack those commands
483 ** natively.
484 **
485 ** Type "fossil sys help" for a list of available commands.
486 **
487
+3 -3
--- src/zip.c
+++ src/zip.c
@@ -230,11 +230,11 @@
230230
dosTime = (H<<11) + (M<<5) + (S>>1);
231231
dosDate = ((y-1980)<<9) + (m<<5) + d;
232232
}
233233
234234
/*
235
-** Set the date and time from a julian day number.
235
+** Set the date and time from a Julian day number.
236236
*/
237237
void zip_set_timedate(double rDate){
238238
char *zDate = db_text(0, "SELECT datetime(%.17g)", rDate);
239239
zip_set_timedate_from_str(zDate);
240240
fossil_free(zDate);
@@ -267,11 +267,11 @@
267267
char zHdr[30];
268268
char zExTime[13];
269269
char zBuf[100];
270270
char zOutBuf[100000];
271271
272
- /* Fill in as much of the header as we know.
272
+ /* Fill inasmuch of the header as we know.
273273
*/
274274
nameLen = (int)strlen(zName);
275275
if( nameLen==0 ) return;
276276
nBlob = pFile ? blob_size(pFile) : 0;
277277
if( pFile ){ /* This is a file, possibly empty... */
@@ -984,11 +984,11 @@
984984
** part of the name= value after the / is the download
985985
** filename. If no check-in is specified by either
986986
** name= or r=, then the name of the main branch
987987
** (usually "trunk") is used.
988988
**
989
-** in=PATTERN Only include files that match the comma-separate
989
+** in=PATTERN Only include files that match the comma-separated
990990
** list of GLOB patterns in PATTERN, as with ex=
991991
**
992992
** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
993993
** comma-separated list of GLOB patterns, where each
994994
** pattern can optionally be quoted using ".." or '..'.
995995
--- src/zip.c
+++ src/zip.c
@@ -230,11 +230,11 @@
230 dosTime = (H<<11) + (M<<5) + (S>>1);
231 dosDate = ((y-1980)<<9) + (m<<5) + d;
232 }
233
234 /*
235 ** Set the date and time from a julian day number.
236 */
237 void zip_set_timedate(double rDate){
238 char *zDate = db_text(0, "SELECT datetime(%.17g)", rDate);
239 zip_set_timedate_from_str(zDate);
240 fossil_free(zDate);
@@ -267,11 +267,11 @@
267 char zHdr[30];
268 char zExTime[13];
269 char zBuf[100];
270 char zOutBuf[100000];
271
272 /* Fill in as much of the header as we know.
273 */
274 nameLen = (int)strlen(zName);
275 if( nameLen==0 ) return;
276 nBlob = pFile ? blob_size(pFile) : 0;
277 if( pFile ){ /* This is a file, possibly empty... */
@@ -984,11 +984,11 @@
984 ** part of the name= value after the / is the download
985 ** filename. If no check-in is specified by either
986 ** name= or r=, then the name of the main branch
987 ** (usually "trunk") is used.
988 **
989 ** in=PATTERN Only include files that match the comma-separate
990 ** list of GLOB patterns in PATTERN, as with ex=
991 **
992 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
993 ** comma-separated list of GLOB patterns, where each
994 ** pattern can optionally be quoted using ".." or '..'.
995
--- src/zip.c
+++ src/zip.c
@@ -230,11 +230,11 @@
230 dosTime = (H<<11) + (M<<5) + (S>>1);
231 dosDate = ((y-1980)<<9) + (m<<5) + d;
232 }
233
234 /*
235 ** Set the date and time from a Julian day number.
236 */
237 void zip_set_timedate(double rDate){
238 char *zDate = db_text(0, "SELECT datetime(%.17g)", rDate);
239 zip_set_timedate_from_str(zDate);
240 fossil_free(zDate);
@@ -267,11 +267,11 @@
267 char zHdr[30];
268 char zExTime[13];
269 char zBuf[100];
270 char zOutBuf[100000];
271
272 /* Fill inasmuch of the header as we know.
273 */
274 nameLen = (int)strlen(zName);
275 if( nameLen==0 ) return;
276 nBlob = pFile ? blob_size(pFile) : 0;
277 if( pFile ){ /* This is a file, possibly empty... */
@@ -984,11 +984,11 @@
984 ** part of the name= value after the / is the download
985 ** filename. If no check-in is specified by either
986 ** name= or r=, then the name of the main branch
987 ** (usually "trunk") is used.
988 **
989 ** in=PATTERN Only include files that match the comma-separated
990 ** list of GLOB patterns in PATTERN, as with ex=
991 **
992 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
993 ** comma-separated list of GLOB patterns, where each
994 ** pattern can optionally be quoted using ".." or '..'.
995
--- tools/codecheck1.c
+++ tools/codecheck1.c
@@ -443,11 +443,11 @@
443443
const struct FmtFunc *pB = (const struct FmtFunc*)pBB;
444444
return strcmp(pA->zFName, pB->zFName);
445445
}
446446
447447
/*
448
-** Determine if the indentifier zIdent of length nIndent is a Fossil
448
+** Determine if the identifier zIdent of length nIndent is a Fossil
449449
** internal interface that uses a printf-style argument. Return zero if not.
450450
** Return the index of the format string if true with the left-most
451451
** argument having an index of 1.
452452
*/
453453
static int isFormatFunc(const char *zIdent, int nIdent, unsigned *pFlags){
454454
--- tools/codecheck1.c
+++ tools/codecheck1.c
@@ -443,11 +443,11 @@
443 const struct FmtFunc *pB = (const struct FmtFunc*)pBB;
444 return strcmp(pA->zFName, pB->zFName);
445 }
446
447 /*
448 ** Determine if the indentifier zIdent of length nIndent is a Fossil
449 ** internal interface that uses a printf-style argument. Return zero if not.
450 ** Return the index of the format string if true with the left-most
451 ** argument having an index of 1.
452 */
453 static int isFormatFunc(const char *zIdent, int nIdent, unsigned *pFlags){
454
--- tools/codecheck1.c
+++ tools/codecheck1.c
@@ -443,11 +443,11 @@
443 const struct FmtFunc *pB = (const struct FmtFunc*)pBB;
444 return strcmp(pA->zFName, pB->zFName);
445 }
446
447 /*
448 ** Determine if the identifier zIdent of length nIndent is a Fossil
449 ** internal interface that uses a printf-style argument. Return zero if not.
450 ** Return the index of the format string if true with the left-most
451 ** argument having an index of 1.
452 */
453 static int isFormatFunc(const char *zIdent, int nIdent, unsigned *pFlags){
454
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -247,10 +247,11 @@
247247
-DSQLITE_ENABLE_DBSTAT_VTAB
248248
-DSQLITE_ENABLE_EXPLAIN_COMMENTS
249249
-DSQLITE_ENABLE_FTS4
250250
-DSQLITE_ENABLE_FTS5
251251
-DSQLITE_ENABLE_MATH_FUNCTIONS
252
+ -DSQLITE_ENABLE_PERCENTILE
252253
-DSQLITE_ENABLE_SETLK_TIMEOUT
253254
-DSQLITE_ENABLE_STMTVTAB
254255
-DSQLITE_HAVE_ZLIB
255256
-DSQLITE_ENABLE_DBPAGE_VTAB
256257
-DSQLITE_TRUSTED_SCHEMA=0
257258
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -247,10 +247,11 @@
247 -DSQLITE_ENABLE_DBSTAT_VTAB
248 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
249 -DSQLITE_ENABLE_FTS4
250 -DSQLITE_ENABLE_FTS5
251 -DSQLITE_ENABLE_MATH_FUNCTIONS
 
252 -DSQLITE_ENABLE_SETLK_TIMEOUT
253 -DSQLITE_ENABLE_STMTVTAB
254 -DSQLITE_HAVE_ZLIB
255 -DSQLITE_ENABLE_DBPAGE_VTAB
256 -DSQLITE_TRUSTED_SCHEMA=0
257
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -247,10 +247,11 @@
247 -DSQLITE_ENABLE_DBSTAT_VTAB
248 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
249 -DSQLITE_ENABLE_FTS4
250 -DSQLITE_ENABLE_FTS5
251 -DSQLITE_ENABLE_MATH_FUNCTIONS
252 -DSQLITE_ENABLE_PERCENTILE
253 -DSQLITE_ENABLE_SETLK_TIMEOUT
254 -DSQLITE_ENABLE_STMTVTAB
255 -DSQLITE_HAVE_ZLIB
256 -DSQLITE_ENABLE_DBPAGE_VTAB
257 -DSQLITE_TRUSTED_SCHEMA=0
258
+61 -23
--- tools/mkindex.c
+++ tools/mkindex.c
@@ -17,15 +17,38 @@
1717
**
1818
** This utility program scans Fossil source text looking for specially
1919
** formatted comments and generates C source code for constant tables
2020
** that define the behavior of commands, webpages, and settings.
2121
**
22
+** USAGE:
23
+**
24
+** mkindex *.c >page_index.h
25
+**
26
+** Run this command with arguments that are all input source files to
27
+** scan. Generated C code appears on standard output. The generated
28
+** C code includes structures that:
29
+**
30
+** * Map command names to the C-language functions that implement
31
+** those command.
32
+**
33
+** * Map webpage names to the C-language functions that implement
34
+** those web pages.
35
+**
36
+** * Map settings into attributes, such as they default value for
37
+** each setting, and the kind of value (boolean, multi-line, etc).
38
+**
39
+** * Provide help text for commands, webpages, settings, and other
40
+** miscellanous help topics.
41
+**
42
+** COMMENT TEXT THAT THIS PROGRAM LOOKS FOR:
43
+**
2244
** The source code is scanned for comment lines of the form:
2345
**
2446
** WEBPAGE: /abc/xyz
2547
** COMMAND: cmdname
2648
** SETTING: access-log
49
+** TOPIC: help-topic
2750
**
2851
** The WEBPAGE and COMMAND comments should be followed by a function that
2952
** implements the webpage or command. The form of this function is:
3053
**
3154
** void function_name(void){
@@ -75,10 +98,22 @@
7598
** SETTING: pgp-command
7699
** DEFAULT: gpg --clearsign -o
77100
**
78101
** If no default is supplied, the default is assumed to be an empty string
79102
** or "off" in the case of a boolean.
103
+**
104
+** A TOPIC: is followed by help text for the named topic.
105
+**
106
+** OUTPUTS:
107
+**
108
+** The output is C-language text to define and initialize a constant
109
+** array of CmdOrPage objects named "aCommand[]". That array is a global
110
+** variable. The dispatch.c source file defines the CmdOrPage object and
111
+** deals with the aCommand[] global variable.
112
+**
113
+** The output also contains a constant array of Setting objects named
114
+** aSetting[]. The Setting object is defined in db.c.
80115
*/
81116
#include <stdio.h>
82117
#include <stdlib.h>
83118
#include <assert.h>
84119
#include <string.h>
@@ -85,26 +120,27 @@
85120
86121
/***************************************************************************
87122
** These macros must match similar macros in dispatch.c.
88123
**
89124
** Allowed values for CmdOrPage.eCmdFlags. */
90
-#define CMDFLAG_1ST_TIER 0x00001 /* Most important commands */
91
-#define CMDFLAG_2ND_TIER 0x00002 /* Obscure and seldom used commands */
92
-#define CMDFLAG_TEST 0x00004 /* Commands for testing only */
93
-#define CMDFLAG_WEBPAGE 0x00008 /* Web pages */
94
-#define CMDFLAG_COMMAND 0x00010 /* A command */
95
-#define CMDFLAG_SETTING 0x00020 /* A setting */
96
-#define CMDFLAG_VERSIONABLE 0x00040 /* A versionable setting */
97
-#define CMDFLAG_BLOCKTEXT 0x00080 /* Multi-line text setting */
98
-#define CMDFLAG_BOOLEAN 0x00100 /* A boolean setting */
99
-#define CMDFLAG_RAWCONTENT 0x00200 /* Do not interpret webpage content */
100
-#define CMDFLAG_SENSITIVE 0x00400 /* Security-sensitive setting */
101
-#define CMDFLAG_HIDDEN 0x00800 /* Elide from most listings */
102
-#define CMDFLAG_LDAVG_EXEMPT 0x01000 /* Exempt from load_control() */
103
-#define CMDFLAG_ALIAS 0x02000 /* Command aliases */
104
-#define CMDFLAG_KEEPEMPTY 0x04000 /* Do not unset empty settings */
105
-#define CMDFLAG_ABBREVSUBCMD 0x08000 /* Abbreviated subcmd in help text */
125
+#define CMDFLAG_1ST_TIER 0x000001 /* Most important commands */
126
+#define CMDFLAG_2ND_TIER 0x000002 /* Obscure and seldom used commands */
127
+#define CMDFLAG_TEST 0x000004 /* Commands for testing only */
128
+#define CMDFLAG_WEBPAGE 0x000008 /* Web pages */
129
+#define CMDFLAG_COMMAND 0x000010 /* A command */
130
+#define CMDFLAG_SETTING 0x000020 /* A setting */
131
+#define CMDFLAG_VERSIONABLE 0x000040 /* A versionable setting */
132
+#define CMDFLAG_BLOCKTEXT 0x000080 /* Multi-line text setting */
133
+#define CMDFLAG_BOOLEAN 0x000100 /* A boolean setting */
134
+#define CMDFLAG_RAWCONTENT 0x000200 /* Do not interpret webpage content */
135
+#define CMDFLAG_SENSITIVE 0x000400 /* Security-sensitive setting */
136
+#define CMDFLAG_HIDDEN 0x000800 /* Elide from most listings */
137
+#define CMDFLAG_LDAVG_EXEMPT 0x001000 /* Exempt from load_control() */
138
+#define CMDFLAG_ALIAS 0x002000 /* Command aliases */
139
+#define CMDFLAG_KEEPEMPTY 0x004000 /* Do not unset empty settings */
140
+#define CMDFLAG_ABBREVSUBCMD 0x008000 /* Abbreviated subcmd in help text */
141
+#define CMDFLAG_TOPIC 0x010000 /* A help topic */
106142
/**************************************************************************/
107143
108144
/*
109145
** Each entry looks like this:
110146
*/
@@ -343,20 +379,21 @@
343379
** Scan a line for a function that implements a web page or command.
344380
*/
345381
void scan_for_func(char *zLine){
346382
int i,j,k;
347383
char *z;
348
- int isSetting;
384
+ int hasFunc;
349385
if( nUsed<=nFixed ) return;
350386
if( strncmp(zLine, "**", 2)==0
351387
&& fossil_isspace(zLine[2])
352388
&& strlen(zLine)<sizeof(zHelp)-nHelp-1
353389
&& nUsed>nFixed
354390
&& strncmp(zLine,"** COMMAND:",11)!=0
355391
&& strncmp(zLine,"** WEBPAGE:",11)!=0
356392
&& strncmp(zLine,"** SETTING:",11)!=0
357393
&& strncmp(zLine,"** DEFAULT:",11)!=0
394
+ && strncmp(zLine,"** TOPIC:",9)!=0
358395
){
359396
if( zLine[2]=='\n' ){
360397
zHelp[nHelp++] = '\n';
361398
}else{
362399
if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -365,12 +402,12 @@
365402
}
366403
return;
367404
}
368405
for(i=0; fossil_isspace(zLine[i]); i++){}
369406
if( zLine[i]==0 ) return;
370
- isSetting = (aEntry[nFixed].eType & CMDFLAG_SETTING)!=0;
371
- if( !isSetting ){
407
+ hasFunc = (aEntry[nFixed].eType & (CMDFLAG_SETTING|CMDFLAG_TOPIC))==0;
408
+ if( hasFunc ){
372409
if( strncmp(&zLine[i],"void",4)!=0 ){
373410
if( zLine[i]!='*' ) goto page_skip;
374411
return;
375412
}
376413
i += 4;
@@ -390,16 +427,16 @@
390427
}else{
391428
z = "";
392429
}
393430
for(k=nFixed; k<nUsed; k++){
394431
aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
395
- aEntry[k].zFunc = isSetting ? "0" : string_dup(&zLine[i], j);
432
+ aEntry[k].zFunc = hasFunc ? string_dup(&zLine[i], j) : "0";
396433
aEntry[k].zHelp = z;
397434
z = 0;
398435
aEntry[k].iHelp = nFixed;
399436
}
400
- if( !isSetting ){
437
+ if( hasFunc ){
401438
i+=j;
402439
while( fossil_isspace(zLine[i]) ){ i++; }
403440
if( zLine[i]!='(' ) goto page_skip;
404441
}
405442
nFixed = nUsed;
@@ -442,11 +479,11 @@
442479
"*/\n"
443480
);
444481
445482
/* Output declarations for all the action functions */
446483
for(i=0; i<nFixed; i++){
447
- if( aEntry[i].eType & CMDFLAG_SETTING ) continue;
484
+ if( aEntry[i].eType & (CMDFLAG_SETTING|CMDFLAG_TOPIC) ) continue;
448485
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
449486
printf("extern void %s(void);\n", aEntry[i].zFunc);
450487
if( aEntry[i].zIf ) printf("#endif\n");
451488
}
452489
@@ -479,11 +516,11 @@
479516
if( aEntry[i].zIf ){
480517
printf("%s", aEntry[i].zIf);
481518
}else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
482519
nWeb++;
483520
}
484
- printf(" { \"%.*s\",%*s%s,%*szHelp%03d, %3d, 0x%03x },\n",
521
+ printf(" { \"%.*s\",%*s%s,%*szHelp%03d, %3d, 0x%05x },\n",
485522
n, z,
486523
25-n, "",
487524
aEntry[i].zFunc,
488525
(int)(29-strlen(aEntry[i].zFunc)), "",
489526
aEntry[i].iHelp,
@@ -550,10 +587,11 @@
550587
scan_for_label("WEBPAGE:",zLine,CMDFLAG_WEBPAGE);
551588
scan_for_label("COMMAND:",zLine,CMDFLAG_COMMAND);
552589
scan_for_func(zLine);
553590
scan_for_label("SETTING:",zLine,CMDFLAG_SETTING);
554591
scan_for_default(zLine);
592
+ scan_for_label("TOPIC:",zLine,CMDFLAG_TOPIC);
555593
}
556594
fclose(in);
557595
nUsed = nFixed;
558596
}
559597
560598
--- tools/mkindex.c
+++ tools/mkindex.c
@@ -17,15 +17,38 @@
17 **
18 ** This utility program scans Fossil source text looking for specially
19 ** formatted comments and generates C source code for constant tables
20 ** that define the behavior of commands, webpages, and settings.
21 **
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22 ** The source code is scanned for comment lines of the form:
23 **
24 ** WEBPAGE: /abc/xyz
25 ** COMMAND: cmdname
26 ** SETTING: access-log
 
27 **
28 ** The WEBPAGE and COMMAND comments should be followed by a function that
29 ** implements the webpage or command. The form of this function is:
30 **
31 ** void function_name(void){
@@ -75,10 +98,22 @@
75 ** SETTING: pgp-command
76 ** DEFAULT: gpg --clearsign -o
77 **
78 ** If no default is supplied, the default is assumed to be an empty string
79 ** or "off" in the case of a boolean.
 
 
 
 
 
 
 
 
 
 
 
 
80 */
81 #include <stdio.h>
82 #include <stdlib.h>
83 #include <assert.h>
84 #include <string.h>
@@ -85,26 +120,27 @@
85
86 /***************************************************************************
87 ** These macros must match similar macros in dispatch.c.
88 **
89 ** Allowed values for CmdOrPage.eCmdFlags. */
90 #define CMDFLAG_1ST_TIER 0x00001 /* Most important commands */
91 #define CMDFLAG_2ND_TIER 0x00002 /* Obscure and seldom used commands */
92 #define CMDFLAG_TEST 0x00004 /* Commands for testing only */
93 #define CMDFLAG_WEBPAGE 0x00008 /* Web pages */
94 #define CMDFLAG_COMMAND 0x00010 /* A command */
95 #define CMDFLAG_SETTING 0x00020 /* A setting */
96 #define CMDFLAG_VERSIONABLE 0x00040 /* A versionable setting */
97 #define CMDFLAG_BLOCKTEXT 0x00080 /* Multi-line text setting */
98 #define CMDFLAG_BOOLEAN 0x00100 /* A boolean setting */
99 #define CMDFLAG_RAWCONTENT 0x00200 /* Do not interpret webpage content */
100 #define CMDFLAG_SENSITIVE 0x00400 /* Security-sensitive setting */
101 #define CMDFLAG_HIDDEN 0x00800 /* Elide from most listings */
102 #define CMDFLAG_LDAVG_EXEMPT 0x01000 /* Exempt from load_control() */
103 #define CMDFLAG_ALIAS 0x02000 /* Command aliases */
104 #define CMDFLAG_KEEPEMPTY 0x04000 /* Do not unset empty settings */
105 #define CMDFLAG_ABBREVSUBCMD 0x08000 /* Abbreviated subcmd in help text */
 
106 /**************************************************************************/
107
108 /*
109 ** Each entry looks like this:
110 */
@@ -343,20 +379,21 @@
343 ** Scan a line for a function that implements a web page or command.
344 */
345 void scan_for_func(char *zLine){
346 int i,j,k;
347 char *z;
348 int isSetting;
349 if( nUsed<=nFixed ) return;
350 if( strncmp(zLine, "**", 2)==0
351 && fossil_isspace(zLine[2])
352 && strlen(zLine)<sizeof(zHelp)-nHelp-1
353 && nUsed>nFixed
354 && strncmp(zLine,"** COMMAND:",11)!=0
355 && strncmp(zLine,"** WEBPAGE:",11)!=0
356 && strncmp(zLine,"** SETTING:",11)!=0
357 && strncmp(zLine,"** DEFAULT:",11)!=0
 
358 ){
359 if( zLine[2]=='\n' ){
360 zHelp[nHelp++] = '\n';
361 }else{
362 if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -365,12 +402,12 @@
365 }
366 return;
367 }
368 for(i=0; fossil_isspace(zLine[i]); i++){}
369 if( zLine[i]==0 ) return;
370 isSetting = (aEntry[nFixed].eType & CMDFLAG_SETTING)!=0;
371 if( !isSetting ){
372 if( strncmp(&zLine[i],"void",4)!=0 ){
373 if( zLine[i]!='*' ) goto page_skip;
374 return;
375 }
376 i += 4;
@@ -390,16 +427,16 @@
390 }else{
391 z = "";
392 }
393 for(k=nFixed; k<nUsed; k++){
394 aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
395 aEntry[k].zFunc = isSetting ? "0" : string_dup(&zLine[i], j);
396 aEntry[k].zHelp = z;
397 z = 0;
398 aEntry[k].iHelp = nFixed;
399 }
400 if( !isSetting ){
401 i+=j;
402 while( fossil_isspace(zLine[i]) ){ i++; }
403 if( zLine[i]!='(' ) goto page_skip;
404 }
405 nFixed = nUsed;
@@ -442,11 +479,11 @@
442 "*/\n"
443 );
444
445 /* Output declarations for all the action functions */
446 for(i=0; i<nFixed; i++){
447 if( aEntry[i].eType & CMDFLAG_SETTING ) continue;
448 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
449 printf("extern void %s(void);\n", aEntry[i].zFunc);
450 if( aEntry[i].zIf ) printf("#endif\n");
451 }
452
@@ -479,11 +516,11 @@
479 if( aEntry[i].zIf ){
480 printf("%s", aEntry[i].zIf);
481 }else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
482 nWeb++;
483 }
484 printf(" { \"%.*s\",%*s%s,%*szHelp%03d, %3d, 0x%03x },\n",
485 n, z,
486 25-n, "",
487 aEntry[i].zFunc,
488 (int)(29-strlen(aEntry[i].zFunc)), "",
489 aEntry[i].iHelp,
@@ -550,10 +587,11 @@
550 scan_for_label("WEBPAGE:",zLine,CMDFLAG_WEBPAGE);
551 scan_for_label("COMMAND:",zLine,CMDFLAG_COMMAND);
552 scan_for_func(zLine);
553 scan_for_label("SETTING:",zLine,CMDFLAG_SETTING);
554 scan_for_default(zLine);
 
555 }
556 fclose(in);
557 nUsed = nFixed;
558 }
559
560
--- tools/mkindex.c
+++ tools/mkindex.c
@@ -17,15 +17,38 @@
17 **
18 ** This utility program scans Fossil source text looking for specially
19 ** formatted comments and generates C source code for constant tables
20 ** that define the behavior of commands, webpages, and settings.
21 **
22 ** USAGE:
23 **
24 ** mkindex *.c >page_index.h
25 **
26 ** Run this command with arguments that are all input source files to
27 ** scan. Generated C code appears on standard output. The generated
28 ** C code includes structures that:
29 **
30 ** * Map command names to the C-language functions that implement
31 ** those command.
32 **
33 ** * Map webpage names to the C-language functions that implement
34 ** those web pages.
35 **
36 ** * Map settings into attributes, such as they default value for
37 ** each setting, and the kind of value (boolean, multi-line, etc).
38 **
39 ** * Provide help text for commands, webpages, settings, and other
40 ** miscellanous help topics.
41 **
42 ** COMMENT TEXT THAT THIS PROGRAM LOOKS FOR:
43 **
44 ** The source code is scanned for comment lines of the form:
45 **
46 ** WEBPAGE: /abc/xyz
47 ** COMMAND: cmdname
48 ** SETTING: access-log
49 ** TOPIC: help-topic
50 **
51 ** The WEBPAGE and COMMAND comments should be followed by a function that
52 ** implements the webpage or command. The form of this function is:
53 **
54 ** void function_name(void){
@@ -75,10 +98,22 @@
98 ** SETTING: pgp-command
99 ** DEFAULT: gpg --clearsign -o
100 **
101 ** If no default is supplied, the default is assumed to be an empty string
102 ** or "off" in the case of a boolean.
103 **
104 ** A TOPIC: is followed by help text for the named topic.
105 **
106 ** OUTPUTS:
107 **
108 ** The output is C-language text to define and initialize a constant
109 ** array of CmdOrPage objects named "aCommand[]". That array is a global
110 ** variable. The dispatch.c source file defines the CmdOrPage object and
111 ** deals with the aCommand[] global variable.
112 **
113 ** The output also contains a constant array of Setting objects named
114 ** aSetting[]. The Setting object is defined in db.c.
115 */
116 #include <stdio.h>
117 #include <stdlib.h>
118 #include <assert.h>
119 #include <string.h>
@@ -85,26 +120,27 @@
120
121 /***************************************************************************
122 ** These macros must match similar macros in dispatch.c.
123 **
124 ** Allowed values for CmdOrPage.eCmdFlags. */
125 #define CMDFLAG_1ST_TIER 0x000001 /* Most important commands */
126 #define CMDFLAG_2ND_TIER 0x000002 /* Obscure and seldom used commands */
127 #define CMDFLAG_TEST 0x000004 /* Commands for testing only */
128 #define CMDFLAG_WEBPAGE 0x000008 /* Web pages */
129 #define CMDFLAG_COMMAND 0x000010 /* A command */
130 #define CMDFLAG_SETTING 0x000020 /* A setting */
131 #define CMDFLAG_VERSIONABLE 0x000040 /* A versionable setting */
132 #define CMDFLAG_BLOCKTEXT 0x000080 /* Multi-line text setting */
133 #define CMDFLAG_BOOLEAN 0x000100 /* A boolean setting */
134 #define CMDFLAG_RAWCONTENT 0x000200 /* Do not interpret webpage content */
135 #define CMDFLAG_SENSITIVE 0x000400 /* Security-sensitive setting */
136 #define CMDFLAG_HIDDEN 0x000800 /* Elide from most listings */
137 #define CMDFLAG_LDAVG_EXEMPT 0x001000 /* Exempt from load_control() */
138 #define CMDFLAG_ALIAS 0x002000 /* Command aliases */
139 #define CMDFLAG_KEEPEMPTY 0x004000 /* Do not unset empty settings */
140 #define CMDFLAG_ABBREVSUBCMD 0x008000 /* Abbreviated subcmd in help text */
141 #define CMDFLAG_TOPIC 0x010000 /* A help topic */
142 /**************************************************************************/
143
144 /*
145 ** Each entry looks like this:
146 */
@@ -343,20 +379,21 @@
379 ** Scan a line for a function that implements a web page or command.
380 */
381 void scan_for_func(char *zLine){
382 int i,j,k;
383 char *z;
384 int hasFunc;
385 if( nUsed<=nFixed ) return;
386 if( strncmp(zLine, "**", 2)==0
387 && fossil_isspace(zLine[2])
388 && strlen(zLine)<sizeof(zHelp)-nHelp-1
389 && nUsed>nFixed
390 && strncmp(zLine,"** COMMAND:",11)!=0
391 && strncmp(zLine,"** WEBPAGE:",11)!=0
392 && strncmp(zLine,"** SETTING:",11)!=0
393 && strncmp(zLine,"** DEFAULT:",11)!=0
394 && strncmp(zLine,"** TOPIC:",9)!=0
395 ){
396 if( zLine[2]=='\n' ){
397 zHelp[nHelp++] = '\n';
398 }else{
399 if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -365,12 +402,12 @@
402 }
403 return;
404 }
405 for(i=0; fossil_isspace(zLine[i]); i++){}
406 if( zLine[i]==0 ) return;
407 hasFunc = (aEntry[nFixed].eType & (CMDFLAG_SETTING|CMDFLAG_TOPIC))==0;
408 if( hasFunc ){
409 if( strncmp(&zLine[i],"void",4)!=0 ){
410 if( zLine[i]!='*' ) goto page_skip;
411 return;
412 }
413 i += 4;
@@ -390,16 +427,16 @@
427 }else{
428 z = "";
429 }
430 for(k=nFixed; k<nUsed; k++){
431 aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
432 aEntry[k].zFunc = hasFunc ? string_dup(&zLine[i], j) : "0";
433 aEntry[k].zHelp = z;
434 z = 0;
435 aEntry[k].iHelp = nFixed;
436 }
437 if( hasFunc ){
438 i+=j;
439 while( fossil_isspace(zLine[i]) ){ i++; }
440 if( zLine[i]!='(' ) goto page_skip;
441 }
442 nFixed = nUsed;
@@ -442,11 +479,11 @@
479 "*/\n"
480 );
481
482 /* Output declarations for all the action functions */
483 for(i=0; i<nFixed; i++){
484 if( aEntry[i].eType & (CMDFLAG_SETTING|CMDFLAG_TOPIC) ) continue;
485 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
486 printf("extern void %s(void);\n", aEntry[i].zFunc);
487 if( aEntry[i].zIf ) printf("#endif\n");
488 }
489
@@ -479,11 +516,11 @@
516 if( aEntry[i].zIf ){
517 printf("%s", aEntry[i].zIf);
518 }else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
519 nWeb++;
520 }
521 printf(" { \"%.*s\",%*s%s,%*szHelp%03d, %3d, 0x%05x },\n",
522 n, z,
523 25-n, "",
524 aEntry[i].zFunc,
525 (int)(29-strlen(aEntry[i].zFunc)), "",
526 aEntry[i].iHelp,
@@ -550,10 +587,11 @@
587 scan_for_label("WEBPAGE:",zLine,CMDFLAG_WEBPAGE);
588 scan_for_label("COMMAND:",zLine,CMDFLAG_COMMAND);
589 scan_for_func(zLine);
590 scan_for_label("SETTING:",zLine,CMDFLAG_SETTING);
591 scan_for_default(zLine);
592 scan_for_label("TOPIC:",zLine,CMDFLAG_TOPIC);
593 }
594 fclose(in);
595 nUsed = nFixed;
596 }
597
598
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -26,13 +26,13 @@
2626
CFLAGS = -o
2727
BCC = $(DMDIR)\bin\dmc $(CFLAGS)
2828
TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
2929
LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
3030
31
-SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP
31
+SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP
3232
33
-SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
33
+SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
3434
3535
PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
3636
3737
SRC = add_.c ajax_.c alerts_.c allrepo_.c attach_.c backlink_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c chat_.c checkin_.c checkout_.c clearsign_.c clone_.c color_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c fileedit_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c hook_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c interwiki_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c match_.c md5_.c merge_.c merge3_.c moderate_.c name_.c patch_.c path_.c piechart_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c robot_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c terminal_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c xsystem_.c zip_.c
3838
3939
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -26,13 +26,13 @@
26 CFLAGS = -o
27 BCC = $(DMDIR)\bin\dmc $(CFLAGS)
28 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
29 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
30
31 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP
32
33 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
34
35 PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
36
37 SRC = add_.c ajax_.c alerts_.c allrepo_.c attach_.c backlink_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c chat_.c checkin_.c checkout_.c clearsign_.c clone_.c color_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c fileedit_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c hook_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c interwiki_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c match_.c md5_.c merge_.c merge3_.c moderate_.c name_.c patch_.c path_.c piechart_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c robot_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c terminal_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c xsystem_.c zip_.c
38
39
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -26,13 +26,13 @@
26 CFLAGS = -o
27 BCC = $(DMDIR)\bin\dmc $(CFLAGS)
28 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
29 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
30
31 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP
32
33 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE -DSQLITE_ENABLE_SETLK_TIMEOUT -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -DHAVE_USLEEP -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
34
35 PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
36
37 SRC = add_.c ajax_.c alerts_.c allrepo_.c attach_.c backlink_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c chat_.c checkin_.c checkout_.c clearsign_.c clone_.c color_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c fileedit_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c hook_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c interwiki_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c match_.c md5_.c merge_.c merge3_.c moderate_.c name_.c patch_.c path_.c piechart_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c robot_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c terminal_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c xsystem_.c zip_.c
38
39
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2558,10 +2558,11 @@
25582558
-DSQLITE_ENABLE_DBSTAT_VTAB \
25592559
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
25602560
-DSQLITE_ENABLE_FTS4 \
25612561
-DSQLITE_ENABLE_FTS5 \
25622562
-DSQLITE_ENABLE_MATH_FUNCTIONS \
2563
+ -DSQLITE_ENABLE_PERCENTILE \
25632564
-DSQLITE_ENABLE_SETLK_TIMEOUT \
25642565
-DSQLITE_ENABLE_STMTVTAB \
25652566
-DSQLITE_HAVE_ZLIB \
25662567
-DSQLITE_ENABLE_DBPAGE_VTAB \
25672568
-DSQLITE_TRUSTED_SCHEMA=0 \
@@ -2588,10 +2589,11 @@
25882589
-DSQLITE_ENABLE_DBSTAT_VTAB \
25892590
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
25902591
-DSQLITE_ENABLE_FTS4 \
25912592
-DSQLITE_ENABLE_FTS5 \
25922593
-DSQLITE_ENABLE_MATH_FUNCTIONS \
2594
+ -DSQLITE_ENABLE_PERCENTILE \
25932595
-DSQLITE_ENABLE_SETLK_TIMEOUT \
25942596
-DSQLITE_ENABLE_STMTVTAB \
25952597
-DSQLITE_HAVE_ZLIB \
25962598
-DSQLITE_ENABLE_DBPAGE_VTAB \
25972599
-DSQLITE_TRUSTED_SCHEMA=0 \
25982600
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2558,10 +2558,11 @@
2558 -DSQLITE_ENABLE_DBSTAT_VTAB \
2559 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2560 -DSQLITE_ENABLE_FTS4 \
2561 -DSQLITE_ENABLE_FTS5 \
2562 -DSQLITE_ENABLE_MATH_FUNCTIONS \
 
2563 -DSQLITE_ENABLE_SETLK_TIMEOUT \
2564 -DSQLITE_ENABLE_STMTVTAB \
2565 -DSQLITE_HAVE_ZLIB \
2566 -DSQLITE_ENABLE_DBPAGE_VTAB \
2567 -DSQLITE_TRUSTED_SCHEMA=0 \
@@ -2588,10 +2589,11 @@
2588 -DSQLITE_ENABLE_DBSTAT_VTAB \
2589 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2590 -DSQLITE_ENABLE_FTS4 \
2591 -DSQLITE_ENABLE_FTS5 \
2592 -DSQLITE_ENABLE_MATH_FUNCTIONS \
 
2593 -DSQLITE_ENABLE_SETLK_TIMEOUT \
2594 -DSQLITE_ENABLE_STMTVTAB \
2595 -DSQLITE_HAVE_ZLIB \
2596 -DSQLITE_ENABLE_DBPAGE_VTAB \
2597 -DSQLITE_TRUSTED_SCHEMA=0 \
2598
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2558,10 +2558,11 @@
2558 -DSQLITE_ENABLE_DBSTAT_VTAB \
2559 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2560 -DSQLITE_ENABLE_FTS4 \
2561 -DSQLITE_ENABLE_FTS5 \
2562 -DSQLITE_ENABLE_MATH_FUNCTIONS \
2563 -DSQLITE_ENABLE_PERCENTILE \
2564 -DSQLITE_ENABLE_SETLK_TIMEOUT \
2565 -DSQLITE_ENABLE_STMTVTAB \
2566 -DSQLITE_HAVE_ZLIB \
2567 -DSQLITE_ENABLE_DBPAGE_VTAB \
2568 -DSQLITE_TRUSTED_SCHEMA=0 \
@@ -2588,10 +2589,11 @@
2589 -DSQLITE_ENABLE_DBSTAT_VTAB \
2590 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2591 -DSQLITE_ENABLE_FTS4 \
2592 -DSQLITE_ENABLE_FTS5 \
2593 -DSQLITE_ENABLE_MATH_FUNCTIONS \
2594 -DSQLITE_ENABLE_PERCENTILE \
2595 -DSQLITE_ENABLE_SETLK_TIMEOUT \
2596 -DSQLITE_ENABLE_STMTVTAB \
2597 -DSQLITE_HAVE_ZLIB \
2598 -DSQLITE_ENABLE_DBPAGE_VTAB \
2599 -DSQLITE_TRUSTED_SCHEMA=0 \
2600
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -316,10 +316,11 @@
316316
/DSQLITE_ENABLE_DBSTAT_VTAB \
317317
/DSQLITE_ENABLE_EXPLAIN_COMMENTS \
318318
/DSQLITE_ENABLE_FTS4 \
319319
/DSQLITE_ENABLE_FTS5 \
320320
/DSQLITE_ENABLE_MATH_FUNCTIONS \
321
+ /DSQLITE_ENABLE_PERCENTILE \
321322
/DSQLITE_ENABLE_SETLK_TIMEOUT \
322323
/DSQLITE_ENABLE_STMTVTAB \
323324
/DSQLITE_HAVE_ZLIB \
324325
/DSQLITE_ENABLE_DBPAGE_VTAB \
325326
/DSQLITE_TRUSTED_SCHEMA=0 \
@@ -343,10 +344,11 @@
343344
/DSQLITE_ENABLE_DBSTAT_VTAB \
344345
/DSQLITE_ENABLE_EXPLAIN_COMMENTS \
345346
/DSQLITE_ENABLE_FTS4 \
346347
/DSQLITE_ENABLE_FTS5 \
347348
/DSQLITE_ENABLE_MATH_FUNCTIONS \
349
+ /DSQLITE_ENABLE_PERCENTILE \
348350
/DSQLITE_ENABLE_SETLK_TIMEOUT \
349351
/DSQLITE_ENABLE_STMTVTAB \
350352
/DSQLITE_HAVE_ZLIB \
351353
/DSQLITE_ENABLE_DBPAGE_VTAB \
352354
/DSQLITE_TRUSTED_SCHEMA=0 \
353355
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -316,10 +316,11 @@
316 /DSQLITE_ENABLE_DBSTAT_VTAB \
317 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
318 /DSQLITE_ENABLE_FTS4 \
319 /DSQLITE_ENABLE_FTS5 \
320 /DSQLITE_ENABLE_MATH_FUNCTIONS \
 
321 /DSQLITE_ENABLE_SETLK_TIMEOUT \
322 /DSQLITE_ENABLE_STMTVTAB \
323 /DSQLITE_HAVE_ZLIB \
324 /DSQLITE_ENABLE_DBPAGE_VTAB \
325 /DSQLITE_TRUSTED_SCHEMA=0 \
@@ -343,10 +344,11 @@
343 /DSQLITE_ENABLE_DBSTAT_VTAB \
344 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
345 /DSQLITE_ENABLE_FTS4 \
346 /DSQLITE_ENABLE_FTS5 \
347 /DSQLITE_ENABLE_MATH_FUNCTIONS \
 
348 /DSQLITE_ENABLE_SETLK_TIMEOUT \
349 /DSQLITE_ENABLE_STMTVTAB \
350 /DSQLITE_HAVE_ZLIB \
351 /DSQLITE_ENABLE_DBPAGE_VTAB \
352 /DSQLITE_TRUSTED_SCHEMA=0 \
353
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -316,10 +316,11 @@
316 /DSQLITE_ENABLE_DBSTAT_VTAB \
317 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
318 /DSQLITE_ENABLE_FTS4 \
319 /DSQLITE_ENABLE_FTS5 \
320 /DSQLITE_ENABLE_MATH_FUNCTIONS \
321 /DSQLITE_ENABLE_PERCENTILE \
322 /DSQLITE_ENABLE_SETLK_TIMEOUT \
323 /DSQLITE_ENABLE_STMTVTAB \
324 /DSQLITE_HAVE_ZLIB \
325 /DSQLITE_ENABLE_DBPAGE_VTAB \
326 /DSQLITE_TRUSTED_SCHEMA=0 \
@@ -343,10 +344,11 @@
344 /DSQLITE_ENABLE_DBSTAT_VTAB \
345 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
346 /DSQLITE_ENABLE_FTS4 \
347 /DSQLITE_ENABLE_FTS5 \
348 /DSQLITE_ENABLE_MATH_FUNCTIONS \
349 /DSQLITE_ENABLE_PERCENTILE \
350 /DSQLITE_ENABLE_SETLK_TIMEOUT \
351 /DSQLITE_ENABLE_STMTVTAB \
352 /DSQLITE_HAVE_ZLIB \
353 /DSQLITE_ENABLE_DBPAGE_VTAB \
354 /DSQLITE_TRUSTED_SCHEMA=0 \
355
--- www/changes.wiki
+++ www/changes.wiki
@@ -23,10 +23,12 @@
2323
[/help/suggested-downloads|suggested-downloads setting], a
2424
link to [/download] named "Tarballs and ZIPs" appears in the
2525
[/sitemap] and thus on the hamburger menu.
2626
<li> The filenames for tarballs and ZIPs are now standardized to
2727
include a timestamp and a hash prefix.
28
+ <li> New "[/help/get|fossil get]" command downloads and unpacks a specific
29
+ check-in without having to clone the repository.
2830
</ol>
2931
<li> Timeline enhancements:<ol type="a">
3032
<li> A new "Simple" view is available. This is compromise between "Verbose"
3133
and "Compact" that shows only the check-in hash rather than the full
3234
detail section. There is an ellipsis that one can click on to see the
@@ -42,16 +44,19 @@
4244
<li> "No-graph" timelines (using the "ng" query parameter) now show
4345
branch colors and bare check-in circles on the left. The check-in
4446
circles appear, but no lines connecting them.
4547
([/timeline?ng|example]).
4648
</ol>
47
- <li> The [/help/timeline|timeline command] is enhanced with the new
48
- "<tt>-u|--for-user</tt>" option.
49
+ <li> The [/help/timeline|timeline command] is enhanced with the new options
50
+ "<tt>-u|--for-user</tt>" to filter by user, and "<tt>-r</tt>" to display
51
+ entries in chronological order.
4952
<li> The [/help/open|open command]'s new "<tt>--reopen REPOFILE</tt>" flag
5053
can be used to fix a checkout after moving its repository file.
5154
<li> Update internal Unicode character tables, used in regular expression
5255
handling, from version 13 to 17.
56
+ <li> Add a zoom-message option to [/help/www/chat|/chat] to better support
57
+ pikchr diagrams.
5358
</ol>
5459
5560
<h2 id='v2_27'>Changes for version 2.27 (2025-09-30)</h2><ol>
5661
<li> Close a potential Denial-of-Service attack against any public-facing Fossil
5762
server involving exponential behavior in Fossil's regexp implementation.
5863
--- www/changes.wiki
+++ www/changes.wiki
@@ -23,10 +23,12 @@
23 [/help/suggested-downloads|suggested-downloads setting], a
24 link to [/download] named "Tarballs and ZIPs" appears in the
25 [/sitemap] and thus on the hamburger menu.
26 <li> The filenames for tarballs and ZIPs are now standardized to
27 include a timestamp and a hash prefix.
 
 
28 </ol>
29 <li> Timeline enhancements:<ol type="a">
30 <li> A new "Simple" view is available. This is compromise between "Verbose"
31 and "Compact" that shows only the check-in hash rather than the full
32 detail section. There is an ellipsis that one can click on to see the
@@ -42,16 +44,19 @@
42 <li> "No-graph" timelines (using the "ng" query parameter) now show
43 branch colors and bare check-in circles on the left. The check-in
44 circles appear, but no lines connecting them.
45 ([/timeline?ng|example]).
46 </ol>
47 <li> The [/help/timeline|timeline command] is enhanced with the new
48 "<tt>-u|--for-user</tt>" option.
 
49 <li> The [/help/open|open command]'s new "<tt>--reopen REPOFILE</tt>" flag
50 can be used to fix a checkout after moving its repository file.
51 <li> Update internal Unicode character tables, used in regular expression
52 handling, from version 13 to 17.
 
 
53 </ol>
54
55 <h2 id='v2_27'>Changes for version 2.27 (2025-09-30)</h2><ol>
56 <li> Close a potential Denial-of-Service attack against any public-facing Fossil
57 server involving exponential behavior in Fossil's regexp implementation.
58
--- www/changes.wiki
+++ www/changes.wiki
@@ -23,10 +23,12 @@
23 [/help/suggested-downloads|suggested-downloads setting], a
24 link to [/download] named "Tarballs and ZIPs" appears in the
25 [/sitemap] and thus on the hamburger menu.
26 <li> The filenames for tarballs and ZIPs are now standardized to
27 include a timestamp and a hash prefix.
28 <li> New "[/help/get|fossil get]" command downloads and unpacks a specific
29 check-in without having to clone the repository.
30 </ol>
31 <li> Timeline enhancements:<ol type="a">
32 <li> A new "Simple" view is available. This is compromise between "Verbose"
33 and "Compact" that shows only the check-in hash rather than the full
34 detail section. There is an ellipsis that one can click on to see the
@@ -42,16 +44,19 @@
44 <li> "No-graph" timelines (using the "ng" query parameter) now show
45 branch colors and bare check-in circles on the left. The check-in
46 circles appear, but no lines connecting them.
47 ([/timeline?ng|example]).
48 </ol>
49 <li> The [/help/timeline|timeline command] is enhanced with the new options
50 "<tt>-u|--for-user</tt>" to filter by user, and "<tt>-r</tt>" to display
51 entries in chronological order.
52 <li> The [/help/open|open command]'s new "<tt>--reopen REPOFILE</tt>" flag
53 can be used to fix a checkout after moving its repository file.
54 <li> Update internal Unicode character tables, used in regular expression
55 handling, from version 13 to 17.
56 <li> Add a zoom-message option to [/help/www/chat|/chat] to better support
57 pikchr diagrams.
58 </ol>
59
60 <h2 id='v2_27'>Changes for version 2.27 (2025-09-30)</h2><ol>
61 <li> Close a potential Denial-of-Service attack against any public-facing Fossil
62 server involving exponential behavior in Fossil's regexp implementation.
63
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -139,11 +139,11 @@
139139
For example, the author of this documentation page is running
140140
"<tt>fossil ui --extpage www/serverext.wiki</tt>" while editing this
141141
very paragraph, and presses Reload from time to time to view his
142142
edits.
143143
144
-A same idea applies when developing new CGI applications using a script
144
+The same idea applies when developing new CGI applications using a script
145145
language (for example using [https://wapp.tcl.tk|Wapp]). Run the
146146
command "<tt>fossil ui --extpage SCRIPT</tt>" where SCRIPT is the name
147147
of the application script, while editing that script in a separate
148148
window, then press Reload periodically on the web browser to test the
149149
script.
150150
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -139,11 +139,11 @@
139 For example, the author of this documentation page is running
140 "<tt>fossil ui --extpage www/serverext.wiki</tt>" while editing this
141 very paragraph, and presses Reload from time to time to view his
142 edits.
143
144 A same idea applies when developing new CGI applications using a script
145 language (for example using [https://wapp.tcl.tk|Wapp]). Run the
146 command "<tt>fossil ui --extpage SCRIPT</tt>" where SCRIPT is the name
147 of the application script, while editing that script in a separate
148 window, then press Reload periodically on the web browser to test the
149 script.
150
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -139,11 +139,11 @@
139 For example, the author of this documentation page is running
140 "<tt>fossil ui --extpage www/serverext.wiki</tt>" while editing this
141 very paragraph, and presses Reload from time to time to view his
142 edits.
143
144 The same idea applies when developing new CGI applications using a script
145 language (for example using [https://wapp.tcl.tk|Wapp]). Run the
146 command "<tt>fossil ui --extpage SCRIPT</tt>" where SCRIPT is the name
147 of the application script, while editing that script in a separate
148 window, then press Reload periodically on the web browser to test the
149 script.
150

Keyboard Shortcuts

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