Skip to content

Commit

Permalink
Preventing memory leak in PDO when retrieving results from the driver,
Browse files Browse the repository at this point in the history
…fixes #2293
  • Loading branch information
lorenzo committed Nov 25, 2011
1 parent 5180540 commit 2bffd4c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Mysql.php
Expand Up @@ -238,7 +238,7 @@ public function resultSet($results) {
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
*/
public function fetchResult() {
if ($row = $this->_result->fetch()) {
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();
foreach ($this->map as $col => $meta) {
list($table, $column, $type) = $meta;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Postgres.php
Expand Up @@ -707,7 +707,7 @@ public function resultSet(&$results) {
* @return array
*/
public function fetchResult() {
if ($row = $this->_result->fetch()) {
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();

foreach ($this->map as $index => $meta) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Sqlite.php
Expand Up @@ -330,7 +330,7 @@ public function resultSet($results) {
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
*/
public function fetchResult() {
if ($row = $this->_result->fetch()) {
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();
foreach ($this->map as $col => $meta) {
list($table, $column, $type) = $meta;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Sqlserver.php
Expand Up @@ -607,7 +607,7 @@ public function read(Model $model, $queryData = array(), $recursive = null) {
* @return mixed
*/
public function fetchResult() {
if ($row = $this->_result->fetch()) {
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();
foreach ($this->map as $col => $meta) {
list($table, $column, $type) = $meta;
Expand Down

0 comments on commit 2bffd4c

Please sign in to comment.