BUG: Fixed MSSQL index name generation for tables with \ in the name.

Right now the name of a table with a namespace will contain a '\' character.  The internal index name generated clashes with this, so we've dealt with it by turning the '\' into a '_'
This commit is contained in:
Sam Minnee 2012-06-26 14:52:18 +12:00
parent 22d53b036b
commit 05e706ea18

View File

@ -830,7 +830,7 @@ class MSSQLDatabase extends SS_Database {
* Return SQL for dropping and recreating an index * Return SQL for dropping and recreating an index
*/ */
protected function getIndexSqlDefinition($tableName, $indexName, $indexSpec) { protected function getIndexSqlDefinition($tableName, $indexName, $indexSpec) {
$index = 'ix_' . $tableName . '_' . $indexName; $index = 'ix_' . str_replace('\\', '_', $tableName) . '_' . $indexName;
$drop = "IF EXISTS (SELECT name FROM sys.indexes WHERE name = '$index') DROP INDEX $index ON \"" . $tableName . "\";"; $drop = "IF EXISTS (SELECT name FROM sys.indexes WHERE name = '$index') DROP INDEX $index ON \"" . $tableName . "\";";
if(!is_array($indexSpec)) { if(!is_array($indexSpec)) {