diff options
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/connect.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 69433bdc4b1..ee5ed471185 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.2 2003/04/04 20:42:13 momjian Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.3 2003/04/08 12:34:25 meskes Exp $ */ #include "postgres_fe.h" @@ -11,6 +11,8 @@ static struct connection *all_connections = NULL, *actual_connection = NULL; +extern enum COMPAT_MODE ecpg_compat_mode; + struct connection * ECPGget_connection(const char *connection_name) { @@ -267,13 +269,26 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd, *tmp, *port = NULL, *realname = NULL, - *options = NULL; + *options = NULL, + *envname; ECPGinit_sqlca(); if ((this = (struct connection *) ECPGalloc(sizeof(struct connection), lineno)) == NULL) return false; + if (ecpg_compat_mode == ECPG_COMPAT_INFORMIX) + { + /* Informix uses an environment variable DBPATH that overrides + * the connection parameters given here */ + envname = getenv("DBPATH"); + if (envname) + { + free(dbname); + dbname=strdup(envname); + } + } + if (dbname == NULL && connection_name == NULL) connection_name = "DEFAULT"; |