You are here

public function Schema::getComment in Drupal driver for SQL Server and SQL Azure 3.0.x

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::getComment()
  2. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::getComment()

Retrieve a table or column comment.

2 calls to Schema::getComment()
Schema::changeField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Change a field definition.
Schema::dropField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Should this be in a Transaction?

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 2042

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function getComment($table, $column = NULL) {
  $prefixInfo = $this
    ->getPrefixInfo($table, TRUE);
  $prefixed_table = $prefixInfo['table'];
  $schema = $this
    ->getDefaultSchema();
  $column_string = isset($column) ? "'Column','{$column}'" : "NULL,NULL";
  $sql = "SELECT value FROM fn_listextendedproperty ('MS_Description','Schema','{$schema}','Table','{$prefixed_table}',{$column_string})";
  $comment = $this->connection
    ->query($sql)
    ->fetchField();
  return $comment;
}