From 29cb957b226d47f7aff8ee8bc187e3d5d59ad75d Mon Sep 17 00:00:00 2001 From: Rob Andrews Date: Thu, 2 Feb 2017 10:18:08 +0000 Subject: [PATCH] send DB_ERROR_UNSUPPORTED if seeking in pdo_mysql --- src/DB/Driver/DoctrineDbal.php | 12 ++++++++++++ src/DB/Driver/PdoDriver.php | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/DB/Driver/DoctrineDbal.php b/src/DB/Driver/DoctrineDbal.php index 68d6357..ebc9acb 100644 --- a/src/DB/Driver/DoctrineDbal.php +++ b/src/DB/Driver/DoctrineDbal.php @@ -164,6 +164,18 @@ public function simpleQuery($query) */ public function fetchInto(StatementContainer $result, &$arr, $fetchmode, $rownum = null) { + // @codeCoverageIgnoreStart + // This is not coverable by integration tests + if (isset($rownum) && ($rownum !== null) && ($this->getPlatform() === 'mysql')) { + return $this->raiseError( + DB::DB_ERROR_UNSUPPORTED, + null, + null, + 'pdo_mysql does not support cursor seeking' + ); + } + // @codeCoverageIgnoreEnd + if ($fetchmode & DB::DB_FETCHMODE_ASSOC) { $arr = self::getStatement($result)->fetch(PDO::FETCH_ASSOC, null, $rownum); if (($this->options['portability'] & DB::DB_PORTABILITY_LOWERCASE) && $arr) { diff --git a/src/DB/Driver/PdoDriver.php b/src/DB/Driver/PdoDriver.php index a52eaa1..fba3895 100644 --- a/src/DB/Driver/PdoDriver.php +++ b/src/DB/Driver/PdoDriver.php @@ -203,6 +203,18 @@ private static function formatErrorInfo(array $errorInfo) */ public function fetchInto(StatementContainer $result, &$arr, $fetchmode, $rownum = null) { + // @codeCoverageIgnoreStart + // This is not coverable by integration tests + if (isset($rownum) && ($rownum !== null) && ($this->getPlatform() === 'mysql')) { + return $this->raiseError( + DB::DB_ERROR_UNSUPPORTED, + null, + null, + 'pdo_mysql does not support cursor seeking' + ); + } + // @codeCoverageIgnoreEnd + if ($fetchmode & DB::DB_FETCHMODE_ASSOC) { $arr = self::getStatement($result)->fetch(PDO::FETCH_ASSOC, null, $rownum); if (($this->options['portability'] & DB::DB_PORTABILITY_LOWERCASE) && $arr) {