| @@ 1034-1045 (lines=12) @@ | ||
| 1031 | $temp_select = $queryObject->getSelectString($with_values); |
|
| 1032 | $uses_distinct = stripos($temp_select, "distinct") !== FALSE; |
|
| 1033 | $uses_groupby = $queryObject->getGroupByString() != ''; |
|
| 1034 | if($uses_distinct || $uses_groupby) |
|
| 1035 | { |
|
| 1036 | $count_query = sprintf('select %s %s %s %s' |
|
| 1037 | , $temp_select |
|
| 1038 | , 'FROM ' . $queryObject->getFromString($with_values) |
|
| 1039 | , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) |
|
| 1040 | , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') |
|
| 1041 | ); |
|
| 1042 | ||
| 1043 | // If query uses grouping or distinct, count from original select |
|
| 1044 | $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); |
|
| 1045 | } |
|
| 1046 | ||
| 1047 | $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; |
|
| 1048 | $result = $this->_query($count_query, $connection); |
|
| @@ 923-934 (lines=12) @@ | ||
| 920 | $temp_select = $queryObject->getSelectString(true); |
|
| 921 | $uses_distinct = stripos($temp_select, "distinct") !== false; |
|
| 922 | $uses_groupby = $queryObject->getGroupByString() != ''; |
|
| 923 | if($uses_distinct || $uses_groupby) |
|
| 924 | { |
|
| 925 | $count_query = sprintf('select %s %s %s %s' |
|
| 926 | , $temp_select |
|
| 927 | , 'FROM ' . $queryObject->getFromString(true) |
|
| 928 | , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) |
|
| 929 | , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') |
|
| 930 | ); |
|
| 931 | ||
| 932 | // If query uses grouping or distinct, count from original select |
|
| 933 | $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); |
|
| 934 | } |
|
| 935 | ||
| 936 | $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 937 | $this->param = $queryObject->getArguments(); |
|
| @@ 746-757 (lines=12) @@ | ||
| 743 | $temp_select = $queryObject->getSelectString($with_values); |
|
| 744 | $uses_distinct = stripos($temp_select, "distinct") !== false; |
|
| 745 | $uses_groupby = $queryObject->getGroupByString() != ''; |
|
| 746 | if($uses_distinct || $uses_groupby) |
|
| 747 | { |
|
| 748 | $count_query = sprintf('select %s %s %s %s' |
|
| 749 | , $temp_select == '*' ? '1' : $temp_select |
|
| 750 | , 'FROM ' . $queryObject->getFromString($with_values) |
|
| 751 | , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) |
|
| 752 | , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') |
|
| 753 | ); |
|
| 754 | ||
| 755 | // If query uses grouping or distinct, count from original select |
|
| 756 | $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); |
|
| 757 | } |
|
| 758 | ||
| 759 | $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; |
|
| 760 | $result_count = $this->_query($count_query, $connection); |
|