| Versionen | |
|---|---|
| drupal7 | public DatabaseSchema_mysql::getComment($table, $column = NULL) |
Retrieve a table or column comment.
includes/
<?php
public function getComment($table, $column = NULL) {
$condition = $this->buildTableNameCondition($this->connection->prefixTables('{' . $table . '}'));
if (isset($column)) {
$condition->condition('column_name', $column);
$condition->compile($this->connection);
// Don't use {} around information_schema table.
return db_query("SELECT column_comment FROM information_schema.columns WHERE " . (string) $condition, $condition->arguments())->fetchField();
}
$condition->compile($this->connection);
// Don't use {} around information_schema table.
$comment = db_query("SELECT table_comment FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchField();
// Work-around for MySQL 5.0 bug http://bugs.mysql.com/bug.php?id=11379
return preg_replace('/; InnoDB free:.*$/', '', $comment);
}
?>
Kommentare
Kommentar hinzufügen