1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

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
This commit is contained in:
Bruce Momjian
1998-03-20 03:08:11 +00:00
parent 561aead3f1
commit 80f7c41388
14 changed files with 275 additions and 95 deletions

View File

@@ -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,24 +587,19 @@ ECPGcommit(int lineno)
return (TRUE);
}
/* include these for compatibility */
bool
ECPGcommit(int lineno)
{
return(ECPGtrans(lineno, "end"));
}
bool
ECPGrollback(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, "abort"));
}
bool
ECPGsetdb(PGconn *newcon)
{