@@ -31,852 +31,852 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | interface IQueryBuilder { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @since 9.0.0 |
|
| 36 | - */ |
|
| 37 | - const PARAM_NULL = \PDO::PARAM_NULL; |
|
| 38 | - /** |
|
| 39 | - * @since 9.0.0 |
|
| 40 | - */ |
|
| 41 | - const PARAM_BOOL = \PDO::PARAM_BOOL; |
|
| 42 | - /** |
|
| 43 | - * @since 9.0.0 |
|
| 44 | - */ |
|
| 45 | - const PARAM_INT = \PDO::PARAM_INT; |
|
| 46 | - /** |
|
| 47 | - * @since 9.0.0 |
|
| 48 | - */ |
|
| 49 | - const PARAM_STR = \PDO::PARAM_STR; |
|
| 50 | - /** |
|
| 51 | - * @since 9.0.0 |
|
| 52 | - */ |
|
| 53 | - const PARAM_LOB = \PDO::PARAM_LOB; |
|
| 54 | - /** |
|
| 55 | - * @since 9.0.0 |
|
| 56 | - */ |
|
| 57 | - const PARAM_DATE = 'datetime'; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @since 9.0.0 |
|
| 61 | - */ |
|
| 62 | - const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY; |
|
| 63 | - /** |
|
| 64 | - * @since 9.0.0 |
|
| 65 | - */ |
|
| 66 | - const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY; |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Enable/disable automatic prefixing of table names with the oc_ prefix |
|
| 71 | - * |
|
| 72 | - * @param bool $enabled If set to true table names will be prefixed with the |
|
| 73 | - * owncloud database prefix automatically. |
|
| 74 | - * @since 8.2.0 |
|
| 75 | - */ |
|
| 76 | - public function automaticTablePrefix($enabled); |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Gets an ExpressionBuilder used for object-oriented construction of query expressions. |
|
| 80 | - * This producer method is intended for convenient inline usage. Example: |
|
| 81 | - * |
|
| 82 | - * <code> |
|
| 83 | - * $qb = $conn->getQueryBuilder() |
|
| 84 | - * ->select('u') |
|
| 85 | - * ->from('users', 'u') |
|
| 86 | - * ->where($qb->expr()->eq('u.id', 1)); |
|
| 87 | - * </code> |
|
| 88 | - * |
|
| 89 | - * For more complex expression construction, consider storing the expression |
|
| 90 | - * builder object in a local variable. |
|
| 91 | - * |
|
| 92 | - * @return \OCP\DB\QueryBuilder\IExpressionBuilder |
|
| 93 | - * @since 8.2.0 |
|
| 94 | - */ |
|
| 95 | - public function expr(); |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Gets the type of the currently built query. |
|
| 99 | - * |
|
| 100 | - * @return integer |
|
| 101 | - * @since 8.2.0 |
|
| 102 | - */ |
|
| 103 | - public function getType(); |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Gets the associated DBAL Connection for this query builder. |
|
| 107 | - * |
|
| 108 | - * @return \OCP\IDBConnection |
|
| 109 | - * @since 8.2.0 |
|
| 110 | - */ |
|
| 111 | - public function getConnection(); |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Gets the state of this query builder instance. |
|
| 115 | - * |
|
| 116 | - * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN. |
|
| 117 | - * @since 8.2.0 |
|
| 118 | - */ |
|
| 119 | - public function getState(); |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Executes this query using the bound parameters and their types. |
|
| 123 | - * |
|
| 124 | - * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate} |
|
| 125 | - * for insert, update and delete statements. |
|
| 126 | - * |
|
| 127 | - * @return \Doctrine\DBAL\Driver\Statement|int |
|
| 128 | - * @since 8.2.0 |
|
| 129 | - */ |
|
| 130 | - public function execute(); |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Gets the complete SQL string formed by the current specifications of this QueryBuilder. |
|
| 134 | - * |
|
| 135 | - * <code> |
|
| 136 | - * $qb = $conn->getQueryBuilder() |
|
| 137 | - * ->select('u') |
|
| 138 | - * ->from('User', 'u') |
|
| 139 | - * echo $qb->getSQL(); // SELECT u FROM User u |
|
| 140 | - * </code> |
|
| 141 | - * |
|
| 142 | - * @return string The SQL query string. |
|
| 143 | - * @since 8.2.0 |
|
| 144 | - */ |
|
| 145 | - public function getSQL(); |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * Sets a query parameter for the query being constructed. |
|
| 149 | - * |
|
| 150 | - * <code> |
|
| 151 | - * $qb = $conn->getQueryBuilder() |
|
| 152 | - * ->select('u') |
|
| 153 | - * ->from('users', 'u') |
|
| 154 | - * ->where('u.id = :user_id') |
|
| 155 | - * ->setParameter(':user_id', 1); |
|
| 156 | - * </code> |
|
| 157 | - * |
|
| 158 | - * @param string|integer $key The parameter position or name. |
|
| 159 | - * @param mixed $value The parameter value. |
|
| 160 | - * @param string|null $type One of the IQueryBuilder::PARAM_* constants. |
|
| 161 | - * |
|
| 162 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 163 | - * @since 8.2.0 |
|
| 164 | - */ |
|
| 165 | - public function setParameter($key, $value, $type = null); |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * Sets a collection of query parameters for the query being constructed. |
|
| 169 | - * |
|
| 170 | - * <code> |
|
| 171 | - * $qb = $conn->getQueryBuilder() |
|
| 172 | - * ->select('u') |
|
| 173 | - * ->from('users', 'u') |
|
| 174 | - * ->where('u.id = :user_id1 OR u.id = :user_id2') |
|
| 175 | - * ->setParameters(array( |
|
| 176 | - * ':user_id1' => 1, |
|
| 177 | - * ':user_id2' => 2 |
|
| 178 | - * )); |
|
| 179 | - * </code> |
|
| 180 | - * |
|
| 181 | - * @param array $params The query parameters to set. |
|
| 182 | - * @param array $types The query parameters types to set. |
|
| 183 | - * |
|
| 184 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 185 | - * @since 8.2.0 |
|
| 186 | - */ |
|
| 187 | - public function setParameters(array $params, array $types = array()); |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Gets all defined query parameters for the query being constructed indexed by parameter index or name. |
|
| 191 | - * |
|
| 192 | - * @return array The currently defined query parameters indexed by parameter index or name. |
|
| 193 | - * @since 8.2.0 |
|
| 194 | - */ |
|
| 195 | - public function getParameters(); |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Gets a (previously set) query parameter of the query being constructed. |
|
| 199 | - * |
|
| 200 | - * @param mixed $key The key (index or name) of the bound parameter. |
|
| 201 | - * |
|
| 202 | - * @return mixed The value of the bound parameter. |
|
| 203 | - * @since 8.2.0 |
|
| 204 | - */ |
|
| 205 | - public function getParameter($key); |
|
| 206 | - |
|
| 207 | - /** |
|
| 208 | - * Gets all defined query parameter types for the query being constructed indexed by parameter index or name. |
|
| 209 | - * |
|
| 210 | - * @return array The currently defined query parameter types indexed by parameter index or name. |
|
| 211 | - * @since 8.2.0 |
|
| 212 | - */ |
|
| 213 | - public function getParameterTypes(); |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Gets a (previously set) query parameter type of the query being constructed. |
|
| 217 | - * |
|
| 218 | - * @param mixed $key The key (index or name) of the bound parameter type. |
|
| 219 | - * |
|
| 220 | - * @return mixed The value of the bound parameter type. |
|
| 221 | - * @since 8.2.0 |
|
| 222 | - */ |
|
| 223 | - public function getParameterType($key); |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * Sets the position of the first result to retrieve (the "offset"). |
|
| 227 | - * |
|
| 228 | - * @param integer $firstResult The first result to return. |
|
| 229 | - * |
|
| 230 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 231 | - * @since 8.2.0 |
|
| 232 | - */ |
|
| 233 | - public function setFirstResult($firstResult); |
|
| 234 | - |
|
| 235 | - /** |
|
| 236 | - * Gets the position of the first result the query object was set to retrieve (the "offset"). |
|
| 237 | - * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder. |
|
| 238 | - * |
|
| 239 | - * @return integer The position of the first result. |
|
| 240 | - * @since 8.2.0 |
|
| 241 | - */ |
|
| 242 | - public function getFirstResult(); |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * Sets the maximum number of results to retrieve (the "limit"). |
|
| 246 | - * |
|
| 247 | - * @param integer $maxResults The maximum number of results to retrieve. |
|
| 248 | - * |
|
| 249 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 250 | - * @since 8.2.0 |
|
| 251 | - */ |
|
| 252 | - public function setMaxResults($maxResults); |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Gets the maximum number of results the query object was set to retrieve (the "limit"). |
|
| 256 | - * Returns NULL if {@link setMaxResults} was not applied to this query builder. |
|
| 257 | - * |
|
| 258 | - * @return integer The maximum number of results. |
|
| 259 | - * @since 8.2.0 |
|
| 260 | - */ |
|
| 261 | - public function getMaxResults(); |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * Specifies an item that is to be returned in the query result. |
|
| 265 | - * Replaces any previously specified selections, if any. |
|
| 266 | - * |
|
| 267 | - * <code> |
|
| 268 | - * $qb = $conn->getQueryBuilder() |
|
| 269 | - * ->select('u.id', 'p.id') |
|
| 270 | - * ->from('users', 'u') |
|
| 271 | - * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); |
|
| 272 | - * </code> |
|
| 273 | - * |
|
| 274 | - * @param mixed $select The selection expressions. |
|
| 275 | - * |
|
| 276 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 277 | - * @since 8.2.0 |
|
| 278 | - */ |
|
| 279 | - public function select($select = null); |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * Specifies an item that is to be returned with a different name in the query result. |
|
| 283 | - * |
|
| 284 | - * <code> |
|
| 285 | - * $qb = $conn->getQueryBuilder() |
|
| 286 | - * ->selectAlias('u.id', 'user_id') |
|
| 287 | - * ->from('users', 'u') |
|
| 288 | - * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); |
|
| 289 | - * </code> |
|
| 290 | - * |
|
| 291 | - * @param mixed $select The selection expressions. |
|
| 292 | - * @param string $alias The column alias used in the constructed query. |
|
| 293 | - * |
|
| 294 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 295 | - * @since 8.2.1 |
|
| 296 | - */ |
|
| 297 | - public function selectAlias($select, $alias); |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * Specifies an item that is to be returned uniquely in the query result. |
|
| 301 | - * |
|
| 302 | - * <code> |
|
| 303 | - * $qb = $conn->getQueryBuilder() |
|
| 304 | - * ->selectDistinct('type') |
|
| 305 | - * ->from('users'); |
|
| 306 | - * </code> |
|
| 307 | - * |
|
| 308 | - * @param mixed $select The selection expressions. |
|
| 309 | - * |
|
| 310 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 311 | - * @since 9.0.0 |
|
| 312 | - */ |
|
| 313 | - public function selectDistinct($select); |
|
| 314 | - |
|
| 315 | - /** |
|
| 316 | - * Adds an item that is to be returned in the query result. |
|
| 317 | - * |
|
| 318 | - * <code> |
|
| 319 | - * $qb = $conn->getQueryBuilder() |
|
| 320 | - * ->select('u.id') |
|
| 321 | - * ->addSelect('p.id') |
|
| 322 | - * ->from('users', 'u') |
|
| 323 | - * ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id'); |
|
| 324 | - * </code> |
|
| 325 | - * |
|
| 326 | - * @param mixed $select The selection expression. |
|
| 327 | - * |
|
| 328 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 329 | - * @since 8.2.0 |
|
| 330 | - */ |
|
| 331 | - public function addSelect($select = null); |
|
| 332 | - |
|
| 333 | - /** |
|
| 334 | - * Turns the query being built into a bulk delete query that ranges over |
|
| 335 | - * a certain table. |
|
| 336 | - * |
|
| 337 | - * <code> |
|
| 338 | - * $qb = $conn->getQueryBuilder() |
|
| 339 | - * ->delete('users', 'u') |
|
| 340 | - * ->where('u.id = :user_id'); |
|
| 341 | - * ->setParameter(':user_id', 1); |
|
| 342 | - * </code> |
|
| 343 | - * |
|
| 344 | - * @param string $delete The table whose rows are subject to the deletion. |
|
| 345 | - * @param string $alias The table alias used in the constructed query. |
|
| 346 | - * |
|
| 347 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 348 | - * @since 8.2.0 |
|
| 349 | - */ |
|
| 350 | - public function delete($delete = null, $alias = null); |
|
| 351 | - |
|
| 352 | - /** |
|
| 353 | - * Turns the query being built into a bulk update query that ranges over |
|
| 354 | - * a certain table |
|
| 355 | - * |
|
| 356 | - * <code> |
|
| 357 | - * $qb = $conn->getQueryBuilder() |
|
| 358 | - * ->update('users', 'u') |
|
| 359 | - * ->set('u.password', md5('password')) |
|
| 360 | - * ->where('u.id = ?'); |
|
| 361 | - * </code> |
|
| 362 | - * |
|
| 363 | - * @param string $update The table whose rows are subject to the update. |
|
| 364 | - * @param string $alias The table alias used in the constructed query. |
|
| 365 | - * |
|
| 366 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 367 | - * @since 8.2.0 |
|
| 368 | - */ |
|
| 369 | - public function update($update = null, $alias = null); |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * Turns the query being built into an insert query that inserts into |
|
| 373 | - * a certain table |
|
| 374 | - * |
|
| 375 | - * <code> |
|
| 376 | - * $qb = $conn->getQueryBuilder() |
|
| 377 | - * ->insert('users') |
|
| 378 | - * ->values( |
|
| 379 | - * array( |
|
| 380 | - * 'name' => '?', |
|
| 381 | - * 'password' => '?' |
|
| 382 | - * ) |
|
| 383 | - * ); |
|
| 384 | - * </code> |
|
| 385 | - * |
|
| 386 | - * @param string $insert The table into which the rows should be inserted. |
|
| 387 | - * |
|
| 388 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 389 | - * @since 8.2.0 |
|
| 390 | - */ |
|
| 391 | - public function insert($insert = null); |
|
| 392 | - |
|
| 393 | - /** |
|
| 394 | - * Creates and adds a query root corresponding to the table identified by the |
|
| 395 | - * given alias, forming a cartesian product with any existing query roots. |
|
| 396 | - * |
|
| 397 | - * <code> |
|
| 398 | - * $qb = $conn->getQueryBuilder() |
|
| 399 | - * ->select('u.id') |
|
| 400 | - * ->from('users', 'u') |
|
| 401 | - * </code> |
|
| 402 | - * |
|
| 403 | - * @param string $from The table. |
|
| 404 | - * @param string|null $alias The alias of the table. |
|
| 405 | - * |
|
| 406 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 407 | - * @since 8.2.0 |
|
| 408 | - */ |
|
| 409 | - public function from($from, $alias = null); |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * Creates and adds a join to the query. |
|
| 413 | - * |
|
| 414 | - * <code> |
|
| 415 | - * $qb = $conn->getQueryBuilder() |
|
| 416 | - * ->select('u.name') |
|
| 417 | - * ->from('users', 'u') |
|
| 418 | - * ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 419 | - * </code> |
|
| 420 | - * |
|
| 421 | - * @param string $fromAlias The alias that points to a from clause. |
|
| 422 | - * @param string $join The table name to join. |
|
| 423 | - * @param string $alias The alias of the join table. |
|
| 424 | - * @param string $condition The condition for the join. |
|
| 425 | - * |
|
| 426 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 427 | - * @since 8.2.0 |
|
| 428 | - */ |
|
| 429 | - public function join($fromAlias, $join, $alias, $condition = null); |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * Creates and adds a join to the query. |
|
| 433 | - * |
|
| 434 | - * <code> |
|
| 435 | - * $qb = $conn->getQueryBuilder() |
|
| 436 | - * ->select('u.name') |
|
| 437 | - * ->from('users', 'u') |
|
| 438 | - * ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 439 | - * </code> |
|
| 440 | - * |
|
| 441 | - * @param string $fromAlias The alias that points to a from clause. |
|
| 442 | - * @param string $join The table name to join. |
|
| 443 | - * @param string $alias The alias of the join table. |
|
| 444 | - * @param string $condition The condition for the join. |
|
| 445 | - * |
|
| 446 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 447 | - * @since 8.2.0 |
|
| 448 | - */ |
|
| 449 | - public function innerJoin($fromAlias, $join, $alias, $condition = null); |
|
| 450 | - |
|
| 451 | - /** |
|
| 452 | - * Creates and adds a left join to the query. |
|
| 453 | - * |
|
| 454 | - * <code> |
|
| 455 | - * $qb = $conn->getQueryBuilder() |
|
| 456 | - * ->select('u.name') |
|
| 457 | - * ->from('users', 'u') |
|
| 458 | - * ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 459 | - * </code> |
|
| 460 | - * |
|
| 461 | - * @param string $fromAlias The alias that points to a from clause. |
|
| 462 | - * @param string $join The table name to join. |
|
| 463 | - * @param string $alias The alias of the join table. |
|
| 464 | - * @param string $condition The condition for the join. |
|
| 465 | - * |
|
| 466 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 467 | - * @since 8.2.0 |
|
| 468 | - */ |
|
| 469 | - public function leftJoin($fromAlias, $join, $alias, $condition = null); |
|
| 470 | - |
|
| 471 | - /** |
|
| 472 | - * Creates and adds a right join to the query. |
|
| 473 | - * |
|
| 474 | - * <code> |
|
| 475 | - * $qb = $conn->getQueryBuilder() |
|
| 476 | - * ->select('u.name') |
|
| 477 | - * ->from('users', 'u') |
|
| 478 | - * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 479 | - * </code> |
|
| 480 | - * |
|
| 481 | - * @param string $fromAlias The alias that points to a from clause. |
|
| 482 | - * @param string $join The table name to join. |
|
| 483 | - * @param string $alias The alias of the join table. |
|
| 484 | - * @param string $condition The condition for the join. |
|
| 485 | - * |
|
| 486 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 487 | - * @since 8.2.0 |
|
| 488 | - */ |
|
| 489 | - public function rightJoin($fromAlias, $join, $alias, $condition = null); |
|
| 490 | - |
|
| 491 | - /** |
|
| 492 | - * Sets a new value for a column in a bulk update query. |
|
| 493 | - * |
|
| 494 | - * <code> |
|
| 495 | - * $qb = $conn->getQueryBuilder() |
|
| 496 | - * ->update('users', 'u') |
|
| 497 | - * ->set('u.password', md5('password')) |
|
| 498 | - * ->where('u.id = ?'); |
|
| 499 | - * </code> |
|
| 500 | - * |
|
| 501 | - * @param string $key The column to set. |
|
| 502 | - * @param string $value The value, expression, placeholder, etc. |
|
| 503 | - * |
|
| 504 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 505 | - * @since 8.2.0 |
|
| 506 | - */ |
|
| 507 | - public function set($key, $value); |
|
| 508 | - |
|
| 509 | - /** |
|
| 510 | - * Specifies one or more restrictions to the query result. |
|
| 511 | - * Replaces any previously specified restrictions, if any. |
|
| 512 | - * |
|
| 513 | - * <code> |
|
| 514 | - * $qb = $conn->getQueryBuilder() |
|
| 515 | - * ->select('u.name') |
|
| 516 | - * ->from('users', 'u') |
|
| 517 | - * ->where('u.id = ?'); |
|
| 518 | - * |
|
| 519 | - * // You can optionally programatically build and/or expressions |
|
| 520 | - * $qb = $conn->getQueryBuilder(); |
|
| 521 | - * |
|
| 522 | - * $or = $qb->expr()->orx(); |
|
| 523 | - * $or->add($qb->expr()->eq('u.id', 1)); |
|
| 524 | - * $or->add($qb->expr()->eq('u.id', 2)); |
|
| 525 | - * |
|
| 526 | - * $qb->update('users', 'u') |
|
| 527 | - * ->set('u.password', md5('password')) |
|
| 528 | - * ->where($or); |
|
| 529 | - * </code> |
|
| 530 | - * |
|
| 531 | - * @param mixed $predicates The restriction predicates. |
|
| 532 | - * |
|
| 533 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 534 | - * @since 8.2.0 |
|
| 535 | - */ |
|
| 536 | - public function where($predicates); |
|
| 537 | - |
|
| 538 | - /** |
|
| 539 | - * Adds one or more restrictions to the query results, forming a logical |
|
| 540 | - * conjunction with any previously specified restrictions. |
|
| 541 | - * |
|
| 542 | - * <code> |
|
| 543 | - * $qb = $conn->getQueryBuilder() |
|
| 544 | - * ->select('u') |
|
| 545 | - * ->from('users', 'u') |
|
| 546 | - * ->where('u.username LIKE ?') |
|
| 547 | - * ->andWhere('u.is_active = 1'); |
|
| 548 | - * </code> |
|
| 549 | - * |
|
| 550 | - * @param mixed $where The query restrictions. |
|
| 551 | - * |
|
| 552 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 553 | - * |
|
| 554 | - * @see where() |
|
| 555 | - * @since 8.2.0 |
|
| 556 | - */ |
|
| 557 | - public function andWhere($where); |
|
| 558 | - |
|
| 559 | - /** |
|
| 560 | - * Adds one or more restrictions to the query results, forming a logical |
|
| 561 | - * disjunction with any previously specified restrictions. |
|
| 562 | - * |
|
| 563 | - * <code> |
|
| 564 | - * $qb = $conn->getQueryBuilder() |
|
| 565 | - * ->select('u.name') |
|
| 566 | - * ->from('users', 'u') |
|
| 567 | - * ->where('u.id = 1') |
|
| 568 | - * ->orWhere('u.id = 2'); |
|
| 569 | - * </code> |
|
| 570 | - * |
|
| 571 | - * @param mixed $where The WHERE statement. |
|
| 572 | - * |
|
| 573 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 574 | - * |
|
| 575 | - * @see where() |
|
| 576 | - * @since 8.2.0 |
|
| 577 | - */ |
|
| 578 | - public function orWhere($where); |
|
| 579 | - |
|
| 580 | - /** |
|
| 581 | - * Specifies a grouping over the results of the query. |
|
| 582 | - * Replaces any previously specified groupings, if any. |
|
| 583 | - * |
|
| 584 | - * <code> |
|
| 585 | - * $qb = $conn->getQueryBuilder() |
|
| 586 | - * ->select('u.name') |
|
| 587 | - * ->from('users', 'u') |
|
| 588 | - * ->groupBy('u.id'); |
|
| 589 | - * </code> |
|
| 590 | - * |
|
| 591 | - * @param mixed $groupBy The grouping expression. |
|
| 592 | - * |
|
| 593 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 594 | - * @since 8.2.0 |
|
| 595 | - */ |
|
| 596 | - public function groupBy($groupBy); |
|
| 597 | - |
|
| 598 | - /** |
|
| 599 | - * Adds a grouping expression to the query. |
|
| 600 | - * |
|
| 601 | - * <code> |
|
| 602 | - * $qb = $conn->getQueryBuilder() |
|
| 603 | - * ->select('u.name') |
|
| 604 | - * ->from('users', 'u') |
|
| 605 | - * ->groupBy('u.lastLogin'); |
|
| 606 | - * ->addGroupBy('u.createdAt') |
|
| 607 | - * </code> |
|
| 608 | - * |
|
| 609 | - * @param mixed $groupBy The grouping expression. |
|
| 610 | - * |
|
| 611 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 612 | - * @since 8.2.0 |
|
| 613 | - */ |
|
| 614 | - public function addGroupBy($groupBy); |
|
| 615 | - |
|
| 616 | - /** |
|
| 617 | - * Sets a value for a column in an insert query. |
|
| 618 | - * |
|
| 619 | - * <code> |
|
| 620 | - * $qb = $conn->getQueryBuilder() |
|
| 621 | - * ->insert('users') |
|
| 622 | - * ->values( |
|
| 623 | - * array( |
|
| 624 | - * 'name' => '?' |
|
| 625 | - * ) |
|
| 626 | - * ) |
|
| 627 | - * ->setValue('password', '?'); |
|
| 628 | - * </code> |
|
| 629 | - * |
|
| 630 | - * @param string $column The column into which the value should be inserted. |
|
| 631 | - * @param string $value The value that should be inserted into the column. |
|
| 632 | - * |
|
| 633 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 634 | - * @since 8.2.0 |
|
| 635 | - */ |
|
| 636 | - public function setValue($column, $value); |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * Specifies values for an insert query indexed by column names. |
|
| 640 | - * Replaces any previous values, if any. |
|
| 641 | - * |
|
| 642 | - * <code> |
|
| 643 | - * $qb = $conn->getQueryBuilder() |
|
| 644 | - * ->insert('users') |
|
| 645 | - * ->values( |
|
| 646 | - * array( |
|
| 647 | - * 'name' => '?', |
|
| 648 | - * 'password' => '?' |
|
| 649 | - * ) |
|
| 650 | - * ); |
|
| 651 | - * </code> |
|
| 652 | - * |
|
| 653 | - * @param array $values The values to specify for the insert query indexed by column names. |
|
| 654 | - * |
|
| 655 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 656 | - * @since 8.2.0 |
|
| 657 | - */ |
|
| 658 | - public function values(array $values); |
|
| 659 | - |
|
| 660 | - /** |
|
| 661 | - * Specifies a restriction over the groups of the query. |
|
| 662 | - * Replaces any previous having restrictions, if any. |
|
| 663 | - * |
|
| 664 | - * @param mixed $having The restriction over the groups. |
|
| 665 | - * |
|
| 666 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 667 | - * @since 8.2.0 |
|
| 668 | - */ |
|
| 669 | - public function having($having); |
|
| 670 | - |
|
| 671 | - /** |
|
| 672 | - * Adds a restriction over the groups of the query, forming a logical |
|
| 673 | - * conjunction with any existing having restrictions. |
|
| 674 | - * |
|
| 675 | - * @param mixed $having The restriction to append. |
|
| 676 | - * |
|
| 677 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 678 | - * @since 8.2.0 |
|
| 679 | - */ |
|
| 680 | - public function andHaving($having); |
|
| 681 | - |
|
| 682 | - /** |
|
| 683 | - * Adds a restriction over the groups of the query, forming a logical |
|
| 684 | - * disjunction with any existing having restrictions. |
|
| 685 | - * |
|
| 686 | - * @param mixed $having The restriction to add. |
|
| 687 | - * |
|
| 688 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 689 | - * @since 8.2.0 |
|
| 690 | - */ |
|
| 691 | - public function orHaving($having); |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * Specifies an ordering for the query results. |
|
| 695 | - * Replaces any previously specified orderings, if any. |
|
| 696 | - * |
|
| 697 | - * @param string $sort The ordering expression. |
|
| 698 | - * @param string $order The ordering direction. |
|
| 699 | - * |
|
| 700 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 701 | - * @since 8.2.0 |
|
| 702 | - */ |
|
| 703 | - public function orderBy($sort, $order = null); |
|
| 704 | - |
|
| 705 | - /** |
|
| 706 | - * Adds an ordering to the query results. |
|
| 707 | - * |
|
| 708 | - * @param string $sort The ordering expression. |
|
| 709 | - * @param string $order The ordering direction. |
|
| 710 | - * |
|
| 711 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 712 | - * @since 8.2.0 |
|
| 713 | - */ |
|
| 714 | - public function addOrderBy($sort, $order = null); |
|
| 715 | - |
|
| 716 | - /** |
|
| 717 | - * Gets a query part by its name. |
|
| 718 | - * |
|
| 719 | - * @param string $queryPartName |
|
| 720 | - * |
|
| 721 | - * @return mixed |
|
| 722 | - * @since 8.2.0 |
|
| 723 | - */ |
|
| 724 | - public function getQueryPart($queryPartName); |
|
| 725 | - |
|
| 726 | - /** |
|
| 727 | - * Gets all query parts. |
|
| 728 | - * |
|
| 729 | - * @return array |
|
| 730 | - * @since 8.2.0 |
|
| 731 | - */ |
|
| 732 | - public function getQueryParts(); |
|
| 733 | - |
|
| 734 | - /** |
|
| 735 | - * Resets SQL parts. |
|
| 736 | - * |
|
| 737 | - * @param array|null $queryPartNames |
|
| 738 | - * |
|
| 739 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 740 | - * @since 8.2.0 |
|
| 741 | - */ |
|
| 742 | - public function resetQueryParts($queryPartNames = null); |
|
| 743 | - |
|
| 744 | - /** |
|
| 745 | - * Resets a single SQL part. |
|
| 746 | - * |
|
| 747 | - * @param string $queryPartName |
|
| 748 | - * |
|
| 749 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 750 | - * @since 8.2.0 |
|
| 751 | - */ |
|
| 752 | - public function resetQueryPart($queryPartName); |
|
| 753 | - |
|
| 754 | - /** |
|
| 755 | - * Creates a new named parameter and bind the value $value to it. |
|
| 756 | - * |
|
| 757 | - * This method provides a shortcut for PDOStatement::bindValue |
|
| 758 | - * when using prepared statements. |
|
| 759 | - * |
|
| 760 | - * The parameter $value specifies the value that you want to bind. If |
|
| 761 | - * $placeholder is not provided bindValue() will automatically create a |
|
| 762 | - * placeholder for you. An automatic placeholder will be of the name |
|
| 763 | - * ':dcValue1', ':dcValue2' etc. |
|
| 764 | - * |
|
| 765 | - * For more information see {@link http://php.net/pdostatement-bindparam} |
|
| 766 | - * |
|
| 767 | - * Example: |
|
| 768 | - * <code> |
|
| 769 | - * $value = 2; |
|
| 770 | - * $q->eq( 'id', $q->bindValue( $value ) ); |
|
| 771 | - * $stmt = $q->executeQuery(); // executed with 'id = 2' |
|
| 772 | - * </code> |
|
| 773 | - * |
|
| 774 | - * @license New BSD License |
|
| 775 | - * @link http://www.zetacomponents.org |
|
| 776 | - * |
|
| 777 | - * @param mixed $value |
|
| 778 | - * @param mixed $type |
|
| 779 | - * @param string $placeHolder The name to bind with. The string must start with a colon ':'. |
|
| 780 | - * |
|
| 781 | - * @return IParameter |
|
| 782 | - * @since 8.2.0 |
|
| 783 | - */ |
|
| 784 | - public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null); |
|
| 785 | - |
|
| 786 | - /** |
|
| 787 | - * Creates a new positional parameter and bind the given value to it. |
|
| 788 | - * |
|
| 789 | - * Attention: If you are using positional parameters with the query builder you have |
|
| 790 | - * to be very careful to bind all parameters in the order they appear in the SQL |
|
| 791 | - * statement , otherwise they get bound in the wrong order which can lead to serious |
|
| 792 | - * bugs in your code. |
|
| 793 | - * |
|
| 794 | - * Example: |
|
| 795 | - * <code> |
|
| 796 | - * $qb = $conn->getQueryBuilder(); |
|
| 797 | - * $qb->select('u.*') |
|
| 798 | - * ->from('users', 'u') |
|
| 799 | - * ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR)) |
|
| 800 | - * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR)) |
|
| 801 | - * </code> |
|
| 802 | - * |
|
| 803 | - * @param mixed $value |
|
| 804 | - * @param integer $type |
|
| 805 | - * |
|
| 806 | - * @return IParameter |
|
| 807 | - * @since 8.2.0 |
|
| 808 | - */ |
|
| 809 | - public function createPositionalParameter($value, $type = self::PARAM_STR); |
|
| 810 | - |
|
| 811 | - /** |
|
| 812 | - * Creates a new parameter |
|
| 813 | - * |
|
| 814 | - * Example: |
|
| 815 | - * <code> |
|
| 816 | - * $qb = $conn->getQueryBuilder(); |
|
| 817 | - * $qb->select('u.*') |
|
| 818 | - * ->from('users', 'u') |
|
| 819 | - * ->where('u.username = ' . $qb->createParameter('name')) |
|
| 820 | - * ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR)) |
|
| 821 | - * </code> |
|
| 822 | - * |
|
| 823 | - * @param string $name |
|
| 824 | - * |
|
| 825 | - * @return IParameter |
|
| 826 | - * @since 8.2.0 |
|
| 827 | - */ |
|
| 828 | - public function createParameter($name); |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * Creates a new function |
|
| 832 | - * |
|
| 833 | - * Attention: Column names inside the call have to be quoted before hand |
|
| 834 | - * |
|
| 835 | - * Example: |
|
| 836 | - * <code> |
|
| 837 | - * $qb = $conn->getQueryBuilder(); |
|
| 838 | - * $qb->select($qb->createFunction('COUNT(*)')) |
|
| 839 | - * ->from('users', 'u') |
|
| 840 | - * echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u |
|
| 841 | - * </code> |
|
| 842 | - * <code> |
|
| 843 | - * $qb = $conn->getQueryBuilder(); |
|
| 844 | - * $qb->select($qb->createFunction('COUNT(`column`)')) |
|
| 845 | - * ->from('users', 'u') |
|
| 846 | - * echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u |
|
| 847 | - * </code> |
|
| 848 | - * |
|
| 849 | - * @param string $call |
|
| 850 | - * |
|
| 851 | - * @return IQueryFunction |
|
| 852 | - * @since 8.2.0 |
|
| 853 | - */ |
|
| 854 | - public function createFunction($call); |
|
| 855 | - |
|
| 856 | - /** |
|
| 857 | - * Used to get the id of the last inserted element |
|
| 858 | - * @return int |
|
| 859 | - * @throws \BadMethodCallException When being called before an insert query has been run. |
|
| 860 | - * @since 9.0.0 |
|
| 861 | - */ |
|
| 862 | - public function getLastInsertId(); |
|
| 863 | - |
|
| 864 | - /** |
|
| 865 | - * Returns the table name quoted and with database prefix as needed by the implementation |
|
| 866 | - * |
|
| 867 | - * @param string $table |
|
| 868 | - * @return string |
|
| 869 | - * @since 9.0.0 |
|
| 870 | - */ |
|
| 871 | - public function getTableName($table); |
|
| 872 | - |
|
| 873 | - /** |
|
| 874 | - * Returns the column name quoted and with table alias prefix as needed by the implementation |
|
| 875 | - * |
|
| 876 | - * @param string $column |
|
| 877 | - * @param string $tableAlias |
|
| 878 | - * @return string |
|
| 879 | - * @since 9.0.0 |
|
| 880 | - */ |
|
| 881 | - public function getColumnName($column, $tableAlias = ''); |
|
| 34 | + /** |
|
| 35 | + * @since 9.0.0 |
|
| 36 | + */ |
|
| 37 | + const PARAM_NULL = \PDO::PARAM_NULL; |
|
| 38 | + /** |
|
| 39 | + * @since 9.0.0 |
|
| 40 | + */ |
|
| 41 | + const PARAM_BOOL = \PDO::PARAM_BOOL; |
|
| 42 | + /** |
|
| 43 | + * @since 9.0.0 |
|
| 44 | + */ |
|
| 45 | + const PARAM_INT = \PDO::PARAM_INT; |
|
| 46 | + /** |
|
| 47 | + * @since 9.0.0 |
|
| 48 | + */ |
|
| 49 | + const PARAM_STR = \PDO::PARAM_STR; |
|
| 50 | + /** |
|
| 51 | + * @since 9.0.0 |
|
| 52 | + */ |
|
| 53 | + const PARAM_LOB = \PDO::PARAM_LOB; |
|
| 54 | + /** |
|
| 55 | + * @since 9.0.0 |
|
| 56 | + */ |
|
| 57 | + const PARAM_DATE = 'datetime'; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @since 9.0.0 |
|
| 61 | + */ |
|
| 62 | + const PARAM_INT_ARRAY = Connection::PARAM_INT_ARRAY; |
|
| 63 | + /** |
|
| 64 | + * @since 9.0.0 |
|
| 65 | + */ |
|
| 66 | + const PARAM_STR_ARRAY = Connection::PARAM_STR_ARRAY; |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Enable/disable automatic prefixing of table names with the oc_ prefix |
|
| 71 | + * |
|
| 72 | + * @param bool $enabled If set to true table names will be prefixed with the |
|
| 73 | + * owncloud database prefix automatically. |
|
| 74 | + * @since 8.2.0 |
|
| 75 | + */ |
|
| 76 | + public function automaticTablePrefix($enabled); |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Gets an ExpressionBuilder used for object-oriented construction of query expressions. |
|
| 80 | + * This producer method is intended for convenient inline usage. Example: |
|
| 81 | + * |
|
| 82 | + * <code> |
|
| 83 | + * $qb = $conn->getQueryBuilder() |
|
| 84 | + * ->select('u') |
|
| 85 | + * ->from('users', 'u') |
|
| 86 | + * ->where($qb->expr()->eq('u.id', 1)); |
|
| 87 | + * </code> |
|
| 88 | + * |
|
| 89 | + * For more complex expression construction, consider storing the expression |
|
| 90 | + * builder object in a local variable. |
|
| 91 | + * |
|
| 92 | + * @return \OCP\DB\QueryBuilder\IExpressionBuilder |
|
| 93 | + * @since 8.2.0 |
|
| 94 | + */ |
|
| 95 | + public function expr(); |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Gets the type of the currently built query. |
|
| 99 | + * |
|
| 100 | + * @return integer |
|
| 101 | + * @since 8.2.0 |
|
| 102 | + */ |
|
| 103 | + public function getType(); |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Gets the associated DBAL Connection for this query builder. |
|
| 107 | + * |
|
| 108 | + * @return \OCP\IDBConnection |
|
| 109 | + * @since 8.2.0 |
|
| 110 | + */ |
|
| 111 | + public function getConnection(); |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Gets the state of this query builder instance. |
|
| 115 | + * |
|
| 116 | + * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN. |
|
| 117 | + * @since 8.2.0 |
|
| 118 | + */ |
|
| 119 | + public function getState(); |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Executes this query using the bound parameters and their types. |
|
| 123 | + * |
|
| 124 | + * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate} |
|
| 125 | + * for insert, update and delete statements. |
|
| 126 | + * |
|
| 127 | + * @return \Doctrine\DBAL\Driver\Statement|int |
|
| 128 | + * @since 8.2.0 |
|
| 129 | + */ |
|
| 130 | + public function execute(); |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Gets the complete SQL string formed by the current specifications of this QueryBuilder. |
|
| 134 | + * |
|
| 135 | + * <code> |
|
| 136 | + * $qb = $conn->getQueryBuilder() |
|
| 137 | + * ->select('u') |
|
| 138 | + * ->from('User', 'u') |
|
| 139 | + * echo $qb->getSQL(); // SELECT u FROM User u |
|
| 140 | + * </code> |
|
| 141 | + * |
|
| 142 | + * @return string The SQL query string. |
|
| 143 | + * @since 8.2.0 |
|
| 144 | + */ |
|
| 145 | + public function getSQL(); |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * Sets a query parameter for the query being constructed. |
|
| 149 | + * |
|
| 150 | + * <code> |
|
| 151 | + * $qb = $conn->getQueryBuilder() |
|
| 152 | + * ->select('u') |
|
| 153 | + * ->from('users', 'u') |
|
| 154 | + * ->where('u.id = :user_id') |
|
| 155 | + * ->setParameter(':user_id', 1); |
|
| 156 | + * </code> |
|
| 157 | + * |
|
| 158 | + * @param string|integer $key The parameter position or name. |
|
| 159 | + * @param mixed $value The parameter value. |
|
| 160 | + * @param string|null $type One of the IQueryBuilder::PARAM_* constants. |
|
| 161 | + * |
|
| 162 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 163 | + * @since 8.2.0 |
|
| 164 | + */ |
|
| 165 | + public function setParameter($key, $value, $type = null); |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * Sets a collection of query parameters for the query being constructed. |
|
| 169 | + * |
|
| 170 | + * <code> |
|
| 171 | + * $qb = $conn->getQueryBuilder() |
|
| 172 | + * ->select('u') |
|
| 173 | + * ->from('users', 'u') |
|
| 174 | + * ->where('u.id = :user_id1 OR u.id = :user_id2') |
|
| 175 | + * ->setParameters(array( |
|
| 176 | + * ':user_id1' => 1, |
|
| 177 | + * ':user_id2' => 2 |
|
| 178 | + * )); |
|
| 179 | + * </code> |
|
| 180 | + * |
|
| 181 | + * @param array $params The query parameters to set. |
|
| 182 | + * @param array $types The query parameters types to set. |
|
| 183 | + * |
|
| 184 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 185 | + * @since 8.2.0 |
|
| 186 | + */ |
|
| 187 | + public function setParameters(array $params, array $types = array()); |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Gets all defined query parameters for the query being constructed indexed by parameter index or name. |
|
| 191 | + * |
|
| 192 | + * @return array The currently defined query parameters indexed by parameter index or name. |
|
| 193 | + * @since 8.2.0 |
|
| 194 | + */ |
|
| 195 | + public function getParameters(); |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Gets a (previously set) query parameter of the query being constructed. |
|
| 199 | + * |
|
| 200 | + * @param mixed $key The key (index or name) of the bound parameter. |
|
| 201 | + * |
|
| 202 | + * @return mixed The value of the bound parameter. |
|
| 203 | + * @since 8.2.0 |
|
| 204 | + */ |
|
| 205 | + public function getParameter($key); |
|
| 206 | + |
|
| 207 | + /** |
|
| 208 | + * Gets all defined query parameter types for the query being constructed indexed by parameter index or name. |
|
| 209 | + * |
|
| 210 | + * @return array The currently defined query parameter types indexed by parameter index or name. |
|
| 211 | + * @since 8.2.0 |
|
| 212 | + */ |
|
| 213 | + public function getParameterTypes(); |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Gets a (previously set) query parameter type of the query being constructed. |
|
| 217 | + * |
|
| 218 | + * @param mixed $key The key (index or name) of the bound parameter type. |
|
| 219 | + * |
|
| 220 | + * @return mixed The value of the bound parameter type. |
|
| 221 | + * @since 8.2.0 |
|
| 222 | + */ |
|
| 223 | + public function getParameterType($key); |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * Sets the position of the first result to retrieve (the "offset"). |
|
| 227 | + * |
|
| 228 | + * @param integer $firstResult The first result to return. |
|
| 229 | + * |
|
| 230 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 231 | + * @since 8.2.0 |
|
| 232 | + */ |
|
| 233 | + public function setFirstResult($firstResult); |
|
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * Gets the position of the first result the query object was set to retrieve (the "offset"). |
|
| 237 | + * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder. |
|
| 238 | + * |
|
| 239 | + * @return integer The position of the first result. |
|
| 240 | + * @since 8.2.0 |
|
| 241 | + */ |
|
| 242 | + public function getFirstResult(); |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * Sets the maximum number of results to retrieve (the "limit"). |
|
| 246 | + * |
|
| 247 | + * @param integer $maxResults The maximum number of results to retrieve. |
|
| 248 | + * |
|
| 249 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 250 | + * @since 8.2.0 |
|
| 251 | + */ |
|
| 252 | + public function setMaxResults($maxResults); |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Gets the maximum number of results the query object was set to retrieve (the "limit"). |
|
| 256 | + * Returns NULL if {@link setMaxResults} was not applied to this query builder. |
|
| 257 | + * |
|
| 258 | + * @return integer The maximum number of results. |
|
| 259 | + * @since 8.2.0 |
|
| 260 | + */ |
|
| 261 | + public function getMaxResults(); |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * Specifies an item that is to be returned in the query result. |
|
| 265 | + * Replaces any previously specified selections, if any. |
|
| 266 | + * |
|
| 267 | + * <code> |
|
| 268 | + * $qb = $conn->getQueryBuilder() |
|
| 269 | + * ->select('u.id', 'p.id') |
|
| 270 | + * ->from('users', 'u') |
|
| 271 | + * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); |
|
| 272 | + * </code> |
|
| 273 | + * |
|
| 274 | + * @param mixed $select The selection expressions. |
|
| 275 | + * |
|
| 276 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 277 | + * @since 8.2.0 |
|
| 278 | + */ |
|
| 279 | + public function select($select = null); |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * Specifies an item that is to be returned with a different name in the query result. |
|
| 283 | + * |
|
| 284 | + * <code> |
|
| 285 | + * $qb = $conn->getQueryBuilder() |
|
| 286 | + * ->selectAlias('u.id', 'user_id') |
|
| 287 | + * ->from('users', 'u') |
|
| 288 | + * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); |
|
| 289 | + * </code> |
|
| 290 | + * |
|
| 291 | + * @param mixed $select The selection expressions. |
|
| 292 | + * @param string $alias The column alias used in the constructed query. |
|
| 293 | + * |
|
| 294 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 295 | + * @since 8.2.1 |
|
| 296 | + */ |
|
| 297 | + public function selectAlias($select, $alias); |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * Specifies an item that is to be returned uniquely in the query result. |
|
| 301 | + * |
|
| 302 | + * <code> |
|
| 303 | + * $qb = $conn->getQueryBuilder() |
|
| 304 | + * ->selectDistinct('type') |
|
| 305 | + * ->from('users'); |
|
| 306 | + * </code> |
|
| 307 | + * |
|
| 308 | + * @param mixed $select The selection expressions. |
|
| 309 | + * |
|
| 310 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 311 | + * @since 9.0.0 |
|
| 312 | + */ |
|
| 313 | + public function selectDistinct($select); |
|
| 314 | + |
|
| 315 | + /** |
|
| 316 | + * Adds an item that is to be returned in the query result. |
|
| 317 | + * |
|
| 318 | + * <code> |
|
| 319 | + * $qb = $conn->getQueryBuilder() |
|
| 320 | + * ->select('u.id') |
|
| 321 | + * ->addSelect('p.id') |
|
| 322 | + * ->from('users', 'u') |
|
| 323 | + * ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id'); |
|
| 324 | + * </code> |
|
| 325 | + * |
|
| 326 | + * @param mixed $select The selection expression. |
|
| 327 | + * |
|
| 328 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 329 | + * @since 8.2.0 |
|
| 330 | + */ |
|
| 331 | + public function addSelect($select = null); |
|
| 332 | + |
|
| 333 | + /** |
|
| 334 | + * Turns the query being built into a bulk delete query that ranges over |
|
| 335 | + * a certain table. |
|
| 336 | + * |
|
| 337 | + * <code> |
|
| 338 | + * $qb = $conn->getQueryBuilder() |
|
| 339 | + * ->delete('users', 'u') |
|
| 340 | + * ->where('u.id = :user_id'); |
|
| 341 | + * ->setParameter(':user_id', 1); |
|
| 342 | + * </code> |
|
| 343 | + * |
|
| 344 | + * @param string $delete The table whose rows are subject to the deletion. |
|
| 345 | + * @param string $alias The table alias used in the constructed query. |
|
| 346 | + * |
|
| 347 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 348 | + * @since 8.2.0 |
|
| 349 | + */ |
|
| 350 | + public function delete($delete = null, $alias = null); |
|
| 351 | + |
|
| 352 | + /** |
|
| 353 | + * Turns the query being built into a bulk update query that ranges over |
|
| 354 | + * a certain table |
|
| 355 | + * |
|
| 356 | + * <code> |
|
| 357 | + * $qb = $conn->getQueryBuilder() |
|
| 358 | + * ->update('users', 'u') |
|
| 359 | + * ->set('u.password', md5('password')) |
|
| 360 | + * ->where('u.id = ?'); |
|
| 361 | + * </code> |
|
| 362 | + * |
|
| 363 | + * @param string $update The table whose rows are subject to the update. |
|
| 364 | + * @param string $alias The table alias used in the constructed query. |
|
| 365 | + * |
|
| 366 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 367 | + * @since 8.2.0 |
|
| 368 | + */ |
|
| 369 | + public function update($update = null, $alias = null); |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * Turns the query being built into an insert query that inserts into |
|
| 373 | + * a certain table |
|
| 374 | + * |
|
| 375 | + * <code> |
|
| 376 | + * $qb = $conn->getQueryBuilder() |
|
| 377 | + * ->insert('users') |
|
| 378 | + * ->values( |
|
| 379 | + * array( |
|
| 380 | + * 'name' => '?', |
|
| 381 | + * 'password' => '?' |
|
| 382 | + * ) |
|
| 383 | + * ); |
|
| 384 | + * </code> |
|
| 385 | + * |
|
| 386 | + * @param string $insert The table into which the rows should be inserted. |
|
| 387 | + * |
|
| 388 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 389 | + * @since 8.2.0 |
|
| 390 | + */ |
|
| 391 | + public function insert($insert = null); |
|
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * Creates and adds a query root corresponding to the table identified by the |
|
| 395 | + * given alias, forming a cartesian product with any existing query roots. |
|
| 396 | + * |
|
| 397 | + * <code> |
|
| 398 | + * $qb = $conn->getQueryBuilder() |
|
| 399 | + * ->select('u.id') |
|
| 400 | + * ->from('users', 'u') |
|
| 401 | + * </code> |
|
| 402 | + * |
|
| 403 | + * @param string $from The table. |
|
| 404 | + * @param string|null $alias The alias of the table. |
|
| 405 | + * |
|
| 406 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 407 | + * @since 8.2.0 |
|
| 408 | + */ |
|
| 409 | + public function from($from, $alias = null); |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * Creates and adds a join to the query. |
|
| 413 | + * |
|
| 414 | + * <code> |
|
| 415 | + * $qb = $conn->getQueryBuilder() |
|
| 416 | + * ->select('u.name') |
|
| 417 | + * ->from('users', 'u') |
|
| 418 | + * ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 419 | + * </code> |
|
| 420 | + * |
|
| 421 | + * @param string $fromAlias The alias that points to a from clause. |
|
| 422 | + * @param string $join The table name to join. |
|
| 423 | + * @param string $alias The alias of the join table. |
|
| 424 | + * @param string $condition The condition for the join. |
|
| 425 | + * |
|
| 426 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 427 | + * @since 8.2.0 |
|
| 428 | + */ |
|
| 429 | + public function join($fromAlias, $join, $alias, $condition = null); |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * Creates and adds a join to the query. |
|
| 433 | + * |
|
| 434 | + * <code> |
|
| 435 | + * $qb = $conn->getQueryBuilder() |
|
| 436 | + * ->select('u.name') |
|
| 437 | + * ->from('users', 'u') |
|
| 438 | + * ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 439 | + * </code> |
|
| 440 | + * |
|
| 441 | + * @param string $fromAlias The alias that points to a from clause. |
|
| 442 | + * @param string $join The table name to join. |
|
| 443 | + * @param string $alias The alias of the join table. |
|
| 444 | + * @param string $condition The condition for the join. |
|
| 445 | + * |
|
| 446 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 447 | + * @since 8.2.0 |
|
| 448 | + */ |
|
| 449 | + public function innerJoin($fromAlias, $join, $alias, $condition = null); |
|
| 450 | + |
|
| 451 | + /** |
|
| 452 | + * Creates and adds a left join to the query. |
|
| 453 | + * |
|
| 454 | + * <code> |
|
| 455 | + * $qb = $conn->getQueryBuilder() |
|
| 456 | + * ->select('u.name') |
|
| 457 | + * ->from('users', 'u') |
|
| 458 | + * ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 459 | + * </code> |
|
| 460 | + * |
|
| 461 | + * @param string $fromAlias The alias that points to a from clause. |
|
| 462 | + * @param string $join The table name to join. |
|
| 463 | + * @param string $alias The alias of the join table. |
|
| 464 | + * @param string $condition The condition for the join. |
|
| 465 | + * |
|
| 466 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 467 | + * @since 8.2.0 |
|
| 468 | + */ |
|
| 469 | + public function leftJoin($fromAlias, $join, $alias, $condition = null); |
|
| 470 | + |
|
| 471 | + /** |
|
| 472 | + * Creates and adds a right join to the query. |
|
| 473 | + * |
|
| 474 | + * <code> |
|
| 475 | + * $qb = $conn->getQueryBuilder() |
|
| 476 | + * ->select('u.name') |
|
| 477 | + * ->from('users', 'u') |
|
| 478 | + * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
|
| 479 | + * </code> |
|
| 480 | + * |
|
| 481 | + * @param string $fromAlias The alias that points to a from clause. |
|
| 482 | + * @param string $join The table name to join. |
|
| 483 | + * @param string $alias The alias of the join table. |
|
| 484 | + * @param string $condition The condition for the join. |
|
| 485 | + * |
|
| 486 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 487 | + * @since 8.2.0 |
|
| 488 | + */ |
|
| 489 | + public function rightJoin($fromAlias, $join, $alias, $condition = null); |
|
| 490 | + |
|
| 491 | + /** |
|
| 492 | + * Sets a new value for a column in a bulk update query. |
|
| 493 | + * |
|
| 494 | + * <code> |
|
| 495 | + * $qb = $conn->getQueryBuilder() |
|
| 496 | + * ->update('users', 'u') |
|
| 497 | + * ->set('u.password', md5('password')) |
|
| 498 | + * ->where('u.id = ?'); |
|
| 499 | + * </code> |
|
| 500 | + * |
|
| 501 | + * @param string $key The column to set. |
|
| 502 | + * @param string $value The value, expression, placeholder, etc. |
|
| 503 | + * |
|
| 504 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 505 | + * @since 8.2.0 |
|
| 506 | + */ |
|
| 507 | + public function set($key, $value); |
|
| 508 | + |
|
| 509 | + /** |
|
| 510 | + * Specifies one or more restrictions to the query result. |
|
| 511 | + * Replaces any previously specified restrictions, if any. |
|
| 512 | + * |
|
| 513 | + * <code> |
|
| 514 | + * $qb = $conn->getQueryBuilder() |
|
| 515 | + * ->select('u.name') |
|
| 516 | + * ->from('users', 'u') |
|
| 517 | + * ->where('u.id = ?'); |
|
| 518 | + * |
|
| 519 | + * // You can optionally programatically build and/or expressions |
|
| 520 | + * $qb = $conn->getQueryBuilder(); |
|
| 521 | + * |
|
| 522 | + * $or = $qb->expr()->orx(); |
|
| 523 | + * $or->add($qb->expr()->eq('u.id', 1)); |
|
| 524 | + * $or->add($qb->expr()->eq('u.id', 2)); |
|
| 525 | + * |
|
| 526 | + * $qb->update('users', 'u') |
|
| 527 | + * ->set('u.password', md5('password')) |
|
| 528 | + * ->where($or); |
|
| 529 | + * </code> |
|
| 530 | + * |
|
| 531 | + * @param mixed $predicates The restriction predicates. |
|
| 532 | + * |
|
| 533 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 534 | + * @since 8.2.0 |
|
| 535 | + */ |
|
| 536 | + public function where($predicates); |
|
| 537 | + |
|
| 538 | + /** |
|
| 539 | + * Adds one or more restrictions to the query results, forming a logical |
|
| 540 | + * conjunction with any previously specified restrictions. |
|
| 541 | + * |
|
| 542 | + * <code> |
|
| 543 | + * $qb = $conn->getQueryBuilder() |
|
| 544 | + * ->select('u') |
|
| 545 | + * ->from('users', 'u') |
|
| 546 | + * ->where('u.username LIKE ?') |
|
| 547 | + * ->andWhere('u.is_active = 1'); |
|
| 548 | + * </code> |
|
| 549 | + * |
|
| 550 | + * @param mixed $where The query restrictions. |
|
| 551 | + * |
|
| 552 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 553 | + * |
|
| 554 | + * @see where() |
|
| 555 | + * @since 8.2.0 |
|
| 556 | + */ |
|
| 557 | + public function andWhere($where); |
|
| 558 | + |
|
| 559 | + /** |
|
| 560 | + * Adds one or more restrictions to the query results, forming a logical |
|
| 561 | + * disjunction with any previously specified restrictions. |
|
| 562 | + * |
|
| 563 | + * <code> |
|
| 564 | + * $qb = $conn->getQueryBuilder() |
|
| 565 | + * ->select('u.name') |
|
| 566 | + * ->from('users', 'u') |
|
| 567 | + * ->where('u.id = 1') |
|
| 568 | + * ->orWhere('u.id = 2'); |
|
| 569 | + * </code> |
|
| 570 | + * |
|
| 571 | + * @param mixed $where The WHERE statement. |
|
| 572 | + * |
|
| 573 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 574 | + * |
|
| 575 | + * @see where() |
|
| 576 | + * @since 8.2.0 |
|
| 577 | + */ |
|
| 578 | + public function orWhere($where); |
|
| 579 | + |
|
| 580 | + /** |
|
| 581 | + * Specifies a grouping over the results of the query. |
|
| 582 | + * Replaces any previously specified groupings, if any. |
|
| 583 | + * |
|
| 584 | + * <code> |
|
| 585 | + * $qb = $conn->getQueryBuilder() |
|
| 586 | + * ->select('u.name') |
|
| 587 | + * ->from('users', 'u') |
|
| 588 | + * ->groupBy('u.id'); |
|
| 589 | + * </code> |
|
| 590 | + * |
|
| 591 | + * @param mixed $groupBy The grouping expression. |
|
| 592 | + * |
|
| 593 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 594 | + * @since 8.2.0 |
|
| 595 | + */ |
|
| 596 | + public function groupBy($groupBy); |
|
| 597 | + |
|
| 598 | + /** |
|
| 599 | + * Adds a grouping expression to the query. |
|
| 600 | + * |
|
| 601 | + * <code> |
|
| 602 | + * $qb = $conn->getQueryBuilder() |
|
| 603 | + * ->select('u.name') |
|
| 604 | + * ->from('users', 'u') |
|
| 605 | + * ->groupBy('u.lastLogin'); |
|
| 606 | + * ->addGroupBy('u.createdAt') |
|
| 607 | + * </code> |
|
| 608 | + * |
|
| 609 | + * @param mixed $groupBy The grouping expression. |
|
| 610 | + * |
|
| 611 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 612 | + * @since 8.2.0 |
|
| 613 | + */ |
|
| 614 | + public function addGroupBy($groupBy); |
|
| 615 | + |
|
| 616 | + /** |
|
| 617 | + * Sets a value for a column in an insert query. |
|
| 618 | + * |
|
| 619 | + * <code> |
|
| 620 | + * $qb = $conn->getQueryBuilder() |
|
| 621 | + * ->insert('users') |
|
| 622 | + * ->values( |
|
| 623 | + * array( |
|
| 624 | + * 'name' => '?' |
|
| 625 | + * ) |
|
| 626 | + * ) |
|
| 627 | + * ->setValue('password', '?'); |
|
| 628 | + * </code> |
|
| 629 | + * |
|
| 630 | + * @param string $column The column into which the value should be inserted. |
|
| 631 | + * @param string $value The value that should be inserted into the column. |
|
| 632 | + * |
|
| 633 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 634 | + * @since 8.2.0 |
|
| 635 | + */ |
|
| 636 | + public function setValue($column, $value); |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * Specifies values for an insert query indexed by column names. |
|
| 640 | + * Replaces any previous values, if any. |
|
| 641 | + * |
|
| 642 | + * <code> |
|
| 643 | + * $qb = $conn->getQueryBuilder() |
|
| 644 | + * ->insert('users') |
|
| 645 | + * ->values( |
|
| 646 | + * array( |
|
| 647 | + * 'name' => '?', |
|
| 648 | + * 'password' => '?' |
|
| 649 | + * ) |
|
| 650 | + * ); |
|
| 651 | + * </code> |
|
| 652 | + * |
|
| 653 | + * @param array $values The values to specify for the insert query indexed by column names. |
|
| 654 | + * |
|
| 655 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 656 | + * @since 8.2.0 |
|
| 657 | + */ |
|
| 658 | + public function values(array $values); |
|
| 659 | + |
|
| 660 | + /** |
|
| 661 | + * Specifies a restriction over the groups of the query. |
|
| 662 | + * Replaces any previous having restrictions, if any. |
|
| 663 | + * |
|
| 664 | + * @param mixed $having The restriction over the groups. |
|
| 665 | + * |
|
| 666 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 667 | + * @since 8.2.0 |
|
| 668 | + */ |
|
| 669 | + public function having($having); |
|
| 670 | + |
|
| 671 | + /** |
|
| 672 | + * Adds a restriction over the groups of the query, forming a logical |
|
| 673 | + * conjunction with any existing having restrictions. |
|
| 674 | + * |
|
| 675 | + * @param mixed $having The restriction to append. |
|
| 676 | + * |
|
| 677 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 678 | + * @since 8.2.0 |
|
| 679 | + */ |
|
| 680 | + public function andHaving($having); |
|
| 681 | + |
|
| 682 | + /** |
|
| 683 | + * Adds a restriction over the groups of the query, forming a logical |
|
| 684 | + * disjunction with any existing having restrictions. |
|
| 685 | + * |
|
| 686 | + * @param mixed $having The restriction to add. |
|
| 687 | + * |
|
| 688 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 689 | + * @since 8.2.0 |
|
| 690 | + */ |
|
| 691 | + public function orHaving($having); |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * Specifies an ordering for the query results. |
|
| 695 | + * Replaces any previously specified orderings, if any. |
|
| 696 | + * |
|
| 697 | + * @param string $sort The ordering expression. |
|
| 698 | + * @param string $order The ordering direction. |
|
| 699 | + * |
|
| 700 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 701 | + * @since 8.2.0 |
|
| 702 | + */ |
|
| 703 | + public function orderBy($sort, $order = null); |
|
| 704 | + |
|
| 705 | + /** |
|
| 706 | + * Adds an ordering to the query results. |
|
| 707 | + * |
|
| 708 | + * @param string $sort The ordering expression. |
|
| 709 | + * @param string $order The ordering direction. |
|
| 710 | + * |
|
| 711 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 712 | + * @since 8.2.0 |
|
| 713 | + */ |
|
| 714 | + public function addOrderBy($sort, $order = null); |
|
| 715 | + |
|
| 716 | + /** |
|
| 717 | + * Gets a query part by its name. |
|
| 718 | + * |
|
| 719 | + * @param string $queryPartName |
|
| 720 | + * |
|
| 721 | + * @return mixed |
|
| 722 | + * @since 8.2.0 |
|
| 723 | + */ |
|
| 724 | + public function getQueryPart($queryPartName); |
|
| 725 | + |
|
| 726 | + /** |
|
| 727 | + * Gets all query parts. |
|
| 728 | + * |
|
| 729 | + * @return array |
|
| 730 | + * @since 8.2.0 |
|
| 731 | + */ |
|
| 732 | + public function getQueryParts(); |
|
| 733 | + |
|
| 734 | + /** |
|
| 735 | + * Resets SQL parts. |
|
| 736 | + * |
|
| 737 | + * @param array|null $queryPartNames |
|
| 738 | + * |
|
| 739 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 740 | + * @since 8.2.0 |
|
| 741 | + */ |
|
| 742 | + public function resetQueryParts($queryPartNames = null); |
|
| 743 | + |
|
| 744 | + /** |
|
| 745 | + * Resets a single SQL part. |
|
| 746 | + * |
|
| 747 | + * @param string $queryPartName |
|
| 748 | + * |
|
| 749 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. |
|
| 750 | + * @since 8.2.0 |
|
| 751 | + */ |
|
| 752 | + public function resetQueryPart($queryPartName); |
|
| 753 | + |
|
| 754 | + /** |
|
| 755 | + * Creates a new named parameter and bind the value $value to it. |
|
| 756 | + * |
|
| 757 | + * This method provides a shortcut for PDOStatement::bindValue |
|
| 758 | + * when using prepared statements. |
|
| 759 | + * |
|
| 760 | + * The parameter $value specifies the value that you want to bind. If |
|
| 761 | + * $placeholder is not provided bindValue() will automatically create a |
|
| 762 | + * placeholder for you. An automatic placeholder will be of the name |
|
| 763 | + * ':dcValue1', ':dcValue2' etc. |
|
| 764 | + * |
|
| 765 | + * For more information see {@link http://php.net/pdostatement-bindparam} |
|
| 766 | + * |
|
| 767 | + * Example: |
|
| 768 | + * <code> |
|
| 769 | + * $value = 2; |
|
| 770 | + * $q->eq( 'id', $q->bindValue( $value ) ); |
|
| 771 | + * $stmt = $q->executeQuery(); // executed with 'id = 2' |
|
| 772 | + * </code> |
|
| 773 | + * |
|
| 774 | + * @license New BSD License |
|
| 775 | + * @link http://www.zetacomponents.org |
|
| 776 | + * |
|
| 777 | + * @param mixed $value |
|
| 778 | + * @param mixed $type |
|
| 779 | + * @param string $placeHolder The name to bind with. The string must start with a colon ':'. |
|
| 780 | + * |
|
| 781 | + * @return IParameter |
|
| 782 | + * @since 8.2.0 |
|
| 783 | + */ |
|
| 784 | + public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null); |
|
| 785 | + |
|
| 786 | + /** |
|
| 787 | + * Creates a new positional parameter and bind the given value to it. |
|
| 788 | + * |
|
| 789 | + * Attention: If you are using positional parameters with the query builder you have |
|
| 790 | + * to be very careful to bind all parameters in the order they appear in the SQL |
|
| 791 | + * statement , otherwise they get bound in the wrong order which can lead to serious |
|
| 792 | + * bugs in your code. |
|
| 793 | + * |
|
| 794 | + * Example: |
|
| 795 | + * <code> |
|
| 796 | + * $qb = $conn->getQueryBuilder(); |
|
| 797 | + * $qb->select('u.*') |
|
| 798 | + * ->from('users', 'u') |
|
| 799 | + * ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR)) |
|
| 800 | + * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR)) |
|
| 801 | + * </code> |
|
| 802 | + * |
|
| 803 | + * @param mixed $value |
|
| 804 | + * @param integer $type |
|
| 805 | + * |
|
| 806 | + * @return IParameter |
|
| 807 | + * @since 8.2.0 |
|
| 808 | + */ |
|
| 809 | + public function createPositionalParameter($value, $type = self::PARAM_STR); |
|
| 810 | + |
|
| 811 | + /** |
|
| 812 | + * Creates a new parameter |
|
| 813 | + * |
|
| 814 | + * Example: |
|
| 815 | + * <code> |
|
| 816 | + * $qb = $conn->getQueryBuilder(); |
|
| 817 | + * $qb->select('u.*') |
|
| 818 | + * ->from('users', 'u') |
|
| 819 | + * ->where('u.username = ' . $qb->createParameter('name')) |
|
| 820 | + * ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR)) |
|
| 821 | + * </code> |
|
| 822 | + * |
|
| 823 | + * @param string $name |
|
| 824 | + * |
|
| 825 | + * @return IParameter |
|
| 826 | + * @since 8.2.0 |
|
| 827 | + */ |
|
| 828 | + public function createParameter($name); |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * Creates a new function |
|
| 832 | + * |
|
| 833 | + * Attention: Column names inside the call have to be quoted before hand |
|
| 834 | + * |
|
| 835 | + * Example: |
|
| 836 | + * <code> |
|
| 837 | + * $qb = $conn->getQueryBuilder(); |
|
| 838 | + * $qb->select($qb->createFunction('COUNT(*)')) |
|
| 839 | + * ->from('users', 'u') |
|
| 840 | + * echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u |
|
| 841 | + * </code> |
|
| 842 | + * <code> |
|
| 843 | + * $qb = $conn->getQueryBuilder(); |
|
| 844 | + * $qb->select($qb->createFunction('COUNT(`column`)')) |
|
| 845 | + * ->from('users', 'u') |
|
| 846 | + * echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u |
|
| 847 | + * </code> |
|
| 848 | + * |
|
| 849 | + * @param string $call |
|
| 850 | + * |
|
| 851 | + * @return IQueryFunction |
|
| 852 | + * @since 8.2.0 |
|
| 853 | + */ |
|
| 854 | + public function createFunction($call); |
|
| 855 | + |
|
| 856 | + /** |
|
| 857 | + * Used to get the id of the last inserted element |
|
| 858 | + * @return int |
|
| 859 | + * @throws \BadMethodCallException When being called before an insert query has been run. |
|
| 860 | + * @since 9.0.0 |
|
| 861 | + */ |
|
| 862 | + public function getLastInsertId(); |
|
| 863 | + |
|
| 864 | + /** |
|
| 865 | + * Returns the table name quoted and with database prefix as needed by the implementation |
|
| 866 | + * |
|
| 867 | + * @param string $table |
|
| 868 | + * @return string |
|
| 869 | + * @since 9.0.0 |
|
| 870 | + */ |
|
| 871 | + public function getTableName($table); |
|
| 872 | + |
|
| 873 | + /** |
|
| 874 | + * Returns the column name quoted and with table alias prefix as needed by the implementation |
|
| 875 | + * |
|
| 876 | + * @param string $column |
|
| 877 | + * @param string $tableAlias |
|
| 878 | + * @return string |
|
| 879 | + * @since 9.0.0 |
|
| 880 | + */ |
|
| 881 | + public function getColumnName($column, $tableAlias = ''); |
|
| 882 | 882 | } |
@@ -28,39 +28,39 @@ |
||
| 28 | 28 | * @since 8.2.0 |
| 29 | 29 | */ |
| 30 | 30 | interface ICompositeExpression { |
| 31 | - /** |
|
| 32 | - * Adds multiple parts to composite expression. |
|
| 33 | - * |
|
| 34 | - * @param array $parts |
|
| 35 | - * |
|
| 36 | - * @return ICompositeExpression |
|
| 37 | - * @since 8.2.0 |
|
| 38 | - */ |
|
| 39 | - public function addMultiple(array $parts = array()); |
|
| 31 | + /** |
|
| 32 | + * Adds multiple parts to composite expression. |
|
| 33 | + * |
|
| 34 | + * @param array $parts |
|
| 35 | + * |
|
| 36 | + * @return ICompositeExpression |
|
| 37 | + * @since 8.2.0 |
|
| 38 | + */ |
|
| 39 | + public function addMultiple(array $parts = array()); |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Adds an expression to composite expression. |
|
| 43 | - * |
|
| 44 | - * @param mixed $part |
|
| 45 | - * |
|
| 46 | - * @return ICompositeExpression |
|
| 47 | - * @since 8.2.0 |
|
| 48 | - */ |
|
| 49 | - public function add($part); |
|
| 41 | + /** |
|
| 42 | + * Adds an expression to composite expression. |
|
| 43 | + * |
|
| 44 | + * @param mixed $part |
|
| 45 | + * |
|
| 46 | + * @return ICompositeExpression |
|
| 47 | + * @since 8.2.0 |
|
| 48 | + */ |
|
| 49 | + public function add($part); |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Retrieves the amount of expressions on composite expression. |
|
| 53 | - * |
|
| 54 | - * @return integer |
|
| 55 | - * @since 8.2.0 |
|
| 56 | - */ |
|
| 57 | - public function count(); |
|
| 51 | + /** |
|
| 52 | + * Retrieves the amount of expressions on composite expression. |
|
| 53 | + * |
|
| 54 | + * @return integer |
|
| 55 | + * @since 8.2.0 |
|
| 56 | + */ |
|
| 57 | + public function count(); |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Returns the type of this composite expression (AND/OR). |
|
| 61 | - * |
|
| 62 | - * @return string |
|
| 63 | - * @since 8.2.0 |
|
| 64 | - */ |
|
| 65 | - public function getType(); |
|
| 59 | + /** |
|
| 60 | + * Returns the type of this composite expression (AND/OR). |
|
| 61 | + * |
|
| 62 | + * @return string |
|
| 63 | + * @since 8.2.0 |
|
| 64 | + */ |
|
| 65 | + public function getType(); |
|
| 66 | 66 | } |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | * @since 8.2.0 |
| 27 | 27 | */ |
| 28 | 28 | interface IParameter { |
| 29 | - /** |
|
| 30 | - * @return string |
|
| 31 | - * @since 8.2.0 |
|
| 32 | - */ |
|
| 33 | - public function __toString(); |
|
| 29 | + /** |
|
| 30 | + * @return string |
|
| 31 | + * @since 8.2.0 |
|
| 32 | + */ |
|
| 33 | + public function __toString(); |
|
| 34 | 34 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @since 9.0.0 |
| 37 | 37 | */ |
| 38 | - const EQ = ExpressionBuilder::EQ; |
|
| 38 | + const EQ = ExpressionBuilder::EQ; |
|
| 39 | 39 | /** |
| 40 | 40 | * @since 9.0.0 |
| 41 | 41 | */ |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | /** |
| 44 | 44 | * @since 9.0.0 |
| 45 | 45 | */ |
| 46 | - const LT = ExpressionBuilder::LT; |
|
| 46 | + const LT = ExpressionBuilder::LT; |
|
| 47 | 47 | /** |
| 48 | 48 | * @since 9.0.0 |
| 49 | 49 | */ |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * @since 9.0.0 |
| 53 | 53 | */ |
| 54 | - const GT = ExpressionBuilder::GT; |
|
| 54 | + const GT = ExpressionBuilder::GT; |
|
| 55 | 55 | /** |
| 56 | 56 | * @since 9.0.0 |
| 57 | 57 | */ |
@@ -32,297 +32,297 @@ |
||
| 32 | 32 | * @since 8.2.0 |
| 33 | 33 | */ |
| 34 | 34 | interface IExpressionBuilder { |
| 35 | - /** |
|
| 36 | - * @since 9.0.0 |
|
| 37 | - */ |
|
| 38 | - const EQ = ExpressionBuilder::EQ; |
|
| 39 | - /** |
|
| 40 | - * @since 9.0.0 |
|
| 41 | - */ |
|
| 42 | - const NEQ = ExpressionBuilder::NEQ; |
|
| 43 | - /** |
|
| 44 | - * @since 9.0.0 |
|
| 45 | - */ |
|
| 46 | - const LT = ExpressionBuilder::LT; |
|
| 47 | - /** |
|
| 48 | - * @since 9.0.0 |
|
| 49 | - */ |
|
| 50 | - const LTE = ExpressionBuilder::LTE; |
|
| 51 | - /** |
|
| 52 | - * @since 9.0.0 |
|
| 53 | - */ |
|
| 54 | - const GT = ExpressionBuilder::GT; |
|
| 55 | - /** |
|
| 56 | - * @since 9.0.0 |
|
| 57 | - */ |
|
| 58 | - const GTE = ExpressionBuilder::GTE; |
|
| 35 | + /** |
|
| 36 | + * @since 9.0.0 |
|
| 37 | + */ |
|
| 38 | + const EQ = ExpressionBuilder::EQ; |
|
| 39 | + /** |
|
| 40 | + * @since 9.0.0 |
|
| 41 | + */ |
|
| 42 | + const NEQ = ExpressionBuilder::NEQ; |
|
| 43 | + /** |
|
| 44 | + * @since 9.0.0 |
|
| 45 | + */ |
|
| 46 | + const LT = ExpressionBuilder::LT; |
|
| 47 | + /** |
|
| 48 | + * @since 9.0.0 |
|
| 49 | + */ |
|
| 50 | + const LTE = ExpressionBuilder::LTE; |
|
| 51 | + /** |
|
| 52 | + * @since 9.0.0 |
|
| 53 | + */ |
|
| 54 | + const GT = ExpressionBuilder::GT; |
|
| 55 | + /** |
|
| 56 | + * @since 9.0.0 |
|
| 57 | + */ |
|
| 58 | + const GTE = ExpressionBuilder::GTE; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Creates a conjunction of the given boolean expressions. |
|
| 62 | - * |
|
| 63 | - * Example: |
|
| 64 | - * |
|
| 65 | - * [php] |
|
| 66 | - * // (u.type = ?) AND (u.role = ?) |
|
| 67 | - * $expr->andX('u.type = ?', 'u.role = ?')); |
|
| 68 | - * |
|
| 69 | - * @param mixed $x Optional clause. Defaults = null, but requires |
|
| 70 | - * at least one defined when converting to string. |
|
| 71 | - * |
|
| 72 | - * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
| 73 | - * @since 8.2.0 |
|
| 74 | - */ |
|
| 75 | - public function andX($x = null); |
|
| 60 | + /** |
|
| 61 | + * Creates a conjunction of the given boolean expressions. |
|
| 62 | + * |
|
| 63 | + * Example: |
|
| 64 | + * |
|
| 65 | + * [php] |
|
| 66 | + * // (u.type = ?) AND (u.role = ?) |
|
| 67 | + * $expr->andX('u.type = ?', 'u.role = ?')); |
|
| 68 | + * |
|
| 69 | + * @param mixed $x Optional clause. Defaults = null, but requires |
|
| 70 | + * at least one defined when converting to string. |
|
| 71 | + * |
|
| 72 | + * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
| 73 | + * @since 8.2.0 |
|
| 74 | + */ |
|
| 75 | + public function andX($x = null); |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Creates a disjunction of the given boolean expressions. |
|
| 79 | - * |
|
| 80 | - * Example: |
|
| 81 | - * |
|
| 82 | - * [php] |
|
| 83 | - * // (u.type = ?) OR (u.role = ?) |
|
| 84 | - * $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?')); |
|
| 85 | - * |
|
| 86 | - * @param mixed $x Optional clause. Defaults = null, but requires |
|
| 87 | - * at least one defined when converting to string. |
|
| 88 | - * |
|
| 89 | - * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
| 90 | - * @since 8.2.0 |
|
| 91 | - */ |
|
| 92 | - public function orX($x = null); |
|
| 77 | + /** |
|
| 78 | + * Creates a disjunction of the given boolean expressions. |
|
| 79 | + * |
|
| 80 | + * Example: |
|
| 81 | + * |
|
| 82 | + * [php] |
|
| 83 | + * // (u.type = ?) OR (u.role = ?) |
|
| 84 | + * $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?')); |
|
| 85 | + * |
|
| 86 | + * @param mixed $x Optional clause. Defaults = null, but requires |
|
| 87 | + * at least one defined when converting to string. |
|
| 88 | + * |
|
| 89 | + * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
| 90 | + * @since 8.2.0 |
|
| 91 | + */ |
|
| 92 | + public function orX($x = null); |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Creates a comparison expression. |
|
| 96 | - * |
|
| 97 | - * @param mixed $x The left expression. |
|
| 98 | - * @param string $operator One of the IExpressionBuilder::* constants. |
|
| 99 | - * @param mixed $y The right expression. |
|
| 100 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 101 | - * required when comparing text fields for oci compatibility |
|
| 102 | - * |
|
| 103 | - * @return string |
|
| 104 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 105 | - */ |
|
| 106 | - public function comparison($x, $operator, $y, $type = null); |
|
| 94 | + /** |
|
| 95 | + * Creates a comparison expression. |
|
| 96 | + * |
|
| 97 | + * @param mixed $x The left expression. |
|
| 98 | + * @param string $operator One of the IExpressionBuilder::* constants. |
|
| 99 | + * @param mixed $y The right expression. |
|
| 100 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 101 | + * required when comparing text fields for oci compatibility |
|
| 102 | + * |
|
| 103 | + * @return string |
|
| 104 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 105 | + */ |
|
| 106 | + public function comparison($x, $operator, $y, $type = null); |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Creates an equality comparison expression with the given arguments. |
|
| 110 | - * |
|
| 111 | - * First argument is considered the left expression and the second is the right expression. |
|
| 112 | - * When converted to string, it will generated a <left expr> = <right expr>. Example: |
|
| 113 | - * |
|
| 114 | - * [php] |
|
| 115 | - * // u.id = ? |
|
| 116 | - * $expr->eq('u.id', '?'); |
|
| 117 | - * |
|
| 118 | - * @param mixed $x The left expression. |
|
| 119 | - * @param mixed $y The right expression. |
|
| 120 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 121 | - * required when comparing text fields for oci compatibility |
|
| 122 | - * |
|
| 123 | - * @return string |
|
| 124 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 125 | - */ |
|
| 126 | - public function eq($x, $y, $type = null); |
|
| 108 | + /** |
|
| 109 | + * Creates an equality comparison expression with the given arguments. |
|
| 110 | + * |
|
| 111 | + * First argument is considered the left expression and the second is the right expression. |
|
| 112 | + * When converted to string, it will generated a <left expr> = <right expr>. Example: |
|
| 113 | + * |
|
| 114 | + * [php] |
|
| 115 | + * // u.id = ? |
|
| 116 | + * $expr->eq('u.id', '?'); |
|
| 117 | + * |
|
| 118 | + * @param mixed $x The left expression. |
|
| 119 | + * @param mixed $y The right expression. |
|
| 120 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 121 | + * required when comparing text fields for oci compatibility |
|
| 122 | + * |
|
| 123 | + * @return string |
|
| 124 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 125 | + */ |
|
| 126 | + public function eq($x, $y, $type = null); |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Creates a non equality comparison expression with the given arguments. |
|
| 130 | - * First argument is considered the left expression and the second is the right expression. |
|
| 131 | - * When converted to string, it will generated a <left expr> <> <right expr>. Example: |
|
| 132 | - * |
|
| 133 | - * [php] |
|
| 134 | - * // u.id <> 1 |
|
| 135 | - * $q->where($q->expr()->neq('u.id', '1')); |
|
| 136 | - * |
|
| 137 | - * @param mixed $x The left expression. |
|
| 138 | - * @param mixed $y The right expression. |
|
| 139 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 140 | - * required when comparing text fields for oci compatibility |
|
| 141 | - * |
|
| 142 | - * @return string |
|
| 143 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 144 | - */ |
|
| 145 | - public function neq($x, $y, $type = null); |
|
| 128 | + /** |
|
| 129 | + * Creates a non equality comparison expression with the given arguments. |
|
| 130 | + * First argument is considered the left expression and the second is the right expression. |
|
| 131 | + * When converted to string, it will generated a <left expr> <> <right expr>. Example: |
|
| 132 | + * |
|
| 133 | + * [php] |
|
| 134 | + * // u.id <> 1 |
|
| 135 | + * $q->where($q->expr()->neq('u.id', '1')); |
|
| 136 | + * |
|
| 137 | + * @param mixed $x The left expression. |
|
| 138 | + * @param mixed $y The right expression. |
|
| 139 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 140 | + * required when comparing text fields for oci compatibility |
|
| 141 | + * |
|
| 142 | + * @return string |
|
| 143 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 144 | + */ |
|
| 145 | + public function neq($x, $y, $type = null); |
|
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * Creates a lower-than comparison expression with the given arguments. |
|
| 149 | - * First argument is considered the left expression and the second is the right expression. |
|
| 150 | - * When converted to string, it will generated a <left expr> < <right expr>. Example: |
|
| 151 | - * |
|
| 152 | - * [php] |
|
| 153 | - * // u.id < ? |
|
| 154 | - * $q->where($q->expr()->lt('u.id', '?')); |
|
| 155 | - * |
|
| 156 | - * @param mixed $x The left expression. |
|
| 157 | - * @param mixed $y The right expression. |
|
| 158 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 159 | - * required when comparing text fields for oci compatibility |
|
| 160 | - * |
|
| 161 | - * @return string |
|
| 162 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 163 | - */ |
|
| 164 | - public function lt($x, $y, $type = null); |
|
| 147 | + /** |
|
| 148 | + * Creates a lower-than comparison expression with the given arguments. |
|
| 149 | + * First argument is considered the left expression and the second is the right expression. |
|
| 150 | + * When converted to string, it will generated a <left expr> < <right expr>. Example: |
|
| 151 | + * |
|
| 152 | + * [php] |
|
| 153 | + * // u.id < ? |
|
| 154 | + * $q->where($q->expr()->lt('u.id', '?')); |
|
| 155 | + * |
|
| 156 | + * @param mixed $x The left expression. |
|
| 157 | + * @param mixed $y The right expression. |
|
| 158 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 159 | + * required when comparing text fields for oci compatibility |
|
| 160 | + * |
|
| 161 | + * @return string |
|
| 162 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 163 | + */ |
|
| 164 | + public function lt($x, $y, $type = null); |
|
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Creates a lower-than-equal comparison expression with the given arguments. |
|
| 168 | - * First argument is considered the left expression and the second is the right expression. |
|
| 169 | - * When converted to string, it will generated a <left expr> <= <right expr>. Example: |
|
| 170 | - * |
|
| 171 | - * [php] |
|
| 172 | - * // u.id <= ? |
|
| 173 | - * $q->where($q->expr()->lte('u.id', '?')); |
|
| 174 | - * |
|
| 175 | - * @param mixed $x The left expression. |
|
| 176 | - * @param mixed $y The right expression. |
|
| 177 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 178 | - * required when comparing text fields for oci compatibility |
|
| 179 | - * |
|
| 180 | - * @return string |
|
| 181 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 182 | - */ |
|
| 183 | - public function lte($x, $y, $type = null); |
|
| 166 | + /** |
|
| 167 | + * Creates a lower-than-equal comparison expression with the given arguments. |
|
| 168 | + * First argument is considered the left expression and the second is the right expression. |
|
| 169 | + * When converted to string, it will generated a <left expr> <= <right expr>. Example: |
|
| 170 | + * |
|
| 171 | + * [php] |
|
| 172 | + * // u.id <= ? |
|
| 173 | + * $q->where($q->expr()->lte('u.id', '?')); |
|
| 174 | + * |
|
| 175 | + * @param mixed $x The left expression. |
|
| 176 | + * @param mixed $y The right expression. |
|
| 177 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 178 | + * required when comparing text fields for oci compatibility |
|
| 179 | + * |
|
| 180 | + * @return string |
|
| 181 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 182 | + */ |
|
| 183 | + public function lte($x, $y, $type = null); |
|
| 184 | 184 | |
| 185 | - /** |
|
| 186 | - * Creates a greater-than comparison expression with the given arguments. |
|
| 187 | - * First argument is considered the left expression and the second is the right expression. |
|
| 188 | - * When converted to string, it will generated a <left expr> > <right expr>. Example: |
|
| 189 | - * |
|
| 190 | - * [php] |
|
| 191 | - * // u.id > ? |
|
| 192 | - * $q->where($q->expr()->gt('u.id', '?')); |
|
| 193 | - * |
|
| 194 | - * @param mixed $x The left expression. |
|
| 195 | - * @param mixed $y The right expression. |
|
| 196 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 197 | - * required when comparing text fields for oci compatibility |
|
| 198 | - * |
|
| 199 | - * @return string |
|
| 200 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 201 | - */ |
|
| 202 | - public function gt($x, $y, $type = null); |
|
| 185 | + /** |
|
| 186 | + * Creates a greater-than comparison expression with the given arguments. |
|
| 187 | + * First argument is considered the left expression and the second is the right expression. |
|
| 188 | + * When converted to string, it will generated a <left expr> > <right expr>. Example: |
|
| 189 | + * |
|
| 190 | + * [php] |
|
| 191 | + * // u.id > ? |
|
| 192 | + * $q->where($q->expr()->gt('u.id', '?')); |
|
| 193 | + * |
|
| 194 | + * @param mixed $x The left expression. |
|
| 195 | + * @param mixed $y The right expression. |
|
| 196 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 197 | + * required when comparing text fields for oci compatibility |
|
| 198 | + * |
|
| 199 | + * @return string |
|
| 200 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 201 | + */ |
|
| 202 | + public function gt($x, $y, $type = null); |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Creates a greater-than-equal comparison expression with the given arguments. |
|
| 206 | - * First argument is considered the left expression and the second is the right expression. |
|
| 207 | - * When converted to string, it will generated a <left expr> >= <right expr>. Example: |
|
| 208 | - * |
|
| 209 | - * [php] |
|
| 210 | - * // u.id >= ? |
|
| 211 | - * $q->where($q->expr()->gte('u.id', '?')); |
|
| 212 | - * |
|
| 213 | - * @param mixed $x The left expression. |
|
| 214 | - * @param mixed $y The right expression. |
|
| 215 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 216 | - * required when comparing text fields for oci compatibility |
|
| 217 | - * |
|
| 218 | - * @return string |
|
| 219 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 220 | - */ |
|
| 221 | - public function gte($x, $y, $type = null); |
|
| 204 | + /** |
|
| 205 | + * Creates a greater-than-equal comparison expression with the given arguments. |
|
| 206 | + * First argument is considered the left expression and the second is the right expression. |
|
| 207 | + * When converted to string, it will generated a <left expr> >= <right expr>. Example: |
|
| 208 | + * |
|
| 209 | + * [php] |
|
| 210 | + * // u.id >= ? |
|
| 211 | + * $q->where($q->expr()->gte('u.id', '?')); |
|
| 212 | + * |
|
| 213 | + * @param mixed $x The left expression. |
|
| 214 | + * @param mixed $y The right expression. |
|
| 215 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 216 | + * required when comparing text fields for oci compatibility |
|
| 217 | + * |
|
| 218 | + * @return string |
|
| 219 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 220 | + */ |
|
| 221 | + public function gte($x, $y, $type = null); |
|
| 222 | 222 | |
| 223 | - /** |
|
| 224 | - * Creates an IS NULL expression with the given arguments. |
|
| 225 | - * |
|
| 226 | - * @param string $x The field in string format to be restricted by IS NULL. |
|
| 227 | - * |
|
| 228 | - * @return string |
|
| 229 | - * @since 8.2.0 |
|
| 230 | - */ |
|
| 231 | - public function isNull($x); |
|
| 223 | + /** |
|
| 224 | + * Creates an IS NULL expression with the given arguments. |
|
| 225 | + * |
|
| 226 | + * @param string $x The field in string format to be restricted by IS NULL. |
|
| 227 | + * |
|
| 228 | + * @return string |
|
| 229 | + * @since 8.2.0 |
|
| 230 | + */ |
|
| 231 | + public function isNull($x); |
|
| 232 | 232 | |
| 233 | - /** |
|
| 234 | - * Creates an IS NOT NULL expression with the given arguments. |
|
| 235 | - * |
|
| 236 | - * @param string $x The field in string format to be restricted by IS NOT NULL. |
|
| 237 | - * |
|
| 238 | - * @return string |
|
| 239 | - * @since 8.2.0 |
|
| 240 | - */ |
|
| 241 | - public function isNotNull($x); |
|
| 233 | + /** |
|
| 234 | + * Creates an IS NOT NULL expression with the given arguments. |
|
| 235 | + * |
|
| 236 | + * @param string $x The field in string format to be restricted by IS NOT NULL. |
|
| 237 | + * |
|
| 238 | + * @return string |
|
| 239 | + * @since 8.2.0 |
|
| 240 | + */ |
|
| 241 | + public function isNotNull($x); |
|
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * Creates a LIKE() comparison expression with the given arguments. |
|
| 245 | - * |
|
| 246 | - * @param string $x Field in string format to be inspected by LIKE() comparison. |
|
| 247 | - * @param mixed $y Argument to be used in LIKE() comparison. |
|
| 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 | - public function like($x, $y, $type = null); |
|
| 243 | + /** |
|
| 244 | + * Creates a LIKE() comparison expression with the given arguments. |
|
| 245 | + * |
|
| 246 | + * @param string $x Field in string format to be inspected by LIKE() comparison. |
|
| 247 | + * @param mixed $y Argument to be used in LIKE() comparison. |
|
| 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 | + public function like($x, $y, $type = null); |
|
| 255 | 255 | |
| 256 | - /** |
|
| 257 | - * Creates a NOT LIKE() comparison expression with the given arguments. |
|
| 258 | - * |
|
| 259 | - * @param string $x Field in string format to be inspected by NOT LIKE() comparison. |
|
| 260 | - * @param mixed $y Argument to be used in NOT LIKE() comparison. |
|
| 261 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 262 | - * required when comparing text fields for oci compatibility |
|
| 263 | - * |
|
| 264 | - * @return string |
|
| 265 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 266 | - */ |
|
| 267 | - public function notLike($x, $y, $type = null); |
|
| 256 | + /** |
|
| 257 | + * Creates a NOT LIKE() comparison expression with the given arguments. |
|
| 258 | + * |
|
| 259 | + * @param string $x Field in string format to be inspected by NOT LIKE() comparison. |
|
| 260 | + * @param mixed $y Argument to be used in NOT LIKE() comparison. |
|
| 261 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 262 | + * required when comparing text fields for oci compatibility |
|
| 263 | + * |
|
| 264 | + * @return string |
|
| 265 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 266 | + */ |
|
| 267 | + public function notLike($x, $y, $type = null); |
|
| 268 | 268 | |
| 269 | - /** |
|
| 270 | - * Creates a ILIKE() comparison expression with the given arguments. |
|
| 271 | - * |
|
| 272 | - * @param string $x Field in string format to be inspected by ILIKE() comparison. |
|
| 273 | - * @param mixed $y Argument to be used in ILIKE() comparison. |
|
| 274 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 275 | - * required when comparing text fields for oci compatibility |
|
| 276 | - * |
|
| 277 | - * @return string |
|
| 278 | - * @since 9.0.0 |
|
| 279 | - */ |
|
| 280 | - public function iLike($x, $y, $type = null); |
|
| 269 | + /** |
|
| 270 | + * Creates a ILIKE() comparison expression with the given arguments. |
|
| 271 | + * |
|
| 272 | + * @param string $x Field in string format to be inspected by ILIKE() comparison. |
|
| 273 | + * @param mixed $y Argument to be used in ILIKE() comparison. |
|
| 274 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 275 | + * required when comparing text fields for oci compatibility |
|
| 276 | + * |
|
| 277 | + * @return string |
|
| 278 | + * @since 9.0.0 |
|
| 279 | + */ |
|
| 280 | + public function iLike($x, $y, $type = null); |
|
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * Creates a IN () comparison expression with the given arguments. |
|
| 284 | - * |
|
| 285 | - * @param string $x The field in string format to be inspected by IN() comparison. |
|
| 286 | - * @param string|array $y The placeholder or the array of values to be used by IN() comparison. |
|
| 287 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 288 | - * required when comparing text fields for oci compatibility |
|
| 289 | - * |
|
| 290 | - * @return string |
|
| 291 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 292 | - */ |
|
| 293 | - public function in($x, $y, $type = null); |
|
| 282 | + /** |
|
| 283 | + * Creates a IN () comparison expression with the given arguments. |
|
| 284 | + * |
|
| 285 | + * @param string $x The field in string format to be inspected by IN() comparison. |
|
| 286 | + * @param string|array $y The placeholder or the array of values to be used by IN() comparison. |
|
| 287 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 288 | + * required when comparing text fields for oci compatibility |
|
| 289 | + * |
|
| 290 | + * @return string |
|
| 291 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 292 | + */ |
|
| 293 | + public function in($x, $y, $type = null); |
|
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Creates a NOT IN () comparison expression with the given arguments. |
|
| 297 | - * |
|
| 298 | - * @param string $x The field in string format to be inspected by NOT IN() comparison. |
|
| 299 | - * @param string|array $y The placeholder or the array of values to be used by NOT IN() comparison. |
|
| 300 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 301 | - * required when comparing text fields for oci compatibility |
|
| 302 | - * |
|
| 303 | - * @return string |
|
| 304 | - * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 305 | - */ |
|
| 306 | - public function notIn($x, $y, $type = null); |
|
| 295 | + /** |
|
| 296 | + * Creates a NOT IN () comparison expression with the given arguments. |
|
| 297 | + * |
|
| 298 | + * @param string $x The field in string format to be inspected by NOT IN() comparison. |
|
| 299 | + * @param string|array $y The placeholder or the array of values to be used by NOT IN() comparison. |
|
| 300 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
| 301 | + * required when comparing text fields for oci compatibility |
|
| 302 | + * |
|
| 303 | + * @return string |
|
| 304 | + * @since 8.2.0 - Parameter $type was added in 9.0.0 |
|
| 305 | + */ |
|
| 306 | + public function notIn($x, $y, $type = null); |
|
| 307 | 307 | |
| 308 | - /** |
|
| 309 | - * Quotes a given input parameter. |
|
| 310 | - * |
|
| 311 | - * @param mixed $input The parameter to be quoted. |
|
| 312 | - * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants |
|
| 313 | - * |
|
| 314 | - * @return string |
|
| 315 | - * @since 8.2.0 |
|
| 316 | - */ |
|
| 317 | - public function literal($input, $type = null); |
|
| 308 | + /** |
|
| 309 | + * Quotes a given input parameter. |
|
| 310 | + * |
|
| 311 | + * @param mixed $input The parameter to be quoted. |
|
| 312 | + * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants |
|
| 313 | + * |
|
| 314 | + * @return string |
|
| 315 | + * @since 8.2.0 |
|
| 316 | + */ |
|
| 317 | + public function literal($input, $type = null); |
|
| 318 | 318 | |
| 319 | - /** |
|
| 320 | - * Returns a IQueryFunction that casts the column to the given type |
|
| 321 | - * |
|
| 322 | - * @param string $column |
|
| 323 | - * @param mixed $type One of IQueryBuilder::PARAM_* |
|
| 324 | - * @return string |
|
| 325 | - * @since 9.0.0 |
|
| 326 | - */ |
|
| 327 | - public function castColumn($column, $type); |
|
| 319 | + /** |
|
| 320 | + * Returns a IQueryFunction that casts the column to the given type |
|
| 321 | + * |
|
| 322 | + * @param string $column |
|
| 323 | + * @param mixed $type One of IQueryBuilder::PARAM_* |
|
| 324 | + * @return string |
|
| 325 | + * @since 9.0.0 |
|
| 326 | + */ |
|
| 327 | + public function castColumn($column, $type); |
|
| 328 | 328 | } |
@@ -33,153 +33,153 @@ |
||
| 33 | 33 | // This means that they should be used by apps instead of the internal ownCloud classes |
| 34 | 34 | namespace OCP { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * This class provides access to the contacts app. Use this class exclusively if you want to access contacts. |
|
| 38 | - * |
|
| 39 | - * Contacts in general will be expressed as an array of key-value-pairs. |
|
| 40 | - * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1 |
|
| 41 | - * |
|
| 42 | - * Proposed workflow for working with contacts: |
|
| 43 | - * - search for the contacts |
|
| 44 | - * - manipulate the results array |
|
| 45 | - * - createOrUpdate will save the given contacts overwriting the existing data |
|
| 46 | - * |
|
| 47 | - * For updating it is mandatory to keep the id. |
|
| 48 | - * Without an id a new contact will be created. |
|
| 49 | - * |
|
| 50 | - * @deprecated 8.1.0 use methods of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 51 | - * @since 5.0.0 |
|
| 52 | - */ |
|
| 53 | - class Contacts { |
|
| 36 | + /** |
|
| 37 | + * This class provides access to the contacts app. Use this class exclusively if you want to access contacts. |
|
| 38 | + * |
|
| 39 | + * Contacts in general will be expressed as an array of key-value-pairs. |
|
| 40 | + * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1 |
|
| 41 | + * |
|
| 42 | + * Proposed workflow for working with contacts: |
|
| 43 | + * - search for the contacts |
|
| 44 | + * - manipulate the results array |
|
| 45 | + * - createOrUpdate will save the given contacts overwriting the existing data |
|
| 46 | + * |
|
| 47 | + * For updating it is mandatory to keep the id. |
|
| 48 | + * Without an id a new contact will be created. |
|
| 49 | + * |
|
| 50 | + * @deprecated 8.1.0 use methods of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 51 | + * @since 5.0.0 |
|
| 52 | + */ |
|
| 53 | + class Contacts { |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * This function is used to search and find contacts within the users address books. |
|
| 57 | - * In case $pattern is empty all contacts will be returned. |
|
| 58 | - * |
|
| 59 | - * Example: |
|
| 60 | - * Following function shows how to search for contacts for the name and the email address. |
|
| 61 | - * |
|
| 62 | - * public static function getMatchingRecipient($term) { |
|
| 63 | - * // The API is not active -> nothing to do |
|
| 64 | - * if (!\OCP\Contacts::isEnabled()) { |
|
| 65 | - * return array(); |
|
| 66 | - * } |
|
| 67 | - * |
|
| 68 | - * $result = \OCP\Contacts::search($term, array('FN', 'EMAIL')); |
|
| 69 | - * $receivers = array(); |
|
| 70 | - * foreach ($result as $r) { |
|
| 71 | - * $id = $r['id']; |
|
| 72 | - * $fn = $r['FN']; |
|
| 73 | - * $email = $r['EMAIL']; |
|
| 74 | - * if (!is_array($email)) { |
|
| 75 | - * $email = array($email); |
|
| 76 | - * } |
|
| 77 | - * |
|
| 78 | - * // loop through all email addresses of this contact |
|
| 79 | - * foreach ($email as $e) { |
|
| 80 | - * $displayName = $fn . " <$e>"; |
|
| 81 | - * $receivers[] = array( |
|
| 82 | - * 'id' => $id, |
|
| 83 | - * 'label' => $displayName, |
|
| 84 | - * 'value' => $displayName); |
|
| 85 | - * } |
|
| 86 | - * } |
|
| 87 | - * |
|
| 88 | - * return $receivers; |
|
| 89 | - * } |
|
| 90 | - * |
|
| 91 | - * |
|
| 92 | - * @param string $pattern which should match within the $searchProperties |
|
| 93 | - * @param array $searchProperties defines the properties within the query pattern should match |
|
| 94 | - * @param array $options - for future use. One should always have options! |
|
| 95 | - * @return array an array of contacts which are arrays of key-value-pairs |
|
| 96 | - * @deprecated 8.1.0 use search() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 97 | - * @since 5.0.0 |
|
| 98 | - */ |
|
| 99 | - public static function search($pattern, $searchProperties = array(), $options = array()) { |
|
| 100 | - $cm = \OC::$server->getContactsManager(); |
|
| 101 | - return $cm->search($pattern, $searchProperties, $options); |
|
| 102 | - } |
|
| 55 | + /** |
|
| 56 | + * This function is used to search and find contacts within the users address books. |
|
| 57 | + * In case $pattern is empty all contacts will be returned. |
|
| 58 | + * |
|
| 59 | + * Example: |
|
| 60 | + * Following function shows how to search for contacts for the name and the email address. |
|
| 61 | + * |
|
| 62 | + * public static function getMatchingRecipient($term) { |
|
| 63 | + * // The API is not active -> nothing to do |
|
| 64 | + * if (!\OCP\Contacts::isEnabled()) { |
|
| 65 | + * return array(); |
|
| 66 | + * } |
|
| 67 | + * |
|
| 68 | + * $result = \OCP\Contacts::search($term, array('FN', 'EMAIL')); |
|
| 69 | + * $receivers = array(); |
|
| 70 | + * foreach ($result as $r) { |
|
| 71 | + * $id = $r['id']; |
|
| 72 | + * $fn = $r['FN']; |
|
| 73 | + * $email = $r['EMAIL']; |
|
| 74 | + * if (!is_array($email)) { |
|
| 75 | + * $email = array($email); |
|
| 76 | + * } |
|
| 77 | + * |
|
| 78 | + * // loop through all email addresses of this contact |
|
| 79 | + * foreach ($email as $e) { |
|
| 80 | + * $displayName = $fn . " <$e>"; |
|
| 81 | + * $receivers[] = array( |
|
| 82 | + * 'id' => $id, |
|
| 83 | + * 'label' => $displayName, |
|
| 84 | + * 'value' => $displayName); |
|
| 85 | + * } |
|
| 86 | + * } |
|
| 87 | + * |
|
| 88 | + * return $receivers; |
|
| 89 | + * } |
|
| 90 | + * |
|
| 91 | + * |
|
| 92 | + * @param string $pattern which should match within the $searchProperties |
|
| 93 | + * @param array $searchProperties defines the properties within the query pattern should match |
|
| 94 | + * @param array $options - for future use. One should always have options! |
|
| 95 | + * @return array an array of contacts which are arrays of key-value-pairs |
|
| 96 | + * @deprecated 8.1.0 use search() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 97 | + * @since 5.0.0 |
|
| 98 | + */ |
|
| 99 | + public static function search($pattern, $searchProperties = array(), $options = array()) { |
|
| 100 | + $cm = \OC::$server->getContactsManager(); |
|
| 101 | + return $cm->search($pattern, $searchProperties, $options); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * This function can be used to delete the contact identified by the given id |
|
| 106 | - * |
|
| 107 | - * @param object $id the unique identifier to a contact |
|
| 108 | - * @param string $address_book_key |
|
| 109 | - * @return bool successful or not |
|
| 110 | - * @deprecated 8.1.0 use delete() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 111 | - * @since 5.0.0 |
|
| 112 | - */ |
|
| 113 | - public static function delete($id, $address_book_key) { |
|
| 114 | - $cm = \OC::$server->getContactsManager(); |
|
| 115 | - return $cm->delete($id, $address_book_key); |
|
| 116 | - } |
|
| 104 | + /** |
|
| 105 | + * This function can be used to delete the contact identified by the given id |
|
| 106 | + * |
|
| 107 | + * @param object $id the unique identifier to a contact |
|
| 108 | + * @param string $address_book_key |
|
| 109 | + * @return bool successful or not |
|
| 110 | + * @deprecated 8.1.0 use delete() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 111 | + * @since 5.0.0 |
|
| 112 | + */ |
|
| 113 | + public static function delete($id, $address_book_key) { |
|
| 114 | + $cm = \OC::$server->getContactsManager(); |
|
| 115 | + return $cm->delete($id, $address_book_key); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * This function is used to create a new contact if 'id' is not given or not present. |
|
| 120 | - * Otherwise the contact will be updated by replacing the entire data set. |
|
| 121 | - * |
|
| 122 | - * @param array $properties this array if key-value-pairs defines a contact |
|
| 123 | - * @param string $address_book_key identifier of the address book in which the contact shall be created or updated |
|
| 124 | - * @return array an array representing the contact just created or updated |
|
| 125 | - * @deprecated 8.1.0 use createOrUpdate() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 126 | - * @since 5.0.0 |
|
| 127 | - */ |
|
| 128 | - public static function createOrUpdate($properties, $address_book_key) { |
|
| 129 | - $cm = \OC::$server->getContactsManager(); |
|
| 130 | - return $cm->createOrUpdate($properties, $address_book_key); |
|
| 131 | - } |
|
| 118 | + /** |
|
| 119 | + * This function is used to create a new contact if 'id' is not given or not present. |
|
| 120 | + * Otherwise the contact will be updated by replacing the entire data set. |
|
| 121 | + * |
|
| 122 | + * @param array $properties this array if key-value-pairs defines a contact |
|
| 123 | + * @param string $address_book_key identifier of the address book in which the contact shall be created or updated |
|
| 124 | + * @return array an array representing the contact just created or updated |
|
| 125 | + * @deprecated 8.1.0 use createOrUpdate() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 126 | + * @since 5.0.0 |
|
| 127 | + */ |
|
| 128 | + public static function createOrUpdate($properties, $address_book_key) { |
|
| 129 | + $cm = \OC::$server->getContactsManager(); |
|
| 130 | + return $cm->createOrUpdate($properties, $address_book_key); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Check if contacts are available (e.g. contacts app enabled) |
|
| 135 | - * |
|
| 136 | - * @return bool true if enabled, false if not |
|
| 137 | - * @deprecated 8.1.0 use isEnabled() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 138 | - * @since 5.0.0 |
|
| 139 | - */ |
|
| 140 | - public static function isEnabled() { |
|
| 141 | - $cm = \OC::$server->getContactsManager(); |
|
| 142 | - return $cm->isEnabled(); |
|
| 143 | - } |
|
| 133 | + /** |
|
| 134 | + * Check if contacts are available (e.g. contacts app enabled) |
|
| 135 | + * |
|
| 136 | + * @return bool true if enabled, false if not |
|
| 137 | + * @deprecated 8.1.0 use isEnabled() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 138 | + * @since 5.0.0 |
|
| 139 | + */ |
|
| 140 | + public static function isEnabled() { |
|
| 141 | + $cm = \OC::$server->getContactsManager(); |
|
| 142 | + return $cm->isEnabled(); |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * @param \OCP\IAddressBook $address_book |
|
| 147 | - * @deprecated 8.1.0 use registerAddressBook() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 148 | - * @since 5.0.0 |
|
| 149 | - */ |
|
| 150 | - public static function registerAddressBook(\OCP\IAddressBook $address_book) { |
|
| 151 | - $cm = \OC::$server->getContactsManager(); |
|
| 152 | - $cm->registerAddressBook($address_book); |
|
| 153 | - } |
|
| 145 | + /** |
|
| 146 | + * @param \OCP\IAddressBook $address_book |
|
| 147 | + * @deprecated 8.1.0 use registerAddressBook() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 148 | + * @since 5.0.0 |
|
| 149 | + */ |
|
| 150 | + public static function registerAddressBook(\OCP\IAddressBook $address_book) { |
|
| 151 | + $cm = \OC::$server->getContactsManager(); |
|
| 152 | + $cm->registerAddressBook($address_book); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * @param \OCP\IAddressBook $address_book |
|
| 157 | - * @deprecated 8.1.0 use unregisterAddressBook() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 158 | - * @since 5.0.0 |
|
| 159 | - */ |
|
| 160 | - public static function unregisterAddressBook(\OCP\IAddressBook $address_book) { |
|
| 161 | - $cm = \OC::$server->getContactsManager(); |
|
| 162 | - $cm->unregisterAddressBook($address_book); |
|
| 163 | - } |
|
| 155 | + /** |
|
| 156 | + * @param \OCP\IAddressBook $address_book |
|
| 157 | + * @deprecated 8.1.0 use unregisterAddressBook() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 158 | + * @since 5.0.0 |
|
| 159 | + */ |
|
| 160 | + public static function unregisterAddressBook(\OCP\IAddressBook $address_book) { |
|
| 161 | + $cm = \OC::$server->getContactsManager(); |
|
| 162 | + $cm->unregisterAddressBook($address_book); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * @return array |
|
| 167 | - * @deprecated 8.1.0 use getAddressBooks() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 168 | - * @since 5.0.0 |
|
| 169 | - */ |
|
| 170 | - public static function getAddressBooks() { |
|
| 171 | - $cm = \OC::$server->getContactsManager(); |
|
| 172 | - return $cm->getAddressBooks(); |
|
| 173 | - } |
|
| 165 | + /** |
|
| 166 | + * @return array |
|
| 167 | + * @deprecated 8.1.0 use getAddressBooks() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 168 | + * @since 5.0.0 |
|
| 169 | + */ |
|
| 170 | + public static function getAddressBooks() { |
|
| 171 | + $cm = \OC::$server->getContactsManager(); |
|
| 172 | + return $cm->getAddressBooks(); |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * removes all registered address book instances |
|
| 177 | - * @deprecated 8.1.0 use clear() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 178 | - * @since 5.0.0 |
|
| 179 | - */ |
|
| 180 | - public static function clear() { |
|
| 181 | - $cm = \OC::$server->getContactsManager(); |
|
| 182 | - $cm->clear(); |
|
| 183 | - } |
|
| 184 | - } |
|
| 175 | + /** |
|
| 176 | + * removes all registered address book instances |
|
| 177 | + * @deprecated 8.1.0 use clear() of \OCP\Contacts\IManager - \OC::$server->getContactsManager(); |
|
| 178 | + * @since 5.0.0 |
|
| 179 | + */ |
|
| 180 | + public static function clear() { |
|
| 181 | + $cm = \OC::$server->getContactsManager(); |
|
| 182 | + $cm->clear(); |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | 185 | } |
@@ -29,44 +29,44 @@ |
||
| 29 | 29 | * @since 8.0.0 |
| 30 | 30 | */ |
| 31 | 31 | interface ICertificateManager { |
| 32 | - /** |
|
| 33 | - * Returns all certificates trusted by the user |
|
| 34 | - * |
|
| 35 | - * @return \OCP\ICertificate[] |
|
| 36 | - * @since 8.0.0 |
|
| 37 | - */ |
|
| 38 | - public function listCertificates(); |
|
| 32 | + /** |
|
| 33 | + * Returns all certificates trusted by the user |
|
| 34 | + * |
|
| 35 | + * @return \OCP\ICertificate[] |
|
| 36 | + * @since 8.0.0 |
|
| 37 | + */ |
|
| 38 | + public function listCertificates(); |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param string $certificate the certificate data |
|
| 42 | - * @param string $name the filename for the certificate |
|
| 43 | - * @return \OCP\ICertificate |
|
| 44 | - * @throws \Exception If the certificate could not get added |
|
| 45 | - * @since 8.0.0 - since 8.1.0 throws exception instead of returning false |
|
| 46 | - */ |
|
| 47 | - public function addCertificate($certificate, $name); |
|
| 40 | + /** |
|
| 41 | + * @param string $certificate the certificate data |
|
| 42 | + * @param string $name the filename for the certificate |
|
| 43 | + * @return \OCP\ICertificate |
|
| 44 | + * @throws \Exception If the certificate could not get added |
|
| 45 | + * @since 8.0.0 - since 8.1.0 throws exception instead of returning false |
|
| 46 | + */ |
|
| 47 | + public function addCertificate($certificate, $name); |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param string $name |
|
| 51 | - * @since 8.0.0 |
|
| 52 | - */ |
|
| 53 | - public function removeCertificate($name); |
|
| 49 | + /** |
|
| 50 | + * @param string $name |
|
| 51 | + * @since 8.0.0 |
|
| 52 | + */ |
|
| 53 | + public function removeCertificate($name); |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Get the path to the certificate bundle for this user |
|
| 57 | - * |
|
| 58 | - * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle (since 9.0.0) |
|
| 59 | - * @return string |
|
| 60 | - * @since 8.0.0 |
|
| 61 | - */ |
|
| 62 | - public function getCertificateBundle($uid = ''); |
|
| 55 | + /** |
|
| 56 | + * Get the path to the certificate bundle for this user |
|
| 57 | + * |
|
| 58 | + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle (since 9.0.0) |
|
| 59 | + * @return string |
|
| 60 | + * @since 8.0.0 |
|
| 61 | + */ |
|
| 62 | + public function getCertificateBundle($uid = ''); |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Get the full local path to the certificate bundle for this user |
|
| 66 | - * |
|
| 67 | - * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle |
|
| 68 | - * @return string |
|
| 69 | - * @since 9.0.0 |
|
| 70 | - */ |
|
| 71 | - public function getAbsoluteBundlePath($uid = ''); |
|
| 64 | + /** |
|
| 65 | + * Get the full local path to the certificate bundle for this user |
|
| 66 | + * |
|
| 67 | + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle |
|
| 68 | + * @return string |
|
| 69 | + * @since 9.0.0 |
|
| 70 | + */ |
|
| 71 | + public function getAbsoluteBundlePath($uid = ''); |
|
| 72 | 72 | } |
@@ -33,14 +33,14 @@ |
||
| 33 | 33 | |
| 34 | 34 | interface IAvatarManager { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * return a user specific instance of \OCP\IAvatar |
|
| 38 | - * @see \OCP\IAvatar |
|
| 39 | - * @param string $user the ownCloud user id |
|
| 40 | - * @return \OCP\IAvatar |
|
| 41 | - * @throws \Exception In case the username is potentially dangerous |
|
| 42 | - * @throws \OCP\Files\NotFoundException In case there is no user folder yet |
|
| 43 | - * @since 6.0.0 |
|
| 44 | - */ |
|
| 45 | - public function getAvatar($user); |
|
| 36 | + /** |
|
| 37 | + * return a user specific instance of \OCP\IAvatar |
|
| 38 | + * @see \OCP\IAvatar |
|
| 39 | + * @param string $user the ownCloud user id |
|
| 40 | + * @return \OCP\IAvatar |
|
| 41 | + * @throws \Exception In case the username is potentially dangerous |
|
| 42 | + * @throws \OCP\Files\NotFoundException In case there is no user folder yet |
|
| 43 | + * @since 6.0.0 |
|
| 44 | + */ |
|
| 45 | + public function getAvatar($user); |
|
| 46 | 46 | } |
@@ -29,158 +29,158 @@ |
||
| 29 | 29 | * @since 8.1.0 |
| 30 | 30 | */ |
| 31 | 31 | interface IImage { |
| 32 | - /** |
|
| 33 | - * Determine whether the object contains an image resource. |
|
| 34 | - * |
|
| 35 | - * @return bool |
|
| 36 | - * @since 8.1.0 |
|
| 37 | - */ |
|
| 38 | - public function valid(); |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Returns the MIME type of the image or an empty string if no image is loaded. |
|
| 42 | - * |
|
| 43 | - * @return string |
|
| 44 | - * @since 8.1.0 |
|
| 45 | - */ |
|
| 46 | - public function mimeType(); |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * Returns the width of the image or -1 if no image is loaded. |
|
| 50 | - * |
|
| 51 | - * @return int |
|
| 52 | - * @since 8.1.0 |
|
| 53 | - */ |
|
| 54 | - public function width(); |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Returns the height of the image or -1 if no image is loaded. |
|
| 58 | - * |
|
| 59 | - * @return int |
|
| 60 | - * @since 8.1.0 |
|
| 61 | - */ |
|
| 62 | - public function height(); |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Returns the width when the image orientation is top-left. |
|
| 66 | - * |
|
| 67 | - * @return int |
|
| 68 | - * @since 8.1.0 |
|
| 69 | - */ |
|
| 70 | - public function widthTopLeft(); |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Returns the height when the image orientation is top-left. |
|
| 74 | - * |
|
| 75 | - * @return int |
|
| 76 | - * @since 8.1.0 |
|
| 77 | - */ |
|
| 78 | - public function heightTopLeft(); |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Outputs the image. |
|
| 82 | - * |
|
| 83 | - * @param string $mimeType |
|
| 84 | - * @return bool |
|
| 85 | - * @since 8.1.0 |
|
| 86 | - */ |
|
| 87 | - public function show($mimeType = null); |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Saves the image. |
|
| 91 | - * |
|
| 92 | - * @param string $filePath |
|
| 93 | - * @param string $mimeType |
|
| 94 | - * @return bool |
|
| 95 | - * @since 8.1.0 |
|
| 96 | - */ |
|
| 97 | - public function save($filePath = null, $mimeType = null); |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * @return resource Returns the image resource in any. |
|
| 101 | - * @since 8.1.0 |
|
| 102 | - */ |
|
| 103 | - public function resource(); |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @return string Returns the raw image data. |
|
| 107 | - * @since 8.1.0 |
|
| 108 | - */ |
|
| 109 | - public function data(); |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * (I'm open for suggestions on better method name ;) |
|
| 113 | - * Get the orientation based on EXIF data. |
|
| 114 | - * |
|
| 115 | - * @return int The orientation or -1 if no EXIF data is available. |
|
| 116 | - * @since 8.1.0 |
|
| 117 | - */ |
|
| 118 | - public function getOrientation(); |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * (I'm open for suggestions on better method name ;) |
|
| 122 | - * Fixes orientation based on EXIF data. |
|
| 123 | - * |
|
| 124 | - * @return bool |
|
| 125 | - * @since 8.1.0 |
|
| 126 | - */ |
|
| 127 | - public function fixOrientation(); |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Resizes the image preserving ratio. |
|
| 131 | - * |
|
| 132 | - * @param integer $maxSize The maximum size of either the width or height. |
|
| 133 | - * @return bool |
|
| 134 | - * @since 8.1.0 |
|
| 135 | - */ |
|
| 136 | - public function resize($maxSize); |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * @param int $width |
|
| 140 | - * @param int $height |
|
| 141 | - * @return bool |
|
| 142 | - * @since 8.1.0 |
|
| 143 | - */ |
|
| 144 | - public function preciseResize($width, $height); |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Crops the image to the middle square. If the image is already square it just returns. |
|
| 148 | - * |
|
| 149 | - * @param int $size maximum size for the result (optional) |
|
| 150 | - * @return bool for success or failure |
|
| 151 | - * @since 8.1.0 |
|
| 152 | - */ |
|
| 153 | - public function centerCrop($size = 0); |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Crops the image from point $x$y with dimension $wx$h. |
|
| 157 | - * |
|
| 158 | - * @param int $x Horizontal position |
|
| 159 | - * @param int $y Vertical position |
|
| 160 | - * @param int $w Width |
|
| 161 | - * @param int $h Height |
|
| 162 | - * @return bool for success or failure |
|
| 163 | - * @since 8.1.0 |
|
| 164 | - */ |
|
| 165 | - public function crop($x, $y, $w, $h); |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * Resizes the image to fit within a boundary while preserving ratio. |
|
| 169 | - * |
|
| 170 | - * @param integer $maxWidth |
|
| 171 | - * @param integer $maxHeight |
|
| 172 | - * @return bool |
|
| 173 | - * @since 8.1.0 |
|
| 174 | - */ |
|
| 175 | - public function fitIn($maxWidth, $maxHeight); |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Shrinks the image to fit within a boundary while preserving ratio. |
|
| 179 | - * |
|
| 180 | - * @param integer $maxWidth |
|
| 181 | - * @param integer $maxHeight |
|
| 182 | - * @return bool |
|
| 183 | - * @since 8.1.0 |
|
| 184 | - */ |
|
| 185 | - public function scaleDownToFit($maxWidth, $maxHeight); |
|
| 32 | + /** |
|
| 33 | + * Determine whether the object contains an image resource. |
|
| 34 | + * |
|
| 35 | + * @return bool |
|
| 36 | + * @since 8.1.0 |
|
| 37 | + */ |
|
| 38 | + public function valid(); |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Returns the MIME type of the image or an empty string if no image is loaded. |
|
| 42 | + * |
|
| 43 | + * @return string |
|
| 44 | + * @since 8.1.0 |
|
| 45 | + */ |
|
| 46 | + public function mimeType(); |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * Returns the width of the image or -1 if no image is loaded. |
|
| 50 | + * |
|
| 51 | + * @return int |
|
| 52 | + * @since 8.1.0 |
|
| 53 | + */ |
|
| 54 | + public function width(); |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Returns the height of the image or -1 if no image is loaded. |
|
| 58 | + * |
|
| 59 | + * @return int |
|
| 60 | + * @since 8.1.0 |
|
| 61 | + */ |
|
| 62 | + public function height(); |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Returns the width when the image orientation is top-left. |
|
| 66 | + * |
|
| 67 | + * @return int |
|
| 68 | + * @since 8.1.0 |
|
| 69 | + */ |
|
| 70 | + public function widthTopLeft(); |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Returns the height when the image orientation is top-left. |
|
| 74 | + * |
|
| 75 | + * @return int |
|
| 76 | + * @since 8.1.0 |
|
| 77 | + */ |
|
| 78 | + public function heightTopLeft(); |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Outputs the image. |
|
| 82 | + * |
|
| 83 | + * @param string $mimeType |
|
| 84 | + * @return bool |
|
| 85 | + * @since 8.1.0 |
|
| 86 | + */ |
|
| 87 | + public function show($mimeType = null); |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Saves the image. |
|
| 91 | + * |
|
| 92 | + * @param string $filePath |
|
| 93 | + * @param string $mimeType |
|
| 94 | + * @return bool |
|
| 95 | + * @since 8.1.0 |
|
| 96 | + */ |
|
| 97 | + public function save($filePath = null, $mimeType = null); |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * @return resource Returns the image resource in any. |
|
| 101 | + * @since 8.1.0 |
|
| 102 | + */ |
|
| 103 | + public function resource(); |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @return string Returns the raw image data. |
|
| 107 | + * @since 8.1.0 |
|
| 108 | + */ |
|
| 109 | + public function data(); |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * (I'm open for suggestions on better method name ;) |
|
| 113 | + * Get the orientation based on EXIF data. |
|
| 114 | + * |
|
| 115 | + * @return int The orientation or -1 if no EXIF data is available. |
|
| 116 | + * @since 8.1.0 |
|
| 117 | + */ |
|
| 118 | + public function getOrientation(); |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * (I'm open for suggestions on better method name ;) |
|
| 122 | + * Fixes orientation based on EXIF data. |
|
| 123 | + * |
|
| 124 | + * @return bool |
|
| 125 | + * @since 8.1.0 |
|
| 126 | + */ |
|
| 127 | + public function fixOrientation(); |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Resizes the image preserving ratio. |
|
| 131 | + * |
|
| 132 | + * @param integer $maxSize The maximum size of either the width or height. |
|
| 133 | + * @return bool |
|
| 134 | + * @since 8.1.0 |
|
| 135 | + */ |
|
| 136 | + public function resize($maxSize); |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * @param int $width |
|
| 140 | + * @param int $height |
|
| 141 | + * @return bool |
|
| 142 | + * @since 8.1.0 |
|
| 143 | + */ |
|
| 144 | + public function preciseResize($width, $height); |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Crops the image to the middle square. If the image is already square it just returns. |
|
| 148 | + * |
|
| 149 | + * @param int $size maximum size for the result (optional) |
|
| 150 | + * @return bool for success or failure |
|
| 151 | + * @since 8.1.0 |
|
| 152 | + */ |
|
| 153 | + public function centerCrop($size = 0); |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Crops the image from point $x$y with dimension $wx$h. |
|
| 157 | + * |
|
| 158 | + * @param int $x Horizontal position |
|
| 159 | + * @param int $y Vertical position |
|
| 160 | + * @param int $w Width |
|
| 161 | + * @param int $h Height |
|
| 162 | + * @return bool for success or failure |
|
| 163 | + * @since 8.1.0 |
|
| 164 | + */ |
|
| 165 | + public function crop($x, $y, $w, $h); |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * Resizes the image to fit within a boundary while preserving ratio. |
|
| 169 | + * |
|
| 170 | + * @param integer $maxWidth |
|
| 171 | + * @param integer $maxHeight |
|
| 172 | + * @return bool |
|
| 173 | + * @since 8.1.0 |
|
| 174 | + */ |
|
| 175 | + public function fitIn($maxWidth, $maxHeight); |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Shrinks the image to fit within a boundary while preserving ratio. |
|
| 179 | + * |
|
| 180 | + * @param integer $maxWidth |
|
| 181 | + * @param integer $maxHeight |
|
| 182 | + * @return bool |
|
| 183 | + * @since 8.1.0 |
|
| 184 | + */ |
|
| 185 | + public function scaleDownToFit($maxWidth, $maxHeight); |
|
| 186 | 186 | } |
@@ -29,31 +29,31 @@ |
||
| 29 | 29 | * @since 8.1.0 |
| 30 | 30 | */ |
| 31 | 31 | interface IProvider { |
| 32 | - /** |
|
| 33 | - * @return string Regex with the mimetypes that are supported by this provider |
|
| 34 | - * @since 8.1.0 |
|
| 35 | - */ |
|
| 36 | - public function getMimeType(); |
|
| 32 | + /** |
|
| 33 | + * @return string Regex with the mimetypes that are supported by this provider |
|
| 34 | + * @since 8.1.0 |
|
| 35 | + */ |
|
| 36 | + public function getMimeType(); |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Check if a preview can be generated for $path |
|
| 40 | - * |
|
| 41 | - * @param \OCP\Files\FileInfo $file |
|
| 42 | - * @return bool |
|
| 43 | - * @since 8.1.0 |
|
| 44 | - */ |
|
| 45 | - public function isAvailable(\OCP\Files\FileInfo $file); |
|
| 38 | + /** |
|
| 39 | + * Check if a preview can be generated for $path |
|
| 40 | + * |
|
| 41 | + * @param \OCP\Files\FileInfo $file |
|
| 42 | + * @return bool |
|
| 43 | + * @since 8.1.0 |
|
| 44 | + */ |
|
| 45 | + public function isAvailable(\OCP\Files\FileInfo $file); |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * get thumbnail for file at path $path |
|
| 49 | - * |
|
| 50 | - * @param string $path Path of file |
|
| 51 | - * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image |
|
| 52 | - * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image |
|
| 53 | - * @param bool $scalingup Disable/Enable upscaling of previews |
|
| 54 | - * @param \OC\Files\View $fileview fileview object of user folder |
|
| 55 | - * @return bool|\OCP\IImage false if no preview was generated |
|
| 56 | - * @since 8.1.0 |
|
| 57 | - */ |
|
| 58 | - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview); |
|
| 47 | + /** |
|
| 48 | + * get thumbnail for file at path $path |
|
| 49 | + * |
|
| 50 | + * @param string $path Path of file |
|
| 51 | + * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image |
|
| 52 | + * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image |
|
| 53 | + * @param bool $scalingup Disable/Enable upscaling of previews |
|
| 54 | + * @param \OC\Files\View $fileview fileview object of user folder |
|
| 55 | + * @return bool|\OCP\IImage false if no preview was generated |
|
| 56 | + * @since 8.1.0 |
|
| 57 | + */ |
|
| 58 | + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview); |
|
| 59 | 59 | } |