Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit91fed81

Browse files
committed
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+
1 parentf7c4ec5 commit91fed81

File tree

5 files changed

+50
-24
lines changed

5 files changed

+50
-24
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,3 +383,15 @@ Thu Jan 21 21:29:00 CET 1999
383383
- Set library version to 2.6.3
384384
- Added 'exec sql whenever sqlwarning'.
385385
- Set ecpg version to 2.4.6
386+
387+
Wed Jan 27 12:42:22 CET 1999
388+
389+
- Fixed bug that caused ecpg to lose 'goto' information.
390+
- Set ecpg version to 2.4.7
391+
392+
Fri Jan 29 18:03:52 CET 1999
393+
394+
- Fixed bug that caused 'enum' to be rejected in pure C code.
395+
- Fixed bug that caused function names to be translated to lower case.
396+
- Set ecpg version to 2.4.8
397+

‎src/interfaces/ecpg/preproc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
33

44
MAJOR_VERSION=2
55
MINOR_VERSION=4
6-
PATCHLEVEL=6
6+
PATCHLEVEL=8
77

88
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION)\
99
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL)\

‎src/interfaces/ecpg/preproc/pgc.l

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -333,22 +333,23 @@ cppline{space}*#.*(\\{space}*\n)*\n*
333333
<SQL>{identifier}/{space}*-{number}{
334334
int i;
335335
ScanKeyword*keyword;
336+
char lower_text[NAMEDATALEN];
336337

337338
BEGIN(xm);
338-
for(i =0; yytext[i]; i++)
339-
if (isascii((unsignedchar)yytext[i]) &&isupper(yytext[i]))
340-
yytext[i] =tolower(yytext[i]);
341-
342-
if (i >= NAMEDATALEN)
343-
yytext[NAMEDATALEN-1] ='\0';
344-
345-
keyword =ScanKeywordLookup((char*)yytext);
339+
/* this should leave the last byte set to '\0' */
340+
strncpy(lower_text,yytext, NAMEDATALEN-1);
341+
for(i =0; lower_text[i]; i++)
342+
if (isascii((unsignedchar)lower_text[i]) &&isupper(lower_text[i]))
343+
lower_text[i] =tolower(lower_text[i]);
344+
345+
printf("yyt= %s, lt = %s\n", yytext, lower_text);
346+
keyword =ScanKeywordLookup((char*)lower_text);
346347
if (keyword !=NULL) {
347348
return keyword->value;
348349
}
349350
else
350351
{
351-
keyword =ScanECPGKeywordLookup((char*)yytext);
352+
keyword =ScanECPGKeywordLookup((char*)lower_text);
352353
if (keyword !=NULL) {
353354
return keyword->value;
354355
}
@@ -475,21 +476,22 @@ cppline{space}*#.*(\\{space}*\n)*\n*
475476
<SQL>{identifier}{
476477
int i;
477478
ScanKeyword*keyword;
479+
char lower_text[NAMEDATALEN];
478480

479-
for(i =0; yytext[i]; i++)
480-
if (isascii((unsignedchar)yytext[i]) &&isupper(yytext[i]))
481-
yytext[i] =tolower(yytext[i]);
482-
483-
if (i >= NAMEDATALEN)
484-
yytext[NAMEDATALEN-1] ='\0';
481+
/* this should leave the last byte set to '\0' */
482+
strncpy(lower_text, yytext, NAMEDATALEN-1);
483+
for(i =0; lower_text[i]; i++)
484+
if (isascii((unsignedchar)lower_text[i]) &&isupper(lower_text[i]))
485+
lower_text[i] =tolower(lower_text[i]);
485486

486-
keyword =ScanKeywordLookup((char*)yytext);
487+
printf("yyt= %s, lt = %s\n", yytext, lower_text);
488+
keyword =ScanKeywordLookup((char*)lower_text);
487489
if (keyword !=NULL) {
488490
return keyword->value;
489491
}
490492
else
491493
{
492-
keyword =ScanECPGKeywordLookup((char*)yytext);
494+
keyword =ScanECPGKeywordLookup((char*)lower_text);
493495
if (keyword !=NULL) {
494496
return keyword->value;
495497
}

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ output_statement(char * stmt, int mode)
521521
/* special embedded SQL token*/
522522
%tokenSQL_BREAKSQL_CALLSQL_CONNECTSQL_CONNECTIONSQL_CONTINUE
523523
%tokenSQL_DISCONNECTSQL_FOUNDSQL_GOSQL_GOTO
524-
%tokenSQL_IDENTIFIEDSQL_IMMEDIATESQL_INDICATORSQL_OPENSQL_RELEASE
524+
%tokenSQL_IDENTIFIEDSQL_IMMEDIATESQL_INDICATORSQL_OPEN
525+
%tokenSQL_PREPARESQL_RELEASE
525526
%tokenSQL_SECTIONSQL_SEMISQL_SQLERRORSQL_SQLPRINTSQL_START
526527
%tokenSQL_STOPSQL_WHENEVERSQL_SQLWARNING
527528

@@ -813,6 +814,9 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
813814
output_line_number();
814815
free($1);
815816
}
817+
|ECPGPrepare{
818+
yyerror("PREPARE is not supported yet.");
819+
}
816820

817821
/*
818822
* We start with a lot of stuff that's very similar to the backend's parsing
@@ -4671,12 +4675,12 @@ action : SQL_CONTINUE {
46714675
}
46724676
|SQL_GOTOname {
46734677
$<action>$.code = W_GOTO;
4674-
$<action>$.command =$2;
4678+
$<action>$.command =strdup($2);
46754679
$<action>$.str = cat2_str(make1_str("goto"),$2);
46764680
}
46774681
|SQL_GOTOname {
46784682
$<action>$.code = W_GOTO;
4679-
$<action>$.command =$3;
4683+
$<action>$.command =strdup($3);
46804684
$<action>$.str = cat2_str(make1_str("goto"),$3);
46814685
}
46824686
|DOname'('dotext')' {
@@ -4695,8 +4699,15 @@ action : SQL_CONTINUE {
46954699
$<action>$.str = cat2_str(make1_str("call"), mm_strdup($<action>$.command));
46964700
}
46974701

4698-
/* some other stuff for ecpg*/
4702+
/*
4703+
* As long as the prepare statement in not supported by the backend, we will
4704+
* try to simulate it here so we get dynamic SQL
4705+
*/
4706+
ECPGPrepare:SQL_PREPAREnameFROMname
4707+
{
4708+
}
46994709

4710+
/* some other stuff for ecpg*/
47004711
ecpg_expr:attropt_indirection
47014712
{
47024713
$$ = cat2_str($1,$2);
@@ -5032,6 +5043,7 @@ c_anything: IDENT { $$ = $1; }
50325043
|S_CHAR{$$ = make1_str("char"); }
50335044
|S_CONST{$$ = make1_str("const"); }
50345045
|S_DOUBLE{$$ = make1_str("double"); }
5046+
|S_ENUM{$$ = make1_str("enum"); }
50355047
|S_EXTERN{$$ = make1_str("extern"); }
50365048
|S_FLOAT{$$ = make1_str("float"); }
50375049
|S_INT{$$ = make1_str("int"); }

‎src/interfaces/ecpg/test/header_test.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
execsqlincludesqlca;
22

3-
execsqlwheneversqlerrordoprint_and_stop();
3+
execsqlwheneversqlerrordoPrintAndStop();
44
execsqlwheneversqlwarningdowarn();
55

6-
voidprint_and_stop(void)
6+
voidPrintAndStop(void)
77
{
88
sqlprint();
99
exit(-1);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp