Fossil

Check-in [f390552d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add (undocumented) from= and to= query parameters on the /reports webpage. If both parameters are a date/time string, then report only covers the span of dates specified.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f390552d0e5c0174560772f81096910178185165b15fea2ad4ed101049d0c8a0
User & Date: drh 2018-02-05 20:18:10
Context
2018-02-07
18:48
Version 2.5 check-in: 188a0e29 user: drh tags: trunk, release, version-2.5
2018-02-05
20:18
Add (undocumented) from= and to= query parameters on the /reports webpage. If both parameters are a date/time string, then report only covers the span of dates specified. check-in: f390552d user: drh tags: trunk
2018-01-28
21:52
Remove --no-dir-symlinks option from the docs. check-in: 57f178ee user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/statrep.c.

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