Fix ODBC num_rows() for subdrivers that return -1
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index 320b932..e7cbc7a 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -43,7 +43,18 @@
 	 */
 	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;
 	}
 
 	/**