Use PMA_DBI_get_table_indexes_sql() only when really needed, in all other cases use PMA_DBI_get_table_indexes()
This commit is contained in:
parent
a31b30ba57
commit
57bea0630a
@ -76,7 +76,7 @@ foreach($tables as $table) {
|
||||
*/
|
||||
|
||||
PMA_DBI_select_db($db);
|
||||
$result = PMA_DBI_query(PMA_DBI_get_table_indexes_sql($db, $table));
|
||||
$indexes = PMA_DBI_get_table_indexes($db, $table);
|
||||
$primary = '';
|
||||
$indexes = array();
|
||||
$lastIndex = '';
|
||||
@ -84,7 +84,7 @@ foreach($tables as $table) {
|
||||
$indexes_data = array();
|
||||
$pk_array = array(); // will be use to emphasis prim. keys in the table
|
||||
// view
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
foreach ($indexes as $row) {
|
||||
// Backups the list of primary keys
|
||||
if ($row['Key_name'] == 'PRIMARY') {
|
||||
$primary .= $row['Column_name'] . ', ';
|
||||
@ -111,10 +111,6 @@ foreach($tables as $table) {
|
||||
}
|
||||
|
||||
} // end while
|
||||
if ($result) {
|
||||
PMA_DBI_free_result($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets columns properties
|
||||
|
||||
@ -755,8 +755,8 @@ if (isset($Field) && count($Field) > 0) {
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
foreach ($tab_all as $tab) {
|
||||
$ind_rs = PMA_DBI_query(PMA_DBI_get_table_indexes_sql($db, $tab));
|
||||
while ($ind = PMA_DBI_fetch_assoc($ind_rs)) {
|
||||
$indexes = PMA_DBI_get_table_indexes($db, $tab);
|
||||
foreach ($indexes as $ind) {
|
||||
$col1 = $tab . '.' . $ind['Column_name'];
|
||||
if (isset($col_all[$col1])) {
|
||||
if ($ind['Non_unique'] == 0) {
|
||||
|
||||
@ -157,7 +157,7 @@ class PMA_Index
|
||||
return true;
|
||||
}
|
||||
|
||||
$_raw_indexes = PMA_DBI_fetch_result(PMA_DBI_get_table_indexes_sql($schema, $table));
|
||||
$_raw_indexes = PMA_DBI_get_table_indexes($schema, $table);
|
||||
foreach ($_raw_indexes as $_each_index) {
|
||||
$_each_index['Schema'] = $schema;
|
||||
if (! isset(PMA_Index::$_registry[$schema][$table][$_each_index['Key_name']])) {
|
||||
|
||||
@ -259,9 +259,6 @@ class PMA_Tracker
|
||||
}
|
||||
|
||||
$indexes = PMA_DBI_get_table_indexes($dbname, $tablename);
|
||||
if (!$indexes) {
|
||||
$indexes = array();
|
||||
}
|
||||
|
||||
$snapshot = array('COLUMNS' => $columns, 'INDEXES' => $indexes);
|
||||
$snapshot = serialize($snapshot);
|
||||
|
||||
@ -1104,7 +1104,7 @@ function PMA_DBI_get_table_indexes_sql($database, $table, $where = null)
|
||||
}
|
||||
|
||||
/**
|
||||
* array PMA_DBI_get_table_indexes($database, $table, $link = null)
|
||||
* Returns indexes od a table
|
||||
*
|
||||
* @param string $database name of database
|
||||
* @param string $table name of the table whose indexes are to be retreived
|
||||
@ -1117,7 +1117,7 @@ function PMA_DBI_get_table_indexes($database, $table, $link = null)
|
||||
$indexes = PMA_DBI_fetch_result($sql, null, null, $link);
|
||||
|
||||
if (! is_array($indexes) || count($indexes) < 1) {
|
||||
return false;
|
||||
return array();
|
||||
}
|
||||
return $indexes;
|
||||
}
|
||||
|
||||
@ -199,15 +199,13 @@ if (isset($plugin_list)) {
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
$unique_keys = array();
|
||||
$keys = PMA_DBI_get_table_indexes($db, $table);
|
||||
foreach ($keys as $key) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
|
||||
@ -302,15 +302,13 @@ if (isset($plugin_list)) {
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
$unique_keys = array();
|
||||
$keys = PMA_DBI_get_table_indexes($db, $table);
|
||||
foreach ($keys as $key) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
|
||||
@ -237,15 +237,13 @@ if (isset($plugin_list)) {
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
$unique_keys = array();
|
||||
$keys = PMA_DBI_get_table_indexes($db, $table);
|
||||
foreach ($keys as $key) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
|
||||
@ -181,15 +181,13 @@ if (isset($plugin_list)) {
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
$unique_keys = array();
|
||||
$keys = PMA_DBI_get_table_indexes($db, $table);
|
||||
foreach ($keys as $key) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
|
||||
Loading…
Reference in New Issue
Block a user