From d2a13b36c9a0aed229a3c9d252c217185b8c801a Mon Sep 17 00:00:00 2001 From: zero Date: Thu, 23 Aug 2007 03:32:07 +0000 Subject: [PATCH] =?UTF-8?q?list=5Forder,=20update=5Forder=20=EC=BB=AC?= =?UTF-8?q?=EB=9F=BC=EC=9D=98=20=EC=A0=95=EB=A0=AC=EC=8B=9C=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=EB=AC=B8=EC=97=90=20=EA=B0=95=EC=A0=9C=EB=A1=9C=20list_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)); diff --git a/classes/db/DBMysql_innodb.class.php b/classes/db/DBMysql_innodb.class.php index dd194c883..31c14633d 100644 --- a/classes/db/DBMysql_innodb.class.php +++ b/classes/db/DBMysql_innodb.class.php @@ -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));