diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index c265d60..5eae8e9 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -174,9 +174,20 @@ $pattern = '/LIMIT[ ]+\d+/'; $sql = preg_replace($pattern, '', $sql); + // For correct ID quoting + $pattern = '/[ ]*`([^`]*ID[^`]*)`[ ]*=/'; + $sql = preg_replace( $pattern, ' "$1" =', $sql); + + // For correct bactick removal + $pattern = '/[ ]*`([^`]+)`[ ]*=/'; + $sql = preg_replace( $pattern, ' $1 =', $sql); + // WP 2.6.1 => 2.8 upgrade, removes a PostgreSQL error but there are some remaining $sql = str_replace( "post_date = '0000-00-00 00:00:00'", "post_date IS NULL", $sql); + // This will avoid modifications to anything following ' SET ' + list($sql,$end) = explode( ' SET ', $sql, 2); + $end = ' SET '.$end; } // UPDATE elseif( 0 === strpos($sql, 'INSERT')) { @@ -238,7 +249,7 @@ if( preg_match('/^.{1}/us',$sql,$ar) != 1) $sql = utf8_encode($sql); - // This will avoid modifications to anything following 'VALUES' + // This will avoid modifications to anything following ' VALUES' list($sql,$end) = explode( ' VALUES', $sql, 2); $end = ' VALUES'.$end; } // INSERT diff --git a/readme.txt b/readme.txt index f48cad9..17cd012 100644 --- a/readme.txt +++ b/readme.txt @@ -51,7 +51,7 @@ There is no screenshot for this plugin == Changelog == * Implemented a generic "INTERVAL xx DAY|HOUR|MINUTE|SECOND" handler -* Prepare workaround for undesirable effects (works with new content for now) +* Backticks and capital text containing 'ID' now work * Improved db.php to remove notices and possible fatal errors * Preliminary support for Wordpress 3.0 * Improved dates functions handling