diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-12 23:21:01 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-12 23:21:01 +0200 |
commit | 2dd8827768379ef8a96611b7b702464da8fd7349 (patch) | |
tree | d633e1a9dbb34e34eae5088c9db0765d85cb1b80 | |
parent | 874c469e0241962e15927de5aba758a7206849ba (diff) |
replace fetchRow with fetch to honour pdostatement
-rw-r--r-- | db/itemmapper.php | 4 | ||||
-rw-r--r-- | db/mapper.php | 6 | ||||
-rw-r--r-- | db/postgres/itemmapper.php | 2 | ||||
-rw-r--r-- | utility/mappertestutility.php | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/db/itemmapper.php b/db/itemmapper.php index c1a341aaa..b223a8aaf 100644 --- a/db/itemmapper.php +++ b/db/itemmapper.php @@ -80,7 +80,7 @@ class ItemMapper extends Mapper implements IMapper { $params = array($userId); - $result = $this->execute($sql, $params)->fetchRow(); + $result = $this->execute($sql, $params)->fetch(); return (int) $result['size']; } @@ -230,7 +230,7 @@ class ItemMapper extends Mapper implements IMapper { $params = array($status, $threshold); $result = $this->execute($sql, $params); - while($row = $result->fetchRow()) { + while($row = $result->fetch()) { $size = (int) $row['size']; $limit = $size - $threshold; diff --git a/db/mapper.php b/db/mapper.php index bae26910a..e61be0a6c 100644 --- a/db/mapper.php +++ b/db/mapper.php @@ -207,12 +207,12 @@ abstract class Mapper { */ protected function findOneQuery($sql, array $params=array(), $limit=null, $offset=null){ $result = $this->execute($sql, $params, $limit, $offset); - $row = $result->fetchRow(); + $row = $result->fetch(); if($row === false || $row === null){ throw new DoesNotExistException('No matching entry found'); } - $row2 = $result->fetchRow(); + $row2 = $result->fetch(); //MDB2 returns null, PDO and doctrine false when no row is available if( ! ($row2 === false || $row2 === null )) { throw new MultipleObjectsReturnedException('More than one result'); @@ -246,7 +246,7 @@ abstract class Mapper { $entities = array(); - while($row = $result->fetchRow()){ + while($row = $result->fetch()){ $entities[] = $this->mapRowToEntity($row); } diff --git a/db/postgres/itemmapper.php b/db/postgres/itemmapper.php index af746ecc1..235461c38 100644 --- a/db/postgres/itemmapper.php +++ b/db/postgres/itemmapper.php @@ -44,7 +44,7 @@ class ItemMapper extends \OCA\News\Db\ItemMapper { $params = array($status, $threshold); $result = $this->execute($sql, $params); - while($row = $result->fetchRow()) { + while($row = $result->fetch()) { $size = (int) $row['size']; $limit = $size - $threshold; diff --git a/utility/mappertestutility.php b/utility/mappertestutility.php index eb7c2a471..9b8cda069 100644 --- a/utility/mappertestutility.php +++ b/utility/mappertestutility.php @@ -42,7 +42,7 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase { ->getMock(); $this->query = $this->getMock('Query', array('execute', 'bindValue')); - $this->pdoResult = $this->getMock('Result', array('fetchRow')); + $this->pdoResult = $this->getMock('Result', array('fetch')); $this->queryAt = 0; $this->prepareAt = 0; $this->iterators = array(); @@ -68,7 +68,7 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase { $fetchAt = $this->fetchAt; $this->pdoResult->expects($this->any()) - ->method('fetchRow') + ->method('fetch') ->will($this->returnCallback( function() use ($iterators, $fetchAt){ $iterator = $iterators[$fetchAt]; |