list_order, update_order 컬럼의 정렬시 조건문에 강제로 < 0 문을 넣어서 인덱스를 사용하도록 mysql 클래스 코드 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2382 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-23 03:32:07 +00:00
parent 051b6a3079
commit d2a13b36c9
2 changed files with 40 additions and 0 deletions

View file

@ -472,6 +472,16 @@
if($output->list_count) return $this->_getNavigationData($table_list, $columns, $condition, $output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
if($output->order) {
foreach($output->order as $key => $val) {
$col = $val[0];
if(!in_array($col, array('list_order','update_order'))) continue;
if($condition) $condition .= sprintf(' and %s < 0 ', $col);
else $condition = sprintf(' where %s < 0 ', $col);
}
}
$query = sprintf("select %s from %s %s", $columns, implode(',',$table_list), $condition);
if(count($output->groups)) $query .= sprintf(' group by %s', implode(',',$output->groups));
@ -521,6 +531,16 @@
if($page > $total_page) $page = $total_page;
$start_count = ($page-1)*$list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
if($output->order) {
foreach($output->order as $key => $val) {
$col = $val[0];
if(!in_array($col, array('list_order','update_order'))) continue;
if($condition) $condition .= sprintf(' and %s < 0 ', $col);
else $condition = sprintf(' where %s < 0 ', $col);
}
}
$query = sprintf("select %s from %s %s", $columns, implode(',',$table_list), $condition);
if(count($output->groups)) $query .= sprintf(' group by %s', implode(',',$output->groups));

View file

@ -483,6 +483,16 @@
if($output->list_count) return $this->_getNavigationData($table_list, $columns, $condition, $output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
if($output->order) {
foreach($output->order as $key => $val) {
$col = $val[0];
if(!in_array($col, array('list_order','update_order'))) continue;
if($condition) $condition .= sprintf(' and %s < 0 ', $col);
else $condition = sprintf(' where %s < 0 ', $col);
}
}
$query = sprintf("select %s from %s %s", $columns, implode(',',$table_list), $condition);
if(count($output->groups)) $query .= sprintf(' group by %s', implode(',',$output->groups));
@ -532,6 +542,16 @@
if($page > $total_page) $page = $total_page;
$start_count = ($page-1)*$list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
if($output->order) {
foreach($output->order as $key => $val) {
$col = $val[0];
if(!in_array($col, array('list_order','update_order'))) continue;
if($condition) $condition .= sprintf(' and %s < 0 ', $col);
else $condition = sprintf(' where %s < 0 ', $col);
}
}
$query = sprintf("select %s from %s %s", $columns, implode(',',$table_list), $condition);
if(count($output->groups)) $query .= sprintf(' group by %s', implode(',',$output->groups));