Ignore:
Timestamp:
04/11/06 15:07:28 (18 years ago)
Author:
bastiaans
Message:

web/addons/job_monarch/conf.php:

  • added SEARCH_RESULT_LIMIT option to prevent HUGE result lists

web/addons/job_monarch/libtoga.php:

  • added a resultcount
  • changed sql query to count first and limit the results

web/addons/job_monarch/search.php:

  • added extra message when results are limited
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/libtoga.php

    r246 r248  
    142142        function searchDbase( $id = null, $queue = null, $user = null, $name = null, $start_from_time = null, $start_to_time = null, $end_from_time = null, $end_to_time = null ) {
    143143
     144                global $SEARCH_RESULT_LIMIT;
     145
    144146                if( $id )
    145147                        $query = "SELECT job_id FROM jobs WHERE job_id = '$id' AND job_status = 'F'";
     
    162164                                $query_args[] = "job_stop_timestamp <= $end_to_time";
    163165
    164                         $query = "SELECT job_id FROM jobs WHERE job_status = 'F' AND ";
     166                        $query = "FROM jobs WHERE job_status = 'F' AND ";
    165167                        $extra_query_args = '';
    166168
     
    175177                }
    176178
    177                 $ids = $this->queryDbase( $query );
     179                $count_result_idname = "COUNT(job_id)";
     180                $select_result_idname = "job_id";
     181
     182                $count_query = "SELECT " . $count_result_idname . " " . $query;
     183
     184                $count_result = $this->queryDbase( $count_query );
     185                $this->resultcount = (int) $count_result[0][count];
     186
     187                $select_query = "SELECT " . $select_result_idname . " " . $query . " ORDER BY job_id LIMIT " . $SEARCH_RESULT_LIMIT;
     188                $ids = $this->queryDbase( $select_query );
    178189
    179190                $ret = array();
Note: See TracChangeset for help on using the changeset viewer.