summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/lib/ecpglib.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-03-20 03:08:11 +0000
committerBruce Momjian <bruce@momjian.us>1998-03-20 03:08:11 +0000
commit80f7c4138859543e447b5358623eb63bca1bbd68 (patch)
tree03fc37441dbd3f31f2ecfe4ee15aa803f652c9a0 /src/interfaces/ecpg/lib/ecpglib.c
parent561aead3f163549bfd8fa86c8cf98a38a9bb6981 (diff)
Here's my next patch to bring ecpg to version 1.1. It now correctly
handles all transaction commands and the exec sql include command. Michael Meskes
Diffstat (limited to 'src/interfaces/ecpg/lib/ecpglib.c')
-rw-r--r--src/interfaces/ecpg/lib/ecpglib.c29
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)