From aa660ec232a236a9c62e4bf2b1535127bb8521be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu> Date: Fri, 20 Nov 2015 13:00:42 +0100 Subject: [PATCH] Throw an exception in case no table name is passed into lastInsertId of the Oracle adapter --- lib/private/db/adapteroci8.php | 3 +++ lib/private/db/connection.php | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/private/db/adapteroci8.php b/lib/private/db/adapteroci8.php index 6e7857e662..76c265bc17 100644 --- a/lib/private/db/adapteroci8.php +++ b/lib/private/db/adapteroci8.php @@ -26,6 +26,9 @@ namespace OC\DB; class AdapterOCI8 extends Adapter { public function lastInsertId($table) { + if (is_null($table)) { + throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()'); + } if ($table !== null) { $suffix = '_SEQ'; $table = '"' . $table . $suffix . '"'; diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php index 1b86d3d383..85b1b7cd5e 100644 --- a/lib/private/db/connection.php +++ b/lib/private/db/connection.php @@ -214,8 +214,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { * @param string $seqName Name of the sequence object from which the ID should be returned. * @return string A string representation of the last inserted ID. */ - public function lastInsertId($seqName = null) - { + public function lastInsertId($seqName = null) { if ($seqName) { $seqName = $this->replaceTablePrefix($seqName); } -- GitLab