Added index hints for CUBRID and Mysql.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9472 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-10-03 17:35:25 +00:00
parent 0b8949cfeb
commit 96b60466be
18 changed files with 350 additions and 4 deletions

View file

@ -28,6 +28,9 @@
require(_XE_PATH_.'classes/db/queryparts/expression/UpdateExpression.class.php');
require(_XE_PATH_.'classes/db/queryparts/table/Table.class.php');
require(_XE_PATH_.'classes/db/queryparts/table/JoinTable.class.php');
require(_XE_PATH_.'classes/db/queryparts/table/CubridTableWithHint.class.php');
require(_XE_PATH_.'classes/db/queryparts/table/MysqlTableWithHint.class.php');
require(_XE_PATH_.'classes/db/queryparts/table/IndexHint.class.php');
require(_XE_PATH_.'classes/db/queryparts/condition/ConditionGroup.class.php');
require(_XE_PATH_.'classes/db/queryparts/condition/Condition.class.php');
require(_XE_PATH_.'classes/db/queryparts/condition/ConditionWithArgument.class.php');
@ -557,6 +560,15 @@
$where = $query->getWhereString($with_values);
if($where != '') $where = ' WHERE ' . $where;
$tableObjects = $query->getTables();
$index_hint_list = '';
foreach($tableObjects as $tableObject){
if(is_a($tableObject, 'CubridTableWithHint'))
$index_hint_list .= $tableObject->getIndexHintString() . ', ';
}
if($index_hint_list != '')
$index_hint_list = 'USING INDEX ' . substr($index_hint_list, 0, -2);
$groupBy = $query->getGroupByString();
if($groupBy != '') $groupBy = ' GROUP BY ' . $groupBy;
@ -566,7 +578,7 @@
$limit = $query->getLimitString();
if($limit != '') $limit = ' LIMIT ' . $limit;
return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
}
function getDeleteSql($query, $with_values = true){