Final Class Yiisoft\Db\Oracle\DDLQueryBuilder
| Inheritance | Yiisoft\Db\Oracle\DDLQueryBuilder » Yiisoft\Db\QueryBuilder\AbstractDDLQueryBuilder |
|---|
Implements a (Data Definition Language) SQL statements for Oracle Server.
Public Methods
Method Details
| public addDefaultValue( string $table, string $name, string $column, mixed $value ): string | ||
| $table | string | |
| $name | string | |
| $column | string | |
| $value | mixed | |
public function addDefaultValue(string $table, string $name, string $column, mixed $value): string
{
throw new NotSupportedException(__METHOD__ . ' is not supported by Oracle.');
}
| public addForeignKey( string $table, string $name, array|string $columns, string $referenceTable, array|string $referenceColumns, string|null $delete = null, string|null $update = null ): string | ||
| $table | string | |
| $name | string | |
| $columns | array|string | |
| $referenceTable | string | |
| $referenceColumns | array|string | |
| $delete | string|null | |
| $update | string|null | |
public function addForeignKey(
string $table,
string $name,
array|string $columns,
string $referenceTable,
array|string $referenceColumns,
?string $delete = null,
?string $update = null,
): string {
$sql = 'ALTER TABLE ' . $this->quoter->quoteTableName($table)
. ' ADD CONSTRAINT ' . $this->quoter->quoteColumnName($name)
. ' FOREIGN KEY (' . $this->queryBuilder->buildColumns($columns) . ')'
. ' REFERENCES ' . $this->quoter->quoteTableName($referenceTable)
. ' (' . $this->queryBuilder->buildColumns($referenceColumns) . ')';
if ($delete !== null) {
$sql .= ' ON DELETE ' . $delete;
}
if ($update !== null) {
throw new Exception('Oracle does not support ON UPDATE clause.');
}
return $sql;
}
| public alterColumn( string $table, string $column, \Yiisoft\Db\Schema\Column\ColumnInterface|string $type ): string | ||
| $table | string | |
| $column | string | |
| $type | \Yiisoft\Db\Schema\Column\ColumnInterface|string | |
public function alterColumn(string $table, string $column, ColumnInterface|string $type): string
{
return 'ALTER TABLE '
. $this->quoter->quoteTableName($table)
. ' MODIFY '
. $this->quoter->quoteColumnName($column)
. ' ' . $this->queryBuilder->buildColumnDefinition($type);
}
| public checkIntegrity( string $schema = '', string $table = '', boolean $check = true ): string | ||
| $schema | string | |
| $table | string | |
| $check | boolean | |
public function checkIntegrity(string $schema = '', string $table = '', bool $check = true): string
{
throw new NotSupportedException(__METHOD__ . ' is not supported by Oracle.');
}
| public dropCommentFromColumn( string $table, string $column ): string | ||
| $table | string | |
| $column | string | |
public function dropCommentFromColumn(string $table, string $column): string
{
return 'COMMENT ON COLUMN '
. $this->quoter->quoteTableName($table)
. '.'
. $this->quoter->quoteColumnName($column)
. " IS ''";
}
| public dropCommentFromTable( string $table ): string | ||
| $table | string | |
public function dropCommentFromTable(string $table): string
{
return 'COMMENT ON TABLE ' . $this->quoter->quoteTableName($table) . " IS ''";
}
| public dropDefaultValue( string $table, string $name ): string | ||
| $table | string | |
| $name | string | |
public function dropDefaultValue(string $table, string $name): string
{
throw new NotSupportedException(__METHOD__ . ' is not supported by Oracle.');
}
| public dropIndex( string $table, string $name ): string | ||
| $table | string | |
| $name | string | |
public function dropIndex(string $table, string $name): string
{
return 'DROP INDEX ' . $this->quoter->quoteTableName($name);
}
| public dropTable( string $table, boolean $ifExists = false, boolean $cascade = false ): string | ||
| $table | string | |
| $ifExists | boolean | |
| $cascade | boolean | |
| throws | \Yiisoft\Db\Exception\NotSupportedException |
Oracle doesn't support "IF EXISTS" option on drop table. |
|---|---|---|
public function dropTable(string $table, bool $ifExists = false, bool $cascade = false): string
{
if ($ifExists) {
throw new NotSupportedException('Oracle doesn\'t support "IF EXISTS" option on drop table.');
}
return 'DROP TABLE '
. $this->quoter->quoteTableName($table)
. ($cascade ? ' CASCADE CONSTRAINTS' : '');
}
Signup or Login in order to comment.