From 0734b51d0347956c85c1c7eb38867d9fd8b89150 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 19 Sep 2014 12:26:07 +0200 Subject: [PATCH] Deprecating executeUnbuffered() in favor of execute() The method origins from the early days and does not differ from execute() anyway. For now it just forwards the call, but will be removed in future releases. --- .../lib/data/DatabaseObjectEditor.class.php | 2 +- .../files/lib/system/WCFSetup.class.php | 4 ++-- .../statement/PreparedStatement.class.php | 18 ++---------------- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php b/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php index ebf42211c3..f51b6eaf6a 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php @@ -109,7 +109,7 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I $affectedCount = 0; WCF::getDB()->beginTransaction(); foreach ($objectIDs as $objectID) { - $statement->executeUnbuffered(array($objectID)); + $statement->execute(array($objectID)); $affectedCount += $statement->getAffectedRows(); } WCF::getDB()->commitTransaction(); diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index 933c3b38ac..1037d4a452 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -815,7 +815,7 @@ class WCFSetup extends WCF { self::getDB()->beginTransaction(); foreach ($acpTemplateInserts as $acpTemplate) { - $statement->executeUnbuffered(array($acpTemplate, 'wcf')); + $statement->execute(array($acpTemplate, 'wcf')); } self::getDB()->commitTransaction(); } @@ -829,7 +829,7 @@ class WCFSetup extends WCF { self::getDB()->beginTransaction(); foreach ($fileInserts as $file) { - $statement->executeUnbuffered(array($file, 'wcf')); + $statement->execute(array($file, 'wcf')); } self::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php b/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php index 03bb33abbb..86e552ce01 100644 --- a/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php +++ b/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php @@ -101,25 +101,11 @@ class PreparedStatement { /** * Executes a prepared statement. * + * @deprecated 2.1 - Please use execute() instead * @param array $parameters */ public function executeUnbuffered(array $parameters = array()) { - $this->parameters = $parameters; - $this->database->incrementQueryCount(); - - try { - if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start($this->query, Benchmark::TYPE_SQL_QUERY); - - if (empty($parameters)) $this->pdoStatement->execute(); - else $this->pdoStatement->execute($parameters); - - if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop(); - } - catch (\PDOException $e) { - if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop(); - - throw new DatabaseException('Could not execute prepared statement: '.$e->getMessage(), $this->database, $this); - } + $this->execute($parameters); } /** -- 2.20.1