diff options
Diffstat (limited to 'includes/database/pgsql/database.inc')
-rw-r--r-- | includes/database/pgsql/database.inc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc index ec3acbb22..e6e6eef96 100644 --- a/includes/database/pgsql/database.inc +++ b/includes/database/pgsql/database.inc @@ -135,13 +135,18 @@ class DatabaseConnection_pgsql extends DatabaseConnection { } public function mapConditionOperator($operator) { - static $specials = array( - // In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE - // statements, we need to use ILIKE instead. Use backslash for escaping - // wildcard characters. - 'LIKE' => array('operator' => 'ILIKE', 'postfix' => " ESCAPE '\\\\'"), - 'NOT LIKE' => array('operator' => 'NOT ILIKE', 'postfix' => " ESCAPE '\\\\'"), - ); + static $specials; + + // Function calls not allowed in static declarations, thus this method. + if (!isset($specials)) { + $specials = array( + // In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE + // statements, we need to use ILIKE instead. Use backslash for escaping + // wildcard characters. + 'LIKE' => array('operator' => 'ILIKE', 'postfix' => ' ESCAPE ' . $this->quote("\\")), + 'NOT LIKE' => array('operator' => 'NOT ILIKE', 'postfix' => ' ESCAPE ' . $this->quote("\\")), + ); + } return isset($specials[$operator]) ? $specials[$operator] : NULL; } |