summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-10-08 18:04:12 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-10-08 18:04:12 +0200
commit74dcbbf816deb0cb05e43f1843f6b84b51966470 (patch)
treeb4ceb0a46fb54366d8943325d9e91895e78a03c0 /system/database
parentb12d7cb03ab1ef63baab4a8d4b1380e6990c1437 (diff)
parent05e8c03b6742033cf88885cb86217cadca3a4567 (diff)
Merge tag '2.1.3'
Conflicts: user_guide Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'system/database')
-rwxr-xr-xsystem/database/drivers/oci8/oci8_result.php10
-rw-r--r--system/database/drivers/pdo/pdo_result.php23
2 files changed, 16 insertions, 17 deletions
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index ae133d7b5..3421278a5 100755
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -26,9 +26,9 @@
*/
class CI_DB_oci8_result extends CI_DB_result {
- var $stmt_id;
- var $curs_id;
- var $limit_used;
+ public $stmt_id;
+ public $curs_id;
+ public $limit_used;
/**
* Number of rows in the result set.
@@ -36,8 +36,6 @@ class CI_DB_oci8_result extends CI_DB_result {
* Oracle doesn't have a graceful way to retun the number of rows
* so we have to use what amounts to a hack.
*
- *
- * @access public
* @return integer
*/
public function num_rows()
@@ -53,7 +51,7 @@ class CI_DB_oci8_result extends CI_DB_result {
}
}
- return $rowcount;
+ return $this->num_rows;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php
index a366a5f12..44fdd6dc5 100644
--- a/system/database/drivers/pdo/pdo_result.php
+++ b/system/database/drivers/pdo/pdo_result.php
@@ -26,26 +26,27 @@
*/
class CI_DB_pdo_result extends CI_DB_result {
+ public $num_rows;
+
/**
* Number of rows in the result set
*
- * @access public
- * @return integer
+ * @return int
*/
- function num_rows()
+ public function num_rows()
{
- if (is_numeric(stripos($this->result_id->queryString, 'SELECT')))
+ if (is_int($this->num_rows))
{
- $dbh = $this->conn_id;
- $query = $dbh->query($this->result_id->queryString);
- $result = $query->fetchAll();
- unset($dbh, $query);
- return count($result);
+ return $this->num_rows;
}
- else
+ elseif (($this->num_rows = $this->result_id->rowCount()) > 0)
{
- return $this->result_id->rowCount();
+ return $this->num_rows;
}
+
+ $this->num_rows = count($this->result_id->fetchAll());
+ $this->result_id->execute();
+ return $this->num_rows;
}
// --------------------------------------------------------------------