mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Sqlite2/3에도 list_order/update_order에 대해 인덱스를 활용하도록 db class 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2384 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0c2dd97644
commit
c3e85b349c
2 changed files with 40 additions and 0 deletions
|
|
@ -495,6 +495,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));
|
||||
|
|
@ -544,6 +554,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));
|
||||
|
|
|
|||
|
|
@ -535,6 +535,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));
|
||||
|
|
@ -584,6 +594,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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue