mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-23 13:19:56 +09:00
Merge 1.5.2.4 ( ~ r10652)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@10653 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
412816433d
commit
f0c12f5756
20 changed files with 3413 additions and 4275 deletions
|
|
@ -565,11 +565,24 @@
|
|||
// 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() != '') {
|
||||
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
|
||||
}
|
||||
|
||||
$count_query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
|
||||
// Check for distinct query and if found update count query structure
|
||||
$temp_select = $queryObject->getSelectString(true);
|
||||
$uses_distinct = strpos(strtolower($temp_select), "distinct") !== false;
|
||||
$uses_groupby = $queryObject->getGroupByString() != '';
|
||||
if($uses_distinct || $uses_groupby) {
|
||||
$count_query = sprintf('select %s %s %s %s'
|
||||
, $temp_select
|
||||
, 'FROM ' . $queryObject->getFromString(true)
|
||||
, ($temp_where === '' ? '' : ' WHERE '. $temp_where)
|
||||
, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
|
||||
);
|
||||
|
||||
// If query uses grouping or distinct, count from original select
|
||||
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
|
||||
}
|
||||
|
||||
$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
|
||||
$this->param = $queryObject->getArguments();
|
||||
$result_count = $this->_query($count_query, $connection);
|
||||
$count_output = $this->_fetch($result_count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue