more patches for ecpg
See attached file. Now accepts "exec sql whenever sqlwarning".
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net | Use PostgreSQL!
Attachments:
ecpg.patchtext/plain; charset=iso-8859-1Download
diff -rcN ecpg/ChangeLog ecpg.mm/ChangeLog
*** ecpg/ChangeLog Tue Jan 19 07:21:03 1999
--- ecpg.mm/ChangeLog Thu Jan 21 16:37:24 1999
***************
*** 335,341 ****
Thu Sep 17 19:23:24 CEST 1998
! - Added missing ´;´ in preproc.y
- Set version to 2.4.2
Tue Sep 29 10:22:00 CEST 1998
--- 335,341 ----
Thu Sep 17 19:23:24 CEST 1998
! - Added missing ';' in preproc.y
- Set version to 2.4.2
Tue Sep 29 10:22:00 CEST 1998
***************
*** 357,379 ****
- Synced preproc.y with gram.y yet again.
- Set version to 2.4.4
! Wed Dec 9 11:24:54 MEZ 1998
- Synced preproc.y with gram.y and the keywords.c files to add CASE
statement.
! Tue Dec 22 14:16:11 CET 1998
- Synced preproc.y with gram.y for locking statements.
- Set version to 2.4.5
! Tue Jan 7 15:19:34 CET 1999
- Synced preproc.y with gram.y for for-update clause and changes in
handling of numerics
! Mon Jan 18 11:22:44 CET 1999
- Added INTERSECT, EXCEPT and UNION for Select statements
- Put keywords.c in sync again after forgettimg it the last time.
! - Set version to 2.4.6
--- 357,385 ----
- Synced preproc.y with gram.y yet again.
- Set version to 2.4.4
! Wed Dec 9 20:24:54 MEZ 1998
- Synced preproc.y with gram.y and the keywords.c files to add CASE
statement.
! Tue Dec 22 19:16:11 CET 1998
- Synced preproc.y with gram.y for locking statements.
- Set version to 2.4.5
! Tue Jan 7 19:19:34 CET 1999
- Synced preproc.y with gram.y for for-update clause and changes in
handling of numerics
! Mon Jan 18 19:22:44 CET 1999
- Added INTERSECT, EXCEPT and UNION for Select statements
- Put keywords.c in sync again after forgettimg it the last time.
!
! Thu Jan 21 21:29:00 CET 1999
!
! - Fixed libecpg to not segfault if there is no connection.
! - Set library version to 2.6.3
! - Added 'exec sql whenever sqlwarning'.
! - Set ecpg version to 2.4.6
diff -rcN ecpg/lib/Makefile.in ecpg.mm/lib/Makefile.in
*** ecpg/lib/Makefile.in Sun Jan 17 11:42:04 1999
--- ecpg.mm/lib/Makefile.in Thu Jan 21 16:28:56 1999
***************
*** 12,18 ****
NAME= ecpg
SO_MAJOR_VERSION= 2
! SO_MINOR_VERSION= 6.2
SRCDIR= @top_srcdir@
include $(SRCDIR)/Makefile.global
--- 12,18 ----
NAME= ecpg
SO_MAJOR_VERSION= 2
! SO_MINOR_VERSION= 6.3
SRCDIR= @top_srcdir@
include $(SRCDIR)/Makefile.global
diff -rcN ecpg/lib/ecpglib.c ecpg.mm/lib/ecpglib.c
*** ecpg/lib/ecpglib.c Sat Oct 3 07:47:10 1998
--- ecpg.mm/lib/ecpglib.c Thu Jan 21 16:28:33 1999
***************
*** 886,897 ****
PGresult *res;
ECPGlog("ECPGtrans line %d action = %s\n", lineno, transaction);
! if ((res = PQexec(actual_connection->connection, transaction)) == NULL)
{
! register_error(ECPG_TRANS, "Error in transaction processing line %d.", lineno);
! return FALSE;
}
- PQclear(res);
if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0)
committed = 1;
return TRUE;
--- 886,902 ----
PGresult *res;
ECPGlog("ECPGtrans line %d action = %s\n", lineno, transaction);
!
! /* if we have no connection we just simulate the command */
! if (actual_connection && actual_connection->connection)
{
! if ((res = PQexec(actual_connection->connection, transaction)) == NULL)
! {
! register_error(ECPG_TRANS, "Error in transaction processing line %d.", lineno);
! return FALSE;
! }
! PQclear(res);
}
if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0)
committed = 1;
return TRUE;
diff -rcN ecpg/preproc/ecpg_keywords.c ecpg.mm/preproc/ecpg_keywords.c
*** ecpg/preproc/ecpg_keywords.c Tue Sep 1 06:46:11 1998
--- ecpg.mm/preproc/ecpg_keywords.c Thu Jan 21 15:33:41 1999
***************
*** 38,43 ****
--- 38,44 ----
{"section", SQL_SECTION},
{"sqlerror", SQL_SQLERROR},
{"sqlprint", SQL_SQLPRINT},
+ {"sqlwarning", SQL_SQLWARNING},
{"stop", SQL_STOP},
{"whenever", SQL_WHENEVER},
};
diff -rcN ecpg/preproc/preproc.y ecpg.mm/preproc/preproc.y
*** ecpg/preproc/preproc.y Tue Jan 19 07:21:05 1999
--- ecpg.mm/preproc/preproc.y Thu Jan 21 16:36:46 1999
***************
*** 45,51 ****
/*
* store the whenever action here
*/
! static struct when when_error, when_nf;
static void
print_action(struct when *w)
--- 45,51 ----
/*
* store the whenever action here
*/
! static struct when when_error, when_nf, when_warn;
static void
print_action(struct when *w)
***************
*** 76,81 ****
--- 76,87 ----
fprintf(yyout, "\nif (sqlca.sqlcode == ECPG_NOT_FOUND) ");
print_action(&when_nf);
}
+ if (when_warn.code != W_NOTHING)
+ {
+ output_line_number();
+ fprintf(yyout, "\nif (sqlca.sqlwarn[0] == 'W') ");
+ print_action(&when_warn);
+ }
if (when_error.code != W_NOTHING)
{
output_line_number();
***************
*** 517,523 ****
%token SQL_DISCONNECT SQL_FOUND SQL_GO SQL_GOTO
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_OPEN SQL_RELEASE
%token SQL_SECTION SQL_SEMI SQL_SQLERROR SQL_SQLPRINT SQL_START
! %token SQL_STOP SQL_WHENEVER
/* C token */
%token S_ANYTHING S_AUTO S_BOOL S_CHAR S_CONST S_DOUBLE S_ENUM S_EXTERN
--- 523,529 ----
%token SQL_DISCONNECT SQL_FOUND SQL_GO SQL_GOTO
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_OPEN SQL_RELEASE
%token SQL_SECTION SQL_SEMI SQL_SQLERROR SQL_SQLPRINT SQL_START
! %token SQL_STOP SQL_WHENEVER SQL_SQLWARNING
/* C token */
%token S_ANYTHING S_AUTO S_BOOL S_CHAR S_CONST S_DOUBLE S_ENUM S_EXTERN
***************
*** 4630,4638 ****
}
/*
* whenever statement: decide what to do in case of error/no data found
! * according to SQL standards we miss: SQLSTATE, CONSTRAINT, SQLEXCEPTION
! * and SQLWARNING
!
*/
ECPGWhenever: SQL_WHENEVER SQL_SQLERROR action {
when_error.code = $<action>3.code;
--- 4636,4642 ----
}
/*
* whenever statement: decide what to do in case of error/no data found
! * according to SQL standards we lack: SQLSTATE, CONSTRAINT and SQLEXCEPTION
*/
ECPGWhenever: SQL_WHENEVER SQL_SQLERROR action {
when_error.code = $<action>3.code;
***************
*** 4643,4648 ****
--- 4647,4657 ----
when_nf.code = $<action>4.code;
when_nf.command = $<action>4.command;
$$ = cat3_str(make1_str("/* exec sql whenever not found "), $4.str, make1_str("; */\n"));
+ }
+ | SQL_WHENEVER SQL_SQLWARNING action {
+ when_warn.code = $<action>3.code;
+ when_warn.command = $<action>3.command;
+ $$ = cat3_str(make1_str("/* exec sql whenever sql_warning "), $3.str, make1_str("; */\n"));
}
action : SQL_CONTINUE {
diff -rcN ecpg/test/header_test.h ecpg.mm/test/header_test.h
*** ecpg/test/header_test.h Thu Jun 4 07:52:00 1998
--- ecpg.mm/test/header_test.h Thu Jan 21 16:59:30 1999
***************
*** 1,3 ****
exec sql include sqlca;
! exec sql whenever sqlerror sqlprint;
--- 1,15 ----
exec sql include sqlca;
! exec sql whenever sqlerror do print_and_stop();
! exec sql whenever sqlwarning do warn();
!
! void print_and_stop(void)
! {
! sqlprint();
! exit(-1);
! }
!
! void warn(void)
! {
! fprintf(stderr, "Warning: At least one column was truncated\n");
! }
Applied...but why isn't/wasn't it posted tothe patches list instead of
here? :(
On Thu, 21 Jan 1999, Michael Meskes wrote:
See attached file. Now accepts "exec sql whenever sqlwarning".
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net | Use PostgreSQL!
Marc G. Fournier
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
Thus spake The Hermit Hacker
Applied...but why isn't/wasn't it posted tothe patches list instead of
here? :(
Perhaps like me he doesn't subscribe to patches and you don't accept
postings to mailing lists from non-subscribers. Personally I find
the CVS update summaries informational enough and prefer not to have
to wade through the raw patches. Is the assumption that those that
submit should also be peer reviewing?
By the way, what ever happened to my primary key patches? On Bruce's
suggestion I posted them to hackers and I saw them but so far no one
has commented on them or checked them in.
P.S. If anyone is trying to mail me directly, druid.net is on hold
due to Internic snafu. It should be fixed soon. In the meantime
you can reach me at darcy@hub.org.
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.
By the way, what ever happened to my primary key patches? On Bruce's
suggestion I posted them to hackers and I saw them but so far no one
has commented on them or checked them in.
I still have them. They look good.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
On Thu, Jan 21, 1999 at 05:06:56PM -0500, D'Arcy J.M. Cain wrote:
Applied...but why isn't/wasn't it posted tothe patches list instead of
here? :(Perhaps like me he doesn't subscribe to patches and you don't accept
postings to mailing lists from non-subscribers. Personally I find
Correct. In fact I even tried subscribe in the process of changing my
hackers and interfaces account but am still waiting for Marc to approve
this.
the CVS update summaries informational enough and prefer not to have
to wade through the raw patches. Is the assumption that those that
submit should also be peer reviewing?
That one is also my problem. As it is now I get way too much email and
cannot cope with lots of patches I will delete anyway.
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net | Use PostgreSQL!
On Thu, Jan 21, 1999 at 04:07:39PM -0400, The Hermit Hacker wrote:
Applied...but why isn't/wasn't it posted tothe patches list instead of
here? :(
Thanks Marc.
As I already said the patches list is a problem for me. The only reason for
this list I see is to get the patches to all people with direct CVS access
so the work does not have to be done by just one person. If this is the real
reason I wonder why we don't set it up this way, i.e. distribution to only
some and the others can send patches but don't get the patches send to them.
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net | Use PostgreSQL!