mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
MINOR Code syntax formatting
This commit is contained in:
parent
f211d2cea8
commit
c44f5ca9ed
@ -785,42 +785,38 @@ class MSSQLDatabase extends SS_Database {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function indexList($table) {
|
public function indexList($table) {
|
||||||
$indexes=DB::query("EXEC sp_helpindex '$table';");
|
$indexes = DB::query("EXEC sp_helpindex '$table';");
|
||||||
$prefix = '';
|
$prefix = '';
|
||||||
$indexList = array();
|
$indexList = array();
|
||||||
|
|
||||||
foreach($indexes as $index) {
|
foreach($indexes as $index) {
|
||||||
|
if(strpos($index['index_description'], 'unique') !== false) {
|
||||||
//Check for uniques:
|
|
||||||
if(strpos($index['index_description'], 'unique')!==false)
|
|
||||||
$prefix='unique ';
|
$prefix='unique ';
|
||||||
|
}
|
||||||
$key=str_replace(', ', ',', $index['index_keys']);
|
|
||||||
$indexList[$key]['indexname']=$index['index_name'];
|
$key = str_replace(', ', ',', $index['index_keys']);
|
||||||
$indexList[$key]['spec']=$prefix . '(' . $key . ')';
|
$indexList[$key]['indexname'] = $index['index_name'];
|
||||||
|
$indexList[$key]['spec'] = $prefix . '(' . $key . ')';
|
||||||
}
|
|
||||||
|
|
||||||
//Now we need to check to see if we have any fulltext indexes attached to this table:
|
|
||||||
if($this->fullTextEnabled()) {
|
|
||||||
$result=DB::query('EXEC sp_help_fulltext_columns;');
|
|
||||||
$columns='';
|
|
||||||
foreach($result as $row){
|
|
||||||
|
|
||||||
if($row['TABLE_NAME']==$table)
|
|
||||||
$columns.=$row['FULLTEXT_COLUMN_NAME'] . ',';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if($columns!=''){
|
|
||||||
$columns=trim($columns, ',');
|
|
||||||
$indexList['SearchFields']['indexname']='SearchFields';
|
|
||||||
$indexList['SearchFields']['spec']='fulltext (' . $columns . ')';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $indexList;
|
// Now we need to check to see if we have any fulltext indexes attached to this table:
|
||||||
|
if($this->fullTextEnabled()) {
|
||||||
|
$result = DB::query('EXEC sp_help_fulltext_columns;');
|
||||||
|
$columns = '';
|
||||||
|
foreach($result as $row) {
|
||||||
|
if($row['TABLE_NAME'] == $table) {
|
||||||
|
$columns .= $row['FULLTEXT_COLUMN_NAME'] . ',';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($columns!=''){
|
||||||
|
$columns=trim($columns, ',');
|
||||||
|
$indexList['SearchFields']['indexname'] = 'SearchFields';
|
||||||
|
$indexList['SearchFields']['spec'] = 'fulltext (' . $columns . ')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $indexList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user