@@ -4,8 +4,18 @@ statements: /*EMPTY*/
4
4
| statements statement
5
5
;
6
6
7
- statement: ecpgstart at toplevel_stmt ';' { connection = NULL; }
7
+ statement: ecpgstart at toplevel_stmt ';'
8
+ {
9
+ if (connection)
10
+ free(connection);
11
+ connection = NULL;
12
+ }
8
13
| ecpgstart toplevel_stmt ';'
14
+ {
15
+ if (connection)
16
+ free(connection);
17
+ connection = NULL;
18
+ }
9
19
| ecpgstart ECPGVarDeclaration
10
20
{
11
21
fprintf(base_yyout, "%s", $2);
@@ -1101,41 +1111,33 @@ UsingConst: Iconst { $$ = $1; }
1101
1111
*/
1102
1112
ECPGDescribe: SQL_DESCRIBE INPUT_P prepared_name using_descriptor
1103
1113
{
1104
- const char *con = connection ? connection : "NULL";
1105
- mmerror(PARSE_ERROR, ET_WARNING, "using unsupported DESCRIBE statement");
1106
- $$ = (char *) mm_alloc(sizeof("1, , ") + strlen(con) + strlen($3));
1107
- sprintf($$, "1, %s, %s", con, $3);
1114
+ $$.input = 1;
1115
+ $$.stmt_name = $3;
1108
1116
}
1109
1117
| SQL_DESCRIBE opt_output prepared_name using_descriptor
1110
1118
{
1111
- const char *con = connection ? connection : "NULL";
1112
1119
struct variable *var;
1113
-
1114
1120
var = argsinsert->variable;
1115
1121
remove_variable_from_list(&argsinsert, var);
1116
1122
add_variable_to_head(&argsresult, var, &no_indicator);
1117
1123
1118
- $$ = (char *) mm_alloc(sizeof("0, , ") + strlen(con) + strlen($3)) ;
1119
- sprintf($$, "0, %s, %s", con, $3) ;
1124
+ $$.input = 0 ;
1125
+ $$.stmt_name = $3 ;
1120
1126
}
1121
1127
| SQL_DESCRIBE opt_output prepared_name into_descriptor
1122
1128
{
1123
- const char *con = connection ? connection : "NULL";
1124
- $$ = (char *) mm_alloc(sizeof("0, , ") + strlen(con) + strlen($3));
1125
- sprintf($$, "0, %s, %s", con, $3);
1129
+ $$.input = 0;
1130
+ $$.stmt_name = $3;
1126
1131
}
1127
1132
| SQL_DESCRIBE INPUT_P prepared_name into_sqlda
1128
1133
{
1129
- const char *con = connection ? connection : "NULL";
1130
- mmerror(PARSE_ERROR, ET_WARNING, "using unsupported DESCRIBE statement");
1131
- $$ = (char *) mm_alloc(sizeof("1, , ") + strlen(con) + strlen($3));
1132
- sprintf($$, "1, %s, %s", con, $3);
1134
+ $$.input = 1;
1135
+ $$.stmt_name = $3;
1133
1136
}
1134
1137
| SQL_DESCRIBE opt_output prepared_name into_sqlda
1135
1138
{
1136
- const char *con = connection ? connection : "NULL";
1137
- $$ = (char *) mm_alloc(sizeof("0, , ") + strlen(con) + strlen($3));
1138
- sprintf($$, "0, %s, %s", con, $3);
1139
+ $$.input = 0;
1140
+ $$.stmt_name = $3;
1139
1141
}
1140
1142
;
1141
1143
@@ -1862,8 +1864,8 @@ c_anything: ecpg_ident { $$ = $1; }
1862
1864
| ':' { $$ = mm_strdup(":"); }
1863
1865
;
1864
1866
1865
- DeallocateStmt: DEALLOCATE prepared_name { $$ = $2; }
1866
- | DEALLOCATE PREPARE prepared_name { $$ = $3; }
1867
+ DeallocateStmt: DEALLOCATE prepared_name { check_declared_list($2); $$ = $2; }
1868
+ | DEALLOCATE PREPARE prepared_name { check_declared_list($3); $$ = $3; }
1867
1869
| DEALLOCATE ALL { $$ = mm_strdup("all"); }
1868
1870
| DEALLOCATE PREPARE ALL { $$ = mm_strdup("all"); }
1869
1871
;
0 commit comments