diff options
author | Michael Meskes <meskes@postgresql.org> | 2003-04-08 12:34:25 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2003-04-08 12:34:25 +0000 |
commit | a50f285d8de0eeb24df5a54f077e7aa2fee8eeee (patch) | |
tree | f3a109306a41df5d5cc636c2b0eccf53ea669458 /src/interfaces/ecpg/ecpglib/connect.c | |
parent | cd203f33958b99656e8486351be08197a9a73d76 (diff) | |
download | postgresql-a50f285d8de0eeb24df5a54f077e7aa2fee8eeee.tar.gz postgresql-a50f285d8de0eeb24df5a54f077e7aa2fee8eeee.zip |
Added some more informix compatibility functions.
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"; |