diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 715aa95..b9e8c82 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -52,6 +52,7 @@ { if( $GLOBALS['pg4wp_conn']) return pg_last_error(); else return ''; } function wpsql_fetch_assoc($result) { return pg_fetch_assoc($result); } function wpsql_escape_string($s) { return pg_escape_string($s); } + function wpsql_real_escape_string($s,$c) { return pg_escape_string($s); } function wpsql_get_server_info() { return '5.0.30'; } // Just want to fool wordpress ... function wpsql_result($result, $i, $fieldname) { return pg_fetch_result($result, $i, $fieldname); } @@ -273,6 +274,10 @@ // 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); + // Correct quoting for PostgreSQL 9.1+ compatibility + $sql = str_replace( "\\'", "''", $sql); + $sql = str_replace( '\"', '"', $sql); + // This will avoid modifications to anything following ' SET ' list($sql,$end) = explode( ' SET ', $sql, 2); $end = ' SET '.$end; @@ -318,6 +323,10 @@ if( preg_match('/^.{1}/us',$sql,$ar) != 1) $sql = utf8_encode($sql); + // Correct quoting for PostgreSQL 9.1+ compatibility + $sql = str_replace( "\\'", "''", $sql); + $sql = str_replace( '\"', '"', $sql); + // This will avoid modifications to anything following ' VALUES' list($sql,$end) = explode( ' VALUES', $sql, 2); $end = ' VALUES'.$end;