function DatabaseSchema_mysql::createKeySql

3 calls to DatabaseSchema_mysql::createKeySql()
DatabaseSchema_mysql::addIndex in includes/database/mysql/schema.inc
Add an index.
DatabaseSchema_mysql::addPrimaryKey in includes/database/mysql/schema.inc
Add a primary key.
DatabaseSchema_mysql::addUniqueKey in includes/database/mysql/schema.inc
Add a unique key.

File

includes/database/mysql/schema.inc, line 289

Class

DatabaseSchema_mysql

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.