Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b53955f

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent dd979f6 commit b53955f

File tree

14 files changed

+277
-323
lines changed

14 files changed

+277
-323
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,5 +775,21 @@ Mon Jan 17 21:55:40 CET 2000
775775
- Synced preproc.y with gram.y.
776776
- Changed FETCH syntax using Rene's final patch. Made it more
777777
standard compliant.
778+
779+
Thu Jan 20 10:00:50 CET 2000
780+
781+
- Synced preproc.y with gram.y.
782+
783+
Fri Jan 21 14:52:27 CET 2000
784+
785+
- Added more log output to ecpglib.
786+
787+
Thu Jan 27 08:12:05 CET 2000
788+
789+
- Added another patch by Rene Hogendoorn.
790+
- Fixed error messages in pgc.l.
791+
- Improved variable parsing.
792+
- Synced preproc.y with gram.y.
778793
- Set library version to 3.0.10.
779794
- Set ecpg version to 2.7.0.
795+

src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
slightly modified)
1010
*/
1111

12-
/* Taken over as part of PostgreSQL by Michael Meskes <meskes@debian.org>
12+
/* Taken over as part of PostgreSQL by Michael Meskes <meskes@postgresql.org>
1313
on Feb. 5th, 1998 */
1414

1515
#include <stdio.h>
@@ -724,6 +724,9 @@ ECPGexecute(struct statement * stmt)
724724
*((void **) var->pointer) = var->value;
725725
add_mem(var->value, stmt->lineno);
726726
}
727+
728+
729+
ECPGlog("ECPGexecute line %d: TYPE db: %d c: %d\n", stmt->lineno, PQftype(results, act_field), var->type);
727730

728731
for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
729732
{
@@ -764,7 +767,7 @@ ECPGexecute(struct statement * stmt)
764767
status = false;
765768
break;
766769
}
767-
770+
768771
switch (var->type)
769772
{
770773
long res;

src/interfaces/ecpg/preproc/c_keywords.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,26 @@
1919
*/
2020
static ScanKeyword ScanKeywords[] = {
2121
/* name value */
22-
{"VARCHAR", S_VARCHAR},
22+
{"VARCHAR", VARCHAR},
2323
{"auto", S_AUTO},
24-
{"bool", S_BOOL},
25-
{"char", S_CHAR},
24+
{"bool", SQL_BOOL},
25+
{"char", CHAR},
2626
{"const", S_CONST},
27-
{"double", S_DOUBLE},
28-
{"enum", S_ENUM},
27+
{"double", DOUBLE},
28+
{"enum", SQL_ENUM},
2929
{"extern", S_EXTERN},
30-
{"float", S_FLOAT},
31-
{"int", S_INT},
32-
{"long", S_LONG},
30+
{"float", FLOAT},
31+
{"int", SQL_INT},
32+
{"long", SQL_LONG},
3333
{"register", S_REGISTER},
34-
{"short", S_SHORT},
35-
{"signed", S_SIGNED},
34+
{"short", SQL_SHORT},
35+
{"signed", SQL_SIGNED},
3636
{"static", S_STATIC},
37-
{"struct", S_STRUCT},
38-
{"union", S_UNION},
39-
{"unsigned", S_UNSIGNED},
40-
{"varchar", S_VARCHAR},
37+
{"struct", SQL_STRUCT},
38+
{"union", UNION},
39+
{"unsigned", SQL_UNSIGNED},
40+
{"varchar", VARCHAR},
41+
{"volatile", S_VOLATILE},
4142
};
4243

4344
ScanKeyword *

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
2-
/* (C) Michael Meskes <meskes@debian.org> Feb 5th, 1998 */
2+
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
33
/* Placed under the same copyright as PostgresSQL */
44

55
#include <unistd.h>

src/interfaces/ecpg/preproc/extern.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern int yylex(void);
4040
extern void yyerror(char *);
4141
extern void *mm_alloc(size_t), *mm_realloc(void *, size_t);
4242
extern char *mm_strdup(const char *);
43+
extern void mmerror(enum errortype, char * );
4344
ScanKeyword *ScanECPGKeywordLookup(char *);
4445
ScanKeyword *ScanCKeywordLookup(char *);
4546

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 18 additions & 11 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.49 2000/01/26 05:58:41 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.50 2000/01/27 19:00:39 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -246,7 +246,7 @@ cppline {space}*#(.*\\{line_end})*.*
246246
errno = 0;
247247
yylval.ival = strtol(literalbuf, &endptr, 2);
248248
if (*endptr != '\0' || errno == ERANGE)
249-
yyerror("ERROR: Bad binary integer input!");
249+
mmerror(ET_ERROR, "Bad binary integer input!");
250250
return ICONST;
251251
}
252252
<xh>{xhinside} |
@@ -268,7 +268,7 @@ cppline {space}*#(.*\\{line_end})*.*
268268
errno = 0;
269269
yylval.ival = strtol(literalbuf, &endptr, 16);
270270
if (*endptr != '\0' || errno == ERANGE)
271-
yyerror("ERROR: Bad hexadecimal integer input");
271+
mmerror(ET_ERROR, "Bad hexadecimal integer input");
272272
return ICONST;
273273
}
274274

@@ -355,7 +355,7 @@ cppline {space}*#(.*\\{line_end})*.*
355355
errno = 0;
356356
yylval.dval = strtod((char *)yytext,&endptr);
357357
if (*endptr != '\0' || errno == ERANGE)
358-
yyerror("ERROR: Bad float8 input");
358+
mmerror(ET_ERROR, "Bad float8 input");
359359
return FCONST;
360360
}
361361
yylval.str = mm_strdup((char*)yytext);
@@ -367,7 +367,7 @@ cppline {space}*#(.*\\{line_end})*.*
367367
errno = 0;
368368
yylval.dval = strtod((char *)yytext,&endptr);
369369
if (*endptr != '\0' || errno == ERANGE)
370-
yyerror("ERROR: Bad float input");
370+
mmerror(ET_ERROR, "Bad float input");
371371
return FCONST;
372372
}
373373
<SQL>:{identifier}(("->"|\.){identifier})* {
@@ -385,6 +385,13 @@ cppline {space}*#(.*\\{line_end})*.*
385385
if (isascii((unsigned char)lower_text[i]) && isupper(lower_text[i]))
386386
lower_text[i] = tolower(lower_text[i]);
387387

388+
if (i >= NAMEDATALEN)
389+
{
390+
sprintf(errortext, "Identifier \"%s\" will be truncated to \"%.*s\"", yytext, NAMEDATALEN-1, yytext);
391+
mmerror (ET_WARN, errortext);
392+
yytext[NAMEDATALEN-1] = '\0';
393+
}
394+
388395
keyword = ScanKeywordLookup((char*)lower_text);
389396
if (keyword != NULL) {
390397
return keyword->value;
@@ -509,10 +516,10 @@ cppline {space}*#(.*\\{line_end})*.*
509516

510517
<C,xskip>{exec_sql}{elif}{space_or_nl}* { /* pop stack */
511518
if ( preproc_tos == 0 ) {
512-
yyerror("ERROR: missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
519+
mmerror(ET_FATAL, "Missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
513520
}
514521
else if ( stacked_if_value[preproc_tos].else_branch ) {
515-
yyerror("ERROR: missing 'EXEC SQL ENDIF;'");
522+
mmerror(ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
516523
}
517524
else {
518525
preproc_tos--;
@@ -523,7 +530,7 @@ cppline {space}*#(.*\\{line_end})*.*
523530

524531
<C,xskip>{exec_sql}{else}{space_or_nl}*";" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */
525532
if ( stacked_if_value[preproc_tos].else_branch ) {
526-
yyerror("ERROR: duplicated 'EXEC SQL ELSE;'");
533+
mmerror(ET_FATAL, "Duplicated 'EXEC SQL ELSE;'");
527534
}
528535
else {
529536
stacked_if_value[preproc_tos].else_branch = TRUE;
@@ -541,7 +548,7 @@ cppline {space}*#(.*\\{line_end})*.*
541548
}
542549
<C,xskip>{exec_sql}{endif}{space_or_nl}*";" {
543550
if ( preproc_tos == 0 ) {
544-
yyerror("ERROR: unmatched 'EXEC SQL ENDIF;'");
551+
mmerror(ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");
545552
}
546553
else {
547554
preproc_tos--;
@@ -559,7 +566,7 @@ cppline {space}*#(.*\\{line_end})*.*
559566

560567
<xcond>{identifier}{space_or_nl}*";" {
561568
if ( preproc_tos >= MAX_NESTED_IF-1 ) {
562-
yyerror("ERROR: too many nested 'EXEC SQL IFDEF' conditions");
569+
mmerror(ET_FATAL, "Too many nested 'EXEC SQL IFDEF' conditions");
563570
}
564571
else {
565572
struct _defines *defptr;
@@ -680,7 +687,7 @@ cppline {space}*#(.*\\{line_end})*.*
680687
if ( preproc_tos > 0 ) {
681688
preproc_tos = 0;
682689

683-
yyerror("ERROR: missing 'EXEC SQL ENDIF;'");
690+
mmerror(ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
684691
}
685692

686693
if (yy_buffer == NULL)

0 commit comments

Comments
 (0)