diff -rcN ecpg/ChangeLog ecpg.mm/ChangeLog *** ecpg/ChangeLog Sat Aug 29 08:19:34 1998 --- ecpg.mm/ChangeLog Thu Sep 17 19:23:47 1998 *************** *** 311,313 **** --- 311,339 ---- - Removed one line of code that AIX complains about since it was not needed anyway - Set library version to 2.6.1 + + 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 diff -rcN ecpg/preproc/Makefile ecpg.mm/preproc/Makefile *** ecpg/preproc/Makefile Tue Aug 25 19:11:38 1998 --- ecpg.mm/preproc/Makefile Mon Sep 14 09:20:32 1998 *************** *** 3,9 **** MAJOR_VERSION=2 MINOR_VERSION=4 ! PATCHLEVEL=1 CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ --- 3,9 ---- MAJOR_VERSION=2 MINOR_VERSION=4 ! PATCHLEVEL=2 CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ *************** *** 26,31 **** --- 26,35 ---- # Rule that really do something. ecpg: $(OBJ) $(CC) -o ecpg $(OBJ) $(LEXLIB) + + pgc.c: pgc.l + $(LEX) $< + mv lex.yy.c pgc.c y.tab.h y.tab.c: preproc.y $(YACC) $(YFLAGS) $< diff -rcN ecpg/preproc/keywords.c ecpg.mm/preproc/keywords.c *** ecpg/preproc/keywords.c Tue Sep 1 06:46:11 1998 --- ecpg.mm/preproc/keywords.c Mon Sep 14 09:22:28 1998 *************** *** 150,155 **** --- 150,156 ---- {"notnull", NOTNULL}, {"null", NULL_P}, {"numeric", NUMERIC}, + {"of", OF}, {"oids", OIDS}, {"on", ON}, {"operator", OPERATOR}, diff -rcN ecpg/preproc/pgc.l ecpg.mm/preproc/pgc.l *** ecpg/preproc/pgc.l Tue Sep 1 06:46:11 1998 --- ecpg.mm/preproc/pgc.l Tue Sep 1 11:28:18 1998 *************** *** 340,345 **** --- 340,348 ---- if (isascii((unsigned char)yytext[i]) && isupper(yytext[i])) yytext[i] = tolower(yytext[i]); + if (i >= NAMEDATALEN) + yytext[NAMEDATALEN-1] = '\0'; + keyword = ScanKeywordLookup((char*)yytext); if (keyword != NULL) { return keyword->value; *************** *** 477,482 **** --- 480,488 ---- for(i = 0; yytext[i]; i++) if (isascii((unsigned char)yytext[i]) && isupper(yytext[i])) yytext[i] = tolower(yytext[i]); + + if (i >= NAMEDATALEN) + yytext[NAMEDATALEN-1] = '\0'; keyword = ScanKeywordLookup((char*)yytext); if (keyword != NULL) { diff -rcN ecpg/preproc/preproc.y ecpg.mm/preproc/preproc.y *** ecpg/preproc/preproc.y Tue Sep 1 06:46:14 1998 --- ecpg.mm/preproc/preproc.y Thu Sep 17 19:23:09 1998 *************** *** 528,534 **** %token TYPECAST /* Keywords (in SQL92 reserved words) */ ! %token ACTION, ADD, ALL, ALTER, AND, ANY AS, ASC, BEGIN_TRANS, BETWEEN, BOTH, BY, CASCADE, CAST, CHAR, CHARACTER, CHECK, CLOSE, COLLATE, COLUMN, COMMIT, CONSTRAINT, CREATE, CROSS, CURRENT, CURRENT_DATE, CURRENT_TIME, --- 528,534 ---- %token TYPECAST /* Keywords (in SQL92 reserved words) */ ! %token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY AS, ASC, BEGIN_TRANS, BETWEEN, BOTH, BY, CASCADE, CAST, CHAR, CHARACTER, CHECK, CLOSE, COLLATE, COLUMN, COMMIT, CONSTRAINT, CREATE, CROSS, CURRENT, CURRENT_DATE, CURRENT_TIME, *************** *** 537,550 **** END_TRANS, EXECUTE, EXISTS, EXTRACT, FETCH, FLOAT, FOR, FOREIGN, FROM, FULL, GRANT, GROUP, HAVING, HOUR_P, ! IN, INNER_P, INSERT, INTERVAL, INTO, IS, JOIN, KEY, LANGUAGE, LEADING, LEFT, LIKE, LOCAL, MATCH, MINUTE_P, MONTH_P, NAMES, ! NATIONAL, NATURAL, NCHAR, NO, NOT, NOTIFY, NULL_P, NUMERIC, ! ON, OPTION, OR, ORDER, OUTER_P, ! PARTIAL, POSITION, PRECISION, PRIMARY, PRIVILEGES, PROCEDURE, PUBLIC, ! REFERENCES, REVOKE, RIGHT, ROLLBACK, ! SECOND_P, SELECT, SET, SUBSTRING, TABLE, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE, TO, TRAILING, TRANSACTION, TRIM, UNION, UNIQUE, UPDATE, USER, USING, --- 537,550 ---- END_TRANS, EXECUTE, EXISTS, EXTRACT, FETCH, FLOAT, FOR, FOREIGN, FROM, FULL, GRANT, GROUP, HAVING, HOUR_P, ! IN, INNER_P, INSENSITIVE, INSERT, INTERVAL, INTO, IS, JOIN, KEY, LANGUAGE, LEADING, LEFT, LIKE, LOCAL, MATCH, MINUTE_P, MONTH_P, NAMES, ! NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NOTIFY, NULL_P, NUMERIC, ! OF, ON, ONLY, OPTION, OR, ORDER, OUTER_P, ! PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC, ! READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK, ! SCROLL, SECOND_P, SELECT, SET, SUBSTRING, TABLE, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE, TO, TRAILING, TRANSACTION, TRIM, UNION, UNIQUE, UPDATE, USER, USING, *************** *** 620,626 **** %type ColId default_expr ColQualifier columnDef ColQualList %type ColConstraint ColConstraintElem default_list NumericOnly FloatOnly %type OptTableElementList OptTableElement TableConstraint ! %type ConstraintElem key_actions constraint_list %type res_target_list res_target_el res_target_list2 %type res_target_el2 opt_id relation_name database_name %type access_method attr_name class index_name name func_name --- 620,626 ---- %type ColId default_expr ColQualifier columnDef ColQualList %type ColConstraint ColConstraintElem default_list NumericOnly FloatOnly %type OptTableElementList OptTableElement TableConstraint ! %type ConstraintElem key_actions constraint_list ColPrimaryKey %type res_target_list res_target_el res_target_list2 %type res_target_el2 opt_id relation_name database_name %type access_method attr_name class index_name name func_name *************** *** 667,672 **** --- 667,673 ---- %type ViewStmt LoadStmt CreatedbStmt opt_database1 opt_database2 location %type DestroydbStmt ClusterStmt grantee RevokeStmt encoding %type GrantStmt privileges operation_commalist operation + %type cursor_clause, opt_cursor, opt_readonly, opt_of %type ECPGWhenever ECPGConnect connection_target ECPGOpen open_opts %type indicator ECPGExecute ecpg_expr dotext *************** *** 1083,1091 **** { $$ = cat3_str($1, $2, $3); } ! | ColId SERIAL { ! $$ = make2_str($1, make1_str(" serial")); } ; --- 1084,1092 ---- { $$ = cat3_str($1, $2, $3); } ! | ColId SERIAL ColPrimaryKey { ! $$ = make3_str($1, make1_str(" serial "), $3); } ; *************** *** 1097,1102 **** --- 1098,1113 ---- | ColConstraint { $$ = $1; } ; + ColPrimaryKey: PRIMARY KEY + { + $$ = make1_str("primary key"); + } + | /*EMPTY*/ + { + $$ = make1_str(""); + } + ; + ColConstraint: CONSTRAINT name ColConstraintElem { *************** *** 1106,1115 **** --- 1117,1145 ---- { $$ = $1; } ; + /* The column constraint WITH NULL gives a shift/reduce error + * because it requires yacc to look more than one token ahead to + * resolve WITH TIME ZONE and WITH NULL. + * So, leave it out of the syntax for now. + | WITH NULL_P + { + $$ = NULL; + } + * - thomas 1998-09-12 + * + * DEFAULT NULL is already the default for Postgres. + * Bue define it here and carry it forward into the system + * to make it explicit. + * - thomas 1998-09-13 + */ ColConstraintElem: CHECK '(' constraint_expr ')' { $$ = make3_str(make1_str("check("), $3, make1_str(")")); } + | DEFAULT NULL_P + { + $$ = make1_str("default null"); + } | DEFAULT default_expr { $$ = cat2_str(make1_str("default"), $2); *************** *** 1143,1152 **** } ; default_expr: AexprConst { $$ = $1; } - | NULL_P - { $$ = make1_str("null"); } | '-' default_expr %prec UMINUS { $$ = cat2_str(make1_str("-"), $2); } | default_expr '+' default_expr --- 1173,1188 ---- } ; + /* The Postgres default column value is NULL. + * Rather than carrying DEFAULT NULL forward as a clause, + * let's just have it be a no-op. + | NULL_P + { $$ = make1_str("null"); } + * - thomas 1998-09-13 + */ + default_expr: AexprConst { $$ = $1; } | '-' default_expr %prec UMINUS { $$ = cat2_str(make1_str("-"), $2); } | default_expr '+' default_expr *************** *** 1559,1565 **** ; TriggerFuncArgs: TriggerFuncArg ! { $$ = $1 } | TriggerFuncArgs ',' TriggerFuncArg { $$ = cat3_str($1, make1_str(","), $3); } | /*EMPTY*/ --- 1595,1601 ---- ; TriggerFuncArgs: TriggerFuncArg ! { $$ = $1; } | TriggerFuncArgs ',' TriggerFuncArg { $$ = cat3_str($1, make1_str(","), $3); } | /*EMPTY*/ *************** *** 1667,1678 **** /***************************************************************************** * * QUERY: ! * fetch/move [forward | backward] [number | all ] [ in ] * *****************************************************************************/ FetchStmt: FETCH opt_direction fetch_how_many opt_portal_name INTO into_list { $$ = cat4_str(make1_str("fetch"), $2, $3, $4); } | MOVE opt_direction fetch_how_many opt_portal_name --- 1703,1719 ---- /***************************************************************************** * * QUERY: ! * fetch/move [forward | backward] [ # | all ] [ in ] ! * fetch [ forward | backward | absolute | relative ] ! * [ # | all | next | prior ] [ [ in | from ] ] * *****************************************************************************/ FetchStmt: FETCH opt_direction fetch_how_many opt_portal_name INTO into_list { + if (strncmp($2, "relative", strlen("relative")) == 0 && atol($3) == 0L) + yyerror("FETCH/RELATIVE at current position is not supported"); + $$ = cat4_str(make1_str("fetch"), $2, $3, $4); } | MOVE opt_direction fetch_how_many opt_portal_name *************** *** 1683,1700 **** opt_direction: FORWARD { $$ = make1_str("forward"); } | BACKWARD { $$ = make1_str("backward"); } | /*EMPTY*/ { $$ = make1_str(""); /* default */ } ; ! fetch_how_many: Iconst ! { $$ = $1; ! if (atol($1) <= 0) yyerror("Please specify nonnegative count for fetch"); } | ALL { $$ = make1_str("all"); } | /*EMPTY*/ { $$ = make1_str(""); /*default*/ } ; opt_portal_name: IN name { $$ = cat2_str(make1_str("in"), $2); } ! | name { $$ = cat2_str(make1_str("in"), $1); } | /*EMPTY*/ { $$ = make1_str(""); } ; --- 1724,1749 ---- opt_direction: FORWARD { $$ = make1_str("forward"); } | BACKWARD { $$ = make1_str("backward"); } + | RELATIVE { $$ = make1_str("relative"); } + | ABSOLUTE + { + fprintf(stderr, "FETCH/ABSOLUTE not supported, using RELATIVE"); + $$ = make1_str("absolute"); + } | /*EMPTY*/ { $$ = make1_str(""); /* default */ } ; ! fetch_how_many: Iconst { $$ = $1; } ! | '-' Iconst { $$ = make2_str(make1_str("-"), $2); } | ALL { $$ = make1_str("all"); } + | NEXT { $$ = make1_str("next"); } + | PRIOR { $$ = make1_str("prior"); } | /*EMPTY*/ { $$ = make1_str(""); /*default*/ } ; opt_portal_name: IN name { $$ = cat2_str(make1_str("in"), $2); } ! | FROM name { $$ = cat2_str(make1_str("from"), $2); } ! /* | name { $$ = cat2_str(make1_str("in"), $1); */ | /*EMPTY*/ { $$ = make1_str(""); } ; *************** *** 2328,2333 **** --- 2377,2386 ---- { $$ = make3_str(make1_str("values("), $3, make1_str(")")); } + | DEFAULT VALUES + { + $$ = make1_str("default values"); + } | SELECT opt_unique res_target_list2 from_clause where_clause group_clause having_clause *************** *** 2404,2414 **** * CURSOR STATEMENTS * *****************************************************************************/ ! CursorStmt: DECLARE name opt_binary CURSOR FOR SELECT opt_unique res_target_list2 from_clause where_clause group_clause having_clause union_clause sort_clause { struct cursor *ptr, *this; --- 2457,2468 ---- * CURSOR STATEMENTS * *****************************************************************************/ ! CursorStmt: DECLARE name opt_cursor CURSOR FOR SELECT opt_unique res_target_list2 from_clause where_clause group_clause having_clause union_clause sort_clause + cursor_clause { struct cursor *ptr, *this; *************** *** 2438,2444 **** --- 2492,2517 ---- } ; + opt_cursor: BINARY { $$ = make1_str("binary"); } + | INSENSITIVE { $$ = make1_str("insensitive"); } + | SCROLL { $$ = make1_str("scroll"); } + | INSENSITIVE SCROLL { $$ = make1_str("insensitive scroll"); } + | /*EMPTY*/ { $$ = make1_str(""); } + ; + + cursor_clause: FOR opt_readonly { $$ = cat2_str(make1_str("for"), $2); } + | /*EMPTY*/ { $$ = make1_str(""); } + + ; + + opt_readonly: READ ONLY { $$ = make1_str("read only"); } + | UPDATE opt_of + { + yyerror("DECLARE/UPDATE not supported; Cursors must be READ ONLY."); + } + ; + opt_of: OF columnList { $$ = make2_str(make1_str("of"), $2); } /***************************************************************************** * *************** *** 3776,3781 **** --- 3849,3855 ---- */ ColId: ident { $$ = $1; } | datetime { $$ = $1; } + | ABSOLUTE { $$ = make1_str("absolute"); } | ACTION { $$ = make1_str("action"); } | CACHE { $$ = make1_str("cache"); } | CYCLE { $$ = make1_str("cycle"); } *************** *** 3787,3804 **** | FUNCTION { $$ = make1_str("function"); } | INCREMENT { $$ = make1_str("increment"); } | INDEX { $$ = make1_str("index"); } | KEY { $$ = make1_str("key"); } | LANGUAGE { $$ = make1_str("language"); } | LOCATION { $$ = make1_str("location"); } | MATCH { $$ = make1_str("match"); } | MAXVALUE { $$ = make1_str("maxvalue"); } | MINVALUE { $$ = make1_str("minvalue"); } | OPERATOR { $$ = make1_str("operator"); } | OPTION { $$ = make1_str("option"); } | PASSWORD { $$ = make1_str("password"); } ! | PRIVILEGES { $$ = make1_str("privileges"); } | RECIPE { $$ = make1_str("recipe"); } | ROW { $$ = make1_str("row"); } | SERIAL { $$ = make1_str("serial"); } | START { $$ = make1_str("start"); } | STATEMENT { $$ = make1_str("statement"); } --- 3861,3886 ---- | FUNCTION { $$ = make1_str("function"); } | INCREMENT { $$ = make1_str("increment"); } | INDEX { $$ = make1_str("index"); } + | INSENSITIVE { $$ = make1_str("insensitive"); } | KEY { $$ = make1_str("key"); } | LANGUAGE { $$ = make1_str("language"); } | LOCATION { $$ = make1_str("location"); } | MATCH { $$ = make1_str("match"); } | MAXVALUE { $$ = make1_str("maxvalue"); } | MINVALUE { $$ = make1_str("minvalue"); } + | NEXT { $$ = make1_str("next"); } + | OF { $$ = make1_str("of"); } + | ONLY { $$ = make1_str("only"); } | OPERATOR { $$ = make1_str("operator"); } | OPTION { $$ = make1_str("option"); } | PASSWORD { $$ = make1_str("password"); } ! | PRIOR { $$ = make1_str("prior"); } ! | PRIVILEGES { $$ = make1_str("privileges"); } ! | READ { $$ = make1_str("read"); } | RECIPE { $$ = make1_str("recipe"); } + | RELATIVE { $$ = make1_str("relative"); } | ROW { $$ = make1_str("row"); } + | SCROLL { $$ = make1_str("scroll"); } | SERIAL { $$ = make1_str("serial"); } | START { $$ = make1_str("start"); } | STATEMENT { $$ = make1_str("statement"); } *************** *** 4006,4012 **** switch(dimension) { case 0: ! strcpy("[]", dim); break; case 1: *dim = '\0'; --- 4088,4094 ---- switch(dimension) { case 0: ! strcpy(dim, "[]"); break; case 1: *dim = '\0';