Commit 4b04b01a authored by Michael Meskes's avatar Michael Meskes

*** empty log message ***

parent b122e16a
...@@ -586,5 +586,9 @@ Mon May 17 18:13:30 CEST 1999 ...@@ -586,5 +586,9 @@ Mon May 17 18:13:30 CEST 1999
Fri May 21 18:13:44 CEST 1999 Fri May 21 18:13:44 CEST 1999
- Synced preproc.y with gram.y. - Synced preproc.y with gram.y.
Sun May 23 11:19:32 CEST 1999
- Add braces around each statement so that a simple if/else works.
- Set library version to 3.0.0 - Set library version to 3.0.0
- Set ecpg version to 2.6.0 - Set ecpg version to 2.6.0
...@@ -80,7 +80,7 @@ print_action(struct when *w) ...@@ -80,7 +80,7 @@ print_action(struct when *w)
static void static void
whenever_action(int mode) whenever_action(int mode)
{ {
if (mode == 1 && when_nf.code != W_NOTHING) if ((mode&1) == 1 && when_nf.code != W_NOTHING)
{ {
output_line_number(); output_line_number();
fprintf(yyout, "\nif (sqlca.sqlcode == ECPG_NOT_FOUND) "); fprintf(yyout, "\nif (sqlca.sqlcode == ECPG_NOT_FOUND) ");
...@@ -98,6 +98,8 @@ whenever_action(int mode) ...@@ -98,6 +98,8 @@ whenever_action(int mode)
fprintf(yyout, "\nif (sqlca.sqlcode < 0) "); fprintf(yyout, "\nif (sqlca.sqlcode < 0) ");
print_action(&when_error); print_action(&when_error);
} }
if ((mode&2) == 2)
fputc('}', yyout);
output_line_number(); output_line_number();
} }
...@@ -525,7 +527,7 @@ output_statement(char * stmt, int mode) ...@@ -525,7 +527,7 @@ output_statement(char * stmt, int mode)
{ {
int i, j=strlen(stmt); int i, j=strlen(stmt);
fprintf(yyout, "ECPGdo(__LINE__, %s, \"", connection ? connection : "NULL"); fprintf(yyout, "{ ECPGdo(__LINE__, %s, \"", connection ? connection : "NULL");
/* do this char by char as we have to filter '\"' */ /* do this char by char as we have to filter '\"' */
for (i = 0;i < j; i++) for (i = 0;i < j; i++)
...@@ -538,6 +540,7 @@ output_statement(char * stmt, int mode) ...@@ -538,6 +540,7 @@ output_statement(char * stmt, int mode)
fputs("ECPGt_EOIT, ", yyout); fputs("ECPGt_EOIT, ", yyout);
dump_variables(argsresult, 1); dump_variables(argsresult, 1);
fputs("ECPGt_EORT);", yyout); fputs("ECPGt_EORT);", yyout);
mode |= 2;
whenever_action(mode); whenever_action(mode);
free(stmt); free(stmt);
if (connection != NULL) if (connection != NULL)
...@@ -903,8 +906,8 @@ stmt: AddAttrStmt { output_statement($1, 0); } ...@@ -903,8 +906,8 @@ stmt: AddAttrStmt { output_statement($1, 0); }
} }
| RuleStmt { output_statement($1, 0); } | RuleStmt { output_statement($1, 0); }
| TransactionStmt { | TransactionStmt {
fprintf(yyout, "ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1); fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ViewStmt { output_statement($1, 0); } | ViewStmt { output_statement($1, 0); }
...@@ -919,8 +922,8 @@ stmt: AddAttrStmt { output_statement($1, 0); } ...@@ -919,8 +922,8 @@ stmt: AddAttrStmt { output_statement($1, 0); }
if (connection) if (connection)
yyerror("no at option for connect statement.\n"); yyerror("no at option for connect statement.\n");
fprintf(yyout, "ECPGconnect(__LINE__, %s, %d);", $1, autocommit); fprintf(yyout, "{ ECPGconnect(__LINE__, %s, %d);", $1, autocommit);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGCursorStmt { | ECPGCursorStmt {
...@@ -930,8 +933,9 @@ stmt: AddAttrStmt { output_statement($1, 0); } ...@@ -930,8 +933,9 @@ stmt: AddAttrStmt { output_statement($1, 0); }
if (connection) if (connection)
yyerror("no at option for connect statement.\n"); yyerror("no at option for connect statement.\n");
fputc('{', yyout);
fputs($1, yyout); fputs($1, yyout);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGDeclare { | ECPGDeclare {
...@@ -941,16 +945,16 @@ stmt: AddAttrStmt { output_statement($1, 0); } ...@@ -941,16 +945,16 @@ stmt: AddAttrStmt { output_statement($1, 0); }
if (connection) if (connection)
yyerror("no at option for disconnect statement.\n"); yyerror("no at option for disconnect statement.\n");
fprintf(yyout, "ECPGdisconnect(__LINE__, \"%s\");", $1); fprintf(yyout, "{ ECPGdisconnect(__LINE__, \"%s\");", $1);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGExecute { | ECPGExecute {
output_statement($1, 0); output_statement($1, 0);
} }
| ECPGFree { | ECPGFree {
fprintf(yyout, "ECPGdeallocate(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1); fprintf(yyout, "{ ECPGdeallocate(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGOpen { | ECPGOpen {
...@@ -968,36 +972,36 @@ stmt: AddAttrStmt { output_statement($1, 0); } ...@@ -968,36 +972,36 @@ stmt: AddAttrStmt { output_statement($1, 0); }
yyerror(errortext); yyerror(errortext);
} }
fprintf(yyout, "ECPGdo(__LINE__, %s, \"%s\",", ptr->connection ? ptr->connection : "NULL", ptr->command); fprintf(yyout, "{ ECPGdo(__LINE__, %s, \"%s\",", ptr->connection ? ptr->connection : "NULL", ptr->command);
/* dump variables to C file*/ /* dump variables to C file*/
dump_variables(ptr->argsinsert, 0); dump_variables(ptr->argsinsert, 0);
dump_variables(argsinsert, 0); dump_variables(argsinsert, 0);
fputs("ECPGt_EOIT, ", yyout); fputs("ECPGt_EOIT, ", yyout);
dump_variables(ptr->argsresult, 0); dump_variables(ptr->argsresult, 0);
fputs("ECPGt_EORT);", yyout); fputs("ECPGt_EORT);", yyout);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGPrepare { | ECPGPrepare {
if (connection) if (connection)
yyerror("no at option for set connection statement.\n"); yyerror("no at option for set connection statement.\n");
fprintf(yyout, "ECPGprepare(__LINE__, %s);", $1); fprintf(yyout, "{ ECPGprepare(__LINE__, %s);", $1);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGRelease { /* output already done */ } | ECPGRelease { /* output already done */ }
| ECPGSetAutocommit { | ECPGSetAutocommit {
fprintf(yyout, "ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL"); fprintf(yyout, "{ ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL");
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGSetConnection { | ECPGSetConnection {
if (connection) if (connection)
yyerror("no at option for set connection statement.\n"); yyerror("no at option for set connection statement.\n");
fprintf(yyout, "ECPGsetconn(__LINE__, %s);", $1); fprintf(yyout, "{ ECPGsetconn(__LINE__, %s);", $1);
whenever_action(0); whenever_action(2);
free($1); free($1);
} }
| ECPGTypedef { | ECPGTypedef {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment