aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.header3
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.trailer1
-rw-r--r--src/interfaces/ecpg/preproc/variable.c3
3 files changed, 6 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header
index d3df8eabbb7..a415780faff 100644
--- a/src/interfaces/ecpg/preproc/ecpg.header
+++ b/src/interfaces/ecpg/preproc/ecpg.header
@@ -432,7 +432,8 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
/* This tests whether the cursor was declared and opened in the same function. */
#define SAMEFUNC(cur) \
((cur->function == NULL) || \
- (cur->function != NULL && strcmp(cur->function, current_function) == 0))
+ (cur->function != NULL && current_function != NULL && \
+ strcmp(cur->function, current_function) == 0))
static struct cursor *
add_additional_variables(const char *name, bool insert)
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer
index 0a77559e83b..e466668ea24 100644
--- a/src/interfaces/ecpg/preproc/ecpg.trailer
+++ b/src/interfaces/ecpg/preproc/ecpg.trailer
@@ -433,6 +433,7 @@ ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_
this->name = mm_strdup(@2);
this->function = (current_function ? mm_strdup(current_function) : NULL);
this->connection = connection ? mm_strdup(connection) : NULL;
+ this->opened = false;
this->command = mm_strdup(cat_str(6, "declare", cursor_marker, @3, "cursor", @5, "for $1"));
this->argsresult = NULL;
this->argsresult_oos = NULL;
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index 6b87d5ff3d9..a4294b8f0ff 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -216,6 +216,9 @@ find_variable(const char *name)
case ']':
count--;
break;
+ case '\0':
+ mmfatal(PARSE_ERROR, "unmatched brace in variable \"%s\"", name);
+ break;
default:
break;
}