diff options
author | Eric Roberts <eric@cryode.com> | 2012-07-11 10:43:36 +0200 |
---|---|---|
committer | Eric Roberts <eric@cryode.com> | 2012-07-11 10:43:36 +0200 |
commit | fa337081ced1b1d34805d28f8307f069edf16cdf (patch) | |
tree | 63e524a282d7a8efef45b205c42f9b8e4a06b89b /system/database/drivers/mssql/mssql_result.php | |
parent | 6bf1e50bdff62d4842cd5a94d324e0768c5ace3e (diff) | |
parent | 78e5fdfe4399975b75b8697f64e270b1799ee2f1 (diff) |
Merge branch 'develop' of https://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/database/drivers/mssql/mssql_result.php')
-rw-r--r-- | system/database/drivers/mssql/mssql_result.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index 5929306af..aeede3f4b 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -26,13 +26,14 @@ */ /** - * MS SQL Result Class + * MSSQL Result Class * * This class extends the parent result class: CI_DB_result * * @category Database * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ + * @since 1.3 */ class CI_DB_mssql_result extends CI_DB_result { @@ -43,7 +44,9 @@ class CI_DB_mssql_result extends CI_DB_result { */ public function num_rows() { - return @mssql_num_rows($this->result_id); + return is_int($this->num_rows) + ? $this->num_rows + : $this->num_rows = @mssql_num_rows($this->result_id); } // -------------------------------------------------------------------- @@ -158,11 +161,25 @@ class CI_DB_mssql_result extends CI_DB_result { * * Returns the result set as an object * + * @param string * @return object */ - protected function _fetch_object() + protected function _fetch_object($class_name = 'stdClass') { - return mssql_fetch_object($this->result_id); + $row = @mssql_fetch_object($this->result_id); + + if ($class_name === 'stdClass' OR ! $row) + { + return $row; + } + + $class_name = new $class_name(); + foreach ($row as $key => $value) + { + $class_name->$key = $value; + } + + return $class_name; } } |