You are here

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

Same name and namespace in other branches
  1. 4.2.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::getComment()
  2. 3.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::getComment()
  3. 4.0.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::getComment()

Retrieve a table or column comment.

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

File

src/Driver/Database/sqlsrv/Schema.php, line 2002

Class

Schema

Namespace

Drupal\sqlsrv\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;
}