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

Commitbf395e8

Browse files
committed
From: Michael Meskes <meskes@usa.net>+ Mon Aug 31 09:40:04 CEST 1998++ - Minor patch to Makefile+ - Put pgc.l in sync with scan.l++ Tue Sep 1 11:31:05 CEST 1998++ - Fixed another bug in preproc.y++ Thu Sep 3 12:21:16 CEST 1998++ - Sync preproc.y with gram.y++ Mon Sep 14 09:21:02 CEST 1998++ - Sync preproc.y with gram.y yet again++ Thu Sep 17 08:55:33 CEST 1998++ - Synced preproc.y and gram.y one more time++ Thu Sep 17 19:23:24 CEST 1998++ - Added missing ´;´ in preproc.y+ - Set version to 2.4.2
1 parent25a64f7 commitbf395e8

File tree

5 files changed

+138
-23
lines changed

5 files changed

+138
-23
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,29 @@ Fri Aug 28 15:36:58 CEST 1998
311311
- Removed one line of code that AIX complains about since it was not
312312
needed anyway
313313
- Set library version to 2.6.1
314+
315+
Mon Aug 31 09:40:04 CEST 1998
316+
317+
- Minor patch to Makefile
318+
- Put pgc.l in sync with scan.l
319+
320+
Tue Sep 1 11:31:05 CEST 1998
321+
322+
- Fixed another bug in preproc.y
323+
324+
Thu Sep 3 12:21:16 CEST 1998
325+
326+
- Sync preproc.y with gram.y
327+
328+
Mon Sep 14 09:21:02 CEST 1998
329+
330+
- Sync preproc.y with gram.y yet again
331+
332+
Thu Sep 17 08:55:33 CEST 1998
333+
334+
- Synced preproc.y and gram.y one more time
335+
336+
Thu Sep 17 19:23:24 CEST 1998
337+
338+
- Added missing �;� in preproc.y
339+
- Set version to 2.4.2

‎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=1
6+
PATCHLEVEL=2
77

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.4 1998/09/01 03:28:41 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.5 1998/09/21 05:52:53 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -150,6 +150,7 @@ static ScanKeyword ScanKeywords[] = {
150150
{"notnull",NOTNULL},
151151
{"null",NULL_P},
152152
{"numeric",NUMERIC},
153+
{"of",OF},
153154
{"oids",OIDS},
154155
{"on",ON},
155156
{"operator",OPERATOR},

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ cppline{space}*#.*(\\{space}*\n)*\n*
340340
if (isascii((unsignedchar)yytext[i]) &&isupper(yytext[i]))
341341
yytext[i] =tolower(yytext[i]);
342342

343+
if (i >= NAMEDATALEN)
344+
yytext[NAMEDATALEN-1] ='\0';
345+
343346
keyword =ScanKeywordLookup((char*)yytext);
344347
if (keyword !=NULL) {
345348
return keyword->value;
@@ -478,6 +481,9 @@ cppline{space}*#.*(\\{space}*\n)*\n*
478481
if (isascii((unsignedchar)yytext[i]) &&isupper(yytext[i]))
479482
yytext[i] =tolower(yytext[i]);
480483

484+
if (i >= NAMEDATALEN)
485+
yytext[NAMEDATALEN-1] ='\0';
486+
481487
keyword =ScanKeywordLookup((char*)yytext);
482488
if (keyword !=NULL) {
483489
return keyword->value;

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

Lines changed: 103 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ output_statement(char * stmt, int mode)
528528
%tokenTYPECAST
529529

530530
/* Keywords (in SQL92 reserved words)*/
531-
%tokenACTION,ADD,ALL,ALTER,AND,ANYAS,ASC,
531+
%tokenABSOLUTE,ACTION,ADD,ALL,ALTER,AND,ANYAS,ASC,
532532
BEGIN_TRANS,BETWEEN,BOTH,BY,
533533
CASCADE,CAST,CHAR,CHARACTER,CHECK,CLOSE,COLLATE,COLUMN,COMMIT,
534534
CONSTRAINT,CREATE,CROSS,CURRENT,CURRENT_DATE,CURRENT_TIME,
@@ -537,14 +537,14 @@ output_statement(char * stmt, int mode)
537537
END_TRANS,EXECUTE,EXISTS,EXTRACT,
538538
FETCH,FLOAT,FOR,FOREIGN,FROM,FULL,
539539
GRANT,GROUP,HAVING,HOUR_P,
540-
IN,INNER_P,INSERT,INTERVAL,INTO,IS,
540+
IN,INNER_P,INSENSITIVE,INSERT,INTERVAL,INTO,IS,
541541
JOIN,KEY,LANGUAGE,LEADING,LEFT,LIKE,LOCAL,
542542
MATCH,MINUTE_P,MONTH_P,NAMES,
543-
NATIONAL,NATURAL,NCHAR,NO,NOT,NOTIFY,NULL_P,NUMERIC,
544-
ON,OPTION,OR,ORDER,OUTER_P,
545-
PARTIAL,POSITION,PRECISION,PRIMARY,PRIVILEGES,PROCEDURE,PUBLIC,
546-
REFERENCES,REVOKE,RIGHT,ROLLBACK,
547-
SECOND_P,SELECT,SET,SUBSTRING,
543+
NATIONAL,NATURAL,NCHAR,NEXT,NO,NOT,NOTIFY,NULL_P,NUMERIC,
544+
OF,ON,ONLY,OPTION,OR,ORDER,OUTER_P,
545+
PARTIAL,POSITION,PRECISION,PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,
546+
READ,REFERENCES,RELATIVE,REVOKE,RIGHT,ROLLBACK,
547+
SCROLL,SECOND_P,SELECT,SET,SUBSTRING,
548548
TABLE,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,
549549
TO,TRAILING,TRANSACTION,TRIM,
550550
UNION,UNIQUE,UPDATE,USER,USING,
@@ -620,7 +620,7 @@ output_statement(char * stmt, int mode)
620620
%type<str>ColIddefault_exprColQualifiercolumnDefColQualList
621621
%type<str>ColConstraintColConstraintElemdefault_listNumericOnlyFloatOnly
622622
%type<str>OptTableElementListOptTableElementTableConstraint
623-
%type<str>ConstraintElemkey_actionsconstraint_list
623+
%type<str>ConstraintElemkey_actionsconstraint_listColPrimaryKey
624624
%type<str>res_target_listres_target_elres_target_list2
625625
%type<str>res_target_el2opt_idrelation_namedatabase_name
626626
%type<str>access_methodattr_nameclassindex_namenamefunc_name
@@ -667,6 +667,7 @@ output_statement(char * stmt, int mode)
667667
%type<str>ViewStmtLoadStmtCreatedbStmtopt_database1opt_database2location
668668
%type<str>DestroydbStmtClusterStmtgranteeRevokeStmtencoding
669669
%type<str>GrantStmtprivilegesoperation_commalistoperation
670+
%type<str>cursor_clause,opt_cursor,opt_readonly,opt_of
670671

671672
%type<str>ECPGWheneverECPGConnectconnection_targetECPGOpenopen_opts
672673
%type<str>indicatorECPGExecuteecpg_exprdotext
@@ -1083,9 +1084,9 @@ columnDef: ColId Typename ColQualifier
10831084
{
10841085
$$ = cat3_str($1,$2,$3);
10851086
}
1086-
|ColIdSERIAL
1087+
|ColIdSERIALColPrimaryKey
10871088
{
1088-
$$ =make2_str($1, make1_str(" serial"));
1089+
$$ =make3_str($1, make1_str(" serial"),$3);
10891090
}
10901091
;
10911092

@@ -1097,6 +1098,16 @@ ColQualList: ColQualList ColConstraint{ $$ = cat2_str($1,$2); }
10971098
|ColConstraint{$$ =$1; }
10981099
;
10991100

1101+
ColPrimaryKey:PRIMARYKEY
1102+
{
1103+
$$ = make1_str("primary key");
1104+
}
1105+
|/*EMPTY*/
1106+
{
1107+
$$ = make1_str("");
1108+
}
1109+
;
1110+
11001111
ColConstraint:
11011112
CONSTRAINTnameColConstraintElem
11021113
{
@@ -1106,10 +1117,29 @@ ColConstraint:
11061117
{$$ =$1; }
11071118
;
11081119

1120+
/* The column constraint WITH NULL gives a shift/reduce error
1121+
* because it requires yacc to look more than one token ahead to
1122+
* resolve WITH TIME ZONE and WITH NULL.
1123+
* So, leave it out of the syntax for now.
1124+
| WITH NULL_P
1125+
{
1126+
$$ = NULL;
1127+
}
1128+
* - thomas 1998-09-12
1129+
*
1130+
* DEFAULT NULL is already the default for Postgres.
1131+
* Bue define it here and carry it forward into the system
1132+
* to make it explicit.
1133+
* - thomas 1998-09-13
1134+
*/
11091135
ColConstraintElem:CHECK'('constraint_expr')'
11101136
{
11111137
$$ = make3_str(make1_str("check("),$3, make1_str(")"));
11121138
}
1139+
|DEFAULTNULL_P
1140+
{
1141+
$$ = make1_str("default null");
1142+
}
11131143
|DEFAULTdefault_expr
11141144
{
11151145
$$ = cat2_str(make1_str("default"),$2);
@@ -1143,10 +1173,16 @@ default_list: default_list ',' default_expr
11431173
}
11441174
;
11451175

1176+
/* The Postgres default column value is NULL.
1177+
* Rather than carrying DEFAULT NULL forward as a clause,
1178+
* let's just have it be a no-op.
1179+
| NULL_P
1180+
{$$ = make1_str("null"); }
1181+
* - thomas 1998-09-13
1182+
*/
1183+
11461184
default_expr:AexprConst
11471185
{$$ =$1; }
1148-
|NULL_P
1149-
{$$ = make1_str("null"); }
11501186
|'-'default_expr %precUMINUS
11511187
{$$ = cat2_str(make1_str("-"),$2); }
11521188
|default_expr'+'default_expr
@@ -1559,7 +1595,7 @@ TriggerForType: ROW{ $$ = make1_str("row"); }
15591595
;
15601596

15611597
TriggerFuncArgs:TriggerFuncArg
1562-
{$$ =$1 }
1598+
{$$ =$1; }
15631599
|TriggerFuncArgs','TriggerFuncArg
15641600
{$$ = cat3_str($1, make1_str(","),$3); }
15651601
|/*EMPTY*/
@@ -1667,12 +1703,17 @@ DestroyStmt: DROP TABLE relation_name_list
16671703
/*****************************************************************************
16681704
*
16691705
*QUERY:
1670-
*fetch/move [forward | backward] [number | all ] [ in <portalname> ]
1706+
* fetch/move [forward | backward] [ # | all ] [ in <portalname> ]
1707+
* fetch [ forward | backward | absolute | relative ]
1708+
* [ # | all | next | prior ] [ [ in | from ] <portalname> ]
16711709
*
16721710
*****************************************************************************/
16731711

16741712
FetchStmt:FETCHopt_directionfetch_how_manyopt_portal_nameINTOinto_list
16751713
{
1714+
if (strncmp($2,"relative", strlen("relative")) ==0 && atol($3) ==0L)
1715+
yyerror("FETCH/RELATIVE at current position is not supported");
1716+
16761717
$$ = cat4_str(make1_str("fetch"),$2,$3,$4);
16771718
}
16781719
|MOVEopt_directionfetch_how_manyopt_portal_name
@@ -1683,18 +1724,26 @@ FetchStmt:FETCH opt_direction fetch_how_many opt_portal_name INTO into_list
16831724

16841725
opt_direction:FORWARD{$$ = make1_str("forward"); }
16851726
|BACKWARD{$$ = make1_str("backward"); }
1727+
|RELATIVE {$$ = make1_str("relative"); }
1728+
|ABSOLUTE
1729+
{
1730+
fprintf(stderr,"FETCH/ABSOLUTE not supported, using RELATIVE");
1731+
$$ = make1_str("absolute");
1732+
}
16861733
|/*EMPTY*/{$$ = make1_str("");/* default*/ }
16871734
;
16881735

1689-
fetch_how_many:Iconst
1690-
{$$ =$1;
1691-
if (atol($1) <=0)yyerror("Please specify nonnegative count for fetch"); }
1736+
fetch_how_many:Iconst {$$ =$1; }
1737+
|'-'Iconst {$$ = make2_str(make1_str("-"),$2); }
16921738
|ALL{$$ = make1_str("all"); }
1739+
|NEXT{$$ = make1_str("next"); }
1740+
|PRIOR{$$ = make1_str("prior"); }
16931741
|/*EMPTY*/{$$ = make1_str("");/*default*/ }
16941742
;
16951743

16961744
opt_portal_name:INname{$$ = cat2_str(make1_str("in"),$2); }
1697-
|name{$$ = cat2_str(make1_str("in"),$1); }
1745+
|FROMname{$$ = cat2_str(make1_str("from"),$2); }
1746+
/*| name{ $$ = cat2_str(make1_str("in"), $1);*/
16981747
|/*EMPTY*/{$$ = make1_str(""); }
16991748
;
17001749

@@ -2328,6 +2377,10 @@ insert_rest: VALUES '(' res_target_list2 ')'
23282377
{
23292378
$$ = make3_str(make1_str("values("),$3, make1_str(")"));
23302379
}
2380+
|DEFAULTVALUES
2381+
{
2382+
$$ = make1_str("default values");
2383+
}
23312384
|SELECTopt_uniqueres_target_list2
23322385
from_clausewhere_clause
23332386
group_clausehaving_clause
@@ -2404,11 +2457,12 @@ UpdateStmt: UPDATE relation_name
24042457
*CURSOR STATEMENTS
24052458
*
24062459
*****************************************************************************/
2407-
CursorStmt:DECLAREnameopt_binaryCURSORFOR
2460+
CursorStmt:DECLAREnameopt_cursorCURSORFOR
24082461
SELECTopt_uniqueres_target_list2
24092462
from_clausewhere_clause
24102463
group_clausehaving_clause
24112464
union_clausesort_clause
2465+
cursor_clause
24122466
{
24132467
structcursor *ptr, *this;
24142468

@@ -2438,7 +2492,26 @@ CursorStmt: DECLARE name opt_binary CURSOR FOR
24382492
}
24392493
;
24402494

2495+
opt_cursor:BINARY {$$ = make1_str("binary"); }
2496+
|INSENSITIVE{$$ = make1_str("insensitive"); }
2497+
|SCROLL {$$ = make1_str("scroll"); }
2498+
|INSENSITIVESCROLL{$$ = make1_str("insensitive scroll"); }
2499+
|/*EMPTY*/ {$$ = make1_str(""); }
2500+
;
2501+
2502+
cursor_clause:FORopt_readonly{$$ = cat2_str(make1_str("for"),$2); }
2503+
|/*EMPTY*/ {$$ = make1_str(""); }
2504+
2505+
;
2506+
2507+
opt_readonly:READONLY{$$ = make1_str("read only"); }
2508+
|UPDATEopt_of
2509+
{
2510+
yyerror("DECLARE/UPDATE not supported; Cursors must be READ ONLY.");
2511+
}
2512+
;
24412513

2514+
opt_of:OFcolumnList {$$ = make2_str(make1_str("of"),$2); }
24422515

24432516
/*****************************************************************************
24442517
*
@@ -3776,6 +3849,7 @@ TypeId: ColId
37763849
*/
37773850
ColId:ident{$$ =$1; }
37783851
|datetime{$$ =$1; }
3852+
|ABSOLUTE{$$ = make1_str("absolute"); }
37793853
|ACTION{$$ = make1_str("action"); }
37803854
|CACHE{$$ = make1_str("cache"); }
37813855
|CYCLE{$$ = make1_str("cycle"); }
@@ -3787,18 +3861,26 @@ ColId: ident{ $$ = $1; }
37873861
|FUNCTION{$$ = make1_str("function"); }
37883862
|INCREMENT{$$ = make1_str("increment"); }
37893863
|INDEX{$$ = make1_str("index"); }
3864+
|INSENSITIVE{$$ = make1_str("insensitive"); }
37903865
|KEY{$$ = make1_str("key"); }
37913866
|LANGUAGE{$$ = make1_str("language"); }
37923867
|LOCATION{$$ = make1_str("location"); }
37933868
|MATCH{$$ = make1_str("match"); }
37943869
|MAXVALUE{$$ = make1_str("maxvalue"); }
37953870
|MINVALUE{$$ = make1_str("minvalue"); }
3871+
|NEXT{$$ = make1_str("next"); }
3872+
|OF{$$ = make1_str("of"); }
3873+
|ONLY{$$ = make1_str("only"); }
37963874
|OPERATOR{$$ = make1_str("operator"); }
37973875
|OPTION{$$ = make1_str("option"); }
37983876
|PASSWORD{$$ = make1_str("password"); }
3799-
|PRIVILEGES{$$ = make1_str("privileges"); }
3877+
|PRIOR{$$ = make1_str("prior"); }
3878+
|PRIVILEGES{$$ = make1_str("privileges"); }
3879+
|READ{$$ = make1_str("read"); }
38003880
|RECIPE{$$ = make1_str("recipe"); }
3881+
|RELATIVE{$$ = make1_str("relative"); }
38013882
|ROW{$$ = make1_str("row"); }
3883+
|SCROLL{$$ = make1_str("scroll"); }
38023884
|SERIAL{$$ = make1_str("serial"); }
38033885
|START{$$ = make1_str("start"); }
38043886
|STATEMENT{$$ = make1_str("statement"); }
@@ -4006,7 +4088,7 @@ variable: opt_pointer symbol opt_array_bounds opt_initializer
40064088
switch(dimension)
40074089
{
40084090
case0:
4009-
strcpy("[]", dim);
4091+
strcpy(dim,"[]");
40104092
break;
40114093
case1:
40124094
*dim ='\0';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp