rhymix/classes/db/queryparts/table/CubridTableWithHint.class.php
flyskyko 54e3a72065 merge from 1.5.3 (~r10943)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@10951 201d5d3c-b55e-5fd7-737f-ddc643e51545
2012-07-27 02:47:10 +00:00

62 lines
1.7 KiB
PHP

<?php
/**
* @author NHN (developers@xpressengine.com)
* @package /classes/db/queryparts/table
* @version 0.1
*/
class CubridTableWithHint extends Table {
/**
* table name
* @var string
*/
var $name;
/**
* table alias
* @var string
*/
var $alias;
/**
* index hint list
* @var array
*/
var $index_hints_list;
/**
* constructor
* @param string $name
* @param string $alias
* @param array $index_hints_list
* @return void
*/
function CubridTableWithHint($name, $alias = NULL, $index_hints_list){
parent::Table($name, $alias);
$this->index_hints_list = $index_hints_list;
}
/**
* Return index hint string
* @return string
*/
function getIndexHintString(){
$result = '';
// Retrieve table prefix, to add it to index name
$db_info = Context::getDBInfo();
$prefix = $db_info->master_db["db_table_prefix"];
foreach($this->index_hints_list as $index_hint){
$index_hint_type = $index_hint->getIndexHintType();
if($index_hint_type !== 'IGNORE'){
$result .= $this->alias . '.'
. '"' . $prefix . substr($index_hint->getIndexName(), 1)
. ($index_hint_type == 'FORCE' ? '(+)' : '')
. ', ';
}
}
$result = substr($result, 0, -2);
return $result;
}
}
?>