Ejemplo n.º 1
0
    $path[count($path) - 1] = 'index.php';
    header('Location: ' . implode('/', $path));
    exit;
}
$url = 'type[]=' . implode('&type[]=', $types);
$imgurl = '';
$where = array();
foreach ($types as $type) {
    $tmp = explode(':', $type);
    $where[] = "(config_id = " . (int) $tmp[1] . " AND fs = '" . pg_escape_string($tmp[0]) . "')";
}
$mins = array();
$queries = array();
// modified time and score (only queries that finished in all cases using the same query plan)
if (in_array($key, array('tpch-m-time', 'tpch-m-score', 'tpch-m-time-pct', 'tpch-m-score-pct'))) {
    $r = get_common_queries($where);
    // FIXME compute proper score minimum
    $min = 0;
    $max = count($r['queries']);
    $imgurl = '&mins[]=' . implode('&mins[]=', $r['mins']) . '&queries[]=' . implode('&queries[]=', $r['queries']);
    // raw score and time (all queries, plan is not compared etc.)
} else {
    if (in_array($key, array('tpch-time', 'tpch-score', 'tpch-time-pct', 'tpch-score-pct'))) {
        $r = get_all_queries($where);
        // FIXME compute proper score minimum
        $min = 0;
        $max = count($r['queries']);
        $imgurl = '&mins[]=' . implode('&mins[]=', $r['mins']) . '&queries[]=' . implode('&queries[]=', $r['queries']);
        // other columns
    } else {
        $sql = 'SELECT MIN(' . $columns[$key]['column'] . ') AS min_val, MAX(' . $columns[$key]['column'] . ') AS max_val ' . 'FROM results_tpch WHERE ' . implode(' OR ', $where);
Ejemplo n.º 2
0
<?php

require 'include/init.php';
$tmp = explode(':', $_REQUEST['type']);
$fs = $tmp[0];
$config = $tmp[1];
$min = isset($_REQUEST['min']) ? $_REQUEST['min'] : null;
$max = isset($_REQUEST['max']) ? $_REQUEST['max'] : null;
$queries = isset($_REQUEST['queries']) ? $_REQUEST['queries'] : null;
$mins = isset($_REQUEST['mins']) ? $_REQUEST['mins'] : null;
$img = $_REQUEST['img'];
// FIXME Rewrite to properly evaluate score etc. This is a mess. Probably move to tpch.php and deal only with GET parameters here.
if (in_array($img, array('tpch-m-time', 'tpch-time', 'tpch-score', 'tpch-m-score', 'tpch-m-time-pct', 'tpch-time-pct', 'tpch-score-pct', 'tpch-m-score-pct'))) {
    if (is_null($queries) && is_null($mins)) {
        if (in_array($img, array('tpch-m-time', 'tpch-m-score', 'tpch-m-time-pct', 'tpch-m-score-pct'))) {
            $r = get_common_queries(array('config_id = ' . (int) $config . " AND fs = '" . pg_escape_string($fs) . "'"));
        } else {
            $r = get_all_queries(array('config_id = ' . (int) $config . " AND fs = '" . pg_escape_string($fs) . "'"));
        }
        $queries = $r['queries'];
        $mins = $r['mins'];
    }
    $sql = 'SELECT title, fs, fs_block, db_block';
    foreach ($queries as $i) {
        $sql .= ", query_{$i}";
    }
    $sql .= ' FROM ' . $columns[$img]['table'] . ' x JOIN config ON (x.config_id = config.id) WHERE config_id = ' . (int) $config . " AND fs = '" . pg_escape_string($fs) . "'";
} else {
    $sql = 'SELECT title, fs, fs_block, db_block, ' . $columns[$img]['column'] . ' AS val FROM ' . $columns[$img]['table'] . ' x JOIN config ON (x.config_id = config.id) WHERE config_id = ' . (int) $config . " AND fs = '" . pg_escape_string($fs) . "'";
}
$result = pg_query($sql);