You are here

protected function DatabaseSchema_sqlsrv::createKeySql in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::createKeySql()
  2. 7 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::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 DatabaseSchema_sqlsrv::createKeySql()
DatabaseSchema_sqlsrv::createIndexSql in sqlsrv/schema.inc
Returns the SQL needed (incomplete) to create and index. Supports XML indexes.
DatabaseSchema_sqlsrv::createPrimaryKey in sqlsrv/schema.inc
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

sqlsrv/schema.inc, line 739
Database schema code for Microsoft SQL Server database servers.

Class

DatabaseSchema_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);
}