protected function DatabaseSchema_sqlite::createIndexSql

7.x schema.inc protected DatabaseSchema_sqlite::createIndexSql($tablename, $schema)

Build the SQL expression for indexes.

4 calls to DatabaseSchema_sqlite::createIndexSql()
DatabaseSchema_sqlite::addIndex in drupal-7.x/includes/database/sqlite/schema.inc
Add an index.
DatabaseSchema_sqlite::addUniqueKey in drupal-7.x/includes/database/sqlite/schema.inc
Add a unique key.
DatabaseSchema_sqlite::createTableSql in drupal-7.x/includes/database/sqlite/schema.inc
Generate SQL to create a new table from a Drupal schema definition.
DatabaseSchema_sqlite::renameTable in drupal-7.x/includes/database/sqlite/schema.inc
Rename a table.

File

drupal-7.x/includes/database/sqlite/schema.inc, line 52
Database schema code for SQLite databases.

Class

DatabaseSchema_sqlite

Code

protected function createIndexSql($tablename, $schema) {
  $sql = array();
  $info = $this->getPrefixInfo($tablename);
  if (!empty($schema['unique keys'])) {
    foreach ($schema['unique keys'] as $key => $fields) {
      $sql[] = 'CREATE UNIQUE INDEX ' . $info['schema'] . '.' . $info['table'] . '_' . $key . ' ON ' . $info['table'] . ' (' . $this->createKeySql($fields) . "); \n";
    }
  }
  if (!empty($schema['indexes'])) {
    foreach ($schema['indexes'] as $key => $fields) {
      $sql[] = 'CREATE INDEX ' . $info['schema'] . '.' . $info['table'] . '_' . $key . ' ON ' . $info['table'] . ' (' . $this->createKeySql($fields) . "); \n";
    }
  }
  return $sql;
}