Excluded converting "NULLIF", patch received from Jamie Strachan

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@418089 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2011-08-01 22:42:10 +00:00
parent 7e63ec4e1c
commit 29033b4871

View File

@@ -156,8 +156,8 @@
$curryear = date( 'Y');
$sql = str_replace( 'FROM \''.$curryear, 'FROM TIMESTAMP \''.$curryear, $sql);
// MySQL 'IF' conversion
$pattern = '/ IF[ ]*\(([^,]+),([^,]+),([^\)]+)\)/';
// MySQL 'IF' conversion - Note : NULLIF doesn't need to be corrected
$pattern = '/ (?<!NULL)IF[ ]*\(([^,]+),([^,]+),([^\)]+)\)/';
$sql = preg_replace( $pattern, ' CASE WHEN $1 THEN $2 ELSE $3 END', $sql);
$sql = str_replace('GROUP BY '.$table_prefix.'posts."ID"', '' , $sql);