Backticks and capital text containing 'ID' now work

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@226904 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2010-04-09 00:45:33 +00:00
parent 738e2c5c3c
commit 803e38aa31
2 changed files with 13 additions and 2 deletions

View File

@@ -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

View File

@@ -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