| 1 | <?php |
||
| 16 | class DropQuery implements QueryInterface |
||
| 17 | { |
||
| 18 | use Attributes; |
||
| 19 | |||
| 20 | /** @var string */ |
||
| 21 | protected $table; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param string $table |
||
| 25 | */ |
||
| 26 | 1 | public function __construct($table) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * {@inheritdoc} |
||
| 33 | */ |
||
| 34 | 1 | public function toSql() |
|
| 35 | { |
||
| 36 | 1 | $sql = "DROP TABLE"; |
|
| 37 | 1 | if (isset($this->attributes['if_exists'])) { |
|
| 38 | 1 | $sql .= ' IF EXISTS'; |
|
| 39 | } |
||
| 40 | 1 | $sql .= " `{$this->table}`"; |
|
| 41 | 1 | if (isset($this->attributes['restrict']) && $this->attributes['restrict']) { |
|
| 42 | 1 | $sql .= ' RESTRICT'; |
|
| 43 | } |
||
| 44 | 1 | if (isset($this->attributes['cascade']) && $this->attributes['cascade']) { |
|
| 45 | 1 | $sql .= ' CASCADE'; |
|
| 46 | } |
||
| 47 | 1 | return $sql; |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | public function getBindings() |
||
| 57 | } |
||
| 58 |