mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
- An index can have multiple columns :P
git-svn-id: file:///svn/phpbb/trunk@5796 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
8e18b11e34
commit
01fdcf2d83
1 changed files with 21 additions and 10 deletions
|
@ -108,9 +108,9 @@ class acp_database
|
|||
if ($download == true)
|
||||
{
|
||||
$name = $filename . $ext;
|
||||
header('Pragma: no-cache');
|
||||
header("Content-Type: $mimetype; name=\"$name\"");
|
||||
header("Content-disposition: attachment; filename=$name");
|
||||
//header('Pragma: no-cache');
|
||||
// header("Content-Type: $mimetype; name=\"$name\"");
|
||||
// header("Content-disposition: attachment; filename=$name");
|
||||
}
|
||||
|
||||
// All of the generated queries go here
|
||||
|
@ -1176,19 +1176,30 @@ class acp_database
|
|||
$db->sql_freeresult($result);
|
||||
$rows = array();
|
||||
|
||||
$sql = "EXEC sp_helpindex '$table_name'";
|
||||
$index = array();
|
||||
$sql = "EXEC sp_statistics '$table_name'";
|
||||
$result = $db->sql_query($sql);
|
||||
if ($db->sql_numrows($result))
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
if ($row['TYPE'] == 3)
|
||||
{
|
||||
if ($row['index_description'] == 'nonclustered located on PRIMARY')
|
||||
{
|
||||
$sql_data .= "\nCREATE INDEX [{$row['index_name']}] ON [$table_name]([{$row['index_keys']}]) ON [PRIMARY]\nGO\n";
|
||||
}
|
||||
$index[$row['INDEX_NAME']][] = $row['COLUMN_NAME'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($index as $index_name => $column_name)
|
||||
{
|
||||
$index[$index_name] = implode(', ', $index[$index_name]);
|
||||
}
|
||||
|
||||
if (sizeof($index))
|
||||
{
|
||||
foreach ($index as $index_name => $columns)
|
||||
{
|
||||
$sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]([$columns]) ON [PRIMARY]\nGO\n";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Reference in a new issue