mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-20 19:02:14 +09:00
Issue 2230: On delete duplicate indexes (CUBRID), delete the index that was created using prefix
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11019 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
b7df903799
commit
f1b8aef579
1 changed files with 15 additions and 7 deletions
|
|
@ -506,7 +506,7 @@
|
|||
$target_columns = array ($target_columns);
|
||||
}
|
||||
|
||||
$query = sprintf ("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique?'unique':'', $this->prefix .$index_name, $this->prefix, $table_name, '"'.implode('","',$target_columns).'"');
|
||||
$query = sprintf ("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique?'unique':'', $index_name, $this->prefix, $table_name, '"'.implode('","',$target_columns).'"');
|
||||
|
||||
$this->_query ($query);
|
||||
}
|
||||
|
|
@ -520,7 +520,7 @@
|
|||
*/
|
||||
function dropIndex ($table_name, $index_name, $is_unique = FALSE)
|
||||
{
|
||||
$query = sprintf ("drop %s index \"%s\" on \"%s%s\"", $is_unique?'unique':'', $this->prefix .$index_name, $this->prefix, $table_name);
|
||||
$query = sprintf ("drop %s index \"%s\" on \"%s%s\"", $is_unique?'unique':'', $index_name, $this->prefix, $table_name);
|
||||
|
||||
$this->_query($query);
|
||||
}
|
||||
|
|
@ -533,7 +533,7 @@
|
|||
*/
|
||||
function isIndexExists ($table_name, $index_name)
|
||||
{
|
||||
$query = sprintf ("select \"index_name\" from \"db_index\" where ". "\"class_name\" = '%s%s' and \"index_name\" = '%s' ", $this->prefix, $table_name, $this->prefix .$index_name);
|
||||
$query = sprintf ("select \"index_name\" from \"db_index\" where ". "\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix .$index_name, $index_name);
|
||||
$result = $this->_query ($query);
|
||||
|
||||
if ($this->isError ()) return FALSE;
|
||||
|
|
@ -581,10 +581,18 @@
|
|||
$output = $this->_fetch ($result);
|
||||
if (!$output) return FALSE;
|
||||
|
||||
$indexes_to_be_deleted = $output->data;
|
||||
if(!is_array($output)) {
|
||||
$indexes_to_be_deleted = array($output);
|
||||
}
|
||||
else {
|
||||
$indexes_to_be_deleted = $output;
|
||||
}
|
||||
|
||||
foreach($indexes_to_be_deleted as $index)
|
||||
{
|
||||
$this->dropIndex($index->class_name, $index->unprefixed_index_name, $index->is_unique == 'YES' ? TRUE : FALSE);
|
||||
$this->dropIndex(substr($index->class_name, strlen($this->prefix))
|
||||
, $this->prefix . $index->unprefixed_index_name
|
||||
, $index->is_unique == 'YES' ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -718,14 +726,14 @@
|
|||
|
||||
if (count ($unique_list)) {
|
||||
foreach ($unique_list as $key => $val) {
|
||||
$query = sprintf ("create unique index \"%s\" on \"%s\" ". "(%s);", $this->prefix .$key, $table_name, '"'.implode('","', $val).'"');
|
||||
$query = sprintf ("create unique index \"%s\" on \"%s\" ". "(%s);", $key, $table_name, '"'.implode('","', $val).'"');
|
||||
$this->_query ($query);
|
||||
}
|
||||
}
|
||||
|
||||
if (count ($index_list)) {
|
||||
foreach ($index_list as $key => $val) {
|
||||
$query = sprintf ("create index \"%s\" on \"%s\" (%s);", $this->prefix .$key, $table_name, '"'.implode('","',$val).'"');
|
||||
$query = sprintf ("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"'.implode('","',$val).'"');
|
||||
$this->_query ($query);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue