1 schema.inc protected DatabaseSchema_mysql::createKeySql($fields)

Generates a string suitable for creating key across multiple fields.

Parameters

array|string $fields: The list of table fields to be included in the key.

Return value

string: The list of fields concatenated together, separated by commas.

File

core/includes/database/mysql/schema.inc, line 302
Database schema code for MySQL database servers.

Class

DatabaseSchema_mysql
Class to create and manipulate MySQL tables.

Code

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