// information_schema.columns so we need to check if the table exists.
returnFALSE;
}
$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.
$comment=$this->connection->query("SELECT table_comment AS 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$this->connection->query("SELECT table_comment AS table_comment FROM information_schema.tables WHERE ".(string)$condition,$condition->arguments())->fetchField();
@@ -1056,16 +1056,24 @@ protected function _createKeys($table, $new_keys) {
}
/**
* Retrieve a table or column comment.
* Retrieves a table or column comment.
*
* @param string $table
* The table name.
* @param string|null $column
* (optional) The column name.
*
* @return string|false
* The table or column comment. FALSE if the table or column does not exist.
*/
publicfunctiongetComment($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 = ?',[$info['table'],$column])->fetchField();
return$this->connection->query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?',[$info['table'],$column])->fetchField()??FALSE;
}
else{
return$this->connection->query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?',['pg_class',$info['table']])->fetchField();
return$this->connection->query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?',['pg_class',$info['table']])->fetchField()??FALSE;