aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/lib/connect.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2003-02-13 13:11:52 +0000
committerMichael Meskes <meskes@postgresql.org>2003-02-13 13:11:52 +0000
commit1a9b0613c1b5af012735a81c07dc1e9dd97af945 (patch)
tree6494a531b6ff7ec1d8801316d8ee14225dfe0394 /src/interfaces/ecpg/lib/connect.c
parente529e9fa4449d77127639b073aa2eed386e367b3 (diff)
downloadpostgresql-1a9b0613c1b5af012735a81c07dc1e9dd97af945.tar.gz
postgresql-1a9b0613c1b5af012735a81c07dc1e9dd97af945.zip
- Applied error reporting patch by Matthew Vanecek
- Started with an Informix compatibility option.
Diffstat (limited to 'src/interfaces/ecpg/lib/connect.c')
-rw-r--r--src/interfaces/ecpg/lib/connect.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/lib/connect.c b/src/interfaces/ecpg/lib/connect.c
index 6cc1f0cb5ef..197f9f1cafd 100644
--- a/src/interfaces/ecpg/lib/connect.c
+++ b/src/interfaces/ecpg/lib/connect.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.19 2002/09/04 20:31:46 momjian Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.20 2003/02/13 13:11:52 meskes Exp $ */
#include "postgres_fe.h"
@@ -419,15 +419,20 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
if (PQstatus(this->connection) == CONNECTION_BAD)
{
+ const char *errmsg = PQerrorMessage(this->connection);
+ char *db = realname ? realname : "<DEFAULT>";
+
+ set_backend_err(errmsg, lineno);
ecpg_finish(this);
- ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n",
- realname ? realname : "<DEFAULT>",
+ ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n\t%s\n",
+ db,
host ? host : "<DEFAULT>",
port ? port : "<DEFAULT>",
options ? "with options " : "", options ? options : "",
user ? "for user " : "", user ? user : "",
- lineno);
- ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>");
+ lineno, errmsg);
+
+ ECPGraise(lineno, ECPG_CONNECT, db);
if (host)
ECPGfree(host);
if (port)