Skip to content

Commit b46fa32

Browse files
author
Michael Meskes
committed
ECPG: Make the preprocessor emit ';' if the variable type for a list of
variables is varchar. This fixes this test case: int main(void) { exec sql begin declare section; varchar a[50], b[50]; exec sql end declare section; return 0; } Since varchars are internally turned into custom structs and the type name is emitted for these variable declarations, the preprocessed code previously had: struct varchar_1 { ... } a _,_ struct varchar_2 { ... } b ; The comma in the generated C file was a syntax error. There are no regression test changes since it's not exercised. Patch by Boszormenyi Zoltan <zb@cybertec.at>
1 parent 37364c6 commit b46fa32

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/interfaces/ecpg/preproc/ecpg.trailer

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,12 @@ opt_signed: SQL_SIGNED
837837
variable_list: variable
838838
{ $$ = $1; }
839839
| variable_list ',' variable
840-
{ $$ = cat_str(3, $1, mm_strdup(","), $3); }
840+
{
841+
if (actual_type[struct_level].type_enum == ECPGt_varchar)
842+
$$ = cat_str(3, $1, mm_strdup(";"), $3);
843+
else
844+
$$ = cat_str(3, $1, mm_strdup(","), $3);
845+
}
841846
;
842847

843848
variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initializer

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy