Permalink
Browse files

Fix PostgreSQL WHERE with boolean values

  • Loading branch information...
1 parent 83b2b1c commit 02e4cd7f31aff17d0f5f02e0d1ad0ef920ff93aa @narfbg narfbg committed Nov 13, 2012
@@ -2534,7 +2534,7 @@ protected function _merge_cache()
*
* Determines if a string represents a literal value or a field name
*
- * @param string
+ * @param string $str
* @return bool
*/
protected function _is_literal($str)
@@ -353,6 +353,24 @@ protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = N
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 */
@@ -674,6 +674,23 @@ protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = N
// --------------------------------------------------------------------
/**
+ * 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

0 comments on commit 02e4cd7

Please sign in to comment.