Integrated changes from http://vitoriodelage.wordpress.com/2014/06/06/add-missing-wpsql_errno-in-pg4wp-plugin/
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user