You are here

function dba_table_describe in Database Administration 5

1 call to dba_table_describe()
dba_admin_tables_describe in ./dba.module
Describe the schema of the selected table.

File

./dba.module, line 743
Allows administrators direct access to their Drupal database. Written by Jeremy Andrews <jeremy@kerneltrap.org>, June 2004. PostgreSQL functionality provided by AAM <aam@ugpl.de> Major security audit, porting, and maintenance by Derek…

Code

function dba_table_describe($table) {
  $rows = array();
  $tables = dba_get_active_tables();
  $quantity = count($tables);
  if ($quantity == 1) {
    drupal_set_title(t('Describe table %table', array(
      '%table' => $table,
    )));
    $result = dba_describe_table($table);
    while ($row = db_fetch_array($result)) {
      if (!$header) {
        $header = array_keys($row);
      }
      $rows[] = (array) $row;
    }
    return theme('table', $header, $rows);
  }
  else {
    drupal_set_message(t('Unable to describe more than one table at a time.'), 'error');
    $output .= dba_database_overview();
  }
  return $output;
}