W3cubDocs

/Drupal 8

public function Schema::getComment

public Schema::getComment($table, $column = NULL)

Retrieve a table or column comment.

File

core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php, line 821

Class

Schema
PostgreSQL implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\Core\Database\Driver\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();
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!pgsql!Schema.php/function/Schema::getComment/8.1.x