summaryrefslogtreecommitdiffstats
path: root/system/database/DB_result.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-07-08 21:43:22 +0200
committerAndrey Andreev <narf@bofh.bg>2012-07-08 21:43:22 +0200
commitadedaf05449112a5ede4a3bc722a9a153b4aa2a3 (patch)
treed9e6a538e140b5076a926151bbe261a960e84417 /system/database/DB_result.php
parentbd6116a63899c5efcf35e175b3db14b1f05c60a9 (diff)
parent0db81b6c82c2f86a6e9da26ab5501ba65cb4c4e1 (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into feature/db_subdrivers
Diffstat (limited to 'system/database/DB_result.php')
-rw-r--r--system/database/DB_result.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index ee0b61201..d44df6c02 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -144,7 +144,7 @@ class CI_DB_result {
{
$this->custom_result_object[$class_name][$i] = new $class_name();
- foreach ($this->$_data as $key => $value)
+ foreach ($this->{$_data}[$i] as $key => $value)
{
$this->custom_result_object[$class_name][$i]->$key = $value;
}
@@ -156,15 +156,9 @@ class CI_DB_result {
$this->_data_seek(0);
$this->custom_result_object[$class_name] = array();
- while ($row = $this->_fetch_object())
+ while ($row = $this->_fetch_object($class_name))
{
- $object = new $class_name();
- foreach ($row as $key => $value)
- {
- $object->$key = $value;
- }
-
- $custom_result_object[$class_name][] = $object;
+ $this->custom_result_object[$class_name][] = $row;
}
return $this->custom_result_object[$class_name];
@@ -461,11 +455,21 @@ class CI_DB_result {
/**
* Returns an unbuffered row and move pointer to next row
*
+ * @param string 'array', 'object' or a custom class name
* @return mixed either a result object or array
*/
public function unbuffered_row($type = 'object')
{
- return ($type !== 'array') ? $this->_fetch_object() : $this->_fetch_assoc();
+ if ($type === 'array')
+ {
+ return $this->_fetch_assoc();
+ }
+ elseif ($type === 'object')
+ {
+ return $this->_fetch_object();
+ }
+
+ return $this->_fetch_object($type);
}
// --------------------------------------------------------------------