You are here

protected function Schema::createKeySql in Drupal driver for SQL Server and SQL Azure 8

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

Returns a list of field names coma separated ready to be used in a SQL Statement.

Parameters

array $fields:

boolean $as_array:

Return value

array|string

2 calls to Schema::createKeySql()
Schema::createIndexSql in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Returns the SQL needed (incomplete) to create and index. Supports XML indexes.
Schema::createPrimaryKey in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Create a Primary Key for the table, does not drop any prior primary keys neither it takes care of cleaning technical primary column. Only call this if you are sure the table does not currently hold a primary key.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 748
Definition of Drupal\Driver\Database\sqlsrv\Schema

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function createKeySql($fields, $as_array = FALSE) {
  $ret = array();
  foreach ($fields as $field) {
    if (is_array($field)) {
      $ret[] = $field[0];
    }
    else {
      $ret[] = $field;
    }
  }
  if ($as_array) {
    return $ret;
  }
  return implode(', ', $ret);
}