@@ -573,6 +573,9 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
573
573
*dimension = type_dimension;
574
574
}
575
575
576
+ if (*length >= 0 && *dimension >= 0 && pointer)
577
+ yyerror (" No multi-dimensional array support" );
578
+
576
579
switch (type_enum)
577
580
{
578
581
case ECPGt_struct:
@@ -589,9 +592,9 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
589
592
590
593
break ;
591
594
case ECPGt_varchar:
592
- /* pointer has to get length 0 */
595
+ /* pointer has to get dimension 0 */
593
596
if (pointer)
594
- *length= 0 ;
597
+ *dimension = 0 ;
595
598
596
599
/* one index is the string length */
597
600
if (*length < 0 )
@@ -3721,11 +3724,11 @@ a_expr: attr opt_indirection
3721
3724
}
3722
3725
| a_expr IN ' (' in_expr ' )'
3723
3726
{
3724
- $$ = make4_str($1 , make1_str(" in (" ), $4 , make1_str(" )" ));
3727
+ $$ = make4_str($1 , make1_str(" in (" ), $4 , make1_str(" )" ));
3725
3728
}
3726
3729
| a_expr NOT IN ' (' not_in_expr ' )'
3727
3730
{
3728
- $$ = make4_str($1 , make1_str(" not in (" ), $5 , make1_str(" )" ));
3731
+ $$ = make4_str($1 , make1_str(" not in (" ), $5 , make1_str(" )" ));
3729
3732
}
3730
3733
| a_expr Op ' (' SubSelect ' )'
3731
3734
{
@@ -4838,15 +4841,16 @@ type: simple_type
4838
4841
{
4839
4842
$$ .type_str = $1 ;
4840
4843
$$ .type_enum = ECPGt_int;
4841
- $$ .type_dimension = -1 ;
4844
+
4845
+ $$ .type_dimension = -1 ;
4842
4846
$$ .type_index = -1 ;
4843
4847
}
4844
4848
| symbol
4845
4849
{
4846
4850
/* this is for typedef'ed types */
4847
4851
struct typedefs *this = get_typedef($1 );
4848
4852
4849
- $$ .type_str = mm_strdup(this ->name);
4853
+ $$ .type_str = ( this ->type->type_enum == ECPGt_varchar) ? make1_str( " " ) : mm_strdup(this ->name);
4850
4854
$$ .type_enum = this ->type->type_enum;
4851
4855
$$ .type_dimension = this ->type->type_dimension;
4852
4856
$$ .type_index = this ->type->type_index;
@@ -4945,8 +4949,6 @@ variable: opt_pointer symbol opt_array_bounds opt_initializer
4945
4949
switch (dimension)
4946
4950
{
4947
4951
case 0 :
4948
- strcpy (dim, " []" );
4949
- break ;
4950
4952
case -1 :
4951
4953
case 1 :
4952
4954
*dim = ' \0 ' ;
@@ -4957,11 +4959,14 @@ variable: opt_pointer symbol opt_array_bounds opt_initializer
4957
4959
}
4958
4960
sprintf (ascii_len, " %d" , length);
4959
4961
4960
- if (length > 0 )
4961
- $$ = make4_str(make5_str(mm_strdup(actual_storage[struct_level]), make1_str(" struct varchar_" ), mm_strdup($2 ), make1_str(" { int len; char arr[" ), mm_strdup(ascii_len)), make1_str(" ]; } " ), mm_strdup($2 ), mm_strdup(dim));
4962
- else
4963
- yyerror (" pointer to varchar are not implemented yet" );
4964
- /* $$ = make4_str(make3_str(mm_strdup(actual_storage[struct_level]), make1_str(" struct varchar_"), mm_strdup($2)), make1_str(" { int len; char *arr; }"), mm_strdup($2), mm_strdup(dim));*/
4962
+ if (length == 0 )
4963
+ yyerror (" pointer to varchar are not implemented" );
4964
+
4965
+ if (dimension == 0 )
4966
+ $$ = make4_str(make5_str(mm_strdup(actual_storage[struct_level]), make1_str(" struct varchar_" ), mm_strdup($2 ), make1_str(" { int len; char arr[" ), mm_strdup(ascii_len)), make1_str(" ]; } *" ), mm_strdup($2 ), $4 );
4967
+ else
4968
+ $$ = make5_str(make5_str(mm_strdup(actual_storage[struct_level]), make1_str(" struct varchar_" ), mm_strdup($2 ), make1_str(" { int len; char arr[" ), mm_strdup(ascii_len)), make1_str(" ]; } " ), mm_strdup($2 ), mm_strdup(dim), $4 );
4969
+
4965
4970
break ;
4966
4971
case ECPGt_char:
4967
4972
case ECPGt_unsigned_char:
0 commit comments