kamal2222ahmed / jiffy-web

Automatically exported from code.google.com/p/jiffy-web
Other
0 stars 0 forks source link

MYSQL Reporting query ported #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Issue:
The query in the reporting UI does not function for MySQL.

Solution (Patch):
Lines 56 - 72 of "report.php" can be replaced for MySQL with the following:

$sql = " 
  SELECT
    DATE_FORMAT(server_time, '%Y-%m-%d') STIME, 
    MEASUREMENT_CODE, 
    AVG(elapsed_time) ET_MEAN
  FROM 
    ".DBSCHEMA."MEASUREMENT_VIEW
  WHERE 
    server_time BETWEEN :startdate AND :enddate
  GROUP BY 
    DATE_FORMAT(server_time, '%Y-%m-%d'), 
    MEASUREMENT_CODE 
";

$sth = $dbh->prepare($sql);
$sth->bindParam(':startdate', $q_params['startdate'], PDO::PARAM_STR);
$sth->bindParam(':enddate', $q_params['enddate'], PDO::PARAM_STR);

Original issue reported on code.google.com by GeorgeC...@gmail.com on 27 Sep 2008 at 6:27