diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-03 15:28:31 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-08 11:45:19 +0100 |
commit | 8b64e92b9262d2a2eec6345685ce421050f95c66 (patch) | |
tree | dd51490b8a184b2643414d11867a9fa450aa5065 /lib/private/legacy/OC_DB_StatementWrapper.php | |
parent | 84e6e9f7cf19207041925eaa237d24e1c12c2c2d (diff) | |
download | nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.tar.gz nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.zip |
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/legacy/OC_DB_StatementWrapper.php')
-rw-r--r-- | lib/private/legacy/OC_DB_StatementWrapper.php | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/lib/private/legacy/OC_DB_StatementWrapper.php b/lib/private/legacy/OC_DB_StatementWrapper.php index 667c2de9678..cc2320015a3 100644 --- a/lib/private/legacy/OC_DB_StatementWrapper.php +++ b/lib/private/legacy/OC_DB_StatementWrapper.php @@ -28,6 +28,8 @@ * */ +use OCP\DB\IPreparedStatement; + /** * small wrapper around \Doctrine\DBAL\Driver\Statement to make it behave, more like an MDB2 Statement * @@ -38,17 +40,20 @@ * @method array fetchAll(integer $fetchMode = null); */ class OC_DB_StatementWrapper { - /** - * @var \Doctrine\DBAL\Driver\Statement - */ + /** @var IPreparedStatement */ private $statement = null; + + /** @var bool */ private $isManipulation = false; + + /** @var array */ private $lastArguments = []; /** + * @param IPreparedStatement $statement * @param boolean $isManipulation */ - public function __construct($statement, $isManipulation) { + public function __construct(IPreparedStatement $statement, $isManipulation) { $this->statement = $statement; $this->isManipulation = $isManipulation; } @@ -63,31 +68,34 @@ class OC_DB_StatementWrapper { /** * make execute return the result instead of a bool * - * @param array $input + * @param mixed[] $input * @return \OC_DB_StatementWrapper|int|bool + * @deprecated */ public function execute($input = []) { $this->lastArguments = $input; - if (count($input) > 0) { - $result = $this->statement->execute($input); - } else { - $result = $this->statement->execute(); - } - - if ($result === false) { + try { + if (count($input) > 0) { + $result = $this->statement->execute($input); + } else { + $result = $this->statement->execute(); + } + } catch (\Doctrine\DBAL\Exception $e) { return false; } + if ($this->isManipulation) { return $this->statement->rowCount(); - } else { - return $this; } + + return $this; } /** * provide an alias for fetch * * @return mixed + * @deprecated */ public function fetchRow() { return $this->statement->fetch(); @@ -97,11 +105,11 @@ class OC_DB_StatementWrapper { * Provide a simple fetchOne. * * fetch single column from the next row - * @param int $column the column number to fetch * @return string + * @deprecated */ - public function fetchOne($column = 0) { - return $this->statement->fetchColumn($column); + public function fetchOne() { + return $this->statement->fetchOne(); } /** |