Completed
Push — master ( 34699d...93c711 )
by Joas
30:13
created
lib/public/DB/Types.php 1 patch
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -16,166 +16,166 @@
 block discarded – undo
16 16
  * @since 21.0.0
17 17
  */
18 18
 final class Types {
19
-	/**
20
-	 * @var string
21
-	 * @since 21.0.0
22
-	 */
23
-	public const BIGINT = 'bigint';
24
-
25
-	/**
26
-	 * @var string
27
-	 * @since 21.0.0
28
-	 */
29
-	public const BINARY = 'binary';
30
-
31
-	/**
32
-	 * @var string
33
-	 * @since 21.0.0
34
-	 */
35
-	public const BLOB = 'blob';
36
-
37
-	/**
38
-	 * @var string
39
-	 * @since 21.0.0
40
-	 */
41
-	public const BOOLEAN = 'boolean';
42
-
43
-	/**
44
-	 * A datetime instance with only the date set.
45
-	 * This will be (de)serialized into a \DateTime instance,
46
-	 * it is recommended to instead use the `DATE_IMMUTABLE` instead.
47
-	 *
48
-	 * Warning: When deserialized the timezone will be set to UTC.
49
-	 * @var string
50
-	 * @since 21.0.0
51
-	 */
52
-	public const DATE = 'date';
53
-
54
-	/**
55
-	 * An immutable datetime instance with only the date set.
56
-	 * This will be (de)serialized into a \DateTimeImmutable instance,
57
-	 * It is recommended to use this over the `DATE` type because
58
-	 * out `Entity` class works detecting changes through the setter,
59
-	 * changes on mutable objects can not be detected.
60
-	 *
61
-	 * Warning: When deserialized the timezone will be set to UTC.
62
-	 * @var string
63
-	 * @since 31.0.0
64
-	 */
65
-	public const DATE_IMMUTABLE = 'date_immutable';
66
-
67
-	/**
68
-	 * A datetime instance with date and time support.
69
-	 * This will be (de)serialized into a \DateTime instance,
70
-	 * it is recommended to instead use the `DATETIME_IMMUTABLE` instead.
71
-	 *
72
-	 * Warning: When deserialized the timezone will be set to UTC.
73
-	 * @var string
74
-	 * @since 21.0.0
75
-	 */
76
-	public const DATETIME = 'datetime';
77
-
78
-	/**
79
-	 * An immutable datetime instance with date and time set.
80
-	 * This will be (de)serialized into a \DateTimeImmutable instance,
81
-	 * It is recommended to use this over the `DATETIME` type because
82
-	 * out `Entity` class works detecting changes through the setter,
83
-	 * changes on mutable objects can not be detected.
84
-	 *
85
-	 * Warning: When deserialized the timezone will be set to UTC.
86
-	 * @var string
87
-	 * @since 31.0.0
88
-	 */
89
-	public const DATETIME_IMMUTABLE = 'datetime_immutable';
90
-
91
-
92
-	/**
93
-	 * A datetime instance with timezone support
94
-	 * This will be (de)serialized into a \DateTime instance,
95
-	 * it is recommended to instead use the `DATETIME_TZ_IMMUTABLE` instead.
96
-	 *
97
-	 * @var string
98
-	 * @since 31.0.0
99
-	 */
100
-	public const DATETIME_TZ = 'datetimetz';
101
-
102
-	/**
103
-	 * An immutable timezone aware datetime instance with date and time set.
104
-	 * This will be (de)serialized into a \DateTimeImmutable instance,
105
-	 * It is recommended to use this over the `DATETIME_TZ` type because
106
-	 * out `Entity` class works detecting changes through the setter,
107
-	 * changes on mutable objects can not be detected.
108
-	 *
109
-	 * @var string
110
-	 * @since 31.0.0
111
-	 */
112
-	public const DATETIME_TZ_IMMUTABLE = 'datetimetz_immutable';
113
-
114
-	/**
115
-	 * @var string
116
-	 * @since 21.0.0
117
-	 */
118
-	public const DECIMAL = 'decimal';
119
-
120
-	/**
121
-	 * @var string
122
-	 * @since 21.0.0
123
-	 */
124
-	public const FLOAT = 'float';
125
-
126
-	/**
127
-	 * @var string
128
-	 * @since 21.0.0
129
-	 */
130
-	public const INTEGER = 'integer';
131
-
132
-	/**
133
-	 * @var string
134
-	 * @since 21.0.0
135
-	 */
136
-	public const SMALLINT = 'smallint';
137
-
138
-	/**
139
-	 * @var string
140
-	 * @since 21.0.0
141
-	 */
142
-	public const STRING = 'string';
143
-
144
-	/**
145
-	 * @var string
146
-	 * @since 21.0.0
147
-	 */
148
-	public const TEXT = 'text';
149
-
150
-	/**
151
-	 * A datetime instance with only the time set.
152
-	 * This will be (de)serialized into a \DateTime instance,
153
-	 * it is recommended to instead use the `TIME_IMMUTABLE` instead.
154
-	 *
155
-	 * Warning: When deserialized the timezone will be set to UTC.
156
-	 * @var string
157
-	 * @since 21.0.0
158
-	 */
159
-	public const TIME = 'time';
160
-
161
-	/**
162
-	 * A datetime instance with only the time set.
163
-	 * This will be (de)serialized into a \DateTime instance.
164
-	 *
165
-	 * It is recommended to use this over the `DATETIME_TZ` type because
166
-	 * out `Entity` class works detecting changes through the setter,
167
-	 * changes on mutable objects can not be detected.
168
-	 *
169
-	 * @var string
170
-	 * @since 31.0.0
171
-	 */
172
-	public const TIME_IMMUTABLE = 'time_immutable';
173
-
174
-	/**
175
-	 * @var string
176
-	 * @since 24.0.0
177
-	 * @deprecated 33.0.0 JSON fields can not properly be used in WHERE statements of Oracle and MySQL.
178
-	 *                    It is recommended to use a simple STRING field and handle JSON within PHP
179
-	 */
180
-	public const JSON = 'json';
19
+    /**
20
+     * @var string
21
+     * @since 21.0.0
22
+     */
23
+    public const BIGINT = 'bigint';
24
+
25
+    /**
26
+     * @var string
27
+     * @since 21.0.0
28
+     */
29
+    public const BINARY = 'binary';
30
+
31
+    /**
32
+     * @var string
33
+     * @since 21.0.0
34
+     */
35
+    public const BLOB = 'blob';
36
+
37
+    /**
38
+     * @var string
39
+     * @since 21.0.0
40
+     */
41
+    public const BOOLEAN = 'boolean';
42
+
43
+    /**
44
+     * A datetime instance with only the date set.
45
+     * This will be (de)serialized into a \DateTime instance,
46
+     * it is recommended to instead use the `DATE_IMMUTABLE` instead.
47
+     *
48
+     * Warning: When deserialized the timezone will be set to UTC.
49
+     * @var string
50
+     * @since 21.0.0
51
+     */
52
+    public const DATE = 'date';
53
+
54
+    /**
55
+     * An immutable datetime instance with only the date set.
56
+     * This will be (de)serialized into a \DateTimeImmutable instance,
57
+     * It is recommended to use this over the `DATE` type because
58
+     * out `Entity` class works detecting changes through the setter,
59
+     * changes on mutable objects can not be detected.
60
+     *
61
+     * Warning: When deserialized the timezone will be set to UTC.
62
+     * @var string
63
+     * @since 31.0.0
64
+     */
65
+    public const DATE_IMMUTABLE = 'date_immutable';
66
+
67
+    /**
68
+     * A datetime instance with date and time support.
69
+     * This will be (de)serialized into a \DateTime instance,
70
+     * it is recommended to instead use the `DATETIME_IMMUTABLE` instead.
71
+     *
72
+     * Warning: When deserialized the timezone will be set to UTC.
73
+     * @var string
74
+     * @since 21.0.0
75
+     */
76
+    public const DATETIME = 'datetime';
77
+
78
+    /**
79
+     * An immutable datetime instance with date and time set.
80
+     * This will be (de)serialized into a \DateTimeImmutable instance,
81
+     * It is recommended to use this over the `DATETIME` type because
82
+     * out `Entity` class works detecting changes through the setter,
83
+     * changes on mutable objects can not be detected.
84
+     *
85
+     * Warning: When deserialized the timezone will be set to UTC.
86
+     * @var string
87
+     * @since 31.0.0
88
+     */
89
+    public const DATETIME_IMMUTABLE = 'datetime_immutable';
90
+
91
+
92
+    /**
93
+     * A datetime instance with timezone support
94
+     * This will be (de)serialized into a \DateTime instance,
95
+     * it is recommended to instead use the `DATETIME_TZ_IMMUTABLE` instead.
96
+     *
97
+     * @var string
98
+     * @since 31.0.0
99
+     */
100
+    public const DATETIME_TZ = 'datetimetz';
101
+
102
+    /**
103
+     * An immutable timezone aware datetime instance with date and time set.
104
+     * This will be (de)serialized into a \DateTimeImmutable instance,
105
+     * It is recommended to use this over the `DATETIME_TZ` type because
106
+     * out `Entity` class works detecting changes through the setter,
107
+     * changes on mutable objects can not be detected.
108
+     *
109
+     * @var string
110
+     * @since 31.0.0
111
+     */
112
+    public const DATETIME_TZ_IMMUTABLE = 'datetimetz_immutable';
113
+
114
+    /**
115
+     * @var string
116
+     * @since 21.0.0
117
+     */
118
+    public const DECIMAL = 'decimal';
119
+
120
+    /**
121
+     * @var string
122
+     * @since 21.0.0
123
+     */
124
+    public const FLOAT = 'float';
125
+
126
+    /**
127
+     * @var string
128
+     * @since 21.0.0
129
+     */
130
+    public const INTEGER = 'integer';
131
+
132
+    /**
133
+     * @var string
134
+     * @since 21.0.0
135
+     */
136
+    public const SMALLINT = 'smallint';
137
+
138
+    /**
139
+     * @var string
140
+     * @since 21.0.0
141
+     */
142
+    public const STRING = 'string';
143
+
144
+    /**
145
+     * @var string
146
+     * @since 21.0.0
147
+     */
148
+    public const TEXT = 'text';
149
+
150
+    /**
151
+     * A datetime instance with only the time set.
152
+     * This will be (de)serialized into a \DateTime instance,
153
+     * it is recommended to instead use the `TIME_IMMUTABLE` instead.
154
+     *
155
+     * Warning: When deserialized the timezone will be set to UTC.
156
+     * @var string
157
+     * @since 21.0.0
158
+     */
159
+    public const TIME = 'time';
160
+
161
+    /**
162
+     * A datetime instance with only the time set.
163
+     * This will be (de)serialized into a \DateTime instance.
164
+     *
165
+     * It is recommended to use this over the `DATETIME_TZ` type because
166
+     * out `Entity` class works detecting changes through the setter,
167
+     * changes on mutable objects can not be detected.
168
+     *
169
+     * @var string
170
+     * @since 31.0.0
171
+     */
172
+    public const TIME_IMMUTABLE = 'time_immutable';
173
+
174
+    /**
175
+     * @var string
176
+     * @since 24.0.0
177
+     * @deprecated 33.0.0 JSON fields can not properly be used in WHERE statements of Oracle and MySQL.
178
+     *                    It is recommended to use a simple STRING field and handle JSON within PHP
179
+     */
180
+    public const JSON = 'json';
181 181
 }
Please login to merge, or discard this patch.
lib/public/DB/QueryBuilder/IQueryBuilder.php 1 patch
Indentation   +1070 added lines, -1070 removed lines patch added patch discarded remove patch
@@ -22,1074 +22,1074 @@
 block discarded – undo
22 22
  * @psalm-taint-specialize
23 23
  */
24 24
 interface IQueryBuilder {
25
-	/**
26
-	 * @since 9.0.0
27
-	 */
28
-	public const PARAM_NULL = ParameterType::NULL;
29
-	/**
30
-	 * @since 9.0.0
31
-	 */
32
-	public const PARAM_BOOL = Types::BOOLEAN;
33
-	/**
34
-	 * @since 9.0.0
35
-	 */
36
-	public const PARAM_INT = ParameterType::INTEGER;
37
-	/**
38
-	 * @since 9.0.0
39
-	 */
40
-	public const PARAM_STR = ParameterType::STRING;
41
-	/**
42
-	 * @since 9.0.0
43
-	 */
44
-	public const PARAM_LOB = ParameterType::LARGE_OBJECT;
45
-
46
-	/**
47
-	 * @since 9.0.0
48
-	 * @deprecated 31.0.0 - use PARAM_DATETIME_MUTABLE instead
49
-	 */
50
-	public const PARAM_DATE = Types::DATETIME_MUTABLE;
51
-
52
-	/**
53
-	 * For passing a \DateTime instance when only interested in the time part (without timezone support)
54
-	 * @since 31.0.0
55
-	 */
56
-	public const PARAM_TIME_MUTABLE = Types::TIME_MUTABLE;
57
-
58
-	/**
59
-	 * For passing a \DateTime instance when only interested in the date part (without timezone support)
60
-	 * @since 31.0.0
61
-	 */
62
-	public const PARAM_DATE_MUTABLE = Types::DATE_MUTABLE;
63
-
64
-	/**
65
-	 * For passing a \DateTime instance (without timezone support)
66
-	 * @since 31.0.0
67
-	 */
68
-	public const PARAM_DATETIME_MUTABLE = Types::DATETIME_MUTABLE;
69
-
70
-	/**
71
-	 * For passing a \DateTime instance with timezone support
72
-	 * @since 31.0.0
73
-	 */
74
-	public const PARAM_DATETIME_TZ_MUTABLE = Types::DATETIMETZ_MUTABLE;
75
-
76
-	/**
77
-	 * For passing a \DateTimeImmutable instance when only interested in the time part (without timezone support)
78
-	 * @since 31.0.0
79
-	 */
80
-	public const PARAM_TIME_IMMUTABLE = Types::TIME_MUTABLE;
81
-
82
-	/**
83
-	 * For passing a \DateTime instance when only interested in the date part (without timezone support)
84
-	 * @since 9.0.0
85
-	 */
86
-	public const PARAM_DATE_IMMUTABLE = Types::DATE_IMMUTABLE;
87
-
88
-	/**
89
-	 * For passing a \DateTime instance (without timezone support)
90
-	 * @since 31.0.0
91
-	 */
92
-	public const PARAM_DATETIME_IMMUTABLE = Types::DATETIME_IMMUTABLE;
93
-
94
-	/**
95
-	 * For passing a \DateTime instance with timezone support
96
-	 * @since 31.0.0
97
-	 */
98
-	public const PARAM_DATETIME_TZ_IMMUTABLE = Types::DATETIMETZ_IMMUTABLE;
99
-
100
-	/**
101
-	 * @since 24.0.0
102
-	 * @deprecated 33.0.0 JSON fields can not properly be used in WHERE statements of Oracle and MySQL.
103
-	 *                    It is recommended to use a simple STRING field and handle JSON within PHP
104
-	 */
105
-	public const PARAM_JSON = 'json';
106
-
107
-	/**
108
-	 * @since 9.0.0
109
-	 */
110
-	public const PARAM_INT_ARRAY = ArrayParameterType::INTEGER;
111
-	/**
112
-	 * @since 9.0.0
113
-	 */
114
-	public const PARAM_STR_ARRAY = ArrayParameterType::STRING;
115
-
116
-	/**
117
-	 * @since 24.0.0 Indicates how many rows can be deleted at once with MySQL
118
-	 * database server.
119
-	 */
120
-	public const MAX_ROW_DELETION = 100000;
121
-
122
-	/**
123
-	 * Enable/disable automatic prefixing of table names with the oc_ prefix
124
-	 *
125
-	 * @param bool $enabled If set to true table names will be prefixed with the
126
-	 *                      owncloud database prefix automatically.
127
-	 * @since 8.2.0
128
-	 */
129
-	public function automaticTablePrefix($enabled);
130
-
131
-	/**
132
-	 * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
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->expr()->eq('u.id', 1));
140
-	 * </code>
141
-	 *
142
-	 * For more complex expression construction, consider storing the expression
143
-	 * builder object in a local variable.
144
-	 *
145
-	 * @return \OCP\DB\QueryBuilder\IExpressionBuilder
146
-	 * @since 8.2.0
147
-	 */
148
-	public function expr();
149
-
150
-	/**
151
-	 * Gets an FunctionBuilder used for object-oriented construction of query functions.
152
-	 * This producer method is intended for convenient inline usage. Example:
153
-	 *
154
-	 * <code>
155
-	 *     $qb = $conn->getQueryBuilder()
156
-	 *         ->select('u')
157
-	 *         ->from('users', 'u')
158
-	 *         ->where($qb->fun()->md5('u.id'));
159
-	 * </code>
160
-	 *
161
-	 * For more complex function construction, consider storing the function
162
-	 * builder object in a local variable.
163
-	 *
164
-	 * @return \OCP\DB\QueryBuilder\IFunctionBuilder
165
-	 * @since 12.0.0
166
-	 */
167
-	public function func();
168
-
169
-	/**
170
-	 * Gets the type of the currently built query.
171
-	 *
172
-	 * @return integer
173
-	 * @since 8.2.0
174
-	 */
175
-	public function getType();
176
-
177
-	/**
178
-	 * Gets the associated DBAL Connection for this query builder.
179
-	 *
180
-	 * @return \OCP\IDBConnection
181
-	 * @since 8.2.0
182
-	 */
183
-	public function getConnection();
184
-
185
-	/**
186
-	 * Gets the state of this query builder instance.
187
-	 *
188
-	 * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
189
-	 * @since 8.2.0
190
-	 * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
191
-	 *    and we can not fix this in our wrapper.
192
-	 */
193
-	public function getState();
194
-
195
-	/**
196
-	 * Execute for select statements
197
-	 *
198
-	 * @param ?IDBConnection $connection (optional) the connection to run the query against. since 30.0
199
-	 * @return IResult
200
-	 * @since 22.0.0
201
-	 *
202
-	 * @throws Exception
203
-	 * @throws \RuntimeException in case of usage with non select query
204
-	 */
205
-	public function executeQuery(?IDBConnection $connection = null): IResult;
206
-
207
-	/**
208
-	 * Execute insert, update and delete statements
209
-	 *
210
-	 * @param ?IDBConnection $connection (optional) the connection to run the query against. since 30.0
211
-	 * @return int the number of affected rows
212
-	 * @since 22.0.0
213
-	 *
214
-	 * @throws Exception
215
-	 * @throws \RuntimeException in case of usage with select query
216
-	 */
217
-	public function executeStatement(?IDBConnection $connection = null): int;
218
-
219
-	/**
220
-	 * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
221
-	 *
222
-	 * <code>
223
-	 *     $qb = $conn->getQueryBuilder()
224
-	 *         ->select('u')
225
-	 *         ->from('User', 'u')
226
-	 *     echo $qb->getSQL(); // SELECT u FROM User u
227
-	 * </code>
228
-	 *
229
-	 * @return string The SQL query string.
230
-	 * @since 8.2.0
231
-	 */
232
-	public function getSQL();
233
-
234
-	/**
235
-	 * Sets a query parameter for the query being constructed.
236
-	 *
237
-	 * <code>
238
-	 *     $qb = $conn->getQueryBuilder()
239
-	 *         ->select('u')
240
-	 *         ->from('users', 'u')
241
-	 *         ->where('u.id = :user_id')
242
-	 *         ->setParameter(':user_id', 1);
243
-	 * </code>
244
-	 *
245
-	 * @param string|integer $key The parameter position or name.
246
-	 * @param mixed $value The parameter value.
247
-	 * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
248
-	 *
249
-	 * @return $this This QueryBuilder instance.
250
-	 * @since 8.2.0
251
-	 */
252
-	public function setParameter($key, $value, $type = null);
253
-
254
-	/**
255
-	 * Sets a collection of query parameters for the query being constructed.
256
-	 *
257
-	 * <code>
258
-	 *     $qb = $conn->getQueryBuilder()
259
-	 *         ->select('u')
260
-	 *         ->from('users', 'u')
261
-	 *         ->where('u.id = :user_id1 OR u.id = :user_id2')
262
-	 *         ->setParameters(array(
263
-	 *             ':user_id1' => 1,
264
-	 *             ':user_id2' => 2
265
-	 *         ));
266
-	 * </code>
267
-	 *
268
-	 * @param array $params The query parameters to set.
269
-	 * @param array $types The query parameters types to set.
270
-	 *
271
-	 * @return $this This QueryBuilder instance.
272
-	 * @since 8.2.0
273
-	 */
274
-	public function setParameters(array $params, array $types = []);
275
-
276
-	/**
277
-	 * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
278
-	 *
279
-	 * @return array The currently defined query parameters indexed by parameter index or name.
280
-	 * @since 8.2.0
281
-	 */
282
-	public function getParameters();
283
-
284
-	/**
285
-	 * Gets a (previously set) query parameter of the query being constructed.
286
-	 *
287
-	 * @param mixed $key The key (index or name) of the bound parameter.
288
-	 *
289
-	 * @return mixed The value of the bound parameter.
290
-	 * @since 8.2.0
291
-	 */
292
-	public function getParameter($key);
293
-
294
-	/**
295
-	 * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
296
-	 *
297
-	 * @return array The currently defined query parameter types indexed by parameter index or name.
298
-	 * @since 8.2.0
299
-	 */
300
-	public function getParameterTypes();
301
-
302
-	/**
303
-	 * Gets a (previously set) query parameter type of the query being constructed.
304
-	 *
305
-	 * @param mixed $key The key (index or name) of the bound parameter type.
306
-	 *
307
-	 * @return mixed The value of the bound parameter type.
308
-	 * @since 8.2.0
309
-	 */
310
-	public function getParameterType($key);
311
-
312
-	/**
313
-	 * Sets the position of the first result to retrieve (the "offset").
314
-	 *
315
-	 * @param int $firstResult The first result to return.
316
-	 *
317
-	 * @return $this This QueryBuilder instance.
318
-	 * @since 8.2.0
319
-	 */
320
-	public function setFirstResult($firstResult);
321
-
322
-	/**
323
-	 * Gets the position of the first result the query object was set to retrieve (the "offset").
324
-	 * Returns 0 if {@link setFirstResult} was not applied to this QueryBuilder.
325
-	 *
326
-	 * @return int The position of the first result.
327
-	 * @since 8.2.0
328
-	 */
329
-	public function getFirstResult();
330
-
331
-	/**
332
-	 * Sets the maximum number of results to retrieve (the "limit").
333
-	 *
334
-	 * @param int|null $maxResults The maximum number of results to retrieve.
335
-	 *
336
-	 * @return $this This QueryBuilder instance.
337
-	 * @since 8.2.0
338
-	 */
339
-	public function setMaxResults($maxResults);
340
-
341
-	/**
342
-	 * Gets the maximum number of results the query object was set to retrieve (the "limit").
343
-	 * Returns NULL if {@link setMaxResults} was not applied to this query builder.
344
-	 *
345
-	 * @return int|null The maximum number of results.
346
-	 * @since 8.2.0
347
-	 */
348
-	public function getMaxResults();
349
-
350
-	/**
351
-	 * Specifies an item that is to be returned in the query result.
352
-	 * Replaces any previously specified selections, if any.
353
-	 *
354
-	 * <code>
355
-	 *     $qb = $conn->getQueryBuilder()
356
-	 *         ->select('u.id', 'p.id')
357
-	 *         ->from('users', 'u')
358
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
359
-	 * </code>
360
-	 *
361
-	 * @param mixed ...$selects The selection expressions.
362
-	 *
363
-	 * @return $this This QueryBuilder instance.
364
-	 * @since 8.2.0
365
-	 *
366
-	 * @psalm-taint-sink sql $selects
367
-	 */
368
-	public function select(...$selects);
369
-
370
-	/**
371
-	 * Specifies an item that is to be returned with a different name in the query result.
372
-	 *
373
-	 * <code>
374
-	 *     $qb = $conn->getQueryBuilder()
375
-	 *         ->selectAlias('u.id', 'user_id')
376
-	 *         ->from('users', 'u')
377
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
378
-	 * </code>
379
-	 *
380
-	 * @param mixed $select The selection expressions.
381
-	 * @param string $alias The column alias used in the constructed query.
382
-	 *
383
-	 * @return $this This QueryBuilder instance.
384
-	 * @since 8.2.1
385
-	 *
386
-	 * @psalm-taint-sink sql $select
387
-	 * @psalm-taint-sink sql $alias
388
-	 */
389
-	public function selectAlias($select, $alias);
390
-
391
-	/**
392
-	 * Specifies an item that is to be returned uniquely in the query result.
393
-	 *
394
-	 * <code>
395
-	 *     $qb = $conn->getQueryBuilder()
396
-	 *         ->selectDistinct('type')
397
-	 *         ->from('users');
398
-	 * </code>
399
-	 *
400
-	 * @param mixed $select The selection expressions.
401
-	 *
402
-	 * @return $this This QueryBuilder instance.
403
-	 * @since 9.0.0
404
-	 *
405
-	 * @psalm-taint-sink sql $select
406
-	 */
407
-	public function selectDistinct($select);
408
-
409
-	/**
410
-	 * Adds an item that is to be returned in the query result.
411
-	 *
412
-	 * <code>
413
-	 *     $qb = $conn->getQueryBuilder()
414
-	 *         ->select('u.id')
415
-	 *         ->addSelect('p.id')
416
-	 *         ->from('users', 'u')
417
-	 *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
418
-	 * </code>
419
-	 *
420
-	 * @param mixed ...$select The selection expression.
421
-	 *
422
-	 * @return $this This QueryBuilder instance.
423
-	 * @since 8.2.0
424
-	 *
425
-	 * @psalm-taint-sink sql $select
426
-	 */
427
-	public function addSelect(...$select);
428
-
429
-	/**
430
-	 * Turns the query being built into a bulk delete query that ranges over
431
-	 * a certain table.
432
-	 *
433
-	 * <code>
434
-	 *     $qb = $conn->getQueryBuilder()
435
-	 *         ->delete('users')
436
-	 *         ->where('id = :user_id');
437
-	 *         ->setParameter(':user_id', 1);
438
-	 * </code>
439
-	 *
440
-	 * @param string $delete The table whose rows are subject to the deletion.
441
-	 * @param string $alias The table alias used in the constructed query.
442
-	 *
443
-	 * @return $this This QueryBuilder instance.
444
-	 * @since 8.2.0
445
-	 * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update
446
-	 *
447
-	 * @psalm-taint-sink sql $delete
448
-	 */
449
-	public function delete($delete = null, $alias = null);
450
-
451
-	/**
452
-	 * Turns the query being built into a bulk update query that ranges over
453
-	 * a certain table
454
-	 *
455
-	 * <code>
456
-	 *     $qb = $conn->getQueryBuilder()
457
-	 *         ->update('users')
458
-	 *         ->set('email', ':email')
459
-	 *         ->where('id = :user_id');
460
-	 *         ->setParameter(':user_id', 1);
461
-	 * </code>
462
-	 *
463
-	 * @param string $update The table whose rows are subject to the update.
464
-	 * @param string $alias The table alias used in the constructed query.
465
-	 *
466
-	 * @return $this This QueryBuilder instance.
467
-	 * @since 8.2.0
468
-	 * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update
469
-	 *
470
-	 * @psalm-taint-sink sql $update
471
-	 */
472
-	public function update($update = null, $alias = null);
473
-
474
-	/**
475
-	 * Turns the query being built into an insert query that inserts into
476
-	 * a certain table
477
-	 *
478
-	 * <code>
479
-	 *     $qb = $conn->getQueryBuilder()
480
-	 *         ->insert('users')
481
-	 *         ->values(
482
-	 *             array(
483
-	 *                 'name' => '?',
484
-	 *                 'password' => '?'
485
-	 *             )
486
-	 *         );
487
-	 * </code>
488
-	 *
489
-	 * @param string $insert The table into which the rows should be inserted.
490
-	 *
491
-	 * @return $this This QueryBuilder instance.
492
-	 * @since 8.2.0
493
-	 *
494
-	 * @psalm-taint-sink sql $insert
495
-	 */
496
-	public function insert($insert = null);
497
-
498
-	/**
499
-	 * Creates and adds a query root corresponding to the table identified by the
500
-	 * given alias, forming a cartesian product with any existing query roots.
501
-	 *
502
-	 * <code>
503
-	 *     $qb = $conn->getQueryBuilder()
504
-	 *         ->select('u.id')
505
-	 *         ->from('users', 'u')
506
-	 * </code>
507
-	 *
508
-	 * @param string|IQueryFunction $from The table.
509
-	 * @param string|null $alias The alias of the table.
510
-	 *
511
-	 * @return $this This QueryBuilder instance.
512
-	 * @since 8.2.0
513
-	 *
514
-	 * @psalm-taint-sink sql $from
515
-	 */
516
-	public function from($from, $alias = null);
517
-
518
-	/**
519
-	 * Creates and adds a join to the query.
520
-	 *
521
-	 * <code>
522
-	 *     $qb = $conn->getQueryBuilder()
523
-	 *         ->select('u.name')
524
-	 *         ->from('users', 'u')
525
-	 *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
526
-	 * </code>
527
-	 *
528
-	 * @param string $fromAlias The alias that points to a from clause.
529
-	 * @param string|IQueryFunction $join The table name to join.
530
-	 * @param string $alias The alias of the join table.
531
-	 * @param string|ICompositeExpression|null $condition The condition for the join.
532
-	 *
533
-	 * @return $this This QueryBuilder instance.
534
-	 * @since 8.2.0
535
-	 *
536
-	 * @psalm-taint-sink sql $fromAlias
537
-	 * @psalm-taint-sink sql $join
538
-	 * @psalm-taint-sink sql $alias
539
-	 * @psalm-taint-sink sql $condition
540
-	 */
541
-	public function join($fromAlias, $join, $alias, $condition = null);
542
-
543
-	/**
544
-	 * Creates and adds a join to the query.
545
-	 *
546
-	 * <code>
547
-	 *     $qb = $conn->getQueryBuilder()
548
-	 *         ->select('u.name')
549
-	 *         ->from('users', 'u')
550
-	 *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
551
-	 * </code>
552
-	 *
553
-	 * @param string $fromAlias The alias that points to a from clause.
554
-	 * @param string|IQueryFunction $join The table name to join.
555
-	 * @param string $alias The alias of the join table.
556
-	 * @param string|ICompositeExpression|null $condition The condition for the join.
557
-	 *
558
-	 * @return $this This QueryBuilder instance.
559
-	 * @since 8.2.0
560
-	 *
561
-	 * @psalm-taint-sink sql $fromAlias
562
-	 * @psalm-taint-sink sql $join
563
-	 * @psalm-taint-sink sql $alias
564
-	 * @psalm-taint-sink sql $condition
565
-	 */
566
-	public function innerJoin($fromAlias, $join, $alias, $condition = null);
567
-
568
-	/**
569
-	 * Creates and adds a left join to the query.
570
-	 *
571
-	 * <code>
572
-	 *     $qb = $conn->getQueryBuilder()
573
-	 *         ->select('u.name')
574
-	 *         ->from('users', 'u')
575
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
576
-	 * </code>
577
-	 *
578
-	 * @param string $fromAlias The alias that points to a from clause.
579
-	 * @param string|IQueryFunction $join The table name to join.
580
-	 * @param string $alias The alias of the join table.
581
-	 * @param string|ICompositeExpression|null $condition The condition for the join.
582
-	 *
583
-	 * @return $this This QueryBuilder instance.
584
-	 * @since 8.2.0
585
-	 * @since 30.0.0 Allow passing IQueryFunction as parameter for `$join` to allow join with a sub-query.
586
-	 *
587
-	 * @psalm-taint-sink sql $fromAlias
588
-	 * @psalm-taint-sink sql $join
589
-	 * @psalm-taint-sink sql $alias
590
-	 * @psalm-taint-sink sql $condition
591
-	 */
592
-	public function leftJoin($fromAlias, $join, $alias, $condition = null);
593
-
594
-	/**
595
-	 * Creates and adds a right join to the query.
596
-	 *
597
-	 * <code>
598
-	 *     $qb = $conn->getQueryBuilder()
599
-	 *         ->select('u.name')
600
-	 *         ->from('users', 'u')
601
-	 *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
602
-	 * </code>
603
-	 *
604
-	 * @param string $fromAlias The alias that points to a from clause.
605
-	 * @param string|IQueryFunction $join The table name to join.
606
-	 * @param string $alias The alias of the join table.
607
-	 * @param string|ICompositeExpression|null $condition The condition for the join.
608
-	 *
609
-	 * @return $this This QueryBuilder instance.
610
-	 * @since 8.2.0
611
-	 *
612
-	 * @psalm-taint-sink sql $fromAlias
613
-	 * @psalm-taint-sink sql $join
614
-	 * @psalm-taint-sink sql $alias
615
-	 * @psalm-taint-sink sql $condition
616
-	 */
617
-	public function rightJoin($fromAlias, $join, $alias, $condition = null);
618
-
619
-	/**
620
-	 * Sets a new value for a column in a bulk update query.
621
-	 *
622
-	 * <code>
623
-	 *     $qb = $conn->getQueryBuilder()
624
-	 *         ->update('users', 'u')
625
-	 *         ->set('u.password', md5('password'))
626
-	 *         ->where('u.id = ?');
627
-	 * </code>
628
-	 *
629
-	 * @param string $key The column to set.
630
-	 * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
631
-	 *
632
-	 * @return $this This QueryBuilder instance.
633
-	 * @since 8.2.0
634
-	 *
635
-	 * @psalm-taint-sink sql $key
636
-	 * @psalm-taint-sink sql $value
637
-	 */
638
-	public function set($key, $value);
639
-
640
-	/**
641
-	 * Specifies one or more restrictions to the query result.
642
-	 * Replaces any previously specified restrictions, if any.
643
-	 *
644
-	 * <code>
645
-	 *     $qb = $conn->getQueryBuilder()
646
-	 *         ->select('u.name')
647
-	 *         ->from('users', 'u')
648
-	 *         ->where('u.id = ?');
649
-	 *
650
-	 *     // You can optionally programmatically build and/or expressions
651
-	 *     $qb = $conn->getQueryBuilder();
652
-	 *
653
-	 *     $or = $qb->expr()->orx(
654
-	 *         $qb->expr()->eq('u.id', 1),
655
-	 *         $qb->expr()->eq('u.id', 2),
656
-	 *     );
657
-	 *
658
-	 *     $qb->update('users', 'u')
659
-	 *         ->set('u.password', md5('password'))
660
-	 *         ->where($or);
661
-	 * </code>
662
-	 *
663
-	 * @param mixed $predicates The restriction predicates.
664
-	 *
665
-	 * @return $this This QueryBuilder instance.
666
-	 * @since 8.2.0
667
-	 *
668
-	 * @psalm-taint-sink sql $predicates
669
-	 */
670
-	public function where(...$predicates);
671
-
672
-	/**
673
-	 * Adds one or more restrictions to the query results, forming a logical
674
-	 * conjunction with any previously specified restrictions.
675
-	 *
676
-	 * <code>
677
-	 *     $qb = $conn->getQueryBuilder()
678
-	 *         ->select('u')
679
-	 *         ->from('users', 'u')
680
-	 *         ->where('u.username LIKE ?')
681
-	 *         ->andWhere('u.is_active = 1');
682
-	 * </code>
683
-	 *
684
-	 * @param mixed ...$where The query restrictions.
685
-	 *
686
-	 * @return $this This QueryBuilder instance.
687
-	 *
688
-	 * @see where()
689
-	 * @since 8.2.0
690
-	 *
691
-	 * @psalm-taint-sink sql $where
692
-	 */
693
-	public function andWhere(...$where);
694
-
695
-	/**
696
-	 * Adds one or more restrictions to the query results, forming a logical
697
-	 * disjunction with any previously specified restrictions.
698
-	 *
699
-	 * <code>
700
-	 *     $qb = $conn->getQueryBuilder()
701
-	 *         ->select('u.name')
702
-	 *         ->from('users', 'u')
703
-	 *         ->where('u.id = 1')
704
-	 *         ->orWhere('u.id = 2');
705
-	 * </code>
706
-	 *
707
-	 * @param mixed ...$where The WHERE statement.
708
-	 *
709
-	 * @return $this This QueryBuilder instance.
710
-	 *
711
-	 * @see where()
712
-	 * @since 8.2.0
713
-	 *
714
-	 * @psalm-taint-sink sql $where
715
-	 */
716
-	public function orWhere(...$where);
717
-
718
-	/**
719
-	 * Specifies a grouping over the results of the query.
720
-	 * Replaces any previously specified groupings, if any.
721
-	 *
722
-	 * <code>
723
-	 *     $qb = $conn->getQueryBuilder()
724
-	 *         ->select('u.name')
725
-	 *         ->from('users', 'u')
726
-	 *         ->groupBy('u.id');
727
-	 * </code>
728
-	 *
729
-	 * @param mixed ...$groupBys The grouping expression.
730
-	 *
731
-	 * @return $this This QueryBuilder instance.
732
-	 * @since 8.2.0
733
-	 *
734
-	 * @psalm-taint-sink sql $groupBys
735
-	 */
736
-	public function groupBy(...$groupBys);
737
-
738
-	/**
739
-	 * Adds a grouping expression to the query.
740
-	 *
741
-	 * <code>
742
-	 *     $qb = $conn->getQueryBuilder()
743
-	 *         ->select('u.name')
744
-	 *         ->from('users', 'u')
745
-	 *         ->groupBy('u.lastLogin');
746
-	 *         ->addGroupBy('u.createdAt')
747
-	 * </code>
748
-	 *
749
-	 * @param mixed ...$groupBy The grouping expression.
750
-	 *
751
-	 * @return $this This QueryBuilder instance.
752
-	 * @since 8.2.0
753
-	 *
754
-	 * @psalm-taint-sink sql $groupby
755
-	 */
756
-	public function addGroupBy(...$groupBy);
757
-
758
-	/**
759
-	 * Sets a value for a column in an insert query.
760
-	 *
761
-	 * <code>
762
-	 *     $qb = $conn->getQueryBuilder()
763
-	 *         ->insert('users')
764
-	 *         ->values(
765
-	 *             array(
766
-	 *                 'name' => '?'
767
-	 *             )
768
-	 *         )
769
-	 *         ->setValue('password', '?');
770
-	 * </code>
771
-	 *
772
-	 * @param string $column The column into which the value should be inserted.
773
-	 * @param IParameter|string $value The value that should be inserted into the column.
774
-	 *
775
-	 * @return $this This QueryBuilder instance.
776
-	 * @since 8.2.0
777
-	 *
778
-	 * @psalm-taint-sink sql $column
779
-	 * @psalm-taint-sink sql $value
780
-	 */
781
-	public function setValue($column, $value);
782
-
783
-	/**
784
-	 * Specifies values for an insert query indexed by column names.
785
-	 * Replaces any previous values, if any.
786
-	 *
787
-	 * <code>
788
-	 *     $qb = $conn->getQueryBuilder()
789
-	 *         ->insert('users')
790
-	 *         ->values(
791
-	 *             array(
792
-	 *                 'name' => '?',
793
-	 *                 'password' => '?'
794
-	 *             )
795
-	 *         );
796
-	 * </code>
797
-	 *
798
-	 * @param array $values The values to specify for the insert query indexed by column names.
799
-	 *
800
-	 * @return $this This QueryBuilder instance.
801
-	 * @since 8.2.0
802
-	 *
803
-	 * @psalm-taint-sink sql $values
804
-	 */
805
-	public function values(array $values);
806
-
807
-	/**
808
-	 * Specifies a restriction over the groups of the query.
809
-	 * Replaces any previous having restrictions, if any.
810
-	 *
811
-	 * @param mixed ...$having The restriction over the groups.
812
-	 *
813
-	 * @return $this This QueryBuilder instance.
814
-	 * @since 8.2.0
815
-	 *
816
-	 * @psalm-taint-sink sql $having
817
-	 */
818
-	public function having(...$having);
819
-
820
-	/**
821
-	 * Adds a restriction over the groups of the query, forming a logical
822
-	 * conjunction with any existing having restrictions.
823
-	 *
824
-	 * @param mixed ...$having The restriction to append.
825
-	 *
826
-	 * @return $this This QueryBuilder instance.
827
-	 * @since 8.2.0
828
-	 *
829
-	 * @psalm-taint-sink sql $andHaving
830
-	 */
831
-	public function andHaving(...$having);
832
-
833
-	/**
834
-	 * Adds a restriction over the groups of the query, forming a logical
835
-	 * disjunction with any existing having restrictions.
836
-	 *
837
-	 * @param mixed ...$having The restriction to add.
838
-	 *
839
-	 * @return $this This QueryBuilder instance.
840
-	 * @since 8.2.0
841
-	 *
842
-	 * @psalm-taint-sink sql $having
843
-	 */
844
-	public function orHaving(...$having);
845
-
846
-	/**
847
-	 * Specifies an ordering for the query results.
848
-	 * Replaces any previously specified orderings, if any.
849
-	 *
850
-	 * @param string|IQueryFunction|ILiteral|IParameter $sort The ordering expression.
851
-	 * @param string $order The ordering direction.
852
-	 *
853
-	 * @return $this This QueryBuilder instance.
854
-	 * @since 8.2.0
855
-	 *
856
-	 * @psalm-taint-sink sql $sort
857
-	 * @psalm-taint-sink sql $order
858
-	 */
859
-	public function orderBy($sort, $order = null);
860
-
861
-	/**
862
-	 * Adds an ordering to the query results.
863
-	 *
864
-	 * @param string|ILiteral|IParameter|IQueryFunction $sort The ordering expression.
865
-	 * @param string $order The ordering direction.
866
-	 *
867
-	 * @return $this This QueryBuilder instance.
868
-	 * @since 8.2.0
869
-	 *
870
-	 * @psalm-taint-sink sql $sort
871
-	 * @psalm-taint-sink sql $order
872
-	 */
873
-	public function addOrderBy($sort, $order = null);
874
-
875
-	/**
876
-	 * Gets a query part by its name.
877
-	 *
878
-	 * @param string $queryPartName
879
-	 *
880
-	 * @return mixed
881
-	 * @since 8.2.0
882
-	 * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
883
-	 *  and we can not fix this in our wrapper. Please track the details you need, outside the object.
884
-	 */
885
-	public function getQueryPart($queryPartName);
886
-
887
-	/**
888
-	 * Gets all query parts.
889
-	 *
890
-	 * @return array
891
-	 * @since 8.2.0
892
-	 * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
893
-	 *  and we can not fix this in our wrapper. Please track the details you need, outside the object.
894
-	 */
895
-	public function getQueryParts();
896
-
897
-	/**
898
-	 * Resets SQL parts.
899
-	 *
900
-	 * @param array|null $queryPartNames
901
-	 *
902
-	 * @return $this This QueryBuilder instance.
903
-	 * @since 8.2.0
904
-	 * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
905
-	 * and we can not fix this in our wrapper. Please create a new IQueryBuilder instead.
906
-	 */
907
-	public function resetQueryParts($queryPartNames = null);
908
-
909
-	/**
910
-	 * Resets a single SQL part.
911
-	 *
912
-	 * @param string $queryPartName
913
-	 *
914
-	 * @return $this This QueryBuilder instance.
915
-	 * @since 8.2.0
916
-	 * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
917
-	 *  and we can not fix this in our wrapper. Please create a new IQueryBuilder instead.
918
-	 */
919
-	public function resetQueryPart($queryPartName);
920
-
921
-	/**
922
-	 * Creates a new named parameter and bind the value $value to it.
923
-	 *
924
-	 * This method provides a shortcut for PDOStatement::bindValue
925
-	 * when using prepared statements.
926
-	 *
927
-	 * The parameter $value specifies the value that you want to bind. If
928
-	 * $placeholder is not provided bindValue() will automatically create a
929
-	 * placeholder for you. An automatic placeholder will be of the name
930
-	 * ':dcValue1', ':dcValue2' etc.
931
-	 *
932
-	 * For more information see {@link https://www.php.net/pdostatement-bindparam}
933
-	 *
934
-	 * Example:
935
-	 * <code>
936
-	 * $value = 2;
937
-	 * $q->eq( 'id', $q->bindValue( $value ) );
938
-	 * $stmt = $q->executeQuery(); // executed with 'id = 2'
939
-	 * </code>
940
-	 *
941
-	 * @license New BSD License
942
-	 * @link http://www.zetacomponents.org
943
-	 *
944
-	 * @param mixed $value
945
-	 * @param self::PARAM_* $type
946
-	 * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
947
-	 *
948
-	 * @return IParameter
949
-	 * @since 8.2.0
950
-	 *
951
-	 * @psalm-taint-escape sql
952
-	 */
953
-	public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
954
-
955
-	/**
956
-	 * Creates a new positional parameter and bind the given value to it.
957
-	 *
958
-	 * Attention: If you are using positional parameters with the query builder you have
959
-	 * to be very careful to bind all parameters in the order they appear in the SQL
960
-	 * statement , otherwise they get bound in the wrong order which can lead to serious
961
-	 * bugs in your code.
962
-	 *
963
-	 * Example:
964
-	 * <code>
965
-	 *  $qb = $conn->getQueryBuilder();
966
-	 *  $qb->select('u.*')
967
-	 *     ->from('users', 'u')
968
-	 *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
969
-	 *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
970
-	 * </code>
971
-	 *
972
-	 * @param mixed $value
973
-	 * @param self::PARAM_* $type
974
-	 *
975
-	 * @return IParameter
976
-	 * @since 8.2.0
977
-	 *
978
-	 * @psalm-taint-escape sql
979
-	 */
980
-	public function createPositionalParameter($value, $type = self::PARAM_STR);
981
-
982
-	/**
983
-	 * Creates a new parameter
984
-	 *
985
-	 * Example:
986
-	 * <code>
987
-	 *  $qb = $conn->getQueryBuilder();
988
-	 *  $qb->select('u.*')
989
-	 *     ->from('users', 'u')
990
-	 *     ->where('u.username = ' . $qb->createParameter('name'))
991
-	 *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
992
-	 * </code>
993
-	 *
994
-	 * @param string $name
995
-	 *
996
-	 * @return IParameter
997
-	 * @since 8.2.0
998
-	 *
999
-	 * @psalm-taint-escape sql
1000
-	 */
1001
-	public function createParameter($name);
1002
-
1003
-	/**
1004
-	 * Creates a new function
1005
-	 *
1006
-	 * Attention: Column names inside the call have to be quoted before hand
1007
-	 *
1008
-	 * Example:
1009
-	 * <code>
1010
-	 *  $qb = $conn->getQueryBuilder();
1011
-	 *  $qb->select($qb->createFunction('COUNT(*)'))
1012
-	 *     ->from('users', 'u')
1013
-	 *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
1014
-	 * </code>
1015
-	 * <code>
1016
-	 *  $qb = $conn->getQueryBuilder();
1017
-	 *  $qb->select($qb->createFunction('COUNT(`column`)'))
1018
-	 *     ->from('users', 'u')
1019
-	 *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
1020
-	 * </code>
1021
-	 *
1022
-	 * @param string $call
1023
-	 *
1024
-	 * @return IQueryFunction
1025
-	 * @since 8.2.0
1026
-	 *
1027
-	 * @psalm-taint-sink sql $call
1028
-	 */
1029
-	public function createFunction($call);
1030
-
1031
-	/**
1032
-	 * Used to get the id of the last inserted element
1033
-	 * @return int
1034
-	 * @throws \BadMethodCallException When being called before an insert query has been run.
1035
-	 * @since 9.0.0
1036
-	 */
1037
-	public function getLastInsertId(): int;
1038
-
1039
-	/**
1040
-	 * Returns the table name quoted and with database prefix as needed by the implementation.
1041
-	 * If a query function is passed the function is casted to string,
1042
-	 * this allows passing functions as sub-queries for join expression.
1043
-	 *
1044
-	 * @param string|IQueryFunction $table
1045
-	 * @return string
1046
-	 * @since 9.0.0
1047
-	 * @since 24.0.0 accepts IQueryFunction as parameter
1048
-	 */
1049
-	public function getTableName($table);
1050
-
1051
-	/**
1052
-	 * Returns the table name with database prefix as needed by the implementation
1053
-	 *
1054
-	 * @param string $table
1055
-	 * @return string
1056
-	 * @since 30.0.0
1057
-	 */
1058
-	public function prefixTableName(string $table): string;
1059
-
1060
-	/**
1061
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
1062
-	 *
1063
-	 * @param string $column
1064
-	 * @param string $tableAlias
1065
-	 * @return string
1066
-	 * @since 9.0.0
1067
-	 */
1068
-	public function getColumnName($column, $tableAlias = '');
1069
-
1070
-	/**
1071
-	 * Provide a hint for the shard key for queries where this can't be detected otherwise
1072
-	 *
1073
-	 * @param string $column
1074
-	 * @param mixed $value
1075
-	 * @return $this
1076
-	 * @since 30.0.0
1077
-	 */
1078
-	public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self;
1079
-
1080
-	/**
1081
-	 * Set the query to run across all shards if sharding is enabled.
1082
-	 *
1083
-	 * @return $this
1084
-	 * @since 30.0.0
1085
-	 */
1086
-	public function runAcrossAllShards(): self;
1087
-
1088
-	/**
1089
-	 * Get a list of column names that are expected in the query output
1090
-	 *
1091
-	 * @return array
1092
-	 * @since 30.0.0
1093
-	 */
1094
-	public function getOutputColumns(): array;
25
+    /**
26
+     * @since 9.0.0
27
+     */
28
+    public const PARAM_NULL = ParameterType::NULL;
29
+    /**
30
+     * @since 9.0.0
31
+     */
32
+    public const PARAM_BOOL = Types::BOOLEAN;
33
+    /**
34
+     * @since 9.0.0
35
+     */
36
+    public const PARAM_INT = ParameterType::INTEGER;
37
+    /**
38
+     * @since 9.0.0
39
+     */
40
+    public const PARAM_STR = ParameterType::STRING;
41
+    /**
42
+     * @since 9.0.0
43
+     */
44
+    public const PARAM_LOB = ParameterType::LARGE_OBJECT;
45
+
46
+    /**
47
+     * @since 9.0.0
48
+     * @deprecated 31.0.0 - use PARAM_DATETIME_MUTABLE instead
49
+     */
50
+    public const PARAM_DATE = Types::DATETIME_MUTABLE;
51
+
52
+    /**
53
+     * For passing a \DateTime instance when only interested in the time part (without timezone support)
54
+     * @since 31.0.0
55
+     */
56
+    public const PARAM_TIME_MUTABLE = Types::TIME_MUTABLE;
57
+
58
+    /**
59
+     * For passing a \DateTime instance when only interested in the date part (without timezone support)
60
+     * @since 31.0.0
61
+     */
62
+    public const PARAM_DATE_MUTABLE = Types::DATE_MUTABLE;
63
+
64
+    /**
65
+     * For passing a \DateTime instance (without timezone support)
66
+     * @since 31.0.0
67
+     */
68
+    public const PARAM_DATETIME_MUTABLE = Types::DATETIME_MUTABLE;
69
+
70
+    /**
71
+     * For passing a \DateTime instance with timezone support
72
+     * @since 31.0.0
73
+     */
74
+    public const PARAM_DATETIME_TZ_MUTABLE = Types::DATETIMETZ_MUTABLE;
75
+
76
+    /**
77
+     * For passing a \DateTimeImmutable instance when only interested in the time part (without timezone support)
78
+     * @since 31.0.0
79
+     */
80
+    public const PARAM_TIME_IMMUTABLE = Types::TIME_MUTABLE;
81
+
82
+    /**
83
+     * For passing a \DateTime instance when only interested in the date part (without timezone support)
84
+     * @since 9.0.0
85
+     */
86
+    public const PARAM_DATE_IMMUTABLE = Types::DATE_IMMUTABLE;
87
+
88
+    /**
89
+     * For passing a \DateTime instance (without timezone support)
90
+     * @since 31.0.0
91
+     */
92
+    public const PARAM_DATETIME_IMMUTABLE = Types::DATETIME_IMMUTABLE;
93
+
94
+    /**
95
+     * For passing a \DateTime instance with timezone support
96
+     * @since 31.0.0
97
+     */
98
+    public const PARAM_DATETIME_TZ_IMMUTABLE = Types::DATETIMETZ_IMMUTABLE;
99
+
100
+    /**
101
+     * @since 24.0.0
102
+     * @deprecated 33.0.0 JSON fields can not properly be used in WHERE statements of Oracle and MySQL.
103
+     *                    It is recommended to use a simple STRING field and handle JSON within PHP
104
+     */
105
+    public const PARAM_JSON = 'json';
106
+
107
+    /**
108
+     * @since 9.0.0
109
+     */
110
+    public const PARAM_INT_ARRAY = ArrayParameterType::INTEGER;
111
+    /**
112
+     * @since 9.0.0
113
+     */
114
+    public const PARAM_STR_ARRAY = ArrayParameterType::STRING;
115
+
116
+    /**
117
+     * @since 24.0.0 Indicates how many rows can be deleted at once with MySQL
118
+     * database server.
119
+     */
120
+    public const MAX_ROW_DELETION = 100000;
121
+
122
+    /**
123
+     * Enable/disable automatic prefixing of table names with the oc_ prefix
124
+     *
125
+     * @param bool $enabled If set to true table names will be prefixed with the
126
+     *                      owncloud database prefix automatically.
127
+     * @since 8.2.0
128
+     */
129
+    public function automaticTablePrefix($enabled);
130
+
131
+    /**
132
+     * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
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->expr()->eq('u.id', 1));
140
+     * </code>
141
+     *
142
+     * For more complex expression construction, consider storing the expression
143
+     * builder object in a local variable.
144
+     *
145
+     * @return \OCP\DB\QueryBuilder\IExpressionBuilder
146
+     * @since 8.2.0
147
+     */
148
+    public function expr();
149
+
150
+    /**
151
+     * Gets an FunctionBuilder used for object-oriented construction of query functions.
152
+     * This producer method is intended for convenient inline usage. Example:
153
+     *
154
+     * <code>
155
+     *     $qb = $conn->getQueryBuilder()
156
+     *         ->select('u')
157
+     *         ->from('users', 'u')
158
+     *         ->where($qb->fun()->md5('u.id'));
159
+     * </code>
160
+     *
161
+     * For more complex function construction, consider storing the function
162
+     * builder object in a local variable.
163
+     *
164
+     * @return \OCP\DB\QueryBuilder\IFunctionBuilder
165
+     * @since 12.0.0
166
+     */
167
+    public function func();
168
+
169
+    /**
170
+     * Gets the type of the currently built query.
171
+     *
172
+     * @return integer
173
+     * @since 8.2.0
174
+     */
175
+    public function getType();
176
+
177
+    /**
178
+     * Gets the associated DBAL Connection for this query builder.
179
+     *
180
+     * @return \OCP\IDBConnection
181
+     * @since 8.2.0
182
+     */
183
+    public function getConnection();
184
+
185
+    /**
186
+     * Gets the state of this query builder instance.
187
+     *
188
+     * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
189
+     * @since 8.2.0
190
+     * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
191
+     *    and we can not fix this in our wrapper.
192
+     */
193
+    public function getState();
194
+
195
+    /**
196
+     * Execute for select statements
197
+     *
198
+     * @param ?IDBConnection $connection (optional) the connection to run the query against. since 30.0
199
+     * @return IResult
200
+     * @since 22.0.0
201
+     *
202
+     * @throws Exception
203
+     * @throws \RuntimeException in case of usage with non select query
204
+     */
205
+    public function executeQuery(?IDBConnection $connection = null): IResult;
206
+
207
+    /**
208
+     * Execute insert, update and delete statements
209
+     *
210
+     * @param ?IDBConnection $connection (optional) the connection to run the query against. since 30.0
211
+     * @return int the number of affected rows
212
+     * @since 22.0.0
213
+     *
214
+     * @throws Exception
215
+     * @throws \RuntimeException in case of usage with select query
216
+     */
217
+    public function executeStatement(?IDBConnection $connection = null): int;
218
+
219
+    /**
220
+     * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
221
+     *
222
+     * <code>
223
+     *     $qb = $conn->getQueryBuilder()
224
+     *         ->select('u')
225
+     *         ->from('User', 'u')
226
+     *     echo $qb->getSQL(); // SELECT u FROM User u
227
+     * </code>
228
+     *
229
+     * @return string The SQL query string.
230
+     * @since 8.2.0
231
+     */
232
+    public function getSQL();
233
+
234
+    /**
235
+     * Sets a query parameter for the query being constructed.
236
+     *
237
+     * <code>
238
+     *     $qb = $conn->getQueryBuilder()
239
+     *         ->select('u')
240
+     *         ->from('users', 'u')
241
+     *         ->where('u.id = :user_id')
242
+     *         ->setParameter(':user_id', 1);
243
+     * </code>
244
+     *
245
+     * @param string|integer $key The parameter position or name.
246
+     * @param mixed $value The parameter value.
247
+     * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
248
+     *
249
+     * @return $this This QueryBuilder instance.
250
+     * @since 8.2.0
251
+     */
252
+    public function setParameter($key, $value, $type = null);
253
+
254
+    /**
255
+     * Sets a collection of query parameters for the query being constructed.
256
+     *
257
+     * <code>
258
+     *     $qb = $conn->getQueryBuilder()
259
+     *         ->select('u')
260
+     *         ->from('users', 'u')
261
+     *         ->where('u.id = :user_id1 OR u.id = :user_id2')
262
+     *         ->setParameters(array(
263
+     *             ':user_id1' => 1,
264
+     *             ':user_id2' => 2
265
+     *         ));
266
+     * </code>
267
+     *
268
+     * @param array $params The query parameters to set.
269
+     * @param array $types The query parameters types to set.
270
+     *
271
+     * @return $this This QueryBuilder instance.
272
+     * @since 8.2.0
273
+     */
274
+    public function setParameters(array $params, array $types = []);
275
+
276
+    /**
277
+     * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
278
+     *
279
+     * @return array The currently defined query parameters indexed by parameter index or name.
280
+     * @since 8.2.0
281
+     */
282
+    public function getParameters();
283
+
284
+    /**
285
+     * Gets a (previously set) query parameter of the query being constructed.
286
+     *
287
+     * @param mixed $key The key (index or name) of the bound parameter.
288
+     *
289
+     * @return mixed The value of the bound parameter.
290
+     * @since 8.2.0
291
+     */
292
+    public function getParameter($key);
293
+
294
+    /**
295
+     * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
296
+     *
297
+     * @return array The currently defined query parameter types indexed by parameter index or name.
298
+     * @since 8.2.0
299
+     */
300
+    public function getParameterTypes();
301
+
302
+    /**
303
+     * Gets a (previously set) query parameter type of the query being constructed.
304
+     *
305
+     * @param mixed $key The key (index or name) of the bound parameter type.
306
+     *
307
+     * @return mixed The value of the bound parameter type.
308
+     * @since 8.2.0
309
+     */
310
+    public function getParameterType($key);
311
+
312
+    /**
313
+     * Sets the position of the first result to retrieve (the "offset").
314
+     *
315
+     * @param int $firstResult The first result to return.
316
+     *
317
+     * @return $this This QueryBuilder instance.
318
+     * @since 8.2.0
319
+     */
320
+    public function setFirstResult($firstResult);
321
+
322
+    /**
323
+     * Gets the position of the first result the query object was set to retrieve (the "offset").
324
+     * Returns 0 if {@link setFirstResult} was not applied to this QueryBuilder.
325
+     *
326
+     * @return int The position of the first result.
327
+     * @since 8.2.0
328
+     */
329
+    public function getFirstResult();
330
+
331
+    /**
332
+     * Sets the maximum number of results to retrieve (the "limit").
333
+     *
334
+     * @param int|null $maxResults The maximum number of results to retrieve.
335
+     *
336
+     * @return $this This QueryBuilder instance.
337
+     * @since 8.2.0
338
+     */
339
+    public function setMaxResults($maxResults);
340
+
341
+    /**
342
+     * Gets the maximum number of results the query object was set to retrieve (the "limit").
343
+     * Returns NULL if {@link setMaxResults} was not applied to this query builder.
344
+     *
345
+     * @return int|null The maximum number of results.
346
+     * @since 8.2.0
347
+     */
348
+    public function getMaxResults();
349
+
350
+    /**
351
+     * Specifies an item that is to be returned in the query result.
352
+     * Replaces any previously specified selections, if any.
353
+     *
354
+     * <code>
355
+     *     $qb = $conn->getQueryBuilder()
356
+     *         ->select('u.id', 'p.id')
357
+     *         ->from('users', 'u')
358
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
359
+     * </code>
360
+     *
361
+     * @param mixed ...$selects The selection expressions.
362
+     *
363
+     * @return $this This QueryBuilder instance.
364
+     * @since 8.2.0
365
+     *
366
+     * @psalm-taint-sink sql $selects
367
+     */
368
+    public function select(...$selects);
369
+
370
+    /**
371
+     * Specifies an item that is to be returned with a different name in the query result.
372
+     *
373
+     * <code>
374
+     *     $qb = $conn->getQueryBuilder()
375
+     *         ->selectAlias('u.id', 'user_id')
376
+     *         ->from('users', 'u')
377
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
378
+     * </code>
379
+     *
380
+     * @param mixed $select The selection expressions.
381
+     * @param string $alias The column alias used in the constructed query.
382
+     *
383
+     * @return $this This QueryBuilder instance.
384
+     * @since 8.2.1
385
+     *
386
+     * @psalm-taint-sink sql $select
387
+     * @psalm-taint-sink sql $alias
388
+     */
389
+    public function selectAlias($select, $alias);
390
+
391
+    /**
392
+     * Specifies an item that is to be returned uniquely in the query result.
393
+     *
394
+     * <code>
395
+     *     $qb = $conn->getQueryBuilder()
396
+     *         ->selectDistinct('type')
397
+     *         ->from('users');
398
+     * </code>
399
+     *
400
+     * @param mixed $select The selection expressions.
401
+     *
402
+     * @return $this This QueryBuilder instance.
403
+     * @since 9.0.0
404
+     *
405
+     * @psalm-taint-sink sql $select
406
+     */
407
+    public function selectDistinct($select);
408
+
409
+    /**
410
+     * Adds an item that is to be returned in the query result.
411
+     *
412
+     * <code>
413
+     *     $qb = $conn->getQueryBuilder()
414
+     *         ->select('u.id')
415
+     *         ->addSelect('p.id')
416
+     *         ->from('users', 'u')
417
+     *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
418
+     * </code>
419
+     *
420
+     * @param mixed ...$select The selection expression.
421
+     *
422
+     * @return $this This QueryBuilder instance.
423
+     * @since 8.2.0
424
+     *
425
+     * @psalm-taint-sink sql $select
426
+     */
427
+    public function addSelect(...$select);
428
+
429
+    /**
430
+     * Turns the query being built into a bulk delete query that ranges over
431
+     * a certain table.
432
+     *
433
+     * <code>
434
+     *     $qb = $conn->getQueryBuilder()
435
+     *         ->delete('users')
436
+     *         ->where('id = :user_id');
437
+     *         ->setParameter(':user_id', 1);
438
+     * </code>
439
+     *
440
+     * @param string $delete The table whose rows are subject to the deletion.
441
+     * @param string $alias The table alias used in the constructed query.
442
+     *
443
+     * @return $this This QueryBuilder instance.
444
+     * @since 8.2.0
445
+     * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update
446
+     *
447
+     * @psalm-taint-sink sql $delete
448
+     */
449
+    public function delete($delete = null, $alias = null);
450
+
451
+    /**
452
+     * Turns the query being built into a bulk update query that ranges over
453
+     * a certain table
454
+     *
455
+     * <code>
456
+     *     $qb = $conn->getQueryBuilder()
457
+     *         ->update('users')
458
+     *         ->set('email', ':email')
459
+     *         ->where('id = :user_id');
460
+     *         ->setParameter(':user_id', 1);
461
+     * </code>
462
+     *
463
+     * @param string $update The table whose rows are subject to the update.
464
+     * @param string $alias The table alias used in the constructed query.
465
+     *
466
+     * @return $this This QueryBuilder instance.
467
+     * @since 8.2.0
468
+     * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update
469
+     *
470
+     * @psalm-taint-sink sql $update
471
+     */
472
+    public function update($update = null, $alias = null);
473
+
474
+    /**
475
+     * Turns the query being built into an insert query that inserts into
476
+     * a certain table
477
+     *
478
+     * <code>
479
+     *     $qb = $conn->getQueryBuilder()
480
+     *         ->insert('users')
481
+     *         ->values(
482
+     *             array(
483
+     *                 'name' => '?',
484
+     *                 'password' => '?'
485
+     *             )
486
+     *         );
487
+     * </code>
488
+     *
489
+     * @param string $insert The table into which the rows should be inserted.
490
+     *
491
+     * @return $this This QueryBuilder instance.
492
+     * @since 8.2.0
493
+     *
494
+     * @psalm-taint-sink sql $insert
495
+     */
496
+    public function insert($insert = null);
497
+
498
+    /**
499
+     * Creates and adds a query root corresponding to the table identified by the
500
+     * given alias, forming a cartesian product with any existing query roots.
501
+     *
502
+     * <code>
503
+     *     $qb = $conn->getQueryBuilder()
504
+     *         ->select('u.id')
505
+     *         ->from('users', 'u')
506
+     * </code>
507
+     *
508
+     * @param string|IQueryFunction $from The table.
509
+     * @param string|null $alias The alias of the table.
510
+     *
511
+     * @return $this This QueryBuilder instance.
512
+     * @since 8.2.0
513
+     *
514
+     * @psalm-taint-sink sql $from
515
+     */
516
+    public function from($from, $alias = null);
517
+
518
+    /**
519
+     * Creates and adds a join to the query.
520
+     *
521
+     * <code>
522
+     *     $qb = $conn->getQueryBuilder()
523
+     *         ->select('u.name')
524
+     *         ->from('users', 'u')
525
+     *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
526
+     * </code>
527
+     *
528
+     * @param string $fromAlias The alias that points to a from clause.
529
+     * @param string|IQueryFunction $join The table name to join.
530
+     * @param string $alias The alias of the join table.
531
+     * @param string|ICompositeExpression|null $condition The condition for the join.
532
+     *
533
+     * @return $this This QueryBuilder instance.
534
+     * @since 8.2.0
535
+     *
536
+     * @psalm-taint-sink sql $fromAlias
537
+     * @psalm-taint-sink sql $join
538
+     * @psalm-taint-sink sql $alias
539
+     * @psalm-taint-sink sql $condition
540
+     */
541
+    public function join($fromAlias, $join, $alias, $condition = null);
542
+
543
+    /**
544
+     * Creates and adds a join to the query.
545
+     *
546
+     * <code>
547
+     *     $qb = $conn->getQueryBuilder()
548
+     *         ->select('u.name')
549
+     *         ->from('users', 'u')
550
+     *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
551
+     * </code>
552
+     *
553
+     * @param string $fromAlias The alias that points to a from clause.
554
+     * @param string|IQueryFunction $join The table name to join.
555
+     * @param string $alias The alias of the join table.
556
+     * @param string|ICompositeExpression|null $condition The condition for the join.
557
+     *
558
+     * @return $this This QueryBuilder instance.
559
+     * @since 8.2.0
560
+     *
561
+     * @psalm-taint-sink sql $fromAlias
562
+     * @psalm-taint-sink sql $join
563
+     * @psalm-taint-sink sql $alias
564
+     * @psalm-taint-sink sql $condition
565
+     */
566
+    public function innerJoin($fromAlias, $join, $alias, $condition = null);
567
+
568
+    /**
569
+     * Creates and adds a left join to the query.
570
+     *
571
+     * <code>
572
+     *     $qb = $conn->getQueryBuilder()
573
+     *         ->select('u.name')
574
+     *         ->from('users', 'u')
575
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
576
+     * </code>
577
+     *
578
+     * @param string $fromAlias The alias that points to a from clause.
579
+     * @param string|IQueryFunction $join The table name to join.
580
+     * @param string $alias The alias of the join table.
581
+     * @param string|ICompositeExpression|null $condition The condition for the join.
582
+     *
583
+     * @return $this This QueryBuilder instance.
584
+     * @since 8.2.0
585
+     * @since 30.0.0 Allow passing IQueryFunction as parameter for `$join` to allow join with a sub-query.
586
+     *
587
+     * @psalm-taint-sink sql $fromAlias
588
+     * @psalm-taint-sink sql $join
589
+     * @psalm-taint-sink sql $alias
590
+     * @psalm-taint-sink sql $condition
591
+     */
592
+    public function leftJoin($fromAlias, $join, $alias, $condition = null);
593
+
594
+    /**
595
+     * Creates and adds a right join to the query.
596
+     *
597
+     * <code>
598
+     *     $qb = $conn->getQueryBuilder()
599
+     *         ->select('u.name')
600
+     *         ->from('users', 'u')
601
+     *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
602
+     * </code>
603
+     *
604
+     * @param string $fromAlias The alias that points to a from clause.
605
+     * @param string|IQueryFunction $join The table name to join.
606
+     * @param string $alias The alias of the join table.
607
+     * @param string|ICompositeExpression|null $condition The condition for the join.
608
+     *
609
+     * @return $this This QueryBuilder instance.
610
+     * @since 8.2.0
611
+     *
612
+     * @psalm-taint-sink sql $fromAlias
613
+     * @psalm-taint-sink sql $join
614
+     * @psalm-taint-sink sql $alias
615
+     * @psalm-taint-sink sql $condition
616
+     */
617
+    public function rightJoin($fromAlias, $join, $alias, $condition = null);
618
+
619
+    /**
620
+     * Sets a new value for a column in a bulk update query.
621
+     *
622
+     * <code>
623
+     *     $qb = $conn->getQueryBuilder()
624
+     *         ->update('users', 'u')
625
+     *         ->set('u.password', md5('password'))
626
+     *         ->where('u.id = ?');
627
+     * </code>
628
+     *
629
+     * @param string $key The column to set.
630
+     * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
631
+     *
632
+     * @return $this This QueryBuilder instance.
633
+     * @since 8.2.0
634
+     *
635
+     * @psalm-taint-sink sql $key
636
+     * @psalm-taint-sink sql $value
637
+     */
638
+    public function set($key, $value);
639
+
640
+    /**
641
+     * Specifies one or more restrictions to the query result.
642
+     * Replaces any previously specified restrictions, if any.
643
+     *
644
+     * <code>
645
+     *     $qb = $conn->getQueryBuilder()
646
+     *         ->select('u.name')
647
+     *         ->from('users', 'u')
648
+     *         ->where('u.id = ?');
649
+     *
650
+     *     // You can optionally programmatically build and/or expressions
651
+     *     $qb = $conn->getQueryBuilder();
652
+     *
653
+     *     $or = $qb->expr()->orx(
654
+     *         $qb->expr()->eq('u.id', 1),
655
+     *         $qb->expr()->eq('u.id', 2),
656
+     *     );
657
+     *
658
+     *     $qb->update('users', 'u')
659
+     *         ->set('u.password', md5('password'))
660
+     *         ->where($or);
661
+     * </code>
662
+     *
663
+     * @param mixed $predicates The restriction predicates.
664
+     *
665
+     * @return $this This QueryBuilder instance.
666
+     * @since 8.2.0
667
+     *
668
+     * @psalm-taint-sink sql $predicates
669
+     */
670
+    public function where(...$predicates);
671
+
672
+    /**
673
+     * Adds one or more restrictions to the query results, forming a logical
674
+     * conjunction with any previously specified restrictions.
675
+     *
676
+     * <code>
677
+     *     $qb = $conn->getQueryBuilder()
678
+     *         ->select('u')
679
+     *         ->from('users', 'u')
680
+     *         ->where('u.username LIKE ?')
681
+     *         ->andWhere('u.is_active = 1');
682
+     * </code>
683
+     *
684
+     * @param mixed ...$where The query restrictions.
685
+     *
686
+     * @return $this This QueryBuilder instance.
687
+     *
688
+     * @see where()
689
+     * @since 8.2.0
690
+     *
691
+     * @psalm-taint-sink sql $where
692
+     */
693
+    public function andWhere(...$where);
694
+
695
+    /**
696
+     * Adds one or more restrictions to the query results, forming a logical
697
+     * disjunction with any previously specified restrictions.
698
+     *
699
+     * <code>
700
+     *     $qb = $conn->getQueryBuilder()
701
+     *         ->select('u.name')
702
+     *         ->from('users', 'u')
703
+     *         ->where('u.id = 1')
704
+     *         ->orWhere('u.id = 2');
705
+     * </code>
706
+     *
707
+     * @param mixed ...$where The WHERE statement.
708
+     *
709
+     * @return $this This QueryBuilder instance.
710
+     *
711
+     * @see where()
712
+     * @since 8.2.0
713
+     *
714
+     * @psalm-taint-sink sql $where
715
+     */
716
+    public function orWhere(...$where);
717
+
718
+    /**
719
+     * Specifies a grouping over the results of the query.
720
+     * Replaces any previously specified groupings, if any.
721
+     *
722
+     * <code>
723
+     *     $qb = $conn->getQueryBuilder()
724
+     *         ->select('u.name')
725
+     *         ->from('users', 'u')
726
+     *         ->groupBy('u.id');
727
+     * </code>
728
+     *
729
+     * @param mixed ...$groupBys The grouping expression.
730
+     *
731
+     * @return $this This QueryBuilder instance.
732
+     * @since 8.2.0
733
+     *
734
+     * @psalm-taint-sink sql $groupBys
735
+     */
736
+    public function groupBy(...$groupBys);
737
+
738
+    /**
739
+     * Adds a grouping expression to the query.
740
+     *
741
+     * <code>
742
+     *     $qb = $conn->getQueryBuilder()
743
+     *         ->select('u.name')
744
+     *         ->from('users', 'u')
745
+     *         ->groupBy('u.lastLogin');
746
+     *         ->addGroupBy('u.createdAt')
747
+     * </code>
748
+     *
749
+     * @param mixed ...$groupBy The grouping expression.
750
+     *
751
+     * @return $this This QueryBuilder instance.
752
+     * @since 8.2.0
753
+     *
754
+     * @psalm-taint-sink sql $groupby
755
+     */
756
+    public function addGroupBy(...$groupBy);
757
+
758
+    /**
759
+     * Sets a value for a column in an insert query.
760
+     *
761
+     * <code>
762
+     *     $qb = $conn->getQueryBuilder()
763
+     *         ->insert('users')
764
+     *         ->values(
765
+     *             array(
766
+     *                 'name' => '?'
767
+     *             )
768
+     *         )
769
+     *         ->setValue('password', '?');
770
+     * </code>
771
+     *
772
+     * @param string $column The column into which the value should be inserted.
773
+     * @param IParameter|string $value The value that should be inserted into the column.
774
+     *
775
+     * @return $this This QueryBuilder instance.
776
+     * @since 8.2.0
777
+     *
778
+     * @psalm-taint-sink sql $column
779
+     * @psalm-taint-sink sql $value
780
+     */
781
+    public function setValue($column, $value);
782
+
783
+    /**
784
+     * Specifies values for an insert query indexed by column names.
785
+     * Replaces any previous values, if any.
786
+     *
787
+     * <code>
788
+     *     $qb = $conn->getQueryBuilder()
789
+     *         ->insert('users')
790
+     *         ->values(
791
+     *             array(
792
+     *                 'name' => '?',
793
+     *                 'password' => '?'
794
+     *             )
795
+     *         );
796
+     * </code>
797
+     *
798
+     * @param array $values The values to specify for the insert query indexed by column names.
799
+     *
800
+     * @return $this This QueryBuilder instance.
801
+     * @since 8.2.0
802
+     *
803
+     * @psalm-taint-sink sql $values
804
+     */
805
+    public function values(array $values);
806
+
807
+    /**
808
+     * Specifies a restriction over the groups of the query.
809
+     * Replaces any previous having restrictions, if any.
810
+     *
811
+     * @param mixed ...$having The restriction over the groups.
812
+     *
813
+     * @return $this This QueryBuilder instance.
814
+     * @since 8.2.0
815
+     *
816
+     * @psalm-taint-sink sql $having
817
+     */
818
+    public function having(...$having);
819
+
820
+    /**
821
+     * Adds a restriction over the groups of the query, forming a logical
822
+     * conjunction with any existing having restrictions.
823
+     *
824
+     * @param mixed ...$having The restriction to append.
825
+     *
826
+     * @return $this This QueryBuilder instance.
827
+     * @since 8.2.0
828
+     *
829
+     * @psalm-taint-sink sql $andHaving
830
+     */
831
+    public function andHaving(...$having);
832
+
833
+    /**
834
+     * Adds a restriction over the groups of the query, forming a logical
835
+     * disjunction with any existing having restrictions.
836
+     *
837
+     * @param mixed ...$having The restriction to add.
838
+     *
839
+     * @return $this This QueryBuilder instance.
840
+     * @since 8.2.0
841
+     *
842
+     * @psalm-taint-sink sql $having
843
+     */
844
+    public function orHaving(...$having);
845
+
846
+    /**
847
+     * Specifies an ordering for the query results.
848
+     * Replaces any previously specified orderings, if any.
849
+     *
850
+     * @param string|IQueryFunction|ILiteral|IParameter $sort The ordering expression.
851
+     * @param string $order The ordering direction.
852
+     *
853
+     * @return $this This QueryBuilder instance.
854
+     * @since 8.2.0
855
+     *
856
+     * @psalm-taint-sink sql $sort
857
+     * @psalm-taint-sink sql $order
858
+     */
859
+    public function orderBy($sort, $order = null);
860
+
861
+    /**
862
+     * Adds an ordering to the query results.
863
+     *
864
+     * @param string|ILiteral|IParameter|IQueryFunction $sort The ordering expression.
865
+     * @param string $order The ordering direction.
866
+     *
867
+     * @return $this This QueryBuilder instance.
868
+     * @since 8.2.0
869
+     *
870
+     * @psalm-taint-sink sql $sort
871
+     * @psalm-taint-sink sql $order
872
+     */
873
+    public function addOrderBy($sort, $order = null);
874
+
875
+    /**
876
+     * Gets a query part by its name.
877
+     *
878
+     * @param string $queryPartName
879
+     *
880
+     * @return mixed
881
+     * @since 8.2.0
882
+     * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
883
+     *  and we can not fix this in our wrapper. Please track the details you need, outside the object.
884
+     */
885
+    public function getQueryPart($queryPartName);
886
+
887
+    /**
888
+     * Gets all query parts.
889
+     *
890
+     * @return array
891
+     * @since 8.2.0
892
+     * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
893
+     *  and we can not fix this in our wrapper. Please track the details you need, outside the object.
894
+     */
895
+    public function getQueryParts();
896
+
897
+    /**
898
+     * Resets SQL parts.
899
+     *
900
+     * @param array|null $queryPartNames
901
+     *
902
+     * @return $this This QueryBuilder instance.
903
+     * @since 8.2.0
904
+     * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
905
+     * and we can not fix this in our wrapper. Please create a new IQueryBuilder instead.
906
+     */
907
+    public function resetQueryParts($queryPartNames = null);
908
+
909
+    /**
910
+     * Resets a single SQL part.
911
+     *
912
+     * @param string $queryPartName
913
+     *
914
+     * @return $this This QueryBuilder instance.
915
+     * @since 8.2.0
916
+     * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update
917
+     *  and we can not fix this in our wrapper. Please create a new IQueryBuilder instead.
918
+     */
919
+    public function resetQueryPart($queryPartName);
920
+
921
+    /**
922
+     * Creates a new named parameter and bind the value $value to it.
923
+     *
924
+     * This method provides a shortcut for PDOStatement::bindValue
925
+     * when using prepared statements.
926
+     *
927
+     * The parameter $value specifies the value that you want to bind. If
928
+     * $placeholder is not provided bindValue() will automatically create a
929
+     * placeholder for you. An automatic placeholder will be of the name
930
+     * ':dcValue1', ':dcValue2' etc.
931
+     *
932
+     * For more information see {@link https://www.php.net/pdostatement-bindparam}
933
+     *
934
+     * Example:
935
+     * <code>
936
+     * $value = 2;
937
+     * $q->eq( 'id', $q->bindValue( $value ) );
938
+     * $stmt = $q->executeQuery(); // executed with 'id = 2'
939
+     * </code>
940
+     *
941
+     * @license New BSD License
942
+     * @link http://www.zetacomponents.org
943
+     *
944
+     * @param mixed $value
945
+     * @param self::PARAM_* $type
946
+     * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
947
+     *
948
+     * @return IParameter
949
+     * @since 8.2.0
950
+     *
951
+     * @psalm-taint-escape sql
952
+     */
953
+    public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
954
+
955
+    /**
956
+     * Creates a new positional parameter and bind the given value to it.
957
+     *
958
+     * Attention: If you are using positional parameters with the query builder you have
959
+     * to be very careful to bind all parameters in the order they appear in the SQL
960
+     * statement , otherwise they get bound in the wrong order which can lead to serious
961
+     * bugs in your code.
962
+     *
963
+     * Example:
964
+     * <code>
965
+     *  $qb = $conn->getQueryBuilder();
966
+     *  $qb->select('u.*')
967
+     *     ->from('users', 'u')
968
+     *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
969
+     *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
970
+     * </code>
971
+     *
972
+     * @param mixed $value
973
+     * @param self::PARAM_* $type
974
+     *
975
+     * @return IParameter
976
+     * @since 8.2.0
977
+     *
978
+     * @psalm-taint-escape sql
979
+     */
980
+    public function createPositionalParameter($value, $type = self::PARAM_STR);
981
+
982
+    /**
983
+     * Creates a new parameter
984
+     *
985
+     * Example:
986
+     * <code>
987
+     *  $qb = $conn->getQueryBuilder();
988
+     *  $qb->select('u.*')
989
+     *     ->from('users', 'u')
990
+     *     ->where('u.username = ' . $qb->createParameter('name'))
991
+     *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
992
+     * </code>
993
+     *
994
+     * @param string $name
995
+     *
996
+     * @return IParameter
997
+     * @since 8.2.0
998
+     *
999
+     * @psalm-taint-escape sql
1000
+     */
1001
+    public function createParameter($name);
1002
+
1003
+    /**
1004
+     * Creates a new function
1005
+     *
1006
+     * Attention: Column names inside the call have to be quoted before hand
1007
+     *
1008
+     * Example:
1009
+     * <code>
1010
+     *  $qb = $conn->getQueryBuilder();
1011
+     *  $qb->select($qb->createFunction('COUNT(*)'))
1012
+     *     ->from('users', 'u')
1013
+     *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
1014
+     * </code>
1015
+     * <code>
1016
+     *  $qb = $conn->getQueryBuilder();
1017
+     *  $qb->select($qb->createFunction('COUNT(`column`)'))
1018
+     *     ->from('users', 'u')
1019
+     *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
1020
+     * </code>
1021
+     *
1022
+     * @param string $call
1023
+     *
1024
+     * @return IQueryFunction
1025
+     * @since 8.2.0
1026
+     *
1027
+     * @psalm-taint-sink sql $call
1028
+     */
1029
+    public function createFunction($call);
1030
+
1031
+    /**
1032
+     * Used to get the id of the last inserted element
1033
+     * @return int
1034
+     * @throws \BadMethodCallException When being called before an insert query has been run.
1035
+     * @since 9.0.0
1036
+     */
1037
+    public function getLastInsertId(): int;
1038
+
1039
+    /**
1040
+     * Returns the table name quoted and with database prefix as needed by the implementation.
1041
+     * If a query function is passed the function is casted to string,
1042
+     * this allows passing functions as sub-queries for join expression.
1043
+     *
1044
+     * @param string|IQueryFunction $table
1045
+     * @return string
1046
+     * @since 9.0.0
1047
+     * @since 24.0.0 accepts IQueryFunction as parameter
1048
+     */
1049
+    public function getTableName($table);
1050
+
1051
+    /**
1052
+     * Returns the table name with database prefix as needed by the implementation
1053
+     *
1054
+     * @param string $table
1055
+     * @return string
1056
+     * @since 30.0.0
1057
+     */
1058
+    public function prefixTableName(string $table): string;
1059
+
1060
+    /**
1061
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
1062
+     *
1063
+     * @param string $column
1064
+     * @param string $tableAlias
1065
+     * @return string
1066
+     * @since 9.0.0
1067
+     */
1068
+    public function getColumnName($column, $tableAlias = '');
1069
+
1070
+    /**
1071
+     * Provide a hint for the shard key for queries where this can't be detected otherwise
1072
+     *
1073
+     * @param string $column
1074
+     * @param mixed $value
1075
+     * @return $this
1076
+     * @since 30.0.0
1077
+     */
1078
+    public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self;
1079
+
1080
+    /**
1081
+     * Set the query to run across all shards if sharding is enabled.
1082
+     *
1083
+     * @return $this
1084
+     * @since 30.0.0
1085
+     */
1086
+    public function runAcrossAllShards(): self;
1087
+
1088
+    /**
1089
+     * Get a list of column names that are expected in the query output
1090
+     *
1091
+     * @return array
1092
+     * @since 30.0.0
1093
+     */
1094
+    public function getOutputColumns(): array;
1095 1095
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -14,40 +14,40 @@
 block discarded – undo
14 14
 use Psr\Log\LoggerInterface;
15 15
 
16 16
 class MySqlExpressionBuilder extends ExpressionBuilder {
17
-	protected string $collation;
17
+    protected string $collation;
18 18
 
19
-	public function __construct(ConnectionAdapter $connection, IQueryBuilder $queryBuilder, LoggerInterface $logger) {
20
-		parent::__construct($connection, $queryBuilder, $logger);
19
+    public function __construct(ConnectionAdapter $connection, IQueryBuilder $queryBuilder, LoggerInterface $logger) {
20
+        parent::__construct($connection, $queryBuilder, $logger);
21 21
 
22
-		$params = $connection->getInner()->getParams();
23
-		$this->collation = $params['collation'] ?? (($params['charset'] ?? 'utf8') . '_general_ci');
24
-	}
22
+        $params = $connection->getInner()->getParams();
23
+        $this->collation = $params['collation'] ?? (($params['charset'] ?? 'utf8') . '_general_ci');
24
+    }
25 25
 
26
-	/**
27
-	 * @inheritdoc
28
-	 */
29
-	public function iLike($x, $y, $type = null): string {
30
-		$x = $this->helper->quoteColumnName($x);
31
-		$y = $this->helper->quoteColumnName($y);
32
-		return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->collation . ' LIKE', $y);
33
-	}
26
+    /**
27
+     * @inheritdoc
28
+     */
29
+    public function iLike($x, $y, $type = null): string {
30
+        $x = $this->helper->quoteColumnName($x);
31
+        $y = $this->helper->quoteColumnName($y);
32
+        return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->collation . ' LIKE', $y);
33
+    }
34 34
 
35
-	/**
36
-	 * Returns a IQueryFunction that casts the column to the given type
37
-	 *
38
-	 * @param string|IQueryFunction $column
39
-	 * @param mixed $type One of IQueryBuilder::PARAM_*
40
-	 * @psalm-param IQueryBuilder::PARAM_* $type
41
-	 * @return IQueryFunction
42
-	 */
43
-	public function castColumn($column, $type): IQueryFunction {
44
-		switch ($type) {
45
-			case IQueryBuilder::PARAM_STR:
46
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS CHAR)');
47
-			case IQueryBuilder::PARAM_JSON:
48
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS JSON)');
49
-			default:
50
-				return parent::castColumn($column, $type);
51
-		}
52
-	}
35
+    /**
36
+     * Returns a IQueryFunction that casts the column to the given type
37
+     *
38
+     * @param string|IQueryFunction $column
39
+     * @param mixed $type One of IQueryBuilder::PARAM_*
40
+     * @psalm-param IQueryBuilder::PARAM_* $type
41
+     * @return IQueryFunction
42
+     */
43
+    public function castColumn($column, $type): IQueryFunction {
44
+        switch ($type) {
45
+            case IQueryBuilder::PARAM_STR:
46
+                return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS CHAR)');
47
+            case IQueryBuilder::PARAM_JSON:
48
+                return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS JSON)');
49
+            default:
50
+                return parent::castColumn($column, $type);
51
+        }
52
+    }
53 53
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		parent::__construct($connection, $queryBuilder, $logger);
21 21
 
22 22
 		$params = $connection->getInner()->getParams();
23
-		$this->collation = $params['collation'] ?? (($params['charset'] ?? 'utf8') . '_general_ci');
23
+		$this->collation = $params['collation'] ?? (($params['charset'] ?? 'utf8').'_general_ci');
24 24
 	}
25 25
 
26 26
 	/**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function iLike($x, $y, $type = null): string {
30 30
 		$x = $this->helper->quoteColumnName($x);
31 31
 		$y = $this->helper->quoteColumnName($y);
32
-		return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->collation . ' LIKE', $y);
32
+		return $this->expressionBuilder->comparison($x, ' COLLATE '.$this->collation.' LIKE', $y);
33 33
 	}
34 34
 
35 35
 	/**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	public function castColumn($column, $type): IQueryFunction {
44 44
 		switch ($type) {
45 45
 			case IQueryBuilder::PARAM_STR:
46
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS CHAR)');
46
+				return new QueryFunction('CAST('.$this->helper->quoteColumnName($column).' AS CHAR)');
47 47
 			case IQueryBuilder::PARAM_JSON:
48
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS JSON)');
48
+				return new QueryFunction('CAST('.$this->helper->quoteColumnName($column).' AS JSON)');
49 49
 			default:
50 50
 				return parent::castColumn($column, $type);
51 51
 		}
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -14,43 +14,43 @@
 block discarded – undo
14 14
 use OCP\DB\QueryBuilder\IQueryFunction;
15 15
 
16 16
 class PgSqlExpressionBuilder extends ExpressionBuilder {
17
-	/**
18
-	 * Returns a IQueryFunction that casts the column to the given type
19
-	 *
20
-	 * @param string|IQueryFunction $column
21
-	 * @param mixed $type One of IQueryBuilder::PARAM_*
22
-	 * @psalm-param IQueryBuilder::PARAM_* $type
23
-	 * @return IQueryFunction
24
-	 */
25
-	public function castColumn($column, $type): IQueryFunction {
26
-		switch ($type) {
27
-			case IQueryBuilder::PARAM_INT:
28
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS BIGINT)');
29
-			case IQueryBuilder::PARAM_STR:
30
-			case IQueryBuilder::PARAM_JSON:
31
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS TEXT)');
32
-			default:
33
-				return parent::castColumn($column, $type);
34
-		}
35
-	}
17
+    /**
18
+     * Returns a IQueryFunction that casts the column to the given type
19
+     *
20
+     * @param string|IQueryFunction $column
21
+     * @param mixed $type One of IQueryBuilder::PARAM_*
22
+     * @psalm-param IQueryBuilder::PARAM_* $type
23
+     * @return IQueryFunction
24
+     */
25
+    public function castColumn($column, $type): IQueryFunction {
26
+        switch ($type) {
27
+            case IQueryBuilder::PARAM_INT:
28
+                return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS BIGINT)');
29
+            case IQueryBuilder::PARAM_STR:
30
+            case IQueryBuilder::PARAM_JSON:
31
+                return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS TEXT)');
32
+            default:
33
+                return parent::castColumn($column, $type);
34
+        }
35
+    }
36 36
 
37
-	/**
38
-	 * @inheritdoc
39
-	 */
40
-	protected function prepareColumn($column, $type) {
41
-		if ($type === IQueryBuilder::PARAM_JSON && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) {
42
-			$column = $this->castColumn($column, $type);
43
-		}
37
+    /**
38
+     * @inheritdoc
39
+     */
40
+    protected function prepareColumn($column, $type) {
41
+        if ($type === IQueryBuilder::PARAM_JSON && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) {
42
+            $column = $this->castColumn($column, $type);
43
+        }
44 44
 
45
-		return parent::prepareColumn($column, $type);
46
-	}
45
+        return parent::prepareColumn($column, $type);
46
+    }
47 47
 
48
-	/**
49
-	 * @inheritdoc
50
-	 */
51
-	public function iLike($x, $y, $type = null): string {
52
-		$x = $this->helper->quoteColumnName($x);
53
-		$y = $this->helper->quoteColumnName($y);
54
-		return $this->expressionBuilder->comparison($x, 'ILIKE', $y);
55
-	}
48
+    /**
49
+     * @inheritdoc
50
+     */
51
+    public function iLike($x, $y, $type = null): string {
52
+        $x = $this->helper->quoteColumnName($x);
53
+        $y = $this->helper->quoteColumnName($y);
54
+        return $this->expressionBuilder->comparison($x, 'ILIKE', $y);
55
+    }
56 56
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
 	public function castColumn($column, $type): IQueryFunction {
26 26
 		switch ($type) {
27 27
 			case IQueryBuilder::PARAM_INT:
28
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS BIGINT)');
28
+				return new QueryFunction('CAST('.$this->helper->quoteColumnName($column).' AS BIGINT)');
29 29
 			case IQueryBuilder::PARAM_STR:
30 30
 			case IQueryBuilder::PARAM_JSON:
31
-				return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS TEXT)');
31
+				return new QueryFunction('CAST('.$this->helper->quoteColumnName($column).' AS TEXT)');
32 32
 			default:
33 33
 				return parent::castColumn($column, $type);
34 34
 		}
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php 2 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -14,119 +14,119 @@
 block discarded – undo
14 14
 use OCP\DB\QueryBuilder\IQueryFunction;
15 15
 
16 16
 class OCIExpressionBuilder extends ExpressionBuilder {
17
-	/**
18
-	 * @param mixed $column
19
-	 * @param mixed|null $type
20
-	 * @return array|IQueryFunction|string
21
-	 */
22
-	protected function prepareColumn($column, $type) {
23
-		if ($type === IQueryBuilder::PARAM_STR && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) {
24
-			$column = $this->castColumn($column, $type);
25
-		}
26
-
27
-		return parent::prepareColumn($column, $type);
28
-	}
29
-
30
-	/**
31
-	 * @inheritdoc
32
-	 */
33
-	public function eq($x, $y, $type = null): string {
34
-		if ($type === IQueryBuilder::PARAM_JSON) {
35
-			$x = $this->prepareColumn($x, $type);
36
-			$y = $this->prepareColumn($y, $type);
37
-			return (string)(new QueryFunction('JSON_EQUAL(' . $x . ',' . $y . ')'));
38
-		}
39
-
40
-		return parent::eq($x, $y, $type);
41
-	}
42
-
43
-	/**
44
-	 * @inheritdoc
45
-	 */
46
-	public function neq($x, $y, $type = null): string {
47
-		if ($type === IQueryBuilder::PARAM_JSON) {
48
-			$x = $this->prepareColumn($x, $type);
49
-			$y = $this->prepareColumn($y, $type);
50
-			return (string)(new QueryFunction('NOT JSON_EQUAL(' . $x . ',' . $y . ')'));
51
-		}
52
-
53
-		return parent::neq($x, $y, $type);
54
-	}
55
-
56
-	/**
57
-	 * @inheritdoc
58
-	 */
59
-	public function in($x, $y, $type = null): string {
60
-		$x = $this->prepareColumn($x, $type);
61
-		$y = $this->prepareColumn($y, $type);
62
-
63
-		return $this->expressionBuilder->in($x, $y);
64
-	}
65
-
66
-	/**
67
-	 * @inheritdoc
68
-	 */
69
-	public function notIn($x, $y, $type = null): string {
70
-		$x = $this->prepareColumn($x, $type);
71
-		$y = $this->prepareColumn($y, $type);
72
-
73
-		return $this->expressionBuilder->notIn($x, $y);
74
-	}
75
-
76
-	/**
77
-	 * Creates a $x = '' statement, because Oracle needs a different check
78
-	 *
79
-	 * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
80
-	 * @return string
81
-	 * @since 13.0.0
82
-	 */
83
-	public function emptyString($x): string {
84
-		return $this->isNull($x);
85
-	}
86
-
87
-	/**
88
-	 * Creates a `$x <> ''` statement, because Oracle needs a different check
89
-	 *
90
-	 * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
91
-	 * @return string
92
-	 * @since 13.0.0
93
-	 */
94
-	public function nonEmptyString($x): string {
95
-		return $this->isNotNull($x);
96
-	}
97
-
98
-	/**
99
-	 * Returns a IQueryFunction that casts the column to the given type
100
-	 *
101
-	 * @param string|IQueryFunction $column
102
-	 * @param mixed $type One of IQueryBuilder::PARAM_*
103
-	 * @psalm-param IQueryBuilder::PARAM_* $type
104
-	 * @return IQueryFunction
105
-	 */
106
-	public function castColumn($column, $type): IQueryFunction {
107
-		if ($type === IQueryBuilder::PARAM_STR) {
108
-			$column = $this->helper->quoteColumnName($column);
109
-			return new QueryFunction('to_char(' . $column . ')');
110
-		}
111
-		if ($type === IQueryBuilder::PARAM_INT) {
112
-			$column = $this->helper->quoteColumnName($column);
113
-			return new QueryFunction('to_number(to_char(' . $column . '))');
114
-		}
115
-
116
-		return parent::castColumn($column, $type);
117
-	}
118
-
119
-	/**
120
-	 * @inheritdoc
121
-	 */
122
-	public function like($x, $y, $type = null): string {
123
-		return parent::like($x, $y, $type) . " ESCAPE '\\'";
124
-	}
125
-
126
-	/**
127
-	 * @inheritdoc
128
-	 */
129
-	public function iLike($x, $y, $type = null): string {
130
-		return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y));
131
-	}
17
+    /**
18
+     * @param mixed $column
19
+     * @param mixed|null $type
20
+     * @return array|IQueryFunction|string
21
+     */
22
+    protected function prepareColumn($column, $type) {
23
+        if ($type === IQueryBuilder::PARAM_STR && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) {
24
+            $column = $this->castColumn($column, $type);
25
+        }
26
+
27
+        return parent::prepareColumn($column, $type);
28
+    }
29
+
30
+    /**
31
+     * @inheritdoc
32
+     */
33
+    public function eq($x, $y, $type = null): string {
34
+        if ($type === IQueryBuilder::PARAM_JSON) {
35
+            $x = $this->prepareColumn($x, $type);
36
+            $y = $this->prepareColumn($y, $type);
37
+            return (string)(new QueryFunction('JSON_EQUAL(' . $x . ',' . $y . ')'));
38
+        }
39
+
40
+        return parent::eq($x, $y, $type);
41
+    }
42
+
43
+    /**
44
+     * @inheritdoc
45
+     */
46
+    public function neq($x, $y, $type = null): string {
47
+        if ($type === IQueryBuilder::PARAM_JSON) {
48
+            $x = $this->prepareColumn($x, $type);
49
+            $y = $this->prepareColumn($y, $type);
50
+            return (string)(new QueryFunction('NOT JSON_EQUAL(' . $x . ',' . $y . ')'));
51
+        }
52
+
53
+        return parent::neq($x, $y, $type);
54
+    }
55
+
56
+    /**
57
+     * @inheritdoc
58
+     */
59
+    public function in($x, $y, $type = null): string {
60
+        $x = $this->prepareColumn($x, $type);
61
+        $y = $this->prepareColumn($y, $type);
62
+
63
+        return $this->expressionBuilder->in($x, $y);
64
+    }
65
+
66
+    /**
67
+     * @inheritdoc
68
+     */
69
+    public function notIn($x, $y, $type = null): string {
70
+        $x = $this->prepareColumn($x, $type);
71
+        $y = $this->prepareColumn($y, $type);
72
+
73
+        return $this->expressionBuilder->notIn($x, $y);
74
+    }
75
+
76
+    /**
77
+     * Creates a $x = '' statement, because Oracle needs a different check
78
+     *
79
+     * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
80
+     * @return string
81
+     * @since 13.0.0
82
+     */
83
+    public function emptyString($x): string {
84
+        return $this->isNull($x);
85
+    }
86
+
87
+    /**
88
+     * Creates a `$x <> ''` statement, because Oracle needs a different check
89
+     *
90
+     * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
91
+     * @return string
92
+     * @since 13.0.0
93
+     */
94
+    public function nonEmptyString($x): string {
95
+        return $this->isNotNull($x);
96
+    }
97
+
98
+    /**
99
+     * Returns a IQueryFunction that casts the column to the given type
100
+     *
101
+     * @param string|IQueryFunction $column
102
+     * @param mixed $type One of IQueryBuilder::PARAM_*
103
+     * @psalm-param IQueryBuilder::PARAM_* $type
104
+     * @return IQueryFunction
105
+     */
106
+    public function castColumn($column, $type): IQueryFunction {
107
+        if ($type === IQueryBuilder::PARAM_STR) {
108
+            $column = $this->helper->quoteColumnName($column);
109
+            return new QueryFunction('to_char(' . $column . ')');
110
+        }
111
+        if ($type === IQueryBuilder::PARAM_INT) {
112
+            $column = $this->helper->quoteColumnName($column);
113
+            return new QueryFunction('to_number(to_char(' . $column . '))');
114
+        }
115
+
116
+        return parent::castColumn($column, $type);
117
+    }
118
+
119
+    /**
120
+     * @inheritdoc
121
+     */
122
+    public function like($x, $y, $type = null): string {
123
+        return parent::like($x, $y, $type) . " ESCAPE '\\'";
124
+    }
125
+
126
+    /**
127
+     * @inheritdoc
128
+     */
129
+    public function iLike($x, $y, $type = null): string {
130
+        return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y));
131
+    }
132 132
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		if ($type === IQueryBuilder::PARAM_JSON) {
35 35
 			$x = $this->prepareColumn($x, $type);
36 36
 			$y = $this->prepareColumn($y, $type);
37
-			return (string)(new QueryFunction('JSON_EQUAL(' . $x . ',' . $y . ')'));
37
+			return (string) (new QueryFunction('JSON_EQUAL('.$x.','.$y.')'));
38 38
 		}
39 39
 
40 40
 		return parent::eq($x, $y, $type);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		if ($type === IQueryBuilder::PARAM_JSON) {
48 48
 			$x = $this->prepareColumn($x, $type);
49 49
 			$y = $this->prepareColumn($y, $type);
50
-			return (string)(new QueryFunction('NOT JSON_EQUAL(' . $x . ',' . $y . ')'));
50
+			return (string) (new QueryFunction('NOT JSON_EQUAL('.$x.','.$y.')'));
51 51
 		}
52 52
 
53 53
 		return parent::neq($x, $y, $type);
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	public function castColumn($column, $type): IQueryFunction {
107 107
 		if ($type === IQueryBuilder::PARAM_STR) {
108 108
 			$column = $this->helper->quoteColumnName($column);
109
-			return new QueryFunction('to_char(' . $column . ')');
109
+			return new QueryFunction('to_char('.$column.')');
110 110
 		}
111 111
 		if ($type === IQueryBuilder::PARAM_INT) {
112 112
 			$column = $this->helper->quoteColumnName($column);
113
-			return new QueryFunction('to_number(to_char(' . $column . '))');
113
+			return new QueryFunction('to_number(to_char('.$column.'))');
114 114
 		}
115 115
 
116 116
 		return parent::castColumn($column, $type);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @inheritdoc
121 121
 	 */
122 122
 	public function like($x, $y, $type = null): string {
123
-		return parent::like($x, $y, $type) . " ESCAPE '\\'";
123
+		return parent::like($x, $y, $type)." ESCAPE '\\'";
124 124
 	}
125 125
 
126 126
 	/**
Please login to merge, or discard this patch.
tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php 2 patches
Indentation   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -18,266 +18,266 @@
 block discarded – undo
18 18
 
19 19
 #[\PHPUnit\Framework\Attributes\Group('DB')]
20 20
 class ExpressionBuilderDBTest extends TestCase {
21
-	/** @var \Doctrine\DBAL\Connection|IDBConnection */
22
-	protected $connection;
23
-	protected $schemaSetup = false;
24
-
25
-	protected function setUp(): void {
26
-		parent::setUp();
27
-
28
-		$this->connection = Server::get(IDBConnection::class);
29
-		$this->prepareTestingTable();
30
-	}
31
-
32
-	public static function likeProvider(): array {
33
-		$connection = Server::get(IDBConnection::class);
34
-
35
-		return [
36
-			['foo', 'bar', false],
37
-			['foo', 'foo', true],
38
-			['foo', 'f%', true],
39
-			['foo', '%o', true],
40
-			['foo', '%', true],
41
-			['foo', 'fo_', true],
42
-			['foo', 'foo_', false],
43
-			['foo', $connection->escapeLikeParameter('fo_'), false],
44
-			['foo', $connection->escapeLikeParameter('f%'), false],
45
-		];
46
-	}
47
-
48
-	/**
49
-	 *
50
-	 * @param string $param1
51
-	 * @param string $param2
52
-	 * @param boolean $match
53
-	 */
54
-	#[\PHPUnit\Framework\Attributes\DataProvider('likeProvider')]
55
-	public function testLike($param1, $param2, $match): void {
56
-		$query = $this->connection->getQueryBuilder();
57
-
58
-		$query->select(new Literal('1'))
59
-			->from('users')
60
-			->where($query->expr()->like($query->createNamedParameter($param1), $query->createNamedParameter($param2)));
61
-
62
-		$result = $query->executeQuery();
63
-		$column = $result->fetchOne();
64
-		$result->closeCursor();
65
-		$this->assertEquals($match, $column);
66
-	}
67
-
68
-	public static function ilikeProvider(): array {
69
-		$connection = Server::get(IDBConnection::class);
70
-
71
-		return [
72
-			['foo', 'bar', false],
73
-			['foo', 'foo', true],
74
-			['foo', 'Foo', true],
75
-			['foo', 'f%', true],
76
-			['foo', '%o', true],
77
-			['foo', '%', true],
78
-			['foo', 'fo_', true],
79
-			['foo', 'foo_', false],
80
-			['foo', $connection->escapeLikeParameter('fo_'), false],
81
-			['foo', $connection->escapeLikeParameter('f%'), false],
82
-		];
83
-	}
84
-
85
-	/**
86
-	 *
87
-	 * @param string $param1
88
-	 * @param string $param2
89
-	 * @param boolean $match
90
-	 */
91
-	#[\PHPUnit\Framework\Attributes\DataProvider('ilikeProvider')]
92
-	public function testILike($param1, $param2, $match): void {
93
-		$query = $this->connection->getQueryBuilder();
94
-
95
-		$query->select(new Literal('1'))
96
-			->from('users')
97
-			->where($query->expr()->iLike($query->createNamedParameter($param1), $query->createNamedParameter($param2)));
98
-
99
-		$result = $query->executeQuery();
100
-		$column = $result->fetchOne();
101
-		$result->closeCursor();
102
-		$this->assertEquals($match, $column);
103
-	}
104
-
105
-	public function testCastColumn(): void {
106
-		$appId = $this->getUniqueID('testing');
107
-		$this->createConfig($appId, '1', '4');
108
-
109
-		$query = $this->connection->getQueryBuilder();
110
-		$query->update('appconfig')
111
-			->set('configvalue',
112
-				$query->expr()->castColumn(
113
-					$query->createFunction(
114
-						'(' . $query->expr()->castColumn('configvalue', IQueryBuilder::PARAM_INT)
115
-						. ' + 1)'
116
-					), IQueryBuilder::PARAM_STR
117
-				)
118
-			)
119
-			->where($query->expr()->eq('appid', $query->createNamedParameter($appId)))
120
-			->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('1')));
121
-
122
-		$result = $query->executeStatement();
123
-		$this->assertEquals(1, $result);
124
-	}
125
-
126
-	public function testLongText(): void {
127
-		$appId = $this->getUniqueID('testing');
128
-		$this->createConfig($appId, 'mykey', 'myvalue');
129
-
130
-		$query = $this->connection->getQueryBuilder();
131
-		$query->select('*')
132
-			->from('appconfig')
133
-			->where($query->expr()->eq('appid', $query->createNamedParameter($appId)))
134
-			->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('mykey')))
135
-			->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('myvalue', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR));
136
-
137
-		$result = $query->executeQuery();
138
-		$entries = $result->fetchAll();
139
-		$result->closeCursor();
140
-		self::assertCount(1, $entries);
141
-		self::assertEquals('myvalue', $entries[0]['configvalue']);
142
-	}
143
-
144
-	public function testJson(): void {
145
-		if ($this->connection->getDatabaseProvider(true) === IDBConnection::PLATFORM_ORACLE) {
146
-			$result = $this->connection->executeQuery('SELECT VERSION FROM PRODUCT_COMPONENT_VERSION');
147
-			$version = $result->fetchOne();
148
-			$result->closeCursor();
149
-			if (str_starts_with($version, '11.')) {
150
-				$this->markTestSkipped('JSON is not supported on Oracle 11, skipping until deprecation was clarified: ' . $version);
151
-			}
152
-		}
153
-
154
-
155
-		$appId = $this->getUniqueID('testing');
156
-		$query = $this->connection->getQueryBuilder();
157
-		$query->insert('share')
158
-			->values([
159
-				'uid_owner' => $query->createNamedParameter('uid_owner'),
160
-				'item_type' => $query->createNamedParameter('item_type'),
161
-				'permissions' => $query->createNamedParameter(0),
162
-				'stime' => $query->createNamedParameter(0),
163
-				'accepted' => $query->createNamedParameter(0),
164
-				'mail_send' => $query->createNamedParameter(0),
165
-				'share_type' => $query->createNamedParameter(0),
166
-				'share_with' => $query->createNamedParameter($appId),
167
-				'attributes' => $query->createNamedParameter('[["permissions","before"]]'),
168
-			])
169
-			->executeStatement();
170
-
171
-		$query = $this->connection->getQueryBuilder();
172
-		$query->update('share')
173
-			->set('attributes', $query->createNamedParameter('[["permissions","after"]]'));
174
-		if ($this->connection->getDatabaseProvider(true) === IDBConnection::PLATFORM_MYSQL) {
175
-			$query->where($query->expr()->eq('attributes', $query->createFunction("JSON_ARRAY(JSON_ARRAY('permissions','before'))"), IQueryBuilder::PARAM_JSON));
176
-		} else {
177
-			$query->where($query->expr()->eq('attributes', $query->createNamedParameter('[["permissions","before"]]'), IQueryBuilder::PARAM_JSON));
178
-		}
179
-		$query->executeStatement();
180
-
181
-		$query = $this->connection->getQueryBuilder();
182
-		$query->select('attributes')
183
-			->from('share')
184
-			->where($query->expr()->eq('share_with', $query->createNamedParameter($appId)));
185
-
186
-		$result = $query->executeQuery();
187
-		$entries = $result->fetchAll();
188
-		$result->closeCursor();
189
-		self::assertCount(1, $entries);
190
-		self::assertEquals([['permissions','after']], json_decode($entries[0]['attributes'], true));
191
-	}
192
-
193
-	public function testDateTimeEquals(): void {
194
-		$dateTime = new \DateTime('2023-01-01');
195
-		$insert = $this->connection->getQueryBuilder();
196
-		$insert->insert('testing')
197
-			->values(['datetime' => $insert->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)])
198
-			->executeStatement();
199
-
200
-		$query = $this->connection->getQueryBuilder();
201
-		$result = $query->select('*')
202
-			->from('testing')
203
-			->where($query->expr()->eq('datetime', $query->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)))
204
-			->executeQuery();
205
-		$entries = $result->fetchAll();
206
-		$result->closeCursor();
207
-		self::assertCount(1, $entries);
208
-	}
209
-
210
-	public function testDateTimeLess(): void {
211
-		$dateTime = new \DateTime('2022-01-01');
212
-		$dateTimeCompare = new \DateTime('2022-01-02');
213
-		$insert = $this->connection->getQueryBuilder();
214
-		$insert->insert('testing')
215
-			->values(['datetime' => $insert->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)])
216
-			->executeStatement();
217
-
218
-		$query = $this->connection->getQueryBuilder();
219
-		$result = $query->select('*')
220
-			->from('testing')
221
-			->where($query->expr()->lt('datetime', $query->createNamedParameter($dateTimeCompare, IQueryBuilder::PARAM_DATETIME_MUTABLE)))
222
-			->executeQuery();
223
-		$entries = $result->fetchAll();
224
-		$result->closeCursor();
225
-		self::assertCount(1, $entries);
226
-	}
227
-
228
-	public function testDateTimeGreater(): void {
229
-		$dateTime = new \DateTime('2023-01-02');
230
-		$dateTimeCompare = new \DateTime('2023-01-01');
231
-		$insert = $this->connection->getQueryBuilder();
232
-		$insert->insert('testing')
233
-			->values(['datetime' => $insert->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)])
234
-			->executeStatement();
235
-
236
-		$query = $this->connection->getQueryBuilder();
237
-		$result = $query->select('*')
238
-			->from('testing')
239
-			->where($query->expr()->gt('datetime', $query->createNamedParameter($dateTimeCompare, IQueryBuilder::PARAM_DATETIME_MUTABLE)))
240
-			->executeQuery();
241
-		$entries = $result->fetchAll();
242
-		$result->closeCursor();
243
-		self::assertCount(1, $entries);
244
-	}
245
-
246
-	protected function createConfig($appId, $key, $value) {
247
-		$query = $this->connection->getQueryBuilder();
248
-		$query->insert('appconfig')
249
-			->values([
250
-				'appid' => $query->createNamedParameter($appId),
251
-				'configkey' => $query->createNamedParameter((string)$key),
252
-				'configvalue' => $query->createNamedParameter((string)$value),
253
-			])
254
-			->executeStatement();
255
-	}
256
-
257
-	protected function prepareTestingTable(): void {
258
-		if ($this->schemaSetup) {
259
-			$this->connection->getQueryBuilder()->delete('testing')->executeStatement();
260
-		}
261
-
262
-		$prefix = Server::get(IConfig::class)->getSystemValueString('dbtableprefix', 'oc_');
263
-		$schema = $this->connection->createSchema();
264
-		try {
265
-			$schema->getTable($prefix . 'testing');
266
-			$this->connection->getQueryBuilder()->delete('testing')->executeStatement();
267
-		} catch (SchemaException $e) {
268
-			$this->schemaSetup = true;
269
-			$table = $schema->createTable($prefix . 'testing');
270
-			$table->addColumn('id', Types::BIGINT, [
271
-				'autoincrement' => true,
272
-				'notnull' => true,
273
-			]);
274
-
275
-			$table->addColumn('datetime', Types::DATETIME, [
276
-				'notnull' => false,
277
-			]);
278
-
279
-			$table->setPrimaryKey(['id']);
280
-			$this->connection->migrateToSchema($schema);
281
-		}
282
-	}
21
+    /** @var \Doctrine\DBAL\Connection|IDBConnection */
22
+    protected $connection;
23
+    protected $schemaSetup = false;
24
+
25
+    protected function setUp(): void {
26
+        parent::setUp();
27
+
28
+        $this->connection = Server::get(IDBConnection::class);
29
+        $this->prepareTestingTable();
30
+    }
31
+
32
+    public static function likeProvider(): array {
33
+        $connection = Server::get(IDBConnection::class);
34
+
35
+        return [
36
+            ['foo', 'bar', false],
37
+            ['foo', 'foo', true],
38
+            ['foo', 'f%', true],
39
+            ['foo', '%o', true],
40
+            ['foo', '%', true],
41
+            ['foo', 'fo_', true],
42
+            ['foo', 'foo_', false],
43
+            ['foo', $connection->escapeLikeParameter('fo_'), false],
44
+            ['foo', $connection->escapeLikeParameter('f%'), false],
45
+        ];
46
+    }
47
+
48
+    /**
49
+     *
50
+     * @param string $param1
51
+     * @param string $param2
52
+     * @param boolean $match
53
+     */
54
+    #[\PHPUnit\Framework\Attributes\DataProvider('likeProvider')]
55
+    public function testLike($param1, $param2, $match): void {
56
+        $query = $this->connection->getQueryBuilder();
57
+
58
+        $query->select(new Literal('1'))
59
+            ->from('users')
60
+            ->where($query->expr()->like($query->createNamedParameter($param1), $query->createNamedParameter($param2)));
61
+
62
+        $result = $query->executeQuery();
63
+        $column = $result->fetchOne();
64
+        $result->closeCursor();
65
+        $this->assertEquals($match, $column);
66
+    }
67
+
68
+    public static function ilikeProvider(): array {
69
+        $connection = Server::get(IDBConnection::class);
70
+
71
+        return [
72
+            ['foo', 'bar', false],
73
+            ['foo', 'foo', true],
74
+            ['foo', 'Foo', true],
75
+            ['foo', 'f%', true],
76
+            ['foo', '%o', true],
77
+            ['foo', '%', true],
78
+            ['foo', 'fo_', true],
79
+            ['foo', 'foo_', false],
80
+            ['foo', $connection->escapeLikeParameter('fo_'), false],
81
+            ['foo', $connection->escapeLikeParameter('f%'), false],
82
+        ];
83
+    }
84
+
85
+    /**
86
+     *
87
+     * @param string $param1
88
+     * @param string $param2
89
+     * @param boolean $match
90
+     */
91
+    #[\PHPUnit\Framework\Attributes\DataProvider('ilikeProvider')]
92
+    public function testILike($param1, $param2, $match): void {
93
+        $query = $this->connection->getQueryBuilder();
94
+
95
+        $query->select(new Literal('1'))
96
+            ->from('users')
97
+            ->where($query->expr()->iLike($query->createNamedParameter($param1), $query->createNamedParameter($param2)));
98
+
99
+        $result = $query->executeQuery();
100
+        $column = $result->fetchOne();
101
+        $result->closeCursor();
102
+        $this->assertEquals($match, $column);
103
+    }
104
+
105
+    public function testCastColumn(): void {
106
+        $appId = $this->getUniqueID('testing');
107
+        $this->createConfig($appId, '1', '4');
108
+
109
+        $query = $this->connection->getQueryBuilder();
110
+        $query->update('appconfig')
111
+            ->set('configvalue',
112
+                $query->expr()->castColumn(
113
+                    $query->createFunction(
114
+                        '(' . $query->expr()->castColumn('configvalue', IQueryBuilder::PARAM_INT)
115
+                        . ' + 1)'
116
+                    ), IQueryBuilder::PARAM_STR
117
+                )
118
+            )
119
+            ->where($query->expr()->eq('appid', $query->createNamedParameter($appId)))
120
+            ->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('1')));
121
+
122
+        $result = $query->executeStatement();
123
+        $this->assertEquals(1, $result);
124
+    }
125
+
126
+    public function testLongText(): void {
127
+        $appId = $this->getUniqueID('testing');
128
+        $this->createConfig($appId, 'mykey', 'myvalue');
129
+
130
+        $query = $this->connection->getQueryBuilder();
131
+        $query->select('*')
132
+            ->from('appconfig')
133
+            ->where($query->expr()->eq('appid', $query->createNamedParameter($appId)))
134
+            ->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('mykey')))
135
+            ->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('myvalue', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR));
136
+
137
+        $result = $query->executeQuery();
138
+        $entries = $result->fetchAll();
139
+        $result->closeCursor();
140
+        self::assertCount(1, $entries);
141
+        self::assertEquals('myvalue', $entries[0]['configvalue']);
142
+    }
143
+
144
+    public function testJson(): void {
145
+        if ($this->connection->getDatabaseProvider(true) === IDBConnection::PLATFORM_ORACLE) {
146
+            $result = $this->connection->executeQuery('SELECT VERSION FROM PRODUCT_COMPONENT_VERSION');
147
+            $version = $result->fetchOne();
148
+            $result->closeCursor();
149
+            if (str_starts_with($version, '11.')) {
150
+                $this->markTestSkipped('JSON is not supported on Oracle 11, skipping until deprecation was clarified: ' . $version);
151
+            }
152
+        }
153
+
154
+
155
+        $appId = $this->getUniqueID('testing');
156
+        $query = $this->connection->getQueryBuilder();
157
+        $query->insert('share')
158
+            ->values([
159
+                'uid_owner' => $query->createNamedParameter('uid_owner'),
160
+                'item_type' => $query->createNamedParameter('item_type'),
161
+                'permissions' => $query->createNamedParameter(0),
162
+                'stime' => $query->createNamedParameter(0),
163
+                'accepted' => $query->createNamedParameter(0),
164
+                'mail_send' => $query->createNamedParameter(0),
165
+                'share_type' => $query->createNamedParameter(0),
166
+                'share_with' => $query->createNamedParameter($appId),
167
+                'attributes' => $query->createNamedParameter('[["permissions","before"]]'),
168
+            ])
169
+            ->executeStatement();
170
+
171
+        $query = $this->connection->getQueryBuilder();
172
+        $query->update('share')
173
+            ->set('attributes', $query->createNamedParameter('[["permissions","after"]]'));
174
+        if ($this->connection->getDatabaseProvider(true) === IDBConnection::PLATFORM_MYSQL) {
175
+            $query->where($query->expr()->eq('attributes', $query->createFunction("JSON_ARRAY(JSON_ARRAY('permissions','before'))"), IQueryBuilder::PARAM_JSON));
176
+        } else {
177
+            $query->where($query->expr()->eq('attributes', $query->createNamedParameter('[["permissions","before"]]'), IQueryBuilder::PARAM_JSON));
178
+        }
179
+        $query->executeStatement();
180
+
181
+        $query = $this->connection->getQueryBuilder();
182
+        $query->select('attributes')
183
+            ->from('share')
184
+            ->where($query->expr()->eq('share_with', $query->createNamedParameter($appId)));
185
+
186
+        $result = $query->executeQuery();
187
+        $entries = $result->fetchAll();
188
+        $result->closeCursor();
189
+        self::assertCount(1, $entries);
190
+        self::assertEquals([['permissions','after']], json_decode($entries[0]['attributes'], true));
191
+    }
192
+
193
+    public function testDateTimeEquals(): void {
194
+        $dateTime = new \DateTime('2023-01-01');
195
+        $insert = $this->connection->getQueryBuilder();
196
+        $insert->insert('testing')
197
+            ->values(['datetime' => $insert->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)])
198
+            ->executeStatement();
199
+
200
+        $query = $this->connection->getQueryBuilder();
201
+        $result = $query->select('*')
202
+            ->from('testing')
203
+            ->where($query->expr()->eq('datetime', $query->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)))
204
+            ->executeQuery();
205
+        $entries = $result->fetchAll();
206
+        $result->closeCursor();
207
+        self::assertCount(1, $entries);
208
+    }
209
+
210
+    public function testDateTimeLess(): void {
211
+        $dateTime = new \DateTime('2022-01-01');
212
+        $dateTimeCompare = new \DateTime('2022-01-02');
213
+        $insert = $this->connection->getQueryBuilder();
214
+        $insert->insert('testing')
215
+            ->values(['datetime' => $insert->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)])
216
+            ->executeStatement();
217
+
218
+        $query = $this->connection->getQueryBuilder();
219
+        $result = $query->select('*')
220
+            ->from('testing')
221
+            ->where($query->expr()->lt('datetime', $query->createNamedParameter($dateTimeCompare, IQueryBuilder::PARAM_DATETIME_MUTABLE)))
222
+            ->executeQuery();
223
+        $entries = $result->fetchAll();
224
+        $result->closeCursor();
225
+        self::assertCount(1, $entries);
226
+    }
227
+
228
+    public function testDateTimeGreater(): void {
229
+        $dateTime = new \DateTime('2023-01-02');
230
+        $dateTimeCompare = new \DateTime('2023-01-01');
231
+        $insert = $this->connection->getQueryBuilder();
232
+        $insert->insert('testing')
233
+            ->values(['datetime' => $insert->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE)])
234
+            ->executeStatement();
235
+
236
+        $query = $this->connection->getQueryBuilder();
237
+        $result = $query->select('*')
238
+            ->from('testing')
239
+            ->where($query->expr()->gt('datetime', $query->createNamedParameter($dateTimeCompare, IQueryBuilder::PARAM_DATETIME_MUTABLE)))
240
+            ->executeQuery();
241
+        $entries = $result->fetchAll();
242
+        $result->closeCursor();
243
+        self::assertCount(1, $entries);
244
+    }
245
+
246
+    protected function createConfig($appId, $key, $value) {
247
+        $query = $this->connection->getQueryBuilder();
248
+        $query->insert('appconfig')
249
+            ->values([
250
+                'appid' => $query->createNamedParameter($appId),
251
+                'configkey' => $query->createNamedParameter((string)$key),
252
+                'configvalue' => $query->createNamedParameter((string)$value),
253
+            ])
254
+            ->executeStatement();
255
+    }
256
+
257
+    protected function prepareTestingTable(): void {
258
+        if ($this->schemaSetup) {
259
+            $this->connection->getQueryBuilder()->delete('testing')->executeStatement();
260
+        }
261
+
262
+        $prefix = Server::get(IConfig::class)->getSystemValueString('dbtableprefix', 'oc_');
263
+        $schema = $this->connection->createSchema();
264
+        try {
265
+            $schema->getTable($prefix . 'testing');
266
+            $this->connection->getQueryBuilder()->delete('testing')->executeStatement();
267
+        } catch (SchemaException $e) {
268
+            $this->schemaSetup = true;
269
+            $table = $schema->createTable($prefix . 'testing');
270
+            $table->addColumn('id', Types::BIGINT, [
271
+                'autoincrement' => true,
272
+                'notnull' => true,
273
+            ]);
274
+
275
+            $table->addColumn('datetime', Types::DATETIME, [
276
+                'notnull' => false,
277
+            ]);
278
+
279
+            $table->setPrimaryKey(['id']);
280
+            $this->connection->migrateToSchema($schema);
281
+        }
282
+    }
283 283
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			->set('configvalue',
112 112
 				$query->expr()->castColumn(
113 113
 					$query->createFunction(
114
-						'(' . $query->expr()->castColumn('configvalue', IQueryBuilder::PARAM_INT)
114
+						'('.$query->expr()->castColumn('configvalue', IQueryBuilder::PARAM_INT)
115 115
 						. ' + 1)'
116 116
 					), IQueryBuilder::PARAM_STR
117 117
 				)
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			$version = $result->fetchOne();
148 148
 			$result->closeCursor();
149 149
 			if (str_starts_with($version, '11.')) {
150
-				$this->markTestSkipped('JSON is not supported on Oracle 11, skipping until deprecation was clarified: ' . $version);
150
+				$this->markTestSkipped('JSON is not supported on Oracle 11, skipping until deprecation was clarified: '.$version);
151 151
 			}
152 152
 		}
153 153
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		$entries = $result->fetchAll();
188 188
 		$result->closeCursor();
189 189
 		self::assertCount(1, $entries);
190
-		self::assertEquals([['permissions','after']], json_decode($entries[0]['attributes'], true));
190
+		self::assertEquals([['permissions', 'after']], json_decode($entries[0]['attributes'], true));
191 191
 	}
192 192
 
193 193
 	public function testDateTimeEquals(): void {
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 		$query->insert('appconfig')
249 249
 			->values([
250 250
 				'appid' => $query->createNamedParameter($appId),
251
-				'configkey' => $query->createNamedParameter((string)$key),
252
-				'configvalue' => $query->createNamedParameter((string)$value),
251
+				'configkey' => $query->createNamedParameter((string) $key),
252
+				'configvalue' => $query->createNamedParameter((string) $value),
253 253
 			])
254 254
 			->executeStatement();
255 255
 	}
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 		$prefix = Server::get(IConfig::class)->getSystemValueString('dbtableprefix', 'oc_');
263 263
 		$schema = $this->connection->createSchema();
264 264
 		try {
265
-			$schema->getTable($prefix . 'testing');
265
+			$schema->getTable($prefix.'testing');
266 266
 			$this->connection->getQueryBuilder()->delete('testing')->executeStatement();
267 267
 		} catch (SchemaException $e) {
268 268
 			$this->schemaSetup = true;
269
-			$table = $schema->createTable($prefix . 'testing');
269
+			$table = $schema->createTable($prefix.'testing');
270 270
 			$table->addColumn('id', Types::BIGINT, [
271 271
 				'autoincrement' => true,
272 272
 				'notnull' => true,
Please login to merge, or discard this patch.
core/Migrations/Version33000Date20251106131209.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,23 +17,23 @@
 block discarded – undo
17 17
 
18 18
 #[DataCleansing(table: 'share', description: 'Fix share download permissions')]
19 19
 class Version33000Date20251106131209 extends SimpleMigrationStep {
20
-	public function __construct(
21
-		private readonly IDBConnection $connection,
22
-	) {
23
-	}
20
+    public function __construct(
21
+        private readonly IDBConnection $connection,
22
+    ) {
23
+    }
24 24
 
25
-	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
26
-		$qb = $this->connection->getQueryBuilder();
27
-		$qb->update('share')
28
-			->set('attributes', $qb->createNamedParameter('[["permissions","download",true]]'))
29
-			->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_CIRCLE, IQueryBuilder::PARAM_INT)));
25
+    public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
26
+        $qb = $this->connection->getQueryBuilder();
27
+        $qb->update('share')
28
+            ->set('attributes', $qb->createNamedParameter('[["permissions","download",true]]'))
29
+            ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_CIRCLE, IQueryBuilder::PARAM_INT)));
30 30
 
31
-		if ($this->connection->getDatabaseProvider(true) === IDBConnection::PLATFORM_MYSQL) {
32
-			$qb->andWhere($qb->expr()->eq('attributes', $qb->createFunction("JSON_ARRAY(JSON_ARRAY('permissions','download',null))"), IQueryBuilder::PARAM_JSON));
33
-		} else {
34
-			$qb->andWhere($qb->expr()->eq('attributes', $qb->createNamedParameter('[["permissions","download",null]]'), IQueryBuilder::PARAM_JSON));
35
-		}
31
+        if ($this->connection->getDatabaseProvider(true) === IDBConnection::PLATFORM_MYSQL) {
32
+            $qb->andWhere($qb->expr()->eq('attributes', $qb->createFunction("JSON_ARRAY(JSON_ARRAY('permissions','download',null))"), IQueryBuilder::PARAM_JSON));
33
+        } else {
34
+            $qb->andWhere($qb->expr()->eq('attributes', $qb->createNamedParameter('[["permissions","download",null]]'), IQueryBuilder::PARAM_JSON));
35
+        }
36 36
 
37
-		$qb->executeStatement();
38
-	}
37
+        $qb->executeStatement();
38
+    }
39 39
 }
Please login to merge, or discard this patch.