diff options
author | Marc G. Fournier <scrappy@hub.org> | 1999-01-21 20:01:34 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1999-01-21 20:01:34 +0000 |
commit | cdbaec771c5c0b77a4a130a3726e6ea043c59eed (patch) | |
tree | be07e5b884c1929d287c2166e774f2ba94c8c8f3 /src/interfaces/ecpg/lib/ecpglib.c | |
parent | 1f37905681dc3f068a2690b21a7162df145c4690 (diff) | |
download | postgresql-cdbaec771c5c0b77a4a130a3726e6ea043c59eed.tar.gz postgresql-cdbaec771c5c0b77a4a130a3726e6ea043c59eed.zip |
From: Michael Meskes <Michael.Meskes@usa.net>
See attached file. Now accepts "exec sql whenever sqlwarning".
Diffstat (limited to 'src/interfaces/ecpg/lib/ecpglib.c')
-rw-r--r-- | src/interfaces/ecpg/lib/ecpglib.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c index f982d5103cb..62769941a7c 100644 --- a/src/interfaces/ecpg/lib/ecpglib.c +++ b/src/interfaces/ecpg/lib/ecpglib.c @@ -886,12 +886,17 @@ ECPGtrans(int lineno, const char *transaction) PGresult *res; ECPGlog("ECPGtrans line %d action = %s\n", lineno, transaction); - if ((res = PQexec(actual_connection->connection, transaction)) == NULL) + + /* if we have no connection we just simulate the command */ + if (actual_connection && actual_connection->connection) { - register_error(ECPG_TRANS, "Error in transaction processing line %d.", lineno); - return FALSE; + if ((res = PQexec(actual_connection->connection, transaction)) == NULL) + { + register_error(ECPG_TRANS, "Error in transaction processing line %d.", lineno); + return FALSE; + } + PQclear(res); } - PQclear(res); if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0) committed = 1; return TRUE; |