Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,20 @@ public function __construct(array $params, Driver $driver, Configuration $config
* Prepares an SQL statement.
*
* @param string $statement The SQL statement to prepare.
* @param int $limit
* @param int $offset
* @param int|null $limit
* @param int|null $offset
*
* @return Statement The prepared statement.
* @throws Exception
*/
public function prepare($statement, $limit = null, $offset = null): Statement {
if ($limit === -1) {
if ($limit === -1 || $limit === null) {
$limit = null;
} else {
$limit = (int) $limit;
}
if ($offset !== null) {
$offset = (int) $offset;
}
if (!is_null($limit)) {
$platform = $this->getDatabasePlatform();
Expand Down
12 changes: 8 additions & 4 deletions lib/private/DB/QueryBuilder/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,12 @@ public function getParameterType($key) {
/**
* Sets the position of the first result to retrieve (the "offset").
*
* @param integer $firstResult The first result to return.
* @param int $firstResult The first result to return.
*
* @return $this This QueryBuilder instance.
*/
public function setFirstResult($firstResult) {
$this->queryBuilder->setFirstResult($firstResult);
$this->queryBuilder->setFirstResult((int) $firstResult);

return $this;
}
Expand All @@ -477,12 +477,16 @@ public function getFirstResult() {
* of the databases will just return an empty result set, Oracle will return
* all entries.
*
* @param integer $maxResults The maximum number of results to retrieve.
* @param int|null $maxResults The maximum number of results to retrieve.
*
* @return $this This QueryBuilder instance.
*/
public function setMaxResults($maxResults) {
$this->queryBuilder->setMaxResults($maxResults);
if ($maxResults === null) {
$this->queryBuilder->setMaxResults($maxResults);
} else {
$this->queryBuilder->setMaxResults((int) $maxResults);
}

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/public/DB/QueryBuilder/IQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function getParameterType($key);
/**
* Sets the position of the first result to retrieve (the "offset").
*
* @param integer $firstResult The first result to return.
* @param int $firstResult The first result to return.
*
* @return $this This QueryBuilder instance.
* @since 8.2.0
Expand All @@ -299,7 +299,7 @@ public function getFirstResult();
/**
* Sets the maximum number of results to retrieve (the "limit").
*
* @param integer $maxResults The maximum number of results to retrieve.
* @param int|null $maxResults The maximum number of results to retrieve.
*
* @return $this This QueryBuilder instance.
* @since 8.2.0
Expand Down
4 changes: 2 additions & 2 deletions lib/public/IDBConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public function getQueryBuilder();
/**
* Used to abstract the ownCloud database access away
* @param string $sql the sql query with ? placeholder for params
* @param int $limit the maximum number of rows
* @param int $offset from which row we want to start
* @param int|null $limit the maximum number of rows
* @param int|null $offset from which row we want to start
* @return IPreparedStatement The prepared statement.
* @since 6.0.0
* @throws Exception since 21.0.0
Expand Down