포럼
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
DB 이슈
2011.11.16 00:36
1.5 버전
1. 특정 테이블과 조인후 (left, right) 특정 컬럼에 distinct 처리시 total count 는 distinct전의 join 상태의 개수가 나옵니다. 페이징오류되버립니다.
2. groups 로 그룹했을 경우 total count는 1이 되버리는 현상 발견.
- count(*) 처리 되어있음.
classes/db/DBMysql.class.php
function queryPageLimit($queryObject, $result, $connection){ $limit = $queryObject->getLimit(); // Total count $temp_where = $queryObject->getWhereString(true, false); $count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE '. $temp_where)); if ($queryObject->getGroupByString() != '') { ... more
댓글 2
-
니오티
2011.11.16 01:26
-
니오티
2011.11.16 01:59
function queryPageLimit($queryObject, $result, $connection){ $limit = $queryObject->getLimit(); // Total count $temp_where = $queryObject->getWhereString(true, false); $temp_select = $queryObject->getSelectString(false); $count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE '. $temp_where)); if ($queryObject->getGroupByString() != '') { $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); /*천영진 추가*/ }else if(is_string($temp_select) && ereg("distinct", $temp_select)){ $count_query = sprintf('select '.$temp_select.' %s %s', 'FROM ' . $queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE '. $temp_where)); $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); } /*천영진 추가*/
subQuery는 아직 완성 안되었나보네요 ㅠ