Changes for 1.3.1 release

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@969858 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2014-08-21 16:50:36 +00:00
parent fb058eda35
commit b67e7c6780
3 changed files with 29 additions and 3 deletions
+23
View File
@@ -55,8 +55,11 @@
function wpsql_escape_string($s) { return pg_escape_string($s); }
function wpsql_real_escape_string($s,$c=NULL) { return pg_escape_string($s); }
function wpsql_get_server_info() { return '5.0.30'; } // Just want to fool wordpress ...
/**** Modified version of wpsql_result() is at the bottom of this file
function wpsql_result($result, $i, $fieldname)
{ return pg_fetch_result($result, $i, $fieldname); }
****/
// This is a fake connection except during installation
function wpsql_connect($dbserver, $dbuser, $dbpass)
@@ -480,3 +483,23 @@
}
return $sql;
}
/*
Quick fix for wpsql_result() error and missing wpsql_errno() function
Source : http://vitoriodelage.wordpress.com/2014/06/06/add-missing-wpsql_errno-in-pg4wp-plugin/
*/
function wpsql_result($result, $i, $fieldname = null) {
if (is_resource($result)) {
if ($fieldname) {
return pg_fetch_result($result, $i, $fieldname);
} else {
return pg_fetch_result($result, $i);
}
}
}
function wpsql_errno( $connection) {
$result = pg_get_result($connection);
$result_status = pg_result_status($result);
return pg_result_error_field($result_status, PGSQL_DIAG_SQLSTATE);
}