Improve MySQL "IF" conversion

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@226244 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2010-04-07 23:41:32 +00:00
parent 03581e4a52
commit f0d659ecad

View File

@@ -149,8 +149,8 @@
$sql = str_replace( 'FROM \''.$curryear, 'FROM TIMESTAMP \''.$curryear, $sql);
// MySQL 'IF' conversion
$pattern = '/IF[ ]*\(([^,]+),([^,]+),([^\)]+)\)/';
$sql = preg_replace( $pattern, 'CASE WHEN $1 THEN $2 ELSE $3 END', $sql);
$pattern = '/ IF[ ]*\(([^,]+),([^,]+),([^\)]+)\)/';
$sql = preg_replace( $pattern, ' CASE WHEN $1 THEN $2 ELSE $3 END', $sql);
$sql = str_replace('GROUP BY '.$table_prefix.'posts."ID"', '' , $sql);
$sql = str_replace("!= ''", '<> 0', $sql);