mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-08 19:42:15 +09:00
Issue 1965: Delete legacy CUBRID indexes (on recreate cache).
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10646 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ab0d78ffde
commit
018b29f09f
2 changed files with 50 additions and 0 deletions
|
|
@ -464,6 +464,48 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteDuplicateIndexes()
|
||||||
|
{
|
||||||
|
$query = sprintf("
|
||||||
|
select \"class_name\"
|
||||||
|
, case
|
||||||
|
when substr(\"index_name\", 0, %d) = '%s'
|
||||||
|
then substr(\"index_name\", %d)
|
||||||
|
else \"index_name\" end as unprefixed_index_name
|
||||||
|
, \"is_unique\"
|
||||||
|
from \"db_index\"
|
||||||
|
where \"class_name\" like %s
|
||||||
|
group by \"class_name\"
|
||||||
|
, case
|
||||||
|
when substr(\"index_name\", 0, %d) = '%s'
|
||||||
|
then substr(\"index_name\", %d)
|
||||||
|
else \"index_name\"
|
||||||
|
end
|
||||||
|
having count(*) > 1
|
||||||
|
", strlen($this->prefix)
|
||||||
|
, $this->prefix
|
||||||
|
, strlen($this->prefix) + 1
|
||||||
|
, "'" . $this->prefix . '%' . "'"
|
||||||
|
, strlen($this->prefix)
|
||||||
|
, $this->prefix
|
||||||
|
, strlen($this->prefix) + 1
|
||||||
|
);
|
||||||
|
$result = $this->_query ($query);
|
||||||
|
|
||||||
|
if ($this->isError ()) return false;
|
||||||
|
|
||||||
|
$output = $this->_fetch ($result);
|
||||||
|
if (!$output) return false;
|
||||||
|
|
||||||
|
$indexes_to_be_deleted = $output->data;
|
||||||
|
foreach($indexes_to_be_deleted as $index)
|
||||||
|
{
|
||||||
|
$this->dropIndex($index->class_name, $index->unprefixed_index_name, $index->is_unique == 'YES' ? true : false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief creates a table by using xml file
|
* @brief creates a table by using xml file
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove duplicate indexes (only for CUBRID)
|
||||||
|
$db_type = &Context::getDBType();
|
||||||
|
if($db_type == 'cubrid')
|
||||||
|
{
|
||||||
|
$db = &DB::getInstance();
|
||||||
|
$db->deleteDuplicateIndexes();
|
||||||
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue