Passed
Push — master ( 99c101...c1fd22 )
by Morris
13:21 queued 10s
created
lib/public/DB/QueryBuilder/IExpressionBuilder.php 1 patch
Indentation   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -33,336 +33,336 @@
 block discarded – undo
33 33
  * @since 8.2.0
34 34
  */
35 35
 interface IExpressionBuilder {
36
-	/**
37
-	 * @since 9.0.0
38
-	 */
39
-	public const EQ = ExpressionBuilder::EQ;
40
-	/**
41
-	 * @since 9.0.0
42
-	 */
43
-	public const NEQ = ExpressionBuilder::NEQ;
44
-	/**
45
-	 * @since 9.0.0
46
-	 */
47
-	public const LT = ExpressionBuilder::LT;
48
-	/**
49
-	 * @since 9.0.0
50
-	 */
51
-	public const LTE = ExpressionBuilder::LTE;
52
-	/**
53
-	 * @since 9.0.0
54
-	 */
55
-	public const GT = ExpressionBuilder::GT;
56
-	/**
57
-	 * @since 9.0.0
58
-	 */
59
-	public const GTE = ExpressionBuilder::GTE;
36
+    /**
37
+     * @since 9.0.0
38
+     */
39
+    public const EQ = ExpressionBuilder::EQ;
40
+    /**
41
+     * @since 9.0.0
42
+     */
43
+    public const NEQ = ExpressionBuilder::NEQ;
44
+    /**
45
+     * @since 9.0.0
46
+     */
47
+    public const LT = ExpressionBuilder::LT;
48
+    /**
49
+     * @since 9.0.0
50
+     */
51
+    public const LTE = ExpressionBuilder::LTE;
52
+    /**
53
+     * @since 9.0.0
54
+     */
55
+    public const GT = ExpressionBuilder::GT;
56
+    /**
57
+     * @since 9.0.0
58
+     */
59
+    public const GTE = ExpressionBuilder::GTE;
60 60
 
61
-	/**
62
-	 * Creates a conjunction of the given boolean expressions.
63
-	 *
64
-	 * Example:
65
-	 *
66
-	 *     [php]
67
-	 *     // (u.type = ?) AND (u.role = ?)
68
-	 *     $expr->andX('u.type = ?', 'u.role = ?'));
69
-	 *
70
-	 * @param mixed ...$x Optional clause. Defaults = null, but requires
71
-	 *                 at least one defined when converting to string.
72
-	 *
73
-	 * @return \OCP\DB\QueryBuilder\ICompositeExpression
74
-	 * @since 8.2.0
75
-	 */
76
-	public function andX(...$x);
61
+    /**
62
+     * Creates a conjunction of the given boolean expressions.
63
+     *
64
+     * Example:
65
+     *
66
+     *     [php]
67
+     *     // (u.type = ?) AND (u.role = ?)
68
+     *     $expr->andX('u.type = ?', 'u.role = ?'));
69
+     *
70
+     * @param mixed ...$x Optional clause. Defaults = null, but requires
71
+     *                 at least one defined when converting to string.
72
+     *
73
+     * @return \OCP\DB\QueryBuilder\ICompositeExpression
74
+     * @since 8.2.0
75
+     */
76
+    public function andX(...$x);
77 77
 
78
-	/**
79
-	 * Creates a disjunction of the given boolean expressions.
80
-	 *
81
-	 * Example:
82
-	 *
83
-	 *     [php]
84
-	 *     // (u.type = ?) OR (u.role = ?)
85
-	 *     $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
86
-	 *
87
-	 * @param mixed ...$x Optional clause. Defaults = null, but requires
88
-	 *                 at least one defined when converting to string.
89
-	 *
90
-	 * @return \OCP\DB\QueryBuilder\ICompositeExpression
91
-	 * @since 8.2.0
92
-	 */
93
-	public function orX(...$x);
78
+    /**
79
+     * Creates a disjunction of the given boolean expressions.
80
+     *
81
+     * Example:
82
+     *
83
+     *     [php]
84
+     *     // (u.type = ?) OR (u.role = ?)
85
+     *     $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
86
+     *
87
+     * @param mixed ...$x Optional clause. Defaults = null, but requires
88
+     *                 at least one defined when converting to string.
89
+     *
90
+     * @return \OCP\DB\QueryBuilder\ICompositeExpression
91
+     * @since 8.2.0
92
+     */
93
+    public function orX(...$x);
94 94
 
95
-	/**
96
-	 * Creates a comparison expression.
97
-	 *
98
-	 * @param mixed $x The left expression.
99
-	 * @param string $operator One of the IExpressionBuilder::* constants.
100
-	 * @param mixed $y The right expression.
101
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
102
-	 *                  required when comparing text fields for oci compatibility
103
-	 *
104
-	 * @return string
105
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
106
-	 */
107
-	public function comparison($x, $operator, $y, $type = null);
95
+    /**
96
+     * Creates a comparison expression.
97
+     *
98
+     * @param mixed $x The left expression.
99
+     * @param string $operator One of the IExpressionBuilder::* constants.
100
+     * @param mixed $y The right expression.
101
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
102
+     *                  required when comparing text fields for oci compatibility
103
+     *
104
+     * @return string
105
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
106
+     */
107
+    public function comparison($x, $operator, $y, $type = null);
108 108
 
109
-	/**
110
-	 * Creates an equality comparison expression with the given arguments.
111
-	 *
112
-	 * First argument is considered the left expression and the second is the right expression.
113
-	 * When converted to string, it will generated a <left expr> = <right expr>. Example:
114
-	 *
115
-	 *     [php]
116
-	 *     // u.id = ?
117
-	 *     $expr->eq('u.id', '?');
118
-	 *
119
-	 * @param mixed $x The left expression.
120
-	 * @param mixed $y The right expression.
121
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
122
-	 *                  required when comparing text fields for oci compatibility
123
-	 *
124
-	 * @return string
125
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
126
-	 */
127
-	public function eq($x, $y, $type = null);
109
+    /**
110
+     * Creates an equality comparison expression with the given arguments.
111
+     *
112
+     * First argument is considered the left expression and the second is the right expression.
113
+     * When converted to string, it will generated a <left expr> = <right expr>. Example:
114
+     *
115
+     *     [php]
116
+     *     // u.id = ?
117
+     *     $expr->eq('u.id', '?');
118
+     *
119
+     * @param mixed $x The left expression.
120
+     * @param mixed $y The right expression.
121
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
122
+     *                  required when comparing text fields for oci compatibility
123
+     *
124
+     * @return string
125
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
126
+     */
127
+    public function eq($x, $y, $type = null);
128 128
 
129
-	/**
130
-	 * Creates a non equality comparison expression with the given arguments.
131
-	 * First argument is considered the left expression and the second is the right expression.
132
-	 * When converted to string, it will generated a <left expr> <> <right expr>. Example:
133
-	 *
134
-	 *     [php]
135
-	 *     // u.id <> 1
136
-	 *     $q->where($q->expr()->neq('u.id', '1'));
137
-	 *
138
-	 * @param mixed $x The left expression.
139
-	 * @param mixed $y The right expression.
140
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
141
-	 *                  required when comparing text fields for oci compatibility
142
-	 *
143
-	 * @return string
144
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
145
-	 */
146
-	public function neq($x, $y, $type = null);
129
+    /**
130
+     * Creates a non equality comparison expression with the given arguments.
131
+     * First argument is considered the left expression and the second is the right expression.
132
+     * When converted to string, it will generated a <left expr> <> <right expr>. Example:
133
+     *
134
+     *     [php]
135
+     *     // u.id <> 1
136
+     *     $q->where($q->expr()->neq('u.id', '1'));
137
+     *
138
+     * @param mixed $x The left expression.
139
+     * @param mixed $y The right expression.
140
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
141
+     *                  required when comparing text fields for oci compatibility
142
+     *
143
+     * @return string
144
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
145
+     */
146
+    public function neq($x, $y, $type = null);
147 147
 
148
-	/**
149
-	 * Creates a lower-than comparison expression with the given arguments.
150
-	 * First argument is considered the left expression and the second is the right expression.
151
-	 * When converted to string, it will generated a <left expr> < <right expr>. Example:
152
-	 *
153
-	 *     [php]
154
-	 *     // u.id < ?
155
-	 *     $q->where($q->expr()->lt('u.id', '?'));
156
-	 *
157
-	 * @param mixed $x The left expression.
158
-	 * @param mixed $y The right expression.
159
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
160
-	 *                  required when comparing text fields for oci compatibility
161
-	 *
162
-	 * @return string
163
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
164
-	 */
165
-	public function lt($x, $y, $type = null);
148
+    /**
149
+     * Creates a lower-than comparison expression with the given arguments.
150
+     * First argument is considered the left expression and the second is the right expression.
151
+     * When converted to string, it will generated a <left expr> < <right expr>. Example:
152
+     *
153
+     *     [php]
154
+     *     // u.id < ?
155
+     *     $q->where($q->expr()->lt('u.id', '?'));
156
+     *
157
+     * @param mixed $x The left expression.
158
+     * @param mixed $y The right expression.
159
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
160
+     *                  required when comparing text fields for oci compatibility
161
+     *
162
+     * @return string
163
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
164
+     */
165
+    public function lt($x, $y, $type = null);
166 166
 
167
-	/**
168
-	 * Creates a lower-than-equal comparison expression with the given arguments.
169
-	 * First argument is considered the left expression and the second is the right expression.
170
-	 * When converted to string, it will generated a <left expr> <= <right expr>. Example:
171
-	 *
172
-	 *     [php]
173
-	 *     // u.id <= ?
174
-	 *     $q->where($q->expr()->lte('u.id', '?'));
175
-	 *
176
-	 * @param mixed $x The left expression.
177
-	 * @param mixed $y The right expression.
178
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
179
-	 *                  required when comparing text fields for oci compatibility
180
-	 *
181
-	 * @return string
182
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
183
-	 */
184
-	public function lte($x, $y, $type = null);
167
+    /**
168
+     * Creates a lower-than-equal comparison expression with the given arguments.
169
+     * First argument is considered the left expression and the second is the right expression.
170
+     * When converted to string, it will generated a <left expr> <= <right expr>. Example:
171
+     *
172
+     *     [php]
173
+     *     // u.id <= ?
174
+     *     $q->where($q->expr()->lte('u.id', '?'));
175
+     *
176
+     * @param mixed $x The left expression.
177
+     * @param mixed $y The right expression.
178
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
179
+     *                  required when comparing text fields for oci compatibility
180
+     *
181
+     * @return string
182
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
183
+     */
184
+    public function lte($x, $y, $type = null);
185 185
 
186
-	/**
187
-	 * Creates a greater-than comparison expression with the given arguments.
188
-	 * First argument is considered the left expression and the second is the right expression.
189
-	 * When converted to string, it will generated a <left expr> > <right expr>. Example:
190
-	 *
191
-	 *     [php]
192
-	 *     // u.id > ?
193
-	 *     $q->where($q->expr()->gt('u.id', '?'));
194
-	 *
195
-	 * @param mixed $x The left expression.
196
-	 * @param mixed $y The right expression.
197
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
198
-	 *                  required when comparing text fields for oci compatibility
199
-	 *
200
-	 * @return string
201
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
202
-	 */
203
-	public function gt($x, $y, $type = null);
186
+    /**
187
+     * Creates a greater-than comparison expression with the given arguments.
188
+     * First argument is considered the left expression and the second is the right expression.
189
+     * When converted to string, it will generated a <left expr> > <right expr>. Example:
190
+     *
191
+     *     [php]
192
+     *     // u.id > ?
193
+     *     $q->where($q->expr()->gt('u.id', '?'));
194
+     *
195
+     * @param mixed $x The left expression.
196
+     * @param mixed $y The right expression.
197
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
198
+     *                  required when comparing text fields for oci compatibility
199
+     *
200
+     * @return string
201
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
202
+     */
203
+    public function gt($x, $y, $type = null);
204 204
 
205
-	/**
206
-	 * Creates a greater-than-equal comparison expression with the given arguments.
207
-	 * First argument is considered the left expression and the second is the right expression.
208
-	 * When converted to string, it will generated a <left expr> >= <right expr>. Example:
209
-	 *
210
-	 *     [php]
211
-	 *     // u.id >= ?
212
-	 *     $q->where($q->expr()->gte('u.id', '?'));
213
-	 *
214
-	 * @param mixed $x The left expression.
215
-	 * @param mixed $y The right expression.
216
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
217
-	 *                  required when comparing text fields for oci compatibility
218
-	 *
219
-	 * @return string
220
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
221
-	 */
222
-	public function gte($x, $y, $type = null);
205
+    /**
206
+     * Creates a greater-than-equal comparison expression with the given arguments.
207
+     * First argument is considered the left expression and the second is the right expression.
208
+     * When converted to string, it will generated a <left expr> >= <right expr>. Example:
209
+     *
210
+     *     [php]
211
+     *     // u.id >= ?
212
+     *     $q->where($q->expr()->gte('u.id', '?'));
213
+     *
214
+     * @param mixed $x The left expression.
215
+     * @param mixed $y The right expression.
216
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
217
+     *                  required when comparing text fields for oci compatibility
218
+     *
219
+     * @return string
220
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
221
+     */
222
+    public function gte($x, $y, $type = null);
223 223
 
224
-	/**
225
-	 * Creates an IS NULL expression with the given arguments.
226
-	 *
227
-	 * @param string $x The field in string format to be restricted by IS NULL.
228
-	 *
229
-	 * @return string
230
-	 * @since 8.2.0
231
-	 */
232
-	public function isNull($x);
224
+    /**
225
+     * Creates an IS NULL expression with the given arguments.
226
+     *
227
+     * @param string $x The field in string format to be restricted by IS NULL.
228
+     *
229
+     * @return string
230
+     * @since 8.2.0
231
+     */
232
+    public function isNull($x);
233 233
 
234
-	/**
235
-	 * Creates an IS NOT NULL expression with the given arguments.
236
-	 *
237
-	 * @param string $x The field in string format to be restricted by IS NOT NULL.
238
-	 *
239
-	 * @return string
240
-	 * @since 8.2.0
241
-	 */
242
-	public function isNotNull($x);
234
+    /**
235
+     * Creates an IS NOT NULL expression with the given arguments.
236
+     *
237
+     * @param string $x The field in string format to be restricted by IS NOT NULL.
238
+     *
239
+     * @return string
240
+     * @since 8.2.0
241
+     */
242
+    public function isNotNull($x);
243 243
 
244
-	/**
245
-	 * Creates a LIKE() comparison expression with the given arguments.
246
-	 *
247
-	 * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison.
248
-	 * @param mixed $y Argument to be used in LIKE() comparison.
249
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
250
-	 *                  required when comparing text fields for oci compatibility
251
-	 *
252
-	 * @return string
253
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
254
-	 */
255
-	public function like($x, $y, $type = null);
244
+    /**
245
+     * Creates a LIKE() comparison expression with the given arguments.
246
+     *
247
+     * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison.
248
+     * @param mixed $y Argument to be used in LIKE() comparison.
249
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
250
+     *                  required when comparing text fields for oci compatibility
251
+     *
252
+     * @return string
253
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
254
+     */
255
+    public function like($x, $y, $type = null);
256 256
 
257
-	/**
258
-	 * Creates a NOT LIKE() comparison expression with the given arguments.
259
-	 *
260
-	 * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison.
261
-	 * @param mixed $y Argument to be used in NOT LIKE() comparison.
262
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
263
-	 *                  required when comparing text fields for oci compatibility
264
-	 *
265
-	 * @return string
266
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
267
-	 */
268
-	public function notLike($x, $y, $type = null);
257
+    /**
258
+     * Creates a NOT LIKE() comparison expression with the given arguments.
259
+     *
260
+     * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison.
261
+     * @param mixed $y Argument to be used in NOT LIKE() comparison.
262
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
263
+     *                  required when comparing text fields for oci compatibility
264
+     *
265
+     * @return string
266
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
267
+     */
268
+    public function notLike($x, $y, $type = null);
269 269
 
270
-	/**
271
-	 * Creates a ILIKE() comparison expression with the given arguments.
272
-	 *
273
-	 * @param string $x Field in string format to be inspected by ILIKE() comparison.
274
-	 * @param mixed $y Argument to be used in ILIKE() comparison.
275
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
276
-	 *                  required when comparing text fields for oci compatibility
277
-	 *
278
-	 * @return string
279
-	 * @since 9.0.0
280
-	 */
281
-	public function iLike($x, $y, $type = null);
270
+    /**
271
+     * Creates a ILIKE() comparison expression with the given arguments.
272
+     *
273
+     * @param string $x Field in string format to be inspected by ILIKE() comparison.
274
+     * @param mixed $y Argument to be used in ILIKE() comparison.
275
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
276
+     *                  required when comparing text fields for oci compatibility
277
+     *
278
+     * @return string
279
+     * @since 9.0.0
280
+     */
281
+    public function iLike($x, $y, $type = null);
282 282
 
283
-	/**
284
-	 * Creates a IN () comparison expression with the given arguments.
285
-	 *
286
-	 * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison.
287
-	 * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison.
288
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
289
-	 *                  required when comparing text fields for oci compatibility
290
-	 *
291
-	 * @return string
292
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
293
-	 */
294
-	public function in($x, $y, $type = null);
283
+    /**
284
+     * Creates a IN () comparison expression with the given arguments.
285
+     *
286
+     * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison.
287
+     * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison.
288
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
289
+     *                  required when comparing text fields for oci compatibility
290
+     *
291
+     * @return string
292
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
293
+     */
294
+    public function in($x, $y, $type = null);
295 295
 
296
-	/**
297
-	 * Creates a NOT IN () comparison expression with the given arguments.
298
-	 *
299
-	 * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison.
300
-	 * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
301
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
302
-	 *                  required when comparing text fields for oci compatibility
303
-	 *
304
-	 * @return string
305
-	 * @since 8.2.0 - Parameter $type was added in 9.0.0
306
-	 */
307
-	public function notIn($x, $y, $type = null);
296
+    /**
297
+     * Creates a NOT IN () comparison expression with the given arguments.
298
+     *
299
+     * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison.
300
+     * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
301
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
302
+     *                  required when comparing text fields for oci compatibility
303
+     *
304
+     * @return string
305
+     * @since 8.2.0 - Parameter $type was added in 9.0.0
306
+     */
307
+    public function notIn($x, $y, $type = null);
308 308
 
309
-	/**
310
-	 * Creates a $x = '' statement, because Oracle needs a different check
311
-	 *
312
-	 * @param string $x The field in string format to be inspected by the comparison.
313
-	 * @return string
314
-	 * @since 13.0.0
315
-	 */
316
-	public function emptyString($x);
309
+    /**
310
+     * Creates a $x = '' statement, because Oracle needs a different check
311
+     *
312
+     * @param string $x The field in string format to be inspected by the comparison.
313
+     * @return string
314
+     * @since 13.0.0
315
+     */
316
+    public function emptyString($x);
317 317
 
318
-	/**
319
-	 * Creates a `$x <> ''` statement, because Oracle needs a different check
320
-	 *
321
-	 * @param string $x The field in string format to be inspected by the comparison.
322
-	 * @return string
323
-	 * @since 13.0.0
324
-	 */
325
-	public function nonEmptyString($x);
318
+    /**
319
+     * Creates a `$x <> ''` statement, because Oracle needs a different check
320
+     *
321
+     * @param string $x The field in string format to be inspected by the comparison.
322
+     * @return string
323
+     * @since 13.0.0
324
+     */
325
+    public function nonEmptyString($x);
326 326
 
327 327
 
328
-	/**
329
-	 * Creates a bitwise AND comparison
330
-	 *
331
-	 * @param string|ILiteral $x The field or value to check
332
-	 * @param int $y Bitmap that must be set
333
-	 * @return IQueryFunction
334
-	 * @since 12.0.0
335
-	 */
336
-	public function bitwiseAnd($x, $y);
328
+    /**
329
+     * Creates a bitwise AND comparison
330
+     *
331
+     * @param string|ILiteral $x The field or value to check
332
+     * @param int $y Bitmap that must be set
333
+     * @return IQueryFunction
334
+     * @since 12.0.0
335
+     */
336
+    public function bitwiseAnd($x, $y);
337 337
 
338
-	/**
339
-	 * Creates a bitwise OR comparison
340
-	 *
341
-	 * @param string|ILiteral $x The field or value to check
342
-	 * @param int $y Bitmap that must be set
343
-	 * @return IQueryFunction
344
-	 * @since 12.0.0
345
-	 */
346
-	public function bitwiseOr($x, $y);
338
+    /**
339
+     * Creates a bitwise OR comparison
340
+     *
341
+     * @param string|ILiteral $x The field or value to check
342
+     * @param int $y Bitmap that must be set
343
+     * @return IQueryFunction
344
+     * @since 12.0.0
345
+     */
346
+    public function bitwiseOr($x, $y);
347 347
 
348
-	/**
349
-	 * Quotes a given input parameter.
350
-	 *
351
-	 * @param mixed $input The parameter to be quoted.
352
-	 * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
353
-	 *
354
-	 * @return string
355
-	 * @since 8.2.0
356
-	 */
357
-	public function literal($input, $type = null);
348
+    /**
349
+     * Quotes a given input parameter.
350
+     *
351
+     * @param mixed $input The parameter to be quoted.
352
+     * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
353
+     *
354
+     * @return string
355
+     * @since 8.2.0
356
+     */
357
+    public function literal($input, $type = null);
358 358
 
359
-	/**
360
-	 * Returns a IQueryFunction that casts the column to the given type
361
-	 *
362
-	 * @param string $column
363
-	 * @param mixed $type One of IQueryBuilder::PARAM_*
364
-	 * @return string
365
-	 * @since 9.0.0
366
-	 */
367
-	public function castColumn($column, $type);
359
+    /**
360
+     * Returns a IQueryFunction that casts the column to the given type
361
+     *
362
+     * @param string $column
363
+     * @param mixed $type One of IQueryBuilder::PARAM_*
364
+     * @return string
365
+     * @since 9.0.0
366
+     */
367
+    public function castColumn($column, $type);
368 368
 }
Please login to merge, or discard this patch.
lib/public/DB/QueryBuilder/IQueryBuilder.php 1 patch
Indentation   +867 added lines, -867 removed lines patch added patch discarded remove patch
@@ -35,871 +35,871 @@
 block discarded – undo
35 35
  */
36 36
 interface IQueryBuilder {
37 37
 
38
-	/**
39
-	 * @since 9.0.0
40
-	 */
41
-	public const PARAM_NULL = \PDO::PARAM_NULL;
42
-	/**
43
-	 * @since 9.0.0
44
-	 */
45
-	public const PARAM_BOOL = \PDO::PARAM_BOOL;
46
-	/**
47
-	 * @since 9.0.0
48
-	 */
49
-	public const PARAM_INT = \PDO::PARAM_INT;
50
-	/**
51
-	 * @since 9.0.0
52
-	 */
53
-	public const PARAM_STR = \PDO::PARAM_STR;
54
-	/**
55
-	 * @since 9.0.0
56
-	 */
57
-	public const PARAM_LOB = \PDO::PARAM_LOB;
58
-	/**
59
-	 * @since 9.0.0
60
-	 */
61
-	public const PARAM_DATE = 'datetime';
62
-
63
-	/**
64
-	 * @since 9.0.0
65
-	 */
66
-	public const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY;
67
-	/**
68
-	 * @since 9.0.0
69
-	 */
70
-	public const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY;
71
-
72
-
73
-	/**
74
-	 * Enable/disable automatic prefixing of table names with the oc_ prefix
75
-	 *
76
-	 * @param bool $enabled If set to true table names will be prefixed with the
77
-	 * owncloud database prefix automatically.
78
-	 * @since 8.2.0
79
-	 */
80
-	public function automaticTablePrefix($enabled);
81
-
82
-	/**
83
-	 * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
84
-	 * This producer method is intended for convenient inline usage. Example:
85
-	 *
86
-	 * <code>
87
-	 *     $qb = $conn->getQueryBuilder()
88
-	 *         ->select('u')
89
-	 *         ->from('users', 'u')
90
-	 *         ->where($qb->expr()->eq('u.id', 1));
91
-	 * </code>
92
-	 *
93
-	 * For more complex expression construction, consider storing the expression
94
-	 * builder object in a local variable.
95
-	 *
96
-	 * @return \OCP\DB\QueryBuilder\IExpressionBuilder
97
-	 * @since 8.2.0
98
-	 */
99
-	public function expr();
100
-
101
-	/**
102
-	 * Gets an FunctionBuilder used for object-oriented construction of query functions.
103
-	 * This producer method is intended for convenient inline usage. Example:
104
-	 *
105
-	 * <code>
106
-	 *     $qb = $conn->getQueryBuilder()
107
-	 *         ->select('u')
108
-	 *         ->from('users', 'u')
109
-	 *         ->where($qb->fun()->md5('u.id'));
110
-	 * </code>
111
-	 *
112
-	 * For more complex function construction, consider storing the function
113
-	 * builder object in a local variable.
114
-	 *
115
-	 * @return \OCP\DB\QueryBuilder\IFunctionBuilder
116
-	 * @since 12.0.0
117
-	 */
118
-	public function func();
119
-
120
-	/**
121
-	 * Gets the type of the currently built query.
122
-	 *
123
-	 * @return integer
124
-	 * @since 8.2.0
125
-	 */
126
-	public function getType();
127
-
128
-	/**
129
-	 * Gets the associated DBAL Connection for this query builder.
130
-	 *
131
-	 * @return \OCP\IDBConnection
132
-	 * @since 8.2.0
133
-	 */
134
-	public function getConnection();
135
-
136
-	/**
137
-	 * Gets the state of this query builder instance.
138
-	 *
139
-	 * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
140
-	 * @since 8.2.0
141
-	 */
142
-	public function getState();
143
-
144
-	/**
145
-	 * Executes this query using the bound parameters and their types.
146
-	 *
147
-	 * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
148
-	 * for insert, update and delete statements.
149
-	 *
150
-	 * @return \Doctrine\DBAL\Driver\Statement|int
151
-	 * @since 8.2.0
152
-	 */
153
-	public function execute();
154
-
155
-	/**
156
-	 * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
157
-	 *
158
-	 * <code>
159
-	 *     $qb = $conn->getQueryBuilder()
160
-	 *         ->select('u')
161
-	 *         ->from('User', 'u')
162
-	 *     echo $qb->getSQL(); // SELECT u FROM User u
163
-	 * </code>
164
-	 *
165
-	 * @return string The SQL query string.
166
-	 * @since 8.2.0
167
-	 */
168
-	public function getSQL();
169
-
170
-	/**
171
-	 * Sets a query parameter for the query being constructed.
172
-	 *
173
-	 * <code>
174
-	 *     $qb = $conn->getQueryBuilder()
175
-	 *         ->select('u')
176
-	 *         ->from('users', 'u')
177
-	 *         ->where('u.id = :user_id')
178
-	 *         ->setParameter(':user_id', 1);
179
-	 * </code>
180
-	 *
181
-	 * @param string|integer $key The parameter position or name.
182
-	 * @param mixed $value The parameter value.
183
-	 * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
184
-	 *
185
-	 * @return $this This QueryBuilder instance.
186
-	 * @since 8.2.0
187
-	 */
188
-	public function setParameter($key, $value, $type = null);
189
-
190
-	/**
191
-	 * Sets a collection of query parameters for the query being constructed.
192
-	 *
193
-	 * <code>
194
-	 *     $qb = $conn->getQueryBuilder()
195
-	 *         ->select('u')
196
-	 *         ->from('users', 'u')
197
-	 *         ->where('u.id = :user_id1 OR u.id = :user_id2')
198
-	 *         ->setParameters(array(
199
-	 *             ':user_id1' => 1,
200
-	 *             ':user_id2' => 2
201
-	 *         ));
202
-	 * </code>
203
-	 *
204
-	 * @param array $params The query parameters to set.
205
-	 * @param array $types The query parameters types to set.
206
-	 *
207
-	 * @return $this This QueryBuilder instance.
208
-	 * @since 8.2.0
209
-	 */
210
-	public function setParameters(array $params, array $types = []);
211
-
212
-	/**
213
-	 * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
214
-	 *
215
-	 * @return array The currently defined query parameters indexed by parameter index or name.
216
-	 * @since 8.2.0
217
-	 */
218
-	public function getParameters();
219
-
220
-	/**
221
-	 * Gets a (previously set) query parameter of the query being constructed.
222
-	 *
223
-	 * @param mixed $key The key (index or name) of the bound parameter.
224
-	 *
225
-	 * @return mixed The value of the bound parameter.
226
-	 * @since 8.2.0
227
-	 */
228
-	public function getParameter($key);
229
-
230
-	/**
231
-	 * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
232
-	 *
233
-	 * @return array The currently defined query parameter types indexed by parameter index or name.
234
-	 * @since 8.2.0
235
-	 */
236
-	public function getParameterTypes();
237
-
238
-	/**
239
-	 * Gets a (previously set) query parameter type of the query being constructed.
240
-	 *
241
-	 * @param mixed $key The key (index or name) of the bound parameter type.
242
-	 *
243
-	 * @return mixed The value of the bound parameter type.
244
-	 * @since 8.2.0
245
-	 */
246
-	public function getParameterType($key);
247
-
248
-	/**
249
-	 * Sets the position of the first result to retrieve (the "offset").
250
-	 *
251
-	 * @param integer $firstResult The first result to return.
252
-	 *
253
-	 * @return $this This QueryBuilder instance.
254
-	 * @since 8.2.0
255
-	 */
256
-	public function setFirstResult($firstResult);
257
-
258
-	/**
259
-	 * Gets the position of the first result the query object was set to retrieve (the "offset").
260
-	 * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
261
-	 *
262
-	 * @return integer The position of the first result.
263
-	 * @since 8.2.0
264
-	 */
265
-	public function getFirstResult();
266
-
267
-	/**
268
-	 * Sets the maximum number of results to retrieve (the "limit").
269
-	 *
270
-	 * @param integer $maxResults The maximum number of results to retrieve.
271
-	 *
272
-	 * @return $this This QueryBuilder instance.
273
-	 * @since 8.2.0
274
-	 */
275
-	public function setMaxResults($maxResults);
276
-
277
-	/**
278
-	 * Gets the maximum number of results the query object was set to retrieve (the "limit").
279
-	 * Returns NULL if {@link setMaxResults} was not applied to this query builder.
280
-	 *
281
-	 * @return integer The maximum number of results.
282
-	 * @since 8.2.0
283
-	 */
284
-	public function getMaxResults();
285
-
286
-	/**
287
-	 * Specifies an item that is to be returned in the query result.
288
-	 * Replaces any previously specified selections, if any.
289
-	 *
290
-	 * <code>
291
-	 *     $qb = $conn->getQueryBuilder()
292
-	 *         ->select('u.id', 'p.id')
293
-	 *         ->from('users', 'u')
294
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
295
-	 * </code>
296
-	 *
297
-	 * @param mixed ...$selects The selection expressions.
298
-	 *
299
-	 * @return $this This QueryBuilder instance.
300
-	 * @since 8.2.0
301
-	 */
302
-	public function select(...$selects);
303
-
304
-	/**
305
-	 * Specifies an item that is to be returned with a different name in the query result.
306
-	 *
307
-	 * <code>
308
-	 *     $qb = $conn->getQueryBuilder()
309
-	 *         ->selectAlias('u.id', 'user_id')
310
-	 *         ->from('users', 'u')
311
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
312
-	 * </code>
313
-	 *
314
-	 * @param mixed $select The selection expressions.
315
-	 * @param string $alias The column alias used in the constructed query.
316
-	 *
317
-	 * @return $this This QueryBuilder instance.
318
-	 * @since 8.2.1
319
-	 */
320
-	public function selectAlias($select, $alias);
321
-
322
-	/**
323
-	 * Specifies an item that is to be returned uniquely in the query result.
324
-	 *
325
-	 * <code>
326
-	 *     $qb = $conn->getQueryBuilder()
327
-	 *         ->selectDistinct('type')
328
-	 *         ->from('users');
329
-	 * </code>
330
-	 *
331
-	 * @param mixed $select The selection expressions.
332
-	 *
333
-	 * @return $this This QueryBuilder instance.
334
-	 * @since 9.0.0
335
-	 */
336
-	public function selectDistinct($select);
337
-
338
-	/**
339
-	 * Adds an item that is to be returned in the query result.
340
-	 *
341
-	 * <code>
342
-	 *     $qb = $conn->getQueryBuilder()
343
-	 *         ->select('u.id')
344
-	 *         ->addSelect('p.id')
345
-	 *         ->from('users', 'u')
346
-	 *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
347
-	 * </code>
348
-	 *
349
-	 * @param mixed ...$select The selection expression.
350
-	 *
351
-	 * @return $this This QueryBuilder instance.
352
-	 * @since 8.2.0
353
-	 */
354
-	public function addSelect(...$select);
355
-
356
-	/**
357
-	 * Turns the query being built into a bulk delete query that ranges over
358
-	 * a certain table.
359
-	 *
360
-	 * <code>
361
-	 *     $qb = $conn->getQueryBuilder()
362
-	 *         ->delete('users', 'u')
363
-	 *         ->where('u.id = :user_id');
364
-	 *         ->setParameter(':user_id', 1);
365
-	 * </code>
366
-	 *
367
-	 * @param string $delete The table whose rows are subject to the deletion.
368
-	 * @param string $alias The table alias used in the constructed query.
369
-	 *
370
-	 * @return $this This QueryBuilder instance.
371
-	 * @since 8.2.0
372
-	 */
373
-	public function delete($delete = null, $alias = null);
374
-
375
-	/**
376
-	 * Turns the query being built into a bulk update query that ranges over
377
-	 * a certain table
378
-	 *
379
-	 * <code>
380
-	 *     $qb = $conn->getQueryBuilder()
381
-	 *         ->update('users', 'u')
382
-	 *         ->set('u.password', md5('password'))
383
-	 *         ->where('u.id = ?');
384
-	 * </code>
385
-	 *
386
-	 * @param string $update The table whose rows are subject to the update.
387
-	 * @param string $alias The table alias used in the constructed query.
388
-	 *
389
-	 * @return $this This QueryBuilder instance.
390
-	 * @since 8.2.0
391
-	 */
392
-	public function update($update = null, $alias = null);
393
-
394
-	/**
395
-	 * Turns the query being built into an insert query that inserts into
396
-	 * a certain table
397
-	 *
398
-	 * <code>
399
-	 *     $qb = $conn->getQueryBuilder()
400
-	 *         ->insert('users')
401
-	 *         ->values(
402
-	 *             array(
403
-	 *                 'name' => '?',
404
-	 *                 'password' => '?'
405
-	 *             )
406
-	 *         );
407
-	 * </code>
408
-	 *
409
-	 * @param string $insert The table into which the rows should be inserted.
410
-	 *
411
-	 * @return $this This QueryBuilder instance.
412
-	 * @since 8.2.0
413
-	 */
414
-	public function insert($insert = null);
415
-
416
-	/**
417
-	 * Creates and adds a query root corresponding to the table identified by the
418
-	 * given alias, forming a cartesian product with any existing query roots.
419
-	 *
420
-	 * <code>
421
-	 *     $qb = $conn->getQueryBuilder()
422
-	 *         ->select('u.id')
423
-	 *         ->from('users', 'u')
424
-	 * </code>
425
-	 *
426
-	 * @param string $from The table.
427
-	 * @param string|null $alias The alias of the table.
428
-	 *
429
-	 * @return $this This QueryBuilder instance.
430
-	 * @since 8.2.0
431
-	 */
432
-	public function from($from, $alias = null);
433
-
434
-	/**
435
-	 * Creates and adds a join to the query.
436
-	 *
437
-	 * <code>
438
-	 *     $qb = $conn->getQueryBuilder()
439
-	 *         ->select('u.name')
440
-	 *         ->from('users', 'u')
441
-	 *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
442
-	 * </code>
443
-	 *
444
-	 * @param string $fromAlias The alias that points to a from clause.
445
-	 * @param string $join The table name to join.
446
-	 * @param string $alias The alias of the join table.
447
-	 * @param string $condition The condition for the join.
448
-	 *
449
-	 * @return $this This QueryBuilder instance.
450
-	 * @since 8.2.0
451
-	 */
452
-	public function join($fromAlias, $join, $alias, $condition = null);
453
-
454
-	/**
455
-	 * Creates and adds a join to the query.
456
-	 *
457
-	 * <code>
458
-	 *     $qb = $conn->getQueryBuilder()
459
-	 *         ->select('u.name')
460
-	 *         ->from('users', 'u')
461
-	 *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
462
-	 * </code>
463
-	 *
464
-	 * @param string $fromAlias The alias that points to a from clause.
465
-	 * @param string $join The table name to join.
466
-	 * @param string $alias The alias of the join table.
467
-	 * @param string $condition The condition for the join.
468
-	 *
469
-	 * @return $this This QueryBuilder instance.
470
-	 * @since 8.2.0
471
-	 */
472
-	public function innerJoin($fromAlias, $join, $alias, $condition = null);
473
-
474
-	/**
475
-	 * Creates and adds a left join to the query.
476
-	 *
477
-	 * <code>
478
-	 *     $qb = $conn->getQueryBuilder()
479
-	 *         ->select('u.name')
480
-	 *         ->from('users', 'u')
481
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
482
-	 * </code>
483
-	 *
484
-	 * @param string $fromAlias The alias that points to a from clause.
485
-	 * @param string $join The table name to join.
486
-	 * @param string $alias The alias of the join table.
487
-	 * @param string $condition The condition for the join.
488
-	 *
489
-	 * @return $this This QueryBuilder instance.
490
-	 * @since 8.2.0
491
-	 */
492
-	public function leftJoin($fromAlias, $join, $alias, $condition = null);
493
-
494
-	/**
495
-	 * Creates and adds a right join to the query.
496
-	 *
497
-	 * <code>
498
-	 *     $qb = $conn->getQueryBuilder()
499
-	 *         ->select('u.name')
500
-	 *         ->from('users', 'u')
501
-	 *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
502
-	 * </code>
503
-	 *
504
-	 * @param string $fromAlias The alias that points to a from clause.
505
-	 * @param string $join The table name to join.
506
-	 * @param string $alias The alias of the join table.
507
-	 * @param string $condition The condition for the join.
508
-	 *
509
-	 * @return $this This QueryBuilder instance.
510
-	 * @since 8.2.0
511
-	 */
512
-	public function rightJoin($fromAlias, $join, $alias, $condition = null);
513
-
514
-	/**
515
-	 * Sets a new value for a column in a bulk update query.
516
-	 *
517
-	 * <code>
518
-	 *     $qb = $conn->getQueryBuilder()
519
-	 *         ->update('users', 'u')
520
-	 *         ->set('u.password', md5('password'))
521
-	 *         ->where('u.id = ?');
522
-	 * </code>
523
-	 *
524
-	 * @param string $key The column to set.
525
-	 * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
526
-	 *
527
-	 * @return $this This QueryBuilder instance.
528
-	 * @since 8.2.0
529
-	 */
530
-	public function set($key, $value);
531
-
532
-	/**
533
-	 * Specifies one or more restrictions to the query result.
534
-	 * Replaces any previously specified restrictions, if any.
535
-	 *
536
-	 * <code>
537
-	 *     $qb = $conn->getQueryBuilder()
538
-	 *         ->select('u.name')
539
-	 *         ->from('users', 'u')
540
-	 *         ->where('u.id = ?');
541
-	 *
542
-	 *     // You can optionally programatically build and/or expressions
543
-	 *     $qb = $conn->getQueryBuilder();
544
-	 *
545
-	 *     $or = $qb->expr()->orx();
546
-	 *     $or->add($qb->expr()->eq('u.id', 1));
547
-	 *     $or->add($qb->expr()->eq('u.id', 2));
548
-	 *
549
-	 *     $qb->update('users', 'u')
550
-	 *         ->set('u.password', md5('password'))
551
-	 *         ->where($or);
552
-	 * </code>
553
-	 *
554
-	 * @param mixed $predicates The restriction predicates.
555
-	 *
556
-	 * @return $this This QueryBuilder instance.
557
-	 * @since 8.2.0
558
-	 */
559
-	public function where(...$predicates);
560
-
561
-	/**
562
-	 * Adds one or more restrictions to the query results, forming a logical
563
-	 * conjunction with any previously specified restrictions.
564
-	 *
565
-	 * <code>
566
-	 *     $qb = $conn->getQueryBuilder()
567
-	 *         ->select('u')
568
-	 *         ->from('users', 'u')
569
-	 *         ->where('u.username LIKE ?')
570
-	 *         ->andWhere('u.is_active = 1');
571
-	 * </code>
572
-	 *
573
-	 * @param mixed ...$where The query restrictions.
574
-	 *
575
-	 * @return $this This QueryBuilder instance.
576
-	 *
577
-	 * @see where()
578
-	 * @since 8.2.0
579
-	 */
580
-	public function andWhere(...$where);
581
-
582
-	/**
583
-	 * Adds one or more restrictions to the query results, forming a logical
584
-	 * disjunction with any previously specified restrictions.
585
-	 *
586
-	 * <code>
587
-	 *     $qb = $conn->getQueryBuilder()
588
-	 *         ->select('u.name')
589
-	 *         ->from('users', 'u')
590
-	 *         ->where('u.id = 1')
591
-	 *         ->orWhere('u.id = 2');
592
-	 * </code>
593
-	 *
594
-	 * @param mixed ...$where The WHERE statement.
595
-	 *
596
-	 * @return $this This QueryBuilder instance.
597
-	 *
598
-	 * @see where()
599
-	 * @since 8.2.0
600
-	 */
601
-	public function orWhere(...$where);
602
-
603
-	/**
604
-	 * Specifies a grouping over the results of the query.
605
-	 * Replaces any previously specified groupings, if any.
606
-	 *
607
-	 * <code>
608
-	 *     $qb = $conn->getQueryBuilder()
609
-	 *         ->select('u.name')
610
-	 *         ->from('users', 'u')
611
-	 *         ->groupBy('u.id');
612
-	 * </code>
613
-	 *
614
-	 * @param mixed ...$groupBys The grouping expression.
615
-	 *
616
-	 * @return $this This QueryBuilder instance.
617
-	 * @since 8.2.0
618
-	 */
619
-	public function groupBy(...$groupBys);
620
-
621
-	/**
622
-	 * Adds a grouping expression to the query.
623
-	 *
624
-	 * <code>
625
-	 *     $qb = $conn->getQueryBuilder()
626
-	 *         ->select('u.name')
627
-	 *         ->from('users', 'u')
628
-	 *         ->groupBy('u.lastLogin');
629
-	 *         ->addGroupBy('u.createdAt')
630
-	 * </code>
631
-	 *
632
-	 * @param mixed ...$groupBy The grouping expression.
633
-	 *
634
-	 * @return $this This QueryBuilder instance.
635
-	 * @since 8.2.0
636
-	 */
637
-	public function addGroupBy(...$groupBy);
638
-
639
-	/**
640
-	 * Sets a value for a column in an insert query.
641
-	 *
642
-	 * <code>
643
-	 *     $qb = $conn->getQueryBuilder()
644
-	 *         ->insert('users')
645
-	 *         ->values(
646
-	 *             array(
647
-	 *                 'name' => '?'
648
-	 *             )
649
-	 *         )
650
-	 *         ->setValue('password', '?');
651
-	 * </code>
652
-	 *
653
-	 * @param string $column The column into which the value should be inserted.
654
-	 * @param IParameter|string $value The value that should be inserted into the column.
655
-	 *
656
-	 * @return $this This QueryBuilder instance.
657
-	 * @since 8.2.0
658
-	 */
659
-	public function setValue($column, $value);
660
-
661
-	/**
662
-	 * Specifies values for an insert query indexed by column names.
663
-	 * Replaces any previous values, if any.
664
-	 *
665
-	 * <code>
666
-	 *     $qb = $conn->getQueryBuilder()
667
-	 *         ->insert('users')
668
-	 *         ->values(
669
-	 *             array(
670
-	 *                 'name' => '?',
671
-	 *                 'password' => '?'
672
-	 *             )
673
-	 *         );
674
-	 * </code>
675
-	 *
676
-	 * @param array $values The values to specify for the insert query indexed by column names.
677
-	 *
678
-	 * @return $this This QueryBuilder instance.
679
-	 * @since 8.2.0
680
-	 */
681
-	public function values(array $values);
682
-
683
-	/**
684
-	 * Specifies a restriction over the groups of the query.
685
-	 * Replaces any previous having restrictions, if any.
686
-	 *
687
-	 * @param mixed ...$having The restriction over the groups.
688
-	 *
689
-	 * @return $this This QueryBuilder instance.
690
-	 * @since 8.2.0
691
-	 */
692
-	public function having(...$having);
693
-
694
-	/**
695
-	 * Adds a restriction over the groups of the query, forming a logical
696
-	 * conjunction with any existing having restrictions.
697
-	 *
698
-	 * @param mixed ...$having The restriction to append.
699
-	 *
700
-	 * @return $this This QueryBuilder instance.
701
-	 * @since 8.2.0
702
-	 */
703
-	public function andHaving(...$having);
704
-
705
-	/**
706
-	 * Adds a restriction over the groups of the query, forming a logical
707
-	 * disjunction with any existing having restrictions.
708
-	 *
709
-	 * @param mixed ...$having The restriction to add.
710
-	 *
711
-	 * @return $this This QueryBuilder instance.
712
-	 * @since 8.2.0
713
-	 */
714
-	public function orHaving(...$having);
715
-
716
-	/**
717
-	 * Specifies an ordering for the query results.
718
-	 * Replaces any previously specified orderings, if any.
719
-	 *
720
-	 * @param string $sort The ordering expression.
721
-	 * @param string $order The ordering direction.
722
-	 *
723
-	 * @return $this This QueryBuilder instance.
724
-	 * @since 8.2.0
725
-	 */
726
-	public function orderBy($sort, $order = null);
727
-
728
-	/**
729
-	 * Adds an ordering to the query results.
730
-	 *
731
-	 * @param string $sort The ordering expression.
732
-	 * @param string $order The ordering direction.
733
-	 *
734
-	 * @return $this This QueryBuilder instance.
735
-	 * @since 8.2.0
736
-	 */
737
-	public function addOrderBy($sort, $order = null);
738
-
739
-	/**
740
-	 * Gets a query part by its name.
741
-	 *
742
-	 * @param string $queryPartName
743
-	 *
744
-	 * @return mixed
745
-	 * @since 8.2.0
746
-	 */
747
-	public function getQueryPart($queryPartName);
748
-
749
-	/**
750
-	 * Gets all query parts.
751
-	 *
752
-	 * @return array
753
-	 * @since 8.2.0
754
-	 */
755
-	public function getQueryParts();
756
-
757
-	/**
758
-	 * Resets SQL parts.
759
-	 *
760
-	 * @param array|null $queryPartNames
761
-	 *
762
-	 * @return $this This QueryBuilder instance.
763
-	 * @since 8.2.0
764
-	 */
765
-	public function resetQueryParts($queryPartNames = null);
766
-
767
-	/**
768
-	 * Resets a single SQL part.
769
-	 *
770
-	 * @param string $queryPartName
771
-	 *
772
-	 * @return $this This QueryBuilder instance.
773
-	 * @since 8.2.0
774
-	 */
775
-	public function resetQueryPart($queryPartName);
776
-
777
-	/**
778
-	 * Creates a new named parameter and bind the value $value to it.
779
-	 *
780
-	 * This method provides a shortcut for PDOStatement::bindValue
781
-	 * when using prepared statements.
782
-	 *
783
-	 * The parameter $value specifies the value that you want to bind. If
784
-	 * $placeholder is not provided bindValue() will automatically create a
785
-	 * placeholder for you. An automatic placeholder will be of the name
786
-	 * ':dcValue1', ':dcValue2' etc.
787
-	 *
788
-	 * For more information see {@link http://php.net/pdostatement-bindparam}
789
-	 *
790
-	 * Example:
791
-	 * <code>
792
-	 * $value = 2;
793
-	 * $q->eq( 'id', $q->bindValue( $value ) );
794
-	 * $stmt = $q->executeQuery(); // executed with 'id = 2'
795
-	 * </code>
796
-	 *
797
-	 * @license New BSD License
798
-	 * @link http://www.zetacomponents.org
799
-	 *
800
-	 * @param mixed $value
801
-	 * @param mixed $type
802
-	 * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
803
-	 *
804
-	 * @return IParameter
805
-	 * @since 8.2.0
806
-	 */
807
-	public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
808
-
809
-	/**
810
-	 * Creates a new positional parameter and bind the given value to it.
811
-	 *
812
-	 * Attention: If you are using positional parameters with the query builder you have
813
-	 * to be very careful to bind all parameters in the order they appear in the SQL
814
-	 * statement , otherwise they get bound in the wrong order which can lead to serious
815
-	 * bugs in your code.
816
-	 *
817
-	 * Example:
818
-	 * <code>
819
-	 *  $qb = $conn->getQueryBuilder();
820
-	 *  $qb->select('u.*')
821
-	 *     ->from('users', 'u')
822
-	 *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
823
-	 *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
824
-	 * </code>
825
-	 *
826
-	 * @param mixed $value
827
-	 * @param integer $type
828
-	 *
829
-	 * @return IParameter
830
-	 * @since 8.2.0
831
-	 */
832
-	public function createPositionalParameter($value, $type = self::PARAM_STR);
833
-
834
-	/**
835
-	 * Creates a new parameter
836
-	 *
837
-	 * Example:
838
-	 * <code>
839
-	 *  $qb = $conn->getQueryBuilder();
840
-	 *  $qb->select('u.*')
841
-	 *     ->from('users', 'u')
842
-	 *     ->where('u.username = ' . $qb->createParameter('name'))
843
-	 *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
844
-	 * </code>
845
-	 *
846
-	 * @param string $name
847
-	 *
848
-	 * @return IParameter
849
-	 * @since 8.2.0
850
-	 */
851
-	public function createParameter($name);
852
-
853
-	/**
854
-	 * Creates a new function
855
-	 *
856
-	 * Attention: Column names inside the call have to be quoted before hand
857
-	 *
858
-	 * Example:
859
-	 * <code>
860
-	 *  $qb = $conn->getQueryBuilder();
861
-	 *  $qb->select($qb->createFunction('COUNT(*)'))
862
-	 *     ->from('users', 'u')
863
-	 *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
864
-	 * </code>
865
-	 * <code>
866
-	 *  $qb = $conn->getQueryBuilder();
867
-	 *  $qb->select($qb->createFunction('COUNT(`column`)'))
868
-	 *     ->from('users', 'u')
869
-	 *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
870
-	 * </code>
871
-	 *
872
-	 * @param string $call
873
-	 *
874
-	 * @return IQueryFunction
875
-	 * @since 8.2.0
876
-	 */
877
-	public function createFunction($call);
878
-
879
-	/**
880
-	 * Used to get the id of the last inserted element
881
-	 * @return int
882
-	 * @throws \BadMethodCallException When being called before an insert query has been run.
883
-	 * @since 9.0.0
884
-	 */
885
-	public function getLastInsertId();
886
-
887
-	/**
888
-	 * Returns the table name quoted and with database prefix as needed by the implementation
889
-	 *
890
-	 * @param string $table
891
-	 * @return string
892
-	 * @since 9.0.0
893
-	 */
894
-	public function getTableName($table);
895
-
896
-	/**
897
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
898
-	 *
899
-	 * @param string $column
900
-	 * @param string $tableAlias
901
-	 * @return string
902
-	 * @since 9.0.0
903
-	 */
904
-	public function getColumnName($column, $tableAlias = '');
38
+    /**
39
+     * @since 9.0.0
40
+     */
41
+    public const PARAM_NULL = \PDO::PARAM_NULL;
42
+    /**
43
+     * @since 9.0.0
44
+     */
45
+    public const PARAM_BOOL = \PDO::PARAM_BOOL;
46
+    /**
47
+     * @since 9.0.0
48
+     */
49
+    public const PARAM_INT = \PDO::PARAM_INT;
50
+    /**
51
+     * @since 9.0.0
52
+     */
53
+    public const PARAM_STR = \PDO::PARAM_STR;
54
+    /**
55
+     * @since 9.0.0
56
+     */
57
+    public const PARAM_LOB = \PDO::PARAM_LOB;
58
+    /**
59
+     * @since 9.0.0
60
+     */
61
+    public const PARAM_DATE = 'datetime';
62
+
63
+    /**
64
+     * @since 9.0.0
65
+     */
66
+    public const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY;
67
+    /**
68
+     * @since 9.0.0
69
+     */
70
+    public const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY;
71
+
72
+
73
+    /**
74
+     * Enable/disable automatic prefixing of table names with the oc_ prefix
75
+     *
76
+     * @param bool $enabled If set to true table names will be prefixed with the
77
+     * owncloud database prefix automatically.
78
+     * @since 8.2.0
79
+     */
80
+    public function automaticTablePrefix($enabled);
81
+
82
+    /**
83
+     * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
84
+     * This producer method is intended for convenient inline usage. Example:
85
+     *
86
+     * <code>
87
+     *     $qb = $conn->getQueryBuilder()
88
+     *         ->select('u')
89
+     *         ->from('users', 'u')
90
+     *         ->where($qb->expr()->eq('u.id', 1));
91
+     * </code>
92
+     *
93
+     * For more complex expression construction, consider storing the expression
94
+     * builder object in a local variable.
95
+     *
96
+     * @return \OCP\DB\QueryBuilder\IExpressionBuilder
97
+     * @since 8.2.0
98
+     */
99
+    public function expr();
100
+
101
+    /**
102
+     * Gets an FunctionBuilder used for object-oriented construction of query functions.
103
+     * This producer method is intended for convenient inline usage. Example:
104
+     *
105
+     * <code>
106
+     *     $qb = $conn->getQueryBuilder()
107
+     *         ->select('u')
108
+     *         ->from('users', 'u')
109
+     *         ->where($qb->fun()->md5('u.id'));
110
+     * </code>
111
+     *
112
+     * For more complex function construction, consider storing the function
113
+     * builder object in a local variable.
114
+     *
115
+     * @return \OCP\DB\QueryBuilder\IFunctionBuilder
116
+     * @since 12.0.0
117
+     */
118
+    public function func();
119
+
120
+    /**
121
+     * Gets the type of the currently built query.
122
+     *
123
+     * @return integer
124
+     * @since 8.2.0
125
+     */
126
+    public function getType();
127
+
128
+    /**
129
+     * Gets the associated DBAL Connection for this query builder.
130
+     *
131
+     * @return \OCP\IDBConnection
132
+     * @since 8.2.0
133
+     */
134
+    public function getConnection();
135
+
136
+    /**
137
+     * Gets the state of this query builder instance.
138
+     *
139
+     * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
140
+     * @since 8.2.0
141
+     */
142
+    public function getState();
143
+
144
+    /**
145
+     * Executes this query using the bound parameters and their types.
146
+     *
147
+     * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
148
+     * for insert, update and delete statements.
149
+     *
150
+     * @return \Doctrine\DBAL\Driver\Statement|int
151
+     * @since 8.2.0
152
+     */
153
+    public function execute();
154
+
155
+    /**
156
+     * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
157
+     *
158
+     * <code>
159
+     *     $qb = $conn->getQueryBuilder()
160
+     *         ->select('u')
161
+     *         ->from('User', 'u')
162
+     *     echo $qb->getSQL(); // SELECT u FROM User u
163
+     * </code>
164
+     *
165
+     * @return string The SQL query string.
166
+     * @since 8.2.0
167
+     */
168
+    public function getSQL();
169
+
170
+    /**
171
+     * Sets a query parameter for the query being constructed.
172
+     *
173
+     * <code>
174
+     *     $qb = $conn->getQueryBuilder()
175
+     *         ->select('u')
176
+     *         ->from('users', 'u')
177
+     *         ->where('u.id = :user_id')
178
+     *         ->setParameter(':user_id', 1);
179
+     * </code>
180
+     *
181
+     * @param string|integer $key The parameter position or name.
182
+     * @param mixed $value The parameter value.
183
+     * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
184
+     *
185
+     * @return $this This QueryBuilder instance.
186
+     * @since 8.2.0
187
+     */
188
+    public function setParameter($key, $value, $type = null);
189
+
190
+    /**
191
+     * Sets a collection of query parameters for the query being constructed.
192
+     *
193
+     * <code>
194
+     *     $qb = $conn->getQueryBuilder()
195
+     *         ->select('u')
196
+     *         ->from('users', 'u')
197
+     *         ->where('u.id = :user_id1 OR u.id = :user_id2')
198
+     *         ->setParameters(array(
199
+     *             ':user_id1' => 1,
200
+     *             ':user_id2' => 2
201
+     *         ));
202
+     * </code>
203
+     *
204
+     * @param array $params The query parameters to set.
205
+     * @param array $types The query parameters types to set.
206
+     *
207
+     * @return $this This QueryBuilder instance.
208
+     * @since 8.2.0
209
+     */
210
+    public function setParameters(array $params, array $types = []);
211
+
212
+    /**
213
+     * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
214
+     *
215
+     * @return array The currently defined query parameters indexed by parameter index or name.
216
+     * @since 8.2.0
217
+     */
218
+    public function getParameters();
219
+
220
+    /**
221
+     * Gets a (previously set) query parameter of the query being constructed.
222
+     *
223
+     * @param mixed $key The key (index or name) of the bound parameter.
224
+     *
225
+     * @return mixed The value of the bound parameter.
226
+     * @since 8.2.0
227
+     */
228
+    public function getParameter($key);
229
+
230
+    /**
231
+     * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
232
+     *
233
+     * @return array The currently defined query parameter types indexed by parameter index or name.
234
+     * @since 8.2.0
235
+     */
236
+    public function getParameterTypes();
237
+
238
+    /**
239
+     * Gets a (previously set) query parameter type of the query being constructed.
240
+     *
241
+     * @param mixed $key The key (index or name) of the bound parameter type.
242
+     *
243
+     * @return mixed The value of the bound parameter type.
244
+     * @since 8.2.0
245
+     */
246
+    public function getParameterType($key);
247
+
248
+    /**
249
+     * Sets the position of the first result to retrieve (the "offset").
250
+     *
251
+     * @param integer $firstResult The first result to return.
252
+     *
253
+     * @return $this This QueryBuilder instance.
254
+     * @since 8.2.0
255
+     */
256
+    public function setFirstResult($firstResult);
257
+
258
+    /**
259
+     * Gets the position of the first result the query object was set to retrieve (the "offset").
260
+     * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
261
+     *
262
+     * @return integer The position of the first result.
263
+     * @since 8.2.0
264
+     */
265
+    public function getFirstResult();
266
+
267
+    /**
268
+     * Sets the maximum number of results to retrieve (the "limit").
269
+     *
270
+     * @param integer $maxResults The maximum number of results to retrieve.
271
+     *
272
+     * @return $this This QueryBuilder instance.
273
+     * @since 8.2.0
274
+     */
275
+    public function setMaxResults($maxResults);
276
+
277
+    /**
278
+     * Gets the maximum number of results the query object was set to retrieve (the "limit").
279
+     * Returns NULL if {@link setMaxResults} was not applied to this query builder.
280
+     *
281
+     * @return integer The maximum number of results.
282
+     * @since 8.2.0
283
+     */
284
+    public function getMaxResults();
285
+
286
+    /**
287
+     * Specifies an item that is to be returned in the query result.
288
+     * Replaces any previously specified selections, if any.
289
+     *
290
+     * <code>
291
+     *     $qb = $conn->getQueryBuilder()
292
+     *         ->select('u.id', 'p.id')
293
+     *         ->from('users', 'u')
294
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
295
+     * </code>
296
+     *
297
+     * @param mixed ...$selects The selection expressions.
298
+     *
299
+     * @return $this This QueryBuilder instance.
300
+     * @since 8.2.0
301
+     */
302
+    public function select(...$selects);
303
+
304
+    /**
305
+     * Specifies an item that is to be returned with a different name in the query result.
306
+     *
307
+     * <code>
308
+     *     $qb = $conn->getQueryBuilder()
309
+     *         ->selectAlias('u.id', 'user_id')
310
+     *         ->from('users', 'u')
311
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
312
+     * </code>
313
+     *
314
+     * @param mixed $select The selection expressions.
315
+     * @param string $alias The column alias used in the constructed query.
316
+     *
317
+     * @return $this This QueryBuilder instance.
318
+     * @since 8.2.1
319
+     */
320
+    public function selectAlias($select, $alias);
321
+
322
+    /**
323
+     * Specifies an item that is to be returned uniquely in the query result.
324
+     *
325
+     * <code>
326
+     *     $qb = $conn->getQueryBuilder()
327
+     *         ->selectDistinct('type')
328
+     *         ->from('users');
329
+     * </code>
330
+     *
331
+     * @param mixed $select The selection expressions.
332
+     *
333
+     * @return $this This QueryBuilder instance.
334
+     * @since 9.0.0
335
+     */
336
+    public function selectDistinct($select);
337
+
338
+    /**
339
+     * Adds an item that is to be returned in the query result.
340
+     *
341
+     * <code>
342
+     *     $qb = $conn->getQueryBuilder()
343
+     *         ->select('u.id')
344
+     *         ->addSelect('p.id')
345
+     *         ->from('users', 'u')
346
+     *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
347
+     * </code>
348
+     *
349
+     * @param mixed ...$select The selection expression.
350
+     *
351
+     * @return $this This QueryBuilder instance.
352
+     * @since 8.2.0
353
+     */
354
+    public function addSelect(...$select);
355
+
356
+    /**
357
+     * Turns the query being built into a bulk delete query that ranges over
358
+     * a certain table.
359
+     *
360
+     * <code>
361
+     *     $qb = $conn->getQueryBuilder()
362
+     *         ->delete('users', 'u')
363
+     *         ->where('u.id = :user_id');
364
+     *         ->setParameter(':user_id', 1);
365
+     * </code>
366
+     *
367
+     * @param string $delete The table whose rows are subject to the deletion.
368
+     * @param string $alias The table alias used in the constructed query.
369
+     *
370
+     * @return $this This QueryBuilder instance.
371
+     * @since 8.2.0
372
+     */
373
+    public function delete($delete = null, $alias = null);
374
+
375
+    /**
376
+     * Turns the query being built into a bulk update query that ranges over
377
+     * a certain table
378
+     *
379
+     * <code>
380
+     *     $qb = $conn->getQueryBuilder()
381
+     *         ->update('users', 'u')
382
+     *         ->set('u.password', md5('password'))
383
+     *         ->where('u.id = ?');
384
+     * </code>
385
+     *
386
+     * @param string $update The table whose rows are subject to the update.
387
+     * @param string $alias The table alias used in the constructed query.
388
+     *
389
+     * @return $this This QueryBuilder instance.
390
+     * @since 8.2.0
391
+     */
392
+    public function update($update = null, $alias = null);
393
+
394
+    /**
395
+     * Turns the query being built into an insert query that inserts into
396
+     * a certain table
397
+     *
398
+     * <code>
399
+     *     $qb = $conn->getQueryBuilder()
400
+     *         ->insert('users')
401
+     *         ->values(
402
+     *             array(
403
+     *                 'name' => '?',
404
+     *                 'password' => '?'
405
+     *             )
406
+     *         );
407
+     * </code>
408
+     *
409
+     * @param string $insert The table into which the rows should be inserted.
410
+     *
411
+     * @return $this This QueryBuilder instance.
412
+     * @since 8.2.0
413
+     */
414
+    public function insert($insert = null);
415
+
416
+    /**
417
+     * Creates and adds a query root corresponding to the table identified by the
418
+     * given alias, forming a cartesian product with any existing query roots.
419
+     *
420
+     * <code>
421
+     *     $qb = $conn->getQueryBuilder()
422
+     *         ->select('u.id')
423
+     *         ->from('users', 'u')
424
+     * </code>
425
+     *
426
+     * @param string $from The table.
427
+     * @param string|null $alias The alias of the table.
428
+     *
429
+     * @return $this This QueryBuilder instance.
430
+     * @since 8.2.0
431
+     */
432
+    public function from($from, $alias = null);
433
+
434
+    /**
435
+     * Creates and adds a join to the query.
436
+     *
437
+     * <code>
438
+     *     $qb = $conn->getQueryBuilder()
439
+     *         ->select('u.name')
440
+     *         ->from('users', 'u')
441
+     *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
442
+     * </code>
443
+     *
444
+     * @param string $fromAlias The alias that points to a from clause.
445
+     * @param string $join The table name to join.
446
+     * @param string $alias The alias of the join table.
447
+     * @param string $condition The condition for the join.
448
+     *
449
+     * @return $this This QueryBuilder instance.
450
+     * @since 8.2.0
451
+     */
452
+    public function join($fromAlias, $join, $alias, $condition = null);
453
+
454
+    /**
455
+     * Creates and adds a join to the query.
456
+     *
457
+     * <code>
458
+     *     $qb = $conn->getQueryBuilder()
459
+     *         ->select('u.name')
460
+     *         ->from('users', 'u')
461
+     *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
462
+     * </code>
463
+     *
464
+     * @param string $fromAlias The alias that points to a from clause.
465
+     * @param string $join The table name to join.
466
+     * @param string $alias The alias of the join table.
467
+     * @param string $condition The condition for the join.
468
+     *
469
+     * @return $this This QueryBuilder instance.
470
+     * @since 8.2.0
471
+     */
472
+    public function innerJoin($fromAlias, $join, $alias, $condition = null);
473
+
474
+    /**
475
+     * Creates and adds a left join to the query.
476
+     *
477
+     * <code>
478
+     *     $qb = $conn->getQueryBuilder()
479
+     *         ->select('u.name')
480
+     *         ->from('users', 'u')
481
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
482
+     * </code>
483
+     *
484
+     * @param string $fromAlias The alias that points to a from clause.
485
+     * @param string $join The table name to join.
486
+     * @param string $alias The alias of the join table.
487
+     * @param string $condition The condition for the join.
488
+     *
489
+     * @return $this This QueryBuilder instance.
490
+     * @since 8.2.0
491
+     */
492
+    public function leftJoin($fromAlias, $join, $alias, $condition = null);
493
+
494
+    /**
495
+     * Creates and adds a right join to the query.
496
+     *
497
+     * <code>
498
+     *     $qb = $conn->getQueryBuilder()
499
+     *         ->select('u.name')
500
+     *         ->from('users', 'u')
501
+     *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
502
+     * </code>
503
+     *
504
+     * @param string $fromAlias The alias that points to a from clause.
505
+     * @param string $join The table name to join.
506
+     * @param string $alias The alias of the join table.
507
+     * @param string $condition The condition for the join.
508
+     *
509
+     * @return $this This QueryBuilder instance.
510
+     * @since 8.2.0
511
+     */
512
+    public function rightJoin($fromAlias, $join, $alias, $condition = null);
513
+
514
+    /**
515
+     * Sets a new value for a column in a bulk update query.
516
+     *
517
+     * <code>
518
+     *     $qb = $conn->getQueryBuilder()
519
+     *         ->update('users', 'u')
520
+     *         ->set('u.password', md5('password'))
521
+     *         ->where('u.id = ?');
522
+     * </code>
523
+     *
524
+     * @param string $key The column to set.
525
+     * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
526
+     *
527
+     * @return $this This QueryBuilder instance.
528
+     * @since 8.2.0
529
+     */
530
+    public function set($key, $value);
531
+
532
+    /**
533
+     * Specifies one or more restrictions to the query result.
534
+     * Replaces any previously specified restrictions, if any.
535
+     *
536
+     * <code>
537
+     *     $qb = $conn->getQueryBuilder()
538
+     *         ->select('u.name')
539
+     *         ->from('users', 'u')
540
+     *         ->where('u.id = ?');
541
+     *
542
+     *     // You can optionally programatically build and/or expressions
543
+     *     $qb = $conn->getQueryBuilder();
544
+     *
545
+     *     $or = $qb->expr()->orx();
546
+     *     $or->add($qb->expr()->eq('u.id', 1));
547
+     *     $or->add($qb->expr()->eq('u.id', 2));
548
+     *
549
+     *     $qb->update('users', 'u')
550
+     *         ->set('u.password', md5('password'))
551
+     *         ->where($or);
552
+     * </code>
553
+     *
554
+     * @param mixed $predicates The restriction predicates.
555
+     *
556
+     * @return $this This QueryBuilder instance.
557
+     * @since 8.2.0
558
+     */
559
+    public function where(...$predicates);
560
+
561
+    /**
562
+     * Adds one or more restrictions to the query results, forming a logical
563
+     * conjunction with any previously specified restrictions.
564
+     *
565
+     * <code>
566
+     *     $qb = $conn->getQueryBuilder()
567
+     *         ->select('u')
568
+     *         ->from('users', 'u')
569
+     *         ->where('u.username LIKE ?')
570
+     *         ->andWhere('u.is_active = 1');
571
+     * </code>
572
+     *
573
+     * @param mixed ...$where The query restrictions.
574
+     *
575
+     * @return $this This QueryBuilder instance.
576
+     *
577
+     * @see where()
578
+     * @since 8.2.0
579
+     */
580
+    public function andWhere(...$where);
581
+
582
+    /**
583
+     * Adds one or more restrictions to the query results, forming a logical
584
+     * disjunction with any previously specified restrictions.
585
+     *
586
+     * <code>
587
+     *     $qb = $conn->getQueryBuilder()
588
+     *         ->select('u.name')
589
+     *         ->from('users', 'u')
590
+     *         ->where('u.id = 1')
591
+     *         ->orWhere('u.id = 2');
592
+     * </code>
593
+     *
594
+     * @param mixed ...$where The WHERE statement.
595
+     *
596
+     * @return $this This QueryBuilder instance.
597
+     *
598
+     * @see where()
599
+     * @since 8.2.0
600
+     */
601
+    public function orWhere(...$where);
602
+
603
+    /**
604
+     * Specifies a grouping over the results of the query.
605
+     * Replaces any previously specified groupings, if any.
606
+     *
607
+     * <code>
608
+     *     $qb = $conn->getQueryBuilder()
609
+     *         ->select('u.name')
610
+     *         ->from('users', 'u')
611
+     *         ->groupBy('u.id');
612
+     * </code>
613
+     *
614
+     * @param mixed ...$groupBys The grouping expression.
615
+     *
616
+     * @return $this This QueryBuilder instance.
617
+     * @since 8.2.0
618
+     */
619
+    public function groupBy(...$groupBys);
620
+
621
+    /**
622
+     * Adds a grouping expression to the query.
623
+     *
624
+     * <code>
625
+     *     $qb = $conn->getQueryBuilder()
626
+     *         ->select('u.name')
627
+     *         ->from('users', 'u')
628
+     *         ->groupBy('u.lastLogin');
629
+     *         ->addGroupBy('u.createdAt')
630
+     * </code>
631
+     *
632
+     * @param mixed ...$groupBy The grouping expression.
633
+     *
634
+     * @return $this This QueryBuilder instance.
635
+     * @since 8.2.0
636
+     */
637
+    public function addGroupBy(...$groupBy);
638
+
639
+    /**
640
+     * Sets a value for a column in an insert query.
641
+     *
642
+     * <code>
643
+     *     $qb = $conn->getQueryBuilder()
644
+     *         ->insert('users')
645
+     *         ->values(
646
+     *             array(
647
+     *                 'name' => '?'
648
+     *             )
649
+     *         )
650
+     *         ->setValue('password', '?');
651
+     * </code>
652
+     *
653
+     * @param string $column The column into which the value should be inserted.
654
+     * @param IParameter|string $value The value that should be inserted into the column.
655
+     *
656
+     * @return $this This QueryBuilder instance.
657
+     * @since 8.2.0
658
+     */
659
+    public function setValue($column, $value);
660
+
661
+    /**
662
+     * Specifies values for an insert query indexed by column names.
663
+     * Replaces any previous values, if any.
664
+     *
665
+     * <code>
666
+     *     $qb = $conn->getQueryBuilder()
667
+     *         ->insert('users')
668
+     *         ->values(
669
+     *             array(
670
+     *                 'name' => '?',
671
+     *                 'password' => '?'
672
+     *             )
673
+     *         );
674
+     * </code>
675
+     *
676
+     * @param array $values The values to specify for the insert query indexed by column names.
677
+     *
678
+     * @return $this This QueryBuilder instance.
679
+     * @since 8.2.0
680
+     */
681
+    public function values(array $values);
682
+
683
+    /**
684
+     * Specifies a restriction over the groups of the query.
685
+     * Replaces any previous having restrictions, if any.
686
+     *
687
+     * @param mixed ...$having The restriction over the groups.
688
+     *
689
+     * @return $this This QueryBuilder instance.
690
+     * @since 8.2.0
691
+     */
692
+    public function having(...$having);
693
+
694
+    /**
695
+     * Adds a restriction over the groups of the query, forming a logical
696
+     * conjunction with any existing having restrictions.
697
+     *
698
+     * @param mixed ...$having The restriction to append.
699
+     *
700
+     * @return $this This QueryBuilder instance.
701
+     * @since 8.2.0
702
+     */
703
+    public function andHaving(...$having);
704
+
705
+    /**
706
+     * Adds a restriction over the groups of the query, forming a logical
707
+     * disjunction with any existing having restrictions.
708
+     *
709
+     * @param mixed ...$having The restriction to add.
710
+     *
711
+     * @return $this This QueryBuilder instance.
712
+     * @since 8.2.0
713
+     */
714
+    public function orHaving(...$having);
715
+
716
+    /**
717
+     * Specifies an ordering for the query results.
718
+     * Replaces any previously specified orderings, if any.
719
+     *
720
+     * @param string $sort The ordering expression.
721
+     * @param string $order The ordering direction.
722
+     *
723
+     * @return $this This QueryBuilder instance.
724
+     * @since 8.2.0
725
+     */
726
+    public function orderBy($sort, $order = null);
727
+
728
+    /**
729
+     * Adds an ordering to the query results.
730
+     *
731
+     * @param string $sort The ordering expression.
732
+     * @param string $order The ordering direction.
733
+     *
734
+     * @return $this This QueryBuilder instance.
735
+     * @since 8.2.0
736
+     */
737
+    public function addOrderBy($sort, $order = null);
738
+
739
+    /**
740
+     * Gets a query part by its name.
741
+     *
742
+     * @param string $queryPartName
743
+     *
744
+     * @return mixed
745
+     * @since 8.2.0
746
+     */
747
+    public function getQueryPart($queryPartName);
748
+
749
+    /**
750
+     * Gets all query parts.
751
+     *
752
+     * @return array
753
+     * @since 8.2.0
754
+     */
755
+    public function getQueryParts();
756
+
757
+    /**
758
+     * Resets SQL parts.
759
+     *
760
+     * @param array|null $queryPartNames
761
+     *
762
+     * @return $this This QueryBuilder instance.
763
+     * @since 8.2.0
764
+     */
765
+    public function resetQueryParts($queryPartNames = null);
766
+
767
+    /**
768
+     * Resets a single SQL part.
769
+     *
770
+     * @param string $queryPartName
771
+     *
772
+     * @return $this This QueryBuilder instance.
773
+     * @since 8.2.0
774
+     */
775
+    public function resetQueryPart($queryPartName);
776
+
777
+    /**
778
+     * Creates a new named parameter and bind the value $value to it.
779
+     *
780
+     * This method provides a shortcut for PDOStatement::bindValue
781
+     * when using prepared statements.
782
+     *
783
+     * The parameter $value specifies the value that you want to bind. If
784
+     * $placeholder is not provided bindValue() will automatically create a
785
+     * placeholder for you. An automatic placeholder will be of the name
786
+     * ':dcValue1', ':dcValue2' etc.
787
+     *
788
+     * For more information see {@link http://php.net/pdostatement-bindparam}
789
+     *
790
+     * Example:
791
+     * <code>
792
+     * $value = 2;
793
+     * $q->eq( 'id', $q->bindValue( $value ) );
794
+     * $stmt = $q->executeQuery(); // executed with 'id = 2'
795
+     * </code>
796
+     *
797
+     * @license New BSD License
798
+     * @link http://www.zetacomponents.org
799
+     *
800
+     * @param mixed $value
801
+     * @param mixed $type
802
+     * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
803
+     *
804
+     * @return IParameter
805
+     * @since 8.2.0
806
+     */
807
+    public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
808
+
809
+    /**
810
+     * Creates a new positional parameter and bind the given value to it.
811
+     *
812
+     * Attention: If you are using positional parameters with the query builder you have
813
+     * to be very careful to bind all parameters in the order they appear in the SQL
814
+     * statement , otherwise they get bound in the wrong order which can lead to serious
815
+     * bugs in your code.
816
+     *
817
+     * Example:
818
+     * <code>
819
+     *  $qb = $conn->getQueryBuilder();
820
+     *  $qb->select('u.*')
821
+     *     ->from('users', 'u')
822
+     *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
823
+     *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
824
+     * </code>
825
+     *
826
+     * @param mixed $value
827
+     * @param integer $type
828
+     *
829
+     * @return IParameter
830
+     * @since 8.2.0
831
+     */
832
+    public function createPositionalParameter($value, $type = self::PARAM_STR);
833
+
834
+    /**
835
+     * Creates a new parameter
836
+     *
837
+     * Example:
838
+     * <code>
839
+     *  $qb = $conn->getQueryBuilder();
840
+     *  $qb->select('u.*')
841
+     *     ->from('users', 'u')
842
+     *     ->where('u.username = ' . $qb->createParameter('name'))
843
+     *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
844
+     * </code>
845
+     *
846
+     * @param string $name
847
+     *
848
+     * @return IParameter
849
+     * @since 8.2.0
850
+     */
851
+    public function createParameter($name);
852
+
853
+    /**
854
+     * Creates a new function
855
+     *
856
+     * Attention: Column names inside the call have to be quoted before hand
857
+     *
858
+     * Example:
859
+     * <code>
860
+     *  $qb = $conn->getQueryBuilder();
861
+     *  $qb->select($qb->createFunction('COUNT(*)'))
862
+     *     ->from('users', 'u')
863
+     *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
864
+     * </code>
865
+     * <code>
866
+     *  $qb = $conn->getQueryBuilder();
867
+     *  $qb->select($qb->createFunction('COUNT(`column`)'))
868
+     *     ->from('users', 'u')
869
+     *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
870
+     * </code>
871
+     *
872
+     * @param string $call
873
+     *
874
+     * @return IQueryFunction
875
+     * @since 8.2.0
876
+     */
877
+    public function createFunction($call);
878
+
879
+    /**
880
+     * Used to get the id of the last inserted element
881
+     * @return int
882
+     * @throws \BadMethodCallException When being called before an insert query has been run.
883
+     * @since 9.0.0
884
+     */
885
+    public function getLastInsertId();
886
+
887
+    /**
888
+     * Returns the table name quoted and with database prefix as needed by the implementation
889
+     *
890
+     * @param string $table
891
+     * @return string
892
+     * @since 9.0.0
893
+     */
894
+    public function getTableName($table);
895
+
896
+    /**
897
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
898
+     *
899
+     * @param string $column
900
+     * @param string $tableAlias
901
+     * @return string
902
+     * @since 9.0.0
903
+     */
904
+    public function getColumnName($column, $tableAlias = '');
905 905
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/QueryBuilder.php 1 patch
Indentation   +1171 added lines, -1171 removed lines patch added patch discarded remove patch
@@ -51,1175 +51,1175 @@
 block discarded – undo
51 51
 
52 52
 class QueryBuilder implements IQueryBuilder {
53 53
 
54
-	/** @var \OCP\IDBConnection */
55
-	private $connection;
56
-
57
-	/** @var SystemConfig */
58
-	private $systemConfig;
59
-
60
-	/** @var ILogger */
61
-	private $logger;
62
-
63
-	/** @var \Doctrine\DBAL\Query\QueryBuilder */
64
-	private $queryBuilder;
65
-
66
-	/** @var QuoteHelper */
67
-	private $helper;
68
-
69
-	/** @var bool */
70
-	private $automaticTablePrefix = true;
71
-
72
-	/** @var string */
73
-	protected $lastInsertedTable;
74
-
75
-	/**
76
-	 * Initializes a new QueryBuilder.
77
-	 *
78
-	 * @param IDBConnection $connection
79
-	 * @param SystemConfig $systemConfig
80
-	 * @param ILogger $logger
81
-	 */
82
-	public function __construct(IDBConnection $connection, SystemConfig $systemConfig, ILogger $logger) {
83
-		$this->connection = $connection;
84
-		$this->systemConfig = $systemConfig;
85
-		$this->logger = $logger;
86
-		$this->queryBuilder = new \Doctrine\DBAL\Query\QueryBuilder($this->connection);
87
-		$this->helper = new QuoteHelper();
88
-	}
89
-
90
-	/**
91
-	 * Enable/disable automatic prefixing of table names with the oc_ prefix
92
-	 *
93
-	 * @param bool $enabled If set to true table names will be prefixed with the
94
-	 * owncloud database prefix automatically.
95
-	 * @since 8.2.0
96
-	 */
97
-	public function automaticTablePrefix($enabled) {
98
-		$this->automaticTablePrefix = (bool) $enabled;
99
-	}
100
-
101
-	/**
102
-	 * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
103
-	 * This producer method is intended for convenient inline usage. Example:
104
-	 *
105
-	 * <code>
106
-	 *     $qb = $conn->getQueryBuilder()
107
-	 *         ->select('u')
108
-	 *         ->from('users', 'u')
109
-	 *         ->where($qb->expr()->eq('u.id', 1));
110
-	 * </code>
111
-	 *
112
-	 * For more complex expression construction, consider storing the expression
113
-	 * builder object in a local variable.
114
-	 *
115
-	 * @return \OCP\DB\QueryBuilder\IExpressionBuilder
116
-	 */
117
-	public function expr() {
118
-		if ($this->connection instanceof OracleConnection) {
119
-			return new OCIExpressionBuilder($this->connection, $this);
120
-		} elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
121
-			return new PgSqlExpressionBuilder($this->connection, $this);
122
-		} elseif ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
123
-			return new MySqlExpressionBuilder($this->connection, $this);
124
-		} elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
125
-			return new SqliteExpressionBuilder($this->connection, $this);
126
-		} else {
127
-			return new ExpressionBuilder($this->connection, $this);
128
-		}
129
-	}
130
-
131
-	/**
132
-	 * Gets an FunctionBuilder used for object-oriented construction of query functions.
133
-	 * This producer method is intended for convenient inline usage. Example:
134
-	 *
135
-	 * <code>
136
-	 *     $qb = $conn->getQueryBuilder()
137
-	 *         ->select('u')
138
-	 *         ->from('users', 'u')
139
-	 *         ->where($qb->fun()->md5('u.id'));
140
-	 * </code>
141
-	 *
142
-	 * For more complex function construction, consider storing the function
143
-	 * builder object in a local variable.
144
-	 *
145
-	 * @return \OCP\DB\QueryBuilder\IFunctionBuilder
146
-	 */
147
-	public function func() {
148
-		if ($this->connection instanceof OracleConnection) {
149
-			return new OCIFunctionBuilder($this->helper);
150
-		} elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
151
-			return new SqliteFunctionBuilder($this->helper);
152
-		} elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
153
-			return new PgSqlFunctionBuilder($this->helper);
154
-		} else {
155
-			return new FunctionBuilder($this->helper);
156
-		}
157
-	}
158
-
159
-	/**
160
-	 * Gets the type of the currently built query.
161
-	 *
162
-	 * @return integer
163
-	 */
164
-	public function getType() {
165
-		return $this->queryBuilder->getType();
166
-	}
167
-
168
-	/**
169
-	 * Gets the associated DBAL Connection for this query builder.
170
-	 *
171
-	 * @return \OCP\IDBConnection
172
-	 */
173
-	public function getConnection() {
174
-		return $this->connection;
175
-	}
176
-
177
-	/**
178
-	 * Gets the state of this query builder instance.
179
-	 *
180
-	 * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
181
-	 */
182
-	public function getState() {
183
-		return $this->queryBuilder->getState();
184
-	}
185
-
186
-	/**
187
-	 * Executes this query using the bound parameters and their types.
188
-	 *
189
-	 * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
190
-	 * for insert, update and delete statements.
191
-	 *
192
-	 * @return \Doctrine\DBAL\Driver\Statement|int
193
-	 */
194
-	public function execute() {
195
-		if ($this->systemConfig->getValue('log_query', false)) {
196
-			$params = [];
197
-			foreach ($this->getParameters() as $placeholder => $value) {
198
-				if (is_array($value)) {
199
-					$params[] = $placeholder . ' => (\'' . implode('\', \'', $value) . '\')';
200
-				} else {
201
-					$params[] = $placeholder . ' => \'' . $value . '\'';
202
-				}
203
-			}
204
-			if (empty($params)) {
205
-				$this->logger->debug('DB QueryBuilder: \'{query}\'', [
206
-					'query' => $this->getSQL(),
207
-					'app' => 'core',
208
-				]);
209
-			} else {
210
-				$this->logger->debug('DB QueryBuilder: \'{query}\' with parameters: {params}', [
211
-					'query' => $this->getSQL(),
212
-					'params' => implode(', ', $params),
213
-					'app' => 'core',
214
-				]);
215
-			}
216
-		}
217
-
218
-		return $this->queryBuilder->execute();
219
-	}
220
-
221
-	/**
222
-	 * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
223
-	 *
224
-	 * <code>
225
-	 *     $qb = $conn->getQueryBuilder()
226
-	 *         ->select('u')
227
-	 *         ->from('User', 'u')
228
-	 *     echo $qb->getSQL(); // SELECT u FROM User u
229
-	 * </code>
230
-	 *
231
-	 * @return string The SQL query string.
232
-	 */
233
-	public function getSQL() {
234
-		return $this->queryBuilder->getSQL();
235
-	}
236
-
237
-	/**
238
-	 * Sets a query parameter for the query being constructed.
239
-	 *
240
-	 * <code>
241
-	 *     $qb = $conn->getQueryBuilder()
242
-	 *         ->select('u')
243
-	 *         ->from('users', 'u')
244
-	 *         ->where('u.id = :user_id')
245
-	 *         ->setParameter(':user_id', 1);
246
-	 * </code>
247
-	 *
248
-	 * @param string|integer $key The parameter position or name.
249
-	 * @param mixed $value The parameter value.
250
-	 * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
251
-	 *
252
-	 * @return $this This QueryBuilder instance.
253
-	 */
254
-	public function setParameter($key, $value, $type = null) {
255
-		$this->queryBuilder->setParameter($key, $value, $type);
256
-
257
-		return $this;
258
-	}
259
-
260
-	/**
261
-	 * Sets a collection of query parameters for the query being constructed.
262
-	 *
263
-	 * <code>
264
-	 *     $qb = $conn->getQueryBuilder()
265
-	 *         ->select('u')
266
-	 *         ->from('users', 'u')
267
-	 *         ->where('u.id = :user_id1 OR u.id = :user_id2')
268
-	 *         ->setParameters(array(
269
-	 *             ':user_id1' => 1,
270
-	 *             ':user_id2' => 2
271
-	 *         ));
272
-	 * </code>
273
-	 *
274
-	 * @param array $params The query parameters to set.
275
-	 * @param array $types The query parameters types to set.
276
-	 *
277
-	 * @return $this This QueryBuilder instance.
278
-	 */
279
-	public function setParameters(array $params, array $types = []) {
280
-		$this->queryBuilder->setParameters($params, $types);
281
-
282
-		return $this;
283
-	}
284
-
285
-	/**
286
-	 * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
287
-	 *
288
-	 * @return array The currently defined query parameters indexed by parameter index or name.
289
-	 */
290
-	public function getParameters() {
291
-		return $this->queryBuilder->getParameters();
292
-	}
293
-
294
-	/**
295
-	 * Gets a (previously set) query parameter of the query being constructed.
296
-	 *
297
-	 * @param mixed $key The key (index or name) of the bound parameter.
298
-	 *
299
-	 * @return mixed The value of the bound parameter.
300
-	 */
301
-	public function getParameter($key) {
302
-		return $this->queryBuilder->getParameter($key);
303
-	}
304
-
305
-	/**
306
-	 * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
307
-	 *
308
-	 * @return array The currently defined query parameter types indexed by parameter index or name.
309
-	 */
310
-	public function getParameterTypes() {
311
-		return $this->queryBuilder->getParameterTypes();
312
-	}
313
-
314
-	/**
315
-	 * Gets a (previously set) query parameter type of the query being constructed.
316
-	 *
317
-	 * @param mixed $key The key (index or name) of the bound parameter type.
318
-	 *
319
-	 * @return mixed The value of the bound parameter type.
320
-	 */
321
-	public function getParameterType($key) {
322
-		return $this->queryBuilder->getParameterType($key);
323
-	}
324
-
325
-	/**
326
-	 * Sets the position of the first result to retrieve (the "offset").
327
-	 *
328
-	 * @param integer $firstResult The first result to return.
329
-	 *
330
-	 * @return $this This QueryBuilder instance.
331
-	 */
332
-	public function setFirstResult($firstResult) {
333
-		$this->queryBuilder->setFirstResult($firstResult);
334
-
335
-		return $this;
336
-	}
337
-
338
-	/**
339
-	 * Gets the position of the first result the query object was set to retrieve (the "offset").
340
-	 * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
341
-	 *
342
-	 * @return integer The position of the first result.
343
-	 */
344
-	public function getFirstResult() {
345
-		return $this->queryBuilder->getFirstResult();
346
-	}
347
-
348
-	/**
349
-	 * Sets the maximum number of results to retrieve (the "limit").
350
-	 *
351
-	 * NOTE: Setting max results to "0" will cause mixed behaviour. While most
352
-	 * of the databases will just return an empty result set, Oracle will return
353
-	 * all entries.
354
-	 *
355
-	 * @param integer $maxResults The maximum number of results to retrieve.
356
-	 *
357
-	 * @return $this This QueryBuilder instance.
358
-	 */
359
-	public function setMaxResults($maxResults) {
360
-		$this->queryBuilder->setMaxResults($maxResults);
361
-
362
-		return $this;
363
-	}
364
-
365
-	/**
366
-	 * Gets the maximum number of results the query object was set to retrieve (the "limit").
367
-	 * Returns NULL if {@link setMaxResults} was not applied to this query builder.
368
-	 *
369
-	 * @return integer The maximum number of results.
370
-	 */
371
-	public function getMaxResults() {
372
-		return $this->queryBuilder->getMaxResults();
373
-	}
374
-
375
-	/**
376
-	 * Specifies an item that is to be returned in the query result.
377
-	 * Replaces any previously specified selections, if any.
378
-	 *
379
-	 * <code>
380
-	 *     $qb = $conn->getQueryBuilder()
381
-	 *         ->select('u.id', 'p.id')
382
-	 *         ->from('users', 'u')
383
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
384
-	 * </code>
385
-	 *
386
-	 * @param mixed ...$selects The selection expressions.
387
-	 *
388
-	 * '@return $this This QueryBuilder instance.
389
-	 */
390
-	public function select(...$selects) {
391
-		if (count($selects) === 1 && is_array($selects[0])) {
392
-			$selects = $selects[0];
393
-		}
394
-
395
-		$this->queryBuilder->select(
396
-			$this->helper->quoteColumnNames($selects)
397
-		);
398
-
399
-		return $this;
400
-	}
401
-
402
-	/**
403
-	 * Specifies an item that is to be returned with a different name in the query result.
404
-	 *
405
-	 * <code>
406
-	 *     $qb = $conn->getQueryBuilder()
407
-	 *         ->selectAlias('u.id', 'user_id')
408
-	 *         ->from('users', 'u')
409
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
410
-	 * </code>
411
-	 *
412
-	 * @param mixed $select The selection expressions.
413
-	 * @param string $alias The column alias used in the constructed query.
414
-	 *
415
-	 * @return $this This QueryBuilder instance.
416
-	 */
417
-	public function selectAlias($select, $alias) {
418
-		$this->queryBuilder->addSelect(
419
-			$this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias)
420
-		);
421
-
422
-		return $this;
423
-	}
424
-
425
-	/**
426
-	 * Specifies an item that is to be returned uniquely in the query result.
427
-	 *
428
-	 * <code>
429
-	 *     $qb = $conn->getQueryBuilder()
430
-	 *         ->selectDistinct('type')
431
-	 *         ->from('users');
432
-	 * </code>
433
-	 *
434
-	 * @param mixed $select The selection expressions.
435
-	 *
436
-	 * @return $this This QueryBuilder instance.
437
-	 */
438
-	public function selectDistinct($select) {
439
-		$this->queryBuilder->addSelect(
440
-			'DISTINCT ' . $this->helper->quoteColumnName($select)
441
-		);
442
-
443
-		return $this;
444
-	}
445
-
446
-	/**
447
-	 * Adds an item that is to be returned in the query result.
448
-	 *
449
-	 * <code>
450
-	 *     $qb = $conn->getQueryBuilder()
451
-	 *         ->select('u.id')
452
-	 *         ->addSelect('p.id')
453
-	 *         ->from('users', 'u')
454
-	 *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
455
-	 * </code>
456
-	 *
457
-	 * @param mixed ...$selects The selection expression.
458
-	 *
459
-	 * @return $this This QueryBuilder instance.
460
-	 */
461
-	public function addSelect(...$selects) {
462
-		if (count($selects) === 1 && is_array($selects[0])) {
463
-			$selects = $selects[0];
464
-		}
465
-
466
-		$this->queryBuilder->addSelect(
467
-			$this->helper->quoteColumnNames($selects)
468
-		);
469
-
470
-		return $this;
471
-	}
472
-
473
-	/**
474
-	 * Turns the query being built into a bulk delete query that ranges over
475
-	 * a certain table.
476
-	 *
477
-	 * <code>
478
-	 *     $qb = $conn->getQueryBuilder()
479
-	 *         ->delete('users', 'u')
480
-	 *         ->where('u.id = :user_id');
481
-	 *         ->setParameter(':user_id', 1);
482
-	 * </code>
483
-	 *
484
-	 * @param string $delete The table whose rows are subject to the deletion.
485
-	 * @param string $alias The table alias used in the constructed query.
486
-	 *
487
-	 * @return $this This QueryBuilder instance.
488
-	 */
489
-	public function delete($delete = null, $alias = null) {
490
-		$this->queryBuilder->delete(
491
-			$this->getTableName($delete),
492
-			$alias
493
-		);
494
-
495
-		return $this;
496
-	}
497
-
498
-	/**
499
-	 * Turns the query being built into a bulk update query that ranges over
500
-	 * a certain table
501
-	 *
502
-	 * <code>
503
-	 *     $qb = $conn->getQueryBuilder()
504
-	 *         ->update('users', 'u')
505
-	 *         ->set('u.password', md5('password'))
506
-	 *         ->where('u.id = ?');
507
-	 * </code>
508
-	 *
509
-	 * @param string $update The table whose rows are subject to the update.
510
-	 * @param string $alias The table alias used in the constructed query.
511
-	 *
512
-	 * @return $this This QueryBuilder instance.
513
-	 */
514
-	public function update($update = null, $alias = null) {
515
-		$this->queryBuilder->update(
516
-			$this->getTableName($update),
517
-			$alias
518
-		);
519
-
520
-		return $this;
521
-	}
522
-
523
-	/**
524
-	 * Turns the query being built into an insert query that inserts into
525
-	 * a certain table
526
-	 *
527
-	 * <code>
528
-	 *     $qb = $conn->getQueryBuilder()
529
-	 *         ->insert('users')
530
-	 *         ->values(
531
-	 *             array(
532
-	 *                 'name' => '?',
533
-	 *                 'password' => '?'
534
-	 *             )
535
-	 *         );
536
-	 * </code>
537
-	 *
538
-	 * @param string $insert The table into which the rows should be inserted.
539
-	 *
540
-	 * @return $this This QueryBuilder instance.
541
-	 */
542
-	public function insert($insert = null) {
543
-		$this->queryBuilder->insert(
544
-			$this->getTableName($insert)
545
-		);
546
-
547
-		$this->lastInsertedTable = $insert;
548
-
549
-		return $this;
550
-	}
551
-
552
-	/**
553
-	 * Creates and adds a query root corresponding to the table identified by the
554
-	 * given alias, forming a cartesian product with any existing query roots.
555
-	 *
556
-	 * <code>
557
-	 *     $qb = $conn->getQueryBuilder()
558
-	 *         ->select('u.id')
559
-	 *         ->from('users', 'u')
560
-	 * </code>
561
-	 *
562
-	 * @param string $from The table.
563
-	 * @param string|null $alias The alias of the table.
564
-	 *
565
-	 * @return $this This QueryBuilder instance.
566
-	 */
567
-	public function from($from, $alias = null) {
568
-		$this->queryBuilder->from(
569
-			$this->getTableName($from),
570
-			$this->quoteAlias($alias)
571
-		);
572
-
573
-		return $this;
574
-	}
575
-
576
-	/**
577
-	 * Creates and adds a join to the query.
578
-	 *
579
-	 * <code>
580
-	 *     $qb = $conn->getQueryBuilder()
581
-	 *         ->select('u.name')
582
-	 *         ->from('users', 'u')
583
-	 *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
584
-	 * </code>
585
-	 *
586
-	 * @param string $fromAlias The alias that points to a from clause.
587
-	 * @param string $join The table name to join.
588
-	 * @param string $alias The alias of the join table.
589
-	 * @param string $condition The condition for the join.
590
-	 *
591
-	 * @return $this This QueryBuilder instance.
592
-	 */
593
-	public function join($fromAlias, $join, $alias, $condition = null) {
594
-		$this->queryBuilder->join(
595
-			$this->quoteAlias($fromAlias),
596
-			$this->getTableName($join),
597
-			$this->quoteAlias($alias),
598
-			$condition
599
-		);
600
-
601
-		return $this;
602
-	}
603
-
604
-	/**
605
-	 * Creates and adds a join to the query.
606
-	 *
607
-	 * <code>
608
-	 *     $qb = $conn->getQueryBuilder()
609
-	 *         ->select('u.name')
610
-	 *         ->from('users', 'u')
611
-	 *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
612
-	 * </code>
613
-	 *
614
-	 * @param string $fromAlias The alias that points to a from clause.
615
-	 * @param string $join The table name to join.
616
-	 * @param string $alias The alias of the join table.
617
-	 * @param string $condition The condition for the join.
618
-	 *
619
-	 * @return $this This QueryBuilder instance.
620
-	 */
621
-	public function innerJoin($fromAlias, $join, $alias, $condition = null) {
622
-		$this->queryBuilder->innerJoin(
623
-			$this->quoteAlias($fromAlias),
624
-			$this->getTableName($join),
625
-			$this->quoteAlias($alias),
626
-			$condition
627
-		);
628
-
629
-		return $this;
630
-	}
631
-
632
-	/**
633
-	 * Creates and adds a left join to the query.
634
-	 *
635
-	 * <code>
636
-	 *     $qb = $conn->getQueryBuilder()
637
-	 *         ->select('u.name')
638
-	 *         ->from('users', 'u')
639
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
640
-	 * </code>
641
-	 *
642
-	 * @param string $fromAlias The alias that points to a from clause.
643
-	 * @param string $join The table name to join.
644
-	 * @param string $alias The alias of the join table.
645
-	 * @param string $condition The condition for the join.
646
-	 *
647
-	 * @return $this This QueryBuilder instance.
648
-	 */
649
-	public function leftJoin($fromAlias, $join, $alias, $condition = null) {
650
-		$this->queryBuilder->leftJoin(
651
-			$this->quoteAlias($fromAlias),
652
-			$this->getTableName($join),
653
-			$this->quoteAlias($alias),
654
-			$condition
655
-		);
656
-
657
-		return $this;
658
-	}
659
-
660
-	/**
661
-	 * Creates and adds a right join to the query.
662
-	 *
663
-	 * <code>
664
-	 *     $qb = $conn->getQueryBuilder()
665
-	 *         ->select('u.name')
666
-	 *         ->from('users', 'u')
667
-	 *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
668
-	 * </code>
669
-	 *
670
-	 * @param string $fromAlias The alias that points to a from clause.
671
-	 * @param string $join The table name to join.
672
-	 * @param string $alias The alias of the join table.
673
-	 * @param string $condition The condition for the join.
674
-	 *
675
-	 * @return $this This QueryBuilder instance.
676
-	 */
677
-	public function rightJoin($fromAlias, $join, $alias, $condition = null) {
678
-		$this->queryBuilder->rightJoin(
679
-			$this->quoteAlias($fromAlias),
680
-			$this->getTableName($join),
681
-			$this->quoteAlias($alias),
682
-			$condition
683
-		);
684
-
685
-		return $this;
686
-	}
687
-
688
-	/**
689
-	 * Sets a new value for a column in a bulk update query.
690
-	 *
691
-	 * <code>
692
-	 *     $qb = $conn->getQueryBuilder()
693
-	 *         ->update('users', 'u')
694
-	 *         ->set('u.password', md5('password'))
695
-	 *         ->where('u.id = ?');
696
-	 * </code>
697
-	 *
698
-	 * @param string $key The column to set.
699
-	 * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
700
-	 *
701
-	 * @return $this This QueryBuilder instance.
702
-	 */
703
-	public function set($key, $value) {
704
-		$this->queryBuilder->set(
705
-			$this->helper->quoteColumnName($key),
706
-			$this->helper->quoteColumnName($value)
707
-		);
708
-
709
-		return $this;
710
-	}
711
-
712
-	/**
713
-	 * Specifies one or more restrictions to the query result.
714
-	 * Replaces any previously specified restrictions, if any.
715
-	 *
716
-	 * <code>
717
-	 *     $qb = $conn->getQueryBuilder()
718
-	 *         ->select('u.name')
719
-	 *         ->from('users', 'u')
720
-	 *         ->where('u.id = ?');
721
-	 *
722
-	 *     // You can optionally programatically build and/or expressions
723
-	 *     $qb = $conn->getQueryBuilder();
724
-	 *
725
-	 *     $or = $qb->expr()->orx();
726
-	 *     $or->add($qb->expr()->eq('u.id', 1));
727
-	 *     $or->add($qb->expr()->eq('u.id', 2));
728
-	 *
729
-	 *     $qb->update('users', 'u')
730
-	 *         ->set('u.password', md5('password'))
731
-	 *         ->where($or);
732
-	 * </code>
733
-	 *
734
-	 * @param mixed ...$predicates The restriction predicates.
735
-	 *
736
-	 * @return $this This QueryBuilder instance.
737
-	 */
738
-	public function where(...$predicates) {
739
-		call_user_func_array(
740
-			[$this->queryBuilder, 'where'],
741
-			$predicates
742
-		);
743
-
744
-		return $this;
745
-	}
746
-
747
-	/**
748
-	 * Adds one or more restrictions to the query results, forming a logical
749
-	 * conjunction with any previously specified restrictions.
750
-	 *
751
-	 * <code>
752
-	 *     $qb = $conn->getQueryBuilder()
753
-	 *         ->select('u')
754
-	 *         ->from('users', 'u')
755
-	 *         ->where('u.username LIKE ?')
756
-	 *         ->andWhere('u.is_active = 1');
757
-	 * </code>
758
-	 *
759
-	 * @param mixed ...$where The query restrictions.
760
-	 *
761
-	 * @return $this This QueryBuilder instance.
762
-	 *
763
-	 * @see where()
764
-	 */
765
-	public function andWhere(...$where) {
766
-		call_user_func_array(
767
-			[$this->queryBuilder, 'andWhere'],
768
-			$where
769
-		);
770
-
771
-		return $this;
772
-	}
773
-
774
-	/**
775
-	 * Adds one or more restrictions to the query results, forming a logical
776
-	 * disjunction with any previously specified restrictions.
777
-	 *
778
-	 * <code>
779
-	 *     $qb = $conn->getQueryBuilder()
780
-	 *         ->select('u.name')
781
-	 *         ->from('users', 'u')
782
-	 *         ->where('u.id = 1')
783
-	 *         ->orWhere('u.id = 2');
784
-	 * </code>
785
-	 *
786
-	 * @param mixed ...$where The WHERE statement.
787
-	 *
788
-	 * @return $this This QueryBuilder instance.
789
-	 *
790
-	 * @see where()
791
-	 */
792
-	public function orWhere(...$where) {
793
-		call_user_func_array(
794
-			[$this->queryBuilder, 'orWhere'],
795
-			$where
796
-		);
797
-
798
-		return $this;
799
-	}
800
-
801
-	/**
802
-	 * Specifies a grouping over the results of the query.
803
-	 * Replaces any previously specified groupings, if any.
804
-	 *
805
-	 * <code>
806
-	 *     $qb = $conn->getQueryBuilder()
807
-	 *         ->select('u.name')
808
-	 *         ->from('users', 'u')
809
-	 *         ->groupBy('u.id');
810
-	 * </code>
811
-	 *
812
-	 * @param mixed ...$groupBys The grouping expression.
813
-	 *
814
-	 * @return $this This QueryBuilder instance.
815
-	 */
816
-	public function groupBy(...$groupBys) {
817
-		if (count($groupBys) === 1 && is_array($groupBys[0])) {
818
-			$groupBys = $groupBys[0];
819
-		}
820
-
821
-		call_user_func_array(
822
-			[$this->queryBuilder, 'groupBy'],
823
-			$this->helper->quoteColumnNames($groupBys)
824
-		);
825
-
826
-		return $this;
827
-	}
828
-
829
-	/**
830
-	 * Adds a grouping expression to the query.
831
-	 *
832
-	 * <code>
833
-	 *     $qb = $conn->getQueryBuilder()
834
-	 *         ->select('u.name')
835
-	 *         ->from('users', 'u')
836
-	 *         ->groupBy('u.lastLogin');
837
-	 *         ->addGroupBy('u.createdAt')
838
-	 * </code>
839
-	 *
840
-	 * @param mixed ...$groupBy The grouping expression.
841
-	 *
842
-	 * @return $this This QueryBuilder instance.
843
-	 */
844
-	public function addGroupBy(...$groupBys) {
845
-		if (count($groupBys) === 1 && is_array($groupBys[0])) {
846
-			$$groupBys = $groupBys[0];
847
-		}
848
-
849
-		call_user_func_array(
850
-			[$this->queryBuilder, 'addGroupBy'],
851
-			$this->helper->quoteColumnNames($groupBys)
852
-		);
853
-
854
-		return $this;
855
-	}
856
-
857
-	/**
858
-	 * Sets a value for a column in an insert query.
859
-	 *
860
-	 * <code>
861
-	 *     $qb = $conn->getQueryBuilder()
862
-	 *         ->insert('users')
863
-	 *         ->values(
864
-	 *             array(
865
-	 *                 'name' => '?'
866
-	 *             )
867
-	 *         )
868
-	 *         ->setValue('password', '?');
869
-	 * </code>
870
-	 *
871
-	 * @param string $column The column into which the value should be inserted.
872
-	 * @param IParameter|string $value The value that should be inserted into the column.
873
-	 *
874
-	 * @return $this This QueryBuilder instance.
875
-	 */
876
-	public function setValue($column, $value) {
877
-		$this->queryBuilder->setValue(
878
-			$this->helper->quoteColumnName($column),
879
-			(string) $value
880
-		);
881
-
882
-		return $this;
883
-	}
884
-
885
-	/**
886
-	 * Specifies values for an insert query indexed by column names.
887
-	 * Replaces any previous values, if any.
888
-	 *
889
-	 * <code>
890
-	 *     $qb = $conn->getQueryBuilder()
891
-	 *         ->insert('users')
892
-	 *         ->values(
893
-	 *             array(
894
-	 *                 'name' => '?',
895
-	 *                 'password' => '?'
896
-	 *             )
897
-	 *         );
898
-	 * </code>
899
-	 *
900
-	 * @param array $values The values to specify for the insert query indexed by column names.
901
-	 *
902
-	 * @return $this This QueryBuilder instance.
903
-	 */
904
-	public function values(array $values) {
905
-		$quotedValues = [];
906
-		foreach ($values as $key => $value) {
907
-			$quotedValues[$this->helper->quoteColumnName($key)] = $value;
908
-		}
909
-
910
-		$this->queryBuilder->values($quotedValues);
911
-
912
-		return $this;
913
-	}
914
-
915
-	/**
916
-	 * Specifies a restriction over the groups of the query.
917
-	 * Replaces any previous having restrictions, if any.
918
-	 *
919
-	 * @param mixed ...$having The restriction over the groups.
920
-	 *
921
-	 * @return $this This QueryBuilder instance.
922
-	 */
923
-	public function having(...$having) {
924
-		call_user_func_array(
925
-			[$this->queryBuilder, 'having'],
926
-			$having
927
-		);
928
-
929
-		return $this;
930
-	}
931
-
932
-	/**
933
-	 * Adds a restriction over the groups of the query, forming a logical
934
-	 * conjunction with any existing having restrictions.
935
-	 *
936
-	 * @param mixed ...$having The restriction to append.
937
-	 *
938
-	 * @return $this This QueryBuilder instance.
939
-	 */
940
-	public function andHaving(...$having) {
941
-		call_user_func_array(
942
-			[$this->queryBuilder, 'andHaving'],
943
-			$having
944
-		);
945
-
946
-		return $this;
947
-	}
948
-
949
-	/**
950
-	 * Adds a restriction over the groups of the query, forming a logical
951
-	 * disjunction with any existing having restrictions.
952
-	 *
953
-	 * @param mixed ...$having The restriction to add.
954
-	 *
955
-	 * @return $this This QueryBuilder instance.
956
-	 */
957
-	public function orHaving(...$having) {
958
-		call_user_func_array(
959
-			[$this->queryBuilder, 'orHaving'],
960
-			$having
961
-		);
962
-
963
-		return $this;
964
-	}
965
-
966
-	/**
967
-	 * Specifies an ordering for the query results.
968
-	 * Replaces any previously specified orderings, if any.
969
-	 *
970
-	 * @param string $sort The ordering expression.
971
-	 * @param string $order The ordering direction.
972
-	 *
973
-	 * @return $this This QueryBuilder instance.
974
-	 */
975
-	public function orderBy($sort, $order = null) {
976
-		$this->queryBuilder->orderBy(
977
-			$this->helper->quoteColumnName($sort),
978
-			$order
979
-		);
980
-
981
-		return $this;
982
-	}
983
-
984
-	/**
985
-	 * Adds an ordering to the query results.
986
-	 *
987
-	 * @param string $sort The ordering expression.
988
-	 * @param string $order The ordering direction.
989
-	 *
990
-	 * @return $this This QueryBuilder instance.
991
-	 */
992
-	public function addOrderBy($sort, $order = null) {
993
-		$this->queryBuilder->addOrderBy(
994
-			$this->helper->quoteColumnName($sort),
995
-			$order
996
-		);
997
-
998
-		return $this;
999
-	}
1000
-
1001
-	/**
1002
-	 * Gets a query part by its name.
1003
-	 *
1004
-	 * @param string $queryPartName
1005
-	 *
1006
-	 * @return mixed
1007
-	 */
1008
-	public function getQueryPart($queryPartName) {
1009
-		return $this->queryBuilder->getQueryPart($queryPartName);
1010
-	}
1011
-
1012
-	/**
1013
-	 * Gets all query parts.
1014
-	 *
1015
-	 * @return array
1016
-	 */
1017
-	public function getQueryParts() {
1018
-		return $this->queryBuilder->getQueryParts();
1019
-	}
1020
-
1021
-	/**
1022
-	 * Resets SQL parts.
1023
-	 *
1024
-	 * @param array|null $queryPartNames
1025
-	 *
1026
-	 * @return $this This QueryBuilder instance.
1027
-	 */
1028
-	public function resetQueryParts($queryPartNames = null) {
1029
-		$this->queryBuilder->resetQueryParts($queryPartNames);
1030
-
1031
-		return $this;
1032
-	}
1033
-
1034
-	/**
1035
-	 * Resets a single SQL part.
1036
-	 *
1037
-	 * @param string $queryPartName
1038
-	 *
1039
-	 * @return $this This QueryBuilder instance.
1040
-	 */
1041
-	public function resetQueryPart($queryPartName) {
1042
-		$this->queryBuilder->resetQueryPart($queryPartName);
1043
-
1044
-		return $this;
1045
-	}
1046
-
1047
-	/**
1048
-	 * Creates a new named parameter and bind the value $value to it.
1049
-	 *
1050
-	 * This method provides a shortcut for PDOStatement::bindValue
1051
-	 * when using prepared statements.
1052
-	 *
1053
-	 * The parameter $value specifies the value that you want to bind. If
1054
-	 * $placeholder is not provided bindValue() will automatically create a
1055
-	 * placeholder for you. An automatic placeholder will be of the name
1056
-	 * ':dcValue1', ':dcValue2' etc.
1057
-	 *
1058
-	 * For more information see {@link http://php.net/pdostatement-bindparam}
1059
-	 *
1060
-	 * Example:
1061
-	 * <code>
1062
-	 * $value = 2;
1063
-	 * $q->eq( 'id', $q->bindValue( $value ) );
1064
-	 * $stmt = $q->executeQuery(); // executed with 'id = 2'
1065
-	 * </code>
1066
-	 *
1067
-	 * @license New BSD License
1068
-	 * @link http://www.zetacomponents.org
1069
-	 *
1070
-	 * @param mixed $value
1071
-	 * @param mixed $type
1072
-	 * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
1073
-	 *
1074
-	 * @return IParameter the placeholder name used.
1075
-	 */
1076
-	public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) {
1077
-		return new Parameter($this->queryBuilder->createNamedParameter($value, $type, $placeHolder));
1078
-	}
1079
-
1080
-	/**
1081
-	 * Creates a new positional parameter and bind the given value to it.
1082
-	 *
1083
-	 * Attention: If you are using positional parameters with the query builder you have
1084
-	 * to be very careful to bind all parameters in the order they appear in the SQL
1085
-	 * statement , otherwise they get bound in the wrong order which can lead to serious
1086
-	 * bugs in your code.
1087
-	 *
1088
-	 * Example:
1089
-	 * <code>
1090
-	 *  $qb = $conn->getQueryBuilder();
1091
-	 *  $qb->select('u.*')
1092
-	 *     ->from('users', 'u')
1093
-	 *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
1094
-	 *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
1095
-	 * </code>
1096
-	 *
1097
-	 * @param mixed $value
1098
-	 * @param integer $type
1099
-	 *
1100
-	 * @return IParameter
1101
-	 */
1102
-	public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) {
1103
-		return new Parameter($this->queryBuilder->createPositionalParameter($value, $type));
1104
-	}
1105
-
1106
-	/**
1107
-	 * Creates a new parameter
1108
-	 *
1109
-	 * Example:
1110
-	 * <code>
1111
-	 *  $qb = $conn->getQueryBuilder();
1112
-	 *  $qb->select('u.*')
1113
-	 *     ->from('users', 'u')
1114
-	 *     ->where('u.username = ' . $qb->createParameter('name'))
1115
-	 *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
1116
-	 * </code>
1117
-	 *
1118
-	 * @param string $name
1119
-	 *
1120
-	 * @return IParameter
1121
-	 */
1122
-	public function createParameter($name) {
1123
-		return new Parameter(':' . $name);
1124
-	}
1125
-
1126
-	/**
1127
-	 * Creates a new function
1128
-	 *
1129
-	 * Attention: Column names inside the call have to be quoted before hand
1130
-	 *
1131
-	 * Example:
1132
-	 * <code>
1133
-	 *  $qb = $conn->getQueryBuilder();
1134
-	 *  $qb->select($qb->createFunction('COUNT(*)'))
1135
-	 *     ->from('users', 'u')
1136
-	 *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
1137
-	 * </code>
1138
-	 * <code>
1139
-	 *  $qb = $conn->getQueryBuilder();
1140
-	 *  $qb->select($qb->createFunction('COUNT(`column`)'))
1141
-	 *     ->from('users', 'u')
1142
-	 *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
1143
-	 * </code>
1144
-	 *
1145
-	 * @param string $call
1146
-	 *
1147
-	 * @return IQueryFunction
1148
-	 */
1149
-	public function createFunction($call) {
1150
-		return new QueryFunction($call);
1151
-	}
1152
-
1153
-	/**
1154
-	 * Used to get the id of the last inserted element
1155
-	 * @return int
1156
-	 * @throws \BadMethodCallException When being called before an insert query has been run.
1157
-	 */
1158
-	public function getLastInsertId() {
1159
-		if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) {
1160
-			// lastInsertId() needs the prefix but no quotes
1161
-			$table = $this->prefixTableName($this->lastInsertedTable);
1162
-			return (int) $this->connection->lastInsertId($table);
1163
-		}
1164
-
1165
-		throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.');
1166
-	}
1167
-
1168
-	/**
1169
-	 * Returns the table name quoted and with database prefix as needed by the implementation
1170
-	 *
1171
-	 * @param string $table
1172
-	 * @return string
1173
-	 */
1174
-	public function getTableName($table) {
1175
-		if ($table instanceof IQueryFunction) {
1176
-			return (string) $table;
1177
-		}
1178
-
1179
-		$table = $this->prefixTableName($table);
1180
-		return $this->helper->quoteColumnName($table);
1181
-	}
1182
-
1183
-	/**
1184
-	 * Returns the table name with database prefix as needed by the implementation
1185
-	 *
1186
-	 * @param string $table
1187
-	 * @return string
1188
-	 */
1189
-	protected function prefixTableName($table) {
1190
-		if ($this->automaticTablePrefix === false || strpos($table, '*PREFIX*') === 0) {
1191
-			return $table;
1192
-		}
1193
-
1194
-		return '*PREFIX*' . $table;
1195
-	}
1196
-
1197
-	/**
1198
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
1199
-	 *
1200
-	 * @param string $column
1201
-	 * @param string $tableAlias
1202
-	 * @return string
1203
-	 */
1204
-	public function getColumnName($column, $tableAlias = '') {
1205
-		if ($tableAlias !== '') {
1206
-			$tableAlias .= '.';
1207
-		}
1208
-
1209
-		return $this->helper->quoteColumnName($tableAlias . $column);
1210
-	}
1211
-
1212
-	/**
1213
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
1214
-	 *
1215
-	 * @param string $alias
1216
-	 * @return string
1217
-	 */
1218
-	public function quoteAlias($alias) {
1219
-		if ($alias === '' || $alias === null) {
1220
-			return $alias;
1221
-		}
1222
-
1223
-		return $this->helper->quoteColumnName($alias);
1224
-	}
54
+    /** @var \OCP\IDBConnection */
55
+    private $connection;
56
+
57
+    /** @var SystemConfig */
58
+    private $systemConfig;
59
+
60
+    /** @var ILogger */
61
+    private $logger;
62
+
63
+    /** @var \Doctrine\DBAL\Query\QueryBuilder */
64
+    private $queryBuilder;
65
+
66
+    /** @var QuoteHelper */
67
+    private $helper;
68
+
69
+    /** @var bool */
70
+    private $automaticTablePrefix = true;
71
+
72
+    /** @var string */
73
+    protected $lastInsertedTable;
74
+
75
+    /**
76
+     * Initializes a new QueryBuilder.
77
+     *
78
+     * @param IDBConnection $connection
79
+     * @param SystemConfig $systemConfig
80
+     * @param ILogger $logger
81
+     */
82
+    public function __construct(IDBConnection $connection, SystemConfig $systemConfig, ILogger $logger) {
83
+        $this->connection = $connection;
84
+        $this->systemConfig = $systemConfig;
85
+        $this->logger = $logger;
86
+        $this->queryBuilder = new \Doctrine\DBAL\Query\QueryBuilder($this->connection);
87
+        $this->helper = new QuoteHelper();
88
+    }
89
+
90
+    /**
91
+     * Enable/disable automatic prefixing of table names with the oc_ prefix
92
+     *
93
+     * @param bool $enabled If set to true table names will be prefixed with the
94
+     * owncloud database prefix automatically.
95
+     * @since 8.2.0
96
+     */
97
+    public function automaticTablePrefix($enabled) {
98
+        $this->automaticTablePrefix = (bool) $enabled;
99
+    }
100
+
101
+    /**
102
+     * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
103
+     * This producer method is intended for convenient inline usage. Example:
104
+     *
105
+     * <code>
106
+     *     $qb = $conn->getQueryBuilder()
107
+     *         ->select('u')
108
+     *         ->from('users', 'u')
109
+     *         ->where($qb->expr()->eq('u.id', 1));
110
+     * </code>
111
+     *
112
+     * For more complex expression construction, consider storing the expression
113
+     * builder object in a local variable.
114
+     *
115
+     * @return \OCP\DB\QueryBuilder\IExpressionBuilder
116
+     */
117
+    public function expr() {
118
+        if ($this->connection instanceof OracleConnection) {
119
+            return new OCIExpressionBuilder($this->connection, $this);
120
+        } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
121
+            return new PgSqlExpressionBuilder($this->connection, $this);
122
+        } elseif ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
123
+            return new MySqlExpressionBuilder($this->connection, $this);
124
+        } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
125
+            return new SqliteExpressionBuilder($this->connection, $this);
126
+        } else {
127
+            return new ExpressionBuilder($this->connection, $this);
128
+        }
129
+    }
130
+
131
+    /**
132
+     * Gets an FunctionBuilder used for object-oriented construction of query functions.
133
+     * This producer method is intended for convenient inline usage. Example:
134
+     *
135
+     * <code>
136
+     *     $qb = $conn->getQueryBuilder()
137
+     *         ->select('u')
138
+     *         ->from('users', 'u')
139
+     *         ->where($qb->fun()->md5('u.id'));
140
+     * </code>
141
+     *
142
+     * For more complex function construction, consider storing the function
143
+     * builder object in a local variable.
144
+     *
145
+     * @return \OCP\DB\QueryBuilder\IFunctionBuilder
146
+     */
147
+    public function func() {
148
+        if ($this->connection instanceof OracleConnection) {
149
+            return new OCIFunctionBuilder($this->helper);
150
+        } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
151
+            return new SqliteFunctionBuilder($this->helper);
152
+        } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
153
+            return new PgSqlFunctionBuilder($this->helper);
154
+        } else {
155
+            return new FunctionBuilder($this->helper);
156
+        }
157
+    }
158
+
159
+    /**
160
+     * Gets the type of the currently built query.
161
+     *
162
+     * @return integer
163
+     */
164
+    public function getType() {
165
+        return $this->queryBuilder->getType();
166
+    }
167
+
168
+    /**
169
+     * Gets the associated DBAL Connection for this query builder.
170
+     *
171
+     * @return \OCP\IDBConnection
172
+     */
173
+    public function getConnection() {
174
+        return $this->connection;
175
+    }
176
+
177
+    /**
178
+     * Gets the state of this query builder instance.
179
+     *
180
+     * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
181
+     */
182
+    public function getState() {
183
+        return $this->queryBuilder->getState();
184
+    }
185
+
186
+    /**
187
+     * Executes this query using the bound parameters and their types.
188
+     *
189
+     * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
190
+     * for insert, update and delete statements.
191
+     *
192
+     * @return \Doctrine\DBAL\Driver\Statement|int
193
+     */
194
+    public function execute() {
195
+        if ($this->systemConfig->getValue('log_query', false)) {
196
+            $params = [];
197
+            foreach ($this->getParameters() as $placeholder => $value) {
198
+                if (is_array($value)) {
199
+                    $params[] = $placeholder . ' => (\'' . implode('\', \'', $value) . '\')';
200
+                } else {
201
+                    $params[] = $placeholder . ' => \'' . $value . '\'';
202
+                }
203
+            }
204
+            if (empty($params)) {
205
+                $this->logger->debug('DB QueryBuilder: \'{query}\'', [
206
+                    'query' => $this->getSQL(),
207
+                    'app' => 'core',
208
+                ]);
209
+            } else {
210
+                $this->logger->debug('DB QueryBuilder: \'{query}\' with parameters: {params}', [
211
+                    'query' => $this->getSQL(),
212
+                    'params' => implode(', ', $params),
213
+                    'app' => 'core',
214
+                ]);
215
+            }
216
+        }
217
+
218
+        return $this->queryBuilder->execute();
219
+    }
220
+
221
+    /**
222
+     * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
223
+     *
224
+     * <code>
225
+     *     $qb = $conn->getQueryBuilder()
226
+     *         ->select('u')
227
+     *         ->from('User', 'u')
228
+     *     echo $qb->getSQL(); // SELECT u FROM User u
229
+     * </code>
230
+     *
231
+     * @return string The SQL query string.
232
+     */
233
+    public function getSQL() {
234
+        return $this->queryBuilder->getSQL();
235
+    }
236
+
237
+    /**
238
+     * Sets a query parameter for the query being constructed.
239
+     *
240
+     * <code>
241
+     *     $qb = $conn->getQueryBuilder()
242
+     *         ->select('u')
243
+     *         ->from('users', 'u')
244
+     *         ->where('u.id = :user_id')
245
+     *         ->setParameter(':user_id', 1);
246
+     * </code>
247
+     *
248
+     * @param string|integer $key The parameter position or name.
249
+     * @param mixed $value The parameter value.
250
+     * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
251
+     *
252
+     * @return $this This QueryBuilder instance.
253
+     */
254
+    public function setParameter($key, $value, $type = null) {
255
+        $this->queryBuilder->setParameter($key, $value, $type);
256
+
257
+        return $this;
258
+    }
259
+
260
+    /**
261
+     * Sets a collection of query parameters for the query being constructed.
262
+     *
263
+     * <code>
264
+     *     $qb = $conn->getQueryBuilder()
265
+     *         ->select('u')
266
+     *         ->from('users', 'u')
267
+     *         ->where('u.id = :user_id1 OR u.id = :user_id2')
268
+     *         ->setParameters(array(
269
+     *             ':user_id1' => 1,
270
+     *             ':user_id2' => 2
271
+     *         ));
272
+     * </code>
273
+     *
274
+     * @param array $params The query parameters to set.
275
+     * @param array $types The query parameters types to set.
276
+     *
277
+     * @return $this This QueryBuilder instance.
278
+     */
279
+    public function setParameters(array $params, array $types = []) {
280
+        $this->queryBuilder->setParameters($params, $types);
281
+
282
+        return $this;
283
+    }
284
+
285
+    /**
286
+     * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
287
+     *
288
+     * @return array The currently defined query parameters indexed by parameter index or name.
289
+     */
290
+    public function getParameters() {
291
+        return $this->queryBuilder->getParameters();
292
+    }
293
+
294
+    /**
295
+     * Gets a (previously set) query parameter of the query being constructed.
296
+     *
297
+     * @param mixed $key The key (index or name) of the bound parameter.
298
+     *
299
+     * @return mixed The value of the bound parameter.
300
+     */
301
+    public function getParameter($key) {
302
+        return $this->queryBuilder->getParameter($key);
303
+    }
304
+
305
+    /**
306
+     * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
307
+     *
308
+     * @return array The currently defined query parameter types indexed by parameter index or name.
309
+     */
310
+    public function getParameterTypes() {
311
+        return $this->queryBuilder->getParameterTypes();
312
+    }
313
+
314
+    /**
315
+     * Gets a (previously set) query parameter type of the query being constructed.
316
+     *
317
+     * @param mixed $key The key (index or name) of the bound parameter type.
318
+     *
319
+     * @return mixed The value of the bound parameter type.
320
+     */
321
+    public function getParameterType($key) {
322
+        return $this->queryBuilder->getParameterType($key);
323
+    }
324
+
325
+    /**
326
+     * Sets the position of the first result to retrieve (the "offset").
327
+     *
328
+     * @param integer $firstResult The first result to return.
329
+     *
330
+     * @return $this This QueryBuilder instance.
331
+     */
332
+    public function setFirstResult($firstResult) {
333
+        $this->queryBuilder->setFirstResult($firstResult);
334
+
335
+        return $this;
336
+    }
337
+
338
+    /**
339
+     * Gets the position of the first result the query object was set to retrieve (the "offset").
340
+     * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
341
+     *
342
+     * @return integer The position of the first result.
343
+     */
344
+    public function getFirstResult() {
345
+        return $this->queryBuilder->getFirstResult();
346
+    }
347
+
348
+    /**
349
+     * Sets the maximum number of results to retrieve (the "limit").
350
+     *
351
+     * NOTE: Setting max results to "0" will cause mixed behaviour. While most
352
+     * of the databases will just return an empty result set, Oracle will return
353
+     * all entries.
354
+     *
355
+     * @param integer $maxResults The maximum number of results to retrieve.
356
+     *
357
+     * @return $this This QueryBuilder instance.
358
+     */
359
+    public function setMaxResults($maxResults) {
360
+        $this->queryBuilder->setMaxResults($maxResults);
361
+
362
+        return $this;
363
+    }
364
+
365
+    /**
366
+     * Gets the maximum number of results the query object was set to retrieve (the "limit").
367
+     * Returns NULL if {@link setMaxResults} was not applied to this query builder.
368
+     *
369
+     * @return integer The maximum number of results.
370
+     */
371
+    public function getMaxResults() {
372
+        return $this->queryBuilder->getMaxResults();
373
+    }
374
+
375
+    /**
376
+     * Specifies an item that is to be returned in the query result.
377
+     * Replaces any previously specified selections, if any.
378
+     *
379
+     * <code>
380
+     *     $qb = $conn->getQueryBuilder()
381
+     *         ->select('u.id', 'p.id')
382
+     *         ->from('users', 'u')
383
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
384
+     * </code>
385
+     *
386
+     * @param mixed ...$selects The selection expressions.
387
+     *
388
+     * '@return $this This QueryBuilder instance.
389
+     */
390
+    public function select(...$selects) {
391
+        if (count($selects) === 1 && is_array($selects[0])) {
392
+            $selects = $selects[0];
393
+        }
394
+
395
+        $this->queryBuilder->select(
396
+            $this->helper->quoteColumnNames($selects)
397
+        );
398
+
399
+        return $this;
400
+    }
401
+
402
+    /**
403
+     * Specifies an item that is to be returned with a different name in the query result.
404
+     *
405
+     * <code>
406
+     *     $qb = $conn->getQueryBuilder()
407
+     *         ->selectAlias('u.id', 'user_id')
408
+     *         ->from('users', 'u')
409
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
410
+     * </code>
411
+     *
412
+     * @param mixed $select The selection expressions.
413
+     * @param string $alias The column alias used in the constructed query.
414
+     *
415
+     * @return $this This QueryBuilder instance.
416
+     */
417
+    public function selectAlias($select, $alias) {
418
+        $this->queryBuilder->addSelect(
419
+            $this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias)
420
+        );
421
+
422
+        return $this;
423
+    }
424
+
425
+    /**
426
+     * Specifies an item that is to be returned uniquely in the query result.
427
+     *
428
+     * <code>
429
+     *     $qb = $conn->getQueryBuilder()
430
+     *         ->selectDistinct('type')
431
+     *         ->from('users');
432
+     * </code>
433
+     *
434
+     * @param mixed $select The selection expressions.
435
+     *
436
+     * @return $this This QueryBuilder instance.
437
+     */
438
+    public function selectDistinct($select) {
439
+        $this->queryBuilder->addSelect(
440
+            'DISTINCT ' . $this->helper->quoteColumnName($select)
441
+        );
442
+
443
+        return $this;
444
+    }
445
+
446
+    /**
447
+     * Adds an item that is to be returned in the query result.
448
+     *
449
+     * <code>
450
+     *     $qb = $conn->getQueryBuilder()
451
+     *         ->select('u.id')
452
+     *         ->addSelect('p.id')
453
+     *         ->from('users', 'u')
454
+     *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
455
+     * </code>
456
+     *
457
+     * @param mixed ...$selects The selection expression.
458
+     *
459
+     * @return $this This QueryBuilder instance.
460
+     */
461
+    public function addSelect(...$selects) {
462
+        if (count($selects) === 1 && is_array($selects[0])) {
463
+            $selects = $selects[0];
464
+        }
465
+
466
+        $this->queryBuilder->addSelect(
467
+            $this->helper->quoteColumnNames($selects)
468
+        );
469
+
470
+        return $this;
471
+    }
472
+
473
+    /**
474
+     * Turns the query being built into a bulk delete query that ranges over
475
+     * a certain table.
476
+     *
477
+     * <code>
478
+     *     $qb = $conn->getQueryBuilder()
479
+     *         ->delete('users', 'u')
480
+     *         ->where('u.id = :user_id');
481
+     *         ->setParameter(':user_id', 1);
482
+     * </code>
483
+     *
484
+     * @param string $delete The table whose rows are subject to the deletion.
485
+     * @param string $alias The table alias used in the constructed query.
486
+     *
487
+     * @return $this This QueryBuilder instance.
488
+     */
489
+    public function delete($delete = null, $alias = null) {
490
+        $this->queryBuilder->delete(
491
+            $this->getTableName($delete),
492
+            $alias
493
+        );
494
+
495
+        return $this;
496
+    }
497
+
498
+    /**
499
+     * Turns the query being built into a bulk update query that ranges over
500
+     * a certain table
501
+     *
502
+     * <code>
503
+     *     $qb = $conn->getQueryBuilder()
504
+     *         ->update('users', 'u')
505
+     *         ->set('u.password', md5('password'))
506
+     *         ->where('u.id = ?');
507
+     * </code>
508
+     *
509
+     * @param string $update The table whose rows are subject to the update.
510
+     * @param string $alias The table alias used in the constructed query.
511
+     *
512
+     * @return $this This QueryBuilder instance.
513
+     */
514
+    public function update($update = null, $alias = null) {
515
+        $this->queryBuilder->update(
516
+            $this->getTableName($update),
517
+            $alias
518
+        );
519
+
520
+        return $this;
521
+    }
522
+
523
+    /**
524
+     * Turns the query being built into an insert query that inserts into
525
+     * a certain table
526
+     *
527
+     * <code>
528
+     *     $qb = $conn->getQueryBuilder()
529
+     *         ->insert('users')
530
+     *         ->values(
531
+     *             array(
532
+     *                 'name' => '?',
533
+     *                 'password' => '?'
534
+     *             )
535
+     *         );
536
+     * </code>
537
+     *
538
+     * @param string $insert The table into which the rows should be inserted.
539
+     *
540
+     * @return $this This QueryBuilder instance.
541
+     */
542
+    public function insert($insert = null) {
543
+        $this->queryBuilder->insert(
544
+            $this->getTableName($insert)
545
+        );
546
+
547
+        $this->lastInsertedTable = $insert;
548
+
549
+        return $this;
550
+    }
551
+
552
+    /**
553
+     * Creates and adds a query root corresponding to the table identified by the
554
+     * given alias, forming a cartesian product with any existing query roots.
555
+     *
556
+     * <code>
557
+     *     $qb = $conn->getQueryBuilder()
558
+     *         ->select('u.id')
559
+     *         ->from('users', 'u')
560
+     * </code>
561
+     *
562
+     * @param string $from The table.
563
+     * @param string|null $alias The alias of the table.
564
+     *
565
+     * @return $this This QueryBuilder instance.
566
+     */
567
+    public function from($from, $alias = null) {
568
+        $this->queryBuilder->from(
569
+            $this->getTableName($from),
570
+            $this->quoteAlias($alias)
571
+        );
572
+
573
+        return $this;
574
+    }
575
+
576
+    /**
577
+     * Creates and adds a join to the query.
578
+     *
579
+     * <code>
580
+     *     $qb = $conn->getQueryBuilder()
581
+     *         ->select('u.name')
582
+     *         ->from('users', 'u')
583
+     *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
584
+     * </code>
585
+     *
586
+     * @param string $fromAlias The alias that points to a from clause.
587
+     * @param string $join The table name to join.
588
+     * @param string $alias The alias of the join table.
589
+     * @param string $condition The condition for the join.
590
+     *
591
+     * @return $this This QueryBuilder instance.
592
+     */
593
+    public function join($fromAlias, $join, $alias, $condition = null) {
594
+        $this->queryBuilder->join(
595
+            $this->quoteAlias($fromAlias),
596
+            $this->getTableName($join),
597
+            $this->quoteAlias($alias),
598
+            $condition
599
+        );
600
+
601
+        return $this;
602
+    }
603
+
604
+    /**
605
+     * Creates and adds a join to the query.
606
+     *
607
+     * <code>
608
+     *     $qb = $conn->getQueryBuilder()
609
+     *         ->select('u.name')
610
+     *         ->from('users', 'u')
611
+     *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
612
+     * </code>
613
+     *
614
+     * @param string $fromAlias The alias that points to a from clause.
615
+     * @param string $join The table name to join.
616
+     * @param string $alias The alias of the join table.
617
+     * @param string $condition The condition for the join.
618
+     *
619
+     * @return $this This QueryBuilder instance.
620
+     */
621
+    public function innerJoin($fromAlias, $join, $alias, $condition = null) {
622
+        $this->queryBuilder->innerJoin(
623
+            $this->quoteAlias($fromAlias),
624
+            $this->getTableName($join),
625
+            $this->quoteAlias($alias),
626
+            $condition
627
+        );
628
+
629
+        return $this;
630
+    }
631
+
632
+    /**
633
+     * Creates and adds a left join to the query.
634
+     *
635
+     * <code>
636
+     *     $qb = $conn->getQueryBuilder()
637
+     *         ->select('u.name')
638
+     *         ->from('users', 'u')
639
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
640
+     * </code>
641
+     *
642
+     * @param string $fromAlias The alias that points to a from clause.
643
+     * @param string $join The table name to join.
644
+     * @param string $alias The alias of the join table.
645
+     * @param string $condition The condition for the join.
646
+     *
647
+     * @return $this This QueryBuilder instance.
648
+     */
649
+    public function leftJoin($fromAlias, $join, $alias, $condition = null) {
650
+        $this->queryBuilder->leftJoin(
651
+            $this->quoteAlias($fromAlias),
652
+            $this->getTableName($join),
653
+            $this->quoteAlias($alias),
654
+            $condition
655
+        );
656
+
657
+        return $this;
658
+    }
659
+
660
+    /**
661
+     * Creates and adds a right join to the query.
662
+     *
663
+     * <code>
664
+     *     $qb = $conn->getQueryBuilder()
665
+     *         ->select('u.name')
666
+     *         ->from('users', 'u')
667
+     *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
668
+     * </code>
669
+     *
670
+     * @param string $fromAlias The alias that points to a from clause.
671
+     * @param string $join The table name to join.
672
+     * @param string $alias The alias of the join table.
673
+     * @param string $condition The condition for the join.
674
+     *
675
+     * @return $this This QueryBuilder instance.
676
+     */
677
+    public function rightJoin($fromAlias, $join, $alias, $condition = null) {
678
+        $this->queryBuilder->rightJoin(
679
+            $this->quoteAlias($fromAlias),
680
+            $this->getTableName($join),
681
+            $this->quoteAlias($alias),
682
+            $condition
683
+        );
684
+
685
+        return $this;
686
+    }
687
+
688
+    /**
689
+     * Sets a new value for a column in a bulk update query.
690
+     *
691
+     * <code>
692
+     *     $qb = $conn->getQueryBuilder()
693
+     *         ->update('users', 'u')
694
+     *         ->set('u.password', md5('password'))
695
+     *         ->where('u.id = ?');
696
+     * </code>
697
+     *
698
+     * @param string $key The column to set.
699
+     * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
700
+     *
701
+     * @return $this This QueryBuilder instance.
702
+     */
703
+    public function set($key, $value) {
704
+        $this->queryBuilder->set(
705
+            $this->helper->quoteColumnName($key),
706
+            $this->helper->quoteColumnName($value)
707
+        );
708
+
709
+        return $this;
710
+    }
711
+
712
+    /**
713
+     * Specifies one or more restrictions to the query result.
714
+     * Replaces any previously specified restrictions, if any.
715
+     *
716
+     * <code>
717
+     *     $qb = $conn->getQueryBuilder()
718
+     *         ->select('u.name')
719
+     *         ->from('users', 'u')
720
+     *         ->where('u.id = ?');
721
+     *
722
+     *     // You can optionally programatically build and/or expressions
723
+     *     $qb = $conn->getQueryBuilder();
724
+     *
725
+     *     $or = $qb->expr()->orx();
726
+     *     $or->add($qb->expr()->eq('u.id', 1));
727
+     *     $or->add($qb->expr()->eq('u.id', 2));
728
+     *
729
+     *     $qb->update('users', 'u')
730
+     *         ->set('u.password', md5('password'))
731
+     *         ->where($or);
732
+     * </code>
733
+     *
734
+     * @param mixed ...$predicates The restriction predicates.
735
+     *
736
+     * @return $this This QueryBuilder instance.
737
+     */
738
+    public function where(...$predicates) {
739
+        call_user_func_array(
740
+            [$this->queryBuilder, 'where'],
741
+            $predicates
742
+        );
743
+
744
+        return $this;
745
+    }
746
+
747
+    /**
748
+     * Adds one or more restrictions to the query results, forming a logical
749
+     * conjunction with any previously specified restrictions.
750
+     *
751
+     * <code>
752
+     *     $qb = $conn->getQueryBuilder()
753
+     *         ->select('u')
754
+     *         ->from('users', 'u')
755
+     *         ->where('u.username LIKE ?')
756
+     *         ->andWhere('u.is_active = 1');
757
+     * </code>
758
+     *
759
+     * @param mixed ...$where The query restrictions.
760
+     *
761
+     * @return $this This QueryBuilder instance.
762
+     *
763
+     * @see where()
764
+     */
765
+    public function andWhere(...$where) {
766
+        call_user_func_array(
767
+            [$this->queryBuilder, 'andWhere'],
768
+            $where
769
+        );
770
+
771
+        return $this;
772
+    }
773
+
774
+    /**
775
+     * Adds one or more restrictions to the query results, forming a logical
776
+     * disjunction with any previously specified restrictions.
777
+     *
778
+     * <code>
779
+     *     $qb = $conn->getQueryBuilder()
780
+     *         ->select('u.name')
781
+     *         ->from('users', 'u')
782
+     *         ->where('u.id = 1')
783
+     *         ->orWhere('u.id = 2');
784
+     * </code>
785
+     *
786
+     * @param mixed ...$where The WHERE statement.
787
+     *
788
+     * @return $this This QueryBuilder instance.
789
+     *
790
+     * @see where()
791
+     */
792
+    public function orWhere(...$where) {
793
+        call_user_func_array(
794
+            [$this->queryBuilder, 'orWhere'],
795
+            $where
796
+        );
797
+
798
+        return $this;
799
+    }
800
+
801
+    /**
802
+     * Specifies a grouping over the results of the query.
803
+     * Replaces any previously specified groupings, if any.
804
+     *
805
+     * <code>
806
+     *     $qb = $conn->getQueryBuilder()
807
+     *         ->select('u.name')
808
+     *         ->from('users', 'u')
809
+     *         ->groupBy('u.id');
810
+     * </code>
811
+     *
812
+     * @param mixed ...$groupBys The grouping expression.
813
+     *
814
+     * @return $this This QueryBuilder instance.
815
+     */
816
+    public function groupBy(...$groupBys) {
817
+        if (count($groupBys) === 1 && is_array($groupBys[0])) {
818
+            $groupBys = $groupBys[0];
819
+        }
820
+
821
+        call_user_func_array(
822
+            [$this->queryBuilder, 'groupBy'],
823
+            $this->helper->quoteColumnNames($groupBys)
824
+        );
825
+
826
+        return $this;
827
+    }
828
+
829
+    /**
830
+     * Adds a grouping expression to the query.
831
+     *
832
+     * <code>
833
+     *     $qb = $conn->getQueryBuilder()
834
+     *         ->select('u.name')
835
+     *         ->from('users', 'u')
836
+     *         ->groupBy('u.lastLogin');
837
+     *         ->addGroupBy('u.createdAt')
838
+     * </code>
839
+     *
840
+     * @param mixed ...$groupBy The grouping expression.
841
+     *
842
+     * @return $this This QueryBuilder instance.
843
+     */
844
+    public function addGroupBy(...$groupBys) {
845
+        if (count($groupBys) === 1 && is_array($groupBys[0])) {
846
+            $$groupBys = $groupBys[0];
847
+        }
848
+
849
+        call_user_func_array(
850
+            [$this->queryBuilder, 'addGroupBy'],
851
+            $this->helper->quoteColumnNames($groupBys)
852
+        );
853
+
854
+        return $this;
855
+    }
856
+
857
+    /**
858
+     * Sets a value for a column in an insert query.
859
+     *
860
+     * <code>
861
+     *     $qb = $conn->getQueryBuilder()
862
+     *         ->insert('users')
863
+     *         ->values(
864
+     *             array(
865
+     *                 'name' => '?'
866
+     *             )
867
+     *         )
868
+     *         ->setValue('password', '?');
869
+     * </code>
870
+     *
871
+     * @param string $column The column into which the value should be inserted.
872
+     * @param IParameter|string $value The value that should be inserted into the column.
873
+     *
874
+     * @return $this This QueryBuilder instance.
875
+     */
876
+    public function setValue($column, $value) {
877
+        $this->queryBuilder->setValue(
878
+            $this->helper->quoteColumnName($column),
879
+            (string) $value
880
+        );
881
+
882
+        return $this;
883
+    }
884
+
885
+    /**
886
+     * Specifies values for an insert query indexed by column names.
887
+     * Replaces any previous values, if any.
888
+     *
889
+     * <code>
890
+     *     $qb = $conn->getQueryBuilder()
891
+     *         ->insert('users')
892
+     *         ->values(
893
+     *             array(
894
+     *                 'name' => '?',
895
+     *                 'password' => '?'
896
+     *             )
897
+     *         );
898
+     * </code>
899
+     *
900
+     * @param array $values The values to specify for the insert query indexed by column names.
901
+     *
902
+     * @return $this This QueryBuilder instance.
903
+     */
904
+    public function values(array $values) {
905
+        $quotedValues = [];
906
+        foreach ($values as $key => $value) {
907
+            $quotedValues[$this->helper->quoteColumnName($key)] = $value;
908
+        }
909
+
910
+        $this->queryBuilder->values($quotedValues);
911
+
912
+        return $this;
913
+    }
914
+
915
+    /**
916
+     * Specifies a restriction over the groups of the query.
917
+     * Replaces any previous having restrictions, if any.
918
+     *
919
+     * @param mixed ...$having The restriction over the groups.
920
+     *
921
+     * @return $this This QueryBuilder instance.
922
+     */
923
+    public function having(...$having) {
924
+        call_user_func_array(
925
+            [$this->queryBuilder, 'having'],
926
+            $having
927
+        );
928
+
929
+        return $this;
930
+    }
931
+
932
+    /**
933
+     * Adds a restriction over the groups of the query, forming a logical
934
+     * conjunction with any existing having restrictions.
935
+     *
936
+     * @param mixed ...$having The restriction to append.
937
+     *
938
+     * @return $this This QueryBuilder instance.
939
+     */
940
+    public function andHaving(...$having) {
941
+        call_user_func_array(
942
+            [$this->queryBuilder, 'andHaving'],
943
+            $having
944
+        );
945
+
946
+        return $this;
947
+    }
948
+
949
+    /**
950
+     * Adds a restriction over the groups of the query, forming a logical
951
+     * disjunction with any existing having restrictions.
952
+     *
953
+     * @param mixed ...$having The restriction to add.
954
+     *
955
+     * @return $this This QueryBuilder instance.
956
+     */
957
+    public function orHaving(...$having) {
958
+        call_user_func_array(
959
+            [$this->queryBuilder, 'orHaving'],
960
+            $having
961
+        );
962
+
963
+        return $this;
964
+    }
965
+
966
+    /**
967
+     * Specifies an ordering for the query results.
968
+     * Replaces any previously specified orderings, if any.
969
+     *
970
+     * @param string $sort The ordering expression.
971
+     * @param string $order The ordering direction.
972
+     *
973
+     * @return $this This QueryBuilder instance.
974
+     */
975
+    public function orderBy($sort, $order = null) {
976
+        $this->queryBuilder->orderBy(
977
+            $this->helper->quoteColumnName($sort),
978
+            $order
979
+        );
980
+
981
+        return $this;
982
+    }
983
+
984
+    /**
985
+     * Adds an ordering to the query results.
986
+     *
987
+     * @param string $sort The ordering expression.
988
+     * @param string $order The ordering direction.
989
+     *
990
+     * @return $this This QueryBuilder instance.
991
+     */
992
+    public function addOrderBy($sort, $order = null) {
993
+        $this->queryBuilder->addOrderBy(
994
+            $this->helper->quoteColumnName($sort),
995
+            $order
996
+        );
997
+
998
+        return $this;
999
+    }
1000
+
1001
+    /**
1002
+     * Gets a query part by its name.
1003
+     *
1004
+     * @param string $queryPartName
1005
+     *
1006
+     * @return mixed
1007
+     */
1008
+    public function getQueryPart($queryPartName) {
1009
+        return $this->queryBuilder->getQueryPart($queryPartName);
1010
+    }
1011
+
1012
+    /**
1013
+     * Gets all query parts.
1014
+     *
1015
+     * @return array
1016
+     */
1017
+    public function getQueryParts() {
1018
+        return $this->queryBuilder->getQueryParts();
1019
+    }
1020
+
1021
+    /**
1022
+     * Resets SQL parts.
1023
+     *
1024
+     * @param array|null $queryPartNames
1025
+     *
1026
+     * @return $this This QueryBuilder instance.
1027
+     */
1028
+    public function resetQueryParts($queryPartNames = null) {
1029
+        $this->queryBuilder->resetQueryParts($queryPartNames);
1030
+
1031
+        return $this;
1032
+    }
1033
+
1034
+    /**
1035
+     * Resets a single SQL part.
1036
+     *
1037
+     * @param string $queryPartName
1038
+     *
1039
+     * @return $this This QueryBuilder instance.
1040
+     */
1041
+    public function resetQueryPart($queryPartName) {
1042
+        $this->queryBuilder->resetQueryPart($queryPartName);
1043
+
1044
+        return $this;
1045
+    }
1046
+
1047
+    /**
1048
+     * Creates a new named parameter and bind the value $value to it.
1049
+     *
1050
+     * This method provides a shortcut for PDOStatement::bindValue
1051
+     * when using prepared statements.
1052
+     *
1053
+     * The parameter $value specifies the value that you want to bind. If
1054
+     * $placeholder is not provided bindValue() will automatically create a
1055
+     * placeholder for you. An automatic placeholder will be of the name
1056
+     * ':dcValue1', ':dcValue2' etc.
1057
+     *
1058
+     * For more information see {@link http://php.net/pdostatement-bindparam}
1059
+     *
1060
+     * Example:
1061
+     * <code>
1062
+     * $value = 2;
1063
+     * $q->eq( 'id', $q->bindValue( $value ) );
1064
+     * $stmt = $q->executeQuery(); // executed with 'id = 2'
1065
+     * </code>
1066
+     *
1067
+     * @license New BSD License
1068
+     * @link http://www.zetacomponents.org
1069
+     *
1070
+     * @param mixed $value
1071
+     * @param mixed $type
1072
+     * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
1073
+     *
1074
+     * @return IParameter the placeholder name used.
1075
+     */
1076
+    public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) {
1077
+        return new Parameter($this->queryBuilder->createNamedParameter($value, $type, $placeHolder));
1078
+    }
1079
+
1080
+    /**
1081
+     * Creates a new positional parameter and bind the given value to it.
1082
+     *
1083
+     * Attention: If you are using positional parameters with the query builder you have
1084
+     * to be very careful to bind all parameters in the order they appear in the SQL
1085
+     * statement , otherwise they get bound in the wrong order which can lead to serious
1086
+     * bugs in your code.
1087
+     *
1088
+     * Example:
1089
+     * <code>
1090
+     *  $qb = $conn->getQueryBuilder();
1091
+     *  $qb->select('u.*')
1092
+     *     ->from('users', 'u')
1093
+     *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
1094
+     *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
1095
+     * </code>
1096
+     *
1097
+     * @param mixed $value
1098
+     * @param integer $type
1099
+     *
1100
+     * @return IParameter
1101
+     */
1102
+    public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) {
1103
+        return new Parameter($this->queryBuilder->createPositionalParameter($value, $type));
1104
+    }
1105
+
1106
+    /**
1107
+     * Creates a new parameter
1108
+     *
1109
+     * Example:
1110
+     * <code>
1111
+     *  $qb = $conn->getQueryBuilder();
1112
+     *  $qb->select('u.*')
1113
+     *     ->from('users', 'u')
1114
+     *     ->where('u.username = ' . $qb->createParameter('name'))
1115
+     *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
1116
+     * </code>
1117
+     *
1118
+     * @param string $name
1119
+     *
1120
+     * @return IParameter
1121
+     */
1122
+    public function createParameter($name) {
1123
+        return new Parameter(':' . $name);
1124
+    }
1125
+
1126
+    /**
1127
+     * Creates a new function
1128
+     *
1129
+     * Attention: Column names inside the call have to be quoted before hand
1130
+     *
1131
+     * Example:
1132
+     * <code>
1133
+     *  $qb = $conn->getQueryBuilder();
1134
+     *  $qb->select($qb->createFunction('COUNT(*)'))
1135
+     *     ->from('users', 'u')
1136
+     *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
1137
+     * </code>
1138
+     * <code>
1139
+     *  $qb = $conn->getQueryBuilder();
1140
+     *  $qb->select($qb->createFunction('COUNT(`column`)'))
1141
+     *     ->from('users', 'u')
1142
+     *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
1143
+     * </code>
1144
+     *
1145
+     * @param string $call
1146
+     *
1147
+     * @return IQueryFunction
1148
+     */
1149
+    public function createFunction($call) {
1150
+        return new QueryFunction($call);
1151
+    }
1152
+
1153
+    /**
1154
+     * Used to get the id of the last inserted element
1155
+     * @return int
1156
+     * @throws \BadMethodCallException When being called before an insert query has been run.
1157
+     */
1158
+    public function getLastInsertId() {
1159
+        if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) {
1160
+            // lastInsertId() needs the prefix but no quotes
1161
+            $table = $this->prefixTableName($this->lastInsertedTable);
1162
+            return (int) $this->connection->lastInsertId($table);
1163
+        }
1164
+
1165
+        throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.');
1166
+    }
1167
+
1168
+    /**
1169
+     * Returns the table name quoted and with database prefix as needed by the implementation
1170
+     *
1171
+     * @param string $table
1172
+     * @return string
1173
+     */
1174
+    public function getTableName($table) {
1175
+        if ($table instanceof IQueryFunction) {
1176
+            return (string) $table;
1177
+        }
1178
+
1179
+        $table = $this->prefixTableName($table);
1180
+        return $this->helper->quoteColumnName($table);
1181
+    }
1182
+
1183
+    /**
1184
+     * Returns the table name with database prefix as needed by the implementation
1185
+     *
1186
+     * @param string $table
1187
+     * @return string
1188
+     */
1189
+    protected function prefixTableName($table) {
1190
+        if ($this->automaticTablePrefix === false || strpos($table, '*PREFIX*') === 0) {
1191
+            return $table;
1192
+        }
1193
+
1194
+        return '*PREFIX*' . $table;
1195
+    }
1196
+
1197
+    /**
1198
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
1199
+     *
1200
+     * @param string $column
1201
+     * @param string $tableAlias
1202
+     * @return string
1203
+     */
1204
+    public function getColumnName($column, $tableAlias = '') {
1205
+        if ($tableAlias !== '') {
1206
+            $tableAlias .= '.';
1207
+        }
1208
+
1209
+        return $this->helper->quoteColumnName($tableAlias . $column);
1210
+    }
1211
+
1212
+    /**
1213
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
1214
+     *
1215
+     * @param string $alias
1216
+     * @return string
1217
+     */
1218
+    public function quoteAlias($alias) {
1219
+        if ($alias === '' || $alias === null) {
1220
+            return $alias;
1221
+        }
1222
+
1223
+        return $this->helper->quoteColumnName($alias);
1224
+    }
1225 1225
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php 1 patch
Indentation   +366 added lines, -366 removed lines patch added patch discarded remove patch
@@ -39,396 +39,396 @@
 block discarded – undo
39 39
 use OCP\IDBConnection;
40 40
 
41 41
 class ExpressionBuilder implements IExpressionBuilder {
42
-	/** @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder */
43
-	protected $expressionBuilder;
42
+    /** @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder */
43
+    protected $expressionBuilder;
44 44
 
45
-	/** @var QuoteHelper */
46
-	protected $helper;
45
+    /** @var QuoteHelper */
46
+    protected $helper;
47 47
 
48
-	/** @var IDBConnection */
49
-	protected $connection;
48
+    /** @var IDBConnection */
49
+    protected $connection;
50 50
 
51
-	/** @var FunctionBuilder */
52
-	protected $functionBuilder;
51
+    /** @var FunctionBuilder */
52
+    protected $functionBuilder;
53 53
 
54
-	/**
55
-	 * Initializes a new <tt>ExpressionBuilder</tt>.
56
-	 *
57
-	 * @param IDBConnection $connection
58
-	 * @param IQueryBuilder $queryBuilder
59
-	 */
60
-	public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) {
61
-		$this->connection = $connection;
62
-		$this->helper = new QuoteHelper();
63
-		$this->expressionBuilder = new DoctrineExpressionBuilder($connection);
64
-		$this->functionBuilder = $queryBuilder->func();
65
-	}
54
+    /**
55
+     * Initializes a new <tt>ExpressionBuilder</tt>.
56
+     *
57
+     * @param IDBConnection $connection
58
+     * @param IQueryBuilder $queryBuilder
59
+     */
60
+    public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) {
61
+        $this->connection = $connection;
62
+        $this->helper = new QuoteHelper();
63
+        $this->expressionBuilder = new DoctrineExpressionBuilder($connection);
64
+        $this->functionBuilder = $queryBuilder->func();
65
+    }
66 66
 
67
-	/**
68
-	 * Creates a conjunction of the given boolean expressions.
69
-	 *
70
-	 * Example:
71
-	 *
72
-	 *     [php]
73
-	 *     // (u.type = ?) AND (u.role = ?)
74
-	 *     $expr->andX('u.type = ?', 'u.role = ?'));
75
-	 *
76
-	 * @param mixed ...$x Optional clause. Defaults = null, but requires
77
-	 *                 at least one defined when converting to string.
78
-	 *
79
-	 * @return \OCP\DB\QueryBuilder\ICompositeExpression
80
-	 */
81
-	public function andX(...$x) {
82
-		$compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $x);
83
-		return new CompositeExpression($compositeExpression);
84
-	}
67
+    /**
68
+     * Creates a conjunction of the given boolean expressions.
69
+     *
70
+     * Example:
71
+     *
72
+     *     [php]
73
+     *     // (u.type = ?) AND (u.role = ?)
74
+     *     $expr->andX('u.type = ?', 'u.role = ?'));
75
+     *
76
+     * @param mixed ...$x Optional clause. Defaults = null, but requires
77
+     *                 at least one defined when converting to string.
78
+     *
79
+     * @return \OCP\DB\QueryBuilder\ICompositeExpression
80
+     */
81
+    public function andX(...$x) {
82
+        $compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $x);
83
+        return new CompositeExpression($compositeExpression);
84
+    }
85 85
 
86
-	/**
87
-	 * Creates a disjunction of the given boolean expressions.
88
-	 *
89
-	 * Example:
90
-	 *
91
-	 *     [php]
92
-	 *     // (u.type = ?) OR (u.role = ?)
93
-	 *     $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
94
-	 *
95
-	 * @param mixed ...$x Optional clause. Defaults = null, but requires
96
-	 *                 at least one defined when converting to string.
97
-	 *
98
-	 * @return \OCP\DB\QueryBuilder\ICompositeExpression
99
-	 */
100
-	public function orX(...$x) {
101
-		$compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $x);
102
-		return new CompositeExpression($compositeExpression);
103
-	}
86
+    /**
87
+     * Creates a disjunction of the given boolean expressions.
88
+     *
89
+     * Example:
90
+     *
91
+     *     [php]
92
+     *     // (u.type = ?) OR (u.role = ?)
93
+     *     $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
94
+     *
95
+     * @param mixed ...$x Optional clause. Defaults = null, but requires
96
+     *                 at least one defined when converting to string.
97
+     *
98
+     * @return \OCP\DB\QueryBuilder\ICompositeExpression
99
+     */
100
+    public function orX(...$x) {
101
+        $compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $x);
102
+        return new CompositeExpression($compositeExpression);
103
+    }
104 104
 
105
-	/**
106
-	 * Creates a comparison expression.
107
-	 *
108
-	 * @param mixed $x The left expression.
109
-	 * @param string $operator One of the IExpressionBuilder::* constants.
110
-	 * @param mixed $y The right expression.
111
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
112
-	 *                  required when comparing text fields for oci compatibility
113
-	 *
114
-	 * @return string
115
-	 */
116
-	public function comparison($x, $operator, $y, $type = null) {
117
-		$x = $this->helper->quoteColumnName($x);
118
-		$y = $this->helper->quoteColumnName($y);
119
-		return $this->expressionBuilder->comparison($x, $operator, $y);
120
-	}
105
+    /**
106
+     * Creates a comparison expression.
107
+     *
108
+     * @param mixed $x The left expression.
109
+     * @param string $operator One of the IExpressionBuilder::* constants.
110
+     * @param mixed $y The right expression.
111
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
112
+     *                  required when comparing text fields for oci compatibility
113
+     *
114
+     * @return string
115
+     */
116
+    public function comparison($x, $operator, $y, $type = null) {
117
+        $x = $this->helper->quoteColumnName($x);
118
+        $y = $this->helper->quoteColumnName($y);
119
+        return $this->expressionBuilder->comparison($x, $operator, $y);
120
+    }
121 121
 
122
-	/**
123
-	 * Creates an equality comparison expression with the given arguments.
124
-	 *
125
-	 * First argument is considered the left expression and the second is the right expression.
126
-	 * When converted to string, it will generated a <left expr> = <right expr>. Example:
127
-	 *
128
-	 *     [php]
129
-	 *     // u.id = ?
130
-	 *     $expr->eq('u.id', '?');
131
-	 *
132
-	 * @param mixed $x The left expression.
133
-	 * @param mixed $y The right expression.
134
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
135
-	 *                  required when comparing text fields for oci compatibility
136
-	 *
137
-	 * @return string
138
-	 */
139
-	public function eq($x, $y, $type = null) {
140
-		$x = $this->helper->quoteColumnName($x);
141
-		$y = $this->helper->quoteColumnName($y);
142
-		return $this->expressionBuilder->eq($x, $y);
143
-	}
122
+    /**
123
+     * Creates an equality comparison expression with the given arguments.
124
+     *
125
+     * First argument is considered the left expression and the second is the right expression.
126
+     * When converted to string, it will generated a <left expr> = <right expr>. Example:
127
+     *
128
+     *     [php]
129
+     *     // u.id = ?
130
+     *     $expr->eq('u.id', '?');
131
+     *
132
+     * @param mixed $x The left expression.
133
+     * @param mixed $y The right expression.
134
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
135
+     *                  required when comparing text fields for oci compatibility
136
+     *
137
+     * @return string
138
+     */
139
+    public function eq($x, $y, $type = null) {
140
+        $x = $this->helper->quoteColumnName($x);
141
+        $y = $this->helper->quoteColumnName($y);
142
+        return $this->expressionBuilder->eq($x, $y);
143
+    }
144 144
 
145
-	/**
146
-	 * Creates a non equality comparison expression with the given arguments.
147
-	 * First argument is considered the left expression and the second is the right expression.
148
-	 * When converted to string, it will generated a <left expr> <> <right expr>. Example:
149
-	 *
150
-	 *     [php]
151
-	 *     // u.id <> 1
152
-	 *     $q->where($q->expr()->neq('u.id', '1'));
153
-	 *
154
-	 * @param mixed $x The left expression.
155
-	 * @param mixed $y The right expression.
156
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
157
-	 *                  required when comparing text fields for oci compatibility
158
-	 *
159
-	 * @return string
160
-	 */
161
-	public function neq($x, $y, $type = null) {
162
-		$x = $this->helper->quoteColumnName($x);
163
-		$y = $this->helper->quoteColumnName($y);
164
-		return $this->expressionBuilder->neq($x, $y);
165
-	}
145
+    /**
146
+     * Creates a non equality comparison expression with the given arguments.
147
+     * First argument is considered the left expression and the second is the right expression.
148
+     * When converted to string, it will generated a <left expr> <> <right expr>. Example:
149
+     *
150
+     *     [php]
151
+     *     // u.id <> 1
152
+     *     $q->where($q->expr()->neq('u.id', '1'));
153
+     *
154
+     * @param mixed $x The left expression.
155
+     * @param mixed $y The right expression.
156
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
157
+     *                  required when comparing text fields for oci compatibility
158
+     *
159
+     * @return string
160
+     */
161
+    public function neq($x, $y, $type = null) {
162
+        $x = $this->helper->quoteColumnName($x);
163
+        $y = $this->helper->quoteColumnName($y);
164
+        return $this->expressionBuilder->neq($x, $y);
165
+    }
166 166
 
167
-	/**
168
-	 * Creates a lower-than comparison expression with the given arguments.
169
-	 * First argument is considered the left expression and the second is the right expression.
170
-	 * When converted to string, it will generated a <left expr> < <right expr>. Example:
171
-	 *
172
-	 *     [php]
173
-	 *     // u.id < ?
174
-	 *     $q->where($q->expr()->lt('u.id', '?'));
175
-	 *
176
-	 * @param mixed $x The left expression.
177
-	 * @param mixed $y The right expression.
178
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
179
-	 *                  required when comparing text fields for oci compatibility
180
-	 *
181
-	 * @return string
182
-	 */
183
-	public function lt($x, $y, $type = null) {
184
-		$x = $this->helper->quoteColumnName($x);
185
-		$y = $this->helper->quoteColumnName($y);
186
-		return $this->expressionBuilder->lt($x, $y);
187
-	}
167
+    /**
168
+     * Creates a lower-than comparison expression with the given arguments.
169
+     * First argument is considered the left expression and the second is the right expression.
170
+     * When converted to string, it will generated a <left expr> < <right expr>. Example:
171
+     *
172
+     *     [php]
173
+     *     // u.id < ?
174
+     *     $q->where($q->expr()->lt('u.id', '?'));
175
+     *
176
+     * @param mixed $x The left expression.
177
+     * @param mixed $y The right expression.
178
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
179
+     *                  required when comparing text fields for oci compatibility
180
+     *
181
+     * @return string
182
+     */
183
+    public function lt($x, $y, $type = null) {
184
+        $x = $this->helper->quoteColumnName($x);
185
+        $y = $this->helper->quoteColumnName($y);
186
+        return $this->expressionBuilder->lt($x, $y);
187
+    }
188 188
 
189
-	/**
190
-	 * Creates a lower-than-equal comparison expression with the given arguments.
191
-	 * First argument is considered the left expression and the second is the right expression.
192
-	 * When converted to string, it will generated a <left expr> <= <right expr>. Example:
193
-	 *
194
-	 *     [php]
195
-	 *     // u.id <= ?
196
-	 *     $q->where($q->expr()->lte('u.id', '?'));
197
-	 *
198
-	 * @param mixed $x The left expression.
199
-	 * @param mixed $y The right expression.
200
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
201
-	 *                  required when comparing text fields for oci compatibility
202
-	 *
203
-	 * @return string
204
-	 */
205
-	public function lte($x, $y, $type = null) {
206
-		$x = $this->helper->quoteColumnName($x);
207
-		$y = $this->helper->quoteColumnName($y);
208
-		return $this->expressionBuilder->lte($x, $y);
209
-	}
189
+    /**
190
+     * Creates a lower-than-equal comparison expression with the given arguments.
191
+     * First argument is considered the left expression and the second is the right expression.
192
+     * When converted to string, it will generated a <left expr> <= <right expr>. Example:
193
+     *
194
+     *     [php]
195
+     *     // u.id <= ?
196
+     *     $q->where($q->expr()->lte('u.id', '?'));
197
+     *
198
+     * @param mixed $x The left expression.
199
+     * @param mixed $y The right expression.
200
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
201
+     *                  required when comparing text fields for oci compatibility
202
+     *
203
+     * @return string
204
+     */
205
+    public function lte($x, $y, $type = null) {
206
+        $x = $this->helper->quoteColumnName($x);
207
+        $y = $this->helper->quoteColumnName($y);
208
+        return $this->expressionBuilder->lte($x, $y);
209
+    }
210 210
 
211
-	/**
212
-	 * Creates a greater-than comparison expression with the given arguments.
213
-	 * First argument is considered the left expression and the second is the right expression.
214
-	 * When converted to string, it will generated a <left expr> > <right expr>. Example:
215
-	 *
216
-	 *     [php]
217
-	 *     // u.id > ?
218
-	 *     $q->where($q->expr()->gt('u.id', '?'));
219
-	 *
220
-	 * @param mixed $x The left expression.
221
-	 * @param mixed $y The right expression.
222
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
223
-	 *                  required when comparing text fields for oci compatibility
224
-	 *
225
-	 * @return string
226
-	 */
227
-	public function gt($x, $y, $type = null) {
228
-		$x = $this->helper->quoteColumnName($x);
229
-		$y = $this->helper->quoteColumnName($y);
230
-		return $this->expressionBuilder->gt($x, $y);
231
-	}
211
+    /**
212
+     * Creates a greater-than comparison expression with the given arguments.
213
+     * First argument is considered the left expression and the second is the right expression.
214
+     * When converted to string, it will generated a <left expr> > <right expr>. Example:
215
+     *
216
+     *     [php]
217
+     *     // u.id > ?
218
+     *     $q->where($q->expr()->gt('u.id', '?'));
219
+     *
220
+     * @param mixed $x The left expression.
221
+     * @param mixed $y The right expression.
222
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
223
+     *                  required when comparing text fields for oci compatibility
224
+     *
225
+     * @return string
226
+     */
227
+    public function gt($x, $y, $type = null) {
228
+        $x = $this->helper->quoteColumnName($x);
229
+        $y = $this->helper->quoteColumnName($y);
230
+        return $this->expressionBuilder->gt($x, $y);
231
+    }
232 232
 
233
-	/**
234
-	 * Creates a greater-than-equal comparison expression with the given arguments.
235
-	 * First argument is considered the left expression and the second is the right expression.
236
-	 * When converted to string, it will generated a <left expr> >= <right expr>. Example:
237
-	 *
238
-	 *     [php]
239
-	 *     // u.id >= ?
240
-	 *     $q->where($q->expr()->gte('u.id', '?'));
241
-	 *
242
-	 * @param mixed $x The left expression.
243
-	 * @param mixed $y The right expression.
244
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
245
-	 *                  required when comparing text fields for oci compatibility
246
-	 *
247
-	 * @return string
248
-	 */
249
-	public function gte($x, $y, $type = null) {
250
-		$x = $this->helper->quoteColumnName($x);
251
-		$y = $this->helper->quoteColumnName($y);
252
-		return $this->expressionBuilder->gte($x, $y);
253
-	}
233
+    /**
234
+     * Creates a greater-than-equal comparison expression with the given arguments.
235
+     * First argument is considered the left expression and the second is the right expression.
236
+     * When converted to string, it will generated a <left expr> >= <right expr>. Example:
237
+     *
238
+     *     [php]
239
+     *     // u.id >= ?
240
+     *     $q->where($q->expr()->gte('u.id', '?'));
241
+     *
242
+     * @param mixed $x The left expression.
243
+     * @param mixed $y The right expression.
244
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
245
+     *                  required when comparing text fields for oci compatibility
246
+     *
247
+     * @return string
248
+     */
249
+    public function gte($x, $y, $type = null) {
250
+        $x = $this->helper->quoteColumnName($x);
251
+        $y = $this->helper->quoteColumnName($y);
252
+        return $this->expressionBuilder->gte($x, $y);
253
+    }
254 254
 
255
-	/**
256
-	 * Creates an IS NULL expression with the given arguments.
257
-	 *
258
-	 * @param string $x The field in string format to be restricted by IS NULL.
259
-	 *
260
-	 * @return string
261
-	 */
262
-	public function isNull($x) {
263
-		$x = $this->helper->quoteColumnName($x);
264
-		return $this->expressionBuilder->isNull($x);
265
-	}
255
+    /**
256
+     * Creates an IS NULL expression with the given arguments.
257
+     *
258
+     * @param string $x The field in string format to be restricted by IS NULL.
259
+     *
260
+     * @return string
261
+     */
262
+    public function isNull($x) {
263
+        $x = $this->helper->quoteColumnName($x);
264
+        return $this->expressionBuilder->isNull($x);
265
+    }
266 266
 
267
-	/**
268
-	 * Creates an IS NOT NULL expression with the given arguments.
269
-	 *
270
-	 * @param string $x The field in string format to be restricted by IS NOT NULL.
271
-	 *
272
-	 * @return string
273
-	 */
274
-	public function isNotNull($x) {
275
-		$x = $this->helper->quoteColumnName($x);
276
-		return $this->expressionBuilder->isNotNull($x);
277
-	}
267
+    /**
268
+     * Creates an IS NOT NULL expression with the given arguments.
269
+     *
270
+     * @param string $x The field in string format to be restricted by IS NOT NULL.
271
+     *
272
+     * @return string
273
+     */
274
+    public function isNotNull($x) {
275
+        $x = $this->helper->quoteColumnName($x);
276
+        return $this->expressionBuilder->isNotNull($x);
277
+    }
278 278
 
279
-	/**
280
-	 * Creates a LIKE() comparison expression with the given arguments.
281
-	 *
282
-	 * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison.
283
-	 * @param mixed $y Argument to be used in LIKE() comparison.
284
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
285
-	 *                  required when comparing text fields for oci compatibility
286
-	 *
287
-	 * @return string
288
-	 */
289
-	public function like($x, $y, $type = null) {
290
-		$x = $this->helper->quoteColumnName($x);
291
-		$y = $this->helper->quoteColumnName($y);
292
-		return $this->expressionBuilder->like($x, $y);
293
-	}
279
+    /**
280
+     * Creates a LIKE() comparison expression with the given arguments.
281
+     *
282
+     * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison.
283
+     * @param mixed $y Argument to be used in LIKE() comparison.
284
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
285
+     *                  required when comparing text fields for oci compatibility
286
+     *
287
+     * @return string
288
+     */
289
+    public function like($x, $y, $type = null) {
290
+        $x = $this->helper->quoteColumnName($x);
291
+        $y = $this->helper->quoteColumnName($y);
292
+        return $this->expressionBuilder->like($x, $y);
293
+    }
294 294
 
295
-	/**
296
-	 * Creates a ILIKE() comparison expression with the given arguments.
297
-	 *
298
-	 * @param string $x Field in string format to be inspected by ILIKE() comparison.
299
-	 * @param mixed $y Argument to be used in ILIKE() comparison.
300
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
301
-	 *                  required when comparing text fields for oci compatibility
302
-	 *
303
-	 * @return string
304
-	 * @since 9.0.0
305
-	 */
306
-	public function iLike($x, $y, $type = null) {
307
-		return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y));
308
-	}
295
+    /**
296
+     * Creates a ILIKE() comparison expression with the given arguments.
297
+     *
298
+     * @param string $x Field in string format to be inspected by ILIKE() comparison.
299
+     * @param mixed $y Argument to be used in ILIKE() comparison.
300
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
301
+     *                  required when comparing text fields for oci compatibility
302
+     *
303
+     * @return string
304
+     * @since 9.0.0
305
+     */
306
+    public function iLike($x, $y, $type = null) {
307
+        return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y));
308
+    }
309 309
 
310
-	/**
311
-	 * Creates a NOT LIKE() comparison expression with the given arguments.
312
-	 *
313
-	 * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison.
314
-	 * @param mixed $y Argument to be used in NOT LIKE() comparison.
315
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
316
-	 *                  required when comparing text fields for oci compatibility
317
-	 *
318
-	 * @return string
319
-	 */
320
-	public function notLike($x, $y, $type = null) {
321
-		$x = $this->helper->quoteColumnName($x);
322
-		$y = $this->helper->quoteColumnName($y);
323
-		return $this->expressionBuilder->notLike($x, $y);
324
-	}
310
+    /**
311
+     * Creates a NOT LIKE() comparison expression with the given arguments.
312
+     *
313
+     * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison.
314
+     * @param mixed $y Argument to be used in NOT LIKE() comparison.
315
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
316
+     *                  required when comparing text fields for oci compatibility
317
+     *
318
+     * @return string
319
+     */
320
+    public function notLike($x, $y, $type = null) {
321
+        $x = $this->helper->quoteColumnName($x);
322
+        $y = $this->helper->quoteColumnName($y);
323
+        return $this->expressionBuilder->notLike($x, $y);
324
+    }
325 325
 
326
-	/**
327
-	 * Creates a IN () comparison expression with the given arguments.
328
-	 *
329
-	 * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison.
330
-	 * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison.
331
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
332
-	 *                  required when comparing text fields for oci compatibility
333
-	 *
334
-	 * @return string
335
-	 */
336
-	public function in($x, $y, $type = null) {
337
-		$x = $this->helper->quoteColumnName($x);
338
-		$y = $this->helper->quoteColumnNames($y);
339
-		return $this->expressionBuilder->in($x, $y);
340
-	}
326
+    /**
327
+     * Creates a IN () comparison expression with the given arguments.
328
+     *
329
+     * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison.
330
+     * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison.
331
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
332
+     *                  required when comparing text fields for oci compatibility
333
+     *
334
+     * @return string
335
+     */
336
+    public function in($x, $y, $type = null) {
337
+        $x = $this->helper->quoteColumnName($x);
338
+        $y = $this->helper->quoteColumnNames($y);
339
+        return $this->expressionBuilder->in($x, $y);
340
+    }
341 341
 
342
-	/**
343
-	 * Creates a NOT IN () comparison expression with the given arguments.
344
-	 *
345
-	 * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison.
346
-	 * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
347
-	 * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
348
-	 *                  required when comparing text fields for oci compatibility
349
-	 *
350
-	 * @return string
351
-	 */
352
-	public function notIn($x, $y, $type = null) {
353
-		$x = $this->helper->quoteColumnName($x);
354
-		$y = $this->helper->quoteColumnNames($y);
355
-		return $this->expressionBuilder->notIn($x, $y);
356
-	}
342
+    /**
343
+     * Creates a NOT IN () comparison expression with the given arguments.
344
+     *
345
+     * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison.
346
+     * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
347
+     * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
348
+     *                  required when comparing text fields for oci compatibility
349
+     *
350
+     * @return string
351
+     */
352
+    public function notIn($x, $y, $type = null) {
353
+        $x = $this->helper->quoteColumnName($x);
354
+        $y = $this->helper->quoteColumnNames($y);
355
+        return $this->expressionBuilder->notIn($x, $y);
356
+    }
357 357
 
358
-	/**
359
-	 * Creates a $x = '' statement, because Oracle needs a different check
360
-	 *
361
-	 * @param string $x The field in string format to be inspected by the comparison.
362
-	 * @return string
363
-	 * @since 13.0.0
364
-	 */
365
-	public function emptyString($x) {
366
-		return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR));
367
-	}
358
+    /**
359
+     * Creates a $x = '' statement, because Oracle needs a different check
360
+     *
361
+     * @param string $x The field in string format to be inspected by the comparison.
362
+     * @return string
363
+     * @since 13.0.0
364
+     */
365
+    public function emptyString($x) {
366
+        return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR));
367
+    }
368 368
 
369
-	/**
370
-	 * Creates a `$x <> ''` statement, because Oracle needs a different check
371
-	 *
372
-	 * @param string $x The field in string format to be inspected by the comparison.
373
-	 * @return string
374
-	 * @since 13.0.0
375
-	 */
376
-	public function nonEmptyString($x) {
377
-		return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR));
378
-	}
369
+    /**
370
+     * Creates a `$x <> ''` statement, because Oracle needs a different check
371
+     *
372
+     * @param string $x The field in string format to be inspected by the comparison.
373
+     * @return string
374
+     * @since 13.0.0
375
+     */
376
+    public function nonEmptyString($x) {
377
+        return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR));
378
+    }
379 379
 
380
-	/**
381
-	 * Binary AND Operator copies a bit to the result if it exists in both operands.
382
-	 *
383
-	 * @param string|ILiteral $x The field or value to check
384
-	 * @param int $y Bitmap that must be set
385
-	 * @return IQueryFunction
386
-	 * @since 12.0.0
387
-	 */
388
-	public function bitwiseAnd($x, $y) {
389
-		return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression(
390
-			$this->helper->quoteColumnName($x),
391
-			$y
392
-		));
393
-	}
380
+    /**
381
+     * Binary AND Operator copies a bit to the result if it exists in both operands.
382
+     *
383
+     * @param string|ILiteral $x The field or value to check
384
+     * @param int $y Bitmap that must be set
385
+     * @return IQueryFunction
386
+     * @since 12.0.0
387
+     */
388
+    public function bitwiseAnd($x, $y) {
389
+        return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression(
390
+            $this->helper->quoteColumnName($x),
391
+            $y
392
+        ));
393
+    }
394 394
 
395
-	/**
396
-	 * Binary OR Operator copies a bit if it exists in either operand.
397
-	 *
398
-	 * @param string|ILiteral $x The field or value to check
399
-	 * @param int $y Bitmap that must be set
400
-	 * @return IQueryFunction
401
-	 * @since 12.0.0
402
-	 */
403
-	public function bitwiseOr($x, $y) {
404
-		return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression(
405
-			$this->helper->quoteColumnName($x),
406
-			$y
407
-		));
408
-	}
395
+    /**
396
+     * Binary OR Operator copies a bit if it exists in either operand.
397
+     *
398
+     * @param string|ILiteral $x The field or value to check
399
+     * @param int $y Bitmap that must be set
400
+     * @return IQueryFunction
401
+     * @since 12.0.0
402
+     */
403
+    public function bitwiseOr($x, $y) {
404
+        return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression(
405
+            $this->helper->quoteColumnName($x),
406
+            $y
407
+        ));
408
+    }
409 409
 
410
-	/**
411
-	 * Quotes a given input parameter.
412
-	 *
413
-	 * @param mixed $input The parameter to be quoted.
414
-	 * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
415
-	 *
416
-	 * @return ILiteral
417
-	 */
418
-	public function literal($input, $type = null) {
419
-		return new Literal($this->expressionBuilder->literal($input, $type));
420
-	}
410
+    /**
411
+     * Quotes a given input parameter.
412
+     *
413
+     * @param mixed $input The parameter to be quoted.
414
+     * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
415
+     *
416
+     * @return ILiteral
417
+     */
418
+    public function literal($input, $type = null) {
419
+        return new Literal($this->expressionBuilder->literal($input, $type));
420
+    }
421 421
 
422
-	/**
423
-	 * Returns a IQueryFunction that casts the column to the given type
424
-	 *
425
-	 * @param string $column
426
-	 * @param mixed $type One of IQueryBuilder::PARAM_*
427
-	 * @return string
428
-	 */
429
-	public function castColumn($column, $type) {
430
-		return new QueryFunction(
431
-			$this->helper->quoteColumnName($column)
432
-		);
433
-	}
422
+    /**
423
+     * Returns a IQueryFunction that casts the column to the given type
424
+     *
425
+     * @param string $column
426
+     * @param mixed $type One of IQueryBuilder::PARAM_*
427
+     * @return string
428
+     */
429
+    public function castColumn($column, $type) {
430
+        return new QueryFunction(
431
+            $this->helper->quoteColumnName($column)
432
+        );
433
+    }
434 434
 }
Please login to merge, or discard this patch.