diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-09-22 03:22:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-09-22 03:22:20 +0000 |
commit | cdf28e6fd6aa87b8e0302bcc88505f378a38968d (patch) | |
tree | f51cb10e2a66a7f71b3c7c3c8368a8dc1d511dd4 /includes/database/pgsql | |
parent | 18a68728d07e2e8da14d84a923eb21b0f8f58cfa (diff) | |
download | brdo-cdf28e6fd6aa87b8e0302bcc88505f378a38968d.tar.gz brdo-cdf28e6fd6aa87b8e0302bcc88505f378a38968d.tar.bz2 |
- Patch #910388 by mikl: installation fails on PostgreSQL 8.4: Invalid escape sequence.
Diffstat (limited to 'includes/database/pgsql')
-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; } |