createTableSql example


  public function createTable($name$table) {
    if ($this->tableExists($name)) {
      throw new SchemaObjectExistsException("Table '$name' already exists.");
    }
    $statements = $this->createTableSql($name$table);
    foreach ($statements as $statement) {
      $this->connection->query($statement);
    }
  }

  /** * Generate SQL to create a new table from a Drupal schema definition. * * This method should be implemented in extending classes. * * @param string $name * The name of the table to create. * @param array $table * A Schema API table definition array. * * @return array * An array of SQL statements to create the table. * * @throws \BadMethodCallException * If the method is not implemented in the concrete driver class. * * @todo This method is called by Schema::createTable on the abstract class, and * therefore should be defined as well on the abstract class to prevent static * analysis errors. In D11, consider changing it to an abstract method, or to * make it private for each driver, and ::createTable actually an abstract * method here for implementation in each driver. */
Home | Imprint | This part of the site doesn't use cookies.