Пример #1
0
 public function dropSequence($sequenceName)
 {
     $this->checkClosed();
     $parts = \blaze\lang\String::asWrapper($sequenceName)->split('_');
     if (count($parts) !== 3) {
         throw new \blaze\ds\DataSourceException('Sequencenames in this driver must have the following structure: tablename_columnname_seq');
     }
     $tbl = $this->getTable($parts[0]);
     $col = $tbl->getColumn($parts[1]);
     $this->databaseMetaData->getConnection()->createStatement()->executeUpdate('ALTER TABLE ' . $parts[0] . ' MODIFY COLUMN ' . ColumnMetaDataImpl::getColumnDefinition($col, null, true, true, false));
 }
Пример #2
0
 public function addColumn(\blaze\ds\meta\ColumnMetaData $column, $newName = null)
 {
     if (!$this->initialized) {
         if ($newName === null) {
             $this->notInitializedColumns[\blaze\lang\String::asNative($column->getName())] = $column;
         } else {
             $this->notInitializedColumns[\blaze\lang\String::asNative($newName)] = $column;
         }
     } else {
         $this->checkClosed();
         $stmt = $this->schema->getDatabaseMetaData()->getConnection()->createStatement();
         $stmt->executeQuery('ALTER TABLE ' . $this->tableName . ' ADD COLUMN ' . ColumnMetaDataImpl::getColumnDefinition($column, $newName));
     }
 }