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 SELECT queries. |
16
|
|
|
* |
17
|
|
|
* @package Aura.SqlQuery |
18
|
|
|
* |
19
|
|
|
*/ |
20
|
|
|
class Select extends Common\Select |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* |
24
|
|
|
* Adds or removes SQL_CALC_FOUND_ROWS flag. |
25
|
|
|
* |
26
|
|
|
* @param bool $enable Set or unset flag (default true). |
27
|
|
|
* |
28
|
|
|
* @return $this |
29
|
|
|
* |
30
|
|
|
*/ |
31
|
2 |
|
public function calcFoundRows($enable = true) |
32
|
|
|
{ |
33
|
2 |
|
$this->setFlag('SQL_CALC_FOUND_ROWS', $enable); |
34
|
2 |
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* |
39
|
|
|
* Adds or removes SQL_CACHE flag. |
40
|
|
|
* |
41
|
|
|
* @param bool $enable Set or unset flag (default true). |
42
|
|
|
* |
43
|
|
|
* @return $this |
44
|
|
|
* |
45
|
|
|
*/ |
46
|
1 |
|
public function cache($enable = true) |
47
|
|
|
{ |
48
|
1 |
|
$this->setFlag('SQL_CACHE', $enable); |
49
|
1 |
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* |
54
|
|
|
* Adds or removes SQL_NO_CACHE flag. |
55
|
|
|
* |
56
|
|
|
* @param bool $enable Set or unset flag (default true). |
57
|
|
|
* |
58
|
|
|
* @return $this |
59
|
|
|
* |
60
|
|
|
*/ |
61
|
2 |
|
public function noCache($enable = true) |
62
|
|
|
{ |
63
|
2 |
|
$this->setFlag('SQL_NO_CACHE', $enable); |
64
|
2 |
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* |
69
|
|
|
* Adds or removes STRAIGHT_JOIN flag. |
70
|
|
|
* |
71
|
|
|
* @param bool $enable Set or unset flag (default true). |
72
|
|
|
* |
73
|
|
|
* @return $this |
74
|
|
|
* |
75
|
|
|
*/ |
76
|
1 |
|
public function straightJoin($enable = true) |
77
|
|
|
{ |
78
|
1 |
|
$this->setFlag('STRAIGHT_JOIN', $enable); |
79
|
1 |
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* |
84
|
|
|
* Adds or removes HIGH_PRIORITY flag. |
85
|
|
|
* |
86
|
|
|
* @param bool $enable Set or unset flag (default true). |
87
|
|
|
* |
88
|
|
|
* @return $this |
89
|
|
|
* |
90
|
|
|
*/ |
91
|
1 |
|
public function highPriority($enable = true) |
92
|
|
|
{ |
93
|
1 |
|
$this->setFlag('HIGH_PRIORITY', $enable); |
94
|
1 |
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* |
99
|
|
|
* Adds or removes SQL_SMALL_RESULT flag. |
100
|
|
|
* |
101
|
|
|
* @param bool $enable Set or unset flag (default true). |
102
|
|
|
* |
103
|
|
|
* @return $this |
104
|
|
|
* |
105
|
|
|
*/ |
106
|
1 |
|
public function smallResult($enable = true) |
107
|
|
|
{ |
108
|
1 |
|
$this->setFlag('SQL_SMALL_RESULT', $enable); |
109
|
1 |
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* |
114
|
|
|
* Adds or removes SQL_BIG_RESULT flag. |
115
|
|
|
* |
116
|
|
|
* @param bool $enable Set or unset flag (default true). |
117
|
|
|
* |
118
|
|
|
* @return $this |
119
|
|
|
* |
120
|
|
|
*/ |
121
|
1 |
|
public function bigResult($enable = true) |
122
|
|
|
{ |
123
|
1 |
|
$this->setFlag('SQL_BIG_RESULT', $enable); |
124
|
1 |
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* |
129
|
|
|
* Adds or removes SQL_BUFFER_RESULT flag. |
130
|
|
|
* |
131
|
|
|
* @param bool $enable Set or unset flag (default true). |
132
|
|
|
* |
133
|
|
|
* @return $this |
134
|
|
|
* |
135
|
|
|
*/ |
136
|
1 |
|
public function bufferResult($enable = true) |
137
|
|
|
{ |
138
|
1 |
|
$this->setFlag('SQL_BUFFER_RESULT', $enable); |
139
|
1 |
|
return $this; |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|