]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/public_html/composequery.php
ocaml 3.09 transition
[helm.git] / helm / matita / scripts / public_html / composequery.php
1 <?php require("common.php"); 
2   
3   $c = array("mark", "options", "test", "result", "compilation");
4
5   function clause_for($c) {
6     $fst = true;
7     $rc = "";
8     foreach($c as $fake => $x) {
9       $v = $_GET[$x];
10       if($v != "--") {
11         if($fst == false) {
12           $rc = $rc . " and "; 
13         } else {
14           $rc = $rc . " ";
15         }
16         $fst = false;
17         $rc = $rc . $x . " = '" . $v . "'";
18       }
19     }
20     return $rc;
21   }
22   
23   $gb = $_GET['groupby'];
24   if($gb != "--")
25     $what = "mark, SEC_TO_TIME(SUM(TIME_TO_SEC(time))) as sum_time, SEC_TO_TIME(SUM(TIME_TO_SEC(timeuser))) as sum_timeuser";
26   else
27     $what = "mark, time, timeuser, compilation, test, result, options";
28   $clause = clause_for($c);
29   if($clause != "")
30     $query = "select $what from bench where " .  clause_for($c);
31   else
32     $query = "select $what from bench ";
33   if( $gb != "--"){
34     $query = $query. "group by $gb";
35   }
36    $query = $query. ";"; 
37
38    header("Location: showquery.php?query=".urlencode("Custom:@@@" . $query));
39    exit;
40 ?>