diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-05-05 10:31:54 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-05-05 10:31:54 +0200 |
commit | 865661ed75a542245abcc6639adee769a13267d0 (patch) | |
tree | 588010f79c616584f265b063ce35d09b7d898eb6 /lib/private/DB | |
parent | 6d3aef1849eb84d423be2a8789bb13f6ef5a26a3 (diff) | |
download | nextcloud-server-865661ed75a542245abcc6639adee769a13267d0.tar.gz nextcloud-server-865661ed75a542245abcc6639adee769a13267d0.zip |
Rename IQueryBuilder::executeUpdate to IQueryBuilder::executeStatement
Because executeUpdate wasn't a great name. And in DBAL they also use
executeStatement more consistently now.
Ref https://github.com/doctrine/dbal/issues/4607
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/DB')
-rw-r--r-- | lib/private/DB/QueryBuilder/QueryBuilder.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index 3549606c2db..ec2c3667fd6 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -309,9 +309,24 @@ class QueryBuilder implements IQueryBuilder { throw new \RuntimeException('Invalid return type for query'); } + /** + * Monkey-patched compatibility layer for apps that were adapted for Nextcloud 22 before + * the first beta, where executeStatement was named executeUpdate. + * + * Static analysis should catch those misuses, but until then let's try to keep things + * running. + * + * @internal + * @deprecated + * @todo drop ASAP + */ public function executeUpdate(): int { + return $this->executeStatement(); + } + + public function executeStatement(): int { if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::SELECT) { - throw new \RuntimeException('Invalid query type, expected INSERT, DELETE or UPDATE query'); + throw new \RuntimeException('Invalid query type, expected INSERT, DELETE or UPDATE statement'); } try { @@ -321,7 +336,7 @@ class QueryBuilder implements IQueryBuilder { } if (!is_int($result)) { - throw new \RuntimeException('Invalid return type for query'); + throw new \RuntimeException('Invalid return type for statement'); } return $result; |