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