You are here

public function DatabaseSchema_pgsql::getComment in Drupal 7

Retrieve a table or column comment.

File

includes/database/pgsql/schema.inc, line 607
Database schema code for PostgreSQL database servers.

Class

DatabaseSchema_pgsql

Code

public function getComment($table, $column = NULL) {
  $info = $this
    ->getPrefixInfo($table);

  // Don't use {} around pg_class, pg_attribute tables.
  if (isset($column)) {
    return $this->connection
      ->query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', array(
      $info['table'],
      $column,
    ))
      ->fetchField();
  }
  else {
    return $this->connection
      ->query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?', array(
      'pg_class',
      $info['table'],
    ))
      ->fetchField();
  }
}