diff options
author | Michael Meskes <meskes@postgresql.org> | 2007-08-14 10:01:54 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2007-08-14 10:01:54 +0000 |
commit | 635a0b9a8640bb7f2944a3f77ddc370f8dd7b010 (patch) | |
tree | d54146b2416fecd2a544f3bf786108079b879cfc /src/interfaces/ecpg/ecpglib/connect.c | |
parent | b83bd31bd953b6daa22bcbdaee5ade2a27ec7324 (diff) | |
download | postgresql-635a0b9a8640bb7f2944a3f77ddc370f8dd7b010.tar.gz postgresql-635a0b9a8640bb7f2944a3f77ddc370f8dd7b010.zip |
- Finished major rewrite to use new protocol version
- Really prepare statements
- Added more regression tests
- Added auto-prepare mode
- Use '$n' for positional variables, '?' is still possible via ecpg option
- Cleaned up the sources a little bit
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/connect.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 650c4e503c0..421155bb923 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.41 2007/03/29 12:02:24 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.42 2007/08/14 10:01:52 meskes Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -185,11 +185,9 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name) { if (con->committed) { - if ((results = PQexec(con->connection, "begin transaction")) == NULL) - { - ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL); + results = PQexec(con->connection, "begin transaction"); + if (!ECPGcheck_PQresult(results, lineno, con->connection, ECPG_COMPAT_PGSQL)) return false; - } PQclear(results); con->committed = false; } @@ -199,11 +197,9 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name) { if (!con->committed) { - if ((results = PQexec(con->connection, "commit")) == NULL) - { - ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL); + results = PQexec(con->connection, "commit"); + if (!ECPGcheck_PQresult(results, lineno, con->connection, ECPG_COMPAT_PGSQL)) return false; - } PQclear(results); con->committed = true; } @@ -249,7 +245,7 @@ ECPGnoticeReceiver(void *arg, const PGresult *result) if (strncmp(sqlstate, "00", 2) == 0) return; - ECPGlog("%s", message); + ECPGlog("ECPGnoticeReceiver %s\n", message); /* map to SQLCODE for backward compatibility */ if (strcmp(sqlstate, ECPG_SQLSTATE_INVALID_CURSOR_NAME) == 0) |