summaryrefslogtreecommitdiffstats
path: root/system/database/DB_query_builder.php
diff options
context:
space:
mode:
authorSoesapto Joeni Hantoro <shidec00@yahoo.com>2012-05-11 06:00:42 +0200
committerSoesapto Joeni Hantoro <shidec00@yahoo.com>2012-05-11 06:00:42 +0200
commitd41f423528b21d97ff0eb268e10947b257f5a90e (patch)
tree76bef7e3d1cd80ece8e662d0c5cd8fa1cd7cc79a /system/database/DB_query_builder.php
parentcdcceecba73dd9f54665f531d15c12f5c9679738 (diff)
Generate better conditions statement on boolean field type. Actually boolean field type need TRUE or FALSE value. Common DBMS (e.g., MySQL) can substite this value with 1 or 0, but it can't be implemented on PostgreSQL. So, its better to use TRUE or FALSE value for boolean field type.
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r--system/database/DB_query_builder.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index d0af66de1..969a25acb 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -432,7 +432,21 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$k .= ' IS NULL';
}
- if ( ! is_null($v))
+ if ( is_bool($v))
+ {
+ if ($escape === TRUE)
+ {
+ $k = $this->protect_identifiers($k, FALSE, $escape);
+
+ $v = ' '.($v ? 'TRUE' : 'FALSE');
+ }
+
+ if ( ! $this->_has_operator($k))
+ {
+ $k .= ' =';
+ }
+ }
+ else if ( ! is_null($v))
{
if ($escape === TRUE)
{