mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 14:52:24 +09:00
add index hint of using "where" syntax
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9471 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cebf35f92a
commit
0b8949cfeb
8 changed files with 51 additions and 42 deletions
|
|
@ -616,7 +616,8 @@
|
|||
if ($limit && $limit->isPageHandler()) {
|
||||
|
||||
// Total count
|
||||
$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString(), ($queryObject->getWhereString() === '' ? '' : ' WHERE '. $queryObject->getWhereString()));
|
||||
$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);
|
||||
}
|
||||
|
|
@ -683,11 +684,8 @@
|
|||
$from = ' FROM '.$from;
|
||||
|
||||
$where = $query->getWhereString($with_values);
|
||||
if($where != ''){
|
||||
if($where != '')
|
||||
$where = ' WHERE ' . $where;
|
||||
if(strstr($where,'list_order')) $where .= ' and list_order < 2100000000 ';
|
||||
if(strstr($where,'update_order')) $where .= ' and update_order < 2100000000 ';
|
||||
}
|
||||
|
||||
$groupBy = $query->getGroupByString();
|
||||
if($groupBy != '') $groupBy = ' GROUP BY ' . $groupBy;
|
||||
|
|
@ -696,23 +694,7 @@
|
|||
if($orderBy != '') $orderBy = ' ORDER BY ' . $orderBy;
|
||||
|
||||
$limit = $query->getLimitString();
|
||||
if ($limit != '') {
|
||||
if ($query->getLimit()) {
|
||||
|
||||
if($orderBy != '')
|
||||
$limit = sprintf (' for orderby_num() between %d and %d', $start_count + 1, $list_count + $start_count);
|
||||
else{
|
||||
if($groupBy != '')
|
||||
$limit = sprintf (' having groupby_num() between %d and %d', $start_count + 1, $list_count + $start_count);
|
||||
else{
|
||||
if ($where != '')
|
||||
$limit = sprintf (' and inst_num() between %d and %d', $start_count + 1, $list_count + $start_count);
|
||||
else
|
||||
$limit = sprintf(' where inst_num() between %d and %d', $start_count + 1, $list_count + $start_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($limit != '') $limit = sprintf (' LIMIT %d, %d', $start_count, $list_count);
|
||||
|
||||
return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue