Skip to content

Commit

Permalink
Merge pull request #48 from wethersherbs/dev-0.3.x
Browse files Browse the repository at this point in the history
Send DB_ERROR_UNSUPPORTED if seeking in pdo_mysql
  • Loading branch information
borb authored Feb 2, 2017
2 parents 4c9d558 + 29cb957 commit 081103c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/DB/Driver/DoctrineDbal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 12 additions & 0 deletions src/DB/Driver/PdoDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 081103c

Please sign in to comment.