diff --git a/pg4wp/db.php b/pg4wp/db.php index 66abc4a..20be426 100644 --- a/pg4wp/db.php +++ b/pg4wp/db.php @@ -3,7 +3,7 @@ Plugin Name: PostgreSQL for WordPress (PG4WP) Plugin URI: http://www.hawkix.net Description: PG4WP is a special 'plugin' enabling WordPress to use a PostgreSQL database. -Version: 1.3.0+ +Version: 1.3.1 Author: Hawk__ Author URI: http://www.hawkix.net License: GPLv2 or newer. @@ -18,7 +18,7 @@ define('DB_DRIVER', 'pgsql'); // 'pgsql' or 'mysql' are supported for now define( 'PG4WP_DEBUG', false); // If you just want to log queries that generate errors, leave PG4WP_DEBUG to "false" // and set this to true -define( 'PG4WP_LOG_ERRORS', true); +define( 'PG4WP_LOG_ERRORS', false); // If you want to allow insecure configuration (from the author point of view) to work with PG4WP, // change this to true diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index fe9c0cf..a77571c 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -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); + } diff --git a/readme.txt b/readme.txt index d999edc..60101f9 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: database, postgresql, PostgreSQL, postgres, mysql Requires at least: 2.9.2 Tested up to: 3.4 -Stable tag: 1.3.0 +Stable tag: 1.3.1 License: GPLv2 or later PostgreSQL for WordPress is a special 'plugin' enabling WordPress to be used with a PostgreSQL database. @@ -66,6 +66,9 @@ There is no screenshot for this plugin == Changelog == += 1.3.1 = +* Integrated changes pointed in http://vitoriodelage.wordpress.com/2014/06/06/add-missing-wpsql_errno-in-pg4wp-plugin/ to correct problems with WP 3.9.1 + = 1.3.0 = * Some cleanup in old code that is not needed anymore * Enhanced wordpress-importer compatibility