";
if ($start_at) {
$prev_pos = $start_at - $page_entries_to_show;
diff --git a/html/ops/db_ops.inc b/html/ops/db_ops.inc
index e0fa12c012..edbbfec261 100644
--- a/html/ops/db_ops.inc
+++ b/html/ops/db_ops.inc
@@ -29,7 +29,12 @@ function lookup_user_auth($auth) {
class SqlQueryString {
var $table;
var $query;
- function SqlQueryString($table, $query) { $this->table = $table; $this->query = $query; }
+ var $urlquery;
+ function SqlQueryString() {
+ $this->table = $_GET['table'];
+ $this->query = $_GET['query'];
+ $this->urlquery = "table=$this->table&query=$this->query";
+ }
function add($clause) {
if (!$this->query) {
$this->query .= "where $clause";
@@ -42,19 +47,25 @@ class SqlQueryString {
$this->add($clause);
}
}
- function addeq($name, $value) {
+ function addeq($name) {
+ $value = $_GET[$name];
if (strlen($value)) {
- $this->add("$name = $value");
+ $this->add("$name = '$value'");
+ $this->urlquery .= "&$name=".urlencode($value);
}
}
- function addeqnz($name, $value) {
+ function addeqnz($name) {
+ $value = $_GET[$name];
if (strlen($value) && $value > 0) {
- $this->add("$name = $value");
+ $this->add("$name = '$value'");
+ $this->urlquery .= "&$name=".urlencode($value);
}
}
- function addgt($name, $value) {
+ function addgt($name) {
+ $value = $_GET[$name];
if (strlen($value) && $value > 0) {
- $this->add("$name > $value");
+ $this->add("$name > '$value'");
+ $this->urlquery .= "&$name=".urlencode($value);
}
}
@@ -79,27 +90,24 @@ class SqlQueryString {
}
}
-function build_sql_query($table)
+function build_sql_query()
{
- parse_str(getenv("QUERY_STRING"));
+ $q = new SqlQueryString();
- $q = new SqlQueryString($table, $query);
-
- $q->addclause($clauses);
- $q->addeq('id', $id);
- $q->addeq('platformid', $plat_id);
- $q->addeq('appid', $app_id);
- $q->addeq('workunitd', $wu_id);
- $q->addeq('hostid', $hostid);
- $q->addeq('userid', $userid);
- $q->addeq('teamid', $team_id);
+ $q->addeq('id');
+ $q->addeq('platformid');
+ $q->addeq('appid'_id);
+ $q->addeq('workunitid');
+ $q->addeq('hostid');
+ $q->addeq('userid');
+ $q->addeq('teamid');
if ($nsecs) {
$received_time = time() - $nsecs;
}
- $q->addgt('received_time', $received_time);
- $q->addeqnz('server_state', $result_server_state);
- $q->addeqnz('outcome', $result_outcome);
- $q->addeqnz('client_state', $result_client_state);
+ $q->addgt('received_time');
+ $q->addeqnz('server_state');
+ $q->addeqnz('outcome');
+ $q->addeqnz('client_state');
if (strlen($sort_by)) {
$q->query .= " order by $sort_by desc";
@@ -134,7 +142,7 @@ function show_result_summary()
$q = build_sql_query('result');
$main_query = $q->get_select_query(0,0);
- $urlquery = urlencode($q->query);
+ $urlquery = $q->urlquery;
echo " Query: $main_query \n";
$result = mysql_query($main_query);
$ntotal =0; // TODO: how to count $result?
@@ -153,66 +161,66 @@ function show_result_summary()
echo " ";
echo "";
echo "" . link_results("$ntotal results", $urlquery, '') . " | ";
- echo "" . link_results("'Over' results", $urlquery, "result_server_state=5") . " | ";
- echo "" . link_results("'Client error' results", $urlquery, "result_outcome=3") . " | ";
+ echo "" . link_results("'Over' results", $urlquery, "server_state=5") . " | ";
+ echo "" . link_results("'Client error' results", $urlquery, "outcome=3") . " | ";
echo " ";
echo "";
echo "Server state | # results | \n";
for ($ss=1; $ss<6; $ss++) {
- row2(result_server_state_string($ss),
- link_results($server_state[$ss], $urlquery,"result_server_state=$ss"));
+ row2(server_state_string($ss),
+ link_results($server_state[$ss], $urlquery,"server_state=$ss"));
}
echo "
| ";
echo "Outcome | # results | \n";
for ($ro=0; $ro<6; $ro++) {
- c_row2(outcome_color($ro), result_outcome_string($ro),
- link_results($outcome[$ro], $urlquery, "result_outcome=$ro"));
+ c_row2(outcome_color($ro), outcome_string($ro),
+ link_results($outcome[$ro], $urlquery, "outcome=$ro"));
}
echo "
| ";
echo "Client state | # results | \n";
for ($cs=1; $cs<6; $cs++) {
- row2(result_client_state_string($cs),
- link_results($client_state[$cs], $urlquery, "result_client_state=$cs"));
+ row2(client_state_string($cs),
+ link_results($client_state[$cs], $urlquery, "client_state=$cs"));
}
print " ";
print " | ";
}
-function result_server_state_select() {
+function server_state_select() {
echo "
- |