コード例 #1
0
 /**
  * Get all indexed columns
  *
  * returns an array with all columns make use of an index, in fact only
  * first columns in an index
  *
  * e.g. index(col1, col2) would only return col1
  *
  * @param bool $backquoted whether to quote name with backticks ``
  *
  * @return array
  */
 public function getIndexedColumns($backquoted = true)
 {
     $sql = PMA_DBI_get_table_indexes_sql($this->getDbName(), $this->getName(), 'Seq_in_index = 1');
     $indexed = PMA_DBI_fetch_result($sql, 'Column_name', 'Column_name');
     $return = array();
     foreach ($indexed as $column) {
         $return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column);
     }
     return $return;
 }
コード例 #2
0
/**
* Returns indexes of a table
*
* @param string $database name of database
* @param string $table    name of the table whose indexes are to be retrieved
* @param mixed  $link     mysql link resource
*
* @return array   $indexes
*/
function PMA_DBI_get_table_indexes($database, $table, $link = null)
{
    $sql = PMA_DBI_get_table_indexes_sql($database, $table);
    $indexes = PMA_DBI_fetch_result($sql, null, null, $link);
    if (!is_array($indexes) || count($indexes) < 1) {
        return array();
    }
    return $indexes;
}