mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 08:42:15 +09:00
issue 2662 db class coding convention
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12216 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3daadb29dc
commit
d77d426c4f
16 changed files with 863 additions and 772 deletions
|
|
@ -1,59 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/db/queryparts/table
|
||||
* @version 0.1
|
||||
*/
|
||||
class MysqlTableWithHint extends Table
|
||||
{
|
||||
/**
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/db/queryparts/table
|
||||
* @version 0.1
|
||||
* table name
|
||||
* @var string
|
||||
*/
|
||||
class MysqlTableWithHint 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;
|
||||
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 MysqlTableWithHint($name, $alias = NULL, $index_hints_list){
|
||||
parent::Table($name, $alias);
|
||||
$this->index_hints_list = $index_hints_list;
|
||||
}
|
||||
|
||||
function toString(){
|
||||
$result = parent::toString();
|
||||
|
||||
$use_index_hint = ''; $force_index_hint = ''; $ignore_index_hint = '';
|
||||
foreach($this->index_hints_list as $index_hint){
|
||||
$index_hint_type = $index_hint->getIndexHintType();
|
||||
if($index_hint_type == 'USE') $use_index_hint .= $index_hint->getIndexName() . ', ';
|
||||
else if($index_hint_type == 'FORCE') $force_index_hint .= $index_hint->getIndexName() . ', ';
|
||||
else if($index_hint_type == 'IGNORE') $ignore_index_hint .= $index_hint->getIndexName() . ', ';
|
||||
}
|
||||
if($use_index_hint != ''){
|
||||
$result .= ' USE INDEX (' . substr($use_index_hint, 0, -2) . ') ';
|
||||
}
|
||||
if($force_index_hint != ''){
|
||||
$result .= ' FORCE INDEX (' . substr($force_index_hint, 0, -2) . ') ';
|
||||
}
|
||||
if($ignore_index_hint != ''){
|
||||
$result .= ' IGNORE INDEX (' . substr($ignore_index_hint, 0, -2) . ') ';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* constructor
|
||||
* @param string $name
|
||||
* @param string $alias
|
||||
* @param string $index_hints_list
|
||||
* @return void
|
||||
*/
|
||||
function MysqlTableWithHint($name, $alias = NULL, $index_hints_list)
|
||||
{
|
||||
parent::Table($name, $alias);
|
||||
$this->index_hints_list = $index_hints_list;
|
||||
}
|
||||
|
||||
?>
|
||||
function toString()
|
||||
{
|
||||
$result = parent::toString();
|
||||
|
||||
$use_index_hint = ''; $force_index_hint = ''; $ignore_index_hint = '';
|
||||
foreach($this->index_hints_list as $index_hint)
|
||||
{
|
||||
$index_hint_type = $index_hint->getIndexHintType();
|
||||
if($index_hint_type == 'USE') $use_index_hint .= $index_hint->getIndexName() . ', ';
|
||||
else if($index_hint_type == 'FORCE') $force_index_hint .= $index_hint->getIndexName() . ', ';
|
||||
else if($index_hint_type == 'IGNORE') $ignore_index_hint .= $index_hint->getIndexName() . ', ';
|
||||
}
|
||||
if($use_index_hint != '')
|
||||
{
|
||||
$result .= ' USE INDEX (' . substr($use_index_hint, 0, -2) . ') ';
|
||||
}
|
||||
if($force_index_hint != '')
|
||||
{
|
||||
$result .= ' FORCE INDEX (' . substr($force_index_hint, 0, -2) . ') ';
|
||||
}
|
||||
if($ignore_index_hint != '')
|
||||
{
|
||||
$result .= ' IGNORE INDEX (' . substr($ignore_index_hint, 0, -2) . ') ';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
/* End of file MysqlTableWithHint.class.php */
|
||||
/* Location: ./classes/db/queryparts/table/MysqlTableWithHint.class.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue