Passed
Push — master ( aeb32e...81302f )
by Christoph
15:20 queued 10s
created
lib/public/IDBConnection.php 1 patch
Indentation   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -51,286 +51,286 @@
 block discarded – undo
51 51
  * @since 6.0.0
52 52
  */
53 53
 interface IDBConnection {
54
-	public const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES';
55
-	public const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES';
56
-	public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class . '::ADD_MISSING_PRIMARY_KEYS';
57
-	public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class . '::CHECK_MISSING_PRIMARY_KEYS';
58
-	public const ADD_MISSING_COLUMNS_EVENT = self::class . '::ADD_MISSING_COLUMNS';
59
-	public const CHECK_MISSING_COLUMNS_EVENT = self::class . '::CHECK_MISSING_COLUMNS';
60
-
61
-	/**
62
-	 * Gets the QueryBuilder for the connection.
63
-	 *
64
-	 * @return \OCP\DB\QueryBuilder\IQueryBuilder
65
-	 * @since 8.2.0
66
-	 */
67
-	public function getQueryBuilder();
68
-
69
-	/**
70
-	 * Used to abstract the ownCloud database access away
71
-	 * @param string $sql the sql query with ? placeholder for params
72
-	 * @param int $limit the maximum number of rows
73
-	 * @param int $offset from which row we want to start
74
-	 * @return IPreparedStatement The prepared statement.
75
-	 * @since 6.0.0
76
-	 * @throws Exception since 21.0.0
77
-	 */
78
-	public function prepare($sql, $limit = null, $offset = null): IPreparedStatement;
79
-
80
-	/**
81
-	 * Executes an, optionally parameterized, SQL query.
82
-	 *
83
-	 * If the query is parameterized, a prepared statement is used.
84
-	 * If an SQLLogger is configured, the execution is logged.
85
-	 *
86
-	 * @param string $sql The SQL query to execute.
87
-	 * @param string[] $params The parameters to bind to the query, if any.
88
-	 * @param array $types The types the previous parameters are in.
89
-	 * @return IResult The executed statement.
90
-	 * @since 8.0.0
91
-	 * @throws Exception since 21.0.0
92
-	 */
93
-	public function executeQuery(string $sql, array $params = [], $types = []): IResult;
94
-
95
-	/**
96
-	 * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
97
-	 * and returns the number of affected rows.
98
-	 *
99
-	 * This method supports PDO binding types as well as DBAL mapping types.
100
-	 *
101
-	 * @param string $sql The SQL query.
102
-	 * @param array $params The query parameters.
103
-	 * @param array $types The parameter types.
104
-	 * @return int The number of affected rows.
105
-	 * @since 8.0.0
106
-	 *
107
-	 * @deprecated 21.0.0 use executeStatement
108
-	 */
109
-	public function executeUpdate(string $sql, array $params = [], array $types = []): int;
110
-
111
-	/**
112
-	 * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
113
-	 * and returns the number of affected rows.
114
-	 *
115
-	 * This method supports PDO binding types as well as DBAL mapping types.
116
-	 *
117
-	 * @param string $sql The SQL query.
118
-	 * @param array $params The query parameters.
119
-	 * @param array $types The parameter types.
120
-	 * @return int The number of affected rows.
121
-	 * @since 21.0.0
122
-	 */
123
-	public function executeStatement($sql, array $params = [], array $types = []): int;
124
-
125
-	/**
126
-	 * Used to get the id of the just inserted element
127
-	 * @param string $table the name of the table where we inserted the item
128
-	 * @return int the id of the inserted element
129
-	 * @since 6.0.0
130
-	 * @throws Exception since 21.0.0
131
-	 * @deprecated 21.0.0 use \OCP\DB\QueryBuilder\IQueryBuilder::getLastInsertId
132
-	 */
133
-	public function lastInsertId(string $table): int;
134
-
135
-	/**
136
-	 * Insert a row if the matching row does not exists. To accomplish proper race condition avoidance
137
-	 * it is needed that there is also a unique constraint on the values. Then this method will
138
-	 * catch the exception and return 0.
139
-	 *
140
-	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
141
-	 * @param array $input data that should be inserted into the table  (column name => value)
142
-	 * @param array|null $compare List of values that should be checked for "if not exists"
143
-	 *				If this is null or an empty array, all keys of $input will be compared
144
-	 *				Please note: text fields (clob) must not be used in the compare array
145
-	 * @return int number of inserted rows
146
-	 * @throws Exception
147
-	 * @since 6.0.0 - parameter $compare was added in 8.1.0, return type changed from boolean in 8.1.0
148
-	 * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
149
-	 */
150
-	public function insertIfNotExist(string $table, array $input, array $compare = null);
151
-
152
-
153
-	/**
154
-	 *
155
-	 * Insert a row if the row does not exist. Eventual conflicts during insert will be ignored.
156
-	 *
157
-	 * Implementation is not fully finished and should not be used!
158
-	 *
159
-	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
160
-	 * @param array $values data that should be inserted into the table  (column name => value)
161
-	 * @return int number of inserted rows
162
-	 * @since 16.0.0
163
-	 */
164
-	public function insertIgnoreConflict(string $table,array $values) : int;
165
-
166
-	/**
167
-	 * Insert or update a row value
168
-	 *
169
-	 * @param string $table
170
-	 * @param array $keys (column name => value)
171
-	 * @param array $values (column name => value)
172
-	 * @param array $updatePreconditionValues ensure values match preconditions (column name => value)
173
-	 * @return int number of new rows
174
-	 * @throws Exception
175
-	 * @throws PreconditionNotMetException
176
-	 * @since 9.0.0
177
-	 */
178
-	public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []): int;
179
-
180
-	/**
181
-	 * Create an exclusive read+write lock on a table
182
-	 *
183
-	 * Important Note: Due to the nature how locks work on different DBs, it is
184
-	 * only possible to lock one table at a time. You should also NOT start a
185
-	 * transaction while holding a lock.
186
-	 *
187
-	 * @param string $tableName
188
-	 * @since 9.1.0
189
-	 */
190
-	public function lockTable($tableName): void;
191
-
192
-	/**
193
-	 * Release a previous acquired lock again
194
-	 *
195
-	 * @since 9.1.0
196
-	 */
197
-	public function unlockTable(): void;
198
-
199
-	/**
200
-	 * Start a transaction
201
-	 * @since 6.0.0
202
-	 * @throws Exception since 21.0.0
203
-	 */
204
-	public function beginTransaction(): void;
205
-
206
-	/**
207
-	 * Check if a transaction is active
208
-	 *
209
-	 * @return bool
210
-	 * @since 8.2.0
211
-	 */
212
-	public function inTransaction(): bool;
213
-
214
-	/**
215
-	 * Commit the database changes done during a transaction that is in progress
216
-	 * @since 6.0.0
217
-	 * @throws Exception since 21.0.0
218
-	 */
219
-	public function commit(): void;
220
-
221
-	/**
222
-	 * Rollback the database changes done during a transaction that is in progress
223
-	 * @since 6.0.0
224
-	 * @throws Exception since 21.0.0
225
-	 */
226
-	public function rollBack(): void;
227
-
228
-	/**
229
-	 * Gets the error code and message as a string for logging
230
-	 * @return string
231
-	 * @since 6.0.0
232
-	 * @deprecated 21.0.0 doesn't return anything meaningful
233
-	 */
234
-	public function getError(): string;
235
-
236
-	/**
237
-	 * Fetch the SQLSTATE associated with the last database operation.
238
-	 *
239
-	 * @return integer The last error code.
240
-	 * @since 8.0.0
241
-	 * @deprecated 21.0.0 doesn't return anything anymore
242
-	 */
243
-	public function errorCode();
244
-
245
-	/**
246
-	 * Fetch extended error information associated with the last database operation.
247
-	 *
248
-	 * @return array The last error information.
249
-	 * @since 8.0.0
250
-	 * @deprecated 21.0.0 doesn't return anything anymore
251
-	 */
252
-	public function errorInfo();
253
-
254
-	/**
255
-	 * Establishes the connection with the database.
256
-	 *
257
-	 * @return bool
258
-	 * @since 8.0.0
259
-	 */
260
-	public function connect(): bool;
261
-
262
-	/**
263
-	 * Close the database connection
264
-	 * @since 8.0.0
265
-	 */
266
-	public function close(): void;
267
-
268
-	/**
269
-	 * Quotes a given input parameter.
270
-	 *
271
-	 * @param mixed $input Parameter to be quoted.
272
-	 * @param int $type Type of the parameter.
273
-	 * @return mixed The quoted parameter.
274
-	 * @since 8.0.0
275
-	 */
276
-	public function quote($input, $type = IQueryBuilder::PARAM_STR);
277
-
278
-	/**
279
-	 * Gets the DatabasePlatform instance that provides all the metadata about
280
-	 * the platform this driver connects to.
281
-	 *
282
-	 * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
283
-	 * @since 8.0.0
284
-	 */
285
-	public function getDatabasePlatform();
286
-
287
-	/**
288
-	 * Drop a table from the database if it exists
289
-	 *
290
-	 * @param string $table table name without the prefix
291
-	 * @since 8.0.0
292
-	 */
293
-	public function dropTable(string $table): void;
294
-
295
-	/**
296
-	 * Check if a table exists
297
-	 *
298
-	 * @param string $table table name without the prefix
299
-	 * @return bool
300
-	 * @since 8.0.0
301
-	 */
302
-	public function tableExists(string $table): bool;
303
-
304
-	/**
305
-	 * Escape a parameter to be used in a LIKE query
306
-	 *
307
-	 * @param string $param
308
-	 * @return string
309
-	 * @since 9.0.0
310
-	 */
311
-	public function escapeLikeParameter(string $param): string;
312
-
313
-	/**
314
-	 * Check whether or not the current database support 4byte wide unicode
315
-	 *
316
-	 * @return bool
317
-	 * @since 11.0.0
318
-	 */
319
-	public function supports4ByteText(): bool;
320
-
321
-	/**
322
-	 * Create the schema of the connected database
323
-	 *
324
-	 * @return Schema
325
-	 * @since 13.0.0
326
-	 */
327
-	public function createSchema(): Schema;
328
-
329
-	/**
330
-	 * Migrate the database to the given schema
331
-	 *
332
-	 * @param Schema $toSchema
333
-	 * @since 13.0.0
334
-	 */
335
-	public function migrateToSchema(Schema $toSchema): void;
54
+    public const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES';
55
+    public const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES';
56
+    public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class . '::ADD_MISSING_PRIMARY_KEYS';
57
+    public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class . '::CHECK_MISSING_PRIMARY_KEYS';
58
+    public const ADD_MISSING_COLUMNS_EVENT = self::class . '::ADD_MISSING_COLUMNS';
59
+    public const CHECK_MISSING_COLUMNS_EVENT = self::class . '::CHECK_MISSING_COLUMNS';
60
+
61
+    /**
62
+     * Gets the QueryBuilder for the connection.
63
+     *
64
+     * @return \OCP\DB\QueryBuilder\IQueryBuilder
65
+     * @since 8.2.0
66
+     */
67
+    public function getQueryBuilder();
68
+
69
+    /**
70
+     * Used to abstract the ownCloud database access away
71
+     * @param string $sql the sql query with ? placeholder for params
72
+     * @param int $limit the maximum number of rows
73
+     * @param int $offset from which row we want to start
74
+     * @return IPreparedStatement The prepared statement.
75
+     * @since 6.0.0
76
+     * @throws Exception since 21.0.0
77
+     */
78
+    public function prepare($sql, $limit = null, $offset = null): IPreparedStatement;
79
+
80
+    /**
81
+     * Executes an, optionally parameterized, SQL query.
82
+     *
83
+     * If the query is parameterized, a prepared statement is used.
84
+     * If an SQLLogger is configured, the execution is logged.
85
+     *
86
+     * @param string $sql The SQL query to execute.
87
+     * @param string[] $params The parameters to bind to the query, if any.
88
+     * @param array $types The types the previous parameters are in.
89
+     * @return IResult The executed statement.
90
+     * @since 8.0.0
91
+     * @throws Exception since 21.0.0
92
+     */
93
+    public function executeQuery(string $sql, array $params = [], $types = []): IResult;
94
+
95
+    /**
96
+     * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
97
+     * and returns the number of affected rows.
98
+     *
99
+     * This method supports PDO binding types as well as DBAL mapping types.
100
+     *
101
+     * @param string $sql The SQL query.
102
+     * @param array $params The query parameters.
103
+     * @param array $types The parameter types.
104
+     * @return int The number of affected rows.
105
+     * @since 8.0.0
106
+     *
107
+     * @deprecated 21.0.0 use executeStatement
108
+     */
109
+    public function executeUpdate(string $sql, array $params = [], array $types = []): int;
110
+
111
+    /**
112
+     * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
113
+     * and returns the number of affected rows.
114
+     *
115
+     * This method supports PDO binding types as well as DBAL mapping types.
116
+     *
117
+     * @param string $sql The SQL query.
118
+     * @param array $params The query parameters.
119
+     * @param array $types The parameter types.
120
+     * @return int The number of affected rows.
121
+     * @since 21.0.0
122
+     */
123
+    public function executeStatement($sql, array $params = [], array $types = []): int;
124
+
125
+    /**
126
+     * Used to get the id of the just inserted element
127
+     * @param string $table the name of the table where we inserted the item
128
+     * @return int the id of the inserted element
129
+     * @since 6.0.0
130
+     * @throws Exception since 21.0.0
131
+     * @deprecated 21.0.0 use \OCP\DB\QueryBuilder\IQueryBuilder::getLastInsertId
132
+     */
133
+    public function lastInsertId(string $table): int;
134
+
135
+    /**
136
+     * Insert a row if the matching row does not exists. To accomplish proper race condition avoidance
137
+     * it is needed that there is also a unique constraint on the values. Then this method will
138
+     * catch the exception and return 0.
139
+     *
140
+     * @param string $table The table name (will replace *PREFIX* with the actual prefix)
141
+     * @param array $input data that should be inserted into the table  (column name => value)
142
+     * @param array|null $compare List of values that should be checked for "if not exists"
143
+     *				If this is null or an empty array, all keys of $input will be compared
144
+     *				Please note: text fields (clob) must not be used in the compare array
145
+     * @return int number of inserted rows
146
+     * @throws Exception
147
+     * @since 6.0.0 - parameter $compare was added in 8.1.0, return type changed from boolean in 8.1.0
148
+     * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
149
+     */
150
+    public function insertIfNotExist(string $table, array $input, array $compare = null);
151
+
152
+
153
+    /**
154
+     *
155
+     * Insert a row if the row does not exist. Eventual conflicts during insert will be ignored.
156
+     *
157
+     * Implementation is not fully finished and should not be used!
158
+     *
159
+     * @param string $table The table name (will replace *PREFIX* with the actual prefix)
160
+     * @param array $values data that should be inserted into the table  (column name => value)
161
+     * @return int number of inserted rows
162
+     * @since 16.0.0
163
+     */
164
+    public function insertIgnoreConflict(string $table,array $values) : int;
165
+
166
+    /**
167
+     * Insert or update a row value
168
+     *
169
+     * @param string $table
170
+     * @param array $keys (column name => value)
171
+     * @param array $values (column name => value)
172
+     * @param array $updatePreconditionValues ensure values match preconditions (column name => value)
173
+     * @return int number of new rows
174
+     * @throws Exception
175
+     * @throws PreconditionNotMetException
176
+     * @since 9.0.0
177
+     */
178
+    public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []): int;
179
+
180
+    /**
181
+     * Create an exclusive read+write lock on a table
182
+     *
183
+     * Important Note: Due to the nature how locks work on different DBs, it is
184
+     * only possible to lock one table at a time. You should also NOT start a
185
+     * transaction while holding a lock.
186
+     *
187
+     * @param string $tableName
188
+     * @since 9.1.0
189
+     */
190
+    public function lockTable($tableName): void;
191
+
192
+    /**
193
+     * Release a previous acquired lock again
194
+     *
195
+     * @since 9.1.0
196
+     */
197
+    public function unlockTable(): void;
198
+
199
+    /**
200
+     * Start a transaction
201
+     * @since 6.0.0
202
+     * @throws Exception since 21.0.0
203
+     */
204
+    public function beginTransaction(): void;
205
+
206
+    /**
207
+     * Check if a transaction is active
208
+     *
209
+     * @return bool
210
+     * @since 8.2.0
211
+     */
212
+    public function inTransaction(): bool;
213
+
214
+    /**
215
+     * Commit the database changes done during a transaction that is in progress
216
+     * @since 6.0.0
217
+     * @throws Exception since 21.0.0
218
+     */
219
+    public function commit(): void;
220
+
221
+    /**
222
+     * Rollback the database changes done during a transaction that is in progress
223
+     * @since 6.0.0
224
+     * @throws Exception since 21.0.0
225
+     */
226
+    public function rollBack(): void;
227
+
228
+    /**
229
+     * Gets the error code and message as a string for logging
230
+     * @return string
231
+     * @since 6.0.0
232
+     * @deprecated 21.0.0 doesn't return anything meaningful
233
+     */
234
+    public function getError(): string;
235
+
236
+    /**
237
+     * Fetch the SQLSTATE associated with the last database operation.
238
+     *
239
+     * @return integer The last error code.
240
+     * @since 8.0.0
241
+     * @deprecated 21.0.0 doesn't return anything anymore
242
+     */
243
+    public function errorCode();
244
+
245
+    /**
246
+     * Fetch extended error information associated with the last database operation.
247
+     *
248
+     * @return array The last error information.
249
+     * @since 8.0.0
250
+     * @deprecated 21.0.0 doesn't return anything anymore
251
+     */
252
+    public function errorInfo();
253
+
254
+    /**
255
+     * Establishes the connection with the database.
256
+     *
257
+     * @return bool
258
+     * @since 8.0.0
259
+     */
260
+    public function connect(): bool;
261
+
262
+    /**
263
+     * Close the database connection
264
+     * @since 8.0.0
265
+     */
266
+    public function close(): void;
267
+
268
+    /**
269
+     * Quotes a given input parameter.
270
+     *
271
+     * @param mixed $input Parameter to be quoted.
272
+     * @param int $type Type of the parameter.
273
+     * @return mixed The quoted parameter.
274
+     * @since 8.0.0
275
+     */
276
+    public function quote($input, $type = IQueryBuilder::PARAM_STR);
277
+
278
+    /**
279
+     * Gets the DatabasePlatform instance that provides all the metadata about
280
+     * the platform this driver connects to.
281
+     *
282
+     * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
283
+     * @since 8.0.0
284
+     */
285
+    public function getDatabasePlatform();
286
+
287
+    /**
288
+     * Drop a table from the database if it exists
289
+     *
290
+     * @param string $table table name without the prefix
291
+     * @since 8.0.0
292
+     */
293
+    public function dropTable(string $table): void;
294
+
295
+    /**
296
+     * Check if a table exists
297
+     *
298
+     * @param string $table table name without the prefix
299
+     * @return bool
300
+     * @since 8.0.0
301
+     */
302
+    public function tableExists(string $table): bool;
303
+
304
+    /**
305
+     * Escape a parameter to be used in a LIKE query
306
+     *
307
+     * @param string $param
308
+     * @return string
309
+     * @since 9.0.0
310
+     */
311
+    public function escapeLikeParameter(string $param): string;
312
+
313
+    /**
314
+     * Check whether or not the current database support 4byte wide unicode
315
+     *
316
+     * @return bool
317
+     * @since 11.0.0
318
+     */
319
+    public function supports4ByteText(): bool;
320
+
321
+    /**
322
+     * Create the schema of the connected database
323
+     *
324
+     * @return Schema
325
+     * @since 13.0.0
326
+     */
327
+    public function createSchema(): Schema;
328
+
329
+    /**
330
+     * Migrate the database to the given schema
331
+     *
332
+     * @param Schema $toSchema
333
+     * @since 13.0.0
334
+     */
335
+    public function migrateToSchema(Schema $toSchema): void;
336 336
 }
Please login to merge, or discard this patch.
lib/public/DB/QueryBuilder/IQueryBuilder.php 1 patch
Indentation   +871 added lines, -871 removed lines patch added patch discarded remove patch
@@ -37,875 +37,875 @@
 block discarded – undo
37 37
  */
38 38
 interface IQueryBuilder {
39 39
 
40
-	/**
41
-	 * @since 9.0.0
42
-	 */
43
-	public const PARAM_NULL = \PDO::PARAM_NULL;
44
-	/**
45
-	 * @since 9.0.0
46
-	 */
47
-	public const PARAM_BOOL = \PDO::PARAM_BOOL;
48
-	/**
49
-	 * @since 9.0.0
50
-	 */
51
-	public const PARAM_INT = \PDO::PARAM_INT;
52
-	/**
53
-	 * @since 9.0.0
54
-	 */
55
-	public const PARAM_STR = \PDO::PARAM_STR;
56
-	/**
57
-	 * @since 9.0.0
58
-	 */
59
-	public const PARAM_LOB = \PDO::PARAM_LOB;
60
-	/**
61
-	 * @since 9.0.0
62
-	 */
63
-	public const PARAM_DATE = 'datetime';
64
-
65
-	/**
66
-	 * @since 9.0.0
67
-	 */
68
-	public const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY;
69
-	/**
70
-	 * @since 9.0.0
71
-	 */
72
-	public const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY;
73
-
74
-
75
-	/**
76
-	 * Enable/disable automatic prefixing of table names with the oc_ prefix
77
-	 *
78
-	 * @param bool $enabled If set to true table names will be prefixed with the
79
-	 * owncloud database prefix automatically.
80
-	 * @since 8.2.0
81
-	 */
82
-	public function automaticTablePrefix($enabled);
83
-
84
-	/**
85
-	 * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
86
-	 * This producer method is intended for convenient inline usage. Example:
87
-	 *
88
-	 * <code>
89
-	 *     $qb = $conn->getQueryBuilder()
90
-	 *         ->select('u')
91
-	 *         ->from('users', 'u')
92
-	 *         ->where($qb->expr()->eq('u.id', 1));
93
-	 * </code>
94
-	 *
95
-	 * For more complex expression construction, consider storing the expression
96
-	 * builder object in a local variable.
97
-	 *
98
-	 * @return \OCP\DB\QueryBuilder\IExpressionBuilder
99
-	 * @since 8.2.0
100
-	 */
101
-	public function expr();
102
-
103
-	/**
104
-	 * Gets an FunctionBuilder used for object-oriented construction of query functions.
105
-	 * This producer method is intended for convenient inline usage. Example:
106
-	 *
107
-	 * <code>
108
-	 *     $qb = $conn->getQueryBuilder()
109
-	 *         ->select('u')
110
-	 *         ->from('users', 'u')
111
-	 *         ->where($qb->fun()->md5('u.id'));
112
-	 * </code>
113
-	 *
114
-	 * For more complex function construction, consider storing the function
115
-	 * builder object in a local variable.
116
-	 *
117
-	 * @return \OCP\DB\QueryBuilder\IFunctionBuilder
118
-	 * @since 12.0.0
119
-	 */
120
-	public function func();
121
-
122
-	/**
123
-	 * Gets the type of the currently built query.
124
-	 *
125
-	 * @return integer
126
-	 * @since 8.2.0
127
-	 */
128
-	public function getType();
129
-
130
-	/**
131
-	 * Gets the associated DBAL Connection for this query builder.
132
-	 *
133
-	 * @return \OCP\IDBConnection
134
-	 * @since 8.2.0
135
-	 */
136
-	public function getConnection();
137
-
138
-	/**
139
-	 * Gets the state of this query builder instance.
140
-	 *
141
-	 * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
142
-	 * @since 8.2.0
143
-	 */
144
-	public function getState();
145
-
146
-	/**
147
-	 * Executes this query using the bound parameters and their types.
148
-	 *
149
-	 * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
150
-	 * for insert, update and delete statements.
151
-	 *
152
-	 * Warning: until Nextcloud 20, this method could return a \Doctrine\DBAL\Driver\Statement but since
153
-	 *          that interface changed in a breaking way the adapter \OCP\DB\QueryBuilder\IStatement is returned
154
-	 *          to bridge old code to the new API
155
-	 *
156
-	 * @return IResult|int
157
-	 * @since 8.2.0
158
-	 */
159
-	public function execute();
160
-
161
-	/**
162
-	 * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
163
-	 *
164
-	 * <code>
165
-	 *     $qb = $conn->getQueryBuilder()
166
-	 *         ->select('u')
167
-	 *         ->from('User', 'u')
168
-	 *     echo $qb->getSQL(); // SELECT u FROM User u
169
-	 * </code>
170
-	 *
171
-	 * @return string The SQL query string.
172
-	 * @since 8.2.0
173
-	 */
174
-	public function getSQL();
175
-
176
-	/**
177
-	 * Sets a query parameter for the query being constructed.
178
-	 *
179
-	 * <code>
180
-	 *     $qb = $conn->getQueryBuilder()
181
-	 *         ->select('u')
182
-	 *         ->from('users', 'u')
183
-	 *         ->where('u.id = :user_id')
184
-	 *         ->setParameter(':user_id', 1);
185
-	 * </code>
186
-	 *
187
-	 * @param string|integer $key The parameter position or name.
188
-	 * @param mixed $value The parameter value.
189
-	 * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
190
-	 *
191
-	 * @return $this This QueryBuilder instance.
192
-	 * @since 8.2.0
193
-	 */
194
-	public function setParameter($key, $value, $type = null);
195
-
196
-	/**
197
-	 * Sets a collection of query parameters for the query being constructed.
198
-	 *
199
-	 * <code>
200
-	 *     $qb = $conn->getQueryBuilder()
201
-	 *         ->select('u')
202
-	 *         ->from('users', 'u')
203
-	 *         ->where('u.id = :user_id1 OR u.id = :user_id2')
204
-	 *         ->setParameters(array(
205
-	 *             ':user_id1' => 1,
206
-	 *             ':user_id2' => 2
207
-	 *         ));
208
-	 * </code>
209
-	 *
210
-	 * @param array $params The query parameters to set.
211
-	 * @param array $types The query parameters types to set.
212
-	 *
213
-	 * @return $this This QueryBuilder instance.
214
-	 * @since 8.2.0
215
-	 */
216
-	public function setParameters(array $params, array $types = []);
217
-
218
-	/**
219
-	 * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
220
-	 *
221
-	 * @return array The currently defined query parameters indexed by parameter index or name.
222
-	 * @since 8.2.0
223
-	 */
224
-	public function getParameters();
225
-
226
-	/**
227
-	 * Gets a (previously set) query parameter of the query being constructed.
228
-	 *
229
-	 * @param mixed $key The key (index or name) of the bound parameter.
230
-	 *
231
-	 * @return mixed The value of the bound parameter.
232
-	 * @since 8.2.0
233
-	 */
234
-	public function getParameter($key);
235
-
236
-	/**
237
-	 * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
238
-	 *
239
-	 * @return array The currently defined query parameter types indexed by parameter index or name.
240
-	 * @since 8.2.0
241
-	 */
242
-	public function getParameterTypes();
243
-
244
-	/**
245
-	 * Gets a (previously set) query parameter type of the query being constructed.
246
-	 *
247
-	 * @param mixed $key The key (index or name) of the bound parameter type.
248
-	 *
249
-	 * @return mixed The value of the bound parameter type.
250
-	 * @since 8.2.0
251
-	 */
252
-	public function getParameterType($key);
253
-
254
-	/**
255
-	 * Sets the position of the first result to retrieve (the "offset").
256
-	 *
257
-	 * @param integer $firstResult The first result to return.
258
-	 *
259
-	 * @return $this This QueryBuilder instance.
260
-	 * @since 8.2.0
261
-	 */
262
-	public function setFirstResult($firstResult);
263
-
264
-	/**
265
-	 * Gets the position of the first result the query object was set to retrieve (the "offset").
266
-	 * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
267
-	 *
268
-	 * @return integer The position of the first result.
269
-	 * @since 8.2.0
270
-	 */
271
-	public function getFirstResult();
272
-
273
-	/**
274
-	 * Sets the maximum number of results to retrieve (the "limit").
275
-	 *
276
-	 * @param integer $maxResults The maximum number of results to retrieve.
277
-	 *
278
-	 * @return $this This QueryBuilder instance.
279
-	 * @since 8.2.0
280
-	 */
281
-	public function setMaxResults($maxResults);
282
-
283
-	/**
284
-	 * Gets the maximum number of results the query object was set to retrieve (the "limit").
285
-	 * Returns NULL if {@link setMaxResults} was not applied to this query builder.
286
-	 *
287
-	 * @return int|null The maximum number of results.
288
-	 * @since 8.2.0
289
-	 */
290
-	public function getMaxResults();
291
-
292
-	/**
293
-	 * Specifies an item that is to be returned in the query result.
294
-	 * Replaces any previously specified selections, if any.
295
-	 *
296
-	 * <code>
297
-	 *     $qb = $conn->getQueryBuilder()
298
-	 *         ->select('u.id', 'p.id')
299
-	 *         ->from('users', 'u')
300
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
301
-	 * </code>
302
-	 *
303
-	 * @param mixed ...$selects The selection expressions.
304
-	 *
305
-	 * @return $this This QueryBuilder instance.
306
-	 * @since 8.2.0
307
-	 */
308
-	public function select(...$selects);
309
-
310
-	/**
311
-	 * Specifies an item that is to be returned with a different name in the query result.
312
-	 *
313
-	 * <code>
314
-	 *     $qb = $conn->getQueryBuilder()
315
-	 *         ->selectAlias('u.id', 'user_id')
316
-	 *         ->from('users', 'u')
317
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
318
-	 * </code>
319
-	 *
320
-	 * @param mixed $select The selection expressions.
321
-	 * @param string $alias The column alias used in the constructed query.
322
-	 *
323
-	 * @return $this This QueryBuilder instance.
324
-	 * @since 8.2.1
325
-	 */
326
-	public function selectAlias($select, $alias);
327
-
328
-	/**
329
-	 * Specifies an item that is to be returned uniquely in the query result.
330
-	 *
331
-	 * <code>
332
-	 *     $qb = $conn->getQueryBuilder()
333
-	 *         ->selectDistinct('type')
334
-	 *         ->from('users');
335
-	 * </code>
336
-	 *
337
-	 * @param mixed $select The selection expressions.
338
-	 *
339
-	 * @return $this This QueryBuilder instance.
340
-	 * @since 9.0.0
341
-	 */
342
-	public function selectDistinct($select);
343
-
344
-	/**
345
-	 * Adds an item that is to be returned in the query result.
346
-	 *
347
-	 * <code>
348
-	 *     $qb = $conn->getQueryBuilder()
349
-	 *         ->select('u.id')
350
-	 *         ->addSelect('p.id')
351
-	 *         ->from('users', 'u')
352
-	 *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
353
-	 * </code>
354
-	 *
355
-	 * @param mixed ...$select The selection expression.
356
-	 *
357
-	 * @return $this This QueryBuilder instance.
358
-	 * @since 8.2.0
359
-	 */
360
-	public function addSelect(...$select);
361
-
362
-	/**
363
-	 * Turns the query being built into a bulk delete query that ranges over
364
-	 * a certain table.
365
-	 *
366
-	 * <code>
367
-	 *     $qb = $conn->getQueryBuilder()
368
-	 *         ->delete('users', 'u')
369
-	 *         ->where('u.id = :user_id');
370
-	 *         ->setParameter(':user_id', 1);
371
-	 * </code>
372
-	 *
373
-	 * @param string $delete The table whose rows are subject to the deletion.
374
-	 * @param string $alias The table alias used in the constructed query.
375
-	 *
376
-	 * @return $this This QueryBuilder instance.
377
-	 * @since 8.2.0
378
-	 */
379
-	public function delete($delete = null, $alias = null);
380
-
381
-	/**
382
-	 * Turns the query being built into a bulk update query that ranges over
383
-	 * a certain table
384
-	 *
385
-	 * <code>
386
-	 *     $qb = $conn->getQueryBuilder()
387
-	 *         ->update('users', 'u')
388
-	 *         ->set('u.password', md5('password'))
389
-	 *         ->where('u.id = ?');
390
-	 * </code>
391
-	 *
392
-	 * @param string $update The table whose rows are subject to the update.
393
-	 * @param string $alias The table alias used in the constructed query.
394
-	 *
395
-	 * @return $this This QueryBuilder instance.
396
-	 * @since 8.2.0
397
-	 */
398
-	public function update($update = null, $alias = null);
399
-
400
-	/**
401
-	 * Turns the query being built into an insert query that inserts into
402
-	 * a certain table
403
-	 *
404
-	 * <code>
405
-	 *     $qb = $conn->getQueryBuilder()
406
-	 *         ->insert('users')
407
-	 *         ->values(
408
-	 *             array(
409
-	 *                 'name' => '?',
410
-	 *                 'password' => '?'
411
-	 *             )
412
-	 *         );
413
-	 * </code>
414
-	 *
415
-	 * @param string $insert The table into which the rows should be inserted.
416
-	 *
417
-	 * @return $this This QueryBuilder instance.
418
-	 * @since 8.2.0
419
-	 */
420
-	public function insert($insert = null);
421
-
422
-	/**
423
-	 * Creates and adds a query root corresponding to the table identified by the
424
-	 * given alias, forming a cartesian product with any existing query roots.
425
-	 *
426
-	 * <code>
427
-	 *     $qb = $conn->getQueryBuilder()
428
-	 *         ->select('u.id')
429
-	 *         ->from('users', 'u')
430
-	 * </code>
431
-	 *
432
-	 * @param string $from The table.
433
-	 * @param string|null $alias The alias of the table.
434
-	 *
435
-	 * @return $this This QueryBuilder instance.
436
-	 * @since 8.2.0
437
-	 */
438
-	public function from($from, $alias = null);
439
-
440
-	/**
441
-	 * Creates and adds a join to the query.
442
-	 *
443
-	 * <code>
444
-	 *     $qb = $conn->getQueryBuilder()
445
-	 *         ->select('u.name')
446
-	 *         ->from('users', 'u')
447
-	 *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
448
-	 * </code>
449
-	 *
450
-	 * @param string $fromAlias The alias that points to a from clause.
451
-	 * @param string $join The table name to join.
452
-	 * @param string $alias The alias of the join table.
453
-	 * @param string $condition The condition for the join.
454
-	 *
455
-	 * @return $this This QueryBuilder instance.
456
-	 * @since 8.2.0
457
-	 */
458
-	public function join($fromAlias, $join, $alias, $condition = null);
459
-
460
-	/**
461
-	 * Creates and adds a join to the query.
462
-	 *
463
-	 * <code>
464
-	 *     $qb = $conn->getQueryBuilder()
465
-	 *         ->select('u.name')
466
-	 *         ->from('users', 'u')
467
-	 *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
468
-	 * </code>
469
-	 *
470
-	 * @param string $fromAlias The alias that points to a from clause.
471
-	 * @param string $join The table name to join.
472
-	 * @param string $alias The alias of the join table.
473
-	 * @param string $condition The condition for the join.
474
-	 *
475
-	 * @return $this This QueryBuilder instance.
476
-	 * @since 8.2.0
477
-	 */
478
-	public function innerJoin($fromAlias, $join, $alias, $condition = null);
479
-
480
-	/**
481
-	 * Creates and adds a left join to the query.
482
-	 *
483
-	 * <code>
484
-	 *     $qb = $conn->getQueryBuilder()
485
-	 *         ->select('u.name')
486
-	 *         ->from('users', 'u')
487
-	 *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
488
-	 * </code>
489
-	 *
490
-	 * @param string $fromAlias The alias that points to a from clause.
491
-	 * @param string $join The table name to join.
492
-	 * @param string $alias The alias of the join table.
493
-	 * @param string $condition The condition for the join.
494
-	 *
495
-	 * @return $this This QueryBuilder instance.
496
-	 * @since 8.2.0
497
-	 */
498
-	public function leftJoin($fromAlias, $join, $alias, $condition = null);
499
-
500
-	/**
501
-	 * Creates and adds a right join to the query.
502
-	 *
503
-	 * <code>
504
-	 *     $qb = $conn->getQueryBuilder()
505
-	 *         ->select('u.name')
506
-	 *         ->from('users', 'u')
507
-	 *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
508
-	 * </code>
509
-	 *
510
-	 * @param string $fromAlias The alias that points to a from clause.
511
-	 * @param string $join The table name to join.
512
-	 * @param string $alias The alias of the join table.
513
-	 * @param string $condition The condition for the join.
514
-	 *
515
-	 * @return $this This QueryBuilder instance.
516
-	 * @since 8.2.0
517
-	 */
518
-	public function rightJoin($fromAlias, $join, $alias, $condition = null);
519
-
520
-	/**
521
-	 * Sets a new value for a column in a bulk update query.
522
-	 *
523
-	 * <code>
524
-	 *     $qb = $conn->getQueryBuilder()
525
-	 *         ->update('users', 'u')
526
-	 *         ->set('u.password', md5('password'))
527
-	 *         ->where('u.id = ?');
528
-	 * </code>
529
-	 *
530
-	 * @param string $key The column to set.
531
-	 * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
532
-	 *
533
-	 * @return $this This QueryBuilder instance.
534
-	 * @since 8.2.0
535
-	 */
536
-	public function set($key, $value);
537
-
538
-	/**
539
-	 * Specifies one or more restrictions to the query result.
540
-	 * Replaces any previously specified restrictions, if any.
541
-	 *
542
-	 * <code>
543
-	 *     $qb = $conn->getQueryBuilder()
544
-	 *         ->select('u.name')
545
-	 *         ->from('users', 'u')
546
-	 *         ->where('u.id = ?');
547
-	 *
548
-	 *     // You can optionally programatically build and/or expressions
549
-	 *     $qb = $conn->getQueryBuilder();
550
-	 *
551
-	 *     $or = $qb->expr()->orx();
552
-	 *     $or->add($qb->expr()->eq('u.id', 1));
553
-	 *     $or->add($qb->expr()->eq('u.id', 2));
554
-	 *
555
-	 *     $qb->update('users', 'u')
556
-	 *         ->set('u.password', md5('password'))
557
-	 *         ->where($or);
558
-	 * </code>
559
-	 *
560
-	 * @param mixed $predicates The restriction predicates.
561
-	 *
562
-	 * @return $this This QueryBuilder instance.
563
-	 * @since 8.2.0
564
-	 */
565
-	public function where(...$predicates);
566
-
567
-	/**
568
-	 * Adds one or more restrictions to the query results, forming a logical
569
-	 * conjunction with any previously specified restrictions.
570
-	 *
571
-	 * <code>
572
-	 *     $qb = $conn->getQueryBuilder()
573
-	 *         ->select('u')
574
-	 *         ->from('users', 'u')
575
-	 *         ->where('u.username LIKE ?')
576
-	 *         ->andWhere('u.is_active = 1');
577
-	 * </code>
578
-	 *
579
-	 * @param mixed ...$where The query restrictions.
580
-	 *
581
-	 * @return $this This QueryBuilder instance.
582
-	 *
583
-	 * @see where()
584
-	 * @since 8.2.0
585
-	 */
586
-	public function andWhere(...$where);
587
-
588
-	/**
589
-	 * Adds one or more restrictions to the query results, forming a logical
590
-	 * disjunction with any previously specified restrictions.
591
-	 *
592
-	 * <code>
593
-	 *     $qb = $conn->getQueryBuilder()
594
-	 *         ->select('u.name')
595
-	 *         ->from('users', 'u')
596
-	 *         ->where('u.id = 1')
597
-	 *         ->orWhere('u.id = 2');
598
-	 * </code>
599
-	 *
600
-	 * @param mixed ...$where The WHERE statement.
601
-	 *
602
-	 * @return $this This QueryBuilder instance.
603
-	 *
604
-	 * @see where()
605
-	 * @since 8.2.0
606
-	 */
607
-	public function orWhere(...$where);
608
-
609
-	/**
610
-	 * Specifies a grouping over the results of the query.
611
-	 * Replaces any previously specified groupings, if any.
612
-	 *
613
-	 * <code>
614
-	 *     $qb = $conn->getQueryBuilder()
615
-	 *         ->select('u.name')
616
-	 *         ->from('users', 'u')
617
-	 *         ->groupBy('u.id');
618
-	 * </code>
619
-	 *
620
-	 * @param mixed ...$groupBys The grouping expression.
621
-	 *
622
-	 * @return $this This QueryBuilder instance.
623
-	 * @since 8.2.0
624
-	 */
625
-	public function groupBy(...$groupBys);
626
-
627
-	/**
628
-	 * Adds a grouping expression to the query.
629
-	 *
630
-	 * <code>
631
-	 *     $qb = $conn->getQueryBuilder()
632
-	 *         ->select('u.name')
633
-	 *         ->from('users', 'u')
634
-	 *         ->groupBy('u.lastLogin');
635
-	 *         ->addGroupBy('u.createdAt')
636
-	 * </code>
637
-	 *
638
-	 * @param mixed ...$groupBy The grouping expression.
639
-	 *
640
-	 * @return $this This QueryBuilder instance.
641
-	 * @since 8.2.0
642
-	 */
643
-	public function addGroupBy(...$groupBy);
644
-
645
-	/**
646
-	 * Sets a value for a column in an insert query.
647
-	 *
648
-	 * <code>
649
-	 *     $qb = $conn->getQueryBuilder()
650
-	 *         ->insert('users')
651
-	 *         ->values(
652
-	 *             array(
653
-	 *                 'name' => '?'
654
-	 *             )
655
-	 *         )
656
-	 *         ->setValue('password', '?');
657
-	 * </code>
658
-	 *
659
-	 * @param string $column The column into which the value should be inserted.
660
-	 * @param IParameter|string $value The value that should be inserted into the column.
661
-	 *
662
-	 * @return $this This QueryBuilder instance.
663
-	 * @since 8.2.0
664
-	 */
665
-	public function setValue($column, $value);
666
-
667
-	/**
668
-	 * Specifies values for an insert query indexed by column names.
669
-	 * Replaces any previous values, if any.
670
-	 *
671
-	 * <code>
672
-	 *     $qb = $conn->getQueryBuilder()
673
-	 *         ->insert('users')
674
-	 *         ->values(
675
-	 *             array(
676
-	 *                 'name' => '?',
677
-	 *                 'password' => '?'
678
-	 *             )
679
-	 *         );
680
-	 * </code>
681
-	 *
682
-	 * @param array $values The values to specify for the insert query indexed by column names.
683
-	 *
684
-	 * @return $this This QueryBuilder instance.
685
-	 * @since 8.2.0
686
-	 */
687
-	public function values(array $values);
688
-
689
-	/**
690
-	 * Specifies a restriction over the groups of the query.
691
-	 * Replaces any previous having restrictions, if any.
692
-	 *
693
-	 * @param mixed ...$having The restriction over the groups.
694
-	 *
695
-	 * @return $this This QueryBuilder instance.
696
-	 * @since 8.2.0
697
-	 */
698
-	public function having(...$having);
699
-
700
-	/**
701
-	 * Adds a restriction over the groups of the query, forming a logical
702
-	 * conjunction with any existing having restrictions.
703
-	 *
704
-	 * @param mixed ...$having The restriction to append.
705
-	 *
706
-	 * @return $this This QueryBuilder instance.
707
-	 * @since 8.2.0
708
-	 */
709
-	public function andHaving(...$having);
710
-
711
-	/**
712
-	 * Adds a restriction over the groups of the query, forming a logical
713
-	 * disjunction with any existing having restrictions.
714
-	 *
715
-	 * @param mixed ...$having The restriction to add.
716
-	 *
717
-	 * @return $this This QueryBuilder instance.
718
-	 * @since 8.2.0
719
-	 */
720
-	public function orHaving(...$having);
721
-
722
-	/**
723
-	 * Specifies an ordering for the query results.
724
-	 * Replaces any previously specified orderings, if any.
725
-	 *
726
-	 * @param string $sort The ordering expression.
727
-	 * @param string $order The ordering direction.
728
-	 *
729
-	 * @return $this This QueryBuilder instance.
730
-	 * @since 8.2.0
731
-	 */
732
-	public function orderBy($sort, $order = null);
733
-
734
-	/**
735
-	 * Adds an ordering to the query results.
736
-	 *
737
-	 * @param string $sort The ordering expression.
738
-	 * @param string $order The ordering direction.
739
-	 *
740
-	 * @return $this This QueryBuilder instance.
741
-	 * @since 8.2.0
742
-	 */
743
-	public function addOrderBy($sort, $order = null);
744
-
745
-	/**
746
-	 * Gets a query part by its name.
747
-	 *
748
-	 * @param string $queryPartName
749
-	 *
750
-	 * @return mixed
751
-	 * @since 8.2.0
752
-	 */
753
-	public function getQueryPart($queryPartName);
754
-
755
-	/**
756
-	 * Gets all query parts.
757
-	 *
758
-	 * @return array
759
-	 * @since 8.2.0
760
-	 */
761
-	public function getQueryParts();
762
-
763
-	/**
764
-	 * Resets SQL parts.
765
-	 *
766
-	 * @param array|null $queryPartNames
767
-	 *
768
-	 * @return $this This QueryBuilder instance.
769
-	 * @since 8.2.0
770
-	 */
771
-	public function resetQueryParts($queryPartNames = null);
772
-
773
-	/**
774
-	 * Resets a single SQL part.
775
-	 *
776
-	 * @param string $queryPartName
777
-	 *
778
-	 * @return $this This QueryBuilder instance.
779
-	 * @since 8.2.0
780
-	 */
781
-	public function resetQueryPart($queryPartName);
782
-
783
-	/**
784
-	 * Creates a new named parameter and bind the value $value to it.
785
-	 *
786
-	 * This method provides a shortcut for PDOStatement::bindValue
787
-	 * when using prepared statements.
788
-	 *
789
-	 * The parameter $value specifies the value that you want to bind. If
790
-	 * $placeholder is not provided bindValue() will automatically create a
791
-	 * placeholder for you. An automatic placeholder will be of the name
792
-	 * ':dcValue1', ':dcValue2' etc.
793
-	 *
794
-	 * For more information see {@link https://www.php.net/pdostatement-bindparam}
795
-	 *
796
-	 * Example:
797
-	 * <code>
798
-	 * $value = 2;
799
-	 * $q->eq( 'id', $q->bindValue( $value ) );
800
-	 * $stmt = $q->executeQuery(); // executed with 'id = 2'
801
-	 * </code>
802
-	 *
803
-	 * @license New BSD License
804
-	 * @link http://www.zetacomponents.org
805
-	 *
806
-	 * @param mixed $value
807
-	 * @param mixed $type
808
-	 * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
809
-	 *
810
-	 * @return IParameter
811
-	 * @since 8.2.0
812
-	 */
813
-	public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
814
-
815
-	/**
816
-	 * Creates a new positional parameter and bind the given value to it.
817
-	 *
818
-	 * Attention: If you are using positional parameters with the query builder you have
819
-	 * to be very careful to bind all parameters in the order they appear in the SQL
820
-	 * statement , otherwise they get bound in the wrong order which can lead to serious
821
-	 * bugs in your code.
822
-	 *
823
-	 * Example:
824
-	 * <code>
825
-	 *  $qb = $conn->getQueryBuilder();
826
-	 *  $qb->select('u.*')
827
-	 *     ->from('users', 'u')
828
-	 *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
829
-	 *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
830
-	 * </code>
831
-	 *
832
-	 * @param mixed $value
833
-	 * @param integer $type
834
-	 *
835
-	 * @return IParameter
836
-	 * @since 8.2.0
837
-	 */
838
-	public function createPositionalParameter($value, $type = self::PARAM_STR);
839
-
840
-	/**
841
-	 * Creates a new parameter
842
-	 *
843
-	 * Example:
844
-	 * <code>
845
-	 *  $qb = $conn->getQueryBuilder();
846
-	 *  $qb->select('u.*')
847
-	 *     ->from('users', 'u')
848
-	 *     ->where('u.username = ' . $qb->createParameter('name'))
849
-	 *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
850
-	 * </code>
851
-	 *
852
-	 * @param string $name
853
-	 *
854
-	 * @return IParameter
855
-	 * @since 8.2.0
856
-	 */
857
-	public function createParameter($name);
858
-
859
-	/**
860
-	 * Creates a new function
861
-	 *
862
-	 * Attention: Column names inside the call have to be quoted before hand
863
-	 *
864
-	 * Example:
865
-	 * <code>
866
-	 *  $qb = $conn->getQueryBuilder();
867
-	 *  $qb->select($qb->createFunction('COUNT(*)'))
868
-	 *     ->from('users', 'u')
869
-	 *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
870
-	 * </code>
871
-	 * <code>
872
-	 *  $qb = $conn->getQueryBuilder();
873
-	 *  $qb->select($qb->createFunction('COUNT(`column`)'))
874
-	 *     ->from('users', 'u')
875
-	 *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
876
-	 * </code>
877
-	 *
878
-	 * @param string $call
879
-	 *
880
-	 * @return IQueryFunction
881
-	 * @since 8.2.0
882
-	 */
883
-	public function createFunction($call);
884
-
885
-	/**
886
-	 * Used to get the id of the last inserted element
887
-	 * @return int
888
-	 * @throws \BadMethodCallException When being called before an insert query has been run.
889
-	 * @since 9.0.0
890
-	 */
891
-	public function getLastInsertId();
892
-
893
-	/**
894
-	 * Returns the table name quoted and with database prefix as needed by the implementation
895
-	 *
896
-	 * @param string $table
897
-	 * @return string
898
-	 * @since 9.0.0
899
-	 */
900
-	public function getTableName($table);
901
-
902
-	/**
903
-	 * Returns the column name quoted and with table alias prefix as needed by the implementation
904
-	 *
905
-	 * @param string $column
906
-	 * @param string $tableAlias
907
-	 * @return string
908
-	 * @since 9.0.0
909
-	 */
910
-	public function getColumnName($column, $tableAlias = '');
40
+    /**
41
+     * @since 9.0.0
42
+     */
43
+    public const PARAM_NULL = \PDO::PARAM_NULL;
44
+    /**
45
+     * @since 9.0.0
46
+     */
47
+    public const PARAM_BOOL = \PDO::PARAM_BOOL;
48
+    /**
49
+     * @since 9.0.0
50
+     */
51
+    public const PARAM_INT = \PDO::PARAM_INT;
52
+    /**
53
+     * @since 9.0.0
54
+     */
55
+    public const PARAM_STR = \PDO::PARAM_STR;
56
+    /**
57
+     * @since 9.0.0
58
+     */
59
+    public const PARAM_LOB = \PDO::PARAM_LOB;
60
+    /**
61
+     * @since 9.0.0
62
+     */
63
+    public const PARAM_DATE = 'datetime';
64
+
65
+    /**
66
+     * @since 9.0.0
67
+     */
68
+    public const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY;
69
+    /**
70
+     * @since 9.0.0
71
+     */
72
+    public const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY;
73
+
74
+
75
+    /**
76
+     * Enable/disable automatic prefixing of table names with the oc_ prefix
77
+     *
78
+     * @param bool $enabled If set to true table names will be prefixed with the
79
+     * owncloud database prefix automatically.
80
+     * @since 8.2.0
81
+     */
82
+    public function automaticTablePrefix($enabled);
83
+
84
+    /**
85
+     * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
86
+     * This producer method is intended for convenient inline usage. Example:
87
+     *
88
+     * <code>
89
+     *     $qb = $conn->getQueryBuilder()
90
+     *         ->select('u')
91
+     *         ->from('users', 'u')
92
+     *         ->where($qb->expr()->eq('u.id', 1));
93
+     * </code>
94
+     *
95
+     * For more complex expression construction, consider storing the expression
96
+     * builder object in a local variable.
97
+     *
98
+     * @return \OCP\DB\QueryBuilder\IExpressionBuilder
99
+     * @since 8.2.0
100
+     */
101
+    public function expr();
102
+
103
+    /**
104
+     * Gets an FunctionBuilder used for object-oriented construction of query functions.
105
+     * This producer method is intended for convenient inline usage. Example:
106
+     *
107
+     * <code>
108
+     *     $qb = $conn->getQueryBuilder()
109
+     *         ->select('u')
110
+     *         ->from('users', 'u')
111
+     *         ->where($qb->fun()->md5('u.id'));
112
+     * </code>
113
+     *
114
+     * For more complex function construction, consider storing the function
115
+     * builder object in a local variable.
116
+     *
117
+     * @return \OCP\DB\QueryBuilder\IFunctionBuilder
118
+     * @since 12.0.0
119
+     */
120
+    public function func();
121
+
122
+    /**
123
+     * Gets the type of the currently built query.
124
+     *
125
+     * @return integer
126
+     * @since 8.2.0
127
+     */
128
+    public function getType();
129
+
130
+    /**
131
+     * Gets the associated DBAL Connection for this query builder.
132
+     *
133
+     * @return \OCP\IDBConnection
134
+     * @since 8.2.0
135
+     */
136
+    public function getConnection();
137
+
138
+    /**
139
+     * Gets the state of this query builder instance.
140
+     *
141
+     * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
142
+     * @since 8.2.0
143
+     */
144
+    public function getState();
145
+
146
+    /**
147
+     * Executes this query using the bound parameters and their types.
148
+     *
149
+     * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
150
+     * for insert, update and delete statements.
151
+     *
152
+     * Warning: until Nextcloud 20, this method could return a \Doctrine\DBAL\Driver\Statement but since
153
+     *          that interface changed in a breaking way the adapter \OCP\DB\QueryBuilder\IStatement is returned
154
+     *          to bridge old code to the new API
155
+     *
156
+     * @return IResult|int
157
+     * @since 8.2.0
158
+     */
159
+    public function execute();
160
+
161
+    /**
162
+     * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
163
+     *
164
+     * <code>
165
+     *     $qb = $conn->getQueryBuilder()
166
+     *         ->select('u')
167
+     *         ->from('User', 'u')
168
+     *     echo $qb->getSQL(); // SELECT u FROM User u
169
+     * </code>
170
+     *
171
+     * @return string The SQL query string.
172
+     * @since 8.2.0
173
+     */
174
+    public function getSQL();
175
+
176
+    /**
177
+     * Sets a query parameter for the query being constructed.
178
+     *
179
+     * <code>
180
+     *     $qb = $conn->getQueryBuilder()
181
+     *         ->select('u')
182
+     *         ->from('users', 'u')
183
+     *         ->where('u.id = :user_id')
184
+     *         ->setParameter(':user_id', 1);
185
+     * </code>
186
+     *
187
+     * @param string|integer $key The parameter position or name.
188
+     * @param mixed $value The parameter value.
189
+     * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
190
+     *
191
+     * @return $this This QueryBuilder instance.
192
+     * @since 8.2.0
193
+     */
194
+    public function setParameter($key, $value, $type = null);
195
+
196
+    /**
197
+     * Sets a collection of query parameters for the query being constructed.
198
+     *
199
+     * <code>
200
+     *     $qb = $conn->getQueryBuilder()
201
+     *         ->select('u')
202
+     *         ->from('users', 'u')
203
+     *         ->where('u.id = :user_id1 OR u.id = :user_id2')
204
+     *         ->setParameters(array(
205
+     *             ':user_id1' => 1,
206
+     *             ':user_id2' => 2
207
+     *         ));
208
+     * </code>
209
+     *
210
+     * @param array $params The query parameters to set.
211
+     * @param array $types The query parameters types to set.
212
+     *
213
+     * @return $this This QueryBuilder instance.
214
+     * @since 8.2.0
215
+     */
216
+    public function setParameters(array $params, array $types = []);
217
+
218
+    /**
219
+     * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
220
+     *
221
+     * @return array The currently defined query parameters indexed by parameter index or name.
222
+     * @since 8.2.0
223
+     */
224
+    public function getParameters();
225
+
226
+    /**
227
+     * Gets a (previously set) query parameter of the query being constructed.
228
+     *
229
+     * @param mixed $key The key (index or name) of the bound parameter.
230
+     *
231
+     * @return mixed The value of the bound parameter.
232
+     * @since 8.2.0
233
+     */
234
+    public function getParameter($key);
235
+
236
+    /**
237
+     * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
238
+     *
239
+     * @return array The currently defined query parameter types indexed by parameter index or name.
240
+     * @since 8.2.0
241
+     */
242
+    public function getParameterTypes();
243
+
244
+    /**
245
+     * Gets a (previously set) query parameter type of the query being constructed.
246
+     *
247
+     * @param mixed $key The key (index or name) of the bound parameter type.
248
+     *
249
+     * @return mixed The value of the bound parameter type.
250
+     * @since 8.2.0
251
+     */
252
+    public function getParameterType($key);
253
+
254
+    /**
255
+     * Sets the position of the first result to retrieve (the "offset").
256
+     *
257
+     * @param integer $firstResult The first result to return.
258
+     *
259
+     * @return $this This QueryBuilder instance.
260
+     * @since 8.2.0
261
+     */
262
+    public function setFirstResult($firstResult);
263
+
264
+    /**
265
+     * Gets the position of the first result the query object was set to retrieve (the "offset").
266
+     * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
267
+     *
268
+     * @return integer The position of the first result.
269
+     * @since 8.2.0
270
+     */
271
+    public function getFirstResult();
272
+
273
+    /**
274
+     * Sets the maximum number of results to retrieve (the "limit").
275
+     *
276
+     * @param integer $maxResults The maximum number of results to retrieve.
277
+     *
278
+     * @return $this This QueryBuilder instance.
279
+     * @since 8.2.0
280
+     */
281
+    public function setMaxResults($maxResults);
282
+
283
+    /**
284
+     * Gets the maximum number of results the query object was set to retrieve (the "limit").
285
+     * Returns NULL if {@link setMaxResults} was not applied to this query builder.
286
+     *
287
+     * @return int|null The maximum number of results.
288
+     * @since 8.2.0
289
+     */
290
+    public function getMaxResults();
291
+
292
+    /**
293
+     * Specifies an item that is to be returned in the query result.
294
+     * Replaces any previously specified selections, if any.
295
+     *
296
+     * <code>
297
+     *     $qb = $conn->getQueryBuilder()
298
+     *         ->select('u.id', 'p.id')
299
+     *         ->from('users', 'u')
300
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
301
+     * </code>
302
+     *
303
+     * @param mixed ...$selects The selection expressions.
304
+     *
305
+     * @return $this This QueryBuilder instance.
306
+     * @since 8.2.0
307
+     */
308
+    public function select(...$selects);
309
+
310
+    /**
311
+     * Specifies an item that is to be returned with a different name in the query result.
312
+     *
313
+     * <code>
314
+     *     $qb = $conn->getQueryBuilder()
315
+     *         ->selectAlias('u.id', 'user_id')
316
+     *         ->from('users', 'u')
317
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
318
+     * </code>
319
+     *
320
+     * @param mixed $select The selection expressions.
321
+     * @param string $alias The column alias used in the constructed query.
322
+     *
323
+     * @return $this This QueryBuilder instance.
324
+     * @since 8.2.1
325
+     */
326
+    public function selectAlias($select, $alias);
327
+
328
+    /**
329
+     * Specifies an item that is to be returned uniquely in the query result.
330
+     *
331
+     * <code>
332
+     *     $qb = $conn->getQueryBuilder()
333
+     *         ->selectDistinct('type')
334
+     *         ->from('users');
335
+     * </code>
336
+     *
337
+     * @param mixed $select The selection expressions.
338
+     *
339
+     * @return $this This QueryBuilder instance.
340
+     * @since 9.0.0
341
+     */
342
+    public function selectDistinct($select);
343
+
344
+    /**
345
+     * Adds an item that is to be returned in the query result.
346
+     *
347
+     * <code>
348
+     *     $qb = $conn->getQueryBuilder()
349
+     *         ->select('u.id')
350
+     *         ->addSelect('p.id')
351
+     *         ->from('users', 'u')
352
+     *         ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
353
+     * </code>
354
+     *
355
+     * @param mixed ...$select The selection expression.
356
+     *
357
+     * @return $this This QueryBuilder instance.
358
+     * @since 8.2.0
359
+     */
360
+    public function addSelect(...$select);
361
+
362
+    /**
363
+     * Turns the query being built into a bulk delete query that ranges over
364
+     * a certain table.
365
+     *
366
+     * <code>
367
+     *     $qb = $conn->getQueryBuilder()
368
+     *         ->delete('users', 'u')
369
+     *         ->where('u.id = :user_id');
370
+     *         ->setParameter(':user_id', 1);
371
+     * </code>
372
+     *
373
+     * @param string $delete The table whose rows are subject to the deletion.
374
+     * @param string $alias The table alias used in the constructed query.
375
+     *
376
+     * @return $this This QueryBuilder instance.
377
+     * @since 8.2.0
378
+     */
379
+    public function delete($delete = null, $alias = null);
380
+
381
+    /**
382
+     * Turns the query being built into a bulk update query that ranges over
383
+     * a certain table
384
+     *
385
+     * <code>
386
+     *     $qb = $conn->getQueryBuilder()
387
+     *         ->update('users', 'u')
388
+     *         ->set('u.password', md5('password'))
389
+     *         ->where('u.id = ?');
390
+     * </code>
391
+     *
392
+     * @param string $update The table whose rows are subject to the update.
393
+     * @param string $alias The table alias used in the constructed query.
394
+     *
395
+     * @return $this This QueryBuilder instance.
396
+     * @since 8.2.0
397
+     */
398
+    public function update($update = null, $alias = null);
399
+
400
+    /**
401
+     * Turns the query being built into an insert query that inserts into
402
+     * a certain table
403
+     *
404
+     * <code>
405
+     *     $qb = $conn->getQueryBuilder()
406
+     *         ->insert('users')
407
+     *         ->values(
408
+     *             array(
409
+     *                 'name' => '?',
410
+     *                 'password' => '?'
411
+     *             )
412
+     *         );
413
+     * </code>
414
+     *
415
+     * @param string $insert The table into which the rows should be inserted.
416
+     *
417
+     * @return $this This QueryBuilder instance.
418
+     * @since 8.2.0
419
+     */
420
+    public function insert($insert = null);
421
+
422
+    /**
423
+     * Creates and adds a query root corresponding to the table identified by the
424
+     * given alias, forming a cartesian product with any existing query roots.
425
+     *
426
+     * <code>
427
+     *     $qb = $conn->getQueryBuilder()
428
+     *         ->select('u.id')
429
+     *         ->from('users', 'u')
430
+     * </code>
431
+     *
432
+     * @param string $from The table.
433
+     * @param string|null $alias The alias of the table.
434
+     *
435
+     * @return $this This QueryBuilder instance.
436
+     * @since 8.2.0
437
+     */
438
+    public function from($from, $alias = null);
439
+
440
+    /**
441
+     * Creates and adds a join to the query.
442
+     *
443
+     * <code>
444
+     *     $qb = $conn->getQueryBuilder()
445
+     *         ->select('u.name')
446
+     *         ->from('users', 'u')
447
+     *         ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
448
+     * </code>
449
+     *
450
+     * @param string $fromAlias The alias that points to a from clause.
451
+     * @param string $join The table name to join.
452
+     * @param string $alias The alias of the join table.
453
+     * @param string $condition The condition for the join.
454
+     *
455
+     * @return $this This QueryBuilder instance.
456
+     * @since 8.2.0
457
+     */
458
+    public function join($fromAlias, $join, $alias, $condition = null);
459
+
460
+    /**
461
+     * Creates and adds a join to the query.
462
+     *
463
+     * <code>
464
+     *     $qb = $conn->getQueryBuilder()
465
+     *         ->select('u.name')
466
+     *         ->from('users', 'u')
467
+     *         ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
468
+     * </code>
469
+     *
470
+     * @param string $fromAlias The alias that points to a from clause.
471
+     * @param string $join The table name to join.
472
+     * @param string $alias The alias of the join table.
473
+     * @param string $condition The condition for the join.
474
+     *
475
+     * @return $this This QueryBuilder instance.
476
+     * @since 8.2.0
477
+     */
478
+    public function innerJoin($fromAlias, $join, $alias, $condition = null);
479
+
480
+    /**
481
+     * Creates and adds a left join to the query.
482
+     *
483
+     * <code>
484
+     *     $qb = $conn->getQueryBuilder()
485
+     *         ->select('u.name')
486
+     *         ->from('users', 'u')
487
+     *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
488
+     * </code>
489
+     *
490
+     * @param string $fromAlias The alias that points to a from clause.
491
+     * @param string $join The table name to join.
492
+     * @param string $alias The alias of the join table.
493
+     * @param string $condition The condition for the join.
494
+     *
495
+     * @return $this This QueryBuilder instance.
496
+     * @since 8.2.0
497
+     */
498
+    public function leftJoin($fromAlias, $join, $alias, $condition = null);
499
+
500
+    /**
501
+     * Creates and adds a right join to the query.
502
+     *
503
+     * <code>
504
+     *     $qb = $conn->getQueryBuilder()
505
+     *         ->select('u.name')
506
+     *         ->from('users', 'u')
507
+     *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
508
+     * </code>
509
+     *
510
+     * @param string $fromAlias The alias that points to a from clause.
511
+     * @param string $join The table name to join.
512
+     * @param string $alias The alias of the join table.
513
+     * @param string $condition The condition for the join.
514
+     *
515
+     * @return $this This QueryBuilder instance.
516
+     * @since 8.2.0
517
+     */
518
+    public function rightJoin($fromAlias, $join, $alias, $condition = null);
519
+
520
+    /**
521
+     * Sets a new value for a column in a bulk update query.
522
+     *
523
+     * <code>
524
+     *     $qb = $conn->getQueryBuilder()
525
+     *         ->update('users', 'u')
526
+     *         ->set('u.password', md5('password'))
527
+     *         ->where('u.id = ?');
528
+     * </code>
529
+     *
530
+     * @param string $key The column to set.
531
+     * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
532
+     *
533
+     * @return $this This QueryBuilder instance.
534
+     * @since 8.2.0
535
+     */
536
+    public function set($key, $value);
537
+
538
+    /**
539
+     * Specifies one or more restrictions to the query result.
540
+     * Replaces any previously specified restrictions, if any.
541
+     *
542
+     * <code>
543
+     *     $qb = $conn->getQueryBuilder()
544
+     *         ->select('u.name')
545
+     *         ->from('users', 'u')
546
+     *         ->where('u.id = ?');
547
+     *
548
+     *     // You can optionally programatically build and/or expressions
549
+     *     $qb = $conn->getQueryBuilder();
550
+     *
551
+     *     $or = $qb->expr()->orx();
552
+     *     $or->add($qb->expr()->eq('u.id', 1));
553
+     *     $or->add($qb->expr()->eq('u.id', 2));
554
+     *
555
+     *     $qb->update('users', 'u')
556
+     *         ->set('u.password', md5('password'))
557
+     *         ->where($or);
558
+     * </code>
559
+     *
560
+     * @param mixed $predicates The restriction predicates.
561
+     *
562
+     * @return $this This QueryBuilder instance.
563
+     * @since 8.2.0
564
+     */
565
+    public function where(...$predicates);
566
+
567
+    /**
568
+     * Adds one or more restrictions to the query results, forming a logical
569
+     * conjunction with any previously specified restrictions.
570
+     *
571
+     * <code>
572
+     *     $qb = $conn->getQueryBuilder()
573
+     *         ->select('u')
574
+     *         ->from('users', 'u')
575
+     *         ->where('u.username LIKE ?')
576
+     *         ->andWhere('u.is_active = 1');
577
+     * </code>
578
+     *
579
+     * @param mixed ...$where The query restrictions.
580
+     *
581
+     * @return $this This QueryBuilder instance.
582
+     *
583
+     * @see where()
584
+     * @since 8.2.0
585
+     */
586
+    public function andWhere(...$where);
587
+
588
+    /**
589
+     * Adds one or more restrictions to the query results, forming a logical
590
+     * disjunction with any previously specified restrictions.
591
+     *
592
+     * <code>
593
+     *     $qb = $conn->getQueryBuilder()
594
+     *         ->select('u.name')
595
+     *         ->from('users', 'u')
596
+     *         ->where('u.id = 1')
597
+     *         ->orWhere('u.id = 2');
598
+     * </code>
599
+     *
600
+     * @param mixed ...$where The WHERE statement.
601
+     *
602
+     * @return $this This QueryBuilder instance.
603
+     *
604
+     * @see where()
605
+     * @since 8.2.0
606
+     */
607
+    public function orWhere(...$where);
608
+
609
+    /**
610
+     * Specifies a grouping over the results of the query.
611
+     * Replaces any previously specified groupings, if any.
612
+     *
613
+     * <code>
614
+     *     $qb = $conn->getQueryBuilder()
615
+     *         ->select('u.name')
616
+     *         ->from('users', 'u')
617
+     *         ->groupBy('u.id');
618
+     * </code>
619
+     *
620
+     * @param mixed ...$groupBys The grouping expression.
621
+     *
622
+     * @return $this This QueryBuilder instance.
623
+     * @since 8.2.0
624
+     */
625
+    public function groupBy(...$groupBys);
626
+
627
+    /**
628
+     * Adds a grouping expression to the query.
629
+     *
630
+     * <code>
631
+     *     $qb = $conn->getQueryBuilder()
632
+     *         ->select('u.name')
633
+     *         ->from('users', 'u')
634
+     *         ->groupBy('u.lastLogin');
635
+     *         ->addGroupBy('u.createdAt')
636
+     * </code>
637
+     *
638
+     * @param mixed ...$groupBy The grouping expression.
639
+     *
640
+     * @return $this This QueryBuilder instance.
641
+     * @since 8.2.0
642
+     */
643
+    public function addGroupBy(...$groupBy);
644
+
645
+    /**
646
+     * Sets a value for a column in an insert query.
647
+     *
648
+     * <code>
649
+     *     $qb = $conn->getQueryBuilder()
650
+     *         ->insert('users')
651
+     *         ->values(
652
+     *             array(
653
+     *                 'name' => '?'
654
+     *             )
655
+     *         )
656
+     *         ->setValue('password', '?');
657
+     * </code>
658
+     *
659
+     * @param string $column The column into which the value should be inserted.
660
+     * @param IParameter|string $value The value that should be inserted into the column.
661
+     *
662
+     * @return $this This QueryBuilder instance.
663
+     * @since 8.2.0
664
+     */
665
+    public function setValue($column, $value);
666
+
667
+    /**
668
+     * Specifies values for an insert query indexed by column names.
669
+     * Replaces any previous values, if any.
670
+     *
671
+     * <code>
672
+     *     $qb = $conn->getQueryBuilder()
673
+     *         ->insert('users')
674
+     *         ->values(
675
+     *             array(
676
+     *                 'name' => '?',
677
+     *                 'password' => '?'
678
+     *             )
679
+     *         );
680
+     * </code>
681
+     *
682
+     * @param array $values The values to specify for the insert query indexed by column names.
683
+     *
684
+     * @return $this This QueryBuilder instance.
685
+     * @since 8.2.0
686
+     */
687
+    public function values(array $values);
688
+
689
+    /**
690
+     * Specifies a restriction over the groups of the query.
691
+     * Replaces any previous having restrictions, if any.
692
+     *
693
+     * @param mixed ...$having The restriction over the groups.
694
+     *
695
+     * @return $this This QueryBuilder instance.
696
+     * @since 8.2.0
697
+     */
698
+    public function having(...$having);
699
+
700
+    /**
701
+     * Adds a restriction over the groups of the query, forming a logical
702
+     * conjunction with any existing having restrictions.
703
+     *
704
+     * @param mixed ...$having The restriction to append.
705
+     *
706
+     * @return $this This QueryBuilder instance.
707
+     * @since 8.2.0
708
+     */
709
+    public function andHaving(...$having);
710
+
711
+    /**
712
+     * Adds a restriction over the groups of the query, forming a logical
713
+     * disjunction with any existing having restrictions.
714
+     *
715
+     * @param mixed ...$having The restriction to add.
716
+     *
717
+     * @return $this This QueryBuilder instance.
718
+     * @since 8.2.0
719
+     */
720
+    public function orHaving(...$having);
721
+
722
+    /**
723
+     * Specifies an ordering for the query results.
724
+     * Replaces any previously specified orderings, if any.
725
+     *
726
+     * @param string $sort The ordering expression.
727
+     * @param string $order The ordering direction.
728
+     *
729
+     * @return $this This QueryBuilder instance.
730
+     * @since 8.2.0
731
+     */
732
+    public function orderBy($sort, $order = null);
733
+
734
+    /**
735
+     * Adds an ordering to the query results.
736
+     *
737
+     * @param string $sort The ordering expression.
738
+     * @param string $order The ordering direction.
739
+     *
740
+     * @return $this This QueryBuilder instance.
741
+     * @since 8.2.0
742
+     */
743
+    public function addOrderBy($sort, $order = null);
744
+
745
+    /**
746
+     * Gets a query part by its name.
747
+     *
748
+     * @param string $queryPartName
749
+     *
750
+     * @return mixed
751
+     * @since 8.2.0
752
+     */
753
+    public function getQueryPart($queryPartName);
754
+
755
+    /**
756
+     * Gets all query parts.
757
+     *
758
+     * @return array
759
+     * @since 8.2.0
760
+     */
761
+    public function getQueryParts();
762
+
763
+    /**
764
+     * Resets SQL parts.
765
+     *
766
+     * @param array|null $queryPartNames
767
+     *
768
+     * @return $this This QueryBuilder instance.
769
+     * @since 8.2.0
770
+     */
771
+    public function resetQueryParts($queryPartNames = null);
772
+
773
+    /**
774
+     * Resets a single SQL part.
775
+     *
776
+     * @param string $queryPartName
777
+     *
778
+     * @return $this This QueryBuilder instance.
779
+     * @since 8.2.0
780
+     */
781
+    public function resetQueryPart($queryPartName);
782
+
783
+    /**
784
+     * Creates a new named parameter and bind the value $value to it.
785
+     *
786
+     * This method provides a shortcut for PDOStatement::bindValue
787
+     * when using prepared statements.
788
+     *
789
+     * The parameter $value specifies the value that you want to bind. If
790
+     * $placeholder is not provided bindValue() will automatically create a
791
+     * placeholder for you. An automatic placeholder will be of the name
792
+     * ':dcValue1', ':dcValue2' etc.
793
+     *
794
+     * For more information see {@link https://www.php.net/pdostatement-bindparam}
795
+     *
796
+     * Example:
797
+     * <code>
798
+     * $value = 2;
799
+     * $q->eq( 'id', $q->bindValue( $value ) );
800
+     * $stmt = $q->executeQuery(); // executed with 'id = 2'
801
+     * </code>
802
+     *
803
+     * @license New BSD License
804
+     * @link http://www.zetacomponents.org
805
+     *
806
+     * @param mixed $value
807
+     * @param mixed $type
808
+     * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
809
+     *
810
+     * @return IParameter
811
+     * @since 8.2.0
812
+     */
813
+    public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null);
814
+
815
+    /**
816
+     * Creates a new positional parameter and bind the given value to it.
817
+     *
818
+     * Attention: If you are using positional parameters with the query builder you have
819
+     * to be very careful to bind all parameters in the order they appear in the SQL
820
+     * statement , otherwise they get bound in the wrong order which can lead to serious
821
+     * bugs in your code.
822
+     *
823
+     * Example:
824
+     * <code>
825
+     *  $qb = $conn->getQueryBuilder();
826
+     *  $qb->select('u.*')
827
+     *     ->from('users', 'u')
828
+     *     ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR))
829
+     *     ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR))
830
+     * </code>
831
+     *
832
+     * @param mixed $value
833
+     * @param integer $type
834
+     *
835
+     * @return IParameter
836
+     * @since 8.2.0
837
+     */
838
+    public function createPositionalParameter($value, $type = self::PARAM_STR);
839
+
840
+    /**
841
+     * Creates a new parameter
842
+     *
843
+     * Example:
844
+     * <code>
845
+     *  $qb = $conn->getQueryBuilder();
846
+     *  $qb->select('u.*')
847
+     *     ->from('users', 'u')
848
+     *     ->where('u.username = ' . $qb->createParameter('name'))
849
+     *     ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR))
850
+     * </code>
851
+     *
852
+     * @param string $name
853
+     *
854
+     * @return IParameter
855
+     * @since 8.2.0
856
+     */
857
+    public function createParameter($name);
858
+
859
+    /**
860
+     * Creates a new function
861
+     *
862
+     * Attention: Column names inside the call have to be quoted before hand
863
+     *
864
+     * Example:
865
+     * <code>
866
+     *  $qb = $conn->getQueryBuilder();
867
+     *  $qb->select($qb->createFunction('COUNT(*)'))
868
+     *     ->from('users', 'u')
869
+     *  echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u
870
+     * </code>
871
+     * <code>
872
+     *  $qb = $conn->getQueryBuilder();
873
+     *  $qb->select($qb->createFunction('COUNT(`column`)'))
874
+     *     ->from('users', 'u')
875
+     *  echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u
876
+     * </code>
877
+     *
878
+     * @param string $call
879
+     *
880
+     * @return IQueryFunction
881
+     * @since 8.2.0
882
+     */
883
+    public function createFunction($call);
884
+
885
+    /**
886
+     * Used to get the id of the last inserted element
887
+     * @return int
888
+     * @throws \BadMethodCallException When being called before an insert query has been run.
889
+     * @since 9.0.0
890
+     */
891
+    public function getLastInsertId();
892
+
893
+    /**
894
+     * Returns the table name quoted and with database prefix as needed by the implementation
895
+     *
896
+     * @param string $table
897
+     * @return string
898
+     * @since 9.0.0
899
+     */
900
+    public function getTableName($table);
901
+
902
+    /**
903
+     * Returns the column name quoted and with table alias prefix as needed by the implementation
904
+     *
905
+     * @param string $column
906
+     * @param string $tableAlias
907
+     * @return string
908
+     * @since 9.0.0
909
+     */
910
+    public function getColumnName($column, $tableAlias = '');
911 911
 }
Please login to merge, or discard this patch.
lib/public/DB/IPreparedStatement.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -34,94 +34,94 @@
 block discarded – undo
34 34
  */
35 35
 interface IPreparedStatement {
36 36
 
37
-	/**
38
-	 * @return true
39
-	 *
40
-	 * @since 21.0.0
41
-	 * @deprecated 21.0.0 use \OCP\DB\IResult::closeCursor on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
42
-	 */
43
-	public function closeCursor(): bool;
37
+    /**
38
+     * @return true
39
+     *
40
+     * @since 21.0.0
41
+     * @deprecated 21.0.0 use \OCP\DB\IResult::closeCursor on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
42
+     */
43
+    public function closeCursor(): bool;
44 44
 
45
-	/**
46
-	 * @param int $fetchMode
47
-	 *
48
-	 * @return mixed
49
-	 *
50
-	 * @since 21.0.0
51
-	 * @deprecated 21.0.0 use \OCP\DB\IResult::fetch on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
52
-	 */
53
-	public function fetch(int $fetchMode = PDO::FETCH_ASSOC);
45
+    /**
46
+     * @param int $fetchMode
47
+     *
48
+     * @return mixed
49
+     *
50
+     * @since 21.0.0
51
+     * @deprecated 21.0.0 use \OCP\DB\IResult::fetch on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
52
+     */
53
+    public function fetch(int $fetchMode = PDO::FETCH_ASSOC);
54 54
 
55
-	/**
56
-	 * @param int $fetchMode
57
-	 *
58
-	 * @return mixed[]
59
-	 *
60
-	 * @since 21.0.0
61
-	 * @deprecated 21.0.0 use \OCP\DB\IResult::fetchAll on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
62
-	 */
63
-	public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC);
55
+    /**
56
+     * @param int $fetchMode
57
+     *
58
+     * @return mixed[]
59
+     *
60
+     * @since 21.0.0
61
+     * @deprecated 21.0.0 use \OCP\DB\IResult::fetchAll on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
62
+     */
63
+    public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC);
64 64
 
65
-	/**
66
-	 * @return mixed
67
-	 *
68
-	 * @since 21.0.0
69
-	 * @deprecated 21.0.0 use \OCP\DB\IResult::fetchColumn on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
70
-	 */
71
-	public function fetchColumn();
65
+    /**
66
+     * @return mixed
67
+     *
68
+     * @since 21.0.0
69
+     * @deprecated 21.0.0 use \OCP\DB\IResult::fetchColumn on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
70
+     */
71
+    public function fetchColumn();
72 72
 
73
-	/**
74
-	 * @return mixed
75
-	 *
76
-	 * @since 21.0.0
77
-	 * @deprecated 21.0.0 use \OCP\DB\IResult::fetchOne on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
78
-	 */
79
-	public function fetchOne();
73
+    /**
74
+     * @return mixed
75
+     *
76
+     * @since 21.0.0
77
+     * @deprecated 21.0.0 use \OCP\DB\IResult::fetchOne on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
78
+     */
79
+    public function fetchOne();
80 80
 
81
-	/**
82
-	 * @param int|string $param
83
-	 * @param mixed $value
84
-	 * @param int $type
85
-	 *
86
-	 * @return bool
87
-	 *
88
-	 * @throws Exception
89
-	 *
90
-	 * @since 21.0.0
91
-	 */
92
-	public function bindValue($param, $value, $type = ParameterType::STRING): bool;
81
+    /**
82
+     * @param int|string $param
83
+     * @param mixed $value
84
+     * @param int $type
85
+     *
86
+     * @return bool
87
+     *
88
+     * @throws Exception
89
+     *
90
+     * @since 21.0.0
91
+     */
92
+    public function bindValue($param, $value, $type = ParameterType::STRING): bool;
93 93
 
94
-	/**
95
-	 * @param int|string $param
96
-	 * @param mixed $variable
97
-	 * @param int $type
98
-	 * @param int|null $length
99
-	 *
100
-	 * @return bool
101
-	 *
102
-	 * @throws Exception
103
-	 *
104
-	 * @since 21.0.0
105
-	 */
106
-	public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool;
94
+    /**
95
+     * @param int|string $param
96
+     * @param mixed $variable
97
+     * @param int $type
98
+     * @param int|null $length
99
+     *
100
+     * @return bool
101
+     *
102
+     * @throws Exception
103
+     *
104
+     * @since 21.0.0
105
+     */
106
+    public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool;
107 107
 
108
-	/**
109
-	 * @param mixed[]|null $params
110
-	 *
111
-	 * @return IResult
112
-	 *
113
-	 * @since 21.0.0
114
-	 * @throws Exception
115
-	 */
116
-	public function execute($params = null): IResult;
108
+    /**
109
+     * @param mixed[]|null $params
110
+     *
111
+     * @return IResult
112
+     *
113
+     * @since 21.0.0
114
+     * @throws Exception
115
+     */
116
+    public function execute($params = null): IResult;
117 117
 
118
-	/**
119
-	 * @return int
120
-	 *
121
-	 * @since 21.0.0
122
-	 *
123
-	 * @throws Exception
124
-	 * @deprecated 21.0.0 use \OCP\DB\IResult::rowCount on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
125
-	 */
126
-	public function rowCount(): int;
118
+    /**
119
+     * @return int
120
+     *
121
+     * @since 21.0.0
122
+     *
123
+     * @throws Exception
124
+     * @deprecated 21.0.0 use \OCP\DB\IResult::rowCount on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare
125
+     */
126
+    public function rowCount(): int;
127 127
 }
Please login to merge, or discard this patch.
lib/public/DB/IResult.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,52 +32,52 @@
 block discarded – undo
32 32
  */
33 33
 interface IResult {
34 34
 
35
-	/**
36
-	 * @return true
37
-	 *
38
-	 * @since 21.0.0
39
-	 */
40
-	public function closeCursor(): bool;
35
+    /**
36
+     * @return true
37
+     *
38
+     * @since 21.0.0
39
+     */
40
+    public function closeCursor(): bool;
41 41
 
42
-	/**
43
-	 * @param int $fetchMode
44
-	 *
45
-	 * @return mixed
46
-	 *
47
-	 * @since 21.0.0
48
-	 */
49
-	public function fetch(int $fetchMode = PDO::FETCH_ASSOC);
42
+    /**
43
+     * @param int $fetchMode
44
+     *
45
+     * @return mixed
46
+     *
47
+     * @since 21.0.0
48
+     */
49
+    public function fetch(int $fetchMode = PDO::FETCH_ASSOC);
50 50
 
51
-	/**
52
-	 * @param int $fetchMode (one of PDO::FETCH_ASSOC, PDO::FETCH_NUM or PDO::FETCH_COLUMN (2, 3 or 7)
53
-	 *
54
-	 * @return mixed[]
55
-	 *
56
-	 * @since 21.0.0
57
-	 */
58
-	public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array;
51
+    /**
52
+     * @param int $fetchMode (one of PDO::FETCH_ASSOC, PDO::FETCH_NUM or PDO::FETCH_COLUMN (2, 3 or 7)
53
+     *
54
+     * @return mixed[]
55
+     *
56
+     * @since 21.0.0
57
+     */
58
+    public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array;
59 59
 
60
-	/**
61
-	 * @return mixed
62
-	 *
63
-	 * @since 21.0.0
64
-	 * @deprecated 21.0.0 use \OCP\DB\IResult::fetchOne
65
-	 */
66
-	public function fetchColumn();
60
+    /**
61
+     * @return mixed
62
+     *
63
+     * @since 21.0.0
64
+     * @deprecated 21.0.0 use \OCP\DB\IResult::fetchOne
65
+     */
66
+    public function fetchColumn();
67 67
 
68
-	/**
69
-	 * @param int $columnIndex
70
-	 *
71
-	 * @return false|mixed
72
-	 *
73
-	 * @since 21.0.0
74
-	 */
75
-	public function fetchOne();
68
+    /**
69
+     * @param int $columnIndex
70
+     *
71
+     * @return false|mixed
72
+     *
73
+     * @since 21.0.0
74
+     */
75
+    public function fetchOne();
76 76
 
77
-	/**
78
-	 * @return int
79
-	 *
80
-	 * @since 21.0.0
81
-	 */
82
-	public function rowCount(): int;
77
+    /**
78
+     * @return int
79
+     *
80
+     * @since 21.0.0
81
+     */
82
+    public function rowCount(): int;
83 83
 }
Please login to merge, or discard this patch.