1
- /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.276 2004/03/02 06:45:05 meskes Exp $*/
1
+ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.277 2004/03/04 07:32:01 meskes Exp $*/
2
2
3
3
/* Copyright comment*/
4
4
%{
@@ -541,7 +541,7 @@ add_additional_variables(char *name, bool insert)
541
541
%type <str> ECPGTypeName using_list ECPGColLabelCommon UsingConst
542
542
%type <str> inf_val_list inf_col_list using_descriptor into_descriptor
543
543
%type <str> ecpg_into_using prepared_name struct_union_type_with_symbol
544
- %type <str> ECPGunreserved ECPGunreserved_interval
544
+ %type <str> ECPGunreserved ECPGunreserved_interval cvariable
545
545
546
546
%type <struct_union> s_struct_union_symbol
547
547
@@ -4220,7 +4220,7 @@ connection_target: database_name opt_server opt_port
4220
4220
}
4221
4221
;
4222
4222
4223
- db_prefix :ident CVARIABLE
4223
+ db_prefix :ident cvariable
4224
4224
{
4225
4225
if (strcmp($2 ," postgresql" ) !=0 && strcmp($2 ," postgres" ) !=0 )
4226
4226
{
@@ -4311,7 +4311,7 @@ user_name: UserId
4311
4311
}
4312
4312
;
4313
4313
4314
- char_variable :CVARIABLE
4314
+ char_variable :cvariable
4315
4315
{
4316
4316
/* check if we have a char variable*/
4317
4317
struct variable *p = find_variable($1 );
@@ -5241,14 +5241,14 @@ ECPGAllocateDescr:SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
5241
5241
* read from descriptor
5242
5242
*/
5243
5243
5244
- ECPGGetDescHeaderItem :CVARIABLE ' =' desc_header_item
5244
+ ECPGGetDescHeaderItem :cvariable ' =' desc_header_item
5245
5245
{ push_assignment($1 ,$3 ); }
5246
5246
;
5247
5247
5248
5248
desc_header_item :SQL_COUNT {$$ = ECPGd_count; }
5249
5249
;
5250
5250
5251
- ECPGGetDescItem :CVARIABLE ' =' descriptor_item { push_assignment($1 ,$3 ); };
5251
+ ECPGGetDescItem :cvariable ' =' descriptor_item { push_assignment($1 ,$3 ); };
5252
5252
5253
5253
descriptor_item :SQL_CARDINALITY {$$ = ECPGd_cardinality; }
5254
5254
| SQL_DATA {$$ = ECPGd_data; }
@@ -5280,7 +5280,7 @@ ECPGGetDescriptorHeader:GET SQL_DESCRIPTOR quoted_ident_stringvar
5280
5280
{$$ =$3 ; }
5281
5281
;
5282
5282
5283
- ECPGGetDescriptor :GET SQL_DESCRIPTOR quoted_ident_stringvar SQL_VALUE CVARIABLE ECPGGetDescItems
5283
+ ECPGGetDescriptor :GET SQL_DESCRIPTOR quoted_ident_stringvar SQL_VALUE cvariable ECPGGetDescItems
5284
5284
{$$ .str =$5 ;$$ .name =$3 ; }
5285
5285
| GET SQL_DESCRIPTOR quoted_ident_stringvar SQL_VALUE Iconst ECPGGetDescItems
5286
5286
{$$ .str =$5 ;$$ .name =$3 ; }
@@ -6047,14 +6047,14 @@ c_args: /*EMPTY*/{ $$ = EMPTY; }
6047
6047
| c_list {$$ =$1 ; }
6048
6048
;
6049
6049
6050
- coutputvariable :CVARIABLE indicator
6050
+ coutputvariable :cvariable indicator
6051
6051
{ add_variable_to_head(&argsresult, find_variable($1 ), find_variable($2 )); }
6052
- | CVARIABLE
6052
+ | cvariable
6053
6053
{ add_variable_to_head(&argsresult, find_variable($1 ), &no_indicator); }
6054
6054
;
6055
6055
6056
6056
6057
- civarind :CVARIABLE indicator
6057
+ civarind :cvariable indicator
6058
6058
{
6059
6059
if (find_variable($2 )->type->type == ECPGt_array)
6060
6060
mmerror (PARSE_ERROR, ET_ERROR," arrays of indicators are not allowed on input" );
@@ -6064,18 +6064,47 @@ civarind: CVARIABLE indicator
6064
6064
}
6065
6065
;
6066
6066
6067
- civar :CVARIABLE
6067
+ civar :cvariable
6068
6068
{
6069
6069
add_variable_to_head (&argsinsert, find_variable($1 ), &no_indicator);
6070
6070
$$ = create_questionmarks($1 ,false );
6071
6071
}
6072
6072
;
6073
6073
6074
- indicator :CVARIABLE { check_indicator((find_variable($1 ))->type);$$ =$1 ; }
6075
- | SQL_INDICATOR CVARIABLE { check_indicator((find_variable($2 ))->type);$$ =$2 ; }
6074
+ indicator :cvariable { check_indicator((find_variable($1 ))->type);$$ =$1 ; }
6075
+ | SQL_INDICATOR cvariable { check_indicator((find_variable($2 ))->type);$$ =$2 ; }
6076
6076
| SQL_INDICATOR name { check_indicator((find_variable($2 ))->type);$$ =$2 ; }
6077
6077
;
6078
6078
6079
+ cvariable :CVARIABLE
6080
+ {
6081
+ /* As long as multidimensional arrays are not implemented we have to check for those here*/
6082
+ char *ptr =$1 ;
6083
+ int brace_open=0 , brace =false ;
6084
+
6085
+ for (; *ptr; ptr++)
6086
+ {
6087
+ switch (*ptr)
6088
+ {
6089
+ case ' [' :if (brace)
6090
+ {
6091
+ mmerror (PARSE_ERROR, ET_FATAL," No multidimensional array support for simple data types" );
6092
+ }
6093
+ brace_open++;
6094
+ break ;
6095
+ case ' ]' : brace_open--;
6096
+ if (brace_open ==0 ) brace =true ;
6097
+ break ;
6098
+ case ' \t ' :
6099
+ case ' ' :break ;
6100
+ default :if (brace_open ==0 ) brace =false ;
6101
+ break ;
6102
+ }
6103
+ }
6104
+
6105
+ $$ =$1 ;
6106
+ }
6107
+ ;
6079
6108
ident :IDENT {$$ =$1 ; }
6080
6109
| CSTRING {$$ = make3_str(make_str(" \" " ),$1 , make_str(" \" " )); }
6081
6110
;