Fossil SCM

Merge version-2.14

george 2021-01-20 19:19 UTC wiki-history merge
Commit 0e31c8d25896220092c79840324a02a0c6d1bfed740319f58e669cea9973959b
154 files changed +1 +1 -1 +3 +19 -3 +16 -21 +1 -1 +3 +1 +34 -22 +88 +9 -5 +4 -2 +1 -1 +12 -1 +6 -3 +16 -16 +11 -5 +4 -2 +11 -1 +4 -2 +1 -1 +9 +1158 +1 -1 +8 -3 +1 -1 +1 -1 +2 -2 +303 -2 +3 -2 +8 -2 +5 +27 -6 +28 -18 +4 -4 +6 -4 +135 -21 +3 -2 +2 -2 +5 -4 +12 -7 +60 -9 +107 -32 +11 -4 +1 -1 +4 -2 +72 -32 +3 -2 +6 -4 +37 -11 +2 +2 -1 +36 -7 +8 -46 +19 -2 +19 -2 +6 -4 +57 +1 -1 +62 -28 +3 -2 +2 -1 +1 -1 +2 -1 +3 -3 +1 -1 +2 -1 +10 -7 +7 -6 +6 -6 +116 -16 +42 -12 +91 -56 +3 -3 +8 -3 +12 -6 +4 -2 +7 -6 +3451 -2182 +15 -5 +23 -7 +1 -1 +67 -12 +32 -30 +3 -3 +2 -2 +1 -1 +9 -3 +231 -31 +19 -13 +6 -3 +3 -3 +1 -1 +2 -2 +101 -8 +9 -5 +31 -16 +31 -16 +1 -1 +4 +3 -2 +3 -2 +509 +1 -1 +10 -4 +19 -2 +20 +3 -3 +1 -1 +1 -1 +41 -7 +134 +1 -2 +4 +71 -30 +1 -1 +17 -5 +3 -3 +14 -2 +2 -2 +1 -1 +54 -99 +19 -7 +86 -35 +2 -2 +11 -11 +1 -1 +1 -1 +25 -25 +32 -8 +28 -56 +1 -1 +2 -1 +7 -1 +18 +507 -507 +1 -1 +1 -1 +1 -1 +1 -1 +3 -2 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +12 -8 +12 -2 +253 -245
~ .fossil-settings/binary-glob ~ .fossil-settings/clean-glob ~ .fossil-settings/ignore-glob ~ auto.def ~ fossil.1 ~ skins/bootstrap/header.txt ~ skins/default/header.txt ~ skins/xekri/css.txt ~ src/alerts.c ~ src/alerts/bflat2.wav ~ src/alerts/bflat3.wav ~ src/alerts/bloop.wav ~ src/alerts/mkwav.c ~ src/alerts/plunk.wav ~ src/attach.c ~ src/backlink.c ~ src/backoffice.c ~ src/blob.c ~ src/branch.c ~ src/browse.c ~ src/builtin.c ~ src/cache.c ~ src/capabilities.c ~ src/captcha.c ~ src/cgi.c ~ src/chat.c ~ src/chat.js ~ src/checkin.c ~ src/checkout.c ~ src/clone.c ~ src/cookies.c ~ src/db.c ~ src/default.css ~ src/descendants.c ~ src/diff.c ~ src/diffcmd.c ~ src/dispatch.c ~ src/doc.c ~ src/encode.c ~ src/event.c ~ src/export.c ~ src/extcgi.c ~ src/fileedit.c ~ src/finfo.c ~ src/forum.c ~ src/fossil.dom.js ~ src/fossil.popupwidget.js ~ src/fossil.storage.js ~ src/hook.c ~ src/import.c ~ src/info.c ~ src/interwiki.c ~ src/json.c ~ src/linenoise.c ~ src/linenoise.h ~ src/loadctrl.c ~ src/login.c ~ src/main.c ~ src/main.mk ~ src/main.mk ~ src/makemake.tcl ~ src/manifest.c ~ src/moderate.c ~ src/name.c ~ src/path.c ~ src/piechart.c ~ src/pikchrshow.c ~ src/printf.c ~ src/rebuild.c ~ src/regexp.c ~ src/repolist.c ~ src/report.c ~ src/search.c ~ src/security_audit.c ~ src/setup.c ~ src/setupuser.c ~ src/shell.c ~ src/shun.c ~ src/sitemap.c ~ src/skins.c ~ src/smtp.c ~ src/sounds/README.md ~ src/sqlite3.c ~ src/sqlite3.h ~ src/stat.c ~ src/statrep.c ~ src/style.c ~ src/sync.c ~ src/tag.c ~ src/tar.c ~ src/terminal.c ~ src/th_main.c ~ src/timeline.c ~ src/tkt.c ~ src/tktsetup.c ~ src/unversioned.c ~ src/update.c ~ src/user.c ~ src/util.c ~ src/webmail.c ~ src/wiki.c ~ src/wiki.c ~ src/wiki.wiki ~ src/wikiformat.c ~ src/xfersetup.c ~ src/zip.c ~ tools/chat.tcl ~ tools/fossil-stress.tcl ~ win/Makefile.dmc ~ win/Makefile.mingw ~ win/Makefile.msc ~ www/blockchain.md ~ www/build.wiki ~ www/caps/admin-v-setup.md ~ www/changes.wiki ~ www/chat.md ~ www/ckout-workflows.md ~ www/co-vs-up.md ~ www/contribute.wiki ~ www/css-tricks.md ~ www/customskin.md ~ www/defcsp.md ~ www/delta_format.wiki ~ www/env-opts.md ~ www/fileedit-page.md ~ www/forum.wiki ~ www/fossil-v-git.wiki ~ www/fossil3.gif ~ www/gitusers.md ~ www/globs.md ~ www/history.md ~ www/hooks.md ~ www/image-format-vs-repo-size.md ~ www/index.wiki ~ www/javascript.md ~ www/json-api/intro.md ~ www/makefile.wiki ~ www/mirrortogithub.md ~ www/mkindex.tcl ~ www/permutedindex.html ~ www/quickstart.wiki ~ www/rebaseharm.md ~ www/server/any/althttpd.md ~ www/server/debian/service.md ~ www/server/openbsd/fastcgi.md ~ www/server/whyuseaserver.wiki ~ www/serverext.wiki ~ www/shunning.wiki ~ www/ssl.wiki ~ www/sync.wiki ~ www/uitest.html ~ www/webpage-ex.md ~ www/webui.wiki ~ www/whyusefossil.wiki
--- .fossil-settings/binary-glob
+++ .fossil-settings/binary-glob
@@ -3,9 +3,10 @@
33
*.jpg
44
*.odp
55
*.dia
66
*.pdf
77
*.png
8
+*.wav
89
compat/zlib/contrib/blast/test.pk
910
compat/zlib/contrib/dotzlib/DotZLib.chm
1011
compat/zlib/contrib/puff/zeros.raw
1112
compat/zlib/zlib.3.pdf
1213
--- .fossil-settings/binary-glob
+++ .fossil-settings/binary-glob
@@ -3,9 +3,10 @@
3 *.jpg
4 *.odp
5 *.dia
6 *.pdf
7 *.png
 
8 compat/zlib/contrib/blast/test.pk
9 compat/zlib/contrib/dotzlib/DotZLib.chm
10 compat/zlib/contrib/puff/zeros.raw
11 compat/zlib/zlib.3.pdf
12
--- .fossil-settings/binary-glob
+++ .fossil-settings/binary-glob
@@ -3,9 +3,10 @@
3 *.jpg
4 *.odp
5 *.dia
6 *.pdf
7 *.png
8 *.wav
9 compat/zlib/contrib/blast/test.pk
10 compat/zlib/contrib/dotzlib/DotZLib.chm
11 compat/zlib/contrib/puff/zeros.raw
12 compat/zlib/zlib.3.pdf
13
--- .fossil-settings/clean-glob
+++ .fossil-settings/clean-glob
@@ -7,11 +7,11 @@
77
*.res
88
Makefile
99
autosetup/jimsh0
1010
autosetup/jimsh0.exe
1111
bld/*
12
-wbld/*
12
+msvcbld/*
1313
win/*.c
1414
win/*.h
1515
win/*.exe
1616
win/headers
1717
win/linkopts
1818
--- .fossil-settings/clean-glob
+++ .fossil-settings/clean-glob
@@ -7,11 +7,11 @@
7 *.res
8 Makefile
9 autosetup/jimsh0
10 autosetup/jimsh0.exe
11 bld/*
12 wbld/*
13 win/*.c
14 win/*.h
15 win/*.exe
16 win/headers
17 win/linkopts
18
--- .fossil-settings/clean-glob
+++ .fossil-settings/clean-glob
@@ -7,11 +7,11 @@
7 *.res
8 Makefile
9 autosetup/jimsh0
10 autosetup/jimsh0.exe
11 bld/*
12 msvcbld/*
13 win/*.c
14 win/*.h
15 win/*.exe
16 win/headers
17 win/linkopts
18
--- .fossil-settings/ignore-glob
+++ .fossil-settings/ignore-glob
@@ -1,7 +1,10 @@
11
compat/openssl*
22
compat/tcl*
3
+compat/zlib*
34
fossil
45
fossil.exe
56
win/fossil.exe
67
*shell-see.*
78
*sqlite3-see.*
9
+bld/*
10
+msvcbld/*
811
--- .fossil-settings/ignore-glob
+++ .fossil-settings/ignore-glob
@@ -1,7 +1,10 @@
1 compat/openssl*
2 compat/tcl*
 
3 fossil
4 fossil.exe
5 win/fossil.exe
6 *shell-see.*
7 *sqlite3-see.*
 
 
8
--- .fossil-settings/ignore-glob
+++ .fossil-settings/ignore-glob
@@ -1,7 +1,10 @@
1 compat/openssl*
2 compat/tcl*
3 compat/zlib*
4 fossil
5 fossil.exe
6 win/fossil.exe
7 *shell-see.*
8 *sqlite3-see.*
9 bld/*
10 msvcbld/*
11
+19 -3
--- auto.def
+++ auto.def
@@ -570,10 +570,18 @@
570570
cc-check-functions utime
571571
cc-check-functions usleep
572572
cc-check-functions strchrnul
573573
cc-check-functions pledge
574574
cc-check-functions backtrace
575
+
576
+# Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
577
+# guard against including it again; use cctest as cc-check-functions and
578
+# cctest_function check for "getpass()" with no args and fail
579
+if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
580
+ define FOSSIL_HAVE_GETPASS 1
581
+ msg-result "Found getpass() with unistd.h"
582
+}
575583
576584
# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
577585
if {![cc-check-functions getloadavg]} {
578586
define FOSSIL_OMIT_LOAD_AVERAGE 1
579587
msg-result "Load average support unavailable"
@@ -586,11 +594,13 @@
586594
}
587595
cc-check-function-in-lib sin m
588596
589597
# Check for the FuseFS library
590598
if {[opt-bool fusefs]} {
591
- if {[cc-check-function-in-lib fuse_mount fuse]} {
599
+ if {[opt-bool static]} {
600
+ msg-result "FuseFS support disabled due to -static"
601
+ } elseif {[cc-check-function-in-lib fuse_mount fuse]} {
592602
define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
593603
define FOSSIL_HAVE_FUSEFS 1
594604
define-append LIBS -lfuse
595605
msg-result "FuseFS support enabled"
596606
}
@@ -608,15 +618,21 @@
608618
# GCC with -fsanitize=undefined.
609619
cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
610620
}
611621
}
612622
613
-# Finally, append -ldl to make sure it's the last in the list.
614
-# The library order matters in case of static linking.
623
+# Finally, append libraries that must be last. This matters more on some
624
+# OSes than others, but is most broadly required for static linking.
615625
if {[check-function-in-lib dlopen dl]} {
616626
# Some platforms (*BSD) have the dl functions already in libc and no libdl.
617627
# In such case we can link directly without -ldl.
618628
define-append LIBS [get-define lib_dlopen]
619629
}
630
+if {[opt-bool static]} {
631
+ # Linux can only infer the dependency on pthread from OpenSSL when
632
+ # doing dynamic linkage.
633
+ define-append LIBS -lpthread
634
+}
635
+
620636
621637
make-template Makefile.in
622638
make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
623639
--- auto.def
+++ auto.def
@@ -570,10 +570,18 @@
570 cc-check-functions utime
571 cc-check-functions usleep
572 cc-check-functions strchrnul
573 cc-check-functions pledge
574 cc-check-functions backtrace
 
 
 
 
 
 
 
 
575
576 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
577 if {![cc-check-functions getloadavg]} {
578 define FOSSIL_OMIT_LOAD_AVERAGE 1
579 msg-result "Load average support unavailable"
@@ -586,11 +594,13 @@
586 }
587 cc-check-function-in-lib sin m
588
589 # Check for the FuseFS library
590 if {[opt-bool fusefs]} {
591 if {[cc-check-function-in-lib fuse_mount fuse]} {
 
 
592 define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
593 define FOSSIL_HAVE_FUSEFS 1
594 define-append LIBS -lfuse
595 msg-result "FuseFS support enabled"
596 }
@@ -608,15 +618,21 @@
608 # GCC with -fsanitize=undefined.
609 cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
610 }
611 }
612
613 # Finally, append -ldl to make sure it's the last in the list.
614 # The library order matters in case of static linking.
615 if {[check-function-in-lib dlopen dl]} {
616 # Some platforms (*BSD) have the dl functions already in libc and no libdl.
617 # In such case we can link directly without -ldl.
618 define-append LIBS [get-define lib_dlopen]
619 }
 
 
 
 
 
 
620
621 make-template Makefile.in
622 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
623
--- auto.def
+++ auto.def
@@ -570,10 +570,18 @@
570 cc-check-functions utime
571 cc-check-functions usleep
572 cc-check-functions strchrnul
573 cc-check-functions pledge
574 cc-check-functions backtrace
575
576 # Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
577 # guard against including it again; use cctest as cc-check-functions and
578 # cctest_function check for "getpass()" with no args and fail
579 if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
580 define FOSSIL_HAVE_GETPASS 1
581 msg-result "Found getpass() with unistd.h"
582 }
583
584 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
585 if {![cc-check-functions getloadavg]} {
586 define FOSSIL_OMIT_LOAD_AVERAGE 1
587 msg-result "Load average support unavailable"
@@ -586,11 +594,13 @@
594 }
595 cc-check-function-in-lib sin m
596
597 # Check for the FuseFS library
598 if {[opt-bool fusefs]} {
599 if {[opt-bool static]} {
600 msg-result "FuseFS support disabled due to -static"
601 } elseif {[cc-check-function-in-lib fuse_mount fuse]} {
602 define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
603 define FOSSIL_HAVE_FUSEFS 1
604 define-append LIBS -lfuse
605 msg-result "FuseFS support enabled"
606 }
@@ -608,15 +618,21 @@
618 # GCC with -fsanitize=undefined.
619 cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
620 }
621 }
622
623 # Finally, append libraries that must be last. This matters more on some
624 # OSes than others, but is most broadly required for static linking.
625 if {[check-function-in-lib dlopen dl]} {
626 # Some platforms (*BSD) have the dl functions already in libc and no libdl.
627 # In such case we can link directly without -ldl.
628 define-append LIBS [get-define lib_dlopen]
629 }
630 if {[opt-bool static]} {
631 # Linux can only infer the dependency on pthread from OpenSSL when
632 # doing dynamic linkage.
633 define-append LIBS -lpthread
634 }
635
636
637 make-template Makefile.in
638 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
639
+16 -21
--- fossil.1
+++ fossil.1
@@ -14,31 +14,26 @@
1414
Fossil is a distributed version control system (DVCS) with built-in
1515
forum, wiki, ticket tracker, CGI/HTTP interface, and HTTP server.
1616
1717
.SH Common COMMANDs:
1818
19
-add clean help push timeline
20
-.br
21
-addremove clone import rebuild ui
22
-.br
23
-all commit info remote-url undo
24
-.br
25
-amend delete init revert unpublished
26
-.br
27
-annotate diff ls rm unversioned
28
-.br
29
-bisect export merge settings update
30
-.br
31
-blame extras mv sql version
32
-.br
33
-branch finfo open stash
34
-.br
35
-bundle fusefs praise status
36
-.br
37
-cat gdiff publish sync
38
-.br
39
-changes grep pull tag
19
+add cat diff ls revert timeline
20
+.br
21
+addremove changes extras merge rm ui
22
+.br
23
+all chat finfo mv settings undo
24
+.br
25
+amend clean gdiff open sql unversioned
26
+.br
27
+annotate clone grep pull stash update
28
+.br
29
+bisect commit help push status version
30
+.br
31
+blame dbstat info rebuild sync
32
+.br
33
+branch delete init remote tag
34
+.br
4035
4136
.SH FEATURES
4237
4338
Features as described on the fossil home page.
4439
4540
--- fossil.1
+++ fossil.1
@@ -14,31 +14,26 @@
14 Fossil is a distributed version control system (DVCS) with built-in
15 forum, wiki, ticket tracker, CGI/HTTP interface, and HTTP server.
16
17 .SH Common COMMANDs:
18
19 add clean help push timeline
20 .br
21 addremove clone import rebuild ui
22 .br
23 all commit info remote-url undo
24 .br
25 amend delete init revert unpublished
26 .br
27 annotate diff ls rm unversioned
28 .br
29 bisect export merge settings update
30 .br
31 blame extras mv sql version
32 .br
33 branch finfo open stash
34 .br
35 bundle fusefs praise status
36 .br
37 cat gdiff publish sync
38 .br
39 changes grep pull tag
40
41 .SH FEATURES
42
43 Features as described on the fossil home page.
44
45
--- fossil.1
+++ fossil.1
@@ -14,31 +14,26 @@
14 Fossil is a distributed version control system (DVCS) with built-in
15 forum, wiki, ticket tracker, CGI/HTTP interface, and HTTP server.
16
17 .SH Common COMMANDs:
18
19 add cat diff ls revert timeline
20 .br
21 addremove changes extras merge rm ui
22 .br
23 all chat finfo mv settings undo
24 .br
25 amend clean gdiff open sql unversioned
26 .br
27 annotate clone grep pull stash update
28 .br
29 bisect commit help push status version
30 .br
31 blame dbstat info rebuild sync
32 .br
33 branch delete init remote tag
34 .br
 
 
 
 
 
35
36 .SH FEATURES
37
38 Features as described on the fossil home page.
39
40
--- skins/bootstrap/header.txt
+++ skins/bootstrap/header.txt
@@ -14,11 +14,11 @@
1414
if(!e) throw new Error("Expecting element with ID "+x);
1515
else return e;
1616
}
1717
</script>
1818
</head>
19
- <body data-spy="scroll" data-target=".sidebar">
19
+ <body data-spy="scroll" data-target=".sidebar" class="$current_feature">
2020
<div id="wrap">
2121
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
2222
<div class="container">
2323
<div class="navbar-header">
2424
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
2525
--- skins/bootstrap/header.txt
+++ skins/bootstrap/header.txt
@@ -14,11 +14,11 @@
14 if(!e) throw new Error("Expecting element with ID "+x);
15 else return e;
16 }
17 </script>
18 </head>
19 <body data-spy="scroll" data-target=".sidebar">
20 <div id="wrap">
21 <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
22 <div class="container">
23 <div class="navbar-header">
24 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
25
--- skins/bootstrap/header.txt
+++ skins/bootstrap/header.txt
@@ -14,11 +14,11 @@
14 if(!e) throw new Error("Expecting element with ID "+x);
15 else return e;
16 }
17 </script>
18 </head>
19 <body data-spy="scroll" data-target=".sidebar" class="$current_feature">
20 <div id="wrap">
21 <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
22 <div class="container">
23 <div class="navbar-header">
24 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
25
--- skins/default/header.txt
+++ skins/default/header.txt
@@ -33,10 +33,13 @@
3333
menulink /taglist Tags wideonly
3434
}
3535
if {[anycap 23456] || [anoncap 2] || [anoncap 3]} {
3636
menulink /forum Forum desktoponly
3737
}
38
+if {[hascap C]} {
39
+ menulink /chat Chat wideonly
40
+}
3841
if {[hascap r]} {
3942
menulink /ticket Tickets wideonly
4043
}
4144
if {[hascap j]} {
4245
menulink /wiki Wiki wideonly
4346
--- skins/default/header.txt
+++ skins/default/header.txt
@@ -33,10 +33,13 @@
33 menulink /taglist Tags wideonly
34 }
35 if {[anycap 23456] || [anoncap 2] || [anoncap 3]} {
36 menulink /forum Forum desktoponly
37 }
 
 
 
38 if {[hascap r]} {
39 menulink /ticket Tickets wideonly
40 }
41 if {[hascap j]} {
42 menulink /wiki Wiki wideonly
43
--- skins/default/header.txt
+++ skins/default/header.txt
@@ -33,10 +33,13 @@
33 menulink /taglist Tags wideonly
34 }
35 if {[anycap 23456] || [anoncap 2] || [anoncap 3]} {
36 menulink /forum Forum desktoponly
37 }
38 if {[hascap C]} {
39 menulink /chat Chat wideonly
40 }
41 if {[hascap r]} {
42 menulink /ticket Tickets wideonly
43 }
44 if {[hascap j]} {
45 menulink /wiki Wiki wideonly
46
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1119,9 +1119,10 @@
11191119
/* odd table row color */
11201120
tr.row1 {
11211121
/* Use default */
11221122
}
11231123
1124
+.fossil-PopupWidget,
11241125
.fossil-tooltip.help-buttonlet-content {
11251126
background-color: #111;
11261127
border: 1px solid rgba(255,255,255,0.5);
11271128
}
11281129
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1119,9 +1119,10 @@
1119 /* odd table row color */
1120 tr.row1 {
1121 /* Use default */
1122 }
1123
 
1124 .fossil-tooltip.help-buttonlet-content {
1125 background-color: #111;
1126 border: 1px solid rgba(255,255,255,0.5);
1127 }
1128
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1119,9 +1119,10 @@
1119 /* odd table row color */
1120 tr.row1 {
1121 /* Use default */
1122 }
1123
1124 .fossil-PopupWidget,
1125 .fossil-tooltip.help-buttonlet-content {
1126 background-color: #111;
1127 border: 1px solid rgba(255,255,255,0.5);
1128 }
1129
+34 -22
--- src/alerts.c
+++ src/alerts.c
@@ -116,11 +116,10 @@
116116
&& fossil_strcmp(db_get("email-send-method",0),"off")==0
117117
){
118118
return; /* Don't create table for disabled email */
119119
}
120120
db_exec_sql(zAlertInit);
121
- alert_triggers_enable();
122121
}else if( !db_table_has_column("repository","pending_alert","sentMod") ){
123122
db_multi_exec(
124123
"ALTER TABLE repository.pending_alert"
125124
" ADD COLUMN sentMod BOOLEAN DEFAULT false;"
126125
);
@@ -129,15 +128,17 @@
129128
130129
/*
131130
** Enable triggers that automatically populate the pending_alert
132131
** table.
133132
*/
134
-void alert_triggers_enable(void){
133
+void alert_create_trigger(void){
135134
if( !db_table_exists("repository","pending_alert") ) return;
136135
db_multi_exec(
137
- "CREATE TRIGGER IF NOT EXISTS repository.alert_trigger1\n"
138
- "AFTER INSERT ON event BEGIN\n"
136
+ "DROP TRIGGER IF EXISTS repository.alert_trigger1;\n" /* Purge legacy */
137
+ /* "DROP TRIGGER IF EXISTS repository.email_trigger1;\n" Very old legacy */
138
+ "CREATE TRIGGER temp.alert_trigger1\n"
139
+ "AFTER INSERT ON repository.event BEGIN\n"
139140
" INSERT INTO pending_alert(eventid)\n"
140141
" SELECT printf('%%.1c%%d',new.type,new.objid) WHERE true\n"
141142
" ON CONFLICT(eventId) DO NOTHING;\n"
142143
"END;"
143144
);
@@ -147,14 +148,14 @@
147148
** Disable triggers the event_pending triggers.
148149
**
149150
** This must be called before rebuilding the EVENT table, for example
150151
** via the "fossil rebuild" command.
151152
*/
152
-void alert_triggers_disable(void){
153
+void alert_drop_trigger(void){
153154
db_multi_exec(
154
- "DROP TRIGGER IF EXISTS repository.alert_trigger1;\n"
155
- "DROP TRIGGER IF EXISTS repository.email_trigger1;\n" // Legacy
155
+ "DROP TRIGGER IF EXISTS temp.alert_trigger1;\n"
156
+ "DROP TRIGGER IF EXISTS repository.alert_trigger1;\n" /* Purge legacy */
156157
);
157158
}
158159
159160
/*
160161
** Return true if email alerts are active.
@@ -171,13 +172,14 @@
171172
**
172173
** If the subscriber table does exist, return 0 without doing anything.
173174
*/
174175
static int alert_webpages_disabled(void){
175176
if( alert_tables_exist() ) return 0;
177
+ style_set_current_feature("alerts");
176178
style_header("Email Alerts Are Disabled");
177179
@ <p>Email alerts are disabled on this server</p>
178
- style_finish_page("alerts");
180
+ style_finish_page();
179181
return 1;
180182
}
181183
182184
/*
183185
** Insert a "Subscriber List" submenu link if the current user
@@ -216,10 +218,11 @@
216218
}
217219
db_begin_transaction();
218220
219221
alert_submenu_common();
220222
style_submenu_element("Send Announcement","%R/announce");
223
+ style_set_current_feature("alerts");
221224
style_header("Email Notification Setup");
222225
@ <h1>Status</h1>
223226
@ <table class="label-value">
224227
if( alert_enabled() ){
225228
stats_for_email();
@@ -308,11 +311,11 @@
308311
@ <hr>
309312
310313
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
311314
@ </div></form>
312315
db_end_transaction(0);
313
- style_finish_page("alerts");
316
+ style_finish_page();
314317
}
315318
316319
#if 0
317320
/*
318321
** Encode pMsg as MIME base64 and append it to pOut
@@ -1060,11 +1063,11 @@
10601063
prompt_user("Continue? (y/N) ", &yn);
10611064
c = blob_str(&yn)[0];
10621065
blob_reset(&yn);
10631066
}
10641067
if( c=='y' ){
1065
- alert_triggers_disable();
1068
+ alert_drop_trigger();
10661069
db_multi_exec(
10671070
"DROP TABLE IF EXISTS subscriber;\n"
10681071
"DROP TABLE IF EXISTS pending_alert;\n"
10691072
"DROP TABLE IF EXISTS alert_bounce;\n"
10701073
/* Legacy */
@@ -1364,10 +1367,11 @@
13641367
}
13651368
if( !g.perm.Admin && !db_get_boolean("anon-subscribe",1) ){
13661369
register_page();
13671370
return;
13681371
}
1372
+ style_set_current_feature("alerts");
13691373
alert_submenu_common();
13701374
needCaptcha = !login_is_individual();
13711375
if( P("submit")
13721376
&& cgi_csrf_safe(1)
13731377
&& subscribe_error_check(&eErr,&zErr,needCaptcha)
@@ -1435,11 +1439,11 @@
14351439
@ <p>An email has been sent to "%h(zEAddr)". That email contains a
14361440
@ hyperlink that you must click to activate your
14371441
@ subscription.</p>
14381442
}
14391443
alert_sender_free(pSender);
1440
- style_finish_page("alerts");
1444
+ style_finish_page();
14411445
}
14421446
return;
14431447
}
14441448
style_header("Signup For Email Alerts");
14451449
if( P("submit")==0 ){
@@ -1552,11 +1556,11 @@
15521556
@ Enter the 8 characters above in the "Security Code" box<br/>
15531557
@ </td></tr></table></div>
15541558
}
15551559
@ </form>
15561560
fossil_free(zErr);
1557
- style_finish_page("alerts");
1561
+ style_finish_page();
15581562
}
15591563
15601564
/*
15611565
** Either shutdown or completely delete a subscription entry given
15621566
** by the hex value zName. Then paint a webpage that explains that
@@ -1572,10 +1576,11 @@
15721576
if( db_step(&q)==SQLITE_ROW ){
15731577
zEmail = db_column_text(&q, 0);
15741578
zLogin = db_column_text(&q, 1);
15751579
uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin);
15761580
}
1581
+ style_set_current_feature("alerts");
15771582
if( zEmail==0 ){
15781583
style_header("Unsubscribe Fail");
15791584
@ <p>Unable to locate a subscriber with the requested key</p>
15801585
}else{
15811586
@@ -1590,11 +1595,11 @@
15901595
@ <a href="%R/setup_uedit?id=%d(uid)">edit or delete
15911596
@ the corresponding user "%h(zLogin)"</a></p>
15921597
}
15931598
}
15941599
db_finalize(&q);
1595
- style_finish_page("alerts");
1600
+ style_finish_page();
15961601
return;
15971602
}
15981603
15991604
/*
16001605
** WEBPAGE: alerts
@@ -1737,10 +1742,11 @@
17371742
alert_unsubscribe(sid);
17381743
db_commit_transaction();
17391744
return;
17401745
}
17411746
}
1747
+ style_set_current_feature("alerts");
17421748
style_header("Update Subscription");
17431749
db_prepare(&q,
17441750
"SELECT"
17451751
" semail," /* 0 */
17461752
" sverified," /* 1 */
@@ -1914,11 +1920,11 @@
19141920
@ </tr>
19151921
@ </table>
19161922
@ </form>
19171923
fossil_free(zErr);
19181924
db_finalize(&q);
1919
- style_finish_page("alerts");
1925
+ style_finish_page();
19201926
db_commit_transaction();
19211927
return;
19221928
}
19231929
19241930
/* This is the message that gets sent to describe how to change
@@ -1977,10 +1983,12 @@
19771983
if( login_is_individual() ){
19781984
cgi_redirectf("%R/alerts");
19791985
return;
19801986
}
19811987
1988
+ style_set_current_feature("alerts");
1989
+
19821990
zEAddr = PD("e","");
19831991
dx = atoi(PD("dx","0"));
19841992
bSubmit = P("submit")!=0 && P("e")!=0 && cgi_csrf_safe(1);
19851993
if( bSubmit ){
19861994
if( !captcha_is_correct(1) ){
@@ -2021,11 +2029,11 @@
20212029
}else{
20222030
@ <p>An email has been sent to "%h(zEAddr)" that explains how to
20232031
@ unsubscribe and/or modify your subscription settings</p>
20242032
}
20252033
alert_sender_free(pSender);
2026
- style_finish_page("alerts");
2034
+ style_finish_page();
20272035
return;
20282036
}
20292037
20302038
/* Non-logged-in users have to enter an email address to which is
20312039
** sent a message containing the unsubscribe link.
@@ -2071,11 +2079,11 @@
20712079
@ </pre>
20722080
@ Enter the 8 characters above in the "Security Code" box<br/>
20732081
@ </td></tr></table></div>
20742082
@ </form>
20752083
fossil_free(zErr);
2076
- style_finish_page("alerts");
2084
+ style_finish_page();
20772085
}
20782086
20792087
/*
20802088
** WEBPAGE: subscribers
20812089
**
@@ -2098,10 +2106,11 @@
20982106
login_needed(0);
20992107
return;
21002108
}
21012109
alert_submenu_common();
21022110
style_submenu_element("Users","setup_ulist");
2111
+ style_set_current_feature("alerts");
21032112
style_header("Subscriber List");
21042113
nTotal = db_int(0, "SELECT count(*) FROM subscriber");
21052114
nPending = db_int(0, "SELECT count(*) FROM subscriber WHERE NOT sverified");
21062115
if( nPending>0 && P("purge") && cgi_csrf_safe(0) ){
21072116
int nNewPending;
@@ -2182,11 +2191,11 @@
21822191
@ </tr>
21832192
}
21842193
@ </tbody></table>
21852194
db_finalize(&q);
21862195
style_table_sorter();
2187
- style_finish_page("alerts");
2196
+ style_finish_page();
21882197
}
21892198
21902199
#if LOCAL_INTERFACE
21912200
/*
21922201
** A single event that might appear in an alert is recorded as an
@@ -2799,14 +2808,15 @@
27992808
unsigned int uSeed = 0;
28002809
const char *zDecoded;
28012810
char *zCaptcha = 0;
28022811
28032812
login_check_credentials();
2813
+ style_set_current_feature("alerts");
28042814
if( zAdminEmail==0 || zAdminEmail[0]==0 ){
28052815
style_header("Outbound Email Disabled");
28062816
@ <p>Outbound email is disabled on this repository
2807
- style_finish_page("alerts");
2817
+ style_finish_page();
28082818
return;
28092819
}
28102820
if( P("submit")!=0
28112821
&& P("subject")!=0
28122822
&& P("msg")!=0
@@ -2834,18 +2844,19 @@
28342844
}else{
28352845
@ <p>Your message has been sent to the repository administrator.
28362846
@ Thank you for your input.</p>
28372847
}
28382848
alert_sender_free(pSender);
2839
- style_finish_page("alerts");
2849
+ style_finish_page();
28402850
return;
28412851
}
28422852
if( captcha_needed() ){
28432853
uSeed = captcha_seed();
28442854
zDecoded = captcha_decode(uSeed);
28452855
zCaptcha = captcha_render(zDecoded);
28462856
}
2857
+ style_set_current_feature("alerts");
28472858
style_header("Message To Administrator");
28482859
form_begin(0, "%R/contact_admin");
28492860
@ <p>Enter a message to the repository administrator below:</p>
28502861
@ <table class="subscribe">
28512862
if( zCaptcha ){
@@ -2881,11 +2892,11 @@
28812892
@ </pre>
28822893
@ Enter the 8 characters above in the "Security Code" box<br/>
28832894
@ </td></tr></table></div>
28842895
}
28852896
@ </form>
2886
- style_finish_page("alerts");
2897
+ style_finish_page();
28872898
}
28882899
28892900
/*
28902901
** Send an annoucement message described by query parameter.
28912902
** Permission to do this has already been verified.
@@ -2971,10 +2982,11 @@
29712982
login_check_credentials();
29722983
if( !g.perm.Announce ){
29732984
login_needed(0);
29742985
return;
29752986
}
2987
+ style_set_current_feature("alerts");
29762988
if( fossil_strcmp(P("name"),"test1")==0 ){
29772989
/* Visit the /announce/test1 page to see the CGI variables */
29782990
@ <p style='border: 1px solid black; padding: 1ex;'>
29792991
cgi_print_all(0, 0);
29802992
@ </p>
@@ -2989,11 +3001,11 @@
29893001
@ </pre></blockquote>
29903002
}else{
29913003
@ <p>The announcement has been sent.
29923004
@ <a href="%h(PD("REQUEST_URI","/"))">Send another</a></p>
29933005
}
2994
- style_finish_page("alerts");
3006
+ style_finish_page();
29953007
return;
29963008
} else if( !alert_enabled() ){
29973009
style_header("Cannot Send Announcement");
29983010
@ <p>Either you have no subscribers yet, or email alerts are not yet
29993011
@ <a href="https://fossil-scm.org/fossil/doc/trunk/www/alerts.md">set up</a>
@@ -3043,7 +3055,7 @@
30433055
@ <td><input type="submit" name="submit" value="Send Message">
30443056
}
30453057
@ </tr>
30463058
@ </table>
30473059
@ </form>
3048
- style_finish_page("alerts");
3060
+ style_finish_page();
30493061
}
30503062
30513063
ADDED src/alerts/bflat2.wav
30523064
ADDED src/alerts/bflat3.wav
30533065
ADDED src/alerts/bloop.wav
30543066
ADDED src/alerts/mkwav.c
30553067
ADDED src/alerts/plunk.wav
--- src/alerts.c
+++ src/alerts.c
@@ -116,11 +116,10 @@
116 && fossil_strcmp(db_get("email-send-method",0),"off")==0
117 ){
118 return; /* Don't create table for disabled email */
119 }
120 db_exec_sql(zAlertInit);
121 alert_triggers_enable();
122 }else if( !db_table_has_column("repository","pending_alert","sentMod") ){
123 db_multi_exec(
124 "ALTER TABLE repository.pending_alert"
125 " ADD COLUMN sentMod BOOLEAN DEFAULT false;"
126 );
@@ -129,15 +128,17 @@
129
130 /*
131 ** Enable triggers that automatically populate the pending_alert
132 ** table.
133 */
134 void alert_triggers_enable(void){
135 if( !db_table_exists("repository","pending_alert") ) return;
136 db_multi_exec(
137 "CREATE TRIGGER IF NOT EXISTS repository.alert_trigger1\n"
138 "AFTER INSERT ON event BEGIN\n"
 
 
139 " INSERT INTO pending_alert(eventid)\n"
140 " SELECT printf('%%.1c%%d',new.type,new.objid) WHERE true\n"
141 " ON CONFLICT(eventId) DO NOTHING;\n"
142 "END;"
143 );
@@ -147,14 +148,14 @@
147 ** Disable triggers the event_pending triggers.
148 **
149 ** This must be called before rebuilding the EVENT table, for example
150 ** via the "fossil rebuild" command.
151 */
152 void alert_triggers_disable(void){
153 db_multi_exec(
154 "DROP TRIGGER IF EXISTS repository.alert_trigger1;\n"
155 "DROP TRIGGER IF EXISTS repository.email_trigger1;\n" // Legacy
156 );
157 }
158
159 /*
160 ** Return true if email alerts are active.
@@ -171,13 +172,14 @@
171 **
172 ** If the subscriber table does exist, return 0 without doing anything.
173 */
174 static int alert_webpages_disabled(void){
175 if( alert_tables_exist() ) return 0;
 
176 style_header("Email Alerts Are Disabled");
177 @ <p>Email alerts are disabled on this server</p>
178 style_finish_page("alerts");
179 return 1;
180 }
181
182 /*
183 ** Insert a "Subscriber List" submenu link if the current user
@@ -216,10 +218,11 @@
216 }
217 db_begin_transaction();
218
219 alert_submenu_common();
220 style_submenu_element("Send Announcement","%R/announce");
 
221 style_header("Email Notification Setup");
222 @ <h1>Status</h1>
223 @ <table class="label-value">
224 if( alert_enabled() ){
225 stats_for_email();
@@ -308,11 +311,11 @@
308 @ <hr>
309
310 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
311 @ </div></form>
312 db_end_transaction(0);
313 style_finish_page("alerts");
314 }
315
316 #if 0
317 /*
318 ** Encode pMsg as MIME base64 and append it to pOut
@@ -1060,11 +1063,11 @@
1060 prompt_user("Continue? (y/N) ", &yn);
1061 c = blob_str(&yn)[0];
1062 blob_reset(&yn);
1063 }
1064 if( c=='y' ){
1065 alert_triggers_disable();
1066 db_multi_exec(
1067 "DROP TABLE IF EXISTS subscriber;\n"
1068 "DROP TABLE IF EXISTS pending_alert;\n"
1069 "DROP TABLE IF EXISTS alert_bounce;\n"
1070 /* Legacy */
@@ -1364,10 +1367,11 @@
1364 }
1365 if( !g.perm.Admin && !db_get_boolean("anon-subscribe",1) ){
1366 register_page();
1367 return;
1368 }
 
1369 alert_submenu_common();
1370 needCaptcha = !login_is_individual();
1371 if( P("submit")
1372 && cgi_csrf_safe(1)
1373 && subscribe_error_check(&eErr,&zErr,needCaptcha)
@@ -1435,11 +1439,11 @@
1435 @ <p>An email has been sent to "%h(zEAddr)". That email contains a
1436 @ hyperlink that you must click to activate your
1437 @ subscription.</p>
1438 }
1439 alert_sender_free(pSender);
1440 style_finish_page("alerts");
1441 }
1442 return;
1443 }
1444 style_header("Signup For Email Alerts");
1445 if( P("submit")==0 ){
@@ -1552,11 +1556,11 @@
1552 @ Enter the 8 characters above in the "Security Code" box<br/>
1553 @ </td></tr></table></div>
1554 }
1555 @ </form>
1556 fossil_free(zErr);
1557 style_finish_page("alerts");
1558 }
1559
1560 /*
1561 ** Either shutdown or completely delete a subscription entry given
1562 ** by the hex value zName. Then paint a webpage that explains that
@@ -1572,10 +1576,11 @@
1572 if( db_step(&q)==SQLITE_ROW ){
1573 zEmail = db_column_text(&q, 0);
1574 zLogin = db_column_text(&q, 1);
1575 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin);
1576 }
 
1577 if( zEmail==0 ){
1578 style_header("Unsubscribe Fail");
1579 @ <p>Unable to locate a subscriber with the requested key</p>
1580 }else{
1581
@@ -1590,11 +1595,11 @@
1590 @ <a href="%R/setup_uedit?id=%d(uid)">edit or delete
1591 @ the corresponding user "%h(zLogin)"</a></p>
1592 }
1593 }
1594 db_finalize(&q);
1595 style_finish_page("alerts");
1596 return;
1597 }
1598
1599 /*
1600 ** WEBPAGE: alerts
@@ -1737,10 +1742,11 @@
1737 alert_unsubscribe(sid);
1738 db_commit_transaction();
1739 return;
1740 }
1741 }
 
1742 style_header("Update Subscription");
1743 db_prepare(&q,
1744 "SELECT"
1745 " semail," /* 0 */
1746 " sverified," /* 1 */
@@ -1914,11 +1920,11 @@
1914 @ </tr>
1915 @ </table>
1916 @ </form>
1917 fossil_free(zErr);
1918 db_finalize(&q);
1919 style_finish_page("alerts");
1920 db_commit_transaction();
1921 return;
1922 }
1923
1924 /* This is the message that gets sent to describe how to change
@@ -1977,10 +1983,12 @@
1977 if( login_is_individual() ){
1978 cgi_redirectf("%R/alerts");
1979 return;
1980 }
1981
 
 
1982 zEAddr = PD("e","");
1983 dx = atoi(PD("dx","0"));
1984 bSubmit = P("submit")!=0 && P("e")!=0 && cgi_csrf_safe(1);
1985 if( bSubmit ){
1986 if( !captcha_is_correct(1) ){
@@ -2021,11 +2029,11 @@
2021 }else{
2022 @ <p>An email has been sent to "%h(zEAddr)" that explains how to
2023 @ unsubscribe and/or modify your subscription settings</p>
2024 }
2025 alert_sender_free(pSender);
2026 style_finish_page("alerts");
2027 return;
2028 }
2029
2030 /* Non-logged-in users have to enter an email address to which is
2031 ** sent a message containing the unsubscribe link.
@@ -2071,11 +2079,11 @@
2071 @ </pre>
2072 @ Enter the 8 characters above in the "Security Code" box<br/>
2073 @ </td></tr></table></div>
2074 @ </form>
2075 fossil_free(zErr);
2076 style_finish_page("alerts");
2077 }
2078
2079 /*
2080 ** WEBPAGE: subscribers
2081 **
@@ -2098,10 +2106,11 @@
2098 login_needed(0);
2099 return;
2100 }
2101 alert_submenu_common();
2102 style_submenu_element("Users","setup_ulist");
 
2103 style_header("Subscriber List");
2104 nTotal = db_int(0, "SELECT count(*) FROM subscriber");
2105 nPending = db_int(0, "SELECT count(*) FROM subscriber WHERE NOT sverified");
2106 if( nPending>0 && P("purge") && cgi_csrf_safe(0) ){
2107 int nNewPending;
@@ -2182,11 +2191,11 @@
2182 @ </tr>
2183 }
2184 @ </tbody></table>
2185 db_finalize(&q);
2186 style_table_sorter();
2187 style_finish_page("alerts");
2188 }
2189
2190 #if LOCAL_INTERFACE
2191 /*
2192 ** A single event that might appear in an alert is recorded as an
@@ -2799,14 +2808,15 @@
2799 unsigned int uSeed = 0;
2800 const char *zDecoded;
2801 char *zCaptcha = 0;
2802
2803 login_check_credentials();
 
2804 if( zAdminEmail==0 || zAdminEmail[0]==0 ){
2805 style_header("Outbound Email Disabled");
2806 @ <p>Outbound email is disabled on this repository
2807 style_finish_page("alerts");
2808 return;
2809 }
2810 if( P("submit")!=0
2811 && P("subject")!=0
2812 && P("msg")!=0
@@ -2834,18 +2844,19 @@
2834 }else{
2835 @ <p>Your message has been sent to the repository administrator.
2836 @ Thank you for your input.</p>
2837 }
2838 alert_sender_free(pSender);
2839 style_finish_page("alerts");
2840 return;
2841 }
2842 if( captcha_needed() ){
2843 uSeed = captcha_seed();
2844 zDecoded = captcha_decode(uSeed);
2845 zCaptcha = captcha_render(zDecoded);
2846 }
 
2847 style_header("Message To Administrator");
2848 form_begin(0, "%R/contact_admin");
2849 @ <p>Enter a message to the repository administrator below:</p>
2850 @ <table class="subscribe">
2851 if( zCaptcha ){
@@ -2881,11 +2892,11 @@
2881 @ </pre>
2882 @ Enter the 8 characters above in the "Security Code" box<br/>
2883 @ </td></tr></table></div>
2884 }
2885 @ </form>
2886 style_finish_page("alerts");
2887 }
2888
2889 /*
2890 ** Send an annoucement message described by query parameter.
2891 ** Permission to do this has already been verified.
@@ -2971,10 +2982,11 @@
2971 login_check_credentials();
2972 if( !g.perm.Announce ){
2973 login_needed(0);
2974 return;
2975 }
 
2976 if( fossil_strcmp(P("name"),"test1")==0 ){
2977 /* Visit the /announce/test1 page to see the CGI variables */
2978 @ <p style='border: 1px solid black; padding: 1ex;'>
2979 cgi_print_all(0, 0);
2980 @ </p>
@@ -2989,11 +3001,11 @@
2989 @ </pre></blockquote>
2990 }else{
2991 @ <p>The announcement has been sent.
2992 @ <a href="%h(PD("REQUEST_URI","/"))">Send another</a></p>
2993 }
2994 style_finish_page("alerts");
2995 return;
2996 } else if( !alert_enabled() ){
2997 style_header("Cannot Send Announcement");
2998 @ <p>Either you have no subscribers yet, or email alerts are not yet
2999 @ <a href="https://fossil-scm.org/fossil/doc/trunk/www/alerts.md">set up</a>
@@ -3043,7 +3055,7 @@
3043 @ <td><input type="submit" name="submit" value="Send Message">
3044 }
3045 @ </tr>
3046 @ </table>
3047 @ </form>
3048 style_finish_page("alerts");
3049 }
3050
3051 DDED src/alerts/bflat2.wav
3052 DDED src/alerts/bflat3.wav
3053 DDED src/alerts/bloop.wav
3054 DDED src/alerts/mkwav.c
3055 DDED src/alerts/plunk.wav
--- src/alerts.c
+++ src/alerts.c
@@ -116,11 +116,10 @@
116 && fossil_strcmp(db_get("email-send-method",0),"off")==0
117 ){
118 return; /* Don't create table for disabled email */
119 }
120 db_exec_sql(zAlertInit);
 
121 }else if( !db_table_has_column("repository","pending_alert","sentMod") ){
122 db_multi_exec(
123 "ALTER TABLE repository.pending_alert"
124 " ADD COLUMN sentMod BOOLEAN DEFAULT false;"
125 );
@@ -129,15 +128,17 @@
128
129 /*
130 ** Enable triggers that automatically populate the pending_alert
131 ** table.
132 */
133 void alert_create_trigger(void){
134 if( !db_table_exists("repository","pending_alert") ) return;
135 db_multi_exec(
136 "DROP TRIGGER IF EXISTS repository.alert_trigger1;\n" /* Purge legacy */
137 /* "DROP TRIGGER IF EXISTS repository.email_trigger1;\n" Very old legacy */
138 "CREATE TRIGGER temp.alert_trigger1\n"
139 "AFTER INSERT ON repository.event BEGIN\n"
140 " INSERT INTO pending_alert(eventid)\n"
141 " SELECT printf('%%.1c%%d',new.type,new.objid) WHERE true\n"
142 " ON CONFLICT(eventId) DO NOTHING;\n"
143 "END;"
144 );
@@ -147,14 +148,14 @@
148 ** Disable triggers the event_pending triggers.
149 **
150 ** This must be called before rebuilding the EVENT table, for example
151 ** via the "fossil rebuild" command.
152 */
153 void alert_drop_trigger(void){
154 db_multi_exec(
155 "DROP TRIGGER IF EXISTS temp.alert_trigger1;\n"
156 "DROP TRIGGER IF EXISTS repository.alert_trigger1;\n" /* Purge legacy */
157 );
158 }
159
160 /*
161 ** Return true if email alerts are active.
@@ -171,13 +172,14 @@
172 **
173 ** If the subscriber table does exist, return 0 without doing anything.
174 */
175 static int alert_webpages_disabled(void){
176 if( alert_tables_exist() ) return 0;
177 style_set_current_feature("alerts");
178 style_header("Email Alerts Are Disabled");
179 @ <p>Email alerts are disabled on this server</p>
180 style_finish_page();
181 return 1;
182 }
183
184 /*
185 ** Insert a "Subscriber List" submenu link if the current user
@@ -216,10 +218,11 @@
218 }
219 db_begin_transaction();
220
221 alert_submenu_common();
222 style_submenu_element("Send Announcement","%R/announce");
223 style_set_current_feature("alerts");
224 style_header("Email Notification Setup");
225 @ <h1>Status</h1>
226 @ <table class="label-value">
227 if( alert_enabled() ){
228 stats_for_email();
@@ -308,11 +311,11 @@
311 @ <hr>
312
313 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
314 @ </div></form>
315 db_end_transaction(0);
316 style_finish_page();
317 }
318
319 #if 0
320 /*
321 ** Encode pMsg as MIME base64 and append it to pOut
@@ -1060,11 +1063,11 @@
1063 prompt_user("Continue? (y/N) ", &yn);
1064 c = blob_str(&yn)[0];
1065 blob_reset(&yn);
1066 }
1067 if( c=='y' ){
1068 alert_drop_trigger();
1069 db_multi_exec(
1070 "DROP TABLE IF EXISTS subscriber;\n"
1071 "DROP TABLE IF EXISTS pending_alert;\n"
1072 "DROP TABLE IF EXISTS alert_bounce;\n"
1073 /* Legacy */
@@ -1364,10 +1367,11 @@
1367 }
1368 if( !g.perm.Admin && !db_get_boolean("anon-subscribe",1) ){
1369 register_page();
1370 return;
1371 }
1372 style_set_current_feature("alerts");
1373 alert_submenu_common();
1374 needCaptcha = !login_is_individual();
1375 if( P("submit")
1376 && cgi_csrf_safe(1)
1377 && subscribe_error_check(&eErr,&zErr,needCaptcha)
@@ -1435,11 +1439,11 @@
1439 @ <p>An email has been sent to "%h(zEAddr)". That email contains a
1440 @ hyperlink that you must click to activate your
1441 @ subscription.</p>
1442 }
1443 alert_sender_free(pSender);
1444 style_finish_page();
1445 }
1446 return;
1447 }
1448 style_header("Signup For Email Alerts");
1449 if( P("submit")==0 ){
@@ -1552,11 +1556,11 @@
1556 @ Enter the 8 characters above in the "Security Code" box<br/>
1557 @ </td></tr></table></div>
1558 }
1559 @ </form>
1560 fossil_free(zErr);
1561 style_finish_page();
1562 }
1563
1564 /*
1565 ** Either shutdown or completely delete a subscription entry given
1566 ** by the hex value zName. Then paint a webpage that explains that
@@ -1572,10 +1576,11 @@
1576 if( db_step(&q)==SQLITE_ROW ){
1577 zEmail = db_column_text(&q, 0);
1578 zLogin = db_column_text(&q, 1);
1579 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin);
1580 }
1581 style_set_current_feature("alerts");
1582 if( zEmail==0 ){
1583 style_header("Unsubscribe Fail");
1584 @ <p>Unable to locate a subscriber with the requested key</p>
1585 }else{
1586
@@ -1590,11 +1595,11 @@
1595 @ <a href="%R/setup_uedit?id=%d(uid)">edit or delete
1596 @ the corresponding user "%h(zLogin)"</a></p>
1597 }
1598 }
1599 db_finalize(&q);
1600 style_finish_page();
1601 return;
1602 }
1603
1604 /*
1605 ** WEBPAGE: alerts
@@ -1737,10 +1742,11 @@
1742 alert_unsubscribe(sid);
1743 db_commit_transaction();
1744 return;
1745 }
1746 }
1747 style_set_current_feature("alerts");
1748 style_header("Update Subscription");
1749 db_prepare(&q,
1750 "SELECT"
1751 " semail," /* 0 */
1752 " sverified," /* 1 */
@@ -1914,11 +1920,11 @@
1920 @ </tr>
1921 @ </table>
1922 @ </form>
1923 fossil_free(zErr);
1924 db_finalize(&q);
1925 style_finish_page();
1926 db_commit_transaction();
1927 return;
1928 }
1929
1930 /* This is the message that gets sent to describe how to change
@@ -1977,10 +1983,12 @@
1983 if( login_is_individual() ){
1984 cgi_redirectf("%R/alerts");
1985 return;
1986 }
1987
1988 style_set_current_feature("alerts");
1989
1990 zEAddr = PD("e","");
1991 dx = atoi(PD("dx","0"));
1992 bSubmit = P("submit")!=0 && P("e")!=0 && cgi_csrf_safe(1);
1993 if( bSubmit ){
1994 if( !captcha_is_correct(1) ){
@@ -2021,11 +2029,11 @@
2029 }else{
2030 @ <p>An email has been sent to "%h(zEAddr)" that explains how to
2031 @ unsubscribe and/or modify your subscription settings</p>
2032 }
2033 alert_sender_free(pSender);
2034 style_finish_page();
2035 return;
2036 }
2037
2038 /* Non-logged-in users have to enter an email address to which is
2039 ** sent a message containing the unsubscribe link.
@@ -2071,11 +2079,11 @@
2079 @ </pre>
2080 @ Enter the 8 characters above in the "Security Code" box<br/>
2081 @ </td></tr></table></div>
2082 @ </form>
2083 fossil_free(zErr);
2084 style_finish_page();
2085 }
2086
2087 /*
2088 ** WEBPAGE: subscribers
2089 **
@@ -2098,10 +2106,11 @@
2106 login_needed(0);
2107 return;
2108 }
2109 alert_submenu_common();
2110 style_submenu_element("Users","setup_ulist");
2111 style_set_current_feature("alerts");
2112 style_header("Subscriber List");
2113 nTotal = db_int(0, "SELECT count(*) FROM subscriber");
2114 nPending = db_int(0, "SELECT count(*) FROM subscriber WHERE NOT sverified");
2115 if( nPending>0 && P("purge") && cgi_csrf_safe(0) ){
2116 int nNewPending;
@@ -2182,11 +2191,11 @@
2191 @ </tr>
2192 }
2193 @ </tbody></table>
2194 db_finalize(&q);
2195 style_table_sorter();
2196 style_finish_page();
2197 }
2198
2199 #if LOCAL_INTERFACE
2200 /*
2201 ** A single event that might appear in an alert is recorded as an
@@ -2799,14 +2808,15 @@
2808 unsigned int uSeed = 0;
2809 const char *zDecoded;
2810 char *zCaptcha = 0;
2811
2812 login_check_credentials();
2813 style_set_current_feature("alerts");
2814 if( zAdminEmail==0 || zAdminEmail[0]==0 ){
2815 style_header("Outbound Email Disabled");
2816 @ <p>Outbound email is disabled on this repository
2817 style_finish_page();
2818 return;
2819 }
2820 if( P("submit")!=0
2821 && P("subject")!=0
2822 && P("msg")!=0
@@ -2834,18 +2844,19 @@
2844 }else{
2845 @ <p>Your message has been sent to the repository administrator.
2846 @ Thank you for your input.</p>
2847 }
2848 alert_sender_free(pSender);
2849 style_finish_page();
2850 return;
2851 }
2852 if( captcha_needed() ){
2853 uSeed = captcha_seed();
2854 zDecoded = captcha_decode(uSeed);
2855 zCaptcha = captcha_render(zDecoded);
2856 }
2857 style_set_current_feature("alerts");
2858 style_header("Message To Administrator");
2859 form_begin(0, "%R/contact_admin");
2860 @ <p>Enter a message to the repository administrator below:</p>
2861 @ <table class="subscribe">
2862 if( zCaptcha ){
@@ -2881,11 +2892,11 @@
2892 @ </pre>
2893 @ Enter the 8 characters above in the "Security Code" box<br/>
2894 @ </td></tr></table></div>
2895 }
2896 @ </form>
2897 style_finish_page();
2898 }
2899
2900 /*
2901 ** Send an annoucement message described by query parameter.
2902 ** Permission to do this has already been verified.
@@ -2971,10 +2982,11 @@
2982 login_check_credentials();
2983 if( !g.perm.Announce ){
2984 login_needed(0);
2985 return;
2986 }
2987 style_set_current_feature("alerts");
2988 if( fossil_strcmp(P("name"),"test1")==0 ){
2989 /* Visit the /announce/test1 page to see the CGI variables */
2990 @ <p style='border: 1px solid black; padding: 1ex;'>
2991 cgi_print_all(0, 0);
2992 @ </p>
@@ -2989,11 +3001,11 @@
3001 @ </pre></blockquote>
3002 }else{
3003 @ <p>The announcement has been sent.
3004 @ <a href="%h(PD("REQUEST_URI","/"))">Send another</a></p>
3005 }
3006 style_finish_page();
3007 return;
3008 } else if( !alert_enabled() ){
3009 style_header("Cannot Send Announcement");
3010 @ <p>Either you have no subscribers yet, or email alerts are not yet
3011 @ <a href="https://fossil-scm.org/fossil/doc/trunk/www/alerts.md">set up</a>
@@ -3043,7 +3055,7 @@
3055 @ <td><input type="submit" name="submit" value="Send Message">
3056 }
3057 @ </tr>
3058 @ </table>
3059 @ </form>
3060 style_finish_page();
3061 }
3062
3063 DDED src/alerts/bflat2.wav
3064 DDED src/alerts/bflat3.wav
3065 DDED src/alerts/bloop.wav
3066 DDED src/alerts/mkwav.c
3067 DDED src/alerts/plunk.wav

Binary file

Binary file

Binary file

--- a/src/alerts/mkwav.c
+++ b/src/alerts/mkwav.c
@@ -0,0 +1,88 @@
1
+/*
2
+** This C program was used to generate the "g-minor-triad.wav" file.
3
+** A small modification generated the "b-flat.wav" file.
4
+**
5
+** This code is saved as an historical reference. It is not part
6
+** of Fossil.
7
+*/
8
+#include <stdio.h>
9
+#include <math.h>
10
+#include <stdlib.h>
11
+
12
+/*
13
+** Write a four-byte little-endian integer value to out.
14
+*/
15
+void write_int4(FILE *out, unsigned int i){
16
+ unsigned char z[4];
17
+ z[0] = i&0xff;
18
+ z[1] = (i>>8)&0xff;
19
+ z[2] = (i>>16)&0xff;
20
+ z[3] = (i>>24)&0xff;
21
+ fwrite(z, 4, 1, out);
22
+}
23
+
24
+/*
25
+** Write out the WAV file
26
+*/
27
+void write_wave(
28
+ const char *zFilename, /* The file to write */
29
+ unsigned int nData, /* Bytes of data */
30
+ unsigned char *aData /* 8000 samples/sec, 8 bit samples */
31
+){
32
+ const unsigned char aWavFmt[] = {
33
+ 0x57, 0x41, 0x56, 0x45, /* "WAVE" */
34
+ 0x66, 0x6d, 0x74, 0x20, /* "fmt " */
35
+ 0x10, 0x00, 0x00, 0x00, /* 16 bytes in the "fmt " section */
36
+ 0x01, 0x00, /* FormatTag: WAVE_FORMAT_PCM */
37
+ 0x01, 0x00, /* 1 channel */
38
+ 0x40, 0x1f, 0x00, 0x00, /* 8000 samples/second */
39
+ 0x40, 0x1f, 0x00, 0x00, /* 8000 bytes/second */
40
+ 0x01, 0x00, /* Block alignment */
41
+ 0x08, 0x00, /* bits/sample */
42
+ 0x64, 0x61, 0x74, 0x61, /* "data" */
43
+ };
44
+ FILE *out = fopen(zFilename,"wb");
45
+ if( out==0 ){
46
+ fprintf(stderr, "cannot open \"%s\" for writing\n", zFilename);
47
+ exit(1);
48
+ }
49
+ fwrite("RIFF", 4, 1, out);
50
+ write_int4(out, nData+4+20+8);
51
+ fwrite(aWavFmt, sizeof(aWavFmt), 1, out);
52
+ write_int4(out, nData);
53
+ fwrite(aData, nData, 1, out);
54
+ fclose(out);
55
+}
56
+
57
+int main(int argc, char **argv){
58
+ int i = 0;
59
+ unsigned char aBuf[800];
60
+# define N sizeof(aBuf)
61
+# define pitch1 195.9977*2 /* G */
62
+# define pitch2 233.0819*2 /* B-flat */
63
+# define pitch3 293.6648*2 /* D */
64
+ while( i<N/2 ){
65
+ double v;
66
+ v = 99.0*sin((2*M_PI*pitch3*i)/8000);
67
+ if( i<200 ){
68
+ v = v*i/200.0;
69
+ }else if( i>N-200 ){
70
+ v = v*(N-i)/200.0;
71
+ }
72
+ aBuf[i] = (char)(v+99.0);
73
+ i++;
74
+ }
75
+ while( i<N ){
76
+ double v;
77
+ v = 99.0*sin((2*M_PI*pitch1*i)/8000);
78
+ if( i<200 ){
79
+ v = v*i/200.0;
80
+ }else if( i>N-200 ){
81
+ v = v*(N-i)/200.0;
82
+ }
83
+ aBuf[i] = (char)(v+99.0);
84
+ i++;
85
+ }
86
+ write_wave("out.wav", N, aBuf);
87
+ return 0;
88
+}
--- a/src/alerts/mkwav.c
+++ b/src/alerts/mkwav.c
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/alerts/mkwav.c
+++ b/src/alerts/mkwav.c
@@ -0,0 +1,88 @@
1 /*
2 ** This C program was used to generate the "g-minor-triad.wav" file.
3 ** A small modification generated the "b-flat.wav" file.
4 **
5 ** This code is saved as an historical reference. It is not part
6 ** of Fossil.
7 */
8 #include <stdio.h>
9 #include <math.h>
10 #include <stdlib.h>
11
12 /*
13 ** Write a four-byte little-endian integer value to out.
14 */
15 void write_int4(FILE *out, unsigned int i){
16 unsigned char z[4];
17 z[0] = i&0xff;
18 z[1] = (i>>8)&0xff;
19 z[2] = (i>>16)&0xff;
20 z[3] = (i>>24)&0xff;
21 fwrite(z, 4, 1, out);
22 }
23
24 /*
25 ** Write out the WAV file
26 */
27 void write_wave(
28 const char *zFilename, /* The file to write */
29 unsigned int nData, /* Bytes of data */
30 unsigned char *aData /* 8000 samples/sec, 8 bit samples */
31 ){
32 const unsigned char aWavFmt[] = {
33 0x57, 0x41, 0x56, 0x45, /* "WAVE" */
34 0x66, 0x6d, 0x74, 0x20, /* "fmt " */
35 0x10, 0x00, 0x00, 0x00, /* 16 bytes in the "fmt " section */
36 0x01, 0x00, /* FormatTag: WAVE_FORMAT_PCM */
37 0x01, 0x00, /* 1 channel */
38 0x40, 0x1f, 0x00, 0x00, /* 8000 samples/second */
39 0x40, 0x1f, 0x00, 0x00, /* 8000 bytes/second */
40 0x01, 0x00, /* Block alignment */
41 0x08, 0x00, /* bits/sample */
42 0x64, 0x61, 0x74, 0x61, /* "data" */
43 };
44 FILE *out = fopen(zFilename,"wb");
45 if( out==0 ){
46 fprintf(stderr, "cannot open \"%s\" for writing\n", zFilename);
47 exit(1);
48 }
49 fwrite("RIFF", 4, 1, out);
50 write_int4(out, nData+4+20+8);
51 fwrite(aWavFmt, sizeof(aWavFmt), 1, out);
52 write_int4(out, nData);
53 fwrite(aData, nData, 1, out);
54 fclose(out);
55 }
56
57 int main(int argc, char **argv){
58 int i = 0;
59 unsigned char aBuf[800];
60 # define N sizeof(aBuf)
61 # define pitch1 195.9977*2 /* G */
62 # define pitch2 233.0819*2 /* B-flat */
63 # define pitch3 293.6648*2 /* D */
64 while( i<N/2 ){
65 double v;
66 v = 99.0*sin((2*M_PI*pitch3*i)/8000);
67 if( i<200 ){
68 v = v*i/200.0;
69 }else if( i>N-200 ){
70 v = v*(N-i)/200.0;
71 }
72 aBuf[i] = (char)(v+99.0);
73 i++;
74 }
75 while( i<N ){
76 double v;
77 v = 99.0*sin((2*M_PI*pitch1*i)/8000);
78 if( i<200 ){
79 v = v*i/200.0;
80 }else if( i>N-200 ){
81 v = v*(N-i)/200.0;
82 }
83 aBuf[i] = (char)(v+99.0);
84 i++;
85 }
86 write_wave("out.wav", N, aBuf);
87 return 0;
88 }

Binary file

+9 -5
--- src/attach.c
+++ src/attach.c
@@ -45,10 +45,11 @@
4545
Blob sql;
4646
Stmt q;
4747
4848
if( zPage && zTkt ) zTkt = 0;
4949
login_check_credentials();
50
+ style_set_current_feature("attach");
5051
blob_zero(&sql);
5152
blob_append_sql(&sql,
5253
"SELECT datetime(mtime,toLocal()), src, target, filename,"
5354
" comment, user,"
5455
" (SELECT uuid FROM blob WHERE rid=attachid), attachid,"
@@ -145,11 +146,11 @@
145146
hyperlink_to_date(zDate, ".");
146147
free(zUrlTail);
147148
}
148149
db_finalize(&q);
149150
@ </ol>
150
- style_finish_page("attach");
151
+ style_finish_page();
151152
return;
152153
}
153154
154155
/*
155156
** WEBPAGE: attachdownload
@@ -176,10 +177,11 @@
176177
int attachid = atoi(PD("attachid","0"));
177178
char *zUUID;
178179
179180
if( zFile==0 ) fossil_redirect_home();
180181
login_check_credentials();
182
+ style_set_current_feature("attach");
181183
if( zPage ){
182184
if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; }
183185
zTarget = zPage;
184186
}else if( zTkt ){
185187
if( g.perm.RdTkt==0 ){ login_needed(g.anon.RdTkt); return; }
@@ -205,16 +207,16 @@
205207
);
206208
}
207209
if( zUUID==0 || zUUID[0]==0 ){
208210
style_header("No Such Attachment");
209211
@ No such attachment....
210
- style_finish_page("attach");
212
+ style_finish_page();
211213
return;
212214
}else if( zUUID[0]=='x' ){
213215
style_header("Missing");
214216
@ Attachment has been deleted
215
- style_finish_page("attach");
217
+ style_finish_page();
216218
return;
217219
}else{
218220
g.perm.Read = 1;
219221
cgi_replace_parameter("name",zUUID);
220222
if( fossil_strcmp(g.zPath,"attachview")==0 ){
@@ -386,10 +388,11 @@
386388
(zPage!=0 && wiki_need_moderation(0));
387389
const char *zComment = PD("comment", "");
388390
attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment);
389391
cgi_redirect(zFrom);
390392
}
393
+ style_set_current_feature("attach");
391394
style_header("Add Attachment");
392395
if( !goodCaptcha ){
393396
@ <p class="generalError">Error: Incorrect security code.</p>
394397
}
395398
@ <h2>Add Attachment To %s(zTargetType)</h2>
@@ -410,11 +413,11 @@
410413
@ <input type="submit" name="ok" value="Add Attachment" />
411414
@ <input type="submit" name="cancel" value="Cancel" />
412415
@ </div>
413416
captcha_generate(0);
414417
@ </form>
415
- style_finish_page("attach");
418
+ style_finish_page();
416419
fossil_free(zTargetType);
417420
}
418421
419422
/*
420423
** WEBPAGE: ainfo
@@ -539,10 +542,11 @@
539542
}
540543
if( strcmp(zModAction,"approve")==0 ){
541544
moderation_approve('a', rid);
542545
}
543546
}
547
+ style_set_current_feature("attach");
544548
style_header("Attachment Details");
545549
style_submenu_element("Raw", "%R/artifact/%s", zUuid);
546550
if(fShowContent){
547551
style_submenu_element("Line Numbers", "%R/ainfo/%s%s", zUuid,
548552
((zLn&&*zLn) ? "" : "?ln=0"));
@@ -622,11 +626,11 @@
622626
@ <i>(file is %d(sz) bytes of binary data)</i>
623627
}
624628
@ </blockquote>
625629
manifest_destroy(pAttach);
626630
blob_reset(&attach);
627
- style_finish_page("attach");
631
+ style_finish_page();
628632
}
629633
630634
/*
631635
** Output HTML to show a list of attachments.
632636
*/
633637
--- src/attach.c
+++ src/attach.c
@@ -45,10 +45,11 @@
45 Blob sql;
46 Stmt q;
47
48 if( zPage && zTkt ) zTkt = 0;
49 login_check_credentials();
 
50 blob_zero(&sql);
51 blob_append_sql(&sql,
52 "SELECT datetime(mtime,toLocal()), src, target, filename,"
53 " comment, user,"
54 " (SELECT uuid FROM blob WHERE rid=attachid), attachid,"
@@ -145,11 +146,11 @@
145 hyperlink_to_date(zDate, ".");
146 free(zUrlTail);
147 }
148 db_finalize(&q);
149 @ </ol>
150 style_finish_page("attach");
151 return;
152 }
153
154 /*
155 ** WEBPAGE: attachdownload
@@ -176,10 +177,11 @@
176 int attachid = atoi(PD("attachid","0"));
177 char *zUUID;
178
179 if( zFile==0 ) fossil_redirect_home();
180 login_check_credentials();
 
181 if( zPage ){
182 if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; }
183 zTarget = zPage;
184 }else if( zTkt ){
185 if( g.perm.RdTkt==0 ){ login_needed(g.anon.RdTkt); return; }
@@ -205,16 +207,16 @@
205 );
206 }
207 if( zUUID==0 || zUUID[0]==0 ){
208 style_header("No Such Attachment");
209 @ No such attachment....
210 style_finish_page("attach");
211 return;
212 }else if( zUUID[0]=='x' ){
213 style_header("Missing");
214 @ Attachment has been deleted
215 style_finish_page("attach");
216 return;
217 }else{
218 g.perm.Read = 1;
219 cgi_replace_parameter("name",zUUID);
220 if( fossil_strcmp(g.zPath,"attachview")==0 ){
@@ -386,10 +388,11 @@
386 (zPage!=0 && wiki_need_moderation(0));
387 const char *zComment = PD("comment", "");
388 attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment);
389 cgi_redirect(zFrom);
390 }
 
391 style_header("Add Attachment");
392 if( !goodCaptcha ){
393 @ <p class="generalError">Error: Incorrect security code.</p>
394 }
395 @ <h2>Add Attachment To %s(zTargetType)</h2>
@@ -410,11 +413,11 @@
410 @ <input type="submit" name="ok" value="Add Attachment" />
411 @ <input type="submit" name="cancel" value="Cancel" />
412 @ </div>
413 captcha_generate(0);
414 @ </form>
415 style_finish_page("attach");
416 fossil_free(zTargetType);
417 }
418
419 /*
420 ** WEBPAGE: ainfo
@@ -539,10 +542,11 @@
539 }
540 if( strcmp(zModAction,"approve")==0 ){
541 moderation_approve('a', rid);
542 }
543 }
 
544 style_header("Attachment Details");
545 style_submenu_element("Raw", "%R/artifact/%s", zUuid);
546 if(fShowContent){
547 style_submenu_element("Line Numbers", "%R/ainfo/%s%s", zUuid,
548 ((zLn&&*zLn) ? "" : "?ln=0"));
@@ -622,11 +626,11 @@
622 @ <i>(file is %d(sz) bytes of binary data)</i>
623 }
624 @ </blockquote>
625 manifest_destroy(pAttach);
626 blob_reset(&attach);
627 style_finish_page("attach");
628 }
629
630 /*
631 ** Output HTML to show a list of attachments.
632 */
633
--- src/attach.c
+++ src/attach.c
@@ -45,10 +45,11 @@
45 Blob sql;
46 Stmt q;
47
48 if( zPage && zTkt ) zTkt = 0;
49 login_check_credentials();
50 style_set_current_feature("attach");
51 blob_zero(&sql);
52 blob_append_sql(&sql,
53 "SELECT datetime(mtime,toLocal()), src, target, filename,"
54 " comment, user,"
55 " (SELECT uuid FROM blob WHERE rid=attachid), attachid,"
@@ -145,11 +146,11 @@
146 hyperlink_to_date(zDate, ".");
147 free(zUrlTail);
148 }
149 db_finalize(&q);
150 @ </ol>
151 style_finish_page();
152 return;
153 }
154
155 /*
156 ** WEBPAGE: attachdownload
@@ -176,10 +177,11 @@
177 int attachid = atoi(PD("attachid","0"));
178 char *zUUID;
179
180 if( zFile==0 ) fossil_redirect_home();
181 login_check_credentials();
182 style_set_current_feature("attach");
183 if( zPage ){
184 if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; }
185 zTarget = zPage;
186 }else if( zTkt ){
187 if( g.perm.RdTkt==0 ){ login_needed(g.anon.RdTkt); return; }
@@ -205,16 +207,16 @@
207 );
208 }
209 if( zUUID==0 || zUUID[0]==0 ){
210 style_header("No Such Attachment");
211 @ No such attachment....
212 style_finish_page();
213 return;
214 }else if( zUUID[0]=='x' ){
215 style_header("Missing");
216 @ Attachment has been deleted
217 style_finish_page();
218 return;
219 }else{
220 g.perm.Read = 1;
221 cgi_replace_parameter("name",zUUID);
222 if( fossil_strcmp(g.zPath,"attachview")==0 ){
@@ -386,10 +388,11 @@
388 (zPage!=0 && wiki_need_moderation(0));
389 const char *zComment = PD("comment", "");
390 attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment);
391 cgi_redirect(zFrom);
392 }
393 style_set_current_feature("attach");
394 style_header("Add Attachment");
395 if( !goodCaptcha ){
396 @ <p class="generalError">Error: Incorrect security code.</p>
397 }
398 @ <h2>Add Attachment To %s(zTargetType)</h2>
@@ -410,11 +413,11 @@
413 @ <input type="submit" name="ok" value="Add Attachment" />
414 @ <input type="submit" name="cancel" value="Cancel" />
415 @ </div>
416 captcha_generate(0);
417 @ </form>
418 style_finish_page();
419 fossil_free(zTargetType);
420 }
421
422 /*
423 ** WEBPAGE: ainfo
@@ -539,10 +542,11 @@
542 }
543 if( strcmp(zModAction,"approve")==0 ){
544 moderation_approve('a', rid);
545 }
546 }
547 style_set_current_feature("attach");
548 style_header("Attachment Details");
549 style_submenu_element("Raw", "%R/artifact/%s", zUuid);
550 if(fShowContent){
551 style_submenu_element("Line Numbers", "%R/ainfo/%s%s", zUuid,
552 ((zLn&&*zLn) ? "" : "?ln=0"));
@@ -622,11 +626,11 @@
626 @ <i>(file is %d(sz) bytes of binary data)</i>
627 }
628 @ </blockquote>
629 manifest_destroy(pAttach);
630 blob_reset(&attach);
631 style_finish_page();
632 }
633
634 /*
635 ** Output HTML to show a list of attachments.
636 */
637
+4 -2
--- src/backlink.c
+++ src/backlink.c
@@ -76,10 +76,11 @@
7676
login_check_credentials();
7777
if( !g.perm.Read || !g.perm.RdTkt || !g.perm.RdWiki ){
7878
login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
7979
return;
8080
}
81
+ style_set_current_feature("test");
8182
style_header("Backlink Timeline (Internal Testing Use)");
8283
db_multi_exec(
8384
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
8485
"DELETE FROM ok;"
8586
"INSERT OR IGNORE INTO ok"
@@ -91,11 +92,11 @@
9192
blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
9293
db_prepare(&q, "%s", blob_sql_text(&sql));
9394
www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
9495
0, 0, 0, 0, 0, 0);
9596
db_finalize(&q);
96
- style_finish_page("test");
97
+ style_finish_page();
9798
}
9899
99100
/*
100101
** WEBPAGE: test-backlinks
101102
**
@@ -107,10 +108,11 @@
107108
login_check_credentials();
108109
if( !g.perm.Admin ){
109110
login_needed(g.anon.Admin);
110111
return;
111112
}
113
+ style_set_current_feature("test");
112114
style_header("Backlink Table (Internal Testing Use)");
113115
n = db_int(0, "SELECT count(*) FROM backlink");
114116
@ <p>%d(n) backlink table entries:</p>
115117
db_prepare(&q,
116118
"SELECT target, srctype, srcid, datetime(mtime),"
@@ -152,11 +154,11 @@
152154
@ <td>%h(zMtime)</tr>
153155
}
154156
@ </tbody>
155157
@ </table>
156158
db_finalize(&q);
157
- style_finish_page("test");
159
+ style_finish_page();
158160
}
159161
160162
/*
161163
** Remove all prior backlinks for the wiki page given. Then
162164
** add new backlinks for the latest version of the wiki page.
163165
--- src/backlink.c
+++ src/backlink.c
@@ -76,10 +76,11 @@
76 login_check_credentials();
77 if( !g.perm.Read || !g.perm.RdTkt || !g.perm.RdWiki ){
78 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
79 return;
80 }
 
81 style_header("Backlink Timeline (Internal Testing Use)");
82 db_multi_exec(
83 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
84 "DELETE FROM ok;"
85 "INSERT OR IGNORE INTO ok"
@@ -91,11 +92,11 @@
91 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
92 db_prepare(&q, "%s", blob_sql_text(&sql));
93 www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
94 0, 0, 0, 0, 0, 0);
95 db_finalize(&q);
96 style_finish_page("test");
97 }
98
99 /*
100 ** WEBPAGE: test-backlinks
101 **
@@ -107,10 +108,11 @@
107 login_check_credentials();
108 if( !g.perm.Admin ){
109 login_needed(g.anon.Admin);
110 return;
111 }
 
112 style_header("Backlink Table (Internal Testing Use)");
113 n = db_int(0, "SELECT count(*) FROM backlink");
114 @ <p>%d(n) backlink table entries:</p>
115 db_prepare(&q,
116 "SELECT target, srctype, srcid, datetime(mtime),"
@@ -152,11 +154,11 @@
152 @ <td>%h(zMtime)</tr>
153 }
154 @ </tbody>
155 @ </table>
156 db_finalize(&q);
157 style_finish_page("test");
158 }
159
160 /*
161 ** Remove all prior backlinks for the wiki page given. Then
162 ** add new backlinks for the latest version of the wiki page.
163
--- src/backlink.c
+++ src/backlink.c
@@ -76,10 +76,11 @@
76 login_check_credentials();
77 if( !g.perm.Read || !g.perm.RdTkt || !g.perm.RdWiki ){
78 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
79 return;
80 }
81 style_set_current_feature("test");
82 style_header("Backlink Timeline (Internal Testing Use)");
83 db_multi_exec(
84 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
85 "DELETE FROM ok;"
86 "INSERT OR IGNORE INTO ok"
@@ -91,11 +92,11 @@
92 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
93 db_prepare(&q, "%s", blob_sql_text(&sql));
94 www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
95 0, 0, 0, 0, 0, 0);
96 db_finalize(&q);
97 style_finish_page();
98 }
99
100 /*
101 ** WEBPAGE: test-backlinks
102 **
@@ -107,10 +108,11 @@
108 login_check_credentials();
109 if( !g.perm.Admin ){
110 login_needed(g.anon.Admin);
111 return;
112 }
113 style_set_current_feature("test");
114 style_header("Backlink Table (Internal Testing Use)");
115 n = db_int(0, "SELECT count(*) FROM backlink");
116 @ <p>%d(n) backlink table entries:</p>
117 db_prepare(&q,
118 "SELECT target, srctype, srcid, datetime(mtime),"
@@ -152,11 +154,11 @@
154 @ <td>%h(zMtime)</tr>
155 }
156 @ </tbody>
157 @ </table>
158 db_finalize(&q);
159 style_finish_page();
160 }
161
162 /*
163 ** Remove all prior backlinks for the wiki page given. Then
164 ** add new backlinks for the latest version of the wiki page.
165
--- src/backoffice.c
+++ src/backoffice.c
@@ -663,11 +663,11 @@
663663
** processing happens periodically. Or, the --poll option can be used
664664
** to run this command as a daemon that will periodically invoke backoffice
665665
** on a collection of repositories.
666666
**
667667
** If only a single repository is named and --poll is omitted, then the
668
-** backoffice work is done in-process. But if there are multiple respositories
668
+** backoffice work is done in-process. But if there are multiple repositories
669669
** or if --poll is used, a separate sub-process is started for each poll of
670670
** each repository.
671671
**
672672
** Standard options:
673673
**
674674
--- src/backoffice.c
+++ src/backoffice.c
@@ -663,11 +663,11 @@
663 ** processing happens periodically. Or, the --poll option can be used
664 ** to run this command as a daemon that will periodically invoke backoffice
665 ** on a collection of repositories.
666 **
667 ** If only a single repository is named and --poll is omitted, then the
668 ** backoffice work is done in-process. But if there are multiple respositories
669 ** or if --poll is used, a separate sub-process is started for each poll of
670 ** each repository.
671 **
672 ** Standard options:
673 **
674
--- src/backoffice.c
+++ src/backoffice.c
@@ -663,11 +663,11 @@
663 ** processing happens periodically. Or, the --poll option can be used
664 ** to run this command as a daemon that will periodically invoke backoffice
665 ** on a collection of repositories.
666 **
667 ** If only a single repository is named and --poll is omitted, then the
668 ** backoffice work is done in-process. But if there are multiple repositories
669 ** or if --poll is used, a separate sub-process is started for each poll of
670 ** each repository.
671 **
672 ** Standard options:
673 **
674
+12 -1
--- src/blob.c
+++ src/blob.c
@@ -365,10 +365,21 @@
365365
}else{
366366
blob_materialize(p);
367367
}
368368
return p->aData;
369369
}
370
+
371
+/*
372
+** Compute the string length of a Blob. If there are embedded
373
+** nul characters, truncate the to blob at the first nul.
374
+*/
375
+int blob_strlen(Blob *p){
376
+ char *z = blob_str(p);
377
+ if( z==0 ) return 0;
378
+ p->nUsed = (int)strlen(p->aData);
379
+ return p->nUsed;
380
+}
370381
371382
/*
372383
** Return a pointer to a null-terminated string for a blob that has
373384
** been created using blob_append_sql() and not blob_appendf(). If
374385
** text was ever added using blob_appendf() then throw an error.
@@ -1368,11 +1379,11 @@
13681379
/*
13691380
** COMMAND: test-escaped-arg
13701381
**
13711382
** Usage %fossil ARG ...
13721383
**
1373
-** Run each argment through blob_append_escaped_arg() and show the
1384
+** Run each argument through blob_append_escaped_arg() and show the
13741385
** result. Append each argument to "fossil test-echo" and run that
13751386
** using fossil_system() to verify that it really does get escaped
13761387
** correctly.
13771388
*/
13781389
void test_escaped_arg__cmd(void){
13791390
--- src/blob.c
+++ src/blob.c
@@ -365,10 +365,21 @@
365 }else{
366 blob_materialize(p);
367 }
368 return p->aData;
369 }
 
 
 
 
 
 
 
 
 
 
 
370
371 /*
372 ** Return a pointer to a null-terminated string for a blob that has
373 ** been created using blob_append_sql() and not blob_appendf(). If
374 ** text was ever added using blob_appendf() then throw an error.
@@ -1368,11 +1379,11 @@
1368 /*
1369 ** COMMAND: test-escaped-arg
1370 **
1371 ** Usage %fossil ARG ...
1372 **
1373 ** Run each argment through blob_append_escaped_arg() and show the
1374 ** result. Append each argument to "fossil test-echo" and run that
1375 ** using fossil_system() to verify that it really does get escaped
1376 ** correctly.
1377 */
1378 void test_escaped_arg__cmd(void){
1379
--- src/blob.c
+++ src/blob.c
@@ -365,10 +365,21 @@
365 }else{
366 blob_materialize(p);
367 }
368 return p->aData;
369 }
370
371 /*
372 ** Compute the string length of a Blob. If there are embedded
373 ** nul characters, truncate the to blob at the first nul.
374 */
375 int blob_strlen(Blob *p){
376 char *z = blob_str(p);
377 if( z==0 ) return 0;
378 p->nUsed = (int)strlen(p->aData);
379 return p->nUsed;
380 }
381
382 /*
383 ** Return a pointer to a null-terminated string for a blob that has
384 ** been created using blob_append_sql() and not blob_appendf(). If
385 ** text was ever added using blob_appendf() then throw an error.
@@ -1368,11 +1379,11 @@
1379 /*
1380 ** COMMAND: test-escaped-arg
1381 **
1382 ** Usage %fossil ARG ...
1383 **
1384 ** Run each argument through blob_append_escaped_arg() and show the
1385 ** result. Append each argument to "fossil test-echo" and run that
1386 ** using fossil_system() to verify that it really does get escaped
1387 ** correctly.
1388 */
1389 void test_escaped_arg__cmd(void){
1390
+6 -3
--- src/branch.c
+++ src/branch.c
@@ -458,10 +458,11 @@
458458
Stmt q;
459459
double rNow;
460460
int show_colors = PB("colors");
461461
login_check_credentials();
462462
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
463
+ style_set_current_feature("branch");
463464
style_header("Branches");
464465
style_adunit_config(ADUNIT_RIGHT_OK);
465466
style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
466467
login_anonymous_available();
467468
@@ -514,11 +515,11 @@
514515
@ </tr>
515516
}
516517
@ </tbody></table></div>
517518
db_finalize(&q);
518519
style_table_sorter();
519
- style_finish_page("branch");
520
+ style_finish_page();
520521
}
521522
522523
/*
523524
** WEBPAGE: brlist
524525
** Show a list of branches. With no query parameters, a sortable table
@@ -556,10 +557,11 @@
556557
showAll = 1;
557558
}
558559
if( showAll ) brFlags = BRL_BOTH;
559560
if( showClosed ) brFlags = BRL_CLOSED_ONLY;
560561
562
+ style_set_current_feature("branch");
561563
style_header("%s", showClosed ? "Closed Branches" :
562564
showAll ? "All Branches" : "Open Branches");
563565
style_submenu_element("Timeline", "brtimeline");
564566
if( showClosed ){
565567
style_submenu_element("All", "brlist?all");
@@ -622,11 +624,11 @@
622624
}
623625
if( cnt ){
624626
@ </ul>
625627
}
626628
db_finalize(&q);
627
- style_finish_page("branch");
629
+ style_finish_page();
628630
}
629631
630632
/*
631633
** This routine is called while for each check-in that is rendered by
632634
** the timeline of a "brlist" page. Add some additional hyperlinks
@@ -671,10 +673,11 @@
671673
int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */
672674
673675
login_check_credentials();
674676
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
675677
678
+ style_set_current_feature("branch");
676679
style_header("Branches");
677680
style_submenu_element("List", "brlist");
678681
login_anonymous_available();
679682
timeline_ss_submenu();
680683
cookie_render();
@@ -698,7 +701,7 @@
698701
if( PB("ng")==0 ) tmFlags |= TIMELINE_GRAPH;
699702
if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR;
700703
if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR;
701704
www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra);
702705
db_finalize(&q);
703
- style_finish_page("branch");
706
+ style_finish_page();
704707
}
705708
--- src/branch.c
+++ src/branch.c
@@ -458,10 +458,11 @@
458 Stmt q;
459 double rNow;
460 int show_colors = PB("colors");
461 login_check_credentials();
462 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
 
463 style_header("Branches");
464 style_adunit_config(ADUNIT_RIGHT_OK);
465 style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
466 login_anonymous_available();
467
@@ -514,11 +515,11 @@
514 @ </tr>
515 }
516 @ </tbody></table></div>
517 db_finalize(&q);
518 style_table_sorter();
519 style_finish_page("branch");
520 }
521
522 /*
523 ** WEBPAGE: brlist
524 ** Show a list of branches. With no query parameters, a sortable table
@@ -556,10 +557,11 @@
556 showAll = 1;
557 }
558 if( showAll ) brFlags = BRL_BOTH;
559 if( showClosed ) brFlags = BRL_CLOSED_ONLY;
560
 
561 style_header("%s", showClosed ? "Closed Branches" :
562 showAll ? "All Branches" : "Open Branches");
563 style_submenu_element("Timeline", "brtimeline");
564 if( showClosed ){
565 style_submenu_element("All", "brlist?all");
@@ -622,11 +624,11 @@
622 }
623 if( cnt ){
624 @ </ul>
625 }
626 db_finalize(&q);
627 style_finish_page("branch");
628 }
629
630 /*
631 ** This routine is called while for each check-in that is rendered by
632 ** the timeline of a "brlist" page. Add some additional hyperlinks
@@ -671,10 +673,11 @@
671 int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */
672
673 login_check_credentials();
674 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
675
 
676 style_header("Branches");
677 style_submenu_element("List", "brlist");
678 login_anonymous_available();
679 timeline_ss_submenu();
680 cookie_render();
@@ -698,7 +701,7 @@
698 if( PB("ng")==0 ) tmFlags |= TIMELINE_GRAPH;
699 if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR;
700 if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR;
701 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra);
702 db_finalize(&q);
703 style_finish_page("branch");
704 }
705
--- src/branch.c
+++ src/branch.c
@@ -458,10 +458,11 @@
458 Stmt q;
459 double rNow;
460 int show_colors = PB("colors");
461 login_check_credentials();
462 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
463 style_set_current_feature("branch");
464 style_header("Branches");
465 style_adunit_config(ADUNIT_RIGHT_OK);
466 style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
467 login_anonymous_available();
468
@@ -514,11 +515,11 @@
515 @ </tr>
516 }
517 @ </tbody></table></div>
518 db_finalize(&q);
519 style_table_sorter();
520 style_finish_page();
521 }
522
523 /*
524 ** WEBPAGE: brlist
525 ** Show a list of branches. With no query parameters, a sortable table
@@ -556,10 +557,11 @@
557 showAll = 1;
558 }
559 if( showAll ) brFlags = BRL_BOTH;
560 if( showClosed ) brFlags = BRL_CLOSED_ONLY;
561
562 style_set_current_feature("branch");
563 style_header("%s", showClosed ? "Closed Branches" :
564 showAll ? "All Branches" : "Open Branches");
565 style_submenu_element("Timeline", "brtimeline");
566 if( showClosed ){
567 style_submenu_element("All", "brlist?all");
@@ -622,11 +624,11 @@
624 }
625 if( cnt ){
626 @ </ul>
627 }
628 db_finalize(&q);
629 style_finish_page();
630 }
631
632 /*
633 ** This routine is called while for each check-in that is rendered by
634 ** the timeline of a "brlist" page. Add some additional hyperlinks
@@ -671,10 +673,11 @@
673 int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */
674
675 login_check_credentials();
676 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
677
678 style_set_current_feature("branch");
679 style_header("Branches");
680 style_submenu_element("List", "brlist");
681 login_anonymous_available();
682 timeline_ss_submenu();
683 cookie_render();
@@ -698,7 +701,7 @@
701 if( PB("ng")==0 ) tmFlags |= TIMELINE_GRAPH;
702 if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR;
703 if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR;
704 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra);
705 db_finalize(&q);
706 style_finish_page();
707 }
708
+16 -16
--- src/browse.c
+++ src/browse.c
@@ -336,11 +336,11 @@
336336
337337
/* If the "noreadme" query parameter is present, do not try to
338338
** show the content of the README file.
339339
*/
340340
if( P("noreadme")!=0 ){
341
- style_finish_page("dir");
341
+ style_finish_page();
342342
return;
343343
}
344344
345345
/* If the directory contains a readme file, then display its content below
346346
** the list of files
@@ -397,11 +397,11 @@
397397
document_emit_js();
398398
}
399399
}
400400
}
401401
db_finalize(&q);
402
- style_finish_page("dir");
402
+ style_finish_page();
403403
}
404404
405405
/*
406406
** Objects used by the "tree" webpage.
407407
*/
@@ -786,16 +786,17 @@
786786
}
787787
db_finalize(&q);
788788
}else{
789789
Stmt q;
790790
db_prepare(&q,
791
- "SELECT filename.name, blob.uuid, max(event.mtime)\n"
792
- " FROM filename, mlink, blob, event\n"
793
- " WHERE mlink.fnid=filename.fnid\n"
794
- " AND event.objid=mlink.mid\n"
795
- " AND blob.rid=mlink.fid\n"
796
- " GROUP BY 1 ORDER BY 1 COLLATE nocase");
791
+ "SELECT\n"
792
+ " (SELECT name FROM filename WHERE filename.fnid=mlink.fnid),\n"
793
+ " (SELECT uuid FROM blob WHERE blob.rid=mlink.fid),\n"
794
+ " max(event.mtime)\n"
795
+ " FROM mlink JOIN event ON event.objid=mlink.mid\n"
796
+ " GROUP BY mlink.fnid\n"
797
+ " ORDER BY 1 COLLATE nocase;");
797798
while( db_step(&q)==SQLITE_ROW ){
798799
const char *zName = db_column_text(&q, 0);
799800
const char *zUuid = db_column_text(&q,1);
800801
double mtime = db_column_double(&q,2);
801802
if( nD>0 && (fossil_strncmp(zName, zD, nD-1)!=0 || zName[nD-1]!='/') ){
@@ -913,11 +914,11 @@
913914
}
914915
}
915916
@ </ul>
916917
@ </ul></div>
917918
builtin_request_js("tree.js");
918
- style_finish_page("tree");
919
+ style_finish_page();
919920
920921
/* We could free memory used by sTree here if we needed to. But
921922
** the process is about to exit, so doing so would not really accomplish
922923
** anything useful. */
923924
}
@@ -956,16 +957,15 @@
956957
@ CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;
957958
;
958959
959960
static const char zComputeFileAgeRun[] =
960961
@ WITH RECURSIVE
961
-@ ckin(x,m) AS (SELECT objid, mtime FROM event WHERE objid=:ckin
962
-@ UNION
963
-@ SELECT plink.pid, event.mtime
964
-@ FROM ckin, plink, event
965
-@ WHERE plink.cid=ckin.x AND event.objid=plink.pid
966
-@ ORDER BY 2 DESC)
962
+@ ckin(x) AS (VALUES(:ckin)
963
+@ UNION
964
+@ SELECT plink.pid
965
+@ FROM ckin, plink
966
+@ WHERE plink.cid=ckin.x)
967967
@ INSERT OR IGNORE INTO fileage(fnid, fid, mid, mtime, pathname)
968968
@ SELECT filename.fnid, mlink.fid, mlink.mid, event.mtime, filename.name
969969
@ FROM foci, filename, blob, mlink, event
970970
@ WHERE foci.checkinID=:ckin
971971
@ AND foci.filename GLOB :glob
@@ -1167,7 +1167,7 @@
11671167
fossil_free(zAge);
11681168
}
11691169
@ </table></div>
11701170
db_finalize(&q1);
11711171
db_finalize(&q2);
1172
- style_finish_page("fileage");
1172
+ style_finish_page();
11731173
}
11741174
--- src/browse.c
+++ src/browse.c
@@ -336,11 +336,11 @@
336
337 /* If the "noreadme" query parameter is present, do not try to
338 ** show the content of the README file.
339 */
340 if( P("noreadme")!=0 ){
341 style_finish_page("dir");
342 return;
343 }
344
345 /* If the directory contains a readme file, then display its content below
346 ** the list of files
@@ -397,11 +397,11 @@
397 document_emit_js();
398 }
399 }
400 }
401 db_finalize(&q);
402 style_finish_page("dir");
403 }
404
405 /*
406 ** Objects used by the "tree" webpage.
407 */
@@ -786,16 +786,17 @@
786 }
787 db_finalize(&q);
788 }else{
789 Stmt q;
790 db_prepare(&q,
791 "SELECT filename.name, blob.uuid, max(event.mtime)\n"
792 " FROM filename, mlink, blob, event\n"
793 " WHERE mlink.fnid=filename.fnid\n"
794 " AND event.objid=mlink.mid\n"
795 " AND blob.rid=mlink.fid\n"
796 " GROUP BY 1 ORDER BY 1 COLLATE nocase");
 
797 while( db_step(&q)==SQLITE_ROW ){
798 const char *zName = db_column_text(&q, 0);
799 const char *zUuid = db_column_text(&q,1);
800 double mtime = db_column_double(&q,2);
801 if( nD>0 && (fossil_strncmp(zName, zD, nD-1)!=0 || zName[nD-1]!='/') ){
@@ -913,11 +914,11 @@
913 }
914 }
915 @ </ul>
916 @ </ul></div>
917 builtin_request_js("tree.js");
918 style_finish_page("tree");
919
920 /* We could free memory used by sTree here if we needed to. But
921 ** the process is about to exit, so doing so would not really accomplish
922 ** anything useful. */
923 }
@@ -956,16 +957,15 @@
956 @ CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;
957 ;
958
959 static const char zComputeFileAgeRun[] =
960 @ WITH RECURSIVE
961 @ ckin(x,m) AS (SELECT objid, mtime FROM event WHERE objid=:ckin
962 @ UNION
963 @ SELECT plink.pid, event.mtime
964 @ FROM ckin, plink, event
965 @ WHERE plink.cid=ckin.x AND event.objid=plink.pid
966 @ ORDER BY 2 DESC)
967 @ INSERT OR IGNORE INTO fileage(fnid, fid, mid, mtime, pathname)
968 @ SELECT filename.fnid, mlink.fid, mlink.mid, event.mtime, filename.name
969 @ FROM foci, filename, blob, mlink, event
970 @ WHERE foci.checkinID=:ckin
971 @ AND foci.filename GLOB :glob
@@ -1167,7 +1167,7 @@
1167 fossil_free(zAge);
1168 }
1169 @ </table></div>
1170 db_finalize(&q1);
1171 db_finalize(&q2);
1172 style_finish_page("fileage");
1173 }
1174
--- src/browse.c
+++ src/browse.c
@@ -336,11 +336,11 @@
336
337 /* If the "noreadme" query parameter is present, do not try to
338 ** show the content of the README file.
339 */
340 if( P("noreadme")!=0 ){
341 style_finish_page();
342 return;
343 }
344
345 /* If the directory contains a readme file, then display its content below
346 ** the list of files
@@ -397,11 +397,11 @@
397 document_emit_js();
398 }
399 }
400 }
401 db_finalize(&q);
402 style_finish_page();
403 }
404
405 /*
406 ** Objects used by the "tree" webpage.
407 */
@@ -786,16 +786,17 @@
786 }
787 db_finalize(&q);
788 }else{
789 Stmt q;
790 db_prepare(&q,
791 "SELECT\n"
792 " (SELECT name FROM filename WHERE filename.fnid=mlink.fnid),\n"
793 " (SELECT uuid FROM blob WHERE blob.rid=mlink.fid),\n"
794 " max(event.mtime)\n"
795 " FROM mlink JOIN event ON event.objid=mlink.mid\n"
796 " GROUP BY mlink.fnid\n"
797 " ORDER BY 1 COLLATE nocase;");
798 while( db_step(&q)==SQLITE_ROW ){
799 const char *zName = db_column_text(&q, 0);
800 const char *zUuid = db_column_text(&q,1);
801 double mtime = db_column_double(&q,2);
802 if( nD>0 && (fossil_strncmp(zName, zD, nD-1)!=0 || zName[nD-1]!='/') ){
@@ -913,11 +914,11 @@
914 }
915 }
916 @ </ul>
917 @ </ul></div>
918 builtin_request_js("tree.js");
919 style_finish_page();
920
921 /* We could free memory used by sTree here if we needed to. But
922 ** the process is about to exit, so doing so would not really accomplish
923 ** anything useful. */
924 }
@@ -956,16 +957,15 @@
957 @ CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;
958 ;
959
960 static const char zComputeFileAgeRun[] =
961 @ WITH RECURSIVE
962 @ ckin(x) AS (VALUES(:ckin)
963 @ UNION
964 @ SELECT plink.pid
965 @ FROM ckin, plink
966 @ WHERE plink.cid=ckin.x)
 
967 @ INSERT OR IGNORE INTO fileage(fnid, fid, mid, mtime, pathname)
968 @ SELECT filename.fnid, mlink.fid, mlink.mid, event.mtime, filename.name
969 @ FROM foci, filename, blob, mlink, event
970 @ WHERE foci.checkinID=:ckin
971 @ AND foci.filename GLOB :glob
@@ -1167,7 +1167,7 @@
1167 fossil_free(zAge);
1168 }
1169 @ </table></div>
1170 db_finalize(&q1);
1171 db_finalize(&q2);
1172 style_finish_page();
1173 }
1174
+11 -5
--- src/builtin.c
+++ src/builtin.c
@@ -94,20 +94,21 @@
9494
**
9595
** Show all built-in text files.
9696
*/
9797
void test_builtin_list_page(void){
9898
int i;
99
+ style_set_current_feature("test");
99100
style_header("Built-in Text Files");
100101
@ <ol>
101102
for(i=0; i<count(aBuiltinFiles); i++){
102103
const char *z = aBuiltinFiles[i].zName;
103104
char *zUrl = href("%R/builtin?name=%T&id=%.8s&mimetype=text/plain",
104105
z,fossil_exe_id());
105106
@ <li>%z(zUrl)%h(z)</a>
106107
}
107108
@ </ol>
108
- style_finish_page("test");
109
+ style_finish_page();
109110
}
110111
111112
/*
112113
** COMMAND: test-builtin-get
113114
**
@@ -178,16 +179,17 @@
178179
** result is immutable and sets a very large cache retention time (1 year).
179180
*/
180181
void builtin_webpage(void){
181182
Blob out;
182183
const char *zName = P("name");
183
- const char *zTxt = 0;
184
+ const char *zContent = 0;
185
+ int nContent = 0;
184186
const char *zId = P("id");
185187
const char *zType = P("mimetype");
186188
int nId;
187
- if( zName ) zTxt = builtin_text(zName);
188
- if( zTxt==0 ){
189
+ if( zName ) zContent = (const char *)builtin_file(zName, &nContent);
190
+ if( zContent==0 ){
189191
const char *zM = P("m");
190192
if( zM ){
191193
if( zId && (nId = (int)strlen(zId))>=8
192194
&& strncmp(zId,fossil_exe_id(),nId)==0
193195
){
@@ -214,11 +216,11 @@
214216
&& strncmp(zId,fossil_exe_id(),nId)==0
215217
){
216218
g.isConst = 1;
217219
}
218220
etag_check(0,0);
219
- blob_init(&out, zTxt, -1);
221
+ blob_init(&out, zContent, nContent);
220222
cgi_set_content(&out);
221223
}
222224
223225
/* Variables controlling the JS cache.
224226
*/
@@ -635,10 +637,14 @@
635637
CX("isDark: %s"
636638
"/*true if the current skin has the 'white-foreground' detail*/",
637639
skin_detail_boolean("white-foreground") ? "true" : "false");
638640
CX("}\n"/*fossil.config.skin*/);
639641
CX("};\n"/* fossil.config */);
642
+ CX("window.fossil.user = {");
643
+ CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest");
644
+ CX("isAdmin: %s", (g.perm.Admin || g.perm.Setup) ? "true" : "false");
645
+ CX("};\n"/*fossil.user*/);
640646
CX("if(fossil.config.skin.isDark) "
641647
"document.body.classList.add('fossil-dark-style');\n");
642648
#if 0
643649
/* Is it safe to emit the CSRF token here? Some pages add it
644650
** as a hidden form field. */
645651
--- src/builtin.c
+++ src/builtin.c
@@ -94,20 +94,21 @@
94 **
95 ** Show all built-in text files.
96 */
97 void test_builtin_list_page(void){
98 int i;
 
99 style_header("Built-in Text Files");
100 @ <ol>
101 for(i=0; i<count(aBuiltinFiles); i++){
102 const char *z = aBuiltinFiles[i].zName;
103 char *zUrl = href("%R/builtin?name=%T&id=%.8s&mimetype=text/plain",
104 z,fossil_exe_id());
105 @ <li>%z(zUrl)%h(z)</a>
106 }
107 @ </ol>
108 style_finish_page("test");
109 }
110
111 /*
112 ** COMMAND: test-builtin-get
113 **
@@ -178,16 +179,17 @@
178 ** result is immutable and sets a very large cache retention time (1 year).
179 */
180 void builtin_webpage(void){
181 Blob out;
182 const char *zName = P("name");
183 const char *zTxt = 0;
 
184 const char *zId = P("id");
185 const char *zType = P("mimetype");
186 int nId;
187 if( zName ) zTxt = builtin_text(zName);
188 if( zTxt==0 ){
189 const char *zM = P("m");
190 if( zM ){
191 if( zId && (nId = (int)strlen(zId))>=8
192 && strncmp(zId,fossil_exe_id(),nId)==0
193 ){
@@ -214,11 +216,11 @@
214 && strncmp(zId,fossil_exe_id(),nId)==0
215 ){
216 g.isConst = 1;
217 }
218 etag_check(0,0);
219 blob_init(&out, zTxt, -1);
220 cgi_set_content(&out);
221 }
222
223 /* Variables controlling the JS cache.
224 */
@@ -635,10 +637,14 @@
635 CX("isDark: %s"
636 "/*true if the current skin has the 'white-foreground' detail*/",
637 skin_detail_boolean("white-foreground") ? "true" : "false");
638 CX("}\n"/*fossil.config.skin*/);
639 CX("};\n"/* fossil.config */);
 
 
 
 
640 CX("if(fossil.config.skin.isDark) "
641 "document.body.classList.add('fossil-dark-style');\n");
642 #if 0
643 /* Is it safe to emit the CSRF token here? Some pages add it
644 ** as a hidden form field. */
645
--- src/builtin.c
+++ src/builtin.c
@@ -94,20 +94,21 @@
94 **
95 ** Show all built-in text files.
96 */
97 void test_builtin_list_page(void){
98 int i;
99 style_set_current_feature("test");
100 style_header("Built-in Text Files");
101 @ <ol>
102 for(i=0; i<count(aBuiltinFiles); i++){
103 const char *z = aBuiltinFiles[i].zName;
104 char *zUrl = href("%R/builtin?name=%T&id=%.8s&mimetype=text/plain",
105 z,fossil_exe_id());
106 @ <li>%z(zUrl)%h(z)</a>
107 }
108 @ </ol>
109 style_finish_page();
110 }
111
112 /*
113 ** COMMAND: test-builtin-get
114 **
@@ -178,16 +179,17 @@
179 ** result is immutable and sets a very large cache retention time (1 year).
180 */
181 void builtin_webpage(void){
182 Blob out;
183 const char *zName = P("name");
184 const char *zContent = 0;
185 int nContent = 0;
186 const char *zId = P("id");
187 const char *zType = P("mimetype");
188 int nId;
189 if( zName ) zContent = (const char *)builtin_file(zName, &nContent);
190 if( zContent==0 ){
191 const char *zM = P("m");
192 if( zM ){
193 if( zId && (nId = (int)strlen(zId))>=8
194 && strncmp(zId,fossil_exe_id(),nId)==0
195 ){
@@ -214,11 +216,11 @@
216 && strncmp(zId,fossil_exe_id(),nId)==0
217 ){
218 g.isConst = 1;
219 }
220 etag_check(0,0);
221 blob_init(&out, zContent, nContent);
222 cgi_set_content(&out);
223 }
224
225 /* Variables controlling the JS cache.
226 */
@@ -635,10 +637,14 @@
637 CX("isDark: %s"
638 "/*true if the current skin has the 'white-foreground' detail*/",
639 skin_detail_boolean("white-foreground") ? "true" : "false");
640 CX("}\n"/*fossil.config.skin*/);
641 CX("};\n"/* fossil.config */);
642 CX("window.fossil.user = {");
643 CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest");
644 CX("isAdmin: %s", (g.perm.Admin || g.perm.Setup) ? "true" : "false");
645 CX("};\n"/*fossil.user*/);
646 CX("if(fossil.config.skin.isDark) "
647 "document.body.classList.add('fossil-dark-style');\n");
648 #if 0
649 /* Is it safe to emit the CSRF token here? Some pages add it
650 ** as a hidden form field. */
651
+4 -2
--- src/cache.c
+++ src/cache.c
@@ -353,10 +353,11 @@
353353
sqlite3_stmt *pStmt;
354354
char zBuf[100];
355355
356356
login_check_credentials();
357357
if( !g.perm.Setup ){ login_needed(0); return; }
358
+ style_set_current_feature("cache");
358359
style_header("Web Cache Status");
359360
db = cacheOpen(0);
360361
if( db==0 ){
361362
@ The web-page cache is disabled for this repository
362363
}else{
@@ -384,11 +385,11 @@
384385
@ <p>cache-file name: %h(zDbName)</p>
385386
@ <p>cache-file size: %s(zBuf)</p>
386387
fossil_free(zDbName);
387388
sqlite3_close(db);
388389
}
389
- style_finish_page("cache");
390
+ style_finish_page();
390391
}
391392
392393
/*
393394
** WEBPAGE: cacheget
394395
**
@@ -405,13 +406,14 @@
405406
login_check_credentials();
406407
if( !g.perm.Setup ){ login_needed(0); return; }
407408
zKey = PD("key","");
408409
blob_zero(&content);
409410
if( cache_read(&content, zKey)==0 ){
411
+ style_set_current_feature("cache");
410412
style_header("Cache Download Error");
411413
@ The cache does not contain any entry with this key: "%h(zKey)"
412
- style_finish_page("cache");
414
+ style_finish_page();
413415
return;
414416
}
415417
cgi_set_content(&content);
416418
cgi_set_content_type("application/x-compressed");
417419
}
418420
--- src/cache.c
+++ src/cache.c
@@ -353,10 +353,11 @@
353 sqlite3_stmt *pStmt;
354 char zBuf[100];
355
356 login_check_credentials();
357 if( !g.perm.Setup ){ login_needed(0); return; }
 
358 style_header("Web Cache Status");
359 db = cacheOpen(0);
360 if( db==0 ){
361 @ The web-page cache is disabled for this repository
362 }else{
@@ -384,11 +385,11 @@
384 @ <p>cache-file name: %h(zDbName)</p>
385 @ <p>cache-file size: %s(zBuf)</p>
386 fossil_free(zDbName);
387 sqlite3_close(db);
388 }
389 style_finish_page("cache");
390 }
391
392 /*
393 ** WEBPAGE: cacheget
394 **
@@ -405,13 +406,14 @@
405 login_check_credentials();
406 if( !g.perm.Setup ){ login_needed(0); return; }
407 zKey = PD("key","");
408 blob_zero(&content);
409 if( cache_read(&content, zKey)==0 ){
 
410 style_header("Cache Download Error");
411 @ The cache does not contain any entry with this key: "%h(zKey)"
412 style_finish_page("cache");
413 return;
414 }
415 cgi_set_content(&content);
416 cgi_set_content_type("application/x-compressed");
417 }
418
--- src/cache.c
+++ src/cache.c
@@ -353,10 +353,11 @@
353 sqlite3_stmt *pStmt;
354 char zBuf[100];
355
356 login_check_credentials();
357 if( !g.perm.Setup ){ login_needed(0); return; }
358 style_set_current_feature("cache");
359 style_header("Web Cache Status");
360 db = cacheOpen(0);
361 if( db==0 ){
362 @ The web-page cache is disabled for this repository
363 }else{
@@ -384,11 +385,11 @@
385 @ <p>cache-file name: %h(zDbName)</p>
386 @ <p>cache-file size: %s(zBuf)</p>
387 fossil_free(zDbName);
388 sqlite3_close(db);
389 }
390 style_finish_page();
391 }
392
393 /*
394 ** WEBPAGE: cacheget
395 **
@@ -405,13 +406,14 @@
406 login_check_credentials();
407 if( !g.perm.Setup ){ login_needed(0); return; }
408 zKey = PD("key","");
409 blob_zero(&content);
410 if( cache_read(&content, zKey)==0 ){
411 style_set_current_feature("cache");
412 style_header("Cache Download Error");
413 @ The cache does not contain any entry with this key: "%h(zKey)"
414 style_finish_page();
415 return;
416 }
417 cgi_set_content(&content);
418 cgi_set_content_type("application/x-compressed");
419 }
420
--- src/capabilities.c
+++ src/capabilities.c
@@ -304,10 +304,12 @@
304304
"Forum-Admin", "Grant capability '4' to other users" },
305305
{ '7', CAPCLASS_ALERT, 0,
306306
"Alerts", "Sign up for email alerts" },
307307
{ 'A', CAPCLASS_ALERT|CAPCLASS_SUPER, 0,
308308
"Announce", "Send announcements to all subscribers" },
309
+ { 'C', CAPCLASS_FORUM, 0,
310
+ "Chat", "Read and/or writes messages in the chatroom" },
309311
{ 'D', CAPCLASS_OTHER, 0,
310312
"Debug", "Enable debugging features" },
311313
};
312314
313315
/*
@@ -391,11 +393,11 @@
391393
" WHERE cap GLOB '*[as]*'"
392394
" ORDER BY 3 ASC",
393395
zSelfCap, hasPubPages, zSelfCap
394396
);
395397
@ <table id='capabilitySummary' cellpadding="0" cellspacing="0" border="1">
396
- @ <tr><th>&nbsp;<th>Code<th>Forum<th>Tickets<th>Wiki\
398
+ @ <tr><th>&nbsp;<th>Code<th>Forum<th>Tickets<th>Wiki<th>Chat\
397399
@ <th>Unversioned Content</th></tr>
398400
while( db_step(&q)==SQLITE_ROW ){
399401
const char *zId = db_column_text(&q, 0);
400402
const char *zCap = db_column_text(&q, 1);
401403
int n = db_column_int(&q, 3);
@@ -446,10 +448,18 @@
446448
/* Wiki */
447449
if( sqlite3_strglob("*[asdfklm]*",zCap)==0 ){
448450
eType = 2;
449451
}else if( sqlite3_strglob("*j*",zCap)==0 ){
450452
eType = 1;
453
+ }else{
454
+ eType = 0;
455
+ }
456
+ @ <td class="%s(azClass[eType])">%s(azType[eType])</td>
457
+
458
+ /* Chat */
459
+ if( sqlite3_strglob("*C*",zCap)==0 ){
460
+ eType = 2;
451461
}else{
452462
eType = 0;
453463
}
454464
@ <td class="%s(azClass[eType])">%s(azType[eType])</td>
455465
456466
--- src/capabilities.c
+++ src/capabilities.c
@@ -304,10 +304,12 @@
304 "Forum-Admin", "Grant capability '4' to other users" },
305 { '7', CAPCLASS_ALERT, 0,
306 "Alerts", "Sign up for email alerts" },
307 { 'A', CAPCLASS_ALERT|CAPCLASS_SUPER, 0,
308 "Announce", "Send announcements to all subscribers" },
 
 
309 { 'D', CAPCLASS_OTHER, 0,
310 "Debug", "Enable debugging features" },
311 };
312
313 /*
@@ -391,11 +393,11 @@
391 " WHERE cap GLOB '*[as]*'"
392 " ORDER BY 3 ASC",
393 zSelfCap, hasPubPages, zSelfCap
394 );
395 @ <table id='capabilitySummary' cellpadding="0" cellspacing="0" border="1">
396 @ <tr><th>&nbsp;<th>Code<th>Forum<th>Tickets<th>Wiki\
397 @ <th>Unversioned Content</th></tr>
398 while( db_step(&q)==SQLITE_ROW ){
399 const char *zId = db_column_text(&q, 0);
400 const char *zCap = db_column_text(&q, 1);
401 int n = db_column_int(&q, 3);
@@ -446,10 +448,18 @@
446 /* Wiki */
447 if( sqlite3_strglob("*[asdfklm]*",zCap)==0 ){
448 eType = 2;
449 }else if( sqlite3_strglob("*j*",zCap)==0 ){
450 eType = 1;
 
 
 
 
 
 
 
 
451 }else{
452 eType = 0;
453 }
454 @ <td class="%s(azClass[eType])">%s(azType[eType])</td>
455
456
--- src/capabilities.c
+++ src/capabilities.c
@@ -304,10 +304,12 @@
304 "Forum-Admin", "Grant capability '4' to other users" },
305 { '7', CAPCLASS_ALERT, 0,
306 "Alerts", "Sign up for email alerts" },
307 { 'A', CAPCLASS_ALERT|CAPCLASS_SUPER, 0,
308 "Announce", "Send announcements to all subscribers" },
309 { 'C', CAPCLASS_FORUM, 0,
310 "Chat", "Read and/or writes messages in the chatroom" },
311 { 'D', CAPCLASS_OTHER, 0,
312 "Debug", "Enable debugging features" },
313 };
314
315 /*
@@ -391,11 +393,11 @@
393 " WHERE cap GLOB '*[as]*'"
394 " ORDER BY 3 ASC",
395 zSelfCap, hasPubPages, zSelfCap
396 );
397 @ <table id='capabilitySummary' cellpadding="0" cellspacing="0" border="1">
398 @ <tr><th>&nbsp;<th>Code<th>Forum<th>Tickets<th>Wiki<th>Chat\
399 @ <th>Unversioned Content</th></tr>
400 while( db_step(&q)==SQLITE_ROW ){
401 const char *zId = db_column_text(&q, 0);
402 const char *zCap = db_column_text(&q, 1);
403 int n = db_column_int(&q, 3);
@@ -446,10 +448,18 @@
448 /* Wiki */
449 if( sqlite3_strglob("*[asdfklm]*",zCap)==0 ){
450 eType = 2;
451 }else if( sqlite3_strglob("*j*",zCap)==0 ){
452 eType = 1;
453 }else{
454 eType = 0;
455 }
456 @ <td class="%s(azClass[eType])">%s(azType[eType])</td>
457
458 /* Chat */
459 if( sqlite3_strglob("*C*",zCap)==0 ){
460 eType = 2;
461 }else{
462 eType = 0;
463 }
464 @ <td class="%s(azClass[eType])">%s(azType[eType])</td>
465
466
+4 -2
--- src/captcha.c
+++ src/captcha.c
@@ -586,15 +586,16 @@
586586
if( zPw==0 || zPw[0]==0 ){
587587
u64 x;
588588
sqlite3_randomness(sizeof(x), &x);
589589
zPw = mprintf("%016llx", x);
590590
}
591
+ style_set_current_feature("test");
591592
style_header("Captcha Test");
592593
@ <pre>
593594
@ %s(captcha_render(zPw))
594595
@ </pre>
595
- style_finish_page("test");
596
+ style_finish_page();
596597
}
597598
598599
/*
599600
** Check to see if the current request is coming from an agent that might
600601
** be a spider. If the agent is not a spider, then return 0 without doing
@@ -621,17 +622,18 @@
621622
cgi_set_cookie(zCookieName, "1", login_cookie_path(), 8*3600);
622623
return 0;
623624
}
624625
625626
/* This appears to be a spider. Offer the captcha */
627
+ style_set_current_feature("captcha");
626628
style_header("Verification");
627629
@ <form method='POST' action='%s(g.zPath)'>
628630
cgi_query_parameters_to_hidden();
629631
@ <p>Please demonstrate that you are human, not a spider or robot</p>
630632
captcha_generate(1);
631633
@ </form>
632
- style_finish_page("captcha");
634
+ style_finish_page();
633635
return 1;
634636
}
635637
636638
/*
637639
** Generate a WAV file that reads aloud the hex digits given by
638640
--- src/captcha.c
+++ src/captcha.c
@@ -586,15 +586,16 @@
586 if( zPw==0 || zPw[0]==0 ){
587 u64 x;
588 sqlite3_randomness(sizeof(x), &x);
589 zPw = mprintf("%016llx", x);
590 }
 
591 style_header("Captcha Test");
592 @ <pre>
593 @ %s(captcha_render(zPw))
594 @ </pre>
595 style_finish_page("test");
596 }
597
598 /*
599 ** Check to see if the current request is coming from an agent that might
600 ** be a spider. If the agent is not a spider, then return 0 without doing
@@ -621,17 +622,18 @@
621 cgi_set_cookie(zCookieName, "1", login_cookie_path(), 8*3600);
622 return 0;
623 }
624
625 /* This appears to be a spider. Offer the captcha */
 
626 style_header("Verification");
627 @ <form method='POST' action='%s(g.zPath)'>
628 cgi_query_parameters_to_hidden();
629 @ <p>Please demonstrate that you are human, not a spider or robot</p>
630 captcha_generate(1);
631 @ </form>
632 style_finish_page("captcha");
633 return 1;
634 }
635
636 /*
637 ** Generate a WAV file that reads aloud the hex digits given by
638
--- src/captcha.c
+++ src/captcha.c
@@ -586,15 +586,16 @@
586 if( zPw==0 || zPw[0]==0 ){
587 u64 x;
588 sqlite3_randomness(sizeof(x), &x);
589 zPw = mprintf("%016llx", x);
590 }
591 style_set_current_feature("test");
592 style_header("Captcha Test");
593 @ <pre>
594 @ %s(captcha_render(zPw))
595 @ </pre>
596 style_finish_page();
597 }
598
599 /*
600 ** Check to see if the current request is coming from an agent that might
601 ** be a spider. If the agent is not a spider, then return 0 without doing
@@ -621,17 +622,18 @@
622 cgi_set_cookie(zCookieName, "1", login_cookie_path(), 8*3600);
623 return 0;
624 }
625
626 /* This appears to be a spider. Offer the captcha */
627 style_set_current_feature("captcha");
628 style_header("Verification");
629 @ <form method='POST' action='%s(g.zPath)'>
630 cgi_query_parameters_to_hidden();
631 @ <p>Please demonstrate that you are human, not a spider or robot</p>
632 captcha_generate(1);
633 @ </form>
634 style_finish_page();
635 return 1;
636 }
637
638 /*
639 ** Generate a WAV file that reads aloud the hex digits given by
640
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -2137,11 +2137,11 @@
21372137
if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){
21382138
fossil_warning("cannot start browser\n");
21392139
}
21402140
}else
21412141
#endif
2142
- if( system(zBrowser)<0 ){
2142
+ if( fossil_system(zBrowser)<0 ){
21432143
fossil_warning("cannot start browser: %s\n", zBrowser);
21442144
}
21452145
}
21462146
while( 1 ){
21472147
#if FOSSIL_MAX_CONNECTIONS>0
21482148
21492149
ADDED src/chat.c
21502150
ADDED src/chat.js
--- src/cgi.c
+++ src/cgi.c
@@ -2137,11 +2137,11 @@
2137 if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){
2138 fossil_warning("cannot start browser\n");
2139 }
2140 }else
2141 #endif
2142 if( system(zBrowser)<0 ){
2143 fossil_warning("cannot start browser: %s\n", zBrowser);
2144 }
2145 }
2146 while( 1 ){
2147 #if FOSSIL_MAX_CONNECTIONS>0
2148
2149 DDED src/chat.c
2150 DDED src/chat.js
--- src/cgi.c
+++ src/cgi.c
@@ -2137,11 +2137,11 @@
2137 if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){
2138 fossil_warning("cannot start browser\n");
2139 }
2140 }else
2141 #endif
2142 if( fossil_system(zBrowser)<0 ){
2143 fossil_warning("cannot start browser: %s\n", zBrowser);
2144 }
2145 }
2146 while( 1 ){
2147 #if FOSSIL_MAX_CONNECTIONS>0
2148
2149 DDED src/chat.c
2150 DDED src/chat.js
+9
--- a/src/chat.c
+++ b/src/chat.c
@@ -0,0 +1,9 @@
1
+button id='chat-clear-filter' class='hidden'>Clear filter</buttonzMsgfossil_free(zMsg);/**/-flat#if 0
2
+ /*
3
+ ** 2021-01-05 temporarily disabled until we decide whether we're
4
+ ** going to keep configurable audio files or not. If we do, this
5
+ ** code needs to check whether the [unversioned] table exists beogg')");
6
+}
7
+#endifonform accept-encoding="utf-8" id="chname="msgsingle" \
8
+ @ placeholder="Type message here." autocomplete="off">
9
+ @ <textarea rows="8muhash
--- a/src/chat.c
+++ b/src/chat.c
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
--- a/src/chat.c
+++ b/src/chat.c
@@ -0,0 +1,9 @@
1 button id='chat-clear-filter' class='hidden'>Clear filter</buttonzMsgfossil_free(zMsg);/**/-flat#if 0
2 /*
3 ** 2021-01-05 temporarily disabled until we decide whether we're
4 ** going to keep configurable audio files or not. If we do, this
5 ** code needs to check whether the [unversioned] table exists beogg')");
6 }
7 #endifonform accept-encoding="utf-8" id="chname="msgsingle" \
8 @ placeholder="Type message here." autocomplete="off">
9 @ <textarea rows="8muhash
+1158
--- a/src/chat.js
+++ b/src/chat.js
@@ -0,0 +1,1158 @@
1
+/**
2
+ This file conta,
3
+ btnMsgHome: E1('#chat-scroll-top'),
4
+ btnMsgEnd: E1('#chat-scroll-bottom/**
5
+ This file contains the client-side implementation of fossil's /chat
6
+ application.
7
+*/
8
+(function(){
9
+ const F = window.fossil, D = F.dom;
10
+ const E1 = function(selector){
11
+ const e = document.querySelector(selector);
12
+ if(!e) throw new Error("missing required DOM element: "+selector);
13
+ return e;
14
+ };
15
+ /**
16
+ Returns true if e is entirely within the bounds of the window's viewport.
17
+ */
18
+ const isEntirelyInViewport = function(e) {
19
+ const rect = e.getBoundingClientRect();
20
+ return (
21
+ rect.top >= 0 &&
22
+ rect.left >= 0 &&
23
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
24
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth)
25
+ );
26
+ };
27
+
28
+ /**
29
+ Returns true if e's on-screen position vertically overlaps that
30
+ of element v's. Horizontal overlap is ignored (we don't need it
31
+ for our case).
32
+ */
33
+ const overlapsElemView = function(e,v) {
34
+ const r1 = e.getBoundingClientRect(),
35
+ r2 = v.getBoundingClientRect();
36
+ if(r1.top<=r2.bottom && r1.top>=r2.top) return true;
37
+ else if(r1.bottom<=r2.bottom && r1.bottom>=r2.top) return true;
38
+ return false;
39
+ };
40
+
41
+ (function(){
42
+ let dbg = document.querySelector('#debugMsg');
43
+ if(dbg){
44
+ /* This can inadvertently influence our flexbox layouts, so move
45
+ it out of the way. */
46
+ D.append(document.body,dbg);
47
+ }
48
+ })();
49
+ const ForceResizeKludge = 0 ? function(){} : (function f(){
50
+ /* Workaround for Safari mayhem regarding use of vh CSS units....
51
+ We tried to use vh units to set the content area size for the
52
+ chat lay Android,
53
+ causing the input area to move off-screen. */
54
+ if(!f.elemsToCount){
55
+ f.elemsToCount = [
56
+ document.querySelector('body > div.header'),
57
+ document.querySelector('body > div.mainmenu'),
58
+ document.querySelector('body > #hbdrop'),
59
+ document.querySelector('body > div.footer')
60
+ ];
61
+ f.contentArea = E1('div.content');
62
+ }
63
+ const bcl = document.body.classList;
64
+ const resized = function(){
65
+ const wh = window.innerHeight,
66
+ com = bcl.contains('chat-only-mode');
67
+ var ht;
68
+ var extra = 0;
69
+ if(com){
70
+ ht = wh;
71
+ }else{
72
+ f.elemsToCount.forEach((e)=>e ? extra += D.effectiveHeight(e) : false);
73
+ ht = wh - extra;
74
+ }
75
+ f.contentArea.style.height =
76
+ f.contentArea.style.maxHeight = [
77
+ "calc(", (ht>=100 ? ht : 100), "px",
78
+ " - 1em"/*fudge value*/,")"
79
+ /* ^^^^ hypothetically not needed, but both Chrome/FF on
80
+ Linux will force scrollbars on the body if this value is
81
+ too small (<0.75em in my tests). */
82
+ ].join('');
83
+ if(false){
84
+ console.debug("resized.",wh, extra, ht,
85
+ window.getComputedStyle(f.contentArea).maxHeight,
86
+ f.contentArea);
87
+ }
88
+ };
89
+ var doit;
90
+ window.addEventListener('resize',function(ev){
91
+ clearTimeout(doit);
92
+ doit = setTimeout(resized, 100);
93
+ }, false);
94
+ resized();
95
+ return resized;
96
+ })();
97
+ fossil.FRK = ForceResizeKludge/*for debugging*/;
98
+ const Chat = (function(){
99
+ const cs = {
100
+ verboseErrors: false /* if true then certain, mostly extraneous,
101
+ error messages may be sent to the console. */,
102
+ e:{/*map of certain DOM elements.*/
103
+ messageInjectPoint: E1('#message-inject-point'),
104
+ pageTitle: E1('head title'),
105
+ loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
106
+ inputWrapper: E1("#chat-input-area"),
107
+ fileSelectWrapper: E1('#chat-input-file-area'),
108
+ messagesWrapper: E1('#chat-messages-wrapper'),
109
+ inputForm: E1('#chat-form'),
110
+ btnSubmit: E1('#chat-message-submit'),
111
+ inputSingle: E1('#chat-input-single'),
112
+ inputMulti: E1('#chat-input-multi'),
113
+ inputCurrent: undefined/*one of inputSingle or inputMulti*/,
114
+ inputFile: E1('#chat-input-file'),
115
+ contentDiv: E1('div.content')
116
+ },
117
+ me: F.user.name,
118
+ mxMsg: F.config.chat.initSize ? -F.config.chat.initSize : -50,
119
+ mnMsg: undefined/*lowest message ID we've seen so far (for history loading)*/,
120
+ pageIsActive: 'visible'===document.visibilityState,
121
+ changesSincePageHidden: 0,
122
+ notificationBubbleColor: 'white',
123
+ totalMessageCount: 0, // total # of inbound messages
124
+ //! Number of messages to load for the history buttons
125
+ loadMessageCount: Math.abs(F.config.chat.initSize || 20),
126
+ ajaxInflight: 0,
127
+ /** Gets (no args) or sets (1 arg) the current input text field value,
128
+ taking into account single- vs multi-line input. The getter returns
129
+ a string and the setter returns this object. */
130
+ inputValue: function(){
131
+ const e = this.inputElement();
132
+ if(arguments.length){
133
+ e.value = arguments[0];
134
+ return this;
135
+ }
136
+ return e.value;
137
+ },
138
+ /** Asks the current user input field to take focus. Returns this. */
139
+ inputFocus: function(){
140
+ this.inputElement().focus();
141
+ return this;
142
+ },
143
+ /** Returns the current message input element. */
144
+ inputElement: function(){
145
+ return this.e.inputCurrent;
146
+ },
147
+ /** Toggles between single- and multi-line edit modes. Returns this. */
148
+ inputToggleSingleMulti: function(){
149
+ const old = this.e.inputCurrent;
150
+ if(this.e.inputCurrent === this.e.inputSingle){
151
+ this.e.inputCurrent = this.e.inputMulti;
152
+ }else{
153
+ this.e.inputCurrent = this.e.inputSingle;
154
+ }
155
+ const m = this.e.messagesWrapper,
156
+ sTop = m.scrollTop,
157
+ mh1 = m.clientHeight;
158
+ D.addClass(old, 'hidden');
159
+ D.removeClass(this.e.inputCurrent, 'hidden');
160
+ const mh2 = m.clientHeight;
161
+ m.scrollTo(0, sTop + (mh1-mh2));
162
+ this.e.inputCurrent.value = old.value;
163
+ old.value = '';
164
+ return this;
165
+ },
166
+ /**
167
+ If passed true or no arguments, switches to multi-line mode
168
+ if currently in single-line mode. If passed false, switches
169
+ to single-line mode if currently in multi-line mode. Returns
170
+ this.
171
+ */
172
+ inputMultilineMode: function(yes){
173
+ if(!arguments.length) yes = true;
174
+ if(yes && this.e.inputCurrent === this.e.inputMulti) return this;
175
+ else if(!yes && this.e.inputCurrent === this.e.inputSingle) return this;
176
+ else return this.inputToggleSingleMulti();
177
+ },
178
+ /** Enables (if yes is truthy) or disables all elements in
179
+ * this.disableDuringAjax. */
180
+ enableAjaxComponents: function(yes){
181
+ D[yes ? 'enable' : 'disable'](this.disableDuringAjax);
182
+ return this;
183
+ },
184
+ /* Must be called before any API is used which starts ajax traffic.
185
+ If this call represents the currently only in-flight ajax request,
186
+ all DOM elements in this.disableDuringAjax are disabled.
187
+ We cannot do this via a central API because (1) window.fetch()'s
188
+ Promise-based API seemingly makes that impossible and (2) the polling
189
+ technique holds ajax requests open for as long as possible. A call
190
+ to this method obligates the caller to also call ajaxEnd().
191
+
192
+ This must NOT be called forelement e as a new row end
193
+ of the list if atEnd is truthy the
194
+ list. */
195
+ injectMessageElem: function f(e, atEnd){
196
+ const mip = atEnd ? this.e.loadOlderToolbar : this.e.messageInjectPoint,
197
+ holder = this.e.messagesWrapper,
198
+ prevMessage = this.e.newestMessage;
199
+ if(atEnd){
200
+ const fe = mip.nextElementSibling;
201
+ if(fe) mip.parentNode.insertBefore(e, fe);
202
+ else D.append(mip.parentNode, e);
203
+ }else{
204
+ D.append(holder,e);
205
+ this.e.newestMessage = e;
206
+ }
207
+ if(!atEnd && !this._isBatchLoading
208
+ && e.dataset.xfrom!==this.me
209
+ && (prevMessage
210
+ ? !this.messageIsInView(prevMessage)
211
+ : false)){
212
+ /* If a new non-history message arrives while the user is
213
+ scrolled elsewhere, do not scroll to the latest
214
+ message, but gently alert the user that a new message
215
+ has arrived. */
216
+ if(!f.btnDown){
217
+ f.btnDown = D.button("⇣⇣⇣");
218
+ f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
219
+ }
220
+ F.toast.message(f.btnDown," New message has arrived.");
221
+ }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
222
+ this.scheduleScrollOfMsg(e);
223
+ }else if(!this._isBatchLoading){
224
+ /* When a message from someone else arrives, we have to
225
+ figure out whether or not to scroll it into view. Ideally
226
+ we'd just stuff it in the UI and let the flexbox layout
227
+ DTRT, but Safari has expressed, in no uncertain terms,
228
+ some disappointment with that approach, so we'll
229
+ heuristicize it: if the previous last message is in view,
230
+ essage input element. */
231
+top of the
232
+ Kludge()list if atEnd is falsy, else at ttentTarg the load-history widge we'd just stuff it in the UI and let the flexbox layout
233
+ DTRT, but Safari has expressed, in no uncertain terms,
234
+ some disappointment with that approach, so we'll
235
+ heuristicistyling. We cannot do this easily as
236
+ messages arrive in batch mode because they can arrive out of
237
+ order (they arrive, and are processed, in reverse order for
238
+ the "load older messages" buttons). We do this handling in user is up readi() for "interactive" use but we'd jrecalculate them en massof messages to load for the history buttons
239
+ loadMessageCount: Math.abs(F.config.chat.initSize || 20),
240
+ ajaxInflight: 0,
241
+ /** Gets (no args) or sets (1 arg) the current input text field value,
242
+ taking into account single- vs multi-line input. The gtains t scrolled elsewhere, do not scroll to the latest
243
+ message, but gently alert the user that a new message
244
+ has arrived. */
245
+ if(!f.btnDown){
246
+ f.btnDown = D.button("⇣⇣⇣");
247
+ f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
248
+ }
249
+ F.toast.message(f.btnDown," New message has arrived.");
250
+ }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
251
+ this.scheduleScrollOfMsg(e);
252
+ }else if(!this._isBatchLoading){
253
+ /* When a message from someone else arrives, we have to
254
+ figure out whether or not to scroll it into view. Ideally
255
+ we'd just stuff it in the UI and let the flexbox layout
256
+ DTRT, but Safari has expressed, in no uncertain terms,
257
+ some disappointment with that approach, so we'll
258
+ heuristicize it: if the previous last message is in view,
259
+ assume the user is at or near the input element and
260
+ scroll this one into view. If that message is NOT in
261
+ view, assume the user is up reading history somewhere and
262
+ do NOT scroll because doing so would interrupt
263
+ them. There are middle grounds here where the user will
264
+ experience a slight UI jolt, but this heuristic mostly
265
+ seems to work out okay. If there was no previous message,
266
+ assume we don't have any messages yet and go ahead and
267
+ scroll this message into view (noting that that scrolling
268
+ is hypothetically a no-op in such cases).
269
+
270
+ The wrench in these works are posts with IMG tags, as
271
+ those images are loaded async and the element does not
272
+ yet have enough information to know how far to scroll!
273
+ For such cases we have to delay the scroll until the
274
+ image loads (and we hope it does so before another
275
+ message arrives).
276
+ */
277
+ if(1===+e.dataset.hasImage){
278
+ e.querySelector('img').addEventListener('load',()=>e.scrollIntoView());
279
+ }else if(!prevMessage || (prevMessage && isEntirelyInViewport(prevMessage))){
280
+ e.scrollIntoView(false);
281
+ }
282
+ }
283
+ },
284
+ /** Returns true if chat-only mode is enabled. */
285
+ isChatOnlyMode: ()=>document.body.classList.contains('chat-only-mode'),
286
+ /**
287
+ Enters (if passed a truthy value or no arguments) or leaves
288
+ "chat-only" mode. That mode hides the page's header and
289
+ footer, leaving only the chat application visible to the
290
+ user.
291
+ */
292
+ chatOnlyMode: function f(yes){
293
+ if(undefined === f.elemsToToggle){
294
+ f.elemsToToggle = [];
295
+ document.querySelectorAll(
296
+ ["body > div.header",
297
+ "body > div.mainmenu",
298
+ "body > div.footer",
299
+ "#debugMsg"
300
+ ].join(',')
301
+ ).forEach((e)=>f.elemsToToggle.push(e));
302
+ }
303
+ if(!arguments.length) yes = true;
304
+ if(yes === this.isChatOnlyMode()) return this;
305
+ if(yes){
306
+ D.addClass(f.elemsToToggle, 'hidden');
307
+ D.addClass(document.body, 'chat-only-mode');
308
+ document.body.scroll(0,document.body.height);
309
+ }else{
310
+ D.removeClass(f.elemsToToggle, 'hidden');
311
+ D.removeClass(document.body, 'chat-only-mode');
312
+ }
313
+ ForceResizeKludge();
314
+ return this;
315
+ },
316
+ /** Tries to scroll the message area to...
317
+ <0 = top of the message list, >0 = bottom of the message list,
318
+ 0 == the newest message (normally the same position as >1).
319
+ */
320
+ scrollMessagesTo: function(where){
321
+ if(where<0){
322
+ Chat.e.messagesWrapper.scrollTop = 0;
323
+ }else if(where>0){
324
+ Chat.e.messagesWrapper.scrollTop = Chat.e.messagesWrapper.scrollHeight;
325
+ }else if(Chat.e.newestMessage){
326
+ Chat.e.newestMessage.scrollIntoView(false);
327
+ }
328
+ },
329
+ togguSpan);
330
+ });
331
+ }
332
+ };
333
+ F.fetch.beforesend = ()=>cs.ajaxStart();
334
+ F.fetch.aftersend = ()=>cs.ajaxEnd();
335
+ cs.e.inputCurrent = cs.e.inputSingle;
336
+ /* Install default settings... */
337
+ Object.keys(cs.settings.defaults).forEach(function(k){
338
+ const v = cs.settings.get(k,cs);
339
+ if(cs===v) cs.settings.set(k,cs.settings.defaults[k]);
340
+ });
341
+ cutCurrent.value MessageElem(mw.e.body);
342
+ mw.scrollIntoView();
343
+ };
344
+
345
+ cs.getMessageElemById = function(id){
346
+ return qs('[data-msgid="'+id+'"]');
347
+ };
348
+
349
+ /** Finds the last .message-widget element and returns it or
350
+ the undefined value if none are found. */
351
+ cs.fetchLastMessageElem = function(){
352
+ const msgs = document.querySelectorAll('.message-widget');
353
+ var rc;
354
+ if(msgs.length){
355
+ rc = this.e.newestMessage = msgs[msgs.length-1];
356
+ }
357
+ return rc;
358
+ };
359
+
360
+ /**
361
+ LOCALLY deletes a message element by the message ID or passing
362
+ the .message-row element. Returns true if it removes an element,
363
+ else false.
364
+ */
365
+ cs.deleteMessageElem = function(id){
366
+ var e;
367
+ if(id instanceof HTMLElement){
368
+ e = id;
369
+ id = e.dataset.msgid;
370
+ }else{
371
+ e = this.getMessageElemById(id);
372
+ }
373
+ if(e && id){
374
+ D.remove(e);
375
+ if(e===this.e.newestMessage){
376
+ this.fetchLastMessageElem();
377
+ }
378
+ F.toast.message("Deleted message "+id+".");
379
+ }
380
+ return !!e;
381
+ };
382
+
383
+ /** Given a .message-row element, this function returns whethe the
384
+ current user may, at least hypothetically, delete the message
385
+ globally. A user may always delete a local copy of a
386
+ post. The server may trump this, e.g. if the login has been
387
+ cancelled after this page was loaded.
388
+ */
389
+ cs.userMayDelete = function(eMsg){
390
+ return +eMsg.dataset.msgid>0
391
+ && (this.me === eMsg.dataset.xfrom
392
+ || F.user.isAdmin/*will be confirmed server-side*/);
393
+ };
394
+
395
+ /** Returns a new Error() object encapsulating state from the given
396
+ fetch() response promise. */
397
+ cs._newResponseError = function(response){
398
+ return new Error([
399
+ "HTTP status ", response.status,": ",response.url,": ",
400
+ response.statusText].join(''));
401
+ };
402
+
403
+ /** Helper for reporting HTTP-level response errors via fetch().
404
+ If response.ok then response.json() is returned, else an Error
405
+ is thrown. */
406
+ cs._fetchJsonOrError = function(response){
407
+ if(response.ok) return response.json();
408
+ else throw cs._newResponseError(response);
409
+ };
410
+
411
+ /**
412
+ Removes the given message ID from the local chat record and, if
413
+ the message was posted by this user OR this user in an
414
+ admin/setup, also submits it for removal on the remote.
415
+
416
+ id may optionally be a DOM element, in which case it must be a
417
+ .message-row element.
418
+ */
419
+ cs.deleteMessage = function(id){
420
+ var e;
421
+ if(id instanceof HTMLElement){
422
+ e = id;
423
+ id = e.dataset.msgid;
424
+ }else{
425
+ e = this.getMessageElemById(id);
426
+ }
427
+ if(!(e instanceof HTMLElement)) return;
428
+ if(this.userMayDelete(e)){
429
+ this.ajaxStart();
430
+ F.fetch("chat-delete/" + id, {
431
+ responseType: 'json',
432
+ onload:(r)=>this.deleteMessageElem(r),
433
+ onerror:(err)=>this.reportErrorAsMessage(err)
434
+ });
435
+ }else{
436
+ this.deleteMessageElem(id);
437
+ }
438
+ };
439
+ document.addEventListener('visibilitychange', function(ev){
440
+ cs.pageIsActive = ('visible' === document.visibilityState);
441
+ if(cs.pageIsActive){
442
+ cs.e.pageTitle.innerText = cs.pageTitleOrig;
443
+ }
444
+ }, true);
445
+ return cs;
446
+ })()/*Chat initialization*/;
447
+
448
+ /**
449
+ Custom widget type for rendering messages (one message per
450
+ instance). These are modelled after FIELDSET elements but we
451
+ don't use FIELDSET because of cross-browser inconsistencies in
452
+ features of the FIELDSET/LEGEND combination, e.g. inability to
453
+ align legends via CSS in Firefox and clicking-related
454
+ deficiencies in Safari.
455
+ */
456
+ Chat.MessageWidget = (function(){
457
+ /**
458
+ Constructor. If passed an argument, it is passed to
459
+ this.setMessage() after initialization.
460
+ */
461
+ const cf = function(){
462
+ this.e = {
463
+ body: D.addClass(D.div(), 'message-widget'),
464
+ tab: D.addClass(D.span(), 'message-widget-tab'),
465
+ content: D.addClass(D.div(), 'message-widget-content')
466
+ };
467
+ D.append(this.e.body, this.e.tab, this.e.content);
468
+ this.e.tab.setAttribute('role', 'button');
469
+ if(arguments.length){
470
+ this.setMessage(arguments[0]);
471
+ }
472
+ };
473
+ /* Left-zero-pad a number to at least 2 digits */
474
+ const pad2 = (x)=>(''+x).length>1 ? x : '0'+x;
475
+ const dowMap = {
476
+ /* Map of Date.getDay() values to weekday names. */
477
+ 0: "Sunday", 1: "Monday", 2: "Tuesday",
478
+ 3: "Wednesday", 4: "Thursday", 5: "Friday",
479
+ 6: "Saturday"
480
+ };
481
+ /* Given a Date, returns the timestamp string used in the
482
+ "tab" part of message widgets. */
483
+ const theTime = function(d){
484
+ return [
485
+ //d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/),
486
+ //'-',pad2(d.getDate()), ' ',
487
+ d.getHours(),":",
488
+ (d.getMinutes()+100).toString().slice(1,3),
489
+ fetch("chat-dele if(response.ok) return if(!response.ok)guments[0]);
490
+ return response;
491
+ings.get('})
492
+ .then(()=>= function ff(d){
493
+ e)) to reset .catch(err=>thiserr))ew Error(/**
494
+ This file conta,
495
+ (d){
496
+ return [
497
+ = function ff(d){
498
+ d || (d = new Date());
499
+ return [
500
+ d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/),
501
+ '-',pad2(d.getDate()),
502
+ ' ',pad2(d.getHours()),':',pad2(d.getMinutes()),
503
+ ':',pad2(d.getSeconds())
504
+ ].join('');
505
+ };
506
+ cf.prototype = {
507
+ scrollIntoView: function(){
508
+ this.e.content.scrollIntoView();
509
+ },
510
+ setMessage: function(m){
511
+ const ds = this.e.body.dataset;
512
+ ds.timestamp = m.mtime;
513
+ ds.lmtime = m.lmtime;
514
+ ds.msgid = m.msgid;
515
+ ds.xfrom = m.xfrom || '';
516
+ if(m.xfrom === Chat.me){
517
+ D.addClass(this.e.body, 'mine');
518
+ }
519
+ if(m.uclr){
520
+ this.e.content.style.backgroundColor = m.uclr;
521
+ this.e.tab.style.backgroundColor = m.uclr;
522
+ }
523
+ const d = new Date(m.mtime);
524
+ D.clearElement(this.e.tab);
525
+ var contentTarget = this.e.content;
526
+ var eXFrom /* element holding xfrom name */;
527
+ if(m.xfrom){
528
+ eXFrom = D.append(D.addClass(D.span(), 'xfrom'), m.xfrom);
529
+ D.append(
530
+ this.e.tab, eXFrom,
531
+ D.text(" #",(m.msgid||'???'),' @ ',theTime(d))
532
+ );
533
+ }else{/*notification*/
534
+ D.addClass(this.e.body, 'notification');
535
+ if(m.isError){
536
+ D.addClass([contentTarget, this.e.tab], 'error');
537
+ }
538
+ D.appe const a = D.a(fname),
539
+ // ^ to cause downloaded cs.e.fsize + " bytes)"
540
+ comes from the same server as this script and
541
+ // is guaranteed by that server to be "safe" HTML - safe in the
542
+ // sense that it is not possible for a malefactor to inject HTML
543
+ // or javascript or CSS. The m.xmsg content might contain
544
+ // hyperlinks, but otherwise it will be markup-free. See the
545
+ // chat_format_to_html() routine in the server for details.
546
+ //
547
+ // Hence, even though innerHTML is normally frowned upon, it is
548
+ // perfectly safe to use in this context.
549
+ if(m.xmsg instanceof Array){
550
+ // Used by Chat.reportErrorAsMessage()
551
+ D.append(contentTarget, m.xmsg);
552
+ }else{
553
+ contentTarget.innerHTML = m.xmsg;
554
+ }
555
+ }
556
+ this.e.tab.addEventListener('click', this._handleLegendClicked, false);
557
+ if(eXFrom){
558
+ eXFrom.addEventListener('click', ()=>this.e.tab.click(), false);
559
+ }
560
+ return this;
561
+ },
562
+ /* Event handler for clicking .message-user elements to show their
563
+ timestamps. */
564
+ _handleLegendClicked: function f(ev){
565
+ if(!f.popup){
566
+ /* Timestamp popup widget */
567
+ f.popup = new F.PopupWidget({
568
+ cssClass: ['fossil-tooltip', 'chat-message-popup'],
569
+ refresh:function(){
570
+ const eMsg = this._eMsg;
571
+ if(!eMsg) return;
572
+ D.clearElement(this.e);
573
+ const d = new Date(eMsg.dataset.timestamp);
574
+ if(d.getMinutes().toString()!=="NaN"){
575
+ // Date works, render informative timestamps
576
+ const xfrom = eMsg.dataset.xfrom || 'server';
577
+ D.append(this.e,
578
+ D.append(D.span(), localTimeString(d)," ",Chat.me," time"),
579
+ D.append(D.span(), iso8601ish(d)));
580
+ if(eMsg.dataset.lmtime && xfrom!==Chat.me){
581
+ D.append(this.e,
582
+ D.append(D.span(), localTime8601(
583
+ new Date(eMsg.dataset.lmtime)
584
+ ).replace('T',' ')," ",xfrom," time"));
585
+ }
586
+ }else{
587
+ /* This might not be necessary any more: it was
588
+ initially caused by Safari being stricter than
589
+ other browsers on its time string input, and that
590
+ has since been resolved by emiting a stricter
591
+ format. */
592
+ // Date doesn't work, so dumb it down...
593
+ D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu"));
594
+ }
595
+ const toolbar = D.addClass(D.div(), 'toolbar');
596
+ D.append(this.e, toolbar);
597
+ const btnDeleteLocal = D.button("Delete locally");
598
+ D.append(toolbar, btnDeleteLocal);
599
+ const self = this;
600
+ btnDeleteLocal.addEventListener('click', function(){
601
+ self.hide();
602
+ Chat.deleteMessageElem(eMsg);
603
+ });
604
+ if(Chat.userMayDelete(eMsg)){
605
+ const btnDeleteGlobal = D.button("Delete globally");
606
+ D.append(toolbar, btnDeleteGlobal);
607
+ btnDeleteGlobal.addEventListener('click', function(){
608
+ self.hide();
609
+ Chat.deleteMessage(eMsg);
610
+ });
611
+ }
612
+ /* This might not be necessary any more: it was
613
+ initially caused by Safari being stricter than
614
+ other browsers on its time string input, and that
615
+ has since been resolved by emiting a stricter
616
+ format. */
617
+ // Date doesn't work, so dumb it down...
618
+ D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu"));
619
+ }
620
+ const toolbar = D.addClass(D.div(), 'toolbar');
621
+ D.append(this.e, toolbar);
622
+ const btnDeleteLocal = D.button("Delete locally");
623
+ D.append(toolbar, btnDeleteLocal);
624
+ const self = this;
625
+ btnDeleteLocal.addEventListener('click', function(){
626
+ self.hide();
627
+ hide();
628
+ Chat.deleteMessage(eMsg);
629
+ });
630
+ }
631
+ if(eMsg.dataset.xfrom){
632
+ /* Add a link to the /timeline filtered on this user. */
633
+ const toolbar2 = D.addClass(D.div(), 'toolbar');
634
+ D.append(this.e, toolbar2);
635
+ const timelineLink = D.attr(
636
+ D.a(F.repoUrl('timeline',{
637
+ u: eMsg.dataset.xfrom,
638
+ y: 'a'
639
+ }), "User's Timeline"),
640
+ 'target', '_blank'
641
+ );
642
+ D.append(toolbar2, timelineLink);
643
+ }
644
+ }/*refresh()*/
645
+ });
646
+ f.popup.installHideHandlers();
647
+ f.popup.hide = function(){
648
+ delete this._eMsg;
649
+ D.clearElement(this.e);
650
+ return this.show(false);
651
+ };
652
+ }/*end static init*/
653
+ const rect = ev.target.getBoundingClientRect();
654
+ const eMsg = ev.target.parentNode/*the owning .message-widget element*/;
655
+ f.popup._eMsg = eMsg;
656
+ let x = rect.left, y = rect.topm;
657
+ f.popup.show(ev.target)/*so we can get its computed size*/;
658
+ if(eMsg.dataset.xfrom===Chat.me
659
+ && document.body.classList.contains('my-messages-right')){
660
+ // Shift popup to the left for right-aligned messages to avoid
661
+ // truncation off the right edge of the page.
662
+ const pRect = f.popup.e.getBoundingClientRect();
663
+ x = rect.right - pRect.width;
664
+ }
665
+ f.popup.show(x, y);
666
+ }/*_handleLegendClicked()*/
667
+ };
668
+ return cf;
669
+ })()/*MessageWidget*/;
670
+
671
+ const BlobXferState = (function(){/*drag/drop bits...*/
672
+ /* State for paste and drag/drop */
673
+ const bxs = {
674
+ dropDetails: document.querySelector('#chat-drop-details'),
675
+ blob: undefined,
676
+ clear: function(){
677
+ this.blob = undefined;
678
+ D.clearElement(this.dropDetails);
679
+ Chat.e.inputFile.value = "";
680
+ }
681
+ };
682
+ /** Updates the paste/drop zone with details of the pasted/dropped
683
+ data. The argument must be a Blob or Blob-like object (File) or
684
+ it can be falsy to reset/clear that state.*/
685
+ const updateDropZoneContent = function(blob){
686
+ const dd = bxs.dropDetails;
687
+ bxs.blob = blob;
688
+ D.clearElement(dd);
689
+ if(!blob){
690
+ Chat.e.inputFile.value = '';
691
+ return;
692
+ }
693
+ D.append(dd, "Name: ", blob.name,
694
+ D.br(), "Size: ",blob.size);
695
+ if(blob.type && blob.type.startsWith("image/")){
696
+ const img = D.img();
697
+ D.append(dd, D.br(), img);
698
+ const reader = new FileReader();
699
+ reader.onload = (e)=>img.setAttribute('src', e.target.result);
700
+ reader.readAsDataURL(blob);
701
+ }
702
+ const btn = D.button("Cancel");
703
+ D.append(dd, D.br(), btn);
704
+ btn.addEventListener('click', ()=>updateDropZoneContent(), false);
705
+ };
706
+ Chat.e.inputFile.addEventListener('change', function(ev){
707
+ updateDropZoneContent(this.files && this.files[0] ? this.files[0] : undefined)
708
+ });
709
+ /* Handle image paste from clipboard. TODO: figure out how we can
710
+ paste non-image binary data as if it had been selected via the
711
+ file selection element. */
712
+ document.addEventListener('paste', function(event){
713
+ const items = event.clipboardData.items,
714
+ item = items[0];
715
+ if(!item || !item.type) return;
716
+ else if('file'===item.kind){
717
+ updateDropZoneContent(false/*clear prev state*/);
718
+ updateDropZoneContent(items[0].getAsFile());
719
+ }
720
+ }, false);
721
+ /* Add help button for drag/drop/paste zone */
722
+ Chat.e.inputFile.parentNode.insertBefore(
723
+ F.helpButtonlets.create(
724
+ Chat.e.fileSelectWrapper.querySelector('.help-buttonlet')
725
+ ), Chat.e.inputFile
726
+ );
727
+ ////////////////////////////////////////////////////////////
728
+ // File drag/drop visual notification.
729
+ const dropHighlight = Chat.e.inputFile /* target zone */;
730
+ const dropEvents = {
731
+ drop: function(ev){
732
+ D.removeClass(dropHighlight, 'dragover');
733
+ },
734
+ dragenter: function(ev){
735
+ ev.preventDefault();
736
+ ev.dataTransfer.dropEffect = "copy";
737
+ D.addClass(dropHighlight, 'dragover');
738
+ },
739
+ dragleave: function(ev){
740
+ D.removeClass(dropHighlight, 'dragover');
741
+ },
742
+ dragend: function(ev){
743
+ D.removeClass(dropHighlight, 'dragover');
744
+ }
745
+ };
746
+ Object.keys(dropEvents).forEach(
747
+ (k)=>Chat.e.inputFile.addEventListener(k, dropEvents[k], true)
748
+ );
749
+ return bxs;
750
+ })()/*drag/drop*/;
751
+
752
+ const tzOffsetToString = function(off){
753
+ const hours = Math.round(off/60), min = Math.round(off % 30);
754
+ return ''+(hours + (min ? '.5' : ''));
755
+ };
756
+ const pad2 = (x)=>('0'+x).substr(-2);
757
+ const localTime8601 = function(d){
758
+ return [
759
+ d.getYear()+1900, '-', pad2(d.getMonth()+1), '-', pad2(d.getDate()),
760
+ 'T', pad2(d.getHours()),':', pad2(d.getMinutes()),':',pad2(d.getSeconds())
761
+ ].join('');
762
+ };
763
+
764
+ Chat.submitMessage = function(){
765
+ const fd = new FormData(this.e.inputForm)
766
+ /* ^^^^ we don't really want/need the FORM element, but when
767
+ FormData() is default-constru new TEXT node with .fsize + " bytes)"
768
+ )
769
+ D.attr(a,'target','_blank'appendChild(a);
770
+ }
771
+ if(!ff.pad){
772
+ ff.pad,theTime(d))
773
+ }
774
+(m.fsize>0){
775
+ /* We return [
776
+ /**
777
+ This file conta,
778
+ btnMsgHome: E1('#chat-scroll-top'),
779
+ btnMsgEnd: E1('#chat-scroll-bottom/**
780
+ This file contains the client-side implementation of fossil's /chat
781
+ application.
782
+*/
783
+(function(){
784
+ const F = window.fossil, D = F.dom;
785
+ const E1 = function(selector){
786
+ const e = document.querySelector(selector);
787
+ if(!e) throw new Error("missing required DOM element: "+selector);
788
+ return e;
789
+ };
790
+ /**
791
+ Returns true if e is entirely within the bounds of the window's viewport.
792
+ */
793
+ const isEntirelyInViewport = function(e) {
794
+ const rect = e.getBoundingClientRect();
795
+ return (
796
+ rect.top >= 0 &&
797
+ rect.left >= 0 &&
798
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
799
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth)
800
+ );
801
+ };
802
+
803
+ /**
804
+ Returns true if e's on-screen position vertically overlaps that
805
+ of element v's. Horizontal overlap is ignored (we don't need it
806
+ for our case).
807
+ */
808
+ const overlapsElemView = function(e,v) {
809
+ const r1 = e.getBoundingClientRect(),
810
+ r2 = v.getBoundingClientRect();
811
+ if(r1.top<=r2.bottom && r1.top>=r2.top) return true;
812
+ else if(r1.bottom<=r2.bottom && r1.bottom>=r2.top) return true;
813
+ return false;
814
+ };
815
+
816
+ (function(){
817
+ let dbg = document.querySelector('#debugMsg');
818
+ if(dbg){
819
+ /* This can inadvertently influence our flexbox layouts, so move
820
+ it out of the way. */
821
+ D.append(document.body,dbg);
822
+ }
823
+ })();
824
+ const ForceResizeKludge = 0 ? function(){} : (function f(){
825
+ /* Workaround for Safari mayhem regarding use of vh CSS units....
826
+ We tried to use vh units to set the content area size for the
827
+ chat lay Android,
828
+ causing the input area to move off-screen. */
829
+ if(!f.elemsToCount){
830
+ f.elemsToCount = [
831
+ document.querySelector('body > div.header'),
832
+ document.querySelector('body > div.mainmenu'),
833
+ document.querySelector('body > #hbdrop'),
834
+ document.querySelector('body > div.footer')
835
+ ];
836
+ f.contentArea = E1('div.content');
837
+ }
838
+ const bcl = document.body.classList;
839
+ const resized = function(){
840
+ const wh = window.innerHeight,
841
+ com = bcl.contains('chat-only-mode');
842
+ var ht;
843
+ var extra = 0;
844
+ if(com){
845
+ ht = wh;
846
+ }else{
847
+ f.elemsToCount.forEach((e)=>e ? extra += D.effectiveHeight(e) : false);
848
+ ht = wh - extra;
849
+ }
850
+ f.contentArea.style.height =
851
+ f.contentArea.style.maxHeight = [
852
+ "calc(", (ht>=100 ? ht : 100), "px",
853
+ " - 1em"/*fudge value*/,")"
854
+ /* ^^^^ hypothetically not needed, but both Chrome/FF on
855
+ Linux will force scrollbars on the body if this value is
856
+ too small (<0.75em in my tests). */
857
+ ].join('');
858
+ if(false){
859
+ console.debug("resized.",wh, extra, ht,
860
+ window.getComputedStyle(f.contentArea).maxHeight,
861
+ f.contentArea);
862
+ }
863
+ };
864
+ var doit;
865
+ window.addEventListener('resize',function(ev){
866
+ clearTimeout(doit);
867
+ doit = setTimeout(resized, 100);
868
+ }, false);
869
+ resized();
870
+ return resized;
871
+ })();
872
+ fossil.FRK = ForceResizeKludge/*for debugging*/;
873
+ const Chat = (function(){
874
+ const cs = {
875
+ verboseErrors: false /* if true then certain, mostly extraneous,
876
+ error messages may be sent to the console. */,
877
+ e:{/*map of certain DOM elements.*/
878
+ messageInjectPoint: E1('#message-inject-point'),
879
+ pageTitle: E1('head title'),
880
+ loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
881
+ inputWrapper: E1("#chat-input-area"),
882
+ fileSelectWrapper: E1('#chat-input-file-area'),
883
+ messagesWrapper: E1('#chat-messages-wrapper'),
884
+ inputForm: E1('#chat-form'),
885
+ btnSubmit: E1('#chat-message-submit'),
886
+ inputSingle: E1('#chat-input-single'),
887
+ inputMulti: E1('#chat-input-multi'),
888
+ inputCurrent: undefined/*one of inputSingle or inputMulti*/,
889
+ inputFile: E1('#chat-input-file'),
890
+ contentDiv: E1('div.content')
891
+ },
892
+ me: F.user.name,
893
+ mxMsg: F.config.chat.initSize ? -F.config.chat.initSize : -50,
894
+ mnMsg: undefined/*lowest message ID we've seen so far (for history loading)*/,
895
+ pageIsActive: 'visible'===document.visibilityState,
896
+ changesSincePageHidden: 0,
897
+ notificationBubbleColor: 'white',
898
+ totalMessageCount: 0, // total # of inbound messages
899
+ //! Number of messages to load for the history buttons
900
+ loadMessageCount: Math.abs(F.config.chat.initSize || 20),
901
+ ajaxInflight: 0,
902
+ /** Gets (no args) or sets (1 arg) the current input text field value,
903
+ taking into account single- vs multi-line input. The getter returns
904
+ a string and the setter returns this object. */
905
+ inputValue: function(){
906
+ const e = this.inputElement();
907
+ if(arguments.length){
908
+ e.value = arguments[0];
909
+ return this;
910
+ }
911
+ return e.value;
912
+ },
913
+ /** Asks the current user input field to take focus. Returns this. */
914
+ inputFocus: function(){
915
+ this.inputElement().focus();
916
+ return this;
917
+ },
918
+ /** Returns the current message input element. */
919
+ inputElement: function(){
920
+ return this.e.inputCurrent;
921
+ },
922
+ /** Toggles between single- and multi-line edit modes. Returns this. */
923
+ inputToggleSingleMulti: function(){
924
+ const old = this.e.inputCurrent;
925
+ if(this.e.inputCurrent === this.e.inputSingle){
926
+ this.e.inputCurrent = this.e.inputMulti;
927
+ }else{
928
+ this.e.inputCurrent = this.e.inputSingle;
929
+ }
930
+ const m = this.e.messagesWrapper,
931
+ sTop = m.scrollTop,
932
+ mh1 = m.clientHeight;
933
+ D.addClass(old, 'hidden');
934
+ D.removeClass(this.e.inputCurrent, 'hidden');
935
+ const mh2 = m.clientHeight;
936
+ m.scrollTo(0, sTop + (mh1-mh2));
937
+ this.e.inputCurrent.value = old.value;
938
+ old.value = '';
939
+ return this;
940
+ },
941
+ /**
942
+ If passed true or no arguments, switches to multi-line mode
943
+ if currently in single-line mode. If passed false, switches
944
+ to single-line mode if currently in multi-line mode. Returns
945
+ this.
946
+ */
947
+ inputMultilineMode: function(yes){
948
+ if(!arguments.length) yes = true;
949
+ if(yes && this.e.inputCurrent === this.e.inputMulti) return this;
950
+ else if(!yes && this.e.inputCurrent === this.e.inputSingle) return this;
951
+ else return this.inputToggleSingleMulti();
952
+ },
953
+ /** Enables (if yes is truthy) or disables all elements in
954
+ * this.disableDuringAjax. */
955
+ enableAjaxComponents: function(yes){
956
+ D[yes ? 'enable' : 'disable'](this.disableDuringAjax);
957
+ return this;
958
+ },
959
+ /* Must be called before any API is used which starts ajax traffic.
960
+ If this call represents the currently only in-flight ajax request,
961
+ all DOM elements in this.disableDuringAjax are disabled.
962
+ We cannot do this via a central API because (1) window.fetch()'s
963
+ Promise-based API seemingly makes that impossible and (2) the polling
964
+ technique holds ajax requests open for as long as possible. A call
965
+ to this method obligates the caller to also call ajaxEnd().
966
+
967
+ This must NOT be called forelement e as a new row end
968
+ of the list if atEnd is truthy the
969
+ list. */
970
+ injectMessageElem: function f(e, atEnd){
971
+ const mip = atEnd ? this.e.loadOlderToolbar : this.e.messageInjectPoint,
972
+ holder = this.e.messagesWrapper,
973
+ prevMessage = this.e.newestMessage;
974
+ if(atEnd){
975
+ const fe = mip.nextElementSibling;
976
+ if(fe) mip.parentNode.insertBefore(e, fe);
977
+ else D.append(mip.parentNode, e);
978
+ }else{
979
+ D.append(holder,e);
980
+ this.e.newestMessage = e;
981
+ }
982
+ if(!atEnd && !this._isBatchLoading
983
+ && e.dataset.xfrom!==this.me
984
+ && (prevMessage
985
+ ? !this.messageIsInView(prevMessage)
986
+ : false)){
987
+ /* If a new non-history message arrives while the user is
988
+ scrolled elsewhere, do not scroll to the latest
989
+ message, but gently alert the user that a new message
990
+ has arrived. */
991
+ if(!f.btnDown){
992
+ f.btnDown = D.button("⇣⇣⇣");
993
+ f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
994
+ }
995
+ F.toast.message(f.btnDown," New message has arrived.");
996
+ }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
997
+ this.scheduleScrollOfMsg(e);
998
+ }else if(!this._isBatchLoading){
999
+ /* When a message from someone else arrives, we have to
1000
+ figure out whether or not to scroll it into view. Ideally
1001
+ we'd just stuff it in the UI and let the flexbox layout
1002
+ DTRT, but Safari has expressed, in no uncertain terms,
1003
+ some disappointment with that approach, so we'll
1004
+ heuristicize it: if the previous last message is in view,
1005
+ essage input element. */
1006
+top of the
1007
+ Kludge()list if atEnd is falsy, else at ttentTarg the load-history widge we'd just stuff it in the UI and let the flexbox layout
1008
+ DTRT, but Safari has expressed, in no uncertain terms,
1009
+ some disappointment with that approach, so we'll
1010
+ heuristicistyling. We cannot do this easily as
1011
+ messages arrive in batch mode because they can arrive out of
1012
+ order (they arrive, and are processed, in reverse order for
1013
+ the "load older messages" buttons). We do this handling in user is up readi() for "interactive" use but we'd jrecalculate them en massof messages to load for the history buttons
1014
+ loadMessageCount: Math.abs(F.config.chat.initSize || 20),
1015
+ ajaxInflight: 0,
1016
+ /** Gets (no args) or sets (1 arg) the current input text field value,
1017
+ taking into account single- vs multi-line input. The gtains t scrolled elsewhere, do not scroll to the latest
1018
+ message, but gently alert the user that a new message
1019
+ has arrived. */
1020
+ if(!f.btnDown){
1021
+ f.btnDown = D.button("⇣⇣⇣");
1022
+ f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
1023
+ }
1024
+ F.toast.message(f.btnDown," New message has arrived.");
1025
+ }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
1026
+ this.scheduleScrollOfMsg(e);
1027
+ }else if(!this._isBatchLoading){
1028
+ /* When a message from someone else arrives, we have to
1029
+ figure out whether or not to scroll it into view. Ideally
1030
+ we'd just stuff it in the UI and let the flexbox layout
1031
+ DTRT, but Safari has expressed, in no uncertain terms,
1032
+ some disappointment with that approach, so we'll
1033
+ heuristicize it: if the previous last message is in view,
1034
+ assume the user is at or near the input element and
1035
+ scroll this one into view. If that message is NOT in
1036
+ view, assume the user is up reading history somewhere and
1037
+ do NOT scroll because doing so would interrupt
1038
+ them. There are middle grounds here where the user will
1039
+ experience a slight UI jolt, but this heuristic mostly
1040
+ seems to work out okay. If there was no previous message,
1041
+ assume we don't have any messages yet and go ahead and
1042
+ scroll this message into view (noting that that scrolling
1043
+ is hypothetically a no-op in such cases).
1044
+
1045
+ The wrench in these works are posts with IMG tags, as
1046
+ those images are loaded async and the element does not
1047
+ yet have enough information to know how far to scroll!
1048
+ For such cases we have to delay the scroll until the
1049
+ image loads (and we hope it does so before another
1050
+ message arrives).
1051
+ */
1052
+ if(1===+e.dataset.hasImage){
1053
+ e.querySelector('img').addEventListener('load',()=>e.scrollIntoView());
1054
+ }else if(!prevMessage || (prevMessage && isEntirelyInViewport(prevMessage))){
1055
+ e.scrollIntoView(false);
1056
+ }
1057
+ }
1058
+ },
1059
+ /** Returns true if chat-only mode is enabled. */
1060
+ isChatOnlyMode: ()=>document.body.classList.contains('chat-only-mode'),
1061
+ /**
1062
+ Enters (if passed a truthy value or no arguments) or leaves
1063
+ "chat-only" mode. That mode hides the page's header and
1064
+ footer, leaving only the chat application visible to the
1065
+ user.
1066
+ */
1067
+ chatOnlyMode: function f(yes){
1068
+ if(undefined === f.elemsToToggle){
1069
+ f.elemsToToggle = [];
1070
+ document.querySelectorAll(
1071
+ ["body > div.header",
1072
+ "body > div.mainmenu",
1073
+ "body > div.footer",
1074
+ "#debugMsg"
1075
+ ].join(',')
1076
+ ).forEach((e)=>f.elemsToToggle.push(e));
1077
+ }
1078
+ if(!arguments.length) yes = true;
1079
+ if(yes === this.isChatOnlyMode()) return this;
1080
+ if(yes){
1081
+ D.addClass(f.elemsToToggle, 'hidden');
1082
+ D.addClass(document.body, 'chat-only-mode');
1083
+ document.body.scroll(0,document.body.height);
1084
+ }else{
1085
+ D.removeClass(f.elemsToToggle, 'hidden');
1086
+ D.removeClass(document.body, 'chat-only-mode');
1087
+ }
1088
+ ForceResizeKludge();
1089
+ return this;
1090
+ },
1091
+ /** Tries to scroll the message area to...
1092
+ <0 = top of the message list, >0 = bottom of the message list,
1093
+ 0 == the newest message (normally the same position as >1).
1094
+ */
1095
+ scrollMessagesTo: function(where){
1096
+ if(where<0){
1097
+ Chat.e.messagesWrapper.scrollTop = 0;
1098
+ }else if(where>0){
1099
+ Chat.e.messagesWrapper.scrollTop = Chat.e.messagesWrapper.scrollHeight;
1100
+ }else if(Chat.e.newestMessage){
1101
+ Chat.e.newestMessage.scrollIntoView(false);
1102
+ }
1103
+ },
1104
+ togguSpan);
1105
+ });
1106
+ }
1107
+ };
1108
+ F.fetch.beforesend = ()=>cs.ajaxStart();
1109
+ F.fetch.aftersend = ()=>cs.ajaxEnd();
1110
+ cs.e.inputCurrent = cs.e.inputSingle;
1111
+ /* Install default settings... */
1112
+ Object.keys(cs.settings.defaults).forEach(function(k){
1113
+ const v = cs.settings.get(k,cs);
1114
+ if(cs===v) cs.settings.set(k,cs.settings.defaults[k]);
1115
+ });
1116
+ cutCurrent.value MessageElem(mw.e.body);
1117
+ mw.scrollIntoView();
1118
+ };
1119
+
1120
+ cs.getMessageElemById = function(id){
1121
+ return qs('[data-msgid="'+id+'"]');
1122
+ };
1123
+
1124
+ /** Finds the last .message-widget element and returns it or
1125
+ the undefined value if none are found. */
1126
+ cs.fetchLastMessageElem = function(){
1127
+ const msgs = document.querySelectorAll('.message-widget');
1128
+ var rc;
1129
+ if(msgs.length){
1130
+ rc = this.e.newestMessage = msgs[msgs.length-1];
1131
+ }
1132
+ return rc;
1133
+ };
1134
+
1135
+ /**
1136
+ LOCALLY deletes a message element by the message ID or passing
1137
+ the .message-row element. Returns true if it removes an element,
1138
+ else false.
1139
+ */
1140
+ cs.deleteMessageElem = function(id){
1141
+ var e;
1142
+ if(id instanceof HTMLElement){
1143
+ e = id;
1144
+ id = e.dataset.msgid;
1145
+ }else{
1146
+ e = this.getMessageElemById(id);
1147
+ }
1148
+ if(e && id){
1149
+ D.remove(e);
1150
+ if(e===this.e.newestMessage){
1151
+ this.fetchLastMessageElem();
1152
+ }
1153
+ F.toast.message("Deleted message "+id+".");
1154
+ }
1155
+ return !!e;
1156
+ };
1157
+
1158
+ /*
--- a/src/chat.js
+++ b/src/chat.js
@@ -0,0 +1,1158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/chat.js
+++ b/src/chat.js
@@ -0,0 +1,1158 @@
1 /**
2 This file conta,
3 btnMsgHome: E1('#chat-scroll-top'),
4 btnMsgEnd: E1('#chat-scroll-bottom/**
5 This file contains the client-side implementation of fossil's /chat
6 application.
7 */
8 (function(){
9 const F = window.fossil, D = F.dom;
10 const E1 = function(selector){
11 const e = document.querySelector(selector);
12 if(!e) throw new Error("missing required DOM element: "+selector);
13 return e;
14 };
15 /**
16 Returns true if e is entirely within the bounds of the window's viewport.
17 */
18 const isEntirelyInViewport = function(e) {
19 const rect = e.getBoundingClientRect();
20 return (
21 rect.top >= 0 &&
22 rect.left >= 0 &&
23 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
24 rect.right <= (window.innerWidth || document.documentElement.clientWidth)
25 );
26 };
27
28 /**
29 Returns true if e's on-screen position vertically overlaps that
30 of element v's. Horizontal overlap is ignored (we don't need it
31 for our case).
32 */
33 const overlapsElemView = function(e,v) {
34 const r1 = e.getBoundingClientRect(),
35 r2 = v.getBoundingClientRect();
36 if(r1.top<=r2.bottom && r1.top>=r2.top) return true;
37 else if(r1.bottom<=r2.bottom && r1.bottom>=r2.top) return true;
38 return false;
39 };
40
41 (function(){
42 let dbg = document.querySelector('#debugMsg');
43 if(dbg){
44 /* This can inadvertently influence our flexbox layouts, so move
45 it out of the way. */
46 D.append(document.body,dbg);
47 }
48 })();
49 const ForceResizeKludge = 0 ? function(){} : (function f(){
50 /* Workaround for Safari mayhem regarding use of vh CSS units....
51 We tried to use vh units to set the content area size for the
52 chat lay Android,
53 causing the input area to move off-screen. */
54 if(!f.elemsToCount){
55 f.elemsToCount = [
56 document.querySelector('body > div.header'),
57 document.querySelector('body > div.mainmenu'),
58 document.querySelector('body > #hbdrop'),
59 document.querySelector('body > div.footer')
60 ];
61 f.contentArea = E1('div.content');
62 }
63 const bcl = document.body.classList;
64 const resized = function(){
65 const wh = window.innerHeight,
66 com = bcl.contains('chat-only-mode');
67 var ht;
68 var extra = 0;
69 if(com){
70 ht = wh;
71 }else{
72 f.elemsToCount.forEach((e)=>e ? extra += D.effectiveHeight(e) : false);
73 ht = wh - extra;
74 }
75 f.contentArea.style.height =
76 f.contentArea.style.maxHeight = [
77 "calc(", (ht>=100 ? ht : 100), "px",
78 " - 1em"/*fudge value*/,")"
79 /* ^^^^ hypothetically not needed, but both Chrome/FF on
80 Linux will force scrollbars on the body if this value is
81 too small (<0.75em in my tests). */
82 ].join('');
83 if(false){
84 console.debug("resized.",wh, extra, ht,
85 window.getComputedStyle(f.contentArea).maxHeight,
86 f.contentArea);
87 }
88 };
89 var doit;
90 window.addEventListener('resize',function(ev){
91 clearTimeout(doit);
92 doit = setTimeout(resized, 100);
93 }, false);
94 resized();
95 return resized;
96 })();
97 fossil.FRK = ForceResizeKludge/*for debugging*/;
98 const Chat = (function(){
99 const cs = {
100 verboseErrors: false /* if true then certain, mostly extraneous,
101 error messages may be sent to the console. */,
102 e:{/*map of certain DOM elements.*/
103 messageInjectPoint: E1('#message-inject-point'),
104 pageTitle: E1('head title'),
105 loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
106 inputWrapper: E1("#chat-input-area"),
107 fileSelectWrapper: E1('#chat-input-file-area'),
108 messagesWrapper: E1('#chat-messages-wrapper'),
109 inputForm: E1('#chat-form'),
110 btnSubmit: E1('#chat-message-submit'),
111 inputSingle: E1('#chat-input-single'),
112 inputMulti: E1('#chat-input-multi'),
113 inputCurrent: undefined/*one of inputSingle or inputMulti*/,
114 inputFile: E1('#chat-input-file'),
115 contentDiv: E1('div.content')
116 },
117 me: F.user.name,
118 mxMsg: F.config.chat.initSize ? -F.config.chat.initSize : -50,
119 mnMsg: undefined/*lowest message ID we've seen so far (for history loading)*/,
120 pageIsActive: 'visible'===document.visibilityState,
121 changesSincePageHidden: 0,
122 notificationBubbleColor: 'white',
123 totalMessageCount: 0, // total # of inbound messages
124 //! Number of messages to load for the history buttons
125 loadMessageCount: Math.abs(F.config.chat.initSize || 20),
126 ajaxInflight: 0,
127 /** Gets (no args) or sets (1 arg) the current input text field value,
128 taking into account single- vs multi-line input. The getter returns
129 a string and the setter returns this object. */
130 inputValue: function(){
131 const e = this.inputElement();
132 if(arguments.length){
133 e.value = arguments[0];
134 return this;
135 }
136 return e.value;
137 },
138 /** Asks the current user input field to take focus. Returns this. */
139 inputFocus: function(){
140 this.inputElement().focus();
141 return this;
142 },
143 /** Returns the current message input element. */
144 inputElement: function(){
145 return this.e.inputCurrent;
146 },
147 /** Toggles between single- and multi-line edit modes. Returns this. */
148 inputToggleSingleMulti: function(){
149 const old = this.e.inputCurrent;
150 if(this.e.inputCurrent === this.e.inputSingle){
151 this.e.inputCurrent = this.e.inputMulti;
152 }else{
153 this.e.inputCurrent = this.e.inputSingle;
154 }
155 const m = this.e.messagesWrapper,
156 sTop = m.scrollTop,
157 mh1 = m.clientHeight;
158 D.addClass(old, 'hidden');
159 D.removeClass(this.e.inputCurrent, 'hidden');
160 const mh2 = m.clientHeight;
161 m.scrollTo(0, sTop + (mh1-mh2));
162 this.e.inputCurrent.value = old.value;
163 old.value = '';
164 return this;
165 },
166 /**
167 If passed true or no arguments, switches to multi-line mode
168 if currently in single-line mode. If passed false, switches
169 to single-line mode if currently in multi-line mode. Returns
170 this.
171 */
172 inputMultilineMode: function(yes){
173 if(!arguments.length) yes = true;
174 if(yes && this.e.inputCurrent === this.e.inputMulti) return this;
175 else if(!yes && this.e.inputCurrent === this.e.inputSingle) return this;
176 else return this.inputToggleSingleMulti();
177 },
178 /** Enables (if yes is truthy) or disables all elements in
179 * this.disableDuringAjax. */
180 enableAjaxComponents: function(yes){
181 D[yes ? 'enable' : 'disable'](this.disableDuringAjax);
182 return this;
183 },
184 /* Must be called before any API is used which starts ajax traffic.
185 If this call represents the currently only in-flight ajax request,
186 all DOM elements in this.disableDuringAjax are disabled.
187 We cannot do this via a central API because (1) window.fetch()'s
188 Promise-based API seemingly makes that impossible and (2) the polling
189 technique holds ajax requests open for as long as possible. A call
190 to this method obligates the caller to also call ajaxEnd().
191
192 This must NOT be called forelement e as a new row end
193 of the list if atEnd is truthy the
194 list. */
195 injectMessageElem: function f(e, atEnd){
196 const mip = atEnd ? this.e.loadOlderToolbar : this.e.messageInjectPoint,
197 holder = this.e.messagesWrapper,
198 prevMessage = this.e.newestMessage;
199 if(atEnd){
200 const fe = mip.nextElementSibling;
201 if(fe) mip.parentNode.insertBefore(e, fe);
202 else D.append(mip.parentNode, e);
203 }else{
204 D.append(holder,e);
205 this.e.newestMessage = e;
206 }
207 if(!atEnd && !this._isBatchLoading
208 && e.dataset.xfrom!==this.me
209 && (prevMessage
210 ? !this.messageIsInView(prevMessage)
211 : false)){
212 /* If a new non-history message arrives while the user is
213 scrolled elsewhere, do not scroll to the latest
214 message, but gently alert the user that a new message
215 has arrived. */
216 if(!f.btnDown){
217 f.btnDown = D.button("⇣⇣⇣");
218 f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
219 }
220 F.toast.message(f.btnDown," New message has arrived.");
221 }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
222 this.scheduleScrollOfMsg(e);
223 }else if(!this._isBatchLoading){
224 /* When a message from someone else arrives, we have to
225 figure out whether or not to scroll it into view. Ideally
226 we'd just stuff it in the UI and let the flexbox layout
227 DTRT, but Safari has expressed, in no uncertain terms,
228 some disappointment with that approach, so we'll
229 heuristicize it: if the previous last message is in view,
230 essage input element. */
231 top of the
232 Kludge()list if atEnd is falsy, else at ttentTarg the load-history widge we'd just stuff it in the UI and let the flexbox layout
233 DTRT, but Safari has expressed, in no uncertain terms,
234 some disappointment with that approach, so we'll
235 heuristicistyling. We cannot do this easily as
236 messages arrive in batch mode because they can arrive out of
237 order (they arrive, and are processed, in reverse order for
238 the "load older messages" buttons). We do this handling in user is up readi() for "interactive" use but we'd jrecalculate them en massof messages to load for the history buttons
239 loadMessageCount: Math.abs(F.config.chat.initSize || 20),
240 ajaxInflight: 0,
241 /** Gets (no args) or sets (1 arg) the current input text field value,
242 taking into account single- vs multi-line input. The gtains t scrolled elsewhere, do not scroll to the latest
243 message, but gently alert the user that a new message
244 has arrived. */
245 if(!f.btnDown){
246 f.btnDown = D.button("⇣⇣⇣");
247 f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
248 }
249 F.toast.message(f.btnDown," New message has arrived.");
250 }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
251 this.scheduleScrollOfMsg(e);
252 }else if(!this._isBatchLoading){
253 /* When a message from someone else arrives, we have to
254 figure out whether or not to scroll it into view. Ideally
255 we'd just stuff it in the UI and let the flexbox layout
256 DTRT, but Safari has expressed, in no uncertain terms,
257 some disappointment with that approach, so we'll
258 heuristicize it: if the previous last message is in view,
259 assume the user is at or near the input element and
260 scroll this one into view. If that message is NOT in
261 view, assume the user is up reading history somewhere and
262 do NOT scroll because doing so would interrupt
263 them. There are middle grounds here where the user will
264 experience a slight UI jolt, but this heuristic mostly
265 seems to work out okay. If there was no previous message,
266 assume we don't have any messages yet and go ahead and
267 scroll this message into view (noting that that scrolling
268 is hypothetically a no-op in such cases).
269
270 The wrench in these works are posts with IMG tags, as
271 those images are loaded async and the element does not
272 yet have enough information to know how far to scroll!
273 For such cases we have to delay the scroll until the
274 image loads (and we hope it does so before another
275 message arrives).
276 */
277 if(1===+e.dataset.hasImage){
278 e.querySelector('img').addEventListener('load',()=>e.scrollIntoView());
279 }else if(!prevMessage || (prevMessage && isEntirelyInViewport(prevMessage))){
280 e.scrollIntoView(false);
281 }
282 }
283 },
284 /** Returns true if chat-only mode is enabled. */
285 isChatOnlyMode: ()=>document.body.classList.contains('chat-only-mode'),
286 /**
287 Enters (if passed a truthy value or no arguments) or leaves
288 "chat-only" mode. That mode hides the page's header and
289 footer, leaving only the chat application visible to the
290 user.
291 */
292 chatOnlyMode: function f(yes){
293 if(undefined === f.elemsToToggle){
294 f.elemsToToggle = [];
295 document.querySelectorAll(
296 ["body > div.header",
297 "body > div.mainmenu",
298 "body > div.footer",
299 "#debugMsg"
300 ].join(',')
301 ).forEach((e)=>f.elemsToToggle.push(e));
302 }
303 if(!arguments.length) yes = true;
304 if(yes === this.isChatOnlyMode()) return this;
305 if(yes){
306 D.addClass(f.elemsToToggle, 'hidden');
307 D.addClass(document.body, 'chat-only-mode');
308 document.body.scroll(0,document.body.height);
309 }else{
310 D.removeClass(f.elemsToToggle, 'hidden');
311 D.removeClass(document.body, 'chat-only-mode');
312 }
313 ForceResizeKludge();
314 return this;
315 },
316 /** Tries to scroll the message area to...
317 <0 = top of the message list, >0 = bottom of the message list,
318 0 == the newest message (normally the same position as >1).
319 */
320 scrollMessagesTo: function(where){
321 if(where<0){
322 Chat.e.messagesWrapper.scrollTop = 0;
323 }else if(where>0){
324 Chat.e.messagesWrapper.scrollTop = Chat.e.messagesWrapper.scrollHeight;
325 }else if(Chat.e.newestMessage){
326 Chat.e.newestMessage.scrollIntoView(false);
327 }
328 },
329 togguSpan);
330 });
331 }
332 };
333 F.fetch.beforesend = ()=>cs.ajaxStart();
334 F.fetch.aftersend = ()=>cs.ajaxEnd();
335 cs.e.inputCurrent = cs.e.inputSingle;
336 /* Install default settings... */
337 Object.keys(cs.settings.defaults).forEach(function(k){
338 const v = cs.settings.get(k,cs);
339 if(cs===v) cs.settings.set(k,cs.settings.defaults[k]);
340 });
341 cutCurrent.value MessageElem(mw.e.body);
342 mw.scrollIntoView();
343 };
344
345 cs.getMessageElemById = function(id){
346 return qs('[data-msgid="'+id+'"]');
347 };
348
349 /** Finds the last .message-widget element and returns it or
350 the undefined value if none are found. */
351 cs.fetchLastMessageElem = function(){
352 const msgs = document.querySelectorAll('.message-widget');
353 var rc;
354 if(msgs.length){
355 rc = this.e.newestMessage = msgs[msgs.length-1];
356 }
357 return rc;
358 };
359
360 /**
361 LOCALLY deletes a message element by the message ID or passing
362 the .message-row element. Returns true if it removes an element,
363 else false.
364 */
365 cs.deleteMessageElem = function(id){
366 var e;
367 if(id instanceof HTMLElement){
368 e = id;
369 id = e.dataset.msgid;
370 }else{
371 e = this.getMessageElemById(id);
372 }
373 if(e && id){
374 D.remove(e);
375 if(e===this.e.newestMessage){
376 this.fetchLastMessageElem();
377 }
378 F.toast.message("Deleted message "+id+".");
379 }
380 return !!e;
381 };
382
383 /** Given a .message-row element, this function returns whethe the
384 current user may, at least hypothetically, delete the message
385 globally. A user may always delete a local copy of a
386 post. The server may trump this, e.g. if the login has been
387 cancelled after this page was loaded.
388 */
389 cs.userMayDelete = function(eMsg){
390 return +eMsg.dataset.msgid>0
391 && (this.me === eMsg.dataset.xfrom
392 || F.user.isAdmin/*will be confirmed server-side*/);
393 };
394
395 /** Returns a new Error() object encapsulating state from the given
396 fetch() response promise. */
397 cs._newResponseError = function(response){
398 return new Error([
399 "HTTP status ", response.status,": ",response.url,": ",
400 response.statusText].join(''));
401 };
402
403 /** Helper for reporting HTTP-level response errors via fetch().
404 If response.ok then response.json() is returned, else an Error
405 is thrown. */
406 cs._fetchJsonOrError = function(response){
407 if(response.ok) return response.json();
408 else throw cs._newResponseError(response);
409 };
410
411 /**
412 Removes the given message ID from the local chat record and, if
413 the message was posted by this user OR this user in an
414 admin/setup, also submits it for removal on the remote.
415
416 id may optionally be a DOM element, in which case it must be a
417 .message-row element.
418 */
419 cs.deleteMessage = function(id){
420 var e;
421 if(id instanceof HTMLElement){
422 e = id;
423 id = e.dataset.msgid;
424 }else{
425 e = this.getMessageElemById(id);
426 }
427 if(!(e instanceof HTMLElement)) return;
428 if(this.userMayDelete(e)){
429 this.ajaxStart();
430 F.fetch("chat-delete/" + id, {
431 responseType: 'json',
432 onload:(r)=>this.deleteMessageElem(r),
433 onerror:(err)=>this.reportErrorAsMessage(err)
434 });
435 }else{
436 this.deleteMessageElem(id);
437 }
438 };
439 document.addEventListener('visibilitychange', function(ev){
440 cs.pageIsActive = ('visible' === document.visibilityState);
441 if(cs.pageIsActive){
442 cs.e.pageTitle.innerText = cs.pageTitleOrig;
443 }
444 }, true);
445 return cs;
446 })()/*Chat initialization*/;
447
448 /**
449 Custom widget type for rendering messages (one message per
450 instance). These are modelled after FIELDSET elements but we
451 don't use FIELDSET because of cross-browser inconsistencies in
452 features of the FIELDSET/LEGEND combination, e.g. inability to
453 align legends via CSS in Firefox and clicking-related
454 deficiencies in Safari.
455 */
456 Chat.MessageWidget = (function(){
457 /**
458 Constructor. If passed an argument, it is passed to
459 this.setMessage() after initialization.
460 */
461 const cf = function(){
462 this.e = {
463 body: D.addClass(D.div(), 'message-widget'),
464 tab: D.addClass(D.span(), 'message-widget-tab'),
465 content: D.addClass(D.div(), 'message-widget-content')
466 };
467 D.append(this.e.body, this.e.tab, this.e.content);
468 this.e.tab.setAttribute('role', 'button');
469 if(arguments.length){
470 this.setMessage(arguments[0]);
471 }
472 };
473 /* Left-zero-pad a number to at least 2 digits */
474 const pad2 = (x)=>(''+x).length>1 ? x : '0'+x;
475 const dowMap = {
476 /* Map of Date.getDay() values to weekday names. */
477 0: "Sunday", 1: "Monday", 2: "Tuesday",
478 3: "Wednesday", 4: "Thursday", 5: "Friday",
479 6: "Saturday"
480 };
481 /* Given a Date, returns the timestamp string used in the
482 "tab" part of message widgets. */
483 const theTime = function(d){
484 return [
485 //d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/),
486 //'-',pad2(d.getDate()), ' ',
487 d.getHours(),":",
488 (d.getMinutes()+100).toString().slice(1,3),
489 fetch("chat-dele if(response.ok) return if(!response.ok)guments[0]);
490 return response;
491 ings.get('})
492 .then(()=>= function ff(d){
493 e)) to reset .catch(err=>thiserr))ew Error(/**
494 This file conta,
495 (d){
496 return [
497 = function ff(d){
498 d || (d = new Date());
499 return [
500 d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/),
501 '-',pad2(d.getDate()),
502 ' ',pad2(d.getHours()),':',pad2(d.getMinutes()),
503 ':',pad2(d.getSeconds())
504 ].join('');
505 };
506 cf.prototype = {
507 scrollIntoView: function(){
508 this.e.content.scrollIntoView();
509 },
510 setMessage: function(m){
511 const ds = this.e.body.dataset;
512 ds.timestamp = m.mtime;
513 ds.lmtime = m.lmtime;
514 ds.msgid = m.msgid;
515 ds.xfrom = m.xfrom || '';
516 if(m.xfrom === Chat.me){
517 D.addClass(this.e.body, 'mine');
518 }
519 if(m.uclr){
520 this.e.content.style.backgroundColor = m.uclr;
521 this.e.tab.style.backgroundColor = m.uclr;
522 }
523 const d = new Date(m.mtime);
524 D.clearElement(this.e.tab);
525 var contentTarget = this.e.content;
526 var eXFrom /* element holding xfrom name */;
527 if(m.xfrom){
528 eXFrom = D.append(D.addClass(D.span(), 'xfrom'), m.xfrom);
529 D.append(
530 this.e.tab, eXFrom,
531 D.text(" #",(m.msgid||'???'),' @ ',theTime(d))
532 );
533 }else{/*notification*/
534 D.addClass(this.e.body, 'notification');
535 if(m.isError){
536 D.addClass([contentTarget, this.e.tab], 'error');
537 }
538 D.appe const a = D.a(fname),
539 // ^ to cause downloaded cs.e.fsize + " bytes)"
540 comes from the same server as this script and
541 // is guaranteed by that server to be "safe" HTML - safe in the
542 // sense that it is not possible for a malefactor to inject HTML
543 // or javascript or CSS. The m.xmsg content might contain
544 // hyperlinks, but otherwise it will be markup-free. See the
545 // chat_format_to_html() routine in the server for details.
546 //
547 // Hence, even though innerHTML is normally frowned upon, it is
548 // perfectly safe to use in this context.
549 if(m.xmsg instanceof Array){
550 // Used by Chat.reportErrorAsMessage()
551 D.append(contentTarget, m.xmsg);
552 }else{
553 contentTarget.innerHTML = m.xmsg;
554 }
555 }
556 this.e.tab.addEventListener('click', this._handleLegendClicked, false);
557 if(eXFrom){
558 eXFrom.addEventListener('click', ()=>this.e.tab.click(), false);
559 }
560 return this;
561 },
562 /* Event handler for clicking .message-user elements to show their
563 timestamps. */
564 _handleLegendClicked: function f(ev){
565 if(!f.popup){
566 /* Timestamp popup widget */
567 f.popup = new F.PopupWidget({
568 cssClass: ['fossil-tooltip', 'chat-message-popup'],
569 refresh:function(){
570 const eMsg = this._eMsg;
571 if(!eMsg) return;
572 D.clearElement(this.e);
573 const d = new Date(eMsg.dataset.timestamp);
574 if(d.getMinutes().toString()!=="NaN"){
575 // Date works, render informative timestamps
576 const xfrom = eMsg.dataset.xfrom || 'server';
577 D.append(this.e,
578 D.append(D.span(), localTimeString(d)," ",Chat.me," time"),
579 D.append(D.span(), iso8601ish(d)));
580 if(eMsg.dataset.lmtime && xfrom!==Chat.me){
581 D.append(this.e,
582 D.append(D.span(), localTime8601(
583 new Date(eMsg.dataset.lmtime)
584 ).replace('T',' ')," ",xfrom," time"));
585 }
586 }else{
587 /* This might not be necessary any more: it was
588 initially caused by Safari being stricter than
589 other browsers on its time string input, and that
590 has since been resolved by emiting a stricter
591 format. */
592 // Date doesn't work, so dumb it down...
593 D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu"));
594 }
595 const toolbar = D.addClass(D.div(), 'toolbar');
596 D.append(this.e, toolbar);
597 const btnDeleteLocal = D.button("Delete locally");
598 D.append(toolbar, btnDeleteLocal);
599 const self = this;
600 btnDeleteLocal.addEventListener('click', function(){
601 self.hide();
602 Chat.deleteMessageElem(eMsg);
603 });
604 if(Chat.userMayDelete(eMsg)){
605 const btnDeleteGlobal = D.button("Delete globally");
606 D.append(toolbar, btnDeleteGlobal);
607 btnDeleteGlobal.addEventListener('click', function(){
608 self.hide();
609 Chat.deleteMessage(eMsg);
610 });
611 }
612 /* This might not be necessary any more: it was
613 initially caused by Safari being stricter than
614 other browsers on its time string input, and that
615 has since been resolved by emiting a stricter
616 format. */
617 // Date doesn't work, so dumb it down...
618 D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu"));
619 }
620 const toolbar = D.addClass(D.div(), 'toolbar');
621 D.append(this.e, toolbar);
622 const btnDeleteLocal = D.button("Delete locally");
623 D.append(toolbar, btnDeleteLocal);
624 const self = this;
625 btnDeleteLocal.addEventListener('click', function(){
626 self.hide();
627 hide();
628 Chat.deleteMessage(eMsg);
629 });
630 }
631 if(eMsg.dataset.xfrom){
632 /* Add a link to the /timeline filtered on this user. */
633 const toolbar2 = D.addClass(D.div(), 'toolbar');
634 D.append(this.e, toolbar2);
635 const timelineLink = D.attr(
636 D.a(F.repoUrl('timeline',{
637 u: eMsg.dataset.xfrom,
638 y: 'a'
639 }), "User's Timeline"),
640 'target', '_blank'
641 );
642 D.append(toolbar2, timelineLink);
643 }
644 }/*refresh()*/
645 });
646 f.popup.installHideHandlers();
647 f.popup.hide = function(){
648 delete this._eMsg;
649 D.clearElement(this.e);
650 return this.show(false);
651 };
652 }/*end static init*/
653 const rect = ev.target.getBoundingClientRect();
654 const eMsg = ev.target.parentNode/*the owning .message-widget element*/;
655 f.popup._eMsg = eMsg;
656 let x = rect.left, y = rect.topm;
657 f.popup.show(ev.target)/*so we can get its computed size*/;
658 if(eMsg.dataset.xfrom===Chat.me
659 && document.body.classList.contains('my-messages-right')){
660 // Shift popup to the left for right-aligned messages to avoid
661 // truncation off the right edge of the page.
662 const pRect = f.popup.e.getBoundingClientRect();
663 x = rect.right - pRect.width;
664 }
665 f.popup.show(x, y);
666 }/*_handleLegendClicked()*/
667 };
668 return cf;
669 })()/*MessageWidget*/;
670
671 const BlobXferState = (function(){/*drag/drop bits...*/
672 /* State for paste and drag/drop */
673 const bxs = {
674 dropDetails: document.querySelector('#chat-drop-details'),
675 blob: undefined,
676 clear: function(){
677 this.blob = undefined;
678 D.clearElement(this.dropDetails);
679 Chat.e.inputFile.value = "";
680 }
681 };
682 /** Updates the paste/drop zone with details of the pasted/dropped
683 data. The argument must be a Blob or Blob-like object (File) or
684 it can be falsy to reset/clear that state.*/
685 const updateDropZoneContent = function(blob){
686 const dd = bxs.dropDetails;
687 bxs.blob = blob;
688 D.clearElement(dd);
689 if(!blob){
690 Chat.e.inputFile.value = '';
691 return;
692 }
693 D.append(dd, "Name: ", blob.name,
694 D.br(), "Size: ",blob.size);
695 if(blob.type && blob.type.startsWith("image/")){
696 const img = D.img();
697 D.append(dd, D.br(), img);
698 const reader = new FileReader();
699 reader.onload = (e)=>img.setAttribute('src', e.target.result);
700 reader.readAsDataURL(blob);
701 }
702 const btn = D.button("Cancel");
703 D.append(dd, D.br(), btn);
704 btn.addEventListener('click', ()=>updateDropZoneContent(), false);
705 };
706 Chat.e.inputFile.addEventListener('change', function(ev){
707 updateDropZoneContent(this.files && this.files[0] ? this.files[0] : undefined)
708 });
709 /* Handle image paste from clipboard. TODO: figure out how we can
710 paste non-image binary data as if it had been selected via the
711 file selection element. */
712 document.addEventListener('paste', function(event){
713 const items = event.clipboardData.items,
714 item = items[0];
715 if(!item || !item.type) return;
716 else if('file'===item.kind){
717 updateDropZoneContent(false/*clear prev state*/);
718 updateDropZoneContent(items[0].getAsFile());
719 }
720 }, false);
721 /* Add help button for drag/drop/paste zone */
722 Chat.e.inputFile.parentNode.insertBefore(
723 F.helpButtonlets.create(
724 Chat.e.fileSelectWrapper.querySelector('.help-buttonlet')
725 ), Chat.e.inputFile
726 );
727 ////////////////////////////////////////////////////////////
728 // File drag/drop visual notification.
729 const dropHighlight = Chat.e.inputFile /* target zone */;
730 const dropEvents = {
731 drop: function(ev){
732 D.removeClass(dropHighlight, 'dragover');
733 },
734 dragenter: function(ev){
735 ev.preventDefault();
736 ev.dataTransfer.dropEffect = "copy";
737 D.addClass(dropHighlight, 'dragover');
738 },
739 dragleave: function(ev){
740 D.removeClass(dropHighlight, 'dragover');
741 },
742 dragend: function(ev){
743 D.removeClass(dropHighlight, 'dragover');
744 }
745 };
746 Object.keys(dropEvents).forEach(
747 (k)=>Chat.e.inputFile.addEventListener(k, dropEvents[k], true)
748 );
749 return bxs;
750 })()/*drag/drop*/;
751
752 const tzOffsetToString = function(off){
753 const hours = Math.round(off/60), min = Math.round(off % 30);
754 return ''+(hours + (min ? '.5' : ''));
755 };
756 const pad2 = (x)=>('0'+x).substr(-2);
757 const localTime8601 = function(d){
758 return [
759 d.getYear()+1900, '-', pad2(d.getMonth()+1), '-', pad2(d.getDate()),
760 'T', pad2(d.getHours()),':', pad2(d.getMinutes()),':',pad2(d.getSeconds())
761 ].join('');
762 };
763
764 Chat.submitMessage = function(){
765 const fd = new FormData(this.e.inputForm)
766 /* ^^^^ we don't really want/need the FORM element, but when
767 FormData() is default-constru new TEXT node with .fsize + " bytes)"
768 )
769 D.attr(a,'target','_blank'appendChild(a);
770 }
771 if(!ff.pad){
772 ff.pad,theTime(d))
773 }
774 (m.fsize>0){
775 /* We return [
776 /**
777 This file conta,
778 btnMsgHome: E1('#chat-scroll-top'),
779 btnMsgEnd: E1('#chat-scroll-bottom/**
780 This file contains the client-side implementation of fossil's /chat
781 application.
782 */
783 (function(){
784 const F = window.fossil, D = F.dom;
785 const E1 = function(selector){
786 const e = document.querySelector(selector);
787 if(!e) throw new Error("missing required DOM element: "+selector);
788 return e;
789 };
790 /**
791 Returns true if e is entirely within the bounds of the window's viewport.
792 */
793 const isEntirelyInViewport = function(e) {
794 const rect = e.getBoundingClientRect();
795 return (
796 rect.top >= 0 &&
797 rect.left >= 0 &&
798 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
799 rect.right <= (window.innerWidth || document.documentElement.clientWidth)
800 );
801 };
802
803 /**
804 Returns true if e's on-screen position vertically overlaps that
805 of element v's. Horizontal overlap is ignored (we don't need it
806 for our case).
807 */
808 const overlapsElemView = function(e,v) {
809 const r1 = e.getBoundingClientRect(),
810 r2 = v.getBoundingClientRect();
811 if(r1.top<=r2.bottom && r1.top>=r2.top) return true;
812 else if(r1.bottom<=r2.bottom && r1.bottom>=r2.top) return true;
813 return false;
814 };
815
816 (function(){
817 let dbg = document.querySelector('#debugMsg');
818 if(dbg){
819 /* This can inadvertently influence our flexbox layouts, so move
820 it out of the way. */
821 D.append(document.body,dbg);
822 }
823 })();
824 const ForceResizeKludge = 0 ? function(){} : (function f(){
825 /* Workaround for Safari mayhem regarding use of vh CSS units....
826 We tried to use vh units to set the content area size for the
827 chat lay Android,
828 causing the input area to move off-screen. */
829 if(!f.elemsToCount){
830 f.elemsToCount = [
831 document.querySelector('body > div.header'),
832 document.querySelector('body > div.mainmenu'),
833 document.querySelector('body > #hbdrop'),
834 document.querySelector('body > div.footer')
835 ];
836 f.contentArea = E1('div.content');
837 }
838 const bcl = document.body.classList;
839 const resized = function(){
840 const wh = window.innerHeight,
841 com = bcl.contains('chat-only-mode');
842 var ht;
843 var extra = 0;
844 if(com){
845 ht = wh;
846 }else{
847 f.elemsToCount.forEach((e)=>e ? extra += D.effectiveHeight(e) : false);
848 ht = wh - extra;
849 }
850 f.contentArea.style.height =
851 f.contentArea.style.maxHeight = [
852 "calc(", (ht>=100 ? ht : 100), "px",
853 " - 1em"/*fudge value*/,")"
854 /* ^^^^ hypothetically not needed, but both Chrome/FF on
855 Linux will force scrollbars on the body if this value is
856 too small (<0.75em in my tests). */
857 ].join('');
858 if(false){
859 console.debug("resized.",wh, extra, ht,
860 window.getComputedStyle(f.contentArea).maxHeight,
861 f.contentArea);
862 }
863 };
864 var doit;
865 window.addEventListener('resize',function(ev){
866 clearTimeout(doit);
867 doit = setTimeout(resized, 100);
868 }, false);
869 resized();
870 return resized;
871 })();
872 fossil.FRK = ForceResizeKludge/*for debugging*/;
873 const Chat = (function(){
874 const cs = {
875 verboseErrors: false /* if true then certain, mostly extraneous,
876 error messages may be sent to the console. */,
877 e:{/*map of certain DOM elements.*/
878 messageInjectPoint: E1('#message-inject-point'),
879 pageTitle: E1('head title'),
880 loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
881 inputWrapper: E1("#chat-input-area"),
882 fileSelectWrapper: E1('#chat-input-file-area'),
883 messagesWrapper: E1('#chat-messages-wrapper'),
884 inputForm: E1('#chat-form'),
885 btnSubmit: E1('#chat-message-submit'),
886 inputSingle: E1('#chat-input-single'),
887 inputMulti: E1('#chat-input-multi'),
888 inputCurrent: undefined/*one of inputSingle or inputMulti*/,
889 inputFile: E1('#chat-input-file'),
890 contentDiv: E1('div.content')
891 },
892 me: F.user.name,
893 mxMsg: F.config.chat.initSize ? -F.config.chat.initSize : -50,
894 mnMsg: undefined/*lowest message ID we've seen so far (for history loading)*/,
895 pageIsActive: 'visible'===document.visibilityState,
896 changesSincePageHidden: 0,
897 notificationBubbleColor: 'white',
898 totalMessageCount: 0, // total # of inbound messages
899 //! Number of messages to load for the history buttons
900 loadMessageCount: Math.abs(F.config.chat.initSize || 20),
901 ajaxInflight: 0,
902 /** Gets (no args) or sets (1 arg) the current input text field value,
903 taking into account single- vs multi-line input. The getter returns
904 a string and the setter returns this object. */
905 inputValue: function(){
906 const e = this.inputElement();
907 if(arguments.length){
908 e.value = arguments[0];
909 return this;
910 }
911 return e.value;
912 },
913 /** Asks the current user input field to take focus. Returns this. */
914 inputFocus: function(){
915 this.inputElement().focus();
916 return this;
917 },
918 /** Returns the current message input element. */
919 inputElement: function(){
920 return this.e.inputCurrent;
921 },
922 /** Toggles between single- and multi-line edit modes. Returns this. */
923 inputToggleSingleMulti: function(){
924 const old = this.e.inputCurrent;
925 if(this.e.inputCurrent === this.e.inputSingle){
926 this.e.inputCurrent = this.e.inputMulti;
927 }else{
928 this.e.inputCurrent = this.e.inputSingle;
929 }
930 const m = this.e.messagesWrapper,
931 sTop = m.scrollTop,
932 mh1 = m.clientHeight;
933 D.addClass(old, 'hidden');
934 D.removeClass(this.e.inputCurrent, 'hidden');
935 const mh2 = m.clientHeight;
936 m.scrollTo(0, sTop + (mh1-mh2));
937 this.e.inputCurrent.value = old.value;
938 old.value = '';
939 return this;
940 },
941 /**
942 If passed true or no arguments, switches to multi-line mode
943 if currently in single-line mode. If passed false, switches
944 to single-line mode if currently in multi-line mode. Returns
945 this.
946 */
947 inputMultilineMode: function(yes){
948 if(!arguments.length) yes = true;
949 if(yes && this.e.inputCurrent === this.e.inputMulti) return this;
950 else if(!yes && this.e.inputCurrent === this.e.inputSingle) return this;
951 else return this.inputToggleSingleMulti();
952 },
953 /** Enables (if yes is truthy) or disables all elements in
954 * this.disableDuringAjax. */
955 enableAjaxComponents: function(yes){
956 D[yes ? 'enable' : 'disable'](this.disableDuringAjax);
957 return this;
958 },
959 /* Must be called before any API is used which starts ajax traffic.
960 If this call represents the currently only in-flight ajax request,
961 all DOM elements in this.disableDuringAjax are disabled.
962 We cannot do this via a central API because (1) window.fetch()'s
963 Promise-based API seemingly makes that impossible and (2) the polling
964 technique holds ajax requests open for as long as possible. A call
965 to this method obligates the caller to also call ajaxEnd().
966
967 This must NOT be called forelement e as a new row end
968 of the list if atEnd is truthy the
969 list. */
970 injectMessageElem: function f(e, atEnd){
971 const mip = atEnd ? this.e.loadOlderToolbar : this.e.messageInjectPoint,
972 holder = this.e.messagesWrapper,
973 prevMessage = this.e.newestMessage;
974 if(atEnd){
975 const fe = mip.nextElementSibling;
976 if(fe) mip.parentNode.insertBefore(e, fe);
977 else D.append(mip.parentNode, e);
978 }else{
979 D.append(holder,e);
980 this.e.newestMessage = e;
981 }
982 if(!atEnd && !this._isBatchLoading
983 && e.dataset.xfrom!==this.me
984 && (prevMessage
985 ? !this.messageIsInView(prevMessage)
986 : false)){
987 /* If a new non-history message arrives while the user is
988 scrolled elsewhere, do not scroll to the latest
989 message, but gently alert the user that a new message
990 has arrived. */
991 if(!f.btnDown){
992 f.btnDown = D.button("⇣⇣⇣");
993 f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
994 }
995 F.toast.message(f.btnDown," New message has arrived.");
996 }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
997 this.scheduleScrollOfMsg(e);
998 }else if(!this._isBatchLoading){
999 /* When a message from someone else arrives, we have to
1000 figure out whether or not to scroll it into view. Ideally
1001 we'd just stuff it in the UI and let the flexbox layout
1002 DTRT, but Safari has expressed, in no uncertain terms,
1003 some disappointment with that approach, so we'll
1004 heuristicize it: if the previous last message is in view,
1005 essage input element. */
1006 top of the
1007 Kludge()list if atEnd is falsy, else at ttentTarg the load-history widge we'd just stuff it in the UI and let the flexbox layout
1008 DTRT, but Safari has expressed, in no uncertain terms,
1009 some disappointment with that approach, so we'll
1010 heuristicistyling. We cannot do this easily as
1011 messages arrive in batch mode because they can arrive out of
1012 order (they arrive, and are processed, in reverse order for
1013 the "load older messages" buttons). We do this handling in user is up readi() for "interactive" use but we'd jrecalculate them en massof messages to load for the history buttons
1014 loadMessageCount: Math.abs(F.config.chat.initSize || 20),
1015 ajaxInflight: 0,
1016 /** Gets (no args) or sets (1 arg) the current input text field value,
1017 taking into account single- vs multi-line input. The gtains t scrolled elsewhere, do not scroll to the latest
1018 message, but gently alert the user that a new message
1019 has arrived. */
1020 if(!f.btnDown){
1021 f.btnDown = D.button("⇣⇣⇣");
1022 f.btnDown.addEventListener('click',()=>this.scrollMessagesTo(1),false);
1023 }
1024 F.toast.message(f.btnDown," New message has arrived.");
1025 }else if(!this._isBatchLoading && e.dataset.xfrom===Chat.me){
1026 this.scheduleScrollOfMsg(e);
1027 }else if(!this._isBatchLoading){
1028 /* When a message from someone else arrives, we have to
1029 figure out whether or not to scroll it into view. Ideally
1030 we'd just stuff it in the UI and let the flexbox layout
1031 DTRT, but Safari has expressed, in no uncertain terms,
1032 some disappointment with that approach, so we'll
1033 heuristicize it: if the previous last message is in view,
1034 assume the user is at or near the input element and
1035 scroll this one into view. If that message is NOT in
1036 view, assume the user is up reading history somewhere and
1037 do NOT scroll because doing so would interrupt
1038 them. There are middle grounds here where the user will
1039 experience a slight UI jolt, but this heuristic mostly
1040 seems to work out okay. If there was no previous message,
1041 assume we don't have any messages yet and go ahead and
1042 scroll this message into view (noting that that scrolling
1043 is hypothetically a no-op in such cases).
1044
1045 The wrench in these works are posts with IMG tags, as
1046 those images are loaded async and the element does not
1047 yet have enough information to know how far to scroll!
1048 For such cases we have to delay the scroll until the
1049 image loads (and we hope it does so before another
1050 message arrives).
1051 */
1052 if(1===+e.dataset.hasImage){
1053 e.querySelector('img').addEventListener('load',()=>e.scrollIntoView());
1054 }else if(!prevMessage || (prevMessage && isEntirelyInViewport(prevMessage))){
1055 e.scrollIntoView(false);
1056 }
1057 }
1058 },
1059 /** Returns true if chat-only mode is enabled. */
1060 isChatOnlyMode: ()=>document.body.classList.contains('chat-only-mode'),
1061 /**
1062 Enters (if passed a truthy value or no arguments) or leaves
1063 "chat-only" mode. That mode hides the page's header and
1064 footer, leaving only the chat application visible to the
1065 user.
1066 */
1067 chatOnlyMode: function f(yes){
1068 if(undefined === f.elemsToToggle){
1069 f.elemsToToggle = [];
1070 document.querySelectorAll(
1071 ["body > div.header",
1072 "body > div.mainmenu",
1073 "body > div.footer",
1074 "#debugMsg"
1075 ].join(',')
1076 ).forEach((e)=>f.elemsToToggle.push(e));
1077 }
1078 if(!arguments.length) yes = true;
1079 if(yes === this.isChatOnlyMode()) return this;
1080 if(yes){
1081 D.addClass(f.elemsToToggle, 'hidden');
1082 D.addClass(document.body, 'chat-only-mode');
1083 document.body.scroll(0,document.body.height);
1084 }else{
1085 D.removeClass(f.elemsToToggle, 'hidden');
1086 D.removeClass(document.body, 'chat-only-mode');
1087 }
1088 ForceResizeKludge();
1089 return this;
1090 },
1091 /** Tries to scroll the message area to...
1092 <0 = top of the message list, >0 = bottom of the message list,
1093 0 == the newest message (normally the same position as >1).
1094 */
1095 scrollMessagesTo: function(where){
1096 if(where<0){
1097 Chat.e.messagesWrapper.scrollTop = 0;
1098 }else if(where>0){
1099 Chat.e.messagesWrapper.scrollTop = Chat.e.messagesWrapper.scrollHeight;
1100 }else if(Chat.e.newestMessage){
1101 Chat.e.newestMessage.scrollIntoView(false);
1102 }
1103 },
1104 togguSpan);
1105 });
1106 }
1107 };
1108 F.fetch.beforesend = ()=>cs.ajaxStart();
1109 F.fetch.aftersend = ()=>cs.ajaxEnd();
1110 cs.e.inputCurrent = cs.e.inputSingle;
1111 /* Install default settings... */
1112 Object.keys(cs.settings.defaults).forEach(function(k){
1113 const v = cs.settings.get(k,cs);
1114 if(cs===v) cs.settings.set(k,cs.settings.defaults[k]);
1115 });
1116 cutCurrent.value MessageElem(mw.e.body);
1117 mw.scrollIntoView();
1118 };
1119
1120 cs.getMessageElemById = function(id){
1121 return qs('[data-msgid="'+id+'"]');
1122 };
1123
1124 /** Finds the last .message-widget element and returns it or
1125 the undefined value if none are found. */
1126 cs.fetchLastMessageElem = function(){
1127 const msgs = document.querySelectorAll('.message-widget');
1128 var rc;
1129 if(msgs.length){
1130 rc = this.e.newestMessage = msgs[msgs.length-1];
1131 }
1132 return rc;
1133 };
1134
1135 /**
1136 LOCALLY deletes a message element by the message ID or passing
1137 the .message-row element. Returns true if it removes an element,
1138 else false.
1139 */
1140 cs.deleteMessageElem = function(id){
1141 var e;
1142 if(id instanceof HTMLElement){
1143 e = id;
1144 id = e.dataset.msgid;
1145 }else{
1146 e = this.getMessageElemById(id);
1147 }
1148 if(e && id){
1149 D.remove(e);
1150 if(e===this.e.newestMessage){
1151 this.fetchLastMessageElem();
1152 }
1153 F.toast.message("Deleted message "+id+".");
1154 }
1155 return !!e;
1156 };
1157
1158 /*
+1 -1
--- src/checkin.c
+++ src/checkin.c
@@ -1179,11 +1179,11 @@
11791179
char *zFile;
11801180
Blob reply, line;
11811181
char *zComment;
11821182
int i;
11831183
1184
- zEditor = fossil_text_editor();db_get("editor", 0);
1184
+ zEditor = fossil_text_editor();
11851185
if( zEditor==0 ){
11861186
if( blob_size(pPrompt)>0 ){
11871187
blob_append(pPrompt,
11881188
"#\n"
11891189
"# Since no default text editor is set using EDITOR or VISUAL\n"
11901190
--- src/checkin.c
+++ src/checkin.c
@@ -1179,11 +1179,11 @@
1179 char *zFile;
1180 Blob reply, line;
1181 char *zComment;
1182 int i;
1183
1184 zEditor = fossil_text_editor();db_get("editor", 0);
1185 if( zEditor==0 ){
1186 if( blob_size(pPrompt)>0 ){
1187 blob_append(pPrompt,
1188 "#\n"
1189 "# Since no default text editor is set using EDITOR or VISUAL\n"
1190
--- src/checkin.c
+++ src/checkin.c
@@ -1179,11 +1179,11 @@
1179 char *zFile;
1180 Blob reply, line;
1181 char *zComment;
1182 int i;
1183
1184 zEditor = fossil_text_editor();
1185 if( zEditor==0 ){
1186 if( blob_size(pPrompt)>0 ){
1187 blob_append(pPrompt,
1188 "#\n"
1189 "# Since no default text editor is set using EDITOR or VISUAL\n"
1190
+8 -3
--- src/checkout.c
+++ src/checkout.c
@@ -262,13 +262,18 @@
262262
** COMMAND: co*
263263
**
264264
** Usage: %fossil checkout ?VERSION | --latest? ?OPTIONS?
265265
** or: %fossil co ?VERSION | --latest? ?OPTIONS?
266266
**
267
-** Check out a version specified on the command-line. This command
268
-** will abort if there are edited files in the current checkout unless
269
-** the --force option appears on the command-line. The --keep option
267
+** NOTE: Most people use "fossil update" instead of "fossil checkout" for
268
+** day-to-day operations. If you are new to Fossil and trying to learn your
269
+** way around, it is recommended that you become familiar with the
270
+** "fossil update" command first.
271
+**
272
+** This command changes the current check-out to the version specified
273
+** as an argument. The command aborts if there are edited files in the
274
+** current checkout unless the --force option is used. The --keep option
270275
** leaves files on disk unchanged, except the manifest and manifest.uuid
271276
** files.
272277
**
273278
** The --latest flag can be used in place of VERSION to checkout the
274279
** latest version in the repository.
275280
--- src/checkout.c
+++ src/checkout.c
@@ -262,13 +262,18 @@
262 ** COMMAND: co*
263 **
264 ** Usage: %fossil checkout ?VERSION | --latest? ?OPTIONS?
265 ** or: %fossil co ?VERSION | --latest? ?OPTIONS?
266 **
267 ** Check out a version specified on the command-line. This command
268 ** will abort if there are edited files in the current checkout unless
269 ** the --force option appears on the command-line. The --keep option
 
 
 
 
 
270 ** leaves files on disk unchanged, except the manifest and manifest.uuid
271 ** files.
272 **
273 ** The --latest flag can be used in place of VERSION to checkout the
274 ** latest version in the repository.
275
--- src/checkout.c
+++ src/checkout.c
@@ -262,13 +262,18 @@
262 ** COMMAND: co*
263 **
264 ** Usage: %fossil checkout ?VERSION | --latest? ?OPTIONS?
265 ** or: %fossil co ?VERSION | --latest? ?OPTIONS?
266 **
267 ** NOTE: Most people use "fossil update" instead of "fossil checkout" for
268 ** day-to-day operations. If you are new to Fossil and trying to learn your
269 ** way around, it is recommended that you become familiar with the
270 ** "fossil update" command first.
271 **
272 ** This command changes the current check-out to the version specified
273 ** as an argument. The command aborts if there are edited files in the
274 ** current checkout unless the --force option is used. The --keep option
275 ** leaves files on disk unchanged, except the manifest and manifest.uuid
276 ** files.
277 **
278 ** The --latest flag can be used in place of VERSION to checkout the
279 ** latest version in the repository.
280
+1 -1
--- src/clone.c
+++ src/clone.c
@@ -422,7 +422,7 @@
422422
@ <p>Clone the repository using this command:
423423
@ <blockquote><pre>
424424
@ fossil clone %s(g.zBaseURL) %h(zNm).fossil
425425
@ </pre></blockquote>
426426
}
427
- style_finish_page("download");
427
+ style_finish_page();
428428
}
429429
--- src/clone.c
+++ src/clone.c
@@ -422,7 +422,7 @@
422 @ <p>Clone the repository using this command:
423 @ <blockquote><pre>
424 @ fossil clone %s(g.zBaseURL) %h(zNm).fossil
425 @ </pre></blockquote>
426 }
427 style_finish_page("download");
428 }
429
--- src/clone.c
+++ src/clone.c
@@ -422,7 +422,7 @@
422 @ <p>Clone the repository using this command:
423 @ <blockquote><pre>
424 @ fossil clone %s(g.zBaseURL) %h(zNm).fossil
425 @ </pre></blockquote>
426 }
427 style_finish_page();
428 }
429
+1 -1
--- src/cookies.c
+++ src/cookies.c
@@ -225,7 +225,7 @@
225225
@ <li>Raw cookie value: "%h(PD("fossil_display_settings",""))"
226226
for(i=0; i<cookies.nParam; i++){
227227
@ <li>%h(cookies.aParam[i].zPName): "%h(cookies.aParam[i].zPValue)"
228228
}
229229
@ </ul>
230
- style_finish_page("cookies");
230
+ style_finish_page();
231231
}
232232
--- src/cookies.c
+++ src/cookies.c
@@ -225,7 +225,7 @@
225 @ <li>Raw cookie value: "%h(PD("fossil_display_settings",""))"
226 for(i=0; i<cookies.nParam; i++){
227 @ <li>%h(cookies.aParam[i].zPName): "%h(cookies.aParam[i].zPValue)"
228 }
229 @ </ul>
230 style_finish_page("cookies");
231 }
232
--- src/cookies.c
+++ src/cookies.c
@@ -225,7 +225,7 @@
225 @ <li>Raw cookie value: "%h(PD("fossil_display_settings",""))"
226 for(i=0; i<cookies.nParam; i++){
227 @ <li>%h(cookies.aParam[i].zPName): "%h(cookies.aParam[i].zPValue)"
228 }
229 @ </ul>
230 style_finish_page();
231 }
232
+2 -2
--- src/db.c
+++ src/db.c
@@ -2767,11 +2767,11 @@
27672767
int db_sql_trace(unsigned m, void *notUsed, void *pP, void *pX){
27682768
sqlite3_stmt *pStmt = (sqlite3_stmt*)pP;
27692769
char *zSql;
27702770
int n;
27712771
const char *zArg = (const char*)pX;
2772
- char zEnd[40];
2772
+ char zEnd[100];
27732773
if( m & SQLITE_TRACE_CLOSE ){
27742774
/* If we are tracking closes, that means we want to clean up static
27752775
** prepared statements. */
27762776
while( db.pAllStmt ){
27772777
db_finalize(db.pAllStmt);
@@ -3996,11 +3996,11 @@
39963996
** This is the number of seconds that a check-in lock will be held on
39973997
** the server before the lock expires. The default is a 60-second delay.
39983998
** Set this value to zero to disable the check-in lock mechanism.
39993999
**
40004000
** This value should be set on the server to which users auto-sync
4001
-** their work. This setting has no affect on client repositories. The
4001
+** their work. This setting has no effect on client repositories. The
40024002
** check-in lock mechanism is only effective if all users are auto-syncing
40034003
** to the same server.
40044004
**
40054005
** Check-in locks are an advisory mechanism designed to help prevent
40064006
** accidental forks due to a check-in race in installations where many
40074007
--- src/db.c
+++ src/db.c
@@ -2767,11 +2767,11 @@
2767 int db_sql_trace(unsigned m, void *notUsed, void *pP, void *pX){
2768 sqlite3_stmt *pStmt = (sqlite3_stmt*)pP;
2769 char *zSql;
2770 int n;
2771 const char *zArg = (const char*)pX;
2772 char zEnd[40];
2773 if( m & SQLITE_TRACE_CLOSE ){
2774 /* If we are tracking closes, that means we want to clean up static
2775 ** prepared statements. */
2776 while( db.pAllStmt ){
2777 db_finalize(db.pAllStmt);
@@ -3996,11 +3996,11 @@
3996 ** This is the number of seconds that a check-in lock will be held on
3997 ** the server before the lock expires. The default is a 60-second delay.
3998 ** Set this value to zero to disable the check-in lock mechanism.
3999 **
4000 ** This value should be set on the server to which users auto-sync
4001 ** their work. This setting has no affect on client repositories. The
4002 ** check-in lock mechanism is only effective if all users are auto-syncing
4003 ** to the same server.
4004 **
4005 ** Check-in locks are an advisory mechanism designed to help prevent
4006 ** accidental forks due to a check-in race in installations where many
4007
--- src/db.c
+++ src/db.c
@@ -2767,11 +2767,11 @@
2767 int db_sql_trace(unsigned m, void *notUsed, void *pP, void *pX){
2768 sqlite3_stmt *pStmt = (sqlite3_stmt*)pP;
2769 char *zSql;
2770 int n;
2771 const char *zArg = (const char*)pX;
2772 char zEnd[100];
2773 if( m & SQLITE_TRACE_CLOSE ){
2774 /* If we are tracking closes, that means we want to clean up static
2775 ** prepared statements. */
2776 while( db.pAllStmt ){
2777 db_finalize(db.pAllStmt);
@@ -3996,11 +3996,11 @@
3996 ** This is the number of seconds that a check-in lock will be held on
3997 ** the server before the lock expires. The default is a 60-second delay.
3998 ** Set this value to zero to disable the check-in lock mechanism.
3999 **
4000 ** This value should be set on the server to which users auto-sync
4001 ** their work. This setting has no effect on client repositories. The
4002 ** check-in lock mechanism is only effective if all users are auto-syncing
4003 ** to the same server.
4004 **
4005 ** Check-in locks are an advisory mechanism designed to help prevent
4006 ** accidental forks due to a check-in race in installations where many
4007
+303 -2
--- src/default.css
+++ src/default.css
@@ -1261,17 +1261,22 @@
12611261
z-index: 19/*below default skin's hamburger popup*/;
12621262
box-shadow: -0.15em 0.15em 0.2em rgba(0, 0, 0, 0.75);
12631263
background-color: inherit;
12641264
color: inherit;
12651265
}
1266
-
1266
+.fossil-PopupWidget {
1267
+ /* This class is ALWAYS set on every fossil.PopupWidget instance, in
1268
+ addition to client/app-configured classes. It should not get any
1269
+ style - it is only used for DOM element selecting/filtering
1270
+ purposes. */
1271
+}
12671272
.fossil-toast-message {
12681273
/* "toast"-style popup message.
12691274
See fossil.popupwidget:toast() */
12701275
position: absolute;
12711276
display: block;
1272
- z-index: 101;
1277
+ z-index: 1001;
12731278
text-align: left;
12741279
padding: 0.15em 0.5em;
12751280
margin: 0;
12761281
font-size: 1em;
12771282
border-width: 1px;
@@ -1461,5 +1466,301 @@
14611466
position: absolute !important;
14621467
opacity: 0 !important;
14631468
pointer-events: none !important;
14641469
display: none !important;
14651470
}
1471
+
1472
+/* Chat-related */
1473
+body.chat span.at-name { /* for @USERNAME references */
1474
+ text-decoration: underline;
1475
+ font-weight: bold;
1476
+}
1477
+/* A wrapper for a single single chat message (one row of the UI) */
1478
+body.chat .message-widget {
1479
+ margin-bottom: 0.75em;
1480
+ border: none;
1481
+ display: flex;
1482
+ flex-direction: column;
1483
+ border: none;
1484
+ align-items: flex-start;
1485
+}
1486
+body.chat.my-messages-right .message-widget.mine {
1487
+ /* Right-aligns a user's own chat messages, similar to how
1488
+ most mobile messaging apps do it. */
1489
+ align-items: flex-end;
1490
+}
1491
+body.chat.my-messages-right .message-widget.notification {
1492
+ /* Center-aligns a system-level notification message. */
1493
+ align-items: center;
1494
+}
1495
+/* The content area of a message. */
1496
+body.chat .message-widget-content {
1497
+ display: inline-block;
1498
+ border-radius: 0.25em;
1499
+ border: 1px solid rgba(0,0,0,0.2);
1500
+ box-shadow: 0.2em 0.2em 0.2em rgba(0, 0, 0, 0.29);
1501
+ padding: 0.25em 0.5em;
1502
+ margin-top: 0;
1503
+ min-width: 9em /*avoid unsightly "underlap" with the neighboring
1504
+ .message-widget-tab element*/;
1505
+ white-space: pre-wrap/*needed for multi-line edits*/;
1506
+}
1507
+body.chat.monospace-messages .message-widget-content,
1508
+body.chat.monospace-messages textarea,
1509
+body.chat.monospace-messages input[type=text]{
1510
+ font-family: monospace;
1511
+}
1512
+/* User name and timestamp (a LEGEND-like element) */
1513
+body.chat .message-widget .message-widget-tab {
1514
+ border-radius: 0.25em 0.25em 0 0;
1515
+ margin: 0 0.25em 0em 0.15em;
1516
+ padding: 0 0.5em 0.15em 0.5em;
1517
+ cursor: pointer;
1518
+ white-space: nowrap;
1519
+}
1520
+body.chat .fossil-tooltip.help-buttonlet-content {
1521
+ font-size: 80%;
1522
+}
1523
+/* The popup element for displaying message timestamps
1524
+ and deletion controls. */
1525
+body.chat .chat-message-popup {
1526
+ font-family: monospace;
1527
+ font-size: 0.8em;
1528
+ text-align: left;
1529
+ display: flex;
1530
+ flex-direction: column;
1531
+ align-items: stretch;
1532
+ padding: 0.25em;
1533
+ z-index: 200;
1534
+}
1535
+/* Full message timestamps. */
1536
+body.chat .chat-message-popup > span { white-space: nowrap; }
1537
+/* Container for the message deletion buttons. */
1538
+body.chat .chat-message-popup > .toolbar {
1539
+ padding: 0.2em;
1540
+ margin: 0;
1541
+ border: 2px inset rgba(0,0,0,0.3);
1542
+ border-radius: 0.25em;
1543
+ display: flex;
1544
+ flex-direction: row;
1545
+ justify-content: stretch;
1546
+ flex-wrap: wrap;
1547
+}
1548
+body.chat .chat-message-popup > .toolbar > button {
1549
+ flex: 1 1 auto;
1550
+}
1551
+/* The widget for loading more/older chat messages. */
1552
+body.chat #load-msg-toolbar {
1553
+ border-radius: 0.25em;
1554
+ padding: 0.1em 0.2em;
1555
+ margin-bottom: 1em;
1556
+}
1557
+/* .all-done is set when chat has loaded all of the available
1558
+ historical messages */
1559
+body.chat #load-msg-toolbar.all-done {
1560
+ opacity: 0.5;
1561
+}
1562
+body.chat #load-msg-toolbar > div {
1563
+ display: flex;
1564
+ flex-direction: row;
1565
+ justify-content: stretch;
1566
+ flex-wrap: wrap;
1567
+}
1568
+body.chat #load-msg-toolbar > div > button {
1569
+ flex: 1 1 auto;
1570
+}
1571
+
1572
+/* An icon element intended for use as a button/menu for
1573
+ accessing app-specific settings. */
1574
+.settings-icon {
1575
+ /* Icon source: https://de.wikipedia.org/wiki/Datei:OOjs_UI_icon_settings.svg
1576
+ MIT License. */
1577
+ background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg \
1578
+xmlns='http://www.w3.org/2000/svg' width='24' height='24' \
1579
+viewBox='0, 0, 24, 24'%3e%3cg id='settings'%3e%3cpath id='gear' \
1580
+d='M3 4h3v2h-3zM12 4h9v2h-9zM8 3h2c.552 0 1 .448 1 1v2c0 .552-.448 1-1 1h-2c-.552 \
1581
+0-1-.448-1-1v-2c0-.552.448-1 1-1zM3 11h9v2h-9zM18 11h3v2h-3zM14 10h2c.552 0 1 .448 \
1582
+1 1v2c0 .552-.448 1-1 1h-2c-.552 0-1-.448-1-1v-2c0-.552.448-1 1-1zM3 18h6v2h-6zM15 \
1583
+18h6v2h-6zM11 17h2c.552 0 1 .448 1 1v2c0 .552-.448 1-1 1h-2c-.552 \
1584
+0-1-.448-1-1v-2c0-.552.448-1 1-1z'/%3e%3c/g%3e%3c/svg%3e");
1585
+ background-repeat: no-repeat;
1586
+ background-position: center;
1587
+ display: inline-block;
1588
+ min-height: 1em;
1589
+ max-height: 1em;
1590
+ min-width: 1em;
1591
+ max-width: 1em;
1592
+ margin: 0;
1593
+ padding: 0.2em/*needed to avoid image truncation*/;
1594
+ border: 1px solid rgba(0,0,0,0.0)/*avoid resize when hover style kicks in*/;
1595
+ cursor: pointer;
1596
+ border-radius: 0.25em;
1597
+}
1598
+.settings-icon:hover {
1599
+ border: 1px outset rgba(127,127,127,1);
1600
+}
1601
+body.fossil-dark-style .settings-icon {
1602
+ filter: invert(100%);
1603
+}
1604
+/* "Chat-only mode" hides the site header/footer, showing only
1605
+ the chat app. */
1606
+body.chat.chat-only-mode{}
1607
+body.chat #chat-settings-button {}
1608
+/** Popup widget for the /chat settings. */
1609
+body.chat .chat-settings-popup {
1610
+ font-size: 0.8em;
1611
+ text-align: left;
1612
+ display: flex;
1613
+ flex-direction: column;
1614
+ align-items: stretch;
1615
+ padding: 0.25em;
1616
+ z-index: 200;
1617
+}
1618
+body.chat .chat-settings-popup > span {
1619
+ vertical-align: middle;
1620
+}
1621
+body.chat .chat-settings-popup > span.menu-entry{
1622
+ white-space: nowrap;
1623
+ cursor: pointer;
1624
+ border: 1px solid;
1625
+ border-radius: 0.25em;
1626
+ padding: 0.25em 0.5em;
1627
+ display: flex;
1628
+ flex-direction: row;
1629
+ align-items: center;
1630
+ justify-content: space-between;
1631
+}
1632
+body.chat .chat-settings-popup > span.menu-entry:hover {
1633
+}
1634
+body.chat .chat-settings-popup > span.menu-entry > .help-buttonlet {
1635
+ vertical-align: middle;
1636
+}
1637
+body.chat .chat-settings-popup > span.menu-entry > span.button {
1638
+ margin: 0.25em 0.2em;
1639
+ padding: 0.25em;
1640
+ flex: 1 1 auto/*eliminates dead no-click zones on the right*/;
1641
+}
1642
+body.chat .chat-settings-popup > span.menu-entry > input[type=checkbox] {
1643
+ cursor: inherit;
1644
+}
1645
+body.chat .chat-settings-popup > select.menu-entry {
1646
+ flex: 1 1 auto;
1647
+ padding: 0;
1648
+ cursor: pointer;
1649
+ min-height: 2.5em;
1650
+ border-radius: 0.25em;
1651
+}
1652
+body.chat .chat-settings-popup > select.menu-entry > option {
1653
+ /*Recall that many browsers don't allow styling of OPTION
1654
+ elements, or allow only very limited styling.*/
1655
+}
1656
+
1657
+/** Container for the list of /chat messages. */
1658
+body.chat #chat-messages-wrapper {
1659
+ overflow: auto;
1660
+ /*max-height: 800em*//*will be re-calc'd in JS*/;
1661
+ flex: 2 1 auto;
1662
+}
1663
+body.chat #chat-messages-wrapper.loading > * {
1664
+ /* An attempt at reducing flicker when loading lots of messages. */
1665
+ visibility: hidden;
1666
+}
1667
+body.chat div.content {
1668
+ margin: 0;
1669
+ padding: 0;
1670
+ display: flex;
1671
+ flex-direction: column-reverse;
1672
+ /* ^^^^ In order to get good automatic scrolling of new messages on
1673
+ the BOTTOM in bottom-up chat mode, such that they scroll up
1674
+ instead of down, we have to use column-reverse layout, which
1675
+ changes #chat-messages-wrapper's "gravity" for purposes of
1676
+ scrolling! If we instead use flex-direction:column then each new
1677
+ message pushes #chat-input-area down further off the screen!
1678
+ */
1679
+ align-items: stretch;
1680
+}
1681
+/* Wrapper for /chat user input controls */
1682
+body.chat #chat-input-area {
1683
+ display: flex;
1684
+ flex-direction: column;
1685
+ padding: 0.5em 1em;
1686
+ border-bottom: none;
1687
+ border-top: 1px solid black;
1688
+ margin: 0.5em 1em 0 1em;
1689
+ position: initial /*sticky currently disabled due to scrolling-related issues*/;
1690
+ bottom: 0;
1691
+}
1692
+body.chat:not(.chat-only-mode) #chat-input-area{
1693
+ /* Safari user reports that 2em is necessary to keep the file selection
1694
+ widget from overlapping the page footer, whereas a margin of 0 is fine
1695
+ for FF/Chrome (and 2em is a *huge* waste of space for those). */
1696
+ margin-bottom: 0;
1697
+}
1698
+
1699
+/* Widget holding the chat message input field, send button, and
1700
+ settings button. */
1701
+body.chat #chat-input-line {
1702
+ display: flex;
1703
+ flex-direction: row;
1704
+ margin-bottom: 0.25em;
1705
+ align-items: self-start;
1706
+}
1707
+body.chat #chat-input-line > input[type=submit],
1708
+body.chat #chat-input-line > #chat-settings-button,
1709
+body.chat #chat-input-line > button {
1710
+ flex: 1 5 auto;
1711
+ max-width: 6em;
1712
+ margin: 0 0.25em;
1713
+}
1714
+body.chat #chat-input-line > button {
1715
+ max-width: 4em;
1716
+}
1717
+body.chat #chat-input-line > #chat-settings-button{
1718
+ margin: 0 0 0 0.25em;
1719
+ max-width: 2em;
1720
+}
1721
+body.chat #chat-input-line > input[type=text],
1722
+body.chat #chat-input-line > textarea {
1723
+ flex: 5 1 auto;
1724
+}
1725
+/* Widget holding the file selection control and preview */
1726
+body.chat #chat-input-file-area {
1727
+ display: flex;
1728
+ flex-direction: row;
1729
+ align-items: center;
1730
+ flex-wrap: wrap;
1731
+}
1732
+body.chat #chat-input-file-area > .file-selection-wrapper {
1733
+ align-self: flex-start;
1734
+ margin-right: 0.5em;
1735
+ flex: 0 1 auto;
1736
+ padding: 0.25em 0.25em 0.25em 0;
1737
+}
1738
+body.chat #chat-input-file-area .file-selection-wrapper > * {
1739
+ vertical-align: middle;
1740
+ margin: 0;
1741
+}
1742
+body.chat #chat-input-file {
1743
+ border:1px solid rgba(0,0,0,0);/*avoid UI shift during drop-targeting*/
1744
+ border-radius: 0.25em;
1745
+ padding: 0.25em;
1746
+}
1747
+body.chat #chat-input-file > input {
1748
+ flex: 1 0 auto;
1749
+}
1750
+/* Indicator when a drag/drop is in progress */
1751
+body.chat #chat-input-file.dragover {
1752
+ border: 1px dashed green;
1753
+}
1754
+/* Widget holding the details of a selected/dropped file/image. */
1755
+body.chat #chat-drop-details {
1756
+ flex: 0 1 auto;
1757
+ padding: 0.5em 1em;
1758
+ margin-left: 0.5em;
1759
+ white-space: pre;
1760
+ font-family: monospace;
1761
+}
1762
+
1763
+body.chat #chat-drop-details img {
1764
+ max-width: 45%;
1765
+ max-height: 45%;
1766
+}
14661767
--- src/default.css
+++ src/default.css
@@ -1261,17 +1261,22 @@
1261 z-index: 19/*below default skin's hamburger popup*/;
1262 box-shadow: -0.15em 0.15em 0.2em rgba(0, 0, 0, 0.75);
1263 background-color: inherit;
1264 color: inherit;
1265 }
1266
 
 
 
 
 
1267 .fossil-toast-message {
1268 /* "toast"-style popup message.
1269 See fossil.popupwidget:toast() */
1270 position: absolute;
1271 display: block;
1272 z-index: 101;
1273 text-align: left;
1274 padding: 0.15em 0.5em;
1275 margin: 0;
1276 font-size: 1em;
1277 border-width: 1px;
@@ -1461,5 +1466,301 @@
1461 position: absolute !important;
1462 opacity: 0 !important;
1463 pointer-events: none !important;
1464 display: none !important;
1465 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1466
--- src/default.css
+++ src/default.css
@@ -1261,17 +1261,22 @@
1261 z-index: 19/*below default skin's hamburger popup*/;
1262 box-shadow: -0.15em 0.15em 0.2em rgba(0, 0, 0, 0.75);
1263 background-color: inherit;
1264 color: inherit;
1265 }
1266 .fossil-PopupWidget {
1267 /* This class is ALWAYS set on every fossil.PopupWidget instance, in
1268 addition to client/app-configured classes. It should not get any
1269 style - it is only used for DOM element selecting/filtering
1270 purposes. */
1271 }
1272 .fossil-toast-message {
1273 /* "toast"-style popup message.
1274 See fossil.popupwidget:toast() */
1275 position: absolute;
1276 display: block;
1277 z-index: 1001;
1278 text-align: left;
1279 padding: 0.15em 0.5em;
1280 margin: 0;
1281 font-size: 1em;
1282 border-width: 1px;
@@ -1461,5 +1466,301 @@
1466 position: absolute !important;
1467 opacity: 0 !important;
1468 pointer-events: none !important;
1469 display: none !important;
1470 }
1471
1472 /* Chat-related */
1473 body.chat span.at-name { /* for @USERNAME references */
1474 text-decoration: underline;
1475 font-weight: bold;
1476 }
1477 /* A wrapper for a single single chat message (one row of the UI) */
1478 body.chat .message-widget {
1479 margin-bottom: 0.75em;
1480 border: none;
1481 display: flex;
1482 flex-direction: column;
1483 border: none;
1484 align-items: flex-start;
1485 }
1486 body.chat.my-messages-right .message-widget.mine {
1487 /* Right-aligns a user's own chat messages, similar to how
1488 most mobile messaging apps do it. */
1489 align-items: flex-end;
1490 }
1491 body.chat.my-messages-right .message-widget.notification {
1492 /* Center-aligns a system-level notification message. */
1493 align-items: center;
1494 }
1495 /* The content area of a message. */
1496 body.chat .message-widget-content {
1497 display: inline-block;
1498 border-radius: 0.25em;
1499 border: 1px solid rgba(0,0,0,0.2);
1500 box-shadow: 0.2em 0.2em 0.2em rgba(0, 0, 0, 0.29);
1501 padding: 0.25em 0.5em;
1502 margin-top: 0;
1503 min-width: 9em /*avoid unsightly "underlap" with the neighboring
1504 .message-widget-tab element*/;
1505 white-space: pre-wrap/*needed for multi-line edits*/;
1506 }
1507 body.chat.monospace-messages .message-widget-content,
1508 body.chat.monospace-messages textarea,
1509 body.chat.monospace-messages input[type=text]{
1510 font-family: monospace;
1511 }
1512 /* User name and timestamp (a LEGEND-like element) */
1513 body.chat .message-widget .message-widget-tab {
1514 border-radius: 0.25em 0.25em 0 0;
1515 margin: 0 0.25em 0em 0.15em;
1516 padding: 0 0.5em 0.15em 0.5em;
1517 cursor: pointer;
1518 white-space: nowrap;
1519 }
1520 body.chat .fossil-tooltip.help-buttonlet-content {
1521 font-size: 80%;
1522 }
1523 /* The popup element for displaying message timestamps
1524 and deletion controls. */
1525 body.chat .chat-message-popup {
1526 font-family: monospace;
1527 font-size: 0.8em;
1528 text-align: left;
1529 display: flex;
1530 flex-direction: column;
1531 align-items: stretch;
1532 padding: 0.25em;
1533 z-index: 200;
1534 }
1535 /* Full message timestamps. */
1536 body.chat .chat-message-popup > span { white-space: nowrap; }
1537 /* Container for the message deletion buttons. */
1538 body.chat .chat-message-popup > .toolbar {
1539 padding: 0.2em;
1540 margin: 0;
1541 border: 2px inset rgba(0,0,0,0.3);
1542 border-radius: 0.25em;
1543 display: flex;
1544 flex-direction: row;
1545 justify-content: stretch;
1546 flex-wrap: wrap;
1547 }
1548 body.chat .chat-message-popup > .toolbar > button {
1549 flex: 1 1 auto;
1550 }
1551 /* The widget for loading more/older chat messages. */
1552 body.chat #load-msg-toolbar {
1553 border-radius: 0.25em;
1554 padding: 0.1em 0.2em;
1555 margin-bottom: 1em;
1556 }
1557 /* .all-done is set when chat has loaded all of the available
1558 historical messages */
1559 body.chat #load-msg-toolbar.all-done {
1560 opacity: 0.5;
1561 }
1562 body.chat #load-msg-toolbar > div {
1563 display: flex;
1564 flex-direction: row;
1565 justify-content: stretch;
1566 flex-wrap: wrap;
1567 }
1568 body.chat #load-msg-toolbar > div > button {
1569 flex: 1 1 auto;
1570 }
1571
1572 /* An icon element intended for use as a button/menu for
1573 accessing app-specific settings. */
1574 .settings-icon {
1575 /* Icon source: https://de.wikipedia.org/wiki/Datei:OOjs_UI_icon_settings.svg
1576 MIT License. */
1577 background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg \
1578 xmlns='http://www.w3.org/2000/svg' width='24' height='24' \
1579 viewBox='0, 0, 24, 24'%3e%3cg id='settings'%3e%3cpath id='gear' \
1580 d='M3 4h3v2h-3zM12 4h9v2h-9zM8 3h2c.552 0 1 .448 1 1v2c0 .552-.448 1-1 1h-2c-.552 \
1581 0-1-.448-1-1v-2c0-.552.448-1 1-1zM3 11h9v2h-9zM18 11h3v2h-3zM14 10h2c.552 0 1 .448 \
1582 1 1v2c0 .552-.448 1-1 1h-2c-.552 0-1-.448-1-1v-2c0-.552.448-1 1-1zM3 18h6v2h-6zM15 \
1583 18h6v2h-6zM11 17h2c.552 0 1 .448 1 1v2c0 .552-.448 1-1 1h-2c-.552 \
1584 0-1-.448-1-1v-2c0-.552.448-1 1-1z'/%3e%3c/g%3e%3c/svg%3e");
1585 background-repeat: no-repeat;
1586 background-position: center;
1587 display: inline-block;
1588 min-height: 1em;
1589 max-height: 1em;
1590 min-width: 1em;
1591 max-width: 1em;
1592 margin: 0;
1593 padding: 0.2em/*needed to avoid image truncation*/;
1594 border: 1px solid rgba(0,0,0,0.0)/*avoid resize when hover style kicks in*/;
1595 cursor: pointer;
1596 border-radius: 0.25em;
1597 }
1598 .settings-icon:hover {
1599 border: 1px outset rgba(127,127,127,1);
1600 }
1601 body.fossil-dark-style .settings-icon {
1602 filter: invert(100%);
1603 }
1604 /* "Chat-only mode" hides the site header/footer, showing only
1605 the chat app. */
1606 body.chat.chat-only-mode{}
1607 body.chat #chat-settings-button {}
1608 /** Popup widget for the /chat settings. */
1609 body.chat .chat-settings-popup {
1610 font-size: 0.8em;
1611 text-align: left;
1612 display: flex;
1613 flex-direction: column;
1614 align-items: stretch;
1615 padding: 0.25em;
1616 z-index: 200;
1617 }
1618 body.chat .chat-settings-popup > span {
1619 vertical-align: middle;
1620 }
1621 body.chat .chat-settings-popup > span.menu-entry{
1622 white-space: nowrap;
1623 cursor: pointer;
1624 border: 1px solid;
1625 border-radius: 0.25em;
1626 padding: 0.25em 0.5em;
1627 display: flex;
1628 flex-direction: row;
1629 align-items: center;
1630 justify-content: space-between;
1631 }
1632 body.chat .chat-settings-popup > span.menu-entry:hover {
1633 }
1634 body.chat .chat-settings-popup > span.menu-entry > .help-buttonlet {
1635 vertical-align: middle;
1636 }
1637 body.chat .chat-settings-popup > span.menu-entry > span.button {
1638 margin: 0.25em 0.2em;
1639 padding: 0.25em;
1640 flex: 1 1 auto/*eliminates dead no-click zones on the right*/;
1641 }
1642 body.chat .chat-settings-popup > span.menu-entry > input[type=checkbox] {
1643 cursor: inherit;
1644 }
1645 body.chat .chat-settings-popup > select.menu-entry {
1646 flex: 1 1 auto;
1647 padding: 0;
1648 cursor: pointer;
1649 min-height: 2.5em;
1650 border-radius: 0.25em;
1651 }
1652 body.chat .chat-settings-popup > select.menu-entry > option {
1653 /*Recall that many browsers don't allow styling of OPTION
1654 elements, or allow only very limited styling.*/
1655 }
1656
1657 /** Container for the list of /chat messages. */
1658 body.chat #chat-messages-wrapper {
1659 overflow: auto;
1660 /*max-height: 800em*//*will be re-calc'd in JS*/;
1661 flex: 2 1 auto;
1662 }
1663 body.chat #chat-messages-wrapper.loading > * {
1664 /* An attempt at reducing flicker when loading lots of messages. */
1665 visibility: hidden;
1666 }
1667 body.chat div.content {
1668 margin: 0;
1669 padding: 0;
1670 display: flex;
1671 flex-direction: column-reverse;
1672 /* ^^^^ In order to get good automatic scrolling of new messages on
1673 the BOTTOM in bottom-up chat mode, such that they scroll up
1674 instead of down, we have to use column-reverse layout, which
1675 changes #chat-messages-wrapper's "gravity" for purposes of
1676 scrolling! If we instead use flex-direction:column then each new
1677 message pushes #chat-input-area down further off the screen!
1678 */
1679 align-items: stretch;
1680 }
1681 /* Wrapper for /chat user input controls */
1682 body.chat #chat-input-area {
1683 display: flex;
1684 flex-direction: column;
1685 padding: 0.5em 1em;
1686 border-bottom: none;
1687 border-top: 1px solid black;
1688 margin: 0.5em 1em 0 1em;
1689 position: initial /*sticky currently disabled due to scrolling-related issues*/;
1690 bottom: 0;
1691 }
1692 body.chat:not(.chat-only-mode) #chat-input-area{
1693 /* Safari user reports that 2em is necessary to keep the file selection
1694 widget from overlapping the page footer, whereas a margin of 0 is fine
1695 for FF/Chrome (and 2em is a *huge* waste of space for those). */
1696 margin-bottom: 0;
1697 }
1698
1699 /* Widget holding the chat message input field, send button, and
1700 settings button. */
1701 body.chat #chat-input-line {
1702 display: flex;
1703 flex-direction: row;
1704 margin-bottom: 0.25em;
1705 align-items: self-start;
1706 }
1707 body.chat #chat-input-line > input[type=submit],
1708 body.chat #chat-input-line > #chat-settings-button,
1709 body.chat #chat-input-line > button {
1710 flex: 1 5 auto;
1711 max-width: 6em;
1712 margin: 0 0.25em;
1713 }
1714 body.chat #chat-input-line > button {
1715 max-width: 4em;
1716 }
1717 body.chat #chat-input-line > #chat-settings-button{
1718 margin: 0 0 0 0.25em;
1719 max-width: 2em;
1720 }
1721 body.chat #chat-input-line > input[type=text],
1722 body.chat #chat-input-line > textarea {
1723 flex: 5 1 auto;
1724 }
1725 /* Widget holding the file selection control and preview */
1726 body.chat #chat-input-file-area {
1727 display: flex;
1728 flex-direction: row;
1729 align-items: center;
1730 flex-wrap: wrap;
1731 }
1732 body.chat #chat-input-file-area > .file-selection-wrapper {
1733 align-self: flex-start;
1734 margin-right: 0.5em;
1735 flex: 0 1 auto;
1736 padding: 0.25em 0.25em 0.25em 0;
1737 }
1738 body.chat #chat-input-file-area .file-selection-wrapper > * {
1739 vertical-align: middle;
1740 margin: 0;
1741 }
1742 body.chat #chat-input-file {
1743 border:1px solid rgba(0,0,0,0);/*avoid UI shift during drop-targeting*/
1744 border-radius: 0.25em;
1745 padding: 0.25em;
1746 }
1747 body.chat #chat-input-file > input {
1748 flex: 1 0 auto;
1749 }
1750 /* Indicator when a drag/drop is in progress */
1751 body.chat #chat-input-file.dragover {
1752 border: 1px dashed green;
1753 }
1754 /* Widget holding the details of a selected/dropped file/image. */
1755 body.chat #chat-drop-details {
1756 flex: 0 1 auto;
1757 padding: 0.5em 1em;
1758 margin-left: 0.5em;
1759 white-space: pre;
1760 font-family: monospace;
1761 }
1762
1763 body.chat #chat-drop-details img {
1764 max-width: 45%;
1765 max-height: 45%;
1766 }
1767
--- src/descendants.c
+++ src/descendants.c
@@ -382,11 +382,11 @@
382382
"%s"
383383
" AND event.objid IN (SELECT rid FROM leaves)"
384384
" ORDER BY event.mtime DESC",
385385
timeline_query_for_tty()
386386
);
387
- print_timeline(&q, 0, width, 0);
387
+ print_timeline(&q, 0, width, 0, 0);
388388
db_finalize(&q);
389389
}
390390
391391
/*
392392
** COMMAND: leaves*
@@ -561,10 +561,11 @@
561561
}
562562
if( showClosed || showAll ){
563563
style_submenu_element("Open", "%s", url_render(&url, 0, 0, 0, 0));
564564
}
565565
url_reset(&url);
566
+ style_set_current_feature("leaves");
566567
style_header("Leaves");
567568
login_anonymous_available();
568569
timeline_ss_submenu();
569570
cookie_render();
570571
#if 0
@@ -613,11 +614,11 @@
613614
if( fBrBg ) tmFlags |= TIMELINE_BRCOLOR;
614615
if( fUBg ) tmFlags |= TIMELINE_UCOLOR;
615616
www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0);
616617
db_finalize(&q);
617618
@ <br />
618
- style_finish_page("leaves");
619
+ style_finish_page();
619620
}
620621
621622
#if INTERFACE
622623
/* Flag parameters to compute_uses_file() */
623624
#define USESFILE_DELETE 0x01 /* Include the check-ins where file deleted */
624625
--- src/descendants.c
+++ src/descendants.c
@@ -382,11 +382,11 @@
382 "%s"
383 " AND event.objid IN (SELECT rid FROM leaves)"
384 " ORDER BY event.mtime DESC",
385 timeline_query_for_tty()
386 );
387 print_timeline(&q, 0, width, 0);
388 db_finalize(&q);
389 }
390
391 /*
392 ** COMMAND: leaves*
@@ -561,10 +561,11 @@
561 }
562 if( showClosed || showAll ){
563 style_submenu_element("Open", "%s", url_render(&url, 0, 0, 0, 0));
564 }
565 url_reset(&url);
 
566 style_header("Leaves");
567 login_anonymous_available();
568 timeline_ss_submenu();
569 cookie_render();
570 #if 0
@@ -613,11 +614,11 @@
613 if( fBrBg ) tmFlags |= TIMELINE_BRCOLOR;
614 if( fUBg ) tmFlags |= TIMELINE_UCOLOR;
615 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0);
616 db_finalize(&q);
617 @ <br />
618 style_finish_page("leaves");
619 }
620
621 #if INTERFACE
622 /* Flag parameters to compute_uses_file() */
623 #define USESFILE_DELETE 0x01 /* Include the check-ins where file deleted */
624
--- src/descendants.c
+++ src/descendants.c
@@ -382,11 +382,11 @@
382 "%s"
383 " AND event.objid IN (SELECT rid FROM leaves)"
384 " ORDER BY event.mtime DESC",
385 timeline_query_for_tty()
386 );
387 print_timeline(&q, 0, width, 0, 0);
388 db_finalize(&q);
389 }
390
391 /*
392 ** COMMAND: leaves*
@@ -561,10 +561,11 @@
561 }
562 if( showClosed || showAll ){
563 style_submenu_element("Open", "%s", url_render(&url, 0, 0, 0, 0));
564 }
565 url_reset(&url);
566 style_set_current_feature("leaves");
567 style_header("Leaves");
568 login_anonymous_available();
569 timeline_ss_submenu();
570 cookie_render();
571 #if 0
@@ -613,11 +614,11 @@
614 if( fBrBg ) tmFlags |= TIMELINE_BRCOLOR;
615 if( fUBg ) tmFlags |= TIMELINE_UCOLOR;
616 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0);
617 db_finalize(&q);
618 @ <br />
619 style_finish_page();
620 }
621
622 #if INTERFACE
623 /* Flag parameters to compute_uses_file() */
624 #define USESFILE_DELETE 0x01 /* Include the check-ins where file deleted */
625
+8 -2
--- src/diff.c
+++ src/diff.c
@@ -1955,11 +1955,16 @@
19551955
int nDel = 0, nIns = 0, i;
19561956
for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
19571957
nDel += c.aEdit[i+1];
19581958
nIns += c.aEdit[i+2];
19591959
}
1960
- blob_appendf(pOut, "%10d %10d", nIns, nDel);
1960
+ g.diffCnt[1] += nIns;
1961
+ g.diffCnt[2] += nDel;
1962
+ if( nIns+nDel ){
1963
+ g.diffCnt[0]++;
1964
+ blob_appendf(pOut, "%10d %10d", nIns, nDel);
1965
+ }
19611966
}else if( diffFlags & DIFF_SIDEBYSIDE ){
19621967
sbsDiff(&c, pOut, pRe, diffFlags);
19631968
}else{
19641969
contextDiff(&c, pOut, pRe, diffFlags);
19651970
}
@@ -2448,10 +2453,11 @@
24482453
/* compute the annotation */
24492454
annotate_file(&ann, zFilename, zRevision, zLimit, zOrigin, annFlags);
24502455
zCI = ann.aVers[0].zMUuid;
24512456
24522457
/* generate the web page */
2458
+ style_set_current_feature("annotate");
24532459
style_header("Annotation For %h", zFilename);
24542460
if( bBlame ){
24552461
url_initialize(&url, "blame");
24562462
}else{
24572463
url_initialize(&url, "annotate");
@@ -2556,11 +2562,11 @@
25562562
}
25572563
@ %s(zPrefix) %h(z)
25582564
25592565
}
25602566
@ </pre>
2561
- style_finish_page("annotate");
2567
+ style_finish_page();
25622568
}
25632569
25642570
/*
25652571
** COMMAND: annotate
25662572
** COMMAND: blame
25672573
--- src/diff.c
+++ src/diff.c
@@ -1955,11 +1955,16 @@
1955 int nDel = 0, nIns = 0, i;
1956 for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
1957 nDel += c.aEdit[i+1];
1958 nIns += c.aEdit[i+2];
1959 }
1960 blob_appendf(pOut, "%10d %10d", nIns, nDel);
 
 
 
 
 
1961 }else if( diffFlags & DIFF_SIDEBYSIDE ){
1962 sbsDiff(&c, pOut, pRe, diffFlags);
1963 }else{
1964 contextDiff(&c, pOut, pRe, diffFlags);
1965 }
@@ -2448,10 +2453,11 @@
2448 /* compute the annotation */
2449 annotate_file(&ann, zFilename, zRevision, zLimit, zOrigin, annFlags);
2450 zCI = ann.aVers[0].zMUuid;
2451
2452 /* generate the web page */
 
2453 style_header("Annotation For %h", zFilename);
2454 if( bBlame ){
2455 url_initialize(&url, "blame");
2456 }else{
2457 url_initialize(&url, "annotate");
@@ -2556,11 +2562,11 @@
2556 }
2557 @ %s(zPrefix) %h(z)
2558
2559 }
2560 @ </pre>
2561 style_finish_page("annotate");
2562 }
2563
2564 /*
2565 ** COMMAND: annotate
2566 ** COMMAND: blame
2567
--- src/diff.c
+++ src/diff.c
@@ -1955,11 +1955,16 @@
1955 int nDel = 0, nIns = 0, i;
1956 for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
1957 nDel += c.aEdit[i+1];
1958 nIns += c.aEdit[i+2];
1959 }
1960 g.diffCnt[1] += nIns;
1961 g.diffCnt[2] += nDel;
1962 if( nIns+nDel ){
1963 g.diffCnt[0]++;
1964 blob_appendf(pOut, "%10d %10d", nIns, nDel);
1965 }
1966 }else if( diffFlags & DIFF_SIDEBYSIDE ){
1967 sbsDiff(&c, pOut, pRe, diffFlags);
1968 }else{
1969 contextDiff(&c, pOut, pRe, diffFlags);
1970 }
@@ -2448,10 +2453,11 @@
2453 /* compute the annotation */
2454 annotate_file(&ann, zFilename, zRevision, zLimit, zOrigin, annFlags);
2455 zCI = ann.aVers[0].zMUuid;
2456
2457 /* generate the web page */
2458 style_set_current_feature("annotate");
2459 style_header("Annotation For %h", zFilename);
2460 if( bBlame ){
2461 url_initialize(&url, "blame");
2462 }else{
2463 url_initialize(&url, "annotate");
@@ -2556,11 +2562,11 @@
2562 }
2563 @ %s(zPrefix) %h(z)
2564
2565 }
2566 @ </pre>
2567 style_finish_page();
2568 }
2569
2570 /*
2571 ** COMMAND: annotate
2572 ** COMMAND: blame
2573
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -887,10 +887,11 @@
887887
zFrom = mprintf("root:%s", zBranch);
888888
}
889889
if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){
890890
fossil_fatal("cannot use --checkin together with --from or --to");
891891
}
892
+ g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0;
892893
if( zTo==0 || againstUndo ){
893894
db_must_be_within_tree();
894895
}else if( zFrom==0 ){
895896
fossil_fatal("must use --from if --to is present");
896897
}else{
@@ -958,10 +959,14 @@
958959
}
959960
fossil_free(pFileDir[i].zName);
960961
}
961962
fossil_free(pFileDir);
962963
}
964
+ if ( diffFlags & DIFF_NUMSTAT ){
965
+ fossil_print("%10d %10d TOTAL over %d changed files\n",
966
+ g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]);
967
+ }
963968
}
964969
965970
/*
966971
** WEBPAGE: vpatch
967972
** URL: /vpatch?from=FROM&to=TO
968973
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -887,10 +887,11 @@
887 zFrom = mprintf("root:%s", zBranch);
888 }
889 if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){
890 fossil_fatal("cannot use --checkin together with --from or --to");
891 }
 
892 if( zTo==0 || againstUndo ){
893 db_must_be_within_tree();
894 }else if( zFrom==0 ){
895 fossil_fatal("must use --from if --to is present");
896 }else{
@@ -958,10 +959,14 @@
958 }
959 fossil_free(pFileDir[i].zName);
960 }
961 fossil_free(pFileDir);
962 }
 
 
 
 
963 }
964
965 /*
966 ** WEBPAGE: vpatch
967 ** URL: /vpatch?from=FROM&to=TO
968
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -887,10 +887,11 @@
887 zFrom = mprintf("root:%s", zBranch);
888 }
889 if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){
890 fossil_fatal("cannot use --checkin together with --from or --to");
891 }
892 g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0;
893 if( zTo==0 || againstUndo ){
894 db_must_be_within_tree();
895 }else if( zFrom==0 ){
896 fossil_fatal("must use --from if --to is present");
897 }else{
@@ -958,10 +959,14 @@
959 }
960 fossil_free(pFileDir[i].zName);
961 }
962 fossil_free(pFileDir);
963 }
964 if ( diffFlags & DIFF_NUMSTAT ){
965 fossil_print("%10d %10d TOTAL over %d changed files\n",
966 g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]);
967 }
968 }
969
970 /*
971 ** WEBPAGE: vpatch
972 ** URL: /vpatch?from=FROM&to=TO
973
+27 -6
--- src/dispatch.c
+++ src/dispatch.c
@@ -349,10 +349,12 @@
349349
** followed by two spaces and a non-space. <dd> elements can begin
350350
** on the same line as long as they are separated by at least
351351
** two spaces.
352352
**
353353
** * Indented text is show verbatim (<pre>...</pre>)
354
+**
355
+** * Lines that begin with "|" at the left margin are in <pre>...</pre>
354356
*/
355357
static void help_to_html(const char *zHelp, Blob *pHtml){
356358
int i;
357359
char c;
358360
int nIndent = 0;
@@ -361,10 +363,11 @@
361363
int aIndent[10];
362364
const char *azEnd[10];
363365
int iLevel = 0;
364366
int isLI = 0;
365367
int isDT = 0;
368
+ int inPRE = 0;
366369
static const char *zEndDL = "</dl></blockquote>";
367370
static const char *zEndPRE = "</pre></blockquote>";
368371
static const char *zEndUL = "</ul>";
369372
static const char *zEndDD = "</dd>";
370373
@@ -380,16 +383,32 @@
380383
wantBR = 1;
381384
continue;
382385
}
383386
i++;
384387
}
385
- if( i>2 && zHelp[0]=='>' && zHelp[1]==' ' ){
386
- isDT = 1;
387
- for(nIndent=1; nIndent<i && zHelp[nIndent]==' '; nIndent++){}
388
+ if( i>2 && (zHelp[0]=='>' || zHelp[0]=='|') && zHelp[1]==' ' ){
389
+ if( zHelp[0]=='>' ){
390
+ isDT = 1;
391
+ for(nIndent=1; nIndent<i && zHelp[nIndent]==' '; nIndent++){}
392
+ }else{
393
+ if( !inPRE ){
394
+ blob_append(pHtml, "<pre>\n", -1);
395
+ inPRE = 1;
396
+ }
397
+ }
388398
}else{
399
+ if( inPRE ){
400
+ blob_append(pHtml, "</pre>\n", -1);
401
+ inPRE = 0;
402
+ }
389403
isDT = 0;
390404
for(nIndent=0; nIndent<i && zHelp[nIndent]==' '; nIndent++){}
405
+ }
406
+ if( inPRE ){
407
+ blob_append(pHtml, zHelp+1, i);
408
+ zHelp += i + 1;
409
+ continue;
391410
}
392411
if( nIndent==i ){
393412
if( c==0 ) break;
394413
if( iLevel && azEnd[iLevel]==zEndPRE ){
395414
/* Skip the newline at the end of a <pre> */
@@ -491,11 +510,11 @@
491510
blob_append(pText, "fossil", 6);
492511
zHelp += i+7;
493512
i = -1;
494513
continue;
495514
}
496
- if( c=='\n' && strncmp(zHelp+i+1,"> ",2)==0 ){
515
+ if( c=='\n' && (zHelp[i+1]=='>' || zHelp[i+1]=='|') && zHelp[i+2]==' ' ){
497516
blob_append(pText, zHelp, i+1);
498517
blob_append(pText, " ", 1);
499518
zHelp += i+2;
500519
i = -1;
501520
continue;
@@ -747,10 +766,11 @@
747766
if( zCmd==0 ) zCmd = P("name");
748767
if( zCmd && *zCmd ){
749768
int rc;
750769
const CmdOrPage *pCmd = 0;
751770
771
+ style_set_current_feature("tkt");
752772
style_header("Help: %s", zCmd);
753773
754774
style_submenu_element("Command-List", "%R/help");
755775
rc = dispatch_name_search(zCmd, CMDFLAG_ANY|CMDFLAG_PREFIX, &pCmd);
756776
if( *zCmd=='/' ){
@@ -850,11 +870,11 @@
850870
}
851871
}
852872
@ </ul></div>
853873
854874
}
855
- style_finish_page("help");
875
+ style_finish_page();
856876
}
857877
858878
/*
859879
** WEBPAGE: test-all-help
860880
**
@@ -862,10 +882,11 @@
862882
*/
863883
void test_all_help_page(void){
864884
int i;
865885
Blob buf;
866886
blob_init(&buf,0,0);
887
+ style_set_current_feature("test");
867888
style_header("All Help Text");
868889
@ <dl>
869890
for(i=0; i<MX_COMMAND; i++){
870891
const char *zDesc;
871892
unsigned int e = aCommand[i].eCmdFlags;
@@ -901,11 +922,11 @@
901922
help_to_html(aCommand[i].zHelp, cgi_output_blob());
902923
@ </dd>
903924
}
904925
@ </dl>
905926
blob_reset(&buf);
906
- style_finish_page("help");
927
+ style_finish_page();
907928
}
908929
909930
static void multi_column_list(const char **azWord, int nWord){
910931
int i, j, len;
911932
int mxLen = 0;
912933
--- src/dispatch.c
+++ src/dispatch.c
@@ -349,10 +349,12 @@
349 ** followed by two spaces and a non-space. <dd> elements can begin
350 ** on the same line as long as they are separated by at least
351 ** two spaces.
352 **
353 ** * Indented text is show verbatim (<pre>...</pre>)
 
 
354 */
355 static void help_to_html(const char *zHelp, Blob *pHtml){
356 int i;
357 char c;
358 int nIndent = 0;
@@ -361,10 +363,11 @@
361 int aIndent[10];
362 const char *azEnd[10];
363 int iLevel = 0;
364 int isLI = 0;
365 int isDT = 0;
 
366 static const char *zEndDL = "</dl></blockquote>";
367 static const char *zEndPRE = "</pre></blockquote>";
368 static const char *zEndUL = "</ul>";
369 static const char *zEndDD = "</dd>";
370
@@ -380,16 +383,32 @@
380 wantBR = 1;
381 continue;
382 }
383 i++;
384 }
385 if( i>2 && zHelp[0]=='>' && zHelp[1]==' ' ){
386 isDT = 1;
387 for(nIndent=1; nIndent<i && zHelp[nIndent]==' '; nIndent++){}
 
 
 
 
 
 
 
388 }else{
 
 
 
 
389 isDT = 0;
390 for(nIndent=0; nIndent<i && zHelp[nIndent]==' '; nIndent++){}
 
 
 
 
 
391 }
392 if( nIndent==i ){
393 if( c==0 ) break;
394 if( iLevel && azEnd[iLevel]==zEndPRE ){
395 /* Skip the newline at the end of a <pre> */
@@ -491,11 +510,11 @@
491 blob_append(pText, "fossil", 6);
492 zHelp += i+7;
493 i = -1;
494 continue;
495 }
496 if( c=='\n' && strncmp(zHelp+i+1,"> ",2)==0 ){
497 blob_append(pText, zHelp, i+1);
498 blob_append(pText, " ", 1);
499 zHelp += i+2;
500 i = -1;
501 continue;
@@ -747,10 +766,11 @@
747 if( zCmd==0 ) zCmd = P("name");
748 if( zCmd && *zCmd ){
749 int rc;
750 const CmdOrPage *pCmd = 0;
751
 
752 style_header("Help: %s", zCmd);
753
754 style_submenu_element("Command-List", "%R/help");
755 rc = dispatch_name_search(zCmd, CMDFLAG_ANY|CMDFLAG_PREFIX, &pCmd);
756 if( *zCmd=='/' ){
@@ -850,11 +870,11 @@
850 }
851 }
852 @ </ul></div>
853
854 }
855 style_finish_page("help");
856 }
857
858 /*
859 ** WEBPAGE: test-all-help
860 **
@@ -862,10 +882,11 @@
862 */
863 void test_all_help_page(void){
864 int i;
865 Blob buf;
866 blob_init(&buf,0,0);
 
867 style_header("All Help Text");
868 @ <dl>
869 for(i=0; i<MX_COMMAND; i++){
870 const char *zDesc;
871 unsigned int e = aCommand[i].eCmdFlags;
@@ -901,11 +922,11 @@
901 help_to_html(aCommand[i].zHelp, cgi_output_blob());
902 @ </dd>
903 }
904 @ </dl>
905 blob_reset(&buf);
906 style_finish_page("help");
907 }
908
909 static void multi_column_list(const char **azWord, int nWord){
910 int i, j, len;
911 int mxLen = 0;
912
--- src/dispatch.c
+++ src/dispatch.c
@@ -349,10 +349,12 @@
349 ** followed by two spaces and a non-space. <dd> elements can begin
350 ** on the same line as long as they are separated by at least
351 ** two spaces.
352 **
353 ** * Indented text is show verbatim (<pre>...</pre>)
354 **
355 ** * Lines that begin with "|" at the left margin are in <pre>...</pre>
356 */
357 static void help_to_html(const char *zHelp, Blob *pHtml){
358 int i;
359 char c;
360 int nIndent = 0;
@@ -361,10 +363,11 @@
363 int aIndent[10];
364 const char *azEnd[10];
365 int iLevel = 0;
366 int isLI = 0;
367 int isDT = 0;
368 int inPRE = 0;
369 static const char *zEndDL = "</dl></blockquote>";
370 static const char *zEndPRE = "</pre></blockquote>";
371 static const char *zEndUL = "</ul>";
372 static const char *zEndDD = "</dd>";
373
@@ -380,16 +383,32 @@
383 wantBR = 1;
384 continue;
385 }
386 i++;
387 }
388 if( i>2 && (zHelp[0]=='>' || zHelp[0]=='|') && zHelp[1]==' ' ){
389 if( zHelp[0]=='>' ){
390 isDT = 1;
391 for(nIndent=1; nIndent<i && zHelp[nIndent]==' '; nIndent++){}
392 }else{
393 if( !inPRE ){
394 blob_append(pHtml, "<pre>\n", -1);
395 inPRE = 1;
396 }
397 }
398 }else{
399 if( inPRE ){
400 blob_append(pHtml, "</pre>\n", -1);
401 inPRE = 0;
402 }
403 isDT = 0;
404 for(nIndent=0; nIndent<i && zHelp[nIndent]==' '; nIndent++){}
405 }
406 if( inPRE ){
407 blob_append(pHtml, zHelp+1, i);
408 zHelp += i + 1;
409 continue;
410 }
411 if( nIndent==i ){
412 if( c==0 ) break;
413 if( iLevel && azEnd[iLevel]==zEndPRE ){
414 /* Skip the newline at the end of a <pre> */
@@ -491,11 +510,11 @@
510 blob_append(pText, "fossil", 6);
511 zHelp += i+7;
512 i = -1;
513 continue;
514 }
515 if( c=='\n' && (zHelp[i+1]=='>' || zHelp[i+1]=='|') && zHelp[i+2]==' ' ){
516 blob_append(pText, zHelp, i+1);
517 blob_append(pText, " ", 1);
518 zHelp += i+2;
519 i = -1;
520 continue;
@@ -747,10 +766,11 @@
766 if( zCmd==0 ) zCmd = P("name");
767 if( zCmd && *zCmd ){
768 int rc;
769 const CmdOrPage *pCmd = 0;
770
771 style_set_current_feature("tkt");
772 style_header("Help: %s", zCmd);
773
774 style_submenu_element("Command-List", "%R/help");
775 rc = dispatch_name_search(zCmd, CMDFLAG_ANY|CMDFLAG_PREFIX, &pCmd);
776 if( *zCmd=='/' ){
@@ -850,11 +870,11 @@
870 }
871 }
872 @ </ul></div>
873
874 }
875 style_finish_page();
876 }
877
878 /*
879 ** WEBPAGE: test-all-help
880 **
@@ -862,10 +882,11 @@
882 */
883 void test_all_help_page(void){
884 int i;
885 Blob buf;
886 blob_init(&buf,0,0);
887 style_set_current_feature("test");
888 style_header("All Help Text");
889 @ <dl>
890 for(i=0; i<MX_COMMAND; i++){
891 const char *zDesc;
892 unsigned int e = aCommand[i].eCmdFlags;
@@ -901,11 +922,11 @@
922 help_to_html(aCommand[i].zHelp, cgi_output_blob());
923 @ </dd>
924 }
925 @ </dl>
926 blob_reset(&buf);
927 style_finish_page();
928 }
929
930 static void multi_column_list(const char **azWord, int nWord){
931 int i, j, len;
932 int mxLen = 0;
933
+28 -18
--- src/doc.c
+++ src/doc.c
@@ -38,30 +38,39 @@
3838
const unsigned char *x;
3939
4040
/* A table of mimetypes based on file content prefixes
4141
*/
4242
static const struct {
43
- const char *zPrefix; /* The file prefix */
44
- const int size; /* Length of the prefix */
43
+ const char *z; /* Identifying file text */
44
+ const unsigned char sz1; /* Length of the prefix */
45
+ const unsigned char of2; /* Offset to the second segment */
46
+ const unsigned char sz2; /* Size of the second segment */
47
+ const unsigned char mn; /* Minimum size of input */
4548
const char *zMimetype; /* The corresponding mimetype */
4649
} aMime[] = {
47
- { "GIF87a", 6, "image/gif" },
48
- { "GIF89a", 6, "image/gif" },
49
- { "\211PNG\r\n\032\n", 8, "image/png" },
50
- { "\377\332\377", 3, "image/jpeg" },
51
- { "\377\330\377", 3, "image/jpeg" },
50
+ { "GIF87a", 6, 0, 0, 6, "image/gif" },
51
+ { "GIF89a", 6, 0, 0, 6, "image/gif" },
52
+ { "\211PNG\r\n\032\n", 8, 0, 0, 8, "image/png" },
53
+ { "\377\332\377", 3, 0, 0, 3, "image/jpeg" },
54
+ { "\377\330\377", 3, 0, 0, 3, "image/jpeg" },
55
+ { "RIFFWAVEfmt", 4, 8, 7, 15, "sound/wav" },
5256
};
5357
5458
if( !looks_like_binary(pBlob) ) {
5559
return 0; /* Plain text */
5660
}
5761
x = (const unsigned char*)blob_buffer(pBlob);
5862
n = blob_size(pBlob);
5963
for(i=0; i<count(aMime); i++){
60
- if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
61
- return aMime[i].zMimetype;
64
+ if( n<aMime[i].mn ) continue;
65
+ if( memcmp(x, aMime[i].z, aMime[i].sz1)!=0 ) continue;
66
+ if( aMime[i].sz2
67
+ && memcmp(x+aMime[i].of2, aMime[i].z+aMime[i].sz1, aMime[i].sz2)!=0
68
+ ){
69
+ continue;
6270
}
71
+ return aMime[i].zMimetype;
6372
}
6473
return "unknown/unknown";
6574
}
6675
6776
/* A table of mimetypes based on file suffixes.
@@ -555,11 +564,11 @@
555564
}
556565
@ <tr><td>%s(zFlag)%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
557566
}
558567
@ </tbody></table>
559568
style_table_sorter();
560
- style_finish_page("mimetypes");
569
+ style_finish_page();
561570
}
562571
563572
/*
564573
** Check to see if the file in the pContent blob is "embedded HTML". Return
565574
** true if it is, and fill pTitle with the document title.
@@ -770,11 +779,11 @@
770779
}else{
771780
style_header("%s", zDefaultTitle);
772781
wiki_convert(pBody, 0, WIKI_BUTTONS);
773782
}
774783
document_emit_js();
775
- style_finish_page("doc");
784
+ style_finish_page();
776785
}else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){
777786
Blob tail = BLOB_INITIALIZER;
778787
markdown_to_html(pBody, &title, &tail);
779788
if( blob_size(&title)>0 ){
780789
style_header("%s", blob_str(&title));
@@ -781,30 +790,30 @@
781790
}else{
782791
style_header("%s", zDefaultTitle);
783792
}
784793
convert_href_and_output(&tail);
785794
document_emit_js();
786
- style_finish_page("doc");
795
+ style_finish_page();
787796
}else if( fossil_strcmp(zMime, "text/plain")==0 ){
788797
style_header("%s", zDefaultTitle);
789798
@ <blockquote><pre>
790799
@ %h(blob_str(pBody))
791800
@ </pre></blockquote>
792801
document_emit_js();
793
- style_finish_page("doc");
802
+ style_finish_page();
794803
}else if( fossil_strcmp(zMime, "text/html")==0
795804
&& doc_is_embedded_html(pBody, &title) ){
796805
if( blob_size(&title)==0 ) blob_append(&title,zFilename,-1);
797806
style_header("%s", blob_str(&title));
798807
convert_href_and_output(pBody);
799808
document_emit_js();
800
- style_finish_page("doc");
809
+ style_finish_page();
801810
}else if( fossil_strcmp(zMime, "text/x-pikchr")==0 ){
802811
style_adunit_config(ADUNIT_RIGHT_OK);
803812
style_header("%s", zDefaultTitle);
804813
wiki_render_by_mimetype(pBody, zMime);
805
- style_finish_page("doc");
814
+ style_finish_page();
806815
#ifdef FOSSIL_ENABLE_TH1_DOCS
807816
}else if( Th_AreDocsEnabled() &&
808817
fossil_strcmp(zMime, "application/x-th1")==0 ){
809818
int raw = P("raw")!=0;
810819
if( !raw ){
@@ -821,11 +830,11 @@
821830
}else{
822831
Th_Render(blob_str(pBody));
823832
}
824833
if( !raw ){
825834
document_emit_js();
826
- style_finish_page("doc");
835
+ style_finish_page();
827836
}
828837
#endif
829838
}else{
830839
fossil_free(style_csp(1));
831840
cgi_set_content_type(zMime);
@@ -906,10 +915,11 @@
906915
#endif
907916
};
908917
909918
login_check_credentials();
910919
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
920
+ style_set_current_feature("doc");
911921
blob_init(&title, 0, 0);
912922
zDfltTitle = isUV ? "" : "Documentation";
913923
db_begin_transaction();
914924
while( rid==0 && (++nMiss)<=count(azSuffix) ){
915925
zName = P("name");
@@ -1029,11 +1039,11 @@
10291039
style_header("Not Found");
10301040
@ <p>Document %h(zOrigName) not found
10311041
if( fossil_strcmp(zCheckin,"ckout")!=0 ){
10321042
@ in %z(href("%R/tree?ci=%T",zCheckin))%h(zCheckin)</a>
10331043
}
1034
- style_finish_page("doc");
1044
+ style_finish_page();
10351045
return;
10361046
}
10371047
10381048
/*
10391049
** The default logo.
@@ -1202,7 +1212,7 @@
12021212
*/
12031213
void doc_search_page(void){
12041214
login_check_credentials();
12051215
style_header("Document Search");
12061216
search_screen(SRCH_DOC, 0);
1207
- style_finish_page("docsrch");
1217
+ style_finish_page();
12081218
}
12091219
--- src/doc.c
+++ src/doc.c
@@ -38,30 +38,39 @@
38 const unsigned char *x;
39
40 /* A table of mimetypes based on file content prefixes
41 */
42 static const struct {
43 const char *zPrefix; /* The file prefix */
44 const int size; /* Length of the prefix */
 
 
 
45 const char *zMimetype; /* The corresponding mimetype */
46 } aMime[] = {
47 { "GIF87a", 6, "image/gif" },
48 { "GIF89a", 6, "image/gif" },
49 { "\211PNG\r\n\032\n", 8, "image/png" },
50 { "\377\332\377", 3, "image/jpeg" },
51 { "\377\330\377", 3, "image/jpeg" },
 
52 };
53
54 if( !looks_like_binary(pBlob) ) {
55 return 0; /* Plain text */
56 }
57 x = (const unsigned char*)blob_buffer(pBlob);
58 n = blob_size(pBlob);
59 for(i=0; i<count(aMime); i++){
60 if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
61 return aMime[i].zMimetype;
 
 
 
 
62 }
 
63 }
64 return "unknown/unknown";
65 }
66
67 /* A table of mimetypes based on file suffixes.
@@ -555,11 +564,11 @@
555 }
556 @ <tr><td>%s(zFlag)%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
557 }
558 @ </tbody></table>
559 style_table_sorter();
560 style_finish_page("mimetypes");
561 }
562
563 /*
564 ** Check to see if the file in the pContent blob is "embedded HTML". Return
565 ** true if it is, and fill pTitle with the document title.
@@ -770,11 +779,11 @@
770 }else{
771 style_header("%s", zDefaultTitle);
772 wiki_convert(pBody, 0, WIKI_BUTTONS);
773 }
774 document_emit_js();
775 style_finish_page("doc");
776 }else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){
777 Blob tail = BLOB_INITIALIZER;
778 markdown_to_html(pBody, &title, &tail);
779 if( blob_size(&title)>0 ){
780 style_header("%s", blob_str(&title));
@@ -781,30 +790,30 @@
781 }else{
782 style_header("%s", zDefaultTitle);
783 }
784 convert_href_and_output(&tail);
785 document_emit_js();
786 style_finish_page("doc");
787 }else if( fossil_strcmp(zMime, "text/plain")==0 ){
788 style_header("%s", zDefaultTitle);
789 @ <blockquote><pre>
790 @ %h(blob_str(pBody))
791 @ </pre></blockquote>
792 document_emit_js();
793 style_finish_page("doc");
794 }else if( fossil_strcmp(zMime, "text/html")==0
795 && doc_is_embedded_html(pBody, &title) ){
796 if( blob_size(&title)==0 ) blob_append(&title,zFilename,-1);
797 style_header("%s", blob_str(&title));
798 convert_href_and_output(pBody);
799 document_emit_js();
800 style_finish_page("doc");
801 }else if( fossil_strcmp(zMime, "text/x-pikchr")==0 ){
802 style_adunit_config(ADUNIT_RIGHT_OK);
803 style_header("%s", zDefaultTitle);
804 wiki_render_by_mimetype(pBody, zMime);
805 style_finish_page("doc");
806 #ifdef FOSSIL_ENABLE_TH1_DOCS
807 }else if( Th_AreDocsEnabled() &&
808 fossil_strcmp(zMime, "application/x-th1")==0 ){
809 int raw = P("raw")!=0;
810 if( !raw ){
@@ -821,11 +830,11 @@
821 }else{
822 Th_Render(blob_str(pBody));
823 }
824 if( !raw ){
825 document_emit_js();
826 style_finish_page("doc");
827 }
828 #endif
829 }else{
830 fossil_free(style_csp(1));
831 cgi_set_content_type(zMime);
@@ -906,10 +915,11 @@
906 #endif
907 };
908
909 login_check_credentials();
910 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
 
911 blob_init(&title, 0, 0);
912 zDfltTitle = isUV ? "" : "Documentation";
913 db_begin_transaction();
914 while( rid==0 && (++nMiss)<=count(azSuffix) ){
915 zName = P("name");
@@ -1029,11 +1039,11 @@
1029 style_header("Not Found");
1030 @ <p>Document %h(zOrigName) not found
1031 if( fossil_strcmp(zCheckin,"ckout")!=0 ){
1032 @ in %z(href("%R/tree?ci=%T",zCheckin))%h(zCheckin)</a>
1033 }
1034 style_finish_page("doc");
1035 return;
1036 }
1037
1038 /*
1039 ** The default logo.
@@ -1202,7 +1212,7 @@
1202 */
1203 void doc_search_page(void){
1204 login_check_credentials();
1205 style_header("Document Search");
1206 search_screen(SRCH_DOC, 0);
1207 style_finish_page("docsrch");
1208 }
1209
--- src/doc.c
+++ src/doc.c
@@ -38,30 +38,39 @@
38 const unsigned char *x;
39
40 /* A table of mimetypes based on file content prefixes
41 */
42 static const struct {
43 const char *z; /* Identifying file text */
44 const unsigned char sz1; /* Length of the prefix */
45 const unsigned char of2; /* Offset to the second segment */
46 const unsigned char sz2; /* Size of the second segment */
47 const unsigned char mn; /* Minimum size of input */
48 const char *zMimetype; /* The corresponding mimetype */
49 } aMime[] = {
50 { "GIF87a", 6, 0, 0, 6, "image/gif" },
51 { "GIF89a", 6, 0, 0, 6, "image/gif" },
52 { "\211PNG\r\n\032\n", 8, 0, 0, 8, "image/png" },
53 { "\377\332\377", 3, 0, 0, 3, "image/jpeg" },
54 { "\377\330\377", 3, 0, 0, 3, "image/jpeg" },
55 { "RIFFWAVEfmt", 4, 8, 7, 15, "sound/wav" },
56 };
57
58 if( !looks_like_binary(pBlob) ) {
59 return 0; /* Plain text */
60 }
61 x = (const unsigned char*)blob_buffer(pBlob);
62 n = blob_size(pBlob);
63 for(i=0; i<count(aMime); i++){
64 if( n<aMime[i].mn ) continue;
65 if( memcmp(x, aMime[i].z, aMime[i].sz1)!=0 ) continue;
66 if( aMime[i].sz2
67 && memcmp(x+aMime[i].of2, aMime[i].z+aMime[i].sz1, aMime[i].sz2)!=0
68 ){
69 continue;
70 }
71 return aMime[i].zMimetype;
72 }
73 return "unknown/unknown";
74 }
75
76 /* A table of mimetypes based on file suffixes.
@@ -555,11 +564,11 @@
564 }
565 @ <tr><td>%s(zFlag)%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
566 }
567 @ </tbody></table>
568 style_table_sorter();
569 style_finish_page();
570 }
571
572 /*
573 ** Check to see if the file in the pContent blob is "embedded HTML". Return
574 ** true if it is, and fill pTitle with the document title.
@@ -770,11 +779,11 @@
779 }else{
780 style_header("%s", zDefaultTitle);
781 wiki_convert(pBody, 0, WIKI_BUTTONS);
782 }
783 document_emit_js();
784 style_finish_page();
785 }else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){
786 Blob tail = BLOB_INITIALIZER;
787 markdown_to_html(pBody, &title, &tail);
788 if( blob_size(&title)>0 ){
789 style_header("%s", blob_str(&title));
@@ -781,30 +790,30 @@
790 }else{
791 style_header("%s", zDefaultTitle);
792 }
793 convert_href_and_output(&tail);
794 document_emit_js();
795 style_finish_page();
796 }else if( fossil_strcmp(zMime, "text/plain")==0 ){
797 style_header("%s", zDefaultTitle);
798 @ <blockquote><pre>
799 @ %h(blob_str(pBody))
800 @ </pre></blockquote>
801 document_emit_js();
802 style_finish_page();
803 }else if( fossil_strcmp(zMime, "text/html")==0
804 && doc_is_embedded_html(pBody, &title) ){
805 if( blob_size(&title)==0 ) blob_append(&title,zFilename,-1);
806 style_header("%s", blob_str(&title));
807 convert_href_and_output(pBody);
808 document_emit_js();
809 style_finish_page();
810 }else if( fossil_strcmp(zMime, "text/x-pikchr")==0 ){
811 style_adunit_config(ADUNIT_RIGHT_OK);
812 style_header("%s", zDefaultTitle);
813 wiki_render_by_mimetype(pBody, zMime);
814 style_finish_page();
815 #ifdef FOSSIL_ENABLE_TH1_DOCS
816 }else if( Th_AreDocsEnabled() &&
817 fossil_strcmp(zMime, "application/x-th1")==0 ){
818 int raw = P("raw")!=0;
819 if( !raw ){
@@ -821,11 +830,11 @@
830 }else{
831 Th_Render(blob_str(pBody));
832 }
833 if( !raw ){
834 document_emit_js();
835 style_finish_page();
836 }
837 #endif
838 }else{
839 fossil_free(style_csp(1));
840 cgi_set_content_type(zMime);
@@ -906,10 +915,11 @@
915 #endif
916 };
917
918 login_check_credentials();
919 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
920 style_set_current_feature("doc");
921 blob_init(&title, 0, 0);
922 zDfltTitle = isUV ? "" : "Documentation";
923 db_begin_transaction();
924 while( rid==0 && (++nMiss)<=count(azSuffix) ){
925 zName = P("name");
@@ -1029,11 +1039,11 @@
1039 style_header("Not Found");
1040 @ <p>Document %h(zOrigName) not found
1041 if( fossil_strcmp(zCheckin,"ckout")!=0 ){
1042 @ in %z(href("%R/tree?ci=%T",zCheckin))%h(zCheckin)</a>
1043 }
1044 style_finish_page();
1045 return;
1046 }
1047
1048 /*
1049 ** The default logo.
@@ -1202,7 +1212,7 @@
1212 */
1213 void doc_search_page(void){
1214 login_check_credentials();
1215 style_header("Document Search");
1216 search_screen(SRCH_DOC, 0);
1217 style_finish_page();
1218 }
1219
+4 -4
--- src/encode.c
+++ src/encode.c
@@ -401,14 +401,14 @@
401401
char *zOut;
402402
u32 c;
403403
int n, i, j;
404404
z = (const unsigned char*)zStr;
405405
n = 0;
406
- while( (c = fossil_utf8_read(&z))!=0 ){
406
+ while( (c = *(z++))!=0 ){
407407
if( c=='\\' || c=='"' ){
408408
n += 2;
409
- }else if( c<' ' || c>=0x7f ){
409
+ }else if( c<' ' ){
410410
if( c=='\n' || c=='\r' ){
411411
n += 2;
412412
}else{
413413
n += 6;
414414
}
@@ -424,15 +424,15 @@
424424
z = (const unsigned char*)zStr;
425425
i = 0;
426426
if(fAddQuotes){
427427
zOut[i++] = '"';
428428
}
429
- while( (c = fossil_utf8_read(&z))!=0 ){
429
+ while( (c = *(z++))!=0 ){
430430
if( c=='\\' || c=='"' ){
431431
zOut[i++] = '\\';
432432
zOut[i++] = c;
433
- }else if( c<' ' || c>=0x7f ){
433
+ }else if( c<' ' ){
434434
zOut[i++] = '\\';
435435
if( c=='\n' ){
436436
zOut[i++] = 'n';
437437
}else if( c=='\r' ){
438438
zOut[i++] = 'r';
439439
--- src/encode.c
+++ src/encode.c
@@ -401,14 +401,14 @@
401 char *zOut;
402 u32 c;
403 int n, i, j;
404 z = (const unsigned char*)zStr;
405 n = 0;
406 while( (c = fossil_utf8_read(&z))!=0 ){
407 if( c=='\\' || c=='"' ){
408 n += 2;
409 }else if( c<' ' || c>=0x7f ){
410 if( c=='\n' || c=='\r' ){
411 n += 2;
412 }else{
413 n += 6;
414 }
@@ -424,15 +424,15 @@
424 z = (const unsigned char*)zStr;
425 i = 0;
426 if(fAddQuotes){
427 zOut[i++] = '"';
428 }
429 while( (c = fossil_utf8_read(&z))!=0 ){
430 if( c=='\\' || c=='"' ){
431 zOut[i++] = '\\';
432 zOut[i++] = c;
433 }else if( c<' ' || c>=0x7f ){
434 zOut[i++] = '\\';
435 if( c=='\n' ){
436 zOut[i++] = 'n';
437 }else if( c=='\r' ){
438 zOut[i++] = 'r';
439
--- src/encode.c
+++ src/encode.c
@@ -401,14 +401,14 @@
401 char *zOut;
402 u32 c;
403 int n, i, j;
404 z = (const unsigned char*)zStr;
405 n = 0;
406 while( (c = *(z++))!=0 ){
407 if( c=='\\' || c=='"' ){
408 n += 2;
409 }else if( c<' ' ){
410 if( c=='\n' || c=='\r' ){
411 n += 2;
412 }else{
413 n += 6;
414 }
@@ -424,15 +424,15 @@
424 z = (const unsigned char*)zStr;
425 i = 0;
426 if(fAddQuotes){
427 zOut[i++] = '"';
428 }
429 while( (c = *(z++))!=0 ){
430 if( c=='\\' || c=='"' ){
431 zOut[i++] = '\\';
432 zOut[i++] = c;
433 }else if( c<' ' ){
434 zOut[i++] = '\\';
435 if( c=='\n' ){
436 zOut[i++] = 'n';
437 }else if( c=='\r' ){
438 zOut[i++] = 'r';
439
+6 -4
--- src/event.c
+++ src/event.c
@@ -110,14 +110,15 @@
110110
}
111111
break;
112112
}
113113
}
114114
db_finalize(&q1);
115
+ style_set_current_feature("event");
115116
if( rid==0 || (specRid!=0 && specRid!=rid) ){
116117
style_header("No Such Tech-Note");
117118
@ Cannot locate a technical note called <b>%h(zId)</b>.
118
- style_finish_page("event");
119
+ style_finish_page();
119120
return;
120121
}
121122
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
122123
zVerbose = P("v");
123124
if( !zVerbose ){
@@ -229,11 +230,11 @@
229230
" FROM tag"
230231
" WHERE tagname GLOB 'event-%q*'",
231232
zId);
232233
attachment_list(zFullId, "<hr /><h2>Attachments:</h2><ul>");
233234
document_emit_js();
234
- style_finish_page("event");
235
+ style_finish_page();
235236
manifest_destroy(pTNote);
236237
}
237238
238239
/*
239240
** Add or update a new tech note to the repository. rid is id of
@@ -415,10 +416,11 @@
415416
*/
416417
if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
417418
login_needed(g.anon.Write && (rid ? g.anon.WrWiki : g.anon.NewWiki));
418419
return;
419420
}
421
+ style_set_current_feature("event");
420422
421423
/* Figure out the color */
422424
if( rid ){
423425
zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
424426
if( zClr && zClr[0] ){
@@ -473,11 +475,11 @@
473475
zMimetype, zComment, zTags,
474476
zClrFlag[0] ? zClr : 0) ){
475477
style_header("Error");
476478
@ Internal error: Fossil tried to make an invalid artifact for
477479
@ the edited technote.
478
- style_finish_page("event");
480
+ style_finish_page();
479481
return;
480482
}
481483
cgi_redirectf("%R/technote?name=%T", zId);
482484
}
483485
if( P("cancel")!=0 ){
@@ -567,11 +569,11 @@
567569
if( P("preview") ){
568570
@ <input type="submit" name="submit" value="Submit" />
569571
}
570572
@ </td></tr></table>
571573
@ </div></form>
572
- style_finish_page("event");
574
+ style_finish_page();
573575
}
574576
575577
/*
576578
** Add a new tech note to the repository. The timestamp is
577579
** given by the zETime parameter. rid must be zero to create
578580
--- src/event.c
+++ src/event.c
@@ -110,14 +110,15 @@
110 }
111 break;
112 }
113 }
114 db_finalize(&q1);
 
115 if( rid==0 || (specRid!=0 && specRid!=rid) ){
116 style_header("No Such Tech-Note");
117 @ Cannot locate a technical note called <b>%h(zId)</b>.
118 style_finish_page("event");
119 return;
120 }
121 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
122 zVerbose = P("v");
123 if( !zVerbose ){
@@ -229,11 +230,11 @@
229 " FROM tag"
230 " WHERE tagname GLOB 'event-%q*'",
231 zId);
232 attachment_list(zFullId, "<hr /><h2>Attachments:</h2><ul>");
233 document_emit_js();
234 style_finish_page("event");
235 manifest_destroy(pTNote);
236 }
237
238 /*
239 ** Add or update a new tech note to the repository. rid is id of
@@ -415,10 +416,11 @@
415 */
416 if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
417 login_needed(g.anon.Write && (rid ? g.anon.WrWiki : g.anon.NewWiki));
418 return;
419 }
 
420
421 /* Figure out the color */
422 if( rid ){
423 zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
424 if( zClr && zClr[0] ){
@@ -473,11 +475,11 @@
473 zMimetype, zComment, zTags,
474 zClrFlag[0] ? zClr : 0) ){
475 style_header("Error");
476 @ Internal error: Fossil tried to make an invalid artifact for
477 @ the edited technote.
478 style_finish_page("event");
479 return;
480 }
481 cgi_redirectf("%R/technote?name=%T", zId);
482 }
483 if( P("cancel")!=0 ){
@@ -567,11 +569,11 @@
567 if( P("preview") ){
568 @ <input type="submit" name="submit" value="Submit" />
569 }
570 @ </td></tr></table>
571 @ </div></form>
572 style_finish_page("event");
573 }
574
575 /*
576 ** Add a new tech note to the repository. The timestamp is
577 ** given by the zETime parameter. rid must be zero to create
578
--- src/event.c
+++ src/event.c
@@ -110,14 +110,15 @@
110 }
111 break;
112 }
113 }
114 db_finalize(&q1);
115 style_set_current_feature("event");
116 if( rid==0 || (specRid!=0 && specRid!=rid) ){
117 style_header("No Such Tech-Note");
118 @ Cannot locate a technical note called <b>%h(zId)</b>.
119 style_finish_page();
120 return;
121 }
122 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
123 zVerbose = P("v");
124 if( !zVerbose ){
@@ -229,11 +230,11 @@
230 " FROM tag"
231 " WHERE tagname GLOB 'event-%q*'",
232 zId);
233 attachment_list(zFullId, "<hr /><h2>Attachments:</h2><ul>");
234 document_emit_js();
235 style_finish_page();
236 manifest_destroy(pTNote);
237 }
238
239 /*
240 ** Add or update a new tech note to the repository. rid is id of
@@ -415,10 +416,11 @@
416 */
417 if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
418 login_needed(g.anon.Write && (rid ? g.anon.WrWiki : g.anon.NewWiki));
419 return;
420 }
421 style_set_current_feature("event");
422
423 /* Figure out the color */
424 if( rid ){
425 zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
426 if( zClr && zClr[0] ){
@@ -473,11 +475,11 @@
475 zMimetype, zComment, zTags,
476 zClrFlag[0] ? zClr : 0) ){
477 style_header("Error");
478 @ Internal error: Fossil tried to make an invalid artifact for
479 @ the edited technote.
480 style_finish_page();
481 return;
482 }
483 cgi_redirectf("%R/technote?name=%T", zId);
484 }
485 if( P("cancel")!=0 ){
@@ -567,11 +569,11 @@
569 if( P("preview") ){
570 @ <input type="submit" name="submit" value="Submit" />
571 }
572 @ </td></tr></table>
573 @ </div></form>
574 style_finish_page();
575 }
576
577 /*
578 ** Add a new tech note to the repository. The timestamp is
579 ** given by the zETime parameter. rid must be zero to create
580
+135 -21
--- src/export.c
+++ src/export.c
@@ -862,10 +862,15 @@
862862
#define VERB_ERROR 1
863863
#define VERB_NORMAL 2
864864
#define VERB_EXTRA 3
865865
static int gitmirror_verbosity = VERB_NORMAL;
866866
867
+/* The main branch in the Git repository. The "trunk" branch of
868
+** Fossil is renamed to be this branch name.
869
+*/
870
+static const char *gitmirror_mainbranch = 0;
871
+
867872
/*
868873
** Output routine that depends on verbosity
869874
*/
870875
static void gitmirror_message(int iLevel, const char *zFormat, ...){
871876
va_list ap;
@@ -1139,21 +1144,23 @@
11391144
** export */
11401145
if( nErr ){
11411146
gitmirror_message(VERB_ERROR,
11421147
"export of %s abandoned due to missing files\n", zUuid);
11431148
*pnLimit = 0;
1149
+ manifest_destroy(pMan);
11441150
return 1;
11451151
}
11461152
11471153
/* Figure out which branch this check-in is a member of */
11481154
zBranch = db_text(0,
11491155
"SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
11501156
TAG_BRANCH, rid
11511157
);
11521158
if( fossil_strcmp(zBranch,"trunk")==0 ){
1159
+ assert( gitmirror_mainbranch!=0 );
11531160
fossil_free(zBranch);
1154
- zBranch = mprintf("master");
1161
+ zBranch = mprintf("%s",gitmirror_mainbranch);
11551162
}else if( zBranch==0 ){
11561163
zBranch = mprintf("unknown");
11571164
}else{
11581165
gitmirror_sanitize_name(zBranch);
11591166
}
@@ -1165,43 +1172,53 @@
11651172
fprintf(xCmd, "mark %s\n", zMark);
11661173
fossil_free(zMark);
11671174
sqlite3_snprintf(sizeof(buf), buf, "%lld",
11681175
(sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
11691176
);
1177
+
11701178
/*
11711179
** Check for 'fx_' table from previous Git import, otherwise take contact info
11721180
** from user table for <emailaddr> in committer field. If no emailaddr, check
11731181
** if username is in email form, otherwise use generic '[email protected]'.
11741182
*/
1175
- char *zTmp;
11761183
if (db_table_exists("repository", "fx_git")) {
11771184
zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser);
11781185
} else {
11791186
zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser);
11801187
}
1188
+
11811189
/* Some repo 'info' fields return an empty string hence the second check */
1182
- if (zEmail == NULL || zEmail[0] == '\0') {
1190
+ if( zEmail==0 ){
11831191
/* If username is in emailaddr form, don't append '@noemail.net' */
1184
- if (strchr(pMan->zUser, '@') == NULL) {
1192
+ if( pMan->zUser==0 || strchr(pMan->zUser, '@')==0 ){
11851193
zEmail = mprintf("%[email protected]", pMan->zUser);
11861194
} else {
11871195
zEmail = fossil_strdup(pMan->zUser);
11881196
}
1189
- } else if ((zTmp = strchr(zEmail, '<')) != NULL) {
1190
- ++zTmp;
1191
- char *zTmpEnd = strchr(zTmp, '>');
1192
- *(zTmpEnd) = '\0';
1193
- zEmail = fossil_strdup(zTmp);
1197
+ }else{
1198
+ char *zTmp = strchr(zEmail, '<');
1199
+ if( zTmp ){
1200
+ char *zTmpEnd = strchr(zTmp+1, '>');
1201
+ char *zNew;
1202
+ int i;
1203
+ if( zTmpEnd ) *(zTmpEnd) = 0;
1204
+ zNew = fossil_strdup(zTmp+1);
1205
+ fossil_free(zEmail);
1206
+ zEmail = zNew;
1207
+ for(i=0; zEmail[i] && !fossil_isspace(zEmail[i]); i++){}
1208
+ zEmail[i] = 0;
1209
+ }
11941210
}
1211
+ fprintf(xCmd, "# rid=%d\n", rid);
11951212
fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf);
11961213
fossil_free(zEmail);
11971214
blob_init(&comment, pMan->zComment, -1);
11981215
if( blob_size(&comment)==0 ){
11991216
blob_append(&comment, "(no comment)", -1);
12001217
}
12011218
blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid);
1202
- fprintf(xCmd, "data %d\n%s\n", blob_size(&comment), blob_str(&comment));
1219
+ fprintf(xCmd, "data %d\n%s\n", blob_strlen(&comment), blob_str(&comment));
12031220
blob_reset(&comment);
12041221
iParent = -1; /* Which ancestor is the primary parent */
12051222
for(i=0; i<pMan->nParent; i++){
12061223
char *zOther = gitmirror_find_mark(pMan->azParent[i],0,0);
12071224
if( zOther==0 ) continue;
@@ -1255,17 +1272,19 @@
12551272
zFNQuoted = gitmirror_quote_filename_if_needed(zFilename);
12561273
fprintf(xCmd,"M %s %s %s\n", zGitMode, zMark, zFNQuoted);
12571274
fossil_free(zFNQuoted);
12581275
}
12591276
db_finalize(&q);
1277
+ manifest_destroy(pMan);
1278
+ pMan = 0;
12601279
12611280
/* Include Fossil-generated auxiliary files in the check-in */
12621281
if( fManifest & MFESTFLG_RAW ){
12631282
Blob manifest;
12641283
content_get(rid, &manifest);
12651284
fprintf(xCmd,"M 100644 inline manifest\ndata %d\n%s\n",
1266
- blob_size(&manifest), blob_str(&manifest));
1285
+ blob_strlen(&manifest), blob_str(&manifest));
12671286
blob_reset(&manifest);
12681287
}
12691288
if( fManifest & MFESTFLG_UUID ){
12701289
int n = (int)strlen(zUuid);
12711290
fprintf(xCmd,"M 100644 inline manifest.uuid\ndata %d\n%s\n", n, zUuid);
@@ -1273,18 +1292,86 @@
12731292
if( fManifest & MFESTFLG_TAGS ){
12741293
Blob tagslist;
12751294
blob_init(&tagslist, 0, 0);
12761295
get_checkin_taglist(rid, &tagslist);
12771296
fprintf(xCmd,"M 100644 inline manifest.tags\ndata %d\n%s\n",
1278
- blob_size(&tagslist), blob_str(&tagslist));
1297
+ blob_strlen(&tagslist), blob_str(&tagslist));
12791298
blob_reset(&tagslist);
12801299
}
12811300
12821301
/* The check-in is finished, so decrement the counter */
12831302
(*pnLimit)--;
12841303
return 0;
12851304
}
1305
+
1306
+/*
1307
+** Create a new Git repository at zMirror to use as the mirror.
1308
+** Try to make zMainBr be the main branch for the new repository.
1309
+**
1310
+** A side-effect of this routine is that current-working directory
1311
+** is changed to zMirror.
1312
+**
1313
+** If zMainBr is initially NULL, then the return value will be the
1314
+** name of the default branch to be used by Git. If zMainBr is
1315
+** initially non-NULL, then the return value will be a copy of zMainBr.
1316
+*/
1317
+static char *gitmirror_init(
1318
+ const char *zMirror,
1319
+ char *zMainBr
1320
+){
1321
+ char *zCmd;
1322
+ int rc;
1323
+
1324
+ /* Create a new Git repository at zMirror */
1325
+ zCmd = mprintf("git init %$", zMirror);
1326
+ gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1327
+ rc = fossil_system(zCmd);
1328
+ if( rc ){
1329
+ fossil_fatal("cannot initialize git repository using: %s\n", zCmd);
1330
+ }
1331
+ fossil_free(zCmd);
1332
+
1333
+ /* Must be in the new Git repository directory for subsequent commands */
1334
+ rc = file_chdir(zMirror, 0);
1335
+ if( rc ){
1336
+ fossil_fatal("cannot change to directory \"%s\"", zMirror);
1337
+ }
1338
+
1339
+ if( zMainBr ){
1340
+ /* Set the current branch to zMainBr */
1341
+ zCmd = mprintf("git symbolic-ref HEAD refs/heads/%s", zMainBr);
1342
+ gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1343
+ rc = fossil_system(zCmd);
1344
+ if( rc ){
1345
+ fossil_fatal("git command failed: %s", zCmd);
1346
+ }
1347
+ fossil_free(zCmd);
1348
+ }else{
1349
+ /* If zMainBr is not specified, then check to see what branch
1350
+ ** name Git chose for itself */
1351
+ char *z;
1352
+ char zLine[1000];
1353
+ FILE *xCmd;
1354
+ int i;
1355
+ zCmd = "git symbolic-ref --short HEAD";
1356
+ gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1357
+ xCmd = popen(zCmd, "r");
1358
+ if( xCmd==0 ){
1359
+ fossil_fatal("git command failed: %s", zCmd);
1360
+ }
1361
+
1362
+ z = fgets(zLine, sizeof(zLine), xCmd);
1363
+ pclose(xCmd);
1364
+ if( z==0 ){
1365
+ fossil_fatal("no output from \"%s\"", zCmd);
1366
+ }
1367
+ for(i=0; z[i] && !fossil_isspace(z[i]); i++){}
1368
+ z[i] = 0;
1369
+ zMainBr = fossil_strdup(z);
1370
+ }
1371
+ return zMainBr;
1372
+}
12861373
12871374
/*
12881375
** Implementation of the "fossil git export" command.
12891376
*/
12901377
void gitmirror_export_command(void){
@@ -1294,10 +1381,11 @@
12941381
char *zMirror; /* Name of the mirror */
12951382
char *z; /* Generic string */
12961383
char *zCmd; /* git command to run as a subprocess */
12971384
const char *zDebug = 0; /* Value of the --debug flag */
12981385
const char *zAutoPush = 0; /* Value of the --autopush flag */
1386
+ char *zMainBr = 0; /* Value of the --mainbranch flag */
12991387
char *zPushUrl; /* URL to sync the mirror to */
13001388
double rEnd; /* time of most recent export */
13011389
int rc; /* Result code */
13021390
int bForce; /* Do the export and sync even if no changes*/
13031391
int bNeedRepack = 0; /* True if we should run repack at the end */
@@ -1314,10 +1402,11 @@
13141402
if( zLimit ){
13151403
nLimit = (unsigned int)atoi(zLimit);
13161404
if( nLimit<=0 ) fossil_fatal("--limit must be positive");
13171405
}
13181406
zAutoPush = find_option("autopush",0,1);
1407
+ zMainBr = (char*)find_option("mainbranch",0,1);
13191408
bForce = find_option("force","f",0)!=0;
13201409
bIfExists = find_option("if-mirrored",0,0)!=0;
13211410
gitmirror_verbosity = VERB_NORMAL;
13221411
while( find_option("quiet","q",0)!=0 ){ gitmirror_verbosity--; }
13231412
while( find_option("verbose","v",0)!=0 ){ gitmirror_verbosity++; }
@@ -1332,25 +1421,28 @@
13321421
zMirror = db_get("last-git-export-repo", 0);
13331422
if( zMirror==0 ){
13341423
if( bIfExists ) return;
13351424
fossil_fatal("no Git repository specified");
13361425
}
1426
+
1427
+ if( zMainBr ){
1428
+ z = fossil_strdup(zMainBr);
1429
+ gitmirror_sanitize_name(z);
1430
+ if( strcmp(z, zMainBr) ){
1431
+ fossil_fatal("\"%s\" is not a legal branch name for Git", zMainBr);
1432
+ }
1433
+ fossil_free(z);
1434
+ }
13371435
13381436
/* Make sure the GIT repository directory exists */
13391437
rc = file_mkdir(zMirror, ExtFILE, 0);
13401438
if( rc ) fossil_fatal("cannot create directory \"%s\"", zMirror);
13411439
13421440
/* Make sure GIT has been initialized */
13431441
z = mprintf("%s/.git", zMirror);
13441442
if( !file_isdir(z, ExtFILE) ){
1345
- zCmd = mprintf("git init %$",zMirror);
1346
- gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1347
- rc = fossil_system(zCmd);
1348
- if( rc ){
1349
- fossil_fatal("cannot initialize the git repository using: \"%s\"", zCmd);
1350
- }
1351
- fossil_free(zCmd);
1443
+ zMainBr = gitmirror_init(zMirror, zMainBr);
13521444
bNeedRepack = 1;
13531445
}
13541446
fossil_free(z);
13551447
13561448
/* Make sure the .mirror_state subdirectory exists */
@@ -1405,10 +1497,25 @@
14051497
"VALUES('autopush',%Q)",
14061498
zAutoPush
14071499
);
14081500
}
14091501
}
1502
+
1503
+ /* Change the mainbranch setting if the --mainbranch flag is present */
1504
+ if( zMainBr && zMainBr[0] ){
1505
+ db_multi_exec(
1506
+ "REPLACE INTO mirror.mconfig(key,value)"
1507
+ "VALUES('mainbranch',%Q)",
1508
+ zMainBr
1509
+ );
1510
+ gitmirror_mainbranch = fossil_strdup(zMainBr);
1511
+ }else{
1512
+ /* Recover the saved name of the main branch */
1513
+ gitmirror_mainbranch = db_text("master",
1514
+ "SELECT value FROM mconfig WHERE key='mainbranch'");
1515
+ }
1516
+
14101517
14111518
/* See if there is any work to be done. Exit early if not, before starting
14121519
** the "git fast-import" command. */
14131520
if( !bForce
14141521
&& !db_exists("SELECT 1 FROM event WHERE type IN ('ci','t')"
@@ -1444,11 +1551,11 @@
14441551
#ifdef _WIN32
14451552
xCmd = popen(zCmd, "wb");
14461553
#else
14471554
xCmd = popen(zCmd, "w");
14481555
#endif
1449
- if( zCmd==0 ){
1556
+ if( xCmd==0 ){
14501557
fossil_fatal("cannot start the \"git fast-import\" command");
14511558
}
14521559
fossil_free(zCmd);
14531560
}
14541561
@@ -1569,11 +1676,11 @@
15691676
char *zBrname = fossil_strdup(db_column_text(&q,0));
15701677
const char *zObj = db_column_text(&q,2);
15711678
char *zRefCmd;
15721679
if( fossil_strcmp(zBrname,"trunk")==0 ){
15731680
fossil_free(zBrname);
1574
- zBrname = fossil_strdup("master");
1681
+ zBrname = fossil_strdup(gitmirror_mainbranch);
15751682
}else{
15761683
gitmirror_sanitize_name(zBrname);
15771684
}
15781685
zRefCmd = mprintf("git update-ref \"refs/heads/%s\" %$", zBrname, zObj);
15791686
fossil_free(zBrname);
@@ -1651,17 +1758,20 @@
16511758
fossil_print("Autopush: off\n");
16521759
}else{
16531760
UrlData url;
16541761
url_parse_local(z, 0, &url);
16551762
fossil_print("Autopush: %s\n", url.canonical);
1763
+ fossil_free(z);
16561764
}
16571765
n = db_int(0,
16581766
"SELECT count(*) FROM event"
16591767
" WHERE type='ci'"
16601768
" AND mtime>coalesce((SELECT value FROM mconfig"
16611769
" WHERE key='start'),0.0)"
16621770
);
1771
+ z = db_text("master", "SELECT value FROM mconfig WHERE key='mainbranch'");
1772
+ fossil_print("Main-Branch: %s\n",z);
16631773
if( n==0 ){
16641774
fossil_print("Status: up-to-date\n");
16651775
}else{
16661776
fossil_print("Status: %d check-in%s awaiting export\n",
16671777
n, n==1 ? "" : "s");
@@ -1706,10 +1816,14 @@
17061816
** piping it into "git fast-import".
17071817
** --force|-f Do the export even if nothing has changed
17081818
** --if-mirrored No-op if the mirror does not already exist.
17091819
** --limit N Add no more than N new check-ins to MIRROR.
17101820
** Useful for debugging
1821
+** --mainbranch NAME Use NAME as the name of the main branch in Git.
1822
+** The "trunk" branch of the Fossil repository is
1823
+** mapped into this name. "master" is used if
1824
+** this option is omitted.
17111825
** --quiet|-q Reduce output. Repeat for even less output.
17121826
** --verbose|-v More output.
17131827
**
17141828
** > fossil git import MIRROR
17151829
**
17161830
--- src/export.c
+++ src/export.c
@@ -862,10 +862,15 @@
862 #define VERB_ERROR 1
863 #define VERB_NORMAL 2
864 #define VERB_EXTRA 3
865 static int gitmirror_verbosity = VERB_NORMAL;
866
 
 
 
 
 
867 /*
868 ** Output routine that depends on verbosity
869 */
870 static void gitmirror_message(int iLevel, const char *zFormat, ...){
871 va_list ap;
@@ -1139,21 +1144,23 @@
1139 ** export */
1140 if( nErr ){
1141 gitmirror_message(VERB_ERROR,
1142 "export of %s abandoned due to missing files\n", zUuid);
1143 *pnLimit = 0;
 
1144 return 1;
1145 }
1146
1147 /* Figure out which branch this check-in is a member of */
1148 zBranch = db_text(0,
1149 "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
1150 TAG_BRANCH, rid
1151 );
1152 if( fossil_strcmp(zBranch,"trunk")==0 ){
 
1153 fossil_free(zBranch);
1154 zBranch = mprintf("master");
1155 }else if( zBranch==0 ){
1156 zBranch = mprintf("unknown");
1157 }else{
1158 gitmirror_sanitize_name(zBranch);
1159 }
@@ -1165,43 +1172,53 @@
1165 fprintf(xCmd, "mark %s\n", zMark);
1166 fossil_free(zMark);
1167 sqlite3_snprintf(sizeof(buf), buf, "%lld",
1168 (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
1169 );
 
1170 /*
1171 ** Check for 'fx_' table from previous Git import, otherwise take contact info
1172 ** from user table for <emailaddr> in committer field. If no emailaddr, check
1173 ** if username is in email form, otherwise use generic '[email protected]'.
1174 */
1175 char *zTmp;
1176 if (db_table_exists("repository", "fx_git")) {
1177 zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser);
1178 } else {
1179 zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser);
1180 }
 
1181 /* Some repo 'info' fields return an empty string hence the second check */
1182 if (zEmail == NULL || zEmail[0] == '\0') {
1183 /* If username is in emailaddr form, don't append '@noemail.net' */
1184 if (strchr(pMan->zUser, '@') == NULL) {
1185 zEmail = mprintf("%[email protected]", pMan->zUser);
1186 } else {
1187 zEmail = fossil_strdup(pMan->zUser);
1188 }
1189 } else if ((zTmp = strchr(zEmail, '<')) != NULL) {
1190 ++zTmp;
1191 char *zTmpEnd = strchr(zTmp, '>');
1192 *(zTmpEnd) = '\0';
1193 zEmail = fossil_strdup(zTmp);
 
 
 
 
 
 
 
 
1194 }
 
1195 fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf);
1196 fossil_free(zEmail);
1197 blob_init(&comment, pMan->zComment, -1);
1198 if( blob_size(&comment)==0 ){
1199 blob_append(&comment, "(no comment)", -1);
1200 }
1201 blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid);
1202 fprintf(xCmd, "data %d\n%s\n", blob_size(&comment), blob_str(&comment));
1203 blob_reset(&comment);
1204 iParent = -1; /* Which ancestor is the primary parent */
1205 for(i=0; i<pMan->nParent; i++){
1206 char *zOther = gitmirror_find_mark(pMan->azParent[i],0,0);
1207 if( zOther==0 ) continue;
@@ -1255,17 +1272,19 @@
1255 zFNQuoted = gitmirror_quote_filename_if_needed(zFilename);
1256 fprintf(xCmd,"M %s %s %s\n", zGitMode, zMark, zFNQuoted);
1257 fossil_free(zFNQuoted);
1258 }
1259 db_finalize(&q);
 
 
1260
1261 /* Include Fossil-generated auxiliary files in the check-in */
1262 if( fManifest & MFESTFLG_RAW ){
1263 Blob manifest;
1264 content_get(rid, &manifest);
1265 fprintf(xCmd,"M 100644 inline manifest\ndata %d\n%s\n",
1266 blob_size(&manifest), blob_str(&manifest));
1267 blob_reset(&manifest);
1268 }
1269 if( fManifest & MFESTFLG_UUID ){
1270 int n = (int)strlen(zUuid);
1271 fprintf(xCmd,"M 100644 inline manifest.uuid\ndata %d\n%s\n", n, zUuid);
@@ -1273,18 +1292,86 @@
1273 if( fManifest & MFESTFLG_TAGS ){
1274 Blob tagslist;
1275 blob_init(&tagslist, 0, 0);
1276 get_checkin_taglist(rid, &tagslist);
1277 fprintf(xCmd,"M 100644 inline manifest.tags\ndata %d\n%s\n",
1278 blob_size(&tagslist), blob_str(&tagslist));
1279 blob_reset(&tagslist);
1280 }
1281
1282 /* The check-in is finished, so decrement the counter */
1283 (*pnLimit)--;
1284 return 0;
1285 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1286
1287 /*
1288 ** Implementation of the "fossil git export" command.
1289 */
1290 void gitmirror_export_command(void){
@@ -1294,10 +1381,11 @@
1294 char *zMirror; /* Name of the mirror */
1295 char *z; /* Generic string */
1296 char *zCmd; /* git command to run as a subprocess */
1297 const char *zDebug = 0; /* Value of the --debug flag */
1298 const char *zAutoPush = 0; /* Value of the --autopush flag */
 
1299 char *zPushUrl; /* URL to sync the mirror to */
1300 double rEnd; /* time of most recent export */
1301 int rc; /* Result code */
1302 int bForce; /* Do the export and sync even if no changes*/
1303 int bNeedRepack = 0; /* True if we should run repack at the end */
@@ -1314,10 +1402,11 @@
1314 if( zLimit ){
1315 nLimit = (unsigned int)atoi(zLimit);
1316 if( nLimit<=0 ) fossil_fatal("--limit must be positive");
1317 }
1318 zAutoPush = find_option("autopush",0,1);
 
1319 bForce = find_option("force","f",0)!=0;
1320 bIfExists = find_option("if-mirrored",0,0)!=0;
1321 gitmirror_verbosity = VERB_NORMAL;
1322 while( find_option("quiet","q",0)!=0 ){ gitmirror_verbosity--; }
1323 while( find_option("verbose","v",0)!=0 ){ gitmirror_verbosity++; }
@@ -1332,25 +1421,28 @@
1332 zMirror = db_get("last-git-export-repo", 0);
1333 if( zMirror==0 ){
1334 if( bIfExists ) return;
1335 fossil_fatal("no Git repository specified");
1336 }
 
 
 
 
 
 
 
 
 
1337
1338 /* Make sure the GIT repository directory exists */
1339 rc = file_mkdir(zMirror, ExtFILE, 0);
1340 if( rc ) fossil_fatal("cannot create directory \"%s\"", zMirror);
1341
1342 /* Make sure GIT has been initialized */
1343 z = mprintf("%s/.git", zMirror);
1344 if( !file_isdir(z, ExtFILE) ){
1345 zCmd = mprintf("git init %$",zMirror);
1346 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1347 rc = fossil_system(zCmd);
1348 if( rc ){
1349 fossil_fatal("cannot initialize the git repository using: \"%s\"", zCmd);
1350 }
1351 fossil_free(zCmd);
1352 bNeedRepack = 1;
1353 }
1354 fossil_free(z);
1355
1356 /* Make sure the .mirror_state subdirectory exists */
@@ -1405,10 +1497,25 @@
1405 "VALUES('autopush',%Q)",
1406 zAutoPush
1407 );
1408 }
1409 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1410
1411 /* See if there is any work to be done. Exit early if not, before starting
1412 ** the "git fast-import" command. */
1413 if( !bForce
1414 && !db_exists("SELECT 1 FROM event WHERE type IN ('ci','t')"
@@ -1444,11 +1551,11 @@
1444 #ifdef _WIN32
1445 xCmd = popen(zCmd, "wb");
1446 #else
1447 xCmd = popen(zCmd, "w");
1448 #endif
1449 if( zCmd==0 ){
1450 fossil_fatal("cannot start the \"git fast-import\" command");
1451 }
1452 fossil_free(zCmd);
1453 }
1454
@@ -1569,11 +1676,11 @@
1569 char *zBrname = fossil_strdup(db_column_text(&q,0));
1570 const char *zObj = db_column_text(&q,2);
1571 char *zRefCmd;
1572 if( fossil_strcmp(zBrname,"trunk")==0 ){
1573 fossil_free(zBrname);
1574 zBrname = fossil_strdup("master");
1575 }else{
1576 gitmirror_sanitize_name(zBrname);
1577 }
1578 zRefCmd = mprintf("git update-ref \"refs/heads/%s\" %$", zBrname, zObj);
1579 fossil_free(zBrname);
@@ -1651,17 +1758,20 @@
1651 fossil_print("Autopush: off\n");
1652 }else{
1653 UrlData url;
1654 url_parse_local(z, 0, &url);
1655 fossil_print("Autopush: %s\n", url.canonical);
 
1656 }
1657 n = db_int(0,
1658 "SELECT count(*) FROM event"
1659 " WHERE type='ci'"
1660 " AND mtime>coalesce((SELECT value FROM mconfig"
1661 " WHERE key='start'),0.0)"
1662 );
 
 
1663 if( n==0 ){
1664 fossil_print("Status: up-to-date\n");
1665 }else{
1666 fossil_print("Status: %d check-in%s awaiting export\n",
1667 n, n==1 ? "" : "s");
@@ -1706,10 +1816,14 @@
1706 ** piping it into "git fast-import".
1707 ** --force|-f Do the export even if nothing has changed
1708 ** --if-mirrored No-op if the mirror does not already exist.
1709 ** --limit N Add no more than N new check-ins to MIRROR.
1710 ** Useful for debugging
 
 
 
 
1711 ** --quiet|-q Reduce output. Repeat for even less output.
1712 ** --verbose|-v More output.
1713 **
1714 ** > fossil git import MIRROR
1715 **
1716
--- src/export.c
+++ src/export.c
@@ -862,10 +862,15 @@
862 #define VERB_ERROR 1
863 #define VERB_NORMAL 2
864 #define VERB_EXTRA 3
865 static int gitmirror_verbosity = VERB_NORMAL;
866
867 /* The main branch in the Git repository. The "trunk" branch of
868 ** Fossil is renamed to be this branch name.
869 */
870 static const char *gitmirror_mainbranch = 0;
871
872 /*
873 ** Output routine that depends on verbosity
874 */
875 static void gitmirror_message(int iLevel, const char *zFormat, ...){
876 va_list ap;
@@ -1139,21 +1144,23 @@
1144 ** export */
1145 if( nErr ){
1146 gitmirror_message(VERB_ERROR,
1147 "export of %s abandoned due to missing files\n", zUuid);
1148 *pnLimit = 0;
1149 manifest_destroy(pMan);
1150 return 1;
1151 }
1152
1153 /* Figure out which branch this check-in is a member of */
1154 zBranch = db_text(0,
1155 "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
1156 TAG_BRANCH, rid
1157 );
1158 if( fossil_strcmp(zBranch,"trunk")==0 ){
1159 assert( gitmirror_mainbranch!=0 );
1160 fossil_free(zBranch);
1161 zBranch = mprintf("%s",gitmirror_mainbranch);
1162 }else if( zBranch==0 ){
1163 zBranch = mprintf("unknown");
1164 }else{
1165 gitmirror_sanitize_name(zBranch);
1166 }
@@ -1165,43 +1172,53 @@
1172 fprintf(xCmd, "mark %s\n", zMark);
1173 fossil_free(zMark);
1174 sqlite3_snprintf(sizeof(buf), buf, "%lld",
1175 (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
1176 );
1177
1178 /*
1179 ** Check for 'fx_' table from previous Git import, otherwise take contact info
1180 ** from user table for <emailaddr> in committer field. If no emailaddr, check
1181 ** if username is in email form, otherwise use generic '[email protected]'.
1182 */
 
1183 if (db_table_exists("repository", "fx_git")) {
1184 zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser);
1185 } else {
1186 zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser);
1187 }
1188
1189 /* Some repo 'info' fields return an empty string hence the second check */
1190 if( zEmail==0 ){
1191 /* If username is in emailaddr form, don't append '@noemail.net' */
1192 if( pMan->zUser==0 || strchr(pMan->zUser, '@')==0 ){
1193 zEmail = mprintf("%[email protected]", pMan->zUser);
1194 } else {
1195 zEmail = fossil_strdup(pMan->zUser);
1196 }
1197 }else{
1198 char *zTmp = strchr(zEmail, '<');
1199 if( zTmp ){
1200 char *zTmpEnd = strchr(zTmp+1, '>');
1201 char *zNew;
1202 int i;
1203 if( zTmpEnd ) *(zTmpEnd) = 0;
1204 zNew = fossil_strdup(zTmp+1);
1205 fossil_free(zEmail);
1206 zEmail = zNew;
1207 for(i=0; zEmail[i] && !fossil_isspace(zEmail[i]); i++){}
1208 zEmail[i] = 0;
1209 }
1210 }
1211 fprintf(xCmd, "# rid=%d\n", rid);
1212 fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf);
1213 fossil_free(zEmail);
1214 blob_init(&comment, pMan->zComment, -1);
1215 if( blob_size(&comment)==0 ){
1216 blob_append(&comment, "(no comment)", -1);
1217 }
1218 blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid);
1219 fprintf(xCmd, "data %d\n%s\n", blob_strlen(&comment), blob_str(&comment));
1220 blob_reset(&comment);
1221 iParent = -1; /* Which ancestor is the primary parent */
1222 for(i=0; i<pMan->nParent; i++){
1223 char *zOther = gitmirror_find_mark(pMan->azParent[i],0,0);
1224 if( zOther==0 ) continue;
@@ -1255,17 +1272,19 @@
1272 zFNQuoted = gitmirror_quote_filename_if_needed(zFilename);
1273 fprintf(xCmd,"M %s %s %s\n", zGitMode, zMark, zFNQuoted);
1274 fossil_free(zFNQuoted);
1275 }
1276 db_finalize(&q);
1277 manifest_destroy(pMan);
1278 pMan = 0;
1279
1280 /* Include Fossil-generated auxiliary files in the check-in */
1281 if( fManifest & MFESTFLG_RAW ){
1282 Blob manifest;
1283 content_get(rid, &manifest);
1284 fprintf(xCmd,"M 100644 inline manifest\ndata %d\n%s\n",
1285 blob_strlen(&manifest), blob_str(&manifest));
1286 blob_reset(&manifest);
1287 }
1288 if( fManifest & MFESTFLG_UUID ){
1289 int n = (int)strlen(zUuid);
1290 fprintf(xCmd,"M 100644 inline manifest.uuid\ndata %d\n%s\n", n, zUuid);
@@ -1273,18 +1292,86 @@
1292 if( fManifest & MFESTFLG_TAGS ){
1293 Blob tagslist;
1294 blob_init(&tagslist, 0, 0);
1295 get_checkin_taglist(rid, &tagslist);
1296 fprintf(xCmd,"M 100644 inline manifest.tags\ndata %d\n%s\n",
1297 blob_strlen(&tagslist), blob_str(&tagslist));
1298 blob_reset(&tagslist);
1299 }
1300
1301 /* The check-in is finished, so decrement the counter */
1302 (*pnLimit)--;
1303 return 0;
1304 }
1305
1306 /*
1307 ** Create a new Git repository at zMirror to use as the mirror.
1308 ** Try to make zMainBr be the main branch for the new repository.
1309 **
1310 ** A side-effect of this routine is that current-working directory
1311 ** is changed to zMirror.
1312 **
1313 ** If zMainBr is initially NULL, then the return value will be the
1314 ** name of the default branch to be used by Git. If zMainBr is
1315 ** initially non-NULL, then the return value will be a copy of zMainBr.
1316 */
1317 static char *gitmirror_init(
1318 const char *zMirror,
1319 char *zMainBr
1320 ){
1321 char *zCmd;
1322 int rc;
1323
1324 /* Create a new Git repository at zMirror */
1325 zCmd = mprintf("git init %$", zMirror);
1326 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1327 rc = fossil_system(zCmd);
1328 if( rc ){
1329 fossil_fatal("cannot initialize git repository using: %s\n", zCmd);
1330 }
1331 fossil_free(zCmd);
1332
1333 /* Must be in the new Git repository directory for subsequent commands */
1334 rc = file_chdir(zMirror, 0);
1335 if( rc ){
1336 fossil_fatal("cannot change to directory \"%s\"", zMirror);
1337 }
1338
1339 if( zMainBr ){
1340 /* Set the current branch to zMainBr */
1341 zCmd = mprintf("git symbolic-ref HEAD refs/heads/%s", zMainBr);
1342 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1343 rc = fossil_system(zCmd);
1344 if( rc ){
1345 fossil_fatal("git command failed: %s", zCmd);
1346 }
1347 fossil_free(zCmd);
1348 }else{
1349 /* If zMainBr is not specified, then check to see what branch
1350 ** name Git chose for itself */
1351 char *z;
1352 char zLine[1000];
1353 FILE *xCmd;
1354 int i;
1355 zCmd = "git symbolic-ref --short HEAD";
1356 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1357 xCmd = popen(zCmd, "r");
1358 if( xCmd==0 ){
1359 fossil_fatal("git command failed: %s", zCmd);
1360 }
1361
1362 z = fgets(zLine, sizeof(zLine), xCmd);
1363 pclose(xCmd);
1364 if( z==0 ){
1365 fossil_fatal("no output from \"%s\"", zCmd);
1366 }
1367 for(i=0; z[i] && !fossil_isspace(z[i]); i++){}
1368 z[i] = 0;
1369 zMainBr = fossil_strdup(z);
1370 }
1371 return zMainBr;
1372 }
1373
1374 /*
1375 ** Implementation of the "fossil git export" command.
1376 */
1377 void gitmirror_export_command(void){
@@ -1294,10 +1381,11 @@
1381 char *zMirror; /* Name of the mirror */
1382 char *z; /* Generic string */
1383 char *zCmd; /* git command to run as a subprocess */
1384 const char *zDebug = 0; /* Value of the --debug flag */
1385 const char *zAutoPush = 0; /* Value of the --autopush flag */
1386 char *zMainBr = 0; /* Value of the --mainbranch flag */
1387 char *zPushUrl; /* URL to sync the mirror to */
1388 double rEnd; /* time of most recent export */
1389 int rc; /* Result code */
1390 int bForce; /* Do the export and sync even if no changes*/
1391 int bNeedRepack = 0; /* True if we should run repack at the end */
@@ -1314,10 +1402,11 @@
1402 if( zLimit ){
1403 nLimit = (unsigned int)atoi(zLimit);
1404 if( nLimit<=0 ) fossil_fatal("--limit must be positive");
1405 }
1406 zAutoPush = find_option("autopush",0,1);
1407 zMainBr = (char*)find_option("mainbranch",0,1);
1408 bForce = find_option("force","f",0)!=0;
1409 bIfExists = find_option("if-mirrored",0,0)!=0;
1410 gitmirror_verbosity = VERB_NORMAL;
1411 while( find_option("quiet","q",0)!=0 ){ gitmirror_verbosity--; }
1412 while( find_option("verbose","v",0)!=0 ){ gitmirror_verbosity++; }
@@ -1332,25 +1421,28 @@
1421 zMirror = db_get("last-git-export-repo", 0);
1422 if( zMirror==0 ){
1423 if( bIfExists ) return;
1424 fossil_fatal("no Git repository specified");
1425 }
1426
1427 if( zMainBr ){
1428 z = fossil_strdup(zMainBr);
1429 gitmirror_sanitize_name(z);
1430 if( strcmp(z, zMainBr) ){
1431 fossil_fatal("\"%s\" is not a legal branch name for Git", zMainBr);
1432 }
1433 fossil_free(z);
1434 }
1435
1436 /* Make sure the GIT repository directory exists */
1437 rc = file_mkdir(zMirror, ExtFILE, 0);
1438 if( rc ) fossil_fatal("cannot create directory \"%s\"", zMirror);
1439
1440 /* Make sure GIT has been initialized */
1441 z = mprintf("%s/.git", zMirror);
1442 if( !file_isdir(z, ExtFILE) ){
1443 zMainBr = gitmirror_init(zMirror, zMainBr);
 
 
 
 
 
 
1444 bNeedRepack = 1;
1445 }
1446 fossil_free(z);
1447
1448 /* Make sure the .mirror_state subdirectory exists */
@@ -1405,10 +1497,25 @@
1497 "VALUES('autopush',%Q)",
1498 zAutoPush
1499 );
1500 }
1501 }
1502
1503 /* Change the mainbranch setting if the --mainbranch flag is present */
1504 if( zMainBr && zMainBr[0] ){
1505 db_multi_exec(
1506 "REPLACE INTO mirror.mconfig(key,value)"
1507 "VALUES('mainbranch',%Q)",
1508 zMainBr
1509 );
1510 gitmirror_mainbranch = fossil_strdup(zMainBr);
1511 }else{
1512 /* Recover the saved name of the main branch */
1513 gitmirror_mainbranch = db_text("master",
1514 "SELECT value FROM mconfig WHERE key='mainbranch'");
1515 }
1516
1517
1518 /* See if there is any work to be done. Exit early if not, before starting
1519 ** the "git fast-import" command. */
1520 if( !bForce
1521 && !db_exists("SELECT 1 FROM event WHERE type IN ('ci','t')"
@@ -1444,11 +1551,11 @@
1551 #ifdef _WIN32
1552 xCmd = popen(zCmd, "wb");
1553 #else
1554 xCmd = popen(zCmd, "w");
1555 #endif
1556 if( xCmd==0 ){
1557 fossil_fatal("cannot start the \"git fast-import\" command");
1558 }
1559 fossil_free(zCmd);
1560 }
1561
@@ -1569,11 +1676,11 @@
1676 char *zBrname = fossil_strdup(db_column_text(&q,0));
1677 const char *zObj = db_column_text(&q,2);
1678 char *zRefCmd;
1679 if( fossil_strcmp(zBrname,"trunk")==0 ){
1680 fossil_free(zBrname);
1681 zBrname = fossil_strdup(gitmirror_mainbranch);
1682 }else{
1683 gitmirror_sanitize_name(zBrname);
1684 }
1685 zRefCmd = mprintf("git update-ref \"refs/heads/%s\" %$", zBrname, zObj);
1686 fossil_free(zBrname);
@@ -1651,17 +1758,20 @@
1758 fossil_print("Autopush: off\n");
1759 }else{
1760 UrlData url;
1761 url_parse_local(z, 0, &url);
1762 fossil_print("Autopush: %s\n", url.canonical);
1763 fossil_free(z);
1764 }
1765 n = db_int(0,
1766 "SELECT count(*) FROM event"
1767 " WHERE type='ci'"
1768 " AND mtime>coalesce((SELECT value FROM mconfig"
1769 " WHERE key='start'),0.0)"
1770 );
1771 z = db_text("master", "SELECT value FROM mconfig WHERE key='mainbranch'");
1772 fossil_print("Main-Branch: %s\n",z);
1773 if( n==0 ){
1774 fossil_print("Status: up-to-date\n");
1775 }else{
1776 fossil_print("Status: %d check-in%s awaiting export\n",
1777 n, n==1 ? "" : "s");
@@ -1706,10 +1816,14 @@
1816 ** piping it into "git fast-import".
1817 ** --force|-f Do the export even if nothing has changed
1818 ** --if-mirrored No-op if the mirror does not already exist.
1819 ** --limit N Add no more than N new check-ins to MIRROR.
1820 ** Useful for debugging
1821 ** --mainbranch NAME Use NAME as the name of the main branch in Git.
1822 ** The "trunk" branch of the Fossil repository is
1823 ** mapped into this name. "master" is used if
1824 ** this option is omitted.
1825 ** --quiet|-q Reduce output. Repeat for even less output.
1826 ** --verbose|-v More output.
1827 **
1828 ** > fossil git import MIRROR
1829 **
1830
+3 -2
--- src/extcgi.c
+++ src/extcgi.c
@@ -143,11 +143,11 @@
143143
** so that the secondary CGI can be aware of the credentials and
144144
** capabilities of the Fossil user.
145145
**
146146
** The /ext page is only functional if the "extroot: DIR" setting is
147147
** found in the CGI script that launched Fossil, or if the "--extroot DIR"
148
-** flag is present when Fossil is lauched using the "server", "ui", or
148
+** flag is present when Fossil is launched using the "server", "ui", or
149149
** "http" commands. DIR must be an absolute pathname (relative to the
150150
** chroot jail) of the root of the file hierarchy that implements the CGI
151151
** functionality. Executable files are CGI. Non-executable files are
152152
** static content.
153153
**
@@ -395,10 +395,11 @@
395395
if( !g.perm.Admin ){
396396
login_needed(0);
397397
return;
398398
}
399399
ext_files();
400
+ style_set_current_feature("extcgi");
400401
style_header("CGI Extension Filelist");
401402
@ <table border="0" cellspacing="0" cellpadding="3">
402403
@ <tbody>
403404
db_prepare(&q, "SELECT pathname, isexe FROM sfile"
404405
" ORDER BY pathname");
@@ -420,7 +421,7 @@
420421
@ </tr>
421422
}
422423
db_finalize(&q);
423424
@ </tbody>
424425
@ </table>
425
- style_finish_page("extcgi");
426
+ style_finish_page();
426427
}
427428
--- src/extcgi.c
+++ src/extcgi.c
@@ -143,11 +143,11 @@
143 ** so that the secondary CGI can be aware of the credentials and
144 ** capabilities of the Fossil user.
145 **
146 ** The /ext page is only functional if the "extroot: DIR" setting is
147 ** found in the CGI script that launched Fossil, or if the "--extroot DIR"
148 ** flag is present when Fossil is lauched using the "server", "ui", or
149 ** "http" commands. DIR must be an absolute pathname (relative to the
150 ** chroot jail) of the root of the file hierarchy that implements the CGI
151 ** functionality. Executable files are CGI. Non-executable files are
152 ** static content.
153 **
@@ -395,10 +395,11 @@
395 if( !g.perm.Admin ){
396 login_needed(0);
397 return;
398 }
399 ext_files();
 
400 style_header("CGI Extension Filelist");
401 @ <table border="0" cellspacing="0" cellpadding="3">
402 @ <tbody>
403 db_prepare(&q, "SELECT pathname, isexe FROM sfile"
404 " ORDER BY pathname");
@@ -420,7 +421,7 @@
420 @ </tr>
421 }
422 db_finalize(&q);
423 @ </tbody>
424 @ </table>
425 style_finish_page("extcgi");
426 }
427
--- src/extcgi.c
+++ src/extcgi.c
@@ -143,11 +143,11 @@
143 ** so that the secondary CGI can be aware of the credentials and
144 ** capabilities of the Fossil user.
145 **
146 ** The /ext page is only functional if the "extroot: DIR" setting is
147 ** found in the CGI script that launched Fossil, or if the "--extroot DIR"
148 ** flag is present when Fossil is launched using the "server", "ui", or
149 ** "http" commands. DIR must be an absolute pathname (relative to the
150 ** chroot jail) of the root of the file hierarchy that implements the CGI
151 ** functionality. Executable files are CGI. Non-executable files are
152 ** static content.
153 **
@@ -395,10 +395,11 @@
395 if( !g.perm.Admin ){
396 login_needed(0);
397 return;
398 }
399 ext_files();
400 style_set_current_feature("extcgi");
401 style_header("CGI Extension Filelist");
402 @ <table border="0" cellspacing="0" cellpadding="3">
403 @ <tbody>
404 db_prepare(&q, "SELECT pathname, isexe FROM sfile"
405 " ORDER BY pathname");
@@ -420,7 +421,7 @@
421 @ </tr>
422 }
423 db_finalize(&q);
424 @ </tbody>
425 @ </table>
426 style_finish_page();
427 }
428
+2 -2
--- src/fileedit.c
+++ src/fileedit.c
@@ -1606,11 +1606,11 @@
16061606
"values matching files which may be edited online."
16071607
"</p>\n");
16081608
}else{
16091609
CX("<p>Online editing is disabled for this repository.</p>\n");
16101610
}
1611
- style_finish_page("fileedit");
1611
+ style_finish_page();
16121612
return;
16131613
}
16141614
16151615
/* Dispatch AJAX methods based tail of the request URI.
16161616
** The AJAX parts do their own permissions/CSRF check and
@@ -2061,7 +2061,7 @@
20612061
style_script_end();
20622062
}
20632063
blob_reset(&err);
20642064
CheckinMiniInfo_cleanup(&cimi);
20652065
db_end_transaction(0);
2066
- style_finish_page("fileedit");
2066
+ style_finish_page();
20672067
}
20682068
--- src/fileedit.c
+++ src/fileedit.c
@@ -1606,11 +1606,11 @@
1606 "values matching files which may be edited online."
1607 "</p>\n");
1608 }else{
1609 CX("<p>Online editing is disabled for this repository.</p>\n");
1610 }
1611 style_finish_page("fileedit");
1612 return;
1613 }
1614
1615 /* Dispatch AJAX methods based tail of the request URI.
1616 ** The AJAX parts do their own permissions/CSRF check and
@@ -2061,7 +2061,7 @@
2061 style_script_end();
2062 }
2063 blob_reset(&err);
2064 CheckinMiniInfo_cleanup(&cimi);
2065 db_end_transaction(0);
2066 style_finish_page("fileedit");
2067 }
2068
--- src/fileedit.c
+++ src/fileedit.c
@@ -1606,11 +1606,11 @@
1606 "values matching files which may be edited online."
1607 "</p>\n");
1608 }else{
1609 CX("<p>Online editing is disabled for this repository.</p>\n");
1610 }
1611 style_finish_page();
1612 return;
1613 }
1614
1615 /* Dispatch AJAX methods based tail of the request URI.
1616 ** The AJAX parts do their own permissions/CSRF check and
@@ -2061,7 +2061,7 @@
2061 style_script_end();
2062 }
2063 blob_reset(&err);
2064 CheckinMiniInfo_cleanup(&cimi);
2065 db_end_transaction(0);
2066 style_finish_page();
2067 }
2068
+5 -4
--- src/finfo.c
+++ src/finfo.c
@@ -367,11 +367,11 @@
367367
ridFrom = name_to_rid_www("from");
368368
zPrevDate[0] = 0;
369369
cookie_render();
370370
if( fnid==0 ){
371371
@ No such file: %h(zFilename)
372
- style_finish_page("finfo");
372
+ style_finish_page();
373373
return;
374374
}
375375
if( g.perm.Admin ){
376376
style_submenu_element("MLink Table", "%R/mlink?name=%t", zFilename);
377377
}
@@ -705,11 +705,11 @@
705705
@ <span id='links-%d(frid)'><span class='timelineExtraLinks'>
706706
@ %z(href("%R/annotate?filename=%h&checkin=%s",z,zCkin))
707707
@ [annotate]</a>
708708
@ %z(href("%R/blame?filename=%h&checkin=%s",z,zCkin))
709709
@ [blame]</a>
710
- @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
710
+ @ %z(href("%R/timeline?uf=%!S",zUuid))[check-ins&nbsp;using]</a>
711711
if( fpid>0 ){
712712
@ %z(href("%R/fdiff?v1=%!S&v2=%!S",zPUuid,zUuid))[diff]</a>
713713
}
714714
if( fileedit_is_editable(zFName) ){
715715
@ %z(href("%R/fileedit?filename=%T&checkin=%!S",zFName,zCkin))\
@@ -754,11 +754,11 @@
754754
@ <td></td><td></td><td></td></tr>
755755
}
756756
}
757757
@ </table>
758758
timeline_output_graph_javascript(pGraph, TIMELINE_FILEDIFF, iTableId);
759
- style_finish_page("finfo");
759
+ style_finish_page();
760760
}
761761
762762
/*
763763
** WEBPAGE: mlink
764764
** URL: /mlink?name=FILENAME
@@ -779,10 +779,11 @@
779779
const char *zCI = P("ci");
780780
Stmt q;
781781
782782
login_check_credentials();
783783
if( !g.perm.Admin ){ login_needed(g.anon.Admin); return; }
784
+ style_set_current_feature("finfo");
784785
style_header("MLINK Table");
785786
if( zFName==0 && zCI==0 ){
786787
@ <span class='generalError'>
787788
@ Requires either a name= or ci= query parameter
788789
@ </span>
@@ -934,7 +935,7 @@
934935
db_finalize(&q);
935936
@ </tbody>
936937
@ </table>
937938
@ </div>
938939
}
939
- style_finish_page("finfo");
940
+ style_finish_page();
940941
}
941942
--- src/finfo.c
+++ src/finfo.c
@@ -367,11 +367,11 @@
367 ridFrom = name_to_rid_www("from");
368 zPrevDate[0] = 0;
369 cookie_render();
370 if( fnid==0 ){
371 @ No such file: %h(zFilename)
372 style_finish_page("finfo");
373 return;
374 }
375 if( g.perm.Admin ){
376 style_submenu_element("MLink Table", "%R/mlink?name=%t", zFilename);
377 }
@@ -705,11 +705,11 @@
705 @ <span id='links-%d(frid)'><span class='timelineExtraLinks'>
706 @ %z(href("%R/annotate?filename=%h&checkin=%s",z,zCkin))
707 @ [annotate]</a>
708 @ %z(href("%R/blame?filename=%h&checkin=%s",z,zCkin))
709 @ [blame]</a>
710 @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
711 if( fpid>0 ){
712 @ %z(href("%R/fdiff?v1=%!S&v2=%!S",zPUuid,zUuid))[diff]</a>
713 }
714 if( fileedit_is_editable(zFName) ){
715 @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zFName,zCkin))\
@@ -754,11 +754,11 @@
754 @ <td></td><td></td><td></td></tr>
755 }
756 }
757 @ </table>
758 timeline_output_graph_javascript(pGraph, TIMELINE_FILEDIFF, iTableId);
759 style_finish_page("finfo");
760 }
761
762 /*
763 ** WEBPAGE: mlink
764 ** URL: /mlink?name=FILENAME
@@ -779,10 +779,11 @@
779 const char *zCI = P("ci");
780 Stmt q;
781
782 login_check_credentials();
783 if( !g.perm.Admin ){ login_needed(g.anon.Admin); return; }
 
784 style_header("MLINK Table");
785 if( zFName==0 && zCI==0 ){
786 @ <span class='generalError'>
787 @ Requires either a name= or ci= query parameter
788 @ </span>
@@ -934,7 +935,7 @@
934 db_finalize(&q);
935 @ </tbody>
936 @ </table>
937 @ </div>
938 }
939 style_finish_page("finfo");
940 }
941
--- src/finfo.c
+++ src/finfo.c
@@ -367,11 +367,11 @@
367 ridFrom = name_to_rid_www("from");
368 zPrevDate[0] = 0;
369 cookie_render();
370 if( fnid==0 ){
371 @ No such file: %h(zFilename)
372 style_finish_page();
373 return;
374 }
375 if( g.perm.Admin ){
376 style_submenu_element("MLink Table", "%R/mlink?name=%t", zFilename);
377 }
@@ -705,11 +705,11 @@
705 @ <span id='links-%d(frid)'><span class='timelineExtraLinks'>
706 @ %z(href("%R/annotate?filename=%h&checkin=%s",z,zCkin))
707 @ [annotate]</a>
708 @ %z(href("%R/blame?filename=%h&checkin=%s",z,zCkin))
709 @ [blame]</a>
710 @ %z(href("%R/timeline?uf=%!S",zUuid))[check-ins&nbsp;using]</a>
711 if( fpid>0 ){
712 @ %z(href("%R/fdiff?v1=%!S&v2=%!S",zPUuid,zUuid))[diff]</a>
713 }
714 if( fileedit_is_editable(zFName) ){
715 @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zFName,zCkin))\
@@ -754,11 +754,11 @@
754 @ <td></td><td></td><td></td></tr>
755 }
756 }
757 @ </table>
758 timeline_output_graph_javascript(pGraph, TIMELINE_FILEDIFF, iTableId);
759 style_finish_page();
760 }
761
762 /*
763 ** WEBPAGE: mlink
764 ** URL: /mlink?name=FILENAME
@@ -779,10 +779,11 @@
779 const char *zCI = P("ci");
780 Stmt q;
781
782 login_check_credentials();
783 if( !g.perm.Admin ){ login_needed(g.anon.Admin); return; }
784 style_set_current_feature("finfo");
785 style_header("MLINK Table");
786 if( zFName==0 && zCI==0 ){
787 @ <span class='generalError'>
788 @ Requires either a name= or ci= query parameter
789 @ </span>
@@ -934,7 +935,7 @@
935 db_finalize(&q);
936 @ </tbody>
937 @ </table>
938 @ </div>
939 }
940 style_finish_page();
941 }
942
+12 -7
--- src/forum.c
+++ src/forum.c
@@ -762,11 +762,11 @@
762762
** name=X REQUIRED. The hash of the post to display.
763763
** t=a Automatic display mode, i.e. hierarchical for
764764
** desktop and chronological for mobile. This is the
765765
** default if the "t" query parameter is omitted.
766766
** t=c Show posts in the order they were written.
767
-** t=h Show posts usin hierarchical indenting.
767
+** t=h Show posts using hierarchical indenting.
768768
** t=s Show only the post specified by "name=X".
769769
** t=r Alias for "t=c&unf&hist".
770770
** t=y Alias for "t=s&unf&hist".
771771
** raw Alias for "t=s&unf". Additionally, omit the border
772772
** around the post, and ignore "t" and "hist".
@@ -862,10 +862,11 @@
862862
" FROM forumpost, event"
863863
" WHERE event.objid=forumpost.fpid"
864864
" AND forumpost.fpid=%d;",
865865
fpid
866866
);
867
+ style_set_current_feature("forum");
867868
style_header("%s%s", zThreadTitle, *zThreadTitle ? "" : "Forum");
868869
fossil_free(zThreadTitle);
869870
if( mode!=FD_CHRONO ){
870871
style_submenu_element("Chronological", "%R/%s/%s?t=c%s%s", g.zPath, zName,
871872
bUnf ? "&unf" : "", bHist ? "&hist" : "");
@@ -883,11 +884,11 @@
883884
/* Emit Forum Javascript. */
884885
builtin_request_js("forum.js");
885886
forum_emit_js();
886887
887888
/* Emit the page style. */
888
- style_finish_page("forum");
889
+ style_finish_page();
889890
}
890891
891892
/*
892893
** Return true if a forum post should be moderated.
893894
*/
@@ -1054,10 +1055,11 @@
10541055
}else{
10551056
forumnew_page();
10561057
}
10571058
return;
10581059
}
1060
+ style_set_current_feature("forum");
10591061
style_header("%h As Anonymous?", isEdit ? "Reply" : "Post");
10601062
@ <p>You are not logged in.
10611063
@ <p><table border="0" cellpadding="10">
10621064
@ <tr><td>
10631065
@ <form action="%s(zGoto)" method="POST">
@@ -1079,11 +1081,11 @@
10791081
@ <input type="submit" value="Login">
10801082
@ </form>
10811083
@ <td>Log into an existing account
10821084
@ </table>
10831085
forum_emit_js();
1084
- style_finish_page("forum");
1086
+ style_finish_page();
10851087
fossil_free(zGoto);
10861088
}
10871089
10881090
/*
10891091
** Write the "From: USER" line on the webpage.
@@ -1115,10 +1117,11 @@
11151117
}
11161118
if( P("preview") && !whitespace_only(zContent) ){
11171119
@ <h1>Preview:</h1>
11181120
forum_render(zTitle, zMimetype, zContent, "forumEdit", 1);
11191121
}
1122
+ style_set_current_feature("forum");
11201123
style_header("New Forum Thread");
11211124
@ <form action="%R/forume1" method="POST">
11221125
@ <h1>New Thread:</h1>
11231126
forum_from_line();
11241127
forum_post_widget(zTitle, zMimetype, zContent);
@@ -1140,11 +1143,11 @@
11401143
@ Show query parameters</label>
11411144
@ </div>
11421145
}
11431146
@ </form>
11441147
forum_emit_js();
1145
- style_finish_page("forum");
1148
+ style_finish_page();
11461149
}
11471150
11481151
/*
11491152
** WEBPAGE: forume2
11501153
**
@@ -1214,10 +1217,11 @@
12141217
cgi_redirectf("%R/forum");
12151218
}
12161219
return;
12171220
}
12181221
}
1222
+ style_set_current_feature("forum");
12191223
isDelete = P("nullout")!=0;
12201224
if( P("submit")
12211225
&& isCsrfSafe
12221226
&& (zContent = PDT("content",""))!=0
12231227
&& (!whitespace_only(zContent) || isDelete)
@@ -1320,11 +1324,11 @@
13201324
@ Show query parameters</label>
13211325
@ </div>
13221326
}
13231327
@ </form>
13241328
forum_emit_js();
1325
- style_finish_page("forum");
1329
+ style_finish_page();
13261330
}
13271331
13281332
/*
13291333
** WEBPAGE: forummain
13301334
** WEBPAGE: forum
@@ -1346,10 +1350,11 @@
13461350
srchFlags = search_restrict(SRCH_FORUM);
13471351
if( !g.perm.RdForum ){
13481352
login_needed(g.anon.RdForum);
13491353
return;
13501354
}
1355
+ style_set_current_feature("forum");
13511356
style_header("Forum");
13521357
if( g.perm.WrForum ){
13531358
style_submenu_element("New Thread","%R/forumnew");
13541359
}else{
13551360
/* Can't combine this with previous case using the ternary operator
@@ -1362,11 +1367,11 @@
13621367
style_submenu_element("Moderation Requests", "%R/modreq");
13631368
}
13641369
if( (srchFlags & SRCH_FORUM)!=0 ){
13651370
if( search_screen(SRCH_FORUM, 0) ){
13661371
style_submenu_element("Recent Threads","%R/forum");
1367
- style_finish_page("forum");
1372
+ style_finish_page();
13681373
return;
13691374
}
13701375
}
13711376
iLimit = atoi(PD("n","25"));
13721377
iOfst = atoi(PD("x","0"));
@@ -1455,7 +1460,7 @@
14551460
if( iCnt>0 ){
14561461
@ </table></div>
14571462
}else{
14581463
@ <h1>No forum posts found</h1>
14591464
}
1460
- style_finish_page("forum");
1465
+ style_finish_page();
14611466
}
14621467
--- src/forum.c
+++ src/forum.c
@@ -762,11 +762,11 @@
762 ** name=X REQUIRED. The hash of the post to display.
763 ** t=a Automatic display mode, i.e. hierarchical for
764 ** desktop and chronological for mobile. This is the
765 ** default if the "t" query parameter is omitted.
766 ** t=c Show posts in the order they were written.
767 ** t=h Show posts usin hierarchical indenting.
768 ** t=s Show only the post specified by "name=X".
769 ** t=r Alias for "t=c&unf&hist".
770 ** t=y Alias for "t=s&unf&hist".
771 ** raw Alias for "t=s&unf". Additionally, omit the border
772 ** around the post, and ignore "t" and "hist".
@@ -862,10 +862,11 @@
862 " FROM forumpost, event"
863 " WHERE event.objid=forumpost.fpid"
864 " AND forumpost.fpid=%d;",
865 fpid
866 );
 
867 style_header("%s%s", zThreadTitle, *zThreadTitle ? "" : "Forum");
868 fossil_free(zThreadTitle);
869 if( mode!=FD_CHRONO ){
870 style_submenu_element("Chronological", "%R/%s/%s?t=c%s%s", g.zPath, zName,
871 bUnf ? "&unf" : "", bHist ? "&hist" : "");
@@ -883,11 +884,11 @@
883 /* Emit Forum Javascript. */
884 builtin_request_js("forum.js");
885 forum_emit_js();
886
887 /* Emit the page style. */
888 style_finish_page("forum");
889 }
890
891 /*
892 ** Return true if a forum post should be moderated.
893 */
@@ -1054,10 +1055,11 @@
1054 }else{
1055 forumnew_page();
1056 }
1057 return;
1058 }
 
1059 style_header("%h As Anonymous?", isEdit ? "Reply" : "Post");
1060 @ <p>You are not logged in.
1061 @ <p><table border="0" cellpadding="10">
1062 @ <tr><td>
1063 @ <form action="%s(zGoto)" method="POST">
@@ -1079,11 +1081,11 @@
1079 @ <input type="submit" value="Login">
1080 @ </form>
1081 @ <td>Log into an existing account
1082 @ </table>
1083 forum_emit_js();
1084 style_finish_page("forum");
1085 fossil_free(zGoto);
1086 }
1087
1088 /*
1089 ** Write the "From: USER" line on the webpage.
@@ -1115,10 +1117,11 @@
1115 }
1116 if( P("preview") && !whitespace_only(zContent) ){
1117 @ <h1>Preview:</h1>
1118 forum_render(zTitle, zMimetype, zContent, "forumEdit", 1);
1119 }
 
1120 style_header("New Forum Thread");
1121 @ <form action="%R/forume1" method="POST">
1122 @ <h1>New Thread:</h1>
1123 forum_from_line();
1124 forum_post_widget(zTitle, zMimetype, zContent);
@@ -1140,11 +1143,11 @@
1140 @ Show query parameters</label>
1141 @ </div>
1142 }
1143 @ </form>
1144 forum_emit_js();
1145 style_finish_page("forum");
1146 }
1147
1148 /*
1149 ** WEBPAGE: forume2
1150 **
@@ -1214,10 +1217,11 @@
1214 cgi_redirectf("%R/forum");
1215 }
1216 return;
1217 }
1218 }
 
1219 isDelete = P("nullout")!=0;
1220 if( P("submit")
1221 && isCsrfSafe
1222 && (zContent = PDT("content",""))!=0
1223 && (!whitespace_only(zContent) || isDelete)
@@ -1320,11 +1324,11 @@
1320 @ Show query parameters</label>
1321 @ </div>
1322 }
1323 @ </form>
1324 forum_emit_js();
1325 style_finish_page("forum");
1326 }
1327
1328 /*
1329 ** WEBPAGE: forummain
1330 ** WEBPAGE: forum
@@ -1346,10 +1350,11 @@
1346 srchFlags = search_restrict(SRCH_FORUM);
1347 if( !g.perm.RdForum ){
1348 login_needed(g.anon.RdForum);
1349 return;
1350 }
 
1351 style_header("Forum");
1352 if( g.perm.WrForum ){
1353 style_submenu_element("New Thread","%R/forumnew");
1354 }else{
1355 /* Can't combine this with previous case using the ternary operator
@@ -1362,11 +1367,11 @@
1362 style_submenu_element("Moderation Requests", "%R/modreq");
1363 }
1364 if( (srchFlags & SRCH_FORUM)!=0 ){
1365 if( search_screen(SRCH_FORUM, 0) ){
1366 style_submenu_element("Recent Threads","%R/forum");
1367 style_finish_page("forum");
1368 return;
1369 }
1370 }
1371 iLimit = atoi(PD("n","25"));
1372 iOfst = atoi(PD("x","0"));
@@ -1455,7 +1460,7 @@
1455 if( iCnt>0 ){
1456 @ </table></div>
1457 }else{
1458 @ <h1>No forum posts found</h1>
1459 }
1460 style_finish_page("forum");
1461 }
1462
--- src/forum.c
+++ src/forum.c
@@ -762,11 +762,11 @@
762 ** name=X REQUIRED. The hash of the post to display.
763 ** t=a Automatic display mode, i.e. hierarchical for
764 ** desktop and chronological for mobile. This is the
765 ** default if the "t" query parameter is omitted.
766 ** t=c Show posts in the order they were written.
767 ** t=h Show posts using hierarchical indenting.
768 ** t=s Show only the post specified by "name=X".
769 ** t=r Alias for "t=c&unf&hist".
770 ** t=y Alias for "t=s&unf&hist".
771 ** raw Alias for "t=s&unf". Additionally, omit the border
772 ** around the post, and ignore "t" and "hist".
@@ -862,10 +862,11 @@
862 " FROM forumpost, event"
863 " WHERE event.objid=forumpost.fpid"
864 " AND forumpost.fpid=%d;",
865 fpid
866 );
867 style_set_current_feature("forum");
868 style_header("%s%s", zThreadTitle, *zThreadTitle ? "" : "Forum");
869 fossil_free(zThreadTitle);
870 if( mode!=FD_CHRONO ){
871 style_submenu_element("Chronological", "%R/%s/%s?t=c%s%s", g.zPath, zName,
872 bUnf ? "&unf" : "", bHist ? "&hist" : "");
@@ -883,11 +884,11 @@
884 /* Emit Forum Javascript. */
885 builtin_request_js("forum.js");
886 forum_emit_js();
887
888 /* Emit the page style. */
889 style_finish_page();
890 }
891
892 /*
893 ** Return true if a forum post should be moderated.
894 */
@@ -1054,10 +1055,11 @@
1055 }else{
1056 forumnew_page();
1057 }
1058 return;
1059 }
1060 style_set_current_feature("forum");
1061 style_header("%h As Anonymous?", isEdit ? "Reply" : "Post");
1062 @ <p>You are not logged in.
1063 @ <p><table border="0" cellpadding="10">
1064 @ <tr><td>
1065 @ <form action="%s(zGoto)" method="POST">
@@ -1079,11 +1081,11 @@
1081 @ <input type="submit" value="Login">
1082 @ </form>
1083 @ <td>Log into an existing account
1084 @ </table>
1085 forum_emit_js();
1086 style_finish_page();
1087 fossil_free(zGoto);
1088 }
1089
1090 /*
1091 ** Write the "From: USER" line on the webpage.
@@ -1115,10 +1117,11 @@
1117 }
1118 if( P("preview") && !whitespace_only(zContent) ){
1119 @ <h1>Preview:</h1>
1120 forum_render(zTitle, zMimetype, zContent, "forumEdit", 1);
1121 }
1122 style_set_current_feature("forum");
1123 style_header("New Forum Thread");
1124 @ <form action="%R/forume1" method="POST">
1125 @ <h1>New Thread:</h1>
1126 forum_from_line();
1127 forum_post_widget(zTitle, zMimetype, zContent);
@@ -1140,11 +1143,11 @@
1143 @ Show query parameters</label>
1144 @ </div>
1145 }
1146 @ </form>
1147 forum_emit_js();
1148 style_finish_page();
1149 }
1150
1151 /*
1152 ** WEBPAGE: forume2
1153 **
@@ -1214,10 +1217,11 @@
1217 cgi_redirectf("%R/forum");
1218 }
1219 return;
1220 }
1221 }
1222 style_set_current_feature("forum");
1223 isDelete = P("nullout")!=0;
1224 if( P("submit")
1225 && isCsrfSafe
1226 && (zContent = PDT("content",""))!=0
1227 && (!whitespace_only(zContent) || isDelete)
@@ -1320,11 +1324,11 @@
1324 @ Show query parameters</label>
1325 @ </div>
1326 }
1327 @ </form>
1328 forum_emit_js();
1329 style_finish_page();
1330 }
1331
1332 /*
1333 ** WEBPAGE: forummain
1334 ** WEBPAGE: forum
@@ -1346,10 +1350,11 @@
1350 srchFlags = search_restrict(SRCH_FORUM);
1351 if( !g.perm.RdForum ){
1352 login_needed(g.anon.RdForum);
1353 return;
1354 }
1355 style_set_current_feature("forum");
1356 style_header("Forum");
1357 if( g.perm.WrForum ){
1358 style_submenu_element("New Thread","%R/forumnew");
1359 }else{
1360 /* Can't combine this with previous case using the ternary operator
@@ -1362,11 +1367,11 @@
1367 style_submenu_element("Moderation Requests", "%R/modreq");
1368 }
1369 if( (srchFlags & SRCH_FORUM)!=0 ){
1370 if( search_screen(SRCH_FORUM, 0) ){
1371 style_submenu_element("Recent Threads","%R/forum");
1372 style_finish_page();
1373 return;
1374 }
1375 }
1376 iLimit = atoi(PD("n","25"));
1377 iOfst = atoi(PD("x","0"));
@@ -1455,7 +1460,7 @@
1460 if( iCnt>0 ){
1461 @ </table></div>
1462 }else{
1463 @ <h1>No forum posts found</h1>
1464 }
1465 style_finish_page();
1466 }
1467
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -112,11 +112,15 @@
112112
if(label) e.appendChild(dom.text(true===label ? href : label));
113113
return e;
114114
};
115115
dom.hr = dom.createElemFactory('hr');
116116
dom.br = dom.createElemFactory('br');
117
- dom.text = (t)=>document.createTextNode(t||'');
117
+ /** Returns a new TEXT node which contains the text of all of the
118
+ arguments appended together. */
119
+ dom.text = function(/*...*/){
120
+ return document.createTextNode(argsToArray(arguments).join(''));
121
+ };
118122
dom.button = function(label){
119123
const b = this.create('button');
120124
if(label) b.appendChild(this.text(label));
121125
return b;
122126
};
@@ -246,26 +250,37 @@
246250
dom.td = dom.createElemFactoryWithOptionalParent('td');
247251
dom.th = dom.createElemFactoryWithOptionalParent('th');
248252
249253
/**
250254
Creates and returns a FIELDSET element, optionaly with a LEGEND
251
- element added to it. If legendText is an HTMLElement then it is
252
- appended as-is, else it is assume (if truthy) to be a value
253
- suitable for passing to dom.append(aLegendElement,...).
255
+ element added to it. If legendText is an HTMLElement then is is
256
+ assumed to be a LEGEND and is appended as-is, else it is assumed
257
+ (if truthy) to be a value suitable for passing to
258
+ dom.append(aLegendElement,...).
254259
*/
255260
dom.fieldset = function(legendText){
256261
const fs = this.create('fieldset');
257262
if(legendText){
258263
this.append(
259264
fs,
260265
(legendText instanceof HTMLElement)
261266
? legendText
262
- : this.append(this.create('legend'),legendText)
267
+ : this.append(this.legend(legendText))
263268
);
264269
}
265270
return fs;
266271
};
272
+ /**
273
+ Returns a new LEGEND legend element. The given argument, if
274
+ not falsy, is append()ed to the element (so it may be a string
275
+ or DOM element.
276
+ */
277
+ dom.legend = function(legendText){
278
+ const rc = this.create('legend');
279
+ if(legendText) this.append(rc, legendText);
280
+ return rc;
281
+ };
267282
268283
/**
269284
Appends each argument after the first to the first argument
270285
(a DOM node) and returns the first argument.
271286
@@ -289,11 +304,12 @@
289304
e.forEach((x)=>f.call(this, parent,x));
290305
continue;
291306
}
292307
if('string'===typeof e
293308
|| 'number'===typeof e
294
- || 'boolean'===typeof e) e = this.text(e);
309
+ || 'boolean'===typeof e
310
+ || e instanceof Error) e = this.text(e);
295311
parent.appendChild(e);
296312
}
297313
return parent;
298314
};
299315
@@ -481,11 +497,11 @@
481497
const n = arguments.length;
482498
var i = 1;
483499
for( ; i < n; ++i ){
484500
e = arguments[i];
485501
if(!e){
486
- console.warn("Achtung: dom.moveChildrenTo() passed a falsy value at argment",i,"of",
502
+ console.warn("Achtung: dom.moveChildrenTo() passed a falsy value at argument",i,"of",
487503
arguments,arguments[i]);
488504
continue;
489505
}
490506
if(e.forEach){
491507
e.forEach((x)=>f.mv(dest, x));
@@ -614,12 +630,12 @@
614630
615631
/**
616632
"Blinks" the given element a single time for the given number of
617633
milliseconds, defaulting (if the 2nd argument is falsy or not a
618634
number) to flashOnce.defaultTimeMs. If a 3rd argument is passed
619
- in, it must be a function, and it gets callback back at the end
620
- of the asynchronous flashing processes.
635
+ in, it must be a function, and it gets called at the end of the
636
+ asynchronous flashing processes.
621637
622638
This will only activate once per element during that timeframe -
623639
further calls will become no-ops until the blink is
624640
completed. This routine adds a dataset member to the element for
625641
the duration of the blink, to allow it to block multiple blinks.
@@ -707,10 +723,45 @@
707723
if(style.hasOwnProperty(k)) e.style[k] = style[k];
708724
}
709725
}
710726
return e;
711727
};
728
+
729
+ /**
730
+ Given a DOM element, this routine measures its "effective
731
+ height", which is the bounding top/bottom range of this element
732
+ and all of its children, recursively. For some DOM structure
733
+ cases, a parent may have a reported height of 0 even though
734
+ children have non-0 sizes.
735
+
736
+ Returns 0 if !e or if the element really has no height.
737
+ */
738
+ dom.effectiveHeight = function f(e){
739
+ if(!e) return 0;
740
+ if(!f.measure){
741
+ f.measure = function callee(e, depth){
742
+ if(!e) return;
743
+ const m = e.getBoundingClientRect();
744
+ if(0===depth){
745
+ callee.top = m.top;
746
+ callee.bottom = m.bottom;
747
+ }else{
748
+ callee.top = m.top ? Math.min(callee.top, m.top) : callee.top;
749
+ callee.bottom = Math.max(callee.bottom, m.bottom);
750
+ }
751
+ Array.prototype.forEach.call(e.children,(e)=>callee(e,depth+1));
752
+ if(0===depth){
753
+ //console.debug("measure() height:",e.className, callee.top, callee.bottom, (callee.bottom - callee.top));
754
+ f.extra += callee.bottom - callee.top;
755
+ }
756
+ return f.extra;
757
+ };
758
+ }
759
+ f.extra = 0;
760
+ f.measure(e,0);
761
+ return f.extra;
762
+ };
712763
713764
/**
714765
Parses a string as HTML.
715766
716767
Usages:
717768
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -112,11 +112,15 @@
112 if(label) e.appendChild(dom.text(true===label ? href : label));
113 return e;
114 };
115 dom.hr = dom.createElemFactory('hr');
116 dom.br = dom.createElemFactory('br');
117 dom.text = (t)=>document.createTextNode(t||'');
 
 
 
 
118 dom.button = function(label){
119 const b = this.create('button');
120 if(label) b.appendChild(this.text(label));
121 return b;
122 };
@@ -246,26 +250,37 @@
246 dom.td = dom.createElemFactoryWithOptionalParent('td');
247 dom.th = dom.createElemFactoryWithOptionalParent('th');
248
249 /**
250 Creates and returns a FIELDSET element, optionaly with a LEGEND
251 element added to it. If legendText is an HTMLElement then it is
252 appended as-is, else it is assume (if truthy) to be a value
253 suitable for passing to dom.append(aLegendElement,...).
 
254 */
255 dom.fieldset = function(legendText){
256 const fs = this.create('fieldset');
257 if(legendText){
258 this.append(
259 fs,
260 (legendText instanceof HTMLElement)
261 ? legendText
262 : this.append(this.create('legend'),legendText)
263 );
264 }
265 return fs;
266 };
 
 
 
 
 
 
 
 
 
 
267
268 /**
269 Appends each argument after the first to the first argument
270 (a DOM node) and returns the first argument.
271
@@ -289,11 +304,12 @@
289 e.forEach((x)=>f.call(this, parent,x));
290 continue;
291 }
292 if('string'===typeof e
293 || 'number'===typeof e
294 || 'boolean'===typeof e) e = this.text(e);
 
295 parent.appendChild(e);
296 }
297 return parent;
298 };
299
@@ -481,11 +497,11 @@
481 const n = arguments.length;
482 var i = 1;
483 for( ; i < n; ++i ){
484 e = arguments[i];
485 if(!e){
486 console.warn("Achtung: dom.moveChildrenTo() passed a falsy value at argment",i,"of",
487 arguments,arguments[i]);
488 continue;
489 }
490 if(e.forEach){
491 e.forEach((x)=>f.mv(dest, x));
@@ -614,12 +630,12 @@
614
615 /**
616 "Blinks" the given element a single time for the given number of
617 milliseconds, defaulting (if the 2nd argument is falsy or not a
618 number) to flashOnce.defaultTimeMs. If a 3rd argument is passed
619 in, it must be a function, and it gets callback back at the end
620 of the asynchronous flashing processes.
621
622 This will only activate once per element during that timeframe -
623 further calls will become no-ops until the blink is
624 completed. This routine adds a dataset member to the element for
625 the duration of the blink, to allow it to block multiple blinks.
@@ -707,10 +723,45 @@
707 if(style.hasOwnProperty(k)) e.style[k] = style[k];
708 }
709 }
710 return e;
711 };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
712
713 /**
714 Parses a string as HTML.
715
716 Usages:
717
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -112,11 +112,15 @@
112 if(label) e.appendChild(dom.text(true===label ? href : label));
113 return e;
114 };
115 dom.hr = dom.createElemFactory('hr');
116 dom.br = dom.createElemFactory('br');
117 /** Returns a new TEXT node which contains the text of all of the
118 arguments appended together. */
119 dom.text = function(/*...*/){
120 return document.createTextNode(argsToArray(arguments).join(''));
121 };
122 dom.button = function(label){
123 const b = this.create('button');
124 if(label) b.appendChild(this.text(label));
125 return b;
126 };
@@ -246,26 +250,37 @@
250 dom.td = dom.createElemFactoryWithOptionalParent('td');
251 dom.th = dom.createElemFactoryWithOptionalParent('th');
252
253 /**
254 Creates and returns a FIELDSET element, optionaly with a LEGEND
255 element added to it. If legendText is an HTMLElement then is is
256 assumed to be a LEGEND and is appended as-is, else it is assumed
257 (if truthy) to be a value suitable for passing to
258 dom.append(aLegendElement,...).
259 */
260 dom.fieldset = function(legendText){
261 const fs = this.create('fieldset');
262 if(legendText){
263 this.append(
264 fs,
265 (legendText instanceof HTMLElement)
266 ? legendText
267 : this.append(this.legend(legendText))
268 );
269 }
270 return fs;
271 };
272 /**
273 Returns a new LEGEND legend element. The given argument, if
274 not falsy, is append()ed to the element (so it may be a string
275 or DOM element.
276 */
277 dom.legend = function(legendText){
278 const rc = this.create('legend');
279 if(legendText) this.append(rc, legendText);
280 return rc;
281 };
282
283 /**
284 Appends each argument after the first to the first argument
285 (a DOM node) and returns the first argument.
286
@@ -289,11 +304,12 @@
304 e.forEach((x)=>f.call(this, parent,x));
305 continue;
306 }
307 if('string'===typeof e
308 || 'number'===typeof e
309 || 'boolean'===typeof e
310 || e instanceof Error) e = this.text(e);
311 parent.appendChild(e);
312 }
313 return parent;
314 };
315
@@ -481,11 +497,11 @@
497 const n = arguments.length;
498 var i = 1;
499 for( ; i < n; ++i ){
500 e = arguments[i];
501 if(!e){
502 console.warn("Achtung: dom.moveChildrenTo() passed a falsy value at argument",i,"of",
503 arguments,arguments[i]);
504 continue;
505 }
506 if(e.forEach){
507 e.forEach((x)=>f.mv(dest, x));
@@ -614,12 +630,12 @@
630
631 /**
632 "Blinks" the given element a single time for the given number of
633 milliseconds, defaulting (if the 2nd argument is falsy or not a
634 number) to flashOnce.defaultTimeMs. If a 3rd argument is passed
635 in, it must be a function, and it gets called at the end of the
636 asynchronous flashing processes.
637
638 This will only activate once per element during that timeframe -
639 further calls will become no-ops until the blink is
640 completed. This routine adds a dataset member to the element for
641 the duration of the blink, to allow it to block multiple blinks.
@@ -707,10 +723,45 @@
723 if(style.hasOwnProperty(k)) e.style[k] = style[k];
724 }
725 }
726 return e;
727 };
728
729 /**
730 Given a DOM element, this routine measures its "effective
731 height", which is the bounding top/bottom range of this element
732 and all of its children, recursively. For some DOM structure
733 cases, a parent may have a reported height of 0 even though
734 children have non-0 sizes.
735
736 Returns 0 if !e or if the element really has no height.
737 */
738 dom.effectiveHeight = function f(e){
739 if(!e) return 0;
740 if(!f.measure){
741 f.measure = function callee(e, depth){
742 if(!e) return;
743 const m = e.getBoundingClientRect();
744 if(0===depth){
745 callee.top = m.top;
746 callee.bottom = m.bottom;
747 }else{
748 callee.top = m.top ? Math.min(callee.top, m.top) : callee.top;
749 callee.bottom = Math.max(callee.bottom, m.bottom);
750 }
751 Array.prototype.forEach.call(e.children,(e)=>callee(e,depth+1));
752 if(0===depth){
753 //console.debug("measure() height:",e.className, callee.top, callee.bottom, (callee.bottom - callee.top));
754 f.extra += callee.bottom - callee.top;
755 }
756 return f.extra;
757 };
758 }
759 f.extra = 0;
760 f.measure(e,0);
761 return f.extra;
762 };
763
764 /**
765 Parses a string as HTML.
766
767 Usages:
768
--- src/fossil.popupwidget.js
+++ src/fossil.popupwidget.js
@@ -12,15 +12,23 @@
1212
Creates a new tooltip-like widget using the given options object.
1313
1414
Options:
1515
1616
.refresh: callback which is called just before the tooltip is
17
- revealed or moved. It must refresh the contents of the tooltip,
18
- if needed, by applying the content to/within this.e, which is the
19
- base DOM element for the tooltip (and is a child of
20
- document.body). If the contents are static and set up via the
21
- .init option then this callback is not needed.
17
+ revealed. It must refresh the contents of the tooltip, if needed,
18
+ by applying the content to/within this.e, which is the base DOM
19
+ element for the tooltip (and is a child of document.body). If the
20
+ contents are static and set up via the .init option then this
21
+ callback is not needed. When moving an already-shown tooltip,
22
+ this is *not* called. It arguably should be, but the fact is that
23
+ we often have to show() a popup twice in a row without hiding it
24
+ between those calls: once to get its computed size and another to
25
+ move it by some amount relative to that size. If the state of the
26
+ popup depends on its position and a "double-show()" is needed
27
+ then the client must hide() the popup between the two calls to
28
+ show() in order to force a call to refresh() on the second
29
+ show().
2230
2331
.adjustX: an optional callback which is called when the tooltip
2432
is to be displayed at a given position and passed the X
2533
viewport-relative coordinate. This routine must either return its
2634
argument as-is or return an adjusted value. The intent is to
@@ -41,11 +49,14 @@
4149
All callback options are called with the PopupWidget object as
4250
their "this".
4351
4452
4553
.cssClass: optional CSS class, or list of classes, to apply to
46
- the new element.
54
+ the new element. In addition to any supplied here (or inherited
55
+ from the default), the class "fossil-PopupWidget" is always set
56
+ in order to allow certain app-internal CSS to account for popup
57
+ windows in special cases.
4758
4859
.style: optional object of properties to copy directly into
4960
the element's style object.
5061
5162
The options passed to this constructor get normalized into a
@@ -76,11 +87,12 @@
7687
7788
*/
7889
F.PopupWidget = function f(opt){
7990
opt = F.mergeLastWins(f.defaultOptions,opt);
8091
this.options = opt;
81
- const e = this.e = D.addClass(D.div(), opt.cssClass);
92
+ const e = this.e = D.addClass(D.div(), opt.cssClass,
93
+ "fossil-PopupWidget");
8294
this.show(false);
8395
if(opt.style){
8496
let k;
8597
for(k in opt.style){
8698
if(opt.style.hasOwnProperty(k)) e.style[k] = opt.style[k];
@@ -140,16 +152,21 @@
140152
For the latter two, this.options.adjustX() and adjustY() will
141153
be called to adjust it further.
142154
143155
Returns this object.
144156
157
+ If this call will reveal the element then it calls
158
+ this.refresh() to update the UI state. If the element was
159
+ already revealed, the call to refresh() is skipped.
160
+
145161
Sidebar: showing/hiding the widget is, as is conventional for
146162
this framework, done by removing/adding the 'hidden' CSS class
147163
to it, so that class must be defined appropriately.
148164
*/
149165
show: function(){
150
- var x = undefined, y = undefined, showIt;
166
+ var x = undefined, y = undefined, showIt,
167
+ wasShown = !this.e.classList.contains('hidden');
151168
if(2===arguments.length){
152169
x = arguments[0];
153170
y = arguments[1];
154171
showIt = true;
155172
}else if(1===arguments.length){
@@ -162,11 +179,11 @@
162179
}else{
163180
showIt = !!arguments[0];
164181
}
165182
}
166183
if(showIt){
167
- this.refresh();
184
+ if(!wasShown) this.refresh();
168185
x = this.options.adjustX.call(this,x);
169186
y = this.options.adjustY.call(this,y);
170187
x += window.pageXOffset;
171188
y += window.pageYOffset;
172189
}
@@ -182,11 +199,52 @@
182199
this.e.style.removeProperty('top');
183200
}
184201
return this;
185202
},
186203
187
- hide: function(){return this.show(false)}
204
+ /**
205
+ Equivalent to show(false), but may be overridden by instances,
206
+ so long as they also call this.show(false) to perform the
207
+ actual hiding. Overriding can be used to clean up any state so
208
+ that the next call to refresh() (before the popup is show()n
209
+ again) can recognize whether it needs to do something, noting
210
+ that it's legal, and sometimes necessary, to call show()
211
+ multiple times without needing/wanting to completely refresh
212
+ the popup between each call (e.g. when moving the popup after
213
+ it's been show()n).
214
+ */
215
+ hide: function(){return this.show(false)},
216
+
217
+ /**
218
+ A convenience method which adds click handlers to this popup's
219
+ main element and document.body to hide (via hide()) the popup
220
+ when either element is clicked or the ESC key is pressed. Only
221
+ call this once per instance, if at all. Returns this;
222
+
223
+ The first argument specifies whether a click handler on this
224
+ object is installed. The second specifies whether a click
225
+ outside of this object should close it. The third specifies
226
+ whether an ESC handler is installed.
227
+
228
+ Passing no arguments is equivalent to passing (true,true,true),
229
+ and passing fewer arguments defaults the unpassed parameters to
230
+ true.
231
+ */
232
+ installHideHandlers: function f(onClickSelf, onClickOther, onEsc){
233
+ if(!arguments.length) onClickSelf = onClickOther = onEsc = true;
234
+ else if(1===arguments.length) onClickOther = onEsc = true;
235
+ else if(2===arguments.length) onEsc = true;
236
+ if(onClickSelf) this.e.addEventListener('click', ()=>this.hide(), false);
237
+ if(onClickOther) document.body.addEventListener('click', ()=>this.hide(), true);
238
+ if(onEsc){
239
+ const self = this;
240
+ document.body.addEventListener('keydown', function(ev){
241
+ if(self.isShown() && 27===ev.which) self.hide();
242
+ }, true);
243
+ }
244
+ return this;
245
+ }
188246
}/*F.PopupWidget.prototype*/;
189247
190248
/**
191249
Internal impl for F.toast() and friends.
192250
@@ -208,10 +266,11 @@
208266
const toastImpl = function f(cssClass, durationMult, argsObject){
209267
if(!f.toaster){
210268
f.toaster = new F.PopupWidget({
211269
cssClass: 'fossil-toast-message'
212270
});
271
+ D.attr(f.toaster.e, 'role', 'alert');
213272
}
214273
const T = f.toaster;
215274
if(f._timer) clearTimeout(f._timer);
216275
D.clearElement(T.e);
217276
if(f._prevCssClass) T.e.classList.remove(f._prevCssClass);
@@ -231,23 +290,28 @@
231290
position: { x: 5, y: 5 /*viewport-relative, pixels*/ },
232291
displayTimeMs: 3000
233292
},
234293
/**
235294
Convenience wrapper around a PopupWidget which pops up a shared
236
- PopupWidget instance to show toast-style messages (commonly seen
237
- on Android). Its arguments may be anything suitable for passing
238
- to fossil.dom.append(), and each argument is first append()ed to
239
- the toast widget, then the widget is shown for
240
- F.toast.config.displayTimeMs milliseconds. This is called while
241
- a toast is currently being displayed, the first will be overwritten
242
- and the time until the message is hidden will be reset.
295
+ PopupWidget instance to show toast-style messages (commonly
296
+ seen on Android). Its arguments may be anything suitable for
297
+ passing to fossil.dom.append(), and each argument is first
298
+ append()ed to the toast widget, then the widget is shown for
299
+ F.toast.config.displayTimeMs milliseconds. If this is called
300
+ while a toast is currently being displayed, the first will be
301
+ overwritten and the time until the message is hidden will be
302
+ reset.
243303
244304
The toast is always shown at the viewport-relative coordinates
245305
defined by the F.toast.config.position.
246306
247
- The toaster's DOM element has the CSS classes fossil-tooltip
248
- and fossil-toast, so can be style via those.
307
+ The toaster's DOM element has the CSS class fossil-tooltip
308
+ and fossil-toast-message, so can be style via those.
309
+
310
+ The 3 main message types (message, warning, error) each get a
311
+ CSS class with that same name added to them. Thus CSS can
312
+ select on .fossil-toast-message.error to style error toasts.
249313
*/
250314
message: function(/*...*/){
251315
return toastImpl(false,1, arguments);
252316
},
253317
/**
@@ -256,11 +320,11 @@
256320
*/
257321
warning: function(/*...*/){
258322
return toastImpl('warning',1.5,arguments);
259323
},
260324
/**
261
- Displays a toast with the 'warning' CSS class assigned to it. It
325
+ Displays a toast with the 'error' CSS class assigned to it. It
262326
displays for twice as long as a normal toast.
263327
*/
264328
error: function(/*...*/){
265329
return toastImpl('error',2,arguments);
266330
}
@@ -290,39 +354,50 @@
290354
291355
*/
292356
setup: function f(){
293357
if(!f.hasOwnProperty('clickHandler')){
294358
f.clickHandler = function fch(ev){
359
+ ev.preventDefault();
295360
if(!fch.popup){
296361
fch.popup = new F.PopupWidget({
297362
cssClass: ['fossil-tooltip', 'help-buttonlet-content'],
298363
refresh: function(){
299364
}
300365
});
301366
fch.popup.e.style.maxWidth = '80%'/*of body*/;
302
- const hide = ()=>fch.popup.hide();
303
- fch.popup.e.addEventListener('click', hide, false);
304
- document.body.addEventListener('click', hide, true);
305
- document.body.addEventListener('keydown', function(ev){
306
- if(fch.popup.isShown() && 27===ev.which){
307
- fch.popup.hide();
308
- }
309
- }, true);
367
+ fch.popup.installHideHandlers();
310368
}
311369
D.append(D.clearElement(fch.popup.e), ev.target.$helpContent);
312
- var popupRect = ev.target.getClientRects()[0];
313
- var x = popupRect.left, y = popupRect.top;
314
- if(x<0) x = 0;
315
- if(y<0) y = 0;
316370
/* Shift the help around a bit to "better" fit the
317371
screen. However, fch.popup.e.getClientRects() is empty
318372
until the popup is shown, so we have to show it,
319373
calculate the resulting size, then move and/or resize it.
320374
321375
This algorithm/these heuristics can certainly be improved
322376
upon.
323377
*/
378
+ var popupRect, rectElem = ev.target;
379
+ while(rectElem){
380
+ popupRect = rectElem.getClientRects()[0]/*undefined if off-screen!*/;
381
+ if(popupRect) break;
382
+ rectElem = rectElem.parentNode;
383
+ }
384
+ if(!popupRect) popupRect = {x:0, y:0, left:0, right:0};
385
+ var x = popupRect.left, y = popupRect.top;
386
+ if(x<0) x = 0;
387
+ if(y<0) y = 0;
388
+ if(rectElem){
389
+ /* Try to ensure that the popup's z-level is higher than this element's */
390
+ const rz = window.getComputedStyle(rectElem).zIndex;
391
+ var myZ;
392
+ if(rz && !isNaN(+rz)){
393
+ myZ = +rz + 1;
394
+ }else{
395
+ myZ = 10000/*guess!*/;
396
+ }
397
+ fch.popup.e.style.zIndex = myZ;
398
+ }
324399
fch.popup.show(x, y);
325400
x = popupRect.left, y = popupRect.top;
326401
popupRect = fch.popup.e.getBoundingClientRect();
327402
const rectBody = document.body.getClientRects()[0];
328403
if(popupRect.right > rectBody.right){
329404
--- src/fossil.popupwidget.js
+++ src/fossil.popupwidget.js
@@ -12,15 +12,23 @@
12 Creates a new tooltip-like widget using the given options object.
13
14 Options:
15
16 .refresh: callback which is called just before the tooltip is
17 revealed or moved. It must refresh the contents of the tooltip,
18 if needed, by applying the content to/within this.e, which is the
19 base DOM element for the tooltip (and is a child of
20 document.body). If the contents are static and set up via the
21 .init option then this callback is not needed.
 
 
 
 
 
 
 
 
22
23 .adjustX: an optional callback which is called when the tooltip
24 is to be displayed at a given position and passed the X
25 viewport-relative coordinate. This routine must either return its
26 argument as-is or return an adjusted value. The intent is to
@@ -41,11 +49,14 @@
41 All callback options are called with the PopupWidget object as
42 their "this".
43
44
45 .cssClass: optional CSS class, or list of classes, to apply to
46 the new element.
 
 
 
47
48 .style: optional object of properties to copy directly into
49 the element's style object.
50
51 The options passed to this constructor get normalized into a
@@ -76,11 +87,12 @@
76
77 */
78 F.PopupWidget = function f(opt){
79 opt = F.mergeLastWins(f.defaultOptions,opt);
80 this.options = opt;
81 const e = this.e = D.addClass(D.div(), opt.cssClass);
 
82 this.show(false);
83 if(opt.style){
84 let k;
85 for(k in opt.style){
86 if(opt.style.hasOwnProperty(k)) e.style[k] = opt.style[k];
@@ -140,16 +152,21 @@
140 For the latter two, this.options.adjustX() and adjustY() will
141 be called to adjust it further.
142
143 Returns this object.
144
 
 
 
 
145 Sidebar: showing/hiding the widget is, as is conventional for
146 this framework, done by removing/adding the 'hidden' CSS class
147 to it, so that class must be defined appropriately.
148 */
149 show: function(){
150 var x = undefined, y = undefined, showIt;
 
151 if(2===arguments.length){
152 x = arguments[0];
153 y = arguments[1];
154 showIt = true;
155 }else if(1===arguments.length){
@@ -162,11 +179,11 @@
162 }else{
163 showIt = !!arguments[0];
164 }
165 }
166 if(showIt){
167 this.refresh();
168 x = this.options.adjustX.call(this,x);
169 y = this.options.adjustY.call(this,y);
170 x += window.pageXOffset;
171 y += window.pageYOffset;
172 }
@@ -182,11 +199,52 @@
182 this.e.style.removeProperty('top');
183 }
184 return this;
185 },
186
187 hide: function(){return this.show(false)}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188 }/*F.PopupWidget.prototype*/;
189
190 /**
191 Internal impl for F.toast() and friends.
192
@@ -208,10 +266,11 @@
208 const toastImpl = function f(cssClass, durationMult, argsObject){
209 if(!f.toaster){
210 f.toaster = new F.PopupWidget({
211 cssClass: 'fossil-toast-message'
212 });
 
213 }
214 const T = f.toaster;
215 if(f._timer) clearTimeout(f._timer);
216 D.clearElement(T.e);
217 if(f._prevCssClass) T.e.classList.remove(f._prevCssClass);
@@ -231,23 +290,28 @@
231 position: { x: 5, y: 5 /*viewport-relative, pixels*/ },
232 displayTimeMs: 3000
233 },
234 /**
235 Convenience wrapper around a PopupWidget which pops up a shared
236 PopupWidget instance to show toast-style messages (commonly seen
237 on Android). Its arguments may be anything suitable for passing
238 to fossil.dom.append(), and each argument is first append()ed to
239 the toast widget, then the widget is shown for
240 F.toast.config.displayTimeMs milliseconds. This is called while
241 a toast is currently being displayed, the first will be overwritten
242 and the time until the message is hidden will be reset.
 
243
244 The toast is always shown at the viewport-relative coordinates
245 defined by the F.toast.config.position.
246
247 The toaster's DOM element has the CSS classes fossil-tooltip
248 and fossil-toast, so can be style via those.
 
 
 
 
249 */
250 message: function(/*...*/){
251 return toastImpl(false,1, arguments);
252 },
253 /**
@@ -256,11 +320,11 @@
256 */
257 warning: function(/*...*/){
258 return toastImpl('warning',1.5,arguments);
259 },
260 /**
261 Displays a toast with the 'warning' CSS class assigned to it. It
262 displays for twice as long as a normal toast.
263 */
264 error: function(/*...*/){
265 return toastImpl('error',2,arguments);
266 }
@@ -290,39 +354,50 @@
290
291 */
292 setup: function f(){
293 if(!f.hasOwnProperty('clickHandler')){
294 f.clickHandler = function fch(ev){
 
295 if(!fch.popup){
296 fch.popup = new F.PopupWidget({
297 cssClass: ['fossil-tooltip', 'help-buttonlet-content'],
298 refresh: function(){
299 }
300 });
301 fch.popup.e.style.maxWidth = '80%'/*of body*/;
302 const hide = ()=>fch.popup.hide();
303 fch.popup.e.addEventListener('click', hide, false);
304 document.body.addEventListener('click', hide, true);
305 document.body.addEventListener('keydown', function(ev){
306 if(fch.popup.isShown() && 27===ev.which){
307 fch.popup.hide();
308 }
309 }, true);
310 }
311 D.append(D.clearElement(fch.popup.e), ev.target.$helpContent);
312 var popupRect = ev.target.getClientRects()[0];
313 var x = popupRect.left, y = popupRect.top;
314 if(x<0) x = 0;
315 if(y<0) y = 0;
316 /* Shift the help around a bit to "better" fit the
317 screen. However, fch.popup.e.getClientRects() is empty
318 until the popup is shown, so we have to show it,
319 calculate the resulting size, then move and/or resize it.
320
321 This algorithm/these heuristics can certainly be improved
322 upon.
323 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324 fch.popup.show(x, y);
325 x = popupRect.left, y = popupRect.top;
326 popupRect = fch.popup.e.getBoundingClientRect();
327 const rectBody = document.body.getClientRects()[0];
328 if(popupRect.right > rectBody.right){
329
--- src/fossil.popupwidget.js
+++ src/fossil.popupwidget.js
@@ -12,15 +12,23 @@
12 Creates a new tooltip-like widget using the given options object.
13
14 Options:
15
16 .refresh: callback which is called just before the tooltip is
17 revealed. It must refresh the contents of the tooltip, if needed,
18 by applying the content to/within this.e, which is the base DOM
19 element for the tooltip (and is a child of document.body). If the
20 contents are static and set up via the .init option then this
21 callback is not needed. When moving an already-shown tooltip,
22 this is *not* called. It arguably should be, but the fact is that
23 we often have to show() a popup twice in a row without hiding it
24 between those calls: once to get its computed size and another to
25 move it by some amount relative to that size. If the state of the
26 popup depends on its position and a "double-show()" is needed
27 then the client must hide() the popup between the two calls to
28 show() in order to force a call to refresh() on the second
29 show().
30
31 .adjustX: an optional callback which is called when the tooltip
32 is to be displayed at a given position and passed the X
33 viewport-relative coordinate. This routine must either return its
34 argument as-is or return an adjusted value. The intent is to
@@ -41,11 +49,14 @@
49 All callback options are called with the PopupWidget object as
50 their "this".
51
52
53 .cssClass: optional CSS class, or list of classes, to apply to
54 the new element. In addition to any supplied here (or inherited
55 from the default), the class "fossil-PopupWidget" is always set
56 in order to allow certain app-internal CSS to account for popup
57 windows in special cases.
58
59 .style: optional object of properties to copy directly into
60 the element's style object.
61
62 The options passed to this constructor get normalized into a
@@ -76,11 +87,12 @@
87
88 */
89 F.PopupWidget = function f(opt){
90 opt = F.mergeLastWins(f.defaultOptions,opt);
91 this.options = opt;
92 const e = this.e = D.addClass(D.div(), opt.cssClass,
93 "fossil-PopupWidget");
94 this.show(false);
95 if(opt.style){
96 let k;
97 for(k in opt.style){
98 if(opt.style.hasOwnProperty(k)) e.style[k] = opt.style[k];
@@ -140,16 +152,21 @@
152 For the latter two, this.options.adjustX() and adjustY() will
153 be called to adjust it further.
154
155 Returns this object.
156
157 If this call will reveal the element then it calls
158 this.refresh() to update the UI state. If the element was
159 already revealed, the call to refresh() is skipped.
160
161 Sidebar: showing/hiding the widget is, as is conventional for
162 this framework, done by removing/adding the 'hidden' CSS class
163 to it, so that class must be defined appropriately.
164 */
165 show: function(){
166 var x = undefined, y = undefined, showIt,
167 wasShown = !this.e.classList.contains('hidden');
168 if(2===arguments.length){
169 x = arguments[0];
170 y = arguments[1];
171 showIt = true;
172 }else if(1===arguments.length){
@@ -162,11 +179,11 @@
179 }else{
180 showIt = !!arguments[0];
181 }
182 }
183 if(showIt){
184 if(!wasShown) this.refresh();
185 x = this.options.adjustX.call(this,x);
186 y = this.options.adjustY.call(this,y);
187 x += window.pageXOffset;
188 y += window.pageYOffset;
189 }
@@ -182,11 +199,52 @@
199 this.e.style.removeProperty('top');
200 }
201 return this;
202 },
203
204 /**
205 Equivalent to show(false), but may be overridden by instances,
206 so long as they also call this.show(false) to perform the
207 actual hiding. Overriding can be used to clean up any state so
208 that the next call to refresh() (before the popup is show()n
209 again) can recognize whether it needs to do something, noting
210 that it's legal, and sometimes necessary, to call show()
211 multiple times without needing/wanting to completely refresh
212 the popup between each call (e.g. when moving the popup after
213 it's been show()n).
214 */
215 hide: function(){return this.show(false)},
216
217 /**
218 A convenience method which adds click handlers to this popup's
219 main element and document.body to hide (via hide()) the popup
220 when either element is clicked or the ESC key is pressed. Only
221 call this once per instance, if at all. Returns this;
222
223 The first argument specifies whether a click handler on this
224 object is installed. The second specifies whether a click
225 outside of this object should close it. The third specifies
226 whether an ESC handler is installed.
227
228 Passing no arguments is equivalent to passing (true,true,true),
229 and passing fewer arguments defaults the unpassed parameters to
230 true.
231 */
232 installHideHandlers: function f(onClickSelf, onClickOther, onEsc){
233 if(!arguments.length) onClickSelf = onClickOther = onEsc = true;
234 else if(1===arguments.length) onClickOther = onEsc = true;
235 else if(2===arguments.length) onEsc = true;
236 if(onClickSelf) this.e.addEventListener('click', ()=>this.hide(), false);
237 if(onClickOther) document.body.addEventListener('click', ()=>this.hide(), true);
238 if(onEsc){
239 const self = this;
240 document.body.addEventListener('keydown', function(ev){
241 if(self.isShown() && 27===ev.which) self.hide();
242 }, true);
243 }
244 return this;
245 }
246 }/*F.PopupWidget.prototype*/;
247
248 /**
249 Internal impl for F.toast() and friends.
250
@@ -208,10 +266,11 @@
266 const toastImpl = function f(cssClass, durationMult, argsObject){
267 if(!f.toaster){
268 f.toaster = new F.PopupWidget({
269 cssClass: 'fossil-toast-message'
270 });
271 D.attr(f.toaster.e, 'role', 'alert');
272 }
273 const T = f.toaster;
274 if(f._timer) clearTimeout(f._timer);
275 D.clearElement(T.e);
276 if(f._prevCssClass) T.e.classList.remove(f._prevCssClass);
@@ -231,23 +290,28 @@
290 position: { x: 5, y: 5 /*viewport-relative, pixels*/ },
291 displayTimeMs: 3000
292 },
293 /**
294 Convenience wrapper around a PopupWidget which pops up a shared
295 PopupWidget instance to show toast-style messages (commonly
296 seen on Android). Its arguments may be anything suitable for
297 passing to fossil.dom.append(), and each argument is first
298 append()ed to the toast widget, then the widget is shown for
299 F.toast.config.displayTimeMs milliseconds. If this is called
300 while a toast is currently being displayed, the first will be
301 overwritten and the time until the message is hidden will be
302 reset.
303
304 The toast is always shown at the viewport-relative coordinates
305 defined by the F.toast.config.position.
306
307 The toaster's DOM element has the CSS class fossil-tooltip
308 and fossil-toast-message, so can be style via those.
309
310 The 3 main message types (message, warning, error) each get a
311 CSS class with that same name added to them. Thus CSS can
312 select on .fossil-toast-message.error to style error toasts.
313 */
314 message: function(/*...*/){
315 return toastImpl(false,1, arguments);
316 },
317 /**
@@ -256,11 +320,11 @@
320 */
321 warning: function(/*...*/){
322 return toastImpl('warning',1.5,arguments);
323 },
324 /**
325 Displays a toast with the 'error' CSS class assigned to it. It
326 displays for twice as long as a normal toast.
327 */
328 error: function(/*...*/){
329 return toastImpl('error',2,arguments);
330 }
@@ -290,39 +354,50 @@
354
355 */
356 setup: function f(){
357 if(!f.hasOwnProperty('clickHandler')){
358 f.clickHandler = function fch(ev){
359 ev.preventDefault();
360 if(!fch.popup){
361 fch.popup = new F.PopupWidget({
362 cssClass: ['fossil-tooltip', 'help-buttonlet-content'],
363 refresh: function(){
364 }
365 });
366 fch.popup.e.style.maxWidth = '80%'/*of body*/;
367 fch.popup.installHideHandlers();
 
 
 
 
 
 
 
368 }
369 D.append(D.clearElement(fch.popup.e), ev.target.$helpContent);
 
 
 
 
370 /* Shift the help around a bit to "better" fit the
371 screen. However, fch.popup.e.getClientRects() is empty
372 until the popup is shown, so we have to show it,
373 calculate the resulting size, then move and/or resize it.
374
375 This algorithm/these heuristics can certainly be improved
376 upon.
377 */
378 var popupRect, rectElem = ev.target;
379 while(rectElem){
380 popupRect = rectElem.getClientRects()[0]/*undefined if off-screen!*/;
381 if(popupRect) break;
382 rectElem = rectElem.parentNode;
383 }
384 if(!popupRect) popupRect = {x:0, y:0, left:0, right:0};
385 var x = popupRect.left, y = popupRect.top;
386 if(x<0) x = 0;
387 if(y<0) y = 0;
388 if(rectElem){
389 /* Try to ensure that the popup's z-level is higher than this element's */
390 const rz = window.getComputedStyle(rectElem).zIndex;
391 var myZ;
392 if(rz && !isNaN(+rz)){
393 myZ = +rz + 1;
394 }else{
395 myZ = 10000/*guess!*/;
396 }
397 fch.popup.e.style.zIndex = myZ;
398 }
399 fch.popup.show(x, y);
400 x = popupRect.left, y = popupRect.top;
401 popupRect = fch.popup.e.getBoundingClientRect();
402 const rectBody = document.body.getClientRects()[0];
403 if(popupRect.right > rectBody.right){
404
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -65,16 +65,16 @@
6565
6666
Sidebar: it might seem odd to provide a key prefix and stick all
6767
properties in the topmost level of the storage object. We do that
6868
because adding a layer of object to sandbox each repo would mean
6969
(de)serializing that whole tree on every storage property change
70
- (and we update storage often during editing
71
- sessions). e.g. instead of storageObject.projectName.foo we have
70
+ (and we update storage often during editing sessions).
71
+ e.g. instead of storageObject.projectName.foo we have
7272
storageObject[storageKeyPrefix+'foo']. That's soley for
7373
efficiency's sake (in terms of battery life and
74
- environment-internal storage-level effort). Even so, it might
75
- (or might not) be useful to do that someday.
74
+ environment-internal storage-level effort). Even so, it might (or
75
+ might not) be useful to do that someday.
7676
*/
7777
const storageKeyPrefix = (
7878
$storageHolder===$storage/*localStorage or sessionStorage*/
7979
? (
8080
F.config.projectCode || F.config.projectName
@@ -101,10 +101,17 @@
101101
/** Returns the value for the given storage key, or
102102
dflt if the key is not found in the storage. */
103103
get: (k,dflt)=>$storageHolder.hasOwnProperty(
104104
storageKeyPrefix+k
105105
) ? $storage.getItem(storageKeyPrefix+k) : dflt,
106
+ /** Returns true if the given key has a value of "true". If the
107
+ key is not found, it returns true if the boolean value of dflt
108
+ is "true". (Remember that JS persistent storage values are all
109
+ strings.) */
110
+ getBool: function(k,dflt){
111
+ return 'true'===this.get(k,''+(!!dflt));
112
+ },
106113
/** Returns the JSON.parse()'d value of the given
107114
storage key's value, or dflt is the key is not
108115
found or JSON.parse() fails. */
109116
getJSON: function f(k,dflt){
110117
try {
111118
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -65,16 +65,16 @@
65
66 Sidebar: it might seem odd to provide a key prefix and stick all
67 properties in the topmost level of the storage object. We do that
68 because adding a layer of object to sandbox each repo would mean
69 (de)serializing that whole tree on every storage property change
70 (and we update storage often during editing
71 sessions). e.g. instead of storageObject.projectName.foo we have
72 storageObject[storageKeyPrefix+'foo']. That's soley for
73 efficiency's sake (in terms of battery life and
74 environment-internal storage-level effort). Even so, it might
75 (or might not) be useful to do that someday.
76 */
77 const storageKeyPrefix = (
78 $storageHolder===$storage/*localStorage or sessionStorage*/
79 ? (
80 F.config.projectCode || F.config.projectName
@@ -101,10 +101,17 @@
101 /** Returns the value for the given storage key, or
102 dflt if the key is not found in the storage. */
103 get: (k,dflt)=>$storageHolder.hasOwnProperty(
104 storageKeyPrefix+k
105 ) ? $storage.getItem(storageKeyPrefix+k) : dflt,
 
 
 
 
 
 
 
106 /** Returns the JSON.parse()'d value of the given
107 storage key's value, or dflt is the key is not
108 found or JSON.parse() fails. */
109 getJSON: function f(k,dflt){
110 try {
111
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -65,16 +65,16 @@
65
66 Sidebar: it might seem odd to provide a key prefix and stick all
67 properties in the topmost level of the storage object. We do that
68 because adding a layer of object to sandbox each repo would mean
69 (de)serializing that whole tree on every storage property change
70 (and we update storage often during editing sessions).
71 e.g. instead of storageObject.projectName.foo we have
72 storageObject[storageKeyPrefix+'foo']. That's soley for
73 efficiency's sake (in terms of battery life and
74 environment-internal storage-level effort). Even so, it might (or
75 might not) be useful to do that someday.
76 */
77 const storageKeyPrefix = (
78 $storageHolder===$storage/*localStorage or sessionStorage*/
79 ? (
80 F.config.projectCode || F.config.projectName
@@ -101,10 +101,17 @@
101 /** Returns the value for the given storage key, or
102 dflt if the key is not found in the storage. */
103 get: (k,dflt)=>$storageHolder.hasOwnProperty(
104 storageKeyPrefix+k
105 ) ? $storage.getItem(storageKeyPrefix+k) : dflt,
106 /** Returns true if the given key has a value of "true". If the
107 key is not found, it returns true if the boolean value of dflt
108 is "true". (Remember that JS persistent storage values are all
109 strings.) */
110 getBool: function(k,dflt){
111 return 'true'===this.get(k,''+(!!dflt));
112 },
113 /** Returns the JSON.parse()'d value of the given
114 storage key's value, or dflt is the key is not
115 found or JSON.parse() fails. */
116 getJSON: function f(k,dflt){
117 try {
118
+1 -1
--- src/hook.c
+++ src/hook.c
@@ -237,11 +237,11 @@
237237
** --new-rcvid M Pretend that the last rcvid valud is M
238238
** --aux-file NAME NAME is substituted for %A in the script
239239
**
240240
** The --base-rcvid and --new-rcvid options are silently ignored if
241241
** the hook type is not "after-receive". The default values for
242
-** --base-rcvid and --new-rcvid cause the last recieve to be processed.
242
+** --base-rcvid and --new-rcvid cause the last receive to be processed.
243243
*/
244244
void hook_cmd(void){
245245
const char *zCmd;
246246
int nCmd;
247247
db_find_and_open_repository(0, 0);
248248
--- src/hook.c
+++ src/hook.c
@@ -237,11 +237,11 @@
237 ** --new-rcvid M Pretend that the last rcvid valud is M
238 ** --aux-file NAME NAME is substituted for %A in the script
239 **
240 ** The --base-rcvid and --new-rcvid options are silently ignored if
241 ** the hook type is not "after-receive". The default values for
242 ** --base-rcvid and --new-rcvid cause the last recieve to be processed.
243 */
244 void hook_cmd(void){
245 const char *zCmd;
246 int nCmd;
247 db_find_and_open_repository(0, 0);
248
--- src/hook.c
+++ src/hook.c
@@ -237,11 +237,11 @@
237 ** --new-rcvid M Pretend that the last rcvid valud is M
238 ** --aux-file NAME NAME is substituted for %A in the script
239 **
240 ** The --base-rcvid and --new-rcvid options are silently ignored if
241 ** the hook type is not "after-receive". The default values for
242 ** --base-rcvid and --new-rcvid cause the last receive to be processed.
243 */
244 void hook_cmd(void){
245 const char *zCmd;
246 int nCmd;
247 db_find_and_open_repository(0, 0);
248
+4 -2
--- src/import.c
+++ src/import.c
@@ -1797,10 +1797,11 @@
17971797
gsvn.zBranches = find_option("branches", 0, 1);
17981798
gsvn.zTags = find_option("tags", 0, 1);
17991799
gsvn.revFlag = find_option("rev-tags", 0, 0)
18001800
|| (incrFlag && !find_option("no-rev-tags", 0, 0));
18011801
}else if( gitFlag ){
1802
+ const char *zGitUser;
18021803
markfile_in = find_option("import-marks", 0, 1);
18031804
markfile_out = find_option("export-marks", 0, 1);
18041805
if( !(ggit.zMasterName = find_option("rename-master", 0, 1)) ){
18051806
ggit.zMasterName = "master";
18061807
}
@@ -1807,15 +1808,16 @@
18071808
ggit.authorFlag = find_option("use-author", 0, 0)!=0;
18081809
/*
18091810
** Extract --attribute 'emailaddr username' args that will populate
18101811
** new 'fx_' table to later match username for check-in attribution.
18111812
*/
1812
- const char *zGitUser = find_option("attribute", 0, 1);
1813
+ zGitUser = find_option("attribute", 0, 1);
18131814
while( zGitUser != 0 ){
1815
+ char *currGitUser;
18141816
ggit.gitUserInfo = fossil_realloc(ggit.gitUserInfo, ++ggit.nGitAttr
18151817
* sizeof(ggit.gitUserInfo[0]));
1816
- char *currGitUser = fossil_strdup(zGitUser);
1818
+ currGitUser = fossil_strdup(zGitUser);
18171819
ggit.gitUserInfo[ggit.nGitAttr-1].zEmail = next_token(&currGitUser);
18181820
ggit.gitUserInfo[ggit.nGitAttr-1].zUser = rest_of_line(&currGitUser);
18191821
zGitUser = find_option("attribute", 0, 1);
18201822
}
18211823
}
18221824
--- src/import.c
+++ src/import.c
@@ -1797,10 +1797,11 @@
1797 gsvn.zBranches = find_option("branches", 0, 1);
1798 gsvn.zTags = find_option("tags", 0, 1);
1799 gsvn.revFlag = find_option("rev-tags", 0, 0)
1800 || (incrFlag && !find_option("no-rev-tags", 0, 0));
1801 }else if( gitFlag ){
 
1802 markfile_in = find_option("import-marks", 0, 1);
1803 markfile_out = find_option("export-marks", 0, 1);
1804 if( !(ggit.zMasterName = find_option("rename-master", 0, 1)) ){
1805 ggit.zMasterName = "master";
1806 }
@@ -1807,15 +1808,16 @@
1807 ggit.authorFlag = find_option("use-author", 0, 0)!=0;
1808 /*
1809 ** Extract --attribute 'emailaddr username' args that will populate
1810 ** new 'fx_' table to later match username for check-in attribution.
1811 */
1812 const char *zGitUser = find_option("attribute", 0, 1);
1813 while( zGitUser != 0 ){
 
1814 ggit.gitUserInfo = fossil_realloc(ggit.gitUserInfo, ++ggit.nGitAttr
1815 * sizeof(ggit.gitUserInfo[0]));
1816 char *currGitUser = fossil_strdup(zGitUser);
1817 ggit.gitUserInfo[ggit.nGitAttr-1].zEmail = next_token(&currGitUser);
1818 ggit.gitUserInfo[ggit.nGitAttr-1].zUser = rest_of_line(&currGitUser);
1819 zGitUser = find_option("attribute", 0, 1);
1820 }
1821 }
1822
--- src/import.c
+++ src/import.c
@@ -1797,10 +1797,11 @@
1797 gsvn.zBranches = find_option("branches", 0, 1);
1798 gsvn.zTags = find_option("tags", 0, 1);
1799 gsvn.revFlag = find_option("rev-tags", 0, 0)
1800 || (incrFlag && !find_option("no-rev-tags", 0, 0));
1801 }else if( gitFlag ){
1802 const char *zGitUser;
1803 markfile_in = find_option("import-marks", 0, 1);
1804 markfile_out = find_option("export-marks", 0, 1);
1805 if( !(ggit.zMasterName = find_option("rename-master", 0, 1)) ){
1806 ggit.zMasterName = "master";
1807 }
@@ -1807,15 +1808,16 @@
1808 ggit.authorFlag = find_option("use-author", 0, 0)!=0;
1809 /*
1810 ** Extract --attribute 'emailaddr username' args that will populate
1811 ** new 'fx_' table to later match username for check-in attribution.
1812 */
1813 zGitUser = find_option("attribute", 0, 1);
1814 while( zGitUser != 0 ){
1815 char *currGitUser;
1816 ggit.gitUserInfo = fossil_realloc(ggit.gitUserInfo, ++ggit.nGitAttr
1817 * sizeof(ggit.gitUserInfo[0]));
1818 currGitUser = fossil_strdup(zGitUser);
1819 ggit.gitUserInfo[ggit.nGitAttr-1].zEmail = next_token(&currGitUser);
1820 ggit.gitUserInfo[ggit.nGitAttr-1].zUser = rest_of_line(&currGitUser);
1821 zGitUser = find_option("attribute", 0, 1);
1822 }
1823 }
1824
+72 -32
--- src/info.c
+++ src/info.c
@@ -503,11 +503,11 @@
503503
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
504504
rid = name_to_rid_www("name");
505505
if( rid==0 ){
506506
style_header("Check-in Information Error");
507507
@ No such object: %h(g.argv[2])
508
- style_finish_page("ci_tags");
508
+ style_finish_page();
509509
return;
510510
}
511511
zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
512512
style_header("Tags and Properties");
513513
@ <h1>Tags and Properties for Check-In \
@@ -595,11 +595,11 @@
595595
blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
596596
db_prepare(&q, "%s", blob_sql_text(&sql));
597597
www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
598598
0, 0, 0, rid, 0, 0);
599599
db_finalize(&q);
600
- style_finish_page("ci_tags");
600
+ style_finish_page();
601601
}
602602
603603
/*
604604
** WEBPAGE: vinfo
605605
** WEBPAGE: ci
@@ -629,16 +629,17 @@
629629
const char *zPageHide = "ci"; /* Page that hides diffs */
630630
const char *zBrName; /* Branch name */
631631
632632
login_check_credentials();
633633
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
634
+ style_set_current_feature("vinfo");
634635
zName = P("name");
635636
rid = name_to_rid_www("name");
636637
if( rid==0 ){
637638
style_header("Check-in Information Error");
638639
@ No such object: %h(g.argv[2])
639
- style_finish_page("vinfo");
640
+ style_finish_page();
640641
return;
641642
}
642643
zRe = P("regex");
643644
if( zRe ) re_compile(&pRe, zRe, 0);
644645
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -940,11 +941,11 @@
940941
diffFlags,pRe,mperm);
941942
}
942943
db_finalize(&q3);
943944
append_diff_javascript(diffType==2);
944945
cookie_render();
945
- style_finish_page("vinfo");
946
+ style_finish_page();
946947
}
947948
948949
/*
949950
** WEBPAGE: winfo
950951
** URL: /winfo?name=HASH
@@ -962,15 +963,16 @@
962963
int tagid;
963964
int ridNext;
964965
965966
login_check_credentials();
966967
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
968
+ style_set_current_feature("winfo");
967969
rid = name_to_rid_www("name");
968970
if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){
969971
style_header("Wiki Page Information Error");
970972
@ No such object: %h(P("name"))
971
- style_finish_page("winfo");
973
+ style_finish_page();
972974
return;
973975
}
974976
if( g.perm.ModWiki && (zModAction = P("modaction"))!=0 ){
975977
if( strcmp(zModAction,"delete")==0 ){
976978
moderation_disapprove(rid);
@@ -1054,11 +1056,11 @@
10541056
safe_html_context(DOCSRC_WIKI);
10551057
wiki_render_by_mimetype(&wiki, pWiki->zMimetype);
10561058
blob_reset(&wiki);
10571059
manifest_destroy(pWiki);
10581060
document_emit_js();
1059
- style_finish_page("winfo");
1061
+ style_finish_page();
10601062
}
10611063
10621064
/*
10631065
** Find an check-in based on query parameter zParam and parse its
10641066
** manifest. Return the number of errors.
@@ -1210,10 +1212,11 @@
12101212
if(zGlob && !*zGlob){
12111213
zGlob = NULL;
12121214
}
12131215
diffFlags = construct_diff_flags(diffType);
12141216
zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1217
+ style_set_current_feature("vdiff");
12151218
if( zBranch==0 ){
12161219
style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
12171220
}
12181221
if( diffType!=0 ){
12191222
style_submenu_element("Hide Diff", "%R/vdiff?%s&diff=0%s%T%s",
@@ -1327,11 +1330,11 @@
13271330
}
13281331
}
13291332
manifest_destroy(pFrom);
13301333
manifest_destroy(pTo);
13311334
append_diff_javascript(diffType==2);
1332
- style_finish_page("vdiff");
1335
+ style_finish_page();
13331336
}
13341337
13351338
#if INTERFACE
13361339
/*
13371340
** Possible return values from object_description()
@@ -1455,11 +1458,11 @@
14551458
if( g.perm.Hyperlink ){
14561459
@ %z(href("%R/annotate?filename=%T&checkin=%!S",zName,zVers))
14571460
@ [annotate]</a>
14581461
@ %z(href("%R/blame?filename=%T&checkin=%!S",zName,zVers))
14591462
@ [blame]</a>
1460
- @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
1463
+ @ %z(href("%R/timeline?uf=%!S",zUuid))[check-ins&nbsp;using]</a>
14611464
if( fileedit_is_editable(zName) ){
14621465
@ %z(href("%R/fileedit?filename=%T&checkin=%!S",zName,zVers))[edit]</a>
14631466
}
14641467
}
14651468
cnt++;
@@ -1730,10 +1733,11 @@
17301733
17311734
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
17321735
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
17331736
diffFlags = construct_diff_flags(diffType) | DIFF_HTML;
17341737
1738
+ style_set_current_feature("fdiff");
17351739
style_header("Diff");
17361740
style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
17371741
if( diffType==2 ){
17381742
style_submenu_element("Unified Diff", "%R/fdiff?v1=%T&v2=%T&diff=1",
17391743
P("v1"), P("v2"));
@@ -1761,11 +1765,11 @@
17611765
@ are shown.</b>
17621766
}
17631767
@ <hr />
17641768
append_diff(zV1, zV2, diffFlags, pRe);
17651769
append_diff_javascript(diffType);
1766
- style_finish_page("fdiff");
1770
+ style_finish_page();
17671771
}
17681772
17691773
/*
17701774
** WEBPAGE: raw
17711775
** URL: /raw/ARTIFACTID
@@ -1897,25 +1901,43 @@
18971901
zLine[k+2] = ' ';
18981902
}
18991903
}
19001904
zLine[53] = ' ';
19011905
zLine[54] = ' ';
1902
- for(j=0; j<16; j++){
1903
- k = j+55;
1906
+ cgi_append_content(zLine, 55);
1907
+ for(j=k=0; j<16; j++){
19041908
if( i+j<n ){
19051909
unsigned char c = x[i+j];
1906
- if( c>=0x20 && c<=0x7e ){
1907
- zLine[k] = c;
1910
+ if( c>'>' && c<=0x7e ){
1911
+ zLine[k++] = c;
1912
+ }else if( c=='>' ){
1913
+ zLine[k++] = '&';
1914
+ zLine[k++] = 'g';
1915
+ zLine[k++] = 't';
1916
+ zLine[k++] = ';';
1917
+ }else if( c=='<' ){
1918
+ zLine[k++] = '&';
1919
+ zLine[k++] = 'l';
1920
+ zLine[k++] = 't';
1921
+ zLine[k++] = ';';
1922
+ }else if( c=='&' ){
1923
+ zLine[k++] = '&';
1924
+ zLine[k++] = 'a';
1925
+ zLine[k++] = 'm';
1926
+ zLine[k++] = 'p';
1927
+ zLine[k++] = ';';
1928
+ }else if( c>=' ' ){
1929
+ zLine[k++] = c;
19081930
}else{
1909
- zLine[k] = '.';
1931
+ zLine[k++] = '.';
19101932
}
19111933
}else{
1912
- zLine[k] = 0;
1934
+ break;
19131935
}
19141936
}
1915
- zLine[71] = 0;
1916
- @ %h(zLine)
1937
+ zLine[k++] = '\n';
1938
+ cgi_append_content(zLine, k);
19171939
}
19181940
}
19191941
19201942
/*
19211943
** WEBPAGE: hexdump
@@ -1962,14 +1984,22 @@
19621984
object_description(rid, objdescFlags, 0, &downloadName);
19631985
style_submenu_element("Download", "%R/raw/%s?at=%T",
19641986
zUuid, file_tail(blob_str(&downloadName)));
19651987
@ <hr />
19661988
content_get(rid, &content);
1967
- @ <blockquote><pre>
1968
- hexdump(&content);
1969
- @ </pre></blockquote>
1970
- style_finish_page("hexdump");
1989
+ if( !g.isHuman ){
1990
+ /* Prevent robots from running hexdump on megabyte-sized source files
1991
+ ** and there by eating up lots of CPU time and bandwidth. There is
1992
+ ** no good reason for a robot to need a hexdump. */
1993
+ @ <p>A hex dump of this file is not available.
1994
+ @ Please download the raw binary file and generate a hex dump yourself.</p>
1995
+ }else{
1996
+ @ <blockquote><pre>
1997
+ hexdump(&content);
1998
+ @ </pre></blockquote>
1999
+ }
2000
+ style_finish_page();
19712001
}
19722002
19732003
/*
19742004
** Look for "ci" and "filename" query parameters. If found, try to
19752005
** use them to extract the record ID of an artifact for the file.
@@ -2234,10 +2264,11 @@
22342264
int isBranchCI = 0; /* ci= refers to a branch name */
22352265
char *zHeader = 0;
22362266
22372267
login_check_credentials();
22382268
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
2269
+ style_set_current_feature("artifact");
22392270
22402271
/* Capture and normalize the name= and ci= query parameters */
22412272
if( zName==0 ){
22422273
zName = P("filename");
22432274
if( zName==0 ){
@@ -2263,11 +2294,11 @@
22632294
page_tree();
22642295
return;
22652296
}
22662297
style_header("Missing name= query parameter");
22672298
@ The name= query parameter is missing
2268
- style_finish_page("artifact");
2299
+ style_finish_page();
22692300
return;
22702301
}
22712302
22722303
url_initialize(&url, g.zPath);
22732304
url_add_parameter(&url, "name", zName);
@@ -2324,11 +2355,11 @@
23242355
}else{
23252356
style_header("No such artifact");
23262357
@ Artifact '%h(zName)' does not exist in this repository.
23272358
}
23282359
if( rid==0 ){
2329
- style_finish_page("artifact");
2360
+ style_finish_page();
23302361
return;
23312362
}
23322363
}
23332364
23342365
if( descOnly || P("verbose")!=0 ){
@@ -2361,10 +2392,11 @@
23612392
@ part of check-in %z(href("%R/info/%!S",zCIUuid))%S(zCIUuid)</a></h2>
23622393
}
23632394
blob_reset(&path);
23642395
}
23652396
style_submenu_element("Artifact", "%R/artifact/%S", zUuid);
2397
+ zMime = mimetype_from_name(zName);
23662398
style_submenu_element("Annotate", "%R/annotate?filename=%T&checkin=%T",
23672399
zName, zCI);
23682400
style_submenu_element("Blame", "%R/blame?filename=%T&checkin=%T",
23692401
zName, zCI);
23702402
blob_init(&downloadName, zName, -1);
@@ -2379,10 +2411,11 @@
23792411
}
23802412
blob_zero(&downloadName);
23812413
if( asText ) objdescFlags &= ~OBJDESC_BASE;
23822414
objType = object_description(rid, objdescFlags,
23832415
(isFile?zName:0), &downloadName);
2416
+ zMime = mimetype_from_name(blob_str(&downloadName));
23842417
}
23852418
if( !descOnly && P("download")!=0 ){
23862419
cgi_redirectf("%R/raw/%s?at=%T",
23872420
db_text("x", "SELECT uuid FROM blob WHERE rid=%d", rid),
23882421
file_tail(blob_str(&downloadName)));
@@ -2432,13 +2465,12 @@
24322465
}
24332466
db_finalize(&q);
24342467
}
24352468
style_submenu_element("Download", "%R/raw/%s?at=%T", zUuid, file_tail(zName));
24362469
if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
2437
- style_submenu_element("Check-ins Using", "%R/timeline?n=200&uf=%s", zUuid);
2470
+ style_submenu_element("Check-ins Using", "%R/timeline?uf=%s", zUuid);
24382471
}
2439
- zMime = mimetype_from_name(blob_str(&downloadName));
24402472
if( zMime ){
24412473
if( fossil_strcmp(zMime, "text/html")==0 ){
24422474
if( asText ){
24432475
style_submenu_element("Html", "%s", url_render(&url, "txt", 0, 0, 0));
24442476
}else{
@@ -2494,18 +2526,20 @@
24942526
@ );
24952527
@ </script>
24962528
}else if( renderAsSvg ){
24972529
@ <object type="image/svg+xml" data="%R/raw/%s(zUuid)"></object>
24982530
}else{
2531
+ const char *zContentMime;
24992532
style_submenu_element("Hex", "%R/hexdump?name=%s", zUuid);
25002533
if( zLn==0 || atoi(zLn)==0 ){
25012534
style_submenu_checkbox("ln", "Line Numbers", 0, 0);
25022535
}
25032536
blob_to_utf8_no_bom(&content, 0);
2504
- zMime = mimetype_from_content(&content);
2537
+ zContentMime = mimetype_from_content(&content);
2538
+ if( zMime==0 ) zMime = zContentMime;
25052539
@ <blockquote class="file-content">
2506
- if( zMime==0 ){
2540
+ if( zContentMime==0 ){
25072541
const char *z, *zFileName, *zExt;
25082542
z = blob_str(&content);
25092543
zFileName = db_text(0,
25102544
"SELECT name FROM mlink, filename"
25112545
" WHERE filename.fnid=mlink.fnid"
@@ -2526,17 +2560,22 @@
25262560
}
25272561
}else if( strncmp(zMime, "image/", 6)==0 ){
25282562
@ <p>(file is %d(blob_size(&content)) bytes of image data)</i></p>
25292563
@ <p><img src="%R/raw/%s(zUuid)?m=%s(zMime)"></p>
25302564
style_submenu_element("Image", "%R/raw/%s?m=%s", zUuid, zMime);
2565
+ }else if( strncmp(zMime, "audio/", 6)==0 ){
2566
+ @ <p>(file is %d(blob_size(&content)) bytes of sound data)</i></p>
2567
+ @ <audio controls src="%R/raw/%s(zUuid)?m=%s(zMime)">
2568
+ @ (Not supported by this browser)
2569
+ @ </audio>
25312570
}else{
25322571
@ <i>(file is %d(blob_size(&content)) bytes of binary data)</i>
25332572
}
25342573
@ </blockquote>
25352574
}
25362575
}
2537
- style_finish_page("artifact");
2576
+ style_finish_page();
25382577
}
25392578
25402579
/*
25412580
** WEBPAGE: tinfo
25422581
** URL: /tinfo?name=ARTIFACTID
@@ -2590,10 +2629,11 @@
25902629
}
25912630
zTktTitle = db_table_has_column("repository", "ticket", "title" )
25922631
? db_text("(No title)",
25932632
"SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
25942633
: 0;
2634
+ style_set_current_feature("tinfo");
25952635
style_header("Ticket Change Details");
25962636
style_submenu_element("Raw", "%R/artifact/%s", zUuid);
25972637
style_submenu_element("History", "%R/tkthistory/%s", zTktName);
25982638
style_submenu_element("Page", "%R/tktview/%t", zTktName);
25992639
style_submenu_element("Timeline", "%R/tkttimeline/%t", zTktName);
@@ -2639,11 +2679,11 @@
26392679
26402680
@ <div class="section">Changes</div>
26412681
@ <p>
26422682
ticket_output_change_artifact(pTktChng, 0, 1);
26432683
manifest_destroy(pTktChng);
2644
- style_finish_page("tinfo");
2684
+ style_finish_page();
26452685
}
26462686
26472687
26482688
/*
26492689
** WEBPAGE: info
@@ -2690,11 +2730,11 @@
26902730
@ <p>No such object: %h(zName)</p>
26912731
if( nLen<4 ){
26922732
@ <p>Object name should be no less than 4 characters. Ten or more
26932733
@ characters are recommended.</p>
26942734
}
2695
- style_finish_page("info");
2735
+ style_finish_page();
26962736
return;
26972737
}else if( rc==2 ){
26982738
cgi_set_parameter("src","info");
26992739
ambiguous_page();
27002740
return;
@@ -2702,11 +2742,11 @@
27022742
zName = blob_str(&uuid);
27032743
rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", zName);
27042744
if( rid==0 ){
27052745
style_header("Broken Link");
27062746
@ <p>No such object: %h(zName)</p>
2707
- style_finish_page("info");
2747
+ style_finish_page();
27082748
return;
27092749
}
27102750
if( db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
27112751
ci_page();
27122752
}else
@@ -3227,11 +3267,11 @@
32273267
}
32283268
@ </td></tr>
32293269
@ </table>
32303270
@ </div></form>
32313271
builtin_request_js("ci_edit.js");
3232
- style_finish_page("ci_edit");
3272
+ style_finish_page();
32333273
}
32343274
32353275
/*
32363276
** Prepare an ammended commit comment. Let the user modify it using the
32373277
** editor specified in the global_config table or either
32383278
--- src/info.c
+++ src/info.c
@@ -503,11 +503,11 @@
503 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
504 rid = name_to_rid_www("name");
505 if( rid==0 ){
506 style_header("Check-in Information Error");
507 @ No such object: %h(g.argv[2])
508 style_finish_page("ci_tags");
509 return;
510 }
511 zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
512 style_header("Tags and Properties");
513 @ <h1>Tags and Properties for Check-In \
@@ -595,11 +595,11 @@
595 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
596 db_prepare(&q, "%s", blob_sql_text(&sql));
597 www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
598 0, 0, 0, rid, 0, 0);
599 db_finalize(&q);
600 style_finish_page("ci_tags");
601 }
602
603 /*
604 ** WEBPAGE: vinfo
605 ** WEBPAGE: ci
@@ -629,16 +629,17 @@
629 const char *zPageHide = "ci"; /* Page that hides diffs */
630 const char *zBrName; /* Branch name */
631
632 login_check_credentials();
633 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
 
634 zName = P("name");
635 rid = name_to_rid_www("name");
636 if( rid==0 ){
637 style_header("Check-in Information Error");
638 @ No such object: %h(g.argv[2])
639 style_finish_page("vinfo");
640 return;
641 }
642 zRe = P("regex");
643 if( zRe ) re_compile(&pRe, zRe, 0);
644 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -940,11 +941,11 @@
940 diffFlags,pRe,mperm);
941 }
942 db_finalize(&q3);
943 append_diff_javascript(diffType==2);
944 cookie_render();
945 style_finish_page("vinfo");
946 }
947
948 /*
949 ** WEBPAGE: winfo
950 ** URL: /winfo?name=HASH
@@ -962,15 +963,16 @@
962 int tagid;
963 int ridNext;
964
965 login_check_credentials();
966 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
 
967 rid = name_to_rid_www("name");
968 if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){
969 style_header("Wiki Page Information Error");
970 @ No such object: %h(P("name"))
971 style_finish_page("winfo");
972 return;
973 }
974 if( g.perm.ModWiki && (zModAction = P("modaction"))!=0 ){
975 if( strcmp(zModAction,"delete")==0 ){
976 moderation_disapprove(rid);
@@ -1054,11 +1056,11 @@
1054 safe_html_context(DOCSRC_WIKI);
1055 wiki_render_by_mimetype(&wiki, pWiki->zMimetype);
1056 blob_reset(&wiki);
1057 manifest_destroy(pWiki);
1058 document_emit_js();
1059 style_finish_page("winfo");
1060 }
1061
1062 /*
1063 ** Find an check-in based on query parameter zParam and parse its
1064 ** manifest. Return the number of errors.
@@ -1210,10 +1212,11 @@
1210 if(zGlob && !*zGlob){
1211 zGlob = NULL;
1212 }
1213 diffFlags = construct_diff_flags(diffType);
1214 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
 
1215 if( zBranch==0 ){
1216 style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
1217 }
1218 if( diffType!=0 ){
1219 style_submenu_element("Hide Diff", "%R/vdiff?%s&diff=0%s%T%s",
@@ -1327,11 +1330,11 @@
1327 }
1328 }
1329 manifest_destroy(pFrom);
1330 manifest_destroy(pTo);
1331 append_diff_javascript(diffType==2);
1332 style_finish_page("vdiff");
1333 }
1334
1335 #if INTERFACE
1336 /*
1337 ** Possible return values from object_description()
@@ -1455,11 +1458,11 @@
1455 if( g.perm.Hyperlink ){
1456 @ %z(href("%R/annotate?filename=%T&checkin=%!S",zName,zVers))
1457 @ [annotate]</a>
1458 @ %z(href("%R/blame?filename=%T&checkin=%!S",zName,zVers))
1459 @ [blame]</a>
1460 @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
1461 if( fileedit_is_editable(zName) ){
1462 @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zName,zVers))[edit]</a>
1463 }
1464 }
1465 cnt++;
@@ -1730,10 +1733,11 @@
1730
1731 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1732 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1733 diffFlags = construct_diff_flags(diffType) | DIFF_HTML;
1734
 
1735 style_header("Diff");
1736 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1737 if( diffType==2 ){
1738 style_submenu_element("Unified Diff", "%R/fdiff?v1=%T&v2=%T&diff=1",
1739 P("v1"), P("v2"));
@@ -1761,11 +1765,11 @@
1761 @ are shown.</b>
1762 }
1763 @ <hr />
1764 append_diff(zV1, zV2, diffFlags, pRe);
1765 append_diff_javascript(diffType);
1766 style_finish_page("fdiff");
1767 }
1768
1769 /*
1770 ** WEBPAGE: raw
1771 ** URL: /raw/ARTIFACTID
@@ -1897,25 +1901,43 @@
1897 zLine[k+2] = ' ';
1898 }
1899 }
1900 zLine[53] = ' ';
1901 zLine[54] = ' ';
1902 for(j=0; j<16; j++){
1903 k = j+55;
1904 if( i+j<n ){
1905 unsigned char c = x[i+j];
1906 if( c>=0x20 && c<=0x7e ){
1907 zLine[k] = c;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1908 }else{
1909 zLine[k] = '.';
1910 }
1911 }else{
1912 zLine[k] = 0;
1913 }
1914 }
1915 zLine[71] = 0;
1916 @ %h(zLine)
1917 }
1918 }
1919
1920 /*
1921 ** WEBPAGE: hexdump
@@ -1962,14 +1984,22 @@
1962 object_description(rid, objdescFlags, 0, &downloadName);
1963 style_submenu_element("Download", "%R/raw/%s?at=%T",
1964 zUuid, file_tail(blob_str(&downloadName)));
1965 @ <hr />
1966 content_get(rid, &content);
1967 @ <blockquote><pre>
1968 hexdump(&content);
1969 @ </pre></blockquote>
1970 style_finish_page("hexdump");
 
 
 
 
 
 
 
 
1971 }
1972
1973 /*
1974 ** Look for "ci" and "filename" query parameters. If found, try to
1975 ** use them to extract the record ID of an artifact for the file.
@@ -2234,10 +2264,11 @@
2234 int isBranchCI = 0; /* ci= refers to a branch name */
2235 char *zHeader = 0;
2236
2237 login_check_credentials();
2238 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
 
2239
2240 /* Capture and normalize the name= and ci= query parameters */
2241 if( zName==0 ){
2242 zName = P("filename");
2243 if( zName==0 ){
@@ -2263,11 +2294,11 @@
2263 page_tree();
2264 return;
2265 }
2266 style_header("Missing name= query parameter");
2267 @ The name= query parameter is missing
2268 style_finish_page("artifact");
2269 return;
2270 }
2271
2272 url_initialize(&url, g.zPath);
2273 url_add_parameter(&url, "name", zName);
@@ -2324,11 +2355,11 @@
2324 }else{
2325 style_header("No such artifact");
2326 @ Artifact '%h(zName)' does not exist in this repository.
2327 }
2328 if( rid==0 ){
2329 style_finish_page("artifact");
2330 return;
2331 }
2332 }
2333
2334 if( descOnly || P("verbose")!=0 ){
@@ -2361,10 +2392,11 @@
2361 @ part of check-in %z(href("%R/info/%!S",zCIUuid))%S(zCIUuid)</a></h2>
2362 }
2363 blob_reset(&path);
2364 }
2365 style_submenu_element("Artifact", "%R/artifact/%S", zUuid);
 
2366 style_submenu_element("Annotate", "%R/annotate?filename=%T&checkin=%T",
2367 zName, zCI);
2368 style_submenu_element("Blame", "%R/blame?filename=%T&checkin=%T",
2369 zName, zCI);
2370 blob_init(&downloadName, zName, -1);
@@ -2379,10 +2411,11 @@
2379 }
2380 blob_zero(&downloadName);
2381 if( asText ) objdescFlags &= ~OBJDESC_BASE;
2382 objType = object_description(rid, objdescFlags,
2383 (isFile?zName:0), &downloadName);
 
2384 }
2385 if( !descOnly && P("download")!=0 ){
2386 cgi_redirectf("%R/raw/%s?at=%T",
2387 db_text("x", "SELECT uuid FROM blob WHERE rid=%d", rid),
2388 file_tail(blob_str(&downloadName)));
@@ -2432,13 +2465,12 @@
2432 }
2433 db_finalize(&q);
2434 }
2435 style_submenu_element("Download", "%R/raw/%s?at=%T", zUuid, file_tail(zName));
2436 if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
2437 style_submenu_element("Check-ins Using", "%R/timeline?n=200&uf=%s", zUuid);
2438 }
2439 zMime = mimetype_from_name(blob_str(&downloadName));
2440 if( zMime ){
2441 if( fossil_strcmp(zMime, "text/html")==0 ){
2442 if( asText ){
2443 style_submenu_element("Html", "%s", url_render(&url, "txt", 0, 0, 0));
2444 }else{
@@ -2494,18 +2526,20 @@
2494 @ );
2495 @ </script>
2496 }else if( renderAsSvg ){
2497 @ <object type="image/svg+xml" data="%R/raw/%s(zUuid)"></object>
2498 }else{
 
2499 style_submenu_element("Hex", "%R/hexdump?name=%s", zUuid);
2500 if( zLn==0 || atoi(zLn)==0 ){
2501 style_submenu_checkbox("ln", "Line Numbers", 0, 0);
2502 }
2503 blob_to_utf8_no_bom(&content, 0);
2504 zMime = mimetype_from_content(&content);
 
2505 @ <blockquote class="file-content">
2506 if( zMime==0 ){
2507 const char *z, *zFileName, *zExt;
2508 z = blob_str(&content);
2509 zFileName = db_text(0,
2510 "SELECT name FROM mlink, filename"
2511 " WHERE filename.fnid=mlink.fnid"
@@ -2526,17 +2560,22 @@
2526 }
2527 }else if( strncmp(zMime, "image/", 6)==0 ){
2528 @ <p>(file is %d(blob_size(&content)) bytes of image data)</i></p>
2529 @ <p><img src="%R/raw/%s(zUuid)?m=%s(zMime)"></p>
2530 style_submenu_element("Image", "%R/raw/%s?m=%s", zUuid, zMime);
 
 
 
 
 
2531 }else{
2532 @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i>
2533 }
2534 @ </blockquote>
2535 }
2536 }
2537 style_finish_page("artifact");
2538 }
2539
2540 /*
2541 ** WEBPAGE: tinfo
2542 ** URL: /tinfo?name=ARTIFACTID
@@ -2590,10 +2629,11 @@
2590 }
2591 zTktTitle = db_table_has_column("repository", "ticket", "title" )
2592 ? db_text("(No title)",
2593 "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
2594 : 0;
 
2595 style_header("Ticket Change Details");
2596 style_submenu_element("Raw", "%R/artifact/%s", zUuid);
2597 style_submenu_element("History", "%R/tkthistory/%s", zTktName);
2598 style_submenu_element("Page", "%R/tktview/%t", zTktName);
2599 style_submenu_element("Timeline", "%R/tkttimeline/%t", zTktName);
@@ -2639,11 +2679,11 @@
2639
2640 @ <div class="section">Changes</div>
2641 @ <p>
2642 ticket_output_change_artifact(pTktChng, 0, 1);
2643 manifest_destroy(pTktChng);
2644 style_finish_page("tinfo");
2645 }
2646
2647
2648 /*
2649 ** WEBPAGE: info
@@ -2690,11 +2730,11 @@
2690 @ <p>No such object: %h(zName)</p>
2691 if( nLen<4 ){
2692 @ <p>Object name should be no less than 4 characters. Ten or more
2693 @ characters are recommended.</p>
2694 }
2695 style_finish_page("info");
2696 return;
2697 }else if( rc==2 ){
2698 cgi_set_parameter("src","info");
2699 ambiguous_page();
2700 return;
@@ -2702,11 +2742,11 @@
2702 zName = blob_str(&uuid);
2703 rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", zName);
2704 if( rid==0 ){
2705 style_header("Broken Link");
2706 @ <p>No such object: %h(zName)</p>
2707 style_finish_page("info");
2708 return;
2709 }
2710 if( db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
2711 ci_page();
2712 }else
@@ -3227,11 +3267,11 @@
3227 }
3228 @ </td></tr>
3229 @ </table>
3230 @ </div></form>
3231 builtin_request_js("ci_edit.js");
3232 style_finish_page("ci_edit");
3233 }
3234
3235 /*
3236 ** Prepare an ammended commit comment. Let the user modify it using the
3237 ** editor specified in the global_config table or either
3238
--- src/info.c
+++ src/info.c
@@ -503,11 +503,11 @@
503 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
504 rid = name_to_rid_www("name");
505 if( rid==0 ){
506 style_header("Check-in Information Error");
507 @ No such object: %h(g.argv[2])
508 style_finish_page();
509 return;
510 }
511 zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
512 style_header("Tags and Properties");
513 @ <h1>Tags and Properties for Check-In \
@@ -595,11 +595,11 @@
595 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
596 db_prepare(&q, "%s", blob_sql_text(&sql));
597 www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
598 0, 0, 0, rid, 0, 0);
599 db_finalize(&q);
600 style_finish_page();
601 }
602
603 /*
604 ** WEBPAGE: vinfo
605 ** WEBPAGE: ci
@@ -629,16 +629,17 @@
629 const char *zPageHide = "ci"; /* Page that hides diffs */
630 const char *zBrName; /* Branch name */
631
632 login_check_credentials();
633 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
634 style_set_current_feature("vinfo");
635 zName = P("name");
636 rid = name_to_rid_www("name");
637 if( rid==0 ){
638 style_header("Check-in Information Error");
639 @ No such object: %h(g.argv[2])
640 style_finish_page();
641 return;
642 }
643 zRe = P("regex");
644 if( zRe ) re_compile(&pRe, zRe, 0);
645 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -940,11 +941,11 @@
941 diffFlags,pRe,mperm);
942 }
943 db_finalize(&q3);
944 append_diff_javascript(diffType==2);
945 cookie_render();
946 style_finish_page();
947 }
948
949 /*
950 ** WEBPAGE: winfo
951 ** URL: /winfo?name=HASH
@@ -962,15 +963,16 @@
963 int tagid;
964 int ridNext;
965
966 login_check_credentials();
967 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
968 style_set_current_feature("winfo");
969 rid = name_to_rid_www("name");
970 if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){
971 style_header("Wiki Page Information Error");
972 @ No such object: %h(P("name"))
973 style_finish_page();
974 return;
975 }
976 if( g.perm.ModWiki && (zModAction = P("modaction"))!=0 ){
977 if( strcmp(zModAction,"delete")==0 ){
978 moderation_disapprove(rid);
@@ -1054,11 +1056,11 @@
1056 safe_html_context(DOCSRC_WIKI);
1057 wiki_render_by_mimetype(&wiki, pWiki->zMimetype);
1058 blob_reset(&wiki);
1059 manifest_destroy(pWiki);
1060 document_emit_js();
1061 style_finish_page();
1062 }
1063
1064 /*
1065 ** Find an check-in based on query parameter zParam and parse its
1066 ** manifest. Return the number of errors.
@@ -1210,10 +1212,11 @@
1212 if(zGlob && !*zGlob){
1213 zGlob = NULL;
1214 }
1215 diffFlags = construct_diff_flags(diffType);
1216 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1217 style_set_current_feature("vdiff");
1218 if( zBranch==0 ){
1219 style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
1220 }
1221 if( diffType!=0 ){
1222 style_submenu_element("Hide Diff", "%R/vdiff?%s&diff=0%s%T%s",
@@ -1327,11 +1330,11 @@
1330 }
1331 }
1332 manifest_destroy(pFrom);
1333 manifest_destroy(pTo);
1334 append_diff_javascript(diffType==2);
1335 style_finish_page();
1336 }
1337
1338 #if INTERFACE
1339 /*
1340 ** Possible return values from object_description()
@@ -1455,11 +1458,11 @@
1458 if( g.perm.Hyperlink ){
1459 @ %z(href("%R/annotate?filename=%T&checkin=%!S",zName,zVers))
1460 @ [annotate]</a>
1461 @ %z(href("%R/blame?filename=%T&checkin=%!S",zName,zVers))
1462 @ [blame]</a>
1463 @ %z(href("%R/timeline?uf=%!S",zUuid))[check-ins&nbsp;using]</a>
1464 if( fileedit_is_editable(zName) ){
1465 @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zName,zVers))[edit]</a>
1466 }
1467 }
1468 cnt++;
@@ -1730,10 +1733,11 @@
1733
1734 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1735 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1736 diffFlags = construct_diff_flags(diffType) | DIFF_HTML;
1737
1738 style_set_current_feature("fdiff");
1739 style_header("Diff");
1740 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1741 if( diffType==2 ){
1742 style_submenu_element("Unified Diff", "%R/fdiff?v1=%T&v2=%T&diff=1",
1743 P("v1"), P("v2"));
@@ -1761,11 +1765,11 @@
1765 @ are shown.</b>
1766 }
1767 @ <hr />
1768 append_diff(zV1, zV2, diffFlags, pRe);
1769 append_diff_javascript(diffType);
1770 style_finish_page();
1771 }
1772
1773 /*
1774 ** WEBPAGE: raw
1775 ** URL: /raw/ARTIFACTID
@@ -1897,25 +1901,43 @@
1901 zLine[k+2] = ' ';
1902 }
1903 }
1904 zLine[53] = ' ';
1905 zLine[54] = ' ';
1906 cgi_append_content(zLine, 55);
1907 for(j=k=0; j<16; j++){
1908 if( i+j<n ){
1909 unsigned char c = x[i+j];
1910 if( c>'>' && c<=0x7e ){
1911 zLine[k++] = c;
1912 }else if( c=='>' ){
1913 zLine[k++] = '&';
1914 zLine[k++] = 'g';
1915 zLine[k++] = 't';
1916 zLine[k++] = ';';
1917 }else if( c=='<' ){
1918 zLine[k++] = '&';
1919 zLine[k++] = 'l';
1920 zLine[k++] = 't';
1921 zLine[k++] = ';';
1922 }else if( c=='&' ){
1923 zLine[k++] = '&';
1924 zLine[k++] = 'a';
1925 zLine[k++] = 'm';
1926 zLine[k++] = 'p';
1927 zLine[k++] = ';';
1928 }else if( c>=' ' ){
1929 zLine[k++] = c;
1930 }else{
1931 zLine[k++] = '.';
1932 }
1933 }else{
1934 break;
1935 }
1936 }
1937 zLine[k++] = '\n';
1938 cgi_append_content(zLine, k);
1939 }
1940 }
1941
1942 /*
1943 ** WEBPAGE: hexdump
@@ -1962,14 +1984,22 @@
1984 object_description(rid, objdescFlags, 0, &downloadName);
1985 style_submenu_element("Download", "%R/raw/%s?at=%T",
1986 zUuid, file_tail(blob_str(&downloadName)));
1987 @ <hr />
1988 content_get(rid, &content);
1989 if( !g.isHuman ){
1990 /* Prevent robots from running hexdump on megabyte-sized source files
1991 ** and there by eating up lots of CPU time and bandwidth. There is
1992 ** no good reason for a robot to need a hexdump. */
1993 @ <p>A hex dump of this file is not available.
1994 @ Please download the raw binary file and generate a hex dump yourself.</p>
1995 }else{
1996 @ <blockquote><pre>
1997 hexdump(&content);
1998 @ </pre></blockquote>
1999 }
2000 style_finish_page();
2001 }
2002
2003 /*
2004 ** Look for "ci" and "filename" query parameters. If found, try to
2005 ** use them to extract the record ID of an artifact for the file.
@@ -2234,10 +2264,11 @@
2264 int isBranchCI = 0; /* ci= refers to a branch name */
2265 char *zHeader = 0;
2266
2267 login_check_credentials();
2268 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
2269 style_set_current_feature("artifact");
2270
2271 /* Capture and normalize the name= and ci= query parameters */
2272 if( zName==0 ){
2273 zName = P("filename");
2274 if( zName==0 ){
@@ -2263,11 +2294,11 @@
2294 page_tree();
2295 return;
2296 }
2297 style_header("Missing name= query parameter");
2298 @ The name= query parameter is missing
2299 style_finish_page();
2300 return;
2301 }
2302
2303 url_initialize(&url, g.zPath);
2304 url_add_parameter(&url, "name", zName);
@@ -2324,11 +2355,11 @@
2355 }else{
2356 style_header("No such artifact");
2357 @ Artifact '%h(zName)' does not exist in this repository.
2358 }
2359 if( rid==0 ){
2360 style_finish_page();
2361 return;
2362 }
2363 }
2364
2365 if( descOnly || P("verbose")!=0 ){
@@ -2361,10 +2392,11 @@
2392 @ part of check-in %z(href("%R/info/%!S",zCIUuid))%S(zCIUuid)</a></h2>
2393 }
2394 blob_reset(&path);
2395 }
2396 style_submenu_element("Artifact", "%R/artifact/%S", zUuid);
2397 zMime = mimetype_from_name(zName);
2398 style_submenu_element("Annotate", "%R/annotate?filename=%T&checkin=%T",
2399 zName, zCI);
2400 style_submenu_element("Blame", "%R/blame?filename=%T&checkin=%T",
2401 zName, zCI);
2402 blob_init(&downloadName, zName, -1);
@@ -2379,10 +2411,11 @@
2411 }
2412 blob_zero(&downloadName);
2413 if( asText ) objdescFlags &= ~OBJDESC_BASE;
2414 objType = object_description(rid, objdescFlags,
2415 (isFile?zName:0), &downloadName);
2416 zMime = mimetype_from_name(blob_str(&downloadName));
2417 }
2418 if( !descOnly && P("download")!=0 ){
2419 cgi_redirectf("%R/raw/%s?at=%T",
2420 db_text("x", "SELECT uuid FROM blob WHERE rid=%d", rid),
2421 file_tail(blob_str(&downloadName)));
@@ -2432,13 +2465,12 @@
2465 }
2466 db_finalize(&q);
2467 }
2468 style_submenu_element("Download", "%R/raw/%s?at=%T", zUuid, file_tail(zName));
2469 if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
2470 style_submenu_element("Check-ins Using", "%R/timeline?uf=%s", zUuid);
2471 }
 
2472 if( zMime ){
2473 if( fossil_strcmp(zMime, "text/html")==0 ){
2474 if( asText ){
2475 style_submenu_element("Html", "%s", url_render(&url, "txt", 0, 0, 0));
2476 }else{
@@ -2494,18 +2526,20 @@
2526 @ );
2527 @ </script>
2528 }else if( renderAsSvg ){
2529 @ <object type="image/svg+xml" data="%R/raw/%s(zUuid)"></object>
2530 }else{
2531 const char *zContentMime;
2532 style_submenu_element("Hex", "%R/hexdump?name=%s", zUuid);
2533 if( zLn==0 || atoi(zLn)==0 ){
2534 style_submenu_checkbox("ln", "Line Numbers", 0, 0);
2535 }
2536 blob_to_utf8_no_bom(&content, 0);
2537 zContentMime = mimetype_from_content(&content);
2538 if( zMime==0 ) zMime = zContentMime;
2539 @ <blockquote class="file-content">
2540 if( zContentMime==0 ){
2541 const char *z, *zFileName, *zExt;
2542 z = blob_str(&content);
2543 zFileName = db_text(0,
2544 "SELECT name FROM mlink, filename"
2545 " WHERE filename.fnid=mlink.fnid"
@@ -2526,17 +2560,22 @@
2560 }
2561 }else if( strncmp(zMime, "image/", 6)==0 ){
2562 @ <p>(file is %d(blob_size(&content)) bytes of image data)</i></p>
2563 @ <p><img src="%R/raw/%s(zUuid)?m=%s(zMime)"></p>
2564 style_submenu_element("Image", "%R/raw/%s?m=%s", zUuid, zMime);
2565 }else if( strncmp(zMime, "audio/", 6)==0 ){
2566 @ <p>(file is %d(blob_size(&content)) bytes of sound data)</i></p>
2567 @ <audio controls src="%R/raw/%s(zUuid)?m=%s(zMime)">
2568 @ (Not supported by this browser)
2569 @ </audio>
2570 }else{
2571 @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i>
2572 }
2573 @ </blockquote>
2574 }
2575 }
2576 style_finish_page();
2577 }
2578
2579 /*
2580 ** WEBPAGE: tinfo
2581 ** URL: /tinfo?name=ARTIFACTID
@@ -2590,10 +2629,11 @@
2629 }
2630 zTktTitle = db_table_has_column("repository", "ticket", "title" )
2631 ? db_text("(No title)",
2632 "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
2633 : 0;
2634 style_set_current_feature("tinfo");
2635 style_header("Ticket Change Details");
2636 style_submenu_element("Raw", "%R/artifact/%s", zUuid);
2637 style_submenu_element("History", "%R/tkthistory/%s", zTktName);
2638 style_submenu_element("Page", "%R/tktview/%t", zTktName);
2639 style_submenu_element("Timeline", "%R/tkttimeline/%t", zTktName);
@@ -2639,11 +2679,11 @@
2679
2680 @ <div class="section">Changes</div>
2681 @ <p>
2682 ticket_output_change_artifact(pTktChng, 0, 1);
2683 manifest_destroy(pTktChng);
2684 style_finish_page();
2685 }
2686
2687
2688 /*
2689 ** WEBPAGE: info
@@ -2690,11 +2730,11 @@
2730 @ <p>No such object: %h(zName)</p>
2731 if( nLen<4 ){
2732 @ <p>Object name should be no less than 4 characters. Ten or more
2733 @ characters are recommended.</p>
2734 }
2735 style_finish_page();
2736 return;
2737 }else if( rc==2 ){
2738 cgi_set_parameter("src","info");
2739 ambiguous_page();
2740 return;
@@ -2702,11 +2742,11 @@
2742 zName = blob_str(&uuid);
2743 rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", zName);
2744 if( rid==0 ){
2745 style_header("Broken Link");
2746 @ <p>No such object: %h(zName)</p>
2747 style_finish_page();
2748 return;
2749 }
2750 if( db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
2751 ci_page();
2752 }else
@@ -3227,11 +3267,11 @@
3267 }
3268 @ </td></tr>
3269 @ </table>
3270 @ </div></form>
3271 builtin_request_js("ci_edit.js");
3272 style_finish_page();
3273 }
3274
3275 /*
3276 ** Prepare an ammended commit comment. Let the user modify it using the
3277 ** editor specified in the global_config table or either
3278
+3 -2
--- src/interwiki.c
+++ src/interwiki.c
@@ -343,10 +343,11 @@
343343
zTag, zBase, zHash, zWiki);
344344
db_protect_pop();
345345
}
346346
}
347347
348
+ style_set_current_feature("interwiki");
348349
style_header("Interwiki Map Configuration");
349350
@ <p>Interwiki links are hyperlink targets of the form
350351
@ <blockquote><i>Tag</i><b>:</b><i>PageName</i></blockquote>
351352
@ <p>Such links resolve to links to <i>PageName</i> on a separate server
352353
@ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
@@ -388,11 +389,11 @@
388389
@ No mappings are currently defined.
389390
}
390391
391392
if( !g.perm.Setup ){
392393
/* Do not show intermap editing fields to non-setup users */
393
- style_finish_page("interwiki");
394
+ style_finish_page();
394395
return;
395396
}
396397
397398
@ <p>To add a new mapping, fill out the form below providing a unique name
398399
@ for the tag. To edit an exist mapping, fill out the form and use the
@@ -421,7 +422,7 @@
421422
@ <tr><td></td>
422423
@ <td><input type="submit" name="submit" value="Apply Changes"></td></tr>
423424
@ </table>
424425
@ </form>
425426
426
- style_finish_page("interwiki");
427
+ style_finish_page();
427428
}
428429
--- src/interwiki.c
+++ src/interwiki.c
@@ -343,10 +343,11 @@
343 zTag, zBase, zHash, zWiki);
344 db_protect_pop();
345 }
346 }
347
 
348 style_header("Interwiki Map Configuration");
349 @ <p>Interwiki links are hyperlink targets of the form
350 @ <blockquote><i>Tag</i><b>:</b><i>PageName</i></blockquote>
351 @ <p>Such links resolve to links to <i>PageName</i> on a separate server
352 @ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
@@ -388,11 +389,11 @@
388 @ No mappings are currently defined.
389 }
390
391 if( !g.perm.Setup ){
392 /* Do not show intermap editing fields to non-setup users */
393 style_finish_page("interwiki");
394 return;
395 }
396
397 @ <p>To add a new mapping, fill out the form below providing a unique name
398 @ for the tag. To edit an exist mapping, fill out the form and use the
@@ -421,7 +422,7 @@
421 @ <tr><td></td>
422 @ <td><input type="submit" name="submit" value="Apply Changes"></td></tr>
423 @ </table>
424 @ </form>
425
426 style_finish_page("interwiki");
427 }
428
--- src/interwiki.c
+++ src/interwiki.c
@@ -343,10 +343,11 @@
343 zTag, zBase, zHash, zWiki);
344 db_protect_pop();
345 }
346 }
347
348 style_set_current_feature("interwiki");
349 style_header("Interwiki Map Configuration");
350 @ <p>Interwiki links are hyperlink targets of the form
351 @ <blockquote><i>Tag</i><b>:</b><i>PageName</i></blockquote>
352 @ <p>Such links resolve to links to <i>PageName</i> on a separate server
353 @ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
@@ -388,11 +389,11 @@
389 @ No mappings are currently defined.
390 }
391
392 if( !g.perm.Setup ){
393 /* Do not show intermap editing fields to non-setup users */
394 style_finish_page();
395 return;
396 }
397
398 @ <p>To add a new mapping, fill out the form below providing a unique name
399 @ for the tag. To edit an exist mapping, fill out the form and use the
@@ -421,7 +422,7 @@
422 @ <tr><td></td>
423 @ <td><input type="submit" name="submit" value="Apply Changes"></td></tr>
424 @ </table>
425 @ </form>
426
427 style_finish_page();
428 }
429
+6 -4
--- src/json.c
+++ src/json.c
@@ -16,14 +16,13 @@
1616
**
1717
*******************************************************************************
1818
**
1919
** Code for the JSON API.
2020
**
21
-** For notes regarding the public JSON interface, please see:
21
+** The JSON API's public interface is documented at:
2222
**
23
-** https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/view
24
-**
23
+** https://fossil-scm.org/fossil/doc/trunk/www/json-api/index.md
2524
**
2625
** Notes for hackers...
2726
**
2827
** Here's how command/page dispatching works: json_page_top() (in HTTP mode) or
2928
** json_cmd_top() (in CLI mode) catch the "json" path/command. Those functions then
@@ -67,11 +66,13 @@
6766
rc = 0;
6867
}else if(0==strncmp("/json",zPathInfo,5)
6968
&& (zPathInfo[5]==0 || zPathInfo[5]=='/')){
7069
rc = 1;
7170
}else if(g.zCmdName!=0 && (0==strcmp("server",g.zCmdName)
72
- || 0==strcmp("cgi",g.zCmdName)) ){
71
+ || 0==strcmp("ui",g.zCmdName)
72
+ || 0==strcmp("cgi",g.zCmdName)
73
+ || 0==strcmp("http",g.zCmdName)) ){
7374
/* When running in server/cgi "directory" mode, zPathInfo is
7475
** prefixed with the repository's name, so in order to determine
7576
** whether or not we're really running in json mode we have to try
7677
** a bit harder. Problem reported here:
7778
** https://fossil-scm.org/forum/forumpost/e4953666d6
@@ -1978,10 +1979,11 @@
19781979
ADD(ModForum,"moderateForum");
19791980
ADD(AdminForum,"adminForum");
19801981
ADD(EmailAlert,"emailAlert");
19811982
ADD(Announce,"announce");
19821983
ADD(Debug,"debug");
1984
+ ADD(Chat,"chat");
19831985
#undef ADD
19841986
return payload;
19851987
}
19861988
19871989
/*
19881990
--- src/json.c
+++ src/json.c
@@ -16,14 +16,13 @@
16 **
17 *******************************************************************************
18 **
19 ** Code for the JSON API.
20 **
21 ** For notes regarding the public JSON interface, please see:
22 **
23 ** https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/view
24 **
25 **
26 ** Notes for hackers...
27 **
28 ** Here's how command/page dispatching works: json_page_top() (in HTTP mode) or
29 ** json_cmd_top() (in CLI mode) catch the "json" path/command. Those functions then
@@ -67,11 +66,13 @@
67 rc = 0;
68 }else if(0==strncmp("/json",zPathInfo,5)
69 && (zPathInfo[5]==0 || zPathInfo[5]=='/')){
70 rc = 1;
71 }else if(g.zCmdName!=0 && (0==strcmp("server",g.zCmdName)
72 || 0==strcmp("cgi",g.zCmdName)) ){
 
 
73 /* When running in server/cgi "directory" mode, zPathInfo is
74 ** prefixed with the repository's name, so in order to determine
75 ** whether or not we're really running in json mode we have to try
76 ** a bit harder. Problem reported here:
77 ** https://fossil-scm.org/forum/forumpost/e4953666d6
@@ -1978,10 +1979,11 @@
1978 ADD(ModForum,"moderateForum");
1979 ADD(AdminForum,"adminForum");
1980 ADD(EmailAlert,"emailAlert");
1981 ADD(Announce,"announce");
1982 ADD(Debug,"debug");
 
1983 #undef ADD
1984 return payload;
1985 }
1986
1987 /*
1988
--- src/json.c
+++ src/json.c
@@ -16,14 +16,13 @@
16 **
17 *******************************************************************************
18 **
19 ** Code for the JSON API.
20 **
21 ** The JSON API's public interface is documented at:
22 **
23 ** https://fossil-scm.org/fossil/doc/trunk/www/json-api/index.md
 
24 **
25 ** Notes for hackers...
26 **
27 ** Here's how command/page dispatching works: json_page_top() (in HTTP mode) or
28 ** json_cmd_top() (in CLI mode) catch the "json" path/command. Those functions then
@@ -67,11 +66,13 @@
66 rc = 0;
67 }else if(0==strncmp("/json",zPathInfo,5)
68 && (zPathInfo[5]==0 || zPathInfo[5]=='/')){
69 rc = 1;
70 }else if(g.zCmdName!=0 && (0==strcmp("server",g.zCmdName)
71 || 0==strcmp("ui",g.zCmdName)
72 || 0==strcmp("cgi",g.zCmdName)
73 || 0==strcmp("http",g.zCmdName)) ){
74 /* When running in server/cgi "directory" mode, zPathInfo is
75 ** prefixed with the repository's name, so in order to determine
76 ** whether or not we're really running in json mode we have to try
77 ** a bit harder. Problem reported here:
78 ** https://fossil-scm.org/forum/forumpost/e4953666d6
@@ -1978,10 +1979,11 @@
1979 ADD(ModForum,"moderateForum");
1980 ADD(AdminForum,"adminForum");
1981 ADD(EmailAlert,"emailAlert");
1982 ADD(Announce,"announce");
1983 ADD(Debug,"debug");
1984 ADD(Chat,"chat");
1985 #undef ADD
1986 return payload;
1987 }
1988
1989 /*
1990
+37 -11
--- src/linenoise.c
+++ src/linenoise.c
@@ -123,10 +123,11 @@
123123
static linenoiseCompletionCallback *completionCallback = NULL;
124124
static linenoiseHintsCallback *hintsCallback = NULL;
125125
static linenoiseFreeHintsCallback *freeHintsCallback = NULL;
126126
127127
static struct termios orig_termios; /* In order to restore at exit.*/
128
+static int maskmode = 0; /* Show "***" instead of input. For passwords. */
128129
static int rawmode = 0; /* For atexit() function to check if restore is needed*/
129130
static int mlmode = 0; /* Multi line mode. Default is single line. */
130131
static int atexit_registered = 0; /* Register atexit just 1 time. */
131132
static int history_max_len = LINENOISE_DEFAULT_HISTORY_MAX_LEN;
132133
static int history_len = 0;
@@ -194,10 +195,23 @@
194195
#else
195196
#define lndebug(fmt, ...)
196197
#endif
197198
198199
/* ======================= Low level terminal handling ====================== */
200
+
201
+/* Enable "mask mode". When it is enabled, instead of the input that
202
+ * the user is typing, the terminal will just display a corresponding
203
+ * number of asterisks, like "****". This is useful for passwords and other
204
+ * secrets that should not be displayed. */
205
+void linenoiseMaskModeEnable(void) {
206
+ maskmode = 1;
207
+}
208
+
209
+/* Disable mask mode. */
210
+void linenoiseMaskModeDisable(void) {
211
+ maskmode = 0;
212
+}
199213
200214
/* Set if to use or not the multi line mode. */
201215
void linenoiseSetMultiLine(int ml) {
202216
mlmode = ml;
203217
}
@@ -483,10 +497,12 @@
483497
int hintmaxlen = l->cols-(plen+l->len);
484498
if (hintlen > hintmaxlen) hintlen = hintmaxlen;
485499
if (bold == 1 && color == -1) color = 37;
486500
if (color != -1 || bold != 0)
487501
snprintf(seq,64,"\033[%d;%d;49m",bold,color);
502
+ else
503
+ seq[0] = '\0';
488504
abAppend(ab,seq,strlen(seq));
489505
abAppend(ab,hint,hintlen);
490506
if (color != -1 || bold != 0)
491507
abAppend(ab,"\033[0m",4);
492508
/* Call the function to free the hint returned. */
@@ -521,11 +537,15 @@
521537
/* Cursor to left edge */
522538
snprintf(seq,64,"\r");
523539
abAppend(&ab,seq,strlen(seq));
524540
/* Write the prompt and the current buffer content */
525541
abAppend(&ab,l->prompt,strlen(l->prompt));
526
- abAppend(&ab,buf,len);
542
+ if (maskmode == 1) {
543
+ while (len--) abAppend(&ab,"*",1);
544
+ } else {
545
+ abAppend(&ab,buf,len);
546
+ }
527547
/* Show hits if any. */
528548
refreshShowHints(&ab,l,plen);
529549
/* Erase to right */
530550
snprintf(seq,64,"\x1b[0K");
531551
abAppend(&ab,seq,strlen(seq));
@@ -556,30 +576,35 @@
556576
557577
/* First step: clear all the lines used before. To do so start by
558578
* going to the last row. */
559579
abInit(&ab);
560580
if (old_rows-rpos > 0) {
561
- /* lndebug("go down %d", old_rows-rpos); */
581
+ lndebug("go down %d", old_rows-rpos);
562582
snprintf(seq,64,"\x1b[%dB", old_rows-rpos);
563583
abAppend(&ab,seq,strlen(seq));
564584
}
565585
566586
/* Now for every row clear it, go up. */
567587
for (j = 0; j < old_rows-1; j++) {
568
- /* lndebug("clear+up"); */
588
+ lndebug("clear+up");
569589
snprintf(seq,64,"\r\x1b[0K\x1b[1A");
570590
abAppend(&ab,seq,strlen(seq));
571591
}
572592
573593
/* Clean the top line. */
574
- /* lndebug("clear"); */
594
+ lndebug("clear");
575595
snprintf(seq,64,"\r\x1b[0K");
576596
abAppend(&ab,seq,strlen(seq));
577597
578598
/* Write the prompt and the current buffer content */
579599
abAppend(&ab,l->prompt,strlen(l->prompt));
580
- abAppend(&ab,l->buf,l->len);
600
+ if (maskmode == 1) {
601
+ unsigned int i;
602
+ for (i = 0; i < l->len; i++) abAppend(&ab,"*",1);
603
+ } else {
604
+ abAppend(&ab,l->buf,l->len);
605
+ }
581606
582607
/* Show hits if any. */
583608
refreshShowHints(&ab,l,plen);
584609
585610
/* If we are at the very end of the screen with our prompt, we need to
@@ -586,39 +611,39 @@
586611
* emit a newline and move the prompt to the first column. */
587612
if (l->pos &&
588613
l->pos == l->len &&
589614
(l->pos+plen) % l->cols == 0)
590615
{
591
- /* lndebug("<newline>"); */
616
+ lndebug("<newline>");
592617
abAppend(&ab,"\n",1);
593618
snprintf(seq,64,"\r");
594619
abAppend(&ab,seq,strlen(seq));
595620
rows++;
596621
if (rows > (int)l->maxrows) l->maxrows = rows;
597622
}
598623
599624
/* Move cursor to right position. */
600625
rpos2 = (plen+l->pos+l->cols)/l->cols; /* current cursor relative row. */
601
- /* lndebug("rpos2 %d", rpos2); */
626
+ lndebug("rpos2 %d", rpos2);
602627
603628
/* Go up till we reach the expected positon. */
604629
if (rows-rpos2 > 0) {
605
- /* lndebug("go-up %d", rows-rpos2); */
630
+ lndebug("go-up %d", rows-rpos2);
606631
snprintf(seq,64,"\x1b[%dA", rows-rpos2);
607632
abAppend(&ab,seq,strlen(seq));
608633
}
609634
610635
/* Set column. */
611636
col = (plen+(int)l->pos) % (int)l->cols;
612
- /* lndebug("set col %d", 1+col); */
637
+ lndebug("set col %d", 1+col);
613638
if (col)
614639
snprintf(seq,64,"\r\x1b[%dC", col);
615640
else
616641
snprintf(seq,64,"\r");
617642
abAppend(&ab,seq,strlen(seq));
618643
619
- /* lndebug("\n"); */
644
+ lndebug("\n");
620645
l->oldpos = l->pos;
621646
622647
if (write(fd,ab.b,ab.len) == -1) {} /* Can't recover from write error. */
623648
abFree(&ab);
624649
}
@@ -643,11 +668,12 @@
643668
l->len++;
644669
l->buf[l->len] = '\0';
645670
if ((!mlmode && l->plen+l->len < l->cols && !hintsCallback)) {
646671
/* Avoid a full update of the line in the
647672
* trivial case. */
648
- if (write(l->ofd,&c,1) == -1) return -1;
673
+ char d = (maskmode==1) ? '*' : c;
674
+ if (write(l->ofd,&d,1) == -1) return -1;
649675
} else {
650676
refreshLine(l);
651677
}
652678
} else {
653679
memmove(l->buf+l->pos+1,l->buf+l->pos,l->len-l->pos);
654680
--- src/linenoise.c
+++ src/linenoise.c
@@ -123,10 +123,11 @@
123 static linenoiseCompletionCallback *completionCallback = NULL;
124 static linenoiseHintsCallback *hintsCallback = NULL;
125 static linenoiseFreeHintsCallback *freeHintsCallback = NULL;
126
127 static struct termios orig_termios; /* In order to restore at exit.*/
 
128 static int rawmode = 0; /* For atexit() function to check if restore is needed*/
129 static int mlmode = 0; /* Multi line mode. Default is single line. */
130 static int atexit_registered = 0; /* Register atexit just 1 time. */
131 static int history_max_len = LINENOISE_DEFAULT_HISTORY_MAX_LEN;
132 static int history_len = 0;
@@ -194,10 +195,23 @@
194 #else
195 #define lndebug(fmt, ...)
196 #endif
197
198 /* ======================= Low level terminal handling ====================== */
 
 
 
 
 
 
 
 
 
 
 
 
 
199
200 /* Set if to use or not the multi line mode. */
201 void linenoiseSetMultiLine(int ml) {
202 mlmode = ml;
203 }
@@ -483,10 +497,12 @@
483 int hintmaxlen = l->cols-(plen+l->len);
484 if (hintlen > hintmaxlen) hintlen = hintmaxlen;
485 if (bold == 1 && color == -1) color = 37;
486 if (color != -1 || bold != 0)
487 snprintf(seq,64,"\033[%d;%d;49m",bold,color);
 
 
488 abAppend(ab,seq,strlen(seq));
489 abAppend(ab,hint,hintlen);
490 if (color != -1 || bold != 0)
491 abAppend(ab,"\033[0m",4);
492 /* Call the function to free the hint returned. */
@@ -521,11 +537,15 @@
521 /* Cursor to left edge */
522 snprintf(seq,64,"\r");
523 abAppend(&ab,seq,strlen(seq));
524 /* Write the prompt and the current buffer content */
525 abAppend(&ab,l->prompt,strlen(l->prompt));
526 abAppend(&ab,buf,len);
 
 
 
 
527 /* Show hits if any. */
528 refreshShowHints(&ab,l,plen);
529 /* Erase to right */
530 snprintf(seq,64,"\x1b[0K");
531 abAppend(&ab,seq,strlen(seq));
@@ -556,30 +576,35 @@
556
557 /* First step: clear all the lines used before. To do so start by
558 * going to the last row. */
559 abInit(&ab);
560 if (old_rows-rpos > 0) {
561 /* lndebug("go down %d", old_rows-rpos); */
562 snprintf(seq,64,"\x1b[%dB", old_rows-rpos);
563 abAppend(&ab,seq,strlen(seq));
564 }
565
566 /* Now for every row clear it, go up. */
567 for (j = 0; j < old_rows-1; j++) {
568 /* lndebug("clear+up"); */
569 snprintf(seq,64,"\r\x1b[0K\x1b[1A");
570 abAppend(&ab,seq,strlen(seq));
571 }
572
573 /* Clean the top line. */
574 /* lndebug("clear"); */
575 snprintf(seq,64,"\r\x1b[0K");
576 abAppend(&ab,seq,strlen(seq));
577
578 /* Write the prompt and the current buffer content */
579 abAppend(&ab,l->prompt,strlen(l->prompt));
580 abAppend(&ab,l->buf,l->len);
 
 
 
 
 
581
582 /* Show hits if any. */
583 refreshShowHints(&ab,l,plen);
584
585 /* If we are at the very end of the screen with our prompt, we need to
@@ -586,39 +611,39 @@
586 * emit a newline and move the prompt to the first column. */
587 if (l->pos &&
588 l->pos == l->len &&
589 (l->pos+plen) % l->cols == 0)
590 {
591 /* lndebug("<newline>"); */
592 abAppend(&ab,"\n",1);
593 snprintf(seq,64,"\r");
594 abAppend(&ab,seq,strlen(seq));
595 rows++;
596 if (rows > (int)l->maxrows) l->maxrows = rows;
597 }
598
599 /* Move cursor to right position. */
600 rpos2 = (plen+l->pos+l->cols)/l->cols; /* current cursor relative row. */
601 /* lndebug("rpos2 %d", rpos2); */
602
603 /* Go up till we reach the expected positon. */
604 if (rows-rpos2 > 0) {
605 /* lndebug("go-up %d", rows-rpos2); */
606 snprintf(seq,64,"\x1b[%dA", rows-rpos2);
607 abAppend(&ab,seq,strlen(seq));
608 }
609
610 /* Set column. */
611 col = (plen+(int)l->pos) % (int)l->cols;
612 /* lndebug("set col %d", 1+col); */
613 if (col)
614 snprintf(seq,64,"\r\x1b[%dC", col);
615 else
616 snprintf(seq,64,"\r");
617 abAppend(&ab,seq,strlen(seq));
618
619 /* lndebug("\n"); */
620 l->oldpos = l->pos;
621
622 if (write(fd,ab.b,ab.len) == -1) {} /* Can't recover from write error. */
623 abFree(&ab);
624 }
@@ -643,11 +668,12 @@
643 l->len++;
644 l->buf[l->len] = '\0';
645 if ((!mlmode && l->plen+l->len < l->cols && !hintsCallback)) {
646 /* Avoid a full update of the line in the
647 * trivial case. */
648 if (write(l->ofd,&c,1) == -1) return -1;
 
649 } else {
650 refreshLine(l);
651 }
652 } else {
653 memmove(l->buf+l->pos+1,l->buf+l->pos,l->len-l->pos);
654
--- src/linenoise.c
+++ src/linenoise.c
@@ -123,10 +123,11 @@
123 static linenoiseCompletionCallback *completionCallback = NULL;
124 static linenoiseHintsCallback *hintsCallback = NULL;
125 static linenoiseFreeHintsCallback *freeHintsCallback = NULL;
126
127 static struct termios orig_termios; /* In order to restore at exit.*/
128 static int maskmode = 0; /* Show "***" instead of input. For passwords. */
129 static int rawmode = 0; /* For atexit() function to check if restore is needed*/
130 static int mlmode = 0; /* Multi line mode. Default is single line. */
131 static int atexit_registered = 0; /* Register atexit just 1 time. */
132 static int history_max_len = LINENOISE_DEFAULT_HISTORY_MAX_LEN;
133 static int history_len = 0;
@@ -194,10 +195,23 @@
195 #else
196 #define lndebug(fmt, ...)
197 #endif
198
199 /* ======================= Low level terminal handling ====================== */
200
201 /* Enable "mask mode". When it is enabled, instead of the input that
202 * the user is typing, the terminal will just display a corresponding
203 * number of asterisks, like "****". This is useful for passwords and other
204 * secrets that should not be displayed. */
205 void linenoiseMaskModeEnable(void) {
206 maskmode = 1;
207 }
208
209 /* Disable mask mode. */
210 void linenoiseMaskModeDisable(void) {
211 maskmode = 0;
212 }
213
214 /* Set if to use or not the multi line mode. */
215 void linenoiseSetMultiLine(int ml) {
216 mlmode = ml;
217 }
@@ -483,10 +497,12 @@
497 int hintmaxlen = l->cols-(plen+l->len);
498 if (hintlen > hintmaxlen) hintlen = hintmaxlen;
499 if (bold == 1 && color == -1) color = 37;
500 if (color != -1 || bold != 0)
501 snprintf(seq,64,"\033[%d;%d;49m",bold,color);
502 else
503 seq[0] = '\0';
504 abAppend(ab,seq,strlen(seq));
505 abAppend(ab,hint,hintlen);
506 if (color != -1 || bold != 0)
507 abAppend(ab,"\033[0m",4);
508 /* Call the function to free the hint returned. */
@@ -521,11 +537,15 @@
537 /* Cursor to left edge */
538 snprintf(seq,64,"\r");
539 abAppend(&ab,seq,strlen(seq));
540 /* Write the prompt and the current buffer content */
541 abAppend(&ab,l->prompt,strlen(l->prompt));
542 if (maskmode == 1) {
543 while (len--) abAppend(&ab,"*",1);
544 } else {
545 abAppend(&ab,buf,len);
546 }
547 /* Show hits if any. */
548 refreshShowHints(&ab,l,plen);
549 /* Erase to right */
550 snprintf(seq,64,"\x1b[0K");
551 abAppend(&ab,seq,strlen(seq));
@@ -556,30 +576,35 @@
576
577 /* First step: clear all the lines used before. To do so start by
578 * going to the last row. */
579 abInit(&ab);
580 if (old_rows-rpos > 0) {
581 lndebug("go down %d", old_rows-rpos);
582 snprintf(seq,64,"\x1b[%dB", old_rows-rpos);
583 abAppend(&ab,seq,strlen(seq));
584 }
585
586 /* Now for every row clear it, go up. */
587 for (j = 0; j < old_rows-1; j++) {
588 lndebug("clear+up");
589 snprintf(seq,64,"\r\x1b[0K\x1b[1A");
590 abAppend(&ab,seq,strlen(seq));
591 }
592
593 /* Clean the top line. */
594 lndebug("clear");
595 snprintf(seq,64,"\r\x1b[0K");
596 abAppend(&ab,seq,strlen(seq));
597
598 /* Write the prompt and the current buffer content */
599 abAppend(&ab,l->prompt,strlen(l->prompt));
600 if (maskmode == 1) {
601 unsigned int i;
602 for (i = 0; i < l->len; i++) abAppend(&ab,"*",1);
603 } else {
604 abAppend(&ab,l->buf,l->len);
605 }
606
607 /* Show hits if any. */
608 refreshShowHints(&ab,l,plen);
609
610 /* If we are at the very end of the screen with our prompt, we need to
@@ -586,39 +611,39 @@
611 * emit a newline and move the prompt to the first column. */
612 if (l->pos &&
613 l->pos == l->len &&
614 (l->pos+plen) % l->cols == 0)
615 {
616 lndebug("<newline>");
617 abAppend(&ab,"\n",1);
618 snprintf(seq,64,"\r");
619 abAppend(&ab,seq,strlen(seq));
620 rows++;
621 if (rows > (int)l->maxrows) l->maxrows = rows;
622 }
623
624 /* Move cursor to right position. */
625 rpos2 = (plen+l->pos+l->cols)/l->cols; /* current cursor relative row. */
626 lndebug("rpos2 %d", rpos2);
627
628 /* Go up till we reach the expected positon. */
629 if (rows-rpos2 > 0) {
630 lndebug("go-up %d", rows-rpos2);
631 snprintf(seq,64,"\x1b[%dA", rows-rpos2);
632 abAppend(&ab,seq,strlen(seq));
633 }
634
635 /* Set column. */
636 col = (plen+(int)l->pos) % (int)l->cols;
637 lndebug("set col %d", 1+col);
638 if (col)
639 snprintf(seq,64,"\r\x1b[%dC", col);
640 else
641 snprintf(seq,64,"\r");
642 abAppend(&ab,seq,strlen(seq));
643
644 lndebug("\n");
645 l->oldpos = l->pos;
646
647 if (write(fd,ab.b,ab.len) == -1) {} /* Can't recover from write error. */
648 abFree(&ab);
649 }
@@ -643,11 +668,12 @@
668 l->len++;
669 l->buf[l->len] = '\0';
670 if ((!mlmode && l->plen+l->len < l->cols && !hintsCallback)) {
671 /* Avoid a full update of the line in the
672 * trivial case. */
673 char d = (maskmode==1) ? '*' : c;
674 if (write(l->ofd,&d,1) == -1) return -1;
675 } else {
676 refreshLine(l);
677 }
678 } else {
679 memmove(l->buf+l->pos+1,l->buf+l->pos,l->len-l->pos);
680
--- src/linenoise.h
+++ src/linenoise.h
@@ -63,10 +63,12 @@
6363
int linenoiseHistorySave(const char *filename);
6464
int linenoiseHistoryLoad(const char *filename);
6565
void linenoiseClearScreen(void);
6666
void linenoiseSetMultiLine(int ml);
6767
void linenoisePrintKeyCodes(void);
68
+void linenoiseMaskModeEnable(void);
69
+void linenoiseMaskModeDisable(void);
6870
6971
#ifdef __cplusplus
7072
}
7173
#endif
7274
7375
--- src/linenoise.h
+++ src/linenoise.h
@@ -63,10 +63,12 @@
63 int linenoiseHistorySave(const char *filename);
64 int linenoiseHistoryLoad(const char *filename);
65 void linenoiseClearScreen(void);
66 void linenoiseSetMultiLine(int ml);
67 void linenoisePrintKeyCodes(void);
 
 
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73
--- src/linenoise.h
+++ src/linenoise.h
@@ -63,10 +63,12 @@
63 int linenoiseHistorySave(const char *filename);
64 int linenoiseHistoryLoad(const char *filename);
65 void linenoiseClearScreen(void);
66 void linenoiseSetMultiLine(int ml);
67 void linenoisePrintKeyCodes(void);
68 void linenoiseMaskModeEnable(void);
69 void linenoiseMaskModeDisable(void);
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75
+2 -1
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -52,15 +52,16 @@
5252
*/
5353
void load_control(void){
5454
double mxLoad = atof(db_get("max-loadavg", 0));
5555
if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
5656
57
+ style_set_current_feature("test");
5758
style_header("Server Overload");
5859
@ <h2>The server load is currently too high.
5960
@ Please try again later.</h2>
6061
@ <p>Current load average: %f(load_average()).<br />
6162
@ Load average limit: %f(mxLoad)</p>
62
- style_finish_page("test");
63
+ style_finish_page();
6364
cgi_set_status(503,"Server Overload");
6465
cgi_reply();
6566
exit(0);
6667
}
6768
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -52,15 +52,16 @@
52 */
53 void load_control(void){
54 double mxLoad = atof(db_get("max-loadavg", 0));
55 if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
56
 
57 style_header("Server Overload");
58 @ <h2>The server load is currently too high.
59 @ Please try again later.</h2>
60 @ <p>Current load average: %f(load_average()).<br />
61 @ Load average limit: %f(mxLoad)</p>
62 style_finish_page("test");
63 cgi_set_status(503,"Server Overload");
64 cgi_reply();
65 exit(0);
66 }
67
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -52,15 +52,16 @@
52 */
53 void load_control(void){
54 double mxLoad = atof(db_get("max-loadavg", 0));
55 if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
56
57 style_set_current_feature("test");
58 style_header("Server Overload");
59 @ <h2>The server load is currently too high.
60 @ Please try again later.</h2>
61 @ <p>Current load average: %f(load_average()).<br />
62 @ Load average limit: %f(mxLoad)</p>
63 style_finish_page();
64 cgi_set_status(503,"Server Overload");
65 cgi_reply();
66 exit(0);
67 }
68
+36 -7
--- src/login.c
+++ src/login.c
@@ -656,10 +656,11 @@
656656
*/
657657
login_set_user_cookie(zUsername, uid, NULL, rememberMe?0:1);
658658
redirect_to_g();
659659
}
660660
}
661
+ style_set_current_feature("login");
661662
style_header("Login/Logout");
662663
style_adunit_config(ADUNIT_OFF);
663664
@ %s(zErrMsg)
664665
if( zGoto && !noAnon ){
665666
char *zAbbrev = fossil_strdup(zGoto);
@@ -776,30 +777,31 @@
776777
@ <hr>
777778
@ <p>Configure <a href="%R/alerts">Email Alerts</a>
778779
@ for user <b>%h(g.zLogin)</b></p>
779780
}
780781
if( g.perm.Password ){
782
+ char *zRPW = fossil_random_password(12);
781783
@ <hr>
782784
@ <p>Change Password for user <b>%h(g.zLogin)</b>:</p>
783785
form_begin(0, "%R/login");
784786
@ <table>
785787
@ <tr><td class="form_label" id="oldpw">Old Password:</td>
786788
@ <td><input aria-labelledby="oldpw" type="password" name="p" \
787789
@ size="30"/></td></tr>
788790
@ <tr><td class="form_label" id="newpw">New Password:</td>
789791
@ <td><input aria-labelledby="newpw" type="password" name="n1" \
790
- @ size="30" /></td></tr>
792
+ @ size="30" /> Suggestion: %z(zRPW)</td></tr>
791793
@ <tr><td class="form_label" id="reppw">Repeat New Password:</td>
792794
@ <td><input aria-labledby="reppw" type="password" name="n2" \
793795
@ size="30" /></td></tr>
794796
@ <tr><td></td>
795797
@ <td><input type="submit" value="Change Password" /></td></tr>
796798
@ </table>
797799
@ </form>
798800
}
799801
}
800
- style_finish_page("login");
802
+ style_finish_page();
801803
}
802804
803805
/*
804806
** Attempt to find login credentials for user zLogin on a peer repository
805807
** with project code zCode. Transfer those credentials to the local
@@ -1076,10 +1078,29 @@
10761078
** see if those credentials are valid for a known user.
10771079
*/
10781080
if( uid==0 && db_get_boolean("http_authentication_ok",0) ){
10791081
uid = login_basic_authentication(zIpAddr);
10801082
}
1083
+
1084
+ /* Check for magic query parameters "resid" (for the username) and
1085
+ ** "token" for the password. Both values (if they exist) will be
1086
+ ** obfuscated.
1087
+ */
1088
+ if( uid==0 ){
1089
+ char *zUsr, *zPW;
1090
+ if( (zUsr = unobscure(P("resid")))!=0
1091
+ && (zPW = unobscure(P("token")))!=0
1092
+ ){
1093
+ char *zSha1Pw = sha1_shared_secret(zPW, zUsr, 0);
1094
+ uid = db_int(0, "SELECT uid FROM user"
1095
+ " WHERE login=%Q"
1096
+ " AND (constant_time_cmp(pw,%Q)=0"
1097
+ " OR constant_time_cmp(pw,%Q)=0)",
1098
+ zUsr, zSha1Pw, zPW);
1099
+ fossil_free(zSha1Pw);
1100
+ }
1101
+ }
10811102
10821103
/* If no user found yet, try to log in as "nobody" */
10831104
if( uid==0 ){
10841105
uid = db_int(0, "SELECT uid FROM user WHERE login='nobody'");
10851106
if( uid==0 ){
@@ -1229,11 +1250,11 @@
12291250
p->ApndWiki = p->Hyperlink = p->Clone =
12301251
p->NewTkt = p->Password = p->RdAddr =
12311252
p->TktFmt = p->Attach = p->ApndTkt =
12321253
p->ModWiki = p->ModTkt =
12331254
p->RdForum = p->WrForum = p->ModForum =
1234
- p->WrTForum = p->AdminForum =
1255
+ p->WrTForum = p->AdminForum = p->Chat =
12351256
p->EmailAlert = p->Announce = p->Debug = 1;
12361257
/* Fall thru into Read/Write */
12371258
case 'i': p->Read = p->Write = 1; break;
12381259
case 'o': p->Read = 1; break;
12391260
case 'z': p->Zip = 1; break;
@@ -1266,10 +1287,11 @@
12661287
case '3': p->WrForum = 1;
12671288
case '2': p->RdForum = 1; break;
12681289
12691290
case '7': p->EmailAlert = 1; break;
12701291
case 'A': p->Announce = 1; break;
1292
+ case 'C': p->Chat = 1; break;
12711293
case 'D': p->Debug = 1; break;
12721294
12731295
/* The "u" privilege recursively
12741296
** inherits all privileges of the user named "reader" */
12751297
case 'u': {
@@ -1349,10 +1371,11 @@
13491371
case '4': rc = p->WrTForum; break;
13501372
case '5': rc = p->ModForum; break;
13511373
case '6': rc = p->AdminForum;break;
13521374
case '7': rc = p->EmailAlert;break;
13531375
case 'A': rc = p->Announce; break;
1376
+ case 'C': rc = p->Chat; break;
13541377
case 'D': rc = p->Debug; break;
13551378
default: rc = 0; break;
13561379
}
13571380
}
13581381
return rc;
@@ -1549,11 +1572,11 @@
15491572
int doAlerts = 0; /* True if subscription is wanted too */
15501573
if( !db_get_boolean("self-register", 0) ){
15511574
style_header("Registration not possible");
15521575
@ <p>This project does not allow user self-registration. Please contact the
15531576
@ project administrator to obtain an account.</p>
1554
- style_finish_page("register");
1577
+ style_finish_page();
15551578
return;
15561579
}
15571580
zPerms = db_get("default-perms", "u");
15581581
15591582
/* Prompt the user for email alerts if this repository is configured for
@@ -1708,11 +1731,11 @@
17081731
}
17091732
alert_sender_free(pSender);
17101733
if( zGoto ){
17111734
@ <p><a href='%h(zGoto)'>Continue</a>
17121735
}
1713
- style_finish_page("register");
1736
+ style_finish_page();
17141737
return;
17151738
}
17161739
redirect_to_g();
17171740
}
17181741
@@ -1768,11 +1791,17 @@
17681791
@ </select></td></tr>
17691792
}
17701793
@ <tr>
17711794
@ <td class="form_label" align="right" id="pswd">Password:</td>
17721795
@ <td><input aria-labelledby="pswd" type="password" name="p" \
1773
- @ value="%h(zPasswd)" size="30"></td>
1796
+ @ value="%h(zPasswd)" size="30"> \
1797
+ if( zPasswd[0]==0 ){
1798
+ char *zRPW = fossil_random_password(12);
1799
+ @ Password suggestion: %z(zRPW)</td>
1800
+ }else{
1801
+ @ </td>
1802
+ }
17741803
@ <tr>
17751804
if( iErrLine==4 ){
17761805
@ <tr><td><td><span class='loginError'>&uarr; %h(zErr)</span></td></tr>
17771806
}
17781807
@ <tr>
@@ -1800,11 +1829,11 @@
18001829
@ %h(zCaptcha)
18011830
@ </pre>
18021831
@ Enter this 8-letter code in the "Captcha" box above.
18031832
@ </td></tr></table></div>
18041833
@ </form>
1805
- style_finish_page("register");
1834
+ style_finish_page();
18061835
18071836
free(zCaptcha);
18081837
}
18091838
18101839
/*
18111840
--- src/login.c
+++ src/login.c
@@ -656,10 +656,11 @@
656 */
657 login_set_user_cookie(zUsername, uid, NULL, rememberMe?0:1);
658 redirect_to_g();
659 }
660 }
 
661 style_header("Login/Logout");
662 style_adunit_config(ADUNIT_OFF);
663 @ %s(zErrMsg)
664 if( zGoto && !noAnon ){
665 char *zAbbrev = fossil_strdup(zGoto);
@@ -776,30 +777,31 @@
776 @ <hr>
777 @ <p>Configure <a href="%R/alerts">Email Alerts</a>
778 @ for user <b>%h(g.zLogin)</b></p>
779 }
780 if( g.perm.Password ){
 
781 @ <hr>
782 @ <p>Change Password for user <b>%h(g.zLogin)</b>:</p>
783 form_begin(0, "%R/login");
784 @ <table>
785 @ <tr><td class="form_label" id="oldpw">Old Password:</td>
786 @ <td><input aria-labelledby="oldpw" type="password" name="p" \
787 @ size="30"/></td></tr>
788 @ <tr><td class="form_label" id="newpw">New Password:</td>
789 @ <td><input aria-labelledby="newpw" type="password" name="n1" \
790 @ size="30" /></td></tr>
791 @ <tr><td class="form_label" id="reppw">Repeat New Password:</td>
792 @ <td><input aria-labledby="reppw" type="password" name="n2" \
793 @ size="30" /></td></tr>
794 @ <tr><td></td>
795 @ <td><input type="submit" value="Change Password" /></td></tr>
796 @ </table>
797 @ </form>
798 }
799 }
800 style_finish_page("login");
801 }
802
803 /*
804 ** Attempt to find login credentials for user zLogin on a peer repository
805 ** with project code zCode. Transfer those credentials to the local
@@ -1076,10 +1078,29 @@
1076 ** see if those credentials are valid for a known user.
1077 */
1078 if( uid==0 && db_get_boolean("http_authentication_ok",0) ){
1079 uid = login_basic_authentication(zIpAddr);
1080 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1081
1082 /* If no user found yet, try to log in as "nobody" */
1083 if( uid==0 ){
1084 uid = db_int(0, "SELECT uid FROM user WHERE login='nobody'");
1085 if( uid==0 ){
@@ -1229,11 +1250,11 @@
1229 p->ApndWiki = p->Hyperlink = p->Clone =
1230 p->NewTkt = p->Password = p->RdAddr =
1231 p->TktFmt = p->Attach = p->ApndTkt =
1232 p->ModWiki = p->ModTkt =
1233 p->RdForum = p->WrForum = p->ModForum =
1234 p->WrTForum = p->AdminForum =
1235 p->EmailAlert = p->Announce = p->Debug = 1;
1236 /* Fall thru into Read/Write */
1237 case 'i': p->Read = p->Write = 1; break;
1238 case 'o': p->Read = 1; break;
1239 case 'z': p->Zip = 1; break;
@@ -1266,10 +1287,11 @@
1266 case '3': p->WrForum = 1;
1267 case '2': p->RdForum = 1; break;
1268
1269 case '7': p->EmailAlert = 1; break;
1270 case 'A': p->Announce = 1; break;
 
1271 case 'D': p->Debug = 1; break;
1272
1273 /* The "u" privilege recursively
1274 ** inherits all privileges of the user named "reader" */
1275 case 'u': {
@@ -1349,10 +1371,11 @@
1349 case '4': rc = p->WrTForum; break;
1350 case '5': rc = p->ModForum; break;
1351 case '6': rc = p->AdminForum;break;
1352 case '7': rc = p->EmailAlert;break;
1353 case 'A': rc = p->Announce; break;
 
1354 case 'D': rc = p->Debug; break;
1355 default: rc = 0; break;
1356 }
1357 }
1358 return rc;
@@ -1549,11 +1572,11 @@
1549 int doAlerts = 0; /* True if subscription is wanted too */
1550 if( !db_get_boolean("self-register", 0) ){
1551 style_header("Registration not possible");
1552 @ <p>This project does not allow user self-registration. Please contact the
1553 @ project administrator to obtain an account.</p>
1554 style_finish_page("register");
1555 return;
1556 }
1557 zPerms = db_get("default-perms", "u");
1558
1559 /* Prompt the user for email alerts if this repository is configured for
@@ -1708,11 +1731,11 @@
1708 }
1709 alert_sender_free(pSender);
1710 if( zGoto ){
1711 @ <p><a href='%h(zGoto)'>Continue</a>
1712 }
1713 style_finish_page("register");
1714 return;
1715 }
1716 redirect_to_g();
1717 }
1718
@@ -1768,11 +1791,17 @@
1768 @ </select></td></tr>
1769 }
1770 @ <tr>
1771 @ <td class="form_label" align="right" id="pswd">Password:</td>
1772 @ <td><input aria-labelledby="pswd" type="password" name="p" \
1773 @ value="%h(zPasswd)" size="30"></td>
 
 
 
 
 
 
1774 @ <tr>
1775 if( iErrLine==4 ){
1776 @ <tr><td><td><span class='loginError'>&uarr; %h(zErr)</span></td></tr>
1777 }
1778 @ <tr>
@@ -1800,11 +1829,11 @@
1800 @ %h(zCaptcha)
1801 @ </pre>
1802 @ Enter this 8-letter code in the "Captcha" box above.
1803 @ </td></tr></table></div>
1804 @ </form>
1805 style_finish_page("register");
1806
1807 free(zCaptcha);
1808 }
1809
1810 /*
1811
--- src/login.c
+++ src/login.c
@@ -656,10 +656,11 @@
656 */
657 login_set_user_cookie(zUsername, uid, NULL, rememberMe?0:1);
658 redirect_to_g();
659 }
660 }
661 style_set_current_feature("login");
662 style_header("Login/Logout");
663 style_adunit_config(ADUNIT_OFF);
664 @ %s(zErrMsg)
665 if( zGoto && !noAnon ){
666 char *zAbbrev = fossil_strdup(zGoto);
@@ -776,30 +777,31 @@
777 @ <hr>
778 @ <p>Configure <a href="%R/alerts">Email Alerts</a>
779 @ for user <b>%h(g.zLogin)</b></p>
780 }
781 if( g.perm.Password ){
782 char *zRPW = fossil_random_password(12);
783 @ <hr>
784 @ <p>Change Password for user <b>%h(g.zLogin)</b>:</p>
785 form_begin(0, "%R/login");
786 @ <table>
787 @ <tr><td class="form_label" id="oldpw">Old Password:</td>
788 @ <td><input aria-labelledby="oldpw" type="password" name="p" \
789 @ size="30"/></td></tr>
790 @ <tr><td class="form_label" id="newpw">New Password:</td>
791 @ <td><input aria-labelledby="newpw" type="password" name="n1" \
792 @ size="30" /> Suggestion: %z(zRPW)</td></tr>
793 @ <tr><td class="form_label" id="reppw">Repeat New Password:</td>
794 @ <td><input aria-labledby="reppw" type="password" name="n2" \
795 @ size="30" /></td></tr>
796 @ <tr><td></td>
797 @ <td><input type="submit" value="Change Password" /></td></tr>
798 @ </table>
799 @ </form>
800 }
801 }
802 style_finish_page();
803 }
804
805 /*
806 ** Attempt to find login credentials for user zLogin on a peer repository
807 ** with project code zCode. Transfer those credentials to the local
@@ -1076,10 +1078,29 @@
1078 ** see if those credentials are valid for a known user.
1079 */
1080 if( uid==0 && db_get_boolean("http_authentication_ok",0) ){
1081 uid = login_basic_authentication(zIpAddr);
1082 }
1083
1084 /* Check for magic query parameters "resid" (for the username) and
1085 ** "token" for the password. Both values (if they exist) will be
1086 ** obfuscated.
1087 */
1088 if( uid==0 ){
1089 char *zUsr, *zPW;
1090 if( (zUsr = unobscure(P("resid")))!=0
1091 && (zPW = unobscure(P("token")))!=0
1092 ){
1093 char *zSha1Pw = sha1_shared_secret(zPW, zUsr, 0);
1094 uid = db_int(0, "SELECT uid FROM user"
1095 " WHERE login=%Q"
1096 " AND (constant_time_cmp(pw,%Q)=0"
1097 " OR constant_time_cmp(pw,%Q)=0)",
1098 zUsr, zSha1Pw, zPW);
1099 fossil_free(zSha1Pw);
1100 }
1101 }
1102
1103 /* If no user found yet, try to log in as "nobody" */
1104 if( uid==0 ){
1105 uid = db_int(0, "SELECT uid FROM user WHERE login='nobody'");
1106 if( uid==0 ){
@@ -1229,11 +1250,11 @@
1250 p->ApndWiki = p->Hyperlink = p->Clone =
1251 p->NewTkt = p->Password = p->RdAddr =
1252 p->TktFmt = p->Attach = p->ApndTkt =
1253 p->ModWiki = p->ModTkt =
1254 p->RdForum = p->WrForum = p->ModForum =
1255 p->WrTForum = p->AdminForum = p->Chat =
1256 p->EmailAlert = p->Announce = p->Debug = 1;
1257 /* Fall thru into Read/Write */
1258 case 'i': p->Read = p->Write = 1; break;
1259 case 'o': p->Read = 1; break;
1260 case 'z': p->Zip = 1; break;
@@ -1266,10 +1287,11 @@
1287 case '3': p->WrForum = 1;
1288 case '2': p->RdForum = 1; break;
1289
1290 case '7': p->EmailAlert = 1; break;
1291 case 'A': p->Announce = 1; break;
1292 case 'C': p->Chat = 1; break;
1293 case 'D': p->Debug = 1; break;
1294
1295 /* The "u" privilege recursively
1296 ** inherits all privileges of the user named "reader" */
1297 case 'u': {
@@ -1349,10 +1371,11 @@
1371 case '4': rc = p->WrTForum; break;
1372 case '5': rc = p->ModForum; break;
1373 case '6': rc = p->AdminForum;break;
1374 case '7': rc = p->EmailAlert;break;
1375 case 'A': rc = p->Announce; break;
1376 case 'C': rc = p->Chat; break;
1377 case 'D': rc = p->Debug; break;
1378 default: rc = 0; break;
1379 }
1380 }
1381 return rc;
@@ -1549,11 +1572,11 @@
1572 int doAlerts = 0; /* True if subscription is wanted too */
1573 if( !db_get_boolean("self-register", 0) ){
1574 style_header("Registration not possible");
1575 @ <p>This project does not allow user self-registration. Please contact the
1576 @ project administrator to obtain an account.</p>
1577 style_finish_page();
1578 return;
1579 }
1580 zPerms = db_get("default-perms", "u");
1581
1582 /* Prompt the user for email alerts if this repository is configured for
@@ -1708,11 +1731,11 @@
1731 }
1732 alert_sender_free(pSender);
1733 if( zGoto ){
1734 @ <p><a href='%h(zGoto)'>Continue</a>
1735 }
1736 style_finish_page();
1737 return;
1738 }
1739 redirect_to_g();
1740 }
1741
@@ -1768,11 +1791,17 @@
1791 @ </select></td></tr>
1792 }
1793 @ <tr>
1794 @ <td class="form_label" align="right" id="pswd">Password:</td>
1795 @ <td><input aria-labelledby="pswd" type="password" name="p" \
1796 @ value="%h(zPasswd)" size="30"> \
1797 if( zPasswd[0]==0 ){
1798 char *zRPW = fossil_random_password(12);
1799 @ Password suggestion: %z(zRPW)</td>
1800 }else{
1801 @ </td>
1802 }
1803 @ <tr>
1804 if( iErrLine==4 ){
1805 @ <tr><td><td><span class='loginError'>&uarr; %h(zErr)</span></td></tr>
1806 }
1807 @ <tr>
@@ -1800,11 +1829,11 @@
1829 @ %h(zCaptcha)
1830 @ </pre>
1831 @ Enter this 8-letter code in the "Captcha" box above.
1832 @ </td></tr></table></div>
1833 @ </form>
1834 style_finish_page();
1835
1836 free(zCaptcha);
1837 }
1838
1839 /*
1840
+8 -46
--- src/main.c
+++ src/main.c
@@ -107,10 +107,11 @@
107107
char WrTForum; /* 4: Post to forums not subject to moderation */
108108
char ModForum; /* 5: Moderate (approve or reject) forum posts */
109109
char AdminForum; /* 6: Grant capability 4 to other users */
110110
char EmailAlert; /* 7: Sign up for email notifications */
111111
char Announce; /* A: Send announcements */
112
+ char Chat; /* C: read or write the chatroom */
112113
char Debug; /* D: show extra Fossil debugging features */
113114
/* These last two are included to block infinite recursion */
114115
char XReader; /* u: Inherit all privileges of "reader" */
115116
char XDeveloper; /* v: Inherit all privileges of "developer" */
116117
};
@@ -320,10 +321,11 @@
320321
} reqPayload; /* request payload object (if any) */
321322
cson_array *warnings; /* response warnings */
322323
int timerId; /* fetched from fossil_timer_start() */
323324
} json;
324325
#endif /* FOSSIL_ENABLE_JSON */
326
+ int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */
325327
};
326328
327329
/*
328330
** Macro for debugging:
329331
*/
@@ -344,11 +346,11 @@
344346
/*
345347
** Zero, unlock, and free the saved database encryption key now.
346348
*/
347349
db_unsave_encryption_key();
348350
#endif
349
-#if defined(_WIN32) || defined(__BIONIC__)
351
+#if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
350352
/*
351353
** Free the secure getpass() buffer now.
352354
*/
353355
freepass();
354356
#endif
@@ -1310,11 +1312,11 @@
13101312
style_submenu_element("Stat", "stat");
13111313
fossil_version_blob(&versionInfo, verboseFlag);
13121314
@ <pre>
13131315
@ %h(blob_str(&versionInfo))
13141316
@ </pre>
1315
- style_finish_page("version");
1317
+ style_finish_page();
13161318
}
13171319
13181320
13191321
/*
13201322
** Set the g.zBaseURL value to the full URL for the toplevel of
@@ -2656,35 +2658,10 @@
26562658
cgi_handle_http_request(0);
26572659
process_one_web_page(0, 0, 1);
26582660
}
26592661
}
26602662
2661
-#if !defined(_WIN32)
2662
-#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
2663
-/*
2664
-** Search for an executable on the PATH environment variable.
2665
-** Return true (1) if found and false (0) if not found.
2666
-*/
2667
-static int binaryOnPath(const char *zBinary){
2668
- const char *zPath = fossil_getenv("PATH");
2669
- char *zFull;
2670
- int i;
2671
- int bExists;
2672
- while( zPath && zPath[0] ){
2673
- while( zPath[0]==':' ) zPath++;
2674
- for(i=0; zPath[i] && zPath[i]!=':'; i++){}
2675
- zFull = mprintf("%.*s/%s", i, zPath, zBinary);
2676
- bExists = file_access(zFull, X_OK);
2677
- fossil_free(zFull);
2678
- if( bExists==0 ) return 1;
2679
- zPath += i;
2680
- }
2681
- return 0;
2682
-}
2683
-#endif
2684
-#endif
2685
-
26862663
/*
26872664
** Respond to a SIGALRM by writing a message to the error log (if there
26882665
** is one) and exiting.
26892666
*/
26902667
#ifndef _WIN32
@@ -2892,27 +2869,11 @@
28922869
mxPort = iPort+100;
28932870
}
28942871
#if !defined(_WIN32)
28952872
/* Unix implementation */
28962873
if( isUiCmd ){
2897
-#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
2898
- zBrowser = db_get("web-browser", 0);
2899
- if( zBrowser==0 ){
2900
- static const char *const azBrowserProg[] =
2901
- { "xdg-open", "gnome-open", "firefox", "google-chrome" };
2902
- int i;
2903
- zBrowser = "echo";
2904
- for(i=0; i<count(azBrowserProg); i++){
2905
- if( binaryOnPath(azBrowserProg[i]) ){
2906
- zBrowser = azBrowserProg[i];
2907
- break;
2908
- }
2909
- }
2910
- }
2911
-#else
2912
- zBrowser = db_get("web-browser", "open");
2913
-#endif
2874
+ zBrowser = fossil_web_browser();
29142875
if( zIpAddr==0 ){
29152876
zBrowserCmd = mprintf("%s \"http://localhost:%%d/%s\" &",
29162877
zBrowser, zInitPage);
29172878
}else if( strchr(zIpAddr,':') ){
29182879
zBrowserCmd = mprintf("%s \"http://[%s]:%%d/%s\" &",
@@ -2971,11 +2932,11 @@
29712932
getpid());
29722933
}
29732934
#else
29742935
/* Win32 implementation */
29752936
if( isUiCmd ){
2976
- zBrowser = db_get("web-browser", "start");
2937
+ zBrowser = fossil_web_browser();
29772938
if( zIpAddr==0 ){
29782939
zBrowserCmd = mprintf("%s http://localhost:%%d/%s &",
29792940
zBrowser, zInitPage);
29802941
}else if( strchr(zIpAddr,':') ){
29812942
zBrowserCmd = mprintf("%s http://[%s]:%%d/%s &",
@@ -3049,10 +3010,11 @@
30493010
login_check_credentials();
30503011
if( !g.perm.Admin ){
30513012
login_needed(0);
30523013
return;
30533014
}
3015
+ style_set_current_feature("test");
30543016
style_header("Warning Test Page");
30553017
style_submenu_element("Error Log","%R/errorlog");
30563018
if( iCase<1 || iCase>4 ){
30573019
@ <p>Generate a message to the <a href="%R/errorlog">error log</a>
30583020
@ by clicking on one of the following cases:
@@ -3097,7 +3059,7 @@
30973059
cgi_reset_content();
30983060
webpage_error("Case 7 from /test-warning");
30993061
}
31003062
@ </ol>
31013063
@ <p>End of test</p>
3102
- style_finish_page("test");
3064
+ style_finish_page();
31033065
}
31043066
--- src/main.c
+++ src/main.c
@@ -107,10 +107,11 @@
107 char WrTForum; /* 4: Post to forums not subject to moderation */
108 char ModForum; /* 5: Moderate (approve or reject) forum posts */
109 char AdminForum; /* 6: Grant capability 4 to other users */
110 char EmailAlert; /* 7: Sign up for email notifications */
111 char Announce; /* A: Send announcements */
 
112 char Debug; /* D: show extra Fossil debugging features */
113 /* These last two are included to block infinite recursion */
114 char XReader; /* u: Inherit all privileges of "reader" */
115 char XDeveloper; /* v: Inherit all privileges of "developer" */
116 };
@@ -320,10 +321,11 @@
320 } reqPayload; /* request payload object (if any) */
321 cson_array *warnings; /* response warnings */
322 int timerId; /* fetched from fossil_timer_start() */
323 } json;
324 #endif /* FOSSIL_ENABLE_JSON */
 
325 };
326
327 /*
328 ** Macro for debugging:
329 */
@@ -344,11 +346,11 @@
344 /*
345 ** Zero, unlock, and free the saved database encryption key now.
346 */
347 db_unsave_encryption_key();
348 #endif
349 #if defined(_WIN32) || defined(__BIONIC__)
350 /*
351 ** Free the secure getpass() buffer now.
352 */
353 freepass();
354 #endif
@@ -1310,11 +1312,11 @@
1310 style_submenu_element("Stat", "stat");
1311 fossil_version_blob(&versionInfo, verboseFlag);
1312 @ <pre>
1313 @ %h(blob_str(&versionInfo))
1314 @ </pre>
1315 style_finish_page("version");
1316 }
1317
1318
1319 /*
1320 ** Set the g.zBaseURL value to the full URL for the toplevel of
@@ -2656,35 +2658,10 @@
2656 cgi_handle_http_request(0);
2657 process_one_web_page(0, 0, 1);
2658 }
2659 }
2660
2661 #if !defined(_WIN32)
2662 #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
2663 /*
2664 ** Search for an executable on the PATH environment variable.
2665 ** Return true (1) if found and false (0) if not found.
2666 */
2667 static int binaryOnPath(const char *zBinary){
2668 const char *zPath = fossil_getenv("PATH");
2669 char *zFull;
2670 int i;
2671 int bExists;
2672 while( zPath && zPath[0] ){
2673 while( zPath[0]==':' ) zPath++;
2674 for(i=0; zPath[i] && zPath[i]!=':'; i++){}
2675 zFull = mprintf("%.*s/%s", i, zPath, zBinary);
2676 bExists = file_access(zFull, X_OK);
2677 fossil_free(zFull);
2678 if( bExists==0 ) return 1;
2679 zPath += i;
2680 }
2681 return 0;
2682 }
2683 #endif
2684 #endif
2685
2686 /*
2687 ** Respond to a SIGALRM by writing a message to the error log (if there
2688 ** is one) and exiting.
2689 */
2690 #ifndef _WIN32
@@ -2892,27 +2869,11 @@
2892 mxPort = iPort+100;
2893 }
2894 #if !defined(_WIN32)
2895 /* Unix implementation */
2896 if( isUiCmd ){
2897 #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
2898 zBrowser = db_get("web-browser", 0);
2899 if( zBrowser==0 ){
2900 static const char *const azBrowserProg[] =
2901 { "xdg-open", "gnome-open", "firefox", "google-chrome" };
2902 int i;
2903 zBrowser = "echo";
2904 for(i=0; i<count(azBrowserProg); i++){
2905 if( binaryOnPath(azBrowserProg[i]) ){
2906 zBrowser = azBrowserProg[i];
2907 break;
2908 }
2909 }
2910 }
2911 #else
2912 zBrowser = db_get("web-browser", "open");
2913 #endif
2914 if( zIpAddr==0 ){
2915 zBrowserCmd = mprintf("%s \"http://localhost:%%d/%s\" &",
2916 zBrowser, zInitPage);
2917 }else if( strchr(zIpAddr,':') ){
2918 zBrowserCmd = mprintf("%s \"http://[%s]:%%d/%s\" &",
@@ -2971,11 +2932,11 @@
2971 getpid());
2972 }
2973 #else
2974 /* Win32 implementation */
2975 if( isUiCmd ){
2976 zBrowser = db_get("web-browser", "start");
2977 if( zIpAddr==0 ){
2978 zBrowserCmd = mprintf("%s http://localhost:%%d/%s &",
2979 zBrowser, zInitPage);
2980 }else if( strchr(zIpAddr,':') ){
2981 zBrowserCmd = mprintf("%s http://[%s]:%%d/%s &",
@@ -3049,10 +3010,11 @@
3049 login_check_credentials();
3050 if( !g.perm.Admin ){
3051 login_needed(0);
3052 return;
3053 }
 
3054 style_header("Warning Test Page");
3055 style_submenu_element("Error Log","%R/errorlog");
3056 if( iCase<1 || iCase>4 ){
3057 @ <p>Generate a message to the <a href="%R/errorlog">error log</a>
3058 @ by clicking on one of the following cases:
@@ -3097,7 +3059,7 @@
3097 cgi_reset_content();
3098 webpage_error("Case 7 from /test-warning");
3099 }
3100 @ </ol>
3101 @ <p>End of test</p>
3102 style_finish_page("test");
3103 }
3104
--- src/main.c
+++ src/main.c
@@ -107,10 +107,11 @@
107 char WrTForum; /* 4: Post to forums not subject to moderation */
108 char ModForum; /* 5: Moderate (approve or reject) forum posts */
109 char AdminForum; /* 6: Grant capability 4 to other users */
110 char EmailAlert; /* 7: Sign up for email notifications */
111 char Announce; /* A: Send announcements */
112 char Chat; /* C: read or write the chatroom */
113 char Debug; /* D: show extra Fossil debugging features */
114 /* These last two are included to block infinite recursion */
115 char XReader; /* u: Inherit all privileges of "reader" */
116 char XDeveloper; /* v: Inherit all privileges of "developer" */
117 };
@@ -320,10 +321,11 @@
321 } reqPayload; /* request payload object (if any) */
322 cson_array *warnings; /* response warnings */
323 int timerId; /* fetched from fossil_timer_start() */
324 } json;
325 #endif /* FOSSIL_ENABLE_JSON */
326 int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */
327 };
328
329 /*
330 ** Macro for debugging:
331 */
@@ -344,11 +346,11 @@
346 /*
347 ** Zero, unlock, and free the saved database encryption key now.
348 */
349 db_unsave_encryption_key();
350 #endif
351 #if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
352 /*
353 ** Free the secure getpass() buffer now.
354 */
355 freepass();
356 #endif
@@ -1310,11 +1312,11 @@
1312 style_submenu_element("Stat", "stat");
1313 fossil_version_blob(&versionInfo, verboseFlag);
1314 @ <pre>
1315 @ %h(blob_str(&versionInfo))
1316 @ </pre>
1317 style_finish_page();
1318 }
1319
1320
1321 /*
1322 ** Set the g.zBaseURL value to the full URL for the toplevel of
@@ -2656,35 +2658,10 @@
2658 cgi_handle_http_request(0);
2659 process_one_web_page(0, 0, 1);
2660 }
2661 }
2662
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2663 /*
2664 ** Respond to a SIGALRM by writing a message to the error log (if there
2665 ** is one) and exiting.
2666 */
2667 #ifndef _WIN32
@@ -2892,27 +2869,11 @@
2869 mxPort = iPort+100;
2870 }
2871 #if !defined(_WIN32)
2872 /* Unix implementation */
2873 if( isUiCmd ){
2874 zBrowser = fossil_web_browser();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2875 if( zIpAddr==0 ){
2876 zBrowserCmd = mprintf("%s \"http://localhost:%%d/%s\" &",
2877 zBrowser, zInitPage);
2878 }else if( strchr(zIpAddr,':') ){
2879 zBrowserCmd = mprintf("%s \"http://[%s]:%%d/%s\" &",
@@ -2971,11 +2932,11 @@
2932 getpid());
2933 }
2934 #else
2935 /* Win32 implementation */
2936 if( isUiCmd ){
2937 zBrowser = fossil_web_browser();
2938 if( zIpAddr==0 ){
2939 zBrowserCmd = mprintf("%s http://localhost:%%d/%s &",
2940 zBrowser, zInitPage);
2941 }else if( strchr(zIpAddr,':') ){
2942 zBrowserCmd = mprintf("%s http://[%s]:%%d/%s &",
@@ -3049,10 +3010,11 @@
3010 login_check_credentials();
3011 if( !g.perm.Admin ){
3012 login_needed(0);
3013 return;
3014 }
3015 style_set_current_feature("test");
3016 style_header("Warning Test Page");
3017 style_submenu_element("Error Log","%R/errorlog");
3018 if( iCase<1 || iCase>4 ){
3019 @ <p>Generate a message to the <a href="%R/errorlog">error log</a>
3020 @ by clicking on one of the following cases:
@@ -3097,7 +3059,7 @@
3059 cgi_reset_content();
3060 webpage_error("Case 7 from /test-warning");
3061 }
3062 @ </ol>
3063 @ <p>End of test</p>
3064 style_finish_page();
3065 }
3066
+19 -2
--- src/main.mk
+++ src/main.mk
@@ -32,10 +32,11 @@
3232
$(SRCDIR)/bundle.c \
3333
$(SRCDIR)/cache.c \
3434
$(SRCDIR)/capabilities.c \
3535
$(SRCDIR)/captcha.c \
3636
$(SRCDIR)/cgi.c \
37
+ $(SRCDIR)/chat.c \
3738
$(SRCDIR)/checkin.c \
3839
$(SRCDIR)/checkout.c \
3940
$(SRCDIR)/clearsign.c \
4041
$(SRCDIR)/clone.c \
4142
$(SRCDIR)/comformat.c \
@@ -219,10 +220,15 @@
219220
$(SRCDIR)/../skins/xekri/css.txt \
220221
$(SRCDIR)/../skins/xekri/details.txt \
221222
$(SRCDIR)/../skins/xekri/footer.txt \
222223
$(SRCDIR)/../skins/xekri/header.txt \
223224
$(SRCDIR)/accordion.js \
225
+ $(SRCDIR)/alerts/bflat2.wav \
226
+ $(SRCDIR)/alerts/bflat3.wav \
227
+ $(SRCDIR)/alerts/bloop.wav \
228
+ $(SRCDIR)/alerts/plunk.wav \
229
+ $(SRCDIR)/chat.js \
224230
$(SRCDIR)/ci_edit.js \
225231
$(SRCDIR)/copybtn.js \
226232
$(SRCDIR)/default.css \
227233
$(SRCDIR)/diff.tcl \
228234
$(SRCDIR)/forum.js \
@@ -291,10 +297,11 @@
291297
$(OBJDIR)/bundle_.c \
292298
$(OBJDIR)/cache_.c \
293299
$(OBJDIR)/capabilities_.c \
294300
$(OBJDIR)/captcha_.c \
295301
$(OBJDIR)/cgi_.c \
302
+ $(OBJDIR)/chat_.c \
296303
$(OBJDIR)/checkin_.c \
297304
$(OBJDIR)/checkout_.c \
298305
$(OBJDIR)/clearsign_.c \
299306
$(OBJDIR)/clone_.c \
300307
$(OBJDIR)/comformat_.c \
@@ -439,10 +446,11 @@
439446
$(OBJDIR)/bundle.o \
440447
$(OBJDIR)/cache.o \
441448
$(OBJDIR)/capabilities.o \
442449
$(OBJDIR)/captcha.o \
443450
$(OBJDIR)/cgi.o \
451
+ $(OBJDIR)/chat.o \
444452
$(OBJDIR)/checkin.o \
445453
$(OBJDIR)/checkout.o \
446454
$(OBJDIR)/clearsign.o \
447455
$(OBJDIR)/clone.o \
448456
$(OBJDIR)/comformat.o \
@@ -738,13 +746,13 @@
738746
$(OBJDIR)/th_lang.o \
739747
$(OBJDIR)/th_tcl.o \
740748
$(OBJDIR)/cson_amalgamation.o
741749
742750
743
-$(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ)
751
+$(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(EXTRAOBJ) $(OBJ)
744752
$(OBJDIR)/codecheck1 $(TRANS_SRC)
745
- $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
753
+ $(TCC) $(TCCFLAGS) -o $(APPNAME) $(EXTRAOBJ) $(OBJ) $(LIB)
746754
747755
# This rule prevents make from using its default rules to try build
748756
# an executable named "manifest" out of the file named "manifest.c"
749757
#
750758
$(SRCDIR)/../manifest:
@@ -777,10 +785,11 @@
777785
$(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
778786
$(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
779787
$(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
780788
$(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
781789
$(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
790
+ $(OBJDIR)/chat_.c:$(OBJDIR)/chat.h \
782791
$(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
783792
$(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
784793
$(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
785794
$(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
786795
$(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1055,10 +1064,18 @@
10551064
10561065
$(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
10571066
$(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
10581067
10591068
$(OBJDIR)/cgi.h: $(OBJDIR)/headers
1069
+
1070
+$(OBJDIR)/chat_.c: $(SRCDIR)/chat.c $(OBJDIR)/translate
1071
+ $(OBJDIR)/translate $(SRCDIR)/chat.c >$@
1072
+
1073
+$(OBJDIR)/chat.o: $(OBJDIR)/chat_.c $(OBJDIR)/chat.h $(SRCDIR)/config.h
1074
+ $(XTCC) -o $(OBJDIR)/chat.o -c $(OBJDIR)/chat_.c
1075
+
1076
+$(OBJDIR)/chat.h: $(OBJDIR)/headers
10601077
10611078
$(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
10621079
$(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
10631080
10641081
$(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
10651082
--- src/main.mk
+++ src/main.mk
@@ -32,10 +32,11 @@
32 $(SRCDIR)/bundle.c \
33 $(SRCDIR)/cache.c \
34 $(SRCDIR)/capabilities.c \
35 $(SRCDIR)/captcha.c \
36 $(SRCDIR)/cgi.c \
 
37 $(SRCDIR)/checkin.c \
38 $(SRCDIR)/checkout.c \
39 $(SRCDIR)/clearsign.c \
40 $(SRCDIR)/clone.c \
41 $(SRCDIR)/comformat.c \
@@ -219,10 +220,15 @@
219 $(SRCDIR)/../skins/xekri/css.txt \
220 $(SRCDIR)/../skins/xekri/details.txt \
221 $(SRCDIR)/../skins/xekri/footer.txt \
222 $(SRCDIR)/../skins/xekri/header.txt \
223 $(SRCDIR)/accordion.js \
 
 
 
 
 
224 $(SRCDIR)/ci_edit.js \
225 $(SRCDIR)/copybtn.js \
226 $(SRCDIR)/default.css \
227 $(SRCDIR)/diff.tcl \
228 $(SRCDIR)/forum.js \
@@ -291,10 +297,11 @@
291 $(OBJDIR)/bundle_.c \
292 $(OBJDIR)/cache_.c \
293 $(OBJDIR)/capabilities_.c \
294 $(OBJDIR)/captcha_.c \
295 $(OBJDIR)/cgi_.c \
 
296 $(OBJDIR)/checkin_.c \
297 $(OBJDIR)/checkout_.c \
298 $(OBJDIR)/clearsign_.c \
299 $(OBJDIR)/clone_.c \
300 $(OBJDIR)/comformat_.c \
@@ -439,10 +446,11 @@
439 $(OBJDIR)/bundle.o \
440 $(OBJDIR)/cache.o \
441 $(OBJDIR)/capabilities.o \
442 $(OBJDIR)/captcha.o \
443 $(OBJDIR)/cgi.o \
 
444 $(OBJDIR)/checkin.o \
445 $(OBJDIR)/checkout.o \
446 $(OBJDIR)/clearsign.o \
447 $(OBJDIR)/clone.o \
448 $(OBJDIR)/comformat.o \
@@ -738,13 +746,13 @@
738 $(OBJDIR)/th_lang.o \
739 $(OBJDIR)/th_tcl.o \
740 $(OBJDIR)/cson_amalgamation.o
741
742
743 $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ)
744 $(OBJDIR)/codecheck1 $(TRANS_SRC)
745 $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
746
747 # This rule prevents make from using its default rules to try build
748 # an executable named "manifest" out of the file named "manifest.c"
749 #
750 $(SRCDIR)/../manifest:
@@ -777,10 +785,11 @@
777 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
778 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
779 $(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
780 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
781 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
 
782 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
783 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
784 $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
785 $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
786 $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1055,10 +1064,18 @@
1055
1056 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1057 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1058
1059 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1060
1061 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
1062 $(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
1063
1064 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1065
--- src/main.mk
+++ src/main.mk
@@ -32,10 +32,11 @@
32 $(SRCDIR)/bundle.c \
33 $(SRCDIR)/cache.c \
34 $(SRCDIR)/capabilities.c \
35 $(SRCDIR)/captcha.c \
36 $(SRCDIR)/cgi.c \
37 $(SRCDIR)/chat.c \
38 $(SRCDIR)/checkin.c \
39 $(SRCDIR)/checkout.c \
40 $(SRCDIR)/clearsign.c \
41 $(SRCDIR)/clone.c \
42 $(SRCDIR)/comformat.c \
@@ -219,10 +220,15 @@
220 $(SRCDIR)/../skins/xekri/css.txt \
221 $(SRCDIR)/../skins/xekri/details.txt \
222 $(SRCDIR)/../skins/xekri/footer.txt \
223 $(SRCDIR)/../skins/xekri/header.txt \
224 $(SRCDIR)/accordion.js \
225 $(SRCDIR)/alerts/bflat2.wav \
226 $(SRCDIR)/alerts/bflat3.wav \
227 $(SRCDIR)/alerts/bloop.wav \
228 $(SRCDIR)/alerts/plunk.wav \
229 $(SRCDIR)/chat.js \
230 $(SRCDIR)/ci_edit.js \
231 $(SRCDIR)/copybtn.js \
232 $(SRCDIR)/default.css \
233 $(SRCDIR)/diff.tcl \
234 $(SRCDIR)/forum.js \
@@ -291,10 +297,11 @@
297 $(OBJDIR)/bundle_.c \
298 $(OBJDIR)/cache_.c \
299 $(OBJDIR)/capabilities_.c \
300 $(OBJDIR)/captcha_.c \
301 $(OBJDIR)/cgi_.c \
302 $(OBJDIR)/chat_.c \
303 $(OBJDIR)/checkin_.c \
304 $(OBJDIR)/checkout_.c \
305 $(OBJDIR)/clearsign_.c \
306 $(OBJDIR)/clone_.c \
307 $(OBJDIR)/comformat_.c \
@@ -439,10 +446,11 @@
446 $(OBJDIR)/bundle.o \
447 $(OBJDIR)/cache.o \
448 $(OBJDIR)/capabilities.o \
449 $(OBJDIR)/captcha.o \
450 $(OBJDIR)/cgi.o \
451 $(OBJDIR)/chat.o \
452 $(OBJDIR)/checkin.o \
453 $(OBJDIR)/checkout.o \
454 $(OBJDIR)/clearsign.o \
455 $(OBJDIR)/clone.o \
456 $(OBJDIR)/comformat.o \
@@ -738,13 +746,13 @@
746 $(OBJDIR)/th_lang.o \
747 $(OBJDIR)/th_tcl.o \
748 $(OBJDIR)/cson_amalgamation.o
749
750
751 $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(EXTRAOBJ) $(OBJ)
752 $(OBJDIR)/codecheck1 $(TRANS_SRC)
753 $(TCC) $(TCCFLAGS) -o $(APPNAME) $(EXTRAOBJ) $(OBJ) $(LIB)
754
755 # This rule prevents make from using its default rules to try build
756 # an executable named "manifest" out of the file named "manifest.c"
757 #
758 $(SRCDIR)/../manifest:
@@ -777,10 +785,11 @@
785 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
786 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
787 $(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
788 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
789 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
790 $(OBJDIR)/chat_.c:$(OBJDIR)/chat.h \
791 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
792 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
793 $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
794 $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
795 $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1055,10 +1064,18 @@
1064
1065 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1066 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1067
1068 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
1069
1070 $(OBJDIR)/chat_.c: $(SRCDIR)/chat.c $(OBJDIR)/translate
1071 $(OBJDIR)/translate $(SRCDIR)/chat.c >$@
1072
1073 $(OBJDIR)/chat.o: $(OBJDIR)/chat_.c $(OBJDIR)/chat.h $(SRCDIR)/config.h
1074 $(XTCC) -o $(OBJDIR)/chat.o -c $(OBJDIR)/chat_.c
1075
1076 $(OBJDIR)/chat.h: $(OBJDIR)/headers
1077
1078 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
1079 $(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
1080
1081 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1082
+19 -2
--- src/main.mk
+++ src/main.mk
@@ -32,10 +32,11 @@
3232
$(SRCDIR)/bundle.c \
3333
$(SRCDIR)/cache.c \
3434
$(SRCDIR)/capabilities.c \
3535
$(SRCDIR)/captcha.c \
3636
$(SRCDIR)/cgi.c \
37
+ $(SRCDIR)/chat.c \
3738
$(SRCDIR)/checkin.c \
3839
$(SRCDIR)/checkout.c \
3940
$(SRCDIR)/clearsign.c \
4041
$(SRCDIR)/clone.c \
4142
$(SRCDIR)/comformat.c \
@@ -219,10 +220,15 @@
219220
$(SRCDIR)/../skins/xekri/css.txt \
220221
$(SRCDIR)/../skins/xekri/details.txt \
221222
$(SRCDIR)/../skins/xekri/footer.txt \
222223
$(SRCDIR)/../skins/xekri/header.txt \
223224
$(SRCDIR)/accordion.js \
225
+ $(SRCDIR)/alerts/bflat2.wav \
226
+ $(SRCDIR)/alerts/bflat3.wav \
227
+ $(SRCDIR)/alerts/bloop.wav \
228
+ $(SRCDIR)/alerts/plunk.wav \
229
+ $(SRCDIR)/chat.js \
224230
$(SRCDIR)/ci_edit.js \
225231
$(SRCDIR)/copybtn.js \
226232
$(SRCDIR)/default.css \
227233
$(SRCDIR)/diff.tcl \
228234
$(SRCDIR)/forum.js \
@@ -291,10 +297,11 @@
291297
$(OBJDIR)/bundle_.c \
292298
$(OBJDIR)/cache_.c \
293299
$(OBJDIR)/capabilities_.c \
294300
$(OBJDIR)/captcha_.c \
295301
$(OBJDIR)/cgi_.c \
302
+ $(OBJDIR)/chat_.c \
296303
$(OBJDIR)/checkin_.c \
297304
$(OBJDIR)/checkout_.c \
298305
$(OBJDIR)/clearsign_.c \
299306
$(OBJDIR)/clone_.c \
300307
$(OBJDIR)/comformat_.c \
@@ -439,10 +446,11 @@
439446
$(OBJDIR)/bundle.o \
440447
$(OBJDIR)/cache.o \
441448
$(OBJDIR)/capabilities.o \
442449
$(OBJDIR)/captcha.o \
443450
$(OBJDIR)/cgi.o \
451
+ $(OBJDIR)/chat.o \
444452
$(OBJDIR)/checkin.o \
445453
$(OBJDIR)/checkout.o \
446454
$(OBJDIR)/clearsign.o \
447455
$(OBJDIR)/clone.o \
448456
$(OBJDIR)/comformat.o \
@@ -738,13 +746,13 @@
738746
$(OBJDIR)/th_lang.o \
739747
$(OBJDIR)/th_tcl.o \
740748
$(OBJDIR)/cson_amalgamation.o
741749
742750
743
-$(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ)
751
+$(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(EXTRAOBJ) $(OBJ)
744752
$(OBJDIR)/codecheck1 $(TRANS_SRC)
745
- $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
753
+ $(TCC) $(TCCFLAGS) -o $(APPNAME) $(EXTRAOBJ) $(OBJ) $(LIB)
746754
747755
# This rule prevents make from using its default rules to try build
748756
# an executable named "manifest" out of the file named "manifest.c"
749757
#
750758
$(SRCDIR)/../manifest:
@@ -777,10 +785,11 @@
777785
$(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
778786
$(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
779787
$(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
780788
$(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
781789
$(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
790
+ $(OBJDIR)/chat_.c:$(OBJDIR)/chat.h \
782791
$(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
783792
$(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
784793
$(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
785794
$(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
786795
$(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1055,10 +1064,18 @@
10551064
10561065
$(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
10571066
$(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
10581067
10591068
$(OBJDIR)/cgi.h: $(OBJDIR)/headers
1069
+
1070
+$(OBJDIR)/chat_.c: $(SRCDIR)/chat.c $(OBJDIR)/translate
1071
+ $(OBJDIR)/translate $(SRCDIR)/chat.c >$@
1072
+
1073
+$(OBJDIR)/chat.o: $(OBJDIR)/chat_.c $(OBJDIR)/chat.h $(SRCDIR)/config.h
1074
+ $(XTCC) -o $(OBJDIR)/chat.o -c $(OBJDIR)/chat_.c
1075
+
1076
+$(OBJDIR)/chat.h: $(OBJDIR)/headers
10601077
10611078
$(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
10621079
$(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
10631080
10641081
$(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
10651082
--- src/main.mk
+++ src/main.mk
@@ -32,10 +32,11 @@
32 $(SRCDIR)/bundle.c \
33 $(SRCDIR)/cache.c \
34 $(SRCDIR)/capabilities.c \
35 $(SRCDIR)/captcha.c \
36 $(SRCDIR)/cgi.c \
 
37 $(SRCDIR)/checkin.c \
38 $(SRCDIR)/checkout.c \
39 $(SRCDIR)/clearsign.c \
40 $(SRCDIR)/clone.c \
41 $(SRCDIR)/comformat.c \
@@ -219,10 +220,15 @@
219 $(SRCDIR)/../skins/xekri/css.txt \
220 $(SRCDIR)/../skins/xekri/details.txt \
221 $(SRCDIR)/../skins/xekri/footer.txt \
222 $(SRCDIR)/../skins/xekri/header.txt \
223 $(SRCDIR)/accordion.js \
 
 
 
 
 
224 $(SRCDIR)/ci_edit.js \
225 $(SRCDIR)/copybtn.js \
226 $(SRCDIR)/default.css \
227 $(SRCDIR)/diff.tcl \
228 $(SRCDIR)/forum.js \
@@ -291,10 +297,11 @@
291 $(OBJDIR)/bundle_.c \
292 $(OBJDIR)/cache_.c \
293 $(OBJDIR)/capabilities_.c \
294 $(OBJDIR)/captcha_.c \
295 $(OBJDIR)/cgi_.c \
 
296 $(OBJDIR)/checkin_.c \
297 $(OBJDIR)/checkout_.c \
298 $(OBJDIR)/clearsign_.c \
299 $(OBJDIR)/clone_.c \
300 $(OBJDIR)/comformat_.c \
@@ -439,10 +446,11 @@
439 $(OBJDIR)/bundle.o \
440 $(OBJDIR)/cache.o \
441 $(OBJDIR)/capabilities.o \
442 $(OBJDIR)/captcha.o \
443 $(OBJDIR)/cgi.o \
 
444 $(OBJDIR)/checkin.o \
445 $(OBJDIR)/checkout.o \
446 $(OBJDIR)/clearsign.o \
447 $(OBJDIR)/clone.o \
448 $(OBJDIR)/comformat.o \
@@ -738,13 +746,13 @@
738 $(OBJDIR)/th_lang.o \
739 $(OBJDIR)/th_tcl.o \
740 $(OBJDIR)/cson_amalgamation.o
741
742
743 $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ)
744 $(OBJDIR)/codecheck1 $(TRANS_SRC)
745 $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
746
747 # This rule prevents make from using its default rules to try build
748 # an executable named "manifest" out of the file named "manifest.c"
749 #
750 $(SRCDIR)/../manifest:
@@ -777,10 +785,11 @@
777 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
778 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
779 $(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
780 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
781 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
 
782 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
783 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
784 $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
785 $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
786 $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1055,10 +1064,18 @@
1055
1056 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1057 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1058
1059 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1060
1061 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
1062 $(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
1063
1064 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1065
--- src/main.mk
+++ src/main.mk
@@ -32,10 +32,11 @@
32 $(SRCDIR)/bundle.c \
33 $(SRCDIR)/cache.c \
34 $(SRCDIR)/capabilities.c \
35 $(SRCDIR)/captcha.c \
36 $(SRCDIR)/cgi.c \
37 $(SRCDIR)/chat.c \
38 $(SRCDIR)/checkin.c \
39 $(SRCDIR)/checkout.c \
40 $(SRCDIR)/clearsign.c \
41 $(SRCDIR)/clone.c \
42 $(SRCDIR)/comformat.c \
@@ -219,10 +220,15 @@
220 $(SRCDIR)/../skins/xekri/css.txt \
221 $(SRCDIR)/../skins/xekri/details.txt \
222 $(SRCDIR)/../skins/xekri/footer.txt \
223 $(SRCDIR)/../skins/xekri/header.txt \
224 $(SRCDIR)/accordion.js \
225 $(SRCDIR)/alerts/bflat2.wav \
226 $(SRCDIR)/alerts/bflat3.wav \
227 $(SRCDIR)/alerts/bloop.wav \
228 $(SRCDIR)/alerts/plunk.wav \
229 $(SRCDIR)/chat.js \
230 $(SRCDIR)/ci_edit.js \
231 $(SRCDIR)/copybtn.js \
232 $(SRCDIR)/default.css \
233 $(SRCDIR)/diff.tcl \
234 $(SRCDIR)/forum.js \
@@ -291,10 +297,11 @@
297 $(OBJDIR)/bundle_.c \
298 $(OBJDIR)/cache_.c \
299 $(OBJDIR)/capabilities_.c \
300 $(OBJDIR)/captcha_.c \
301 $(OBJDIR)/cgi_.c \
302 $(OBJDIR)/chat_.c \
303 $(OBJDIR)/checkin_.c \
304 $(OBJDIR)/checkout_.c \
305 $(OBJDIR)/clearsign_.c \
306 $(OBJDIR)/clone_.c \
307 $(OBJDIR)/comformat_.c \
@@ -439,10 +446,11 @@
446 $(OBJDIR)/bundle.o \
447 $(OBJDIR)/cache.o \
448 $(OBJDIR)/capabilities.o \
449 $(OBJDIR)/captcha.o \
450 $(OBJDIR)/cgi.o \
451 $(OBJDIR)/chat.o \
452 $(OBJDIR)/checkin.o \
453 $(OBJDIR)/checkout.o \
454 $(OBJDIR)/clearsign.o \
455 $(OBJDIR)/clone.o \
456 $(OBJDIR)/comformat.o \
@@ -738,13 +746,13 @@
746 $(OBJDIR)/th_lang.o \
747 $(OBJDIR)/th_tcl.o \
748 $(OBJDIR)/cson_amalgamation.o
749
750
751 $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(EXTRAOBJ) $(OBJ)
752 $(OBJDIR)/codecheck1 $(TRANS_SRC)
753 $(TCC) $(TCCFLAGS) -o $(APPNAME) $(EXTRAOBJ) $(OBJ) $(LIB)
754
755 # This rule prevents make from using its default rules to try build
756 # an executable named "manifest" out of the file named "manifest.c"
757 #
758 $(SRCDIR)/../manifest:
@@ -777,10 +785,11 @@
785 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
786 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
787 $(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
788 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
789 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
790 $(OBJDIR)/chat_.c:$(OBJDIR)/chat.h \
791 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
792 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
793 $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
794 $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
795 $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1055,10 +1064,18 @@
1064
1065 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1066 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1067
1068 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
1069
1070 $(OBJDIR)/chat_.c: $(SRCDIR)/chat.c $(OBJDIR)/translate
1071 $(OBJDIR)/translate $(SRCDIR)/chat.c >$@
1072
1073 $(OBJDIR)/chat.o: $(OBJDIR)/chat_.c $(OBJDIR)/chat.h $(SRCDIR)/config.h
1074 $(XTCC) -o $(OBJDIR)/chat.o -c $(OBJDIR)/chat_.c
1075
1076 $(OBJDIR)/chat.h: $(OBJDIR)/headers
1077
1078 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
1079 $(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
1080
1081 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1082
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -43,10 +43,11 @@
4343
bundle
4444
cache
4545
capabilities
4646
captcha
4747
cgi
48
+ chat
4849
checkin
4950
checkout
5051
clearsign
5152
clone
5253
comformat
@@ -184,10 +185,11 @@
184185
*.js
185186
default.css
186187
style.*.css
187188
../skins/*/*.txt
188189
sounds/*.wav
190
+ alerts/*.wav
189191
}
190192
191193
# Options used to compile the included SQLite library.
192194
#
193195
set SQLITE_OPTIONS {
@@ -445,13 +447,13 @@
445447
$(OBJDIR)/th_tcl.o <<<NEXT_LINE>>>
446448
$(OBJDIR)/cson_amalgamation.o
447449
}]
448450
449451
writeln {
450
-$(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ)
452
+$(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(EXTRAOBJ) $(OBJ)
451453
$(OBJDIR)/codecheck1 $(TRANS_SRC)
452
- $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
454
+ $(TCC) $(TCCFLAGS) -o $(APPNAME) $(EXTRAOBJ) $(OBJ) $(LIB)
453455
454456
# This rule prevents make from using its default rules to try build
455457
# an executable named "manifest" out of the file named "manifest.c"
456458
#
457459
$(SRCDIR)/../manifest:
@@ -1176,13 +1178,13 @@
11761178
11771179
ifdef FOSSIL_BUILD_SSL
11781180
APPTARGETS += openssl
11791181
endif
11801182
1181
-$(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o
1183
+$(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o
11821184
$(CODECHECK1) $(TRANS_SRC)
1183
- $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(LIB)
1185
+ $(TCC) -o $@ $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o $(LIB)
11841186
11851187
# This rule prevents make from using its default rules to try build
11861188
# an executable named "manifest" out of the file named "manifest.c"
11871189
#
11881190
$(SRCDIR)/../manifest:
11891191
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -43,10 +43,11 @@
43 bundle
44 cache
45 capabilities
46 captcha
47 cgi
 
48 checkin
49 checkout
50 clearsign
51 clone
52 comformat
@@ -184,10 +185,11 @@
184 *.js
185 default.css
186 style.*.css
187 ../skins/*/*.txt
188 sounds/*.wav
 
189 }
190
191 # Options used to compile the included SQLite library.
192 #
193 set SQLITE_OPTIONS {
@@ -445,13 +447,13 @@
445 $(OBJDIR)/th_tcl.o <<<NEXT_LINE>>>
446 $(OBJDIR)/cson_amalgamation.o
447 }]
448
449 writeln {
450 $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ)
451 $(OBJDIR)/codecheck1 $(TRANS_SRC)
452 $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
453
454 # This rule prevents make from using its default rules to try build
455 # an executable named "manifest" out of the file named "manifest.c"
456 #
457 $(SRCDIR)/../manifest:
@@ -1176,13 +1178,13 @@
1176
1177 ifdef FOSSIL_BUILD_SSL
1178 APPTARGETS += openssl
1179 endif
1180
1181 $(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o
1182 $(CODECHECK1) $(TRANS_SRC)
1183 $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(LIB)
1184
1185 # This rule prevents make from using its default rules to try build
1186 # an executable named "manifest" out of the file named "manifest.c"
1187 #
1188 $(SRCDIR)/../manifest:
1189
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -43,10 +43,11 @@
43 bundle
44 cache
45 capabilities
46 captcha
47 cgi
48 chat
49 checkin
50 checkout
51 clearsign
52 clone
53 comformat
@@ -184,10 +185,11 @@
185 *.js
186 default.css
187 style.*.css
188 ../skins/*/*.txt
189 sounds/*.wav
190 alerts/*.wav
191 }
192
193 # Options used to compile the included SQLite library.
194 #
195 set SQLITE_OPTIONS {
@@ -445,13 +447,13 @@
447 $(OBJDIR)/th_tcl.o <<<NEXT_LINE>>>
448 $(OBJDIR)/cson_amalgamation.o
449 }]
450
451 writeln {
452 $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(EXTRAOBJ) $(OBJ)
453 $(OBJDIR)/codecheck1 $(TRANS_SRC)
454 $(TCC) $(TCCFLAGS) -o $(APPNAME) $(EXTRAOBJ) $(OBJ) $(LIB)
455
456 # This rule prevents make from using its default rules to try build
457 # an executable named "manifest" out of the file named "manifest.c"
458 #
459 $(SRCDIR)/../manifest:
@@ -1176,13 +1178,13 @@
1178
1179 ifdef FOSSIL_BUILD_SSL
1180 APPTARGETS += openssl
1181 endif
1182
1183 $(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o
1184 $(CODECHECK1) $(TRANS_SRC)
1185 $(TCC) -o $@ $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o $(LIB)
1186
1187 # This rule prevents make from using its default rules to try build
1188 # an executable named "manifest" out of the file named "manifest.c"
1189 #
1190 $(SRCDIR)/../manifest:
1191
--- src/manifest.c
+++ src/manifest.c
@@ -168,10 +168,35 @@
168168
** True if manifest_crosslink_begin() has been called but
169169
** manifest_crosslink_end() is still pending.
170170
*/
171171
static int manifest_crosslink_busy = 0;
172172
173
+/*
174
+** There are some triggers that need to fire whenever new content
175
+** is added to the EVENT table, to make corresponding changes to the
176
+** PENDING_ALERT and CHAT tables. These are done with TEMP triggers
177
+** which are created as needed. The reasons for using TEMP triggers:
178
+**
179
+** * A small minority of invocations of Fossil need to use those triggers.
180
+** So we save CPU cycles in the common case by not having to parse the
181
+** trigger definition
182
+**
183
+** * We don't have to worry about dangling table references inside
184
+** of triggers. For example, we can create a trigger that adds
185
+** to the CHAT table. But an admin can still drop that CHAT table
186
+** at any moment, since the trigger that refers to CHAT is a TEMP
187
+** trigger and won't persist to cause problems.
188
+**
189
+** * Because TEMP triggers are defined by the specific version of the
190
+** application that is running, we don't have to worry with legacy
191
+** compatibility of the triggers.
192
+**
193
+** This boolean variable is set when the TEMP triggers for EVENT
194
+** have been created.
195
+*/
196
+static int manifest_event_triggers_are_enabled = 0;
197
+
173198
/*
174199
** Clear the memory allocated in a manifest object
175200
*/
176201
void manifest_destroy(Manifest *p){
177202
if( p ){
@@ -1938,10 +1963,11 @@
19381963
** by the call to manifest_crosslink_end().
19391964
*/
19401965
void manifest_crosslink_begin(void){
19411966
assert( manifest_crosslink_busy==0 );
19421967
manifest_crosslink_busy = 1;
1968
+ manifest_create_event_triggers();
19431969
db_begin_transaction();
19441970
db_multi_exec(
19451971
"CREATE TEMP TABLE pending_xlink(id TEXT PRIMARY KEY)WITHOUT ROWID;"
19461972
"CREATE TEMP TABLE time_fudge("
19471973
" mid INTEGER PRIMARY KEY," /* The rid of a manifest */
@@ -2056,10 +2082,32 @@
20562082
20572083
db_end_transaction(0);
20582084
manifest_crosslink_busy = 0;
20592085
return ( rc!=TH_ERROR );
20602086
}
2087
+
2088
+/*
2089
+** Activate EVENT triggers if they do not already exist.
2090
+*/
2091
+void manifest_create_event_triggers(void){
2092
+ if( manifest_event_triggers_are_enabled ){
2093
+ return; /* Triggers already exists. No-op. */
2094
+ }
2095
+ alert_create_trigger();
2096
+ manifest_event_triggers_are_enabled = 1;
2097
+}
2098
+
2099
+/*
2100
+** Disable manifest event triggers. Drop them if they exist, but mark
2101
+** them has having been created so that they won't be recreated. This
2102
+** is used during "rebuild" to prevent triggers from firing then.
2103
+*/
2104
+void manifest_disable_event_triggers(void){
2105
+ alert_drop_trigger();
2106
+ manifest_event_triggers_are_enabled = 1;
2107
+}
2108
+
20612109
20622110
/*
20632111
** Make an entry in the event table for a ticket change artifact.
20642112
*/
20652113
void manifest_ticket_event(
@@ -2126,10 +2174,11 @@
21262174
);
21272175
blob_appendf(&brief, "New ticket [%!S|%S].", pManifest->zTicketUuid,
21282176
pManifest->zTicketUuid);
21292177
}
21302178
fossil_free(zTitle);
2179
+ manifest_create_event_triggers();
21312180
db_multi_exec(
21322181
"REPLACE INTO event(type,tagid,mtime,objid,user,comment,brief)"
21332182
"VALUES('t',%d,%.17g,%d,%Q,%Q,%Q)",
21342183
tktTagId, pManifest->rDate, rid, pManifest->zUser,
21352184
blob_str(&comment), blob_str(&brief)
@@ -2227,10 +2276,11 @@
22272276
const char *zUuid = 0;
22282277
22292278
if( g.fSqlTrace ){
22302279
fossil_trace("-- manifest_crosslink(%d)\n", rid);
22312280
}
2281
+ manifest_create_event_triggers();
22322282
if( (p = manifest_cache_find(rid))!=0 ){
22332283
blob_reset(pContent);
22342284
}else if( (p = manifest_parse(pContent, rid, 0))==0 ){
22352285
assert( blob_is_reset(pContent) || pContent==0 );
22362286
if( (flags & MC_NO_ERRORS)==0 ){
@@ -2274,10 +2324,11 @@
22742324
}
22752325
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
22762326
char *zCom;
22772327
parentid = manifest_add_checkin_linkages(rid,p,p->nParent,p->azParent);
22782328
search_doc_touch('c', rid, 0);
2329
+ assert( manifest_event_triggers_are_enabled );
22792330
db_multi_exec(
22802331
"REPLACE INTO event(type,mtime,objid,user,comment,"
22812332
"bgcolor,euser,ecomment,omtime)"
22822333
"VALUES('ci',"
22832334
" coalesce("
@@ -2389,10 +2440,11 @@
23892440
if( manifest_crosslink_busy ){
23902441
add_pending_crosslink('w',p->zWikiTitle);
23912442
}else{
23922443
backlink_wiki_refresh(p->zWikiTitle);
23932444
}
2445
+ assert( manifest_event_triggers_are_enabled );
23942446
db_multi_exec(
23952447
"REPLACE INTO event(type,mtime,objid,user,comment)"
23962448
"VALUES('w',%.17g,%d,%Q,'%c%q');",
23972449
p->rDate, rid, p->zUser, cPrefix, p->zWikiTitle
23982450
);
@@ -2435,10 +2487,11 @@
24352487
}
24362488
if( subsequent ){
24372489
content_deltify(rid, &subsequent, 1, 0);
24382490
}else{
24392491
search_doc_touch('e',rid,0);
2492
+ assert( manifest_event_triggers_are_enabled );
24402493
db_multi_exec(
24412494
"REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)"
24422495
"VALUES('e',%.17g,%d,%d,%Q,%Q,"
24432496
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
24442497
p->rEventDate, rid, tagid, p->zUser, p->zComment,
@@ -2575,10 +2628,11 @@
25752628
}else{
25762629
zComment = mprintf("Delete attachment \"%h\" from ticket [%!S|%S]",
25772630
p->zAttachName, p->zAttachTarget, p->zAttachTarget);
25782631
}
25792632
}
2633
+ assert( manifest_event_triggers_are_enabled );
25802634
db_multi_exec(
25812635
"REPLACE INTO event(type,mtime,objid,user,comment)"
25822636
"VALUES('%c',%.17g,%d,%Q,%Q)",
25832637
attachToType, p->rDate, rid, p->zUser, zComment
25842638
);
@@ -2678,10 +2732,11 @@
26782732
blob_appendf(&comment, ".");
26792733
}
26802734
}
26812735
/*blob_appendf(&comment, " &#91;[/info/%S | details]&#93;");*/
26822736
if( blob_size(&comment)==0 ) blob_append(&comment, " ", 1);
2737
+ assert( manifest_event_triggers_are_enabled );
26832738
db_multi_exec(
26842739
"REPLACE INTO event(type,mtime,objid,user,comment)"
26852740
"VALUES('g',%.17g,%d,%Q,%Q)",
26862741
p->rDate, rid, p->zUser, blob_str(&comment)+1
26872742
);
@@ -2707,10 +2762,11 @@
27072762
zTitle = p->zThreadTitle;
27082763
if( zTitle==0 || zTitle[0]==0 ){
27092764
zTitle = "(Deleted)";
27102765
}
27112766
zFType = fprev ? "Edit" : "Post";
2767
+ assert( manifest_event_triggers_are_enabled );
27122768
db_multi_exec(
27132769
"REPLACE INTO event(type,mtime,objid,user,comment)"
27142770
"VALUES('f',%.17g,%d,%Q,'%q: %q')",
27152771
p->rDate, rid, p->zUser, zFType, zTitle
27162772
);
@@ -2739,10 +2795,11 @@
27392795
}else if( fprev ){
27402796
zFType = "Edit reply";
27412797
}else{
27422798
zFType = "Reply";
27432799
}
2800
+ assert( manifest_event_triggers_are_enabled );
27442801
db_multi_exec(
27452802
"REPLACE INTO event(type,mtime,objid,user,comment)"
27462803
"VALUES('f',%.17g,%d,%Q,'%q: %q')",
27472804
p->rDate, rid, p->zUser, zFType, zTitle
27482805
);
27492806
--- src/manifest.c
+++ src/manifest.c
@@ -168,10 +168,35 @@
168 ** True if manifest_crosslink_begin() has been called but
169 ** manifest_crosslink_end() is still pending.
170 */
171 static int manifest_crosslink_busy = 0;
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173 /*
174 ** Clear the memory allocated in a manifest object
175 */
176 void manifest_destroy(Manifest *p){
177 if( p ){
@@ -1938,10 +1963,11 @@
1938 ** by the call to manifest_crosslink_end().
1939 */
1940 void manifest_crosslink_begin(void){
1941 assert( manifest_crosslink_busy==0 );
1942 manifest_crosslink_busy = 1;
 
1943 db_begin_transaction();
1944 db_multi_exec(
1945 "CREATE TEMP TABLE pending_xlink(id TEXT PRIMARY KEY)WITHOUT ROWID;"
1946 "CREATE TEMP TABLE time_fudge("
1947 " mid INTEGER PRIMARY KEY," /* The rid of a manifest */
@@ -2056,10 +2082,32 @@
2056
2057 db_end_transaction(0);
2058 manifest_crosslink_busy = 0;
2059 return ( rc!=TH_ERROR );
2060 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2061
2062 /*
2063 ** Make an entry in the event table for a ticket change artifact.
2064 */
2065 void manifest_ticket_event(
@@ -2126,10 +2174,11 @@
2126 );
2127 blob_appendf(&brief, "New ticket [%!S|%S].", pManifest->zTicketUuid,
2128 pManifest->zTicketUuid);
2129 }
2130 fossil_free(zTitle);
 
2131 db_multi_exec(
2132 "REPLACE INTO event(type,tagid,mtime,objid,user,comment,brief)"
2133 "VALUES('t',%d,%.17g,%d,%Q,%Q,%Q)",
2134 tktTagId, pManifest->rDate, rid, pManifest->zUser,
2135 blob_str(&comment), blob_str(&brief)
@@ -2227,10 +2276,11 @@
2227 const char *zUuid = 0;
2228
2229 if( g.fSqlTrace ){
2230 fossil_trace("-- manifest_crosslink(%d)\n", rid);
2231 }
 
2232 if( (p = manifest_cache_find(rid))!=0 ){
2233 blob_reset(pContent);
2234 }else if( (p = manifest_parse(pContent, rid, 0))==0 ){
2235 assert( blob_is_reset(pContent) || pContent==0 );
2236 if( (flags & MC_NO_ERRORS)==0 ){
@@ -2274,10 +2324,11 @@
2274 }
2275 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
2276 char *zCom;
2277 parentid = manifest_add_checkin_linkages(rid,p,p->nParent,p->azParent);
2278 search_doc_touch('c', rid, 0);
 
2279 db_multi_exec(
2280 "REPLACE INTO event(type,mtime,objid,user,comment,"
2281 "bgcolor,euser,ecomment,omtime)"
2282 "VALUES('ci',"
2283 " coalesce("
@@ -2389,10 +2440,11 @@
2389 if( manifest_crosslink_busy ){
2390 add_pending_crosslink('w',p->zWikiTitle);
2391 }else{
2392 backlink_wiki_refresh(p->zWikiTitle);
2393 }
 
2394 db_multi_exec(
2395 "REPLACE INTO event(type,mtime,objid,user,comment)"
2396 "VALUES('w',%.17g,%d,%Q,'%c%q');",
2397 p->rDate, rid, p->zUser, cPrefix, p->zWikiTitle
2398 );
@@ -2435,10 +2487,11 @@
2435 }
2436 if( subsequent ){
2437 content_deltify(rid, &subsequent, 1, 0);
2438 }else{
2439 search_doc_touch('e',rid,0);
 
2440 db_multi_exec(
2441 "REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)"
2442 "VALUES('e',%.17g,%d,%d,%Q,%Q,"
2443 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
2444 p->rEventDate, rid, tagid, p->zUser, p->zComment,
@@ -2575,10 +2628,11 @@
2575 }else{
2576 zComment = mprintf("Delete attachment \"%h\" from ticket [%!S|%S]",
2577 p->zAttachName, p->zAttachTarget, p->zAttachTarget);
2578 }
2579 }
 
2580 db_multi_exec(
2581 "REPLACE INTO event(type,mtime,objid,user,comment)"
2582 "VALUES('%c',%.17g,%d,%Q,%Q)",
2583 attachToType, p->rDate, rid, p->zUser, zComment
2584 );
@@ -2678,10 +2732,11 @@
2678 blob_appendf(&comment, ".");
2679 }
2680 }
2681 /*blob_appendf(&comment, " &#91;[/info/%S | details]&#93;");*/
2682 if( blob_size(&comment)==0 ) blob_append(&comment, " ", 1);
 
2683 db_multi_exec(
2684 "REPLACE INTO event(type,mtime,objid,user,comment)"
2685 "VALUES('g',%.17g,%d,%Q,%Q)",
2686 p->rDate, rid, p->zUser, blob_str(&comment)+1
2687 );
@@ -2707,10 +2762,11 @@
2707 zTitle = p->zThreadTitle;
2708 if( zTitle==0 || zTitle[0]==0 ){
2709 zTitle = "(Deleted)";
2710 }
2711 zFType = fprev ? "Edit" : "Post";
 
2712 db_multi_exec(
2713 "REPLACE INTO event(type,mtime,objid,user,comment)"
2714 "VALUES('f',%.17g,%d,%Q,'%q: %q')",
2715 p->rDate, rid, p->zUser, zFType, zTitle
2716 );
@@ -2739,10 +2795,11 @@
2739 }else if( fprev ){
2740 zFType = "Edit reply";
2741 }else{
2742 zFType = "Reply";
2743 }
 
2744 db_multi_exec(
2745 "REPLACE INTO event(type,mtime,objid,user,comment)"
2746 "VALUES('f',%.17g,%d,%Q,'%q: %q')",
2747 p->rDate, rid, p->zUser, zFType, zTitle
2748 );
2749
--- src/manifest.c
+++ src/manifest.c
@@ -168,10 +168,35 @@
168 ** True if manifest_crosslink_begin() has been called but
169 ** manifest_crosslink_end() is still pending.
170 */
171 static int manifest_crosslink_busy = 0;
172
173 /*
174 ** There are some triggers that need to fire whenever new content
175 ** is added to the EVENT table, to make corresponding changes to the
176 ** PENDING_ALERT and CHAT tables. These are done with TEMP triggers
177 ** which are created as needed. The reasons for using TEMP triggers:
178 **
179 ** * A small minority of invocations of Fossil need to use those triggers.
180 ** So we save CPU cycles in the common case by not having to parse the
181 ** trigger definition
182 **
183 ** * We don't have to worry about dangling table references inside
184 ** of triggers. For example, we can create a trigger that adds
185 ** to the CHAT table. But an admin can still drop that CHAT table
186 ** at any moment, since the trigger that refers to CHAT is a TEMP
187 ** trigger and won't persist to cause problems.
188 **
189 ** * Because TEMP triggers are defined by the specific version of the
190 ** application that is running, we don't have to worry with legacy
191 ** compatibility of the triggers.
192 **
193 ** This boolean variable is set when the TEMP triggers for EVENT
194 ** have been created.
195 */
196 static int manifest_event_triggers_are_enabled = 0;
197
198 /*
199 ** Clear the memory allocated in a manifest object
200 */
201 void manifest_destroy(Manifest *p){
202 if( p ){
@@ -1938,10 +1963,11 @@
1963 ** by the call to manifest_crosslink_end().
1964 */
1965 void manifest_crosslink_begin(void){
1966 assert( manifest_crosslink_busy==0 );
1967 manifest_crosslink_busy = 1;
1968 manifest_create_event_triggers();
1969 db_begin_transaction();
1970 db_multi_exec(
1971 "CREATE TEMP TABLE pending_xlink(id TEXT PRIMARY KEY)WITHOUT ROWID;"
1972 "CREATE TEMP TABLE time_fudge("
1973 " mid INTEGER PRIMARY KEY," /* The rid of a manifest */
@@ -2056,10 +2082,32 @@
2082
2083 db_end_transaction(0);
2084 manifest_crosslink_busy = 0;
2085 return ( rc!=TH_ERROR );
2086 }
2087
2088 /*
2089 ** Activate EVENT triggers if they do not already exist.
2090 */
2091 void manifest_create_event_triggers(void){
2092 if( manifest_event_triggers_are_enabled ){
2093 return; /* Triggers already exists. No-op. */
2094 }
2095 alert_create_trigger();
2096 manifest_event_triggers_are_enabled = 1;
2097 }
2098
2099 /*
2100 ** Disable manifest event triggers. Drop them if they exist, but mark
2101 ** them has having been created so that they won't be recreated. This
2102 ** is used during "rebuild" to prevent triggers from firing then.
2103 */
2104 void manifest_disable_event_triggers(void){
2105 alert_drop_trigger();
2106 manifest_event_triggers_are_enabled = 1;
2107 }
2108
2109
2110 /*
2111 ** Make an entry in the event table for a ticket change artifact.
2112 */
2113 void manifest_ticket_event(
@@ -2126,10 +2174,11 @@
2174 );
2175 blob_appendf(&brief, "New ticket [%!S|%S].", pManifest->zTicketUuid,
2176 pManifest->zTicketUuid);
2177 }
2178 fossil_free(zTitle);
2179 manifest_create_event_triggers();
2180 db_multi_exec(
2181 "REPLACE INTO event(type,tagid,mtime,objid,user,comment,brief)"
2182 "VALUES('t',%d,%.17g,%d,%Q,%Q,%Q)",
2183 tktTagId, pManifest->rDate, rid, pManifest->zUser,
2184 blob_str(&comment), blob_str(&brief)
@@ -2227,10 +2276,11 @@
2276 const char *zUuid = 0;
2277
2278 if( g.fSqlTrace ){
2279 fossil_trace("-- manifest_crosslink(%d)\n", rid);
2280 }
2281 manifest_create_event_triggers();
2282 if( (p = manifest_cache_find(rid))!=0 ){
2283 blob_reset(pContent);
2284 }else if( (p = manifest_parse(pContent, rid, 0))==0 ){
2285 assert( blob_is_reset(pContent) || pContent==0 );
2286 if( (flags & MC_NO_ERRORS)==0 ){
@@ -2274,10 +2324,11 @@
2324 }
2325 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
2326 char *zCom;
2327 parentid = manifest_add_checkin_linkages(rid,p,p->nParent,p->azParent);
2328 search_doc_touch('c', rid, 0);
2329 assert( manifest_event_triggers_are_enabled );
2330 db_multi_exec(
2331 "REPLACE INTO event(type,mtime,objid,user,comment,"
2332 "bgcolor,euser,ecomment,omtime)"
2333 "VALUES('ci',"
2334 " coalesce("
@@ -2389,10 +2440,11 @@
2440 if( manifest_crosslink_busy ){
2441 add_pending_crosslink('w',p->zWikiTitle);
2442 }else{
2443 backlink_wiki_refresh(p->zWikiTitle);
2444 }
2445 assert( manifest_event_triggers_are_enabled );
2446 db_multi_exec(
2447 "REPLACE INTO event(type,mtime,objid,user,comment)"
2448 "VALUES('w',%.17g,%d,%Q,'%c%q');",
2449 p->rDate, rid, p->zUser, cPrefix, p->zWikiTitle
2450 );
@@ -2435,10 +2487,11 @@
2487 }
2488 if( subsequent ){
2489 content_deltify(rid, &subsequent, 1, 0);
2490 }else{
2491 search_doc_touch('e',rid,0);
2492 assert( manifest_event_triggers_are_enabled );
2493 db_multi_exec(
2494 "REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)"
2495 "VALUES('e',%.17g,%d,%d,%Q,%Q,"
2496 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
2497 p->rEventDate, rid, tagid, p->zUser, p->zComment,
@@ -2575,10 +2628,11 @@
2628 }else{
2629 zComment = mprintf("Delete attachment \"%h\" from ticket [%!S|%S]",
2630 p->zAttachName, p->zAttachTarget, p->zAttachTarget);
2631 }
2632 }
2633 assert( manifest_event_triggers_are_enabled );
2634 db_multi_exec(
2635 "REPLACE INTO event(type,mtime,objid,user,comment)"
2636 "VALUES('%c',%.17g,%d,%Q,%Q)",
2637 attachToType, p->rDate, rid, p->zUser, zComment
2638 );
@@ -2678,10 +2732,11 @@
2732 blob_appendf(&comment, ".");
2733 }
2734 }
2735 /*blob_appendf(&comment, " &#91;[/info/%S | details]&#93;");*/
2736 if( blob_size(&comment)==0 ) blob_append(&comment, " ", 1);
2737 assert( manifest_event_triggers_are_enabled );
2738 db_multi_exec(
2739 "REPLACE INTO event(type,mtime,objid,user,comment)"
2740 "VALUES('g',%.17g,%d,%Q,%Q)",
2741 p->rDate, rid, p->zUser, blob_str(&comment)+1
2742 );
@@ -2707,10 +2762,11 @@
2762 zTitle = p->zThreadTitle;
2763 if( zTitle==0 || zTitle[0]==0 ){
2764 zTitle = "(Deleted)";
2765 }
2766 zFType = fprev ? "Edit" : "Post";
2767 assert( manifest_event_triggers_are_enabled );
2768 db_multi_exec(
2769 "REPLACE INTO event(type,mtime,objid,user,comment)"
2770 "VALUES('f',%.17g,%d,%Q,'%q: %q')",
2771 p->rDate, rid, p->zUser, zFType, zTitle
2772 );
@@ -2739,10 +2795,11 @@
2795 }else if( fprev ){
2796 zFType = "Edit reply";
2797 }else{
2798 zFType = "Reply";
2799 }
2800 assert( manifest_event_triggers_are_enabled );
2801 db_multi_exec(
2802 "REPLACE INTO event(type,mtime,objid,user,comment)"
2803 "VALUES('f',%.17g,%d,%Q,'%q: %q')",
2804 p->rDate, rid, p->zUser, zFType, zTitle
2805 );
2806
+1 -1
--- src/moderate.c
+++ src/moderate.c
@@ -189,11 +189,11 @@
189189
);
190190
db_prepare(&q, "%s", blob_sql_text(&sql));
191191
www_print_timeline(&q, 0, 0, 0, 0, 0, 0, 0);
192192
db_finalize(&q);
193193
}
194
- style_finish_page("modreq");
194
+ style_finish_page();
195195
}
196196
197197
/*
198198
** Disapproves any entries in the modreq table which belong to any
199199
** user whose name is no longer found in the user table. This is only
200200
--- src/moderate.c
+++ src/moderate.c
@@ -189,11 +189,11 @@
189 );
190 db_prepare(&q, "%s", blob_sql_text(&sql));
191 www_print_timeline(&q, 0, 0, 0, 0, 0, 0, 0);
192 db_finalize(&q);
193 }
194 style_finish_page("modreq");
195 }
196
197 /*
198 ** Disapproves any entries in the modreq table which belong to any
199 ** user whose name is no longer found in the user table. This is only
200
--- src/moderate.c
+++ src/moderate.c
@@ -189,11 +189,11 @@
189 );
190 db_prepare(&q, "%s", blob_sql_text(&sql));
191 www_print_timeline(&q, 0, 0, 0, 0, 0, 0, 0);
192 db_finalize(&q);
193 }
194 style_finish_page();
195 }
196
197 /*
198 ** Disapproves any entries in the modreq table which belong to any
199 ** user whose name is no longer found in the user table. This is only
200
+62 -28
--- src/name.c
+++ src/name.c
@@ -181,10 +181,53 @@
181181
ans = compute_youngest_ancestor_in_branch(rid, zBr);
182182
fossil_free(zBr);
183183
}
184184
return ans;
185185
}
186
+
187
+/*
188
+** Find the RID of the most recent object with symbolic tag zTag
189
+** and having a type that matches zType.
190
+**
191
+** Return 0 if there are no matches.
192
+**
193
+** This is a tricky query to do efficiently.
194
+** If the tag is very common (ex: "trunk") then
195
+** we want to use the query identified below as Q1 - which searching
196
+** the most recent EVENT table entries for the most recent with the tag.
197
+** But if the tag is relatively scarce (anything other than "trunk", basically)
198
+** then we want to do the indexed search show below as Q2.
199
+*/
200
+static int most_recent_event_with_tag(const char *zTag, const char *zType){
201
+ return db_int(0,
202
+ "SELECT objid FROM ("
203
+ /* Q1: Begin by looking for the tag in the 30 most recent events */
204
+ "SELECT objid"
205
+ " FROM (SELECT * FROM event ORDER BY mtime DESC LIMIT 30) AS ex"
206
+ " WHERE type GLOB '%q'"
207
+ " AND EXISTS(SELECT 1 FROM tagxref, tag"
208
+ " WHERE tag.tagname='sym-%q'"
209
+ " AND tagxref.tagid=tag.tagid"
210
+ " AND tagxref.tagtype>0"
211
+ " AND tagxref.rid=ex.objid)"
212
+ " ORDER BY mtime DESC LIMIT 1"
213
+ ") UNION ALL SELECT * FROM ("
214
+ /* Q2: If the tag is not found in the 30 most recent events, then using
215
+ ** the tagxref table to index for the tag */
216
+ "SELECT event.objid"
217
+ " FROM tag, tagxref, event"
218
+ " WHERE tag.tagname='sym-%q'"
219
+ " AND tagxref.tagid=tag.tagid"
220
+ " AND tagxref.tagtype>0"
221
+ " AND event.objid=tagxref.rid"
222
+ " AND event.type GLOB '%q'"
223
+ " ORDER BY event.mtime DESC LIMIT 1"
224
+ ") LIMIT 1;",
225
+ zType, zTag, zTag, zType
226
+ );
227
+}
228
+
186229
187230
/*
188231
** Convert a symbolic name into a RID. Acceptable forms:
189232
**
190233
** * artifact hash (optionally enclosed in [...])
@@ -225,11 +268,10 @@
225268
int i;
226269
int startOfBranch = 0;
227270
const char *zXTag; /* zTag with optional [...] removed */
228271
int nXTag; /* Size of zXTag */
229272
const char *zDate; /* Expanded date-time string */
230
- const char *zTagPrefix = "sym";
231273
232274
if( zType==0 || zType[0]==0 ){
233275
zType = "*";
234276
}else if( zType[0]=='b' ){
235277
zType = "ci";
@@ -301,19 +343,11 @@
301343
return rid;
302344
}
303345
304346
/* "tag:" + symbolic-name */
305347
if( memcmp(zTag, "tag:", 4)==0 ){
306
- rid = db_int(0,
307
- "SELECT event.objid, max(event.mtime)"
308
- " FROM tag, tagxref, event"
309
- " WHERE tag.tagname='sym-%q' "
310
- " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
311
- " AND event.objid=tagxref.rid "
312
- " AND event.type GLOB '%q'",
313
- &zTag[4], zType
314
- );
348
+ rid = most_recent_event_with_tag(&zTag[4], zType);
315349
if( startOfBranch ) rid = start_of_branch(rid,1);
316350
return rid;
317351
}
318352
319353
/* root:BR -> The origin of the branch named BR */
@@ -396,22 +430,22 @@
396430
db_finalize(&q);
397431
if( rid ) return rid;
398432
}
399433
400434
if( zType[0]=='w' ){
401
- zTagPrefix = "wiki";
402
- }
403
- /* Symbolic name */
404
- rid = db_int(0,
405
- "SELECT event.objid, max(event.mtime)"
406
- " FROM tag, tagxref, event"
407
- " WHERE tag.tagname='%q-%q' "
408
- " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
409
- " AND event.objid=tagxref.rid "
410
- " AND event.type GLOB '%q'",
411
- zTagPrefix, zTag, zType
412
- );
435
+ rid = db_int(0,
436
+ "SELECT event.objid, max(event.mtime)"
437
+ " FROM tag, tagxref, event"
438
+ " WHERE tag.tagname='wiki-%q' "
439
+ " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
440
+ " AND event.objid=tagxref.rid "
441
+ " AND event.type GLOB '%q'",
442
+ zTag, zType
443
+ );
444
+ }else{
445
+ rid = most_recent_event_with_tag(zTag, zType);
446
+ }
413447
414448
if( rid>0 ){
415449
if( startOfBranch ) rid = start_of_branch(rid,1);
416450
return rid;
417451
}
@@ -668,11 +702,11 @@
668702
@ </li></ul>
669703
@ </p></li>
670704
}
671705
@ </ol>
672706
db_finalize(&q);
673
- style_finish_page("ambiguous");
707
+ style_finish_page();
674708
}
675709
676710
/*
677711
** Convert the name in CGI parameter zParamName into a rid and return that
678712
** rid. If the CGI parameter is missing or is not a valid artifact tag,
@@ -1328,11 +1362,11 @@
13281362
for(i=1; i<=mx; i+=n){
13291363
@ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
13301364
@ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a>
13311365
}
13321366
@ </ul>
1333
- style_finish_page("bloblist");
1367
+ style_finish_page();
13341368
return;
13351369
}
13361370
if( phantomOnly || privOnly || mx>n ){
13371371
style_submenu_element("Index", "bloblist");
13381372
}
@@ -1407,11 +1441,11 @@
14071441
}
14081442
@ </tr>
14091443
}
14101444
@ </table>
14111445
db_finalize(&q);
1412
- style_finish_page("bloblist");
1446
+ style_finish_page();
14131447
}
14141448
14151449
/*
14161450
** Output HTML that shows a table of all public phantoms.
14171451
*/
@@ -1489,11 +1523,11 @@
14891523
}
14901524
if( g.perm.Write ){
14911525
style_submenu_element("Artifact Stats", "artifact_stats");
14921526
}
14931527
table_of_public_phantoms();
1494
- style_finish_page("phantoms");
1528
+ style_finish_page();
14951529
}
14961530
14971531
/*
14981532
** WEBPAGE: bigbloblist
14991533
**
@@ -1553,11 +1587,11 @@
15531587
@ </tr>
15541588
}
15551589
@ </tbody></table>
15561590
db_finalize(&q);
15571591
style_table_sorter();
1558
- style_finish_page("bigbloblist");
1592
+ style_finish_page();
15591593
}
15601594
15611595
/*
15621596
** COMMAND: test-unsent
15631597
**
@@ -1677,7 +1711,7 @@
16771711
collision_report("SELECT (SELECT uuid FROM blob WHERE rid=objid)"
16781712
" FROM event WHERE event.type='ci'"
16791713
" ORDER BY 1");
16801714
@ <h1>Hash Prefix Collisions on All Artifacts</h1>
16811715
collision_report("SELECT uuid FROM blob ORDER BY 1");
1682
- style_finish_page("hash-collisions");
1716
+ style_finish_page();
16831717
}
16841718
--- src/name.c
+++ src/name.c
@@ -181,10 +181,53 @@
181 ans = compute_youngest_ancestor_in_branch(rid, zBr);
182 fossil_free(zBr);
183 }
184 return ans;
185 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
187 /*
188 ** Convert a symbolic name into a RID. Acceptable forms:
189 **
190 ** * artifact hash (optionally enclosed in [...])
@@ -225,11 +268,10 @@
225 int i;
226 int startOfBranch = 0;
227 const char *zXTag; /* zTag with optional [...] removed */
228 int nXTag; /* Size of zXTag */
229 const char *zDate; /* Expanded date-time string */
230 const char *zTagPrefix = "sym";
231
232 if( zType==0 || zType[0]==0 ){
233 zType = "*";
234 }else if( zType[0]=='b' ){
235 zType = "ci";
@@ -301,19 +343,11 @@
301 return rid;
302 }
303
304 /* "tag:" + symbolic-name */
305 if( memcmp(zTag, "tag:", 4)==0 ){
306 rid = db_int(0,
307 "SELECT event.objid, max(event.mtime)"
308 " FROM tag, tagxref, event"
309 " WHERE tag.tagname='sym-%q' "
310 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
311 " AND event.objid=tagxref.rid "
312 " AND event.type GLOB '%q'",
313 &zTag[4], zType
314 );
315 if( startOfBranch ) rid = start_of_branch(rid,1);
316 return rid;
317 }
318
319 /* root:BR -> The origin of the branch named BR */
@@ -396,22 +430,22 @@
396 db_finalize(&q);
397 if( rid ) return rid;
398 }
399
400 if( zType[0]=='w' ){
401 zTagPrefix = "wiki";
402 }
403 /* Symbolic name */
404 rid = db_int(0,
405 "SELECT event.objid, max(event.mtime)"
406 " FROM tag, tagxref, event"
407 " WHERE tag.tagname='%q-%q' "
408 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
409 " AND event.objid=tagxref.rid "
410 " AND event.type GLOB '%q'",
411 zTagPrefix, zTag, zType
412 );
413
414 if( rid>0 ){
415 if( startOfBranch ) rid = start_of_branch(rid,1);
416 return rid;
417 }
@@ -668,11 +702,11 @@
668 @ </li></ul>
669 @ </p></li>
670 }
671 @ </ol>
672 db_finalize(&q);
673 style_finish_page("ambiguous");
674 }
675
676 /*
677 ** Convert the name in CGI parameter zParamName into a rid and return that
678 ** rid. If the CGI parameter is missing or is not a valid artifact tag,
@@ -1328,11 +1362,11 @@
1328 for(i=1; i<=mx; i+=n){
1329 @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
1330 @ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a>
1331 }
1332 @ </ul>
1333 style_finish_page("bloblist");
1334 return;
1335 }
1336 if( phantomOnly || privOnly || mx>n ){
1337 style_submenu_element("Index", "bloblist");
1338 }
@@ -1407,11 +1441,11 @@
1407 }
1408 @ </tr>
1409 }
1410 @ </table>
1411 db_finalize(&q);
1412 style_finish_page("bloblist");
1413 }
1414
1415 /*
1416 ** Output HTML that shows a table of all public phantoms.
1417 */
@@ -1489,11 +1523,11 @@
1489 }
1490 if( g.perm.Write ){
1491 style_submenu_element("Artifact Stats", "artifact_stats");
1492 }
1493 table_of_public_phantoms();
1494 style_finish_page("phantoms");
1495 }
1496
1497 /*
1498 ** WEBPAGE: bigbloblist
1499 **
@@ -1553,11 +1587,11 @@
1553 @ </tr>
1554 }
1555 @ </tbody></table>
1556 db_finalize(&q);
1557 style_table_sorter();
1558 style_finish_page("bigbloblist");
1559 }
1560
1561 /*
1562 ** COMMAND: test-unsent
1563 **
@@ -1677,7 +1711,7 @@
1677 collision_report("SELECT (SELECT uuid FROM blob WHERE rid=objid)"
1678 " FROM event WHERE event.type='ci'"
1679 " ORDER BY 1");
1680 @ <h1>Hash Prefix Collisions on All Artifacts</h1>
1681 collision_report("SELECT uuid FROM blob ORDER BY 1");
1682 style_finish_page("hash-collisions");
1683 }
1684
--- src/name.c
+++ src/name.c
@@ -181,10 +181,53 @@
181 ans = compute_youngest_ancestor_in_branch(rid, zBr);
182 fossil_free(zBr);
183 }
184 return ans;
185 }
186
187 /*
188 ** Find the RID of the most recent object with symbolic tag zTag
189 ** and having a type that matches zType.
190 **
191 ** Return 0 if there are no matches.
192 **
193 ** This is a tricky query to do efficiently.
194 ** If the tag is very common (ex: "trunk") then
195 ** we want to use the query identified below as Q1 - which searching
196 ** the most recent EVENT table entries for the most recent with the tag.
197 ** But if the tag is relatively scarce (anything other than "trunk", basically)
198 ** then we want to do the indexed search show below as Q2.
199 */
200 static int most_recent_event_with_tag(const char *zTag, const char *zType){
201 return db_int(0,
202 "SELECT objid FROM ("
203 /* Q1: Begin by looking for the tag in the 30 most recent events */
204 "SELECT objid"
205 " FROM (SELECT * FROM event ORDER BY mtime DESC LIMIT 30) AS ex"
206 " WHERE type GLOB '%q'"
207 " AND EXISTS(SELECT 1 FROM tagxref, tag"
208 " WHERE tag.tagname='sym-%q'"
209 " AND tagxref.tagid=tag.tagid"
210 " AND tagxref.tagtype>0"
211 " AND tagxref.rid=ex.objid)"
212 " ORDER BY mtime DESC LIMIT 1"
213 ") UNION ALL SELECT * FROM ("
214 /* Q2: If the tag is not found in the 30 most recent events, then using
215 ** the tagxref table to index for the tag */
216 "SELECT event.objid"
217 " FROM tag, tagxref, event"
218 " WHERE tag.tagname='sym-%q'"
219 " AND tagxref.tagid=tag.tagid"
220 " AND tagxref.tagtype>0"
221 " AND event.objid=tagxref.rid"
222 " AND event.type GLOB '%q'"
223 " ORDER BY event.mtime DESC LIMIT 1"
224 ") LIMIT 1;",
225 zType, zTag, zTag, zType
226 );
227 }
228
229
230 /*
231 ** Convert a symbolic name into a RID. Acceptable forms:
232 **
233 ** * artifact hash (optionally enclosed in [...])
@@ -225,11 +268,10 @@
268 int i;
269 int startOfBranch = 0;
270 const char *zXTag; /* zTag with optional [...] removed */
271 int nXTag; /* Size of zXTag */
272 const char *zDate; /* Expanded date-time string */
 
273
274 if( zType==0 || zType[0]==0 ){
275 zType = "*";
276 }else if( zType[0]=='b' ){
277 zType = "ci";
@@ -301,19 +343,11 @@
343 return rid;
344 }
345
346 /* "tag:" + symbolic-name */
347 if( memcmp(zTag, "tag:", 4)==0 ){
348 rid = most_recent_event_with_tag(&zTag[4], zType);
 
 
 
 
 
 
 
 
349 if( startOfBranch ) rid = start_of_branch(rid,1);
350 return rid;
351 }
352
353 /* root:BR -> The origin of the branch named BR */
@@ -396,22 +430,22 @@
430 db_finalize(&q);
431 if( rid ) return rid;
432 }
433
434 if( zType[0]=='w' ){
435 rid = db_int(0,
436 "SELECT event.objid, max(event.mtime)"
437 " FROM tag, tagxref, event"
438 " WHERE tag.tagname='wiki-%q' "
439 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
440 " AND event.objid=tagxref.rid "
441 " AND event.type GLOB '%q'",
442 zTag, zType
443 );
444 }else{
445 rid = most_recent_event_with_tag(zTag, zType);
446 }
447
448 if( rid>0 ){
449 if( startOfBranch ) rid = start_of_branch(rid,1);
450 return rid;
451 }
@@ -668,11 +702,11 @@
702 @ </li></ul>
703 @ </p></li>
704 }
705 @ </ol>
706 db_finalize(&q);
707 style_finish_page();
708 }
709
710 /*
711 ** Convert the name in CGI parameter zParamName into a rid and return that
712 ** rid. If the CGI parameter is missing or is not a valid artifact tag,
@@ -1328,11 +1362,11 @@
1362 for(i=1; i<=mx; i+=n){
1363 @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
1364 @ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a>
1365 }
1366 @ </ul>
1367 style_finish_page();
1368 return;
1369 }
1370 if( phantomOnly || privOnly || mx>n ){
1371 style_submenu_element("Index", "bloblist");
1372 }
@@ -1407,11 +1441,11 @@
1441 }
1442 @ </tr>
1443 }
1444 @ </table>
1445 db_finalize(&q);
1446 style_finish_page();
1447 }
1448
1449 /*
1450 ** Output HTML that shows a table of all public phantoms.
1451 */
@@ -1489,11 +1523,11 @@
1523 }
1524 if( g.perm.Write ){
1525 style_submenu_element("Artifact Stats", "artifact_stats");
1526 }
1527 table_of_public_phantoms();
1528 style_finish_page();
1529 }
1530
1531 /*
1532 ** WEBPAGE: bigbloblist
1533 **
@@ -1553,11 +1587,11 @@
1587 @ </tr>
1588 }
1589 @ </tbody></table>
1590 db_finalize(&q);
1591 style_table_sorter();
1592 style_finish_page();
1593 }
1594
1595 /*
1596 ** COMMAND: test-unsent
1597 **
@@ -1677,7 +1711,7 @@
1711 collision_report("SELECT (SELECT uuid FROM blob WHERE rid=objid)"
1712 " FROM event WHERE event.type='ci'"
1713 " ORDER BY 1");
1714 @ <h1>Hash Prefix Collisions on All Artifacts</h1>
1715 collision_report("SELECT uuid FROM blob ORDER BY 1");
1716 style_finish_page();
1717 }
1718
+3 -2
--- src/path.c
+++ src/path.c
@@ -607,20 +607,21 @@
607607
608608
/*
609609
** WEBPAGE: test-rename-list
610610
**
611611
** Print a list of all file rename operations throughout history.
612
-** This page is intended for for testing purposes only and may change
612
+** This page is intended for testing purposes only and may change
613613
** or be discontinued without notice.
614614
*/
615615
void test_rename_list_page(void){
616616
Stmt q;
617617
int nRename;
618618
int nCheckin;
619619
620620
login_check_credentials();
621621
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
622
+ style_set_current_feature("test");
622623
if( P("all")!=0 ){
623624
style_header("List Of All Filename Changes");
624625
db_multi_exec("%s", zRenameQuery/*safe-for-%s*/);
625626
style_submenu_element("Distinct", "%R/test-rename-list");
626627
}else{
@@ -651,7 +652,7 @@
651652
@ <td>%z(href("%R/info/%!S",zUuid))%S(zUuid)</a></td></tr>
652653
}
653654
@ </tbody></table>
654655
db_finalize(&q);
655656
style_table_sorter();
656
- style_finish_page("test");
657
+ style_finish_page();
657658
}
658659
--- src/path.c
+++ src/path.c
@@ -607,20 +607,21 @@
607
608 /*
609 ** WEBPAGE: test-rename-list
610 **
611 ** Print a list of all file rename operations throughout history.
612 ** This page is intended for for testing purposes only and may change
613 ** or be discontinued without notice.
614 */
615 void test_rename_list_page(void){
616 Stmt q;
617 int nRename;
618 int nCheckin;
619
620 login_check_credentials();
621 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
 
622 if( P("all")!=0 ){
623 style_header("List Of All Filename Changes");
624 db_multi_exec("%s", zRenameQuery/*safe-for-%s*/);
625 style_submenu_element("Distinct", "%R/test-rename-list");
626 }else{
@@ -651,7 +652,7 @@
651 @ <td>%z(href("%R/info/%!S",zUuid))%S(zUuid)</a></td></tr>
652 }
653 @ </tbody></table>
654 db_finalize(&q);
655 style_table_sorter();
656 style_finish_page("test");
657 }
658
--- src/path.c
+++ src/path.c
@@ -607,20 +607,21 @@
607
608 /*
609 ** WEBPAGE: test-rename-list
610 **
611 ** Print a list of all file rename operations throughout history.
612 ** This page is intended for testing purposes only and may change
613 ** or be discontinued without notice.
614 */
615 void test_rename_list_page(void){
616 Stmt q;
617 int nRename;
618 int nCheckin;
619
620 login_check_credentials();
621 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
622 style_set_current_feature("test");
623 if( P("all")!=0 ){
624 style_header("List Of All Filename Changes");
625 db_multi_exec("%s", zRenameQuery/*safe-for-%s*/);
626 style_submenu_element("Distinct", "%R/test-rename-list");
627 }else{
@@ -651,7 +652,7 @@
652 @ <td>%z(href("%R/info/%!S",zUuid))%S(zUuid)</a></td></tr>
653 }
654 @ </tbody></table>
655 db_finalize(&q);
656 style_table_sorter();
657 style_finish_page();
658 }
659
+2 -1
--- src/piechart.c
+++ src/piechart.c
@@ -277,10 +277,11 @@
277277
int width;
278278
int height;
279279
int i, j;
280280
281281
login_check_credentials();
282
+ style_set_current_feature("test");
282283
style_header("Pie Chart Test");
283284
db_multi_exec("CREATE TEMP TABLE piechart(amt REAL, label TEXT);");
284285
db_prepare(&ins, "INSERT INTO piechart(amt,label) VALUES(:amt,:label)");
285286
zData = PD("data","");
286287
width = atoi(PD("width","800"));
@@ -328,7 +329,7 @@
328329
@ <li> <a href='test-piechart?data=2,2,2,2,2,44,44,2,2,2,2,2'>Case 2</a>
329330
@ <li> <a href='test-piechart?data=20,2,2,2,2,2,2,2,2,2,2,80'>Case 3</a>
330331
@ <li> <a href='test-piechart?data=80,2,2,2,2,2,2,2,2,2,2,20'>Case 4</a>
331332
@ <li> <a href='test-piechart?data=2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2'>Case 5</a>
332333
@ </ul>
333
- style_finish_page("test");
334
+ style_finish_page();
334335
}
335336
--- src/piechart.c
+++ src/piechart.c
@@ -277,10 +277,11 @@
277 int width;
278 int height;
279 int i, j;
280
281 login_check_credentials();
 
282 style_header("Pie Chart Test");
283 db_multi_exec("CREATE TEMP TABLE piechart(amt REAL, label TEXT);");
284 db_prepare(&ins, "INSERT INTO piechart(amt,label) VALUES(:amt,:label)");
285 zData = PD("data","");
286 width = atoi(PD("width","800"));
@@ -328,7 +329,7 @@
328 @ <li> <a href='test-piechart?data=2,2,2,2,2,44,44,2,2,2,2,2'>Case 2</a>
329 @ <li> <a href='test-piechart?data=20,2,2,2,2,2,2,2,2,2,2,80'>Case 3</a>
330 @ <li> <a href='test-piechart?data=80,2,2,2,2,2,2,2,2,2,2,20'>Case 4</a>
331 @ <li> <a href='test-piechart?data=2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2'>Case 5</a>
332 @ </ul>
333 style_finish_page("test");
334 }
335
--- src/piechart.c
+++ src/piechart.c
@@ -277,10 +277,11 @@
277 int width;
278 int height;
279 int i, j;
280
281 login_check_credentials();
282 style_set_current_feature("test");
283 style_header("Pie Chart Test");
284 db_multi_exec("CREATE TEMP TABLE piechart(amt REAL, label TEXT);");
285 db_prepare(&ins, "INSERT INTO piechart(amt,label) VALUES(:amt,:label)");
286 zData = PD("data","");
287 width = atoi(PD("width","800"));
@@ -328,7 +329,7 @@
329 @ <li> <a href='test-piechart?data=2,2,2,2,2,44,44,2,2,2,2,2'>Case 2</a>
330 @ <li> <a href='test-piechart?data=20,2,2,2,2,2,2,2,2,2,2,80'>Case 3</a>
331 @ <li> <a href='test-piechart?data=80,2,2,2,2,2,2,2,2,2,2,20'>Case 4</a>
332 @ <li> <a href='test-piechart?data=2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2'>Case 5</a>
333 @ </ul>
334 style_finish_page();
335 }
336
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -374,11 +374,11 @@
374374
} CX("</div>"/*sbs-wrapper*/);
375375
builtin_fossil_js_bundle_or("fetch", "copybutton", "popupwidget",
376376
"storage", "pikchr", NULL);
377377
builtin_request_js("fossil.page.pikchrshow.js");
378378
builtin_fulfill_js_requests();
379
- style_finish_page("pikchrshow");
379
+ style_finish_page();
380380
}
381381
382382
/*
383383
** COMMAND: pikchr*
384384
**
385385
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -374,11 +374,11 @@
374 } CX("</div>"/*sbs-wrapper*/);
375 builtin_fossil_js_bundle_or("fetch", "copybutton", "popupwidget",
376 "storage", "pikchr", NULL);
377 builtin_request_js("fossil.page.pikchrshow.js");
378 builtin_fulfill_js_requests();
379 style_finish_page("pikchrshow");
380 }
381
382 /*
383 ** COMMAND: pikchr*
384 **
385
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -374,11 +374,11 @@
374 } CX("</div>"/*sbs-wrapper*/);
375 builtin_fossil_js_bundle_or("fetch", "copybutton", "popupwidget",
376 "storage", "pikchr", NULL);
377 builtin_request_js("fossil.page.pikchrshow.js");
378 builtin_fulfill_js_requests();
379 style_finish_page();
380 }
381
382 /*
383 ** COMMAND: pikchr*
384 **
385
+2 -1
--- src/printf.c
+++ src/printf.c
@@ -1116,15 +1116,16 @@
11161116
#endif
11171117
if( g.cgiOutput==1 && g.db ){
11181118
g.cgiOutput = 2;
11191119
cgi_reset_content();
11201120
cgi_set_content_type("text/html");
1121
+ style_set_current_feature("error");
11211122
style_header("Bad Request");
11221123
etag_cancel();
11231124
@ <p class="generalError">%h(z)</p>
11241125
cgi_set_status(400, "Bad Request");
1125
- style_finish_page("error");
1126
+ style_finish_page();
11261127
cgi_reply();
11271128
}else if( !g.fQuiet ){
11281129
fossil_force_newline();
11291130
fossil_trace("%s\n", z);
11301131
}
11311132
--- src/printf.c
+++ src/printf.c
@@ -1116,15 +1116,16 @@
1116 #endif
1117 if( g.cgiOutput==1 && g.db ){
1118 g.cgiOutput = 2;
1119 cgi_reset_content();
1120 cgi_set_content_type("text/html");
 
1121 style_header("Bad Request");
1122 etag_cancel();
1123 @ <p class="generalError">%h(z)</p>
1124 cgi_set_status(400, "Bad Request");
1125 style_finish_page("error");
1126 cgi_reply();
1127 }else if( !g.fQuiet ){
1128 fossil_force_newline();
1129 fossil_trace("%s\n", z);
1130 }
1131
--- src/printf.c
+++ src/printf.c
@@ -1116,15 +1116,16 @@
1116 #endif
1117 if( g.cgiOutput==1 && g.db ){
1118 g.cgiOutput = 2;
1119 cgi_reset_content();
1120 cgi_set_content_type("text/html");
1121 style_set_current_feature("error");
1122 style_header("Bad Request");
1123 etag_cancel();
1124 @ <p class="generalError">%h(z)</p>
1125 cgi_set_status(400, "Bad Request");
1126 style_finish_page();
1127 cgi_reply();
1128 }else if( !g.fQuiet ){
1129 fossil_force_newline();
1130 fossil_trace("%s\n", z);
1131 }
1132
+3 -3
--- src/rebuild.c
+++ src/rebuild.c
@@ -383,11 +383,11 @@
383383
ttyOutput = doOut;
384384
processCnt = 0;
385385
if (ttyOutput && !g.fQuiet) {
386386
percent_complete(0);
387387
}
388
- alert_triggers_disable();
388
+ manifest_disable_event_triggers();
389389
rebuild_update_schema();
390390
blob_init(&sql, 0, 0);
391391
db_unprotect(PROTECT_ALL);
392392
db_prepare(&q,
393393
"SELECT name FROM sqlite_schema /*scan*/"
@@ -394,11 +394,11 @@
394394
" WHERE type='table'"
395395
" AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias',"
396396
"'config','shun','private','reportfmt',"
397397
"'concealed','accesslog','modreq',"
398398
"'purgeevent','purgeitem','unversioned',"
399
- "'subscriber','pending_alert','alert_bounce')"
399
+ "'subscriber','pending_alert','alert_bounce','chat')"
400400
" AND name NOT GLOB 'sqlite_*'"
401401
" AND name NOT GLOB 'fx_*'"
402402
);
403403
while( db_step(&q)==SQLITE_ROW ){
404404
blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
@@ -475,11 +475,10 @@
475475
if( doClustering ) create_cluster();
476476
if( ttyOutput && !g.fQuiet && totalSize>0 ){
477477
processCnt += incrSize;
478478
percent_complete((processCnt*1000)/totalSize);
479479
}
480
- alert_triggers_enable();
481480
if(!g.fQuiet && ttyOutput ){
482481
percent_complete(1000);
483482
fossil_print("\n");
484483
}
485484
db_protect_pop();
@@ -942,10 +941,11 @@
942941
"UPDATE user SET photo=NULL, info='';\n"
943942
"DROP TABLE IF EXISTS purgeevent;\n"
944943
"DROP TABLE IF EXISTS purgeitem;\n"
945944
"DROP TABLE IF EXISTS admin_log;\n"
946945
"DROP TABLE IF EXISTS vcache;\n"
946
+ "DROP TABLE IF EXISTS chat;\n"
947947
);
948948
}
949949
db_protect_pop();
950950
}
951951
if( !bNeedRebuild ){
952952
--- src/rebuild.c
+++ src/rebuild.c
@@ -383,11 +383,11 @@
383 ttyOutput = doOut;
384 processCnt = 0;
385 if (ttyOutput && !g.fQuiet) {
386 percent_complete(0);
387 }
388 alert_triggers_disable();
389 rebuild_update_schema();
390 blob_init(&sql, 0, 0);
391 db_unprotect(PROTECT_ALL);
392 db_prepare(&q,
393 "SELECT name FROM sqlite_schema /*scan*/"
@@ -394,11 +394,11 @@
394 " WHERE type='table'"
395 " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias',"
396 "'config','shun','private','reportfmt',"
397 "'concealed','accesslog','modreq',"
398 "'purgeevent','purgeitem','unversioned',"
399 "'subscriber','pending_alert','alert_bounce')"
400 " AND name NOT GLOB 'sqlite_*'"
401 " AND name NOT GLOB 'fx_*'"
402 );
403 while( db_step(&q)==SQLITE_ROW ){
404 blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
@@ -475,11 +475,10 @@
475 if( doClustering ) create_cluster();
476 if( ttyOutput && !g.fQuiet && totalSize>0 ){
477 processCnt += incrSize;
478 percent_complete((processCnt*1000)/totalSize);
479 }
480 alert_triggers_enable();
481 if(!g.fQuiet && ttyOutput ){
482 percent_complete(1000);
483 fossil_print("\n");
484 }
485 db_protect_pop();
@@ -942,10 +941,11 @@
942 "UPDATE user SET photo=NULL, info='';\n"
943 "DROP TABLE IF EXISTS purgeevent;\n"
944 "DROP TABLE IF EXISTS purgeitem;\n"
945 "DROP TABLE IF EXISTS admin_log;\n"
946 "DROP TABLE IF EXISTS vcache;\n"
 
947 );
948 }
949 db_protect_pop();
950 }
951 if( !bNeedRebuild ){
952
--- src/rebuild.c
+++ src/rebuild.c
@@ -383,11 +383,11 @@
383 ttyOutput = doOut;
384 processCnt = 0;
385 if (ttyOutput && !g.fQuiet) {
386 percent_complete(0);
387 }
388 manifest_disable_event_triggers();
389 rebuild_update_schema();
390 blob_init(&sql, 0, 0);
391 db_unprotect(PROTECT_ALL);
392 db_prepare(&q,
393 "SELECT name FROM sqlite_schema /*scan*/"
@@ -394,11 +394,11 @@
394 " WHERE type='table'"
395 " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias',"
396 "'config','shun','private','reportfmt',"
397 "'concealed','accesslog','modreq',"
398 "'purgeevent','purgeitem','unversioned',"
399 "'subscriber','pending_alert','alert_bounce','chat')"
400 " AND name NOT GLOB 'sqlite_*'"
401 " AND name NOT GLOB 'fx_*'"
402 );
403 while( db_step(&q)==SQLITE_ROW ){
404 blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
@@ -475,11 +475,10 @@
475 if( doClustering ) create_cluster();
476 if( ttyOutput && !g.fQuiet && totalSize>0 ){
477 processCnt += incrSize;
478 percent_complete((processCnt*1000)/totalSize);
479 }
 
480 if(!g.fQuiet && ttyOutput ){
481 percent_complete(1000);
482 fossil_print("\n");
483 }
484 db_protect_pop();
@@ -942,10 +941,11 @@
941 "UPDATE user SET photo=NULL, info='';\n"
942 "DROP TABLE IF EXISTS purgeevent;\n"
943 "DROP TABLE IF EXISTS purgeitem;\n"
944 "DROP TABLE IF EXISTS admin_log;\n"
945 "DROP TABLE IF EXISTS vcache;\n"
946 "DROP TABLE IF EXISTS chat;\n"
947 );
948 }
949 db_protect_pop();
950 }
951 if( !bNeedRebuild ){
952
+1 -1
--- src/regexp.c
+++ src/regexp.c
@@ -811,11 +811,11 @@
811811
** -c|--count Suppress normal output; instead print a count
812812
** of the number of matching files
813813
** -i|--ignore-case Ignore case
814814
** -l|--files-with-matches List only hash for each match
815815
** --once Stop searching after the first match
816
-** -s|--no-messages Suppress error messages about nonexistant
816
+** -s|--no-messages Suppress error messages about nonexistent
817817
** or unreadable files
818818
** -v|--invert-match Invert the sense of matching. Show only
819819
** files that have no matches. Implies -l
820820
** --verbose Show each file as it is analyzed
821821
*/
822822
--- src/regexp.c
+++ src/regexp.c
@@ -811,11 +811,11 @@
811 ** -c|--count Suppress normal output; instead print a count
812 ** of the number of matching files
813 ** -i|--ignore-case Ignore case
814 ** -l|--files-with-matches List only hash for each match
815 ** --once Stop searching after the first match
816 ** -s|--no-messages Suppress error messages about nonexistant
817 ** or unreadable files
818 ** -v|--invert-match Invert the sense of matching. Show only
819 ** files that have no matches. Implies -l
820 ** --verbose Show each file as it is analyzed
821 */
822
--- src/regexp.c
+++ src/regexp.c
@@ -811,11 +811,11 @@
811 ** -c|--count Suppress normal output; instead print a count
812 ** of the number of matching files
813 ** -i|--ignore-case Ignore case
814 ** -l|--files-with-matches List only hash for each match
815 ** --once Stop searching after the first match
816 ** -s|--no-messages Suppress error messages about nonexistent
817 ** or unreadable files
818 ** -v|--invert-match Invert the sense of matching. Show only
819 ** files that have no matches. Implies -l
820 ** --verbose Show each file as it is analyzed
821 */
822
+2 -1
--- src/repolist.c
+++ src/repolist.c
@@ -245,14 +245,15 @@
245245
/* This case runs if remote_repository_info() found a repository
246246
** that has the "repolist_skin" property set to non-zero and left
247247
** that repository open in g.db. Use the skin of that repository
248248
** for display. */
249249
login_check_credentials();
250
+ style_set_current_feature("repolist");
250251
style_header("Repository List");
251252
@ %s(blob_str(&html))
252253
style_table_sorter();
253
- style_finish_page("repolist");
254
+ style_finish_page();
254255
}else{
255256
/* If no repositories were found that had the "repolist_skin"
256257
** property set, then use a default skin */
257258
@ <html>
258259
@ <head>
259260
--- src/repolist.c
+++ src/repolist.c
@@ -245,14 +245,15 @@
245 /* This case runs if remote_repository_info() found a repository
246 ** that has the "repolist_skin" property set to non-zero and left
247 ** that repository open in g.db. Use the skin of that repository
248 ** for display. */
249 login_check_credentials();
 
250 style_header("Repository List");
251 @ %s(blob_str(&html))
252 style_table_sorter();
253 style_finish_page("repolist");
254 }else{
255 /* If no repositories were found that had the "repolist_skin"
256 ** property set, then use a default skin */
257 @ <html>
258 @ <head>
259
--- src/repolist.c
+++ src/repolist.c
@@ -245,14 +245,15 @@
245 /* This case runs if remote_repository_info() found a repository
246 ** that has the "repolist_skin" property set to non-zero and left
247 ** that repository open in g.db. Use the skin of that repository
248 ** for display. */
249 login_check_credentials();
250 style_set_current_feature("repolist");
251 style_header("Repository List");
252 @ %s(blob_str(&html))
253 style_table_sorter();
254 style_finish_page();
255 }else{
256 /* If no repositories were found that had the "repolist_skin"
257 ** property set, then use a default skin */
258 @ <html>
259 @ <head>
260
+10 -7
--- src/report.c
+++ src/report.c
@@ -97,11 +97,11 @@
9797
Th_Render(zScript);
9898
9999
blob_reset(&ril);
100100
if( g.thTrace ) Th_Trace("END_REPORTLIST<br />\n", -1);
101101
102
- style_finish_page("reportlist");
102
+ style_finish_page();
103103
}
104104
105105
/*
106106
** Remove whitespace from both ends of a string.
107107
*/
@@ -325,14 +325,15 @@
325325
return;
326326
}
327327
rn = atoi(PD("rn","0"));
328328
db_prepare(&q, "SELECT title, sqlcode, owner, cols "
329329
"FROM reportfmt WHERE rn=%d",rn);
330
+ style_set_current_feature("report");
330331
style_header("SQL For Report Format Number %d", rn);
331332
if( db_step(&q)!=SQLITE_ROW ){
332333
@ <p>Unknown report number: %d(rn)</p>
333
- style_finish_page("report");
334
+ style_finish_page();
334335
db_finalize(&q);
335336
return;
336337
}
337338
zTitle = db_column_text(&q, 0);
338339
zSQL = db_column_text(&q, 1);
@@ -350,11 +351,11 @@
350351
@ <td width=15></td><td valign="top">
351352
output_color_key(zClrKey, 0, "border=0 cellspacing=0 cellpadding=3");
352353
@ </td>
353354
@ </tr></table>
354355
report_format_hints();
355
- style_finish_page("report");
356
+ style_finish_page();
356357
db_finalize(&q);
357358
}
358359
359360
/*
360361
** WEBPAGE: rptnew
@@ -381,10 +382,11 @@
381382
login_check_credentials();
382383
if( !g.perm.TktFmt ){
383384
login_needed(g.anon.TktFmt);
384385
return;
385386
}
387
+ style_set_current_feature("report");
386388
/*view_add_functions(0);*/
387389
rn = atoi(PD("rn","0"));
388390
zTitle = P("t");
389391
zOwner = PD("w",g.zLogin);
390392
z = P("s");
@@ -410,11 +412,11 @@
410412
@ <input type="hidden" name="rn" value="%d(rn)">
411413
login_insert_csrf_secret();
412414
@ <input type="submit" name="del2" value="Delete The Report">
413415
@ <input type="submit" name="can" value="Cancel">
414416
@ </form>
415
- style_finish_page("report");
417
+ style_finish_page();
416418
return;
417419
}else if( P("can") ){
418420
/* user cancelled */
419421
cgi_redirect("reportlist");
420422
return;
@@ -502,20 +504,20 @@
502504
if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
503505
@ <p>This report format is owned by %h(zOwner). You are not allowed
504506
@ to change it.</p>
505507
@ </form>
506508
report_format_hints();
507
- style_finish_page("report");
509
+ style_finish_page();
508510
return;
509511
}
510512
@ <input type="submit" value="Apply Changes" />
511513
if( rn>0 ){
512514
@ <input type="submit" value="Delete This Report" name="del1" />
513515
}
514516
@ </div></form>
515517
report_format_hints();
516
- style_finish_page("report");
518
+ style_finish_page();
517519
}
518520
519521
/*
520522
** Output a bunch of text that provides information about report
521523
** formats
@@ -1029,10 +1031,11 @@
10291031
count = 0;
10301032
if( !tabs ){
10311033
struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
10321034
10331035
db_multi_exec("PRAGMA empty_result_callbacks=ON");
1036
+ style_set_current_feature("report");
10341037
style_submenu_element("Raw", "rptview?tablist=1&%h", PD("QUERY_STRING",""));
10351038
if( g.perm.Admin
10361039
|| (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
10371040
style_submenu_element("Edit", "rptedit?rn=%d", rn);
10381041
}
@@ -1057,11 +1060,11 @@
10571060
@ <p class="reportError">Error: %h(zErr1)</p>
10581061
}else if( zErr2 ){
10591062
@ <p class="reportError">Error: %h(zErr2)</p>
10601063
}
10611064
style_table_sorter();
1062
- style_finish_page("report");
1065
+ style_finish_page();
10631066
}else{
10641067
report_restrict_sql(&zErr1);
10651068
db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2);
10661069
report_unrestrict_sql();
10671070
cgi_set_content_type("text/plain");
10681071
--- src/report.c
+++ src/report.c
@@ -97,11 +97,11 @@
97 Th_Render(zScript);
98
99 blob_reset(&ril);
100 if( g.thTrace ) Th_Trace("END_REPORTLIST<br />\n", -1);
101
102 style_finish_page("reportlist");
103 }
104
105 /*
106 ** Remove whitespace from both ends of a string.
107 */
@@ -325,14 +325,15 @@
325 return;
326 }
327 rn = atoi(PD("rn","0"));
328 db_prepare(&q, "SELECT title, sqlcode, owner, cols "
329 "FROM reportfmt WHERE rn=%d",rn);
 
330 style_header("SQL For Report Format Number %d", rn);
331 if( db_step(&q)!=SQLITE_ROW ){
332 @ <p>Unknown report number: %d(rn)</p>
333 style_finish_page("report");
334 db_finalize(&q);
335 return;
336 }
337 zTitle = db_column_text(&q, 0);
338 zSQL = db_column_text(&q, 1);
@@ -350,11 +351,11 @@
350 @ <td width=15></td><td valign="top">
351 output_color_key(zClrKey, 0, "border=0 cellspacing=0 cellpadding=3");
352 @ </td>
353 @ </tr></table>
354 report_format_hints();
355 style_finish_page("report");
356 db_finalize(&q);
357 }
358
359 /*
360 ** WEBPAGE: rptnew
@@ -381,10 +382,11 @@
381 login_check_credentials();
382 if( !g.perm.TktFmt ){
383 login_needed(g.anon.TktFmt);
384 return;
385 }
 
386 /*view_add_functions(0);*/
387 rn = atoi(PD("rn","0"));
388 zTitle = P("t");
389 zOwner = PD("w",g.zLogin);
390 z = P("s");
@@ -410,11 +412,11 @@
410 @ <input type="hidden" name="rn" value="%d(rn)">
411 login_insert_csrf_secret();
412 @ <input type="submit" name="del2" value="Delete The Report">
413 @ <input type="submit" name="can" value="Cancel">
414 @ </form>
415 style_finish_page("report");
416 return;
417 }else if( P("can") ){
418 /* user cancelled */
419 cgi_redirect("reportlist");
420 return;
@@ -502,20 +504,20 @@
502 if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
503 @ <p>This report format is owned by %h(zOwner). You are not allowed
504 @ to change it.</p>
505 @ </form>
506 report_format_hints();
507 style_finish_page("report");
508 return;
509 }
510 @ <input type="submit" value="Apply Changes" />
511 if( rn>0 ){
512 @ <input type="submit" value="Delete This Report" name="del1" />
513 }
514 @ </div></form>
515 report_format_hints();
516 style_finish_page("report");
517 }
518
519 /*
520 ** Output a bunch of text that provides information about report
521 ** formats
@@ -1029,10 +1031,11 @@
1029 count = 0;
1030 if( !tabs ){
1031 struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1032
1033 db_multi_exec("PRAGMA empty_result_callbacks=ON");
 
1034 style_submenu_element("Raw", "rptview?tablist=1&%h", PD("QUERY_STRING",""));
1035 if( g.perm.Admin
1036 || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
1037 style_submenu_element("Edit", "rptedit?rn=%d", rn);
1038 }
@@ -1057,11 +1060,11 @@
1057 @ <p class="reportError">Error: %h(zErr1)</p>
1058 }else if( zErr2 ){
1059 @ <p class="reportError">Error: %h(zErr2)</p>
1060 }
1061 style_table_sorter();
1062 style_finish_page("report");
1063 }else{
1064 report_restrict_sql(&zErr1);
1065 db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2);
1066 report_unrestrict_sql();
1067 cgi_set_content_type("text/plain");
1068
--- src/report.c
+++ src/report.c
@@ -97,11 +97,11 @@
97 Th_Render(zScript);
98
99 blob_reset(&ril);
100 if( g.thTrace ) Th_Trace("END_REPORTLIST<br />\n", -1);
101
102 style_finish_page();
103 }
104
105 /*
106 ** Remove whitespace from both ends of a string.
107 */
@@ -325,14 +325,15 @@
325 return;
326 }
327 rn = atoi(PD("rn","0"));
328 db_prepare(&q, "SELECT title, sqlcode, owner, cols "
329 "FROM reportfmt WHERE rn=%d",rn);
330 style_set_current_feature("report");
331 style_header("SQL For Report Format Number %d", rn);
332 if( db_step(&q)!=SQLITE_ROW ){
333 @ <p>Unknown report number: %d(rn)</p>
334 style_finish_page();
335 db_finalize(&q);
336 return;
337 }
338 zTitle = db_column_text(&q, 0);
339 zSQL = db_column_text(&q, 1);
@@ -350,11 +351,11 @@
351 @ <td width=15></td><td valign="top">
352 output_color_key(zClrKey, 0, "border=0 cellspacing=0 cellpadding=3");
353 @ </td>
354 @ </tr></table>
355 report_format_hints();
356 style_finish_page();
357 db_finalize(&q);
358 }
359
360 /*
361 ** WEBPAGE: rptnew
@@ -381,10 +382,11 @@
382 login_check_credentials();
383 if( !g.perm.TktFmt ){
384 login_needed(g.anon.TktFmt);
385 return;
386 }
387 style_set_current_feature("report");
388 /*view_add_functions(0);*/
389 rn = atoi(PD("rn","0"));
390 zTitle = P("t");
391 zOwner = PD("w",g.zLogin);
392 z = P("s");
@@ -410,11 +412,11 @@
412 @ <input type="hidden" name="rn" value="%d(rn)">
413 login_insert_csrf_secret();
414 @ <input type="submit" name="del2" value="Delete The Report">
415 @ <input type="submit" name="can" value="Cancel">
416 @ </form>
417 style_finish_page();
418 return;
419 }else if( P("can") ){
420 /* user cancelled */
421 cgi_redirect("reportlist");
422 return;
@@ -502,20 +504,20 @@
504 if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
505 @ <p>This report format is owned by %h(zOwner). You are not allowed
506 @ to change it.</p>
507 @ </form>
508 report_format_hints();
509 style_finish_page();
510 return;
511 }
512 @ <input type="submit" value="Apply Changes" />
513 if( rn>0 ){
514 @ <input type="submit" value="Delete This Report" name="del1" />
515 }
516 @ </div></form>
517 report_format_hints();
518 style_finish_page();
519 }
520
521 /*
522 ** Output a bunch of text that provides information about report
523 ** formats
@@ -1029,10 +1031,11 @@
1031 count = 0;
1032 if( !tabs ){
1033 struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1034
1035 db_multi_exec("PRAGMA empty_result_callbacks=ON");
1036 style_set_current_feature("report");
1037 style_submenu_element("Raw", "rptview?tablist=1&%h", PD("QUERY_STRING",""));
1038 if( g.perm.Admin
1039 || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
1040 style_submenu_element("Edit", "rptedit?rn=%d", rn);
1041 }
@@ -1057,11 +1060,11 @@
1060 @ <p class="reportError">Error: %h(zErr1)</p>
1061 }else if( zErr2 ){
1062 @ <p class="reportError">Error: %h(zErr2)</p>
1063 }
1064 style_table_sorter();
1065 style_finish_page();
1066 }else{
1067 report_restrict_sql(&zErr1);
1068 db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2);
1069 report_unrestrict_sql();
1070 cgi_set_content_type("text/plain");
1071
+7 -6
--- src/search.c
+++ src/search.c
@@ -643,11 +643,11 @@
643643
blob_append_sql(&sql,"AND x>%d ", iBest/3);
644644
}
645645
blob_append(&sql, "ORDER BY x DESC, date DESC ", -1);
646646
db_prepare(&q, "%s", blob_sql_text(&sql));
647647
blob_reset(&sql);
648
- print_timeline(&q, nLimit, width, 0);
648
+ print_timeline(&q, nLimit, width, 0, 0);
649649
db_finalize(&q);
650650
}
651651
652652
#if INTERFACE
653653
/* What to search for */
@@ -1212,11 +1212,11 @@
12121212
*/
12131213
void search_page(void){
12141214
login_check_credentials();
12151215
style_header("Search");
12161216
search_screen(SRCH_ALL, 1);
1217
- style_finish_page("search");
1217
+ style_finish_page();
12181218
}
12191219
12201220
12211221
/*
12221222
** This is a helper function for search_stext(). Writing into pOut
@@ -1979,13 +1979,14 @@
19791979
const char *zIdxed = P("ixed");
19801980
int id;
19811981
int cnt1 = 0, cnt2 = 0, cnt3 = 0;
19821982
login_check_credentials();
19831983
if( !g.perm.Admin ){ login_needed(0); return; }
1984
+ style_set_current_feature("test");
19841985
if( !search_index_exists() ){
19851986
@ <p>Indexed search is disabled
1986
- style_finish_page("report");
1987
+ style_finish_page();
19871988
return;
19881989
}
19891990
search_sql_setup(g.db);
19901991
style_submenu_element("Setup","%R/srchsetup");
19911992
if( zId!=0 && (id = atoi(zId))>0 ){
@@ -2025,11 +2026,11 @@
20252026
style_submenu_element(zName,"%R/test-ftsdocs?y=%c&ixed=1",zDocId[0]);
20262027
zName = mprintf("Unindexed '%c' docs",zDocId[0]);
20272028
style_submenu_element(zName,"%R/test-ftsdocs?y=%c&ixed=0",zDocId[0]);
20282029
}
20292030
db_finalize(&q);
2030
- style_finish_page("test");
2031
+ style_finish_page();
20312032
return;
20322033
}
20332034
if( zType!=0 && zType[0]!=0 && zType[1]==0 &&
20342035
zIdxed!=0 && (zIdxed[0]=='1' || zIdxed[0]=='0') && zIdxed[1]==0
20352036
){
@@ -2055,11 +2056,11 @@
20552056
@ <li> <a href='test-ftsdocs?id=%d(db_column_int(&q,0))'>
20562057
@ %h(db_column_text(&q,1))</a>
20572058
}
20582059
@ </ul>
20592060
db_finalize(&q);
2060
- style_finish_page("test");
2061
+ style_finish_page();
20612062
return;
20622063
}
20632064
style_header("Summary of ftsdocs");
20642065
db_prepare(&q,
20652066
"SELECT type, sum(idxed IS TRUE), sum(idxed IS FALSE), count(*)"
@@ -2099,7 +2100,7 @@
20992100
@ </tbody><tfooter>
21002101
@ <tr><th>Total<th align="right">%d(cnt1)<th align="right">%d(cnt2)
21012102
@ <th align="right">%d(cnt3)
21022103
@ </tfooter>
21032104
@ </table>
2104
- style_finish_page("test");
2105
+ style_finish_page();
21052106
}
21062107
--- src/search.c
+++ src/search.c
@@ -643,11 +643,11 @@
643 blob_append_sql(&sql,"AND x>%d ", iBest/3);
644 }
645 blob_append(&sql, "ORDER BY x DESC, date DESC ", -1);
646 db_prepare(&q, "%s", blob_sql_text(&sql));
647 blob_reset(&sql);
648 print_timeline(&q, nLimit, width, 0);
649 db_finalize(&q);
650 }
651
652 #if INTERFACE
653 /* What to search for */
@@ -1212,11 +1212,11 @@
1212 */
1213 void search_page(void){
1214 login_check_credentials();
1215 style_header("Search");
1216 search_screen(SRCH_ALL, 1);
1217 style_finish_page("search");
1218 }
1219
1220
1221 /*
1222 ** This is a helper function for search_stext(). Writing into pOut
@@ -1979,13 +1979,14 @@
1979 const char *zIdxed = P("ixed");
1980 int id;
1981 int cnt1 = 0, cnt2 = 0, cnt3 = 0;
1982 login_check_credentials();
1983 if( !g.perm.Admin ){ login_needed(0); return; }
 
1984 if( !search_index_exists() ){
1985 @ <p>Indexed search is disabled
1986 style_finish_page("report");
1987 return;
1988 }
1989 search_sql_setup(g.db);
1990 style_submenu_element("Setup","%R/srchsetup");
1991 if( zId!=0 && (id = atoi(zId))>0 ){
@@ -2025,11 +2026,11 @@
2025 style_submenu_element(zName,"%R/test-ftsdocs?y=%c&ixed=1",zDocId[0]);
2026 zName = mprintf("Unindexed '%c' docs",zDocId[0]);
2027 style_submenu_element(zName,"%R/test-ftsdocs?y=%c&ixed=0",zDocId[0]);
2028 }
2029 db_finalize(&q);
2030 style_finish_page("test");
2031 return;
2032 }
2033 if( zType!=0 && zType[0]!=0 && zType[1]==0 &&
2034 zIdxed!=0 && (zIdxed[0]=='1' || zIdxed[0]=='0') && zIdxed[1]==0
2035 ){
@@ -2055,11 +2056,11 @@
2055 @ <li> <a href='test-ftsdocs?id=%d(db_column_int(&q,0))'>
2056 @ %h(db_column_text(&q,1))</a>
2057 }
2058 @ </ul>
2059 db_finalize(&q);
2060 style_finish_page("test");
2061 return;
2062 }
2063 style_header("Summary of ftsdocs");
2064 db_prepare(&q,
2065 "SELECT type, sum(idxed IS TRUE), sum(idxed IS FALSE), count(*)"
@@ -2099,7 +2100,7 @@
2099 @ </tbody><tfooter>
2100 @ <tr><th>Total<th align="right">%d(cnt1)<th align="right">%d(cnt2)
2101 @ <th align="right">%d(cnt3)
2102 @ </tfooter>
2103 @ </table>
2104 style_finish_page("test");
2105 }
2106
--- src/search.c
+++ src/search.c
@@ -643,11 +643,11 @@
643 blob_append_sql(&sql,"AND x>%d ", iBest/3);
644 }
645 blob_append(&sql, "ORDER BY x DESC, date DESC ", -1);
646 db_prepare(&q, "%s", blob_sql_text(&sql));
647 blob_reset(&sql);
648 print_timeline(&q, nLimit, width, 0, 0);
649 db_finalize(&q);
650 }
651
652 #if INTERFACE
653 /* What to search for */
@@ -1212,11 +1212,11 @@
1212 */
1213 void search_page(void){
1214 login_check_credentials();
1215 style_header("Search");
1216 search_screen(SRCH_ALL, 1);
1217 style_finish_page();
1218 }
1219
1220
1221 /*
1222 ** This is a helper function for search_stext(). Writing into pOut
@@ -1979,13 +1979,14 @@
1979 const char *zIdxed = P("ixed");
1980 int id;
1981 int cnt1 = 0, cnt2 = 0, cnt3 = 0;
1982 login_check_credentials();
1983 if( !g.perm.Admin ){ login_needed(0); return; }
1984 style_set_current_feature("test");
1985 if( !search_index_exists() ){
1986 @ <p>Indexed search is disabled
1987 style_finish_page();
1988 return;
1989 }
1990 search_sql_setup(g.db);
1991 style_submenu_element("Setup","%R/srchsetup");
1992 if( zId!=0 && (id = atoi(zId))>0 ){
@@ -2025,11 +2026,11 @@
2026 style_submenu_element(zName,"%R/test-ftsdocs?y=%c&ixed=1",zDocId[0]);
2027 zName = mprintf("Unindexed '%c' docs",zDocId[0]);
2028 style_submenu_element(zName,"%R/test-ftsdocs?y=%c&ixed=0",zDocId[0]);
2029 }
2030 db_finalize(&q);
2031 style_finish_page();
2032 return;
2033 }
2034 if( zType!=0 && zType[0]!=0 && zType[1]==0 &&
2035 zIdxed!=0 && (zIdxed[0]=='1' || zIdxed[0]=='0') && zIdxed[1]==0
2036 ){
@@ -2055,11 +2056,11 @@
2056 @ <li> <a href='test-ftsdocs?id=%d(db_column_int(&q,0))'>
2057 @ %h(db_column_text(&q,1))</a>
2058 }
2059 @ </ul>
2060 db_finalize(&q);
2061 style_finish_page();
2062 return;
2063 }
2064 style_header("Summary of ftsdocs");
2065 db_prepare(&q,
2066 "SELECT type, sum(idxed IS TRUE), sum(idxed IS FALSE), count(*)"
@@ -2099,7 +2100,7 @@
2100 @ </tbody><tfooter>
2101 @ <tr><th>Total<th align="right">%d(cnt1)<th align="right">%d(cnt2)
2102 @ <th align="right">%d(cnt3)
2103 @ </tfooter>
2104 @ </table>
2105 style_finish_page();
2106 }
2107
--- src/security_audit.c
+++ src/security_audit.c
@@ -591,11 +591,11 @@
591591
table_of_public_phantoms();
592592
@ </li>
593593
}
594594
595595
@ </ol>
596
- style_finish_page("secaudit");
596
+ style_finish_page();
597597
}
598598
599599
/*
600600
** WEBPAGE: takeitprivate
601601
**
@@ -633,11 +633,11 @@
633633
@ <form action="%s(g.zPath)" method="post">
634634
@ <input type="submit" name="apply" value="Make It Private">
635635
@ <input type="submit" name="cancel" value="Cancel">
636636
@ </form>
637637
638
- style_finish_page("takeitprivate");
638
+ style_finish_page();
639639
}
640640
641641
/*
642642
** The maximum number of bytes of log to show
643643
*/
@@ -674,11 +674,11 @@
674674
@ If the server is running using one of
675675
@ the "fossil http" or "fossil server" commands then add
676676
@ a command-line option "--errorlog <i>FILENAME</i>" to that
677677
@ command.
678678
@ </ol>
679
- style_finish_page("errorlog");
679
+ style_finish_page();
680680
return;
681681
}
682682
if( P("truncate1") && cgi_csrf_safe(1) ){
683683
fclose(fopen(g.zErrlog,"w"));
684684
}
@@ -694,20 +694,20 @@
694694
@ <form action="%R/errorlog" method="POST">
695695
@ <p>Confirm that you want to truncate the %,lld(szFile)-byte error log:
696696
@ <input type="submit" name="truncate1" value="Confirm">
697697
@ <input type="submit" name="cancel" value="Cancel">
698698
@ </form>
699
- style_finish_page("errorlog");
699
+ style_finish_page();
700700
return;
701701
}
702702
@ <p>The server error log at "%h(g.zErrlog)" is %,lld(szFile) bytes in size.
703703
style_submenu_element("Download", "%R/errorlog?download");
704704
style_submenu_element("Truncate", "%R/errorlog?truncate");
705705
in = fossil_fopen(g.zErrlog, "rb");
706706
if( in==0 ){
707707
@ <p class='generalError'>Unable to open that file for reading!</p>
708
- style_finish_page("errorlog");
708
+ style_finish_page();
709709
return;
710710
}
711711
if( szFile>MXSHOWLOG && P("all")==0 ){
712712
@ <form action="%R/errorlog" method="POST">
713713
@ <p>Only the last %,d(MXSHOWLOG) bytes are shown.
@@ -720,7 +720,7 @@
720720
while( fgets(z, sizeof(z), in) ){
721721
@ %h(z)\
722722
}
723723
fclose(in);
724724
@ </pre>
725
- style_finish_page("errorlog");
725
+ style_finish_page();
726726
}
727727
--- src/security_audit.c
+++ src/security_audit.c
@@ -591,11 +591,11 @@
591 table_of_public_phantoms();
592 @ </li>
593 }
594
595 @ </ol>
596 style_finish_page("secaudit");
597 }
598
599 /*
600 ** WEBPAGE: takeitprivate
601 **
@@ -633,11 +633,11 @@
633 @ <form action="%s(g.zPath)" method="post">
634 @ <input type="submit" name="apply" value="Make It Private">
635 @ <input type="submit" name="cancel" value="Cancel">
636 @ </form>
637
638 style_finish_page("takeitprivate");
639 }
640
641 /*
642 ** The maximum number of bytes of log to show
643 */
@@ -674,11 +674,11 @@
674 @ If the server is running using one of
675 @ the "fossil http" or "fossil server" commands then add
676 @ a command-line option "--errorlog <i>FILENAME</i>" to that
677 @ command.
678 @ </ol>
679 style_finish_page("errorlog");
680 return;
681 }
682 if( P("truncate1") && cgi_csrf_safe(1) ){
683 fclose(fopen(g.zErrlog,"w"));
684 }
@@ -694,20 +694,20 @@
694 @ <form action="%R/errorlog" method="POST">
695 @ <p>Confirm that you want to truncate the %,lld(szFile)-byte error log:
696 @ <input type="submit" name="truncate1" value="Confirm">
697 @ <input type="submit" name="cancel" value="Cancel">
698 @ </form>
699 style_finish_page("errorlog");
700 return;
701 }
702 @ <p>The server error log at "%h(g.zErrlog)" is %,lld(szFile) bytes in size.
703 style_submenu_element("Download", "%R/errorlog?download");
704 style_submenu_element("Truncate", "%R/errorlog?truncate");
705 in = fossil_fopen(g.zErrlog, "rb");
706 if( in==0 ){
707 @ <p class='generalError'>Unable to open that file for reading!</p>
708 style_finish_page("errorlog");
709 return;
710 }
711 if( szFile>MXSHOWLOG && P("all")==0 ){
712 @ <form action="%R/errorlog" method="POST">
713 @ <p>Only the last %,d(MXSHOWLOG) bytes are shown.
@@ -720,7 +720,7 @@
720 while( fgets(z, sizeof(z), in) ){
721 @ %h(z)\
722 }
723 fclose(in);
724 @ </pre>
725 style_finish_page("errorlog");
726 }
727
--- src/security_audit.c
+++ src/security_audit.c
@@ -591,11 +591,11 @@
591 table_of_public_phantoms();
592 @ </li>
593 }
594
595 @ </ol>
596 style_finish_page();
597 }
598
599 /*
600 ** WEBPAGE: takeitprivate
601 **
@@ -633,11 +633,11 @@
633 @ <form action="%s(g.zPath)" method="post">
634 @ <input type="submit" name="apply" value="Make It Private">
635 @ <input type="submit" name="cancel" value="Cancel">
636 @ </form>
637
638 style_finish_page();
639 }
640
641 /*
642 ** The maximum number of bytes of log to show
643 */
@@ -674,11 +674,11 @@
674 @ If the server is running using one of
675 @ the "fossil http" or "fossil server" commands then add
676 @ a command-line option "--errorlog <i>FILENAME</i>" to that
677 @ command.
678 @ </ol>
679 style_finish_page();
680 return;
681 }
682 if( P("truncate1") && cgi_csrf_safe(1) ){
683 fclose(fopen(g.zErrlog,"w"));
684 }
@@ -694,20 +694,20 @@
694 @ <form action="%R/errorlog" method="POST">
695 @ <p>Confirm that you want to truncate the %,lld(szFile)-byte error log:
696 @ <input type="submit" name="truncate1" value="Confirm">
697 @ <input type="submit" name="cancel" value="Cancel">
698 @ </form>
699 style_finish_page();
700 return;
701 }
702 @ <p>The server error log at "%h(g.zErrlog)" is %,lld(szFile) bytes in size.
703 style_submenu_element("Download", "%R/errorlog?download");
704 style_submenu_element("Truncate", "%R/errorlog?truncate");
705 in = fossil_fopen(g.zErrlog, "rb");
706 if( in==0 ){
707 @ <p class='generalError'>Unable to open that file for reading!</p>
708 style_finish_page();
709 return;
710 }
711 if( szFile>MXSHOWLOG && P("all")==0 ){
712 @ <form action="%R/errorlog" method="POST">
713 @ <p>Only the last %,d(MXSHOWLOG) bytes are shown.
@@ -720,7 +720,7 @@
720 while( fgets(z, sizeof(z), in) ){
721 @ %h(z)\
722 }
723 fclose(in);
724 @ </pre>
725 style_finish_page();
726 }
727
+116 -16
--- src/setup.c
+++ src/setup.c
@@ -73,10 +73,11 @@
7373
if( !g.perm.Admin ){
7474
login_needed(0);
7575
}
7676
setup_user = g.perm.Setup;
7777
78
+ style_set_current_feature("setup");
7879
style_header("Server Administration");
7980
8081
/* Make sure the header contains <base href="...">. Issue a warning
8182
** if it does not. */
8283
if( !cgi_header_contains("<base href=") ){
@@ -123,10 +124,12 @@
123124
" on the same server");
124125
setup_menu_entry("Tickets", "tktsetup",
125126
"Configure the trouble-ticketing system for this repository");
126127
setup_menu_entry("Wiki", "setup_wiki",
127128
"Configure the wiki for this repository");
129
+ setup_menu_entry("Chat", "setup_chat",
130
+ "Configure the chatroom");
128131
}
129132
setup_menu_entry("Search","srchsetup",
130133
"Configure the built-in search engine");
131134
setup_menu_entry("URL Aliases", "waliassetup",
132135
"Configure URL aliases");
@@ -175,11 +178,11 @@
175178
setup_menu_entry("TH1", "admin_th1",
176179
"Enter raw TH1 commands");
177180
}
178181
@ </table>
179182
180
- style_finish_page("setup");
183
+ style_finish_page();
181184
}
182185
183186
/*
184187
** Generate a checkbox for an attribute.
185188
*/
@@ -339,10 +342,11 @@
339342
if( !g.perm.Setup ){
340343
login_needed(0);
341344
return;
342345
}
343346
347
+ style_set_current_feature("setup");
344348
style_header("Access Control Settings");
345349
db_begin_transaction();
346350
@ <form action="%R/setup_access" method="post"><div>
347351
login_insert_csrf_secret();
348352
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -576,11 +580,11 @@
576580
577581
@ <hr />
578582
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
579583
@ </div></form>
580584
db_end_transaction(0);
581
- style_finish_page("setup");
585
+ style_finish_page();
582586
}
583587
584588
/*
585589
** WEBPAGE: setup_login_group
586590
**
@@ -608,10 +612,11 @@
608612
if( P("join")!=0 ){
609613
login_group_join(zRepo, 1, zLogin, zPw, zNewName, &zErrMsg);
610614
}else if( P("leave") ){
611615
login_group_leave(&zErrMsg);
612616
}
617
+ style_set_current_feature("setup");
613618
style_header("Login Group Configuration");
614619
if( zErrMsg ){
615620
@ <p class="generalError">%s(zErrMsg)</p>
616621
}
617622
zGroup = login_group_name();
@@ -704,11 +709,11 @@
704709
}
705710
db_finalize(&q);
706711
@ </tbody></table>
707712
style_table_sorter();
708713
}
709
- style_finish_page("setup");
714
+ style_finish_page();
710715
}
711716
712717
/*
713718
** WEBPAGE: setup_timeline
714719
**
@@ -729,10 +734,11 @@
729734
if( !g.perm.Admin ){
730735
login_needed(0);
731736
return;
732737
}
733738
739
+ style_set_current_feature("setup");
734740
style_header("Timeline Display Preferences");
735741
db_begin_transaction();
736742
@ <form action="%R/setup_timeline" method="post"><div>
737743
login_insert_csrf_secret();
738744
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -843,11 +849,11 @@
843849
844850
@ <hr />
845851
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
846852
@ </div></form>
847853
db_end_transaction(0);
848
- style_finish_page("setup");
854
+ style_finish_page();
849855
}
850856
851857
/*
852858
** WEBPAGE: setup_settings
853859
**
@@ -864,10 +870,11 @@
864870
if( !g.perm.Setup ){
865871
login_needed(0);
866872
return;
867873
}
868874
875
+ style_set_current_feature("setup");
869876
style_header("Settings");
870877
if(!g.repositoryOpen){
871878
/* Provide read-only access to versioned settings,
872879
but only if no repo file was explicitly provided. */
873880
db_open_local(0);
@@ -936,11 +943,11 @@
936943
}
937944
}
938945
@ </td></tr></table>
939946
@ </div></form>
940947
db_end_transaction(0);
941
- style_finish_page("setup");
948
+ style_finish_page();
942949
}
943950
944951
/*
945952
** WEBPAGE: setup_config
946953
**
@@ -951,10 +958,11 @@
951958
if( !g.perm.Setup ){
952959
login_needed(0);
953960
return;
954961
}
955962
963
+ style_set_current_feature("setup");
956964
style_header("WWW Configuration");
957965
db_begin_transaction();
958966
@ <form action="%R/setup_config" method="post"><div>
959967
login_insert_csrf_secret();
960968
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1001,11 +1009,11 @@
10011009
@
10021010
@ <blockquote><p>%h(g.zBaseURL)/home</p></blockquote>
10031011
@
10041012
@ <p>The default "/home" page displays a Wiki page with the same name
10051013
@ as the Project Name specified above. Some sites prefer to redirect
1006
- @ to a documentation page (ex: "/doc/tip/index.wiki") or to "/timeline".</p>
1014
+ @ to a documentation page (ex: "/doc/trunk/index.wiki") or to "/timeline".</p>
10071015
@
10081016
@ <p>Note: To avoid a redirect loop or other problems, this entry must
10091017
@ begin with "/" and it must specify a valid page. For example,
10101018
@ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the
10111019
@ leading "/".</p>
@@ -1032,11 +1040,11 @@
10321040
@ (Property: sitemap-contact)
10331041
@ <hr />
10341042
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
10351043
@ </div></form>
10361044
db_end_transaction(0);
1037
- style_finish_page("setup");
1045
+ style_finish_page();
10381046
}
10391047
10401048
/*
10411049
** WEBPAGE: setup_wiki
10421050
**
@@ -1047,10 +1055,11 @@
10471055
if( !g.perm.Setup ){
10481056
login_needed(0);
10491057
return;
10501058
}
10511059
1060
+ style_set_current_feature("setup");
10521061
style_header("Wiki Configuration");
10531062
db_begin_transaction();
10541063
@ <form action="%R/setup_wiki" method="post"><div>
10551064
login_insert_csrf_secret();
10561065
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1108,11 +1117,94 @@
11081117
@ (Property: "wiki-use-html")
11091118
@ <hr />
11101119
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
11111120
@ </div></form>
11121121
db_end_transaction(0);
1113
- style_finish_page("setup");
1122
+ style_finish_page();
1123
+}
1124
+
1125
+/*
1126
+** WEBPAGE: setup_chat
1127
+**
1128
+** The "Admin/Chat" page. Requires Setup privilege.
1129
+*/
1130
+void setup_chat(void){
1131
+ static const char *const azAlerts[] = {
1132
+ "alerts/plunk.wav", "Plunk",
1133
+ "alerts/bflat3.wav", "Tone-1",
1134
+ "alerts/bflat2.wav", "Tone-2",
1135
+ "alerts/bloop.wav", "Bloop",
1136
+ };
1137
+
1138
+ login_check_credentials();
1139
+ if( !g.perm.Setup ){
1140
+ login_needed(0);
1141
+ return;
1142
+ }
1143
+
1144
+ style_set_current_feature("setup");
1145
+ style_header("Chat Configuration");
1146
+ db_begin_transaction();
1147
+ @ <form action="%R/setup_chat" method="post"><div>
1148
+ login_insert_csrf_secret();
1149
+ @ <input type="submit" name="submit" value="Apply Changes" /></p>
1150
+ @ <hr />
1151
+ entry_attribute("Initial Chat History Size", 10,
1152
+ "chat-initial-history", "chatih", "50", 0);
1153
+ @ <p>When /chat first starts up, it preloads up to this many historical
1154
+ @ messages.
1155
+ @ (Property: "chat-initial-history")</p>
1156
+ @ <hr />
1157
+ entry_attribute("Minimum Number Of Historical Messages To Retain", 10,
1158
+ "chat-keep-count", "chatkc", "50", 0);
1159
+ @ <p>The chat subsystem purges older messages. But it will always retain
1160
+ @ the N most recent messages where N is the value of this setting.
1161
+ @ (Property: "chat-keep-count")</p>
1162
+ @ <hr />
1163
+ entry_attribute("Maximum Message Age In Days", 10,
1164
+ "chat-keep-days", "chatkd", "7", 0);
1165
+ @ <p>Chat message are removed after N days, where N is the value of
1166
+ @ this setting. N may be fractional. So, for example, to only keep
1167
+ @ an historical record of chat messages for 12 hours, set this value
1168
+ @ to 0.5.
1169
+ @ (Property: "chat-keep-days")</p>
1170
+ @ <hr />
1171
+ entry_attribute("Chat Polling Timeout", 10,
1172
+ "chat-poll-timeout", "chatpt", "420", 0);
1173
+ @ <p>New chat content is downloaded using the "long poll" technique.
1174
+ @ HTTP requests are made to /chat-poll which blocks waiting on new
1175
+ @ content to arrive. But the /chat-poll cannot block forever. It
1176
+ @ eventual must give up and return an empty message set. This setting
1177
+ @ determines how long /chat-poll will wait before giving up. The
1178
+ @ default setting of approximately 7 minutes works well on many systems.
1179
+ @ Shorter delays might be required on installations that use proxies
1180
+ @ or web-servers with short timeouts. For best efficiency, this value
1181
+ @ should be larger rather than smaller.
1182
+ @ (Property: "chat-poll-timeout")</p>
1183
+ @ <hr />
1184
+
1185
+ multiple_choice_attribute("Alert sound",
1186
+ "chat-alert-sound", "snd", azAlerts[0],
1187
+ count(azAlerts)/2, azAlerts);
1188
+ @ <p>The sound used in the client-side chat to indicate that a new
1189
+ @ chat message has arrived.
1190
+ @ (Property: "chat-alert-sound")</p>
1191
+ @ <hr/>
1192
+ @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1193
+ @ </div></form>
1194
+ db_end_transaction(0);
1195
+ @ <script nonce="%h(style_nonce())">
1196
+ @ (function(){
1197
+ @ var w = document.getElementById('idsnd');
1198
+ @ w.onchange = function(){
1199
+ @ var audio = new Audio('%s(g.zBaseURL)/builtin/' + w.value);
1200
+ @ audio.currentTime = 0;
1201
+ @ audio.play();
1202
+ @ }
1203
+ @ })();
1204
+ @ </script>
1205
+ style_finish_page();
11141206
}
11151207
11161208
/*
11171209
** WEBPAGE: setup_modreq
11181210
**
@@ -1123,10 +1215,11 @@
11231215
if( !g.perm.Admin ){
11241216
login_needed(0);
11251217
return;
11261218
}
11271219
1220
+ style_set_current_feature("setup");
11281221
style_header("Moderator For Wiki And Tickets");
11291222
db_begin_transaction();
11301223
@ <form action="%R/setup_modreq" method="post"><div>
11311224
login_insert_csrf_secret();
11321225
@ <hr />
@@ -1154,11 +1247,11 @@
11541247
11551248
@ <hr />
11561249
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
11571250
@ </div></form>
11581251
db_end_transaction(0);
1159
- style_finish_page("setup");
1252
+ style_finish_page();
11601253
11611254
}
11621255
11631256
/*
11641257
** WEBPAGE: setup_adunit
@@ -1180,10 +1273,11 @@
11801273
cgi_replace_parameter("adunit","");
11811274
cgi_replace_parameter("adright","");
11821275
setup_incr_cfgcnt();
11831276
}
11841277
1278
+ style_set_current_feature("setup");
11851279
style_header("Edit Ad Unit");
11861280
@ <form action="%R/setup_adunit" method="post"><div>
11871281
login_insert_csrf_secret();
11881282
@ <b>Banner Ad-Unit:</b><br />
11891283
textarea_attribute("", 6, 80, "adunit", "adunit", "", 0);
@@ -1235,11 +1329,11 @@
12351329
@ border: 1px solid #f11;
12361330
@ background-color: #fcc;
12371331
@ '&gt;Demo Ad&lt;/div&gt;
12381332
@ </pre></blockquote>
12391333
@ </li>
1240
- style_finish_page("setup");
1334
+ style_finish_page();
12411335
db_end_transaction(0);
12421336
}
12431337
12441338
/*
12451339
** WEBPAGE: setup_logo
@@ -1361,10 +1455,11 @@
13611455
);
13621456
db_protect_pop();
13631457
db_end_transaction(0);
13641458
cgi_redirect("setup_logo");
13651459
}
1460
+ style_set_current_feature("setup");
13661461
style_header("Edit Project Logo And Background");
13671462
@ <p>The current project logo has a MIME-Type of <b>%h(zLogoMime)</b>
13681463
@ and looks like this:</p>
13691464
@ <blockquote><p><img src="%R/logo/%z(zLogoMtime)" \
13701465
@ alt="logo" border="1" />
@@ -1437,11 +1532,11 @@
14371532
@ <hr />
14381533
@
14391534
@ <p><span class="note">Note:</span> Your browser has probably cached these
14401535
@ images, so you may need to press the Reload button before changes will
14411536
@ take effect. </p>
1442
- style_finish_page("setup");
1537
+ style_finish_page();
14431538
db_end_transaction(0);
14441539
}
14451540
14461541
/*
14471542
** Prevent the RAW SQL feature from being used to ATTACH a different
@@ -1481,10 +1576,11 @@
14811576
login_needed(0);
14821577
return;
14831578
}
14841579
add_content_sql_commands(g.db);
14851580
zQ = cgi_csrf_safe(1) ? P("q") : 0;
1581
+ style_set_current_feature("setup");
14861582
style_header("Raw SQL Commands");
14871583
@ <p><b>Caution:</b> There are no restrictions on the SQL that can be
14881584
@ run by this page. You can do serious and irrepairable damage to the
14891585
@ repository. Proceed with extreme caution.</p>
14901586
@
@@ -1599,11 +1695,11 @@
15991695
}
16001696
sqlite3_finalize(pStmt);
16011697
@ </table>
16021698
}
16031699
}
1604
- style_finish_page("setup");
1700
+ style_finish_page();
16051701
}
16061702
16071703
16081704
/*
16091705
** WEBPAGE: admin_th1
@@ -1618,10 +1714,11 @@
16181714
login_check_credentials();
16191715
if( !g.perm.Setup ){
16201716
login_needed(0);
16211717
return;
16221718
}
1719
+ style_set_current_feature("setup");
16231720
style_header("Raw TH1 Commands");
16241721
@ <p><b>Caution:</b> There are no restrictions on the TH1 that can be
16251722
@ run by this page. If Tcl integration was enabled at compile-time and
16261723
@ the "tcl" setting is enabled, Tcl commands may be run as well.</p>
16271724
@
@@ -1643,11 +1740,11 @@
16431740
@ <pre class="th1result">%h(zR)</pre>
16441741
}else{
16451742
@ <pre class="th1error">%h(zR)</pre>
16461743
}
16471744
}
1648
- style_finish_page("setup");
1745
+ style_finish_page();
16491746
}
16501747
16511748
/*
16521749
** WEBPAGE: admin_log
16531750
**
@@ -1664,10 +1761,11 @@
16641761
login_check_credentials();
16651762
if( !g.perm.Admin ){
16661763
login_needed(0);
16671764
return;
16681765
}
1766
+ style_set_current_feature("setup");
16691767
style_header("Admin Log");
16701768
create_admin_log_table();
16711769
limit = atoi(PD("n","200"));
16721770
ofst = atoi(PD("x","0"));
16731771
fLogEnabled = db_get_boolean("admin-log", 0);
@@ -1710,11 +1808,11 @@
17101808
db_finalize(&stLog);
17111809
@ </tbody></table>
17121810
if( counter>ofst+limit ){
17131811
@ <p><a href="admin_log?n=%d(limit)&x=%d(limit+ofst)">[Older]</a></p>
17141812
}
1715
- style_finish_page("setup");
1813
+ style_finish_page();
17161814
}
17171815
17181816
/*
17191817
** WEBPAGE: srchsetup
17201818
**
@@ -1724,10 +1822,11 @@
17241822
login_check_credentials();
17251823
if( !g.perm.Admin ){
17261824
login_needed(0);
17271825
return;
17281826
}
1827
+ style_set_current_feature("setup");
17291828
style_header("Search Configuration");
17301829
@ <form action="%R/srchsetup" method="post"><div>
17311830
login_insert_csrf_secret();
17321831
@ <div style="text-align:center;font-weight:bold;">
17331832
@ Server-specific settings that affect the
@@ -1790,11 +1889,11 @@
17901889
@ larger repositories.</p>
17911890
onoff_attribute("Use Porter Stemmer","search-stemmer","ss",0,0);
17921891
@ <p><input type="submit" name="fts1" value="Create A Full-Text Index">
17931892
}
17941893
@ </div></form>
1795
- style_finish_page("setup");
1894
+ style_finish_page();
17961895
}
17971896
17981897
/*
17991898
** A URL Alias originally called zOldName is now zNewName/zValue.
18001899
** Write SQL to make this change into pSql.
@@ -1849,10 +1948,11 @@
18491948
login_check_credentials();
18501949
if( !g.perm.Admin ){
18511950
login_needed(0);
18521951
return;
18531952
}
1953
+ style_set_current_feature("setup");
18541954
style_header("URL Alias Configuration");
18551955
if( P("submit")!=0 ){
18561956
Blob token;
18571957
Blob sql;
18581958
const char *zNewName;
@@ -1948,7 +2048,7 @@
19482048
@ <p>To delete an entry from the alias table, change its name or value to an
19492049
@ empty string and press "Apply Changes".
19502050
@
19512051
@ <p>To add a new alias, fill in the name and value in the bottom row
19522052
@ of the table above and press "Apply Changes".
1953
- style_finish_page("setup");
2053
+ style_finish_page();
19542054
}
19552055
--- src/setup.c
+++ src/setup.c
@@ -73,10 +73,11 @@
73 if( !g.perm.Admin ){
74 login_needed(0);
75 }
76 setup_user = g.perm.Setup;
77
 
78 style_header("Server Administration");
79
80 /* Make sure the header contains <base href="...">. Issue a warning
81 ** if it does not. */
82 if( !cgi_header_contains("<base href=") ){
@@ -123,10 +124,12 @@
123 " on the same server");
124 setup_menu_entry("Tickets", "tktsetup",
125 "Configure the trouble-ticketing system for this repository");
126 setup_menu_entry("Wiki", "setup_wiki",
127 "Configure the wiki for this repository");
 
 
128 }
129 setup_menu_entry("Search","srchsetup",
130 "Configure the built-in search engine");
131 setup_menu_entry("URL Aliases", "waliassetup",
132 "Configure URL aliases");
@@ -175,11 +178,11 @@
175 setup_menu_entry("TH1", "admin_th1",
176 "Enter raw TH1 commands");
177 }
178 @ </table>
179
180 style_finish_page("setup");
181 }
182
183 /*
184 ** Generate a checkbox for an attribute.
185 */
@@ -339,10 +342,11 @@
339 if( !g.perm.Setup ){
340 login_needed(0);
341 return;
342 }
343
 
344 style_header("Access Control Settings");
345 db_begin_transaction();
346 @ <form action="%R/setup_access" method="post"><div>
347 login_insert_csrf_secret();
348 @ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -576,11 +580,11 @@
576
577 @ <hr />
578 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
579 @ </div></form>
580 db_end_transaction(0);
581 style_finish_page("setup");
582 }
583
584 /*
585 ** WEBPAGE: setup_login_group
586 **
@@ -608,10 +612,11 @@
608 if( P("join")!=0 ){
609 login_group_join(zRepo, 1, zLogin, zPw, zNewName, &zErrMsg);
610 }else if( P("leave") ){
611 login_group_leave(&zErrMsg);
612 }
 
613 style_header("Login Group Configuration");
614 if( zErrMsg ){
615 @ <p class="generalError">%s(zErrMsg)</p>
616 }
617 zGroup = login_group_name();
@@ -704,11 +709,11 @@
704 }
705 db_finalize(&q);
706 @ </tbody></table>
707 style_table_sorter();
708 }
709 style_finish_page("setup");
710 }
711
712 /*
713 ** WEBPAGE: setup_timeline
714 **
@@ -729,10 +734,11 @@
729 if( !g.perm.Admin ){
730 login_needed(0);
731 return;
732 }
733
 
734 style_header("Timeline Display Preferences");
735 db_begin_transaction();
736 @ <form action="%R/setup_timeline" method="post"><div>
737 login_insert_csrf_secret();
738 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -843,11 +849,11 @@
843
844 @ <hr />
845 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
846 @ </div></form>
847 db_end_transaction(0);
848 style_finish_page("setup");
849 }
850
851 /*
852 ** WEBPAGE: setup_settings
853 **
@@ -864,10 +870,11 @@
864 if( !g.perm.Setup ){
865 login_needed(0);
866 return;
867 }
868
 
869 style_header("Settings");
870 if(!g.repositoryOpen){
871 /* Provide read-only access to versioned settings,
872 but only if no repo file was explicitly provided. */
873 db_open_local(0);
@@ -936,11 +943,11 @@
936 }
937 }
938 @ </td></tr></table>
939 @ </div></form>
940 db_end_transaction(0);
941 style_finish_page("setup");
942 }
943
944 /*
945 ** WEBPAGE: setup_config
946 **
@@ -951,10 +958,11 @@
951 if( !g.perm.Setup ){
952 login_needed(0);
953 return;
954 }
955
 
956 style_header("WWW Configuration");
957 db_begin_transaction();
958 @ <form action="%R/setup_config" method="post"><div>
959 login_insert_csrf_secret();
960 @ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1001,11 +1009,11 @@
1001 @
1002 @ <blockquote><p>%h(g.zBaseURL)/home</p></blockquote>
1003 @
1004 @ <p>The default "/home" page displays a Wiki page with the same name
1005 @ as the Project Name specified above. Some sites prefer to redirect
1006 @ to a documentation page (ex: "/doc/tip/index.wiki") or to "/timeline".</p>
1007 @
1008 @ <p>Note: To avoid a redirect loop or other problems, this entry must
1009 @ begin with "/" and it must specify a valid page. For example,
1010 @ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the
1011 @ leading "/".</p>
@@ -1032,11 +1040,11 @@
1032 @ (Property: sitemap-contact)
1033 @ <hr />
1034 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1035 @ </div></form>
1036 db_end_transaction(0);
1037 style_finish_page("setup");
1038 }
1039
1040 /*
1041 ** WEBPAGE: setup_wiki
1042 **
@@ -1047,10 +1055,11 @@
1047 if( !g.perm.Setup ){
1048 login_needed(0);
1049 return;
1050 }
1051
 
1052 style_header("Wiki Configuration");
1053 db_begin_transaction();
1054 @ <form action="%R/setup_wiki" method="post"><div>
1055 login_insert_csrf_secret();
1056 @ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1108,11 +1117,94 @@
1108 @ (Property: "wiki-use-html")
1109 @ <hr />
1110 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1111 @ </div></form>
1112 db_end_transaction(0);
1113 style_finish_page("setup");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1114 }
1115
1116 /*
1117 ** WEBPAGE: setup_modreq
1118 **
@@ -1123,10 +1215,11 @@
1123 if( !g.perm.Admin ){
1124 login_needed(0);
1125 return;
1126 }
1127
 
1128 style_header("Moderator For Wiki And Tickets");
1129 db_begin_transaction();
1130 @ <form action="%R/setup_modreq" method="post"><div>
1131 login_insert_csrf_secret();
1132 @ <hr />
@@ -1154,11 +1247,11 @@
1154
1155 @ <hr />
1156 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1157 @ </div></form>
1158 db_end_transaction(0);
1159 style_finish_page("setup");
1160
1161 }
1162
1163 /*
1164 ** WEBPAGE: setup_adunit
@@ -1180,10 +1273,11 @@
1180 cgi_replace_parameter("adunit","");
1181 cgi_replace_parameter("adright","");
1182 setup_incr_cfgcnt();
1183 }
1184
 
1185 style_header("Edit Ad Unit");
1186 @ <form action="%R/setup_adunit" method="post"><div>
1187 login_insert_csrf_secret();
1188 @ <b>Banner Ad-Unit:</b><br />
1189 textarea_attribute("", 6, 80, "adunit", "adunit", "", 0);
@@ -1235,11 +1329,11 @@
1235 @ border: 1px solid #f11;
1236 @ background-color: #fcc;
1237 @ '&gt;Demo Ad&lt;/div&gt;
1238 @ </pre></blockquote>
1239 @ </li>
1240 style_finish_page("setup");
1241 db_end_transaction(0);
1242 }
1243
1244 /*
1245 ** WEBPAGE: setup_logo
@@ -1361,10 +1455,11 @@
1361 );
1362 db_protect_pop();
1363 db_end_transaction(0);
1364 cgi_redirect("setup_logo");
1365 }
 
1366 style_header("Edit Project Logo And Background");
1367 @ <p>The current project logo has a MIME-Type of <b>%h(zLogoMime)</b>
1368 @ and looks like this:</p>
1369 @ <blockquote><p><img src="%R/logo/%z(zLogoMtime)" \
1370 @ alt="logo" border="1" />
@@ -1437,11 +1532,11 @@
1437 @ <hr />
1438 @
1439 @ <p><span class="note">Note:</span> Your browser has probably cached these
1440 @ images, so you may need to press the Reload button before changes will
1441 @ take effect. </p>
1442 style_finish_page("setup");
1443 db_end_transaction(0);
1444 }
1445
1446 /*
1447 ** Prevent the RAW SQL feature from being used to ATTACH a different
@@ -1481,10 +1576,11 @@
1481 login_needed(0);
1482 return;
1483 }
1484 add_content_sql_commands(g.db);
1485 zQ = cgi_csrf_safe(1) ? P("q") : 0;
 
1486 style_header("Raw SQL Commands");
1487 @ <p><b>Caution:</b> There are no restrictions on the SQL that can be
1488 @ run by this page. You can do serious and irrepairable damage to the
1489 @ repository. Proceed with extreme caution.</p>
1490 @
@@ -1599,11 +1695,11 @@
1599 }
1600 sqlite3_finalize(pStmt);
1601 @ </table>
1602 }
1603 }
1604 style_finish_page("setup");
1605 }
1606
1607
1608 /*
1609 ** WEBPAGE: admin_th1
@@ -1618,10 +1714,11 @@
1618 login_check_credentials();
1619 if( !g.perm.Setup ){
1620 login_needed(0);
1621 return;
1622 }
 
1623 style_header("Raw TH1 Commands");
1624 @ <p><b>Caution:</b> There are no restrictions on the TH1 that can be
1625 @ run by this page. If Tcl integration was enabled at compile-time and
1626 @ the "tcl" setting is enabled, Tcl commands may be run as well.</p>
1627 @
@@ -1643,11 +1740,11 @@
1643 @ <pre class="th1result">%h(zR)</pre>
1644 }else{
1645 @ <pre class="th1error">%h(zR)</pre>
1646 }
1647 }
1648 style_finish_page("setup");
1649 }
1650
1651 /*
1652 ** WEBPAGE: admin_log
1653 **
@@ -1664,10 +1761,11 @@
1664 login_check_credentials();
1665 if( !g.perm.Admin ){
1666 login_needed(0);
1667 return;
1668 }
 
1669 style_header("Admin Log");
1670 create_admin_log_table();
1671 limit = atoi(PD("n","200"));
1672 ofst = atoi(PD("x","0"));
1673 fLogEnabled = db_get_boolean("admin-log", 0);
@@ -1710,11 +1808,11 @@
1710 db_finalize(&stLog);
1711 @ </tbody></table>
1712 if( counter>ofst+limit ){
1713 @ <p><a href="admin_log?n=%d(limit)&x=%d(limit+ofst)">[Older]</a></p>
1714 }
1715 style_finish_page("setup");
1716 }
1717
1718 /*
1719 ** WEBPAGE: srchsetup
1720 **
@@ -1724,10 +1822,11 @@
1724 login_check_credentials();
1725 if( !g.perm.Admin ){
1726 login_needed(0);
1727 return;
1728 }
 
1729 style_header("Search Configuration");
1730 @ <form action="%R/srchsetup" method="post"><div>
1731 login_insert_csrf_secret();
1732 @ <div style="text-align:center;font-weight:bold;">
1733 @ Server-specific settings that affect the
@@ -1790,11 +1889,11 @@
1790 @ larger repositories.</p>
1791 onoff_attribute("Use Porter Stemmer","search-stemmer","ss",0,0);
1792 @ <p><input type="submit" name="fts1" value="Create A Full-Text Index">
1793 }
1794 @ </div></form>
1795 style_finish_page("setup");
1796 }
1797
1798 /*
1799 ** A URL Alias originally called zOldName is now zNewName/zValue.
1800 ** Write SQL to make this change into pSql.
@@ -1849,10 +1948,11 @@
1849 login_check_credentials();
1850 if( !g.perm.Admin ){
1851 login_needed(0);
1852 return;
1853 }
 
1854 style_header("URL Alias Configuration");
1855 if( P("submit")!=0 ){
1856 Blob token;
1857 Blob sql;
1858 const char *zNewName;
@@ -1948,7 +2048,7 @@
1948 @ <p>To delete an entry from the alias table, change its name or value to an
1949 @ empty string and press "Apply Changes".
1950 @
1951 @ <p>To add a new alias, fill in the name and value in the bottom row
1952 @ of the table above and press "Apply Changes".
1953 style_finish_page("setup");
1954 }
1955
--- src/setup.c
+++ src/setup.c
@@ -73,10 +73,11 @@
73 if( !g.perm.Admin ){
74 login_needed(0);
75 }
76 setup_user = g.perm.Setup;
77
78 style_set_current_feature("setup");
79 style_header("Server Administration");
80
81 /* Make sure the header contains <base href="...">. Issue a warning
82 ** if it does not. */
83 if( !cgi_header_contains("<base href=") ){
@@ -123,10 +124,12 @@
124 " on the same server");
125 setup_menu_entry("Tickets", "tktsetup",
126 "Configure the trouble-ticketing system for this repository");
127 setup_menu_entry("Wiki", "setup_wiki",
128 "Configure the wiki for this repository");
129 setup_menu_entry("Chat", "setup_chat",
130 "Configure the chatroom");
131 }
132 setup_menu_entry("Search","srchsetup",
133 "Configure the built-in search engine");
134 setup_menu_entry("URL Aliases", "waliassetup",
135 "Configure URL aliases");
@@ -175,11 +178,11 @@
178 setup_menu_entry("TH1", "admin_th1",
179 "Enter raw TH1 commands");
180 }
181 @ </table>
182
183 style_finish_page();
184 }
185
186 /*
187 ** Generate a checkbox for an attribute.
188 */
@@ -339,10 +342,11 @@
342 if( !g.perm.Setup ){
343 login_needed(0);
344 return;
345 }
346
347 style_set_current_feature("setup");
348 style_header("Access Control Settings");
349 db_begin_transaction();
350 @ <form action="%R/setup_access" method="post"><div>
351 login_insert_csrf_secret();
352 @ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -576,11 +580,11 @@
580
581 @ <hr />
582 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
583 @ </div></form>
584 db_end_transaction(0);
585 style_finish_page();
586 }
587
588 /*
589 ** WEBPAGE: setup_login_group
590 **
@@ -608,10 +612,11 @@
612 if( P("join")!=0 ){
613 login_group_join(zRepo, 1, zLogin, zPw, zNewName, &zErrMsg);
614 }else if( P("leave") ){
615 login_group_leave(&zErrMsg);
616 }
617 style_set_current_feature("setup");
618 style_header("Login Group Configuration");
619 if( zErrMsg ){
620 @ <p class="generalError">%s(zErrMsg)</p>
621 }
622 zGroup = login_group_name();
@@ -704,11 +709,11 @@
709 }
710 db_finalize(&q);
711 @ </tbody></table>
712 style_table_sorter();
713 }
714 style_finish_page();
715 }
716
717 /*
718 ** WEBPAGE: setup_timeline
719 **
@@ -729,10 +734,11 @@
734 if( !g.perm.Admin ){
735 login_needed(0);
736 return;
737 }
738
739 style_set_current_feature("setup");
740 style_header("Timeline Display Preferences");
741 db_begin_transaction();
742 @ <form action="%R/setup_timeline" method="post"><div>
743 login_insert_csrf_secret();
744 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -843,11 +849,11 @@
849
850 @ <hr />
851 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
852 @ </div></form>
853 db_end_transaction(0);
854 style_finish_page();
855 }
856
857 /*
858 ** WEBPAGE: setup_settings
859 **
@@ -864,10 +870,11 @@
870 if( !g.perm.Setup ){
871 login_needed(0);
872 return;
873 }
874
875 style_set_current_feature("setup");
876 style_header("Settings");
877 if(!g.repositoryOpen){
878 /* Provide read-only access to versioned settings,
879 but only if no repo file was explicitly provided. */
880 db_open_local(0);
@@ -936,11 +943,11 @@
943 }
944 }
945 @ </td></tr></table>
946 @ </div></form>
947 db_end_transaction(0);
948 style_finish_page();
949 }
950
951 /*
952 ** WEBPAGE: setup_config
953 **
@@ -951,10 +958,11 @@
958 if( !g.perm.Setup ){
959 login_needed(0);
960 return;
961 }
962
963 style_set_current_feature("setup");
964 style_header("WWW Configuration");
965 db_begin_transaction();
966 @ <form action="%R/setup_config" method="post"><div>
967 login_insert_csrf_secret();
968 @ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1001,11 +1009,11 @@
1009 @
1010 @ <blockquote><p>%h(g.zBaseURL)/home</p></blockquote>
1011 @
1012 @ <p>The default "/home" page displays a Wiki page with the same name
1013 @ as the Project Name specified above. Some sites prefer to redirect
1014 @ to a documentation page (ex: "/doc/trunk/index.wiki") or to "/timeline".</p>
1015 @
1016 @ <p>Note: To avoid a redirect loop or other problems, this entry must
1017 @ begin with "/" and it must specify a valid page. For example,
1018 @ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the
1019 @ leading "/".</p>
@@ -1032,11 +1040,11 @@
1040 @ (Property: sitemap-contact)
1041 @ <hr />
1042 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1043 @ </div></form>
1044 db_end_transaction(0);
1045 style_finish_page();
1046 }
1047
1048 /*
1049 ** WEBPAGE: setup_wiki
1050 **
@@ -1047,10 +1055,11 @@
1055 if( !g.perm.Setup ){
1056 login_needed(0);
1057 return;
1058 }
1059
1060 style_set_current_feature("setup");
1061 style_header("Wiki Configuration");
1062 db_begin_transaction();
1063 @ <form action="%R/setup_wiki" method="post"><div>
1064 login_insert_csrf_secret();
1065 @ <input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1108,11 +1117,94 @@
1117 @ (Property: "wiki-use-html")
1118 @ <hr />
1119 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1120 @ </div></form>
1121 db_end_transaction(0);
1122 style_finish_page();
1123 }
1124
1125 /*
1126 ** WEBPAGE: setup_chat
1127 **
1128 ** The "Admin/Chat" page. Requires Setup privilege.
1129 */
1130 void setup_chat(void){
1131 static const char *const azAlerts[] = {
1132 "alerts/plunk.wav", "Plunk",
1133 "alerts/bflat3.wav", "Tone-1",
1134 "alerts/bflat2.wav", "Tone-2",
1135 "alerts/bloop.wav", "Bloop",
1136 };
1137
1138 login_check_credentials();
1139 if( !g.perm.Setup ){
1140 login_needed(0);
1141 return;
1142 }
1143
1144 style_set_current_feature("setup");
1145 style_header("Chat Configuration");
1146 db_begin_transaction();
1147 @ <form action="%R/setup_chat" method="post"><div>
1148 login_insert_csrf_secret();
1149 @ <input type="submit" name="submit" value="Apply Changes" /></p>
1150 @ <hr />
1151 entry_attribute("Initial Chat History Size", 10,
1152 "chat-initial-history", "chatih", "50", 0);
1153 @ <p>When /chat first starts up, it preloads up to this many historical
1154 @ messages.
1155 @ (Property: "chat-initial-history")</p>
1156 @ <hr />
1157 entry_attribute("Minimum Number Of Historical Messages To Retain", 10,
1158 "chat-keep-count", "chatkc", "50", 0);
1159 @ <p>The chat subsystem purges older messages. But it will always retain
1160 @ the N most recent messages where N is the value of this setting.
1161 @ (Property: "chat-keep-count")</p>
1162 @ <hr />
1163 entry_attribute("Maximum Message Age In Days", 10,
1164 "chat-keep-days", "chatkd", "7", 0);
1165 @ <p>Chat message are removed after N days, where N is the value of
1166 @ this setting. N may be fractional. So, for example, to only keep
1167 @ an historical record of chat messages for 12 hours, set this value
1168 @ to 0.5.
1169 @ (Property: "chat-keep-days")</p>
1170 @ <hr />
1171 entry_attribute("Chat Polling Timeout", 10,
1172 "chat-poll-timeout", "chatpt", "420", 0);
1173 @ <p>New chat content is downloaded using the "long poll" technique.
1174 @ HTTP requests are made to /chat-poll which blocks waiting on new
1175 @ content to arrive. But the /chat-poll cannot block forever. It
1176 @ eventual must give up and return an empty message set. This setting
1177 @ determines how long /chat-poll will wait before giving up. The
1178 @ default setting of approximately 7 minutes works well on many systems.
1179 @ Shorter delays might be required on installations that use proxies
1180 @ or web-servers with short timeouts. For best efficiency, this value
1181 @ should be larger rather than smaller.
1182 @ (Property: "chat-poll-timeout")</p>
1183 @ <hr />
1184
1185 multiple_choice_attribute("Alert sound",
1186 "chat-alert-sound", "snd", azAlerts[0],
1187 count(azAlerts)/2, azAlerts);
1188 @ <p>The sound used in the client-side chat to indicate that a new
1189 @ chat message has arrived.
1190 @ (Property: "chat-alert-sound")</p>
1191 @ <hr/>
1192 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1193 @ </div></form>
1194 db_end_transaction(0);
1195 @ <script nonce="%h(style_nonce())">
1196 @ (function(){
1197 @ var w = document.getElementById('idsnd');
1198 @ w.onchange = function(){
1199 @ var audio = new Audio('%s(g.zBaseURL)/builtin/' + w.value);
1200 @ audio.currentTime = 0;
1201 @ audio.play();
1202 @ }
1203 @ })();
1204 @ </script>
1205 style_finish_page();
1206 }
1207
1208 /*
1209 ** WEBPAGE: setup_modreq
1210 **
@@ -1123,10 +1215,11 @@
1215 if( !g.perm.Admin ){
1216 login_needed(0);
1217 return;
1218 }
1219
1220 style_set_current_feature("setup");
1221 style_header("Moderator For Wiki And Tickets");
1222 db_begin_transaction();
1223 @ <form action="%R/setup_modreq" method="post"><div>
1224 login_insert_csrf_secret();
1225 @ <hr />
@@ -1154,11 +1247,11 @@
1247
1248 @ <hr />
1249 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1250 @ </div></form>
1251 db_end_transaction(0);
1252 style_finish_page();
1253
1254 }
1255
1256 /*
1257 ** WEBPAGE: setup_adunit
@@ -1180,10 +1273,11 @@
1273 cgi_replace_parameter("adunit","");
1274 cgi_replace_parameter("adright","");
1275 setup_incr_cfgcnt();
1276 }
1277
1278 style_set_current_feature("setup");
1279 style_header("Edit Ad Unit");
1280 @ <form action="%R/setup_adunit" method="post"><div>
1281 login_insert_csrf_secret();
1282 @ <b>Banner Ad-Unit:</b><br />
1283 textarea_attribute("", 6, 80, "adunit", "adunit", "", 0);
@@ -1235,11 +1329,11 @@
1329 @ border: 1px solid #f11;
1330 @ background-color: #fcc;
1331 @ '&gt;Demo Ad&lt;/div&gt;
1332 @ </pre></blockquote>
1333 @ </li>
1334 style_finish_page();
1335 db_end_transaction(0);
1336 }
1337
1338 /*
1339 ** WEBPAGE: setup_logo
@@ -1361,10 +1455,11 @@
1455 );
1456 db_protect_pop();
1457 db_end_transaction(0);
1458 cgi_redirect("setup_logo");
1459 }
1460 style_set_current_feature("setup");
1461 style_header("Edit Project Logo And Background");
1462 @ <p>The current project logo has a MIME-Type of <b>%h(zLogoMime)</b>
1463 @ and looks like this:</p>
1464 @ <blockquote><p><img src="%R/logo/%z(zLogoMtime)" \
1465 @ alt="logo" border="1" />
@@ -1437,11 +1532,11 @@
1532 @ <hr />
1533 @
1534 @ <p><span class="note">Note:</span> Your browser has probably cached these
1535 @ images, so you may need to press the Reload button before changes will
1536 @ take effect. </p>
1537 style_finish_page();
1538 db_end_transaction(0);
1539 }
1540
1541 /*
1542 ** Prevent the RAW SQL feature from being used to ATTACH a different
@@ -1481,10 +1576,11 @@
1576 login_needed(0);
1577 return;
1578 }
1579 add_content_sql_commands(g.db);
1580 zQ = cgi_csrf_safe(1) ? P("q") : 0;
1581 style_set_current_feature("setup");
1582 style_header("Raw SQL Commands");
1583 @ <p><b>Caution:</b> There are no restrictions on the SQL that can be
1584 @ run by this page. You can do serious and irrepairable damage to the
1585 @ repository. Proceed with extreme caution.</p>
1586 @
@@ -1599,11 +1695,11 @@
1695 }
1696 sqlite3_finalize(pStmt);
1697 @ </table>
1698 }
1699 }
1700 style_finish_page();
1701 }
1702
1703
1704 /*
1705 ** WEBPAGE: admin_th1
@@ -1618,10 +1714,11 @@
1714 login_check_credentials();
1715 if( !g.perm.Setup ){
1716 login_needed(0);
1717 return;
1718 }
1719 style_set_current_feature("setup");
1720 style_header("Raw TH1 Commands");
1721 @ <p><b>Caution:</b> There are no restrictions on the TH1 that can be
1722 @ run by this page. If Tcl integration was enabled at compile-time and
1723 @ the "tcl" setting is enabled, Tcl commands may be run as well.</p>
1724 @
@@ -1643,11 +1740,11 @@
1740 @ <pre class="th1result">%h(zR)</pre>
1741 }else{
1742 @ <pre class="th1error">%h(zR)</pre>
1743 }
1744 }
1745 style_finish_page();
1746 }
1747
1748 /*
1749 ** WEBPAGE: admin_log
1750 **
@@ -1664,10 +1761,11 @@
1761 login_check_credentials();
1762 if( !g.perm.Admin ){
1763 login_needed(0);
1764 return;
1765 }
1766 style_set_current_feature("setup");
1767 style_header("Admin Log");
1768 create_admin_log_table();
1769 limit = atoi(PD("n","200"));
1770 ofst = atoi(PD("x","0"));
1771 fLogEnabled = db_get_boolean("admin-log", 0);
@@ -1710,11 +1808,11 @@
1808 db_finalize(&stLog);
1809 @ </tbody></table>
1810 if( counter>ofst+limit ){
1811 @ <p><a href="admin_log?n=%d(limit)&x=%d(limit+ofst)">[Older]</a></p>
1812 }
1813 style_finish_page();
1814 }
1815
1816 /*
1817 ** WEBPAGE: srchsetup
1818 **
@@ -1724,10 +1822,11 @@
1822 login_check_credentials();
1823 if( !g.perm.Admin ){
1824 login_needed(0);
1825 return;
1826 }
1827 style_set_current_feature("setup");
1828 style_header("Search Configuration");
1829 @ <form action="%R/srchsetup" method="post"><div>
1830 login_insert_csrf_secret();
1831 @ <div style="text-align:center;font-weight:bold;">
1832 @ Server-specific settings that affect the
@@ -1790,11 +1889,11 @@
1889 @ larger repositories.</p>
1890 onoff_attribute("Use Porter Stemmer","search-stemmer","ss",0,0);
1891 @ <p><input type="submit" name="fts1" value="Create A Full-Text Index">
1892 }
1893 @ </div></form>
1894 style_finish_page();
1895 }
1896
1897 /*
1898 ** A URL Alias originally called zOldName is now zNewName/zValue.
1899 ** Write SQL to make this change into pSql.
@@ -1849,10 +1948,11 @@
1948 login_check_credentials();
1949 if( !g.perm.Admin ){
1950 login_needed(0);
1951 return;
1952 }
1953 style_set_current_feature("setup");
1954 style_header("URL Alias Configuration");
1955 if( P("submit")!=0 ){
1956 Blob token;
1957 Blob sql;
1958 const char *zNewName;
@@ -1948,7 +2048,7 @@
2048 @ <p>To delete an entry from the alias table, change its name or value to an
2049 @ empty string and press "Apply Changes".
2050 @
2051 @ <p>To add a new alias, fill in the name and value in the bottom row
2052 @ of the table above and press "Apply Changes".
2053 style_finish_page();
2054 }
2055
+42 -12
--- src/setupuser.c
+++ src/setupuser.c
@@ -16,10 +16,13 @@
1616
*******************************************************************************
1717
**
1818
** Setup pages associated with user management. The code in this
1919
** file was formerly part of the "setup.c" module, but has been broken
2020
** out into its own module to improve maintainability.
21
+**
22
+** Note: Do not confuse "Users" with "Subscribers". Code to deal with
23
+** subscribers is over in the "alerts.c" source file.
2124
*/
2225
#include "config.h"
2326
#include <assert.h>
2427
#include "setupuser.h"
2528
@@ -49,10 +52,11 @@
4952
style_submenu_element("Log", "access_log");
5053
style_submenu_element("Help", "setup_ulist_notes");
5154
if( alert_tables_exist() ){
5255
style_submenu_element("Subscribers", "subscribers");
5356
}
57
+ style_set_current_feature("setup");
5458
style_header("User List");
5559
if( (zWith==0 || zWith[0]==0) && !bUnusedOnly ){
5660
@ <table border=1 cellpadding=2 cellspacing=0 class='userTable'>
5761
@ <thead><tr>
5862
@ <th>Category
@@ -109,13 +113,14 @@
109113
}
110114
if( !bUnusedOnly ){
111115
style_submenu_element("Unused", "setup_ulist?unused");
112116
}
113117
@ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \
114
- @ data-column-types='ktxTTK' data-init-sort='2'>
118
+ @ data-column-types='ktxTTKt' data-init-sort='2'>
115119
@ <thead><tr>
116
- @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead>
120
+ @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login\
121
+ @ <th>Alerts</tr></thead>
117122
@ <tbody>
118123
db_multi_exec(
119124
"CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL)"
120125
"WITHOUT ROWID;"
121126
);
@@ -127,10 +132,16 @@
127132
" UNION ALL"
128133
" SELECT login AS uname, rcvfrom.mtime AS mtime"
129134
" FROM rcvfrom JOIN user USING(uid))"
130135
" GROUP BY 1;"
131136
);
137
+ }
138
+ if( !db_table_exists("repository","subscriber") ){
139
+ db_multi_exec(
140
+ "CREATE TEMP TABLE subscriber(suname PRIMARY KEY, ssub, subscriberId)"
141
+ "WITHOUT ROWID;"
142
+ );
132143
}
133144
if( bUnusedOnly ){
134145
zWith = mprintf(
135146
" AND login NOT IN ("
136147
"SELECT user FROM event WHERE user NOT NULL "
@@ -142,17 +153,19 @@
142153
zWith = mprintf(" AND fullcap(cap) GLOB '*[%q]*'", zWith);
143154
}else{
144155
zWith = "";
145156
}
146157
db_prepare(&s,
147
- "SELECT uid, login, cap, info, date(mtime,'unixepoch'),"
158
+ "SELECT uid, login, cap, info, date(user.mtime,'unixepoch'),"
148159
" lower(login) AS sortkey, "
149160
" CASE WHEN info LIKE '%%expires 20%%'"
150161
" THEN substr(info,instr(lower(info),'expires')+8,10)"
151162
" END AS exp,"
152
- "atime"
163
+ "atime,"
164
+ " subscriber.ssub, subscriber.subscriberId"
153165
" FROM user LEFT JOIN lastAccess ON login=uname"
166
+ " LEFT JOIN subscriber ON login=suname"
154167
" WHERE login NOT IN ('anonymous','nobody','developer','reader') %s"
155168
" ORDER BY sortkey", zWith/*safe-for-%s*/
156169
);
157170
rNow = db_double(0.0, "SELECT julianday('now');");
158171
while( db_step(&s)==SQLITE_ROW ){
@@ -163,10 +176,12 @@
163176
const char *zDate = db_column_text(&s, 4);
164177
const char *zSortKey = db_column_text(&s,5);
165178
const char *zExp = db_column_text(&s,6);
166179
double rATime = db_column_double(&s,7);
167180
char *zAge = 0;
181
+ const char *zSub;
182
+ int sid = db_column_int(&s,9);
168183
if( rATime>0.0 ){
169184
zAge = human_readable_age(rNow - rATime);
170185
}
171186
@ <tr>
172187
@ <td data-sortkey='%h(zSortKey)'>\
@@ -174,17 +189,25 @@
174189
@ <td>%h(zCap)
175190
@ <td>%h(zInfo)
176191
@ <td>%h(zDate?zDate:"")
177192
@ <td>%h(zExp?zExp:"")
178193
@ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
194
+ if( db_column_type(&s,8)==SQLITE_NULL ){
195
+ @ <td>
196
+ }else if( (zSub = db_column_text(&s,8))==0 || zSub[0]==0 ){
197
+ @ <td><a href="%R/alerts?sid=%d(sid)"><i>off</i></a>
198
+ }else{
199
+ @ <td><a href="%R/alerts?sid=%d(sid)">%h(zSub)</a>
200
+ }
201
+
179202
@ </tr>
180203
fossil_free(zAge);
181204
}
182205
@ </tbody></table>
183206
db_finalize(&s);
184207
style_table_sorter();
185
- style_finish_page("setupuser");
208
+ style_finish_page();
186209
}
187210
188211
/*
189212
** WEBPAGE: setup_ulist_notes
190213
**
@@ -191,10 +214,11 @@
191214
** A documentation page showing notes about user configuration. This
192215
** information used to be a side-bar on the user list page, but has been
193216
** factored out for improved presentation.
194217
*/
195218
void setup_ulist_notes(void){
219
+ style_set_current_feature("setup");
196220
style_header("User Configuration Notes");
197221
@ <h1>User Configuration Notes:</h1>
198222
@ <ol>
199223
@ <li><p>
200224
@ Every user, logged in or not, inherits the privileges of
@@ -226,20 +250,21 @@
226250
@
227251
@ <li><p>The permission flags are as follows:</p>
228252
capabilities_table(CAPCLASS_ALL);
229253
@ </li>
230254
@ </ol>
231
- style_finish_page("setupuser");
255
+ style_finish_page();
232256
}
233257
234258
/*
235259
** WEBPAGE: setup_ucap_list
236260
**
237261
** A documentation page showing the meaning of the various user capabilities
238262
** code letters.
239263
*/
240264
void setup_ucap_list(void){
265
+ style_set_current_feature("setup");
241266
style_header("User Capability Codes");
242267
@ <h1>All capabilities</h1>
243268
capabilities_table(CAPCLASS_ALL);
244269
@ <h1>Capabilities associated with checked-in content</h1>
245270
capabilities_table(CAPCLASS_CODE);
@@ -253,11 +278,11 @@
253278
capabilities_table(CAPCLASS_WIKI);
254279
@ <h1>Administrative capabilities</h1>
255280
capabilities_table(CAPCLASS_SUPER);
256281
@ <h1>Miscellaneous capabilities</h1>
257282
capabilities_table(CAPCLASS_OTHER);
258
- style_finish_page("setupuser");
283
+ style_finish_page();
259284
}
260285
261286
/*
262287
** Return true if zPw is a valid password string. A valid
263288
** password string is:
@@ -341,10 +366,12 @@
341366
"User \"%s\" has %d or more artifacts in the block-chain. "
342367
"Delete anyhow?",
343368
P("login")/*safe-for-%s*/, n);
344369
}
345370
}
371
+
372
+ style_set_current_feature("setup");
346373
347374
/* If we have all the necessary information, write the new or
348375
** modified user record. After writing the user record, redirect
349376
** to the page that displays a list of users.
350377
*/
@@ -387,11 +414,11 @@
387414
style_header("User Creation Error");
388415
@ <span class="loginError">Empty login not allowed.</span>
389416
@
390417
@ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
391418
@ [Bummer]</a></p>
392
- style_finish_page("setupuser");
419
+ style_finish_page();
393420
return;
394421
}
395422
if( isValidPwString(zPw) ){
396423
zPw = sha1_shared_secret(zPw, zLogin, 0);
397424
}else{
@@ -404,11 +431,11 @@
404431
@ <span class="loginError">Login "%h(zLogin)" is already used by
405432
@ a different user.</span>
406433
@
407434
@ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
408435
@ [Bummer]</a></p>
409
- style_finish_page("setupuser");
436
+ style_finish_page();
410437
return;
411438
}
412439
login_verify_csrf_secret();
413440
db_unprotect(PROTECT_USER);
414441
db_multi_exec(
@@ -456,11 +483,11 @@
456483
admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
457484
@ <span class="loginError">%h(zErr)</span>
458485
@
459486
@ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
460487
@ [Bummer]</a></p>
461
- style_finish_page("setupuser");
488
+ style_finish_page();
462489
return;
463490
}
464491
}
465492
cgi_redirect(cgi_referer("setup_ulist"));
466493
return;
@@ -654,10 +681,12 @@
654681
@ Supervise Forum%s(B('6'))</label>
655682
@ <li><label><input type="checkbox" name="a7"%s(oa['7']) />
656683
@ Email Alerts%s(B('7'))</label>
657684
@ <li><label><input type="checkbox" name="aA"%s(oa['A']) />
658685
@ Send Announcements%s(B('A'))</label>
686
+ @ <li><label><input type="checkbox" name="aC"%s(oa['C']) />
687
+ @ Chatroom%s(B('C'))</label>
659688
@ <li><label><input type="checkbox" name="aD"%s(oa['D']) />
660689
@ Enable Debug%s(B('D'))</label>
661690
@ </ul></div>
662691
@ </td>
663692
@ </tr>
@@ -675,12 +704,13 @@
675704
/* Obscure the password for all users */
676705
@ <td><input aria-labelledby="supw" type="password" autocomplete="off" \
677706
@ name="pw" value="**********" /></td>
678707
}else{
679708
/* Show an empty password as an empty input field */
709
+ char *zRPW = fossil_random_password(12);
680710
@ <td><input aria-labelledby="supw" type="password" name="pw" \
681
- @ autocomplete="off" value="" /></td>
711
+ @ autocomplete="off" value="" /> Password suggestion: %z(zRPW)</td>
682712
}
683713
@ </tr>
684714
}
685715
zGroup = login_group_name();
686716
if( zGroup ){
@@ -874,7 +904,7 @@
874904
@ template for users who are allowed more access than
875905
@ <span class="usertype">anonymous</span>,
876906
@ but less than a <span class="usertype">developer</span>.
877907
@ </p></li>
878908
@ </ul>
879
- style_finish_page("setupuser");
909
+ style_finish_page();
880910
}
881911
--- src/setupuser.c
+++ src/setupuser.c
@@ -16,10 +16,13 @@
16 *******************************************************************************
17 **
18 ** Setup pages associated with user management. The code in this
19 ** file was formerly part of the "setup.c" module, but has been broken
20 ** out into its own module to improve maintainability.
 
 
 
21 */
22 #include "config.h"
23 #include <assert.h>
24 #include "setupuser.h"
25
@@ -49,10 +52,11 @@
49 style_submenu_element("Log", "access_log");
50 style_submenu_element("Help", "setup_ulist_notes");
51 if( alert_tables_exist() ){
52 style_submenu_element("Subscribers", "subscribers");
53 }
 
54 style_header("User List");
55 if( (zWith==0 || zWith[0]==0) && !bUnusedOnly ){
56 @ <table border=1 cellpadding=2 cellspacing=0 class='userTable'>
57 @ <thead><tr>
58 @ <th>Category
@@ -109,13 +113,14 @@
109 }
110 if( !bUnusedOnly ){
111 style_submenu_element("Unused", "setup_ulist?unused");
112 }
113 @ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \
114 @ data-column-types='ktxTTK' data-init-sort='2'>
115 @ <thead><tr>
116 @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead>
 
117 @ <tbody>
118 db_multi_exec(
119 "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL)"
120 "WITHOUT ROWID;"
121 );
@@ -127,10 +132,16 @@
127 " UNION ALL"
128 " SELECT login AS uname, rcvfrom.mtime AS mtime"
129 " FROM rcvfrom JOIN user USING(uid))"
130 " GROUP BY 1;"
131 );
 
 
 
 
 
 
132 }
133 if( bUnusedOnly ){
134 zWith = mprintf(
135 " AND login NOT IN ("
136 "SELECT user FROM event WHERE user NOT NULL "
@@ -142,17 +153,19 @@
142 zWith = mprintf(" AND fullcap(cap) GLOB '*[%q]*'", zWith);
143 }else{
144 zWith = "";
145 }
146 db_prepare(&s,
147 "SELECT uid, login, cap, info, date(mtime,'unixepoch'),"
148 " lower(login) AS sortkey, "
149 " CASE WHEN info LIKE '%%expires 20%%'"
150 " THEN substr(info,instr(lower(info),'expires')+8,10)"
151 " END AS exp,"
152 "atime"
 
153 " FROM user LEFT JOIN lastAccess ON login=uname"
 
154 " WHERE login NOT IN ('anonymous','nobody','developer','reader') %s"
155 " ORDER BY sortkey", zWith/*safe-for-%s*/
156 );
157 rNow = db_double(0.0, "SELECT julianday('now');");
158 while( db_step(&s)==SQLITE_ROW ){
@@ -163,10 +176,12 @@
163 const char *zDate = db_column_text(&s, 4);
164 const char *zSortKey = db_column_text(&s,5);
165 const char *zExp = db_column_text(&s,6);
166 double rATime = db_column_double(&s,7);
167 char *zAge = 0;
 
 
168 if( rATime>0.0 ){
169 zAge = human_readable_age(rNow - rATime);
170 }
171 @ <tr>
172 @ <td data-sortkey='%h(zSortKey)'>\
@@ -174,17 +189,25 @@
174 @ <td>%h(zCap)
175 @ <td>%h(zInfo)
176 @ <td>%h(zDate?zDate:"")
177 @ <td>%h(zExp?zExp:"")
178 @ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
 
 
 
 
 
 
 
 
179 @ </tr>
180 fossil_free(zAge);
181 }
182 @ </tbody></table>
183 db_finalize(&s);
184 style_table_sorter();
185 style_finish_page("setupuser");
186 }
187
188 /*
189 ** WEBPAGE: setup_ulist_notes
190 **
@@ -191,10 +214,11 @@
191 ** A documentation page showing notes about user configuration. This
192 ** information used to be a side-bar on the user list page, but has been
193 ** factored out for improved presentation.
194 */
195 void setup_ulist_notes(void){
 
196 style_header("User Configuration Notes");
197 @ <h1>User Configuration Notes:</h1>
198 @ <ol>
199 @ <li><p>
200 @ Every user, logged in or not, inherits the privileges of
@@ -226,20 +250,21 @@
226 @
227 @ <li><p>The permission flags are as follows:</p>
228 capabilities_table(CAPCLASS_ALL);
229 @ </li>
230 @ </ol>
231 style_finish_page("setupuser");
232 }
233
234 /*
235 ** WEBPAGE: setup_ucap_list
236 **
237 ** A documentation page showing the meaning of the various user capabilities
238 ** code letters.
239 */
240 void setup_ucap_list(void){
 
241 style_header("User Capability Codes");
242 @ <h1>All capabilities</h1>
243 capabilities_table(CAPCLASS_ALL);
244 @ <h1>Capabilities associated with checked-in content</h1>
245 capabilities_table(CAPCLASS_CODE);
@@ -253,11 +278,11 @@
253 capabilities_table(CAPCLASS_WIKI);
254 @ <h1>Administrative capabilities</h1>
255 capabilities_table(CAPCLASS_SUPER);
256 @ <h1>Miscellaneous capabilities</h1>
257 capabilities_table(CAPCLASS_OTHER);
258 style_finish_page("setupuser");
259 }
260
261 /*
262 ** Return true if zPw is a valid password string. A valid
263 ** password string is:
@@ -341,10 +366,12 @@
341 "User \"%s\" has %d or more artifacts in the block-chain. "
342 "Delete anyhow?",
343 P("login")/*safe-for-%s*/, n);
344 }
345 }
 
 
346
347 /* If we have all the necessary information, write the new or
348 ** modified user record. After writing the user record, redirect
349 ** to the page that displays a list of users.
350 */
@@ -387,11 +414,11 @@
387 style_header("User Creation Error");
388 @ <span class="loginError">Empty login not allowed.</span>
389 @
390 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
391 @ [Bummer]</a></p>
392 style_finish_page("setupuser");
393 return;
394 }
395 if( isValidPwString(zPw) ){
396 zPw = sha1_shared_secret(zPw, zLogin, 0);
397 }else{
@@ -404,11 +431,11 @@
404 @ <span class="loginError">Login "%h(zLogin)" is already used by
405 @ a different user.</span>
406 @
407 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
408 @ [Bummer]</a></p>
409 style_finish_page("setupuser");
410 return;
411 }
412 login_verify_csrf_secret();
413 db_unprotect(PROTECT_USER);
414 db_multi_exec(
@@ -456,11 +483,11 @@
456 admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
457 @ <span class="loginError">%h(zErr)</span>
458 @
459 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
460 @ [Bummer]</a></p>
461 style_finish_page("setupuser");
462 return;
463 }
464 }
465 cgi_redirect(cgi_referer("setup_ulist"));
466 return;
@@ -654,10 +681,12 @@
654 @ Supervise Forum%s(B('6'))</label>
655 @ <li><label><input type="checkbox" name="a7"%s(oa['7']) />
656 @ Email Alerts%s(B('7'))</label>
657 @ <li><label><input type="checkbox" name="aA"%s(oa['A']) />
658 @ Send Announcements%s(B('A'))</label>
 
 
659 @ <li><label><input type="checkbox" name="aD"%s(oa['D']) />
660 @ Enable Debug%s(B('D'))</label>
661 @ </ul></div>
662 @ </td>
663 @ </tr>
@@ -675,12 +704,13 @@
675 /* Obscure the password for all users */
676 @ <td><input aria-labelledby="supw" type="password" autocomplete="off" \
677 @ name="pw" value="**********" /></td>
678 }else{
679 /* Show an empty password as an empty input field */
 
680 @ <td><input aria-labelledby="supw" type="password" name="pw" \
681 @ autocomplete="off" value="" /></td>
682 }
683 @ </tr>
684 }
685 zGroup = login_group_name();
686 if( zGroup ){
@@ -874,7 +904,7 @@
874 @ template for users who are allowed more access than
875 @ <span class="usertype">anonymous</span>,
876 @ but less than a <span class="usertype">developer</span>.
877 @ </p></li>
878 @ </ul>
879 style_finish_page("setupuser");
880 }
881
--- src/setupuser.c
+++ src/setupuser.c
@@ -16,10 +16,13 @@
16 *******************************************************************************
17 **
18 ** Setup pages associated with user management. The code in this
19 ** file was formerly part of the "setup.c" module, but has been broken
20 ** out into its own module to improve maintainability.
21 **
22 ** Note: Do not confuse "Users" with "Subscribers". Code to deal with
23 ** subscribers is over in the "alerts.c" source file.
24 */
25 #include "config.h"
26 #include <assert.h>
27 #include "setupuser.h"
28
@@ -49,10 +52,11 @@
52 style_submenu_element("Log", "access_log");
53 style_submenu_element("Help", "setup_ulist_notes");
54 if( alert_tables_exist() ){
55 style_submenu_element("Subscribers", "subscribers");
56 }
57 style_set_current_feature("setup");
58 style_header("User List");
59 if( (zWith==0 || zWith[0]==0) && !bUnusedOnly ){
60 @ <table border=1 cellpadding=2 cellspacing=0 class='userTable'>
61 @ <thead><tr>
62 @ <th>Category
@@ -109,13 +113,14 @@
113 }
114 if( !bUnusedOnly ){
115 style_submenu_element("Unused", "setup_ulist?unused");
116 }
117 @ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \
118 @ data-column-types='ktxTTKt' data-init-sort='2'>
119 @ <thead><tr>
120 @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login\
121 @ <th>Alerts</tr></thead>
122 @ <tbody>
123 db_multi_exec(
124 "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL)"
125 "WITHOUT ROWID;"
126 );
@@ -127,10 +132,16 @@
132 " UNION ALL"
133 " SELECT login AS uname, rcvfrom.mtime AS mtime"
134 " FROM rcvfrom JOIN user USING(uid))"
135 " GROUP BY 1;"
136 );
137 }
138 if( !db_table_exists("repository","subscriber") ){
139 db_multi_exec(
140 "CREATE TEMP TABLE subscriber(suname PRIMARY KEY, ssub, subscriberId)"
141 "WITHOUT ROWID;"
142 );
143 }
144 if( bUnusedOnly ){
145 zWith = mprintf(
146 " AND login NOT IN ("
147 "SELECT user FROM event WHERE user NOT NULL "
@@ -142,17 +153,19 @@
153 zWith = mprintf(" AND fullcap(cap) GLOB '*[%q]*'", zWith);
154 }else{
155 zWith = "";
156 }
157 db_prepare(&s,
158 "SELECT uid, login, cap, info, date(user.mtime,'unixepoch'),"
159 " lower(login) AS sortkey, "
160 " CASE WHEN info LIKE '%%expires 20%%'"
161 " THEN substr(info,instr(lower(info),'expires')+8,10)"
162 " END AS exp,"
163 "atime,"
164 " subscriber.ssub, subscriber.subscriberId"
165 " FROM user LEFT JOIN lastAccess ON login=uname"
166 " LEFT JOIN subscriber ON login=suname"
167 " WHERE login NOT IN ('anonymous','nobody','developer','reader') %s"
168 " ORDER BY sortkey", zWith/*safe-for-%s*/
169 );
170 rNow = db_double(0.0, "SELECT julianday('now');");
171 while( db_step(&s)==SQLITE_ROW ){
@@ -163,10 +176,12 @@
176 const char *zDate = db_column_text(&s, 4);
177 const char *zSortKey = db_column_text(&s,5);
178 const char *zExp = db_column_text(&s,6);
179 double rATime = db_column_double(&s,7);
180 char *zAge = 0;
181 const char *zSub;
182 int sid = db_column_int(&s,9);
183 if( rATime>0.0 ){
184 zAge = human_readable_age(rNow - rATime);
185 }
186 @ <tr>
187 @ <td data-sortkey='%h(zSortKey)'>\
@@ -174,17 +189,25 @@
189 @ <td>%h(zCap)
190 @ <td>%h(zInfo)
191 @ <td>%h(zDate?zDate:"")
192 @ <td>%h(zExp?zExp:"")
193 @ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
194 if( db_column_type(&s,8)==SQLITE_NULL ){
195 @ <td>
196 }else if( (zSub = db_column_text(&s,8))==0 || zSub[0]==0 ){
197 @ <td><a href="%R/alerts?sid=%d(sid)"><i>off</i></a>
198 }else{
199 @ <td><a href="%R/alerts?sid=%d(sid)">%h(zSub)</a>
200 }
201
202 @ </tr>
203 fossil_free(zAge);
204 }
205 @ </tbody></table>
206 db_finalize(&s);
207 style_table_sorter();
208 style_finish_page();
209 }
210
211 /*
212 ** WEBPAGE: setup_ulist_notes
213 **
@@ -191,10 +214,11 @@
214 ** A documentation page showing notes about user configuration. This
215 ** information used to be a side-bar on the user list page, but has been
216 ** factored out for improved presentation.
217 */
218 void setup_ulist_notes(void){
219 style_set_current_feature("setup");
220 style_header("User Configuration Notes");
221 @ <h1>User Configuration Notes:</h1>
222 @ <ol>
223 @ <li><p>
224 @ Every user, logged in or not, inherits the privileges of
@@ -226,20 +250,21 @@
250 @
251 @ <li><p>The permission flags are as follows:</p>
252 capabilities_table(CAPCLASS_ALL);
253 @ </li>
254 @ </ol>
255 style_finish_page();
256 }
257
258 /*
259 ** WEBPAGE: setup_ucap_list
260 **
261 ** A documentation page showing the meaning of the various user capabilities
262 ** code letters.
263 */
264 void setup_ucap_list(void){
265 style_set_current_feature("setup");
266 style_header("User Capability Codes");
267 @ <h1>All capabilities</h1>
268 capabilities_table(CAPCLASS_ALL);
269 @ <h1>Capabilities associated with checked-in content</h1>
270 capabilities_table(CAPCLASS_CODE);
@@ -253,11 +278,11 @@
278 capabilities_table(CAPCLASS_WIKI);
279 @ <h1>Administrative capabilities</h1>
280 capabilities_table(CAPCLASS_SUPER);
281 @ <h1>Miscellaneous capabilities</h1>
282 capabilities_table(CAPCLASS_OTHER);
283 style_finish_page();
284 }
285
286 /*
287 ** Return true if zPw is a valid password string. A valid
288 ** password string is:
@@ -341,10 +366,12 @@
366 "User \"%s\" has %d or more artifacts in the block-chain. "
367 "Delete anyhow?",
368 P("login")/*safe-for-%s*/, n);
369 }
370 }
371
372 style_set_current_feature("setup");
373
374 /* If we have all the necessary information, write the new or
375 ** modified user record. After writing the user record, redirect
376 ** to the page that displays a list of users.
377 */
@@ -387,11 +414,11 @@
414 style_header("User Creation Error");
415 @ <span class="loginError">Empty login not allowed.</span>
416 @
417 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
418 @ [Bummer]</a></p>
419 style_finish_page();
420 return;
421 }
422 if( isValidPwString(zPw) ){
423 zPw = sha1_shared_secret(zPw, zLogin, 0);
424 }else{
@@ -404,11 +431,11 @@
431 @ <span class="loginError">Login "%h(zLogin)" is already used by
432 @ a different user.</span>
433 @
434 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
435 @ [Bummer]</a></p>
436 style_finish_page();
437 return;
438 }
439 login_verify_csrf_secret();
440 db_unprotect(PROTECT_USER);
441 db_multi_exec(
@@ -456,11 +483,11 @@
483 admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
484 @ <span class="loginError">%h(zErr)</span>
485 @
486 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
487 @ [Bummer]</a></p>
488 style_finish_page();
489 return;
490 }
491 }
492 cgi_redirect(cgi_referer("setup_ulist"));
493 return;
@@ -654,10 +681,12 @@
681 @ Supervise Forum%s(B('6'))</label>
682 @ <li><label><input type="checkbox" name="a7"%s(oa['7']) />
683 @ Email Alerts%s(B('7'))</label>
684 @ <li><label><input type="checkbox" name="aA"%s(oa['A']) />
685 @ Send Announcements%s(B('A'))</label>
686 @ <li><label><input type="checkbox" name="aC"%s(oa['C']) />
687 @ Chatroom%s(B('C'))</label>
688 @ <li><label><input type="checkbox" name="aD"%s(oa['D']) />
689 @ Enable Debug%s(B('D'))</label>
690 @ </ul></div>
691 @ </td>
692 @ </tr>
@@ -675,12 +704,13 @@
704 /* Obscure the password for all users */
705 @ <td><input aria-labelledby="supw" type="password" autocomplete="off" \
706 @ name="pw" value="**********" /></td>
707 }else{
708 /* Show an empty password as an empty input field */
709 char *zRPW = fossil_random_password(12);
710 @ <td><input aria-labelledby="supw" type="password" name="pw" \
711 @ autocomplete="off" value="" /> Password suggestion: %z(zRPW)</td>
712 }
713 @ </tr>
714 }
715 zGroup = login_group_name();
716 if( zGroup ){
@@ -874,7 +904,7 @@
904 @ template for users who are allowed more access than
905 @ <span class="usertype">anonymous</span>,
906 @ but less than a <span class="usertype">developer</span>.
907 @ </p></li>
908 @ </ul>
909 style_finish_page();
910 }
911
+91 -56
--- src/shell.c
+++ src/shell.c
@@ -1422,11 +1422,14 @@
14221422
/* #include "sqlite3ext.h" */
14231423
SQLITE_EXTENSION_INIT1
14241424
#include <assert.h>
14251425
#include <string.h>
14261426
#include <stdarg.h>
1427
+
1428
+#ifndef SQLITE_AMALGAMATION
14271429
/* typedef sqlite3_uint64 u64; */
1430
+#endif /* SQLITE_AMALGAMATION */
14281431
14291432
/******************************************************************************
14301433
** The Hash Engine
14311434
*/
14321435
/*
@@ -2012,13 +2015,15 @@
20122015
sqlite3_free(zMsg);
20132016
return;
20142017
}
20152018
nCol = sqlite3_column_count(pStmt);
20162019
z = sqlite3_sql(pStmt);
2017
- n = (int)strlen(z);
2018
- hash_step_vformat(&cx,"S%d:",n);
2019
- SHA3Update(&cx,(unsigned char*)z,n);
2020
+ if( z ){
2021
+ n = (int)strlen(z);
2022
+ hash_step_vformat(&cx,"S%d:",n);
2023
+ SHA3Update(&cx,(unsigned char*)z,n);
2024
+ }
20202025
20212026
/* Compute a hash over the result of the query */
20222027
while( SQLITE_ROW==sqlite3_step(pStmt) ){
20232028
SHA3Update(&cx,(const unsigned char*)"R",1);
20242029
for(i=0; i<nCol; i++){
@@ -5561,11 +5566,12 @@
55615566
** 1: start=VALUE
55625567
** 2: stop=VALUE
55635568
** 4: step=VALUE
55645569
**
55655570
** Also, if bit 8 is set, that means that the series should be output
5566
-** in descending order rather than in ascending order.
5571
+** in descending order rather than in ascending order. If bit 16 is
5572
+** set, then output must appear in ascending order.
55675573
**
55685574
** This routine should initialize the cursor and position it so that it
55695575
** is pointing at the first row, or pointing off the end of the table
55705576
** (so that seriesEof() will return true) if the table is empty.
55715577
*/
@@ -5587,11 +5593,16 @@
55875593
}else{
55885594
pCur->mxValue = 0xffffffff;
55895595
}
55905596
if( idxNum & 4 ){
55915597
pCur->iStep = sqlite3_value_int64(argv[i++]);
5592
- if( pCur->iStep<1 ) pCur->iStep = 1;
5598
+ if( pCur->iStep==0 ){
5599
+ pCur->iStep = 1;
5600
+ }else if( pCur->iStep<0 ){
5601
+ pCur->iStep = -pCur->iStep;
5602
+ if( (idxNum & 16)==0 ) idxNum |= 8;
5603
+ }
55935604
}else{
55945605
pCur->iStep = 1;
55955606
}
55965607
for(i=0; i<argc; i++){
55975608
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
@@ -5681,11 +5692,15 @@
56815692
/* Both start= and stop= boundaries are available. This is the
56825693
** the preferred case */
56835694
pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
56845695
pIdxInfo->estimatedRows = 1000;
56855696
if( pIdxInfo->nOrderBy==1 ){
5686
- if( pIdxInfo->aOrderBy[0].desc ) idxNum |= 8;
5697
+ if( pIdxInfo->aOrderBy[0].desc ){
5698
+ idxNum |= 8;
5699
+ }else{
5700
+ idxNum |= 16;
5701
+ }
56875702
pIdxInfo->orderByConsumed = 1;
56885703
}
56895704
}else{
56905705
/* If either boundary is missing, we have to generate a huge span
56915706
** of numbers. Make this case very expensive so that the query
@@ -8932,11 +8947,11 @@
89328947
IdxTable *pNew = 0;
89338948
int rc, rc2;
89348949
char *pCsr = 0;
89358950
int nPk = 0;
89368951
8937
- rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_info=%Q", zTab);
8952
+ rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
89388953
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
89398954
const char *zCol = (const char*)sqlite3_column_text(p1, 1);
89408955
nByte += 1 + STRLEN(zCol);
89418956
rc = sqlite3_table_column_metadata(
89428957
db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
@@ -9966,14 +9981,16 @@
99669981
99679982
idxFinalize(&rc, pAllIndex);
99689983
idxFinalize(&rc, pIndexXInfo);
99699984
idxFinalize(&rc, pWrite);
99709985
9971
- for(i=0; i<pCtx->nSlot; i++){
9972
- sqlite3_free(pCtx->aSlot[i].z);
9986
+ if( pCtx ){
9987
+ for(i=0; i<pCtx->nSlot; i++){
9988
+ sqlite3_free(pCtx->aSlot[i].z);
9989
+ }
9990
+ sqlite3_free(pCtx);
99739991
}
9974
- sqlite3_free(pCtx);
99759992
99769993
if( rc==SQLITE_OK ){
99779994
rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
99789995
}
99799996
@@ -11110,16 +11127,16 @@
1111011127
sqlite3 *db; /* The database */
1111111128
u8 autoExplain; /* Automatically turn on .explain mode */
1111211129
u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
1111311130
u8 autoEQPtest; /* autoEQP is in test mode */
1111411131
u8 autoEQPtrace; /* autoEQP is in trace mode */
11115
- u8 statsOn; /* True to display memory stats before each finalize */
1111611132
u8 scanstatsOn; /* True to display scan stats before each finalize */
1111711133
u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
1111811134
u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
1111911135
u8 nEqpLevel; /* Depth of the EQP output graph */
1112011136
u8 eTraceType; /* SHELL_TRACE_* value for type of trace */
11137
+ unsigned statsOn; /* True to display memory stats before each finalize */
1112111138
unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */
1112211139
int outCount; /* Revert to stdout when reaching zero */
1112311140
int cnt; /* Number of records displayed so far */
1112411141
int lineno; /* Line number of last line read from in */
1112511142
int openFlags; /* Additional flags to open. (SQLITE_OPEN_NOFOLLOW) */
@@ -12052,10 +12069,11 @@
1205212069
}
1205312070
}
1205412071
if( azArg==0 ) break;
1205512072
for(i=0; i<nArg; i++){
1205612073
int w = aExplainWidth[i];
12074
+ if( i==nArg-1 ) w = 0;
1205712075
if( azArg[i] && strlenChar(azArg[i])>w ){
1205812076
w = strlenChar(azArg[i]);
1205912077
}
1206012078
if( i==1 && p->aiIndent && p->pStmt ){
1206112079
if( p->iIndent<p->nIndent ){
@@ -12616,11 +12634,11 @@
1261612634
int iHiwtr;
1261712635
FILE *out;
1261812636
if( pArg==0 || pArg->out==0 ) return 0;
1261912637
out = pArg->out;
1262012638
12621
- if( pArg->pStmt && (pArg->statsOn & 2) ){
12639
+ if( pArg->pStmt && pArg->statsOn==2 ){
1262212640
int nCol, i, x;
1262312641
sqlite3_stmt *pStmt = pArg->pStmt;
1262412642
char z[100];
1262512643
nCol = sqlite3_column_count(pStmt);
1262612644
raw_printf(out, "%-36s %d\n", "Number of output columns:", nCol);
@@ -12639,10 +12657,18 @@
1263912657
sqlite3_snprintf(30, z+x, "origin name:");
1264012658
utf8_printf(out, "%-36s %s\n", z, sqlite3_column_origin_name(pStmt,i));
1264112659
#endif
1264212660
}
1264312661
}
12662
+
12663
+ if( pArg->statsOn==3 ){
12664
+ if( pArg->pStmt ){
12665
+ iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
12666
+ raw_printf(pArg->out, "VM-steps: %d\n", iCur);
12667
+ }
12668
+ return 0;
12669
+ }
1264412670
1264512671
displayStatLine(pArg, "Memory Used:",
1264612672
"%lld (max %lld) bytes", SQLITE_STATUS_MEMORY_USED, bReset);
1264712673
displayStatLine(pArg, "Number of Outstanding Allocations:",
1264812674
"%lld (max %lld)", SQLITE_STATUS_MALLOC_COUNT, bReset);
@@ -12906,35 +12932,22 @@
1290612932
}
1290712933
1290812934
/*
1290912935
** Disable and restore .wheretrace and .selecttrace settings.
1291012936
*/
12911
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
12912
-extern unsigned int sqlite3_unsupported_selecttrace;
12913
-static int savedSelectTrace;
12914
-#endif
12915
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
12916
-extern int sqlite3WhereTrace;
12917
-static int savedWhereTrace;
12918
-#endif
12937
+static unsigned int savedSelectTrace;
12938
+static unsigned int savedWhereTrace;
1291912939
static void disable_debug_trace_modes(void){
12920
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
12921
- savedSelectTrace = sqlite3_unsupported_selecttrace;
12922
- sqlite3_unsupported_selecttrace = 0;
12923
-#endif
12924
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
12925
- savedWhereTrace = sqlite3WhereTrace;
12926
- sqlite3WhereTrace = 0;
12927
-#endif
12940
+ unsigned int zero = 0;
12941
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 0, &savedSelectTrace);
12942
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &zero);
12943
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 2, &savedWhereTrace);
12944
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &zero);
1292812945
}
1292912946
static void restore_debug_trace_modes(void){
12930
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
12931
- sqlite3_unsupported_selecttrace = savedSelectTrace;
12932
-#endif
12933
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
12934
- sqlite3WhereTrace = savedWhereTrace;
12935
-#endif
12947
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &savedSelectTrace);
12948
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &savedWhereTrace);
1293612949
}
1293712950
1293812951
/* Create the TEMP table used to store parameter bindings */
1293912952
static void bind_table_init(ShellState *p){
1294012953
int wrSchema = 0;
@@ -14085,11 +14098,15 @@
1408514098
" Any other argument is a LIKE pattern for tables to hash",
1408614099
#ifndef SQLITE_NOHAVE_SYSTEM
1408714100
".shell CMD ARGS... Run CMD ARGS... in a system shell",
1408814101
#endif
1408914102
".show Show the current values for various settings",
14090
- ".stats ?on|off? Show stats or turn stats on or off",
14103
+ ".stats ?ARG? Show stats or turn stats on or off",
14104
+ " off Turn off automatic stat display",
14105
+ " on Turn on automatic stat display",
14106
+ " stmt Show statement stats",
14107
+ " vmstep Show the virtual machine step count only",
1409114108
#ifndef SQLITE_NOHAVE_SYSTEM
1409214109
".system CMD ARGS... Run CMD ARGS... in a system shell",
1409314110
#endif
1409414111
".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
1409514112
".testcase NAME Begin redirecting output to 'testcase-out.txt'",
@@ -17901,20 +17918,21 @@
1790117918
static const struct {
1790217919
const char *zCtrlName; /* Name of a test-control option */
1790317920
int ctrlCode; /* Integer code for that option */
1790417921
const char *zUsage; /* Usage notes */
1790517922
} aCtrl[] = {
17906
- { "size_limit", SQLITE_FCNTL_SIZE_LIMIT, "[LIMIT]" },
1790717923
{ "chunk_size", SQLITE_FCNTL_CHUNK_SIZE, "SIZE" },
17908
- /* { "win32_av_retry", SQLITE_FCNTL_WIN32_AV_RETRY, "COUNT DELAY" },*/
17909
- { "persist_wal", SQLITE_FCNTL_PERSIST_WAL, "[BOOLEAN]" },
17910
- { "psow", SQLITE_FCNTL_POWERSAFE_OVERWRITE, "[BOOLEAN]" },
17911
- /* { "pragma", SQLITE_FCNTL_PRAGMA, "NAME ARG" },*/
17912
- { "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" },
17924
+ { "data_version", SQLITE_FCNTL_DATA_VERSION, "" },
1791317925
{ "has_moved", SQLITE_FCNTL_HAS_MOVED, "" },
1791417926
{ "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" },
17927
+ { "persist_wal", SQLITE_FCNTL_PERSIST_WAL, "[BOOLEAN]" },
17928
+ /* { "pragma", SQLITE_FCNTL_PRAGMA, "NAME ARG" },*/
17929
+ { "psow", SQLITE_FCNTL_POWERSAFE_OVERWRITE, "[BOOLEAN]" },
1791517930
{ "reserve_bytes", SQLITE_FCNTL_RESERVE_BYTES, "[N]" },
17931
+ { "size_limit", SQLITE_FCNTL_SIZE_LIMIT, "[LIMIT]" },
17932
+ { "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" },
17933
+ /* { "win32_av_retry", SQLITE_FCNTL_WIN32_AV_RETRY, "COUNT DELAY" },*/
1791617934
};
1791717935
int filectrl = -1;
1791817936
int iCtrl = -1;
1791917937
sqlite3_int64 iRes = 0; /* Integer result to display if rc2==1 */
1792017938
int isOk = 0; /* 0: usage 1: %lld 2: no-result */
@@ -17997,10 +18015,11 @@
1799718015
sqlite3_file_control(p->db, zSchema, filectrl, &x);
1799818016
iRes = x;
1799918017
isOk = 1;
1800018018
break;
1800118019
}
18020
+ case SQLITE_FCNTL_DATA_VERSION:
1800218021
case SQLITE_FCNTL_HAS_MOVED: {
1800318022
int x;
1800418023
if( nArg!=2 ) break;
1800518024
sqlite3_file_control(p->db, zSchema, filectrl, &x);
1800618025
iRes = x;
@@ -18705,13 +18724,13 @@
1870518724
}
1870618725
}else
1870718726
#endif /* SQLITE_DEBUG */
1870818727
1870918728
if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
18710
- char *zNewFilename; /* Name of the database file to open */
18711
- int iName = 1; /* Index in azArg[] of the filename */
18712
- int newFlag = 0; /* True to delete file before opening */
18729
+ char *zNewFilename = 0; /* Name of the database file to open */
18730
+ int iName = 1; /* Index in azArg[] of the filename */
18731
+ int newFlag = 0; /* True to delete file before opening */
1871318732
/* Close the existing database */
1871418733
session_close_all(p);
1871518734
close_db(p->db);
1871618735
p->db = 0;
1871718736
p->zDbFilename = 0;
@@ -18719,11 +18738,11 @@
1871918738
p->zFreeOnClose = 0;
1872018739
p->openMode = SHELL_OPEN_UNSPEC;
1872118740
p->openFlags = 0;
1872218741
p->szMax = 0;
1872318742
/* Check for command-line arguments */
18724
- for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
18743
+ for(iName=1; iName<nArg; iName++){
1872518744
const char *z = azArg[iName];
1872618745
if( optionMatch(z,"new") ){
1872718746
newFlag = 1;
1872818747
#ifdef SQLITE_HAVE_ZLIB
1872918748
}else if( optionMatch(z, "zip") ){
@@ -18745,14 +18764,19 @@
1874518764
#endif /* SQLITE_ENABLE_DESERIALIZE */
1874618765
}else if( z[0]=='-' ){
1874718766
utf8_printf(stderr, "unknown option: %s\n", z);
1874818767
rc = 1;
1874918768
goto meta_command_exit;
18769
+ }else if( zNewFilename ){
18770
+ utf8_printf(stderr, "extra argument: \"%s\"\n", z);
18771
+ rc = 1;
18772
+ goto meta_command_exit;
18773
+ }else{
18774
+ zNewFilename = sqlite3_mprintf("%s", z);
1875018775
}
1875118776
}
1875218777
/* If a filename is specified, try to open it first */
18753
- zNewFilename = nArg>iName ? sqlite3_mprintf("%s", azArg[iName]) : 0;
1875418778
if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
1875518779
if( newFlag ) shellDeleteFile(zNewFilename);
1875618780
p->zDbFilename = zNewFilename;
1875718781
open_db(p, OPEN_DB_KEEPALIVE);
1875818782
if( p->db==0 ){
@@ -19271,15 +19295,14 @@
1927119295
}else{
1927219296
rc = 0;
1927319297
}
1927419298
}else
1927519299
19276
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
1927719300
if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
19278
- sqlite3_unsupported_selecttrace = nArg>=2 ? (int)integerValue(azArg[1]) : 0xffff;
19301
+ unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
19302
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &x);
1927919303
}else
19280
-#endif
1928119304
1928219305
#if defined(SQLITE_ENABLE_SESSION)
1928319306
if( c=='s' && strncmp(azArg[0],"session",n)==0 && n>=3 ){
1928419307
OpenSession *pSession = &p->aSession[0];
1928519308
char **azCmd = &azArg[1];
@@ -19756,10 +19779,11 @@
1975619779
}else
1975719780
#endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
1975819781
1975919782
if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
1976019783
static const char *azBool[] = { "off", "on", "trigger", "full"};
19784
+ const char *zOut;
1976119785
int i;
1976219786
if( nArg!=1 ){
1976319787
raw_printf(stderr, "Usage: .show\n");
1976419788
rc = 1;
1976519789
goto meta_command_exit;
@@ -19780,11 +19804,17 @@
1978019804
output_c_string(p->out, p->colSeparator);
1978119805
raw_printf(p->out, "\n");
1978219806
utf8_printf(p->out,"%12.12s: ", "rowseparator");
1978319807
output_c_string(p->out, p->rowSeparator);
1978419808
raw_printf(p->out, "\n");
19785
- utf8_printf(p->out, "%12.12s: %s\n","stats", azBool[p->statsOn!=0]);
19809
+ switch( p->statsOn ){
19810
+ case 0: zOut = "off"; break;
19811
+ default: zOut = "on"; break;
19812
+ case 2: zOut = "stmt"; break;
19813
+ case 3: zOut = "vmstep"; break;
19814
+ }
19815
+ utf8_printf(p->out, "%12.12s: %s\n","stats", zOut);
1978619816
utf8_printf(p->out, "%12.12s: ", "width");
1978719817
for (i=0;i<p->nWidth;i++) {
1978819818
raw_printf(p->out, "%d ", p->colWidth[i]);
1978919819
}
1979019820
raw_printf(p->out, "\n");
@@ -19792,15 +19822,21 @@
1979219822
p->zDbFilename ? p->zDbFilename : "");
1979319823
}else
1979419824
1979519825
if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){
1979619826
if( nArg==2 ){
19797
- p->statsOn = (u8)booleanValue(azArg[1]);
19827
+ if( strcmp(azArg[1],"stmt")==0 ){
19828
+ p->statsOn = 2;
19829
+ }else if( strcmp(azArg[1],"vmstep")==0 ){
19830
+ p->statsOn = 3;
19831
+ }else{
19832
+ p->statsOn = (u8)booleanValue(azArg[1]);
19833
+ }
1979819834
}else if( nArg==1 ){
1979919835
display_stats(p->db, p, 0);
1980019836
}else{
19801
- raw_printf(stderr, "Usage: .stats ?on|off?\n");
19837
+ raw_printf(stderr, "Usage: .stats ?on|off|stmt|vmstep?\n");
1980219838
rc = 1;
1980319839
}
1980419840
}else
1980519841
1980619842
if( (c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0)
@@ -20001,11 +20037,11 @@
2000120037
switch(testctrl){
2000220038
2000320039
/* sqlite3_test_control(int, db, int) */
2000420040
case SQLITE_TESTCTRL_OPTIMIZATIONS:
2000520041
if( nArg==3 ){
20006
- int opt = (int)strtol(azArg[2], 0, 0);
20042
+ unsigned int opt = (unsigned int)strtol(azArg[2], 0, 0);
2000720043
rc2 = sqlite3_test_control(testctrl, p->db, opt);
2000820044
isOk = 3;
2000920045
}
2001020046
break;
2001120047
@@ -20330,15 +20366,14 @@
2033020366
sqlite3_free(zVfsName);
2033120367
}
2033220368
}
2033320369
}else
2033420370
20335
-#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
2033620371
if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
20337
- sqlite3WhereTrace = nArg>=2 ? booleanValue(azArg[1]) : 0xff;
20372
+ unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
20373
+ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &x);
2033820374
}else
20339
-#endif
2034020375
2034120376
if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
2034220377
int j;
2034320378
assert( nArg<=ArraySize(azArg) );
2034420379
p->nWidth = nArg-1;
2034520380
--- src/shell.c
+++ src/shell.c
@@ -1422,11 +1422,14 @@
1422 /* #include "sqlite3ext.h" */
1423 SQLITE_EXTENSION_INIT1
1424 #include <assert.h>
1425 #include <string.h>
1426 #include <stdarg.h>
 
 
1427 /* typedef sqlite3_uint64 u64; */
 
1428
1429 /******************************************************************************
1430 ** The Hash Engine
1431 */
1432 /*
@@ -2012,13 +2015,15 @@
2012 sqlite3_free(zMsg);
2013 return;
2014 }
2015 nCol = sqlite3_column_count(pStmt);
2016 z = sqlite3_sql(pStmt);
2017 n = (int)strlen(z);
2018 hash_step_vformat(&cx,"S%d:",n);
2019 SHA3Update(&cx,(unsigned char*)z,n);
 
 
2020
2021 /* Compute a hash over the result of the query */
2022 while( SQLITE_ROW==sqlite3_step(pStmt) ){
2023 SHA3Update(&cx,(const unsigned char*)"R",1);
2024 for(i=0; i<nCol; i++){
@@ -5561,11 +5566,12 @@
5561 ** 1: start=VALUE
5562 ** 2: stop=VALUE
5563 ** 4: step=VALUE
5564 **
5565 ** Also, if bit 8 is set, that means that the series should be output
5566 ** in descending order rather than in ascending order.
 
5567 **
5568 ** This routine should initialize the cursor and position it so that it
5569 ** is pointing at the first row, or pointing off the end of the table
5570 ** (so that seriesEof() will return true) if the table is empty.
5571 */
@@ -5587,11 +5593,16 @@
5587 }else{
5588 pCur->mxValue = 0xffffffff;
5589 }
5590 if( idxNum & 4 ){
5591 pCur->iStep = sqlite3_value_int64(argv[i++]);
5592 if( pCur->iStep<1 ) pCur->iStep = 1;
 
 
 
 
 
5593 }else{
5594 pCur->iStep = 1;
5595 }
5596 for(i=0; i<argc; i++){
5597 if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
@@ -5681,11 +5692,15 @@
5681 /* Both start= and stop= boundaries are available. This is the
5682 ** the preferred case */
5683 pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
5684 pIdxInfo->estimatedRows = 1000;
5685 if( pIdxInfo->nOrderBy==1 ){
5686 if( pIdxInfo->aOrderBy[0].desc ) idxNum |= 8;
 
 
 
 
5687 pIdxInfo->orderByConsumed = 1;
5688 }
5689 }else{
5690 /* If either boundary is missing, we have to generate a huge span
5691 ** of numbers. Make this case very expensive so that the query
@@ -8932,11 +8947,11 @@
8932 IdxTable *pNew = 0;
8933 int rc, rc2;
8934 char *pCsr = 0;
8935 int nPk = 0;
8936
8937 rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_info=%Q", zTab);
8938 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
8939 const char *zCol = (const char*)sqlite3_column_text(p1, 1);
8940 nByte += 1 + STRLEN(zCol);
8941 rc = sqlite3_table_column_metadata(
8942 db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
@@ -9966,14 +9981,16 @@
9966
9967 idxFinalize(&rc, pAllIndex);
9968 idxFinalize(&rc, pIndexXInfo);
9969 idxFinalize(&rc, pWrite);
9970
9971 for(i=0; i<pCtx->nSlot; i++){
9972 sqlite3_free(pCtx->aSlot[i].z);
 
 
 
9973 }
9974 sqlite3_free(pCtx);
9975
9976 if( rc==SQLITE_OK ){
9977 rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
9978 }
9979
@@ -11110,16 +11127,16 @@
11110 sqlite3 *db; /* The database */
11111 u8 autoExplain; /* Automatically turn on .explain mode */
11112 u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
11113 u8 autoEQPtest; /* autoEQP is in test mode */
11114 u8 autoEQPtrace; /* autoEQP is in trace mode */
11115 u8 statsOn; /* True to display memory stats before each finalize */
11116 u8 scanstatsOn; /* True to display scan stats before each finalize */
11117 u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
11118 u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
11119 u8 nEqpLevel; /* Depth of the EQP output graph */
11120 u8 eTraceType; /* SHELL_TRACE_* value for type of trace */
 
11121 unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */
11122 int outCount; /* Revert to stdout when reaching zero */
11123 int cnt; /* Number of records displayed so far */
11124 int lineno; /* Line number of last line read from in */
11125 int openFlags; /* Additional flags to open. (SQLITE_OPEN_NOFOLLOW) */
@@ -12052,10 +12069,11 @@
12052 }
12053 }
12054 if( azArg==0 ) break;
12055 for(i=0; i<nArg; i++){
12056 int w = aExplainWidth[i];
 
12057 if( azArg[i] && strlenChar(azArg[i])>w ){
12058 w = strlenChar(azArg[i]);
12059 }
12060 if( i==1 && p->aiIndent && p->pStmt ){
12061 if( p->iIndent<p->nIndent ){
@@ -12616,11 +12634,11 @@
12616 int iHiwtr;
12617 FILE *out;
12618 if( pArg==0 || pArg->out==0 ) return 0;
12619 out = pArg->out;
12620
12621 if( pArg->pStmt && (pArg->statsOn & 2) ){
12622 int nCol, i, x;
12623 sqlite3_stmt *pStmt = pArg->pStmt;
12624 char z[100];
12625 nCol = sqlite3_column_count(pStmt);
12626 raw_printf(out, "%-36s %d\n", "Number of output columns:", nCol);
@@ -12639,10 +12657,18 @@
12639 sqlite3_snprintf(30, z+x, "origin name:");
12640 utf8_printf(out, "%-36s %s\n", z, sqlite3_column_origin_name(pStmt,i));
12641 #endif
12642 }
12643 }
 
 
 
 
 
 
 
 
12644
12645 displayStatLine(pArg, "Memory Used:",
12646 "%lld (max %lld) bytes", SQLITE_STATUS_MEMORY_USED, bReset);
12647 displayStatLine(pArg, "Number of Outstanding Allocations:",
12648 "%lld (max %lld)", SQLITE_STATUS_MALLOC_COUNT, bReset);
@@ -12906,35 +12932,22 @@
12906 }
12907
12908 /*
12909 ** Disable and restore .wheretrace and .selecttrace settings.
12910 */
12911 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
12912 extern unsigned int sqlite3_unsupported_selecttrace;
12913 static int savedSelectTrace;
12914 #endif
12915 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
12916 extern int sqlite3WhereTrace;
12917 static int savedWhereTrace;
12918 #endif
12919 static void disable_debug_trace_modes(void){
12920 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
12921 savedSelectTrace = sqlite3_unsupported_selecttrace;
12922 sqlite3_unsupported_selecttrace = 0;
12923 #endif
12924 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
12925 savedWhereTrace = sqlite3WhereTrace;
12926 sqlite3WhereTrace = 0;
12927 #endif
12928 }
12929 static void restore_debug_trace_modes(void){
12930 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
12931 sqlite3_unsupported_selecttrace = savedSelectTrace;
12932 #endif
12933 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
12934 sqlite3WhereTrace = savedWhereTrace;
12935 #endif
12936 }
12937
12938 /* Create the TEMP table used to store parameter bindings */
12939 static void bind_table_init(ShellState *p){
12940 int wrSchema = 0;
@@ -14085,11 +14098,15 @@
14085 " Any other argument is a LIKE pattern for tables to hash",
14086 #ifndef SQLITE_NOHAVE_SYSTEM
14087 ".shell CMD ARGS... Run CMD ARGS... in a system shell",
14088 #endif
14089 ".show Show the current values for various settings",
14090 ".stats ?on|off? Show stats or turn stats on or off",
 
 
 
 
14091 #ifndef SQLITE_NOHAVE_SYSTEM
14092 ".system CMD ARGS... Run CMD ARGS... in a system shell",
14093 #endif
14094 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
14095 ".testcase NAME Begin redirecting output to 'testcase-out.txt'",
@@ -17901,20 +17918,21 @@
17901 static const struct {
17902 const char *zCtrlName; /* Name of a test-control option */
17903 int ctrlCode; /* Integer code for that option */
17904 const char *zUsage; /* Usage notes */
17905 } aCtrl[] = {
17906 { "size_limit", SQLITE_FCNTL_SIZE_LIMIT, "[LIMIT]" },
17907 { "chunk_size", SQLITE_FCNTL_CHUNK_SIZE, "SIZE" },
17908 /* { "win32_av_retry", SQLITE_FCNTL_WIN32_AV_RETRY, "COUNT DELAY" },*/
17909 { "persist_wal", SQLITE_FCNTL_PERSIST_WAL, "[BOOLEAN]" },
17910 { "psow", SQLITE_FCNTL_POWERSAFE_OVERWRITE, "[BOOLEAN]" },
17911 /* { "pragma", SQLITE_FCNTL_PRAGMA, "NAME ARG" },*/
17912 { "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" },
17913 { "has_moved", SQLITE_FCNTL_HAS_MOVED, "" },
17914 { "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" },
 
 
 
17915 { "reserve_bytes", SQLITE_FCNTL_RESERVE_BYTES, "[N]" },
 
 
 
17916 };
17917 int filectrl = -1;
17918 int iCtrl = -1;
17919 sqlite3_int64 iRes = 0; /* Integer result to display if rc2==1 */
17920 int isOk = 0; /* 0: usage 1: %lld 2: no-result */
@@ -17997,10 +18015,11 @@
17997 sqlite3_file_control(p->db, zSchema, filectrl, &x);
17998 iRes = x;
17999 isOk = 1;
18000 break;
18001 }
 
18002 case SQLITE_FCNTL_HAS_MOVED: {
18003 int x;
18004 if( nArg!=2 ) break;
18005 sqlite3_file_control(p->db, zSchema, filectrl, &x);
18006 iRes = x;
@@ -18705,13 +18724,13 @@
18705 }
18706 }else
18707 #endif /* SQLITE_DEBUG */
18708
18709 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
18710 char *zNewFilename; /* Name of the database file to open */
18711 int iName = 1; /* Index in azArg[] of the filename */
18712 int newFlag = 0; /* True to delete file before opening */
18713 /* Close the existing database */
18714 session_close_all(p);
18715 close_db(p->db);
18716 p->db = 0;
18717 p->zDbFilename = 0;
@@ -18719,11 +18738,11 @@
18719 p->zFreeOnClose = 0;
18720 p->openMode = SHELL_OPEN_UNSPEC;
18721 p->openFlags = 0;
18722 p->szMax = 0;
18723 /* Check for command-line arguments */
18724 for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
18725 const char *z = azArg[iName];
18726 if( optionMatch(z,"new") ){
18727 newFlag = 1;
18728 #ifdef SQLITE_HAVE_ZLIB
18729 }else if( optionMatch(z, "zip") ){
@@ -18745,14 +18764,19 @@
18745 #endif /* SQLITE_ENABLE_DESERIALIZE */
18746 }else if( z[0]=='-' ){
18747 utf8_printf(stderr, "unknown option: %s\n", z);
18748 rc = 1;
18749 goto meta_command_exit;
 
 
 
 
 
 
18750 }
18751 }
18752 /* If a filename is specified, try to open it first */
18753 zNewFilename = nArg>iName ? sqlite3_mprintf("%s", azArg[iName]) : 0;
18754 if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
18755 if( newFlag ) shellDeleteFile(zNewFilename);
18756 p->zDbFilename = zNewFilename;
18757 open_db(p, OPEN_DB_KEEPALIVE);
18758 if( p->db==0 ){
@@ -19271,15 +19295,14 @@
19271 }else{
19272 rc = 0;
19273 }
19274 }else
19275
19276 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
19277 if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
19278 sqlite3_unsupported_selecttrace = nArg>=2 ? (int)integerValue(azArg[1]) : 0xffff;
 
19279 }else
19280 #endif
19281
19282 #if defined(SQLITE_ENABLE_SESSION)
19283 if( c=='s' && strncmp(azArg[0],"session",n)==0 && n>=3 ){
19284 OpenSession *pSession = &p->aSession[0];
19285 char **azCmd = &azArg[1];
@@ -19756,10 +19779,11 @@
19756 }else
19757 #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
19758
19759 if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
19760 static const char *azBool[] = { "off", "on", "trigger", "full"};
 
19761 int i;
19762 if( nArg!=1 ){
19763 raw_printf(stderr, "Usage: .show\n");
19764 rc = 1;
19765 goto meta_command_exit;
@@ -19780,11 +19804,17 @@
19780 output_c_string(p->out, p->colSeparator);
19781 raw_printf(p->out, "\n");
19782 utf8_printf(p->out,"%12.12s: ", "rowseparator");
19783 output_c_string(p->out, p->rowSeparator);
19784 raw_printf(p->out, "\n");
19785 utf8_printf(p->out, "%12.12s: %s\n","stats", azBool[p->statsOn!=0]);
 
 
 
 
 
 
19786 utf8_printf(p->out, "%12.12s: ", "width");
19787 for (i=0;i<p->nWidth;i++) {
19788 raw_printf(p->out, "%d ", p->colWidth[i]);
19789 }
19790 raw_printf(p->out, "\n");
@@ -19792,15 +19822,21 @@
19792 p->zDbFilename ? p->zDbFilename : "");
19793 }else
19794
19795 if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){
19796 if( nArg==2 ){
19797 p->statsOn = (u8)booleanValue(azArg[1]);
 
 
 
 
 
 
19798 }else if( nArg==1 ){
19799 display_stats(p->db, p, 0);
19800 }else{
19801 raw_printf(stderr, "Usage: .stats ?on|off?\n");
19802 rc = 1;
19803 }
19804 }else
19805
19806 if( (c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0)
@@ -20001,11 +20037,11 @@
20001 switch(testctrl){
20002
20003 /* sqlite3_test_control(int, db, int) */
20004 case SQLITE_TESTCTRL_OPTIMIZATIONS:
20005 if( nArg==3 ){
20006 int opt = (int)strtol(azArg[2], 0, 0);
20007 rc2 = sqlite3_test_control(testctrl, p->db, opt);
20008 isOk = 3;
20009 }
20010 break;
20011
@@ -20330,15 +20366,14 @@
20330 sqlite3_free(zVfsName);
20331 }
20332 }
20333 }else
20334
20335 #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
20336 if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
20337 sqlite3WhereTrace = nArg>=2 ? booleanValue(azArg[1]) : 0xff;
 
20338 }else
20339 #endif
20340
20341 if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
20342 int j;
20343 assert( nArg<=ArraySize(azArg) );
20344 p->nWidth = nArg-1;
20345
--- src/shell.c
+++ src/shell.c
@@ -1422,11 +1422,14 @@
1422 /* #include "sqlite3ext.h" */
1423 SQLITE_EXTENSION_INIT1
1424 #include <assert.h>
1425 #include <string.h>
1426 #include <stdarg.h>
1427
1428 #ifndef SQLITE_AMALGAMATION
1429 /* typedef sqlite3_uint64 u64; */
1430 #endif /* SQLITE_AMALGAMATION */
1431
1432 /******************************************************************************
1433 ** The Hash Engine
1434 */
1435 /*
@@ -2012,13 +2015,15 @@
2015 sqlite3_free(zMsg);
2016 return;
2017 }
2018 nCol = sqlite3_column_count(pStmt);
2019 z = sqlite3_sql(pStmt);
2020 if( z ){
2021 n = (int)strlen(z);
2022 hash_step_vformat(&cx,"S%d:",n);
2023 SHA3Update(&cx,(unsigned char*)z,n);
2024 }
2025
2026 /* Compute a hash over the result of the query */
2027 while( SQLITE_ROW==sqlite3_step(pStmt) ){
2028 SHA3Update(&cx,(const unsigned char*)"R",1);
2029 for(i=0; i<nCol; i++){
@@ -5561,11 +5566,12 @@
5566 ** 1: start=VALUE
5567 ** 2: stop=VALUE
5568 ** 4: step=VALUE
5569 **
5570 ** Also, if bit 8 is set, that means that the series should be output
5571 ** in descending order rather than in ascending order. If bit 16 is
5572 ** set, then output must appear in ascending order.
5573 **
5574 ** This routine should initialize the cursor and position it so that it
5575 ** is pointing at the first row, or pointing off the end of the table
5576 ** (so that seriesEof() will return true) if the table is empty.
5577 */
@@ -5587,11 +5593,16 @@
5593 }else{
5594 pCur->mxValue = 0xffffffff;
5595 }
5596 if( idxNum & 4 ){
5597 pCur->iStep = sqlite3_value_int64(argv[i++]);
5598 if( pCur->iStep==0 ){
5599 pCur->iStep = 1;
5600 }else if( pCur->iStep<0 ){
5601 pCur->iStep = -pCur->iStep;
5602 if( (idxNum & 16)==0 ) idxNum |= 8;
5603 }
5604 }else{
5605 pCur->iStep = 1;
5606 }
5607 for(i=0; i<argc; i++){
5608 if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
@@ -5681,11 +5692,15 @@
5692 /* Both start= and stop= boundaries are available. This is the
5693 ** the preferred case */
5694 pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
5695 pIdxInfo->estimatedRows = 1000;
5696 if( pIdxInfo->nOrderBy==1 ){
5697 if( pIdxInfo->aOrderBy[0].desc ){
5698 idxNum |= 8;
5699 }else{
5700 idxNum |= 16;
5701 }
5702 pIdxInfo->orderByConsumed = 1;
5703 }
5704 }else{
5705 /* If either boundary is missing, we have to generate a huge span
5706 ** of numbers. Make this case very expensive so that the query
@@ -8932,11 +8947,11 @@
8947 IdxTable *pNew = 0;
8948 int rc, rc2;
8949 char *pCsr = 0;
8950 int nPk = 0;
8951
8952 rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
8953 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
8954 const char *zCol = (const char*)sqlite3_column_text(p1, 1);
8955 nByte += 1 + STRLEN(zCol);
8956 rc = sqlite3_table_column_metadata(
8957 db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
@@ -9966,14 +9981,16 @@
9981
9982 idxFinalize(&rc, pAllIndex);
9983 idxFinalize(&rc, pIndexXInfo);
9984 idxFinalize(&rc, pWrite);
9985
9986 if( pCtx ){
9987 for(i=0; i<pCtx->nSlot; i++){
9988 sqlite3_free(pCtx->aSlot[i].z);
9989 }
9990 sqlite3_free(pCtx);
9991 }
 
9992
9993 if( rc==SQLITE_OK ){
9994 rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
9995 }
9996
@@ -11110,16 +11127,16 @@
11127 sqlite3 *db; /* The database */
11128 u8 autoExplain; /* Automatically turn on .explain mode */
11129 u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
11130 u8 autoEQPtest; /* autoEQP is in test mode */
11131 u8 autoEQPtrace; /* autoEQP is in trace mode */
 
11132 u8 scanstatsOn; /* True to display scan stats before each finalize */
11133 u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
11134 u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
11135 u8 nEqpLevel; /* Depth of the EQP output graph */
11136 u8 eTraceType; /* SHELL_TRACE_* value for type of trace */
11137 unsigned statsOn; /* True to display memory stats before each finalize */
11138 unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */
11139 int outCount; /* Revert to stdout when reaching zero */
11140 int cnt; /* Number of records displayed so far */
11141 int lineno; /* Line number of last line read from in */
11142 int openFlags; /* Additional flags to open. (SQLITE_OPEN_NOFOLLOW) */
@@ -12052,10 +12069,11 @@
12069 }
12070 }
12071 if( azArg==0 ) break;
12072 for(i=0; i<nArg; i++){
12073 int w = aExplainWidth[i];
12074 if( i==nArg-1 ) w = 0;
12075 if( azArg[i] && strlenChar(azArg[i])>w ){
12076 w = strlenChar(azArg[i]);
12077 }
12078 if( i==1 && p->aiIndent && p->pStmt ){
12079 if( p->iIndent<p->nIndent ){
@@ -12616,11 +12634,11 @@
12634 int iHiwtr;
12635 FILE *out;
12636 if( pArg==0 || pArg->out==0 ) return 0;
12637 out = pArg->out;
12638
12639 if( pArg->pStmt && pArg->statsOn==2 ){
12640 int nCol, i, x;
12641 sqlite3_stmt *pStmt = pArg->pStmt;
12642 char z[100];
12643 nCol = sqlite3_column_count(pStmt);
12644 raw_printf(out, "%-36s %d\n", "Number of output columns:", nCol);
@@ -12639,10 +12657,18 @@
12657 sqlite3_snprintf(30, z+x, "origin name:");
12658 utf8_printf(out, "%-36s %s\n", z, sqlite3_column_origin_name(pStmt,i));
12659 #endif
12660 }
12661 }
12662
12663 if( pArg->statsOn==3 ){
12664 if( pArg->pStmt ){
12665 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
12666 raw_printf(pArg->out, "VM-steps: %d\n", iCur);
12667 }
12668 return 0;
12669 }
12670
12671 displayStatLine(pArg, "Memory Used:",
12672 "%lld (max %lld) bytes", SQLITE_STATUS_MEMORY_USED, bReset);
12673 displayStatLine(pArg, "Number of Outstanding Allocations:",
12674 "%lld (max %lld)", SQLITE_STATUS_MALLOC_COUNT, bReset);
@@ -12906,35 +12932,22 @@
12932 }
12933
12934 /*
12935 ** Disable and restore .wheretrace and .selecttrace settings.
12936 */
12937 static unsigned int savedSelectTrace;
12938 static unsigned int savedWhereTrace;
 
 
 
 
 
 
12939 static void disable_debug_trace_modes(void){
12940 unsigned int zero = 0;
12941 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 0, &savedSelectTrace);
12942 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &zero);
12943 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 2, &savedWhereTrace);
12944 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &zero);
 
 
 
12945 }
12946 static void restore_debug_trace_modes(void){
12947 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &savedSelectTrace);
12948 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &savedWhereTrace);
 
 
 
 
12949 }
12950
12951 /* Create the TEMP table used to store parameter bindings */
12952 static void bind_table_init(ShellState *p){
12953 int wrSchema = 0;
@@ -14085,11 +14098,15 @@
14098 " Any other argument is a LIKE pattern for tables to hash",
14099 #ifndef SQLITE_NOHAVE_SYSTEM
14100 ".shell CMD ARGS... Run CMD ARGS... in a system shell",
14101 #endif
14102 ".show Show the current values for various settings",
14103 ".stats ?ARG? Show stats or turn stats on or off",
14104 " off Turn off automatic stat display",
14105 " on Turn on automatic stat display",
14106 " stmt Show statement stats",
14107 " vmstep Show the virtual machine step count only",
14108 #ifndef SQLITE_NOHAVE_SYSTEM
14109 ".system CMD ARGS... Run CMD ARGS... in a system shell",
14110 #endif
14111 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
14112 ".testcase NAME Begin redirecting output to 'testcase-out.txt'",
@@ -17901,20 +17918,21 @@
17918 static const struct {
17919 const char *zCtrlName; /* Name of a test-control option */
17920 int ctrlCode; /* Integer code for that option */
17921 const char *zUsage; /* Usage notes */
17922 } aCtrl[] = {
 
17923 { "chunk_size", SQLITE_FCNTL_CHUNK_SIZE, "SIZE" },
17924 { "data_version", SQLITE_FCNTL_DATA_VERSION, "" },
 
 
 
 
17925 { "has_moved", SQLITE_FCNTL_HAS_MOVED, "" },
17926 { "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" },
17927 { "persist_wal", SQLITE_FCNTL_PERSIST_WAL, "[BOOLEAN]" },
17928 /* { "pragma", SQLITE_FCNTL_PRAGMA, "NAME ARG" },*/
17929 { "psow", SQLITE_FCNTL_POWERSAFE_OVERWRITE, "[BOOLEAN]" },
17930 { "reserve_bytes", SQLITE_FCNTL_RESERVE_BYTES, "[N]" },
17931 { "size_limit", SQLITE_FCNTL_SIZE_LIMIT, "[LIMIT]" },
17932 { "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" },
17933 /* { "win32_av_retry", SQLITE_FCNTL_WIN32_AV_RETRY, "COUNT DELAY" },*/
17934 };
17935 int filectrl = -1;
17936 int iCtrl = -1;
17937 sqlite3_int64 iRes = 0; /* Integer result to display if rc2==1 */
17938 int isOk = 0; /* 0: usage 1: %lld 2: no-result */
@@ -17997,10 +18015,11 @@
18015 sqlite3_file_control(p->db, zSchema, filectrl, &x);
18016 iRes = x;
18017 isOk = 1;
18018 break;
18019 }
18020 case SQLITE_FCNTL_DATA_VERSION:
18021 case SQLITE_FCNTL_HAS_MOVED: {
18022 int x;
18023 if( nArg!=2 ) break;
18024 sqlite3_file_control(p->db, zSchema, filectrl, &x);
18025 iRes = x;
@@ -18705,13 +18724,13 @@
18724 }
18725 }else
18726 #endif /* SQLITE_DEBUG */
18727
18728 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
18729 char *zNewFilename = 0; /* Name of the database file to open */
18730 int iName = 1; /* Index in azArg[] of the filename */
18731 int newFlag = 0; /* True to delete file before opening */
18732 /* Close the existing database */
18733 session_close_all(p);
18734 close_db(p->db);
18735 p->db = 0;
18736 p->zDbFilename = 0;
@@ -18719,11 +18738,11 @@
18738 p->zFreeOnClose = 0;
18739 p->openMode = SHELL_OPEN_UNSPEC;
18740 p->openFlags = 0;
18741 p->szMax = 0;
18742 /* Check for command-line arguments */
18743 for(iName=1; iName<nArg; iName++){
18744 const char *z = azArg[iName];
18745 if( optionMatch(z,"new") ){
18746 newFlag = 1;
18747 #ifdef SQLITE_HAVE_ZLIB
18748 }else if( optionMatch(z, "zip") ){
@@ -18745,14 +18764,19 @@
18764 #endif /* SQLITE_ENABLE_DESERIALIZE */
18765 }else if( z[0]=='-' ){
18766 utf8_printf(stderr, "unknown option: %s\n", z);
18767 rc = 1;
18768 goto meta_command_exit;
18769 }else if( zNewFilename ){
18770 utf8_printf(stderr, "extra argument: \"%s\"\n", z);
18771 rc = 1;
18772 goto meta_command_exit;
18773 }else{
18774 zNewFilename = sqlite3_mprintf("%s", z);
18775 }
18776 }
18777 /* If a filename is specified, try to open it first */
 
18778 if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
18779 if( newFlag ) shellDeleteFile(zNewFilename);
18780 p->zDbFilename = zNewFilename;
18781 open_db(p, OPEN_DB_KEEPALIVE);
18782 if( p->db==0 ){
@@ -19271,15 +19295,14 @@
19295 }else{
19296 rc = 0;
19297 }
19298 }else
19299
 
19300 if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
19301 unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
19302 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &x);
19303 }else
 
19304
19305 #if defined(SQLITE_ENABLE_SESSION)
19306 if( c=='s' && strncmp(azArg[0],"session",n)==0 && n>=3 ){
19307 OpenSession *pSession = &p->aSession[0];
19308 char **azCmd = &azArg[1];
@@ -19756,10 +19779,11 @@
19779 }else
19780 #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
19781
19782 if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
19783 static const char *azBool[] = { "off", "on", "trigger", "full"};
19784 const char *zOut;
19785 int i;
19786 if( nArg!=1 ){
19787 raw_printf(stderr, "Usage: .show\n");
19788 rc = 1;
19789 goto meta_command_exit;
@@ -19780,11 +19804,17 @@
19804 output_c_string(p->out, p->colSeparator);
19805 raw_printf(p->out, "\n");
19806 utf8_printf(p->out,"%12.12s: ", "rowseparator");
19807 output_c_string(p->out, p->rowSeparator);
19808 raw_printf(p->out, "\n");
19809 switch( p->statsOn ){
19810 case 0: zOut = "off"; break;
19811 default: zOut = "on"; break;
19812 case 2: zOut = "stmt"; break;
19813 case 3: zOut = "vmstep"; break;
19814 }
19815 utf8_printf(p->out, "%12.12s: %s\n","stats", zOut);
19816 utf8_printf(p->out, "%12.12s: ", "width");
19817 for (i=0;i<p->nWidth;i++) {
19818 raw_printf(p->out, "%d ", p->colWidth[i]);
19819 }
19820 raw_printf(p->out, "\n");
@@ -19792,15 +19822,21 @@
19822 p->zDbFilename ? p->zDbFilename : "");
19823 }else
19824
19825 if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){
19826 if( nArg==2 ){
19827 if( strcmp(azArg[1],"stmt")==0 ){
19828 p->statsOn = 2;
19829 }else if( strcmp(azArg[1],"vmstep")==0 ){
19830 p->statsOn = 3;
19831 }else{
19832 p->statsOn = (u8)booleanValue(azArg[1]);
19833 }
19834 }else if( nArg==1 ){
19835 display_stats(p->db, p, 0);
19836 }else{
19837 raw_printf(stderr, "Usage: .stats ?on|off|stmt|vmstep?\n");
19838 rc = 1;
19839 }
19840 }else
19841
19842 if( (c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0)
@@ -20001,11 +20037,11 @@
20037 switch(testctrl){
20038
20039 /* sqlite3_test_control(int, db, int) */
20040 case SQLITE_TESTCTRL_OPTIMIZATIONS:
20041 if( nArg==3 ){
20042 unsigned int opt = (unsigned int)strtol(azArg[2], 0, 0);
20043 rc2 = sqlite3_test_control(testctrl, p->db, opt);
20044 isOk = 3;
20045 }
20046 break;
20047
@@ -20330,15 +20366,14 @@
20366 sqlite3_free(zVfsName);
20367 }
20368 }
20369 }else
20370
 
20371 if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
20372 unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
20373 sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &x);
20374 }else
 
20375
20376 if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
20377 int j;
20378 assert( nArg<=ArraySize(azArg) );
20379 p->nWidth = nArg-1;
20380
+3 -3
--- src/shun.c
+++ src/shun.c
@@ -263,11 +263,11 @@
263263
if( cnt==0 ){
264264
@ <i>no artifacts are shunned on this server</i>
265265
}
266266
db_finalize(&q);
267267
@ </p></blockquote>
268
- style_finish_page("shun");
268
+ style_finish_page();
269269
fossil_free(zCanonical);
270270
}
271271
272272
/*
273273
** Remove from the BLOB table all artifacts that are in the SHUN table.
@@ -403,11 +403,11 @@
403403
@ </tr>
404404
}
405405
}
406406
db_finalize(&q);
407407
@ </table>
408
- style_finish_page("rcvfromlist");
408
+ style_finish_page();
409409
}
410410
411411
/*
412412
** WEBPAGE: rcvfrom
413413
**
@@ -549,7 +549,7 @@
549549
@ </td></tr>
550550
}
551551
}
552552
@ </table>
553553
db_finalize(&q);
554
- style_finish_page("rcvfrom");
554
+ style_finish_page();
555555
}
556556
--- src/shun.c
+++ src/shun.c
@@ -263,11 +263,11 @@
263 if( cnt==0 ){
264 @ <i>no artifacts are shunned on this server</i>
265 }
266 db_finalize(&q);
267 @ </p></blockquote>
268 style_finish_page("shun");
269 fossil_free(zCanonical);
270 }
271
272 /*
273 ** Remove from the BLOB table all artifacts that are in the SHUN table.
@@ -403,11 +403,11 @@
403 @ </tr>
404 }
405 }
406 db_finalize(&q);
407 @ </table>
408 style_finish_page("rcvfromlist");
409 }
410
411 /*
412 ** WEBPAGE: rcvfrom
413 **
@@ -549,7 +549,7 @@
549 @ </td></tr>
550 }
551 }
552 @ </table>
553 db_finalize(&q);
554 style_finish_page("rcvfrom");
555 }
556
--- src/shun.c
+++ src/shun.c
@@ -263,11 +263,11 @@
263 if( cnt==0 ){
264 @ <i>no artifacts are shunned on this server</i>
265 }
266 db_finalize(&q);
267 @ </p></blockquote>
268 style_finish_page();
269 fossil_free(zCanonical);
270 }
271
272 /*
273 ** Remove from the BLOB table all artifacts that are in the SHUN table.
@@ -403,11 +403,11 @@
403 @ </tr>
404 }
405 }
406 db_finalize(&q);
407 @ </table>
408 style_finish_page();
409 }
410
411 /*
412 ** WEBPAGE: rcvfrom
413 **
@@ -549,7 +549,7 @@
549 @ </td></tr>
550 }
551 }
552 @ </table>
553 db_finalize(&q);
554 style_finish_page();
555 }
556
+8 -3
--- src/sitemap.c
+++ src/sitemap.c
@@ -115,10 +115,13 @@
115115
@ </li>
116116
}
117117
if( srchFlags ){
118118
@ <li>%z(href("%R/search"))Search</a></li>
119119
}
120
+ if( g.perm.Chat ){
121
+ @ <li>%z(href("%R/chat"))Chat</a></li>
122
+ }
120123
if( g.perm.RdForum ){
121124
@ <li>%z(href("%R/forum"))Forum</a>
122125
@ <ul>
123126
@ <li>%z(href("%R/timeline?y=f"))Recent activity</a></li>
124127
@ </ul>
@@ -221,11 +224,11 @@
221224
if( isPopup ){
222225
@ <li>%z(href("%R/sitemap"))Site Map</a></li>
223226
}
224227
@ </ul>
225228
if( !isPopup ){
226
- style_finish_page("sitemap");
229
+ style_finish_page();
227230
}
228231
}
229232
230233
/*
231234
** WEBPAGE: sitemap-test
@@ -236,10 +239,11 @@
236239
*/
237240
void sitemap_test_page(void){
238241
int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
239242
240243
login_check_credentials();
244
+ style_set_current_feature("sitemap");
241245
if( P("popup")!=0 && cgi_csrf_safe(0) ){
242246
/* If this is a POST from the same origin with the popup=1 parameter,
243247
** then disable anti-robot defenses */
244248
isPopup = 1;
245249
g.perm.Hyperlink = 1;
@@ -273,11 +277,11 @@
273277
}
274278
@ <li>%z(href("%R/cookies"))Content of display preference cookie</a></li>
275279
@ <li>%z(href("%R/test-captcha"))Random ASCII-art Captcha image</a></li>
276280
@ <li>%z(href("%R/test-piechart"))Pie-Chart generator test</a></li>
277281
if( !isPopup ){
278
- style_finish_page("sitemap");
282
+ style_finish_page();
279283
}
280284
}
281285
282286
/*
283287
** WEBPAGE: sitemap-timeline
@@ -287,10 +291,11 @@
287291
*/
288292
void sitemap_timeline_page(void){
289293
int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
290294
291295
login_check_credentials();
296
+ style_set_current_feature("sitemap");
292297
if( P("popup")!=0 && cgi_csrf_safe(0) ){
293298
/* If this is a POST from the same origin with the popup=1 parameter,
294299
** then disable anti-robot defenses */
295300
isPopup = 1;
296301
g.perm.Hyperlink = 1;
@@ -313,8 +318,8 @@
313318
@ <li>%z(href("%R/timewarps"))Timewarps</a></li>
314319
@ <li>%z(href("%R/timeline?ubg"))Color-coded by user</a></li>
315320
@ <li>%z(href("%R/timeline?deltabg"))Delta vs. baseline manifests</a></li>
316321
@ </ul>
317322
if( !isPopup ){
318
- style_finish_page("sitemap");
323
+ style_finish_page();
319324
}
320325
}
321326
--- src/sitemap.c
+++ src/sitemap.c
@@ -115,10 +115,13 @@
115 @ </li>
116 }
117 if( srchFlags ){
118 @ <li>%z(href("%R/search"))Search</a></li>
119 }
 
 
 
120 if( g.perm.RdForum ){
121 @ <li>%z(href("%R/forum"))Forum</a>
122 @ <ul>
123 @ <li>%z(href("%R/timeline?y=f"))Recent activity</a></li>
124 @ </ul>
@@ -221,11 +224,11 @@
221 if( isPopup ){
222 @ <li>%z(href("%R/sitemap"))Site Map</a></li>
223 }
224 @ </ul>
225 if( !isPopup ){
226 style_finish_page("sitemap");
227 }
228 }
229
230 /*
231 ** WEBPAGE: sitemap-test
@@ -236,10 +239,11 @@
236 */
237 void sitemap_test_page(void){
238 int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
239
240 login_check_credentials();
 
241 if( P("popup")!=0 && cgi_csrf_safe(0) ){
242 /* If this is a POST from the same origin with the popup=1 parameter,
243 ** then disable anti-robot defenses */
244 isPopup = 1;
245 g.perm.Hyperlink = 1;
@@ -273,11 +277,11 @@
273 }
274 @ <li>%z(href("%R/cookies"))Content of display preference cookie</a></li>
275 @ <li>%z(href("%R/test-captcha"))Random ASCII-art Captcha image</a></li>
276 @ <li>%z(href("%R/test-piechart"))Pie-Chart generator test</a></li>
277 if( !isPopup ){
278 style_finish_page("sitemap");
279 }
280 }
281
282 /*
283 ** WEBPAGE: sitemap-timeline
@@ -287,10 +291,11 @@
287 */
288 void sitemap_timeline_page(void){
289 int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
290
291 login_check_credentials();
 
292 if( P("popup")!=0 && cgi_csrf_safe(0) ){
293 /* If this is a POST from the same origin with the popup=1 parameter,
294 ** then disable anti-robot defenses */
295 isPopup = 1;
296 g.perm.Hyperlink = 1;
@@ -313,8 +318,8 @@
313 @ <li>%z(href("%R/timewarps"))Timewarps</a></li>
314 @ <li>%z(href("%R/timeline?ubg"))Color-coded by user</a></li>
315 @ <li>%z(href("%R/timeline?deltabg"))Delta vs. baseline manifests</a></li>
316 @ </ul>
317 if( !isPopup ){
318 style_finish_page("sitemap");
319 }
320 }
321
--- src/sitemap.c
+++ src/sitemap.c
@@ -115,10 +115,13 @@
115 @ </li>
116 }
117 if( srchFlags ){
118 @ <li>%z(href("%R/search"))Search</a></li>
119 }
120 if( g.perm.Chat ){
121 @ <li>%z(href("%R/chat"))Chat</a></li>
122 }
123 if( g.perm.RdForum ){
124 @ <li>%z(href("%R/forum"))Forum</a>
125 @ <ul>
126 @ <li>%z(href("%R/timeline?y=f"))Recent activity</a></li>
127 @ </ul>
@@ -221,11 +224,11 @@
224 if( isPopup ){
225 @ <li>%z(href("%R/sitemap"))Site Map</a></li>
226 }
227 @ </ul>
228 if( !isPopup ){
229 style_finish_page();
230 }
231 }
232
233 /*
234 ** WEBPAGE: sitemap-test
@@ -236,10 +239,11 @@
239 */
240 void sitemap_test_page(void){
241 int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
242
243 login_check_credentials();
244 style_set_current_feature("sitemap");
245 if( P("popup")!=0 && cgi_csrf_safe(0) ){
246 /* If this is a POST from the same origin with the popup=1 parameter,
247 ** then disable anti-robot defenses */
248 isPopup = 1;
249 g.perm.Hyperlink = 1;
@@ -273,11 +277,11 @@
277 }
278 @ <li>%z(href("%R/cookies"))Content of display preference cookie</a></li>
279 @ <li>%z(href("%R/test-captcha"))Random ASCII-art Captcha image</a></li>
280 @ <li>%z(href("%R/test-piechart"))Pie-Chart generator test</a></li>
281 if( !isPopup ){
282 style_finish_page();
283 }
284 }
285
286 /*
287 ** WEBPAGE: sitemap-timeline
@@ -287,10 +291,11 @@
291 */
292 void sitemap_timeline_page(void){
293 int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
294
295 login_check_credentials();
296 style_set_current_feature("sitemap");
297 if( P("popup")!=0 && cgi_csrf_safe(0) ){
298 /* If this is a POST from the same origin with the popup=1 parameter,
299 ** then disable anti-robot defenses */
300 isPopup = 1;
301 g.perm.Hyperlink = 1;
@@ -313,8 +318,8 @@
318 @ <li>%z(href("%R/timewarps"))Timewarps</a></li>
319 @ <li>%z(href("%R/timeline?ubg"))Color-coded by user</a></li>
320 @ <li>%z(href("%R/timeline?deltabg"))Delta vs. baseline manifests</a></li>
321 @ </ul>
322 if( !isPopup ){
323 style_finish_page();
324 }
325 }
326
+12 -6
--- src/skins.c
+++ src/skins.c
@@ -387,10 +387,11 @@
387387
zOldName = P("sn");
388388
zNewName = P("newname");
389389
if( zOldName==0 ) return 0;
390390
if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
391391
if( zNewName==0 ) zNewName = zOldName;
392
+ style_set_current_feature("skins");
392393
style_header("Rename A Skin");
393394
if( ex ){
394395
@ <p><span class="generalError">There is already another skin
395396
@ named "%h(zNewName)". Choose a different name.</span></p>
396397
}
@@ -404,11 +405,11 @@
404405
@ <input type="submit" name="rename" value="Rename">
405406
@ <input type="submit" name="canren" value="Cancel">
406407
@ </table>
407408
login_insert_csrf_secret();
408409
@ </div></form>
409
- style_finish_page("skins");
410
+ style_finish_page();
410411
return 1;
411412
}
412413
db_unprotect(PROTECT_CONFIG);
413414
db_multi_exec(
414415
"UPDATE config SET name='skin:%q' WHERE name='skin:%q';",
@@ -429,10 +430,11 @@
429430
zNewName = P("svname");
430431
if( zNewName && zNewName[0]!=0 ){
431432
}
432433
if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
433434
if( zNewName==0 ) zNewName = "";
435
+ style_set_current_feature("skins");
434436
style_header("Save Current Skin");
435437
if( ex ){
436438
@ <p><span class="generalError">There is already another skin
437439
@ named "%h(zNewName)". Choose a different name.</span></p>
438440
}
@@ -444,11 +446,11 @@
444446
@ <input type="submit" name="save" value="Save">
445447
@ <input type="submit" name="cansave" value="Cancel">
446448
@ </table>
447449
login_insert_csrf_secret();
448450
@ </div></form>
449
- style_finish_page("skins");
451
+ style_finish_page();
450452
return 1;
451453
}
452454
db_unprotect(PROTECT_CONFIG);
453455
db_multi_exec(
454456
"INSERT OR IGNORE INTO config(name, value, mtime)"
@@ -483,10 +485,12 @@
483485
zCurrent = getSkin(0);
484486
for(i=0; i<count(aBuiltinSkin); i++){
485487
aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
486488
}
487489
490
+ style_set_current_feature("skins");
491
+
488492
if( cgi_csrf_safe(1) ){
489493
/* Process requests to delete a user-defined skin */
490494
if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
491495
style_header("Confirm Custom Skin Delete");
492496
@ <form action="%R/setup_skin_admin" method="post"><div>
@@ -495,11 +499,11 @@
495499
@ <input type="hidden" name="sn" value="%h(P("sn"))" />
496500
@ <input type="submit" name="del2" value="Confirm - Delete The Skin" />
497501
@ <input type="submit" name="cancel" value="Cancel - Do Not Delete" />
498502
login_insert_csrf_secret();
499503
@ </div></form>
500
- style_finish_page("skins");
504
+ style_finish_page();
501505
db_end_transaction(1);
502506
return;
503507
}
504508
if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){
505509
db_unprotect(PROTECT_CONFIG);
@@ -648,11 +652,11 @@
648652
@ </form></tr>
649653
}
650654
db_finalize(&q);
651655
652656
@ </table>
653
- style_finish_page("skins");
657
+ style_finish_page();
654658
db_end_transaction(0);
655659
}
656660
657661
/*
658662
** Generate HTML for a <select> that lists all the available skin names,
@@ -796,10 +800,11 @@
796800
zContent = zDflt;
797801
isRevert = 1;
798802
}
799803
800804
db_begin_transaction();
805
+ style_set_current_feature("skins");
801806
style_header("%s", zTitle);
802807
for(j=0; j<count(aSkinAttr); j++){
803808
style_submenu_element(aSkinAttr[j].zSubmenu,
804809
"%R/setup_skinedit?w=%d&basis=%h&sk=%d",j,zBasis,iSkin);
805810
}
@@ -845,11 +850,11 @@
845850
blob_reset(&from);
846851
blob_reset(&to);
847852
blob_reset(&out);
848853
}
849854
@ </div></form>
850
- style_finish_page("skins");
855
+ style_finish_page();
851856
db_end_transaction(0);
852857
}
853858
854859
/*
855860
** Try to initialize draft skin iSkin to the built-in or preexisting
@@ -962,10 +967,11 @@
962967
/* Publish the draft skin */
963968
if( P("pub7")!=0 && PB("pub7ck1") && PB("pub7ck2") ){
964969
skin_publish(iSkin);
965970
}
966971
972
+ style_set_current_feature("skins");
967973
style_header("Customize Skin");
968974
969975
@ <p>Customize the look of this Fossil repository by making changes
970976
@ to the CSS, Header, Footer, and Detail Settings in one of nine "draft"
971977
@ configurations. Then, after verifying that all is working correctly,
@@ -1123,7 +1129,7 @@
11231129
}else{
11241130
@ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page
11251131
@ for cleanup and recovery actions.
11261132
}
11271133
builtin_request_js("skin.js");
1128
- style_finish_page("skins");
1134
+ style_finish_page();
11291135
}
11301136
--- src/skins.c
+++ src/skins.c
@@ -387,10 +387,11 @@
387 zOldName = P("sn");
388 zNewName = P("newname");
389 if( zOldName==0 ) return 0;
390 if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
391 if( zNewName==0 ) zNewName = zOldName;
 
392 style_header("Rename A Skin");
393 if( ex ){
394 @ <p><span class="generalError">There is already another skin
395 @ named "%h(zNewName)". Choose a different name.</span></p>
396 }
@@ -404,11 +405,11 @@
404 @ <input type="submit" name="rename" value="Rename">
405 @ <input type="submit" name="canren" value="Cancel">
406 @ </table>
407 login_insert_csrf_secret();
408 @ </div></form>
409 style_finish_page("skins");
410 return 1;
411 }
412 db_unprotect(PROTECT_CONFIG);
413 db_multi_exec(
414 "UPDATE config SET name='skin:%q' WHERE name='skin:%q';",
@@ -429,10 +430,11 @@
429 zNewName = P("svname");
430 if( zNewName && zNewName[0]!=0 ){
431 }
432 if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
433 if( zNewName==0 ) zNewName = "";
 
434 style_header("Save Current Skin");
435 if( ex ){
436 @ <p><span class="generalError">There is already another skin
437 @ named "%h(zNewName)". Choose a different name.</span></p>
438 }
@@ -444,11 +446,11 @@
444 @ <input type="submit" name="save" value="Save">
445 @ <input type="submit" name="cansave" value="Cancel">
446 @ </table>
447 login_insert_csrf_secret();
448 @ </div></form>
449 style_finish_page("skins");
450 return 1;
451 }
452 db_unprotect(PROTECT_CONFIG);
453 db_multi_exec(
454 "INSERT OR IGNORE INTO config(name, value, mtime)"
@@ -483,10 +485,12 @@
483 zCurrent = getSkin(0);
484 for(i=0; i<count(aBuiltinSkin); i++){
485 aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
486 }
487
 
 
488 if( cgi_csrf_safe(1) ){
489 /* Process requests to delete a user-defined skin */
490 if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
491 style_header("Confirm Custom Skin Delete");
492 @ <form action="%R/setup_skin_admin" method="post"><div>
@@ -495,11 +499,11 @@
495 @ <input type="hidden" name="sn" value="%h(P("sn"))" />
496 @ <input type="submit" name="del2" value="Confirm - Delete The Skin" />
497 @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" />
498 login_insert_csrf_secret();
499 @ </div></form>
500 style_finish_page("skins");
501 db_end_transaction(1);
502 return;
503 }
504 if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){
505 db_unprotect(PROTECT_CONFIG);
@@ -648,11 +652,11 @@
648 @ </form></tr>
649 }
650 db_finalize(&q);
651
652 @ </table>
653 style_finish_page("skins");
654 db_end_transaction(0);
655 }
656
657 /*
658 ** Generate HTML for a <select> that lists all the available skin names,
@@ -796,10 +800,11 @@
796 zContent = zDflt;
797 isRevert = 1;
798 }
799
800 db_begin_transaction();
 
801 style_header("%s", zTitle);
802 for(j=0; j<count(aSkinAttr); j++){
803 style_submenu_element(aSkinAttr[j].zSubmenu,
804 "%R/setup_skinedit?w=%d&basis=%h&sk=%d",j,zBasis,iSkin);
805 }
@@ -845,11 +850,11 @@
845 blob_reset(&from);
846 blob_reset(&to);
847 blob_reset(&out);
848 }
849 @ </div></form>
850 style_finish_page("skins");
851 db_end_transaction(0);
852 }
853
854 /*
855 ** Try to initialize draft skin iSkin to the built-in or preexisting
@@ -962,10 +967,11 @@
962 /* Publish the draft skin */
963 if( P("pub7")!=0 && PB("pub7ck1") && PB("pub7ck2") ){
964 skin_publish(iSkin);
965 }
966
 
967 style_header("Customize Skin");
968
969 @ <p>Customize the look of this Fossil repository by making changes
970 @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft"
971 @ configurations. Then, after verifying that all is working correctly,
@@ -1123,7 +1129,7 @@
1123 }else{
1124 @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page
1125 @ for cleanup and recovery actions.
1126 }
1127 builtin_request_js("skin.js");
1128 style_finish_page("skins");
1129 }
1130
--- src/skins.c
+++ src/skins.c
@@ -387,10 +387,11 @@
387 zOldName = P("sn");
388 zNewName = P("newname");
389 if( zOldName==0 ) return 0;
390 if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
391 if( zNewName==0 ) zNewName = zOldName;
392 style_set_current_feature("skins");
393 style_header("Rename A Skin");
394 if( ex ){
395 @ <p><span class="generalError">There is already another skin
396 @ named "%h(zNewName)". Choose a different name.</span></p>
397 }
@@ -404,11 +405,11 @@
405 @ <input type="submit" name="rename" value="Rename">
406 @ <input type="submit" name="canren" value="Cancel">
407 @ </table>
408 login_insert_csrf_secret();
409 @ </div></form>
410 style_finish_page();
411 return 1;
412 }
413 db_unprotect(PROTECT_CONFIG);
414 db_multi_exec(
415 "UPDATE config SET name='skin:%q' WHERE name='skin:%q';",
@@ -429,10 +430,11 @@
430 zNewName = P("svname");
431 if( zNewName && zNewName[0]!=0 ){
432 }
433 if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
434 if( zNewName==0 ) zNewName = "";
435 style_set_current_feature("skins");
436 style_header("Save Current Skin");
437 if( ex ){
438 @ <p><span class="generalError">There is already another skin
439 @ named "%h(zNewName)". Choose a different name.</span></p>
440 }
@@ -444,11 +446,11 @@
446 @ <input type="submit" name="save" value="Save">
447 @ <input type="submit" name="cansave" value="Cancel">
448 @ </table>
449 login_insert_csrf_secret();
450 @ </div></form>
451 style_finish_page();
452 return 1;
453 }
454 db_unprotect(PROTECT_CONFIG);
455 db_multi_exec(
456 "INSERT OR IGNORE INTO config(name, value, mtime)"
@@ -483,10 +485,12 @@
485 zCurrent = getSkin(0);
486 for(i=0; i<count(aBuiltinSkin); i++){
487 aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
488 }
489
490 style_set_current_feature("skins");
491
492 if( cgi_csrf_safe(1) ){
493 /* Process requests to delete a user-defined skin */
494 if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
495 style_header("Confirm Custom Skin Delete");
496 @ <form action="%R/setup_skin_admin" method="post"><div>
@@ -495,11 +499,11 @@
499 @ <input type="hidden" name="sn" value="%h(P("sn"))" />
500 @ <input type="submit" name="del2" value="Confirm - Delete The Skin" />
501 @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" />
502 login_insert_csrf_secret();
503 @ </div></form>
504 style_finish_page();
505 db_end_transaction(1);
506 return;
507 }
508 if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){
509 db_unprotect(PROTECT_CONFIG);
@@ -648,11 +652,11 @@
652 @ </form></tr>
653 }
654 db_finalize(&q);
655
656 @ </table>
657 style_finish_page();
658 db_end_transaction(0);
659 }
660
661 /*
662 ** Generate HTML for a <select> that lists all the available skin names,
@@ -796,10 +800,11 @@
800 zContent = zDflt;
801 isRevert = 1;
802 }
803
804 db_begin_transaction();
805 style_set_current_feature("skins");
806 style_header("%s", zTitle);
807 for(j=0; j<count(aSkinAttr); j++){
808 style_submenu_element(aSkinAttr[j].zSubmenu,
809 "%R/setup_skinedit?w=%d&basis=%h&sk=%d",j,zBasis,iSkin);
810 }
@@ -845,11 +850,11 @@
850 blob_reset(&from);
851 blob_reset(&to);
852 blob_reset(&out);
853 }
854 @ </div></form>
855 style_finish_page();
856 db_end_transaction(0);
857 }
858
859 /*
860 ** Try to initialize draft skin iSkin to the built-in or preexisting
@@ -962,10 +967,11 @@
967 /* Publish the draft skin */
968 if( P("pub7")!=0 && PB("pub7ck1") && PB("pub7ck2") ){
969 skin_publish(iSkin);
970 }
971
972 style_set_current_feature("skins");
973 style_header("Customize Skin");
974
975 @ <p>Customize the look of this Fossil repository by making changes
976 @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft"
977 @ configurations. Then, after verifying that all is working correctly,
@@ -1123,7 +1129,7 @@
1129 }else{
1130 @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page
1131 @ for cleanup and recovery actions.
1132 }
1133 builtin_request_js("skin.js");
1134 style_finish_page();
1135 }
1136
+4 -2
--- src/smtp.c
+++ src/smtp.c
@@ -769,10 +769,11 @@
769769
if( !g.perm.Setup ){
770770
login_needed(0);
771771
return;
772772
}
773773
db_begin_transaction();
774
+ style_set_current_feature("smtp");
774775
style_header("Email Server Setup");
775776
if( db_table_exists("repository","emailroute") ){
776777
style_submenu_element("emailblob table", "%R/emailblob");
777778
style_submenu_element("emailoutq table", "%R/emailoutq");
778779
db_prepare(&q, "SELECT eaddr, epolicy FROM emailroute ORDER BY 1");
@@ -805,11 +806,11 @@
805806
@ <form method="POST" action="%R/setup_smtp_route">
806807
@ <input type="submit" value="New">
807808
@ &larr; Add a new email address
808809
@ </form>
809810
@ </table>
810
- style_finish_page("smtp");
811
+ style_finish_page();
811812
db_end_transaction(0);
812813
}
813814
814815
/*
815816
** WEBPAGE: setup_smtp_route
@@ -833,10 +834,11 @@
833834
login_check_credentials();
834835
if( !g.perm.Setup ){
835836
login_needed(0);
836837
return;
837838
}
839
+ style_set_current_feature("smtp");
838840
style_header("Email Route Editor");
839841
840842
if( P("edit") && cgi_csrf_safe(1) && zEAddr!=0 && zEPolicy!=0 ){
841843
smtp_server_schema(0);
842844
if( (zOAddr==0 || fossil_strcmp(zEAddr,zOAddr)!=0) ){
@@ -924,11 +926,11 @@
924926
@ with USER.LOGIN=<i>login-name</i>.
925927
@ </ul>
926928
@
927929
@ <p>To delete a route &rarr; erase all text from the "Routing" field then
928930
@ press the "Apply" button.
929
- style_finish_page("smtp");
931
+ style_finish_page();
930932
}
931933
932934
#if LOCAL_INTERFACE
933935
/*
934936
** State information for the server
935937
--- src/smtp.c
+++ src/smtp.c
@@ -769,10 +769,11 @@
769 if( !g.perm.Setup ){
770 login_needed(0);
771 return;
772 }
773 db_begin_transaction();
 
774 style_header("Email Server Setup");
775 if( db_table_exists("repository","emailroute") ){
776 style_submenu_element("emailblob table", "%R/emailblob");
777 style_submenu_element("emailoutq table", "%R/emailoutq");
778 db_prepare(&q, "SELECT eaddr, epolicy FROM emailroute ORDER BY 1");
@@ -805,11 +806,11 @@
805 @ <form method="POST" action="%R/setup_smtp_route">
806 @ <input type="submit" value="New">
807 @ &larr; Add a new email address
808 @ </form>
809 @ </table>
810 style_finish_page("smtp");
811 db_end_transaction(0);
812 }
813
814 /*
815 ** WEBPAGE: setup_smtp_route
@@ -833,10 +834,11 @@
833 login_check_credentials();
834 if( !g.perm.Setup ){
835 login_needed(0);
836 return;
837 }
 
838 style_header("Email Route Editor");
839
840 if( P("edit") && cgi_csrf_safe(1) && zEAddr!=0 && zEPolicy!=0 ){
841 smtp_server_schema(0);
842 if( (zOAddr==0 || fossil_strcmp(zEAddr,zOAddr)!=0) ){
@@ -924,11 +926,11 @@
924 @ with USER.LOGIN=<i>login-name</i>.
925 @ </ul>
926 @
927 @ <p>To delete a route &rarr; erase all text from the "Routing" field then
928 @ press the "Apply" button.
929 style_finish_page("smtp");
930 }
931
932 #if LOCAL_INTERFACE
933 /*
934 ** State information for the server
935
--- src/smtp.c
+++ src/smtp.c
@@ -769,10 +769,11 @@
769 if( !g.perm.Setup ){
770 login_needed(0);
771 return;
772 }
773 db_begin_transaction();
774 style_set_current_feature("smtp");
775 style_header("Email Server Setup");
776 if( db_table_exists("repository","emailroute") ){
777 style_submenu_element("emailblob table", "%R/emailblob");
778 style_submenu_element("emailoutq table", "%R/emailoutq");
779 db_prepare(&q, "SELECT eaddr, epolicy FROM emailroute ORDER BY 1");
@@ -805,11 +806,11 @@
806 @ <form method="POST" action="%R/setup_smtp_route">
807 @ <input type="submit" value="New">
808 @ &larr; Add a new email address
809 @ </form>
810 @ </table>
811 style_finish_page();
812 db_end_transaction(0);
813 }
814
815 /*
816 ** WEBPAGE: setup_smtp_route
@@ -833,10 +834,11 @@
834 login_check_credentials();
835 if( !g.perm.Setup ){
836 login_needed(0);
837 return;
838 }
839 style_set_current_feature("smtp");
840 style_header("Email Route Editor");
841
842 if( P("edit") && cgi_csrf_safe(1) && zEAddr!=0 && zEPolicy!=0 ){
843 smtp_server_schema(0);
844 if( (zOAddr==0 || fossil_strcmp(zEAddr,zOAddr)!=0) ){
@@ -924,11 +926,11 @@
926 @ with USER.LOGIN=<i>login-name</i>.
927 @ </ul>
928 @
929 @ <p>To delete a route &rarr; erase all text from the "Routing" field then
930 @ press the "Apply" button.
931 style_finish_page();
932 }
933
934 #if LOCAL_INTERFACE
935 /*
936 ** State information for the server
937
--- src/sounds/README.md
+++ src/sounds/README.md
@@ -1,11 +1,12 @@
1
-The *.wav files in this directory contain a human voice speaking each
2
-of the 16 hexadecimal digits. If a captcha string consists of just
3
-hexadecimal digits (as is the case for captchas generated by the
4
-[../captcha.c module](../captcha.c)) then these WAV files can be
5
-concatenated together to generate an audio reading of the captcha, which
6
-enables visually impaired users to complete the captcha.
1
+The `[0-9a-f].wav` files in this directory contain a human voice
2
+speaking each of the 16 hexadecimal digits. If a captcha string
3
+consists of just hexadecimal digits (as is the case for captchas
4
+generated by the [captcha.c module](/finfo/src/captcha.c)) then these WAV
5
+files can be concatenated together to generate an audio reading of the
6
+captcha, which enables visually impaired users to complete the
7
+captcha.
78
89
Each of the WAV files uses 8000 samples per second, 8 bits per sample
910
and are 6000 samples in length.
1011
1112
The recordings are made by Philip Bennefall and are of his own voice.
1213
--- src/sounds/README.md
+++ src/sounds/README.md
@@ -1,11 +1,12 @@
1 The *.wav files in this directory contain a human voice speaking each
2 of the 16 hexadecimal digits. If a captcha string consists of just
3 hexadecimal digits (as is the case for captchas generated by the
4 [../captcha.c module](../captcha.c)) then these WAV files can be
5 concatenated together to generate an audio reading of the captcha, which
6 enables visually impaired users to complete the captcha.
 
7
8 Each of the WAV files uses 8000 samples per second, 8 bits per sample
9 and are 6000 samples in length.
10
11 The recordings are made by Philip Bennefall and are of his own voice.
12
--- src/sounds/README.md
+++ src/sounds/README.md
@@ -1,11 +1,12 @@
1 The `[0-9a-f].wav` files in this directory contain a human voice
2 speaking each of the 16 hexadecimal digits. If a captcha string
3 consists of just hexadecimal digits (as is the case for captchas
4 generated by the [captcha.c module](/finfo/src/captcha.c)) then these WAV
5 files can be concatenated together to generate an audio reading of the
6 captcha, which enables visually impaired users to complete the
7 captcha.
8
9 Each of the WAV files uses 8000 samples per second, 8 bits per sample
10 and are 6000 samples in length.
11
12 The recordings are made by Philip Bennefall and are of his own voice.
13
+3451 -2182
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.34.0. By combining all the individual C code files into this
3
+** version 3.35.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -281,10 +281,13 @@
281281
#if SQLITE_ENABLE_LOAD_EXTENSION
282282
"ENABLE_LOAD_EXTENSION",
283283
#endif
284284
#ifdef SQLITE_ENABLE_LOCKING_STYLE
285285
"ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
286
+#endif
287
+#if SQLITE_ENABLE_MATH_FUNCTIONS
288
+ "ENABLE_MATH_FUNCTIONS",
286289
#endif
287290
#if SQLITE_ENABLE_MEMORY_MANAGEMENT
288291
"ENABLE_MEMORY_MANAGEMENT",
289292
#endif
290293
#if SQLITE_ENABLE_MEMSYS3
@@ -988,10 +991,22 @@
988991
# define MSVC_VERSION _MSC_VER
989992
#else
990993
# define MSVC_VERSION 0
991994
#endif
992995
996
+/*
997
+** Some C99 functions in "math.h" are only present for MSVC when its version
998
+** is associated with Visual Studio 2013 or higher.
999
+*/
1000
+#ifndef SQLITE_HAVE_C99_MATH_FUNCS
1001
+# if MSVC_VERSION==0 || MSVC_VERSION>=1800
1002
+# define SQLITE_HAVE_C99_MATH_FUNCS (1)
1003
+# else
1004
+# define SQLITE_HAVE_C99_MATH_FUNCS (0)
1005
+# endif
1006
+#endif
1007
+
9931008
/* Needed for various definitions... */
9941009
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
9951010
# define _GNU_SOURCE
9961011
#endif
9971012
@@ -1169,13 +1184,13 @@
11691184
**
11701185
** See also: [sqlite3_libversion()],
11711186
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11721187
** [sqlite_version()] and [sqlite_source_id()].
11731188
*/
1174
-#define SQLITE_VERSION "3.34.0"
1175
-#define SQLITE_VERSION_NUMBER 3034000
1176
-#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
1189
+#define SQLITE_VERSION "3.35.0"
1190
+#define SQLITE_VERSION_NUMBER 3035000
1191
+#define SQLITE_SOURCE_ID "2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18df9a04"
11771192
11781193
/*
11791194
** CAPI3REF: Run-Time Library Version Numbers
11801195
** KEYWORDS: sqlite3_version sqlite3_sourceid
11811196
**
@@ -4545,10 +4560,11 @@
45454560
** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
45464561
** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
45474562
** that uses dot-files in place of posix advisory locking.
45484563
** <tr><td> file:data.db?mode=readonly <td>
45494564
** An error. "readonly" is not a valid option for the "mode" parameter.
4565
+** Use "ro" instead: "file:data.db?mode=ro".
45504566
** </table>
45514567
**
45524568
** ^URI hexadecimal escape sequences (%HH) are supported within the path and
45534569
** query components of a URI. A hexadecimal escape sequence consists of a
45544570
** percent sign - "%" - followed by exactly two hexadecimal digits
@@ -4743,11 +4759,11 @@
47434759
** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
47444760
**
47454761
** If the Y parameter to sqlite3_free_filename(Y) is anything other
47464762
** than a NULL pointer or a pointer previously acquired from
47474763
** sqlite3_create_filename(), then bad things such as heap
4748
-** corruption or segfaults may occur. The value Y should be
4764
+** corruption or segfaults may occur. The value Y should not be
47494765
** used again after sqlite3_free_filename(Y) has been called. This means
47504766
** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
47514767
** then the corresponding [sqlite3_module.xClose() method should also be
47524768
** invoked prior to calling sqlite3_free_filename(Y).
47534769
*/
@@ -8811,11 +8827,12 @@
88118827
#define SQLITE_TESTCTRL_PARSER_COVERAGE 26
88128828
#define SQLITE_TESTCTRL_RESULT_INTREAL 27
88138829
#define SQLITE_TESTCTRL_PRNG_SEED 28
88148830
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
88158831
#define SQLITE_TESTCTRL_SEEK_COUNT 30
8816
-#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
8832
+#define SQLITE_TESTCTRL_TRACEFLAGS 31
8833
+#define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
88178834
88188835
/*
88198836
** CAPI3REF: SQL Keyword Checking
88208837
**
88218838
** These routines provide access to the set of SQL language keywords
@@ -11484,10 +11501,18 @@
1148411501
** guaranteed that a call to sqlite3session_changeset() will return a
1148511502
** changeset containing zero changes.
1148611503
*/
1148711504
SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
1148811505
11506
+/*
11507
+** CAPI3REF: Query for the amount of heap memory used by a session object.
11508
+**
11509
+** This API returns the total amount of heap memory in bytes currently
11510
+** used by the session object passed as the only argument.
11511
+*/
11512
+SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
11513
+
1148911514
/*
1149011515
** CAPI3REF: Create An Iterator To Traverse A Changeset
1149111516
** CONSTRUCTOR: sqlite3_changeset_iter
1149211517
**
1149311518
** Create an iterator used to iterate through the contents of a changeset.
@@ -13526,11 +13551,12 @@
1352613551
** places. The following macros try to make this explicit.
1352713552
*/
1352813553
#ifndef __has_extension
1352913554
# define __has_extension(x) 0 /* compatibility with non-clang compilers */
1353013555
#endif
13531
-#if GCC_VERSION>=4007000 || __has_extension(c_atomic)
13556
+#if GCC_VERSION>=4007000 || \
13557
+ (__has_extension(c_atomic) && __has_extension(c_atomic_store_n))
1353213558
# define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED)
1353313559
# define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)
1353413560
#else
1353513561
# define AtomicLoad(PTR) (*(PTR))
1353613562
# define AtomicStore(PTR,VAL) (*(PTR) = (VAL))
@@ -14592,25 +14618,37 @@
1459214618
1459314619
/*
1459414620
** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
1459514621
** the Select query generator tracing logic is turned on.
1459614622
*/
14597
-#if defined(SQLITE_ENABLE_SELECTTRACE)
14598
-# define SELECTTRACE_ENABLED 1
14599
-#else
14600
-# define SELECTTRACE_ENABLED 0
14623
+#if !defined(SQLITE_AMALGAMATION)
14624
+SQLITE_PRIVATE u32 sqlite3SelectTrace;
1460114625
#endif
14602
-#if defined(SQLITE_ENABLE_SELECTTRACE)
14626
+#if defined(SQLITE_DEBUG) \
14627
+ && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE))
1460314628
# define SELECTTRACE_ENABLED 1
1460414629
# define SELECTTRACE(K,P,S,X) \
14605
- if(sqlite3_unsupported_selecttrace&(K)) \
14630
+ if(sqlite3SelectTrace&(K)) \
1460614631
sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
1460714632
sqlite3DebugPrintf X
1460814633
#else
1460914634
# define SELECTTRACE(K,P,S,X)
1461014635
# define SELECTTRACE_ENABLED 0
1461114636
#endif
14637
+
14638
+/*
14639
+** Macros for "wheretrace"
14640
+*/
14641
+SQLITE_PRIVATE u32 sqlite3WhereTrace;
14642
+#if defined(SQLITE_DEBUG) \
14643
+ && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
14644
+# define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
14645
+# define WHERETRACE_ENABLED 1
14646
+#else
14647
+# define WHERETRACE(K,X)
14648
+#endif
14649
+
1461214650
1461314651
/*
1461414652
** An instance of the following structure is used to store the busy-handler
1461514653
** callback for a given sqlite handle.
1461614654
**
@@ -14737,10 +14775,11 @@
1473714775
typedef struct Lookaside Lookaside;
1473814776
typedef struct LookasideSlot LookasideSlot;
1473914777
typedef struct Module Module;
1474014778
typedef struct NameContext NameContext;
1474114779
typedef struct Parse Parse;
14780
+typedef struct ParseCleanup ParseCleanup;
1474214781
typedef struct PreUpdate PreUpdate;
1474314782
typedef struct PrintfArguments PrintfArguments;
1474414783
typedef struct RenameToken RenameToken;
1474514784
typedef struct RowSet RowSet;
1474614785
typedef struct Savepoint Savepoint;
@@ -15316,10 +15355,11 @@
1531615355
1531715356
/* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */
1531815357
#define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */
1531915358
#define BTREE_AUXDELETE 0x04 /* not the primary delete operation */
1532015359
#define BTREE_APPEND 0x08 /* Insert is likely an append */
15360
+#define BTREE_PREFORMAT 0x80 /* Insert is likely an append */
1532115361
1532215362
/* An instance of the BtreePayload object describes the content of a single
1532315363
** entry in either an index or table btree.
1532415364
**
1532515365
** Index btrees (used for indexes and also WITHOUT ROWID tables) contain
@@ -15414,10 +15454,12 @@
1541415454
#endif
1541515455
1541615456
#ifndef SQLITE_OMIT_WAL
1541715457
SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
1541815458
#endif
15459
+
15460
+SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);
1541915461
1542015462
/*
1542115463
** If we are not using shared cache, then there is no need to
1542215464
** use mutexes to access the BtShared structures. So make the
1542315465
** Enter and Leave procedures no-ops.
@@ -15757,64 +15799,65 @@
1575715799
#define OP_SeekScan 118 /* synopsis: Scan-ahead up to P1 rows */
1575815800
#define OP_SeekHit 119 /* synopsis: set P2<=seekHit<=P3 */
1575915801
#define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
1576015802
#define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
1576115803
#define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
15762
-#define OP_Delete 123
15763
-#define OP_ResetCount 124
15764
-#define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15765
-#define OP_SorterData 126 /* synopsis: r[P2]=data */
15766
-#define OP_RowData 127 /* synopsis: r[P2]=data */
15767
-#define OP_Rowid 128 /* synopsis: r[P2]=rowid */
15768
-#define OP_NullRow 129
15769
-#define OP_SeekEnd 130
15770
-#define OP_IdxInsert 131 /* synopsis: key=r[P2] */
15771
-#define OP_SorterInsert 132 /* synopsis: key=r[P2] */
15772
-#define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */
15773
-#define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */
15774
-#define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */
15775
-#define OP_FinishSeek 136
15776
-#define OP_Destroy 137
15777
-#define OP_Clear 138
15778
-#define OP_ResetSorter 139
15779
-#define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15780
-#define OP_SqlExec 141
15781
-#define OP_ParseSchema 142
15782
-#define OP_LoadAnalysis 143
15783
-#define OP_DropTable 144
15784
-#define OP_DropIndex 145
15785
-#define OP_DropTrigger 146
15786
-#define OP_IntegrityCk 147
15787
-#define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */
15788
-#define OP_Param 149
15804
+#define OP_RowCell 123
15805
+#define OP_Delete 124
15806
+#define OP_ResetCount 125
15807
+#define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15808
+#define OP_SorterData 127 /* synopsis: r[P2]=data */
15809
+#define OP_RowData 128 /* synopsis: r[P2]=data */
15810
+#define OP_Rowid 129 /* synopsis: r[P2]=rowid */
15811
+#define OP_NullRow 130
15812
+#define OP_SeekEnd 131
15813
+#define OP_IdxInsert 132 /* synopsis: key=r[P2] */
15814
+#define OP_SorterInsert 133 /* synopsis: key=r[P2] */
15815
+#define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */
15816
+#define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */
15817
+#define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */
15818
+#define OP_FinishSeek 137
15819
+#define OP_Destroy 138
15820
+#define OP_Clear 139
15821
+#define OP_ResetSorter 140
15822
+#define OP_CreateBtree 141 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15823
+#define OP_SqlExec 142
15824
+#define OP_ParseSchema 143
15825
+#define OP_LoadAnalysis 144
15826
+#define OP_DropTable 145
15827
+#define OP_DropIndex 146
15828
+#define OP_DropTrigger 147
15829
+#define OP_IntegrityCk 148
15830
+#define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */
1578915831
#define OP_Real 150 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15790
-#define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */
15791
-#define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15792
-#define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15793
-#define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15794
-#define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15795
-#define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15796
-#define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */
15797
-#define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */
15798
-#define OP_Expire 159
15799
-#define OP_CursorLock 160
15800
-#define OP_CursorUnlock 161
15801
-#define OP_TableLock 162 /* synopsis: iDb=P1 root=P2 write=P3 */
15802
-#define OP_VBegin 163
15803
-#define OP_VCreate 164
15804
-#define OP_VDestroy 165
15805
-#define OP_VOpen 166
15806
-#define OP_VColumn 167 /* synopsis: r[P3]=vcolumn(P2) */
15807
-#define OP_VRename 168
15808
-#define OP_Pagecount 169
15809
-#define OP_MaxPgcnt 170
15810
-#define OP_Trace 171
15811
-#define OP_CursorHint 172
15812
-#define OP_ReleaseReg 173 /* synopsis: release r[P1@P2] mask P3 */
15813
-#define OP_Noop 174
15814
-#define OP_Explain 175
15815
-#define OP_Abortable 176
15832
+#define OP_Param 151
15833
+#define OP_FkCounter 152 /* synopsis: fkctr[P1]+=P2 */
15834
+#define OP_MemMax 153 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15835
+#define OP_OffsetLimit 154 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15836
+#define OP_AggInverse 155 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15837
+#define OP_AggStep 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15838
+#define OP_AggStep1 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15839
+#define OP_AggValue 158 /* synopsis: r[P3]=value N=P2 */
15840
+#define OP_AggFinal 159 /* synopsis: accum=r[P1] N=P2 */
15841
+#define OP_Expire 160
15842
+#define OP_CursorLock 161
15843
+#define OP_CursorUnlock 162
15844
+#define OP_TableLock 163 /* synopsis: iDb=P1 root=P2 write=P3 */
15845
+#define OP_VBegin 164
15846
+#define OP_VCreate 165
15847
+#define OP_VDestroy 166
15848
+#define OP_VOpen 167
15849
+#define OP_VColumn 168 /* synopsis: r[P3]=vcolumn(P2) */
15850
+#define OP_VRename 169
15851
+#define OP_Pagecount 170
15852
+#define OP_MaxPgcnt 171
15853
+#define OP_Trace 172
15854
+#define OP_CursorHint 173
15855
+#define OP_ReleaseReg 174 /* synopsis: release r[P1@P2] mask P3 */
15856
+#define OP_Noop 175
15857
+#define OP_Explain 176
15858
+#define OP_Abortable 177
1581615859
1581715860
/* Properties such as "out2" or "jump" that are specified in
1581815861
** comments following the "case" for each opcode in the vdbe.c
1581915862
** are encoded into bitvectors as follows:
1582015863
*/
@@ -15839,17 +15882,17 @@
1583915882
/* 88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
1584015883
/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
1584115884
/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
1584215885
/* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
1584315886
/* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15844
-/* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\
15845
-/* 136 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15846
-/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00,\
15847
-/* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15887
+/* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\
15888
+/* 136 */ 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\
15889
+/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10,\
15890
+/* 152 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\
1584815891
/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15849
-/* 168 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15850
-/* 176 */ 0x00,}
15892
+/* 168 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\
15893
+/* 176 */ 0x00, 0x00,}
1585115894
1585215895
/* The sqlite3P2Values() routine is able to run faster if it knows
1585315896
** the value of the largest JUMP opcode. The smaller the maximum
1585415897
** JUMP opcode the better, so the mkopcodeh.tcl script that
1585515898
** generated this include file strives to group all JUMP opcodes
@@ -16905,11 +16948,11 @@
1690516948
u32 nSchemaLock; /* Do not reset the schema when non-zero */
1690616949
unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
1690716950
int errCode; /* Most recent error code (SQLITE_*) */
1690816951
int errMask; /* & result codes with this before returning */
1690916952
int iSysErrno; /* Errno value from last system error */
16910
- u16 dbOptFlags; /* Flags to enable/disable optimizations */
16953
+ u32 dbOptFlags; /* Flags to enable/disable optimizations */
1691116954
u8 enc; /* Text encoding */
1691216955
u8 autoCommit; /* The auto-commit flag. */
1691316956
u8 temp_store; /* 1: file 2: memory 0: default */
1691416957
u8 mallocFailed; /* True if we have seen a malloc failure */
1691516958
u8 bBenignMalloc; /* Do not require OOMs if true */
@@ -17112,28 +17155,30 @@
1711217155
/*
1711317156
** Bits of the sqlite3.dbOptFlags field that are used by the
1711417157
** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
1711517158
** selectively disable various optimizations.
1711617159
*/
17117
-#define SQLITE_QueryFlattener 0x0001 /* Query flattening */
17118
-#define SQLITE_WindowFunc 0x0002 /* Use xInverse for window functions */
17119
-#define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */
17120
-#define SQLITE_FactorOutConst 0x0008 /* Constant factoring */
17121
-#define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */
17122
-#define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */
17123
-#define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */
17124
-#define SQLITE_Transitive 0x0080 /* Transitive constraints */
17125
-#define SQLITE_OmitNoopJoin 0x0100 /* Omit unused tables in joins */
17126
-#define SQLITE_CountOfView 0x0200 /* The count-of-view optimization */
17127
-#define SQLITE_CursorHints 0x0400 /* Add OP_CursorHint opcodes */
17128
-#define SQLITE_Stat4 0x0800 /* Use STAT4 data */
17129
- /* TH3 expects the Stat4 ^^^^^^ value to be 0x0800. Don't change it */
17130
-#define SQLITE_PushDown 0x1000 /* The push-down optimization */
17131
-#define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */
17132
-#define SQLITE_SkipScan 0x4000 /* Skip-scans */
17133
-#define SQLITE_PropagateConst 0x8000 /* The constant propagation opt */
17134
-#define SQLITE_AllOpts 0xffff /* All optimizations */
17160
+#define SQLITE_QueryFlattener 0x00000001 /* Query flattening */
17161
+#define SQLITE_WindowFunc 0x00000002 /* Use xInverse for window functions */
17162
+#define SQLITE_GroupByOrder 0x00000004 /* GROUPBY cover of ORDERBY */
17163
+#define SQLITE_FactorOutConst 0x00000008 /* Constant factoring */
17164
+#define SQLITE_DistinctOpt 0x00000010 /* DISTINCT using indexes */
17165
+#define SQLITE_CoverIdxScan 0x00000020 /* Covering index scans */
17166
+#define SQLITE_OrderByIdxJoin 0x00000040 /* ORDER BY of joins via index */
17167
+#define SQLITE_Transitive 0x00000080 /* Transitive constraints */
17168
+#define SQLITE_OmitNoopJoin 0x00000100 /* Omit unused tables in joins */
17169
+#define SQLITE_CountOfView 0x00000200 /* The count-of-view optimization */
17170
+#define SQLITE_CursorHints 0x00000400 /* Add OP_CursorHint opcodes */
17171
+#define SQLITE_Stat4 0x00000800 /* Use STAT4 data */
17172
+ /* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */
17173
+#define SQLITE_PushDown 0x00001000 /* The push-down optimization */
17174
+#define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
17175
+#define SQLITE_SkipScan 0x00004000 /* Skip-scans */
17176
+#define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
17177
+#define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
17178
+#define SQLITE_ExistsToIN 0x00020000 /* The EXISTS-to-IN optimization */
17179
+#define SQLITE_AllOpts 0xffffffff /* All optimizations */
1713517180
1713617181
/*
1713717182
** Macros for testing whether or not optimizations are enabled or disabled.
1713817183
*/
1713917184
#define OptimizationDisabled(db, mask) (((db)->dbOptFlags&(mask))!=0)
@@ -17285,10 +17330,13 @@
1728517330
** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions
1728617331
** and functions like sqlite_version() that can change, but not during
1728717332
** a single query. The iArg is ignored. The user-data is always set
1728817333
** to a NULL pointer. The bNC parameter is not used.
1728917334
**
17335
+** MFUNCTION(zName, nArg, xPtr, xFunc)
17336
+** For math-library functions. xPtr is an arbitrary pointer.
17337
+**
1729017338
** PURE_DATE(zName, nArg, iArg, bNC, xFunc)
1729117339
** Used for "pure" date/time functions, this macro is like DFUNCTION
1729217340
** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is
1729317341
** ignored and the user-data for these functions is set to an
1729417342
** arbitrary non-NULL pointer. The bNC parameter is not used.
@@ -17320,10 +17368,13 @@
1732017368
{nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
1732117369
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
1732217370
#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
1732317371
{nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
1732417372
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
17373
+#define MFUNCTION(zName, nArg, xPtr, xFunc) \
17374
+ {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
17375
+ xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
1732517376
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
1732617377
{nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
1732717378
SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
1732817379
#define TEST_FUNC(zName, nArg, iArg, mFlags) \
1732917380
{nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
@@ -17590,11 +17641,10 @@
1759017641
char **azModuleArg; /* 0: module 1: schema 2: vtab name 3...: args */
1759117642
VTable *pVTable; /* List of VTable objects. */
1759217643
#endif
1759317644
Trigger *pTrigger; /* List of triggers stored in pSchema */
1759417645
Schema *pSchema; /* Schema that contains this table */
17595
- Table *pNextZombie; /* Next on the Parse.pZombieTab list */
1759617646
};
1759717647
1759817648
/*
1759917649
** Allowed values for Table.tabFlags.
1760017650
**
@@ -17719,20 +17769,26 @@
1771917769
** occurs. IGNORE means that the particular row that caused the constraint
1772017770
** error is not inserted or updated. Processing continues and no error
1772117771
** is returned. REPLACE means that preexisting database rows that caused
1772217772
** a UNIQUE constraint violation are removed so that the new insert or
1772317773
** update can proceed. Processing continues and no error is reported.
17774
+** UPDATE applies to insert operations only and means that the insert
17775
+** is omitted and the DO UPDATE clause of an upsert is run instead.
1772417776
**
17725
-** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.
17777
+** RESTRICT, SETNULL, SETDFLT, and CASCADE actions apply only to foreign keys.
1772617778
** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
1772717779
** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign
17728
-** key is set to NULL. CASCADE means that a DELETE or UPDATE of the
17780
+** key is set to NULL. SETDFLT means that the foreign key is set
17781
+** to its default value. CASCADE means that a DELETE or UPDATE of the
1772917782
** referenced table row is propagated into the row that holds the
1773017783
** foreign key.
17784
+**
17785
+** The OE_Default value is a place holder that means to use whatever
17786
+** conflict resolution algorthm is required from context.
1773117787
**
1773217788
** The following symbolic values are used to record which type
17733
-** of action to take.
17789
+** of conflict resolution action to take.
1773417790
*/
1773517791
#define OE_None 0 /* There is no constraint to check */
1773617792
#define OE_Rollback 1 /* Fail the operation and rollback the transaction */
1773717793
#define OE_Abort 2 /* Back out changes but do no rollback transaction */
1773817794
#define OE_Fail 3 /* Stop the operation but leave all prior changes */
@@ -18114,11 +18170,11 @@
1811418170
** TK_SELECT: 1st register of result vector */
1811518171
ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
1811618172
** TK_VARIABLE: variable number (always >= 1).
1811718173
** TK_SELECT_COLUMN: column of the result vector */
1811818174
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
18119
- i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
18175
+ int iRightJoinTable; /* If EP_FromJoin, the right table of the join */
1812018176
AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
1812118177
union {
1812218178
Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
1812318179
** for a column of an index on an expression */
1812418180
Window *pWin; /* EP_WinFunc: Window/Filter defn for a function */
@@ -18482,19 +18538,25 @@
1848218538
** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
1848318539
** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
1848418540
** WHERE clause is omitted.
1848518541
*/
1848618542
struct Upsert {
18487
- ExprList *pUpsertTarget; /* Optional description of conflicting index */
18543
+ ExprList *pUpsertTarget; /* Optional description of conflict target */
1848818544
Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
1848918545
ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
1849018546
Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
18491
- /* The fields above comprise the parse tree for the upsert clause.
18492
- ** The fields below are used to transfer information from the INSERT
18493
- ** processing down into the UPDATE processing while generating code.
18494
- ** Upsert owns the memory allocated above, but not the memory below. */
18495
- Index *pUpsertIdx; /* Constraint that pUpsertTarget identifies */
18547
+ Upsert *pNextUpsert; /* Next ON CONFLICT clause in the list */
18548
+ u8 isDoUpdate; /* True for DO UPDATE. False for DO NOTHING */
18549
+ /* Above this point is the parse tree for the ON CONFLICT clauses.
18550
+ ** The next group of fields stores intermediate data. */
18551
+ void *pToFree; /* Free memory when deleting the Upsert object */
18552
+ /* All fields above are owned by the Upsert object and must be freed
18553
+ ** when the Upsert is destroyed. The fields below are used to transfer
18554
+ ** information from the INSERT processing down into the UPDATE processing
18555
+ ** while generating code. The fields below are owned by the INSERT
18556
+ ** statement and will be freed by INSERT processing. */
18557
+ Index *pUpsertIdx; /* UNIQUE constraint specified by pUpsertTarget */
1849618558
SrcList *pUpsertSrc; /* Table to be updated */
1849718559
int regData; /* First register holding array of VALUES */
1849818560
int iDataCur; /* Index of the data cursor */
1849918561
int iIdxCur; /* Index of the first index cursor */
1850018562
};
@@ -18740,10 +18802,21 @@
1874018802
# define DbMaskSet(M,I) (M)|=(((yDbMask)1)<<(I))
1874118803
# define DbMaskAllZero(M) (M)==0
1874218804
# define DbMaskNonZero(M) (M)!=0
1874318805
#endif
1874418806
18807
+/*
18808
+** An instance of the ParseCleanup object specifies an operation that
18809
+** should be performed after parsing to deallocation resources obtained
18810
+** during the parse and which are no longer needed.
18811
+*/
18812
+struct ParseCleanup {
18813
+ ParseCleanup *pNext; /* Next cleanup task */
18814
+ void *pPtr; /* Pointer to object to deallocate */
18815
+ void (*xCleanup)(sqlite3*,void*); /* Deallocation routine */
18816
+};
18817
+
1874518818
/*
1874618819
** An SQL parser context. A copy of this structure is passed through
1874718820
** the parser and down into all the parser action routine in order to
1874818821
** carry around information that is global to the entire parse.
1874918822
**
@@ -18771,10 +18844,13 @@
1877118844
u8 mayAbort; /* True if statement may throw an ABORT exception */
1877218845
u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
1877318846
u8 okConstFactor; /* OK to factor out constants */
1877418847
u8 disableLookaside; /* Number of times lookaside has been disabled */
1877518848
u8 disableVtab; /* Disable all virtual tables for this parse */
18849
+#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
18850
+ u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
18851
+#endif
1877618852
int nRangeReg; /* Size of the temporary register block */
1877718853
int iRangeReg; /* First register in temporary register block */
1877818854
int nErr; /* Number of errors seen */
1877918855
int nTab; /* Number of previously allocated VDBE cursors */
1878018856
int nMem; /* Number of memory cells used so far */
@@ -18849,14 +18925,13 @@
1884918925
const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
1885018926
#ifndef SQLITE_OMIT_VIRTUALTABLE
1885118927
Token sArg; /* Complete text of a module argument */
1885218928
Table **apVtabLock; /* Pointer to virtual tables needing locking */
1885318929
#endif
18854
- Table *pZombieTab; /* List of Table objects to delete after code gen */
1885518930
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
1885618931
With *pWith; /* Current WITH clause, or NULL */
18857
- With *pWithToFree; /* Free this WITH object at the end of the parse */
18932
+ ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
1885818933
#ifndef SQLITE_OMIT_ALTERTABLE
1885918934
RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
1886018935
#endif
1886118936
};
1886218937
@@ -18932,10 +19007,11 @@
1893219007
#define OPFLAG_P2ISREG 0x10 /* P2 to OP_Open** is a register number */
1893319008
#define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */
1893419009
#define OPFLAG_SAVEPOSITION 0x02 /* OP_Delete/Insert: save cursor pos */
1893519010
#define OPFLAG_AUXDELETE 0x04 /* OP_Delete: index in a DELETE op */
1893619011
#define OPFLAG_NOCHNG_MAGIC 0x6d /* OP_MakeRecord: serialtype 10 is ok */
19012
+#define OPFLAG_PREFORMAT 0x80 /* OP_Insert uses preformatted cell */
1893719013
1893819014
/*
1893919015
* Each trigger present in the database schema is stored as an instance of
1894019016
* struct Trigger.
1894119017
*
@@ -19310,11 +19386,10 @@
1931019386
SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin);
1931119387
SQLITE_PRIVATE int sqlite3WindowCompare(Parse*, Window*, Window*, int);
1931219388
SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Select*);
1931319389
SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int);
1931419390
SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*);
19315
-SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*);
1931619391
SQLITE_PRIVATE void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*);
1931719392
SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p);
1931819393
SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p);
1931919394
SQLITE_PRIVATE void sqlite3WindowFunctions(void);
1932019395
SQLITE_PRIVATE void sqlite3WindowChain(Parse*, Window*, Window*);
@@ -19720,10 +19795,11 @@
1972019795
SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
1972119796
SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
1972219797
SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
1972319798
SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
1972419799
SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo*);
19800
+SQLITE_PRIVATE void sqlite3WhereMinMaxOptEarlyOut(Vdbe*,WhereInfo*);
1972519801
SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*);
1972619802
SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*);
1972719803
SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*);
1972819804
SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*);
1972919805
#define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */
@@ -19966,10 +20042,11 @@
1996620042
SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr);
1996720043
SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
1996820044
SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
1996920045
SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
1997020046
SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
20047
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*);
1997120048
SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
1997220049
SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
1997320050
SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
1997420051
SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
1997520052
@@ -20029,11 +20106,10 @@
2002920106
SQLITE_PRIVATE const char sqlite3StrBINARY[];
2003020107
SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
2003120108
SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
2003220109
SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;
2003320110
SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;
20034
-SQLITE_API extern u32 sqlite3_unsupported_selecttrace;
2003520111
#ifndef SQLITE_OMIT_WSD
2003620112
SQLITE_PRIVATE int sqlite3PendingByte;
2003720113
#endif
2003820114
#endif /* SQLITE_AMALGAMATION */
2003920115
#ifdef VDBE_PROFILE
@@ -20048,10 +20124,11 @@
2004820124
SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
2004920125
SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
2005020126
SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
2005120127
SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
2005220128
SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
20129
+SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*);
2005320130
SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
2005420131
SQLITE_PRIVATE int sqlite3MatchEName(
2005520132
const struct ExprList_item*,
2005620133
const char*,
2005720134
const char*,
@@ -20218,10 +20295,11 @@
2021820295
SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
2021920296
SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
2022020297
SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
2022120298
SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
2022220299
SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
20300
+SQLITE_PRIVATE void sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
2022320301
#ifdef SQLITE_ENABLE_NORMALIZE
2022420302
SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
2022520303
#endif
2022620304
SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
2022720305
SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
@@ -20240,19 +20318,23 @@
2024020318
#else
2024120319
#define sqlite3WithPush(x,y,z)
2024220320
#define sqlite3WithDelete(x,y)
2024320321
#endif
2024420322
#ifndef SQLITE_OMIT_UPSERT
20245
-SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*);
20323
+SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
2024620324
SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
2024720325
SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
2024820326
SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
2024920327
SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
20328
+SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert*,Index*);
20329
+SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert*);
2025020330
#else
20251
-#define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0)
20331
+#define sqlite3UpsertNew(u,v,w,x,y,z) ((Upsert*)0)
2025220332
#define sqlite3UpsertDelete(x,y)
20253
-#define sqlite3UpsertDup(x,y) ((Upsert*)0)
20333
+#define sqlite3UpsertDup(x,y) ((Upsert*)0)
20334
+#define sqlite3UpsertOfIndex(x,y) ((Upsert*)0)
20335
+#define sqlite3UpsertNextIsIPK(x) 0
2025420336
#endif
2025520337
2025620338
2025720339
/* Declarations for functions in fkey.c. All of these are replaced by
2025820340
** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
@@ -20744,13 +20826,14 @@
2074420826
#ifndef SQLITE_OMIT_WSD
2074520827
SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
2074620828
#endif
2074720829
2074820830
/*
20749
-** Flags for select tracing and the ".selecttrace" macro of the CLI
20831
+** Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS.
2075020832
*/
20751
-SQLITE_API u32 sqlite3_unsupported_selecttrace = 0;
20833
+SQLITE_PRIVATE u32 sqlite3SelectTrace = 0;
20834
+SQLITE_PRIVATE u32 sqlite3WhereTrace = 0;
2075220835
2075320836
/* #include "opcodes.h" */
2075420837
/*
2075520838
** Properties of opcodes. The OPFLG_INITIALIZER macro is
2075620839
** created by mkopcodeh.awk during compilation. Data is obtained
@@ -23170,10 +23253,12 @@
2317023253
SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
2317123254
if( id->pMethods==0 ) return SQLITE_NOTFOUND;
2317223255
#ifdef SQLITE_TEST
2317323256
if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
2317423257
&& op!=SQLITE_FCNTL_LOCK_TIMEOUT
23258
+ && op!=SQLITE_FCNTL_CKPT_DONE
23259
+ && op!=SQLITE_FCNTL_CKPT_START
2317523260
){
2317623261
/* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
2317723262
** is using a regular VFS, it is called after the corresponding
2317823263
** transaction has been committed. Injecting a fault at this point
2317923264
** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
@@ -23180,11 +23265,16 @@
2318023265
** but the transaction is committed anyway.
2318123266
**
2318223267
** The core must call OsFileControl() though, not OsFileControlHint(),
2318323268
** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
2318423269
** means the commit really has failed and an error should be returned
23185
- ** to the user. */
23270
+ ** to the user.
23271
+ **
23272
+ ** The CKPT_DONE and CKPT_START file-controls are write-only signals
23273
+ ** to the cksumvfs. Their return code is meaningless and is ignored
23274
+ ** by the SQLite core, so there is no point in simulating OOMs for them.
23275
+ */
2318623276
DO_OS_MALLOC_TEST(id);
2318723277
}
2318823278
#endif
2318923279
return id->pMethods->xFileControl(id, op, pArg);
2319023280
}
@@ -31381,10 +31471,20 @@
3138131471
SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
3138231472
assert( db!=0 );
3138331473
db->errCode = err_code;
3138431474
if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
3138531475
}
31476
+
31477
+/*
31478
+** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
31479
+** and error message.
31480
+*/
31481
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
31482
+ assert( db!=0 );
31483
+ db->errCode = SQLITE_OK;
31484
+ if( db->pErr ) sqlite3ValueSetNull(db->pErr);
31485
+}
3138631486
3138731487
/*
3138831488
** Load the sqlite3.iSysErrno field if that is an appropriate thing
3138931489
** to do based on the SQLite error code in rc.
3139031490
*/
@@ -33371,64 +33471,65 @@
3337133471
/* 118 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
3337233472
/* 119 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
3337333473
/* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
3337433474
/* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
3337533475
/* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
33376
- /* 123 */ "Delete" OpHelp(""),
33377
- /* 124 */ "ResetCount" OpHelp(""),
33378
- /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
33379
- /* 126 */ "SorterData" OpHelp("r[P2]=data"),
33380
- /* 127 */ "RowData" OpHelp("r[P2]=data"),
33381
- /* 128 */ "Rowid" OpHelp("r[P2]=rowid"),
33382
- /* 129 */ "NullRow" OpHelp(""),
33383
- /* 130 */ "SeekEnd" OpHelp(""),
33384
- /* 131 */ "IdxInsert" OpHelp("key=r[P2]"),
33385
- /* 132 */ "SorterInsert" OpHelp("key=r[P2]"),
33386
- /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
33387
- /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
33388
- /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"),
33389
- /* 136 */ "FinishSeek" OpHelp(""),
33390
- /* 137 */ "Destroy" OpHelp(""),
33391
- /* 138 */ "Clear" OpHelp(""),
33392
- /* 139 */ "ResetSorter" OpHelp(""),
33393
- /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
33394
- /* 141 */ "SqlExec" OpHelp(""),
33395
- /* 142 */ "ParseSchema" OpHelp(""),
33396
- /* 143 */ "LoadAnalysis" OpHelp(""),
33397
- /* 144 */ "DropTable" OpHelp(""),
33398
- /* 145 */ "DropIndex" OpHelp(""),
33399
- /* 146 */ "DropTrigger" OpHelp(""),
33400
- /* 147 */ "IntegrityCk" OpHelp(""),
33401
- /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
33402
- /* 149 */ "Param" OpHelp(""),
33476
+ /* 123 */ "RowCell" OpHelp(""),
33477
+ /* 124 */ "Delete" OpHelp(""),
33478
+ /* 125 */ "ResetCount" OpHelp(""),
33479
+ /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
33480
+ /* 127 */ "SorterData" OpHelp("r[P2]=data"),
33481
+ /* 128 */ "RowData" OpHelp("r[P2]=data"),
33482
+ /* 129 */ "Rowid" OpHelp("r[P2]=rowid"),
33483
+ /* 130 */ "NullRow" OpHelp(""),
33484
+ /* 131 */ "SeekEnd" OpHelp(""),
33485
+ /* 132 */ "IdxInsert" OpHelp("key=r[P2]"),
33486
+ /* 133 */ "SorterInsert" OpHelp("key=r[P2]"),
33487
+ /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
33488
+ /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
33489
+ /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"),
33490
+ /* 137 */ "FinishSeek" OpHelp(""),
33491
+ /* 138 */ "Destroy" OpHelp(""),
33492
+ /* 139 */ "Clear" OpHelp(""),
33493
+ /* 140 */ "ResetSorter" OpHelp(""),
33494
+ /* 141 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
33495
+ /* 142 */ "SqlExec" OpHelp(""),
33496
+ /* 143 */ "ParseSchema" OpHelp(""),
33497
+ /* 144 */ "LoadAnalysis" OpHelp(""),
33498
+ /* 145 */ "DropTable" OpHelp(""),
33499
+ /* 146 */ "DropIndex" OpHelp(""),
33500
+ /* 147 */ "DropTrigger" OpHelp(""),
33501
+ /* 148 */ "IntegrityCk" OpHelp(""),
33502
+ /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
3340333503
/* 150 */ "Real" OpHelp("r[P2]=P4"),
33404
- /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
33405
- /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
33406
- /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
33407
- /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
33408
- /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
33409
- /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
33410
- /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"),
33411
- /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
33412
- /* 159 */ "Expire" OpHelp(""),
33413
- /* 160 */ "CursorLock" OpHelp(""),
33414
- /* 161 */ "CursorUnlock" OpHelp(""),
33415
- /* 162 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
33416
- /* 163 */ "VBegin" OpHelp(""),
33417
- /* 164 */ "VCreate" OpHelp(""),
33418
- /* 165 */ "VDestroy" OpHelp(""),
33419
- /* 166 */ "VOpen" OpHelp(""),
33420
- /* 167 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
33421
- /* 168 */ "VRename" OpHelp(""),
33422
- /* 169 */ "Pagecount" OpHelp(""),
33423
- /* 170 */ "MaxPgcnt" OpHelp(""),
33424
- /* 171 */ "Trace" OpHelp(""),
33425
- /* 172 */ "CursorHint" OpHelp(""),
33426
- /* 173 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
33427
- /* 174 */ "Noop" OpHelp(""),
33428
- /* 175 */ "Explain" OpHelp(""),
33429
- /* 176 */ "Abortable" OpHelp(""),
33504
+ /* 151 */ "Param" OpHelp(""),
33505
+ /* 152 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
33506
+ /* 153 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
33507
+ /* 154 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
33508
+ /* 155 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
33509
+ /* 156 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
33510
+ /* 157 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
33511
+ /* 158 */ "AggValue" OpHelp("r[P3]=value N=P2"),
33512
+ /* 159 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
33513
+ /* 160 */ "Expire" OpHelp(""),
33514
+ /* 161 */ "CursorLock" OpHelp(""),
33515
+ /* 162 */ "CursorUnlock" OpHelp(""),
33516
+ /* 163 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
33517
+ /* 164 */ "VBegin" OpHelp(""),
33518
+ /* 165 */ "VCreate" OpHelp(""),
33519
+ /* 166 */ "VDestroy" OpHelp(""),
33520
+ /* 167 */ "VOpen" OpHelp(""),
33521
+ /* 168 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
33522
+ /* 169 */ "VRename" OpHelp(""),
33523
+ /* 170 */ "Pagecount" OpHelp(""),
33524
+ /* 171 */ "MaxPgcnt" OpHelp(""),
33525
+ /* 172 */ "Trace" OpHelp(""),
33526
+ /* 173 */ "CursorHint" OpHelp(""),
33527
+ /* 174 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
33528
+ /* 175 */ "Noop" OpHelp(""),
33529
+ /* 176 */ "Explain" OpHelp(""),
33530
+ /* 177 */ "Abortable" OpHelp(""),
3343033531
};
3343133532
return azName[i];
3343233533
}
3343333534
#endif
3343433535
@@ -64147,10 +64248,11 @@
6414764248
BtShared *pNext; /* Next on a list of sharable BtShared structs */
6414864249
BtLock *pLock; /* List of locks held on this shared-btree struct */
6414964250
Btree *pWriter; /* Btree with currently open write transaction */
6415064251
#endif
6415164252
u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */
64253
+ int nPreformatSize; /* Size of last cell written by TransferRow() */
6415264254
};
6415364255
6415464256
/*
6415564257
** Allowed values for BtShared.btsFlags
6415664258
*/
@@ -65859,10 +65961,28 @@
6585965961
}else{
6586065962
pInfo->nLocal = (u16)minLocal;
6586165963
}
6586265964
pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
6586365965
}
65966
+
65967
+/*
65968
+** Given a record with nPayload bytes of payload stored within btree
65969
+** page pPage, return the number of bytes of payload stored locally.
65970
+*/
65971
+static int btreePayloadToLocal(MemPage *pPage, i64 nPayload){
65972
+ int maxLocal; /* Maximum amount of payload held locally */
65973
+ maxLocal = pPage->maxLocal;
65974
+ if( nPayload<=maxLocal ){
65975
+ return nPayload;
65976
+ }else{
65977
+ int minLocal; /* Minimum amount of payload held locally */
65978
+ int surplus; /* Overflow payload available for local storage */
65979
+ minLocal = pPage->minLocal;
65980
+ surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize-4);
65981
+ return ( surplus <= maxLocal ) ? surplus : minLocal;
65982
+ }
65983
+}
6586465984
6586565985
/*
6586665986
** The following routines are implementations of the MemPage.xParseCell()
6586765987
** method.
6586865988
**
@@ -73377,11 +73497,12 @@
7337773497
Btree *p = pCur->pBtree;
7337873498
BtShared *pBt = p->pBt;
7337973499
unsigned char *oldCell;
7338073500
unsigned char *newCell = 0;
7338173501
73382
- assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND))==flags );
73502
+ assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND|BTREE_PREFORMAT))==flags );
73503
+ assert( (flags & BTREE_PREFORMAT)==0 || seekResult || pCur->pKeyInfo==0 );
7338373504
7338473505
if( pCur->eState==CURSOR_FAULT ){
7338573506
assert( pCur->skipNext!=SQLITE_OK );
7338673507
return pCur->skipNext;
7338773508
}
@@ -73395,11 +73516,11 @@
7339573516
/* Assert that the caller has been consistent. If this cursor was opened
7339673517
** expecting an index b-tree, then the caller should be inserting blob
7339773518
** keys with no associated data. If the cursor was opened expecting an
7339873519
** intkey table, the caller should be inserting integer keys with a
7339973520
** blob of associated data. */
73400
- assert( (pX->pKey==0)==(pCur->pKeyInfo==0) );
73521
+ assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );
7340173522
7340273523
/* Save the positions of any other cursors open on this table.
7340373524
**
7340473525
** In some cases, the call to btreeMoveto() below is a no-op. For
7340573526
** example, when inserting data into a table with auto-generated integer
@@ -73505,11 +73626,11 @@
7350573626
assert( pCur->eState==CURSOR_VALID
7350673627
|| (pCur->eState==CURSOR_INVALID && loc)
7350773628
|| CORRUPT_DB );
7350873629
7350973630
pPage = pCur->pPage;
73510
- assert( pPage->intKey || pX->nKey>=0 );
73631
+ assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
7351173632
assert( pPage->leaf || !pPage->intKey );
7351273633
if( pPage->nFree<0 ){
7351373634
if( pCur->eState>CURSOR_INVALID ){
7351473635
rc = SQLITE_CORRUPT_BKPT;
7351573636
}else{
@@ -73522,11 +73643,25 @@
7352273643
pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
7352373644
loc==0 ? "overwrite" : "new entry"));
7352473645
assert( pPage->isInit );
7352573646
newCell = pBt->pTmpSpace;
7352673647
assert( newCell!=0 );
73527
- rc = fillInCell(pPage, newCell, pX, &szNew);
73648
+ if( flags & BTREE_PREFORMAT ){
73649
+ rc = SQLITE_OK;
73650
+ szNew = pBt->nPreformatSize;
73651
+ if( szNew<4 ) szNew = 4;
73652
+ if( ISAUTOVACUUM && szNew>pPage->maxLocal ){
73653
+ CellInfo info;
73654
+ pPage->xParseCell(pPage, newCell, &info);
73655
+ if( info.nPayload!=info.nLocal ){
73656
+ Pgno ovfl = get4byte(&newCell[szNew-4]);
73657
+ ptrmapPut(pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc);
73658
+ }
73659
+ }
73660
+ }else{
73661
+ rc = fillInCell(pPage, newCell, pX, &szNew);
73662
+ }
7352873663
if( rc ) goto end_insert;
7352973664
assert( szNew==pPage->xCellSize(pPage, newCell) );
7353073665
assert( szNew <= MX_CELL_SIZE(pBt) );
7353173666
idx = pCur->ix;
7353273667
if( loc==0 ){
@@ -73626,10 +73761,118 @@
7362673761
}
7362773762
}
7362873763
assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );
7362973764
7363073765
end_insert:
73766
+ return rc;
73767
+}
73768
+
73769
+/*
73770
+** This function is used as part of copying the current row from cursor
73771
+** pSrc into cursor pDest. If the cursors are open on intkey tables, then
73772
+** parameter iKey is used as the rowid value when the record is copied
73773
+** into pDest. Otherwise, the record is copied verbatim.
73774
+**
73775
+** This function does not actually write the new value to cursor pDest.
73776
+** Instead, it creates and populates any required overflow pages and
73777
+** writes the data for the new cell into the BtShared.pTmpSpace buffer
73778
+** for the destination database. The size of the cell, in bytes, is left
73779
+** in BtShared.nPreformatSize. The caller completes the insertion by
73780
+** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified.
73781
+**
73782
+** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
73783
+*/
73784
+SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
73785
+ int rc = SQLITE_OK;
73786
+ BtShared *pBt = pDest->pBt;
73787
+ u8 *aOut = pBt->pTmpSpace; /* Pointer to next output buffer */
73788
+ const u8 *aIn; /* Pointer to next input buffer */
73789
+ u32 nIn; /* Size of input buffer aIn[] */
73790
+ u32 nRem; /* Bytes of data still to copy */
73791
+
73792
+ getCellInfo(pSrc);
73793
+ aOut += putVarint32(aOut, pSrc->info.nPayload);
73794
+ if( pDest->pKeyInfo==0 ) aOut += putVarint(aOut, iKey);
73795
+ nIn = pSrc->info.nLocal;
73796
+ aIn = pSrc->info.pPayload;
73797
+ if( aIn+nIn>pSrc->pPage->aDataEnd ){
73798
+ return SQLITE_CORRUPT_BKPT;
73799
+ }
73800
+ nRem = pSrc->info.nPayload;
73801
+ if( nIn==nRem && nIn<pDest->pPage->maxLocal ){
73802
+ memcpy(aOut, aIn, nIn);
73803
+ pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace);
73804
+ }else{
73805
+ Pager *pSrcPager = pSrc->pBt->pPager;
73806
+ u8 *pPgnoOut = 0;
73807
+ Pgno ovflIn = 0;
73808
+ DbPage *pPageIn = 0;
73809
+ MemPage *pPageOut = 0;
73810
+ u32 nOut; /* Size of output buffer aOut[] */
73811
+
73812
+ nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
73813
+ pBt->nPreformatSize = nOut + (aOut - pBt->pTmpSpace);
73814
+ if( nOut<pSrc->info.nPayload ){
73815
+ pPgnoOut = &aOut[nOut];
73816
+ pBt->nPreformatSize += 4;
73817
+ }
73818
+
73819
+ if( nRem>nIn ){
73820
+ if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
73821
+ return SQLITE_CORRUPT_BKPT;
73822
+ }
73823
+ ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
73824
+ }
73825
+
73826
+ do {
73827
+ nRem -= nOut;
73828
+ do{
73829
+ assert( nOut>0 );
73830
+ if( nIn>0 ){
73831
+ int nCopy = MIN(nOut, nIn);
73832
+ memcpy(aOut, aIn, nCopy);
73833
+ nOut -= nCopy;
73834
+ nIn -= nCopy;
73835
+ aOut += nCopy;
73836
+ aIn += nCopy;
73837
+ }
73838
+ if( nOut>0 ){
73839
+ sqlite3PagerUnref(pPageIn);
73840
+ pPageIn = 0;
73841
+ rc = sqlite3PagerGet(pSrcPager, ovflIn, &pPageIn, PAGER_GET_READONLY);
73842
+ if( rc==SQLITE_OK ){
73843
+ aIn = (const u8*)sqlite3PagerGetData(pPageIn);
73844
+ ovflIn = get4byte(aIn);
73845
+ aIn += 4;
73846
+ nIn = pSrc->pBt->usableSize - 4;
73847
+ }
73848
+ }
73849
+ }while( rc==SQLITE_OK && nOut>0 );
73850
+
73851
+ if( rc==SQLITE_OK && nRem>0 ){
73852
+ Pgno pgnoNew;
73853
+ MemPage *pNew = 0;
73854
+ rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
73855
+ put4byte(pPgnoOut, pgnoNew);
73856
+ if( ISAUTOVACUUM && pPageOut ){
73857
+ ptrmapPut(pBt, pgnoNew, PTRMAP_OVERFLOW2, pPageOut->pgno, &rc);
73858
+ }
73859
+ releasePage(pPageOut);
73860
+ pPageOut = pNew;
73861
+ if( pPageOut ){
73862
+ pPgnoOut = pPageOut->aData;
73863
+ put4byte(pPgnoOut, 0);
73864
+ aOut = &pPgnoOut[4];
73865
+ nOut = MIN(pBt->usableSize - 4, nRem);
73866
+ }
73867
+ }
73868
+ }while( nRem>0 && rc==SQLITE_OK );
73869
+
73870
+ releasePage(pPageOut);
73871
+ sqlite3PagerUnref(pPageIn);
73872
+ }
73873
+
7363173874
return rc;
7363273875
}
7363373876
7363473877
/*
7363573878
** Delete the entry that the cursor is pointing to.
@@ -80340,10 +80583,12 @@
8034080583
assert( p!=0 );
8034180584
assert( p->nOp>0 );
8034280585
assert( pParse!=0 );
8034380586
assert( p->magic==VDBE_MAGIC_INIT );
8034480587
assert( pParse==p->pParse );
80588
+ p->pVList = pParse->pVList;
80589
+ pParse->pVList = 0;
8034580590
db = p->db;
8034680591
assert( db->mallocFailed==0 );
8034780592
nVar = pParse->nVar;
8034880593
nMem = pParse->nMem;
8034980594
nCursor = pParse->nTab;
@@ -80424,12 +80669,10 @@
8042480669
p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
8042580670
#endif
8042680671
}
8042780672
}
8042880673
80429
- p->pVList = pParse->pVList;
80430
- pParse->pVList = 0;
8043180674
if( db->mallocFailed ){
8043280675
p->nVar = 0;
8043380676
p->nCursor = 0;
8043480677
p->nMem = 0;
8043580678
}else{
@@ -85414,11 +85657,11 @@
8541485657
testcase( zRawSql[0]=='#' );
8541585658
idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken);
8541685659
assert( idx>0 );
8541785660
}
8541885661
zRawSql += nToken;
85419
- nextIndex = idx + 1;
85662
+ nextIndex = MAX(idx + 1, nextIndex);
8542085663
assert( idx>0 && idx<=p->nVar );
8542185664
pVar = &p->aVar[idx-1];
8542285665
if( pVar->flags & MEM_Null ){
8542385666
sqlite3_str_append(&out, "NULL", 4);
8542485667
}else if( pVar->flags & (MEM_Int|MEM_IntReal) ){
@@ -90701,11 +90944,12 @@
9070190944
}else{
9070290945
x.nZero = 0;
9070390946
}
9070490947
x.pKey = 0;
9070590948
rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
90706
- (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)), seekResult
90949
+ (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
90950
+ seekResult
9070790951
);
9070890952
pC->deferredMoveto = 0;
9070990953
pC->cacheStatus = CACHE_STALE;
9071090954
9071190955
/* Invoke the update-hook if required. */
@@ -90717,10 +90961,37 @@
9071790961
(pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,
9071890962
zDb, pTab->zName, x.nKey);
9071990963
}
9072090964
break;
9072190965
}
90966
+
90967
+/* Opcode: RowCell P1 P2 P3 * *
90968
+**
90969
+** P1 and P2 are both open cursors. Both must be opened on the same type
90970
+** of table - intkey or index. This opcode is used as part of copying
90971
+** the current row from P2 into P1. If the cursors are opened on intkey
90972
+** tables, register P3 contains the rowid to use with the new record in
90973
+** P1. If they are opened on index tables, P3 is not used.
90974
+**
90975
+** This opcode must be followed by either an Insert or InsertIdx opcode
90976
+** with the OPFLAG_PREFORMAT flag set to complete the insert operation.
90977
+*/
90978
+case OP_RowCell: {
90979
+ VdbeCursor *pDest; /* Cursor to write to */
90980
+ VdbeCursor *pSrc; /* Cursor to read from */
90981
+ i64 iKey; /* Rowid value to insert with */
90982
+ assert( pOp[1].opcode==OP_Insert || pOp[1].opcode==OP_IdxInsert );
90983
+ assert( pOp[1].opcode==OP_Insert || pOp->p3==0 );
90984
+ assert( pOp[1].opcode==OP_IdxInsert || pOp->p3>0 );
90985
+ assert( pOp[1].p5 & OPFLAG_PREFORMAT );
90986
+ pDest = p->apCsr[pOp->p1];
90987
+ pSrc = p->apCsr[pOp->p2];
90988
+ iKey = pOp->p3 ? aMem[pOp->p3].u.i : 0;
90989
+ rc = sqlite3BtreeTransferRow(pDest->uc.pCursor, pSrc->uc.pCursor, iKey);
90990
+ if( rc!=SQLITE_OK ) goto abort_due_to_error;
90991
+ break;
90992
+};
9072290993
9072390994
/* Opcode: Delete P1 P2 P3 P4 P5
9072490995
**
9072590996
** Delete the record at which the P1 cursor is currently pointing.
9072690997
**
@@ -91373,11 +91644,11 @@
9137391644
pC = p->apCsr[pOp->p1];
9137491645
sqlite3VdbeIncrWriteCounter(p, pC);
9137591646
assert( pC!=0 );
9137691647
assert( !isSorter(pC) );
9137791648
pIn2 = &aMem[pOp->p2];
91378
- assert( pIn2->flags & MEM_Blob );
91649
+ assert( (pIn2->flags & MEM_Blob) || (pOp->p5 & OPFLAG_PREFORMAT) );
9137991650
if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
9138091651
assert( pC->eCurType==CURTYPE_BTREE );
9138191652
assert( pC->isTable==0 );
9138291653
rc = ExpandBlob(pIn2);
9138391654
if( rc ) goto abort_due_to_error;
@@ -91384,11 +91655,11 @@
9138491655
x.nKey = pIn2->n;
9138591656
x.pKey = pIn2->z;
9138691657
x.aMem = aMem + pOp->p3;
9138791658
x.nMem = (u16)pOp->p4.i;
9138891659
rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
91389
- (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)),
91660
+ (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
9139091661
((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
9139191662
);
9139291663
assert( pC->deferredMoveto==0 );
9139391664
pC->cacheStatus = CACHE_STALE;
9139491665
if( rc) goto abort_due_to_error;
@@ -97975,11 +98246,11 @@
9797598246
#if !defined(SQLITE_OMIT_WINDOWFUNC)
9797698247
/*
9797798248
** Walk all expressions linked into the list of Window objects passed
9797898249
** as the second argument.
9797998250
*/
97980
-static int walkWindowList(Walker *pWalker, Window *pList){
98251
+static int walkWindowList(Walker *pWalker, Window *pList, int bOneOnly){
9798198252
Window *pWin;
9798298253
for(pWin=pList; pWin; pWin=pWin->pNextWin){
9798398254
int rc;
9798498255
rc = sqlite3WalkExprList(pWalker, pWin->pOrderBy);
9798598256
if( rc ) return WRC_Abort;
@@ -97994,10 +98265,11 @@
9799498265
** not matter anyhow. */
9799598266
rc = sqlite3WalkExpr(pWalker, pWin->pStart);
9799698267
if( NEVER(rc) ) return WRC_Abort;
9799798268
rc = sqlite3WalkExpr(pWalker, pWin->pEnd);
9799898269
if( NEVER(rc) ) return WRC_Abort;
98270
+ if( bOneOnly ) break;
9799998271
}
9800098272
return WRC_Continue;
9800198273
}
9800298274
#endif
9800398275
@@ -98041,11 +98313,11 @@
9804198313
if( pExpr->x.pList ){
9804298314
if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
9804398315
}
9804498316
#ifndef SQLITE_OMIT_WINDOWFUNC
9804598317
if( ExprHasProperty(pExpr, EP_WinFunc) ){
98046
- if( walkWindowList(pWalker, pExpr->y.pWin) ) return WRC_Abort;
98318
+ if( walkWindowList(pWalker, pExpr->y.pWin, 1) ) return WRC_Abort;
9804798319
}
9804898320
#endif
9804998321
}
9805098322
}
9805198323
break;
@@ -98088,11 +98360,11 @@
9808898360
{
9808998361
Parse *pParse = pWalker->pParse;
9809098362
if( pParse && IN_RENAME_OBJECT ){
9809198363
/* The following may return WRC_Abort if there are unresolvable
9809298364
** symbols (e.g. a table that does not exist) in a window definition. */
98093
- int rc = walkWindowList(pWalker, p->pWinDefn);
98365
+ int rc = walkWindowList(pWalker, p->pWinDefn, 0);
9809498366
return rc;
9809598367
}
9809698368
}
9809798369
#endif
9809898370
return WRC_Continue;
@@ -100258,11 +100530,22 @@
100258100530
Parse *pParse, /* Parsing context */
100259100531
Expr *pExpr, /* Add the "COLLATE" clause to this expression */
100260100532
const Token *pCollName, /* Name of collating sequence */
100261100533
int dequote /* True to dequote pCollName */
100262100534
){
100263
- if( pCollName->n>0 ){
100535
+ assert( pExpr!=0 || pParse->db->mallocFailed );
100536
+ if( pExpr==0 ) return 0;
100537
+ if( pExpr->op==TK_VECTOR ){
100538
+ ExprList *pList = pExpr->x.pList;
100539
+ if( ALWAYS(pList!=0) ){
100540
+ int i;
100541
+ for(i=0; i<pList->nExpr; i++){
100542
+ pList->a[i].pExpr = sqlite3ExprAddCollateToken(pParse,pList->a[i].pExpr,
100543
+ pCollName, dequote);
100544
+ }
100545
+ }
100546
+ }else if( pCollName->n>0 ){
100264100547
Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);
100265100548
if( pNew ){
100266100549
pNew->pLeft = pExpr;
100267100550
pNew->flags |= EP_Collate|EP_Skip;
100268100551
pExpr = pNew;
@@ -106634,15 +106917,18 @@
106634106917
u32 savedDbFlags = db->mDbFlags;
106635106918
while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
106636106919
*zEnd-- = '\0';
106637106920
}
106638106921
db->mDbFlags |= DBFLAG_PreferBuiltin;
106922
+ /* substr() operations on characters, but addColOffset is in bytes. So we
106923
+ ** have to use printf() to translate between these units: */
106639106924
sqlite3NestedParse(pParse,
106640106925
"UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
106641
- "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
106926
+ "sql = printf('%%.%ds, ',sql) || %Q"
106927
+ " || substr(sql,1+length(printf('%%.%ds',sql))) "
106642106928
"WHERE type = 'table' AND name = %Q",
106643
- zDb, pNew->addColOffset, zCol, pNew->addColOffset+1,
106929
+ zDb, pNew->addColOffset, zCol, pNew->addColOffset,
106644106930
zTab
106645106931
);
106646106932
sqlite3DbFree(db, zCol);
106647106933
db->mDbFlags = savedDbFlags;
106648106934
}
@@ -110798,15 +111084,11 @@
110798111084
110799111085
/* Don't do any authorization checks if the database is initialising
110800111086
** or if the parser is being invoked from within sqlite3_declare_vtab.
110801111087
*/
110802111088
assert( !IN_RENAME_OBJECT || db->xAuth==0 );
110803
- if( db->init.busy || IN_SPECIAL_PARSE ){
110804
- return SQLITE_OK;
110805
- }
110806
-
110807
- if( db->xAuth==0 ){
111089
+ if( db->xAuth==0 || db->init.busy || IN_SPECIAL_PARSE ){
110808111090
return SQLITE_OK;
110809111091
}
110810111092
110811111093
/* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the
110812111094
** callback are either NULL pointers or zero-terminated strings that
@@ -111008,10 +111290,14 @@
111008111290
}
111009111291
111010111292
/* Begin by generating some termination code at the end of the
111011111293
** vdbe program
111012111294
*/
111295
+ if( pParse->pVdbe==0 && db->init.busy ){
111296
+ pParse->rc = SQLITE_DONE;
111297
+ return;
111298
+ }
111013111299
v = sqlite3GetVdbe(pParse);
111014111300
assert( !pParse->isMultiWrite
111015111301
|| sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
111016111302
if( v ){
111017111303
sqlite3VdbeAddOp0(v, OP_Halt);
@@ -112120,10 +112406,12 @@
112120112406
int i;
112121112407
char *z;
112122112408
char *zType;
112123112409
Column *pCol;
112124112410
sqlite3 *db = pParse->db;
112411
+ u8 hName;
112412
+
112125112413
if( (p = pParse->pNewTable)==0 ) return;
112126112414
if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
112127112415
sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
112128112416
return;
112129112417
}
@@ -112131,12 +112419,13 @@
112131112419
if( z==0 ) return;
112132112420
if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName);
112133112421
memcpy(z, pName->z, pName->n);
112134112422
z[pName->n] = 0;
112135112423
sqlite3Dequote(z);
112424
+ hName = sqlite3StrIHash(z);
112136112425
for(i=0; i<p->nCol; i++){
112137
- if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){
112426
+ if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zName)==0 ){
112138112427
sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
112139112428
sqlite3DbFree(db, z);
112140112429
return;
112141112430
}
112142112431
}
@@ -112150,11 +112439,11 @@
112150112439
p->aCol = aNew;
112151112440
}
112152112441
pCol = &p->aCol[p->nCol];
112153112442
memset(pCol, 0, sizeof(p->aCol[0]));
112154112443
pCol->zName = z;
112155
- pCol->hName = sqlite3StrIHash(z);
112444
+ pCol->hName = hName;
112156112445
sqlite3ColumnPropertiesFromName(p, pCol);
112157112446
112158112447
if( pType->n==0 ){
112159112448
/* If there is no type specified, columns have the default affinity
112160112449
** 'BLOB' with a default size of 4 bytes. */
@@ -113426,11 +113715,11 @@
113426113715
assert( !pSelect && pCons && pEnd );
113427113716
if( pCons->z==0 ){
113428113717
pCons = pEnd;
113429113718
}
113430113719
nName = (int)((const char *)pCons->z - zName);
113431
- p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
113720
+ p->addColOffset = 13 + nName;
113432113721
}
113433113722
#endif
113434113723
}
113435113724
}
113436113725
@@ -119441,10 +119730,206 @@
119441119730
}
119442119731
119443119732
*pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;
119444119733
return 1;
119445119734
}
119735
+
119736
+/* Mathematical Constants */
119737
+#ifndef M_PI
119738
+# define M_PI 3.141592653589793238462643383279502884
119739
+#endif
119740
+#ifndef M_LN10
119741
+# define M_LN10 2.302585092994045684017991454684364208
119742
+#endif
119743
+#ifndef M_LN2
119744
+# define M_LN2 0.693147180559945309417232121458176568
119745
+#endif
119746
+
119747
+
119748
+/* Extra math functions that require linking with -lm
119749
+*/
119750
+#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
119751
+/*
119752
+** Implementation SQL functions:
119753
+**
119754
+** ceil(X)
119755
+** ceiling(X)
119756
+** floor(X)
119757
+**
119758
+** The sqlite3_user_data() pointer is a pointer to the libm implementation
119759
+** of the underlying C function.
119760
+*/
119761
+static void ceilingFunc(
119762
+ sqlite3_context *context,
119763
+ int argc,
119764
+ sqlite3_value **argv
119765
+){
119766
+ assert( argc==1 );
119767
+ switch( sqlite3_value_numeric_type(argv[0]) ){
119768
+ case SQLITE_INTEGER: {
119769
+ sqlite3_result_int64(context, sqlite3_value_int64(argv[0]));
119770
+ break;
119771
+ }
119772
+ case SQLITE_FLOAT: {
119773
+ double (*x)(double) = (double(*)(double))sqlite3_user_data(context);
119774
+ sqlite3_result_double(context, x(sqlite3_value_double(argv[0])));
119775
+ break;
119776
+ }
119777
+ default: {
119778
+ break;
119779
+ }
119780
+ }
119781
+}
119782
+
119783
+/*
119784
+** On some systems, ceil() and floor() are intrinsic function. You are
119785
+** unable to take a pointer to these functions. Hence, we here wrap them
119786
+** in our own actual functions.
119787
+*/
119788
+static double xCeil(double x){ return ceil(x); }
119789
+static double xFloor(double x){ return floor(x); }
119790
+
119791
+/*
119792
+** Implementation of SQL functions:
119793
+**
119794
+** ln(X) - natural logarithm
119795
+** log(X) - log X base 10
119796
+** log10(X) - log X base 10
119797
+** log(B,X) - log X base B
119798
+*/
119799
+static void logFunc(
119800
+ sqlite3_context *context,
119801
+ int argc,
119802
+ sqlite3_value **argv
119803
+){
119804
+ double x, b, ans;
119805
+ assert( argc==1 || argc==2 );
119806
+ switch( sqlite3_value_numeric_type(argv[0]) ){
119807
+ case SQLITE_INTEGER:
119808
+ case SQLITE_FLOAT:
119809
+ x = sqlite3_value_double(argv[0]);
119810
+ if( x<0.0 ) return;
119811
+ break;
119812
+ default:
119813
+ return;
119814
+ }
119815
+ if( argc==2 ){
119816
+ switch( sqlite3_value_numeric_type(argv[0]) ){
119817
+ case SQLITE_INTEGER:
119818
+ case SQLITE_FLOAT:
119819
+ b = x;
119820
+ x = sqlite3_value_double(argv[1]);
119821
+ if( x<0.0 ) return;
119822
+ break;
119823
+ default:
119824
+ return;
119825
+ }
119826
+ ans = log(x)/log(b);
119827
+ }else{
119828
+ ans = log(x);
119829
+ switch( SQLITE_PTR_TO_INT(sqlite3_user_data(context)) ){
119830
+ case 1:
119831
+ /* Convert from natural logarithm to log base 10 */
119832
+ ans *= 1.0/M_LN10;
119833
+ break;
119834
+ case 2:
119835
+ /* Convert from natural logarithm to log base 2 */
119836
+ ans *= 1.0/M_LN2;
119837
+ break;
119838
+ default:
119839
+ break;
119840
+ }
119841
+ }
119842
+ sqlite3_result_double(context, ans);
119843
+}
119844
+
119845
+/*
119846
+** Functions to converts degrees to radians and radians to degrees.
119847
+*/
119848
+static double degToRad(double x){ return x*(M_PI/180.0); }
119849
+static double radToDeg(double x){ return x*(180.0/M_PI); }
119850
+
119851
+/*
119852
+** Implementation of 1-argument SQL math functions:
119853
+**
119854
+** exp(X) - Compute e to the X-th power
119855
+*/
119856
+static void math1Func(
119857
+ sqlite3_context *context,
119858
+ int argc,
119859
+ sqlite3_value **argv
119860
+){
119861
+ int type0;
119862
+ double v0, ans;
119863
+ double (*x)(double);
119864
+ assert( argc==1 );
119865
+ type0 = sqlite3_value_numeric_type(argv[0]);
119866
+ if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
119867
+ v0 = sqlite3_value_double(argv[0]);
119868
+ x = (double(*)(double))sqlite3_user_data(context);
119869
+ ans = x(v0);
119870
+ sqlite3_result_double(context, ans);
119871
+}
119872
+
119873
+/*
119874
+** Implementation of 2-argument SQL math functions:
119875
+**
119876
+** power(X,Y) - Compute X to the Y-th power
119877
+*/
119878
+static void math2Func(
119879
+ sqlite3_context *context,
119880
+ int argc,
119881
+ sqlite3_value **argv
119882
+){
119883
+ int type0, type1;
119884
+ double v0, v1, ans;
119885
+ double (*x)(double,double);
119886
+ assert( argc==2 );
119887
+ type0 = sqlite3_value_numeric_type(argv[0]);
119888
+ if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
119889
+ type1 = sqlite3_value_numeric_type(argv[1]);
119890
+ if( type1!=SQLITE_INTEGER && type1!=SQLITE_FLOAT ) return;
119891
+ v0 = sqlite3_value_double(argv[0]);
119892
+ v1 = sqlite3_value_double(argv[1]);
119893
+ x = (double(*)(double,double))sqlite3_user_data(context);
119894
+ ans = x(v0, v1);
119895
+ sqlite3_result_double(context, ans);
119896
+}
119897
+
119898
+/*
119899
+** Implementation of 2-argument SQL math functions:
119900
+**
119901
+** power(X,Y) - Compute X to the Y-th power
119902
+*/
119903
+static void piFunc(
119904
+ sqlite3_context *context,
119905
+ int argc,
119906
+ sqlite3_value **argv
119907
+){
119908
+ assert( argc==0 );
119909
+ sqlite3_result_double(context, M_PI);
119910
+}
119911
+
119912
+#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
119913
+
119914
+/*
119915
+** Implementation of sign(X) function.
119916
+*/
119917
+static void signFunc(
119918
+ sqlite3_context *context,
119919
+ int argc,
119920
+ sqlite3_value **argv
119921
+){
119922
+ int type0;
119923
+ double x;
119924
+ UNUSED_PARAMETER(argc);
119925
+ assert( argc==1 );
119926
+ type0 = sqlite3_value_numeric_type(argv[0]);
119927
+ if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
119928
+ x = sqlite3_value_double(argv[0]);
119929
+ sqlite3_result_int(context, x<0.0 ? -1 : x>0.0 ? +1 : 0);
119930
+}
119446119931
119447119932
/*
119448119933
** All of the FuncDef structures in the aBuiltinFunc[] array above
119449119934
** to the global function hash table. This occurs at start-time (as
119450119935
** a consequence of calling sqlite3_initialize()).
@@ -119560,10 +120045,47 @@
119560120045
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
119561120046
FUNCTION(unknown, -1, 0, 0, unknownFunc ),
119562120047
#endif
119563120048
FUNCTION(coalesce, 1, 0, 0, 0 ),
119564120049
FUNCTION(coalesce, 0, 0, 0, 0 ),
120050
+#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
120051
+ MFUNCTION(ceil, 1, xCeil, ceilingFunc ),
120052
+ MFUNCTION(ceiling, 1, xCeil, ceilingFunc ),
120053
+ MFUNCTION(floor, 1, xFloor, ceilingFunc ),
120054
+#if SQLITE_HAVE_C99_MATH_FUNCS
120055
+ MFUNCTION(trunc, 1, trunc, ceilingFunc ),
120056
+#endif
120057
+ FUNCTION(ln, 1, 0, 0, logFunc ),
120058
+ FUNCTION(log, 1, 1, 0, logFunc ),
120059
+ FUNCTION(log10, 1, 1, 0, logFunc ),
120060
+ FUNCTION(log2, 1, 2, 0, logFunc ),
120061
+ FUNCTION(log, 2, 0, 0, logFunc ),
120062
+ MFUNCTION(exp, 1, exp, math1Func ),
120063
+ MFUNCTION(pow, 2, pow, math2Func ),
120064
+ MFUNCTION(power, 2, pow, math2Func ),
120065
+ MFUNCTION(mod, 2, fmod, math2Func ),
120066
+ MFUNCTION(acos, 1, acos, math1Func ),
120067
+ MFUNCTION(asin, 1, asin, math1Func ),
120068
+ MFUNCTION(atan, 1, atan, math1Func ),
120069
+ MFUNCTION(atan2, 2, atan2, math2Func ),
120070
+ MFUNCTION(cos, 1, cos, math1Func ),
120071
+ MFUNCTION(sin, 1, sin, math1Func ),
120072
+ MFUNCTION(tan, 1, tan, math1Func ),
120073
+ MFUNCTION(cosh, 1, cosh, math1Func ),
120074
+ MFUNCTION(sinh, 1, sinh, math1Func ),
120075
+ MFUNCTION(tanh, 1, tanh, math1Func ),
120076
+#if SQLITE_HAVE_C99_MATH_FUNCS
120077
+ MFUNCTION(acosh, 1, acosh, math1Func ),
120078
+ MFUNCTION(asinh, 1, asinh, math1Func ),
120079
+ MFUNCTION(atanh, 1, atanh, math1Func ),
120080
+#endif
120081
+ MFUNCTION(sqrt, 1, sqrt, math1Func ),
120082
+ MFUNCTION(radians, 1, degToRad, math1Func ),
120083
+ MFUNCTION(degrees, 1, radToDeg, math1Func ),
120084
+ FUNCTION(pi, 0, 0, 0, piFunc ),
120085
+#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
120086
+ FUNCTION(sign, 1, 0, 0, signFunc ),
119565120087
INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
119566120088
INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
119567120089
};
119568120090
#ifndef SQLITE_OMIT_ALTERTABLE
119569120091
sqlite3AlterFunctions();
@@ -121413,11 +121935,13 @@
121413121935
121414121936
pInfo = pToplevel->pAinc;
121415121937
while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
121416121938
if( pInfo==0 ){
121417121939
pInfo = sqlite3DbMallocRawNN(pParse->db, sizeof(*pInfo));
121418
- if( pInfo==0 ) return 0;
121940
+ sqlite3ParserAddCleanup(pToplevel, sqlite3DbFree, pInfo);
121941
+ testcase( pParse->earlyCleanup );
121942
+ if( pParse->db->mallocFailed ) return 0;
121419121943
pInfo->pNext = pToplevel->pAinc;
121420121944
pToplevel->pAinc = pInfo;
121421121945
pInfo->pTab = pTab;
121422121946
pInfo->iDb = iDb;
121423121947
pToplevel->nMem++; /* Register to hold name of table */
@@ -122018,10 +122542,11 @@
122018122542
}
122019122543
aRegIdx[i] = ++pParse->nMem; /* Register to store the table record */
122020122544
}
122021122545
#ifndef SQLITE_OMIT_UPSERT
122022122546
if( pUpsert ){
122547
+ Upsert *pNx;
122023122548
if( IsVirtual(pTab) ){
122024122549
sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
122025122550
pTab->zName);
122026122551
goto insert_cleanup;
122027122552
}
@@ -122031,17 +122556,21 @@
122031122556
}
122032122557
if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){
122033122558
goto insert_cleanup;
122034122559
}
122035122560
pTabList->a[0].iCursor = iDataCur;
122036
- pUpsert->pUpsertSrc = pTabList;
122037
- pUpsert->regData = regData;
122038
- pUpsert->iDataCur = iDataCur;
122039
- pUpsert->iIdxCur = iIdxCur;
122040
- if( pUpsert->pUpsertTarget ){
122041
- sqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert);
122042
- }
122561
+ pNx = pUpsert;
122562
+ do{
122563
+ pNx->pUpsertSrc = pTabList;
122564
+ pNx->regData = regData;
122565
+ pNx->iDataCur = iDataCur;
122566
+ pNx->iIdxCur = iIdxCur;
122567
+ if( pNx->pUpsertTarget ){
122568
+ sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx);
122569
+ }
122570
+ pNx = pNx->pNextUpsert;
122571
+ }while( pNx!=0 );
122043122572
}
122044122573
#endif
122045122574
122046122575
122047122576
/* This is the top of the main insertion loop */
@@ -122441,10 +122970,74 @@
122441122970
testcase( w.eCode==CKCNSTRNT_COLUMN );
122442122971
testcase( w.eCode==CKCNSTRNT_ROWID );
122443122972
testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
122444122973
return w.eCode!=0;
122445122974
}
122975
+
122976
+/*
122977
+** The sqlite3GenerateConstraintChecks() routine usually wants to visit
122978
+** the indexes of a table in the order provided in the Table->pIndex list.
122979
+** However, sometimes (rarely - when there is an upsert) it wants to visit
122980
+** the indexes in a different order. The following data structures accomplish
122981
+** this.
122982
+**
122983
+** The IndexIterator object is used to walk through all of the indexes
122984
+** of a table in either Index.pNext order, or in some other order established
122985
+** by an array of IndexListTerm objects.
122986
+*/
122987
+typedef struct IndexListTerm IndexListTerm;
122988
+typedef struct IndexIterator IndexIterator;
122989
+struct IndexIterator {
122990
+ int eType; /* 0 for Index.pNext list. 1 for an array of IndexListTerm */
122991
+ int i; /* Index of the current item from the list */
122992
+ union {
122993
+ struct { /* Use this object for eType==0: A Index.pNext list */
122994
+ Index *pIdx; /* The current Index */
122995
+ } lx;
122996
+ struct { /* Use this object for eType==1; Array of IndexListTerm */
122997
+ int nIdx; /* Size of the array */
122998
+ IndexListTerm *aIdx; /* Array of IndexListTerms */
122999
+ } ax;
123000
+ } u;
123001
+};
123002
+
123003
+/* When IndexIterator.eType==1, then each index is an array of instances
123004
+** of the following object
123005
+*/
123006
+struct IndexListTerm {
123007
+ Index *p; /* The index */
123008
+ int ix; /* Which entry in the original Table.pIndex list is this index*/
123009
+};
123010
+
123011
+/* Return the first index on the list */
123012
+static Index *indexIteratorFirst(IndexIterator *pIter, int *pIx){
123013
+ assert( pIter->i==0 );
123014
+ if( pIter->eType ){
123015
+ *pIx = pIter->u.ax.aIdx[0].ix;
123016
+ return pIter->u.ax.aIdx[0].p;
123017
+ }else{
123018
+ *pIx = 0;
123019
+ return pIter->u.lx.pIdx;
123020
+ }
123021
+}
123022
+
123023
+/* Return the next index from the list. Return NULL when out of indexes */
123024
+static Index *indexIteratorNext(IndexIterator *pIter, int *pIx){
123025
+ if( pIter->eType ){
123026
+ int i = ++pIter->i;
123027
+ if( i>=pIter->u.ax.nIdx ){
123028
+ *pIx = i;
123029
+ return 0;
123030
+ }
123031
+ *pIx = pIter->u.ax.aIdx[i].ix;
123032
+ return pIter->u.ax.aIdx[i].p;
123033
+ }else{
123034
+ ++(*pIx);
123035
+ pIter->u.lx.pIdx = pIter->u.lx.pIdx->pNext;
123036
+ return pIter->u.lx.pIdx;
123037
+ }
123038
+}
122446123039
122447123040
/*
122448123041
** Generate code to do constraint checks prior to an INSERT or an UPDATE
122449123042
** on table pTab.
122450123043
**
@@ -122550,32 +123143,33 @@
122550123143
int *aiChng, /* column i is unchanged if aiChng[i]<0 */
122551123144
Upsert *pUpsert /* ON CONFLICT clauses, if any. NULL otherwise */
122552123145
){
122553123146
Vdbe *v; /* VDBE under constrution */
122554123147
Index *pIdx; /* Pointer to one of the indices */
122555
- Index *pPk = 0; /* The PRIMARY KEY index */
123148
+ Index *pPk = 0; /* The PRIMARY KEY index for WITHOUT ROWID tables */
122556123149
sqlite3 *db; /* Database connection */
122557123150
int i; /* loop counter */
122558123151
int ix; /* Index loop counter */
122559123152
int nCol; /* Number of columns */
122560123153
int onError; /* Conflict resolution strategy */
122561123154
int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
122562123155
int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
122563
- Index *pUpIdx = 0; /* Index to which to apply the upsert */
122564
- u8 isUpdate; /* True if this is an UPDATE operation */
123156
+ Upsert *pUpsertClause = 0; /* The specific ON CONFLICT clause for pIdx */
123157
+ u8 isUpdate; /* True if this is an UPDATE operation */
122565123158
u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
122566
- int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */
122567
- int upsertJump = 0; /* Address of Goto that jumps into upsert subroutine */
123159
+ int upsertIpkReturn = 0; /* Address of Goto at end of IPK uniqueness check */
123160
+ int upsertIpkDelay = 0; /* Address of Goto to bypass initial IPK check */
122568123161
int ipkTop = 0; /* Top of the IPK uniqueness check */
122569123162
int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */
122570123163
/* Variables associated with retesting uniqueness constraints after
122571123164
** replace triggers fire have run */
122572123165
int regTrigCnt; /* Register used to count replace trigger invocations */
122573123166
int addrRecheck = 0; /* Jump here to recheck all uniqueness constraints */
122574123167
int lblRecheckOk = 0; /* Each recheck jumps to this label if it passes */
122575123168
Trigger *pTrigger; /* List of DELETE triggers on the table pTab */
122576123169
int nReplaceTrig = 0; /* Number of replace triggers coded */
123170
+ IndexIterator sIdxIter; /* Index iterator */
122577123171
122578123172
isUpdate = regOldData!=0;
122579123173
db = pParse->db;
122580123174
v = pParse->pVdbe;
122581123175
assert( v!=0 );
@@ -122769,23 +123363,67 @@
122769123363
**
122770123364
** The ordering of (2) and (3) is accomplished by making sure the linked
122771123365
** list of indexes attached to a table puts all OE_Replace indexes last
122772123366
** in the list. See sqlite3CreateIndex() for where that happens.
122773123367
*/
122774
-
123368
+ sIdxIter.eType = 0;
123369
+ sIdxIter.i = 0;
123370
+ sIdxIter.u.ax.aIdx = 0; /* Silence harmless compiler warning */
123371
+ sIdxIter.u.lx.pIdx = pTab->pIndex;
122775123372
if( pUpsert ){
122776123373
if( pUpsert->pUpsertTarget==0 ){
122777
- /* An ON CONFLICT DO NOTHING clause, without a constraint-target.
122778
- ** Make all unique constraint resolution be OE_Ignore */
122779
- assert( pUpsert->pUpsertSet==0 );
122780
- overrideError = OE_Ignore;
122781
- pUpsert = 0;
122782
- }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
122783
- /* If the constraint-target uniqueness check must be run first.
122784
- ** Jump to that uniqueness check now */
122785
- upsertJump = sqlite3VdbeAddOp0(v, OP_Goto);
122786
- VdbeComment((v, "UPSERT constraint goes first"));
123374
+ /* There is just on ON CONFLICT clause and it has no constraint-target */
123375
+ assert( pUpsert->pNextUpsert==0 );
123376
+ if( pUpsert->isDoUpdate==0 ){
123377
+ /* A single ON CONFLICT DO NOTHING clause, without a constraint-target.
123378
+ ** Make all unique constraint resolution be OE_Ignore */
123379
+ overrideError = OE_Ignore;
123380
+ pUpsert = 0;
123381
+ }else{
123382
+ /* A single ON CONFLICT DO UPDATE. Make all resolutions OE_Update */
123383
+ overrideError = OE_Update;
123384
+ }
123385
+ }else if( pTab->pIndex!=0 ){
123386
+ /* Otherwise, we'll need to run the IndexListTerm array version of the
123387
+ ** iterator to ensure that all of the ON CONFLICT conditions are
123388
+ ** checked first and in order. */
123389
+ int nIdx, jj;
123390
+ u64 nByte;
123391
+ Upsert *pTerm;
123392
+ u8 *bUsed;
123393
+ for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
123394
+ assert( aRegIdx[nIdx]>0 );
123395
+ }
123396
+ sIdxIter.eType = 1;
123397
+ sIdxIter.u.ax.nIdx = nIdx;
123398
+ nByte = (sizeof(IndexListTerm)+1)*nIdx + nIdx;
123399
+ sIdxIter.u.ax.aIdx = sqlite3DbMallocZero(db, nByte);
123400
+ if( sIdxIter.u.ax.aIdx==0 ) return; /* OOM */
123401
+ bUsed = (u8*)&sIdxIter.u.ax.aIdx[nIdx];
123402
+ pUpsert->pToFree = sIdxIter.u.ax.aIdx;
123403
+ for(i=0, pTerm=pUpsert; pTerm; pTerm=pTerm->pNextUpsert){
123404
+ if( pTerm->pUpsertTarget==0 ) break;
123405
+ if( pTerm->pUpsertIdx==0 ) continue; /* Skip ON CONFLICT for the IPK */
123406
+ jj = 0;
123407
+ pIdx = pTab->pIndex;
123408
+ while( ALWAYS(pIdx!=0) && pIdx!=pTerm->pUpsertIdx ){
123409
+ pIdx = pIdx->pNext;
123410
+ jj++;
123411
+ }
123412
+ if( bUsed[jj] ) continue; /* Duplicate ON CONFLICT clause ignored */
123413
+ bUsed[jj] = 1;
123414
+ sIdxIter.u.ax.aIdx[i].p = pIdx;
123415
+ sIdxIter.u.ax.aIdx[i].ix = jj;
123416
+ i++;
123417
+ }
123418
+ for(jj=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, jj++){
123419
+ if( bUsed[jj] ) continue;
123420
+ sIdxIter.u.ax.aIdx[i].p = pIdx;
123421
+ sIdxIter.u.ax.aIdx[i].ix = jj;
123422
+ i++;
123423
+ }
123424
+ assert( i==nIdx );
122787123425
}
122788123426
}
122789123427
122790123428
/* Determine if it is possible that triggers (either explicitly coded
122791123429
** triggers or FK resolution actions) might run as a result of deletes
@@ -122844,25 +123482,34 @@
122844123482
}else if( onError==OE_Default ){
122845123483
onError = OE_Abort;
122846123484
}
122847123485
122848123486
/* figure out whether or not upsert applies in this case */
122849
- if( pUpsert && pUpsert->pUpsertIdx==0 ){
122850
- if( pUpsert->pUpsertSet==0 ){
122851
- onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
122852
- }else{
122853
- onError = OE_Update; /* DO UPDATE */
123487
+ if( pUpsert ){
123488
+ pUpsertClause = sqlite3UpsertOfIndex(pUpsert,0);
123489
+ if( pUpsertClause!=0 ){
123490
+ if( pUpsertClause->isDoUpdate==0 ){
123491
+ onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
123492
+ }else{
123493
+ onError = OE_Update; /* DO UPDATE */
123494
+ }
123495
+ }
123496
+ if( pUpsertClause!=pUpsert ){
123497
+ /* The first ON CONFLICT clause has a conflict target other than
123498
+ ** the IPK. We have to jump ahead to that first ON CONFLICT clause
123499
+ ** and then come back here and deal with the IPK afterwards */
123500
+ upsertIpkDelay = sqlite3VdbeAddOp0(v, OP_Goto);
122854123501
}
122855123502
}
122856123503
122857123504
/* If the response to a rowid conflict is REPLACE but the response
122858123505
** to some other UNIQUE constraint is FAIL or IGNORE, then we need
122859123506
** to defer the running of the rowid conflict checking until after
122860123507
** the UNIQUE constraints have run.
122861123508
*/
122862123509
if( onError==OE_Replace /* IPK rule is REPLACE */
122863
- && onError!=overrideError /* Rules for other contraints are different */
123510
+ && onError!=overrideError /* Rules for other constraints are different */
122864123511
&& pTab->pIndex /* There exist other constraints */
122865123512
){
122866123513
ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
122867123514
VdbeComment((v, "defer IPK REPLACE until last"));
122868123515
}
@@ -122955,11 +123602,13 @@
122955123602
sqlite3VdbeGoto(v, ignoreDest);
122956123603
break;
122957123604
}
122958123605
}
122959123606
sqlite3VdbeResolveLabel(v, addrRowidOk);
122960
- if( ipkTop ){
123607
+ if( pUpsert && pUpsertClause!=pUpsert ){
123608
+ upsertIpkReturn = sqlite3VdbeAddOp0(v, OP_Goto);
123609
+ }else if( ipkTop ){
122961123610
ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
122962123611
sqlite3VdbeJumpHere(v, ipkTop-1);
122963123612
}
122964123613
}
122965123614
@@ -122968,27 +123617,29 @@
122968123617
** Compute the revised record entries for indices as we go.
122969123618
**
122970123619
** This loop also handles the case of the PRIMARY KEY index for a
122971123620
** WITHOUT ROWID table.
122972123621
*/
122973
- for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
123622
+ for(pIdx = indexIteratorFirst(&sIdxIter, &ix);
123623
+ pIdx;
123624
+ pIdx = indexIteratorNext(&sIdxIter, &ix)
123625
+ ){
122974123626
int regIdx; /* Range of registers hold conent for pIdx */
122975123627
int regR; /* Range of registers holding conflicting PK */
122976123628
int iThisCur; /* Cursor for this UNIQUE index */
122977123629
int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
122978123630
int addrConflictCk; /* First opcode in the conflict check logic */
122979123631
122980123632
if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
122981
- if( pUpIdx==pIdx ){
122982
- addrUniqueOk = upsertJump+1;
122983
- upsertBypass = sqlite3VdbeGoto(v, 0);
122984
- VdbeComment((v, "Skip upsert subroutine"));
122985
- sqlite3VdbeJumpHere(v, upsertJump);
122986
- }else{
122987
- addrUniqueOk = sqlite3VdbeMakeLabel(pParse);
122988
- }
122989
- if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
123633
+ if( pUpsert ){
123634
+ pUpsertClause = sqlite3UpsertOfIndex(pUpsert, pIdx);
123635
+ if( upsertIpkDelay && pUpsertClause==pUpsert ){
123636
+ sqlite3VdbeJumpHere(v, upsertIpkDelay);
123637
+ }
123638
+ }
123639
+ addrUniqueOk = sqlite3VdbeMakeLabel(pParse);
123640
+ if( bAffinityDone==0 ){
122990123641
sqlite3TableAffinity(v, pTab, regNewData+1);
122991123642
bAffinityDone = 1;
122992123643
}
122993123644
VdbeNoopComment((v, "prep index %s", pIdx->zName));
122994123645
iThisCur = iIdxCur+ix;
@@ -123055,12 +123706,12 @@
123055123706
}else if( onError==OE_Default ){
123056123707
onError = OE_Abort;
123057123708
}
123058123709
123059123710
/* Figure out if the upsert clause applies to this index */
123060
- if( pUpIdx==pIdx ){
123061
- if( pUpsert->pUpsertSet==0 ){
123711
+ if( pUpsertClause ){
123712
+ if( pUpsertClause->isDoUpdate==0 ){
123062123713
onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
123063123714
}else{
123064123715
onError = OE_Update; /* DO UPDATE */
123065123716
}
123066123717
}
@@ -123094,11 +123745,11 @@
123094123745
addrConflictCk =
123095123746
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
123096123747
regIdx, pIdx->nKeyCol); VdbeCoverage(v);
123097123748
123098123749
/* Generate code to handle collisions */
123099
- regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
123750
+ regR = pIdx==pPk ? regIdx : sqlite3GetTempRange(pParse, nPkField);
123100123751
if( isUpdate || onError==OE_Replace ){
123101123752
if( HasRowid(pTab) ){
123102123753
sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
123103123754
/* Conflict only if the rowid of the existing index entry
123104123755
** is different from old-rowid */
@@ -123246,17 +123897,20 @@
123246123897
}
123247123898
seenReplace = 1;
123248123899
break;
123249123900
}
123250123901
}
123251
- if( pUpIdx==pIdx ){
123252
- sqlite3VdbeGoto(v, upsertJump+1);
123253
- sqlite3VdbeJumpHere(v, upsertBypass);
123254
- }else{
123255
- sqlite3VdbeResolveLabel(v, addrUniqueOk);
123256
- }
123902
+ sqlite3VdbeResolveLabel(v, addrUniqueOk);
123257123903
if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
123904
+ if( pUpsertClause
123905
+ && upsertIpkReturn
123906
+ && sqlite3UpsertNextIsIPK(pUpsertClause)
123907
+ ){
123908
+ sqlite3VdbeGoto(v, upsertIpkDelay+1);
123909
+ sqlite3VdbeJumpHere(v, upsertIpkReturn);
123910
+ upsertIpkReturn = 0;
123911
+ }
123258123912
}
123259123913
123260123914
/* If the IPK constraint is a REPLACE, run it last */
123261123915
if( ipkTop ){
123262123916
sqlite3VdbeGoto(v, ipkTop);
@@ -123791,10 +124445,11 @@
123791124445
sqlite3CodeVerifySchema(pParse, iDbSrc);
123792124446
iSrc = pParse->nTab++;
123793124447
iDest = pParse->nTab++;
123794124448
regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
123795124449
regData = sqlite3GetTempReg(pParse);
124450
+ sqlite3VdbeAddOp2(v, OP_Null, 0, regData);
123796124451
regRowid = sqlite3GetTempReg(pParse);
123797124452
sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
123798124453
assert( HasRowid(pDest) || destHasUniqueIdx );
123799124454
if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
123800124455
(pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
@@ -123826,32 +124481,44 @@
123826124481
u8 insFlags;
123827124482
sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
123828124483
emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
123829124484
if( pDest->iPKey>=0 ){
123830124485
addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
123831
- sqlite3VdbeVerifyAbortable(v, onError);
123832
- addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
123833
- VdbeCoverage(v);
123834
- sqlite3RowidConstraint(pParse, onError, pDest);
123835
- sqlite3VdbeJumpHere(v, addr2);
124486
+ if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
124487
+ sqlite3VdbeVerifyAbortable(v, onError);
124488
+ addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
124489
+ VdbeCoverage(v);
124490
+ sqlite3RowidConstraint(pParse, onError, pDest);
124491
+ sqlite3VdbeJumpHere(v, addr2);
124492
+ }
123836124493
autoIncStep(pParse, regAutoinc, regRowid);
123837124494
}else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_VacuumInto) ){
123838124495
addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
123839124496
}else{
123840124497
addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
123841124498
assert( (pDest->tabFlags & TF_Autoincrement)==0 );
123842124499
}
124500
+
123843124501
if( db->mDbFlags & DBFLAG_Vacuum ){
123844124502
sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
123845
- insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT;
124503
+ insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
123846124504
}else{
123847
- insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND;
124505
+ insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND|OPFLAG_PREFORMAT;
123848124506
}
123849
- sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124507
+#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124508
+ if( db->xPreUpdateCallback ){
124509
+ sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124510
+ insFlags &= ~OPFLAG_PREFORMAT;
124511
+ }else
124512
+#endif
124513
+ {
124514
+ sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
124515
+ }
123850124516
sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
123851
- (char*)pDest, P4_TABLE);
124517
+ (char*)pDest, P4_TABLE);
123852124518
sqlite3VdbeChangeP5(v, insFlags);
124519
+
123853124520
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
123854124521
sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
123855124522
sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
123856124523
}else{
123857124524
sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);
@@ -123889,17 +124556,20 @@
123889124556
for(i=0; i<pSrcIdx->nColumn; i++){
123890124557
const char *zColl = pSrcIdx->azColl[i];
123891124558
if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
123892124559
}
123893124560
if( i==pSrcIdx->nColumn ){
123894
- idxInsFlags = OPFLAG_USESEEKRESULT;
124561
+ idxInsFlags = OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
123895124562
sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
124563
+ sqlite3VdbeAddOp2(v, OP_RowCell, iDest, iSrc);
123896124564
}
123897124565
}else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
123898124566
idxInsFlags |= OPFLAG_NCHANGE;
123899124567
}
123900
- sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124568
+ if( idxInsFlags!=(OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT) ){
124569
+ sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124570
+ }
123901124571
sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
123902124572
sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
123903124573
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
123904124574
sqlite3VdbeJumpHere(v, addr1);
123905124575
sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
@@ -128940,15 +129610,22 @@
128940129610
128941129611
assert( iDb>=0 && iDb<db->nDb );
128942129612
if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
128943129613
if( argv[3]==0 ){
128944129614
corruptSchema(pData, argv[1], 0);
128945
- }else if( sqlite3_strnicmp(argv[4],"create ",7)==0 ){
129615
+ }else if( argv[4]
129616
+ && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
129617
+ && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
128946129618
/* Call the parser to process a CREATE TABLE, INDEX or VIEW.
128947129619
** But because db->init.busy is set to 1, no VDBE code is generated
128948129620
** or executed. All the parser does is build the internal data
128949129621
** structures that describe the table, index, or view.
129622
+ **
129623
+ ** No other valid SQL statement, other than the variable CREATE statements,
129624
+ ** can begin with the letters "C" and "R". Thus, it is not possible run
129625
+ ** any other kind of statement while parsing the schema, even a corrupt
129626
+ ** schema.
128950129627
*/
128951129628
int rc;
128952129629
u8 saved_iDb = db->init.iDb;
128953129630
sqlite3_stmt *pStmt;
128954129631
TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
@@ -129401,19 +130078,66 @@
129401130078
while( pThis ){
129402130079
AggInfo *pNext = pThis->pNext;
129403130080
agginfoFree(db, pThis);
129404130081
pThis = pNext;
129405130082
}
130083
+ while( pParse->pCleanup ){
130084
+ ParseCleanup *pCleanup = pParse->pCleanup;
130085
+ pParse->pCleanup = pCleanup->pNext;
130086
+ pCleanup->xCleanup(db, pCleanup->pPtr);
130087
+ sqlite3DbFree(db, pCleanup);
130088
+ }
129406130089
sqlite3DbFree(db, pParse->aLabel);
129407
- sqlite3ExprListDelete(db, pParse->pConstExpr);
130090
+ if( pParse->pConstExpr ){
130091
+ sqlite3ExprListDelete(db, pParse->pConstExpr);
130092
+ }
129408130093
if( db ){
129409130094
assert( db->lookaside.bDisable >= pParse->disableLookaside );
129410130095
db->lookaside.bDisable -= pParse->disableLookaside;
129411130096
db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue;
129412130097
}
129413130098
pParse->disableLookaside = 0;
129414130099
}
130100
+
130101
+/*
130102
+** Add a new cleanup operation to a Parser. The cleanup should happen when
130103
+** the parser object is destroyed. But, beware: the cleanup might happen
130104
+** immediately.
130105
+**
130106
+** Use this mechanism for uncommon cleanups. There is a higher setup
130107
+** cost for this mechansim (an extra malloc), so it should not be used
130108
+** for common cleanups that happen on most calls. But for less
130109
+** common cleanups, we save a single NULL-pointer comparison in
130110
+** sqlite3ParserReset(), which reduces the total CPU cycle count.
130111
+**
130112
+** If a memory allocation error occurs, then the cleanup happens immediately.
130113
+** When eithr SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the
130114
+** pParse->earlyCleanup flag is set in that case. Calling code show verify
130115
+** that test cases exist for which this happens, to guard against possible
130116
+** use-after-free errors following an OOM. The preferred way to do this is
130117
+** to immediately follow the call to this routine with:
130118
+**
130119
+** testcase( pParse->earlyCleanup );
130120
+*/
130121
+SQLITE_PRIVATE void sqlite3ParserAddCleanup(
130122
+ Parse *pParse, /* Destroy when this Parser finishes */
130123
+ void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */
130124
+ void *pPtr /* Pointer to object to be cleaned up */
130125
+){
130126
+ ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup));
130127
+ if( pCleanup ){
130128
+ pCleanup->pNext = pParse->pCleanup;
130129
+ pParse->pCleanup = pCleanup;
130130
+ pCleanup->pPtr = pPtr;
130131
+ pCleanup->xCleanup = xCleanup;
130132
+ }else{
130133
+ xCleanup(pParse->db, pPtr);
130134
+#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
130135
+ pParse->earlyCleanup = 1;
130136
+#endif
130137
+ }
130138
+}
129415130139
129416130140
/*
129417130141
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
129418130142
*/
129419130143
static int sqlite3Prepare(
@@ -129509,16 +130233,10 @@
129509130233
}else{
129510130234
sqlite3RunParser(&sParse, zSql, &zErrMsg);
129511130235
}
129512130236
assert( 0==sParse.nQueryLoop );
129513130237
129514
- if( sParse.rc==SQLITE_DONE ){
129515
- sParse.rc = SQLITE_OK;
129516
- }
129517
- if( sParse.checkSchema ){
129518
- schemaIsValid(&sParse);
129519
- }
129520130238
if( pzTail ){
129521130239
*pzTail = sParse.zTail;
129522130240
}
129523130241
129524130242
if( db->init.busy==0 ){
@@ -129525,24 +130243,32 @@
129525130243
sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
129526130244
}
129527130245
if( db->mallocFailed ){
129528130246
sParse.rc = SQLITE_NOMEM_BKPT;
129529130247
}
129530
- rc = sParse.rc;
129531
- if( rc!=SQLITE_OK ){
129532
- if( sParse.pVdbe ) sqlite3VdbeFinalize(sParse.pVdbe);
129533
- assert(!(*ppStmt));
130248
+ if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){
130249
+ if( sParse.checkSchema ){
130250
+ schemaIsValid(&sParse);
130251
+ }
130252
+ if( sParse.pVdbe ){
130253
+ sqlite3VdbeFinalize(sParse.pVdbe);
130254
+ }
130255
+ assert( 0==(*ppStmt) );
130256
+ rc = sParse.rc;
130257
+ if( zErrMsg ){
130258
+ sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
130259
+ sqlite3DbFree(db, zErrMsg);
130260
+ }else{
130261
+ sqlite3Error(db, rc);
130262
+ }
129534130263
}else{
130264
+ assert( zErrMsg==0 );
129535130265
*ppStmt = (sqlite3_stmt*)sParse.pVdbe;
130266
+ rc = SQLITE_OK;
130267
+ sqlite3ErrorClear(db);
129536130268
}
129537130269
129538
- if( zErrMsg ){
129539
- sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
129540
- sqlite3DbFree(db, zErrMsg);
129541
- }else{
129542
- sqlite3Error(db, rc);
129543
- }
129544130270
129545130271
/* Delete any TriggerPrg structures allocated while parsing this statement. */
129546130272
while( sParse.pTriggerPrg ){
129547130273
TriggerPrg *pT = sParse.pTriggerPrg;
129548130274
sParse.pTriggerPrg = pT->pNext;
@@ -130146,11 +130872,11 @@
130146130872
pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
130147130873
if( pEq && isOuterJoin ){
130148130874
ExprSetProperty(pEq, EP_FromJoin);
130149130875
assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
130150130876
ExprSetVVAProperty(pEq, EP_NoReduce);
130151
- pEq->iRightJoinTable = (i16)pE2->iTable;
130877
+ pEq->iRightJoinTable = pE2->iTable;
130152130878
}
130153130879
*ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
130154130880
}
130155130881
130156130882
/*
@@ -130182,11 +130908,11 @@
130182130908
SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){
130183130909
while( p ){
130184130910
ExprSetProperty(p, EP_FromJoin);
130185130911
assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );
130186130912
ExprSetVVAProperty(p, EP_NoReduce);
130187
- p->iRightJoinTable = (i16)iTable;
130913
+ p->iRightJoinTable = iTable;
130188130914
if( p->op==TK_FUNCTION && p->x.pList ){
130189130915
int i;
130190130916
for(i=0; i<p->x.pList->nExpr; i++){
130191130917
sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable);
130192130918
}
@@ -133448,10 +134174,92 @@
133448134174
pSrcItem->colUsed = 0;
133449134175
sqlite3WalkSelect(&w, pSelect);
133450134176
}
133451134177
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
133452134178
134179
+#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
134180
+/*
134181
+** Assign new cursor numbers to each of the items in pSrc. For each
134182
+** new cursor number assigned, set an entry in the aCsrMap[] array
134183
+** to map the old cursor number to the new:
134184
+**
134185
+** aCsrMap[iOld] = iNew;
134186
+**
134187
+** The array is guaranteed by the caller to be large enough for all
134188
+** existing cursor numbers in pSrc.
134189
+**
134190
+** If pSrc contains any sub-selects, call this routine recursively
134191
+** on the FROM clause of each such sub-select, with iExcept set to -1.
134192
+*/
134193
+static void srclistRenumberCursors(
134194
+ Parse *pParse, /* Parse context */
134195
+ int *aCsrMap, /* Array to store cursor mappings in */
134196
+ SrcList *pSrc, /* FROM clause to renumber */
134197
+ int iExcept /* FROM clause item to skip */
134198
+){
134199
+ int i;
134200
+ struct SrcList_item *pItem;
134201
+ for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
134202
+ if( i!=iExcept ){
134203
+ Select *p;
134204
+ pItem->iCursor = aCsrMap[pItem->iCursor] = pParse->nTab++;
134205
+ for(p=pItem->pSelect; p; p=p->pPrior){
134206
+ srclistRenumberCursors(pParse, aCsrMap, p->pSrc, -1);
134207
+ }
134208
+ }
134209
+ }
134210
+}
134211
+
134212
+/*
134213
+** Expression walker callback used by renumberCursors() to update
134214
+** Expr objects to match newly assigned cursor numbers.
134215
+*/
134216
+static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
134217
+ int *aCsrMap = pWalker->u.aiCol;
134218
+ if( pExpr->op==TK_COLUMN && aCsrMap[pExpr->iTable] ){
134219
+ pExpr->iTable = aCsrMap[pExpr->iTable];
134220
+ }
134221
+ if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
134222
+ pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
134223
+ }
134224
+ return WRC_Continue;
134225
+}
134226
+
134227
+/*
134228
+** Assign a new cursor number to each cursor in the FROM clause (Select.pSrc)
134229
+** of the SELECT statement passed as the second argument, and to each
134230
+** cursor in the FROM clause of any FROM clause sub-selects, recursively.
134231
+** Except, do not assign a new cursor number to the iExcept'th element in
134232
+** the FROM clause of (*p). Update all expressions and other references
134233
+** to refer to the new cursor numbers.
134234
+**
134235
+** Argument aCsrMap is an array that may be used for temporary working
134236
+** space. Two guarantees are made by the caller:
134237
+**
134238
+** * the array is larger than the largest cursor number used within the
134239
+** select statement passed as an argument, and
134240
+**
134241
+** * the array entries for all cursor numbers that do *not* appear in
134242
+** FROM clauses of the select statement as described above are
134243
+** initialized to zero.
134244
+*/
134245
+static void renumberCursors(
134246
+ Parse *pParse, /* Parse context */
134247
+ Select *p, /* Select to renumber cursors within */
134248
+ int iExcept, /* FROM clause item to skip */
134249
+ int *aCsrMap /* Working space */
134250
+){
134251
+ Walker w;
134252
+ srclistRenumberCursors(pParse, aCsrMap, p->pSrc, iExcept);
134253
+ memset(&w, 0, sizeof(w));
134254
+ w.u.aiCol = aCsrMap;
134255
+ w.xExprCallback = renumberCursorsCb;
134256
+ w.xSelectCallback = sqlite3SelectWalkNoop;
134257
+ sqlite3WalkSelect(&w, p);
134258
+}
134259
+#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
134260
+
133453134261
#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
133454134262
/*
133455134263
** This routine attempts to flatten subqueries as a performance optimization.
133456134264
** This routine returns 1 if it makes changes and 0 if no flattening occurs.
133457134265
**
@@ -133542,13 +134350,13 @@
133542134350
** (17b) no terms within the subquery compound may be aggregate
133543134351
** or DISTINCT, and
133544134352
** (17c) every term within the subquery compound must have a FROM clause
133545134353
** (17d) the outer query may not be
133546134354
** (17d1) aggregate, or
133547
-** (17d2) DISTINCT, or
133548
-** (17d3) a join.
133549
-** (17e) the subquery may not contain window functions
134355
+** (17d2) DISTINCT
134356
+** (17e) the subquery may not contain window functions, and
134357
+** (17f) the subquery must not be the RHS of a LEFT JOIN.
133550134358
**
133551134359
** The parent and sub-query may contain WHERE clauses. Subject to
133552134360
** rules (11), (13) and (14), they may also contain ORDER BY,
133553134361
** LIMIT and OFFSET clauses. The subquery cannot use any compound
133554134362
** operator other than UNION ALL because all the other compound
@@ -133560,12 +134368,12 @@
133560134368
** SELECT statement, but all the code here does is make sure that no
133561134369
** such (illegal) sub-query is flattened. The caller will detect the
133562134370
** syntax error and return a detailed message.
133563134371
**
133564134372
** (18) If the sub-query is a compound select, then all terms of the
133565
-** ORDER BY clause of the parent must be simple references to
133566
-** columns of the sub-query.
134373
+** ORDER BY clause of the parent must be copies of a term returned
134374
+** by the parent query.
133567134375
**
133568134376
** (19) If the subquery uses LIMIT then the outer query may not
133569134377
** have a WHERE clause.
133570134378
**
133571134379
** (20) If the sub-query is a compound select, then it must not use
@@ -133577,13 +134385,12 @@
133577134385
** (21) If the subquery uses LIMIT then the outer query may not be
133578134386
** DISTINCT. (See ticket [752e1646fc]).
133579134387
**
133580134388
** (22) The subquery may not be a recursive CTE.
133581134389
**
133582
-** (**) Subsumed into restriction (17d3). Was: If the outer query is
133583
-** a recursive CTE, then the sub-query may not be a compound query.
133584
-** This restriction is because transforming the
134390
+** (23) If the outer query is a recursive CTE, then the sub-query may not be
134391
+** a compound query. This restriction is because transforming the
133585134392
** parent to a compound query confuses the code that handles
133586134393
** recursive queries in multiSelect().
133587134394
**
133588134395
** (**) We no longer attempt to flatten aggregate subqueries. Was:
133589134396
** The subquery may not be an aggregate that uses the built-in min() or
@@ -133624,10 +134431,11 @@
133624134431
int i; /* Loop counter */
133625134432
Expr *pWhere; /* The WHERE clause */
133626134433
struct SrcList_item *pSubitem; /* The subquery */
133627134434
sqlite3 *db = pParse->db;
133628134435
Walker w; /* Walker to persist agginfo data */
134436
+ int *aCsrMap = 0;
133629134437
133630134438
/* Check to see if flattening is permitted. Return 0 if not.
133631134439
*/
133632134440
assert( p!=0 );
133633134441
assert( p->pPrior==0 );
@@ -133719,17 +134527,18 @@
133719134527
*/
133720134528
if( pSub->pPrior ){
133721134529
if( pSub->pOrderBy ){
133722134530
return 0; /* Restriction (20) */
133723134531
}
133724
- if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
133725
- return 0; /* (17d1), (17d2), or (17d3) */
134532
+ if( isAgg || (p->selFlags & SF_Distinct)!=0 || isLeftJoin>0 ){
134533
+ return 0; /* (17d1), (17d2), or (17f) */
133726134534
}
133727134535
for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
133728134536
testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );
133729134537
testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );
133730134538
assert( pSub->pSrc!=0 );
134539
+ assert( (pSub->selFlags & SF_Recursive)==0 );
133731134540
assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );
133732134541
if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */
133733134542
|| (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */
133734134543
|| pSub1->pSrc->nSrc<1 /* (17c) */
133735134544
#ifndef SQLITE_OMIT_WINDOWFUNC
@@ -133746,19 +134555,18 @@
133746134555
int ii;
133747134556
for(ii=0; ii<p->pOrderBy->nExpr; ii++){
133748134557
if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;
133749134558
}
133750134559
}
133751
- }
133752
-
133753
- /* Ex-restriction (23):
133754
- ** The only way that the recursive part of a CTE can contain a compound
133755
- ** subquery is for the subquery to be one term of a join. But if the
133756
- ** subquery is a join, then the flattening has already been stopped by
133757
- ** restriction (17d3)
133758
- */
133759
- assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );
134560
+
134561
+ /* Restriction (23) */
134562
+ if( (p->selFlags & SF_Recursive) ) return 0;
134563
+
134564
+ if( pSrc->nSrc>1 ){
134565
+ aCsrMap = sqlite3DbMallocZero(db, pParse->nTab*sizeof(int));
134566
+ }
134567
+ }
133760134568
133761134569
/***** If we reach this point, flattening is permitted. *****/
133762134570
SELECTTRACE(1,pParse,p,("flatten %u.%p from term %d\n",
133763134571
pSub->selId, pSub, iFrom));
133764134572
@@ -133765,10 +134573,21 @@
133765134573
/* Authorize the subquery */
133766134574
pParse->zAuthContext = pSubitem->zName;
133767134575
TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);
133768134576
testcase( i==SQLITE_DENY );
133769134577
pParse->zAuthContext = zSavedAuthContext;
134578
+
134579
+ /* Delete the transient structures associated with thesubquery */
134580
+ pSub1 = pSubitem->pSelect;
134581
+ sqlite3DbFree(db, pSubitem->zDatabase);
134582
+ sqlite3DbFree(db, pSubitem->zName);
134583
+ sqlite3DbFree(db, pSubitem->zAlias);
134584
+ pSubitem->zDatabase = 0;
134585
+ pSubitem->zName = 0;
134586
+ pSubitem->zAlias = 0;
134587
+ pSubitem->pSelect = 0;
134588
+ assert( pSubitem->pOn==0 );
133770134589
133771134590
/* If the sub-query is a compound SELECT statement, then (by restrictions
133772134591
** 17 and 18 above) it must be a UNION ALL and the parent query must
133773134592
** be of the form:
133774134593
**
@@ -133804,47 +134623,40 @@
133804134623
for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){
133805134624
Select *pNew;
133806134625
ExprList *pOrderBy = p->pOrderBy;
133807134626
Expr *pLimit = p->pLimit;
133808134627
Select *pPrior = p->pPrior;
134628
+ Table *pItemTab = pSubitem->pTab;
134629
+ pSubitem->pTab = 0;
133809134630
p->pOrderBy = 0;
133810
- p->pSrc = 0;
133811134631
p->pPrior = 0;
133812134632
p->pLimit = 0;
133813134633
pNew = sqlite3SelectDup(db, p, 0);
133814134634
p->pLimit = pLimit;
133815134635
p->pOrderBy = pOrderBy;
133816
- p->pSrc = pSrc;
133817134636
p->op = TK_ALL;
134637
+ pSubitem->pTab = pItemTab;
133818134638
if( pNew==0 ){
133819134639
p->pPrior = pPrior;
133820134640
}else{
134641
+ if( aCsrMap && db->mallocFailed==0 ){
134642
+ renumberCursors(pParse, pNew, iFrom, aCsrMap);
134643
+ }
133821134644
pNew->pPrior = pPrior;
133822134645
if( pPrior ) pPrior->pNext = pNew;
133823134646
pNew->pNext = p;
133824134647
p->pPrior = pNew;
133825134648
SELECTTRACE(2,pParse,p,("compound-subquery flattener"
133826134649
" creates %u as peer\n",pNew->selId));
133827134650
}
133828
- if( db->mallocFailed ) return 1;
133829
- }
133830
-
133831
- /* Begin flattening the iFrom-th entry of the FROM clause
133832
- ** in the outer query.
133833
- */
133834
- pSub = pSub1 = pSubitem->pSelect;
133835
-
133836
- /* Delete the transient table structure associated with the
133837
- ** subquery
133838
- */
133839
- sqlite3DbFree(db, pSubitem->zDatabase);
133840
- sqlite3DbFree(db, pSubitem->zName);
133841
- sqlite3DbFree(db, pSubitem->zAlias);
133842
- pSubitem->zDatabase = 0;
133843
- pSubitem->zName = 0;
133844
- pSubitem->zAlias = 0;
133845
- pSubitem->pSelect = 0;
134651
+ assert( pSubitem->pSelect==0 );
134652
+ }
134653
+ sqlite3DbFree(db, aCsrMap);
134654
+ if( db->mallocFailed ){
134655
+ pSubitem->pSelect = pSub1;
134656
+ return 1;
134657
+ }
133846134658
133847134659
/* Defer deleting the Table object associated with the
133848134660
** subquery until code generation is
133849134661
** complete, since there may still exist Expr.pTab entries that
133850134662
** refer to the subquery even after flattening. Ticket #3346.
@@ -133853,12 +134665,14 @@
133853134665
*/
133854134666
if( ALWAYS(pSubitem->pTab!=0) ){
133855134667
Table *pTabToDel = pSubitem->pTab;
133856134668
if( pTabToDel->nTabRef==1 ){
133857134669
Parse *pToplevel = sqlite3ParseToplevel(pParse);
133858
- pTabToDel->pNextZombie = pToplevel->pZombieTab;
133859
- pToplevel->pZombieTab = pTabToDel;
134670
+ sqlite3ParserAddCleanup(pToplevel,
134671
+ (void(*)(sqlite3*,void*))sqlite3DeleteTable,
134672
+ pTabToDel);
134673
+ testcase( pToplevel->earlyCleanup );
133860134674
}else{
133861134675
pTabToDel->nTabRef--;
133862134676
}
133863134677
pSubitem->pTab = 0;
133864134678
}
@@ -133874,26 +134688,21 @@
133874134688
** iParent. The iParent cursor will never be used. Subsequent code
133875134689
** will scan expressions looking for iParent references and replace
133876134690
** those references with expressions that resolve to the subquery FROM
133877134691
** elements we are now copying in.
133878134692
*/
134693
+ pSub = pSub1;
133879134694
for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
133880134695
int nSubSrc;
133881134696
u8 jointype = 0;
133882134697
assert( pSub!=0 );
133883134698
pSubSrc = pSub->pSrc; /* FROM clause of subquery */
133884134699
nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
133885134700
pSrc = pParent->pSrc; /* FROM clause of the outer query */
133886134701
133887
- if( pSrc ){
133888
- assert( pParent==p ); /* First time through the loop */
133889
- jointype = pSubitem->fg.jointype;
133890
- }else{
133891
- assert( pParent!=p ); /* 2nd and subsequent times through the loop */
133892
- pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
133893
- if( pSrc==0 ) break;
133894
- pParent->pSrc = pSrc;
134702
+ if( pParent==p ){
134703
+ jointype = pSubitem->fg.jointype; /* First time through the loop */
133895134704
}
133896134705
133897134706
/* The subquery uses a single slot of the FROM clause of the outer
133898134707
** query. If the subquery has more than one element in its FROM clause,
133899134708
** then expand the outer query to make space for it to hold all elements
@@ -134009,11 +134818,11 @@
134009134818
sqlite3AggInfoPersistWalkerInit(&w, pParse);
134010134819
sqlite3WalkSelect(&w,pSub1);
134011134820
sqlite3SelectDelete(db, pSub1);
134012134821
134013134822
#if SELECTTRACE_ENABLED
134014
- if( sqlite3_unsupported_selecttrace & 0x100 ){
134823
+ if( sqlite3SelectTrace & 0x100 ){
134015134824
SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
134016134825
sqlite3TreeViewSelect(0, p, 0);
134017134826
}
134018134827
#endif
134019134828
@@ -134356,11 +135165,15 @@
134356135165
u8 sortFlags = 0;
134357135166
134358135167
assert( *ppMinMax==0 );
134359135168
assert( pFunc->op==TK_AGG_FUNCTION );
134360135169
assert( !IsWindowFunc(pFunc) );
134361
- if( pEList==0 || pEList->nExpr!=1 || ExprHasProperty(pFunc, EP_WinFunc) ){
135170
+ if( pEList==0
135171
+ || pEList->nExpr!=1
135172
+ || ExprHasProperty(pFunc, EP_WinFunc)
135173
+ || OptimizationDisabled(db, SQLITE_MinMaxOpt)
135174
+ ){
134362135175
return eRet;
134363135176
}
134364135177
zFunc = pFunc->u.zToken;
134365135178
if( sqlite3StrICmp(zFunc, "min")==0 ){
134366135179
eRet = WHERE_ORDERBY_MIN;
@@ -134574,16 +135387,20 @@
134574135387
** should be freed along with the Parse object. In other cases, when
134575135388
** bFree==0, the With object will be freed along with the SELECT
134576135389
** statement with which it is associated.
134577135390
*/
134578135391
SQLITE_PRIVATE void sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){
134579
- assert( bFree==0 || (pParse->pWith==0 && pParse->pWithToFree==0) );
134580135392
if( pWith ){
134581135393
assert( pParse->pWith!=pWith );
134582135394
pWith->pOuter = pParse->pWith;
134583135395
pParse->pWith = pWith;
134584
- if( bFree ) pParse->pWithToFree = pWith;
135396
+ if( bFree ){
135397
+ sqlite3ParserAddCleanup(pParse,
135398
+ (void(*)(sqlite3*,void*))sqlite3WithDelete,
135399
+ pWith);
135400
+ testcase( pParse->earlyCleanup );
135401
+ }
134585135402
}
134586135403
}
134587135404
134588135405
/*
134589135406
** This function checks if argument pFrom refers to a CTE declared by
@@ -135414,11 +136231,13 @@
135414136231
** within the HAVING expression with a constant "1".
135415136232
*/
135416136233
static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){
135417136234
if( pExpr->op!=TK_AND ){
135418136235
Select *pS = pWalker->u.pSelect;
135419
- if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
136236
+ if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy)
136237
+ && ExprAlwaysFalse(pExpr)==0
136238
+ ){
135420136239
sqlite3 *db = pWalker->pParse->db;
135421136240
Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1");
135422136241
if( pNew ){
135423136242
Expr *pWhere = pS->pWhere;
135424136243
SWAP(Expr, *pNew, *pExpr);
@@ -135453,11 +136272,11 @@
135453136272
sWalker.pParse = pParse;
135454136273
sWalker.xExprCallback = havingToWhereExprCb;
135455136274
sWalker.u.pSelect = p;
135456136275
sqlite3WalkExpr(&sWalker, p->pHaving);
135457136276
#if SELECTTRACE_ENABLED
135458
- if( sWalker.eCode && (sqlite3_unsupported_selecttrace & 0x100)!=0 ){
136277
+ if( sWalker.eCode && (sqlite3SelectTrace & 0x100)!=0 ){
135459136278
SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
135460136279
sqlite3TreeViewSelect(0, p, 0);
135461136280
}
135462136281
#endif
135463136282
}
@@ -135575,11 +136394,11 @@
135575136394
}
135576136395
p->pEList->a[0].pExpr = pExpr;
135577136396
p->selFlags &= ~SF_Aggregate;
135578136397
135579136398
#if SELECTTRACE_ENABLED
135580
- if( sqlite3_unsupported_selecttrace & 0x400 ){
136399
+ if( sqlite3SelectTrace & 0x400 ){
135581136400
SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
135582136401
sqlite3TreeViewSelect(0, p, 0);
135583136402
}
135584136403
#endif
135585136404
return 1;
@@ -135628,11 +136447,11 @@
135628136447
return 1;
135629136448
}
135630136449
if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
135631136450
#if SELECTTRACE_ENABLED
135632136451
SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
135633
- if( sqlite3_unsupported_selecttrace & 0x100 ){
136452
+ if( sqlite3SelectTrace & 0x100 ){
135634136453
sqlite3TreeViewSelect(0, p, 0);
135635136454
}
135636136455
#endif
135637136456
135638136457
assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );
@@ -135653,11 +136472,11 @@
135653136472
if( pParse->nErr || db->mallocFailed ){
135654136473
goto select_end;
135655136474
}
135656136475
assert( p->pEList!=0 );
135657136476
#if SELECTTRACE_ENABLED
135658
- if( sqlite3_unsupported_selecttrace & 0x104 ){
136477
+ if( sqlite3SelectTrace & 0x104 ){
135659136478
SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
135660136479
sqlite3TreeViewSelect(0, p, 0);
135661136480
}
135662136481
#endif
135663136482
@@ -135688,11 +136507,11 @@
135688136507
if( rc ){
135689136508
assert( db->mallocFailed || pParse->nErr>0 );
135690136509
goto select_end;
135691136510
}
135692136511
#if SELECTTRACE_ENABLED
135693
- if( p->pWin && (sqlite3_unsupported_selecttrace & 0x108)!=0 ){
136512
+ if( p->pWin && (sqlite3SelectTrace & 0x108)!=0 ){
135694136513
SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n"));
135695136514
sqlite3TreeViewSelect(0, p, 0);
135696136515
}
135697136516
#endif
135698136517
#endif /* SQLITE_OMIT_WINDOWFUNC */
@@ -135795,11 +136614,11 @@
135795136614
*/
135796136615
if( p->pPrior ){
135797136616
rc = multiSelect(pParse, p, pDest);
135798136617
#if SELECTTRACE_ENABLED
135799136618
SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
135800
- if( (sqlite3_unsupported_selecttrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
136619
+ if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
135801136620
sqlite3TreeViewSelect(0, p, 0);
135802136621
}
135803136622
#endif
135804136623
if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
135805136624
return rc;
@@ -135814,11 +136633,11 @@
135814136633
if( pTabList->nSrc>1
135815136634
&& OptimizationEnabled(db, SQLITE_PropagateConst)
135816136635
&& propagateConstants(pParse, p)
135817136636
){
135818136637
#if SELECTTRACE_ENABLED
135819
- if( sqlite3_unsupported_selecttrace & 0x100 ){
136638
+ if( sqlite3SelectTrace & 0x100 ){
135820136639
SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
135821136640
sqlite3TreeViewSelect(0, p, 0);
135822136641
}
135823136642
#endif
135824136643
}else{
@@ -135902,11 +136721,11 @@
135902136721
if( OptimizationEnabled(db, SQLITE_PushDown)
135903136722
&& pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
135904136723
(pItem->fg.jointype & JT_OUTER)!=0)
135905136724
){
135906136725
#if SELECTTRACE_ENABLED
135907
- if( sqlite3_unsupported_selecttrace & 0x100 ){
136726
+ if( sqlite3SelectTrace & 0x100 ){
135908136727
SELECTTRACE(0x100,pParse,p,
135909136728
("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
135910136729
sqlite3TreeViewSelect(0, p, 0);
135911136730
}
135912136731
#endif
@@ -136002,11 +136821,11 @@
136002136821
pGroupBy = p->pGroupBy;
136003136822
pHaving = p->pHaving;
136004136823
sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;
136005136824
136006136825
#if SELECTTRACE_ENABLED
136007
- if( sqlite3_unsupported_selecttrace & 0x400 ){
136826
+ if( sqlite3SelectTrace & 0x400 ){
136008136827
SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
136009136828
sqlite3TreeViewSelect(0, p, 0);
136010136829
}
136011136830
#endif
136012136831
@@ -136038,11 +136857,11 @@
136038136857
** the sDistinct.isTnct is still set. Hence, isTnct represents the
136039136858
** original setting of the SF_Distinct flag, not the current setting */
136040136859
assert( sDistinct.isTnct );
136041136860
136042136861
#if SELECTTRACE_ENABLED
136043
- if( sqlite3_unsupported_selecttrace & 0x400 ){
136862
+ if( sqlite3SelectTrace & 0x400 ){
136044136863
SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
136045136864
sqlite3TreeViewSelect(0, p, 0);
136046136865
}
136047136866
#endif
136048136867
}
@@ -136286,14 +137105,18 @@
136286137105
sNC.ncFlags &= ~NC_InAggFunc;
136287137106
}
136288137107
pAggInfo->mxReg = pParse->nMem;
136289137108
if( db->mallocFailed ) goto select_end;
136290137109
#if SELECTTRACE_ENABLED
136291
- if( sqlite3_unsupported_selecttrace & 0x400 ){
137110
+ if( sqlite3SelectTrace & 0x400 ){
136292137111
int ii;
136293137112
SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
136294137113
sqlite3TreeViewSelect(0, p, 0);
137114
+ if( minMaxFlag ){
137115
+ sqlite3DebugPrintf("MIN/MAX Optimization (0x%02x) adds:\n", minMaxFlag);
137116
+ sqlite3TreeViewExprList(0, pMinMaxOrderBy, 0, "ORDERBY");
137117
+ }
136295137118
for(ii=0; ii<pAggInfo->nColumn; ii++){
136296137119
sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
136297137120
ii, pAggInfo->aCol[ii].iMem);
136298137121
sqlite3TreeViewExpr(0, pAggInfo->aCol[ii].pCExpr, 0);
136299137122
}
@@ -136479,11 +137302,11 @@
136479137302
VdbeComment((v, "indicate data in accumulator"));
136480137303
136481137304
/* End of the loop
136482137305
*/
136483137306
if( groupBySort ){
136484
- sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx, addrTopOfLoop);
137307
+ sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
136485137308
VdbeCoverage(v);
136486137309
}else{
136487137310
sqlite3WhereEnd(pWInfo);
136488137311
sqlite3VdbeChangeToNoop(v, addrSortingIdx);
136489137312
}
@@ -136591,11 +137414,10 @@
136591137414
sqlite3VdbeAddOp2(v, OP_Count, iCsr, pAggInfo->aFunc[0].iMem);
136592137415
sqlite3VdbeAddOp1(v, OP_Close, iCsr);
136593137416
explainSimpleCount(pParse, pTab, pBest);
136594137417
}else{
136595137418
int regAcc = 0; /* "populate accumulators" flag */
136596
- int addrSkip;
136597137419
136598137420
/* If there are accumulator registers but no min() or max() functions
136599137421
** without FILTER clauses, allocate register regAcc. Register regAcc
136600137422
** will contain 0 the first time the inner loop runs, and 1 thereafter.
136601137423
** The code generated by updateAccumulator() uses this to ensure
@@ -136640,13 +137462,12 @@
136640137462
if( pWInfo==0 ){
136641137463
goto select_end;
136642137464
}
136643137465
updateAccumulator(pParse, regAcc, pAggInfo);
136644137466
if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
136645
- addrSkip = sqlite3WhereOrderByLimitOptLabel(pWInfo);
136646
- if( addrSkip!=sqlite3WhereContinueLabel(pWInfo) ){
136647
- sqlite3VdbeGoto(v, addrSkip);
137467
+ if( minMaxFlag ){
137468
+ sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
136648137469
}
136649137470
sqlite3WhereEnd(pWInfo);
136650137471
finalizeAggFunctions(pParse, pAggInfo);
136651137472
}
136652137473
@@ -136688,28 +137509,26 @@
136688137509
sqlite3ExprListDelete(db, pMinMaxOrderBy);
136689137510
#ifdef SQLITE_DEBUG
136690137511
if( pAggInfo && !db->mallocFailed ){
136691137512
for(i=0; i<pAggInfo->nColumn; i++){
136692137513
Expr *pExpr = pAggInfo->aCol[i].pCExpr;
136693
- assert( pExpr!=0 || db->mallocFailed );
136694
- if( pExpr==0 ) continue;
137514
+ assert( pExpr!=0 );
136695137515
assert( pExpr->pAggInfo==pAggInfo );
136696137516
assert( pExpr->iAgg==i );
136697137517
}
136698137518
for(i=0; i<pAggInfo->nFunc; i++){
136699137519
Expr *pExpr = pAggInfo->aFunc[i].pFExpr;
136700
- assert( pExpr!=0 || db->mallocFailed );
136701
- if( pExpr==0 ) continue;
137520
+ assert( pExpr!=0 );
136702137521
assert( pExpr->pAggInfo==pAggInfo );
136703137522
assert( pExpr->iAgg==i );
136704137523
}
136705137524
}
136706137525
#endif
136707137526
136708137527
#if SELECTTRACE_ENABLED
136709137528
SELECTTRACE(0x1,pParse,p,("end processing\n"));
136710
- if( (sqlite3_unsupported_selecttrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
137529
+ if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
136711137530
sqlite3TreeViewSelect(0, p, 0);
136712137531
}
136713137532
#endif
136714137533
ExplainQueryPlanPop(pParse);
136715137534
return rc;
@@ -137918,11 +138737,10 @@
137918138737
pPrg->aColmask[0] = pSubParse->oldmask;
137919138738
pPrg->aColmask[1] = pSubParse->newmask;
137920138739
sqlite3VdbeDelete(v);
137921138740
}
137922138741
137923
- assert( !pSubParse->pAinc && !pSubParse->pZombieTab );
137924138742
assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg );
137925138743
sqlite3ParserReset(pSubParse);
137926138744
sqlite3StackFree(db, pSubParse);
137927138745
137928138746
return pPrg;
@@ -139476,19 +140294,26 @@
139476140294
139477140295
#ifndef SQLITE_OMIT_UPSERT
139478140296
/*
139479140297
** Free a list of Upsert objects
139480140298
*/
139481
-SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
139482
- if( p ){
140299
+static void SQLITE_NOINLINE upsertDelete(sqlite3 *db, Upsert *p){
140300
+ do{
140301
+ Upsert *pNext = p->pNextUpsert;
139483140302
sqlite3ExprListDelete(db, p->pUpsertTarget);
139484140303
sqlite3ExprDelete(db, p->pUpsertTargetWhere);
139485140304
sqlite3ExprListDelete(db, p->pUpsertSet);
139486140305
sqlite3ExprDelete(db, p->pUpsertWhere);
140306
+ sqlite3DbFree(db, p->pToFree);
139487140307
sqlite3DbFree(db, p);
139488
- }
140308
+ p = pNext;
140309
+ }while( p );
139489140310
}
140311
+SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
140312
+ if( p ) upsertDelete(db, p);
140313
+}
140314
+
139490140315
139491140316
/*
139492140317
** Duplicate an Upsert object.
139493140318
*/
139494140319
SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
@@ -139495,11 +140320,12 @@
139495140320
if( p==0 ) return 0;
139496140321
return sqlite3UpsertNew(db,
139497140322
sqlite3ExprListDup(db, p->pUpsertTarget, 0),
139498140323
sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
139499140324
sqlite3ExprListDup(db, p->pUpsertSet, 0),
139500
- sqlite3ExprDup(db, p->pUpsertWhere, 0)
140325
+ sqlite3ExprDup(db, p->pUpsertWhere, 0),
140326
+ sqlite3UpsertDup(db, p->pNextUpsert)
139501140327
);
139502140328
}
139503140329
139504140330
/*
139505140331
** Create a new Upsert object.
@@ -139507,26 +140333,29 @@
139507140333
SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
139508140334
sqlite3 *db, /* Determines which memory allocator to use */
139509140335
ExprList *pTarget, /* Target argument to ON CONFLICT, or NULL */
139510140336
Expr *pTargetWhere, /* Optional WHERE clause on the target */
139511140337
ExprList *pSet, /* UPDATE columns, or NULL for a DO NOTHING */
139512
- Expr *pWhere /* WHERE clause for the ON CONFLICT UPDATE */
140338
+ Expr *pWhere, /* WHERE clause for the ON CONFLICT UPDATE */
140339
+ Upsert *pNext /* Next ON CONFLICT clause in the list */
139513140340
){
139514140341
Upsert *pNew;
139515
- pNew = sqlite3DbMallocRaw(db, sizeof(Upsert));
140342
+ pNew = sqlite3DbMallocZero(db, sizeof(Upsert));
139516140343
if( pNew==0 ){
139517140344
sqlite3ExprListDelete(db, pTarget);
139518140345
sqlite3ExprDelete(db, pTargetWhere);
139519140346
sqlite3ExprListDelete(db, pSet);
139520140347
sqlite3ExprDelete(db, pWhere);
140348
+ sqlite3UpsertDelete(db, pNext);
139521140349
return 0;
139522140350
}else{
139523140351
pNew->pUpsertTarget = pTarget;
139524140352
pNew->pUpsertTargetWhere = pTargetWhere;
139525140353
pNew->pUpsertSet = pSet;
139526140354
pNew->pUpsertWhere = pWhere;
139527
- pNew->pUpsertIdx = 0;
140355
+ pNew->isDoUpdate = pSet!=0;
140356
+ pNew->pNextUpsert = pNext;
139528140357
}
139529140358
return pNew;
139530140359
}
139531140360
139532140361
/*
@@ -139547,10 +140376,11 @@
139547140376
Index *pIdx; /* One of the indexes of pTab */
139548140377
ExprList *pTarget; /* The conflict-target clause */
139549140378
Expr *pTerm; /* One term of the conflict-target clause */
139550140379
NameContext sNC; /* Context for resolving symbolic names */
139551140380
Expr sCol[2]; /* Index column converted into an Expr */
140381
+ int nClause = 0; /* Counter of ON CONFLICT clauses */
139552140382
139553140383
assert( pTabList->nSrc==1 );
139554140384
assert( pTabList->a[0].pTab!=0 );
139555140385
assert( pUpsert!=0 );
139556140386
assert( pUpsert->pUpsertTarget!=0 );
@@ -139560,91 +140390,135 @@
139560140390
** WHERE clause.
139561140391
*/
139562140392
memset(&sNC, 0, sizeof(sNC));
139563140393
sNC.pParse = pParse;
139564140394
sNC.pSrcList = pTabList;
139565
- rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
139566
- if( rc ) return rc;
139567
- rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
139568
- if( rc ) return rc;
139569
-
139570
- /* Check to see if the conflict target matches the rowid. */
139571
- pTab = pTabList->a[0].pTab;
139572
- pTarget = pUpsert->pUpsertTarget;
139573
- iCursor = pTabList->a[0].iCursor;
139574
- if( HasRowid(pTab)
139575
- && pTarget->nExpr==1
139576
- && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
139577
- && pTerm->iColumn==XN_ROWID
139578
- ){
139579
- /* The conflict-target is the rowid of the primary table */
139580
- assert( pUpsert->pUpsertIdx==0 );
139581
- return SQLITE_OK;
139582
- }
139583
-
139584
- /* Initialize sCol[0..1] to be an expression parse tree for a
139585
- ** single column of an index. The sCol[0] node will be the TK_COLLATE
139586
- ** operator and sCol[1] will be the TK_COLUMN operator. Code below
139587
- ** will populate the specific collation and column number values
139588
- ** prior to comparing against the conflict-target expression.
139589
- */
139590
- memset(sCol, 0, sizeof(sCol));
139591
- sCol[0].op = TK_COLLATE;
139592
- sCol[0].pLeft = &sCol[1];
139593
- sCol[1].op = TK_COLUMN;
139594
- sCol[1].iTable = pTabList->a[0].iCursor;
139595
-
139596
- /* Check for matches against other indexes */
139597
- for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
139598
- int ii, jj, nn;
139599
- if( !IsUniqueIndex(pIdx) ) continue;
139600
- if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
139601
- if( pIdx->pPartIdxWhere ){
139602
- if( pUpsert->pUpsertTargetWhere==0 ) continue;
139603
- if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
139604
- pIdx->pPartIdxWhere, iCursor)!=0 ){
139605
- continue;
139606
- }
139607
- }
139608
- nn = pIdx->nKeyCol;
139609
- for(ii=0; ii<nn; ii++){
139610
- Expr *pExpr;
139611
- sCol[0].u.zToken = (char*)pIdx->azColl[ii];
139612
- if( pIdx->aiColumn[ii]==XN_EXPR ){
139613
- assert( pIdx->aColExpr!=0 );
139614
- assert( pIdx->aColExpr->nExpr>ii );
139615
- pExpr = pIdx->aColExpr->a[ii].pExpr;
139616
- if( pExpr->op!=TK_COLLATE ){
139617
- sCol[0].pLeft = pExpr;
139618
- pExpr = &sCol[0];
139619
- }
139620
- }else{
139621
- sCol[0].pLeft = &sCol[1];
139622
- sCol[1].iColumn = pIdx->aiColumn[ii];
139623
- pExpr = &sCol[0];
139624
- }
139625
- for(jj=0; jj<nn; jj++){
139626
- if( sqlite3ExprCompare(pParse, pTarget->a[jj].pExpr, pExpr,iCursor)<2 ){
139627
- break; /* Column ii of the index matches column jj of target */
139628
- }
139629
- }
139630
- if( jj>=nn ){
139631
- /* The target contains no match for column jj of the index */
139632
- break;
139633
- }
139634
- }
139635
- if( ii<nn ){
139636
- /* Column ii of the index did not match any term of the conflict target.
139637
- ** Continue the search with the next index. */
139638
- continue;
139639
- }
139640
- pUpsert->pUpsertIdx = pIdx;
139641
- return SQLITE_OK;
139642
- }
139643
- sqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any "
139644
- "PRIMARY KEY or UNIQUE constraint");
139645
- return SQLITE_ERROR;
140395
+ for(; pUpsert && pUpsert->pUpsertTarget;
140396
+ pUpsert=pUpsert->pNextUpsert, nClause++){
140397
+ rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
140398
+ if( rc ) return rc;
140399
+ rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
140400
+ if( rc ) return rc;
140401
+
140402
+ /* Check to see if the conflict target matches the rowid. */
140403
+ pTab = pTabList->a[0].pTab;
140404
+ pTarget = pUpsert->pUpsertTarget;
140405
+ iCursor = pTabList->a[0].iCursor;
140406
+ if( HasRowid(pTab)
140407
+ && pTarget->nExpr==1
140408
+ && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
140409
+ && pTerm->iColumn==XN_ROWID
140410
+ ){
140411
+ /* The conflict-target is the rowid of the primary table */
140412
+ assert( pUpsert->pUpsertIdx==0 );
140413
+ continue;
140414
+ }
140415
+
140416
+ /* Initialize sCol[0..1] to be an expression parse tree for a
140417
+ ** single column of an index. The sCol[0] node will be the TK_COLLATE
140418
+ ** operator and sCol[1] will be the TK_COLUMN operator. Code below
140419
+ ** will populate the specific collation and column number values
140420
+ ** prior to comparing against the conflict-target expression.
140421
+ */
140422
+ memset(sCol, 0, sizeof(sCol));
140423
+ sCol[0].op = TK_COLLATE;
140424
+ sCol[0].pLeft = &sCol[1];
140425
+ sCol[1].op = TK_COLUMN;
140426
+ sCol[1].iTable = pTabList->a[0].iCursor;
140427
+
140428
+ /* Check for matches against other indexes */
140429
+ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
140430
+ int ii, jj, nn;
140431
+ if( !IsUniqueIndex(pIdx) ) continue;
140432
+ if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
140433
+ if( pIdx->pPartIdxWhere ){
140434
+ if( pUpsert->pUpsertTargetWhere==0 ) continue;
140435
+ if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
140436
+ pIdx->pPartIdxWhere, iCursor)!=0 ){
140437
+ continue;
140438
+ }
140439
+ }
140440
+ nn = pIdx->nKeyCol;
140441
+ for(ii=0; ii<nn; ii++){
140442
+ Expr *pExpr;
140443
+ sCol[0].u.zToken = (char*)pIdx->azColl[ii];
140444
+ if( pIdx->aiColumn[ii]==XN_EXPR ){
140445
+ assert( pIdx->aColExpr!=0 );
140446
+ assert( pIdx->aColExpr->nExpr>ii );
140447
+ pExpr = pIdx->aColExpr->a[ii].pExpr;
140448
+ if( pExpr->op!=TK_COLLATE ){
140449
+ sCol[0].pLeft = pExpr;
140450
+ pExpr = &sCol[0];
140451
+ }
140452
+ }else{
140453
+ sCol[0].pLeft = &sCol[1];
140454
+ sCol[1].iColumn = pIdx->aiColumn[ii];
140455
+ pExpr = &sCol[0];
140456
+ }
140457
+ for(jj=0; jj<nn; jj++){
140458
+ if( sqlite3ExprCompare(pParse,pTarget->a[jj].pExpr,pExpr,iCursor)<2 ){
140459
+ break; /* Column ii of the index matches column jj of target */
140460
+ }
140461
+ }
140462
+ if( jj>=nn ){
140463
+ /* The target contains no match for column jj of the index */
140464
+ break;
140465
+ }
140466
+ }
140467
+ if( ii<nn ){
140468
+ /* Column ii of the index did not match any term of the conflict target.
140469
+ ** Continue the search with the next index. */
140470
+ continue;
140471
+ }
140472
+ pUpsert->pUpsertIdx = pIdx;
140473
+ break;
140474
+ }
140475
+ if( pUpsert->pUpsertIdx==0 ){
140476
+ char zWhich[16];
140477
+ if( nClause==0 && pUpsert->pNextUpsert==0 ){
140478
+ zWhich[0] = 0;
140479
+ }else{
140480
+ sqlite3_snprintf(sizeof(zWhich),zWhich,"%r ", nClause+1);
140481
+ }
140482
+ sqlite3ErrorMsg(pParse, "%sON CONFLICT clause does not match any "
140483
+ "PRIMARY KEY or UNIQUE constraint", zWhich);
140484
+ return SQLITE_ERROR;
140485
+ }
140486
+ }
140487
+ return SQLITE_OK;
140488
+}
140489
+
140490
+/*
140491
+** Return true if pUpsert is the last ON CONFLICT clause with a
140492
+** conflict target, or if pUpsert is followed by another ON CONFLICT
140493
+** clause that targets the INTEGER PRIMARY KEY.
140494
+*/
140495
+SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert *pUpsert){
140496
+ Upsert *pNext;
140497
+ if( NEVER(pUpsert==0) ) return 0;
140498
+ pNext = pUpsert->pNextUpsert;
140499
+ if( pNext==0 ) return 1;
140500
+ if( pNext->pUpsertTarget==0 ) return 1;
140501
+ if( pNext->pUpsertIdx==0 ) return 1;
140502
+ return 0;
140503
+}
140504
+
140505
+/*
140506
+** Given the list of ON CONFLICT clauses described by pUpsert, and
140507
+** a particular index pIdx, return a pointer to the particular ON CONFLICT
140508
+** clause that applies to the index. Or, if the index is not subject to
140509
+** any ON CONFLICT clause, return NULL.
140510
+*/
140511
+SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert *pUpsert, Index *pIdx){
140512
+ while(
140513
+ pUpsert
140514
+ && pUpsert->pUpsertTarget!=0
140515
+ && pUpsert->pUpsertIdx!=pIdx
140516
+ ){
140517
+ pUpsert = pUpsert->pNextUpsert;
140518
+ }
140519
+ return pUpsert;
139646140520
}
139647140521
139648140522
/*
139649140523
** Generate bytecode that does an UPDATE as part of an upsert.
139650140524
**
@@ -139664,15 +140538,17 @@
139664140538
Vdbe *v = pParse->pVdbe;
139665140539
sqlite3 *db = pParse->db;
139666140540
SrcList *pSrc; /* FROM clause for the UPDATE */
139667140541
int iDataCur;
139668140542
int i;
140543
+ Upsert *pTop = pUpsert;
139669140544
139670140545
assert( v!=0 );
139671140546
assert( pUpsert!=0 );
139672
- VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
139673140547
iDataCur = pUpsert->iDataCur;
140548
+ pUpsert = sqlite3UpsertOfIndex(pTop, pIdx);
140549
+ VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
139674140550
if( pIdx && iCur!=iDataCur ){
139675140551
if( HasRowid(pTab) ){
139676140552
int regRowid = sqlite3GetTempReg(pParse);
139677140553
sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
139678140554
sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
@@ -139698,23 +140574,21 @@
139698140574
"corrupt database", P4_STATIC);
139699140575
sqlite3MayAbort(pParse);
139700140576
sqlite3VdbeJumpHere(v, i);
139701140577
}
139702140578
}
139703
- /* pUpsert does not own pUpsertSrc - the outer INSERT statement does. So
139704
- ** we have to make a copy before passing it down into sqlite3Update() */
139705
- pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0);
140579
+ /* pUpsert does not own pTop->pUpsertSrc - the outer INSERT statement does.
140580
+ ** So we have to make a copy before passing it down into sqlite3Update() */
140581
+ pSrc = sqlite3SrcListDup(db, pTop->pUpsertSrc, 0);
139706140582
/* excluded.* columns of type REAL need to be converted to a hard real */
139707140583
for(i=0; i<pTab->nCol; i++){
139708140584
if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
139709
- sqlite3VdbeAddOp1(v, OP_RealAffinity, pUpsert->regData+i);
140585
+ sqlite3VdbeAddOp1(v, OP_RealAffinity, pTop->regData+i);
139710140586
}
139711140587
}
139712
- sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet,
139713
- pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert);
139714
- pUpsert->pUpsertSet = 0; /* Will have been deleted by sqlite3Update() */
139715
- pUpsert->pUpsertWhere = 0; /* Will have been deleted by sqlite3Update() */
140588
+ sqlite3Update(pParse, pSrc, sqlite3ExprListDup(db,pUpsert->pUpsertSet,0),
140589
+ sqlite3ExprDup(db,pUpsert->pUpsertWhere,0), OE_Abort, 0, 0, pUpsert);
139716140590
VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
139717140591
}
139718140592
139719140593
#endif /* SQLITE_OMIT_UPSERT */
139720140594
@@ -141487,23 +142361,10 @@
141487142361
** a separate source file for easier editing.
141488142362
*/
141489142363
#ifndef SQLITE_WHEREINT_H
141490142364
#define SQLITE_WHEREINT_H
141491142365
141492
-/*
141493
-** Trace output macros
141494
-*/
141495
-#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
141496
-/***/ extern int sqlite3WhereTrace;
141497
-#endif
141498
-#if defined(SQLITE_DEBUG) \
141499
- && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
141500
-# define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
141501
-# define WHERETRACE_ENABLED 1
141502
-#else
141503
-# define WHERETRACE(K,X)
141504
-#endif
141505142366
141506142367
/* Forward references
141507142368
*/
141508142369
typedef struct WhereClause WhereClause;
141509142370
typedef struct WhereMaskSet WhereMaskSet;
@@ -145573,10 +146434,275 @@
145573146434
}
145574146435
if( mPrereq==0 ) return 0; /* No table references */
145575146436
if( (mPrereq&(mPrereq-1))!=0 ) return 0; /* Refs more than one table */
145576146437
return exprMightBeIndexed2(pFrom,mPrereq,aiCurCol,pExpr);
145577146438
}
146439
+
146440
+/*
146441
+** Expression callback for exprUsesSrclist().
146442
+*/
146443
+static int exprUsesSrclistCb(Walker *p, Expr *pExpr){
146444
+ if( pExpr->op==TK_COLUMN ){
146445
+ SrcList *pSrc = p->u.pSrcList;
146446
+ int iCsr = pExpr->iTable;
146447
+ int ii;
146448
+ for(ii=0; ii<pSrc->nSrc; ii++){
146449
+ if( pSrc->a[ii].iCursor==iCsr ){
146450
+ return p->eCode ? WRC_Abort : WRC_Continue;
146451
+ }
146452
+ }
146453
+ return p->eCode ? WRC_Continue : WRC_Abort;
146454
+ }
146455
+ return WRC_Continue;
146456
+}
146457
+
146458
+/*
146459
+** Select callback for exprUsesSrclist().
146460
+*/
146461
+static int exprUsesSrclistSelectCb(Walker *p, Select *pSelect){
146462
+ return WRC_Abort;
146463
+}
146464
+
146465
+/*
146466
+** This function always returns true if expression pExpr contains
146467
+** a sub-select.
146468
+**
146469
+** If there is no sub-select in pExpr, then return true if pExpr
146470
+** contains a TK_COLUMN node for a table that is (bUses==1)
146471
+** or is not (bUses==0) in pSrc.
146472
+**
146473
+** Said another way:
146474
+**
146475
+** bUses Return Meaning
146476
+** -------- ------ ------------------------------------------------
146477
+**
146478
+** bUses==1 true pExpr contains either a sub-select or a
146479
+** TK_COLUMN referencing pSrc.
146480
+**
146481
+** bUses==1 false pExpr contains no sub-selects and all TK_COLUMN
146482
+** nodes reference tables not found in pSrc
146483
+**
146484
+** bUses==0 true pExpr contains either a sub-select or a TK_COLUMN
146485
+** that references a table not in pSrc.
146486
+**
146487
+** bUses==0 false pExpr contains no sub-selects and all TK_COLUMN
146488
+** nodes reference pSrc
146489
+*/
146490
+static int exprUsesSrclist(SrcList *pSrc, Expr *pExpr, int bUses){
146491
+ Walker sWalker;
146492
+ memset(&sWalker, 0, sizeof(Walker));
146493
+ sWalker.eCode = bUses;
146494
+ sWalker.u.pSrcList = pSrc;
146495
+ sWalker.xExprCallback = exprUsesSrclistCb;
146496
+ sWalker.xSelectCallback = exprUsesSrclistSelectCb;
146497
+ return (sqlite3WalkExpr(&sWalker, pExpr)==WRC_Abort);
146498
+}
146499
+
146500
+/*
146501
+** Context object used by exprExistsToInIter() as it iterates through an
146502
+** expression tree.
146503
+*/
146504
+struct ExistsToInCtx {
146505
+ SrcList *pSrc; /* The tables in an EXISTS(SELECT ... FROM <here> ...) */
146506
+ Expr *pInLhs; /* OUT: Use this as the LHS of the IN operator */
146507
+ Expr *pEq; /* OUT: The == term that include pInLhs */
146508
+ Expr **ppAnd; /* OUT: The AND operator that includes pEq as a child */
146509
+ Expr **ppParent; /* The AND operator currently being examined */
146510
+};
146511
+
146512
+/*
146513
+** Iterate through all AND connected nodes in the expression tree
146514
+** headed by (*ppExpr), populating the structure passed as the first
146515
+** argument with the values required by exprAnalyzeExistsFindEq().
146516
+**
146517
+** This function returns non-zero if the expression tree does not meet
146518
+** the two conditions described by the header comment for
146519
+** exprAnalyzeExistsFindEq(), or zero if it does.
146520
+*/
146521
+static int exprExistsToInIter(struct ExistsToInCtx *p, Expr **ppExpr){
146522
+ Expr *pExpr = *ppExpr;
146523
+ switch( pExpr->op ){
146524
+ case TK_AND:
146525
+ p->ppParent = ppExpr;
146526
+ if( exprExistsToInIter(p, &pExpr->pLeft) ) return 1;
146527
+ p->ppParent = ppExpr;
146528
+ if( exprExistsToInIter(p, &pExpr->pRight) ) return 1;
146529
+ break;
146530
+ case TK_EQ: {
146531
+ int bLeft = exprUsesSrclist(p->pSrc, pExpr->pLeft, 0);
146532
+ int bRight = exprUsesSrclist(p->pSrc, pExpr->pRight, 0);
146533
+ if( bLeft || bRight ){
146534
+ if( (bLeft && bRight) || p->pInLhs ) return 1;
146535
+ p->pInLhs = bLeft ? pExpr->pLeft : pExpr->pRight;
146536
+ if( exprUsesSrclist(p->pSrc, p->pInLhs, 1) ) return 1;
146537
+ p->pEq = pExpr;
146538
+ p->ppAnd = p->ppParent;
146539
+ }
146540
+ break;
146541
+ }
146542
+ default:
146543
+ if( exprUsesSrclist(p->pSrc, pExpr, 0) ){
146544
+ return 1;
146545
+ }
146546
+ break;
146547
+ }
146548
+
146549
+ return 0;
146550
+}
146551
+
146552
+/*
146553
+** This function is used by exprAnalyzeExists() when creating virtual IN(...)
146554
+** terms equivalent to user-supplied EXIST(...) clauses. It splits the WHERE
146555
+** clause of the Select object passed as the first argument into one or more
146556
+** expressions joined by AND operators, and then tests if the following are
146557
+** true:
146558
+**
146559
+** 1. Exactly one of the AND separated terms refers to the outer
146560
+** query, and it is an == (TK_EQ) expression.
146561
+**
146562
+** 2. Only one side of the == expression refers to the outer query, and
146563
+** it does not refer to any columns from the inner query.
146564
+**
146565
+** If both these conditions are true, then a pointer to the side of the ==
146566
+** expression that refers to the outer query is returned. The caller will
146567
+** use this expression as the LHS of the IN(...) virtual term. Or, if one
146568
+** or both of the above conditions are not true, NULL is returned.
146569
+**
146570
+** If non-NULL is returned and ppEq is non-NULL, *ppEq is set to point
146571
+** to the == expression node before returning. If pppAnd is non-NULL and
146572
+** the == node is not the root of the WHERE clause, then *pppAnd is set
146573
+** to point to the pointer to the AND node that is the parent of the ==
146574
+** node within the WHERE expression tree.
146575
+*/
146576
+static Expr *exprAnalyzeExistsFindEq(
146577
+ Select *pSel, /* The SELECT of the EXISTS */
146578
+ Expr **ppEq, /* OUT: == node from WHERE clause */
146579
+ Expr ***pppAnd /* OUT: Pointer to parent of ==, if any */
146580
+){
146581
+ struct ExistsToInCtx ctx;
146582
+ memset(&ctx, 0, sizeof(ctx));
146583
+ ctx.pSrc = pSel->pSrc;
146584
+ if( exprExistsToInIter(&ctx, &pSel->pWhere) ){
146585
+ return 0;
146586
+ }
146587
+ if( ppEq ) *ppEq = ctx.pEq;
146588
+ if( pppAnd ) *pppAnd = ctx.ppAnd;
146589
+ return ctx.pInLhs;
146590
+}
146591
+
146592
+/*
146593
+** Term idxTerm of the WHERE clause passed as the second argument is an
146594
+** EXISTS expression with a correlated SELECT statement on the RHS.
146595
+** This function analyzes the SELECT statement, and if possible adds an
146596
+** equivalent "? IN(SELECT...)" virtual term to the WHERE clause.
146597
+**
146598
+** For an EXISTS term such as the following:
146599
+**
146600
+** EXISTS (SELECT ... FROM <srclist> WHERE <e1> = <e2> AND <e3>)
146601
+**
146602
+** The virtual IN() term added is:
146603
+**
146604
+** <e1> IN (SELECT <e2> FROM <srclist> WHERE <e3>)
146605
+**
146606
+** The virtual term is only added if the following conditions are met:
146607
+**
146608
+** 1. The sub-select must not be an aggregate or use window functions,
146609
+**
146610
+** 2. The sub-select must not be a compound SELECT,
146611
+**
146612
+** 3. Expression <e1> must refer to at least one column from the outer
146613
+** query, and must not refer to any column from the inner query
146614
+** (i.e. from <srclist>).
146615
+**
146616
+** 4. <e2> and <e3> must not refer to any values from the outer query.
146617
+** In other words, once <e1> has been removed, the inner query
146618
+** must not be correlated.
146619
+**
146620
+*/
146621
+static void exprAnalyzeExists(
146622
+ SrcList *pSrc, /* the FROM clause */
146623
+ WhereClause *pWC, /* the WHERE clause */
146624
+ int idxTerm /* Index of the term to be analyzed */
146625
+){
146626
+ Parse *pParse = pWC->pWInfo->pParse;
146627
+ WhereTerm *pTerm = &pWC->a[idxTerm];
146628
+ Expr *pExpr = pTerm->pExpr;
146629
+ Select *pSel = pExpr->x.pSelect;
146630
+ Expr *pDup = 0;
146631
+ Expr *pEq = 0;
146632
+ Expr *pRet = 0;
146633
+ Expr *pInLhs = 0;
146634
+ Expr **ppAnd = 0;
146635
+ int idxNew;
146636
+ sqlite3 *db = pParse->db;
146637
+
146638
+ assert( pExpr->op==TK_EXISTS );
146639
+ assert( (pExpr->flags & EP_VarSelect) && (pExpr->flags & EP_xIsSelect) );
146640
+
146641
+ if( (pSel->selFlags & SF_Aggregate) || pSel->pWin ) return;
146642
+ if( pSel->pPrior ) return;
146643
+ if( pSel->pWhere==0 ) return;
146644
+ if( 0==exprAnalyzeExistsFindEq(pSel, 0, 0) ) return;
146645
+
146646
+ pDup = sqlite3ExprDup(db, pExpr, 0);
146647
+ if( db->mallocFailed ){
146648
+ sqlite3ExprDelete(db, pDup);
146649
+ return;
146650
+ }
146651
+ pSel = pDup->x.pSelect;
146652
+ sqlite3ExprListDelete(db, pSel->pEList);
146653
+ pSel->pEList = 0;
146654
+
146655
+ pInLhs = exprAnalyzeExistsFindEq(pSel, &pEq, &ppAnd);
146656
+ assert( pInLhs && pEq );
146657
+ assert( pEq==pSel->pWhere || ppAnd );
146658
+ if( pInLhs==pEq->pLeft ){
146659
+ pRet = pEq->pRight;
146660
+ }else{
146661
+ CollSeq *p = sqlite3ExprCompareCollSeq(pParse, pEq);
146662
+ pInLhs = sqlite3ExprAddCollateString(pParse, pInLhs, p?p->zName:"BINARY");
146663
+ pRet = pEq->pLeft;
146664
+ }
146665
+
146666
+ assert( pDup->pLeft==0 );
146667
+ pDup->op = TK_IN;
146668
+ pDup->pLeft = pInLhs;
146669
+ pDup->flags &= ~EP_VarSelect;
146670
+ if( pRet->op==TK_VECTOR ){
146671
+ pSel->pEList = pRet->x.pList;
146672
+ pRet->x.pList = 0;
146673
+ sqlite3ExprDelete(db, pRet);
146674
+ }else{
146675
+ pSel->pEList = sqlite3ExprListAppend(pParse, 0, pRet);
146676
+ }
146677
+ pEq->pLeft = 0;
146678
+ pEq->pRight = 0;
146679
+ if( ppAnd ){
146680
+ Expr *pAnd = *ppAnd;
146681
+ Expr *pOther = (pAnd->pLeft==pEq) ? pAnd->pRight : pAnd->pLeft;
146682
+ pAnd->pLeft = pAnd->pRight = 0;
146683
+ sqlite3ExprDelete(db, pAnd);
146684
+ *ppAnd = pOther;
146685
+ }else{
146686
+ assert( pSel->pWhere==pEq );
146687
+ pSel->pWhere = 0;
146688
+ }
146689
+ sqlite3ExprDelete(db, pEq);
146690
+
146691
+#ifdef WHERETRACE_ENABLED /* 0x20 */
146692
+ if( sqlite3WhereTrace & 0x20 ){
146693
+ sqlite3DebugPrintf("Convert EXISTS:\n");
146694
+ sqlite3TreeViewExpr(0, pExpr, 0);
146695
+ sqlite3DebugPrintf("into IN:\n");
146696
+ sqlite3TreeViewExpr(0, pDup, 0);
146697
+ }
146698
+#endif
146699
+ idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);
146700
+ exprAnalyze(pSrc, pWC, idxNew);
146701
+ markTermAsChild(pWC, idxNew, idxTerm);
146702
+ pWC->a[idxTerm].wtFlags |= TERM_COPIED;
146703
+}
145578146704
145579146705
/*
145580146706
** The input to this routine is an WhereTerm structure with only the
145581146707
** "pExpr" field filled in. The job of this routine is to analyze the
145582146708
** subexpression and populate all the other fields of the WhereTerm
@@ -145758,10 +146884,20 @@
145758146884
assert( pWC->op==TK_AND );
145759146885
exprAnalyzeOrTerm(pSrc, pWC, idxTerm);
145760146886
pTerm = &pWC->a[idxTerm];
145761146887
}
145762146888
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */
146889
+
146890
+ else if( pExpr->op==TK_EXISTS ){
146891
+ /* Perhaps treat an EXISTS operator as an IN operator */
146892
+ if( (pExpr->flags & EP_VarSelect)!=0
146893
+ && OptimizationEnabled(db, SQLITE_ExistsToIN)
146894
+ ){
146895
+ exprAnalyzeExists(pSrc, pWC, idxTerm);
146896
+ }
146897
+ }
146898
+
145763146899
145764146900
#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION
145765146901
/* Add constraints to reduce the search space on a LIKE or GLOB
145766146902
** operator.
145767146903
**
@@ -146219,16 +147355,10 @@
146219147355
Parse *pParse; /* The parsing context */
146220147356
};
146221147357
146222147358
/* Forward declaration of methods */
146223147359
static int whereLoopResize(sqlite3*, WhereLoop*, int);
146224
-
146225
-/* Test variable that can be set to enable WHERE tracing */
146226
-#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
146227
-/***/ int sqlite3WhereTrace = 0;
146228
-#endif
146229
-
146230147360
146231147361
/*
146232147362
** Return the estimated number of output rows from a WHERE clause
146233147363
*/
146234147364
SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
@@ -146287,10 +147417,36 @@
146287147417
}
146288147418
pInner = &pWInfo->a[pWInfo->nLevel-1];
146289147419
assert( pInner->addrNxt!=0 );
146290147420
return pInner->addrNxt;
146291147421
}
147422
+
147423
+/*
147424
+** While generating code for the min/max optimization, after handling
147425
+** the aggregate-step call to min() or max(), check to see if any
147426
+** additional looping is required. If the output order is such that
147427
+** we are certain that the correct answer has already been found, then
147428
+** code an OP_Goto to by pass subsequent processing.
147429
+**
147430
+** Any extra OP_Goto that is coded here is an optimization. The
147431
+** correct answer should be obtained regardless. This OP_Goto just
147432
+** makes the answer appear faster.
147433
+*/
147434
+SQLITE_PRIVATE void sqlite3WhereMinMaxOptEarlyOut(Vdbe *v, WhereInfo *pWInfo){
147435
+ WhereLevel *pInner;
147436
+ int i;
147437
+ if( !pWInfo->bOrderedInnerLoop ) return;
147438
+ if( pWInfo->nOBSat==0 ) return;
147439
+ for(i=pWInfo->nLevel-1; i>=0; i--){
147440
+ pInner = &pWInfo->a[i];
147441
+ if( (pInner->pWLoop->wsFlags & WHERE_COLUMN_IN)!=0 ){
147442
+ sqlite3VdbeGoto(v, pInner->addrNxt);
147443
+ return;
147444
+ }
147445
+ }
147446
+ sqlite3VdbeGoto(v, pWInfo->iBreak);
147447
+}
146292147448
146293147449
/*
146294147450
** Return the VDBE address or label to jump to in order to continue
146295147451
** immediately with the next row of a WHERE clause.
146296147452
*/
@@ -148794,11 +149950,11 @@
148794149950
pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm
148795149951
);
148796149952
pBtm = pTerm;
148797149953
pTop = 0;
148798149954
if( pTerm->wtFlags & TERM_LIKEOPT ){
148799
- /* Range contraints that come from the LIKE optimization are
149955
+ /* Range constraints that come from the LIKE optimization are
148800149956
** always used in pairs. */
148801149957
pTop = &pTerm[1];
148802149958
assert( (pTop-(pTerm->pWC->a))<pTerm->pWC->nTerm );
148803149959
assert( pTop->wtFlags & TERM_LIKEOPT );
148804149960
assert( pTop->eOperator==WO_LT );
@@ -155319,22 +156475,22 @@
155319156475
#define sqlite3ParserCTX_PDECL ,Parse *pParse
155320156476
#define sqlite3ParserCTX_PARAM ,pParse
155321156477
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
155322156478
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
155323156479
#define YYFALLBACK 1
155324
-#define YYNSTATE 553
155325
-#define YYNRULE 385
155326
-#define YYNRULE_WITH_ACTION 325
156480
+#define YYNSTATE 558
156481
+#define YYNRULE 386
156482
+#define YYNRULE_WITH_ACTION 326
155327156483
#define YYNTOKEN 181
155328
-#define YY_MAX_SHIFT 552
155329
-#define YY_MIN_SHIFTREDUCE 803
155330
-#define YY_MAX_SHIFTREDUCE 1187
155331
-#define YY_ERROR_ACTION 1188
155332
-#define YY_ACCEPT_ACTION 1189
155333
-#define YY_NO_ACTION 1190
155334
-#define YY_MIN_REDUCE 1191
155335
-#define YY_MAX_REDUCE 1575
156484
+#define YY_MAX_SHIFT 557
156485
+#define YY_MIN_SHIFTREDUCE 809
156486
+#define YY_MAX_SHIFTREDUCE 1194
156487
+#define YY_ERROR_ACTION 1195
156488
+#define YY_ACCEPT_ACTION 1196
156489
+#define YY_NO_ACTION 1197
156490
+#define YY_MIN_REDUCE 1198
156491
+#define YY_MAX_REDUCE 1583
155336156492
/************* End control #defines *******************************************/
155337156493
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
155338156494
155339156495
/* Define the yytestcase() macro to be a no-op if is not already defined
155340156496
** otherwise.
@@ -155397,209 +156553,209 @@
155397156553
** yy_reduce_ofst[] For each state, the offset into yy_action for
155398156554
** shifting non-terminals after a reduce.
155399156555
** yy_default[] Default action for each state.
155400156556
**
155401156557
*********** Begin parsing tables **********************************************/
155402
-#define YY_ACTTAB_COUNT (1962)
156558
+#define YY_ACTTAB_COUNT (1968)
155403156559
static const YYACTIONTYPE yy_action[] = {
155404
- /* 0 */ 546, 1222, 546, 451, 1260, 546, 1239, 546, 114, 111,
155405
- /* 10 */ 211, 546, 1537, 546, 1260, 523, 114, 111, 211, 392,
155406
- /* 20 */ 1232, 344, 42, 42, 42, 42, 1225, 42, 42, 71,
155407
- /* 30 */ 71, 937, 1224, 71, 71, 71, 71, 1462, 1493, 938,
155408
- /* 40 */ 820, 453, 6, 121, 122, 112, 1165, 1165, 1006, 1009,
155409
- /* 50 */ 999, 999, 119, 119, 120, 120, 120, 120, 1543, 392,
155410
- /* 60 */ 1358, 1517, 552, 2, 1193, 194, 528, 436, 143, 291,
155411
- /* 70 */ 528, 136, 528, 371, 261, 504, 272, 385, 1273, 527,
155412
- /* 80 */ 503, 493, 164, 121, 122, 112, 1165, 1165, 1006, 1009,
155413
- /* 90 */ 999, 999, 119, 119, 120, 120, 120, 120, 1358, 442,
155414
- /* 100 */ 1514, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155415
- /* 110 */ 115, 424, 266, 266, 266, 266, 1498, 358, 1500, 435,
155416
- /* 120 */ 357, 1498, 517, 524, 1485, 543, 1114, 543, 1114, 392,
155417
- /* 130 */ 405, 241, 208, 114, 111, 211, 98, 290, 537, 221,
155418
- /* 140 */ 1029, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155419
- /* 150 */ 115, 424, 1142, 121, 122, 112, 1165, 1165, 1006, 1009,
155420
- /* 160 */ 999, 999, 119, 119, 120, 120, 120, 120, 406, 428,
155421
- /* 170 */ 117, 117, 116, 116, 116, 115, 424, 1418, 468, 123,
156560
+ /* 0 */ 551, 1229, 551, 456, 1267, 551, 1246, 551, 114, 111,
156561
+ /* 10 */ 212, 551, 1545, 551, 1267, 528, 114, 111, 212, 396,
156562
+ /* 20 */ 1239, 348, 42, 42, 42, 42, 1232, 42, 42, 71,
156563
+ /* 30 */ 71, 943, 1231, 71, 71, 71, 71, 1470, 1501, 944,
156564
+ /* 40 */ 826, 458, 6, 121, 122, 112, 1172, 1172, 1013, 1016,
156565
+ /* 50 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 1551, 396,
156566
+ /* 60 */ 1366, 1525, 557, 2, 1200, 195, 533, 441, 143, 293,
156567
+ /* 70 */ 533, 136, 533, 375, 262, 509, 273, 389, 1280, 532,
156568
+ /* 80 */ 508, 498, 165, 121, 122, 112, 1172, 1172, 1013, 1016,
156569
+ /* 90 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 1366, 447,
156570
+ /* 100 */ 1522, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156571
+ /* 110 */ 115, 429, 267, 267, 267, 267, 1506, 362, 1508, 440,
156572
+ /* 120 */ 361, 1506, 522, 529, 1493, 548, 1121, 548, 1121, 396,
156573
+ /* 130 */ 410, 242, 209, 114, 111, 212, 98, 292, 542, 222,
156574
+ /* 140 */ 1036, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156575
+ /* 150 */ 115, 429, 1149, 121, 122, 112, 1172, 1172, 1013, 1016,
156576
+ /* 160 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 411, 433,
156577
+ /* 170 */ 117, 117, 116, 116, 116, 115, 429, 1426, 473, 123,
155422156578
/* 180 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
155423
- /* 190 */ 424, 116, 116, 116, 115, 424, 540, 540, 540, 392,
155424
- /* 200 */ 505, 120, 120, 120, 120, 113, 1051, 1142, 1143, 1144,
155425
- /* 210 */ 1051, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155426
- /* 220 */ 115, 424, 1461, 121, 122, 112, 1165, 1165, 1006, 1009,
155427
- /* 230 */ 999, 999, 119, 119, 120, 120, 120, 120, 392, 444,
155428
- /* 240 */ 316, 83, 463, 81, 359, 382, 1142, 80, 118, 118,
155429
- /* 250 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 179,
155430
- /* 260 */ 434, 424, 121, 122, 112, 1165, 1165, 1006, 1009, 999,
155431
- /* 270 */ 999, 119, 119, 120, 120, 120, 120, 434, 433, 266,
155432
- /* 280 */ 266, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155433
- /* 290 */ 115, 424, 543, 1109, 903, 506, 1142, 114, 111, 211,
155434
- /* 300 */ 1431, 1142, 1143, 1144, 206, 491, 1109, 392, 449, 1109,
155435
- /* 310 */ 545, 330, 120, 120, 120, 120, 298, 1431, 1433, 17,
156579
+ /* 190 */ 429, 116, 116, 116, 115, 429, 545, 545, 545, 396,
156580
+ /* 200 */ 510, 120, 120, 120, 120, 113, 1058, 1149, 1150, 1151,
156581
+ /* 210 */ 1058, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156582
+ /* 220 */ 115, 429, 1469, 121, 122, 112, 1172, 1172, 1013, 1016,
156583
+ /* 230 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 396, 449,
156584
+ /* 240 */ 320, 83, 468, 81, 363, 386, 1149, 80, 118, 118,
156585
+ /* 250 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 180,
156586
+ /* 260 */ 439, 429, 121, 122, 112, 1172, 1172, 1013, 1016, 1006,
156587
+ /* 270 */ 1006, 119, 119, 120, 120, 120, 120, 439, 438, 267,
156588
+ /* 280 */ 267, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156589
+ /* 290 */ 115, 429, 548, 1116, 909, 511, 1149, 114, 111, 212,
156590
+ /* 300 */ 1439, 1149, 1150, 1151, 207, 496, 1116, 396, 454, 1116,
156591
+ /* 310 */ 550, 334, 120, 120, 120, 120, 300, 1439, 1441, 17,
155436156592
/* 320 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
155437
- /* 330 */ 424, 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999,
155438
- /* 340 */ 119, 119, 120, 120, 120, 120, 392, 1358, 434, 1142,
155439
- /* 350 */ 482, 1142, 1143, 1144, 996, 996, 1007, 1010, 445, 118,
155440
- /* 360 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 424,
155441
- /* 370 */ 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155442
- /* 380 */ 119, 120, 120, 120, 120, 1054, 1054, 465, 1431, 118,
155443
- /* 390 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 424,
155444
- /* 400 */ 1142, 451, 546, 1426, 1142, 1143, 1144, 233, 966, 1142,
155445
- /* 410 */ 481, 478, 477, 171, 360, 392, 164, 407, 414, 842,
155446
- /* 420 */ 476, 164, 185, 334, 71, 71, 1243, 1000, 118, 118,
155447
- /* 430 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 121,
155448
- /* 440 */ 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119, 119,
155449
- /* 450 */ 120, 120, 120, 120, 392, 1142, 1143, 1144, 835, 12,
155450
- /* 460 */ 314, 509, 163, 356, 1142, 1143, 1144, 114, 111, 211,
155451
- /* 470 */ 508, 290, 537, 546, 276, 180, 290, 537, 121, 122,
155452
- /* 480 */ 112, 1165, 1165, 1006, 1009, 999, 999, 119, 119, 120,
155453
- /* 490 */ 120, 120, 120, 345, 484, 71, 71, 118, 118, 118,
155454
- /* 500 */ 118, 117, 117, 116, 116, 116, 115, 424, 1142, 209,
155455
- /* 510 */ 411, 523, 1142, 1109, 1571, 378, 252, 269, 342, 487,
155456
- /* 520 */ 337, 486, 238, 392, 513, 364, 1109, 1127, 333, 1109,
155457
- /* 530 */ 191, 409, 286, 32, 457, 443, 118, 118, 118, 118,
155458
- /* 540 */ 117, 117, 116, 116, 116, 115, 424, 121, 122, 112,
155459
- /* 550 */ 1165, 1165, 1006, 1009, 999, 999, 119, 119, 120, 120,
155460
- /* 560 */ 120, 120, 392, 1142, 1143, 1144, 987, 1142, 1143, 1144,
155461
- /* 570 */ 1142, 233, 492, 1492, 481, 478, 477, 6, 163, 546,
155462
- /* 580 */ 512, 546, 115, 424, 476, 5, 121, 122, 112, 1165,
155463
- /* 590 */ 1165, 1006, 1009, 999, 999, 119, 119, 120, 120, 120,
156593
+ /* 330 */ 429, 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006,
156594
+ /* 340 */ 119, 119, 120, 120, 120, 120, 396, 1366, 439, 1149,
156595
+ /* 350 */ 487, 1149, 1150, 1151, 1003, 1003, 1014, 1017, 406, 118,
156596
+ /* 360 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 429,
156597
+ /* 370 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156598
+ /* 380 */ 119, 120, 120, 120, 120, 1061, 1061, 470, 1439, 118,
156599
+ /* 390 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 429,
156600
+ /* 400 */ 1149, 456, 551, 1434, 1149, 1150, 1151, 234, 973, 1149,
156601
+ /* 410 */ 486, 483, 482, 172, 364, 396, 165, 412, 419, 848,
156602
+ /* 420 */ 481, 165, 186, 338, 71, 71, 1250, 1007, 118, 118,
156603
+ /* 430 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 121,
156604
+ /* 440 */ 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119, 119,
156605
+ /* 450 */ 120, 120, 120, 120, 396, 1149, 1150, 1151, 841, 12,
156606
+ /* 460 */ 318, 514, 164, 360, 1149, 1150, 1151, 114, 111, 212,
156607
+ /* 470 */ 513, 292, 542, 551, 277, 181, 292, 542, 121, 122,
156608
+ /* 480 */ 112, 1172, 1172, 1013, 1016, 1006, 1006, 119, 119, 120,
156609
+ /* 490 */ 120, 120, 120, 349, 489, 71, 71, 118, 118, 118,
156610
+ /* 500 */ 118, 117, 117, 116, 116, 116, 115, 429, 1149, 210,
156611
+ /* 510 */ 416, 528, 1149, 1116, 1579, 382, 253, 270, 346, 492,
156612
+ /* 520 */ 341, 491, 239, 396, 518, 368, 1116, 1134, 337, 1116,
156613
+ /* 530 */ 192, 414, 288, 32, 462, 448, 118, 118, 118, 118,
156614
+ /* 540 */ 117, 117, 116, 116, 116, 115, 429, 121, 122, 112,
156615
+ /* 550 */ 1172, 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120,
156616
+ /* 560 */ 120, 120, 396, 1149, 1150, 1151, 994, 1149, 1150, 1151,
156617
+ /* 570 */ 1149, 234, 497, 1500, 486, 483, 482, 6, 164, 551,
156618
+ /* 580 */ 517, 551, 115, 429, 481, 5, 121, 122, 112, 1172,
156619
+ /* 590 */ 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120,
155464156620
/* 600 */ 120, 13, 13, 13, 13, 118, 118, 118, 118, 117,
155465
- /* 610 */ 117, 116, 116, 116, 115, 424, 403, 502, 408, 546,
155466
- /* 620 */ 1486, 544, 1142, 892, 892, 1142, 1143, 1144, 1473, 1142,
155467
- /* 630 */ 275, 392, 808, 809, 810, 971, 422, 422, 422, 16,
155468
- /* 640 */ 16, 55, 55, 1242, 118, 118, 118, 118, 117, 117,
155469
- /* 650 */ 116, 116, 116, 115, 424, 121, 122, 112, 1165, 1165,
155470
- /* 660 */ 1006, 1009, 999, 999, 119, 119, 120, 120, 120, 120,
155471
- /* 670 */ 392, 1189, 1, 1, 552, 2, 1193, 1142, 1143, 1144,
155472
- /* 680 */ 194, 291, 898, 136, 1142, 1143, 1144, 897, 521, 1492,
155473
- /* 690 */ 1273, 3, 380, 6, 121, 122, 112, 1165, 1165, 1006,
155474
- /* 700 */ 1009, 999, 999, 119, 119, 120, 120, 120, 120, 858,
155475
- /* 710 */ 546, 924, 546, 118, 118, 118, 118, 117, 117, 116,
155476
- /* 720 */ 116, 116, 115, 424, 266, 266, 1092, 1569, 1142, 551,
155477
- /* 730 */ 1569, 1193, 13, 13, 13, 13, 291, 543, 136, 392,
155478
- /* 740 */ 485, 421, 420, 966, 344, 1273, 468, 410, 859, 279,
155479
- /* 750 */ 140, 221, 118, 118, 118, 118, 117, 117, 116, 116,
155480
- /* 760 */ 116, 115, 424, 121, 122, 112, 1165, 1165, 1006, 1009,
155481
- /* 770 */ 999, 999, 119, 119, 120, 120, 120, 120, 546, 266,
155482
- /* 780 */ 266, 428, 392, 1142, 1143, 1144, 1172, 830, 1172, 468,
155483
- /* 790 */ 431, 145, 543, 1146, 401, 314, 439, 302, 838, 1490,
155484
- /* 800 */ 71, 71, 412, 6, 1090, 473, 221, 100, 112, 1165,
155485
- /* 810 */ 1165, 1006, 1009, 999, 999, 119, 119, 120, 120, 120,
156621
+ /* 610 */ 117, 116, 116, 116, 115, 429, 408, 507, 413, 551,
156622
+ /* 620 */ 1494, 549, 1149, 898, 898, 1149, 1150, 1151, 1481, 1149,
156623
+ /* 630 */ 276, 396, 814, 815, 816, 978, 427, 427, 427, 16,
156624
+ /* 640 */ 16, 55, 55, 1249, 118, 118, 118, 118, 117, 117,
156625
+ /* 650 */ 116, 116, 116, 115, 429, 121, 122, 112, 1172, 1172,
156626
+ /* 660 */ 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120, 120,
156627
+ /* 670 */ 396, 1196, 1, 1, 557, 2, 1200, 1149, 1150, 1151,
156628
+ /* 680 */ 195, 293, 904, 136, 1149, 1150, 1151, 903, 526, 1500,
156629
+ /* 690 */ 1280, 3, 384, 6, 121, 122, 112, 1172, 1172, 1013,
156630
+ /* 700 */ 1016, 1006, 1006, 119, 119, 120, 120, 120, 120, 864,
156631
+ /* 710 */ 551, 930, 551, 118, 118, 118, 118, 117, 117, 116,
156632
+ /* 720 */ 116, 116, 115, 429, 267, 267, 1099, 1577, 1149, 556,
156633
+ /* 730 */ 1577, 1200, 13, 13, 13, 13, 293, 548, 136, 396,
156634
+ /* 740 */ 490, 426, 425, 973, 348, 1280, 473, 415, 865, 281,
156635
+ /* 750 */ 140, 222, 118, 118, 118, 118, 117, 117, 116, 116,
156636
+ /* 760 */ 116, 115, 429, 121, 122, 112, 1172, 1172, 1013, 1016,
156637
+ /* 770 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 551, 267,
156638
+ /* 780 */ 267, 433, 396, 1149, 1150, 1151, 1179, 836, 1179, 473,
156639
+ /* 790 */ 436, 145, 548, 1153, 405, 318, 444, 304, 844, 1498,
156640
+ /* 800 */ 71, 71, 417, 6, 1097, 478, 222, 100, 112, 1172,
156641
+ /* 810 */ 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120,
155486156642
/* 820 */ 120, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155487
- /* 830 */ 115, 424, 237, 1425, 546, 451, 428, 287, 986, 546,
155488
- /* 840 */ 236, 235, 234, 830, 97, 529, 429, 1265, 1265, 1146,
155489
- /* 850 */ 494, 307, 430, 838, 977, 546, 71, 71, 976, 1241,
155490
- /* 860 */ 546, 51, 51, 300, 118, 118, 118, 118, 117, 117,
155491
- /* 870 */ 116, 116, 116, 115, 424, 194, 103, 70, 70, 266,
155492
- /* 880 */ 266, 546, 71, 71, 266, 266, 30, 391, 344, 976,
155493
- /* 890 */ 976, 978, 543, 528, 1109, 328, 392, 543, 495, 397,
155494
- /* 900 */ 1470, 195, 530, 13, 13, 1358, 240, 1109, 277, 280,
155495
- /* 910 */ 1109, 280, 304, 457, 306, 333, 392, 31, 188, 419,
155496
- /* 920 */ 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155497
- /* 930 */ 119, 120, 120, 120, 120, 142, 392, 365, 457, 986,
155498
- /* 940 */ 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155499
- /* 950 */ 119, 120, 120, 120, 120, 977, 323, 1142, 326, 976,
155500
- /* 960 */ 121, 110, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155501
- /* 970 */ 119, 120, 120, 120, 120, 464, 377, 1185, 118, 118,
155502
- /* 980 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 1142,
155503
- /* 990 */ 976, 976, 978, 305, 9, 366, 244, 362, 118, 118,
155504
- /* 1000 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 313,
155505
- /* 1010 */ 546, 344, 1142, 1143, 1144, 299, 290, 537, 118, 118,
155506
- /* 1020 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 1263,
155507
- /* 1030 */ 1263, 1163, 13, 13, 278, 421, 420, 468, 392, 923,
155508
- /* 1040 */ 260, 260, 289, 1169, 1142, 1143, 1144, 189, 1171, 266,
155509
- /* 1050 */ 266, 468, 390, 543, 1186, 546, 1170, 263, 144, 489,
155510
- /* 1060 */ 922, 546, 543, 122, 112, 1165, 1165, 1006, 1009, 999,
155511
- /* 1070 */ 999, 119, 119, 120, 120, 120, 120, 71, 71, 1142,
155512
- /* 1080 */ 1172, 1272, 1172, 13, 13, 898, 1070, 1163, 546, 468,
155513
- /* 1090 */ 897, 107, 538, 1491, 4, 1268, 1109, 6, 525, 1049,
155514
- /* 1100 */ 12, 1071, 1092, 1570, 312, 455, 1570, 520, 541, 1109,
155515
- /* 1110 */ 56, 56, 1109, 1489, 423, 1358, 1072, 6, 345, 285,
156643
+ /* 830 */ 115, 429, 238, 1433, 551, 456, 433, 289, 993, 551,
156644
+ /* 840 */ 237, 236, 235, 836, 97, 534, 434, 1272, 1272, 1153,
156645
+ /* 850 */ 499, 309, 435, 844, 984, 551, 71, 71, 983, 1248,
156646
+ /* 860 */ 551, 51, 51, 302, 118, 118, 118, 118, 117, 117,
156647
+ /* 870 */ 116, 116, 116, 115, 429, 195, 103, 70, 70, 267,
156648
+ /* 880 */ 267, 551, 71, 71, 267, 267, 30, 395, 348, 983,
156649
+ /* 890 */ 983, 985, 548, 533, 1116, 332, 396, 548, 500, 401,
156650
+ /* 900 */ 460, 196, 535, 13, 13, 1366, 241, 1116, 278, 282,
156651
+ /* 910 */ 1116, 282, 306, 462, 308, 337, 396, 31, 189, 424,
156652
+ /* 920 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156653
+ /* 930 */ 119, 120, 120, 120, 120, 142, 396, 369, 456, 993,
156654
+ /* 940 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156655
+ /* 950 */ 119, 120, 120, 120, 120, 984, 327, 1149, 330, 983,
156656
+ /* 960 */ 121, 110, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156657
+ /* 970 */ 119, 120, 120, 120, 120, 469, 381, 1192, 118, 118,
156658
+ /* 980 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 1149,
156659
+ /* 990 */ 983, 983, 985, 307, 9, 461, 245, 462, 118, 118,
156660
+ /* 1000 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 317,
156661
+ /* 1010 */ 551, 279, 1149, 1150, 1151, 301, 292, 542, 118, 118,
156662
+ /* 1020 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 1270,
156663
+ /* 1030 */ 1270, 1170, 13, 13, 531, 426, 425, 473, 396, 929,
156664
+ /* 1040 */ 261, 261, 97, 1176, 1149, 1150, 1151, 190, 1178, 267,
156665
+ /* 1050 */ 267, 473, 138, 548, 1193, 551, 1177, 264, 348, 494,
156666
+ /* 1060 */ 928, 551, 548, 122, 112, 1172, 1172, 1013, 1016, 1006,
156667
+ /* 1070 */ 1006, 119, 119, 120, 120, 120, 120, 71, 71, 1149,
156668
+ /* 1080 */ 1179, 1279, 1179, 13, 13, 904, 1077, 1170, 551, 473,
156669
+ /* 1090 */ 903, 107, 543, 280, 4, 1275, 1116, 450, 530, 1056,
156670
+ /* 1100 */ 12, 1078, 1099, 1578, 316, 144, 1578, 525, 546, 1116,
156671
+ /* 1110 */ 56, 56, 1116, 1499, 428, 1366, 1079, 6, 349, 970,
155516156672
/* 1120 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
155517
- /* 1130 */ 424, 425, 1271, 321, 1142, 1143, 1144, 878, 266, 266,
155518
- /* 1140 */ 1277, 107, 538, 535, 4, 1488, 293, 879, 1211, 6,
155519
- /* 1150 */ 210, 543, 543, 164, 294, 496, 416, 204, 541, 267,
155520
- /* 1160 */ 267, 1214, 398, 511, 499, 204, 266, 266, 396, 531,
155521
- /* 1170 */ 8, 986, 543, 519, 546, 922, 458, 105, 105, 543,
155522
- /* 1180 */ 1090, 425, 266, 266, 106, 417, 425, 548, 547, 266,
155523
- /* 1190 */ 266, 976, 518, 535, 1373, 543, 15, 15, 266, 266,
155524
- /* 1200 */ 456, 1120, 543, 266, 266, 1070, 1372, 515, 290, 537,
155525
- /* 1210 */ 546, 543, 514, 97, 444, 316, 543, 546, 922, 125,
155526
- /* 1220 */ 1071, 986, 976, 976, 978, 979, 27, 105, 105, 401,
155527
- /* 1230 */ 343, 1511, 44, 44, 106, 1072, 425, 548, 547, 57,
155528
- /* 1240 */ 57, 976, 343, 1511, 107, 538, 546, 4, 462, 401,
155529
- /* 1250 */ 214, 1120, 459, 297, 377, 1091, 534, 1309, 546, 539,
155530
- /* 1260 */ 398, 541, 290, 537, 104, 244, 102, 526, 58, 58,
155531
- /* 1270 */ 546, 199, 976, 976, 978, 979, 27, 1516, 1131, 427,
155532
- /* 1280 */ 59, 59, 270, 237, 425, 138, 95, 375, 375, 374,
155533
- /* 1290 */ 255, 372, 60, 60, 817, 1180, 535, 546, 273, 546,
155534
- /* 1300 */ 1163, 1308, 389, 388, 546, 438, 546, 215, 210, 296,
155535
- /* 1310 */ 515, 849, 546, 265, 208, 516, 1476, 295, 274, 61,
155536
- /* 1320 */ 61, 62, 62, 308, 986, 109, 45, 45, 46, 46,
155537
- /* 1330 */ 105, 105, 1186, 922, 47, 47, 341, 106, 546, 425,
155538
- /* 1340 */ 548, 547, 1542, 546, 976, 867, 340, 217, 546, 937,
155539
- /* 1350 */ 397, 107, 538, 218, 4, 156, 1163, 938, 158, 546,
155540
- /* 1360 */ 49, 49, 1162, 546, 268, 50, 50, 546, 541, 1450,
155541
- /* 1370 */ 63, 63, 546, 1449, 216, 976, 976, 978, 979, 27,
155542
- /* 1380 */ 446, 64, 64, 546, 460, 65, 65, 546, 318, 14,
155543
- /* 1390 */ 14, 425, 1305, 546, 66, 66, 1087, 546, 141, 379,
155544
- /* 1400 */ 38, 546, 963, 535, 322, 127, 127, 546, 393, 67,
155545
- /* 1410 */ 67, 546, 325, 290, 537, 52, 52, 515, 546, 68,
155546
- /* 1420 */ 68, 845, 514, 69, 69, 399, 165, 857, 856, 53,
155547
- /* 1430 */ 53, 986, 311, 151, 151, 97, 432, 105, 105, 327,
155548
- /* 1440 */ 152, 152, 526, 1048, 106, 1048, 425, 548, 547, 1131,
155549
- /* 1450 */ 427, 976, 1032, 270, 968, 239, 329, 243, 375, 375,
155550
- /* 1460 */ 374, 255, 372, 940, 941, 817, 1296, 546, 220, 546,
155551
- /* 1470 */ 107, 538, 546, 4, 546, 1256, 199, 845, 215, 1036,
155552
- /* 1480 */ 296, 1530, 976, 976, 978, 979, 27, 541, 295, 76,
155553
- /* 1490 */ 76, 54, 54, 980, 72, 72, 128, 128, 864, 865,
155554
- /* 1500 */ 107, 538, 546, 4, 1047, 546, 1047, 533, 469, 546,
155555
- /* 1510 */ 425, 546, 450, 1240, 546, 243, 546, 541, 217, 546,
155556
- /* 1520 */ 452, 197, 535, 243, 73, 73, 156, 129, 129, 158,
155557
- /* 1530 */ 336, 130, 130, 126, 126, 1036, 150, 150, 149, 149,
155558
- /* 1540 */ 425, 134, 134, 317, 474, 216, 97, 239, 331, 980,
155559
- /* 1550 */ 986, 97, 535, 346, 347, 546, 105, 105, 902, 931,
155560
- /* 1560 */ 546, 895, 243, 106, 109, 425, 548, 547, 546, 1505,
155561
- /* 1570 */ 976, 828, 99, 538, 139, 4, 546, 133, 133, 393,
155562
- /* 1580 */ 986, 1317, 131, 131, 290, 537, 105, 105, 1357, 541,
155563
- /* 1590 */ 132, 132, 1292, 106, 1303, 425, 548, 547, 75, 75,
155564
- /* 1600 */ 976, 976, 976, 978, 979, 27, 546, 432, 896, 1289,
155565
- /* 1610 */ 532, 109, 425, 1363, 546, 1221, 1213, 1202, 258, 546,
155566
- /* 1620 */ 349, 546, 1201, 11, 535, 1203, 1524, 351, 77, 77,
155567
- /* 1630 */ 376, 976, 976, 978, 979, 27, 74, 74, 353, 213,
155568
- /* 1640 */ 301, 43, 43, 48, 48, 437, 310, 201, 303, 1350,
155569
- /* 1650 */ 315, 355, 986, 454, 479, 1239, 339, 192, 105, 105,
155570
- /* 1660 */ 1422, 1421, 193, 536, 205, 106, 1527, 425, 548, 547,
155571
- /* 1670 */ 1180, 167, 976, 270, 247, 1469, 1467, 1177, 375, 375,
155572
- /* 1680 */ 374, 255, 372, 200, 369, 817, 400, 83, 79, 82,
155573
- /* 1690 */ 1427, 448, 177, 95, 1342, 161, 169, 1339, 215, 440,
155574
- /* 1700 */ 296, 172, 173, 976, 976, 978, 979, 27, 295, 174,
155575
- /* 1710 */ 175, 441, 472, 223, 1347, 383, 35, 381, 36, 461,
155576
- /* 1720 */ 88, 1353, 181, 447, 384, 1416, 227, 467, 259, 229,
155577
- /* 1730 */ 186, 488, 470, 324, 1250, 230, 231, 320, 217, 1204,
155578
- /* 1740 */ 1438, 1259, 386, 1258, 413, 90, 156, 849, 1541, 158,
155579
- /* 1750 */ 206, 415, 1540, 507, 1300, 1257, 94, 348, 1229, 1301,
155580
- /* 1760 */ 387, 1510, 1228, 338, 1227, 216, 350, 1539, 498, 283,
155581
- /* 1770 */ 284, 1249, 501, 1299, 352, 245, 246, 418, 1298, 354,
155582
- /* 1780 */ 1496, 1495, 124, 10, 526, 363, 101, 1324, 253, 96,
155583
- /* 1790 */ 510, 1210, 34, 549, 1137, 254, 256, 257, 166, 393,
155584
- /* 1800 */ 550, 1199, 1282, 361, 290, 537, 1281, 196, 367, 368,
155585
- /* 1810 */ 1194, 153, 1454, 137, 281, 1323, 1455, 804, 154, 426,
155586
- /* 1820 */ 198, 155, 1453, 1452, 292, 212, 202, 432, 1402, 203,
155587
- /* 1830 */ 271, 135, 288, 78, 1046, 1044, 960, 168, 157, 881,
155588
- /* 1840 */ 170, 219, 309, 222, 1060, 176, 964, 159, 402, 84,
155589
- /* 1850 */ 178, 404, 85, 86, 87, 160, 1063, 224, 394, 395,
155590
- /* 1860 */ 225, 1059, 146, 18, 226, 319, 243, 1174, 466, 228,
155591
- /* 1870 */ 1052, 182, 183, 37, 819, 471, 340, 232, 332, 483,
155592
- /* 1880 */ 184, 89, 162, 19, 20, 475, 91, 480, 847, 335,
155593
- /* 1890 */ 147, 860, 282, 92, 490, 93, 1125, 148, 1012, 1095,
155594
- /* 1900 */ 39, 497, 1096, 40, 500, 262, 207, 264, 930, 187,
155595
- /* 1910 */ 925, 109, 1111, 1115, 1113, 7, 1099, 242, 33, 1119,
155596
- /* 1920 */ 21, 522, 22, 23, 24, 1118, 25, 190, 97, 26,
155597
- /* 1930 */ 1027, 1013, 1011, 1015, 1069, 1016, 1068, 249, 248, 28,
155598
- /* 1940 */ 41, 891, 981, 829, 108, 29, 250, 542, 251, 370,
155599
- /* 1950 */ 373, 1133, 1132, 1190, 1190, 1190, 1190, 1190, 1190, 1190,
155600
- /* 1960 */ 1532, 1531,
156673
+ /* 1130 */ 429, 430, 1278, 325, 1149, 1150, 1151, 884, 267, 267,
156674
+ /* 1140 */ 855, 107, 543, 540, 4, 1497, 238, 885, 1218, 6,
156675
+ /* 1150 */ 211, 548, 370, 165, 366, 501, 421, 1496, 546, 268,
156676
+ /* 1160 */ 268, 6, 1550, 516, 504, 873, 267, 267, 400, 536,
156677
+ /* 1170 */ 8, 993, 548, 524, 551, 928, 463, 105, 105, 548,
156678
+ /* 1180 */ 1097, 430, 267, 267, 106, 422, 430, 553, 552, 267,
156679
+ /* 1190 */ 267, 983, 523, 540, 1381, 548, 15, 15, 267, 267,
156680
+ /* 1200 */ 1478, 1127, 548, 267, 267, 1077, 1380, 520, 292, 542,
156681
+ /* 1210 */ 551, 548, 519, 401, 449, 320, 548, 551, 928, 125,
156682
+ /* 1220 */ 1078, 993, 983, 983, 985, 986, 27, 105, 105, 405,
156683
+ /* 1230 */ 347, 1519, 44, 44, 106, 1079, 430, 553, 552, 57,
156684
+ /* 1240 */ 57, 983, 347, 1519, 107, 543, 551, 4, 467, 405,
156685
+ /* 1250 */ 215, 1127, 464, 295, 381, 1098, 539, 296, 551, 1221,
156686
+ /* 1260 */ 402, 546, 544, 402, 299, 245, 292, 542, 58, 58,
156687
+ /* 1270 */ 551, 1284, 983, 983, 985, 986, 27, 1524, 1138, 432,
156688
+ /* 1280 */ 59, 59, 271, 548, 430, 403, 166, 379, 379, 378,
156689
+ /* 1290 */ 256, 376, 60, 60, 823, 1187, 540, 551, 274, 551,
156690
+ /* 1300 */ 1170, 851, 393, 392, 551, 205, 551, 216, 211, 298,
156691
+ /* 1310 */ 520, 1303, 551, 266, 209, 521, 1316, 297, 275, 61,
156692
+ /* 1320 */ 61, 62, 62, 451, 993, 205, 45, 45, 46, 46,
156693
+ /* 1330 */ 105, 105, 1193, 928, 47, 47, 291, 106, 551, 430,
156694
+ /* 1340 */ 553, 552, 943, 551, 983, 313, 394, 218, 551, 109,
156695
+ /* 1350 */ 944, 107, 543, 219, 4, 156, 1170, 851, 158, 551,
156696
+ /* 1360 */ 49, 49, 104, 551, 102, 50, 50, 551, 546, 1315,
156697
+ /* 1370 */ 63, 63, 551, 443, 217, 983, 983, 985, 986, 27,
156698
+ /* 1380 */ 1484, 64, 64, 551, 310, 65, 65, 551, 1458, 14,
156699
+ /* 1390 */ 14, 430, 1457, 551, 66, 66, 1094, 551, 1169, 383,
156700
+ /* 1400 */ 141, 551, 38, 540, 269, 127, 127, 551, 397, 67,
156701
+ /* 1410 */ 67, 551, 465, 292, 542, 52, 52, 520, 551, 68,
156702
+ /* 1420 */ 68, 1043, 519, 69, 69, 315, 95, 322, 97, 53,
156703
+ /* 1430 */ 53, 993, 975, 151, 151, 244, 437, 105, 105, 200,
156704
+ /* 1440 */ 152, 152, 455, 1312, 106, 244, 430, 553, 552, 1138,
156705
+ /* 1450 */ 432, 983, 457, 271, 321, 244, 326, 97, 379, 379,
156706
+ /* 1460 */ 378, 256, 376, 863, 862, 823, 531, 551, 221, 551,
156707
+ /* 1470 */ 107, 543, 551, 4, 551, 329, 479, 1043, 216, 240,
156708
+ /* 1480 */ 298, 331, 983, 983, 985, 986, 27, 546, 297, 76,
156709
+ /* 1490 */ 76, 54, 54, 333, 72, 72, 128, 128, 870, 871,
156710
+ /* 1500 */ 107, 543, 551, 4, 1263, 551, 946, 947, 1247, 551,
156711
+ /* 1510 */ 430, 551, 200, 1055, 551, 1055, 551, 546, 218, 551,
156712
+ /* 1520 */ 335, 1538, 540, 97, 73, 73, 156, 129, 129, 158,
156713
+ /* 1530 */ 340, 130, 130, 126, 126, 350, 150, 150, 149, 149,
156714
+ /* 1540 */ 430, 134, 134, 345, 1039, 217, 937, 240, 901, 244,
156715
+ /* 1550 */ 993, 109, 540, 344, 987, 551, 105, 105, 908, 351,
156716
+ /* 1560 */ 551, 1513, 1054, 106, 1054, 430, 553, 552, 551, 1324,
156717
+ /* 1570 */ 983, 834, 99, 543, 139, 4, 551, 133, 133, 397,
156718
+ /* 1580 */ 993, 1365, 131, 131, 292, 542, 105, 105, 1299, 546,
156719
+ /* 1590 */ 132, 132, 287, 106, 1310, 430, 553, 552, 75, 75,
156720
+ /* 1600 */ 983, 983, 983, 985, 986, 27, 551, 437, 902, 537,
156721
+ /* 1610 */ 987, 109, 430, 259, 551, 538, 1371, 1228, 474, 551,
156722
+ /* 1620 */ 198, 551, 1220, 1209, 540, 1208, 1210, 1532, 77, 77,
156723
+ /* 1630 */ 202, 983, 983, 985, 986, 27, 74, 74, 1296, 353,
156724
+ /* 1640 */ 355, 43, 43, 48, 48, 357, 11, 380, 214, 343,
156725
+ /* 1650 */ 303, 442, 993, 312, 305, 1360, 314, 484, 105, 105,
156726
+ /* 1660 */ 459, 1246, 319, 206, 1430, 106, 1429, 430, 553, 552,
156727
+ /* 1670 */ 359, 541, 983, 271, 1535, 1187, 168, 248, 379, 379,
156728
+ /* 1680 */ 378, 256, 376, 201, 193, 823, 373, 194, 1477, 1475,
156729
+ /* 1690 */ 1184, 79, 404, 82, 83, 453, 178, 95, 216, 1349,
156730
+ /* 1700 */ 298, 162, 1435, 983, 983, 985, 986, 27, 297, 1354,
156731
+ /* 1710 */ 1346, 35, 170, 445, 446, 477, 173, 174, 175, 176,
156732
+ /* 1720 */ 385, 224, 1358, 1361, 1357, 466, 387, 36, 182, 452,
156733
+ /* 1730 */ 388, 1424, 228, 88, 472, 260, 230, 1446, 218, 187,
156734
+ /* 1740 */ 475, 328, 231, 390, 324, 1211, 156, 232, 493, 158,
156735
+ /* 1750 */ 418, 90, 1257, 1266, 1549, 1265, 1264, 855, 1256, 207,
156736
+ /* 1760 */ 420, 512, 1307, 1548, 94, 217, 352, 391, 1236, 1235,
156737
+ /* 1770 */ 342, 1234, 1547, 1518, 354, 285, 503, 286, 506, 246,
156738
+ /* 1780 */ 247, 1504, 1503, 423, 1308, 124, 531, 1306, 356, 10,
156739
+ /* 1790 */ 1305, 367, 1331, 101, 290, 96, 254, 515, 1217, 397,
156740
+ /* 1800 */ 34, 554, 1144, 255, 292, 542, 257, 372, 1289, 365,
156741
+ /* 1810 */ 371, 358, 1288, 197, 258, 555, 1206, 1201, 1462, 153,
156742
+ /* 1820 */ 1463, 1330, 1461, 154, 137, 283, 1460, 437, 155, 203,
156743
+ /* 1830 */ 810, 204, 78, 431, 1410, 199, 294, 213, 272, 135,
156744
+ /* 1840 */ 1053, 1051, 966, 157, 169, 220, 171, 887, 311, 223,
156745
+ /* 1850 */ 1067, 177, 159, 160, 407, 84, 409, 179, 85, 86,
156746
+ /* 1860 */ 87, 161, 1070, 225, 1066, 398, 167, 399, 18, 226,
156747
+ /* 1870 */ 146, 227, 323, 244, 1181, 471, 229, 1059, 183, 184,
156748
+ /* 1880 */ 37, 825, 344, 476, 233, 336, 488, 480, 185, 89,
156749
+ /* 1890 */ 19, 20, 485, 92, 853, 339, 91, 163, 866, 147,
156750
+ /* 1900 */ 284, 495, 502, 1132, 148, 1019, 936, 1102, 39, 93,
156751
+ /* 1910 */ 1103, 40, 505, 263, 208, 265, 188, 931, 1122, 243,
156752
+ /* 1920 */ 1126, 109, 33, 1120, 1118, 21, 1106, 22, 527, 1034,
156753
+ /* 1930 */ 23, 24, 1125, 25, 191, 97, 26, 1020, 1018, 1022,
156754
+ /* 1940 */ 1076, 250, 7, 1075, 249, 1023, 28, 41, 547, 988,
156755
+ /* 1950 */ 835, 108, 29, 251, 252, 1540, 374, 897, 377, 1140,
156756
+ /* 1960 */ 1139, 1197, 1197, 1197, 1197, 1197, 1197, 1539,
155601156757
};
155602156758
static const YYCODETYPE yy_lookahead[] = {
155603156759
/* 0 */ 189, 211, 189, 189, 218, 189, 220, 189, 267, 268,
155604156760
/* 10 */ 269, 189, 210, 189, 228, 189, 267, 268, 269, 19,
155605156761
/* 20 */ 218, 189, 211, 212, 211, 212, 211, 211, 212, 211,
@@ -155688,117 +156844,117 @@
155688156844
/* 850 */ 200, 16, 189, 114, 115, 189, 211, 212, 119, 221,
155689156845
/* 860 */ 189, 211, 212, 258, 101, 102, 103, 104, 105, 106,
155690156846
/* 870 */ 107, 108, 109, 110, 111, 189, 156, 211, 212, 234,
155691156847
/* 880 */ 235, 189, 211, 212, 234, 235, 22, 201, 189, 150,
155692156848
/* 890 */ 151, 152, 247, 248, 76, 16, 19, 247, 248, 113,
155693
- /* 900 */ 189, 24, 257, 211, 212, 189, 26, 89, 262, 223,
156849
+ /* 900 */ 19, 24, 257, 211, 212, 189, 26, 89, 262, 223,
155694156850
/* 910 */ 92, 225, 77, 189, 79, 129, 19, 53, 226, 248,
155695156851
/* 920 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
155696156852
/* 930 */ 53, 54, 55, 56, 57, 236, 19, 271, 189, 99,
155697156853
/* 940 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
155698156854
/* 950 */ 53, 54, 55, 56, 57, 115, 77, 59, 79, 119,
155699156855
/* 960 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
155700156856
/* 970 */ 53, 54, 55, 56, 57, 259, 22, 23, 101, 102,
155701156857
/* 980 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 59,
155702
- /* 990 */ 150, 151, 152, 158, 22, 244, 24, 246, 101, 102,
156858
+ /* 990 */ 150, 151, 152, 158, 22, 114, 24, 189, 101, 102,
155703156859
/* 1000 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 285,
155704
- /* 1010 */ 189, 189, 114, 115, 116, 200, 136, 137, 101, 102,
156860
+ /* 1010 */ 189, 262, 114, 115, 116, 200, 136, 137, 101, 102,
155705156861
/* 1020 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 230,
155706
- /* 1030 */ 231, 59, 211, 212, 285, 105, 106, 189, 19, 141,
155707
- /* 1040 */ 234, 235, 239, 113, 114, 115, 116, 226, 118, 234,
155708
- /* 1050 */ 235, 189, 249, 247, 100, 189, 126, 23, 236, 107,
156862
+ /* 1030 */ 231, 59, 211, 212, 143, 105, 106, 189, 19, 141,
156863
+ /* 1040 */ 234, 235, 26, 113, 114, 115, 116, 226, 118, 234,
156864
+ /* 1050 */ 235, 189, 161, 247, 100, 189, 126, 23, 189, 107,
155709156865
/* 1060 */ 26, 189, 247, 44, 45, 46, 47, 48, 49, 50,
155710156866
/* 1070 */ 51, 52, 53, 54, 55, 56, 57, 211, 212, 59,
155711156867
/* 1080 */ 150, 233, 152, 211, 212, 133, 12, 115, 189, 189,
155712
- /* 1090 */ 138, 19, 20, 300, 22, 233, 76, 304, 226, 11,
155713
- /* 1100 */ 208, 27, 22, 23, 200, 19, 26, 87, 36, 89,
155714
- /* 1110 */ 211, 212, 92, 300, 248, 189, 42, 304, 189, 250,
156868
+ /* 1090 */ 138, 19, 20, 285, 22, 233, 76, 127, 226, 11,
156869
+ /* 1100 */ 208, 27, 22, 23, 200, 236, 26, 87, 36, 89,
156870
+ /* 1110 */ 211, 212, 92, 300, 248, 189, 42, 304, 189, 149,
155715156871
/* 1120 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
155716156872
/* 1130 */ 111, 59, 200, 233, 114, 115, 116, 63, 234, 235,
155717
- /* 1140 */ 235, 19, 20, 71, 22, 300, 189, 73, 200, 304,
155718
- /* 1150 */ 116, 247, 247, 81, 189, 200, 227, 26, 36, 234,
155719
- /* 1160 */ 235, 203, 204, 143, 200, 26, 234, 235, 194, 200,
156873
+ /* 1140 */ 124, 19, 20, 71, 22, 300, 46, 73, 200, 304,
156874
+ /* 1150 */ 116, 247, 244, 81, 246, 200, 227, 300, 36, 234,
156875
+ /* 1160 */ 235, 304, 23, 143, 200, 26, 234, 235, 194, 200,
155720156876
/* 1170 */ 48, 99, 247, 66, 189, 141, 284, 105, 106, 247,
155721156877
/* 1180 */ 100, 59, 234, 235, 112, 259, 114, 115, 116, 234,
155722156878
/* 1190 */ 235, 119, 85, 71, 266, 247, 211, 212, 234, 235,
155723
- /* 1200 */ 114, 94, 247, 234, 235, 12, 266, 85, 136, 137,
155724
- /* 1210 */ 189, 247, 90, 26, 126, 127, 247, 189, 26, 22,
156879
+ /* 1200 */ 189, 94, 247, 234, 235, 12, 266, 85, 136, 137,
156880
+ /* 1210 */ 189, 247, 90, 113, 126, 127, 247, 189, 26, 22,
155725156881
/* 1220 */ 27, 99, 150, 151, 152, 153, 154, 105, 106, 189,
155726156882
/* 1230 */ 302, 303, 211, 212, 112, 42, 114, 115, 116, 211,
155727156883
/* 1240 */ 212, 119, 302, 303, 19, 20, 189, 22, 274, 189,
155728156884
/* 1250 */ 15, 144, 278, 189, 22, 23, 63, 189, 189, 203,
155729
- /* 1260 */ 204, 36, 136, 137, 155, 24, 157, 143, 211, 212,
155730
- /* 1270 */ 189, 140, 150, 151, 152, 153, 154, 0, 1, 2,
155731
- /* 1280 */ 211, 212, 5, 46, 59, 161, 147, 10, 11, 12,
156885
+ /* 1260 */ 204, 36, 203, 204, 189, 24, 136, 137, 211, 212,
156886
+ /* 1270 */ 189, 235, 150, 151, 152, 153, 154, 0, 1, 2,
156887
+ /* 1280 */ 211, 212, 5, 247, 59, 292, 293, 10, 11, 12,
155732156888
/* 1290 */ 13, 14, 211, 212, 17, 60, 71, 189, 258, 189,
155733
- /* 1300 */ 59, 189, 105, 106, 189, 189, 189, 30, 116, 32,
155734
- /* 1310 */ 85, 124, 189, 251, 252, 90, 189, 40, 258, 211,
155735
- /* 1320 */ 212, 211, 212, 189, 99, 26, 211, 212, 211, 212,
155736
- /* 1330 */ 105, 106, 100, 141, 211, 212, 119, 112, 189, 114,
155737
- /* 1340 */ 115, 116, 23, 189, 119, 26, 129, 70, 189, 31,
155738
- /* 1350 */ 113, 19, 20, 24, 22, 78, 115, 39, 81, 189,
155739
- /* 1360 */ 211, 212, 26, 189, 22, 211, 212, 189, 36, 189,
156889
+ /* 1300 */ 59, 59, 105, 106, 189, 26, 189, 30, 116, 32,
156890
+ /* 1310 */ 85, 253, 189, 251, 252, 90, 189, 40, 258, 211,
156891
+ /* 1320 */ 212, 211, 212, 127, 99, 26, 211, 212, 211, 212,
156892
+ /* 1330 */ 105, 106, 100, 141, 211, 212, 239, 112, 189, 114,
156893
+ /* 1340 */ 115, 116, 31, 189, 119, 149, 249, 70, 189, 26,
156894
+ /* 1350 */ 39, 19, 20, 24, 22, 78, 115, 115, 81, 189,
156895
+ /* 1360 */ 211, 212, 155, 189, 157, 211, 212, 189, 36, 189,
155740156896
/* 1370 */ 211, 212, 189, 189, 97, 150, 151, 152, 153, 154,
155741
- /* 1380 */ 127, 211, 212, 189, 189, 211, 212, 189, 189, 211,
155742
- /* 1390 */ 212, 59, 189, 189, 211, 212, 23, 189, 22, 26,
155743
- /* 1400 */ 24, 189, 149, 71, 189, 211, 212, 189, 131, 211,
156897
+ /* 1380 */ 189, 211, 212, 189, 189, 211, 212, 189, 189, 211,
156898
+ /* 1390 */ 212, 59, 189, 189, 211, 212, 23, 189, 26, 26,
156899
+ /* 1400 */ 22, 189, 24, 71, 22, 211, 212, 189, 131, 211,
155744156900
/* 1410 */ 212, 189, 189, 136, 137, 211, 212, 85, 189, 211,
155745
- /* 1420 */ 212, 59, 90, 211, 212, 292, 293, 118, 119, 211,
155746
- /* 1430 */ 212, 99, 23, 211, 212, 26, 159, 105, 106, 189,
155747
- /* 1440 */ 211, 212, 143, 150, 112, 152, 114, 115, 116, 1,
156901
+ /* 1420 */ 212, 59, 90, 211, 212, 23, 147, 189, 26, 211,
156902
+ /* 1430 */ 212, 99, 23, 211, 212, 26, 159, 105, 106, 140,
156903
+ /* 1440 */ 211, 212, 23, 189, 112, 26, 114, 115, 116, 1,
155748156904
/* 1450 */ 2, 119, 23, 5, 23, 26, 189, 26, 10, 11,
155749
- /* 1460 */ 12, 13, 14, 83, 84, 17, 253, 189, 139, 189,
155750
- /* 1470 */ 19, 20, 189, 22, 189, 189, 140, 115, 30, 59,
155751
- /* 1480 */ 32, 139, 150, 151, 152, 153, 154, 36, 40, 211,
155752
- /* 1490 */ 212, 211, 212, 59, 211, 212, 211, 212, 7, 8,
155753
- /* 1500 */ 19, 20, 189, 22, 150, 189, 152, 231, 281, 189,
155754
- /* 1510 */ 59, 189, 23, 189, 189, 26, 189, 36, 70, 189,
155755
- /* 1520 */ 23, 237, 71, 26, 211, 212, 78, 211, 212, 81,
155756
- /* 1530 */ 189, 211, 212, 211, 212, 115, 211, 212, 211, 212,
155757
- /* 1540 */ 59, 211, 212, 23, 23, 97, 26, 26, 23, 115,
155758
- /* 1550 */ 99, 26, 71, 189, 189, 189, 105, 106, 107, 23,
155759
- /* 1560 */ 189, 23, 26, 112, 26, 114, 115, 116, 189, 309,
156905
+ /* 1460 */ 12, 13, 14, 118, 119, 17, 143, 189, 139, 189,
156906
+ /* 1470 */ 19, 20, 189, 22, 189, 189, 23, 115, 30, 26,
156907
+ /* 1480 */ 32, 189, 150, 151, 152, 153, 154, 36, 40, 211,
156908
+ /* 1490 */ 212, 211, 212, 189, 211, 212, 211, 212, 7, 8,
156909
+ /* 1500 */ 19, 20, 189, 22, 189, 189, 83, 84, 189, 189,
156910
+ /* 1510 */ 59, 189, 140, 150, 189, 152, 189, 36, 70, 189,
156911
+ /* 1520 */ 23, 139, 71, 26, 211, 212, 78, 211, 212, 81,
156912
+ /* 1530 */ 189, 211, 212, 211, 212, 189, 211, 212, 211, 212,
156913
+ /* 1540 */ 59, 211, 212, 119, 23, 97, 23, 26, 23, 26,
156914
+ /* 1550 */ 99, 26, 71, 129, 59, 189, 105, 106, 107, 189,
156915
+ /* 1560 */ 189, 309, 150, 112, 152, 114, 115, 116, 189, 189,
155760156916
/* 1570 */ 119, 23, 19, 20, 26, 22, 189, 211, 212, 131,
155761156917
/* 1580 */ 99, 189, 211, 212, 136, 137, 105, 106, 189, 36,
155762
- /* 1590 */ 211, 212, 189, 112, 189, 114, 115, 116, 211, 212,
155763
- /* 1600 */ 119, 150, 151, 152, 153, 154, 189, 159, 23, 250,
155764
- /* 1610 */ 189, 26, 59, 189, 189, 189, 189, 189, 280, 189,
155765
- /* 1620 */ 250, 189, 189, 238, 71, 189, 189, 250, 211, 212,
155766
- /* 1630 */ 187, 150, 151, 152, 153, 154, 211, 212, 250, 290,
155767
- /* 1640 */ 240, 211, 212, 211, 212, 254, 286, 209, 254, 241,
155768
- /* 1650 */ 240, 254, 99, 286, 215, 220, 214, 244, 105, 106,
155769
- /* 1660 */ 214, 214, 244, 273, 224, 112, 192, 114, 115, 116,
155770
- /* 1670 */ 60, 290, 119, 5, 139, 196, 196, 38, 10, 11,
155771
- /* 1680 */ 12, 13, 14, 238, 240, 17, 196, 148, 287, 287,
155772
- /* 1690 */ 276, 113, 22, 147, 241, 43, 229, 241, 30, 18,
155773
- /* 1700 */ 32, 232, 232, 150, 151, 152, 153, 154, 40, 232,
155774
- /* 1710 */ 232, 196, 18, 195, 265, 265, 264, 241, 264, 196,
155775
- /* 1720 */ 155, 229, 229, 241, 241, 241, 195, 62, 196, 195,
155776
- /* 1730 */ 22, 113, 216, 196, 222, 195, 195, 282, 70, 196,
155777
- /* 1740 */ 283, 213, 216, 213, 64, 22, 78, 124, 219, 81,
155778
- /* 1750 */ 162, 111, 219, 142, 256, 213, 113, 255, 213, 256,
155779
- /* 1760 */ 216, 303, 215, 213, 213, 97, 255, 213, 216, 275,
155780
- /* 1770 */ 275, 222, 216, 256, 255, 196, 91, 82, 256, 255,
155781
- /* 1780 */ 308, 308, 146, 22, 143, 196, 155, 260, 25, 145,
155782
- /* 1790 */ 144, 199, 26, 198, 13, 190, 190, 6, 293, 131,
155783
- /* 1800 */ 188, 188, 245, 244, 136, 137, 245, 243, 242, 241,
155784
- /* 1810 */ 188, 202, 208, 217, 217, 260, 208, 4, 202, 3,
155785
- /* 1820 */ 22, 202, 208, 208, 160, 15, 209, 159, 270, 209,
155786
- /* 1830 */ 98, 16, 272, 208, 23, 23, 137, 148, 128, 20,
155787
- /* 1840 */ 140, 24, 16, 142, 1, 140, 149, 128, 61, 53,
155788
- /* 1850 */ 148, 37, 53, 53, 53, 128, 114, 34, 296, 296,
155789
- /* 1860 */ 139, 1, 5, 22, 113, 158, 26, 75, 41, 139,
155790
- /* 1870 */ 68, 68, 113, 24, 20, 19, 129, 123, 23, 96,
155791
- /* 1880 */ 22, 22, 37, 22, 22, 67, 22, 67, 59, 24,
155792
- /* 1890 */ 23, 28, 67, 147, 22, 26, 23, 23, 23, 23,
155793
- /* 1900 */ 22, 24, 23, 22, 24, 23, 139, 23, 114, 22,
155794
- /* 1910 */ 141, 26, 88, 75, 86, 44, 23, 34, 22, 75,
155795
- /* 1920 */ 34, 24, 34, 34, 34, 93, 34, 26, 26, 34,
155796
- /* 1930 */ 23, 23, 23, 23, 23, 11, 23, 22, 26, 22,
155797
- /* 1940 */ 22, 133, 23, 23, 22, 22, 139, 26, 139, 23,
155798
- /* 1950 */ 15, 1, 1, 310, 310, 310, 310, 310, 310, 310,
155799
- /* 1960 */ 139, 139, 310, 310, 310, 310, 310, 310, 310, 310,
156918
+ /* 1590 */ 211, 212, 250, 112, 189, 114, 115, 116, 211, 212,
156919
+ /* 1600 */ 119, 150, 151, 152, 153, 154, 189, 159, 23, 189,
156920
+ /* 1610 */ 115, 26, 59, 280, 189, 231, 189, 189, 281, 189,
156921
+ /* 1620 */ 237, 189, 189, 189, 71, 189, 189, 189, 211, 212,
156922
+ /* 1630 */ 209, 150, 151, 152, 153, 154, 211, 212, 250, 250,
156923
+ /* 1640 */ 250, 211, 212, 211, 212, 250, 238, 187, 290, 214,
156924
+ /* 1650 */ 240, 254, 99, 286, 254, 241, 241, 215, 105, 106,
156925
+ /* 1660 */ 286, 220, 240, 224, 214, 112, 214, 114, 115, 116,
156926
+ /* 1670 */ 254, 273, 119, 5, 192, 60, 290, 139, 10, 11,
156927
+ /* 1680 */ 12, 13, 14, 238, 244, 17, 240, 244, 196, 196,
156928
+ /* 1690 */ 38, 287, 196, 287, 148, 113, 22, 147, 30, 241,
156929
+ /* 1700 */ 32, 43, 276, 150, 151, 152, 153, 154, 40, 265,
156930
+ /* 1710 */ 241, 264, 229, 18, 196, 18, 232, 232, 232, 232,
156931
+ /* 1720 */ 241, 195, 265, 229, 265, 196, 265, 264, 229, 241,
156932
+ /* 1730 */ 241, 241, 195, 155, 62, 196, 195, 283, 70, 22,
156933
+ /* 1740 */ 216, 196, 195, 216, 282, 196, 78, 195, 113, 81,
156934
+ /* 1750 */ 64, 22, 222, 213, 219, 213, 213, 124, 222, 162,
156935
+ /* 1760 */ 111, 142, 256, 219, 113, 97, 255, 216, 213, 215,
156936
+ /* 1770 */ 213, 213, 213, 303, 255, 275, 216, 275, 216, 196,
156937
+ /* 1780 */ 91, 308, 308, 82, 256, 146, 143, 256, 255, 22,
156938
+ /* 1790 */ 256, 196, 260, 155, 272, 145, 25, 144, 199, 131,
156939
+ /* 1800 */ 26, 198, 13, 190, 136, 137, 190, 241, 245, 244,
156940
+ /* 1810 */ 242, 255, 245, 243, 6, 188, 188, 188, 208, 202,
156941
+ /* 1820 */ 208, 260, 208, 202, 217, 217, 208, 159, 202, 209,
156942
+ /* 1830 */ 4, 209, 208, 3, 270, 22, 160, 15, 98, 16,
156943
+ /* 1840 */ 23, 23, 137, 128, 148, 24, 140, 20, 16, 142,
156944
+ /* 1850 */ 1, 140, 128, 128, 61, 53, 37, 148, 53, 53,
156945
+ /* 1860 */ 53, 128, 114, 34, 1, 296, 293, 296, 22, 139,
156946
+ /* 1870 */ 5, 113, 158, 26, 75, 41, 139, 68, 68, 113,
156947
+ /* 1880 */ 24, 20, 129, 19, 123, 23, 96, 67, 22, 22,
156948
+ /* 1890 */ 22, 22, 67, 147, 59, 24, 22, 37, 28, 23,
156949
+ /* 1900 */ 67, 22, 24, 23, 23, 23, 114, 23, 22, 26,
156950
+ /* 1910 */ 23, 22, 24, 23, 139, 23, 22, 141, 75, 34,
156951
+ /* 1920 */ 75, 26, 22, 86, 88, 34, 23, 34, 24, 23,
156952
+ /* 1930 */ 34, 34, 93, 34, 26, 26, 34, 23, 23, 23,
156953
+ /* 1940 */ 23, 22, 44, 23, 26, 11, 22, 22, 26, 23,
156954
+ /* 1950 */ 23, 22, 22, 139, 139, 139, 23, 133, 15, 1,
156955
+ /* 1960 */ 1, 310, 310, 310, 310, 310, 310, 139, 310, 310,
155800156956
/* 1970 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155801156957
/* 1980 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155802156958
/* 1990 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155803156959
/* 2000 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155804156960
/* 2010 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
@@ -155812,15 +156968,15 @@
155812156968
/* 2090 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155813156969
/* 2100 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155814156970
/* 2110 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155815156971
/* 2120 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155816156972
/* 2130 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155817
- /* 2140 */ 310, 310, 310,
156973
+ /* 2140 */ 310, 310, 310, 310, 310, 310, 310, 310, 310,
155818156974
};
155819
-#define YY_SHIFT_COUNT (552)
156975
+#define YY_SHIFT_COUNT (557)
155820156976
#define YY_SHIFT_MIN (0)
155821
-#define YY_SHIFT_MAX (1951)
156977
+#define YY_SHIFT_MAX (1959)
155822156978
static const unsigned short int yy_shift_ofst[] = {
155823156979
/* 0 */ 1448, 1277, 1668, 1072, 1072, 340, 1122, 1225, 1332, 1481,
155824156980
/* 10 */ 1481, 1481, 335, 0, 0, 180, 897, 1481, 1481, 1481,
155825156981
/* 20 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
155826156982
/* 30 */ 930, 930, 1020, 1020, 290, 1, 340, 340, 340, 340,
@@ -155833,55 +156989,55 @@
155833156989
/* 100 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
155834156990
/* 110 */ 1481, 1481, 1553, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
155835156991
/* 120 */ 1481, 1481, 1481, 1481, 1481, 1481, 147, 258, 258, 258,
155836156992
/* 130 */ 258, 258, 79, 65, 84, 449, 19, 786, 449, 636,
155837156993
/* 140 */ 636, 449, 880, 880, 880, 880, 113, 142, 142, 472,
155838
- /* 150 */ 150, 1962, 1962, 399, 399, 399, 93, 237, 341, 237,
155839
- /* 160 */ 237, 1074, 1074, 437, 350, 704, 1080, 449, 449, 449,
156994
+ /* 150 */ 150, 1968, 1968, 399, 399, 399, 93, 237, 341, 237,
156995
+ /* 160 */ 237, 237, 1074, 1074, 437, 350, 704, 1080, 449, 449,
155840156996
/* 170 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 449,
155841
- /* 180 */ 449, 449, 449, 449, 449, 449, 449, 449, 818, 818,
155842
- /* 190 */ 449, 1088, 217, 217, 734, 734, 1124, 1126, 1962, 1962,
155843
- /* 200 */ 1962, 739, 840, 840, 453, 454, 511, 187, 563, 570,
155844
- /* 210 */ 898, 669, 449, 449, 449, 449, 449, 449, 449, 449,
155845
- /* 220 */ 449, 670, 449, 449, 449, 449, 449, 449, 449, 449,
155846
- /* 230 */ 449, 449, 449, 449, 674, 674, 674, 449, 449, 449,
155847
- /* 240 */ 449, 1034, 449, 449, 449, 972, 1107, 449, 449, 1193,
155848
- /* 250 */ 449, 449, 449, 449, 449, 449, 449, 449, 260, 177,
155849
- /* 260 */ 489, 1241, 1241, 1241, 1241, 1192, 489, 489, 952, 1197,
155850
- /* 270 */ 625, 1235, 1131, 181, 181, 1086, 1139, 1131, 1086, 1187,
155851
- /* 280 */ 1319, 1237, 1318, 1318, 1318, 181, 1299, 1299, 1109, 1336,
155852
- /* 290 */ 549, 1376, 1610, 1535, 1535, 1639, 1639, 1535, 1539, 1578,
155853
- /* 300 */ 1670, 1546, 1652, 1546, 1681, 1681, 1681, 1681, 1535, 1694,
155854
- /* 310 */ 1546, 1546, 1578, 1670, 1652, 1546, 1652, 1546, 1535, 1694,
155855
- /* 320 */ 1565, 1665, 1535, 1694, 1708, 1535, 1694, 1535, 1694, 1708,
155856
- /* 330 */ 1618, 1618, 1618, 1680, 1723, 1723, 1708, 1618, 1623, 1618,
155857
- /* 340 */ 1680, 1618, 1618, 1588, 1708, 1640, 1640, 1708, 1611, 1643,
155858
- /* 350 */ 1611, 1643, 1611, 1643, 1611, 1643, 1535, 1685, 1685, 1695,
155859
- /* 360 */ 1695, 1636, 1641, 1761, 1535, 1631, 1636, 1644, 1646, 1546,
155860
- /* 370 */ 1763, 1766, 1781, 1781, 1791, 1791, 1791, 1962, 1962, 1962,
155861
- /* 380 */ 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962,
155862
- /* 390 */ 1962, 1962, 308, 835, 954, 1232, 879, 715, 728, 1373,
155863
- /* 400 */ 864, 1329, 1253, 1409, 297, 1431, 1489, 1497, 1520, 1521,
155864
- /* 410 */ 1525, 1362, 1309, 1491, 1217, 1420, 1429, 1536, 1380, 1538,
155865
- /* 420 */ 1293, 1354, 1548, 1585, 1434, 1342, 1813, 1816, 1798, 1664,
155866
- /* 430 */ 1810, 1732, 1815, 1811, 1812, 1699, 1689, 1710, 1817, 1700,
155867
- /* 440 */ 1819, 1701, 1826, 1843, 1705, 1697, 1719, 1787, 1814, 1702,
155868
- /* 450 */ 1796, 1799, 1800, 1801, 1727, 1742, 1823, 1721, 1860, 1857,
155869
- /* 460 */ 1841, 1751, 1707, 1802, 1840, 1803, 1792, 1827, 1730, 1759,
155870
- /* 470 */ 1849, 1854, 1856, 1747, 1754, 1858, 1818, 1859, 1861, 1855,
155871
- /* 480 */ 1862, 1820, 1829, 1865, 1783, 1863, 1864, 1825, 1845, 1867,
155872
- /* 490 */ 1746, 1872, 1873, 1874, 1875, 1869, 1876, 1878, 1877, 1879,
155873
- /* 500 */ 1881, 1880, 1767, 1882, 1884, 1794, 1883, 1887, 1769, 1885,
155874
- /* 510 */ 1886, 1888, 1889, 1890, 1824, 1838, 1828, 1871, 1844, 1832,
155875
- /* 520 */ 1892, 1893, 1896, 1897, 1901, 1902, 1895, 1907, 1885, 1908,
155876
- /* 530 */ 1909, 1910, 1911, 1912, 1913, 1915, 1924, 1917, 1918, 1919,
155877
- /* 540 */ 1920, 1922, 1923, 1921, 1808, 1807, 1809, 1821, 1822, 1926,
155878
- /* 550 */ 1935, 1950, 1951,
156997
+ /* 180 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 818,
156998
+ /* 190 */ 818, 449, 1088, 217, 217, 734, 734, 891, 1130, 1968,
156999
+ /* 200 */ 1968, 1968, 739, 840, 840, 453, 454, 511, 187, 563,
157000
+ /* 210 */ 570, 898, 669, 449, 449, 449, 449, 449, 449, 449,
157001
+ /* 220 */ 449, 449, 670, 449, 449, 449, 449, 449, 449, 449,
157002
+ /* 230 */ 449, 449, 449, 449, 449, 674, 674, 674, 449, 449,
157003
+ /* 240 */ 449, 449, 1034, 449, 449, 449, 972, 1107, 449, 449,
157004
+ /* 250 */ 1193, 449, 449, 449, 449, 449, 449, 449, 449, 260,
157005
+ /* 260 */ 177, 489, 1241, 1241, 1241, 1241, 1192, 489, 489, 952,
157006
+ /* 270 */ 1197, 625, 1235, 1299, 181, 181, 881, 1279, 1279, 1299,
157007
+ /* 280 */ 881, 1016, 1139, 1100, 1311, 1311, 1311, 181, 1323, 1323,
157008
+ /* 290 */ 1207, 1372, 549, 1378, 1615, 1538, 1538, 1652, 1652, 1538,
157009
+ /* 300 */ 1546, 1582, 1674, 1550, 1658, 1550, 1695, 1695, 1695, 1695,
157010
+ /* 310 */ 1538, 1697, 1550, 1582, 1582, 1550, 1582, 1674, 1658, 1550,
157011
+ /* 320 */ 1658, 1550, 1538, 1697, 1578, 1672, 1538, 1697, 1717, 1538,
157012
+ /* 330 */ 1697, 1538, 1697, 1717, 1635, 1635, 1635, 1686, 1729, 1729,
157013
+ /* 340 */ 1717, 1635, 1633, 1635, 1686, 1635, 1635, 1597, 1717, 1649,
157014
+ /* 350 */ 1649, 1717, 1619, 1651, 1619, 1651, 1619, 1651, 1619, 1651,
157015
+ /* 360 */ 1538, 1689, 1689, 1701, 1701, 1639, 1643, 1767, 1538, 1638,
157016
+ /* 370 */ 1639, 1650, 1653, 1550, 1771, 1774, 1789, 1789, 1808, 1808,
157017
+ /* 380 */ 1808, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968,
157018
+ /* 390 */ 1968, 1968, 1968, 1968, 1968, 1968, 308, 835, 954, 1232,
157019
+ /* 400 */ 879, 715, 728, 1373, 864, 1329, 970, 1196, 1402, 297,
157020
+ /* 410 */ 1409, 1419, 1429, 1431, 1453, 1497, 1242, 1345, 1491, 1424,
157021
+ /* 420 */ 1362, 1521, 1523, 1423, 1525, 1363, 1412, 1548, 1585, 1495,
157022
+ /* 430 */ 1382, 1826, 1830, 1813, 1676, 1822, 1740, 1823, 1817, 1818,
157023
+ /* 440 */ 1705, 1696, 1715, 1821, 1706, 1827, 1707, 1832, 1849, 1711,
157024
+ /* 450 */ 1724, 1725, 1793, 1819, 1709, 1802, 1805, 1806, 1807, 1733,
157025
+ /* 460 */ 1748, 1829, 1730, 1863, 1865, 1846, 1758, 1714, 1809, 1847,
157026
+ /* 470 */ 1810, 1799, 1834, 1737, 1766, 1856, 1861, 1864, 1753, 1761,
157027
+ /* 480 */ 1866, 1820, 1867, 1868, 1862, 1869, 1825, 1835, 1871, 1790,
157028
+ /* 490 */ 1870, 1874, 1833, 1860, 1876, 1746, 1879, 1880, 1881, 1882,
157029
+ /* 500 */ 1883, 1884, 1886, 1878, 1887, 1889, 1888, 1775, 1890, 1892,
157030
+ /* 510 */ 1792, 1885, 1894, 1776, 1895, 1891, 1893, 1896, 1897, 1836,
157031
+ /* 520 */ 1843, 1837, 1898, 1845, 1839, 1899, 1903, 1900, 1904, 1908,
157032
+ /* 530 */ 1909, 1902, 1906, 1895, 1914, 1915, 1916, 1917, 1918, 1920,
157033
+ /* 540 */ 1919, 1934, 1924, 1925, 1926, 1927, 1929, 1930, 1922, 1824,
157034
+ /* 550 */ 1814, 1815, 1816, 1828, 1933, 1943, 1958, 1959,
155879157035
};
155880
-#define YY_REDUCE_COUNT (391)
157036
+#define YY_REDUCE_COUNT (395)
155881157037
#define YY_REDUCE_MIN (-262)
155882
-#define YY_REDUCE_MAX (1625)
157038
+#define YY_REDUCE_MAX (1629)
155883157039
static const short yy_reduce_ofst[] = {
155884157040
/* 0 */ 490, -122, 545, 645, 650, -120, -189, -187, -184, -182,
155885157041
/* 10 */ -178, -176, 45, 30, 200, -251, -134, 390, 392, 521,
155886157042
/* 20 */ 523, 213, 692, 821, 284, 589, 872, 666, 671, 866,
155887157043
/* 30 */ 71, 111, 273, 389, 686, 815, 904, 932, 948, 955,
@@ -155895,92 +157051,92 @@
155895157051
/* 110 */ 1285, 1313, 1316, 1320, 1322, 1325, 1327, 1330, 1366, 1371,
155896157052
/* 120 */ 1379, 1387, 1417, 1425, 1430, 1432, -259, -259, -259, -259,
155897157053
/* 130 */ -259, -259, -259, -259, -259, 557, 974, -214, -174, -9,
155898157054
/* 140 */ 431, -124, 806, 925, 806, 925, 251, 928, 940, -259,
155899157055
/* 150 */ -259, -259, -259, -198, -198, -198, 127, -186, -168, 212,
155900
- /* 160 */ 646, 617, 799, -262, 555, 220, 220, 491, 605, 1040,
155901
- /* 170 */ 1060, 699, -11, 600, 848, 862, 345, -129, 724, -91,
155902
- /* 180 */ 158, 749, 716, 900, 304, 822, 929, 926, 499, 793,
155903
- /* 190 */ 322, 892, 813, 845, 958, 1056, 751, 905, 1133, 1062,
155904
- /* 200 */ 803, -210, -185, -179, -148, -167, -89, 121, 274, 281,
155905
- /* 210 */ 320, 336, 439, 663, 711, 957, 965, 1064, 1068, 1112,
155906
- /* 220 */ 1116, -196, 1127, 1134, 1180, 1184, 1195, 1199, 1203, 1215,
155907
- /* 230 */ 1223, 1250, 1267, 1286, 205, 422, 638, 1324, 1341, 1364,
155908
- /* 240 */ 1365, 1213, 1392, 1399, 1403, 869, 1260, 1405, 1421, 1276,
155909
- /* 250 */ 1424, 121, 1426, 1427, 1428, 1433, 1436, 1437, 1227, 1338,
155910
- /* 260 */ 1284, 1359, 1370, 1377, 1388, 1213, 1284, 1284, 1385, 1438,
155911
- /* 270 */ 1443, 1349, 1400, 1391, 1394, 1360, 1408, 1410, 1367, 1439,
155912
- /* 280 */ 1440, 1435, 1442, 1446, 1447, 1397, 1413, 1418, 1390, 1444,
155913
- /* 290 */ 1445, 1474, 1381, 1479, 1480, 1401, 1402, 1490, 1414, 1449,
155914
- /* 300 */ 1452, 1453, 1467, 1456, 1469, 1470, 1477, 1478, 1515, 1518,
155915
- /* 310 */ 1476, 1482, 1450, 1454, 1492, 1483, 1493, 1484, 1523, 1531,
155916
- /* 320 */ 1457, 1455, 1532, 1534, 1516, 1537, 1540, 1543, 1541, 1526,
155917
- /* 330 */ 1528, 1530, 1542, 1512, 1529, 1533, 1544, 1545, 1547, 1550,
155918
- /* 340 */ 1549, 1551, 1554, 1458, 1552, 1494, 1495, 1556, 1498, 1502,
155919
- /* 350 */ 1503, 1511, 1517, 1519, 1522, 1524, 1579, 1472, 1473, 1527,
155920
- /* 360 */ 1555, 1557, 1559, 1558, 1589, 1560, 1561, 1564, 1566, 1568,
155921
- /* 370 */ 1592, 1595, 1605, 1606, 1612, 1613, 1622, 1562, 1563, 1505,
155922
- /* 380 */ 1609, 1604, 1608, 1614, 1615, 1616, 1596, 1597, 1617, 1620,
155923
- /* 390 */ 1625, 1619,
157056
+ /* 160 */ 646, 749, 617, 799, -262, 555, 220, 220, 491, 605,
157057
+ /* 170 */ 1040, 1060, 699, -11, 600, 848, 862, 345, -129, 724,
157058
+ /* 180 */ -91, 158, 808, 716, 900, 304, 869, 929, 926, 499,
157059
+ /* 190 */ 813, 322, 892, 845, 857, 1056, 1059, 908, 1036, 993,
157060
+ /* 200 */ 1062, 1097, -210, -185, -179, -148, -167, -89, 121, 274,
157061
+ /* 210 */ 281, 320, 336, 439, 663, 1011, 1064, 1068, 1075, 1127,
157062
+ /* 220 */ 1180, 1184, -196, 1191, 1195, 1199, 1203, 1223, 1238, 1254,
157063
+ /* 230 */ 1267, 1286, 1292, 1304, 1315, 205, 422, 638, 1319, 1341,
157064
+ /* 240 */ 1346, 1370, 1058, 1380, 1392, 1399, 1342, 1252, 1405, 1420,
157065
+ /* 250 */ 1384, 1427, 121, 1428, 1433, 1434, 1436, 1437, 1438, 1337,
157066
+ /* 260 */ 1333, 1383, 1388, 1389, 1390, 1395, 1058, 1383, 1383, 1408,
157067
+ /* 270 */ 1421, 1460, 1358, 1410, 1397, 1400, 1367, 1414, 1415, 1422,
157068
+ /* 280 */ 1374, 1442, 1439, 1441, 1435, 1450, 1452, 1416, 1440, 1443,
157069
+ /* 290 */ 1398, 1446, 1445, 1482, 1386, 1492, 1493, 1404, 1406, 1496,
157070
+ /* 300 */ 1426, 1444, 1447, 1458, 1483, 1469, 1484, 1485, 1486, 1487,
157071
+ /* 310 */ 1518, 1526, 1479, 1457, 1459, 1488, 1461, 1463, 1494, 1489,
157072
+ /* 320 */ 1499, 1490, 1529, 1537, 1454, 1462, 1539, 1541, 1524, 1545,
157073
+ /* 330 */ 1547, 1549, 1552, 1527, 1540, 1542, 1543, 1530, 1535, 1544,
157074
+ /* 340 */ 1551, 1555, 1554, 1557, 1536, 1558, 1559, 1470, 1560, 1500,
157075
+ /* 350 */ 1502, 1562, 1506, 1511, 1528, 1519, 1531, 1533, 1534, 1556,
157076
+ /* 360 */ 1583, 1473, 1474, 1532, 1561, 1563, 1565, 1564, 1595, 1522,
157077
+ /* 370 */ 1567, 1570, 1568, 1566, 1599, 1603, 1613, 1616, 1627, 1628,
157078
+ /* 380 */ 1629, 1569, 1571, 1573, 1617, 1610, 1612, 1614, 1618, 1621,
157079
+ /* 390 */ 1607, 1608, 1620, 1622, 1624, 1626,
155924157080
};
155925157081
static const YYACTIONTYPE yy_default[] = {
155926
- /* 0 */ 1575, 1575, 1575, 1411, 1188, 1297, 1188, 1188, 1188, 1411,
155927
- /* 10 */ 1411, 1411, 1188, 1327, 1327, 1464, 1219, 1188, 1188, 1188,
155928
- /* 20 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1410, 1188, 1188,
155929
- /* 30 */ 1188, 1188, 1494, 1494, 1188, 1188, 1188, 1188, 1188, 1188,
155930
- /* 40 */ 1188, 1188, 1188, 1336, 1188, 1188, 1188, 1188, 1188, 1188,
155931
- /* 50 */ 1412, 1413, 1188, 1188, 1188, 1463, 1465, 1428, 1346, 1345,
155932
- /* 60 */ 1344, 1343, 1446, 1314, 1341, 1334, 1338, 1406, 1407, 1405,
155933
- /* 70 */ 1409, 1413, 1412, 1188, 1337, 1377, 1391, 1376, 1188, 1188,
155934
- /* 80 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155935
- /* 90 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155936
- /* 100 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155937
- /* 110 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155938
- /* 120 */ 1188, 1188, 1188, 1188, 1188, 1188, 1385, 1390, 1396, 1389,
155939
- /* 130 */ 1386, 1379, 1378, 1380, 1381, 1188, 1209, 1261, 1188, 1188,
155940
- /* 140 */ 1188, 1188, 1482, 1481, 1188, 1188, 1219, 1371, 1370, 1382,
155941
- /* 150 */ 1383, 1393, 1392, 1471, 1529, 1528, 1429, 1188, 1188, 1188,
155942
- /* 160 */ 1188, 1188, 1188, 1494, 1188, 1188, 1188, 1188, 1188, 1188,
155943
- /* 170 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155944
- /* 180 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1494, 1494,
155945
- /* 190 */ 1188, 1219, 1494, 1494, 1215, 1215, 1321, 1188, 1477, 1297,
155946
- /* 200 */ 1288, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155947
- /* 210 */ 1188, 1188, 1188, 1188, 1188, 1468, 1466, 1188, 1188, 1188,
155948
- /* 220 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155949
- /* 230 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155950
- /* 240 */ 1188, 1188, 1188, 1188, 1188, 1293, 1188, 1188, 1188, 1188,
155951
- /* 250 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1523, 1188, 1441,
155952
- /* 260 */ 1275, 1293, 1293, 1293, 1293, 1295, 1276, 1274, 1287, 1220,
155953
- /* 270 */ 1195, 1567, 1294, 1316, 1316, 1564, 1340, 1294, 1564, 1236,
155954
- /* 280 */ 1545, 1231, 1327, 1327, 1327, 1316, 1321, 1321, 1408, 1294,
155955
- /* 290 */ 1287, 1188, 1567, 1302, 1302, 1566, 1566, 1302, 1429, 1349,
155956
- /* 300 */ 1355, 1340, 1264, 1340, 1270, 1270, 1270, 1270, 1302, 1206,
155957
- /* 310 */ 1340, 1340, 1349, 1355, 1264, 1340, 1264, 1340, 1302, 1206,
155958
- /* 320 */ 1445, 1561, 1302, 1206, 1419, 1302, 1206, 1302, 1206, 1419,
155959
- /* 330 */ 1262, 1262, 1262, 1251, 1188, 1188, 1419, 1262, 1236, 1262,
155960
- /* 340 */ 1251, 1262, 1262, 1512, 1419, 1423, 1423, 1419, 1320, 1315,
155961
- /* 350 */ 1320, 1315, 1320, 1315, 1320, 1315, 1302, 1504, 1504, 1330,
155962
- /* 360 */ 1330, 1335, 1321, 1414, 1302, 1188, 1335, 1333, 1331, 1340,
155963
- /* 370 */ 1212, 1254, 1526, 1526, 1522, 1522, 1522, 1572, 1572, 1477,
155964
- /* 380 */ 1538, 1219, 1219, 1219, 1219, 1538, 1238, 1238, 1220, 1220,
155965
- /* 390 */ 1219, 1538, 1188, 1188, 1188, 1188, 1188, 1188, 1533, 1188,
155966
- /* 400 */ 1430, 1306, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155967
- /* 410 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155968
- /* 420 */ 1188, 1188, 1188, 1188, 1188, 1360, 1188, 1191, 1474, 1188,
155969
- /* 430 */ 1188, 1472, 1188, 1188, 1188, 1188, 1188, 1188, 1307, 1188,
155970
- /* 440 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155971
- /* 450 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1563, 1188, 1188,
155972
- /* 460 */ 1188, 1188, 1188, 1188, 1444, 1443, 1188, 1188, 1304, 1188,
155973
- /* 470 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155974
- /* 480 */ 1188, 1188, 1234, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155975
- /* 490 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155976
- /* 500 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1332,
155977
- /* 510 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155978
- /* 520 */ 1188, 1188, 1188, 1188, 1509, 1322, 1188, 1188, 1554, 1188,
155979
- /* 530 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155980
- /* 540 */ 1188, 1188, 1188, 1549, 1278, 1362, 1188, 1361, 1365, 1188,
155981
- /* 550 */ 1200, 1188, 1188,
157082
+ /* 0 */ 1583, 1583, 1583, 1419, 1195, 1304, 1195, 1195, 1195, 1419,
157083
+ /* 10 */ 1419, 1419, 1195, 1334, 1334, 1472, 1226, 1195, 1195, 1195,
157084
+ /* 20 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1418, 1195, 1195,
157085
+ /* 30 */ 1195, 1195, 1502, 1502, 1195, 1195, 1195, 1195, 1195, 1195,
157086
+ /* 40 */ 1195, 1195, 1195, 1343, 1195, 1195, 1195, 1195, 1195, 1195,
157087
+ /* 50 */ 1420, 1421, 1195, 1195, 1195, 1471, 1473, 1436, 1353, 1352,
157088
+ /* 60 */ 1351, 1350, 1454, 1321, 1348, 1341, 1345, 1414, 1415, 1413,
157089
+ /* 70 */ 1417, 1421, 1420, 1195, 1344, 1385, 1399, 1384, 1195, 1195,
157090
+ /* 80 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157091
+ /* 90 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157092
+ /* 100 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157093
+ /* 110 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157094
+ /* 120 */ 1195, 1195, 1195, 1195, 1195, 1195, 1393, 1398, 1404, 1397,
157095
+ /* 130 */ 1394, 1387, 1386, 1388, 1389, 1195, 1216, 1268, 1195, 1195,
157096
+ /* 140 */ 1195, 1195, 1490, 1489, 1195, 1195, 1226, 1379, 1378, 1390,
157097
+ /* 150 */ 1391, 1401, 1400, 1479, 1537, 1536, 1437, 1195, 1195, 1195,
157098
+ /* 160 */ 1195, 1195, 1195, 1195, 1502, 1195, 1195, 1195, 1195, 1195,
157099
+ /* 170 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157100
+ /* 180 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1502,
157101
+ /* 190 */ 1502, 1195, 1226, 1502, 1502, 1222, 1222, 1328, 1195, 1485,
157102
+ /* 200 */ 1304, 1295, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157103
+ /* 210 */ 1195, 1195, 1195, 1195, 1195, 1195, 1476, 1474, 1195, 1195,
157104
+ /* 220 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157105
+ /* 230 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157106
+ /* 240 */ 1195, 1195, 1195, 1195, 1195, 1195, 1300, 1195, 1195, 1195,
157107
+ /* 250 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1531, 1195,
157108
+ /* 260 */ 1449, 1282, 1300, 1300, 1300, 1300, 1302, 1283, 1281, 1294,
157109
+ /* 270 */ 1227, 1202, 1575, 1301, 1323, 1323, 1572, 1347, 1347, 1301,
157110
+ /* 280 */ 1572, 1243, 1553, 1238, 1334, 1334, 1334, 1323, 1328, 1328,
157111
+ /* 290 */ 1416, 1301, 1294, 1195, 1575, 1309, 1309, 1574, 1574, 1309,
157112
+ /* 300 */ 1437, 1356, 1363, 1347, 1271, 1347, 1277, 1277, 1277, 1277,
157113
+ /* 310 */ 1309, 1213, 1347, 1356, 1356, 1347, 1356, 1363, 1271, 1347,
157114
+ /* 320 */ 1271, 1347, 1309, 1213, 1453, 1569, 1309, 1213, 1427, 1309,
157115
+ /* 330 */ 1213, 1309, 1213, 1427, 1269, 1269, 1269, 1258, 1195, 1195,
157116
+ /* 340 */ 1427, 1269, 1243, 1269, 1258, 1269, 1269, 1520, 1427, 1431,
157117
+ /* 350 */ 1431, 1427, 1327, 1322, 1327, 1322, 1327, 1322, 1327, 1322,
157118
+ /* 360 */ 1309, 1512, 1512, 1337, 1337, 1342, 1328, 1422, 1309, 1195,
157119
+ /* 370 */ 1342, 1340, 1338, 1347, 1219, 1261, 1534, 1534, 1530, 1530,
157120
+ /* 380 */ 1530, 1580, 1580, 1485, 1546, 1226, 1226, 1226, 1226, 1546,
157121
+ /* 390 */ 1245, 1245, 1227, 1227, 1226, 1546, 1195, 1195, 1195, 1195,
157122
+ /* 400 */ 1195, 1195, 1541, 1195, 1438, 1313, 1195, 1195, 1195, 1195,
157123
+ /* 410 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157124
+ /* 420 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157125
+ /* 430 */ 1368, 1195, 1198, 1482, 1195, 1195, 1480, 1195, 1195, 1195,
157126
+ /* 440 */ 1195, 1195, 1195, 1314, 1195, 1195, 1195, 1195, 1195, 1195,
157127
+ /* 450 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157128
+ /* 460 */ 1195, 1195, 1571, 1195, 1195, 1195, 1195, 1195, 1195, 1452,
157129
+ /* 470 */ 1451, 1195, 1195, 1311, 1195, 1195, 1195, 1195, 1195, 1195,
157130
+ /* 480 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1241, 1195, 1195,
157131
+ /* 490 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157132
+ /* 500 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157133
+ /* 510 */ 1195, 1195, 1195, 1195, 1339, 1195, 1195, 1195, 1195, 1195,
157134
+ /* 520 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1517,
157135
+ /* 530 */ 1329, 1195, 1195, 1562, 1195, 1195, 1195, 1195, 1195, 1195,
157136
+ /* 540 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1557, 1285,
157137
+ /* 550 */ 1370, 1195, 1369, 1373, 1195, 1207, 1195, 1195,
155982157138
};
155983157139
/********** End of lemon-generated parsing tables *****************************/
155984157140
155985157141
/* The next table maps tokens (terminal symbols) into fallback tokens.
155986157142
** If a construct like the following:
@@ -156741,236 +157897,237 @@
156741157897
/* 154 */ "setlist ::= nm EQ expr",
156742157898
/* 155 */ "setlist ::= LP idlist RP EQ expr",
156743157899
/* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
156744157900
/* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
156745157901
/* 158 */ "upsert ::=",
156746
- /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
156747
- /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
157902
+ /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert",
157903
+ /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert",
156748157904
/* 161 */ "upsert ::= ON CONFLICT DO NOTHING",
156749
- /* 162 */ "insert_cmd ::= INSERT orconf",
156750
- /* 163 */ "insert_cmd ::= REPLACE",
156751
- /* 164 */ "idlist_opt ::=",
156752
- /* 165 */ "idlist_opt ::= LP idlist RP",
156753
- /* 166 */ "idlist ::= idlist COMMA nm",
156754
- /* 167 */ "idlist ::= nm",
156755
- /* 168 */ "expr ::= LP expr RP",
156756
- /* 169 */ "expr ::= ID|INDEXED",
156757
- /* 170 */ "expr ::= JOIN_KW",
156758
- /* 171 */ "expr ::= nm DOT nm",
156759
- /* 172 */ "expr ::= nm DOT nm DOT nm",
156760
- /* 173 */ "term ::= NULL|FLOAT|BLOB",
156761
- /* 174 */ "term ::= STRING",
156762
- /* 175 */ "term ::= INTEGER",
156763
- /* 176 */ "expr ::= VARIABLE",
156764
- /* 177 */ "expr ::= expr COLLATE ID|STRING",
156765
- /* 178 */ "expr ::= CAST LP expr AS typetoken RP",
156766
- /* 179 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
156767
- /* 180 */ "expr ::= ID|INDEXED LP STAR RP",
156768
- /* 181 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
156769
- /* 182 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
156770
- /* 183 */ "term ::= CTIME_KW",
156771
- /* 184 */ "expr ::= LP nexprlist COMMA expr RP",
156772
- /* 185 */ "expr ::= expr AND expr",
156773
- /* 186 */ "expr ::= expr OR expr",
156774
- /* 187 */ "expr ::= expr LT|GT|GE|LE expr",
156775
- /* 188 */ "expr ::= expr EQ|NE expr",
156776
- /* 189 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
156777
- /* 190 */ "expr ::= expr PLUS|MINUS expr",
156778
- /* 191 */ "expr ::= expr STAR|SLASH|REM expr",
156779
- /* 192 */ "expr ::= expr CONCAT expr",
156780
- /* 193 */ "likeop ::= NOT LIKE_KW|MATCH",
156781
- /* 194 */ "expr ::= expr likeop expr",
156782
- /* 195 */ "expr ::= expr likeop expr ESCAPE expr",
156783
- /* 196 */ "expr ::= expr ISNULL|NOTNULL",
156784
- /* 197 */ "expr ::= expr NOT NULL",
156785
- /* 198 */ "expr ::= expr IS expr",
156786
- /* 199 */ "expr ::= expr IS NOT expr",
156787
- /* 200 */ "expr ::= NOT expr",
156788
- /* 201 */ "expr ::= BITNOT expr",
156789
- /* 202 */ "expr ::= PLUS|MINUS expr",
156790
- /* 203 */ "between_op ::= BETWEEN",
156791
- /* 204 */ "between_op ::= NOT BETWEEN",
156792
- /* 205 */ "expr ::= expr between_op expr AND expr",
156793
- /* 206 */ "in_op ::= IN",
156794
- /* 207 */ "in_op ::= NOT IN",
156795
- /* 208 */ "expr ::= expr in_op LP exprlist RP",
156796
- /* 209 */ "expr ::= LP select RP",
156797
- /* 210 */ "expr ::= expr in_op LP select RP",
156798
- /* 211 */ "expr ::= expr in_op nm dbnm paren_exprlist",
156799
- /* 212 */ "expr ::= EXISTS LP select RP",
156800
- /* 213 */ "expr ::= CASE case_operand case_exprlist case_else END",
156801
- /* 214 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
156802
- /* 215 */ "case_exprlist ::= WHEN expr THEN expr",
156803
- /* 216 */ "case_else ::= ELSE expr",
156804
- /* 217 */ "case_else ::=",
156805
- /* 218 */ "case_operand ::= expr",
156806
- /* 219 */ "case_operand ::=",
156807
- /* 220 */ "exprlist ::=",
156808
- /* 221 */ "nexprlist ::= nexprlist COMMA expr",
156809
- /* 222 */ "nexprlist ::= expr",
156810
- /* 223 */ "paren_exprlist ::=",
156811
- /* 224 */ "paren_exprlist ::= LP exprlist RP",
156812
- /* 225 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
156813
- /* 226 */ "uniqueflag ::= UNIQUE",
156814
- /* 227 */ "uniqueflag ::=",
156815
- /* 228 */ "eidlist_opt ::=",
156816
- /* 229 */ "eidlist_opt ::= LP eidlist RP",
156817
- /* 230 */ "eidlist ::= eidlist COMMA nm collate sortorder",
156818
- /* 231 */ "eidlist ::= nm collate sortorder",
156819
- /* 232 */ "collate ::=",
156820
- /* 233 */ "collate ::= COLLATE ID|STRING",
156821
- /* 234 */ "cmd ::= DROP INDEX ifexists fullname",
156822
- /* 235 */ "cmd ::= VACUUM vinto",
156823
- /* 236 */ "cmd ::= VACUUM nm vinto",
156824
- /* 237 */ "vinto ::= INTO expr",
156825
- /* 238 */ "vinto ::=",
156826
- /* 239 */ "cmd ::= PRAGMA nm dbnm",
156827
- /* 240 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
156828
- /* 241 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
156829
- /* 242 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
156830
- /* 243 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
156831
- /* 244 */ "plus_num ::= PLUS INTEGER|FLOAT",
156832
- /* 245 */ "minus_num ::= MINUS INTEGER|FLOAT",
156833
- /* 246 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
156834
- /* 247 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
156835
- /* 248 */ "trigger_time ::= BEFORE|AFTER",
156836
- /* 249 */ "trigger_time ::= INSTEAD OF",
156837
- /* 250 */ "trigger_time ::=",
156838
- /* 251 */ "trigger_event ::= DELETE|INSERT",
156839
- /* 252 */ "trigger_event ::= UPDATE",
156840
- /* 253 */ "trigger_event ::= UPDATE OF idlist",
156841
- /* 254 */ "when_clause ::=",
156842
- /* 255 */ "when_clause ::= WHEN expr",
156843
- /* 256 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
156844
- /* 257 */ "trigger_cmd_list ::= trigger_cmd SEMI",
156845
- /* 258 */ "trnm ::= nm DOT nm",
156846
- /* 259 */ "tridxby ::= INDEXED BY nm",
156847
- /* 260 */ "tridxby ::= NOT INDEXED",
156848
- /* 261 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
156849
- /* 262 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
156850
- /* 263 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
156851
- /* 264 */ "trigger_cmd ::= scanpt select scanpt",
156852
- /* 265 */ "expr ::= RAISE LP IGNORE RP",
156853
- /* 266 */ "expr ::= RAISE LP raisetype COMMA nm RP",
156854
- /* 267 */ "raisetype ::= ROLLBACK",
156855
- /* 268 */ "raisetype ::= ABORT",
156856
- /* 269 */ "raisetype ::= FAIL",
156857
- /* 270 */ "cmd ::= DROP TRIGGER ifexists fullname",
156858
- /* 271 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
156859
- /* 272 */ "cmd ::= DETACH database_kw_opt expr",
156860
- /* 273 */ "key_opt ::=",
156861
- /* 274 */ "key_opt ::= KEY expr",
156862
- /* 275 */ "cmd ::= REINDEX",
156863
- /* 276 */ "cmd ::= REINDEX nm dbnm",
156864
- /* 277 */ "cmd ::= ANALYZE",
156865
- /* 278 */ "cmd ::= ANALYZE nm dbnm",
156866
- /* 279 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
156867
- /* 280 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
156868
- /* 281 */ "add_column_fullname ::= fullname",
156869
- /* 282 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
156870
- /* 283 */ "cmd ::= create_vtab",
156871
- /* 284 */ "cmd ::= create_vtab LP vtabarglist RP",
156872
- /* 285 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
156873
- /* 286 */ "vtabarg ::=",
156874
- /* 287 */ "vtabargtoken ::= ANY",
156875
- /* 288 */ "vtabargtoken ::= lp anylist RP",
156876
- /* 289 */ "lp ::= LP",
156877
- /* 290 */ "with ::= WITH wqlist",
156878
- /* 291 */ "with ::= WITH RECURSIVE wqlist",
156879
- /* 292 */ "wqlist ::= nm eidlist_opt AS LP select RP",
156880
- /* 293 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
156881
- /* 294 */ "windowdefn_list ::= windowdefn",
156882
- /* 295 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
156883
- /* 296 */ "windowdefn ::= nm AS LP window RP",
156884
- /* 297 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
156885
- /* 298 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
156886
- /* 299 */ "window ::= ORDER BY sortlist frame_opt",
156887
- /* 300 */ "window ::= nm ORDER BY sortlist frame_opt",
156888
- /* 301 */ "window ::= frame_opt",
156889
- /* 302 */ "window ::= nm frame_opt",
156890
- /* 303 */ "frame_opt ::=",
156891
- /* 304 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
156892
- /* 305 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
156893
- /* 306 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
156894
- /* 307 */ "frame_bound_s ::= frame_bound",
156895
- /* 308 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
156896
- /* 309 */ "frame_bound_e ::= frame_bound",
156897
- /* 310 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
156898
- /* 311 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
156899
- /* 312 */ "frame_bound ::= CURRENT ROW",
156900
- /* 313 */ "frame_exclude_opt ::=",
156901
- /* 314 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
156902
- /* 315 */ "frame_exclude ::= NO OTHERS",
156903
- /* 316 */ "frame_exclude ::= CURRENT ROW",
156904
- /* 317 */ "frame_exclude ::= GROUP|TIES",
156905
- /* 318 */ "window_clause ::= WINDOW windowdefn_list",
156906
- /* 319 */ "filter_over ::= filter_clause over_clause",
156907
- /* 320 */ "filter_over ::= over_clause",
156908
- /* 321 */ "filter_over ::= filter_clause",
156909
- /* 322 */ "over_clause ::= OVER LP window RP",
156910
- /* 323 */ "over_clause ::= OVER nm",
156911
- /* 324 */ "filter_clause ::= FILTER LP WHERE expr RP",
156912
- /* 325 */ "input ::= cmdlist",
156913
- /* 326 */ "cmdlist ::= cmdlist ecmd",
156914
- /* 327 */ "cmdlist ::= ecmd",
156915
- /* 328 */ "ecmd ::= SEMI",
156916
- /* 329 */ "ecmd ::= cmdx SEMI",
156917
- /* 330 */ "ecmd ::= explain cmdx SEMI",
156918
- /* 331 */ "trans_opt ::=",
156919
- /* 332 */ "trans_opt ::= TRANSACTION",
156920
- /* 333 */ "trans_opt ::= TRANSACTION nm",
156921
- /* 334 */ "savepoint_opt ::= SAVEPOINT",
156922
- /* 335 */ "savepoint_opt ::=",
156923
- /* 336 */ "cmd ::= create_table create_table_args",
156924
- /* 337 */ "columnlist ::= columnlist COMMA columnname carglist",
156925
- /* 338 */ "columnlist ::= columnname carglist",
156926
- /* 339 */ "nm ::= ID|INDEXED",
156927
- /* 340 */ "nm ::= STRING",
156928
- /* 341 */ "nm ::= JOIN_KW",
156929
- /* 342 */ "typetoken ::= typename",
156930
- /* 343 */ "typename ::= ID|STRING",
156931
- /* 344 */ "signed ::= plus_num",
156932
- /* 345 */ "signed ::= minus_num",
156933
- /* 346 */ "carglist ::= carglist ccons",
156934
- /* 347 */ "carglist ::=",
156935
- /* 348 */ "ccons ::= NULL onconf",
156936
- /* 349 */ "ccons ::= GENERATED ALWAYS AS generated",
156937
- /* 350 */ "ccons ::= AS generated",
156938
- /* 351 */ "conslist_opt ::= COMMA conslist",
156939
- /* 352 */ "conslist ::= conslist tconscomma tcons",
156940
- /* 353 */ "conslist ::= tcons",
156941
- /* 354 */ "tconscomma ::=",
156942
- /* 355 */ "defer_subclause_opt ::= defer_subclause",
156943
- /* 356 */ "resolvetype ::= raisetype",
156944
- /* 357 */ "selectnowith ::= oneselect",
156945
- /* 358 */ "oneselect ::= values",
156946
- /* 359 */ "sclp ::= selcollist COMMA",
156947
- /* 360 */ "as ::= ID|STRING",
156948
- /* 361 */ "expr ::= term",
156949
- /* 362 */ "likeop ::= LIKE_KW|MATCH",
156950
- /* 363 */ "exprlist ::= nexprlist",
156951
- /* 364 */ "nmnum ::= plus_num",
156952
- /* 365 */ "nmnum ::= nm",
156953
- /* 366 */ "nmnum ::= ON",
156954
- /* 367 */ "nmnum ::= DELETE",
156955
- /* 368 */ "nmnum ::= DEFAULT",
156956
- /* 369 */ "plus_num ::= INTEGER|FLOAT",
156957
- /* 370 */ "foreach_clause ::=",
156958
- /* 371 */ "foreach_clause ::= FOR EACH ROW",
156959
- /* 372 */ "trnm ::= nm",
156960
- /* 373 */ "tridxby ::=",
156961
- /* 374 */ "database_kw_opt ::= DATABASE",
156962
- /* 375 */ "database_kw_opt ::=",
156963
- /* 376 */ "kwcolumn_opt ::=",
156964
- /* 377 */ "kwcolumn_opt ::= COLUMNKW",
156965
- /* 378 */ "vtabarglist ::= vtabarg",
156966
- /* 379 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
156967
- /* 380 */ "vtabarg ::= vtabarg vtabargtoken",
156968
- /* 381 */ "anylist ::=",
156969
- /* 382 */ "anylist ::= anylist LP anylist RP",
156970
- /* 383 */ "anylist ::= anylist ANY",
156971
- /* 384 */ "with ::=",
157905
+ /* 162 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt",
157906
+ /* 163 */ "insert_cmd ::= INSERT orconf",
157907
+ /* 164 */ "insert_cmd ::= REPLACE",
157908
+ /* 165 */ "idlist_opt ::=",
157909
+ /* 166 */ "idlist_opt ::= LP idlist RP",
157910
+ /* 167 */ "idlist ::= idlist COMMA nm",
157911
+ /* 168 */ "idlist ::= nm",
157912
+ /* 169 */ "expr ::= LP expr RP",
157913
+ /* 170 */ "expr ::= ID|INDEXED",
157914
+ /* 171 */ "expr ::= JOIN_KW",
157915
+ /* 172 */ "expr ::= nm DOT nm",
157916
+ /* 173 */ "expr ::= nm DOT nm DOT nm",
157917
+ /* 174 */ "term ::= NULL|FLOAT|BLOB",
157918
+ /* 175 */ "term ::= STRING",
157919
+ /* 176 */ "term ::= INTEGER",
157920
+ /* 177 */ "expr ::= VARIABLE",
157921
+ /* 178 */ "expr ::= expr COLLATE ID|STRING",
157922
+ /* 179 */ "expr ::= CAST LP expr AS typetoken RP",
157923
+ /* 180 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
157924
+ /* 181 */ "expr ::= ID|INDEXED LP STAR RP",
157925
+ /* 182 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
157926
+ /* 183 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
157927
+ /* 184 */ "term ::= CTIME_KW",
157928
+ /* 185 */ "expr ::= LP nexprlist COMMA expr RP",
157929
+ /* 186 */ "expr ::= expr AND expr",
157930
+ /* 187 */ "expr ::= expr OR expr",
157931
+ /* 188 */ "expr ::= expr LT|GT|GE|LE expr",
157932
+ /* 189 */ "expr ::= expr EQ|NE expr",
157933
+ /* 190 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
157934
+ /* 191 */ "expr ::= expr PLUS|MINUS expr",
157935
+ /* 192 */ "expr ::= expr STAR|SLASH|REM expr",
157936
+ /* 193 */ "expr ::= expr CONCAT expr",
157937
+ /* 194 */ "likeop ::= NOT LIKE_KW|MATCH",
157938
+ /* 195 */ "expr ::= expr likeop expr",
157939
+ /* 196 */ "expr ::= expr likeop expr ESCAPE expr",
157940
+ /* 197 */ "expr ::= expr ISNULL|NOTNULL",
157941
+ /* 198 */ "expr ::= expr NOT NULL",
157942
+ /* 199 */ "expr ::= expr IS expr",
157943
+ /* 200 */ "expr ::= expr IS NOT expr",
157944
+ /* 201 */ "expr ::= NOT expr",
157945
+ /* 202 */ "expr ::= BITNOT expr",
157946
+ /* 203 */ "expr ::= PLUS|MINUS expr",
157947
+ /* 204 */ "between_op ::= BETWEEN",
157948
+ /* 205 */ "between_op ::= NOT BETWEEN",
157949
+ /* 206 */ "expr ::= expr between_op expr AND expr",
157950
+ /* 207 */ "in_op ::= IN",
157951
+ /* 208 */ "in_op ::= NOT IN",
157952
+ /* 209 */ "expr ::= expr in_op LP exprlist RP",
157953
+ /* 210 */ "expr ::= LP select RP",
157954
+ /* 211 */ "expr ::= expr in_op LP select RP",
157955
+ /* 212 */ "expr ::= expr in_op nm dbnm paren_exprlist",
157956
+ /* 213 */ "expr ::= EXISTS LP select RP",
157957
+ /* 214 */ "expr ::= CASE case_operand case_exprlist case_else END",
157958
+ /* 215 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
157959
+ /* 216 */ "case_exprlist ::= WHEN expr THEN expr",
157960
+ /* 217 */ "case_else ::= ELSE expr",
157961
+ /* 218 */ "case_else ::=",
157962
+ /* 219 */ "case_operand ::= expr",
157963
+ /* 220 */ "case_operand ::=",
157964
+ /* 221 */ "exprlist ::=",
157965
+ /* 222 */ "nexprlist ::= nexprlist COMMA expr",
157966
+ /* 223 */ "nexprlist ::= expr",
157967
+ /* 224 */ "paren_exprlist ::=",
157968
+ /* 225 */ "paren_exprlist ::= LP exprlist RP",
157969
+ /* 226 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
157970
+ /* 227 */ "uniqueflag ::= UNIQUE",
157971
+ /* 228 */ "uniqueflag ::=",
157972
+ /* 229 */ "eidlist_opt ::=",
157973
+ /* 230 */ "eidlist_opt ::= LP eidlist RP",
157974
+ /* 231 */ "eidlist ::= eidlist COMMA nm collate sortorder",
157975
+ /* 232 */ "eidlist ::= nm collate sortorder",
157976
+ /* 233 */ "collate ::=",
157977
+ /* 234 */ "collate ::= COLLATE ID|STRING",
157978
+ /* 235 */ "cmd ::= DROP INDEX ifexists fullname",
157979
+ /* 236 */ "cmd ::= VACUUM vinto",
157980
+ /* 237 */ "cmd ::= VACUUM nm vinto",
157981
+ /* 238 */ "vinto ::= INTO expr",
157982
+ /* 239 */ "vinto ::=",
157983
+ /* 240 */ "cmd ::= PRAGMA nm dbnm",
157984
+ /* 241 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
157985
+ /* 242 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
157986
+ /* 243 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
157987
+ /* 244 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
157988
+ /* 245 */ "plus_num ::= PLUS INTEGER|FLOAT",
157989
+ /* 246 */ "minus_num ::= MINUS INTEGER|FLOAT",
157990
+ /* 247 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
157991
+ /* 248 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
157992
+ /* 249 */ "trigger_time ::= BEFORE|AFTER",
157993
+ /* 250 */ "trigger_time ::= INSTEAD OF",
157994
+ /* 251 */ "trigger_time ::=",
157995
+ /* 252 */ "trigger_event ::= DELETE|INSERT",
157996
+ /* 253 */ "trigger_event ::= UPDATE",
157997
+ /* 254 */ "trigger_event ::= UPDATE OF idlist",
157998
+ /* 255 */ "when_clause ::=",
157999
+ /* 256 */ "when_clause ::= WHEN expr",
158000
+ /* 257 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
158001
+ /* 258 */ "trigger_cmd_list ::= trigger_cmd SEMI",
158002
+ /* 259 */ "trnm ::= nm DOT nm",
158003
+ /* 260 */ "tridxby ::= INDEXED BY nm",
158004
+ /* 261 */ "tridxby ::= NOT INDEXED",
158005
+ /* 262 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
158006
+ /* 263 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
158007
+ /* 264 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
158008
+ /* 265 */ "trigger_cmd ::= scanpt select scanpt",
158009
+ /* 266 */ "expr ::= RAISE LP IGNORE RP",
158010
+ /* 267 */ "expr ::= RAISE LP raisetype COMMA nm RP",
158011
+ /* 268 */ "raisetype ::= ROLLBACK",
158012
+ /* 269 */ "raisetype ::= ABORT",
158013
+ /* 270 */ "raisetype ::= FAIL",
158014
+ /* 271 */ "cmd ::= DROP TRIGGER ifexists fullname",
158015
+ /* 272 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
158016
+ /* 273 */ "cmd ::= DETACH database_kw_opt expr",
158017
+ /* 274 */ "key_opt ::=",
158018
+ /* 275 */ "key_opt ::= KEY expr",
158019
+ /* 276 */ "cmd ::= REINDEX",
158020
+ /* 277 */ "cmd ::= REINDEX nm dbnm",
158021
+ /* 278 */ "cmd ::= ANALYZE",
158022
+ /* 279 */ "cmd ::= ANALYZE nm dbnm",
158023
+ /* 280 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
158024
+ /* 281 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
158025
+ /* 282 */ "add_column_fullname ::= fullname",
158026
+ /* 283 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
158027
+ /* 284 */ "cmd ::= create_vtab",
158028
+ /* 285 */ "cmd ::= create_vtab LP vtabarglist RP",
158029
+ /* 286 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
158030
+ /* 287 */ "vtabarg ::=",
158031
+ /* 288 */ "vtabargtoken ::= ANY",
158032
+ /* 289 */ "vtabargtoken ::= lp anylist RP",
158033
+ /* 290 */ "lp ::= LP",
158034
+ /* 291 */ "with ::= WITH wqlist",
158035
+ /* 292 */ "with ::= WITH RECURSIVE wqlist",
158036
+ /* 293 */ "wqlist ::= nm eidlist_opt AS LP select RP",
158037
+ /* 294 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
158038
+ /* 295 */ "windowdefn_list ::= windowdefn",
158039
+ /* 296 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
158040
+ /* 297 */ "windowdefn ::= nm AS LP window RP",
158041
+ /* 298 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
158042
+ /* 299 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
158043
+ /* 300 */ "window ::= ORDER BY sortlist frame_opt",
158044
+ /* 301 */ "window ::= nm ORDER BY sortlist frame_opt",
158045
+ /* 302 */ "window ::= frame_opt",
158046
+ /* 303 */ "window ::= nm frame_opt",
158047
+ /* 304 */ "frame_opt ::=",
158048
+ /* 305 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
158049
+ /* 306 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
158050
+ /* 307 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
158051
+ /* 308 */ "frame_bound_s ::= frame_bound",
158052
+ /* 309 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
158053
+ /* 310 */ "frame_bound_e ::= frame_bound",
158054
+ /* 311 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
158055
+ /* 312 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
158056
+ /* 313 */ "frame_bound ::= CURRENT ROW",
158057
+ /* 314 */ "frame_exclude_opt ::=",
158058
+ /* 315 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
158059
+ /* 316 */ "frame_exclude ::= NO OTHERS",
158060
+ /* 317 */ "frame_exclude ::= CURRENT ROW",
158061
+ /* 318 */ "frame_exclude ::= GROUP|TIES",
158062
+ /* 319 */ "window_clause ::= WINDOW windowdefn_list",
158063
+ /* 320 */ "filter_over ::= filter_clause over_clause",
158064
+ /* 321 */ "filter_over ::= over_clause",
158065
+ /* 322 */ "filter_over ::= filter_clause",
158066
+ /* 323 */ "over_clause ::= OVER LP window RP",
158067
+ /* 324 */ "over_clause ::= OVER nm",
158068
+ /* 325 */ "filter_clause ::= FILTER LP WHERE expr RP",
158069
+ /* 326 */ "input ::= cmdlist",
158070
+ /* 327 */ "cmdlist ::= cmdlist ecmd",
158071
+ /* 328 */ "cmdlist ::= ecmd",
158072
+ /* 329 */ "ecmd ::= SEMI",
158073
+ /* 330 */ "ecmd ::= cmdx SEMI",
158074
+ /* 331 */ "ecmd ::= explain cmdx SEMI",
158075
+ /* 332 */ "trans_opt ::=",
158076
+ /* 333 */ "trans_opt ::= TRANSACTION",
158077
+ /* 334 */ "trans_opt ::= TRANSACTION nm",
158078
+ /* 335 */ "savepoint_opt ::= SAVEPOINT",
158079
+ /* 336 */ "savepoint_opt ::=",
158080
+ /* 337 */ "cmd ::= create_table create_table_args",
158081
+ /* 338 */ "columnlist ::= columnlist COMMA columnname carglist",
158082
+ /* 339 */ "columnlist ::= columnname carglist",
158083
+ /* 340 */ "nm ::= ID|INDEXED",
158084
+ /* 341 */ "nm ::= STRING",
158085
+ /* 342 */ "nm ::= JOIN_KW",
158086
+ /* 343 */ "typetoken ::= typename",
158087
+ /* 344 */ "typename ::= ID|STRING",
158088
+ /* 345 */ "signed ::= plus_num",
158089
+ /* 346 */ "signed ::= minus_num",
158090
+ /* 347 */ "carglist ::= carglist ccons",
158091
+ /* 348 */ "carglist ::=",
158092
+ /* 349 */ "ccons ::= NULL onconf",
158093
+ /* 350 */ "ccons ::= GENERATED ALWAYS AS generated",
158094
+ /* 351 */ "ccons ::= AS generated",
158095
+ /* 352 */ "conslist_opt ::= COMMA conslist",
158096
+ /* 353 */ "conslist ::= conslist tconscomma tcons",
158097
+ /* 354 */ "conslist ::= tcons",
158098
+ /* 355 */ "tconscomma ::=",
158099
+ /* 356 */ "defer_subclause_opt ::= defer_subclause",
158100
+ /* 357 */ "resolvetype ::= raisetype",
158101
+ /* 358 */ "selectnowith ::= oneselect",
158102
+ /* 359 */ "oneselect ::= values",
158103
+ /* 360 */ "sclp ::= selcollist COMMA",
158104
+ /* 361 */ "as ::= ID|STRING",
158105
+ /* 362 */ "expr ::= term",
158106
+ /* 363 */ "likeop ::= LIKE_KW|MATCH",
158107
+ /* 364 */ "exprlist ::= nexprlist",
158108
+ /* 365 */ "nmnum ::= plus_num",
158109
+ /* 366 */ "nmnum ::= nm",
158110
+ /* 367 */ "nmnum ::= ON",
158111
+ /* 368 */ "nmnum ::= DELETE",
158112
+ /* 369 */ "nmnum ::= DEFAULT",
158113
+ /* 370 */ "plus_num ::= INTEGER|FLOAT",
158114
+ /* 371 */ "foreach_clause ::=",
158115
+ /* 372 */ "foreach_clause ::= FOR EACH ROW",
158116
+ /* 373 */ "trnm ::= nm",
158117
+ /* 374 */ "tridxby ::=",
158118
+ /* 375 */ "database_kw_opt ::= DATABASE",
158119
+ /* 376 */ "database_kw_opt ::=",
158120
+ /* 377 */ "kwcolumn_opt ::=",
158121
+ /* 378 */ "kwcolumn_opt ::= COLUMNKW",
158122
+ /* 379 */ "vtabarglist ::= vtabarg",
158123
+ /* 380 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
158124
+ /* 381 */ "vtabarg ::= vtabarg vtabargtoken",
158125
+ /* 382 */ "anylist ::=",
158126
+ /* 383 */ "anylist ::= anylist LP anylist RP",
158127
+ /* 384 */ "anylist ::= anylist ANY",
158128
+ /* 385 */ "with ::=",
156972158129
};
156973158130
#endif /* NDEBUG */
156974158131
156975158132
156976158133
#if YYSTACKDEPTH<=0
@@ -157633,236 +158790,237 @@
157633158790
262, /* (154) setlist ::= nm EQ expr */
157634158791
262, /* (155) setlist ::= LP idlist RP EQ expr */
157635158792
186, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
157636158793
186, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
157637158794
265, /* (158) upsert ::= */
157638
- 265, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
157639
- 265, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
158795
+ 265, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
158796
+ 265, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
157640158797
265, /* (161) upsert ::= ON CONFLICT DO NOTHING */
157641
- 263, /* (162) insert_cmd ::= INSERT orconf */
157642
- 263, /* (163) insert_cmd ::= REPLACE */
157643
- 264, /* (164) idlist_opt ::= */
157644
- 264, /* (165) idlist_opt ::= LP idlist RP */
157645
- 259, /* (166) idlist ::= idlist COMMA nm */
157646
- 259, /* (167) idlist ::= nm */
157647
- 212, /* (168) expr ::= LP expr RP */
157648
- 212, /* (169) expr ::= ID|INDEXED */
157649
- 212, /* (170) expr ::= JOIN_KW */
157650
- 212, /* (171) expr ::= nm DOT nm */
157651
- 212, /* (172) expr ::= nm DOT nm DOT nm */
157652
- 211, /* (173) term ::= NULL|FLOAT|BLOB */
157653
- 211, /* (174) term ::= STRING */
157654
- 211, /* (175) term ::= INTEGER */
157655
- 212, /* (176) expr ::= VARIABLE */
157656
- 212, /* (177) expr ::= expr COLLATE ID|STRING */
157657
- 212, /* (178) expr ::= CAST LP expr AS typetoken RP */
157658
- 212, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */
157659
- 212, /* (180) expr ::= ID|INDEXED LP STAR RP */
157660
- 212, /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
157661
- 212, /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */
157662
- 211, /* (183) term ::= CTIME_KW */
157663
- 212, /* (184) expr ::= LP nexprlist COMMA expr RP */
157664
- 212, /* (185) expr ::= expr AND expr */
157665
- 212, /* (186) expr ::= expr OR expr */
157666
- 212, /* (187) expr ::= expr LT|GT|GE|LE expr */
157667
- 212, /* (188) expr ::= expr EQ|NE expr */
157668
- 212, /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
157669
- 212, /* (190) expr ::= expr PLUS|MINUS expr */
157670
- 212, /* (191) expr ::= expr STAR|SLASH|REM expr */
157671
- 212, /* (192) expr ::= expr CONCAT expr */
157672
- 267, /* (193) likeop ::= NOT LIKE_KW|MATCH */
157673
- 212, /* (194) expr ::= expr likeop expr */
157674
- 212, /* (195) expr ::= expr likeop expr ESCAPE expr */
157675
- 212, /* (196) expr ::= expr ISNULL|NOTNULL */
157676
- 212, /* (197) expr ::= expr NOT NULL */
157677
- 212, /* (198) expr ::= expr IS expr */
157678
- 212, /* (199) expr ::= expr IS NOT expr */
157679
- 212, /* (200) expr ::= NOT expr */
157680
- 212, /* (201) expr ::= BITNOT expr */
157681
- 212, /* (202) expr ::= PLUS|MINUS expr */
157682
- 268, /* (203) between_op ::= BETWEEN */
157683
- 268, /* (204) between_op ::= NOT BETWEEN */
157684
- 212, /* (205) expr ::= expr between_op expr AND expr */
157685
- 269, /* (206) in_op ::= IN */
157686
- 269, /* (207) in_op ::= NOT IN */
157687
- 212, /* (208) expr ::= expr in_op LP exprlist RP */
157688
- 212, /* (209) expr ::= LP select RP */
157689
- 212, /* (210) expr ::= expr in_op LP select RP */
157690
- 212, /* (211) expr ::= expr in_op nm dbnm paren_exprlist */
157691
- 212, /* (212) expr ::= EXISTS LP select RP */
157692
- 212, /* (213) expr ::= CASE case_operand case_exprlist case_else END */
157693
- 272, /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */
157694
- 272, /* (215) case_exprlist ::= WHEN expr THEN expr */
157695
- 273, /* (216) case_else ::= ELSE expr */
157696
- 273, /* (217) case_else ::= */
157697
- 271, /* (218) case_operand ::= expr */
157698
- 271, /* (219) case_operand ::= */
157699
- 257, /* (220) exprlist ::= */
157700
- 248, /* (221) nexprlist ::= nexprlist COMMA expr */
157701
- 248, /* (222) nexprlist ::= expr */
157702
- 270, /* (223) paren_exprlist ::= */
157703
- 270, /* (224) paren_exprlist ::= LP exprlist RP */
157704
- 186, /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
157705
- 274, /* (226) uniqueflag ::= UNIQUE */
157706
- 274, /* (227) uniqueflag ::= */
157707
- 216, /* (228) eidlist_opt ::= */
157708
- 216, /* (229) eidlist_opt ::= LP eidlist RP */
157709
- 227, /* (230) eidlist ::= eidlist COMMA nm collate sortorder */
157710
- 227, /* (231) eidlist ::= nm collate sortorder */
157711
- 275, /* (232) collate ::= */
157712
- 275, /* (233) collate ::= COLLATE ID|STRING */
157713
- 186, /* (234) cmd ::= DROP INDEX ifexists fullname */
157714
- 186, /* (235) cmd ::= VACUUM vinto */
157715
- 186, /* (236) cmd ::= VACUUM nm vinto */
157716
- 276, /* (237) vinto ::= INTO expr */
157717
- 276, /* (238) vinto ::= */
157718
- 186, /* (239) cmd ::= PRAGMA nm dbnm */
157719
- 186, /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */
157720
- 186, /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */
157721
- 186, /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */
157722
- 186, /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */
157723
- 206, /* (244) plus_num ::= PLUS INTEGER|FLOAT */
157724
- 207, /* (245) minus_num ::= MINUS INTEGER|FLOAT */
157725
- 186, /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
157726
- 278, /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
157727
- 280, /* (248) trigger_time ::= BEFORE|AFTER */
157728
- 280, /* (249) trigger_time ::= INSTEAD OF */
157729
- 280, /* (250) trigger_time ::= */
157730
- 281, /* (251) trigger_event ::= DELETE|INSERT */
157731
- 281, /* (252) trigger_event ::= UPDATE */
157732
- 281, /* (253) trigger_event ::= UPDATE OF idlist */
157733
- 283, /* (254) when_clause ::= */
157734
- 283, /* (255) when_clause ::= WHEN expr */
157735
- 279, /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
157736
- 279, /* (257) trigger_cmd_list ::= trigger_cmd SEMI */
157737
- 285, /* (258) trnm ::= nm DOT nm */
157738
- 286, /* (259) tridxby ::= INDEXED BY nm */
157739
- 286, /* (260) tridxby ::= NOT INDEXED */
157740
- 284, /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
157741
- 284, /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
157742
- 284, /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
157743
- 284, /* (264) trigger_cmd ::= scanpt select scanpt */
157744
- 212, /* (265) expr ::= RAISE LP IGNORE RP */
157745
- 212, /* (266) expr ::= RAISE LP raisetype COMMA nm RP */
157746
- 231, /* (267) raisetype ::= ROLLBACK */
157747
- 231, /* (268) raisetype ::= ABORT */
157748
- 231, /* (269) raisetype ::= FAIL */
157749
- 186, /* (270) cmd ::= DROP TRIGGER ifexists fullname */
157750
- 186, /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
157751
- 186, /* (272) cmd ::= DETACH database_kw_opt expr */
157752
- 288, /* (273) key_opt ::= */
157753
- 288, /* (274) key_opt ::= KEY expr */
157754
- 186, /* (275) cmd ::= REINDEX */
157755
- 186, /* (276) cmd ::= REINDEX nm dbnm */
157756
- 186, /* (277) cmd ::= ANALYZE */
157757
- 186, /* (278) cmd ::= ANALYZE nm dbnm */
157758
- 186, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
157759
- 186, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
157760
- 289, /* (281) add_column_fullname ::= fullname */
157761
- 186, /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
157762
- 186, /* (283) cmd ::= create_vtab */
157763
- 186, /* (284) cmd ::= create_vtab LP vtabarglist RP */
157764
- 291, /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
157765
- 293, /* (286) vtabarg ::= */
157766
- 294, /* (287) vtabargtoken ::= ANY */
157767
- 294, /* (288) vtabargtoken ::= lp anylist RP */
157768
- 295, /* (289) lp ::= LP */
157769
- 261, /* (290) with ::= WITH wqlist */
157770
- 261, /* (291) with ::= WITH RECURSIVE wqlist */
157771
- 236, /* (292) wqlist ::= nm eidlist_opt AS LP select RP */
157772
- 236, /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
157773
- 297, /* (294) windowdefn_list ::= windowdefn */
157774
- 297, /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */
157775
- 298, /* (296) windowdefn ::= nm AS LP window RP */
157776
- 299, /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
157777
- 299, /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
157778
- 299, /* (299) window ::= ORDER BY sortlist frame_opt */
157779
- 299, /* (300) window ::= nm ORDER BY sortlist frame_opt */
157780
- 299, /* (301) window ::= frame_opt */
157781
- 299, /* (302) window ::= nm frame_opt */
157782
- 300, /* (303) frame_opt ::= */
157783
- 300, /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
157784
- 300, /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
157785
- 304, /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */
157786
- 306, /* (307) frame_bound_s ::= frame_bound */
157787
- 306, /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */
157788
- 307, /* (309) frame_bound_e ::= frame_bound */
157789
- 307, /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */
157790
- 305, /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */
157791
- 305, /* (312) frame_bound ::= CURRENT ROW */
157792
- 308, /* (313) frame_exclude_opt ::= */
157793
- 308, /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */
157794
- 309, /* (315) frame_exclude ::= NO OTHERS */
157795
- 309, /* (316) frame_exclude ::= CURRENT ROW */
157796
- 309, /* (317) frame_exclude ::= GROUP|TIES */
157797
- 246, /* (318) window_clause ::= WINDOW windowdefn_list */
157798
- 266, /* (319) filter_over ::= filter_clause over_clause */
157799
- 266, /* (320) filter_over ::= over_clause */
157800
- 266, /* (321) filter_over ::= filter_clause */
157801
- 303, /* (322) over_clause ::= OVER LP window RP */
157802
- 303, /* (323) over_clause ::= OVER nm */
157803
- 302, /* (324) filter_clause ::= FILTER LP WHERE expr RP */
157804
- 181, /* (325) input ::= cmdlist */
157805
- 182, /* (326) cmdlist ::= cmdlist ecmd */
157806
- 182, /* (327) cmdlist ::= ecmd */
157807
- 183, /* (328) ecmd ::= SEMI */
157808
- 183, /* (329) ecmd ::= cmdx SEMI */
157809
- 183, /* (330) ecmd ::= explain cmdx SEMI */
157810
- 188, /* (331) trans_opt ::= */
157811
- 188, /* (332) trans_opt ::= TRANSACTION */
157812
- 188, /* (333) trans_opt ::= TRANSACTION nm */
157813
- 190, /* (334) savepoint_opt ::= SAVEPOINT */
157814
- 190, /* (335) savepoint_opt ::= */
157815
- 186, /* (336) cmd ::= create_table create_table_args */
157816
- 197, /* (337) columnlist ::= columnlist COMMA columnname carglist */
157817
- 197, /* (338) columnlist ::= columnname carglist */
157818
- 189, /* (339) nm ::= ID|INDEXED */
157819
- 189, /* (340) nm ::= STRING */
157820
- 189, /* (341) nm ::= JOIN_KW */
157821
- 203, /* (342) typetoken ::= typename */
157822
- 204, /* (343) typename ::= ID|STRING */
157823
- 205, /* (344) signed ::= plus_num */
157824
- 205, /* (345) signed ::= minus_num */
157825
- 202, /* (346) carglist ::= carglist ccons */
157826
- 202, /* (347) carglist ::= */
157827
- 210, /* (348) ccons ::= NULL onconf */
157828
- 210, /* (349) ccons ::= GENERATED ALWAYS AS generated */
157829
- 210, /* (350) ccons ::= AS generated */
157830
- 198, /* (351) conslist_opt ::= COMMA conslist */
157831
- 223, /* (352) conslist ::= conslist tconscomma tcons */
157832
- 223, /* (353) conslist ::= tcons */
157833
- 224, /* (354) tconscomma ::= */
157834
- 228, /* (355) defer_subclause_opt ::= defer_subclause */
157835
- 230, /* (356) resolvetype ::= raisetype */
157836
- 234, /* (357) selectnowith ::= oneselect */
157837
- 235, /* (358) oneselect ::= values */
157838
- 249, /* (359) sclp ::= selcollist COMMA */
157839
- 250, /* (360) as ::= ID|STRING */
157840
- 212, /* (361) expr ::= term */
157841
- 267, /* (362) likeop ::= LIKE_KW|MATCH */
157842
- 257, /* (363) exprlist ::= nexprlist */
157843
- 277, /* (364) nmnum ::= plus_num */
157844
- 277, /* (365) nmnum ::= nm */
157845
- 277, /* (366) nmnum ::= ON */
157846
- 277, /* (367) nmnum ::= DELETE */
157847
- 277, /* (368) nmnum ::= DEFAULT */
157848
- 206, /* (369) plus_num ::= INTEGER|FLOAT */
157849
- 282, /* (370) foreach_clause ::= */
157850
- 282, /* (371) foreach_clause ::= FOR EACH ROW */
157851
- 285, /* (372) trnm ::= nm */
157852
- 286, /* (373) tridxby ::= */
157853
- 287, /* (374) database_kw_opt ::= DATABASE */
157854
- 287, /* (375) database_kw_opt ::= */
157855
- 290, /* (376) kwcolumn_opt ::= */
157856
- 290, /* (377) kwcolumn_opt ::= COLUMNKW */
157857
- 292, /* (378) vtabarglist ::= vtabarg */
157858
- 292, /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */
157859
- 293, /* (380) vtabarg ::= vtabarg vtabargtoken */
157860
- 296, /* (381) anylist ::= */
157861
- 296, /* (382) anylist ::= anylist LP anylist RP */
157862
- 296, /* (383) anylist ::= anylist ANY */
157863
- 261, /* (384) with ::= */
158798
+ 265, /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
158799
+ 263, /* (163) insert_cmd ::= INSERT orconf */
158800
+ 263, /* (164) insert_cmd ::= REPLACE */
158801
+ 264, /* (165) idlist_opt ::= */
158802
+ 264, /* (166) idlist_opt ::= LP idlist RP */
158803
+ 259, /* (167) idlist ::= idlist COMMA nm */
158804
+ 259, /* (168) idlist ::= nm */
158805
+ 212, /* (169) expr ::= LP expr RP */
158806
+ 212, /* (170) expr ::= ID|INDEXED */
158807
+ 212, /* (171) expr ::= JOIN_KW */
158808
+ 212, /* (172) expr ::= nm DOT nm */
158809
+ 212, /* (173) expr ::= nm DOT nm DOT nm */
158810
+ 211, /* (174) term ::= NULL|FLOAT|BLOB */
158811
+ 211, /* (175) term ::= STRING */
158812
+ 211, /* (176) term ::= INTEGER */
158813
+ 212, /* (177) expr ::= VARIABLE */
158814
+ 212, /* (178) expr ::= expr COLLATE ID|STRING */
158815
+ 212, /* (179) expr ::= CAST LP expr AS typetoken RP */
158816
+ 212, /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
158817
+ 212, /* (181) expr ::= ID|INDEXED LP STAR RP */
158818
+ 212, /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
158819
+ 212, /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
158820
+ 211, /* (184) term ::= CTIME_KW */
158821
+ 212, /* (185) expr ::= LP nexprlist COMMA expr RP */
158822
+ 212, /* (186) expr ::= expr AND expr */
158823
+ 212, /* (187) expr ::= expr OR expr */
158824
+ 212, /* (188) expr ::= expr LT|GT|GE|LE expr */
158825
+ 212, /* (189) expr ::= expr EQ|NE expr */
158826
+ 212, /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
158827
+ 212, /* (191) expr ::= expr PLUS|MINUS expr */
158828
+ 212, /* (192) expr ::= expr STAR|SLASH|REM expr */
158829
+ 212, /* (193) expr ::= expr CONCAT expr */
158830
+ 267, /* (194) likeop ::= NOT LIKE_KW|MATCH */
158831
+ 212, /* (195) expr ::= expr likeop expr */
158832
+ 212, /* (196) expr ::= expr likeop expr ESCAPE expr */
158833
+ 212, /* (197) expr ::= expr ISNULL|NOTNULL */
158834
+ 212, /* (198) expr ::= expr NOT NULL */
158835
+ 212, /* (199) expr ::= expr IS expr */
158836
+ 212, /* (200) expr ::= expr IS NOT expr */
158837
+ 212, /* (201) expr ::= NOT expr */
158838
+ 212, /* (202) expr ::= BITNOT expr */
158839
+ 212, /* (203) expr ::= PLUS|MINUS expr */
158840
+ 268, /* (204) between_op ::= BETWEEN */
158841
+ 268, /* (205) between_op ::= NOT BETWEEN */
158842
+ 212, /* (206) expr ::= expr between_op expr AND expr */
158843
+ 269, /* (207) in_op ::= IN */
158844
+ 269, /* (208) in_op ::= NOT IN */
158845
+ 212, /* (209) expr ::= expr in_op LP exprlist RP */
158846
+ 212, /* (210) expr ::= LP select RP */
158847
+ 212, /* (211) expr ::= expr in_op LP select RP */
158848
+ 212, /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
158849
+ 212, /* (213) expr ::= EXISTS LP select RP */
158850
+ 212, /* (214) expr ::= CASE case_operand case_exprlist case_else END */
158851
+ 272, /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
158852
+ 272, /* (216) case_exprlist ::= WHEN expr THEN expr */
158853
+ 273, /* (217) case_else ::= ELSE expr */
158854
+ 273, /* (218) case_else ::= */
158855
+ 271, /* (219) case_operand ::= expr */
158856
+ 271, /* (220) case_operand ::= */
158857
+ 257, /* (221) exprlist ::= */
158858
+ 248, /* (222) nexprlist ::= nexprlist COMMA expr */
158859
+ 248, /* (223) nexprlist ::= expr */
158860
+ 270, /* (224) paren_exprlist ::= */
158861
+ 270, /* (225) paren_exprlist ::= LP exprlist RP */
158862
+ 186, /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
158863
+ 274, /* (227) uniqueflag ::= UNIQUE */
158864
+ 274, /* (228) uniqueflag ::= */
158865
+ 216, /* (229) eidlist_opt ::= */
158866
+ 216, /* (230) eidlist_opt ::= LP eidlist RP */
158867
+ 227, /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
158868
+ 227, /* (232) eidlist ::= nm collate sortorder */
158869
+ 275, /* (233) collate ::= */
158870
+ 275, /* (234) collate ::= COLLATE ID|STRING */
158871
+ 186, /* (235) cmd ::= DROP INDEX ifexists fullname */
158872
+ 186, /* (236) cmd ::= VACUUM vinto */
158873
+ 186, /* (237) cmd ::= VACUUM nm vinto */
158874
+ 276, /* (238) vinto ::= INTO expr */
158875
+ 276, /* (239) vinto ::= */
158876
+ 186, /* (240) cmd ::= PRAGMA nm dbnm */
158877
+ 186, /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
158878
+ 186, /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
158879
+ 186, /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
158880
+ 186, /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
158881
+ 206, /* (245) plus_num ::= PLUS INTEGER|FLOAT */
158882
+ 207, /* (246) minus_num ::= MINUS INTEGER|FLOAT */
158883
+ 186, /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
158884
+ 278, /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
158885
+ 280, /* (249) trigger_time ::= BEFORE|AFTER */
158886
+ 280, /* (250) trigger_time ::= INSTEAD OF */
158887
+ 280, /* (251) trigger_time ::= */
158888
+ 281, /* (252) trigger_event ::= DELETE|INSERT */
158889
+ 281, /* (253) trigger_event ::= UPDATE */
158890
+ 281, /* (254) trigger_event ::= UPDATE OF idlist */
158891
+ 283, /* (255) when_clause ::= */
158892
+ 283, /* (256) when_clause ::= WHEN expr */
158893
+ 279, /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
158894
+ 279, /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
158895
+ 285, /* (259) trnm ::= nm DOT nm */
158896
+ 286, /* (260) tridxby ::= INDEXED BY nm */
158897
+ 286, /* (261) tridxby ::= NOT INDEXED */
158898
+ 284, /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
158899
+ 284, /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
158900
+ 284, /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
158901
+ 284, /* (265) trigger_cmd ::= scanpt select scanpt */
158902
+ 212, /* (266) expr ::= RAISE LP IGNORE RP */
158903
+ 212, /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
158904
+ 231, /* (268) raisetype ::= ROLLBACK */
158905
+ 231, /* (269) raisetype ::= ABORT */
158906
+ 231, /* (270) raisetype ::= FAIL */
158907
+ 186, /* (271) cmd ::= DROP TRIGGER ifexists fullname */
158908
+ 186, /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
158909
+ 186, /* (273) cmd ::= DETACH database_kw_opt expr */
158910
+ 288, /* (274) key_opt ::= */
158911
+ 288, /* (275) key_opt ::= KEY expr */
158912
+ 186, /* (276) cmd ::= REINDEX */
158913
+ 186, /* (277) cmd ::= REINDEX nm dbnm */
158914
+ 186, /* (278) cmd ::= ANALYZE */
158915
+ 186, /* (279) cmd ::= ANALYZE nm dbnm */
158916
+ 186, /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
158917
+ 186, /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
158918
+ 289, /* (282) add_column_fullname ::= fullname */
158919
+ 186, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
158920
+ 186, /* (284) cmd ::= create_vtab */
158921
+ 186, /* (285) cmd ::= create_vtab LP vtabarglist RP */
158922
+ 291, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
158923
+ 293, /* (287) vtabarg ::= */
158924
+ 294, /* (288) vtabargtoken ::= ANY */
158925
+ 294, /* (289) vtabargtoken ::= lp anylist RP */
158926
+ 295, /* (290) lp ::= LP */
158927
+ 261, /* (291) with ::= WITH wqlist */
158928
+ 261, /* (292) with ::= WITH RECURSIVE wqlist */
158929
+ 236, /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
158930
+ 236, /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
158931
+ 297, /* (295) windowdefn_list ::= windowdefn */
158932
+ 297, /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
158933
+ 298, /* (297) windowdefn ::= nm AS LP window RP */
158934
+ 299, /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
158935
+ 299, /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
158936
+ 299, /* (300) window ::= ORDER BY sortlist frame_opt */
158937
+ 299, /* (301) window ::= nm ORDER BY sortlist frame_opt */
158938
+ 299, /* (302) window ::= frame_opt */
158939
+ 299, /* (303) window ::= nm frame_opt */
158940
+ 300, /* (304) frame_opt ::= */
158941
+ 300, /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
158942
+ 300, /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
158943
+ 304, /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
158944
+ 306, /* (308) frame_bound_s ::= frame_bound */
158945
+ 306, /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
158946
+ 307, /* (310) frame_bound_e ::= frame_bound */
158947
+ 307, /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
158948
+ 305, /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
158949
+ 305, /* (313) frame_bound ::= CURRENT ROW */
158950
+ 308, /* (314) frame_exclude_opt ::= */
158951
+ 308, /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
158952
+ 309, /* (316) frame_exclude ::= NO OTHERS */
158953
+ 309, /* (317) frame_exclude ::= CURRENT ROW */
158954
+ 309, /* (318) frame_exclude ::= GROUP|TIES */
158955
+ 246, /* (319) window_clause ::= WINDOW windowdefn_list */
158956
+ 266, /* (320) filter_over ::= filter_clause over_clause */
158957
+ 266, /* (321) filter_over ::= over_clause */
158958
+ 266, /* (322) filter_over ::= filter_clause */
158959
+ 303, /* (323) over_clause ::= OVER LP window RP */
158960
+ 303, /* (324) over_clause ::= OVER nm */
158961
+ 302, /* (325) filter_clause ::= FILTER LP WHERE expr RP */
158962
+ 181, /* (326) input ::= cmdlist */
158963
+ 182, /* (327) cmdlist ::= cmdlist ecmd */
158964
+ 182, /* (328) cmdlist ::= ecmd */
158965
+ 183, /* (329) ecmd ::= SEMI */
158966
+ 183, /* (330) ecmd ::= cmdx SEMI */
158967
+ 183, /* (331) ecmd ::= explain cmdx SEMI */
158968
+ 188, /* (332) trans_opt ::= */
158969
+ 188, /* (333) trans_opt ::= TRANSACTION */
158970
+ 188, /* (334) trans_opt ::= TRANSACTION nm */
158971
+ 190, /* (335) savepoint_opt ::= SAVEPOINT */
158972
+ 190, /* (336) savepoint_opt ::= */
158973
+ 186, /* (337) cmd ::= create_table create_table_args */
158974
+ 197, /* (338) columnlist ::= columnlist COMMA columnname carglist */
158975
+ 197, /* (339) columnlist ::= columnname carglist */
158976
+ 189, /* (340) nm ::= ID|INDEXED */
158977
+ 189, /* (341) nm ::= STRING */
158978
+ 189, /* (342) nm ::= JOIN_KW */
158979
+ 203, /* (343) typetoken ::= typename */
158980
+ 204, /* (344) typename ::= ID|STRING */
158981
+ 205, /* (345) signed ::= plus_num */
158982
+ 205, /* (346) signed ::= minus_num */
158983
+ 202, /* (347) carglist ::= carglist ccons */
158984
+ 202, /* (348) carglist ::= */
158985
+ 210, /* (349) ccons ::= NULL onconf */
158986
+ 210, /* (350) ccons ::= GENERATED ALWAYS AS generated */
158987
+ 210, /* (351) ccons ::= AS generated */
158988
+ 198, /* (352) conslist_opt ::= COMMA conslist */
158989
+ 223, /* (353) conslist ::= conslist tconscomma tcons */
158990
+ 223, /* (354) conslist ::= tcons */
158991
+ 224, /* (355) tconscomma ::= */
158992
+ 228, /* (356) defer_subclause_opt ::= defer_subclause */
158993
+ 230, /* (357) resolvetype ::= raisetype */
158994
+ 234, /* (358) selectnowith ::= oneselect */
158995
+ 235, /* (359) oneselect ::= values */
158996
+ 249, /* (360) sclp ::= selcollist COMMA */
158997
+ 250, /* (361) as ::= ID|STRING */
158998
+ 212, /* (362) expr ::= term */
158999
+ 267, /* (363) likeop ::= LIKE_KW|MATCH */
159000
+ 257, /* (364) exprlist ::= nexprlist */
159001
+ 277, /* (365) nmnum ::= plus_num */
159002
+ 277, /* (366) nmnum ::= nm */
159003
+ 277, /* (367) nmnum ::= ON */
159004
+ 277, /* (368) nmnum ::= DELETE */
159005
+ 277, /* (369) nmnum ::= DEFAULT */
159006
+ 206, /* (370) plus_num ::= INTEGER|FLOAT */
159007
+ 282, /* (371) foreach_clause ::= */
159008
+ 282, /* (372) foreach_clause ::= FOR EACH ROW */
159009
+ 285, /* (373) trnm ::= nm */
159010
+ 286, /* (374) tridxby ::= */
159011
+ 287, /* (375) database_kw_opt ::= DATABASE */
159012
+ 287, /* (376) database_kw_opt ::= */
159013
+ 290, /* (377) kwcolumn_opt ::= */
159014
+ 290, /* (378) kwcolumn_opt ::= COLUMNKW */
159015
+ 292, /* (379) vtabarglist ::= vtabarg */
159016
+ 292, /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
159017
+ 293, /* (381) vtabarg ::= vtabarg vtabargtoken */
159018
+ 296, /* (382) anylist ::= */
159019
+ 296, /* (383) anylist ::= anylist LP anylist RP */
159020
+ 296, /* (384) anylist ::= anylist ANY */
159021
+ 261, /* (385) with ::= */
157864159022
};
157865159023
157866159024
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
157867159025
** of symbols on the right-hand side of that rule. */
157868159026
static const signed char yyRuleInfoNRhs[] = {
@@ -158023,236 +159181,237 @@
158023159181
-3, /* (154) setlist ::= nm EQ expr */
158024159182
-5, /* (155) setlist ::= LP idlist RP EQ expr */
158025159183
-7, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
158026159184
-7, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
158027159185
0, /* (158) upsert ::= */
158028
- -11, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
158029
- -8, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
159186
+ -12, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
159187
+ -9, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
158030159188
-4, /* (161) upsert ::= ON CONFLICT DO NOTHING */
158031
- -2, /* (162) insert_cmd ::= INSERT orconf */
158032
- -1, /* (163) insert_cmd ::= REPLACE */
158033
- 0, /* (164) idlist_opt ::= */
158034
- -3, /* (165) idlist_opt ::= LP idlist RP */
158035
- -3, /* (166) idlist ::= idlist COMMA nm */
158036
- -1, /* (167) idlist ::= nm */
158037
- -3, /* (168) expr ::= LP expr RP */
158038
- -1, /* (169) expr ::= ID|INDEXED */
158039
- -1, /* (170) expr ::= JOIN_KW */
158040
- -3, /* (171) expr ::= nm DOT nm */
158041
- -5, /* (172) expr ::= nm DOT nm DOT nm */
158042
- -1, /* (173) term ::= NULL|FLOAT|BLOB */
158043
- -1, /* (174) term ::= STRING */
158044
- -1, /* (175) term ::= INTEGER */
158045
- -1, /* (176) expr ::= VARIABLE */
158046
- -3, /* (177) expr ::= expr COLLATE ID|STRING */
158047
- -6, /* (178) expr ::= CAST LP expr AS typetoken RP */
158048
- -5, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */
158049
- -4, /* (180) expr ::= ID|INDEXED LP STAR RP */
158050
- -6, /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
158051
- -5, /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */
158052
- -1, /* (183) term ::= CTIME_KW */
158053
- -5, /* (184) expr ::= LP nexprlist COMMA expr RP */
158054
- -3, /* (185) expr ::= expr AND expr */
158055
- -3, /* (186) expr ::= expr OR expr */
158056
- -3, /* (187) expr ::= expr LT|GT|GE|LE expr */
158057
- -3, /* (188) expr ::= expr EQ|NE expr */
158058
- -3, /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
158059
- -3, /* (190) expr ::= expr PLUS|MINUS expr */
158060
- -3, /* (191) expr ::= expr STAR|SLASH|REM expr */
158061
- -3, /* (192) expr ::= expr CONCAT expr */
158062
- -2, /* (193) likeop ::= NOT LIKE_KW|MATCH */
158063
- -3, /* (194) expr ::= expr likeop expr */
158064
- -5, /* (195) expr ::= expr likeop expr ESCAPE expr */
158065
- -2, /* (196) expr ::= expr ISNULL|NOTNULL */
158066
- -3, /* (197) expr ::= expr NOT NULL */
158067
- -3, /* (198) expr ::= expr IS expr */
158068
- -4, /* (199) expr ::= expr IS NOT expr */
158069
- -2, /* (200) expr ::= NOT expr */
158070
- -2, /* (201) expr ::= BITNOT expr */
158071
- -2, /* (202) expr ::= PLUS|MINUS expr */
158072
- -1, /* (203) between_op ::= BETWEEN */
158073
- -2, /* (204) between_op ::= NOT BETWEEN */
158074
- -5, /* (205) expr ::= expr between_op expr AND expr */
158075
- -1, /* (206) in_op ::= IN */
158076
- -2, /* (207) in_op ::= NOT IN */
158077
- -5, /* (208) expr ::= expr in_op LP exprlist RP */
158078
- -3, /* (209) expr ::= LP select RP */
158079
- -5, /* (210) expr ::= expr in_op LP select RP */
158080
- -5, /* (211) expr ::= expr in_op nm dbnm paren_exprlist */
158081
- -4, /* (212) expr ::= EXISTS LP select RP */
158082
- -5, /* (213) expr ::= CASE case_operand case_exprlist case_else END */
158083
- -5, /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */
158084
- -4, /* (215) case_exprlist ::= WHEN expr THEN expr */
158085
- -2, /* (216) case_else ::= ELSE expr */
158086
- 0, /* (217) case_else ::= */
158087
- -1, /* (218) case_operand ::= expr */
158088
- 0, /* (219) case_operand ::= */
158089
- 0, /* (220) exprlist ::= */
158090
- -3, /* (221) nexprlist ::= nexprlist COMMA expr */
158091
- -1, /* (222) nexprlist ::= expr */
158092
- 0, /* (223) paren_exprlist ::= */
158093
- -3, /* (224) paren_exprlist ::= LP exprlist RP */
158094
- -12, /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
158095
- -1, /* (226) uniqueflag ::= UNIQUE */
158096
- 0, /* (227) uniqueflag ::= */
158097
- 0, /* (228) eidlist_opt ::= */
158098
- -3, /* (229) eidlist_opt ::= LP eidlist RP */
158099
- -5, /* (230) eidlist ::= eidlist COMMA nm collate sortorder */
158100
- -3, /* (231) eidlist ::= nm collate sortorder */
158101
- 0, /* (232) collate ::= */
158102
- -2, /* (233) collate ::= COLLATE ID|STRING */
158103
- -4, /* (234) cmd ::= DROP INDEX ifexists fullname */
158104
- -2, /* (235) cmd ::= VACUUM vinto */
158105
- -3, /* (236) cmd ::= VACUUM nm vinto */
158106
- -2, /* (237) vinto ::= INTO expr */
158107
- 0, /* (238) vinto ::= */
158108
- -3, /* (239) cmd ::= PRAGMA nm dbnm */
158109
- -5, /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */
158110
- -6, /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */
158111
- -5, /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */
158112
- -6, /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */
158113
- -2, /* (244) plus_num ::= PLUS INTEGER|FLOAT */
158114
- -2, /* (245) minus_num ::= MINUS INTEGER|FLOAT */
158115
- -5, /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
158116
- -11, /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
158117
- -1, /* (248) trigger_time ::= BEFORE|AFTER */
158118
- -2, /* (249) trigger_time ::= INSTEAD OF */
158119
- 0, /* (250) trigger_time ::= */
158120
- -1, /* (251) trigger_event ::= DELETE|INSERT */
158121
- -1, /* (252) trigger_event ::= UPDATE */
158122
- -3, /* (253) trigger_event ::= UPDATE OF idlist */
158123
- 0, /* (254) when_clause ::= */
158124
- -2, /* (255) when_clause ::= WHEN expr */
158125
- -3, /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
158126
- -2, /* (257) trigger_cmd_list ::= trigger_cmd SEMI */
158127
- -3, /* (258) trnm ::= nm DOT nm */
158128
- -3, /* (259) tridxby ::= INDEXED BY nm */
158129
- -2, /* (260) tridxby ::= NOT INDEXED */
158130
- -9, /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
158131
- -8, /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
158132
- -6, /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
158133
- -3, /* (264) trigger_cmd ::= scanpt select scanpt */
158134
- -4, /* (265) expr ::= RAISE LP IGNORE RP */
158135
- -6, /* (266) expr ::= RAISE LP raisetype COMMA nm RP */
158136
- -1, /* (267) raisetype ::= ROLLBACK */
158137
- -1, /* (268) raisetype ::= ABORT */
158138
- -1, /* (269) raisetype ::= FAIL */
158139
- -4, /* (270) cmd ::= DROP TRIGGER ifexists fullname */
158140
- -6, /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
158141
- -3, /* (272) cmd ::= DETACH database_kw_opt expr */
158142
- 0, /* (273) key_opt ::= */
158143
- -2, /* (274) key_opt ::= KEY expr */
158144
- -1, /* (275) cmd ::= REINDEX */
158145
- -3, /* (276) cmd ::= REINDEX nm dbnm */
158146
- -1, /* (277) cmd ::= ANALYZE */
158147
- -3, /* (278) cmd ::= ANALYZE nm dbnm */
158148
- -6, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
158149
- -7, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
158150
- -1, /* (281) add_column_fullname ::= fullname */
158151
- -8, /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
158152
- -1, /* (283) cmd ::= create_vtab */
158153
- -4, /* (284) cmd ::= create_vtab LP vtabarglist RP */
158154
- -8, /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
158155
- 0, /* (286) vtabarg ::= */
158156
- -1, /* (287) vtabargtoken ::= ANY */
158157
- -3, /* (288) vtabargtoken ::= lp anylist RP */
158158
- -1, /* (289) lp ::= LP */
158159
- -2, /* (290) with ::= WITH wqlist */
158160
- -3, /* (291) with ::= WITH RECURSIVE wqlist */
158161
- -6, /* (292) wqlist ::= nm eidlist_opt AS LP select RP */
158162
- -8, /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
158163
- -1, /* (294) windowdefn_list ::= windowdefn */
158164
- -3, /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */
158165
- -5, /* (296) windowdefn ::= nm AS LP window RP */
158166
- -5, /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
158167
- -6, /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
158168
- -4, /* (299) window ::= ORDER BY sortlist frame_opt */
158169
- -5, /* (300) window ::= nm ORDER BY sortlist frame_opt */
158170
- -1, /* (301) window ::= frame_opt */
158171
- -2, /* (302) window ::= nm frame_opt */
158172
- 0, /* (303) frame_opt ::= */
158173
- -3, /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
158174
- -6, /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
158175
- -1, /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */
158176
- -1, /* (307) frame_bound_s ::= frame_bound */
158177
- -2, /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */
158178
- -1, /* (309) frame_bound_e ::= frame_bound */
158179
- -2, /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */
158180
- -2, /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */
158181
- -2, /* (312) frame_bound ::= CURRENT ROW */
158182
- 0, /* (313) frame_exclude_opt ::= */
158183
- -2, /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */
158184
- -2, /* (315) frame_exclude ::= NO OTHERS */
158185
- -2, /* (316) frame_exclude ::= CURRENT ROW */
158186
- -1, /* (317) frame_exclude ::= GROUP|TIES */
158187
- -2, /* (318) window_clause ::= WINDOW windowdefn_list */
158188
- -2, /* (319) filter_over ::= filter_clause over_clause */
158189
- -1, /* (320) filter_over ::= over_clause */
158190
- -1, /* (321) filter_over ::= filter_clause */
158191
- -4, /* (322) over_clause ::= OVER LP window RP */
158192
- -2, /* (323) over_clause ::= OVER nm */
158193
- -5, /* (324) filter_clause ::= FILTER LP WHERE expr RP */
158194
- -1, /* (325) input ::= cmdlist */
158195
- -2, /* (326) cmdlist ::= cmdlist ecmd */
158196
- -1, /* (327) cmdlist ::= ecmd */
158197
- -1, /* (328) ecmd ::= SEMI */
158198
- -2, /* (329) ecmd ::= cmdx SEMI */
158199
- -3, /* (330) ecmd ::= explain cmdx SEMI */
158200
- 0, /* (331) trans_opt ::= */
158201
- -1, /* (332) trans_opt ::= TRANSACTION */
158202
- -2, /* (333) trans_opt ::= TRANSACTION nm */
158203
- -1, /* (334) savepoint_opt ::= SAVEPOINT */
158204
- 0, /* (335) savepoint_opt ::= */
158205
- -2, /* (336) cmd ::= create_table create_table_args */
158206
- -4, /* (337) columnlist ::= columnlist COMMA columnname carglist */
158207
- -2, /* (338) columnlist ::= columnname carglist */
158208
- -1, /* (339) nm ::= ID|INDEXED */
158209
- -1, /* (340) nm ::= STRING */
158210
- -1, /* (341) nm ::= JOIN_KW */
158211
- -1, /* (342) typetoken ::= typename */
158212
- -1, /* (343) typename ::= ID|STRING */
158213
- -1, /* (344) signed ::= plus_num */
158214
- -1, /* (345) signed ::= minus_num */
158215
- -2, /* (346) carglist ::= carglist ccons */
158216
- 0, /* (347) carglist ::= */
158217
- -2, /* (348) ccons ::= NULL onconf */
158218
- -4, /* (349) ccons ::= GENERATED ALWAYS AS generated */
158219
- -2, /* (350) ccons ::= AS generated */
158220
- -2, /* (351) conslist_opt ::= COMMA conslist */
158221
- -3, /* (352) conslist ::= conslist tconscomma tcons */
158222
- -1, /* (353) conslist ::= tcons */
158223
- 0, /* (354) tconscomma ::= */
158224
- -1, /* (355) defer_subclause_opt ::= defer_subclause */
158225
- -1, /* (356) resolvetype ::= raisetype */
158226
- -1, /* (357) selectnowith ::= oneselect */
158227
- -1, /* (358) oneselect ::= values */
158228
- -2, /* (359) sclp ::= selcollist COMMA */
158229
- -1, /* (360) as ::= ID|STRING */
158230
- -1, /* (361) expr ::= term */
158231
- -1, /* (362) likeop ::= LIKE_KW|MATCH */
158232
- -1, /* (363) exprlist ::= nexprlist */
158233
- -1, /* (364) nmnum ::= plus_num */
158234
- -1, /* (365) nmnum ::= nm */
158235
- -1, /* (366) nmnum ::= ON */
158236
- -1, /* (367) nmnum ::= DELETE */
158237
- -1, /* (368) nmnum ::= DEFAULT */
158238
- -1, /* (369) plus_num ::= INTEGER|FLOAT */
158239
- 0, /* (370) foreach_clause ::= */
158240
- -3, /* (371) foreach_clause ::= FOR EACH ROW */
158241
- -1, /* (372) trnm ::= nm */
158242
- 0, /* (373) tridxby ::= */
158243
- -1, /* (374) database_kw_opt ::= DATABASE */
158244
- 0, /* (375) database_kw_opt ::= */
158245
- 0, /* (376) kwcolumn_opt ::= */
158246
- -1, /* (377) kwcolumn_opt ::= COLUMNKW */
158247
- -1, /* (378) vtabarglist ::= vtabarg */
158248
- -3, /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */
158249
- -2, /* (380) vtabarg ::= vtabarg vtabargtoken */
158250
- 0, /* (381) anylist ::= */
158251
- -4, /* (382) anylist ::= anylist LP anylist RP */
158252
- -2, /* (383) anylist ::= anylist ANY */
158253
- 0, /* (384) with ::= */
159189
+ -7, /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
159190
+ -2, /* (163) insert_cmd ::= INSERT orconf */
159191
+ -1, /* (164) insert_cmd ::= REPLACE */
159192
+ 0, /* (165) idlist_opt ::= */
159193
+ -3, /* (166) idlist_opt ::= LP idlist RP */
159194
+ -3, /* (167) idlist ::= idlist COMMA nm */
159195
+ -1, /* (168) idlist ::= nm */
159196
+ -3, /* (169) expr ::= LP expr RP */
159197
+ -1, /* (170) expr ::= ID|INDEXED */
159198
+ -1, /* (171) expr ::= JOIN_KW */
159199
+ -3, /* (172) expr ::= nm DOT nm */
159200
+ -5, /* (173) expr ::= nm DOT nm DOT nm */
159201
+ -1, /* (174) term ::= NULL|FLOAT|BLOB */
159202
+ -1, /* (175) term ::= STRING */
159203
+ -1, /* (176) term ::= INTEGER */
159204
+ -1, /* (177) expr ::= VARIABLE */
159205
+ -3, /* (178) expr ::= expr COLLATE ID|STRING */
159206
+ -6, /* (179) expr ::= CAST LP expr AS typetoken RP */
159207
+ -5, /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
159208
+ -4, /* (181) expr ::= ID|INDEXED LP STAR RP */
159209
+ -6, /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159210
+ -5, /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
159211
+ -1, /* (184) term ::= CTIME_KW */
159212
+ -5, /* (185) expr ::= LP nexprlist COMMA expr RP */
159213
+ -3, /* (186) expr ::= expr AND expr */
159214
+ -3, /* (187) expr ::= expr OR expr */
159215
+ -3, /* (188) expr ::= expr LT|GT|GE|LE expr */
159216
+ -3, /* (189) expr ::= expr EQ|NE expr */
159217
+ -3, /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
159218
+ -3, /* (191) expr ::= expr PLUS|MINUS expr */
159219
+ -3, /* (192) expr ::= expr STAR|SLASH|REM expr */
159220
+ -3, /* (193) expr ::= expr CONCAT expr */
159221
+ -2, /* (194) likeop ::= NOT LIKE_KW|MATCH */
159222
+ -3, /* (195) expr ::= expr likeop expr */
159223
+ -5, /* (196) expr ::= expr likeop expr ESCAPE expr */
159224
+ -2, /* (197) expr ::= expr ISNULL|NOTNULL */
159225
+ -3, /* (198) expr ::= expr NOT NULL */
159226
+ -3, /* (199) expr ::= expr IS expr */
159227
+ -4, /* (200) expr ::= expr IS NOT expr */
159228
+ -2, /* (201) expr ::= NOT expr */
159229
+ -2, /* (202) expr ::= BITNOT expr */
159230
+ -2, /* (203) expr ::= PLUS|MINUS expr */
159231
+ -1, /* (204) between_op ::= BETWEEN */
159232
+ -2, /* (205) between_op ::= NOT BETWEEN */
159233
+ -5, /* (206) expr ::= expr between_op expr AND expr */
159234
+ -1, /* (207) in_op ::= IN */
159235
+ -2, /* (208) in_op ::= NOT IN */
159236
+ -5, /* (209) expr ::= expr in_op LP exprlist RP */
159237
+ -3, /* (210) expr ::= LP select RP */
159238
+ -5, /* (211) expr ::= expr in_op LP select RP */
159239
+ -5, /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
159240
+ -4, /* (213) expr ::= EXISTS LP select RP */
159241
+ -5, /* (214) expr ::= CASE case_operand case_exprlist case_else END */
159242
+ -5, /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
159243
+ -4, /* (216) case_exprlist ::= WHEN expr THEN expr */
159244
+ -2, /* (217) case_else ::= ELSE expr */
159245
+ 0, /* (218) case_else ::= */
159246
+ -1, /* (219) case_operand ::= expr */
159247
+ 0, /* (220) case_operand ::= */
159248
+ 0, /* (221) exprlist ::= */
159249
+ -3, /* (222) nexprlist ::= nexprlist COMMA expr */
159250
+ -1, /* (223) nexprlist ::= expr */
159251
+ 0, /* (224) paren_exprlist ::= */
159252
+ -3, /* (225) paren_exprlist ::= LP exprlist RP */
159253
+ -12, /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159254
+ -1, /* (227) uniqueflag ::= UNIQUE */
159255
+ 0, /* (228) uniqueflag ::= */
159256
+ 0, /* (229) eidlist_opt ::= */
159257
+ -3, /* (230) eidlist_opt ::= LP eidlist RP */
159258
+ -5, /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
159259
+ -3, /* (232) eidlist ::= nm collate sortorder */
159260
+ 0, /* (233) collate ::= */
159261
+ -2, /* (234) collate ::= COLLATE ID|STRING */
159262
+ -4, /* (235) cmd ::= DROP INDEX ifexists fullname */
159263
+ -2, /* (236) cmd ::= VACUUM vinto */
159264
+ -3, /* (237) cmd ::= VACUUM nm vinto */
159265
+ -2, /* (238) vinto ::= INTO expr */
159266
+ 0, /* (239) vinto ::= */
159267
+ -3, /* (240) cmd ::= PRAGMA nm dbnm */
159268
+ -5, /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
159269
+ -6, /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
159270
+ -5, /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
159271
+ -6, /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
159272
+ -2, /* (245) plus_num ::= PLUS INTEGER|FLOAT */
159273
+ -2, /* (246) minus_num ::= MINUS INTEGER|FLOAT */
159274
+ -5, /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159275
+ -11, /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159276
+ -1, /* (249) trigger_time ::= BEFORE|AFTER */
159277
+ -2, /* (250) trigger_time ::= INSTEAD OF */
159278
+ 0, /* (251) trigger_time ::= */
159279
+ -1, /* (252) trigger_event ::= DELETE|INSERT */
159280
+ -1, /* (253) trigger_event ::= UPDATE */
159281
+ -3, /* (254) trigger_event ::= UPDATE OF idlist */
159282
+ 0, /* (255) when_clause ::= */
159283
+ -2, /* (256) when_clause ::= WHEN expr */
159284
+ -3, /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159285
+ -2, /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
159286
+ -3, /* (259) trnm ::= nm DOT nm */
159287
+ -3, /* (260) tridxby ::= INDEXED BY nm */
159288
+ -2, /* (261) tridxby ::= NOT INDEXED */
159289
+ -9, /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159290
+ -8, /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159291
+ -6, /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159292
+ -3, /* (265) trigger_cmd ::= scanpt select scanpt */
159293
+ -4, /* (266) expr ::= RAISE LP IGNORE RP */
159294
+ -6, /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
159295
+ -1, /* (268) raisetype ::= ROLLBACK */
159296
+ -1, /* (269) raisetype ::= ABORT */
159297
+ -1, /* (270) raisetype ::= FAIL */
159298
+ -4, /* (271) cmd ::= DROP TRIGGER ifexists fullname */
159299
+ -6, /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159300
+ -3, /* (273) cmd ::= DETACH database_kw_opt expr */
159301
+ 0, /* (274) key_opt ::= */
159302
+ -2, /* (275) key_opt ::= KEY expr */
159303
+ -1, /* (276) cmd ::= REINDEX */
159304
+ -3, /* (277) cmd ::= REINDEX nm dbnm */
159305
+ -1, /* (278) cmd ::= ANALYZE */
159306
+ -3, /* (279) cmd ::= ANALYZE nm dbnm */
159307
+ -6, /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
159308
+ -7, /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159309
+ -1, /* (282) add_column_fullname ::= fullname */
159310
+ -8, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159311
+ -1, /* (284) cmd ::= create_vtab */
159312
+ -4, /* (285) cmd ::= create_vtab LP vtabarglist RP */
159313
+ -8, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159314
+ 0, /* (287) vtabarg ::= */
159315
+ -1, /* (288) vtabargtoken ::= ANY */
159316
+ -3, /* (289) vtabargtoken ::= lp anylist RP */
159317
+ -1, /* (290) lp ::= LP */
159318
+ -2, /* (291) with ::= WITH wqlist */
159319
+ -3, /* (292) with ::= WITH RECURSIVE wqlist */
159320
+ -6, /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
159321
+ -8, /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159322
+ -1, /* (295) windowdefn_list ::= windowdefn */
159323
+ -3, /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159324
+ -5, /* (297) windowdefn ::= nm AS LP window RP */
159325
+ -5, /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159326
+ -6, /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159327
+ -4, /* (300) window ::= ORDER BY sortlist frame_opt */
159328
+ -5, /* (301) window ::= nm ORDER BY sortlist frame_opt */
159329
+ -1, /* (302) window ::= frame_opt */
159330
+ -2, /* (303) window ::= nm frame_opt */
159331
+ 0, /* (304) frame_opt ::= */
159332
+ -3, /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159333
+ -6, /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159334
+ -1, /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
159335
+ -1, /* (308) frame_bound_s ::= frame_bound */
159336
+ -2, /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
159337
+ -1, /* (310) frame_bound_e ::= frame_bound */
159338
+ -2, /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
159339
+ -2, /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
159340
+ -2, /* (313) frame_bound ::= CURRENT ROW */
159341
+ 0, /* (314) frame_exclude_opt ::= */
159342
+ -2, /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
159343
+ -2, /* (316) frame_exclude ::= NO OTHERS */
159344
+ -2, /* (317) frame_exclude ::= CURRENT ROW */
159345
+ -1, /* (318) frame_exclude ::= GROUP|TIES */
159346
+ -2, /* (319) window_clause ::= WINDOW windowdefn_list */
159347
+ -2, /* (320) filter_over ::= filter_clause over_clause */
159348
+ -1, /* (321) filter_over ::= over_clause */
159349
+ -1, /* (322) filter_over ::= filter_clause */
159350
+ -4, /* (323) over_clause ::= OVER LP window RP */
159351
+ -2, /* (324) over_clause ::= OVER nm */
159352
+ -5, /* (325) filter_clause ::= FILTER LP WHERE expr RP */
159353
+ -1, /* (326) input ::= cmdlist */
159354
+ -2, /* (327) cmdlist ::= cmdlist ecmd */
159355
+ -1, /* (328) cmdlist ::= ecmd */
159356
+ -1, /* (329) ecmd ::= SEMI */
159357
+ -2, /* (330) ecmd ::= cmdx SEMI */
159358
+ -3, /* (331) ecmd ::= explain cmdx SEMI */
159359
+ 0, /* (332) trans_opt ::= */
159360
+ -1, /* (333) trans_opt ::= TRANSACTION */
159361
+ -2, /* (334) trans_opt ::= TRANSACTION nm */
159362
+ -1, /* (335) savepoint_opt ::= SAVEPOINT */
159363
+ 0, /* (336) savepoint_opt ::= */
159364
+ -2, /* (337) cmd ::= create_table create_table_args */
159365
+ -4, /* (338) columnlist ::= columnlist COMMA columnname carglist */
159366
+ -2, /* (339) columnlist ::= columnname carglist */
159367
+ -1, /* (340) nm ::= ID|INDEXED */
159368
+ -1, /* (341) nm ::= STRING */
159369
+ -1, /* (342) nm ::= JOIN_KW */
159370
+ -1, /* (343) typetoken ::= typename */
159371
+ -1, /* (344) typename ::= ID|STRING */
159372
+ -1, /* (345) signed ::= plus_num */
159373
+ -1, /* (346) signed ::= minus_num */
159374
+ -2, /* (347) carglist ::= carglist ccons */
159375
+ 0, /* (348) carglist ::= */
159376
+ -2, /* (349) ccons ::= NULL onconf */
159377
+ -4, /* (350) ccons ::= GENERATED ALWAYS AS generated */
159378
+ -2, /* (351) ccons ::= AS generated */
159379
+ -2, /* (352) conslist_opt ::= COMMA conslist */
159380
+ -3, /* (353) conslist ::= conslist tconscomma tcons */
159381
+ -1, /* (354) conslist ::= tcons */
159382
+ 0, /* (355) tconscomma ::= */
159383
+ -1, /* (356) defer_subclause_opt ::= defer_subclause */
159384
+ -1, /* (357) resolvetype ::= raisetype */
159385
+ -1, /* (358) selectnowith ::= oneselect */
159386
+ -1, /* (359) oneselect ::= values */
159387
+ -2, /* (360) sclp ::= selcollist COMMA */
159388
+ -1, /* (361) as ::= ID|STRING */
159389
+ -1, /* (362) expr ::= term */
159390
+ -1, /* (363) likeop ::= LIKE_KW|MATCH */
159391
+ -1, /* (364) exprlist ::= nexprlist */
159392
+ -1, /* (365) nmnum ::= plus_num */
159393
+ -1, /* (366) nmnum ::= nm */
159394
+ -1, /* (367) nmnum ::= ON */
159395
+ -1, /* (368) nmnum ::= DELETE */
159396
+ -1, /* (369) nmnum ::= DEFAULT */
159397
+ -1, /* (370) plus_num ::= INTEGER|FLOAT */
159398
+ 0, /* (371) foreach_clause ::= */
159399
+ -3, /* (372) foreach_clause ::= FOR EACH ROW */
159400
+ -1, /* (373) trnm ::= nm */
159401
+ 0, /* (374) tridxby ::= */
159402
+ -1, /* (375) database_kw_opt ::= DATABASE */
159403
+ 0, /* (376) database_kw_opt ::= */
159404
+ 0, /* (377) kwcolumn_opt ::= */
159405
+ -1, /* (378) kwcolumn_opt ::= COLUMNKW */
159406
+ -1, /* (379) vtabarglist ::= vtabarg */
159407
+ -3, /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
159408
+ -2, /* (381) vtabarg ::= vtabarg vtabargtoken */
159409
+ 0, /* (382) anylist ::= */
159410
+ -4, /* (383) anylist ::= anylist LP anylist RP */
159411
+ -2, /* (384) anylist ::= anylist ANY */
159412
+ 0, /* (385) with ::= */
158254159413
};
158255159414
158256159415
static void yy_accept(yyParser*); /* Forward Declaration */
158257159416
158258159417
/*
@@ -158278,59 +159437,10 @@
158278159437
int yysize; /* Amount to pop the stack */
158279159438
sqlite3ParserARG_FETCH
158280159439
(void)yyLookahead;
158281159440
(void)yyLookaheadToken;
158282159441
yymsp = yypParser->yytos;
158283
- assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
158284
-#ifndef NDEBUG
158285
- if( yyTraceFILE ){
158286
- yysize = yyRuleInfoNRhs[yyruleno];
158287
- if( yysize ){
158288
- fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
158289
- yyTracePrompt,
158290
- yyruleno, yyRuleName[yyruleno],
158291
- yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
158292
- yymsp[yysize].stateno);
158293
- }else{
158294
- fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
158295
- yyTracePrompt, yyruleno, yyRuleName[yyruleno],
158296
- yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
158297
- }
158298
- }
158299
-#endif /* NDEBUG */
158300
-
158301
- /* Check that the stack is large enough to grow by a single entry
158302
- ** if the RHS of the rule is empty. This ensures that there is room
158303
- ** enough on the stack to push the LHS value */
158304
- if( yyRuleInfoNRhs[yyruleno]==0 ){
158305
-#ifdef YYTRACKMAXSTACKDEPTH
158306
- if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
158307
- yypParser->yyhwm++;
158308
- assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
158309
- }
158310
-#endif
158311
-#if YYSTACKDEPTH>0
158312
- if( yypParser->yytos>=yypParser->yystackEnd ){
158313
- yyStackOverflow(yypParser);
158314
- /* The call to yyStackOverflow() above pops the stack until it is
158315
- ** empty, causing the main parser loop to exit. So the return value
158316
- ** is never used and does not matter. */
158317
- return 0;
158318
- }
158319
-#else
158320
- if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
158321
- if( yyGrowStack(yypParser) ){
158322
- yyStackOverflow(yypParser);
158323
- /* The call to yyStackOverflow() above pops the stack until it is
158324
- ** empty, causing the main parser loop to exit. So the return value
158325
- ** is never used and does not matter. */
158326
- return 0;
158327
- }
158328
- yymsp = yypParser->yytos;
158329
- }
158330
-#endif
158331
- }
158332159442
158333159443
switch( yyruleno ){
158334159444
/* Beginning here are the reduction cases. A typical example
158335159445
** follows:
158336159446
** case 0:
@@ -158357,11 +159467,11 @@
158357159467
{yymsp[1].minor.yy192 = TK_DEFERRED;}
158358159468
break;
158359159469
case 5: /* transtype ::= DEFERRED */
158360159470
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
158361159471
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
158362
- case 306: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==306);
159472
+ case 307: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==307);
158363159473
{yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/}
158364159474
break;
158365159475
case 8: /* cmd ::= COMMIT|END trans_opt */
158366159476
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
158367159477
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -158395,11 +159505,11 @@
158395159505
case 45: /* autoinc ::= */ yytestcase(yyruleno==45);
158396159506
case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
158397159507
case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
158398159508
case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
158399159509
case 96: /* distinct ::= */ yytestcase(yyruleno==96);
158400
- case 232: /* collate ::= */ yytestcase(yyruleno==232);
159510
+ case 233: /* collate ::= */ yytestcase(yyruleno==233);
158401159511
{yymsp[1].minor.yy192 = 0;}
158402159512
break;
158403159513
case 16: /* ifnotexists ::= IF NOT EXISTS */
158404159514
{yymsp[-2].minor.yy192 = 1;}
158405159515
break;
@@ -158554,18 +159664,18 @@
158554159664
case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
158555159665
{yymsp[-2].minor.yy192 = 0;}
158556159666
break;
158557159667
case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
158558159668
case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
158559
- case 162: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==162);
159669
+ case 163: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==163);
158560159670
{yymsp[-1].minor.yy192 = yymsp[0].minor.yy192;}
158561159671
break;
158562159672
case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
158563159673
case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
158564
- case 204: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==204);
158565
- case 207: /* in_op ::= NOT IN */ yytestcase(yyruleno==207);
158566
- case 233: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==233);
159674
+ case 205: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==205);
159675
+ case 208: /* in_op ::= NOT IN */ yytestcase(yyruleno==208);
159676
+ case 234: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==234);
158567159677
{yymsp[-1].minor.yy192 = 1;}
158568159678
break;
158569159679
case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
158570159680
{yymsp[-1].minor.yy192 = 0;}
158571159681
break;
@@ -158597,11 +159707,11 @@
158597159707
break;
158598159708
case 75: /* resolvetype ::= IGNORE */
158599159709
{yymsp[0].minor.yy192 = OE_Ignore;}
158600159710
break;
158601159711
case 76: /* resolvetype ::= REPLACE */
158602
- case 163: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==163);
159712
+ case 164: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==164);
158603159713
{yymsp[0].minor.yy192 = OE_Replace;}
158604159714
break;
158605159715
case 77: /* cmd ::= DROP TABLE ifexists fullname */
158606159716
{
158607159717
sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192);
@@ -158729,13 +159839,13 @@
158729159839
{yymsp[0].minor.yy192 = SF_All;}
158730159840
break;
158731159841
case 97: /* sclp ::= */
158732159842
case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
158733159843
case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
158734
- case 220: /* exprlist ::= */ yytestcase(yyruleno==220);
158735
- case 223: /* paren_exprlist ::= */ yytestcase(yyruleno==223);
158736
- case 228: /* eidlist_opt ::= */ yytestcase(yyruleno==228);
159844
+ case 221: /* exprlist ::= */ yytestcase(yyruleno==221);
159845
+ case 224: /* paren_exprlist ::= */ yytestcase(yyruleno==224);
159846
+ case 229: /* eidlist_opt ::= */ yytestcase(yyruleno==229);
158737159847
{yymsp[1].minor.yy242 = 0;}
158738159848
break;
158739159849
case 98: /* selcollist ::= sclp scanpt expr scanpt as */
158740159850
{
158741159851
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
@@ -158757,12 +159867,12 @@
158757159867
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot);
158758159868
}
158759159869
break;
158760159870
case 101: /* as ::= AS nm */
158761159871
case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
158762
- case 244: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==244);
158763
- case 245: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==245);
159872
+ case 245: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==245);
159873
+ case 246: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==246);
158764159874
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
158765159875
break;
158766159876
case 103: /* from ::= */
158767159877
case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
158768159878
{yymsp[1].minor.yy47 = 0;}
@@ -158874,21 +159984,21 @@
158874159984
{yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
158875159985
break;
158876159986
case 123: /* on_opt ::= ON expr */
158877159987
case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
158878159988
case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
158879
- case 216: /* case_else ::= ELSE expr */ yytestcase(yyruleno==216);
158880
- case 237: /* vinto ::= INTO expr */ yytestcase(yyruleno==237);
159989
+ case 217: /* case_else ::= ELSE expr */ yytestcase(yyruleno==217);
159990
+ case 238: /* vinto ::= INTO expr */ yytestcase(yyruleno==238);
158881159991
{yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;}
158882159992
break;
158883159993
case 124: /* on_opt ::= */
158884159994
case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
158885159995
case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
158886159996
case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
158887
- case 217: /* case_else ::= */ yytestcase(yyruleno==217);
158888
- case 219: /* case_operand ::= */ yytestcase(yyruleno==219);
158889
- case 238: /* vinto ::= */ yytestcase(yyruleno==238);
159997
+ case 218: /* case_else ::= */ yytestcase(yyruleno==218);
159998
+ case 220: /* case_operand ::= */ yytestcase(yyruleno==220);
159999
+ case 239: /* vinto ::= */ yytestcase(yyruleno==239);
158890160000
{yymsp[1].minor.yy202 = 0;}
158891160001
break;
158892160002
case 126: /* indexed_opt ::= INDEXED BY nm */
158893160003
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
158894160004
break;
@@ -158897,11 +160007,11 @@
158897160007
break;
158898160008
case 128: /* using_opt ::= USING LP idlist RP */
158899160009
{yymsp[-3].minor.yy600 = yymsp[-1].minor.yy600;}
158900160010
break;
158901160011
case 129: /* using_opt ::= */
158902
- case 164: /* idlist_opt ::= */ yytestcase(yyruleno==164);
160012
+ case 165: /* idlist_opt ::= */ yytestcase(yyruleno==165);
158903160013
{yymsp[1].minor.yy600 = 0;}
158904160014
break;
158905160015
case 131: /* orderby_opt ::= ORDER BY sortlist */
158906160016
case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
158907160017
{yymsp[-2].minor.yy242 = yymsp[0].minor.yy242;}
@@ -158991,36 +160101,39 @@
158991160101
}
158992160102
break;
158993160103
case 158: /* upsert ::= */
158994160104
{ yymsp[1].minor.yy318 = 0; }
158995160105
break;
158996
- case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
158997
-{ yymsp[-10].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy242,yymsp[-5].minor.yy202,yymsp[-1].minor.yy242,yymsp[0].minor.yy202);}
160106
+ case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
160107
+{ yymsp[-11].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy242,yymsp[-6].minor.yy202,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202,yymsp[0].minor.yy318);}
158998160108
break;
158999
- case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
159000
-{ yymsp[-7].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202,0,0); }
160109
+ case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
160110
+{ yymsp[-8].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy242,yymsp[-3].minor.yy202,0,0,yymsp[0].minor.yy318); }
159001160111
break;
159002160112
case 161: /* upsert ::= ON CONFLICT DO NOTHING */
159003
-{ yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
160113
+{ yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
159004160114
break;
159005
- case 165: /* idlist_opt ::= LP idlist RP */
160115
+ case 162: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
160116
+{ yymsp[-6].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-1].minor.yy242,yymsp[0].minor.yy202,0);}
160117
+ break;
160118
+ case 166: /* idlist_opt ::= LP idlist RP */
159006160119
{yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;}
159007160120
break;
159008
- case 166: /* idlist ::= idlist COMMA nm */
160121
+ case 167: /* idlist ::= idlist COMMA nm */
159009160122
{yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);}
159010160123
break;
159011
- case 167: /* idlist ::= nm */
160124
+ case 168: /* idlist ::= nm */
159012160125
{yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
159013160126
break;
159014
- case 168: /* expr ::= LP expr RP */
160127
+ case 169: /* expr ::= LP expr RP */
159015160128
{yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;}
159016160129
break;
159017
- case 169: /* expr ::= ID|INDEXED */
159018
- case 170: /* expr ::= JOIN_KW */ yytestcase(yyruleno==170);
160130
+ case 170: /* expr ::= ID|INDEXED */
160131
+ case 171: /* expr ::= JOIN_KW */ yytestcase(yyruleno==171);
159019160132
{yymsp[0].minor.yy202=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
159020160133
break;
159021
- case 171: /* expr ::= nm DOT nm */
160134
+ case 172: /* expr ::= nm DOT nm */
159022160135
{
159023160136
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
159024160137
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
159025160138
if( IN_RENAME_OBJECT ){
159026160139
sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
@@ -159028,11 +160141,11 @@
159028160141
}
159029160142
yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
159030160143
}
159031160144
yymsp[-2].minor.yy202 = yylhsminor.yy202;
159032160145
break;
159033
- case 172: /* expr ::= nm DOT nm DOT nm */
160146
+ case 173: /* expr ::= nm DOT nm DOT nm */
159034160147
{
159035160148
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
159036160149
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
159037160150
Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
159038160151
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -159042,21 +160155,21 @@
159042160155
}
159043160156
yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
159044160157
}
159045160158
yymsp[-4].minor.yy202 = yylhsminor.yy202;
159046160159
break;
159047
- case 173: /* term ::= NULL|FLOAT|BLOB */
159048
- case 174: /* term ::= STRING */ yytestcase(yyruleno==174);
160160
+ case 174: /* term ::= NULL|FLOAT|BLOB */
160161
+ case 175: /* term ::= STRING */ yytestcase(yyruleno==175);
159049160162
{yymsp[0].minor.yy202=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
159050160163
break;
159051
- case 175: /* term ::= INTEGER */
160164
+ case 176: /* term ::= INTEGER */
159052160165
{
159053160166
yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
159054160167
}
159055160168
yymsp[0].minor.yy202 = yylhsminor.yy202;
159056160169
break;
159057
- case 176: /* expr ::= VARIABLE */
160170
+ case 177: /* expr ::= VARIABLE */
159058160171
{
159059160172
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
159060160173
u32 n = yymsp[0].minor.yy0.n;
159061160174
yymsp[0].minor.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
159062160175
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n);
@@ -159074,54 +160187,54 @@
159074160187
if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable);
159075160188
}
159076160189
}
159077160190
}
159078160191
break;
159079
- case 177: /* expr ::= expr COLLATE ID|STRING */
160192
+ case 178: /* expr ::= expr COLLATE ID|STRING */
159080160193
{
159081160194
yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1);
159082160195
}
159083160196
break;
159084
- case 178: /* expr ::= CAST LP expr AS typetoken RP */
160197
+ case 179: /* expr ::= CAST LP expr AS typetoken RP */
159085160198
{
159086160199
yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
159087160200
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0);
159088160201
}
159089160202
break;
159090
- case 179: /* expr ::= ID|INDEXED LP distinct exprlist RP */
160203
+ case 180: /* expr ::= ID|INDEXED LP distinct exprlist RP */
159091160204
{
159092160205
yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192);
159093160206
}
159094160207
yymsp[-4].minor.yy202 = yylhsminor.yy202;
159095160208
break;
159096
- case 180: /* expr ::= ID|INDEXED LP STAR RP */
160209
+ case 181: /* expr ::= ID|INDEXED LP STAR RP */
159097160210
{
159098160211
yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
159099160212
}
159100160213
yymsp[-3].minor.yy202 = yylhsminor.yy202;
159101160214
break;
159102
- case 181: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
160215
+ case 182: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159103160216
{
159104160217
yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192);
159105160218
sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
159106160219
}
159107160220
yymsp[-5].minor.yy202 = yylhsminor.yy202;
159108160221
break;
159109
- case 182: /* expr ::= ID|INDEXED LP STAR RP filter_over */
160222
+ case 183: /* expr ::= ID|INDEXED LP STAR RP filter_over */
159110160223
{
159111160224
yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
159112160225
sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
159113160226
}
159114160227
yymsp[-4].minor.yy202 = yylhsminor.yy202;
159115160228
break;
159116
- case 183: /* term ::= CTIME_KW */
160229
+ case 184: /* term ::= CTIME_KW */
159117160230
{
159118160231
yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
159119160232
}
159120160233
yymsp[0].minor.yy202 = yylhsminor.yy202;
159121160234
break;
159122
- case 184: /* expr ::= LP nexprlist COMMA expr RP */
160235
+ case 185: /* expr ::= LP nexprlist COMMA expr RP */
159123160236
{
159124160237
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202);
159125160238
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
159126160239
if( yymsp[-4].minor.yy202 ){
159127160240
yymsp[-4].minor.yy202->x.pList = pList;
@@ -159131,26 +160244,26 @@
159131160244
}else{
159132160245
sqlite3ExprListDelete(pParse->db, pList);
159133160246
}
159134160247
}
159135160248
break;
159136
- case 185: /* expr ::= expr AND expr */
160249
+ case 186: /* expr ::= expr AND expr */
159137160250
{yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
159138160251
break;
159139
- case 186: /* expr ::= expr OR expr */
159140
- case 187: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==187);
159141
- case 188: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==188);
159142
- case 189: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==189);
159143
- case 190: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==190);
159144
- case 191: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==191);
159145
- case 192: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==192);
160252
+ case 187: /* expr ::= expr OR expr */
160253
+ case 188: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==188);
160254
+ case 189: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==189);
160255
+ case 190: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==190);
160256
+ case 191: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==191);
160257
+ case 192: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==192);
160258
+ case 193: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==193);
159146160259
{yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
159147160260
break;
159148
- case 193: /* likeop ::= NOT LIKE_KW|MATCH */
160261
+ case 194: /* likeop ::= NOT LIKE_KW|MATCH */
159149160262
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
159150160263
break;
159151
- case 194: /* expr ::= expr likeop expr */
160264
+ case 195: /* expr ::= expr likeop expr */
159152160265
{
159153160266
ExprList *pList;
159154160267
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
159155160268
yymsp[-1].minor.yy0.n &= 0x7fffffff;
159156160269
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy202);
@@ -159158,11 +160271,11 @@
159158160271
yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
159159160272
if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0);
159160160273
if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc;
159161160274
}
159162160275
break;
159163
- case 195: /* expr ::= expr likeop expr ESCAPE expr */
160276
+ case 196: /* expr ::= expr likeop expr ESCAPE expr */
159164160277
{
159165160278
ExprList *pList;
159166160279
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
159167160280
yymsp[-3].minor.yy0.n &= 0x7fffffff;
159168160281
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
@@ -159171,43 +160284,43 @@
159171160284
yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
159172160285
if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159173160286
if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc;
159174160287
}
159175160288
break;
159176
- case 196: /* expr ::= expr ISNULL|NOTNULL */
160289
+ case 197: /* expr ::= expr ISNULL|NOTNULL */
159177160290
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);}
159178160291
break;
159179
- case 197: /* expr ::= expr NOT NULL */
160292
+ case 198: /* expr ::= expr NOT NULL */
159180160293
{yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);}
159181160294
break;
159182
- case 198: /* expr ::= expr IS expr */
160295
+ case 199: /* expr ::= expr IS expr */
159183160296
{
159184160297
yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);
159185160298
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL);
159186160299
}
159187160300
break;
159188
- case 199: /* expr ::= expr IS NOT expr */
160301
+ case 200: /* expr ::= expr IS NOT expr */
159189160302
{
159190160303
yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202);
159191160304
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL);
159192160305
}
159193160306
break;
159194
- case 200: /* expr ::= NOT expr */
159195
- case 201: /* expr ::= BITNOT expr */ yytestcase(yyruleno==201);
160307
+ case 201: /* expr ::= NOT expr */
160308
+ case 202: /* expr ::= BITNOT expr */ yytestcase(yyruleno==202);
159196160309
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/}
159197160310
break;
159198
- case 202: /* expr ::= PLUS|MINUS expr */
160311
+ case 203: /* expr ::= PLUS|MINUS expr */
159199160312
{
159200160313
yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0);
159201160314
/*A-overwrites-B*/
159202160315
}
159203160316
break;
159204
- case 203: /* between_op ::= BETWEEN */
159205
- case 206: /* in_op ::= IN */ yytestcase(yyruleno==206);
160317
+ case 204: /* between_op ::= BETWEEN */
160318
+ case 207: /* in_op ::= IN */ yytestcase(yyruleno==207);
159206160319
{yymsp[0].minor.yy192 = 0;}
159207160320
break;
159208
- case 205: /* expr ::= expr between_op expr AND expr */
160321
+ case 206: /* expr ::= expr between_op expr AND expr */
159209160322
{
159210160323
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
159211160324
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
159212160325
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0);
159213160326
if( yymsp[-4].minor.yy202 ){
@@ -159216,11 +160329,11 @@
159216160329
sqlite3ExprListDelete(pParse->db, pList);
159217160330
}
159218160331
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159219160332
}
159220160333
break;
159221
- case 208: /* expr ::= expr in_op LP exprlist RP */
160334
+ case 209: /* expr ::= expr in_op LP exprlist RP */
159222160335
{
159223160336
if( yymsp[-1].minor.yy242==0 ){
159224160337
/* Expressions of the form
159225160338
**
159226160339
** expr1 IN ()
@@ -159248,41 +160361,41 @@
159248160361
}
159249160362
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159250160363
}
159251160364
}
159252160365
break;
159253
- case 209: /* expr ::= LP select RP */
160366
+ case 210: /* expr ::= LP select RP */
159254160367
{
159255160368
yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
159256160369
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539);
159257160370
}
159258160371
break;
159259
- case 210: /* expr ::= expr in_op LP select RP */
160372
+ case 211: /* expr ::= expr in_op LP select RP */
159260160373
{
159261160374
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
159262160375
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539);
159263160376
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159264160377
}
159265160378
break;
159266
- case 211: /* expr ::= expr in_op nm dbnm paren_exprlist */
160379
+ case 212: /* expr ::= expr in_op nm dbnm paren_exprlist */
159267160380
{
159268160381
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
159269160382
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
159270160383
if( yymsp[0].minor.yy242 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242);
159271160384
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
159272160385
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect);
159273160386
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159274160387
}
159275160388
break;
159276
- case 212: /* expr ::= EXISTS LP select RP */
160389
+ case 213: /* expr ::= EXISTS LP select RP */
159277160390
{
159278160391
Expr *p;
159279160392
p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
159280160393
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539);
159281160394
}
159282160395
break;
159283
- case 213: /* expr ::= CASE case_operand case_exprlist case_else END */
160396
+ case 214: /* expr ::= CASE case_operand case_exprlist case_else END */
159284160397
{
159285160398
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0);
159286160399
if( yymsp[-4].minor.yy202 ){
159287160400
yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242;
159288160401
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202);
@@ -159290,394 +160403,394 @@
159290160403
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242);
159291160404
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202);
159292160405
}
159293160406
}
159294160407
break;
159295
- case 214: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
160408
+ case 215: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
159296160409
{
159297160410
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
159298160411
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202);
159299160412
}
159300160413
break;
159301
- case 215: /* case_exprlist ::= WHEN expr THEN expr */
160414
+ case 216: /* case_exprlist ::= WHEN expr THEN expr */
159302160415
{
159303160416
yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
159304160417
yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202);
159305160418
}
159306160419
break;
159307
- case 218: /* case_operand ::= expr */
160420
+ case 219: /* case_operand ::= expr */
159308160421
{yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/}
159309160422
break;
159310
- case 221: /* nexprlist ::= nexprlist COMMA expr */
160423
+ case 222: /* nexprlist ::= nexprlist COMMA expr */
159311160424
{yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);}
159312160425
break;
159313
- case 222: /* nexprlist ::= expr */
160426
+ case 223: /* nexprlist ::= expr */
159314160427
{yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/}
159315160428
break;
159316
- case 224: /* paren_exprlist ::= LP exprlist RP */
159317
- case 229: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==229);
160429
+ case 225: /* paren_exprlist ::= LP exprlist RP */
160430
+ case 230: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==230);
159318160431
{yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242;}
159319160432
break;
159320
- case 225: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
160433
+ case 226: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159321160434
{
159322160435
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
159323160436
sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy242, yymsp[-10].minor.yy192,
159324160437
&yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF);
159325160438
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
159326160439
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
159327160440
}
159328160441
}
159329160442
break;
159330
- case 226: /* uniqueflag ::= UNIQUE */
159331
- case 268: /* raisetype ::= ABORT */ yytestcase(yyruleno==268);
160443
+ case 227: /* uniqueflag ::= UNIQUE */
160444
+ case 269: /* raisetype ::= ABORT */ yytestcase(yyruleno==269);
159332160445
{yymsp[0].minor.yy192 = OE_Abort;}
159333160446
break;
159334
- case 227: /* uniqueflag ::= */
160447
+ case 228: /* uniqueflag ::= */
159335160448
{yymsp[1].minor.yy192 = OE_None;}
159336160449
break;
159337
- case 230: /* eidlist ::= eidlist COMMA nm collate sortorder */
160450
+ case 231: /* eidlist ::= eidlist COMMA nm collate sortorder */
159338160451
{
159339160452
yymsp[-4].minor.yy242 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192);
159340160453
}
159341160454
break;
159342
- case 231: /* eidlist ::= nm collate sortorder */
160455
+ case 232: /* eidlist ::= nm collate sortorder */
159343160456
{
159344160457
yymsp[-2].minor.yy242 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); /*A-overwrites-Y*/
159345160458
}
159346160459
break;
159347
- case 234: /* cmd ::= DROP INDEX ifexists fullname */
160460
+ case 235: /* cmd ::= DROP INDEX ifexists fullname */
159348160461
{sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);}
159349160462
break;
159350
- case 235: /* cmd ::= VACUUM vinto */
160463
+ case 236: /* cmd ::= VACUUM vinto */
159351160464
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);}
159352160465
break;
159353
- case 236: /* cmd ::= VACUUM nm vinto */
160466
+ case 237: /* cmd ::= VACUUM nm vinto */
159354160467
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);}
159355160468
break;
159356
- case 239: /* cmd ::= PRAGMA nm dbnm */
160469
+ case 240: /* cmd ::= PRAGMA nm dbnm */
159357160470
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
159358160471
break;
159359
- case 240: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
160472
+ case 241: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
159360160473
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
159361160474
break;
159362
- case 241: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
160475
+ case 242: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
159363160476
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
159364160477
break;
159365
- case 242: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
160478
+ case 243: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
159366160479
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
159367160480
break;
159368
- case 243: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
160481
+ case 244: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
159369160482
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
159370160483
break;
159371
- case 246: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
160484
+ case 247: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159372160485
{
159373160486
Token all;
159374160487
all.z = yymsp[-3].minor.yy0.z;
159375160488
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
159376160489
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy447, &all);
159377160490
}
159378160491
break;
159379
- case 247: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
160492
+ case 248: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159380160493
{
159381160494
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192);
159382160495
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
159383160496
}
159384160497
break;
159385
- case 248: /* trigger_time ::= BEFORE|AFTER */
160498
+ case 249: /* trigger_time ::= BEFORE|AFTER */
159386160499
{ yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/ }
159387160500
break;
159388
- case 249: /* trigger_time ::= INSTEAD OF */
160501
+ case 250: /* trigger_time ::= INSTEAD OF */
159389160502
{ yymsp[-1].minor.yy192 = TK_INSTEAD;}
159390160503
break;
159391
- case 250: /* trigger_time ::= */
160504
+ case 251: /* trigger_time ::= */
159392160505
{ yymsp[1].minor.yy192 = TK_BEFORE; }
159393160506
break;
159394
- case 251: /* trigger_event ::= DELETE|INSERT */
159395
- case 252: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==252);
160507
+ case 252: /* trigger_event ::= DELETE|INSERT */
160508
+ case 253: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==253);
159396160509
{yymsp[0].minor.yy230.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy230.b = 0;}
159397160510
break;
159398
- case 253: /* trigger_event ::= UPDATE OF idlist */
160511
+ case 254: /* trigger_event ::= UPDATE OF idlist */
159399160512
{yymsp[-2].minor.yy230.a = TK_UPDATE; yymsp[-2].minor.yy230.b = yymsp[0].minor.yy600;}
159400160513
break;
159401
- case 254: /* when_clause ::= */
159402
- case 273: /* key_opt ::= */ yytestcase(yyruleno==273);
160514
+ case 255: /* when_clause ::= */
160515
+ case 274: /* key_opt ::= */ yytestcase(yyruleno==274);
159403160516
{ yymsp[1].minor.yy202 = 0; }
159404160517
break;
159405
- case 255: /* when_clause ::= WHEN expr */
159406
- case 274: /* key_opt ::= KEY expr */ yytestcase(yyruleno==274);
160518
+ case 256: /* when_clause ::= WHEN expr */
160519
+ case 275: /* key_opt ::= KEY expr */ yytestcase(yyruleno==275);
159407160520
{ yymsp[-1].minor.yy202 = yymsp[0].minor.yy202; }
159408160521
break;
159409
- case 256: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
160522
+ case 257: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159410160523
{
159411160524
assert( yymsp[-2].minor.yy447!=0 );
159412160525
yymsp[-2].minor.yy447->pLast->pNext = yymsp[-1].minor.yy447;
159413160526
yymsp[-2].minor.yy447->pLast = yymsp[-1].minor.yy447;
159414160527
}
159415160528
break;
159416
- case 257: /* trigger_cmd_list ::= trigger_cmd SEMI */
160529
+ case 258: /* trigger_cmd_list ::= trigger_cmd SEMI */
159417160530
{
159418160531
assert( yymsp[-1].minor.yy447!=0 );
159419160532
yymsp[-1].minor.yy447->pLast = yymsp[-1].minor.yy447;
159420160533
}
159421160534
break;
159422
- case 258: /* trnm ::= nm DOT nm */
160535
+ case 259: /* trnm ::= nm DOT nm */
159423160536
{
159424160537
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
159425160538
sqlite3ErrorMsg(pParse,
159426160539
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
159427160540
"statements within triggers");
159428160541
}
159429160542
break;
159430
- case 259: /* tridxby ::= INDEXED BY nm */
160543
+ case 260: /* tridxby ::= INDEXED BY nm */
159431160544
{
159432160545
sqlite3ErrorMsg(pParse,
159433160546
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
159434160547
"within triggers");
159435160548
}
159436160549
break;
159437
- case 260: /* tridxby ::= NOT INDEXED */
160550
+ case 261: /* tridxby ::= NOT INDEXED */
159438160551
{
159439160552
sqlite3ErrorMsg(pParse,
159440160553
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
159441160554
"within triggers");
159442160555
}
159443160556
break;
159444
- case 261: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
160557
+ case 262: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159445160558
{yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy47, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202, yymsp[-7].minor.yy192, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy436);}
159446160559
yymsp[-8].minor.yy447 = yylhsminor.yy447;
159447160560
break;
159448
- case 262: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
160561
+ case 263: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159449160562
{
159450160563
yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/
159451160564
}
159452160565
yymsp[-7].minor.yy447 = yylhsminor.yy447;
159453160566
break;
159454
- case 263: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
160567
+ case 264: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159455160568
{yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);}
159456160569
yymsp[-5].minor.yy447 = yylhsminor.yy447;
159457160570
break;
159458
- case 264: /* trigger_cmd ::= scanpt select scanpt */
160571
+ case 265: /* trigger_cmd ::= scanpt select scanpt */
159459160572
{yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/}
159460160573
yymsp[-2].minor.yy447 = yylhsminor.yy447;
159461160574
break;
159462
- case 265: /* expr ::= RAISE LP IGNORE RP */
160575
+ case 266: /* expr ::= RAISE LP IGNORE RP */
159463160576
{
159464160577
yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
159465160578
if( yymsp[-3].minor.yy202 ){
159466160579
yymsp[-3].minor.yy202->affExpr = OE_Ignore;
159467160580
}
159468160581
}
159469160582
break;
159470
- case 266: /* expr ::= RAISE LP raisetype COMMA nm RP */
160583
+ case 267: /* expr ::= RAISE LP raisetype COMMA nm RP */
159471160584
{
159472160585
yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
159473160586
if( yymsp[-5].minor.yy202 ) {
159474160587
yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192;
159475160588
}
159476160589
}
159477160590
break;
159478
- case 267: /* raisetype ::= ROLLBACK */
160591
+ case 268: /* raisetype ::= ROLLBACK */
159479160592
{yymsp[0].minor.yy192 = OE_Rollback;}
159480160593
break;
159481
- case 269: /* raisetype ::= FAIL */
160594
+ case 270: /* raisetype ::= FAIL */
159482160595
{yymsp[0].minor.yy192 = OE_Fail;}
159483160596
break;
159484
- case 270: /* cmd ::= DROP TRIGGER ifexists fullname */
160597
+ case 271: /* cmd ::= DROP TRIGGER ifexists fullname */
159485160598
{
159486160599
sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192);
159487160600
}
159488160601
break;
159489
- case 271: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
160602
+ case 272: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159490160603
{
159491160604
sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202);
159492160605
}
159493160606
break;
159494
- case 272: /* cmd ::= DETACH database_kw_opt expr */
160607
+ case 273: /* cmd ::= DETACH database_kw_opt expr */
159495160608
{
159496160609
sqlite3Detach(pParse, yymsp[0].minor.yy202);
159497160610
}
159498160611
break;
159499
- case 275: /* cmd ::= REINDEX */
160612
+ case 276: /* cmd ::= REINDEX */
159500160613
{sqlite3Reindex(pParse, 0, 0);}
159501160614
break;
159502
- case 276: /* cmd ::= REINDEX nm dbnm */
160615
+ case 277: /* cmd ::= REINDEX nm dbnm */
159503160616
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
159504160617
break;
159505
- case 277: /* cmd ::= ANALYZE */
160618
+ case 278: /* cmd ::= ANALYZE */
159506160619
{sqlite3Analyze(pParse, 0, 0);}
159507160620
break;
159508
- case 278: /* cmd ::= ANALYZE nm dbnm */
160621
+ case 279: /* cmd ::= ANALYZE nm dbnm */
159509160622
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
159510160623
break;
159511
- case 279: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
160624
+ case 280: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
159512160625
{
159513160626
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0);
159514160627
}
159515160628
break;
159516
- case 280: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
160629
+ case 281: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159517160630
{
159518160631
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
159519160632
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
159520160633
}
159521160634
break;
159522
- case 281: /* add_column_fullname ::= fullname */
160635
+ case 282: /* add_column_fullname ::= fullname */
159523160636
{
159524160637
disableLookaside(pParse);
159525160638
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47);
159526160639
}
159527160640
break;
159528
- case 282: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
160641
+ case 283: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159529160642
{
159530160643
sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
159531160644
}
159532160645
break;
159533
- case 283: /* cmd ::= create_vtab */
160646
+ case 284: /* cmd ::= create_vtab */
159534160647
{sqlite3VtabFinishParse(pParse,0);}
159535160648
break;
159536
- case 284: /* cmd ::= create_vtab LP vtabarglist RP */
160649
+ case 285: /* cmd ::= create_vtab LP vtabarglist RP */
159537160650
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
159538160651
break;
159539
- case 285: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
160652
+ case 286: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159540160653
{
159541160654
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy192);
159542160655
}
159543160656
break;
159544
- case 286: /* vtabarg ::= */
160657
+ case 287: /* vtabarg ::= */
159545160658
{sqlite3VtabArgInit(pParse);}
159546160659
break;
159547
- case 287: /* vtabargtoken ::= ANY */
159548
- case 288: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==288);
159549
- case 289: /* lp ::= LP */ yytestcase(yyruleno==289);
160660
+ case 288: /* vtabargtoken ::= ANY */
160661
+ case 289: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==289);
160662
+ case 290: /* lp ::= LP */ yytestcase(yyruleno==290);
159550160663
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
159551160664
break;
159552
- case 290: /* with ::= WITH wqlist */
159553
- case 291: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==291);
160665
+ case 291: /* with ::= WITH wqlist */
160666
+ case 292: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==292);
159554160667
{ sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); }
159555160668
break;
159556
- case 292: /* wqlist ::= nm eidlist_opt AS LP select RP */
160669
+ case 293: /* wqlist ::= nm eidlist_opt AS LP select RP */
159557160670
{
159558160671
yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/
159559160672
}
159560160673
break;
159561
- case 293: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
160674
+ case 294: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159562160675
{
159563160676
yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539);
159564160677
}
159565160678
break;
159566
- case 294: /* windowdefn_list ::= windowdefn */
160679
+ case 295: /* windowdefn_list ::= windowdefn */
159567160680
{ yylhsminor.yy303 = yymsp[0].minor.yy303; }
159568160681
yymsp[0].minor.yy303 = yylhsminor.yy303;
159569160682
break;
159570
- case 295: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
160683
+ case 296: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
159571160684
{
159572160685
assert( yymsp[0].minor.yy303!=0 );
159573160686
sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303);
159574160687
yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303;
159575160688
yylhsminor.yy303 = yymsp[0].minor.yy303;
159576160689
}
159577160690
yymsp[-2].minor.yy303 = yylhsminor.yy303;
159578160691
break;
159579
- case 296: /* windowdefn ::= nm AS LP window RP */
160692
+ case 297: /* windowdefn ::= nm AS LP window RP */
159580160693
{
159581160694
if( ALWAYS(yymsp[-1].minor.yy303) ){
159582160695
yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
159583160696
}
159584160697
yylhsminor.yy303 = yymsp[-1].minor.yy303;
159585160698
}
159586160699
yymsp[-4].minor.yy303 = yylhsminor.yy303;
159587160700
break;
159588
- case 297: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
160701
+ case 298: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159589160702
{
159590160703
yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0);
159591160704
}
159592160705
break;
159593
- case 298: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
160706
+ case 299: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159594160707
{
159595160708
yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0);
159596160709
}
159597160710
yymsp[-5].minor.yy303 = yylhsminor.yy303;
159598160711
break;
159599
- case 299: /* window ::= ORDER BY sortlist frame_opt */
160712
+ case 300: /* window ::= ORDER BY sortlist frame_opt */
159600160713
{
159601160714
yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0);
159602160715
}
159603160716
break;
159604
- case 300: /* window ::= nm ORDER BY sortlist frame_opt */
160717
+ case 301: /* window ::= nm ORDER BY sortlist frame_opt */
159605160718
{
159606160719
yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0);
159607160720
}
159608160721
yymsp[-4].minor.yy303 = yylhsminor.yy303;
159609160722
break;
159610
- case 301: /* window ::= frame_opt */
159611
- case 320: /* filter_over ::= over_clause */ yytestcase(yyruleno==320);
160723
+ case 302: /* window ::= frame_opt */
160724
+ case 321: /* filter_over ::= over_clause */ yytestcase(yyruleno==321);
159612160725
{
159613160726
yylhsminor.yy303 = yymsp[0].minor.yy303;
159614160727
}
159615160728
yymsp[0].minor.yy303 = yylhsminor.yy303;
159616160729
break;
159617
- case 302: /* window ::= nm frame_opt */
160730
+ case 303: /* window ::= nm frame_opt */
159618160731
{
159619160732
yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0);
159620160733
}
159621160734
yymsp[-1].minor.yy303 = yylhsminor.yy303;
159622160735
break;
159623
- case 303: /* frame_opt ::= */
160736
+ case 304: /* frame_opt ::= */
159624160737
{
159625160738
yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
159626160739
}
159627160740
break;
159628
- case 304: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
160741
+ case 305: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159629160742
{
159630160743
yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58);
159631160744
}
159632160745
yymsp[-2].minor.yy303 = yylhsminor.yy303;
159633160746
break;
159634
- case 305: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
160747
+ case 306: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159635160748
{
159636160749
yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58);
159637160750
}
159638160751
yymsp[-5].minor.yy303 = yylhsminor.yy303;
159639160752
break;
159640
- case 307: /* frame_bound_s ::= frame_bound */
159641
- case 309: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==309);
160753
+ case 308: /* frame_bound_s ::= frame_bound */
160754
+ case 310: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==310);
159642160755
{yylhsminor.yy77 = yymsp[0].minor.yy77;}
159643160756
yymsp[0].minor.yy77 = yylhsminor.yy77;
159644160757
break;
159645
- case 308: /* frame_bound_s ::= UNBOUNDED PRECEDING */
159646
- case 310: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==310);
159647
- case 312: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==312);
160758
+ case 309: /* frame_bound_s ::= UNBOUNDED PRECEDING */
160759
+ case 311: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==311);
160760
+ case 313: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==313);
159648160761
{yylhsminor.yy77.eType = yymsp[-1].major; yylhsminor.yy77.pExpr = 0;}
159649160762
yymsp[-1].minor.yy77 = yylhsminor.yy77;
159650160763
break;
159651
- case 311: /* frame_bound ::= expr PRECEDING|FOLLOWING */
160764
+ case 312: /* frame_bound ::= expr PRECEDING|FOLLOWING */
159652160765
{yylhsminor.yy77.eType = yymsp[0].major; yylhsminor.yy77.pExpr = yymsp[-1].minor.yy202;}
159653160766
yymsp[-1].minor.yy77 = yylhsminor.yy77;
159654160767
break;
159655
- case 313: /* frame_exclude_opt ::= */
160768
+ case 314: /* frame_exclude_opt ::= */
159656160769
{yymsp[1].minor.yy58 = 0;}
159657160770
break;
159658
- case 314: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
160771
+ case 315: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
159659160772
{yymsp[-1].minor.yy58 = yymsp[0].minor.yy58;}
159660160773
break;
159661
- case 315: /* frame_exclude ::= NO OTHERS */
159662
- case 316: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==316);
160774
+ case 316: /* frame_exclude ::= NO OTHERS */
160775
+ case 317: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==317);
159663160776
{yymsp[-1].minor.yy58 = yymsp[-1].major; /*A-overwrites-X*/}
159664160777
break;
159665
- case 317: /* frame_exclude ::= GROUP|TIES */
160778
+ case 318: /* frame_exclude ::= GROUP|TIES */
159666160779
{yymsp[0].minor.yy58 = yymsp[0].major; /*A-overwrites-X*/}
159667160780
break;
159668
- case 318: /* window_clause ::= WINDOW windowdefn_list */
160781
+ case 319: /* window_clause ::= WINDOW windowdefn_list */
159669160782
{ yymsp[-1].minor.yy303 = yymsp[0].minor.yy303; }
159670160783
break;
159671
- case 319: /* filter_over ::= filter_clause over_clause */
160784
+ case 320: /* filter_over ::= filter_clause over_clause */
159672160785
{
159673160786
yymsp[0].minor.yy303->pFilter = yymsp[-1].minor.yy202;
159674160787
yylhsminor.yy303 = yymsp[0].minor.yy303;
159675160788
}
159676160789
yymsp[-1].minor.yy303 = yylhsminor.yy303;
159677160790
break;
159678
- case 321: /* filter_over ::= filter_clause */
160791
+ case 322: /* filter_over ::= filter_clause */
159679160792
{
159680160793
yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
159681160794
if( yylhsminor.yy303 ){
159682160795
yylhsminor.yy303->eFrmType = TK_FILTER;
159683160796
yylhsminor.yy303->pFilter = yymsp[0].minor.yy202;
@@ -159685,88 +160798,88 @@
159685160798
sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202);
159686160799
}
159687160800
}
159688160801
yymsp[0].minor.yy303 = yylhsminor.yy303;
159689160802
break;
159690
- case 322: /* over_clause ::= OVER LP window RP */
160803
+ case 323: /* over_clause ::= OVER LP window RP */
159691160804
{
159692160805
yymsp[-3].minor.yy303 = yymsp[-1].minor.yy303;
159693160806
assert( yymsp[-3].minor.yy303!=0 );
159694160807
}
159695160808
break;
159696
- case 323: /* over_clause ::= OVER nm */
160809
+ case 324: /* over_clause ::= OVER nm */
159697160810
{
159698160811
yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
159699160812
if( yymsp[-1].minor.yy303 ){
159700160813
yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
159701160814
}
159702160815
}
159703160816
break;
159704
- case 324: /* filter_clause ::= FILTER LP WHERE expr RP */
160817
+ case 325: /* filter_clause ::= FILTER LP WHERE expr RP */
159705160818
{ yymsp[-4].minor.yy202 = yymsp[-1].minor.yy202; }
159706160819
break;
159707160820
default:
159708
- /* (325) input ::= cmdlist */ yytestcase(yyruleno==325);
159709
- /* (326) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==326);
159710
- /* (327) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=327);
159711
- /* (328) ecmd ::= SEMI */ yytestcase(yyruleno==328);
159712
- /* (329) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==329);
159713
- /* (330) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=330);
159714
- /* (331) trans_opt ::= */ yytestcase(yyruleno==331);
159715
- /* (332) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==332);
159716
- /* (333) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==333);
159717
- /* (334) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==334);
159718
- /* (335) savepoint_opt ::= */ yytestcase(yyruleno==335);
159719
- /* (336) cmd ::= create_table create_table_args */ yytestcase(yyruleno==336);
159720
- /* (337) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==337);
159721
- /* (338) columnlist ::= columnname carglist */ yytestcase(yyruleno==338);
159722
- /* (339) nm ::= ID|INDEXED */ yytestcase(yyruleno==339);
159723
- /* (340) nm ::= STRING */ yytestcase(yyruleno==340);
159724
- /* (341) nm ::= JOIN_KW */ yytestcase(yyruleno==341);
159725
- /* (342) typetoken ::= typename */ yytestcase(yyruleno==342);
159726
- /* (343) typename ::= ID|STRING */ yytestcase(yyruleno==343);
159727
- /* (344) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=344);
159728
- /* (345) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
159729
- /* (346) carglist ::= carglist ccons */ yytestcase(yyruleno==346);
159730
- /* (347) carglist ::= */ yytestcase(yyruleno==347);
159731
- /* (348) ccons ::= NULL onconf */ yytestcase(yyruleno==348);
159732
- /* (349) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==349);
159733
- /* (350) ccons ::= AS generated */ yytestcase(yyruleno==350);
159734
- /* (351) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==351);
159735
- /* (352) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==352);
159736
- /* (353) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=353);
159737
- /* (354) tconscomma ::= */ yytestcase(yyruleno==354);
159738
- /* (355) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=355);
159739
- /* (356) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=356);
159740
- /* (357) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=357);
159741
- /* (358) oneselect ::= values */ yytestcase(yyruleno==358);
159742
- /* (359) sclp ::= selcollist COMMA */ yytestcase(yyruleno==359);
159743
- /* (360) as ::= ID|STRING */ yytestcase(yyruleno==360);
159744
- /* (361) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=361);
159745
- /* (362) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==362);
159746
- /* (363) exprlist ::= nexprlist */ yytestcase(yyruleno==363);
159747
- /* (364) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=364);
159748
- /* (365) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=365);
159749
- /* (366) nmnum ::= ON */ yytestcase(yyruleno==366);
159750
- /* (367) nmnum ::= DELETE */ yytestcase(yyruleno==367);
159751
- /* (368) nmnum ::= DEFAULT */ yytestcase(yyruleno==368);
159752
- /* (369) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==369);
159753
- /* (370) foreach_clause ::= */ yytestcase(yyruleno==370);
159754
- /* (371) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==371);
159755
- /* (372) trnm ::= nm */ yytestcase(yyruleno==372);
159756
- /* (373) tridxby ::= */ yytestcase(yyruleno==373);
159757
- /* (374) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==374);
159758
- /* (375) database_kw_opt ::= */ yytestcase(yyruleno==375);
159759
- /* (376) kwcolumn_opt ::= */ yytestcase(yyruleno==376);
159760
- /* (377) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==377);
159761
- /* (378) vtabarglist ::= vtabarg */ yytestcase(yyruleno==378);
159762
- /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==379);
159763
- /* (380) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==380);
159764
- /* (381) anylist ::= */ yytestcase(yyruleno==381);
159765
- /* (382) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==382);
159766
- /* (383) anylist ::= anylist ANY */ yytestcase(yyruleno==383);
159767
- /* (384) with ::= */ yytestcase(yyruleno==384);
160821
+ /* (326) input ::= cmdlist */ yytestcase(yyruleno==326);
160822
+ /* (327) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==327);
160823
+ /* (328) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=328);
160824
+ /* (329) ecmd ::= SEMI */ yytestcase(yyruleno==329);
160825
+ /* (330) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==330);
160826
+ /* (331) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=331);
160827
+ /* (332) trans_opt ::= */ yytestcase(yyruleno==332);
160828
+ /* (333) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==333);
160829
+ /* (334) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==334);
160830
+ /* (335) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==335);
160831
+ /* (336) savepoint_opt ::= */ yytestcase(yyruleno==336);
160832
+ /* (337) cmd ::= create_table create_table_args */ yytestcase(yyruleno==337);
160833
+ /* (338) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==338);
160834
+ /* (339) columnlist ::= columnname carglist */ yytestcase(yyruleno==339);
160835
+ /* (340) nm ::= ID|INDEXED */ yytestcase(yyruleno==340);
160836
+ /* (341) nm ::= STRING */ yytestcase(yyruleno==341);
160837
+ /* (342) nm ::= JOIN_KW */ yytestcase(yyruleno==342);
160838
+ /* (343) typetoken ::= typename */ yytestcase(yyruleno==343);
160839
+ /* (344) typename ::= ID|STRING */ yytestcase(yyruleno==344);
160840
+ /* (345) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
160841
+ /* (346) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=346);
160842
+ /* (347) carglist ::= carglist ccons */ yytestcase(yyruleno==347);
160843
+ /* (348) carglist ::= */ yytestcase(yyruleno==348);
160844
+ /* (349) ccons ::= NULL onconf */ yytestcase(yyruleno==349);
160845
+ /* (350) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==350);
160846
+ /* (351) ccons ::= AS generated */ yytestcase(yyruleno==351);
160847
+ /* (352) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==352);
160848
+ /* (353) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==353);
160849
+ /* (354) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=354);
160850
+ /* (355) tconscomma ::= */ yytestcase(yyruleno==355);
160851
+ /* (356) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=356);
160852
+ /* (357) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=357);
160853
+ /* (358) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=358);
160854
+ /* (359) oneselect ::= values */ yytestcase(yyruleno==359);
160855
+ /* (360) sclp ::= selcollist COMMA */ yytestcase(yyruleno==360);
160856
+ /* (361) as ::= ID|STRING */ yytestcase(yyruleno==361);
160857
+ /* (362) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=362);
160858
+ /* (363) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==363);
160859
+ /* (364) exprlist ::= nexprlist */ yytestcase(yyruleno==364);
160860
+ /* (365) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=365);
160861
+ /* (366) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=366);
160862
+ /* (367) nmnum ::= ON */ yytestcase(yyruleno==367);
160863
+ /* (368) nmnum ::= DELETE */ yytestcase(yyruleno==368);
160864
+ /* (369) nmnum ::= DEFAULT */ yytestcase(yyruleno==369);
160865
+ /* (370) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==370);
160866
+ /* (371) foreach_clause ::= */ yytestcase(yyruleno==371);
160867
+ /* (372) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==372);
160868
+ /* (373) trnm ::= nm */ yytestcase(yyruleno==373);
160869
+ /* (374) tridxby ::= */ yytestcase(yyruleno==374);
160870
+ /* (375) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==375);
160871
+ /* (376) database_kw_opt ::= */ yytestcase(yyruleno==376);
160872
+ /* (377) kwcolumn_opt ::= */ yytestcase(yyruleno==377);
160873
+ /* (378) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==378);
160874
+ /* (379) vtabarglist ::= vtabarg */ yytestcase(yyruleno==379);
160875
+ /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==380);
160876
+ /* (381) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==381);
160877
+ /* (382) anylist ::= */ yytestcase(yyruleno==382);
160878
+ /* (383) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==383);
160879
+ /* (384) anylist ::= anylist ANY */ yytestcase(yyruleno==384);
160880
+ /* (385) with ::= */ yytestcase(yyruleno==385);
159768160881
break;
159769160882
/********** End reduce actions ************************************************/
159770160883
};
159771160884
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
159772160885
yygoto = yyRuleInfoLhs[yyruleno];
@@ -159914,16 +161027,60 @@
159914161027
yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
159915161028
}
159916161029
}
159917161030
#endif
159918161031
159919
- do{
161032
+ while(1){ /* Exit by "break" */
161033
+ assert( yypParser->yytos>=yypParser->yystack );
159920161034
assert( yyact==yypParser->yytos->stateno );
159921161035
yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
159922161036
if( yyact >= YY_MIN_REDUCE ){
159923
- yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
159924
- yyminor sqlite3ParserCTX_PARAM);
161037
+ unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
161038
+ assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
161039
+#ifndef NDEBUG
161040
+ if( yyTraceFILE ){
161041
+ int yysize = yyRuleInfoNRhs[yyruleno];
161042
+ if( yysize ){
161043
+ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
161044
+ yyTracePrompt,
161045
+ yyruleno, yyRuleName[yyruleno],
161046
+ yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
161047
+ yypParser->yytos[yysize].stateno);
161048
+ }else{
161049
+ fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
161050
+ yyTracePrompt, yyruleno, yyRuleName[yyruleno],
161051
+ yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
161052
+ }
161053
+ }
161054
+#endif /* NDEBUG */
161055
+
161056
+ /* Check that the stack is large enough to grow by a single entry
161057
+ ** if the RHS of the rule is empty. This ensures that there is room
161058
+ ** enough on the stack to push the LHS value */
161059
+ if( yyRuleInfoNRhs[yyruleno]==0 ){
161060
+#ifdef YYTRACKMAXSTACKDEPTH
161061
+ if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
161062
+ yypParser->yyhwm++;
161063
+ assert( yypParser->yyhwm ==
161064
+ (int)(yypParser->yytos - yypParser->yystack));
161065
+ }
161066
+#endif
161067
+#if YYSTACKDEPTH>0
161068
+ if( yypParser->yytos>=yypParser->yystackEnd ){
161069
+ yyStackOverflow(yypParser);
161070
+ break;
161071
+ }
161072
+#else
161073
+ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
161074
+ if( yyGrowStack(yypParser) ){
161075
+ yyStackOverflow(yypParser);
161076
+ break;
161077
+ }
161078
+ }
161079
+#endif
161080
+ }
161081
+ yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor sqlite3ParserCTX_PARAM);
159925161082
}else if( yyact <= YY_MAX_SHIFTREDUCE ){
159926161083
yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
159927161084
#ifndef YYNOERRORRECOVERY
159928161085
yypParser->yyerrcnt--;
159929161086
#endif
@@ -160032,11 +161189,11 @@
160032161189
#endif
160033161190
}
160034161191
break;
160035161192
#endif
160036161193
}
160037
- }while( yypParser->yytos>yypParser->yystack );
161194
+ }
160038161195
#ifndef NDEBUG
160039161196
if( yyTraceFILE ){
160040161197
yyStackEntry *i;
160041161198
char cDiv = '[';
160042161199
fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
@@ -160093,12 +161250,12 @@
160093161250
** The lookup table is much faster. To maximize speed, and to ensure that
160094161251
** a lookup table is used, all of the classes need to be small integers and
160095161252
** all of them need to be used within the switch.
160096161253
*/
160097161254
#define CC_X 0 /* The letter 'x', or start of BLOB literal */
160098
-#define CC_KYWD 1 /* Alphabetics or '_'. Usable in a keyword */
160099
-#define CC_ID 2 /* unicode characters usable in IDs */
161255
+#define CC_KYWD0 1 /* First letter of a keyword */
161256
+#define CC_KYWD 2 /* Alphabetics or '_'. Usable in a keyword */
160100161257
#define CC_DIGIT 3 /* Digits */
160101161258
#define CC_DOLLAR 4 /* '$' */
160102161259
#define CC_VARALPHA 5 /* '@', '#', ':'. Alphabetic SQL variables */
160103161260
#define CC_VARNUM 6 /* '?'. Numeric SQL variables */
160104161261
#define CC_SPACE 7 /* Space characters */
@@ -160119,24 +161276,25 @@
160119161276
#define CC_PERCENT 22 /* '%' */
160120161277
#define CC_COMMA 23 /* ',' */
160121161278
#define CC_AND 24 /* '&' */
160122161279
#define CC_TILDA 25 /* '~' */
160123161280
#define CC_DOT 26 /* '.' */
160124
-#define CC_ILLEGAL 27 /* Illegal character */
160125
-#define CC_NUL 28 /* 0x00 */
161281
+#define CC_ID 27 /* unicode characters usable in IDs */
161282
+#define CC_ILLEGAL 28 /* Illegal character */
161283
+#define CC_NUL 29 /* 0x00 */
160126161284
160127161285
static const unsigned char aiClass[] = {
160128161286
#ifdef SQLITE_ASCII
160129161287
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
160130
-/* 0x */ 28, 27, 27, 27, 27, 27, 27, 27, 27, 7, 7, 27, 7, 7, 27, 27,
160131
-/* 1x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
161288
+/* 0x */ 29, 28, 28, 28, 28, 28, 28, 28, 28, 7, 7, 28, 7, 7, 28, 28,
161289
+/* 1x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
160132161290
/* 2x */ 7, 15, 8, 5, 4, 22, 24, 8, 17, 18, 21, 20, 23, 11, 26, 16,
160133161291
/* 3x */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 19, 12, 14, 13, 6,
160134161292
/* 4x */ 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
160135
-/* 5x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 9, 27, 27, 27, 1,
161293
+/* 5x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 9, 28, 28, 28, 2,
160136161294
/* 6x */ 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
160137
-/* 7x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 27, 10, 27, 25, 27,
161295
+/* 7x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 28, 10, 28, 25, 28,
160138161296
/* 8x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160139161297
/* 9x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160140161298
/* Ax */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160141161299
/* Bx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160142161300
/* Cx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -160144,26 +161302,26 @@
160144161302
/* Ex */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160145161303
/* Fx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
160146161304
#endif
160147161305
#ifdef SQLITE_EBCDIC
160148161306
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
160149
-/* 0x */ 27, 27, 27, 27, 27, 7, 27, 27, 27, 27, 27, 27, 7, 7, 27, 27,
160150
-/* 1x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
160151
-/* 2x */ 27, 27, 27, 27, 27, 7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
160152
-/* 3x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
160153
-/* 4x */ 7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 12, 17, 20, 10,
160154
-/* 5x */ 24, 27, 27, 27, 27, 27, 27, 27, 27, 27, 15, 4, 21, 18, 19, 27,
160155
-/* 6x */ 11, 16, 27, 27, 27, 27, 27, 27, 27, 27, 27, 23, 22, 1, 13, 6,
160156
-/* 7x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 8, 5, 5, 5, 8, 14, 8,
160157
-/* 8x */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160158
-/* 9x */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160159
-/* Ax */ 27, 25, 1, 1, 1, 1, 1, 0, 1, 1, 27, 27, 27, 27, 27, 27,
160160
-/* Bx */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 9, 27, 27, 27, 27, 27,
160161
-/* Cx */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160162
-/* Dx */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160163
-/* Ex */ 27, 27, 1, 1, 1, 1, 1, 0, 1, 1, 27, 27, 27, 27, 27, 27,
160164
-/* Fx */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 27, 27, 27, 27, 27, 27,
161307
+/* 0x */ 29, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 7, 7, 28, 28,
161308
+/* 1x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
161309
+/* 2x */ 28, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
161310
+/* 3x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
161311
+/* 4x */ 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 26, 12, 17, 20, 10,
161312
+/* 5x */ 24, 28, 28, 28, 28, 28, 28, 28, 28, 28, 15, 4, 21, 18, 19, 28,
161313
+/* 6x */ 11, 16, 28, 28, 28, 28, 28, 28, 28, 28, 28, 23, 22, 2, 13, 6,
161314
+/* 7x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 8, 5, 5, 5, 8, 14, 8,
161315
+/* 8x */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161316
+/* 9x */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161317
+/* Ax */ 28, 25, 1, 1, 1, 1, 1, 0, 2, 2, 28, 28, 28, 28, 28, 28,
161318
+/* Bx */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 9, 28, 28, 28, 28, 28,
161319
+/* Cx */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161320
+/* Dx */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161321
+/* Ex */ 28, 28, 1, 1, 1, 1, 1, 0, 2, 2, 28, 28, 28, 28, 28, 28,
161322
+/* Fx */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 28, 28, 28, 28, 28, 28,
160165161323
#endif
160166161324
};
160167161325
160168161326
/*
160169161327
** The charMap() macro maps alphabetic characters (only) into their
@@ -160504,11 +161662,11 @@
160504161662
** return the integer n (the length of the token). */
160505161663
static int keywordCode(const char *z, int n, int *pType){
160506161664
int i, j;
160507161665
const char *zKW;
160508161666
if( n>=2 ){
160509
- i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;
161667
+ i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
160510161668
for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
160511161669
if( aKWLen[i]!=n ) continue;
160512161670
zKW = &zKWText[aKWOffset[i]];
160513161671
#ifdef SQLITE_ASCII
160514161672
if( (z[0]&~0x20)!=zKW[0] ) continue;
@@ -161046,11 +162204,11 @@
161046162204
}
161047162205
}
161048162206
if( n==0 ) *tokenType = TK_ILLEGAL;
161049162207
return i;
161050162208
}
161051
- case CC_KYWD: {
162209
+ case CC_KYWD0: {
161052162210
for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}
161053162211
if( IdChar(z[i]) ){
161054162212
/* This token started out using characters that can appear in keywords,
161055162213
** but z[i] is a character not allowed within keywords, so this must
161056162214
** be an identifier instead */
@@ -161076,10 +162234,11 @@
161076162234
#endif
161077162235
/* If it is not a BLOB literal, then it must be an ID, since no
161078162236
** SQL keywords start with the letter 'x'. Fall through */
161079162237
/* no break */ deliberate_fall_through
161080162238
}
162239
+ case CC_KYWD:
161081162240
case CC_ID: {
161082162241
i = 1;
161083162242
break;
161084162243
}
161085162244
case CC_NUL: {
@@ -161258,23 +162417,11 @@
161258162417
sqlite3DeleteTable(db, pParse->pNewTable);
161259162418
}
161260162419
if( !IN_RENAME_OBJECT ){
161261162420
sqlite3DeleteTrigger(db, pParse->pNewTrigger);
161262162421
}
161263
-
161264
- if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree);
161265162422
sqlite3DbFree(db, pParse->pVList);
161266
- while( pParse->pAinc ){
161267
- AutoincInfo *p = pParse->pAinc;
161268
- pParse->pAinc = p->pNext;
161269
- sqlite3DbFreeNN(db, p);
161270
- }
161271
- while( pParse->pZombieTab ){
161272
- Table *p = pParse->pZombieTab;
161273
- pParse->pZombieTab = p->pNextZombie;
161274
- sqlite3DeleteTable(db, p);
161275
- }
161276162423
db->pParse = pParse->pParentParse;
161277162424
pParse->pParentParse = 0;
161278162425
assert( nErr==0 || pParse->rc!=SQLITE_OK );
161279162426
return nErr;
161280162427
}
@@ -165883,11 +167030,11 @@
165883167030
** with various optimizations disabled to verify that the same answer
165884167031
** is obtained in every case.
165885167032
*/
165886167033
case SQLITE_TESTCTRL_OPTIMIZATIONS: {
165887167034
sqlite3 *db = va_arg(ap, sqlite3*);
165888
- db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
167035
+ db->dbOptFlags = va_arg(ap, u32);
165889167036
break;
165890167037
}
165891167038
165892167039
/* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
165893167040
**
@@ -166058,11 +167205,30 @@
166058167205
*pn = sqlite3BtreeSeekCount(db->aDb->pBt);
166059167206
(void)db; /* Silence harmless unused variable warning */
166060167207
break;
166061167208
}
166062167209
166063
-
167210
+ /* sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr)
167211
+ **
167212
+ ** "ptr" is a pointer to a u32.
167213
+ **
167214
+ ** op==0 Store the current sqlite3SelectTrace in *ptr
167215
+ ** op==1 Set sqlite3SelectTrace to the value *ptr
167216
+ ** op==3 Store the current sqlite3WhereTrace in *ptr
167217
+ ** op==3 Set sqlite3WhereTrace to the value *ptr
167218
+ */
167219
+ case SQLITE_TESTCTRL_TRACEFLAGS: {
167220
+ int opTrace = va_arg(ap, int);
167221
+ u32 *ptr = va_arg(ap, u32*);
167222
+ switch( opTrace ){
167223
+ case 0: *ptr = sqlite3SelectTrace; break;
167224
+ case 1: sqlite3SelectTrace = *ptr; break;
167225
+ case 2: *ptr = sqlite3WhereTrace; break;
167226
+ case 3: sqlite3WhereTrace = *ptr; break;
167227
+ }
167228
+ break;
167229
+ }
166064167230
}
166065167231
va_end(ap);
166066167232
#endif /* SQLITE_UNTESTABLE */
166067167233
return rc;
166068167234
}
@@ -203337,10 +204503,11 @@
203337204503
int bIndirect; /* True if all changes are indirect */
203338204504
int bAutoAttach; /* True to auto-attach tables */
203339204505
int rc; /* Non-zero if an error has occurred */
203340204506
void *pFilterCtx; /* First argument to pass to xTableFilter */
203341204507
int (*xTableFilter)(void *pCtx, const char *zTab);
204508
+ i64 nMalloc; /* Number of bytes of data allocated */
203342204509
sqlite3_value *pZeroBlob; /* Value containing X'' */
203343204510
sqlite3_session *pNext; /* Next session object on same db. */
203344204511
SessionTable *pTable; /* List of attached tables */
203345204512
SessionHook hook; /* APIs to grab new and old data with */
203346204513
};
@@ -203720,10 +204887,30 @@
203720204887
203721204888
if( pnWrite ) *pnWrite += nByte;
203722204889
return SQLITE_OK;
203723204890
}
203724204891
204892
+/*
204893
+** Allocate and return a pointer to a buffer nByte bytes in size. If
204894
+** pSession is not NULL, increase the sqlite3_session.nMalloc variable
204895
+** by the number of bytes allocated.
204896
+*/
204897
+static void *sessionMalloc64(sqlite3_session *pSession, i64 nByte){
204898
+ void *pRet = sqlite3_malloc64(nByte);
204899
+ if( pSession ) pSession->nMalloc += sqlite3_msize(pRet);
204900
+ return pRet;
204901
+}
204902
+
204903
+/*
204904
+** Free buffer pFree, which must have been allocated by an earlier
204905
+** call to sessionMalloc64(). If pSession is not NULL, decrease the
204906
+** sqlite3_session.nMalloc counter by the number of bytes freed.
204907
+*/
204908
+static void sessionFree(sqlite3_session *pSession, void *pFree){
204909
+ if( pSession ) pSession->nMalloc -= sqlite3_msize(pFree);
204910
+ sqlite3_free(pFree);
204911
+}
203725204912
203726204913
/*
203727204914
** This macro is used to calculate hash key values for data structures. In
203728204915
** order to use this macro, the entire data structure must be represented
203729204916
** as a series of unsigned integers. In order to calculate a hash-key value
@@ -204187,17 +205374,23 @@
204187205374
** It is possible that a non-fatal OOM error occurs in this function. In
204188205375
** that case the hash-table does not grow, but SQLITE_OK is returned anyway.
204189205376
** Growing the hash table in this case is a performance optimization only,
204190205377
** it is not required for correct operation.
204191205378
*/
204192
-static int sessionGrowHash(int bPatchset, SessionTable *pTab){
205379
+static int sessionGrowHash(
205380
+ sqlite3_session *pSession, /* For memory accounting. May be NULL */
205381
+ int bPatchset,
205382
+ SessionTable *pTab
205383
+){
204193205384
if( pTab->nChange==0 || pTab->nEntry>=(pTab->nChange/2) ){
204194205385
int i;
204195205386
SessionChange **apNew;
204196205387
sqlite3_int64 nNew = 2*(sqlite3_int64)(pTab->nChange ? pTab->nChange : 128);
204197205388
204198
- apNew = (SessionChange **)sqlite3_malloc64(sizeof(SessionChange *) * nNew);
205389
+ apNew = (SessionChange**)sessionMalloc64(
205390
+ pSession, sizeof(SessionChange*) * nNew
205391
+ );
204199205392
if( apNew==0 ){
204200205393
if( pTab->nChange==0 ){
204201205394
return SQLITE_ERROR;
204202205395
}
204203205396
return SQLITE_OK;
@@ -204214,11 +205407,11 @@
204214205407
p->pNext = apNew[iHash];
204215205408
apNew[iHash] = p;
204216205409
}
204217205410
}
204218205411
204219
- sqlite3_free(pTab->apChange);
205412
+ sessionFree(pSession, pTab->apChange);
204220205413
pTab->nChange = nNew;
204221205414
pTab->apChange = apNew;
204222205415
}
204223205416
204224205417
return SQLITE_OK;
@@ -204248,10 +205441,11 @@
204248205441
**
204249205442
** All returned buffers are part of the same single allocation, which must
204250205443
** be freed using sqlite3_free() by the caller
204251205444
*/
204252205445
static int sessionTableInfo(
205446
+ sqlite3_session *pSession, /* For memory accounting. May be NULL */
204253205447
sqlite3 *db, /* Database connection */
204254205448
const char *zDb, /* Name of attached database (e.g. "main") */
204255205449
const char *zThis, /* Table name */
204256205450
int *pnCol, /* OUT: number of columns */
204257205451
const char **pzTab, /* OUT: Copy of zThis */
@@ -204302,11 +205496,11 @@
204302205496
}
204303205497
rc = sqlite3_reset(pStmt);
204304205498
204305205499
if( rc==SQLITE_OK ){
204306205500
nByte += nDbCol * (sizeof(const char *) + sizeof(u8) + 1);
204307
- pAlloc = sqlite3_malloc64(nByte);
205501
+ pAlloc = sessionMalloc64(pSession, nByte);
204308205502
if( pAlloc==0 ){
204309205503
rc = SQLITE_NOMEM;
204310205504
}
204311205505
}
204312205506
if( rc==SQLITE_OK ){
@@ -204345,11 +205539,11 @@
204345205539
}else{
204346205540
*pazCol = 0;
204347205541
*pabPK = 0;
204348205542
*pnCol = 0;
204349205543
if( pzTab ) *pzTab = 0;
204350
- sqlite3_free(azCol);
205544
+ sessionFree(pSession, azCol);
204351205545
}
204352205546
sqlite3_finalize(pStmt);
204353205547
return rc;
204354205548
}
204355205549
@@ -204367,11 +205561,11 @@
204367205561
*/
204368205562
static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){
204369205563
if( pTab->nCol==0 ){
204370205564
u8 *abPK;
204371205565
assert( pTab->azCol==0 || pTab->abPK==0 );
204372
- pSession->rc = sessionTableInfo(pSession->db, pSession->zDb,
205566
+ pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb,
204373205567
pTab->zName, &pTab->nCol, 0, &pTab->azCol, &abPK
204374205568
);
204375205569
if( pSession->rc==SQLITE_OK ){
204376205570
int i;
204377205571
for(i=0; i<pTab->nCol; i++){
@@ -204458,11 +205652,11 @@
204458205652
pSession->rc = SQLITE_SCHEMA;
204459205653
return;
204460205654
}
204461205655
204462205656
/* Grow the hash table if required */
204463
- if( sessionGrowHash(0, pTab) ){
205657
+ if( sessionGrowHash(pSession, 0, pTab) ){
204464205658
pSession->rc = SQLITE_NOMEM;
204465205659
return;
204466205660
}
204467205661
204468205662
if( pTab->bStat1 ){
@@ -204525,11 +205719,11 @@
204525205719
rc = sessionSerializeValue(0, p, &nByte);
204526205720
if( rc!=SQLITE_OK ) goto error_out;
204527205721
}
204528205722
204529205723
/* Allocate the change object */
204530
- pChange = (SessionChange *)sqlite3_malloc64(nByte);
205724
+ pChange = (SessionChange *)sessionMalloc64(pSession, nByte);
204531205725
if( !pChange ){
204532205726
rc = SQLITE_NOMEM;
204533205727
goto error_out;
204534205728
}else{
204535205729
memset(pChange, 0, sizeof(SessionChange));
@@ -204898,11 +206092,11 @@
204898206092
int bHasPk = 0;
204899206093
int bMismatch = 0;
204900206094
int nCol; /* Columns in zFrom.zTbl */
204901206095
u8 *abPK;
204902206096
const char **azCol = 0;
204903
- rc = sessionTableInfo(db, zFrom, zTbl, &nCol, 0, &azCol, &abPK);
206097
+ rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, &abPK);
204904206098
if( rc==SQLITE_OK ){
204905206099
if( pTo->nCol!=nCol ){
204906206100
bMismatch = 1;
204907206101
}else{
204908206102
int i;
@@ -204996,11 +206190,11 @@
204996206190
204997206191
/*
204998206192
** Free the list of table objects passed as the first argument. The contents
204999206193
** of the changed-rows hash tables are also deleted.
205000206194
*/
205001
-static void sessionDeleteTable(SessionTable *pList){
206195
+static void sessionDeleteTable(sqlite3_session *pSession, SessionTable *pList){
205002206196
SessionTable *pNext;
205003206197
SessionTable *pTab;
205004206198
205005206199
for(pTab=pList; pTab; pTab=pNext){
205006206200
int i;
@@ -205008,16 +206202,16 @@
205008206202
for(i=0; i<pTab->nChange; i++){
205009206203
SessionChange *p;
205010206204
SessionChange *pNextChange;
205011206205
for(p=pTab->apChange[i]; p; p=pNextChange){
205012206206
pNextChange = p->pNext;
205013
- sqlite3_free(p);
206207
+ sessionFree(pSession, p);
205014206208
}
205015206209
}
205016
- sqlite3_free((char*)pTab->azCol); /* cast works around VC++ bug */
205017
- sqlite3_free(pTab->apChange);
205018
- sqlite3_free(pTab);
206210
+ sessionFree(pSession, (char*)pTab->azCol); /* cast works around VC++ bug */
206211
+ sessionFree(pSession, pTab->apChange);
206212
+ sessionFree(pSession, pTab);
205019206213
}
205020206214
}
205021206215
205022206216
/*
205023206217
** Delete a session object previously allocated using sqlite3session_create().
@@ -205041,13 +206235,15 @@
205041206235
sqlite3_mutex_leave(sqlite3_db_mutex(db));
205042206236
sqlite3ValueFree(pSession->pZeroBlob);
205043206237
205044206238
/* Delete all attached table objects. And the contents of their
205045206239
** associated hash-tables. */
205046
- sessionDeleteTable(pSession->pTable);
206240
+ sessionDeleteTable(pSession, pSession->pTable);
205047206241
205048
- /* Free the session object itself. */
206242
+ /* Assert that all allocations have been freed and then free the
206243
+ ** session object itself. */
206244
+ assert( pSession->nMalloc==0 );
205049206245
sqlite3_free(pSession);
205050206246
}
205051206247
205052206248
/*
205053206249
** Set a table filter on a Session Object.
@@ -205090,11 +206286,12 @@
205090206286
if( 0==sqlite3_strnicmp(pTab->zName, zName, nName+1) ) break;
205091206287
}
205092206288
205093206289
if( !pTab ){
205094206290
/* Allocate new SessionTable object. */
205095
- pTab = (SessionTable *)sqlite3_malloc64(sizeof(SessionTable) + nName + 1);
206291
+ int nByte = sizeof(SessionTable) + nName + 1;
206292
+ pTab = (SessionTable*)sessionMalloc64(pSession, nByte);
205096206293
if( !pTab ){
205097206294
rc = SQLITE_NOMEM;
205098206295
}else{
205099206296
/* Populate the new SessionTable object and link it into the list.
205100206297
** The new object must be linked onto the end of the list, not
@@ -205687,11 +206884,11 @@
205687206884
sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */
205688206885
int nRewind = buf.nBuf; /* Initial size of write buffer */
205689206886
int nNoop; /* Size of buffer after writing tbl header */
205690206887
205691206888
/* Check the table schema is still Ok. */
205692
- rc = sessionTableInfo(db, pSession->zDb, zName, &nCol, 0, &azCol, &abPK);
206889
+ rc = sessionTableInfo(0, db, pSession->zDb, zName, &nCol, 0,&azCol,&abPK);
205693206890
if( !rc && (pTab->nCol!=nCol || memcmp(abPK, pTab->abPK, nCol)) ){
205694206891
rc = SQLITE_SCHEMA;
205695206892
}
205696206893
205697206894
/* Write a table header */
@@ -205861,10 +207058,17 @@
205861207058
}
205862207059
sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db));
205863207060
205864207061
return (ret==0);
205865207062
}
207063
+
207064
+/*
207065
+** Return the amount of heap memory in use.
207066
+*/
207067
+SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession){
207068
+ return pSession->nMalloc;
207069
+}
205866207070
205867207071
/*
205868207072
** Do the work for either sqlite3changeset_start() or start_strm().
205869207073
*/
205870207074
static int sessionChangesetStart(
@@ -207673,11 +208877,11 @@
207673208877
}else{
207674208878
int nMinCol = 0;
207675208879
int i;
207676208880
207677208881
sqlite3changeset_pk(pIter, &abPK, 0);
207678
- rc = sessionTableInfo(
208882
+ rc = sessionTableInfo(0,
207679208883
db, "main", zNew, &sApply.nCol, &zTab, &sApply.azCol, &sApply.abPK
207680208884
);
207681208885
if( rc!=SQLITE_OK ) break;
207682208886
for(i=0; i<sApply.nCol; i++){
207683208887
if( sApply.abPK[i] ) nMinCol = i+1;
@@ -208152,11 +209356,11 @@
208152209356
rc = SQLITE_SCHEMA;
208153209357
break;
208154209358
}
208155209359
}
208156209360
208157
- if( sessionGrowHash(pIter->bPatchset, pTab) ){
209361
+ if( sessionGrowHash(0, pIter->bPatchset, pTab) ){
208158209362
rc = SQLITE_NOMEM;
208159209363
break;
208160209364
}
208161209365
iHash = sessionChangeHash(
208162209366
pTab, (pIter->bPatchset && op==SQLITE_DELETE), aRec, pTab->nChange
@@ -208338,11 +209542,11 @@
208338209542
/*
208339209543
** Delete a changegroup object.
208340209544
*/
208341209545
SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
208342209546
if( pGrp ){
208343
- sessionDeleteTable(pGrp->pList);
209547
+ sessionDeleteTable(0, pGrp->pList);
208344209548
sqlite3_free(pGrp);
208345209549
}
208346209550
}
208347209551
208348209552
/*
@@ -208739,11 +209943,11 @@
208739209943
/*
208740209944
** Destroy a rebaser object
208741209945
*/
208742209946
SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p){
208743209947
if( p ){
208744
- sessionDeleteTable(p->grp.pList);
209948
+ sessionDeleteTable(0, p->grp.pList);
208745209949
sqlite3_free(p);
208746209950
}
208747209951
}
208748209952
208749209953
/*
@@ -211201,59 +212405,10 @@
211201212405
int fts5yysize; /* Amount to pop the stack */
211202212406
sqlite3Fts5ParserARG_FETCH
211203212407
(void)fts5yyLookahead;
211204212408
(void)fts5yyLookaheadToken;
211205212409
fts5yymsp = fts5yypParser->fts5yytos;
211206
- assert( fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) );
211207
-#ifndef NDEBUG
211208
- if( fts5yyTraceFILE ){
211209
- fts5yysize = fts5yyRuleInfoNRhs[fts5yyruleno];
211210
- if( fts5yysize ){
211211
- fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
211212
- fts5yyTracePrompt,
211213
- fts5yyruleno, fts5yyRuleName[fts5yyruleno],
211214
- fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action",
211215
- fts5yymsp[fts5yysize].stateno);
211216
- }else{
211217
- fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s.\n",
211218
- fts5yyTracePrompt, fts5yyruleno, fts5yyRuleName[fts5yyruleno],
211219
- fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action");
211220
- }
211221
- }
211222
-#endif /* NDEBUG */
211223
-
211224
- /* Check that the stack is large enough to grow by a single entry
211225
- ** if the RHS of the rule is empty. This ensures that there is room
211226
- ** enough on the stack to push the LHS value */
211227
- if( fts5yyRuleInfoNRhs[fts5yyruleno]==0 ){
211228
-#ifdef fts5YYTRACKMAXSTACKDEPTH
211229
- if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){
211230
- fts5yypParser->fts5yyhwm++;
211231
- assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack));
211232
- }
211233
-#endif
211234
-#if fts5YYSTACKDEPTH>0
211235
- if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
211236
- fts5yyStackOverflow(fts5yypParser);
211237
- /* The call to fts5yyStackOverflow() above pops the stack until it is
211238
- ** empty, causing the main parser loop to exit. So the return value
211239
- ** is never used and does not matter. */
211240
- return 0;
211241
- }
211242
-#else
211243
- if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
211244
- if( fts5yyGrowStack(fts5yypParser) ){
211245
- fts5yyStackOverflow(fts5yypParser);
211246
- /* The call to fts5yyStackOverflow() above pops the stack until it is
211247
- ** empty, causing the main parser loop to exit. So the return value
211248
- ** is never used and does not matter. */
211249
- return 0;
211250
- }
211251
- fts5yymsp = fts5yypParser->fts5yytos;
211252
- }
211253
-#endif
211254
- }
211255212410
211256212411
switch( fts5yyruleno ){
211257212412
/* Beginning here are the reduction cases. A typical example
211258212413
** follows:
211259212414
** case 0:
@@ -211552,16 +212707,60 @@
211552212707
fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact-fts5YY_MIN_REDUCE);
211553212708
}
211554212709
}
211555212710
#endif
211556212711
211557
- do{
212712
+ while(1){ /* Exit by "break" */
212713
+ assert( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystack );
211558212714
assert( fts5yyact==fts5yypParser->fts5yytos->stateno );
211559212715
fts5yyact = fts5yy_find_shift_action((fts5YYCODETYPE)fts5yymajor,fts5yyact);
211560212716
if( fts5yyact >= fts5YY_MIN_REDUCE ){
211561
- fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor,
211562
- fts5yyminor sqlite3Fts5ParserCTX_PARAM);
212717
+ unsigned int fts5yyruleno = fts5yyact - fts5YY_MIN_REDUCE; /* Reduce by this rule */
212718
+ assert( fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) );
212719
+#ifndef NDEBUG
212720
+ if( fts5yyTraceFILE ){
212721
+ int fts5yysize = fts5yyRuleInfoNRhs[fts5yyruleno];
212722
+ if( fts5yysize ){
212723
+ fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
212724
+ fts5yyTracePrompt,
212725
+ fts5yyruleno, fts5yyRuleName[fts5yyruleno],
212726
+ fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action",
212727
+ fts5yypParser->fts5yytos[fts5yysize].stateno);
212728
+ }else{
212729
+ fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s.\n",
212730
+ fts5yyTracePrompt, fts5yyruleno, fts5yyRuleName[fts5yyruleno],
212731
+ fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action");
212732
+ }
212733
+ }
212734
+#endif /* NDEBUG */
212735
+
212736
+ /* Check that the stack is large enough to grow by a single entry
212737
+ ** if the RHS of the rule is empty. This ensures that there is room
212738
+ ** enough on the stack to push the LHS value */
212739
+ if( fts5yyRuleInfoNRhs[fts5yyruleno]==0 ){
212740
+#ifdef fts5YYTRACKMAXSTACKDEPTH
212741
+ if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){
212742
+ fts5yypParser->fts5yyhwm++;
212743
+ assert( fts5yypParser->fts5yyhwm ==
212744
+ (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack));
212745
+ }
212746
+#endif
212747
+#if fts5YYSTACKDEPTH>0
212748
+ if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
212749
+ fts5yyStackOverflow(fts5yypParser);
212750
+ break;
212751
+ }
212752
+#else
212753
+ if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
212754
+ if( fts5yyGrowStack(fts5yypParser) ){
212755
+ fts5yyStackOverflow(fts5yypParser);
212756
+ break;
212757
+ }
212758
+ }
212759
+#endif
212760
+ }
212761
+ fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyruleno,fts5yymajor,fts5yyminor sqlite3Fts5ParserCTX_PARAM);
211563212762
}else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
211564212763
fts5yy_shift(fts5yypParser,fts5yyact,(fts5YYCODETYPE)fts5yymajor,fts5yyminor);
211565212764
#ifndef fts5YYNOERRORRECOVERY
211566212765
fts5yypParser->fts5yyerrcnt--;
211567212766
#endif
@@ -211670,11 +212869,11 @@
211670212869
#endif
211671212870
}
211672212871
break;
211673212872
#endif
211674212873
}
211675
- }while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );
212874
+ }
211676212875
#ifndef NDEBUG
211677212876
if( fts5yyTraceFILE ){
211678212877
fts5yyStackEntry *i;
211679212878
char cDiv = '[';
211680212879
fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt);
@@ -215282,12 +216481,12 @@
215282216481
){
215283216482
rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
215284216483
}
215285216484
215286216485
/* If the iterator is not at a real match, skip forward until it is. */
215287
- while( pRoot->bNomatch ){
215288
- assert( pRoot->bEof==0 && rc==SQLITE_OK );
216486
+ while( pRoot->bNomatch && rc==SQLITE_OK ){
216487
+ assert( pRoot->bEof==0 );
215289216488
rc = fts5ExprNodeNext(p, pRoot, 0, 0);
215290216489
}
215291216490
return rc;
215292216491
}
215293216492
@@ -219468,18 +220667,14 @@
219468220667
if( pbNewTerm ) *pbNewTerm = 1;
219469220668
}
219470220669
}else{
219471220670
/* The following could be done by calling fts5SegIterLoadNPos(). But
219472220671
** this block is particularly performance critical, so equivalent
219473
- ** code is inlined.
219474
- **
219475
- ** Later: Switched back to fts5SegIterLoadNPos() because it supports
219476
- ** detail=none mode. Not ideal.
219477
- */
220672
+ ** code is inlined. */
219478220673
int nSz;
219479220674
assert( p->rc==SQLITE_OK );
219480
- assert( pIter->iLeafOffset<=pIter->pLeaf->nn );
220675
+ assert_nc( pIter->iLeafOffset<=pIter->pLeaf->nn );
219481220676
fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);
219482220677
pIter->bDel = (nSz & 0x0001);
219483220678
pIter->nPos = nSz>>1;
219484220679
assert_nc( pIter->nPos>=0 );
219485220680
}
@@ -220467,11 +221662,11 @@
220467221662
u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset];
220468221663
int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset);
220469221664
int pgno = pSeg->iLeafPgno;
220470221665
int pgnoSave = 0;
220471221666
220472
- /* This function does notmwork with detail=none databases. */
221667
+ /* This function does not work with detail=none databases. */
220473221668
assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );
220474221669
220475221670
if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){
220476221671
pgnoSave = pgno+1;
220477221672
}
@@ -220480,10 +221675,13 @@
220480221675
xChunk(p, pCtx, pChunk, nChunk);
220481221676
nRem -= nChunk;
220482221677
fts5DataRelease(pData);
220483221678
if( nRem<=0 ){
220484221679
break;
221680
+ }else if( pSeg->pSeg==0 ){
221681
+ p->rc = FTS5_CORRUPT;
221682
+ return;
220485221683
}else{
220486221684
pgno++;
220487221685
pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
220488221686
if( pData==0 ) break;
220489221687
pChunk = &pData->p[4];
@@ -220531,70 +221729,76 @@
220531221729
}
220532221730
}
220533221731
}
220534221732
220535221733
/*
220536
-** IN/OUT parameter (*pa) points to a position list n bytes in size. If
220537
-** the position list contains entries for column iCol, then (*pa) is set
220538
-** to point to the sub-position-list for that column and the number of
220539
-** bytes in it returned. Or, if the argument position list does not
220540
-** contain any entries for column iCol, return 0.
221734
+** Parameter pPos points to a buffer containing a position list, size nPos.
221735
+** This function filters it according to pColset (which must be non-NULL)
221736
+** and sets pIter->base.pData/nData to point to the new position list.
221737
+** If memory is required for the new position list, use buffer pIter->poslist.
221738
+** Or, if the new position list is a contiguous subset of the input, set
221739
+** pIter->base.pData/nData to point directly to it.
221740
+**
221741
+** This function is a no-op if *pRc is other than SQLITE_OK when it is
221742
+** called. If an OOM error is encountered, *pRc is set to SQLITE_NOMEM
221743
+** before returning.
220541221744
*/
220542
-static int fts5IndexExtractCol(
220543
- const u8 **pa, /* IN/OUT: Pointer to poslist */
220544
- int n, /* IN: Size of poslist in bytes */
220545
- int iCol /* Column to extract from poslist */
220546
-){
220547
- int iCurrent = 0; /* Anything before the first 0x01 is col 0 */
220548
- const u8 *p = *pa;
220549
- const u8 *pEnd = &p[n]; /* One byte past end of position list */
220550
-
220551
- while( iCol>iCurrent ){
220552
- /* Advance pointer p until it points to pEnd or an 0x01 byte that is
220553
- ** not part of a varint. Note that it is not possible for a negative
220554
- ** or extremely large varint to occur within an uncorrupted position
220555
- ** list. So the last byte of each varint may be assumed to have a clear
220556
- ** 0x80 bit. */
220557
- while( *p!=0x01 ){
220558
- while( *p++ & 0x80 );
220559
- if( p>=pEnd ) return 0;
220560
- }
220561
- *pa = p++;
220562
- iCurrent = *p++;
220563
- if( iCurrent & 0x80 ){
220564
- p--;
220565
- p += fts5GetVarint32(p, iCurrent);
220566
- }
220567
- }
220568
- if( iCol!=iCurrent ) return 0;
220569
-
220570
- /* Advance pointer p until it points to pEnd or an 0x01 byte that is
220571
- ** not part of a varint */
220572
- while( p<pEnd && *p!=0x01 ){
220573
- while( *p++ & 0x80 );
220574
- }
220575
-
220576
- return p - (*pa);
220577
-}
220578
-
220579221745
static void fts5IndexExtractColset(
220580221746
int *pRc,
220581221747
Fts5Colset *pColset, /* Colset to filter on */
220582221748
const u8 *pPos, int nPos, /* Position list */
220583
- Fts5Buffer *pBuf /* Output buffer */
221749
+ Fts5Iter *pIter
220584221750
){
220585221751
if( *pRc==SQLITE_OK ){
220586
- int i;
220587
- fts5BufferZero(pBuf);
220588
- for(i=0; i<pColset->nCol; i++){
220589
- const u8 *pSub = pPos;
220590
- int nSub = fts5IndexExtractCol(&pSub, nPos, pColset->aiCol[i]);
220591
- if( nSub ){
220592
- fts5BufferAppendBlob(pRc, pBuf, nSub, pSub);
221752
+ const u8 *p = pPos;
221753
+ const u8 *aCopy = p;
221754
+ const u8 *pEnd = &p[nPos]; /* One byte past end of position list */
221755
+ int i = 0;
221756
+ int iCurrent = 0;
221757
+
221758
+ if( pColset->nCol>1 && sqlite3Fts5BufferSize(pRc, &pIter->poslist, nPos) ){
221759
+ return;
221760
+ }
221761
+
221762
+ while( 1 ){
221763
+ while( pColset->aiCol[i]<iCurrent ){
221764
+ i++;
221765
+ if( i==pColset->nCol ){
221766
+ pIter->base.pData = pIter->poslist.p;
221767
+ pIter->base.nData = pIter->poslist.n;
221768
+ return;
221769
+ }
221770
+ }
221771
+
221772
+ /* Advance pointer p until it points to pEnd or an 0x01 byte that is
221773
+ ** not part of a varint */
221774
+ while( p<pEnd && *p!=0x01 ){
221775
+ while( *p++ & 0x80 );
221776
+ }
221777
+
221778
+ if( pColset->aiCol[i]==iCurrent ){
221779
+ if( pColset->nCol==1 ){
221780
+ pIter->base.pData = aCopy;
221781
+ pIter->base.nData = p-aCopy;
221782
+ return;
221783
+ }
221784
+ fts5BufferSafeAppendBlob(&pIter->poslist, aCopy, p-aCopy);
221785
+ }
221786
+ if( p==pEnd ){
221787
+ pIter->base.pData = pIter->poslist.p;
221788
+ pIter->base.nData = pIter->poslist.n;
221789
+ return;
221790
+ }
221791
+ aCopy = p++;
221792
+ iCurrent = *p++;
221793
+ if( iCurrent & 0x80 ){
221794
+ p--;
221795
+ p += fts5GetVarint32(p, iCurrent);
220593221796
}
220594221797
}
220595221798
}
221799
+
220596221800
}
220597221801
220598221802
/*
220599221803
** xSetOutputs callback used by detail=none tables.
220600221804
*/
@@ -220710,20 +221914,13 @@
220710221914
220711221915
if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
220712221916
/* All data is stored on the current page. Populate the output
220713221917
** variables to point into the body of the page object. */
220714221918
const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
220715
- if( pColset->nCol==1 ){
220716
- pIter->base.nData = fts5IndexExtractCol(&a, pSeg->nPos,pColset->aiCol[0]);
220717
- pIter->base.pData = a;
220718
- }else{
220719
- int *pRc = &pIter->pIndex->rc;
220720
- fts5BufferZero(&pIter->poslist);
220721
- fts5IndexExtractColset(pRc, pColset, a, pSeg->nPos, &pIter->poslist);
220722
- pIter->base.pData = pIter->poslist.p;
220723
- pIter->base.nData = pIter->poslist.n;
220724
- }
221919
+ int *pRc = &pIter->pIndex->rc;
221920
+ fts5BufferZero(&pIter->poslist);
221921
+ fts5IndexExtractColset(pRc, pColset, a, pSeg->nPos, pIter);
220725221922
}else{
220726221923
/* The data is distributed over two or more pages. Copy it into the
220727221924
** Fts5Iter.poslist buffer and then set the output pointer to point
220728221925
** to this buffer. */
220729221926
fts5BufferZero(&pIter->poslist);
@@ -222202,11 +223399,11 @@
222202223399
222203223400
222204223401
static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
222205223402
u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;
222206223403
222207
- assert( pIter->aPoslist );
223404
+ assert( pIter->aPoslist || (p==0 && pIter->aPoslist==0) );
222208223405
if( p>=pIter->aEof ){
222209223406
pIter->aPoslist = 0;
222210223407
}else{
222211223408
i64 iDelta;
222212223409
@@ -222286,20 +223483,24 @@
222286223483
** In this case the buffers consist of a delta-encoded list of rowids only.
222287223484
*/
222288223485
static void fts5MergeRowidLists(
222289223486
Fts5Index *p, /* FTS5 backend object */
222290223487
Fts5Buffer *p1, /* First list to merge */
222291
- Fts5Buffer *p2 /* Second list to merge */
223488
+ int nBuf, /* Number of entries in apBuf[] */
223489
+ Fts5Buffer *aBuf /* Array of other lists to merge into p1 */
222292223490
){
222293223491
int i1 = 0;
222294223492
int i2 = 0;
222295223493
i64 iRowid1 = 0;
222296223494
i64 iRowid2 = 0;
222297223495
i64 iOut = 0;
222298
-
223496
+ Fts5Buffer *p2 = &aBuf[0];
222299223497
Fts5Buffer out;
223498
+
223499
+ (void)nBuf;
222300223500
memset(&out, 0, sizeof(out));
223501
+ assert( nBuf==1 );
222301223502
sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);
222302223503
if( p->rc ) return;
222303223504
222304223505
fts5NextRowid(p1, &i1, &iRowid1);
222305223506
fts5NextRowid(p2, &i2, &iRowid2);
@@ -222321,185 +223522,218 @@
222321223522
}
222322223523
222323223524
fts5BufferSwap(&out, p1);
222324223525
fts5BufferFree(&out);
222325223526
}
223527
+
223528
+typedef struct PrefixMerger PrefixMerger;
223529
+struct PrefixMerger {
223530
+ Fts5DoclistIter iter; /* Doclist iterator */
223531
+ i64 iPos; /* For iterating through a position list */
223532
+ int iOff;
223533
+ u8 *aPos;
223534
+ PrefixMerger *pNext; /* Next in docid/poslist order */
223535
+};
223536
+
223537
+static void fts5PrefixMergerInsertByRowid(
223538
+ PrefixMerger **ppHead,
223539
+ PrefixMerger *p
223540
+){
223541
+ if( p->iter.aPoslist ){
223542
+ PrefixMerger **pp = ppHead;
223543
+ while( *pp && p->iter.iRowid>(*pp)->iter.iRowid ){
223544
+ pp = &(*pp)->pNext;
223545
+ }
223546
+ p->pNext = *pp;
223547
+ *pp = p;
223548
+ }
223549
+}
223550
+
223551
+static void fts5PrefixMergerInsertByPosition(
223552
+ PrefixMerger **ppHead,
223553
+ PrefixMerger *p
223554
+){
223555
+ if( p->iPos>=0 ){
223556
+ PrefixMerger **pp = ppHead;
223557
+ while( *pp && p->iPos>(*pp)->iPos ){
223558
+ pp = &(*pp)->pNext;
223559
+ }
223560
+ p->pNext = *pp;
223561
+ *pp = p;
223562
+ }
223563
+}
223564
+
222326223565
222327223566
/*
222328
-** Buffers p1 and p2 contain doclists. This function merges the content
222329
-** of the two doclists together and sets buffer p1 to the result before
222330
-** returning.
222331
-**
222332
-** If an error occurs, an error code is left in p->rc. If an error has
222333
-** already occurred, this function is a no-op.
223567
+** Array aBuf[] contains nBuf doclists. These are all merged in with the
223568
+** doclist in buffer p1.
222334223569
*/
222335223570
static void fts5MergePrefixLists(
222336223571
Fts5Index *p, /* FTS5 backend object */
222337223572
Fts5Buffer *p1, /* First list to merge */
222338
- Fts5Buffer *p2 /* Second list to merge */
222339
-){
222340
- if( p2->n ){
222341
- i64 iLastRowid = 0;
222342
- Fts5DoclistIter i1;
222343
- Fts5DoclistIter i2;
222344
- Fts5Buffer out = {0, 0, 0};
222345
- Fts5Buffer tmp = {0, 0, 0};
222346
-
222347
- /* The maximum size of the output is equal to the sum of the two
222348
- ** input sizes + 1 varint (9 bytes). The extra varint is because if the
222349
- ** first rowid in one input is a large negative number, and the first in
222350
- ** the other a non-negative number, the delta for the non-negative
222351
- ** number will be larger on disk than the literal integer value
222352
- ** was.
222353
- **
222354
- ** Or, if the input position-lists are corrupt, then the output might
222355
- ** include up to 2 extra 10-byte positions created by interpreting -1
222356
- ** (the value PoslistNext64() uses for EOF) as a position and appending
222357
- ** it to the output. This can happen at most once for each input
222358
- ** position-list, hence two 10 byte paddings. */
222359
- if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9+10+10) ) return;
222360
- fts5DoclistIterInit(p1, &i1);
222361
- fts5DoclistIterInit(p2, &i2);
222362
-
222363
- while( 1 ){
222364
- if( i1.iRowid<i2.iRowid ){
222365
- /* Copy entry from i1 */
222366
- fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
222367
- fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.nPoslist+i1.nSize);
222368
- fts5DoclistIterNext(&i1);
222369
- if( i1.aPoslist==0 ) break;
222370
- assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
222371
- }
222372
- else if( i2.iRowid!=i1.iRowid ){
222373
- /* Copy entry from i2 */
222374
- fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
222375
- fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.nPoslist+i2.nSize);
222376
- fts5DoclistIterNext(&i2);
222377
- if( i2.aPoslist==0 ) break;
222378
- assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
222379
- }
222380
- else{
222381
- /* Merge the two position lists. */
222382
- i64 iPos1 = 0;
222383
- i64 iPos2 = 0;
222384
- int iOff1 = 0;
222385
- int iOff2 = 0;
222386
- u8 *a1 = &i1.aPoslist[i1.nSize];
222387
- u8 *a2 = &i2.aPoslist[i2.nSize];
222388
- int nCopy;
222389
- u8 *aCopy;
222390
-
222391
- i64 iPrev = 0;
222392
- Fts5PoslistWriter writer;
222393
- memset(&writer, 0, sizeof(writer));
222394
-
222395
- /* See the earlier comment in this function for an explanation of why
222396
- ** corrupt input position lists might cause the output to consume
222397
- ** at most 20 bytes of unexpected space. */
222398
- fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
222399
- fts5BufferZero(&tmp);
222400
- sqlite3Fts5BufferSize(&p->rc, &tmp,
222401
- i1.nPoslist + i2.nPoslist + 10 + 10 + FTS5_DATA_ZERO_PADDING
222402
- );
222403
- if( p->rc ) break;
222404
-
222405
- sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
222406
- sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
222407
- assert_nc( iPos1>=0 && iPos2>=0 );
222408
-
222409
- if( iPos1<iPos2 ){
222410
- sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
222411
- sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
222412
- }else{
222413
- sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
222414
- sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
222415
- }
222416
- if( iPos1>=0 && iPos2>=0 ){
222417
- while( 1 ){
222418
- if( iPos1<iPos2 ){
222419
- if( iPos1!=iPrev ){
222420
- sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
222421
- }
222422
- sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
222423
- if( iPos1<0 ) break;
222424
- }else{
222425
- assert_nc( iPos2!=iPrev );
222426
- sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
222427
- sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
222428
- if( iPos2<0 ) break;
222429
- }
222430
- }
222431
- }
222432
-
222433
- if( iPos1>=0 ){
222434
- if( iPos1!=iPrev ){
222435
- sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
222436
- }
222437
- aCopy = &a1[iOff1];
222438
- nCopy = i1.nPoslist - iOff1;
222439
- }else{
222440
- assert_nc( iPos2>=0 && iPos2!=iPrev );
222441
- sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
222442
- aCopy = &a2[iOff2];
222443
- nCopy = i2.nPoslist - iOff2;
222444
- }
222445
- if( nCopy>0 ){
222446
- fts5BufferSafeAppendBlob(&tmp, aCopy, nCopy);
222447
- }
222448
-
222449
- /* WRITEPOSLISTSIZE */
222450
- assert_nc( tmp.n<=i1.nPoslist+i2.nPoslist );
222451
- assert( tmp.n<=i1.nPoslist+i2.nPoslist+10+10 );
222452
- if( tmp.n>i1.nPoslist+i2.nPoslist ){
222453
- if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
222454
- break;
222455
- }
222456
- fts5BufferSafeAppendVarint(&out, tmp.n * 2);
222457
- fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
222458
- fts5DoclistIterNext(&i1);
222459
- fts5DoclistIterNext(&i2);
222460
- assert_nc( out.n<=(p1->n+p2->n+9) );
222461
- if( i1.aPoslist==0 || i2.aPoslist==0 ) break;
222462
- assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
222463
- }
222464
- }
222465
-
222466
- if( i1.aPoslist ){
222467
- fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
222468
- fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.aEof - i1.aPoslist);
222469
- }
222470
- else if( i2.aPoslist ){
222471
- fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
222472
- fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.aEof - i2.aPoslist);
222473
- }
222474
- assert_nc( out.n<=(p1->n+p2->n+9) );
222475
-
222476
- fts5BufferFree(p1);
222477
- fts5BufferFree(&tmp);
222478
- memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
222479
- *p1 = out;
222480
- }
223573
+ int nBuf, /* Number of buffers in array aBuf[] */
223574
+ Fts5Buffer *aBuf /* Other lists to merge in */
223575
+){
223576
+#define fts5PrefixMergerNextPosition(p) \
223577
+ sqlite3Fts5PoslistNext64((p)->aPos,(p)->iter.nPoslist,&(p)->iOff,&(p)->iPos);
223578
+#define FTS5_MERGE_NLIST 16
223579
+ PrefixMerger aMerger[FTS5_MERGE_NLIST];
223580
+ PrefixMerger *pHead = 0;
223581
+ int i;
223582
+ int nOut = 0;
223583
+ Fts5Buffer out = {0, 0, 0};
223584
+ Fts5Buffer tmp = {0, 0, 0};
223585
+ i64 iLastRowid = 0;
223586
+
223587
+ /* Initialize a doclist-iterator for each input buffer. Arrange them in
223588
+ ** a linked-list starting at pHead in ascending order of rowid. Avoid
223589
+ ** linking any iterators already at EOF into the linked list at all. */
223590
+ assert( nBuf+1<=sizeof(aMerger)/sizeof(aMerger[0]) );
223591
+ memset(aMerger, 0, sizeof(PrefixMerger)*(nBuf+1));
223592
+ pHead = &aMerger[nBuf];
223593
+ fts5DoclistIterInit(p1, &pHead->iter);
223594
+ for(i=0; i<nBuf; i++){
223595
+ fts5DoclistIterInit(&aBuf[i], &aMerger[i].iter);
223596
+ fts5PrefixMergerInsertByRowid(&pHead, &aMerger[i]);
223597
+ nOut += aBuf[i].n;
223598
+ }
223599
+ if( nOut==0 ) return;
223600
+ nOut += p1->n + 9 + 10*nBuf;
223601
+
223602
+ /* The maximum size of the output is equal to the sum of the
223603
+ ** input sizes + 1 varint (9 bytes). The extra varint is because if the
223604
+ ** first rowid in one input is a large negative number, and the first in
223605
+ ** the other a non-negative number, the delta for the non-negative
223606
+ ** number will be larger on disk than the literal integer value
223607
+ ** was.
223608
+ **
223609
+ ** Or, if the input position-lists are corrupt, then the output might
223610
+ ** include up to (nBuf+1) extra 10-byte positions created by interpreting -1
223611
+ ** (the value PoslistNext64() uses for EOF) as a position and appending
223612
+ ** it to the output. This can happen at most once for each input
223613
+ ** position-list, hence (nBuf+1) 10 byte paddings. */
223614
+ if( sqlite3Fts5BufferSize(&p->rc, &out, nOut) ) return;
223615
+
223616
+ while( pHead ){
223617
+ fts5MergeAppendDocid(&out, iLastRowid, pHead->iter.iRowid);
223618
+
223619
+ if( pHead->pNext && iLastRowid==pHead->pNext->iter.iRowid ){
223620
+ /* Merge data from two or more poslists */
223621
+ i64 iPrev = 0;
223622
+ int nTmp = FTS5_DATA_ZERO_PADDING;
223623
+ int nMerge = 0;
223624
+ PrefixMerger *pSave = pHead;
223625
+ PrefixMerger *pThis = 0;
223626
+ int nTail = 0;
223627
+
223628
+ pHead = 0;
223629
+ while( pSave && pSave->iter.iRowid==iLastRowid ){
223630
+ PrefixMerger *pNext = pSave->pNext;
223631
+ pSave->iOff = 0;
223632
+ pSave->iPos = 0;
223633
+ pSave->aPos = &pSave->iter.aPoslist[pSave->iter.nSize];
223634
+ fts5PrefixMergerNextPosition(pSave);
223635
+ nTmp += pSave->iter.nPoslist + 10;
223636
+ nMerge++;
223637
+ fts5PrefixMergerInsertByPosition(&pHead, pSave);
223638
+ pSave = pNext;
223639
+ }
223640
+
223641
+ if( pHead==0 || pHead->pNext==0 ){
223642
+ p->rc = FTS5_CORRUPT;
223643
+ break;
223644
+ }
223645
+
223646
+ /* See the earlier comment in this function for an explanation of why
223647
+ ** corrupt input position lists might cause the output to consume
223648
+ ** at most nMerge*10 bytes of unexpected space. */
223649
+ if( sqlite3Fts5BufferSize(&p->rc, &tmp, nTmp+nMerge*10) ){
223650
+ break;
223651
+ }
223652
+ fts5BufferZero(&tmp);
223653
+
223654
+ pThis = pHead;
223655
+ pHead = pThis->pNext;
223656
+ sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
223657
+ fts5PrefixMergerNextPosition(pThis);
223658
+ fts5PrefixMergerInsertByPosition(&pHead, pThis);
223659
+
223660
+ while( pHead->pNext ){
223661
+ pThis = pHead;
223662
+ if( pThis->iPos!=iPrev ){
223663
+ sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
223664
+ }
223665
+ fts5PrefixMergerNextPosition(pThis);
223666
+ pHead = pThis->pNext;
223667
+ fts5PrefixMergerInsertByPosition(&pHead, pThis);
223668
+ }
223669
+
223670
+ if( pHead->iPos!=iPrev ){
223671
+ sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pHead->iPos);
223672
+ }
223673
+ nTail = pHead->iter.nPoslist - pHead->iOff;
223674
+
223675
+ /* WRITEPOSLISTSIZE */
223676
+ assert( tmp.n+nTail<=nTmp );
223677
+ if( tmp.n+nTail>nTmp-FTS5_DATA_ZERO_PADDING ){
223678
+ if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
223679
+ break;
223680
+ }
223681
+ fts5BufferSafeAppendVarint(&out, (tmp.n+nTail) * 2);
223682
+ fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
223683
+ if( nTail>0 ){
223684
+ fts5BufferSafeAppendBlob(&out, &pHead->aPos[pHead->iOff], nTail);
223685
+ }
223686
+
223687
+ pHead = pSave;
223688
+ for(i=0; i<nBuf+1; i++){
223689
+ PrefixMerger *pX = &aMerger[i];
223690
+ if( pX->iter.aPoslist && pX->iter.iRowid==iLastRowid ){
223691
+ fts5DoclistIterNext(&pX->iter);
223692
+ fts5PrefixMergerInsertByRowid(&pHead, pX);
223693
+ }
223694
+ }
223695
+
223696
+ }else{
223697
+ /* Copy poslist from pHead to output */
223698
+ PrefixMerger *pThis = pHead;
223699
+ Fts5DoclistIter *pI = &pThis->iter;
223700
+ fts5BufferSafeAppendBlob(&out, pI->aPoslist, pI->nPoslist+pI->nSize);
223701
+ fts5DoclistIterNext(pI);
223702
+ pHead = pThis->pNext;
223703
+ fts5PrefixMergerInsertByRowid(&pHead, pThis);
223704
+ }
223705
+ }
223706
+
223707
+ fts5BufferFree(p1);
223708
+ fts5BufferFree(&tmp);
223709
+ memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
223710
+ *p1 = out;
222481223711
}
222482223712
222483223713
static void fts5SetupPrefixIter(
222484223714
Fts5Index *p, /* Index to read from */
222485223715
int bDesc, /* True for "ORDER BY rowid DESC" */
222486
- const u8 *pToken, /* Buffer containing prefix to match */
223716
+ int iIdx, /* Index to scan for data */
223717
+ u8 *pToken, /* Buffer containing prefix to match */
222487223718
int nToken, /* Size of buffer pToken in bytes */
222488223719
Fts5Colset *pColset, /* Restrict matches to these columns */
222489223720
Fts5Iter **ppIter /* OUT: New iterator */
222490223721
){
222491223722
Fts5Structure *pStruct;
222492223723
Fts5Buffer *aBuf;
222493
- const int nBuf = 32;
223724
+ int nBuf = 32;
223725
+ int nMerge = 1;
222494223726
222495
- void (*xMerge)(Fts5Index*, Fts5Buffer*, Fts5Buffer*);
223727
+ void (*xMerge)(Fts5Index*, Fts5Buffer*, int, Fts5Buffer*);
222496223728
void (*xAppend)(Fts5Index*, i64, Fts5Iter*, Fts5Buffer*);
222497223729
if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
222498223730
xMerge = fts5MergeRowidLists;
222499223731
xAppend = fts5AppendRowid;
222500223732
}else{
223733
+ nMerge = FTS5_MERGE_NLIST-1;
223734
+ nBuf = nMerge*8; /* Sufficient to merge (16^8)==(2^32) lists */
222501223735
xMerge = fts5MergePrefixLists;
222502223736
xAppend = fts5AppendPoslist;
222503223737
}
222504223738
222505223739
aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);
@@ -222515,10 +223749,31 @@
222515223749
Fts5Data *pData;
222516223750
Fts5Buffer doclist;
222517223751
int bNewTerm = 1;
222518223752
222519223753
memset(&doclist, 0, sizeof(doclist));
223754
+ if( iIdx!=0 ){
223755
+ int dummy = 0;
223756
+ const int f2 = FTS5INDEX_QUERY_SKIPEMPTY|FTS5INDEX_QUERY_NOOUTPUT;
223757
+ pToken[0] = FTS5_MAIN_PREFIX;
223758
+ fts5MultiIterNew(p, pStruct, f2, pColset, pToken, nToken, -1, 0, &p1);
223759
+ fts5IterSetOutputCb(&p->rc, p1);
223760
+ for(;
223761
+ fts5MultiIterEof(p, p1)==0;
223762
+ fts5MultiIterNext2(p, p1, &dummy)
223763
+ ){
223764
+ Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
223765
+ p1->xSetOutputs(p1, pSeg);
223766
+ if( p1->base.nData ){
223767
+ xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
223768
+ iLastRowid = p1->base.iRowid;
223769
+ }
223770
+ }
223771
+ fts5MultiIterFree(p1);
223772
+ }
223773
+
223774
+ pToken[0] = FTS5_MAIN_PREFIX + iIdx;
222520223775
fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
222521223776
fts5IterSetOutputCb(&p->rc, p1);
222522223777
for( /* no-op */ ;
222523223778
fts5MultiIterEof(p, p1)==0;
222524223779
fts5MultiIterNext2(p, p1, &bNewTerm)
@@ -222535,31 +223790,43 @@
222535223790
222536223791
if( p1->base.nData==0 ) continue;
222537223792
222538223793
if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
222539223794
for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
222540
- assert( i<nBuf );
222541
- if( aBuf[i].n==0 ){
222542
- fts5BufferSwap(&doclist, &aBuf[i]);
222543
- fts5BufferZero(&doclist);
222544
- }else{
222545
- xMerge(p, &doclist, &aBuf[i]);
222546
- fts5BufferZero(&aBuf[i]);
223795
+ int i1 = i*nMerge;
223796
+ int iStore;
223797
+ assert( i1+nMerge<=nBuf );
223798
+ for(iStore=i1; iStore<i1+nMerge; iStore++){
223799
+ if( aBuf[iStore].n==0 ){
223800
+ fts5BufferSwap(&doclist, &aBuf[iStore]);
223801
+ fts5BufferZero(&doclist);
223802
+ break;
223803
+ }
223804
+ }
223805
+ if( iStore==i1+nMerge ){
223806
+ xMerge(p, &doclist, nMerge, &aBuf[i1]);
223807
+ for(iStore=i1; iStore<i1+nMerge; iStore++){
223808
+ fts5BufferZero(&aBuf[iStore]);
223809
+ }
222547223810
}
222548223811
}
222549223812
iLastRowid = 0;
222550223813
}
222551223814
222552223815
xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
222553223816
iLastRowid = p1->base.iRowid;
222554223817
}
222555223818
222556
- for(i=0; i<nBuf; i++){
223819
+ assert( (nBuf%nMerge)==0 );
223820
+ for(i=0; i<nBuf; i+=nMerge){
223821
+ int iFree;
222557223822
if( p->rc==SQLITE_OK ){
222558
- xMerge(p, &doclist, &aBuf[i]);
223823
+ xMerge(p, &doclist, nMerge, &aBuf[i]);
222559223824
}
222560
- fts5BufferFree(&aBuf[i]);
223825
+ for(iFree=i; iFree<i+nMerge; iFree++){
223826
+ fts5BufferFree(&aBuf[iFree]);
223827
+ }
222561223828
}
222562223829
fts5MultiIterFree(p1);
222563223830
222564223831
pData = fts5IdxMalloc(p, sizeof(Fts5Data)+doclist.n+FTS5_DATA_ZERO_PADDING);
222565223832
if( pData ){
@@ -222810,10 +224077,11 @@
222810224077
/* If the QUERY_SCAN flag is set, all other flags must be clear. */
222811224078
assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
222812224079
222813224080
if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
222814224081
int iIdx = 0; /* Index to search */
224082
+ int iPrefixIdx = 0; /* +1 prefix index */
222815224083
if( nToken ) memcpy(&buf.p[1], pToken, nToken);
222816224084
222817224085
/* Figure out which index to search and set iIdx accordingly. If this
222818224086
** is a prefix query for which there is no prefix index, set iIdx to
222819224087
** greater than pConfig->nPrefix to indicate that the query will be
@@ -222831,11 +224099,13 @@
222831224099
}else
222832224100
#endif
222833224101
if( flags & FTS5INDEX_QUERY_PREFIX ){
222834224102
int nChar = fts5IndexCharlen(pToken, nToken);
222835224103
for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
222836
- if( pConfig->aPrefix[iIdx-1]==nChar ) break;
224104
+ int nIdxChar = pConfig->aPrefix[iIdx-1];
224105
+ if( nIdxChar==nChar ) break;
224106
+ if( nIdxChar==nChar+1 ) iPrefixIdx = iIdx;
222837224107
}
222838224108
}
222839224109
222840224110
if( iIdx<=pConfig->nPrefix ){
222841224111
/* Straight index lookup */
@@ -222848,12 +224118,11 @@
222848224118
fts5StructureRelease(pStruct);
222849224119
}
222850224120
}else{
222851224121
/* Scan multiple terms in the main index */
222852224122
int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
222853
- buf.p[0] = FTS5_MAIN_PREFIX;
222854
- fts5SetupPrefixIter(p, bDesc, buf.p, nToken+1, pColset, &pRet);
224123
+ fts5SetupPrefixIter(p, bDesc, iPrefixIdx, buf.p, nToken+1, pColset,&pRet);
222855224124
assert( p->rc!=SQLITE_OK || pRet->pColset==0 );
222856224125
fts5IterSetOutputCb(&p->rc, pRet);
222857224126
if( p->rc==SQLITE_OK ){
222858224127
Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];
222859224128
if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
@@ -226817,11 +228086,11 @@
226817228086
int nArg, /* Number of args */
226818228087
sqlite3_value **apUnused /* Function arguments */
226819228088
){
226820228089
assert( nArg==0 );
226821228090
UNUSED_PARAM2(nArg, apUnused);
226822
- sqlite3_result_text(pCtx, "fts5: 2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b", -1, SQLITE_TRANSIENT);
228091
+ sqlite3_result_text(pCtx, "fts5: 2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18df9a04", -1, SQLITE_TRANSIENT);
226823228092
}
226824228093
226825228094
/*
226826228095
** Return true if zName is the extension on one of the shadow tables used
226827228096
** by this module.
@@ -231743,12 +233012,12 @@
231743233012
}
231744233013
#endif /* SQLITE_CORE */
231745233014
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
231746233015
231747233016
/************** End of stmt.c ************************************************/
231748
-#if __LINE__!=231748
233017
+#if __LINE__!=233017
231749233018
#undef SQLITE_SOURCE_ID
231750
-#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089falt2"
233019
+#define SQLITE_SOURCE_ID "2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18dfalt2"
231751233020
#endif
231752233021
/* Return the source-id for this library */
231753233022
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
231754233023
/************************** End of sqlite3.c ******************************/
231755233024
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.34.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -281,10 +281,13 @@
281 #if SQLITE_ENABLE_LOAD_EXTENSION
282 "ENABLE_LOAD_EXTENSION",
283 #endif
284 #ifdef SQLITE_ENABLE_LOCKING_STYLE
285 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
 
 
 
286 #endif
287 #if SQLITE_ENABLE_MEMORY_MANAGEMENT
288 "ENABLE_MEMORY_MANAGEMENT",
289 #endif
290 #if SQLITE_ENABLE_MEMSYS3
@@ -988,10 +991,22 @@
988 # define MSVC_VERSION _MSC_VER
989 #else
990 # define MSVC_VERSION 0
991 #endif
992
 
 
 
 
 
 
 
 
 
 
 
 
993 /* Needed for various definitions... */
994 #if defined(__GNUC__) && !defined(_GNU_SOURCE)
995 # define _GNU_SOURCE
996 #endif
997
@@ -1169,13 +1184,13 @@
1169 **
1170 ** See also: [sqlite3_libversion()],
1171 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1172 ** [sqlite_version()] and [sqlite_source_id()].
1173 */
1174 #define SQLITE_VERSION "3.34.0"
1175 #define SQLITE_VERSION_NUMBER 3034000
1176 #define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
1177
1178 /*
1179 ** CAPI3REF: Run-Time Library Version Numbers
1180 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1181 **
@@ -4545,10 +4560,11 @@
4545 ** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
4546 ** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
4547 ** that uses dot-files in place of posix advisory locking.
4548 ** <tr><td> file:data.db?mode=readonly <td>
4549 ** An error. "readonly" is not a valid option for the "mode" parameter.
 
4550 ** </table>
4551 **
4552 ** ^URI hexadecimal escape sequences (%HH) are supported within the path and
4553 ** query components of a URI. A hexadecimal escape sequence consists of a
4554 ** percent sign - "%" - followed by exactly two hexadecimal digits
@@ -4743,11 +4759,11 @@
4743 ** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
4744 **
4745 ** If the Y parameter to sqlite3_free_filename(Y) is anything other
4746 ** than a NULL pointer or a pointer previously acquired from
4747 ** sqlite3_create_filename(), then bad things such as heap
4748 ** corruption or segfaults may occur. The value Y should be
4749 ** used again after sqlite3_free_filename(Y) has been called. This means
4750 ** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
4751 ** then the corresponding [sqlite3_module.xClose() method should also be
4752 ** invoked prior to calling sqlite3_free_filename(Y).
4753 */
@@ -8811,11 +8827,12 @@
8811 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
8812 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
8813 #define SQLITE_TESTCTRL_PRNG_SEED 28
8814 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
8815 #define SQLITE_TESTCTRL_SEEK_COUNT 30
8816 #define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
 
8817
8818 /*
8819 ** CAPI3REF: SQL Keyword Checking
8820 **
8821 ** These routines provide access to the set of SQL language keywords
@@ -11484,10 +11501,18 @@
11484 ** guaranteed that a call to sqlite3session_changeset() will return a
11485 ** changeset containing zero changes.
11486 */
11487 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
11488
 
 
 
 
 
 
 
 
11489 /*
11490 ** CAPI3REF: Create An Iterator To Traverse A Changeset
11491 ** CONSTRUCTOR: sqlite3_changeset_iter
11492 **
11493 ** Create an iterator used to iterate through the contents of a changeset.
@@ -13526,11 +13551,12 @@
13526 ** places. The following macros try to make this explicit.
13527 */
13528 #ifndef __has_extension
13529 # define __has_extension(x) 0 /* compatibility with non-clang compilers */
13530 #endif
13531 #if GCC_VERSION>=4007000 || __has_extension(c_atomic)
 
13532 # define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED)
13533 # define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)
13534 #else
13535 # define AtomicLoad(PTR) (*(PTR))
13536 # define AtomicStore(PTR,VAL) (*(PTR) = (VAL))
@@ -14592,25 +14618,37 @@
14592
14593 /*
14594 ** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
14595 ** the Select query generator tracing logic is turned on.
14596 */
14597 #if defined(SQLITE_ENABLE_SELECTTRACE)
14598 # define SELECTTRACE_ENABLED 1
14599 #else
14600 # define SELECTTRACE_ENABLED 0
14601 #endif
14602 #if defined(SQLITE_ENABLE_SELECTTRACE)
 
14603 # define SELECTTRACE_ENABLED 1
14604 # define SELECTTRACE(K,P,S,X) \
14605 if(sqlite3_unsupported_selecttrace&(K)) \
14606 sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
14607 sqlite3DebugPrintf X
14608 #else
14609 # define SELECTTRACE(K,P,S,X)
14610 # define SELECTTRACE_ENABLED 0
14611 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
14612
14613 /*
14614 ** An instance of the following structure is used to store the busy-handler
14615 ** callback for a given sqlite handle.
14616 **
@@ -14737,10 +14775,11 @@
14737 typedef struct Lookaside Lookaside;
14738 typedef struct LookasideSlot LookasideSlot;
14739 typedef struct Module Module;
14740 typedef struct NameContext NameContext;
14741 typedef struct Parse Parse;
 
14742 typedef struct PreUpdate PreUpdate;
14743 typedef struct PrintfArguments PrintfArguments;
14744 typedef struct RenameToken RenameToken;
14745 typedef struct RowSet RowSet;
14746 typedef struct Savepoint Savepoint;
@@ -15316,10 +15355,11 @@
15316
15317 /* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */
15318 #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */
15319 #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */
15320 #define BTREE_APPEND 0x08 /* Insert is likely an append */
 
15321
15322 /* An instance of the BtreePayload object describes the content of a single
15323 ** entry in either an index or table btree.
15324 **
15325 ** Index btrees (used for indexes and also WITHOUT ROWID tables) contain
@@ -15414,10 +15454,12 @@
15414 #endif
15415
15416 #ifndef SQLITE_OMIT_WAL
15417 SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
15418 #endif
 
 
15419
15420 /*
15421 ** If we are not using shared cache, then there is no need to
15422 ** use mutexes to access the BtShared structures. So make the
15423 ** Enter and Leave procedures no-ops.
@@ -15757,64 +15799,65 @@
15757 #define OP_SeekScan 118 /* synopsis: Scan-ahead up to P1 rows */
15758 #define OP_SeekHit 119 /* synopsis: set P2<=seekHit<=P3 */
15759 #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
15760 #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
15761 #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
15762 #define OP_Delete 123
15763 #define OP_ResetCount 124
15764 #define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15765 #define OP_SorterData 126 /* synopsis: r[P2]=data */
15766 #define OP_RowData 127 /* synopsis: r[P2]=data */
15767 #define OP_Rowid 128 /* synopsis: r[P2]=rowid */
15768 #define OP_NullRow 129
15769 #define OP_SeekEnd 130
15770 #define OP_IdxInsert 131 /* synopsis: key=r[P2] */
15771 #define OP_SorterInsert 132 /* synopsis: key=r[P2] */
15772 #define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */
15773 #define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */
15774 #define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */
15775 #define OP_FinishSeek 136
15776 #define OP_Destroy 137
15777 #define OP_Clear 138
15778 #define OP_ResetSorter 139
15779 #define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15780 #define OP_SqlExec 141
15781 #define OP_ParseSchema 142
15782 #define OP_LoadAnalysis 143
15783 #define OP_DropTable 144
15784 #define OP_DropIndex 145
15785 #define OP_DropTrigger 146
15786 #define OP_IntegrityCk 147
15787 #define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */
15788 #define OP_Param 149
15789 #define OP_Real 150 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15790 #define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */
15791 #define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15792 #define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15793 #define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15794 #define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15795 #define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15796 #define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */
15797 #define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */
15798 #define OP_Expire 159
15799 #define OP_CursorLock 160
15800 #define OP_CursorUnlock 161
15801 #define OP_TableLock 162 /* synopsis: iDb=P1 root=P2 write=P3 */
15802 #define OP_VBegin 163
15803 #define OP_VCreate 164
15804 #define OP_VDestroy 165
15805 #define OP_VOpen 166
15806 #define OP_VColumn 167 /* synopsis: r[P3]=vcolumn(P2) */
15807 #define OP_VRename 168
15808 #define OP_Pagecount 169
15809 #define OP_MaxPgcnt 170
15810 #define OP_Trace 171
15811 #define OP_CursorHint 172
15812 #define OP_ReleaseReg 173 /* synopsis: release r[P1@P2] mask P3 */
15813 #define OP_Noop 174
15814 #define OP_Explain 175
15815 #define OP_Abortable 176
 
15816
15817 /* Properties such as "out2" or "jump" that are specified in
15818 ** comments following the "case" for each opcode in the vdbe.c
15819 ** are encoded into bitvectors as follows:
15820 */
@@ -15839,17 +15882,17 @@
15839 /* 88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
15840 /* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
15841 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
15842 /* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
15843 /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15844 /* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\
15845 /* 136 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15846 /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00,\
15847 /* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15848 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15849 /* 168 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15850 /* 176 */ 0x00,}
15851
15852 /* The sqlite3P2Values() routine is able to run faster if it knows
15853 ** the value of the largest JUMP opcode. The smaller the maximum
15854 ** JUMP opcode the better, so the mkopcodeh.tcl script that
15855 ** generated this include file strives to group all JUMP opcodes
@@ -16905,11 +16948,11 @@
16905 u32 nSchemaLock; /* Do not reset the schema when non-zero */
16906 unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
16907 int errCode; /* Most recent error code (SQLITE_*) */
16908 int errMask; /* & result codes with this before returning */
16909 int iSysErrno; /* Errno value from last system error */
16910 u16 dbOptFlags; /* Flags to enable/disable optimizations */
16911 u8 enc; /* Text encoding */
16912 u8 autoCommit; /* The auto-commit flag. */
16913 u8 temp_store; /* 1: file 2: memory 0: default */
16914 u8 mallocFailed; /* True if we have seen a malloc failure */
16915 u8 bBenignMalloc; /* Do not require OOMs if true */
@@ -17112,28 +17155,30 @@
17112 /*
17113 ** Bits of the sqlite3.dbOptFlags field that are used by the
17114 ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
17115 ** selectively disable various optimizations.
17116 */
17117 #define SQLITE_QueryFlattener 0x0001 /* Query flattening */
17118 #define SQLITE_WindowFunc 0x0002 /* Use xInverse for window functions */
17119 #define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */
17120 #define SQLITE_FactorOutConst 0x0008 /* Constant factoring */
17121 #define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */
17122 #define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */
17123 #define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */
17124 #define SQLITE_Transitive 0x0080 /* Transitive constraints */
17125 #define SQLITE_OmitNoopJoin 0x0100 /* Omit unused tables in joins */
17126 #define SQLITE_CountOfView 0x0200 /* The count-of-view optimization */
17127 #define SQLITE_CursorHints 0x0400 /* Add OP_CursorHint opcodes */
17128 #define SQLITE_Stat4 0x0800 /* Use STAT4 data */
17129 /* TH3 expects the Stat4 ^^^^^^ value to be 0x0800. Don't change it */
17130 #define SQLITE_PushDown 0x1000 /* The push-down optimization */
17131 #define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */
17132 #define SQLITE_SkipScan 0x4000 /* Skip-scans */
17133 #define SQLITE_PropagateConst 0x8000 /* The constant propagation opt */
17134 #define SQLITE_AllOpts 0xffff /* All optimizations */
 
 
17135
17136 /*
17137 ** Macros for testing whether or not optimizations are enabled or disabled.
17138 */
17139 #define OptimizationDisabled(db, mask) (((db)->dbOptFlags&(mask))!=0)
@@ -17285,10 +17330,13 @@
17285 ** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions
17286 ** and functions like sqlite_version() that can change, but not during
17287 ** a single query. The iArg is ignored. The user-data is always set
17288 ** to a NULL pointer. The bNC parameter is not used.
17289 **
 
 
 
17290 ** PURE_DATE(zName, nArg, iArg, bNC, xFunc)
17291 ** Used for "pure" date/time functions, this macro is like DFUNCTION
17292 ** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is
17293 ** ignored and the user-data for these functions is set to an
17294 ** arbitrary non-NULL pointer. The bNC parameter is not used.
@@ -17320,10 +17368,13 @@
17320 {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
17321 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
17322 #define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
17323 {nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
17324 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
 
 
 
17325 #define INLINE_FUNC(zName, nArg, iArg, mFlags) \
17326 {nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
17327 SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
17328 #define TEST_FUNC(zName, nArg, iArg, mFlags) \
17329 {nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
@@ -17590,11 +17641,10 @@
17590 char **azModuleArg; /* 0: module 1: schema 2: vtab name 3...: args */
17591 VTable *pVTable; /* List of VTable objects. */
17592 #endif
17593 Trigger *pTrigger; /* List of triggers stored in pSchema */
17594 Schema *pSchema; /* Schema that contains this table */
17595 Table *pNextZombie; /* Next on the Parse.pZombieTab list */
17596 };
17597
17598 /*
17599 ** Allowed values for Table.tabFlags.
17600 **
@@ -17719,20 +17769,26 @@
17719 ** occurs. IGNORE means that the particular row that caused the constraint
17720 ** error is not inserted or updated. Processing continues and no error
17721 ** is returned. REPLACE means that preexisting database rows that caused
17722 ** a UNIQUE constraint violation are removed so that the new insert or
17723 ** update can proceed. Processing continues and no error is reported.
 
 
17724 **
17725 ** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.
17726 ** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
17727 ** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign
17728 ** key is set to NULL. CASCADE means that a DELETE or UPDATE of the
 
17729 ** referenced table row is propagated into the row that holds the
17730 ** foreign key.
 
 
 
17731 **
17732 ** The following symbolic values are used to record which type
17733 ** of action to take.
17734 */
17735 #define OE_None 0 /* There is no constraint to check */
17736 #define OE_Rollback 1 /* Fail the operation and rollback the transaction */
17737 #define OE_Abort 2 /* Back out changes but do no rollback transaction */
17738 #define OE_Fail 3 /* Stop the operation but leave all prior changes */
@@ -18114,11 +18170,11 @@
18114 ** TK_SELECT: 1st register of result vector */
18115 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
18116 ** TK_VARIABLE: variable number (always >= 1).
18117 ** TK_SELECT_COLUMN: column of the result vector */
18118 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
18119 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
18120 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
18121 union {
18122 Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
18123 ** for a column of an index on an expression */
18124 Window *pWin; /* EP_WinFunc: Window/Filter defn for a function */
@@ -18482,19 +18538,25 @@
18482 ** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
18483 ** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
18484 ** WHERE clause is omitted.
18485 */
18486 struct Upsert {
18487 ExprList *pUpsertTarget; /* Optional description of conflicting index */
18488 Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
18489 ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
18490 Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
18491 /* The fields above comprise the parse tree for the upsert clause.
18492 ** The fields below are used to transfer information from the INSERT
18493 ** processing down into the UPDATE processing while generating code.
18494 ** Upsert owns the memory allocated above, but not the memory below. */
18495 Index *pUpsertIdx; /* Constraint that pUpsertTarget identifies */
 
 
 
 
 
 
18496 SrcList *pUpsertSrc; /* Table to be updated */
18497 int regData; /* First register holding array of VALUES */
18498 int iDataCur; /* Index of the data cursor */
18499 int iIdxCur; /* Index of the first index cursor */
18500 };
@@ -18740,10 +18802,21 @@
18740 # define DbMaskSet(M,I) (M)|=(((yDbMask)1)<<(I))
18741 # define DbMaskAllZero(M) (M)==0
18742 # define DbMaskNonZero(M) (M)!=0
18743 #endif
18744
 
 
 
 
 
 
 
 
 
 
 
18745 /*
18746 ** An SQL parser context. A copy of this structure is passed through
18747 ** the parser and down into all the parser action routine in order to
18748 ** carry around information that is global to the entire parse.
18749 **
@@ -18771,10 +18844,13 @@
18771 u8 mayAbort; /* True if statement may throw an ABORT exception */
18772 u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
18773 u8 okConstFactor; /* OK to factor out constants */
18774 u8 disableLookaside; /* Number of times lookaside has been disabled */
18775 u8 disableVtab; /* Disable all virtual tables for this parse */
 
 
 
18776 int nRangeReg; /* Size of the temporary register block */
18777 int iRangeReg; /* First register in temporary register block */
18778 int nErr; /* Number of errors seen */
18779 int nTab; /* Number of previously allocated VDBE cursors */
18780 int nMem; /* Number of memory cells used so far */
@@ -18849,14 +18925,13 @@
18849 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
18850 #ifndef SQLITE_OMIT_VIRTUALTABLE
18851 Token sArg; /* Complete text of a module argument */
18852 Table **apVtabLock; /* Pointer to virtual tables needing locking */
18853 #endif
18854 Table *pZombieTab; /* List of Table objects to delete after code gen */
18855 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
18856 With *pWith; /* Current WITH clause, or NULL */
18857 With *pWithToFree; /* Free this WITH object at the end of the parse */
18858 #ifndef SQLITE_OMIT_ALTERTABLE
18859 RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
18860 #endif
18861 };
18862
@@ -18932,10 +19007,11 @@
18932 #define OPFLAG_P2ISREG 0x10 /* P2 to OP_Open** is a register number */
18933 #define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */
18934 #define OPFLAG_SAVEPOSITION 0x02 /* OP_Delete/Insert: save cursor pos */
18935 #define OPFLAG_AUXDELETE 0x04 /* OP_Delete: index in a DELETE op */
18936 #define OPFLAG_NOCHNG_MAGIC 0x6d /* OP_MakeRecord: serialtype 10 is ok */
 
18937
18938 /*
18939 * Each trigger present in the database schema is stored as an instance of
18940 * struct Trigger.
18941 *
@@ -19310,11 +19386,10 @@
19310 SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin);
19311 SQLITE_PRIVATE int sqlite3WindowCompare(Parse*, Window*, Window*, int);
19312 SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Select*);
19313 SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int);
19314 SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*);
19315 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*);
19316 SQLITE_PRIVATE void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*);
19317 SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p);
19318 SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p);
19319 SQLITE_PRIVATE void sqlite3WindowFunctions(void);
19320 SQLITE_PRIVATE void sqlite3WindowChain(Parse*, Window*, Window*);
@@ -19720,10 +19795,11 @@
19720 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
19721 SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
19722 SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
19723 SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
19724 SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo*);
 
19725 SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*);
19726 SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*);
19727 SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*);
19728 SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*);
19729 #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */
@@ -19966,10 +20042,11 @@
19966 SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr);
19967 SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
19968 SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
19969 SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
19970 SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
 
19971 SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
19972 SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
19973 SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
19974 SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
19975
@@ -20029,11 +20106,10 @@
20029 SQLITE_PRIVATE const char sqlite3StrBINARY[];
20030 SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
20031 SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
20032 SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;
20033 SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;
20034 SQLITE_API extern u32 sqlite3_unsupported_selecttrace;
20035 #ifndef SQLITE_OMIT_WSD
20036 SQLITE_PRIVATE int sqlite3PendingByte;
20037 #endif
20038 #endif /* SQLITE_AMALGAMATION */
20039 #ifdef VDBE_PROFILE
@@ -20048,10 +20124,11 @@
20048 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
20049 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
20050 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
20051 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
20052 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
 
20053 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
20054 SQLITE_PRIVATE int sqlite3MatchEName(
20055 const struct ExprList_item*,
20056 const char*,
20057 const char*,
@@ -20218,10 +20295,11 @@
20218 SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20219 SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
20220 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
20221 SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
20222 SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
 
20223 #ifdef SQLITE_ENABLE_NORMALIZE
20224 SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
20225 #endif
20226 SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
20227 SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
@@ -20240,19 +20318,23 @@
20240 #else
20241 #define sqlite3WithPush(x,y,z)
20242 #define sqlite3WithDelete(x,y)
20243 #endif
20244 #ifndef SQLITE_OMIT_UPSERT
20245 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*);
20246 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
20247 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
20248 SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
20249 SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
 
 
20250 #else
20251 #define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0)
20252 #define sqlite3UpsertDelete(x,y)
20253 #define sqlite3UpsertDup(x,y) ((Upsert*)0)
 
 
20254 #endif
20255
20256
20257 /* Declarations for functions in fkey.c. All of these are replaced by
20258 ** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
@@ -20744,13 +20826,14 @@
20744 #ifndef SQLITE_OMIT_WSD
20745 SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
20746 #endif
20747
20748 /*
20749 ** Flags for select tracing and the ".selecttrace" macro of the CLI
20750 */
20751 SQLITE_API u32 sqlite3_unsupported_selecttrace = 0;
 
20752
20753 /* #include "opcodes.h" */
20754 /*
20755 ** Properties of opcodes. The OPFLG_INITIALIZER macro is
20756 ** created by mkopcodeh.awk during compilation. Data is obtained
@@ -23170,10 +23253,12 @@
23170 SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
23171 if( id->pMethods==0 ) return SQLITE_NOTFOUND;
23172 #ifdef SQLITE_TEST
23173 if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
23174 && op!=SQLITE_FCNTL_LOCK_TIMEOUT
 
 
23175 ){
23176 /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
23177 ** is using a regular VFS, it is called after the corresponding
23178 ** transaction has been committed. Injecting a fault at this point
23179 ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
@@ -23180,11 +23265,16 @@
23180 ** but the transaction is committed anyway.
23181 **
23182 ** The core must call OsFileControl() though, not OsFileControlHint(),
23183 ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
23184 ** means the commit really has failed and an error should be returned
23185 ** to the user. */
 
 
 
 
 
23186 DO_OS_MALLOC_TEST(id);
23187 }
23188 #endif
23189 return id->pMethods->xFileControl(id, op, pArg);
23190 }
@@ -31381,10 +31471,20 @@
31381 SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
31382 assert( db!=0 );
31383 db->errCode = err_code;
31384 if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
31385 }
 
 
 
 
 
 
 
 
 
 
31386
31387 /*
31388 ** Load the sqlite3.iSysErrno field if that is an appropriate thing
31389 ** to do based on the SQLite error code in rc.
31390 */
@@ -33371,64 +33471,65 @@
33371 /* 118 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
33372 /* 119 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
33373 /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
33374 /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
33375 /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
33376 /* 123 */ "Delete" OpHelp(""),
33377 /* 124 */ "ResetCount" OpHelp(""),
33378 /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
33379 /* 126 */ "SorterData" OpHelp("r[P2]=data"),
33380 /* 127 */ "RowData" OpHelp("r[P2]=data"),
33381 /* 128 */ "Rowid" OpHelp("r[P2]=rowid"),
33382 /* 129 */ "NullRow" OpHelp(""),
33383 /* 130 */ "SeekEnd" OpHelp(""),
33384 /* 131 */ "IdxInsert" OpHelp("key=r[P2]"),
33385 /* 132 */ "SorterInsert" OpHelp("key=r[P2]"),
33386 /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
33387 /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
33388 /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"),
33389 /* 136 */ "FinishSeek" OpHelp(""),
33390 /* 137 */ "Destroy" OpHelp(""),
33391 /* 138 */ "Clear" OpHelp(""),
33392 /* 139 */ "ResetSorter" OpHelp(""),
33393 /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
33394 /* 141 */ "SqlExec" OpHelp(""),
33395 /* 142 */ "ParseSchema" OpHelp(""),
33396 /* 143 */ "LoadAnalysis" OpHelp(""),
33397 /* 144 */ "DropTable" OpHelp(""),
33398 /* 145 */ "DropIndex" OpHelp(""),
33399 /* 146 */ "DropTrigger" OpHelp(""),
33400 /* 147 */ "IntegrityCk" OpHelp(""),
33401 /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
33402 /* 149 */ "Param" OpHelp(""),
33403 /* 150 */ "Real" OpHelp("r[P2]=P4"),
33404 /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
33405 /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
33406 /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
33407 /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
33408 /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
33409 /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
33410 /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"),
33411 /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
33412 /* 159 */ "Expire" OpHelp(""),
33413 /* 160 */ "CursorLock" OpHelp(""),
33414 /* 161 */ "CursorUnlock" OpHelp(""),
33415 /* 162 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
33416 /* 163 */ "VBegin" OpHelp(""),
33417 /* 164 */ "VCreate" OpHelp(""),
33418 /* 165 */ "VDestroy" OpHelp(""),
33419 /* 166 */ "VOpen" OpHelp(""),
33420 /* 167 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
33421 /* 168 */ "VRename" OpHelp(""),
33422 /* 169 */ "Pagecount" OpHelp(""),
33423 /* 170 */ "MaxPgcnt" OpHelp(""),
33424 /* 171 */ "Trace" OpHelp(""),
33425 /* 172 */ "CursorHint" OpHelp(""),
33426 /* 173 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
33427 /* 174 */ "Noop" OpHelp(""),
33428 /* 175 */ "Explain" OpHelp(""),
33429 /* 176 */ "Abortable" OpHelp(""),
 
33430 };
33431 return azName[i];
33432 }
33433 #endif
33434
@@ -64147,10 +64248,11 @@
64147 BtShared *pNext; /* Next on a list of sharable BtShared structs */
64148 BtLock *pLock; /* List of locks held on this shared-btree struct */
64149 Btree *pWriter; /* Btree with currently open write transaction */
64150 #endif
64151 u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */
 
64152 };
64153
64154 /*
64155 ** Allowed values for BtShared.btsFlags
64156 */
@@ -65859,10 +65961,28 @@
65859 }else{
65860 pInfo->nLocal = (u16)minLocal;
65861 }
65862 pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
65863 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65864
65865 /*
65866 ** The following routines are implementations of the MemPage.xParseCell()
65867 ** method.
65868 **
@@ -73377,11 +73497,12 @@
73377 Btree *p = pCur->pBtree;
73378 BtShared *pBt = p->pBt;
73379 unsigned char *oldCell;
73380 unsigned char *newCell = 0;
73381
73382 assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND))==flags );
 
73383
73384 if( pCur->eState==CURSOR_FAULT ){
73385 assert( pCur->skipNext!=SQLITE_OK );
73386 return pCur->skipNext;
73387 }
@@ -73395,11 +73516,11 @@
73395 /* Assert that the caller has been consistent. If this cursor was opened
73396 ** expecting an index b-tree, then the caller should be inserting blob
73397 ** keys with no associated data. If the cursor was opened expecting an
73398 ** intkey table, the caller should be inserting integer keys with a
73399 ** blob of associated data. */
73400 assert( (pX->pKey==0)==(pCur->pKeyInfo==0) );
73401
73402 /* Save the positions of any other cursors open on this table.
73403 **
73404 ** In some cases, the call to btreeMoveto() below is a no-op. For
73405 ** example, when inserting data into a table with auto-generated integer
@@ -73505,11 +73626,11 @@
73505 assert( pCur->eState==CURSOR_VALID
73506 || (pCur->eState==CURSOR_INVALID && loc)
73507 || CORRUPT_DB );
73508
73509 pPage = pCur->pPage;
73510 assert( pPage->intKey || pX->nKey>=0 );
73511 assert( pPage->leaf || !pPage->intKey );
73512 if( pPage->nFree<0 ){
73513 if( pCur->eState>CURSOR_INVALID ){
73514 rc = SQLITE_CORRUPT_BKPT;
73515 }else{
@@ -73522,11 +73643,25 @@
73522 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
73523 loc==0 ? "overwrite" : "new entry"));
73524 assert( pPage->isInit );
73525 newCell = pBt->pTmpSpace;
73526 assert( newCell!=0 );
73527 rc = fillInCell(pPage, newCell, pX, &szNew);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73528 if( rc ) goto end_insert;
73529 assert( szNew==pPage->xCellSize(pPage, newCell) );
73530 assert( szNew <= MX_CELL_SIZE(pBt) );
73531 idx = pCur->ix;
73532 if( loc==0 ){
@@ -73626,10 +73761,118 @@
73626 }
73627 }
73628 assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );
73629
73630 end_insert:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73631 return rc;
73632 }
73633
73634 /*
73635 ** Delete the entry that the cursor is pointing to.
@@ -80340,10 +80583,12 @@
80340 assert( p!=0 );
80341 assert( p->nOp>0 );
80342 assert( pParse!=0 );
80343 assert( p->magic==VDBE_MAGIC_INIT );
80344 assert( pParse==p->pParse );
 
 
80345 db = p->db;
80346 assert( db->mallocFailed==0 );
80347 nVar = pParse->nVar;
80348 nMem = pParse->nMem;
80349 nCursor = pParse->nTab;
@@ -80424,12 +80669,10 @@
80424 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
80425 #endif
80426 }
80427 }
80428
80429 p->pVList = pParse->pVList;
80430 pParse->pVList = 0;
80431 if( db->mallocFailed ){
80432 p->nVar = 0;
80433 p->nCursor = 0;
80434 p->nMem = 0;
80435 }else{
@@ -85414,11 +85657,11 @@
85414 testcase( zRawSql[0]=='#' );
85415 idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken);
85416 assert( idx>0 );
85417 }
85418 zRawSql += nToken;
85419 nextIndex = idx + 1;
85420 assert( idx>0 && idx<=p->nVar );
85421 pVar = &p->aVar[idx-1];
85422 if( pVar->flags & MEM_Null ){
85423 sqlite3_str_append(&out, "NULL", 4);
85424 }else if( pVar->flags & (MEM_Int|MEM_IntReal) ){
@@ -90701,11 +90944,12 @@
90701 }else{
90702 x.nZero = 0;
90703 }
90704 x.pKey = 0;
90705 rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
90706 (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)), seekResult
 
90707 );
90708 pC->deferredMoveto = 0;
90709 pC->cacheStatus = CACHE_STALE;
90710
90711 /* Invoke the update-hook if required. */
@@ -90717,10 +90961,37 @@
90717 (pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,
90718 zDb, pTab->zName, x.nKey);
90719 }
90720 break;
90721 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90722
90723 /* Opcode: Delete P1 P2 P3 P4 P5
90724 **
90725 ** Delete the record at which the P1 cursor is currently pointing.
90726 **
@@ -91373,11 +91644,11 @@
91373 pC = p->apCsr[pOp->p1];
91374 sqlite3VdbeIncrWriteCounter(p, pC);
91375 assert( pC!=0 );
91376 assert( !isSorter(pC) );
91377 pIn2 = &aMem[pOp->p2];
91378 assert( pIn2->flags & MEM_Blob );
91379 if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
91380 assert( pC->eCurType==CURTYPE_BTREE );
91381 assert( pC->isTable==0 );
91382 rc = ExpandBlob(pIn2);
91383 if( rc ) goto abort_due_to_error;
@@ -91384,11 +91655,11 @@
91384 x.nKey = pIn2->n;
91385 x.pKey = pIn2->z;
91386 x.aMem = aMem + pOp->p3;
91387 x.nMem = (u16)pOp->p4.i;
91388 rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
91389 (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)),
91390 ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
91391 );
91392 assert( pC->deferredMoveto==0 );
91393 pC->cacheStatus = CACHE_STALE;
91394 if( rc) goto abort_due_to_error;
@@ -97975,11 +98246,11 @@
97975 #if !defined(SQLITE_OMIT_WINDOWFUNC)
97976 /*
97977 ** Walk all expressions linked into the list of Window objects passed
97978 ** as the second argument.
97979 */
97980 static int walkWindowList(Walker *pWalker, Window *pList){
97981 Window *pWin;
97982 for(pWin=pList; pWin; pWin=pWin->pNextWin){
97983 int rc;
97984 rc = sqlite3WalkExprList(pWalker, pWin->pOrderBy);
97985 if( rc ) return WRC_Abort;
@@ -97994,10 +98265,11 @@
97994 ** not matter anyhow. */
97995 rc = sqlite3WalkExpr(pWalker, pWin->pStart);
97996 if( NEVER(rc) ) return WRC_Abort;
97997 rc = sqlite3WalkExpr(pWalker, pWin->pEnd);
97998 if( NEVER(rc) ) return WRC_Abort;
 
97999 }
98000 return WRC_Continue;
98001 }
98002 #endif
98003
@@ -98041,11 +98313,11 @@
98041 if( pExpr->x.pList ){
98042 if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
98043 }
98044 #ifndef SQLITE_OMIT_WINDOWFUNC
98045 if( ExprHasProperty(pExpr, EP_WinFunc) ){
98046 if( walkWindowList(pWalker, pExpr->y.pWin) ) return WRC_Abort;
98047 }
98048 #endif
98049 }
98050 }
98051 break;
@@ -98088,11 +98360,11 @@
98088 {
98089 Parse *pParse = pWalker->pParse;
98090 if( pParse && IN_RENAME_OBJECT ){
98091 /* The following may return WRC_Abort if there are unresolvable
98092 ** symbols (e.g. a table that does not exist) in a window definition. */
98093 int rc = walkWindowList(pWalker, p->pWinDefn);
98094 return rc;
98095 }
98096 }
98097 #endif
98098 return WRC_Continue;
@@ -100258,11 +100530,22 @@
100258 Parse *pParse, /* Parsing context */
100259 Expr *pExpr, /* Add the "COLLATE" clause to this expression */
100260 const Token *pCollName, /* Name of collating sequence */
100261 int dequote /* True to dequote pCollName */
100262 ){
100263 if( pCollName->n>0 ){
 
 
 
 
 
 
 
 
 
 
 
100264 Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);
100265 if( pNew ){
100266 pNew->pLeft = pExpr;
100267 pNew->flags |= EP_Collate|EP_Skip;
100268 pExpr = pNew;
@@ -106634,15 +106917,18 @@
106634 u32 savedDbFlags = db->mDbFlags;
106635 while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
106636 *zEnd-- = '\0';
106637 }
106638 db->mDbFlags |= DBFLAG_PreferBuiltin;
 
 
106639 sqlite3NestedParse(pParse,
106640 "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
106641 "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
 
106642 "WHERE type = 'table' AND name = %Q",
106643 zDb, pNew->addColOffset, zCol, pNew->addColOffset+1,
106644 zTab
106645 );
106646 sqlite3DbFree(db, zCol);
106647 db->mDbFlags = savedDbFlags;
106648 }
@@ -110798,15 +111084,11 @@
110798
110799 /* Don't do any authorization checks if the database is initialising
110800 ** or if the parser is being invoked from within sqlite3_declare_vtab.
110801 */
110802 assert( !IN_RENAME_OBJECT || db->xAuth==0 );
110803 if( db->init.busy || IN_SPECIAL_PARSE ){
110804 return SQLITE_OK;
110805 }
110806
110807 if( db->xAuth==0 ){
110808 return SQLITE_OK;
110809 }
110810
110811 /* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the
110812 ** callback are either NULL pointers or zero-terminated strings that
@@ -111008,10 +111290,14 @@
111008 }
111009
111010 /* Begin by generating some termination code at the end of the
111011 ** vdbe program
111012 */
 
 
 
 
111013 v = sqlite3GetVdbe(pParse);
111014 assert( !pParse->isMultiWrite
111015 || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
111016 if( v ){
111017 sqlite3VdbeAddOp0(v, OP_Halt);
@@ -112120,10 +112406,12 @@
112120 int i;
112121 char *z;
112122 char *zType;
112123 Column *pCol;
112124 sqlite3 *db = pParse->db;
 
 
112125 if( (p = pParse->pNewTable)==0 ) return;
112126 if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
112127 sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
112128 return;
112129 }
@@ -112131,12 +112419,13 @@
112131 if( z==0 ) return;
112132 if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName);
112133 memcpy(z, pName->z, pName->n);
112134 z[pName->n] = 0;
112135 sqlite3Dequote(z);
 
112136 for(i=0; i<p->nCol; i++){
112137 if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){
112138 sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
112139 sqlite3DbFree(db, z);
112140 return;
112141 }
112142 }
@@ -112150,11 +112439,11 @@
112150 p->aCol = aNew;
112151 }
112152 pCol = &p->aCol[p->nCol];
112153 memset(pCol, 0, sizeof(p->aCol[0]));
112154 pCol->zName = z;
112155 pCol->hName = sqlite3StrIHash(z);
112156 sqlite3ColumnPropertiesFromName(p, pCol);
112157
112158 if( pType->n==0 ){
112159 /* If there is no type specified, columns have the default affinity
112160 ** 'BLOB' with a default size of 4 bytes. */
@@ -113426,11 +113715,11 @@
113426 assert( !pSelect && pCons && pEnd );
113427 if( pCons->z==0 ){
113428 pCons = pEnd;
113429 }
113430 nName = (int)((const char *)pCons->z - zName);
113431 p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
113432 }
113433 #endif
113434 }
113435 }
113436
@@ -119441,10 +119730,206 @@
119441 }
119442
119443 *pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;
119444 return 1;
119445 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119446
119447 /*
119448 ** All of the FuncDef structures in the aBuiltinFunc[] array above
119449 ** to the global function hash table. This occurs at start-time (as
119450 ** a consequence of calling sqlite3_initialize()).
@@ -119560,10 +120045,47 @@
119560 #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
119561 FUNCTION(unknown, -1, 0, 0, unknownFunc ),
119562 #endif
119563 FUNCTION(coalesce, 1, 0, 0, 0 ),
119564 FUNCTION(coalesce, 0, 0, 0, 0 ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119565 INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
119566 INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
119567 };
119568 #ifndef SQLITE_OMIT_ALTERTABLE
119569 sqlite3AlterFunctions();
@@ -121413,11 +121935,13 @@
121413
121414 pInfo = pToplevel->pAinc;
121415 while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
121416 if( pInfo==0 ){
121417 pInfo = sqlite3DbMallocRawNN(pParse->db, sizeof(*pInfo));
121418 if( pInfo==0 ) return 0;
 
 
121419 pInfo->pNext = pToplevel->pAinc;
121420 pToplevel->pAinc = pInfo;
121421 pInfo->pTab = pTab;
121422 pInfo->iDb = iDb;
121423 pToplevel->nMem++; /* Register to hold name of table */
@@ -122018,10 +122542,11 @@
122018 }
122019 aRegIdx[i] = ++pParse->nMem; /* Register to store the table record */
122020 }
122021 #ifndef SQLITE_OMIT_UPSERT
122022 if( pUpsert ){
 
122023 if( IsVirtual(pTab) ){
122024 sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
122025 pTab->zName);
122026 goto insert_cleanup;
122027 }
@@ -122031,17 +122556,21 @@
122031 }
122032 if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){
122033 goto insert_cleanup;
122034 }
122035 pTabList->a[0].iCursor = iDataCur;
122036 pUpsert->pUpsertSrc = pTabList;
122037 pUpsert->regData = regData;
122038 pUpsert->iDataCur = iDataCur;
122039 pUpsert->iIdxCur = iIdxCur;
122040 if( pUpsert->pUpsertTarget ){
122041 sqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert);
122042 }
 
 
 
 
122043 }
122044 #endif
122045
122046
122047 /* This is the top of the main insertion loop */
@@ -122441,10 +122970,74 @@
122441 testcase( w.eCode==CKCNSTRNT_COLUMN );
122442 testcase( w.eCode==CKCNSTRNT_ROWID );
122443 testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
122444 return w.eCode!=0;
122445 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122446
122447 /*
122448 ** Generate code to do constraint checks prior to an INSERT or an UPDATE
122449 ** on table pTab.
122450 **
@@ -122550,32 +123143,33 @@
122550 int *aiChng, /* column i is unchanged if aiChng[i]<0 */
122551 Upsert *pUpsert /* ON CONFLICT clauses, if any. NULL otherwise */
122552 ){
122553 Vdbe *v; /* VDBE under constrution */
122554 Index *pIdx; /* Pointer to one of the indices */
122555 Index *pPk = 0; /* The PRIMARY KEY index */
122556 sqlite3 *db; /* Database connection */
122557 int i; /* loop counter */
122558 int ix; /* Index loop counter */
122559 int nCol; /* Number of columns */
122560 int onError; /* Conflict resolution strategy */
122561 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
122562 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
122563 Index *pUpIdx = 0; /* Index to which to apply the upsert */
122564 u8 isUpdate; /* True if this is an UPDATE operation */
122565 u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
122566 int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */
122567 int upsertJump = 0; /* Address of Goto that jumps into upsert subroutine */
122568 int ipkTop = 0; /* Top of the IPK uniqueness check */
122569 int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */
122570 /* Variables associated with retesting uniqueness constraints after
122571 ** replace triggers fire have run */
122572 int regTrigCnt; /* Register used to count replace trigger invocations */
122573 int addrRecheck = 0; /* Jump here to recheck all uniqueness constraints */
122574 int lblRecheckOk = 0; /* Each recheck jumps to this label if it passes */
122575 Trigger *pTrigger; /* List of DELETE triggers on the table pTab */
122576 int nReplaceTrig = 0; /* Number of replace triggers coded */
 
122577
122578 isUpdate = regOldData!=0;
122579 db = pParse->db;
122580 v = pParse->pVdbe;
122581 assert( v!=0 );
@@ -122769,23 +123363,67 @@
122769 **
122770 ** The ordering of (2) and (3) is accomplished by making sure the linked
122771 ** list of indexes attached to a table puts all OE_Replace indexes last
122772 ** in the list. See sqlite3CreateIndex() for where that happens.
122773 */
122774
 
 
 
122775 if( pUpsert ){
122776 if( pUpsert->pUpsertTarget==0 ){
122777 /* An ON CONFLICT DO NOTHING clause, without a constraint-target.
122778 ** Make all unique constraint resolution be OE_Ignore */
122779 assert( pUpsert->pUpsertSet==0 );
122780 overrideError = OE_Ignore;
122781 pUpsert = 0;
122782 }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
122783 /* If the constraint-target uniqueness check must be run first.
122784 ** Jump to that uniqueness check now */
122785 upsertJump = sqlite3VdbeAddOp0(v, OP_Goto);
122786 VdbeComment((v, "UPSERT constraint goes first"));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122787 }
122788 }
122789
122790 /* Determine if it is possible that triggers (either explicitly coded
122791 ** triggers or FK resolution actions) might run as a result of deletes
@@ -122844,25 +123482,34 @@
122844 }else if( onError==OE_Default ){
122845 onError = OE_Abort;
122846 }
122847
122848 /* figure out whether or not upsert applies in this case */
122849 if( pUpsert && pUpsert->pUpsertIdx==0 ){
122850 if( pUpsert->pUpsertSet==0 ){
122851 onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
122852 }else{
122853 onError = OE_Update; /* DO UPDATE */
 
 
 
 
 
 
 
 
 
122854 }
122855 }
122856
122857 /* If the response to a rowid conflict is REPLACE but the response
122858 ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
122859 ** to defer the running of the rowid conflict checking until after
122860 ** the UNIQUE constraints have run.
122861 */
122862 if( onError==OE_Replace /* IPK rule is REPLACE */
122863 && onError!=overrideError /* Rules for other contraints are different */
122864 && pTab->pIndex /* There exist other constraints */
122865 ){
122866 ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
122867 VdbeComment((v, "defer IPK REPLACE until last"));
122868 }
@@ -122955,11 +123602,13 @@
122955 sqlite3VdbeGoto(v, ignoreDest);
122956 break;
122957 }
122958 }
122959 sqlite3VdbeResolveLabel(v, addrRowidOk);
122960 if( ipkTop ){
 
 
122961 ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
122962 sqlite3VdbeJumpHere(v, ipkTop-1);
122963 }
122964 }
122965
@@ -122968,27 +123617,29 @@
122968 ** Compute the revised record entries for indices as we go.
122969 **
122970 ** This loop also handles the case of the PRIMARY KEY index for a
122971 ** WITHOUT ROWID table.
122972 */
122973 for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
 
 
 
122974 int regIdx; /* Range of registers hold conent for pIdx */
122975 int regR; /* Range of registers holding conflicting PK */
122976 int iThisCur; /* Cursor for this UNIQUE index */
122977 int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
122978 int addrConflictCk; /* First opcode in the conflict check logic */
122979
122980 if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
122981 if( pUpIdx==pIdx ){
122982 addrUniqueOk = upsertJump+1;
122983 upsertBypass = sqlite3VdbeGoto(v, 0);
122984 VdbeComment((v, "Skip upsert subroutine"));
122985 sqlite3VdbeJumpHere(v, upsertJump);
122986 }else{
122987 addrUniqueOk = sqlite3VdbeMakeLabel(pParse);
122988 }
122989 if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
122990 sqlite3TableAffinity(v, pTab, regNewData+1);
122991 bAffinityDone = 1;
122992 }
122993 VdbeNoopComment((v, "prep index %s", pIdx->zName));
122994 iThisCur = iIdxCur+ix;
@@ -123055,12 +123706,12 @@
123055 }else if( onError==OE_Default ){
123056 onError = OE_Abort;
123057 }
123058
123059 /* Figure out if the upsert clause applies to this index */
123060 if( pUpIdx==pIdx ){
123061 if( pUpsert->pUpsertSet==0 ){
123062 onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
123063 }else{
123064 onError = OE_Update; /* DO UPDATE */
123065 }
123066 }
@@ -123094,11 +123745,11 @@
123094 addrConflictCk =
123095 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
123096 regIdx, pIdx->nKeyCol); VdbeCoverage(v);
123097
123098 /* Generate code to handle collisions */
123099 regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
123100 if( isUpdate || onError==OE_Replace ){
123101 if( HasRowid(pTab) ){
123102 sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
123103 /* Conflict only if the rowid of the existing index entry
123104 ** is different from old-rowid */
@@ -123246,17 +123897,20 @@
123246 }
123247 seenReplace = 1;
123248 break;
123249 }
123250 }
123251 if( pUpIdx==pIdx ){
123252 sqlite3VdbeGoto(v, upsertJump+1);
123253 sqlite3VdbeJumpHere(v, upsertBypass);
123254 }else{
123255 sqlite3VdbeResolveLabel(v, addrUniqueOk);
123256 }
123257 if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
 
 
 
 
 
 
 
 
123258 }
123259
123260 /* If the IPK constraint is a REPLACE, run it last */
123261 if( ipkTop ){
123262 sqlite3VdbeGoto(v, ipkTop);
@@ -123791,10 +124445,11 @@
123791 sqlite3CodeVerifySchema(pParse, iDbSrc);
123792 iSrc = pParse->nTab++;
123793 iDest = pParse->nTab++;
123794 regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
123795 regData = sqlite3GetTempReg(pParse);
 
123796 regRowid = sqlite3GetTempReg(pParse);
123797 sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
123798 assert( HasRowid(pDest) || destHasUniqueIdx );
123799 if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
123800 (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
@@ -123826,32 +124481,44 @@
123826 u8 insFlags;
123827 sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
123828 emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
123829 if( pDest->iPKey>=0 ){
123830 addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
123831 sqlite3VdbeVerifyAbortable(v, onError);
123832 addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
123833 VdbeCoverage(v);
123834 sqlite3RowidConstraint(pParse, onError, pDest);
123835 sqlite3VdbeJumpHere(v, addr2);
 
 
123836 autoIncStep(pParse, regAutoinc, regRowid);
123837 }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_VacuumInto) ){
123838 addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
123839 }else{
123840 addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
123841 assert( (pDest->tabFlags & TF_Autoincrement)==0 );
123842 }
 
123843 if( db->mDbFlags & DBFLAG_Vacuum ){
123844 sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
123845 insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT;
123846 }else{
123847 insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND;
123848 }
123849 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
 
 
 
 
 
 
 
 
123850 sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
123851 (char*)pDest, P4_TABLE);
123852 sqlite3VdbeChangeP5(v, insFlags);
 
123853 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
123854 sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
123855 sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
123856 }else{
123857 sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);
@@ -123889,17 +124556,20 @@
123889 for(i=0; i<pSrcIdx->nColumn; i++){
123890 const char *zColl = pSrcIdx->azColl[i];
123891 if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
123892 }
123893 if( i==pSrcIdx->nColumn ){
123894 idxInsFlags = OPFLAG_USESEEKRESULT;
123895 sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
 
123896 }
123897 }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
123898 idxInsFlags |= OPFLAG_NCHANGE;
123899 }
123900 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
 
 
123901 sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
123902 sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
123903 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
123904 sqlite3VdbeJumpHere(v, addr1);
123905 sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
@@ -128940,15 +129610,22 @@
128940
128941 assert( iDb>=0 && iDb<db->nDb );
128942 if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
128943 if( argv[3]==0 ){
128944 corruptSchema(pData, argv[1], 0);
128945 }else if( sqlite3_strnicmp(argv[4],"create ",7)==0 ){
 
 
128946 /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
128947 ** But because db->init.busy is set to 1, no VDBE code is generated
128948 ** or executed. All the parser does is build the internal data
128949 ** structures that describe the table, index, or view.
 
 
 
 
 
128950 */
128951 int rc;
128952 u8 saved_iDb = db->init.iDb;
128953 sqlite3_stmt *pStmt;
128954 TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
@@ -129401,19 +130078,66 @@
129401 while( pThis ){
129402 AggInfo *pNext = pThis->pNext;
129403 agginfoFree(db, pThis);
129404 pThis = pNext;
129405 }
 
 
 
 
 
 
129406 sqlite3DbFree(db, pParse->aLabel);
129407 sqlite3ExprListDelete(db, pParse->pConstExpr);
 
 
129408 if( db ){
129409 assert( db->lookaside.bDisable >= pParse->disableLookaside );
129410 db->lookaside.bDisable -= pParse->disableLookaside;
129411 db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue;
129412 }
129413 pParse->disableLookaside = 0;
129414 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129415
129416 /*
129417 ** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
129418 */
129419 static int sqlite3Prepare(
@@ -129509,16 +130233,10 @@
129509 }else{
129510 sqlite3RunParser(&sParse, zSql, &zErrMsg);
129511 }
129512 assert( 0==sParse.nQueryLoop );
129513
129514 if( sParse.rc==SQLITE_DONE ){
129515 sParse.rc = SQLITE_OK;
129516 }
129517 if( sParse.checkSchema ){
129518 schemaIsValid(&sParse);
129519 }
129520 if( pzTail ){
129521 *pzTail = sParse.zTail;
129522 }
129523
129524 if( db->init.busy==0 ){
@@ -129525,24 +130243,32 @@
129525 sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
129526 }
129527 if( db->mallocFailed ){
129528 sParse.rc = SQLITE_NOMEM_BKPT;
129529 }
129530 rc = sParse.rc;
129531 if( rc!=SQLITE_OK ){
129532 if( sParse.pVdbe ) sqlite3VdbeFinalize(sParse.pVdbe);
129533 assert(!(*ppStmt));
 
 
 
 
 
 
 
 
 
 
 
129534 }else{
 
129535 *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
 
 
129536 }
129537
129538 if( zErrMsg ){
129539 sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
129540 sqlite3DbFree(db, zErrMsg);
129541 }else{
129542 sqlite3Error(db, rc);
129543 }
129544
129545 /* Delete any TriggerPrg structures allocated while parsing this statement. */
129546 while( sParse.pTriggerPrg ){
129547 TriggerPrg *pT = sParse.pTriggerPrg;
129548 sParse.pTriggerPrg = pT->pNext;
@@ -130146,11 +130872,11 @@
130146 pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
130147 if( pEq && isOuterJoin ){
130148 ExprSetProperty(pEq, EP_FromJoin);
130149 assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
130150 ExprSetVVAProperty(pEq, EP_NoReduce);
130151 pEq->iRightJoinTable = (i16)pE2->iTable;
130152 }
130153 *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
130154 }
130155
130156 /*
@@ -130182,11 +130908,11 @@
130182 SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){
130183 while( p ){
130184 ExprSetProperty(p, EP_FromJoin);
130185 assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );
130186 ExprSetVVAProperty(p, EP_NoReduce);
130187 p->iRightJoinTable = (i16)iTable;
130188 if( p->op==TK_FUNCTION && p->x.pList ){
130189 int i;
130190 for(i=0; i<p->x.pList->nExpr; i++){
130191 sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable);
130192 }
@@ -133448,10 +134174,92 @@
133448 pSrcItem->colUsed = 0;
133449 sqlite3WalkSelect(&w, pSelect);
133450 }
133451 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
133452
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133453 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
133454 /*
133455 ** This routine attempts to flatten subqueries as a performance optimization.
133456 ** This routine returns 1 if it makes changes and 0 if no flattening occurs.
133457 **
@@ -133542,13 +134350,13 @@
133542 ** (17b) no terms within the subquery compound may be aggregate
133543 ** or DISTINCT, and
133544 ** (17c) every term within the subquery compound must have a FROM clause
133545 ** (17d) the outer query may not be
133546 ** (17d1) aggregate, or
133547 ** (17d2) DISTINCT, or
133548 ** (17d3) a join.
133549 ** (17e) the subquery may not contain window functions
133550 **
133551 ** The parent and sub-query may contain WHERE clauses. Subject to
133552 ** rules (11), (13) and (14), they may also contain ORDER BY,
133553 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
133554 ** operator other than UNION ALL because all the other compound
@@ -133560,12 +134368,12 @@
133560 ** SELECT statement, but all the code here does is make sure that no
133561 ** such (illegal) sub-query is flattened. The caller will detect the
133562 ** syntax error and return a detailed message.
133563 **
133564 ** (18) If the sub-query is a compound select, then all terms of the
133565 ** ORDER BY clause of the parent must be simple references to
133566 ** columns of the sub-query.
133567 **
133568 ** (19) If the subquery uses LIMIT then the outer query may not
133569 ** have a WHERE clause.
133570 **
133571 ** (20) If the sub-query is a compound select, then it must not use
@@ -133577,13 +134385,12 @@
133577 ** (21) If the subquery uses LIMIT then the outer query may not be
133578 ** DISTINCT. (See ticket [752e1646fc]).
133579 **
133580 ** (22) The subquery may not be a recursive CTE.
133581 **
133582 ** (**) Subsumed into restriction (17d3). Was: If the outer query is
133583 ** a recursive CTE, then the sub-query may not be a compound query.
133584 ** This restriction is because transforming the
133585 ** parent to a compound query confuses the code that handles
133586 ** recursive queries in multiSelect().
133587 **
133588 ** (**) We no longer attempt to flatten aggregate subqueries. Was:
133589 ** The subquery may not be an aggregate that uses the built-in min() or
@@ -133624,10 +134431,11 @@
133624 int i; /* Loop counter */
133625 Expr *pWhere; /* The WHERE clause */
133626 struct SrcList_item *pSubitem; /* The subquery */
133627 sqlite3 *db = pParse->db;
133628 Walker w; /* Walker to persist agginfo data */
 
133629
133630 /* Check to see if flattening is permitted. Return 0 if not.
133631 */
133632 assert( p!=0 );
133633 assert( p->pPrior==0 );
@@ -133719,17 +134527,18 @@
133719 */
133720 if( pSub->pPrior ){
133721 if( pSub->pOrderBy ){
133722 return 0; /* Restriction (20) */
133723 }
133724 if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
133725 return 0; /* (17d1), (17d2), or (17d3) */
133726 }
133727 for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
133728 testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );
133729 testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );
133730 assert( pSub->pSrc!=0 );
 
133731 assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );
133732 if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */
133733 || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */
133734 || pSub1->pSrc->nSrc<1 /* (17c) */
133735 #ifndef SQLITE_OMIT_WINDOWFUNC
@@ -133746,19 +134555,18 @@
133746 int ii;
133747 for(ii=0; ii<p->pOrderBy->nExpr; ii++){
133748 if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;
133749 }
133750 }
133751 }
133752
133753 /* Ex-restriction (23):
133754 ** The only way that the recursive part of a CTE can contain a compound
133755 ** subquery is for the subquery to be one term of a join. But if the
133756 ** subquery is a join, then the flattening has already been stopped by
133757 ** restriction (17d3)
133758 */
133759 assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );
133760
133761 /***** If we reach this point, flattening is permitted. *****/
133762 SELECTTRACE(1,pParse,p,("flatten %u.%p from term %d\n",
133763 pSub->selId, pSub, iFrom));
133764
@@ -133765,10 +134573,21 @@
133765 /* Authorize the subquery */
133766 pParse->zAuthContext = pSubitem->zName;
133767 TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);
133768 testcase( i==SQLITE_DENY );
133769 pParse->zAuthContext = zSavedAuthContext;
 
 
 
 
 
 
 
 
 
 
 
133770
133771 /* If the sub-query is a compound SELECT statement, then (by restrictions
133772 ** 17 and 18 above) it must be a UNION ALL and the parent query must
133773 ** be of the form:
133774 **
@@ -133804,47 +134623,40 @@
133804 for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){
133805 Select *pNew;
133806 ExprList *pOrderBy = p->pOrderBy;
133807 Expr *pLimit = p->pLimit;
133808 Select *pPrior = p->pPrior;
 
 
133809 p->pOrderBy = 0;
133810 p->pSrc = 0;
133811 p->pPrior = 0;
133812 p->pLimit = 0;
133813 pNew = sqlite3SelectDup(db, p, 0);
133814 p->pLimit = pLimit;
133815 p->pOrderBy = pOrderBy;
133816 p->pSrc = pSrc;
133817 p->op = TK_ALL;
 
133818 if( pNew==0 ){
133819 p->pPrior = pPrior;
133820 }else{
 
 
 
133821 pNew->pPrior = pPrior;
133822 if( pPrior ) pPrior->pNext = pNew;
133823 pNew->pNext = p;
133824 p->pPrior = pNew;
133825 SELECTTRACE(2,pParse,p,("compound-subquery flattener"
133826 " creates %u as peer\n",pNew->selId));
133827 }
133828 if( db->mallocFailed ) return 1;
133829 }
133830
133831 /* Begin flattening the iFrom-th entry of the FROM clause
133832 ** in the outer query.
133833 */
133834 pSub = pSub1 = pSubitem->pSelect;
133835
133836 /* Delete the transient table structure associated with the
133837 ** subquery
133838 */
133839 sqlite3DbFree(db, pSubitem->zDatabase);
133840 sqlite3DbFree(db, pSubitem->zName);
133841 sqlite3DbFree(db, pSubitem->zAlias);
133842 pSubitem->zDatabase = 0;
133843 pSubitem->zName = 0;
133844 pSubitem->zAlias = 0;
133845 pSubitem->pSelect = 0;
133846
133847 /* Defer deleting the Table object associated with the
133848 ** subquery until code generation is
133849 ** complete, since there may still exist Expr.pTab entries that
133850 ** refer to the subquery even after flattening. Ticket #3346.
@@ -133853,12 +134665,14 @@
133853 */
133854 if( ALWAYS(pSubitem->pTab!=0) ){
133855 Table *pTabToDel = pSubitem->pTab;
133856 if( pTabToDel->nTabRef==1 ){
133857 Parse *pToplevel = sqlite3ParseToplevel(pParse);
133858 pTabToDel->pNextZombie = pToplevel->pZombieTab;
133859 pToplevel->pZombieTab = pTabToDel;
 
 
133860 }else{
133861 pTabToDel->nTabRef--;
133862 }
133863 pSubitem->pTab = 0;
133864 }
@@ -133874,26 +134688,21 @@
133874 ** iParent. The iParent cursor will never be used. Subsequent code
133875 ** will scan expressions looking for iParent references and replace
133876 ** those references with expressions that resolve to the subquery FROM
133877 ** elements we are now copying in.
133878 */
 
133879 for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
133880 int nSubSrc;
133881 u8 jointype = 0;
133882 assert( pSub!=0 );
133883 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
133884 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
133885 pSrc = pParent->pSrc; /* FROM clause of the outer query */
133886
133887 if( pSrc ){
133888 assert( pParent==p ); /* First time through the loop */
133889 jointype = pSubitem->fg.jointype;
133890 }else{
133891 assert( pParent!=p ); /* 2nd and subsequent times through the loop */
133892 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
133893 if( pSrc==0 ) break;
133894 pParent->pSrc = pSrc;
133895 }
133896
133897 /* The subquery uses a single slot of the FROM clause of the outer
133898 ** query. If the subquery has more than one element in its FROM clause,
133899 ** then expand the outer query to make space for it to hold all elements
@@ -134009,11 +134818,11 @@
134009 sqlite3AggInfoPersistWalkerInit(&w, pParse);
134010 sqlite3WalkSelect(&w,pSub1);
134011 sqlite3SelectDelete(db, pSub1);
134012
134013 #if SELECTTRACE_ENABLED
134014 if( sqlite3_unsupported_selecttrace & 0x100 ){
134015 SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
134016 sqlite3TreeViewSelect(0, p, 0);
134017 }
134018 #endif
134019
@@ -134356,11 +135165,15 @@
134356 u8 sortFlags = 0;
134357
134358 assert( *ppMinMax==0 );
134359 assert( pFunc->op==TK_AGG_FUNCTION );
134360 assert( !IsWindowFunc(pFunc) );
134361 if( pEList==0 || pEList->nExpr!=1 || ExprHasProperty(pFunc, EP_WinFunc) ){
 
 
 
 
134362 return eRet;
134363 }
134364 zFunc = pFunc->u.zToken;
134365 if( sqlite3StrICmp(zFunc, "min")==0 ){
134366 eRet = WHERE_ORDERBY_MIN;
@@ -134574,16 +135387,20 @@
134574 ** should be freed along with the Parse object. In other cases, when
134575 ** bFree==0, the With object will be freed along with the SELECT
134576 ** statement with which it is associated.
134577 */
134578 SQLITE_PRIVATE void sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){
134579 assert( bFree==0 || (pParse->pWith==0 && pParse->pWithToFree==0) );
134580 if( pWith ){
134581 assert( pParse->pWith!=pWith );
134582 pWith->pOuter = pParse->pWith;
134583 pParse->pWith = pWith;
134584 if( bFree ) pParse->pWithToFree = pWith;
 
 
 
 
 
134585 }
134586 }
134587
134588 /*
134589 ** This function checks if argument pFrom refers to a CTE declared by
@@ -135414,11 +136231,13 @@
135414 ** within the HAVING expression with a constant "1".
135415 */
135416 static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){
135417 if( pExpr->op!=TK_AND ){
135418 Select *pS = pWalker->u.pSelect;
135419 if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
 
 
135420 sqlite3 *db = pWalker->pParse->db;
135421 Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1");
135422 if( pNew ){
135423 Expr *pWhere = pS->pWhere;
135424 SWAP(Expr, *pNew, *pExpr);
@@ -135453,11 +136272,11 @@
135453 sWalker.pParse = pParse;
135454 sWalker.xExprCallback = havingToWhereExprCb;
135455 sWalker.u.pSelect = p;
135456 sqlite3WalkExpr(&sWalker, p->pHaving);
135457 #if SELECTTRACE_ENABLED
135458 if( sWalker.eCode && (sqlite3_unsupported_selecttrace & 0x100)!=0 ){
135459 SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
135460 sqlite3TreeViewSelect(0, p, 0);
135461 }
135462 #endif
135463 }
@@ -135575,11 +136394,11 @@
135575 }
135576 p->pEList->a[0].pExpr = pExpr;
135577 p->selFlags &= ~SF_Aggregate;
135578
135579 #if SELECTTRACE_ENABLED
135580 if( sqlite3_unsupported_selecttrace & 0x400 ){
135581 SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
135582 sqlite3TreeViewSelect(0, p, 0);
135583 }
135584 #endif
135585 return 1;
@@ -135628,11 +136447,11 @@
135628 return 1;
135629 }
135630 if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
135631 #if SELECTTRACE_ENABLED
135632 SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
135633 if( sqlite3_unsupported_selecttrace & 0x100 ){
135634 sqlite3TreeViewSelect(0, p, 0);
135635 }
135636 #endif
135637
135638 assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );
@@ -135653,11 +136472,11 @@
135653 if( pParse->nErr || db->mallocFailed ){
135654 goto select_end;
135655 }
135656 assert( p->pEList!=0 );
135657 #if SELECTTRACE_ENABLED
135658 if( sqlite3_unsupported_selecttrace & 0x104 ){
135659 SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
135660 sqlite3TreeViewSelect(0, p, 0);
135661 }
135662 #endif
135663
@@ -135688,11 +136507,11 @@
135688 if( rc ){
135689 assert( db->mallocFailed || pParse->nErr>0 );
135690 goto select_end;
135691 }
135692 #if SELECTTRACE_ENABLED
135693 if( p->pWin && (sqlite3_unsupported_selecttrace & 0x108)!=0 ){
135694 SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n"));
135695 sqlite3TreeViewSelect(0, p, 0);
135696 }
135697 #endif
135698 #endif /* SQLITE_OMIT_WINDOWFUNC */
@@ -135795,11 +136614,11 @@
135795 */
135796 if( p->pPrior ){
135797 rc = multiSelect(pParse, p, pDest);
135798 #if SELECTTRACE_ENABLED
135799 SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
135800 if( (sqlite3_unsupported_selecttrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
135801 sqlite3TreeViewSelect(0, p, 0);
135802 }
135803 #endif
135804 if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
135805 return rc;
@@ -135814,11 +136633,11 @@
135814 if( pTabList->nSrc>1
135815 && OptimizationEnabled(db, SQLITE_PropagateConst)
135816 && propagateConstants(pParse, p)
135817 ){
135818 #if SELECTTRACE_ENABLED
135819 if( sqlite3_unsupported_selecttrace & 0x100 ){
135820 SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
135821 sqlite3TreeViewSelect(0, p, 0);
135822 }
135823 #endif
135824 }else{
@@ -135902,11 +136721,11 @@
135902 if( OptimizationEnabled(db, SQLITE_PushDown)
135903 && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
135904 (pItem->fg.jointype & JT_OUTER)!=0)
135905 ){
135906 #if SELECTTRACE_ENABLED
135907 if( sqlite3_unsupported_selecttrace & 0x100 ){
135908 SELECTTRACE(0x100,pParse,p,
135909 ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
135910 sqlite3TreeViewSelect(0, p, 0);
135911 }
135912 #endif
@@ -136002,11 +136821,11 @@
136002 pGroupBy = p->pGroupBy;
136003 pHaving = p->pHaving;
136004 sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;
136005
136006 #if SELECTTRACE_ENABLED
136007 if( sqlite3_unsupported_selecttrace & 0x400 ){
136008 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
136009 sqlite3TreeViewSelect(0, p, 0);
136010 }
136011 #endif
136012
@@ -136038,11 +136857,11 @@
136038 ** the sDistinct.isTnct is still set. Hence, isTnct represents the
136039 ** original setting of the SF_Distinct flag, not the current setting */
136040 assert( sDistinct.isTnct );
136041
136042 #if SELECTTRACE_ENABLED
136043 if( sqlite3_unsupported_selecttrace & 0x400 ){
136044 SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
136045 sqlite3TreeViewSelect(0, p, 0);
136046 }
136047 #endif
136048 }
@@ -136286,14 +137105,18 @@
136286 sNC.ncFlags &= ~NC_InAggFunc;
136287 }
136288 pAggInfo->mxReg = pParse->nMem;
136289 if( db->mallocFailed ) goto select_end;
136290 #if SELECTTRACE_ENABLED
136291 if( sqlite3_unsupported_selecttrace & 0x400 ){
136292 int ii;
136293 SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
136294 sqlite3TreeViewSelect(0, p, 0);
 
 
 
 
136295 for(ii=0; ii<pAggInfo->nColumn; ii++){
136296 sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
136297 ii, pAggInfo->aCol[ii].iMem);
136298 sqlite3TreeViewExpr(0, pAggInfo->aCol[ii].pCExpr, 0);
136299 }
@@ -136479,11 +137302,11 @@
136479 VdbeComment((v, "indicate data in accumulator"));
136480
136481 /* End of the loop
136482 */
136483 if( groupBySort ){
136484 sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx, addrTopOfLoop);
136485 VdbeCoverage(v);
136486 }else{
136487 sqlite3WhereEnd(pWInfo);
136488 sqlite3VdbeChangeToNoop(v, addrSortingIdx);
136489 }
@@ -136591,11 +137414,10 @@
136591 sqlite3VdbeAddOp2(v, OP_Count, iCsr, pAggInfo->aFunc[0].iMem);
136592 sqlite3VdbeAddOp1(v, OP_Close, iCsr);
136593 explainSimpleCount(pParse, pTab, pBest);
136594 }else{
136595 int regAcc = 0; /* "populate accumulators" flag */
136596 int addrSkip;
136597
136598 /* If there are accumulator registers but no min() or max() functions
136599 ** without FILTER clauses, allocate register regAcc. Register regAcc
136600 ** will contain 0 the first time the inner loop runs, and 1 thereafter.
136601 ** The code generated by updateAccumulator() uses this to ensure
@@ -136640,13 +137462,12 @@
136640 if( pWInfo==0 ){
136641 goto select_end;
136642 }
136643 updateAccumulator(pParse, regAcc, pAggInfo);
136644 if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
136645 addrSkip = sqlite3WhereOrderByLimitOptLabel(pWInfo);
136646 if( addrSkip!=sqlite3WhereContinueLabel(pWInfo) ){
136647 sqlite3VdbeGoto(v, addrSkip);
136648 }
136649 sqlite3WhereEnd(pWInfo);
136650 finalizeAggFunctions(pParse, pAggInfo);
136651 }
136652
@@ -136688,28 +137509,26 @@
136688 sqlite3ExprListDelete(db, pMinMaxOrderBy);
136689 #ifdef SQLITE_DEBUG
136690 if( pAggInfo && !db->mallocFailed ){
136691 for(i=0; i<pAggInfo->nColumn; i++){
136692 Expr *pExpr = pAggInfo->aCol[i].pCExpr;
136693 assert( pExpr!=0 || db->mallocFailed );
136694 if( pExpr==0 ) continue;
136695 assert( pExpr->pAggInfo==pAggInfo );
136696 assert( pExpr->iAgg==i );
136697 }
136698 for(i=0; i<pAggInfo->nFunc; i++){
136699 Expr *pExpr = pAggInfo->aFunc[i].pFExpr;
136700 assert( pExpr!=0 || db->mallocFailed );
136701 if( pExpr==0 ) continue;
136702 assert( pExpr->pAggInfo==pAggInfo );
136703 assert( pExpr->iAgg==i );
136704 }
136705 }
136706 #endif
136707
136708 #if SELECTTRACE_ENABLED
136709 SELECTTRACE(0x1,pParse,p,("end processing\n"));
136710 if( (sqlite3_unsupported_selecttrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
136711 sqlite3TreeViewSelect(0, p, 0);
136712 }
136713 #endif
136714 ExplainQueryPlanPop(pParse);
136715 return rc;
@@ -137918,11 +138737,10 @@
137918 pPrg->aColmask[0] = pSubParse->oldmask;
137919 pPrg->aColmask[1] = pSubParse->newmask;
137920 sqlite3VdbeDelete(v);
137921 }
137922
137923 assert( !pSubParse->pAinc && !pSubParse->pZombieTab );
137924 assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg );
137925 sqlite3ParserReset(pSubParse);
137926 sqlite3StackFree(db, pSubParse);
137927
137928 return pPrg;
@@ -139476,19 +140294,26 @@
139476
139477 #ifndef SQLITE_OMIT_UPSERT
139478 /*
139479 ** Free a list of Upsert objects
139480 */
139481 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
139482 if( p ){
 
139483 sqlite3ExprListDelete(db, p->pUpsertTarget);
139484 sqlite3ExprDelete(db, p->pUpsertTargetWhere);
139485 sqlite3ExprListDelete(db, p->pUpsertSet);
139486 sqlite3ExprDelete(db, p->pUpsertWhere);
 
139487 sqlite3DbFree(db, p);
139488 }
 
139489 }
 
 
 
 
139490
139491 /*
139492 ** Duplicate an Upsert object.
139493 */
139494 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
@@ -139495,11 +140320,12 @@
139495 if( p==0 ) return 0;
139496 return sqlite3UpsertNew(db,
139497 sqlite3ExprListDup(db, p->pUpsertTarget, 0),
139498 sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
139499 sqlite3ExprListDup(db, p->pUpsertSet, 0),
139500 sqlite3ExprDup(db, p->pUpsertWhere, 0)
 
139501 );
139502 }
139503
139504 /*
139505 ** Create a new Upsert object.
@@ -139507,26 +140333,29 @@
139507 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
139508 sqlite3 *db, /* Determines which memory allocator to use */
139509 ExprList *pTarget, /* Target argument to ON CONFLICT, or NULL */
139510 Expr *pTargetWhere, /* Optional WHERE clause on the target */
139511 ExprList *pSet, /* UPDATE columns, or NULL for a DO NOTHING */
139512 Expr *pWhere /* WHERE clause for the ON CONFLICT UPDATE */
 
139513 ){
139514 Upsert *pNew;
139515 pNew = sqlite3DbMallocRaw(db, sizeof(Upsert));
139516 if( pNew==0 ){
139517 sqlite3ExprListDelete(db, pTarget);
139518 sqlite3ExprDelete(db, pTargetWhere);
139519 sqlite3ExprListDelete(db, pSet);
139520 sqlite3ExprDelete(db, pWhere);
 
139521 return 0;
139522 }else{
139523 pNew->pUpsertTarget = pTarget;
139524 pNew->pUpsertTargetWhere = pTargetWhere;
139525 pNew->pUpsertSet = pSet;
139526 pNew->pUpsertWhere = pWhere;
139527 pNew->pUpsertIdx = 0;
 
139528 }
139529 return pNew;
139530 }
139531
139532 /*
@@ -139547,10 +140376,11 @@
139547 Index *pIdx; /* One of the indexes of pTab */
139548 ExprList *pTarget; /* The conflict-target clause */
139549 Expr *pTerm; /* One term of the conflict-target clause */
139550 NameContext sNC; /* Context for resolving symbolic names */
139551 Expr sCol[2]; /* Index column converted into an Expr */
 
139552
139553 assert( pTabList->nSrc==1 );
139554 assert( pTabList->a[0].pTab!=0 );
139555 assert( pUpsert!=0 );
139556 assert( pUpsert->pUpsertTarget!=0 );
@@ -139560,91 +140390,135 @@
139560 ** WHERE clause.
139561 */
139562 memset(&sNC, 0, sizeof(sNC));
139563 sNC.pParse = pParse;
139564 sNC.pSrcList = pTabList;
139565 rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
139566 if( rc ) return rc;
139567 rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
139568 if( rc ) return rc;
139569
139570 /* Check to see if the conflict target matches the rowid. */
139571 pTab = pTabList->a[0].pTab;
139572 pTarget = pUpsert->pUpsertTarget;
139573 iCursor = pTabList->a[0].iCursor;
139574 if( HasRowid(pTab)
139575 && pTarget->nExpr==1
139576 && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
139577 && pTerm->iColumn==XN_ROWID
139578 ){
139579 /* The conflict-target is the rowid of the primary table */
139580 assert( pUpsert->pUpsertIdx==0 );
139581 return SQLITE_OK;
139582 }
139583
139584 /* Initialize sCol[0..1] to be an expression parse tree for a
139585 ** single column of an index. The sCol[0] node will be the TK_COLLATE
139586 ** operator and sCol[1] will be the TK_COLUMN operator. Code below
139587 ** will populate the specific collation and column number values
139588 ** prior to comparing against the conflict-target expression.
139589 */
139590 memset(sCol, 0, sizeof(sCol));
139591 sCol[0].op = TK_COLLATE;
139592 sCol[0].pLeft = &sCol[1];
139593 sCol[1].op = TK_COLUMN;
139594 sCol[1].iTable = pTabList->a[0].iCursor;
139595
139596 /* Check for matches against other indexes */
139597 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
139598 int ii, jj, nn;
139599 if( !IsUniqueIndex(pIdx) ) continue;
139600 if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
139601 if( pIdx->pPartIdxWhere ){
139602 if( pUpsert->pUpsertTargetWhere==0 ) continue;
139603 if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
139604 pIdx->pPartIdxWhere, iCursor)!=0 ){
139605 continue;
139606 }
139607 }
139608 nn = pIdx->nKeyCol;
139609 for(ii=0; ii<nn; ii++){
139610 Expr *pExpr;
139611 sCol[0].u.zToken = (char*)pIdx->azColl[ii];
139612 if( pIdx->aiColumn[ii]==XN_EXPR ){
139613 assert( pIdx->aColExpr!=0 );
139614 assert( pIdx->aColExpr->nExpr>ii );
139615 pExpr = pIdx->aColExpr->a[ii].pExpr;
139616 if( pExpr->op!=TK_COLLATE ){
139617 sCol[0].pLeft = pExpr;
139618 pExpr = &sCol[0];
139619 }
139620 }else{
139621 sCol[0].pLeft = &sCol[1];
139622 sCol[1].iColumn = pIdx->aiColumn[ii];
139623 pExpr = &sCol[0];
139624 }
139625 for(jj=0; jj<nn; jj++){
139626 if( sqlite3ExprCompare(pParse, pTarget->a[jj].pExpr, pExpr,iCursor)<2 ){
139627 break; /* Column ii of the index matches column jj of target */
139628 }
139629 }
139630 if( jj>=nn ){
139631 /* The target contains no match for column jj of the index */
139632 break;
139633 }
139634 }
139635 if( ii<nn ){
139636 /* Column ii of the index did not match any term of the conflict target.
139637 ** Continue the search with the next index. */
139638 continue;
139639 }
139640 pUpsert->pUpsertIdx = pIdx;
139641 return SQLITE_OK;
139642 }
139643 sqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any "
139644 "PRIMARY KEY or UNIQUE constraint");
139645 return SQLITE_ERROR;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139646 }
139647
139648 /*
139649 ** Generate bytecode that does an UPDATE as part of an upsert.
139650 **
@@ -139664,15 +140538,17 @@
139664 Vdbe *v = pParse->pVdbe;
139665 sqlite3 *db = pParse->db;
139666 SrcList *pSrc; /* FROM clause for the UPDATE */
139667 int iDataCur;
139668 int i;
 
139669
139670 assert( v!=0 );
139671 assert( pUpsert!=0 );
139672 VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
139673 iDataCur = pUpsert->iDataCur;
 
 
139674 if( pIdx && iCur!=iDataCur ){
139675 if( HasRowid(pTab) ){
139676 int regRowid = sqlite3GetTempReg(pParse);
139677 sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
139678 sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
@@ -139698,23 +140574,21 @@
139698 "corrupt database", P4_STATIC);
139699 sqlite3MayAbort(pParse);
139700 sqlite3VdbeJumpHere(v, i);
139701 }
139702 }
139703 /* pUpsert does not own pUpsertSrc - the outer INSERT statement does. So
139704 ** we have to make a copy before passing it down into sqlite3Update() */
139705 pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0);
139706 /* excluded.* columns of type REAL need to be converted to a hard real */
139707 for(i=0; i<pTab->nCol; i++){
139708 if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
139709 sqlite3VdbeAddOp1(v, OP_RealAffinity, pUpsert->regData+i);
139710 }
139711 }
139712 sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet,
139713 pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert);
139714 pUpsert->pUpsertSet = 0; /* Will have been deleted by sqlite3Update() */
139715 pUpsert->pUpsertWhere = 0; /* Will have been deleted by sqlite3Update() */
139716 VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
139717 }
139718
139719 #endif /* SQLITE_OMIT_UPSERT */
139720
@@ -141487,23 +142361,10 @@
141487 ** a separate source file for easier editing.
141488 */
141489 #ifndef SQLITE_WHEREINT_H
141490 #define SQLITE_WHEREINT_H
141491
141492 /*
141493 ** Trace output macros
141494 */
141495 #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
141496 /***/ extern int sqlite3WhereTrace;
141497 #endif
141498 #if defined(SQLITE_DEBUG) \
141499 && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
141500 # define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
141501 # define WHERETRACE_ENABLED 1
141502 #else
141503 # define WHERETRACE(K,X)
141504 #endif
141505
141506 /* Forward references
141507 */
141508 typedef struct WhereClause WhereClause;
141509 typedef struct WhereMaskSet WhereMaskSet;
@@ -145573,10 +146434,275 @@
145573 }
145574 if( mPrereq==0 ) return 0; /* No table references */
145575 if( (mPrereq&(mPrereq-1))!=0 ) return 0; /* Refs more than one table */
145576 return exprMightBeIndexed2(pFrom,mPrereq,aiCurCol,pExpr);
145577 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145578
145579 /*
145580 ** The input to this routine is an WhereTerm structure with only the
145581 ** "pExpr" field filled in. The job of this routine is to analyze the
145582 ** subexpression and populate all the other fields of the WhereTerm
@@ -145758,10 +146884,20 @@
145758 assert( pWC->op==TK_AND );
145759 exprAnalyzeOrTerm(pSrc, pWC, idxTerm);
145760 pTerm = &pWC->a[idxTerm];
145761 }
145762 #endif /* SQLITE_OMIT_OR_OPTIMIZATION */
 
 
 
 
 
 
 
 
 
 
145763
145764 #ifndef SQLITE_OMIT_LIKE_OPTIMIZATION
145765 /* Add constraints to reduce the search space on a LIKE or GLOB
145766 ** operator.
145767 **
@@ -146219,16 +147355,10 @@
146219 Parse *pParse; /* The parsing context */
146220 };
146221
146222 /* Forward declaration of methods */
146223 static int whereLoopResize(sqlite3*, WhereLoop*, int);
146224
146225 /* Test variable that can be set to enable WHERE tracing */
146226 #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
146227 /***/ int sqlite3WhereTrace = 0;
146228 #endif
146229
146230
146231 /*
146232 ** Return the estimated number of output rows from a WHERE clause
146233 */
146234 SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
@@ -146287,10 +147417,36 @@
146287 }
146288 pInner = &pWInfo->a[pWInfo->nLevel-1];
146289 assert( pInner->addrNxt!=0 );
146290 return pInner->addrNxt;
146291 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146292
146293 /*
146294 ** Return the VDBE address or label to jump to in order to continue
146295 ** immediately with the next row of a WHERE clause.
146296 */
@@ -148794,11 +149950,11 @@
148794 pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm
148795 );
148796 pBtm = pTerm;
148797 pTop = 0;
148798 if( pTerm->wtFlags & TERM_LIKEOPT ){
148799 /* Range contraints that come from the LIKE optimization are
148800 ** always used in pairs. */
148801 pTop = &pTerm[1];
148802 assert( (pTop-(pTerm->pWC->a))<pTerm->pWC->nTerm );
148803 assert( pTop->wtFlags & TERM_LIKEOPT );
148804 assert( pTop->eOperator==WO_LT );
@@ -155319,22 +156475,22 @@
155319 #define sqlite3ParserCTX_PDECL ,Parse *pParse
155320 #define sqlite3ParserCTX_PARAM ,pParse
155321 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
155322 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
155323 #define YYFALLBACK 1
155324 #define YYNSTATE 553
155325 #define YYNRULE 385
155326 #define YYNRULE_WITH_ACTION 325
155327 #define YYNTOKEN 181
155328 #define YY_MAX_SHIFT 552
155329 #define YY_MIN_SHIFTREDUCE 803
155330 #define YY_MAX_SHIFTREDUCE 1187
155331 #define YY_ERROR_ACTION 1188
155332 #define YY_ACCEPT_ACTION 1189
155333 #define YY_NO_ACTION 1190
155334 #define YY_MIN_REDUCE 1191
155335 #define YY_MAX_REDUCE 1575
155336 /************* End control #defines *******************************************/
155337 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
155338
155339 /* Define the yytestcase() macro to be a no-op if is not already defined
155340 ** otherwise.
@@ -155397,209 +156553,209 @@
155397 ** yy_reduce_ofst[] For each state, the offset into yy_action for
155398 ** shifting non-terminals after a reduce.
155399 ** yy_default[] Default action for each state.
155400 **
155401 *********** Begin parsing tables **********************************************/
155402 #define YY_ACTTAB_COUNT (1962)
155403 static const YYACTIONTYPE yy_action[] = {
155404 /* 0 */ 546, 1222, 546, 451, 1260, 546, 1239, 546, 114, 111,
155405 /* 10 */ 211, 546, 1537, 546, 1260, 523, 114, 111, 211, 392,
155406 /* 20 */ 1232, 344, 42, 42, 42, 42, 1225, 42, 42, 71,
155407 /* 30 */ 71, 937, 1224, 71, 71, 71, 71, 1462, 1493, 938,
155408 /* 40 */ 820, 453, 6, 121, 122, 112, 1165, 1165, 1006, 1009,
155409 /* 50 */ 999, 999, 119, 119, 120, 120, 120, 120, 1543, 392,
155410 /* 60 */ 1358, 1517, 552, 2, 1193, 194, 528, 436, 143, 291,
155411 /* 70 */ 528, 136, 528, 371, 261, 504, 272, 385, 1273, 527,
155412 /* 80 */ 503, 493, 164, 121, 122, 112, 1165, 1165, 1006, 1009,
155413 /* 90 */ 999, 999, 119, 119, 120, 120, 120, 120, 1358, 442,
155414 /* 100 */ 1514, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155415 /* 110 */ 115, 424, 266, 266, 266, 266, 1498, 358, 1500, 435,
155416 /* 120 */ 357, 1498, 517, 524, 1485, 543, 1114, 543, 1114, 392,
155417 /* 130 */ 405, 241, 208, 114, 111, 211, 98, 290, 537, 221,
155418 /* 140 */ 1029, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155419 /* 150 */ 115, 424, 1142, 121, 122, 112, 1165, 1165, 1006, 1009,
155420 /* 160 */ 999, 999, 119, 119, 120, 120, 120, 120, 406, 428,
155421 /* 170 */ 117, 117, 116, 116, 116, 115, 424, 1418, 468, 123,
155422 /* 180 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
155423 /* 190 */ 424, 116, 116, 116, 115, 424, 540, 540, 540, 392,
155424 /* 200 */ 505, 120, 120, 120, 120, 113, 1051, 1142, 1143, 1144,
155425 /* 210 */ 1051, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155426 /* 220 */ 115, 424, 1461, 121, 122, 112, 1165, 1165, 1006, 1009,
155427 /* 230 */ 999, 999, 119, 119, 120, 120, 120, 120, 392, 444,
155428 /* 240 */ 316, 83, 463, 81, 359, 382, 1142, 80, 118, 118,
155429 /* 250 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 179,
155430 /* 260 */ 434, 424, 121, 122, 112, 1165, 1165, 1006, 1009, 999,
155431 /* 270 */ 999, 119, 119, 120, 120, 120, 120, 434, 433, 266,
155432 /* 280 */ 266, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155433 /* 290 */ 115, 424, 543, 1109, 903, 506, 1142, 114, 111, 211,
155434 /* 300 */ 1431, 1142, 1143, 1144, 206, 491, 1109, 392, 449, 1109,
155435 /* 310 */ 545, 330, 120, 120, 120, 120, 298, 1431, 1433, 17,
155436 /* 320 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
155437 /* 330 */ 424, 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999,
155438 /* 340 */ 119, 119, 120, 120, 120, 120, 392, 1358, 434, 1142,
155439 /* 350 */ 482, 1142, 1143, 1144, 996, 996, 1007, 1010, 445, 118,
155440 /* 360 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 424,
155441 /* 370 */ 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155442 /* 380 */ 119, 120, 120, 120, 120, 1054, 1054, 465, 1431, 118,
155443 /* 390 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 424,
155444 /* 400 */ 1142, 451, 546, 1426, 1142, 1143, 1144, 233, 966, 1142,
155445 /* 410 */ 481, 478, 477, 171, 360, 392, 164, 407, 414, 842,
155446 /* 420 */ 476, 164, 185, 334, 71, 71, 1243, 1000, 118, 118,
155447 /* 430 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 121,
155448 /* 440 */ 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119, 119,
155449 /* 450 */ 120, 120, 120, 120, 392, 1142, 1143, 1144, 835, 12,
155450 /* 460 */ 314, 509, 163, 356, 1142, 1143, 1144, 114, 111, 211,
155451 /* 470 */ 508, 290, 537, 546, 276, 180, 290, 537, 121, 122,
155452 /* 480 */ 112, 1165, 1165, 1006, 1009, 999, 999, 119, 119, 120,
155453 /* 490 */ 120, 120, 120, 345, 484, 71, 71, 118, 118, 118,
155454 /* 500 */ 118, 117, 117, 116, 116, 116, 115, 424, 1142, 209,
155455 /* 510 */ 411, 523, 1142, 1109, 1571, 378, 252, 269, 342, 487,
155456 /* 520 */ 337, 486, 238, 392, 513, 364, 1109, 1127, 333, 1109,
155457 /* 530 */ 191, 409, 286, 32, 457, 443, 118, 118, 118, 118,
155458 /* 540 */ 117, 117, 116, 116, 116, 115, 424, 121, 122, 112,
155459 /* 550 */ 1165, 1165, 1006, 1009, 999, 999, 119, 119, 120, 120,
155460 /* 560 */ 120, 120, 392, 1142, 1143, 1144, 987, 1142, 1143, 1144,
155461 /* 570 */ 1142, 233, 492, 1492, 481, 478, 477, 6, 163, 546,
155462 /* 580 */ 512, 546, 115, 424, 476, 5, 121, 122, 112, 1165,
155463 /* 590 */ 1165, 1006, 1009, 999, 999, 119, 119, 120, 120, 120,
155464 /* 600 */ 120, 13, 13, 13, 13, 118, 118, 118, 118, 117,
155465 /* 610 */ 117, 116, 116, 116, 115, 424, 403, 502, 408, 546,
155466 /* 620 */ 1486, 544, 1142, 892, 892, 1142, 1143, 1144, 1473, 1142,
155467 /* 630 */ 275, 392, 808, 809, 810, 971, 422, 422, 422, 16,
155468 /* 640 */ 16, 55, 55, 1242, 118, 118, 118, 118, 117, 117,
155469 /* 650 */ 116, 116, 116, 115, 424, 121, 122, 112, 1165, 1165,
155470 /* 660 */ 1006, 1009, 999, 999, 119, 119, 120, 120, 120, 120,
155471 /* 670 */ 392, 1189, 1, 1, 552, 2, 1193, 1142, 1143, 1144,
155472 /* 680 */ 194, 291, 898, 136, 1142, 1143, 1144, 897, 521, 1492,
155473 /* 690 */ 1273, 3, 380, 6, 121, 122, 112, 1165, 1165, 1006,
155474 /* 700 */ 1009, 999, 999, 119, 119, 120, 120, 120, 120, 858,
155475 /* 710 */ 546, 924, 546, 118, 118, 118, 118, 117, 117, 116,
155476 /* 720 */ 116, 116, 115, 424, 266, 266, 1092, 1569, 1142, 551,
155477 /* 730 */ 1569, 1193, 13, 13, 13, 13, 291, 543, 136, 392,
155478 /* 740 */ 485, 421, 420, 966, 344, 1273, 468, 410, 859, 279,
155479 /* 750 */ 140, 221, 118, 118, 118, 118, 117, 117, 116, 116,
155480 /* 760 */ 116, 115, 424, 121, 122, 112, 1165, 1165, 1006, 1009,
155481 /* 770 */ 999, 999, 119, 119, 120, 120, 120, 120, 546, 266,
155482 /* 780 */ 266, 428, 392, 1142, 1143, 1144, 1172, 830, 1172, 468,
155483 /* 790 */ 431, 145, 543, 1146, 401, 314, 439, 302, 838, 1490,
155484 /* 800 */ 71, 71, 412, 6, 1090, 473, 221, 100, 112, 1165,
155485 /* 810 */ 1165, 1006, 1009, 999, 999, 119, 119, 120, 120, 120,
155486 /* 820 */ 120, 118, 118, 118, 118, 117, 117, 116, 116, 116,
155487 /* 830 */ 115, 424, 237, 1425, 546, 451, 428, 287, 986, 546,
155488 /* 840 */ 236, 235, 234, 830, 97, 529, 429, 1265, 1265, 1146,
155489 /* 850 */ 494, 307, 430, 838, 977, 546, 71, 71, 976, 1241,
155490 /* 860 */ 546, 51, 51, 300, 118, 118, 118, 118, 117, 117,
155491 /* 870 */ 116, 116, 116, 115, 424, 194, 103, 70, 70, 266,
155492 /* 880 */ 266, 546, 71, 71, 266, 266, 30, 391, 344, 976,
155493 /* 890 */ 976, 978, 543, 528, 1109, 328, 392, 543, 495, 397,
155494 /* 900 */ 1470, 195, 530, 13, 13, 1358, 240, 1109, 277, 280,
155495 /* 910 */ 1109, 280, 304, 457, 306, 333, 392, 31, 188, 419,
155496 /* 920 */ 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155497 /* 930 */ 119, 120, 120, 120, 120, 142, 392, 365, 457, 986,
155498 /* 940 */ 121, 122, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155499 /* 950 */ 119, 120, 120, 120, 120, 977, 323, 1142, 326, 976,
155500 /* 960 */ 121, 110, 112, 1165, 1165, 1006, 1009, 999, 999, 119,
155501 /* 970 */ 119, 120, 120, 120, 120, 464, 377, 1185, 118, 118,
155502 /* 980 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 1142,
155503 /* 990 */ 976, 976, 978, 305, 9, 366, 244, 362, 118, 118,
155504 /* 1000 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 313,
155505 /* 1010 */ 546, 344, 1142, 1143, 1144, 299, 290, 537, 118, 118,
155506 /* 1020 */ 118, 118, 117, 117, 116, 116, 116, 115, 424, 1263,
155507 /* 1030 */ 1263, 1163, 13, 13, 278, 421, 420, 468, 392, 923,
155508 /* 1040 */ 260, 260, 289, 1169, 1142, 1143, 1144, 189, 1171, 266,
155509 /* 1050 */ 266, 468, 390, 543, 1186, 546, 1170, 263, 144, 489,
155510 /* 1060 */ 922, 546, 543, 122, 112, 1165, 1165, 1006, 1009, 999,
155511 /* 1070 */ 999, 119, 119, 120, 120, 120, 120, 71, 71, 1142,
155512 /* 1080 */ 1172, 1272, 1172, 13, 13, 898, 1070, 1163, 546, 468,
155513 /* 1090 */ 897, 107, 538, 1491, 4, 1268, 1109, 6, 525, 1049,
155514 /* 1100 */ 12, 1071, 1092, 1570, 312, 455, 1570, 520, 541, 1109,
155515 /* 1110 */ 56, 56, 1109, 1489, 423, 1358, 1072, 6, 345, 285,
155516 /* 1120 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
155517 /* 1130 */ 424, 425, 1271, 321, 1142, 1143, 1144, 878, 266, 266,
155518 /* 1140 */ 1277, 107, 538, 535, 4, 1488, 293, 879, 1211, 6,
155519 /* 1150 */ 210, 543, 543, 164, 294, 496, 416, 204, 541, 267,
155520 /* 1160 */ 267, 1214, 398, 511, 499, 204, 266, 266, 396, 531,
155521 /* 1170 */ 8, 986, 543, 519, 546, 922, 458, 105, 105, 543,
155522 /* 1180 */ 1090, 425, 266, 266, 106, 417, 425, 548, 547, 266,
155523 /* 1190 */ 266, 976, 518, 535, 1373, 543, 15, 15, 266, 266,
155524 /* 1200 */ 456, 1120, 543, 266, 266, 1070, 1372, 515, 290, 537,
155525 /* 1210 */ 546, 543, 514, 97, 444, 316, 543, 546, 922, 125,
155526 /* 1220 */ 1071, 986, 976, 976, 978, 979, 27, 105, 105, 401,
155527 /* 1230 */ 343, 1511, 44, 44, 106, 1072, 425, 548, 547, 57,
155528 /* 1240 */ 57, 976, 343, 1511, 107, 538, 546, 4, 462, 401,
155529 /* 1250 */ 214, 1120, 459, 297, 377, 1091, 534, 1309, 546, 539,
155530 /* 1260 */ 398, 541, 290, 537, 104, 244, 102, 526, 58, 58,
155531 /* 1270 */ 546, 199, 976, 976, 978, 979, 27, 1516, 1131, 427,
155532 /* 1280 */ 59, 59, 270, 237, 425, 138, 95, 375, 375, 374,
155533 /* 1290 */ 255, 372, 60, 60, 817, 1180, 535, 546, 273, 546,
155534 /* 1300 */ 1163, 1308, 389, 388, 546, 438, 546, 215, 210, 296,
155535 /* 1310 */ 515, 849, 546, 265, 208, 516, 1476, 295, 274, 61,
155536 /* 1320 */ 61, 62, 62, 308, 986, 109, 45, 45, 46, 46,
155537 /* 1330 */ 105, 105, 1186, 922, 47, 47, 341, 106, 546, 425,
155538 /* 1340 */ 548, 547, 1542, 546, 976, 867, 340, 217, 546, 937,
155539 /* 1350 */ 397, 107, 538, 218, 4, 156, 1163, 938, 158, 546,
155540 /* 1360 */ 49, 49, 1162, 546, 268, 50, 50, 546, 541, 1450,
155541 /* 1370 */ 63, 63, 546, 1449, 216, 976, 976, 978, 979, 27,
155542 /* 1380 */ 446, 64, 64, 546, 460, 65, 65, 546, 318, 14,
155543 /* 1390 */ 14, 425, 1305, 546, 66, 66, 1087, 546, 141, 379,
155544 /* 1400 */ 38, 546, 963, 535, 322, 127, 127, 546, 393, 67,
155545 /* 1410 */ 67, 546, 325, 290, 537, 52, 52, 515, 546, 68,
155546 /* 1420 */ 68, 845, 514, 69, 69, 399, 165, 857, 856, 53,
155547 /* 1430 */ 53, 986, 311, 151, 151, 97, 432, 105, 105, 327,
155548 /* 1440 */ 152, 152, 526, 1048, 106, 1048, 425, 548, 547, 1131,
155549 /* 1450 */ 427, 976, 1032, 270, 968, 239, 329, 243, 375, 375,
155550 /* 1460 */ 374, 255, 372, 940, 941, 817, 1296, 546, 220, 546,
155551 /* 1470 */ 107, 538, 546, 4, 546, 1256, 199, 845, 215, 1036,
155552 /* 1480 */ 296, 1530, 976, 976, 978, 979, 27, 541, 295, 76,
155553 /* 1490 */ 76, 54, 54, 980, 72, 72, 128, 128, 864, 865,
155554 /* 1500 */ 107, 538, 546, 4, 1047, 546, 1047, 533, 469, 546,
155555 /* 1510 */ 425, 546, 450, 1240, 546, 243, 546, 541, 217, 546,
155556 /* 1520 */ 452, 197, 535, 243, 73, 73, 156, 129, 129, 158,
155557 /* 1530 */ 336, 130, 130, 126, 126, 1036, 150, 150, 149, 149,
155558 /* 1540 */ 425, 134, 134, 317, 474, 216, 97, 239, 331, 980,
155559 /* 1550 */ 986, 97, 535, 346, 347, 546, 105, 105, 902, 931,
155560 /* 1560 */ 546, 895, 243, 106, 109, 425, 548, 547, 546, 1505,
155561 /* 1570 */ 976, 828, 99, 538, 139, 4, 546, 133, 133, 393,
155562 /* 1580 */ 986, 1317, 131, 131, 290, 537, 105, 105, 1357, 541,
155563 /* 1590 */ 132, 132, 1292, 106, 1303, 425, 548, 547, 75, 75,
155564 /* 1600 */ 976, 976, 976, 978, 979, 27, 546, 432, 896, 1289,
155565 /* 1610 */ 532, 109, 425, 1363, 546, 1221, 1213, 1202, 258, 546,
155566 /* 1620 */ 349, 546, 1201, 11, 535, 1203, 1524, 351, 77, 77,
155567 /* 1630 */ 376, 976, 976, 978, 979, 27, 74, 74, 353, 213,
155568 /* 1640 */ 301, 43, 43, 48, 48, 437, 310, 201, 303, 1350,
155569 /* 1650 */ 315, 355, 986, 454, 479, 1239, 339, 192, 105, 105,
155570 /* 1660 */ 1422, 1421, 193, 536, 205, 106, 1527, 425, 548, 547,
155571 /* 1670 */ 1180, 167, 976, 270, 247, 1469, 1467, 1177, 375, 375,
155572 /* 1680 */ 374, 255, 372, 200, 369, 817, 400, 83, 79, 82,
155573 /* 1690 */ 1427, 448, 177, 95, 1342, 161, 169, 1339, 215, 440,
155574 /* 1700 */ 296, 172, 173, 976, 976, 978, 979, 27, 295, 174,
155575 /* 1710 */ 175, 441, 472, 223, 1347, 383, 35, 381, 36, 461,
155576 /* 1720 */ 88, 1353, 181, 447, 384, 1416, 227, 467, 259, 229,
155577 /* 1730 */ 186, 488, 470, 324, 1250, 230, 231, 320, 217, 1204,
155578 /* 1740 */ 1438, 1259, 386, 1258, 413, 90, 156, 849, 1541, 158,
155579 /* 1750 */ 206, 415, 1540, 507, 1300, 1257, 94, 348, 1229, 1301,
155580 /* 1760 */ 387, 1510, 1228, 338, 1227, 216, 350, 1539, 498, 283,
155581 /* 1770 */ 284, 1249, 501, 1299, 352, 245, 246, 418, 1298, 354,
155582 /* 1780 */ 1496, 1495, 124, 10, 526, 363, 101, 1324, 253, 96,
155583 /* 1790 */ 510, 1210, 34, 549, 1137, 254, 256, 257, 166, 393,
155584 /* 1800 */ 550, 1199, 1282, 361, 290, 537, 1281, 196, 367, 368,
155585 /* 1810 */ 1194, 153, 1454, 137, 281, 1323, 1455, 804, 154, 426,
155586 /* 1820 */ 198, 155, 1453, 1452, 292, 212, 202, 432, 1402, 203,
155587 /* 1830 */ 271, 135, 288, 78, 1046, 1044, 960, 168, 157, 881,
155588 /* 1840 */ 170, 219, 309, 222, 1060, 176, 964, 159, 402, 84,
155589 /* 1850 */ 178, 404, 85, 86, 87, 160, 1063, 224, 394, 395,
155590 /* 1860 */ 225, 1059, 146, 18, 226, 319, 243, 1174, 466, 228,
155591 /* 1870 */ 1052, 182, 183, 37, 819, 471, 340, 232, 332, 483,
155592 /* 1880 */ 184, 89, 162, 19, 20, 475, 91, 480, 847, 335,
155593 /* 1890 */ 147, 860, 282, 92, 490, 93, 1125, 148, 1012, 1095,
155594 /* 1900 */ 39, 497, 1096, 40, 500, 262, 207, 264, 930, 187,
155595 /* 1910 */ 925, 109, 1111, 1115, 1113, 7, 1099, 242, 33, 1119,
155596 /* 1920 */ 21, 522, 22, 23, 24, 1118, 25, 190, 97, 26,
155597 /* 1930 */ 1027, 1013, 1011, 1015, 1069, 1016, 1068, 249, 248, 28,
155598 /* 1940 */ 41, 891, 981, 829, 108, 29, 250, 542, 251, 370,
155599 /* 1950 */ 373, 1133, 1132, 1190, 1190, 1190, 1190, 1190, 1190, 1190,
155600 /* 1960 */ 1532, 1531,
155601 };
155602 static const YYCODETYPE yy_lookahead[] = {
155603 /* 0 */ 189, 211, 189, 189, 218, 189, 220, 189, 267, 268,
155604 /* 10 */ 269, 189, 210, 189, 228, 189, 267, 268, 269, 19,
155605 /* 20 */ 218, 189, 211, 212, 211, 212, 211, 211, 212, 211,
@@ -155688,117 +156844,117 @@
155688 /* 850 */ 200, 16, 189, 114, 115, 189, 211, 212, 119, 221,
155689 /* 860 */ 189, 211, 212, 258, 101, 102, 103, 104, 105, 106,
155690 /* 870 */ 107, 108, 109, 110, 111, 189, 156, 211, 212, 234,
155691 /* 880 */ 235, 189, 211, 212, 234, 235, 22, 201, 189, 150,
155692 /* 890 */ 151, 152, 247, 248, 76, 16, 19, 247, 248, 113,
155693 /* 900 */ 189, 24, 257, 211, 212, 189, 26, 89, 262, 223,
155694 /* 910 */ 92, 225, 77, 189, 79, 129, 19, 53, 226, 248,
155695 /* 920 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
155696 /* 930 */ 53, 54, 55, 56, 57, 236, 19, 271, 189, 99,
155697 /* 940 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
155698 /* 950 */ 53, 54, 55, 56, 57, 115, 77, 59, 79, 119,
155699 /* 960 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
155700 /* 970 */ 53, 54, 55, 56, 57, 259, 22, 23, 101, 102,
155701 /* 980 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 59,
155702 /* 990 */ 150, 151, 152, 158, 22, 244, 24, 246, 101, 102,
155703 /* 1000 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 285,
155704 /* 1010 */ 189, 189, 114, 115, 116, 200, 136, 137, 101, 102,
155705 /* 1020 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 230,
155706 /* 1030 */ 231, 59, 211, 212, 285, 105, 106, 189, 19, 141,
155707 /* 1040 */ 234, 235, 239, 113, 114, 115, 116, 226, 118, 234,
155708 /* 1050 */ 235, 189, 249, 247, 100, 189, 126, 23, 236, 107,
155709 /* 1060 */ 26, 189, 247, 44, 45, 46, 47, 48, 49, 50,
155710 /* 1070 */ 51, 52, 53, 54, 55, 56, 57, 211, 212, 59,
155711 /* 1080 */ 150, 233, 152, 211, 212, 133, 12, 115, 189, 189,
155712 /* 1090 */ 138, 19, 20, 300, 22, 233, 76, 304, 226, 11,
155713 /* 1100 */ 208, 27, 22, 23, 200, 19, 26, 87, 36, 89,
155714 /* 1110 */ 211, 212, 92, 300, 248, 189, 42, 304, 189, 250,
155715 /* 1120 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
155716 /* 1130 */ 111, 59, 200, 233, 114, 115, 116, 63, 234, 235,
155717 /* 1140 */ 235, 19, 20, 71, 22, 300, 189, 73, 200, 304,
155718 /* 1150 */ 116, 247, 247, 81, 189, 200, 227, 26, 36, 234,
155719 /* 1160 */ 235, 203, 204, 143, 200, 26, 234, 235, 194, 200,
155720 /* 1170 */ 48, 99, 247, 66, 189, 141, 284, 105, 106, 247,
155721 /* 1180 */ 100, 59, 234, 235, 112, 259, 114, 115, 116, 234,
155722 /* 1190 */ 235, 119, 85, 71, 266, 247, 211, 212, 234, 235,
155723 /* 1200 */ 114, 94, 247, 234, 235, 12, 266, 85, 136, 137,
155724 /* 1210 */ 189, 247, 90, 26, 126, 127, 247, 189, 26, 22,
155725 /* 1220 */ 27, 99, 150, 151, 152, 153, 154, 105, 106, 189,
155726 /* 1230 */ 302, 303, 211, 212, 112, 42, 114, 115, 116, 211,
155727 /* 1240 */ 212, 119, 302, 303, 19, 20, 189, 22, 274, 189,
155728 /* 1250 */ 15, 144, 278, 189, 22, 23, 63, 189, 189, 203,
155729 /* 1260 */ 204, 36, 136, 137, 155, 24, 157, 143, 211, 212,
155730 /* 1270 */ 189, 140, 150, 151, 152, 153, 154, 0, 1, 2,
155731 /* 1280 */ 211, 212, 5, 46, 59, 161, 147, 10, 11, 12,
155732 /* 1290 */ 13, 14, 211, 212, 17, 60, 71, 189, 258, 189,
155733 /* 1300 */ 59, 189, 105, 106, 189, 189, 189, 30, 116, 32,
155734 /* 1310 */ 85, 124, 189, 251, 252, 90, 189, 40, 258, 211,
155735 /* 1320 */ 212, 211, 212, 189, 99, 26, 211, 212, 211, 212,
155736 /* 1330 */ 105, 106, 100, 141, 211, 212, 119, 112, 189, 114,
155737 /* 1340 */ 115, 116, 23, 189, 119, 26, 129, 70, 189, 31,
155738 /* 1350 */ 113, 19, 20, 24, 22, 78, 115, 39, 81, 189,
155739 /* 1360 */ 211, 212, 26, 189, 22, 211, 212, 189, 36, 189,
155740 /* 1370 */ 211, 212, 189, 189, 97, 150, 151, 152, 153, 154,
155741 /* 1380 */ 127, 211, 212, 189, 189, 211, 212, 189, 189, 211,
155742 /* 1390 */ 212, 59, 189, 189, 211, 212, 23, 189, 22, 26,
155743 /* 1400 */ 24, 189, 149, 71, 189, 211, 212, 189, 131, 211,
155744 /* 1410 */ 212, 189, 189, 136, 137, 211, 212, 85, 189, 211,
155745 /* 1420 */ 212, 59, 90, 211, 212, 292, 293, 118, 119, 211,
155746 /* 1430 */ 212, 99, 23, 211, 212, 26, 159, 105, 106, 189,
155747 /* 1440 */ 211, 212, 143, 150, 112, 152, 114, 115, 116, 1,
155748 /* 1450 */ 2, 119, 23, 5, 23, 26, 189, 26, 10, 11,
155749 /* 1460 */ 12, 13, 14, 83, 84, 17, 253, 189, 139, 189,
155750 /* 1470 */ 19, 20, 189, 22, 189, 189, 140, 115, 30, 59,
155751 /* 1480 */ 32, 139, 150, 151, 152, 153, 154, 36, 40, 211,
155752 /* 1490 */ 212, 211, 212, 59, 211, 212, 211, 212, 7, 8,
155753 /* 1500 */ 19, 20, 189, 22, 150, 189, 152, 231, 281, 189,
155754 /* 1510 */ 59, 189, 23, 189, 189, 26, 189, 36, 70, 189,
155755 /* 1520 */ 23, 237, 71, 26, 211, 212, 78, 211, 212, 81,
155756 /* 1530 */ 189, 211, 212, 211, 212, 115, 211, 212, 211, 212,
155757 /* 1540 */ 59, 211, 212, 23, 23, 97, 26, 26, 23, 115,
155758 /* 1550 */ 99, 26, 71, 189, 189, 189, 105, 106, 107, 23,
155759 /* 1560 */ 189, 23, 26, 112, 26, 114, 115, 116, 189, 309,
155760 /* 1570 */ 119, 23, 19, 20, 26, 22, 189, 211, 212, 131,
155761 /* 1580 */ 99, 189, 211, 212, 136, 137, 105, 106, 189, 36,
155762 /* 1590 */ 211, 212, 189, 112, 189, 114, 115, 116, 211, 212,
155763 /* 1600 */ 119, 150, 151, 152, 153, 154, 189, 159, 23, 250,
155764 /* 1610 */ 189, 26, 59, 189, 189, 189, 189, 189, 280, 189,
155765 /* 1620 */ 250, 189, 189, 238, 71, 189, 189, 250, 211, 212,
155766 /* 1630 */ 187, 150, 151, 152, 153, 154, 211, 212, 250, 290,
155767 /* 1640 */ 240, 211, 212, 211, 212, 254, 286, 209, 254, 241,
155768 /* 1650 */ 240, 254, 99, 286, 215, 220, 214, 244, 105, 106,
155769 /* 1660 */ 214, 214, 244, 273, 224, 112, 192, 114, 115, 116,
155770 /* 1670 */ 60, 290, 119, 5, 139, 196, 196, 38, 10, 11,
155771 /* 1680 */ 12, 13, 14, 238, 240, 17, 196, 148, 287, 287,
155772 /* 1690 */ 276, 113, 22, 147, 241, 43, 229, 241, 30, 18,
155773 /* 1700 */ 32, 232, 232, 150, 151, 152, 153, 154, 40, 232,
155774 /* 1710 */ 232, 196, 18, 195, 265, 265, 264, 241, 264, 196,
155775 /* 1720 */ 155, 229, 229, 241, 241, 241, 195, 62, 196, 195,
155776 /* 1730 */ 22, 113, 216, 196, 222, 195, 195, 282, 70, 196,
155777 /* 1740 */ 283, 213, 216, 213, 64, 22, 78, 124, 219, 81,
155778 /* 1750 */ 162, 111, 219, 142, 256, 213, 113, 255, 213, 256,
155779 /* 1760 */ 216, 303, 215, 213, 213, 97, 255, 213, 216, 275,
155780 /* 1770 */ 275, 222, 216, 256, 255, 196, 91, 82, 256, 255,
155781 /* 1780 */ 308, 308, 146, 22, 143, 196, 155, 260, 25, 145,
155782 /* 1790 */ 144, 199, 26, 198, 13, 190, 190, 6, 293, 131,
155783 /* 1800 */ 188, 188, 245, 244, 136, 137, 245, 243, 242, 241,
155784 /* 1810 */ 188, 202, 208, 217, 217, 260, 208, 4, 202, 3,
155785 /* 1820 */ 22, 202, 208, 208, 160, 15, 209, 159, 270, 209,
155786 /* 1830 */ 98, 16, 272, 208, 23, 23, 137, 148, 128, 20,
155787 /* 1840 */ 140, 24, 16, 142, 1, 140, 149, 128, 61, 53,
155788 /* 1850 */ 148, 37, 53, 53, 53, 128, 114, 34, 296, 296,
155789 /* 1860 */ 139, 1, 5, 22, 113, 158, 26, 75, 41, 139,
155790 /* 1870 */ 68, 68, 113, 24, 20, 19, 129, 123, 23, 96,
155791 /* 1880 */ 22, 22, 37, 22, 22, 67, 22, 67, 59, 24,
155792 /* 1890 */ 23, 28, 67, 147, 22, 26, 23, 23, 23, 23,
155793 /* 1900 */ 22, 24, 23, 22, 24, 23, 139, 23, 114, 22,
155794 /* 1910 */ 141, 26, 88, 75, 86, 44, 23, 34, 22, 75,
155795 /* 1920 */ 34, 24, 34, 34, 34, 93, 34, 26, 26, 34,
155796 /* 1930 */ 23, 23, 23, 23, 23, 11, 23, 22, 26, 22,
155797 /* 1940 */ 22, 133, 23, 23, 22, 22, 139, 26, 139, 23,
155798 /* 1950 */ 15, 1, 1, 310, 310, 310, 310, 310, 310, 310,
155799 /* 1960 */ 139, 139, 310, 310, 310, 310, 310, 310, 310, 310,
155800 /* 1970 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155801 /* 1980 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155802 /* 1990 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155803 /* 2000 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155804 /* 2010 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
@@ -155812,15 +156968,15 @@
155812 /* 2090 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155813 /* 2100 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155814 /* 2110 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155815 /* 2120 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155816 /* 2130 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
155817 /* 2140 */ 310, 310, 310,
155818 };
155819 #define YY_SHIFT_COUNT (552)
155820 #define YY_SHIFT_MIN (0)
155821 #define YY_SHIFT_MAX (1951)
155822 static const unsigned short int yy_shift_ofst[] = {
155823 /* 0 */ 1448, 1277, 1668, 1072, 1072, 340, 1122, 1225, 1332, 1481,
155824 /* 10 */ 1481, 1481, 335, 0, 0, 180, 897, 1481, 1481, 1481,
155825 /* 20 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
155826 /* 30 */ 930, 930, 1020, 1020, 290, 1, 340, 340, 340, 340,
@@ -155833,55 +156989,55 @@
155833 /* 100 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
155834 /* 110 */ 1481, 1481, 1553, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
155835 /* 120 */ 1481, 1481, 1481, 1481, 1481, 1481, 147, 258, 258, 258,
155836 /* 130 */ 258, 258, 79, 65, 84, 449, 19, 786, 449, 636,
155837 /* 140 */ 636, 449, 880, 880, 880, 880, 113, 142, 142, 472,
155838 /* 150 */ 150, 1962, 1962, 399, 399, 399, 93, 237, 341, 237,
155839 /* 160 */ 237, 1074, 1074, 437, 350, 704, 1080, 449, 449, 449,
155840 /* 170 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 449,
155841 /* 180 */ 449, 449, 449, 449, 449, 449, 449, 449, 818, 818,
155842 /* 190 */ 449, 1088, 217, 217, 734, 734, 1124, 1126, 1962, 1962,
155843 /* 200 */ 1962, 739, 840, 840, 453, 454, 511, 187, 563, 570,
155844 /* 210 */ 898, 669, 449, 449, 449, 449, 449, 449, 449, 449,
155845 /* 220 */ 449, 670, 449, 449, 449, 449, 449, 449, 449, 449,
155846 /* 230 */ 449, 449, 449, 449, 674, 674, 674, 449, 449, 449,
155847 /* 240 */ 449, 1034, 449, 449, 449, 972, 1107, 449, 449, 1193,
155848 /* 250 */ 449, 449, 449, 449, 449, 449, 449, 449, 260, 177,
155849 /* 260 */ 489, 1241, 1241, 1241, 1241, 1192, 489, 489, 952, 1197,
155850 /* 270 */ 625, 1235, 1131, 181, 181, 1086, 1139, 1131, 1086, 1187,
155851 /* 280 */ 1319, 1237, 1318, 1318, 1318, 181, 1299, 1299, 1109, 1336,
155852 /* 290 */ 549, 1376, 1610, 1535, 1535, 1639, 1639, 1535, 1539, 1578,
155853 /* 300 */ 1670, 1546, 1652, 1546, 1681, 1681, 1681, 1681, 1535, 1694,
155854 /* 310 */ 1546, 1546, 1578, 1670, 1652, 1546, 1652, 1546, 1535, 1694,
155855 /* 320 */ 1565, 1665, 1535, 1694, 1708, 1535, 1694, 1535, 1694, 1708,
155856 /* 330 */ 1618, 1618, 1618, 1680, 1723, 1723, 1708, 1618, 1623, 1618,
155857 /* 340 */ 1680, 1618, 1618, 1588, 1708, 1640, 1640, 1708, 1611, 1643,
155858 /* 350 */ 1611, 1643, 1611, 1643, 1611, 1643, 1535, 1685, 1685, 1695,
155859 /* 360 */ 1695, 1636, 1641, 1761, 1535, 1631, 1636, 1644, 1646, 1546,
155860 /* 370 */ 1763, 1766, 1781, 1781, 1791, 1791, 1791, 1962, 1962, 1962,
155861 /* 380 */ 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962,
155862 /* 390 */ 1962, 1962, 308, 835, 954, 1232, 879, 715, 728, 1373,
155863 /* 400 */ 864, 1329, 1253, 1409, 297, 1431, 1489, 1497, 1520, 1521,
155864 /* 410 */ 1525, 1362, 1309, 1491, 1217, 1420, 1429, 1536, 1380, 1538,
155865 /* 420 */ 1293, 1354, 1548, 1585, 1434, 1342, 1813, 1816, 1798, 1664,
155866 /* 430 */ 1810, 1732, 1815, 1811, 1812, 1699, 1689, 1710, 1817, 1700,
155867 /* 440 */ 1819, 1701, 1826, 1843, 1705, 1697, 1719, 1787, 1814, 1702,
155868 /* 450 */ 1796, 1799, 1800, 1801, 1727, 1742, 1823, 1721, 1860, 1857,
155869 /* 460 */ 1841, 1751, 1707, 1802, 1840, 1803, 1792, 1827, 1730, 1759,
155870 /* 470 */ 1849, 1854, 1856, 1747, 1754, 1858, 1818, 1859, 1861, 1855,
155871 /* 480 */ 1862, 1820, 1829, 1865, 1783, 1863, 1864, 1825, 1845, 1867,
155872 /* 490 */ 1746, 1872, 1873, 1874, 1875, 1869, 1876, 1878, 1877, 1879,
155873 /* 500 */ 1881, 1880, 1767, 1882, 1884, 1794, 1883, 1887, 1769, 1885,
155874 /* 510 */ 1886, 1888, 1889, 1890, 1824, 1838, 1828, 1871, 1844, 1832,
155875 /* 520 */ 1892, 1893, 1896, 1897, 1901, 1902, 1895, 1907, 1885, 1908,
155876 /* 530 */ 1909, 1910, 1911, 1912, 1913, 1915, 1924, 1917, 1918, 1919,
155877 /* 540 */ 1920, 1922, 1923, 1921, 1808, 1807, 1809, 1821, 1822, 1926,
155878 /* 550 */ 1935, 1950, 1951,
155879 };
155880 #define YY_REDUCE_COUNT (391)
155881 #define YY_REDUCE_MIN (-262)
155882 #define YY_REDUCE_MAX (1625)
155883 static const short yy_reduce_ofst[] = {
155884 /* 0 */ 490, -122, 545, 645, 650, -120, -189, -187, -184, -182,
155885 /* 10 */ -178, -176, 45, 30, 200, -251, -134, 390, 392, 521,
155886 /* 20 */ 523, 213, 692, 821, 284, 589, 872, 666, 671, 866,
155887 /* 30 */ 71, 111, 273, 389, 686, 815, 904, 932, 948, 955,
@@ -155895,92 +157051,92 @@
155895 /* 110 */ 1285, 1313, 1316, 1320, 1322, 1325, 1327, 1330, 1366, 1371,
155896 /* 120 */ 1379, 1387, 1417, 1425, 1430, 1432, -259, -259, -259, -259,
155897 /* 130 */ -259, -259, -259, -259, -259, 557, 974, -214, -174, -9,
155898 /* 140 */ 431, -124, 806, 925, 806, 925, 251, 928, 940, -259,
155899 /* 150 */ -259, -259, -259, -198, -198, -198, 127, -186, -168, 212,
155900 /* 160 */ 646, 617, 799, -262, 555, 220, 220, 491, 605, 1040,
155901 /* 170 */ 1060, 699, -11, 600, 848, 862, 345, -129, 724, -91,
155902 /* 180 */ 158, 749, 716, 900, 304, 822, 929, 926, 499, 793,
155903 /* 190 */ 322, 892, 813, 845, 958, 1056, 751, 905, 1133, 1062,
155904 /* 200 */ 803, -210, -185, -179, -148, -167, -89, 121, 274, 281,
155905 /* 210 */ 320, 336, 439, 663, 711, 957, 965, 1064, 1068, 1112,
155906 /* 220 */ 1116, -196, 1127, 1134, 1180, 1184, 1195, 1199, 1203, 1215,
155907 /* 230 */ 1223, 1250, 1267, 1286, 205, 422, 638, 1324, 1341, 1364,
155908 /* 240 */ 1365, 1213, 1392, 1399, 1403, 869, 1260, 1405, 1421, 1276,
155909 /* 250 */ 1424, 121, 1426, 1427, 1428, 1433, 1436, 1437, 1227, 1338,
155910 /* 260 */ 1284, 1359, 1370, 1377, 1388, 1213, 1284, 1284, 1385, 1438,
155911 /* 270 */ 1443, 1349, 1400, 1391, 1394, 1360, 1408, 1410, 1367, 1439,
155912 /* 280 */ 1440, 1435, 1442, 1446, 1447, 1397, 1413, 1418, 1390, 1444,
155913 /* 290 */ 1445, 1474, 1381, 1479, 1480, 1401, 1402, 1490, 1414, 1449,
155914 /* 300 */ 1452, 1453, 1467, 1456, 1469, 1470, 1477, 1478, 1515, 1518,
155915 /* 310 */ 1476, 1482, 1450, 1454, 1492, 1483, 1493, 1484, 1523, 1531,
155916 /* 320 */ 1457, 1455, 1532, 1534, 1516, 1537, 1540, 1543, 1541, 1526,
155917 /* 330 */ 1528, 1530, 1542, 1512, 1529, 1533, 1544, 1545, 1547, 1550,
155918 /* 340 */ 1549, 1551, 1554, 1458, 1552, 1494, 1495, 1556, 1498, 1502,
155919 /* 350 */ 1503, 1511, 1517, 1519, 1522, 1524, 1579, 1472, 1473, 1527,
155920 /* 360 */ 1555, 1557, 1559, 1558, 1589, 1560, 1561, 1564, 1566, 1568,
155921 /* 370 */ 1592, 1595, 1605, 1606, 1612, 1613, 1622, 1562, 1563, 1505,
155922 /* 380 */ 1609, 1604, 1608, 1614, 1615, 1616, 1596, 1597, 1617, 1620,
155923 /* 390 */ 1625, 1619,
155924 };
155925 static const YYACTIONTYPE yy_default[] = {
155926 /* 0 */ 1575, 1575, 1575, 1411, 1188, 1297, 1188, 1188, 1188, 1411,
155927 /* 10 */ 1411, 1411, 1188, 1327, 1327, 1464, 1219, 1188, 1188, 1188,
155928 /* 20 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1410, 1188, 1188,
155929 /* 30 */ 1188, 1188, 1494, 1494, 1188, 1188, 1188, 1188, 1188, 1188,
155930 /* 40 */ 1188, 1188, 1188, 1336, 1188, 1188, 1188, 1188, 1188, 1188,
155931 /* 50 */ 1412, 1413, 1188, 1188, 1188, 1463, 1465, 1428, 1346, 1345,
155932 /* 60 */ 1344, 1343, 1446, 1314, 1341, 1334, 1338, 1406, 1407, 1405,
155933 /* 70 */ 1409, 1413, 1412, 1188, 1337, 1377, 1391, 1376, 1188, 1188,
155934 /* 80 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155935 /* 90 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155936 /* 100 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155937 /* 110 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155938 /* 120 */ 1188, 1188, 1188, 1188, 1188, 1188, 1385, 1390, 1396, 1389,
155939 /* 130 */ 1386, 1379, 1378, 1380, 1381, 1188, 1209, 1261, 1188, 1188,
155940 /* 140 */ 1188, 1188, 1482, 1481, 1188, 1188, 1219, 1371, 1370, 1382,
155941 /* 150 */ 1383, 1393, 1392, 1471, 1529, 1528, 1429, 1188, 1188, 1188,
155942 /* 160 */ 1188, 1188, 1188, 1494, 1188, 1188, 1188, 1188, 1188, 1188,
155943 /* 170 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155944 /* 180 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1494, 1494,
155945 /* 190 */ 1188, 1219, 1494, 1494, 1215, 1215, 1321, 1188, 1477, 1297,
155946 /* 200 */ 1288, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155947 /* 210 */ 1188, 1188, 1188, 1188, 1188, 1468, 1466, 1188, 1188, 1188,
155948 /* 220 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155949 /* 230 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155950 /* 240 */ 1188, 1188, 1188, 1188, 1188, 1293, 1188, 1188, 1188, 1188,
155951 /* 250 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1523, 1188, 1441,
155952 /* 260 */ 1275, 1293, 1293, 1293, 1293, 1295, 1276, 1274, 1287, 1220,
155953 /* 270 */ 1195, 1567, 1294, 1316, 1316, 1564, 1340, 1294, 1564, 1236,
155954 /* 280 */ 1545, 1231, 1327, 1327, 1327, 1316, 1321, 1321, 1408, 1294,
155955 /* 290 */ 1287, 1188, 1567, 1302, 1302, 1566, 1566, 1302, 1429, 1349,
155956 /* 300 */ 1355, 1340, 1264, 1340, 1270, 1270, 1270, 1270, 1302, 1206,
155957 /* 310 */ 1340, 1340, 1349, 1355, 1264, 1340, 1264, 1340, 1302, 1206,
155958 /* 320 */ 1445, 1561, 1302, 1206, 1419, 1302, 1206, 1302, 1206, 1419,
155959 /* 330 */ 1262, 1262, 1262, 1251, 1188, 1188, 1419, 1262, 1236, 1262,
155960 /* 340 */ 1251, 1262, 1262, 1512, 1419, 1423, 1423, 1419, 1320, 1315,
155961 /* 350 */ 1320, 1315, 1320, 1315, 1320, 1315, 1302, 1504, 1504, 1330,
155962 /* 360 */ 1330, 1335, 1321, 1414, 1302, 1188, 1335, 1333, 1331, 1340,
155963 /* 370 */ 1212, 1254, 1526, 1526, 1522, 1522, 1522, 1572, 1572, 1477,
155964 /* 380 */ 1538, 1219, 1219, 1219, 1219, 1538, 1238, 1238, 1220, 1220,
155965 /* 390 */ 1219, 1538, 1188, 1188, 1188, 1188, 1188, 1188, 1533, 1188,
155966 /* 400 */ 1430, 1306, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155967 /* 410 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155968 /* 420 */ 1188, 1188, 1188, 1188, 1188, 1360, 1188, 1191, 1474, 1188,
155969 /* 430 */ 1188, 1472, 1188, 1188, 1188, 1188, 1188, 1188, 1307, 1188,
155970 /* 440 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155971 /* 450 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1563, 1188, 1188,
155972 /* 460 */ 1188, 1188, 1188, 1188, 1444, 1443, 1188, 1188, 1304, 1188,
155973 /* 470 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155974 /* 480 */ 1188, 1188, 1234, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155975 /* 490 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155976 /* 500 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1332,
155977 /* 510 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155978 /* 520 */ 1188, 1188, 1188, 1188, 1509, 1322, 1188, 1188, 1554, 1188,
155979 /* 530 */ 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
155980 /* 540 */ 1188, 1188, 1188, 1549, 1278, 1362, 1188, 1361, 1365, 1188,
155981 /* 550 */ 1200, 1188, 1188,
155982 };
155983 /********** End of lemon-generated parsing tables *****************************/
155984
155985 /* The next table maps tokens (terminal symbols) into fallback tokens.
155986 ** If a construct like the following:
@@ -156741,236 +157897,237 @@
156741 /* 154 */ "setlist ::= nm EQ expr",
156742 /* 155 */ "setlist ::= LP idlist RP EQ expr",
156743 /* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
156744 /* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
156745 /* 158 */ "upsert ::=",
156746 /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
156747 /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
156748 /* 161 */ "upsert ::= ON CONFLICT DO NOTHING",
156749 /* 162 */ "insert_cmd ::= INSERT orconf",
156750 /* 163 */ "insert_cmd ::= REPLACE",
156751 /* 164 */ "idlist_opt ::=",
156752 /* 165 */ "idlist_opt ::= LP idlist RP",
156753 /* 166 */ "idlist ::= idlist COMMA nm",
156754 /* 167 */ "idlist ::= nm",
156755 /* 168 */ "expr ::= LP expr RP",
156756 /* 169 */ "expr ::= ID|INDEXED",
156757 /* 170 */ "expr ::= JOIN_KW",
156758 /* 171 */ "expr ::= nm DOT nm",
156759 /* 172 */ "expr ::= nm DOT nm DOT nm",
156760 /* 173 */ "term ::= NULL|FLOAT|BLOB",
156761 /* 174 */ "term ::= STRING",
156762 /* 175 */ "term ::= INTEGER",
156763 /* 176 */ "expr ::= VARIABLE",
156764 /* 177 */ "expr ::= expr COLLATE ID|STRING",
156765 /* 178 */ "expr ::= CAST LP expr AS typetoken RP",
156766 /* 179 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
156767 /* 180 */ "expr ::= ID|INDEXED LP STAR RP",
156768 /* 181 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
156769 /* 182 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
156770 /* 183 */ "term ::= CTIME_KW",
156771 /* 184 */ "expr ::= LP nexprlist COMMA expr RP",
156772 /* 185 */ "expr ::= expr AND expr",
156773 /* 186 */ "expr ::= expr OR expr",
156774 /* 187 */ "expr ::= expr LT|GT|GE|LE expr",
156775 /* 188 */ "expr ::= expr EQ|NE expr",
156776 /* 189 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
156777 /* 190 */ "expr ::= expr PLUS|MINUS expr",
156778 /* 191 */ "expr ::= expr STAR|SLASH|REM expr",
156779 /* 192 */ "expr ::= expr CONCAT expr",
156780 /* 193 */ "likeop ::= NOT LIKE_KW|MATCH",
156781 /* 194 */ "expr ::= expr likeop expr",
156782 /* 195 */ "expr ::= expr likeop expr ESCAPE expr",
156783 /* 196 */ "expr ::= expr ISNULL|NOTNULL",
156784 /* 197 */ "expr ::= expr NOT NULL",
156785 /* 198 */ "expr ::= expr IS expr",
156786 /* 199 */ "expr ::= expr IS NOT expr",
156787 /* 200 */ "expr ::= NOT expr",
156788 /* 201 */ "expr ::= BITNOT expr",
156789 /* 202 */ "expr ::= PLUS|MINUS expr",
156790 /* 203 */ "between_op ::= BETWEEN",
156791 /* 204 */ "between_op ::= NOT BETWEEN",
156792 /* 205 */ "expr ::= expr between_op expr AND expr",
156793 /* 206 */ "in_op ::= IN",
156794 /* 207 */ "in_op ::= NOT IN",
156795 /* 208 */ "expr ::= expr in_op LP exprlist RP",
156796 /* 209 */ "expr ::= LP select RP",
156797 /* 210 */ "expr ::= expr in_op LP select RP",
156798 /* 211 */ "expr ::= expr in_op nm dbnm paren_exprlist",
156799 /* 212 */ "expr ::= EXISTS LP select RP",
156800 /* 213 */ "expr ::= CASE case_operand case_exprlist case_else END",
156801 /* 214 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
156802 /* 215 */ "case_exprlist ::= WHEN expr THEN expr",
156803 /* 216 */ "case_else ::= ELSE expr",
156804 /* 217 */ "case_else ::=",
156805 /* 218 */ "case_operand ::= expr",
156806 /* 219 */ "case_operand ::=",
156807 /* 220 */ "exprlist ::=",
156808 /* 221 */ "nexprlist ::= nexprlist COMMA expr",
156809 /* 222 */ "nexprlist ::= expr",
156810 /* 223 */ "paren_exprlist ::=",
156811 /* 224 */ "paren_exprlist ::= LP exprlist RP",
156812 /* 225 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
156813 /* 226 */ "uniqueflag ::= UNIQUE",
156814 /* 227 */ "uniqueflag ::=",
156815 /* 228 */ "eidlist_opt ::=",
156816 /* 229 */ "eidlist_opt ::= LP eidlist RP",
156817 /* 230 */ "eidlist ::= eidlist COMMA nm collate sortorder",
156818 /* 231 */ "eidlist ::= nm collate sortorder",
156819 /* 232 */ "collate ::=",
156820 /* 233 */ "collate ::= COLLATE ID|STRING",
156821 /* 234 */ "cmd ::= DROP INDEX ifexists fullname",
156822 /* 235 */ "cmd ::= VACUUM vinto",
156823 /* 236 */ "cmd ::= VACUUM nm vinto",
156824 /* 237 */ "vinto ::= INTO expr",
156825 /* 238 */ "vinto ::=",
156826 /* 239 */ "cmd ::= PRAGMA nm dbnm",
156827 /* 240 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
156828 /* 241 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
156829 /* 242 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
156830 /* 243 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
156831 /* 244 */ "plus_num ::= PLUS INTEGER|FLOAT",
156832 /* 245 */ "minus_num ::= MINUS INTEGER|FLOAT",
156833 /* 246 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
156834 /* 247 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
156835 /* 248 */ "trigger_time ::= BEFORE|AFTER",
156836 /* 249 */ "trigger_time ::= INSTEAD OF",
156837 /* 250 */ "trigger_time ::=",
156838 /* 251 */ "trigger_event ::= DELETE|INSERT",
156839 /* 252 */ "trigger_event ::= UPDATE",
156840 /* 253 */ "trigger_event ::= UPDATE OF idlist",
156841 /* 254 */ "when_clause ::=",
156842 /* 255 */ "when_clause ::= WHEN expr",
156843 /* 256 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
156844 /* 257 */ "trigger_cmd_list ::= trigger_cmd SEMI",
156845 /* 258 */ "trnm ::= nm DOT nm",
156846 /* 259 */ "tridxby ::= INDEXED BY nm",
156847 /* 260 */ "tridxby ::= NOT INDEXED",
156848 /* 261 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
156849 /* 262 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
156850 /* 263 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
156851 /* 264 */ "trigger_cmd ::= scanpt select scanpt",
156852 /* 265 */ "expr ::= RAISE LP IGNORE RP",
156853 /* 266 */ "expr ::= RAISE LP raisetype COMMA nm RP",
156854 /* 267 */ "raisetype ::= ROLLBACK",
156855 /* 268 */ "raisetype ::= ABORT",
156856 /* 269 */ "raisetype ::= FAIL",
156857 /* 270 */ "cmd ::= DROP TRIGGER ifexists fullname",
156858 /* 271 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
156859 /* 272 */ "cmd ::= DETACH database_kw_opt expr",
156860 /* 273 */ "key_opt ::=",
156861 /* 274 */ "key_opt ::= KEY expr",
156862 /* 275 */ "cmd ::= REINDEX",
156863 /* 276 */ "cmd ::= REINDEX nm dbnm",
156864 /* 277 */ "cmd ::= ANALYZE",
156865 /* 278 */ "cmd ::= ANALYZE nm dbnm",
156866 /* 279 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
156867 /* 280 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
156868 /* 281 */ "add_column_fullname ::= fullname",
156869 /* 282 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
156870 /* 283 */ "cmd ::= create_vtab",
156871 /* 284 */ "cmd ::= create_vtab LP vtabarglist RP",
156872 /* 285 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
156873 /* 286 */ "vtabarg ::=",
156874 /* 287 */ "vtabargtoken ::= ANY",
156875 /* 288 */ "vtabargtoken ::= lp anylist RP",
156876 /* 289 */ "lp ::= LP",
156877 /* 290 */ "with ::= WITH wqlist",
156878 /* 291 */ "with ::= WITH RECURSIVE wqlist",
156879 /* 292 */ "wqlist ::= nm eidlist_opt AS LP select RP",
156880 /* 293 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
156881 /* 294 */ "windowdefn_list ::= windowdefn",
156882 /* 295 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
156883 /* 296 */ "windowdefn ::= nm AS LP window RP",
156884 /* 297 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
156885 /* 298 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
156886 /* 299 */ "window ::= ORDER BY sortlist frame_opt",
156887 /* 300 */ "window ::= nm ORDER BY sortlist frame_opt",
156888 /* 301 */ "window ::= frame_opt",
156889 /* 302 */ "window ::= nm frame_opt",
156890 /* 303 */ "frame_opt ::=",
156891 /* 304 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
156892 /* 305 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
156893 /* 306 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
156894 /* 307 */ "frame_bound_s ::= frame_bound",
156895 /* 308 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
156896 /* 309 */ "frame_bound_e ::= frame_bound",
156897 /* 310 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
156898 /* 311 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
156899 /* 312 */ "frame_bound ::= CURRENT ROW",
156900 /* 313 */ "frame_exclude_opt ::=",
156901 /* 314 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
156902 /* 315 */ "frame_exclude ::= NO OTHERS",
156903 /* 316 */ "frame_exclude ::= CURRENT ROW",
156904 /* 317 */ "frame_exclude ::= GROUP|TIES",
156905 /* 318 */ "window_clause ::= WINDOW windowdefn_list",
156906 /* 319 */ "filter_over ::= filter_clause over_clause",
156907 /* 320 */ "filter_over ::= over_clause",
156908 /* 321 */ "filter_over ::= filter_clause",
156909 /* 322 */ "over_clause ::= OVER LP window RP",
156910 /* 323 */ "over_clause ::= OVER nm",
156911 /* 324 */ "filter_clause ::= FILTER LP WHERE expr RP",
156912 /* 325 */ "input ::= cmdlist",
156913 /* 326 */ "cmdlist ::= cmdlist ecmd",
156914 /* 327 */ "cmdlist ::= ecmd",
156915 /* 328 */ "ecmd ::= SEMI",
156916 /* 329 */ "ecmd ::= cmdx SEMI",
156917 /* 330 */ "ecmd ::= explain cmdx SEMI",
156918 /* 331 */ "trans_opt ::=",
156919 /* 332 */ "trans_opt ::= TRANSACTION",
156920 /* 333 */ "trans_opt ::= TRANSACTION nm",
156921 /* 334 */ "savepoint_opt ::= SAVEPOINT",
156922 /* 335 */ "savepoint_opt ::=",
156923 /* 336 */ "cmd ::= create_table create_table_args",
156924 /* 337 */ "columnlist ::= columnlist COMMA columnname carglist",
156925 /* 338 */ "columnlist ::= columnname carglist",
156926 /* 339 */ "nm ::= ID|INDEXED",
156927 /* 340 */ "nm ::= STRING",
156928 /* 341 */ "nm ::= JOIN_KW",
156929 /* 342 */ "typetoken ::= typename",
156930 /* 343 */ "typename ::= ID|STRING",
156931 /* 344 */ "signed ::= plus_num",
156932 /* 345 */ "signed ::= minus_num",
156933 /* 346 */ "carglist ::= carglist ccons",
156934 /* 347 */ "carglist ::=",
156935 /* 348 */ "ccons ::= NULL onconf",
156936 /* 349 */ "ccons ::= GENERATED ALWAYS AS generated",
156937 /* 350 */ "ccons ::= AS generated",
156938 /* 351 */ "conslist_opt ::= COMMA conslist",
156939 /* 352 */ "conslist ::= conslist tconscomma tcons",
156940 /* 353 */ "conslist ::= tcons",
156941 /* 354 */ "tconscomma ::=",
156942 /* 355 */ "defer_subclause_opt ::= defer_subclause",
156943 /* 356 */ "resolvetype ::= raisetype",
156944 /* 357 */ "selectnowith ::= oneselect",
156945 /* 358 */ "oneselect ::= values",
156946 /* 359 */ "sclp ::= selcollist COMMA",
156947 /* 360 */ "as ::= ID|STRING",
156948 /* 361 */ "expr ::= term",
156949 /* 362 */ "likeop ::= LIKE_KW|MATCH",
156950 /* 363 */ "exprlist ::= nexprlist",
156951 /* 364 */ "nmnum ::= plus_num",
156952 /* 365 */ "nmnum ::= nm",
156953 /* 366 */ "nmnum ::= ON",
156954 /* 367 */ "nmnum ::= DELETE",
156955 /* 368 */ "nmnum ::= DEFAULT",
156956 /* 369 */ "plus_num ::= INTEGER|FLOAT",
156957 /* 370 */ "foreach_clause ::=",
156958 /* 371 */ "foreach_clause ::= FOR EACH ROW",
156959 /* 372 */ "trnm ::= nm",
156960 /* 373 */ "tridxby ::=",
156961 /* 374 */ "database_kw_opt ::= DATABASE",
156962 /* 375 */ "database_kw_opt ::=",
156963 /* 376 */ "kwcolumn_opt ::=",
156964 /* 377 */ "kwcolumn_opt ::= COLUMNKW",
156965 /* 378 */ "vtabarglist ::= vtabarg",
156966 /* 379 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
156967 /* 380 */ "vtabarg ::= vtabarg vtabargtoken",
156968 /* 381 */ "anylist ::=",
156969 /* 382 */ "anylist ::= anylist LP anylist RP",
156970 /* 383 */ "anylist ::= anylist ANY",
156971 /* 384 */ "with ::=",
 
156972 };
156973 #endif /* NDEBUG */
156974
156975
156976 #if YYSTACKDEPTH<=0
@@ -157633,236 +158790,237 @@
157633 262, /* (154) setlist ::= nm EQ expr */
157634 262, /* (155) setlist ::= LP idlist RP EQ expr */
157635 186, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
157636 186, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
157637 265, /* (158) upsert ::= */
157638 265, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
157639 265, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
157640 265, /* (161) upsert ::= ON CONFLICT DO NOTHING */
157641 263, /* (162) insert_cmd ::= INSERT orconf */
157642 263, /* (163) insert_cmd ::= REPLACE */
157643 264, /* (164) idlist_opt ::= */
157644 264, /* (165) idlist_opt ::= LP idlist RP */
157645 259, /* (166) idlist ::= idlist COMMA nm */
157646 259, /* (167) idlist ::= nm */
157647 212, /* (168) expr ::= LP expr RP */
157648 212, /* (169) expr ::= ID|INDEXED */
157649 212, /* (170) expr ::= JOIN_KW */
157650 212, /* (171) expr ::= nm DOT nm */
157651 212, /* (172) expr ::= nm DOT nm DOT nm */
157652 211, /* (173) term ::= NULL|FLOAT|BLOB */
157653 211, /* (174) term ::= STRING */
157654 211, /* (175) term ::= INTEGER */
157655 212, /* (176) expr ::= VARIABLE */
157656 212, /* (177) expr ::= expr COLLATE ID|STRING */
157657 212, /* (178) expr ::= CAST LP expr AS typetoken RP */
157658 212, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */
157659 212, /* (180) expr ::= ID|INDEXED LP STAR RP */
157660 212, /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
157661 212, /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */
157662 211, /* (183) term ::= CTIME_KW */
157663 212, /* (184) expr ::= LP nexprlist COMMA expr RP */
157664 212, /* (185) expr ::= expr AND expr */
157665 212, /* (186) expr ::= expr OR expr */
157666 212, /* (187) expr ::= expr LT|GT|GE|LE expr */
157667 212, /* (188) expr ::= expr EQ|NE expr */
157668 212, /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
157669 212, /* (190) expr ::= expr PLUS|MINUS expr */
157670 212, /* (191) expr ::= expr STAR|SLASH|REM expr */
157671 212, /* (192) expr ::= expr CONCAT expr */
157672 267, /* (193) likeop ::= NOT LIKE_KW|MATCH */
157673 212, /* (194) expr ::= expr likeop expr */
157674 212, /* (195) expr ::= expr likeop expr ESCAPE expr */
157675 212, /* (196) expr ::= expr ISNULL|NOTNULL */
157676 212, /* (197) expr ::= expr NOT NULL */
157677 212, /* (198) expr ::= expr IS expr */
157678 212, /* (199) expr ::= expr IS NOT expr */
157679 212, /* (200) expr ::= NOT expr */
157680 212, /* (201) expr ::= BITNOT expr */
157681 212, /* (202) expr ::= PLUS|MINUS expr */
157682 268, /* (203) between_op ::= BETWEEN */
157683 268, /* (204) between_op ::= NOT BETWEEN */
157684 212, /* (205) expr ::= expr between_op expr AND expr */
157685 269, /* (206) in_op ::= IN */
157686 269, /* (207) in_op ::= NOT IN */
157687 212, /* (208) expr ::= expr in_op LP exprlist RP */
157688 212, /* (209) expr ::= LP select RP */
157689 212, /* (210) expr ::= expr in_op LP select RP */
157690 212, /* (211) expr ::= expr in_op nm dbnm paren_exprlist */
157691 212, /* (212) expr ::= EXISTS LP select RP */
157692 212, /* (213) expr ::= CASE case_operand case_exprlist case_else END */
157693 272, /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */
157694 272, /* (215) case_exprlist ::= WHEN expr THEN expr */
157695 273, /* (216) case_else ::= ELSE expr */
157696 273, /* (217) case_else ::= */
157697 271, /* (218) case_operand ::= expr */
157698 271, /* (219) case_operand ::= */
157699 257, /* (220) exprlist ::= */
157700 248, /* (221) nexprlist ::= nexprlist COMMA expr */
157701 248, /* (222) nexprlist ::= expr */
157702 270, /* (223) paren_exprlist ::= */
157703 270, /* (224) paren_exprlist ::= LP exprlist RP */
157704 186, /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
157705 274, /* (226) uniqueflag ::= UNIQUE */
157706 274, /* (227) uniqueflag ::= */
157707 216, /* (228) eidlist_opt ::= */
157708 216, /* (229) eidlist_opt ::= LP eidlist RP */
157709 227, /* (230) eidlist ::= eidlist COMMA nm collate sortorder */
157710 227, /* (231) eidlist ::= nm collate sortorder */
157711 275, /* (232) collate ::= */
157712 275, /* (233) collate ::= COLLATE ID|STRING */
157713 186, /* (234) cmd ::= DROP INDEX ifexists fullname */
157714 186, /* (235) cmd ::= VACUUM vinto */
157715 186, /* (236) cmd ::= VACUUM nm vinto */
157716 276, /* (237) vinto ::= INTO expr */
157717 276, /* (238) vinto ::= */
157718 186, /* (239) cmd ::= PRAGMA nm dbnm */
157719 186, /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */
157720 186, /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */
157721 186, /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */
157722 186, /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */
157723 206, /* (244) plus_num ::= PLUS INTEGER|FLOAT */
157724 207, /* (245) minus_num ::= MINUS INTEGER|FLOAT */
157725 186, /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
157726 278, /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
157727 280, /* (248) trigger_time ::= BEFORE|AFTER */
157728 280, /* (249) trigger_time ::= INSTEAD OF */
157729 280, /* (250) trigger_time ::= */
157730 281, /* (251) trigger_event ::= DELETE|INSERT */
157731 281, /* (252) trigger_event ::= UPDATE */
157732 281, /* (253) trigger_event ::= UPDATE OF idlist */
157733 283, /* (254) when_clause ::= */
157734 283, /* (255) when_clause ::= WHEN expr */
157735 279, /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
157736 279, /* (257) trigger_cmd_list ::= trigger_cmd SEMI */
157737 285, /* (258) trnm ::= nm DOT nm */
157738 286, /* (259) tridxby ::= INDEXED BY nm */
157739 286, /* (260) tridxby ::= NOT INDEXED */
157740 284, /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
157741 284, /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
157742 284, /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
157743 284, /* (264) trigger_cmd ::= scanpt select scanpt */
157744 212, /* (265) expr ::= RAISE LP IGNORE RP */
157745 212, /* (266) expr ::= RAISE LP raisetype COMMA nm RP */
157746 231, /* (267) raisetype ::= ROLLBACK */
157747 231, /* (268) raisetype ::= ABORT */
157748 231, /* (269) raisetype ::= FAIL */
157749 186, /* (270) cmd ::= DROP TRIGGER ifexists fullname */
157750 186, /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
157751 186, /* (272) cmd ::= DETACH database_kw_opt expr */
157752 288, /* (273) key_opt ::= */
157753 288, /* (274) key_opt ::= KEY expr */
157754 186, /* (275) cmd ::= REINDEX */
157755 186, /* (276) cmd ::= REINDEX nm dbnm */
157756 186, /* (277) cmd ::= ANALYZE */
157757 186, /* (278) cmd ::= ANALYZE nm dbnm */
157758 186, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
157759 186, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
157760 289, /* (281) add_column_fullname ::= fullname */
157761 186, /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
157762 186, /* (283) cmd ::= create_vtab */
157763 186, /* (284) cmd ::= create_vtab LP vtabarglist RP */
157764 291, /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
157765 293, /* (286) vtabarg ::= */
157766 294, /* (287) vtabargtoken ::= ANY */
157767 294, /* (288) vtabargtoken ::= lp anylist RP */
157768 295, /* (289) lp ::= LP */
157769 261, /* (290) with ::= WITH wqlist */
157770 261, /* (291) with ::= WITH RECURSIVE wqlist */
157771 236, /* (292) wqlist ::= nm eidlist_opt AS LP select RP */
157772 236, /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
157773 297, /* (294) windowdefn_list ::= windowdefn */
157774 297, /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */
157775 298, /* (296) windowdefn ::= nm AS LP window RP */
157776 299, /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
157777 299, /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
157778 299, /* (299) window ::= ORDER BY sortlist frame_opt */
157779 299, /* (300) window ::= nm ORDER BY sortlist frame_opt */
157780 299, /* (301) window ::= frame_opt */
157781 299, /* (302) window ::= nm frame_opt */
157782 300, /* (303) frame_opt ::= */
157783 300, /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
157784 300, /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
157785 304, /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */
157786 306, /* (307) frame_bound_s ::= frame_bound */
157787 306, /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */
157788 307, /* (309) frame_bound_e ::= frame_bound */
157789 307, /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */
157790 305, /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */
157791 305, /* (312) frame_bound ::= CURRENT ROW */
157792 308, /* (313) frame_exclude_opt ::= */
157793 308, /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */
157794 309, /* (315) frame_exclude ::= NO OTHERS */
157795 309, /* (316) frame_exclude ::= CURRENT ROW */
157796 309, /* (317) frame_exclude ::= GROUP|TIES */
157797 246, /* (318) window_clause ::= WINDOW windowdefn_list */
157798 266, /* (319) filter_over ::= filter_clause over_clause */
157799 266, /* (320) filter_over ::= over_clause */
157800 266, /* (321) filter_over ::= filter_clause */
157801 303, /* (322) over_clause ::= OVER LP window RP */
157802 303, /* (323) over_clause ::= OVER nm */
157803 302, /* (324) filter_clause ::= FILTER LP WHERE expr RP */
157804 181, /* (325) input ::= cmdlist */
157805 182, /* (326) cmdlist ::= cmdlist ecmd */
157806 182, /* (327) cmdlist ::= ecmd */
157807 183, /* (328) ecmd ::= SEMI */
157808 183, /* (329) ecmd ::= cmdx SEMI */
157809 183, /* (330) ecmd ::= explain cmdx SEMI */
157810 188, /* (331) trans_opt ::= */
157811 188, /* (332) trans_opt ::= TRANSACTION */
157812 188, /* (333) trans_opt ::= TRANSACTION nm */
157813 190, /* (334) savepoint_opt ::= SAVEPOINT */
157814 190, /* (335) savepoint_opt ::= */
157815 186, /* (336) cmd ::= create_table create_table_args */
157816 197, /* (337) columnlist ::= columnlist COMMA columnname carglist */
157817 197, /* (338) columnlist ::= columnname carglist */
157818 189, /* (339) nm ::= ID|INDEXED */
157819 189, /* (340) nm ::= STRING */
157820 189, /* (341) nm ::= JOIN_KW */
157821 203, /* (342) typetoken ::= typename */
157822 204, /* (343) typename ::= ID|STRING */
157823 205, /* (344) signed ::= plus_num */
157824 205, /* (345) signed ::= minus_num */
157825 202, /* (346) carglist ::= carglist ccons */
157826 202, /* (347) carglist ::= */
157827 210, /* (348) ccons ::= NULL onconf */
157828 210, /* (349) ccons ::= GENERATED ALWAYS AS generated */
157829 210, /* (350) ccons ::= AS generated */
157830 198, /* (351) conslist_opt ::= COMMA conslist */
157831 223, /* (352) conslist ::= conslist tconscomma tcons */
157832 223, /* (353) conslist ::= tcons */
157833 224, /* (354) tconscomma ::= */
157834 228, /* (355) defer_subclause_opt ::= defer_subclause */
157835 230, /* (356) resolvetype ::= raisetype */
157836 234, /* (357) selectnowith ::= oneselect */
157837 235, /* (358) oneselect ::= values */
157838 249, /* (359) sclp ::= selcollist COMMA */
157839 250, /* (360) as ::= ID|STRING */
157840 212, /* (361) expr ::= term */
157841 267, /* (362) likeop ::= LIKE_KW|MATCH */
157842 257, /* (363) exprlist ::= nexprlist */
157843 277, /* (364) nmnum ::= plus_num */
157844 277, /* (365) nmnum ::= nm */
157845 277, /* (366) nmnum ::= ON */
157846 277, /* (367) nmnum ::= DELETE */
157847 277, /* (368) nmnum ::= DEFAULT */
157848 206, /* (369) plus_num ::= INTEGER|FLOAT */
157849 282, /* (370) foreach_clause ::= */
157850 282, /* (371) foreach_clause ::= FOR EACH ROW */
157851 285, /* (372) trnm ::= nm */
157852 286, /* (373) tridxby ::= */
157853 287, /* (374) database_kw_opt ::= DATABASE */
157854 287, /* (375) database_kw_opt ::= */
157855 290, /* (376) kwcolumn_opt ::= */
157856 290, /* (377) kwcolumn_opt ::= COLUMNKW */
157857 292, /* (378) vtabarglist ::= vtabarg */
157858 292, /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */
157859 293, /* (380) vtabarg ::= vtabarg vtabargtoken */
157860 296, /* (381) anylist ::= */
157861 296, /* (382) anylist ::= anylist LP anylist RP */
157862 296, /* (383) anylist ::= anylist ANY */
157863 261, /* (384) with ::= */
 
157864 };
157865
157866 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
157867 ** of symbols on the right-hand side of that rule. */
157868 static const signed char yyRuleInfoNRhs[] = {
@@ -158023,236 +159181,237 @@
158023 -3, /* (154) setlist ::= nm EQ expr */
158024 -5, /* (155) setlist ::= LP idlist RP EQ expr */
158025 -7, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
158026 -7, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
158027 0, /* (158) upsert ::= */
158028 -11, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
158029 -8, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
158030 -4, /* (161) upsert ::= ON CONFLICT DO NOTHING */
158031 -2, /* (162) insert_cmd ::= INSERT orconf */
158032 -1, /* (163) insert_cmd ::= REPLACE */
158033 0, /* (164) idlist_opt ::= */
158034 -3, /* (165) idlist_opt ::= LP idlist RP */
158035 -3, /* (166) idlist ::= idlist COMMA nm */
158036 -1, /* (167) idlist ::= nm */
158037 -3, /* (168) expr ::= LP expr RP */
158038 -1, /* (169) expr ::= ID|INDEXED */
158039 -1, /* (170) expr ::= JOIN_KW */
158040 -3, /* (171) expr ::= nm DOT nm */
158041 -5, /* (172) expr ::= nm DOT nm DOT nm */
158042 -1, /* (173) term ::= NULL|FLOAT|BLOB */
158043 -1, /* (174) term ::= STRING */
158044 -1, /* (175) term ::= INTEGER */
158045 -1, /* (176) expr ::= VARIABLE */
158046 -3, /* (177) expr ::= expr COLLATE ID|STRING */
158047 -6, /* (178) expr ::= CAST LP expr AS typetoken RP */
158048 -5, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */
158049 -4, /* (180) expr ::= ID|INDEXED LP STAR RP */
158050 -6, /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
158051 -5, /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */
158052 -1, /* (183) term ::= CTIME_KW */
158053 -5, /* (184) expr ::= LP nexprlist COMMA expr RP */
158054 -3, /* (185) expr ::= expr AND expr */
158055 -3, /* (186) expr ::= expr OR expr */
158056 -3, /* (187) expr ::= expr LT|GT|GE|LE expr */
158057 -3, /* (188) expr ::= expr EQ|NE expr */
158058 -3, /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
158059 -3, /* (190) expr ::= expr PLUS|MINUS expr */
158060 -3, /* (191) expr ::= expr STAR|SLASH|REM expr */
158061 -3, /* (192) expr ::= expr CONCAT expr */
158062 -2, /* (193) likeop ::= NOT LIKE_KW|MATCH */
158063 -3, /* (194) expr ::= expr likeop expr */
158064 -5, /* (195) expr ::= expr likeop expr ESCAPE expr */
158065 -2, /* (196) expr ::= expr ISNULL|NOTNULL */
158066 -3, /* (197) expr ::= expr NOT NULL */
158067 -3, /* (198) expr ::= expr IS expr */
158068 -4, /* (199) expr ::= expr IS NOT expr */
158069 -2, /* (200) expr ::= NOT expr */
158070 -2, /* (201) expr ::= BITNOT expr */
158071 -2, /* (202) expr ::= PLUS|MINUS expr */
158072 -1, /* (203) between_op ::= BETWEEN */
158073 -2, /* (204) between_op ::= NOT BETWEEN */
158074 -5, /* (205) expr ::= expr between_op expr AND expr */
158075 -1, /* (206) in_op ::= IN */
158076 -2, /* (207) in_op ::= NOT IN */
158077 -5, /* (208) expr ::= expr in_op LP exprlist RP */
158078 -3, /* (209) expr ::= LP select RP */
158079 -5, /* (210) expr ::= expr in_op LP select RP */
158080 -5, /* (211) expr ::= expr in_op nm dbnm paren_exprlist */
158081 -4, /* (212) expr ::= EXISTS LP select RP */
158082 -5, /* (213) expr ::= CASE case_operand case_exprlist case_else END */
158083 -5, /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */
158084 -4, /* (215) case_exprlist ::= WHEN expr THEN expr */
158085 -2, /* (216) case_else ::= ELSE expr */
158086 0, /* (217) case_else ::= */
158087 -1, /* (218) case_operand ::= expr */
158088 0, /* (219) case_operand ::= */
158089 0, /* (220) exprlist ::= */
158090 -3, /* (221) nexprlist ::= nexprlist COMMA expr */
158091 -1, /* (222) nexprlist ::= expr */
158092 0, /* (223) paren_exprlist ::= */
158093 -3, /* (224) paren_exprlist ::= LP exprlist RP */
158094 -12, /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
158095 -1, /* (226) uniqueflag ::= UNIQUE */
158096 0, /* (227) uniqueflag ::= */
158097 0, /* (228) eidlist_opt ::= */
158098 -3, /* (229) eidlist_opt ::= LP eidlist RP */
158099 -5, /* (230) eidlist ::= eidlist COMMA nm collate sortorder */
158100 -3, /* (231) eidlist ::= nm collate sortorder */
158101 0, /* (232) collate ::= */
158102 -2, /* (233) collate ::= COLLATE ID|STRING */
158103 -4, /* (234) cmd ::= DROP INDEX ifexists fullname */
158104 -2, /* (235) cmd ::= VACUUM vinto */
158105 -3, /* (236) cmd ::= VACUUM nm vinto */
158106 -2, /* (237) vinto ::= INTO expr */
158107 0, /* (238) vinto ::= */
158108 -3, /* (239) cmd ::= PRAGMA nm dbnm */
158109 -5, /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */
158110 -6, /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */
158111 -5, /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */
158112 -6, /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */
158113 -2, /* (244) plus_num ::= PLUS INTEGER|FLOAT */
158114 -2, /* (245) minus_num ::= MINUS INTEGER|FLOAT */
158115 -5, /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
158116 -11, /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
158117 -1, /* (248) trigger_time ::= BEFORE|AFTER */
158118 -2, /* (249) trigger_time ::= INSTEAD OF */
158119 0, /* (250) trigger_time ::= */
158120 -1, /* (251) trigger_event ::= DELETE|INSERT */
158121 -1, /* (252) trigger_event ::= UPDATE */
158122 -3, /* (253) trigger_event ::= UPDATE OF idlist */
158123 0, /* (254) when_clause ::= */
158124 -2, /* (255) when_clause ::= WHEN expr */
158125 -3, /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
158126 -2, /* (257) trigger_cmd_list ::= trigger_cmd SEMI */
158127 -3, /* (258) trnm ::= nm DOT nm */
158128 -3, /* (259) tridxby ::= INDEXED BY nm */
158129 -2, /* (260) tridxby ::= NOT INDEXED */
158130 -9, /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
158131 -8, /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
158132 -6, /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
158133 -3, /* (264) trigger_cmd ::= scanpt select scanpt */
158134 -4, /* (265) expr ::= RAISE LP IGNORE RP */
158135 -6, /* (266) expr ::= RAISE LP raisetype COMMA nm RP */
158136 -1, /* (267) raisetype ::= ROLLBACK */
158137 -1, /* (268) raisetype ::= ABORT */
158138 -1, /* (269) raisetype ::= FAIL */
158139 -4, /* (270) cmd ::= DROP TRIGGER ifexists fullname */
158140 -6, /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
158141 -3, /* (272) cmd ::= DETACH database_kw_opt expr */
158142 0, /* (273) key_opt ::= */
158143 -2, /* (274) key_opt ::= KEY expr */
158144 -1, /* (275) cmd ::= REINDEX */
158145 -3, /* (276) cmd ::= REINDEX nm dbnm */
158146 -1, /* (277) cmd ::= ANALYZE */
158147 -3, /* (278) cmd ::= ANALYZE nm dbnm */
158148 -6, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
158149 -7, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
158150 -1, /* (281) add_column_fullname ::= fullname */
158151 -8, /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
158152 -1, /* (283) cmd ::= create_vtab */
158153 -4, /* (284) cmd ::= create_vtab LP vtabarglist RP */
158154 -8, /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
158155 0, /* (286) vtabarg ::= */
158156 -1, /* (287) vtabargtoken ::= ANY */
158157 -3, /* (288) vtabargtoken ::= lp anylist RP */
158158 -1, /* (289) lp ::= LP */
158159 -2, /* (290) with ::= WITH wqlist */
158160 -3, /* (291) with ::= WITH RECURSIVE wqlist */
158161 -6, /* (292) wqlist ::= nm eidlist_opt AS LP select RP */
158162 -8, /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
158163 -1, /* (294) windowdefn_list ::= windowdefn */
158164 -3, /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */
158165 -5, /* (296) windowdefn ::= nm AS LP window RP */
158166 -5, /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
158167 -6, /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
158168 -4, /* (299) window ::= ORDER BY sortlist frame_opt */
158169 -5, /* (300) window ::= nm ORDER BY sortlist frame_opt */
158170 -1, /* (301) window ::= frame_opt */
158171 -2, /* (302) window ::= nm frame_opt */
158172 0, /* (303) frame_opt ::= */
158173 -3, /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
158174 -6, /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
158175 -1, /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */
158176 -1, /* (307) frame_bound_s ::= frame_bound */
158177 -2, /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */
158178 -1, /* (309) frame_bound_e ::= frame_bound */
158179 -2, /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */
158180 -2, /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */
158181 -2, /* (312) frame_bound ::= CURRENT ROW */
158182 0, /* (313) frame_exclude_opt ::= */
158183 -2, /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */
158184 -2, /* (315) frame_exclude ::= NO OTHERS */
158185 -2, /* (316) frame_exclude ::= CURRENT ROW */
158186 -1, /* (317) frame_exclude ::= GROUP|TIES */
158187 -2, /* (318) window_clause ::= WINDOW windowdefn_list */
158188 -2, /* (319) filter_over ::= filter_clause over_clause */
158189 -1, /* (320) filter_over ::= over_clause */
158190 -1, /* (321) filter_over ::= filter_clause */
158191 -4, /* (322) over_clause ::= OVER LP window RP */
158192 -2, /* (323) over_clause ::= OVER nm */
158193 -5, /* (324) filter_clause ::= FILTER LP WHERE expr RP */
158194 -1, /* (325) input ::= cmdlist */
158195 -2, /* (326) cmdlist ::= cmdlist ecmd */
158196 -1, /* (327) cmdlist ::= ecmd */
158197 -1, /* (328) ecmd ::= SEMI */
158198 -2, /* (329) ecmd ::= cmdx SEMI */
158199 -3, /* (330) ecmd ::= explain cmdx SEMI */
158200 0, /* (331) trans_opt ::= */
158201 -1, /* (332) trans_opt ::= TRANSACTION */
158202 -2, /* (333) trans_opt ::= TRANSACTION nm */
158203 -1, /* (334) savepoint_opt ::= SAVEPOINT */
158204 0, /* (335) savepoint_opt ::= */
158205 -2, /* (336) cmd ::= create_table create_table_args */
158206 -4, /* (337) columnlist ::= columnlist COMMA columnname carglist */
158207 -2, /* (338) columnlist ::= columnname carglist */
158208 -1, /* (339) nm ::= ID|INDEXED */
158209 -1, /* (340) nm ::= STRING */
158210 -1, /* (341) nm ::= JOIN_KW */
158211 -1, /* (342) typetoken ::= typename */
158212 -1, /* (343) typename ::= ID|STRING */
158213 -1, /* (344) signed ::= plus_num */
158214 -1, /* (345) signed ::= minus_num */
158215 -2, /* (346) carglist ::= carglist ccons */
158216 0, /* (347) carglist ::= */
158217 -2, /* (348) ccons ::= NULL onconf */
158218 -4, /* (349) ccons ::= GENERATED ALWAYS AS generated */
158219 -2, /* (350) ccons ::= AS generated */
158220 -2, /* (351) conslist_opt ::= COMMA conslist */
158221 -3, /* (352) conslist ::= conslist tconscomma tcons */
158222 -1, /* (353) conslist ::= tcons */
158223 0, /* (354) tconscomma ::= */
158224 -1, /* (355) defer_subclause_opt ::= defer_subclause */
158225 -1, /* (356) resolvetype ::= raisetype */
158226 -1, /* (357) selectnowith ::= oneselect */
158227 -1, /* (358) oneselect ::= values */
158228 -2, /* (359) sclp ::= selcollist COMMA */
158229 -1, /* (360) as ::= ID|STRING */
158230 -1, /* (361) expr ::= term */
158231 -1, /* (362) likeop ::= LIKE_KW|MATCH */
158232 -1, /* (363) exprlist ::= nexprlist */
158233 -1, /* (364) nmnum ::= plus_num */
158234 -1, /* (365) nmnum ::= nm */
158235 -1, /* (366) nmnum ::= ON */
158236 -1, /* (367) nmnum ::= DELETE */
158237 -1, /* (368) nmnum ::= DEFAULT */
158238 -1, /* (369) plus_num ::= INTEGER|FLOAT */
158239 0, /* (370) foreach_clause ::= */
158240 -3, /* (371) foreach_clause ::= FOR EACH ROW */
158241 -1, /* (372) trnm ::= nm */
158242 0, /* (373) tridxby ::= */
158243 -1, /* (374) database_kw_opt ::= DATABASE */
158244 0, /* (375) database_kw_opt ::= */
158245 0, /* (376) kwcolumn_opt ::= */
158246 -1, /* (377) kwcolumn_opt ::= COLUMNKW */
158247 -1, /* (378) vtabarglist ::= vtabarg */
158248 -3, /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */
158249 -2, /* (380) vtabarg ::= vtabarg vtabargtoken */
158250 0, /* (381) anylist ::= */
158251 -4, /* (382) anylist ::= anylist LP anylist RP */
158252 -2, /* (383) anylist ::= anylist ANY */
158253 0, /* (384) with ::= */
 
158254 };
158255
158256 static void yy_accept(yyParser*); /* Forward Declaration */
158257
158258 /*
@@ -158278,59 +159437,10 @@
158278 int yysize; /* Amount to pop the stack */
158279 sqlite3ParserARG_FETCH
158280 (void)yyLookahead;
158281 (void)yyLookaheadToken;
158282 yymsp = yypParser->yytos;
158283 assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
158284 #ifndef NDEBUG
158285 if( yyTraceFILE ){
158286 yysize = yyRuleInfoNRhs[yyruleno];
158287 if( yysize ){
158288 fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
158289 yyTracePrompt,
158290 yyruleno, yyRuleName[yyruleno],
158291 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
158292 yymsp[yysize].stateno);
158293 }else{
158294 fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
158295 yyTracePrompt, yyruleno, yyRuleName[yyruleno],
158296 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
158297 }
158298 }
158299 #endif /* NDEBUG */
158300
158301 /* Check that the stack is large enough to grow by a single entry
158302 ** if the RHS of the rule is empty. This ensures that there is room
158303 ** enough on the stack to push the LHS value */
158304 if( yyRuleInfoNRhs[yyruleno]==0 ){
158305 #ifdef YYTRACKMAXSTACKDEPTH
158306 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
158307 yypParser->yyhwm++;
158308 assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
158309 }
158310 #endif
158311 #if YYSTACKDEPTH>0
158312 if( yypParser->yytos>=yypParser->yystackEnd ){
158313 yyStackOverflow(yypParser);
158314 /* The call to yyStackOverflow() above pops the stack until it is
158315 ** empty, causing the main parser loop to exit. So the return value
158316 ** is never used and does not matter. */
158317 return 0;
158318 }
158319 #else
158320 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
158321 if( yyGrowStack(yypParser) ){
158322 yyStackOverflow(yypParser);
158323 /* The call to yyStackOverflow() above pops the stack until it is
158324 ** empty, causing the main parser loop to exit. So the return value
158325 ** is never used and does not matter. */
158326 return 0;
158327 }
158328 yymsp = yypParser->yytos;
158329 }
158330 #endif
158331 }
158332
158333 switch( yyruleno ){
158334 /* Beginning here are the reduction cases. A typical example
158335 ** follows:
158336 ** case 0:
@@ -158357,11 +159467,11 @@
158357 {yymsp[1].minor.yy192 = TK_DEFERRED;}
158358 break;
158359 case 5: /* transtype ::= DEFERRED */
158360 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
158361 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
158362 case 306: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==306);
158363 {yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/}
158364 break;
158365 case 8: /* cmd ::= COMMIT|END trans_opt */
158366 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
158367 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -158395,11 +159505,11 @@
158395 case 45: /* autoinc ::= */ yytestcase(yyruleno==45);
158396 case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
158397 case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
158398 case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
158399 case 96: /* distinct ::= */ yytestcase(yyruleno==96);
158400 case 232: /* collate ::= */ yytestcase(yyruleno==232);
158401 {yymsp[1].minor.yy192 = 0;}
158402 break;
158403 case 16: /* ifnotexists ::= IF NOT EXISTS */
158404 {yymsp[-2].minor.yy192 = 1;}
158405 break;
@@ -158554,18 +159664,18 @@
158554 case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
158555 {yymsp[-2].minor.yy192 = 0;}
158556 break;
158557 case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
158558 case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
158559 case 162: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==162);
158560 {yymsp[-1].minor.yy192 = yymsp[0].minor.yy192;}
158561 break;
158562 case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
158563 case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
158564 case 204: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==204);
158565 case 207: /* in_op ::= NOT IN */ yytestcase(yyruleno==207);
158566 case 233: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==233);
158567 {yymsp[-1].minor.yy192 = 1;}
158568 break;
158569 case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
158570 {yymsp[-1].minor.yy192 = 0;}
158571 break;
@@ -158597,11 +159707,11 @@
158597 break;
158598 case 75: /* resolvetype ::= IGNORE */
158599 {yymsp[0].minor.yy192 = OE_Ignore;}
158600 break;
158601 case 76: /* resolvetype ::= REPLACE */
158602 case 163: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==163);
158603 {yymsp[0].minor.yy192 = OE_Replace;}
158604 break;
158605 case 77: /* cmd ::= DROP TABLE ifexists fullname */
158606 {
158607 sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192);
@@ -158729,13 +159839,13 @@
158729 {yymsp[0].minor.yy192 = SF_All;}
158730 break;
158731 case 97: /* sclp ::= */
158732 case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
158733 case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
158734 case 220: /* exprlist ::= */ yytestcase(yyruleno==220);
158735 case 223: /* paren_exprlist ::= */ yytestcase(yyruleno==223);
158736 case 228: /* eidlist_opt ::= */ yytestcase(yyruleno==228);
158737 {yymsp[1].minor.yy242 = 0;}
158738 break;
158739 case 98: /* selcollist ::= sclp scanpt expr scanpt as */
158740 {
158741 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
@@ -158757,12 +159867,12 @@
158757 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot);
158758 }
158759 break;
158760 case 101: /* as ::= AS nm */
158761 case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
158762 case 244: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==244);
158763 case 245: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==245);
158764 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
158765 break;
158766 case 103: /* from ::= */
158767 case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
158768 {yymsp[1].minor.yy47 = 0;}
@@ -158874,21 +159984,21 @@
158874 {yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
158875 break;
158876 case 123: /* on_opt ::= ON expr */
158877 case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
158878 case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
158879 case 216: /* case_else ::= ELSE expr */ yytestcase(yyruleno==216);
158880 case 237: /* vinto ::= INTO expr */ yytestcase(yyruleno==237);
158881 {yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;}
158882 break;
158883 case 124: /* on_opt ::= */
158884 case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
158885 case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
158886 case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
158887 case 217: /* case_else ::= */ yytestcase(yyruleno==217);
158888 case 219: /* case_operand ::= */ yytestcase(yyruleno==219);
158889 case 238: /* vinto ::= */ yytestcase(yyruleno==238);
158890 {yymsp[1].minor.yy202 = 0;}
158891 break;
158892 case 126: /* indexed_opt ::= INDEXED BY nm */
158893 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
158894 break;
@@ -158897,11 +160007,11 @@
158897 break;
158898 case 128: /* using_opt ::= USING LP idlist RP */
158899 {yymsp[-3].minor.yy600 = yymsp[-1].minor.yy600;}
158900 break;
158901 case 129: /* using_opt ::= */
158902 case 164: /* idlist_opt ::= */ yytestcase(yyruleno==164);
158903 {yymsp[1].minor.yy600 = 0;}
158904 break;
158905 case 131: /* orderby_opt ::= ORDER BY sortlist */
158906 case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
158907 {yymsp[-2].minor.yy242 = yymsp[0].minor.yy242;}
@@ -158991,36 +160101,39 @@
158991 }
158992 break;
158993 case 158: /* upsert ::= */
158994 { yymsp[1].minor.yy318 = 0; }
158995 break;
158996 case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
158997 { yymsp[-10].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy242,yymsp[-5].minor.yy202,yymsp[-1].minor.yy242,yymsp[0].minor.yy202);}
158998 break;
158999 case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
159000 { yymsp[-7].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202,0,0); }
159001 break;
159002 case 161: /* upsert ::= ON CONFLICT DO NOTHING */
159003 { yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
159004 break;
159005 case 165: /* idlist_opt ::= LP idlist RP */
 
 
 
159006 {yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;}
159007 break;
159008 case 166: /* idlist ::= idlist COMMA nm */
159009 {yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);}
159010 break;
159011 case 167: /* idlist ::= nm */
159012 {yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
159013 break;
159014 case 168: /* expr ::= LP expr RP */
159015 {yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;}
159016 break;
159017 case 169: /* expr ::= ID|INDEXED */
159018 case 170: /* expr ::= JOIN_KW */ yytestcase(yyruleno==170);
159019 {yymsp[0].minor.yy202=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
159020 break;
159021 case 171: /* expr ::= nm DOT nm */
159022 {
159023 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
159024 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
159025 if( IN_RENAME_OBJECT ){
159026 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
@@ -159028,11 +160141,11 @@
159028 }
159029 yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
159030 }
159031 yymsp[-2].minor.yy202 = yylhsminor.yy202;
159032 break;
159033 case 172: /* expr ::= nm DOT nm DOT nm */
159034 {
159035 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
159036 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
159037 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
159038 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -159042,21 +160155,21 @@
159042 }
159043 yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
159044 }
159045 yymsp[-4].minor.yy202 = yylhsminor.yy202;
159046 break;
159047 case 173: /* term ::= NULL|FLOAT|BLOB */
159048 case 174: /* term ::= STRING */ yytestcase(yyruleno==174);
159049 {yymsp[0].minor.yy202=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
159050 break;
159051 case 175: /* term ::= INTEGER */
159052 {
159053 yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
159054 }
159055 yymsp[0].minor.yy202 = yylhsminor.yy202;
159056 break;
159057 case 176: /* expr ::= VARIABLE */
159058 {
159059 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
159060 u32 n = yymsp[0].minor.yy0.n;
159061 yymsp[0].minor.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
159062 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n);
@@ -159074,54 +160187,54 @@
159074 if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable);
159075 }
159076 }
159077 }
159078 break;
159079 case 177: /* expr ::= expr COLLATE ID|STRING */
159080 {
159081 yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1);
159082 }
159083 break;
159084 case 178: /* expr ::= CAST LP expr AS typetoken RP */
159085 {
159086 yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
159087 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0);
159088 }
159089 break;
159090 case 179: /* expr ::= ID|INDEXED LP distinct exprlist RP */
159091 {
159092 yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192);
159093 }
159094 yymsp[-4].minor.yy202 = yylhsminor.yy202;
159095 break;
159096 case 180: /* expr ::= ID|INDEXED LP STAR RP */
159097 {
159098 yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
159099 }
159100 yymsp[-3].minor.yy202 = yylhsminor.yy202;
159101 break;
159102 case 181: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159103 {
159104 yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192);
159105 sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
159106 }
159107 yymsp[-5].minor.yy202 = yylhsminor.yy202;
159108 break;
159109 case 182: /* expr ::= ID|INDEXED LP STAR RP filter_over */
159110 {
159111 yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
159112 sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
159113 }
159114 yymsp[-4].minor.yy202 = yylhsminor.yy202;
159115 break;
159116 case 183: /* term ::= CTIME_KW */
159117 {
159118 yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
159119 }
159120 yymsp[0].minor.yy202 = yylhsminor.yy202;
159121 break;
159122 case 184: /* expr ::= LP nexprlist COMMA expr RP */
159123 {
159124 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202);
159125 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
159126 if( yymsp[-4].minor.yy202 ){
159127 yymsp[-4].minor.yy202->x.pList = pList;
@@ -159131,26 +160244,26 @@
159131 }else{
159132 sqlite3ExprListDelete(pParse->db, pList);
159133 }
159134 }
159135 break;
159136 case 185: /* expr ::= expr AND expr */
159137 {yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
159138 break;
159139 case 186: /* expr ::= expr OR expr */
159140 case 187: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==187);
159141 case 188: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==188);
159142 case 189: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==189);
159143 case 190: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==190);
159144 case 191: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==191);
159145 case 192: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==192);
159146 {yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
159147 break;
159148 case 193: /* likeop ::= NOT LIKE_KW|MATCH */
159149 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
159150 break;
159151 case 194: /* expr ::= expr likeop expr */
159152 {
159153 ExprList *pList;
159154 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
159155 yymsp[-1].minor.yy0.n &= 0x7fffffff;
159156 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy202);
@@ -159158,11 +160271,11 @@
159158 yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
159159 if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0);
159160 if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc;
159161 }
159162 break;
159163 case 195: /* expr ::= expr likeop expr ESCAPE expr */
159164 {
159165 ExprList *pList;
159166 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
159167 yymsp[-3].minor.yy0.n &= 0x7fffffff;
159168 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
@@ -159171,43 +160284,43 @@
159171 yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
159172 if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159173 if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc;
159174 }
159175 break;
159176 case 196: /* expr ::= expr ISNULL|NOTNULL */
159177 {yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);}
159178 break;
159179 case 197: /* expr ::= expr NOT NULL */
159180 {yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);}
159181 break;
159182 case 198: /* expr ::= expr IS expr */
159183 {
159184 yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);
159185 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL);
159186 }
159187 break;
159188 case 199: /* expr ::= expr IS NOT expr */
159189 {
159190 yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202);
159191 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL);
159192 }
159193 break;
159194 case 200: /* expr ::= NOT expr */
159195 case 201: /* expr ::= BITNOT expr */ yytestcase(yyruleno==201);
159196 {yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/}
159197 break;
159198 case 202: /* expr ::= PLUS|MINUS expr */
159199 {
159200 yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0);
159201 /*A-overwrites-B*/
159202 }
159203 break;
159204 case 203: /* between_op ::= BETWEEN */
159205 case 206: /* in_op ::= IN */ yytestcase(yyruleno==206);
159206 {yymsp[0].minor.yy192 = 0;}
159207 break;
159208 case 205: /* expr ::= expr between_op expr AND expr */
159209 {
159210 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
159211 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
159212 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0);
159213 if( yymsp[-4].minor.yy202 ){
@@ -159216,11 +160329,11 @@
159216 sqlite3ExprListDelete(pParse->db, pList);
159217 }
159218 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159219 }
159220 break;
159221 case 208: /* expr ::= expr in_op LP exprlist RP */
159222 {
159223 if( yymsp[-1].minor.yy242==0 ){
159224 /* Expressions of the form
159225 **
159226 ** expr1 IN ()
@@ -159248,41 +160361,41 @@
159248 }
159249 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159250 }
159251 }
159252 break;
159253 case 209: /* expr ::= LP select RP */
159254 {
159255 yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
159256 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539);
159257 }
159258 break;
159259 case 210: /* expr ::= expr in_op LP select RP */
159260 {
159261 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
159262 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539);
159263 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159264 }
159265 break;
159266 case 211: /* expr ::= expr in_op nm dbnm paren_exprlist */
159267 {
159268 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
159269 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
159270 if( yymsp[0].minor.yy242 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242);
159271 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
159272 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect);
159273 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
159274 }
159275 break;
159276 case 212: /* expr ::= EXISTS LP select RP */
159277 {
159278 Expr *p;
159279 p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
159280 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539);
159281 }
159282 break;
159283 case 213: /* expr ::= CASE case_operand case_exprlist case_else END */
159284 {
159285 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0);
159286 if( yymsp[-4].minor.yy202 ){
159287 yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242;
159288 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202);
@@ -159290,394 +160403,394 @@
159290 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242);
159291 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202);
159292 }
159293 }
159294 break;
159295 case 214: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
159296 {
159297 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
159298 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202);
159299 }
159300 break;
159301 case 215: /* case_exprlist ::= WHEN expr THEN expr */
159302 {
159303 yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
159304 yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202);
159305 }
159306 break;
159307 case 218: /* case_operand ::= expr */
159308 {yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/}
159309 break;
159310 case 221: /* nexprlist ::= nexprlist COMMA expr */
159311 {yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);}
159312 break;
159313 case 222: /* nexprlist ::= expr */
159314 {yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/}
159315 break;
159316 case 224: /* paren_exprlist ::= LP exprlist RP */
159317 case 229: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==229);
159318 {yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242;}
159319 break;
159320 case 225: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159321 {
159322 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
159323 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy242, yymsp[-10].minor.yy192,
159324 &yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF);
159325 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
159326 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
159327 }
159328 }
159329 break;
159330 case 226: /* uniqueflag ::= UNIQUE */
159331 case 268: /* raisetype ::= ABORT */ yytestcase(yyruleno==268);
159332 {yymsp[0].minor.yy192 = OE_Abort;}
159333 break;
159334 case 227: /* uniqueflag ::= */
159335 {yymsp[1].minor.yy192 = OE_None;}
159336 break;
159337 case 230: /* eidlist ::= eidlist COMMA nm collate sortorder */
159338 {
159339 yymsp[-4].minor.yy242 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192);
159340 }
159341 break;
159342 case 231: /* eidlist ::= nm collate sortorder */
159343 {
159344 yymsp[-2].minor.yy242 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); /*A-overwrites-Y*/
159345 }
159346 break;
159347 case 234: /* cmd ::= DROP INDEX ifexists fullname */
159348 {sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);}
159349 break;
159350 case 235: /* cmd ::= VACUUM vinto */
159351 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);}
159352 break;
159353 case 236: /* cmd ::= VACUUM nm vinto */
159354 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);}
159355 break;
159356 case 239: /* cmd ::= PRAGMA nm dbnm */
159357 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
159358 break;
159359 case 240: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
159360 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
159361 break;
159362 case 241: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
159363 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
159364 break;
159365 case 242: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
159366 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
159367 break;
159368 case 243: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
159369 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
159370 break;
159371 case 246: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159372 {
159373 Token all;
159374 all.z = yymsp[-3].minor.yy0.z;
159375 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
159376 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy447, &all);
159377 }
159378 break;
159379 case 247: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159380 {
159381 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192);
159382 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
159383 }
159384 break;
159385 case 248: /* trigger_time ::= BEFORE|AFTER */
159386 { yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/ }
159387 break;
159388 case 249: /* trigger_time ::= INSTEAD OF */
159389 { yymsp[-1].minor.yy192 = TK_INSTEAD;}
159390 break;
159391 case 250: /* trigger_time ::= */
159392 { yymsp[1].minor.yy192 = TK_BEFORE; }
159393 break;
159394 case 251: /* trigger_event ::= DELETE|INSERT */
159395 case 252: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==252);
159396 {yymsp[0].minor.yy230.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy230.b = 0;}
159397 break;
159398 case 253: /* trigger_event ::= UPDATE OF idlist */
159399 {yymsp[-2].minor.yy230.a = TK_UPDATE; yymsp[-2].minor.yy230.b = yymsp[0].minor.yy600;}
159400 break;
159401 case 254: /* when_clause ::= */
159402 case 273: /* key_opt ::= */ yytestcase(yyruleno==273);
159403 { yymsp[1].minor.yy202 = 0; }
159404 break;
159405 case 255: /* when_clause ::= WHEN expr */
159406 case 274: /* key_opt ::= KEY expr */ yytestcase(yyruleno==274);
159407 { yymsp[-1].minor.yy202 = yymsp[0].minor.yy202; }
159408 break;
159409 case 256: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159410 {
159411 assert( yymsp[-2].minor.yy447!=0 );
159412 yymsp[-2].minor.yy447->pLast->pNext = yymsp[-1].minor.yy447;
159413 yymsp[-2].minor.yy447->pLast = yymsp[-1].minor.yy447;
159414 }
159415 break;
159416 case 257: /* trigger_cmd_list ::= trigger_cmd SEMI */
159417 {
159418 assert( yymsp[-1].minor.yy447!=0 );
159419 yymsp[-1].minor.yy447->pLast = yymsp[-1].minor.yy447;
159420 }
159421 break;
159422 case 258: /* trnm ::= nm DOT nm */
159423 {
159424 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
159425 sqlite3ErrorMsg(pParse,
159426 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
159427 "statements within triggers");
159428 }
159429 break;
159430 case 259: /* tridxby ::= INDEXED BY nm */
159431 {
159432 sqlite3ErrorMsg(pParse,
159433 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
159434 "within triggers");
159435 }
159436 break;
159437 case 260: /* tridxby ::= NOT INDEXED */
159438 {
159439 sqlite3ErrorMsg(pParse,
159440 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
159441 "within triggers");
159442 }
159443 break;
159444 case 261: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159445 {yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy47, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202, yymsp[-7].minor.yy192, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy436);}
159446 yymsp[-8].minor.yy447 = yylhsminor.yy447;
159447 break;
159448 case 262: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159449 {
159450 yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/
159451 }
159452 yymsp[-7].minor.yy447 = yylhsminor.yy447;
159453 break;
159454 case 263: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159455 {yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);}
159456 yymsp[-5].minor.yy447 = yylhsminor.yy447;
159457 break;
159458 case 264: /* trigger_cmd ::= scanpt select scanpt */
159459 {yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/}
159460 yymsp[-2].minor.yy447 = yylhsminor.yy447;
159461 break;
159462 case 265: /* expr ::= RAISE LP IGNORE RP */
159463 {
159464 yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
159465 if( yymsp[-3].minor.yy202 ){
159466 yymsp[-3].minor.yy202->affExpr = OE_Ignore;
159467 }
159468 }
159469 break;
159470 case 266: /* expr ::= RAISE LP raisetype COMMA nm RP */
159471 {
159472 yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
159473 if( yymsp[-5].minor.yy202 ) {
159474 yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192;
159475 }
159476 }
159477 break;
159478 case 267: /* raisetype ::= ROLLBACK */
159479 {yymsp[0].minor.yy192 = OE_Rollback;}
159480 break;
159481 case 269: /* raisetype ::= FAIL */
159482 {yymsp[0].minor.yy192 = OE_Fail;}
159483 break;
159484 case 270: /* cmd ::= DROP TRIGGER ifexists fullname */
159485 {
159486 sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192);
159487 }
159488 break;
159489 case 271: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159490 {
159491 sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202);
159492 }
159493 break;
159494 case 272: /* cmd ::= DETACH database_kw_opt expr */
159495 {
159496 sqlite3Detach(pParse, yymsp[0].minor.yy202);
159497 }
159498 break;
159499 case 275: /* cmd ::= REINDEX */
159500 {sqlite3Reindex(pParse, 0, 0);}
159501 break;
159502 case 276: /* cmd ::= REINDEX nm dbnm */
159503 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
159504 break;
159505 case 277: /* cmd ::= ANALYZE */
159506 {sqlite3Analyze(pParse, 0, 0);}
159507 break;
159508 case 278: /* cmd ::= ANALYZE nm dbnm */
159509 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
159510 break;
159511 case 279: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
159512 {
159513 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0);
159514 }
159515 break;
159516 case 280: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159517 {
159518 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
159519 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
159520 }
159521 break;
159522 case 281: /* add_column_fullname ::= fullname */
159523 {
159524 disableLookaside(pParse);
159525 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47);
159526 }
159527 break;
159528 case 282: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159529 {
159530 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
159531 }
159532 break;
159533 case 283: /* cmd ::= create_vtab */
159534 {sqlite3VtabFinishParse(pParse,0);}
159535 break;
159536 case 284: /* cmd ::= create_vtab LP vtabarglist RP */
159537 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
159538 break;
159539 case 285: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159540 {
159541 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy192);
159542 }
159543 break;
159544 case 286: /* vtabarg ::= */
159545 {sqlite3VtabArgInit(pParse);}
159546 break;
159547 case 287: /* vtabargtoken ::= ANY */
159548 case 288: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==288);
159549 case 289: /* lp ::= LP */ yytestcase(yyruleno==289);
159550 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
159551 break;
159552 case 290: /* with ::= WITH wqlist */
159553 case 291: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==291);
159554 { sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); }
159555 break;
159556 case 292: /* wqlist ::= nm eidlist_opt AS LP select RP */
159557 {
159558 yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/
159559 }
159560 break;
159561 case 293: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159562 {
159563 yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539);
159564 }
159565 break;
159566 case 294: /* windowdefn_list ::= windowdefn */
159567 { yylhsminor.yy303 = yymsp[0].minor.yy303; }
159568 yymsp[0].minor.yy303 = yylhsminor.yy303;
159569 break;
159570 case 295: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
159571 {
159572 assert( yymsp[0].minor.yy303!=0 );
159573 sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303);
159574 yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303;
159575 yylhsminor.yy303 = yymsp[0].minor.yy303;
159576 }
159577 yymsp[-2].minor.yy303 = yylhsminor.yy303;
159578 break;
159579 case 296: /* windowdefn ::= nm AS LP window RP */
159580 {
159581 if( ALWAYS(yymsp[-1].minor.yy303) ){
159582 yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
159583 }
159584 yylhsminor.yy303 = yymsp[-1].minor.yy303;
159585 }
159586 yymsp[-4].minor.yy303 = yylhsminor.yy303;
159587 break;
159588 case 297: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159589 {
159590 yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0);
159591 }
159592 break;
159593 case 298: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159594 {
159595 yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0);
159596 }
159597 yymsp[-5].minor.yy303 = yylhsminor.yy303;
159598 break;
159599 case 299: /* window ::= ORDER BY sortlist frame_opt */
159600 {
159601 yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0);
159602 }
159603 break;
159604 case 300: /* window ::= nm ORDER BY sortlist frame_opt */
159605 {
159606 yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0);
159607 }
159608 yymsp[-4].minor.yy303 = yylhsminor.yy303;
159609 break;
159610 case 301: /* window ::= frame_opt */
159611 case 320: /* filter_over ::= over_clause */ yytestcase(yyruleno==320);
159612 {
159613 yylhsminor.yy303 = yymsp[0].minor.yy303;
159614 }
159615 yymsp[0].minor.yy303 = yylhsminor.yy303;
159616 break;
159617 case 302: /* window ::= nm frame_opt */
159618 {
159619 yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0);
159620 }
159621 yymsp[-1].minor.yy303 = yylhsminor.yy303;
159622 break;
159623 case 303: /* frame_opt ::= */
159624 {
159625 yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
159626 }
159627 break;
159628 case 304: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159629 {
159630 yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58);
159631 }
159632 yymsp[-2].minor.yy303 = yylhsminor.yy303;
159633 break;
159634 case 305: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159635 {
159636 yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58);
159637 }
159638 yymsp[-5].minor.yy303 = yylhsminor.yy303;
159639 break;
159640 case 307: /* frame_bound_s ::= frame_bound */
159641 case 309: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==309);
159642 {yylhsminor.yy77 = yymsp[0].minor.yy77;}
159643 yymsp[0].minor.yy77 = yylhsminor.yy77;
159644 break;
159645 case 308: /* frame_bound_s ::= UNBOUNDED PRECEDING */
159646 case 310: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==310);
159647 case 312: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==312);
159648 {yylhsminor.yy77.eType = yymsp[-1].major; yylhsminor.yy77.pExpr = 0;}
159649 yymsp[-1].minor.yy77 = yylhsminor.yy77;
159650 break;
159651 case 311: /* frame_bound ::= expr PRECEDING|FOLLOWING */
159652 {yylhsminor.yy77.eType = yymsp[0].major; yylhsminor.yy77.pExpr = yymsp[-1].minor.yy202;}
159653 yymsp[-1].minor.yy77 = yylhsminor.yy77;
159654 break;
159655 case 313: /* frame_exclude_opt ::= */
159656 {yymsp[1].minor.yy58 = 0;}
159657 break;
159658 case 314: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
159659 {yymsp[-1].minor.yy58 = yymsp[0].minor.yy58;}
159660 break;
159661 case 315: /* frame_exclude ::= NO OTHERS */
159662 case 316: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==316);
159663 {yymsp[-1].minor.yy58 = yymsp[-1].major; /*A-overwrites-X*/}
159664 break;
159665 case 317: /* frame_exclude ::= GROUP|TIES */
159666 {yymsp[0].minor.yy58 = yymsp[0].major; /*A-overwrites-X*/}
159667 break;
159668 case 318: /* window_clause ::= WINDOW windowdefn_list */
159669 { yymsp[-1].minor.yy303 = yymsp[0].minor.yy303; }
159670 break;
159671 case 319: /* filter_over ::= filter_clause over_clause */
159672 {
159673 yymsp[0].minor.yy303->pFilter = yymsp[-1].minor.yy202;
159674 yylhsminor.yy303 = yymsp[0].minor.yy303;
159675 }
159676 yymsp[-1].minor.yy303 = yylhsminor.yy303;
159677 break;
159678 case 321: /* filter_over ::= filter_clause */
159679 {
159680 yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
159681 if( yylhsminor.yy303 ){
159682 yylhsminor.yy303->eFrmType = TK_FILTER;
159683 yylhsminor.yy303->pFilter = yymsp[0].minor.yy202;
@@ -159685,88 +160798,88 @@
159685 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202);
159686 }
159687 }
159688 yymsp[0].minor.yy303 = yylhsminor.yy303;
159689 break;
159690 case 322: /* over_clause ::= OVER LP window RP */
159691 {
159692 yymsp[-3].minor.yy303 = yymsp[-1].minor.yy303;
159693 assert( yymsp[-3].minor.yy303!=0 );
159694 }
159695 break;
159696 case 323: /* over_clause ::= OVER nm */
159697 {
159698 yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
159699 if( yymsp[-1].minor.yy303 ){
159700 yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
159701 }
159702 }
159703 break;
159704 case 324: /* filter_clause ::= FILTER LP WHERE expr RP */
159705 { yymsp[-4].minor.yy202 = yymsp[-1].minor.yy202; }
159706 break;
159707 default:
159708 /* (325) input ::= cmdlist */ yytestcase(yyruleno==325);
159709 /* (326) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==326);
159710 /* (327) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=327);
159711 /* (328) ecmd ::= SEMI */ yytestcase(yyruleno==328);
159712 /* (329) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==329);
159713 /* (330) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=330);
159714 /* (331) trans_opt ::= */ yytestcase(yyruleno==331);
159715 /* (332) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==332);
159716 /* (333) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==333);
159717 /* (334) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==334);
159718 /* (335) savepoint_opt ::= */ yytestcase(yyruleno==335);
159719 /* (336) cmd ::= create_table create_table_args */ yytestcase(yyruleno==336);
159720 /* (337) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==337);
159721 /* (338) columnlist ::= columnname carglist */ yytestcase(yyruleno==338);
159722 /* (339) nm ::= ID|INDEXED */ yytestcase(yyruleno==339);
159723 /* (340) nm ::= STRING */ yytestcase(yyruleno==340);
159724 /* (341) nm ::= JOIN_KW */ yytestcase(yyruleno==341);
159725 /* (342) typetoken ::= typename */ yytestcase(yyruleno==342);
159726 /* (343) typename ::= ID|STRING */ yytestcase(yyruleno==343);
159727 /* (344) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=344);
159728 /* (345) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
159729 /* (346) carglist ::= carglist ccons */ yytestcase(yyruleno==346);
159730 /* (347) carglist ::= */ yytestcase(yyruleno==347);
159731 /* (348) ccons ::= NULL onconf */ yytestcase(yyruleno==348);
159732 /* (349) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==349);
159733 /* (350) ccons ::= AS generated */ yytestcase(yyruleno==350);
159734 /* (351) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==351);
159735 /* (352) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==352);
159736 /* (353) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=353);
159737 /* (354) tconscomma ::= */ yytestcase(yyruleno==354);
159738 /* (355) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=355);
159739 /* (356) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=356);
159740 /* (357) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=357);
159741 /* (358) oneselect ::= values */ yytestcase(yyruleno==358);
159742 /* (359) sclp ::= selcollist COMMA */ yytestcase(yyruleno==359);
159743 /* (360) as ::= ID|STRING */ yytestcase(yyruleno==360);
159744 /* (361) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=361);
159745 /* (362) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==362);
159746 /* (363) exprlist ::= nexprlist */ yytestcase(yyruleno==363);
159747 /* (364) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=364);
159748 /* (365) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=365);
159749 /* (366) nmnum ::= ON */ yytestcase(yyruleno==366);
159750 /* (367) nmnum ::= DELETE */ yytestcase(yyruleno==367);
159751 /* (368) nmnum ::= DEFAULT */ yytestcase(yyruleno==368);
159752 /* (369) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==369);
159753 /* (370) foreach_clause ::= */ yytestcase(yyruleno==370);
159754 /* (371) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==371);
159755 /* (372) trnm ::= nm */ yytestcase(yyruleno==372);
159756 /* (373) tridxby ::= */ yytestcase(yyruleno==373);
159757 /* (374) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==374);
159758 /* (375) database_kw_opt ::= */ yytestcase(yyruleno==375);
159759 /* (376) kwcolumn_opt ::= */ yytestcase(yyruleno==376);
159760 /* (377) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==377);
159761 /* (378) vtabarglist ::= vtabarg */ yytestcase(yyruleno==378);
159762 /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==379);
159763 /* (380) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==380);
159764 /* (381) anylist ::= */ yytestcase(yyruleno==381);
159765 /* (382) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==382);
159766 /* (383) anylist ::= anylist ANY */ yytestcase(yyruleno==383);
159767 /* (384) with ::= */ yytestcase(yyruleno==384);
159768 break;
159769 /********** End reduce actions ************************************************/
159770 };
159771 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
159772 yygoto = yyRuleInfoLhs[yyruleno];
@@ -159914,16 +161027,60 @@
159914 yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
159915 }
159916 }
159917 #endif
159918
159919 do{
 
159920 assert( yyact==yypParser->yytos->stateno );
159921 yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
159922 if( yyact >= YY_MIN_REDUCE ){
159923 yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
159924 yyminor sqlite3ParserCTX_PARAM);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159925 }else if( yyact <= YY_MAX_SHIFTREDUCE ){
159926 yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
159927 #ifndef YYNOERRORRECOVERY
159928 yypParser->yyerrcnt--;
159929 #endif
@@ -160032,11 +161189,11 @@
160032 #endif
160033 }
160034 break;
160035 #endif
160036 }
160037 }while( yypParser->yytos>yypParser->yystack );
160038 #ifndef NDEBUG
160039 if( yyTraceFILE ){
160040 yyStackEntry *i;
160041 char cDiv = '[';
160042 fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
@@ -160093,12 +161250,12 @@
160093 ** The lookup table is much faster. To maximize speed, and to ensure that
160094 ** a lookup table is used, all of the classes need to be small integers and
160095 ** all of them need to be used within the switch.
160096 */
160097 #define CC_X 0 /* The letter 'x', or start of BLOB literal */
160098 #define CC_KYWD 1 /* Alphabetics or '_'. Usable in a keyword */
160099 #define CC_ID 2 /* unicode characters usable in IDs */
160100 #define CC_DIGIT 3 /* Digits */
160101 #define CC_DOLLAR 4 /* '$' */
160102 #define CC_VARALPHA 5 /* '@', '#', ':'. Alphabetic SQL variables */
160103 #define CC_VARNUM 6 /* '?'. Numeric SQL variables */
160104 #define CC_SPACE 7 /* Space characters */
@@ -160119,24 +161276,25 @@
160119 #define CC_PERCENT 22 /* '%' */
160120 #define CC_COMMA 23 /* ',' */
160121 #define CC_AND 24 /* '&' */
160122 #define CC_TILDA 25 /* '~' */
160123 #define CC_DOT 26 /* '.' */
160124 #define CC_ILLEGAL 27 /* Illegal character */
160125 #define CC_NUL 28 /* 0x00 */
 
160126
160127 static const unsigned char aiClass[] = {
160128 #ifdef SQLITE_ASCII
160129 /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
160130 /* 0x */ 28, 27, 27, 27, 27, 27, 27, 27, 27, 7, 7, 27, 7, 7, 27, 27,
160131 /* 1x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
160132 /* 2x */ 7, 15, 8, 5, 4, 22, 24, 8, 17, 18, 21, 20, 23, 11, 26, 16,
160133 /* 3x */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 19, 12, 14, 13, 6,
160134 /* 4x */ 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
160135 /* 5x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 9, 27, 27, 27, 1,
160136 /* 6x */ 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
160137 /* 7x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 27, 10, 27, 25, 27,
160138 /* 8x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160139 /* 9x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160140 /* Ax */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160141 /* Bx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160142 /* Cx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -160144,26 +161302,26 @@
160144 /* Ex */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160145 /* Fx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
160146 #endif
160147 #ifdef SQLITE_EBCDIC
160148 /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
160149 /* 0x */ 27, 27, 27, 27, 27, 7, 27, 27, 27, 27, 27, 27, 7, 7, 27, 27,
160150 /* 1x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
160151 /* 2x */ 27, 27, 27, 27, 27, 7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
160152 /* 3x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
160153 /* 4x */ 7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 12, 17, 20, 10,
160154 /* 5x */ 24, 27, 27, 27, 27, 27, 27, 27, 27, 27, 15, 4, 21, 18, 19, 27,
160155 /* 6x */ 11, 16, 27, 27, 27, 27, 27, 27, 27, 27, 27, 23, 22, 1, 13, 6,
160156 /* 7x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 8, 5, 5, 5, 8, 14, 8,
160157 /* 8x */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160158 /* 9x */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160159 /* Ax */ 27, 25, 1, 1, 1, 1, 1, 0, 1, 1, 27, 27, 27, 27, 27, 27,
160160 /* Bx */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 9, 27, 27, 27, 27, 27,
160161 /* Cx */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160162 /* Dx */ 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 27,
160163 /* Ex */ 27, 27, 1, 1, 1, 1, 1, 0, 1, 1, 27, 27, 27, 27, 27, 27,
160164 /* Fx */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 27, 27, 27, 27, 27, 27,
160165 #endif
160166 };
160167
160168 /*
160169 ** The charMap() macro maps alphabetic characters (only) into their
@@ -160504,11 +161662,11 @@
160504 ** return the integer n (the length of the token). */
160505 static int keywordCode(const char *z, int n, int *pType){
160506 int i, j;
160507 const char *zKW;
160508 if( n>=2 ){
160509 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;
160510 for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
160511 if( aKWLen[i]!=n ) continue;
160512 zKW = &zKWText[aKWOffset[i]];
160513 #ifdef SQLITE_ASCII
160514 if( (z[0]&~0x20)!=zKW[0] ) continue;
@@ -161046,11 +162204,11 @@
161046 }
161047 }
161048 if( n==0 ) *tokenType = TK_ILLEGAL;
161049 return i;
161050 }
161051 case CC_KYWD: {
161052 for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}
161053 if( IdChar(z[i]) ){
161054 /* This token started out using characters that can appear in keywords,
161055 ** but z[i] is a character not allowed within keywords, so this must
161056 ** be an identifier instead */
@@ -161076,10 +162234,11 @@
161076 #endif
161077 /* If it is not a BLOB literal, then it must be an ID, since no
161078 ** SQL keywords start with the letter 'x'. Fall through */
161079 /* no break */ deliberate_fall_through
161080 }
 
161081 case CC_ID: {
161082 i = 1;
161083 break;
161084 }
161085 case CC_NUL: {
@@ -161258,23 +162417,11 @@
161258 sqlite3DeleteTable(db, pParse->pNewTable);
161259 }
161260 if( !IN_RENAME_OBJECT ){
161261 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
161262 }
161263
161264 if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree);
161265 sqlite3DbFree(db, pParse->pVList);
161266 while( pParse->pAinc ){
161267 AutoincInfo *p = pParse->pAinc;
161268 pParse->pAinc = p->pNext;
161269 sqlite3DbFreeNN(db, p);
161270 }
161271 while( pParse->pZombieTab ){
161272 Table *p = pParse->pZombieTab;
161273 pParse->pZombieTab = p->pNextZombie;
161274 sqlite3DeleteTable(db, p);
161275 }
161276 db->pParse = pParse->pParentParse;
161277 pParse->pParentParse = 0;
161278 assert( nErr==0 || pParse->rc!=SQLITE_OK );
161279 return nErr;
161280 }
@@ -165883,11 +167030,11 @@
165883 ** with various optimizations disabled to verify that the same answer
165884 ** is obtained in every case.
165885 */
165886 case SQLITE_TESTCTRL_OPTIMIZATIONS: {
165887 sqlite3 *db = va_arg(ap, sqlite3*);
165888 db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
165889 break;
165890 }
165891
165892 /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
165893 **
@@ -166058,11 +167205,30 @@
166058 *pn = sqlite3BtreeSeekCount(db->aDb->pBt);
166059 (void)db; /* Silence harmless unused variable warning */
166060 break;
166061 }
166062
166063
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166064 }
166065 va_end(ap);
166066 #endif /* SQLITE_UNTESTABLE */
166067 return rc;
166068 }
@@ -203337,10 +204503,11 @@
203337 int bIndirect; /* True if all changes are indirect */
203338 int bAutoAttach; /* True to auto-attach tables */
203339 int rc; /* Non-zero if an error has occurred */
203340 void *pFilterCtx; /* First argument to pass to xTableFilter */
203341 int (*xTableFilter)(void *pCtx, const char *zTab);
 
203342 sqlite3_value *pZeroBlob; /* Value containing X'' */
203343 sqlite3_session *pNext; /* Next session object on same db. */
203344 SessionTable *pTable; /* List of attached tables */
203345 SessionHook hook; /* APIs to grab new and old data with */
203346 };
@@ -203720,10 +204887,30 @@
203720
203721 if( pnWrite ) *pnWrite += nByte;
203722 return SQLITE_OK;
203723 }
203724
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203725
203726 /*
203727 ** This macro is used to calculate hash key values for data structures. In
203728 ** order to use this macro, the entire data structure must be represented
203729 ** as a series of unsigned integers. In order to calculate a hash-key value
@@ -204187,17 +205374,23 @@
204187 ** It is possible that a non-fatal OOM error occurs in this function. In
204188 ** that case the hash-table does not grow, but SQLITE_OK is returned anyway.
204189 ** Growing the hash table in this case is a performance optimization only,
204190 ** it is not required for correct operation.
204191 */
204192 static int sessionGrowHash(int bPatchset, SessionTable *pTab){
 
 
 
 
204193 if( pTab->nChange==0 || pTab->nEntry>=(pTab->nChange/2) ){
204194 int i;
204195 SessionChange **apNew;
204196 sqlite3_int64 nNew = 2*(sqlite3_int64)(pTab->nChange ? pTab->nChange : 128);
204197
204198 apNew = (SessionChange **)sqlite3_malloc64(sizeof(SessionChange *) * nNew);
 
 
204199 if( apNew==0 ){
204200 if( pTab->nChange==0 ){
204201 return SQLITE_ERROR;
204202 }
204203 return SQLITE_OK;
@@ -204214,11 +205407,11 @@
204214 p->pNext = apNew[iHash];
204215 apNew[iHash] = p;
204216 }
204217 }
204218
204219 sqlite3_free(pTab->apChange);
204220 pTab->nChange = nNew;
204221 pTab->apChange = apNew;
204222 }
204223
204224 return SQLITE_OK;
@@ -204248,10 +205441,11 @@
204248 **
204249 ** All returned buffers are part of the same single allocation, which must
204250 ** be freed using sqlite3_free() by the caller
204251 */
204252 static int sessionTableInfo(
 
204253 sqlite3 *db, /* Database connection */
204254 const char *zDb, /* Name of attached database (e.g. "main") */
204255 const char *zThis, /* Table name */
204256 int *pnCol, /* OUT: number of columns */
204257 const char **pzTab, /* OUT: Copy of zThis */
@@ -204302,11 +205496,11 @@
204302 }
204303 rc = sqlite3_reset(pStmt);
204304
204305 if( rc==SQLITE_OK ){
204306 nByte += nDbCol * (sizeof(const char *) + sizeof(u8) + 1);
204307 pAlloc = sqlite3_malloc64(nByte);
204308 if( pAlloc==0 ){
204309 rc = SQLITE_NOMEM;
204310 }
204311 }
204312 if( rc==SQLITE_OK ){
@@ -204345,11 +205539,11 @@
204345 }else{
204346 *pazCol = 0;
204347 *pabPK = 0;
204348 *pnCol = 0;
204349 if( pzTab ) *pzTab = 0;
204350 sqlite3_free(azCol);
204351 }
204352 sqlite3_finalize(pStmt);
204353 return rc;
204354 }
204355
@@ -204367,11 +205561,11 @@
204367 */
204368 static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){
204369 if( pTab->nCol==0 ){
204370 u8 *abPK;
204371 assert( pTab->azCol==0 || pTab->abPK==0 );
204372 pSession->rc = sessionTableInfo(pSession->db, pSession->zDb,
204373 pTab->zName, &pTab->nCol, 0, &pTab->azCol, &abPK
204374 );
204375 if( pSession->rc==SQLITE_OK ){
204376 int i;
204377 for(i=0; i<pTab->nCol; i++){
@@ -204458,11 +205652,11 @@
204458 pSession->rc = SQLITE_SCHEMA;
204459 return;
204460 }
204461
204462 /* Grow the hash table if required */
204463 if( sessionGrowHash(0, pTab) ){
204464 pSession->rc = SQLITE_NOMEM;
204465 return;
204466 }
204467
204468 if( pTab->bStat1 ){
@@ -204525,11 +205719,11 @@
204525 rc = sessionSerializeValue(0, p, &nByte);
204526 if( rc!=SQLITE_OK ) goto error_out;
204527 }
204528
204529 /* Allocate the change object */
204530 pChange = (SessionChange *)sqlite3_malloc64(nByte);
204531 if( !pChange ){
204532 rc = SQLITE_NOMEM;
204533 goto error_out;
204534 }else{
204535 memset(pChange, 0, sizeof(SessionChange));
@@ -204898,11 +206092,11 @@
204898 int bHasPk = 0;
204899 int bMismatch = 0;
204900 int nCol; /* Columns in zFrom.zTbl */
204901 u8 *abPK;
204902 const char **azCol = 0;
204903 rc = sessionTableInfo(db, zFrom, zTbl, &nCol, 0, &azCol, &abPK);
204904 if( rc==SQLITE_OK ){
204905 if( pTo->nCol!=nCol ){
204906 bMismatch = 1;
204907 }else{
204908 int i;
@@ -204996,11 +206190,11 @@
204996
204997 /*
204998 ** Free the list of table objects passed as the first argument. The contents
204999 ** of the changed-rows hash tables are also deleted.
205000 */
205001 static void sessionDeleteTable(SessionTable *pList){
205002 SessionTable *pNext;
205003 SessionTable *pTab;
205004
205005 for(pTab=pList; pTab; pTab=pNext){
205006 int i;
@@ -205008,16 +206202,16 @@
205008 for(i=0; i<pTab->nChange; i++){
205009 SessionChange *p;
205010 SessionChange *pNextChange;
205011 for(p=pTab->apChange[i]; p; p=pNextChange){
205012 pNextChange = p->pNext;
205013 sqlite3_free(p);
205014 }
205015 }
205016 sqlite3_free((char*)pTab->azCol); /* cast works around VC++ bug */
205017 sqlite3_free(pTab->apChange);
205018 sqlite3_free(pTab);
205019 }
205020 }
205021
205022 /*
205023 ** Delete a session object previously allocated using sqlite3session_create().
@@ -205041,13 +206235,15 @@
205041 sqlite3_mutex_leave(sqlite3_db_mutex(db));
205042 sqlite3ValueFree(pSession->pZeroBlob);
205043
205044 /* Delete all attached table objects. And the contents of their
205045 ** associated hash-tables. */
205046 sessionDeleteTable(pSession->pTable);
205047
205048 /* Free the session object itself. */
 
 
205049 sqlite3_free(pSession);
205050 }
205051
205052 /*
205053 ** Set a table filter on a Session Object.
@@ -205090,11 +206286,12 @@
205090 if( 0==sqlite3_strnicmp(pTab->zName, zName, nName+1) ) break;
205091 }
205092
205093 if( !pTab ){
205094 /* Allocate new SessionTable object. */
205095 pTab = (SessionTable *)sqlite3_malloc64(sizeof(SessionTable) + nName + 1);
 
205096 if( !pTab ){
205097 rc = SQLITE_NOMEM;
205098 }else{
205099 /* Populate the new SessionTable object and link it into the list.
205100 ** The new object must be linked onto the end of the list, not
@@ -205687,11 +206884,11 @@
205687 sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */
205688 int nRewind = buf.nBuf; /* Initial size of write buffer */
205689 int nNoop; /* Size of buffer after writing tbl header */
205690
205691 /* Check the table schema is still Ok. */
205692 rc = sessionTableInfo(db, pSession->zDb, zName, &nCol, 0, &azCol, &abPK);
205693 if( !rc && (pTab->nCol!=nCol || memcmp(abPK, pTab->abPK, nCol)) ){
205694 rc = SQLITE_SCHEMA;
205695 }
205696
205697 /* Write a table header */
@@ -205861,10 +207058,17 @@
205861 }
205862 sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db));
205863
205864 return (ret==0);
205865 }
 
 
 
 
 
 
 
205866
205867 /*
205868 ** Do the work for either sqlite3changeset_start() or start_strm().
205869 */
205870 static int sessionChangesetStart(
@@ -207673,11 +208877,11 @@
207673 }else{
207674 int nMinCol = 0;
207675 int i;
207676
207677 sqlite3changeset_pk(pIter, &abPK, 0);
207678 rc = sessionTableInfo(
207679 db, "main", zNew, &sApply.nCol, &zTab, &sApply.azCol, &sApply.abPK
207680 );
207681 if( rc!=SQLITE_OK ) break;
207682 for(i=0; i<sApply.nCol; i++){
207683 if( sApply.abPK[i] ) nMinCol = i+1;
@@ -208152,11 +209356,11 @@
208152 rc = SQLITE_SCHEMA;
208153 break;
208154 }
208155 }
208156
208157 if( sessionGrowHash(pIter->bPatchset, pTab) ){
208158 rc = SQLITE_NOMEM;
208159 break;
208160 }
208161 iHash = sessionChangeHash(
208162 pTab, (pIter->bPatchset && op==SQLITE_DELETE), aRec, pTab->nChange
@@ -208338,11 +209542,11 @@
208338 /*
208339 ** Delete a changegroup object.
208340 */
208341 SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
208342 if( pGrp ){
208343 sessionDeleteTable(pGrp->pList);
208344 sqlite3_free(pGrp);
208345 }
208346 }
208347
208348 /*
@@ -208739,11 +209943,11 @@
208739 /*
208740 ** Destroy a rebaser object
208741 */
208742 SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p){
208743 if( p ){
208744 sessionDeleteTable(p->grp.pList);
208745 sqlite3_free(p);
208746 }
208747 }
208748
208749 /*
@@ -211201,59 +212405,10 @@
211201 int fts5yysize; /* Amount to pop the stack */
211202 sqlite3Fts5ParserARG_FETCH
211203 (void)fts5yyLookahead;
211204 (void)fts5yyLookaheadToken;
211205 fts5yymsp = fts5yypParser->fts5yytos;
211206 assert( fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) );
211207 #ifndef NDEBUG
211208 if( fts5yyTraceFILE ){
211209 fts5yysize = fts5yyRuleInfoNRhs[fts5yyruleno];
211210 if( fts5yysize ){
211211 fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
211212 fts5yyTracePrompt,
211213 fts5yyruleno, fts5yyRuleName[fts5yyruleno],
211214 fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action",
211215 fts5yymsp[fts5yysize].stateno);
211216 }else{
211217 fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s.\n",
211218 fts5yyTracePrompt, fts5yyruleno, fts5yyRuleName[fts5yyruleno],
211219 fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action");
211220 }
211221 }
211222 #endif /* NDEBUG */
211223
211224 /* Check that the stack is large enough to grow by a single entry
211225 ** if the RHS of the rule is empty. This ensures that there is room
211226 ** enough on the stack to push the LHS value */
211227 if( fts5yyRuleInfoNRhs[fts5yyruleno]==0 ){
211228 #ifdef fts5YYTRACKMAXSTACKDEPTH
211229 if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){
211230 fts5yypParser->fts5yyhwm++;
211231 assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack));
211232 }
211233 #endif
211234 #if fts5YYSTACKDEPTH>0
211235 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
211236 fts5yyStackOverflow(fts5yypParser);
211237 /* The call to fts5yyStackOverflow() above pops the stack until it is
211238 ** empty, causing the main parser loop to exit. So the return value
211239 ** is never used and does not matter. */
211240 return 0;
211241 }
211242 #else
211243 if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
211244 if( fts5yyGrowStack(fts5yypParser) ){
211245 fts5yyStackOverflow(fts5yypParser);
211246 /* The call to fts5yyStackOverflow() above pops the stack until it is
211247 ** empty, causing the main parser loop to exit. So the return value
211248 ** is never used and does not matter. */
211249 return 0;
211250 }
211251 fts5yymsp = fts5yypParser->fts5yytos;
211252 }
211253 #endif
211254 }
211255
211256 switch( fts5yyruleno ){
211257 /* Beginning here are the reduction cases. A typical example
211258 ** follows:
211259 ** case 0:
@@ -211552,16 +212707,60 @@
211552 fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact-fts5YY_MIN_REDUCE);
211553 }
211554 }
211555 #endif
211556
211557 do{
 
211558 assert( fts5yyact==fts5yypParser->fts5yytos->stateno );
211559 fts5yyact = fts5yy_find_shift_action((fts5YYCODETYPE)fts5yymajor,fts5yyact);
211560 if( fts5yyact >= fts5YY_MIN_REDUCE ){
211561 fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor,
211562 fts5yyminor sqlite3Fts5ParserCTX_PARAM);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211563 }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
211564 fts5yy_shift(fts5yypParser,fts5yyact,(fts5YYCODETYPE)fts5yymajor,fts5yyminor);
211565 #ifndef fts5YYNOERRORRECOVERY
211566 fts5yypParser->fts5yyerrcnt--;
211567 #endif
@@ -211670,11 +212869,11 @@
211670 #endif
211671 }
211672 break;
211673 #endif
211674 }
211675 }while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );
211676 #ifndef NDEBUG
211677 if( fts5yyTraceFILE ){
211678 fts5yyStackEntry *i;
211679 char cDiv = '[';
211680 fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt);
@@ -215282,12 +216481,12 @@
215282 ){
215283 rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
215284 }
215285
215286 /* If the iterator is not at a real match, skip forward until it is. */
215287 while( pRoot->bNomatch ){
215288 assert( pRoot->bEof==0 && rc==SQLITE_OK );
215289 rc = fts5ExprNodeNext(p, pRoot, 0, 0);
215290 }
215291 return rc;
215292 }
215293
@@ -219468,18 +220667,14 @@
219468 if( pbNewTerm ) *pbNewTerm = 1;
219469 }
219470 }else{
219471 /* The following could be done by calling fts5SegIterLoadNPos(). But
219472 ** this block is particularly performance critical, so equivalent
219473 ** code is inlined.
219474 **
219475 ** Later: Switched back to fts5SegIterLoadNPos() because it supports
219476 ** detail=none mode. Not ideal.
219477 */
219478 int nSz;
219479 assert( p->rc==SQLITE_OK );
219480 assert( pIter->iLeafOffset<=pIter->pLeaf->nn );
219481 fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);
219482 pIter->bDel = (nSz & 0x0001);
219483 pIter->nPos = nSz>>1;
219484 assert_nc( pIter->nPos>=0 );
219485 }
@@ -220467,11 +221662,11 @@
220467 u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset];
220468 int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset);
220469 int pgno = pSeg->iLeafPgno;
220470 int pgnoSave = 0;
220471
220472 /* This function does notmwork with detail=none databases. */
220473 assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );
220474
220475 if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){
220476 pgnoSave = pgno+1;
220477 }
@@ -220480,10 +221675,13 @@
220480 xChunk(p, pCtx, pChunk, nChunk);
220481 nRem -= nChunk;
220482 fts5DataRelease(pData);
220483 if( nRem<=0 ){
220484 break;
 
 
 
220485 }else{
220486 pgno++;
220487 pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
220488 if( pData==0 ) break;
220489 pChunk = &pData->p[4];
@@ -220531,70 +221729,76 @@
220531 }
220532 }
220533 }
220534
220535 /*
220536 ** IN/OUT parameter (*pa) points to a position list n bytes in size. If
220537 ** the position list contains entries for column iCol, then (*pa) is set
220538 ** to point to the sub-position-list for that column and the number of
220539 ** bytes in it returned. Or, if the argument position list does not
220540 ** contain any entries for column iCol, return 0.
 
 
 
 
 
220541 */
220542 static int fts5IndexExtractCol(
220543 const u8 **pa, /* IN/OUT: Pointer to poslist */
220544 int n, /* IN: Size of poslist in bytes */
220545 int iCol /* Column to extract from poslist */
220546 ){
220547 int iCurrent = 0; /* Anything before the first 0x01 is col 0 */
220548 const u8 *p = *pa;
220549 const u8 *pEnd = &p[n]; /* One byte past end of position list */
220550
220551 while( iCol>iCurrent ){
220552 /* Advance pointer p until it points to pEnd or an 0x01 byte that is
220553 ** not part of a varint. Note that it is not possible for a negative
220554 ** or extremely large varint to occur within an uncorrupted position
220555 ** list. So the last byte of each varint may be assumed to have a clear
220556 ** 0x80 bit. */
220557 while( *p!=0x01 ){
220558 while( *p++ & 0x80 );
220559 if( p>=pEnd ) return 0;
220560 }
220561 *pa = p++;
220562 iCurrent = *p++;
220563 if( iCurrent & 0x80 ){
220564 p--;
220565 p += fts5GetVarint32(p, iCurrent);
220566 }
220567 }
220568 if( iCol!=iCurrent ) return 0;
220569
220570 /* Advance pointer p until it points to pEnd or an 0x01 byte that is
220571 ** not part of a varint */
220572 while( p<pEnd && *p!=0x01 ){
220573 while( *p++ & 0x80 );
220574 }
220575
220576 return p - (*pa);
220577 }
220578
220579 static void fts5IndexExtractColset(
220580 int *pRc,
220581 Fts5Colset *pColset, /* Colset to filter on */
220582 const u8 *pPos, int nPos, /* Position list */
220583 Fts5Buffer *pBuf /* Output buffer */
220584 ){
220585 if( *pRc==SQLITE_OK ){
220586 int i;
220587 fts5BufferZero(pBuf);
220588 for(i=0; i<pColset->nCol; i++){
220589 const u8 *pSub = pPos;
220590 int nSub = fts5IndexExtractCol(&pSub, nPos, pColset->aiCol[i]);
220591 if( nSub ){
220592 fts5BufferAppendBlob(pRc, pBuf, nSub, pSub);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220593 }
220594 }
220595 }
 
220596 }
220597
220598 /*
220599 ** xSetOutputs callback used by detail=none tables.
220600 */
@@ -220710,20 +221914,13 @@
220710
220711 if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
220712 /* All data is stored on the current page. Populate the output
220713 ** variables to point into the body of the page object. */
220714 const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
220715 if( pColset->nCol==1 ){
220716 pIter->base.nData = fts5IndexExtractCol(&a, pSeg->nPos,pColset->aiCol[0]);
220717 pIter->base.pData = a;
220718 }else{
220719 int *pRc = &pIter->pIndex->rc;
220720 fts5BufferZero(&pIter->poslist);
220721 fts5IndexExtractColset(pRc, pColset, a, pSeg->nPos, &pIter->poslist);
220722 pIter->base.pData = pIter->poslist.p;
220723 pIter->base.nData = pIter->poslist.n;
220724 }
220725 }else{
220726 /* The data is distributed over two or more pages. Copy it into the
220727 ** Fts5Iter.poslist buffer and then set the output pointer to point
220728 ** to this buffer. */
220729 fts5BufferZero(&pIter->poslist);
@@ -222202,11 +223399,11 @@
222202
222203
222204 static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
222205 u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;
222206
222207 assert( pIter->aPoslist );
222208 if( p>=pIter->aEof ){
222209 pIter->aPoslist = 0;
222210 }else{
222211 i64 iDelta;
222212
@@ -222286,20 +223483,24 @@
222286 ** In this case the buffers consist of a delta-encoded list of rowids only.
222287 */
222288 static void fts5MergeRowidLists(
222289 Fts5Index *p, /* FTS5 backend object */
222290 Fts5Buffer *p1, /* First list to merge */
222291 Fts5Buffer *p2 /* Second list to merge */
 
222292 ){
222293 int i1 = 0;
222294 int i2 = 0;
222295 i64 iRowid1 = 0;
222296 i64 iRowid2 = 0;
222297 i64 iOut = 0;
222298
222299 Fts5Buffer out;
 
 
222300 memset(&out, 0, sizeof(out));
 
222301 sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);
222302 if( p->rc ) return;
222303
222304 fts5NextRowid(p1, &i1, &iRowid1);
222305 fts5NextRowid(p2, &i2, &iRowid2);
@@ -222321,185 +223522,218 @@
222321 }
222322
222323 fts5BufferSwap(&out, p1);
222324 fts5BufferFree(&out);
222325 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222326
222327 /*
222328 ** Buffers p1 and p2 contain doclists. This function merges the content
222329 ** of the two doclists together and sets buffer p1 to the result before
222330 ** returning.
222331 **
222332 ** If an error occurs, an error code is left in p->rc. If an error has
222333 ** already occurred, this function is a no-op.
222334 */
222335 static void fts5MergePrefixLists(
222336 Fts5Index *p, /* FTS5 backend object */
222337 Fts5Buffer *p1, /* First list to merge */
222338 Fts5Buffer *p2 /* Second list to merge */
222339 ){
222340 if( p2->n ){
222341 i64 iLastRowid = 0;
222342 Fts5DoclistIter i1;
222343 Fts5DoclistIter i2;
222344 Fts5Buffer out = {0, 0, 0};
222345 Fts5Buffer tmp = {0, 0, 0};
222346
222347 /* The maximum size of the output is equal to the sum of the two
222348 ** input sizes + 1 varint (9 bytes). The extra varint is because if the
222349 ** first rowid in one input is a large negative number, and the first in
222350 ** the other a non-negative number, the delta for the non-negative
222351 ** number will be larger on disk than the literal integer value
222352 ** was.
222353 **
222354 ** Or, if the input position-lists are corrupt, then the output might
222355 ** include up to 2 extra 10-byte positions created by interpreting -1
222356 ** (the value PoslistNext64() uses for EOF) as a position and appending
222357 ** it to the output. This can happen at most once for each input
222358 ** position-list, hence two 10 byte paddings. */
222359 if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9+10+10) ) return;
222360 fts5DoclistIterInit(p1, &i1);
222361 fts5DoclistIterInit(p2, &i2);
222362
222363 while( 1 ){
222364 if( i1.iRowid<i2.iRowid ){
222365 /* Copy entry from i1 */
222366 fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
222367 fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.nPoslist+i1.nSize);
222368 fts5DoclistIterNext(&i1);
222369 if( i1.aPoslist==0 ) break;
222370 assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
222371 }
222372 else if( i2.iRowid!=i1.iRowid ){
222373 /* Copy entry from i2 */
222374 fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
222375 fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.nPoslist+i2.nSize);
222376 fts5DoclistIterNext(&i2);
222377 if( i2.aPoslist==0 ) break;
222378 assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
222379 }
222380 else{
222381 /* Merge the two position lists. */
222382 i64 iPos1 = 0;
222383 i64 iPos2 = 0;
222384 int iOff1 = 0;
222385 int iOff2 = 0;
222386 u8 *a1 = &i1.aPoslist[i1.nSize];
222387 u8 *a2 = &i2.aPoslist[i2.nSize];
222388 int nCopy;
222389 u8 *aCopy;
222390
222391 i64 iPrev = 0;
222392 Fts5PoslistWriter writer;
222393 memset(&writer, 0, sizeof(writer));
222394
222395 /* See the earlier comment in this function for an explanation of why
222396 ** corrupt input position lists might cause the output to consume
222397 ** at most 20 bytes of unexpected space. */
222398 fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
222399 fts5BufferZero(&tmp);
222400 sqlite3Fts5BufferSize(&p->rc, &tmp,
222401 i1.nPoslist + i2.nPoslist + 10 + 10 + FTS5_DATA_ZERO_PADDING
222402 );
222403 if( p->rc ) break;
222404
222405 sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
222406 sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
222407 assert_nc( iPos1>=0 && iPos2>=0 );
222408
222409 if( iPos1<iPos2 ){
222410 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
222411 sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
222412 }else{
222413 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
222414 sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
222415 }
222416 if( iPos1>=0 && iPos2>=0 ){
222417 while( 1 ){
222418 if( iPos1<iPos2 ){
222419 if( iPos1!=iPrev ){
222420 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
222421 }
222422 sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
222423 if( iPos1<0 ) break;
222424 }else{
222425 assert_nc( iPos2!=iPrev );
222426 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
222427 sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
222428 if( iPos2<0 ) break;
222429 }
222430 }
222431 }
222432
222433 if( iPos1>=0 ){
222434 if( iPos1!=iPrev ){
222435 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
222436 }
222437 aCopy = &a1[iOff1];
222438 nCopy = i1.nPoslist - iOff1;
222439 }else{
222440 assert_nc( iPos2>=0 && iPos2!=iPrev );
222441 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
222442 aCopy = &a2[iOff2];
222443 nCopy = i2.nPoslist - iOff2;
222444 }
222445 if( nCopy>0 ){
222446 fts5BufferSafeAppendBlob(&tmp, aCopy, nCopy);
222447 }
222448
222449 /* WRITEPOSLISTSIZE */
222450 assert_nc( tmp.n<=i1.nPoslist+i2.nPoslist );
222451 assert( tmp.n<=i1.nPoslist+i2.nPoslist+10+10 );
222452 if( tmp.n>i1.nPoslist+i2.nPoslist ){
222453 if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
222454 break;
222455 }
222456 fts5BufferSafeAppendVarint(&out, tmp.n * 2);
222457 fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
222458 fts5DoclistIterNext(&i1);
222459 fts5DoclistIterNext(&i2);
222460 assert_nc( out.n<=(p1->n+p2->n+9) );
222461 if( i1.aPoslist==0 || i2.aPoslist==0 ) break;
222462 assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
222463 }
222464 }
222465
222466 if( i1.aPoslist ){
222467 fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
222468 fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.aEof - i1.aPoslist);
222469 }
222470 else if( i2.aPoslist ){
222471 fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
222472 fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.aEof - i2.aPoslist);
222473 }
222474 assert_nc( out.n<=(p1->n+p2->n+9) );
222475
222476 fts5BufferFree(p1);
222477 fts5BufferFree(&tmp);
222478 memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
222479 *p1 = out;
222480 }
222481 }
222482
222483 static void fts5SetupPrefixIter(
222484 Fts5Index *p, /* Index to read from */
222485 int bDesc, /* True for "ORDER BY rowid DESC" */
222486 const u8 *pToken, /* Buffer containing prefix to match */
 
222487 int nToken, /* Size of buffer pToken in bytes */
222488 Fts5Colset *pColset, /* Restrict matches to these columns */
222489 Fts5Iter **ppIter /* OUT: New iterator */
222490 ){
222491 Fts5Structure *pStruct;
222492 Fts5Buffer *aBuf;
222493 const int nBuf = 32;
 
222494
222495 void (*xMerge)(Fts5Index*, Fts5Buffer*, Fts5Buffer*);
222496 void (*xAppend)(Fts5Index*, i64, Fts5Iter*, Fts5Buffer*);
222497 if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
222498 xMerge = fts5MergeRowidLists;
222499 xAppend = fts5AppendRowid;
222500 }else{
 
 
222501 xMerge = fts5MergePrefixLists;
222502 xAppend = fts5AppendPoslist;
222503 }
222504
222505 aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);
@@ -222515,10 +223749,31 @@
222515 Fts5Data *pData;
222516 Fts5Buffer doclist;
222517 int bNewTerm = 1;
222518
222519 memset(&doclist, 0, sizeof(doclist));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222520 fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
222521 fts5IterSetOutputCb(&p->rc, p1);
222522 for( /* no-op */ ;
222523 fts5MultiIterEof(p, p1)==0;
222524 fts5MultiIterNext2(p, p1, &bNewTerm)
@@ -222535,31 +223790,43 @@
222535
222536 if( p1->base.nData==0 ) continue;
222537
222538 if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
222539 for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
222540 assert( i<nBuf );
222541 if( aBuf[i].n==0 ){
222542 fts5BufferSwap(&doclist, &aBuf[i]);
222543 fts5BufferZero(&doclist);
222544 }else{
222545 xMerge(p, &doclist, &aBuf[i]);
222546 fts5BufferZero(&aBuf[i]);
 
 
 
 
 
 
 
 
222547 }
222548 }
222549 iLastRowid = 0;
222550 }
222551
222552 xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
222553 iLastRowid = p1->base.iRowid;
222554 }
222555
222556 for(i=0; i<nBuf; i++){
 
 
222557 if( p->rc==SQLITE_OK ){
222558 xMerge(p, &doclist, &aBuf[i]);
222559 }
222560 fts5BufferFree(&aBuf[i]);
 
 
222561 }
222562 fts5MultiIterFree(p1);
222563
222564 pData = fts5IdxMalloc(p, sizeof(Fts5Data)+doclist.n+FTS5_DATA_ZERO_PADDING);
222565 if( pData ){
@@ -222810,10 +224077,11 @@
222810 /* If the QUERY_SCAN flag is set, all other flags must be clear. */
222811 assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
222812
222813 if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
222814 int iIdx = 0; /* Index to search */
 
222815 if( nToken ) memcpy(&buf.p[1], pToken, nToken);
222816
222817 /* Figure out which index to search and set iIdx accordingly. If this
222818 ** is a prefix query for which there is no prefix index, set iIdx to
222819 ** greater than pConfig->nPrefix to indicate that the query will be
@@ -222831,11 +224099,13 @@
222831 }else
222832 #endif
222833 if( flags & FTS5INDEX_QUERY_PREFIX ){
222834 int nChar = fts5IndexCharlen(pToken, nToken);
222835 for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
222836 if( pConfig->aPrefix[iIdx-1]==nChar ) break;
 
 
222837 }
222838 }
222839
222840 if( iIdx<=pConfig->nPrefix ){
222841 /* Straight index lookup */
@@ -222848,12 +224118,11 @@
222848 fts5StructureRelease(pStruct);
222849 }
222850 }else{
222851 /* Scan multiple terms in the main index */
222852 int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
222853 buf.p[0] = FTS5_MAIN_PREFIX;
222854 fts5SetupPrefixIter(p, bDesc, buf.p, nToken+1, pColset, &pRet);
222855 assert( p->rc!=SQLITE_OK || pRet->pColset==0 );
222856 fts5IterSetOutputCb(&p->rc, pRet);
222857 if( p->rc==SQLITE_OK ){
222858 Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];
222859 if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
@@ -226817,11 +228086,11 @@
226817 int nArg, /* Number of args */
226818 sqlite3_value **apUnused /* Function arguments */
226819 ){
226820 assert( nArg==0 );
226821 UNUSED_PARAM2(nArg, apUnused);
226822 sqlite3_result_text(pCtx, "fts5: 2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b", -1, SQLITE_TRANSIENT);
226823 }
226824
226825 /*
226826 ** Return true if zName is the extension on one of the shadow tables used
226827 ** by this module.
@@ -231743,12 +233012,12 @@
231743 }
231744 #endif /* SQLITE_CORE */
231745 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
231746
231747 /************** End of stmt.c ************************************************/
231748 #if __LINE__!=231748
231749 #undef SQLITE_SOURCE_ID
231750 #define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089falt2"
231751 #endif
231752 /* Return the source-id for this library */
231753 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
231754 /************************** End of sqlite3.c ******************************/
231755
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.35.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -281,10 +281,13 @@
281 #if SQLITE_ENABLE_LOAD_EXTENSION
282 "ENABLE_LOAD_EXTENSION",
283 #endif
284 #ifdef SQLITE_ENABLE_LOCKING_STYLE
285 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
286 #endif
287 #if SQLITE_ENABLE_MATH_FUNCTIONS
288 "ENABLE_MATH_FUNCTIONS",
289 #endif
290 #if SQLITE_ENABLE_MEMORY_MANAGEMENT
291 "ENABLE_MEMORY_MANAGEMENT",
292 #endif
293 #if SQLITE_ENABLE_MEMSYS3
@@ -988,10 +991,22 @@
991 # define MSVC_VERSION _MSC_VER
992 #else
993 # define MSVC_VERSION 0
994 #endif
995
996 /*
997 ** Some C99 functions in "math.h" are only present for MSVC when its version
998 ** is associated with Visual Studio 2013 or higher.
999 */
1000 #ifndef SQLITE_HAVE_C99_MATH_FUNCS
1001 # if MSVC_VERSION==0 || MSVC_VERSION>=1800
1002 # define SQLITE_HAVE_C99_MATH_FUNCS (1)
1003 # else
1004 # define SQLITE_HAVE_C99_MATH_FUNCS (0)
1005 # endif
1006 #endif
1007
1008 /* Needed for various definitions... */
1009 #if defined(__GNUC__) && !defined(_GNU_SOURCE)
1010 # define _GNU_SOURCE
1011 #endif
1012
@@ -1169,13 +1184,13 @@
1184 **
1185 ** See also: [sqlite3_libversion()],
1186 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1187 ** [sqlite_version()] and [sqlite_source_id()].
1188 */
1189 #define SQLITE_VERSION "3.35.0"
1190 #define SQLITE_VERSION_NUMBER 3035000
1191 #define SQLITE_SOURCE_ID "2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18df9a04"
1192
1193 /*
1194 ** CAPI3REF: Run-Time Library Version Numbers
1195 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1196 **
@@ -4545,10 +4560,11 @@
4560 ** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
4561 ** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
4562 ** that uses dot-files in place of posix advisory locking.
4563 ** <tr><td> file:data.db?mode=readonly <td>
4564 ** An error. "readonly" is not a valid option for the "mode" parameter.
4565 ** Use "ro" instead: "file:data.db?mode=ro".
4566 ** </table>
4567 **
4568 ** ^URI hexadecimal escape sequences (%HH) are supported within the path and
4569 ** query components of a URI. A hexadecimal escape sequence consists of a
4570 ** percent sign - "%" - followed by exactly two hexadecimal digits
@@ -4743,11 +4759,11 @@
4759 ** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
4760 **
4761 ** If the Y parameter to sqlite3_free_filename(Y) is anything other
4762 ** than a NULL pointer or a pointer previously acquired from
4763 ** sqlite3_create_filename(), then bad things such as heap
4764 ** corruption or segfaults may occur. The value Y should not be
4765 ** used again after sqlite3_free_filename(Y) has been called. This means
4766 ** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
4767 ** then the corresponding [sqlite3_module.xClose() method should also be
4768 ** invoked prior to calling sqlite3_free_filename(Y).
4769 */
@@ -8811,11 +8827,12 @@
8827 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
8828 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
8829 #define SQLITE_TESTCTRL_PRNG_SEED 28
8830 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
8831 #define SQLITE_TESTCTRL_SEEK_COUNT 30
8832 #define SQLITE_TESTCTRL_TRACEFLAGS 31
8833 #define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
8834
8835 /*
8836 ** CAPI3REF: SQL Keyword Checking
8837 **
8838 ** These routines provide access to the set of SQL language keywords
@@ -11484,10 +11501,18 @@
11501 ** guaranteed that a call to sqlite3session_changeset() will return a
11502 ** changeset containing zero changes.
11503 */
11504 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
11505
11506 /*
11507 ** CAPI3REF: Query for the amount of heap memory used by a session object.
11508 **
11509 ** This API returns the total amount of heap memory in bytes currently
11510 ** used by the session object passed as the only argument.
11511 */
11512 SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
11513
11514 /*
11515 ** CAPI3REF: Create An Iterator To Traverse A Changeset
11516 ** CONSTRUCTOR: sqlite3_changeset_iter
11517 **
11518 ** Create an iterator used to iterate through the contents of a changeset.
@@ -13526,11 +13551,12 @@
13551 ** places. The following macros try to make this explicit.
13552 */
13553 #ifndef __has_extension
13554 # define __has_extension(x) 0 /* compatibility with non-clang compilers */
13555 #endif
13556 #if GCC_VERSION>=4007000 || \
13557 (__has_extension(c_atomic) && __has_extension(c_atomic_store_n))
13558 # define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED)
13559 # define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)
13560 #else
13561 # define AtomicLoad(PTR) (*(PTR))
13562 # define AtomicStore(PTR,VAL) (*(PTR) = (VAL))
@@ -14592,25 +14618,37 @@
14618
14619 /*
14620 ** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
14621 ** the Select query generator tracing logic is turned on.
14622 */
14623 #if !defined(SQLITE_AMALGAMATION)
14624 SQLITE_PRIVATE u32 sqlite3SelectTrace;
 
 
14625 #endif
14626 #if defined(SQLITE_DEBUG) \
14627 && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE))
14628 # define SELECTTRACE_ENABLED 1
14629 # define SELECTTRACE(K,P,S,X) \
14630 if(sqlite3SelectTrace&(K)) \
14631 sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
14632 sqlite3DebugPrintf X
14633 #else
14634 # define SELECTTRACE(K,P,S,X)
14635 # define SELECTTRACE_ENABLED 0
14636 #endif
14637
14638 /*
14639 ** Macros for "wheretrace"
14640 */
14641 SQLITE_PRIVATE u32 sqlite3WhereTrace;
14642 #if defined(SQLITE_DEBUG) \
14643 && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
14644 # define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
14645 # define WHERETRACE_ENABLED 1
14646 #else
14647 # define WHERETRACE(K,X)
14648 #endif
14649
14650
14651 /*
14652 ** An instance of the following structure is used to store the busy-handler
14653 ** callback for a given sqlite handle.
14654 **
@@ -14737,10 +14775,11 @@
14775 typedef struct Lookaside Lookaside;
14776 typedef struct LookasideSlot LookasideSlot;
14777 typedef struct Module Module;
14778 typedef struct NameContext NameContext;
14779 typedef struct Parse Parse;
14780 typedef struct ParseCleanup ParseCleanup;
14781 typedef struct PreUpdate PreUpdate;
14782 typedef struct PrintfArguments PrintfArguments;
14783 typedef struct RenameToken RenameToken;
14784 typedef struct RowSet RowSet;
14785 typedef struct Savepoint Savepoint;
@@ -15316,10 +15355,11 @@
15355
15356 /* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */
15357 #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */
15358 #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */
15359 #define BTREE_APPEND 0x08 /* Insert is likely an append */
15360 #define BTREE_PREFORMAT 0x80 /* Insert is likely an append */
15361
15362 /* An instance of the BtreePayload object describes the content of a single
15363 ** entry in either an index or table btree.
15364 **
15365 ** Index btrees (used for indexes and also WITHOUT ROWID tables) contain
@@ -15414,10 +15454,12 @@
15454 #endif
15455
15456 #ifndef SQLITE_OMIT_WAL
15457 SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
15458 #endif
15459
15460 SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);
15461
15462 /*
15463 ** If we are not using shared cache, then there is no need to
15464 ** use mutexes to access the BtShared structures. So make the
15465 ** Enter and Leave procedures no-ops.
@@ -15757,64 +15799,65 @@
15799 #define OP_SeekScan 118 /* synopsis: Scan-ahead up to P1 rows */
15800 #define OP_SeekHit 119 /* synopsis: set P2<=seekHit<=P3 */
15801 #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
15802 #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
15803 #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
15804 #define OP_RowCell 123
15805 #define OP_Delete 124
15806 #define OP_ResetCount 125
15807 #define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15808 #define OP_SorterData 127 /* synopsis: r[P2]=data */
15809 #define OP_RowData 128 /* synopsis: r[P2]=data */
15810 #define OP_Rowid 129 /* synopsis: r[P2]=rowid */
15811 #define OP_NullRow 130
15812 #define OP_SeekEnd 131
15813 #define OP_IdxInsert 132 /* synopsis: key=r[P2] */
15814 #define OP_SorterInsert 133 /* synopsis: key=r[P2] */
15815 #define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */
15816 #define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */
15817 #define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */
15818 #define OP_FinishSeek 137
15819 #define OP_Destroy 138
15820 #define OP_Clear 139
15821 #define OP_ResetSorter 140
15822 #define OP_CreateBtree 141 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15823 #define OP_SqlExec 142
15824 #define OP_ParseSchema 143
15825 #define OP_LoadAnalysis 144
15826 #define OP_DropTable 145
15827 #define OP_DropIndex 146
15828 #define OP_DropTrigger 147
15829 #define OP_IntegrityCk 148
15830 #define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */
15831 #define OP_Real 150 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15832 #define OP_Param 151
15833 #define OP_FkCounter 152 /* synopsis: fkctr[P1]+=P2 */
15834 #define OP_MemMax 153 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15835 #define OP_OffsetLimit 154 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15836 #define OP_AggInverse 155 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15837 #define OP_AggStep 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15838 #define OP_AggStep1 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15839 #define OP_AggValue 158 /* synopsis: r[P3]=value N=P2 */
15840 #define OP_AggFinal 159 /* synopsis: accum=r[P1] N=P2 */
15841 #define OP_Expire 160
15842 #define OP_CursorLock 161
15843 #define OP_CursorUnlock 162
15844 #define OP_TableLock 163 /* synopsis: iDb=P1 root=P2 write=P3 */
15845 #define OP_VBegin 164
15846 #define OP_VCreate 165
15847 #define OP_VDestroy 166
15848 #define OP_VOpen 167
15849 #define OP_VColumn 168 /* synopsis: r[P3]=vcolumn(P2) */
15850 #define OP_VRename 169
15851 #define OP_Pagecount 170
15852 #define OP_MaxPgcnt 171
15853 #define OP_Trace 172
15854 #define OP_CursorHint 173
15855 #define OP_ReleaseReg 174 /* synopsis: release r[P1@P2] mask P3 */
15856 #define OP_Noop 175
15857 #define OP_Explain 176
15858 #define OP_Abortable 177
15859
15860 /* Properties such as "out2" or "jump" that are specified in
15861 ** comments following the "case" for each opcode in the vdbe.c
15862 ** are encoded into bitvectors as follows:
15863 */
@@ -15839,17 +15882,17 @@
15882 /* 88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
15883 /* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
15884 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
15885 /* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
15886 /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15887 /* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\
15888 /* 136 */ 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\
15889 /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10,\
15890 /* 152 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\
15891 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15892 /* 168 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\
15893 /* 176 */ 0x00, 0x00,}
15894
15895 /* The sqlite3P2Values() routine is able to run faster if it knows
15896 ** the value of the largest JUMP opcode. The smaller the maximum
15897 ** JUMP opcode the better, so the mkopcodeh.tcl script that
15898 ** generated this include file strives to group all JUMP opcodes
@@ -16905,11 +16948,11 @@
16948 u32 nSchemaLock; /* Do not reset the schema when non-zero */
16949 unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
16950 int errCode; /* Most recent error code (SQLITE_*) */
16951 int errMask; /* & result codes with this before returning */
16952 int iSysErrno; /* Errno value from last system error */
16953 u32 dbOptFlags; /* Flags to enable/disable optimizations */
16954 u8 enc; /* Text encoding */
16955 u8 autoCommit; /* The auto-commit flag. */
16956 u8 temp_store; /* 1: file 2: memory 0: default */
16957 u8 mallocFailed; /* True if we have seen a malloc failure */
16958 u8 bBenignMalloc; /* Do not require OOMs if true */
@@ -17112,28 +17155,30 @@
17155 /*
17156 ** Bits of the sqlite3.dbOptFlags field that are used by the
17157 ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
17158 ** selectively disable various optimizations.
17159 */
17160 #define SQLITE_QueryFlattener 0x00000001 /* Query flattening */
17161 #define SQLITE_WindowFunc 0x00000002 /* Use xInverse for window functions */
17162 #define SQLITE_GroupByOrder 0x00000004 /* GROUPBY cover of ORDERBY */
17163 #define SQLITE_FactorOutConst 0x00000008 /* Constant factoring */
17164 #define SQLITE_DistinctOpt 0x00000010 /* DISTINCT using indexes */
17165 #define SQLITE_CoverIdxScan 0x00000020 /* Covering index scans */
17166 #define SQLITE_OrderByIdxJoin 0x00000040 /* ORDER BY of joins via index */
17167 #define SQLITE_Transitive 0x00000080 /* Transitive constraints */
17168 #define SQLITE_OmitNoopJoin 0x00000100 /* Omit unused tables in joins */
17169 #define SQLITE_CountOfView 0x00000200 /* The count-of-view optimization */
17170 #define SQLITE_CursorHints 0x00000400 /* Add OP_CursorHint opcodes */
17171 #define SQLITE_Stat4 0x00000800 /* Use STAT4 data */
17172 /* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */
17173 #define SQLITE_PushDown 0x00001000 /* The push-down optimization */
17174 #define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
17175 #define SQLITE_SkipScan 0x00004000 /* Skip-scans */
17176 #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
17177 #define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
17178 #define SQLITE_ExistsToIN 0x00020000 /* The EXISTS-to-IN optimization */
17179 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
17180
17181 /*
17182 ** Macros for testing whether or not optimizations are enabled or disabled.
17183 */
17184 #define OptimizationDisabled(db, mask) (((db)->dbOptFlags&(mask))!=0)
@@ -17285,10 +17330,13 @@
17330 ** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions
17331 ** and functions like sqlite_version() that can change, but not during
17332 ** a single query. The iArg is ignored. The user-data is always set
17333 ** to a NULL pointer. The bNC parameter is not used.
17334 **
17335 ** MFUNCTION(zName, nArg, xPtr, xFunc)
17336 ** For math-library functions. xPtr is an arbitrary pointer.
17337 **
17338 ** PURE_DATE(zName, nArg, iArg, bNC, xFunc)
17339 ** Used for "pure" date/time functions, this macro is like DFUNCTION
17340 ** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is
17341 ** ignored and the user-data for these functions is set to an
17342 ** arbitrary non-NULL pointer. The bNC parameter is not used.
@@ -17320,10 +17368,13 @@
17368 {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
17369 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
17370 #define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
17371 {nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
17372 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
17373 #define MFUNCTION(zName, nArg, xPtr, xFunc) \
17374 {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
17375 xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
17376 #define INLINE_FUNC(zName, nArg, iArg, mFlags) \
17377 {nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
17378 SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
17379 #define TEST_FUNC(zName, nArg, iArg, mFlags) \
17380 {nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
@@ -17590,11 +17641,10 @@
17641 char **azModuleArg; /* 0: module 1: schema 2: vtab name 3...: args */
17642 VTable *pVTable; /* List of VTable objects. */
17643 #endif
17644 Trigger *pTrigger; /* List of triggers stored in pSchema */
17645 Schema *pSchema; /* Schema that contains this table */
 
17646 };
17647
17648 /*
17649 ** Allowed values for Table.tabFlags.
17650 **
@@ -17719,20 +17769,26 @@
17769 ** occurs. IGNORE means that the particular row that caused the constraint
17770 ** error is not inserted or updated. Processing continues and no error
17771 ** is returned. REPLACE means that preexisting database rows that caused
17772 ** a UNIQUE constraint violation are removed so that the new insert or
17773 ** update can proceed. Processing continues and no error is reported.
17774 ** UPDATE applies to insert operations only and means that the insert
17775 ** is omitted and the DO UPDATE clause of an upsert is run instead.
17776 **
17777 ** RESTRICT, SETNULL, SETDFLT, and CASCADE actions apply only to foreign keys.
17778 ** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
17779 ** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign
17780 ** key is set to NULL. SETDFLT means that the foreign key is set
17781 ** to its default value. CASCADE means that a DELETE or UPDATE of the
17782 ** referenced table row is propagated into the row that holds the
17783 ** foreign key.
17784 **
17785 ** The OE_Default value is a place holder that means to use whatever
17786 ** conflict resolution algorthm is required from context.
17787 **
17788 ** The following symbolic values are used to record which type
17789 ** of conflict resolution action to take.
17790 */
17791 #define OE_None 0 /* There is no constraint to check */
17792 #define OE_Rollback 1 /* Fail the operation and rollback the transaction */
17793 #define OE_Abort 2 /* Back out changes but do no rollback transaction */
17794 #define OE_Fail 3 /* Stop the operation but leave all prior changes */
@@ -18114,11 +18170,11 @@
18170 ** TK_SELECT: 1st register of result vector */
18171 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
18172 ** TK_VARIABLE: variable number (always >= 1).
18173 ** TK_SELECT_COLUMN: column of the result vector */
18174 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
18175 int iRightJoinTable; /* If EP_FromJoin, the right table of the join */
18176 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
18177 union {
18178 Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
18179 ** for a column of an index on an expression */
18180 Window *pWin; /* EP_WinFunc: Window/Filter defn for a function */
@@ -18482,19 +18538,25 @@
18538 ** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
18539 ** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
18540 ** WHERE clause is omitted.
18541 */
18542 struct Upsert {
18543 ExprList *pUpsertTarget; /* Optional description of conflict target */
18544 Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
18545 ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
18546 Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
18547 Upsert *pNextUpsert; /* Next ON CONFLICT clause in the list */
18548 u8 isDoUpdate; /* True for DO UPDATE. False for DO NOTHING */
18549 /* Above this point is the parse tree for the ON CONFLICT clauses.
18550 ** The next group of fields stores intermediate data. */
18551 void *pToFree; /* Free memory when deleting the Upsert object */
18552 /* All fields above are owned by the Upsert object and must be freed
18553 ** when the Upsert is destroyed. The fields below are used to transfer
18554 ** information from the INSERT processing down into the UPDATE processing
18555 ** while generating code. The fields below are owned by the INSERT
18556 ** statement and will be freed by INSERT processing. */
18557 Index *pUpsertIdx; /* UNIQUE constraint specified by pUpsertTarget */
18558 SrcList *pUpsertSrc; /* Table to be updated */
18559 int regData; /* First register holding array of VALUES */
18560 int iDataCur; /* Index of the data cursor */
18561 int iIdxCur; /* Index of the first index cursor */
18562 };
@@ -18740,10 +18802,21 @@
18802 # define DbMaskSet(M,I) (M)|=(((yDbMask)1)<<(I))
18803 # define DbMaskAllZero(M) (M)==0
18804 # define DbMaskNonZero(M) (M)!=0
18805 #endif
18806
18807 /*
18808 ** An instance of the ParseCleanup object specifies an operation that
18809 ** should be performed after parsing to deallocation resources obtained
18810 ** during the parse and which are no longer needed.
18811 */
18812 struct ParseCleanup {
18813 ParseCleanup *pNext; /* Next cleanup task */
18814 void *pPtr; /* Pointer to object to deallocate */
18815 void (*xCleanup)(sqlite3*,void*); /* Deallocation routine */
18816 };
18817
18818 /*
18819 ** An SQL parser context. A copy of this structure is passed through
18820 ** the parser and down into all the parser action routine in order to
18821 ** carry around information that is global to the entire parse.
18822 **
@@ -18771,10 +18844,13 @@
18844 u8 mayAbort; /* True if statement may throw an ABORT exception */
18845 u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
18846 u8 okConstFactor; /* OK to factor out constants */
18847 u8 disableLookaside; /* Number of times lookaside has been disabled */
18848 u8 disableVtab; /* Disable all virtual tables for this parse */
18849 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
18850 u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
18851 #endif
18852 int nRangeReg; /* Size of the temporary register block */
18853 int iRangeReg; /* First register in temporary register block */
18854 int nErr; /* Number of errors seen */
18855 int nTab; /* Number of previously allocated VDBE cursors */
18856 int nMem; /* Number of memory cells used so far */
@@ -18849,14 +18925,13 @@
18925 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
18926 #ifndef SQLITE_OMIT_VIRTUALTABLE
18927 Token sArg; /* Complete text of a module argument */
18928 Table **apVtabLock; /* Pointer to virtual tables needing locking */
18929 #endif
 
18930 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
18931 With *pWith; /* Current WITH clause, or NULL */
18932 ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
18933 #ifndef SQLITE_OMIT_ALTERTABLE
18934 RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
18935 #endif
18936 };
18937
@@ -18932,10 +19007,11 @@
19007 #define OPFLAG_P2ISREG 0x10 /* P2 to OP_Open** is a register number */
19008 #define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */
19009 #define OPFLAG_SAVEPOSITION 0x02 /* OP_Delete/Insert: save cursor pos */
19010 #define OPFLAG_AUXDELETE 0x04 /* OP_Delete: index in a DELETE op */
19011 #define OPFLAG_NOCHNG_MAGIC 0x6d /* OP_MakeRecord: serialtype 10 is ok */
19012 #define OPFLAG_PREFORMAT 0x80 /* OP_Insert uses preformatted cell */
19013
19014 /*
19015 * Each trigger present in the database schema is stored as an instance of
19016 * struct Trigger.
19017 *
@@ -19310,11 +19386,10 @@
19386 SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin);
19387 SQLITE_PRIVATE int sqlite3WindowCompare(Parse*, Window*, Window*, int);
19388 SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Select*);
19389 SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int);
19390 SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*);
 
19391 SQLITE_PRIVATE void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*);
19392 SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p);
19393 SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p);
19394 SQLITE_PRIVATE void sqlite3WindowFunctions(void);
19395 SQLITE_PRIVATE void sqlite3WindowChain(Parse*, Window*, Window*);
@@ -19720,10 +19795,11 @@
19795 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
19796 SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
19797 SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
19798 SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
19799 SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo*);
19800 SQLITE_PRIVATE void sqlite3WhereMinMaxOptEarlyOut(Vdbe*,WhereInfo*);
19801 SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*);
19802 SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*);
19803 SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*);
19804 SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*);
19805 #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */
@@ -19966,10 +20042,11 @@
20042 SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr);
20043 SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
20044 SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
20045 SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
20046 SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
20047 SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*);
20048 SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
20049 SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
20050 SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
20051 SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
20052
@@ -20029,11 +20106,10 @@
20106 SQLITE_PRIVATE const char sqlite3StrBINARY[];
20107 SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
20108 SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
20109 SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;
20110 SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;
 
20111 #ifndef SQLITE_OMIT_WSD
20112 SQLITE_PRIVATE int sqlite3PendingByte;
20113 #endif
20114 #endif /* SQLITE_AMALGAMATION */
20115 #ifdef VDBE_PROFILE
@@ -20048,10 +20124,11 @@
20124 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
20125 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
20126 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
20127 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
20128 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
20129 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*);
20130 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
20131 SQLITE_PRIVATE int sqlite3MatchEName(
20132 const struct ExprList_item*,
20133 const char*,
20134 const char*,
@@ -20218,10 +20295,11 @@
20295 SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20296 SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
20297 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
20298 SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
20299 SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
20300 SQLITE_PRIVATE void sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
20301 #ifdef SQLITE_ENABLE_NORMALIZE
20302 SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
20303 #endif
20304 SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
20305 SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
@@ -20240,19 +20318,23 @@
20318 #else
20319 #define sqlite3WithPush(x,y,z)
20320 #define sqlite3WithDelete(x,y)
20321 #endif
20322 #ifndef SQLITE_OMIT_UPSERT
20323 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
20324 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
20325 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
20326 SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
20327 SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
20328 SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert*,Index*);
20329 SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert*);
20330 #else
20331 #define sqlite3UpsertNew(u,v,w,x,y,z) ((Upsert*)0)
20332 #define sqlite3UpsertDelete(x,y)
20333 #define sqlite3UpsertDup(x,y) ((Upsert*)0)
20334 #define sqlite3UpsertOfIndex(x,y) ((Upsert*)0)
20335 #define sqlite3UpsertNextIsIPK(x) 0
20336 #endif
20337
20338
20339 /* Declarations for functions in fkey.c. All of these are replaced by
20340 ** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
@@ -20744,13 +20826,14 @@
20826 #ifndef SQLITE_OMIT_WSD
20827 SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
20828 #endif
20829
20830 /*
20831 ** Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS.
20832 */
20833 SQLITE_PRIVATE u32 sqlite3SelectTrace = 0;
20834 SQLITE_PRIVATE u32 sqlite3WhereTrace = 0;
20835
20836 /* #include "opcodes.h" */
20837 /*
20838 ** Properties of opcodes. The OPFLG_INITIALIZER macro is
20839 ** created by mkopcodeh.awk during compilation. Data is obtained
@@ -23170,10 +23253,12 @@
23253 SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
23254 if( id->pMethods==0 ) return SQLITE_NOTFOUND;
23255 #ifdef SQLITE_TEST
23256 if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
23257 && op!=SQLITE_FCNTL_LOCK_TIMEOUT
23258 && op!=SQLITE_FCNTL_CKPT_DONE
23259 && op!=SQLITE_FCNTL_CKPT_START
23260 ){
23261 /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
23262 ** is using a regular VFS, it is called after the corresponding
23263 ** transaction has been committed. Injecting a fault at this point
23264 ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
@@ -23180,11 +23265,16 @@
23265 ** but the transaction is committed anyway.
23266 **
23267 ** The core must call OsFileControl() though, not OsFileControlHint(),
23268 ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
23269 ** means the commit really has failed and an error should be returned
23270 ** to the user.
23271 **
23272 ** The CKPT_DONE and CKPT_START file-controls are write-only signals
23273 ** to the cksumvfs. Their return code is meaningless and is ignored
23274 ** by the SQLite core, so there is no point in simulating OOMs for them.
23275 */
23276 DO_OS_MALLOC_TEST(id);
23277 }
23278 #endif
23279 return id->pMethods->xFileControl(id, op, pArg);
23280 }
@@ -31381,10 +31471,20 @@
31471 SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
31472 assert( db!=0 );
31473 db->errCode = err_code;
31474 if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
31475 }
31476
31477 /*
31478 ** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
31479 ** and error message.
31480 */
31481 SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
31482 assert( db!=0 );
31483 db->errCode = SQLITE_OK;
31484 if( db->pErr ) sqlite3ValueSetNull(db->pErr);
31485 }
31486
31487 /*
31488 ** Load the sqlite3.iSysErrno field if that is an appropriate thing
31489 ** to do based on the SQLite error code in rc.
31490 */
@@ -33371,64 +33471,65 @@
33471 /* 118 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
33472 /* 119 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
33473 /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
33474 /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
33475 /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
33476 /* 123 */ "RowCell" OpHelp(""),
33477 /* 124 */ "Delete" OpHelp(""),
33478 /* 125 */ "ResetCount" OpHelp(""),
33479 /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
33480 /* 127 */ "SorterData" OpHelp("r[P2]=data"),
33481 /* 128 */ "RowData" OpHelp("r[P2]=data"),
33482 /* 129 */ "Rowid" OpHelp("r[P2]=rowid"),
33483 /* 130 */ "NullRow" OpHelp(""),
33484 /* 131 */ "SeekEnd" OpHelp(""),
33485 /* 132 */ "IdxInsert" OpHelp("key=r[P2]"),
33486 /* 133 */ "SorterInsert" OpHelp("key=r[P2]"),
33487 /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
33488 /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
33489 /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"),
33490 /* 137 */ "FinishSeek" OpHelp(""),
33491 /* 138 */ "Destroy" OpHelp(""),
33492 /* 139 */ "Clear" OpHelp(""),
33493 /* 140 */ "ResetSorter" OpHelp(""),
33494 /* 141 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
33495 /* 142 */ "SqlExec" OpHelp(""),
33496 /* 143 */ "ParseSchema" OpHelp(""),
33497 /* 144 */ "LoadAnalysis" OpHelp(""),
33498 /* 145 */ "DropTable" OpHelp(""),
33499 /* 146 */ "DropIndex" OpHelp(""),
33500 /* 147 */ "DropTrigger" OpHelp(""),
33501 /* 148 */ "IntegrityCk" OpHelp(""),
33502 /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
33503 /* 150 */ "Real" OpHelp("r[P2]=P4"),
33504 /* 151 */ "Param" OpHelp(""),
33505 /* 152 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
33506 /* 153 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
33507 /* 154 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
33508 /* 155 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
33509 /* 156 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
33510 /* 157 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
33511 /* 158 */ "AggValue" OpHelp("r[P3]=value N=P2"),
33512 /* 159 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
33513 /* 160 */ "Expire" OpHelp(""),
33514 /* 161 */ "CursorLock" OpHelp(""),
33515 /* 162 */ "CursorUnlock" OpHelp(""),
33516 /* 163 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
33517 /* 164 */ "VBegin" OpHelp(""),
33518 /* 165 */ "VCreate" OpHelp(""),
33519 /* 166 */ "VDestroy" OpHelp(""),
33520 /* 167 */ "VOpen" OpHelp(""),
33521 /* 168 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
33522 /* 169 */ "VRename" OpHelp(""),
33523 /* 170 */ "Pagecount" OpHelp(""),
33524 /* 171 */ "MaxPgcnt" OpHelp(""),
33525 /* 172 */ "Trace" OpHelp(""),
33526 /* 173 */ "CursorHint" OpHelp(""),
33527 /* 174 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
33528 /* 175 */ "Noop" OpHelp(""),
33529 /* 176 */ "Explain" OpHelp(""),
33530 /* 177 */ "Abortable" OpHelp(""),
33531 };
33532 return azName[i];
33533 }
33534 #endif
33535
@@ -64147,10 +64248,11 @@
64248 BtShared *pNext; /* Next on a list of sharable BtShared structs */
64249 BtLock *pLock; /* List of locks held on this shared-btree struct */
64250 Btree *pWriter; /* Btree with currently open write transaction */
64251 #endif
64252 u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */
64253 int nPreformatSize; /* Size of last cell written by TransferRow() */
64254 };
64255
64256 /*
64257 ** Allowed values for BtShared.btsFlags
64258 */
@@ -65859,10 +65961,28 @@
65961 }else{
65962 pInfo->nLocal = (u16)minLocal;
65963 }
65964 pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
65965 }
65966
65967 /*
65968 ** Given a record with nPayload bytes of payload stored within btree
65969 ** page pPage, return the number of bytes of payload stored locally.
65970 */
65971 static int btreePayloadToLocal(MemPage *pPage, i64 nPayload){
65972 int maxLocal; /* Maximum amount of payload held locally */
65973 maxLocal = pPage->maxLocal;
65974 if( nPayload<=maxLocal ){
65975 return nPayload;
65976 }else{
65977 int minLocal; /* Minimum amount of payload held locally */
65978 int surplus; /* Overflow payload available for local storage */
65979 minLocal = pPage->minLocal;
65980 surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize-4);
65981 return ( surplus <= maxLocal ) ? surplus : minLocal;
65982 }
65983 }
65984
65985 /*
65986 ** The following routines are implementations of the MemPage.xParseCell()
65987 ** method.
65988 **
@@ -73377,11 +73497,12 @@
73497 Btree *p = pCur->pBtree;
73498 BtShared *pBt = p->pBt;
73499 unsigned char *oldCell;
73500 unsigned char *newCell = 0;
73501
73502 assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND|BTREE_PREFORMAT))==flags );
73503 assert( (flags & BTREE_PREFORMAT)==0 || seekResult || pCur->pKeyInfo==0 );
73504
73505 if( pCur->eState==CURSOR_FAULT ){
73506 assert( pCur->skipNext!=SQLITE_OK );
73507 return pCur->skipNext;
73508 }
@@ -73395,11 +73516,11 @@
73516 /* Assert that the caller has been consistent. If this cursor was opened
73517 ** expecting an index b-tree, then the caller should be inserting blob
73518 ** keys with no associated data. If the cursor was opened expecting an
73519 ** intkey table, the caller should be inserting integer keys with a
73520 ** blob of associated data. */
73521 assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );
73522
73523 /* Save the positions of any other cursors open on this table.
73524 **
73525 ** In some cases, the call to btreeMoveto() below is a no-op. For
73526 ** example, when inserting data into a table with auto-generated integer
@@ -73505,11 +73626,11 @@
73626 assert( pCur->eState==CURSOR_VALID
73627 || (pCur->eState==CURSOR_INVALID && loc)
73628 || CORRUPT_DB );
73629
73630 pPage = pCur->pPage;
73631 assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
73632 assert( pPage->leaf || !pPage->intKey );
73633 if( pPage->nFree<0 ){
73634 if( pCur->eState>CURSOR_INVALID ){
73635 rc = SQLITE_CORRUPT_BKPT;
73636 }else{
@@ -73522,11 +73643,25 @@
73643 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
73644 loc==0 ? "overwrite" : "new entry"));
73645 assert( pPage->isInit );
73646 newCell = pBt->pTmpSpace;
73647 assert( newCell!=0 );
73648 if( flags & BTREE_PREFORMAT ){
73649 rc = SQLITE_OK;
73650 szNew = pBt->nPreformatSize;
73651 if( szNew<4 ) szNew = 4;
73652 if( ISAUTOVACUUM && szNew>pPage->maxLocal ){
73653 CellInfo info;
73654 pPage->xParseCell(pPage, newCell, &info);
73655 if( info.nPayload!=info.nLocal ){
73656 Pgno ovfl = get4byte(&newCell[szNew-4]);
73657 ptrmapPut(pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc);
73658 }
73659 }
73660 }else{
73661 rc = fillInCell(pPage, newCell, pX, &szNew);
73662 }
73663 if( rc ) goto end_insert;
73664 assert( szNew==pPage->xCellSize(pPage, newCell) );
73665 assert( szNew <= MX_CELL_SIZE(pBt) );
73666 idx = pCur->ix;
73667 if( loc==0 ){
@@ -73626,10 +73761,118 @@
73761 }
73762 }
73763 assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );
73764
73765 end_insert:
73766 return rc;
73767 }
73768
73769 /*
73770 ** This function is used as part of copying the current row from cursor
73771 ** pSrc into cursor pDest. If the cursors are open on intkey tables, then
73772 ** parameter iKey is used as the rowid value when the record is copied
73773 ** into pDest. Otherwise, the record is copied verbatim.
73774 **
73775 ** This function does not actually write the new value to cursor pDest.
73776 ** Instead, it creates and populates any required overflow pages and
73777 ** writes the data for the new cell into the BtShared.pTmpSpace buffer
73778 ** for the destination database. The size of the cell, in bytes, is left
73779 ** in BtShared.nPreformatSize. The caller completes the insertion by
73780 ** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified.
73781 **
73782 ** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
73783 */
73784 SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
73785 int rc = SQLITE_OK;
73786 BtShared *pBt = pDest->pBt;
73787 u8 *aOut = pBt->pTmpSpace; /* Pointer to next output buffer */
73788 const u8 *aIn; /* Pointer to next input buffer */
73789 u32 nIn; /* Size of input buffer aIn[] */
73790 u32 nRem; /* Bytes of data still to copy */
73791
73792 getCellInfo(pSrc);
73793 aOut += putVarint32(aOut, pSrc->info.nPayload);
73794 if( pDest->pKeyInfo==0 ) aOut += putVarint(aOut, iKey);
73795 nIn = pSrc->info.nLocal;
73796 aIn = pSrc->info.pPayload;
73797 if( aIn+nIn>pSrc->pPage->aDataEnd ){
73798 return SQLITE_CORRUPT_BKPT;
73799 }
73800 nRem = pSrc->info.nPayload;
73801 if( nIn==nRem && nIn<pDest->pPage->maxLocal ){
73802 memcpy(aOut, aIn, nIn);
73803 pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace);
73804 }else{
73805 Pager *pSrcPager = pSrc->pBt->pPager;
73806 u8 *pPgnoOut = 0;
73807 Pgno ovflIn = 0;
73808 DbPage *pPageIn = 0;
73809 MemPage *pPageOut = 0;
73810 u32 nOut; /* Size of output buffer aOut[] */
73811
73812 nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
73813 pBt->nPreformatSize = nOut + (aOut - pBt->pTmpSpace);
73814 if( nOut<pSrc->info.nPayload ){
73815 pPgnoOut = &aOut[nOut];
73816 pBt->nPreformatSize += 4;
73817 }
73818
73819 if( nRem>nIn ){
73820 if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
73821 return SQLITE_CORRUPT_BKPT;
73822 }
73823 ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
73824 }
73825
73826 do {
73827 nRem -= nOut;
73828 do{
73829 assert( nOut>0 );
73830 if( nIn>0 ){
73831 int nCopy = MIN(nOut, nIn);
73832 memcpy(aOut, aIn, nCopy);
73833 nOut -= nCopy;
73834 nIn -= nCopy;
73835 aOut += nCopy;
73836 aIn += nCopy;
73837 }
73838 if( nOut>0 ){
73839 sqlite3PagerUnref(pPageIn);
73840 pPageIn = 0;
73841 rc = sqlite3PagerGet(pSrcPager, ovflIn, &pPageIn, PAGER_GET_READONLY);
73842 if( rc==SQLITE_OK ){
73843 aIn = (const u8*)sqlite3PagerGetData(pPageIn);
73844 ovflIn = get4byte(aIn);
73845 aIn += 4;
73846 nIn = pSrc->pBt->usableSize - 4;
73847 }
73848 }
73849 }while( rc==SQLITE_OK && nOut>0 );
73850
73851 if( rc==SQLITE_OK && nRem>0 ){
73852 Pgno pgnoNew;
73853 MemPage *pNew = 0;
73854 rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
73855 put4byte(pPgnoOut, pgnoNew);
73856 if( ISAUTOVACUUM && pPageOut ){
73857 ptrmapPut(pBt, pgnoNew, PTRMAP_OVERFLOW2, pPageOut->pgno, &rc);
73858 }
73859 releasePage(pPageOut);
73860 pPageOut = pNew;
73861 if( pPageOut ){
73862 pPgnoOut = pPageOut->aData;
73863 put4byte(pPgnoOut, 0);
73864 aOut = &pPgnoOut[4];
73865 nOut = MIN(pBt->usableSize - 4, nRem);
73866 }
73867 }
73868 }while( nRem>0 && rc==SQLITE_OK );
73869
73870 releasePage(pPageOut);
73871 sqlite3PagerUnref(pPageIn);
73872 }
73873
73874 return rc;
73875 }
73876
73877 /*
73878 ** Delete the entry that the cursor is pointing to.
@@ -80340,10 +80583,12 @@
80583 assert( p!=0 );
80584 assert( p->nOp>0 );
80585 assert( pParse!=0 );
80586 assert( p->magic==VDBE_MAGIC_INIT );
80587 assert( pParse==p->pParse );
80588 p->pVList = pParse->pVList;
80589 pParse->pVList = 0;
80590 db = p->db;
80591 assert( db->mallocFailed==0 );
80592 nVar = pParse->nVar;
80593 nMem = pParse->nMem;
80594 nCursor = pParse->nTab;
@@ -80424,12 +80669,10 @@
80669 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
80670 #endif
80671 }
80672 }
80673
 
 
80674 if( db->mallocFailed ){
80675 p->nVar = 0;
80676 p->nCursor = 0;
80677 p->nMem = 0;
80678 }else{
@@ -85414,11 +85657,11 @@
85657 testcase( zRawSql[0]=='#' );
85658 idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken);
85659 assert( idx>0 );
85660 }
85661 zRawSql += nToken;
85662 nextIndex = MAX(idx + 1, nextIndex);
85663 assert( idx>0 && idx<=p->nVar );
85664 pVar = &p->aVar[idx-1];
85665 if( pVar->flags & MEM_Null ){
85666 sqlite3_str_append(&out, "NULL", 4);
85667 }else if( pVar->flags & (MEM_Int|MEM_IntReal) ){
@@ -90701,11 +90944,12 @@
90944 }else{
90945 x.nZero = 0;
90946 }
90947 x.pKey = 0;
90948 rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
90949 (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
90950 seekResult
90951 );
90952 pC->deferredMoveto = 0;
90953 pC->cacheStatus = CACHE_STALE;
90954
90955 /* Invoke the update-hook if required. */
@@ -90717,10 +90961,37 @@
90961 (pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,
90962 zDb, pTab->zName, x.nKey);
90963 }
90964 break;
90965 }
90966
90967 /* Opcode: RowCell P1 P2 P3 * *
90968 **
90969 ** P1 and P2 are both open cursors. Both must be opened on the same type
90970 ** of table - intkey or index. This opcode is used as part of copying
90971 ** the current row from P2 into P1. If the cursors are opened on intkey
90972 ** tables, register P3 contains the rowid to use with the new record in
90973 ** P1. If they are opened on index tables, P3 is not used.
90974 **
90975 ** This opcode must be followed by either an Insert or InsertIdx opcode
90976 ** with the OPFLAG_PREFORMAT flag set to complete the insert operation.
90977 */
90978 case OP_RowCell: {
90979 VdbeCursor *pDest; /* Cursor to write to */
90980 VdbeCursor *pSrc; /* Cursor to read from */
90981 i64 iKey; /* Rowid value to insert with */
90982 assert( pOp[1].opcode==OP_Insert || pOp[1].opcode==OP_IdxInsert );
90983 assert( pOp[1].opcode==OP_Insert || pOp->p3==0 );
90984 assert( pOp[1].opcode==OP_IdxInsert || pOp->p3>0 );
90985 assert( pOp[1].p5 & OPFLAG_PREFORMAT );
90986 pDest = p->apCsr[pOp->p1];
90987 pSrc = p->apCsr[pOp->p2];
90988 iKey = pOp->p3 ? aMem[pOp->p3].u.i : 0;
90989 rc = sqlite3BtreeTransferRow(pDest->uc.pCursor, pSrc->uc.pCursor, iKey);
90990 if( rc!=SQLITE_OK ) goto abort_due_to_error;
90991 break;
90992 };
90993
90994 /* Opcode: Delete P1 P2 P3 P4 P5
90995 **
90996 ** Delete the record at which the P1 cursor is currently pointing.
90997 **
@@ -91373,11 +91644,11 @@
91644 pC = p->apCsr[pOp->p1];
91645 sqlite3VdbeIncrWriteCounter(p, pC);
91646 assert( pC!=0 );
91647 assert( !isSorter(pC) );
91648 pIn2 = &aMem[pOp->p2];
91649 assert( (pIn2->flags & MEM_Blob) || (pOp->p5 & OPFLAG_PREFORMAT) );
91650 if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
91651 assert( pC->eCurType==CURTYPE_BTREE );
91652 assert( pC->isTable==0 );
91653 rc = ExpandBlob(pIn2);
91654 if( rc ) goto abort_due_to_error;
@@ -91384,11 +91655,11 @@
91655 x.nKey = pIn2->n;
91656 x.pKey = pIn2->z;
91657 x.aMem = aMem + pOp->p3;
91658 x.nMem = (u16)pOp->p4.i;
91659 rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
91660 (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
91661 ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
91662 );
91663 assert( pC->deferredMoveto==0 );
91664 pC->cacheStatus = CACHE_STALE;
91665 if( rc) goto abort_due_to_error;
@@ -97975,11 +98246,11 @@
98246 #if !defined(SQLITE_OMIT_WINDOWFUNC)
98247 /*
98248 ** Walk all expressions linked into the list of Window objects passed
98249 ** as the second argument.
98250 */
98251 static int walkWindowList(Walker *pWalker, Window *pList, int bOneOnly){
98252 Window *pWin;
98253 for(pWin=pList; pWin; pWin=pWin->pNextWin){
98254 int rc;
98255 rc = sqlite3WalkExprList(pWalker, pWin->pOrderBy);
98256 if( rc ) return WRC_Abort;
@@ -97994,10 +98265,11 @@
98265 ** not matter anyhow. */
98266 rc = sqlite3WalkExpr(pWalker, pWin->pStart);
98267 if( NEVER(rc) ) return WRC_Abort;
98268 rc = sqlite3WalkExpr(pWalker, pWin->pEnd);
98269 if( NEVER(rc) ) return WRC_Abort;
98270 if( bOneOnly ) break;
98271 }
98272 return WRC_Continue;
98273 }
98274 #endif
98275
@@ -98041,11 +98313,11 @@
98313 if( pExpr->x.pList ){
98314 if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
98315 }
98316 #ifndef SQLITE_OMIT_WINDOWFUNC
98317 if( ExprHasProperty(pExpr, EP_WinFunc) ){
98318 if( walkWindowList(pWalker, pExpr->y.pWin, 1) ) return WRC_Abort;
98319 }
98320 #endif
98321 }
98322 }
98323 break;
@@ -98088,11 +98360,11 @@
98360 {
98361 Parse *pParse = pWalker->pParse;
98362 if( pParse && IN_RENAME_OBJECT ){
98363 /* The following may return WRC_Abort if there are unresolvable
98364 ** symbols (e.g. a table that does not exist) in a window definition. */
98365 int rc = walkWindowList(pWalker, p->pWinDefn, 0);
98366 return rc;
98367 }
98368 }
98369 #endif
98370 return WRC_Continue;
@@ -100258,11 +100530,22 @@
100530 Parse *pParse, /* Parsing context */
100531 Expr *pExpr, /* Add the "COLLATE" clause to this expression */
100532 const Token *pCollName, /* Name of collating sequence */
100533 int dequote /* True to dequote pCollName */
100534 ){
100535 assert( pExpr!=0 || pParse->db->mallocFailed );
100536 if( pExpr==0 ) return 0;
100537 if( pExpr->op==TK_VECTOR ){
100538 ExprList *pList = pExpr->x.pList;
100539 if( ALWAYS(pList!=0) ){
100540 int i;
100541 for(i=0; i<pList->nExpr; i++){
100542 pList->a[i].pExpr = sqlite3ExprAddCollateToken(pParse,pList->a[i].pExpr,
100543 pCollName, dequote);
100544 }
100545 }
100546 }else if( pCollName->n>0 ){
100547 Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);
100548 if( pNew ){
100549 pNew->pLeft = pExpr;
100550 pNew->flags |= EP_Collate|EP_Skip;
100551 pExpr = pNew;
@@ -106634,15 +106917,18 @@
106917 u32 savedDbFlags = db->mDbFlags;
106918 while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
106919 *zEnd-- = '\0';
106920 }
106921 db->mDbFlags |= DBFLAG_PreferBuiltin;
106922 /* substr() operations on characters, but addColOffset is in bytes. So we
106923 ** have to use printf() to translate between these units: */
106924 sqlite3NestedParse(pParse,
106925 "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
106926 "sql = printf('%%.%ds, ',sql) || %Q"
106927 " || substr(sql,1+length(printf('%%.%ds',sql))) "
106928 "WHERE type = 'table' AND name = %Q",
106929 zDb, pNew->addColOffset, zCol, pNew->addColOffset,
106930 zTab
106931 );
106932 sqlite3DbFree(db, zCol);
106933 db->mDbFlags = savedDbFlags;
106934 }
@@ -110798,15 +111084,11 @@
111084
111085 /* Don't do any authorization checks if the database is initialising
111086 ** or if the parser is being invoked from within sqlite3_declare_vtab.
111087 */
111088 assert( !IN_RENAME_OBJECT || db->xAuth==0 );
111089 if( db->xAuth==0 || db->init.busy || IN_SPECIAL_PARSE ){
 
 
 
 
111090 return SQLITE_OK;
111091 }
111092
111093 /* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the
111094 ** callback are either NULL pointers or zero-terminated strings that
@@ -111008,10 +111290,14 @@
111290 }
111291
111292 /* Begin by generating some termination code at the end of the
111293 ** vdbe program
111294 */
111295 if( pParse->pVdbe==0 && db->init.busy ){
111296 pParse->rc = SQLITE_DONE;
111297 return;
111298 }
111299 v = sqlite3GetVdbe(pParse);
111300 assert( !pParse->isMultiWrite
111301 || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
111302 if( v ){
111303 sqlite3VdbeAddOp0(v, OP_Halt);
@@ -112120,10 +112406,12 @@
112406 int i;
112407 char *z;
112408 char *zType;
112409 Column *pCol;
112410 sqlite3 *db = pParse->db;
112411 u8 hName;
112412
112413 if( (p = pParse->pNewTable)==0 ) return;
112414 if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
112415 sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
112416 return;
112417 }
@@ -112131,12 +112419,13 @@
112419 if( z==0 ) return;
112420 if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName);
112421 memcpy(z, pName->z, pName->n);
112422 z[pName->n] = 0;
112423 sqlite3Dequote(z);
112424 hName = sqlite3StrIHash(z);
112425 for(i=0; i<p->nCol; i++){
112426 if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zName)==0 ){
112427 sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
112428 sqlite3DbFree(db, z);
112429 return;
112430 }
112431 }
@@ -112150,11 +112439,11 @@
112439 p->aCol = aNew;
112440 }
112441 pCol = &p->aCol[p->nCol];
112442 memset(pCol, 0, sizeof(p->aCol[0]));
112443 pCol->zName = z;
112444 pCol->hName = hName;
112445 sqlite3ColumnPropertiesFromName(p, pCol);
112446
112447 if( pType->n==0 ){
112448 /* If there is no type specified, columns have the default affinity
112449 ** 'BLOB' with a default size of 4 bytes. */
@@ -113426,11 +113715,11 @@
113715 assert( !pSelect && pCons && pEnd );
113716 if( pCons->z==0 ){
113717 pCons = pEnd;
113718 }
113719 nName = (int)((const char *)pCons->z - zName);
113720 p->addColOffset = 13 + nName;
113721 }
113722 #endif
113723 }
113724 }
113725
@@ -119441,10 +119730,206 @@
119730 }
119731
119732 *pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;
119733 return 1;
119734 }
119735
119736 /* Mathematical Constants */
119737 #ifndef M_PI
119738 # define M_PI 3.141592653589793238462643383279502884
119739 #endif
119740 #ifndef M_LN10
119741 # define M_LN10 2.302585092994045684017991454684364208
119742 #endif
119743 #ifndef M_LN2
119744 # define M_LN2 0.693147180559945309417232121458176568
119745 #endif
119746
119747
119748 /* Extra math functions that require linking with -lm
119749 */
119750 #ifdef SQLITE_ENABLE_MATH_FUNCTIONS
119751 /*
119752 ** Implementation SQL functions:
119753 **
119754 ** ceil(X)
119755 ** ceiling(X)
119756 ** floor(X)
119757 **
119758 ** The sqlite3_user_data() pointer is a pointer to the libm implementation
119759 ** of the underlying C function.
119760 */
119761 static void ceilingFunc(
119762 sqlite3_context *context,
119763 int argc,
119764 sqlite3_value **argv
119765 ){
119766 assert( argc==1 );
119767 switch( sqlite3_value_numeric_type(argv[0]) ){
119768 case SQLITE_INTEGER: {
119769 sqlite3_result_int64(context, sqlite3_value_int64(argv[0]));
119770 break;
119771 }
119772 case SQLITE_FLOAT: {
119773 double (*x)(double) = (double(*)(double))sqlite3_user_data(context);
119774 sqlite3_result_double(context, x(sqlite3_value_double(argv[0])));
119775 break;
119776 }
119777 default: {
119778 break;
119779 }
119780 }
119781 }
119782
119783 /*
119784 ** On some systems, ceil() and floor() are intrinsic function. You are
119785 ** unable to take a pointer to these functions. Hence, we here wrap them
119786 ** in our own actual functions.
119787 */
119788 static double xCeil(double x){ return ceil(x); }
119789 static double xFloor(double x){ return floor(x); }
119790
119791 /*
119792 ** Implementation of SQL functions:
119793 **
119794 ** ln(X) - natural logarithm
119795 ** log(X) - log X base 10
119796 ** log10(X) - log X base 10
119797 ** log(B,X) - log X base B
119798 */
119799 static void logFunc(
119800 sqlite3_context *context,
119801 int argc,
119802 sqlite3_value **argv
119803 ){
119804 double x, b, ans;
119805 assert( argc==1 || argc==2 );
119806 switch( sqlite3_value_numeric_type(argv[0]) ){
119807 case SQLITE_INTEGER:
119808 case SQLITE_FLOAT:
119809 x = sqlite3_value_double(argv[0]);
119810 if( x<0.0 ) return;
119811 break;
119812 default:
119813 return;
119814 }
119815 if( argc==2 ){
119816 switch( sqlite3_value_numeric_type(argv[0]) ){
119817 case SQLITE_INTEGER:
119818 case SQLITE_FLOAT:
119819 b = x;
119820 x = sqlite3_value_double(argv[1]);
119821 if( x<0.0 ) return;
119822 break;
119823 default:
119824 return;
119825 }
119826 ans = log(x)/log(b);
119827 }else{
119828 ans = log(x);
119829 switch( SQLITE_PTR_TO_INT(sqlite3_user_data(context)) ){
119830 case 1:
119831 /* Convert from natural logarithm to log base 10 */
119832 ans *= 1.0/M_LN10;
119833 break;
119834 case 2:
119835 /* Convert from natural logarithm to log base 2 */
119836 ans *= 1.0/M_LN2;
119837 break;
119838 default:
119839 break;
119840 }
119841 }
119842 sqlite3_result_double(context, ans);
119843 }
119844
119845 /*
119846 ** Functions to converts degrees to radians and radians to degrees.
119847 */
119848 static double degToRad(double x){ return x*(M_PI/180.0); }
119849 static double radToDeg(double x){ return x*(180.0/M_PI); }
119850
119851 /*
119852 ** Implementation of 1-argument SQL math functions:
119853 **
119854 ** exp(X) - Compute e to the X-th power
119855 */
119856 static void math1Func(
119857 sqlite3_context *context,
119858 int argc,
119859 sqlite3_value **argv
119860 ){
119861 int type0;
119862 double v0, ans;
119863 double (*x)(double);
119864 assert( argc==1 );
119865 type0 = sqlite3_value_numeric_type(argv[0]);
119866 if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
119867 v0 = sqlite3_value_double(argv[0]);
119868 x = (double(*)(double))sqlite3_user_data(context);
119869 ans = x(v0);
119870 sqlite3_result_double(context, ans);
119871 }
119872
119873 /*
119874 ** Implementation of 2-argument SQL math functions:
119875 **
119876 ** power(X,Y) - Compute X to the Y-th power
119877 */
119878 static void math2Func(
119879 sqlite3_context *context,
119880 int argc,
119881 sqlite3_value **argv
119882 ){
119883 int type0, type1;
119884 double v0, v1, ans;
119885 double (*x)(double,double);
119886 assert( argc==2 );
119887 type0 = sqlite3_value_numeric_type(argv[0]);
119888 if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
119889 type1 = sqlite3_value_numeric_type(argv[1]);
119890 if( type1!=SQLITE_INTEGER && type1!=SQLITE_FLOAT ) return;
119891 v0 = sqlite3_value_double(argv[0]);
119892 v1 = sqlite3_value_double(argv[1]);
119893 x = (double(*)(double,double))sqlite3_user_data(context);
119894 ans = x(v0, v1);
119895 sqlite3_result_double(context, ans);
119896 }
119897
119898 /*
119899 ** Implementation of 2-argument SQL math functions:
119900 **
119901 ** power(X,Y) - Compute X to the Y-th power
119902 */
119903 static void piFunc(
119904 sqlite3_context *context,
119905 int argc,
119906 sqlite3_value **argv
119907 ){
119908 assert( argc==0 );
119909 sqlite3_result_double(context, M_PI);
119910 }
119911
119912 #endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
119913
119914 /*
119915 ** Implementation of sign(X) function.
119916 */
119917 static void signFunc(
119918 sqlite3_context *context,
119919 int argc,
119920 sqlite3_value **argv
119921 ){
119922 int type0;
119923 double x;
119924 UNUSED_PARAMETER(argc);
119925 assert( argc==1 );
119926 type0 = sqlite3_value_numeric_type(argv[0]);
119927 if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
119928 x = sqlite3_value_double(argv[0]);
119929 sqlite3_result_int(context, x<0.0 ? -1 : x>0.0 ? +1 : 0);
119930 }
119931
119932 /*
119933 ** All of the FuncDef structures in the aBuiltinFunc[] array above
119934 ** to the global function hash table. This occurs at start-time (as
119935 ** a consequence of calling sqlite3_initialize()).
@@ -119560,10 +120045,47 @@
120045 #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
120046 FUNCTION(unknown, -1, 0, 0, unknownFunc ),
120047 #endif
120048 FUNCTION(coalesce, 1, 0, 0, 0 ),
120049 FUNCTION(coalesce, 0, 0, 0, 0 ),
120050 #ifdef SQLITE_ENABLE_MATH_FUNCTIONS
120051 MFUNCTION(ceil, 1, xCeil, ceilingFunc ),
120052 MFUNCTION(ceiling, 1, xCeil, ceilingFunc ),
120053 MFUNCTION(floor, 1, xFloor, ceilingFunc ),
120054 #if SQLITE_HAVE_C99_MATH_FUNCS
120055 MFUNCTION(trunc, 1, trunc, ceilingFunc ),
120056 #endif
120057 FUNCTION(ln, 1, 0, 0, logFunc ),
120058 FUNCTION(log, 1, 1, 0, logFunc ),
120059 FUNCTION(log10, 1, 1, 0, logFunc ),
120060 FUNCTION(log2, 1, 2, 0, logFunc ),
120061 FUNCTION(log, 2, 0, 0, logFunc ),
120062 MFUNCTION(exp, 1, exp, math1Func ),
120063 MFUNCTION(pow, 2, pow, math2Func ),
120064 MFUNCTION(power, 2, pow, math2Func ),
120065 MFUNCTION(mod, 2, fmod, math2Func ),
120066 MFUNCTION(acos, 1, acos, math1Func ),
120067 MFUNCTION(asin, 1, asin, math1Func ),
120068 MFUNCTION(atan, 1, atan, math1Func ),
120069 MFUNCTION(atan2, 2, atan2, math2Func ),
120070 MFUNCTION(cos, 1, cos, math1Func ),
120071 MFUNCTION(sin, 1, sin, math1Func ),
120072 MFUNCTION(tan, 1, tan, math1Func ),
120073 MFUNCTION(cosh, 1, cosh, math1Func ),
120074 MFUNCTION(sinh, 1, sinh, math1Func ),
120075 MFUNCTION(tanh, 1, tanh, math1Func ),
120076 #if SQLITE_HAVE_C99_MATH_FUNCS
120077 MFUNCTION(acosh, 1, acosh, math1Func ),
120078 MFUNCTION(asinh, 1, asinh, math1Func ),
120079 MFUNCTION(atanh, 1, atanh, math1Func ),
120080 #endif
120081 MFUNCTION(sqrt, 1, sqrt, math1Func ),
120082 MFUNCTION(radians, 1, degToRad, math1Func ),
120083 MFUNCTION(degrees, 1, radToDeg, math1Func ),
120084 FUNCTION(pi, 0, 0, 0, piFunc ),
120085 #endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
120086 FUNCTION(sign, 1, 0, 0, signFunc ),
120087 INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
120088 INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
120089 };
120090 #ifndef SQLITE_OMIT_ALTERTABLE
120091 sqlite3AlterFunctions();
@@ -121413,11 +121935,13 @@
121935
121936 pInfo = pToplevel->pAinc;
121937 while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
121938 if( pInfo==0 ){
121939 pInfo = sqlite3DbMallocRawNN(pParse->db, sizeof(*pInfo));
121940 sqlite3ParserAddCleanup(pToplevel, sqlite3DbFree, pInfo);
121941 testcase( pParse->earlyCleanup );
121942 if( pParse->db->mallocFailed ) return 0;
121943 pInfo->pNext = pToplevel->pAinc;
121944 pToplevel->pAinc = pInfo;
121945 pInfo->pTab = pTab;
121946 pInfo->iDb = iDb;
121947 pToplevel->nMem++; /* Register to hold name of table */
@@ -122018,10 +122542,11 @@
122542 }
122543 aRegIdx[i] = ++pParse->nMem; /* Register to store the table record */
122544 }
122545 #ifndef SQLITE_OMIT_UPSERT
122546 if( pUpsert ){
122547 Upsert *pNx;
122548 if( IsVirtual(pTab) ){
122549 sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
122550 pTab->zName);
122551 goto insert_cleanup;
122552 }
@@ -122031,17 +122556,21 @@
122556 }
122557 if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){
122558 goto insert_cleanup;
122559 }
122560 pTabList->a[0].iCursor = iDataCur;
122561 pNx = pUpsert;
122562 do{
122563 pNx->pUpsertSrc = pTabList;
122564 pNx->regData = regData;
122565 pNx->iDataCur = iDataCur;
122566 pNx->iIdxCur = iIdxCur;
122567 if( pNx->pUpsertTarget ){
122568 sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx);
122569 }
122570 pNx = pNx->pNextUpsert;
122571 }while( pNx!=0 );
122572 }
122573 #endif
122574
122575
122576 /* This is the top of the main insertion loop */
@@ -122441,10 +122970,74 @@
122970 testcase( w.eCode==CKCNSTRNT_COLUMN );
122971 testcase( w.eCode==CKCNSTRNT_ROWID );
122972 testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
122973 return w.eCode!=0;
122974 }
122975
122976 /*
122977 ** The sqlite3GenerateConstraintChecks() routine usually wants to visit
122978 ** the indexes of a table in the order provided in the Table->pIndex list.
122979 ** However, sometimes (rarely - when there is an upsert) it wants to visit
122980 ** the indexes in a different order. The following data structures accomplish
122981 ** this.
122982 **
122983 ** The IndexIterator object is used to walk through all of the indexes
122984 ** of a table in either Index.pNext order, or in some other order established
122985 ** by an array of IndexListTerm objects.
122986 */
122987 typedef struct IndexListTerm IndexListTerm;
122988 typedef struct IndexIterator IndexIterator;
122989 struct IndexIterator {
122990 int eType; /* 0 for Index.pNext list. 1 for an array of IndexListTerm */
122991 int i; /* Index of the current item from the list */
122992 union {
122993 struct { /* Use this object for eType==0: A Index.pNext list */
122994 Index *pIdx; /* The current Index */
122995 } lx;
122996 struct { /* Use this object for eType==1; Array of IndexListTerm */
122997 int nIdx; /* Size of the array */
122998 IndexListTerm *aIdx; /* Array of IndexListTerms */
122999 } ax;
123000 } u;
123001 };
123002
123003 /* When IndexIterator.eType==1, then each index is an array of instances
123004 ** of the following object
123005 */
123006 struct IndexListTerm {
123007 Index *p; /* The index */
123008 int ix; /* Which entry in the original Table.pIndex list is this index*/
123009 };
123010
123011 /* Return the first index on the list */
123012 static Index *indexIteratorFirst(IndexIterator *pIter, int *pIx){
123013 assert( pIter->i==0 );
123014 if( pIter->eType ){
123015 *pIx = pIter->u.ax.aIdx[0].ix;
123016 return pIter->u.ax.aIdx[0].p;
123017 }else{
123018 *pIx = 0;
123019 return pIter->u.lx.pIdx;
123020 }
123021 }
123022
123023 /* Return the next index from the list. Return NULL when out of indexes */
123024 static Index *indexIteratorNext(IndexIterator *pIter, int *pIx){
123025 if( pIter->eType ){
123026 int i = ++pIter->i;
123027 if( i>=pIter->u.ax.nIdx ){
123028 *pIx = i;
123029 return 0;
123030 }
123031 *pIx = pIter->u.ax.aIdx[i].ix;
123032 return pIter->u.ax.aIdx[i].p;
123033 }else{
123034 ++(*pIx);
123035 pIter->u.lx.pIdx = pIter->u.lx.pIdx->pNext;
123036 return pIter->u.lx.pIdx;
123037 }
123038 }
123039
123040 /*
123041 ** Generate code to do constraint checks prior to an INSERT or an UPDATE
123042 ** on table pTab.
123043 **
@@ -122550,32 +123143,33 @@
123143 int *aiChng, /* column i is unchanged if aiChng[i]<0 */
123144 Upsert *pUpsert /* ON CONFLICT clauses, if any. NULL otherwise */
123145 ){
123146 Vdbe *v; /* VDBE under constrution */
123147 Index *pIdx; /* Pointer to one of the indices */
123148 Index *pPk = 0; /* The PRIMARY KEY index for WITHOUT ROWID tables */
123149 sqlite3 *db; /* Database connection */
123150 int i; /* loop counter */
123151 int ix; /* Index loop counter */
123152 int nCol; /* Number of columns */
123153 int onError; /* Conflict resolution strategy */
123154 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
123155 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
123156 Upsert *pUpsertClause = 0; /* The specific ON CONFLICT clause for pIdx */
123157 u8 isUpdate; /* True if this is an UPDATE operation */
123158 u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
123159 int upsertIpkReturn = 0; /* Address of Goto at end of IPK uniqueness check */
123160 int upsertIpkDelay = 0; /* Address of Goto to bypass initial IPK check */
123161 int ipkTop = 0; /* Top of the IPK uniqueness check */
123162 int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */
123163 /* Variables associated with retesting uniqueness constraints after
123164 ** replace triggers fire have run */
123165 int regTrigCnt; /* Register used to count replace trigger invocations */
123166 int addrRecheck = 0; /* Jump here to recheck all uniqueness constraints */
123167 int lblRecheckOk = 0; /* Each recheck jumps to this label if it passes */
123168 Trigger *pTrigger; /* List of DELETE triggers on the table pTab */
123169 int nReplaceTrig = 0; /* Number of replace triggers coded */
123170 IndexIterator sIdxIter; /* Index iterator */
123171
123172 isUpdate = regOldData!=0;
123173 db = pParse->db;
123174 v = pParse->pVdbe;
123175 assert( v!=0 );
@@ -122769,23 +123363,67 @@
123363 **
123364 ** The ordering of (2) and (3) is accomplished by making sure the linked
123365 ** list of indexes attached to a table puts all OE_Replace indexes last
123366 ** in the list. See sqlite3CreateIndex() for where that happens.
123367 */
123368 sIdxIter.eType = 0;
123369 sIdxIter.i = 0;
123370 sIdxIter.u.ax.aIdx = 0; /* Silence harmless compiler warning */
123371 sIdxIter.u.lx.pIdx = pTab->pIndex;
123372 if( pUpsert ){
123373 if( pUpsert->pUpsertTarget==0 ){
123374 /* There is just on ON CONFLICT clause and it has no constraint-target */
123375 assert( pUpsert->pNextUpsert==0 );
123376 if( pUpsert->isDoUpdate==0 ){
123377 /* A single ON CONFLICT DO NOTHING clause, without a constraint-target.
123378 ** Make all unique constraint resolution be OE_Ignore */
123379 overrideError = OE_Ignore;
123380 pUpsert = 0;
123381 }else{
123382 /* A single ON CONFLICT DO UPDATE. Make all resolutions OE_Update */
123383 overrideError = OE_Update;
123384 }
123385 }else if( pTab->pIndex!=0 ){
123386 /* Otherwise, we'll need to run the IndexListTerm array version of the
123387 ** iterator to ensure that all of the ON CONFLICT conditions are
123388 ** checked first and in order. */
123389 int nIdx, jj;
123390 u64 nByte;
123391 Upsert *pTerm;
123392 u8 *bUsed;
123393 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
123394 assert( aRegIdx[nIdx]>0 );
123395 }
123396 sIdxIter.eType = 1;
123397 sIdxIter.u.ax.nIdx = nIdx;
123398 nByte = (sizeof(IndexListTerm)+1)*nIdx + nIdx;
123399 sIdxIter.u.ax.aIdx = sqlite3DbMallocZero(db, nByte);
123400 if( sIdxIter.u.ax.aIdx==0 ) return; /* OOM */
123401 bUsed = (u8*)&sIdxIter.u.ax.aIdx[nIdx];
123402 pUpsert->pToFree = sIdxIter.u.ax.aIdx;
123403 for(i=0, pTerm=pUpsert; pTerm; pTerm=pTerm->pNextUpsert){
123404 if( pTerm->pUpsertTarget==0 ) break;
123405 if( pTerm->pUpsertIdx==0 ) continue; /* Skip ON CONFLICT for the IPK */
123406 jj = 0;
123407 pIdx = pTab->pIndex;
123408 while( ALWAYS(pIdx!=0) && pIdx!=pTerm->pUpsertIdx ){
123409 pIdx = pIdx->pNext;
123410 jj++;
123411 }
123412 if( bUsed[jj] ) continue; /* Duplicate ON CONFLICT clause ignored */
123413 bUsed[jj] = 1;
123414 sIdxIter.u.ax.aIdx[i].p = pIdx;
123415 sIdxIter.u.ax.aIdx[i].ix = jj;
123416 i++;
123417 }
123418 for(jj=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, jj++){
123419 if( bUsed[jj] ) continue;
123420 sIdxIter.u.ax.aIdx[i].p = pIdx;
123421 sIdxIter.u.ax.aIdx[i].ix = jj;
123422 i++;
123423 }
123424 assert( i==nIdx );
123425 }
123426 }
123427
123428 /* Determine if it is possible that triggers (either explicitly coded
123429 ** triggers or FK resolution actions) might run as a result of deletes
@@ -122844,25 +123482,34 @@
123482 }else if( onError==OE_Default ){
123483 onError = OE_Abort;
123484 }
123485
123486 /* figure out whether or not upsert applies in this case */
123487 if( pUpsert ){
123488 pUpsertClause = sqlite3UpsertOfIndex(pUpsert,0);
123489 if( pUpsertClause!=0 ){
123490 if( pUpsertClause->isDoUpdate==0 ){
123491 onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
123492 }else{
123493 onError = OE_Update; /* DO UPDATE */
123494 }
123495 }
123496 if( pUpsertClause!=pUpsert ){
123497 /* The first ON CONFLICT clause has a conflict target other than
123498 ** the IPK. We have to jump ahead to that first ON CONFLICT clause
123499 ** and then come back here and deal with the IPK afterwards */
123500 upsertIpkDelay = sqlite3VdbeAddOp0(v, OP_Goto);
123501 }
123502 }
123503
123504 /* If the response to a rowid conflict is REPLACE but the response
123505 ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
123506 ** to defer the running of the rowid conflict checking until after
123507 ** the UNIQUE constraints have run.
123508 */
123509 if( onError==OE_Replace /* IPK rule is REPLACE */
123510 && onError!=overrideError /* Rules for other constraints are different */
123511 && pTab->pIndex /* There exist other constraints */
123512 ){
123513 ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
123514 VdbeComment((v, "defer IPK REPLACE until last"));
123515 }
@@ -122955,11 +123602,13 @@
123602 sqlite3VdbeGoto(v, ignoreDest);
123603 break;
123604 }
123605 }
123606 sqlite3VdbeResolveLabel(v, addrRowidOk);
123607 if( pUpsert && pUpsertClause!=pUpsert ){
123608 upsertIpkReturn = sqlite3VdbeAddOp0(v, OP_Goto);
123609 }else if( ipkTop ){
123610 ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
123611 sqlite3VdbeJumpHere(v, ipkTop-1);
123612 }
123613 }
123614
@@ -122968,27 +123617,29 @@
123617 ** Compute the revised record entries for indices as we go.
123618 **
123619 ** This loop also handles the case of the PRIMARY KEY index for a
123620 ** WITHOUT ROWID table.
123621 */
123622 for(pIdx = indexIteratorFirst(&sIdxIter, &ix);
123623 pIdx;
123624 pIdx = indexIteratorNext(&sIdxIter, &ix)
123625 ){
123626 int regIdx; /* Range of registers hold conent for pIdx */
123627 int regR; /* Range of registers holding conflicting PK */
123628 int iThisCur; /* Cursor for this UNIQUE index */
123629 int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
123630 int addrConflictCk; /* First opcode in the conflict check logic */
123631
123632 if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
123633 if( pUpsert ){
123634 pUpsertClause = sqlite3UpsertOfIndex(pUpsert, pIdx);
123635 if( upsertIpkDelay && pUpsertClause==pUpsert ){
123636 sqlite3VdbeJumpHere(v, upsertIpkDelay);
123637 }
123638 }
123639 addrUniqueOk = sqlite3VdbeMakeLabel(pParse);
123640 if( bAffinityDone==0 ){
 
123641 sqlite3TableAffinity(v, pTab, regNewData+1);
123642 bAffinityDone = 1;
123643 }
123644 VdbeNoopComment((v, "prep index %s", pIdx->zName));
123645 iThisCur = iIdxCur+ix;
@@ -123055,12 +123706,12 @@
123706 }else if( onError==OE_Default ){
123707 onError = OE_Abort;
123708 }
123709
123710 /* Figure out if the upsert clause applies to this index */
123711 if( pUpsertClause ){
123712 if( pUpsertClause->isDoUpdate==0 ){
123713 onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
123714 }else{
123715 onError = OE_Update; /* DO UPDATE */
123716 }
123717 }
@@ -123094,11 +123745,11 @@
123745 addrConflictCk =
123746 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
123747 regIdx, pIdx->nKeyCol); VdbeCoverage(v);
123748
123749 /* Generate code to handle collisions */
123750 regR = pIdx==pPk ? regIdx : sqlite3GetTempRange(pParse, nPkField);
123751 if( isUpdate || onError==OE_Replace ){
123752 if( HasRowid(pTab) ){
123753 sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
123754 /* Conflict only if the rowid of the existing index entry
123755 ** is different from old-rowid */
@@ -123246,17 +123897,20 @@
123897 }
123898 seenReplace = 1;
123899 break;
123900 }
123901 }
123902 sqlite3VdbeResolveLabel(v, addrUniqueOk);
 
 
 
 
 
123903 if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
123904 if( pUpsertClause
123905 && upsertIpkReturn
123906 && sqlite3UpsertNextIsIPK(pUpsertClause)
123907 ){
123908 sqlite3VdbeGoto(v, upsertIpkDelay+1);
123909 sqlite3VdbeJumpHere(v, upsertIpkReturn);
123910 upsertIpkReturn = 0;
123911 }
123912 }
123913
123914 /* If the IPK constraint is a REPLACE, run it last */
123915 if( ipkTop ){
123916 sqlite3VdbeGoto(v, ipkTop);
@@ -123791,10 +124445,11 @@
124445 sqlite3CodeVerifySchema(pParse, iDbSrc);
124446 iSrc = pParse->nTab++;
124447 iDest = pParse->nTab++;
124448 regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
124449 regData = sqlite3GetTempReg(pParse);
124450 sqlite3VdbeAddOp2(v, OP_Null, 0, regData);
124451 regRowid = sqlite3GetTempReg(pParse);
124452 sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
124453 assert( HasRowid(pDest) || destHasUniqueIdx );
124454 if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
124455 (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
@@ -123826,32 +124481,44 @@
124481 u8 insFlags;
124482 sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
124483 emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
124484 if( pDest->iPKey>=0 ){
124485 addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
124486 if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
124487 sqlite3VdbeVerifyAbortable(v, onError);
124488 addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
124489 VdbeCoverage(v);
124490 sqlite3RowidConstraint(pParse, onError, pDest);
124491 sqlite3VdbeJumpHere(v, addr2);
124492 }
124493 autoIncStep(pParse, regAutoinc, regRowid);
124494 }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_VacuumInto) ){
124495 addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
124496 }else{
124497 addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
124498 assert( (pDest->tabFlags & TF_Autoincrement)==0 );
124499 }
124500
124501 if( db->mDbFlags & DBFLAG_Vacuum ){
124502 sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
124503 insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
124504 }else{
124505 insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND|OPFLAG_PREFORMAT;
124506 }
124507 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124508 if( db->xPreUpdateCallback ){
124509 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124510 insFlags &= ~OPFLAG_PREFORMAT;
124511 }else
124512 #endif
124513 {
124514 sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
124515 }
124516 sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
124517 (char*)pDest, P4_TABLE);
124518 sqlite3VdbeChangeP5(v, insFlags);
124519
124520 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
124521 sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
124522 sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
124523 }else{
124524 sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);
@@ -123889,17 +124556,20 @@
124556 for(i=0; i<pSrcIdx->nColumn; i++){
124557 const char *zColl = pSrcIdx->azColl[i];
124558 if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
124559 }
124560 if( i==pSrcIdx->nColumn ){
124561 idxInsFlags = OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
124562 sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
124563 sqlite3VdbeAddOp2(v, OP_RowCell, iDest, iSrc);
124564 }
124565 }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
124566 idxInsFlags |= OPFLAG_NCHANGE;
124567 }
124568 if( idxInsFlags!=(OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT) ){
124569 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124570 }
124571 sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
124572 sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
124573 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
124574 sqlite3VdbeJumpHere(v, addr1);
124575 sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
@@ -128940,15 +129610,22 @@
129610
129611 assert( iDb>=0 && iDb<db->nDb );
129612 if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
129613 if( argv[3]==0 ){
129614 corruptSchema(pData, argv[1], 0);
129615 }else if( argv[4]
129616 && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
129617 && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
129618 /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
129619 ** But because db->init.busy is set to 1, no VDBE code is generated
129620 ** or executed. All the parser does is build the internal data
129621 ** structures that describe the table, index, or view.
129622 **
129623 ** No other valid SQL statement, other than the variable CREATE statements,
129624 ** can begin with the letters "C" and "R". Thus, it is not possible run
129625 ** any other kind of statement while parsing the schema, even a corrupt
129626 ** schema.
129627 */
129628 int rc;
129629 u8 saved_iDb = db->init.iDb;
129630 sqlite3_stmt *pStmt;
129631 TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
@@ -129401,19 +130078,66 @@
130078 while( pThis ){
130079 AggInfo *pNext = pThis->pNext;
130080 agginfoFree(db, pThis);
130081 pThis = pNext;
130082 }
130083 while( pParse->pCleanup ){
130084 ParseCleanup *pCleanup = pParse->pCleanup;
130085 pParse->pCleanup = pCleanup->pNext;
130086 pCleanup->xCleanup(db, pCleanup->pPtr);
130087 sqlite3DbFree(db, pCleanup);
130088 }
130089 sqlite3DbFree(db, pParse->aLabel);
130090 if( pParse->pConstExpr ){
130091 sqlite3ExprListDelete(db, pParse->pConstExpr);
130092 }
130093 if( db ){
130094 assert( db->lookaside.bDisable >= pParse->disableLookaside );
130095 db->lookaside.bDisable -= pParse->disableLookaside;
130096 db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue;
130097 }
130098 pParse->disableLookaside = 0;
130099 }
130100
130101 /*
130102 ** Add a new cleanup operation to a Parser. The cleanup should happen when
130103 ** the parser object is destroyed. But, beware: the cleanup might happen
130104 ** immediately.
130105 **
130106 ** Use this mechanism for uncommon cleanups. There is a higher setup
130107 ** cost for this mechansim (an extra malloc), so it should not be used
130108 ** for common cleanups that happen on most calls. But for less
130109 ** common cleanups, we save a single NULL-pointer comparison in
130110 ** sqlite3ParserReset(), which reduces the total CPU cycle count.
130111 **
130112 ** If a memory allocation error occurs, then the cleanup happens immediately.
130113 ** When eithr SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the
130114 ** pParse->earlyCleanup flag is set in that case. Calling code show verify
130115 ** that test cases exist for which this happens, to guard against possible
130116 ** use-after-free errors following an OOM. The preferred way to do this is
130117 ** to immediately follow the call to this routine with:
130118 **
130119 ** testcase( pParse->earlyCleanup );
130120 */
130121 SQLITE_PRIVATE void sqlite3ParserAddCleanup(
130122 Parse *pParse, /* Destroy when this Parser finishes */
130123 void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */
130124 void *pPtr /* Pointer to object to be cleaned up */
130125 ){
130126 ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup));
130127 if( pCleanup ){
130128 pCleanup->pNext = pParse->pCleanup;
130129 pParse->pCleanup = pCleanup;
130130 pCleanup->pPtr = pPtr;
130131 pCleanup->xCleanup = xCleanup;
130132 }else{
130133 xCleanup(pParse->db, pPtr);
130134 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
130135 pParse->earlyCleanup = 1;
130136 #endif
130137 }
130138 }
130139
130140 /*
130141 ** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
130142 */
130143 static int sqlite3Prepare(
@@ -129509,16 +130233,10 @@
130233 }else{
130234 sqlite3RunParser(&sParse, zSql, &zErrMsg);
130235 }
130236 assert( 0==sParse.nQueryLoop );
130237
 
 
 
 
 
 
130238 if( pzTail ){
130239 *pzTail = sParse.zTail;
130240 }
130241
130242 if( db->init.busy==0 ){
@@ -129525,24 +130243,32 @@
130243 sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
130244 }
130245 if( db->mallocFailed ){
130246 sParse.rc = SQLITE_NOMEM_BKPT;
130247 }
130248 if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){
130249 if( sParse.checkSchema ){
130250 schemaIsValid(&sParse);
130251 }
130252 if( sParse.pVdbe ){
130253 sqlite3VdbeFinalize(sParse.pVdbe);
130254 }
130255 assert( 0==(*ppStmt) );
130256 rc = sParse.rc;
130257 if( zErrMsg ){
130258 sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
130259 sqlite3DbFree(db, zErrMsg);
130260 }else{
130261 sqlite3Error(db, rc);
130262 }
130263 }else{
130264 assert( zErrMsg==0 );
130265 *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
130266 rc = SQLITE_OK;
130267 sqlite3ErrorClear(db);
130268 }
130269
 
 
 
 
 
 
130270
130271 /* Delete any TriggerPrg structures allocated while parsing this statement. */
130272 while( sParse.pTriggerPrg ){
130273 TriggerPrg *pT = sParse.pTriggerPrg;
130274 sParse.pTriggerPrg = pT->pNext;
@@ -130146,11 +130872,11 @@
130872 pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
130873 if( pEq && isOuterJoin ){
130874 ExprSetProperty(pEq, EP_FromJoin);
130875 assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
130876 ExprSetVVAProperty(pEq, EP_NoReduce);
130877 pEq->iRightJoinTable = pE2->iTable;
130878 }
130879 *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
130880 }
130881
130882 /*
@@ -130182,11 +130908,11 @@
130908 SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){
130909 while( p ){
130910 ExprSetProperty(p, EP_FromJoin);
130911 assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );
130912 ExprSetVVAProperty(p, EP_NoReduce);
130913 p->iRightJoinTable = iTable;
130914 if( p->op==TK_FUNCTION && p->x.pList ){
130915 int i;
130916 for(i=0; i<p->x.pList->nExpr; i++){
130917 sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable);
130918 }
@@ -133448,10 +134174,92 @@
134174 pSrcItem->colUsed = 0;
134175 sqlite3WalkSelect(&w, pSelect);
134176 }
134177 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
134178
134179 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
134180 /*
134181 ** Assign new cursor numbers to each of the items in pSrc. For each
134182 ** new cursor number assigned, set an entry in the aCsrMap[] array
134183 ** to map the old cursor number to the new:
134184 **
134185 ** aCsrMap[iOld] = iNew;
134186 **
134187 ** The array is guaranteed by the caller to be large enough for all
134188 ** existing cursor numbers in pSrc.
134189 **
134190 ** If pSrc contains any sub-selects, call this routine recursively
134191 ** on the FROM clause of each such sub-select, with iExcept set to -1.
134192 */
134193 static void srclistRenumberCursors(
134194 Parse *pParse, /* Parse context */
134195 int *aCsrMap, /* Array to store cursor mappings in */
134196 SrcList *pSrc, /* FROM clause to renumber */
134197 int iExcept /* FROM clause item to skip */
134198 ){
134199 int i;
134200 struct SrcList_item *pItem;
134201 for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
134202 if( i!=iExcept ){
134203 Select *p;
134204 pItem->iCursor = aCsrMap[pItem->iCursor] = pParse->nTab++;
134205 for(p=pItem->pSelect; p; p=p->pPrior){
134206 srclistRenumberCursors(pParse, aCsrMap, p->pSrc, -1);
134207 }
134208 }
134209 }
134210 }
134211
134212 /*
134213 ** Expression walker callback used by renumberCursors() to update
134214 ** Expr objects to match newly assigned cursor numbers.
134215 */
134216 static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
134217 int *aCsrMap = pWalker->u.aiCol;
134218 if( pExpr->op==TK_COLUMN && aCsrMap[pExpr->iTable] ){
134219 pExpr->iTable = aCsrMap[pExpr->iTable];
134220 }
134221 if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
134222 pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
134223 }
134224 return WRC_Continue;
134225 }
134226
134227 /*
134228 ** Assign a new cursor number to each cursor in the FROM clause (Select.pSrc)
134229 ** of the SELECT statement passed as the second argument, and to each
134230 ** cursor in the FROM clause of any FROM clause sub-selects, recursively.
134231 ** Except, do not assign a new cursor number to the iExcept'th element in
134232 ** the FROM clause of (*p). Update all expressions and other references
134233 ** to refer to the new cursor numbers.
134234 **
134235 ** Argument aCsrMap is an array that may be used for temporary working
134236 ** space. Two guarantees are made by the caller:
134237 **
134238 ** * the array is larger than the largest cursor number used within the
134239 ** select statement passed as an argument, and
134240 **
134241 ** * the array entries for all cursor numbers that do *not* appear in
134242 ** FROM clauses of the select statement as described above are
134243 ** initialized to zero.
134244 */
134245 static void renumberCursors(
134246 Parse *pParse, /* Parse context */
134247 Select *p, /* Select to renumber cursors within */
134248 int iExcept, /* FROM clause item to skip */
134249 int *aCsrMap /* Working space */
134250 ){
134251 Walker w;
134252 srclistRenumberCursors(pParse, aCsrMap, p->pSrc, iExcept);
134253 memset(&w, 0, sizeof(w));
134254 w.u.aiCol = aCsrMap;
134255 w.xExprCallback = renumberCursorsCb;
134256 w.xSelectCallback = sqlite3SelectWalkNoop;
134257 sqlite3WalkSelect(&w, p);
134258 }
134259 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
134260
134261 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
134262 /*
134263 ** This routine attempts to flatten subqueries as a performance optimization.
134264 ** This routine returns 1 if it makes changes and 0 if no flattening occurs.
134265 **
@@ -133542,13 +134350,13 @@
134350 ** (17b) no terms within the subquery compound may be aggregate
134351 ** or DISTINCT, and
134352 ** (17c) every term within the subquery compound must have a FROM clause
134353 ** (17d) the outer query may not be
134354 ** (17d1) aggregate, or
134355 ** (17d2) DISTINCT
134356 ** (17e) the subquery may not contain window functions, and
134357 ** (17f) the subquery must not be the RHS of a LEFT JOIN.
134358 **
134359 ** The parent and sub-query may contain WHERE clauses. Subject to
134360 ** rules (11), (13) and (14), they may also contain ORDER BY,
134361 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
134362 ** operator other than UNION ALL because all the other compound
@@ -133560,12 +134368,12 @@
134368 ** SELECT statement, but all the code here does is make sure that no
134369 ** such (illegal) sub-query is flattened. The caller will detect the
134370 ** syntax error and return a detailed message.
134371 **
134372 ** (18) If the sub-query is a compound select, then all terms of the
134373 ** ORDER BY clause of the parent must be copies of a term returned
134374 ** by the parent query.
134375 **
134376 ** (19) If the subquery uses LIMIT then the outer query may not
134377 ** have a WHERE clause.
134378 **
134379 ** (20) If the sub-query is a compound select, then it must not use
@@ -133577,13 +134385,12 @@
134385 ** (21) If the subquery uses LIMIT then the outer query may not be
134386 ** DISTINCT. (See ticket [752e1646fc]).
134387 **
134388 ** (22) The subquery may not be a recursive CTE.
134389 **
134390 ** (23) If the outer query is a recursive CTE, then the sub-query may not be
134391 ** a compound query. This restriction is because transforming the
 
134392 ** parent to a compound query confuses the code that handles
134393 ** recursive queries in multiSelect().
134394 **
134395 ** (**) We no longer attempt to flatten aggregate subqueries. Was:
134396 ** The subquery may not be an aggregate that uses the built-in min() or
@@ -133624,10 +134431,11 @@
134431 int i; /* Loop counter */
134432 Expr *pWhere; /* The WHERE clause */
134433 struct SrcList_item *pSubitem; /* The subquery */
134434 sqlite3 *db = pParse->db;
134435 Walker w; /* Walker to persist agginfo data */
134436 int *aCsrMap = 0;
134437
134438 /* Check to see if flattening is permitted. Return 0 if not.
134439 */
134440 assert( p!=0 );
134441 assert( p->pPrior==0 );
@@ -133719,17 +134527,18 @@
134527 */
134528 if( pSub->pPrior ){
134529 if( pSub->pOrderBy ){
134530 return 0; /* Restriction (20) */
134531 }
134532 if( isAgg || (p->selFlags & SF_Distinct)!=0 || isLeftJoin>0 ){
134533 return 0; /* (17d1), (17d2), or (17f) */
134534 }
134535 for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
134536 testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );
134537 testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );
134538 assert( pSub->pSrc!=0 );
134539 assert( (pSub->selFlags & SF_Recursive)==0 );
134540 assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );
134541 if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */
134542 || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */
134543 || pSub1->pSrc->nSrc<1 /* (17c) */
134544 #ifndef SQLITE_OMIT_WINDOWFUNC
@@ -133746,19 +134555,18 @@
134555 int ii;
134556 for(ii=0; ii<p->pOrderBy->nExpr; ii++){
134557 if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;
134558 }
134559 }
134560
134561 /* Restriction (23) */
134562 if( (p->selFlags & SF_Recursive) ) return 0;
134563
134564 if( pSrc->nSrc>1 ){
134565 aCsrMap = sqlite3DbMallocZero(db, pParse->nTab*sizeof(int));
134566 }
134567 }
 
134568
134569 /***** If we reach this point, flattening is permitted. *****/
134570 SELECTTRACE(1,pParse,p,("flatten %u.%p from term %d\n",
134571 pSub->selId, pSub, iFrom));
134572
@@ -133765,10 +134573,21 @@
134573 /* Authorize the subquery */
134574 pParse->zAuthContext = pSubitem->zName;
134575 TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);
134576 testcase( i==SQLITE_DENY );
134577 pParse->zAuthContext = zSavedAuthContext;
134578
134579 /* Delete the transient structures associated with thesubquery */
134580 pSub1 = pSubitem->pSelect;
134581 sqlite3DbFree(db, pSubitem->zDatabase);
134582 sqlite3DbFree(db, pSubitem->zName);
134583 sqlite3DbFree(db, pSubitem->zAlias);
134584 pSubitem->zDatabase = 0;
134585 pSubitem->zName = 0;
134586 pSubitem->zAlias = 0;
134587 pSubitem->pSelect = 0;
134588 assert( pSubitem->pOn==0 );
134589
134590 /* If the sub-query is a compound SELECT statement, then (by restrictions
134591 ** 17 and 18 above) it must be a UNION ALL and the parent query must
134592 ** be of the form:
134593 **
@@ -133804,47 +134623,40 @@
134623 for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){
134624 Select *pNew;
134625 ExprList *pOrderBy = p->pOrderBy;
134626 Expr *pLimit = p->pLimit;
134627 Select *pPrior = p->pPrior;
134628 Table *pItemTab = pSubitem->pTab;
134629 pSubitem->pTab = 0;
134630 p->pOrderBy = 0;
 
134631 p->pPrior = 0;
134632 p->pLimit = 0;
134633 pNew = sqlite3SelectDup(db, p, 0);
134634 p->pLimit = pLimit;
134635 p->pOrderBy = pOrderBy;
 
134636 p->op = TK_ALL;
134637 pSubitem->pTab = pItemTab;
134638 if( pNew==0 ){
134639 p->pPrior = pPrior;
134640 }else{
134641 if( aCsrMap && db->mallocFailed==0 ){
134642 renumberCursors(pParse, pNew, iFrom, aCsrMap);
134643 }
134644 pNew->pPrior = pPrior;
134645 if( pPrior ) pPrior->pNext = pNew;
134646 pNew->pNext = p;
134647 p->pPrior = pNew;
134648 SELECTTRACE(2,pParse,p,("compound-subquery flattener"
134649 " creates %u as peer\n",pNew->selId));
134650 }
134651 assert( pSubitem->pSelect==0 );
134652 }
134653 sqlite3DbFree(db, aCsrMap);
134654 if( db->mallocFailed ){
134655 pSubitem->pSelect = pSub1;
134656 return 1;
134657 }
 
 
 
 
 
 
 
 
 
 
 
134658
134659 /* Defer deleting the Table object associated with the
134660 ** subquery until code generation is
134661 ** complete, since there may still exist Expr.pTab entries that
134662 ** refer to the subquery even after flattening. Ticket #3346.
@@ -133853,12 +134665,14 @@
134665 */
134666 if( ALWAYS(pSubitem->pTab!=0) ){
134667 Table *pTabToDel = pSubitem->pTab;
134668 if( pTabToDel->nTabRef==1 ){
134669 Parse *pToplevel = sqlite3ParseToplevel(pParse);
134670 sqlite3ParserAddCleanup(pToplevel,
134671 (void(*)(sqlite3*,void*))sqlite3DeleteTable,
134672 pTabToDel);
134673 testcase( pToplevel->earlyCleanup );
134674 }else{
134675 pTabToDel->nTabRef--;
134676 }
134677 pSubitem->pTab = 0;
134678 }
@@ -133874,26 +134688,21 @@
134688 ** iParent. The iParent cursor will never be used. Subsequent code
134689 ** will scan expressions looking for iParent references and replace
134690 ** those references with expressions that resolve to the subquery FROM
134691 ** elements we are now copying in.
134692 */
134693 pSub = pSub1;
134694 for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
134695 int nSubSrc;
134696 u8 jointype = 0;
134697 assert( pSub!=0 );
134698 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
134699 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
134700 pSrc = pParent->pSrc; /* FROM clause of the outer query */
134701
134702 if( pParent==p ){
134703 jointype = pSubitem->fg.jointype; /* First time through the loop */
 
 
 
 
 
 
134704 }
134705
134706 /* The subquery uses a single slot of the FROM clause of the outer
134707 ** query. If the subquery has more than one element in its FROM clause,
134708 ** then expand the outer query to make space for it to hold all elements
@@ -134009,11 +134818,11 @@
134818 sqlite3AggInfoPersistWalkerInit(&w, pParse);
134819 sqlite3WalkSelect(&w,pSub1);
134820 sqlite3SelectDelete(db, pSub1);
134821
134822 #if SELECTTRACE_ENABLED
134823 if( sqlite3SelectTrace & 0x100 ){
134824 SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
134825 sqlite3TreeViewSelect(0, p, 0);
134826 }
134827 #endif
134828
@@ -134356,11 +135165,15 @@
135165 u8 sortFlags = 0;
135166
135167 assert( *ppMinMax==0 );
135168 assert( pFunc->op==TK_AGG_FUNCTION );
135169 assert( !IsWindowFunc(pFunc) );
135170 if( pEList==0
135171 || pEList->nExpr!=1
135172 || ExprHasProperty(pFunc, EP_WinFunc)
135173 || OptimizationDisabled(db, SQLITE_MinMaxOpt)
135174 ){
135175 return eRet;
135176 }
135177 zFunc = pFunc->u.zToken;
135178 if( sqlite3StrICmp(zFunc, "min")==0 ){
135179 eRet = WHERE_ORDERBY_MIN;
@@ -134574,16 +135387,20 @@
135387 ** should be freed along with the Parse object. In other cases, when
135388 ** bFree==0, the With object will be freed along with the SELECT
135389 ** statement with which it is associated.
135390 */
135391 SQLITE_PRIVATE void sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){
 
135392 if( pWith ){
135393 assert( pParse->pWith!=pWith );
135394 pWith->pOuter = pParse->pWith;
135395 pParse->pWith = pWith;
135396 if( bFree ){
135397 sqlite3ParserAddCleanup(pParse,
135398 (void(*)(sqlite3*,void*))sqlite3WithDelete,
135399 pWith);
135400 testcase( pParse->earlyCleanup );
135401 }
135402 }
135403 }
135404
135405 /*
135406 ** This function checks if argument pFrom refers to a CTE declared by
@@ -135414,11 +136231,13 @@
136231 ** within the HAVING expression with a constant "1".
136232 */
136233 static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){
136234 if( pExpr->op!=TK_AND ){
136235 Select *pS = pWalker->u.pSelect;
136236 if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy)
136237 && ExprAlwaysFalse(pExpr)==0
136238 ){
136239 sqlite3 *db = pWalker->pParse->db;
136240 Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1");
136241 if( pNew ){
136242 Expr *pWhere = pS->pWhere;
136243 SWAP(Expr, *pNew, *pExpr);
@@ -135453,11 +136272,11 @@
136272 sWalker.pParse = pParse;
136273 sWalker.xExprCallback = havingToWhereExprCb;
136274 sWalker.u.pSelect = p;
136275 sqlite3WalkExpr(&sWalker, p->pHaving);
136276 #if SELECTTRACE_ENABLED
136277 if( sWalker.eCode && (sqlite3SelectTrace & 0x100)!=0 ){
136278 SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
136279 sqlite3TreeViewSelect(0, p, 0);
136280 }
136281 #endif
136282 }
@@ -135575,11 +136394,11 @@
136394 }
136395 p->pEList->a[0].pExpr = pExpr;
136396 p->selFlags &= ~SF_Aggregate;
136397
136398 #if SELECTTRACE_ENABLED
136399 if( sqlite3SelectTrace & 0x400 ){
136400 SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
136401 sqlite3TreeViewSelect(0, p, 0);
136402 }
136403 #endif
136404 return 1;
@@ -135628,11 +136447,11 @@
136447 return 1;
136448 }
136449 if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
136450 #if SELECTTRACE_ENABLED
136451 SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
136452 if( sqlite3SelectTrace & 0x100 ){
136453 sqlite3TreeViewSelect(0, p, 0);
136454 }
136455 #endif
136456
136457 assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );
@@ -135653,11 +136472,11 @@
136472 if( pParse->nErr || db->mallocFailed ){
136473 goto select_end;
136474 }
136475 assert( p->pEList!=0 );
136476 #if SELECTTRACE_ENABLED
136477 if( sqlite3SelectTrace & 0x104 ){
136478 SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
136479 sqlite3TreeViewSelect(0, p, 0);
136480 }
136481 #endif
136482
@@ -135688,11 +136507,11 @@
136507 if( rc ){
136508 assert( db->mallocFailed || pParse->nErr>0 );
136509 goto select_end;
136510 }
136511 #if SELECTTRACE_ENABLED
136512 if( p->pWin && (sqlite3SelectTrace & 0x108)!=0 ){
136513 SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n"));
136514 sqlite3TreeViewSelect(0, p, 0);
136515 }
136516 #endif
136517 #endif /* SQLITE_OMIT_WINDOWFUNC */
@@ -135795,11 +136614,11 @@
136614 */
136615 if( p->pPrior ){
136616 rc = multiSelect(pParse, p, pDest);
136617 #if SELECTTRACE_ENABLED
136618 SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
136619 if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
136620 sqlite3TreeViewSelect(0, p, 0);
136621 }
136622 #endif
136623 if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
136624 return rc;
@@ -135814,11 +136633,11 @@
136633 if( pTabList->nSrc>1
136634 && OptimizationEnabled(db, SQLITE_PropagateConst)
136635 && propagateConstants(pParse, p)
136636 ){
136637 #if SELECTTRACE_ENABLED
136638 if( sqlite3SelectTrace & 0x100 ){
136639 SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
136640 sqlite3TreeViewSelect(0, p, 0);
136641 }
136642 #endif
136643 }else{
@@ -135902,11 +136721,11 @@
136721 if( OptimizationEnabled(db, SQLITE_PushDown)
136722 && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
136723 (pItem->fg.jointype & JT_OUTER)!=0)
136724 ){
136725 #if SELECTTRACE_ENABLED
136726 if( sqlite3SelectTrace & 0x100 ){
136727 SELECTTRACE(0x100,pParse,p,
136728 ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
136729 sqlite3TreeViewSelect(0, p, 0);
136730 }
136731 #endif
@@ -136002,11 +136821,11 @@
136821 pGroupBy = p->pGroupBy;
136822 pHaving = p->pHaving;
136823 sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;
136824
136825 #if SELECTTRACE_ENABLED
136826 if( sqlite3SelectTrace & 0x400 ){
136827 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
136828 sqlite3TreeViewSelect(0, p, 0);
136829 }
136830 #endif
136831
@@ -136038,11 +136857,11 @@
136857 ** the sDistinct.isTnct is still set. Hence, isTnct represents the
136858 ** original setting of the SF_Distinct flag, not the current setting */
136859 assert( sDistinct.isTnct );
136860
136861 #if SELECTTRACE_ENABLED
136862 if( sqlite3SelectTrace & 0x400 ){
136863 SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
136864 sqlite3TreeViewSelect(0, p, 0);
136865 }
136866 #endif
136867 }
@@ -136286,14 +137105,18 @@
137105 sNC.ncFlags &= ~NC_InAggFunc;
137106 }
137107 pAggInfo->mxReg = pParse->nMem;
137108 if( db->mallocFailed ) goto select_end;
137109 #if SELECTTRACE_ENABLED
137110 if( sqlite3SelectTrace & 0x400 ){
137111 int ii;
137112 SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
137113 sqlite3TreeViewSelect(0, p, 0);
137114 if( minMaxFlag ){
137115 sqlite3DebugPrintf("MIN/MAX Optimization (0x%02x) adds:\n", minMaxFlag);
137116 sqlite3TreeViewExprList(0, pMinMaxOrderBy, 0, "ORDERBY");
137117 }
137118 for(ii=0; ii<pAggInfo->nColumn; ii++){
137119 sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
137120 ii, pAggInfo->aCol[ii].iMem);
137121 sqlite3TreeViewExpr(0, pAggInfo->aCol[ii].pCExpr, 0);
137122 }
@@ -136479,11 +137302,11 @@
137302 VdbeComment((v, "indicate data in accumulator"));
137303
137304 /* End of the loop
137305 */
137306 if( groupBySort ){
137307 sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
137308 VdbeCoverage(v);
137309 }else{
137310 sqlite3WhereEnd(pWInfo);
137311 sqlite3VdbeChangeToNoop(v, addrSortingIdx);
137312 }
@@ -136591,11 +137414,10 @@
137414 sqlite3VdbeAddOp2(v, OP_Count, iCsr, pAggInfo->aFunc[0].iMem);
137415 sqlite3VdbeAddOp1(v, OP_Close, iCsr);
137416 explainSimpleCount(pParse, pTab, pBest);
137417 }else{
137418 int regAcc = 0; /* "populate accumulators" flag */
 
137419
137420 /* If there are accumulator registers but no min() or max() functions
137421 ** without FILTER clauses, allocate register regAcc. Register regAcc
137422 ** will contain 0 the first time the inner loop runs, and 1 thereafter.
137423 ** The code generated by updateAccumulator() uses this to ensure
@@ -136640,13 +137462,12 @@
137462 if( pWInfo==0 ){
137463 goto select_end;
137464 }
137465 updateAccumulator(pParse, regAcc, pAggInfo);
137466 if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
137467 if( minMaxFlag ){
137468 sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
 
137469 }
137470 sqlite3WhereEnd(pWInfo);
137471 finalizeAggFunctions(pParse, pAggInfo);
137472 }
137473
@@ -136688,28 +137509,26 @@
137509 sqlite3ExprListDelete(db, pMinMaxOrderBy);
137510 #ifdef SQLITE_DEBUG
137511 if( pAggInfo && !db->mallocFailed ){
137512 for(i=0; i<pAggInfo->nColumn; i++){
137513 Expr *pExpr = pAggInfo->aCol[i].pCExpr;
137514 assert( pExpr!=0 );
 
137515 assert( pExpr->pAggInfo==pAggInfo );
137516 assert( pExpr->iAgg==i );
137517 }
137518 for(i=0; i<pAggInfo->nFunc; i++){
137519 Expr *pExpr = pAggInfo->aFunc[i].pFExpr;
137520 assert( pExpr!=0 );
 
137521 assert( pExpr->pAggInfo==pAggInfo );
137522 assert( pExpr->iAgg==i );
137523 }
137524 }
137525 #endif
137526
137527 #if SELECTTRACE_ENABLED
137528 SELECTTRACE(0x1,pParse,p,("end processing\n"));
137529 if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
137530 sqlite3TreeViewSelect(0, p, 0);
137531 }
137532 #endif
137533 ExplainQueryPlanPop(pParse);
137534 return rc;
@@ -137918,11 +138737,10 @@
138737 pPrg->aColmask[0] = pSubParse->oldmask;
138738 pPrg->aColmask[1] = pSubParse->newmask;
138739 sqlite3VdbeDelete(v);
138740 }
138741
 
138742 assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg );
138743 sqlite3ParserReset(pSubParse);
138744 sqlite3StackFree(db, pSubParse);
138745
138746 return pPrg;
@@ -139476,19 +140294,26 @@
140294
140295 #ifndef SQLITE_OMIT_UPSERT
140296 /*
140297 ** Free a list of Upsert objects
140298 */
140299 static void SQLITE_NOINLINE upsertDelete(sqlite3 *db, Upsert *p){
140300 do{
140301 Upsert *pNext = p->pNextUpsert;
140302 sqlite3ExprListDelete(db, p->pUpsertTarget);
140303 sqlite3ExprDelete(db, p->pUpsertTargetWhere);
140304 sqlite3ExprListDelete(db, p->pUpsertSet);
140305 sqlite3ExprDelete(db, p->pUpsertWhere);
140306 sqlite3DbFree(db, p->pToFree);
140307 sqlite3DbFree(db, p);
140308 p = pNext;
140309 }while( p );
140310 }
140311 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
140312 if( p ) upsertDelete(db, p);
140313 }
140314
140315
140316 /*
140317 ** Duplicate an Upsert object.
140318 */
140319 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
@@ -139495,11 +140320,12 @@
140320 if( p==0 ) return 0;
140321 return sqlite3UpsertNew(db,
140322 sqlite3ExprListDup(db, p->pUpsertTarget, 0),
140323 sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
140324 sqlite3ExprListDup(db, p->pUpsertSet, 0),
140325 sqlite3ExprDup(db, p->pUpsertWhere, 0),
140326 sqlite3UpsertDup(db, p->pNextUpsert)
140327 );
140328 }
140329
140330 /*
140331 ** Create a new Upsert object.
@@ -139507,26 +140333,29 @@
140333 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
140334 sqlite3 *db, /* Determines which memory allocator to use */
140335 ExprList *pTarget, /* Target argument to ON CONFLICT, or NULL */
140336 Expr *pTargetWhere, /* Optional WHERE clause on the target */
140337 ExprList *pSet, /* UPDATE columns, or NULL for a DO NOTHING */
140338 Expr *pWhere, /* WHERE clause for the ON CONFLICT UPDATE */
140339 Upsert *pNext /* Next ON CONFLICT clause in the list */
140340 ){
140341 Upsert *pNew;
140342 pNew = sqlite3DbMallocZero(db, sizeof(Upsert));
140343 if( pNew==0 ){
140344 sqlite3ExprListDelete(db, pTarget);
140345 sqlite3ExprDelete(db, pTargetWhere);
140346 sqlite3ExprListDelete(db, pSet);
140347 sqlite3ExprDelete(db, pWhere);
140348 sqlite3UpsertDelete(db, pNext);
140349 return 0;
140350 }else{
140351 pNew->pUpsertTarget = pTarget;
140352 pNew->pUpsertTargetWhere = pTargetWhere;
140353 pNew->pUpsertSet = pSet;
140354 pNew->pUpsertWhere = pWhere;
140355 pNew->isDoUpdate = pSet!=0;
140356 pNew->pNextUpsert = pNext;
140357 }
140358 return pNew;
140359 }
140360
140361 /*
@@ -139547,10 +140376,11 @@
140376 Index *pIdx; /* One of the indexes of pTab */
140377 ExprList *pTarget; /* The conflict-target clause */
140378 Expr *pTerm; /* One term of the conflict-target clause */
140379 NameContext sNC; /* Context for resolving symbolic names */
140380 Expr sCol[2]; /* Index column converted into an Expr */
140381 int nClause = 0; /* Counter of ON CONFLICT clauses */
140382
140383 assert( pTabList->nSrc==1 );
140384 assert( pTabList->a[0].pTab!=0 );
140385 assert( pUpsert!=0 );
140386 assert( pUpsert->pUpsertTarget!=0 );
@@ -139560,91 +140390,135 @@
140390 ** WHERE clause.
140391 */
140392 memset(&sNC, 0, sizeof(sNC));
140393 sNC.pParse = pParse;
140394 sNC.pSrcList = pTabList;
140395 for(; pUpsert && pUpsert->pUpsertTarget;
140396 pUpsert=pUpsert->pNextUpsert, nClause++){
140397 rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
140398 if( rc ) return rc;
140399 rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
140400 if( rc ) return rc;
140401
140402 /* Check to see if the conflict target matches the rowid. */
140403 pTab = pTabList->a[0].pTab;
140404 pTarget = pUpsert->pUpsertTarget;
140405 iCursor = pTabList->a[0].iCursor;
140406 if( HasRowid(pTab)
140407 && pTarget->nExpr==1
140408 && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
140409 && pTerm->iColumn==XN_ROWID
140410 ){
140411 /* The conflict-target is the rowid of the primary table */
140412 assert( pUpsert->pUpsertIdx==0 );
140413 continue;
140414 }
140415
140416 /* Initialize sCol[0..1] to be an expression parse tree for a
140417 ** single column of an index. The sCol[0] node will be the TK_COLLATE
140418 ** operator and sCol[1] will be the TK_COLUMN operator. Code below
140419 ** will populate the specific collation and column number values
140420 ** prior to comparing against the conflict-target expression.
140421 */
140422 memset(sCol, 0, sizeof(sCol));
140423 sCol[0].op = TK_COLLATE;
140424 sCol[0].pLeft = &sCol[1];
140425 sCol[1].op = TK_COLUMN;
140426 sCol[1].iTable = pTabList->a[0].iCursor;
140427
140428 /* Check for matches against other indexes */
140429 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
140430 int ii, jj, nn;
140431 if( !IsUniqueIndex(pIdx) ) continue;
140432 if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
140433 if( pIdx->pPartIdxWhere ){
140434 if( pUpsert->pUpsertTargetWhere==0 ) continue;
140435 if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
140436 pIdx->pPartIdxWhere, iCursor)!=0 ){
140437 continue;
140438 }
140439 }
140440 nn = pIdx->nKeyCol;
140441 for(ii=0; ii<nn; ii++){
140442 Expr *pExpr;
140443 sCol[0].u.zToken = (char*)pIdx->azColl[ii];
140444 if( pIdx->aiColumn[ii]==XN_EXPR ){
140445 assert( pIdx->aColExpr!=0 );
140446 assert( pIdx->aColExpr->nExpr>ii );
140447 pExpr = pIdx->aColExpr->a[ii].pExpr;
140448 if( pExpr->op!=TK_COLLATE ){
140449 sCol[0].pLeft = pExpr;
140450 pExpr = &sCol[0];
140451 }
140452 }else{
140453 sCol[0].pLeft = &sCol[1];
140454 sCol[1].iColumn = pIdx->aiColumn[ii];
140455 pExpr = &sCol[0];
140456 }
140457 for(jj=0; jj<nn; jj++){
140458 if( sqlite3ExprCompare(pParse,pTarget->a[jj].pExpr,pExpr,iCursor)<2 ){
140459 break; /* Column ii of the index matches column jj of target */
140460 }
140461 }
140462 if( jj>=nn ){
140463 /* The target contains no match for column jj of the index */
140464 break;
140465 }
140466 }
140467 if( ii<nn ){
140468 /* Column ii of the index did not match any term of the conflict target.
140469 ** Continue the search with the next index. */
140470 continue;
140471 }
140472 pUpsert->pUpsertIdx = pIdx;
140473 break;
140474 }
140475 if( pUpsert->pUpsertIdx==0 ){
140476 char zWhich[16];
140477 if( nClause==0 && pUpsert->pNextUpsert==0 ){
140478 zWhich[0] = 0;
140479 }else{
140480 sqlite3_snprintf(sizeof(zWhich),zWhich,"%r ", nClause+1);
140481 }
140482 sqlite3ErrorMsg(pParse, "%sON CONFLICT clause does not match any "
140483 "PRIMARY KEY or UNIQUE constraint", zWhich);
140484 return SQLITE_ERROR;
140485 }
140486 }
140487 return SQLITE_OK;
140488 }
140489
140490 /*
140491 ** Return true if pUpsert is the last ON CONFLICT clause with a
140492 ** conflict target, or if pUpsert is followed by another ON CONFLICT
140493 ** clause that targets the INTEGER PRIMARY KEY.
140494 */
140495 SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert *pUpsert){
140496 Upsert *pNext;
140497 if( NEVER(pUpsert==0) ) return 0;
140498 pNext = pUpsert->pNextUpsert;
140499 if( pNext==0 ) return 1;
140500 if( pNext->pUpsertTarget==0 ) return 1;
140501 if( pNext->pUpsertIdx==0 ) return 1;
140502 return 0;
140503 }
140504
140505 /*
140506 ** Given the list of ON CONFLICT clauses described by pUpsert, and
140507 ** a particular index pIdx, return a pointer to the particular ON CONFLICT
140508 ** clause that applies to the index. Or, if the index is not subject to
140509 ** any ON CONFLICT clause, return NULL.
140510 */
140511 SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert *pUpsert, Index *pIdx){
140512 while(
140513 pUpsert
140514 && pUpsert->pUpsertTarget!=0
140515 && pUpsert->pUpsertIdx!=pIdx
140516 ){
140517 pUpsert = pUpsert->pNextUpsert;
140518 }
140519 return pUpsert;
140520 }
140521
140522 /*
140523 ** Generate bytecode that does an UPDATE as part of an upsert.
140524 **
@@ -139664,15 +140538,17 @@
140538 Vdbe *v = pParse->pVdbe;
140539 sqlite3 *db = pParse->db;
140540 SrcList *pSrc; /* FROM clause for the UPDATE */
140541 int iDataCur;
140542 int i;
140543 Upsert *pTop = pUpsert;
140544
140545 assert( v!=0 );
140546 assert( pUpsert!=0 );
 
140547 iDataCur = pUpsert->iDataCur;
140548 pUpsert = sqlite3UpsertOfIndex(pTop, pIdx);
140549 VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
140550 if( pIdx && iCur!=iDataCur ){
140551 if( HasRowid(pTab) ){
140552 int regRowid = sqlite3GetTempReg(pParse);
140553 sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
140554 sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
@@ -139698,23 +140574,21 @@
140574 "corrupt database", P4_STATIC);
140575 sqlite3MayAbort(pParse);
140576 sqlite3VdbeJumpHere(v, i);
140577 }
140578 }
140579 /* pUpsert does not own pTop->pUpsertSrc - the outer INSERT statement does.
140580 ** So we have to make a copy before passing it down into sqlite3Update() */
140581 pSrc = sqlite3SrcListDup(db, pTop->pUpsertSrc, 0);
140582 /* excluded.* columns of type REAL need to be converted to a hard real */
140583 for(i=0; i<pTab->nCol; i++){
140584 if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
140585 sqlite3VdbeAddOp1(v, OP_RealAffinity, pTop->regData+i);
140586 }
140587 }
140588 sqlite3Update(pParse, pSrc, sqlite3ExprListDup(db,pUpsert->pUpsertSet,0),
140589 sqlite3ExprDup(db,pUpsert->pUpsertWhere,0), OE_Abort, 0, 0, pUpsert);
 
 
140590 VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
140591 }
140592
140593 #endif /* SQLITE_OMIT_UPSERT */
140594
@@ -141487,23 +142361,10 @@
142361 ** a separate source file for easier editing.
142362 */
142363 #ifndef SQLITE_WHEREINT_H
142364 #define SQLITE_WHEREINT_H
142365
 
 
 
 
 
 
 
 
 
 
 
 
 
142366
142367 /* Forward references
142368 */
142369 typedef struct WhereClause WhereClause;
142370 typedef struct WhereMaskSet WhereMaskSet;
@@ -145573,10 +146434,275 @@
146434 }
146435 if( mPrereq==0 ) return 0; /* No table references */
146436 if( (mPrereq&(mPrereq-1))!=0 ) return 0; /* Refs more than one table */
146437 return exprMightBeIndexed2(pFrom,mPrereq,aiCurCol,pExpr);
146438 }
146439
146440 /*
146441 ** Expression callback for exprUsesSrclist().
146442 */
146443 static int exprUsesSrclistCb(Walker *p, Expr *pExpr){
146444 if( pExpr->op==TK_COLUMN ){
146445 SrcList *pSrc = p->u.pSrcList;
146446 int iCsr = pExpr->iTable;
146447 int ii;
146448 for(ii=0; ii<pSrc->nSrc; ii++){
146449 if( pSrc->a[ii].iCursor==iCsr ){
146450 return p->eCode ? WRC_Abort : WRC_Continue;
146451 }
146452 }
146453 return p->eCode ? WRC_Continue : WRC_Abort;
146454 }
146455 return WRC_Continue;
146456 }
146457
146458 /*
146459 ** Select callback for exprUsesSrclist().
146460 */
146461 static int exprUsesSrclistSelectCb(Walker *p, Select *pSelect){
146462 return WRC_Abort;
146463 }
146464
146465 /*
146466 ** This function always returns true if expression pExpr contains
146467 ** a sub-select.
146468 **
146469 ** If there is no sub-select in pExpr, then return true if pExpr
146470 ** contains a TK_COLUMN node for a table that is (bUses==1)
146471 ** or is not (bUses==0) in pSrc.
146472 **
146473 ** Said another way:
146474 **
146475 ** bUses Return Meaning
146476 ** -------- ------ ------------------------------------------------
146477 **
146478 ** bUses==1 true pExpr contains either a sub-select or a
146479 ** TK_COLUMN referencing pSrc.
146480 **
146481 ** bUses==1 false pExpr contains no sub-selects and all TK_COLUMN
146482 ** nodes reference tables not found in pSrc
146483 **
146484 ** bUses==0 true pExpr contains either a sub-select or a TK_COLUMN
146485 ** that references a table not in pSrc.
146486 **
146487 ** bUses==0 false pExpr contains no sub-selects and all TK_COLUMN
146488 ** nodes reference pSrc
146489 */
146490 static int exprUsesSrclist(SrcList *pSrc, Expr *pExpr, int bUses){
146491 Walker sWalker;
146492 memset(&sWalker, 0, sizeof(Walker));
146493 sWalker.eCode = bUses;
146494 sWalker.u.pSrcList = pSrc;
146495 sWalker.xExprCallback = exprUsesSrclistCb;
146496 sWalker.xSelectCallback = exprUsesSrclistSelectCb;
146497 return (sqlite3WalkExpr(&sWalker, pExpr)==WRC_Abort);
146498 }
146499
146500 /*
146501 ** Context object used by exprExistsToInIter() as it iterates through an
146502 ** expression tree.
146503 */
146504 struct ExistsToInCtx {
146505 SrcList *pSrc; /* The tables in an EXISTS(SELECT ... FROM <here> ...) */
146506 Expr *pInLhs; /* OUT: Use this as the LHS of the IN operator */
146507 Expr *pEq; /* OUT: The == term that include pInLhs */
146508 Expr **ppAnd; /* OUT: The AND operator that includes pEq as a child */
146509 Expr **ppParent; /* The AND operator currently being examined */
146510 };
146511
146512 /*
146513 ** Iterate through all AND connected nodes in the expression tree
146514 ** headed by (*ppExpr), populating the structure passed as the first
146515 ** argument with the values required by exprAnalyzeExistsFindEq().
146516 **
146517 ** This function returns non-zero if the expression tree does not meet
146518 ** the two conditions described by the header comment for
146519 ** exprAnalyzeExistsFindEq(), or zero if it does.
146520 */
146521 static int exprExistsToInIter(struct ExistsToInCtx *p, Expr **ppExpr){
146522 Expr *pExpr = *ppExpr;
146523 switch( pExpr->op ){
146524 case TK_AND:
146525 p->ppParent = ppExpr;
146526 if( exprExistsToInIter(p, &pExpr->pLeft) ) return 1;
146527 p->ppParent = ppExpr;
146528 if( exprExistsToInIter(p, &pExpr->pRight) ) return 1;
146529 break;
146530 case TK_EQ: {
146531 int bLeft = exprUsesSrclist(p->pSrc, pExpr->pLeft, 0);
146532 int bRight = exprUsesSrclist(p->pSrc, pExpr->pRight, 0);
146533 if( bLeft || bRight ){
146534 if( (bLeft && bRight) || p->pInLhs ) return 1;
146535 p->pInLhs = bLeft ? pExpr->pLeft : pExpr->pRight;
146536 if( exprUsesSrclist(p->pSrc, p->pInLhs, 1) ) return 1;
146537 p->pEq = pExpr;
146538 p->ppAnd = p->ppParent;
146539 }
146540 break;
146541 }
146542 default:
146543 if( exprUsesSrclist(p->pSrc, pExpr, 0) ){
146544 return 1;
146545 }
146546 break;
146547 }
146548
146549 return 0;
146550 }
146551
146552 /*
146553 ** This function is used by exprAnalyzeExists() when creating virtual IN(...)
146554 ** terms equivalent to user-supplied EXIST(...) clauses. It splits the WHERE
146555 ** clause of the Select object passed as the first argument into one or more
146556 ** expressions joined by AND operators, and then tests if the following are
146557 ** true:
146558 **
146559 ** 1. Exactly one of the AND separated terms refers to the outer
146560 ** query, and it is an == (TK_EQ) expression.
146561 **
146562 ** 2. Only one side of the == expression refers to the outer query, and
146563 ** it does not refer to any columns from the inner query.
146564 **
146565 ** If both these conditions are true, then a pointer to the side of the ==
146566 ** expression that refers to the outer query is returned. The caller will
146567 ** use this expression as the LHS of the IN(...) virtual term. Or, if one
146568 ** or both of the above conditions are not true, NULL is returned.
146569 **
146570 ** If non-NULL is returned and ppEq is non-NULL, *ppEq is set to point
146571 ** to the == expression node before returning. If pppAnd is non-NULL and
146572 ** the == node is not the root of the WHERE clause, then *pppAnd is set
146573 ** to point to the pointer to the AND node that is the parent of the ==
146574 ** node within the WHERE expression tree.
146575 */
146576 static Expr *exprAnalyzeExistsFindEq(
146577 Select *pSel, /* The SELECT of the EXISTS */
146578 Expr **ppEq, /* OUT: == node from WHERE clause */
146579 Expr ***pppAnd /* OUT: Pointer to parent of ==, if any */
146580 ){
146581 struct ExistsToInCtx ctx;
146582 memset(&ctx, 0, sizeof(ctx));
146583 ctx.pSrc = pSel->pSrc;
146584 if( exprExistsToInIter(&ctx, &pSel->pWhere) ){
146585 return 0;
146586 }
146587 if( ppEq ) *ppEq = ctx.pEq;
146588 if( pppAnd ) *pppAnd = ctx.ppAnd;
146589 return ctx.pInLhs;
146590 }
146591
146592 /*
146593 ** Term idxTerm of the WHERE clause passed as the second argument is an
146594 ** EXISTS expression with a correlated SELECT statement on the RHS.
146595 ** This function analyzes the SELECT statement, and if possible adds an
146596 ** equivalent "? IN(SELECT...)" virtual term to the WHERE clause.
146597 **
146598 ** For an EXISTS term such as the following:
146599 **
146600 ** EXISTS (SELECT ... FROM <srclist> WHERE <e1> = <e2> AND <e3>)
146601 **
146602 ** The virtual IN() term added is:
146603 **
146604 ** <e1> IN (SELECT <e2> FROM <srclist> WHERE <e3>)
146605 **
146606 ** The virtual term is only added if the following conditions are met:
146607 **
146608 ** 1. The sub-select must not be an aggregate or use window functions,
146609 **
146610 ** 2. The sub-select must not be a compound SELECT,
146611 **
146612 ** 3. Expression <e1> must refer to at least one column from the outer
146613 ** query, and must not refer to any column from the inner query
146614 ** (i.e. from <srclist>).
146615 **
146616 ** 4. <e2> and <e3> must not refer to any values from the outer query.
146617 ** In other words, once <e1> has been removed, the inner query
146618 ** must not be correlated.
146619 **
146620 */
146621 static void exprAnalyzeExists(
146622 SrcList *pSrc, /* the FROM clause */
146623 WhereClause *pWC, /* the WHERE clause */
146624 int idxTerm /* Index of the term to be analyzed */
146625 ){
146626 Parse *pParse = pWC->pWInfo->pParse;
146627 WhereTerm *pTerm = &pWC->a[idxTerm];
146628 Expr *pExpr = pTerm->pExpr;
146629 Select *pSel = pExpr->x.pSelect;
146630 Expr *pDup = 0;
146631 Expr *pEq = 0;
146632 Expr *pRet = 0;
146633 Expr *pInLhs = 0;
146634 Expr **ppAnd = 0;
146635 int idxNew;
146636 sqlite3 *db = pParse->db;
146637
146638 assert( pExpr->op==TK_EXISTS );
146639 assert( (pExpr->flags & EP_VarSelect) && (pExpr->flags & EP_xIsSelect) );
146640
146641 if( (pSel->selFlags & SF_Aggregate) || pSel->pWin ) return;
146642 if( pSel->pPrior ) return;
146643 if( pSel->pWhere==0 ) return;
146644 if( 0==exprAnalyzeExistsFindEq(pSel, 0, 0) ) return;
146645
146646 pDup = sqlite3ExprDup(db, pExpr, 0);
146647 if( db->mallocFailed ){
146648 sqlite3ExprDelete(db, pDup);
146649 return;
146650 }
146651 pSel = pDup->x.pSelect;
146652 sqlite3ExprListDelete(db, pSel->pEList);
146653 pSel->pEList = 0;
146654
146655 pInLhs = exprAnalyzeExistsFindEq(pSel, &pEq, &ppAnd);
146656 assert( pInLhs && pEq );
146657 assert( pEq==pSel->pWhere || ppAnd );
146658 if( pInLhs==pEq->pLeft ){
146659 pRet = pEq->pRight;
146660 }else{
146661 CollSeq *p = sqlite3ExprCompareCollSeq(pParse, pEq);
146662 pInLhs = sqlite3ExprAddCollateString(pParse, pInLhs, p?p->zName:"BINARY");
146663 pRet = pEq->pLeft;
146664 }
146665
146666 assert( pDup->pLeft==0 );
146667 pDup->op = TK_IN;
146668 pDup->pLeft = pInLhs;
146669 pDup->flags &= ~EP_VarSelect;
146670 if( pRet->op==TK_VECTOR ){
146671 pSel->pEList = pRet->x.pList;
146672 pRet->x.pList = 0;
146673 sqlite3ExprDelete(db, pRet);
146674 }else{
146675 pSel->pEList = sqlite3ExprListAppend(pParse, 0, pRet);
146676 }
146677 pEq->pLeft = 0;
146678 pEq->pRight = 0;
146679 if( ppAnd ){
146680 Expr *pAnd = *ppAnd;
146681 Expr *pOther = (pAnd->pLeft==pEq) ? pAnd->pRight : pAnd->pLeft;
146682 pAnd->pLeft = pAnd->pRight = 0;
146683 sqlite3ExprDelete(db, pAnd);
146684 *ppAnd = pOther;
146685 }else{
146686 assert( pSel->pWhere==pEq );
146687 pSel->pWhere = 0;
146688 }
146689 sqlite3ExprDelete(db, pEq);
146690
146691 #ifdef WHERETRACE_ENABLED /* 0x20 */
146692 if( sqlite3WhereTrace & 0x20 ){
146693 sqlite3DebugPrintf("Convert EXISTS:\n");
146694 sqlite3TreeViewExpr(0, pExpr, 0);
146695 sqlite3DebugPrintf("into IN:\n");
146696 sqlite3TreeViewExpr(0, pDup, 0);
146697 }
146698 #endif
146699 idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);
146700 exprAnalyze(pSrc, pWC, idxNew);
146701 markTermAsChild(pWC, idxNew, idxTerm);
146702 pWC->a[idxTerm].wtFlags |= TERM_COPIED;
146703 }
146704
146705 /*
146706 ** The input to this routine is an WhereTerm structure with only the
146707 ** "pExpr" field filled in. The job of this routine is to analyze the
146708 ** subexpression and populate all the other fields of the WhereTerm
@@ -145758,10 +146884,20 @@
146884 assert( pWC->op==TK_AND );
146885 exprAnalyzeOrTerm(pSrc, pWC, idxTerm);
146886 pTerm = &pWC->a[idxTerm];
146887 }
146888 #endif /* SQLITE_OMIT_OR_OPTIMIZATION */
146889
146890 else if( pExpr->op==TK_EXISTS ){
146891 /* Perhaps treat an EXISTS operator as an IN operator */
146892 if( (pExpr->flags & EP_VarSelect)!=0
146893 && OptimizationEnabled(db, SQLITE_ExistsToIN)
146894 ){
146895 exprAnalyzeExists(pSrc, pWC, idxTerm);
146896 }
146897 }
146898
146899
146900 #ifndef SQLITE_OMIT_LIKE_OPTIMIZATION
146901 /* Add constraints to reduce the search space on a LIKE or GLOB
146902 ** operator.
146903 **
@@ -146219,16 +147355,10 @@
147355 Parse *pParse; /* The parsing context */
147356 };
147357
147358 /* Forward declaration of methods */
147359 static int whereLoopResize(sqlite3*, WhereLoop*, int);
 
 
 
 
 
 
147360
147361 /*
147362 ** Return the estimated number of output rows from a WHERE clause
147363 */
147364 SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
@@ -146287,10 +147417,36 @@
147417 }
147418 pInner = &pWInfo->a[pWInfo->nLevel-1];
147419 assert( pInner->addrNxt!=0 );
147420 return pInner->addrNxt;
147421 }
147422
147423 /*
147424 ** While generating code for the min/max optimization, after handling
147425 ** the aggregate-step call to min() or max(), check to see if any
147426 ** additional looping is required. If the output order is such that
147427 ** we are certain that the correct answer has already been found, then
147428 ** code an OP_Goto to by pass subsequent processing.
147429 **
147430 ** Any extra OP_Goto that is coded here is an optimization. The
147431 ** correct answer should be obtained regardless. This OP_Goto just
147432 ** makes the answer appear faster.
147433 */
147434 SQLITE_PRIVATE void sqlite3WhereMinMaxOptEarlyOut(Vdbe *v, WhereInfo *pWInfo){
147435 WhereLevel *pInner;
147436 int i;
147437 if( !pWInfo->bOrderedInnerLoop ) return;
147438 if( pWInfo->nOBSat==0 ) return;
147439 for(i=pWInfo->nLevel-1; i>=0; i--){
147440 pInner = &pWInfo->a[i];
147441 if( (pInner->pWLoop->wsFlags & WHERE_COLUMN_IN)!=0 ){
147442 sqlite3VdbeGoto(v, pInner->addrNxt);
147443 return;
147444 }
147445 }
147446 sqlite3VdbeGoto(v, pWInfo->iBreak);
147447 }
147448
147449 /*
147450 ** Return the VDBE address or label to jump to in order to continue
147451 ** immediately with the next row of a WHERE clause.
147452 */
@@ -148794,11 +149950,11 @@
149950 pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm
149951 );
149952 pBtm = pTerm;
149953 pTop = 0;
149954 if( pTerm->wtFlags & TERM_LIKEOPT ){
149955 /* Range constraints that come from the LIKE optimization are
149956 ** always used in pairs. */
149957 pTop = &pTerm[1];
149958 assert( (pTop-(pTerm->pWC->a))<pTerm->pWC->nTerm );
149959 assert( pTop->wtFlags & TERM_LIKEOPT );
149960 assert( pTop->eOperator==WO_LT );
@@ -155319,22 +156475,22 @@
156475 #define sqlite3ParserCTX_PDECL ,Parse *pParse
156476 #define sqlite3ParserCTX_PARAM ,pParse
156477 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
156478 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
156479 #define YYFALLBACK 1
156480 #define YYNSTATE 558
156481 #define YYNRULE 386
156482 #define YYNRULE_WITH_ACTION 326
156483 #define YYNTOKEN 181
156484 #define YY_MAX_SHIFT 557
156485 #define YY_MIN_SHIFTREDUCE 809
156486 #define YY_MAX_SHIFTREDUCE 1194
156487 #define YY_ERROR_ACTION 1195
156488 #define YY_ACCEPT_ACTION 1196
156489 #define YY_NO_ACTION 1197
156490 #define YY_MIN_REDUCE 1198
156491 #define YY_MAX_REDUCE 1583
156492 /************* End control #defines *******************************************/
156493 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
156494
156495 /* Define the yytestcase() macro to be a no-op if is not already defined
156496 ** otherwise.
@@ -155397,209 +156553,209 @@
156553 ** yy_reduce_ofst[] For each state, the offset into yy_action for
156554 ** shifting non-terminals after a reduce.
156555 ** yy_default[] Default action for each state.
156556 **
156557 *********** Begin parsing tables **********************************************/
156558 #define YY_ACTTAB_COUNT (1968)
156559 static const YYACTIONTYPE yy_action[] = {
156560 /* 0 */ 551, 1229, 551, 456, 1267, 551, 1246, 551, 114, 111,
156561 /* 10 */ 212, 551, 1545, 551, 1267, 528, 114, 111, 212, 396,
156562 /* 20 */ 1239, 348, 42, 42, 42, 42, 1232, 42, 42, 71,
156563 /* 30 */ 71, 943, 1231, 71, 71, 71, 71, 1470, 1501, 944,
156564 /* 40 */ 826, 458, 6, 121, 122, 112, 1172, 1172, 1013, 1016,
156565 /* 50 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 1551, 396,
156566 /* 60 */ 1366, 1525, 557, 2, 1200, 195, 533, 441, 143, 293,
156567 /* 70 */ 533, 136, 533, 375, 262, 509, 273, 389, 1280, 532,
156568 /* 80 */ 508, 498, 165, 121, 122, 112, 1172, 1172, 1013, 1016,
156569 /* 90 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 1366, 447,
156570 /* 100 */ 1522, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156571 /* 110 */ 115, 429, 267, 267, 267, 267, 1506, 362, 1508, 440,
156572 /* 120 */ 361, 1506, 522, 529, 1493, 548, 1121, 548, 1121, 396,
156573 /* 130 */ 410, 242, 209, 114, 111, 212, 98, 292, 542, 222,
156574 /* 140 */ 1036, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156575 /* 150 */ 115, 429, 1149, 121, 122, 112, 1172, 1172, 1013, 1016,
156576 /* 160 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 411, 433,
156577 /* 170 */ 117, 117, 116, 116, 116, 115, 429, 1426, 473, 123,
156578 /* 180 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
156579 /* 190 */ 429, 116, 116, 116, 115, 429, 545, 545, 545, 396,
156580 /* 200 */ 510, 120, 120, 120, 120, 113, 1058, 1149, 1150, 1151,
156581 /* 210 */ 1058, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156582 /* 220 */ 115, 429, 1469, 121, 122, 112, 1172, 1172, 1013, 1016,
156583 /* 230 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 396, 449,
156584 /* 240 */ 320, 83, 468, 81, 363, 386, 1149, 80, 118, 118,
156585 /* 250 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 180,
156586 /* 260 */ 439, 429, 121, 122, 112, 1172, 1172, 1013, 1016, 1006,
156587 /* 270 */ 1006, 119, 119, 120, 120, 120, 120, 439, 438, 267,
156588 /* 280 */ 267, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156589 /* 290 */ 115, 429, 548, 1116, 909, 511, 1149, 114, 111, 212,
156590 /* 300 */ 1439, 1149, 1150, 1151, 207, 496, 1116, 396, 454, 1116,
156591 /* 310 */ 550, 334, 120, 120, 120, 120, 300, 1439, 1441, 17,
156592 /* 320 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
156593 /* 330 */ 429, 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006,
156594 /* 340 */ 119, 119, 120, 120, 120, 120, 396, 1366, 439, 1149,
156595 /* 350 */ 487, 1149, 1150, 1151, 1003, 1003, 1014, 1017, 406, 118,
156596 /* 360 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 429,
156597 /* 370 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156598 /* 380 */ 119, 120, 120, 120, 120, 1061, 1061, 470, 1439, 118,
156599 /* 390 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 429,
156600 /* 400 */ 1149, 456, 551, 1434, 1149, 1150, 1151, 234, 973, 1149,
156601 /* 410 */ 486, 483, 482, 172, 364, 396, 165, 412, 419, 848,
156602 /* 420 */ 481, 165, 186, 338, 71, 71, 1250, 1007, 118, 118,
156603 /* 430 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 121,
156604 /* 440 */ 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119, 119,
156605 /* 450 */ 120, 120, 120, 120, 396, 1149, 1150, 1151, 841, 12,
156606 /* 460 */ 318, 514, 164, 360, 1149, 1150, 1151, 114, 111, 212,
156607 /* 470 */ 513, 292, 542, 551, 277, 181, 292, 542, 121, 122,
156608 /* 480 */ 112, 1172, 1172, 1013, 1016, 1006, 1006, 119, 119, 120,
156609 /* 490 */ 120, 120, 120, 349, 489, 71, 71, 118, 118, 118,
156610 /* 500 */ 118, 117, 117, 116, 116, 116, 115, 429, 1149, 210,
156611 /* 510 */ 416, 528, 1149, 1116, 1579, 382, 253, 270, 346, 492,
156612 /* 520 */ 341, 491, 239, 396, 518, 368, 1116, 1134, 337, 1116,
156613 /* 530 */ 192, 414, 288, 32, 462, 448, 118, 118, 118, 118,
156614 /* 540 */ 117, 117, 116, 116, 116, 115, 429, 121, 122, 112,
156615 /* 550 */ 1172, 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120,
156616 /* 560 */ 120, 120, 396, 1149, 1150, 1151, 994, 1149, 1150, 1151,
156617 /* 570 */ 1149, 234, 497, 1500, 486, 483, 482, 6, 164, 551,
156618 /* 580 */ 517, 551, 115, 429, 481, 5, 121, 122, 112, 1172,
156619 /* 590 */ 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120,
156620 /* 600 */ 120, 13, 13, 13, 13, 118, 118, 118, 118, 117,
156621 /* 610 */ 117, 116, 116, 116, 115, 429, 408, 507, 413, 551,
156622 /* 620 */ 1494, 549, 1149, 898, 898, 1149, 1150, 1151, 1481, 1149,
156623 /* 630 */ 276, 396, 814, 815, 816, 978, 427, 427, 427, 16,
156624 /* 640 */ 16, 55, 55, 1249, 118, 118, 118, 118, 117, 117,
156625 /* 650 */ 116, 116, 116, 115, 429, 121, 122, 112, 1172, 1172,
156626 /* 660 */ 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120, 120,
156627 /* 670 */ 396, 1196, 1, 1, 557, 2, 1200, 1149, 1150, 1151,
156628 /* 680 */ 195, 293, 904, 136, 1149, 1150, 1151, 903, 526, 1500,
156629 /* 690 */ 1280, 3, 384, 6, 121, 122, 112, 1172, 1172, 1013,
156630 /* 700 */ 1016, 1006, 1006, 119, 119, 120, 120, 120, 120, 864,
156631 /* 710 */ 551, 930, 551, 118, 118, 118, 118, 117, 117, 116,
156632 /* 720 */ 116, 116, 115, 429, 267, 267, 1099, 1577, 1149, 556,
156633 /* 730 */ 1577, 1200, 13, 13, 13, 13, 293, 548, 136, 396,
156634 /* 740 */ 490, 426, 425, 973, 348, 1280, 473, 415, 865, 281,
156635 /* 750 */ 140, 222, 118, 118, 118, 118, 117, 117, 116, 116,
156636 /* 760 */ 116, 115, 429, 121, 122, 112, 1172, 1172, 1013, 1016,
156637 /* 770 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 551, 267,
156638 /* 780 */ 267, 433, 396, 1149, 1150, 1151, 1179, 836, 1179, 473,
156639 /* 790 */ 436, 145, 548, 1153, 405, 318, 444, 304, 844, 1498,
156640 /* 800 */ 71, 71, 417, 6, 1097, 478, 222, 100, 112, 1172,
156641 /* 810 */ 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120,
156642 /* 820 */ 120, 118, 118, 118, 118, 117, 117, 116, 116, 116,
156643 /* 830 */ 115, 429, 238, 1433, 551, 456, 433, 289, 993, 551,
156644 /* 840 */ 237, 236, 235, 836, 97, 534, 434, 1272, 1272, 1153,
156645 /* 850 */ 499, 309, 435, 844, 984, 551, 71, 71, 983, 1248,
156646 /* 860 */ 551, 51, 51, 302, 118, 118, 118, 118, 117, 117,
156647 /* 870 */ 116, 116, 116, 115, 429, 195, 103, 70, 70, 267,
156648 /* 880 */ 267, 551, 71, 71, 267, 267, 30, 395, 348, 983,
156649 /* 890 */ 983, 985, 548, 533, 1116, 332, 396, 548, 500, 401,
156650 /* 900 */ 460, 196, 535, 13, 13, 1366, 241, 1116, 278, 282,
156651 /* 910 */ 1116, 282, 306, 462, 308, 337, 396, 31, 189, 424,
156652 /* 920 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156653 /* 930 */ 119, 120, 120, 120, 120, 142, 396, 369, 456, 993,
156654 /* 940 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156655 /* 950 */ 119, 120, 120, 120, 120, 984, 327, 1149, 330, 983,
156656 /* 960 */ 121, 110, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
156657 /* 970 */ 119, 120, 120, 120, 120, 469, 381, 1192, 118, 118,
156658 /* 980 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 1149,
156659 /* 990 */ 983, 983, 985, 307, 9, 461, 245, 462, 118, 118,
156660 /* 1000 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 317,
156661 /* 1010 */ 551, 279, 1149, 1150, 1151, 301, 292, 542, 118, 118,
156662 /* 1020 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 1270,
156663 /* 1030 */ 1270, 1170, 13, 13, 531, 426, 425, 473, 396, 929,
156664 /* 1040 */ 261, 261, 97, 1176, 1149, 1150, 1151, 190, 1178, 267,
156665 /* 1050 */ 267, 473, 138, 548, 1193, 551, 1177, 264, 348, 494,
156666 /* 1060 */ 928, 551, 548, 122, 112, 1172, 1172, 1013, 1016, 1006,
156667 /* 1070 */ 1006, 119, 119, 120, 120, 120, 120, 71, 71, 1149,
156668 /* 1080 */ 1179, 1279, 1179, 13, 13, 904, 1077, 1170, 551, 473,
156669 /* 1090 */ 903, 107, 543, 280, 4, 1275, 1116, 450, 530, 1056,
156670 /* 1100 */ 12, 1078, 1099, 1578, 316, 144, 1578, 525, 546, 1116,
156671 /* 1110 */ 56, 56, 1116, 1499, 428, 1366, 1079, 6, 349, 970,
156672 /* 1120 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
156673 /* 1130 */ 429, 430, 1278, 325, 1149, 1150, 1151, 884, 267, 267,
156674 /* 1140 */ 855, 107, 543, 540, 4, 1497, 238, 885, 1218, 6,
156675 /* 1150 */ 211, 548, 370, 165, 366, 501, 421, 1496, 546, 268,
156676 /* 1160 */ 268, 6, 1550, 516, 504, 873, 267, 267, 400, 536,
156677 /* 1170 */ 8, 993, 548, 524, 551, 928, 463, 105, 105, 548,
156678 /* 1180 */ 1097, 430, 267, 267, 106, 422, 430, 553, 552, 267,
156679 /* 1190 */ 267, 983, 523, 540, 1381, 548, 15, 15, 267, 267,
156680 /* 1200 */ 1478, 1127, 548, 267, 267, 1077, 1380, 520, 292, 542,
156681 /* 1210 */ 551, 548, 519, 401, 449, 320, 548, 551, 928, 125,
156682 /* 1220 */ 1078, 993, 983, 983, 985, 986, 27, 105, 105, 405,
156683 /* 1230 */ 347, 1519, 44, 44, 106, 1079, 430, 553, 552, 57,
156684 /* 1240 */ 57, 983, 347, 1519, 107, 543, 551, 4, 467, 405,
156685 /* 1250 */ 215, 1127, 464, 295, 381, 1098, 539, 296, 551, 1221,
156686 /* 1260 */ 402, 546, 544, 402, 299, 245, 292, 542, 58, 58,
156687 /* 1270 */ 551, 1284, 983, 983, 985, 986, 27, 1524, 1138, 432,
156688 /* 1280 */ 59, 59, 271, 548, 430, 403, 166, 379, 379, 378,
156689 /* 1290 */ 256, 376, 60, 60, 823, 1187, 540, 551, 274, 551,
156690 /* 1300 */ 1170, 851, 393, 392, 551, 205, 551, 216, 211, 298,
156691 /* 1310 */ 520, 1303, 551, 266, 209, 521, 1316, 297, 275, 61,
156692 /* 1320 */ 61, 62, 62, 451, 993, 205, 45, 45, 46, 46,
156693 /* 1330 */ 105, 105, 1193, 928, 47, 47, 291, 106, 551, 430,
156694 /* 1340 */ 553, 552, 943, 551, 983, 313, 394, 218, 551, 109,
156695 /* 1350 */ 944, 107, 543, 219, 4, 156, 1170, 851, 158, 551,
156696 /* 1360 */ 49, 49, 104, 551, 102, 50, 50, 551, 546, 1315,
156697 /* 1370 */ 63, 63, 551, 443, 217, 983, 983, 985, 986, 27,
156698 /* 1380 */ 1484, 64, 64, 551, 310, 65, 65, 551, 1458, 14,
156699 /* 1390 */ 14, 430, 1457, 551, 66, 66, 1094, 551, 1169, 383,
156700 /* 1400 */ 141, 551, 38, 540, 269, 127, 127, 551, 397, 67,
156701 /* 1410 */ 67, 551, 465, 292, 542, 52, 52, 520, 551, 68,
156702 /* 1420 */ 68, 1043, 519, 69, 69, 315, 95, 322, 97, 53,
156703 /* 1430 */ 53, 993, 975, 151, 151, 244, 437, 105, 105, 200,
156704 /* 1440 */ 152, 152, 455, 1312, 106, 244, 430, 553, 552, 1138,
156705 /* 1450 */ 432, 983, 457, 271, 321, 244, 326, 97, 379, 379,
156706 /* 1460 */ 378, 256, 376, 863, 862, 823, 531, 551, 221, 551,
156707 /* 1470 */ 107, 543, 551, 4, 551, 329, 479, 1043, 216, 240,
156708 /* 1480 */ 298, 331, 983, 983, 985, 986, 27, 546, 297, 76,
156709 /* 1490 */ 76, 54, 54, 333, 72, 72, 128, 128, 870, 871,
156710 /* 1500 */ 107, 543, 551, 4, 1263, 551, 946, 947, 1247, 551,
156711 /* 1510 */ 430, 551, 200, 1055, 551, 1055, 551, 546, 218, 551,
156712 /* 1520 */ 335, 1538, 540, 97, 73, 73, 156, 129, 129, 158,
156713 /* 1530 */ 340, 130, 130, 126, 126, 350, 150, 150, 149, 149,
156714 /* 1540 */ 430, 134, 134, 345, 1039, 217, 937, 240, 901, 244,
156715 /* 1550 */ 993, 109, 540, 344, 987, 551, 105, 105, 908, 351,
156716 /* 1560 */ 551, 1513, 1054, 106, 1054, 430, 553, 552, 551, 1324,
156717 /* 1570 */ 983, 834, 99, 543, 139, 4, 551, 133, 133, 397,
156718 /* 1580 */ 993, 1365, 131, 131, 292, 542, 105, 105, 1299, 546,
156719 /* 1590 */ 132, 132, 287, 106, 1310, 430, 553, 552, 75, 75,
156720 /* 1600 */ 983, 983, 983, 985, 986, 27, 551, 437, 902, 537,
156721 /* 1610 */ 987, 109, 430, 259, 551, 538, 1371, 1228, 474, 551,
156722 /* 1620 */ 198, 551, 1220, 1209, 540, 1208, 1210, 1532, 77, 77,
156723 /* 1630 */ 202, 983, 983, 985, 986, 27, 74, 74, 1296, 353,
156724 /* 1640 */ 355, 43, 43, 48, 48, 357, 11, 380, 214, 343,
156725 /* 1650 */ 303, 442, 993, 312, 305, 1360, 314, 484, 105, 105,
156726 /* 1660 */ 459, 1246, 319, 206, 1430, 106, 1429, 430, 553, 552,
156727 /* 1670 */ 359, 541, 983, 271, 1535, 1187, 168, 248, 379, 379,
156728 /* 1680 */ 378, 256, 376, 201, 193, 823, 373, 194, 1477, 1475,
156729 /* 1690 */ 1184, 79, 404, 82, 83, 453, 178, 95, 216, 1349,
156730 /* 1700 */ 298, 162, 1435, 983, 983, 985, 986, 27, 297, 1354,
156731 /* 1710 */ 1346, 35, 170, 445, 446, 477, 173, 174, 175, 176,
156732 /* 1720 */ 385, 224, 1358, 1361, 1357, 466, 387, 36, 182, 452,
156733 /* 1730 */ 388, 1424, 228, 88, 472, 260, 230, 1446, 218, 187,
156734 /* 1740 */ 475, 328, 231, 390, 324, 1211, 156, 232, 493, 158,
156735 /* 1750 */ 418, 90, 1257, 1266, 1549, 1265, 1264, 855, 1256, 207,
156736 /* 1760 */ 420, 512, 1307, 1548, 94, 217, 352, 391, 1236, 1235,
156737 /* 1770 */ 342, 1234, 1547, 1518, 354, 285, 503, 286, 506, 246,
156738 /* 1780 */ 247, 1504, 1503, 423, 1308, 124, 531, 1306, 356, 10,
156739 /* 1790 */ 1305, 367, 1331, 101, 290, 96, 254, 515, 1217, 397,
156740 /* 1800 */ 34, 554, 1144, 255, 292, 542, 257, 372, 1289, 365,
156741 /* 1810 */ 371, 358, 1288, 197, 258, 555, 1206, 1201, 1462, 153,
156742 /* 1820 */ 1463, 1330, 1461, 154, 137, 283, 1460, 437, 155, 203,
156743 /* 1830 */ 810, 204, 78, 431, 1410, 199, 294, 213, 272, 135,
156744 /* 1840 */ 1053, 1051, 966, 157, 169, 220, 171, 887, 311, 223,
156745 /* 1850 */ 1067, 177, 159, 160, 407, 84, 409, 179, 85, 86,
156746 /* 1860 */ 87, 161, 1070, 225, 1066, 398, 167, 399, 18, 226,
156747 /* 1870 */ 146, 227, 323, 244, 1181, 471, 229, 1059, 183, 184,
156748 /* 1880 */ 37, 825, 344, 476, 233, 336, 488, 480, 185, 89,
156749 /* 1890 */ 19, 20, 485, 92, 853, 339, 91, 163, 866, 147,
156750 /* 1900 */ 284, 495, 502, 1132, 148, 1019, 936, 1102, 39, 93,
156751 /* 1910 */ 1103, 40, 505, 263, 208, 265, 188, 931, 1122, 243,
156752 /* 1920 */ 1126, 109, 33, 1120, 1118, 21, 1106, 22, 527, 1034,
156753 /* 1930 */ 23, 24, 1125, 25, 191, 97, 26, 1020, 1018, 1022,
156754 /* 1940 */ 1076, 250, 7, 1075, 249, 1023, 28, 41, 547, 988,
156755 /* 1950 */ 835, 108, 29, 251, 252, 1540, 374, 897, 377, 1140,
156756 /* 1960 */ 1139, 1197, 1197, 1197, 1197, 1197, 1197, 1539,
156757 };
156758 static const YYCODETYPE yy_lookahead[] = {
156759 /* 0 */ 189, 211, 189, 189, 218, 189, 220, 189, 267, 268,
156760 /* 10 */ 269, 189, 210, 189, 228, 189, 267, 268, 269, 19,
156761 /* 20 */ 218, 189, 211, 212, 211, 212, 211, 211, 212, 211,
@@ -155688,117 +156844,117 @@
156844 /* 850 */ 200, 16, 189, 114, 115, 189, 211, 212, 119, 221,
156845 /* 860 */ 189, 211, 212, 258, 101, 102, 103, 104, 105, 106,
156846 /* 870 */ 107, 108, 109, 110, 111, 189, 156, 211, 212, 234,
156847 /* 880 */ 235, 189, 211, 212, 234, 235, 22, 201, 189, 150,
156848 /* 890 */ 151, 152, 247, 248, 76, 16, 19, 247, 248, 113,
156849 /* 900 */ 19, 24, 257, 211, 212, 189, 26, 89, 262, 223,
156850 /* 910 */ 92, 225, 77, 189, 79, 129, 19, 53, 226, 248,
156851 /* 920 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
156852 /* 930 */ 53, 54, 55, 56, 57, 236, 19, 271, 189, 99,
156853 /* 940 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
156854 /* 950 */ 53, 54, 55, 56, 57, 115, 77, 59, 79, 119,
156855 /* 960 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
156856 /* 970 */ 53, 54, 55, 56, 57, 259, 22, 23, 101, 102,
156857 /* 980 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 59,
156858 /* 990 */ 150, 151, 152, 158, 22, 114, 24, 189, 101, 102,
156859 /* 1000 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 285,
156860 /* 1010 */ 189, 262, 114, 115, 116, 200, 136, 137, 101, 102,
156861 /* 1020 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 230,
156862 /* 1030 */ 231, 59, 211, 212, 143, 105, 106, 189, 19, 141,
156863 /* 1040 */ 234, 235, 26, 113, 114, 115, 116, 226, 118, 234,
156864 /* 1050 */ 235, 189, 161, 247, 100, 189, 126, 23, 189, 107,
156865 /* 1060 */ 26, 189, 247, 44, 45, 46, 47, 48, 49, 50,
156866 /* 1070 */ 51, 52, 53, 54, 55, 56, 57, 211, 212, 59,
156867 /* 1080 */ 150, 233, 152, 211, 212, 133, 12, 115, 189, 189,
156868 /* 1090 */ 138, 19, 20, 285, 22, 233, 76, 127, 226, 11,
156869 /* 1100 */ 208, 27, 22, 23, 200, 236, 26, 87, 36, 89,
156870 /* 1110 */ 211, 212, 92, 300, 248, 189, 42, 304, 189, 149,
156871 /* 1120 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
156872 /* 1130 */ 111, 59, 200, 233, 114, 115, 116, 63, 234, 235,
156873 /* 1140 */ 124, 19, 20, 71, 22, 300, 46, 73, 200, 304,
156874 /* 1150 */ 116, 247, 244, 81, 246, 200, 227, 300, 36, 234,
156875 /* 1160 */ 235, 304, 23, 143, 200, 26, 234, 235, 194, 200,
156876 /* 1170 */ 48, 99, 247, 66, 189, 141, 284, 105, 106, 247,
156877 /* 1180 */ 100, 59, 234, 235, 112, 259, 114, 115, 116, 234,
156878 /* 1190 */ 235, 119, 85, 71, 266, 247, 211, 212, 234, 235,
156879 /* 1200 */ 189, 94, 247, 234, 235, 12, 266, 85, 136, 137,
156880 /* 1210 */ 189, 247, 90, 113, 126, 127, 247, 189, 26, 22,
156881 /* 1220 */ 27, 99, 150, 151, 152, 153, 154, 105, 106, 189,
156882 /* 1230 */ 302, 303, 211, 212, 112, 42, 114, 115, 116, 211,
156883 /* 1240 */ 212, 119, 302, 303, 19, 20, 189, 22, 274, 189,
156884 /* 1250 */ 15, 144, 278, 189, 22, 23, 63, 189, 189, 203,
156885 /* 1260 */ 204, 36, 203, 204, 189, 24, 136, 137, 211, 212,
156886 /* 1270 */ 189, 235, 150, 151, 152, 153, 154, 0, 1, 2,
156887 /* 1280 */ 211, 212, 5, 247, 59, 292, 293, 10, 11, 12,
156888 /* 1290 */ 13, 14, 211, 212, 17, 60, 71, 189, 258, 189,
156889 /* 1300 */ 59, 59, 105, 106, 189, 26, 189, 30, 116, 32,
156890 /* 1310 */ 85, 253, 189, 251, 252, 90, 189, 40, 258, 211,
156891 /* 1320 */ 212, 211, 212, 127, 99, 26, 211, 212, 211, 212,
156892 /* 1330 */ 105, 106, 100, 141, 211, 212, 239, 112, 189, 114,
156893 /* 1340 */ 115, 116, 31, 189, 119, 149, 249, 70, 189, 26,
156894 /* 1350 */ 39, 19, 20, 24, 22, 78, 115, 115, 81, 189,
156895 /* 1360 */ 211, 212, 155, 189, 157, 211, 212, 189, 36, 189,
156896 /* 1370 */ 211, 212, 189, 189, 97, 150, 151, 152, 153, 154,
156897 /* 1380 */ 189, 211, 212, 189, 189, 211, 212, 189, 189, 211,
156898 /* 1390 */ 212, 59, 189, 189, 211, 212, 23, 189, 26, 26,
156899 /* 1400 */ 22, 189, 24, 71, 22, 211, 212, 189, 131, 211,
156900 /* 1410 */ 212, 189, 189, 136, 137, 211, 212, 85, 189, 211,
156901 /* 1420 */ 212, 59, 90, 211, 212, 23, 147, 189, 26, 211,
156902 /* 1430 */ 212, 99, 23, 211, 212, 26, 159, 105, 106, 140,
156903 /* 1440 */ 211, 212, 23, 189, 112, 26, 114, 115, 116, 1,
156904 /* 1450 */ 2, 119, 23, 5, 23, 26, 189, 26, 10, 11,
156905 /* 1460 */ 12, 13, 14, 118, 119, 17, 143, 189, 139, 189,
156906 /* 1470 */ 19, 20, 189, 22, 189, 189, 23, 115, 30, 26,
156907 /* 1480 */ 32, 189, 150, 151, 152, 153, 154, 36, 40, 211,
156908 /* 1490 */ 212, 211, 212, 189, 211, 212, 211, 212, 7, 8,
156909 /* 1500 */ 19, 20, 189, 22, 189, 189, 83, 84, 189, 189,
156910 /* 1510 */ 59, 189, 140, 150, 189, 152, 189, 36, 70, 189,
156911 /* 1520 */ 23, 139, 71, 26, 211, 212, 78, 211, 212, 81,
156912 /* 1530 */ 189, 211, 212, 211, 212, 189, 211, 212, 211, 212,
156913 /* 1540 */ 59, 211, 212, 119, 23, 97, 23, 26, 23, 26,
156914 /* 1550 */ 99, 26, 71, 129, 59, 189, 105, 106, 107, 189,
156915 /* 1560 */ 189, 309, 150, 112, 152, 114, 115, 116, 189, 189,
156916 /* 1570 */ 119, 23, 19, 20, 26, 22, 189, 211, 212, 131,
156917 /* 1580 */ 99, 189, 211, 212, 136, 137, 105, 106, 189, 36,
156918 /* 1590 */ 211, 212, 250, 112, 189, 114, 115, 116, 211, 212,
156919 /* 1600 */ 119, 150, 151, 152, 153, 154, 189, 159, 23, 189,
156920 /* 1610 */ 115, 26, 59, 280, 189, 231, 189, 189, 281, 189,
156921 /* 1620 */ 237, 189, 189, 189, 71, 189, 189, 189, 211, 212,
156922 /* 1630 */ 209, 150, 151, 152, 153, 154, 211, 212, 250, 250,
156923 /* 1640 */ 250, 211, 212, 211, 212, 250, 238, 187, 290, 214,
156924 /* 1650 */ 240, 254, 99, 286, 254, 241, 241, 215, 105, 106,
156925 /* 1660 */ 286, 220, 240, 224, 214, 112, 214, 114, 115, 116,
156926 /* 1670 */ 254, 273, 119, 5, 192, 60, 290, 139, 10, 11,
156927 /* 1680 */ 12, 13, 14, 238, 244, 17, 240, 244, 196, 196,
156928 /* 1690 */ 38, 287, 196, 287, 148, 113, 22, 147, 30, 241,
156929 /* 1700 */ 32, 43, 276, 150, 151, 152, 153, 154, 40, 265,
156930 /* 1710 */ 241, 264, 229, 18, 196, 18, 232, 232, 232, 232,
156931 /* 1720 */ 241, 195, 265, 229, 265, 196, 265, 264, 229, 241,
156932 /* 1730 */ 241, 241, 195, 155, 62, 196, 195, 283, 70, 22,
156933 /* 1740 */ 216, 196, 195, 216, 282, 196, 78, 195, 113, 81,
156934 /* 1750 */ 64, 22, 222, 213, 219, 213, 213, 124, 222, 162,
156935 /* 1760 */ 111, 142, 256, 219, 113, 97, 255, 216, 213, 215,
156936 /* 1770 */ 213, 213, 213, 303, 255, 275, 216, 275, 216, 196,
156937 /* 1780 */ 91, 308, 308, 82, 256, 146, 143, 256, 255, 22,
156938 /* 1790 */ 256, 196, 260, 155, 272, 145, 25, 144, 199, 131,
156939 /* 1800 */ 26, 198, 13, 190, 136, 137, 190, 241, 245, 244,
156940 /* 1810 */ 242, 255, 245, 243, 6, 188, 188, 188, 208, 202,
156941 /* 1820 */ 208, 260, 208, 202, 217, 217, 208, 159, 202, 209,
156942 /* 1830 */ 4, 209, 208, 3, 270, 22, 160, 15, 98, 16,
156943 /* 1840 */ 23, 23, 137, 128, 148, 24, 140, 20, 16, 142,
156944 /* 1850 */ 1, 140, 128, 128, 61, 53, 37, 148, 53, 53,
156945 /* 1860 */ 53, 128, 114, 34, 1, 296, 293, 296, 22, 139,
156946 /* 1870 */ 5, 113, 158, 26, 75, 41, 139, 68, 68, 113,
156947 /* 1880 */ 24, 20, 129, 19, 123, 23, 96, 67, 22, 22,
156948 /* 1890 */ 22, 22, 67, 147, 59, 24, 22, 37, 28, 23,
156949 /* 1900 */ 67, 22, 24, 23, 23, 23, 114, 23, 22, 26,
156950 /* 1910 */ 23, 22, 24, 23, 139, 23, 22, 141, 75, 34,
156951 /* 1920 */ 75, 26, 22, 86, 88, 34, 23, 34, 24, 23,
156952 /* 1930 */ 34, 34, 93, 34, 26, 26, 34, 23, 23, 23,
156953 /* 1940 */ 23, 22, 44, 23, 26, 11, 22, 22, 26, 23,
156954 /* 1950 */ 23, 22, 22, 139, 139, 139, 23, 133, 15, 1,
156955 /* 1960 */ 1, 310, 310, 310, 310, 310, 310, 139, 310, 310,
156956 /* 1970 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156957 /* 1980 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156958 /* 1990 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156959 /* 2000 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156960 /* 2010 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
@@ -155812,15 +156968,15 @@
156968 /* 2090 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156969 /* 2100 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156970 /* 2110 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156971 /* 2120 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156972 /* 2130 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
156973 /* 2140 */ 310, 310, 310, 310, 310, 310, 310, 310, 310,
156974 };
156975 #define YY_SHIFT_COUNT (557)
156976 #define YY_SHIFT_MIN (0)
156977 #define YY_SHIFT_MAX (1959)
156978 static const unsigned short int yy_shift_ofst[] = {
156979 /* 0 */ 1448, 1277, 1668, 1072, 1072, 340, 1122, 1225, 1332, 1481,
156980 /* 10 */ 1481, 1481, 335, 0, 0, 180, 897, 1481, 1481, 1481,
156981 /* 20 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
156982 /* 30 */ 930, 930, 1020, 1020, 290, 1, 340, 340, 340, 340,
@@ -155833,55 +156989,55 @@
156989 /* 100 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
156990 /* 110 */ 1481, 1481, 1553, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
156991 /* 120 */ 1481, 1481, 1481, 1481, 1481, 1481, 147, 258, 258, 258,
156992 /* 130 */ 258, 258, 79, 65, 84, 449, 19, 786, 449, 636,
156993 /* 140 */ 636, 449, 880, 880, 880, 880, 113, 142, 142, 472,
156994 /* 150 */ 150, 1968, 1968, 399, 399, 399, 93, 237, 341, 237,
156995 /* 160 */ 237, 237, 1074, 1074, 437, 350, 704, 1080, 449, 449,
156996 /* 170 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 449,
156997 /* 180 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 818,
156998 /* 190 */ 818, 449, 1088, 217, 217, 734, 734, 891, 1130, 1968,
156999 /* 200 */ 1968, 1968, 739, 840, 840, 453, 454, 511, 187, 563,
157000 /* 210 */ 570, 898, 669, 449, 449, 449, 449, 449, 449, 449,
157001 /* 220 */ 449, 449, 670, 449, 449, 449, 449, 449, 449, 449,
157002 /* 230 */ 449, 449, 449, 449, 449, 674, 674, 674, 449, 449,
157003 /* 240 */ 449, 449, 1034, 449, 449, 449, 972, 1107, 449, 449,
157004 /* 250 */ 1193, 449, 449, 449, 449, 449, 449, 449, 449, 260,
157005 /* 260 */ 177, 489, 1241, 1241, 1241, 1241, 1192, 489, 489, 952,
157006 /* 270 */ 1197, 625, 1235, 1299, 181, 181, 881, 1279, 1279, 1299,
157007 /* 280 */ 881, 1016, 1139, 1100, 1311, 1311, 1311, 181, 1323, 1323,
157008 /* 290 */ 1207, 1372, 549, 1378, 1615, 1538, 1538, 1652, 1652, 1538,
157009 /* 300 */ 1546, 1582, 1674, 1550, 1658, 1550, 1695, 1695, 1695, 1695,
157010 /* 310 */ 1538, 1697, 1550, 1582, 1582, 1550, 1582, 1674, 1658, 1550,
157011 /* 320 */ 1658, 1550, 1538, 1697, 1578, 1672, 1538, 1697, 1717, 1538,
157012 /* 330 */ 1697, 1538, 1697, 1717, 1635, 1635, 1635, 1686, 1729, 1729,
157013 /* 340 */ 1717, 1635, 1633, 1635, 1686, 1635, 1635, 1597, 1717, 1649,
157014 /* 350 */ 1649, 1717, 1619, 1651, 1619, 1651, 1619, 1651, 1619, 1651,
157015 /* 360 */ 1538, 1689, 1689, 1701, 1701, 1639, 1643, 1767, 1538, 1638,
157016 /* 370 */ 1639, 1650, 1653, 1550, 1771, 1774, 1789, 1789, 1808, 1808,
157017 /* 380 */ 1808, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968,
157018 /* 390 */ 1968, 1968, 1968, 1968, 1968, 1968, 308, 835, 954, 1232,
157019 /* 400 */ 879, 715, 728, 1373, 864, 1329, 970, 1196, 1402, 297,
157020 /* 410 */ 1409, 1419, 1429, 1431, 1453, 1497, 1242, 1345, 1491, 1424,
157021 /* 420 */ 1362, 1521, 1523, 1423, 1525, 1363, 1412, 1548, 1585, 1495,
157022 /* 430 */ 1382, 1826, 1830, 1813, 1676, 1822, 1740, 1823, 1817, 1818,
157023 /* 440 */ 1705, 1696, 1715, 1821, 1706, 1827, 1707, 1832, 1849, 1711,
157024 /* 450 */ 1724, 1725, 1793, 1819, 1709, 1802, 1805, 1806, 1807, 1733,
157025 /* 460 */ 1748, 1829, 1730, 1863, 1865, 1846, 1758, 1714, 1809, 1847,
157026 /* 470 */ 1810, 1799, 1834, 1737, 1766, 1856, 1861, 1864, 1753, 1761,
157027 /* 480 */ 1866, 1820, 1867, 1868, 1862, 1869, 1825, 1835, 1871, 1790,
157028 /* 490 */ 1870, 1874, 1833, 1860, 1876, 1746, 1879, 1880, 1881, 1882,
157029 /* 500 */ 1883, 1884, 1886, 1878, 1887, 1889, 1888, 1775, 1890, 1892,
157030 /* 510 */ 1792, 1885, 1894, 1776, 1895, 1891, 1893, 1896, 1897, 1836,
157031 /* 520 */ 1843, 1837, 1898, 1845, 1839, 1899, 1903, 1900, 1904, 1908,
157032 /* 530 */ 1909, 1902, 1906, 1895, 1914, 1915, 1916, 1917, 1918, 1920,
157033 /* 540 */ 1919, 1934, 1924, 1925, 1926, 1927, 1929, 1930, 1922, 1824,
157034 /* 550 */ 1814, 1815, 1816, 1828, 1933, 1943, 1958, 1959,
157035 };
157036 #define YY_REDUCE_COUNT (395)
157037 #define YY_REDUCE_MIN (-262)
157038 #define YY_REDUCE_MAX (1629)
157039 static const short yy_reduce_ofst[] = {
157040 /* 0 */ 490, -122, 545, 645, 650, -120, -189, -187, -184, -182,
157041 /* 10 */ -178, -176, 45, 30, 200, -251, -134, 390, 392, 521,
157042 /* 20 */ 523, 213, 692, 821, 284, 589, 872, 666, 671, 866,
157043 /* 30 */ 71, 111, 273, 389, 686, 815, 904, 932, 948, 955,
@@ -155895,92 +157051,92 @@
157051 /* 110 */ 1285, 1313, 1316, 1320, 1322, 1325, 1327, 1330, 1366, 1371,
157052 /* 120 */ 1379, 1387, 1417, 1425, 1430, 1432, -259, -259, -259, -259,
157053 /* 130 */ -259, -259, -259, -259, -259, 557, 974, -214, -174, -9,
157054 /* 140 */ 431, -124, 806, 925, 806, 925, 251, 928, 940, -259,
157055 /* 150 */ -259, -259, -259, -198, -198, -198, 127, -186, -168, 212,
157056 /* 160 */ 646, 749, 617, 799, -262, 555, 220, 220, 491, 605,
157057 /* 170 */ 1040, 1060, 699, -11, 600, 848, 862, 345, -129, 724,
157058 /* 180 */ -91, 158, 808, 716, 900, 304, 869, 929, 926, 499,
157059 /* 190 */ 813, 322, 892, 845, 857, 1056, 1059, 908, 1036, 993,
157060 /* 200 */ 1062, 1097, -210, -185, -179, -148, -167, -89, 121, 274,
157061 /* 210 */ 281, 320, 336, 439, 663, 1011, 1064, 1068, 1075, 1127,
157062 /* 220 */ 1180, 1184, -196, 1191, 1195, 1199, 1203, 1223, 1238, 1254,
157063 /* 230 */ 1267, 1286, 1292, 1304, 1315, 205, 422, 638, 1319, 1341,
157064 /* 240 */ 1346, 1370, 1058, 1380, 1392, 1399, 1342, 1252, 1405, 1420,
157065 /* 250 */ 1384, 1427, 121, 1428, 1433, 1434, 1436, 1437, 1438, 1337,
157066 /* 260 */ 1333, 1383, 1388, 1389, 1390, 1395, 1058, 1383, 1383, 1408,
157067 /* 270 */ 1421, 1460, 1358, 1410, 1397, 1400, 1367, 1414, 1415, 1422,
157068 /* 280 */ 1374, 1442, 1439, 1441, 1435, 1450, 1452, 1416, 1440, 1443,
157069 /* 290 */ 1398, 1446, 1445, 1482, 1386, 1492, 1493, 1404, 1406, 1496,
157070 /* 300 */ 1426, 1444, 1447, 1458, 1483, 1469, 1484, 1485, 1486, 1487,
157071 /* 310 */ 1518, 1526, 1479, 1457, 1459, 1488, 1461, 1463, 1494, 1489,
157072 /* 320 */ 1499, 1490, 1529, 1537, 1454, 1462, 1539, 1541, 1524, 1545,
157073 /* 330 */ 1547, 1549, 1552, 1527, 1540, 1542, 1543, 1530, 1535, 1544,
157074 /* 340 */ 1551, 1555, 1554, 1557, 1536, 1558, 1559, 1470, 1560, 1500,
157075 /* 350 */ 1502, 1562, 1506, 1511, 1528, 1519, 1531, 1533, 1534, 1556,
157076 /* 360 */ 1583, 1473, 1474, 1532, 1561, 1563, 1565, 1564, 1595, 1522,
157077 /* 370 */ 1567, 1570, 1568, 1566, 1599, 1603, 1613, 1616, 1627, 1628,
157078 /* 380 */ 1629, 1569, 1571, 1573, 1617, 1610, 1612, 1614, 1618, 1621,
157079 /* 390 */ 1607, 1608, 1620, 1622, 1624, 1626,
157080 };
157081 static const YYACTIONTYPE yy_default[] = {
157082 /* 0 */ 1583, 1583, 1583, 1419, 1195, 1304, 1195, 1195, 1195, 1419,
157083 /* 10 */ 1419, 1419, 1195, 1334, 1334, 1472, 1226, 1195, 1195, 1195,
157084 /* 20 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1418, 1195, 1195,
157085 /* 30 */ 1195, 1195, 1502, 1502, 1195, 1195, 1195, 1195, 1195, 1195,
157086 /* 40 */ 1195, 1195, 1195, 1343, 1195, 1195, 1195, 1195, 1195, 1195,
157087 /* 50 */ 1420, 1421, 1195, 1195, 1195, 1471, 1473, 1436, 1353, 1352,
157088 /* 60 */ 1351, 1350, 1454, 1321, 1348, 1341, 1345, 1414, 1415, 1413,
157089 /* 70 */ 1417, 1421, 1420, 1195, 1344, 1385, 1399, 1384, 1195, 1195,
157090 /* 80 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157091 /* 90 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157092 /* 100 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157093 /* 110 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157094 /* 120 */ 1195, 1195, 1195, 1195, 1195, 1195, 1393, 1398, 1404, 1397,
157095 /* 130 */ 1394, 1387, 1386, 1388, 1389, 1195, 1216, 1268, 1195, 1195,
157096 /* 140 */ 1195, 1195, 1490, 1489, 1195, 1195, 1226, 1379, 1378, 1390,
157097 /* 150 */ 1391, 1401, 1400, 1479, 1537, 1536, 1437, 1195, 1195, 1195,
157098 /* 160 */ 1195, 1195, 1195, 1195, 1502, 1195, 1195, 1195, 1195, 1195,
157099 /* 170 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157100 /* 180 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1502,
157101 /* 190 */ 1502, 1195, 1226, 1502, 1502, 1222, 1222, 1328, 1195, 1485,
157102 /* 200 */ 1304, 1295, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157103 /* 210 */ 1195, 1195, 1195, 1195, 1195, 1195, 1476, 1474, 1195, 1195,
157104 /* 220 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157105 /* 230 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157106 /* 240 */ 1195, 1195, 1195, 1195, 1195, 1195, 1300, 1195, 1195, 1195,
157107 /* 250 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1531, 1195,
157108 /* 260 */ 1449, 1282, 1300, 1300, 1300, 1300, 1302, 1283, 1281, 1294,
157109 /* 270 */ 1227, 1202, 1575, 1301, 1323, 1323, 1572, 1347, 1347, 1301,
157110 /* 280 */ 1572, 1243, 1553, 1238, 1334, 1334, 1334, 1323, 1328, 1328,
157111 /* 290 */ 1416, 1301, 1294, 1195, 1575, 1309, 1309, 1574, 1574, 1309,
157112 /* 300 */ 1437, 1356, 1363, 1347, 1271, 1347, 1277, 1277, 1277, 1277,
157113 /* 310 */ 1309, 1213, 1347, 1356, 1356, 1347, 1356, 1363, 1271, 1347,
157114 /* 320 */ 1271, 1347, 1309, 1213, 1453, 1569, 1309, 1213, 1427, 1309,
157115 /* 330 */ 1213, 1309, 1213, 1427, 1269, 1269, 1269, 1258, 1195, 1195,
157116 /* 340 */ 1427, 1269, 1243, 1269, 1258, 1269, 1269, 1520, 1427, 1431,
157117 /* 350 */ 1431, 1427, 1327, 1322, 1327, 1322, 1327, 1322, 1327, 1322,
157118 /* 360 */ 1309, 1512, 1512, 1337, 1337, 1342, 1328, 1422, 1309, 1195,
157119 /* 370 */ 1342, 1340, 1338, 1347, 1219, 1261, 1534, 1534, 1530, 1530,
157120 /* 380 */ 1530, 1580, 1580, 1485, 1546, 1226, 1226, 1226, 1226, 1546,
157121 /* 390 */ 1245, 1245, 1227, 1227, 1226, 1546, 1195, 1195, 1195, 1195,
157122 /* 400 */ 1195, 1195, 1541, 1195, 1438, 1313, 1195, 1195, 1195, 1195,
157123 /* 410 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157124 /* 420 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157125 /* 430 */ 1368, 1195, 1198, 1482, 1195, 1195, 1480, 1195, 1195, 1195,
157126 /* 440 */ 1195, 1195, 1195, 1314, 1195, 1195, 1195, 1195, 1195, 1195,
157127 /* 450 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157128 /* 460 */ 1195, 1195, 1571, 1195, 1195, 1195, 1195, 1195, 1195, 1452,
157129 /* 470 */ 1451, 1195, 1195, 1311, 1195, 1195, 1195, 1195, 1195, 1195,
157130 /* 480 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1241, 1195, 1195,
157131 /* 490 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157132 /* 500 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
157133 /* 510 */ 1195, 1195, 1195, 1195, 1339, 1195, 1195, 1195, 1195, 1195,
157134 /* 520 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1517,
157135 /* 530 */ 1329, 1195, 1195, 1562, 1195, 1195, 1195, 1195, 1195, 1195,
157136 /* 540 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1557, 1285,
157137 /* 550 */ 1370, 1195, 1369, 1373, 1195, 1207, 1195, 1195,
157138 };
157139 /********** End of lemon-generated parsing tables *****************************/
157140
157141 /* The next table maps tokens (terminal symbols) into fallback tokens.
157142 ** If a construct like the following:
@@ -156741,236 +157897,237 @@
157897 /* 154 */ "setlist ::= nm EQ expr",
157898 /* 155 */ "setlist ::= LP idlist RP EQ expr",
157899 /* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
157900 /* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
157901 /* 158 */ "upsert ::=",
157902 /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert",
157903 /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert",
157904 /* 161 */ "upsert ::= ON CONFLICT DO NOTHING",
157905 /* 162 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt",
157906 /* 163 */ "insert_cmd ::= INSERT orconf",
157907 /* 164 */ "insert_cmd ::= REPLACE",
157908 /* 165 */ "idlist_opt ::=",
157909 /* 166 */ "idlist_opt ::= LP idlist RP",
157910 /* 167 */ "idlist ::= idlist COMMA nm",
157911 /* 168 */ "idlist ::= nm",
157912 /* 169 */ "expr ::= LP expr RP",
157913 /* 170 */ "expr ::= ID|INDEXED",
157914 /* 171 */ "expr ::= JOIN_KW",
157915 /* 172 */ "expr ::= nm DOT nm",
157916 /* 173 */ "expr ::= nm DOT nm DOT nm",
157917 /* 174 */ "term ::= NULL|FLOAT|BLOB",
157918 /* 175 */ "term ::= STRING",
157919 /* 176 */ "term ::= INTEGER",
157920 /* 177 */ "expr ::= VARIABLE",
157921 /* 178 */ "expr ::= expr COLLATE ID|STRING",
157922 /* 179 */ "expr ::= CAST LP expr AS typetoken RP",
157923 /* 180 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
157924 /* 181 */ "expr ::= ID|INDEXED LP STAR RP",
157925 /* 182 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
157926 /* 183 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
157927 /* 184 */ "term ::= CTIME_KW",
157928 /* 185 */ "expr ::= LP nexprlist COMMA expr RP",
157929 /* 186 */ "expr ::= expr AND expr",
157930 /* 187 */ "expr ::= expr OR expr",
157931 /* 188 */ "expr ::= expr LT|GT|GE|LE expr",
157932 /* 189 */ "expr ::= expr EQ|NE expr",
157933 /* 190 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
157934 /* 191 */ "expr ::= expr PLUS|MINUS expr",
157935 /* 192 */ "expr ::= expr STAR|SLASH|REM expr",
157936 /* 193 */ "expr ::= expr CONCAT expr",
157937 /* 194 */ "likeop ::= NOT LIKE_KW|MATCH",
157938 /* 195 */ "expr ::= expr likeop expr",
157939 /* 196 */ "expr ::= expr likeop expr ESCAPE expr",
157940 /* 197 */ "expr ::= expr ISNULL|NOTNULL",
157941 /* 198 */ "expr ::= expr NOT NULL",
157942 /* 199 */ "expr ::= expr IS expr",
157943 /* 200 */ "expr ::= expr IS NOT expr",
157944 /* 201 */ "expr ::= NOT expr",
157945 /* 202 */ "expr ::= BITNOT expr",
157946 /* 203 */ "expr ::= PLUS|MINUS expr",
157947 /* 204 */ "between_op ::= BETWEEN",
157948 /* 205 */ "between_op ::= NOT BETWEEN",
157949 /* 206 */ "expr ::= expr between_op expr AND expr",
157950 /* 207 */ "in_op ::= IN",
157951 /* 208 */ "in_op ::= NOT IN",
157952 /* 209 */ "expr ::= expr in_op LP exprlist RP",
157953 /* 210 */ "expr ::= LP select RP",
157954 /* 211 */ "expr ::= expr in_op LP select RP",
157955 /* 212 */ "expr ::= expr in_op nm dbnm paren_exprlist",
157956 /* 213 */ "expr ::= EXISTS LP select RP",
157957 /* 214 */ "expr ::= CASE case_operand case_exprlist case_else END",
157958 /* 215 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
157959 /* 216 */ "case_exprlist ::= WHEN expr THEN expr",
157960 /* 217 */ "case_else ::= ELSE expr",
157961 /* 218 */ "case_else ::=",
157962 /* 219 */ "case_operand ::= expr",
157963 /* 220 */ "case_operand ::=",
157964 /* 221 */ "exprlist ::=",
157965 /* 222 */ "nexprlist ::= nexprlist COMMA expr",
157966 /* 223 */ "nexprlist ::= expr",
157967 /* 224 */ "paren_exprlist ::=",
157968 /* 225 */ "paren_exprlist ::= LP exprlist RP",
157969 /* 226 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
157970 /* 227 */ "uniqueflag ::= UNIQUE",
157971 /* 228 */ "uniqueflag ::=",
157972 /* 229 */ "eidlist_opt ::=",
157973 /* 230 */ "eidlist_opt ::= LP eidlist RP",
157974 /* 231 */ "eidlist ::= eidlist COMMA nm collate sortorder",
157975 /* 232 */ "eidlist ::= nm collate sortorder",
157976 /* 233 */ "collate ::=",
157977 /* 234 */ "collate ::= COLLATE ID|STRING",
157978 /* 235 */ "cmd ::= DROP INDEX ifexists fullname",
157979 /* 236 */ "cmd ::= VACUUM vinto",
157980 /* 237 */ "cmd ::= VACUUM nm vinto",
157981 /* 238 */ "vinto ::= INTO expr",
157982 /* 239 */ "vinto ::=",
157983 /* 240 */ "cmd ::= PRAGMA nm dbnm",
157984 /* 241 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
157985 /* 242 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
157986 /* 243 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
157987 /* 244 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
157988 /* 245 */ "plus_num ::= PLUS INTEGER|FLOAT",
157989 /* 246 */ "minus_num ::= MINUS INTEGER|FLOAT",
157990 /* 247 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
157991 /* 248 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
157992 /* 249 */ "trigger_time ::= BEFORE|AFTER",
157993 /* 250 */ "trigger_time ::= INSTEAD OF",
157994 /* 251 */ "trigger_time ::=",
157995 /* 252 */ "trigger_event ::= DELETE|INSERT",
157996 /* 253 */ "trigger_event ::= UPDATE",
157997 /* 254 */ "trigger_event ::= UPDATE OF idlist",
157998 /* 255 */ "when_clause ::=",
157999 /* 256 */ "when_clause ::= WHEN expr",
158000 /* 257 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
158001 /* 258 */ "trigger_cmd_list ::= trigger_cmd SEMI",
158002 /* 259 */ "trnm ::= nm DOT nm",
158003 /* 260 */ "tridxby ::= INDEXED BY nm",
158004 /* 261 */ "tridxby ::= NOT INDEXED",
158005 /* 262 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
158006 /* 263 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
158007 /* 264 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
158008 /* 265 */ "trigger_cmd ::= scanpt select scanpt",
158009 /* 266 */ "expr ::= RAISE LP IGNORE RP",
158010 /* 267 */ "expr ::= RAISE LP raisetype COMMA nm RP",
158011 /* 268 */ "raisetype ::= ROLLBACK",
158012 /* 269 */ "raisetype ::= ABORT",
158013 /* 270 */ "raisetype ::= FAIL",
158014 /* 271 */ "cmd ::= DROP TRIGGER ifexists fullname",
158015 /* 272 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
158016 /* 273 */ "cmd ::= DETACH database_kw_opt expr",
158017 /* 274 */ "key_opt ::=",
158018 /* 275 */ "key_opt ::= KEY expr",
158019 /* 276 */ "cmd ::= REINDEX",
158020 /* 277 */ "cmd ::= REINDEX nm dbnm",
158021 /* 278 */ "cmd ::= ANALYZE",
158022 /* 279 */ "cmd ::= ANALYZE nm dbnm",
158023 /* 280 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
158024 /* 281 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
158025 /* 282 */ "add_column_fullname ::= fullname",
158026 /* 283 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
158027 /* 284 */ "cmd ::= create_vtab",
158028 /* 285 */ "cmd ::= create_vtab LP vtabarglist RP",
158029 /* 286 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
158030 /* 287 */ "vtabarg ::=",
158031 /* 288 */ "vtabargtoken ::= ANY",
158032 /* 289 */ "vtabargtoken ::= lp anylist RP",
158033 /* 290 */ "lp ::= LP",
158034 /* 291 */ "with ::= WITH wqlist",
158035 /* 292 */ "with ::= WITH RECURSIVE wqlist",
158036 /* 293 */ "wqlist ::= nm eidlist_opt AS LP select RP",
158037 /* 294 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
158038 /* 295 */ "windowdefn_list ::= windowdefn",
158039 /* 296 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
158040 /* 297 */ "windowdefn ::= nm AS LP window RP",
158041 /* 298 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
158042 /* 299 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
158043 /* 300 */ "window ::= ORDER BY sortlist frame_opt",
158044 /* 301 */ "window ::= nm ORDER BY sortlist frame_opt",
158045 /* 302 */ "window ::= frame_opt",
158046 /* 303 */ "window ::= nm frame_opt",
158047 /* 304 */ "frame_opt ::=",
158048 /* 305 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
158049 /* 306 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
158050 /* 307 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
158051 /* 308 */ "frame_bound_s ::= frame_bound",
158052 /* 309 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
158053 /* 310 */ "frame_bound_e ::= frame_bound",
158054 /* 311 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
158055 /* 312 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
158056 /* 313 */ "frame_bound ::= CURRENT ROW",
158057 /* 314 */ "frame_exclude_opt ::=",
158058 /* 315 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
158059 /* 316 */ "frame_exclude ::= NO OTHERS",
158060 /* 317 */ "frame_exclude ::= CURRENT ROW",
158061 /* 318 */ "frame_exclude ::= GROUP|TIES",
158062 /* 319 */ "window_clause ::= WINDOW windowdefn_list",
158063 /* 320 */ "filter_over ::= filter_clause over_clause",
158064 /* 321 */ "filter_over ::= over_clause",
158065 /* 322 */ "filter_over ::= filter_clause",
158066 /* 323 */ "over_clause ::= OVER LP window RP",
158067 /* 324 */ "over_clause ::= OVER nm",
158068 /* 325 */ "filter_clause ::= FILTER LP WHERE expr RP",
158069 /* 326 */ "input ::= cmdlist",
158070 /* 327 */ "cmdlist ::= cmdlist ecmd",
158071 /* 328 */ "cmdlist ::= ecmd",
158072 /* 329 */ "ecmd ::= SEMI",
158073 /* 330 */ "ecmd ::= cmdx SEMI",
158074 /* 331 */ "ecmd ::= explain cmdx SEMI",
158075 /* 332 */ "trans_opt ::=",
158076 /* 333 */ "trans_opt ::= TRANSACTION",
158077 /* 334 */ "trans_opt ::= TRANSACTION nm",
158078 /* 335 */ "savepoint_opt ::= SAVEPOINT",
158079 /* 336 */ "savepoint_opt ::=",
158080 /* 337 */ "cmd ::= create_table create_table_args",
158081 /* 338 */ "columnlist ::= columnlist COMMA columnname carglist",
158082 /* 339 */ "columnlist ::= columnname carglist",
158083 /* 340 */ "nm ::= ID|INDEXED",
158084 /* 341 */ "nm ::= STRING",
158085 /* 342 */ "nm ::= JOIN_KW",
158086 /* 343 */ "typetoken ::= typename",
158087 /* 344 */ "typename ::= ID|STRING",
158088 /* 345 */ "signed ::= plus_num",
158089 /* 346 */ "signed ::= minus_num",
158090 /* 347 */ "carglist ::= carglist ccons",
158091 /* 348 */ "carglist ::=",
158092 /* 349 */ "ccons ::= NULL onconf",
158093 /* 350 */ "ccons ::= GENERATED ALWAYS AS generated",
158094 /* 351 */ "ccons ::= AS generated",
158095 /* 352 */ "conslist_opt ::= COMMA conslist",
158096 /* 353 */ "conslist ::= conslist tconscomma tcons",
158097 /* 354 */ "conslist ::= tcons",
158098 /* 355 */ "tconscomma ::=",
158099 /* 356 */ "defer_subclause_opt ::= defer_subclause",
158100 /* 357 */ "resolvetype ::= raisetype",
158101 /* 358 */ "selectnowith ::= oneselect",
158102 /* 359 */ "oneselect ::= values",
158103 /* 360 */ "sclp ::= selcollist COMMA",
158104 /* 361 */ "as ::= ID|STRING",
158105 /* 362 */ "expr ::= term",
158106 /* 363 */ "likeop ::= LIKE_KW|MATCH",
158107 /* 364 */ "exprlist ::= nexprlist",
158108 /* 365 */ "nmnum ::= plus_num",
158109 /* 366 */ "nmnum ::= nm",
158110 /* 367 */ "nmnum ::= ON",
158111 /* 368 */ "nmnum ::= DELETE",
158112 /* 369 */ "nmnum ::= DEFAULT",
158113 /* 370 */ "plus_num ::= INTEGER|FLOAT",
158114 /* 371 */ "foreach_clause ::=",
158115 /* 372 */ "foreach_clause ::= FOR EACH ROW",
158116 /* 373 */ "trnm ::= nm",
158117 /* 374 */ "tridxby ::=",
158118 /* 375 */ "database_kw_opt ::= DATABASE",
158119 /* 376 */ "database_kw_opt ::=",
158120 /* 377 */ "kwcolumn_opt ::=",
158121 /* 378 */ "kwcolumn_opt ::= COLUMNKW",
158122 /* 379 */ "vtabarglist ::= vtabarg",
158123 /* 380 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
158124 /* 381 */ "vtabarg ::= vtabarg vtabargtoken",
158125 /* 382 */ "anylist ::=",
158126 /* 383 */ "anylist ::= anylist LP anylist RP",
158127 /* 384 */ "anylist ::= anylist ANY",
158128 /* 385 */ "with ::=",
158129 };
158130 #endif /* NDEBUG */
158131
158132
158133 #if YYSTACKDEPTH<=0
@@ -157633,236 +158790,237 @@
158790 262, /* (154) setlist ::= nm EQ expr */
158791 262, /* (155) setlist ::= LP idlist RP EQ expr */
158792 186, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
158793 186, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
158794 265, /* (158) upsert ::= */
158795 265, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
158796 265, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
158797 265, /* (161) upsert ::= ON CONFLICT DO NOTHING */
158798 265, /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
158799 263, /* (163) insert_cmd ::= INSERT orconf */
158800 263, /* (164) insert_cmd ::= REPLACE */
158801 264, /* (165) idlist_opt ::= */
158802 264, /* (166) idlist_opt ::= LP idlist RP */
158803 259, /* (167) idlist ::= idlist COMMA nm */
158804 259, /* (168) idlist ::= nm */
158805 212, /* (169) expr ::= LP expr RP */
158806 212, /* (170) expr ::= ID|INDEXED */
158807 212, /* (171) expr ::= JOIN_KW */
158808 212, /* (172) expr ::= nm DOT nm */
158809 212, /* (173) expr ::= nm DOT nm DOT nm */
158810 211, /* (174) term ::= NULL|FLOAT|BLOB */
158811 211, /* (175) term ::= STRING */
158812 211, /* (176) term ::= INTEGER */
158813 212, /* (177) expr ::= VARIABLE */
158814 212, /* (178) expr ::= expr COLLATE ID|STRING */
158815 212, /* (179) expr ::= CAST LP expr AS typetoken RP */
158816 212, /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
158817 212, /* (181) expr ::= ID|INDEXED LP STAR RP */
158818 212, /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
158819 212, /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
158820 211, /* (184) term ::= CTIME_KW */
158821 212, /* (185) expr ::= LP nexprlist COMMA expr RP */
158822 212, /* (186) expr ::= expr AND expr */
158823 212, /* (187) expr ::= expr OR expr */
158824 212, /* (188) expr ::= expr LT|GT|GE|LE expr */
158825 212, /* (189) expr ::= expr EQ|NE expr */
158826 212, /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
158827 212, /* (191) expr ::= expr PLUS|MINUS expr */
158828 212, /* (192) expr ::= expr STAR|SLASH|REM expr */
158829 212, /* (193) expr ::= expr CONCAT expr */
158830 267, /* (194) likeop ::= NOT LIKE_KW|MATCH */
158831 212, /* (195) expr ::= expr likeop expr */
158832 212, /* (196) expr ::= expr likeop expr ESCAPE expr */
158833 212, /* (197) expr ::= expr ISNULL|NOTNULL */
158834 212, /* (198) expr ::= expr NOT NULL */
158835 212, /* (199) expr ::= expr IS expr */
158836 212, /* (200) expr ::= expr IS NOT expr */
158837 212, /* (201) expr ::= NOT expr */
158838 212, /* (202) expr ::= BITNOT expr */
158839 212, /* (203) expr ::= PLUS|MINUS expr */
158840 268, /* (204) between_op ::= BETWEEN */
158841 268, /* (205) between_op ::= NOT BETWEEN */
158842 212, /* (206) expr ::= expr between_op expr AND expr */
158843 269, /* (207) in_op ::= IN */
158844 269, /* (208) in_op ::= NOT IN */
158845 212, /* (209) expr ::= expr in_op LP exprlist RP */
158846 212, /* (210) expr ::= LP select RP */
158847 212, /* (211) expr ::= expr in_op LP select RP */
158848 212, /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
158849 212, /* (213) expr ::= EXISTS LP select RP */
158850 212, /* (214) expr ::= CASE case_operand case_exprlist case_else END */
158851 272, /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
158852 272, /* (216) case_exprlist ::= WHEN expr THEN expr */
158853 273, /* (217) case_else ::= ELSE expr */
158854 273, /* (218) case_else ::= */
158855 271, /* (219) case_operand ::= expr */
158856 271, /* (220) case_operand ::= */
158857 257, /* (221) exprlist ::= */
158858 248, /* (222) nexprlist ::= nexprlist COMMA expr */
158859 248, /* (223) nexprlist ::= expr */
158860 270, /* (224) paren_exprlist ::= */
158861 270, /* (225) paren_exprlist ::= LP exprlist RP */
158862 186, /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
158863 274, /* (227) uniqueflag ::= UNIQUE */
158864 274, /* (228) uniqueflag ::= */
158865 216, /* (229) eidlist_opt ::= */
158866 216, /* (230) eidlist_opt ::= LP eidlist RP */
158867 227, /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
158868 227, /* (232) eidlist ::= nm collate sortorder */
158869 275, /* (233) collate ::= */
158870 275, /* (234) collate ::= COLLATE ID|STRING */
158871 186, /* (235) cmd ::= DROP INDEX ifexists fullname */
158872 186, /* (236) cmd ::= VACUUM vinto */
158873 186, /* (237) cmd ::= VACUUM nm vinto */
158874 276, /* (238) vinto ::= INTO expr */
158875 276, /* (239) vinto ::= */
158876 186, /* (240) cmd ::= PRAGMA nm dbnm */
158877 186, /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
158878 186, /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
158879 186, /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
158880 186, /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
158881 206, /* (245) plus_num ::= PLUS INTEGER|FLOAT */
158882 207, /* (246) minus_num ::= MINUS INTEGER|FLOAT */
158883 186, /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
158884 278, /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
158885 280, /* (249) trigger_time ::= BEFORE|AFTER */
158886 280, /* (250) trigger_time ::= INSTEAD OF */
158887 280, /* (251) trigger_time ::= */
158888 281, /* (252) trigger_event ::= DELETE|INSERT */
158889 281, /* (253) trigger_event ::= UPDATE */
158890 281, /* (254) trigger_event ::= UPDATE OF idlist */
158891 283, /* (255) when_clause ::= */
158892 283, /* (256) when_clause ::= WHEN expr */
158893 279, /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
158894 279, /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
158895 285, /* (259) trnm ::= nm DOT nm */
158896 286, /* (260) tridxby ::= INDEXED BY nm */
158897 286, /* (261) tridxby ::= NOT INDEXED */
158898 284, /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
158899 284, /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
158900 284, /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
158901 284, /* (265) trigger_cmd ::= scanpt select scanpt */
158902 212, /* (266) expr ::= RAISE LP IGNORE RP */
158903 212, /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
158904 231, /* (268) raisetype ::= ROLLBACK */
158905 231, /* (269) raisetype ::= ABORT */
158906 231, /* (270) raisetype ::= FAIL */
158907 186, /* (271) cmd ::= DROP TRIGGER ifexists fullname */
158908 186, /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
158909 186, /* (273) cmd ::= DETACH database_kw_opt expr */
158910 288, /* (274) key_opt ::= */
158911 288, /* (275) key_opt ::= KEY expr */
158912 186, /* (276) cmd ::= REINDEX */
158913 186, /* (277) cmd ::= REINDEX nm dbnm */
158914 186, /* (278) cmd ::= ANALYZE */
158915 186, /* (279) cmd ::= ANALYZE nm dbnm */
158916 186, /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
158917 186, /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
158918 289, /* (282) add_column_fullname ::= fullname */
158919 186, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
158920 186, /* (284) cmd ::= create_vtab */
158921 186, /* (285) cmd ::= create_vtab LP vtabarglist RP */
158922 291, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
158923 293, /* (287) vtabarg ::= */
158924 294, /* (288) vtabargtoken ::= ANY */
158925 294, /* (289) vtabargtoken ::= lp anylist RP */
158926 295, /* (290) lp ::= LP */
158927 261, /* (291) with ::= WITH wqlist */
158928 261, /* (292) with ::= WITH RECURSIVE wqlist */
158929 236, /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
158930 236, /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
158931 297, /* (295) windowdefn_list ::= windowdefn */
158932 297, /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
158933 298, /* (297) windowdefn ::= nm AS LP window RP */
158934 299, /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
158935 299, /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
158936 299, /* (300) window ::= ORDER BY sortlist frame_opt */
158937 299, /* (301) window ::= nm ORDER BY sortlist frame_opt */
158938 299, /* (302) window ::= frame_opt */
158939 299, /* (303) window ::= nm frame_opt */
158940 300, /* (304) frame_opt ::= */
158941 300, /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
158942 300, /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
158943 304, /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
158944 306, /* (308) frame_bound_s ::= frame_bound */
158945 306, /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
158946 307, /* (310) frame_bound_e ::= frame_bound */
158947 307, /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
158948 305, /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
158949 305, /* (313) frame_bound ::= CURRENT ROW */
158950 308, /* (314) frame_exclude_opt ::= */
158951 308, /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
158952 309, /* (316) frame_exclude ::= NO OTHERS */
158953 309, /* (317) frame_exclude ::= CURRENT ROW */
158954 309, /* (318) frame_exclude ::= GROUP|TIES */
158955 246, /* (319) window_clause ::= WINDOW windowdefn_list */
158956 266, /* (320) filter_over ::= filter_clause over_clause */
158957 266, /* (321) filter_over ::= over_clause */
158958 266, /* (322) filter_over ::= filter_clause */
158959 303, /* (323) over_clause ::= OVER LP window RP */
158960 303, /* (324) over_clause ::= OVER nm */
158961 302, /* (325) filter_clause ::= FILTER LP WHERE expr RP */
158962 181, /* (326) input ::= cmdlist */
158963 182, /* (327) cmdlist ::= cmdlist ecmd */
158964 182, /* (328) cmdlist ::= ecmd */
158965 183, /* (329) ecmd ::= SEMI */
158966 183, /* (330) ecmd ::= cmdx SEMI */
158967 183, /* (331) ecmd ::= explain cmdx SEMI */
158968 188, /* (332) trans_opt ::= */
158969 188, /* (333) trans_opt ::= TRANSACTION */
158970 188, /* (334) trans_opt ::= TRANSACTION nm */
158971 190, /* (335) savepoint_opt ::= SAVEPOINT */
158972 190, /* (336) savepoint_opt ::= */
158973 186, /* (337) cmd ::= create_table create_table_args */
158974 197, /* (338) columnlist ::= columnlist COMMA columnname carglist */
158975 197, /* (339) columnlist ::= columnname carglist */
158976 189, /* (340) nm ::= ID|INDEXED */
158977 189, /* (341) nm ::= STRING */
158978 189, /* (342) nm ::= JOIN_KW */
158979 203, /* (343) typetoken ::= typename */
158980 204, /* (344) typename ::= ID|STRING */
158981 205, /* (345) signed ::= plus_num */
158982 205, /* (346) signed ::= minus_num */
158983 202, /* (347) carglist ::= carglist ccons */
158984 202, /* (348) carglist ::= */
158985 210, /* (349) ccons ::= NULL onconf */
158986 210, /* (350) ccons ::= GENERATED ALWAYS AS generated */
158987 210, /* (351) ccons ::= AS generated */
158988 198, /* (352) conslist_opt ::= COMMA conslist */
158989 223, /* (353) conslist ::= conslist tconscomma tcons */
158990 223, /* (354) conslist ::= tcons */
158991 224, /* (355) tconscomma ::= */
158992 228, /* (356) defer_subclause_opt ::= defer_subclause */
158993 230, /* (357) resolvetype ::= raisetype */
158994 234, /* (358) selectnowith ::= oneselect */
158995 235, /* (359) oneselect ::= values */
158996 249, /* (360) sclp ::= selcollist COMMA */
158997 250, /* (361) as ::= ID|STRING */
158998 212, /* (362) expr ::= term */
158999 267, /* (363) likeop ::= LIKE_KW|MATCH */
159000 257, /* (364) exprlist ::= nexprlist */
159001 277, /* (365) nmnum ::= plus_num */
159002 277, /* (366) nmnum ::= nm */
159003 277, /* (367) nmnum ::= ON */
159004 277, /* (368) nmnum ::= DELETE */
159005 277, /* (369) nmnum ::= DEFAULT */
159006 206, /* (370) plus_num ::= INTEGER|FLOAT */
159007 282, /* (371) foreach_clause ::= */
159008 282, /* (372) foreach_clause ::= FOR EACH ROW */
159009 285, /* (373) trnm ::= nm */
159010 286, /* (374) tridxby ::= */
159011 287, /* (375) database_kw_opt ::= DATABASE */
159012 287, /* (376) database_kw_opt ::= */
159013 290, /* (377) kwcolumn_opt ::= */
159014 290, /* (378) kwcolumn_opt ::= COLUMNKW */
159015 292, /* (379) vtabarglist ::= vtabarg */
159016 292, /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
159017 293, /* (381) vtabarg ::= vtabarg vtabargtoken */
159018 296, /* (382) anylist ::= */
159019 296, /* (383) anylist ::= anylist LP anylist RP */
159020 296, /* (384) anylist ::= anylist ANY */
159021 261, /* (385) with ::= */
159022 };
159023
159024 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
159025 ** of symbols on the right-hand side of that rule. */
159026 static const signed char yyRuleInfoNRhs[] = {
@@ -158023,236 +159181,237 @@
159181 -3, /* (154) setlist ::= nm EQ expr */
159182 -5, /* (155) setlist ::= LP idlist RP EQ expr */
159183 -7, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
159184 -7, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
159185 0, /* (158) upsert ::= */
159186 -12, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
159187 -9, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
159188 -4, /* (161) upsert ::= ON CONFLICT DO NOTHING */
159189 -7, /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
159190 -2, /* (163) insert_cmd ::= INSERT orconf */
159191 -1, /* (164) insert_cmd ::= REPLACE */
159192 0, /* (165) idlist_opt ::= */
159193 -3, /* (166) idlist_opt ::= LP idlist RP */
159194 -3, /* (167) idlist ::= idlist COMMA nm */
159195 -1, /* (168) idlist ::= nm */
159196 -3, /* (169) expr ::= LP expr RP */
159197 -1, /* (170) expr ::= ID|INDEXED */
159198 -1, /* (171) expr ::= JOIN_KW */
159199 -3, /* (172) expr ::= nm DOT nm */
159200 -5, /* (173) expr ::= nm DOT nm DOT nm */
159201 -1, /* (174) term ::= NULL|FLOAT|BLOB */
159202 -1, /* (175) term ::= STRING */
159203 -1, /* (176) term ::= INTEGER */
159204 -1, /* (177) expr ::= VARIABLE */
159205 -3, /* (178) expr ::= expr COLLATE ID|STRING */
159206 -6, /* (179) expr ::= CAST LP expr AS typetoken RP */
159207 -5, /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
159208 -4, /* (181) expr ::= ID|INDEXED LP STAR RP */
159209 -6, /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159210 -5, /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
159211 -1, /* (184) term ::= CTIME_KW */
159212 -5, /* (185) expr ::= LP nexprlist COMMA expr RP */
159213 -3, /* (186) expr ::= expr AND expr */
159214 -3, /* (187) expr ::= expr OR expr */
159215 -3, /* (188) expr ::= expr LT|GT|GE|LE expr */
159216 -3, /* (189) expr ::= expr EQ|NE expr */
159217 -3, /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
159218 -3, /* (191) expr ::= expr PLUS|MINUS expr */
159219 -3, /* (192) expr ::= expr STAR|SLASH|REM expr */
159220 -3, /* (193) expr ::= expr CONCAT expr */
159221 -2, /* (194) likeop ::= NOT LIKE_KW|MATCH */
159222 -3, /* (195) expr ::= expr likeop expr */
159223 -5, /* (196) expr ::= expr likeop expr ESCAPE expr */
159224 -2, /* (197) expr ::= expr ISNULL|NOTNULL */
159225 -3, /* (198) expr ::= expr NOT NULL */
159226 -3, /* (199) expr ::= expr IS expr */
159227 -4, /* (200) expr ::= expr IS NOT expr */
159228 -2, /* (201) expr ::= NOT expr */
159229 -2, /* (202) expr ::= BITNOT expr */
159230 -2, /* (203) expr ::= PLUS|MINUS expr */
159231 -1, /* (204) between_op ::= BETWEEN */
159232 -2, /* (205) between_op ::= NOT BETWEEN */
159233 -5, /* (206) expr ::= expr between_op expr AND expr */
159234 -1, /* (207) in_op ::= IN */
159235 -2, /* (208) in_op ::= NOT IN */
159236 -5, /* (209) expr ::= expr in_op LP exprlist RP */
159237 -3, /* (210) expr ::= LP select RP */
159238 -5, /* (211) expr ::= expr in_op LP select RP */
159239 -5, /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
159240 -4, /* (213) expr ::= EXISTS LP select RP */
159241 -5, /* (214) expr ::= CASE case_operand case_exprlist case_else END */
159242 -5, /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
159243 -4, /* (216) case_exprlist ::= WHEN expr THEN expr */
159244 -2, /* (217) case_else ::= ELSE expr */
159245 0, /* (218) case_else ::= */
159246 -1, /* (219) case_operand ::= expr */
159247 0, /* (220) case_operand ::= */
159248 0, /* (221) exprlist ::= */
159249 -3, /* (222) nexprlist ::= nexprlist COMMA expr */
159250 -1, /* (223) nexprlist ::= expr */
159251 0, /* (224) paren_exprlist ::= */
159252 -3, /* (225) paren_exprlist ::= LP exprlist RP */
159253 -12, /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159254 -1, /* (227) uniqueflag ::= UNIQUE */
159255 0, /* (228) uniqueflag ::= */
159256 0, /* (229) eidlist_opt ::= */
159257 -3, /* (230) eidlist_opt ::= LP eidlist RP */
159258 -5, /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
159259 -3, /* (232) eidlist ::= nm collate sortorder */
159260 0, /* (233) collate ::= */
159261 -2, /* (234) collate ::= COLLATE ID|STRING */
159262 -4, /* (235) cmd ::= DROP INDEX ifexists fullname */
159263 -2, /* (236) cmd ::= VACUUM vinto */
159264 -3, /* (237) cmd ::= VACUUM nm vinto */
159265 -2, /* (238) vinto ::= INTO expr */
159266 0, /* (239) vinto ::= */
159267 -3, /* (240) cmd ::= PRAGMA nm dbnm */
159268 -5, /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
159269 -6, /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
159270 -5, /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
159271 -6, /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
159272 -2, /* (245) plus_num ::= PLUS INTEGER|FLOAT */
159273 -2, /* (246) minus_num ::= MINUS INTEGER|FLOAT */
159274 -5, /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159275 -11, /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159276 -1, /* (249) trigger_time ::= BEFORE|AFTER */
159277 -2, /* (250) trigger_time ::= INSTEAD OF */
159278 0, /* (251) trigger_time ::= */
159279 -1, /* (252) trigger_event ::= DELETE|INSERT */
159280 -1, /* (253) trigger_event ::= UPDATE */
159281 -3, /* (254) trigger_event ::= UPDATE OF idlist */
159282 0, /* (255) when_clause ::= */
159283 -2, /* (256) when_clause ::= WHEN expr */
159284 -3, /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159285 -2, /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
159286 -3, /* (259) trnm ::= nm DOT nm */
159287 -3, /* (260) tridxby ::= INDEXED BY nm */
159288 -2, /* (261) tridxby ::= NOT INDEXED */
159289 -9, /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159290 -8, /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159291 -6, /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159292 -3, /* (265) trigger_cmd ::= scanpt select scanpt */
159293 -4, /* (266) expr ::= RAISE LP IGNORE RP */
159294 -6, /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
159295 -1, /* (268) raisetype ::= ROLLBACK */
159296 -1, /* (269) raisetype ::= ABORT */
159297 -1, /* (270) raisetype ::= FAIL */
159298 -4, /* (271) cmd ::= DROP TRIGGER ifexists fullname */
159299 -6, /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159300 -3, /* (273) cmd ::= DETACH database_kw_opt expr */
159301 0, /* (274) key_opt ::= */
159302 -2, /* (275) key_opt ::= KEY expr */
159303 -1, /* (276) cmd ::= REINDEX */
159304 -3, /* (277) cmd ::= REINDEX nm dbnm */
159305 -1, /* (278) cmd ::= ANALYZE */
159306 -3, /* (279) cmd ::= ANALYZE nm dbnm */
159307 -6, /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
159308 -7, /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159309 -1, /* (282) add_column_fullname ::= fullname */
159310 -8, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159311 -1, /* (284) cmd ::= create_vtab */
159312 -4, /* (285) cmd ::= create_vtab LP vtabarglist RP */
159313 -8, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159314 0, /* (287) vtabarg ::= */
159315 -1, /* (288) vtabargtoken ::= ANY */
159316 -3, /* (289) vtabargtoken ::= lp anylist RP */
159317 -1, /* (290) lp ::= LP */
159318 -2, /* (291) with ::= WITH wqlist */
159319 -3, /* (292) with ::= WITH RECURSIVE wqlist */
159320 -6, /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
159321 -8, /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159322 -1, /* (295) windowdefn_list ::= windowdefn */
159323 -3, /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159324 -5, /* (297) windowdefn ::= nm AS LP window RP */
159325 -5, /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159326 -6, /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159327 -4, /* (300) window ::= ORDER BY sortlist frame_opt */
159328 -5, /* (301) window ::= nm ORDER BY sortlist frame_opt */
159329 -1, /* (302) window ::= frame_opt */
159330 -2, /* (303) window ::= nm frame_opt */
159331 0, /* (304) frame_opt ::= */
159332 -3, /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159333 -6, /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159334 -1, /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
159335 -1, /* (308) frame_bound_s ::= frame_bound */
159336 -2, /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
159337 -1, /* (310) frame_bound_e ::= frame_bound */
159338 -2, /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
159339 -2, /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
159340 -2, /* (313) frame_bound ::= CURRENT ROW */
159341 0, /* (314) frame_exclude_opt ::= */
159342 -2, /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
159343 -2, /* (316) frame_exclude ::= NO OTHERS */
159344 -2, /* (317) frame_exclude ::= CURRENT ROW */
159345 -1, /* (318) frame_exclude ::= GROUP|TIES */
159346 -2, /* (319) window_clause ::= WINDOW windowdefn_list */
159347 -2, /* (320) filter_over ::= filter_clause over_clause */
159348 -1, /* (321) filter_over ::= over_clause */
159349 -1, /* (322) filter_over ::= filter_clause */
159350 -4, /* (323) over_clause ::= OVER LP window RP */
159351 -2, /* (324) over_clause ::= OVER nm */
159352 -5, /* (325) filter_clause ::= FILTER LP WHERE expr RP */
159353 -1, /* (326) input ::= cmdlist */
159354 -2, /* (327) cmdlist ::= cmdlist ecmd */
159355 -1, /* (328) cmdlist ::= ecmd */
159356 -1, /* (329) ecmd ::= SEMI */
159357 -2, /* (330) ecmd ::= cmdx SEMI */
159358 -3, /* (331) ecmd ::= explain cmdx SEMI */
159359 0, /* (332) trans_opt ::= */
159360 -1, /* (333) trans_opt ::= TRANSACTION */
159361 -2, /* (334) trans_opt ::= TRANSACTION nm */
159362 -1, /* (335) savepoint_opt ::= SAVEPOINT */
159363 0, /* (336) savepoint_opt ::= */
159364 -2, /* (337) cmd ::= create_table create_table_args */
159365 -4, /* (338) columnlist ::= columnlist COMMA columnname carglist */
159366 -2, /* (339) columnlist ::= columnname carglist */
159367 -1, /* (340) nm ::= ID|INDEXED */
159368 -1, /* (341) nm ::= STRING */
159369 -1, /* (342) nm ::= JOIN_KW */
159370 -1, /* (343) typetoken ::= typename */
159371 -1, /* (344) typename ::= ID|STRING */
159372 -1, /* (345) signed ::= plus_num */
159373 -1, /* (346) signed ::= minus_num */
159374 -2, /* (347) carglist ::= carglist ccons */
159375 0, /* (348) carglist ::= */
159376 -2, /* (349) ccons ::= NULL onconf */
159377 -4, /* (350) ccons ::= GENERATED ALWAYS AS generated */
159378 -2, /* (351) ccons ::= AS generated */
159379 -2, /* (352) conslist_opt ::= COMMA conslist */
159380 -3, /* (353) conslist ::= conslist tconscomma tcons */
159381 -1, /* (354) conslist ::= tcons */
159382 0, /* (355) tconscomma ::= */
159383 -1, /* (356) defer_subclause_opt ::= defer_subclause */
159384 -1, /* (357) resolvetype ::= raisetype */
159385 -1, /* (358) selectnowith ::= oneselect */
159386 -1, /* (359) oneselect ::= values */
159387 -2, /* (360) sclp ::= selcollist COMMA */
159388 -1, /* (361) as ::= ID|STRING */
159389 -1, /* (362) expr ::= term */
159390 -1, /* (363) likeop ::= LIKE_KW|MATCH */
159391 -1, /* (364) exprlist ::= nexprlist */
159392 -1, /* (365) nmnum ::= plus_num */
159393 -1, /* (366) nmnum ::= nm */
159394 -1, /* (367) nmnum ::= ON */
159395 -1, /* (368) nmnum ::= DELETE */
159396 -1, /* (369) nmnum ::= DEFAULT */
159397 -1, /* (370) plus_num ::= INTEGER|FLOAT */
159398 0, /* (371) foreach_clause ::= */
159399 -3, /* (372) foreach_clause ::= FOR EACH ROW */
159400 -1, /* (373) trnm ::= nm */
159401 0, /* (374) tridxby ::= */
159402 -1, /* (375) database_kw_opt ::= DATABASE */
159403 0, /* (376) database_kw_opt ::= */
159404 0, /* (377) kwcolumn_opt ::= */
159405 -1, /* (378) kwcolumn_opt ::= COLUMNKW */
159406 -1, /* (379) vtabarglist ::= vtabarg */
159407 -3, /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
159408 -2, /* (381) vtabarg ::= vtabarg vtabargtoken */
159409 0, /* (382) anylist ::= */
159410 -4, /* (383) anylist ::= anylist LP anylist RP */
159411 -2, /* (384) anylist ::= anylist ANY */
159412 0, /* (385) with ::= */
159413 };
159414
159415 static void yy_accept(yyParser*); /* Forward Declaration */
159416
159417 /*
@@ -158278,59 +159437,10 @@
159437 int yysize; /* Amount to pop the stack */
159438 sqlite3ParserARG_FETCH
159439 (void)yyLookahead;
159440 (void)yyLookaheadToken;
159441 yymsp = yypParser->yytos;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159442
159443 switch( yyruleno ){
159444 /* Beginning here are the reduction cases. A typical example
159445 ** follows:
159446 ** case 0:
@@ -158357,11 +159467,11 @@
159467 {yymsp[1].minor.yy192 = TK_DEFERRED;}
159468 break;
159469 case 5: /* transtype ::= DEFERRED */
159470 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
159471 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
159472 case 307: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==307);
159473 {yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/}
159474 break;
159475 case 8: /* cmd ::= COMMIT|END trans_opt */
159476 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
159477 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -158395,11 +159505,11 @@
159505 case 45: /* autoinc ::= */ yytestcase(yyruleno==45);
159506 case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
159507 case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
159508 case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
159509 case 96: /* distinct ::= */ yytestcase(yyruleno==96);
159510 case 233: /* collate ::= */ yytestcase(yyruleno==233);
159511 {yymsp[1].minor.yy192 = 0;}
159512 break;
159513 case 16: /* ifnotexists ::= IF NOT EXISTS */
159514 {yymsp[-2].minor.yy192 = 1;}
159515 break;
@@ -158554,18 +159664,18 @@
159664 case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
159665 {yymsp[-2].minor.yy192 = 0;}
159666 break;
159667 case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
159668 case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
159669 case 163: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==163);
159670 {yymsp[-1].minor.yy192 = yymsp[0].minor.yy192;}
159671 break;
159672 case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
159673 case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
159674 case 205: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==205);
159675 case 208: /* in_op ::= NOT IN */ yytestcase(yyruleno==208);
159676 case 234: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==234);
159677 {yymsp[-1].minor.yy192 = 1;}
159678 break;
159679 case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
159680 {yymsp[-1].minor.yy192 = 0;}
159681 break;
@@ -158597,11 +159707,11 @@
159707 break;
159708 case 75: /* resolvetype ::= IGNORE */
159709 {yymsp[0].minor.yy192 = OE_Ignore;}
159710 break;
159711 case 76: /* resolvetype ::= REPLACE */
159712 case 164: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==164);
159713 {yymsp[0].minor.yy192 = OE_Replace;}
159714 break;
159715 case 77: /* cmd ::= DROP TABLE ifexists fullname */
159716 {
159717 sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192);
@@ -158729,13 +159839,13 @@
159839 {yymsp[0].minor.yy192 = SF_All;}
159840 break;
159841 case 97: /* sclp ::= */
159842 case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
159843 case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
159844 case 221: /* exprlist ::= */ yytestcase(yyruleno==221);
159845 case 224: /* paren_exprlist ::= */ yytestcase(yyruleno==224);
159846 case 229: /* eidlist_opt ::= */ yytestcase(yyruleno==229);
159847 {yymsp[1].minor.yy242 = 0;}
159848 break;
159849 case 98: /* selcollist ::= sclp scanpt expr scanpt as */
159850 {
159851 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
@@ -158757,12 +159867,12 @@
159867 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot);
159868 }
159869 break;
159870 case 101: /* as ::= AS nm */
159871 case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
159872 case 245: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==245);
159873 case 246: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==246);
159874 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
159875 break;
159876 case 103: /* from ::= */
159877 case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
159878 {yymsp[1].minor.yy47 = 0;}
@@ -158874,21 +159984,21 @@
159984 {yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
159985 break;
159986 case 123: /* on_opt ::= ON expr */
159987 case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
159988 case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
159989 case 217: /* case_else ::= ELSE expr */ yytestcase(yyruleno==217);
159990 case 238: /* vinto ::= INTO expr */ yytestcase(yyruleno==238);
159991 {yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;}
159992 break;
159993 case 124: /* on_opt ::= */
159994 case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
159995 case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
159996 case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
159997 case 218: /* case_else ::= */ yytestcase(yyruleno==218);
159998 case 220: /* case_operand ::= */ yytestcase(yyruleno==220);
159999 case 239: /* vinto ::= */ yytestcase(yyruleno==239);
160000 {yymsp[1].minor.yy202 = 0;}
160001 break;
160002 case 126: /* indexed_opt ::= INDEXED BY nm */
160003 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
160004 break;
@@ -158897,11 +160007,11 @@
160007 break;
160008 case 128: /* using_opt ::= USING LP idlist RP */
160009 {yymsp[-3].minor.yy600 = yymsp[-1].minor.yy600;}
160010 break;
160011 case 129: /* using_opt ::= */
160012 case 165: /* idlist_opt ::= */ yytestcase(yyruleno==165);
160013 {yymsp[1].minor.yy600 = 0;}
160014 break;
160015 case 131: /* orderby_opt ::= ORDER BY sortlist */
160016 case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
160017 {yymsp[-2].minor.yy242 = yymsp[0].minor.yy242;}
@@ -158991,36 +160101,39 @@
160101 }
160102 break;
160103 case 158: /* upsert ::= */
160104 { yymsp[1].minor.yy318 = 0; }
160105 break;
160106 case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
160107 { yymsp[-11].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy242,yymsp[-6].minor.yy202,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202,yymsp[0].minor.yy318);}
160108 break;
160109 case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
160110 { yymsp[-8].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy242,yymsp[-3].minor.yy202,0,0,yymsp[0].minor.yy318); }
160111 break;
160112 case 161: /* upsert ::= ON CONFLICT DO NOTHING */
160113 { yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
160114 break;
160115 case 162: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
160116 { yymsp[-6].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-1].minor.yy242,yymsp[0].minor.yy202,0);}
160117 break;
160118 case 166: /* idlist_opt ::= LP idlist RP */
160119 {yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;}
160120 break;
160121 case 167: /* idlist ::= idlist COMMA nm */
160122 {yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);}
160123 break;
160124 case 168: /* idlist ::= nm */
160125 {yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
160126 break;
160127 case 169: /* expr ::= LP expr RP */
160128 {yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;}
160129 break;
160130 case 170: /* expr ::= ID|INDEXED */
160131 case 171: /* expr ::= JOIN_KW */ yytestcase(yyruleno==171);
160132 {yymsp[0].minor.yy202=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160133 break;
160134 case 172: /* expr ::= nm DOT nm */
160135 {
160136 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160137 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
160138 if( IN_RENAME_OBJECT ){
160139 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
@@ -159028,11 +160141,11 @@
160141 }
160142 yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
160143 }
160144 yymsp[-2].minor.yy202 = yylhsminor.yy202;
160145 break;
160146 case 173: /* expr ::= nm DOT nm DOT nm */
160147 {
160148 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
160149 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160150 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
160151 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -159042,21 +160155,21 @@
160155 }
160156 yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
160157 }
160158 yymsp[-4].minor.yy202 = yylhsminor.yy202;
160159 break;
160160 case 174: /* term ::= NULL|FLOAT|BLOB */
160161 case 175: /* term ::= STRING */ yytestcase(yyruleno==175);
160162 {yymsp[0].minor.yy202=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160163 break;
160164 case 176: /* term ::= INTEGER */
160165 {
160166 yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
160167 }
160168 yymsp[0].minor.yy202 = yylhsminor.yy202;
160169 break;
160170 case 177: /* expr ::= VARIABLE */
160171 {
160172 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
160173 u32 n = yymsp[0].minor.yy0.n;
160174 yymsp[0].minor.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
160175 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n);
@@ -159074,54 +160187,54 @@
160187 if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable);
160188 }
160189 }
160190 }
160191 break;
160192 case 178: /* expr ::= expr COLLATE ID|STRING */
160193 {
160194 yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1);
160195 }
160196 break;
160197 case 179: /* expr ::= CAST LP expr AS typetoken RP */
160198 {
160199 yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
160200 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0);
160201 }
160202 break;
160203 case 180: /* expr ::= ID|INDEXED LP distinct exprlist RP */
160204 {
160205 yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192);
160206 }
160207 yymsp[-4].minor.yy202 = yylhsminor.yy202;
160208 break;
160209 case 181: /* expr ::= ID|INDEXED LP STAR RP */
160210 {
160211 yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
160212 }
160213 yymsp[-3].minor.yy202 = yylhsminor.yy202;
160214 break;
160215 case 182: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
160216 {
160217 yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192);
160218 sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
160219 }
160220 yymsp[-5].minor.yy202 = yylhsminor.yy202;
160221 break;
160222 case 183: /* expr ::= ID|INDEXED LP STAR RP filter_over */
160223 {
160224 yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
160225 sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
160226 }
160227 yymsp[-4].minor.yy202 = yylhsminor.yy202;
160228 break;
160229 case 184: /* term ::= CTIME_KW */
160230 {
160231 yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
160232 }
160233 yymsp[0].minor.yy202 = yylhsminor.yy202;
160234 break;
160235 case 185: /* expr ::= LP nexprlist COMMA expr RP */
160236 {
160237 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202);
160238 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
160239 if( yymsp[-4].minor.yy202 ){
160240 yymsp[-4].minor.yy202->x.pList = pList;
@@ -159131,26 +160244,26 @@
160244 }else{
160245 sqlite3ExprListDelete(pParse->db, pList);
160246 }
160247 }
160248 break;
160249 case 186: /* expr ::= expr AND expr */
160250 {yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
160251 break;
160252 case 187: /* expr ::= expr OR expr */
160253 case 188: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==188);
160254 case 189: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==189);
160255 case 190: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==190);
160256 case 191: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==191);
160257 case 192: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==192);
160258 case 193: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==193);
160259 {yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
160260 break;
160261 case 194: /* likeop ::= NOT LIKE_KW|MATCH */
160262 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
160263 break;
160264 case 195: /* expr ::= expr likeop expr */
160265 {
160266 ExprList *pList;
160267 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
160268 yymsp[-1].minor.yy0.n &= 0x7fffffff;
160269 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy202);
@@ -159158,11 +160271,11 @@
160271 yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
160272 if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0);
160273 if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc;
160274 }
160275 break;
160276 case 196: /* expr ::= expr likeop expr ESCAPE expr */
160277 {
160278 ExprList *pList;
160279 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
160280 yymsp[-3].minor.yy0.n &= 0x7fffffff;
160281 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
@@ -159171,43 +160284,43 @@
160284 yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
160285 if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
160286 if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc;
160287 }
160288 break;
160289 case 197: /* expr ::= expr ISNULL|NOTNULL */
160290 {yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);}
160291 break;
160292 case 198: /* expr ::= expr NOT NULL */
160293 {yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);}
160294 break;
160295 case 199: /* expr ::= expr IS expr */
160296 {
160297 yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);
160298 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL);
160299 }
160300 break;
160301 case 200: /* expr ::= expr IS NOT expr */
160302 {
160303 yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202);
160304 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL);
160305 }
160306 break;
160307 case 201: /* expr ::= NOT expr */
160308 case 202: /* expr ::= BITNOT expr */ yytestcase(yyruleno==202);
160309 {yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/}
160310 break;
160311 case 203: /* expr ::= PLUS|MINUS expr */
160312 {
160313 yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0);
160314 /*A-overwrites-B*/
160315 }
160316 break;
160317 case 204: /* between_op ::= BETWEEN */
160318 case 207: /* in_op ::= IN */ yytestcase(yyruleno==207);
160319 {yymsp[0].minor.yy192 = 0;}
160320 break;
160321 case 206: /* expr ::= expr between_op expr AND expr */
160322 {
160323 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
160324 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
160325 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0);
160326 if( yymsp[-4].minor.yy202 ){
@@ -159216,11 +160329,11 @@
160329 sqlite3ExprListDelete(pParse->db, pList);
160330 }
160331 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
160332 }
160333 break;
160334 case 209: /* expr ::= expr in_op LP exprlist RP */
160335 {
160336 if( yymsp[-1].minor.yy242==0 ){
160337 /* Expressions of the form
160338 **
160339 ** expr1 IN ()
@@ -159248,41 +160361,41 @@
160361 }
160362 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
160363 }
160364 }
160365 break;
160366 case 210: /* expr ::= LP select RP */
160367 {
160368 yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
160369 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539);
160370 }
160371 break;
160372 case 211: /* expr ::= expr in_op LP select RP */
160373 {
160374 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
160375 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539);
160376 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
160377 }
160378 break;
160379 case 212: /* expr ::= expr in_op nm dbnm paren_exprlist */
160380 {
160381 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
160382 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
160383 if( yymsp[0].minor.yy242 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242);
160384 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
160385 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect);
160386 if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
160387 }
160388 break;
160389 case 213: /* expr ::= EXISTS LP select RP */
160390 {
160391 Expr *p;
160392 p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
160393 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539);
160394 }
160395 break;
160396 case 214: /* expr ::= CASE case_operand case_exprlist case_else END */
160397 {
160398 yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0);
160399 if( yymsp[-4].minor.yy202 ){
160400 yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242;
160401 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202);
@@ -159290,394 +160403,394 @@
160403 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242);
160404 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202);
160405 }
160406 }
160407 break;
160408 case 215: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
160409 {
160410 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
160411 yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202);
160412 }
160413 break;
160414 case 216: /* case_exprlist ::= WHEN expr THEN expr */
160415 {
160416 yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
160417 yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202);
160418 }
160419 break;
160420 case 219: /* case_operand ::= expr */
160421 {yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/}
160422 break;
160423 case 222: /* nexprlist ::= nexprlist COMMA expr */
160424 {yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);}
160425 break;
160426 case 223: /* nexprlist ::= expr */
160427 {yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/}
160428 break;
160429 case 225: /* paren_exprlist ::= LP exprlist RP */
160430 case 230: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==230);
160431 {yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242;}
160432 break;
160433 case 226: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
160434 {
160435 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
160436 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy242, yymsp[-10].minor.yy192,
160437 &yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF);
160438 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
160439 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
160440 }
160441 }
160442 break;
160443 case 227: /* uniqueflag ::= UNIQUE */
160444 case 269: /* raisetype ::= ABORT */ yytestcase(yyruleno==269);
160445 {yymsp[0].minor.yy192 = OE_Abort;}
160446 break;
160447 case 228: /* uniqueflag ::= */
160448 {yymsp[1].minor.yy192 = OE_None;}
160449 break;
160450 case 231: /* eidlist ::= eidlist COMMA nm collate sortorder */
160451 {
160452 yymsp[-4].minor.yy242 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192);
160453 }
160454 break;
160455 case 232: /* eidlist ::= nm collate sortorder */
160456 {
160457 yymsp[-2].minor.yy242 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); /*A-overwrites-Y*/
160458 }
160459 break;
160460 case 235: /* cmd ::= DROP INDEX ifexists fullname */
160461 {sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);}
160462 break;
160463 case 236: /* cmd ::= VACUUM vinto */
160464 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);}
160465 break;
160466 case 237: /* cmd ::= VACUUM nm vinto */
160467 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);}
160468 break;
160469 case 240: /* cmd ::= PRAGMA nm dbnm */
160470 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
160471 break;
160472 case 241: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
160473 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
160474 break;
160475 case 242: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
160476 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
160477 break;
160478 case 243: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
160479 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
160480 break;
160481 case 244: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
160482 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
160483 break;
160484 case 247: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
160485 {
160486 Token all;
160487 all.z = yymsp[-3].minor.yy0.z;
160488 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
160489 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy447, &all);
160490 }
160491 break;
160492 case 248: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
160493 {
160494 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192);
160495 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
160496 }
160497 break;
160498 case 249: /* trigger_time ::= BEFORE|AFTER */
160499 { yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/ }
160500 break;
160501 case 250: /* trigger_time ::= INSTEAD OF */
160502 { yymsp[-1].minor.yy192 = TK_INSTEAD;}
160503 break;
160504 case 251: /* trigger_time ::= */
160505 { yymsp[1].minor.yy192 = TK_BEFORE; }
160506 break;
160507 case 252: /* trigger_event ::= DELETE|INSERT */
160508 case 253: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==253);
160509 {yymsp[0].minor.yy230.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy230.b = 0;}
160510 break;
160511 case 254: /* trigger_event ::= UPDATE OF idlist */
160512 {yymsp[-2].minor.yy230.a = TK_UPDATE; yymsp[-2].minor.yy230.b = yymsp[0].minor.yy600;}
160513 break;
160514 case 255: /* when_clause ::= */
160515 case 274: /* key_opt ::= */ yytestcase(yyruleno==274);
160516 { yymsp[1].minor.yy202 = 0; }
160517 break;
160518 case 256: /* when_clause ::= WHEN expr */
160519 case 275: /* key_opt ::= KEY expr */ yytestcase(yyruleno==275);
160520 { yymsp[-1].minor.yy202 = yymsp[0].minor.yy202; }
160521 break;
160522 case 257: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
160523 {
160524 assert( yymsp[-2].minor.yy447!=0 );
160525 yymsp[-2].minor.yy447->pLast->pNext = yymsp[-1].minor.yy447;
160526 yymsp[-2].minor.yy447->pLast = yymsp[-1].minor.yy447;
160527 }
160528 break;
160529 case 258: /* trigger_cmd_list ::= trigger_cmd SEMI */
160530 {
160531 assert( yymsp[-1].minor.yy447!=0 );
160532 yymsp[-1].minor.yy447->pLast = yymsp[-1].minor.yy447;
160533 }
160534 break;
160535 case 259: /* trnm ::= nm DOT nm */
160536 {
160537 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
160538 sqlite3ErrorMsg(pParse,
160539 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
160540 "statements within triggers");
160541 }
160542 break;
160543 case 260: /* tridxby ::= INDEXED BY nm */
160544 {
160545 sqlite3ErrorMsg(pParse,
160546 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
160547 "within triggers");
160548 }
160549 break;
160550 case 261: /* tridxby ::= NOT INDEXED */
160551 {
160552 sqlite3ErrorMsg(pParse,
160553 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
160554 "within triggers");
160555 }
160556 break;
160557 case 262: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
160558 {yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy47, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202, yymsp[-7].minor.yy192, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy436);}
160559 yymsp[-8].minor.yy447 = yylhsminor.yy447;
160560 break;
160561 case 263: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
160562 {
160563 yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/
160564 }
160565 yymsp[-7].minor.yy447 = yylhsminor.yy447;
160566 break;
160567 case 264: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
160568 {yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);}
160569 yymsp[-5].minor.yy447 = yylhsminor.yy447;
160570 break;
160571 case 265: /* trigger_cmd ::= scanpt select scanpt */
160572 {yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/}
160573 yymsp[-2].minor.yy447 = yylhsminor.yy447;
160574 break;
160575 case 266: /* expr ::= RAISE LP IGNORE RP */
160576 {
160577 yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
160578 if( yymsp[-3].minor.yy202 ){
160579 yymsp[-3].minor.yy202->affExpr = OE_Ignore;
160580 }
160581 }
160582 break;
160583 case 267: /* expr ::= RAISE LP raisetype COMMA nm RP */
160584 {
160585 yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
160586 if( yymsp[-5].minor.yy202 ) {
160587 yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192;
160588 }
160589 }
160590 break;
160591 case 268: /* raisetype ::= ROLLBACK */
160592 {yymsp[0].minor.yy192 = OE_Rollback;}
160593 break;
160594 case 270: /* raisetype ::= FAIL */
160595 {yymsp[0].minor.yy192 = OE_Fail;}
160596 break;
160597 case 271: /* cmd ::= DROP TRIGGER ifexists fullname */
160598 {
160599 sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192);
160600 }
160601 break;
160602 case 272: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
160603 {
160604 sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202);
160605 }
160606 break;
160607 case 273: /* cmd ::= DETACH database_kw_opt expr */
160608 {
160609 sqlite3Detach(pParse, yymsp[0].minor.yy202);
160610 }
160611 break;
160612 case 276: /* cmd ::= REINDEX */
160613 {sqlite3Reindex(pParse, 0, 0);}
160614 break;
160615 case 277: /* cmd ::= REINDEX nm dbnm */
160616 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
160617 break;
160618 case 278: /* cmd ::= ANALYZE */
160619 {sqlite3Analyze(pParse, 0, 0);}
160620 break;
160621 case 279: /* cmd ::= ANALYZE nm dbnm */
160622 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
160623 break;
160624 case 280: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
160625 {
160626 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0);
160627 }
160628 break;
160629 case 281: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
160630 {
160631 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
160632 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
160633 }
160634 break;
160635 case 282: /* add_column_fullname ::= fullname */
160636 {
160637 disableLookaside(pParse);
160638 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47);
160639 }
160640 break;
160641 case 283: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
160642 {
160643 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
160644 }
160645 break;
160646 case 284: /* cmd ::= create_vtab */
160647 {sqlite3VtabFinishParse(pParse,0);}
160648 break;
160649 case 285: /* cmd ::= create_vtab LP vtabarglist RP */
160650 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
160651 break;
160652 case 286: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
160653 {
160654 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy192);
160655 }
160656 break;
160657 case 287: /* vtabarg ::= */
160658 {sqlite3VtabArgInit(pParse);}
160659 break;
160660 case 288: /* vtabargtoken ::= ANY */
160661 case 289: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==289);
160662 case 290: /* lp ::= LP */ yytestcase(yyruleno==290);
160663 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
160664 break;
160665 case 291: /* with ::= WITH wqlist */
160666 case 292: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==292);
160667 { sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); }
160668 break;
160669 case 293: /* wqlist ::= nm eidlist_opt AS LP select RP */
160670 {
160671 yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/
160672 }
160673 break;
160674 case 294: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
160675 {
160676 yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539);
160677 }
160678 break;
160679 case 295: /* windowdefn_list ::= windowdefn */
160680 { yylhsminor.yy303 = yymsp[0].minor.yy303; }
160681 yymsp[0].minor.yy303 = yylhsminor.yy303;
160682 break;
160683 case 296: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
160684 {
160685 assert( yymsp[0].minor.yy303!=0 );
160686 sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303);
160687 yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303;
160688 yylhsminor.yy303 = yymsp[0].minor.yy303;
160689 }
160690 yymsp[-2].minor.yy303 = yylhsminor.yy303;
160691 break;
160692 case 297: /* windowdefn ::= nm AS LP window RP */
160693 {
160694 if( ALWAYS(yymsp[-1].minor.yy303) ){
160695 yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
160696 }
160697 yylhsminor.yy303 = yymsp[-1].minor.yy303;
160698 }
160699 yymsp[-4].minor.yy303 = yylhsminor.yy303;
160700 break;
160701 case 298: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
160702 {
160703 yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0);
160704 }
160705 break;
160706 case 299: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
160707 {
160708 yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0);
160709 }
160710 yymsp[-5].minor.yy303 = yylhsminor.yy303;
160711 break;
160712 case 300: /* window ::= ORDER BY sortlist frame_opt */
160713 {
160714 yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0);
160715 }
160716 break;
160717 case 301: /* window ::= nm ORDER BY sortlist frame_opt */
160718 {
160719 yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0);
160720 }
160721 yymsp[-4].minor.yy303 = yylhsminor.yy303;
160722 break;
160723 case 302: /* window ::= frame_opt */
160724 case 321: /* filter_over ::= over_clause */ yytestcase(yyruleno==321);
160725 {
160726 yylhsminor.yy303 = yymsp[0].minor.yy303;
160727 }
160728 yymsp[0].minor.yy303 = yylhsminor.yy303;
160729 break;
160730 case 303: /* window ::= nm frame_opt */
160731 {
160732 yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0);
160733 }
160734 yymsp[-1].minor.yy303 = yylhsminor.yy303;
160735 break;
160736 case 304: /* frame_opt ::= */
160737 {
160738 yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
160739 }
160740 break;
160741 case 305: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
160742 {
160743 yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58);
160744 }
160745 yymsp[-2].minor.yy303 = yylhsminor.yy303;
160746 break;
160747 case 306: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
160748 {
160749 yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58);
160750 }
160751 yymsp[-5].minor.yy303 = yylhsminor.yy303;
160752 break;
160753 case 308: /* frame_bound_s ::= frame_bound */
160754 case 310: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==310);
160755 {yylhsminor.yy77 = yymsp[0].minor.yy77;}
160756 yymsp[0].minor.yy77 = yylhsminor.yy77;
160757 break;
160758 case 309: /* frame_bound_s ::= UNBOUNDED PRECEDING */
160759 case 311: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==311);
160760 case 313: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==313);
160761 {yylhsminor.yy77.eType = yymsp[-1].major; yylhsminor.yy77.pExpr = 0;}
160762 yymsp[-1].minor.yy77 = yylhsminor.yy77;
160763 break;
160764 case 312: /* frame_bound ::= expr PRECEDING|FOLLOWING */
160765 {yylhsminor.yy77.eType = yymsp[0].major; yylhsminor.yy77.pExpr = yymsp[-1].minor.yy202;}
160766 yymsp[-1].minor.yy77 = yylhsminor.yy77;
160767 break;
160768 case 314: /* frame_exclude_opt ::= */
160769 {yymsp[1].minor.yy58 = 0;}
160770 break;
160771 case 315: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
160772 {yymsp[-1].minor.yy58 = yymsp[0].minor.yy58;}
160773 break;
160774 case 316: /* frame_exclude ::= NO OTHERS */
160775 case 317: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==317);
160776 {yymsp[-1].minor.yy58 = yymsp[-1].major; /*A-overwrites-X*/}
160777 break;
160778 case 318: /* frame_exclude ::= GROUP|TIES */
160779 {yymsp[0].minor.yy58 = yymsp[0].major; /*A-overwrites-X*/}
160780 break;
160781 case 319: /* window_clause ::= WINDOW windowdefn_list */
160782 { yymsp[-1].minor.yy303 = yymsp[0].minor.yy303; }
160783 break;
160784 case 320: /* filter_over ::= filter_clause over_clause */
160785 {
160786 yymsp[0].minor.yy303->pFilter = yymsp[-1].minor.yy202;
160787 yylhsminor.yy303 = yymsp[0].minor.yy303;
160788 }
160789 yymsp[-1].minor.yy303 = yylhsminor.yy303;
160790 break;
160791 case 322: /* filter_over ::= filter_clause */
160792 {
160793 yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
160794 if( yylhsminor.yy303 ){
160795 yylhsminor.yy303->eFrmType = TK_FILTER;
160796 yylhsminor.yy303->pFilter = yymsp[0].minor.yy202;
@@ -159685,88 +160798,88 @@
160798 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202);
160799 }
160800 }
160801 yymsp[0].minor.yy303 = yylhsminor.yy303;
160802 break;
160803 case 323: /* over_clause ::= OVER LP window RP */
160804 {
160805 yymsp[-3].minor.yy303 = yymsp[-1].minor.yy303;
160806 assert( yymsp[-3].minor.yy303!=0 );
160807 }
160808 break;
160809 case 324: /* over_clause ::= OVER nm */
160810 {
160811 yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
160812 if( yymsp[-1].minor.yy303 ){
160813 yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
160814 }
160815 }
160816 break;
160817 case 325: /* filter_clause ::= FILTER LP WHERE expr RP */
160818 { yymsp[-4].minor.yy202 = yymsp[-1].minor.yy202; }
160819 break;
160820 default:
160821 /* (326) input ::= cmdlist */ yytestcase(yyruleno==326);
160822 /* (327) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==327);
160823 /* (328) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=328);
160824 /* (329) ecmd ::= SEMI */ yytestcase(yyruleno==329);
160825 /* (330) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==330);
160826 /* (331) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=331);
160827 /* (332) trans_opt ::= */ yytestcase(yyruleno==332);
160828 /* (333) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==333);
160829 /* (334) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==334);
160830 /* (335) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==335);
160831 /* (336) savepoint_opt ::= */ yytestcase(yyruleno==336);
160832 /* (337) cmd ::= create_table create_table_args */ yytestcase(yyruleno==337);
160833 /* (338) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==338);
160834 /* (339) columnlist ::= columnname carglist */ yytestcase(yyruleno==339);
160835 /* (340) nm ::= ID|INDEXED */ yytestcase(yyruleno==340);
160836 /* (341) nm ::= STRING */ yytestcase(yyruleno==341);
160837 /* (342) nm ::= JOIN_KW */ yytestcase(yyruleno==342);
160838 /* (343) typetoken ::= typename */ yytestcase(yyruleno==343);
160839 /* (344) typename ::= ID|STRING */ yytestcase(yyruleno==344);
160840 /* (345) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
160841 /* (346) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=346);
160842 /* (347) carglist ::= carglist ccons */ yytestcase(yyruleno==347);
160843 /* (348) carglist ::= */ yytestcase(yyruleno==348);
160844 /* (349) ccons ::= NULL onconf */ yytestcase(yyruleno==349);
160845 /* (350) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==350);
160846 /* (351) ccons ::= AS generated */ yytestcase(yyruleno==351);
160847 /* (352) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==352);
160848 /* (353) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==353);
160849 /* (354) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=354);
160850 /* (355) tconscomma ::= */ yytestcase(yyruleno==355);
160851 /* (356) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=356);
160852 /* (357) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=357);
160853 /* (358) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=358);
160854 /* (359) oneselect ::= values */ yytestcase(yyruleno==359);
160855 /* (360) sclp ::= selcollist COMMA */ yytestcase(yyruleno==360);
160856 /* (361) as ::= ID|STRING */ yytestcase(yyruleno==361);
160857 /* (362) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=362);
160858 /* (363) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==363);
160859 /* (364) exprlist ::= nexprlist */ yytestcase(yyruleno==364);
160860 /* (365) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=365);
160861 /* (366) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=366);
160862 /* (367) nmnum ::= ON */ yytestcase(yyruleno==367);
160863 /* (368) nmnum ::= DELETE */ yytestcase(yyruleno==368);
160864 /* (369) nmnum ::= DEFAULT */ yytestcase(yyruleno==369);
160865 /* (370) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==370);
160866 /* (371) foreach_clause ::= */ yytestcase(yyruleno==371);
160867 /* (372) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==372);
160868 /* (373) trnm ::= nm */ yytestcase(yyruleno==373);
160869 /* (374) tridxby ::= */ yytestcase(yyruleno==374);
160870 /* (375) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==375);
160871 /* (376) database_kw_opt ::= */ yytestcase(yyruleno==376);
160872 /* (377) kwcolumn_opt ::= */ yytestcase(yyruleno==377);
160873 /* (378) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==378);
160874 /* (379) vtabarglist ::= vtabarg */ yytestcase(yyruleno==379);
160875 /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==380);
160876 /* (381) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==381);
160877 /* (382) anylist ::= */ yytestcase(yyruleno==382);
160878 /* (383) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==383);
160879 /* (384) anylist ::= anylist ANY */ yytestcase(yyruleno==384);
160880 /* (385) with ::= */ yytestcase(yyruleno==385);
160881 break;
160882 /********** End reduce actions ************************************************/
160883 };
160884 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
160885 yygoto = yyRuleInfoLhs[yyruleno];
@@ -159914,16 +161027,60 @@
161027 yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
161028 }
161029 }
161030 #endif
161031
161032 while(1){ /* Exit by "break" */
161033 assert( yypParser->yytos>=yypParser->yystack );
161034 assert( yyact==yypParser->yytos->stateno );
161035 yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
161036 if( yyact >= YY_MIN_REDUCE ){
161037 unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
161038 assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
161039 #ifndef NDEBUG
161040 if( yyTraceFILE ){
161041 int yysize = yyRuleInfoNRhs[yyruleno];
161042 if( yysize ){
161043 fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
161044 yyTracePrompt,
161045 yyruleno, yyRuleName[yyruleno],
161046 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
161047 yypParser->yytos[yysize].stateno);
161048 }else{
161049 fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
161050 yyTracePrompt, yyruleno, yyRuleName[yyruleno],
161051 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
161052 }
161053 }
161054 #endif /* NDEBUG */
161055
161056 /* Check that the stack is large enough to grow by a single entry
161057 ** if the RHS of the rule is empty. This ensures that there is room
161058 ** enough on the stack to push the LHS value */
161059 if( yyRuleInfoNRhs[yyruleno]==0 ){
161060 #ifdef YYTRACKMAXSTACKDEPTH
161061 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
161062 yypParser->yyhwm++;
161063 assert( yypParser->yyhwm ==
161064 (int)(yypParser->yytos - yypParser->yystack));
161065 }
161066 #endif
161067 #if YYSTACKDEPTH>0
161068 if( yypParser->yytos>=yypParser->yystackEnd ){
161069 yyStackOverflow(yypParser);
161070 break;
161071 }
161072 #else
161073 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
161074 if( yyGrowStack(yypParser) ){
161075 yyStackOverflow(yypParser);
161076 break;
161077 }
161078 }
161079 #endif
161080 }
161081 yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor sqlite3ParserCTX_PARAM);
161082 }else if( yyact <= YY_MAX_SHIFTREDUCE ){
161083 yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
161084 #ifndef YYNOERRORRECOVERY
161085 yypParser->yyerrcnt--;
161086 #endif
@@ -160032,11 +161189,11 @@
161189 #endif
161190 }
161191 break;
161192 #endif
161193 }
161194 }
161195 #ifndef NDEBUG
161196 if( yyTraceFILE ){
161197 yyStackEntry *i;
161198 char cDiv = '[';
161199 fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
@@ -160093,12 +161250,12 @@
161250 ** The lookup table is much faster. To maximize speed, and to ensure that
161251 ** a lookup table is used, all of the classes need to be small integers and
161252 ** all of them need to be used within the switch.
161253 */
161254 #define CC_X 0 /* The letter 'x', or start of BLOB literal */
161255 #define CC_KYWD0 1 /* First letter of a keyword */
161256 #define CC_KYWD 2 /* Alphabetics or '_'. Usable in a keyword */
161257 #define CC_DIGIT 3 /* Digits */
161258 #define CC_DOLLAR 4 /* '$' */
161259 #define CC_VARALPHA 5 /* '@', '#', ':'. Alphabetic SQL variables */
161260 #define CC_VARNUM 6 /* '?'. Numeric SQL variables */
161261 #define CC_SPACE 7 /* Space characters */
@@ -160119,24 +161276,25 @@
161276 #define CC_PERCENT 22 /* '%' */
161277 #define CC_COMMA 23 /* ',' */
161278 #define CC_AND 24 /* '&' */
161279 #define CC_TILDA 25 /* '~' */
161280 #define CC_DOT 26 /* '.' */
161281 #define CC_ID 27 /* unicode characters usable in IDs */
161282 #define CC_ILLEGAL 28 /* Illegal character */
161283 #define CC_NUL 29 /* 0x00 */
161284
161285 static const unsigned char aiClass[] = {
161286 #ifdef SQLITE_ASCII
161287 /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
161288 /* 0x */ 29, 28, 28, 28, 28, 28, 28, 28, 28, 7, 7, 28, 7, 7, 28, 28,
161289 /* 1x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
161290 /* 2x */ 7, 15, 8, 5, 4, 22, 24, 8, 17, 18, 21, 20, 23, 11, 26, 16,
161291 /* 3x */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 19, 12, 14, 13, 6,
161292 /* 4x */ 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
161293 /* 5x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 9, 28, 28, 28, 2,
161294 /* 6x */ 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
161295 /* 7x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 28, 10, 28, 25, 28,
161296 /* 8x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161297 /* 9x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161298 /* Ax */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161299 /* Bx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161300 /* Cx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -160144,26 +161302,26 @@
161302 /* Ex */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161303 /* Fx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
161304 #endif
161305 #ifdef SQLITE_EBCDIC
161306 /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
161307 /* 0x */ 29, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 7, 7, 28, 28,
161308 /* 1x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
161309 /* 2x */ 28, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
161310 /* 3x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
161311 /* 4x */ 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 26, 12, 17, 20, 10,
161312 /* 5x */ 24, 28, 28, 28, 28, 28, 28, 28, 28, 28, 15, 4, 21, 18, 19, 28,
161313 /* 6x */ 11, 16, 28, 28, 28, 28, 28, 28, 28, 28, 28, 23, 22, 2, 13, 6,
161314 /* 7x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 8, 5, 5, 5, 8, 14, 8,
161315 /* 8x */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161316 /* 9x */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161317 /* Ax */ 28, 25, 1, 1, 1, 1, 1, 0, 2, 2, 28, 28, 28, 28, 28, 28,
161318 /* Bx */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 9, 28, 28, 28, 28, 28,
161319 /* Cx */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161320 /* Dx */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
161321 /* Ex */ 28, 28, 1, 1, 1, 1, 1, 0, 2, 2, 28, 28, 28, 28, 28, 28,
161322 /* Fx */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 28, 28, 28, 28, 28, 28,
161323 #endif
161324 };
161325
161326 /*
161327 ** The charMap() macro maps alphabetic characters (only) into their
@@ -160504,11 +161662,11 @@
161662 ** return the integer n (the length of the token). */
161663 static int keywordCode(const char *z, int n, int *pType){
161664 int i, j;
161665 const char *zKW;
161666 if( n>=2 ){
161667 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
161668 for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
161669 if( aKWLen[i]!=n ) continue;
161670 zKW = &zKWText[aKWOffset[i]];
161671 #ifdef SQLITE_ASCII
161672 if( (z[0]&~0x20)!=zKW[0] ) continue;
@@ -161046,11 +162204,11 @@
162204 }
162205 }
162206 if( n==0 ) *tokenType = TK_ILLEGAL;
162207 return i;
162208 }
162209 case CC_KYWD0: {
162210 for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}
162211 if( IdChar(z[i]) ){
162212 /* This token started out using characters that can appear in keywords,
162213 ** but z[i] is a character not allowed within keywords, so this must
162214 ** be an identifier instead */
@@ -161076,10 +162234,11 @@
162234 #endif
162235 /* If it is not a BLOB literal, then it must be an ID, since no
162236 ** SQL keywords start with the letter 'x'. Fall through */
162237 /* no break */ deliberate_fall_through
162238 }
162239 case CC_KYWD:
162240 case CC_ID: {
162241 i = 1;
162242 break;
162243 }
162244 case CC_NUL: {
@@ -161258,23 +162417,11 @@
162417 sqlite3DeleteTable(db, pParse->pNewTable);
162418 }
162419 if( !IN_RENAME_OBJECT ){
162420 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
162421 }
 
 
162422 sqlite3DbFree(db, pParse->pVList);
 
 
 
 
 
 
 
 
 
 
162423 db->pParse = pParse->pParentParse;
162424 pParse->pParentParse = 0;
162425 assert( nErr==0 || pParse->rc!=SQLITE_OK );
162426 return nErr;
162427 }
@@ -165883,11 +167030,11 @@
167030 ** with various optimizations disabled to verify that the same answer
167031 ** is obtained in every case.
167032 */
167033 case SQLITE_TESTCTRL_OPTIMIZATIONS: {
167034 sqlite3 *db = va_arg(ap, sqlite3*);
167035 db->dbOptFlags = va_arg(ap, u32);
167036 break;
167037 }
167038
167039 /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
167040 **
@@ -166058,11 +167205,30 @@
167205 *pn = sqlite3BtreeSeekCount(db->aDb->pBt);
167206 (void)db; /* Silence harmless unused variable warning */
167207 break;
167208 }
167209
167210 /* sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr)
167211 **
167212 ** "ptr" is a pointer to a u32.
167213 **
167214 ** op==0 Store the current sqlite3SelectTrace in *ptr
167215 ** op==1 Set sqlite3SelectTrace to the value *ptr
167216 ** op==3 Store the current sqlite3WhereTrace in *ptr
167217 ** op==3 Set sqlite3WhereTrace to the value *ptr
167218 */
167219 case SQLITE_TESTCTRL_TRACEFLAGS: {
167220 int opTrace = va_arg(ap, int);
167221 u32 *ptr = va_arg(ap, u32*);
167222 switch( opTrace ){
167223 case 0: *ptr = sqlite3SelectTrace; break;
167224 case 1: sqlite3SelectTrace = *ptr; break;
167225 case 2: *ptr = sqlite3WhereTrace; break;
167226 case 3: sqlite3WhereTrace = *ptr; break;
167227 }
167228 break;
167229 }
167230 }
167231 va_end(ap);
167232 #endif /* SQLITE_UNTESTABLE */
167233 return rc;
167234 }
@@ -203337,10 +204503,11 @@
204503 int bIndirect; /* True if all changes are indirect */
204504 int bAutoAttach; /* True to auto-attach tables */
204505 int rc; /* Non-zero if an error has occurred */
204506 void *pFilterCtx; /* First argument to pass to xTableFilter */
204507 int (*xTableFilter)(void *pCtx, const char *zTab);
204508 i64 nMalloc; /* Number of bytes of data allocated */
204509 sqlite3_value *pZeroBlob; /* Value containing X'' */
204510 sqlite3_session *pNext; /* Next session object on same db. */
204511 SessionTable *pTable; /* List of attached tables */
204512 SessionHook hook; /* APIs to grab new and old data with */
204513 };
@@ -203720,10 +204887,30 @@
204887
204888 if( pnWrite ) *pnWrite += nByte;
204889 return SQLITE_OK;
204890 }
204891
204892 /*
204893 ** Allocate and return a pointer to a buffer nByte bytes in size. If
204894 ** pSession is not NULL, increase the sqlite3_session.nMalloc variable
204895 ** by the number of bytes allocated.
204896 */
204897 static void *sessionMalloc64(sqlite3_session *pSession, i64 nByte){
204898 void *pRet = sqlite3_malloc64(nByte);
204899 if( pSession ) pSession->nMalloc += sqlite3_msize(pRet);
204900 return pRet;
204901 }
204902
204903 /*
204904 ** Free buffer pFree, which must have been allocated by an earlier
204905 ** call to sessionMalloc64(). If pSession is not NULL, decrease the
204906 ** sqlite3_session.nMalloc counter by the number of bytes freed.
204907 */
204908 static void sessionFree(sqlite3_session *pSession, void *pFree){
204909 if( pSession ) pSession->nMalloc -= sqlite3_msize(pFree);
204910 sqlite3_free(pFree);
204911 }
204912
204913 /*
204914 ** This macro is used to calculate hash key values for data structures. In
204915 ** order to use this macro, the entire data structure must be represented
204916 ** as a series of unsigned integers. In order to calculate a hash-key value
@@ -204187,17 +205374,23 @@
205374 ** It is possible that a non-fatal OOM error occurs in this function. In
205375 ** that case the hash-table does not grow, but SQLITE_OK is returned anyway.
205376 ** Growing the hash table in this case is a performance optimization only,
205377 ** it is not required for correct operation.
205378 */
205379 static int sessionGrowHash(
205380 sqlite3_session *pSession, /* For memory accounting. May be NULL */
205381 int bPatchset,
205382 SessionTable *pTab
205383 ){
205384 if( pTab->nChange==0 || pTab->nEntry>=(pTab->nChange/2) ){
205385 int i;
205386 SessionChange **apNew;
205387 sqlite3_int64 nNew = 2*(sqlite3_int64)(pTab->nChange ? pTab->nChange : 128);
205388
205389 apNew = (SessionChange**)sessionMalloc64(
205390 pSession, sizeof(SessionChange*) * nNew
205391 );
205392 if( apNew==0 ){
205393 if( pTab->nChange==0 ){
205394 return SQLITE_ERROR;
205395 }
205396 return SQLITE_OK;
@@ -204214,11 +205407,11 @@
205407 p->pNext = apNew[iHash];
205408 apNew[iHash] = p;
205409 }
205410 }
205411
205412 sessionFree(pSession, pTab->apChange);
205413 pTab->nChange = nNew;
205414 pTab->apChange = apNew;
205415 }
205416
205417 return SQLITE_OK;
@@ -204248,10 +205441,11 @@
205441 **
205442 ** All returned buffers are part of the same single allocation, which must
205443 ** be freed using sqlite3_free() by the caller
205444 */
205445 static int sessionTableInfo(
205446 sqlite3_session *pSession, /* For memory accounting. May be NULL */
205447 sqlite3 *db, /* Database connection */
205448 const char *zDb, /* Name of attached database (e.g. "main") */
205449 const char *zThis, /* Table name */
205450 int *pnCol, /* OUT: number of columns */
205451 const char **pzTab, /* OUT: Copy of zThis */
@@ -204302,11 +205496,11 @@
205496 }
205497 rc = sqlite3_reset(pStmt);
205498
205499 if( rc==SQLITE_OK ){
205500 nByte += nDbCol * (sizeof(const char *) + sizeof(u8) + 1);
205501 pAlloc = sessionMalloc64(pSession, nByte);
205502 if( pAlloc==0 ){
205503 rc = SQLITE_NOMEM;
205504 }
205505 }
205506 if( rc==SQLITE_OK ){
@@ -204345,11 +205539,11 @@
205539 }else{
205540 *pazCol = 0;
205541 *pabPK = 0;
205542 *pnCol = 0;
205543 if( pzTab ) *pzTab = 0;
205544 sessionFree(pSession, azCol);
205545 }
205546 sqlite3_finalize(pStmt);
205547 return rc;
205548 }
205549
@@ -204367,11 +205561,11 @@
205561 */
205562 static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){
205563 if( pTab->nCol==0 ){
205564 u8 *abPK;
205565 assert( pTab->azCol==0 || pTab->abPK==0 );
205566 pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb,
205567 pTab->zName, &pTab->nCol, 0, &pTab->azCol, &abPK
205568 );
205569 if( pSession->rc==SQLITE_OK ){
205570 int i;
205571 for(i=0; i<pTab->nCol; i++){
@@ -204458,11 +205652,11 @@
205652 pSession->rc = SQLITE_SCHEMA;
205653 return;
205654 }
205655
205656 /* Grow the hash table if required */
205657 if( sessionGrowHash(pSession, 0, pTab) ){
205658 pSession->rc = SQLITE_NOMEM;
205659 return;
205660 }
205661
205662 if( pTab->bStat1 ){
@@ -204525,11 +205719,11 @@
205719 rc = sessionSerializeValue(0, p, &nByte);
205720 if( rc!=SQLITE_OK ) goto error_out;
205721 }
205722
205723 /* Allocate the change object */
205724 pChange = (SessionChange *)sessionMalloc64(pSession, nByte);
205725 if( !pChange ){
205726 rc = SQLITE_NOMEM;
205727 goto error_out;
205728 }else{
205729 memset(pChange, 0, sizeof(SessionChange));
@@ -204898,11 +206092,11 @@
206092 int bHasPk = 0;
206093 int bMismatch = 0;
206094 int nCol; /* Columns in zFrom.zTbl */
206095 u8 *abPK;
206096 const char **azCol = 0;
206097 rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, &abPK);
206098 if( rc==SQLITE_OK ){
206099 if( pTo->nCol!=nCol ){
206100 bMismatch = 1;
206101 }else{
206102 int i;
@@ -204996,11 +206190,11 @@
206190
206191 /*
206192 ** Free the list of table objects passed as the first argument. The contents
206193 ** of the changed-rows hash tables are also deleted.
206194 */
206195 static void sessionDeleteTable(sqlite3_session *pSession, SessionTable *pList){
206196 SessionTable *pNext;
206197 SessionTable *pTab;
206198
206199 for(pTab=pList; pTab; pTab=pNext){
206200 int i;
@@ -205008,16 +206202,16 @@
206202 for(i=0; i<pTab->nChange; i++){
206203 SessionChange *p;
206204 SessionChange *pNextChange;
206205 for(p=pTab->apChange[i]; p; p=pNextChange){
206206 pNextChange = p->pNext;
206207 sessionFree(pSession, p);
206208 }
206209 }
206210 sessionFree(pSession, (char*)pTab->azCol); /* cast works around VC++ bug */
206211 sessionFree(pSession, pTab->apChange);
206212 sessionFree(pSession, pTab);
206213 }
206214 }
206215
206216 /*
206217 ** Delete a session object previously allocated using sqlite3session_create().
@@ -205041,13 +206235,15 @@
206235 sqlite3_mutex_leave(sqlite3_db_mutex(db));
206236 sqlite3ValueFree(pSession->pZeroBlob);
206237
206238 /* Delete all attached table objects. And the contents of their
206239 ** associated hash-tables. */
206240 sessionDeleteTable(pSession, pSession->pTable);
206241
206242 /* Assert that all allocations have been freed and then free the
206243 ** session object itself. */
206244 assert( pSession->nMalloc==0 );
206245 sqlite3_free(pSession);
206246 }
206247
206248 /*
206249 ** Set a table filter on a Session Object.
@@ -205090,11 +206286,12 @@
206286 if( 0==sqlite3_strnicmp(pTab->zName, zName, nName+1) ) break;
206287 }
206288
206289 if( !pTab ){
206290 /* Allocate new SessionTable object. */
206291 int nByte = sizeof(SessionTable) + nName + 1;
206292 pTab = (SessionTable*)sessionMalloc64(pSession, nByte);
206293 if( !pTab ){
206294 rc = SQLITE_NOMEM;
206295 }else{
206296 /* Populate the new SessionTable object and link it into the list.
206297 ** The new object must be linked onto the end of the list, not
@@ -205687,11 +206884,11 @@
206884 sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */
206885 int nRewind = buf.nBuf; /* Initial size of write buffer */
206886 int nNoop; /* Size of buffer after writing tbl header */
206887
206888 /* Check the table schema is still Ok. */
206889 rc = sessionTableInfo(0, db, pSession->zDb, zName, &nCol, 0,&azCol,&abPK);
206890 if( !rc && (pTab->nCol!=nCol || memcmp(abPK, pTab->abPK, nCol)) ){
206891 rc = SQLITE_SCHEMA;
206892 }
206893
206894 /* Write a table header */
@@ -205861,10 +207058,17 @@
207058 }
207059 sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db));
207060
207061 return (ret==0);
207062 }
207063
207064 /*
207065 ** Return the amount of heap memory in use.
207066 */
207067 SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession){
207068 return pSession->nMalloc;
207069 }
207070
207071 /*
207072 ** Do the work for either sqlite3changeset_start() or start_strm().
207073 */
207074 static int sessionChangesetStart(
@@ -207673,11 +208877,11 @@
208877 }else{
208878 int nMinCol = 0;
208879 int i;
208880
208881 sqlite3changeset_pk(pIter, &abPK, 0);
208882 rc = sessionTableInfo(0,
208883 db, "main", zNew, &sApply.nCol, &zTab, &sApply.azCol, &sApply.abPK
208884 );
208885 if( rc!=SQLITE_OK ) break;
208886 for(i=0; i<sApply.nCol; i++){
208887 if( sApply.abPK[i] ) nMinCol = i+1;
@@ -208152,11 +209356,11 @@
209356 rc = SQLITE_SCHEMA;
209357 break;
209358 }
209359 }
209360
209361 if( sessionGrowHash(0, pIter->bPatchset, pTab) ){
209362 rc = SQLITE_NOMEM;
209363 break;
209364 }
209365 iHash = sessionChangeHash(
209366 pTab, (pIter->bPatchset && op==SQLITE_DELETE), aRec, pTab->nChange
@@ -208338,11 +209542,11 @@
209542 /*
209543 ** Delete a changegroup object.
209544 */
209545 SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
209546 if( pGrp ){
209547 sessionDeleteTable(0, pGrp->pList);
209548 sqlite3_free(pGrp);
209549 }
209550 }
209551
209552 /*
@@ -208739,11 +209943,11 @@
209943 /*
209944 ** Destroy a rebaser object
209945 */
209946 SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p){
209947 if( p ){
209948 sessionDeleteTable(0, p->grp.pList);
209949 sqlite3_free(p);
209950 }
209951 }
209952
209953 /*
@@ -211201,59 +212405,10 @@
212405 int fts5yysize; /* Amount to pop the stack */
212406 sqlite3Fts5ParserARG_FETCH
212407 (void)fts5yyLookahead;
212408 (void)fts5yyLookaheadToken;
212409 fts5yymsp = fts5yypParser->fts5yytos;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212410
212411 switch( fts5yyruleno ){
212412 /* Beginning here are the reduction cases. A typical example
212413 ** follows:
212414 ** case 0:
@@ -211552,16 +212707,60 @@
212707 fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact-fts5YY_MIN_REDUCE);
212708 }
212709 }
212710 #endif
212711
212712 while(1){ /* Exit by "break" */
212713 assert( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystack );
212714 assert( fts5yyact==fts5yypParser->fts5yytos->stateno );
212715 fts5yyact = fts5yy_find_shift_action((fts5YYCODETYPE)fts5yymajor,fts5yyact);
212716 if( fts5yyact >= fts5YY_MIN_REDUCE ){
212717 unsigned int fts5yyruleno = fts5yyact - fts5YY_MIN_REDUCE; /* Reduce by this rule */
212718 assert( fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) );
212719 #ifndef NDEBUG
212720 if( fts5yyTraceFILE ){
212721 int fts5yysize = fts5yyRuleInfoNRhs[fts5yyruleno];
212722 if( fts5yysize ){
212723 fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
212724 fts5yyTracePrompt,
212725 fts5yyruleno, fts5yyRuleName[fts5yyruleno],
212726 fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action",
212727 fts5yypParser->fts5yytos[fts5yysize].stateno);
212728 }else{
212729 fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s.\n",
212730 fts5yyTracePrompt, fts5yyruleno, fts5yyRuleName[fts5yyruleno],
212731 fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action");
212732 }
212733 }
212734 #endif /* NDEBUG */
212735
212736 /* Check that the stack is large enough to grow by a single entry
212737 ** if the RHS of the rule is empty. This ensures that there is room
212738 ** enough on the stack to push the LHS value */
212739 if( fts5yyRuleInfoNRhs[fts5yyruleno]==0 ){
212740 #ifdef fts5YYTRACKMAXSTACKDEPTH
212741 if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){
212742 fts5yypParser->fts5yyhwm++;
212743 assert( fts5yypParser->fts5yyhwm ==
212744 (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack));
212745 }
212746 #endif
212747 #if fts5YYSTACKDEPTH>0
212748 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
212749 fts5yyStackOverflow(fts5yypParser);
212750 break;
212751 }
212752 #else
212753 if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
212754 if( fts5yyGrowStack(fts5yypParser) ){
212755 fts5yyStackOverflow(fts5yypParser);
212756 break;
212757 }
212758 }
212759 #endif
212760 }
212761 fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyruleno,fts5yymajor,fts5yyminor sqlite3Fts5ParserCTX_PARAM);
212762 }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
212763 fts5yy_shift(fts5yypParser,fts5yyact,(fts5YYCODETYPE)fts5yymajor,fts5yyminor);
212764 #ifndef fts5YYNOERRORRECOVERY
212765 fts5yypParser->fts5yyerrcnt--;
212766 #endif
@@ -211670,11 +212869,11 @@
212869 #endif
212870 }
212871 break;
212872 #endif
212873 }
212874 }
212875 #ifndef NDEBUG
212876 if( fts5yyTraceFILE ){
212877 fts5yyStackEntry *i;
212878 char cDiv = '[';
212879 fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt);
@@ -215282,12 +216481,12 @@
216481 ){
216482 rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
216483 }
216484
216485 /* If the iterator is not at a real match, skip forward until it is. */
216486 while( pRoot->bNomatch && rc==SQLITE_OK ){
216487 assert( pRoot->bEof==0 );
216488 rc = fts5ExprNodeNext(p, pRoot, 0, 0);
216489 }
216490 return rc;
216491 }
216492
@@ -219468,18 +220667,14 @@
220667 if( pbNewTerm ) *pbNewTerm = 1;
220668 }
220669 }else{
220670 /* The following could be done by calling fts5SegIterLoadNPos(). But
220671 ** this block is particularly performance critical, so equivalent
220672 ** code is inlined. */
 
 
 
 
220673 int nSz;
220674 assert( p->rc==SQLITE_OK );
220675 assert_nc( pIter->iLeafOffset<=pIter->pLeaf->nn );
220676 fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);
220677 pIter->bDel = (nSz & 0x0001);
220678 pIter->nPos = nSz>>1;
220679 assert_nc( pIter->nPos>=0 );
220680 }
@@ -220467,11 +221662,11 @@
221662 u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset];
221663 int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset);
221664 int pgno = pSeg->iLeafPgno;
221665 int pgnoSave = 0;
221666
221667 /* This function does not work with detail=none databases. */
221668 assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );
221669
221670 if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){
221671 pgnoSave = pgno+1;
221672 }
@@ -220480,10 +221675,13 @@
221675 xChunk(p, pCtx, pChunk, nChunk);
221676 nRem -= nChunk;
221677 fts5DataRelease(pData);
221678 if( nRem<=0 ){
221679 break;
221680 }else if( pSeg->pSeg==0 ){
221681 p->rc = FTS5_CORRUPT;
221682 return;
221683 }else{
221684 pgno++;
221685 pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
221686 if( pData==0 ) break;
221687 pChunk = &pData->p[4];
@@ -220531,70 +221729,76 @@
221729 }
221730 }
221731 }
221732
221733 /*
221734 ** Parameter pPos points to a buffer containing a position list, size nPos.
221735 ** This function filters it according to pColset (which must be non-NULL)
221736 ** and sets pIter->base.pData/nData to point to the new position list.
221737 ** If memory is required for the new position list, use buffer pIter->poslist.
221738 ** Or, if the new position list is a contiguous subset of the input, set
221739 ** pIter->base.pData/nData to point directly to it.
221740 **
221741 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
221742 ** called. If an OOM error is encountered, *pRc is set to SQLITE_NOMEM
221743 ** before returning.
221744 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221745 static void fts5IndexExtractColset(
221746 int *pRc,
221747 Fts5Colset *pColset, /* Colset to filter on */
221748 const u8 *pPos, int nPos, /* Position list */
221749 Fts5Iter *pIter
221750 ){
221751 if( *pRc==SQLITE_OK ){
221752 const u8 *p = pPos;
221753 const u8 *aCopy = p;
221754 const u8 *pEnd = &p[nPos]; /* One byte past end of position list */
221755 int i = 0;
221756 int iCurrent = 0;
221757
221758 if( pColset->nCol>1 && sqlite3Fts5BufferSize(pRc, &pIter->poslist, nPos) ){
221759 return;
221760 }
221761
221762 while( 1 ){
221763 while( pColset->aiCol[i]<iCurrent ){
221764 i++;
221765 if( i==pColset->nCol ){
221766 pIter->base.pData = pIter->poslist.p;
221767 pIter->base.nData = pIter->poslist.n;
221768 return;
221769 }
221770 }
221771
221772 /* Advance pointer p until it points to pEnd or an 0x01 byte that is
221773 ** not part of a varint */
221774 while( p<pEnd && *p!=0x01 ){
221775 while( *p++ & 0x80 );
221776 }
221777
221778 if( pColset->aiCol[i]==iCurrent ){
221779 if( pColset->nCol==1 ){
221780 pIter->base.pData = aCopy;
221781 pIter->base.nData = p-aCopy;
221782 return;
221783 }
221784 fts5BufferSafeAppendBlob(&pIter->poslist, aCopy, p-aCopy);
221785 }
221786 if( p==pEnd ){
221787 pIter->base.pData = pIter->poslist.p;
221788 pIter->base.nData = pIter->poslist.n;
221789 return;
221790 }
221791 aCopy = p++;
221792 iCurrent = *p++;
221793 if( iCurrent & 0x80 ){
221794 p--;
221795 p += fts5GetVarint32(p, iCurrent);
221796 }
221797 }
221798 }
221799
221800 }
221801
221802 /*
221803 ** xSetOutputs callback used by detail=none tables.
221804 */
@@ -220710,20 +221914,13 @@
221914
221915 if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
221916 /* All data is stored on the current page. Populate the output
221917 ** variables to point into the body of the page object. */
221918 const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
221919 int *pRc = &pIter->pIndex->rc;
221920 fts5BufferZero(&pIter->poslist);
221921 fts5IndexExtractColset(pRc, pColset, a, pSeg->nPos, pIter);
 
 
 
 
 
 
 
221922 }else{
221923 /* The data is distributed over two or more pages. Copy it into the
221924 ** Fts5Iter.poslist buffer and then set the output pointer to point
221925 ** to this buffer. */
221926 fts5BufferZero(&pIter->poslist);
@@ -222202,11 +223399,11 @@
223399
223400
223401 static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
223402 u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;
223403
223404 assert( pIter->aPoslist || (p==0 && pIter->aPoslist==0) );
223405 if( p>=pIter->aEof ){
223406 pIter->aPoslist = 0;
223407 }else{
223408 i64 iDelta;
223409
@@ -222286,20 +223483,24 @@
223483 ** In this case the buffers consist of a delta-encoded list of rowids only.
223484 */
223485 static void fts5MergeRowidLists(
223486 Fts5Index *p, /* FTS5 backend object */
223487 Fts5Buffer *p1, /* First list to merge */
223488 int nBuf, /* Number of entries in apBuf[] */
223489 Fts5Buffer *aBuf /* Array of other lists to merge into p1 */
223490 ){
223491 int i1 = 0;
223492 int i2 = 0;
223493 i64 iRowid1 = 0;
223494 i64 iRowid2 = 0;
223495 i64 iOut = 0;
223496 Fts5Buffer *p2 = &aBuf[0];
223497 Fts5Buffer out;
223498
223499 (void)nBuf;
223500 memset(&out, 0, sizeof(out));
223501 assert( nBuf==1 );
223502 sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);
223503 if( p->rc ) return;
223504
223505 fts5NextRowid(p1, &i1, &iRowid1);
223506 fts5NextRowid(p2, &i2, &iRowid2);
@@ -222321,185 +223522,218 @@
223522 }
223523
223524 fts5BufferSwap(&out, p1);
223525 fts5BufferFree(&out);
223526 }
223527
223528 typedef struct PrefixMerger PrefixMerger;
223529 struct PrefixMerger {
223530 Fts5DoclistIter iter; /* Doclist iterator */
223531 i64 iPos; /* For iterating through a position list */
223532 int iOff;
223533 u8 *aPos;
223534 PrefixMerger *pNext; /* Next in docid/poslist order */
223535 };
223536
223537 static void fts5PrefixMergerInsertByRowid(
223538 PrefixMerger **ppHead,
223539 PrefixMerger *p
223540 ){
223541 if( p->iter.aPoslist ){
223542 PrefixMerger **pp = ppHead;
223543 while( *pp && p->iter.iRowid>(*pp)->iter.iRowid ){
223544 pp = &(*pp)->pNext;
223545 }
223546 p->pNext = *pp;
223547 *pp = p;
223548 }
223549 }
223550
223551 static void fts5PrefixMergerInsertByPosition(
223552 PrefixMerger **ppHead,
223553 PrefixMerger *p
223554 ){
223555 if( p->iPos>=0 ){
223556 PrefixMerger **pp = ppHead;
223557 while( *pp && p->iPos>(*pp)->iPos ){
223558 pp = &(*pp)->pNext;
223559 }
223560 p->pNext = *pp;
223561 *pp = p;
223562 }
223563 }
223564
223565
223566 /*
223567 ** Array aBuf[] contains nBuf doclists. These are all merged in with the
223568 ** doclist in buffer p1.
 
 
 
 
223569 */
223570 static void fts5MergePrefixLists(
223571 Fts5Index *p, /* FTS5 backend object */
223572 Fts5Buffer *p1, /* First list to merge */
223573 int nBuf, /* Number of buffers in array aBuf[] */
223574 Fts5Buffer *aBuf /* Other lists to merge in */
223575 ){
223576 #define fts5PrefixMergerNextPosition(p) \
223577 sqlite3Fts5PoslistNext64((p)->aPos,(p)->iter.nPoslist,&(p)->iOff,&(p)->iPos);
223578 #define FTS5_MERGE_NLIST 16
223579 PrefixMerger aMerger[FTS5_MERGE_NLIST];
223580 PrefixMerger *pHead = 0;
223581 int i;
223582 int nOut = 0;
223583 Fts5Buffer out = {0, 0, 0};
223584 Fts5Buffer tmp = {0, 0, 0};
223585 i64 iLastRowid = 0;
223586
223587 /* Initialize a doclist-iterator for each input buffer. Arrange them in
223588 ** a linked-list starting at pHead in ascending order of rowid. Avoid
223589 ** linking any iterators already at EOF into the linked list at all. */
223590 assert( nBuf+1<=sizeof(aMerger)/sizeof(aMerger[0]) );
223591 memset(aMerger, 0, sizeof(PrefixMerger)*(nBuf+1));
223592 pHead = &aMerger[nBuf];
223593 fts5DoclistIterInit(p1, &pHead->iter);
223594 for(i=0; i<nBuf; i++){
223595 fts5DoclistIterInit(&aBuf[i], &aMerger[i].iter);
223596 fts5PrefixMergerInsertByRowid(&pHead, &aMerger[i]);
223597 nOut += aBuf[i].n;
223598 }
223599 if( nOut==0 ) return;
223600 nOut += p1->n + 9 + 10*nBuf;
223601
223602 /* The maximum size of the output is equal to the sum of the
223603 ** input sizes + 1 varint (9 bytes). The extra varint is because if the
223604 ** first rowid in one input is a large negative number, and the first in
223605 ** the other a non-negative number, the delta for the non-negative
223606 ** number will be larger on disk than the literal integer value
223607 ** was.
223608 **
223609 ** Or, if the input position-lists are corrupt, then the output might
223610 ** include up to (nBuf+1) extra 10-byte positions created by interpreting -1
223611 ** (the value PoslistNext64() uses for EOF) as a position and appending
223612 ** it to the output. This can happen at most once for each input
223613 ** position-list, hence (nBuf+1) 10 byte paddings. */
223614 if( sqlite3Fts5BufferSize(&p->rc, &out, nOut) ) return;
223615
223616 while( pHead ){
223617 fts5MergeAppendDocid(&out, iLastRowid, pHead->iter.iRowid);
223618
223619 if( pHead->pNext && iLastRowid==pHead->pNext->iter.iRowid ){
223620 /* Merge data from two or more poslists */
223621 i64 iPrev = 0;
223622 int nTmp = FTS5_DATA_ZERO_PADDING;
223623 int nMerge = 0;
223624 PrefixMerger *pSave = pHead;
223625 PrefixMerger *pThis = 0;
223626 int nTail = 0;
223627
223628 pHead = 0;
223629 while( pSave && pSave->iter.iRowid==iLastRowid ){
223630 PrefixMerger *pNext = pSave->pNext;
223631 pSave->iOff = 0;
223632 pSave->iPos = 0;
223633 pSave->aPos = &pSave->iter.aPoslist[pSave->iter.nSize];
223634 fts5PrefixMergerNextPosition(pSave);
223635 nTmp += pSave->iter.nPoslist + 10;
223636 nMerge++;
223637 fts5PrefixMergerInsertByPosition(&pHead, pSave);
223638 pSave = pNext;
223639 }
223640
223641 if( pHead==0 || pHead->pNext==0 ){
223642 p->rc = FTS5_CORRUPT;
223643 break;
223644 }
223645
223646 /* See the earlier comment in this function for an explanation of why
223647 ** corrupt input position lists might cause the output to consume
223648 ** at most nMerge*10 bytes of unexpected space. */
223649 if( sqlite3Fts5BufferSize(&p->rc, &tmp, nTmp+nMerge*10) ){
223650 break;
223651 }
223652 fts5BufferZero(&tmp);
223653
223654 pThis = pHead;
223655 pHead = pThis->pNext;
223656 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
223657 fts5PrefixMergerNextPosition(pThis);
223658 fts5PrefixMergerInsertByPosition(&pHead, pThis);
223659
223660 while( pHead->pNext ){
223661 pThis = pHead;
223662 if( pThis->iPos!=iPrev ){
223663 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
223664 }
223665 fts5PrefixMergerNextPosition(pThis);
223666 pHead = pThis->pNext;
223667 fts5PrefixMergerInsertByPosition(&pHead, pThis);
223668 }
223669
223670 if( pHead->iPos!=iPrev ){
223671 sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pHead->iPos);
223672 }
223673 nTail = pHead->iter.nPoslist - pHead->iOff;
223674
223675 /* WRITEPOSLISTSIZE */
223676 assert( tmp.n+nTail<=nTmp );
223677 if( tmp.n+nTail>nTmp-FTS5_DATA_ZERO_PADDING ){
223678 if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
223679 break;
223680 }
223681 fts5BufferSafeAppendVarint(&out, (tmp.n+nTail) * 2);
223682 fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
223683 if( nTail>0 ){
223684 fts5BufferSafeAppendBlob(&out, &pHead->aPos[pHead->iOff], nTail);
223685 }
223686
223687 pHead = pSave;
223688 for(i=0; i<nBuf+1; i++){
223689 PrefixMerger *pX = &aMerger[i];
223690 if( pX->iter.aPoslist && pX->iter.iRowid==iLastRowid ){
223691 fts5DoclistIterNext(&pX->iter);
223692 fts5PrefixMergerInsertByRowid(&pHead, pX);
223693 }
223694 }
223695
223696 }else{
223697 /* Copy poslist from pHead to output */
223698 PrefixMerger *pThis = pHead;
223699 Fts5DoclistIter *pI = &pThis->iter;
223700 fts5BufferSafeAppendBlob(&out, pI->aPoslist, pI->nPoslist+pI->nSize);
223701 fts5DoclistIterNext(pI);
223702 pHead = pThis->pNext;
223703 fts5PrefixMergerInsertByRowid(&pHead, pThis);
223704 }
223705 }
223706
223707 fts5BufferFree(p1);
223708 fts5BufferFree(&tmp);
223709 memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
223710 *p1 = out;
 
 
 
 
 
223711 }
223712
223713 static void fts5SetupPrefixIter(
223714 Fts5Index *p, /* Index to read from */
223715 int bDesc, /* True for "ORDER BY rowid DESC" */
223716 int iIdx, /* Index to scan for data */
223717 u8 *pToken, /* Buffer containing prefix to match */
223718 int nToken, /* Size of buffer pToken in bytes */
223719 Fts5Colset *pColset, /* Restrict matches to these columns */
223720 Fts5Iter **ppIter /* OUT: New iterator */
223721 ){
223722 Fts5Structure *pStruct;
223723 Fts5Buffer *aBuf;
223724 int nBuf = 32;
223725 int nMerge = 1;
223726
223727 void (*xMerge)(Fts5Index*, Fts5Buffer*, int, Fts5Buffer*);
223728 void (*xAppend)(Fts5Index*, i64, Fts5Iter*, Fts5Buffer*);
223729 if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
223730 xMerge = fts5MergeRowidLists;
223731 xAppend = fts5AppendRowid;
223732 }else{
223733 nMerge = FTS5_MERGE_NLIST-1;
223734 nBuf = nMerge*8; /* Sufficient to merge (16^8)==(2^32) lists */
223735 xMerge = fts5MergePrefixLists;
223736 xAppend = fts5AppendPoslist;
223737 }
223738
223739 aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);
@@ -222515,10 +223749,31 @@
223749 Fts5Data *pData;
223750 Fts5Buffer doclist;
223751 int bNewTerm = 1;
223752
223753 memset(&doclist, 0, sizeof(doclist));
223754 if( iIdx!=0 ){
223755 int dummy = 0;
223756 const int f2 = FTS5INDEX_QUERY_SKIPEMPTY|FTS5INDEX_QUERY_NOOUTPUT;
223757 pToken[0] = FTS5_MAIN_PREFIX;
223758 fts5MultiIterNew(p, pStruct, f2, pColset, pToken, nToken, -1, 0, &p1);
223759 fts5IterSetOutputCb(&p->rc, p1);
223760 for(;
223761 fts5MultiIterEof(p, p1)==0;
223762 fts5MultiIterNext2(p, p1, &dummy)
223763 ){
223764 Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
223765 p1->xSetOutputs(p1, pSeg);
223766 if( p1->base.nData ){
223767 xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
223768 iLastRowid = p1->base.iRowid;
223769 }
223770 }
223771 fts5MultiIterFree(p1);
223772 }
223773
223774 pToken[0] = FTS5_MAIN_PREFIX + iIdx;
223775 fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
223776 fts5IterSetOutputCb(&p->rc, p1);
223777 for( /* no-op */ ;
223778 fts5MultiIterEof(p, p1)==0;
223779 fts5MultiIterNext2(p, p1, &bNewTerm)
@@ -222535,31 +223790,43 @@
223790
223791 if( p1->base.nData==0 ) continue;
223792
223793 if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
223794 for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
223795 int i1 = i*nMerge;
223796 int iStore;
223797 assert( i1+nMerge<=nBuf );
223798 for(iStore=i1; iStore<i1+nMerge; iStore++){
223799 if( aBuf[iStore].n==0 ){
223800 fts5BufferSwap(&doclist, &aBuf[iStore]);
223801 fts5BufferZero(&doclist);
223802 break;
223803 }
223804 }
223805 if( iStore==i1+nMerge ){
223806 xMerge(p, &doclist, nMerge, &aBuf[i1]);
223807 for(iStore=i1; iStore<i1+nMerge; iStore++){
223808 fts5BufferZero(&aBuf[iStore]);
223809 }
223810 }
223811 }
223812 iLastRowid = 0;
223813 }
223814
223815 xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
223816 iLastRowid = p1->base.iRowid;
223817 }
223818
223819 assert( (nBuf%nMerge)==0 );
223820 for(i=0; i<nBuf; i+=nMerge){
223821 int iFree;
223822 if( p->rc==SQLITE_OK ){
223823 xMerge(p, &doclist, nMerge, &aBuf[i]);
223824 }
223825 for(iFree=i; iFree<i+nMerge; iFree++){
223826 fts5BufferFree(&aBuf[iFree]);
223827 }
223828 }
223829 fts5MultiIterFree(p1);
223830
223831 pData = fts5IdxMalloc(p, sizeof(Fts5Data)+doclist.n+FTS5_DATA_ZERO_PADDING);
223832 if( pData ){
@@ -222810,10 +224077,11 @@
224077 /* If the QUERY_SCAN flag is set, all other flags must be clear. */
224078 assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
224079
224080 if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
224081 int iIdx = 0; /* Index to search */
224082 int iPrefixIdx = 0; /* +1 prefix index */
224083 if( nToken ) memcpy(&buf.p[1], pToken, nToken);
224084
224085 /* Figure out which index to search and set iIdx accordingly. If this
224086 ** is a prefix query for which there is no prefix index, set iIdx to
224087 ** greater than pConfig->nPrefix to indicate that the query will be
@@ -222831,11 +224099,13 @@
224099 }else
224100 #endif
224101 if( flags & FTS5INDEX_QUERY_PREFIX ){
224102 int nChar = fts5IndexCharlen(pToken, nToken);
224103 for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
224104 int nIdxChar = pConfig->aPrefix[iIdx-1];
224105 if( nIdxChar==nChar ) break;
224106 if( nIdxChar==nChar+1 ) iPrefixIdx = iIdx;
224107 }
224108 }
224109
224110 if( iIdx<=pConfig->nPrefix ){
224111 /* Straight index lookup */
@@ -222848,12 +224118,11 @@
224118 fts5StructureRelease(pStruct);
224119 }
224120 }else{
224121 /* Scan multiple terms in the main index */
224122 int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
224123 fts5SetupPrefixIter(p, bDesc, iPrefixIdx, buf.p, nToken+1, pColset,&pRet);
 
224124 assert( p->rc!=SQLITE_OK || pRet->pColset==0 );
224125 fts5IterSetOutputCb(&p->rc, pRet);
224126 if( p->rc==SQLITE_OK ){
224127 Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];
224128 if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
@@ -226817,11 +228086,11 @@
228086 int nArg, /* Number of args */
228087 sqlite3_value **apUnused /* Function arguments */
228088 ){
228089 assert( nArg==0 );
228090 UNUSED_PARAM2(nArg, apUnused);
228091 sqlite3_result_text(pCtx, "fts5: 2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18df9a04", -1, SQLITE_TRANSIENT);
228092 }
228093
228094 /*
228095 ** Return true if zName is the extension on one of the shadow tables used
228096 ** by this module.
@@ -231743,12 +233012,12 @@
233012 }
233013 #endif /* SQLITE_CORE */
233014 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
233015
233016 /************** End of stmt.c ************************************************/
233017 #if __LINE__!=233017
233018 #undef SQLITE_SOURCE_ID
233019 #define SQLITE_SOURCE_ID "2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18dfalt2"
233020 #endif
233021 /* Return the source-id for this library */
233022 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
233023 /************************** End of sqlite3.c ******************************/
233024
+15 -5
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121121
**
122122
** See also: [sqlite3_libversion()],
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126
-#define SQLITE_VERSION "3.34.0"
127
-#define SQLITE_VERSION_NUMBER 3034000
128
-#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
126
+#define SQLITE_VERSION "3.35.0"
127
+#define SQLITE_VERSION_NUMBER 3035000
128
+#define SQLITE_SOURCE_ID "2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18df9a04"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -3497,10 +3497,11 @@
34973497
** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
34983498
** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
34993499
** that uses dot-files in place of posix advisory locking.
35003500
** <tr><td> file:data.db?mode=readonly <td>
35013501
** An error. "readonly" is not a valid option for the "mode" parameter.
3502
+** Use "ro" instead: "file:data.db?mode=ro".
35023503
** </table>
35033504
**
35043505
** ^URI hexadecimal escape sequences (%HH) are supported within the path and
35053506
** query components of a URI. A hexadecimal escape sequence consists of a
35063507
** percent sign - "%" - followed by exactly two hexadecimal digits
@@ -3695,11 +3696,11 @@
36953696
** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
36963697
**
36973698
** If the Y parameter to sqlite3_free_filename(Y) is anything other
36983699
** than a NULL pointer or a pointer previously acquired from
36993700
** sqlite3_create_filename(), then bad things such as heap
3700
-** corruption or segfaults may occur. The value Y should be
3701
+** corruption or segfaults may occur. The value Y should not be
37013702
** used again after sqlite3_free_filename(Y) has been called. This means
37023703
** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
37033704
** then the corresponding [sqlite3_module.xClose() method should also be
37043705
** invoked prior to calling sqlite3_free_filename(Y).
37053706
*/
@@ -7763,11 +7764,12 @@
77637764
#define SQLITE_TESTCTRL_PARSER_COVERAGE 26
77647765
#define SQLITE_TESTCTRL_RESULT_INTREAL 27
77657766
#define SQLITE_TESTCTRL_PRNG_SEED 28
77667767
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
77677768
#define SQLITE_TESTCTRL_SEEK_COUNT 30
7768
-#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
7769
+#define SQLITE_TESTCTRL_TRACEFLAGS 31
7770
+#define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
77697771
77707772
/*
77717773
** CAPI3REF: SQL Keyword Checking
77727774
**
77737775
** These routines provide access to the set of SQL language keywords
@@ -10436,10 +10438,18 @@
1043610438
** guaranteed that a call to sqlite3session_changeset() will return a
1043710439
** changeset containing zero changes.
1043810440
*/
1043910441
SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
1044010442
10443
+/*
10444
+** CAPI3REF: Query for the amount of heap memory used by a session object.
10445
+**
10446
+** This API returns the total amount of heap memory in bytes currently
10447
+** used by the session object passed as the only argument.
10448
+*/
10449
+SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
10450
+
1044110451
/*
1044210452
** CAPI3REF: Create An Iterator To Traverse A Changeset
1044310453
** CONSTRUCTOR: sqlite3_changeset_iter
1044410454
**
1044510455
** Create an iterator used to iterate through the contents of a changeset.
1044610456
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.34.0"
127 #define SQLITE_VERSION_NUMBER 3034000
128 #define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -3497,10 +3497,11 @@
3497 ** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
3498 ** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
3499 ** that uses dot-files in place of posix advisory locking.
3500 ** <tr><td> file:data.db?mode=readonly <td>
3501 ** An error. "readonly" is not a valid option for the "mode" parameter.
 
3502 ** </table>
3503 **
3504 ** ^URI hexadecimal escape sequences (%HH) are supported within the path and
3505 ** query components of a URI. A hexadecimal escape sequence consists of a
3506 ** percent sign - "%" - followed by exactly two hexadecimal digits
@@ -3695,11 +3696,11 @@
3695 ** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
3696 **
3697 ** If the Y parameter to sqlite3_free_filename(Y) is anything other
3698 ** than a NULL pointer or a pointer previously acquired from
3699 ** sqlite3_create_filename(), then bad things such as heap
3700 ** corruption or segfaults may occur. The value Y should be
3701 ** used again after sqlite3_free_filename(Y) has been called. This means
3702 ** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
3703 ** then the corresponding [sqlite3_module.xClose() method should also be
3704 ** invoked prior to calling sqlite3_free_filename(Y).
3705 */
@@ -7763,11 +7764,12 @@
7763 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
7764 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
7765 #define SQLITE_TESTCTRL_PRNG_SEED 28
7766 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
7767 #define SQLITE_TESTCTRL_SEEK_COUNT 30
7768 #define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
 
7769
7770 /*
7771 ** CAPI3REF: SQL Keyword Checking
7772 **
7773 ** These routines provide access to the set of SQL language keywords
@@ -10436,10 +10438,18 @@
10436 ** guaranteed that a call to sqlite3session_changeset() will return a
10437 ** changeset containing zero changes.
10438 */
10439 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
10440
 
 
 
 
 
 
 
 
10441 /*
10442 ** CAPI3REF: Create An Iterator To Traverse A Changeset
10443 ** CONSTRUCTOR: sqlite3_changeset_iter
10444 **
10445 ** Create an iterator used to iterate through the contents of a changeset.
10446
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.35.0"
127 #define SQLITE_VERSION_NUMBER 3035000
128 #define SQLITE_SOURCE_ID "2021-01-18 12:35:16 c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18df9a04"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -3497,10 +3497,11 @@
3497 ** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
3498 ** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
3499 ** that uses dot-files in place of posix advisory locking.
3500 ** <tr><td> file:data.db?mode=readonly <td>
3501 ** An error. "readonly" is not a valid option for the "mode" parameter.
3502 ** Use "ro" instead: "file:data.db?mode=ro".
3503 ** </table>
3504 **
3505 ** ^URI hexadecimal escape sequences (%HH) are supported within the path and
3506 ** query components of a URI. A hexadecimal escape sequence consists of a
3507 ** percent sign - "%" - followed by exactly two hexadecimal digits
@@ -3695,11 +3696,11 @@
3696 ** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
3697 **
3698 ** If the Y parameter to sqlite3_free_filename(Y) is anything other
3699 ** than a NULL pointer or a pointer previously acquired from
3700 ** sqlite3_create_filename(), then bad things such as heap
3701 ** corruption or segfaults may occur. The value Y should not be
3702 ** used again after sqlite3_free_filename(Y) has been called. This means
3703 ** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
3704 ** then the corresponding [sqlite3_module.xClose() method should also be
3705 ** invoked prior to calling sqlite3_free_filename(Y).
3706 */
@@ -7763,11 +7764,12 @@
7764 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
7765 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
7766 #define SQLITE_TESTCTRL_PRNG_SEED 28
7767 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
7768 #define SQLITE_TESTCTRL_SEEK_COUNT 30
7769 #define SQLITE_TESTCTRL_TRACEFLAGS 31
7770 #define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
7771
7772 /*
7773 ** CAPI3REF: SQL Keyword Checking
7774 **
7775 ** These routines provide access to the set of SQL language keywords
@@ -10436,10 +10438,18 @@
10438 ** guaranteed that a call to sqlite3session_changeset() will return a
10439 ** changeset containing zero changes.
10440 */
10441 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
10442
10443 /*
10444 ** CAPI3REF: Query for the amount of heap memory used by a session object.
10445 **
10446 ** This API returns the total amount of heap memory in bytes currently
10447 ** used by the session object passed as the only argument.
10448 */
10449 SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
10450
10451 /*
10452 ** CAPI3REF: Create An Iterator To Traverse A Changeset
10453 ** CONSTRUCTOR: sqlite3_changeset_iter
10454 **
10455 ** Create an iterator used to iterate through the contents of a changeset.
10456
+23 -7
--- src/stat.c
+++ src/stat.c
@@ -217,10 +217,21 @@
217217
@ <tr><th>Number&nbsp;Of&nbsp;Wiki&nbsp;Pages:</th><td>
218218
n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
219219
" WHERE +tagname GLOB 'wiki-*'");
220220
@ %,d(n)
221221
@ </td></tr>
222
+ if( db_table_exists("repository","chat") ){
223
+ sqlite3_int64 sz = 0;
224
+ char zSz[100];
225
+ n = db_int(0, "SELECT max(msgid) FROM chat");
226
+ m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE");
227
+ sz = db_int64(0, "SELECT sum(coalesce(length(xmsg),0)+"
228
+ "coalesce(length(file),0)) FROM chat");
229
+ approxSizeName(sizeof(zSz), zSz, sz);
230
+ @ <tr><th>Number&nbsp;Of&nbsp;Chat&nbsp;Messages:</th>
231
+ @ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr>
232
+ }
222233
n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
223234
" WHERE +tagname GLOB 'tkt-*'");
224235
if( n>0 ){
225236
@ <tr><th>Number&nbsp;Of&nbsp;Tickets:</th><td>%,d(n)</td></tr>
226237
}
@@ -288,11 +299,11 @@
288299
if( g.perm.Admin && alert_enabled() ){
289300
stats_for_email();
290301
}
291302
292303
@ </table>
293
- style_finish_page("stat");
304
+ style_finish_page();
294305
}
295306
296307
/*
297308
** COMMAND: dbstat
298309
**
@@ -459,10 +470,11 @@
459470
sqlite3_int64 iNow;
460471
char *zRemote;
461472
login_check_credentials();
462473
if( !g.perm.Admin ){ login_needed(0); return; }
463474
475
+ style_set_current_feature("stat");
464476
style_header("URLs and Checkouts");
465477
style_adunit_config(ADUNIT_RIGHT_OK);
466478
style_submenu_element("Stat", "stat");
467479
style_submenu_element("Schema", "repo_schema");
468480
iNow = db_int64(0, "SELECT strftime('%%s','now')");
@@ -516,11 +528,11 @@
516528
}else{
517529
@ <p>%h(zRemote)</p>
518530
}
519531
@ </div>
520532
}
521
- style_finish_page("stat");
533
+ style_finish_page();
522534
}
523535
524536
/*
525537
** WEBPAGE: repo_schema
526538
**
@@ -531,10 +543,11 @@
531543
Blob sql;
532544
const char *zArg = P("n");
533545
login_check_credentials();
534546
if( !g.perm.Admin ){ login_needed(0); return; }
535547
548
+ style_set_current_feature("stat");
536549
style_header("Repository Schema");
537550
style_adunit_config(ADUNIT_RIGHT_OK);
538551
style_submenu_element("Stat", "stat");
539552
style_submenu_element("URLs", "urllist");
540553
if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){
@@ -574,11 +587,11 @@
574587
db_finalize(&q);
575588
}else{
576589
style_submenu_element("Stat1","repo_stat1");
577590
}
578591
}
579
- style_finish_page("stat");
592
+ style_finish_page();
580593
}
581594
582595
/*
583596
** WEBPAGE: repo_stat1
584597
**
@@ -586,10 +599,11 @@
586599
*/
587600
void repo_stat1_page(void){
588601
login_check_credentials();
589602
if( !g.perm.Admin ){ login_needed(0); return; }
590603
604
+ style_set_current_feature("stat");
591605
style_header("Repository STAT1 Table");
592606
style_adunit_config(ADUNIT_RIGHT_OK);
593607
style_submenu_element("Stat", "stat");
594608
style_submenu_element("Schema", "repo_schema");
595609
if( db_table_exists("repository","sqlite_stat1") ){
@@ -606,11 +620,11 @@
606620
@ INSERT INTO sqlite_stat1 VALUES('%z(zUrl)%h(zTab)</a>','%h(zIdx)','%h(zStat)');
607621
}
608622
@ </pre>
609623
db_finalize(&q);
610624
}
611
- style_finish_page("stat");
625
+ style_finish_page();
612626
}
613627
614628
/*
615629
** WEBPAGE: repo-tabsize
616630
**
@@ -621,10 +635,11 @@
621635
sqlite3_int64 fsize;
622636
char zBuf[100];
623637
624638
login_check_credentials();
625639
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
640
+ style_set_current_feature("stat");
626641
style_header("Repository Table Sizes");
627642
style_adunit_config(ADUNIT_RIGHT_OK);
628643
style_submenu_element("Stat", "stat");
629644
if( g.perm.Admin ){
630645
style_submenu_element("Schema", "repo_schema");
@@ -678,11 +693,11 @@
678693
@ <h2>%h(file_tail(g.zLocalDbName)) Size: %s(zBuf)</h2>
679694
@ <center><svg width='800' height='500'>
680695
piechart_render(800,500,PIE_OTHER|PIE_PERCENT);
681696
@ </svg></center>
682697
}
683
- style_finish_page("stat");
698
+ style_finish_page();
684699
}
685700
686701
/*
687702
** Gather statistics on artifact types, counts, and sizes.
688703
**
@@ -798,10 +813,11 @@
798813
login_needed(g.anon.Write);
799814
return;
800815
}
801816
load_control();
802817
818
+ style_set_current_feature("stat");
803819
style_header("Artifact Statistics");
804820
style_submenu_element("Repository Stats", "stat");
805821
style_submenu_element("Artifact List", "bloblist");
806822
gather_artifact_stats(1);
807823
@@ -819,11 +835,11 @@
819835
sumCmpr = db_column_int64(&q, 4);
820836
sumExp = db_column_int64(&q, 5);
821837
db_finalize(&q);
822838
if( nTotal==0 ){
823839
@ No artifacts in this repository!
824
- style_finish_page("stat");
840
+ style_finish_page();
825841
return;
826842
}
827843
avgCmpr = (double)sumCmpr/nTotal;
828844
avgExp = (double)sumExp/nTotal;
829845
@@ -964,7 +980,7 @@
964980
}
965981
@ </tbody></table></div>
966982
db_finalize(&q);
967983
}
968984
style_table_sorter();
969
- style_finish_page("stat");
985
+ style_finish_page();
970986
}
971987
--- src/stat.c
+++ src/stat.c
@@ -217,10 +217,21 @@
217 @ <tr><th>Number&nbsp;Of&nbsp;Wiki&nbsp;Pages:</th><td>
218 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
219 " WHERE +tagname GLOB 'wiki-*'");
220 @ %,d(n)
221 @ </td></tr>
 
 
 
 
 
 
 
 
 
 
 
222 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
223 " WHERE +tagname GLOB 'tkt-*'");
224 if( n>0 ){
225 @ <tr><th>Number&nbsp;Of&nbsp;Tickets:</th><td>%,d(n)</td></tr>
226 }
@@ -288,11 +299,11 @@
288 if( g.perm.Admin && alert_enabled() ){
289 stats_for_email();
290 }
291
292 @ </table>
293 style_finish_page("stat");
294 }
295
296 /*
297 ** COMMAND: dbstat
298 **
@@ -459,10 +470,11 @@
459 sqlite3_int64 iNow;
460 char *zRemote;
461 login_check_credentials();
462 if( !g.perm.Admin ){ login_needed(0); return; }
463
 
464 style_header("URLs and Checkouts");
465 style_adunit_config(ADUNIT_RIGHT_OK);
466 style_submenu_element("Stat", "stat");
467 style_submenu_element("Schema", "repo_schema");
468 iNow = db_int64(0, "SELECT strftime('%%s','now')");
@@ -516,11 +528,11 @@
516 }else{
517 @ <p>%h(zRemote)</p>
518 }
519 @ </div>
520 }
521 style_finish_page("stat");
522 }
523
524 /*
525 ** WEBPAGE: repo_schema
526 **
@@ -531,10 +543,11 @@
531 Blob sql;
532 const char *zArg = P("n");
533 login_check_credentials();
534 if( !g.perm.Admin ){ login_needed(0); return; }
535
 
536 style_header("Repository Schema");
537 style_adunit_config(ADUNIT_RIGHT_OK);
538 style_submenu_element("Stat", "stat");
539 style_submenu_element("URLs", "urllist");
540 if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){
@@ -574,11 +587,11 @@
574 db_finalize(&q);
575 }else{
576 style_submenu_element("Stat1","repo_stat1");
577 }
578 }
579 style_finish_page("stat");
580 }
581
582 /*
583 ** WEBPAGE: repo_stat1
584 **
@@ -586,10 +599,11 @@
586 */
587 void repo_stat1_page(void){
588 login_check_credentials();
589 if( !g.perm.Admin ){ login_needed(0); return; }
590
 
591 style_header("Repository STAT1 Table");
592 style_adunit_config(ADUNIT_RIGHT_OK);
593 style_submenu_element("Stat", "stat");
594 style_submenu_element("Schema", "repo_schema");
595 if( db_table_exists("repository","sqlite_stat1") ){
@@ -606,11 +620,11 @@
606 @ INSERT INTO sqlite_stat1 VALUES('%z(zUrl)%h(zTab)</a>','%h(zIdx)','%h(zStat)');
607 }
608 @ </pre>
609 db_finalize(&q);
610 }
611 style_finish_page("stat");
612 }
613
614 /*
615 ** WEBPAGE: repo-tabsize
616 **
@@ -621,10 +635,11 @@
621 sqlite3_int64 fsize;
622 char zBuf[100];
623
624 login_check_credentials();
625 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
 
626 style_header("Repository Table Sizes");
627 style_adunit_config(ADUNIT_RIGHT_OK);
628 style_submenu_element("Stat", "stat");
629 if( g.perm.Admin ){
630 style_submenu_element("Schema", "repo_schema");
@@ -678,11 +693,11 @@
678 @ <h2>%h(file_tail(g.zLocalDbName)) Size: %s(zBuf)</h2>
679 @ <center><svg width='800' height='500'>
680 piechart_render(800,500,PIE_OTHER|PIE_PERCENT);
681 @ </svg></center>
682 }
683 style_finish_page("stat");
684 }
685
686 /*
687 ** Gather statistics on artifact types, counts, and sizes.
688 **
@@ -798,10 +813,11 @@
798 login_needed(g.anon.Write);
799 return;
800 }
801 load_control();
802
 
803 style_header("Artifact Statistics");
804 style_submenu_element("Repository Stats", "stat");
805 style_submenu_element("Artifact List", "bloblist");
806 gather_artifact_stats(1);
807
@@ -819,11 +835,11 @@
819 sumCmpr = db_column_int64(&q, 4);
820 sumExp = db_column_int64(&q, 5);
821 db_finalize(&q);
822 if( nTotal==0 ){
823 @ No artifacts in this repository!
824 style_finish_page("stat");
825 return;
826 }
827 avgCmpr = (double)sumCmpr/nTotal;
828 avgExp = (double)sumExp/nTotal;
829
@@ -964,7 +980,7 @@
964 }
965 @ </tbody></table></div>
966 db_finalize(&q);
967 }
968 style_table_sorter();
969 style_finish_page("stat");
970 }
971
--- src/stat.c
+++ src/stat.c
@@ -217,10 +217,21 @@
217 @ <tr><th>Number&nbsp;Of&nbsp;Wiki&nbsp;Pages:</th><td>
218 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
219 " WHERE +tagname GLOB 'wiki-*'");
220 @ %,d(n)
221 @ </td></tr>
222 if( db_table_exists("repository","chat") ){
223 sqlite3_int64 sz = 0;
224 char zSz[100];
225 n = db_int(0, "SELECT max(msgid) FROM chat");
226 m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE");
227 sz = db_int64(0, "SELECT sum(coalesce(length(xmsg),0)+"
228 "coalesce(length(file),0)) FROM chat");
229 approxSizeName(sizeof(zSz), zSz, sz);
230 @ <tr><th>Number&nbsp;Of&nbsp;Chat&nbsp;Messages:</th>
231 @ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr>
232 }
233 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
234 " WHERE +tagname GLOB 'tkt-*'");
235 if( n>0 ){
236 @ <tr><th>Number&nbsp;Of&nbsp;Tickets:</th><td>%,d(n)</td></tr>
237 }
@@ -288,11 +299,11 @@
299 if( g.perm.Admin && alert_enabled() ){
300 stats_for_email();
301 }
302
303 @ </table>
304 style_finish_page();
305 }
306
307 /*
308 ** COMMAND: dbstat
309 **
@@ -459,10 +470,11 @@
470 sqlite3_int64 iNow;
471 char *zRemote;
472 login_check_credentials();
473 if( !g.perm.Admin ){ login_needed(0); return; }
474
475 style_set_current_feature("stat");
476 style_header("URLs and Checkouts");
477 style_adunit_config(ADUNIT_RIGHT_OK);
478 style_submenu_element("Stat", "stat");
479 style_submenu_element("Schema", "repo_schema");
480 iNow = db_int64(0, "SELECT strftime('%%s','now')");
@@ -516,11 +528,11 @@
528 }else{
529 @ <p>%h(zRemote)</p>
530 }
531 @ </div>
532 }
533 style_finish_page();
534 }
535
536 /*
537 ** WEBPAGE: repo_schema
538 **
@@ -531,10 +543,11 @@
543 Blob sql;
544 const char *zArg = P("n");
545 login_check_credentials();
546 if( !g.perm.Admin ){ login_needed(0); return; }
547
548 style_set_current_feature("stat");
549 style_header("Repository Schema");
550 style_adunit_config(ADUNIT_RIGHT_OK);
551 style_submenu_element("Stat", "stat");
552 style_submenu_element("URLs", "urllist");
553 if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){
@@ -574,11 +587,11 @@
587 db_finalize(&q);
588 }else{
589 style_submenu_element("Stat1","repo_stat1");
590 }
591 }
592 style_finish_page();
593 }
594
595 /*
596 ** WEBPAGE: repo_stat1
597 **
@@ -586,10 +599,11 @@
599 */
600 void repo_stat1_page(void){
601 login_check_credentials();
602 if( !g.perm.Admin ){ login_needed(0); return; }
603
604 style_set_current_feature("stat");
605 style_header("Repository STAT1 Table");
606 style_adunit_config(ADUNIT_RIGHT_OK);
607 style_submenu_element("Stat", "stat");
608 style_submenu_element("Schema", "repo_schema");
609 if( db_table_exists("repository","sqlite_stat1") ){
@@ -606,11 +620,11 @@
620 @ INSERT INTO sqlite_stat1 VALUES('%z(zUrl)%h(zTab)</a>','%h(zIdx)','%h(zStat)');
621 }
622 @ </pre>
623 db_finalize(&q);
624 }
625 style_finish_page();
626 }
627
628 /*
629 ** WEBPAGE: repo-tabsize
630 **
@@ -621,10 +635,11 @@
635 sqlite3_int64 fsize;
636 char zBuf[100];
637
638 login_check_credentials();
639 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
640 style_set_current_feature("stat");
641 style_header("Repository Table Sizes");
642 style_adunit_config(ADUNIT_RIGHT_OK);
643 style_submenu_element("Stat", "stat");
644 if( g.perm.Admin ){
645 style_submenu_element("Schema", "repo_schema");
@@ -678,11 +693,11 @@
693 @ <h2>%h(file_tail(g.zLocalDbName)) Size: %s(zBuf)</h2>
694 @ <center><svg width='800' height='500'>
695 piechart_render(800,500,PIE_OTHER|PIE_PERCENT);
696 @ </svg></center>
697 }
698 style_finish_page();
699 }
700
701 /*
702 ** Gather statistics on artifact types, counts, and sizes.
703 **
@@ -798,10 +813,11 @@
813 login_needed(g.anon.Write);
814 return;
815 }
816 load_control();
817
818 style_set_current_feature("stat");
819 style_header("Artifact Statistics");
820 style_submenu_element("Repository Stats", "stat");
821 style_submenu_element("Artifact List", "bloblist");
822 gather_artifact_stats(1);
823
@@ -819,11 +835,11 @@
835 sumCmpr = db_column_int64(&q, 4);
836 sumExp = db_column_int64(&q, 5);
837 db_finalize(&q);
838 if( nTotal==0 ){
839 @ No artifacts in this repository!
840 style_finish_page();
841 return;
842 }
843 avgCmpr = (double)sumCmpr/nTotal;
844 avgExp = (double)sumExp/nTotal;
845
@@ -964,7 +980,7 @@
980 }
981 @ </tbody></table></div>
982 db_finalize(&q);
983 }
984 style_table_sorter();
985 style_finish_page();
986 }
987
+1 -1
--- src/statrep.c
+++ src/statrep.c
@@ -825,7 +825,7 @@
825825
break;
826826
case RPT_LASTCHNG:
827827
stats_report_last_change();
828828
break;
829829
}
830
- style_finish_page("reports");
830
+ style_finish_page();
831831
}
832832
--- src/statrep.c
+++ src/statrep.c
@@ -825,7 +825,7 @@
825 break;
826 case RPT_LASTCHNG:
827 stats_report_last_change();
828 break;
829 }
830 style_finish_page("reports");
831 }
832
--- src/statrep.c
+++ src/statrep.c
@@ -825,7 +825,7 @@
825 break;
826 case RPT_LASTCHNG:
827 stats_report_last_change();
828 break;
829 }
830 style_finish_page();
831 }
832
+67 -12
--- src/style.c
+++ src/style.c
@@ -33,11 +33,11 @@
3333
** style_submenu_checkbox()
3434
** style_submenu_binary()
3535
** style_submenu_multichoice()
3636
** style_submenu_sql()
3737
**
38
-** prior to calling style_footer(). The style_footer() routine
38
+** prior to calling style_finish_page(). The style_finish_page() routine
3939
** will generate the appropriate HTML text just below the main
4040
** menu.
4141
*/
4242
static struct Submenu {
4343
const char *zLabel; /* Button label */
@@ -84,10 +84,16 @@
8484
/*
8585
** Submenu disable flag
8686
*/
8787
static int submenuEnable = 1;
8888
89
+/*
90
+** Disable content-security-policy.
91
+** Warning: Do not disable the CSP without careful consideration!
92
+*/
93
+static int disableCSP = 0;
94
+
8995
/*
9096
** Flags for various javascript files needed prior to </body>
9197
*/
9298
static int needHrefJs = 0; /* href.js */
9399
@@ -525,15 +531,17 @@
525531
char *style_csp(int toHeader){
526532
static const char zBackupCSP[] =
527533
"default-src 'self' data:; "
528534
"script-src 'self' 'nonce-$nonce'; "
529535
"style-src 'self' 'unsafe-inline'";
530
- const char *zFormat = db_get("default-csp","");
536
+ const char *zFormat;
531537
Blob csp;
532538
char *zNonce;
533539
char *zCsp;
534540
int i;
541
+ if( disableCSP ) return fossil_strdup("");
542
+ zFormat = db_get("default-csp","");
535543
if( zFormat[0]==0 ){
536544
zFormat = zBackupCSP;
537545
}
538546
blob_init(&csp, 0, 0);
539547
while( zFormat[0] && (zNonce = strstr(zFormat,"$nonce"))!=0 ){
@@ -549,10 +557,21 @@
549557
if( toHeader ){
550558
cgi_printf_header("Content-Security-Policy: %s\r\n", zCsp);
551559
}
552560
return zCsp;
553561
}
562
+
563
+/*
564
+** Disable content security policy for the current page.
565
+** WARNING: Do not do this lightly!
566
+**
567
+** This routine must be called before the CSP is sued by
568
+** style_header().
569
+*/
570
+void style_disable_csp(void){
571
+ disableCSP = 1;
572
+}
554573
555574
/*
556575
** Default HTML page header text through <body>. If the repository-specific
557576
** header template lacks a <body> tag, then all of the following is
558577
** prepended.
@@ -559,26 +578,60 @@
559578
*/
560579
static const char zDfltHeader[] =
561580
@ <html>
562581
@ <head>
563582
@ <base href="$baseurl/$current_page" />
583
+@ <meta charset="UTF-8">
564584
@ <meta http-equiv="Content-Security-Policy" content="$default_csp" />
565585
@ <meta name="viewport" content="width=device-width, initial-scale=1.0">
566586
@ <title>$<project_name>: $<title></title>
567587
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed" \
568588
@ href="$home/timeline.rss" />
569589
@ <link rel="stylesheet" href="$stylesheet_url" type="text/css" />
570590
@ </head>
571
-@ <body>
591
+@ <body class="$current_feature">
572592
;
573593
574594
/*
575595
** Returns the default page header.
576596
*/
577597
const char *get_default_header(){
578598
return zDfltHeader;
579599
}
600
+
601
+/*
602
+** Given a URL path, extract the first element as a "feature" name,
603
+** used as the <body class="FEATURE"> value by default, though
604
+** later-running code may override this, typically to group multiple
605
+** Fossil UI URLs into a single "feature" so you can have per-feature
606
+** CSS rules.
607
+**
608
+** For example, "body.forum div.markdown blockquote" targets only
609
+** block quotes made in forum posts, leaving other Markdown quotes
610
+** alone. Because feature class "forum" groups /forummain, /forumpost,
611
+** and /forume2, it works across all renderings of Markdown to HTML
612
+** within the Fossil forum feature.
613
+*/
614
+static const char* feature_from_page_path(const char *zPath){
615
+ const char* zSlash = strchr(zPath, '/');
616
+ if (zSlash) {
617
+ return fossil_strndup(zPath, zSlash - zPath);
618
+ } else {
619
+ return zPath;
620
+ }
621
+}
622
+
623
+/*
624
+** Override the value of the TH1 variable current_feature, its default
625
+** set by feature_from_page_path(). We do not call this from
626
+** style_init_th1_vars() because that uses Th_MaybeStore() instead to
627
+** allow webpage implementations to call this before style_header()
628
+** to override that "maybe" default with something better.
629
+*/
630
+void style_set_current_feature(const char* zFeature){
631
+ Th_Store("current_feature", zFeature);
632
+}
580633
581634
/*
582635
** Initialize all the default TH1 variables
583636
*/
584637
static void style_init_th1_vars(const char *zTitle){
@@ -612,10 +665,11 @@
612665
image_url_var("logo");
613666
image_url_var("background");
614667
if( !login_is_nobody() ){
615668
Th_Store("login", g.zLogin);
616669
}
670
+ Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) );
617671
}
618672
619673
/*
620674
** Draw the header.
621675
*/
@@ -748,16 +802,12 @@
748802
** been received.
749803
**
750804
** * Finalizes the page content.
751805
**
752806
** * Appends the footer.
753
-**
754
-** The zPageType argument is a class name inserted in the <div> that
755
-** surrounds the page content. CSS can use this to have different styles
756
-** according to the page type.
757807
*/
758
-void style_finish_page(const char* zPageType){
808
+void style_finish_page(){
759809
const char *zFooter;
760810
const char *zAd = 0;
761811
unsigned int mAdFlags = 0;
762812
763813
if( !headerHasBeenGenerated ) return;
@@ -885,11 +935,11 @@
885935
@ <div class="adunit_banner">
886936
cgi_append_content(zAd, -1);
887937
@ </div>
888938
}
889939
890
- @ <div class="content %s(zPageType)"><span id="debugMsg"></span>
940
+ @ <div class="content"><span id="debugMsg"></span>
891941
cgi_destination(CGI_BODY);
892942
893943
if( sideboxUsed ){
894944
@ <div class="endContent"></div>
895945
}
@@ -1150,10 +1200,11 @@
11501200
login_check_credentials();
11511201
if( g.perm.Admin || g.perm.Setup || db_get_boolean("test_env_enable",0) ){
11521202
isAuth = 1;
11531203
}
11541204
cgi_load_environment();
1205
+ style_set_current_feature(zFormat[0]==0 ? "test" : "error");
11551206
if( zFormat[0] ){
11561207
va_list ap;
11571208
va_start(ap, zFormat);
11581209
zErr = vmprintf(zFormat, ap);
11591210
va_end(ap);
@@ -1192,10 +1243,13 @@
11921243
if( zCap[0] ){
11931244
@ anonymous-adds = %s(find_anon_capabilities(zCap))<br />
11941245
}
11951246
@ g.zRepositoryName = %h(g.zRepositoryName)<br />
11961247
@ load_average() = %f(load_average())<br />
1248
+#ifndef _WIN32
1249
+ @ RSS = %.2f(fossil_rss()/1000000.0) MB</br />
1250
+#endif
11971251
@ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br />
11981252
@ fossil_exe_id() = %h(fossil_exe_id())<br />
11991253
@ <hr />
12001254
P("HTTP_USER_AGENT");
12011255
cgi_print_all(showAll, 0);
@@ -1205,15 +1259,15 @@
12051259
@ %h(blob_str(&g.httpHeader))
12061260
@ </pre>
12071261
}
12081262
}
12091263
if( zErr && zErr[0] ){
1210
- style_finish_page("error");
1264
+ style_finish_page();
12111265
cgi_reply();
12121266
fossil_exit(1);
12131267
}else{
1214
- style_finish_page("test");
1268
+ style_finish_page();
12151269
}
12161270
}
12171271
12181272
/*
12191273
** Generate a Not Yet Implemented error page.
@@ -1242,14 +1296,15 @@
12421296
zMsg = vmprintf(zFormat, ap);
12431297
va_end(ap);
12441298
}else{
12451299
zMsg = "Not Found";
12461300
}
1301
+ style_set_current_feature("enotfound");
12471302
style_header("Not Found");
12481303
@ <p>%h(zMsg)</p>
12491304
cgi_set_status(404, "Not Found");
1250
- style_finish_page("enotfound");
1305
+ style_finish_page();
12511306
}
12521307
12531308
#if INTERFACE
12541309
# define webpage_assert(T) if(!(T)){webpage_assert_page(__FILE__,__LINE__,#T);}
12551310
#endif
12561311
--- src/style.c
+++ src/style.c
@@ -33,11 +33,11 @@
33 ** style_submenu_checkbox()
34 ** style_submenu_binary()
35 ** style_submenu_multichoice()
36 ** style_submenu_sql()
37 **
38 ** prior to calling style_footer(). The style_footer() routine
39 ** will generate the appropriate HTML text just below the main
40 ** menu.
41 */
42 static struct Submenu {
43 const char *zLabel; /* Button label */
@@ -84,10 +84,16 @@
84 /*
85 ** Submenu disable flag
86 */
87 static int submenuEnable = 1;
88
 
 
 
 
 
 
89 /*
90 ** Flags for various javascript files needed prior to </body>
91 */
92 static int needHrefJs = 0; /* href.js */
93
@@ -525,15 +531,17 @@
525 char *style_csp(int toHeader){
526 static const char zBackupCSP[] =
527 "default-src 'self' data:; "
528 "script-src 'self' 'nonce-$nonce'; "
529 "style-src 'self' 'unsafe-inline'";
530 const char *zFormat = db_get("default-csp","");
531 Blob csp;
532 char *zNonce;
533 char *zCsp;
534 int i;
 
 
535 if( zFormat[0]==0 ){
536 zFormat = zBackupCSP;
537 }
538 blob_init(&csp, 0, 0);
539 while( zFormat[0] && (zNonce = strstr(zFormat,"$nonce"))!=0 ){
@@ -549,10 +557,21 @@
549 if( toHeader ){
550 cgi_printf_header("Content-Security-Policy: %s\r\n", zCsp);
551 }
552 return zCsp;
553 }
 
 
 
 
 
 
 
 
 
 
 
554
555 /*
556 ** Default HTML page header text through <body>. If the repository-specific
557 ** header template lacks a <body> tag, then all of the following is
558 ** prepended.
@@ -559,26 +578,60 @@
559 */
560 static const char zDfltHeader[] =
561 @ <html>
562 @ <head>
563 @ <base href="$baseurl/$current_page" />
 
564 @ <meta http-equiv="Content-Security-Policy" content="$default_csp" />
565 @ <meta name="viewport" content="width=device-width, initial-scale=1.0">
566 @ <title>$<project_name>: $<title></title>
567 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" \
568 @ href="$home/timeline.rss" />
569 @ <link rel="stylesheet" href="$stylesheet_url" type="text/css" />
570 @ </head>
571 @ <body>
572 ;
573
574 /*
575 ** Returns the default page header.
576 */
577 const char *get_default_header(){
578 return zDfltHeader;
579 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
581 /*
582 ** Initialize all the default TH1 variables
583 */
584 static void style_init_th1_vars(const char *zTitle){
@@ -612,10 +665,11 @@
612 image_url_var("logo");
613 image_url_var("background");
614 if( !login_is_nobody() ){
615 Th_Store("login", g.zLogin);
616 }
 
617 }
618
619 /*
620 ** Draw the header.
621 */
@@ -748,16 +802,12 @@
748 ** been received.
749 **
750 ** * Finalizes the page content.
751 **
752 ** * Appends the footer.
753 **
754 ** The zPageType argument is a class name inserted in the <div> that
755 ** surrounds the page content. CSS can use this to have different styles
756 ** according to the page type.
757 */
758 void style_finish_page(const char* zPageType){
759 const char *zFooter;
760 const char *zAd = 0;
761 unsigned int mAdFlags = 0;
762
763 if( !headerHasBeenGenerated ) return;
@@ -885,11 +935,11 @@
885 @ <div class="adunit_banner">
886 cgi_append_content(zAd, -1);
887 @ </div>
888 }
889
890 @ <div class="content %s(zPageType)"><span id="debugMsg"></span>
891 cgi_destination(CGI_BODY);
892
893 if( sideboxUsed ){
894 @ <div class="endContent"></div>
895 }
@@ -1150,10 +1200,11 @@
1150 login_check_credentials();
1151 if( g.perm.Admin || g.perm.Setup || db_get_boolean("test_env_enable",0) ){
1152 isAuth = 1;
1153 }
1154 cgi_load_environment();
 
1155 if( zFormat[0] ){
1156 va_list ap;
1157 va_start(ap, zFormat);
1158 zErr = vmprintf(zFormat, ap);
1159 va_end(ap);
@@ -1192,10 +1243,13 @@
1192 if( zCap[0] ){
1193 @ anonymous-adds = %s(find_anon_capabilities(zCap))<br />
1194 }
1195 @ g.zRepositoryName = %h(g.zRepositoryName)<br />
1196 @ load_average() = %f(load_average())<br />
 
 
 
1197 @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br />
1198 @ fossil_exe_id() = %h(fossil_exe_id())<br />
1199 @ <hr />
1200 P("HTTP_USER_AGENT");
1201 cgi_print_all(showAll, 0);
@@ -1205,15 +1259,15 @@
1205 @ %h(blob_str(&g.httpHeader))
1206 @ </pre>
1207 }
1208 }
1209 if( zErr && zErr[0] ){
1210 style_finish_page("error");
1211 cgi_reply();
1212 fossil_exit(1);
1213 }else{
1214 style_finish_page("test");
1215 }
1216 }
1217
1218 /*
1219 ** Generate a Not Yet Implemented error page.
@@ -1242,14 +1296,15 @@
1242 zMsg = vmprintf(zFormat, ap);
1243 va_end(ap);
1244 }else{
1245 zMsg = "Not Found";
1246 }
 
1247 style_header("Not Found");
1248 @ <p>%h(zMsg)</p>
1249 cgi_set_status(404, "Not Found");
1250 style_finish_page("enotfound");
1251 }
1252
1253 #if INTERFACE
1254 # define webpage_assert(T) if(!(T)){webpage_assert_page(__FILE__,__LINE__,#T);}
1255 #endif
1256
--- src/style.c
+++ src/style.c
@@ -33,11 +33,11 @@
33 ** style_submenu_checkbox()
34 ** style_submenu_binary()
35 ** style_submenu_multichoice()
36 ** style_submenu_sql()
37 **
38 ** prior to calling style_finish_page(). The style_finish_page() routine
39 ** will generate the appropriate HTML text just below the main
40 ** menu.
41 */
42 static struct Submenu {
43 const char *zLabel; /* Button label */
@@ -84,10 +84,16 @@
84 /*
85 ** Submenu disable flag
86 */
87 static int submenuEnable = 1;
88
89 /*
90 ** Disable content-security-policy.
91 ** Warning: Do not disable the CSP without careful consideration!
92 */
93 static int disableCSP = 0;
94
95 /*
96 ** Flags for various javascript files needed prior to </body>
97 */
98 static int needHrefJs = 0; /* href.js */
99
@@ -525,15 +531,17 @@
531 char *style_csp(int toHeader){
532 static const char zBackupCSP[] =
533 "default-src 'self' data:; "
534 "script-src 'self' 'nonce-$nonce'; "
535 "style-src 'self' 'unsafe-inline'";
536 const char *zFormat;
537 Blob csp;
538 char *zNonce;
539 char *zCsp;
540 int i;
541 if( disableCSP ) return fossil_strdup("");
542 zFormat = db_get("default-csp","");
543 if( zFormat[0]==0 ){
544 zFormat = zBackupCSP;
545 }
546 blob_init(&csp, 0, 0);
547 while( zFormat[0] && (zNonce = strstr(zFormat,"$nonce"))!=0 ){
@@ -549,10 +557,21 @@
557 if( toHeader ){
558 cgi_printf_header("Content-Security-Policy: %s\r\n", zCsp);
559 }
560 return zCsp;
561 }
562
563 /*
564 ** Disable content security policy for the current page.
565 ** WARNING: Do not do this lightly!
566 **
567 ** This routine must be called before the CSP is sued by
568 ** style_header().
569 */
570 void style_disable_csp(void){
571 disableCSP = 1;
572 }
573
574 /*
575 ** Default HTML page header text through <body>. If the repository-specific
576 ** header template lacks a <body> tag, then all of the following is
577 ** prepended.
@@ -559,26 +578,60 @@
578 */
579 static const char zDfltHeader[] =
580 @ <html>
581 @ <head>
582 @ <base href="$baseurl/$current_page" />
583 @ <meta charset="UTF-8">
584 @ <meta http-equiv="Content-Security-Policy" content="$default_csp" />
585 @ <meta name="viewport" content="width=device-width, initial-scale=1.0">
586 @ <title>$<project_name>: $<title></title>
587 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" \
588 @ href="$home/timeline.rss" />
589 @ <link rel="stylesheet" href="$stylesheet_url" type="text/css" />
590 @ </head>
591 @ <body class="$current_feature">
592 ;
593
594 /*
595 ** Returns the default page header.
596 */
597 const char *get_default_header(){
598 return zDfltHeader;
599 }
600
601 /*
602 ** Given a URL path, extract the first element as a "feature" name,
603 ** used as the <body class="FEATURE"> value by default, though
604 ** later-running code may override this, typically to group multiple
605 ** Fossil UI URLs into a single "feature" so you can have per-feature
606 ** CSS rules.
607 **
608 ** For example, "body.forum div.markdown blockquote" targets only
609 ** block quotes made in forum posts, leaving other Markdown quotes
610 ** alone. Because feature class "forum" groups /forummain, /forumpost,
611 ** and /forume2, it works across all renderings of Markdown to HTML
612 ** within the Fossil forum feature.
613 */
614 static const char* feature_from_page_path(const char *zPath){
615 const char* zSlash = strchr(zPath, '/');
616 if (zSlash) {
617 return fossil_strndup(zPath, zSlash - zPath);
618 } else {
619 return zPath;
620 }
621 }
622
623 /*
624 ** Override the value of the TH1 variable current_feature, its default
625 ** set by feature_from_page_path(). We do not call this from
626 ** style_init_th1_vars() because that uses Th_MaybeStore() instead to
627 ** allow webpage implementations to call this before style_header()
628 ** to override that "maybe" default with something better.
629 */
630 void style_set_current_feature(const char* zFeature){
631 Th_Store("current_feature", zFeature);
632 }
633
634 /*
635 ** Initialize all the default TH1 variables
636 */
637 static void style_init_th1_vars(const char *zTitle){
@@ -612,10 +665,11 @@
665 image_url_var("logo");
666 image_url_var("background");
667 if( !login_is_nobody() ){
668 Th_Store("login", g.zLogin);
669 }
670 Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) );
671 }
672
673 /*
674 ** Draw the header.
675 */
@@ -748,16 +802,12 @@
802 ** been received.
803 **
804 ** * Finalizes the page content.
805 **
806 ** * Appends the footer.
 
 
 
 
807 */
808 void style_finish_page(){
809 const char *zFooter;
810 const char *zAd = 0;
811 unsigned int mAdFlags = 0;
812
813 if( !headerHasBeenGenerated ) return;
@@ -885,11 +935,11 @@
935 @ <div class="adunit_banner">
936 cgi_append_content(zAd, -1);
937 @ </div>
938 }
939
940 @ <div class="content"><span id="debugMsg"></span>
941 cgi_destination(CGI_BODY);
942
943 if( sideboxUsed ){
944 @ <div class="endContent"></div>
945 }
@@ -1150,10 +1200,11 @@
1200 login_check_credentials();
1201 if( g.perm.Admin || g.perm.Setup || db_get_boolean("test_env_enable",0) ){
1202 isAuth = 1;
1203 }
1204 cgi_load_environment();
1205 style_set_current_feature(zFormat[0]==0 ? "test" : "error");
1206 if( zFormat[0] ){
1207 va_list ap;
1208 va_start(ap, zFormat);
1209 zErr = vmprintf(zFormat, ap);
1210 va_end(ap);
@@ -1192,10 +1243,13 @@
1243 if( zCap[0] ){
1244 @ anonymous-adds = %s(find_anon_capabilities(zCap))<br />
1245 }
1246 @ g.zRepositoryName = %h(g.zRepositoryName)<br />
1247 @ load_average() = %f(load_average())<br />
1248 #ifndef _WIN32
1249 @ RSS = %.2f(fossil_rss()/1000000.0) MB</br />
1250 #endif
1251 @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br />
1252 @ fossil_exe_id() = %h(fossil_exe_id())<br />
1253 @ <hr />
1254 P("HTTP_USER_AGENT");
1255 cgi_print_all(showAll, 0);
@@ -1205,15 +1259,15 @@
1259 @ %h(blob_str(&g.httpHeader))
1260 @ </pre>
1261 }
1262 }
1263 if( zErr && zErr[0] ){
1264 style_finish_page();
1265 cgi_reply();
1266 fossil_exit(1);
1267 }else{
1268 style_finish_page();
1269 }
1270 }
1271
1272 /*
1273 ** Generate a Not Yet Implemented error page.
@@ -1242,14 +1296,15 @@
1296 zMsg = vmprintf(zFormat, ap);
1297 va_end(ap);
1298 }else{
1299 zMsg = "Not Found";
1300 }
1301 style_set_current_feature("enotfound");
1302 style_header("Not Found");
1303 @ <p>%h(zMsg)</p>
1304 cgi_set_status(404, "Not Found");
1305 style_finish_page();
1306 }
1307
1308 #if INTERFACE
1309 # define webpage_assert(T) if(!(T)){webpage_assert_page(__FILE__,__LINE__,#T);}
1310 #endif
1311
+32 -30
--- src/sync.c
+++ src/sync.c
@@ -350,58 +350,60 @@
350350
** COMMAND: remote
351351
** COMMAND: remote-url*
352352
**
353353
** Usage: %fossil remote ?SUBCOMMAND ...?
354354
**
355
-** Use this command to view or modify the set of remote repositories
356
-** used as the default target for sync, push, and pull and for autosync.
357
-**
358
-** The default remote is set automatically by a "clone" command or by any
359
-** "sync", "push", or "pull" command that specifies an explicit URL
360
-** and omits the --once flag. The default remote is used by
361
-** auto-syncing and by "sync", "push", and "pull" that omit the server URL.
362
-** Additional remotes can be added using the "add" command or deleted
363
-** using the "delete" command. The name of any additional remote can be
364
-** used as an argument to the "sync", "push", and "pull" commands where
365
-** one would normally put a URL argument.
366
-**
367
-** See "fossil help clone" for further information about URL formats.
368
-**
369
-** The official name of this command is "remote-url" but most people
370
-** use the shortened name "remote".
355
+** View or modify the set of remote repository sync URLs used as the
356
+** target in any command that uses the sync protocol: "sync", "push",
357
+** and "pull", plus all other commands that trigger Fossil's autosync
358
+** feature. (Collectively, "sync operations".)
359
+**
360
+** See "fossil help clone" for the format of these sync URLs.
361
+**
362
+** Fossil implicitly sets the default remote sync URL from the initial
363
+** "clone" or "open URL" command for a repository, then may subsequently
364
+** change it when given a URL in commands that take a sync URL, except
365
+** when given the --once flag. Fossil uses this new sync URL as its
366
+** default when not explicitly given one in subsequent sync operations.
367
+**
368
+** Named remotes added by "remote add" allow use of those names in place
369
+** of a sync URL in any command that takes one.
370
+**
371
+** The full name of this command is "remote-url", but we anticipate no
372
+** future collision from use of its shortened form "remote".
371373
**
372374
** > fossil remote
373375
**
374
-** With no arguments, this command shows the current default remote.
375
-** Or if there is no default, it shows "off". The default remote is
376
-** used by autosync. The default remote is whatever URL was specified
377
-** for the most recent "sync", "push", or "pull" command that omitted
378
-** the --once option.
376
+** With no arguments, this command shows the current default remote
377
+** URL. If there is no default, it shows "off".
379378
**
380379
** > fossil remote add NAME URL
381380
**
382
-** Add a new URL to the set of remotes. The new URL is assigned the
383
-** symbolic identifier "NAME". Subsequently, NAME can be used in place
384
-** of the full URL on commands like "push" and "pull".
381
+** Add a new named URL to the set of remote sync URLs for use in
382
+** place of a sync URL in commands that take one.
385383
**
386384
** > fossil remote delete NAME
387385
**
388
-** Delete a URL previously added by the "add" subcommand.
386
+** Delete a sync URL previously added by the "add" subcommand.
389387
**
390388
** > fossil remote list
391389
**
392
-** Show all remote URLs
390
+** Show all remote repository sync URLs.
393391
**
394392
** > fossil remote off
395393
**
396
-** Disable the default URL. Use this as a shorthand to prevent
397
-** autosync while in airplane mode, for example.
394
+** Forget the default sync URL, disabling autosync. Combined with
395
+** named sync URLs, it allows canceling this "airplane mode" with
396
+** "fossil remote NAME" to select a previously-set named URL.
397
+**
398
+** To disable use of the default remote without forgetting its URL,
399
+** say "fossil set autosync 0" instead.
398400
**
399401
** > fossil remote REF
400402
**
401
-** Make REF the new default URL. The prior default URL is replaced.
402
-** REF can be either an explicit URL or a NAME from a prior "add".
403
+** Make REF the new default URL, replacing the prior default.
404
+** REF may be a URL or a NAME from a prior "add".
403405
*/
404406
void remote_url_cmd(void){
405407
char *zUrl, *zArg;
406408
int nArg;
407409
db_find_and_open_repository(0, 0);
408410
--- src/sync.c
+++ src/sync.c
@@ -350,58 +350,60 @@
350 ** COMMAND: remote
351 ** COMMAND: remote-url*
352 **
353 ** Usage: %fossil remote ?SUBCOMMAND ...?
354 **
355 ** Use this command to view or modify the set of remote repositories
356 ** used as the default target for sync, push, and pull and for autosync.
357 **
358 ** The default remote is set automatically by a "clone" command or by any
359 ** "sync", "push", or "pull" command that specifies an explicit URL
360 ** and omits the --once flag. The default remote is used by
361 ** auto-syncing and by "sync", "push", and "pull" that omit the server URL.
362 ** Additional remotes can be added using the "add" command or deleted
363 ** using the "delete" command. The name of any additional remote can be
364 ** used as an argument to the "sync", "push", and "pull" commands where
365 ** one would normally put a URL argument.
366 **
367 ** See "fossil help clone" for further information about URL formats.
368 **
369 ** The official name of this command is "remote-url" but most people
370 ** use the shortened name "remote".
 
 
371 **
372 ** > fossil remote
373 **
374 ** With no arguments, this command shows the current default remote.
375 ** Or if there is no default, it shows "off". The default remote is
376 ** used by autosync. The default remote is whatever URL was specified
377 ** for the most recent "sync", "push", or "pull" command that omitted
378 ** the --once option.
379 **
380 ** > fossil remote add NAME URL
381 **
382 ** Add a new URL to the set of remotes. The new URL is assigned the
383 ** symbolic identifier "NAME". Subsequently, NAME can be used in place
384 ** of the full URL on commands like "push" and "pull".
385 **
386 ** > fossil remote delete NAME
387 **
388 ** Delete a URL previously added by the "add" subcommand.
389 **
390 ** > fossil remote list
391 **
392 ** Show all remote URLs
393 **
394 ** > fossil remote off
395 **
396 ** Disable the default URL. Use this as a shorthand to prevent
397 ** autosync while in airplane mode, for example.
 
 
 
 
398 **
399 ** > fossil remote REF
400 **
401 ** Make REF the new default URL. The prior default URL is replaced.
402 ** REF can be either an explicit URL or a NAME from a prior "add".
403 */
404 void remote_url_cmd(void){
405 char *zUrl, *zArg;
406 int nArg;
407 db_find_and_open_repository(0, 0);
408
--- src/sync.c
+++ src/sync.c
@@ -350,58 +350,60 @@
350 ** COMMAND: remote
351 ** COMMAND: remote-url*
352 **
353 ** Usage: %fossil remote ?SUBCOMMAND ...?
354 **
355 ** View or modify the set of remote repository sync URLs used as the
356 ** target in any command that uses the sync protocol: "sync", "push",
357 ** and "pull", plus all other commands that trigger Fossil's autosync
358 ** feature. (Collectively, "sync operations".)
359 **
360 ** See "fossil help clone" for the format of these sync URLs.
361 **
362 ** Fossil implicitly sets the default remote sync URL from the initial
363 ** "clone" or "open URL" command for a repository, then may subsequently
364 ** change it when given a URL in commands that take a sync URL, except
365 ** when given the --once flag. Fossil uses this new sync URL as its
366 ** default when not explicitly given one in subsequent sync operations.
367 **
368 ** Named remotes added by "remote add" allow use of those names in place
369 ** of a sync URL in any command that takes one.
370 **
371 ** The full name of this command is "remote-url", but we anticipate no
372 ** future collision from use of its shortened form "remote".
373 **
374 ** > fossil remote
375 **
376 ** With no arguments, this command shows the current default remote
377 ** URL. If there is no default, it shows "off".
 
 
 
378 **
379 ** > fossil remote add NAME URL
380 **
381 ** Add a new named URL to the set of remote sync URLs for use in
382 ** place of a sync URL in commands that take one.
 
383 **
384 ** > fossil remote delete NAME
385 **
386 ** Delete a sync URL previously added by the "add" subcommand.
387 **
388 ** > fossil remote list
389 **
390 ** Show all remote repository sync URLs.
391 **
392 ** > fossil remote off
393 **
394 ** Forget the default sync URL, disabling autosync. Combined with
395 ** named sync URLs, it allows canceling this "airplane mode" with
396 ** "fossil remote NAME" to select a previously-set named URL.
397 **
398 ** To disable use of the default remote without forgetting its URL,
399 ** say "fossil set autosync 0" instead.
400 **
401 ** > fossil remote REF
402 **
403 ** Make REF the new default URL, replacing the prior default.
404 ** REF may be a URL or a NAME from a prior "add".
405 */
406 void remote_url_cmd(void){
407 char *zUrl, *zArg;
408 int nArg;
409 db_find_and_open_repository(0, 0);
410
+3 -3
--- src/tag.c
+++ src/tag.c
@@ -541,11 +541,11 @@
541541
" ORDER BY event.mtime DESC /*sort*/",
542542
timeline_query_for_tty(), zType, tagid
543543
);
544544
db_prepare(&q, "%s", blob_sql_text(&sql));
545545
blob_reset(&sql);
546
- print_timeline(&q, nFindLimit, 79, 0);
546
+ print_timeline(&q, nFindLimit, 79, 0, 0);
547547
db_finalize(&q);
548548
}
549549
}
550550
}else
551551
@@ -724,11 +724,11 @@
724724
@ <li><span class="tagDsp">%h(zName)</span></li>
725725
}
726726
}
727727
@ </ul>
728728
db_finalize(&q);
729
- style_finish_page("taglist");
729
+ style_finish_page();
730730
}
731731
732732
/*
733733
** WEBPAGE: /tagtimeline
734734
**
@@ -781,7 +781,7 @@
781781
if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR;
782782
if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR;
783783
www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0);
784784
db_finalize(&q);
785785
@ <br />
786
- style_finish_page("tagtimeline");
786
+ style_finish_page();
787787
}
788788
--- src/tag.c
+++ src/tag.c
@@ -541,11 +541,11 @@
541 " ORDER BY event.mtime DESC /*sort*/",
542 timeline_query_for_tty(), zType, tagid
543 );
544 db_prepare(&q, "%s", blob_sql_text(&sql));
545 blob_reset(&sql);
546 print_timeline(&q, nFindLimit, 79, 0);
547 db_finalize(&q);
548 }
549 }
550 }else
551
@@ -724,11 +724,11 @@
724 @ <li><span class="tagDsp">%h(zName)</span></li>
725 }
726 }
727 @ </ul>
728 db_finalize(&q);
729 style_finish_page("taglist");
730 }
731
732 /*
733 ** WEBPAGE: /tagtimeline
734 **
@@ -781,7 +781,7 @@
781 if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR;
782 if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR;
783 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0);
784 db_finalize(&q);
785 @ <br />
786 style_finish_page("tagtimeline");
787 }
788
--- src/tag.c
+++ src/tag.c
@@ -541,11 +541,11 @@
541 " ORDER BY event.mtime DESC /*sort*/",
542 timeline_query_for_tty(), zType, tagid
543 );
544 db_prepare(&q, "%s", blob_sql_text(&sql));
545 blob_reset(&sql);
546 print_timeline(&q, nFindLimit, 79, 0, 0);
547 db_finalize(&q);
548 }
549 }
550 }else
551
@@ -724,11 +724,11 @@
724 @ <li><span class="tagDsp">%h(zName)</span></li>
725 }
726 }
727 @ </ul>
728 db_finalize(&q);
729 style_finish_page();
730 }
731
732 /*
733 ** WEBPAGE: /tagtimeline
734 **
@@ -781,7 +781,7 @@
781 if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR;
782 if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR;
783 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0);
784 db_finalize(&q);
785 @ <br />
786 style_finish_page();
787 }
788
+2 -2
--- src/tar.c
+++ src/tar.c
@@ -785,11 +785,11 @@
785785
}
786786
if( zExclude ){
787787
@ zExclude = "%h(zExclude)"<br />
788788
}
789789
@ zKey = "%h(zKey)"
790
- style_finish_page("tarball");
790
+ style_finish_page();
791791
return;
792792
}
793793
if( referred_from_login() ){
794794
style_header("Tarball Download");
795795
@ <form action='%R/tarball/%h(zName).tar.gz'>
@@ -796,11 +796,11 @@
796796
cgi_query_parameters_to_hidden();
797797
@ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content
798798
@ of check-in <b>%h(zRid)</b>:
799799
@ <input type="submit" value="Download" />
800800
@ </form>
801
- style_finish_page("tarball");
801
+ style_finish_page();
802802
return;
803803
}
804804
blob_zero(&tarball);
805805
if( cache_read(&tarball, zKey)==0 ){
806806
tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude);
807807
--- src/tar.c
+++ src/tar.c
@@ -785,11 +785,11 @@
785 }
786 if( zExclude ){
787 @ zExclude = "%h(zExclude)"<br />
788 }
789 @ zKey = "%h(zKey)"
790 style_finish_page("tarball");
791 return;
792 }
793 if( referred_from_login() ){
794 style_header("Tarball Download");
795 @ <form action='%R/tarball/%h(zName).tar.gz'>
@@ -796,11 +796,11 @@
796 cgi_query_parameters_to_hidden();
797 @ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content
798 @ of check-in <b>%h(zRid)</b>:
799 @ <input type="submit" value="Download" />
800 @ </form>
801 style_finish_page("tarball");
802 return;
803 }
804 blob_zero(&tarball);
805 if( cache_read(&tarball, zKey)==0 ){
806 tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude);
807
--- src/tar.c
+++ src/tar.c
@@ -785,11 +785,11 @@
785 }
786 if( zExclude ){
787 @ zExclude = "%h(zExclude)"<br />
788 }
789 @ zKey = "%h(zKey)"
790 style_finish_page();
791 return;
792 }
793 if( referred_from_login() ){
794 style_header("Tarball Download");
795 @ <form action='%R/tarball/%h(zName).tar.gz'>
@@ -796,11 +796,11 @@
796 cgi_query_parameters_to_hidden();
797 @ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content
798 @ of check-in <b>%h(zRid)</b>:
799 @ <input type="submit" value="Download" />
800 @ </form>
801 style_finish_page();
802 return;
803 }
804 blob_zero(&tarball);
805 if( cache_read(&tarball, zKey)==0 ){
806 tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude);
807
+1 -1
--- src/terminal.c
+++ src/terminal.c
@@ -117,11 +117,11 @@
117117
118118
/*
119119
** COMMAND: test-terminal-size
120120
**
121121
** Show the size of the terminal window from which the command is launched
122
-** as two integers, the width in charaters and the height in lines.
122
+** as two integers, the width in characters and the height in lines.
123123
**
124124
** If the size cannot be determined, two zeros are shown.
125125
*/
126126
void test_terminal_size_cmd(void){
127127
TerminalSize ts;
128128
--- src/terminal.c
+++ src/terminal.c
@@ -117,11 +117,11 @@
117
118 /*
119 ** COMMAND: test-terminal-size
120 **
121 ** Show the size of the terminal window from which the command is launched
122 ** as two integers, the width in charaters and the height in lines.
123 **
124 ** If the size cannot be determined, two zeros are shown.
125 */
126 void test_terminal_size_cmd(void){
127 TerminalSize ts;
128
--- src/terminal.c
+++ src/terminal.c
@@ -117,11 +117,11 @@
117
118 /*
119 ** COMMAND: test-terminal-size
120 **
121 ** Show the size of the terminal window from which the command is launched
122 ** as two integers, the width in characters and the height in lines.
123 **
124 ** If the size cannot be determined, two zeros are shown.
125 */
126 void test_terminal_size_cmd(void){
127 TerminalSize ts;
128
+9 -3
--- src/th_main.c
+++ src/th_main.c
@@ -1478,11 +1478,11 @@
14781478
){
14791479
if( argc!=1 ){
14801480
return Th_WrongNumArgs(interp, "styleFooter");
14811481
}
14821482
if( Th_IsRepositoryOpen() ){
1483
- style_finish_page("th1"); /* TODO: add optional parameter to pass along? */
1483
+ style_finish_page();
14841484
Th_SetResult(interp, 0, 0);
14851485
return TH_OK;
14861486
}else{
14871487
Th_SetResult(interp, "repository unavailable", -1);
14881488
return TH_ERROR;
@@ -2932,19 +2932,22 @@
29322932
** --http Include an HTTP response header in the output
29332933
** --open-config Open the configuration database
29342934
** --set-anon-caps Set anonymous login capabilities
29352935
** --set-user-caps Set user login capabilities
29362936
** --th-trace Trace TH1 execution (for debugging purposes)
2937
+** --no-print-result Do not output the final result. Use if it
2938
+** interferes with script output.
29372939
*/
29382940
void test_th_source(void){
29392941
int rc;
29402942
const char *zRc;
2941
- int forceCgi, fullHttpReply;
2943
+ int forceCgi, fullHttpReply, fNoPrintRc;
29422944
Blob in;
29432945
Th_InitTraceLog();
29442946
forceCgi = find_option("cgi", 0, 0)!=0;
29452947
fullHttpReply = find_option("http", 0, 0)!=0;
2948
+ fNoPrintRc = find_option("no-print-result",0,0)!=0;
29462949
if( fullHttpReply ) forceCgi = 1;
29472950
if( forceCgi ) Th_ForceCgi(fullHttpReply);
29482951
if( find_option("open-config", 0, 0)!=0 ){
29492952
Th_OpenConfig(1);
29502953
}
@@ -2965,11 +2968,14 @@
29652968
blob_zero(&in);
29662969
blob_read_from_file(&in, g.argv[2], ExtFILE);
29672970
Th_FossilInit(TH_INIT_DEFAULT);
29682971
rc = Th_Eval(g.interp, 0, blob_str(&in), -1);
29692972
zRc = Th_ReturnCodeName(rc, 1);
2970
- fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0));
2973
+ if(0==fNoPrintRc){
2974
+ fossil_print("%s%s%s\n", zRc, zRc ? ": " : "",
2975
+ Th_GetResult(g.interp, 0));
2976
+ }
29712977
Th_PrintTraceLog();
29722978
if( forceCgi ) cgi_reply();
29732979
}
29742980
29752981
#ifdef FOSSIL_ENABLE_TH1_HOOKS
29762982
--- src/th_main.c
+++ src/th_main.c
@@ -1478,11 +1478,11 @@
1478 ){
1479 if( argc!=1 ){
1480 return Th_WrongNumArgs(interp, "styleFooter");
1481 }
1482 if( Th_IsRepositoryOpen() ){
1483 style_finish_page("th1"); /* TODO: add optional parameter to pass along? */
1484 Th_SetResult(interp, 0, 0);
1485 return TH_OK;
1486 }else{
1487 Th_SetResult(interp, "repository unavailable", -1);
1488 return TH_ERROR;
@@ -2932,19 +2932,22 @@
2932 ** --http Include an HTTP response header in the output
2933 ** --open-config Open the configuration database
2934 ** --set-anon-caps Set anonymous login capabilities
2935 ** --set-user-caps Set user login capabilities
2936 ** --th-trace Trace TH1 execution (for debugging purposes)
 
 
2937 */
2938 void test_th_source(void){
2939 int rc;
2940 const char *zRc;
2941 int forceCgi, fullHttpReply;
2942 Blob in;
2943 Th_InitTraceLog();
2944 forceCgi = find_option("cgi", 0, 0)!=0;
2945 fullHttpReply = find_option("http", 0, 0)!=0;
 
2946 if( fullHttpReply ) forceCgi = 1;
2947 if( forceCgi ) Th_ForceCgi(fullHttpReply);
2948 if( find_option("open-config", 0, 0)!=0 ){
2949 Th_OpenConfig(1);
2950 }
@@ -2965,11 +2968,14 @@
2965 blob_zero(&in);
2966 blob_read_from_file(&in, g.argv[2], ExtFILE);
2967 Th_FossilInit(TH_INIT_DEFAULT);
2968 rc = Th_Eval(g.interp, 0, blob_str(&in), -1);
2969 zRc = Th_ReturnCodeName(rc, 1);
2970 fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0));
 
 
 
2971 Th_PrintTraceLog();
2972 if( forceCgi ) cgi_reply();
2973 }
2974
2975 #ifdef FOSSIL_ENABLE_TH1_HOOKS
2976
--- src/th_main.c
+++ src/th_main.c
@@ -1478,11 +1478,11 @@
1478 ){
1479 if( argc!=1 ){
1480 return Th_WrongNumArgs(interp, "styleFooter");
1481 }
1482 if( Th_IsRepositoryOpen() ){
1483 style_finish_page();
1484 Th_SetResult(interp, 0, 0);
1485 return TH_OK;
1486 }else{
1487 Th_SetResult(interp, "repository unavailable", -1);
1488 return TH_ERROR;
@@ -2932,19 +2932,22 @@
2932 ** --http Include an HTTP response header in the output
2933 ** --open-config Open the configuration database
2934 ** --set-anon-caps Set anonymous login capabilities
2935 ** --set-user-caps Set user login capabilities
2936 ** --th-trace Trace TH1 execution (for debugging purposes)
2937 ** --no-print-result Do not output the final result. Use if it
2938 ** interferes with script output.
2939 */
2940 void test_th_source(void){
2941 int rc;
2942 const char *zRc;
2943 int forceCgi, fullHttpReply, fNoPrintRc;
2944 Blob in;
2945 Th_InitTraceLog();
2946 forceCgi = find_option("cgi", 0, 0)!=0;
2947 fullHttpReply = find_option("http", 0, 0)!=0;
2948 fNoPrintRc = find_option("no-print-result",0,0)!=0;
2949 if( fullHttpReply ) forceCgi = 1;
2950 if( forceCgi ) Th_ForceCgi(fullHttpReply);
2951 if( find_option("open-config", 0, 0)!=0 ){
2952 Th_OpenConfig(1);
2953 }
@@ -2965,11 +2968,14 @@
2968 blob_zero(&in);
2969 blob_read_from_file(&in, g.argv[2], ExtFILE);
2970 Th_FossilInit(TH_INIT_DEFAULT);
2971 rc = Th_Eval(g.interp, 0, blob_str(&in), -1);
2972 zRc = Th_ReturnCodeName(rc, 1);
2973 if(0==fNoPrintRc){
2974 fossil_print("%s%s%s\n", zRc, zRc ? ": " : "",
2975 Th_GetResult(g.interp, 0));
2976 }
2977 Th_PrintTraceLog();
2978 if( forceCgi ) cgi_reply();
2979 }
2980
2981 #ifdef FOSSIL_ENABLE_TH1_HOOKS
2982
+231 -31
--- src/timeline.c
+++ src/timeline.c
@@ -122,10 +122,13 @@
122122
#define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */
123123
#endif
124124
125125
/*
126126
** Hash a string and use the hash to determine a background color.
127
+**
128
+** This value returned is in static space and is overwritten with
129
+** each subsequent call.
127130
*/
128131
char *hash_color(const char *z){
129132
int i; /* Loop counter */
130133
unsigned int h = 0; /* Hash on the branch name */
131134
int r, g, b; /* Values for red, green, and blue */
@@ -134,23 +137,23 @@
134137
static char zColor[10]; /* The resulting color */
135138
static int ix[2] = {0,0}; /* Color chooser parameters */
136139
137140
if( ix[0]==0 ){
138141
if( skin_detail_boolean("white-foreground") ){
139
- ix[0] = 140;
140
- ix[1] = 40;
142
+ ix[0] = 0x50;
143
+ ix[1] = 0x20;
141144
}else{
142
- ix[0] = 216;
143
- ix[1] = 16;
145
+ ix[0] = 0xf8;
146
+ ix[1] = 0x20;
144147
}
145148
}
146149
for(i=0; z[i]; i++ ){
147150
h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
148151
}
149152
h1 = h % 6; h /= 6;
150
- h3 = h % 30; h /= 30;
151
- h4 = h % 40; h /= 40;
153
+ h3 = h % 10; h /= 10;
154
+ h4 = h % 10; h /= 10;
152155
mx = ix[0] - h3;
153156
mn = mx - h4 - ix[1];
154157
h2 = (h%(mx - mn)) + mn;
155158
switch( h1 ){
156159
case 0: r = mx; g = h2, b = mn; break;
@@ -189,10 +192,11 @@
189192
const char *zBr;
190193
char zNm[10];
191194
int i, cnt;
192195
login_check_credentials();
193196
197
+ style_set_current_feature("test");
194198
style_header("Hash Color Test");
195199
for(i=cnt=0; i<10; i++){
196200
sqlite3_snprintf(sizeof(zNm),zNm,"b%d",i);
197201
zBr = P(zNm);
198202
if( zBr && zBr[0] ){
@@ -214,11 +218,11 @@
214218
zBr = P(zNm);
215219
@ <input type="text" size="30" name='%s(zNm)' value='%h(PD(zNm,""))'><br />
216220
}
217221
@ <input type="submit">
218222
@ </form>
219
- style_finish_page("test");
223
+ style_finish_page();
220224
}
221225
222226
/*
223227
** Return a new timelineTable id.
224228
*/
@@ -542,12 +546,16 @@
542546
if( !isSelectedOrCurrent ){
543547
@ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'>
544548
}else{
545549
@ <td class="timeline%s(zStyle)Cell%s(zExtraClass)">
546550
}
547
- if( pGraph && zType[0]!='c' ){
548
- @ &bull;
551
+ if( pGraph ){
552
+ if( zType[0]=='e' ){
553
+ @ <b>Note:</b>
554
+ }else if( zType[0]!='c' ){
555
+ @ &bull;
556
+ }
549557
}
550558
if( modPending ){
551559
@ <span class="modpending">(Awaiting Moderator Approval)</span>
552560
}
553561
if( (tmFlags & TIMELINE_BISECT)!=0 && zType[0]=='c' ){
@@ -1628,14 +1636,21 @@
16281636
** c=TIMEORTAG Show events that happen "circa" TIMEORTAG
16291637
** cf=FILEHASH Show events around the time of the first use of
16301638
** the file with FILEHASH
16311639
** m=TIMEORTAG Highlight the event at TIMEORTAG
16321640
** n=COUNT Maximum number of events. "all" for no limit
1641
+** n1=COUNT Same as "n" but doesn't set the display-preference cookie
1642
+** Use "n1=COUNT" for a one-time display change
16331643
** p=CHECKIN Parents and ancestors of CHECKIN
16341644
** bt=PRIOR ... going back to PRIOR
16351645
** d=CHECKIN Children and descendants of CHECKIN
1636
-** dp=CHECKIN The same as 'd=CHECKIN&p=CHECKIN'
1646
+** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
1647
+** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
1648
+** bt=CHECKIN In conjunction with p=CX, this means show all
1649
+** ancestors of CX going back to the time of CHECKIN.
1650
+** All qualifying check-ins are shown unless there
1651
+** is also an n= or n1= query parameter.
16371652
** t=TAG Show only check-ins with the given TAG
16381653
** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
16391654
** rel Show related check-ins as well as those matching t=TAG
16401655
** mionly Limit rel to show ancestors but not descendants
16411656
** nowiki Do not show wiki associated with branch or tag
@@ -1655,10 +1670,12 @@
16551670
** from=CHECKIN Path from...
16561671
** to=CHECKIN ... to this
16571672
** shortest ... show only the shortest path
16581673
** rel ... also show related checkins
16591674
** uf=FILE_HASH Show only check-ins that contain the given file version
1675
+** All qualifying check-ins are shown unless there is
1676
+** also an n= or n1= query parameter.
16601677
** chng=GLOBLIST Show only check-ins that involve changes to a file whose
16611678
** name matches one of the comma-separate GLOBLIST
16621679
** brbg Background color determined by branch name
16631680
** ubg Background color determined by user
16641681
** deltabg Background color red for delta manifests or green
@@ -1689,13 +1706,13 @@
16891706
void page_timeline(void){
16901707
Stmt q; /* Query used to generate the timeline */
16911708
Blob sql; /* text of SQL used to generate timeline */
16921709
Blob desc; /* Description of the timeline */
16931710
int nEntry; /* Max number of entries on timeline */
1694
- int p_rid = name_to_typed_rid(P("p"),"ci"); /* artifact p and its parents */
1695
- int d_rid = name_to_typed_rid(P("d"),"ci"); /* artifact d and descendants */
1696
- int f_rid = name_to_typed_rid(P("f"),"ci"); /* artifact f and close family */
1711
+ int p_rid; /* artifact p and its parents */
1712
+ int d_rid; /* artifact d and descendants */
1713
+ int f_rid; /* artifact f and close family */
16971714
const char *zUser = P("u"); /* All entries by this user if not NULL */
16981715
const char *zType; /* Type of events to display */
16991716
const char *zAfter = P("a"); /* Events after this time */
17001717
const char *zBefore = P("b"); /* Events before this time */
17011718
const char *zCirca = P("c"); /* Events near this time */
@@ -1747,16 +1764,33 @@
17471764
int showCherrypicks = 1; /* True to show cherrypick merges */
17481765
int haveParameterN; /* True if n= query parameter present */
17491766
17501767
url_initialize(&url, "timeline");
17511768
cgi_query_parameters_to_url(&url);
1769
+
17521770
17531771
/* Set number of rows to display */
1754
- haveParameterN = P("n")!=0;
1755
- cookie_read_parameter("n","n");
17561772
z = P("n");
1757
- if( z==0 ) z = db_get("timeline-default-length",0);
1773
+ if( z!=0 ){
1774
+ haveParameterN = 1;
1775
+ cookie_write_parameter("n","n",0);
1776
+ }else{
1777
+ const char *z2;
1778
+ haveParameterN = 0;
1779
+ cookie_read_parameter("n","n");
1780
+ z = P("n");
1781
+ if( z==0 ){
1782
+ z = db_get("timeline-default-length",0);
1783
+ }
1784
+ cgi_replace_query_parameter("n",fossil_strdup(z));
1785
+ cookie_write_parameter("n","n",0);
1786
+ z2 = P("n1");
1787
+ if( z2 ){
1788
+ haveParameterN = 2;
1789
+ z = z2;
1790
+ }
1791
+ }
17581792
if( z ){
17591793
if( fossil_strcmp(z,"all")==0 ){
17601794
nEntry = 0;
17611795
}else{
17621796
nEntry = atoi(z);
@@ -1764,21 +1798,32 @@
17641798
z = "10";
17651799
nEntry = 10;
17661800
}
17671801
}
17681802
}else{
1769
- z = "50";
17701803
nEntry = 50;
17711804
}
1805
+
1806
+ /* Query parameters d=, p=, and f= and variants */
1807
+ z = P("p");
1808
+ p_rid = z ? name_to_typed_rid(z,"ci") : 0;
1809
+ z = P("d");
1810
+ d_rid = z ? name_to_typed_rid(z,"ci") : 0;
1811
+ z = P("f");
1812
+ f_rid = z ? name_to_typed_rid(z,"ci") : 0;
1813
+ z = P("df");
1814
+ if( z && (d_rid = name_to_typed_rid(z,"ci"))!=0 ){
1815
+ nEntry = 0;
1816
+ useDividers = 0;
1817
+ cgi_replace_query_parameter("d",fossil_strdup(z));
1818
+ }
17721819
17731820
/* Undocumented query parameter to set JS mode */
17741821
builtin_set_js_delivery_mode(P("jsmode"),1);
17751822
17761823
secondaryRid = name_to_typed_rid(P("sel2"),"ci");
17771824
selectedRid = name_to_typed_rid(P("sel1"),"ci");
1778
- cgi_replace_query_parameter("n",z);
1779
- cookie_write_parameter("n","n",0);
17801825
tmFlags |= timeline_ss_submenu();
17811826
cookie_link_parameter("advm","advm","0");
17821827
advancedMenu = atoi(PD("advm","0"));
17831828
17841829
/* Omit all cherry-pick merge lines if the "ncp" query parameter is
@@ -1913,10 +1958,11 @@
19131958
zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid);
19141959
db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)");
19151960
compute_uses_file("usesfile", ufid, 0);
19161961
zType = "ci";
19171962
disableY = 1;
1963
+ if( !haveParameterN ) nEntry = 0;
19181964
}else{
19191965
zUses = 0;
19201966
}
19211967
}
19221968
if( renameOnly ){
@@ -2105,11 +2151,11 @@
21052151
int ridBackTo = 0;
21062152
21072153
tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS;
21082154
if( p_rid && d_rid ){
21092155
if( p_rid!=d_rid ) p_rid = d_rid;
2110
- if( P("n")==0 ) nEntry = 10;
2156
+ if( !haveParameterN ) nEntry = 10;
21112157
}
21122158
db_multi_exec(
21132159
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
21142160
);
21152161
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d",
@@ -2129,11 +2175,11 @@
21292175
db_multi_exec("DELETE FROM ok");
21302176
}
21312177
if( p_rid ){
21322178
zBackTo = P("bt");
21332179
ridBackTo = zBackTo ? name_to_typed_rid(zBackTo,"ci") : 0;
2134
- if( !haveParameterN ) nEntry = 0;
2180
+ if( ridBackTo && !haveParameterN ) nEntry = 0;
21352181
compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0, ridBackTo);
21362182
np = db_int(0, "SELECT count(*)-1 FROM ok");
21372183
if( np>0 || nd==0 ){
21382184
if( nd>0 ) blob_appendf(&desc, " and ");
21392185
blob_appendf(&desc, "%d ancestor%s", np, (1==np)?"":"s");
@@ -2725,11 +2771,106 @@
27252771
if( zOlderButton ){
27262772
@ %z(chref("button","%s",zOlderButton))%h(zOlderButtonLabel)\
27272773
@ &nbsp;&darr;</a>
27282774
}
27292775
document_emit_js(/*handles pikchrs rendered above*/);
2730
- style_finish_page("timeline");
2776
+ style_finish_page();
2777
+}
2778
+
2779
+/*
2780
+** Translate a timeline entry into the printable format by
2781
+** converting every %-substitutions as follows:
2782
+**
2783
+** %n newline
2784
+** %% a raw %
2785
+** %H commit hash
2786
+** %h abbreviated commit hash
2787
+** %a author name
2788
+** %d date
2789
+** %c comment (\n, \t replaced by space, \r deleted)
2790
+** %b branch
2791
+** %t tags
2792
+** %p phase (zero or more of: *CURRENT*, *MERGE*, *FORK*,
2793
+** *UNPUBLISHED*, *LEAF*, *BRANCH*)
2794
+**
2795
+** The returned string is obtained from fossil_malloc() and should
2796
+** be freed by the caller.
2797
+*/
2798
+static char *timeline_entry_subst(
2799
+ const char *zFormat,
2800
+ int *nLine,
2801
+ const char *zId,
2802
+ const char *zDate,
2803
+ const char *zUser,
2804
+ const char *zCom,
2805
+ const char *zBranch,
2806
+ const char *zTags,
2807
+ const char *zPhase
2808
+){
2809
+ Blob r, co;
2810
+ int i, j;
2811
+ blob_init(&r, 0, 0);
2812
+ blob_init(&co, 0, 0);
2813
+
2814
+ /* Replace LF and tab with space, delete CR */
2815
+ while( zCom[0] ){
2816
+ for(j=0; zCom[j] && zCom[j]!='\r' && zCom[j]!='\n' && zCom[j]!='\t'; j++){}
2817
+ blob_append(&co, zCom, j);
2818
+ if( zCom[j]==0 ) break;
2819
+ if( zCom[j]!='\r')
2820
+ blob_append(&co, " ", 1);
2821
+ zCom += j+1;
2822
+ }
2823
+ blob_str(&co);
2824
+
2825
+ *nLine = 1;
2826
+ while( zFormat[0] ){
2827
+ for(i=0; zFormat[i] && zFormat[i]!='%'; i++){}
2828
+ blob_append(&r, zFormat, i);
2829
+ if( zFormat[i]==0 ) break;
2830
+ if( zFormat[i+1]=='%' ){
2831
+ blob_append(&r, "%", 1);
2832
+ zFormat += i+2;
2833
+ }else if( zFormat[i+1]=='n' ){
2834
+ blob_append(&r, "\n", 1);
2835
+ *nLine += 1;
2836
+ zFormat += i+2;
2837
+ }else if( zFormat[i+1]=='H' ){
2838
+ blob_append(&r, zId, -1);
2839
+ zFormat += i+2;
2840
+ }else if( zFormat[i+1]=='h' ){
2841
+ char *zFree = 0;
2842
+ zFree = mprintf("%S", zId);
2843
+ blob_append(&r, zFree, -1);
2844
+ fossil_free(zFree);
2845
+ zFormat += i+2;
2846
+ }else if( zFormat[i+1]=='d' ){
2847
+ blob_append(&r, zDate, -1);
2848
+ zFormat += i+2;
2849
+ }else if( zFormat[i+1]=='a' ){
2850
+ blob_append(&r, zUser, -1);
2851
+ zFormat += i+2;
2852
+ }else if( zFormat[i+1]=='c' ){
2853
+ blob_append(&r, co.aData, -1);
2854
+ zFormat += i+2;
2855
+ }else if( zFormat[i+1]=='b' ){
2856
+ if( zBranch ) blob_append(&r, zBranch, -1);
2857
+ zFormat += i+2;
2858
+ }else if( zFormat[i+1]=='t' ){
2859
+ blob_append(&r, zTags, -1);
2860
+ zFormat += i+2;
2861
+ }else if( zFormat[i+1]=='p' ){
2862
+ blob_append(&r, zPhase, -1);
2863
+ zFormat += i+2;
2864
+ }else{
2865
+ blob_append(&r, zFormat+i, 1);
2866
+ zFormat += i+1;
2867
+ }
2868
+ }
2869
+ fossil_free(co.aData);
2870
+ blob_str(&r);
2871
+ return r.aData;
27312872
}
27322873
27332874
/*
27342875
** The input query q selects various records. Print a human-readable
27352876
** summary of those records.
@@ -2745,18 +2886,21 @@
27452886
** The query should return these columns:
27462887
**
27472888
** 0. rid
27482889
** 1. uuid
27492890
** 2. Date/Time
2750
-** 3. Comment string and user
2891
+** 3. Comment string, user, and tags
27512892
** 4. Number of non-merge children
27522893
** 5. Number of parents
27532894
** 6. mtime
27542895
** 7. branch
27552896
** 8. event-type: 'ci', 'w', 't', 'f', and so forth.
2897
+** 9. comment
2898
+** 10. user
2899
+** 11. tags
27562900
*/
2757
-void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){
2901
+void print_timeline(Stmt *q, int nLimit, int width, const char *zFormat, int verboseFlag){
27582902
int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
27592903
int nLine = 0;
27602904
int nEntry = 0;
27612905
char zPrevDate[20];
27622906
const char *zCurrentUuid = 0;
@@ -2775,11 +2919,15 @@
27752919
const char *zId = db_column_text(q, 1);
27762920
const char *zDate = db_column_text(q, 2);
27772921
const char *zCom = db_column_text(q, 3);
27782922
int nChild = db_column_int(q, 4);
27792923
int nParent = db_column_int(q, 5);
2924
+ const char *zBranch = db_column_text(q, 7);
27802925
const char *zType = db_column_text(q, 8);
2926
+ const char *zComShort = db_column_text(q, 9);
2927
+ const char *zUserShort = db_column_text(q, 10);
2928
+ const char *zTags = db_column_text(q, 11);
27812929
char *zFree = 0;
27822930
int n = 0;
27832931
char zPrefix[80];
27842932
27852933
if( nAbsLimit!=0 ){
@@ -2789,17 +2937,18 @@
27892937
}else if( nEntry>=nAbsLimit ){
27902938
fossil_print("--- entry limit (%d) reached ---\n", nAbsLimit);
27912939
break; /* entry count limit hit, stop. */
27922940
}
27932941
}
2794
- if( fossil_strnicmp(zDate, zPrevDate, 10) ){
2942
+ if( zFormat == 0 && fossil_strnicmp(zDate, zPrevDate, 10) ){
27952943
fossil_print("=== %.10s ===\n", zDate);
27962944
memcpy(zPrevDate, zDate, 10);
27972945
nLine++; /* record another line */
27982946
}
27992947
if( zCom==0 ) zCom = "";
2800
- fossil_print("%.8s ", &zDate[11]);
2948
+ if( zFormat == 0 )
2949
+ fossil_print("%.8s ", &zDate[11]);
28012950
zPrefix[0] = 0;
28022951
if( nParent>1 ){
28032952
sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* ");
28042953
n = strlen(zPrefix);
28052954
}
@@ -2831,12 +2980,27 @@
28312980
zFree = mprintf("[%S] Edit to wiki page \"%s\"", zId, zCom+1);
28322981
}
28332982
}else{
28342983
zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
28352984
}
2836
- /* record another X lines */
2837
- nLine += comment_print(zFree, zCom, 9, width, get_comment_format());
2985
+
2986
+ if( zFormat ){
2987
+ char *zEntry;
2988
+ int nEntryLine = 0;
2989
+ if( nChild==0 ){
2990
+ sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*LEAF* ");
2991
+ }
2992
+ zEntry = timeline_entry_subst(zFormat, &nEntryLine, zId, zDate, zUserShort,
2993
+ zComShort, zBranch, zTags, zPrefix);
2994
+ nLine += nEntryLine;
2995
+ fossil_print("%s\n", zEntry);
2996
+ fossil_free(zEntry);
2997
+ }
2998
+ else{
2999
+ /* record another X lines */
3000
+ nLine += comment_print(zFree, zCom, 9, width, get_comment_format());
3001
+ }
28383002
fossil_free(zFree);
28393003
28403004
if(verboseFlag){
28413005
if( !fchngQueryInit ){
28423006
db_prepare(&fchngQuery,
@@ -2902,10 +3066,17 @@
29023066
@ AS primPlinkCount,
29033067
@ (SELECT count(*) FROM plink WHERE cid=blob.rid) AS plinkCount,
29043068
@ event.mtime AS mtime,
29053069
@ tagxref.value AS branch,
29063070
@ event.type
3071
+ @ , coalesce(ecomment,comment) AS comment0
3072
+ @ , coalesce(euser,user,'?') AS user0
3073
+ @ , (SELECT case when length(x)>0 then x else '' end
3074
+ @ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x
3075
+ @ FROM tag, tagxref
3076
+ @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
3077
+ @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0)) AS tags
29073078
@ FROM tag CROSS JOIN event CROSS JOIN blob
29083079
@ LEFT JOIN tagxref ON tagxref.tagid=tag.tagid
29093080
@ AND tagxref.tagtype>0
29103081
@ AND tagxref.rid=blob.rid
29113082
@ WHERE blob.rid=event.objid
@@ -2931,10 +3102,11 @@
29313102
*/
29323103
static int fossil_is_julianday(const char *zDate){
29333104
return db_int(0, "SELECT EXISTS (SELECT julianday(%Q) AS jd"
29343105
" WHERE jd IS NOT NULL)", zDate);
29353106
}
3107
+
29363108
29373109
/*
29383110
** COMMAND: timeline
29393111
**
29403112
** Usage: %fossil timeline ?WHEN? ?CHECKIN|DATETIME? ?OPTIONS?
@@ -2968,19 +3140,37 @@
29683140
** --offset P skip P changes
29693141
** --sql Show the SQL used to generate the timeline
29703142
** -t|--type TYPE Output items from the given types only, such as:
29713143
** ci = file commits only
29723144
** e = technical notes only
3145
+** f = forum posts only
29733146
** t = tickets only
29743147
** w = wiki commits only
29753148
** -v|--verbose Output the list of files changed by each commit
29763149
** and the type of each change (edited, deleted,
29773150
** etc.) after the check-in comment.
29783151
** -W|--width N Width of lines (default is to auto-detect). N must be
29793152
** either greater than 20 or it ust be zero 0 to
29803153
** indicate no limit, resulting in a single line per
29813154
** entry.
3155
+** -F|--format Entry format. Values "oneline", "medium", and "full"
3156
+** get mapped to the full options below. Otherwise a
3157
+** string which can contain these placeholders:
3158
+** %n newline
3159
+** %% a raw %
3160
+** %H commit hash
3161
+** %h abbreviated commit hash
3162
+** %a author name
3163
+** %d date
3164
+** %c comment (NL, TAB replaced by space, LF deleted)
3165
+** %b branch
3166
+** %t tags
3167
+** %p phase: zero or more of *CURRENT*, *MERGE*,
3168
+** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH*
3169
+** --oneline Show only short hash and comment for each entry
3170
+** --medium Medium-verbose entry formatting
3171
+** --full Extra verbose entry formatting
29823172
** -R REPO_FILE Specifies the repository db to use. Default is
29833173
** the current checkout's repository.
29843174
*/
29853175
void timeline_cmd(void){
29863176
Stmt q;
@@ -2996,10 +3186,11 @@
29963186
Blob uuid;
29973187
int mode = TIMELINE_MODE_NONE;
29983188
int verboseFlag = 0 ;
29993189
int iOffset;
30003190
const char *zFilePattern = 0;
3191
+ const char *zFormat = 0;
30013192
Blob treeName;
30023193
int showSql = 0;
30033194
30043195
verboseFlag = find_option("verbose","v", 0)!=0;
30053196
if( !verboseFlag){
@@ -3008,10 +3199,18 @@
30083199
db_find_and_open_repository(0, 0);
30093200
zLimit = find_option("limit","n",1);
30103201
zWidth = find_option("width","W",1);
30113202
zType = find_option("type","t",1);
30123203
zFilePattern = find_option("path","p",1);
3204
+ zFormat = find_option("format","F",1);
3205
+ if( find_option("oneline",0,0)!= 0 || fossil_strcmp(zFormat,"oneline")==0 )
3206
+ zFormat = "%h %c";
3207
+ if( find_option("medium",0,0)!= 0 || fossil_strcmp(zFormat,"medium")==0 )
3208
+ zFormat = "Commit: %h%nDate: %d%nAuthor: %a%nComment: %c%n";
3209
+ if( find_option("full",0,0)!= 0 || fossil_strcmp(zFormat,"full")==0 )
3210
+ zFormat = "Commit: %H%nDate: %d%nAuthor: %a%nComment: %c%n"
3211
+ "Branch: %b%nTags: %t%nPhase: %p%n";
30133212
showSql = find_option("sql",0,0)!=0;
30143213
30153214
if( !zLimit ){
30163215
zLimit = find_option("count",0,1);
30173216
}
@@ -3157,11 +3356,11 @@
31573356
if( showSql ){
31583357
fossil_print("%s\n", blob_str(&sql));
31593358
}
31603359
db_prepare_blob(&q, &sql);
31613360
blob_reset(&sql);
3162
- print_timeline(&q, n, width, verboseFlag);
3361
+ print_timeline(&q, n, width, zFormat, verboseFlag);
31633362
db_finalize(&q);
31643363
}
31653364
31663365
/*
31673366
** WEBPAGE: thisdayinhistory
@@ -3184,10 +3383,11 @@
31843383
login_check_credentials();
31853384
if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum) ){
31863385
login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
31873386
return;
31883387
}
3388
+ style_set_current_feature("timeline");
31893389
style_header("Today In History");
31903390
zToday = (char*)P("today");
31913391
if( zToday ){
31923392
zToday = timeline_expand_datetime(zToday);
31933393
if( !fossil_isdate(zToday) ) zToday = 0;
@@ -3231,11 +3431,11 @@
32313431
@ <small>%z(href("%R/timeline?c=%t",zId))(more context)</a>\
32323432
@ </small></h2>
32333433
www_print_timeline(&q, TIMELINE_GRAPH, 0, 0, 0, 0, 0, 0);
32343434
}
32353435
db_finalize(&q);
3236
- style_finish_page("timeline");
3436
+ style_finish_page();
32373437
}
32383438
32393439
32403440
/*
32413441
** COMMAND: test-timewarp-list
@@ -3337,7 +3537,7 @@
33373537
if( cnt==0 ){
33383538
@ <p>No timewarps in this repository</p>
33393539
}else{
33403540
@ </tbody></table></div>
33413541
}
3342
- style_finish_page("timewarps");
3542
+ style_finish_page();
33433543
}
33443544
--- src/timeline.c
+++ src/timeline.c
@@ -122,10 +122,13 @@
122 #define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */
123 #endif
124
125 /*
126 ** Hash a string and use the hash to determine a background color.
 
 
 
127 */
128 char *hash_color(const char *z){
129 int i; /* Loop counter */
130 unsigned int h = 0; /* Hash on the branch name */
131 int r, g, b; /* Values for red, green, and blue */
@@ -134,23 +137,23 @@
134 static char zColor[10]; /* The resulting color */
135 static int ix[2] = {0,0}; /* Color chooser parameters */
136
137 if( ix[0]==0 ){
138 if( skin_detail_boolean("white-foreground") ){
139 ix[0] = 140;
140 ix[1] = 40;
141 }else{
142 ix[0] = 216;
143 ix[1] = 16;
144 }
145 }
146 for(i=0; z[i]; i++ ){
147 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
148 }
149 h1 = h % 6; h /= 6;
150 h3 = h % 30; h /= 30;
151 h4 = h % 40; h /= 40;
152 mx = ix[0] - h3;
153 mn = mx - h4 - ix[1];
154 h2 = (h%(mx - mn)) + mn;
155 switch( h1 ){
156 case 0: r = mx; g = h2, b = mn; break;
@@ -189,10 +192,11 @@
189 const char *zBr;
190 char zNm[10];
191 int i, cnt;
192 login_check_credentials();
193
 
194 style_header("Hash Color Test");
195 for(i=cnt=0; i<10; i++){
196 sqlite3_snprintf(sizeof(zNm),zNm,"b%d",i);
197 zBr = P(zNm);
198 if( zBr && zBr[0] ){
@@ -214,11 +218,11 @@
214 zBr = P(zNm);
215 @ <input type="text" size="30" name='%s(zNm)' value='%h(PD(zNm,""))'><br />
216 }
217 @ <input type="submit">
218 @ </form>
219 style_finish_page("test");
220 }
221
222 /*
223 ** Return a new timelineTable id.
224 */
@@ -542,12 +546,16 @@
542 if( !isSelectedOrCurrent ){
543 @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'>
544 }else{
545 @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)">
546 }
547 if( pGraph && zType[0]!='c' ){
548 @ &bull;
 
 
 
 
549 }
550 if( modPending ){
551 @ <span class="modpending">(Awaiting Moderator Approval)</span>
552 }
553 if( (tmFlags & TIMELINE_BISECT)!=0 && zType[0]=='c' ){
@@ -1628,14 +1636,21 @@
1628 ** c=TIMEORTAG Show events that happen "circa" TIMEORTAG
1629 ** cf=FILEHASH Show events around the time of the first use of
1630 ** the file with FILEHASH
1631 ** m=TIMEORTAG Highlight the event at TIMEORTAG
1632 ** n=COUNT Maximum number of events. "all" for no limit
 
 
1633 ** p=CHECKIN Parents and ancestors of CHECKIN
1634 ** bt=PRIOR ... going back to PRIOR
1635 ** d=CHECKIN Children and descendants of CHECKIN
1636 ** dp=CHECKIN The same as 'd=CHECKIN&p=CHECKIN'
 
 
 
 
 
1637 ** t=TAG Show only check-ins with the given TAG
1638 ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
1639 ** rel Show related check-ins as well as those matching t=TAG
1640 ** mionly Limit rel to show ancestors but not descendants
1641 ** nowiki Do not show wiki associated with branch or tag
@@ -1655,10 +1670,12 @@
1655 ** from=CHECKIN Path from...
1656 ** to=CHECKIN ... to this
1657 ** shortest ... show only the shortest path
1658 ** rel ... also show related checkins
1659 ** uf=FILE_HASH Show only check-ins that contain the given file version
 
 
1660 ** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1661 ** name matches one of the comma-separate GLOBLIST
1662 ** brbg Background color determined by branch name
1663 ** ubg Background color determined by user
1664 ** deltabg Background color red for delta manifests or green
@@ -1689,13 +1706,13 @@
1689 void page_timeline(void){
1690 Stmt q; /* Query used to generate the timeline */
1691 Blob sql; /* text of SQL used to generate timeline */
1692 Blob desc; /* Description of the timeline */
1693 int nEntry; /* Max number of entries on timeline */
1694 int p_rid = name_to_typed_rid(P("p"),"ci"); /* artifact p and its parents */
1695 int d_rid = name_to_typed_rid(P("d"),"ci"); /* artifact d and descendants */
1696 int f_rid = name_to_typed_rid(P("f"),"ci"); /* artifact f and close family */
1697 const char *zUser = P("u"); /* All entries by this user if not NULL */
1698 const char *zType; /* Type of events to display */
1699 const char *zAfter = P("a"); /* Events after this time */
1700 const char *zBefore = P("b"); /* Events before this time */
1701 const char *zCirca = P("c"); /* Events near this time */
@@ -1747,16 +1764,33 @@
1747 int showCherrypicks = 1; /* True to show cherrypick merges */
1748 int haveParameterN; /* True if n= query parameter present */
1749
1750 url_initialize(&url, "timeline");
1751 cgi_query_parameters_to_url(&url);
 
1752
1753 /* Set number of rows to display */
1754 haveParameterN = P("n")!=0;
1755 cookie_read_parameter("n","n");
1756 z = P("n");
1757 if( z==0 ) z = db_get("timeline-default-length",0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1758 if( z ){
1759 if( fossil_strcmp(z,"all")==0 ){
1760 nEntry = 0;
1761 }else{
1762 nEntry = atoi(z);
@@ -1764,21 +1798,32 @@
1764 z = "10";
1765 nEntry = 10;
1766 }
1767 }
1768 }else{
1769 z = "50";
1770 nEntry = 50;
1771 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1772
1773 /* Undocumented query parameter to set JS mode */
1774 builtin_set_js_delivery_mode(P("jsmode"),1);
1775
1776 secondaryRid = name_to_typed_rid(P("sel2"),"ci");
1777 selectedRid = name_to_typed_rid(P("sel1"),"ci");
1778 cgi_replace_query_parameter("n",z);
1779 cookie_write_parameter("n","n",0);
1780 tmFlags |= timeline_ss_submenu();
1781 cookie_link_parameter("advm","advm","0");
1782 advancedMenu = atoi(PD("advm","0"));
1783
1784 /* Omit all cherry-pick merge lines if the "ncp" query parameter is
@@ -1913,10 +1958,11 @@
1913 zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid);
1914 db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)");
1915 compute_uses_file("usesfile", ufid, 0);
1916 zType = "ci";
1917 disableY = 1;
 
1918 }else{
1919 zUses = 0;
1920 }
1921 }
1922 if( renameOnly ){
@@ -2105,11 +2151,11 @@
2105 int ridBackTo = 0;
2106
2107 tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS;
2108 if( p_rid && d_rid ){
2109 if( p_rid!=d_rid ) p_rid = d_rid;
2110 if( P("n")==0 ) nEntry = 10;
2111 }
2112 db_multi_exec(
2113 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
2114 );
2115 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d",
@@ -2129,11 +2175,11 @@
2129 db_multi_exec("DELETE FROM ok");
2130 }
2131 if( p_rid ){
2132 zBackTo = P("bt");
2133 ridBackTo = zBackTo ? name_to_typed_rid(zBackTo,"ci") : 0;
2134 if( !haveParameterN ) nEntry = 0;
2135 compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0, ridBackTo);
2136 np = db_int(0, "SELECT count(*)-1 FROM ok");
2137 if( np>0 || nd==0 ){
2138 if( nd>0 ) blob_appendf(&desc, " and ");
2139 blob_appendf(&desc, "%d ancestor%s", np, (1==np)?"":"s");
@@ -2725,11 +2771,106 @@
2725 if( zOlderButton ){
2726 @ %z(chref("button","%s",zOlderButton))%h(zOlderButtonLabel)\
2727 @ &nbsp;&darr;</a>
2728 }
2729 document_emit_js(/*handles pikchrs rendered above*/);
2730 style_finish_page("timeline");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2731 }
2732
2733 /*
2734 ** The input query q selects various records. Print a human-readable
2735 ** summary of those records.
@@ -2745,18 +2886,21 @@
2745 ** The query should return these columns:
2746 **
2747 ** 0. rid
2748 ** 1. uuid
2749 ** 2. Date/Time
2750 ** 3. Comment string and user
2751 ** 4. Number of non-merge children
2752 ** 5. Number of parents
2753 ** 6. mtime
2754 ** 7. branch
2755 ** 8. event-type: 'ci', 'w', 't', 'f', and so forth.
 
 
 
2756 */
2757 void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){
2758 int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
2759 int nLine = 0;
2760 int nEntry = 0;
2761 char zPrevDate[20];
2762 const char *zCurrentUuid = 0;
@@ -2775,11 +2919,15 @@
2775 const char *zId = db_column_text(q, 1);
2776 const char *zDate = db_column_text(q, 2);
2777 const char *zCom = db_column_text(q, 3);
2778 int nChild = db_column_int(q, 4);
2779 int nParent = db_column_int(q, 5);
 
2780 const char *zType = db_column_text(q, 8);
 
 
 
2781 char *zFree = 0;
2782 int n = 0;
2783 char zPrefix[80];
2784
2785 if( nAbsLimit!=0 ){
@@ -2789,17 +2937,18 @@
2789 }else if( nEntry>=nAbsLimit ){
2790 fossil_print("--- entry limit (%d) reached ---\n", nAbsLimit);
2791 break; /* entry count limit hit, stop. */
2792 }
2793 }
2794 if( fossil_strnicmp(zDate, zPrevDate, 10) ){
2795 fossil_print("=== %.10s ===\n", zDate);
2796 memcpy(zPrevDate, zDate, 10);
2797 nLine++; /* record another line */
2798 }
2799 if( zCom==0 ) zCom = "";
2800 fossil_print("%.8s ", &zDate[11]);
 
2801 zPrefix[0] = 0;
2802 if( nParent>1 ){
2803 sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* ");
2804 n = strlen(zPrefix);
2805 }
@@ -2831,12 +2980,27 @@
2831 zFree = mprintf("[%S] Edit to wiki page \"%s\"", zId, zCom+1);
2832 }
2833 }else{
2834 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
2835 }
2836 /* record another X lines */
2837 nLine += comment_print(zFree, zCom, 9, width, get_comment_format());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2838 fossil_free(zFree);
2839
2840 if(verboseFlag){
2841 if( !fchngQueryInit ){
2842 db_prepare(&fchngQuery,
@@ -2902,10 +3066,17 @@
2902 @ AS primPlinkCount,
2903 @ (SELECT count(*) FROM plink WHERE cid=blob.rid) AS plinkCount,
2904 @ event.mtime AS mtime,
2905 @ tagxref.value AS branch,
2906 @ event.type
 
 
 
 
 
 
 
2907 @ FROM tag CROSS JOIN event CROSS JOIN blob
2908 @ LEFT JOIN tagxref ON tagxref.tagid=tag.tagid
2909 @ AND tagxref.tagtype>0
2910 @ AND tagxref.rid=blob.rid
2911 @ WHERE blob.rid=event.objid
@@ -2931,10 +3102,11 @@
2931 */
2932 static int fossil_is_julianday(const char *zDate){
2933 return db_int(0, "SELECT EXISTS (SELECT julianday(%Q) AS jd"
2934 " WHERE jd IS NOT NULL)", zDate);
2935 }
 
2936
2937 /*
2938 ** COMMAND: timeline
2939 **
2940 ** Usage: %fossil timeline ?WHEN? ?CHECKIN|DATETIME? ?OPTIONS?
@@ -2968,19 +3140,37 @@
2968 ** --offset P skip P changes
2969 ** --sql Show the SQL used to generate the timeline
2970 ** -t|--type TYPE Output items from the given types only, such as:
2971 ** ci = file commits only
2972 ** e = technical notes only
 
2973 ** t = tickets only
2974 ** w = wiki commits only
2975 ** -v|--verbose Output the list of files changed by each commit
2976 ** and the type of each change (edited, deleted,
2977 ** etc.) after the check-in comment.
2978 ** -W|--width N Width of lines (default is to auto-detect). N must be
2979 ** either greater than 20 or it ust be zero 0 to
2980 ** indicate no limit, resulting in a single line per
2981 ** entry.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2982 ** -R REPO_FILE Specifies the repository db to use. Default is
2983 ** the current checkout's repository.
2984 */
2985 void timeline_cmd(void){
2986 Stmt q;
@@ -2996,10 +3186,11 @@
2996 Blob uuid;
2997 int mode = TIMELINE_MODE_NONE;
2998 int verboseFlag = 0 ;
2999 int iOffset;
3000 const char *zFilePattern = 0;
 
3001 Blob treeName;
3002 int showSql = 0;
3003
3004 verboseFlag = find_option("verbose","v", 0)!=0;
3005 if( !verboseFlag){
@@ -3008,10 +3199,18 @@
3008 db_find_and_open_repository(0, 0);
3009 zLimit = find_option("limit","n",1);
3010 zWidth = find_option("width","W",1);
3011 zType = find_option("type","t",1);
3012 zFilePattern = find_option("path","p",1);
 
 
 
 
 
 
 
 
3013 showSql = find_option("sql",0,0)!=0;
3014
3015 if( !zLimit ){
3016 zLimit = find_option("count",0,1);
3017 }
@@ -3157,11 +3356,11 @@
3157 if( showSql ){
3158 fossil_print("%s\n", blob_str(&sql));
3159 }
3160 db_prepare_blob(&q, &sql);
3161 blob_reset(&sql);
3162 print_timeline(&q, n, width, verboseFlag);
3163 db_finalize(&q);
3164 }
3165
3166 /*
3167 ** WEBPAGE: thisdayinhistory
@@ -3184,10 +3383,11 @@
3184 login_check_credentials();
3185 if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum) ){
3186 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
3187 return;
3188 }
 
3189 style_header("Today In History");
3190 zToday = (char*)P("today");
3191 if( zToday ){
3192 zToday = timeline_expand_datetime(zToday);
3193 if( !fossil_isdate(zToday) ) zToday = 0;
@@ -3231,11 +3431,11 @@
3231 @ <small>%z(href("%R/timeline?c=%t",zId))(more context)</a>\
3232 @ </small></h2>
3233 www_print_timeline(&q, TIMELINE_GRAPH, 0, 0, 0, 0, 0, 0);
3234 }
3235 db_finalize(&q);
3236 style_finish_page("timeline");
3237 }
3238
3239
3240 /*
3241 ** COMMAND: test-timewarp-list
@@ -3337,7 +3537,7 @@
3337 if( cnt==0 ){
3338 @ <p>No timewarps in this repository</p>
3339 }else{
3340 @ </tbody></table></div>
3341 }
3342 style_finish_page("timewarps");
3343 }
3344
--- src/timeline.c
+++ src/timeline.c
@@ -122,10 +122,13 @@
122 #define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */
123 #endif
124
125 /*
126 ** Hash a string and use the hash to determine a background color.
127 **
128 ** This value returned is in static space and is overwritten with
129 ** each subsequent call.
130 */
131 char *hash_color(const char *z){
132 int i; /* Loop counter */
133 unsigned int h = 0; /* Hash on the branch name */
134 int r, g, b; /* Values for red, green, and blue */
@@ -134,23 +137,23 @@
137 static char zColor[10]; /* The resulting color */
138 static int ix[2] = {0,0}; /* Color chooser parameters */
139
140 if( ix[0]==0 ){
141 if( skin_detail_boolean("white-foreground") ){
142 ix[0] = 0x50;
143 ix[1] = 0x20;
144 }else{
145 ix[0] = 0xf8;
146 ix[1] = 0x20;
147 }
148 }
149 for(i=0; z[i]; i++ ){
150 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
151 }
152 h1 = h % 6; h /= 6;
153 h3 = h % 10; h /= 10;
154 h4 = h % 10; h /= 10;
155 mx = ix[0] - h3;
156 mn = mx - h4 - ix[1];
157 h2 = (h%(mx - mn)) + mn;
158 switch( h1 ){
159 case 0: r = mx; g = h2, b = mn; break;
@@ -189,10 +192,11 @@
192 const char *zBr;
193 char zNm[10];
194 int i, cnt;
195 login_check_credentials();
196
197 style_set_current_feature("test");
198 style_header("Hash Color Test");
199 for(i=cnt=0; i<10; i++){
200 sqlite3_snprintf(sizeof(zNm),zNm,"b%d",i);
201 zBr = P(zNm);
202 if( zBr && zBr[0] ){
@@ -214,11 +218,11 @@
218 zBr = P(zNm);
219 @ <input type="text" size="30" name='%s(zNm)' value='%h(PD(zNm,""))'><br />
220 }
221 @ <input type="submit">
222 @ </form>
223 style_finish_page();
224 }
225
226 /*
227 ** Return a new timelineTable id.
228 */
@@ -542,12 +546,16 @@
546 if( !isSelectedOrCurrent ){
547 @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'>
548 }else{
549 @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)">
550 }
551 if( pGraph ){
552 if( zType[0]=='e' ){
553 @ <b>Note:</b>
554 }else if( zType[0]!='c' ){
555 @ &bull;
556 }
557 }
558 if( modPending ){
559 @ <span class="modpending">(Awaiting Moderator Approval)</span>
560 }
561 if( (tmFlags & TIMELINE_BISECT)!=0 && zType[0]=='c' ){
@@ -1628,14 +1636,21 @@
1636 ** c=TIMEORTAG Show events that happen "circa" TIMEORTAG
1637 ** cf=FILEHASH Show events around the time of the first use of
1638 ** the file with FILEHASH
1639 ** m=TIMEORTAG Highlight the event at TIMEORTAG
1640 ** n=COUNT Maximum number of events. "all" for no limit
1641 ** n1=COUNT Same as "n" but doesn't set the display-preference cookie
1642 ** Use "n1=COUNT" for a one-time display change
1643 ** p=CHECKIN Parents and ancestors of CHECKIN
1644 ** bt=PRIOR ... going back to PRIOR
1645 ** d=CHECKIN Children and descendants of CHECKIN
1646 ** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN'
1647 ** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From"
1648 ** bt=CHECKIN In conjunction with p=CX, this means show all
1649 ** ancestors of CX going back to the time of CHECKIN.
1650 ** All qualifying check-ins are shown unless there
1651 ** is also an n= or n1= query parameter.
1652 ** t=TAG Show only check-ins with the given TAG
1653 ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
1654 ** rel Show related check-ins as well as those matching t=TAG
1655 ** mionly Limit rel to show ancestors but not descendants
1656 ** nowiki Do not show wiki associated with branch or tag
@@ -1655,10 +1670,12 @@
1670 ** from=CHECKIN Path from...
1671 ** to=CHECKIN ... to this
1672 ** shortest ... show only the shortest path
1673 ** rel ... also show related checkins
1674 ** uf=FILE_HASH Show only check-ins that contain the given file version
1675 ** All qualifying check-ins are shown unless there is
1676 ** also an n= or n1= query parameter.
1677 ** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1678 ** name matches one of the comma-separate GLOBLIST
1679 ** brbg Background color determined by branch name
1680 ** ubg Background color determined by user
1681 ** deltabg Background color red for delta manifests or green
@@ -1689,13 +1706,13 @@
1706 void page_timeline(void){
1707 Stmt q; /* Query used to generate the timeline */
1708 Blob sql; /* text of SQL used to generate timeline */
1709 Blob desc; /* Description of the timeline */
1710 int nEntry; /* Max number of entries on timeline */
1711 int p_rid; /* artifact p and its parents */
1712 int d_rid; /* artifact d and descendants */
1713 int f_rid; /* artifact f and close family */
1714 const char *zUser = P("u"); /* All entries by this user if not NULL */
1715 const char *zType; /* Type of events to display */
1716 const char *zAfter = P("a"); /* Events after this time */
1717 const char *zBefore = P("b"); /* Events before this time */
1718 const char *zCirca = P("c"); /* Events near this time */
@@ -1747,16 +1764,33 @@
1764 int showCherrypicks = 1; /* True to show cherrypick merges */
1765 int haveParameterN; /* True if n= query parameter present */
1766
1767 url_initialize(&url, "timeline");
1768 cgi_query_parameters_to_url(&url);
1769
1770
1771 /* Set number of rows to display */
 
 
1772 z = P("n");
1773 if( z!=0 ){
1774 haveParameterN = 1;
1775 cookie_write_parameter("n","n",0);
1776 }else{
1777 const char *z2;
1778 haveParameterN = 0;
1779 cookie_read_parameter("n","n");
1780 z = P("n");
1781 if( z==0 ){
1782 z = db_get("timeline-default-length",0);
1783 }
1784 cgi_replace_query_parameter("n",fossil_strdup(z));
1785 cookie_write_parameter("n","n",0);
1786 z2 = P("n1");
1787 if( z2 ){
1788 haveParameterN = 2;
1789 z = z2;
1790 }
1791 }
1792 if( z ){
1793 if( fossil_strcmp(z,"all")==0 ){
1794 nEntry = 0;
1795 }else{
1796 nEntry = atoi(z);
@@ -1764,21 +1798,32 @@
1798 z = "10";
1799 nEntry = 10;
1800 }
1801 }
1802 }else{
 
1803 nEntry = 50;
1804 }
1805
1806 /* Query parameters d=, p=, and f= and variants */
1807 z = P("p");
1808 p_rid = z ? name_to_typed_rid(z,"ci") : 0;
1809 z = P("d");
1810 d_rid = z ? name_to_typed_rid(z,"ci") : 0;
1811 z = P("f");
1812 f_rid = z ? name_to_typed_rid(z,"ci") : 0;
1813 z = P("df");
1814 if( z && (d_rid = name_to_typed_rid(z,"ci"))!=0 ){
1815 nEntry = 0;
1816 useDividers = 0;
1817 cgi_replace_query_parameter("d",fossil_strdup(z));
1818 }
1819
1820 /* Undocumented query parameter to set JS mode */
1821 builtin_set_js_delivery_mode(P("jsmode"),1);
1822
1823 secondaryRid = name_to_typed_rid(P("sel2"),"ci");
1824 selectedRid = name_to_typed_rid(P("sel1"),"ci");
 
 
1825 tmFlags |= timeline_ss_submenu();
1826 cookie_link_parameter("advm","advm","0");
1827 advancedMenu = atoi(PD("advm","0"));
1828
1829 /* Omit all cherry-pick merge lines if the "ncp" query parameter is
@@ -1913,10 +1958,11 @@
1958 zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid);
1959 db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)");
1960 compute_uses_file("usesfile", ufid, 0);
1961 zType = "ci";
1962 disableY = 1;
1963 if( !haveParameterN ) nEntry = 0;
1964 }else{
1965 zUses = 0;
1966 }
1967 }
1968 if( renameOnly ){
@@ -2105,11 +2151,11 @@
2151 int ridBackTo = 0;
2152
2153 tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS;
2154 if( p_rid && d_rid ){
2155 if( p_rid!=d_rid ) p_rid = d_rid;
2156 if( !haveParameterN ) nEntry = 10;
2157 }
2158 db_multi_exec(
2159 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
2160 );
2161 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d",
@@ -2129,11 +2175,11 @@
2175 db_multi_exec("DELETE FROM ok");
2176 }
2177 if( p_rid ){
2178 zBackTo = P("bt");
2179 ridBackTo = zBackTo ? name_to_typed_rid(zBackTo,"ci") : 0;
2180 if( ridBackTo && !haveParameterN ) nEntry = 0;
2181 compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0, ridBackTo);
2182 np = db_int(0, "SELECT count(*)-1 FROM ok");
2183 if( np>0 || nd==0 ){
2184 if( nd>0 ) blob_appendf(&desc, " and ");
2185 blob_appendf(&desc, "%d ancestor%s", np, (1==np)?"":"s");
@@ -2725,11 +2771,106 @@
2771 if( zOlderButton ){
2772 @ %z(chref("button","%s",zOlderButton))%h(zOlderButtonLabel)\
2773 @ &nbsp;&darr;</a>
2774 }
2775 document_emit_js(/*handles pikchrs rendered above*/);
2776 style_finish_page();
2777 }
2778
2779 /*
2780 ** Translate a timeline entry into the printable format by
2781 ** converting every %-substitutions as follows:
2782 **
2783 ** %n newline
2784 ** %% a raw %
2785 ** %H commit hash
2786 ** %h abbreviated commit hash
2787 ** %a author name
2788 ** %d date
2789 ** %c comment (\n, \t replaced by space, \r deleted)
2790 ** %b branch
2791 ** %t tags
2792 ** %p phase (zero or more of: *CURRENT*, *MERGE*, *FORK*,
2793 ** *UNPUBLISHED*, *LEAF*, *BRANCH*)
2794 **
2795 ** The returned string is obtained from fossil_malloc() and should
2796 ** be freed by the caller.
2797 */
2798 static char *timeline_entry_subst(
2799 const char *zFormat,
2800 int *nLine,
2801 const char *zId,
2802 const char *zDate,
2803 const char *zUser,
2804 const char *zCom,
2805 const char *zBranch,
2806 const char *zTags,
2807 const char *zPhase
2808 ){
2809 Blob r, co;
2810 int i, j;
2811 blob_init(&r, 0, 0);
2812 blob_init(&co, 0, 0);
2813
2814 /* Replace LF and tab with space, delete CR */
2815 while( zCom[0] ){
2816 for(j=0; zCom[j] && zCom[j]!='\r' && zCom[j]!='\n' && zCom[j]!='\t'; j++){}
2817 blob_append(&co, zCom, j);
2818 if( zCom[j]==0 ) break;
2819 if( zCom[j]!='\r')
2820 blob_append(&co, " ", 1);
2821 zCom += j+1;
2822 }
2823 blob_str(&co);
2824
2825 *nLine = 1;
2826 while( zFormat[0] ){
2827 for(i=0; zFormat[i] && zFormat[i]!='%'; i++){}
2828 blob_append(&r, zFormat, i);
2829 if( zFormat[i]==0 ) break;
2830 if( zFormat[i+1]=='%' ){
2831 blob_append(&r, "%", 1);
2832 zFormat += i+2;
2833 }else if( zFormat[i+1]=='n' ){
2834 blob_append(&r, "\n", 1);
2835 *nLine += 1;
2836 zFormat += i+2;
2837 }else if( zFormat[i+1]=='H' ){
2838 blob_append(&r, zId, -1);
2839 zFormat += i+2;
2840 }else if( zFormat[i+1]=='h' ){
2841 char *zFree = 0;
2842 zFree = mprintf("%S", zId);
2843 blob_append(&r, zFree, -1);
2844 fossil_free(zFree);
2845 zFormat += i+2;
2846 }else if( zFormat[i+1]=='d' ){
2847 blob_append(&r, zDate, -1);
2848 zFormat += i+2;
2849 }else if( zFormat[i+1]=='a' ){
2850 blob_append(&r, zUser, -1);
2851 zFormat += i+2;
2852 }else if( zFormat[i+1]=='c' ){
2853 blob_append(&r, co.aData, -1);
2854 zFormat += i+2;
2855 }else if( zFormat[i+1]=='b' ){
2856 if( zBranch ) blob_append(&r, zBranch, -1);
2857 zFormat += i+2;
2858 }else if( zFormat[i+1]=='t' ){
2859 blob_append(&r, zTags, -1);
2860 zFormat += i+2;
2861 }else if( zFormat[i+1]=='p' ){
2862 blob_append(&r, zPhase, -1);
2863 zFormat += i+2;
2864 }else{
2865 blob_append(&r, zFormat+i, 1);
2866 zFormat += i+1;
2867 }
2868 }
2869 fossil_free(co.aData);
2870 blob_str(&r);
2871 return r.aData;
2872 }
2873
2874 /*
2875 ** The input query q selects various records. Print a human-readable
2876 ** summary of those records.
@@ -2745,18 +2886,21 @@
2886 ** The query should return these columns:
2887 **
2888 ** 0. rid
2889 ** 1. uuid
2890 ** 2. Date/Time
2891 ** 3. Comment string, user, and tags
2892 ** 4. Number of non-merge children
2893 ** 5. Number of parents
2894 ** 6. mtime
2895 ** 7. branch
2896 ** 8. event-type: 'ci', 'w', 't', 'f', and so forth.
2897 ** 9. comment
2898 ** 10. user
2899 ** 11. tags
2900 */
2901 void print_timeline(Stmt *q, int nLimit, int width, const char *zFormat, int verboseFlag){
2902 int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
2903 int nLine = 0;
2904 int nEntry = 0;
2905 char zPrevDate[20];
2906 const char *zCurrentUuid = 0;
@@ -2775,11 +2919,15 @@
2919 const char *zId = db_column_text(q, 1);
2920 const char *zDate = db_column_text(q, 2);
2921 const char *zCom = db_column_text(q, 3);
2922 int nChild = db_column_int(q, 4);
2923 int nParent = db_column_int(q, 5);
2924 const char *zBranch = db_column_text(q, 7);
2925 const char *zType = db_column_text(q, 8);
2926 const char *zComShort = db_column_text(q, 9);
2927 const char *zUserShort = db_column_text(q, 10);
2928 const char *zTags = db_column_text(q, 11);
2929 char *zFree = 0;
2930 int n = 0;
2931 char zPrefix[80];
2932
2933 if( nAbsLimit!=0 ){
@@ -2789,17 +2937,18 @@
2937 }else if( nEntry>=nAbsLimit ){
2938 fossil_print("--- entry limit (%d) reached ---\n", nAbsLimit);
2939 break; /* entry count limit hit, stop. */
2940 }
2941 }
2942 if( zFormat == 0 && fossil_strnicmp(zDate, zPrevDate, 10) ){
2943 fossil_print("=== %.10s ===\n", zDate);
2944 memcpy(zPrevDate, zDate, 10);
2945 nLine++; /* record another line */
2946 }
2947 if( zCom==0 ) zCom = "";
2948 if( zFormat == 0 )
2949 fossil_print("%.8s ", &zDate[11]);
2950 zPrefix[0] = 0;
2951 if( nParent>1 ){
2952 sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* ");
2953 n = strlen(zPrefix);
2954 }
@@ -2831,12 +2980,27 @@
2980 zFree = mprintf("[%S] Edit to wiki page \"%s\"", zId, zCom+1);
2981 }
2982 }else{
2983 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
2984 }
2985
2986 if( zFormat ){
2987 char *zEntry;
2988 int nEntryLine = 0;
2989 if( nChild==0 ){
2990 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*LEAF* ");
2991 }
2992 zEntry = timeline_entry_subst(zFormat, &nEntryLine, zId, zDate, zUserShort,
2993 zComShort, zBranch, zTags, zPrefix);
2994 nLine += nEntryLine;
2995 fossil_print("%s\n", zEntry);
2996 fossil_free(zEntry);
2997 }
2998 else{
2999 /* record another X lines */
3000 nLine += comment_print(zFree, zCom, 9, width, get_comment_format());
3001 }
3002 fossil_free(zFree);
3003
3004 if(verboseFlag){
3005 if( !fchngQueryInit ){
3006 db_prepare(&fchngQuery,
@@ -2902,10 +3066,17 @@
3066 @ AS primPlinkCount,
3067 @ (SELECT count(*) FROM plink WHERE cid=blob.rid) AS plinkCount,
3068 @ event.mtime AS mtime,
3069 @ tagxref.value AS branch,
3070 @ event.type
3071 @ , coalesce(ecomment,comment) AS comment0
3072 @ , coalesce(euser,user,'?') AS user0
3073 @ , (SELECT case when length(x)>0 then x else '' end
3074 @ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x
3075 @ FROM tag, tagxref
3076 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
3077 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0)) AS tags
3078 @ FROM tag CROSS JOIN event CROSS JOIN blob
3079 @ LEFT JOIN tagxref ON tagxref.tagid=tag.tagid
3080 @ AND tagxref.tagtype>0
3081 @ AND tagxref.rid=blob.rid
3082 @ WHERE blob.rid=event.objid
@@ -2931,10 +3102,11 @@
3102 */
3103 static int fossil_is_julianday(const char *zDate){
3104 return db_int(0, "SELECT EXISTS (SELECT julianday(%Q) AS jd"
3105 " WHERE jd IS NOT NULL)", zDate);
3106 }
3107
3108
3109 /*
3110 ** COMMAND: timeline
3111 **
3112 ** Usage: %fossil timeline ?WHEN? ?CHECKIN|DATETIME? ?OPTIONS?
@@ -2968,19 +3140,37 @@
3140 ** --offset P skip P changes
3141 ** --sql Show the SQL used to generate the timeline
3142 ** -t|--type TYPE Output items from the given types only, such as:
3143 ** ci = file commits only
3144 ** e = technical notes only
3145 ** f = forum posts only
3146 ** t = tickets only
3147 ** w = wiki commits only
3148 ** -v|--verbose Output the list of files changed by each commit
3149 ** and the type of each change (edited, deleted,
3150 ** etc.) after the check-in comment.
3151 ** -W|--width N Width of lines (default is to auto-detect). N must be
3152 ** either greater than 20 or it ust be zero 0 to
3153 ** indicate no limit, resulting in a single line per
3154 ** entry.
3155 ** -F|--format Entry format. Values "oneline", "medium", and "full"
3156 ** get mapped to the full options below. Otherwise a
3157 ** string which can contain these placeholders:
3158 ** %n newline
3159 ** %% a raw %
3160 ** %H commit hash
3161 ** %h abbreviated commit hash
3162 ** %a author name
3163 ** %d date
3164 ** %c comment (NL, TAB replaced by space, LF deleted)
3165 ** %b branch
3166 ** %t tags
3167 ** %p phase: zero or more of *CURRENT*, *MERGE*,
3168 ** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH*
3169 ** --oneline Show only short hash and comment for each entry
3170 ** --medium Medium-verbose entry formatting
3171 ** --full Extra verbose entry formatting
3172 ** -R REPO_FILE Specifies the repository db to use. Default is
3173 ** the current checkout's repository.
3174 */
3175 void timeline_cmd(void){
3176 Stmt q;
@@ -2996,10 +3186,11 @@
3186 Blob uuid;
3187 int mode = TIMELINE_MODE_NONE;
3188 int verboseFlag = 0 ;
3189 int iOffset;
3190 const char *zFilePattern = 0;
3191 const char *zFormat = 0;
3192 Blob treeName;
3193 int showSql = 0;
3194
3195 verboseFlag = find_option("verbose","v", 0)!=0;
3196 if( !verboseFlag){
@@ -3008,10 +3199,18 @@
3199 db_find_and_open_repository(0, 0);
3200 zLimit = find_option("limit","n",1);
3201 zWidth = find_option("width","W",1);
3202 zType = find_option("type","t",1);
3203 zFilePattern = find_option("path","p",1);
3204 zFormat = find_option("format","F",1);
3205 if( find_option("oneline",0,0)!= 0 || fossil_strcmp(zFormat,"oneline")==0 )
3206 zFormat = "%h %c";
3207 if( find_option("medium",0,0)!= 0 || fossil_strcmp(zFormat,"medium")==0 )
3208 zFormat = "Commit: %h%nDate: %d%nAuthor: %a%nComment: %c%n";
3209 if( find_option("full",0,0)!= 0 || fossil_strcmp(zFormat,"full")==0 )
3210 zFormat = "Commit: %H%nDate: %d%nAuthor: %a%nComment: %c%n"
3211 "Branch: %b%nTags: %t%nPhase: %p%n";
3212 showSql = find_option("sql",0,0)!=0;
3213
3214 if( !zLimit ){
3215 zLimit = find_option("count",0,1);
3216 }
@@ -3157,11 +3356,11 @@
3356 if( showSql ){
3357 fossil_print("%s\n", blob_str(&sql));
3358 }
3359 db_prepare_blob(&q, &sql);
3360 blob_reset(&sql);
3361 print_timeline(&q, n, width, zFormat, verboseFlag);
3362 db_finalize(&q);
3363 }
3364
3365 /*
3366 ** WEBPAGE: thisdayinhistory
@@ -3184,10 +3383,11 @@
3383 login_check_credentials();
3384 if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum) ){
3385 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
3386 return;
3387 }
3388 style_set_current_feature("timeline");
3389 style_header("Today In History");
3390 zToday = (char*)P("today");
3391 if( zToday ){
3392 zToday = timeline_expand_datetime(zToday);
3393 if( !fossil_isdate(zToday) ) zToday = 0;
@@ -3231,11 +3431,11 @@
3431 @ <small>%z(href("%R/timeline?c=%t",zId))(more context)</a>\
3432 @ </small></h2>
3433 www_print_timeline(&q, TIMELINE_GRAPH, 0, 0, 0, 0, 0, 0);
3434 }
3435 db_finalize(&q);
3436 style_finish_page();
3437 }
3438
3439
3440 /*
3441 ** COMMAND: test-timewarp-list
@@ -3337,7 +3537,7 @@
3537 if( cnt==0 ){
3538 @ <p>No timewarps in this repository</p>
3539 }else{
3540 @ </tbody></table></div>
3541 }
3542 style_finish_page();
3543 }
3544
+19 -13
--- src/tkt.c
+++ src/tkt.c
@@ -585,10 +585,11 @@
585585
if( P("plaintext") ){
586586
style_submenu_element("Formatted", "%R/tktview/%s", zUuid);
587587
}else{
588588
style_submenu_element("Plaintext", "%R/tktview/%s?plaintext", zUuid);
589589
}
590
+ style_set_current_feature("tkt");
590591
style_header("View Ticket");
591592
if( showTimeline ){
592593
int tagid = db_int(0,"SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
593594
zUuid);
594595
if( tagid ){
@@ -618,11 +619,11 @@
618619
" WHERE tkt_uuid GLOB '%q*'", zUuid);
619620
if( zFullName ){
620621
attachment_list(zFullName, "<hr /><h2>Attachments:</h2><ul>");
621622
}
622623
623
- style_finish_page("tkt");
624
+ style_finish_page();
624625
}
625626
626627
/*
627628
** TH1 command: append_field FIELD STRING
628629
**
@@ -815,10 +816,11 @@
815816
login_check_credentials();
816817
if( !g.perm.NewTkt ){ login_needed(g.anon.NewTkt); return; }
817818
if( P("cancel") ){
818819
cgi_redirect("home");
819820
}
821
+ style_set_current_feature("tkt");
820822
style_header("New Ticket");
821823
ticket_standard_submenu(T_ALL_BUT(T_NEW));
822824
if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
823825
ticket_init();
824826
initializeVariablesFromCGI();
@@ -841,11 +843,11 @@
841843
return;
842844
}
843845
captcha_generate(0);
844846
@ </form>
845847
if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1);
846
- style_finish_page("tkt");
848
+ style_finish_page();
847849
}
848850
849851
/*
850852
** WEBPAGE: tktedit
851853
** WEBPAGE: debug_tktedit
@@ -870,28 +872,29 @@
870872
}
871873
zName = P("name");
872874
if( P("cancel") ){
873875
cgi_redirectf("tktview?name=%T", zName);
874876
}
877
+ style_set_current_feature("tkt");
875878
style_header("Edit Ticket");
876879
if( zName==0 || (nName = strlen(zName))<4 || nName>HNAME_LEN_SHA1
877880
|| !validate16(zName,nName) ){
878881
@ <span class="tktError">Not a valid ticket id: "%h(zName)"</span>
879
- style_finish_page("tkt");
882
+ style_finish_page();
880883
return;
881884
}
882885
nRec = db_int(0, "SELECT count(*) FROM ticket WHERE tkt_uuid GLOB '%q*'",
883886
zName);
884887
if( nRec==0 ){
885888
@ <span class="tktError">No such ticket: "%h(zName)"</span>
886
- style_finish_page("tkt");
889
+ style_finish_page();
887890
return;
888891
}
889892
if( nRec>1 ){
890893
@ <span class="tktError">%d(nRec) tickets begin with:
891894
@ "%h(zName)"</span>
892
- style_finish_page("tkt");
895
+ style_finish_page();
893896
return;
894897
}
895898
if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1);
896899
ticket_init();
897900
getAllTicketFields();
@@ -912,11 +915,11 @@
912915
return;
913916
}
914917
captcha_generate(0);
915918
@ </form>
916919
if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1);
917
- style_finish_page("tkt");
920
+ style_finish_page();
918921
}
919922
920923
/*
921924
** Check the ticket table schema in zSchema to see if it appears to
922925
** be well-formed. If everything is OK, return NULL. If something is
@@ -1035,22 +1038,23 @@
10351038
if( zType[0]=='c' ){
10361039
zTitle = mprintf("Check-ins Associated With Ticket %h", zUuid);
10371040
}else{
10381041
zTitle = mprintf("Timeline Of Ticket %h", zUuid);
10391042
}
1043
+ style_set_current_feature("tkt");
10401044
style_header("%z", zTitle);
10411045
10421046
sqlite3_snprintf(6, zGlobPattern, "%s", zUuid);
10431047
canonical16(zGlobPattern, strlen(zGlobPattern));
10441048
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
10451049
if( tagid==0 ){
10461050
@ No such ticket: %h(zUuid)
1047
- style_finish_page("tkt");
1051
+ style_finish_page();
10481052
return;
10491053
}
10501054
tkt_draw_timeline(tagid, zType);
1051
- style_finish_page("tkt");
1055
+ style_finish_page();
10521056
}
10531057
10541058
/*
10551059
** WEBPAGE: tkthistory
10561060
** URL: /tkthistory?name=TICKETUUID
@@ -1059,11 +1063,11 @@
10591063
** another way) show a list of artifacts associated with a single ticket.
10601064
**
10611065
** By default, the artifacts are decoded and formatted. Text fields
10621066
** are formatted as text/plain, since in the general case Fossil does
10631067
** not have knowledge of the encoding. If the "raw" query parameter
1064
-** is present, then the* undecoded and unformatted text of each artifact
1068
+** is present, then the undecoded and unformatted text of each artifact
10651069
** is displayed.
10661070
*/
10671071
void tkthistory_page(void){
10681072
Stmt q;
10691073
char *zTitle;
@@ -1084,16 +1088,17 @@
10841088
if( P("raw")!=0 ){
10851089
style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
10861090
}else if( g.perm.Admin ){
10871091
style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
10881092
}
1093
+ style_set_current_feature("tkt");
10891094
style_header("%z", zTitle);
10901095
10911096
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
10921097
if( tagid==0 ){
10931098
@ No such ticket: %h(zUuid)
1094
- style_finish_page("tkt");
1099
+ style_finish_page();
10951100
return;
10961101
}
10971102
if( P("raw")!=0 ){
10981103
@ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
10991104
}else{
@@ -1162,11 +1167,11 @@
11621167
}
11631168
db_finalize(&q);
11641169
if( nChng ){
11651170
@ </ol>
11661171
}
1167
- style_finish_page("tkt");
1172
+ style_finish_page();
11681173
}
11691174
11701175
/*
11711176
** Return TRUE if the given BLOB contains a newline character.
11721177
*/
@@ -1490,11 +1495,11 @@
14901495
/* read all given ticket field/value pairs from command line */
14911496
if( i==g.argc ){
14921497
fossil_fatal("empty %s command aborted!",g.argv[2]);
14931498
}
14941499
getAllTicketFields();
1495
- /* read commandline and assign fields in the aField[].zValue array */
1500
+ /* read command-line and assign fields in the aField[].zValue array */
14961501
while( i<g.argc ){
14971502
char *zFName;
14981503
char *zFValue;
14991504
int j;
15001505
int append = 0;
@@ -1611,10 +1616,11 @@
16111616
**
16121617
** Full-text search of all current tickets
16131618
*/
16141619
void tkt_srchpage(void){
16151620
login_check_credentials();
1621
+ style_set_current_feature("tkt");
16161622
style_header("Ticket Search");
16171623
ticket_standard_submenu(T_ALL_BUT(T_SRCH));
16181624
search_screen(SRCH_TKT, 0);
1619
- style_finish_page("tkt");
1625
+ style_finish_page();
16201626
}
16211627
--- src/tkt.c
+++ src/tkt.c
@@ -585,10 +585,11 @@
585 if( P("plaintext") ){
586 style_submenu_element("Formatted", "%R/tktview/%s", zUuid);
587 }else{
588 style_submenu_element("Plaintext", "%R/tktview/%s?plaintext", zUuid);
589 }
 
590 style_header("View Ticket");
591 if( showTimeline ){
592 int tagid = db_int(0,"SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
593 zUuid);
594 if( tagid ){
@@ -618,11 +619,11 @@
618 " WHERE tkt_uuid GLOB '%q*'", zUuid);
619 if( zFullName ){
620 attachment_list(zFullName, "<hr /><h2>Attachments:</h2><ul>");
621 }
622
623 style_finish_page("tkt");
624 }
625
626 /*
627 ** TH1 command: append_field FIELD STRING
628 **
@@ -815,10 +816,11 @@
815 login_check_credentials();
816 if( !g.perm.NewTkt ){ login_needed(g.anon.NewTkt); return; }
817 if( P("cancel") ){
818 cgi_redirect("home");
819 }
 
820 style_header("New Ticket");
821 ticket_standard_submenu(T_ALL_BUT(T_NEW));
822 if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
823 ticket_init();
824 initializeVariablesFromCGI();
@@ -841,11 +843,11 @@
841 return;
842 }
843 captcha_generate(0);
844 @ </form>
845 if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1);
846 style_finish_page("tkt");
847 }
848
849 /*
850 ** WEBPAGE: tktedit
851 ** WEBPAGE: debug_tktedit
@@ -870,28 +872,29 @@
870 }
871 zName = P("name");
872 if( P("cancel") ){
873 cgi_redirectf("tktview?name=%T", zName);
874 }
 
875 style_header("Edit Ticket");
876 if( zName==0 || (nName = strlen(zName))<4 || nName>HNAME_LEN_SHA1
877 || !validate16(zName,nName) ){
878 @ <span class="tktError">Not a valid ticket id: "%h(zName)"</span>
879 style_finish_page("tkt");
880 return;
881 }
882 nRec = db_int(0, "SELECT count(*) FROM ticket WHERE tkt_uuid GLOB '%q*'",
883 zName);
884 if( nRec==0 ){
885 @ <span class="tktError">No such ticket: "%h(zName)"</span>
886 style_finish_page("tkt");
887 return;
888 }
889 if( nRec>1 ){
890 @ <span class="tktError">%d(nRec) tickets begin with:
891 @ "%h(zName)"</span>
892 style_finish_page("tkt");
893 return;
894 }
895 if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1);
896 ticket_init();
897 getAllTicketFields();
@@ -912,11 +915,11 @@
912 return;
913 }
914 captcha_generate(0);
915 @ </form>
916 if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1);
917 style_finish_page("tkt");
918 }
919
920 /*
921 ** Check the ticket table schema in zSchema to see if it appears to
922 ** be well-formed. If everything is OK, return NULL. If something is
@@ -1035,22 +1038,23 @@
1035 if( zType[0]=='c' ){
1036 zTitle = mprintf("Check-ins Associated With Ticket %h", zUuid);
1037 }else{
1038 zTitle = mprintf("Timeline Of Ticket %h", zUuid);
1039 }
 
1040 style_header("%z", zTitle);
1041
1042 sqlite3_snprintf(6, zGlobPattern, "%s", zUuid);
1043 canonical16(zGlobPattern, strlen(zGlobPattern));
1044 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
1045 if( tagid==0 ){
1046 @ No such ticket: %h(zUuid)
1047 style_finish_page("tkt");
1048 return;
1049 }
1050 tkt_draw_timeline(tagid, zType);
1051 style_finish_page("tkt");
1052 }
1053
1054 /*
1055 ** WEBPAGE: tkthistory
1056 ** URL: /tkthistory?name=TICKETUUID
@@ -1059,11 +1063,11 @@
1059 ** another way) show a list of artifacts associated with a single ticket.
1060 **
1061 ** By default, the artifacts are decoded and formatted. Text fields
1062 ** are formatted as text/plain, since in the general case Fossil does
1063 ** not have knowledge of the encoding. If the "raw" query parameter
1064 ** is present, then the* undecoded and unformatted text of each artifact
1065 ** is displayed.
1066 */
1067 void tkthistory_page(void){
1068 Stmt q;
1069 char *zTitle;
@@ -1084,16 +1088,17 @@
1084 if( P("raw")!=0 ){
1085 style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
1086 }else if( g.perm.Admin ){
1087 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
1088 }
 
1089 style_header("%z", zTitle);
1090
1091 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
1092 if( tagid==0 ){
1093 @ No such ticket: %h(zUuid)
1094 style_finish_page("tkt");
1095 return;
1096 }
1097 if( P("raw")!=0 ){
1098 @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
1099 }else{
@@ -1162,11 +1167,11 @@
1162 }
1163 db_finalize(&q);
1164 if( nChng ){
1165 @ </ol>
1166 }
1167 style_finish_page("tkt");
1168 }
1169
1170 /*
1171 ** Return TRUE if the given BLOB contains a newline character.
1172 */
@@ -1490,11 +1495,11 @@
1490 /* read all given ticket field/value pairs from command line */
1491 if( i==g.argc ){
1492 fossil_fatal("empty %s command aborted!",g.argv[2]);
1493 }
1494 getAllTicketFields();
1495 /* read commandline and assign fields in the aField[].zValue array */
1496 while( i<g.argc ){
1497 char *zFName;
1498 char *zFValue;
1499 int j;
1500 int append = 0;
@@ -1611,10 +1616,11 @@
1611 **
1612 ** Full-text search of all current tickets
1613 */
1614 void tkt_srchpage(void){
1615 login_check_credentials();
 
1616 style_header("Ticket Search");
1617 ticket_standard_submenu(T_ALL_BUT(T_SRCH));
1618 search_screen(SRCH_TKT, 0);
1619 style_finish_page("tkt");
1620 }
1621
--- src/tkt.c
+++ src/tkt.c
@@ -585,10 +585,11 @@
585 if( P("plaintext") ){
586 style_submenu_element("Formatted", "%R/tktview/%s", zUuid);
587 }else{
588 style_submenu_element("Plaintext", "%R/tktview/%s?plaintext", zUuid);
589 }
590 style_set_current_feature("tkt");
591 style_header("View Ticket");
592 if( showTimeline ){
593 int tagid = db_int(0,"SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
594 zUuid);
595 if( tagid ){
@@ -618,11 +619,11 @@
619 " WHERE tkt_uuid GLOB '%q*'", zUuid);
620 if( zFullName ){
621 attachment_list(zFullName, "<hr /><h2>Attachments:</h2><ul>");
622 }
623
624 style_finish_page();
625 }
626
627 /*
628 ** TH1 command: append_field FIELD STRING
629 **
@@ -815,10 +816,11 @@
816 login_check_credentials();
817 if( !g.perm.NewTkt ){ login_needed(g.anon.NewTkt); return; }
818 if( P("cancel") ){
819 cgi_redirect("home");
820 }
821 style_set_current_feature("tkt");
822 style_header("New Ticket");
823 ticket_standard_submenu(T_ALL_BUT(T_NEW));
824 if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
825 ticket_init();
826 initializeVariablesFromCGI();
@@ -841,11 +843,11 @@
843 return;
844 }
845 captcha_generate(0);
846 @ </form>
847 if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1);
848 style_finish_page();
849 }
850
851 /*
852 ** WEBPAGE: tktedit
853 ** WEBPAGE: debug_tktedit
@@ -870,28 +872,29 @@
872 }
873 zName = P("name");
874 if( P("cancel") ){
875 cgi_redirectf("tktview?name=%T", zName);
876 }
877 style_set_current_feature("tkt");
878 style_header("Edit Ticket");
879 if( zName==0 || (nName = strlen(zName))<4 || nName>HNAME_LEN_SHA1
880 || !validate16(zName,nName) ){
881 @ <span class="tktError">Not a valid ticket id: "%h(zName)"</span>
882 style_finish_page();
883 return;
884 }
885 nRec = db_int(0, "SELECT count(*) FROM ticket WHERE tkt_uuid GLOB '%q*'",
886 zName);
887 if( nRec==0 ){
888 @ <span class="tktError">No such ticket: "%h(zName)"</span>
889 style_finish_page();
890 return;
891 }
892 if( nRec>1 ){
893 @ <span class="tktError">%d(nRec) tickets begin with:
894 @ "%h(zName)"</span>
895 style_finish_page();
896 return;
897 }
898 if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1);
899 ticket_init();
900 getAllTicketFields();
@@ -912,11 +915,11 @@
915 return;
916 }
917 captcha_generate(0);
918 @ </form>
919 if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1);
920 style_finish_page();
921 }
922
923 /*
924 ** Check the ticket table schema in zSchema to see if it appears to
925 ** be well-formed. If everything is OK, return NULL. If something is
@@ -1035,22 +1038,23 @@
1038 if( zType[0]=='c' ){
1039 zTitle = mprintf("Check-ins Associated With Ticket %h", zUuid);
1040 }else{
1041 zTitle = mprintf("Timeline Of Ticket %h", zUuid);
1042 }
1043 style_set_current_feature("tkt");
1044 style_header("%z", zTitle);
1045
1046 sqlite3_snprintf(6, zGlobPattern, "%s", zUuid);
1047 canonical16(zGlobPattern, strlen(zGlobPattern));
1048 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
1049 if( tagid==0 ){
1050 @ No such ticket: %h(zUuid)
1051 style_finish_page();
1052 return;
1053 }
1054 tkt_draw_timeline(tagid, zType);
1055 style_finish_page();
1056 }
1057
1058 /*
1059 ** WEBPAGE: tkthistory
1060 ** URL: /tkthistory?name=TICKETUUID
@@ -1059,11 +1063,11 @@
1063 ** another way) show a list of artifacts associated with a single ticket.
1064 **
1065 ** By default, the artifacts are decoded and formatted. Text fields
1066 ** are formatted as text/plain, since in the general case Fossil does
1067 ** not have knowledge of the encoding. If the "raw" query parameter
1068 ** is present, then the undecoded and unformatted text of each artifact
1069 ** is displayed.
1070 */
1071 void tkthistory_page(void){
1072 Stmt q;
1073 char *zTitle;
@@ -1084,16 +1088,17 @@
1088 if( P("raw")!=0 ){
1089 style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
1090 }else if( g.perm.Admin ){
1091 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
1092 }
1093 style_set_current_feature("tkt");
1094 style_header("%z", zTitle);
1095
1096 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
1097 if( tagid==0 ){
1098 @ No such ticket: %h(zUuid)
1099 style_finish_page();
1100 return;
1101 }
1102 if( P("raw")!=0 ){
1103 @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
1104 }else{
@@ -1162,11 +1167,11 @@
1167 }
1168 db_finalize(&q);
1169 if( nChng ){
1170 @ </ol>
1171 }
1172 style_finish_page();
1173 }
1174
1175 /*
1176 ** Return TRUE if the given BLOB contains a newline character.
1177 */
@@ -1490,11 +1495,11 @@
1495 /* read all given ticket field/value pairs from command line */
1496 if( i==g.argc ){
1497 fossil_fatal("empty %s command aborted!",g.argv[2]);
1498 }
1499 getAllTicketFields();
1500 /* read command-line and assign fields in the aField[].zValue array */
1501 while( i<g.argc ){
1502 char *zFName;
1503 char *zFValue;
1504 int j;
1505 int append = 0;
@@ -1611,10 +1616,11 @@
1616 **
1617 ** Full-text search of all current tickets
1618 */
1619 void tkt_srchpage(void){
1620 login_check_credentials();
1621 style_set_current_feature("tkt");
1622 style_header("Ticket Search");
1623 ticket_standard_submenu(T_ALL_BUT(T_SRCH));
1624 search_screen(SRCH_TKT, 0);
1625 style_finish_page();
1626 }
1627
+6 -3
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -54,11 +54,11 @@
5454
setup_menu_entry("Report Template", "tktsetup_rpttplt",
5555
"The default ticket report format.");
5656
setup_menu_entry("Key Template", "tktsetup_keytplt",
5757
"The default color key for reports.");
5858
@ </table>
59
- style_finish_page("tktsetup");
59
+ style_finish_page();
6060
}
6161
6262
/*
6363
** NOTE: When changing the table definition below, also change the
6464
** equivalent definition found in schema.c.
@@ -123,18 +123,20 @@
123123
login_check_credentials();
124124
if( !g.perm.Setup ){
125125
login_needed(0);
126126
return;
127127
}
128
+ style_set_current_feature("tktsetup");
128129
if( PB("setup") ){
129130
cgi_redirect("tktsetup");
130131
}
131132
isSubmit = P("submit")!=0;
132133
z = P("x");
133134
if( z==0 ){
134135
z = db_get(zDbField, zDfltValue);
135136
}
137
+ style_set_current_feature("tktsetup");
136138
style_header("Edit %s", zTitle);
137139
if( P("clear")!=0 ){
138140
login_verify_csrf_secret();
139141
db_unset(zDbField, 0);
140142
if( xRebuild ) xRebuild();
@@ -163,11 +165,11 @@
163165
@ <hr />
164166
@ <h2>Default %s(zTitle)</h2>
165167
@ <blockquote><pre>
166168
@ %h(zDfltValue)
167169
@ </pre></blockquote>
168
- style_finish_page("tktsetup");
170
+ style_finish_page();
169171
}
170172
171173
/*
172174
** WEBPAGE: tktsetup_tab
173175
** Administrative page for defining the "ticket" table used
@@ -901,10 +903,11 @@
901903
}
902904
903905
if( P("setup") ){
904906
cgi_redirect("tktsetup");
905907
}
908
+ style_set_current_feature("tktsetup");
906909
style_header("Ticket Display On Timelines");
907910
db_begin_transaction();
908911
@ <form action="%R/tktsetup_timeline" method="post"><div>
909912
login_insert_csrf_secret();
910913
@@ -934,8 +937,8 @@
934937
@ <input type="submit" name="submit" value="Apply Changes" />
935938
@ <input type="submit" name="setup" value="Cancel" />
936939
@ </p>
937940
@ </div></form>
938941
db_end_transaction(0);
939
- style_finish_page("tktsetup");
942
+ style_finish_page();
940943
941944
}
942945
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -54,11 +54,11 @@
54 setup_menu_entry("Report Template", "tktsetup_rpttplt",
55 "The default ticket report format.");
56 setup_menu_entry("Key Template", "tktsetup_keytplt",
57 "The default color key for reports.");
58 @ </table>
59 style_finish_page("tktsetup");
60 }
61
62 /*
63 ** NOTE: When changing the table definition below, also change the
64 ** equivalent definition found in schema.c.
@@ -123,18 +123,20 @@
123 login_check_credentials();
124 if( !g.perm.Setup ){
125 login_needed(0);
126 return;
127 }
 
128 if( PB("setup") ){
129 cgi_redirect("tktsetup");
130 }
131 isSubmit = P("submit")!=0;
132 z = P("x");
133 if( z==0 ){
134 z = db_get(zDbField, zDfltValue);
135 }
 
136 style_header("Edit %s", zTitle);
137 if( P("clear")!=0 ){
138 login_verify_csrf_secret();
139 db_unset(zDbField, 0);
140 if( xRebuild ) xRebuild();
@@ -163,11 +165,11 @@
163 @ <hr />
164 @ <h2>Default %s(zTitle)</h2>
165 @ <blockquote><pre>
166 @ %h(zDfltValue)
167 @ </pre></blockquote>
168 style_finish_page("tktsetup");
169 }
170
171 /*
172 ** WEBPAGE: tktsetup_tab
173 ** Administrative page for defining the "ticket" table used
@@ -901,10 +903,11 @@
901 }
902
903 if( P("setup") ){
904 cgi_redirect("tktsetup");
905 }
 
906 style_header("Ticket Display On Timelines");
907 db_begin_transaction();
908 @ <form action="%R/tktsetup_timeline" method="post"><div>
909 login_insert_csrf_secret();
910
@@ -934,8 +937,8 @@
934 @ <input type="submit" name="submit" value="Apply Changes" />
935 @ <input type="submit" name="setup" value="Cancel" />
936 @ </p>
937 @ </div></form>
938 db_end_transaction(0);
939 style_finish_page("tktsetup");
940
941 }
942
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -54,11 +54,11 @@
54 setup_menu_entry("Report Template", "tktsetup_rpttplt",
55 "The default ticket report format.");
56 setup_menu_entry("Key Template", "tktsetup_keytplt",
57 "The default color key for reports.");
58 @ </table>
59 style_finish_page();
60 }
61
62 /*
63 ** NOTE: When changing the table definition below, also change the
64 ** equivalent definition found in schema.c.
@@ -123,18 +123,20 @@
123 login_check_credentials();
124 if( !g.perm.Setup ){
125 login_needed(0);
126 return;
127 }
128 style_set_current_feature("tktsetup");
129 if( PB("setup") ){
130 cgi_redirect("tktsetup");
131 }
132 isSubmit = P("submit")!=0;
133 z = P("x");
134 if( z==0 ){
135 z = db_get(zDbField, zDfltValue);
136 }
137 style_set_current_feature("tktsetup");
138 style_header("Edit %s", zTitle);
139 if( P("clear")!=0 ){
140 login_verify_csrf_secret();
141 db_unset(zDbField, 0);
142 if( xRebuild ) xRebuild();
@@ -163,11 +165,11 @@
165 @ <hr />
166 @ <h2>Default %s(zTitle)</h2>
167 @ <blockquote><pre>
168 @ %h(zDfltValue)
169 @ </pre></blockquote>
170 style_finish_page();
171 }
172
173 /*
174 ** WEBPAGE: tktsetup_tab
175 ** Administrative page for defining the "ticket" table used
@@ -901,10 +903,11 @@
903 }
904
905 if( P("setup") ){
906 cgi_redirect("tktsetup");
907 }
908 style_set_current_feature("tktsetup");
909 style_header("Ticket Display On Timelines");
910 db_begin_transaction();
911 @ <form action="%R/tktsetup_timeline" method="post"><div>
912 login_insert_csrf_secret();
913
@@ -934,8 +937,8 @@
937 @ <input type="submit" name="submit" value="Apply Changes" />
938 @ <input type="submit" name="setup" value="Cancel" />
939 @ </p>
940 @ </div></form>
941 db_end_transaction(0);
942 style_finish_page();
943
944 }
945
--- src/unversioned.c
+++ src/unversioned.c
@@ -546,11 +546,11 @@
546546
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
547547
etag_check(ETAG_DATA,0);
548548
style_header("Unversioned Files");
549549
if( !db_table_exists("repository","unversioned") ){
550550
@ No unversioned files on this server
551
- style_finish_page("uvlist");
551
+ style_finish_page();
552552
return;
553553
}
554554
if( PB("byage") ) zOrderBy = "mtime DESC";
555555
if( PB("showdel") ) showDel = 1;
556556
db_prepare(&q,
@@ -622,21 +622,21 @@
622622
}
623623
db_finalize(&q);
624624
if( n ){
625625
approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
626626
@ </tbody>
627
- @ <tfoot><tr><td><b>Total over %d(cnt) files</b><td><td>%s(zSzName)
627
+ @ <tfoot><tr><td><b>Total for %d(cnt) files</b><td><td>%s(zSzName)
628628
@ <td><td>
629629
if( g.perm.Admin ){
630630
@ <td>
631631
}
632632
@ </tfoot>
633633
@ </table></div>
634634
}else{
635635
@ No unversioned files on this server.
636636
}
637
- style_finish_page("uvlist");
637
+ style_finish_page();
638638
}
639639
640640
/*
641641
** WEBPAGE: juvlist
642642
**
643643
--- src/unversioned.c
+++ src/unversioned.c
@@ -546,11 +546,11 @@
546 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
547 etag_check(ETAG_DATA,0);
548 style_header("Unversioned Files");
549 if( !db_table_exists("repository","unversioned") ){
550 @ No unversioned files on this server
551 style_finish_page("uvlist");
552 return;
553 }
554 if( PB("byage") ) zOrderBy = "mtime DESC";
555 if( PB("showdel") ) showDel = 1;
556 db_prepare(&q,
@@ -622,21 +622,21 @@
622 }
623 db_finalize(&q);
624 if( n ){
625 approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
626 @ </tbody>
627 @ <tfoot><tr><td><b>Total over %d(cnt) files</b><td><td>%s(zSzName)
628 @ <td><td>
629 if( g.perm.Admin ){
630 @ <td>
631 }
632 @ </tfoot>
633 @ </table></div>
634 }else{
635 @ No unversioned files on this server.
636 }
637 style_finish_page("uvlist");
638 }
639
640 /*
641 ** WEBPAGE: juvlist
642 **
643
--- src/unversioned.c
+++ src/unversioned.c
@@ -546,11 +546,11 @@
546 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
547 etag_check(ETAG_DATA,0);
548 style_header("Unversioned Files");
549 if( !db_table_exists("repository","unversioned") ){
550 @ No unversioned files on this server
551 style_finish_page();
552 return;
553 }
554 if( PB("byage") ) zOrderBy = "mtime DESC";
555 if( PB("showdel") ) showDel = 1;
556 db_prepare(&q,
@@ -622,21 +622,21 @@
622 }
623 db_finalize(&q);
624 if( n ){
625 approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
626 @ </tbody>
627 @ <tfoot><tr><td><b>Total for %d(cnt) files</b><td><td>%s(zSzName)
628 @ <td><td>
629 if( g.perm.Admin ){
630 @ <td>
631 }
632 @ </tfoot>
633 @ </table></div>
634 }else{
635 @ No unversioned files on this server.
636 }
637 style_finish_page();
638 }
639
640 /*
641 ** WEBPAGE: juvlist
642 **
643
+1 -1
--- src/update.c
+++ src/update.c
@@ -221,11 +221,11 @@
221221
"%s "
222222
" AND event.objid IN leaves"
223223
" ORDER BY event.mtime DESC",
224224
timeline_query_for_tty()
225225
);
226
- print_timeline(&q, -100, width, 0);
226
+ print_timeline(&q, -100, width, 0, 0);
227227
db_finalize(&q);
228228
fossil_fatal("Multiple descendants");
229229
}
230230
}
231231
tid = db_int(0, "SELECT rid FROM leaves, event"
232232
--- src/update.c
+++ src/update.c
@@ -221,11 +221,11 @@
221 "%s "
222 " AND event.objid IN leaves"
223 " ORDER BY event.mtime DESC",
224 timeline_query_for_tty()
225 );
226 print_timeline(&q, -100, width, 0);
227 db_finalize(&q);
228 fossil_fatal("Multiple descendants");
229 }
230 }
231 tid = db_int(0, "SELECT rid FROM leaves, event"
232
--- src/update.c
+++ src/update.c
@@ -221,11 +221,11 @@
221 "%s "
222 " AND event.objid IN leaves"
223 " ORDER BY event.mtime DESC",
224 timeline_query_for_tty()
225 );
226 print_timeline(&q, -100, width, 0, 0);
227 db_finalize(&q);
228 fossil_fatal("Multiple descendants");
229 }
230 }
231 tid = db_int(0, "SELECT rid FROM leaves, event"
232
+2 -2
--- src/user.c
+++ src/user.c
@@ -38,11 +38,11 @@
3838
if( z[i]>0 && z[i]<' ' ) z[i] = ' ';
3939
}
4040
blob_append(pBlob, z, -1);
4141
}
4242
43
-#if defined(_WIN32) || defined(__BIONIC__)
43
+#if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
4444
#ifdef _WIN32
4545
#include <conio.h>
4646
#endif
4747
4848
/*
@@ -772,7 +772,7 @@
772772
@ <label><input type="checkbox" name="delall">
773773
@ Delete all entries</input></label>
774774
@ <input type="submit" name="delallbtn" value="Delete"></input>
775775
@ </form>
776776
style_table_sorter();
777
- style_finish_page("access_log");
777
+ style_finish_page();
778778
}
779779
--- src/user.c
+++ src/user.c
@@ -38,11 +38,11 @@
38 if( z[i]>0 && z[i]<' ' ) z[i] = ' ';
39 }
40 blob_append(pBlob, z, -1);
41 }
42
43 #if defined(_WIN32) || defined(__BIONIC__)
44 #ifdef _WIN32
45 #include <conio.h>
46 #endif
47
48 /*
@@ -772,7 +772,7 @@
772 @ <label><input type="checkbox" name="delall">
773 @ Delete all entries</input></label>
774 @ <input type="submit" name="delallbtn" value="Delete"></input>
775 @ </form>
776 style_table_sorter();
777 style_finish_page("access_log");
778 }
779
--- src/user.c
+++ src/user.c
@@ -38,11 +38,11 @@
38 if( z[i]>0 && z[i]<' ' ) z[i] = ' ';
39 }
40 blob_append(pBlob, z, -1);
41 }
42
43 #if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
44 #ifdef _WIN32
45 #include <conio.h>
46 #endif
47
48 /*
@@ -772,7 +772,7 @@
772 @ <label><input type="checkbox" name="delall">
773 @ Delete all entries</input></label>
774 @ <input type="submit" name="delallbtn" value="Delete"></input>
775 @ </form>
776 style_table_sorter();
777 style_finish_page();
778 }
779
+101 -8
--- src/util.c
+++ src/util.c
@@ -21,10 +21,11 @@
2121
#include "util.h"
2222
#if defined(USE_MMAN_H)
2323
# include <sys/mman.h>
2424
# include <unistd.h>
2525
#endif
26
+#include <math.h>
2627
2728
/*
2829
** For the fossil_timer_xxx() family of functions...
2930
*/
3031
#ifdef _WIN32
@@ -424,10 +425,24 @@
424425
*piKernel =
425426
((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec;
426427
}
427428
#endif
428429
}
430
+
431
+/*
432
+** Return the resident set size for this process
433
+*/
434
+sqlite3_uint64 fossil_rss(void){
435
+#ifdef _WIN32
436
+ return 0;
437
+#else
438
+ struct rusage s;
439
+ getrusage(RUSAGE_SELF, &s);
440
+ return s.ru_maxrss*1024;
441
+#endif
442
+}
443
+
429444
430445
/*
431446
** Internal helper type for fossil_timer_xxx().
432447
*/
433448
enum FossilTimerEnum {
@@ -697,12 +712,12 @@
697712
/* 0 1 2 3 4 5 */
698713
/* 123456789 123456789 123456789 123456789 123456789 123456 */
699714
"23456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
700715
701716
if( N<8 ) N = 8;
702
- else if( N>sizeof(zAlphabet)-2 ) N = sizeof(zAlphabet)-2;
703717
nSrc = sizeof(zAlphabet) - 1;
718
+ if( N>nSrc ) N = nSrc;
704719
memcpy(zSrc, zAlphabet, nSrc);
705720
706721
for(i=0; i<N; i++){
707722
unsigned r;
708723
sqlite3_randomness(sizeof(r), &r);
@@ -715,22 +730,47 @@
715730
}
716731
717732
/*
718733
** COMMAND: test-random-password
719734
**
720
-** Usage: %fossil test-random-password ?N?
735
+** Usage: %fossil test-random-password [N] [--entropy]
721736
**
722737
** Generate a random password string of approximately N characters in length.
723
-** If N is omitted, use 10. Values of N less than 8 are changed to 8
724
-** and greater than 55 and changed to 55.
738
+** If N is omitted, use 12. Values of N less than 8 are changed to 8
739
+** and greater than 57 and changed to 57.
740
+**
741
+** If the --entropy flag is included, the number of bits of entropy in
742
+** the password is show as well.
725743
*/
726744
void test_random_password(void){
727
- int N = 10;
728
- if( g.argc>=3 ){
729
- N = atoi(g.argv[2]);
745
+ int N = 12;
746
+ int showEntropy = 0;
747
+ int i;
748
+ char *zPassword;
749
+ for(i=2; i<g.argc; i++){
750
+ const char *z = g.argv[i];
751
+ if( z[0]=='-' && z[1]=='-' ) z++;
752
+ if( strcmp(z,"-entropy")==0 ){
753
+ showEntropy = 1;
754
+ }else if( fossil_isdigit(z[0]) ){
755
+ N = atoi(z);
756
+ if( N<8 ) N = 8;
757
+ if( N>57 ) N = 57;
758
+ }else{
759
+ usage("[N] [--entropy]");
760
+ }
761
+ }
762
+ zPassword = fossil_random_password(N);
763
+ if( showEntropy ){
764
+ double et = 57.0;
765
+ for(i=1; i<N; i++) et *= 57-i;
766
+ fossil_print("%s (%d bits of entropy)\n", zPassword,
767
+ (int)(log(et)/log(2.0)));
768
+ }else{
769
+ fossil_print("%s\n", zPassword);
730770
}
731
- fossil_print("%s\n", fossil_random_password(N));
771
+ fossil_free(zPassword);
732772
}
733773
734774
/*
735775
** Return the number of decimal digits in a nonnegative integer. This is useful
736776
** when formatting text.
@@ -738,5 +778,58 @@
738778
int fossil_num_digits(int n){
739779
return n< 10 ? 1 : n< 100 ? 2 : n< 1000 ? 3
740780
: n< 10000 ? 4 : n< 100000 ? 5 : n< 1000000 ? 6
741781
: n<10000000 ? 7 : n<100000000 ? 8 : n<1000000000 ? 9 : 10;
742782
}
783
+
784
+#if !defined(_WIN32)
785
+#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
786
+/*
787
+** Search for an executable on the PATH environment variable.
788
+** Return true (1) if found and false (0) if not found.
789
+*/
790
+static int binaryOnPath(const char *zBinary){
791
+ const char *zPath = fossil_getenv("PATH");
792
+ char *zFull;
793
+ int i;
794
+ int bExists;
795
+ while( zPath && zPath[0] ){
796
+ while( zPath[0]==':' ) zPath++;
797
+ for(i=0; zPath[i] && zPath[i]!=':'; i++){}
798
+ zFull = mprintf("%.*s/%s", i, zPath, zBinary);
799
+ bExists = file_access(zFull, X_OK);
800
+ fossil_free(zFull);
801
+ if( bExists==0 ) return 1;
802
+ zPath += i;
803
+ }
804
+ return 0;
805
+}
806
+#endif
807
+#endif
808
+
809
+
810
+/*
811
+** Return the name of a command that will launch a web-browser.
812
+*/
813
+const char *fossil_web_browser(void){
814
+ const char *zBrowser = 0;
815
+#if defined(_WIN32)
816
+ zBrowser = db_get("web-browser", "start");
817
+#elif defined(__DARWIN__) || defined(__APPLE__) || defined(__HAIKU__)
818
+ zBrowser = db_get("web-browser", "open");
819
+#else
820
+ zBrowser = db_get("web-browser", 0);
821
+ if( zBrowser==0 ){
822
+ static const char *const azBrowserProg[] =
823
+ { "xdg-open", "gnome-open", "firefox", "google-chrome" };
824
+ int i;
825
+ zBrowser = "echo";
826
+ for(i=0; i<count(azBrowserProg); i++){
827
+ if( binaryOnPath(azBrowserProg[i]) ){
828
+ zBrowser = azBrowserProg[i];
829
+ break;
830
+ }
831
+ }
832
+ }
833
+#endif
834
+ return zBrowser;
835
+}
743836
--- src/util.c
+++ src/util.c
@@ -21,10 +21,11 @@
21 #include "util.h"
22 #if defined(USE_MMAN_H)
23 # include <sys/mman.h>
24 # include <unistd.h>
25 #endif
 
26
27 /*
28 ** For the fossil_timer_xxx() family of functions...
29 */
30 #ifdef _WIN32
@@ -424,10 +425,24 @@
424 *piKernel =
425 ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec;
426 }
427 #endif
428 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
430 /*
431 ** Internal helper type for fossil_timer_xxx().
432 */
433 enum FossilTimerEnum {
@@ -697,12 +712,12 @@
697 /* 0 1 2 3 4 5 */
698 /* 123456789 123456789 123456789 123456789 123456789 123456 */
699 "23456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
700
701 if( N<8 ) N = 8;
702 else if( N>sizeof(zAlphabet)-2 ) N = sizeof(zAlphabet)-2;
703 nSrc = sizeof(zAlphabet) - 1;
 
704 memcpy(zSrc, zAlphabet, nSrc);
705
706 for(i=0; i<N; i++){
707 unsigned r;
708 sqlite3_randomness(sizeof(r), &r);
@@ -715,22 +730,47 @@
715 }
716
717 /*
718 ** COMMAND: test-random-password
719 **
720 ** Usage: %fossil test-random-password ?N?
721 **
722 ** Generate a random password string of approximately N characters in length.
723 ** If N is omitted, use 10. Values of N less than 8 are changed to 8
724 ** and greater than 55 and changed to 55.
 
 
 
725 */
726 void test_random_password(void){
727 int N = 10;
728 if( g.argc>=3 ){
729 N = atoi(g.argv[2]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
730 }
731 fossil_print("%s\n", fossil_random_password(N));
732 }
733
734 /*
735 ** Return the number of decimal digits in a nonnegative integer. This is useful
736 ** when formatting text.
@@ -738,5 +778,58 @@
738 int fossil_num_digits(int n){
739 return n< 10 ? 1 : n< 100 ? 2 : n< 1000 ? 3
740 : n< 10000 ? 4 : n< 100000 ? 5 : n< 1000000 ? 6
741 : n<10000000 ? 7 : n<100000000 ? 8 : n<1000000000 ? 9 : 10;
742 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
--- src/util.c
+++ src/util.c
@@ -21,10 +21,11 @@
21 #include "util.h"
22 #if defined(USE_MMAN_H)
23 # include <sys/mman.h>
24 # include <unistd.h>
25 #endif
26 #include <math.h>
27
28 /*
29 ** For the fossil_timer_xxx() family of functions...
30 */
31 #ifdef _WIN32
@@ -424,10 +425,24 @@
425 *piKernel =
426 ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec;
427 }
428 #endif
429 }
430
431 /*
432 ** Return the resident set size for this process
433 */
434 sqlite3_uint64 fossil_rss(void){
435 #ifdef _WIN32
436 return 0;
437 #else
438 struct rusage s;
439 getrusage(RUSAGE_SELF, &s);
440 return s.ru_maxrss*1024;
441 #endif
442 }
443
444
445 /*
446 ** Internal helper type for fossil_timer_xxx().
447 */
448 enum FossilTimerEnum {
@@ -697,12 +712,12 @@
712 /* 0 1 2 3 4 5 */
713 /* 123456789 123456789 123456789 123456789 123456789 123456 */
714 "23456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
715
716 if( N<8 ) N = 8;
 
717 nSrc = sizeof(zAlphabet) - 1;
718 if( N>nSrc ) N = nSrc;
719 memcpy(zSrc, zAlphabet, nSrc);
720
721 for(i=0; i<N; i++){
722 unsigned r;
723 sqlite3_randomness(sizeof(r), &r);
@@ -715,22 +730,47 @@
730 }
731
732 /*
733 ** COMMAND: test-random-password
734 **
735 ** Usage: %fossil test-random-password [N] [--entropy]
736 **
737 ** Generate a random password string of approximately N characters in length.
738 ** If N is omitted, use 12. Values of N less than 8 are changed to 8
739 ** and greater than 57 and changed to 57.
740 **
741 ** If the --entropy flag is included, the number of bits of entropy in
742 ** the password is show as well.
743 */
744 void test_random_password(void){
745 int N = 12;
746 int showEntropy = 0;
747 int i;
748 char *zPassword;
749 for(i=2; i<g.argc; i++){
750 const char *z = g.argv[i];
751 if( z[0]=='-' && z[1]=='-' ) z++;
752 if( strcmp(z,"-entropy")==0 ){
753 showEntropy = 1;
754 }else if( fossil_isdigit(z[0]) ){
755 N = atoi(z);
756 if( N<8 ) N = 8;
757 if( N>57 ) N = 57;
758 }else{
759 usage("[N] [--entropy]");
760 }
761 }
762 zPassword = fossil_random_password(N);
763 if( showEntropy ){
764 double et = 57.0;
765 for(i=1; i<N; i++) et *= 57-i;
766 fossil_print("%s (%d bits of entropy)\n", zPassword,
767 (int)(log(et)/log(2.0)));
768 }else{
769 fossil_print("%s\n", zPassword);
770 }
771 fossil_free(zPassword);
772 }
773
774 /*
775 ** Return the number of decimal digits in a nonnegative integer. This is useful
776 ** when formatting text.
@@ -738,5 +778,58 @@
778 int fossil_num_digits(int n){
779 return n< 10 ? 1 : n< 100 ? 2 : n< 1000 ? 3
780 : n< 10000 ? 4 : n< 100000 ? 5 : n< 1000000 ? 6
781 : n<10000000 ? 7 : n<100000000 ? 8 : n<1000000000 ? 9 : 10;
782 }
783
784 #if !defined(_WIN32)
785 #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
786 /*
787 ** Search for an executable on the PATH environment variable.
788 ** Return true (1) if found and false (0) if not found.
789 */
790 static int binaryOnPath(const char *zBinary){
791 const char *zPath = fossil_getenv("PATH");
792 char *zFull;
793 int i;
794 int bExists;
795 while( zPath && zPath[0] ){
796 while( zPath[0]==':' ) zPath++;
797 for(i=0; zPath[i] && zPath[i]!=':'; i++){}
798 zFull = mprintf("%.*s/%s", i, zPath, zBinary);
799 bExists = file_access(zFull, X_OK);
800 fossil_free(zFull);
801 if( bExists==0 ) return 1;
802 zPath += i;
803 }
804 return 0;
805 }
806 #endif
807 #endif
808
809
810 /*
811 ** Return the name of a command that will launch a web-browser.
812 */
813 const char *fossil_web_browser(void){
814 const char *zBrowser = 0;
815 #if defined(_WIN32)
816 zBrowser = db_get("web-browser", "start");
817 #elif defined(__DARWIN__) || defined(__APPLE__) || defined(__HAIKU__)
818 zBrowser = db_get("web-browser", "open");
819 #else
820 zBrowser = db_get("web-browser", 0);
821 if( zBrowser==0 ){
822 static const char *const azBrowserProg[] =
823 { "xdg-open", "gnome-open", "firefox", "google-chrome" };
824 int i;
825 zBrowser = "echo";
826 for(i=0; i<count(azBrowserProg); i++){
827 if( binaryOnPath(azBrowserProg[i]) ){
828 zBrowser = azBrowserProg[i];
829 break;
830 }
831 }
832 }
833 #endif
834 return zBrowser;
835 }
836
+9 -5
--- src/webmail.c
+++ src/webmail.c
@@ -407,10 +407,11 @@
407407
emailid
408408
);
409409
if( zUser ) blob_append_sql(&sql, " AND euser=%Q", zUser);
410410
db_prepare_blob(&q, &sql);
411411
blob_reset(&sql);
412
+ style_set_current_feature("webmail");
412413
style_header("Message %d",emailid);
413414
if( db_step(&q)==SQLITE_ROW ){
414415
Blob msg = db_column_text_as_blob(&q, 0);
415416
int eFormat = atoi(PD("f","0"));
416417
eState = db_column_int(&q, 1);
@@ -513,11 +514,11 @@
513514
style_submenu_element("Delete", "%s",
514515
url_render(pUrl,"trash","1",zENum,"1"));
515516
}
516517
517518
db_end_transaction(0);
518
- style_finish_page("webmail");
519
+ style_finish_page();
519520
return;
520521
}
521522
522523
/*
523524
** Scan the query parameters looking for parameters with name of the
@@ -610,14 +611,15 @@
610611
login_check_credentials();
611612
if( !login_is_individual() ){
612613
login_needed(0);
613614
return;
614615
}
616
+ style_set_current_feature("webmail");
615617
if( !db_table_exists("repository","emailbox") ){
616618
style_header("Webmail Not Available");
617619
@ <p>This repository is not configured to provide webmail</p>
618
- style_finish_page("webmail");
620
+ style_finish_page();
619621
return;
620622
}
621623
add_content_sql_commands(g.db);
622624
emailid = atoi(PD("id","0"));
623625
url_initialize(&url, "webmail");
@@ -757,11 +759,11 @@
757759
@ for(i=0; i<x.length; i++){
758760
@ x[i].checked = true;
759761
@ }
760762
@ }
761763
@ </script>
762
- style_finish_page("webmail");
764
+ style_finish_page();
763765
db_end_transaction(0);
764766
}
765767
766768
/*
767769
** WEBPAGE: emailblob
@@ -780,10 +782,11 @@
780782
if( !g.perm.Setup ){
781783
login_needed(0);
782784
return;
783785
}
784786
add_content_sql_commands(g.db);
787
+ style_set_current_feature("webmail");
785788
style_header("emailblob table");
786789
if( id>0 ){
787790
style_submenu_element("Index", "%R/emailblob");
788791
@ <ul>
789792
db_prepare(&q, "SELECT emailid FROM emailblob WHERE ets=%d", id);
@@ -854,11 +857,11 @@
854857
}
855858
@ </tbody></table>
856859
db_finalize(&q);
857860
style_table_sorter();
858861
}
859
- style_finish_page("webmail");
862
+ style_finish_page();
860863
}
861864
862865
/*
863866
** WEBPAGE: emailoutq
864867
**
@@ -872,10 +875,11 @@
872875
if( !g.perm.Setup ){
873876
login_needed(0);
874877
return;
875878
}
876879
add_content_sql_commands(g.db);
880
+ style_set_current_feature("webmail");
877881
style_header("emailoutq table");
878882
style_submenu_element("emailblob table","%R/emailblob");
879883
db_prepare(&q,
880884
"SELECT edomain, efrom, eto, emsgid, "
881885
" datetime(ectime,'unixepoch'),"
@@ -911,7 +915,7 @@
911915
}
912916
}
913917
@ </tbody></table>
914918
db_finalize(&q);
915919
style_table_sorter();
916
- style_finish_page("webmail");
920
+ style_finish_page();
917921
}
918922
--- src/webmail.c
+++ src/webmail.c
@@ -407,10 +407,11 @@
407 emailid
408 );
409 if( zUser ) blob_append_sql(&sql, " AND euser=%Q", zUser);
410 db_prepare_blob(&q, &sql);
411 blob_reset(&sql);
 
412 style_header("Message %d",emailid);
413 if( db_step(&q)==SQLITE_ROW ){
414 Blob msg = db_column_text_as_blob(&q, 0);
415 int eFormat = atoi(PD("f","0"));
416 eState = db_column_int(&q, 1);
@@ -513,11 +514,11 @@
513 style_submenu_element("Delete", "%s",
514 url_render(pUrl,"trash","1",zENum,"1"));
515 }
516
517 db_end_transaction(0);
518 style_finish_page("webmail");
519 return;
520 }
521
522 /*
523 ** Scan the query parameters looking for parameters with name of the
@@ -610,14 +611,15 @@
610 login_check_credentials();
611 if( !login_is_individual() ){
612 login_needed(0);
613 return;
614 }
 
615 if( !db_table_exists("repository","emailbox") ){
616 style_header("Webmail Not Available");
617 @ <p>This repository is not configured to provide webmail</p>
618 style_finish_page("webmail");
619 return;
620 }
621 add_content_sql_commands(g.db);
622 emailid = atoi(PD("id","0"));
623 url_initialize(&url, "webmail");
@@ -757,11 +759,11 @@
757 @ for(i=0; i<x.length; i++){
758 @ x[i].checked = true;
759 @ }
760 @ }
761 @ </script>
762 style_finish_page("webmail");
763 db_end_transaction(0);
764 }
765
766 /*
767 ** WEBPAGE: emailblob
@@ -780,10 +782,11 @@
780 if( !g.perm.Setup ){
781 login_needed(0);
782 return;
783 }
784 add_content_sql_commands(g.db);
 
785 style_header("emailblob table");
786 if( id>0 ){
787 style_submenu_element("Index", "%R/emailblob");
788 @ <ul>
789 db_prepare(&q, "SELECT emailid FROM emailblob WHERE ets=%d", id);
@@ -854,11 +857,11 @@
854 }
855 @ </tbody></table>
856 db_finalize(&q);
857 style_table_sorter();
858 }
859 style_finish_page("webmail");
860 }
861
862 /*
863 ** WEBPAGE: emailoutq
864 **
@@ -872,10 +875,11 @@
872 if( !g.perm.Setup ){
873 login_needed(0);
874 return;
875 }
876 add_content_sql_commands(g.db);
 
877 style_header("emailoutq table");
878 style_submenu_element("emailblob table","%R/emailblob");
879 db_prepare(&q,
880 "SELECT edomain, efrom, eto, emsgid, "
881 " datetime(ectime,'unixepoch'),"
@@ -911,7 +915,7 @@
911 }
912 }
913 @ </tbody></table>
914 db_finalize(&q);
915 style_table_sorter();
916 style_finish_page("webmail");
917 }
918
--- src/webmail.c
+++ src/webmail.c
@@ -407,10 +407,11 @@
407 emailid
408 );
409 if( zUser ) blob_append_sql(&sql, " AND euser=%Q", zUser);
410 db_prepare_blob(&q, &sql);
411 blob_reset(&sql);
412 style_set_current_feature("webmail");
413 style_header("Message %d",emailid);
414 if( db_step(&q)==SQLITE_ROW ){
415 Blob msg = db_column_text_as_blob(&q, 0);
416 int eFormat = atoi(PD("f","0"));
417 eState = db_column_int(&q, 1);
@@ -513,11 +514,11 @@
514 style_submenu_element("Delete", "%s",
515 url_render(pUrl,"trash","1",zENum,"1"));
516 }
517
518 db_end_transaction(0);
519 style_finish_page();
520 return;
521 }
522
523 /*
524 ** Scan the query parameters looking for parameters with name of the
@@ -610,14 +611,15 @@
611 login_check_credentials();
612 if( !login_is_individual() ){
613 login_needed(0);
614 return;
615 }
616 style_set_current_feature("webmail");
617 if( !db_table_exists("repository","emailbox") ){
618 style_header("Webmail Not Available");
619 @ <p>This repository is not configured to provide webmail</p>
620 style_finish_page();
621 return;
622 }
623 add_content_sql_commands(g.db);
624 emailid = atoi(PD("id","0"));
625 url_initialize(&url, "webmail");
@@ -757,11 +759,11 @@
759 @ for(i=0; i<x.length; i++){
760 @ x[i].checked = true;
761 @ }
762 @ }
763 @ </script>
764 style_finish_page();
765 db_end_transaction(0);
766 }
767
768 /*
769 ** WEBPAGE: emailblob
@@ -780,10 +782,11 @@
782 if( !g.perm.Setup ){
783 login_needed(0);
784 return;
785 }
786 add_content_sql_commands(g.db);
787 style_set_current_feature("webmail");
788 style_header("emailblob table");
789 if( id>0 ){
790 style_submenu_element("Index", "%R/emailblob");
791 @ <ul>
792 db_prepare(&q, "SELECT emailid FROM emailblob WHERE ets=%d", id);
@@ -854,11 +857,11 @@
857 }
858 @ </tbody></table>
859 db_finalize(&q);
860 style_table_sorter();
861 }
862 style_finish_page();
863 }
864
865 /*
866 ** WEBPAGE: emailoutq
867 **
@@ -872,10 +875,11 @@
875 if( !g.perm.Setup ){
876 login_needed(0);
877 return;
878 }
879 add_content_sql_commands(g.db);
880 style_set_current_feature("webmail");
881 style_header("emailoutq table");
882 style_submenu_element("emailblob table","%R/emailblob");
883 db_prepare(&q,
884 "SELECT edomain, efrom, eto, emsgid, "
885 " datetime(ectime,'unixepoch'),"
@@ -911,7 +915,7 @@
915 }
916 }
917 @ </tbody></table>
918 db_finalize(&q);
919 style_table_sorter();
920 style_finish_page();
921 }
922
+31 -16
--- src/wiki.c
+++ src/wiki.c
@@ -62,15 +62,16 @@
6262
** Check a wiki name. If it is not well-formed, then issue an error
6363
** and return true. If it is well-formed, return false.
6464
*/
6565
static int check_name(const char *z){
6666
if( !wiki_name_is_wellformed((const unsigned char *)z) ){
67
+ style_set_current_feature("wiki");
6768
style_header("Wiki Page Name Error");
6869
@ The wiki name "<span class="wikiError">%h(z)</span>" is not well-formed.
6970
@ Rules for wiki page names:
7071
well_formed_wiki_name_rules();
71
- style_finish_page("wiki");
72
+ style_finish_page();
7273
return 1;
7374
}
7475
return 0;
7576
}
7677
@@ -134,18 +135,19 @@
134135
cgi_set_parameter_nocopy("name", g.zExtra, 1);
135136
g.isHome = 1;
136137
wiki_page();
137138
return;
138139
}
140
+ style_set_current_feature("wiki");
139141
style_header("Home");
140142
@ <p>This is a stub home-page for the project.
141143
@ To fill in this page, first go to
142144
@ %z(href("%R/setup_config"))setup/config</a>
143145
@ and establish a "Project Name". Then create a
144146
@ wiki page with that name. The content of that wiki page
145147
@ will be displayed in place of this message.</p>
146
- style_finish_page("wiki");
148
+ style_finish_page();
147149
}
148150
149151
/*
150152
** Return true if the given pagename is the name of the sandbox
151153
*/
@@ -229,10 +231,11 @@
229231
** Show a summary of the Markdown wiki formatting rules.
230232
*/
231233
void markdown_rules_page(void){
232234
Blob x;
233235
int fTxt = P("txt")!=0;
236
+ style_set_current_feature("wiki");
234237
style_header("Markdown Formatting Rules");
235238
if( fTxt ){
236239
style_submenu_element("Formatted", "%R/md_rules");
237240
}else{
238241
style_submenu_element("Plain-Text", "%R/md_rules?txt=1");
@@ -242,11 +245,11 @@
242245
blob_materialize(&x);
243246
interwiki_append_map_table(&x);
244247
safe_html_context(DOCSRC_TRUSTED);
245248
wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
246249
blob_reset(&x);
247
- style_finish_page("wiki");
250
+ style_finish_page();
248251
}
249252
250253
/*
251254
** WEBPAGE: wiki_rules
252255
**
@@ -253,10 +256,11 @@
253256
** Show a summary of the wiki formatting rules.
254257
*/
255258
void wiki_rules_page(void){
256259
Blob x;
257260
int fTxt = P("txt")!=0;
261
+ style_set_current_feature("wiki");
258262
style_header("Wiki Formatting Rules");
259263
if( fTxt ){
260264
style_submenu_element("Formatted", "%R/wiki_rules");
261265
}else{
262266
style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
@@ -266,25 +270,26 @@
266270
blob_materialize(&x);
267271
interwiki_append_map_table(&x);
268272
safe_html_context(DOCSRC_TRUSTED);
269273
wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
270274
blob_reset(&x);
271
- style_finish_page("wiki");
275
+ style_finish_page();
272276
}
273277
274278
/*
275279
** WEBPAGE: markup_help
276280
**
277281
** Show links to the md_rules and wiki_rules pages.
278282
*/
279283
void markup_help_page(void){
284
+ style_set_current_feature("wiki");
280285
style_header("Fossil Markup Styles");
281286
@ <ul>
282287
@ <li><p>%z(href("%R/wiki_rules"))Fossil Wiki Formatting Rules</a></p></li>
283288
@ <li><p>%z(href("%R/md_rules"))Markdown Formatting Rules</a></p></li>
284289
@ </ul>
285
- style_finish_page("wiki");
290
+ style_finish_page();
286291
}
287292
288293
/*
289294
** Returns non-zero if moderation is required for wiki changes and wiki
290295
** attachments.
@@ -344,10 +349,11 @@
344349
** A generic landing page for wiki.
345350
*/
346351
void wiki_helppage(void){
347352
login_check_credentials();
348353
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
354
+ style_set_current_feature("wiki");
349355
style_header("Wiki Help");
350356
wiki_standard_submenu(W_ALL_BUT(W_HELP));
351357
@ <h2>Wiki Links</h2>
352358
@ <ul>
353359
@ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li>
@@ -369,11 +375,11 @@
369375
if( search_restrict(SRCH_WIKI)!=0 ){
370376
@ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
371377
@ words</li>
372378
}
373379
@ </ul>
374
- style_finish_page("wiki");
380
+ style_finish_page();
375381
return;
376382
}
377383
378384
/*
379385
** WEBPAGE: wikisrch
@@ -381,14 +387,15 @@
381387
**
382388
** Full-text search of all current wiki text
383389
*/
384390
void wiki_srchpage(void){
385391
login_check_credentials();
392
+ style_set_current_feature("wiki");
386393
style_header("Wiki Search");
387394
wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
388395
search_screen(SRCH_WIKI, 0);
389
- style_finish_page("wiki");
396
+ style_finish_page();
390397
}
391398
392399
/* Return values from wiki_page_type() */
393400
#if INTERFACE
394401
# define WIKITYPE_UNKNOWN (-1)
@@ -446,10 +453,11 @@
446453
static int wiki_page_header(
447454
int eType, /* Page type. Might be WIKITYPE_UNKNOWN */
448455
const char *zPageName, /* Name of the page */
449456
const char *zExtra /* Extra prefix text on the page header */
450457
){
458
+ style_set_current_feature("wiki");
451459
if( eType==WIKITYPE_UNKNOWN ) eType = wiki_page_type(zPageName);
452460
switch( eType ){
453461
case WIKITYPE_NORMAL: {
454462
style_header("%s%s", zExtra, zPageName);
455463
break;
@@ -597,11 +605,11 @@
597605
blob_reset(&wiki);
598606
}
599607
attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
600608
manifest_destroy(pWiki);
601609
document_emit_js(/*for optional pikchr support*/);
602
- style_finish_page("wiki");
610
+ style_finish_page();
603611
}
604612
605613
/*
606614
** Write a wiki artifact into the repository
607615
*/
@@ -1101,11 +1109,11 @@
11011109
** until the user explicitly saves it). If passed no page name,
11021110
** the user may select a page from the list on the first UI tab.
11031111
**
11041112
** When creating a new page, the mimetype URL parameter may optionally
11051113
** be used to set its mimetype to one of text/x-fossil-wiki,
1106
-** text/x-markdown, or text/plain, defauling to the former.
1114
+** text/x-markdown, or text/plain, defaulting to the former.
11071115
*/
11081116
void wikiedit_page(void){
11091117
const char *zPageName;
11101118
const char * zMimetype = P("mimetype");
11111119
int isSandbox;
@@ -1138,10 +1146,11 @@
11381146
if( !g.perm.RdWiki ){
11391147
login_needed(g.anon.RdWiki);
11401148
return;
11411149
}
11421150
}
1151
+ style_set_current_feature("wiki");
11431152
style_header("Wiki Editor");
11441153
style_emit_noscript_for_js_page();
11451154
11461155
/* Status bar */
11471156
CX("<div id='fossil-status-bar' "
@@ -1344,11 +1353,11 @@
13441353
CX("}catch(e){"
13451354
"fossil.error(e); console.error('Exception:',e);"
13461355
"}\n");
13471356
CX("});\n"/*fossil.onPageLoad()*/);
13481357
style_script_end();
1349
- style_finish_page("wiki");
1358
+ style_finish_page();
13501359
}
13511360
13521361
/*
13531362
** WEBPAGE: wikinew
13541363
** URL /wikinew
@@ -1367,10 +1376,11 @@
13671376
zName = PD("name","");
13681377
zMimetype = wiki_filter_mimetypes(P("mimetype"));
13691378
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
13701379
cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
13711380
}
1381
+ style_set_current_feature("wiki");
13721382
style_header("Create A New Wiki Page");
13731383
wiki_standard_submenu(W_ALL_BUT(W_NEW));
13741384
@ <p>Rules for wiki page names:</p>
13751385
well_formed_wiki_name_rules();
13761386
form_begin(0, "%R/wikinew");
@@ -1382,11 +1392,11 @@
13821392
@ </p></form>
13831393
if( zName[0] ){
13841394
@ <p><span class="wikiError">
13851395
@ "%h(zName)" is not a valid wiki page name!</span></p>
13861396
}
1387
- style_finish_page("wiki");
1397
+ style_finish_page();
13881398
}
13891399
13901400
13911401
/*
13921402
** Append the wiki text for an remark to the end of the given BLOB.
@@ -1513,10 +1523,11 @@
15131523
if( P("cancel")!=0 ){
15141524
cgi_redirectf("wiki?name=%T", zPageName);
15151525
return;
15161526
}
15171527
style_set_current_page("%T?name=%T", g.zPath, zPageName);
1528
+ style_set_current_feature("wiki");
15181529
style_header("Append Comment To: %s", zPageName);
15191530
if( !goodCaptcha ){
15201531
@ <p class="generalError">Error: Incorrect security code.</p>
15211532
}
15221533
if( P("preview")!=0 ){
@@ -1544,11 +1555,11 @@
15441555
@ <input type="submit" name="preview" value="Preview Your Comment" />
15451556
@ <input type="submit" name="submit" value="Append Your Changes" />
15461557
@ <input type="submit" name="cancel" value="Cancel" />
15471558
captcha_generate(0);
15481559
@ </form>
1549
- style_finish_page("wiki");
1560
+ style_finish_page();
15501561
}
15511562
15521563
/*
15531564
** WEBPAGE: whistory
15541565
** URL: /whistory?name=PAGENAME
@@ -1565,10 +1576,11 @@
15651576
double rNow;
15661577
int showRid;
15671578
login_check_credentials();
15681579
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
15691580
zPageName = PD("name","");
1581
+ style_set_current_feature("wiki");
15701582
style_header("History Of %s", zPageName);
15711583
showRid = P("showid")!=0;
15721584
db_prepare(&q,
15731585
"SELECT"
15741586
" event.mtime,"
@@ -1634,11 +1646,11 @@
16341646
}
16351647
@ </tbody></table></div>
16361648
db_finalize(&q);
16371649
builtin_request_js("fossil.page.whistory.js");
16381650
/* style_table_sorter(); */
1639
- style_finish_page("wiki");
1651
+ style_finish_page();
16401652
}
16411653
16421654
/*
16431655
** WEBPAGE: wdiff
16441656
**
@@ -1697,20 +1709,21 @@
16971709
}
16981710
nextRid = wiki_next(wiki_tagid(pW1->zWikiTitle),pW1->rDate);
16991711
if( nextRid ){
17001712
style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
17011713
}
1714
+ style_set_current_feature("wiki");
17021715
style_header("Changes To %s", pW1->zWikiTitle);
17031716
blob_zero(&d);
17041717
diffFlags = construct_diff_flags(1);
17051718
text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
17061719
@ <pre class="udiff">
17071720
@ %s(blob_str(&d))
17081721
@ <pre>
17091722
manifest_destroy(pW1);
17101723
manifest_destroy(pW2);
1711
- style_finish_page("wiki");
1724
+ style_finish_page();
17121725
}
17131726
17141727
/*
17151728
** A query that returns information about all wiki pages.
17161729
**
@@ -1753,10 +1766,11 @@
17531766
int showAll = P("all")!=0;
17541767
int showRid = P("showid")!=0;
17551768
17561769
login_check_credentials();
17571770
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1771
+ style_set_current_feature("wiki");
17581772
style_header("Available Wiki Pages");
17591773
if( showAll ){
17601774
style_submenu_element("Active", "%R/wcontent");
17611775
}else{
17621776
style_submenu_element("All", "%R/wcontent?all=1");
@@ -1808,11 +1822,11 @@
18081822
fossil_free(zWDisplayName);
18091823
}
18101824
@ </tbody></table></div>
18111825
db_finalize(&q);
18121826
style_table_sorter();
1813
- style_finish_page("wiki");
1827
+ style_finish_page();
18141828
}
18151829
18161830
/*
18171831
** WEBPAGE: wfind
18181832
**
@@ -1823,10 +1837,11 @@
18231837
Stmt q;
18241838
const char *zTitle;
18251839
login_check_credentials();
18261840
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
18271841
zTitle = PD("title","*");
1842
+ style_set_current_feature("wiki");
18281843
style_header("Wiki Pages Found");
18291844
@ <ul>
18301845
db_prepare(&q,
18311846
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
18321847
" ORDER BY lower(tagname) /*sort*/" ,
@@ -1835,11 +1850,11 @@
18351850
const char *zName = db_column_text(&q, 0);
18361851
@ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
18371852
}
18381853
db_finalize(&q);
18391854
@ </ul>
1840
- style_finish_page("wiki");
1855
+ style_finish_page();
18411856
}
18421857
18431858
/*
18441859
** Add a new wiki page to the repository. The page name is
18451860
** given by the zPageName parameter. rid must be zero to create
18461861
--- src/wiki.c
+++ src/wiki.c
@@ -62,15 +62,16 @@
62 ** Check a wiki name. If it is not well-formed, then issue an error
63 ** and return true. If it is well-formed, return false.
64 */
65 static int check_name(const char *z){
66 if( !wiki_name_is_wellformed((const unsigned char *)z) ){
 
67 style_header("Wiki Page Name Error");
68 @ The wiki name "<span class="wikiError">%h(z)</span>" is not well-formed.
69 @ Rules for wiki page names:
70 well_formed_wiki_name_rules();
71 style_finish_page("wiki");
72 return 1;
73 }
74 return 0;
75 }
76
@@ -134,18 +135,19 @@
134 cgi_set_parameter_nocopy("name", g.zExtra, 1);
135 g.isHome = 1;
136 wiki_page();
137 return;
138 }
 
139 style_header("Home");
140 @ <p>This is a stub home-page for the project.
141 @ To fill in this page, first go to
142 @ %z(href("%R/setup_config"))setup/config</a>
143 @ and establish a "Project Name". Then create a
144 @ wiki page with that name. The content of that wiki page
145 @ will be displayed in place of this message.</p>
146 style_finish_page("wiki");
147 }
148
149 /*
150 ** Return true if the given pagename is the name of the sandbox
151 */
@@ -229,10 +231,11 @@
229 ** Show a summary of the Markdown wiki formatting rules.
230 */
231 void markdown_rules_page(void){
232 Blob x;
233 int fTxt = P("txt")!=0;
 
234 style_header("Markdown Formatting Rules");
235 if( fTxt ){
236 style_submenu_element("Formatted", "%R/md_rules");
237 }else{
238 style_submenu_element("Plain-Text", "%R/md_rules?txt=1");
@@ -242,11 +245,11 @@
242 blob_materialize(&x);
243 interwiki_append_map_table(&x);
244 safe_html_context(DOCSRC_TRUSTED);
245 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
246 blob_reset(&x);
247 style_finish_page("wiki");
248 }
249
250 /*
251 ** WEBPAGE: wiki_rules
252 **
@@ -253,10 +256,11 @@
253 ** Show a summary of the wiki formatting rules.
254 */
255 void wiki_rules_page(void){
256 Blob x;
257 int fTxt = P("txt")!=0;
 
258 style_header("Wiki Formatting Rules");
259 if( fTxt ){
260 style_submenu_element("Formatted", "%R/wiki_rules");
261 }else{
262 style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
@@ -266,25 +270,26 @@
266 blob_materialize(&x);
267 interwiki_append_map_table(&x);
268 safe_html_context(DOCSRC_TRUSTED);
269 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
270 blob_reset(&x);
271 style_finish_page("wiki");
272 }
273
274 /*
275 ** WEBPAGE: markup_help
276 **
277 ** Show links to the md_rules and wiki_rules pages.
278 */
279 void markup_help_page(void){
 
280 style_header("Fossil Markup Styles");
281 @ <ul>
282 @ <li><p>%z(href("%R/wiki_rules"))Fossil Wiki Formatting Rules</a></p></li>
283 @ <li><p>%z(href("%R/md_rules"))Markdown Formatting Rules</a></p></li>
284 @ </ul>
285 style_finish_page("wiki");
286 }
287
288 /*
289 ** Returns non-zero if moderation is required for wiki changes and wiki
290 ** attachments.
@@ -344,10 +349,11 @@
344 ** A generic landing page for wiki.
345 */
346 void wiki_helppage(void){
347 login_check_credentials();
348 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
 
349 style_header("Wiki Help");
350 wiki_standard_submenu(W_ALL_BUT(W_HELP));
351 @ <h2>Wiki Links</h2>
352 @ <ul>
353 @ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li>
@@ -369,11 +375,11 @@
369 if( search_restrict(SRCH_WIKI)!=0 ){
370 @ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
371 @ words</li>
372 }
373 @ </ul>
374 style_finish_page("wiki");
375 return;
376 }
377
378 /*
379 ** WEBPAGE: wikisrch
@@ -381,14 +387,15 @@
381 **
382 ** Full-text search of all current wiki text
383 */
384 void wiki_srchpage(void){
385 login_check_credentials();
 
386 style_header("Wiki Search");
387 wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
388 search_screen(SRCH_WIKI, 0);
389 style_finish_page("wiki");
390 }
391
392 /* Return values from wiki_page_type() */
393 #if INTERFACE
394 # define WIKITYPE_UNKNOWN (-1)
@@ -446,10 +453,11 @@
446 static int wiki_page_header(
447 int eType, /* Page type. Might be WIKITYPE_UNKNOWN */
448 const char *zPageName, /* Name of the page */
449 const char *zExtra /* Extra prefix text on the page header */
450 ){
 
451 if( eType==WIKITYPE_UNKNOWN ) eType = wiki_page_type(zPageName);
452 switch( eType ){
453 case WIKITYPE_NORMAL: {
454 style_header("%s%s", zExtra, zPageName);
455 break;
@@ -597,11 +605,11 @@
597 blob_reset(&wiki);
598 }
599 attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
600 manifest_destroy(pWiki);
601 document_emit_js(/*for optional pikchr support*/);
602 style_finish_page("wiki");
603 }
604
605 /*
606 ** Write a wiki artifact into the repository
607 */
@@ -1101,11 +1109,11 @@
1101 ** until the user explicitly saves it). If passed no page name,
1102 ** the user may select a page from the list on the first UI tab.
1103 **
1104 ** When creating a new page, the mimetype URL parameter may optionally
1105 ** be used to set its mimetype to one of text/x-fossil-wiki,
1106 ** text/x-markdown, or text/plain, defauling to the former.
1107 */
1108 void wikiedit_page(void){
1109 const char *zPageName;
1110 const char * zMimetype = P("mimetype");
1111 int isSandbox;
@@ -1138,10 +1146,11 @@
1138 if( !g.perm.RdWiki ){
1139 login_needed(g.anon.RdWiki);
1140 return;
1141 }
1142 }
 
1143 style_header("Wiki Editor");
1144 style_emit_noscript_for_js_page();
1145
1146 /* Status bar */
1147 CX("<div id='fossil-status-bar' "
@@ -1344,11 +1353,11 @@
1344 CX("}catch(e){"
1345 "fossil.error(e); console.error('Exception:',e);"
1346 "}\n");
1347 CX("});\n"/*fossil.onPageLoad()*/);
1348 style_script_end();
1349 style_finish_page("wiki");
1350 }
1351
1352 /*
1353 ** WEBPAGE: wikinew
1354 ** URL /wikinew
@@ -1367,10 +1376,11 @@
1367 zName = PD("name","");
1368 zMimetype = wiki_filter_mimetypes(P("mimetype"));
1369 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
1370 cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
1371 }
 
1372 style_header("Create A New Wiki Page");
1373 wiki_standard_submenu(W_ALL_BUT(W_NEW));
1374 @ <p>Rules for wiki page names:</p>
1375 well_formed_wiki_name_rules();
1376 form_begin(0, "%R/wikinew");
@@ -1382,11 +1392,11 @@
1382 @ </p></form>
1383 if( zName[0] ){
1384 @ <p><span class="wikiError">
1385 @ "%h(zName)" is not a valid wiki page name!</span></p>
1386 }
1387 style_finish_page("wiki");
1388 }
1389
1390
1391 /*
1392 ** Append the wiki text for an remark to the end of the given BLOB.
@@ -1513,10 +1523,11 @@
1513 if( P("cancel")!=0 ){
1514 cgi_redirectf("wiki?name=%T", zPageName);
1515 return;
1516 }
1517 style_set_current_page("%T?name=%T", g.zPath, zPageName);
 
1518 style_header("Append Comment To: %s", zPageName);
1519 if( !goodCaptcha ){
1520 @ <p class="generalError">Error: Incorrect security code.</p>
1521 }
1522 if( P("preview")!=0 ){
@@ -1544,11 +1555,11 @@
1544 @ <input type="submit" name="preview" value="Preview Your Comment" />
1545 @ <input type="submit" name="submit" value="Append Your Changes" />
1546 @ <input type="submit" name="cancel" value="Cancel" />
1547 captcha_generate(0);
1548 @ </form>
1549 style_finish_page("wiki");
1550 }
1551
1552 /*
1553 ** WEBPAGE: whistory
1554 ** URL: /whistory?name=PAGENAME
@@ -1565,10 +1576,11 @@
1565 double rNow;
1566 int showRid;
1567 login_check_credentials();
1568 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1569 zPageName = PD("name","");
 
1570 style_header("History Of %s", zPageName);
1571 showRid = P("showid")!=0;
1572 db_prepare(&q,
1573 "SELECT"
1574 " event.mtime,"
@@ -1634,11 +1646,11 @@
1634 }
1635 @ </tbody></table></div>
1636 db_finalize(&q);
1637 builtin_request_js("fossil.page.whistory.js");
1638 /* style_table_sorter(); */
1639 style_finish_page("wiki");
1640 }
1641
1642 /*
1643 ** WEBPAGE: wdiff
1644 **
@@ -1697,20 +1709,21 @@
1697 }
1698 nextRid = wiki_next(wiki_tagid(pW1->zWikiTitle),pW1->rDate);
1699 if( nextRid ){
1700 style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
1701 }
 
1702 style_header("Changes To %s", pW1->zWikiTitle);
1703 blob_zero(&d);
1704 diffFlags = construct_diff_flags(1);
1705 text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
1706 @ <pre class="udiff">
1707 @ %s(blob_str(&d))
1708 @ <pre>
1709 manifest_destroy(pW1);
1710 manifest_destroy(pW2);
1711 style_finish_page("wiki");
1712 }
1713
1714 /*
1715 ** A query that returns information about all wiki pages.
1716 **
@@ -1753,10 +1766,11 @@
1753 int showAll = P("all")!=0;
1754 int showRid = P("showid")!=0;
1755
1756 login_check_credentials();
1757 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
 
1758 style_header("Available Wiki Pages");
1759 if( showAll ){
1760 style_submenu_element("Active", "%R/wcontent");
1761 }else{
1762 style_submenu_element("All", "%R/wcontent?all=1");
@@ -1808,11 +1822,11 @@
1808 fossil_free(zWDisplayName);
1809 }
1810 @ </tbody></table></div>
1811 db_finalize(&q);
1812 style_table_sorter();
1813 style_finish_page("wiki");
1814 }
1815
1816 /*
1817 ** WEBPAGE: wfind
1818 **
@@ -1823,10 +1837,11 @@
1823 Stmt q;
1824 const char *zTitle;
1825 login_check_credentials();
1826 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1827 zTitle = PD("title","*");
 
1828 style_header("Wiki Pages Found");
1829 @ <ul>
1830 db_prepare(&q,
1831 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
1832 " ORDER BY lower(tagname) /*sort*/" ,
@@ -1835,11 +1850,11 @@
1835 const char *zName = db_column_text(&q, 0);
1836 @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
1837 }
1838 db_finalize(&q);
1839 @ </ul>
1840 style_finish_page("wiki");
1841 }
1842
1843 /*
1844 ** Add a new wiki page to the repository. The page name is
1845 ** given by the zPageName parameter. rid must be zero to create
1846
--- src/wiki.c
+++ src/wiki.c
@@ -62,15 +62,16 @@
62 ** Check a wiki name. If it is not well-formed, then issue an error
63 ** and return true. If it is well-formed, return false.
64 */
65 static int check_name(const char *z){
66 if( !wiki_name_is_wellformed((const unsigned char *)z) ){
67 style_set_current_feature("wiki");
68 style_header("Wiki Page Name Error");
69 @ The wiki name "<span class="wikiError">%h(z)</span>" is not well-formed.
70 @ Rules for wiki page names:
71 well_formed_wiki_name_rules();
72 style_finish_page();
73 return 1;
74 }
75 return 0;
76 }
77
@@ -134,18 +135,19 @@
135 cgi_set_parameter_nocopy("name", g.zExtra, 1);
136 g.isHome = 1;
137 wiki_page();
138 return;
139 }
140 style_set_current_feature("wiki");
141 style_header("Home");
142 @ <p>This is a stub home-page for the project.
143 @ To fill in this page, first go to
144 @ %z(href("%R/setup_config"))setup/config</a>
145 @ and establish a "Project Name". Then create a
146 @ wiki page with that name. The content of that wiki page
147 @ will be displayed in place of this message.</p>
148 style_finish_page();
149 }
150
151 /*
152 ** Return true if the given pagename is the name of the sandbox
153 */
@@ -229,10 +231,11 @@
231 ** Show a summary of the Markdown wiki formatting rules.
232 */
233 void markdown_rules_page(void){
234 Blob x;
235 int fTxt = P("txt")!=0;
236 style_set_current_feature("wiki");
237 style_header("Markdown Formatting Rules");
238 if( fTxt ){
239 style_submenu_element("Formatted", "%R/md_rules");
240 }else{
241 style_submenu_element("Plain-Text", "%R/md_rules?txt=1");
@@ -242,11 +245,11 @@
245 blob_materialize(&x);
246 interwiki_append_map_table(&x);
247 safe_html_context(DOCSRC_TRUSTED);
248 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
249 blob_reset(&x);
250 style_finish_page();
251 }
252
253 /*
254 ** WEBPAGE: wiki_rules
255 **
@@ -253,10 +256,11 @@
256 ** Show a summary of the wiki formatting rules.
257 */
258 void wiki_rules_page(void){
259 Blob x;
260 int fTxt = P("txt")!=0;
261 style_set_current_feature("wiki");
262 style_header("Wiki Formatting Rules");
263 if( fTxt ){
264 style_submenu_element("Formatted", "%R/wiki_rules");
265 }else{
266 style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
@@ -266,25 +270,26 @@
270 blob_materialize(&x);
271 interwiki_append_map_table(&x);
272 safe_html_context(DOCSRC_TRUSTED);
273 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
274 blob_reset(&x);
275 style_finish_page();
276 }
277
278 /*
279 ** WEBPAGE: markup_help
280 **
281 ** Show links to the md_rules and wiki_rules pages.
282 */
283 void markup_help_page(void){
284 style_set_current_feature("wiki");
285 style_header("Fossil Markup Styles");
286 @ <ul>
287 @ <li><p>%z(href("%R/wiki_rules"))Fossil Wiki Formatting Rules</a></p></li>
288 @ <li><p>%z(href("%R/md_rules"))Markdown Formatting Rules</a></p></li>
289 @ </ul>
290 style_finish_page();
291 }
292
293 /*
294 ** Returns non-zero if moderation is required for wiki changes and wiki
295 ** attachments.
@@ -344,10 +349,11 @@
349 ** A generic landing page for wiki.
350 */
351 void wiki_helppage(void){
352 login_check_credentials();
353 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
354 style_set_current_feature("wiki");
355 style_header("Wiki Help");
356 wiki_standard_submenu(W_ALL_BUT(W_HELP));
357 @ <h2>Wiki Links</h2>
358 @ <ul>
359 @ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li>
@@ -369,11 +375,11 @@
375 if( search_restrict(SRCH_WIKI)!=0 ){
376 @ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
377 @ words</li>
378 }
379 @ </ul>
380 style_finish_page();
381 return;
382 }
383
384 /*
385 ** WEBPAGE: wikisrch
@@ -381,14 +387,15 @@
387 **
388 ** Full-text search of all current wiki text
389 */
390 void wiki_srchpage(void){
391 login_check_credentials();
392 style_set_current_feature("wiki");
393 style_header("Wiki Search");
394 wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
395 search_screen(SRCH_WIKI, 0);
396 style_finish_page();
397 }
398
399 /* Return values from wiki_page_type() */
400 #if INTERFACE
401 # define WIKITYPE_UNKNOWN (-1)
@@ -446,10 +453,11 @@
453 static int wiki_page_header(
454 int eType, /* Page type. Might be WIKITYPE_UNKNOWN */
455 const char *zPageName, /* Name of the page */
456 const char *zExtra /* Extra prefix text on the page header */
457 ){
458 style_set_current_feature("wiki");
459 if( eType==WIKITYPE_UNKNOWN ) eType = wiki_page_type(zPageName);
460 switch( eType ){
461 case WIKITYPE_NORMAL: {
462 style_header("%s%s", zExtra, zPageName);
463 break;
@@ -597,11 +605,11 @@
605 blob_reset(&wiki);
606 }
607 attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
608 manifest_destroy(pWiki);
609 document_emit_js(/*for optional pikchr support*/);
610 style_finish_page();
611 }
612
613 /*
614 ** Write a wiki artifact into the repository
615 */
@@ -1101,11 +1109,11 @@
1109 ** until the user explicitly saves it). If passed no page name,
1110 ** the user may select a page from the list on the first UI tab.
1111 **
1112 ** When creating a new page, the mimetype URL parameter may optionally
1113 ** be used to set its mimetype to one of text/x-fossil-wiki,
1114 ** text/x-markdown, or text/plain, defaulting to the former.
1115 */
1116 void wikiedit_page(void){
1117 const char *zPageName;
1118 const char * zMimetype = P("mimetype");
1119 int isSandbox;
@@ -1138,10 +1146,11 @@
1146 if( !g.perm.RdWiki ){
1147 login_needed(g.anon.RdWiki);
1148 return;
1149 }
1150 }
1151 style_set_current_feature("wiki");
1152 style_header("Wiki Editor");
1153 style_emit_noscript_for_js_page();
1154
1155 /* Status bar */
1156 CX("<div id='fossil-status-bar' "
@@ -1344,11 +1353,11 @@
1353 CX("}catch(e){"
1354 "fossil.error(e); console.error('Exception:',e);"
1355 "}\n");
1356 CX("});\n"/*fossil.onPageLoad()*/);
1357 style_script_end();
1358 style_finish_page();
1359 }
1360
1361 /*
1362 ** WEBPAGE: wikinew
1363 ** URL /wikinew
@@ -1367,10 +1376,11 @@
1376 zName = PD("name","");
1377 zMimetype = wiki_filter_mimetypes(P("mimetype"));
1378 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
1379 cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
1380 }
1381 style_set_current_feature("wiki");
1382 style_header("Create A New Wiki Page");
1383 wiki_standard_submenu(W_ALL_BUT(W_NEW));
1384 @ <p>Rules for wiki page names:</p>
1385 well_formed_wiki_name_rules();
1386 form_begin(0, "%R/wikinew");
@@ -1382,11 +1392,11 @@
1392 @ </p></form>
1393 if( zName[0] ){
1394 @ <p><span class="wikiError">
1395 @ "%h(zName)" is not a valid wiki page name!</span></p>
1396 }
1397 style_finish_page();
1398 }
1399
1400
1401 /*
1402 ** Append the wiki text for an remark to the end of the given BLOB.
@@ -1513,10 +1523,11 @@
1523 if( P("cancel")!=0 ){
1524 cgi_redirectf("wiki?name=%T", zPageName);
1525 return;
1526 }
1527 style_set_current_page("%T?name=%T", g.zPath, zPageName);
1528 style_set_current_feature("wiki");
1529 style_header("Append Comment To: %s", zPageName);
1530 if( !goodCaptcha ){
1531 @ <p class="generalError">Error: Incorrect security code.</p>
1532 }
1533 if( P("preview")!=0 ){
@@ -1544,11 +1555,11 @@
1555 @ <input type="submit" name="preview" value="Preview Your Comment" />
1556 @ <input type="submit" name="submit" value="Append Your Changes" />
1557 @ <input type="submit" name="cancel" value="Cancel" />
1558 captcha_generate(0);
1559 @ </form>
1560 style_finish_page();
1561 }
1562
1563 /*
1564 ** WEBPAGE: whistory
1565 ** URL: /whistory?name=PAGENAME
@@ -1565,10 +1576,11 @@
1576 double rNow;
1577 int showRid;
1578 login_check_credentials();
1579 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1580 zPageName = PD("name","");
1581 style_set_current_feature("wiki");
1582 style_header("History Of %s", zPageName);
1583 showRid = P("showid")!=0;
1584 db_prepare(&q,
1585 "SELECT"
1586 " event.mtime,"
@@ -1634,11 +1646,11 @@
1646 }
1647 @ </tbody></table></div>
1648 db_finalize(&q);
1649 builtin_request_js("fossil.page.whistory.js");
1650 /* style_table_sorter(); */
1651 style_finish_page();
1652 }
1653
1654 /*
1655 ** WEBPAGE: wdiff
1656 **
@@ -1697,20 +1709,21 @@
1709 }
1710 nextRid = wiki_next(wiki_tagid(pW1->zWikiTitle),pW1->rDate);
1711 if( nextRid ){
1712 style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
1713 }
1714 style_set_current_feature("wiki");
1715 style_header("Changes To %s", pW1->zWikiTitle);
1716 blob_zero(&d);
1717 diffFlags = construct_diff_flags(1);
1718 text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
1719 @ <pre class="udiff">
1720 @ %s(blob_str(&d))
1721 @ <pre>
1722 manifest_destroy(pW1);
1723 manifest_destroy(pW2);
1724 style_finish_page();
1725 }
1726
1727 /*
1728 ** A query that returns information about all wiki pages.
1729 **
@@ -1753,10 +1766,11 @@
1766 int showAll = P("all")!=0;
1767 int showRid = P("showid")!=0;
1768
1769 login_check_credentials();
1770 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1771 style_set_current_feature("wiki");
1772 style_header("Available Wiki Pages");
1773 if( showAll ){
1774 style_submenu_element("Active", "%R/wcontent");
1775 }else{
1776 style_submenu_element("All", "%R/wcontent?all=1");
@@ -1808,11 +1822,11 @@
1822 fossil_free(zWDisplayName);
1823 }
1824 @ </tbody></table></div>
1825 db_finalize(&q);
1826 style_table_sorter();
1827 style_finish_page();
1828 }
1829
1830 /*
1831 ** WEBPAGE: wfind
1832 **
@@ -1823,10 +1837,11 @@
1837 Stmt q;
1838 const char *zTitle;
1839 login_check_credentials();
1840 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1841 zTitle = PD("title","*");
1842 style_set_current_feature("wiki");
1843 style_header("Wiki Pages Found");
1844 @ <ul>
1845 db_prepare(&q,
1846 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
1847 " ORDER BY lower(tagname) /*sort*/" ,
@@ -1835,11 +1850,11 @@
1850 const char *zName = db_column_text(&q, 0);
1851 @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
1852 }
1853 db_finalize(&q);
1854 @ </ul>
1855 style_finish_page();
1856 }
1857
1858 /*
1859 ** Add a new wiki page to the repository. The page name is
1860 ** given by the zPageName parameter. rid must be zero to create
1861
+31 -16
--- src/wiki.c
+++ src/wiki.c
@@ -62,15 +62,16 @@
6262
** Check a wiki name. If it is not well-formed, then issue an error
6363
** and return true. If it is well-formed, return false.
6464
*/
6565
static int check_name(const char *z){
6666
if( !wiki_name_is_wellformed((const unsigned char *)z) ){
67
+ style_set_current_feature("wiki");
6768
style_header("Wiki Page Name Error");
6869
@ The wiki name "<span class="wikiError">%h(z)</span>" is not well-formed.
6970
@ Rules for wiki page names:
7071
well_formed_wiki_name_rules();
71
- style_finish_page("wiki");
72
+ style_finish_page();
7273
return 1;
7374
}
7475
return 0;
7576
}
7677
@@ -134,18 +135,19 @@
134135
cgi_set_parameter_nocopy("name", g.zExtra, 1);
135136
g.isHome = 1;
136137
wiki_page();
137138
return;
138139
}
140
+ style_set_current_feature("wiki");
139141
style_header("Home");
140142
@ <p>This is a stub home-page for the project.
141143
@ To fill in this page, first go to
142144
@ %z(href("%R/setup_config"))setup/config</a>
143145
@ and establish a "Project Name". Then create a
144146
@ wiki page with that name. The content of that wiki page
145147
@ will be displayed in place of this message.</p>
146
- style_finish_page("wiki");
148
+ style_finish_page();
147149
}
148150
149151
/*
150152
** Return true if the given pagename is the name of the sandbox
151153
*/
@@ -229,10 +231,11 @@
229231
** Show a summary of the Markdown wiki formatting rules.
230232
*/
231233
void markdown_rules_page(void){
232234
Blob x;
233235
int fTxt = P("txt")!=0;
236
+ style_set_current_feature("wiki");
234237
style_header("Markdown Formatting Rules");
235238
if( fTxt ){
236239
style_submenu_element("Formatted", "%R/md_rules");
237240
}else{
238241
style_submenu_element("Plain-Text", "%R/md_rules?txt=1");
@@ -242,11 +245,11 @@
242245
blob_materialize(&x);
243246
interwiki_append_map_table(&x);
244247
safe_html_context(DOCSRC_TRUSTED);
245248
wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
246249
blob_reset(&x);
247
- style_finish_page("wiki");
250
+ style_finish_page();
248251
}
249252
250253
/*
251254
** WEBPAGE: wiki_rules
252255
**
@@ -253,10 +256,11 @@
253256
** Show a summary of the wiki formatting rules.
254257
*/
255258
void wiki_rules_page(void){
256259
Blob x;
257260
int fTxt = P("txt")!=0;
261
+ style_set_current_feature("wiki");
258262
style_header("Wiki Formatting Rules");
259263
if( fTxt ){
260264
style_submenu_element("Formatted", "%R/wiki_rules");
261265
}else{
262266
style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
@@ -266,25 +270,26 @@
266270
blob_materialize(&x);
267271
interwiki_append_map_table(&x);
268272
safe_html_context(DOCSRC_TRUSTED);
269273
wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
270274
blob_reset(&x);
271
- style_finish_page("wiki");
275
+ style_finish_page();
272276
}
273277
274278
/*
275279
** WEBPAGE: markup_help
276280
**
277281
** Show links to the md_rules and wiki_rules pages.
278282
*/
279283
void markup_help_page(void){
284
+ style_set_current_feature("wiki");
280285
style_header("Fossil Markup Styles");
281286
@ <ul>
282287
@ <li><p>%z(href("%R/wiki_rules"))Fossil Wiki Formatting Rules</a></p></li>
283288
@ <li><p>%z(href("%R/md_rules"))Markdown Formatting Rules</a></p></li>
284289
@ </ul>
285
- style_finish_page("wiki");
290
+ style_finish_page();
286291
}
287292
288293
/*
289294
** Returns non-zero if moderation is required for wiki changes and wiki
290295
** attachments.
@@ -344,10 +349,11 @@
344349
** A generic landing page for wiki.
345350
*/
346351
void wiki_helppage(void){
347352
login_check_credentials();
348353
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
354
+ style_set_current_feature("wiki");
349355
style_header("Wiki Help");
350356
wiki_standard_submenu(W_ALL_BUT(W_HELP));
351357
@ <h2>Wiki Links</h2>
352358
@ <ul>
353359
@ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li>
@@ -369,11 +375,11 @@
369375
if( search_restrict(SRCH_WIKI)!=0 ){
370376
@ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
371377
@ words</li>
372378
}
373379
@ </ul>
374
- style_finish_page("wiki");
380
+ style_finish_page();
375381
return;
376382
}
377383
378384
/*
379385
** WEBPAGE: wikisrch
@@ -381,14 +387,15 @@
381387
**
382388
** Full-text search of all current wiki text
383389
*/
384390
void wiki_srchpage(void){
385391
login_check_credentials();
392
+ style_set_current_feature("wiki");
386393
style_header("Wiki Search");
387394
wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
388395
search_screen(SRCH_WIKI, 0);
389
- style_finish_page("wiki");
396
+ style_finish_page();
390397
}
391398
392399
/* Return values from wiki_page_type() */
393400
#if INTERFACE
394401
# define WIKITYPE_UNKNOWN (-1)
@@ -446,10 +453,11 @@
446453
static int wiki_page_header(
447454
int eType, /* Page type. Might be WIKITYPE_UNKNOWN */
448455
const char *zPageName, /* Name of the page */
449456
const char *zExtra /* Extra prefix text on the page header */
450457
){
458
+ style_set_current_feature("wiki");
451459
if( eType==WIKITYPE_UNKNOWN ) eType = wiki_page_type(zPageName);
452460
switch( eType ){
453461
case WIKITYPE_NORMAL: {
454462
style_header("%s%s", zExtra, zPageName);
455463
break;
@@ -597,11 +605,11 @@
597605
blob_reset(&wiki);
598606
}
599607
attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
600608
manifest_destroy(pWiki);
601609
document_emit_js(/*for optional pikchr support*/);
602
- style_finish_page("wiki");
610
+ style_finish_page();
603611
}
604612
605613
/*
606614
** Write a wiki artifact into the repository
607615
*/
@@ -1101,11 +1109,11 @@
11011109
** until the user explicitly saves it). If passed no page name,
11021110
** the user may select a page from the list on the first UI tab.
11031111
**
11041112
** When creating a new page, the mimetype URL parameter may optionally
11051113
** be used to set its mimetype to one of text/x-fossil-wiki,
1106
-** text/x-markdown, or text/plain, defauling to the former.
1114
+** text/x-markdown, or text/plain, defaulting to the former.
11071115
*/
11081116
void wikiedit_page(void){
11091117
const char *zPageName;
11101118
const char * zMimetype = P("mimetype");
11111119
int isSandbox;
@@ -1138,10 +1146,11 @@
11381146
if( !g.perm.RdWiki ){
11391147
login_needed(g.anon.RdWiki);
11401148
return;
11411149
}
11421150
}
1151
+ style_set_current_feature("wiki");
11431152
style_header("Wiki Editor");
11441153
style_emit_noscript_for_js_page();
11451154
11461155
/* Status bar */
11471156
CX("<div id='fossil-status-bar' "
@@ -1344,11 +1353,11 @@
13441353
CX("}catch(e){"
13451354
"fossil.error(e); console.error('Exception:',e);"
13461355
"}\n");
13471356
CX("});\n"/*fossil.onPageLoad()*/);
13481357
style_script_end();
1349
- style_finish_page("wiki");
1358
+ style_finish_page();
13501359
}
13511360
13521361
/*
13531362
** WEBPAGE: wikinew
13541363
** URL /wikinew
@@ -1367,10 +1376,11 @@
13671376
zName = PD("name","");
13681377
zMimetype = wiki_filter_mimetypes(P("mimetype"));
13691378
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
13701379
cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
13711380
}
1381
+ style_set_current_feature("wiki");
13721382
style_header("Create A New Wiki Page");
13731383
wiki_standard_submenu(W_ALL_BUT(W_NEW));
13741384
@ <p>Rules for wiki page names:</p>
13751385
well_formed_wiki_name_rules();
13761386
form_begin(0, "%R/wikinew");
@@ -1382,11 +1392,11 @@
13821392
@ </p></form>
13831393
if( zName[0] ){
13841394
@ <p><span class="wikiError">
13851395
@ "%h(zName)" is not a valid wiki page name!</span></p>
13861396
}
1387
- style_finish_page("wiki");
1397
+ style_finish_page();
13881398
}
13891399
13901400
13911401
/*
13921402
** Append the wiki text for an remark to the end of the given BLOB.
@@ -1513,10 +1523,11 @@
15131523
if( P("cancel")!=0 ){
15141524
cgi_redirectf("wiki?name=%T", zPageName);
15151525
return;
15161526
}
15171527
style_set_current_page("%T?name=%T", g.zPath, zPageName);
1528
+ style_set_current_feature("wiki");
15181529
style_header("Append Comment To: %s", zPageName);
15191530
if( !goodCaptcha ){
15201531
@ <p class="generalError">Error: Incorrect security code.</p>
15211532
}
15221533
if( P("preview")!=0 ){
@@ -1544,11 +1555,11 @@
15441555
@ <input type="submit" name="preview" value="Preview Your Comment" />
15451556
@ <input type="submit" name="submit" value="Append Your Changes" />
15461557
@ <input type="submit" name="cancel" value="Cancel" />
15471558
captcha_generate(0);
15481559
@ </form>
1549
- style_finish_page("wiki");
1560
+ style_finish_page();
15501561
}
15511562
15521563
/*
15531564
** WEBPAGE: whistory
15541565
** URL: /whistory?name=PAGENAME
@@ -1565,10 +1576,11 @@
15651576
double rNow;
15661577
int showRid;
15671578
login_check_credentials();
15681579
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
15691580
zPageName = PD("name","");
1581
+ style_set_current_feature("wiki");
15701582
style_header("History Of %s", zPageName);
15711583
showRid = P("showid")!=0;
15721584
db_prepare(&q,
15731585
"SELECT"
15741586
" event.mtime,"
@@ -1634,11 +1646,11 @@
16341646
}
16351647
@ </tbody></table></div>
16361648
db_finalize(&q);
16371649
builtin_request_js("fossil.page.whistory.js");
16381650
/* style_table_sorter(); */
1639
- style_finish_page("wiki");
1651
+ style_finish_page();
16401652
}
16411653
16421654
/*
16431655
** WEBPAGE: wdiff
16441656
**
@@ -1697,20 +1709,21 @@
16971709
}
16981710
nextRid = wiki_next(wiki_tagid(pW1->zWikiTitle),pW1->rDate);
16991711
if( nextRid ){
17001712
style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
17011713
}
1714
+ style_set_current_feature("wiki");
17021715
style_header("Changes To %s", pW1->zWikiTitle);
17031716
blob_zero(&d);
17041717
diffFlags = construct_diff_flags(1);
17051718
text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
17061719
@ <pre class="udiff">
17071720
@ %s(blob_str(&d))
17081721
@ <pre>
17091722
manifest_destroy(pW1);
17101723
manifest_destroy(pW2);
1711
- style_finish_page("wiki");
1724
+ style_finish_page();
17121725
}
17131726
17141727
/*
17151728
** A query that returns information about all wiki pages.
17161729
**
@@ -1753,10 +1766,11 @@
17531766
int showAll = P("all")!=0;
17541767
int showRid = P("showid")!=0;
17551768
17561769
login_check_credentials();
17571770
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1771
+ style_set_current_feature("wiki");
17581772
style_header("Available Wiki Pages");
17591773
if( showAll ){
17601774
style_submenu_element("Active", "%R/wcontent");
17611775
}else{
17621776
style_submenu_element("All", "%R/wcontent?all=1");
@@ -1808,11 +1822,11 @@
18081822
fossil_free(zWDisplayName);
18091823
}
18101824
@ </tbody></table></div>
18111825
db_finalize(&q);
18121826
style_table_sorter();
1813
- style_finish_page("wiki");
1827
+ style_finish_page();
18141828
}
18151829
18161830
/*
18171831
** WEBPAGE: wfind
18181832
**
@@ -1823,10 +1837,11 @@
18231837
Stmt q;
18241838
const char *zTitle;
18251839
login_check_credentials();
18261840
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
18271841
zTitle = PD("title","*");
1842
+ style_set_current_feature("wiki");
18281843
style_header("Wiki Pages Found");
18291844
@ <ul>
18301845
db_prepare(&q,
18311846
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
18321847
" ORDER BY lower(tagname) /*sort*/" ,
@@ -1835,11 +1850,11 @@
18351850
const char *zName = db_column_text(&q, 0);
18361851
@ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
18371852
}
18381853
db_finalize(&q);
18391854
@ </ul>
1840
- style_finish_page("wiki");
1855
+ style_finish_page();
18411856
}
18421857
18431858
/*
18441859
** Add a new wiki page to the repository. The page name is
18451860
** given by the zPageName parameter. rid must be zero to create
18461861
--- src/wiki.c
+++ src/wiki.c
@@ -62,15 +62,16 @@
62 ** Check a wiki name. If it is not well-formed, then issue an error
63 ** and return true. If it is well-formed, return false.
64 */
65 static int check_name(const char *z){
66 if( !wiki_name_is_wellformed((const unsigned char *)z) ){
 
67 style_header("Wiki Page Name Error");
68 @ The wiki name "<span class="wikiError">%h(z)</span>" is not well-formed.
69 @ Rules for wiki page names:
70 well_formed_wiki_name_rules();
71 style_finish_page("wiki");
72 return 1;
73 }
74 return 0;
75 }
76
@@ -134,18 +135,19 @@
134 cgi_set_parameter_nocopy("name", g.zExtra, 1);
135 g.isHome = 1;
136 wiki_page();
137 return;
138 }
 
139 style_header("Home");
140 @ <p>This is a stub home-page for the project.
141 @ To fill in this page, first go to
142 @ %z(href("%R/setup_config"))setup/config</a>
143 @ and establish a "Project Name". Then create a
144 @ wiki page with that name. The content of that wiki page
145 @ will be displayed in place of this message.</p>
146 style_finish_page("wiki");
147 }
148
149 /*
150 ** Return true if the given pagename is the name of the sandbox
151 */
@@ -229,10 +231,11 @@
229 ** Show a summary of the Markdown wiki formatting rules.
230 */
231 void markdown_rules_page(void){
232 Blob x;
233 int fTxt = P("txt")!=0;
 
234 style_header("Markdown Formatting Rules");
235 if( fTxt ){
236 style_submenu_element("Formatted", "%R/md_rules");
237 }else{
238 style_submenu_element("Plain-Text", "%R/md_rules?txt=1");
@@ -242,11 +245,11 @@
242 blob_materialize(&x);
243 interwiki_append_map_table(&x);
244 safe_html_context(DOCSRC_TRUSTED);
245 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
246 blob_reset(&x);
247 style_finish_page("wiki");
248 }
249
250 /*
251 ** WEBPAGE: wiki_rules
252 **
@@ -253,10 +256,11 @@
253 ** Show a summary of the wiki formatting rules.
254 */
255 void wiki_rules_page(void){
256 Blob x;
257 int fTxt = P("txt")!=0;
 
258 style_header("Wiki Formatting Rules");
259 if( fTxt ){
260 style_submenu_element("Formatted", "%R/wiki_rules");
261 }else{
262 style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
@@ -266,25 +270,26 @@
266 blob_materialize(&x);
267 interwiki_append_map_table(&x);
268 safe_html_context(DOCSRC_TRUSTED);
269 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
270 blob_reset(&x);
271 style_finish_page("wiki");
272 }
273
274 /*
275 ** WEBPAGE: markup_help
276 **
277 ** Show links to the md_rules and wiki_rules pages.
278 */
279 void markup_help_page(void){
 
280 style_header("Fossil Markup Styles");
281 @ <ul>
282 @ <li><p>%z(href("%R/wiki_rules"))Fossil Wiki Formatting Rules</a></p></li>
283 @ <li><p>%z(href("%R/md_rules"))Markdown Formatting Rules</a></p></li>
284 @ </ul>
285 style_finish_page("wiki");
286 }
287
288 /*
289 ** Returns non-zero if moderation is required for wiki changes and wiki
290 ** attachments.
@@ -344,10 +349,11 @@
344 ** A generic landing page for wiki.
345 */
346 void wiki_helppage(void){
347 login_check_credentials();
348 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
 
349 style_header("Wiki Help");
350 wiki_standard_submenu(W_ALL_BUT(W_HELP));
351 @ <h2>Wiki Links</h2>
352 @ <ul>
353 @ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li>
@@ -369,11 +375,11 @@
369 if( search_restrict(SRCH_WIKI)!=0 ){
370 @ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
371 @ words</li>
372 }
373 @ </ul>
374 style_finish_page("wiki");
375 return;
376 }
377
378 /*
379 ** WEBPAGE: wikisrch
@@ -381,14 +387,15 @@
381 **
382 ** Full-text search of all current wiki text
383 */
384 void wiki_srchpage(void){
385 login_check_credentials();
 
386 style_header("Wiki Search");
387 wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
388 search_screen(SRCH_WIKI, 0);
389 style_finish_page("wiki");
390 }
391
392 /* Return values from wiki_page_type() */
393 #if INTERFACE
394 # define WIKITYPE_UNKNOWN (-1)
@@ -446,10 +453,11 @@
446 static int wiki_page_header(
447 int eType, /* Page type. Might be WIKITYPE_UNKNOWN */
448 const char *zPageName, /* Name of the page */
449 const char *zExtra /* Extra prefix text on the page header */
450 ){
 
451 if( eType==WIKITYPE_UNKNOWN ) eType = wiki_page_type(zPageName);
452 switch( eType ){
453 case WIKITYPE_NORMAL: {
454 style_header("%s%s", zExtra, zPageName);
455 break;
@@ -597,11 +605,11 @@
597 blob_reset(&wiki);
598 }
599 attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
600 manifest_destroy(pWiki);
601 document_emit_js(/*for optional pikchr support*/);
602 style_finish_page("wiki");
603 }
604
605 /*
606 ** Write a wiki artifact into the repository
607 */
@@ -1101,11 +1109,11 @@
1101 ** until the user explicitly saves it). If passed no page name,
1102 ** the user may select a page from the list on the first UI tab.
1103 **
1104 ** When creating a new page, the mimetype URL parameter may optionally
1105 ** be used to set its mimetype to one of text/x-fossil-wiki,
1106 ** text/x-markdown, or text/plain, defauling to the former.
1107 */
1108 void wikiedit_page(void){
1109 const char *zPageName;
1110 const char * zMimetype = P("mimetype");
1111 int isSandbox;
@@ -1138,10 +1146,11 @@
1138 if( !g.perm.RdWiki ){
1139 login_needed(g.anon.RdWiki);
1140 return;
1141 }
1142 }
 
1143 style_header("Wiki Editor");
1144 style_emit_noscript_for_js_page();
1145
1146 /* Status bar */
1147 CX("<div id='fossil-status-bar' "
@@ -1344,11 +1353,11 @@
1344 CX("}catch(e){"
1345 "fossil.error(e); console.error('Exception:',e);"
1346 "}\n");
1347 CX("});\n"/*fossil.onPageLoad()*/);
1348 style_script_end();
1349 style_finish_page("wiki");
1350 }
1351
1352 /*
1353 ** WEBPAGE: wikinew
1354 ** URL /wikinew
@@ -1367,10 +1376,11 @@
1367 zName = PD("name","");
1368 zMimetype = wiki_filter_mimetypes(P("mimetype"));
1369 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
1370 cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
1371 }
 
1372 style_header("Create A New Wiki Page");
1373 wiki_standard_submenu(W_ALL_BUT(W_NEW));
1374 @ <p>Rules for wiki page names:</p>
1375 well_formed_wiki_name_rules();
1376 form_begin(0, "%R/wikinew");
@@ -1382,11 +1392,11 @@
1382 @ </p></form>
1383 if( zName[0] ){
1384 @ <p><span class="wikiError">
1385 @ "%h(zName)" is not a valid wiki page name!</span></p>
1386 }
1387 style_finish_page("wiki");
1388 }
1389
1390
1391 /*
1392 ** Append the wiki text for an remark to the end of the given BLOB.
@@ -1513,10 +1523,11 @@
1513 if( P("cancel")!=0 ){
1514 cgi_redirectf("wiki?name=%T", zPageName);
1515 return;
1516 }
1517 style_set_current_page("%T?name=%T", g.zPath, zPageName);
 
1518 style_header("Append Comment To: %s", zPageName);
1519 if( !goodCaptcha ){
1520 @ <p class="generalError">Error: Incorrect security code.</p>
1521 }
1522 if( P("preview")!=0 ){
@@ -1544,11 +1555,11 @@
1544 @ <input type="submit" name="preview" value="Preview Your Comment" />
1545 @ <input type="submit" name="submit" value="Append Your Changes" />
1546 @ <input type="submit" name="cancel" value="Cancel" />
1547 captcha_generate(0);
1548 @ </form>
1549 style_finish_page("wiki");
1550 }
1551
1552 /*
1553 ** WEBPAGE: whistory
1554 ** URL: /whistory?name=PAGENAME
@@ -1565,10 +1576,11 @@
1565 double rNow;
1566 int showRid;
1567 login_check_credentials();
1568 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1569 zPageName = PD("name","");
 
1570 style_header("History Of %s", zPageName);
1571 showRid = P("showid")!=0;
1572 db_prepare(&q,
1573 "SELECT"
1574 " event.mtime,"
@@ -1634,11 +1646,11 @@
1634 }
1635 @ </tbody></table></div>
1636 db_finalize(&q);
1637 builtin_request_js("fossil.page.whistory.js");
1638 /* style_table_sorter(); */
1639 style_finish_page("wiki");
1640 }
1641
1642 /*
1643 ** WEBPAGE: wdiff
1644 **
@@ -1697,20 +1709,21 @@
1697 }
1698 nextRid = wiki_next(wiki_tagid(pW1->zWikiTitle),pW1->rDate);
1699 if( nextRid ){
1700 style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
1701 }
 
1702 style_header("Changes To %s", pW1->zWikiTitle);
1703 blob_zero(&d);
1704 diffFlags = construct_diff_flags(1);
1705 text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
1706 @ <pre class="udiff">
1707 @ %s(blob_str(&d))
1708 @ <pre>
1709 manifest_destroy(pW1);
1710 manifest_destroy(pW2);
1711 style_finish_page("wiki");
1712 }
1713
1714 /*
1715 ** A query that returns information about all wiki pages.
1716 **
@@ -1753,10 +1766,11 @@
1753 int showAll = P("all")!=0;
1754 int showRid = P("showid")!=0;
1755
1756 login_check_credentials();
1757 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
 
1758 style_header("Available Wiki Pages");
1759 if( showAll ){
1760 style_submenu_element("Active", "%R/wcontent");
1761 }else{
1762 style_submenu_element("All", "%R/wcontent?all=1");
@@ -1808,11 +1822,11 @@
1808 fossil_free(zWDisplayName);
1809 }
1810 @ </tbody></table></div>
1811 db_finalize(&q);
1812 style_table_sorter();
1813 style_finish_page("wiki");
1814 }
1815
1816 /*
1817 ** WEBPAGE: wfind
1818 **
@@ -1823,10 +1837,11 @@
1823 Stmt q;
1824 const char *zTitle;
1825 login_check_credentials();
1826 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1827 zTitle = PD("title","*");
 
1828 style_header("Wiki Pages Found");
1829 @ <ul>
1830 db_prepare(&q,
1831 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
1832 " ORDER BY lower(tagname) /*sort*/" ,
@@ -1835,11 +1850,11 @@
1835 const char *zName = db_column_text(&q, 0);
1836 @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
1837 }
1838 db_finalize(&q);
1839 @ </ul>
1840 style_finish_page("wiki");
1841 }
1842
1843 /*
1844 ** Add a new wiki page to the repository. The page name is
1845 ** given by the zPageName parameter. rid must be zero to create
1846
--- src/wiki.c
+++ src/wiki.c
@@ -62,15 +62,16 @@
62 ** Check a wiki name. If it is not well-formed, then issue an error
63 ** and return true. If it is well-formed, return false.
64 */
65 static int check_name(const char *z){
66 if( !wiki_name_is_wellformed((const unsigned char *)z) ){
67 style_set_current_feature("wiki");
68 style_header("Wiki Page Name Error");
69 @ The wiki name "<span class="wikiError">%h(z)</span>" is not well-formed.
70 @ Rules for wiki page names:
71 well_formed_wiki_name_rules();
72 style_finish_page();
73 return 1;
74 }
75 return 0;
76 }
77
@@ -134,18 +135,19 @@
135 cgi_set_parameter_nocopy("name", g.zExtra, 1);
136 g.isHome = 1;
137 wiki_page();
138 return;
139 }
140 style_set_current_feature("wiki");
141 style_header("Home");
142 @ <p>This is a stub home-page for the project.
143 @ To fill in this page, first go to
144 @ %z(href("%R/setup_config"))setup/config</a>
145 @ and establish a "Project Name". Then create a
146 @ wiki page with that name. The content of that wiki page
147 @ will be displayed in place of this message.</p>
148 style_finish_page();
149 }
150
151 /*
152 ** Return true if the given pagename is the name of the sandbox
153 */
@@ -229,10 +231,11 @@
231 ** Show a summary of the Markdown wiki formatting rules.
232 */
233 void markdown_rules_page(void){
234 Blob x;
235 int fTxt = P("txt")!=0;
236 style_set_current_feature("wiki");
237 style_header("Markdown Formatting Rules");
238 if( fTxt ){
239 style_submenu_element("Formatted", "%R/md_rules");
240 }else{
241 style_submenu_element("Plain-Text", "%R/md_rules?txt=1");
@@ -242,11 +245,11 @@
245 blob_materialize(&x);
246 interwiki_append_map_table(&x);
247 safe_html_context(DOCSRC_TRUSTED);
248 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
249 blob_reset(&x);
250 style_finish_page();
251 }
252
253 /*
254 ** WEBPAGE: wiki_rules
255 **
@@ -253,10 +256,11 @@
256 ** Show a summary of the wiki formatting rules.
257 */
258 void wiki_rules_page(void){
259 Blob x;
260 int fTxt = P("txt")!=0;
261 style_set_current_feature("wiki");
262 style_header("Wiki Formatting Rules");
263 if( fTxt ){
264 style_submenu_element("Formatted", "%R/wiki_rules");
265 }else{
266 style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
@@ -266,25 +270,26 @@
270 blob_materialize(&x);
271 interwiki_append_map_table(&x);
272 safe_html_context(DOCSRC_TRUSTED);
273 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
274 blob_reset(&x);
275 style_finish_page();
276 }
277
278 /*
279 ** WEBPAGE: markup_help
280 **
281 ** Show links to the md_rules and wiki_rules pages.
282 */
283 void markup_help_page(void){
284 style_set_current_feature("wiki");
285 style_header("Fossil Markup Styles");
286 @ <ul>
287 @ <li><p>%z(href("%R/wiki_rules"))Fossil Wiki Formatting Rules</a></p></li>
288 @ <li><p>%z(href("%R/md_rules"))Markdown Formatting Rules</a></p></li>
289 @ </ul>
290 style_finish_page();
291 }
292
293 /*
294 ** Returns non-zero if moderation is required for wiki changes and wiki
295 ** attachments.
@@ -344,10 +349,11 @@
349 ** A generic landing page for wiki.
350 */
351 void wiki_helppage(void){
352 login_check_credentials();
353 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
354 style_set_current_feature("wiki");
355 style_header("Wiki Help");
356 wiki_standard_submenu(W_ALL_BUT(W_HELP));
357 @ <h2>Wiki Links</h2>
358 @ <ul>
359 @ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li>
@@ -369,11 +375,11 @@
375 if( search_restrict(SRCH_WIKI)!=0 ){
376 @ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
377 @ words</li>
378 }
379 @ </ul>
380 style_finish_page();
381 return;
382 }
383
384 /*
385 ** WEBPAGE: wikisrch
@@ -381,14 +387,15 @@
387 **
388 ** Full-text search of all current wiki text
389 */
390 void wiki_srchpage(void){
391 login_check_credentials();
392 style_set_current_feature("wiki");
393 style_header("Wiki Search");
394 wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
395 search_screen(SRCH_WIKI, 0);
396 style_finish_page();
397 }
398
399 /* Return values from wiki_page_type() */
400 #if INTERFACE
401 # define WIKITYPE_UNKNOWN (-1)
@@ -446,10 +453,11 @@
453 static int wiki_page_header(
454 int eType, /* Page type. Might be WIKITYPE_UNKNOWN */
455 const char *zPageName, /* Name of the page */
456 const char *zExtra /* Extra prefix text on the page header */
457 ){
458 style_set_current_feature("wiki");
459 if( eType==WIKITYPE_UNKNOWN ) eType = wiki_page_type(zPageName);
460 switch( eType ){
461 case WIKITYPE_NORMAL: {
462 style_header("%s%s", zExtra, zPageName);
463 break;
@@ -597,11 +605,11 @@
605 blob_reset(&wiki);
606 }
607 attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
608 manifest_destroy(pWiki);
609 document_emit_js(/*for optional pikchr support*/);
610 style_finish_page();
611 }
612
613 /*
614 ** Write a wiki artifact into the repository
615 */
@@ -1101,11 +1109,11 @@
1109 ** until the user explicitly saves it). If passed no page name,
1110 ** the user may select a page from the list on the first UI tab.
1111 **
1112 ** When creating a new page, the mimetype URL parameter may optionally
1113 ** be used to set its mimetype to one of text/x-fossil-wiki,
1114 ** text/x-markdown, or text/plain, defaulting to the former.
1115 */
1116 void wikiedit_page(void){
1117 const char *zPageName;
1118 const char * zMimetype = P("mimetype");
1119 int isSandbox;
@@ -1138,10 +1146,11 @@
1146 if( !g.perm.RdWiki ){
1147 login_needed(g.anon.RdWiki);
1148 return;
1149 }
1150 }
1151 style_set_current_feature("wiki");
1152 style_header("Wiki Editor");
1153 style_emit_noscript_for_js_page();
1154
1155 /* Status bar */
1156 CX("<div id='fossil-status-bar' "
@@ -1344,11 +1353,11 @@
1353 CX("}catch(e){"
1354 "fossil.error(e); console.error('Exception:',e);"
1355 "}\n");
1356 CX("});\n"/*fossil.onPageLoad()*/);
1357 style_script_end();
1358 style_finish_page();
1359 }
1360
1361 /*
1362 ** WEBPAGE: wikinew
1363 ** URL /wikinew
@@ -1367,10 +1376,11 @@
1376 zName = PD("name","");
1377 zMimetype = wiki_filter_mimetypes(P("mimetype"));
1378 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
1379 cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
1380 }
1381 style_set_current_feature("wiki");
1382 style_header("Create A New Wiki Page");
1383 wiki_standard_submenu(W_ALL_BUT(W_NEW));
1384 @ <p>Rules for wiki page names:</p>
1385 well_formed_wiki_name_rules();
1386 form_begin(0, "%R/wikinew");
@@ -1382,11 +1392,11 @@
1392 @ </p></form>
1393 if( zName[0] ){
1394 @ <p><span class="wikiError">
1395 @ "%h(zName)" is not a valid wiki page name!</span></p>
1396 }
1397 style_finish_page();
1398 }
1399
1400
1401 /*
1402 ** Append the wiki text for an remark to the end of the given BLOB.
@@ -1513,10 +1523,11 @@
1523 if( P("cancel")!=0 ){
1524 cgi_redirectf("wiki?name=%T", zPageName);
1525 return;
1526 }
1527 style_set_current_page("%T?name=%T", g.zPath, zPageName);
1528 style_set_current_feature("wiki");
1529 style_header("Append Comment To: %s", zPageName);
1530 if( !goodCaptcha ){
1531 @ <p class="generalError">Error: Incorrect security code.</p>
1532 }
1533 if( P("preview")!=0 ){
@@ -1544,11 +1555,11 @@
1555 @ <input type="submit" name="preview" value="Preview Your Comment" />
1556 @ <input type="submit" name="submit" value="Append Your Changes" />
1557 @ <input type="submit" name="cancel" value="Cancel" />
1558 captcha_generate(0);
1559 @ </form>
1560 style_finish_page();
1561 }
1562
1563 /*
1564 ** WEBPAGE: whistory
1565 ** URL: /whistory?name=PAGENAME
@@ -1565,10 +1576,11 @@
1576 double rNow;
1577 int showRid;
1578 login_check_credentials();
1579 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1580 zPageName = PD("name","");
1581 style_set_current_feature("wiki");
1582 style_header("History Of %s", zPageName);
1583 showRid = P("showid")!=0;
1584 db_prepare(&q,
1585 "SELECT"
1586 " event.mtime,"
@@ -1634,11 +1646,11 @@
1646 }
1647 @ </tbody></table></div>
1648 db_finalize(&q);
1649 builtin_request_js("fossil.page.whistory.js");
1650 /* style_table_sorter(); */
1651 style_finish_page();
1652 }
1653
1654 /*
1655 ** WEBPAGE: wdiff
1656 **
@@ -1697,20 +1709,21 @@
1709 }
1710 nextRid = wiki_next(wiki_tagid(pW1->zWikiTitle),pW1->rDate);
1711 if( nextRid ){
1712 style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
1713 }
1714 style_set_current_feature("wiki");
1715 style_header("Changes To %s", pW1->zWikiTitle);
1716 blob_zero(&d);
1717 diffFlags = construct_diff_flags(1);
1718 text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
1719 @ <pre class="udiff">
1720 @ %s(blob_str(&d))
1721 @ <pre>
1722 manifest_destroy(pW1);
1723 manifest_destroy(pW2);
1724 style_finish_page();
1725 }
1726
1727 /*
1728 ** A query that returns information about all wiki pages.
1729 **
@@ -1753,10 +1766,11 @@
1766 int showAll = P("all")!=0;
1767 int showRid = P("showid")!=0;
1768
1769 login_check_credentials();
1770 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1771 style_set_current_feature("wiki");
1772 style_header("Available Wiki Pages");
1773 if( showAll ){
1774 style_submenu_element("Active", "%R/wcontent");
1775 }else{
1776 style_submenu_element("All", "%R/wcontent?all=1");
@@ -1808,11 +1822,11 @@
1822 fossil_free(zWDisplayName);
1823 }
1824 @ </tbody></table></div>
1825 db_finalize(&q);
1826 style_table_sorter();
1827 style_finish_page();
1828 }
1829
1830 /*
1831 ** WEBPAGE: wfind
1832 **
@@ -1823,10 +1837,11 @@
1837 Stmt q;
1838 const char *zTitle;
1839 login_check_credentials();
1840 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1841 zTitle = PD("title","*");
1842 style_set_current_feature("wiki");
1843 style_header("Wiki Pages Found");
1844 @ <ul>
1845 db_prepare(&q,
1846 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
1847 " ORDER BY lower(tagname) /*sort*/" ,
@@ -1835,11 +1850,11 @@
1850 const char *zName = db_column_text(&q, 0);
1851 @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
1852 }
1853 db_finalize(&q);
1854 @ </ul>
1855 style_finish_page();
1856 }
1857
1858 /*
1859 ** Add a new wiki page to the repository. The page name is
1860 ** given by the zPageName parameter. rid must be zero to create
1861
+1 -1
--- src/wiki.wiki
+++ src/wiki.wiki
@@ -32,11 +32,11 @@
3232
character surrounded on both sides by two or more spaces or by a tab.
3333
Or it can be a number and a "." (ex: "5.") surrounded on both sides
3434
by two spaces or a tab.
3535
Only a single level of enumeration list is supported by wiki.
3636
For nested lists or for enumerations that count using letters or
37
- roman numerials, use HTML.
37
+ roman numerals, use HTML.
3838
3939
4. <b>Indented Paragraphs.</b>
4040
Any paragraph that begins with two or more spaces or a tab and which
4141
is not a bullet or enumeration list item is rendered indented.
4242
Only a single level of indentation is supported by wiki.
4343
--- src/wiki.wiki
+++ src/wiki.wiki
@@ -32,11 +32,11 @@
32 character surrounded on both sides by two or more spaces or by a tab.
33 Or it can be a number and a "." (ex: "5.") surrounded on both sides
34 by two spaces or a tab.
35 Only a single level of enumeration list is supported by wiki.
36 For nested lists or for enumerations that count using letters or
37 roman numerials, use HTML.
38
39 4. <b>Indented Paragraphs.</b>
40 Any paragraph that begins with two or more spaces or a tab and which
41 is not a bullet or enumeration list item is rendered indented.
42 Only a single level of indentation is supported by wiki.
43
--- src/wiki.wiki
+++ src/wiki.wiki
@@ -32,11 +32,11 @@
32 character surrounded on both sides by two or more spaces or by a tab.
33 Or it can be a number and a "." (ex: "5.") surrounded on both sides
34 by two spaces or a tab.
35 Only a single level of enumeration list is supported by wiki.
36 For nested lists or for enumerations that count using letters or
37 roman numerals, use HTML.
38
39 4. <b>Indented Paragraphs.</b>
40 Any paragraph that begins with two or more spaces or a tab and which
41 is not a bullet or enumeration list item is rendered indented.
42 Only a single level of indentation is supported by wiki.
43
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -32,10 +32,11 @@
3232
#define WIKI_NOBADLINKS 0x010 /* Ignore broken hyperlinks */
3333
#define WIKI_LINKSONLY 0x020 /* No markup. Only decorate links */
3434
#define WIKI_NEWLINE 0x040 /* Honor \n - break lines at each \n */
3535
#define WIKI_MARKDOWNLINKS 0x080 /* Resolve hyperlinks as in markdown */
3636
#define WIKI_SAFE 0x100 /* Make the result safe for embedding */
37
+#define WIKI_TARGET_BLANK 0x200 /* Hyperlinks go to a new window */
3738
#endif
3839
3940
4041
/*
4142
** These are the only markup attributes allowed.
@@ -1256,10 +1257,13 @@
12561257
const char *zExtraNS = 0;
12571258
char *zRemote = 0;
12581259
12591260
if( zTitle ){
12601261
zExtra = mprintf(" title='%h'", zTitle);
1262
+ zExtraNS = zExtra+1;
1263
+ }else if( mFlags & WIKI_TARGET_BLANK ){
1264
+ zExtra = mprintf(" target='_blank'");
12611265
zExtraNS = zExtra+1;
12621266
}
12631267
assert( nClose>=20 );
12641268
if( strncmp(zTarget, "http:", 5)==0
12651269
|| strncmp(zTarget, "https:", 6)==0
12661270
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -32,10 +32,11 @@
32 #define WIKI_NOBADLINKS 0x010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x080 /* Resolve hyperlinks as in markdown */
36 #define WIKI_SAFE 0x100 /* Make the result safe for embedding */
 
37 #endif
38
39
40 /*
41 ** These are the only markup attributes allowed.
@@ -1256,10 +1257,13 @@
1256 const char *zExtraNS = 0;
1257 char *zRemote = 0;
1258
1259 if( zTitle ){
1260 zExtra = mprintf(" title='%h'", zTitle);
 
 
 
1261 zExtraNS = zExtra+1;
1262 }
1263 assert( nClose>=20 );
1264 if( strncmp(zTarget, "http:", 5)==0
1265 || strncmp(zTarget, "https:", 6)==0
1266
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -32,10 +32,11 @@
32 #define WIKI_NOBADLINKS 0x010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x080 /* Resolve hyperlinks as in markdown */
36 #define WIKI_SAFE 0x100 /* Make the result safe for embedding */
37 #define WIKI_TARGET_BLANK 0x200 /* Hyperlinks go to a new window */
38 #endif
39
40
41 /*
42 ** These are the only markup attributes allowed.
@@ -1256,10 +1257,13 @@
1257 const char *zExtraNS = 0;
1258 char *zRemote = 0;
1259
1260 if( zTitle ){
1261 zExtra = mprintf(" title='%h'", zTitle);
1262 zExtraNS = zExtra+1;
1263 }else if( mFlags & WIKI_TARGET_BLANK ){
1264 zExtra = mprintf(" target='_blank'");
1265 zExtraNS = zExtra+1;
1266 }
1267 assert( nClose>=20 );
1268 if( strncmp(zTarget, "http:", 5)==0
1269 || strncmp(zTarget, "https:", 6)==0
1270
+3 -2
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -85,11 +85,11 @@
8585
client_sync(syncFlags, 0, 0, 0);
8686
@ </pre>
8787
}
8888
}
8989
90
- style_finish_page("xfersetup");
90
+ style_finish_page();
9191
}
9292
9393
/*
9494
** Common implementation for the transfer setup editor pages.
9595
*/
@@ -116,10 +116,11 @@
116116
isSubmit = P("submit")!=0;
117117
z = P("x");
118118
if( z==0 ){
119119
z = db_get(zDbField, zDfltValue);
120120
}
121
+ style_set_current_feature("xfersetup");
121122
style_header("Edit %s", zTitle);
122123
if( P("clear")!=0 ){
123124
login_verify_csrf_secret();
124125
db_unset(zDbField, 0);
125126
if( xRebuild ) xRebuild();
@@ -150,11 +151,11 @@
150151
@ <h2>Default %s(zTitle)</h2>
151152
@ <blockquote><pre>
152153
@ %h(zDfltValue)
153154
@ </pre></blockquote>
154155
}
155
- style_finish_page("xfersetup");
156
+ style_finish_page();
156157
}
157158
158159
static const char *zDefaultXferCommon = 0;
159160
160161
/*
161162
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -85,11 +85,11 @@
85 client_sync(syncFlags, 0, 0, 0);
86 @ </pre>
87 }
88 }
89
90 style_finish_page("xfersetup");
91 }
92
93 /*
94 ** Common implementation for the transfer setup editor pages.
95 */
@@ -116,10 +116,11 @@
116 isSubmit = P("submit")!=0;
117 z = P("x");
118 if( z==0 ){
119 z = db_get(zDbField, zDfltValue);
120 }
 
121 style_header("Edit %s", zTitle);
122 if( P("clear")!=0 ){
123 login_verify_csrf_secret();
124 db_unset(zDbField, 0);
125 if( xRebuild ) xRebuild();
@@ -150,11 +151,11 @@
150 @ <h2>Default %s(zTitle)</h2>
151 @ <blockquote><pre>
152 @ %h(zDfltValue)
153 @ </pre></blockquote>
154 }
155 style_finish_page("xfersetup");
156 }
157
158 static const char *zDefaultXferCommon = 0;
159
160 /*
161
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -85,11 +85,11 @@
85 client_sync(syncFlags, 0, 0, 0);
86 @ </pre>
87 }
88 }
89
90 style_finish_page();
91 }
92
93 /*
94 ** Common implementation for the transfer setup editor pages.
95 */
@@ -116,10 +116,11 @@
116 isSubmit = P("submit")!=0;
117 z = P("x");
118 if( z==0 ){
119 z = db_get(zDbField, zDfltValue);
120 }
121 style_set_current_feature("xfersetup");
122 style_header("Edit %s", zTitle);
123 if( P("clear")!=0 ){
124 login_verify_csrf_secret();
125 db_unset(zDbField, 0);
126 if( xRebuild ) xRebuild();
@@ -150,11 +151,11 @@
151 @ <h2>Default %s(zTitle)</h2>
152 @ <blockquote><pre>
153 @ %h(zDfltValue)
154 @ </pre></blockquote>
155 }
156 style_finish_page();
157 }
158
159 static const char *zDefaultXferCommon = 0;
160
161 /*
162
+3 -2
--- src/zip.c
+++ src/zip.c
@@ -944,10 +944,11 @@
944944
if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude);
945945
if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude);
946946
zKey = blob_str(&cacheKey);
947947
etag_check(ETAG_HASH, zKey);
948948
949
+ style_set_current_feature("zip");
949950
if( P("debug")!=0 ){
950951
style_header("%s Archive Generator Debug Screen", zType);
951952
@ zName = "%h(zName)"<br />
952953
@ rid = %d(rid)<br />
953954
if( zInclude ){
@@ -955,11 +956,11 @@
955956
}
956957
if( zExclude ){
957958
@ zExclude = "%h(zExclude)"<br />
958959
}
959960
@ zKey = "%h(zKey)"
960
- style_finish_page("zip");
961
+ style_finish_page();
961962
return;
962963
}
963964
if( referred_from_login() ){
964965
style_header("%s Archive Download", zType);
965966
@ <form action='%R/%s(g.zPath)/%h(zName).%s(g.zPath)'>
@@ -966,11 +967,11 @@
966967
cgi_query_parameters_to_hidden();
967968
@ <p>%s(zType) Archive named <b>%h(zName).%s(g.zPath)</b>
968969
@ holding the content of check-in <b>%h(zRid)</b>:
969970
@ <input type="submit" value="Download" />
970971
@ </form>
971
- style_finish_page("zip");
972
+ style_finish_page();
972973
return;
973974
}
974975
blob_zero(&zip);
975976
if( cache_read(&zip, zKey)==0 ){
976977
zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude);
977978
978979
ADDED tools/chat.tcl
--- src/zip.c
+++ src/zip.c
@@ -944,10 +944,11 @@
944 if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude);
945 if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude);
946 zKey = blob_str(&cacheKey);
947 etag_check(ETAG_HASH, zKey);
948
 
949 if( P("debug")!=0 ){
950 style_header("%s Archive Generator Debug Screen", zType);
951 @ zName = "%h(zName)"<br />
952 @ rid = %d(rid)<br />
953 if( zInclude ){
@@ -955,11 +956,11 @@
955 }
956 if( zExclude ){
957 @ zExclude = "%h(zExclude)"<br />
958 }
959 @ zKey = "%h(zKey)"
960 style_finish_page("zip");
961 return;
962 }
963 if( referred_from_login() ){
964 style_header("%s Archive Download", zType);
965 @ <form action='%R/%s(g.zPath)/%h(zName).%s(g.zPath)'>
@@ -966,11 +967,11 @@
966 cgi_query_parameters_to_hidden();
967 @ <p>%s(zType) Archive named <b>%h(zName).%s(g.zPath)</b>
968 @ holding the content of check-in <b>%h(zRid)</b>:
969 @ <input type="submit" value="Download" />
970 @ </form>
971 style_finish_page("zip");
972 return;
973 }
974 blob_zero(&zip);
975 if( cache_read(&zip, zKey)==0 ){
976 zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude);
977
978 DDED tools/chat.tcl
--- src/zip.c
+++ src/zip.c
@@ -944,10 +944,11 @@
944 if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude);
945 if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude);
946 zKey = blob_str(&cacheKey);
947 etag_check(ETAG_HASH, zKey);
948
949 style_set_current_feature("zip");
950 if( P("debug")!=0 ){
951 style_header("%s Archive Generator Debug Screen", zType);
952 @ zName = "%h(zName)"<br />
953 @ rid = %d(rid)<br />
954 if( zInclude ){
@@ -955,11 +956,11 @@
956 }
957 if( zExclude ){
958 @ zExclude = "%h(zExclude)"<br />
959 }
960 @ zKey = "%h(zKey)"
961 style_finish_page();
962 return;
963 }
964 if( referred_from_login() ){
965 style_header("%s Archive Download", zType);
966 @ <form action='%R/%s(g.zPath)/%h(zName).%s(g.zPath)'>
@@ -966,11 +967,11 @@
967 cgi_query_parameters_to_hidden();
968 @ <p>%s(zType) Archive named <b>%h(zName).%s(g.zPath)</b>
969 @ holding the content of check-in <b>%h(zRid)</b>:
970 @ <input type="submit" value="Download" />
971 @ </form>
972 style_finish_page();
973 return;
974 }
975 blob_zero(&zip);
976 if( cache_read(&zip, zKey)==0 ){
977 zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude);
978
979 DDED tools/chat.tcl
--- a/tools/chat.tcl
+++ b/tools/chat.tcl
@@ -0,0 +1,509 @@
1
+#!/usr/bin/wapptclsh
2
+#
3
+# A chat program designed to run using the extcgi mechanism of Fossil.
4
+#
5
+encoding system utf-8
6
+
7
+# The name of the chat database file
8
+#
9
+proc chat-db-name {} {
10
+ set x [wapp-param SCRIPT_FILENAME]
11
+ set dir [file dir $x]
12
+ set fn [file tail $x]
13
+ return $dir/-$fn.db
14
+}
15
+
16
+# Verify permission to use chat. Return true if not authorized.
17
+# Return false if the Fossil user is allowed to access chat.
18
+#
19
+proc not-authorized {} {
20
+ set cap [wapp-param FOSSIL_CAPABILITIES]
21
+ return [expr {![string match *i* $cap]}]
22
+}
23
+
24
+# The default page.
25
+# Load the initial chat screen.
26
+#
27
+proc wapp-default {} {
28
+ wapp-content-security-policy off
29
+ wapp-trim {
30
+ <div class="fossil-doc" data-title="Chat">
31
+ }
32
+ if {[not-authorized]} {
33
+ wapp-trim {
34
+ <h1>Not authorized</h1>
35
+ <p>You must have privileges to use this chatroom</p>
36
+ </div>
37
+ }
38
+ return
39
+ }
40
+ set scriptFile [wapp-param SCRIPT_FILENAME]
41
+ set cgiFn [file tail $scriptFile]
42
+ wapp-trim {
43
+ <form accept-encoding="utf-8" id="chat-form">
44
+ <div id='chat-input-area'>
45
+ <div id='chat-input-line'>
46
+ <input type="text" name="msg" id="sbox" placeholder="Type message here.">
47
+ <input type="submit" value="Send">
48
+ </div>
49
+ <div id='chat-input-file'>
50
+ <span>File:</span>
51
+ <input type="file" name="file">
52
+ </div>
53
+ </div>
54
+ </form>
55
+ <hr>
56
+ <span id='message-inject-point'><!--
57
+ new chat messages get inserted immediately after this element
58
+ --></span>
59
+
60
+ </div><!-- .fossil-doc -->
61
+ <hr>
62
+ <p>
63
+ <a href="%string($cgiFn)/env">CGI environment</a> |
64
+ <a href="%string($cgiFn)/self">Wapp script</a>
65
+ <style>
66
+\#dialog {
67
+ width: 97%;
68
+}
69
+\#chat-input-area {
70
+ width: 100%;
71
+ display: flex;
72
+ flex-direction: column;
73
+}
74
+\#chat-input-line {
75
+ display: flex;
76
+ flex-direction: row;
77
+ margin-bottom: 1em;
78
+ align-items: center;
79
+}
80
+\#chat-input-line > input[type=submit] {
81
+ flex: 1 5 auto;
82
+ max-width: 6em;
83
+}
84
+\#chat-input-line > input[type=text] {
85
+ flex: 5 1 auto;
86
+}
87
+\#chat-input-file {
88
+ display: flex;
89
+ flex-direction: row;
90
+ align-items: center;
91
+}
92
+\#chat-input-file > input {
93
+ flex: 1 0 auto;
94
+}
95
+span.at-name { /* for @USERNAME references */
96
+ text-decoration: underline;
97
+ font-weight: bold;
98
+}
99
+/* A wrapper for a single single message (one row of the UI) */
100
+.message-row {
101
+ margin-bottom: 0.5em;
102
+ border: none;
103
+ display: flex;
104
+ flex-direction: row;
105
+ justify-content: flex-start;
106
+ /*border: 1px solid rgba(0,0,0,0.2);
107
+ border-radius: 0.25em;
108
+ box-shadow: 0.2em 0.2em 0.2em rgba(0, 0, 0, 0.29);*/
109
+ border: none;
110
+}
111
+/* Rows for the current user have the .user-is-me CSS class
112
+ and get right-aligned. */
113
+.message-row.user-is-me {
114
+ justify-content: flex-end;
115
+ /*background-color: #d2dde1;*/
116
+}
117
+/* The content area of a message (the body element of a FIELDSET) */
118
+.message-content {
119
+ display: inline-block;
120
+ border-radius: 0.25em;
121
+ border: 1px solid rgba(0,0,0,0.2);
122
+ box-shadow: 0.2em 0.2em 0.2em rgba(0, 0, 0, 0.29);
123
+ padding: 0.25em 1em;
124
+ margin-top: -0.75em;
125
+}
126
+.message-row.user-is-me .message-content {
127
+ background-color: #d2dde1;
128
+}
129
+/* User name for the post (a LEGEND element) */
130
+.message-row .message-user {
131
+ background: inherit;
132
+ border-radius: 0.25em 0.25em 0 0;
133
+ padding: 0 0.5em;
134
+ /*text-align: left; Firefox requires the 'align' attribute */
135
+ margin-left: 0.25em;
136
+ padding: 0 0.5em 0em 0.5em;
137
+ margin-bottom: 0.4em;
138
+ background-color: #d2dde1;
139
+}
140
+/* Reposition "my" posts to the right */
141
+.message-row.user-is-me .message-user {
142
+ /*text-align: right; Firefox requires the 'align' attribute */
143
+ margin-left: 0;
144
+ margin-right: 0.25em;
145
+}
146
+</style>
147
+ }
148
+ set nonce [wapp-param FOSSIL_NONCE]
149
+ set submiturl [wapp-param SCRIPT_NAME]/send
150
+ set pollurl [wapp-param SCRIPT_NAME]/poll
151
+ set downloadurl [wapp-param SCRIPT_NAME]/download
152
+ set me [wapp-param FOSSIL_USER]
153
+ wapp-trim {
154
+<script nonce="%string($nonce)">
155
+(function(){
156
+ const form = document.querySelector('#chat-form');
157
+ let mxMsg = 0;
158
+ let _me = "%string($me)";
159
+ form.addEventListener('submit',(e)=>{
160
+ e.preventDefault();
161
+ if( form.msg.value.length>0 || form.file.value.length>0 ){
162
+ fetch("%string($submiturl)",{
163
+ method: 'POST',
164
+ body: new FormData(form)
165
+ });
166
+ }
167
+ form.msg.value = "";
168
+ form.file.value = "";
169
+ form.msg.focus();
170
+ });
171
+ const rxUrl = /\\b(?:https?|ftp):\\/\\/\[a-z0-9-+&@\#\\/%?=~_|!:,.;]*\[a-z0-9-+&@\#\\/%=~_|]/gim;
172
+ const rxAtName = /@\\w+/gmi;
173
+ // ^^^ achtung, extra backslashes needed for the outer TCL.
174
+ const textNode = (T)=>document.createTextNode(T);
175
+
176
+ // Converts a message string to a message-containing DOM element
177
+ // and returns that element, which may contain child elements.
178
+ // If 2nd arg is passed, it must be a DOM element to which all
179
+ // child elements are appended.
180
+ const messageToDOM = function f(str, tgtElem){
181
+ "use strict";
182
+ if(!f.rxUrl){
183
+ f.rxUrl = rxUrl;
184
+ f.rxAt = rxAtName;
185
+ f.rxNS = /\\S/;
186
+ f.ce = (T)=>document.createElement(T);
187
+ f.ct = (T)=>document.createTextNode(T);
188
+ f.replaceUrls = function ff(sub, offset, whole){
189
+ if(offset > ff.prevStart){
190
+ f.accum.push((ff.prevStart?' ':'')+whole.substring(ff.prevStart, offset-1)+' ');
191
+ }
192
+ const a = f.ce('a');
193
+ a.setAttribute('href',sub);
194
+ a.setAttribute('target','_blank');
195
+ a.appendChild(f.ct(sub));
196
+ f.accum.push(a);
197
+ ff.prevStart = offset + sub.length + 1;
198
+ };
199
+ f.replaceAtName = function ff(sub, offset,whole){
200
+ if(offset > ff.prevStart){
201
+ ff.accum.push((ff.prevStart?' ':'')+whole.substring(ff.prevStart, offset-1)+' ');
202
+ }else if(offset && f.rxNS.test(whole[offset-1])){
203
+ // Sigh: https://stackoverflow.com/questions/52655367
204
+ ff.accum.push(sub);
205
+ return;
206
+ }
207
+ const e = f.ce('span');
208
+ e.classList.add('at-name');
209
+ e.appendChild(f.ct(sub));
210
+ ff.accum.push(e);
211
+ ff.prevStart = offset + sub.length + 1;
212
+ };
213
+ }
214
+ f.accum = []; // accumulate strings and DOM elements here.
215
+ f.rxUrl.lastIndex = f.replaceUrls.prevStart = 0; // reset regex cursor
216
+ str.replace(f.rxUrl, f.replaceUrls);
217
+ // Push remaining non-URL part of the string to the queue...
218
+ if(f.replaceUrls.prevStart < str.length){
219
+ f.accum.push((f.replaceUrls.prevStart?' ':'')+str.substring(f.replaceUrls.prevStart));
220
+ }
221
+ // Pass 2: process @NAME references...
222
+ // TODO: only match NAME if it's the name of a currently participating
223
+ // user. Add a second class if NAME == current user, and style that one
224
+ // differently so that people can more easily see when they're spoken to.
225
+ const accum2 = f.replaceAtName.accum = [];
226
+ //console.debug("f.accum =",f.accum);
227
+ f.accum.forEach(function(v){
228
+ //console.debug("v =",v);
229
+ if('string'===typeof v){
230
+ f.rxAt.lastIndex = f.replaceAtName.prevStart = 0;
231
+ v.replace(f.rxAt, f.replaceAtName);
232
+ if(f.replaceAtName.prevStart < v.length){
233
+ accum2.push((f.replaceAtName.prevStart?' ':'')+v.substring(f.replaceAtName.prevStart));
234
+ }
235
+ }else{
236
+ accum2.push(v);
237
+ }
238
+ //console.debug("accum2 =",accum2);
239
+ });
240
+ delete f.accum;
241
+ //console.debug("accum2 =",accum2);
242
+ const span = tgtElem || f.ce('span');
243
+ accum2.forEach(function(e){
244
+ if('string'===typeof e) e = f.ct(e);
245
+ span.appendChild(e);
246
+ });
247
+ //console.debug("span =",span.innerHTML);
248
+ return span;
249
+ }/*end messageToDOM()*/;
250
+ /* Injects element e as a new row in the chat, at the top of the list */
251
+ const injectMessage = function f(e){
252
+ if(!f.injectPoint){
253
+ f.injectPoint = document.querySelector('#message-inject-point');
254
+ }
255
+ if(f.injectPoint.nextSibling){
256
+ f.injectPoint.parentNode.insertBefore(e, f.injectPoint.nextSibling);
257
+ }else{
258
+ f.injectPoint.parentNode.appendChild(e);
259
+ }
260
+ };
261
+ /** Returns the local time string of Date object d, defaulting
262
+ to the current time. */
263
+ const localTimeString = function ff(d){
264
+ if(!ff.pad){
265
+ ff.pad = (x)=>(''+x).length>1 ? x : '0'+x;
266
+ }
267
+ d || (d = new Date());
268
+ return [
269
+ d.getFullYear(),'-',ff.pad(d.getMonth()+1/*sigh*/),
270
+ '-',ff.pad(d.getDate()),
271
+ ' ',ff.pad(d.getHours()),':',ff.pad(d.getMinutes()),
272
+ ':',ff.pad(d.getSeconds())
273
+ ].join('');
274
+ };
275
+ function newcontent(jx){
276
+ var i;
277
+ for(i=0; i<jx.msgs.length; ++i){
278
+ let m = jx.msgs[i];
279
+ let row = document.createElement("fieldset");
280
+ if( m.msgid>mxMsg ) mxMsg = m.msgid;
281
+ row.classList.add('message-row');
282
+ injectMessage(row);
283
+ const eWho = document.createElement('legend');
284
+ eWho.setAttribute('align', (m.xfrom===_me ? 'right' : 'left'));
285
+ row.appendChild(eWho);
286
+ eWho.classList.add('message-user');
287
+ let whoName;
288
+ if( m.xfrom===_me ){
289
+ whoName = 'me';
290
+ row.classList.add('user-is-me');
291
+ }else{
292
+ whoName = m.xfrom;
293
+ }
294
+ eWho.append(textNode(
295
+ whoName+' @ '+
296
+ localTimeString(new Date(Date.parse(m.mtime+".000Z"))))
297
+ );
298
+ let span = document.createElement("div");
299
+ span.classList.add('message-content');
300
+ row.appendChild(span);
301
+ if( m.fsize>0 ){
302
+ if( m.fmime && m.fmime.startsWith("image/") ){
303
+ let img = document.createElement("img");
304
+ img.src = "%string($downloadurl)/" + m.msgid;
305
+ span.appendChild(img);
306
+ }else{
307
+ let a = document.createElement("a");
308
+ let txt = "(" + m.fname + " " + m.fsize + " bytes)";
309
+ a.href = "%string($downloadurl)/" + m.msgid;
310
+ a.appendChild(document.createTextNode(txt));
311
+ span.appendChild(a);
312
+ }
313
+ let br = document.createElement("br");
314
+ br.style.clear = "both";
315
+ span.appendChild(br);
316
+ }
317
+ if(m.xmsg){
318
+ messageToDOM(m.xmsg, span);
319
+ }
320
+ span.classList.add('chat-message');
321
+ if( m.xfrom!=_me ){
322
+ span.classList.add('chat-mx');
323
+ }else{
324
+ span.classList.add('chat-ms');
325
+ }
326
+ }
327
+ }
328
+ async function poll(){
329
+ if(poll.running) return;
330
+ poll.running = true;
331
+ fetch("%string($pollurl)/" + mxMsg)
332
+ .then(x=>x.json())
333
+ .then(y=>newcontent(y))
334
+ .finally(()=>poll.running=false)
335
+ }
336
+ setInterval(poll, 1000);
337
+})();</script>
338
+ }
339
+
340
+ # Make sure the chat database exists
341
+ sqlite3 db [chat-db-name]
342
+ if {[db one {PRAGMA journal_mode}]!="wal"} {
343
+ db eval {PRAGMA journal_mode=WAL}
344
+ }
345
+ db eval {
346
+ CREATE TABLE IF NOT EXISTS chat(
347
+ msgid INTEGER PRIMARY KEY AUTOINCREMENT,
348
+ mtime JULIANDAY,
349
+ xfrom TEXT,
350
+ xto TEXT,
351
+ xmsg TEXT,
352
+ file BLOB,
353
+ fname TEXT,
354
+ fmime TEXT
355
+ );
356
+ CREATE TABLE IF NOT EXISTS ustat(
357
+ uname TEXT PRIMARY KEY,
358
+ mtime JULIANDAY, -- Last interaction
359
+ seen INT, -- Last message seen
360
+ logout JULIANDAY
361
+ ) WITHOUT ROWID;
362
+ }
363
+ db close
364
+}
365
+
366
+# Show the CGI environment. Used for testing only.
367
+#
368
+proc wapp-page-env {} {
369
+ wapp-trim {
370
+ <div class="fossil-doc" data-title="Chat CGI Environment">
371
+ <pre>%html([wapp-debug-env])</pre>
372
+ </div>
373
+ }
374
+}
375
+
376
+# Log the CGI environment into the "-logfile.txt" file in the same
377
+# directory as the script. Used for testing and development only.
378
+#
379
+proc logenv {} {
380
+ set fn [file dir [wapp-param SCRIPT_FILENAME]]/-logfile.txt
381
+ set out [open $fn a]
382
+ puts $out {************************************************************}
383
+ puts $out [wapp-debug-env]
384
+ close $out
385
+}
386
+
387
+# A no-op page. Used for testing and development only.
388
+#
389
+proc noop-page {} {
390
+ wapp-trim {
391
+ <div class="fossil-doc" data-title="No-op"><h1>No-Op</h1></div>
392
+ }
393
+}
394
+
395
+# Accept a new post via XHR.
396
+# No reply expected.
397
+#
398
+proc wapp-page-send {} {
399
+ if {[not-authorized]} return
400
+ set user [wapp-param FOSSIL_USER]
401
+ set fcontent [wapp-param file.content]
402
+ set fname [wapp-param file.filename]
403
+ set fmime [wapp-param file.mimetype]
404
+ set msg [wapp-param msg]
405
+ sqlite3 db [chat-db-name]
406
+ db eval BEGIN
407
+ if {$fcontent!=""} {
408
+ db eval {
409
+ INSERT INTO chat(mtime,xfrom,xmsg,file,fname,fmime)
410
+ VALUES(julianday('now'),$user,@msg,@fcontent,$fname,$fmime)
411
+ }
412
+ } else {
413
+ db eval {
414
+ INSERT INTO chat(mtime,xfrom,xmsg)
415
+ VALUES(julianday('now'),$user,@msg)
416
+ }
417
+ }
418
+ db eval {
419
+ INSERT INTO ustat(uname,mtime,seen) VALUES($user,julianday('now'),0)
420
+ ON CONFLICT(uname) DO UPDATE set mtime=julianday('now')
421
+ }
422
+ db eval COMMIT
423
+ db close
424
+}
425
+
426
+# Request updates.
427
+# Delay the response until something changes (as this system works
428
+# using the Hanging-GET or Long-Poll style of server-push).
429
+# The result is javascript describing the new content.
430
+#
431
+# Call is like this: /poll/N
432
+# Where N is the last message received so far. The reply stalls
433
+# until newer messages are available.
434
+#
435
+proc wapp-page-poll {} {
436
+ if {[not-authorized]} return
437
+ wapp-mimetype text/json
438
+ set msglist {}
439
+ sqlite3 db [chat-db-name]
440
+ set id 0
441
+ scan [wapp-param PATH_TAIL] %d id
442
+ while {1} {
443
+ set datavers [db one {PRAGMA data_version}]
444
+ db eval {SELECT msgid, datetime(mtime) AS dx, xfrom, CAST(xmsg AS text) mx,
445
+ length(file) AS lx, fname, fmime
446
+ FROM chat
447
+ WHERE msgid>$id
448
+ ORDER BY msgid} {
449
+ set quname [string map {\" \\\"} $xfrom]
450
+ set qmsg [string map {\" \\\"} $mx]
451
+ if {$lx==""} {set lx 0}
452
+ set qfname [string map {\" \\\"} $fname]
453
+ lappend msglist "\173\"msgid\":$msgid,\"mtime\":\"$dx\",\
454
+ \"xfrom\":\"$quname\",\
455
+ \"xmsg\":\"$qmsg\",\"fsize\":$lx,\
456
+ \"fname\":\"$qfname\",\"fmime\":\"$fmime\"\175"
457
+ }
458
+ if {[llength $msglist]>0} {
459
+ wapp-unsafe "\173\042msgs\042:\133[join $msglist ,]\135\175"
460
+ db close
461
+ return
462
+ }
463
+ after 2000
464
+ while {[db one {PRAGMA data_version}]==$datavers} {after 2000}
465
+ }
466
+}
467
+
468
+# Show the text of this script.
469
+#
470
+proc wapp-page-self {} {
471
+ wapp-trim {
472
+ <div class="fossil-doc" data-title="Wapp Script for Chat">
473
+ }
474
+ set fd [open [wapp-param SCRIPT_FILENAME] rb]
475
+ set script [read $fd]
476
+ wapp-trim {
477
+ <pre>%html($script)</pre>
478
+ }
479
+ wapp-trim {
480
+ </div>
481
+ }
482
+}
483
+
484
+# Download the file associated with a message.
485
+#
486
+# Call like this: /download/N
487
+# Where N is the message id.
488
+#
489
+proc wapp-page-download {} {
490
+ if {[not-authorized]} {
491
+ wapp-trim {
492
+ <h1>Not authorized</h1>
493
+ <p>You must have privileges to use this chatroom</p>
494
+ </div>
495
+ }
496
+ return
497
+ }
498
+ set id 0
499
+ scan [wapp-param PATH_TAIL] %d id
500
+ sqlite3 db [chat-db-name]
501
+ db eval {SELECT fname, fmime, file FROM chat WHERE msgid=$id} {
502
+ wapp-mimetype $fmime
503
+ wapp $file
504
+ }
505
+ db close
506
+}
507
+
508
+
509
+wapp-start $argv
--- a/tools/chat.tcl
+++ b/tools/chat.tcl
@@ -0,0 +1,509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/chat.tcl
+++ b/tools/chat.tcl
@@ -0,0 +1,509 @@
1 #!/usr/bin/wapptclsh
2 #
3 # A chat program designed to run using the extcgi mechanism of Fossil.
4 #
5 encoding system utf-8
6
7 # The name of the chat database file
8 #
9 proc chat-db-name {} {
10 set x [wapp-param SCRIPT_FILENAME]
11 set dir [file dir $x]
12 set fn [file tail $x]
13 return $dir/-$fn.db
14 }
15
16 # Verify permission to use chat. Return true if not authorized.
17 # Return false if the Fossil user is allowed to access chat.
18 #
19 proc not-authorized {} {
20 set cap [wapp-param FOSSIL_CAPABILITIES]
21 return [expr {![string match *i* $cap]}]
22 }
23
24 # The default page.
25 # Load the initial chat screen.
26 #
27 proc wapp-default {} {
28 wapp-content-security-policy off
29 wapp-trim {
30 <div class="fossil-doc" data-title="Chat">
31 }
32 if {[not-authorized]} {
33 wapp-trim {
34 <h1>Not authorized</h1>
35 <p>You must have privileges to use this chatroom</p>
36 </div>
37 }
38 return
39 }
40 set scriptFile [wapp-param SCRIPT_FILENAME]
41 set cgiFn [file tail $scriptFile]
42 wapp-trim {
43 <form accept-encoding="utf-8" id="chat-form">
44 <div id='chat-input-area'>
45 <div id='chat-input-line'>
46 <input type="text" name="msg" id="sbox" placeholder="Type message here.">
47 <input type="submit" value="Send">
48 </div>
49 <div id='chat-input-file'>
50 <span>File:</span>
51 <input type="file" name="file">
52 </div>
53 </div>
54 </form>
55 <hr>
56 <span id='message-inject-point'><!--
57 new chat messages get inserted immediately after this element
58 --></span>
59
60 </div><!-- .fossil-doc -->
61 <hr>
62 <p>
63 <a href="%string($cgiFn)/env">CGI environment</a> |
64 <a href="%string($cgiFn)/self">Wapp script</a>
65 <style>
66 \#dialog {
67 width: 97%;
68 }
69 \#chat-input-area {
70 width: 100%;
71 display: flex;
72 flex-direction: column;
73 }
74 \#chat-input-line {
75 display: flex;
76 flex-direction: row;
77 margin-bottom: 1em;
78 align-items: center;
79 }
80 \#chat-input-line > input[type=submit] {
81 flex: 1 5 auto;
82 max-width: 6em;
83 }
84 \#chat-input-line > input[type=text] {
85 flex: 5 1 auto;
86 }
87 \#chat-input-file {
88 display: flex;
89 flex-direction: row;
90 align-items: center;
91 }
92 \#chat-input-file > input {
93 flex: 1 0 auto;
94 }
95 span.at-name { /* for @USERNAME references */
96 text-decoration: underline;
97 font-weight: bold;
98 }
99 /* A wrapper for a single single message (one row of the UI) */
100 .message-row {
101 margin-bottom: 0.5em;
102 border: none;
103 display: flex;
104 flex-direction: row;
105 justify-content: flex-start;
106 /*border: 1px solid rgba(0,0,0,0.2);
107 border-radius: 0.25em;
108 box-shadow: 0.2em 0.2em 0.2em rgba(0, 0, 0, 0.29);*/
109 border: none;
110 }
111 /* Rows for the current user have the .user-is-me CSS class
112 and get right-aligned. */
113 .message-row.user-is-me {
114 justify-content: flex-end;
115 /*background-color: #d2dde1;*/
116 }
117 /* The content area of a message (the body element of a FIELDSET) */
118 .message-content {
119 display: inline-block;
120 border-radius: 0.25em;
121 border: 1px solid rgba(0,0,0,0.2);
122 box-shadow: 0.2em 0.2em 0.2em rgba(0, 0, 0, 0.29);
123 padding: 0.25em 1em;
124 margin-top: -0.75em;
125 }
126 .message-row.user-is-me .message-content {
127 background-color: #d2dde1;
128 }
129 /* User name for the post (a LEGEND element) */
130 .message-row .message-user {
131 background: inherit;
132 border-radius: 0.25em 0.25em 0 0;
133 padding: 0 0.5em;
134 /*text-align: left; Firefox requires the 'align' attribute */
135 margin-left: 0.25em;
136 padding: 0 0.5em 0em 0.5em;
137 margin-bottom: 0.4em;
138 background-color: #d2dde1;
139 }
140 /* Reposition "my" posts to the right */
141 .message-row.user-is-me .message-user {
142 /*text-align: right; Firefox requires the 'align' attribute */
143 margin-left: 0;
144 margin-right: 0.25em;
145 }
146 </style>
147 }
148 set nonce [wapp-param FOSSIL_NONCE]
149 set submiturl [wapp-param SCRIPT_NAME]/send
150 set pollurl [wapp-param SCRIPT_NAME]/poll
151 set downloadurl [wapp-param SCRIPT_NAME]/download
152 set me [wapp-param FOSSIL_USER]
153 wapp-trim {
154 <script nonce="%string($nonce)">
155 (function(){
156 const form = document.querySelector('#chat-form');
157 let mxMsg = 0;
158 let _me = "%string($me)";
159 form.addEventListener('submit',(e)=>{
160 e.preventDefault();
161 if( form.msg.value.length>0 || form.file.value.length>0 ){
162 fetch("%string($submiturl)",{
163 method: 'POST',
164 body: new FormData(form)
165 });
166 }
167 form.msg.value = "";
168 form.file.value = "";
169 form.msg.focus();
170 });
171 const rxUrl = /\\b(?:https?|ftp):\\/\\/\[a-z0-9-+&@\#\\/%?=~_|!:,.;]*\[a-z0-9-+&@\#\\/%=~_|]/gim;
172 const rxAtName = /@\\w+/gmi;
173 // ^^^ achtung, extra backslashes needed for the outer TCL.
174 const textNode = (T)=>document.createTextNode(T);
175
176 // Converts a message string to a message-containing DOM element
177 // and returns that element, which may contain child elements.
178 // If 2nd arg is passed, it must be a DOM element to which all
179 // child elements are appended.
180 const messageToDOM = function f(str, tgtElem){
181 "use strict";
182 if(!f.rxUrl){
183 f.rxUrl = rxUrl;
184 f.rxAt = rxAtName;
185 f.rxNS = /\\S/;
186 f.ce = (T)=>document.createElement(T);
187 f.ct = (T)=>document.createTextNode(T);
188 f.replaceUrls = function ff(sub, offset, whole){
189 if(offset > ff.prevStart){
190 f.accum.push((ff.prevStart?' ':'')+whole.substring(ff.prevStart, offset-1)+' ');
191 }
192 const a = f.ce('a');
193 a.setAttribute('href',sub);
194 a.setAttribute('target','_blank');
195 a.appendChild(f.ct(sub));
196 f.accum.push(a);
197 ff.prevStart = offset + sub.length + 1;
198 };
199 f.replaceAtName = function ff(sub, offset,whole){
200 if(offset > ff.prevStart){
201 ff.accum.push((ff.prevStart?' ':'')+whole.substring(ff.prevStart, offset-1)+' ');
202 }else if(offset && f.rxNS.test(whole[offset-1])){
203 // Sigh: https://stackoverflow.com/questions/52655367
204 ff.accum.push(sub);
205 return;
206 }
207 const e = f.ce('span');
208 e.classList.add('at-name');
209 e.appendChild(f.ct(sub));
210 ff.accum.push(e);
211 ff.prevStart = offset + sub.length + 1;
212 };
213 }
214 f.accum = []; // accumulate strings and DOM elements here.
215 f.rxUrl.lastIndex = f.replaceUrls.prevStart = 0; // reset regex cursor
216 str.replace(f.rxUrl, f.replaceUrls);
217 // Push remaining non-URL part of the string to the queue...
218 if(f.replaceUrls.prevStart < str.length){
219 f.accum.push((f.replaceUrls.prevStart?' ':'')+str.substring(f.replaceUrls.prevStart));
220 }
221 // Pass 2: process @NAME references...
222 // TODO: only match NAME if it's the name of a currently participating
223 // user. Add a second class if NAME == current user, and style that one
224 // differently so that people can more easily see when they're spoken to.
225 const accum2 = f.replaceAtName.accum = [];
226 //console.debug("f.accum =",f.accum);
227 f.accum.forEach(function(v){
228 //console.debug("v =",v);
229 if('string'===typeof v){
230 f.rxAt.lastIndex = f.replaceAtName.prevStart = 0;
231 v.replace(f.rxAt, f.replaceAtName);
232 if(f.replaceAtName.prevStart < v.length){
233 accum2.push((f.replaceAtName.prevStart?' ':'')+v.substring(f.replaceAtName.prevStart));
234 }
235 }else{
236 accum2.push(v);
237 }
238 //console.debug("accum2 =",accum2);
239 });
240 delete f.accum;
241 //console.debug("accum2 =",accum2);
242 const span = tgtElem || f.ce('span');
243 accum2.forEach(function(e){
244 if('string'===typeof e) e = f.ct(e);
245 span.appendChild(e);
246 });
247 //console.debug("span =",span.innerHTML);
248 return span;
249 }/*end messageToDOM()*/;
250 /* Injects element e as a new row in the chat, at the top of the list */
251 const injectMessage = function f(e){
252 if(!f.injectPoint){
253 f.injectPoint = document.querySelector('#message-inject-point');
254 }
255 if(f.injectPoint.nextSibling){
256 f.injectPoint.parentNode.insertBefore(e, f.injectPoint.nextSibling);
257 }else{
258 f.injectPoint.parentNode.appendChild(e);
259 }
260 };
261 /** Returns the local time string of Date object d, defaulting
262 to the current time. */
263 const localTimeString = function ff(d){
264 if(!ff.pad){
265 ff.pad = (x)=>(''+x).length>1 ? x : '0'+x;
266 }
267 d || (d = new Date());
268 return [
269 d.getFullYear(),'-',ff.pad(d.getMonth()+1/*sigh*/),
270 '-',ff.pad(d.getDate()),
271 ' ',ff.pad(d.getHours()),':',ff.pad(d.getMinutes()),
272 ':',ff.pad(d.getSeconds())
273 ].join('');
274 };
275 function newcontent(jx){
276 var i;
277 for(i=0; i<jx.msgs.length; ++i){
278 let m = jx.msgs[i];
279 let row = document.createElement("fieldset");
280 if( m.msgid>mxMsg ) mxMsg = m.msgid;
281 row.classList.add('message-row');
282 injectMessage(row);
283 const eWho = document.createElement('legend');
284 eWho.setAttribute('align', (m.xfrom===_me ? 'right' : 'left'));
285 row.appendChild(eWho);
286 eWho.classList.add('message-user');
287 let whoName;
288 if( m.xfrom===_me ){
289 whoName = 'me';
290 row.classList.add('user-is-me');
291 }else{
292 whoName = m.xfrom;
293 }
294 eWho.append(textNode(
295 whoName+' @ '+
296 localTimeString(new Date(Date.parse(m.mtime+".000Z"))))
297 );
298 let span = document.createElement("div");
299 span.classList.add('message-content');
300 row.appendChild(span);
301 if( m.fsize>0 ){
302 if( m.fmime && m.fmime.startsWith("image/") ){
303 let img = document.createElement("img");
304 img.src = "%string($downloadurl)/" + m.msgid;
305 span.appendChild(img);
306 }else{
307 let a = document.createElement("a");
308 let txt = "(" + m.fname + " " + m.fsize + " bytes)";
309 a.href = "%string($downloadurl)/" + m.msgid;
310 a.appendChild(document.createTextNode(txt));
311 span.appendChild(a);
312 }
313 let br = document.createElement("br");
314 br.style.clear = "both";
315 span.appendChild(br);
316 }
317 if(m.xmsg){
318 messageToDOM(m.xmsg, span);
319 }
320 span.classList.add('chat-message');
321 if( m.xfrom!=_me ){
322 span.classList.add('chat-mx');
323 }else{
324 span.classList.add('chat-ms');
325 }
326 }
327 }
328 async function poll(){
329 if(poll.running) return;
330 poll.running = true;
331 fetch("%string($pollurl)/" + mxMsg)
332 .then(x=>x.json())
333 .then(y=>newcontent(y))
334 .finally(()=>poll.running=false)
335 }
336 setInterval(poll, 1000);
337 })();</script>
338 }
339
340 # Make sure the chat database exists
341 sqlite3 db [chat-db-name]
342 if {[db one {PRAGMA journal_mode}]!="wal"} {
343 db eval {PRAGMA journal_mode=WAL}
344 }
345 db eval {
346 CREATE TABLE IF NOT EXISTS chat(
347 msgid INTEGER PRIMARY KEY AUTOINCREMENT,
348 mtime JULIANDAY,
349 xfrom TEXT,
350 xto TEXT,
351 xmsg TEXT,
352 file BLOB,
353 fname TEXT,
354 fmime TEXT
355 );
356 CREATE TABLE IF NOT EXISTS ustat(
357 uname TEXT PRIMARY KEY,
358 mtime JULIANDAY, -- Last interaction
359 seen INT, -- Last message seen
360 logout JULIANDAY
361 ) WITHOUT ROWID;
362 }
363 db close
364 }
365
366 # Show the CGI environment. Used for testing only.
367 #
368 proc wapp-page-env {} {
369 wapp-trim {
370 <div class="fossil-doc" data-title="Chat CGI Environment">
371 <pre>%html([wapp-debug-env])</pre>
372 </div>
373 }
374 }
375
376 # Log the CGI environment into the "-logfile.txt" file in the same
377 # directory as the script. Used for testing and development only.
378 #
379 proc logenv {} {
380 set fn [file dir [wapp-param SCRIPT_FILENAME]]/-logfile.txt
381 set out [open $fn a]
382 puts $out {************************************************************}
383 puts $out [wapp-debug-env]
384 close $out
385 }
386
387 # A no-op page. Used for testing and development only.
388 #
389 proc noop-page {} {
390 wapp-trim {
391 <div class="fossil-doc" data-title="No-op"><h1>No-Op</h1></div>
392 }
393 }
394
395 # Accept a new post via XHR.
396 # No reply expected.
397 #
398 proc wapp-page-send {} {
399 if {[not-authorized]} return
400 set user [wapp-param FOSSIL_USER]
401 set fcontent [wapp-param file.content]
402 set fname [wapp-param file.filename]
403 set fmime [wapp-param file.mimetype]
404 set msg [wapp-param msg]
405 sqlite3 db [chat-db-name]
406 db eval BEGIN
407 if {$fcontent!=""} {
408 db eval {
409 INSERT INTO chat(mtime,xfrom,xmsg,file,fname,fmime)
410 VALUES(julianday('now'),$user,@msg,@fcontent,$fname,$fmime)
411 }
412 } else {
413 db eval {
414 INSERT INTO chat(mtime,xfrom,xmsg)
415 VALUES(julianday('now'),$user,@msg)
416 }
417 }
418 db eval {
419 INSERT INTO ustat(uname,mtime,seen) VALUES($user,julianday('now'),0)
420 ON CONFLICT(uname) DO UPDATE set mtime=julianday('now')
421 }
422 db eval COMMIT
423 db close
424 }
425
426 # Request updates.
427 # Delay the response until something changes (as this system works
428 # using the Hanging-GET or Long-Poll style of server-push).
429 # The result is javascript describing the new content.
430 #
431 # Call is like this: /poll/N
432 # Where N is the last message received so far. The reply stalls
433 # until newer messages are available.
434 #
435 proc wapp-page-poll {} {
436 if {[not-authorized]} return
437 wapp-mimetype text/json
438 set msglist {}
439 sqlite3 db [chat-db-name]
440 set id 0
441 scan [wapp-param PATH_TAIL] %d id
442 while {1} {
443 set datavers [db one {PRAGMA data_version}]
444 db eval {SELECT msgid, datetime(mtime) AS dx, xfrom, CAST(xmsg AS text) mx,
445 length(file) AS lx, fname, fmime
446 FROM chat
447 WHERE msgid>$id
448 ORDER BY msgid} {
449 set quname [string map {\" \\\"} $xfrom]
450 set qmsg [string map {\" \\\"} $mx]
451 if {$lx==""} {set lx 0}
452 set qfname [string map {\" \\\"} $fname]
453 lappend msglist "\173\"msgid\":$msgid,\"mtime\":\"$dx\",\
454 \"xfrom\":\"$quname\",\
455 \"xmsg\":\"$qmsg\",\"fsize\":$lx,\
456 \"fname\":\"$qfname\",\"fmime\":\"$fmime\"\175"
457 }
458 if {[llength $msglist]>0} {
459 wapp-unsafe "\173\042msgs\042:\133[join $msglist ,]\135\175"
460 db close
461 return
462 }
463 after 2000
464 while {[db one {PRAGMA data_version}]==$datavers} {after 2000}
465 }
466 }
467
468 # Show the text of this script.
469 #
470 proc wapp-page-self {} {
471 wapp-trim {
472 <div class="fossil-doc" data-title="Wapp Script for Chat">
473 }
474 set fd [open [wapp-param SCRIPT_FILENAME] rb]
475 set script [read $fd]
476 wapp-trim {
477 <pre>%html($script)</pre>
478 }
479 wapp-trim {
480 </div>
481 }
482 }
483
484 # Download the file associated with a message.
485 #
486 # Call like this: /download/N
487 # Where N is the message id.
488 #
489 proc wapp-page-download {} {
490 if {[not-authorized]} {
491 wapp-trim {
492 <h1>Not authorized</h1>
493 <p>You must have privileges to use this chatroom</p>
494 </div>
495 }
496 return
497 }
498 set id 0
499 scan [wapp-param PATH_TAIL] %d id
500 sqlite3 db [chat-db-name]
501 db eval {SELECT fname, fmime, file FROM chat WHERE msgid=$id} {
502 wapp-mimetype $fmime
503 wapp $file
504 }
505 db close
506 }
507
508
509 wapp-start $argv
--- tools/fossil-stress.tcl
+++ tools/fossil-stress.tcl
@@ -15,11 +15,11 @@
1515
incr i
1616
set nthread [lindex $argv $i]
1717
} elseif {[string index $x 0]=="-"} {
1818
error "unknown option \"$x\""
1919
} elseif {[info exists url]} {
20
- error "unknown argment \"$x\""
20
+ error "unknown argument \"$x\""
2121
} else {
2222
set url $x
2323
}
2424
}
2525
if {![info exists url]} {
2626
--- tools/fossil-stress.tcl
+++ tools/fossil-stress.tcl
@@ -15,11 +15,11 @@
15 incr i
16 set nthread [lindex $argv $i]
17 } elseif {[string index $x 0]=="-"} {
18 error "unknown option \"$x\""
19 } elseif {[info exists url]} {
20 error "unknown argment \"$x\""
21 } else {
22 set url $x
23 }
24 }
25 if {![info exists url]} {
26
--- tools/fossil-stress.tcl
+++ tools/fossil-stress.tcl
@@ -15,11 +15,11 @@
15 incr i
16 set nthread [lindex $argv $i]
17 } elseif {[string index $x 0]=="-"} {
18 error "unknown option \"$x\""
19 } elseif {[info exists url]} {
20 error "unknown argument \"$x\""
21 } else {
22 set url $x
23 }
24 }
25 if {![info exists url]} {
26
+10 -4
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
2828
2929
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_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0
3030
3131
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_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -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
3232
33
-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 checkin_.c checkout_.c clearsign_.c clone_.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 md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pikchr_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.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 webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c zip_.c
33
+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 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 md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pikchr_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.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 webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c zip_.c
3434
35
-OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\interwiki$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pikchr$O $(OBJDIR)\pikchrshow$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
35
+OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\chat$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\interwiki$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pikchr$O $(OBJDIR)\pikchrshow$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
3636
3737
3838
RC=$(DMDIR)\bin\rcc
3939
RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
4040
@@ -49,11 +49,11 @@
4949
5050
$(OBJDIR)\fossil.res: $B\win\fossil.rc
5151
$(RC) $(RCFLAGS) -o$@ $**
5252
5353
$(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54
- +echo add ajax alerts allrepo attach backlink backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export extcgi file fileedit finfo foci forum fshell fusefs fuzz glob graph gzip hname hook http http_socket http_ssl http_transport import info interwiki json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pikchr pikchrshow pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar terminal th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp xfer xfersetup zip shell sqlite3 th th_lang > $@
54
+ +echo add ajax alerts allrepo attach backlink backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi chat checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export extcgi file fileedit finfo foci forum fshell fusefs fuzz glob graph gzip hname hook http http_socket http_ssl http_transport import info interwiki json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pikchr pikchrshow pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar terminal th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp xfer xfersetup zip shell sqlite3 th th_lang > $@
5555
+echo fossil >> $@
5656
+echo fossil >> $@
5757
+echo $(LIBS) >> $@
5858
+echo. >> $@
5959
+echo fossil >> $@
@@ -229,10 +229,16 @@
229229
$(OBJDIR)\cgi$O : cgi_.c cgi.h
230230
$(TCC) -o$@ -c cgi_.c
231231
232232
cgi_.c : $(SRCDIR)\cgi.c
233233
+translate$E $** > $@
234
+
235
+$(OBJDIR)\chat$O : chat_.c chat.h
236
+ $(TCC) -o$@ -c chat_.c
237
+
238
+chat_.c : $(SRCDIR)\chat.c
239
+ +translate$E $** > $@
234240
235241
$(OBJDIR)\checkin$O : checkin_.c checkin.h
236242
$(TCC) -o$@ -c checkin_.c
237243
238244
checkin_.c : $(SRCDIR)\checkin.c
@@ -999,7 +1005,7 @@
9991005
10001006
zip_.c : $(SRCDIR)\zip.c
10011007
+translate$E $** > $@
10021008
10031009
headers: makeheaders$E page_index.h builtin_data.h VERSION.h
1004
- +makeheaders$E add_.c:add.h ajax_.c:ajax.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backlink_.c:backlink.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h extcgi_.c:extcgi.h file_.c:file.h fileedit_.c:fileedit.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h fuzz_.c:fuzz.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h hook_.c:hook.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h interwiki_.c:interwiki.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pikchr_.c:pikchr.h pikchrshow_.c:pikchrshow.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h terminal_.c:terminal.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
1010
+ +makeheaders$E add_.c:add.h ajax_.c:ajax.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backlink_.c:backlink.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h chat_.c:chat.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h extcgi_.c:extcgi.h file_.c:file.h fileedit_.c:fileedit.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h fuzz_.c:fuzz.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h hook_.c:hook.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h interwiki_.c:interwiki.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pikchr_.c:pikchr.h pikchrshow_.c:pikchrshow.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h terminal_.c:terminal.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
10051011
@copy /Y nul: headers
10061012
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
28
29 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_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0
30
31 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_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -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
32
33 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 checkin_.c checkout_.c clearsign_.c clone_.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 md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pikchr_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.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 webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\interwiki$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pikchr$O $(OBJDIR)\pikchrshow$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
38 RC=$(DMDIR)\bin\rcc
39 RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
40
@@ -49,11 +49,11 @@
49
50 $(OBJDIR)\fossil.res: $B\win\fossil.rc
51 $(RC) $(RCFLAGS) -o$@ $**
52
53 $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54 +echo add ajax alerts allrepo attach backlink backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export extcgi file fileedit finfo foci forum fshell fusefs fuzz glob graph gzip hname hook http http_socket http_ssl http_transport import info interwiki json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pikchr pikchrshow pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar terminal th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp xfer xfersetup zip shell sqlite3 th th_lang > $@
55 +echo fossil >> $@
56 +echo fossil >> $@
57 +echo $(LIBS) >> $@
58 +echo. >> $@
59 +echo fossil >> $@
@@ -229,10 +229,16 @@
229 $(OBJDIR)\cgi$O : cgi_.c cgi.h
230 $(TCC) -o$@ -c cgi_.c
231
232 cgi_.c : $(SRCDIR)\cgi.c
233 +translate$E $** > $@
 
 
 
 
 
 
234
235 $(OBJDIR)\checkin$O : checkin_.c checkin.h
236 $(TCC) -o$@ -c checkin_.c
237
238 checkin_.c : $(SRCDIR)\checkin.c
@@ -999,7 +1005,7 @@
999
1000 zip_.c : $(SRCDIR)\zip.c
1001 +translate$E $** > $@
1002
1003 headers: makeheaders$E page_index.h builtin_data.h VERSION.h
1004 +makeheaders$E add_.c:add.h ajax_.c:ajax.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backlink_.c:backlink.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h extcgi_.c:extcgi.h file_.c:file.h fileedit_.c:fileedit.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h fuzz_.c:fuzz.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h hook_.c:hook.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h interwiki_.c:interwiki.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pikchr_.c:pikchr.h pikchrshow_.c:pikchrshow.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h terminal_.c:terminal.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
1005 @copy /Y nul: headers
1006
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
28
29 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_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0
30
31 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_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -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
32
33 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 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 md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pikchr_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.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 webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\chat$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\interwiki$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pikchr$O $(OBJDIR)\pikchrshow$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
38 RC=$(DMDIR)\bin\rcc
39 RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
40
@@ -49,11 +49,11 @@
49
50 $(OBJDIR)\fossil.res: $B\win\fossil.rc
51 $(RC) $(RCFLAGS) -o$@ $**
52
53 $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54 +echo add ajax alerts allrepo attach backlink backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi chat checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export extcgi file fileedit finfo foci forum fshell fusefs fuzz glob graph gzip hname hook http http_socket http_ssl http_transport import info interwiki json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pikchr pikchrshow pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar terminal th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp xfer xfersetup zip shell sqlite3 th th_lang > $@
55 +echo fossil >> $@
56 +echo fossil >> $@
57 +echo $(LIBS) >> $@
58 +echo. >> $@
59 +echo fossil >> $@
@@ -229,10 +229,16 @@
229 $(OBJDIR)\cgi$O : cgi_.c cgi.h
230 $(TCC) -o$@ -c cgi_.c
231
232 cgi_.c : $(SRCDIR)\cgi.c
233 +translate$E $** > $@
234
235 $(OBJDIR)\chat$O : chat_.c chat.h
236 $(TCC) -o$@ -c chat_.c
237
238 chat_.c : $(SRCDIR)\chat.c
239 +translate$E $** > $@
240
241 $(OBJDIR)\checkin$O : checkin_.c checkin.h
242 $(TCC) -o$@ -c checkin_.c
243
244 checkin_.c : $(SRCDIR)\checkin.c
@@ -999,7 +1005,7 @@
1005
1006 zip_.c : $(SRCDIR)\zip.c
1007 +translate$E $** > $@
1008
1009 headers: makeheaders$E page_index.h builtin_data.h VERSION.h
1010 +makeheaders$E add_.c:add.h ajax_.c:ajax.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backlink_.c:backlink.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h chat_.c:chat.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h extcgi_.c:extcgi.h file_.c:file.h fileedit_.c:fileedit.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h fuzz_.c:fuzz.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h hook_.c:hook.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h interwiki_.c:interwiki.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pikchr_.c:pikchr.h pikchrshow_.c:pikchrshow.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h terminal_.c:terminal.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
1011 @copy /Y nul: headers
1012
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -444,10 +444,11 @@
444444
$(SRCDIR)/bundle.c \
445445
$(SRCDIR)/cache.c \
446446
$(SRCDIR)/capabilities.c \
447447
$(SRCDIR)/captcha.c \
448448
$(SRCDIR)/cgi.c \
449
+ $(SRCDIR)/chat.c \
449450
$(SRCDIR)/checkin.c \
450451
$(SRCDIR)/checkout.c \
451452
$(SRCDIR)/clearsign.c \
452453
$(SRCDIR)/clone.c \
453454
$(SRCDIR)/comformat.c \
@@ -631,10 +632,15 @@
631632
$(SRCDIR)/../skins/xekri/css.txt \
632633
$(SRCDIR)/../skins/xekri/details.txt \
633634
$(SRCDIR)/../skins/xekri/footer.txt \
634635
$(SRCDIR)/../skins/xekri/header.txt \
635636
$(SRCDIR)/accordion.js \
637
+ $(SRCDIR)/alerts/bflat2.wav \
638
+ $(SRCDIR)/alerts/bflat3.wav \
639
+ $(SRCDIR)/alerts/bloop.wav \
640
+ $(SRCDIR)/alerts/plunk.wav \
641
+ $(SRCDIR)/chat.js \
636642
$(SRCDIR)/ci_edit.js \
637643
$(SRCDIR)/copybtn.js \
638644
$(SRCDIR)/default.css \
639645
$(SRCDIR)/diff.tcl \
640646
$(SRCDIR)/forum.js \
@@ -702,10 +708,11 @@
702708
$(OBJDIR)/bundle_.c \
703709
$(OBJDIR)/cache_.c \
704710
$(OBJDIR)/capabilities_.c \
705711
$(OBJDIR)/captcha_.c \
706712
$(OBJDIR)/cgi_.c \
713
+ $(OBJDIR)/chat_.c \
707714
$(OBJDIR)/checkin_.c \
708715
$(OBJDIR)/checkout_.c \
709716
$(OBJDIR)/clearsign_.c \
710717
$(OBJDIR)/clone_.c \
711718
$(OBJDIR)/comformat_.c \
@@ -850,10 +857,11 @@
850857
$(OBJDIR)/bundle.o \
851858
$(OBJDIR)/cache.o \
852859
$(OBJDIR)/capabilities.o \
853860
$(OBJDIR)/captcha.o \
854861
$(OBJDIR)/cgi.o \
862
+ $(OBJDIR)/chat.o \
855863
$(OBJDIR)/checkin.o \
856864
$(OBJDIR)/checkout.o \
857865
$(OBJDIR)/clearsign.o \
858866
$(OBJDIR)/clone.o \
859867
$(OBJDIR)/comformat.o \
@@ -1163,13 +1171,13 @@
11631171
11641172
ifdef FOSSIL_BUILD_SSL
11651173
APPTARGETS += openssl
11661174
endif
11671175
1168
-$(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o
1176
+$(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o
11691177
$(CODECHECK1) $(TRANS_SRC)
1170
- $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(LIB)
1178
+ $(TCC) -o $@ $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o $(LIB)
11711179
11721180
# This rule prevents make from using its default rules to try build
11731181
# an executable named "manifest" out of the file named "manifest.c"
11741182
#
11751183
$(SRCDIR)/../manifest:
@@ -1213,10 +1221,11 @@
12131221
$(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
12141222
$(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
12151223
$(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
12161224
$(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
12171225
$(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
1226
+ $(OBJDIR)/chat_.c:$(OBJDIR)/chat.h \
12181227
$(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
12191228
$(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
12201229
$(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
12211230
$(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
12221231
$(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1493,10 +1502,18 @@
14931502
14941503
$(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
14951504
$(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
14961505
14971506
$(OBJDIR)/cgi.h: $(OBJDIR)/headers
1507
+
1508
+$(OBJDIR)/chat_.c: $(SRCDIR)/chat.c $(TRANSLATE)
1509
+ $(TRANSLATE) $(SRCDIR)/chat.c >$@
1510
+
1511
+$(OBJDIR)/chat.o: $(OBJDIR)/chat_.c $(OBJDIR)/chat.h $(SRCDIR)/config.h
1512
+ $(XTCC) -o $(OBJDIR)/chat.o -c $(OBJDIR)/chat_.c
1513
+
1514
+$(OBJDIR)/chat.h: $(OBJDIR)/headers
14981515
14991516
$(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
15001517
$(TRANSLATE) $(SRCDIR)/checkin.c >$@
15011518
15021519
$(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
15031520
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -444,10 +444,11 @@
444 $(SRCDIR)/bundle.c \
445 $(SRCDIR)/cache.c \
446 $(SRCDIR)/capabilities.c \
447 $(SRCDIR)/captcha.c \
448 $(SRCDIR)/cgi.c \
 
449 $(SRCDIR)/checkin.c \
450 $(SRCDIR)/checkout.c \
451 $(SRCDIR)/clearsign.c \
452 $(SRCDIR)/clone.c \
453 $(SRCDIR)/comformat.c \
@@ -631,10 +632,15 @@
631 $(SRCDIR)/../skins/xekri/css.txt \
632 $(SRCDIR)/../skins/xekri/details.txt \
633 $(SRCDIR)/../skins/xekri/footer.txt \
634 $(SRCDIR)/../skins/xekri/header.txt \
635 $(SRCDIR)/accordion.js \
 
 
 
 
 
636 $(SRCDIR)/ci_edit.js \
637 $(SRCDIR)/copybtn.js \
638 $(SRCDIR)/default.css \
639 $(SRCDIR)/diff.tcl \
640 $(SRCDIR)/forum.js \
@@ -702,10 +708,11 @@
702 $(OBJDIR)/bundle_.c \
703 $(OBJDIR)/cache_.c \
704 $(OBJDIR)/capabilities_.c \
705 $(OBJDIR)/captcha_.c \
706 $(OBJDIR)/cgi_.c \
 
707 $(OBJDIR)/checkin_.c \
708 $(OBJDIR)/checkout_.c \
709 $(OBJDIR)/clearsign_.c \
710 $(OBJDIR)/clone_.c \
711 $(OBJDIR)/comformat_.c \
@@ -850,10 +857,11 @@
850 $(OBJDIR)/bundle.o \
851 $(OBJDIR)/cache.o \
852 $(OBJDIR)/capabilities.o \
853 $(OBJDIR)/captcha.o \
854 $(OBJDIR)/cgi.o \
 
855 $(OBJDIR)/checkin.o \
856 $(OBJDIR)/checkout.o \
857 $(OBJDIR)/clearsign.o \
858 $(OBJDIR)/clone.o \
859 $(OBJDIR)/comformat.o \
@@ -1163,13 +1171,13 @@
1163
1164 ifdef FOSSIL_BUILD_SSL
1165 APPTARGETS += openssl
1166 endif
1167
1168 $(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o
1169 $(CODECHECK1) $(TRANS_SRC)
1170 $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(LIB)
1171
1172 # This rule prevents make from using its default rules to try build
1173 # an executable named "manifest" out of the file named "manifest.c"
1174 #
1175 $(SRCDIR)/../manifest:
@@ -1213,10 +1221,11 @@
1213 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
1214 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
1215 $(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
1216 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
1217 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
 
1218 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
1219 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
1220 $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
1221 $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
1222 $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1493,10 +1502,18 @@
1493
1494 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1495 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1496
1497 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1498
1499 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1500 $(TRANSLATE) $(SRCDIR)/checkin.c >$@
1501
1502 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1503
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -444,10 +444,11 @@
444 $(SRCDIR)/bundle.c \
445 $(SRCDIR)/cache.c \
446 $(SRCDIR)/capabilities.c \
447 $(SRCDIR)/captcha.c \
448 $(SRCDIR)/cgi.c \
449 $(SRCDIR)/chat.c \
450 $(SRCDIR)/checkin.c \
451 $(SRCDIR)/checkout.c \
452 $(SRCDIR)/clearsign.c \
453 $(SRCDIR)/clone.c \
454 $(SRCDIR)/comformat.c \
@@ -631,10 +632,15 @@
632 $(SRCDIR)/../skins/xekri/css.txt \
633 $(SRCDIR)/../skins/xekri/details.txt \
634 $(SRCDIR)/../skins/xekri/footer.txt \
635 $(SRCDIR)/../skins/xekri/header.txt \
636 $(SRCDIR)/accordion.js \
637 $(SRCDIR)/alerts/bflat2.wav \
638 $(SRCDIR)/alerts/bflat3.wav \
639 $(SRCDIR)/alerts/bloop.wav \
640 $(SRCDIR)/alerts/plunk.wav \
641 $(SRCDIR)/chat.js \
642 $(SRCDIR)/ci_edit.js \
643 $(SRCDIR)/copybtn.js \
644 $(SRCDIR)/default.css \
645 $(SRCDIR)/diff.tcl \
646 $(SRCDIR)/forum.js \
@@ -702,10 +708,11 @@
708 $(OBJDIR)/bundle_.c \
709 $(OBJDIR)/cache_.c \
710 $(OBJDIR)/capabilities_.c \
711 $(OBJDIR)/captcha_.c \
712 $(OBJDIR)/cgi_.c \
713 $(OBJDIR)/chat_.c \
714 $(OBJDIR)/checkin_.c \
715 $(OBJDIR)/checkout_.c \
716 $(OBJDIR)/clearsign_.c \
717 $(OBJDIR)/clone_.c \
718 $(OBJDIR)/comformat_.c \
@@ -850,10 +857,11 @@
857 $(OBJDIR)/bundle.o \
858 $(OBJDIR)/cache.o \
859 $(OBJDIR)/capabilities.o \
860 $(OBJDIR)/captcha.o \
861 $(OBJDIR)/cgi.o \
862 $(OBJDIR)/chat.o \
863 $(OBJDIR)/checkin.o \
864 $(OBJDIR)/checkout.o \
865 $(OBJDIR)/clearsign.o \
866 $(OBJDIR)/clone.o \
867 $(OBJDIR)/comformat.o \
@@ -1163,13 +1171,13 @@
1171
1172 ifdef FOSSIL_BUILD_SSL
1173 APPTARGETS += openssl
1174 endif
1175
1176 $(APPNAME): $(APPTARGETS) $(OBJDIR)/headers $(CODECHECK1) $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o
1177 $(CODECHECK1) $(TRANS_SRC)
1178 $(TCC) -o $@ $(EXTRAOBJ) $(OBJ) $(OBJDIR)/fossil.o $(LIB)
1179
1180 # This rule prevents make from using its default rules to try build
1181 # an executable named "manifest" out of the file named "manifest.c"
1182 #
1183 $(SRCDIR)/../manifest:
@@ -1213,10 +1221,11 @@
1221 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
1222 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
1223 $(OBJDIR)/capabilities_.c:$(OBJDIR)/capabilities.h \
1224 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
1225 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
1226 $(OBJDIR)/chat_.c:$(OBJDIR)/chat.h \
1227 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
1228 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
1229 $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h \
1230 $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h \
1231 $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \
@@ -1493,10 +1502,18 @@
1502
1503 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1504 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1505
1506 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
1507
1508 $(OBJDIR)/chat_.c: $(SRCDIR)/chat.c $(TRANSLATE)
1509 $(TRANSLATE) $(SRCDIR)/chat.c >$@
1510
1511 $(OBJDIR)/chat.o: $(OBJDIR)/chat_.c $(OBJDIR)/chat.h $(SRCDIR)/config.h
1512 $(XTCC) -o $(OBJDIR)/chat.o -c $(OBJDIR)/chat_.c
1513
1514 $(OBJDIR)/chat.h: $(OBJDIR)/headers
1515
1516 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1517 $(TRANSLATE) $(SRCDIR)/checkin.c >$@
1518
1519 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1520
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -366,10 +366,11 @@
366366
"$(OX)\bundle_.c" \
367367
"$(OX)\cache_.c" \
368368
"$(OX)\capabilities_.c" \
369369
"$(OX)\captcha_.c" \
370370
"$(OX)\cgi_.c" \
371
+ "$(OX)\chat_.c" \
371372
"$(OX)\checkin_.c" \
372373
"$(OX)\checkout_.c" \
373374
"$(OX)\clearsign_.c" \
374375
"$(OX)\clone_.c" \
375376
"$(OX)\comformat_.c" \
@@ -552,10 +553,15 @@
552553
"$(SRCDIR)\..\skins\xekri\css.txt" \
553554
"$(SRCDIR)\..\skins\xekri\details.txt" \
554555
"$(SRCDIR)\..\skins\xekri\footer.txt" \
555556
"$(SRCDIR)\..\skins\xekri\header.txt" \
556557
"$(SRCDIR)\accordion.js" \
558
+ "$(SRCDIR)\alerts\bflat2.wav" \
559
+ "$(SRCDIR)\alerts\bflat3.wav" \
560
+ "$(SRCDIR)\alerts\bloop.wav" \
561
+ "$(SRCDIR)\alerts\plunk.wav" \
562
+ "$(SRCDIR)\chat.js" \
557563
"$(SRCDIR)\ci_edit.js" \
558564
"$(SRCDIR)\copybtn.js" \
559565
"$(SRCDIR)\default.css" \
560566
"$(SRCDIR)\diff.tcl" \
561567
"$(SRCDIR)\forum.js" \
@@ -622,10 +628,11 @@
622628
"$(OX)\bundle$O" \
623629
"$(OX)\cache$O" \
624630
"$(OX)\capabilities$O" \
625631
"$(OX)\captcha$O" \
626632
"$(OX)\cgi$O" \
633
+ "$(OX)\chat$O" \
627634
"$(OX)\checkin$O" \
628635
"$(OX)\checkout$O" \
629636
"$(OX)\clearsign$O" \
630637
"$(OX)\clone$O" \
631638
"$(OX)\comformat$O" \
@@ -851,10 +858,11 @@
851858
echo "$(OX)\bundle.obj" >> $@
852859
echo "$(OX)\cache.obj" >> $@
853860
echo "$(OX)\capabilities.obj" >> $@
854861
echo "$(OX)\captcha.obj" >> $@
855862
echo "$(OX)\cgi.obj" >> $@
863
+ echo "$(OX)\chat.obj" >> $@
856864
echo "$(OX)\checkin.obj" >> $@
857865
echo "$(OX)\checkout.obj" >> $@
858866
echo "$(OX)\clearsign.obj" >> $@
859867
echo "$(OX)\clone.obj" >> $@
860868
echo "$(OX)\comformat.obj" >> $@
@@ -1158,10 +1166,15 @@
11581166
echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@
11591167
echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@
11601168
echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@
11611169
echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@
11621170
echo "$(SRCDIR)\accordion.js" >> $@
1171
+ echo "$(SRCDIR)\alerts/bflat2.wav" >> $@
1172
+ echo "$(SRCDIR)\alerts/bflat3.wav" >> $@
1173
+ echo "$(SRCDIR)\alerts/bloop.wav" >> $@
1174
+ echo "$(SRCDIR)\alerts/plunk.wav" >> $@
1175
+ echo "$(SRCDIR)\chat.js" >> $@
11631176
echo "$(SRCDIR)\ci_edit.js" >> $@
11641177
echo "$(SRCDIR)\copybtn.js" >> $@
11651178
echo "$(SRCDIR)\default.css" >> $@
11661179
echo "$(SRCDIR)\diff.tcl" >> $@
11671180
echo "$(SRCDIR)\forum.js" >> $@
@@ -1317,10 +1330,16 @@
13171330
"$(OX)\cgi$O" : "$(OX)\cgi_.c" "$(OX)\cgi.h"
13181331
$(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\cgi_.c"
13191332
13201333
"$(OX)\cgi_.c" : "$(SRCDIR)\cgi.c"
13211334
"$(OBJDIR)\translate$E" $** > $@
1335
+
1336
+"$(OX)\chat$O" : "$(OX)\chat_.c" "$(OX)\chat.h"
1337
+ $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\chat_.c"
1338
+
1339
+"$(OX)\chat_.c" : "$(SRCDIR)\chat.c"
1340
+ "$(OBJDIR)\translate$E" $** > $@
13221341
13231342
"$(OX)\checkin$O" : "$(OX)\checkin_.c" "$(OX)\checkin.h"
13241343
$(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\checkin_.c"
13251344
13261345
"$(OX)\checkin_.c" : "$(SRCDIR)\checkin.c"
@@ -2108,10 +2127,11 @@
21082127
"$(OX)\bundle_.c":"$(OX)\bundle.h" \
21092128
"$(OX)\cache_.c":"$(OX)\cache.h" \
21102129
"$(OX)\capabilities_.c":"$(OX)\capabilities.h" \
21112130
"$(OX)\captcha_.c":"$(OX)\captcha.h" \
21122131
"$(OX)\cgi_.c":"$(OX)\cgi.h" \
2132
+ "$(OX)\chat_.c":"$(OX)\chat.h" \
21132133
"$(OX)\checkin_.c":"$(OX)\checkin.h" \
21142134
"$(OX)\checkout_.c":"$(OX)\checkout.h" \
21152135
"$(OX)\clearsign_.c":"$(OX)\clearsign.h" \
21162136
"$(OX)\clone_.c":"$(OX)\clone.h" \
21172137
"$(OX)\comformat_.c":"$(OX)\comformat.h" \
21182138
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -366,10 +366,11 @@
366 "$(OX)\bundle_.c" \
367 "$(OX)\cache_.c" \
368 "$(OX)\capabilities_.c" \
369 "$(OX)\captcha_.c" \
370 "$(OX)\cgi_.c" \
 
371 "$(OX)\checkin_.c" \
372 "$(OX)\checkout_.c" \
373 "$(OX)\clearsign_.c" \
374 "$(OX)\clone_.c" \
375 "$(OX)\comformat_.c" \
@@ -552,10 +553,15 @@
552 "$(SRCDIR)\..\skins\xekri\css.txt" \
553 "$(SRCDIR)\..\skins\xekri\details.txt" \
554 "$(SRCDIR)\..\skins\xekri\footer.txt" \
555 "$(SRCDIR)\..\skins\xekri\header.txt" \
556 "$(SRCDIR)\accordion.js" \
 
 
 
 
 
557 "$(SRCDIR)\ci_edit.js" \
558 "$(SRCDIR)\copybtn.js" \
559 "$(SRCDIR)\default.css" \
560 "$(SRCDIR)\diff.tcl" \
561 "$(SRCDIR)\forum.js" \
@@ -622,10 +628,11 @@
622 "$(OX)\bundle$O" \
623 "$(OX)\cache$O" \
624 "$(OX)\capabilities$O" \
625 "$(OX)\captcha$O" \
626 "$(OX)\cgi$O" \
 
627 "$(OX)\checkin$O" \
628 "$(OX)\checkout$O" \
629 "$(OX)\clearsign$O" \
630 "$(OX)\clone$O" \
631 "$(OX)\comformat$O" \
@@ -851,10 +858,11 @@
851 echo "$(OX)\bundle.obj" >> $@
852 echo "$(OX)\cache.obj" >> $@
853 echo "$(OX)\capabilities.obj" >> $@
854 echo "$(OX)\captcha.obj" >> $@
855 echo "$(OX)\cgi.obj" >> $@
 
856 echo "$(OX)\checkin.obj" >> $@
857 echo "$(OX)\checkout.obj" >> $@
858 echo "$(OX)\clearsign.obj" >> $@
859 echo "$(OX)\clone.obj" >> $@
860 echo "$(OX)\comformat.obj" >> $@
@@ -1158,10 +1166,15 @@
1158 echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@
1159 echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@
1160 echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@
1161 echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@
1162 echo "$(SRCDIR)\accordion.js" >> $@
 
 
 
 
 
1163 echo "$(SRCDIR)\ci_edit.js" >> $@
1164 echo "$(SRCDIR)\copybtn.js" >> $@
1165 echo "$(SRCDIR)\default.css" >> $@
1166 echo "$(SRCDIR)\diff.tcl" >> $@
1167 echo "$(SRCDIR)\forum.js" >> $@
@@ -1317,10 +1330,16 @@
1317 "$(OX)\cgi$O" : "$(OX)\cgi_.c" "$(OX)\cgi.h"
1318 $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\cgi_.c"
1319
1320 "$(OX)\cgi_.c" : "$(SRCDIR)\cgi.c"
1321 "$(OBJDIR)\translate$E" $** > $@
 
 
 
 
 
 
1322
1323 "$(OX)\checkin$O" : "$(OX)\checkin_.c" "$(OX)\checkin.h"
1324 $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\checkin_.c"
1325
1326 "$(OX)\checkin_.c" : "$(SRCDIR)\checkin.c"
@@ -2108,10 +2127,11 @@
2108 "$(OX)\bundle_.c":"$(OX)\bundle.h" \
2109 "$(OX)\cache_.c":"$(OX)\cache.h" \
2110 "$(OX)\capabilities_.c":"$(OX)\capabilities.h" \
2111 "$(OX)\captcha_.c":"$(OX)\captcha.h" \
2112 "$(OX)\cgi_.c":"$(OX)\cgi.h" \
 
2113 "$(OX)\checkin_.c":"$(OX)\checkin.h" \
2114 "$(OX)\checkout_.c":"$(OX)\checkout.h" \
2115 "$(OX)\clearsign_.c":"$(OX)\clearsign.h" \
2116 "$(OX)\clone_.c":"$(OX)\clone.h" \
2117 "$(OX)\comformat_.c":"$(OX)\comformat.h" \
2118
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -366,10 +366,11 @@
366 "$(OX)\bundle_.c" \
367 "$(OX)\cache_.c" \
368 "$(OX)\capabilities_.c" \
369 "$(OX)\captcha_.c" \
370 "$(OX)\cgi_.c" \
371 "$(OX)\chat_.c" \
372 "$(OX)\checkin_.c" \
373 "$(OX)\checkout_.c" \
374 "$(OX)\clearsign_.c" \
375 "$(OX)\clone_.c" \
376 "$(OX)\comformat_.c" \
@@ -552,10 +553,15 @@
553 "$(SRCDIR)\..\skins\xekri\css.txt" \
554 "$(SRCDIR)\..\skins\xekri\details.txt" \
555 "$(SRCDIR)\..\skins\xekri\footer.txt" \
556 "$(SRCDIR)\..\skins\xekri\header.txt" \
557 "$(SRCDIR)\accordion.js" \
558 "$(SRCDIR)\alerts\bflat2.wav" \
559 "$(SRCDIR)\alerts\bflat3.wav" \
560 "$(SRCDIR)\alerts\bloop.wav" \
561 "$(SRCDIR)\alerts\plunk.wav" \
562 "$(SRCDIR)\chat.js" \
563 "$(SRCDIR)\ci_edit.js" \
564 "$(SRCDIR)\copybtn.js" \
565 "$(SRCDIR)\default.css" \
566 "$(SRCDIR)\diff.tcl" \
567 "$(SRCDIR)\forum.js" \
@@ -622,10 +628,11 @@
628 "$(OX)\bundle$O" \
629 "$(OX)\cache$O" \
630 "$(OX)\capabilities$O" \
631 "$(OX)\captcha$O" \
632 "$(OX)\cgi$O" \
633 "$(OX)\chat$O" \
634 "$(OX)\checkin$O" \
635 "$(OX)\checkout$O" \
636 "$(OX)\clearsign$O" \
637 "$(OX)\clone$O" \
638 "$(OX)\comformat$O" \
@@ -851,10 +858,11 @@
858 echo "$(OX)\bundle.obj" >> $@
859 echo "$(OX)\cache.obj" >> $@
860 echo "$(OX)\capabilities.obj" >> $@
861 echo "$(OX)\captcha.obj" >> $@
862 echo "$(OX)\cgi.obj" >> $@
863 echo "$(OX)\chat.obj" >> $@
864 echo "$(OX)\checkin.obj" >> $@
865 echo "$(OX)\checkout.obj" >> $@
866 echo "$(OX)\clearsign.obj" >> $@
867 echo "$(OX)\clone.obj" >> $@
868 echo "$(OX)\comformat.obj" >> $@
@@ -1158,10 +1166,15 @@
1166 echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@
1167 echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@
1168 echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@
1169 echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@
1170 echo "$(SRCDIR)\accordion.js" >> $@
1171 echo "$(SRCDIR)\alerts/bflat2.wav" >> $@
1172 echo "$(SRCDIR)\alerts/bflat3.wav" >> $@
1173 echo "$(SRCDIR)\alerts/bloop.wav" >> $@
1174 echo "$(SRCDIR)\alerts/plunk.wav" >> $@
1175 echo "$(SRCDIR)\chat.js" >> $@
1176 echo "$(SRCDIR)\ci_edit.js" >> $@
1177 echo "$(SRCDIR)\copybtn.js" >> $@
1178 echo "$(SRCDIR)\default.css" >> $@
1179 echo "$(SRCDIR)\diff.tcl" >> $@
1180 echo "$(SRCDIR)\forum.js" >> $@
@@ -1317,10 +1330,16 @@
1330 "$(OX)\cgi$O" : "$(OX)\cgi_.c" "$(OX)\cgi.h"
1331 $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\cgi_.c"
1332
1333 "$(OX)\cgi_.c" : "$(SRCDIR)\cgi.c"
1334 "$(OBJDIR)\translate$E" $** > $@
1335
1336 "$(OX)\chat$O" : "$(OX)\chat_.c" "$(OX)\chat.h"
1337 $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\chat_.c"
1338
1339 "$(OX)\chat_.c" : "$(SRCDIR)\chat.c"
1340 "$(OBJDIR)\translate$E" $** > $@
1341
1342 "$(OX)\checkin$O" : "$(OX)\checkin_.c" "$(OX)\checkin.h"
1343 $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\checkin_.c"
1344
1345 "$(OX)\checkin_.c" : "$(SRCDIR)\checkin.c"
@@ -2108,10 +2127,11 @@
2127 "$(OX)\bundle_.c":"$(OX)\bundle.h" \
2128 "$(OX)\cache_.c":"$(OX)\cache.h" \
2129 "$(OX)\capabilities_.c":"$(OX)\capabilities.h" \
2130 "$(OX)\captcha_.c":"$(OX)\captcha.h" \
2131 "$(OX)\cgi_.c":"$(OX)\cgi.h" \
2132 "$(OX)\chat_.c":"$(OX)\chat.h" \
2133 "$(OX)\checkin_.c":"$(OX)\checkin.h" \
2134 "$(OX)\checkout_.c":"$(OX)\checkout.h" \
2135 "$(OX)\clearsign_.c":"$(OX)\clearsign.h" \
2136 "$(OX)\clone_.c":"$(OX)\clone.h" \
2137 "$(OX)\comformat_.c":"$(OX)\comformat.h" \
2138
--- www/blockchain.md
+++ www/blockchain.md
@@ -80,11 +80,11 @@
8080
hash chain that applies an ordering and lookup scheme to the blocks.
8181
[_Blockchain: Simple Explanation_][bse] explains this “hash chain”
8282
vs. “block chain” distinction in more detail.
8383
8484
These signatures prevent modification of the face value of each
85
- transation (Type 1 fraud) by ensuring that only the one signing a
85
+ transaction (Type 1 fraud) by ensuring that only the one signing a
8686
new block has the private signing key that could change an issued
8787
block after the fact.
8888
8989
The fact that these signatures are also *chained* prevents Type
9090
3 frauds by making the *prior* owner of a block sign it over to
@@ -119,11 +119,11 @@
119119
to [later](#work).
120120
121121
Although you have complete control over the contents of your local
122122
Fossil repository clone, you cannot perform Type 1 forgery on its
123123
contents short of executing a [preimage attack][prei] on the hash
124
- algorthm. ([SHA3-256][SHA-3] by default in the current version of
124
+ algorithm. ([SHA3-256][SHA-3] by default in the current version of
125125
Fossil.) Even if you could, Fossil’s sync protocol will prevent the
126126
modification from being pushed into another repository: the remote
127127
Fossil instance says, “I’ve already got that one, thanks,” and
128128
ignores the push. Thus, short of breaking into the remote server
129129
and modifying the repository in place, you couldn’t even make use of
@@ -146,11 +146,11 @@
146146
147147
If Fossil signatures prevent Type 1 and Type 2 frauds, you
148148
may wonder why they are not enabled by default. It is because
149149
they are defense-in-depth measures, not the minimum sufficient
150150
measures needed to prevent repository fraud, unlike the equivalent
151
- protections in a cryptocurrency blockcahin. Fossil provides its
151
+ protections in a cryptocurrency blockchain. Fossil provides its
152152
primary protections through other means, so it doesn’t need to
153153
mandate signatures.
154154
155155
Also, Fossil is not itself a [PKI], and there is no way for regular
156156
users of Fossil to link it to a PKI, since doing so would likely
157157
--- www/blockchain.md
+++ www/blockchain.md
@@ -80,11 +80,11 @@
80 hash chain that applies an ordering and lookup scheme to the blocks.
81 [_Blockchain: Simple Explanation_][bse] explains this “hash chain”
82 vs. “block chain” distinction in more detail.
83
84 These signatures prevent modification of the face value of each
85 transation (Type 1 fraud) by ensuring that only the one signing a
86 new block has the private signing key that could change an issued
87 block after the fact.
88
89 The fact that these signatures are also *chained* prevents Type
90 3 frauds by making the *prior* owner of a block sign it over to
@@ -119,11 +119,11 @@
119 to [later](#work).
120
121 Although you have complete control over the contents of your local
122 Fossil repository clone, you cannot perform Type 1 forgery on its
123 contents short of executing a [preimage attack][prei] on the hash
124 algorthm. ([SHA3-256][SHA-3] by default in the current version of
125 Fossil.) Even if you could, Fossil’s sync protocol will prevent the
126 modification from being pushed into another repository: the remote
127 Fossil instance says, “I’ve already got that one, thanks,” and
128 ignores the push. Thus, short of breaking into the remote server
129 and modifying the repository in place, you couldn’t even make use of
@@ -146,11 +146,11 @@
146
147 If Fossil signatures prevent Type 1 and Type 2 frauds, you
148 may wonder why they are not enabled by default. It is because
149 they are defense-in-depth measures, not the minimum sufficient
150 measures needed to prevent repository fraud, unlike the equivalent
151 protections in a cryptocurrency blockcahin. Fossil provides its
152 primary protections through other means, so it doesn’t need to
153 mandate signatures.
154
155 Also, Fossil is not itself a [PKI], and there is no way for regular
156 users of Fossil to link it to a PKI, since doing so would likely
157
--- www/blockchain.md
+++ www/blockchain.md
@@ -80,11 +80,11 @@
80 hash chain that applies an ordering and lookup scheme to the blocks.
81 [_Blockchain: Simple Explanation_][bse] explains this “hash chain”
82 vs. “block chain” distinction in more detail.
83
84 These signatures prevent modification of the face value of each
85 transaction (Type 1 fraud) by ensuring that only the one signing a
86 new block has the private signing key that could change an issued
87 block after the fact.
88
89 The fact that these signatures are also *chained* prevents Type
90 3 frauds by making the *prior* owner of a block sign it over to
@@ -119,11 +119,11 @@
119 to [later](#work).
120
121 Although you have complete control over the contents of your local
122 Fossil repository clone, you cannot perform Type 1 forgery on its
123 contents short of executing a [preimage attack][prei] on the hash
124 algorithm. ([SHA3-256][SHA-3] by default in the current version of
125 Fossil.) Even if you could, Fossil’s sync protocol will prevent the
126 modification from being pushed into another repository: the remote
127 Fossil instance says, “I’ve already got that one, thanks,” and
128 ignores the push. Thus, short of breaking into the remote server
129 and modifying the repository in place, you couldn’t even make use of
@@ -146,11 +146,11 @@
146
147 If Fossil signatures prevent Type 1 and Type 2 frauds, you
148 may wonder why they are not enabled by default. It is because
149 they are defense-in-depth measures, not the minimum sufficient
150 measures needed to prevent repository fraud, unlike the equivalent
151 protections in a cryptocurrency blockchain. Fossil provides its
152 primary protections through other means, so it doesn’t need to
153 mandate signatures.
154
155 Also, Fossil is not itself a [PKI], and there is no way for regular
156 users of Fossil to link it to a PKI, since doing so would likely
157
+1 -1
--- www/build.wiki
+++ www/build.wiki
@@ -316,11 +316,11 @@
316316
317317
<h2>6.0 Building on/for Android</h2>
318318
319319
<h3>6.1 Cross-compiling from Linux</h3>
320320
321
-The following instructions for building Fossil for Andoid,
321
+The following instructions for building Fossil for Android,
322322
without requiring a rooted OS, are adapted from
323323
[https://fossil-scm.org/forum/forumpost/e0e9de4a7e | forumpost/e0e9de4a7e].
324324
325325
On the development machine, from the fossil source tree:
326326
327327
--- www/build.wiki
+++ www/build.wiki
@@ -316,11 +316,11 @@
316
317 <h2>6.0 Building on/for Android</h2>
318
319 <h3>6.1 Cross-compiling from Linux</h3>
320
321 The following instructions for building Fossil for Andoid,
322 without requiring a rooted OS, are adapted from
323 [https://fossil-scm.org/forum/forumpost/e0e9de4a7e | forumpost/e0e9de4a7e].
324
325 On the development machine, from the fossil source tree:
326
327
--- www/build.wiki
+++ www/build.wiki
@@ -316,11 +316,11 @@
316
317 <h2>6.0 Building on/for Android</h2>
318
319 <h3>6.1 Cross-compiling from Linux</h3>
320
321 The following instructions for building Fossil for Android,
322 without requiring a rooted OS, are adapted from
323 [https://fossil-scm.org/forum/forumpost/e0e9de4a7e | forumpost/e0e9de4a7e].
324
325 On the development machine, from the fossil source tree:
326
327
--- www/caps/admin-v-setup.md
+++ www/caps/admin-v-setup.md
@@ -348,11 +348,11 @@
348348
SQL queries against the Fossil repository via Fossil UI. This not
349349
only allows arbitrary ability to modify the repository hash tree
350350
and its backing data tables, it can probably also be used to damage
351351
the host such as via `PRAGMA temp_store = FILE`.
352352
353
-* **Tickets**: This section allows input of aribtrary TH1 code that
353
+* **Tickets**: This section allows input of arbitrary TH1 code that
354354
runs on the server, affecting the way the Fossil ticketing system
355355
works. The justification in the **TH1** section below therefore
356356
applies.
357357
358358
* **TH1**: The [TH1 language][th1] is quite restricted relative to the
359359
--- www/caps/admin-v-setup.md
+++ www/caps/admin-v-setup.md
@@ -348,11 +348,11 @@
348 SQL queries against the Fossil repository via Fossil UI. This not
349 only allows arbitrary ability to modify the repository hash tree
350 and its backing data tables, it can probably also be used to damage
351 the host such as via `PRAGMA temp_store = FILE`.
352
353 * **Tickets**: This section allows input of aribtrary TH1 code that
354 runs on the server, affecting the way the Fossil ticketing system
355 works. The justification in the **TH1** section below therefore
356 applies.
357
358 * **TH1**: The [TH1 language][th1] is quite restricted relative to the
359
--- www/caps/admin-v-setup.md
+++ www/caps/admin-v-setup.md
@@ -348,11 +348,11 @@
348 SQL queries against the Fossil repository via Fossil UI. This not
349 only allows arbitrary ability to modify the repository hash tree
350 and its backing data tables, it can probably also be used to damage
351 the host such as via `PRAGMA temp_store = FILE`.
352
353 * **Tickets**: This section allows input of arbitrary TH1 code that
354 runs on the server, affecting the way the Fossil ticketing system
355 works. The justification in the **TH1** section below therefore
356 applies.
357
358 * **TH1**: The [TH1 language][th1] is quite restricted relative to the
359
+41 -7
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,21 +1,51 @@
11
<title>Change Log</title>
22
33
<a name='v2_14'></a>
4
-<h2>Changes for Version 2.14 (pending)</h2>
4
+<h2>Changes for Version 2.14 (2021-01-20)</h2>
55
6
+ * <b>Schema Update Notice #1:</b>
7
+ This release drops a trigger from the database schema (replacing
8
+ it with a TEMP trigger that is created as needed). This
9
+ change happens automatically the first time you
10
+ add content to a repository using Fossil 2.14 or later. No
11
+ action is needed on your part. However, if you upgrade to
12
+ version 2.14 and then later downgrade or otherwise use an earlier
13
+ version of Fossil, the email notification mechanism may fail
14
+ to send out notifications for some events, due to the missing
15
+ trigger. If you want to
16
+ permanently downgrade an installation, then you should run
17
+ "[/help?cmd=rebuild|fossil rebuild]" after the downgrade
18
+ to get email notifications working again. If you are not using
19
+ email notification, then the schema change will not affect you in
20
+ any way.
21
+ * <b>Schema Update Notice #2:</b>
22
+ This release changes how the descriptions of wiki edits are stored
23
+ in the EVENT table, for improved display on timelines. You must
24
+ run "[/help?cmd=rebuild|fossil rebuild]" to take advantage of
25
+ this enhancement. Everything will still work without
26
+ "fossil rebuild", except you will get goofy descriptions of
27
+ wiki updates in the timeline.
28
+ * Add support for [./chat.md|Fossil chat].
629
* The "[/help?cmd=clone|fossil clone]" command is enhanced so that
730
if the repository filename is omitted, an appropriate name is derived
831
from the remote URL and the newly cloned repo is opened. This makes
932
the clone command work more like Git, thus making it easier for
1033
people transitioning from Git.
11
- * Changed the way that wiki edits are stored in the EVENT table of the
12
- database, for more flexibility and better features.
13
- <b>Run "fossil rebuild" to take advantage of this change</b>.
34
+ * Added the --mainbranch option to the [/help?cmd=git|fossil git export]
35
+ command.
36
+ * Added the --format option to the
37
+ "[/help?cmd=timeline|fossil timeline]" command.
38
+ * Enhance the --numstat option on the
39
+ "[/help?cmd=diff|fossil diff]" command so that it shows a total
40
+ number of lines added and deleted and total number of files
41
+ modified.
1442
* Add the "contact" sub-command to [/help?cmd=user|fossil user].
1543
* Added commands "[/help?cmd=all|fossil all git export]" and
1644
"[/help?cmd=all|fossil all git status]".
45
+ * Added the "df=CHECKIN" query parameter to the
46
+ [/help?cmd=/timeline|/timeline page].
1747
* Improvements to the "[/sitemap]" page. Add subpages
1848
[/sitemap-timeline] and [/sitemap-test].
1949
* Better text position in cylinder objects of Pikchr diagrams.
2050
* New "details.txt" settings available to custom skins to better control
2151
the rendering of Pikchr diagrams:
@@ -24,10 +54,14 @@
2454
<li> pikchr-scale
2555
<li> pikchr-fontscale
2656
</ul>
2757
* Allow the use of SQL functions inside the ticket table definition
2858
for custom ticket configurations.
59
+ * The built-in SQLite is updated to version 3.35.0 alpha containing
60
+ performance optimizations, especially performance associated with
61
+ startup, and minor improvements to the CLI.
62
+ * Performance optimizations to Fossil itself.
2963
* Countless improvements and enhancements to the documentation
3064
3165
<a name='v2_13'></a>
3266
<h2>Changes for Version 2.13 (2020-11-01)</h2>
3367
@@ -605,11 +639,11 @@
605639
<a name='v2_0'></a>
606640
<h2>Changes for Version 2.0 (2017-03-03)</h2>
607641
608642
* Use the
609643
[https://github.com/cr-marcstevens/sha1collisiondetection|hardened SHA1]
610
- implemenation by Marc Stevens and Dan Shumow.
644
+ implementation by Marc Stevens and Dan Shumow.
611645
* Add the ability to read and understand
612646
[./fileformat.wiki#names|artifact names] that are based on SHA3-256
613647
rather than SHA1, but do not actually generate any such names.
614648
* Added the [/help?cmd=sha3sum|sha3sum] command.
615649
* Update the built-in SQLite to version 3.17.0.
@@ -629,11 +663,11 @@
629663
with many new filter options so that specific kinds of changes can be
630664
found without having to pipe through grep or sed.
631665
* Enhanced the [/help/sqlite3|fossil sql] command so that it opens the
632666
[./tech_overview.wiki#localdb|checkout database] and the
633667
[./tech_overview.wiki#configdb|configuration database] in addition to the
634
- respository database.
668
+ repository database.
635669
* TH1 enhancements:
636670
<ul><li>Add <nowiki>[unversioned content]</nowiki> command.</li>
637671
<li>Add <nowiki>[unversioned list]</nowiki> command.</li>
638672
<li>Add project_description variable.</li>
639673
</ul>
@@ -722,11 +756,11 @@
722756
[/help?cmd=/tarball|/tarball] and [/help?cmd=/zip|/zip] web pages.
723757
* Add support for [./encryptedrepos.wiki|encrypted Fossil repositories].
724758
* If the FOSSIL_PWREADER environment variable is set, then use the program it
725759
names in place of getpass() to read passwords and passphrases
726760
* Option --baseurl now works on Windows.
727
- * Numerious documentation improvements.
761
+ * Numerous documentation improvements.
728762
* Update the built-in SQLite to version 3.13.0.
729763
730764
<a name='v1_34'></a>
731765
<h2>Changes for Version 1.34 (2015-11-02)</h2>
732766
733767
734768
ADDED www/chat.md
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,21 +1,51 @@
1 <title>Change Log</title>
2
3 <a name='v2_14'></a>
4 <h2>Changes for Version 2.14 (pending)</h2>
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6 * The "[/help?cmd=clone|fossil clone]" command is enhanced so that
7 if the repository filename is omitted, an appropriate name is derived
8 from the remote URL and the newly cloned repo is opened. This makes
9 the clone command work more like Git, thus making it easier for
10 people transitioning from Git.
11 * Changed the way that wiki edits are stored in the EVENT table of the
12 database, for more flexibility and better features.
13 <b>Run "fossil rebuild" to take advantage of this change</b>.
 
 
 
 
 
14 * Add the "contact" sub-command to [/help?cmd=user|fossil user].
15 * Added commands "[/help?cmd=all|fossil all git export]" and
16 "[/help?cmd=all|fossil all git status]".
 
 
17 * Improvements to the "[/sitemap]" page. Add subpages
18 [/sitemap-timeline] and [/sitemap-test].
19 * Better text position in cylinder objects of Pikchr diagrams.
20 * New "details.txt" settings available to custom skins to better control
21 the rendering of Pikchr diagrams:
@@ -24,10 +54,14 @@
24 <li> pikchr-scale
25 <li> pikchr-fontscale
26 </ul>
27 * Allow the use of SQL functions inside the ticket table definition
28 for custom ticket configurations.
 
 
 
 
29 * Countless improvements and enhancements to the documentation
30
31 <a name='v2_13'></a>
32 <h2>Changes for Version 2.13 (2020-11-01)</h2>
33
@@ -605,11 +639,11 @@
605 <a name='v2_0'></a>
606 <h2>Changes for Version 2.0 (2017-03-03)</h2>
607
608 * Use the
609 [https://github.com/cr-marcstevens/sha1collisiondetection|hardened SHA1]
610 implemenation by Marc Stevens and Dan Shumow.
611 * Add the ability to read and understand
612 [./fileformat.wiki#names|artifact names] that are based on SHA3-256
613 rather than SHA1, but do not actually generate any such names.
614 * Added the [/help?cmd=sha3sum|sha3sum] command.
615 * Update the built-in SQLite to version 3.17.0.
@@ -629,11 +663,11 @@
629 with many new filter options so that specific kinds of changes can be
630 found without having to pipe through grep or sed.
631 * Enhanced the [/help/sqlite3|fossil sql] command so that it opens the
632 [./tech_overview.wiki#localdb|checkout database] and the
633 [./tech_overview.wiki#configdb|configuration database] in addition to the
634 respository database.
635 * TH1 enhancements:
636 <ul><li>Add <nowiki>[unversioned content]</nowiki> command.</li>
637 <li>Add <nowiki>[unversioned list]</nowiki> command.</li>
638 <li>Add project_description variable.</li>
639 </ul>
@@ -722,11 +756,11 @@
722 [/help?cmd=/tarball|/tarball] and [/help?cmd=/zip|/zip] web pages.
723 * Add support for [./encryptedrepos.wiki|encrypted Fossil repositories].
724 * If the FOSSIL_PWREADER environment variable is set, then use the program it
725 names in place of getpass() to read passwords and passphrases
726 * Option --baseurl now works on Windows.
727 * Numerious documentation improvements.
728 * Update the built-in SQLite to version 3.13.0.
729
730 <a name='v1_34'></a>
731 <h2>Changes for Version 1.34 (2015-11-02)</h2>
732
733
734 DDED www/chat.md
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,21 +1,51 @@
1 <title>Change Log</title>
2
3 <a name='v2_14'></a>
4 <h2>Changes for Version 2.14 (2021-01-20)</h2>
5
6 * <b>Schema Update Notice #1:</b>
7 This release drops a trigger from the database schema (replacing
8 it with a TEMP trigger that is created as needed). This
9 change happens automatically the first time you
10 add content to a repository using Fossil 2.14 or later. No
11 action is needed on your part. However, if you upgrade to
12 version 2.14 and then later downgrade or otherwise use an earlier
13 version of Fossil, the email notification mechanism may fail
14 to send out notifications for some events, due to the missing
15 trigger. If you want to
16 permanently downgrade an installation, then you should run
17 "[/help?cmd=rebuild|fossil rebuild]" after the downgrade
18 to get email notifications working again. If you are not using
19 email notification, then the schema change will not affect you in
20 any way.
21 * <b>Schema Update Notice #2:</b>
22 This release changes how the descriptions of wiki edits are stored
23 in the EVENT table, for improved display on timelines. You must
24 run "[/help?cmd=rebuild|fossil rebuild]" to take advantage of
25 this enhancement. Everything will still work without
26 "fossil rebuild", except you will get goofy descriptions of
27 wiki updates in the timeline.
28 * Add support for [./chat.md|Fossil chat].
29 * The "[/help?cmd=clone|fossil clone]" command is enhanced so that
30 if the repository filename is omitted, an appropriate name is derived
31 from the remote URL and the newly cloned repo is opened. This makes
32 the clone command work more like Git, thus making it easier for
33 people transitioning from Git.
34 * Added the --mainbranch option to the [/help?cmd=git|fossil git export]
35 command.
36 * Added the --format option to the
37 "[/help?cmd=timeline|fossil timeline]" command.
38 * Enhance the --numstat option on the
39 "[/help?cmd=diff|fossil diff]" command so that it shows a total
40 number of lines added and deleted and total number of files
41 modified.
42 * Add the "contact" sub-command to [/help?cmd=user|fossil user].
43 * Added commands "[/help?cmd=all|fossil all git export]" and
44 "[/help?cmd=all|fossil all git status]".
45 * Added the "df=CHECKIN" query parameter to the
46 [/help?cmd=/timeline|/timeline page].
47 * Improvements to the "[/sitemap]" page. Add subpages
48 [/sitemap-timeline] and [/sitemap-test].
49 * Better text position in cylinder objects of Pikchr diagrams.
50 * New "details.txt" settings available to custom skins to better control
51 the rendering of Pikchr diagrams:
@@ -24,10 +54,14 @@
54 <li> pikchr-scale
55 <li> pikchr-fontscale
56 </ul>
57 * Allow the use of SQL functions inside the ticket table definition
58 for custom ticket configurations.
59 * The built-in SQLite is updated to version 3.35.0 alpha containing
60 performance optimizations, especially performance associated with
61 startup, and minor improvements to the CLI.
62 * Performance optimizations to Fossil itself.
63 * Countless improvements and enhancements to the documentation
64
65 <a name='v2_13'></a>
66 <h2>Changes for Version 2.13 (2020-11-01)</h2>
67
@@ -605,11 +639,11 @@
639 <a name='v2_0'></a>
640 <h2>Changes for Version 2.0 (2017-03-03)</h2>
641
642 * Use the
643 [https://github.com/cr-marcstevens/sha1collisiondetection|hardened SHA1]
644 implementation by Marc Stevens and Dan Shumow.
645 * Add the ability to read and understand
646 [./fileformat.wiki#names|artifact names] that are based on SHA3-256
647 rather than SHA1, but do not actually generate any such names.
648 * Added the [/help?cmd=sha3sum|sha3sum] command.
649 * Update the built-in SQLite to version 3.17.0.
@@ -629,11 +663,11 @@
663 with many new filter options so that specific kinds of changes can be
664 found without having to pipe through grep or sed.
665 * Enhanced the [/help/sqlite3|fossil sql] command so that it opens the
666 [./tech_overview.wiki#localdb|checkout database] and the
667 [./tech_overview.wiki#configdb|configuration database] in addition to the
668 repository database.
669 * TH1 enhancements:
670 <ul><li>Add <nowiki>[unversioned content]</nowiki> command.</li>
671 <li>Add <nowiki>[unversioned list]</nowiki> command.</li>
672 <li>Add project_description variable.</li>
673 </ul>
@@ -722,11 +756,11 @@
756 [/help?cmd=/tarball|/tarball] and [/help?cmd=/zip|/zip] web pages.
757 * Add support for [./encryptedrepos.wiki|encrypted Fossil repositories].
758 * If the FOSSIL_PWREADER environment variable is set, then use the program it
759 names in place of getpass() to read passwords and passphrases
760 * Option --baseurl now works on Windows.
761 * Numerous documentation improvements.
762 * Update the built-in SQLite to version 3.13.0.
763
764 <a name='v1_34'></a>
765 <h2>Changes for Version 1.34 (2015-11-02)</h2>
766
767
768 DDED www/chat.md
+134
--- a/www/chat.md
+++ b/www/chat.md
@@ -0,0 +1,134 @@
1
+?cmd=emeral** &rarr;
2
+ Chat mAs of versrarr;
3
+ Chat messages do not sync to peer repositories, and they are
4
+ automatically deleted after a configurable delay (default: 7 days).
5
+ Individual messages or the entire s-by on the internet.
6
+Fto provide a
7
+ me without impacting ime without impa
8
+ dispersed developers. is designed for use by insider
9
+ as a replacemigher. It is not intended as a general-purpose gathering
10
+place for random passers-by on the internet.
11
+Fossil chat seeks to provide a communication venue for discussion
12
+that does *not* become part of the permanent record for the project.
13
+For persistent and durable discussion, use the [Forum](./forum.. The chatroomies, and they are
14
+ automatically deleted after a configurable delay (default: 7 days).
15
+ Individual messages or the entire conversation
16
+ can be deleted at any time without impacting any other part
17
+ of the system.
18
+
19
+Fossil chat is designed for use by insiders - people with check-in
20
+privileges or higher. It is not intended as a general-purpose gathering
21
+place for random passers-by on the internet.
22
+Fossil chat seeks to provide a communication venue for discussion
23
+that does *not* become part of the permanent record for the project.
24
+For persistent and durable discussion, use the [Forum](./forum.wiki).
25
+Because the conversation is intended to be ephemeral, the chat messages
26
+are local to a single repository. Chat content does not sync.
27
+
28
+
29
+## Setup
30
+
31
+A Fossil repository must be functioning as a [server](./server/) in order
32
+for chat to work.
33
+To activate chat, simply add the [C capability](/setup_ucap_list)
34
+to every user who is authorized to participate. Anyone who can read chat
35
+can also post to chat.
36
+
37
+Setup ("s") and Admin ("a") usAs of version 2.17,?cmd=emeral** &rarr" capability. A common configuration is to add the "C" capability
38
+to "Developer" so that any individual user who has the "v" capability will
39
+also have access to chat.
40
+
41
+There are also some settings under /Admin/Chat that control the
42
+behavior of chat, though the default settings are reasonable so in mat check-out (the server whose URL is shown by the
43
+[fossil remote](/help/remote) command).
44
+
45
+### <a id="robots"></a> Chat Messages From Robots
46
+
47
+The [fossil chat send](/help/chat) can be used by project-specific
48
+robots to send notifications to the chatroom. For example, on the
49
+[SQLite project](https://sqlite.org/) (for which the Fossil chatroom
50
+feature, and indeed all of Fossil, was invented) there are long-running
51
+fuzz servers that sometimes run across obscure problems. Whenever this
52
+happens, a message is sent to the SQLite developers chatroom alerting
53
+them to the problem.
54
+
55
+The recommended way to allow robots to send chat messages is to create
56
+a new user on the server for each robot. Give each such robot account
57
+the "C" privilege only. That means that the robot user account will be
58
+able to send chat messages, but not do anything else. Then, in the
59
+program or script that runs the robot, when it wants to send a chat
60
+message, have it run a command like this:
61
+
62
+~~~~
63
+fossil chat send --remote https://robot:[email protected]/fossil \
64
+ --message 'MESSAGE TEXT' --file file-to-attach.txt
65
+~~~~
66
+
67
+Substitute the appropriate project URL, robot account
68
+name and password, message text and file atta?cmd=rs.*
69
+>
70
+The [/chat](/help/www/chat) webpage downloads a small amount of HTML
71
+and a small amount of javascript to run the chat session. The
72
+javascript uses XMLHttpRequest (XHR) to download chat content, post
73
+new content, or delete historical messages. The following web
74
+interfaces are used by the XHR:
75
+
76
+ * [/chat-poll](/help?name=/chat-poll) &rarr;
77
+ Downloads chat content as JSON.
78
+ Chat messages are numbered sequentially.
79
+ The clirgest chat message Sidebar: message deletion is a type of message and deletions count
80
+ of versrarr;
81
+ ?cmd=emeral** &rarr;
82
+
83
+from the reposito the deleted
84
+comment).?cmd=emeral** &rarr Chat mAs of <a id="cli"></a> The `f currently visible
85
+chat) from within any op not posted
86
+ the project that is in th cosmetic-only
87
+mpt to connece it currently
88
+ holds, and the server sends back subsequent messages. If there
89
+ are no subsequent messages, the /chat-poll page blocks until new
90
+ messages are available.
91
+
92
+ * [/chat-send](/help?name=/chat-send) &rarr;
93
+ Sends a new chat message to the server.
94
+
95
+ * [/chat-delete](/help?name=/chat-delete) &rarr;
96
+ Deletes a chat message.
97
+
98
+Fossil chat uses the venerable?cmd=lling](wikipedia:/wiki/Push_technology#Long_polling)"
99
+technique to receive asynchronous notifiction of new messages.
100
+This is done because long polling works well with CGI and SCGI,
101
+which are the usu> are
102
+ automatically deleted after a configurable delay (default: 7 days).
103
+ Individual messages or the entire conversation
104
+ can be deleted at any time without impacting any other part
105
+ of the system.
106
+
107
+Fossil chat is designed for use by insiders - people with check-in
108
+privileges or higher. It is not intended as a general-purpose gathering
109
+place for random passers-by on the internet.Message text is delivered verbatim. There is no markup. However,
110
+the chat system does try to identify and tag hyperlinks, as follows:
111
+
112
+ * Any word that begins with "http://" or "https://" is assumed
113
+ to be a hyperlink and is tagged.
114
+
115
+ * Text within `[...]` is parsed, and it if is a valid hyperlink
116
+ target (according to the way that [Fossil Wiki](/wiki_rules) or
117
+ [Markdown](/md_rules) understand hyperlinks), then that text is
118
+ tagged. Note that only URLs and Fossil-internal constructs such
119
+ as checkin hashes and wiki pages names are recognized here, not
120
+ constructs such as `[URL | label]` or `[label](URL)`.
121
+
122
+Apart from adding hyperlink anchor tags to bits of text that look
123
+like hyperlinks, no changesocal to a single repository. Chat content does not sync.
124
+
125
+
126
+## Setup
127
+
128
+A Fossil repository must be functioning as a [server](./server/) in order
129
+for chat to work.
130
+To activate chat, simply add the [C capability](/setup_ucap_list)
131
+to every user who is authorized to participate. Anyone who can read chat
132
+can also post to chat.
133
+
134
+Setup ("s") and Admin ("a")
--- a/www/chat.md
+++ b/www/chat.md
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/www/chat.md
+++ b/www/chat.md
@@ -0,0 +1,134 @@
1 ?cmd=emeral** &rarr;
2 Chat mAs of versrarr;
3 Chat messages do not sync to peer repositories, and they are
4 automatically deleted after a configurable delay (default: 7 days).
5 Individual messages or the entire s-by on the internet.
6 Fto provide a
7 me without impacting ime without impa
8 dispersed developers. is designed for use by insider
9 as a replacemigher. It is not intended as a general-purpose gathering
10 place for random passers-by on the internet.
11 Fossil chat seeks to provide a communication venue for discussion
12 that does *not* become part of the permanent record for the project.
13 For persistent and durable discussion, use the [Forum](./forum.. The chatroomies, and they are
14 automatically deleted after a configurable delay (default: 7 days).
15 Individual messages or the entire conversation
16 can be deleted at any time without impacting any other part
17 of the system.
18
19 Fossil chat is designed for use by insiders - people with check-in
20 privileges or higher. It is not intended as a general-purpose gathering
21 place for random passers-by on the internet.
22 Fossil chat seeks to provide a communication venue for discussion
23 that does *not* become part of the permanent record for the project.
24 For persistent and durable discussion, use the [Forum](./forum.wiki).
25 Because the conversation is intended to be ephemeral, the chat messages
26 are local to a single repository. Chat content does not sync.
27
28
29 ## Setup
30
31 A Fossil repository must be functioning as a [server](./server/) in order
32 for chat to work.
33 To activate chat, simply add the [C capability](/setup_ucap_list)
34 to every user who is authorized to participate. Anyone who can read chat
35 can also post to chat.
36
37 Setup ("s") and Admin ("a") usAs of version 2.17,?cmd=emeral** &rarr" capability. A common configuration is to add the "C" capability
38 to "Developer" so that any individual user who has the "v" capability will
39 also have access to chat.
40
41 There are also some settings under /Admin/Chat that control the
42 behavior of chat, though the default settings are reasonable so in mat check-out (the server whose URL is shown by the
43 [fossil remote](/help/remote) command).
44
45 ### <a id="robots"></a> Chat Messages From Robots
46
47 The [fossil chat send](/help/chat) can be used by project-specific
48 robots to send notifications to the chatroom. For example, on the
49 [SQLite project](https://sqlite.org/) (for which the Fossil chatroom
50 feature, and indeed all of Fossil, was invented) there are long-running
51 fuzz servers that sometimes run across obscure problems. Whenever this
52 happens, a message is sent to the SQLite developers chatroom alerting
53 them to the problem.
54
55 The recommended way to allow robots to send chat messages is to create
56 a new user on the server for each robot. Give each such robot account
57 the "C" privilege only. That means that the robot user account will be
58 able to send chat messages, but not do anything else. Then, in the
59 program or script that runs the robot, when it wants to send a chat
60 message, have it run a command like this:
61
62 ~~~~
63 fossil chat send --remote https://robot:[email protected]/fossil \
64 --message 'MESSAGE TEXT' --file file-to-attach.txt
65 ~~~~
66
67 Substitute the appropriate project URL, robot account
68 name and password, message text and file atta?cmd=rs.*
69 >
70 The [/chat](/help/www/chat) webpage downloads a small amount of HTML
71 and a small amount of javascript to run the chat session. The
72 javascript uses XMLHttpRequest (XHR) to download chat content, post
73 new content, or delete historical messages. The following web
74 interfaces are used by the XHR:
75
76 * [/chat-poll](/help?name=/chat-poll) &rarr;
77 Downloads chat content as JSON.
78 Chat messages are numbered sequentially.
79 The clirgest chat message Sidebar: message deletion is a type of message and deletions count
80 of versrarr;
81 ?cmd=emeral** &rarr;
82
83 from the reposito the deleted
84 comment).?cmd=emeral** &rarr Chat mAs of <a id="cli"></a> The `f currently visible
85 chat) from within any op not posted
86 the project that is in th cosmetic-only
87 mpt to connece it currently
88 holds, and the server sends back subsequent messages. If there
89 are no subsequent messages, the /chat-poll page blocks until new
90 messages are available.
91
92 * [/chat-send](/help?name=/chat-send) &rarr;
93 Sends a new chat message to the server.
94
95 * [/chat-delete](/help?name=/chat-delete) &rarr;
96 Deletes a chat message.
97
98 Fossil chat uses the venerable?cmd=lling](wikipedia:/wiki/Push_technology#Long_polling)"
99 technique to receive asynchronous notifiction of new messages.
100 This is done because long polling works well with CGI and SCGI,
101 which are the usu> are
102 automatically deleted after a configurable delay (default: 7 days).
103 Individual messages or the entire conversation
104 can be deleted at any time without impacting any other part
105 of the system.
106
107 Fossil chat is designed for use by insiders - people with check-in
108 privileges or higher. It is not intended as a general-purpose gathering
109 place for random passers-by on the internet.Message text is delivered verbatim. There is no markup. However,
110 the chat system does try to identify and tag hyperlinks, as follows:
111
112 * Any word that begins with "http://" or "https://" is assumed
113 to be a hyperlink and is tagged.
114
115 * Text within `[...]` is parsed, and it if is a valid hyperlink
116 target (according to the way that [Fossil Wiki](/wiki_rules) or
117 [Markdown](/md_rules) understand hyperlinks), then that text is
118 tagged. Note that only URLs and Fossil-internal constructs such
119 as checkin hashes and wiki pages names are recognized here, not
120 constructs such as `[URL | label]` or `[label](URL)`.
121
122 Apart from adding hyperlink anchor tags to bits of text that look
123 like hyperlinks, no changesocal to a single repository. Chat content does not sync.
124
125
126 ## Setup
127
128 A Fossil repository must be functioning as a [server](./server/) in order
129 for chat to work.
130 To activate chat, simply add the [C capability](/setup_ucap_list)
131 to every user who is authorized to participate. Anyone who can read chat
132 can also post to chat.
133
134 Setup ("s") and Admin ("a")
--- www/ckout-workflows.md
+++ www/ckout-workflows.md
@@ -109,12 +109,11 @@
109109
details.)
110110
111111
112112
#### <a id="clone"></a> Git-Like Clone-and-Open
113113
114
-With Fossil 2.14 — currently unreleased — we added a more Git-like
115
-alternative:
114
+In Fossil 2.14, we added a more Git-like alternative:
116115
117116
fossil clone https://fossil-scm.org/fossil
118117
cd fossil
119118
120119
This results in a `fossil.fossil` repo DB file and a `fossil/` working
121120
122121
ADDED www/co-vs-up.md
--- www/ckout-workflows.md
+++ www/ckout-workflows.md
@@ -109,12 +109,11 @@
109 details.)
110
111
112 #### <a id="clone"></a> Git-Like Clone-and-Open
113
114 With Fossil 2.14 — currently unreleased — we added a more Git-like
115 alternative:
116
117 fossil clone https://fossil-scm.org/fossil
118 cd fossil
119
120 This results in a `fossil.fossil` repo DB file and a `fossil/` working
121
122 DDED www/co-vs-up.md
--- www/ckout-workflows.md
+++ www/ckout-workflows.md
@@ -109,12 +109,11 @@
109 details.)
110
111
112 #### <a id="clone"></a> Git-Like Clone-and-Open
113
114 In Fossil 2.14, we added a more Git-like alternative:
 
115
116 fossil clone https://fossil-scm.org/fossil
117 cd fossil
118
119 This results in a `fossil.fossil` repo DB file and a `fossil/` working
120
121 DDED www/co-vs-up.md
--- a/www/co-vs-up.md
+++ b/www/co-vs-up.md
@@ -0,0 +1,4 @@
1
+?cmd=ly useful.
2
+
3
+[co]: /help/checkout
4
+[cvsmu]: http://web.mit.edu/gnu/doc/html/cvs_?cmd=update
--- a/www/co-vs-up.md
+++ b/www/co-vs-up.md
@@ -0,0 +1,4 @@
 
 
 
 
--- a/www/co-vs-up.md
+++ b/www/co-vs-up.md
@@ -0,0 +1,4 @@
1 ?cmd=ly useful.
2
3 [co]: /help/checkout
4 [cvsmu]: http://web.mit.edu/gnu/doc/html/cvs_?cmd=update
--- www/contribute.wiki
+++ www/contribute.wiki
@@ -1,83 +1,124 @@
11
<title>Contributing To Fossil</title>
22
3
-Users are encouraged to contributed enhancements back to the Fossil
3
+Fossil users are encouraged to contributed enhancements back to the
44
project. This note outlines some of the procedures for making
55
useful contributions.
66
77
<h2>1.0 Contributor Agreement</h2>
88
9
-In order to accept your contributions, we <u>must</u> have a
9
+In order to accept non-trivial contributions, we <u>must</u> have a
1010
[./copyright-release.pdf | Contributor Agreement (PDF)]
1111
(or [./copyright-release.html | as HTML]) on file for you. We require
1212
this in order to maintain clear title to the Fossil code and prevent
1313
the introduction of code with incompatible licenses or other entanglements
14
-that might cause legal problems for Fossil users. Many larger companies
15
-and other lawyer-rich organizations require this as a precondition to using
14
+that might cause legal problems for Fossil users. Many
15
+lawyer-rich organizations require this as a precondition to using
1616
Fossil.
1717
1818
If you do not wish to submit a Contributor Agreement, we would still
1919
welcome your suggestions and example code, but we will not use your code
20
-directly - we will be forced to re-implement your changes from scratch which
20
+directly: we will be forced to re-implement your changes from scratch, which
2121
might take longer.
22
+
23
+We've made exceptions for "trivial" changes in the past, but the
24
+definition of that term is up to the project leader.
2225
2326
<h2>2.0 Submitting Patches</h2>
2427
2528
Suggested changes or bug fixes can be submitted by creating a patch
26
-against the current source tree. Email patches to
29
+against the current source tree:
30
+
31
+ <tt>fossil diff -i > my-change.patch</tt>
32
+
33
+Post patches to
34
+[https://fossil-scm.org/forum | the forum] or email them to
2735
<a href="mailto:[email protected]">[email protected]</a>. Be sure to
2836
describe in detail what the patch does and which version of Fossil
29
-it is written against.
30
-
31
-A contributor agreement is not strictly necessary to submit a patch.
32
-However, without a contributor agreement on file, your patch will be
33
-used for reference only - it will not be applied to the code. This
34
-may delay acceptance of your patch.
35
-
36
-Your patches or changes might not be accepted even if you do have
37
+it is written against. It's best to make patches against tip-of-trunk
38
+rather than against past releases.
39
+
40
+If your change is more complicated than a patch can properly encode, you
41
+may submit [/help?cmd=bundle | a Fossil bundle] instead. Unlike patches,
42
+bundles can contain multiple commits, check-in comments, file renames,
43
+file deletions, branching decisions, and more which <tt>patch(1)</tt>
44
+files cannot. It's best to make a bundle of a new branch so the change
45
+can be integrated, tested, enhanced, and merged down to trunk in a
46
+controlled fashion.
47
+
48
+A contributor agreement is not strictly necessary to submit a patch or bundle,
49
+but without a contributor agreement on file, your contribution will be
50
+used for reference only: it will not be applied to the code. This
51
+may delay acceptance of your contribution.
52
+
53
+Your contribution might not be accepted even if you do have
3754
a contributor agreement on file. Please do not take this personally
38
-or as an affront to your coding ability. Sometimes patches are rejected
55
+or as an affront to your coding ability. Sometimes contributions are rejected
3956
because they seem to be taking the project in a direction that the
40
-architect does not want to go. Or, there might be an alternative
57
+architect does not want to go. In other cases, there might be an alternative
4158
implementation of the same feature being prepared separately.
4259
4360
<h2>3.0 Check-in Privileges</h2>
4461
4562
Check-in privileges are granted on a case-by-case basis. Your chances
4663
of getting check-in privileges are much improved if you have a history
47
-of submitting quality patches and/or making thoughtful posts on the
48
-[http://www.mail-archive.com/[email protected]/ | mailing list].
49
-A contributor agreement is, of course, a prerequisite for check-in
64
+of submitting quality patches and/or making thoughtful posts on
65
+[https://fossil-scm.org/forum | the forum].
66
+A signed contributor agreement is, of course, a prerequisite for check-in
5067
privileges.</p>
5168
5269
Contributors are asked to make all non-trivial changes on a branch. The
5370
Fossil Architect (Richard Hipp) will merge changes onto the trunk.</p>
5471
55
-Contributors are required to following the
72
+Contributors are required to follow the
5673
[./checkin.wiki | pre-checkin checklist] prior to every check-in to
5774
the Fossil self-hosting repository. This checklist is short and succinct
5875
and should only require a few seconds to follow. Contributors
5976
should print out a copy of the pre-checkin checklist and keep
60
-it on a note card beside their workstations, for quick reference.
77
+it on a note card beside their workstations for quick reference.
6178
6279
Contributors should review the
6380
[./style.wiki | Coding Style Guidelines] and mimic the coding style
6481
used through the rest of the Fossil source code. Your code should
6582
blend in. A third-party reader should be unable to distinguish your
6683
code from any other code in the source corpus.
6784
6885
<h2>4.0 Testing</h2>
6986
70
-Fossil has the beginnings of a
71
-[../test/release-checklist.wiki | release checklist] but this is an
72
-area that needs further work. (Your contributions here are welcomed!)
73
-Contributors with check-in privileges are expected to run the release
74
-checklist on any major changes they contribute, and if appropriate expand
75
-the checklist and/or the automated test scripts to cover their additions.
76
-
77
-
78
-<h2>5.0 See Also</h2>
87
+Fossil's [../test/release-checklist.wiki | release checklist] is of
88
+primary benefit to the project leader, followed by him at release time,
89
+but contributors are encouraged to run through its steps when making
90
+major changes, since if the change doesn't pass this checklist, it won't
91
+be included in the next release.
92
+
93
+<h2>5.0 UI and Documentation Language</h2>
94
+
95
+The Fossil project uses American English in its web interface and
96
+documentation. Until there is some provision for translating the UI and
97
+docs into other languages and dialects, we ask that you do not commit
98
+changes that conflict with this.
99
+
100
+We aren't opposed to such a project, but it would be a huge amount of
101
+work, which no one's stepped up to do yet. Not only is each individual
102
+translation a large ongoing job its own right, there is no
103
+infrastructure for it yet, so the first few translations will be harder
104
+than any future translation built on that infrastructure.
105
+
106
+More immediately, we're likely to reject, revert, or rework commits that
107
+use other English dialects. One example that comes up occasionally is
108
+"artefact" versus "artifact." The UI and docs use the American English
109
+spelling pervasively, so you have poor options if you insist on
110
+"artefact:"
111
+
112
+ * attempt to slip one-off changes by your peers
113
+ * attempt to change all American English usages to Commonwealth English
114
+ * make the Fossil UI and docs translatable, then contribute a
115
+ Commonwealth English translation
116
+
117
+Only the latter is likely to succeed.
118
+
119
+<h2>6.0 See Also</h2>
79120
80121
* [./build.wiki | How To Compile And Install Fossil]
81122
* [./makefile.wiki | The Fossil Build Process]
82123
* [./tech_overview.wiki | A Technical Overview of Fossil]
83124
* [./adding_code.wiki | Adding Features To Fossil]
84125
--- www/contribute.wiki
+++ www/contribute.wiki
@@ -1,83 +1,124 @@
1 <title>Contributing To Fossil</title>
2
3 Users are encouraged to contributed enhancements back to the Fossil
4 project. This note outlines some of the procedures for making
5 useful contributions.
6
7 <h2>1.0 Contributor Agreement</h2>
8
9 In order to accept your contributions, we <u>must</u> have a
10 [./copyright-release.pdf | Contributor Agreement (PDF)]
11 (or [./copyright-release.html | as HTML]) on file for you. We require
12 this in order to maintain clear title to the Fossil code and prevent
13 the introduction of code with incompatible licenses or other entanglements
14 that might cause legal problems for Fossil users. Many larger companies
15 and other lawyer-rich organizations require this as a precondition to using
16 Fossil.
17
18 If you do not wish to submit a Contributor Agreement, we would still
19 welcome your suggestions and example code, but we will not use your code
20 directly - we will be forced to re-implement your changes from scratch which
21 might take longer.
 
 
 
22
23 <h2>2.0 Submitting Patches</h2>
24
25 Suggested changes or bug fixes can be submitted by creating a patch
26 against the current source tree. Email patches to
 
 
 
 
 
27 <a href="mailto:[email protected]">[email protected]</a>. Be sure to
28 describe in detail what the patch does and which version of Fossil
29 it is written against.
30
31 A contributor agreement is not strictly necessary to submit a patch.
32 However, without a contributor agreement on file, your patch will be
33 used for reference only - it will not be applied to the code. This
34 may delay acceptance of your patch.
35
36 Your patches or changes might not be accepted even if you do have
 
 
 
 
 
 
 
 
 
37 a contributor agreement on file. Please do not take this personally
38 or as an affront to your coding ability. Sometimes patches are rejected
39 because they seem to be taking the project in a direction that the
40 architect does not want to go. Or, there might be an alternative
41 implementation of the same feature being prepared separately.
42
43 <h2>3.0 Check-in Privileges</h2>
44
45 Check-in privileges are granted on a case-by-case basis. Your chances
46 of getting check-in privileges are much improved if you have a history
47 of submitting quality patches and/or making thoughtful posts on the
48 [http://www.mail-archive.com/[email protected]/ | mailing list].
49 A contributor agreement is, of course, a prerequisite for check-in
50 privileges.</p>
51
52 Contributors are asked to make all non-trivial changes on a branch. The
53 Fossil Architect (Richard Hipp) will merge changes onto the trunk.</p>
54
55 Contributors are required to following the
56 [./checkin.wiki | pre-checkin checklist] prior to every check-in to
57 the Fossil self-hosting repository. This checklist is short and succinct
58 and should only require a few seconds to follow. Contributors
59 should print out a copy of the pre-checkin checklist and keep
60 it on a note card beside their workstations, for quick reference.
61
62 Contributors should review the
63 [./style.wiki | Coding Style Guidelines] and mimic the coding style
64 used through the rest of the Fossil source code. Your code should
65 blend in. A third-party reader should be unable to distinguish your
66 code from any other code in the source corpus.
67
68 <h2>4.0 Testing</h2>
69
70 Fossil has the beginnings of a
71 [../test/release-checklist.wiki | release checklist] but this is an
72 area that needs further work. (Your contributions here are welcomed!)
73 Contributors with check-in privileges are expected to run the release
74 checklist on any major changes they contribute, and if appropriate expand
75 the checklist and/or the automated test scripts to cover their additions.
76
77
78 <h2>5.0 See Also</h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
80 * [./build.wiki | How To Compile And Install Fossil]
81 * [./makefile.wiki | The Fossil Build Process]
82 * [./tech_overview.wiki | A Technical Overview of Fossil]
83 * [./adding_code.wiki | Adding Features To Fossil]
84
--- www/contribute.wiki
+++ www/contribute.wiki
@@ -1,83 +1,124 @@
1 <title>Contributing To Fossil</title>
2
3 Fossil users are encouraged to contributed enhancements back to the
4 project. This note outlines some of the procedures for making
5 useful contributions.
6
7 <h2>1.0 Contributor Agreement</h2>
8
9 In order to accept non-trivial contributions, we <u>must</u> have a
10 [./copyright-release.pdf | Contributor Agreement (PDF)]
11 (or [./copyright-release.html | as HTML]) on file for you. We require
12 this in order to maintain clear title to the Fossil code and prevent
13 the introduction of code with incompatible licenses or other entanglements
14 that might cause legal problems for Fossil users. Many
15 lawyer-rich organizations require this as a precondition to using
16 Fossil.
17
18 If you do not wish to submit a Contributor Agreement, we would still
19 welcome your suggestions and example code, but we will not use your code
20 directly: we will be forced to re-implement your changes from scratch, which
21 might take longer.
22
23 We've made exceptions for "trivial" changes in the past, but the
24 definition of that term is up to the project leader.
25
26 <h2>2.0 Submitting Patches</h2>
27
28 Suggested changes or bug fixes can be submitted by creating a patch
29 against the current source tree:
30
31 <tt>fossil diff -i > my-change.patch</tt>
32
33 Post patches to
34 [https://fossil-scm.org/forum | the forum] or email them to
35 <a href="mailto:[email protected]">[email protected]</a>. Be sure to
36 describe in detail what the patch does and which version of Fossil
37 it is written against. It's best to make patches against tip-of-trunk
38 rather than against past releases.
39
40 If your change is more complicated than a patch can properly encode, you
41 may submit [/help?cmd=bundle | a Fossil bundle] instead. Unlike patches,
42 bundles can contain multiple commits, check-in comments, file renames,
43 file deletions, branching decisions, and more which <tt>patch(1)</tt>
44 files cannot. It's best to make a bundle of a new branch so the change
45 can be integrated, tested, enhanced, and merged down to trunk in a
46 controlled fashion.
47
48 A contributor agreement is not strictly necessary to submit a patch or bundle,
49 but without a contributor agreement on file, your contribution will be
50 used for reference only: it will not be applied to the code. This
51 may delay acceptance of your contribution.
52
53 Your contribution might not be accepted even if you do have
54 a contributor agreement on file. Please do not take this personally
55 or as an affront to your coding ability. Sometimes contributions are rejected
56 because they seem to be taking the project in a direction that the
57 architect does not want to go. In other cases, there might be an alternative
58 implementation of the same feature being prepared separately.
59
60 <h2>3.0 Check-in Privileges</h2>
61
62 Check-in privileges are granted on a case-by-case basis. Your chances
63 of getting check-in privileges are much improved if you have a history
64 of submitting quality patches and/or making thoughtful posts on
65 [https://fossil-scm.org/forum | the forum].
66 A signed contributor agreement is, of course, a prerequisite for check-in
67 privileges.</p>
68
69 Contributors are asked to make all non-trivial changes on a branch. The
70 Fossil Architect (Richard Hipp) will merge changes onto the trunk.</p>
71
72 Contributors are required to follow the
73 [./checkin.wiki | pre-checkin checklist] prior to every check-in to
74 the Fossil self-hosting repository. This checklist is short and succinct
75 and should only require a few seconds to follow. Contributors
76 should print out a copy of the pre-checkin checklist and keep
77 it on a note card beside their workstations for quick reference.
78
79 Contributors should review the
80 [./style.wiki | Coding Style Guidelines] and mimic the coding style
81 used through the rest of the Fossil source code. Your code should
82 blend in. A third-party reader should be unable to distinguish your
83 code from any other code in the source corpus.
84
85 <h2>4.0 Testing</h2>
86
87 Fossil's [../test/release-checklist.wiki | release checklist] is of
88 primary benefit to the project leader, followed by him at release time,
89 but contributors are encouraged to run through its steps when making
90 major changes, since if the change doesn't pass this checklist, it won't
91 be included in the next release.
92
93 <h2>5.0 UI and Documentation Language</h2>
94
95 The Fossil project uses American English in its web interface and
96 documentation. Until there is some provision for translating the UI and
97 docs into other languages and dialects, we ask that you do not commit
98 changes that conflict with this.
99
100 We aren't opposed to such a project, but it would be a huge amount of
101 work, which no one's stepped up to do yet. Not only is each individual
102 translation a large ongoing job its own right, there is no
103 infrastructure for it yet, so the first few translations will be harder
104 than any future translation built on that infrastructure.
105
106 More immediately, we're likely to reject, revert, or rework commits that
107 use other English dialects. One example that comes up occasionally is
108 "artefact" versus "artifact." The UI and docs use the American English
109 spelling pervasively, so you have poor options if you insist on
110 "artefact:"
111
112 * attempt to slip one-off changes by your peers
113 * attempt to change all American English usages to Commonwealth English
114 * make the Fossil UI and docs translatable, then contribute a
115 Commonwealth English translation
116
117 Only the latter is likely to succeed.
118
119 <h2>6.0 See Also</h2>
120
121 * [./build.wiki | How To Compile And Install Fossil]
122 * [./makefile.wiki | The Fossil Build Process]
123 * [./tech_overview.wiki | A Technical Overview of Fossil]
124 * [./adding_code.wiki | Adding Features To Fossil]
125
--- www/css-tricks.md
+++ www/css-tricks.md
@@ -13,11 +13,11 @@
1313
of customizing certain CSS-based behaviors in a Fossil UI. That said...
1414
1515
## Is it Really `!important`?
1616
1717
By and large, CSS's `!important` qualifier is not needed when
18
-customzing Fossil's CSS. On occasion, however, particular styles may
18
+customizing Fossil's CSS. On occasion, however, particular styles may
1919
be set directly on DOM elements when Fossil generates its HTML, and
2020
such cases require the use of `!important` to override them.
2121
2222
2323
<!-- ============================================================ -->
2424
--- www/css-tricks.md
+++ www/css-tricks.md
@@ -13,11 +13,11 @@
13 of customizing certain CSS-based behaviors in a Fossil UI. That said...
14
15 ## Is it Really `!important`?
16
17 By and large, CSS's `!important` qualifier is not needed when
18 customzing Fossil's CSS. On occasion, however, particular styles may
19 be set directly on DOM elements when Fossil generates its HTML, and
20 such cases require the use of `!important` to override them.
21
22
23 <!-- ============================================================ -->
24
--- www/css-tricks.md
+++ www/css-tricks.md
@@ -13,11 +13,11 @@
13 of customizing certain CSS-based behaviors in a Fossil UI. That said...
14
15 ## Is it Really `!important`?
16
17 By and large, CSS's `!important` qualifier is not needed when
18 customizing Fossil's CSS. On occasion, however, particular styles may
19 be set directly on DOM elements when Fossil generates its HTML, and
20 such cases require the use of `!important` to override them.
21
22
23 <!-- ============================================================ -->
24
--- www/customskin.md
+++ www/customskin.md
@@ -84,11 +84,23 @@
8484
<meta http-equiv="Content-Security-Policy" content="...." />
8585
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8686
<title>....</title>
8787
<link rel="stylesheet" href="..." type="text/css" />
8888
</head>
89
- <body>
89
+ <body class="FEATURE">
90
+
91
+…where `FEATURE` is either the top-level URL element (e.g. `doc`) or a
92
+feature class that groups multiple URLs under a single name such as
93
+`forum` to contain `/forummain`, `/forumpost`, `/forume2`, etc. This
94
+allows per-feature CSS such as
95
+
96
+ body.forum div.markdown blockquote {
97
+ margin-left: 10px;
98
+ }
99
+
100
+That is, affect HTML `<blockquote>` tags specially only for forum posts
101
+written in Markdown, leaving all other block quotes alone.
90102
91103
In most cases, it is best to leave the Fossil-generated HTML Header
92104
alone. (One exception is when the administrator needs to include links
93105
to additional CSS files.) The configurable part of the skin begins
94106
with the Content Header section which should follow this template:
@@ -157,11 +169,11 @@
157169
158170
<blockquote><dl>
159171
<dt><b>css.txt</b></dt><dd>
160172
161173
<p>The css.txt file is the text of the CSS for Fossil.
162
-Fossil might add additional CSS elements after the
174
+Fossil might add additional CSS elements after
163175
the css.txt file, if it sees that the css.txt omits some
164176
CSS components that Fossil needs. But for the most part,
165177
the content of the css.txt is the CSS for the page.</dd>
166178
167179
<dt><b>details.txt</b><dt><dd>
@@ -183,12 +195,12 @@
183195
right is a boolean - "1" to activate the feature and "0" to
184196
disable it. The "white-foreground:" setting should be set to
185197
"1" if the page color has light-color text on a darker background,
186198
and "0" if the page has dark text on a light-colored background.
187199
<p>
188
-If the "pikchr-foreground" setting (only available in Fossil 2.14 and
189
-later) is defined and is not an empty string then it specifies a
200
+If the "pikchr-foreground" setting (added in Fossil 2.14)
201
+is defined and is not an empty string then it specifies a
190202
foreground color to use for [pikchr diagrams](./pikchr.md). The
191203
default pikchr foreground color is black, or white if the
192204
"white-foreground" boolean is set.
193205
</dd>
194206
@@ -251,11 +263,11 @@
251263
press "Reload" on your browser to see the effects.
252264
253265
## <a name="headfoot"></a>Header and Footer Processing
254266
255267
The `header.txt` and `footer.txt` control files of a skin are the HTML text
256
-of the Contnet Header and Content Footer, except that before being inserted
268
+of the Content Header and Content Footer, except that before being inserted
257269
into the output stream, the text is run through a
258270
[TH1 interpreter](./th1.md) that might adjust the text as follows:
259271
260272
* All text within &lt;th1&gt;...&lt;/th1&gt; is omitted from the
261273
output and is instead run as a TH1 script. That TH1
262274
--- www/customskin.md
+++ www/customskin.md
@@ -84,11 +84,23 @@
84 <meta http-equiv="Content-Security-Policy" content="...." />
85 <meta name="viewport" content="width=device-width, initial-scale=1.0">
86 <title>....</title>
87 <link rel="stylesheet" href="..." type="text/css" />
88 </head>
89 <body>
 
 
 
 
 
 
 
 
 
 
 
 
90
91 In most cases, it is best to leave the Fossil-generated HTML Header
92 alone. (One exception is when the administrator needs to include links
93 to additional CSS files.) The configurable part of the skin begins
94 with the Content Header section which should follow this template:
@@ -157,11 +169,11 @@
157
158 <blockquote><dl>
159 <dt><b>css.txt</b></dt><dd>
160
161 <p>The css.txt file is the text of the CSS for Fossil.
162 Fossil might add additional CSS elements after the
163 the css.txt file, if it sees that the css.txt omits some
164 CSS components that Fossil needs. But for the most part,
165 the content of the css.txt is the CSS for the page.</dd>
166
167 <dt><b>details.txt</b><dt><dd>
@@ -183,12 +195,12 @@
183 right is a boolean - "1" to activate the feature and "0" to
184 disable it. The "white-foreground:" setting should be set to
185 "1" if the page color has light-color text on a darker background,
186 and "0" if the page has dark text on a light-colored background.
187 <p>
188 If the "pikchr-foreground" setting (only available in Fossil 2.14 and
189 later) is defined and is not an empty string then it specifies a
190 foreground color to use for [pikchr diagrams](./pikchr.md). The
191 default pikchr foreground color is black, or white if the
192 "white-foreground" boolean is set.
193 </dd>
194
@@ -251,11 +263,11 @@
251 press "Reload" on your browser to see the effects.
252
253 ## <a name="headfoot"></a>Header and Footer Processing
254
255 The `header.txt` and `footer.txt` control files of a skin are the HTML text
256 of the Contnet Header and Content Footer, except that before being inserted
257 into the output stream, the text is run through a
258 [TH1 interpreter](./th1.md) that might adjust the text as follows:
259
260 * All text within &lt;th1&gt;...&lt;/th1&gt; is omitted from the
261 output and is instead run as a TH1 script. That TH1
262
--- www/customskin.md
+++ www/customskin.md
@@ -84,11 +84,23 @@
84 <meta http-equiv="Content-Security-Policy" content="...." />
85 <meta name="viewport" content="width=device-width, initial-scale=1.0">
86 <title>....</title>
87 <link rel="stylesheet" href="..." type="text/css" />
88 </head>
89 <body class="FEATURE">
90
91 …where `FEATURE` is either the top-level URL element (e.g. `doc`) or a
92 feature class that groups multiple URLs under a single name such as
93 `forum` to contain `/forummain`, `/forumpost`, `/forume2`, etc. This
94 allows per-feature CSS such as
95
96 body.forum div.markdown blockquote {
97 margin-left: 10px;
98 }
99
100 That is, affect HTML `<blockquote>` tags specially only for forum posts
101 written in Markdown, leaving all other block quotes alone.
102
103 In most cases, it is best to leave the Fossil-generated HTML Header
104 alone. (One exception is when the administrator needs to include links
105 to additional CSS files.) The configurable part of the skin begins
106 with the Content Header section which should follow this template:
@@ -157,11 +169,11 @@
169
170 <blockquote><dl>
171 <dt><b>css.txt</b></dt><dd>
172
173 <p>The css.txt file is the text of the CSS for Fossil.
174 Fossil might add additional CSS elements after
175 the css.txt file, if it sees that the css.txt omits some
176 CSS components that Fossil needs. But for the most part,
177 the content of the css.txt is the CSS for the page.</dd>
178
179 <dt><b>details.txt</b><dt><dd>
@@ -183,12 +195,12 @@
195 right is a boolean - "1" to activate the feature and "0" to
196 disable it. The "white-foreground:" setting should be set to
197 "1" if the page color has light-color text on a darker background,
198 and "0" if the page has dark text on a light-colored background.
199 <p>
200 If the "pikchr-foreground" setting (added in Fossil 2.14)
201 is defined and is not an empty string then it specifies a
202 foreground color to use for [pikchr diagrams](./pikchr.md). The
203 default pikchr foreground color is black, or white if the
204 "white-foreground" boolean is set.
205 </dd>
206
@@ -251,11 +263,11 @@
263 press "Reload" on your browser to see the effects.
264
265 ## <a name="headfoot"></a>Header and Footer Processing
266
267 The `header.txt` and `footer.txt` control files of a skin are the HTML text
268 of the Content Header and Content Footer, except that before being inserted
269 into the output stream, the text is run through a
270 [TH1 interpreter](./th1.md) that might adjust the text as follows:
271
272 * All text within &lt;th1&gt;...&lt;/th1&gt; is omitted from the
273 output and is instead run as a TH1 script. That TH1
274
+3 -3
--- www/defcsp.md
+++ www/defcsp.md
@@ -102,11 +102,11 @@
102102
103103
As the "`unsafe-`" prefix on the name implies, the `'unsafe-inline'`
104104
feature is suboptimal for security. However, there are
105105
a few places in the Fossil-generated HTML that benefit from this
106106
flexibility and the work-arounds are verbose and difficult to maintain.
107
-Futhermore, the harm that can be done with style injections is far
107
+Furthermore, the harm that can be done with style injections is far
108108
less than the harm possible with injected javascript. And so the
109109
`'unsafe-inline'` compromise is accepted for now, though it might
110110
go away in some future release of Fossil.
111111
112112
### <a name="script"></a> script-src 'self' 'nonce-%s'
@@ -173,11 +173,11 @@
173173
content:
174174
175175
<script src="/doc/trunk/bad.js"></script>
176176
177177
That script can then do anything allowed in JavaScript to *any other*
178
-Chisel repository your browser can access.The possibilities for mischief
178
+Chisel repository your browser can access. The possibilities for mischief
179179
are *vast*. For just one example, if you have login cookies on four
180180
different Chisel repositories, your attacker could harvest the login
181181
cookies for all of them through this path if we allowed Fossil to serve
182182
JavaScript files under the same CSP policy as we do for CSS files.
183183
@@ -240,11 +240,11 @@
240240
to serve such content via `/ext` URLs.
241241
242242
5. Put Fossil behind a [front-end proxy server][svr] as a virtual
243243
subdirectory within the site, so that our default CSP’s “self” rules
244244
match static file routes on that same site. For instance, your repo
245
- might be at `https://example.com/code`, allowing documentes in that
245
+ might be at `https://example.com/code`, allowing documents in that
246246
repo to refer to:
247247
248248
* images as `/image/foo.png`
249249
* JavaScript files as `/js/bar.js`
250250
* CSS style sheets as `/style/qux.css`
251251
--- www/defcsp.md
+++ www/defcsp.md
@@ -102,11 +102,11 @@
102
103 As the "`unsafe-`" prefix on the name implies, the `'unsafe-inline'`
104 feature is suboptimal for security. However, there are
105 a few places in the Fossil-generated HTML that benefit from this
106 flexibility and the work-arounds are verbose and difficult to maintain.
107 Futhermore, the harm that can be done with style injections is far
108 less than the harm possible with injected javascript. And so the
109 `'unsafe-inline'` compromise is accepted for now, though it might
110 go away in some future release of Fossil.
111
112 ### <a name="script"></a> script-src 'self' 'nonce-%s'
@@ -173,11 +173,11 @@
173 content:
174
175 <script src="/doc/trunk/bad.js"></script>
176
177 That script can then do anything allowed in JavaScript to *any other*
178 Chisel repository your browser can access.The possibilities for mischief
179 are *vast*. For just one example, if you have login cookies on four
180 different Chisel repositories, your attacker could harvest the login
181 cookies for all of them through this path if we allowed Fossil to serve
182 JavaScript files under the same CSP policy as we do for CSS files.
183
@@ -240,11 +240,11 @@
240 to serve such content via `/ext` URLs.
241
242 5. Put Fossil behind a [front-end proxy server][svr] as a virtual
243 subdirectory within the site, so that our default CSP’s “self” rules
244 match static file routes on that same site. For instance, your repo
245 might be at `https://example.com/code`, allowing documentes in that
246 repo to refer to:
247
248 * images as `/image/foo.png`
249 * JavaScript files as `/js/bar.js`
250 * CSS style sheets as `/style/qux.css`
251
--- www/defcsp.md
+++ www/defcsp.md
@@ -102,11 +102,11 @@
102
103 As the "`unsafe-`" prefix on the name implies, the `'unsafe-inline'`
104 feature is suboptimal for security. However, there are
105 a few places in the Fossil-generated HTML that benefit from this
106 flexibility and the work-arounds are verbose and difficult to maintain.
107 Furthermore, the harm that can be done with style injections is far
108 less than the harm possible with injected javascript. And so the
109 `'unsafe-inline'` compromise is accepted for now, though it might
110 go away in some future release of Fossil.
111
112 ### <a name="script"></a> script-src 'self' 'nonce-%s'
@@ -173,11 +173,11 @@
173 content:
174
175 <script src="/doc/trunk/bad.js"></script>
176
177 That script can then do anything allowed in JavaScript to *any other*
178 Chisel repository your browser can access. The possibilities for mischief
179 are *vast*. For just one example, if you have login cookies on four
180 different Chisel repositories, your attacker could harvest the login
181 cookies for all of them through this path if we allowed Fossil to serve
182 JavaScript files under the same CSP policy as we do for CSS files.
183
@@ -240,11 +240,11 @@
240 to serve such content via `/ext` URLs.
241
242 5. Put Fossil behind a [front-end proxy server][svr] as a virtual
243 subdirectory within the site, so that our default CSP’s “self” rules
244 match static file routes on that same site. For instance, your repo
245 might be at `https://example.com/code`, allowing documents in that
246 repo to refer to:
247
248 * images as `/image/foo.png`
249 * JavaScript files as `/js/bar.js`
250 * CSS style sheets as `/style/qux.css`
251
--- www/delta_format.wiki
+++ www/delta_format.wiki
@@ -191,12 +191,24 @@
191191
written base-64 encoded, MSB first, and without leading
192192
"0"-characters, except if they are significant (i.e. 0 => "0").
193193
</p>
194194
195195
<p>
196
-The base-64 coding is described in
197
-<a href="http://www.ietf.org/rfc/rfc3548.txt">RFC 3548</a>.
196
+The base-64 encoding uses one character for each 6 bits of
197
+the integer to be encoded. The encoding characters are:
198
+</p>
199
+
200
+<blockquote><pre>
201
+0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~
202
+</pre></blockquote>
203
+
204
+<p>The least significant 6 bits of the integer are encoded by
205
+the first character, followed by
206
+the next 6 bits, and so on until all non-zero bits of the integer
207
+are encoded. The minimum number of encoding characters is used.
208
+Note that for integers less than 10, the base-64 coding is a
209
+ASCII decimal rendering of the number itself.
198210
</p>
199211
200212
<a name="examples"></a><h1>4.0 Examples</h1>
201213
202214
<a name="examplesint"></a><h2>4.1 Integer encoding</h2>
203215
--- www/delta_format.wiki
+++ www/delta_format.wiki
@@ -191,12 +191,24 @@
191 written base-64 encoded, MSB first, and without leading
192 "0"-characters, except if they are significant (i.e. 0 => "0").
193 </p>
194
195 <p>
196 The base-64 coding is described in
197 <a href="http://www.ietf.org/rfc/rfc3548.txt">RFC 3548</a>.
 
 
 
 
 
 
 
 
 
 
 
 
198 </p>
199
200 <a name="examples"></a><h1>4.0 Examples</h1>
201
202 <a name="examplesint"></a><h2>4.1 Integer encoding</h2>
203
--- www/delta_format.wiki
+++ www/delta_format.wiki
@@ -191,12 +191,24 @@
191 written base-64 encoded, MSB first, and without leading
192 "0"-characters, except if they are significant (i.e. 0 => "0").
193 </p>
194
195 <p>
196 The base-64 encoding uses one character for each 6 bits of
197 the integer to be encoded. The encoding characters are:
198 </p>
199
200 <blockquote><pre>
201 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~
202 </pre></blockquote>
203
204 <p>The least significant 6 bits of the integer are encoded by
205 the first character, followed by
206 the next 6 bits, and so on until all non-zero bits of the integer
207 are encoded. The minimum number of encoding characters is used.
208 Note that for integers less than 10, the base-64 coding is a
209 ASCII decimal rendering of the number itself.
210 </p>
211
212 <a name="examples"></a><h1>4.0 Examples</h1>
213
214 <a name="examplesint"></a><h2>4.1 Integer encoding</h2>
215
+2 -2
--- www/env-opts.md
+++ www/env-opts.md
@@ -113,11 +113,11 @@
113113
114114
Environment Variables
115115
---------------------
116116
117117
The location of the user's account-wide [configuration database][configdb]
118
-depends on the operating system and on the existance of various
118
+depends on the operating system and on the existence of various
119119
environment variables and/or files. See the discussion of the
120120
[configuration database location algorithm][configloc] for details.
121121
122122
`EDITOR`: Name the editor to use for check-in and stash comments.
123123
Overridden by the local or global `editor` setting or the `VISUAL`
@@ -393,11 +393,11 @@
393393
[configuration database file][configdb].
394394
The configuration database file includes the global settings
395395
and the list of repositories and checkouts used by `fossil all`.
396396
397397
The location of the configuration database file depends on the
398
-operating system and on the existance of various environment
398
+operating system and on the existence of various environment
399399
variables and/or files. In brief, the configuration database is
400400
usually:
401401
402402
* Traditional unix &rarr; "`$HOME/.fossil`"
403403
* Windows &rarr; "`%LOCALAPPDATA%/_fossil`"
404404
--- www/env-opts.md
+++ www/env-opts.md
@@ -113,11 +113,11 @@
113
114 Environment Variables
115 ---------------------
116
117 The location of the user's account-wide [configuration database][configdb]
118 depends on the operating system and on the existance of various
119 environment variables and/or files. See the discussion of the
120 [configuration database location algorithm][configloc] for details.
121
122 `EDITOR`: Name the editor to use for check-in and stash comments.
123 Overridden by the local or global `editor` setting or the `VISUAL`
@@ -393,11 +393,11 @@
393 [configuration database file][configdb].
394 The configuration database file includes the global settings
395 and the list of repositories and checkouts used by `fossil all`.
396
397 The location of the configuration database file depends on the
398 operating system and on the existance of various environment
399 variables and/or files. In brief, the configuration database is
400 usually:
401
402 * Traditional unix &rarr; "`$HOME/.fossil`"
403 * Windows &rarr; "`%LOCALAPPDATA%/_fossil`"
404
--- www/env-opts.md
+++ www/env-opts.md
@@ -113,11 +113,11 @@
113
114 Environment Variables
115 ---------------------
116
117 The location of the user's account-wide [configuration database][configdb]
118 depends on the operating system and on the existence of various
119 environment variables and/or files. See the discussion of the
120 [configuration database location algorithm][configloc] for details.
121
122 `EDITOR`: Name the editor to use for check-in and stash comments.
123 Overridden by the local or global `editor` setting or the `VISUAL`
@@ -393,11 +393,11 @@
393 [configuration database file][configdb].
394 The configuration database file includes the global settings
395 and the list of repositories and checkouts used by `fossil all`.
396
397 The location of the configuration database file depends on the
398 operating system and on the existence of various environment
399 variables and/or files. In brief, the configuration database is
400 usually:
401
402 * Traditional unix &rarr; "`$HOME/.fossil`"
403 * Windows &rarr; "`%LOCALAPPDATA%/_fossil`"
404
--- www/fileedit-page.md
+++ www/fileedit-page.md
@@ -137,11 +137,11 @@
137137
Exactly how long `localStorage` will survive, and how much it or
138138
`sessionStorage` can hold, is environment-dependent. `sessionStorage`
139139
will survive until the current browser tab is closed, but it survives
140140
across reloads of the same tab.
141141
142
-If `/filepage` determines that no peristent storage is available a
142
+If `/filepage` determines that no persistent storage is available a
143143
warning is displayed on the editor page.
144144
145145
[html5storage]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API
146146
147147
## <a id="power"></a> The Power is Yours, but...
148148
--- www/fileedit-page.md
+++ www/fileedit-page.md
@@ -137,11 +137,11 @@
137 Exactly how long `localStorage` will survive, and how much it or
138 `sessionStorage` can hold, is environment-dependent. `sessionStorage`
139 will survive until the current browser tab is closed, but it survives
140 across reloads of the same tab.
141
142 If `/filepage` determines that no peristent storage is available a
143 warning is displayed on the editor page.
144
145 [html5storage]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API
146
147 ## <a id="power"></a> The Power is Yours, but...
148
--- www/fileedit-page.md
+++ www/fileedit-page.md
@@ -137,11 +137,11 @@
137 Exactly how long `localStorage` will survive, and how much it or
138 `sessionStorage` can hold, is environment-dependent. `sessionStorage`
139 will survive until the current browser tab is closed, but it survives
140 across reloads of the same tab.
141
142 If `/filepage` determines that no persistent storage is available a
143 warning is displayed on the editor page.
144
145 [html5storage]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API
146
147 ## <a id="power"></a> The Power is Yours, but...
148
+54 -99
--- www/forum.wiki
+++ www/forum.wiki
@@ -1,113 +1,68 @@
11
<title>Fossil Forums</title>
22
33
<h2>Introduction</h2>
44
5
-As of Fossil 2.7, Fossil includes a built-in discussion forum feature.
6
-
7
-Any project complex enough to benefit from being managed by Fossil and
8
-which has more than one user can probably also benefit from having a
9
-discussion forum. Even if your project has a discussion forum already,
10
-there are many benefits to using Fossil's built-in forum feature, some
11
-of which you cannot get by using third-party alternatives:
12
-
13
- * <b>Easy to Administer:</b> Third-party discussion forum and mailing
14
- list software tends to be difficult to install, set up, and
15
- administer. The Fossil forum feature aims to be as close to
16
- zero-configuration as is practical.
5
+Fossil includes a built-in discussion forum, designed to substitute
6
+for a mailing list. Email notification is available to receive posts,
7
+but the web-based UI must be used to enter new posts. Advantages of
8
+the forum include:
9
+
10
+ * <b>Easy to Administer:</b> If you have already set up a
11
+ [./server/|Fossil server] with [./alerts.md|email alerts]
12
+ then turning on the forum feature
13
+ is just a matter of flipping some permission bits. There is
14
+ no new software to install and configure, and the same logins
15
+ and passwords work.
16
+
17
+ * <b>Consistent Display:</b> Forum posts can be in [/md_rules|Markdown],
18
+ [/wiki_rules|Fossil Wiki], or plain text. Whichever format is used, the result is
19
+ displayed consistently across all platforms and operating systems and
20
+ between mobile devices and desktops.
21
+
22
+ * <b>Editable:</b> Forum posts can be amended after they are sent,
23
+ to fix typos or provide updates. The original posts are preserved
24
+ as part of the historical record, but only the amended posts are
25
+ displayed by default.
26
+
27
+ * <b>Built-in Full-Text Search:</b> Forum posts can be included in
28
+ the index used by the built-in Fossil search logic.
29
+
30
+ * <b>Off-Line Access:</b> Because forum posts are synced along with
31
+ all other artifacts, you can search the forum, or add new posts, or
32
+ edit existing posts, all while off-line.
33
+
34
+ * <b>Automatically Cross-Referenced To Other Fossil Artifacts:</b> Because forum
35
+ posts are normal Fossil artifacts, you can link from them to
36
+ other Fossil artifacts (check-ins, wiki, tickets) and from those other
37
+ artifacts to forum posts. The reverse links are recognized and
38
+ displayed automatically on the receiver.
1739
1840
* <b>Malefactor Resistant:</b> Because Fossil accepts forum posts
19
- only via the web UI, it is inherently [./antibot.wiki | protected
20
- against bots].
41
+ only via the web UI, it is more resistent to spam. Passers-by
42
+ can post to the forum anonymously (subject to moderation), without
43
+ the hassle of a sign-up process.
2144
2245
* <b>Distributed and Tamper-Proof:</b> Posts are stored in the Fossil
23
- repository using the same [./fileformat.wiki | block chain technology]
46
+ repository using the same [./fileformat.wiki | DAG/Merkle-tree design]
2447
that Fossil uses to store your check-ins, wiki documents, etc.
25
- Posts sync to cloned repositories in a tamper-proof fashion.
26
-
27
- * <b>Space Efficient:</b> Because of Fossil's [./delta_format.wiki |
28
- delta compression technology], discussions add little to the size
29
- of a cloned repository. Ten years of the SQLite project's
30
- discussions — averaging about 2 dozen posts per day — compress down
31
- to [https://fossil-scm.org/forum/forumpost/9b6f3f36bdb | just
32
- 35&nbsp;MB of space] in a Fossil forum repository.
33
-
34
- * <b>Built-in Full-Text Search:</b> Fossil forums use
35
- [https://sqlite.org/fts3.html | SQLite's powerful FTS4 engine] to
36
- handle searches. If your project currently uses a mailing list for
37
- discussions, this means you are no longer reliant upon third-party
38
- mailing list archive services to provide a useful search engine for
39
- your discussions. If you are running a private Fossil repository,
40
- you may not even have the <em>option</em> of delegating this useful
41
- service to a third-party; Fossil provides this service out of the
42
- box.
43
-
44
- * <b>One Result Per Matching Post:</b> When you search the forum
45
- archives via the Fossil web interface, you get only one result for
46
- each matching post. When you search for project information via a
47
- standard web search engine, you might get a result from the project
48
- site's own mail archive plus one from Nabble, one from Gmane, one
49
- from The Mail Archive...
50
-
51
- * <b>Search Off-Line:</b> Because Fossil is a [./concepts.wiki |
52
- distributed version control system], project members can search
53
- your forum archive while disconnected from the network where the
54
- central Fossil instance runs. Your past discussions are potentially
55
- just as valuable as a wiki document or checkin comment: there is no
56
- good reason why you should have to wait to get back on the Internet
57
- or back to the office before you can search for past posts.
58
-
59
- * <b>Contribute Off-Line:</b> Fossil forum posts work like any other
60
- insertion into the repository, so a user can create new threads and
61
- reply to existing ones while off-line, then sync their
62
- contributions to the server they cloned from when back on-line.
63
- Yes, you can post to the forum from inside a tent, miles from the
64
- nearest WiFi router or cellular data tower.
65
-
66
- * <b>Interlink with Other Fossil-Managed Artifacts:</b> Because forum
67
- posts are normal Fossil artifacts, you can interlink them with
68
- other Fossil artifacts using short internal links: link to forum
69
- threads from a [./tickets.wiki | ticket], link to a wiki document
70
- from a forum post, etc.
71
-
72
- * <b>Durable Links:</b> Once you create a valid internal artifact
73
- link in Fossil, it <em>remains</em> valid, durably. With
74
- third-party forum software and mailing list search engines, your
75
- links are only valid until the third-party component changes its
76
- URL scheme or disappears from the web.
77
-
78
- * <b>Role-Based Access Control:</b> The forum uses the same
79
- [./caps/ | capability-based access control
80
- system] that Fossil uses to control all other repository accesses.
81
- The Fossil forum feature simply adds [./caps/ref.html#2 | several new fine-grained
82
- capabilities] to the existing system.
83
-
84
- * <b>Enduring, Open File Format:</b> Since Fossil has an
85
- [./fileformat.wiki | open and well-documented file format], your
86
- discussion archives are truly that: <em>archives</em>. You are no
87
- longer dependent on the lifetime and business model of a
88
- third-party piece of software or service. Should you choose to stop
89
- using Fossil, you can easily extract your discussion traffic for
90
- transfer to another system.
91
-
92
- * <b>Lightweight Markup:</b> Posts can be marked up using Fossil's
93
- existing [/md_rules | Markdown] and [/wiki_rules | Wiki] markup
94
- processors. No longer must you choose between two bad options: to
95
- restrict posts to plain text only or to allow wild-west
96
- HTML-formatted MIME email. Fossil's lightweight markup language
97
- formatting features give you a middle path, providing your users
98
- enough formatting power to communicate complex ideas well without
99
- providing so much power as to risk
100
- [https://wonko.com/post/html-escaping | security problems].
101
-
102
- * <b>Easy Email Alerts:</b> You can configure Fossil to
103
- [./alerts.md | send email alerts]. Forum post emails include the
104
- complete message content for the benefit of those that prefer to
105
- visit the forum only when they need to post something. Alerts are
106
- optional, and each user gets the choice of immediate or daily
107
- digest delivery.
108
-
48
+ Forum posts sync to cloned repositories.
49
+
50
+<h2>Example Installations</h2>
51
+
52
+Both the [forum:/forum|Fossil project itself] and the
53
+[https://sqlite.org/forum/forum|SQLite project] use the Fossil forum in place
54
+of mailing lists. The forum has worked well on both projects. The ability
55
+to post anonymously provides a low-resistance path for people to report
56
+problems, resulting in more problems being reported and fixed.
57
+The ability to moderate and amend forum posts means that the
58
+forums contain better information. And backups and archives
59
+are as easy as running "clone".
60
+
61
+Both Fossil and SQLite keep their forums as separate repositories.
62
+But there is no requirement to do this. A forum can be coresident in
63
+the same repository with the source code.
10964
11065
<h2 id="setup">Setting up a Fossil Forum</h2>
11166
11267
<h3 id="caps">Capabilities</h3>
11368
11469
--- www/forum.wiki
+++ www/forum.wiki
@@ -1,113 +1,68 @@
1 <title>Fossil Forums</title>
2
3 <h2>Introduction</h2>
4
5 As of Fossil 2.7, Fossil includes a built-in discussion forum feature.
6
7 Any project complex enough to benefit from being managed by Fossil and
8 which has more than one user can probably also benefit from having a
9 discussion forum. Even if your project has a discussion forum already,
10 there are many benefits to using Fossil's built-in forum feature, some
11 of which you cannot get by using third-party alternatives:
12
13 * <b>Easy to Administer:</b> Third-party discussion forum and mailing
14 list software tends to be difficult to install, set up, and
15 administer. The Fossil forum feature aims to be as close to
16 zero-configuration as is practical.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
18 * <b>Malefactor Resistant:</b> Because Fossil accepts forum posts
19 only via the web UI, it is inherently [./antibot.wiki | protected
20 against bots].
 
21
22 * <b>Distributed and Tamper-Proof:</b> Posts are stored in the Fossil
23 repository using the same [./fileformat.wiki | block chain technology]
24 that Fossil uses to store your check-ins, wiki documents, etc.
25 Posts sync to cloned repositories in a tamper-proof fashion.
26
27 * <b>Space Efficient:</b> Because of Fossil's [./delta_format.wiki |
28 delta compression technology], discussions add little to the size
29 of a cloned repository. Ten years of the SQLite project's
30 discussions — averaging about 2 dozen posts per day — compress down
31 to [https://fossil-scm.org/forum/forumpost/9b6f3f36bdb | just
32 35&nbsp;MB of space] in a Fossil forum repository.
33
34 * <b>Built-in Full-Text Search:</b> Fossil forums use
35 [https://sqlite.org/fts3.html | SQLite's powerful FTS4 engine] to
36 handle searches. If your project currently uses a mailing list for
37 discussions, this means you are no longer reliant upon third-party
38 mailing list archive services to provide a useful search engine for
39 your discussions. If you are running a private Fossil repository,
40 you may not even have the <em>option</em> of delegating this useful
41 service to a third-party; Fossil provides this service out of the
42 box.
43
44 * <b>One Result Per Matching Post:</b> When you search the forum
45 archives via the Fossil web interface, you get only one result for
46 each matching post. When you search for project information via a
47 standard web search engine, you might get a result from the project
48 site's own mail archive plus one from Nabble, one from Gmane, one
49 from The Mail Archive...
50
51 * <b>Search Off-Line:</b> Because Fossil is a [./concepts.wiki |
52 distributed version control system], project members can search
53 your forum archive while disconnected from the network where the
54 central Fossil instance runs. Your past discussions are potentially
55 just as valuable as a wiki document or checkin comment: there is no
56 good reason why you should have to wait to get back on the Internet
57 or back to the office before you can search for past posts.
58
59 * <b>Contribute Off-Line:</b> Fossil forum posts work like any other
60 insertion into the repository, so a user can create new threads and
61 reply to existing ones while off-line, then sync their
62 contributions to the server they cloned from when back on-line.
63 Yes, you can post to the forum from inside a tent, miles from the
64 nearest WiFi router or cellular data tower.
65
66 * <b>Interlink with Other Fossil-Managed Artifacts:</b> Because forum
67 posts are normal Fossil artifacts, you can interlink them with
68 other Fossil artifacts using short internal links: link to forum
69 threads from a [./tickets.wiki | ticket], link to a wiki document
70 from a forum post, etc.
71
72 * <b>Durable Links:</b> Once you create a valid internal artifact
73 link in Fossil, it <em>remains</em> valid, durably. With
74 third-party forum software and mailing list search engines, your
75 links are only valid until the third-party component changes its
76 URL scheme or disappears from the web.
77
78 * <b>Role-Based Access Control:</b> The forum uses the same
79 [./caps/ | capability-based access control
80 system] that Fossil uses to control all other repository accesses.
81 The Fossil forum feature simply adds [./caps/ref.html#2 | several new fine-grained
82 capabilities] to the existing system.
83
84 * <b>Enduring, Open File Format:</b> Since Fossil has an
85 [./fileformat.wiki | open and well-documented file format], your
86 discussion archives are truly that: <em>archives</em>. You are no
87 longer dependent on the lifetime and business model of a
88 third-party piece of software or service. Should you choose to stop
89 using Fossil, you can easily extract your discussion traffic for
90 transfer to another system.
91
92 * <b>Lightweight Markup:</b> Posts can be marked up using Fossil's
93 existing [/md_rules | Markdown] and [/wiki_rules | Wiki] markup
94 processors. No longer must you choose between two bad options: to
95 restrict posts to plain text only or to allow wild-west
96 HTML-formatted MIME email. Fossil's lightweight markup language
97 formatting features give you a middle path, providing your users
98 enough formatting power to communicate complex ideas well without
99 providing so much power as to risk
100 [https://wonko.com/post/html-escaping | security problems].
101
102 * <b>Easy Email Alerts:</b> You can configure Fossil to
103 [./alerts.md | send email alerts]. Forum post emails include the
104 complete message content for the benefit of those that prefer to
105 visit the forum only when they need to post something. Alerts are
106 optional, and each user gets the choice of immediate or daily
107 digest delivery.
108
109
110 <h2 id="setup">Setting up a Fossil Forum</h2>
111
112 <h3 id="caps">Capabilities</h3>
113
114
--- www/forum.wiki
+++ www/forum.wiki
@@ -1,113 +1,68 @@
1 <title>Fossil Forums</title>
2
3 <h2>Introduction</h2>
4
5 Fossil includes a built-in discussion forum, designed to substitute
6 for a mailing list. Email notification is available to receive posts,
7 but the web-based UI must be used to enter new posts. Advantages of
8 the forum include:
9
10 * <b>Easy to Administer:</b> If you have already set up a
11 [./server/|Fossil server] with [./alerts.md|email alerts]
12 then turning on the forum feature
13 is just a matter of flipping some permission bits. There is
14 no new software to install and configure, and the same logins
15 and passwords work.
16
17 * <b>Consistent Display:</b> Forum posts can be in [/md_rules|Markdown],
18 [/wiki_rules|Fossil Wiki], or plain text. Whichever format is used, the result is
19 displayed consistently across all platforms and operating systems and
20 between mobile devices and desktops.
21
22 * <b>Editable:</b> Forum posts can be amended after they are sent,
23 to fix typos or provide updates. The original posts are preserved
24 as part of the historical record, but only the amended posts are
25 displayed by default.
26
27 * <b>Built-in Full-Text Search:</b> Forum posts can be included in
28 the index used by the built-in Fossil search logic.
29
30 * <b>Off-Line Access:</b> Because forum posts are synced along with
31 all other artifacts, you can search the forum, or add new posts, or
32 edit existing posts, all while off-line.
33
34 * <b>Automatically Cross-Referenced To Other Fossil Artifacts:</b> Because forum
35 posts are normal Fossil artifacts, you can link from them to
36 other Fossil artifacts (check-ins, wiki, tickets) and from those other
37 artifacts to forum posts. The reverse links are recognized and
38 displayed automatically on the receiver.
39
40 * <b>Malefactor Resistant:</b> Because Fossil accepts forum posts
41 only via the web UI, it is more resistent to spam. Passers-by
42 can post to the forum anonymously (subject to moderation), without
43 the hassle of a sign-up process.
44
45 * <b>Distributed and Tamper-Proof:</b> Posts are stored in the Fossil
46 repository using the same [./fileformat.wiki | DAG/Merkle-tree design]
47 that Fossil uses to store your check-ins, wiki documents, etc.
48 Forum posts sync to cloned repositories.
49
50 <h2>Example Installations</h2>
51
52 Both the [forum:/forum|Fossil project itself] and the
53 [https://sqlite.org/forum/forum|SQLite project] use the Fossil forum in place
54 of mailing lists. The forum has worked well on both projects. The ability
55 to post anonymously provides a low-resistance path for people to report
56 problems, resulting in more problems being reported and fixed.
57 The ability to moderate and amend forum posts means that the
58 forums contain better information. And backups and archives
59 are as easy as running "clone".
60
61 Both Fossil and SQLite keep their forums as separate repositories.
62 But there is no requirement to do this. A forum can be coresident in
63 the same repository with the source code.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
65 <h2 id="setup">Setting up a Fossil Forum</h2>
66
67 <h3 id="caps">Capabilities</h3>
68
69
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -38,11 +38,11 @@
3838
3939
<blockquote><table border=1 cellpadding=5 align=center>
4040
<tr><th width="49%">GIT</th><th width="49%">FOSSIL</th><th width="2%">more</th></tr>
4141
<tr>
4242
<td>File versioning only</td>
43
- <td>VCS, tickets, wiki, docs, notes, forum, UI,
43
+ <td>VCS, tickets, wiki, docs, notes, forum, chat, UI,
4444
[https://en.wikipedia.org/wiki/Role-based_access_control|RBAC]</td>
4545
<td><a href="#features">2.1&nbsp;&darr;</a></td>
4646
</tr>
4747
<tr>
4848
<td>A federation of many small programs</td>
@@ -105,11 +105,12 @@
105105
106106
Git provides file versioning services only, whereas Fossil adds
107107
an integrated [./wikitheory.wiki | wiki],
108108
[./bugtheory.wiki | ticketing &amp; bug tracking],
109109
[./embeddeddoc.wiki | embedded documentation],
110
-[./event.wiki | technical notes], and a [./forum.wiki | web forum],
110
+[./event.wiki | technical notes], a [./forum.wiki | web forum],
111
+and a [./chat.md | chat service],
111112
all within a single nicely-designed [./customskin.md|skinnable] web
112113
[/help?cmd=ui|UI],
113114
protected by [./caps/ | a fine-grained role-based
114115
access control system].
115116
These additional capabilities are available for Git as 3rd-party
@@ -167,11 +168,11 @@
167168
not expected to build Git from source and install it themselves.
168169
169170
Fossil is a single self-contained stand-alone executable which by default
170171
depends only on common platform libraries. You can statically link
171172
to get an executable with no external dependencies at all &mdash; a useful
172
-feature for running inside of restrictive
173
+feature for running inside a restrictive
173174
[https://en.wikipedia.org/wiki/Chroot|chroot jail].
174175
175176
The precompiled Fossil binaries are delivered as just a single
176177
executable. The precompiled Windows deliveries are just a ZIP archive
177178
containing only "<tt>fossil.exe</tt>". There is no "<tt>setup.exe</tt>"
@@ -225,11 +226,11 @@
225226
technology choices: Ruby and PostgreSQL vs C and SQLite.
226227
227228
The Fossil project itself is [./selfhost.wiki|hosted on a small and
228229
inexpensive VPS]. A bare-bones $5/month VPS or a
229230
spare Raspberry Pi is sufficient to run a full-up project
230
-site, complete with tickets, wiki, and forum, in addition to
231
+site, complete with tickets, wiki, chat, and forum, in addition to
231232
being a code repository.
232233
233234
<h3 id="durable" name="database">2.3 Query Language</h3>
234235
235236
The baseline data structures for Fossil and Git are the same, modulo
@@ -257,11 +258,11 @@
257258
check-in. It is so difficult, in fact, that neither native Git nor
258259
GitHub provide this capability short of crawling the
259260
[https://www.git-scm.com/docs/git-log|commit log]. With Fossil,
260261
on the other hand, finding descendents is a simple SQL query.
261262
It is common in Fossil to ask to see
262
-[/timeline?d=release&n=all&y=ci&nd|all check-ins since the last release].
263
+[/timeline?df=release&y=ci|all check-ins since the last release].
263264
Git lets you see "what came before". Fossil makes it just as
264265
easy to also see "what came after".
265266
266267
Leaf check-ins in Git that lack a "ref" become "detached," making them
267268
difficult to locate and subject to garbage collection. This
@@ -401,10 +402,18 @@
401402
private branches, so that a Git repo clone often isn't really a clone at
402403
all: it may have an arbitrary number of differences relative to the
403404
repository it originally cloned from. Git encourages siloed development.
404405
Select work in a developer's local repository may remain private
405406
indefinitely.
407
+
408
+The Git preference for siloed development has been strongly adopted by Github,
409
+who say
410
+"[https://guides.github.com/activities/forking|Forking is at the core of social coding at GitHub]".
411
+As a result, as of January 2021,
412
+[https://github.com/search?q=is:public|Github hosts 43 million distinct software projects],
413
+most of them created as a results of Git/Github forking and very many
414
+of them discontinued.
406415
407416
All of this is exactly what one wants when doing bazaar-style
408417
development.
409418
410419
Fossil's normal mode of operation differs on every one of these points,
@@ -537,11 +546,11 @@
537546
538547
539548
<h4 id="contrib">2.5.3 Accepting Contributions</h4>
540549
541550
As of this writing, Git has received about 4.5 times as many commits as
542
-Fossil resulting in about 2.5times as many lines of source code. The line
551
+Fossil resulting in about 2.5 times as many lines of source code. The line
543552
count excludes tests and in-tree third-party dependencies. It does not
544553
exclude the default GUI for each, since it's integral for Fossil, so we
545554
count the size of <tt>gitk</tt> in this.
546555
547556
It is obvious that Git is bigger in part because of its first-mover
@@ -939,11 +948,14 @@
939948
hosted as [https://fossil-scm.org/forum/|a separate Fossil repo]
940949
from the [https://fossil-scm.org/fossil/|main Fossil self-hosting
941950
repo] for administration reasons, and the Download page content
942951
isn't normally synchronized with a "<tt>fossil clone</tt>" command unless
943952
you add the "-u" option. (See "[./aboutdownload.wiki|How the
944
- Download Page Works]" for details.) There may also be some purely
953
+ Download Page Works]" for details.)
954
+ Chat history is deliberately not synced as
955
+ chat messages are intended to be ephemeral.
956
+ There may also be some purely
945957
static elements of the web site served via D. Richard Hipp's own
946958
lightweight web server,
947959
<tt>[https://sqlite.org/althttpd/|althttpd]</tt>,
948960
which is configured as a front end to Fossil running in CGI mode on
949961
these sites.
950962
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -38,11 +38,11 @@
38
39 <blockquote><table border=1 cellpadding=5 align=center>
40 <tr><th width="49%">GIT</th><th width="49%">FOSSIL</th><th width="2%">more</th></tr>
41 <tr>
42 <td>File versioning only</td>
43 <td>VCS, tickets, wiki, docs, notes, forum, UI,
44 [https://en.wikipedia.org/wiki/Role-based_access_control|RBAC]</td>
45 <td><a href="#features">2.1&nbsp;&darr;</a></td>
46 </tr>
47 <tr>
48 <td>A federation of many small programs</td>
@@ -105,11 +105,12 @@
105
106 Git provides file versioning services only, whereas Fossil adds
107 an integrated [./wikitheory.wiki | wiki],
108 [./bugtheory.wiki | ticketing &amp; bug tracking],
109 [./embeddeddoc.wiki | embedded documentation],
110 [./event.wiki | technical notes], and a [./forum.wiki | web forum],
 
111 all within a single nicely-designed [./customskin.md|skinnable] web
112 [/help?cmd=ui|UI],
113 protected by [./caps/ | a fine-grained role-based
114 access control system].
115 These additional capabilities are available for Git as 3rd-party
@@ -167,11 +168,11 @@
167 not expected to build Git from source and install it themselves.
168
169 Fossil is a single self-contained stand-alone executable which by default
170 depends only on common platform libraries. You can statically link
171 to get an executable with no external dependencies at all &mdash; a useful
172 feature for running inside of restrictive
173 [https://en.wikipedia.org/wiki/Chroot|chroot jail].
174
175 The precompiled Fossil binaries are delivered as just a single
176 executable. The precompiled Windows deliveries are just a ZIP archive
177 containing only "<tt>fossil.exe</tt>". There is no "<tt>setup.exe</tt>"
@@ -225,11 +226,11 @@
225 technology choices: Ruby and PostgreSQL vs C and SQLite.
226
227 The Fossil project itself is [./selfhost.wiki|hosted on a small and
228 inexpensive VPS]. A bare-bones $5/month VPS or a
229 spare Raspberry Pi is sufficient to run a full-up project
230 site, complete with tickets, wiki, and forum, in addition to
231 being a code repository.
232
233 <h3 id="durable" name="database">2.3 Query Language</h3>
234
235 The baseline data structures for Fossil and Git are the same, modulo
@@ -257,11 +258,11 @@
257 check-in. It is so difficult, in fact, that neither native Git nor
258 GitHub provide this capability short of crawling the
259 [https://www.git-scm.com/docs/git-log|commit log]. With Fossil,
260 on the other hand, finding descendents is a simple SQL query.
261 It is common in Fossil to ask to see
262 [/timeline?d=release&n=all&y=ci&nd|all check-ins since the last release].
263 Git lets you see "what came before". Fossil makes it just as
264 easy to also see "what came after".
265
266 Leaf check-ins in Git that lack a "ref" become "detached," making them
267 difficult to locate and subject to garbage collection. This
@@ -401,10 +402,18 @@
401 private branches, so that a Git repo clone often isn't really a clone at
402 all: it may have an arbitrary number of differences relative to the
403 repository it originally cloned from. Git encourages siloed development.
404 Select work in a developer's local repository may remain private
405 indefinitely.
 
 
 
 
 
 
 
 
406
407 All of this is exactly what one wants when doing bazaar-style
408 development.
409
410 Fossil's normal mode of operation differs on every one of these points,
@@ -537,11 +546,11 @@
537
538
539 <h4 id="contrib">2.5.3 Accepting Contributions</h4>
540
541 As of this writing, Git has received about 4.5 times as many commits as
542 Fossil resulting in about 2.5times as many lines of source code. The line
543 count excludes tests and in-tree third-party dependencies. It does not
544 exclude the default GUI for each, since it's integral for Fossil, so we
545 count the size of <tt>gitk</tt> in this.
546
547 It is obvious that Git is bigger in part because of its first-mover
@@ -939,11 +948,14 @@
939 hosted as [https://fossil-scm.org/forum/|a separate Fossil repo]
940 from the [https://fossil-scm.org/fossil/|main Fossil self-hosting
941 repo] for administration reasons, and the Download page content
942 isn't normally synchronized with a "<tt>fossil clone</tt>" command unless
943 you add the "-u" option. (See "[./aboutdownload.wiki|How the
944 Download Page Works]" for details.) There may also be some purely
 
 
 
945 static elements of the web site served via D. Richard Hipp's own
946 lightweight web server,
947 <tt>[https://sqlite.org/althttpd/|althttpd]</tt>,
948 which is configured as a front end to Fossil running in CGI mode on
949 these sites.
950
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -38,11 +38,11 @@
38
39 <blockquote><table border=1 cellpadding=5 align=center>
40 <tr><th width="49%">GIT</th><th width="49%">FOSSIL</th><th width="2%">more</th></tr>
41 <tr>
42 <td>File versioning only</td>
43 <td>VCS, tickets, wiki, docs, notes, forum, chat, UI,
44 [https://en.wikipedia.org/wiki/Role-based_access_control|RBAC]</td>
45 <td><a href="#features">2.1&nbsp;&darr;</a></td>
46 </tr>
47 <tr>
48 <td>A federation of many small programs</td>
@@ -105,11 +105,12 @@
105
106 Git provides file versioning services only, whereas Fossil adds
107 an integrated [./wikitheory.wiki | wiki],
108 [./bugtheory.wiki | ticketing &amp; bug tracking],
109 [./embeddeddoc.wiki | embedded documentation],
110 [./event.wiki | technical notes], a [./forum.wiki | web forum],
111 and a [./chat.md | chat service],
112 all within a single nicely-designed [./customskin.md|skinnable] web
113 [/help?cmd=ui|UI],
114 protected by [./caps/ | a fine-grained role-based
115 access control system].
116 These additional capabilities are available for Git as 3rd-party
@@ -167,11 +168,11 @@
168 not expected to build Git from source and install it themselves.
169
170 Fossil is a single self-contained stand-alone executable which by default
171 depends only on common platform libraries. You can statically link
172 to get an executable with no external dependencies at all &mdash; a useful
173 feature for running inside a restrictive
174 [https://en.wikipedia.org/wiki/Chroot|chroot jail].
175
176 The precompiled Fossil binaries are delivered as just a single
177 executable. The precompiled Windows deliveries are just a ZIP archive
178 containing only "<tt>fossil.exe</tt>". There is no "<tt>setup.exe</tt>"
@@ -225,11 +226,11 @@
226 technology choices: Ruby and PostgreSQL vs C and SQLite.
227
228 The Fossil project itself is [./selfhost.wiki|hosted on a small and
229 inexpensive VPS]. A bare-bones $5/month VPS or a
230 spare Raspberry Pi is sufficient to run a full-up project
231 site, complete with tickets, wiki, chat, and forum, in addition to
232 being a code repository.
233
234 <h3 id="durable" name="database">2.3 Query Language</h3>
235
236 The baseline data structures for Fossil and Git are the same, modulo
@@ -257,11 +258,11 @@
258 check-in. It is so difficult, in fact, that neither native Git nor
259 GitHub provide this capability short of crawling the
260 [https://www.git-scm.com/docs/git-log|commit log]. With Fossil,
261 on the other hand, finding descendents is a simple SQL query.
262 It is common in Fossil to ask to see
263 [/timeline?df=release&y=ci|all check-ins since the last release].
264 Git lets you see "what came before". Fossil makes it just as
265 easy to also see "what came after".
266
267 Leaf check-ins in Git that lack a "ref" become "detached," making them
268 difficult to locate and subject to garbage collection. This
@@ -401,10 +402,18 @@
402 private branches, so that a Git repo clone often isn't really a clone at
403 all: it may have an arbitrary number of differences relative to the
404 repository it originally cloned from. Git encourages siloed development.
405 Select work in a developer's local repository may remain private
406 indefinitely.
407
408 The Git preference for siloed development has been strongly adopted by Github,
409 who say
410 "[https://guides.github.com/activities/forking|Forking is at the core of social coding at GitHub]".
411 As a result, as of January 2021,
412 [https://github.com/search?q=is:public|Github hosts 43 million distinct software projects],
413 most of them created as a results of Git/Github forking and very many
414 of them discontinued.
415
416 All of this is exactly what one wants when doing bazaar-style
417 development.
418
419 Fossil's normal mode of operation differs on every one of these points,
@@ -537,11 +546,11 @@
546
547
548 <h4 id="contrib">2.5.3 Accepting Contributions</h4>
549
550 As of this writing, Git has received about 4.5 times as many commits as
551 Fossil resulting in about 2.5 times as many lines of source code. The line
552 count excludes tests and in-tree third-party dependencies. It does not
553 exclude the default GUI for each, since it's integral for Fossil, so we
554 count the size of <tt>gitk</tt> in this.
555
556 It is obvious that Git is bigger in part because of its first-mover
@@ -939,11 +948,14 @@
948 hosted as [https://fossil-scm.org/forum/|a separate Fossil repo]
949 from the [https://fossil-scm.org/fossil/|main Fossil self-hosting
950 repo] for administration reasons, and the Download page content
951 isn't normally synchronized with a "<tt>fossil clone</tt>" command unless
952 you add the "-u" option. (See "[./aboutdownload.wiki|How the
953 Download Page Works]" for details.)
954 Chat history is deliberately not synced as
955 chat messages are intended to be ephemeral.
956 There may also be some purely
957 static elements of the web site served via D. Richard Hipp's own
958 lightweight web server,
959 <tt>[https://sqlite.org/althttpd/|althttpd]</tt>,
960 which is configured as a front end to Fossil running in CGI mode on
961 these sites.
962
--- www/fossil3.gif
+++ www/fossil3.gif
cannot compute difference between binary files
11
--- www/fossil3.gif
+++ www/fossil3.gif
0 annot compute difference between binary files
1
--- www/fossil3.gif
+++ www/fossil3.gif
0 annot compute difference between binary files
1
+86 -35
--- www/gitusers.md
+++ www/gitusers.md
@@ -1,18 +1,25 @@
11
# Git to Fossil Translation Guide
22
33
## Introduction
44
5
-This document attempts to provide equivalents for common Git commands
6
-and workflows where possible, and where not, to explain those cases.
7
-
8
-Although Fossil shares many similarities with Git, there are enough
9
-differences that we can’t provide a simple “translation dictionary” for
10
-some commands. This document is more concerned with those cases than the
11
-simple 1:1 mappings, which you can likely find on your own. In many
12
-cases, the sub-commands are identical: [`fossil bisect`][bis] does essentially
13
-the same thing as `git bisect`, for example.
5
+Fossil shares many similarities with Git. In many cases, the
6
+sub-commands are identical: [`fossil bisect`][fbis] does essentially the
7
+same thing as [`git bisect`][gbis], for example.
8
+
9
+This document covers the cases where there is no simple 1:1 mapping,
10
+usually because of intentional design differences in Fossil that prevent
11
+it from working exactly like Git. We choose to explain these differences
12
+rather than provide a simple “translation dictionary,” since to
13
+understand the conversion, you need to know why the difference exists.
14
+
15
+We focus on practical command examples here, leaving discussions of the
16
+philosophical underpinnings drive these command differences to [another
17
+document][fvg]. The [case studies](#cs1) do get a bit philosophical, but
18
+it is with the aim of illustrating how these Fossil design differences
19
+cause Fossil to behave materially differently from Git in everyday
20
+operation.
1421
1522
We present this from the perspective of Git users moving to Fossil, but
1623
it is also possible to read this document as a Fossil user who speaks
1724
only pidgin Git, who may often have questions of the form, “Now how do I
1825
do X in Git again?”
@@ -26,14 +33,12 @@
2633
While we do try to explain Fossil-specific terminology inline here
2734
as-needed, you may find it helpful to skim [the Fossil glossary][gloss].
2835
It will give you another take on our definitions here, and it may help
2936
you to understand some of the other Fossil docs better.
3037
31
-We focus more on practical command examples here than on [the
32
-philosophical underpinnings][fvg] that drive these differences.
33
-
34
-[bis]: /help?cmd=bisect
38
+[fbis]: /help?cmd=bisect
39
+[gbis]: https://git-scm.com/docs/git-bisect
3540
[ffor]: https://fossil-scm.org/forum
3641
[fvg]: ./fossil-v-git.wiki
3742
3843
3944
<a id="mwd"></a>
@@ -69,30 +74,53 @@
6974
7075
…is best given as:
7176
7277
fossil update some-branch
7378
74
-…in Fossil. There is a `fossil checkout` command, but it has two
75
-restrictions that push you toward using `fossil update` instead:
76
-
77
-1. Several features in `fossil update` do not exist in
78
- `fossil checkout`.
79
-
80
-2. The lone exception is `fossil checkout --keep`, a rarely-needed
81
- operation.
82
-
83
-3. Fossil will have you typing “`fossil up`” frequently anyway to pull
84
- remote changes and merge them into the local check-out directory.
85
- Adding a `VERSION` string for the cases where you mean something
86
- other than “tip of the current branch” is an easy habit to develop.
87
-
88
-Neither command is an alias for the other. They overlap enough that they
89
-can be used interchangeably for everyday use cases, but since `update`
90
-is more powerful, we recommend that you break the habit of typing
91
-`checkout`.
79
+…in Fossil. There is a [`fossil checkout`][co] command, but it has
80
+[several differences](./co-vs-up.md) that make it less broadly useful
81
+than [`fossil update`][up] in everyday operation, so we recommend that
82
+Git users moving to Fossil develop a habit of typing `fossil up` rather
83
+than `fossil checkout`. That said, one of those differences does match
84
+up with Git users’ expectations: `fossil checkout` doesn’t pull changes
85
+from the remote repository into the local clone as `fossil update` does.
86
+We think this is less broadly useful, but that’s the subject of the next
87
+section.
9288
9389
[ckwf]: ./ckout-workflows.md
90
+[co]: /help?cmd=checkout
91
+
92
+
93
+#### <a id="pullup"></a> Update vs Pull
94
+
95
+The closest equivalent to [`git pull`][gpull] is [`fossil up`][up],
96
+since Fossil tends to follow the CVS command design: `cvs up` pulls
97
+changes from the central CVS repository and merges them into the local
98
+working directory, so that’s what `fossil up` does, too.
99
+
100
+There is a `fossil pull` command, but it is simply the reverse of
101
+`fossil push`, so that `fossil sync` [is functionally equivalent
102
+to](./sync.wiki#sync):
103
+
104
+ fossil push ; fossil pull
105
+
106
+There is no “and update the local working directory” step in Fossil’s
107
+push, pull, or sync commands, as with `git pull`.
108
+
109
+This makes `fossil up` dual-use:
110
+
111
+* Without the optional `VERSION` argument, it updates the working
112
+ checkout to the tip of the current branch.
113
+
114
+* With that argument, it updates to the named version. If that’s the
115
+ name of a branch, it updates to the tip of that branch rather than
116
+ the current one.
117
+
118
+We think this is a more sensible command design than `git checkout` vs
119
+`git pull`.
120
+
121
+[gpull]: https://git-scm.com/docs/git-pull
94122
95123
96124
#### <a id="rname"></a> Naming Repositories
97125
98126
The Fossil repository database file can be named anything
@@ -634,11 +662,12 @@
634662
"`master`" branch in stock Git or to [the “`main`” branch in GitHub][mbgh].
635663
636664
Because the `fossil git export` command has to work with both stock Git
637665
and with GitHub, Fossil uses Git’s traditional default rather than
638666
GitHub’s new default: your Fossil repo’s “trunk” branch becomes “master”
639
-when [mirroring to GitHub][mirgh], not “main.”
667
+when [mirroring to GitHub][mirgh] unless you give the `--mainbranch`
668
+option added in Fossil 2.14.
640669
641670
We do not know what happens on subsequent exports if you later rename
642671
this branch on the GitHub side.
643672
644673
[mbgh]: https://github.com/github/renaming
@@ -674,10 +703,32 @@
674703
compatible with Fossil yet which currently has no functional equivalent.
675704
We cover [this and the workaround for it](#csplit) above.
676705
677706
[3]: ./rebaseharm.md
678707
708
+
709
+## <a name="cdiff"></a> Colorized Diffs
710
+
711
+The graphical diffs in the Fossil web UI and `fossil diff --tk` use
712
+color to distinguish insertions, deletions, and replacements, but unlike
713
+with `git diff` when the output is to an ANSI X3.64 capable terminal,
714
+`fossil diff` does not.
715
+
716
+There’s an easy way to add this feature to Fossil, though: install
717
+[`colordiff`][cdiff], which is included in [many package systems][cdpkg],
718
+then say:
719
+
720
+ fossil set --global diff-command 'colordiff -wu'
721
+
722
+Because this is unconditional, unlike `git diff --color=auto`, you will
723
+then have to remember to add the `-i` option to `fossil diff` commands
724
+when you want color disabled, such as when piping diff output to another
725
+command that doesn’t understand ANSI escape sequences. There’s an
726
+example of this [below](#dstat).
727
+
728
+[cdpkg]: https://repology.org/project/colordiff/versions
729
+
679730
680731
## <a id="show"></a> Showing Information About Commits
681732
682733
While there is no direct equivalent to Git’s “`show`” command, similar
683734
functionality may be present in Fossil under other commands:
@@ -741,11 +792,11 @@
741792
742793
We gave the `-i` flag in both cases to force Fossil to use its internal
743794
diff implementation, bypassing [your local `diff-command` setting][dcset].
744795
The `--numstat` option has no effect when you have an external diff
745796
command set, and some diff command alternatives like
746
-[`colordiff`][cdiff] produce output that confuses `diffstat`.
797
+[`colordiff`][cdiff] (covered [above](#cdiff)) produce output that confuses `diffstat`.
747798
748799
If you leave off the `-N` flag in the second example, the `diffstat`
749800
output won’t include info about any newly-added files.
750801
751802
[cdiff]: https://www.colordiff.org/
@@ -827,11 +878,11 @@
827878
828879
Why would you want to check out a version of a project by date? Perhaps
829880
because your customer gave you a vague bug report referencing only a
830881
date rather than a version. Or, you may be poking semi-randomly through
831882
history to find a “good” version to anchor the start point of a
832
-[`bisect`][bis] operation.
883
+[`fossil bisect`][fbis] operation.
833884
834885
My search engine’s first result for “git checkout by date” is [this
835886
highly-upvoted accepted Stack Overflow answer][gcod]. The first command
836887
it gives is based on Git’s [`rev-parse` feature][grp]:
837888
@@ -846,11 +897,11 @@
846897
847898
2. A date string in Git without a time will be interpreted as
848899
“[at the local wall clock time on the given date][gapxd],” so the
849900
command means something different from one second to the next. This
850901
can be a problem if there are multiple commits on that date, because
851
- the command will give diffferent results depending on the time of
902
+ the command will give different results depending on the time of
852903
day you run it.
853904
854905
3. It gives misleading output if there is no close match for the date
855906
in the local [reflog]. It starts out empty after a fresh clone, and
856907
while it does build up as you use that clone, Git [automatically
857908
--- www/gitusers.md
+++ www/gitusers.md
@@ -1,18 +1,25 @@
1 # Git to Fossil Translation Guide
2
3 ## Introduction
4
5 This document attempts to provide equivalents for common Git commands
6 and workflows where possible, and where not, to explain those cases.
7
8 Although Fossil shares many similarities with Git, there are enough
9 differences that we can’t provide a simple “translation dictionary” for
10 some commands. This document is more concerned with those cases than the
11 simple 1:1 mappings, which you can likely find on your own. In many
12 cases, the sub-commands are identical: [`fossil bisect`][bis] does essentially
13 the same thing as `git bisect`, for example.
 
 
 
 
 
 
 
14
15 We present this from the perspective of Git users moving to Fossil, but
16 it is also possible to read this document as a Fossil user who speaks
17 only pidgin Git, who may often have questions of the form, “Now how do I
18 do X in Git again?”
@@ -26,14 +33,12 @@
26 While we do try to explain Fossil-specific terminology inline here
27 as-needed, you may find it helpful to skim [the Fossil glossary][gloss].
28 It will give you another take on our definitions here, and it may help
29 you to understand some of the other Fossil docs better.
30
31 We focus more on practical command examples here than on [the
32 philosophical underpinnings][fvg] that drive these differences.
33
34 [bis]: /help?cmd=bisect
35 [ffor]: https://fossil-scm.org/forum
36 [fvg]: ./fossil-v-git.wiki
37
38
39 <a id="mwd"></a>
@@ -69,30 +74,53 @@
69
70 …is best given as:
71
72 fossil update some-branch
73
74 …in Fossil. There is a `fossil checkout` command, but it has two
75 restrictions that push you toward using `fossil update` instead:
76
77 1. Several features in `fossil update` do not exist in
78 `fossil checkout`.
79
80 2. The lone exception is `fossil checkout --keep`, a rarely-needed
81 operation.
82
83 3. Fossil will have you typing “`fossil up`” frequently anyway to pull
84 remote changes and merge them into the local check-out directory.
85 Adding a `VERSION` string for the cases where you mean something
86 other than “tip of the current branch” is an easy habit to develop.
87
88 Neither command is an alias for the other. They overlap enough that they
89 can be used interchangeably for everyday use cases, but since `update`
90 is more powerful, we recommend that you break the habit of typing
91 `checkout`.
92
93 [ckwf]: ./ckout-workflows.md
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
95
96 #### <a id="rname"></a> Naming Repositories
97
98 The Fossil repository database file can be named anything
@@ -634,11 +662,12 @@
634 "`master`" branch in stock Git or to [the “`main`” branch in GitHub][mbgh].
635
636 Because the `fossil git export` command has to work with both stock Git
637 and with GitHub, Fossil uses Git’s traditional default rather than
638 GitHub’s new default: your Fossil repo’s “trunk” branch becomes “master”
639 when [mirroring to GitHub][mirgh], not “main.”
 
640
641 We do not know what happens on subsequent exports if you later rename
642 this branch on the GitHub side.
643
644 [mbgh]: https://github.com/github/renaming
@@ -674,10 +703,32 @@
674 compatible with Fossil yet which currently has no functional equivalent.
675 We cover [this and the workaround for it](#csplit) above.
676
677 [3]: ./rebaseharm.md
678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
679
680 ## <a id="show"></a> Showing Information About Commits
681
682 While there is no direct equivalent to Git’s “`show`” command, similar
683 functionality may be present in Fossil under other commands:
@@ -741,11 +792,11 @@
741
742 We gave the `-i` flag in both cases to force Fossil to use its internal
743 diff implementation, bypassing [your local `diff-command` setting][dcset].
744 The `--numstat` option has no effect when you have an external diff
745 command set, and some diff command alternatives like
746 [`colordiff`][cdiff] produce output that confuses `diffstat`.
747
748 If you leave off the `-N` flag in the second example, the `diffstat`
749 output won’t include info about any newly-added files.
750
751 [cdiff]: https://www.colordiff.org/
@@ -827,11 +878,11 @@
827
828 Why would you want to check out a version of a project by date? Perhaps
829 because your customer gave you a vague bug report referencing only a
830 date rather than a version. Or, you may be poking semi-randomly through
831 history to find a “good” version to anchor the start point of a
832 [`bisect`][bis] operation.
833
834 My search engine’s first result for “git checkout by date” is [this
835 highly-upvoted accepted Stack Overflow answer][gcod]. The first command
836 it gives is based on Git’s [`rev-parse` feature][grp]:
837
@@ -846,11 +897,11 @@
846
847 2. A date string in Git without a time will be interpreted as
848 “[at the local wall clock time on the given date][gapxd],” so the
849 command means something different from one second to the next. This
850 can be a problem if there are multiple commits on that date, because
851 the command will give diffferent results depending on the time of
852 day you run it.
853
854 3. It gives misleading output if there is no close match for the date
855 in the local [reflog]. It starts out empty after a fresh clone, and
856 while it does build up as you use that clone, Git [automatically
857
--- www/gitusers.md
+++ www/gitusers.md
@@ -1,18 +1,25 @@
1 # Git to Fossil Translation Guide
2
3 ## Introduction
4
5 Fossil shares many similarities with Git. In many cases, the
6 sub-commands are identical: [`fossil bisect`][fbis] does essentially the
7 same thing as [`git bisect`][gbis], for example.
8
9 This document covers the cases where there is no simple 1:1 mapping,
10 usually because of intentional design differences in Fossil that prevent
11 it from working exactly like Git. We choose to explain these differences
12 rather than provide a simple “translation dictionary,” since to
13 understand the conversion, you need to know why the difference exists.
14
15 We focus on practical command examples here, leaving discussions of the
16 philosophical underpinnings drive these command differences to [another
17 document][fvg]. The [case studies](#cs1) do get a bit philosophical, but
18 it is with the aim of illustrating how these Fossil design differences
19 cause Fossil to behave materially differently from Git in everyday
20 operation.
21
22 We present this from the perspective of Git users moving to Fossil, but
23 it is also possible to read this document as a Fossil user who speaks
24 only pidgin Git, who may often have questions of the form, “Now how do I
25 do X in Git again?”
@@ -26,14 +33,12 @@
33 While we do try to explain Fossil-specific terminology inline here
34 as-needed, you may find it helpful to skim [the Fossil glossary][gloss].
35 It will give you another take on our definitions here, and it may help
36 you to understand some of the other Fossil docs better.
37
38 [fbis]: /help?cmd=bisect
39 [gbis]: https://git-scm.com/docs/git-bisect
 
 
40 [ffor]: https://fossil-scm.org/forum
41 [fvg]: ./fossil-v-git.wiki
42
43
44 <a id="mwd"></a>
@@ -69,30 +74,53 @@
74
75 …is best given as:
76
77 fossil update some-branch
78
79 …in Fossil. There is a [`fossil checkout`][co] command, but it has
80 [several differences](./co-vs-up.md) that make it less broadly useful
81 than [`fossil update`][up] in everyday operation, so we recommend that
82 Git users moving to Fossil develop a habit of typing `fossil up` rather
83 than `fossil checkout`. That said, one of those differences does match
84 up with Git users’ expectations: `fossil checkout` doesn’t pull changes
85 from the remote repository into the local clone as `fossil update` does.
86 We think this is less broadly useful, but that’s the subject of the next
87 section.
 
 
 
 
 
 
 
 
 
88
89 [ckwf]: ./ckout-workflows.md
90 [co]: /help?cmd=checkout
91
92
93 #### <a id="pullup"></a> Update vs Pull
94
95 The closest equivalent to [`git pull`][gpull] is [`fossil up`][up],
96 since Fossil tends to follow the CVS command design: `cvs up` pulls
97 changes from the central CVS repository and merges them into the local
98 working directory, so that’s what `fossil up` does, too.
99
100 There is a `fossil pull` command, but it is simply the reverse of
101 `fossil push`, so that `fossil sync` [is functionally equivalent
102 to](./sync.wiki#sync):
103
104 fossil push ; fossil pull
105
106 There is no “and update the local working directory” step in Fossil’s
107 push, pull, or sync commands, as with `git pull`.
108
109 This makes `fossil up` dual-use:
110
111 * Without the optional `VERSION` argument, it updates the working
112 checkout to the tip of the current branch.
113
114 * With that argument, it updates to the named version. If that’s the
115 name of a branch, it updates to the tip of that branch rather than
116 the current one.
117
118 We think this is a more sensible command design than `git checkout` vs
119 `git pull`.
120
121 [gpull]: https://git-scm.com/docs/git-pull
122
123
124 #### <a id="rname"></a> Naming Repositories
125
126 The Fossil repository database file can be named anything
@@ -634,11 +662,12 @@
662 "`master`" branch in stock Git or to [the “`main`” branch in GitHub][mbgh].
663
664 Because the `fossil git export` command has to work with both stock Git
665 and with GitHub, Fossil uses Git’s traditional default rather than
666 GitHub’s new default: your Fossil repo’s “trunk” branch becomes “master”
667 when [mirroring to GitHub][mirgh] unless you give the `--mainbranch`
668 option added in Fossil 2.14.
669
670 We do not know what happens on subsequent exports if you later rename
671 this branch on the GitHub side.
672
673 [mbgh]: https://github.com/github/renaming
@@ -674,10 +703,32 @@
703 compatible with Fossil yet which currently has no functional equivalent.
704 We cover [this and the workaround for it](#csplit) above.
705
706 [3]: ./rebaseharm.md
707
708
709 ## <a name="cdiff"></a> Colorized Diffs
710
711 The graphical diffs in the Fossil web UI and `fossil diff --tk` use
712 color to distinguish insertions, deletions, and replacements, but unlike
713 with `git diff` when the output is to an ANSI X3.64 capable terminal,
714 `fossil diff` does not.
715
716 There’s an easy way to add this feature to Fossil, though: install
717 [`colordiff`][cdiff], which is included in [many package systems][cdpkg],
718 then say:
719
720 fossil set --global diff-command 'colordiff -wu'
721
722 Because this is unconditional, unlike `git diff --color=auto`, you will
723 then have to remember to add the `-i` option to `fossil diff` commands
724 when you want color disabled, such as when piping diff output to another
725 command that doesn’t understand ANSI escape sequences. There’s an
726 example of this [below](#dstat).
727
728 [cdpkg]: https://repology.org/project/colordiff/versions
729
730
731 ## <a id="show"></a> Showing Information About Commits
732
733 While there is no direct equivalent to Git’s “`show`” command, similar
734 functionality may be present in Fossil under other commands:
@@ -741,11 +792,11 @@
792
793 We gave the `-i` flag in both cases to force Fossil to use its internal
794 diff implementation, bypassing [your local `diff-command` setting][dcset].
795 The `--numstat` option has no effect when you have an external diff
796 command set, and some diff command alternatives like
797 [`colordiff`][cdiff] (covered [above](#cdiff)) produce output that confuses `diffstat`.
798
799 If you leave off the `-N` flag in the second example, the `diffstat`
800 output won’t include info about any newly-added files.
801
802 [cdiff]: https://www.colordiff.org/
@@ -827,11 +878,11 @@
878
879 Why would you want to check out a version of a project by date? Perhaps
880 because your customer gave you a vague bug report referencing only a
881 date rather than a version. Or, you may be poking semi-randomly through
882 history to find a “good” version to anchor the start point of a
883 [`fossil bisect`][fbis] operation.
884
885 My search engine’s first result for “git checkout by date” is [this
886 highly-upvoted accepted Stack Overflow answer][gcod]. The first command
887 it gives is based on Git’s [`rev-parse` feature][grp]:
888
@@ -846,11 +897,11 @@
897
898 2. A date string in Git without a time will be interpreted as
899 “[at the local wall clock time on the given date][gapxd],” so the
900 command means something different from one second to the next. This
901 can be a problem if there are multiple commits on that date, because
902 the command will give different results depending on the time of
903 day you run it.
904
905 3. It gives misleading output if there is no close match for the date
906 in the local [reflog]. It starts out empty after a fresh clone, and
907 while it does build up as you use that clone, Git [automatically
908
+2 -2
--- www/globs.md
+++ www/globs.md
@@ -60,11 +60,11 @@
6060
Fossil file names are stored as complete path names. The distinction
6161
between file name and directory name is “below” Fossil in this sense.
6262
6363
[pg]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
6464
65
-The bracket expresssions above require some additional explanation:
65
+The bracket expressions above require some additional explanation:
6666
6767
* A range of characters may be specified with `-`, so `[a-f]` matches
6868
exactly the same characters as `[abcdef]`. Ranges reflect Unicode
6969
code points without any locale-specific collation sequence.
7070
Therefore, this particular sequence never matches the Unicode
@@ -484,11 +484,11 @@
484484
## Experimenting
485485
486486
To preview the effects of command line glob pattern expansion for
487487
various glob patterns (unquoted, quoted, comma-terminated), for any
488488
combination of command shell, OS, C run time, and Fossil version,
489
-preceed the command you want to test with [`test-echo`][] like so:
489
+precede the command you want to test with [`test-echo`][] like so:
490490
491491
$ fossil test-echo setting crlf-glob "*"
492492
C:\> echo * | fossil test-echo setting crlf-glob --args -
493493
494494
The [`test-glob`][] command is also handy to test if a string
495495
--- www/globs.md
+++ www/globs.md
@@ -60,11 +60,11 @@
60 Fossil file names are stored as complete path names. The distinction
61 between file name and directory name is “below” Fossil in this sense.
62
63 [pg]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
64
65 The bracket expresssions above require some additional explanation:
66
67 * A range of characters may be specified with `-`, so `[a-f]` matches
68 exactly the same characters as `[abcdef]`. Ranges reflect Unicode
69 code points without any locale-specific collation sequence.
70 Therefore, this particular sequence never matches the Unicode
@@ -484,11 +484,11 @@
484 ## Experimenting
485
486 To preview the effects of command line glob pattern expansion for
487 various glob patterns (unquoted, quoted, comma-terminated), for any
488 combination of command shell, OS, C run time, and Fossil version,
489 preceed the command you want to test with [`test-echo`][] like so:
490
491 $ fossil test-echo setting crlf-glob "*"
492 C:\> echo * | fossil test-echo setting crlf-glob --args -
493
494 The [`test-glob`][] command is also handy to test if a string
495
--- www/globs.md
+++ www/globs.md
@@ -60,11 +60,11 @@
60 Fossil file names are stored as complete path names. The distinction
61 between file name and directory name is “below” Fossil in this sense.
62
63 [pg]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
64
65 The bracket expressions above require some additional explanation:
66
67 * A range of characters may be specified with `-`, so `[a-f]` matches
68 exactly the same characters as `[abcdef]`. Ranges reflect Unicode
69 code points without any locale-specific collation sequence.
70 Therefore, this particular sequence never matches the Unicode
@@ -484,11 +484,11 @@
484 ## Experimenting
485
486 To preview the effects of command line glob pattern expansion for
487 various glob patterns (unquoted, quoted, comma-terminated), for any
488 combination of command shell, OS, C run time, and Fossil version,
489 precede the command you want to test with [`test-echo`][] like so:
490
491 $ fossil test-echo setting crlf-glob "*"
492 C:\> echo * | fossil test-echo setting crlf-glob --args -
493
494 The [`test-glob`][] command is also handy to test if a string
495
+11 -11
--- www/history.md
+++ www/history.md
@@ -3,11 +3,11 @@
33
Fossil is a [distributed version control system (DVCS)][100] written
44
beginning in [2007][105] by the [architect of SQLite][110] for the
55
purpose of managing the [SQLite project][115].
66
77
[100]: https://en.wikipedia.org/wiki/Distributed_version_control
8
-[105]: /timeline?a=1970-01-01&n=10
8
+[105]: /timeline?a=1970-01-01&n1=10
99
[110]: https://sqlite.org/crew.html
1010
[115]: https://sqlite.org/
1111
1212
Though Fossil was originally written specifically to support SQLite,
1313
it is now also used by countless other projects. The SQLite architect (drh)
@@ -25,16 +25,16 @@
2525
2626
[300]: https://en.wikipedia.org/wiki/Concurrent_Versions_System
2727
2828
Though innovative and much loved in its time, CVS was not without problems.
2929
Among those was a lack of visibility into the project history and the
30
-lack of integrated bug tracking. To try to address these deficiencies,
30
+lack of integrated bug tracking. To address these deficiencies,
3131
the SQLite author developed the [CVSTrac][305] wrapper for CVS beginning
3232
in [2002][310].
3333
3434
[305]: http://cvstrac.org/
35
-[310]: http://cvstrac.org/fossil/timeline?a=19700101&n=10
35
+[310]: http://cvstrac.org/fossil/timeline?a=19700101&n1=10
3636
3737
CVSTrac greatly improved the usability of CVS and was adopted by
3838
other projects. CVSTrac also [inspired the design][315] of [Trac][320],
3939
which was a similar system that was (and is) far more widely used.
4040
@@ -47,12 +47,12 @@
4747
That was not an unreasonable check-in comment, as check-in comments
4848
were scarcely seen and of questionable utility in raw CVS. CVSTrac
4949
changed that, making check-in comments more visible and more useful.
5050
The SQLite developers reacted by creating [better check-in comments][330].
5151
52
-[325]: https://sqlite.org/src/timeline?a=19700101&n=10
53
-[330]: https://sqlite.org/src/timeline?c=20030101&n=10&nd
52
+[325]: https://sqlite.org/src/timeline?a=19700101&n1=10
53
+[330]: https://sqlite.org/src/timeline?c=20030101&n1=10&nd
5454
5555
At about this same time, the [Monotone][335] system appeared.
5656
Monotone was one of the first distributed version control systems. As far as
5757
this author is aware, Monotone was the first VCS to make use of
5858
SHA1 to identify artifacts. Monotone stored its content in an SQLite
@@ -61,15 +61,15 @@
6161
6262
[335]: https://www.monotone.ca/
6363
6464
Beginning around 2005, the need for a better version control system
6565
for SQLite began to become evident. The SQLite architect looked
66
-around for a suitable replacement. Monotone, Git, and Mercurical were
66
+around for a suitable replacement. Monotone, Git, and Mercurial were
6767
all considered. But at that time, none of these supported sync
6868
over ordinary HTTP, none could be run from an inexpensive shell
6969
account on a leased server (this was before the widespread availability
70
-of affordable virtual machines), and none of them supported anything
70
+of affordable virtual private servers), and none of them supported anything
7171
resembling the wiki and ticket features of CVSTrac that had been
7272
found to be so useful. And so, the SQLite architect began writing
7373
his own DVCS.
7474
7575
Early prototypes were done in [TCL][340]. As experiments proceeded,
@@ -78,18 +78,18 @@
7878
were better implemented in plain old C.
7979
Experiments continued. Finally, a prototype capable of self-hosting
8080
was devised on [2007-07-16][345].
8181
8282
[340]: https://www.tcl.tk/
83
-[345]: https://fossil-scm.org/fossil/timeline?c=200707211410&n=10
83
+[345]: https://fossil-scm.org/fossil/timeline?c=200707211410&n1=10
8484
8585
The first project hosted by Fossil was Fossil itself. After a
8686
few months of development work, the code was considered stable enough
8787
to begin hosting the [SQLite documentation repository][350] which was
8888
split off from the main SQLite CVS repository on [2007-11-12][355].
8989
After two years of development work on Fossil, the
90
-SQLite source code itself was transfered to Fossil on
90
+SQLite source code itself was transferred to Fossil on
9191
[2009-08-11][360].
9292
9393
[350]: https://www.sqlite.org/docsrc/doc/trunk/README.md
94
-[355]: https://www.sqlite.org/docsrc/timeline?c=200711120345&n=10
95
-[360]: https://sqlite.org/src/timeline?c=b0848925babde524&n=12&y=ci
94
+[355]: https://www.sqlite.org/docsrc/timeline?c=200711120345&n1=10
95
+[360]: https://sqlite.org/src/timeline?c=b0848925babde524&n1=12&y=ci
9696
--- www/history.md
+++ www/history.md
@@ -3,11 +3,11 @@
3 Fossil is a [distributed version control system (DVCS)][100] written
4 beginning in [2007][105] by the [architect of SQLite][110] for the
5 purpose of managing the [SQLite project][115].
6
7 [100]: https://en.wikipedia.org/wiki/Distributed_version_control
8 [105]: /timeline?a=1970-01-01&n=10
9 [110]: https://sqlite.org/crew.html
10 [115]: https://sqlite.org/
11
12 Though Fossil was originally written specifically to support SQLite,
13 it is now also used by countless other projects. The SQLite architect (drh)
@@ -25,16 +25,16 @@
25
26 [300]: https://en.wikipedia.org/wiki/Concurrent_Versions_System
27
28 Though innovative and much loved in its time, CVS was not without problems.
29 Among those was a lack of visibility into the project history and the
30 lack of integrated bug tracking. To try to address these deficiencies,
31 the SQLite author developed the [CVSTrac][305] wrapper for CVS beginning
32 in [2002][310].
33
34 [305]: http://cvstrac.org/
35 [310]: http://cvstrac.org/fossil/timeline?a=19700101&n=10
36
37 CVSTrac greatly improved the usability of CVS and was adopted by
38 other projects. CVSTrac also [inspired the design][315] of [Trac][320],
39 which was a similar system that was (and is) far more widely used.
40
@@ -47,12 +47,12 @@
47 That was not an unreasonable check-in comment, as check-in comments
48 were scarcely seen and of questionable utility in raw CVS. CVSTrac
49 changed that, making check-in comments more visible and more useful.
50 The SQLite developers reacted by creating [better check-in comments][330].
51
52 [325]: https://sqlite.org/src/timeline?a=19700101&n=10
53 [330]: https://sqlite.org/src/timeline?c=20030101&n=10&nd
54
55 At about this same time, the [Monotone][335] system appeared.
56 Monotone was one of the first distributed version control systems. As far as
57 this author is aware, Monotone was the first VCS to make use of
58 SHA1 to identify artifacts. Monotone stored its content in an SQLite
@@ -61,15 +61,15 @@
61
62 [335]: https://www.monotone.ca/
63
64 Beginning around 2005, the need for a better version control system
65 for SQLite began to become evident. The SQLite architect looked
66 around for a suitable replacement. Monotone, Git, and Mercurical were
67 all considered. But at that time, none of these supported sync
68 over ordinary HTTP, none could be run from an inexpensive shell
69 account on a leased server (this was before the widespread availability
70 of affordable virtual machines), and none of them supported anything
71 resembling the wiki and ticket features of CVSTrac that had been
72 found to be so useful. And so, the SQLite architect began writing
73 his own DVCS.
74
75 Early prototypes were done in [TCL][340]. As experiments proceeded,
@@ -78,18 +78,18 @@
78 were better implemented in plain old C.
79 Experiments continued. Finally, a prototype capable of self-hosting
80 was devised on [2007-07-16][345].
81
82 [340]: https://www.tcl.tk/
83 [345]: https://fossil-scm.org/fossil/timeline?c=200707211410&n=10
84
85 The first project hosted by Fossil was Fossil itself. After a
86 few months of development work, the code was considered stable enough
87 to begin hosting the [SQLite documentation repository][350] which was
88 split off from the main SQLite CVS repository on [2007-11-12][355].
89 After two years of development work on Fossil, the
90 SQLite source code itself was transfered to Fossil on
91 [2009-08-11][360].
92
93 [350]: https://www.sqlite.org/docsrc/doc/trunk/README.md
94 [355]: https://www.sqlite.org/docsrc/timeline?c=200711120345&n=10
95 [360]: https://sqlite.org/src/timeline?c=b0848925babde524&n=12&y=ci
96
--- www/history.md
+++ www/history.md
@@ -3,11 +3,11 @@
3 Fossil is a [distributed version control system (DVCS)][100] written
4 beginning in [2007][105] by the [architect of SQLite][110] for the
5 purpose of managing the [SQLite project][115].
6
7 [100]: https://en.wikipedia.org/wiki/Distributed_version_control
8 [105]: /timeline?a=1970-01-01&n1=10
9 [110]: https://sqlite.org/crew.html
10 [115]: https://sqlite.org/
11
12 Though Fossil was originally written specifically to support SQLite,
13 it is now also used by countless other projects. The SQLite architect (drh)
@@ -25,16 +25,16 @@
25
26 [300]: https://en.wikipedia.org/wiki/Concurrent_Versions_System
27
28 Though innovative and much loved in its time, CVS was not without problems.
29 Among those was a lack of visibility into the project history and the
30 lack of integrated bug tracking. To address these deficiencies,
31 the SQLite author developed the [CVSTrac][305] wrapper for CVS beginning
32 in [2002][310].
33
34 [305]: http://cvstrac.org/
35 [310]: http://cvstrac.org/fossil/timeline?a=19700101&n1=10
36
37 CVSTrac greatly improved the usability of CVS and was adopted by
38 other projects. CVSTrac also [inspired the design][315] of [Trac][320],
39 which was a similar system that was (and is) far more widely used.
40
@@ -47,12 +47,12 @@
47 That was not an unreasonable check-in comment, as check-in comments
48 were scarcely seen and of questionable utility in raw CVS. CVSTrac
49 changed that, making check-in comments more visible and more useful.
50 The SQLite developers reacted by creating [better check-in comments][330].
51
52 [325]: https://sqlite.org/src/timeline?a=19700101&n1=10
53 [330]: https://sqlite.org/src/timeline?c=20030101&n1=10&nd
54
55 At about this same time, the [Monotone][335] system appeared.
56 Monotone was one of the first distributed version control systems. As far as
57 this author is aware, Monotone was the first VCS to make use of
58 SHA1 to identify artifacts. Monotone stored its content in an SQLite
@@ -61,15 +61,15 @@
61
62 [335]: https://www.monotone.ca/
63
64 Beginning around 2005, the need for a better version control system
65 for SQLite began to become evident. The SQLite architect looked
66 around for a suitable replacement. Monotone, Git, and Mercurial were
67 all considered. But at that time, none of these supported sync
68 over ordinary HTTP, none could be run from an inexpensive shell
69 account on a leased server (this was before the widespread availability
70 of affordable virtual private servers), and none of them supported anything
71 resembling the wiki and ticket features of CVSTrac that had been
72 found to be so useful. And so, the SQLite architect began writing
73 his own DVCS.
74
75 Early prototypes were done in [TCL][340]. As experiments proceeded,
@@ -78,18 +78,18 @@
78 were better implemented in plain old C.
79 Experiments continued. Finally, a prototype capable of self-hosting
80 was devised on [2007-07-16][345].
81
82 [340]: https://www.tcl.tk/
83 [345]: https://fossil-scm.org/fossil/timeline?c=200707211410&n1=10
84
85 The first project hosted by Fossil was Fossil itself. After a
86 few months of development work, the code was considered stable enough
87 to begin hosting the [SQLite documentation repository][350] which was
88 split off from the main SQLite CVS repository on [2007-11-12][355].
89 After two years of development work on Fossil, the
90 SQLite source code itself was transferred to Fossil on
91 [2009-08-11][360].
92
93 [350]: https://www.sqlite.org/docsrc/doc/trunk/README.md
94 [355]: https://www.sqlite.org/docsrc/timeline?c=200711120345&n1=10
95 [360]: https://sqlite.org/src/timeline?c=b0848925babde524&n1=12&y=ci
96
+1 -1
--- www/hooks.md
+++ www/hooks.md
@@ -91,11 +91,11 @@
9191
and the transaction commits before it tries to access the repository
9292
database.
9393
9494
* A push might not deliver all of the artifacts for a checkin. If
9595
Fossil knows that a /xfer HTTP request is incomplete, it will defer
96
- running the after-receive push for 60 seconds, or unti a complete
96
+ running the after-receive push for 60 seconds, or until a complete
9797
/xfer request is received. This helps to prevent after-receive hooks
9898
from running when incomplete checkins exist in the repository, but
9999
it does not provide hard guarantees, as there is no way to do that
100100
in a distributed system.
101101
102102
--- www/hooks.md
+++ www/hooks.md
@@ -91,11 +91,11 @@
91 and the transaction commits before it tries to access the repository
92 database.
93
94 * A push might not deliver all of the artifacts for a checkin. If
95 Fossil knows that a /xfer HTTP request is incomplete, it will defer
96 running the after-receive push for 60 seconds, or unti a complete
97 /xfer request is received. This helps to prevent after-receive hooks
98 from running when incomplete checkins exist in the repository, but
99 it does not provide hard guarantees, as there is no way to do that
100 in a distributed system.
101
102
--- www/hooks.md
+++ www/hooks.md
@@ -91,11 +91,11 @@
91 and the transaction commits before it tries to access the repository
92 database.
93
94 * A push might not deliver all of the artifacts for a checkin. If
95 Fossil knows that a /xfer HTTP request is incomplete, it will defer
96 running the after-receive push for 60 seconds, or until a complete
97 /xfer request is received. This helps to prevent after-receive hooks
98 from running when incomplete checkins exist in the repository, but
99 it does not provide hard guarantees, as there is no way to do that
100 in a distributed system.
101
102
--- www/image-format-vs-repo-size.md
+++ www/image-format-vs-repo-size.md
@@ -140,11 +140,11 @@
140140
virtually no penalty to using BMP or TIFF over PNG. The file sizes
141141
likely differ only because of differences in zlib settings between
142142
the cases.
143143
144144
* Because JPEG’s lossy nature allows it to start smaller and have
145
- smaller size increases than than PNG, the crossover point with
145
+ smaller size increases than PNG, the crossover point with
146146
BMP/TIFF isn’t until 7-9 checkins in typical runs of this [Monte
147147
Carlo experiment][mce]. Given a choice among these four file
148148
formats and a willingness to use lossy image compression, a rational
149149
tradeoff is to choose JPEG for repositories where each image will
150150
change fewer than that number of times.
151151
--- www/image-format-vs-repo-size.md
+++ www/image-format-vs-repo-size.md
@@ -140,11 +140,11 @@
140 virtually no penalty to using BMP or TIFF over PNG. The file sizes
141 likely differ only because of differences in zlib settings between
142 the cases.
143
144 * Because JPEG’s lossy nature allows it to start smaller and have
145 smaller size increases than than PNG, the crossover point with
146 BMP/TIFF isn’t until 7-9 checkins in typical runs of this [Monte
147 Carlo experiment][mce]. Given a choice among these four file
148 formats and a willingness to use lossy image compression, a rational
149 tradeoff is to choose JPEG for repositories where each image will
150 change fewer than that number of times.
151
--- www/image-format-vs-repo-size.md
+++ www/image-format-vs-repo-size.md
@@ -140,11 +140,11 @@
140 virtually no penalty to using BMP or TIFF over PNG. The file sizes
141 likely differ only because of differences in zlib settings between
142 the cases.
143
144 * Because JPEG’s lossy nature allows it to start smaller and have
145 smaller size increases than PNG, the crossover point with
146 BMP/TIFF isn’t until 7-9 checkins in typical runs of this [Monte
147 Carlo experiment][mce]. Given a choice among these four file
148 formats and a willingness to use lossy image compression, a rational
149 tradeoff is to choose JPEG for repositories where each image will
150 change fewer than that number of times.
151
+25 -25
--- www/index.wiki
+++ www/index.wiki
@@ -1,11 +1,11 @@
11
<title>Home</title>
22
33
<h3>What Is Fossil?</h3>
44
5
-<div style='width:200px;float:right;border:2px solid #446979;padding:10px;margin:0px 10px;'>
6
-<ul>
5
+<div style='float:right;border:2px solid #446979;padding:0 15px 10px 0;margin:0 0 10px 10px;'>
6
+<ul style='margin-left: -10px;'>
77
<li> [/uv/download.html | Download]
88
<li> [./quickstart.wiki | Quick Start]
99
<li> [./build.wiki | Install]
1010
<li> [https://fossil-scm.org/forum | Support/Forum ]
1111
<li> [./hints.wiki | Tips &amp; Hints]
@@ -12,23 +12,23 @@
1212
<li> [./changes.wiki | Change Log]
1313
<li> [../COPYRIGHT-BSD2.txt | License]
1414
<li> [./userlinks.wiki | User Links]
1515
<li> [./hacker-howto.wiki | Hacker How-To]
1616
<li> [./fossil-v-git.wiki | Fossil vs. Git]
17
-<li> [./permutedindex.html | Documentation Index]
17
+<li> [./permutedindex.html | Doc Index]
1818
</ul>
19
-<img src="fossil3.gif" align="center">
19
+<center><img src="fossil3.gif" align="center"></center>
2020
</div>
2121
2222
<p>Fossil is a simple, high-reliability, distributed software configuration
2323
management system with these advanced features:
2424
25
- 1. <b>Integrated Bug Tracking, Wiki, Forum, and Technotes</b> -
25
+ 1. <b>Project Management</b> -
2626
In addition to doing [./concepts.wiki | distributed version control]
2727
like Git and Mercurial,
2828
Fossil also supports [./bugtheory.wiki | bug tracking],
29
- [./wikitheory.wiki | wiki], [./forum.wiki | forum], and
29
+ [./wikitheory.wiki | wiki], [./forum.wiki | forum], [./chat.md | chat], and
3030
[./event.wiki | technotes].
3131
3232
2. <b>Built-in Web Interface</b> -
3333
Fossil has a built-in,
3434
[https://fossil-scm.org/skins/index.html | themeable],
@@ -44,32 +44,32 @@
4444
[./unvers.wiki | unversioned files].
4545
When you clone Fossil from one of its
4646
[./selfhost.wiki | self-hosting repositories],
4747
you get more than just source code - you get this entire website.
4848
49
- 3. <b>Self-Contained</b> -
50
- Fossil is a single self-contained stand-alone executable.
49
+ 3. <b>All-in-one</b> -
50
+ Fossil is a single self-contained, stand-alone executable.
5151
To install, simply download a
5252
[/uv/download.html | precompiled binary]
5353
for Linux, Mac, or Windows and put it on your $PATH.
5454
[./build.wiki | Easy-to-compile source code] is also available.
5555
56
- 4. <b>Simple Networking</b> -
57
- No custom protocols or TCP ports.
58
- Fossil uses ordinary HTTP (or HTTPS or SSH)
56
+
57
+ 4. <b>Self-host Friendly</b> - Stand up a project website
58
+ in minutes using [./server/ | a variety of techniques].
59
+ Fossil is CPU and memory efficient. Most projects can be
60
+ hosted comfortably on a $5/month VPS or a Raspberry Pi.
61
+ You can also set up an automatic
62
+ [./mirrortogithub.md | GitHub mirror].
63
+
64
+ 5. <b>Simple Networking</b> -
65
+ Fossil uses ordinary HTTPS (or SSH if you prefer)
5966
for network communications, so it works fine from behind
60
- restrictive firewalls, including [./quickstart.wiki#proxy|proxies].
67
+ firewalls and [./quickstart.wiki#proxy|proxies].
6168
The protocol is
6269
[./stats.wiki | bandwidth efficient] to the point that Fossil can be
63
- used comfortably over dial-up or over the exceedingly slow Wifi on
64
- airliners.
65
-
66
- 5. <b>Simple Server Setup</b> - No server is required, but if you want to
67
- set one up, Fossil supports [./server/ | several different server
68
- configurations] including CGI, SCGI, and direct HTTP.
69
- You can also easily set up your Fossil repository to automatically
70
- [./mirrortogithub.md | mirror content on GitHub].
70
+ used comfortably over dial-up, weak 3G, or airliner Wifi.
7171
7272
6. <b>Autosync</b> -
7373
Fossil supports [./concepts.wiki#workflow | "autosync" mode]
7474
which helps to keep projects moving
7575
forward by reducing the amount of needless
@@ -81,19 +81,19 @@
8181
in an SQLite database so that transactions are
8282
atomic even if interrupted by a power loss or system crash.
8383
Automatic [./selfcheck.wiki | self-checks] verify that all aspects of
8484
the repository are consistent prior to each commit.
8585
86
- 8. <b>Free and Open-Source</b> - Uses the [../COPYRIGHT-BSD2.txt|2-clause BSD license].
86
+ 8. <b>Free and Open-Source</b> - [../COPYRIGHT-BSD2.txt|2-clause BSD license].
8787
8888
<hr>
89
-<h3>Latest Release: 2.13 ([/timeline?c=version-2.13|2020-11-01])</h3>
89
+<h3>Latest Release: 2.14 ([/timeline?c=version-2.14|2021-01-20])</h3>
9090
9191
* [/uv/download.html|Download]
92
- * [./changes.wiki#v2_13|Change Summary]
93
- * [/timeline?p=version-2.13&bt=version-2.12&n=all|Check-ins in version 2.13]
94
- * [/timeline?d=version-2.13&n=all&nd|Check-ins derived from the 2.13 release]
92
+ * [./changes.wiki#v2_14|Change Summary]
93
+ * [/timeline?p=version-2.14&bt=version-2.13&y=ci|Check-ins in version 2.13]
94
+ * [/timeline?df=version-2.14&y=ci|Check-ins derived from the 2.14 release]
9595
* [/timeline?t=release|Timeline of all past releases]
9696
9797
<hr>
9898
<h3>Quick Start</h3>
9999
100100
--- www/index.wiki
+++ www/index.wiki
@@ -1,11 +1,11 @@
1 <title>Home</title>
2
3 <h3>What Is Fossil?</h3>
4
5 <div style='width:200px;float:right;border:2px solid #446979;padding:10px;margin:0px 10px;'>
6 <ul>
7 <li> [/uv/download.html | Download]
8 <li> [./quickstart.wiki | Quick Start]
9 <li> [./build.wiki | Install]
10 <li> [https://fossil-scm.org/forum | Support/Forum ]
11 <li> [./hints.wiki | Tips &amp; Hints]
@@ -12,23 +12,23 @@
12 <li> [./changes.wiki | Change Log]
13 <li> [../COPYRIGHT-BSD2.txt | License]
14 <li> [./userlinks.wiki | User Links]
15 <li> [./hacker-howto.wiki | Hacker How-To]
16 <li> [./fossil-v-git.wiki | Fossil vs. Git]
17 <li> [./permutedindex.html | Documentation Index]
18 </ul>
19 <img src="fossil3.gif" align="center">
20 </div>
21
22 <p>Fossil is a simple, high-reliability, distributed software configuration
23 management system with these advanced features:
24
25 1. <b>Integrated Bug Tracking, Wiki, Forum, and Technotes</b> -
26 In addition to doing [./concepts.wiki | distributed version control]
27 like Git and Mercurial,
28 Fossil also supports [./bugtheory.wiki | bug tracking],
29 [./wikitheory.wiki | wiki], [./forum.wiki | forum], and
30 [./event.wiki | technotes].
31
32 2. <b>Built-in Web Interface</b> -
33 Fossil has a built-in,
34 [https://fossil-scm.org/skins/index.html | themeable],
@@ -44,32 +44,32 @@
44 [./unvers.wiki | unversioned files].
45 When you clone Fossil from one of its
46 [./selfhost.wiki | self-hosting repositories],
47 you get more than just source code - you get this entire website.
48
49 3. <b>Self-Contained</b> -
50 Fossil is a single self-contained stand-alone executable.
51 To install, simply download a
52 [/uv/download.html | precompiled binary]
53 for Linux, Mac, or Windows and put it on your $PATH.
54 [./build.wiki | Easy-to-compile source code] is also available.
55
56 4. <b>Simple Networking</b> -
57 No custom protocols or TCP ports.
58 Fossil uses ordinary HTTP (or HTTPS or SSH)
 
 
 
 
 
 
 
59 for network communications, so it works fine from behind
60 restrictive firewalls, including [./quickstart.wiki#proxy|proxies].
61 The protocol is
62 [./stats.wiki | bandwidth efficient] to the point that Fossil can be
63 used comfortably over dial-up or over the exceedingly slow Wifi on
64 airliners.
65
66 5. <b>Simple Server Setup</b> - No server is required, but if you want to
67 set one up, Fossil supports [./server/ | several different server
68 configurations] including CGI, SCGI, and direct HTTP.
69 You can also easily set up your Fossil repository to automatically
70 [./mirrortogithub.md | mirror content on GitHub].
71
72 6. <b>Autosync</b> -
73 Fossil supports [./concepts.wiki#workflow | "autosync" mode]
74 which helps to keep projects moving
75 forward by reducing the amount of needless
@@ -81,19 +81,19 @@
81 in an SQLite database so that transactions are
82 atomic even if interrupted by a power loss or system crash.
83 Automatic [./selfcheck.wiki | self-checks] verify that all aspects of
84 the repository are consistent prior to each commit.
85
86 8. <b>Free and Open-Source</b> - Uses the [../COPYRIGHT-BSD2.txt|2-clause BSD license].
87
88 <hr>
89 <h3>Latest Release: 2.13 ([/timeline?c=version-2.13|2020-11-01])</h3>
90
91 * [/uv/download.html|Download]
92 * [./changes.wiki#v2_13|Change Summary]
93 * [/timeline?p=version-2.13&bt=version-2.12&n=all|Check-ins in version 2.13]
94 * [/timeline?d=version-2.13&n=all&nd|Check-ins derived from the 2.13 release]
95 * [/timeline?t=release|Timeline of all past releases]
96
97 <hr>
98 <h3>Quick Start</h3>
99
100
--- www/index.wiki
+++ www/index.wiki
@@ -1,11 +1,11 @@
1 <title>Home</title>
2
3 <h3>What Is Fossil?</h3>
4
5 <div style='float:right;border:2px solid #446979;padding:0 15px 10px 0;margin:0 0 10px 10px;'>
6 <ul style='margin-left: -10px;'>
7 <li> [/uv/download.html | Download]
8 <li> [./quickstart.wiki | Quick Start]
9 <li> [./build.wiki | Install]
10 <li> [https://fossil-scm.org/forum | Support/Forum ]
11 <li> [./hints.wiki | Tips &amp; Hints]
@@ -12,23 +12,23 @@
12 <li> [./changes.wiki | Change Log]
13 <li> [../COPYRIGHT-BSD2.txt | License]
14 <li> [./userlinks.wiki | User Links]
15 <li> [./hacker-howto.wiki | Hacker How-To]
16 <li> [./fossil-v-git.wiki | Fossil vs. Git]
17 <li> [./permutedindex.html | Doc Index]
18 </ul>
19 <center><img src="fossil3.gif" align="center"></center>
20 </div>
21
22 <p>Fossil is a simple, high-reliability, distributed software configuration
23 management system with these advanced features:
24
25 1. <b>Project Management</b> -
26 In addition to doing [./concepts.wiki | distributed version control]
27 like Git and Mercurial,
28 Fossil also supports [./bugtheory.wiki | bug tracking],
29 [./wikitheory.wiki | wiki], [./forum.wiki | forum], [./chat.md | chat], and
30 [./event.wiki | technotes].
31
32 2. <b>Built-in Web Interface</b> -
33 Fossil has a built-in,
34 [https://fossil-scm.org/skins/index.html | themeable],
@@ -44,32 +44,32 @@
44 [./unvers.wiki | unversioned files].
45 When you clone Fossil from one of its
46 [./selfhost.wiki | self-hosting repositories],
47 you get more than just source code - you get this entire website.
48
49 3. <b>All-in-one</b> -
50 Fossil is a single self-contained, stand-alone executable.
51 To install, simply download a
52 [/uv/download.html | precompiled binary]
53 for Linux, Mac, or Windows and put it on your $PATH.
54 [./build.wiki | Easy-to-compile source code] is also available.
55
56
57 4. <b>Self-host Friendly</b> - Stand up a project website
58 in minutes using [./server/ | a variety of techniques].
59 Fossil is CPU and memory efficient. Most projects can be
60 hosted comfortably on a $5/month VPS or a Raspberry Pi.
61 You can also set up an automatic
62 [./mirrortogithub.md | GitHub mirror].
63
64 5. <b>Simple Networking</b> -
65 Fossil uses ordinary HTTPS (or SSH if you prefer)
66 for network communications, so it works fine from behind
67 firewalls and [./quickstart.wiki#proxy|proxies].
68 The protocol is
69 [./stats.wiki | bandwidth efficient] to the point that Fossil can be
70 used comfortably over dial-up, weak 3G, or airliner Wifi.
 
 
 
 
 
 
 
71
72 6. <b>Autosync</b> -
73 Fossil supports [./concepts.wiki#workflow | "autosync" mode]
74 which helps to keep projects moving
75 forward by reducing the amount of needless
@@ -81,19 +81,19 @@
81 in an SQLite database so that transactions are
82 atomic even if interrupted by a power loss or system crash.
83 Automatic [./selfcheck.wiki | self-checks] verify that all aspects of
84 the repository are consistent prior to each commit.
85
86 8. <b>Free and Open-Source</b> - [../COPYRIGHT-BSD2.txt|2-clause BSD license].
87
88 <hr>
89 <h3>Latest Release: 2.14 ([/timeline?c=version-2.14|2021-01-20])</h3>
90
91 * [/uv/download.html|Download]
92 * [./changes.wiki#v2_14|Change Summary]
93 * [/timeline?p=version-2.14&bt=version-2.13&y=ci|Check-ins in version 2.13]
94 * [/timeline?df=version-2.14&y=ci|Check-ins derived from the 2.14 release]
95 * [/timeline?t=release|Timeline of all past releases]
96
97 <hr>
98 <h3>Quick Start</h3>
99
100
--- www/javascript.md
+++ www/javascript.md
@@ -9,20 +9,22 @@
99
it is an enhancement to provided functionality, and there is always
1010
another way to accomplish a given end without using JavaScript.
1111
1212
This is not to say that Fossil’s fall-backs for such cases are always as
1313
elegant and functional as a no-JS purist might wish. That is simply
14
-because [the vast majority of web users run with JavaScript enabled](#stats),
15
-and a minority of those run with some kind of [conditional JavaScript
16
-blocking](#block) in place. Fossil’s active developers do not deviate from that
14
+because [the vast majority of web users leave JavaScript unconditionally
15
+enabled](#stats), and of the small minority of those that do not, a
16
+large chunk use some kind of [conditional blocking](#block) instead,
17
+rather than disable JavaScript entirely.
18
+Fossil’s active developers do not deviate from that
1719
norm enough that we have many no-JS purists among us, so the no-JS case
1820
doesn’t get as much attention as some might want. We do [accept code
1921
contributions][cg], and we are philosophically in favor of graceful
2022
fall-backs, so you are welcome to appoint yourself the position of no-JS
2123
czar for the Fossil project!
2224
23
-Evil is in actions, not in nouns: we do not believe JavaScript *can*
25
+Evil is in actions, not in objects: we do not believe JavaScript *can*
2426
be evil. It is an active technology, but the actions that matter here
2527
are those of writing the code and checking it into the Fossil project
2628
repository. None of the JavaScript code in Fossil is evil, a fact we
2729
enforce by being careful about who we give check-in rights on the
2830
repository to and by policing what code does get contributed. The Fossil
@@ -64,12 +66,13 @@
6466
Most JavaScript-based Fossil pages use less code than that.
6567
6668
Atop that, Fossil sends HTTP headers to the browser that allow it
6769
to perform aggressive caching so that typical page loads will skip
6870
re-loading this content on subsequent loads. These features are
69
- currently optional: you must either set the new [`fossil server
70
- --jsmode bundle` option][fsrv] or the corresponding `jsmode` control line
71
+ currently optional: you must either set the new
72
+ [`fossil server --jsmode bundle` option][fsrv] or the corresponding
73
+ `jsmode` control line
7174
in your [`fossil cgi`][fcgi] script when setting up your
7275
[Fossil server][fshome]. That done, Fossil’s JavaScript files will
7376
load almost instantly from the browser’s cache after the initial
7477
page load, rather than be re-transferred over the network.
7578
@@ -92,12 +95,14 @@
9295
Nowadays JavaScript is, as a rule, astoundingly fast. As the world
9396
continues to move more and more to web-based applications and
9497
services, JavaScript engine developers have ample motivation to keep
9598
their engines fast and competitive.
9699
97
- Once the scripts are cached, Ajax based page updates are faster than
98
- the alternative, a full HTTP POST round-trip.
100
+ Ajax partial page updates are faster than
101
+ the no-JS alternative, a full HTTP POST round-trip to submit new
102
+ data to the remote server, retrieve an entire new HTML document,
103
+ and re-render the whole thing client-side.
99104
100105
3. <a id="3pjs"></a>“**Third-party JavaScript cannot be trusted.**”
101106
102107
Fossil does not use any third-party JavaScript libraries, not even
103108
very common ones like jQuery. Every bit of JavaScript served by the
@@ -546,10 +551,29 @@
546551
local time zone to be a useful fallback for the current feature, so [a
547552
patch to do this][cg] may well be accepted. Since this is not a
548553
*necessary* Fossil feature, an interested user is unlikely to get the
549554
core developers to do this work for them.
550555
556
+
557
+### <a id="chat"></a>Chat
558
+
559
+The [chat feature](./chat.md) added in Fossil 2.14 is deeply dependent
560
+on JavaScript. There is no obvious way to do this sort of thing without
561
+active client-side code of some sort.
562
+
563
+_Potential Workaround:_ It would not be especially difficult for someone
564
+sufficiently motivated to build a Fossil chat gateway, connecting to
565
+IRC, Jabber, etc. The messages are stored in the repository’s `chat`
566
+table with monotonically increasing IDs, so a poller that did something
567
+like
568
+
569
+ SELECT xfrom, xmsg FROM chat WHERE msgid > 1234;
570
+
571
+…would pull the messages submitted since the last poll. Making the
572
+gateway bidirectional should be possible as well, as long as it properly
573
+uses SQLite transactions.
574
+
551575
----
552576
553577
## <a id="future"></a>Future Plans for JavaScript in Fossil
554578
555579
As of mid-2020, the informal provisional plan is to increase Fossil
556580
--- www/javascript.md
+++ www/javascript.md
@@ -9,20 +9,22 @@
9 it is an enhancement to provided functionality, and there is always
10 another way to accomplish a given end without using JavaScript.
11
12 This is not to say that Fossil’s fall-backs for such cases are always as
13 elegant and functional as a no-JS purist might wish. That is simply
14 because [the vast majority of web users run with JavaScript enabled](#stats),
15 and a minority of those run with some kind of [conditional JavaScript
16 blocking](#block) in place. Fossil’s active developers do not deviate from that
 
 
17 norm enough that we have many no-JS purists among us, so the no-JS case
18 doesn’t get as much attention as some might want. We do [accept code
19 contributions][cg], and we are philosophically in favor of graceful
20 fall-backs, so you are welcome to appoint yourself the position of no-JS
21 czar for the Fossil project!
22
23 Evil is in actions, not in nouns: we do not believe JavaScript *can*
24 be evil. It is an active technology, but the actions that matter here
25 are those of writing the code and checking it into the Fossil project
26 repository. None of the JavaScript code in Fossil is evil, a fact we
27 enforce by being careful about who we give check-in rights on the
28 repository to and by policing what code does get contributed. The Fossil
@@ -64,12 +66,13 @@
64 Most JavaScript-based Fossil pages use less code than that.
65
66 Atop that, Fossil sends HTTP headers to the browser that allow it
67 to perform aggressive caching so that typical page loads will skip
68 re-loading this content on subsequent loads. These features are
69 currently optional: you must either set the new [`fossil server
70 --jsmode bundle` option][fsrv] or the corresponding `jsmode` control line
 
71 in your [`fossil cgi`][fcgi] script when setting up your
72 [Fossil server][fshome]. That done, Fossil’s JavaScript files will
73 load almost instantly from the browser’s cache after the initial
74 page load, rather than be re-transferred over the network.
75
@@ -92,12 +95,14 @@
92 Nowadays JavaScript is, as a rule, astoundingly fast. As the world
93 continues to move more and more to web-based applications and
94 services, JavaScript engine developers have ample motivation to keep
95 their engines fast and competitive.
96
97 Once the scripts are cached, Ajax based page updates are faster than
98 the alternative, a full HTTP POST round-trip.
 
 
99
100 3. <a id="3pjs"></a>“**Third-party JavaScript cannot be trusted.**”
101
102 Fossil does not use any third-party JavaScript libraries, not even
103 very common ones like jQuery. Every bit of JavaScript served by the
@@ -546,10 +551,29 @@
546 local time zone to be a useful fallback for the current feature, so [a
547 patch to do this][cg] may well be accepted. Since this is not a
548 *necessary* Fossil feature, an interested user is unlikely to get the
549 core developers to do this work for them.
550
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551 ----
552
553 ## <a id="future"></a>Future Plans for JavaScript in Fossil
554
555 As of mid-2020, the informal provisional plan is to increase Fossil
556
--- www/javascript.md
+++ www/javascript.md
@@ -9,20 +9,22 @@
9 it is an enhancement to provided functionality, and there is always
10 another way to accomplish a given end without using JavaScript.
11
12 This is not to say that Fossil’s fall-backs for such cases are always as
13 elegant and functional as a no-JS purist might wish. That is simply
14 because [the vast majority of web users leave JavaScript unconditionally
15 enabled](#stats), and of the small minority of those that do not, a
16 large chunk use some kind of [conditional blocking](#block) instead,
17 rather than disable JavaScript entirely.
18 Fossil’s active developers do not deviate from that
19 norm enough that we have many no-JS purists among us, so the no-JS case
20 doesn’t get as much attention as some might want. We do [accept code
21 contributions][cg], and we are philosophically in favor of graceful
22 fall-backs, so you are welcome to appoint yourself the position of no-JS
23 czar for the Fossil project!
24
25 Evil is in actions, not in objects: we do not believe JavaScript *can*
26 be evil. It is an active technology, but the actions that matter here
27 are those of writing the code and checking it into the Fossil project
28 repository. None of the JavaScript code in Fossil is evil, a fact we
29 enforce by being careful about who we give check-in rights on the
30 repository to and by policing what code does get contributed. The Fossil
@@ -64,12 +66,13 @@
66 Most JavaScript-based Fossil pages use less code than that.
67
68 Atop that, Fossil sends HTTP headers to the browser that allow it
69 to perform aggressive caching so that typical page loads will skip
70 re-loading this content on subsequent loads. These features are
71 currently optional: you must either set the new
72 [`fossil server --jsmode bundle` option][fsrv] or the corresponding
73 `jsmode` control line
74 in your [`fossil cgi`][fcgi] script when setting up your
75 [Fossil server][fshome]. That done, Fossil’s JavaScript files will
76 load almost instantly from the browser’s cache after the initial
77 page load, rather than be re-transferred over the network.
78
@@ -92,12 +95,14 @@
95 Nowadays JavaScript is, as a rule, astoundingly fast. As the world
96 continues to move more and more to web-based applications and
97 services, JavaScript engine developers have ample motivation to keep
98 their engines fast and competitive.
99
100 Ajax partial page updates are faster than
101 the no-JS alternative, a full HTTP POST round-trip to submit new
102 data to the remote server, retrieve an entire new HTML document,
103 and re-render the whole thing client-side.
104
105 3. <a id="3pjs"></a>“**Third-party JavaScript cannot be trusted.**”
106
107 Fossil does not use any third-party JavaScript libraries, not even
108 very common ones like jQuery. Every bit of JavaScript served by the
@@ -546,10 +551,29 @@
551 local time zone to be a useful fallback for the current feature, so [a
552 patch to do this][cg] may well be accepted. Since this is not a
553 *necessary* Fossil feature, an interested user is unlikely to get the
554 core developers to do this work for them.
555
556
557 ### <a id="chat"></a>Chat
558
559 The [chat feature](./chat.md) added in Fossil 2.14 is deeply dependent
560 on JavaScript. There is no obvious way to do this sort of thing without
561 active client-side code of some sort.
562
563 _Potential Workaround:_ It would not be especially difficult for someone
564 sufficiently motivated to build a Fossil chat gateway, connecting to
565 IRC, Jabber, etc. The messages are stored in the repository’s `chat`
566 table with monotonically increasing IDs, so a poller that did something
567 like
568
569 SELECT xfrom, xmsg FROM chat WHERE msgid > 1234;
570
571 …would pull the messages submitted since the last poll. Making the
572 gateway bidirectional should be possible as well, as long as it properly
573 uses SQLite transactions.
574
575 ----
576
577 ## <a id="future"></a>Future Plans for JavaScript in Fossil
578
579 As of mid-2020, the informal provisional plan is to increase Fossil
580
--- www/json-api/intro.md
+++ www/json-api/intro.md
@@ -140,61 +140,33 @@
140140
# Technical Problems and Considerations
141141
142142
A random list of considerations which need to be made and potential
143143
problem areas...
144144
145
-- **Binary data:** HTML4 and JavaScript have no portable way of
146
- handling binary data, so commands which could potentially deal with
147
- binary data (e.g. committing a file) are ruled out for the time
148
- being. HTML5 and accompanying JavaScript additions will binary
149
- data usable client-side. That said, a JSON interface cannot natively
150
- work with binary unless it is encoded (base64 or hex or whatever),
151
- and such encoding would have to be understood on both the server and
152
- client sides, which may rule out usage in some environments.\
153
- **Status:** deferred until needed. My current thinking is to send
154
- URLs instead of binary data, and the URLs would point to some path
155
- which produces the raw artifact content. We could read POSTed binary
156
- input, but this might require some re-tooling of fossil's innards
157
- and it precludes the use of a JSON request envelope, so it would be
158
- limited to requests which can be configured solely via GET arguments
159
- (as opposed to POST envelope/payload options). i.e. configure the
160
- JSON bits via GET and POST the binary data.
161
-- **64-bit integers:** JSON does not specify integer precision,
162
- probably because it targets many different platforms and not all
163
- of them can support more than 32 bits. JavaScript (from which JSON
164
- derives) supports 53 bits of integer precision. That said, it's
165
- "highly unlikely" that we'll have any range problems with "only"
166
- 53 bits of precision. The underlying JSON API supports *signed*
167
- 32- or 64-bit integers on both 32- and 64-bit builds, but only if
168
- "long long" or `int64_t` are available (from the C99 header
169
- `stdint.h`). Only multi-gig repositories are ever expected to use
170
- large numbers, and even then only rarely (e.g. via the "stat"
171
- command).
172
-- **Timestamps:** for portability this API uses GMT Unix Epoch
173
- timestamps. They are the most portable time representation out
174
- there, easily usable in most programming environments. (In hindsight,
175
- this should have been Unix + Milliseconds, but the API already
176
- pervasively uses seconds-precision.)
177
-- **Artifact vs. Artefact:** both are correct vis-a-vis the
178
- english language but Fossil consistently uses the former, so we’ll
179
- use that.
180
-- **Multiple logins per user:** fossil currently does not allow
181
- multiple active logins for a given user except anonymous. For all
182
- others, the most recent login wins. This is only a very minor
183
- annoyance for the HTML interface but will be more problematic for
184
- JSON clients. e.g. a user might have a ticket poller and a commit poller
185
- running, and both would need to be logged in.\
186
- **Status:** as of 20120315 (commit
187
- [*73038baaa3*](http://www.fossil-scm.org/index.html/info/73038baaa3)),
188
- fossil allows a user to be logged in multiple times (confirm: only
189
- within the same network?). The only caveat is that if any one of
190
- them logs out, it will invalidate the login session for the others.
191
- This is good enough for the time being, however. It will likely only
192
- become painful if we actually get enough apps in the wild that
193
- someone might have some running on his mobile phone and some on his
194
- PC and some on his server. The workarounds for now are (A) not to
195
- log out and (B) program apps/applets/widgets to try to re-login
196
- occasionally. Fossil will at some point expire the login, anyway.
197
- FIXME: update the expiry time on each request? To do that right we'd
198
- have to re-set the cookie on each request :/. We could optionally
199
- add a new JSON request which simply updates the login cookie
200
- lifetime (e.g. /json/keepalive or expand /json/whoami to do that).
145
+- **Binary data:** JSON is a text serialization method, and it takes
146
+ up the “payload” area of each HTTP request, so there is no
147
+ reasonable way to include binary data in the JSON message without
148
+ some sort of codec like Base64, for which there is no provision in
149
+ the current JSON API. You will therefore find no JSON API for
150
+ committing changes to a file in the repository, for example. Other
151
+ Fossil APIs such as [`/raw`](/help?cmd=/raw) or
152
+ [`/fileedit`](../fileedit-page.md) may serve you better.
153
+- **64-bit integers:** The JSON standard does not specify integer precision,
154
+ because it targets many different platforms, and not all of
155
+ them can support more than 32 bits. JavaScript (from which JSON
156
+ derives) supports 53 bits of integer precision, which may affect how
157
+ a given client-side JSON implementation sends large integers to Fossil’s JSON
158
+ API. Our JSON parser can cope with integers larger than 32 bits on input, and it
159
+ can emit them, but it requires platform support. If you’re running
160
+ Fossil on a 64-bit host, you should not run into problems in
161
+ this area, but if you’re on a legacy 32-bit only or a mixed 32/64-bit
162
+ system, it’s possible that some integers in the API could be
163
+ clipped. Realize however that this is a rare case: Fossil currently
164
+ cannot store files large enough to exceed a 32-bit `size_t` value,
165
+ and `time_t` won’t roll past 32-bit integers until 2038. We’re aware
166
+ of no other uses of integers in this API that could even in
167
+ principle exceed the range of a 32-bit integer.
168
+- **Timestamps:** For portability, this API uses UTC Unix epoch
169
+ timestamps. (`time_t`) They are the most portable time representation out
170
+ there, easily usable in most programming environments. (In
171
+ hindsight, we might better have used a higher-precision time format,
172
+ but changing that now would break API compatibility.)
201173
--- www/json-api/intro.md
+++ www/json-api/intro.md
@@ -140,61 +140,33 @@
140 # Technical Problems and Considerations
141
142 A random list of considerations which need to be made and potential
143 problem areas...
144
145 - **Binary data:** HTML4 and JavaScript have no portable way of
146 handling binary data, so commands which could potentially deal with
147 binary data (e.g. committing a file) are ruled out for the time
148 being. HTML5 and accompanying JavaScript additions will binary
149 data usable client-side. That said, a JSON interface cannot natively
150 work with binary unless it is encoded (base64 or hex or whatever),
151 and such encoding would have to be understood on both the server and
152 client sides, which may rule out usage in some environments.\
153 **Status:** deferred until needed. My current thinking is to send
154 URLs instead of binary data, and the URLs would point to some path
155 which produces the raw artifact content. We could read POSTed binary
156 input, but this might require some re-tooling of fossil's innards
157 and it precludes the use of a JSON request envelope, so it would be
158 limited to requests which can be configured solely via GET arguments
159 (as opposed to POST envelope/payload options). i.e. configure the
160 JSON bits via GET and POST the binary data.
161 - **64-bit integers:** JSON does not specify integer precision,
162 probably because it targets many different platforms and not all
163 of them can support more than 32 bits. JavaScript (from which JSON
164 derives) supports 53 bits of integer precision. That said, it's
165 "highly unlikely" that we'll have any range problems with "only"
166 53 bits of precision. The underlying JSON API supports *signed*
167 32- or 64-bit integers on both 32- and 64-bit builds, but only if
168 "long long" or `int64_t` are available (from the C99 header
169 `stdint.h`). Only multi-gig repositories are ever expected to use
170 large numbers, and even then only rarely (e.g. via the "stat"
171 command).
172 - **Timestamps:** for portability this API uses GMT Unix Epoch
173 timestamps. They are the most portable time representation out
174 there, easily usable in most programming environments. (In hindsight,
175 this should have been Unix + Milliseconds, but the API already
176 pervasively uses seconds-precision.)
177 - **Artifact vs. Artefact:** both are correct vis-a-vis the
178 english language but Fossil consistently uses the former, so we’ll
179 use that.
180 - **Multiple logins per user:** fossil currently does not allow
181 multiple active logins for a given user except anonymous. For all
182 others, the most recent login wins. This is only a very minor
183 annoyance for the HTML interface but will be more problematic for
184 JSON clients. e.g. a user might have a ticket poller and a commit poller
185 running, and both would need to be logged in.\
186 **Status:** as of 20120315 (commit
187 [*73038baaa3*](http://www.fossil-scm.org/index.html/info/73038baaa3)),
188 fossil allows a user to be logged in multiple times (confirm: only
189 within the same network?). The only caveat is that if any one of
190 them logs out, it will invalidate the login session for the others.
191 This is good enough for the time being, however. It will likely only
192 become painful if we actually get enough apps in the wild that
193 someone might have some running on his mobile phone and some on his
194 PC and some on his server. The workarounds for now are (A) not to
195 log out and (B) program apps/applets/widgets to try to re-login
196 occasionally. Fossil will at some point expire the login, anyway.
197 FIXME: update the expiry time on each request? To do that right we'd
198 have to re-set the cookie on each request :/. We could optionally
199 add a new JSON request which simply updates the login cookie
200 lifetime (e.g. /json/keepalive or expand /json/whoami to do that).
201
--- www/json-api/intro.md
+++ www/json-api/intro.md
@@ -140,61 +140,33 @@
140 # Technical Problems and Considerations
141
142 A random list of considerations which need to be made and potential
143 problem areas...
144
145 - **Binary data:** JSON is a text serialization method, and it takes
146 up the “payload” area of each HTTP request, so there is no
147 reasonable way to include binary data in the JSON message without
148 some sort of codec like Base64, for which there is no provision in
149 the current JSON API. You will therefore find no JSON API for
150 committing changes to a file in the repository, for example. Other
151 Fossil APIs such as [`/raw`](/help?cmd=/raw) or
152 [`/fileedit`](../fileedit-page.md) may serve you better.
153 - **64-bit integers:** The JSON standard does not specify integer precision,
154 because it targets many different platforms, and not all of
155 them can support more than 32 bits. JavaScript (from which JSON
156 derives) supports 53 bits of integer precision, which may affect how
157 a given client-side JSON implementation sends large integers to Fossil’s JSON
158 API. Our JSON parser can cope with integers larger than 32 bits on input, and it
159 can emit them, but it requires platform support. If you’re running
160 Fossil on a 64-bit host, you should not run into problems in
161 this area, but if you’re on a legacy 32-bit only or a mixed 32/64-bit
162 system, it’s possible that some integers in the API could be
163 clipped. Realize however that this is a rare case: Fossil currently
164 cannot store files large enough to exceed a 32-bit `size_t` value,
165 and `time_t` won’t roll past 32-bit integers until 2038. We’re aware
166 of no other uses of integers in this API that could even in
167 principle exceed the range of a 32-bit integer.
168 - **Timestamps:** For portability, this API uses UTC Unix epoch
169 timestamps. (`time_t`) They are the most portable time representation out
170 there, easily usable in most programming environments. (In
171 hindsight, we might better have used a higher-precision time format,
172 but changing that now would break API compatibility.)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -158,11 +158,11 @@
158158
VERSION files
159159
in the root of the source tree are the three arguments and
160160
the generated VERSION.h file appears on standard output.
161161
162162
The builtin_data.h header file is generated by a C program: src/mkbuiltin.c.
163
-The builtin_data.h file contains C-langauge byte-array definitions for
163
+The builtin_data.h file contains C-language byte-array definitions for
164164
the content of resource files used by Fossil. To generate the
165165
builtin_data.h file, first compile the mkbuiltin.c program, then run:
166166
167167
<blockquote><pre>
168168
mkbuiltin.exe diff.tcl <i>OtherFiles...</i> &gt;builtin_data.h
169169
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -158,11 +158,11 @@
158 VERSION files
159 in the root of the source tree are the three arguments and
160 the generated VERSION.h file appears on standard output.
161
162 The builtin_data.h header file is generated by a C program: src/mkbuiltin.c.
163 The builtin_data.h file contains C-langauge byte-array definitions for
164 the content of resource files used by Fossil. To generate the
165 builtin_data.h file, first compile the mkbuiltin.c program, then run:
166
167 <blockquote><pre>
168 mkbuiltin.exe diff.tcl <i>OtherFiles...</i> &gt;builtin_data.h
169
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -158,11 +158,11 @@
158 VERSION files
159 in the root of the source tree are the three arguments and
160 the generated VERSION.h file appears on standard output.
161
162 The builtin_data.h header file is generated by a C program: src/mkbuiltin.c.
163 The builtin_data.h file contains C-language byte-array definitions for
164 the content of resource files used by Fossil. To generate the
165 builtin_data.h file, first compile the mkbuiltin.c program, then run:
166
167 <blockquote><pre>
168 mkbuiltin.exe diff.tcl <i>OtherFiles...</i> &gt;builtin_data.h
169
--- www/mirrortogithub.md
+++ www/mirrortogithub.md
@@ -107,11 +107,12 @@
107107
Git. Be careful not to mess with the `.mirror_state` directory or
108108
any of its contents. Do not put those files under Git management. Do
109109
not edit or delete them.
110110
111111
* The name of the "trunk" branch is automatically translated into "master"
112
- in the Git mirror.
112
+ in the Git mirror unless you give the `--mainbranch` option,
113
+ added in Fossil 2.14.
113114
114115
* Only check-ins and simple tags are translated to Git. Git does not
115116
support wiki or tickets or unversioned content or any of the other
116117
features of Fossil that make it so convenient to use, so those other
117118
elements cannot be mirrored in Git.
118119
--- www/mirrortogithub.md
+++ www/mirrortogithub.md
@@ -107,11 +107,12 @@
107 Git. Be careful not to mess with the `.mirror_state` directory or
108 any of its contents. Do not put those files under Git management. Do
109 not edit or delete them.
110
111 * The name of the "trunk" branch is automatically translated into "master"
112 in the Git mirror.
 
113
114 * Only check-ins and simple tags are translated to Git. Git does not
115 support wiki or tickets or unversioned content or any of the other
116 features of Fossil that make it so convenient to use, so those other
117 elements cannot be mirrored in Git.
118
--- www/mirrortogithub.md
+++ www/mirrortogithub.md
@@ -107,11 +107,12 @@
107 Git. Be careful not to mess with the `.mirror_state` directory or
108 any of its contents. Do not put those files under Git management. Do
109 not edit or delete them.
110
111 * The name of the "trunk" branch is automatically translated into "master"
112 in the Git mirror unless you give the `--mainbranch` option,
113 added in Fossil 2.14.
114
115 * Only check-ins and simple tags are translated to Git. Git does not
116 support wiki or tickets or unversioned content or any of the other
117 features of Fossil that make it so convenient to use, so those other
118 elements cannot be mirrored in Git.
119
+7 -1
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -24,16 +24,20 @@
2424
caps/ {Administering User Capabilities}
2525
caps/admin-v-setup.md {Differences Between Setup and Admin Users}
2626
caps/ref.html {User Capability Reference}
2727
cgi.wiki {CGI Script Configuration Options}
2828
changes.wiki {Fossil Changelog}
29
+ chat.md {Fossil Chat}
2930
checkin_names.wiki {Check-in And Version Names}
3031
checkin.wiki {Check-in Checklist}
3132
childprojects.wiki {Child Projects}
33
+ chroot.md {Server Chroot Jail}
3234
ckout-workflows.md {Check-Out Workflows}
35
+ co-vs-up.md {Checkout vs Update}
3336
copyright-release.html {Contributor License Agreement}
3437
concepts.wiki {Fossil Core Concepts}
38
+ contact.md {Developer Contact Information}
3539
contribute.wiki {Contributing Code or Documentation To The Fossil Project}
3640
css-tricks.md {Fossil CSS Tips and Tricks}
3741
customgraph.md {Theming: Customizing the Timeline Graph}
3842
customskin.md {Theming: Customizing The Appearance of Web Pages}
3943
customskin.md {Custom Skins}
@@ -67,16 +71,18 @@
6771
index.wiki {Home Page}
6872
inout.wiki {Import And Export To And From Git}
6973
interwiki.md {Interwiki Links}
7074
image-format-vs-repo-size.md {Image Format vs Fossil Repo Size}
7175
javascript.md {Use of JavaScript in Fossil}
76
+ loadmgmt.md {Managing Server Load}
7277
makefile.wiki {The Fossil Build Process}
7378
mirrorlimitations.md {Limitations On Git Mirrors}
7479
mirrortogithub.md {How To Mirror A Fossil Repository On GitHub}
7580
/md_rules {Markdown Formatting Rules}
7681
newrepo.wiki {How To Create A New Fossil Repository}
7782
password.wiki {Password Management And Authentication}
83
+ pikchr.md {The Pikchr Diagram Language}
7884
pop.wiki {Principles Of Operation}
7985
private.wiki {Creating, Syncing, and Deleting Private Branches}
8086
qandc.wiki {Questions And Criticisms}
8187
quickstart.wiki {Fossil Quick Start Guide}
8288
quotes.wiki
@@ -98,12 +104,12 @@
98104
sync.wiki {The Fossil Sync Protocol}
99105
tech_overview.wiki {A Technical Overview Of The Design And Implementation
100106
Of Fossil}
101107
tech_overview.wiki {SQLite Databases Used By Fossil}
102108
th1.md {The TH1 Scripting Language}
103
- tickets.wiki {The Fossil Ticket System}
104109
theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
110
+ tickets.wiki {The Fossil Ticket System}
105111
unvers.wiki {Unversioned Files}
106112
webpage-ex.md {Webpage Examples}
107113
webui.wiki {The Fossil Web Interface}
108114
whyusefossil.wiki {Why You Should Use Fossil}
109115
whyusefossil.wiki {Benefits Of Version Control}
110116
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -24,16 +24,20 @@
24 caps/ {Administering User Capabilities}
25 caps/admin-v-setup.md {Differences Between Setup and Admin Users}
26 caps/ref.html {User Capability Reference}
27 cgi.wiki {CGI Script Configuration Options}
28 changes.wiki {Fossil Changelog}
 
29 checkin_names.wiki {Check-in And Version Names}
30 checkin.wiki {Check-in Checklist}
31 childprojects.wiki {Child Projects}
 
32 ckout-workflows.md {Check-Out Workflows}
 
33 copyright-release.html {Contributor License Agreement}
34 concepts.wiki {Fossil Core Concepts}
 
35 contribute.wiki {Contributing Code or Documentation To The Fossil Project}
36 css-tricks.md {Fossil CSS Tips and Tricks}
37 customgraph.md {Theming: Customizing the Timeline Graph}
38 customskin.md {Theming: Customizing The Appearance of Web Pages}
39 customskin.md {Custom Skins}
@@ -67,16 +71,18 @@
67 index.wiki {Home Page}
68 inout.wiki {Import And Export To And From Git}
69 interwiki.md {Interwiki Links}
70 image-format-vs-repo-size.md {Image Format vs Fossil Repo Size}
71 javascript.md {Use of JavaScript in Fossil}
 
72 makefile.wiki {The Fossil Build Process}
73 mirrorlimitations.md {Limitations On Git Mirrors}
74 mirrortogithub.md {How To Mirror A Fossil Repository On GitHub}
75 /md_rules {Markdown Formatting Rules}
76 newrepo.wiki {How To Create A New Fossil Repository}
77 password.wiki {Password Management And Authentication}
 
78 pop.wiki {Principles Of Operation}
79 private.wiki {Creating, Syncing, and Deleting Private Branches}
80 qandc.wiki {Questions And Criticisms}
81 quickstart.wiki {Fossil Quick Start Guide}
82 quotes.wiki
@@ -98,12 +104,12 @@
98 sync.wiki {The Fossil Sync Protocol}
99 tech_overview.wiki {A Technical Overview Of The Design And Implementation
100 Of Fossil}
101 tech_overview.wiki {SQLite Databases Used By Fossil}
102 th1.md {The TH1 Scripting Language}
103 tickets.wiki {The Fossil Ticket System}
104 theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
 
105 unvers.wiki {Unversioned Files}
106 webpage-ex.md {Webpage Examples}
107 webui.wiki {The Fossil Web Interface}
108 whyusefossil.wiki {Why You Should Use Fossil}
109 whyusefossil.wiki {Benefits Of Version Control}
110
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -24,16 +24,20 @@
24 caps/ {Administering User Capabilities}
25 caps/admin-v-setup.md {Differences Between Setup and Admin Users}
26 caps/ref.html {User Capability Reference}
27 cgi.wiki {CGI Script Configuration Options}
28 changes.wiki {Fossil Changelog}
29 chat.md {Fossil Chat}
30 checkin_names.wiki {Check-in And Version Names}
31 checkin.wiki {Check-in Checklist}
32 childprojects.wiki {Child Projects}
33 chroot.md {Server Chroot Jail}
34 ckout-workflows.md {Check-Out Workflows}
35 co-vs-up.md {Checkout vs Update}
36 copyright-release.html {Contributor License Agreement}
37 concepts.wiki {Fossil Core Concepts}
38 contact.md {Developer Contact Information}
39 contribute.wiki {Contributing Code or Documentation To The Fossil Project}
40 css-tricks.md {Fossil CSS Tips and Tricks}
41 customgraph.md {Theming: Customizing the Timeline Graph}
42 customskin.md {Theming: Customizing The Appearance of Web Pages}
43 customskin.md {Custom Skins}
@@ -67,16 +71,18 @@
71 index.wiki {Home Page}
72 inout.wiki {Import And Export To And From Git}
73 interwiki.md {Interwiki Links}
74 image-format-vs-repo-size.md {Image Format vs Fossil Repo Size}
75 javascript.md {Use of JavaScript in Fossil}
76 loadmgmt.md {Managing Server Load}
77 makefile.wiki {The Fossil Build Process}
78 mirrorlimitations.md {Limitations On Git Mirrors}
79 mirrortogithub.md {How To Mirror A Fossil Repository On GitHub}
80 /md_rules {Markdown Formatting Rules}
81 newrepo.wiki {How To Create A New Fossil Repository}
82 password.wiki {Password Management And Authentication}
83 pikchr.md {The Pikchr Diagram Language}
84 pop.wiki {Principles Of Operation}
85 private.wiki {Creating, Syncing, and Deleting Private Branches}
86 qandc.wiki {Questions And Criticisms}
87 quickstart.wiki {Fossil Quick Start Guide}
88 quotes.wiki
@@ -98,12 +104,12 @@
104 sync.wiki {The Fossil Sync Protocol}
105 tech_overview.wiki {A Technical Overview Of The Design And Implementation
106 Of Fossil}
107 tech_overview.wiki {SQLite Databases Used By Fossil}
108 th1.md {The TH1 Scripting Language}
 
109 theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
110 tickets.wiki {The Fossil Ticket System}
111 unvers.wiki {Unversioned Files}
112 webpage-ex.md {Webpage Examples}
113 webui.wiki {The Fossil Web Interface}
114 whyusefossil.wiki {Why You Should Use Fossil}
115 whyusefossil.wiki {Benefits Of Version Control}
116
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -56,27 +56,31 @@
5656
<li><a href="cgi.wiki"><b>CGI Script Configuration Options</b></a></li>
5757
<li><a href="serverext.wiki">CGI Scripts &mdash; Adding Extensions To A Fossil Server Using</a></li>
5858
<li><a href="serverext.wiki"><b>CGI Server Extensions</b></a></li>
5959
<li><a href="aboutcgi.wiki">CGI Works In Fossil &mdash; How</a></li>
6060
<li><a href="changes.wiki">Changelog &mdash; Fossil</a></li>
61
+<li><a href="chat.md">Chat &mdash; Fossil</a></li>
6162
<li><a href="checkin_names.wiki"><b>Check-in And Version Names</b></a></li>
6263
<li><a href="checkin.wiki"><b>Check-in Checklist</b></a></li>
6364
<li><a href="ckout-workflows.md"><b>Check-Out Workflows</b></a></li>
6465
<li><a href="checkin.wiki">Checklist &mdash; Check-in</a></li>
6566
<li><a href="../test/release-checklist.wiki">Checklist &mdash; Pre-Release Testing</a></li>
6667
<li><a href="foss-cklist.wiki"><b>Checklist For Successful Open-Source Projects</b></a></li>
68
+<li><a href="co-vs-up.md"><b>Checkout vs Update</b></a></li>
6769
<li><a href="selfcheck.wiki">Checks &mdash; Fossil Repository Integrity Self</a></li>
6870
<li><a href="childprojects.wiki"><b>Child Projects</b></a></li>
6971
<li><a href="hashpolicy.wiki">Choosing Between SHA1 and SHA3-256 &mdash; Hash Policy:</a></li>
72
+<li><a href="chroot.md">Chroot Jail &mdash; Server</a></li>
7073
<li><a href="contribute.wiki">Code or Documentation To The Fossil Project &mdash; Contributing</a></li>
7174
<li><a href="style.wiki">Code Style Guidelines &mdash; Source</a></li>
7275
<li><a href="../../../help">Commands and Webpages &mdash; Lists of</a></li>
7376
<li><a href="build.wiki"><b>Compiling and Installing Fossil</b></a></li>
7477
<li><a href="concepts.wiki">Concepts &mdash; Fossil Core</a></li>
7578
<li><a href="cgi.wiki">Configuration Options &mdash; CGI Script</a></li>
7679
<li><a href="server/">Configure A Fossil Server &mdash; How To</a></li>
7780
<li><a href="rebaseharm.md">Considered Harmful &mdash; Rebase</a></li>
81
+<li><a href="contact.md">Contact Information &mdash; Developer</a></li>
7882
<li><a href="shunning.wiki">Content From Fossil &mdash; Shunning: Deleting</a></li>
7983
<li><a href="defcsp.md">Content Security Policy &mdash; The Default</a></li>
8084
<li><a href="contribute.wiki"><b>Contributing Code or Documentation To The Fossil Project</b></a></li>
8185
<li><a href="copyright-release.html"><b>Contributor License Agreement</b></a></li>
8286
<li><a href="whyusefossil.wiki">Control &mdash; Benefits Of Version</a></li>
@@ -96,11 +100,13 @@
96100
<li><a href="private.wiki">Deleting Private Branches &mdash; Creating, Syncing, and</a></li>
97101
<li><a href="delta_encoder_algorithm.wiki">Delta Encoding Algorithm &mdash; Fossil</a></li>
98102
<li><a href="delta_format.wiki">Delta Format &mdash; Fossil</a></li>
99103
<li><a href="tech_overview.wiki">Design And Implementation Of Fossil &mdash; A Technical Overview Of The</a></li>
100104
<li><a href="theory1.wiki">Design Of The Fossil DVCS &mdash; Thoughts On The</a></li>
105
+<li><a href="contact.md"><b>Developer Contact Information</b></a></li>
101106
<li><a href="hacker-howto.wiki">Developers Guide &mdash; Fossil</a></li>
107
+<li><a href="pikchr.md">Diagram Language &mdash; The Pikchr</a></li>
102108
<li><a href="caps/admin-v-setup.md"><b>Differences Between Setup and Admin Users</b></a></li>
103109
<li><a href="embeddeddoc.wiki">Documentation &mdash; Embedded Project</a></li>
104110
<li><a href="contribute.wiki">Documentation To The Fossil Project &mdash; Contributing Code or</a></li>
105111
<li><a href="aboutdownload.wiki">Download Page Works &mdash; How The</a></li>
106112
<li><a href="theory1.wiki">DVCS &mdash; Thoughts On The Design Of The Fossil</a></li>
@@ -128,10 +134,11 @@
128134
<li><a href="../../../md_rules">Formatting Rules &mdash; Markdown</a></li>
129135
<li><a href="../../../wiki_rules">Formatting Rules &mdash; Wiki</a></li>
130136
<li><a href="forum.wiki">Forums &mdash; Fossil</a></li>
131137
<li><a href="cap-theorem.md"><b>Fossil and the CAP Theorem</b></a></li>
132138
<li><a href="changes.wiki"><b>Fossil Changelog</b></a></li>
139
+<li><a href="chat.md"><b>Fossil Chat</b></a></li>
133140
<li><a href="concepts.wiki"><b>Fossil Core Concepts</b></a></li>
134141
<li><a href="css-tricks.md"><b>Fossil CSS Tips and Tricks</b></a></li>
135142
<li><a href="delta_encoder_algorithm.wiki"><b>Fossil Delta Encoding Algorithm</b></a></li>
136143
<li><a href="delta_format.wiki"><b>Fossil Delta Format</b></a></li>
137144
<li><a href="hacker-howto.wiki"><b>Fossil Developers Guide</b></a></li>
@@ -182,23 +189,28 @@
182189
<li><a href="fossil-from-msvc.wiki">IDE &mdash; Integrating Fossil in the Microsoft Express 2010</a></li>
183190
<li><a href="hashes.md">Identification &mdash; Hashes: Fossil Artifact</a></li>
184191
<li><a href="image-format-vs-repo-size.md"><b>Image Format vs Fossil Repo Size</b></a></li>
185192
<li><a href="tech_overview.wiki">Implementation Of Fossil &mdash; A Technical Overview Of The Design And</a></li>
186193
<li><a href="inout.wiki"><b>Import And Export To And From Git</b></a></li>
194
+<li><a href="contact.md">Information &mdash; Developer Contact</a></li>
187195
<li><a href="build.wiki">Installing Fossil &mdash; Compiling and</a></li>
188196
<li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li>
189197
<li><a href="selfcheck.wiki">Integrity Self Checks &mdash; Fossil Repository</a></li>
190198
<li><a href="webui.wiki">Interface &mdash; The Fossil Web</a></li>
191199
<li><a href="interwiki.md"><b>Interwiki Links</b></a></li>
192200
<li><a href="blockchain.md"><b>Is Fossil A Blockchain?</b></a></li>
201
+<li><a href="chroot.md">Jail &mdash; Server Chroot</a></li>
193202
<li><a href="javascript.md">JavaScript in Fossil &mdash; Use of</a></li>
203
+<li><a href="pikchr.md">Language &mdash; The Pikchr Diagram</a></li>
194204
<li><a href="th1.md">Language &mdash; The TH1 Scripting</a></li>
195205
<li><a href="copyright-release.html">License Agreement &mdash; Contributor</a></li>
196206
<li><a href="mirrorlimitations.md"><b>Limitations On Git Mirrors</b></a></li>
197207
<li><a href="interwiki.md">Links &mdash; Interwiki</a></li>
198208
<li><a href="../../../help"><b>Lists of Commands and Webpages</b></a></li>
209
+<li><a href="loadmgmt.md">Load &mdash; Managing Server</a></li>
199210
<li><a href="password.wiki">Management And Authentication &mdash; Password</a></li>
211
+<li><a href="loadmgmt.md"><b>Managing Server Load</b></a></li>
200212
<li><a href="../../../sitemap">Map &mdash; Site</a></li>
201213
<li><a href="../../../md_rules"><b>Markdown Formatting Rules</b></a></li>
202214
<li><a href="backoffice.md">mechanism of Fossil &mdash; The Backoffice</a></li>
203215
<li><a href="branching.wiki">Merging, and Tagging &mdash; Branching, Forking,</a></li>
204216
<li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE &mdash; Integrating Fossil in the</a></li>
@@ -221,10 +233,11 @@
221233
<li><a href="customskin.md">Pages &mdash; Theming: Customizing The Appearance of Web</a></li>
222234
<li><a href="password.wiki"><b>Password Management And Authentication</b></a></li>
223235
<li><a href="globs.md">Patterns &mdash; File Name Glob</a></li>
224236
<li><a href="quotes.wiki">People Are Saying About Fossil, Git, and DVCSes in General &mdash; Quotes: What</a></li>
225237
<li><a href="stats.wiki"><b>Performance Statistics</b></a></li>
238
+<li><a href="pikchr.md">Pikchr Diagram Language &mdash; The</a></li>
226239
<li><a href="defcsp.md">Policy &mdash; The Default Content Security</a></li>
227240
<li><a href="hashpolicy.wiki">Policy: Choosing Between SHA1 and SHA3-256 &mdash; Hash</a></li>
228241
<li><a href="grep.md">POSIX grep &mdash; Fossil grep vs</a></li>
229242
<li><a href="../test/release-checklist.wiki"><b>Pre-Release Testing Checklist</b></a></li>
230243
<li><a href="pop.wiki"><b>Principles Of Operation</b></a></li>
@@ -261,11 +274,13 @@
261274
<li><a href="serverext.wiki">Scripts &mdash; Adding Extensions To A Fossil Server Using CGI</a></li>
262275
<li><a href="defcsp.md">Security Policy &mdash; The Default Content</a></li>
263276
<li><a href="selfcheck.wiki">Self Checks &mdash; Fossil Repository Integrity</a></li>
264277
<li><a href="selfhost.wiki">Self Hosting Repositories &mdash; Fossil</a></li>
265278
<li><a href="server/">Server &mdash; How To Configure A Fossil</a></li>
279
+<li><a href="chroot.md"><b>Server Chroot Jail</b></a></li>
266280
<li><a href="serverext.wiki">Server Extensions &mdash; CGI</a></li>
281
+<li><a href="loadmgmt.md">Server Load &mdash; Managing</a></li>
267282
<li><a href="serverext.wiki">Server Using CGI Scripts &mdash; Adding Extensions To A Fossil</a></li>
268283
<li><a href="settings.wiki">Settings &mdash; Fossil</a></li>
269284
<li><a href="caps/admin-v-setup.md">Setup and Admin Users &mdash; Differences Between</a></li>
270285
<li><a href="hashpolicy.wiki">SHA1 and SHA3-256 &mdash; Hash Policy: Choosing Between</a></li>
271286
<li><a href="hashpolicy.wiki">SHA3-256 &mdash; Hash Policy: Choosing Between SHA1 and</a></li>
@@ -296,10 +311,11 @@
296311
<li><a href="fileedit-page.md"><b>The fileedit Page</b></a></li>
297312
<li><a href="makefile.wiki"><b>The Fossil Build Process</b></a></li>
298313
<li><a href="sync.wiki"><b>The Fossil Sync Protocol</b></a></li>
299314
<li><a href="tickets.wiki"><b>The Fossil Ticket System</b></a></li>
300315
<li><a href="webui.wiki"><b>The Fossil Web Interface</b></a></li>
316
+<li><a href="pikchr.md"><b>The Pikchr Diagram Language</b></a></li>
301317
<li><a href="history.md"><b>The Purpose And History Of Fossil</b></a></li>
302318
<li><a href="th1.md"><b>The TH1 Scripting Language</b></a></li>
303319
<li><a href="customskin.md"><b>Theming: Customizing The Appearance of Web Pages</b></a></li>
304320
<li><a href="customgraph.md"><b>Theming: Customizing the Timeline Graph</b></a></li>
305321
<li><a href="cap-theorem.md">Theorem &mdash; Fossil and the CAP</a></li>
@@ -313,10 +329,11 @@
313329
<li><a href="gitusers.md">Translation Guide &mdash; Git to Fossil</a></li>
314330
<li><a href="css-tricks.md">Tricks &mdash; Fossil CSS Tips and</a></li>
315331
<li><a href="unvers.wiki"><b>Unversioned Files</b></a></li>
316332
<li><a href="backup.md">Up a Remote Fossil Repository &mdash; Backing</a></li>
317333
<li><a href="fiveminutes.wiki"><b>Up and Running in 5 Minutes as a Single User</b></a></li>
334
+<li><a href="co-vs-up.md">Update &mdash; Checkout vs</a></li>
318335
<li><a href="hints.wiki">Usage Hints &mdash; Fossil Tips And</a></li>
319336
<li><a href="javascript.md"><b>Use of JavaScript in Fossil</b></a></li>
320337
<li><a href="fiveminutes.wiki">User &mdash; Up and Running in 5 Minutes as a Single</a></li>
321338
<li><a href="caps/">User Capabilities &mdash; Administering</a></li>
322339
<li><a href="caps/ref.html"><b>User Capability Reference</b></a></li>
@@ -327,10 +344,11 @@
327344
<li><a href="whyusefossil.wiki">Version Control &mdash; Benefits Of</a></li>
328345
<li><a href="checkin_names.wiki">Version Names &mdash; Check-in And</a></li>
329346
<li><a href="fossil-v-git.wiki">Versus Git &mdash; Fossil</a></li>
330347
<li><a href="image-format-vs-repo-size.md">vs Fossil Repo Size &mdash; Image Format</a></li>
331348
<li><a href="grep.md">vs POSIX grep &mdash; Fossil grep</a></li>
349
+<li><a href="co-vs-up.md">vs Update &mdash; Checkout</a></li>
332350
<li><a href="webui.wiki">Web Interface &mdash; The Fossil</a></li>
333351
<li><a href="customskin.md">Web Pages &mdash; Theming: Customizing The Appearance of</a></li>
334352
<li><a href="webpage-ex.md"><b>Webpage Examples</b></a></li>
335353
<li><a href="../../../help">Webpages &mdash; Lists of Commands and</a></li>
336354
<li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General &mdash; Quotes:</a></li>
337355
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -56,27 +56,31 @@
56 <li><a href="cgi.wiki"><b>CGI Script Configuration Options</b></a></li>
57 <li><a href="serverext.wiki">CGI Scripts &mdash; Adding Extensions To A Fossil Server Using</a></li>
58 <li><a href="serverext.wiki"><b>CGI Server Extensions</b></a></li>
59 <li><a href="aboutcgi.wiki">CGI Works In Fossil &mdash; How</a></li>
60 <li><a href="changes.wiki">Changelog &mdash; Fossil</a></li>
 
61 <li><a href="checkin_names.wiki"><b>Check-in And Version Names</b></a></li>
62 <li><a href="checkin.wiki"><b>Check-in Checklist</b></a></li>
63 <li><a href="ckout-workflows.md"><b>Check-Out Workflows</b></a></li>
64 <li><a href="checkin.wiki">Checklist &mdash; Check-in</a></li>
65 <li><a href="../test/release-checklist.wiki">Checklist &mdash; Pre-Release Testing</a></li>
66 <li><a href="foss-cklist.wiki"><b>Checklist For Successful Open-Source Projects</b></a></li>
 
67 <li><a href="selfcheck.wiki">Checks &mdash; Fossil Repository Integrity Self</a></li>
68 <li><a href="childprojects.wiki"><b>Child Projects</b></a></li>
69 <li><a href="hashpolicy.wiki">Choosing Between SHA1 and SHA3-256 &mdash; Hash Policy:</a></li>
 
70 <li><a href="contribute.wiki">Code or Documentation To The Fossil Project &mdash; Contributing</a></li>
71 <li><a href="style.wiki">Code Style Guidelines &mdash; Source</a></li>
72 <li><a href="../../../help">Commands and Webpages &mdash; Lists of</a></li>
73 <li><a href="build.wiki"><b>Compiling and Installing Fossil</b></a></li>
74 <li><a href="concepts.wiki">Concepts &mdash; Fossil Core</a></li>
75 <li><a href="cgi.wiki">Configuration Options &mdash; CGI Script</a></li>
76 <li><a href="server/">Configure A Fossil Server &mdash; How To</a></li>
77 <li><a href="rebaseharm.md">Considered Harmful &mdash; Rebase</a></li>
 
78 <li><a href="shunning.wiki">Content From Fossil &mdash; Shunning: Deleting</a></li>
79 <li><a href="defcsp.md">Content Security Policy &mdash; The Default</a></li>
80 <li><a href="contribute.wiki"><b>Contributing Code or Documentation To The Fossil Project</b></a></li>
81 <li><a href="copyright-release.html"><b>Contributor License Agreement</b></a></li>
82 <li><a href="whyusefossil.wiki">Control &mdash; Benefits Of Version</a></li>
@@ -96,11 +100,13 @@
96 <li><a href="private.wiki">Deleting Private Branches &mdash; Creating, Syncing, and</a></li>
97 <li><a href="delta_encoder_algorithm.wiki">Delta Encoding Algorithm &mdash; Fossil</a></li>
98 <li><a href="delta_format.wiki">Delta Format &mdash; Fossil</a></li>
99 <li><a href="tech_overview.wiki">Design And Implementation Of Fossil &mdash; A Technical Overview Of The</a></li>
100 <li><a href="theory1.wiki">Design Of The Fossil DVCS &mdash; Thoughts On The</a></li>
 
101 <li><a href="hacker-howto.wiki">Developers Guide &mdash; Fossil</a></li>
 
102 <li><a href="caps/admin-v-setup.md"><b>Differences Between Setup and Admin Users</b></a></li>
103 <li><a href="embeddeddoc.wiki">Documentation &mdash; Embedded Project</a></li>
104 <li><a href="contribute.wiki">Documentation To The Fossil Project &mdash; Contributing Code or</a></li>
105 <li><a href="aboutdownload.wiki">Download Page Works &mdash; How The</a></li>
106 <li><a href="theory1.wiki">DVCS &mdash; Thoughts On The Design Of The Fossil</a></li>
@@ -128,10 +134,11 @@
128 <li><a href="../../../md_rules">Formatting Rules &mdash; Markdown</a></li>
129 <li><a href="../../../wiki_rules">Formatting Rules &mdash; Wiki</a></li>
130 <li><a href="forum.wiki">Forums &mdash; Fossil</a></li>
131 <li><a href="cap-theorem.md"><b>Fossil and the CAP Theorem</b></a></li>
132 <li><a href="changes.wiki"><b>Fossil Changelog</b></a></li>
 
133 <li><a href="concepts.wiki"><b>Fossil Core Concepts</b></a></li>
134 <li><a href="css-tricks.md"><b>Fossil CSS Tips and Tricks</b></a></li>
135 <li><a href="delta_encoder_algorithm.wiki"><b>Fossil Delta Encoding Algorithm</b></a></li>
136 <li><a href="delta_format.wiki"><b>Fossil Delta Format</b></a></li>
137 <li><a href="hacker-howto.wiki"><b>Fossil Developers Guide</b></a></li>
@@ -182,23 +189,28 @@
182 <li><a href="fossil-from-msvc.wiki">IDE &mdash; Integrating Fossil in the Microsoft Express 2010</a></li>
183 <li><a href="hashes.md">Identification &mdash; Hashes: Fossil Artifact</a></li>
184 <li><a href="image-format-vs-repo-size.md"><b>Image Format vs Fossil Repo Size</b></a></li>
185 <li><a href="tech_overview.wiki">Implementation Of Fossil &mdash; A Technical Overview Of The Design And</a></li>
186 <li><a href="inout.wiki"><b>Import And Export To And From Git</b></a></li>
 
187 <li><a href="build.wiki">Installing Fossil &mdash; Compiling and</a></li>
188 <li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li>
189 <li><a href="selfcheck.wiki">Integrity Self Checks &mdash; Fossil Repository</a></li>
190 <li><a href="webui.wiki">Interface &mdash; The Fossil Web</a></li>
191 <li><a href="interwiki.md"><b>Interwiki Links</b></a></li>
192 <li><a href="blockchain.md"><b>Is Fossil A Blockchain?</b></a></li>
 
193 <li><a href="javascript.md">JavaScript in Fossil &mdash; Use of</a></li>
 
194 <li><a href="th1.md">Language &mdash; The TH1 Scripting</a></li>
195 <li><a href="copyright-release.html">License Agreement &mdash; Contributor</a></li>
196 <li><a href="mirrorlimitations.md"><b>Limitations On Git Mirrors</b></a></li>
197 <li><a href="interwiki.md">Links &mdash; Interwiki</a></li>
198 <li><a href="../../../help"><b>Lists of Commands and Webpages</b></a></li>
 
199 <li><a href="password.wiki">Management And Authentication &mdash; Password</a></li>
 
200 <li><a href="../../../sitemap">Map &mdash; Site</a></li>
201 <li><a href="../../../md_rules"><b>Markdown Formatting Rules</b></a></li>
202 <li><a href="backoffice.md">mechanism of Fossil &mdash; The Backoffice</a></li>
203 <li><a href="branching.wiki">Merging, and Tagging &mdash; Branching, Forking,</a></li>
204 <li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE &mdash; Integrating Fossil in the</a></li>
@@ -221,10 +233,11 @@
221 <li><a href="customskin.md">Pages &mdash; Theming: Customizing The Appearance of Web</a></li>
222 <li><a href="password.wiki"><b>Password Management And Authentication</b></a></li>
223 <li><a href="globs.md">Patterns &mdash; File Name Glob</a></li>
224 <li><a href="quotes.wiki">People Are Saying About Fossil, Git, and DVCSes in General &mdash; Quotes: What</a></li>
225 <li><a href="stats.wiki"><b>Performance Statistics</b></a></li>
 
226 <li><a href="defcsp.md">Policy &mdash; The Default Content Security</a></li>
227 <li><a href="hashpolicy.wiki">Policy: Choosing Between SHA1 and SHA3-256 &mdash; Hash</a></li>
228 <li><a href="grep.md">POSIX grep &mdash; Fossil grep vs</a></li>
229 <li><a href="../test/release-checklist.wiki"><b>Pre-Release Testing Checklist</b></a></li>
230 <li><a href="pop.wiki"><b>Principles Of Operation</b></a></li>
@@ -261,11 +274,13 @@
261 <li><a href="serverext.wiki">Scripts &mdash; Adding Extensions To A Fossil Server Using CGI</a></li>
262 <li><a href="defcsp.md">Security Policy &mdash; The Default Content</a></li>
263 <li><a href="selfcheck.wiki">Self Checks &mdash; Fossil Repository Integrity</a></li>
264 <li><a href="selfhost.wiki">Self Hosting Repositories &mdash; Fossil</a></li>
265 <li><a href="server/">Server &mdash; How To Configure A Fossil</a></li>
 
266 <li><a href="serverext.wiki">Server Extensions &mdash; CGI</a></li>
 
267 <li><a href="serverext.wiki">Server Using CGI Scripts &mdash; Adding Extensions To A Fossil</a></li>
268 <li><a href="settings.wiki">Settings &mdash; Fossil</a></li>
269 <li><a href="caps/admin-v-setup.md">Setup and Admin Users &mdash; Differences Between</a></li>
270 <li><a href="hashpolicy.wiki">SHA1 and SHA3-256 &mdash; Hash Policy: Choosing Between</a></li>
271 <li><a href="hashpolicy.wiki">SHA3-256 &mdash; Hash Policy: Choosing Between SHA1 and</a></li>
@@ -296,10 +311,11 @@
296 <li><a href="fileedit-page.md"><b>The fileedit Page</b></a></li>
297 <li><a href="makefile.wiki"><b>The Fossil Build Process</b></a></li>
298 <li><a href="sync.wiki"><b>The Fossil Sync Protocol</b></a></li>
299 <li><a href="tickets.wiki"><b>The Fossil Ticket System</b></a></li>
300 <li><a href="webui.wiki"><b>The Fossil Web Interface</b></a></li>
 
301 <li><a href="history.md"><b>The Purpose And History Of Fossil</b></a></li>
302 <li><a href="th1.md"><b>The TH1 Scripting Language</b></a></li>
303 <li><a href="customskin.md"><b>Theming: Customizing The Appearance of Web Pages</b></a></li>
304 <li><a href="customgraph.md"><b>Theming: Customizing the Timeline Graph</b></a></li>
305 <li><a href="cap-theorem.md">Theorem &mdash; Fossil and the CAP</a></li>
@@ -313,10 +329,11 @@
313 <li><a href="gitusers.md">Translation Guide &mdash; Git to Fossil</a></li>
314 <li><a href="css-tricks.md">Tricks &mdash; Fossil CSS Tips and</a></li>
315 <li><a href="unvers.wiki"><b>Unversioned Files</b></a></li>
316 <li><a href="backup.md">Up a Remote Fossil Repository &mdash; Backing</a></li>
317 <li><a href="fiveminutes.wiki"><b>Up and Running in 5 Minutes as a Single User</b></a></li>
 
318 <li><a href="hints.wiki">Usage Hints &mdash; Fossil Tips And</a></li>
319 <li><a href="javascript.md"><b>Use of JavaScript in Fossil</b></a></li>
320 <li><a href="fiveminutes.wiki">User &mdash; Up and Running in 5 Minutes as a Single</a></li>
321 <li><a href="caps/">User Capabilities &mdash; Administering</a></li>
322 <li><a href="caps/ref.html"><b>User Capability Reference</b></a></li>
@@ -327,10 +344,11 @@
327 <li><a href="whyusefossil.wiki">Version Control &mdash; Benefits Of</a></li>
328 <li><a href="checkin_names.wiki">Version Names &mdash; Check-in And</a></li>
329 <li><a href="fossil-v-git.wiki">Versus Git &mdash; Fossil</a></li>
330 <li><a href="image-format-vs-repo-size.md">vs Fossil Repo Size &mdash; Image Format</a></li>
331 <li><a href="grep.md">vs POSIX grep &mdash; Fossil grep</a></li>
 
332 <li><a href="webui.wiki">Web Interface &mdash; The Fossil</a></li>
333 <li><a href="customskin.md">Web Pages &mdash; Theming: Customizing The Appearance of</a></li>
334 <li><a href="webpage-ex.md"><b>Webpage Examples</b></a></li>
335 <li><a href="../../../help">Webpages &mdash; Lists of Commands and</a></li>
336 <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General &mdash; Quotes:</a></li>
337
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -56,27 +56,31 @@
56 <li><a href="cgi.wiki"><b>CGI Script Configuration Options</b></a></li>
57 <li><a href="serverext.wiki">CGI Scripts &mdash; Adding Extensions To A Fossil Server Using</a></li>
58 <li><a href="serverext.wiki"><b>CGI Server Extensions</b></a></li>
59 <li><a href="aboutcgi.wiki">CGI Works In Fossil &mdash; How</a></li>
60 <li><a href="changes.wiki">Changelog &mdash; Fossil</a></li>
61 <li><a href="chat.md">Chat &mdash; Fossil</a></li>
62 <li><a href="checkin_names.wiki"><b>Check-in And Version Names</b></a></li>
63 <li><a href="checkin.wiki"><b>Check-in Checklist</b></a></li>
64 <li><a href="ckout-workflows.md"><b>Check-Out Workflows</b></a></li>
65 <li><a href="checkin.wiki">Checklist &mdash; Check-in</a></li>
66 <li><a href="../test/release-checklist.wiki">Checklist &mdash; Pre-Release Testing</a></li>
67 <li><a href="foss-cklist.wiki"><b>Checklist For Successful Open-Source Projects</b></a></li>
68 <li><a href="co-vs-up.md"><b>Checkout vs Update</b></a></li>
69 <li><a href="selfcheck.wiki">Checks &mdash; Fossil Repository Integrity Self</a></li>
70 <li><a href="childprojects.wiki"><b>Child Projects</b></a></li>
71 <li><a href="hashpolicy.wiki">Choosing Between SHA1 and SHA3-256 &mdash; Hash Policy:</a></li>
72 <li><a href="chroot.md">Chroot Jail &mdash; Server</a></li>
73 <li><a href="contribute.wiki">Code or Documentation To The Fossil Project &mdash; Contributing</a></li>
74 <li><a href="style.wiki">Code Style Guidelines &mdash; Source</a></li>
75 <li><a href="../../../help">Commands and Webpages &mdash; Lists of</a></li>
76 <li><a href="build.wiki"><b>Compiling and Installing Fossil</b></a></li>
77 <li><a href="concepts.wiki">Concepts &mdash; Fossil Core</a></li>
78 <li><a href="cgi.wiki">Configuration Options &mdash; CGI Script</a></li>
79 <li><a href="server/">Configure A Fossil Server &mdash; How To</a></li>
80 <li><a href="rebaseharm.md">Considered Harmful &mdash; Rebase</a></li>
81 <li><a href="contact.md">Contact Information &mdash; Developer</a></li>
82 <li><a href="shunning.wiki">Content From Fossil &mdash; Shunning: Deleting</a></li>
83 <li><a href="defcsp.md">Content Security Policy &mdash; The Default</a></li>
84 <li><a href="contribute.wiki"><b>Contributing Code or Documentation To The Fossil Project</b></a></li>
85 <li><a href="copyright-release.html"><b>Contributor License Agreement</b></a></li>
86 <li><a href="whyusefossil.wiki">Control &mdash; Benefits Of Version</a></li>
@@ -96,11 +100,13 @@
100 <li><a href="private.wiki">Deleting Private Branches &mdash; Creating, Syncing, and</a></li>
101 <li><a href="delta_encoder_algorithm.wiki">Delta Encoding Algorithm &mdash; Fossil</a></li>
102 <li><a href="delta_format.wiki">Delta Format &mdash; Fossil</a></li>
103 <li><a href="tech_overview.wiki">Design And Implementation Of Fossil &mdash; A Technical Overview Of The</a></li>
104 <li><a href="theory1.wiki">Design Of The Fossil DVCS &mdash; Thoughts On The</a></li>
105 <li><a href="contact.md"><b>Developer Contact Information</b></a></li>
106 <li><a href="hacker-howto.wiki">Developers Guide &mdash; Fossil</a></li>
107 <li><a href="pikchr.md">Diagram Language &mdash; The Pikchr</a></li>
108 <li><a href="caps/admin-v-setup.md"><b>Differences Between Setup and Admin Users</b></a></li>
109 <li><a href="embeddeddoc.wiki">Documentation &mdash; Embedded Project</a></li>
110 <li><a href="contribute.wiki">Documentation To The Fossil Project &mdash; Contributing Code or</a></li>
111 <li><a href="aboutdownload.wiki">Download Page Works &mdash; How The</a></li>
112 <li><a href="theory1.wiki">DVCS &mdash; Thoughts On The Design Of The Fossil</a></li>
@@ -128,10 +134,11 @@
134 <li><a href="../../../md_rules">Formatting Rules &mdash; Markdown</a></li>
135 <li><a href="../../../wiki_rules">Formatting Rules &mdash; Wiki</a></li>
136 <li><a href="forum.wiki">Forums &mdash; Fossil</a></li>
137 <li><a href="cap-theorem.md"><b>Fossil and the CAP Theorem</b></a></li>
138 <li><a href="changes.wiki"><b>Fossil Changelog</b></a></li>
139 <li><a href="chat.md"><b>Fossil Chat</b></a></li>
140 <li><a href="concepts.wiki"><b>Fossil Core Concepts</b></a></li>
141 <li><a href="css-tricks.md"><b>Fossil CSS Tips and Tricks</b></a></li>
142 <li><a href="delta_encoder_algorithm.wiki"><b>Fossil Delta Encoding Algorithm</b></a></li>
143 <li><a href="delta_format.wiki"><b>Fossil Delta Format</b></a></li>
144 <li><a href="hacker-howto.wiki"><b>Fossil Developers Guide</b></a></li>
@@ -182,23 +189,28 @@
189 <li><a href="fossil-from-msvc.wiki">IDE &mdash; Integrating Fossil in the Microsoft Express 2010</a></li>
190 <li><a href="hashes.md">Identification &mdash; Hashes: Fossil Artifact</a></li>
191 <li><a href="image-format-vs-repo-size.md"><b>Image Format vs Fossil Repo Size</b></a></li>
192 <li><a href="tech_overview.wiki">Implementation Of Fossil &mdash; A Technical Overview Of The Design And</a></li>
193 <li><a href="inout.wiki"><b>Import And Export To And From Git</b></a></li>
194 <li><a href="contact.md">Information &mdash; Developer Contact</a></li>
195 <li><a href="build.wiki">Installing Fossil &mdash; Compiling and</a></li>
196 <li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li>
197 <li><a href="selfcheck.wiki">Integrity Self Checks &mdash; Fossil Repository</a></li>
198 <li><a href="webui.wiki">Interface &mdash; The Fossil Web</a></li>
199 <li><a href="interwiki.md"><b>Interwiki Links</b></a></li>
200 <li><a href="blockchain.md"><b>Is Fossil A Blockchain?</b></a></li>
201 <li><a href="chroot.md">Jail &mdash; Server Chroot</a></li>
202 <li><a href="javascript.md">JavaScript in Fossil &mdash; Use of</a></li>
203 <li><a href="pikchr.md">Language &mdash; The Pikchr Diagram</a></li>
204 <li><a href="th1.md">Language &mdash; The TH1 Scripting</a></li>
205 <li><a href="copyright-release.html">License Agreement &mdash; Contributor</a></li>
206 <li><a href="mirrorlimitations.md"><b>Limitations On Git Mirrors</b></a></li>
207 <li><a href="interwiki.md">Links &mdash; Interwiki</a></li>
208 <li><a href="../../../help"><b>Lists of Commands and Webpages</b></a></li>
209 <li><a href="loadmgmt.md">Load &mdash; Managing Server</a></li>
210 <li><a href="password.wiki">Management And Authentication &mdash; Password</a></li>
211 <li><a href="loadmgmt.md"><b>Managing Server Load</b></a></li>
212 <li><a href="../../../sitemap">Map &mdash; Site</a></li>
213 <li><a href="../../../md_rules"><b>Markdown Formatting Rules</b></a></li>
214 <li><a href="backoffice.md">mechanism of Fossil &mdash; The Backoffice</a></li>
215 <li><a href="branching.wiki">Merging, and Tagging &mdash; Branching, Forking,</a></li>
216 <li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE &mdash; Integrating Fossil in the</a></li>
@@ -221,10 +233,11 @@
233 <li><a href="customskin.md">Pages &mdash; Theming: Customizing The Appearance of Web</a></li>
234 <li><a href="password.wiki"><b>Password Management And Authentication</b></a></li>
235 <li><a href="globs.md">Patterns &mdash; File Name Glob</a></li>
236 <li><a href="quotes.wiki">People Are Saying About Fossil, Git, and DVCSes in General &mdash; Quotes: What</a></li>
237 <li><a href="stats.wiki"><b>Performance Statistics</b></a></li>
238 <li><a href="pikchr.md">Pikchr Diagram Language &mdash; The</a></li>
239 <li><a href="defcsp.md">Policy &mdash; The Default Content Security</a></li>
240 <li><a href="hashpolicy.wiki">Policy: Choosing Between SHA1 and SHA3-256 &mdash; Hash</a></li>
241 <li><a href="grep.md">POSIX grep &mdash; Fossil grep vs</a></li>
242 <li><a href="../test/release-checklist.wiki"><b>Pre-Release Testing Checklist</b></a></li>
243 <li><a href="pop.wiki"><b>Principles Of Operation</b></a></li>
@@ -261,11 +274,13 @@
274 <li><a href="serverext.wiki">Scripts &mdash; Adding Extensions To A Fossil Server Using CGI</a></li>
275 <li><a href="defcsp.md">Security Policy &mdash; The Default Content</a></li>
276 <li><a href="selfcheck.wiki">Self Checks &mdash; Fossil Repository Integrity</a></li>
277 <li><a href="selfhost.wiki">Self Hosting Repositories &mdash; Fossil</a></li>
278 <li><a href="server/">Server &mdash; How To Configure A Fossil</a></li>
279 <li><a href="chroot.md"><b>Server Chroot Jail</b></a></li>
280 <li><a href="serverext.wiki">Server Extensions &mdash; CGI</a></li>
281 <li><a href="loadmgmt.md">Server Load &mdash; Managing</a></li>
282 <li><a href="serverext.wiki">Server Using CGI Scripts &mdash; Adding Extensions To A Fossil</a></li>
283 <li><a href="settings.wiki">Settings &mdash; Fossil</a></li>
284 <li><a href="caps/admin-v-setup.md">Setup and Admin Users &mdash; Differences Between</a></li>
285 <li><a href="hashpolicy.wiki">SHA1 and SHA3-256 &mdash; Hash Policy: Choosing Between</a></li>
286 <li><a href="hashpolicy.wiki">SHA3-256 &mdash; Hash Policy: Choosing Between SHA1 and</a></li>
@@ -296,10 +311,11 @@
311 <li><a href="fileedit-page.md"><b>The fileedit Page</b></a></li>
312 <li><a href="makefile.wiki"><b>The Fossil Build Process</b></a></li>
313 <li><a href="sync.wiki"><b>The Fossil Sync Protocol</b></a></li>
314 <li><a href="tickets.wiki"><b>The Fossil Ticket System</b></a></li>
315 <li><a href="webui.wiki"><b>The Fossil Web Interface</b></a></li>
316 <li><a href="pikchr.md"><b>The Pikchr Diagram Language</b></a></li>
317 <li><a href="history.md"><b>The Purpose And History Of Fossil</b></a></li>
318 <li><a href="th1.md"><b>The TH1 Scripting Language</b></a></li>
319 <li><a href="customskin.md"><b>Theming: Customizing The Appearance of Web Pages</b></a></li>
320 <li><a href="customgraph.md"><b>Theming: Customizing the Timeline Graph</b></a></li>
321 <li><a href="cap-theorem.md">Theorem &mdash; Fossil and the CAP</a></li>
@@ -313,10 +329,11 @@
329 <li><a href="gitusers.md">Translation Guide &mdash; Git to Fossil</a></li>
330 <li><a href="css-tricks.md">Tricks &mdash; Fossil CSS Tips and</a></li>
331 <li><a href="unvers.wiki"><b>Unversioned Files</b></a></li>
332 <li><a href="backup.md">Up a Remote Fossil Repository &mdash; Backing</a></li>
333 <li><a href="fiveminutes.wiki"><b>Up and Running in 5 Minutes as a Single User</b></a></li>
334 <li><a href="co-vs-up.md">Update &mdash; Checkout vs</a></li>
335 <li><a href="hints.wiki">Usage Hints &mdash; Fossil Tips And</a></li>
336 <li><a href="javascript.md"><b>Use of JavaScript in Fossil</b></a></li>
337 <li><a href="fiveminutes.wiki">User &mdash; Up and Running in 5 Minutes as a Single</a></li>
338 <li><a href="caps/">User Capabilities &mdash; Administering</a></li>
339 <li><a href="caps/ref.html"><b>User Capability Reference</b></a></li>
@@ -327,10 +344,11 @@
344 <li><a href="whyusefossil.wiki">Version Control &mdash; Benefits Of</a></li>
345 <li><a href="checkin_names.wiki">Version Names &mdash; Check-in And</a></li>
346 <li><a href="fossil-v-git.wiki">Versus Git &mdash; Fossil</a></li>
347 <li><a href="image-format-vs-repo-size.md">vs Fossil Repo Size &mdash; Image Format</a></li>
348 <li><a href="grep.md">vs POSIX grep &mdash; Fossil grep</a></li>
349 <li><a href="co-vs-up.md">vs Update &mdash; Checkout</a></li>
350 <li><a href="webui.wiki">Web Interface &mdash; The Fossil</a></li>
351 <li><a href="customskin.md">Web Pages &mdash; Theming: Customizing The Appearance of</a></li>
352 <li><a href="webpage-ex.md"><b>Webpage Examples</b></a></li>
353 <li><a href="../../../help">Webpages &mdash; Lists of Commands and</a></li>
354 <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General &mdash; Quotes:</a></li>
355
+507 -507
--- www/quickstart.wiki
+++ www/quickstart.wiki
@@ -4,552 +4,552 @@
44
<p>This is a guide to help you get started using the Fossil [https://en.wikipedia.org/wiki/Distributed_version_control|Distributed Version Control System] quickly
55
and painlessly.</p>
66
77
<h2 id="install">Installing</h2>
88
9
- <p>Fossil is a single self-contained C program. You need to
10
- either download a
11
- [https://www.fossil-scm.org/fossil/uv/download.html|precompiled
12
- binary]
13
- or <a href="build.wiki">compile it yourself</a> from sources.
14
- Install Fossil by putting the fossil binary
15
- someplace on your $PATH.</p>
16
- You can test that Fossil is present and working like this:
17
-
18
- <blockquote>
19
- <b>
20
- fossil version<br>
21
- <tt>This is fossil version 2.13 [309af345ab] 2020-09-28 04:02:55 UTC</tt><br>
22
- </b>
23
- </blockquote>
9
+<p>Fossil is a single self-contained C program. You need to
10
+either download a
11
+[https://www.fossil-scm.org/fossil/uv/download.html|precompiled
12
+binary]
13
+or <a href="build.wiki">compile it yourself</a> from sources.
14
+Install Fossil by putting the fossil binary
15
+someplace on your $PATH.</p>
16
+You can test that Fossil is present and working like this:
17
+
18
+<blockquote>
19
+<b>
20
+fossil version<br>
21
+<tt>This is fossil version 2.13 [309af345ab] 2020-09-28 04:02:55 UTC</tt><br>
22
+</b>
23
+</blockquote>
2424
2525
<h2 id="workflow" name="fslclone">General Work Flow</h2>
2626
27
- <p>Fossil works with repository files (a database in a single file with the project's
28
- complete history) and with checked-out local trees (the working directory
29
- you use to do your work).
30
- (See [./whyusefossil.wiki#definitions | definitions] for more background.)
31
- The workflow looks like this:</p>
32
-
33
- <ul>
34
- <li>Create or clone a repository file. ([/help/init|fossil init] or
35
- [/help/clone | fossil clone])
36
- <li>Check out a local tree. ([/help/open | fossil open])
37
- <li>Perform operations on the repository (including repository
38
- configuration).
39
- </ul>
40
-
41
- Fossil can be entirely driven from the command line. Many features
42
- can also be conveniently accessed from the build-in web interface.
43
-
44
- <p>The following sections give a brief overview of these
45
- operations.</p>
27
+<p>Fossil works with repository files (a database in a single file with the project's
28
+complete history) and with checked-out local trees (the working directory
29
+you use to do your work).
30
+(See [./whyusefossil.wiki#definitions | definitions] for more background.)
31
+The workflow looks like this:</p>
32
+
33
+<ul>
34
+ <li>Create or clone a repository file. ([/help/init|fossil init] or
35
+ [/help/clone | fossil clone])
36
+ <li>Check out a local tree. ([/help/open | fossil open])
37
+ <li>Perform operations on the repository (including repository
38
+ configuration).
39
+</ul>
40
+
41
+Fossil can be entirely driven from the command line. Many features
42
+can also be conveniently accessed from the build-in web interface.
43
+
44
+<p>The following sections give a brief overview of these
45
+operations.</p>
4646
4747
<h2 id="new">Starting A New Project</h2>
4848
49
- <p>To start a new project with fossil create a new empty repository
50
- this way: ([/help/init | more info]) </p>
51
-
52
- <blockquote>
53
- <b>fossil init </b><i> repository-filename</i>
54
- </blockquote>
55
-
56
- You can name the database anything you like, and you can place it anywhere in the filesystem.
57
- The <tt>.fossil</tt> extension is traditional but only required if you are going to use the
58
- <tt>[./help?cmd=/server | fossil server DIRECTORY]</tt> feature.”
49
+<p>To start a new project with fossil create a new empty repository
50
+this way: ([/help/init | more info]) </p>
51
+
52
+<blockquote>
53
+<b>fossil init </b><i> repository-filename</i>
54
+</blockquote>
55
+
56
+You can name the database anything you like, and you can place it anywhere in the filesystem.
57
+The <tt>.fossil</tt> extension is traditional but only required if you are going to use the
58
+<tt>[./help?cmd=/server | fossil server DIRECTORY]</tt> feature.”
5959
6060
<h2 id="clone">Cloning An Existing Repository</h2>
6161
62
- <p>Most fossil operations interact with a repository that is on the
63
- local disk drive, not on a remote system. Hence, before accessing
64
- a remote repository it is necessary to make a local copy of that
65
- repository. Making a local copy of a remote repository is called
66
- "cloning".</p>
67
-
68
- <p>Clone a remote repository as follows: ([/help/clone | more info])</p>
69
-
70
- <blockquote>
71
- <b>fossil clone</b> <i>URL repository-filename</i>
72
- </blockquote>
73
-
74
- <p>The <i>URL</i> specifies the fossil repository
75
- you want to clone. The <i>repository-filename</i> is the new local
76
- filename into which the cloned repository will be written. For
77
- example, to clone the source code of Fossil itself:
78
-
79
- <blockquote>
80
- <b>fossil clone https://www.fossil-scm.org/ myclone.fossil</b>
81
- </blockquote>
82
-
83
- If your logged-in username is 'exampleuser', you should see output something like this:
84
-
85
- <blockquote>
86
- <b><tt>
87
- Round-trips: 8 Artifacts sent: 0 received: 39421<br>
88
- Clone done, sent: 2424 received: 42965725 ip: 10.10.10.0<br>
89
- Rebuilding repository meta-data...<br>
90
- 100% complete...<br>
91
- Extra delta compression... <br>
92
- Vacuuming the database... <br>
93
- project-id: 94259BB9F186226D80E49D1FA2DB29F935CCA0333<br>
94
- server-id: 016595e9043054038a9ea9bc526d7f33f7ac0e42<br>
95
- admin-user: exampleuser (password is "yoWgDR42iv")><br>
96
- </tt></b>
97
- </blockquote>
98
-
99
- <p>If the remote repository requires a login, include a
100
- userid in the URL like this:
101
-
102
- <blockquote>
103
- <b>fossil clone https://</b><i>remoteuserid</i><b>@www.example.org/ myclone.fossil</b>
104
- </blockquote>
105
-
106
- <p>You will be prompted separately for the password.
107
- Use [https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters|"%HH"] escapes for special characters in the userid.
108
- For example "/" would be replaced by "%2F" meaning that a userid of "Projects/Budget" would become "Projects%2FBudget") </p>
109
-
110
- <p>If you are behind a restrictive firewall, you might need
111
- to <a href="#proxy">specify an HTTP proxy</a>.</p>
112
-
113
- <p>A Fossil repository is a single disk file. Instead of cloning,
114
- you can just make a copy of the repository file (for example, using
115
- "scp"). Note, however, that the repository file contains auxiliary
116
- information above and beyond the versioned files, including some
117
- sensitive information such as password hashes and email addresses. If you
118
- want to share Fossil repositories directly by copying, consider running the
119
- [/help/scrub|fossil scrub] command to remove sensitive information
120
- before transmitting the file.
62
+<p>Most fossil operations interact with a repository that is on the
63
+local disk drive, not on a remote system. Hence, before accessing
64
+a remote repository it is necessary to make a local copy of that
65
+repository. Making a local copy of a remote repository is called
66
+"cloning".</p>
67
+
68
+<p>Clone a remote repository as follows: ([/help/clone | more info])</p>
69
+
70
+<blockquote>
71
+<b>fossil clone</b> <i>URL repository-filename</i>
72
+</blockquote>
73
+
74
+<p>The <i>URL</i> specifies the fossil repository
75
+you want to clone. The <i>repository-filename</i> is the new local
76
+filename into which the cloned repository will be written. For
77
+example, to clone the source code of Fossil itself:
78
+
79
+<blockquote>
80
+<b>fossil clone https://www.fossil-scm.org/ myclone.fossil</b>
81
+</blockquote>
82
+
83
+If your logged-in username is 'exampleuser', you should see output something like this:
84
+
85
+<blockquote>
86
+<b><tt>
87
+ Round-trips: 8 Artifacts sent: 0 received: 39421<br>
88
+ Clone done, sent: 2424 received: 42965725 ip: 10.10.10.0<br>
89
+ Rebuilding repository meta-data...<br>
90
+ 100% complete...<br>
91
+ Extra delta compression... <br>
92
+ Vacuuming the database... <br>
93
+ project-id: 94259BB9F186226D80E49D1FA2DB29F935CCA0333<br>
94
+ server-id: 016595e9043054038a9ea9bc526d7f33f7ac0e42<br>
95
+ admin-user: exampleuser (password is "yoWgDR42iv")><br>
96
+</tt></b>
97
+</blockquote>
98
+
99
+<p>If the remote repository requires a login, include a
100
+userid in the URL like this:
101
+
102
+<blockquote>
103
+<b>fossil clone https://</b><i>remoteuserid</i><b>@www.example.org/ myclone.fossil</b>
104
+</blockquote>
105
+
106
+<p>You will be prompted separately for the password.
107
+ Use [https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters|"%HH"] escapes for special characters in the userid.
108
+ For example "/" would be replaced by "%2F" meaning that a userid of "Projects/Budget" would become "Projects%2FBudget") </p>
109
+
110
+<p>If you are behind a restrictive firewall, you might need
111
+to <a href="#proxy">specify an HTTP proxy</a>.</p>
112
+
113
+<p>A Fossil repository is a single disk file. Instead of cloning,
114
+you can just make a copy of the repository file (for example, using
115
+"scp"). Note, however, that the repository file contains auxiliary
116
+information above and beyond the versioned files, including some
117
+sensitive information such as password hashes and email addresses. If you
118
+want to share Fossil repositories directly by copying, consider running the
119
+[/help/scrub|fossil scrub] command to remove sensitive information
120
+before transmitting the file.
121121
122122
<h2 id="import">Importing From Another Version Control System</h2>
123123
124
- <p>Rather than start a new project, or clone an existing Fossil project,
125
- you might prefer to
126
- <a href="./inout.wiki">import an existing Git project</a>
127
- into Fossil using the [/help/import | fossil import] command.
128
-
129
- You can even decide to export your project back into git using the
130
- [/help/git | fossil git] command, which is how the Fossil project maintains
131
- [https://github.com/drhsqlite/fossil-mirror | its public GitHub mirror]. There
132
- is no limit to the number of times a tree can be imported and exported between
133
- Fossil and git.
134
-
135
- The [https://git-scm.com/docs/git-fast-export|Git fast-export format] has become
136
- a popular way to move files between version management systems, including from
137
- [https://www.mercurial-scm.org/|Mercurial].
138
- Fossil can also import [https://subversion.apache.org/|Subversion projects] directly.
124
+<p>Rather than start a new project, or clone an existing Fossil project,
125
+you might prefer to
126
+<a href="./inout.wiki">import an existing Git project</a>
127
+into Fossil using the [/help/import | fossil import] command.
128
+
129
+You can even decide to export your project back into git using the
130
+[/help/git | fossil git] command, which is how the Fossil project maintains
131
+[https://github.com/drhsqlite/fossil-mirror | its public GitHub mirror]. There
132
+is no limit to the number of times a tree can be imported and exported between
133
+Fossil and git.
134
+
135
+The [https://git-scm.com/docs/git-fast-export|Git fast-export format] has become
136
+a popular way to move files between version management systems, including from
137
+[https://www.mercurial-scm.org/|Mercurial].
138
+Fossil can also import [https://subversion.apache.org/|Subversion projects] directly.
139139
140140
<h2 id="checkout">Checking Out A Local Tree</h2>
141141
142
- <p>To work on a project in fossil, you need to check out a local
143
- copy of the source tree. Create the directory you want to be
144
- the root of your tree and cd into that directory. Then
145
- do this: ([/help/open | more info])</p>
146
-
147
- <blockquote>
148
- <b>fossil open </b><i> repository-filename</i>
149
- </blockquote>
150
-
151
- for example:
152
-
153
- <blockquote>
154
- <b><tt>
155
- fossil open ../myclone.fossil<br>
156
- BUILD.txt<br>
157
- COPYRIGHT-BSD2.txt<br>
158
- README.md<br>
159
- ︙<br>
160
- </tt></b>
161
- </blockquote>
162
-
163
- (or "fossil open ..\myclone.fossil" on Windows).
164
-
165
- <p>This leaves you with the newest version of the tree
166
- checked out.
167
- From anywhere underneath the root of your local tree, you
168
- can type commands like the following to find out the status of
169
- your local tree:</p>
170
-
171
- <blockquote>
172
- <b>[/help/info | fossil info]</b><br>
173
- <b>[/help/status | fossil status]</b><br>
174
- <b>[/help/changes | fossil changes]</b><br>
175
- <b>[/help/diff | fossil diff]</b><br>
176
- <b>[/help/timeline | fossil timeline]</b><br>
177
- <b>[/help/ls | fossil ls]</b><br>
178
- <b>[/help/branch | fossil branch]</b><br>
179
- </blockquote>
180
-
181
- <p>If you created a new respository using "fossil init" some commands will not
182
- produce much output.</p>
183
-
184
- <p>Note that Fossil allows you to make multiple check-outs in
185
- separate directories from the same repository. This enables you,
186
- for example, to do builds from multiple branches or versions at
187
- the same time without having to generate extra clones.</p>
188
-
189
- <p>To switch a checkout between different versions and branches,
190
- use:</p>
191
-
192
- <blockquote>
193
- <b>[/help/update | fossil update]</b><br>
194
- <b>[/help/checkout | fossil checkout]</b><br>
195
- </blockquote>
196
-
197
- <p>[/help/update | update] honors the "autosync" option and
198
- does a "soft" switch, merging any local changes into the target
199
- version, whereas [/help/checkout | checkout] does not
200
- automatically sync and does a "hard" switch, overwriting local
201
- changes if told to do so.</p>
202
-
203
-<h2 id="changes">Making and Commiting Changes</h2>
204
-
205
- <p>To add new files to your project or remove existing ones, use these
206
- commands:</p>
207
-
208
- <blockquote>
209
- <b>[/help/add | fossil add]</b> <i>file...</i><br>
210
- <b>[/help/rm | fossil rm]</b> <i>file...</i><br>
211
- <b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
212
- </blockquote>
213
-
214
- <p>The command:</p>
215
- <blockquote>
216
- <b>
217
- [/help/changes | fossil changes]</b>
218
- </blockquote>
219
- <p>lists files that have changed since the last commit to the repository. For
220
- example, if you edit the file "README.md":</p>
221
-
222
- <blockquote>
223
- <b>
224
- fossil changes<br>
225
- EDITED README.md
226
- </b>
227
- </blockquote>
228
-
229
- <p>To see exactly what change was made you can use the command</p>
230
- [/help/diff | fossil diff]:
231
- <blockquote>
232
- <b>
233
- fossil diff <br><tt>
234
- Index: README.md<br>
235
- ============================================================<br>
236
- --- README.md<br>
237
- +++ README.md<br>
238
- @@ -1,5 +1,6 @@<br>
239
- +Made some changes to the project<br>
240
- # Original text<br>
241
- </tt></b>
242
- </blockquote>
243
-
244
- <p>"fossil diff" is the difference between your tree on disk now and as the tree was
245
- when you did "fossil open". An open is the first checkout from a repository
246
- into a new directory. </p>
247
-
248
- <p>To commit your changes to a local-only repository:</p>
249
- <blockquote>
250
- <b>
251
- fossil commit </b><i>(... Fossil will start your editor, if defined)</i><b><br><tt>
252
- # Enter a commit message for this check-in. Lines beginning with # are ignored.<br>
253
- #<br>
254
- # user: exampleuser<br>
255
- # tags: trunk<br>
256
- #<br>
257
- # EDITED README.md<br>
258
- Edited file to add description of code changes<br>
259
- New_Version: 7b9a416ced4a69a60589dde1aedd1a30fde8eec3528d265dbeed5135530440ab<br>
260
- </tt></b>
261
- </blockquote>
262
-
263
- <p>You will be prompted for check-in comments using whatever editor
264
- is specified by your VISUAL or EDITOR environment variable. If none is
265
- specified Fossil uses line-editing in the terminal.</p>
266
-
267
- <p>To commit your changes to a repository that was cloned from remote you
268
- perform the same actions but the results are different. Fossil
269
- defaults to 'autosync' mode, a single-stage commit that sends all changes
270
- committed to the local repository immediately on to the remote parent repository. This
271
- only works if you have write permission to the remote respository.</p>
142
+<p>To work on a project in fossil, you need to check out a local
143
+copy of the source tree. Create the directory you want to be
144
+the root of your tree and cd into that directory. Then
145
+do this: ([/help/open | more info])</p>
146
+
147
+<blockquote>
148
+<b>fossil open </b><i> repository-filename</i>
149
+</blockquote>
150
+
151
+for example:
152
+
153
+<blockquote>
154
+<b><tt>
155
+ fossil open ../myclone.fossil<br>
156
+ BUILD.txt<br>
157
+ COPYRIGHT-BSD2.txt<br>
158
+ README.md<br>
159
+ ︙<br>
160
+</tt></b>
161
+</blockquote>
162
+
163
+(or "fossil open ..\myclone.fossil" on Windows).
164
+
165
+<p>This leaves you with the newest version of the tree
166
+checked out.
167
+From anywhere underneath the root of your local tree, you
168
+can type commands like the following to find out the status of
169
+your local tree:</p>
170
+
171
+<blockquote>
172
+<b>[/help/info | fossil info]</b><br>
173
+<b>[/help/status | fossil status]</b><br>
174
+<b>[/help/changes | fossil changes]</b><br>
175
+<b>[/help/diff | fossil diff]</b><br>
176
+<b>[/help/timeline | fossil timeline]</b><br>
177
+<b>[/help/ls | fossil ls]</b><br>
178
+<b>[/help/branch | fossil branch]</b><br>
179
+</blockquote>
180
+
181
+<p>If you created a new repository using "fossil init" some commands will not
182
+produce much output.</p>
183
+
184
+<p>Note that Fossil allows you to make multiple check-outs in
185
+separate directories from the same repository. This enables you,
186
+for example, to do builds from multiple branches or versions at
187
+the same time without having to generate extra clones.</p>
188
+
189
+<p>To switch a checkout between different versions and branches,
190
+use:</p>
191
+
192
+<blockquote>
193
+<b>[/help/update | fossil update]</b><br>
194
+<b>[/help/checkout | fossil checkout]</b><br>
195
+</blockquote>
196
+
197
+<p>[/help/update | update] honors the "autosync" option and
198
+does a "soft" switch, merging any local changes into the target
199
+version, whereas [/help/checkout | checkout] does not
200
+automatically sync and does a "hard" switch, overwriting local
201
+changes if told to do so.</p>
202
+
203
+<h2 id="changes">Making and Committing Changes</h2>
204
+
205
+<p>To add new files to your project or remove existing ones, use these
206
+commands:</p>
207
+
208
+<blockquote>
209
+<b>[/help/add | fossil add]</b> <i>file...</i><br>
210
+<b>[/help/rm | fossil rm]</b> <i>file...</i><br>
211
+<b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
212
+</blockquote>
213
+
214
+<p>The command:</p>
215
+<blockquote>
216
+<b>
217
+ [/help/changes | fossil changes]</b>
218
+</blockquote>
219
+<p>lists files that have changed since the last commit to the repository. For
220
+example, if you edit the file "README.md":</p>
221
+
222
+<blockquote>
223
+<b>
224
+ fossil changes<br>
225
+ EDITED README.md
226
+</b>
227
+</blockquote>
228
+
229
+<p>To see exactly what change was made you can use the command</p>
230
+[/help/diff | fossil diff]:
231
+<blockquote>
232
+<b>
233
+ fossil diff <br><tt>
234
+ Index: README.md<br>
235
+ ============================================================<br>
236
+ --- README.md<br>
237
+ +++ README.md<br>
238
+ @@ -1,5 +1,6 @@<br>
239
+ +Made some changes to the project<br>
240
+ # Original text<br>
241
+ </tt></b>
242
+</blockquote>
243
+
244
+<p>"fossil diff" is the difference between your tree on disk now and as the tree was
245
+when you did "fossil open". An open is the first checkout from a repository
246
+into a new directory. </p>
247
+
248
+<p>To commit your changes to a local-only repository:</p>
249
+<blockquote>
250
+<b>
251
+fossil commit </b><i>(... Fossil will start your editor, if defined)</i><b><br><tt>
252
+# Enter a commit message for this check-in. Lines beginning with # are ignored.<br>
253
+#<br>
254
+# user: exampleuser<br>
255
+# tags: trunk<br>
256
+#<br>
257
+# EDITED README.md<br>
258
+Edited file to add description of code changes<br>
259
+New_Version: 7b9a416ced4a69a60589dde1aedd1a30fde8eec3528d265dbeed5135530440ab<br>
260
+</tt></b>
261
+</blockquote>
262
+
263
+<p>You will be prompted for check-in comments using whatever editor
264
+is specified by your VISUAL or EDITOR environment variable. If none is
265
+specified Fossil uses line-editing in the terminal.</p>
266
+
267
+<p>To commit your changes to a repository that was cloned from remote you
268
+perform the same actions but the results are different. Fossil
269
+defaults to 'autosync' mode, a single-stage commit that sends all changes
270
+committed to the local repository immediately on to the remote parent repository. This
271
+only works if you have write permission to the remote respository.</p>
272272
273273
<h2 id="naming">Naming of Files, Checkins, and Branches</h2>
274274
275
- <p>Fossil deals with information artifacts. This Quickstart document only deals
276
- with files and collections of files, but be aware there are also tickets, wiki pages and more.
277
- Every artifact in Fossil has a universally-unique hash id, and may also have a
278
- human-readable name.</p>
279
-
280
- <p>The following are all equivalent ways of identifying a Fossil file,
281
- checkin or branch artifact:</p>
282
-
283
- <ul>
284
- <li> the full unique SHA-256 hash, such as be836de35a821523beac2e53168e135d5ebd725d7af421e5f736a28e8034673a
285
- <li> an abbreviated hash prefix, such as the first ten characters: be836de35a . This won't be universally unique, but it is usually unique within any one repository. As an example, the [https://fossil-scm.org/home/hash-collisions|Fossil project hash collisions] showed at the time of writing that there are no artifacts with identical first 8 characters
286
- <li> a branch name, such as "special-features" or "juliet-testing". Each branch also has a unique SHA-256 hash
287
- </ul>
288
-
289
- <p>A special convenience branch is "trunk", which is Fossil's default branch name for
290
- the first checkin, and the default for any time a branch name is needed but not
291
- specified.</p>
292
-
293
- This will get you started on identifying checkins. The
294
- <a href="./checkin_names.wiki">Checkin Names document</a> is a complete reference, including
295
- how timestamps can also be used.
275
+<p>Fossil deals with information artifacts. This Quickstart document only deals
276
+with files and collections of files, but be aware there are also tickets, wiki pages and more.
277
+Every artifact in Fossil has a universally-unique hash id, and may also have a
278
+human-readable name.</p>
279
+
280
+<p>The following are all equivalent ways of identifying a Fossil file,
281
+checkin or branch artifact:</p>
282
+
283
+<ul>
284
+<li> the full unique SHA-256 hash, such as be836de35a821523beac2e53168e135d5ebd725d7af421e5f736a28e8034673a
285
+<li> an abbreviated hash prefix, such as the first ten characters: be836de35a . This won't be universally unique, but it is usually unique within any one repository. As an example, the [https://fossil-scm.org/home/hash-collisions|Fossil project hash collisions] showed at the time of writing that there are no artifacts with identical first 8 characters
286
+<li> a branch name, such as "special-features" or "juliet-testing". Each branch also has a unique SHA-256 hash
287
+</ul>
288
+
289
+<p>A special convenience branch is "trunk", which is Fossil's default branch name for
290
+the first checkin, and the default for any time a branch name is needed but not
291
+specified.</p>
292
+
293
+This will get you started on identifying checkins. The
294
+<a href="./checkin_names.wiki">Checkin Names document</a> is a complete reference, including
295
+how timestamps can also be used.
296296
297297
<h2 id="config">Configuring Your Local Repository</h2>
298298
299
- <p>When you create a new repository, either by cloning an existing
300
- project or create a new project of your own, you usually want to do some
301
- local configuration. This is easily accomplished using the web-server
302
- that is built into fossil. Start the fossil web server like this:
303
- ([/help/ui | more info])</p>
304
-
305
- <blockquote>
306
- <b>fossil ui </b><i> repository-filename</i>
307
- </blockquote>
308
-
309
- <p>You can omit the <i>repository-filename</i> from the command above
310
- if you are inside a checked-out local tree.</p>
311
-
312
- <p>This starts a web server then automatically launches your
313
- web browser and makes it point to this web server. If your system
314
- has an unusual configuration, fossil might not be able to figure out
315
- how to start your web browser. In that case, first tell fossil
316
- where to find your web browser using a command like this:</p>
317
-
318
- <blockquote>
319
- <b>fossil setting web-browser </b><i> path-to-web-browser</i>
320
- </blockquote>
321
-
322
- <p>By default, fossil does not require a login for HTTP connections
323
- coming in from the IP loopback address 127.0.0.1. You can, and perhaps
324
- should, change this after you create a few users.</p>
325
-
326
- <p>When you are finished configuring, just press Control-C or use
327
- the <b>kill</b> command to shut down the mini-server.</p>
299
+<p>When you create a new repository, either by cloning an existing
300
+project or create a new project of your own, you usually want to do some
301
+local configuration. This is easily accomplished using the web-server
302
+that is built into fossil. Start the fossil web server like this:
303
+([/help/ui | more info])</p>
304
+
305
+<blockquote>
306
+<b>fossil ui </b><i> repository-filename</i>
307
+</blockquote>
308
+
309
+<p>You can omit the <i>repository-filename</i> from the command above
310
+if you are inside a checked-out local tree.</p>
311
+
312
+<p>This starts a web server then automatically launches your
313
+web browser and makes it point to this web server. If your system
314
+has an unusual configuration, fossil might not be able to figure out
315
+how to start your web browser. In that case, first tell fossil
316
+where to find your web browser using a command like this:</p>
317
+
318
+<blockquote>
319
+<b>fossil setting web-browser </b><i> path-to-web-browser</i>
320
+</blockquote>
321
+
322
+<p>By default, fossil does not require a login for HTTP connections
323
+coming in from the IP loopback address 127.0.0.1. You can, and perhaps
324
+should, change this after you create a few users.</p>
325
+
326
+<p>When you are finished configuring, just press Control-C or use
327
+the <b>kill</b> command to shut down the mini-server.</p>
328328
329329
<h2 id="changes">Making Changes</h2>
330330
331
- <p>To add new files to your project, or remove old files, use these
332
- commands:</p>
333
-
334
- <blockquote>
335
- <b>[/help/add | fossil add]</b> <i>file...</i><br>
336
- <b>[/help/rm | fossil rm]</b> <i>file...</i><br>
337
- <b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
338
- </blockquote>
339
-
340
- <p>You can also edit files freely. Once you are ready to commit
341
- your changes, type:</p>
342
-
343
- <blockquote>
344
- <b>[/help/commit | fossil commit]</b>
345
- </blockquote>
346
-
347
- <p>You will be prompted for check-in comments using whatever editor
348
- is specified by your VISUAL or EDITOR environment variable.</p>
349
-
350
- In the default configuration, the [/help/commit|commit]
351
- command will also automatically [/help/push|push] your changes, but that
352
- feature can be disabled. (More information about
353
- [./concepts.wiki#workflow|autosync] and how to disable it.)
354
- Remember that your coworkers can not see your changes until you
355
- commit and push them.</p>
331
+<p>To add new files to your project, or remove old files, use these
332
+commands:</p>
333
+
334
+<blockquote>
335
+<b>[/help/add | fossil add]</b> <i>file...</i><br>
336
+<b>[/help/rm | fossil rm]</b> <i>file...</i><br>
337
+<b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
338
+</blockquote>
339
+
340
+<p>You can also edit files freely. Once you are ready to commit
341
+your changes, type:</p>
342
+
343
+<blockquote>
344
+<b>[/help/commit | fossil commit]</b>
345
+</blockquote>
346
+
347
+<p>You will be prompted for check-in comments using whatever editor
348
+is specified by your VISUAL or EDITOR environment variable.</p>
349
+
350
+In the default configuration, the [/help/commit|commit]
351
+command will also automatically [/help/push|push] your changes, but that
352
+feature can be disabled. (More information about
353
+[./concepts.wiki#workflow|autosync] and how to disable it.)
354
+Remember that your coworkers can not see your changes until you
355
+commit and push them.</p>
356356
357357
<h2 id="sharing">Sharing Changes</h2>
358358
359
- <p>When [./concepts.wiki#workflow|autosync] is turned off,
360
- the changes you [/help/commit | commit] are only
361
- on your local repository.
362
- To share those changes with other repositories, do:</p>
363
-
364
- <blockquote>
365
- <b>[/help/push | fossil push]</b> <i>URL</i>
366
- </blockquote>
367
-
368
- <p>Where <i>URL</i> is the http: URL of the server repository you
369
- want to share your changes with. If you omit the <i>URL</i> argument,
370
- fossil will use whatever server you most recently synced with.</p>
371
-
372
- <p>The [/help/push | push] command only sends your changes to others. To
373
- Receive changes from others, use [/help/pull | pull]. Or go both ways at
374
- once using [/help/sync | sync]:</p>
375
-
376
- <blockquote>
377
- <b>[/help/pull | fossil pull]</b> <i>URL</i><br>
378
- <b>[/help/sync | fossil sync]</b> <i>URL</i>
379
- </blockquote>
380
-
381
- <p>When you pull in changes from others, they go into your repository,
382
- not into your checked-out local tree. To get the changes into your
383
- local tree, use [/help/update | update]:</p>
384
-
385
- <blockquote>
386
- <b>[/help/update | fossil update]</b> <i>VERSION</i>
387
- </blockquote>
388
-
389
- <p>The <i>VERSION</i> can be the name of a branch or tag or any
390
- abbreviation to the 40-character
391
- artifact identifier for a particular check-in, or it can be a
392
- date/time stamp. ([./checkin_names.wiki | more info])
393
- If you omit
394
- the <i>VERSION</i>, then fossil moves you to the
395
- latest version of the branch your are currently on.</p>
396
-
397
- <p>The default behavior is for [./concepts.wiki#workflow|autosync] to
398
- be turned on. That means that a [/help/pull|pull] automatically occurs
399
- when you run [/help/update|update] and a [/help/push|push] happens
400
- automatically after you [/help/commit|commit]. So in normal practice,
401
- the push, pull, and sync commands are rarely used. But it is important
402
- to know about them, all the same.</p>
403
-
404
- <blockquote>
405
- <b>[/help/checkout | fossil checkout]</b> <i>VERSION</i>
406
- </blockquote>
407
-
408
- <p>Is similar to update except that it does not honor the autosync
409
- setting, nor does it merge in local changes - it prefers to overwrite
410
- them and fails if local changes exist unless the <tt>--force</tt>
411
- flag is used.</p>
359
+<p>When [./concepts.wiki#workflow|autosync] is turned off,
360
+the changes you [/help/commit | commit] are only
361
+on your local repository.
362
+To share those changes with other repositories, do:</p>
363
+
364
+<blockquote>
365
+<b>[/help/push | fossil push]</b> <i>URL</i>
366
+</blockquote>
367
+
368
+<p>Where <i>URL</i> is the http: URL of the server repository you
369
+want to share your changes with. If you omit the <i>URL</i> argument,
370
+fossil will use whatever server you most recently synced with.</p>
371
+
372
+<p>The [/help/push | push] command only sends your changes to others. To
373
+Receive changes from others, use [/help/pull | pull]. Or go both ways at
374
+once using [/help/sync | sync]:</p>
375
+
376
+<blockquote>
377
+<b>[/help/pull | fossil pull]</b> <i>URL</i><br>
378
+<b>[/help/sync | fossil sync]</b> <i>URL</i>
379
+</blockquote>
380
+
381
+<p>When you pull in changes from others, they go into your repository,
382
+not into your checked-out local tree. To get the changes into your
383
+local tree, use [/help/update | update]:</p>
384
+
385
+<blockquote>
386
+<b>[/help/update | fossil update]</b> <i>VERSION</i>
387
+</blockquote>
388
+
389
+<p>The <i>VERSION</i> can be the name of a branch or tag or any
390
+abbreviation to the 40-character
391
+artifact identifier for a particular check-in, or it can be a
392
+date/time stamp. ([./checkin_names.wiki | more info])
393
+If you omit
394
+the <i>VERSION</i>, then fossil moves you to the
395
+latest version of the branch your are currently on.</p>
396
+
397
+<p>The default behavior is for [./concepts.wiki#workflow|autosync] to
398
+be turned on. That means that a [/help/pull|pull] automatically occurs
399
+when you run [/help/update|update] and a [/help/push|push] happens
400
+automatically after you [/help/commit|commit]. So in normal practice,
401
+the push, pull, and sync commands are rarely used. But it is important
402
+to know about them, all the same.</p>
403
+
404
+<blockquote>
405
+<b>[/help/checkout | fossil checkout]</b> <i>VERSION</i>
406
+</blockquote>
407
+
408
+<p>Is similar to update except that it does not honor the autosync
409
+setting, nor does it merge in local changes - it prefers to overwrite
410
+them and fails if local changes exist unless the <tt>--force</tt>
411
+flag is used.</p>
412412
413413
<h2 id="branch" name="merge">Branching And Merging</h2>
414414
415
- <p>Use the --branch option to the [/help/commit | commit] command
416
- to start a new branch. Note that in Fossil, branches are normally
417
- created when you commit, not before you start editing. You can
418
- use the [/help/branch | branch new] command to create a new branch
419
- before you start editing, if you want, but most people just wait
420
- until they are ready to commit.
421
-
422
- To merge two branches back together, first
423
- [/help/update | update] to the branch you want to merge into.
424
- Then do a [/help/merge|merge] of the other branch that you want to incorporate
425
- the changes from. For example, to merge "featureX" changes into "trunk"
426
- do this:</p>
427
-
428
- <blockquote>
429
- <b>fossil [/help/update|update] trunk</b><br>
430
- <b>fossil [/help/merge|merge] featureX</b><br>
431
- <i># make sure the merge didn't break anything...</i><br>
432
- <b>fossil [/help/commit|commit]
433
- </blockquote>
434
-
435
- <p>The argument to the [/help/merge|merge] command can be any of the
436
- version identifier forms that work for [/help/update|update].
437
- ([./checkin_names.wiki|more info].)
438
- The merge command has options to cherry-pick individual
439
- changes, or to back out individual changes, if you don't want to
440
- do a full merge.</p>
441
-
442
- The merge command puts all changes in your working check-out.
443
- No changes are made to the repository.
444
- You must run [/help/commit|commit] separately
445
- to add the merge changes into your repository to make them persistent
446
- and so that your coworkers can see them.
447
- But before you do that, you will normally want to run a few tests
448
- to verify that the merge didn't cause logic breaks in your code.
449
-
450
- The same branch can be merged multiple times without trouble. Fossil
451
- automatically keeps up with things and avoids conflicts when doing
452
- multiple merges. So even if you have merged the featureX branch
453
- into trunk previously, you can do so again and Fossil will automatically
454
- know to pull in only those changes that have occurred since the previous
455
- merge.
456
-
457
- <p>If a merge or update doesn't work out (perhaps something breaks or
458
- there are many merge conflicts) then you back up using:</p>
459
-
460
- <blockquote>
461
- <b>[/help/undo | fossil undo]</b>
462
- </blockquote>
463
-
464
- <p>This will back out the changes that the merge or update made to the
465
- working checkout. There is also a [/help/redo|redo] command if you undo by
466
- mistake. Undo and redo only work for changes that have
467
- not yet been checked in using commit and there is only a single
468
- level of undo/redo.</p>
415
+<p>Use the --branch option to the [/help/commit | commit] command
416
+to start a new branch. Note that in Fossil, branches are normally
417
+created when you commit, not before you start editing. You can
418
+use the [/help/branch | branch new] command to create a new branch
419
+before you start editing, if you want, but most people just wait
420
+until they are ready to commit.
421
+
422
+To merge two branches back together, first
423
+[/help/update | update] to the branch you want to merge into.
424
+Then do a [/help/merge|merge] of the other branch that you want to incorporate
425
+the changes from. For example, to merge "featureX" changes into "trunk"
426
+do this:</p>
427
+
428
+<blockquote>
429
+<b>fossil [/help/update|update] trunk</b><br>
430
+<b>fossil [/help/merge|merge] featureX</b><br>
431
+<i># make sure the merge didn't break anything...</i><br>
432
+<b>fossil [/help/commit|commit]
433
+</blockquote>
434
+
435
+<p>The argument to the [/help/merge|merge] command can be any of the
436
+version identifier forms that work for [/help/update|update].
437
+([./checkin_names.wiki|more info].)
438
+The merge command has options to cherry-pick individual
439
+changes, or to back out individual changes, if you don't want to
440
+do a full merge.</p>
441
+
442
+The merge command puts all changes in your working check-out.
443
+No changes are made to the repository.
444
+You must run [/help/commit|commit] separately
445
+to add the merge changes into your repository to make them persistent
446
+and so that your coworkers can see them.
447
+But before you do that, you will normally want to run a few tests
448
+to verify that the merge didn't cause logic breaks in your code.
449
+
450
+The same branch can be merged multiple times without trouble. Fossil
451
+automatically keeps up with things and avoids conflicts when doing
452
+multiple merges. So even if you have merged the featureX branch
453
+into trunk previously, you can do so again and Fossil will automatically
454
+know to pull in only those changes that have occurred since the previous
455
+merge.
456
+
457
+<p>If a merge or update doesn't work out (perhaps something breaks or
458
+there are many merge conflicts) then you back up using:</p>
459
+
460
+<blockquote>
461
+<b>[/help/undo | fossil undo]</b>
462
+</blockquote>
463
+
464
+<p>This will back out the changes that the merge or update made to the
465
+working checkout. There is also a [/help/redo|redo] command if you undo by
466
+mistake. Undo and redo only work for changes that have
467
+not yet been checked in using commit and there is only a single
468
+level of undo/redo.</p>
469469
470470
471471
<h2 id="server">Setting Up A Server</h2>
472472
473
- <p>Fossil can act as a stand-alone web server using one of these
474
- commands:</p>
475
-
476
- <blockquote>
477
- <b>[/help/server | fossil server]</b> <i>repository-filename</i><br>
478
- <b>[/help/ui | fossil ui]</b> <i>repository-filename</i>
479
- </blockquote>
480
-
481
- <p>The <i>repository-filename</i> can be omitted when these commands
482
- are run from within an open check-out, which a particularly useful
483
- shortcut for the <b>fossil ui</b> command.
484
-
485
- <p>The <b>ui</b> command is intended for accessing the web interface
486
- from a local desktop. The <b>ui</b> command binds to the loopback IP
487
- address only (and thus makes the web interface visible only on the
488
- local machine) and it automatically start your web browser pointing at the
489
- server. For cross-machine collaboration, use the <b>server</b> command,
490
- which binds on all IP addresses and does not try to start a web browser.</p>
491
-
492
- <p>Servers are also easily configured as:
493
- <ul>
494
- <li>[./server/any/inetd.md|inetd]
495
- <li>[./server/debian/service.md|systemd]
496
- <li>[./server/any/cgi.md|CGI]
497
- <li>[./server/any/scgi.md|SCGI]
498
- </ul>
499
-
500
- <p>The [./selfhost.wiki | self-hosting fossil repositories] use
501
- CGI.
473
+<p>Fossil can act as a stand-alone web server using one of these
474
+commands:</p>
475
+
476
+<blockquote>
477
+<b>[/help/server | fossil server]</b> <i>repository-filename</i><br>
478
+<b>[/help/ui | fossil ui]</b> <i>repository-filename</i>
479
+</blockquote>
480
+
481
+<p>The <i>repository-filename</i> can be omitted when these commands
482
+are run from within an open check-out, which a particularly useful
483
+shortcut for the <b>fossil ui</b> command.
484
+
485
+<p>The <b>ui</b> command is intended for accessing the web interface
486
+from a local desktop. The <b>ui</b> command binds to the loopback IP
487
+address only (and thus makes the web interface visible only on the
488
+local machine) and it automatically start your web browser pointing at the
489
+server. For cross-machine collaboration, use the <b>server</b> command,
490
+which binds on all IP addresses and does not try to start a web browser.</p>
491
+
492
+<p>Servers are also easily configured as:
493
+<ul>
494
+<li>[./server/any/inetd.md|inetd]
495
+<li>[./server/debian/service.md|systemd]
496
+<li>[./server/any/cgi.md|CGI]
497
+<li>[./server/any/scgi.md|SCGI]
498
+</ul>
499
+
500
+<p>The [./selfhost.wiki | self-hosting fossil repositories] use
501
+CGI.
502502
503503
<h2 id="proxy">HTTP Proxies</h2>
504504
505
- <p>If you are behind a restrictive firewall that requires you to use
506
- an HTTP proxy to reach the internet, then you can configure the proxy
507
- in three different ways. You can tell fossil about your proxy using
508
- a command-line option on commands that use the network,
509
- <b>sync</b>, <b>clone</b>, <b>push</b>, and <b>pull</b>.</p>
510
-
511
- <blockquote>
512
- <b>fossil clone </b><i>URL</i> <b>--proxy</b> <i>Proxy-URL</i>
513
- </blockquote>
514
-
515
- <p>It is annoying to have to type in the proxy URL every time you
516
- sync your project, though, so you can make the proxy configuration
517
- persistent using the [/help/setting | setting] command:</p>
518
-
519
- <blockquote>
520
- <b>fossil setting proxy </b><i>Proxy-URL</i>
521
- </blockquote>
522
-
523
- <p>Or, you can set the "<b>http_proxy</b>" environment variable:</p>
524
-
525
- <blockquote>
526
- <b>export http_proxy=</b><i>Proxy-URL</i>
527
- </blockquote>
528
-
529
- <p>To stop using the proxy, do:</p>
530
-
531
- <blockquote>
532
- <b>fossil setting proxy off</b>
533
- </blockquote>
534
-
535
- <p>Or unset the environment variable. The fossil setting for the
536
- HTTP proxy takes precedence over the environment variable and the
537
- command-line option overrides both. If you have an persistent
538
- proxy setting that you want to override for a one-time sync, that
539
- is easily done on the command-line. For example, to sync with
540
- a co-workers repository on your LAN, you might type:</p>
541
-
542
- <blockquote>
543
- <b>fossil sync http://192.168.1.36:8080/ --proxy off</b>
544
- </blockquote>
505
+<p>If you are behind a restrictive firewall that requires you to use
506
+an HTTP proxy to reach the internet, then you can configure the proxy
507
+in three different ways. You can tell fossil about your proxy using
508
+a command-line option on commands that use the network,
509
+<b>sync</b>, <b>clone</b>, <b>push</b>, and <b>pull</b>.</p>
510
+
511
+<blockquote>
512
+<b>fossil clone </b><i>URL</i> <b>--proxy</b> <i>Proxy-URL</i>
513
+</blockquote>
514
+
515
+<p>It is annoying to have to type in the proxy URL every time you
516
+sync your project, though, so you can make the proxy configuration
517
+persistent using the [/help/setting | setting] command:</p>
518
+
519
+<blockquote>
520
+<b>fossil setting proxy </b><i>Proxy-URL</i>
521
+</blockquote>
522
+
523
+<p>Or, you can set the "<b>http_proxy</b>" environment variable:</p>
524
+
525
+<blockquote>
526
+<b>export http_proxy=</b><i>Proxy-URL</i>
527
+</blockquote>
528
+
529
+<p>To stop using the proxy, do:</p>
530
+
531
+<blockquote>
532
+<b>fossil setting proxy off</b>
533
+</blockquote>
534
+
535
+<p>Or unset the environment variable. The fossil setting for the
536
+HTTP proxy takes precedence over the environment variable and the
537
+command-line option overrides both. If you have a persistent
538
+proxy setting that you want to override for a one-time sync, that
539
+is easily done on the command-line. For example, to sync with
540
+a co-worker's repository on your LAN, you might type:</p>
541
+
542
+<blockquote>
543
+<b>fossil sync http://192.168.1.36:8080/ --proxy off</b>
544
+</blockquote>
545545
546546
<h2 id="links">Other Resources</h2>
547547
548
- <ul>
549
- <li> <a href="./gitusers.md">Hints For Users With Prior Git Experience</a>
550
- <li> <a href="./whyusefossil.wiki">Why You Should Use Fossil</a>
551
- <li> <a href="./history.md">The History and Purpose of Fossil</a>
552
- <li> <a href="./branching.wiki">Branching, Forking, and Tagging</a>
553
- <li> <a href="./hints.wiki">Fossil Tips and Usage Hints</a>
554
- <li> <a href="./permutedindex.html">Comprehensive Fossil Doc Index</a>
555
- </ul>
548
+<ul>
549
+<li> <a href="./gitusers.md">Hints For Users With Prior Git Experience</a>
550
+<li> <a href="./whyusefossil.wiki">Why You Should Use Fossil</a>
551
+<li> <a href="./history.md">The History and Purpose of Fossil</a>
552
+<li> <a href="./branching.wiki">Branching, Forking, and Tagging</a>
553
+<li> <a href="./hints.wiki">Fossil Tips and Usage Hints</a>
554
+<li> <a href="./permutedindex.html">Comprehensive Fossil Doc Index</a>
555
+</ul>
556556
--- www/quickstart.wiki
+++ www/quickstart.wiki
@@ -4,552 +4,552 @@
4 <p>This is a guide to help you get started using the Fossil [https://en.wikipedia.org/wiki/Distributed_version_control|Distributed Version Control System] quickly
5 and painlessly.</p>
6
7 <h2 id="install">Installing</h2>
8
9 <p>Fossil is a single self-contained C program. You need to
10 either download a
11 [https://www.fossil-scm.org/fossil/uv/download.html|precompiled
12 binary]
13 or <a href="build.wiki">compile it yourself</a> from sources.
14 Install Fossil by putting the fossil binary
15 someplace on your $PATH.</p>
16 You can test that Fossil is present and working like this:
17
18 <blockquote>
19 <b>
20 fossil version<br>
21 <tt>This is fossil version 2.13 [309af345ab] 2020-09-28 04:02:55 UTC</tt><br>
22 </b>
23 </blockquote>
24
25 <h2 id="workflow" name="fslclone">General Work Flow</h2>
26
27 <p>Fossil works with repository files (a database in a single file with the project's
28 complete history) and with checked-out local trees (the working directory
29 you use to do your work).
30 (See [./whyusefossil.wiki#definitions | definitions] for more background.)
31 The workflow looks like this:</p>
32
33 <ul>
34 <li>Create or clone a repository file. ([/help/init|fossil init] or
35 [/help/clone | fossil clone])
36 <li>Check out a local tree. ([/help/open | fossil open])
37 <li>Perform operations on the repository (including repository
38 configuration).
39 </ul>
40
41 Fossil can be entirely driven from the command line. Many features
42 can also be conveniently accessed from the build-in web interface.
43
44 <p>The following sections give a brief overview of these
45 operations.</p>
46
47 <h2 id="new">Starting A New Project</h2>
48
49 <p>To start a new project with fossil create a new empty repository
50 this way: ([/help/init | more info]) </p>
51
52 <blockquote>
53 <b>fossil init </b><i> repository-filename</i>
54 </blockquote>
55
56 You can name the database anything you like, and you can place it anywhere in the filesystem.
57 The <tt>.fossil</tt> extension is traditional but only required if you are going to use the
58 <tt>[./help?cmd=/server | fossil server DIRECTORY]</tt> feature.”
59
60 <h2 id="clone">Cloning An Existing Repository</h2>
61
62 <p>Most fossil operations interact with a repository that is on the
63 local disk drive, not on a remote system. Hence, before accessing
64 a remote repository it is necessary to make a local copy of that
65 repository. Making a local copy of a remote repository is called
66 "cloning".</p>
67
68 <p>Clone a remote repository as follows: ([/help/clone | more info])</p>
69
70 <blockquote>
71 <b>fossil clone</b> <i>URL repository-filename</i>
72 </blockquote>
73
74 <p>The <i>URL</i> specifies the fossil repository
75 you want to clone. The <i>repository-filename</i> is the new local
76 filename into which the cloned repository will be written. For
77 example, to clone the source code of Fossil itself:
78
79 <blockquote>
80 <b>fossil clone https://www.fossil-scm.org/ myclone.fossil</b>
81 </blockquote>
82
83 If your logged-in username is 'exampleuser', you should see output something like this:
84
85 <blockquote>
86 <b><tt>
87 Round-trips: 8 Artifacts sent: 0 received: 39421<br>
88 Clone done, sent: 2424 received: 42965725 ip: 10.10.10.0<br>
89 Rebuilding repository meta-data...<br>
90 100% complete...<br>
91 Extra delta compression... <br>
92 Vacuuming the database... <br>
93 project-id: 94259BB9F186226D80E49D1FA2DB29F935CCA0333<br>
94 server-id: 016595e9043054038a9ea9bc526d7f33f7ac0e42<br>
95 admin-user: exampleuser (password is "yoWgDR42iv")><br>
96 </tt></b>
97 </blockquote>
98
99 <p>If the remote repository requires a login, include a
100 userid in the URL like this:
101
102 <blockquote>
103 <b>fossil clone https://</b><i>remoteuserid</i><b>@www.example.org/ myclone.fossil</b>
104 </blockquote>
105
106 <p>You will be prompted separately for the password.
107 Use [https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters|"%HH"] escapes for special characters in the userid.
108 For example "/" would be replaced by "%2F" meaning that a userid of "Projects/Budget" would become "Projects%2FBudget") </p>
109
110 <p>If you are behind a restrictive firewall, you might need
111 to <a href="#proxy">specify an HTTP proxy</a>.</p>
112
113 <p>A Fossil repository is a single disk file. Instead of cloning,
114 you can just make a copy of the repository file (for example, using
115 "scp"). Note, however, that the repository file contains auxiliary
116 information above and beyond the versioned files, including some
117 sensitive information such as password hashes and email addresses. If you
118 want to share Fossil repositories directly by copying, consider running the
119 [/help/scrub|fossil scrub] command to remove sensitive information
120 before transmitting the file.
121
122 <h2 id="import">Importing From Another Version Control System</h2>
123
124 <p>Rather than start a new project, or clone an existing Fossil project,
125 you might prefer to
126 <a href="./inout.wiki">import an existing Git project</a>
127 into Fossil using the [/help/import | fossil import] command.
128
129 You can even decide to export your project back into git using the
130 [/help/git | fossil git] command, which is how the Fossil project maintains
131 [https://github.com/drhsqlite/fossil-mirror | its public GitHub mirror]. There
132 is no limit to the number of times a tree can be imported and exported between
133 Fossil and git.
134
135 The [https://git-scm.com/docs/git-fast-export|Git fast-export format] has become
136 a popular way to move files between version management systems, including from
137 [https://www.mercurial-scm.org/|Mercurial].
138 Fossil can also import [https://subversion.apache.org/|Subversion projects] directly.
139
140 <h2 id="checkout">Checking Out A Local Tree</h2>
141
142 <p>To work on a project in fossil, you need to check out a local
143 copy of the source tree. Create the directory you want to be
144 the root of your tree and cd into that directory. Then
145 do this: ([/help/open | more info])</p>
146
147 <blockquote>
148 <b>fossil open </b><i> repository-filename</i>
149 </blockquote>
150
151 for example:
152
153 <blockquote>
154 <b><tt>
155 fossil open ../myclone.fossil<br>
156 BUILD.txt<br>
157 COPYRIGHT-BSD2.txt<br>
158 README.md<br>
159 ︙<br>
160 </tt></b>
161 </blockquote>
162
163 (or "fossil open ..\myclone.fossil" on Windows).
164
165 <p>This leaves you with the newest version of the tree
166 checked out.
167 From anywhere underneath the root of your local tree, you
168 can type commands like the following to find out the status of
169 your local tree:</p>
170
171 <blockquote>
172 <b>[/help/info | fossil info]</b><br>
173 <b>[/help/status | fossil status]</b><br>
174 <b>[/help/changes | fossil changes]</b><br>
175 <b>[/help/diff | fossil diff]</b><br>
176 <b>[/help/timeline | fossil timeline]</b><br>
177 <b>[/help/ls | fossil ls]</b><br>
178 <b>[/help/branch | fossil branch]</b><br>
179 </blockquote>
180
181 <p>If you created a new respository using "fossil init" some commands will not
182 produce much output.</p>
183
184 <p>Note that Fossil allows you to make multiple check-outs in
185 separate directories from the same repository. This enables you,
186 for example, to do builds from multiple branches or versions at
187 the same time without having to generate extra clones.</p>
188
189 <p>To switch a checkout between different versions and branches,
190 use:</p>
191
192 <blockquote>
193 <b>[/help/update | fossil update]</b><br>
194 <b>[/help/checkout | fossil checkout]</b><br>
195 </blockquote>
196
197 <p>[/help/update | update] honors the "autosync" option and
198 does a "soft" switch, merging any local changes into the target
199 version, whereas [/help/checkout | checkout] does not
200 automatically sync and does a "hard" switch, overwriting local
201 changes if told to do so.</p>
202
203 <h2 id="changes">Making and Commiting Changes</h2>
204
205 <p>To add new files to your project or remove existing ones, use these
206 commands:</p>
207
208 <blockquote>
209 <b>[/help/add | fossil add]</b> <i>file...</i><br>
210 <b>[/help/rm | fossil rm]</b> <i>file...</i><br>
211 <b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
212 </blockquote>
213
214 <p>The command:</p>
215 <blockquote>
216 <b>
217 [/help/changes | fossil changes]</b>
218 </blockquote>
219 <p>lists files that have changed since the last commit to the repository. For
220 example, if you edit the file "README.md":</p>
221
222 <blockquote>
223 <b>
224 fossil changes<br>
225 EDITED README.md
226 </b>
227 </blockquote>
228
229 <p>To see exactly what change was made you can use the command</p>
230 [/help/diff | fossil diff]:
231 <blockquote>
232 <b>
233 fossil diff <br><tt>
234 Index: README.md<br>
235 ============================================================<br>
236 --- README.md<br>
237 +++ README.md<br>
238 @@ -1,5 +1,6 @@<br>
239 +Made some changes to the project<br>
240 # Original text<br>
241 </tt></b>
242 </blockquote>
243
244 <p>"fossil diff" is the difference between your tree on disk now and as the tree was
245 when you did "fossil open". An open is the first checkout from a repository
246 into a new directory. </p>
247
248 <p>To commit your changes to a local-only repository:</p>
249 <blockquote>
250 <b>
251 fossil commit </b><i>(... Fossil will start your editor, if defined)</i><b><br><tt>
252 # Enter a commit message for this check-in. Lines beginning with # are ignored.<br>
253 #<br>
254 # user: exampleuser<br>
255 # tags: trunk<br>
256 #<br>
257 # EDITED README.md<br>
258 Edited file to add description of code changes<br>
259 New_Version: 7b9a416ced4a69a60589dde1aedd1a30fde8eec3528d265dbeed5135530440ab<br>
260 </tt></b>
261 </blockquote>
262
263 <p>You will be prompted for check-in comments using whatever editor
264 is specified by your VISUAL or EDITOR environment variable. If none is
265 specified Fossil uses line-editing in the terminal.</p>
266
267 <p>To commit your changes to a repository that was cloned from remote you
268 perform the same actions but the results are different. Fossil
269 defaults to 'autosync' mode, a single-stage commit that sends all changes
270 committed to the local repository immediately on to the remote parent repository. This
271 only works if you have write permission to the remote respository.</p>
272
273 <h2 id="naming">Naming of Files, Checkins, and Branches</h2>
274
275 <p>Fossil deals with information artifacts. This Quickstart document only deals
276 with files and collections of files, but be aware there are also tickets, wiki pages and more.
277 Every artifact in Fossil has a universally-unique hash id, and may also have a
278 human-readable name.</p>
279
280 <p>The following are all equivalent ways of identifying a Fossil file,
281 checkin or branch artifact:</p>
282
283 <ul>
284 <li> the full unique SHA-256 hash, such as be836de35a821523beac2e53168e135d5ebd725d7af421e5f736a28e8034673a
285 <li> an abbreviated hash prefix, such as the first ten characters: be836de35a . This won't be universally unique, but it is usually unique within any one repository. As an example, the [https://fossil-scm.org/home/hash-collisions|Fossil project hash collisions] showed at the time of writing that there are no artifacts with identical first 8 characters
286 <li> a branch name, such as "special-features" or "juliet-testing". Each branch also has a unique SHA-256 hash
287 </ul>
288
289 <p>A special convenience branch is "trunk", which is Fossil's default branch name for
290 the first checkin, and the default for any time a branch name is needed but not
291 specified.</p>
292
293 This will get you started on identifying checkins. The
294 <a href="./checkin_names.wiki">Checkin Names document</a> is a complete reference, including
295 how timestamps can also be used.
296
297 <h2 id="config">Configuring Your Local Repository</h2>
298
299 <p>When you create a new repository, either by cloning an existing
300 project or create a new project of your own, you usually want to do some
301 local configuration. This is easily accomplished using the web-server
302 that is built into fossil. Start the fossil web server like this:
303 ([/help/ui | more info])</p>
304
305 <blockquote>
306 <b>fossil ui </b><i> repository-filename</i>
307 </blockquote>
308
309 <p>You can omit the <i>repository-filename</i> from the command above
310 if you are inside a checked-out local tree.</p>
311
312 <p>This starts a web server then automatically launches your
313 web browser and makes it point to this web server. If your system
314 has an unusual configuration, fossil might not be able to figure out
315 how to start your web browser. In that case, first tell fossil
316 where to find your web browser using a command like this:</p>
317
318 <blockquote>
319 <b>fossil setting web-browser </b><i> path-to-web-browser</i>
320 </blockquote>
321
322 <p>By default, fossil does not require a login for HTTP connections
323 coming in from the IP loopback address 127.0.0.1. You can, and perhaps
324 should, change this after you create a few users.</p>
325
326 <p>When you are finished configuring, just press Control-C or use
327 the <b>kill</b> command to shut down the mini-server.</p>
328
329 <h2 id="changes">Making Changes</h2>
330
331 <p>To add new files to your project, or remove old files, use these
332 commands:</p>
333
334 <blockquote>
335 <b>[/help/add | fossil add]</b> <i>file...</i><br>
336 <b>[/help/rm | fossil rm]</b> <i>file...</i><br>
337 <b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
338 </blockquote>
339
340 <p>You can also edit files freely. Once you are ready to commit
341 your changes, type:</p>
342
343 <blockquote>
344 <b>[/help/commit | fossil commit]</b>
345 </blockquote>
346
347 <p>You will be prompted for check-in comments using whatever editor
348 is specified by your VISUAL or EDITOR environment variable.</p>
349
350 In the default configuration, the [/help/commit|commit]
351 command will also automatically [/help/push|push] your changes, but that
352 feature can be disabled. (More information about
353 [./concepts.wiki#workflow|autosync] and how to disable it.)
354 Remember that your coworkers can not see your changes until you
355 commit and push them.</p>
356
357 <h2 id="sharing">Sharing Changes</h2>
358
359 <p>When [./concepts.wiki#workflow|autosync] is turned off,
360 the changes you [/help/commit | commit] are only
361 on your local repository.
362 To share those changes with other repositories, do:</p>
363
364 <blockquote>
365 <b>[/help/push | fossil push]</b> <i>URL</i>
366 </blockquote>
367
368 <p>Where <i>URL</i> is the http: URL of the server repository you
369 want to share your changes with. If you omit the <i>URL</i> argument,
370 fossil will use whatever server you most recently synced with.</p>
371
372 <p>The [/help/push | push] command only sends your changes to others. To
373 Receive changes from others, use [/help/pull | pull]. Or go both ways at
374 once using [/help/sync | sync]:</p>
375
376 <blockquote>
377 <b>[/help/pull | fossil pull]</b> <i>URL</i><br>
378 <b>[/help/sync | fossil sync]</b> <i>URL</i>
379 </blockquote>
380
381 <p>When you pull in changes from others, they go into your repository,
382 not into your checked-out local tree. To get the changes into your
383 local tree, use [/help/update | update]:</p>
384
385 <blockquote>
386 <b>[/help/update | fossil update]</b> <i>VERSION</i>
387 </blockquote>
388
389 <p>The <i>VERSION</i> can be the name of a branch or tag or any
390 abbreviation to the 40-character
391 artifact identifier for a particular check-in, or it can be a
392 date/time stamp. ([./checkin_names.wiki | more info])
393 If you omit
394 the <i>VERSION</i>, then fossil moves you to the
395 latest version of the branch your are currently on.</p>
396
397 <p>The default behavior is for [./concepts.wiki#workflow|autosync] to
398 be turned on. That means that a [/help/pull|pull] automatically occurs
399 when you run [/help/update|update] and a [/help/push|push] happens
400 automatically after you [/help/commit|commit]. So in normal practice,
401 the push, pull, and sync commands are rarely used. But it is important
402 to know about them, all the same.</p>
403
404 <blockquote>
405 <b>[/help/checkout | fossil checkout]</b> <i>VERSION</i>
406 </blockquote>
407
408 <p>Is similar to update except that it does not honor the autosync
409 setting, nor does it merge in local changes - it prefers to overwrite
410 them and fails if local changes exist unless the <tt>--force</tt>
411 flag is used.</p>
412
413 <h2 id="branch" name="merge">Branching And Merging</h2>
414
415 <p>Use the --branch option to the [/help/commit | commit] command
416 to start a new branch. Note that in Fossil, branches are normally
417 created when you commit, not before you start editing. You can
418 use the [/help/branch | branch new] command to create a new branch
419 before you start editing, if you want, but most people just wait
420 until they are ready to commit.
421
422 To merge two branches back together, first
423 [/help/update | update] to the branch you want to merge into.
424 Then do a [/help/merge|merge] of the other branch that you want to incorporate
425 the changes from. For example, to merge "featureX" changes into "trunk"
426 do this:</p>
427
428 <blockquote>
429 <b>fossil [/help/update|update] trunk</b><br>
430 <b>fossil [/help/merge|merge] featureX</b><br>
431 <i># make sure the merge didn't break anything...</i><br>
432 <b>fossil [/help/commit|commit]
433 </blockquote>
434
435 <p>The argument to the [/help/merge|merge] command can be any of the
436 version identifier forms that work for [/help/update|update].
437 ([./checkin_names.wiki|more info].)
438 The merge command has options to cherry-pick individual
439 changes, or to back out individual changes, if you don't want to
440 do a full merge.</p>
441
442 The merge command puts all changes in your working check-out.
443 No changes are made to the repository.
444 You must run [/help/commit|commit] separately
445 to add the merge changes into your repository to make them persistent
446 and so that your coworkers can see them.
447 But before you do that, you will normally want to run a few tests
448 to verify that the merge didn't cause logic breaks in your code.
449
450 The same branch can be merged multiple times without trouble. Fossil
451 automatically keeps up with things and avoids conflicts when doing
452 multiple merges. So even if you have merged the featureX branch
453 into trunk previously, you can do so again and Fossil will automatically
454 know to pull in only those changes that have occurred since the previous
455 merge.
456
457 <p>If a merge or update doesn't work out (perhaps something breaks or
458 there are many merge conflicts) then you back up using:</p>
459
460 <blockquote>
461 <b>[/help/undo | fossil undo]</b>
462 </blockquote>
463
464 <p>This will back out the changes that the merge or update made to the
465 working checkout. There is also a [/help/redo|redo] command if you undo by
466 mistake. Undo and redo only work for changes that have
467 not yet been checked in using commit and there is only a single
468 level of undo/redo.</p>
469
470
471 <h2 id="server">Setting Up A Server</h2>
472
473 <p>Fossil can act as a stand-alone web server using one of these
474 commands:</p>
475
476 <blockquote>
477 <b>[/help/server | fossil server]</b> <i>repository-filename</i><br>
478 <b>[/help/ui | fossil ui]</b> <i>repository-filename</i>
479 </blockquote>
480
481 <p>The <i>repository-filename</i> can be omitted when these commands
482 are run from within an open check-out, which a particularly useful
483 shortcut for the <b>fossil ui</b> command.
484
485 <p>The <b>ui</b> command is intended for accessing the web interface
486 from a local desktop. The <b>ui</b> command binds to the loopback IP
487 address only (and thus makes the web interface visible only on the
488 local machine) and it automatically start your web browser pointing at the
489 server. For cross-machine collaboration, use the <b>server</b> command,
490 which binds on all IP addresses and does not try to start a web browser.</p>
491
492 <p>Servers are also easily configured as:
493 <ul>
494 <li>[./server/any/inetd.md|inetd]
495 <li>[./server/debian/service.md|systemd]
496 <li>[./server/any/cgi.md|CGI]
497 <li>[./server/any/scgi.md|SCGI]
498 </ul>
499
500 <p>The [./selfhost.wiki | self-hosting fossil repositories] use
501 CGI.
502
503 <h2 id="proxy">HTTP Proxies</h2>
504
505 <p>If you are behind a restrictive firewall that requires you to use
506 an HTTP proxy to reach the internet, then you can configure the proxy
507 in three different ways. You can tell fossil about your proxy using
508 a command-line option on commands that use the network,
509 <b>sync</b>, <b>clone</b>, <b>push</b>, and <b>pull</b>.</p>
510
511 <blockquote>
512 <b>fossil clone </b><i>URL</i> <b>--proxy</b> <i>Proxy-URL</i>
513 </blockquote>
514
515 <p>It is annoying to have to type in the proxy URL every time you
516 sync your project, though, so you can make the proxy configuration
517 persistent using the [/help/setting | setting] command:</p>
518
519 <blockquote>
520 <b>fossil setting proxy </b><i>Proxy-URL</i>
521 </blockquote>
522
523 <p>Or, you can set the "<b>http_proxy</b>" environment variable:</p>
524
525 <blockquote>
526 <b>export http_proxy=</b><i>Proxy-URL</i>
527 </blockquote>
528
529 <p>To stop using the proxy, do:</p>
530
531 <blockquote>
532 <b>fossil setting proxy off</b>
533 </blockquote>
534
535 <p>Or unset the environment variable. The fossil setting for the
536 HTTP proxy takes precedence over the environment variable and the
537 command-line option overrides both. If you have an persistent
538 proxy setting that you want to override for a one-time sync, that
539 is easily done on the command-line. For example, to sync with
540 a co-workers repository on your LAN, you might type:</p>
541
542 <blockquote>
543 <b>fossil sync http://192.168.1.36:8080/ --proxy off</b>
544 </blockquote>
545
546 <h2 id="links">Other Resources</h2>
547
548 <ul>
549 <li> <a href="./gitusers.md">Hints For Users With Prior Git Experience</a>
550 <li> <a href="./whyusefossil.wiki">Why You Should Use Fossil</a>
551 <li> <a href="./history.md">The History and Purpose of Fossil</a>
552 <li> <a href="./branching.wiki">Branching, Forking, and Tagging</a>
553 <li> <a href="./hints.wiki">Fossil Tips and Usage Hints</a>
554 <li> <a href="./permutedindex.html">Comprehensive Fossil Doc Index</a>
555 </ul>
556
--- www/quickstart.wiki
+++ www/quickstart.wiki
@@ -4,552 +4,552 @@
4 <p>This is a guide to help you get started using the Fossil [https://en.wikipedia.org/wiki/Distributed_version_control|Distributed Version Control System] quickly
5 and painlessly.</p>
6
7 <h2 id="install">Installing</h2>
8
9 <p>Fossil is a single self-contained C program. You need to
10 either download a
11 [https://www.fossil-scm.org/fossil/uv/download.html|precompiled
12 binary]
13 or <a href="build.wiki">compile it yourself</a> from sources.
14 Install Fossil by putting the fossil binary
15 someplace on your $PATH.</p>
16 You can test that Fossil is present and working like this:
17
18 <blockquote>
19 <b>
20 fossil version<br>
21 <tt>This is fossil version 2.13 [309af345ab] 2020-09-28 04:02:55 UTC</tt><br>
22 </b>
23 </blockquote>
24
25 <h2 id="workflow" name="fslclone">General Work Flow</h2>
26
27 <p>Fossil works with repository files (a database in a single file with the project's
28 complete history) and with checked-out local trees (the working directory
29 you use to do your work).
30 (See [./whyusefossil.wiki#definitions | definitions] for more background.)
31 The workflow looks like this:</p>
32
33 <ul>
34 <li>Create or clone a repository file. ([/help/init|fossil init] or
35 [/help/clone | fossil clone])
36 <li>Check out a local tree. ([/help/open | fossil open])
37 <li>Perform operations on the repository (including repository
38 configuration).
39 </ul>
40
41 Fossil can be entirely driven from the command line. Many features
42 can also be conveniently accessed from the build-in web interface.
43
44 <p>The following sections give a brief overview of these
45 operations.</p>
46
47 <h2 id="new">Starting A New Project</h2>
48
49 <p>To start a new project with fossil create a new empty repository
50 this way: ([/help/init | more info]) </p>
51
52 <blockquote>
53 <b>fossil init </b><i> repository-filename</i>
54 </blockquote>
55
56 You can name the database anything you like, and you can place it anywhere in the filesystem.
57 The <tt>.fossil</tt> extension is traditional but only required if you are going to use the
58 <tt>[./help?cmd=/server | fossil server DIRECTORY]</tt> feature.”
59
60 <h2 id="clone">Cloning An Existing Repository</h2>
61
62 <p>Most fossil operations interact with a repository that is on the
63 local disk drive, not on a remote system. Hence, before accessing
64 a remote repository it is necessary to make a local copy of that
65 repository. Making a local copy of a remote repository is called
66 "cloning".</p>
67
68 <p>Clone a remote repository as follows: ([/help/clone | more info])</p>
69
70 <blockquote>
71 <b>fossil clone</b> <i>URL repository-filename</i>
72 </blockquote>
73
74 <p>The <i>URL</i> specifies the fossil repository
75 you want to clone. The <i>repository-filename</i> is the new local
76 filename into which the cloned repository will be written. For
77 example, to clone the source code of Fossil itself:
78
79 <blockquote>
80 <b>fossil clone https://www.fossil-scm.org/ myclone.fossil</b>
81 </blockquote>
82
83 If your logged-in username is 'exampleuser', you should see output something like this:
84
85 <blockquote>
86 <b><tt>
87 Round-trips: 8 Artifacts sent: 0 received: 39421<br>
88 Clone done, sent: 2424 received: 42965725 ip: 10.10.10.0<br>
89 Rebuilding repository meta-data...<br>
90 100% complete...<br>
91 Extra delta compression... <br>
92 Vacuuming the database... <br>
93 project-id: 94259BB9F186226D80E49D1FA2DB29F935CCA0333<br>
94 server-id: 016595e9043054038a9ea9bc526d7f33f7ac0e42<br>
95 admin-user: exampleuser (password is "yoWgDR42iv")><br>
96 </tt></b>
97 </blockquote>
98
99 <p>If the remote repository requires a login, include a
100 userid in the URL like this:
101
102 <blockquote>
103 <b>fossil clone https://</b><i>remoteuserid</i><b>@www.example.org/ myclone.fossil</b>
104 </blockquote>
105
106 <p>You will be prompted separately for the password.
107 Use [https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters|"%HH"] escapes for special characters in the userid.
108 For example "/" would be replaced by "%2F" meaning that a userid of "Projects/Budget" would become "Projects%2FBudget") </p>
109
110 <p>If you are behind a restrictive firewall, you might need
111 to <a href="#proxy">specify an HTTP proxy</a>.</p>
112
113 <p>A Fossil repository is a single disk file. Instead of cloning,
114 you can just make a copy of the repository file (for example, using
115 "scp"). Note, however, that the repository file contains auxiliary
116 information above and beyond the versioned files, including some
117 sensitive information such as password hashes and email addresses. If you
118 want to share Fossil repositories directly by copying, consider running the
119 [/help/scrub|fossil scrub] command to remove sensitive information
120 before transmitting the file.
121
122 <h2 id="import">Importing From Another Version Control System</h2>
123
124 <p>Rather than start a new project, or clone an existing Fossil project,
125 you might prefer to
126 <a href="./inout.wiki">import an existing Git project</a>
127 into Fossil using the [/help/import | fossil import] command.
128
129 You can even decide to export your project back into git using the
130 [/help/git | fossil git] command, which is how the Fossil project maintains
131 [https://github.com/drhsqlite/fossil-mirror | its public GitHub mirror]. There
132 is no limit to the number of times a tree can be imported and exported between
133 Fossil and git.
134
135 The [https://git-scm.com/docs/git-fast-export|Git fast-export format] has become
136 a popular way to move files between version management systems, including from
137 [https://www.mercurial-scm.org/|Mercurial].
138 Fossil can also import [https://subversion.apache.org/|Subversion projects] directly.
139
140 <h2 id="checkout">Checking Out A Local Tree</h2>
141
142 <p>To work on a project in fossil, you need to check out a local
143 copy of the source tree. Create the directory you want to be
144 the root of your tree and cd into that directory. Then
145 do this: ([/help/open | more info])</p>
146
147 <blockquote>
148 <b>fossil open </b><i> repository-filename</i>
149 </blockquote>
150
151 for example:
152
153 <blockquote>
154 <b><tt>
155 fossil open ../myclone.fossil<br>
156 BUILD.txt<br>
157 COPYRIGHT-BSD2.txt<br>
158 README.md<br>
159 ︙<br>
160 </tt></b>
161 </blockquote>
162
163 (or "fossil open ..\myclone.fossil" on Windows).
164
165 <p>This leaves you with the newest version of the tree
166 checked out.
167 From anywhere underneath the root of your local tree, you
168 can type commands like the following to find out the status of
169 your local tree:</p>
170
171 <blockquote>
172 <b>[/help/info | fossil info]</b><br>
173 <b>[/help/status | fossil status]</b><br>
174 <b>[/help/changes | fossil changes]</b><br>
175 <b>[/help/diff | fossil diff]</b><br>
176 <b>[/help/timeline | fossil timeline]</b><br>
177 <b>[/help/ls | fossil ls]</b><br>
178 <b>[/help/branch | fossil branch]</b><br>
179 </blockquote>
180
181 <p>If you created a new repository using "fossil init" some commands will not
182 produce much output.</p>
183
184 <p>Note that Fossil allows you to make multiple check-outs in
185 separate directories from the same repository. This enables you,
186 for example, to do builds from multiple branches or versions at
187 the same time without having to generate extra clones.</p>
188
189 <p>To switch a checkout between different versions and branches,
190 use:</p>
191
192 <blockquote>
193 <b>[/help/update | fossil update]</b><br>
194 <b>[/help/checkout | fossil checkout]</b><br>
195 </blockquote>
196
197 <p>[/help/update | update] honors the "autosync" option and
198 does a "soft" switch, merging any local changes into the target
199 version, whereas [/help/checkout | checkout] does not
200 automatically sync and does a "hard" switch, overwriting local
201 changes if told to do so.</p>
202
203 <h2 id="changes">Making and Committing Changes</h2>
204
205 <p>To add new files to your project or remove existing ones, use these
206 commands:</p>
207
208 <blockquote>
209 <b>[/help/add | fossil add]</b> <i>file...</i><br>
210 <b>[/help/rm | fossil rm]</b> <i>file...</i><br>
211 <b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
212 </blockquote>
213
214 <p>The command:</p>
215 <blockquote>
216 <b>
217 [/help/changes | fossil changes]</b>
218 </blockquote>
219 <p>lists files that have changed since the last commit to the repository. For
220 example, if you edit the file "README.md":</p>
221
222 <blockquote>
223 <b>
224 fossil changes<br>
225 EDITED README.md
226 </b>
227 </blockquote>
228
229 <p>To see exactly what change was made you can use the command</p>
230 [/help/diff | fossil diff]:
231 <blockquote>
232 <b>
233 fossil diff <br><tt>
234 Index: README.md<br>
235 ============================================================<br>
236 --- README.md<br>
237 +++ README.md<br>
238 @@ -1,5 +1,6 @@<br>
239 +Made some changes to the project<br>
240 # Original text<br>
241 </tt></b>
242 </blockquote>
243
244 <p>"fossil diff" is the difference between your tree on disk now and as the tree was
245 when you did "fossil open". An open is the first checkout from a repository
246 into a new directory. </p>
247
248 <p>To commit your changes to a local-only repository:</p>
249 <blockquote>
250 <b>
251 fossil commit </b><i>(... Fossil will start your editor, if defined)</i><b><br><tt>
252 # Enter a commit message for this check-in. Lines beginning with # are ignored.<br>
253 #<br>
254 # user: exampleuser<br>
255 # tags: trunk<br>
256 #<br>
257 # EDITED README.md<br>
258 Edited file to add description of code changes<br>
259 New_Version: 7b9a416ced4a69a60589dde1aedd1a30fde8eec3528d265dbeed5135530440ab<br>
260 </tt></b>
261 </blockquote>
262
263 <p>You will be prompted for check-in comments using whatever editor
264 is specified by your VISUAL or EDITOR environment variable. If none is
265 specified Fossil uses line-editing in the terminal.</p>
266
267 <p>To commit your changes to a repository that was cloned from remote you
268 perform the same actions but the results are different. Fossil
269 defaults to 'autosync' mode, a single-stage commit that sends all changes
270 committed to the local repository immediately on to the remote parent repository. This
271 only works if you have write permission to the remote respository.</p>
272
273 <h2 id="naming">Naming of Files, Checkins, and Branches</h2>
274
275 <p>Fossil deals with information artifacts. This Quickstart document only deals
276 with files and collections of files, but be aware there are also tickets, wiki pages and more.
277 Every artifact in Fossil has a universally-unique hash id, and may also have a
278 human-readable name.</p>
279
280 <p>The following are all equivalent ways of identifying a Fossil file,
281 checkin or branch artifact:</p>
282
283 <ul>
284 <li> the full unique SHA-256 hash, such as be836de35a821523beac2e53168e135d5ebd725d7af421e5f736a28e8034673a
285 <li> an abbreviated hash prefix, such as the first ten characters: be836de35a . This won't be universally unique, but it is usually unique within any one repository. As an example, the [https://fossil-scm.org/home/hash-collisions|Fossil project hash collisions] showed at the time of writing that there are no artifacts with identical first 8 characters
286 <li> a branch name, such as "special-features" or "juliet-testing". Each branch also has a unique SHA-256 hash
287 </ul>
288
289 <p>A special convenience branch is "trunk", which is Fossil's default branch name for
290 the first checkin, and the default for any time a branch name is needed but not
291 specified.</p>
292
293 This will get you started on identifying checkins. The
294 <a href="./checkin_names.wiki">Checkin Names document</a> is a complete reference, including
295 how timestamps can also be used.
296
297 <h2 id="config">Configuring Your Local Repository</h2>
298
299 <p>When you create a new repository, either by cloning an existing
300 project or create a new project of your own, you usually want to do some
301 local configuration. This is easily accomplished using the web-server
302 that is built into fossil. Start the fossil web server like this:
303 ([/help/ui | more info])</p>
304
305 <blockquote>
306 <b>fossil ui </b><i> repository-filename</i>
307 </blockquote>
308
309 <p>You can omit the <i>repository-filename</i> from the command above
310 if you are inside a checked-out local tree.</p>
311
312 <p>This starts a web server then automatically launches your
313 web browser and makes it point to this web server. If your system
314 has an unusual configuration, fossil might not be able to figure out
315 how to start your web browser. In that case, first tell fossil
316 where to find your web browser using a command like this:</p>
317
318 <blockquote>
319 <b>fossil setting web-browser </b><i> path-to-web-browser</i>
320 </blockquote>
321
322 <p>By default, fossil does not require a login for HTTP connections
323 coming in from the IP loopback address 127.0.0.1. You can, and perhaps
324 should, change this after you create a few users.</p>
325
326 <p>When you are finished configuring, just press Control-C or use
327 the <b>kill</b> command to shut down the mini-server.</p>
328
329 <h2 id="changes">Making Changes</h2>
330
331 <p>To add new files to your project, or remove old files, use these
332 commands:</p>
333
334 <blockquote>
335 <b>[/help/add | fossil add]</b> <i>file...</i><br>
336 <b>[/help/rm | fossil rm]</b> <i>file...</i><br>
337 <b>[/help/addremove | fossil addremove]</b> <i>file...</i><br>
338 </blockquote>
339
340 <p>You can also edit files freely. Once you are ready to commit
341 your changes, type:</p>
342
343 <blockquote>
344 <b>[/help/commit | fossil commit]</b>
345 </blockquote>
346
347 <p>You will be prompted for check-in comments using whatever editor
348 is specified by your VISUAL or EDITOR environment variable.</p>
349
350 In the default configuration, the [/help/commit|commit]
351 command will also automatically [/help/push|push] your changes, but that
352 feature can be disabled. (More information about
353 [./concepts.wiki#workflow|autosync] and how to disable it.)
354 Remember that your coworkers can not see your changes until you
355 commit and push them.</p>
356
357 <h2 id="sharing">Sharing Changes</h2>
358
359 <p>When [./concepts.wiki#workflow|autosync] is turned off,
360 the changes you [/help/commit | commit] are only
361 on your local repository.
362 To share those changes with other repositories, do:</p>
363
364 <blockquote>
365 <b>[/help/push | fossil push]</b> <i>URL</i>
366 </blockquote>
367
368 <p>Where <i>URL</i> is the http: URL of the server repository you
369 want to share your changes with. If you omit the <i>URL</i> argument,
370 fossil will use whatever server you most recently synced with.</p>
371
372 <p>The [/help/push | push] command only sends your changes to others. To
373 Receive changes from others, use [/help/pull | pull]. Or go both ways at
374 once using [/help/sync | sync]:</p>
375
376 <blockquote>
377 <b>[/help/pull | fossil pull]</b> <i>URL</i><br>
378 <b>[/help/sync | fossil sync]</b> <i>URL</i>
379 </blockquote>
380
381 <p>When you pull in changes from others, they go into your repository,
382 not into your checked-out local tree. To get the changes into your
383 local tree, use [/help/update | update]:</p>
384
385 <blockquote>
386 <b>[/help/update | fossil update]</b> <i>VERSION</i>
387 </blockquote>
388
389 <p>The <i>VERSION</i> can be the name of a branch or tag or any
390 abbreviation to the 40-character
391 artifact identifier for a particular check-in, or it can be a
392 date/time stamp. ([./checkin_names.wiki | more info])
393 If you omit
394 the <i>VERSION</i>, then fossil moves you to the
395 latest version of the branch your are currently on.</p>
396
397 <p>The default behavior is for [./concepts.wiki#workflow|autosync] to
398 be turned on. That means that a [/help/pull|pull] automatically occurs
399 when you run [/help/update|update] and a [/help/push|push] happens
400 automatically after you [/help/commit|commit]. So in normal practice,
401 the push, pull, and sync commands are rarely used. But it is important
402 to know about them, all the same.</p>
403
404 <blockquote>
405 <b>[/help/checkout | fossil checkout]</b> <i>VERSION</i>
406 </blockquote>
407
408 <p>Is similar to update except that it does not honor the autosync
409 setting, nor does it merge in local changes - it prefers to overwrite
410 them and fails if local changes exist unless the <tt>--force</tt>
411 flag is used.</p>
412
413 <h2 id="branch" name="merge">Branching And Merging</h2>
414
415 <p>Use the --branch option to the [/help/commit | commit] command
416 to start a new branch. Note that in Fossil, branches are normally
417 created when you commit, not before you start editing. You can
418 use the [/help/branch | branch new] command to create a new branch
419 before you start editing, if you want, but most people just wait
420 until they are ready to commit.
421
422 To merge two branches back together, first
423 [/help/update | update] to the branch you want to merge into.
424 Then do a [/help/merge|merge] of the other branch that you want to incorporate
425 the changes from. For example, to merge "featureX" changes into "trunk"
426 do this:</p>
427
428 <blockquote>
429 <b>fossil [/help/update|update] trunk</b><br>
430 <b>fossil [/help/merge|merge] featureX</b><br>
431 <i># make sure the merge didn't break anything...</i><br>
432 <b>fossil [/help/commit|commit]
433 </blockquote>
434
435 <p>The argument to the [/help/merge|merge] command can be any of the
436 version identifier forms that work for [/help/update|update].
437 ([./checkin_names.wiki|more info].)
438 The merge command has options to cherry-pick individual
439 changes, or to back out individual changes, if you don't want to
440 do a full merge.</p>
441
442 The merge command puts all changes in your working check-out.
443 No changes are made to the repository.
444 You must run [/help/commit|commit] separately
445 to add the merge changes into your repository to make them persistent
446 and so that your coworkers can see them.
447 But before you do that, you will normally want to run a few tests
448 to verify that the merge didn't cause logic breaks in your code.
449
450 The same branch can be merged multiple times without trouble. Fossil
451 automatically keeps up with things and avoids conflicts when doing
452 multiple merges. So even if you have merged the featureX branch
453 into trunk previously, you can do so again and Fossil will automatically
454 know to pull in only those changes that have occurred since the previous
455 merge.
456
457 <p>If a merge or update doesn't work out (perhaps something breaks or
458 there are many merge conflicts) then you back up using:</p>
459
460 <blockquote>
461 <b>[/help/undo | fossil undo]</b>
462 </blockquote>
463
464 <p>This will back out the changes that the merge or update made to the
465 working checkout. There is also a [/help/redo|redo] command if you undo by
466 mistake. Undo and redo only work for changes that have
467 not yet been checked in using commit and there is only a single
468 level of undo/redo.</p>
469
470
471 <h2 id="server">Setting Up A Server</h2>
472
473 <p>Fossil can act as a stand-alone web server using one of these
474 commands:</p>
475
476 <blockquote>
477 <b>[/help/server | fossil server]</b> <i>repository-filename</i><br>
478 <b>[/help/ui | fossil ui]</b> <i>repository-filename</i>
479 </blockquote>
480
481 <p>The <i>repository-filename</i> can be omitted when these commands
482 are run from within an open check-out, which a particularly useful
483 shortcut for the <b>fossil ui</b> command.
484
485 <p>The <b>ui</b> command is intended for accessing the web interface
486 from a local desktop. The <b>ui</b> command binds to the loopback IP
487 address only (and thus makes the web interface visible only on the
488 local machine) and it automatically start your web browser pointing at the
489 server. For cross-machine collaboration, use the <b>server</b> command,
490 which binds on all IP addresses and does not try to start a web browser.</p>
491
492 <p>Servers are also easily configured as:
493 <ul>
494 <li>[./server/any/inetd.md|inetd]
495 <li>[./server/debian/service.md|systemd]
496 <li>[./server/any/cgi.md|CGI]
497 <li>[./server/any/scgi.md|SCGI]
498 </ul>
499
500 <p>The [./selfhost.wiki | self-hosting fossil repositories] use
501 CGI.
502
503 <h2 id="proxy">HTTP Proxies</h2>
504
505 <p>If you are behind a restrictive firewall that requires you to use
506 an HTTP proxy to reach the internet, then you can configure the proxy
507 in three different ways. You can tell fossil about your proxy using
508 a command-line option on commands that use the network,
509 <b>sync</b>, <b>clone</b>, <b>push</b>, and <b>pull</b>.</p>
510
511 <blockquote>
512 <b>fossil clone </b><i>URL</i> <b>--proxy</b> <i>Proxy-URL</i>
513 </blockquote>
514
515 <p>It is annoying to have to type in the proxy URL every time you
516 sync your project, though, so you can make the proxy configuration
517 persistent using the [/help/setting | setting] command:</p>
518
519 <blockquote>
520 <b>fossil setting proxy </b><i>Proxy-URL</i>
521 </blockquote>
522
523 <p>Or, you can set the "<b>http_proxy</b>" environment variable:</p>
524
525 <blockquote>
526 <b>export http_proxy=</b><i>Proxy-URL</i>
527 </blockquote>
528
529 <p>To stop using the proxy, do:</p>
530
531 <blockquote>
532 <b>fossil setting proxy off</b>
533 </blockquote>
534
535 <p>Or unset the environment variable. The fossil setting for the
536 HTTP proxy takes precedence over the environment variable and the
537 command-line option overrides both. If you have a persistent
538 proxy setting that you want to override for a one-time sync, that
539 is easily done on the command-line. For example, to sync with
540 a co-worker's repository on your LAN, you might type:</p>
541
542 <blockquote>
543 <b>fossil sync http://192.168.1.36:8080/ --proxy off</b>
544 </blockquote>
545
546 <h2 id="links">Other Resources</h2>
547
548 <ul>
549 <li> <a href="./gitusers.md">Hints For Users With Prior Git Experience</a>
550 <li> <a href="./whyusefossil.wiki">Why You Should Use Fossil</a>
551 <li> <a href="./history.md">The History and Purpose of Fossil</a>
552 <li> <a href="./branching.wiki">Branching, Forking, and Tagging</a>
553 <li> <a href="./hints.wiki">Fossil Tips and Usage Hints</a>
554 <li> <a href="./permutedindex.html">Comprehensive Fossil Doc Index</a>
555 </ul>
556
--- www/rebaseharm.md
+++ www/rebaseharm.md
@@ -331,11 +331,11 @@
331331
presentation for routine display purposes.
332332
333333
Git needs rebase because it lacks these annotation facilities. Rather
334334
than consider rebase a desirable feature missing in Fossil, ask instead
335335
why Git lacks support for making editorial changes to check-ins without
336
-modifyihng history? Wouldn't it be better to fix the version control
336
+modifying history? Wouldn't it be better to fix the version control
337337
tool rather than requiring users to fabricate a fictitious project
338338
history?
339339
340340
## <a name="collapsing"></a>6.0 Collapsing check-ins throws away valuable information
341341
342342
--- www/rebaseharm.md
+++ www/rebaseharm.md
@@ -331,11 +331,11 @@
331 presentation for routine display purposes.
332
333 Git needs rebase because it lacks these annotation facilities. Rather
334 than consider rebase a desirable feature missing in Fossil, ask instead
335 why Git lacks support for making editorial changes to check-ins without
336 modifyihng history? Wouldn't it be better to fix the version control
337 tool rather than requiring users to fabricate a fictitious project
338 history?
339
340 ## <a name="collapsing"></a>6.0 Collapsing check-ins throws away valuable information
341
342
--- www/rebaseharm.md
+++ www/rebaseharm.md
@@ -331,11 +331,11 @@
331 presentation for routine display purposes.
332
333 Git needs rebase because it lacks these annotation facilities. Rather
334 than consider rebase a desirable feature missing in Fossil, ask instead
335 why Git lacks support for making editorial changes to check-ins without
336 modifying history? Wouldn't it be better to fix the version control
337 tool rather than requiring users to fabricate a fictitious project
338 history?
339
340 ## <a name="collapsing"></a>6.0 Collapsing check-ins throws away valuable information
341
342
--- www/server/any/althttpd.md
+++ www/server/any/althttpd.md
@@ -9,11 +9,11 @@
99
server, follow these steps.
1010
<ol>
1111
<li<p>Get the althttpd webserver running on the host. This is easily
1212
done by following the [althttpd documentation][althttpd].
1313
14
-<li><p>Create a CGI script for your Fossil respository. The script will
14
+<li><p>Create a CGI script for your Fossil repository. The script will
1515
be typically be two lines of code that look something like this:
1616
1717
~~~
1818
#!/usr/bin/fossil
1919
repository: /home/yourlogin/fossils/project.fossil
2020
--- www/server/any/althttpd.md
+++ www/server/any/althttpd.md
@@ -9,11 +9,11 @@
9 server, follow these steps.
10 <ol>
11 <li<p>Get the althttpd webserver running on the host. This is easily
12 done by following the [althttpd documentation][althttpd].
13
14 <li><p>Create a CGI script for your Fossil respository. The script will
15 be typically be two lines of code that look something like this:
16
17 ~~~
18 #!/usr/bin/fossil
19 repository: /home/yourlogin/fossils/project.fossil
20
--- www/server/any/althttpd.md
+++ www/server/any/althttpd.md
@@ -9,11 +9,11 @@
9 server, follow these steps.
10 <ol>
11 <li<p>Get the althttpd webserver running on the host. This is easily
12 done by following the [althttpd documentation][althttpd].
13
14 <li><p>Create a CGI script for your Fossil repository. The script will
15 be typically be two lines of code that look something like this:
16
17 ~~~
18 #!/usr/bin/fossil
19 repository: /home/yourlogin/fossils/project.fossil
20
--- www/server/debian/service.md
+++ www/server/debian/service.md
@@ -103,11 +103,11 @@
103103
104104
/etc/systemd/system
105105
/lib/systemd/system
106106
107107
2. Add `User` and `Group` directives to the `[Service]` section so
108
- Fossil runs as a normal user, preferrably one with access only to
108
+ Fossil runs as a normal user, preferably one with access only to
109109
the Fossil repo files, rather than running as `root`.
110110
111111
112112
## Socket Activation
113113
114114
--- www/server/debian/service.md
+++ www/server/debian/service.md
@@ -103,11 +103,11 @@
103
104 /etc/systemd/system
105 /lib/systemd/system
106
107 2. Add `User` and `Group` directives to the `[Service]` section so
108 Fossil runs as a normal user, preferrably one with access only to
109 the Fossil repo files, rather than running as `root`.
110
111
112 ## Socket Activation
113
114
--- www/server/debian/service.md
+++ www/server/debian/service.md
@@ -103,11 +103,11 @@
103
104 /etc/systemd/system
105 /lib/systemd/system
106
107 2. Add `User` and `Group` directives to the `[Service]` section so
108 Fossil runs as a normal user, preferably one with access only to
109 the Fossil repo files, rather than running as `root`.
110
111
112 ## Socket Activation
113
114
--- www/server/openbsd/fastcgi.md
+++ www/server/openbsd/fastcgi.md
@@ -68,11 +68,11 @@
6868
Fossil needs both `/dev/random` and `/dev/null`, which aren't accessible
6969
from within the chroot, so need to be constructed; `/var`, however, is
7070
mounted with the `nodev` option. Rather than removing this default
7171
setting, create a small memory filesystem and then mount it on to
7272
`/var/www/dev` with [`mount_mfs(8)`][mfs] so that the `random` and
73
-`null` device files can be created. In order to avoid neccessitating a
73
+`null` device files can be created. In order to avoid necessitating a
7474
startup script to recreate the device files at boot, create a template
7575
of the needed ``/dev`` tree to automatically populate the memory
7676
filesystem.
7777
7878
```console
7979
--- www/server/openbsd/fastcgi.md
+++ www/server/openbsd/fastcgi.md
@@ -68,11 +68,11 @@
68 Fossil needs both `/dev/random` and `/dev/null`, which aren't accessible
69 from within the chroot, so need to be constructed; `/var`, however, is
70 mounted with the `nodev` option. Rather than removing this default
71 setting, create a small memory filesystem and then mount it on to
72 `/var/www/dev` with [`mount_mfs(8)`][mfs] so that the `random` and
73 `null` device files can be created. In order to avoid neccessitating a
74 startup script to recreate the device files at boot, create a template
75 of the needed ``/dev`` tree to automatically populate the memory
76 filesystem.
77
78 ```console
79
--- www/server/openbsd/fastcgi.md
+++ www/server/openbsd/fastcgi.md
@@ -68,11 +68,11 @@
68 Fossil needs both `/dev/random` and `/dev/null`, which aren't accessible
69 from within the chroot, so need to be constructed; `/var`, however, is
70 mounted with the `nodev` option. Rather than removing this default
71 setting, create a small memory filesystem and then mount it on to
72 `/var/www/dev` with [`mount_mfs(8)`][mfs] so that the `random` and
73 `null` device files can be created. In order to avoid necessitating a
74 startup script to recreate the device files at boot, create a template
75 of the needed ``/dev`` tree to automatically populate the memory
76 filesystem.
77
78 ```console
79
--- www/server/whyuseaserver.wiki
+++ www/server/whyuseaserver.wiki
@@ -14,11 +14,12 @@
1414
Here are a few reasons to set up a Fossil server for your project:
1515
1616
1. <b>A server works as a complete project website.</b><p>
1717
Fossil does more than just version control. It also supports
1818
[../tickets.wiki|trouble-tickets],
19
- [../wikitheory.wiki|wiki], and a [../forum.wiki|forum].
19
+ [../wikitheory.wiki|wiki],
20
+ a [../chat.md|developer chat room], and a [../forum.wiki|forum].
2021
The [../embeddeddoc.wiki|embedded documentation]
2122
feature provides a great mechanism for providing project documentation.
2223
The [../unvers.wiki|unversioned files] feature is a convenient way
2324
to host builds and downloads on the project website.
2425
@@ -25,11 +26,11 @@
2526
2. <b>A server gives developers a common point of rendezvous for
2627
syncing their work.</b><p>
2728
It is possible for developers to synchronize peer-to-peer but
2829
that requires the developers coordinate the sync, which in turn
2930
requires that the developers both want to sync at the same moment.
30
- A server aleviates this time dependency by allowing each developer
31
+ A server alleviates this time dependency by allowing each developer
3132
to sync whenever it is convenient (for example, automatically syncing
3233
after each commit and before each update). Developers all stay
3334
in sync with each other, without having to interrupt each other
3435
constantly to set up a peer-to-peer sync.
3536
3637
--- www/server/whyuseaserver.wiki
+++ www/server/whyuseaserver.wiki
@@ -14,11 +14,12 @@
14 Here are a few reasons to set up a Fossil server for your project:
15
16 1. <b>A server works as a complete project website.</b><p>
17 Fossil does more than just version control. It also supports
18 [../tickets.wiki|trouble-tickets],
19 [../wikitheory.wiki|wiki], and a [../forum.wiki|forum].
 
20 The [../embeddeddoc.wiki|embedded documentation]
21 feature provides a great mechanism for providing project documentation.
22 The [../unvers.wiki|unversioned files] feature is a convenient way
23 to host builds and downloads on the project website.
24
@@ -25,11 +26,11 @@
25 2. <b>A server gives developers a common point of rendezvous for
26 syncing their work.</b><p>
27 It is possible for developers to synchronize peer-to-peer but
28 that requires the developers coordinate the sync, which in turn
29 requires that the developers both want to sync at the same moment.
30 A server aleviates this time dependency by allowing each developer
31 to sync whenever it is convenient (for example, automatically syncing
32 after each commit and before each update). Developers all stay
33 in sync with each other, without having to interrupt each other
34 constantly to set up a peer-to-peer sync.
35
36
--- www/server/whyuseaserver.wiki
+++ www/server/whyuseaserver.wiki
@@ -14,11 +14,12 @@
14 Here are a few reasons to set up a Fossil server for your project:
15
16 1. <b>A server works as a complete project website.</b><p>
17 Fossil does more than just version control. It also supports
18 [../tickets.wiki|trouble-tickets],
19 [../wikitheory.wiki|wiki],
20 a [../chat.md|developer chat room], and a [../forum.wiki|forum].
21 The [../embeddeddoc.wiki|embedded documentation]
22 feature provides a great mechanism for providing project documentation.
23 The [../unvers.wiki|unversioned files] feature is a convenient way
24 to host builds and downloads on the project website.
25
@@ -25,11 +26,11 @@
26 2. <b>A server gives developers a common point of rendezvous for
27 syncing their work.</b><p>
28 It is possible for developers to synchronize peer-to-peer but
29 that requires the developers coordinate the sync, which in turn
30 requires that the developers both want to sync at the same moment.
31 A server alleviates this time dependency by allowing each developer
32 to sync whenever it is convenient (for example, automatically syncing
33 after each commit and before each update). Developers all stay
34 in sync with each other, without having to interrupt each other
35 constantly to set up a peer-to-peer sync.
36
37
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -86,11 +86,11 @@
8686
[https://wapp.tcl.tk|Wapp program]. The current source code to the
8787
this program can be seen at
8888
[https://www.sqlite.org/src/ext/checklist/3070700/self] and
8989
recent historical versions are available at
9090
[https://sqlite.org/docsrc/finfo/misc/checklist.tcl] with
91
-older legacy at [https://sqlite.org/checklistapp/timeline?n=all]
91
+older legacy at [https://sqlite.org/checklistapp/timeline?n1=all]
9292
9393
There is a cascade of CGIs happening here. The web server that receives
9494
the initial HTTP request runs Fossil as a CGI based on the
9595
"https://sqlite.org/src" portion of the URL. The Fossil instance then
9696
runs the checklist sub-CGI based on the "/ext/checklists" suffix. The
9797
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -86,11 +86,11 @@
86 [https://wapp.tcl.tk|Wapp program]. The current source code to the
87 this program can be seen at
88 [https://www.sqlite.org/src/ext/checklist/3070700/self] and
89 recent historical versions are available at
90 [https://sqlite.org/docsrc/finfo/misc/checklist.tcl] with
91 older legacy at [https://sqlite.org/checklistapp/timeline?n=all]
92
93 There is a cascade of CGIs happening here. The web server that receives
94 the initial HTTP request runs Fossil as a CGI based on the
95 "https://sqlite.org/src" portion of the URL. The Fossil instance then
96 runs the checklist sub-CGI based on the "/ext/checklists" suffix. The
97
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -86,11 +86,11 @@
86 [https://wapp.tcl.tk|Wapp program]. The current source code to the
87 this program can be seen at
88 [https://www.sqlite.org/src/ext/checklist/3070700/self] and
89 recent historical versions are available at
90 [https://sqlite.org/docsrc/finfo/misc/checklist.tcl] with
91 older legacy at [https://sqlite.org/checklistapp/timeline?n1=all]
92
93 There is a cascade of CGIs happening here. The web server that receives
94 the initial HTTP request runs Fossil as a CGI based on the
95 "https://sqlite.org/src" portion of the URL. The Fossil instance then
96 runs the checklist sub-CGI based on the "/ext/checklists" suffix. The
97
--- www/shunning.wiki
+++ www/shunning.wiki
@@ -92,11 +92,11 @@
9292
9393
<h2>Exception: Non-versioned Content</h2>
9494
9595
It is normal and expected to delete data which is not versioned, such as
9696
usernames and passwords in the user table. The [/help/scrub|fossil scrub]
97
-command will remove all sensitive non-versioned data from a respository.
97
+command will remove all sensitive non-versioned data from a repository.
9898
9999
The scrub command will remove user 'bertina', along with their password,
100100
any supplied IP address, any concealed email address etc. However, in the
101101
DAG, commits by 'bertina' will continue to be visible unchanged even though
102102
there is no longer any such user in Fossil.
103103
--- www/shunning.wiki
+++ www/shunning.wiki
@@ -92,11 +92,11 @@
92
93 <h2>Exception: Non-versioned Content</h2>
94
95 It is normal and expected to delete data which is not versioned, such as
96 usernames and passwords in the user table. The [/help/scrub|fossil scrub]
97 command will remove all sensitive non-versioned data from a respository.
98
99 The scrub command will remove user 'bertina', along with their password,
100 any supplied IP address, any concealed email address etc. However, in the
101 DAG, commits by 'bertina' will continue to be visible unchanged even though
102 there is no longer any such user in Fossil.
103
--- www/shunning.wiki
+++ www/shunning.wiki
@@ -92,11 +92,11 @@
92
93 <h2>Exception: Non-versioned Content</h2>
94
95 It is normal and expected to delete data which is not versioned, such as
96 usernames and passwords in the user table. The [/help/scrub|fossil scrub]
97 command will remove all sensitive non-versioned data from a repository.
98
99 The scrub command will remove user 'bertina', along with their password,
100 any supplied IP address, any concealed email address etc. However, in the
101 DAG, commits by 'bertina' will continue to be visible unchanged even though
102 there is no longer any such user in Fossil.
103
+1 -1
--- www/ssl.wiki
+++ www/ssl.wiki
@@ -157,11 +157,11 @@
157157
<pre>
158158
fossil set --global ssl-ca-location /path/to/local-ca.pem
159159
</pre>
160160
161161
The use of <tt>--global</tt> with this option is common, since you may
162
-have multiple reposotories served under certificates signed by that same
162
+have multiple repositories served under certificates signed by that same
163163
CA. However, if you have a mix of publicly-signed and locally-signed
164164
certificates, you might want to drop the <tt>--global</tt> flag and set
165165
this option on a per-repository basis instead.
166166
167167
A common way to run into the broader first problem is that you're on
168168
--- www/ssl.wiki
+++ www/ssl.wiki
@@ -157,11 +157,11 @@
157 <pre>
158 fossil set --global ssl-ca-location /path/to/local-ca.pem
159 </pre>
160
161 The use of <tt>--global</tt> with this option is common, since you may
162 have multiple reposotories served under certificates signed by that same
163 CA. However, if you have a mix of publicly-signed and locally-signed
164 certificates, you might want to drop the <tt>--global</tt> flag and set
165 this option on a per-repository basis instead.
166
167 A common way to run into the broader first problem is that you're on
168
--- www/ssl.wiki
+++ www/ssl.wiki
@@ -157,11 +157,11 @@
157 <pre>
158 fossil set --global ssl-ca-location /path/to/local-ca.pem
159 </pre>
160
161 The use of <tt>--global</tt> with this option is common, since you may
162 have multiple repositories served under certificates signed by that same
163 CA. However, if you have a mix of publicly-signed and locally-signed
164 certificates, you might want to drop the <tt>--global</tt> flag and set
165 this option on a per-repository basis instead.
166
167 A common way to run into the broader first problem is that you're on
168
+1 -1
--- www/sync.wiki
+++ www/sync.wiki
@@ -913,11 +913,11 @@
913913
server knows all artifacts that exist on the client. Also, as with
914914
pull, the client attempts to keep the size of the request from
915915
growing too large by suppressing file cards once the
916916
size of the request reaches 1MB.</p>
917917
918
-<h3>5.3 Sync</h3>
918
+<h3 id="sync">5.3 Sync</h3>
919919
920920
<p>A sync is just a pull and a push that happen at the same time.
921921
The first three steps of a pull are combined with the first five steps
922922
of a push. Steps (4) through (7) of a pull are combined with steps
923923
(5) through (8) of a push. And steps (8) through (10) of a pull
924924
--- www/sync.wiki
+++ www/sync.wiki
@@ -913,11 +913,11 @@
913 server knows all artifacts that exist on the client. Also, as with
914 pull, the client attempts to keep the size of the request from
915 growing too large by suppressing file cards once the
916 size of the request reaches 1MB.</p>
917
918 <h3>5.3 Sync</h3>
919
920 <p>A sync is just a pull and a push that happen at the same time.
921 The first three steps of a pull are combined with the first five steps
922 of a push. Steps (4) through (7) of a pull are combined with steps
923 (5) through (8) of a push. And steps (8) through (10) of a pull
924
--- www/sync.wiki
+++ www/sync.wiki
@@ -913,11 +913,11 @@
913 server knows all artifacts that exist on the client. Also, as with
914 pull, the client attempts to keep the size of the request from
915 growing too large by suppressing file cards once the
916 size of the request reaches 1MB.</p>
917
918 <h3 id="sync">5.3 Sync</h3>
919
920 <p>A sync is just a pull and a push that happen at the same time.
921 The first three steps of a pull are combined with the first five steps
922 of a push. Steps (4) through (7) of a pull are combined with steps
923 (5) through (8) of a push. And steps (8) through (10) of a pull
924
+1 -1
--- www/uitest.html
+++ www/uitest.html
@@ -12,11 +12,11 @@
1212
url: "timeline",
1313
desc:
1414
"Simple timeline of most recent check-ins. Verify that all submenus work."
1515
},
1616
{
17
- url: "timeline?n=125",
17
+ url: "timeline?n1=125",
1818
desc:
1919
"Timeline with 125 entries. Verify that submenus preserve the entry count."
2020
},
2121
{
2222
url: "wiki",
2323
--- www/uitest.html
+++ www/uitest.html
@@ -12,11 +12,11 @@
12 url: "timeline",
13 desc:
14 "Simple timeline of most recent check-ins. Verify that all submenus work."
15 },
16 {
17 url: "timeline?n=125",
18 desc:
19 "Timeline with 125 entries. Verify that submenus preserve the entry count."
20 },
21 {
22 url: "wiki",
23
--- www/uitest.html
+++ www/uitest.html
@@ -12,11 +12,11 @@
12 url: "timeline",
13 desc:
14 "Simple timeline of most recent check-ins. Verify that all submenus work."
15 },
16 {
17 url: "timeline?n1=125",
18 desc:
19 "Timeline with 125 entries. Verify that submenus preserve the entry count."
20 },
21 {
22 url: "wiki",
23
--- www/webpage-ex.md
+++ www/webpage-ex.md
@@ -4,46 +4,50 @@
44
Here are just a few examples of the many web pages supported
55
by Fossil. Follow hyperlinks on the examples below to see many
66
other examples.
77
88
* <a target='_blank' class='exbtn'
9
- href='$ROOT/timeline?y=ci&n=100'>(Example)</a> &rarr;
9
+ href='$ROOT/timeline?y=ci&n1=100'>(Example)</a> &rarr;
1010
100 most recent check-ins.
1111
1212
* <a target='_blank' class='exbtn'
1313
href='$ROOT/finfo?name=src/file.c'>(Example)</a> &rarr;
1414
All changes to the <b>src/file.c</b> source file.
1515
1616
* <a target='_blank' class='exbtn'
17
- href='$ROOT/timeline?n=200&uf=0c3c2d086a'>(Example)</a> &rarr;
17
+ href='$ROOT/timeline?n1=200&uf=0c3c2d086a'>(Example)</a> &rarr;
1818
All check-ins using a particular version of the <b>src/file.c</b>
1919
source file.
2020
2121
* <a target='_blank' class='exbtn'
22
- href='$ROOT/timeline?n=11&y=ci&c=2014-01-01'>(Example)</a> &rarr;
22
+ href='$ROOT/timeline?n1=11&y=ci&c=2014-01-01'>(Example)</a> &rarr;
2323
Check-ins proximate to an historical point in time (2014-01-01).
2424
2525
* <a target='_blank' class='exbtn'
26
- href='$ROOT/timeline?n=11&y=ci&c=2014-01-01&v=1'>(Example)</a> &rarr;
26
+ href='$ROOT/timeline?df=release&y=ci'>(Example)</a> &rarr;
27
+ All check-ins derived from the most recent release.
28
+
29
+ * <a target='_blank' class='exbtn'
30
+ href='$ROOT/timeline?n1=11&y=ci&c=2014-01-01&v=1'>(Example)</a> &rarr;
2731
The previous example augmented with file changes.
2832
2933
* <a target='_blank' class='exbtn'
30
- href='$ROOT/timeline?n=25&y=ci&a=1970-01-01'>(Example)</a> &rarr;
34
+ href='$ROOT/timeline?n1=25&y=ci&a=1970-01-01'>(Example)</a> &rarr;
3135
First 25 check-ins after 1970-01-01. (The first 25 check-ins of
3236
the project.)
3337
3438
* <a target='_blank' class='exbtn'
35
- href='$ROOT/timeline?n=200&r=svn-import'>(Example)</a> &rarr;
39
+ href='$ROOT/timeline?n1=200&r=svn-import'>(Example)</a> &rarr;
3640
All check-ins of the "svn-import" branch together with check-ins
3741
that merge with that branch.
3842
3943
* <a target='_blank' class='exbtn'
40
- href='$ROOT/timeline?n=200&t=svn-import'>(Example)</a> &rarr;
44
+ href='$ROOT/timeline?n1=200&t=svn-import'>(Example)</a> &rarr;
4145
All check-ins of the "svn-import" branch only.
4246
4347
* <a target='_blank' class='exbtn'
44
- href='$ROOT/timeline?n=100&y=ci&ubg'>(Example)</a> &rarr;
48
+ href='$ROOT/timeline?n1=100&y=ci&ubg'>(Example)</a> &rarr;
4549
100 most recent check-ins color coded by committer rather than by branch.
4650
4751
* <a target='_blank' class='exbtn'
4852
href='$ROOT/timeline?from=version-1.27&to=version-1.28'>(Example)</a> &rarr;
4953
All check-ins on the most direct path from
5054
--- www/webpage-ex.md
+++ www/webpage-ex.md
@@ -4,46 +4,50 @@
4 Here are just a few examples of the many web pages supported
5 by Fossil. Follow hyperlinks on the examples below to see many
6 other examples.
7
8 * <a target='_blank' class='exbtn'
9 href='$ROOT/timeline?y=ci&n=100'>(Example)</a> &rarr;
10 100 most recent check-ins.
11
12 * <a target='_blank' class='exbtn'
13 href='$ROOT/finfo?name=src/file.c'>(Example)</a> &rarr;
14 All changes to the <b>src/file.c</b> source file.
15
16 * <a target='_blank' class='exbtn'
17 href='$ROOT/timeline?n=200&uf=0c3c2d086a'>(Example)</a> &rarr;
18 All check-ins using a particular version of the <b>src/file.c</b>
19 source file.
20
21 * <a target='_blank' class='exbtn'
22 href='$ROOT/timeline?n=11&y=ci&c=2014-01-01'>(Example)</a> &rarr;
23 Check-ins proximate to an historical point in time (2014-01-01).
24
25 * <a target='_blank' class='exbtn'
26 href='$ROOT/timeline?n=11&y=ci&c=2014-01-01&v=1'>(Example)</a> &rarr;
 
 
 
 
27 The previous example augmented with file changes.
28
29 * <a target='_blank' class='exbtn'
30 href='$ROOT/timeline?n=25&y=ci&a=1970-01-01'>(Example)</a> &rarr;
31 First 25 check-ins after 1970-01-01. (The first 25 check-ins of
32 the project.)
33
34 * <a target='_blank' class='exbtn'
35 href='$ROOT/timeline?n=200&r=svn-import'>(Example)</a> &rarr;
36 All check-ins of the "svn-import" branch together with check-ins
37 that merge with that branch.
38
39 * <a target='_blank' class='exbtn'
40 href='$ROOT/timeline?n=200&t=svn-import'>(Example)</a> &rarr;
41 All check-ins of the "svn-import" branch only.
42
43 * <a target='_blank' class='exbtn'
44 href='$ROOT/timeline?n=100&y=ci&ubg'>(Example)</a> &rarr;
45 100 most recent check-ins color coded by committer rather than by branch.
46
47 * <a target='_blank' class='exbtn'
48 href='$ROOT/timeline?from=version-1.27&to=version-1.28'>(Example)</a> &rarr;
49 All check-ins on the most direct path from
50
--- www/webpage-ex.md
+++ www/webpage-ex.md
@@ -4,46 +4,50 @@
4 Here are just a few examples of the many web pages supported
5 by Fossil. Follow hyperlinks on the examples below to see many
6 other examples.
7
8 * <a target='_blank' class='exbtn'
9 href='$ROOT/timeline?y=ci&n1=100'>(Example)</a> &rarr;
10 100 most recent check-ins.
11
12 * <a target='_blank' class='exbtn'
13 href='$ROOT/finfo?name=src/file.c'>(Example)</a> &rarr;
14 All changes to the <b>src/file.c</b> source file.
15
16 * <a target='_blank' class='exbtn'
17 href='$ROOT/timeline?n1=200&uf=0c3c2d086a'>(Example)</a> &rarr;
18 All check-ins using a particular version of the <b>src/file.c</b>
19 source file.
20
21 * <a target='_blank' class='exbtn'
22 href='$ROOT/timeline?n1=11&y=ci&c=2014-01-01'>(Example)</a> &rarr;
23 Check-ins proximate to an historical point in time (2014-01-01).
24
25 * <a target='_blank' class='exbtn'
26 href='$ROOT/timeline?df=release&y=ci'>(Example)</a> &rarr;
27 All check-ins derived from the most recent release.
28
29 * <a target='_blank' class='exbtn'
30 href='$ROOT/timeline?n1=11&y=ci&c=2014-01-01&v=1'>(Example)</a> &rarr;
31 The previous example augmented with file changes.
32
33 * <a target='_blank' class='exbtn'
34 href='$ROOT/timeline?n1=25&y=ci&a=1970-01-01'>(Example)</a> &rarr;
35 First 25 check-ins after 1970-01-01. (The first 25 check-ins of
36 the project.)
37
38 * <a target='_blank' class='exbtn'
39 href='$ROOT/timeline?n1=200&r=svn-import'>(Example)</a> &rarr;
40 All check-ins of the "svn-import" branch together with check-ins
41 that merge with that branch.
42
43 * <a target='_blank' class='exbtn'
44 href='$ROOT/timeline?n1=200&t=svn-import'>(Example)</a> &rarr;
45 All check-ins of the "svn-import" branch only.
46
47 * <a target='_blank' class='exbtn'
48 href='$ROOT/timeline?n1=100&y=ci&ubg'>(Example)</a> &rarr;
49 100 most recent check-ins color coded by committer rather than by branch.
50
51 * <a target='_blank' class='exbtn'
52 href='$ROOT/timeline?from=version-1.27&to=version-1.28'>(Example)</a> &rarr;
53 All check-ins on the most direct path from
54
+12 -2
--- www/webui.wiki
+++ www/webui.wiki
@@ -7,10 +7,11 @@
77
* [./bugtheory.wiki | Ticketing and bug tracking]
88
* [./wikitheory.wiki | Wiki]
99
* [./embeddeddoc.wiki | On-line documentation]
1010
* [./event.wiki | Technical notes]
1111
* [./forum.wiki | Forum]
12
+ * [./chat.md | Chatroom]
1213
* Timelines
1314
* Full text search over all of the above
1415
* Status information
1516
* Graphs of revision and branching history
1617
* File and version lists and differences
@@ -100,11 +101,11 @@
100101
changes from your co-workers the next time your repository is synchronized.
101102
102103
You can view and edit <b>wiki</b> by following the "Wiki" link on the
103104
menu bar. Fossil has its own easy-to-remember
104105
[/wiki_rules | markup rules], or if you prefer, it also
105
-support [/md_rules | Markdown]. And, as with tickets, all of
106
+supports [/md_rules | Markdown]. And, as with tickets, all of
106107
your edits will automatically merge with those of your co-workers when
107108
your repository synchronizes.
108109
109110
You can view summary reports of <b>branches</b> in the
110111
check-in graph by visiting the "Branches" link on the
@@ -130,11 +131,20 @@
130131
interface. Templates
131132
for the header and footer of each page can be edited, as can the CSS
132133
for the entire page. You can even change around the main menu.
133134
Timeline display preferences can be edited. The page that is brought
134135
up as the "Home" page can be changed. It is often useful to set the
135
-"Home" page to be a wiki page or an embedded document.
136
+"Home" page to be a wiki page or an embedded document. The built-in
137
+pages <b>/home</b> and <b>/index</b> can be used as the "Home" page.
138
+They have identical effect, which is to instruct Fossil to find and
139
+display a wiki page with the same name as the project, or if that
140
+does not exist, <b>/README.md</b> or <b>/index.wiki</b>.
141
+
142
+An embedded document link such as <b>doc/trunk/README.md</b> can be
143
+used for the "Home" page. If you specify one of the built-in keywords
144
+<b>/home</b> or <b>/index</b>, the page will not be treated as an
145
+embedded document.
136146
137147
<h2>Installing On A Network Server</h2>
138148
139149
When you create a new Fossil project and after you have configured it
140150
like you want it using the web interface, you can make the project
141151
--- www/webui.wiki
+++ www/webui.wiki
@@ -7,10 +7,11 @@
7 * [./bugtheory.wiki | Ticketing and bug tracking]
8 * [./wikitheory.wiki | Wiki]
9 * [./embeddeddoc.wiki | On-line documentation]
10 * [./event.wiki | Technical notes]
11 * [./forum.wiki | Forum]
 
12 * Timelines
13 * Full text search over all of the above
14 * Status information
15 * Graphs of revision and branching history
16 * File and version lists and differences
@@ -100,11 +101,11 @@
100 changes from your co-workers the next time your repository is synchronized.
101
102 You can view and edit <b>wiki</b> by following the "Wiki" link on the
103 menu bar. Fossil has its own easy-to-remember
104 [/wiki_rules | markup rules], or if you prefer, it also
105 support [/md_rules | Markdown]. And, as with tickets, all of
106 your edits will automatically merge with those of your co-workers when
107 your repository synchronizes.
108
109 You can view summary reports of <b>branches</b> in the
110 check-in graph by visiting the "Branches" link on the
@@ -130,11 +131,20 @@
130 interface. Templates
131 for the header and footer of each page can be edited, as can the CSS
132 for the entire page. You can even change around the main menu.
133 Timeline display preferences can be edited. The page that is brought
134 up as the "Home" page can be changed. It is often useful to set the
135 "Home" page to be a wiki page or an embedded document.
 
 
 
 
 
 
 
 
 
136
137 <h2>Installing On A Network Server</h2>
138
139 When you create a new Fossil project and after you have configured it
140 like you want it using the web interface, you can make the project
141
--- www/webui.wiki
+++ www/webui.wiki
@@ -7,10 +7,11 @@
7 * [./bugtheory.wiki | Ticketing and bug tracking]
8 * [./wikitheory.wiki | Wiki]
9 * [./embeddeddoc.wiki | On-line documentation]
10 * [./event.wiki | Technical notes]
11 * [./forum.wiki | Forum]
12 * [./chat.md | Chatroom]
13 * Timelines
14 * Full text search over all of the above
15 * Status information
16 * Graphs of revision and branching history
17 * File and version lists and differences
@@ -100,11 +101,11 @@
101 changes from your co-workers the next time your repository is synchronized.
102
103 You can view and edit <b>wiki</b> by following the "Wiki" link on the
104 menu bar. Fossil has its own easy-to-remember
105 [/wiki_rules | markup rules], or if you prefer, it also
106 supports [/md_rules | Markdown]. And, as with tickets, all of
107 your edits will automatically merge with those of your co-workers when
108 your repository synchronizes.
109
110 You can view summary reports of <b>branches</b> in the
111 check-in graph by visiting the "Branches" link on the
@@ -130,11 +131,20 @@
131 interface. Templates
132 for the header and footer of each page can be edited, as can the CSS
133 for the entire page. You can even change around the main menu.
134 Timeline display preferences can be edited. The page that is brought
135 up as the "Home" page can be changed. It is often useful to set the
136 "Home" page to be a wiki page or an embedded document. The built-in
137 pages <b>/home</b> and <b>/index</b> can be used as the "Home" page.
138 They have identical effect, which is to instruct Fossil to find and
139 display a wiki page with the same name as the project, or if that
140 does not exist, <b>/README.md</b> or <b>/index.wiki</b>.
141
142 An embedded document link such as <b>doc/trunk/README.md</b> can be
143 used for the "Home" page. If you specify one of the built-in keywords
144 <b>/home</b> or <b>/index</b>, the page will not be treated as an
145 embedded document.
146
147 <h2>Installing On A Network Server</h2>
148
149 When you create a new Fossil project and after you have configured it
150 like you want it using the web interface, you can make the project
151
+253 -245
--- www/whyusefossil.wiki
+++ www/whyusefossil.wiki
@@ -2,12 +2,11 @@
22
<h1 align='center'>Why You Should Use Fossil</h1>
33
<p align='center'><b>Or, if not Fossil, at least some kind of modern
44
version control<br>such as Git, Mercurial, or Subversion.</b></p>
55
<p align='center'>(Presented in outline form, for people in a hurry)</p>
66
7
-<ol>
8
-<li><p><b>Benefits of Version Control</b>
7
+<b>I. Benefits of Version Control</b>
98
<ol type='A'>
109
<li><p><b>Immutable file and version identification</b>
1110
<ol type='i'>
1211
<li>Simplified and unambiguous communication between developers
1312
<li>Detect accidental or surreptitious changes
@@ -37,249 +36,258 @@
3736
<li>Failed disk-drives cause no loss of work
3837
<li>Avoid wasting time doing manual file copying
3938
<li>Avoid human errors during manual backups
4039
</ol>
4140
</ol>
42
-<a name='definitions'></a>
43
-<li><p><b>Definitions</b></p>
44
- <ul>
45
- <li><p><b>Project</b> &rarr;
46
- a collection of computer files that serve some common
47
- purpose. Often the project is a software application and the
48
- individual files are source code together with makefiles, scripts, and
49
- "README.txt" files. Other examples of projects include books or
50
- manuals in which each chapter or section is held in a separate file.
51
- <ul>
52
- <li><p>Projects change and evolve. The whole purpose of version
53
- control is to track and manage that evolution.
54
- <li><p>Most projects contain many files, but it is possible
55
- to have a project consisting of just a single file.
56
- <li><p>Fossil requires that
57
- all the files for a project must be collected into a single
58
- directory hierarchy - a single folder possibly with layers
59
- of subfolders. Fossil is not a good choice for managing a
60
- project that has files scattered hither and yon all over
61
- the disk. In other words, Fossil only works for projects
62
- where the files are laid out such that they can be archived
63
- into a ZIP file or tarball.
64
- </ul>
65
- <li><p><b>Repository</b> &rarr;
66
- (also called "repo") a single file that contains
67
- all historical versions of all files in a project. A repo is similar
68
- to a ZIP archive in that it is a single file that stores compressed
69
- versions of many other files. Files can be extracted from the
70
- repo and new files can be added to the repo, just as with a ZIP
71
- archive. But a repo has other capabilities above and beyond
72
- what a ZIP archive can do.
73
- <ul>
74
- <li><p>Fossil does not care what you name your repository files,
75
- though names ending with ".fossil" are recommended.
76
- <li><p>A single project typically has multiple, redundant repositories on
77
- separate machines.
78
- <li><p>All repositories stay synchronized with one another by exchanging
79
- information via HTTP or SSH.
80
- <li><p>All repos for a single project redundantly store all information
81
- about that project. So if any one repo is lost due to a disk
82
- crash, all content is preserved in the surviving repos.
83
- <li><p>The usual arrangement is one repository per user. And since
84
- most users these days have their own computer, that means one
85
- repository per computer. But this is not a requirement. It is
86
- ok to have multiple copies of the same repository on the same
87
- computer.
88
- <li><p>Fossil works fine with just a single copy of the repository.
89
- But in that case there is no redundancy. If that one repository
90
- file is lost due to a hardware malfunction, then there is no way
91
- to recover the project.
92
- <li><p>Best practice is to keep all repositories for a user in a single
93
- folder. Folders such as "~/Fossils" or "%USERPROFILE%\Fossils"
94
- are recommended. Fossil itself does not care where the repositories
95
- are stored. Nor does Fossil require repositories to be
96
- kept in the same folder. But it is easier to organize your work
97
- if all repositories are kept in the same place.
98
- </ul>
99
- <li><p><b>Check-out</b> &rarr;
100
- a set of files that have been extracted from a
101
- repository and that represent a particular version or snapshot of
102
- the project.
103
- <ul>
104
- <li><p>Check-outs must be on the same computer as the repository from
105
- which they are extracted. This is just like with a ZIP archive:
106
- one must have the ZIP archive file on the local machine before
107
- extracting files from ZIP archive.
108
- <li><p>There can be multiple check-outs (in different folders) from
109
- the same repository.
110
- <li><p>The repository must be on the same computer as the check-out, but
111
- the relative locations of the repo and the check-out are arbitrary.
112
- The repository may be located inside the folder holding the
113
- check-out, but it certainly does not have to be and usually is
114
- not.
115
- <li><p>A special file exists in every check-out that tells Fossil from
116
- which repository the check-out was extracted, and which version of
117
- the project the check-out represents. This is the ".fslckout" file
118
- on unix systems or the "_FOSSIL_" file on Windows.
119
- </ul>
120
- <li><p><b>Check-in</b> &rarr;
121
- another name for a particular version of the project.
122
- A check-in is a collection of files inside of a repository that
123
- represent a snapshot of the project for an instant in time.
124
- Check-ins exist only inside of the repository. This contrasts with
125
- a check-out which is a collection of files outside of the repository.
126
- <ul>
127
- <li><p>Every check-out knows the check-in from which it was derived.
128
- But check-outs might have been edited and so might not exactly
129
- match their associated check-in.
130
- <li><p>Check-ins are immutable. They can never be changed. But
131
- check-outs are collections of ordinary files on disk. The
132
- files of a check-out can be edited just like any other file.
133
- <li><p>A check-in can be thought of as an historical snapshot of a
134
- check-out.
135
- <li><p>"Check-in", "version", "snapshot", and "revision" are synonyms.
136
- <li><p> When used as a noun, the word "commit" is another synonym
137
- for "check-in". When used as a verb, the word "commit"
138
- means to create a new check-in.
139
- </ul>
140
- </ul>
141
-<li><p><b>Basic Fossil commands</b>
142
- <ul>
143
- <li><p><b>clone</b> &rarr;
144
- Make a copy of a repository. The original repository
145
- is usually (but not always) on a remote machine and the copy is on
146
- the local machine. The copy remembers the network location from
147
- which it was copied and (by default) tries to keep itself synchronized
148
- with the original.
149
- <li><p><b>open</b> &rarr;
150
- Create a new check-out from a repository on the local machine.
151
- <li><p><b>update</b> &rarr;
152
- Modify an existing check-out so that it is derived from a
153
- different version of the same project.
154
- <li><p><b>commit</b> &rarr;
155
- Create a new version (a new check-in) of the project that
156
- is a snapshot of the current check-out.
157
- <li><p><b>revert</b> &rarr;
158
- Undo all local edits on a check-out. Make the check-out
159
- be an exact copy of its associated check-in.
160
- <li><p><b>push</b> &rarr;
161
- Copy content found in a local repository over to a remote
162
- repository. (Fossil usually does this automatically in response to
163
- a "commit" and so this command is seldom used, but it is important
164
- to understand it.)
165
- <li><p><b>pull</b> &rarr;
166
- Copy new content found in a remote repository into a local
167
- repository. A "pull" by itself does not modify any check-out. The
168
- "pull" command only moves content between repositories. However,
169
- the "update" command will (often) automatically do a "pull" before
170
- attempting to update the local check-out.
171
- <li><p><b>sync</b> &rarr;
172
- Do both a "push" and a "pull" at the same time.
173
- <li><p><b>add</b> &rarr;
174
- Add a new file to the local check-out. The file must already be
175
- on disk. This command tells Fossil to start tracking and managing
176
- the file. This command affects only the local check-out and does
177
- not modify any repository. The new file is inserted into the
178
- repository at the next "commit" command.
179
- <li><p><b>rm/mv</b> &rarr;
180
- Short for 'remove' and 'move', these commands are like "add"
181
- in that they specify pending changes to the structure of the check-out.
182
- As with "add", no changes are made to the repository until the next
183
- "commit".
184
- </ul>
185
-<li><p><b>The history of a project is a Directed Acyclic Graph (DAG)</b>
186
- <ul>
187
- <li><p>Fossil (and other distributed VCSes like Git and Mercurial, but
188
- not Subversion) represent
189
- the history of a project as a directed acyclic graph (DAG).
190
- <ul>
191
- <li><p>Each check-in is a node in the graph
192
- <li><p>If check-in Y is derived from check-in X then there is
193
- an arc in the graph from node X to node Y.
194
- <li><p>The older check-in (X) is call the "parent" and the newer
195
- check-in (Y) is the "child". The child is derived from
196
- the parent.
197
- </ul>
198
- <li><p>Two users (or the same user working in different check-outs)
199
- might commit different changes against the same check-in. This
200
- results in one parent node having two or more children.
201
- <li><p>Command: <b>merge</b> &rarr;
202
- combines the work of multiple check-ins into
203
- a single check-out. That check-out can then be committed to create
204
- a new check-in that has two (or more) parents.
205
- <ul>
206
- <li><p>Most check-ins have just one parent, and either zero or
207
- one child.
208
- <li><p>When a check-in has two or more parents, one of those parents
209
- is the "primary parent". All the other parent nodes are "secondary"
210
- or "merge" parents.
211
- Conceptually, the primary parent shows the main line of
212
- development. Content from the merge parents is added
213
- into the main line.
214
- <li><p>The "direct children" of a check-in X are all children that
215
- have X as their primary parent.
216
- <li><p>A check-in node with no direct children is sometimes called
217
- a "leaf".
218
- <li><p>The "merge" command changes only the check-out.
219
- The "commit" command must be run subsequently to make the merge
220
- a permanent part of project.
221
- </ul>
222
- <li><p>Definition: <b>branch</b> &rarr;
223
- a sequence of check-ins that are all linked
224
- together in the DAG through the primary parent.
225
- <ul>
226
- <li><p>Branches are often given names which propagate to direct children.
227
- The tradition in Fossil is to call the main branch "trunk". In
228
- Git, the main branch is usually called "master".
229
- <li><p>It is possible to have multiple branches with the same name.
230
- Fossil has no problem with this, but it can be confusing to
231
- humans, so best practice is to give each branch a unique name.
232
- <li><p>The name of a branch can be changed by adding special tags
233
- to the first check-in of a branch. The name assigned by this
234
- special tag automatically propagates to all direct children.
235
- </ul>
236
- </ul>
237
-<li><p><b>Why version control is important (reprise)</b>
238
- <ol type="A">
239
- <li><p>Every check-in and every individual file has a unique name - its
240
- SHA1 or SHA3-256 hash. Team members can unambiguously identify
241
- any specific
242
- version of the overall project or any specific version of an
243
- individual file.
244
- <li><p>Any historical version of the whole project or of any individual
245
- file can be easily recreated at any time and by any team member.
246
- <li><p>Accidental changes to files can be detected by recomputing their
247
- cryptographic hash.
248
- <li><p>Files of unknown origin can be identified using their hash.
249
- <li><p>Developers are able to work in parallel, review each others work,
250
- and easily merge their changes together. External revisions to
251
- the baseline can be easily incorporated into the latest changes.
252
- <li><p>Developers can follow experimental lines of development, then
253
- revert back to an earlier stable version if the experiment does
254
- not work out. Creativity is enhanced by allowing crazy ideas to
255
- be investigated without destabilizing the project.
256
- <li><p>Developers can work on several independent subprojects, flipping
257
- back and forth from one subproject to another at will, and merge
258
- patches together or back into the main line of development as they
259
- mature.
260
- <li><p>Older changes can be easily backed out of recent revisions, for
261
- example if bugs are found long after the code was committed.
262
- <li><p>Enhancements in a branch can be easily copied into other branches,
263
- or into the trunk.
264
- <li><p>The complete history of all changes is plainly visible to
265
- all team members. Project leaders can easily keep track of what
266
- all team members are doing. Check-in comments help everyone to
267
- understand and/or remember the reason for each change.
268
- <li><p>New team members can be brought up-to-date with all of the historical
269
- code, quickly and easily.
270
- <li><p>New developers, interns, or inexperienced staff members who still
271
- do not understand all the details of the project or who are otherwise
272
- prone to making mistakes can be assigned significant subprojects to
273
- be carried out in branches without risking main line stability.
274
- <li><p>Code is automatically synchronized across all machines. No human
275
- effort is wasted copying files from machine to machine. The risk
276
- of human errors during file transfer and backup is eliminated.
277
- <li><p>A hardware failure results in minimal lost work because
278
- all previously committed changes will have been automatically
279
- replicated on other machines.
280
- <li><p>The complete work history of the project is conveniently archived
281
- in a single file, simplifying long-term record keeping.
282
- <li><p>A precise historical record is maintained which can be used to
283
- support copyright and patent claims or regulatory compliance.
284
- </ol>
41
+
42
+<a name='definitions'></a>
43
+<p><b>II. Definitions</b></p>
44
+
45
+<ul>
46
+<li><p><b>Project</b> &rarr;
47
+ a collection of computer files that serve some common
48
+ purpose. Often the project is a software application and the
49
+ individual files are source code together with makefiles, scripts, and
50
+ "README.txt" files. Other examples of projects include books or
51
+ manuals in which each chapter or section is held in a separate file.
52
+ <ul>
53
+ <li><p>Projects change and evolve. The whole purpose of version
54
+ control is to track and manage that evolution.
55
+ <li><p>Most projects contain many files, but it is possible
56
+ to have a project consisting of just a single file.
57
+ <li><p>Fossil requires that
58
+ all the files for a project must be collected into a single
59
+ directory hierarchy - a single folder possibly with layers
60
+ of subfolders. Fossil is not a good choice for managing a
61
+ project that has files scattered hither and yon all over
62
+ the disk. In other words, Fossil only works for projects
63
+ where the files are laid out such that they can be archived
64
+ into a ZIP file or tarball.
65
+ </ul>
66
+<li><p><b>Repository</b> &rarr;
67
+ (also called "repo") a single file that contains
68
+ all historical versions of all files in a project. A repo is similar
69
+ to a ZIP archive in that it is a single file that stores compressed
70
+ versions of many other files. Files can be extracted from the
71
+ repo and new files can be added to the repo, just as with a ZIP
72
+ archive. But a repo has other capabilities above and beyond
73
+ what a ZIP archive can do.
74
+ <ul>
75
+ <li><p>Fossil does not care what you name your repository files,
76
+ though names ending with ".fossil" are recommended.
77
+ <li><p>A single project typically has multiple, redundant repositories on
78
+ separate machines.
79
+ <li><p>All repositories stay synchronized with one another by exchanging
80
+ information via HTTP or SSH.
81
+ <li><p>All repos for a single project redundantly store all information
82
+ about that project. So if any one repo is lost due to a disk
83
+ crash, all content is preserved in the surviving repos.
84
+ <li><p>The usual arrangement is one repository per user. And since
85
+ most users these days have their own computer, that means one
86
+ repository per computer. But this is not a requirement. It is
87
+ ok to have multiple copies of the same repository on the same
88
+ computer.
89
+ <li><p>Fossil works fine with just a single copy of the repository.
90
+ But in that case there is no redundancy. If that one repository
91
+ file is lost due to a hardware malfunction, then there is no way
92
+ to recover the project.
93
+ <li><p>Best practice is to keep all repositories for a user in a single
94
+ folder. Folders such as "~/Fossils" or "%USERPROFILE%\Fossils"
95
+ are recommended. Fossil itself does not care where the repositories
96
+ are stored. Nor does Fossil require repositories to be
97
+ kept in the same folder. But it is easier to organize your work
98
+ if all repositories are kept in the same place.
99
+ </ul>
100
+<li><p><b>Check-out</b> &rarr;
101
+ a set of files that have been extracted from a
102
+ repository and that represent a particular version or snapshot of
103
+ the project.
104
+ <ul>
105
+ <li><p>Check-outs must be on the same computer as the repository from
106
+ which they are extracted. This is just like with a ZIP archive:
107
+ one must have the ZIP archive file on the local machine before
108
+ extracting files from ZIP archive.
109
+ <li><p>There can be multiple check-outs (in different folders) from
110
+ the same repository.
111
+ <li><p>The repository must be on the same computer as the check-out, but
112
+ the relative locations of the repo and the check-out are arbitrary.
113
+ The repository may be located inside the folder holding the
114
+ check-out, but it certainly does not have to be and usually is
115
+ not.
116
+ <li><p>A special file exists in every check-out that tells Fossil from
117
+ which repository the check-out was extracted, and which version of
118
+ the project the check-out represents. This is the ".fslckout" file
119
+ on unix systems or the "_FOSSIL_" file on Windows.
120
+ </ul>
121
+<li><p><b>Check-in</b> &rarr;
122
+ another name for a particular version of the project.
123
+ A check-in is a collection of files inside of a repository that
124
+ represent a snapshot of the project for an instant in time.
125
+ Check-ins exist only inside of the repository. This contrasts with
126
+ a check-out which is a collection of files outside of the repository.
127
+ <ul>
128
+ <li><p>Every check-out knows the check-in from which it was derived.
129
+ But check-outs might have been edited and so might not exactly
130
+ match their associated check-in.
131
+ <li><p>Check-ins are immutable. They can never be changed. But
132
+ check-outs are collections of ordinary files on disk. The
133
+ files of a check-out can be edited just like any other file.
134
+ <li><p>A check-in can be thought of as an historical snapshot of a
135
+ check-out.
136
+ <li><p>"Check-in", "version", "snapshot", and "revision" are synonyms.
137
+ <li><p> When used as a noun, the word "commit" is another synonym
138
+ for "check-in". When used as a verb, the word "commit"
139
+ means to create a new check-in.
140
+ </ul>
141
+</ul>
142
+
143
+<p><b>III. Basic Fossil commands</b>
144
+
145
+ <ul>
146
+ <li><p><b>clone</b> &rarr;
147
+ Make a copy of a repository. The original repository
148
+ is usually (but not always) on a remote machine and the copy is on
149
+ the local machine. The copy remembers the network location from
150
+ which it was copied and (by default) tries to keep itself synchronized
151
+ with the original.
152
+ <li><p><b>open</b> &rarr;
153
+ Create a new check-out from a repository on the local machine.
154
+ <li><p><b>update</b> &rarr;
155
+ Modify an existing check-out so that it is derived from a
156
+ different version of the same project.
157
+ <li><p><b>commit</b> &rarr;
158
+ Create a new version (a new check-in) of the project that
159
+ is a snapshot of the current check-out.
160
+ <li><p><b>revert</b> &rarr;
161
+ Undo all local edits on a check-out. Make the check-out
162
+ be an exact copy of its associated check-in.
163
+ <li><p><b>push</b> &rarr;
164
+ Copy content found in a local repository over to a remote
165
+ repository. (Fossil usually does this automatically in response to
166
+ a "commit" and so this command is seldom used, but it is important
167
+ to understand it.)
168
+ <li><p><b>pull</b> &rarr;
169
+ Copy new content found in a remote repository into a local
170
+ repository. A "pull" by itself does not modify any check-out. The
171
+ "pull" command only moves content between repositories. However,
172
+ the "update" command will (often) automatically do a "pull" before
173
+ attempting to update the local check-out.
174
+ <li><p><b>sync</b> &rarr;
175
+ Do both a "push" and a "pull" at the same time.
176
+ <li><p><b>add</b> &rarr;
177
+ Add a new file to the local check-out. The file must already be
178
+ on disk. This command tells Fossil to start tracking and managing
179
+ the file. This command affects only the local check-out and does
180
+ not modify any repository. The new file is inserted into the
181
+ repository at the next "commit" command.
182
+ <li><p><b>rm/mv</b> &rarr;
183
+ Short for 'remove' and 'move', these commands are like "add"
184
+ in that they specify pending changes to the structure of the check-out.
185
+ As with "add", no changes are made to the repository until the next
186
+ "commit".
187
+ </ul>
188
+
189
+<b>IV. The history of a project is a Directed Acyclic Graph (DAG)</b>
190
+
191
+ <ul>
192
+ <li><p>Fossil (and other distributed VCSes like Git and Mercurial, but
193
+ not Subversion) represent
194
+ the history of a project as a directed acyclic graph (DAG).
195
+ <ul>
196
+ <li><p>Each check-in is a node in the graph
197
+ <li><p>If check-in Y is derived from check-in X then there is
198
+ an arc in the graph from node X to node Y.
199
+ <li><p>The older check-in (X) is call the "parent" and the newer
200
+ check-in (Y) is the "child". The child is derived from
201
+ the parent.
202
+ </ul>
203
+ <li><p>Two users (or the same user working in different check-outs)
204
+ might commit different changes against the same check-in. This
205
+ results in one parent node having two or more children.
206
+ <li><p>Command: <b>merge</b> &rarr;
207
+ combines the work of multiple check-ins into
208
+ a single check-out. That check-out can then be committed to create
209
+ a new check-in that has two (or more) parents.
210
+ <ul>
211
+ <li><p>Most check-ins have just one parent, and either zero or
212
+ one child.
213
+ <li><p>When a check-in has two or more parents, one of those parents
214
+ is the "primary parent". All the other parent nodes are "secondary"
215
+ or "merge" parents.
216
+ Conceptually, the primary parent shows the main line of
217
+ development. Content from the merge parents is added
218
+ into the main line.
219
+ <li><p>The "direct children" of a check-in X are all children that
220
+ have X as their primary parent.
221
+ <li><p>A check-in node with no direct children is sometimes called
222
+ a "leaf".
223
+ <li><p>The "merge" command changes only the check-out.
224
+ The "commit" command must be run subsequently to make the merge
225
+ a permanent part of project.
226
+ </ul>
227
+ <li><p>Definition: <b>branch</b> &rarr;
228
+ a sequence of check-ins that are all linked
229
+ together in the DAG through the primary parent.
230
+ <ul>
231
+ <li><p>Branches are often given names which propagate to direct children.
232
+ The tradition in Fossil is to call the main branch "trunk". In
233
+ Git, it's called "master" by default, though some call it
234
+ something else, like "main".
235
+ <li><p>It is possible to have multiple branches with the same name.
236
+ Fossil has no problem with this, but it can be confusing to
237
+ humans, so best practice is to give each branch a unique name.
238
+ <li><p>The name of a branch can be changed by adding special tags
239
+ to the first check-in of a branch. The name assigned by this
240
+ special tag automatically propagates to all direct children.
241
+ </ul>
242
+ </ul>
243
+
244
+<b>V. Why version control is important (reprise)</b>
245
+
246
+ <ol>
247
+ <li><p>Every check-in and every individual file has a unique name - its
248
+ SHA1 or SHA3-256 hash. Team members can unambiguously identify
249
+ any specific
250
+ version of the overall project or any specific version of an
251
+ individual file.
252
+ <li><p>Any historical version of the whole project or of any individual
253
+ file can be easily recreated at any time and by any team member.
254
+ <li><p>Accidental changes to files can be detected by recomputing their
255
+ cryptographic hash.
256
+ <li><p>Files of unknown origin can be identified using their hash.
257
+ <li><p>Developers are able to work in parallel, review each others work,
258
+ and easily merge their changes together. External revisions to
259
+ the baseline can be easily incorporated into the latest changes.
260
+ <li><p>Developers can follow experimental lines of development, then
261
+ revert back to an earlier stable version if the experiment does
262
+ not work out. Creativity is enhanced by allowing crazy ideas to
263
+ be investigated without destabilizing the project.
264
+ <li><p>Developers can work on several independent subprojects, flipping
265
+ back and forth from one subproject to another at will, and merge
266
+ patches together or back into the main line of development as they
267
+ mature.
268
+ <li><p>Older changes can be easily backed out of recent revisions, for
269
+ example if bugs are found long after the code was committed.
270
+ <li><p>Enhancements in a branch can be easily copied into other branches,
271
+ or into the trunk.
272
+ <li><p>The complete history of all changes is plainly visible to
273
+ all team members. Project leaders can easily keep track of what
274
+ all team members are doing. Check-in comments help everyone to
275
+ understand and/or remember the reason for each change.
276
+ <li><p>New team members can be brought up-to-date with all of the historical
277
+ code, quickly and easily.
278
+ <li><p>New developers, interns, or inexperienced staff members who still
279
+ do not understand all the details of the project or who are otherwise
280
+ prone to making mistakes can be assigned significant subprojects to
281
+ be carried out in branches without risking main line stability.
282
+ <li><p>Code is automatically synchronized across all machines. No human
283
+ effort is wasted copying files from machine to machine. The risk
284
+ of human errors during file transfer and backup is eliminated.
285
+ <li><p>A hardware failure results in minimal lost work because
286
+ all previously committed changes will have been automatically
287
+ replicated on other machines.
288
+ <li><p>The complete work history of the project is conveniently archived
289
+ in a single file, simplifying long-term record keeping.
290
+ <li><p>A precise historical record is maintained which can be used to
291
+ support copyright and patent claims or regulatory compliance.
292
+ </ol>
285293
</ol>
286294
--- www/whyusefossil.wiki
+++ www/whyusefossil.wiki
@@ -2,12 +2,11 @@
2 <h1 align='center'>Why You Should Use Fossil</h1>
3 <p align='center'><b>Or, if not Fossil, at least some kind of modern
4 version control<br>such as Git, Mercurial, or Subversion.</b></p>
5 <p align='center'>(Presented in outline form, for people in a hurry)</p>
6
7 <ol>
8 <li><p><b>Benefits of Version Control</b>
9 <ol type='A'>
10 <li><p><b>Immutable file and version identification</b>
11 <ol type='i'>
12 <li>Simplified and unambiguous communication between developers
13 <li>Detect accidental or surreptitious changes
@@ -37,249 +36,258 @@
37 <li>Failed disk-drives cause no loss of work
38 <li>Avoid wasting time doing manual file copying
39 <li>Avoid human errors during manual backups
40 </ol>
41 </ol>
42 <a name='definitions'></a>
43 <li><p><b>Definitions</b></p>
44 <ul>
45 <li><p><b>Project</b> &rarr;
46 a collection of computer files that serve some common
47 purpose. Often the project is a software application and the
48 individual files are source code together with makefiles, scripts, and
49 "README.txt" files. Other examples of projects include books or
50 manuals in which each chapter or section is held in a separate file.
51 <ul>
52 <li><p>Projects change and evolve. The whole purpose of version
53 control is to track and manage that evolution.
54 <li><p>Most projects contain many files, but it is possible
55 to have a project consisting of just a single file.
56 <li><p>Fossil requires that
57 all the files for a project must be collected into a single
58 directory hierarchy - a single folder possibly with layers
59 of subfolders. Fossil is not a good choice for managing a
60 project that has files scattered hither and yon all over
61 the disk. In other words, Fossil only works for projects
62 where the files are laid out such that they can be archived
63 into a ZIP file or tarball.
64 </ul>
65 <li><p><b>Repository</b> &rarr;
66 (also called "repo") a single file that contains
67 all historical versions of all files in a project. A repo is similar
68 to a ZIP archive in that it is a single file that stores compressed
69 versions of many other files. Files can be extracted from the
70 repo and new files can be added to the repo, just as with a ZIP
71 archive. But a repo has other capabilities above and beyond
72 what a ZIP archive can do.
73 <ul>
74 <li><p>Fossil does not care what you name your repository files,
75 though names ending with ".fossil" are recommended.
76 <li><p>A single project typically has multiple, redundant repositories on
77 separate machines.
78 <li><p>All repositories stay synchronized with one another by exchanging
79 information via HTTP or SSH.
80 <li><p>All repos for a single project redundantly store all information
81 about that project. So if any one repo is lost due to a disk
82 crash, all content is preserved in the surviving repos.
83 <li><p>The usual arrangement is one repository per user. And since
84 most users these days have their own computer, that means one
85 repository per computer. But this is not a requirement. It is
86 ok to have multiple copies of the same repository on the same
87 computer.
88 <li><p>Fossil works fine with just a single copy of the repository.
89 But in that case there is no redundancy. If that one repository
90 file is lost due to a hardware malfunction, then there is no way
91 to recover the project.
92 <li><p>Best practice is to keep all repositories for a user in a single
93 folder. Folders such as "~/Fossils" or "%USERPROFILE%\Fossils"
94 are recommended. Fossil itself does not care where the repositories
95 are stored. Nor does Fossil require repositories to be
96 kept in the same folder. But it is easier to organize your work
97 if all repositories are kept in the same place.
98 </ul>
99 <li><p><b>Check-out</b> &rarr;
100 a set of files that have been extracted from a
101 repository and that represent a particular version or snapshot of
102 the project.
103 <ul>
104 <li><p>Check-outs must be on the same computer as the repository from
105 which they are extracted. This is just like with a ZIP archive:
106 one must have the ZIP archive file on the local machine before
107 extracting files from ZIP archive.
108 <li><p>There can be multiple check-outs (in different folders) from
109 the same repository.
110 <li><p>The repository must be on the same computer as the check-out, but
111 the relative locations of the repo and the check-out are arbitrary.
112 The repository may be located inside the folder holding the
113 check-out, but it certainly does not have to be and usually is
114 not.
115 <li><p>A special file exists in every check-out that tells Fossil from
116 which repository the check-out was extracted, and which version of
117 the project the check-out represents. This is the ".fslckout" file
118 on unix systems or the "_FOSSIL_" file on Windows.
119 </ul>
120 <li><p><b>Check-in</b> &rarr;
121 another name for a particular version of the project.
122 A check-in is a collection of files inside of a repository that
123 represent a snapshot of the project for an instant in time.
124 Check-ins exist only inside of the repository. This contrasts with
125 a check-out which is a collection of files outside of the repository.
126 <ul>
127 <li><p>Every check-out knows the check-in from which it was derived.
128 But check-outs might have been edited and so might not exactly
129 match their associated check-in.
130 <li><p>Check-ins are immutable. They can never be changed. But
131 check-outs are collections of ordinary files on disk. The
132 files of a check-out can be edited just like any other file.
133 <li><p>A check-in can be thought of as an historical snapshot of a
134 check-out.
135 <li><p>"Check-in", "version", "snapshot", and "revision" are synonyms.
136 <li><p> When used as a noun, the word "commit" is another synonym
137 for "check-in". When used as a verb, the word "commit"
138 means to create a new check-in.
139 </ul>
140 </ul>
141 <li><p><b>Basic Fossil commands</b>
142 <ul>
143 <li><p><b>clone</b> &rarr;
144 Make a copy of a repository. The original repository
145 is usually (but not always) on a remote machine and the copy is on
146 the local machine. The copy remembers the network location from
147 which it was copied and (by default) tries to keep itself synchronized
148 with the original.
149 <li><p><b>open</b> &rarr;
150 Create a new check-out from a repository on the local machine.
151 <li><p><b>update</b> &rarr;
152 Modify an existing check-out so that it is derived from a
153 different version of the same project.
154 <li><p><b>commit</b> &rarr;
155 Create a new version (a new check-in) of the project that
156 is a snapshot of the current check-out.
157 <li><p><b>revert</b> &rarr;
158 Undo all local edits on a check-out. Make the check-out
159 be an exact copy of its associated check-in.
160 <li><p><b>push</b> &rarr;
161 Copy content found in a local repository over to a remote
162 repository. (Fossil usually does this automatically in response to
163 a "commit" and so this command is seldom used, but it is important
164 to understand it.)
165 <li><p><b>pull</b> &rarr;
166 Copy new content found in a remote repository into a local
167 repository. A "pull" by itself does not modify any check-out. The
168 "pull" command only moves content between repositories. However,
169 the "update" command will (often) automatically do a "pull" before
170 attempting to update the local check-out.
171 <li><p><b>sync</b> &rarr;
172 Do both a "push" and a "pull" at the same time.
173 <li><p><b>add</b> &rarr;
174 Add a new file to the local check-out. The file must already be
175 on disk. This command tells Fossil to start tracking and managing
176 the file. This command affects only the local check-out and does
177 not modify any repository. The new file is inserted into the
178 repository at the next "commit" command.
179 <li><p><b>rm/mv</b> &rarr;
180 Short for 'remove' and 'move', these commands are like "add"
181 in that they specify pending changes to the structure of the check-out.
182 As with "add", no changes are made to the repository until the next
183 "commit".
184 </ul>
185 <li><p><b>The history of a project is a Directed Acyclic Graph (DAG)</b>
186 <ul>
187 <li><p>Fossil (and other distributed VCSes like Git and Mercurial, but
188 not Subversion) represent
189 the history of a project as a directed acyclic graph (DAG).
190 <ul>
191 <li><p>Each check-in is a node in the graph
192 <li><p>If check-in Y is derived from check-in X then there is
193 an arc in the graph from node X to node Y.
194 <li><p>The older check-in (X) is call the "parent" and the newer
195 check-in (Y) is the "child". The child is derived from
196 the parent.
197 </ul>
198 <li><p>Two users (or the same user working in different check-outs)
199 might commit different changes against the same check-in. This
200 results in one parent node having two or more children.
201 <li><p>Command: <b>merge</b> &rarr;
202 combines the work of multiple check-ins into
203 a single check-out. That check-out can then be committed to create
204 a new check-in that has two (or more) parents.
205 <ul>
206 <li><p>Most check-ins have just one parent, and either zero or
207 one child.
208 <li><p>When a check-in has two or more parents, one of those parents
209 is the "primary parent". All the other parent nodes are "secondary"
210 or "merge" parents.
211 Conceptually, the primary parent shows the main line of
212 development. Content from the merge parents is added
213 into the main line.
214 <li><p>The "direct children" of a check-in X are all children that
215 have X as their primary parent.
216 <li><p>A check-in node with no direct children is sometimes called
217 a "leaf".
218 <li><p>The "merge" command changes only the check-out.
219 The "commit" command must be run subsequently to make the merge
220 a permanent part of project.
221 </ul>
222 <li><p>Definition: <b>branch</b> &rarr;
223 a sequence of check-ins that are all linked
224 together in the DAG through the primary parent.
225 <ul>
226 <li><p>Branches are often given names which propagate to direct children.
227 The tradition in Fossil is to call the main branch "trunk". In
228 Git, the main branch is usually called "master".
229 <li><p>It is possible to have multiple branches with the same name.
230 Fossil has no problem with this, but it can be confusing to
231 humans, so best practice is to give each branch a unique name.
232 <li><p>The name of a branch can be changed by adding special tags
233 to the first check-in of a branch. The name assigned by this
234 special tag automatically propagates to all direct children.
235 </ul>
236 </ul>
237 <li><p><b>Why version control is important (reprise)</b>
238 <ol type="A">
239 <li><p>Every check-in and every individual file has a unique name - its
240 SHA1 or SHA3-256 hash. Team members can unambiguously identify
241 any specific
242 version of the overall project or any specific version of an
243 individual file.
244 <li><p>Any historical version of the whole project or of any individual
245 file can be easily recreated at any time and by any team member.
246 <li><p>Accidental changes to files can be detected by recomputing their
247 cryptographic hash.
248 <li><p>Files of unknown origin can be identified using their hash.
249 <li><p>Developers are able to work in parallel, review each others work,
250 and easily merge their changes together. External revisions to
251 the baseline can be easily incorporated into the latest changes.
252 <li><p>Developers can follow experimental lines of development, then
253 revert back to an earlier stable version if the experiment does
254 not work out. Creativity is enhanced by allowing crazy ideas to
255 be investigated without destabilizing the project.
256 <li><p>Developers can work on several independent subprojects, flipping
257 back and forth from one subproject to another at will, and merge
258 patches together or back into the main line of development as they
259 mature.
260 <li><p>Older changes can be easily backed out of recent revisions, for
261 example if bugs are found long after the code was committed.
262 <li><p>Enhancements in a branch can be easily copied into other branches,
263 or into the trunk.
264 <li><p>The complete history of all changes is plainly visible to
265 all team members. Project leaders can easily keep track of what
266 all team members are doing. Check-in comments help everyone to
267 understand and/or remember the reason for each change.
268 <li><p>New team members can be brought up-to-date with all of the historical
269 code, quickly and easily.
270 <li><p>New developers, interns, or inexperienced staff members who still
271 do not understand all the details of the project or who are otherwise
272 prone to making mistakes can be assigned significant subprojects to
273 be carried out in branches without risking main line stability.
274 <li><p>Code is automatically synchronized across all machines. No human
275 effort is wasted copying files from machine to machine. The risk
276 of human errors during file transfer and backup is eliminated.
277 <li><p>A hardware failure results in minimal lost work because
278 all previously committed changes will have been automatically
279 replicated on other machines.
280 <li><p>The complete work history of the project is conveniently archived
281 in a single file, simplifying long-term record keeping.
282 <li><p>A precise historical record is maintained which can be used to
283 support copyright and patent claims or regulatory compliance.
284 </ol>
 
 
 
 
 
 
 
 
 
285 </ol>
286
--- www/whyusefossil.wiki
+++ www/whyusefossil.wiki
@@ -2,12 +2,11 @@
2 <h1 align='center'>Why You Should Use Fossil</h1>
3 <p align='center'><b>Or, if not Fossil, at least some kind of modern
4 version control<br>such as Git, Mercurial, or Subversion.</b></p>
5 <p align='center'>(Presented in outline form, for people in a hurry)</p>
6
7 <b>I. Benefits of Version Control</b>
 
8 <ol type='A'>
9 <li><p><b>Immutable file and version identification</b>
10 <ol type='i'>
11 <li>Simplified and unambiguous communication between developers
12 <li>Detect accidental or surreptitious changes
@@ -37,249 +36,258 @@
36 <li>Failed disk-drives cause no loss of work
37 <li>Avoid wasting time doing manual file copying
38 <li>Avoid human errors during manual backups
39 </ol>
40 </ol>
41
42 <a name='definitions'></a>
43 <p><b>II. Definitions</b></p>
44
45 <ul>
46 <li><p><b>Project</b> &rarr;
47 a collection of computer files that serve some common
48 purpose. Often the project is a software application and the
49 individual files are source code together with makefiles, scripts, and
50 "README.txt" files. Other examples of projects include books or
51 manuals in which each chapter or section is held in a separate file.
52 <ul>
53 <li><p>Projects change and evolve. The whole purpose of version
54 control is to track and manage that evolution.
55 <li><p>Most projects contain many files, but it is possible
56 to have a project consisting of just a single file.
57 <li><p>Fossil requires that
58 all the files for a project must be collected into a single
59 directory hierarchy - a single folder possibly with layers
60 of subfolders. Fossil is not a good choice for managing a
61 project that has files scattered hither and yon all over
62 the disk. In other words, Fossil only works for projects
63 where the files are laid out such that they can be archived
64 into a ZIP file or tarball.
65 </ul>
66 <li><p><b>Repository</b> &rarr;
67 (also called "repo") a single file that contains
68 all historical versions of all files in a project. A repo is similar
69 to a ZIP archive in that it is a single file that stores compressed
70 versions of many other files. Files can be extracted from the
71 repo and new files can be added to the repo, just as with a ZIP
72 archive. But a repo has other capabilities above and beyond
73 what a ZIP archive can do.
74 <ul>
75 <li><p>Fossil does not care what you name your repository files,
76 though names ending with ".fossil" are recommended.
77 <li><p>A single project typically has multiple, redundant repositories on
78 separate machines.
79 <li><p>All repositories stay synchronized with one another by exchanging
80 information via HTTP or SSH.
81 <li><p>All repos for a single project redundantly store all information
82 about that project. So if any one repo is lost due to a disk
83 crash, all content is preserved in the surviving repos.
84 <li><p>The usual arrangement is one repository per user. And since
85 most users these days have their own computer, that means one
86 repository per computer. But this is not a requirement. It is
87 ok to have multiple copies of the same repository on the same
88 computer.
89 <li><p>Fossil works fine with just a single copy of the repository.
90 But in that case there is no redundancy. If that one repository
91 file is lost due to a hardware malfunction, then there is no way
92 to recover the project.
93 <li><p>Best practice is to keep all repositories for a user in a single
94 folder. Folders such as "~/Fossils" or "%USERPROFILE%\Fossils"
95 are recommended. Fossil itself does not care where the repositories
96 are stored. Nor does Fossil require repositories to be
97 kept in the same folder. But it is easier to organize your work
98 if all repositories are kept in the same place.
99 </ul>
100 <li><p><b>Check-out</b> &rarr;
101 a set of files that have been extracted from a
102 repository and that represent a particular version or snapshot of
103 the project.
104 <ul>
105 <li><p>Check-outs must be on the same computer as the repository from
106 which they are extracted. This is just like with a ZIP archive:
107 one must have the ZIP archive file on the local machine before
108 extracting files from ZIP archive.
109 <li><p>There can be multiple check-outs (in different folders) from
110 the same repository.
111 <li><p>The repository must be on the same computer as the check-out, but
112 the relative locations of the repo and the check-out are arbitrary.
113 The repository may be located inside the folder holding the
114 check-out, but it certainly does not have to be and usually is
115 not.
116 <li><p>A special file exists in every check-out that tells Fossil from
117 which repository the check-out was extracted, and which version of
118 the project the check-out represents. This is the ".fslckout" file
119 on unix systems or the "_FOSSIL_" file on Windows.
120 </ul>
121 <li><p><b>Check-in</b> &rarr;
122 another name for a particular version of the project.
123 A check-in is a collection of files inside of a repository that
124 represent a snapshot of the project for an instant in time.
125 Check-ins exist only inside of the repository. This contrasts with
126 a check-out which is a collection of files outside of the repository.
127 <ul>
128 <li><p>Every check-out knows the check-in from which it was derived.
129 But check-outs might have been edited and so might not exactly
130 match their associated check-in.
131 <li><p>Check-ins are immutable. They can never be changed. But
132 check-outs are collections of ordinary files on disk. The
133 files of a check-out can be edited just like any other file.
134 <li><p>A check-in can be thought of as an historical snapshot of a
135 check-out.
136 <li><p>"Check-in", "version", "snapshot", and "revision" are synonyms.
137 <li><p> When used as a noun, the word "commit" is another synonym
138 for "check-in". When used as a verb, the word "commit"
139 means to create a new check-in.
140 </ul>
141 </ul>
142
143 <p><b>III. Basic Fossil commands</b>
144
145 <ul>
146 <li><p><b>clone</b> &rarr;
147 Make a copy of a repository. The original repository
148 is usually (but not always) on a remote machine and the copy is on
149 the local machine. The copy remembers the network location from
150 which it was copied and (by default) tries to keep itself synchronized
151 with the original.
152 <li><p><b>open</b> &rarr;
153 Create a new check-out from a repository on the local machine.
154 <li><p><b>update</b> &rarr;
155 Modify an existing check-out so that it is derived from a
156 different version of the same project.
157 <li><p><b>commit</b> &rarr;
158 Create a new version (a new check-in) of the project that
159 is a snapshot of the current check-out.
160 <li><p><b>revert</b> &rarr;
161 Undo all local edits on a check-out. Make the check-out
162 be an exact copy of its associated check-in.
163 <li><p><b>push</b> &rarr;
164 Copy content found in a local repository over to a remote
165 repository. (Fossil usually does this automatically in response to
166 a "commit" and so this command is seldom used, but it is important
167 to understand it.)
168 <li><p><b>pull</b> &rarr;
169 Copy new content found in a remote repository into a local
170 repository. A "pull" by itself does not modify any check-out. The
171 "pull" command only moves content between repositories. However,
172 the "update" command will (often) automatically do a "pull" before
173 attempting to update the local check-out.
174 <li><p><b>sync</b> &rarr;
175 Do both a "push" and a "pull" at the same time.
176 <li><p><b>add</b> &rarr;
177 Add a new file to the local check-out. The file must already be
178 on disk. This command tells Fossil to start tracking and managing
179 the file. This command affects only the local check-out and does
180 not modify any repository. The new file is inserted into the
181 repository at the next "commit" command.
182 <li><p><b>rm/mv</b> &rarr;
183 Short for 'remove' and 'move', these commands are like "add"
184 in that they specify pending changes to the structure of the check-out.
185 As with "add", no changes are made to the repository until the next
186 "commit".
187 </ul>
188
189 <b>IV. The history of a project is a Directed Acyclic Graph (DAG)</b>
190
191 <ul>
192 <li><p>Fossil (and other distributed VCSes like Git and Mercurial, but
193 not Subversion) represent
194 the history of a project as a directed acyclic graph (DAG).
195 <ul>
196 <li><p>Each check-in is a node in the graph
197 <li><p>If check-in Y is derived from check-in X then there is
198 an arc in the graph from node X to node Y.
199 <li><p>The older check-in (X) is call the "parent" and the newer
200 check-in (Y) is the "child". The child is derived from
201 the parent.
202 </ul>
203 <li><p>Two users (or the same user working in different check-outs)
204 might commit different changes against the same check-in. This
205 results in one parent node having two or more children.
206 <li><p>Command: <b>merge</b> &rarr;
207 combines the work of multiple check-ins into
208 a single check-out. That check-out can then be committed to create
209 a new check-in that has two (or more) parents.
210 <ul>
211 <li><p>Most check-ins have just one parent, and either zero or
212 one child.
213 <li><p>When a check-in has two or more parents, one of those parents
214 is the "primary parent". All the other parent nodes are "secondary"
215 or "merge" parents.
216 Conceptually, the primary parent shows the main line of
217 development. Content from the merge parents is added
218 into the main line.
219 <li><p>The "direct children" of a check-in X are all children that
220 have X as their primary parent.
221 <li><p>A check-in node with no direct children is sometimes called
222 a "leaf".
223 <li><p>The "merge" command changes only the check-out.
224 The "commit" command must be run subsequently to make the merge
225 a permanent part of project.
226 </ul>
227 <li><p>Definition: <b>branch</b> &rarr;
228 a sequence of check-ins that are all linked
229 together in the DAG through the primary parent.
230 <ul>
231 <li><p>Branches are often given names which propagate to direct children.
232 The tradition in Fossil is to call the main branch "trunk". In
233 Git, it's called "master" by default, though some call it
234 something else, like "main".
235 <li><p>It is possible to have multiple branches with the same name.
236 Fossil has no problem with this, but it can be confusing to
237 humans, so best practice is to give each branch a unique name.
238 <li><p>The name of a branch can be changed by adding special tags
239 to the first check-in of a branch. The name assigned by this
240 special tag automatically propagates to all direct children.
241 </ul>
242 </ul>
243
244 <b>V. Why version control is important (reprise)</b>
245
246 <ol>
247 <li><p>Every check-in and every individual file has a unique name - its
248 SHA1 or SHA3-256 hash. Team members can unambiguously identify
249 any specific
250 version of the overall project or any specific version of an
251 individual file.
252 <li><p>Any historical version of the whole project or of any individual
253 file can be easily recreated at any time and by any team member.
254 <li><p>Accidental changes to files can be detected by recomputing their
255 cryptographic hash.
256 <li><p>Files of unknown origin can be identified using their hash.
257 <li><p>Developers are able to work in parallel, review each others work,
258 and easily merge their changes together. External revisions to
259 the baseline can be easily incorporated into the latest changes.
260 <li><p>Developers can follow experimental lines of development, then
261 revert back to an earlier stable version if the experiment does
262 not work out. Creativity is enhanced by allowing crazy ideas to
263 be investigated without destabilizing the project.
264 <li><p>Developers can work on several independent subprojects, flipping
265 back and forth from one subproject to another at will, and merge
266 patches together or back into the main line of development as they
267 mature.
268 <li><p>Older changes can be easily backed out of recent revisions, for
269 example if bugs are found long after the code was committed.
270 <li><p>Enhancements in a branch can be easily copied into other branches,
271 or into the trunk.
272 <li><p>The complete history of all changes is plainly visible to
273 all team members. Project leaders can easily keep track of what
274 all team members are doing. Check-in comments help everyone to
275 understand and/or remember the reason for each change.
276 <li><p>New team members can be brought up-to-date with all of the historical
277 code, quickly and easily.
278 <li><p>New developers, interns, or inexperienced staff members who still
279 do not understand all the details of the project or who are otherwise
280 prone to making mistakes can be assigned significant subprojects to
281 be carried out in branches without risking main line stability.
282 <li><p>Code is automatically synchronized across all machines. No human
283 effort is wasted copying files from machine to machine. The risk
284 of human errors during file transfer and backup is eliminated.
285 <li><p>A hardware failure results in minimal lost work because
286 all previously committed changes will have been automatically
287 replicated on other machines.
288 <li><p>The complete work history of the project is conveniently archived
289 in a single file, simplifying long-term record keeping.
290 <li><p>A precise historical record is maintained which can be used to
291 support copyright and patent claims or regulatory compliance.
292 </ol>
293 </ol>
294

Keyboard Shortcuts

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