Fossil SCM

Begin making use of the new date/time modifiers available in SQLite in the implementation of the byweek variant of the /report page.

drh 2026-07-01 12:22 UTC trunk
Commit a13a024beacf72e910dd1b6c53d5cfc8ec460e33ffd3862ade0cb75f16e3dfb8
3 files changed +1 -1 +3 -3 +4 -2
+1 -1
--- auto.def
+++ auto.def
@@ -36,11 +36,11 @@
3636
}
3737
3838
# Update the minimum required SQLite version number here, and also
3939
# in src/main.c near the sqlite3_libversion_number() call. Take care
4040
# that both places agree!
41
-define MINIMUM_SQLITE_VERSION "3.49.0"
41
+define MINIMUM_SQLITE_VERSION "3.54.0"
4242
4343
# This is useful for people wanting Fossil to use an external SQLite library
4444
# to compare the one they have against the minimum required
4545
if {[opt-bool print-minimum-sqlite-version]} {
4646
puts [get-define MINIMUM_SQLITE_VERSION]
4747
--- auto.def
+++ auto.def
@@ -36,11 +36,11 @@
36 }
37
38 # Update the minimum required SQLite version number here, and also
39 # in src/main.c near the sqlite3_libversion_number() call. Take care
40 # that both places agree!
41 define MINIMUM_SQLITE_VERSION "3.49.0"
42
43 # This is useful for people wanting Fossil to use an external SQLite library
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47
--- auto.def
+++ auto.def
@@ -36,11 +36,11 @@
36 }
37
38 # Update the minimum required SQLite version number here, and also
39 # in src/main.c near the sqlite3_libversion_number() call. Take care
40 # that both places agree!
41 define MINIMUM_SQLITE_VERSION "3.54.0"
42
43 # This is useful for people wanting Fossil to use an external SQLite library
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47
+3 -3
--- src/main.c
+++ src/main.c
@@ -761,14 +761,14 @@
761761
fossil_limit_memory(1);
762762
763763
/* When updating the minimum SQLite version, change the number here,
764764
** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
765765
** care that both places agree! */
766
- if( sqlite3_libversion_number()<3049000
767
- || strncmp(sqlite3_sourceid(),"2025-02-06",10)<0
766
+ if( sqlite3_libversion_number()<3054000
767
+ || strncmp(sqlite3_sourceid(),"2025-07-01",10)<0
768768
){
769
- fossil_panic("Unsuitable SQLite version %s, must be at least 3.49.0",
769
+ fossil_panic("Unsuitable SQLite version %s, must be at least 3.54.0",
770770
sqlite3_libversion());
771771
}
772772
773773
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
774774
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
775775
--- src/main.c
+++ src/main.c
@@ -761,14 +761,14 @@
761 fossil_limit_memory(1);
762
763 /* When updating the minimum SQLite version, change the number here,
764 ** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
765 ** care that both places agree! */
766 if( sqlite3_libversion_number()<3049000
767 || strncmp(sqlite3_sourceid(),"2025-02-06",10)<0
768 ){
769 fossil_panic("Unsuitable SQLite version %s, must be at least 3.49.0",
770 sqlite3_libversion());
771 }
772
773 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
774 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
775
--- src/main.c
+++ src/main.c
@@ -761,14 +761,14 @@
761 fossil_limit_memory(1);
762
763 /* When updating the minimum SQLite version, change the number here,
764 ** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
765 ** care that both places agree! */
766 if( sqlite3_libversion_number()<3054000
767 || strncmp(sqlite3_sourceid(),"2025-07-01",10)<0
768 ){
769 fossil_panic("Unsuitable SQLite version %s, must be at least 3.54.0",
770 sqlite3_libversion());
771 }
772
773 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
774 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
775
+4 -2
--- src/statrep.c
+++ src/statrep.c
@@ -699,14 +699,16 @@
699699
style_submenu_checkbox("sa", "Show-All", 0, 0);
700700
if( zYear==0 || strlen(zYear)!=4 ){
701701
zYear = db_text("1970","SELECT substr(date('now'),1,4);");
702702
}
703703
rYearStart = db_double(0.0,"SELECT julianday('%q-01-01')",zYear);
704
- rYearEnd = db_double(0.0,"SELECT julianday('%q-12-31 23:59:59.999')",zYear);
704
+ rYearEnd = db_double(0.0,"SELECT julianday('%q-01-01','end of year')",zYear);
705705
rWeekOne = db_double(0.0,"SELECT julianday('%q-01-01','weekday 1')",zYear);
706706
rWeekZero = rWeekOne>rYearStart ? rWeekOne - 7.0 : rWeekOne;
707
- rAllEnd = db_double(0.0,"SELECT julianday('%q-12-31 23:59:59.999','weekday 0')",zYear);
707
+ rAllEnd = db_double(0.0,
708
+ "SELECT julianday('%q-01-01','end of year','weekday 0')",
709
+ zYear);
708710
db_multi_exec("CREATE TEMP TABLE wkdata(wk,n);");
709711
db_prepare(&q,
710712
"WITH RECURSIVE c(wkn) AS (\n"
711713
" VALUES(if(:WeekZero<:WeekOne,0,1))\n"
712714
" UNION ALL\n"
713715
--- src/statrep.c
+++ src/statrep.c
@@ -699,14 +699,16 @@
699 style_submenu_checkbox("sa", "Show-All", 0, 0);
700 if( zYear==0 || strlen(zYear)!=4 ){
701 zYear = db_text("1970","SELECT substr(date('now'),1,4);");
702 }
703 rYearStart = db_double(0.0,"SELECT julianday('%q-01-01')",zYear);
704 rYearEnd = db_double(0.0,"SELECT julianday('%q-12-31 23:59:59.999')",zYear);
705 rWeekOne = db_double(0.0,"SELECT julianday('%q-01-01','weekday 1')",zYear);
706 rWeekZero = rWeekOne>rYearStart ? rWeekOne - 7.0 : rWeekOne;
707 rAllEnd = db_double(0.0,"SELECT julianday('%q-12-31 23:59:59.999','weekday 0')",zYear);
 
 
708 db_multi_exec("CREATE TEMP TABLE wkdata(wk,n);");
709 db_prepare(&q,
710 "WITH RECURSIVE c(wkn) AS (\n"
711 " VALUES(if(:WeekZero<:WeekOne,0,1))\n"
712 " UNION ALL\n"
713
--- src/statrep.c
+++ src/statrep.c
@@ -699,14 +699,16 @@
699 style_submenu_checkbox("sa", "Show-All", 0, 0);
700 if( zYear==0 || strlen(zYear)!=4 ){
701 zYear = db_text("1970","SELECT substr(date('now'),1,4);");
702 }
703 rYearStart = db_double(0.0,"SELECT julianday('%q-01-01')",zYear);
704 rYearEnd = db_double(0.0,"SELECT julianday('%q-01-01','end of year')",zYear);
705 rWeekOne = db_double(0.0,"SELECT julianday('%q-01-01','weekday 1')",zYear);
706 rWeekZero = rWeekOne>rYearStart ? rWeekOne - 7.0 : rWeekOne;
707 rAllEnd = db_double(0.0,
708 "SELECT julianday('%q-01-01','end of year','weekday 0')",
709 zYear);
710 db_multi_exec("CREATE TEMP TABLE wkdata(wk,n);");
711 db_prepare(&q,
712 "WITH RECURSIVE c(wkn) AS (\n"
713 " VALUES(if(:WeekZero<:WeekOne,0,1))\n"
714 " UNION ALL\n"
715

Keyboard Shortcuts

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