From cdbaec771c5c0b77a4a130a3726e6ea043c59eed Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Thu, 21 Jan 1999 20:01:34 +0000 Subject: From: Michael Meskes See attached file. Now accepts "exec sql whenever sqlwarning". --- src/interfaces/ecpg/lib/ecpglib.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/interfaces/ecpg/lib/ecpglib.c') diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c index f982d5103c..62769941a7 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; -- cgit v1.2.1