コード例 #1
0
 public function initialize(\blaze\ds\meta\SchemaMetaData $schema, $newName = null)
 {
     if ($newName !== null) {
         $this->tableName = $newName;
     }
     $query = 'CREATE TABLE ' . $this->tableName . '(';
     if (count($this->notInitializedColumns) > 0) {
         foreach ($this->notInitializedColumns as $column) {
             $query .= ColumnMetaDataImpl::getColumnDefinition($column);
             $query .= ',';
         }
         $query = substr($query, 0, strlen($query) - 1);
     }
     $query .= ') ENGINE InnoDB';
     if ($this->tableCharset !== null) {
         $query .= ' CHARACTER SET ' . $this->tableCharset;
     }
     if ($this->tableCollation !== null) {
         $query .= ' COLLATE ' . $this->tableCollation;
     }
     if ($this->tableComment !== null) {
         $query .= ' COMMENT \'' . $this->tableComment . '\'';
     }
     $schema->getDatabaseMetaData()->getConnection()->createStatement()->executeQuery($query);
     $this->schema = $schema;
     $this->initialized = true;
     if (count($this->notInitializedColumns) > 0) {
         foreach ($this->notInitializedColumns as $column) {
             $column->initialize($this);
         }
     }
     $this->notInitializedColumns = array();
 }
コード例 #2
0
 public function reverseSchema(\blaze\ds\meta\SchemaMetaData $smd)
 {
     foreach ($smd->getTables() as $table) {
         $this->reverseTable($table);
     }
     foreach ($smd->getViews() as $view) {
         $this->reverseView($view);
     }
 }
コード例 #3
0
 public function drop()
 {
     $this->checkClosed();
     $this->schema->drop();
 }