mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 19:20:35 -04:00
fix(db): Add a hint that we return PHP_INT_MAX
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
66aac18bad
commit
98b6c7c48a
4 changed files with 8 additions and 9 deletions
|
|
@ -317,7 +317,7 @@ class Connection extends PrimaryReadReplicaConnection {
|
|||
* @param array $params The query parameters.
|
||||
* @param array $types The parameter types.
|
||||
*
|
||||
* @return int The number of affected rows.
|
||||
* @return int The number of affected rows, if the result is bigger than PHP_INT_MAX, PHP_INT_MAX is returned
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Exception
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class QueryBuilder implements IQueryBuilder {
|
|||
/**
|
||||
* Executes this query using the bound parameters and their types.
|
||||
*
|
||||
* Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
|
||||
* Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeStatement}
|
||||
* for insert, update and delete statements.
|
||||
*
|
||||
* @return IResult|int
|
||||
|
|
@ -272,12 +272,10 @@ class QueryBuilder implements IQueryBuilder {
|
|||
|
||||
if ($this->getType() !== self::SELECT) {
|
||||
$result = $this->queryBuilder->executeStatement();
|
||||
} else {
|
||||
$result = $this->queryBuilder->executeQuery();
|
||||
}
|
||||
if (is_int($result)) {
|
||||
return $result;
|
||||
return (int) $result;
|
||||
}
|
||||
|
||||
$result = $this->queryBuilder->executeQuery();
|
||||
return new ResultAdapter($result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,6 @@ class ResultAdapter implements IResult {
|
|||
}
|
||||
|
||||
public function rowCount(): int {
|
||||
return $this->inner->rowCount();
|
||||
return (int) $this->inner->rowCount();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,9 +69,10 @@ interface IResult {
|
|||
public function fetchOne();
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @return int If the result is bigger than PHP_INT_MAX, PHP_INT_MAX is returned
|
||||
*
|
||||
* @since 21.0.0
|
||||
* @since 30.0.0 If the result is bigger than PHP_INT_MAX, PHP_INT_MAX is returned
|
||||
*/
|
||||
public function rowCount(): int;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue