From be57fe8870f25112fed5222bec3c90c650c70747 Mon Sep 17 00:00:00 2001 From: arjen Date: Sat, 1 Feb 2003 08:20:41 +0000 Subject: [PATCH] A few bug fixes in updating the database from version 20. The error from pg_connect is not suppressed. --- src/gcm_daemon/classes/gnucomo_db_version.php | 6 +++--- src/phpclasses/db.postgres.php | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gcm_daemon/classes/gnucomo_db_version.php b/src/gcm_daemon/classes/gnucomo_db_version.php index fdf2ad4..ccd3703 100644 --- a/src/gcm_daemon/classes/gnucomo_db_version.php +++ b/src/gcm_daemon/classes/gnucomo_db_version.php @@ -185,11 +185,11 @@ $dbms->query($local_sql); case 20: - $local_sql = "CREATE TABLE 'parameter_notification' ('notificationid' bigint, 'paramid' bigint, primary key (notificationid, paramid))"; + $local_sql = "CREATE TABLE parameter_notification (notificationid bigint, paramid bigint, primary key (notificationid, paramid))"; $dbms->query($local_sql); - $local_sql = "CREATE TABLE 'parameter_class' ('name' text, 'property_name' text, 'description' text, 'property_type' text, "; - $local_sql .= "'min' float, 'max' float, 'notify' boolean, primary key (name, property_name));"; + $local_sql = "CREATE TABLE parameter_class (name text, property_name text, description text, property_type text, "; + $local_sql .= "min float, max float, notify boolean, primary key (name, property_name));"; $dbms->query($local_sql); $local_sql = "INSERT INTO parameter_class (name, property_name, description, property_type, notify)"; diff --git a/src/phpclasses/db.postgres.php b/src/phpclasses/db.postgres.php index 234f832..0fc268c 100644 --- a/src/phpclasses/db.postgres.php +++ b/src/phpclasses/db.postgres.php @@ -31,14 +31,15 @@ } $local_connection_string = "dbname=$this->db_name user=$this->db_user "; + if ($this->db_password == '') { $local_connection_string .= $this->db_password; } - $this->db_connection = @pg_pconnect($local_connection_string); - if ($this->have_db_connection() == "FALSE") { + $this->db_connection = pg_pconnect($local_connection_string); + if ($this->have_db_connection() == FALSE) { syslog (LOG_INFO, "Failed to make a connection to Postgres"); - die ("connection to Postgres failed"); + die ("connection to Postgres failed\n"); } else { syslog (LOG_INFO, "Connection to Postgres was made correctly"); } -- 2.11.0