From: Benjamin C. <bc...@us...> - 2001-10-30 05:19:56
|
Update of /cvsroot/phpbt/phpbt/admin In directory usw-pr-cvs1:/tmp/cvs-serv17647/admin Modified Files: os.php project.php resolution.php severity.php status.php user.php Log Message: Make the limit queries PG friendly and break them up over multiple lines Index: os.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/admin/os.php,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- os.php 2001/10/05 04:22:46 1.14 +++ os.php 2001/10/30 05:19:54 1.15 @@ -83,7 +83,8 @@ 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange, 'records' => $nr)); - $q->query("select * from ".TBL_OS." order by $order $sort limit $llimit, $selrange"); + $q->limit_query("select * from ".TBL_OS." order by $order $sort", + $selrange, $llimit); if (!$q->num_rows()) { $t->set_var('rows',"<tr><td>{$STRING['nooses']}</td></tr>"); Index: project.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/admin/project.php,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- project.php 2001/10/12 04:19:31 1.23 +++ project.php 2001/10/30 05:19:54 1.24 @@ -280,7 +280,8 @@ 'TITLE' => $TITLE['project'] )); - $q->query("select * from ".TBL_PROJECT." order by $order $sort limit $llimit, $selrange"); + $q->limit_query("select * from ".TBL_PROJECT." order by $order $sort", + $selrange, $llimit); if (!$q->num_rows()) { $t->set_var('rows',"<tr><td>{$STRING['noprojects']}</td></tr>"); Index: resolution.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/admin/resolution.php,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- resolution.php 2001/10/05 04:22:46 1.15 +++ resolution.php 2001/10/30 05:19:54 1.16 @@ -36,10 +36,13 @@ if ($error) { list_items($resolutionid, $error); return; } if (!$resolutionid) { - $q->query("insert into ".TBL_RESOLUTION." (resolution_id, resolution_name, resolution_desc, sort_order)" - ." values (".$q->nextid(TBL_RESOLUTION).", '$fname', '$fdescription', '$fsortorder')"); + $q->query("insert into ".TBL_RESOLUTION. + " (resolution_id, resolution_name, resolution_desc, sort_order)" + ." values (".$q->nextid(TBL_RESOLUTION).", '$fname', '$fdescription', '$fsortorder')"); } else { - $q->query("update ".TBL_RESOLUTION." set resolution_name = '$fname', resolution_desc = '$fdescription', sort_order = '$fsortorder' where resolution_id = '$resolutionid'"); + $q->query("update ".TBL_RESOLUTION. + " set resolution_name = '$fname', resolution_desc = '$fdescription', + sort_order = '$fsortorder' where resolution_id = '$resolutionid'"); } header("Location: $me?"); } @@ -48,7 +51,8 @@ global $q, $me, $t, $fname, $fdescription, $fsortorder, $STRING; if ($resolutionid && !$error) { - $row = $q->grab("select * from ".TBL_RESOLUTION." where resolution_id = '$resolutionid'"); + $row = $q->grab("select * from ".TBL_RESOLUTION. + " where resolution_id = '$resolutionid'"); $t->set_var(array( 'action' => $STRING['edit'], 'fresolutionid' => $row['resolution_id'], @@ -74,7 +78,8 @@ $t->set_block('content','row','rows'); if (!$order) { $order = 'sort_order'; $sort = 'asc'; } - $nr = $q->query("select count(*) from ".TBL_RESOLUTION." where resolution_id = '$resolutionid' order by $order $sort"); + $nr = $q->query("select count(*) from ".TBL_RESOLUTION. + " where resolution_id = '$resolutionid' order by $order $sort"); list($selrange, $llimit, $npages, $pages) = multipages($nr,$page, "order=$order&sort=$sort"); @@ -85,7 +90,8 @@ 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange, 'records' => $nr)); - $q->query("select * from ".TBL_RESOLUTION." order by $order $sort limit $llimit, $selrange"); + $q->limit_query("select * from ".TBL_RESOLUTION." order by $order $sort", + $selrange, $llimit); if (!$q->num_rows()) { $t->set_var('rows',"<tr><td>{$STRING['noresolutions']}</td></tr>"); Index: severity.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/admin/severity.php,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- severity.php 2001/10/06 03:53:33 1.11 +++ severity.php 2001/10/30 05:19:54 1.12 @@ -36,9 +36,13 @@ if ($error) { list_items($severityid, $error); return; } if (!$severityid) { - $q->query("insert into ".TBL_SEVERITY." (severity_id, severity_name, severity_desc, sort_order, severity_color) values (".$q->nextid(TBL_SEVERITY).", '$fname', '$fdescription', '$fsortorder', '$fcolor')"); + $q->query("insert into ".TBL_SEVERITY. + " (severity_id, severity_name, severity_desc, sort_order, severity_color) + values (".$q->nextid(TBL_SEVERITY).", '$fname', '$fdescription', '$fsortorder', '$fcolor')"); } else { - $q->query("update ".TBL_SEVERITY." set severity_name = '$fname', severity_desc = '$fdescription', sort_order = '$fsortorder', severity_color = '$fcolor' where severity_id = '$severityid'"); + $q->query("update ".TBL_SEVERITY." set severity_name = '$fname', + severity_desc = '$fdescription', sort_order = '$fsortorder', + severity_color = '$fcolor' where severity_id = '$severityid'"); } header("Location: $me?"); } @@ -47,7 +51,8 @@ global $q, $me, $t, $_pv, $STRING; if ($severityid && !$error) { - $row = $q->grab("select * from ".TBL_SEVERITY." where severity_id = '$severityid'"); + $row = $q->grab("select * from ".TBL_SEVERITY. + " where severity_id = '$severityid'"); $t->set_var(array( 'action' => $STRING['edit'], 'fseverityid' => $row['severity_id'], @@ -77,7 +82,8 @@ $t->set_block('content','row','rows'); if (!$order) { $order = 'sort_order'; $sort = 'asc'; } - $nr = $q->query("select count(*) from ".TBL_SEVERITY." where severity_id = '$severityid' order by $order $sort"); + $nr = $q->query("select count(*) from ".TBL_SEVERITY. + " where severity_id = '$severityid' order by $order $sort"); list($selrange, $llimit, $npages, $pages) = multipages($nr,$page, "order=$order&sort=$sort"); @@ -88,7 +94,9 @@ 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange, 'records' => $nr)); - $q->query("select * from ".TBL_SEVERITY." order by $order $sort limit $llimit, $selrange"); + $q->limit_query("select * from ".TBL_SEVERITY." order by $order $sort", + $selrange, $llimit); + if (!$q->num_rows()) { $t->set_var('rows',"<tr><td>{$STRING['noseverities']}</td></tr>"); Index: status.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/admin/status.php,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- status.php 2001/10/05 04:22:46 1.15 +++ status.php 2001/10/30 05:19:54 1.16 @@ -36,9 +36,13 @@ if ($error) { list_items($statusid, $error); return; } if (!$statusid) { - $q->query("insert into ".TBL_STATUS." (status_id, status_name, status_desc, sort_order) values (".$q->nextid(TBL_STATUS).", '$fname', '$fdescription', '$fsortorder')"); + $q->query("insert into ".TBL_STATUS. + " (status_id, status_name, status_desc, sort_order) values (". + $q->nextid(TBL_STATUS).", '$fname', '$fdescription', '$fsortorder')"); } else { - $q->query("update ".TBL_STATUS." set status_name = '$fname', status_desc = '$fdescription', sort_order = '$fsortorder' where status_id = '$statusid'"); + $q->query("update ".TBL_STATUS. + " set status_name = '$fname', status_desc = '$fdescription', + sort_order = '$fsortorder' where status_id = '$statusid'"); } header("Location: $me?"); } @@ -47,7 +51,8 @@ global $q, $me, $t, $fname, $fdescription, $fsortorder, $STRING; if ($statusid && !$error) { - $row = $q->grab("select * from ".TBL_STATUS." where status_id = '$statusid'"); + $row = $q->grab("select * from ".TBL_STATUS. + " where status_id = '$statusid'"); $t->set_var(array( 'action' => $STRING['edit'], 'fstatusid' => $row['status_id'], @@ -73,7 +78,8 @@ $t->set_block('content','row','rows'); if (!$order) { $order = 'sort_order'; $sort = 'asc'; } - $nr = $q->query("select count(*) from ".TBL_STATUS." where status_id = '$statusid' order by $order $sort"); + $nr = $q->query("select count(*) from ".TBL_STATUS. + " where status_id = '$statusid' order by $order $sort"); list($selrange, $llimit, $npages, $pages) = multipages($nr,$page, "order=$order&sort=$sort"); @@ -84,7 +90,8 @@ 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange, 'records' => $nr)); - $q->query("select * from ".TBL_STATUS." order by $order $sort limit $llimit, $selrange"); + $q->limit_query("select * from ".TBL_STATUS." order by $order $sort", + $selrange, $llimit); if (!$q->num_rows()) { $t->set_var('rows',"<tr><td>{$STRING['nostatuses']}</td></tr>"); Index: user.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- user.php 2001/10/12 04:19:31 1.29 +++ user.php 2001/10/30 05:19:54 1.30 @@ -183,9 +183,9 @@ 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange, 'records' => $nr)); - $q->query("select user_id, concat(first_name,' ',last_name) as fullname, + $q->limit_query("select user_id, concat(first_name,' ',last_name) as fullname, email, login, created_date, active from ".TBL_AUTH_USER - ." order by $order $sort limit $llimit, $selrange"); + ." order by $order $sort", $selrange, $llimit); if (!$q->num_rows()) { $t->set_var('rows',"<tr><td>{$STRING['nousers']}</td></tr>"); |