Skip to content
Merged
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
4 changes: 2 additions & 2 deletions lib/private/DB/QueryBuilder/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1234,11 +1234,11 @@ public function createFunction($call) {
* @return int
* @throws \BadMethodCallException When being called before an insert query has been run.
*/
public function getLastInsertId() {
public function getLastInsertId(): int {
if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) {
// lastInsertId() needs the prefix but no quotes
$table = $this->prefixTableName($this->lastInsertedTable);
return (int) $this->connection->lastInsertId($table);
return $this->connection->lastInsertId($table);
}

throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.');
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct($storage, $isAvailable = true) {
$connection = \OC::$server->getDatabaseConnection();
$available = $isAvailable ? 1 : 0;
if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) {
$this->numericId = (int)$connection->lastInsertId('*PREFIX*storages');
$this->numericId = $connection->lastInsertId('*PREFIX*storages');
} else {
if ($row = self::getStorageById($this->storageId)) {
$this->numericId = (int)$row['numeric_id'];
Expand Down
2 changes: 1 addition & 1 deletion lib/public/DB/QueryBuilder/IQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ public function createFunction($call);
* @throws \BadMethodCallException When being called before an insert query has been run.
* @since 9.0.0
*/
public function getLastInsertId();
public function getLastInsertId(): int;

/**
* Returns the table name quoted and with database prefix as needed by the implementation
Expand Down