DatabaseSchema::createTable
public function DatabaseSchema::createTable
public DatabaseSchema::createTable($name, $table)
Create a new table from a Drupal table definition.
Parameters
$name: The name of the table to create.
$table: A Schema API table definition array.
Throws
DatabaseSchemaObjectExistsException If the specified table already exists.
File
- includes/database/schema.inc, line 658
- Generic Database schema code.
Class
Code
public function createTable($name, $table) { if ($this->tableExists($name)) { throw new DatabaseSchemaObjectExistsException(t('Table @name already exists.', array('@name' => $name))); } $statements = $this->createTableSql($name, $table); foreach ($statements as $statement) { $this->connection->query($statement); } }
© 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/includes!database!schema.inc/function/DatabaseSchema::createTable/7.x