summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/odbc/odbc_result.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index 320b9327c..e7cbc7af5 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -43,7 +43,18 @@ class CI_DB_odbc_result extends CI_DB_result {
*/
public function num_rows()
{
- return @odbc_num_rows($this->result_id);
+ if ($this->num_rows > 0)
+ {
+ return $this->num_rows;
+ }
+
+ // Work-around for ODBC subdrivers that don't support num_rows()
+ if (($this->num_rows = @odbc_num_rows($this->result_id)) === -1)
+ {
+ return $this->num_rows = count($this->result_array());
+ }
+
+ return $this->num_rows;
}
/**