diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-05-15 00:00:06 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-05-15 00:00:06 +0200 |
commit | 212b0470e1aa288ba4f4d47d13647d6cd150fd15 (patch) | |
tree | f800288e4d064c8b9e1f1f1aa6f1a3c075918cb2 /system/database/drivers | |
parent | fff6c2a3caa1ce14e58fcb3ee0d937d17985eea1 (diff) | |
parent | 82196b945e291c65fdb66b35e3205f786ce8e921 (diff) |
Merge pull request #1324 from toopay/db-tests
Improved DB tests
Diffstat (limited to 'system/database/drivers')
-rw-r--r-- | system/database/drivers/pdo/pdo_result.php | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 19aee1dfc..0b8937cc5 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -84,19 +84,14 @@ class CI_DB_pdo_result extends CI_DB_result { // Define the output $output = array('assoc', 'object'); + // Initial value + $this->result_assoc = array() and $this->result_object = array(); + // Fetch the result - foreach ($output as $type) + while ($row = $this->_fetch_assoc()) { - // Define the method and handler - $res_method = '_fetch_'.$type; - $res_handler = 'result_'.$type; - - $this->$res_handler = array(); - - while ($row = $this->$res_method()) - { - $this->{$res_handler}[] = $row; - } + $this->result_assoc[] = $row; + $this->result_object[] = (object) $row; } // Save this as buffer and marked the fetch flag @@ -249,7 +244,7 @@ class CI_DB_pdo_result extends CI_DB_result { */ protected function _fetch_object() { - return $this->result_id->fetchObject(); + return $this->result_id->fetch(PDO::FETCH_OBJ); } } |