Added support for PostgreSQL 9.1+ default config for standard_conforming_strings

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@542038 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2012-05-09 20:17:16 +00:00
parent afadc6b033
commit dba478b671

View File

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