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

Commit3a33537

Browse files
author
Michael Meskes
committed
- Synced parser and keyword file.
- More work on Informix compatibility.
1 parentaa874ee commit3a33537

File tree

10 files changed

+142
-97
lines changed

10 files changed

+142
-97
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,5 +1332,12 @@ Thu Feb 13 14:06:28 CET 2003
13321332
- Started working on an Informix compatibility mode. With option "-C
13331333
INFORMIX" set, ecpg now accepts "$" as alias for "exec sql" and to
13341334
denote variables inside SQL statements.
1335+
1336+
1337+
Fri Feb 14 14:14:25 CET 2003
1338+
1339+
- Synced parser and keyword file.
1340+
- More work on Informix compatibility.
13351341
- Set ecpg version to 2.12.0.
1342+
- Set library to 3.4.2.
13361343

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* This file contains stuff needed to be as compatible to Informix as possible.
3+
*/
4+
5+
#defineSQLNOTFOUND 100
6+

‎src/interfaces/ecpg/lib/error.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.18 2003/02/13 18:13:22 tgl Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.19 2003/02/1413:17:13 meskes Exp $ */
22

33
#include"postgres_fe.h"
44

@@ -14,7 +14,6 @@
1414
* the last back-end operation. */
1515
staticchar*ECPGerr;
1616

17-
1817
void
1918
ECPGraise(intline,intcode,constchar*str)
2019
{

‎src/interfaces/ecpg/lib/extern.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
/* Here are some methods used by the lib. */
88

9+
/* Stores the backend error message for client access */
10+
voidset_backend_err(constchar*err,intlineon);
11+
912
/* Store and retrieve the backend error message for client access */
1013
voidset_backend_err(constchar*err,intlineon);
1114
char*ECPGerrmsg(void);

‎src/interfaces/ecpg/preproc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.89 2002/12/04 18:14:11 momjian Exp $
1+
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.90 2003/02/14 13:17:13 meskes Exp $
22

33
subdir = src/interfaces/ecpg/preproc
44
top_builddir = ../../../..
55
include$(top_builddir)/src/Makefile.global
66

77
MAJOR_VERSION=2
8-
MINOR_VERSION=11
8+
MINOR_VERSION=12
99
PATCHLEVEL=0
1010

1111
overrideCPPFLAGS := -I$(srcdir)/../include -I$(srcdir)$(CPPFLAGS)\

‎src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.59 2003/02/13 13:11:52 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.60 2003/02/14 13:17:13 meskes Exp $ */
22

33
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
44
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -315,6 +315,10 @@ main(int argc, char *const argv[])
315315
/* we need several includes */
316316
fprintf(yyout,"/* Processed by ecpg (%d.%d.%d) */\n/* These four include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n#line 1 \"%s\"\n",MAJOR_VERSION,MINOR_VERSION,PATCHLEVEL,input_filename);
317317

318+
/* add some compatibility headers */
319+
if (compat==ECPG_COMPAT_INFORMIX)
320+
fprintf(yyout,"/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
321+
318322
/* and parse the source */
319323
yyparse();
320324

‎src/interfaces/ecpg/preproc/keywords.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.55 2002/10/21 13:09:31 meskes Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.56 2003/02/14 13:17:13 meskes Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -28,7 +28,7 @@
2828
*/
2929
staticScanKeywordScanKeywords[]= {
3030
/* name, value */
31-
{"abort",ABORT_TRANS},
31+
{"abort",ABORT_P},
3232
{"absolute",ABSOLUTE},
3333
{"access",ACCESS},
3434
{"action",ACTION},
@@ -49,7 +49,7 @@ static ScanKeyword ScanKeywords[] = {
4949
{"authorization",AUTHORIZATION},
5050
{"backward",BACKWARD},
5151
{"before",BEFORE},
52-
{"begin",BEGIN_TRANS},
52+
{"begin",BEGIN_P},
5353
{"between",BETWEEN},
5454
{"bigint",BIGINT},
5555
{"binary",BINARY},
@@ -115,7 +115,7 @@ static ScanKeyword ScanKeywords[] = {
115115
{"else",ELSE},
116116
{"encoding",ENCODING},
117117
{"encrypted",ENCRYPTED},
118-
{"end",END_TRANS},
118+
{"end",END_P},
119119
{"escape",ESCAPE},
120120
{"except",EXCEPT},
121121
{"exclusive",EXCLUSIVE},
@@ -226,6 +226,7 @@ static ScanKeyword ScanKeywords[] = {
226226
{"position",POSITION},
227227
{"precision",PRECISION},
228228
{"prepare",PREPARE},
229+
{"preserve",PRESERVE},
229230
{"primary",PRIMARY},
230231
{"prior",PRIOR},
231232
{"privileges",PRIVILEGES},
@@ -246,6 +247,7 @@ static ScanKeyword ScanKeywords[] = {
246247
{"right",RIGHT},
247248
{"rollback",ROLLBACK},
248249
{"row",ROW},
250+
{"rows",ROWS},
249251
{"rule",RULE},
250252
{"schema",SCHEMA},
251253
{"scroll",SCROLL},

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

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.103 2003/02/13 20:37:28 meskes Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.104 2003/02/14 13:17:13 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -423,7 +423,6 @@ cppline{space}*#(.*\\{space})*.*
423423
/* are we simulating Informix? */
424424
if (compat == ECPG_COMPAT_INFORMIX)
425425
{
426-
printf ("unput $\n");
427426
unput(':');
428427
}
429428
else
@@ -560,6 +559,12 @@ cppline{space}*#(.*\\{space})*.*
560559
if (keyword !=NULL)
561560
return keyword->value;
562561

562+
/* Is it a C keyword? */
563+
keyword =ScanCKeywordLookup(yytext);
564+
if (keyword !=NULL)
565+
return keyword->value;
566+
567+
563568
/* How about a DEFINE? */
564569
for (ptr = defines; ptr; ptr = ptr->next)
565570
{
@@ -697,6 +702,7 @@ cppline{space}*#(.*\\{space})*.*
697702

698703
<C>{exec_sql}{define}{space}*{BEGIN(def_ident); }
699704
<C>{exec_sql}{include}{space}*{BEGIN(incl); }
705+
<C>{informix_special}{include}{space}*{BEGIN(incl); }
700706

701707
<C,xskip>{exec_sql}{ifdef}{space}*{ ifcond =TRUE;BEGIN(xcond); }
702708
<C,xskip>{exec_sql}{ifndef}{space}* { ifcond =FALSE;BEGIN(xcond); }
@@ -832,32 +838,45 @@ cppline{space}*#(.*\\{space})*.*
832838
i-- )
833839
{}
834840

835-
/* Remove trailing '"' if it exists */
836-
if (yytext[i] =='"')
837-
yytext[i] ='\0';
838-
else
839-
yytext[i+1] ='\0';
841+
yytext[i+1] ='\0';
842+
yyin =NULL;
840843

841-
/* also remove starting '"' */
842-
if (yytext[0] =='"')
844+
/* If file name is enclosed in '"' remove these and look only in '.' */
845+
if (yytext[0] =='"' && yytext[i] =='"')
846+
{
847+
yytext[i] ='\0';
843848
memmove(yytext, yytext+1,strlen(yytext));
844-
845-
yyin =NULL;
846-
for (ip = include_paths; yyin ==NULL && ip !=NULL; ip = ip->next)
847-
{
848-
if (strlen(ip->path) +strlen(yytext) +3 > MAXPGPATH)
849-
{
850-
fprintf(stderr,"Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno);
851-
continue;
852-
}
853-
snprintf (inc_file,sizeof(inc_file),"%s/%s", ip->path, yytext);
854-
yyin =fopen( inc_file,"r" );
849+
850+
strncpy(inc_file, yytext,sizeof(inc_file));
851+
yyin =fopen(inc_file,"r");
855852
if (!yyin)
856853
{
857854
if (strcmp(inc_file +strlen(inc_file) -2,".h"))
858855
{
859856
strcat(inc_file,".h");
860-
yyin =fopen( inc_file,"r" );
857+
yyin =fopen(inc_file,"r");
858+
}
859+
}
860+
861+
}
862+
else
863+
{
864+
for (ip = include_paths; yyin ==NULL && ip !=NULL; ip = ip->next)
865+
{
866+
if (strlen(ip->path) +strlen(yytext) +3 > MAXPGPATH)
867+
{
868+
fprintf(stderr,"Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno);
869+
continue;
870+
}
871+
snprintf (inc_file,sizeof(inc_file),"%s/%s", ip->path, yytext);
872+
yyin =fopen(inc_file,"r");
873+
if (!yyin)
874+
{
875+
if (strcmp(inc_file +strlen(inc_file) -2,".h"))
876+
{
877+
strcat(inc_file,".h");
878+
yyin =fopen( inc_file,"r" );
879+
}
861880
}
862881
}
863882
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp