diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-13 10:50:47 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-13 10:50:47 +0100 |
commit | 02e4cd7f31aff17d0f5f02e0d1ad0ef920ff93aa (patch) | |
tree | d2c3c9c960d9f61a3830639841d1b64252a34a7a /system | |
parent | 83b2b1cd75d85d78ddcae1f9716984d8acdd7ca6 (diff) |
Fix PostgreSQL WHERE with boolean values
Diffstat (limited to 'system')
-rw-r--r-- | system/database/DB_query_builder.php | 2 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php | 18 | ||||
-rw-r--r-- | system/database/drivers/postgre/postgre_driver.php | 17 |
3 files changed, 36 insertions, 1 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 543d5ccdd..00294c3df 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -2534,7 +2534,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * Determines if a string represents a literal value or a field name * - * @param string + * @param string $str * @return bool */ protected function _is_literal($str) diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php index 45165213f..41b50f0d6 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php @@ -353,6 +353,24 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver { return $this; } + // -------------------------------------------------------------------- + + /** + * Is literal + * + * Determines if a string represents a literal value or a field name + * + * @param string $str + * @return bool + */ + protected function _is_literal($str) + { + $str = trim($str); + + return (empty($str) OR ctype_digit($str) OR $str[0] === "'" OR in_array($str, array('TRUE', 'FALSE'), TRUE)); + } + + } /* End of file pdo_pgsql_driver.php */ diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index a52777b1e..c2bc4d9ad 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -674,6 +674,23 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- /** + * Is literal + * + * Determines if a string represents a literal value or a field name + * + * @param string $str + * @return bool + */ + protected function _is_literal($str) + { + $str = trim($str); + + return (empty($str) OR ctype_digit($str) OR $str[0] === "'" OR in_array($str, array('TRUE', 'FALSE'), TRUE)); + } + + // -------------------------------------------------------------------- + + /** * Close DB Connection * * @return void |