From 6bfa6e9d0fdb336164724d3ac0e183d60e86b3ba Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 8 Dec 2009 20:53:15 +0000 Subject: [PATCH] BUGFIX Make use of fulltextIndexExists() in MSSQLDatabase::getIndexSqlDefinition() instead of issuing it's own query to do so --- code/MSSQLDatabase.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/MSSQLDatabase.php b/code/MSSQLDatabase.php index 724451a..57d194e 100644 --- a/code/MSSQLDatabase.php +++ b/code/MSSQLDatabase.php @@ -682,14 +682,14 @@ class MSSQLDatabase extends SS_Database { if($this->fullTextEnabled) { //Enable full text search. $this->createFullTextCatalog(); - + $primary_key=$this->getPrimaryKey($tableName); - - //First, we need to see if a full text search already exists: - $result=$this->query("SELECT object_id FROM sys.fulltext_indexes WHERE object_id=object_id('$tableName');")->first(); $drop = ''; - if($result) $drop = "DROP FULLTEXT INDEX ON \"" . $tableName . "\";"; + if($this->fulltextIndexExists($tableName)) { + $drop = "DROP FULLTEXT INDEX ON \"$tableName\";"; + } + return $drop . "CREATE FULLTEXT INDEX ON \"$tableName\" ({$indexSpec['value']}) KEY INDEX $primary_key WITH CHANGE_TRACKING AUTO;"; } }