fix for count_all
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 06a508e..71d6c42 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -297,8 +297,8 @@
if ($table == '')
return '0';
- $query = $this->query($this->_count_string . "FROM ".$this->dbprefix.$table);
-
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
+
if ($query->num_rows() == 0)
return '0';
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 36e3651..9ba37b4 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -312,7 +312,7 @@
if ($table == '')
return '0';
- $query = $this->query($this->_count_string . "FROM `".$this->dbprefix.$table."`");
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
if ($query->num_rows() == 0)
return '0';
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 94a2993..e548fb0 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -306,7 +306,7 @@
if ($table == '')
return '0';
- $query = $this->query($this->_count_string . "FROM `".$this->dbprefix.$table."`");
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
if ($query->num_rows() == 0)
return '0';
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 160a56d..56095e9 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -413,7 +413,7 @@
if ($table == '')
return '0';
- $query = $this->query($this->_count_string . "FROM ".$table);
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
if ($query == FALSE)
{
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index c5c582d..03f58e2 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -281,8 +281,8 @@
if ($table == '')
return '0';
- $query = $this->query($this->_count_string . "FROM `".$this->dbprefix.$table."`");
-
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
+
if ($query->num_rows() == 0)
return '0';
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index fa27f03..8ea7603 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -302,9 +302,7 @@
if ($table == '')
return '0';
- $query = $this->query($this->_count_string .'FROM "'.$this->dbprefix.$table.'"');
-// original query before _count_string was used. Kept for reference
-// $query = $this->query('SELECT COUNT(*) AS numrows FROM "'.$this->dbprefix.$table.'"');
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
if ($query->num_rows() == 0)
return '0';
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 110b208..31b2928 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -298,7 +298,7 @@
if ($table == '')
return '0';
- $query = $this->query($this->_count_string . "FROM `".$this->dbprefix.$table."`");
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
if ($query->num_rows() == 0)
return '0';