function Schema::getComment
Same name in this branch
- 11.x core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::getComment()
Same name and namespace in other branches
- 10 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::getComment()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::getComment()
- 9 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::getComment()
- 9 core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::getComment()
- 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::getComment()
- 8.9.x core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php \Drupal\Core\Database\Driver\pgsql\Schema::getComment()
Retrieves a table or column comment.
Parameters
string $table: The table name.
string|null $column: (optional) The column name.
Return value
string|false The table or column comment. FALSE if the table or column does not exist.
File
-
core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Schema.php, line 684
Class
- Schema
- MySQL implementation of \Drupal\Core\Database\Schema.
Namespace
Drupal\mysql\Driver\Database\mysqlCode
public function getComment($table, $column = NULL) {
$condition = $this->buildTableNameCondition($table);
if (isset($column)) {
if (!$this->tableExists($table)) {
// If the table is a view it will be present in
// information_schema.columns so we need to check if the table exists.
return FALSE;
}
$condition->condition('column_name', $column);
$condition->compile($this->connection, $this);
// Don't use {} around information_schema.columns table.
return $this->connection
->query("SELECT column_comment AS column_comment FROM information_schema.columns WHERE " . (string) $condition, $condition->arguments())
->fetchField();
}
$condition->condition('table_type', 'BASE TABLE');
$condition->compile($this->connection, $this);
// Don't use {} around information_schema.tables table.
return $this->connection
->query("SELECT table_comment AS table_comment FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())
->fetchField();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.