diff options
author | Marc G. Fournier <scrappy@hub.org> | 1997-03-18 20:15:39 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1997-03-18 20:15:39 +0000 |
commit | 812a6c2b546850e9f9721b580698d5a161e5d76e (patch) | |
tree | 043e497eb6ccd99bb7b7d8052dbdb0fd9429d8c3 /src/interfaces/libpq/fe-connect.c | |
parent | d1463050658950afd25ef2457182a498b6b3a6b4 (diff) |
- Move most of the I/O in both libpq and the backend to a set
of common routines in pqcomprim.c (pq communication primitives).
Not all adapted to it yet, but it's a start.
- Rewritten some of those routines, to write/read bigger chunks of
data, precomputing stuff in buffers instead of sending out byte
by byte.
- As a consequence, I need to know the endianness of the machine.
Currently I rely on getting it from machine/endian.h, but this
may not be available everywhere? (Who the hell thought it was
a good idea to pass integers to the backend the other way around
than the normal network byte order? *argl*)
- Libpq looks in the environment for magic variables, and upon
establishing a connection to the backend, sends it queries
of the form "SET var_name TO 'var_value'". This needs a change
in the backend parser (Mr. Parser, are you there? :)
- Currently it looks for two Env-Vars, namely PG_DATEFORMAT
and PG_FLOATFORMAT. What else makes sense? PG_TIMEFORMAT?
PG_TIMEZONE?
From: "Martin J. Laubach" <mjl@wwx.vip.at>
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 60f55ae5993..4b3a8630a51 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.24 1997/03/12 21:23:09 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.25 1997/03/18 20:15:39 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -100,6 +100,16 @@ static PQconninfoOption PQconninfoOptions[] = { NULL, NULL, 0 } }; +struct EnvironmentOptions + { + const char *envName, *pgName; + } EnvironmentOptions[] = + { + { "PG_DATEFORMAT", "pg_dateformat" }, + { "PG_FLOATFORMAT", "pg_floatformat" }, + { NULL } + }; + /* ---------------- * PQconnectdb * @@ -514,6 +524,24 @@ connectDB(PGconn *conn) conn->port = port; + { + struct EnvironmentOptions *eo; + char setQuery[80]; /* mjl: size okay? XXX */ + + for(eo = EnvironmentOptions; eo->envName; eo++) + { + const char *val; + + if(val = getenv(eo->envName)) + { + PGresult *res; + + sprintf(setQuery, "SET %s TO \".60%s\"", eo->pgName, val); + res = PQexec(conn, setQuery); + PQclear(res); /* Don't care? */ + } + } + } return CONNECTION_OK; connect_errReturn: |