1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* This file is part of Aura for PHP. |
5
|
|
|
* |
6
|
|
|
* @license http://opensource.org/licenses/bsd-license.php BSD |
7
|
|
|
* |
8
|
|
|
*/ |
9
|
|
|
namespace Aura\SqlQuery\Mysql; |
10
|
|
|
|
11
|
|
|
use Aura\SqlQuery\Common; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* |
15
|
|
|
* An object for MySQL UPDATE queries. |
16
|
|
|
* |
17
|
|
|
* @package Aura.SqlQuery |
18
|
|
|
* |
19
|
|
|
*/ |
20
|
|
|
class Delete extends Common\Delete implements Common\OrderByInterface, Common\LimitInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* |
24
|
|
|
* Adds or removes LOW_PRIORITY flag. |
25
|
|
|
* |
26
|
|
|
* @param bool $enable Set or unset flag (default true). |
27
|
|
|
* |
28
|
|
|
* @return $this |
29
|
|
|
* |
30
|
|
|
*/ |
31
|
1 |
|
public function lowPriority($enable = true) |
32
|
|
|
{ |
33
|
1 |
|
$this->setFlag('LOW_PRIORITY', $enable); |
34
|
1 |
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* |
39
|
|
|
* Adds or removes IGNORE flag. |
40
|
|
|
* |
41
|
|
|
* @param bool $enable Set or unset flag (default true). |
42
|
|
|
* |
43
|
|
|
* @return $this |
44
|
|
|
* |
45
|
|
|
*/ |
46
|
1 |
|
public function ignore($enable = true) |
47
|
|
|
{ |
48
|
1 |
|
$this->setFlag('IGNORE', $enable); |
49
|
1 |
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* |
54
|
|
|
* Adds or removes QUICK flag. |
55
|
|
|
* |
56
|
|
|
* @param bool $enable Set or unset flag (default true). |
57
|
|
|
* |
58
|
|
|
* @return $this |
59
|
|
|
* |
60
|
|
|
*/ |
61
|
1 |
|
public function quick($enable = true) |
62
|
|
|
{ |
63
|
1 |
|
$this->setFlag('QUICK', $enable); |
64
|
1 |
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* |
69
|
|
|
* Sets a limit count on the query. |
70
|
|
|
* |
71
|
|
|
* @param int $limit The number of rows to select. |
72
|
|
|
* |
73
|
|
|
* @return $this |
74
|
|
|
* |
75
|
|
|
*/ |
76
|
2 |
|
public function limit($limit) |
77
|
|
|
{ |
78
|
2 |
|
$this->limit = (int) $limit; |
79
|
2 |
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* |
84
|
|
|
* Returns the LIMIT value. |
85
|
|
|
* |
86
|
|
|
* @return int |
87
|
|
|
* |
88
|
|
|
*/ |
89
|
1 |
|
public function getLimit() |
90
|
|
|
{ |
91
|
1 |
|
return $this->limit; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* |
96
|
|
|
* Adds a column order to the query. |
97
|
|
|
* |
98
|
|
|
* @param array $spec The columns and direction to order by. |
99
|
|
|
* |
100
|
|
|
* @return $this |
101
|
|
|
* |
102
|
|
|
*/ |
103
|
1 |
|
public function orderBy(array $spec) |
104
|
|
|
{ |
105
|
1 |
|
return $this->addOrderBy($spec); |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|