From 48f77e760c331667f5d7b15a8eb3a1378dc59242 Mon Sep 17 00:00:00 2001 From: hawk__ Date: Fri, 5 Aug 2011 22:43:58 +0000 Subject: [PATCH] Get the server version when connecting, will be used later git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@419934 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- pg4wp/driver_pgsql.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index c16c2ee..e90e41d 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -17,6 +17,7 @@ wp_die( 'Your PHP installation appears to be missing the PostgreSQL extension which is required by WordPress with PG4WP.' ); // Initializing some variables + $GLOBALS['pg4wp_version'] = '7.0'; $GLOBALS['pg4wp_result'] = 0; $GLOBALS['pg4wp_numrows'] = '10'; $GLOBALS['pg4wp_ins_table'] = ''; @@ -83,7 +84,14 @@ $GLOBALS['pg4wp_conn'] = pg_connect($pg_connstr); - // Now we should be connected, we "forget" about the connection parameters (if this is not a "test" connection + if( $GLOBALS['pg4wp_conn']) + { + $ver = pg_version($GLOBALS['pg4wp_conn']); + if( isset($ver['server'])) + $GLOBALS['pg4wp_version'] = $ver['server']; + } + + // Now we should be connected, we "forget" about the connection parameters (if this is not a "test" connection) if( !defined('WP_INSTALLING') || !WP_INSTALLING) $GLOBALS['pg4wp_connstr'] = ''; @@ -412,6 +420,6 @@ $res = pg_query($sql); $data = pg_fetch_result($res, 0, 0); if( PG4WP_DEBUG && $sql) - error_log("Getting : $sql => $data\n", 3, PG4WP_LOG.'pg4wp_insertid.log'); + error_log("Getting inserted ID for '$t' : $sql => $data\n", 3, PG4WP_LOG.'pg4wp_insertid.log'); return $data; }