From 33d71e3037da7ddc85e71bc43d605244473bd7ff Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Fri, 7 Jan 2000 08:01:18 +0000 Subject: [PATCH] *** empty log message *** --- src/interfaces/ecpg/ChangeLog | 5 + src/interfaces/ecpg/preproc/Makefile | 2 +- src/interfaces/ecpg/preproc/preproc.y | 138 ++++++++++++++++---------- src/interfaces/ecpg/test/test1.pgc | 2 +- src/interfaces/ecpg/test/test3.pgc | 6 +- 5 files changed, 95 insertions(+), 58 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 296b34d5cd2..43e110bf781 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -755,3 +755,8 @@ Thu Dec 23 13:25:05 CET 1999 - Fixed command line parsing. - Set ecpg version to 2.6.13. +Thu Jan 6 09:52:27 CET 2000 + + - Synced preproc.y with gram.y. + - Made sure Bruce's additions also make it into my source tree. + - Set ecpg version to 2.6.14. diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile index ad2af480452..4c07c576558 100644 --- a/src/interfaces/ecpg/preproc/Makefile +++ b/src/interfaces/ecpg/preproc/Makefile @@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global MAJOR_VERSION=2 MINOR_VERSION=6 -PATCHLEVEL=13 +PATCHLEVEL=14 CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 999ae050c9a..e8a9fb11d69 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -27,7 +27,6 @@ static char *connection = NULL; static int QueryIsRule = 0, ForUpdateNotAllowed = 0, FoundInto = 0; static struct this_type actual_type[STRUCT_DEPTH]; static char *actual_storage[STRUCT_DEPTH]; -static char *actual_startline[STRUCT_DEPTH]; /* temporarily store struct members while creating the data structure */ struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH] = { NULL }; @@ -70,7 +69,7 @@ void output_line_number() { if (input_filename) - fprintf(yyout, "\n#line %d \"%s\"\n", yylineno, input_filename); + fprintf(yyout, "\n#line %d \"%s\"\n", yylineno + 1, input_filename); } static void @@ -480,20 +479,6 @@ make_name(void) return(name); } -static char * -hashline_number() -{ - if (input_filename) - { - char* line = mm_alloc(strlen("\n#line %d \"%s\"\n") + 21 + strlen(input_filename)); - sprintf(line, "\n#line %d \"%s\"\n", yylineno, input_filename); - - return line; - } - - return EMPTY; -} - static void output_statement(char * stmt, int mode) { @@ -772,7 +757,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim %type columnList DeleteStmt LockStmt UpdateStmt CursorStmt %type NotifyStmt columnElem copy_dirn UnlistenStmt copy_null %type copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary -%type opt_with_copy FetchStmt direction fetch_how_many portal_name +%type opt_with_copy FetchStmt opt_direction fetch_how_many opt_portal_name %type ClosePortalStmt DropStmt VacuumStmt opt_verbose %type opt_analyze opt_va_list va_list ExplainStmt index_params %type index_list func_index index_elem opt_type opt_class access_method_clause @@ -803,11 +788,12 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim %type select_offset_value table_list using_expr join_expr %type using_list from_expr table_expr join_clause join_type %type join_qual update_list join_clause join_clause_with_union -%type opt_level opt_lock lock_type, +%type opt_level opt_lock lock_type users_in_new_group_clause %type OptConstrFromTable comment_op ConstraintAttributeSpec %type constraints_set_list constraints_set_namelist comment_fn %type constraints_set_mode comment_type comment_cl comment_ag %type ConstraintDeferrabilitySpec ConstraintTimeSpec +%type CreateGroupStmt, AlterGroupStmt, DropGroupStmt %type ECPGWhenever ECPGConnect connection_target ECPGOpen %type indicator ECPGExecute ECPGPrepare ecpg_using @@ -822,7 +808,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim %type enum_type civariableonly ECPGCursorStmt ECPGDeallocate %type ECPGFree ECPGDeclare ECPGVar sql_variable_declarations %type sql_declaration sql_variable_list sql_variable opt_at -%type struct_type s_struct declaration declarations variable_declarations +%type struct_type s_struct declaration variable_declarations %type s_struct s_union union_type ECPGSetAutocommit on_off %type simple_type varchar_type @@ -851,12 +837,14 @@ statement: ecpgstart opt_at stmt ';' { connection = NULL; } opt_at: SQL_AT connection_target { connection = $2; } stmt: AddAttrStmt { output_statement($1, 0); } + | AlterGroupStmt { output_statement($1, 0); } | AlterUserStmt { output_statement($1, 0); } | ClosePortalStmt { output_statement($1, 0); } | CommentStmt { output_statement($1, 0); } | CopyStmt { output_statement($1, 0); } | CreateStmt { output_statement($1, 0); } | CreateAsStmt { output_statement($1, 0); } + | CreateGroupStmt { output_statement($1, 0); } | CreateSeqStmt { output_statement($1, 0); } | CreatePLangStmt { output_statement($1, 0); } | CreateTrigStmt { output_statement($1, 0); } @@ -865,6 +853,7 @@ stmt: AddAttrStmt { output_statement($1, 0); } | DefineStmt { output_statement($1, 0); } | DropStmt { output_statement($1, 0); } | TruncateStmt { output_statement($1, 0); } + | DropGroupStmt { output_statement($1, 0); } | DropPLangStmt { output_statement($1, 0); } | DropTrigStmt { output_statement($1, 0); } | DropUserStmt { output_statement($1, 0); } @@ -1111,10 +1100,6 @@ user_group_list: user_group_list ',' UserId user_group_clause: IN GROUP user_group_list { - /* the backend doesn't actually process this, - * so an warning message is probably fairer */ - mmerror(ET_WARN, "IN GROUP is not implemented"); - $$ = cat2_str(make_str("in group"), $3); } | /*EMPTY*/ { $$ = EMPTY; } @@ -1124,6 +1109,63 @@ user_valid_clause: VALID UNTIL Sconst { $$ = cat2_str(make_str("valid until") | /*EMPTY*/ { $$ = EMPTY; } ; + +/***************************************************************************** + * + * Create a postresql group + * + * + ****************************************************************************/ +CreateGroupStmt: CREATE GROUP UserId + { + $$ = cat2_str(make_str("create group"), $3); + } + | CREATE GROUP UserId WITH sysid_clause users_in_new_group_clause + { + $$ = cat_str(5, make_str("create group"), $3, make_str("with"), $5, $6); + } + ; + +users_in_new_group_clause: USER user_group_list { $$ = cat2_str(make_str("user"), $2); } + | /* EMPTY */ { $$ = EMPTY; } + ; + + +/***************************************************************************** + * + * Alter a postresql group + * + * + *****************************************************************************/ +AlterGroupStmt: ALTER GROUP UserId WITH SYSID Iconst + { + $$ = cat_str(4, make_str("alter group"), $3, make_str("with sysid"), $6); + } + | + ALTER GROUP UserId ADD USER user_group_list + { + $$ = cat_str(4, make_str("alter group"), $3, make_str("add user"), $6); + } + | + ALTER GROUP UserId DROP USER user_group_list + { + $$ = cat_str(4, make_str("alter group"), $3, make_str("drop user"), $6); + } + ; + +/***************************************************************************** + * + * Drop a postresql group + * + * + **********************