Commit 91fed81c authored by Marc G. Fournier's avatar Marc G. Fournier

From: Michael Meskes <Michael.Meskes@usa.net>

+
+ Wed Jan 27 12:42:22 CET 1999
+
+       - Fixed bug that caused ecpg to lose 'goto' information.
+       - Set ecpg version to 2.4.7
+
+ Fri Jan 29 18:03:52 CET 1999
+
+       - Fixed bug that caused 'enum' to be rejected in pure C code.
+       - Fixed bug that caused function names to be translated to lower case.
+       - Set ecpg version to 2.4.8
+
parent f7c4ec50
...@@ -383,3 +383,15 @@ Thu Jan 21 21:29:00 CET 1999 ...@@ -383,3 +383,15 @@ Thu Jan 21 21:29:00 CET 1999
- Set library version to 2.6.3 - Set library version to 2.6.3
- Added 'exec sql whenever sqlwarning'. - Added 'exec sql whenever sqlwarning'.
- Set ecpg version to 2.4.6 - Set ecpg version to 2.4.6
Wed Jan 27 12:42:22 CET 1999
- Fixed bug that caused ecpg to lose 'goto' information.
- Set ecpg version to 2.4.7
Fri Jan 29 18:03:52 CET 1999
- Fixed bug that caused 'enum' to be rejected in pure C code.
- Fixed bug that caused function names to be translated to lower case.
- Set ecpg version to 2.4.8
...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global ...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2 MAJOR_VERSION=2
MINOR_VERSION=4 MINOR_VERSION=4
PATCHLEVEL=6 PATCHLEVEL=8
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
......
...@@ -333,22 +333,23 @@ cppline {space}*#.*(\\{space}*\n)*\n* ...@@ -333,22 +333,23 @@ cppline {space}*#.*(\\{space}*\n)*\n*
<SQL>{identifier}/{space}*-{number} { <SQL>{identifier}/{space}*-{number} {
int i; int i;
ScanKeyword *keyword; ScanKeyword *keyword;
char lower_text[NAMEDATALEN];
BEGIN(xm); BEGIN(xm);
for(i = 0; yytext[i]; i++) /* this should leave the last byte set to '\0' */
if (isascii((unsigned char)yytext[i]) && isupper(yytext[i])) strncpy(lower_text, yytext, NAMEDATALEN-1);
yytext[i] = tolower(yytext[i]); for(i = 0; lower_text[i]; i++)
if (isascii((unsigned char)lower_text[i]) && isupper(lower_text[i]))
if (i >= NAMEDATALEN) lower_text[i] = tolower(lower_text[i]);
yytext[NAMEDATALEN-1] = '\0';
printf("yyt= %s, lt = %s\n", yytext, lower_text);
keyword = ScanKeywordLookup((char*)yytext); keyword = ScanKeywordLookup((char*)lower_text);
if (keyword != NULL) { if (keyword != NULL) {
return keyword->value; return keyword->value;
} }
else else
{ {
keyword = ScanECPGKeywordLookup((char*)yytext); keyword = ScanECPGKeywordLookup((char*)lower_text);
if (keyword != NULL) { if (keyword != NULL) {
return keyword->value; return keyword->value;
} }
...@@ -475,21 +476,22 @@ cppline {space}*#.*(\\{space}*\n)*\n* ...@@ -475,21 +476,22 @@ cppline {space}*#.*(\\{space}*\n)*\n*
<SQL>{identifier} { <SQL>{identifier} {
int i; int i;
ScanKeyword *keyword; ScanKeyword *keyword;
char lower_text[NAMEDATALEN];
for(i = 0; yytext[i]; i++) /* this should leave the last byte set to '\0' */
if (isascii((unsigned char)yytext[i]) && isupper(yytext[i])) strncpy(lower_text, yytext, NAMEDATALEN-1);
yytext[i] = tolower(yytext[i]); for(i = 0; lower_text[i]; i++)
if (isascii((unsigned char)lower_text[i]) && isupper(lower_text[i]))
if (i >= NAMEDATALEN) lower_text[i] = tolower(lower_text[i]);
yytext[NAMEDATALEN-1] = '\0';
keyword = ScanKeywordLookup((char*)yytext); printf("yyt= %s, lt = %s\n", yytext, lower_text);
keyword = ScanKeywordLookup((char*)lower_text);
if (keyword != NULL) { if (keyword != NULL) {
return keyword->value; return keyword->value;
} }
else else
{ {
keyword = ScanECPGKeywordLookup((char*)yytext); keyword = ScanECPGKeywordLookup((char*)lower_text);
if (keyword != NULL) { if (keyword != NULL) {
return keyword->value; return keyword->value;
} }
......
...@@ -521,7 +521,8 @@ output_statement(char * stmt, int mode) ...@@ -521,7 +521,8 @@ output_statement(char * stmt, int mode)
/* special embedded SQL token */ /* special embedded SQL token */
%token SQL_BREAK SQL_CALL SQL_CONNECT SQL_CONNECTION SQL_CONTINUE %token SQL_BREAK SQL_CALL SQL_CONNECT SQL_CONNECTION SQL_CONTINUE
%token SQL_DISCONNECT SQL_FOUND SQL_GO SQL_GOTO %token SQL_DISCONNECT SQL_FOUND SQL_GO SQL_GOTO
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_OPEN SQL_RELEASE %token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_OPEN
%token SQL_PREPARE SQL_RELEASE
%token SQL_SECTION SQL_SEMI SQL_SQLERROR SQL_SQLPRINT SQL_START %token SQL_SECTION SQL_SEMI SQL_SQLERROR SQL_SQLPRINT SQL_START
%token SQL_STOP SQL_WHENEVER SQL_SQLWARNING %token SQL_STOP SQL_WHENEVER SQL_SQLWARNING
...@@ -813,6 +814,9 @@ stmt: AddAttrStmt { output_statement($1, 0); } ...@@ -813,6 +814,9 @@ stmt: AddAttrStmt { output_statement($1, 0); }
output_line_number(); output_line_number();
free($1); free($1);
} }
| ECPGPrepare {
yyerror("PREPARE is not supported yet.");
}
/* /*
* We start with a lot of stuff that's very similar to the backend's parsing * We start with a lot of stuff that's very similar to the backend's parsing
...@@ -4671,12 +4675,12 @@ action : SQL_CONTINUE { ...@@ -4671,12 +4675,12 @@ action : SQL_CONTINUE {
} }
| SQL_GOTO name { | SQL_GOTO name {
$<action>$.code = W_GOTO; $<action>$.code = W_GOTO;
$<action>$.command = $2; $<action>$.command = strdup($2);
$<action>$.str = cat2_str(make1_str("goto "), $2); $<action>$.str = cat2_str(make1_str("goto "), $2);
} }
| SQL_GO TO name { | SQL_GO TO name {
$<action>$.code = W_GOTO; $<action>$.code = W_GOTO;
$<action>$.command = $3; $<action>$.command = strdup($3);
$<action>$.str = cat2_str(make1_str("goto "), $3); $<action>$.str = cat2_str(make1_str("goto "), $3);
} }
| DO name '(' dotext ')' { | DO name '(' dotext ')' {
...@@ -4695,8 +4699,15 @@ action : SQL_CONTINUE { ...@@ -4695,8 +4699,15 @@ action : SQL_CONTINUE {
$<action>$.str = cat2_str(make1_str("call"), mm_strdup($<action>$.command)); $<action>$.str = cat2_str(make1_str("call"), mm_strdup($<action>$.command));
} }
/* some other stuff for ecpg */ /*
* As long as the prepare statement in not supported by the backend, we will
* try to simulate it here so we get dynamic SQL
*/
ECPGPrepare: SQL_PREPARE name FROM name
{
}
/* some other stuff for ecpg */
ecpg_expr: attr opt_indirection ecpg_expr: attr opt_indirection
{ {
$$ = cat2_str($1, $2); $$ = cat2_str($1, $2);
...@@ -5032,6 +5043,7 @@ c_anything: IDENT { $$ = $1; } ...@@ -5032,6 +5043,7 @@ c_anything: IDENT { $$ = $1; }
| S_CHAR { $$ = make1_str("char"); } | S_CHAR { $$ = make1_str("char"); }
| S_CONST { $$ = make1_str("const"); } | S_CONST { $$ = make1_str("const"); }
| S_DOUBLE { $$ = make1_str("double"); } | S_DOUBLE { $$ = make1_str("double"); }
| S_ENUM { $$ = make1_str("enum"); }
| S_EXTERN { $$ = make1_str("extern"); } | S_EXTERN { $$ = make1_str("extern"); }
| S_FLOAT { $$ = make1_str("float"); } | S_FLOAT { $$ = make1_str("float"); }
| S_INT { $$ = make1_str("int"); } | S_INT { $$ = make1_str("int"); }
......
exec sql include sqlca; exec sql include sqlca;
exec sql whenever sqlerror do print_and_stop(); exec sql whenever sqlerror do PrintAndStop();
exec sql whenever sqlwarning do warn(); exec sql whenever sqlwarning do warn();
void print_and_stop(void) void PrintAndStop(void)
{ {
sqlprint(); sqlprint();
exit(-1); exit(-1);
......
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