mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
parent
0c6bc8fbb1
commit
03e5909036
6 changed files with 81 additions and 4 deletions
|
|
@ -11,4 +11,5 @@ class IndexHint
|
|||
public $hint_type = '';
|
||||
public $index_name = '';
|
||||
public $table_name = '';
|
||||
public $var;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -469,7 +469,14 @@ class Query extends VariableBase
|
|||
{
|
||||
$key = $index_hint->hint_type ?: 'USE';
|
||||
$index_list[$key] = $index_list[$key] ?? [];
|
||||
$index_list[$key][] = $index_hint->index_name;
|
||||
if ($index_hint->var && isset($this->_args[$index_hint->var]))
|
||||
{
|
||||
$index_list[$key][] = self::quoteName($this->_args[$index_hint->var]);
|
||||
}
|
||||
elseif ($index_hint->index_name)
|
||||
{
|
||||
$index_list[$key][] = self::quoteName($index_hint->index_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -477,7 +484,10 @@ class Query extends VariableBase
|
|||
$result = [];
|
||||
foreach ($index_list as $key => $val)
|
||||
{
|
||||
$result[] = sprintf('%s INDEX (%s)', $key, implode(', ', $val));
|
||||
if (count($val))
|
||||
{
|
||||
$result[] = sprintf('%s INDEX (%s)', $key, implode(', ', $val));
|
||||
}
|
||||
}
|
||||
return implode(' ', $result);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue