페이징을 할 경우 DB class에서 navigation을 처리하도록 변경

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3154 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-12-04 08:26:15 +00:00
parent 6a322a17ce
commit 539c32082e
6 changed files with 133 additions and 49 deletions

View file

@ -556,17 +556,45 @@
$condition = $this->getCondition($output);
if($output->list_count) return $this->_getNavigationData($table_list, $columns, $condition, $output);
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $condition, $output);
$query = sprintf("select %s from %s %s", $columns, implode(',',$table_list), $condition);
if(count($output->groups)) $query .= sprintf(' group by %s', implode(',',$output->groups));
if($output->order) {
foreach($output->order as $key => $val) {
// list_count를 사용할 경우 적용
if($output->list_count['value']) {
$start_count = 0;
$list_count = $output->list_count['value'];
if ($output->order) {
foreach($output->order as $key => $val) {
$index_list[] = sprintf('%s %s', $val[0], $val[1]);
}
if(count($index_list)) $query .= ' order by '.implode(',',$index_list);
$query = sprintf('%s for orderby_num() between %d and %d', $query, $start_count, $list_count);
}
if(count($index_list)) $query .= ' order by '.implode(',',$index_list);
else {
if (count($output->groups))
$query = sprintf('%s having groupby_num() between %d and %d', $query, $start_count, $list_count);
else {
if ($condition)
$query = sprintf('%s and inst_num() between %d and %d', $query, $start_count, $list_count);
else
$query = sprintf('%s where inst_num() between %d and %d', $query, $start_count, $list_count);
}
}
} else {
if($output->order) {
foreach($output->order as $key => $val) {
$index_list[] = sprintf('%s %s', $val[0], $val[1]);
}
if(count($index_list)) $query .= ' order by '.implode(',',$index_list);
}
}
$result = $this->_query($query);