]> matita.cs.unibo.it Git - helm.git/blob - matita/scripts/public_html/composequery.php
tagged 0.5.0-rc1
[helm.git] / 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   $limit = $_GET['limit'];
25   if($gb != "--")
26     $what = "mark, SUM(time) as sum_time, SUM(timeuser) as sum_timeuser";
27   else
28     $what = "mark, time, timeuser, compilation, test, result, options";
29   $clause = clause_for($c);
30   if($clause != "")
31     $query = "select $what from bench where " .  clause_for($c);
32   else
33     $query = "select $what from bench ";
34   if( $gb != "--"){
35     $query = $query. "group by $gb";
36   }
37
38   if($limit != "--") {
39     $query = $query. " LIMIT 0,$limit";
40   }
41
42    $query = $query. ";"; 
43
44    header("Location: showquery.php?query=".urlencode("Custom:@@@" . $query));
45    exit;
46 ?>