W3cubDocs

/Drupal 8

public function Schema::createTableSql

public Schema::createTableSql($name, $table)

Generate SQL to create a new table from a Drupal schema definition.

Parameters

$name: The name of the table to create.

$table: A Schema API table definition array.

Return value

An array of SQL statements to create the table.

File

core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php, line 47

Class

Schema
SQLite implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

public function createTableSql($name, $table) {
  $sql = array();
  $sql[] = "CREATE TABLE {" . $name . "} (\n" . $this->createColumnsSql($name, $table) . "\n)\n";
  return array_merge($sql, $this->createIndexSql($name, $table));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!sqlite!Schema.php/function/Schema::createTableSql/8.1.x