diff options
Diffstat (limited to 'src/interfaces/ecpg/lib/ecpglib.c')
-rw-r--r-- | src/interfaces/ecpg/lib/ecpglib.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c index 301b43d6c7b..87b2350bdb0 100644 --- a/src/interfaces/ecpg/lib/ecpglib.c +++ b/src/interfaces/ecpg/lib/ecpglib.c @@ -572,14 +572,14 @@ ECPGdo(int lineno, char *query,...) bool -ECPGcommit(int lineno) +ECPGtrans(int lineno, const char * transaction) { PGresult *res; - ECPGlog("ECPGcommit line %d\n", lineno); - if ((res = PQexec(simple_connection, "end")) == NULL) + ECPGlog("ECPGtrans line %d action = %s\n", lineno, transaction); + if ((res = PQexec(simple_connection, transaction)) == NULL) { - register_error(-1, "Error committing line %d.", lineno); + register_error(-1, "Error in transaction processing line %d.", lineno); return (FALSE); } PQclear(res); @@ -587,23 +587,18 @@ ECPGcommit(int lineno) return (TRUE); } +/* include these for compatibility */ bool -ECPGrollback(int lineno) +ECPGcommit(int lineno) { - PGresult *res; - - ECPGlog("ECPGrollback line %d\n", lineno); - if ((res = PQexec(simple_connection, "abort")) == NULL) - { - register_error(-1, "Error rolling back line %d.", lineno); - return (FALSE); - } - PQclear(res); - committed = 1; - return (TRUE); + return(ECPGtrans(lineno, "end")); } - +bool +ECPGrollback(int lineno) +{ + return(ECPGtrans(lineno, "abort")); +} bool ECPGsetdb(PGconn *newcon) |