You are here

protected function Schema::createCommentSql in Drupal driver for SQL Server and SQL Azure 3.0.x

Create the SQL statement to add a new comment.

2 calls to Schema::createCommentSql()
Schema::addField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Add a new field to a table.
Schema::createTableSql in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Generate SQL to create a new table from a Drupal schema definition.

File

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

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function createCommentSql($value, $table = NULL, $column = NULL) {
  $schema = $this
    ->getDefaultSchema();
  $value = $this
    ->prepareComment($value);
  $prefixInfo = $this
    ->getPrefixInfo($table, TRUE);
  $prefixed_table = $prefixInfo['table'];
  $sql = "EXEC sp_addextendedproperty @name=N'MS_Description', @value={$value}";
  $sql .= ",@level0type = N'Schema', @level0name = '{$schema}'";
  if (isset($table)) {
    $sql .= ",@level1type = N'Table', @level1name = '{$prefixed_table}'";
    if (isset($column)) {
      $sql .= ",@level2type = N'Column', @level2name = '{$column}'";
    }
  }
  return $sql;
}