mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Remove index hint classes for MS SQL and Cubrid
This commit is contained in:
parent
f00ba6f272
commit
6070707941
4 changed files with 2 additions and 154 deletions
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
/**
|
||||
* @author NAVER (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 __construct($name, $alias = NULL, $index_hints_list)
|
||||
{
|
||||
parent::__construct($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
|
||||
$prefix = config('db.master.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;
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file CubridTableWithHint.class.php */
|
||||
/* Location: ./classes/db/queryparts/table/CubridTableWithHint.class.php */
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
/**
|
||||
* @author NAVER (developers@xpressengine.com)
|
||||
* @package /classes/db/queryparts/table
|
||||
* @version 0.1
|
||||
*/
|
||||
class MssqlTableWithHint extends Table
|
||||
{
|
||||
|
||||
/**
|
||||
* table name
|
||||
* @var string
|
||||
*/
|
||||
var $name;
|
||||
|
||||
/**
|
||||
* table alias
|
||||
* @var string
|
||||
*/
|
||||
var $alias;
|
||||
|
||||
/**
|
||||
* index hint type, ex) IGNORE, FORCE, USE...
|
||||
* @var array
|
||||
*/
|
||||
var $index_hints_list;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string $name
|
||||
* @param string $alias
|
||||
* @param string $index_hints_list
|
||||
* @return void
|
||||
*/
|
||||
function __construct($name, $alias = NULL, $index_hints_list)
|
||||
{
|
||||
parent::__construct($name, $alias);
|
||||
$this->index_hints_list = $index_hints_list;
|
||||
}
|
||||
|
||||
function toString()
|
||||
{
|
||||
$result = parent::toString();
|
||||
|
||||
$index_hint_string = '';
|
||||
$indexTypeList = array('USE' => 1, 'FORCE' => 1);
|
||||
foreach($this->index_hints_list as $index_hint)
|
||||
{
|
||||
$index_hint_type = $index_hint->getIndexHintType();
|
||||
if(isset($indexTypeList[$index_hint_type]))
|
||||
{
|
||||
$index_hint_string .= 'INDEX(' . $index_hint->getIndexName() . '), ';
|
||||
}
|
||||
}
|
||||
if($index_hint_string != '')
|
||||
{
|
||||
$result .= ' WITH(' . substr($index_hint_string, 0, -2) . ') ';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file MssqlTableWithHint.class.php */
|
||||
/* Location: ./classes/db/queryparts/table/MssqlTableWithHint.class.php */
|
||||
Loading…
Add table
Add a link
Reference in a new issue