1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright 2021 Aleksandar Panic |
4
|
|
|
* |
5
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
6
|
|
|
* you may not use this file except in compliance with the License. |
7
|
|
|
* You may obtain a copy of the License at |
8
|
|
|
* |
9
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
10
|
|
|
* |
11
|
|
|
* Unless required by applicable law or agreed to in writing, software |
12
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
13
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14
|
|
|
* See the License for the specific language governing permissions and |
15
|
|
|
* limitations under the License. |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
namespace ArekX\PQL\Sql\Query; |
19
|
|
|
|
20
|
|
|
use ArekX\PQL\Contracts\StructuredQuery; |
21
|
|
|
use ArekX\PQL\Query; |
22
|
|
|
use ArekX\PQL\Sql\Query\Traits\ConditionTrait; |
23
|
|
|
use ArekX\PQL\Sql\Query\Traits\ConfigureTrait; |
24
|
|
|
use ArekX\PQL\Sql\Query\Traits\JoinTrait; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Represents a delete query to delete items from the |
28
|
|
|
* driver. |
29
|
|
|
*/ |
30
|
|
|
class Delete extends Query |
31
|
|
|
{ |
32
|
|
|
use ConditionTrait; |
33
|
|
|
use JoinTrait; |
34
|
|
|
use ConfigureTrait; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Set the place from which to delete data. |
38
|
|
|
* |
39
|
|
|
* **SQL Injection Warning**: Value in this function is not usually escaped in the driver |
40
|
|
|
* and should not be used to pass values from the user input to it. If you need to pass |
41
|
|
|
* and escape query use Raw query. |
42
|
|
|
* |
43
|
|
|
* If a StructuredQuery is passed, it will be additionally parsed according to that type. |
44
|
|
|
* |
45
|
|
|
* @param string|StructuredQuery|array $from Table or other destination to delete data from. |
46
|
|
|
* @return $this |
47
|
|
|
*/ |
48
|
16 |
|
public function from(StructuredQuery|string|array $from): static |
49
|
|
|
{ |
50
|
16 |
|
$this->use('from', $from); |
51
|
16 |
|
return $this; |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|