Skip to content

Commit 7500a96

Browse files
committed
From: Michael Meskes <meskes@topsystem.de>
+ Thu Apr 23 09:27:16 CEST 1998 + + - Also allow call in whenever statement with the same functionality + as do. + + Thu Apr 23 12:29:28 CEST 1998 + + - Also rewrote variable declaration part. It is now possible to + declare more than one variable per line. + - Set version to 2.1.0 + + Fri Apr 24 13:50:15 CEST 1998 + + - Fixed some bugs. + - Set version to 2.1.1
1 parent f2b64d3 commit 7500a96

File tree

13 files changed

+347
-264
lines changed

13 files changed

+347
-264
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,24 @@ Mon Apr 20 16:13:25 CEST 1998
121121
Mon Apr 20 16:39:23 CEST 1998
122122

123123
- Cursor is opened when the open command is issued, not at declare time.
124+
- Set version to 2.0.0
124125

125126
Tue Apr 21 12:53:49 CEST 1998
126127

127128
- Set indicator to amount of data really written (truncation).
128129

130+
Thu Apr 23 09:27:16 CEST 1998
131+
132+
- Also allow call in whenever statement with the same functionality
133+
as do.
134+
135+
Thu Apr 23 12:29:28 CEST 1998
136+
137+
- Also rewrote variable declaration part. It is now possible to
138+
declare more than one variable per line.
139+
- Set version to 2.1.0
140+
141+
Fri Apr 24 13:50:15 CEST 1998
142+
143+
- Fixed some bugs.
144+
- Set version to 2.1.1

src/interfaces/ecpg/TODO

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ There is no exec sql prepare statement.
3535
The complete structure definition has to be listed inside the declare
3636
section for ecpg to be able to understand it.
3737

38-
Each variable has to be defined on a line on its own.
39-
4038
There is no way yet to fill a complete array with one call except arrays of
4139
[unsigned] char which are considered strings.
4240

@@ -54,4 +52,7 @@ exec sql disconnect {current|default|all|connectionname|connection_hostvar};
5452
| CURRENT
5553
commit release|commit work release auch disconnect
5654

57-
It is not neccessary to check for sql not found after all commands.
55+
It is not neccessary to check for "not found" after all commands.
56+
57+
It would be nice to be able to specify parts of a structure like :foo.bar or
58+
:foo->bar.

src/interfaces/ecpg/lib/Makefile.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ ifeq ($(PORTNAME), linux)
2121
install-shlib-dep := install-shlib
2222
shlib := libecpg.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
2323
LDFLAGS_SL = -shared -soname libecpg.so.$(SO_MAJOR_VERSION)
24-
CFLAGS += $(CFLAGS_SL)
2524
endif
2625
endif
2726
ifeq ($(PORTNAME), bsd)
@@ -47,12 +46,12 @@ endif
4746

4847
all: libecpg.a $(shlib)
4948

50-
$(shlib): ecpglib.o typename.o
51-
$(LD) $(LDFLAGS_SL) -o $@ ecpglib.o typename.o
49+
$(shlib): ecpglib.sho typename.sho
50+
$(LD) $(LDFLAGS_SL) -o $@ ecpglib.sho typename.sho
5251
ln -sf $@ libecpg.so
5352

5453
clean:
55-
rm -f *.o *.a core a.out *~ $(shlib) libecpg.so
54+
rm -f *.o *.sho *.a core a.out *~ $(shlib) libecpg.so
5655

5756
dep depend:
5857

@@ -70,6 +69,11 @@ uninstall::
7069
libecpg.a : libecpg.a(ecpglib.o) libecpg.a(typename.o)
7170

7271
ecpglib.o : ecpglib.c ../include/ecpglib.h ../include/ecpgtype.h
73-
$(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c ecpglib.c
72+
$(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c $< -o $@
7473
typename.o : typename.c ../include/ecpgtype.h
75-
$(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c typename.c
74+
$(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c $< -o $@
75+
76+
ecpglib.sho : ecpglib.c ../include/ecpglib.h ../include/ecpgtype.h
77+
$(CC) $(CFLAGS) $(CFLAGS_SL) -I../include $(PQ_INCLUDE) -c $< -o $@
78+
typename.sho : typename.c ../include/ecpgtype.h
79+
$(CC) $(CFLAGS) $(CFLAGS_SL) -I../include $(PQ_INCLUDE) -c $< -o $@

src/interfaces/ecpg/preproc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ SRCDIR= ../../..
22
include $(SRCDIR)/Makefile.global
33

44
MAJOR_VERSION=2
5-
MINOR_VERSION=0
6-
PATCHLEVEL=0
5+
MINOR_VERSION=1
6+
PATCHLEVEL=1
77

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

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static void
2727
usage(char *progname)
2828
{
2929
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
30-
fprintf(stderr, "Usage: %s: [-v] [-d] [-I include path] [ -o output file name] file1 [file2] ...\n", progname);
30+
fprintf(stderr, "Usage: %s: [-v] [-I include path] [ -o output file name] file1 [file2] ...\n", progname);
3131
}
3232

3333
static void
@@ -51,7 +51,7 @@ main(int argc, char *const argv[])
5151
add_include_path("/usr/local/include");
5252
add_include_path(".");
5353

54-
while ((c = getopt(argc, argv, "vdo:I:")) != EOF)
54+
while ((c = getopt(argc, argv, "vo:I:")) != EOF)
5555
{
5656
switch (c)
5757
{
@@ -62,9 +62,6 @@ main(int argc, char *const argv[])
6262
else
6363
out_option = 1;
6464
break;
65-
case 'd':
66-
debugging = 1;
67-
break;
6865
case 'I':
6966
add_include_path(optarg);
7067
break;

src/interfaces/ecpg/preproc/ecpg_keywords.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222
static ScanKeyword ScanKeywords[] = {
2323
/* name value */
24+
{"call", SQL_CALL},
2425
{"connect", SQL_CONNECT},
2526
{"continue", SQL_CONTINUE},
2627
{"found", SQL_FOUND},

src/interfaces/ecpg/preproc/extern.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
/* variables */
44

5-
extern int debugging,
6-
braces_open;
5+
extern int braces_open;
76
extern char *yytext;
87
extern int yylineno,
98
yyleng;
@@ -23,6 +22,18 @@ struct cursor { char *name;
2322

2423
extern struct cursor *cur;
2524

25+
/* This is a linked list of the variable names and types. */
26+
struct variable
27+
{
28+
char * name;
29+
struct ECPGtype * type;
30+
int brace_level;
31+
struct variable * next;
32+
};
33+
34+
extern struct ECPGtype ecpg_no_indicator;
35+
extern struct variable no_indicator;
36+
2637
/* functions */
2738

2839
extern void lex_init(void);

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct _yy_buffer { YY_BUFFER_STATE buffer;
7070
%x xb
7171
%x xc
7272
%x xd
73+
%x xdc
7374
%x xh
7475
%x xm
7576
%x xq
@@ -261,15 +262,30 @@ sql [sS][qQ][lL]
261262
<xd>{xdstop} {
262263
BEGIN(SQL);
263264
yylval.str = strdup(literal);
264-
return (IDENT);
265+
return (CSTRING);
265266
}
266267
<xd>{xdinside} {
267268
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
268269
yyerror("ERROR: quoted string parse buffer exceeded");
269270
memcpy(literal+llen, yytext, yyleng+1);
270271
llen += yyleng;
271272
}
272-
273+
<C>{xdstart} {
274+
BEGIN(xdc);
275+
llen = 0;
276+
*literal = '\0';
277+
}
278+
<xdc>{xdstop} {
279+
BEGIN(C);
280+
yylval.str = strdup(literal);
281+
return (CSTRING);
282+
}
283+
<xdc>{xdinside} {
284+
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
285+
yyerror("ERROR: quoted string parse buffer exceeded");
286+
memcpy(literal+llen, yytext, yyleng+1);
287+
llen += yyleng;
288+
}
273289

274290
<xm>{space}* { /* ignore */ }
275291
<xm>{xmstop} {
@@ -283,7 +299,7 @@ sql [sS][qQ][lL]
283299
<SQL>{self}/-[\.0-9] {
284300
return (yytext[0]);
285301
}
286-
<SQL>{self} { return (yytext[0]); }
302+
<SQL>{self} { return (yytext[0]); }
287303
<SQL>{operator}/-[\.0-9] {
288304
yylval.str = strdup((char*)yytext);
289305
return (Op);
@@ -379,6 +395,10 @@ sql [sS][qQ][lL]
379395
return (FCONST);
380396
}
381397

398+
<SQL>:{identifier} {
399+
yylval.str = strdup((char*)yytext+1);
400+
return(CVARIABLE);
401+
}
382402
<SQL>{identifier} {
383403
int i;
384404
ScanKeyword *keyword;
@@ -423,12 +443,14 @@ sql [sS][qQ][lL]
423443
}
424444
}
425445
<C>";" { return(';'); }
446+
<C>"," { return(','); }
447+
<C>"*" { return('*'); }
426448
<C>{space} { ECHO; }
427-
\{ { return('{'); }
428-
\} { return('}'); }
429-
\[ { return('['); }
430-
\] { return(']'); }
431-
\= { return('='); }
449+
<C>\{ { return('{'); }
450+
<C>\} { return('}'); }
451+
<C>\[ { return('['); }
452+
<C>\] { return(']'); }
453+
<C>\= { return('='); }
432454
<C>{other} { return (S_ANYTHING); }
433455
<C>{exec}{space}{sql}{space}{include} { BEGIN(incl); }
434456
<incl>{space} /* eat the whitespace */

0 commit comments

Comments
 (0)