summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/postgre/postgre_driver.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2009-02-03 17:13:57 +0100
committerDerek Allard <derek.allard@ellislab.com>2009-02-03 17:13:57 +0100
commite37ab385f5c9ef8824d2ad4e31f544dbe6089095 (patch)
tree50d2cc1476bf17b415625526bd2b728e045520b4 /system/database/drivers/postgre/postgre_driver.php
parent1978e12d4221fe7e61749a3206b086e5d4158f77 (diff)
DB count_all() not returns an integer always
Added some syntactical improvements within DB (braces) Fixed a bug when doing 'random' on order_by() (#5706). Fixed a bug where adding a primary key through Forge could fail (#5731). Fixed a bug when using DB cache on multiple databases (#5737).
Diffstat (limited to 'system/database/drivers/postgre/postgre_driver.php')
-rw-r--r--system/database/drivers/postgre/postgre_driver.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index da0b0f23a..9d53b1ef8 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -329,15 +329,19 @@ class CI_DB_postgre_driver extends CI_DB {
function count_all($table = '')
{
if ($table == '')
- return '0';
+ {
+ return 0;
+ }
+
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
- $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
-
if ($query->num_rows() == 0)
- return '0';
+ {
+ return 0;
+ }
$row = $query->row();
- return $row->numrows;
+ return (int) $row->numrows;
}
// --------------------------------------------------------------------