Made select varadic

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-03-13 08:07:08 +01:00
parent 3cae276149
commit c8aee70a0b
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with 7 additions and 5 deletions

View File

@ -379,12 +379,14 @@ class QueryBuilder implements IQueryBuilder {
* ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
* </code> * </code>
* *
* @param mixed $select The selection expressions. * @param mixed ...$selects The selection expressions.
* *
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/ */
public function select($select = null) { public function select(...$selects) {
$selects = is_array($select) ? $select : func_get_args(); if (count($selects) === 1 && is_array($selects[0])) {
$selects = $selects[0];
}
$this->queryBuilder->select( $this->queryBuilder->select(
$this->helper->quoteColumnNames($selects) $this->helper->quoteColumnNames($selects)

View File

@ -292,12 +292,12 @@ interface IQueryBuilder {
* ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
* </code> * </code>
* *
* @param mixed $select The selection expressions. * @param mixed ...$selects The selection expressions.
* *
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0 * @since 8.2.0
*/ */
public function select($select = null); public function select(...$selects);
/** /**
* Specifies an item that is to be returned with a different name in the query result. * Specifies an item that is to be returned with a different name in the query result.