56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
** filter it applies, or '*' if no filter is applied (i.e. if "all" is
** used).
*/
static int stats_report_init_view(){
const char *zType = PD("type","*"); /* analog to /timeline?y=... */
const char *zRealType = NULL; /* normalized form of zType */
int rc = 0; /* result code */
assert( !statsReportType && "Must not be called more than once." );
switch( (zType && *zType) ? *zType : 0 ){
case 'c':
case 'C':
zRealType = "ci";
rc = *zRealType;
break;
|
>
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
** filter it applies, or '*' if no filter is applied (i.e. if "all" is
** used).
*/
static int stats_report_init_view(){
const char *zType = PD("type","*"); /* analog to /timeline?y=... */
const char *zRealType = NULL; /* normalized form of zType */
int rc = 0; /* result code */
char *zTimeSpan; /* Time span */
assert( !statsReportType && "Must not be called more than once." );
switch( (zType && *zType) ? *zType : 0 ){
case 'c':
case 'C':
zRealType = "ci";
rc = *zRealType;
break;
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
rc = *zRealType;
break;
default:
rc = '*';
break;
}
assert(0 != rc);
if(zRealType){
statsReportTimelineYFlag = zRealType;
db_multi_exec("CREATE TEMP VIEW v_reports AS "
"SELECT * FROM event WHERE type GLOB %Q",
zRealType);
}else{
statsReportTimelineYFlag = "a";
db_multi_exec("CREATE TEMP VIEW v_reports AS "
"SELECT * FROM event");
}
return statsReportType = rc;
}
/*
** Returns a string suitable (for a given value of suitable) for
** use in a label with the header of the /reports pages, dependent
|
>
>
>
>
>
>
>
|
|
|
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
rc = *zRealType;
break;
default:
rc = '*';
break;
}
assert(0 != rc);
if( P("from")!=0 && P("to")!=0 ){
zTimeSpan = mprintf(
" (event.mtime BETWEEN julianday(%Q) AND julianday(%Q))",
P("from"), P("to"));
}else{
zTimeSpan = " 1";
}
if(zRealType){
statsReportTimelineYFlag = zRealType;
db_multi_exec("CREATE TEMP VIEW v_reports AS "
"SELECT * FROM event WHERE (type GLOB %Q) AND %s",
zRealType, zTimeSpan/*safe-for-%s*/);
}else{
statsReportTimelineYFlag = "a";
db_multi_exec("CREATE TEMP VIEW v_reports AS "
"SELECT * FROM event WHERE %s", zTimeSpan/*safe-for-%s*/);
}
return statsReportType = rc;
}
/*
** Returns a string suitable (for a given value of suitable) for
** use in a label with the header of the /reports pages, dependent
|