You are here

function dba_describe_table in Database Administration 5

Same name and namespace in other branches
  1. 7 dba.admin.inc \dba_describe_table()

Describe table.

Related topics

2 calls to dba_describe_table()
dba_get_primary_key in ./dba.module
dba_table_describe in ./dba.module

File

./dba.module, line 1395
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_describe_table($table, $verbose = TRUE) {
  if (_is_mysql()) {
    $query = 'DESCRIBE ' . db_escape_table($table) . ';';
  }
  else {

    // Lowercase names of resulting colums are important for PostgreSQL.
    $query = "SELECT tabname as table, colname as field, coltype as type, colnull as null, coldefault as default, colextra as extra FROM {drupal_system_catalog} WHERE tabname = '{" . db_escape_table($table) . "}' ORDER BY colextra;";
  }
  if ($verbose) {
    drupal_set_message($query);
  }
  return db_query($query);
}