Fossil SCM

Tweaked the various wiki page list queries to ensure that they do not include tags named wiki-* unless those tags appear to refer to a wiki page. Historically, the tag command has allowed entry of such tags and at least one is known to exist in another tree.

stephan 2021-06-04 12:32 trunk
Commit 4218b200312f4203f2672adc6f1970ac08c564e896f64c966f30451e59b6f304
2 files changed +3 -1 +3
+3 -1
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -460,11 +460,13 @@
460460
return NULL;
461461
}
462462
blob_append(&sql,"SELECT"
463463
" DISTINCT substr(tagname,6) as name"
464464
" FROM tag JOIN tagxref USING('tagid')"
465
- " WHERE tagname GLOB 'wiki-*'",
465
+ " WHERE tagname GLOB 'wiki-*'"
466
+ " AND TYPEOF(tagxref.value+0)='integer'",
467
+ /* ^^^ elide wiki- tags which are not wiki pages */
466468
-1);
467469
zGlob = json_find_option_cstr("glob",NULL,"g");
468470
if(zGlob && *zGlob){
469471
blob_append_sql(&sql," AND name %s GLOB %Q",
470472
fInvert ? "NOT" : "", zGlob);
471473
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -460,11 +460,13 @@
460 return NULL;
461 }
462 blob_append(&sql,"SELECT"
463 " DISTINCT substr(tagname,6) as name"
464 " FROM tag JOIN tagxref USING('tagid')"
465 " WHERE tagname GLOB 'wiki-*'",
 
 
466 -1);
467 zGlob = json_find_option_cstr("glob",NULL,"g");
468 if(zGlob && *zGlob){
469 blob_append_sql(&sql," AND name %s GLOB %Q",
470 fInvert ? "NOT" : "", zGlob);
471
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -460,11 +460,13 @@
460 return NULL;
461 }
462 blob_append(&sql,"SELECT"
463 " DISTINCT substr(tagname,6) as name"
464 " FROM tag JOIN tagxref USING('tagid')"
465 " WHERE tagname GLOB 'wiki-*'"
466 " AND TYPEOF(tagxref.value+0)='integer'",
467 /* ^^^ elide wiki- tags which are not wiki pages */
468 -1);
469 zGlob = json_find_option_cstr("glob",NULL,"g");
470 if(zGlob && *zGlob){
471 blob_append_sql(&sql," AND name %s GLOB %Q",
472 fInvert ? "NOT" : "", zGlob);
473
+3
--- src/wiki.c
+++ src/wiki.c
@@ -1016,10 +1016,12 @@
10161016
db_begin_transaction();
10171017
db_prepare(&q, "SELECT"
10181018
" substr(tagname,6) AS name"
10191019
" FROM tag JOIN tagxref USING('tagid')"
10201020
" WHERE tagname GLOB 'wiki-*'"
1021
+ " AND TYPEOF(tagxref.value+0)='integer'"
1022
+ /* ^^^ elide wiki- tags which are not wiki pages */
10211023
" UNION SELECT 'Sandbox' AS name"
10221024
" ORDER BY name COLLATE NOCASE");
10231025
CX("[");
10241026
while( SQLITE_ROW==db_step(&q) ){
10251027
char const * zName = db_column_text(&q,0);
@@ -1759,10 +1761,11 @@
17591761
@ tag,
17601762
@ tagxref
17611763
@ WHERE
17621764
@ tag.tagname GLOB 'wiki-*'
17631765
@ AND tagxref.tagid=tag.tagid
1766
+@ AND TYPEOF(wrid)='integer' -- only wiki- tags which are wiki pages
17641767
@ GROUP BY 1
17651768
@ ORDER BY 2;
17661769
;
17671770
17681771
/*
17691772
--- src/wiki.c
+++ src/wiki.c
@@ -1016,10 +1016,12 @@
1016 db_begin_transaction();
1017 db_prepare(&q, "SELECT"
1018 " substr(tagname,6) AS name"
1019 " FROM tag JOIN tagxref USING('tagid')"
1020 " WHERE tagname GLOB 'wiki-*'"
 
 
1021 " UNION SELECT 'Sandbox' AS name"
1022 " ORDER BY name COLLATE NOCASE");
1023 CX("[");
1024 while( SQLITE_ROW==db_step(&q) ){
1025 char const * zName = db_column_text(&q,0);
@@ -1759,10 +1761,11 @@
1759 @ tag,
1760 @ tagxref
1761 @ WHERE
1762 @ tag.tagname GLOB 'wiki-*'
1763 @ AND tagxref.tagid=tag.tagid
 
1764 @ GROUP BY 1
1765 @ ORDER BY 2;
1766 ;
1767
1768 /*
1769
--- src/wiki.c
+++ src/wiki.c
@@ -1016,10 +1016,12 @@
1016 db_begin_transaction();
1017 db_prepare(&q, "SELECT"
1018 " substr(tagname,6) AS name"
1019 " FROM tag JOIN tagxref USING('tagid')"
1020 " WHERE tagname GLOB 'wiki-*'"
1021 " AND TYPEOF(tagxref.value+0)='integer'"
1022 /* ^^^ elide wiki- tags which are not wiki pages */
1023 " UNION SELECT 'Sandbox' AS name"
1024 " ORDER BY name COLLATE NOCASE");
1025 CX("[");
1026 while( SQLITE_ROW==db_step(&q) ){
1027 char const * zName = db_column_text(&q,0);
@@ -1759,10 +1761,11 @@
1761 @ tag,
1762 @ tagxref
1763 @ WHERE
1764 @ tag.tagname GLOB 'wiki-*'
1765 @ AND tagxref.tagid=tag.tagid
1766 @ AND TYPEOF(wrid)='integer' -- only wiki- tags which are wiki pages
1767 @ GROUP BY 1
1768 @ ORDER BY 2;
1769 ;
1770
1771 /*
1772

Keyboard Shortcuts

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