aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/ecpg.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2021-03-24 20:48:20 +0100
committerMichael Meskes <meskes@postgresql.org>2021-03-24 21:09:24 +0100
commitad8305a43d1890768a613d3fb586b44f17360f29 (patch)
treef8873fcf8ba95baa0a258ccaaaa905715587d742 /src/interfaces/ecpg/preproc/ecpg.c
parent37c99d304dcbf12ab581ff031f394af93b750895 (diff)
downloadpostgresql-ad8305a43d1890768a613d3fb586b44f17360f29.tar.gz
postgresql-ad8305a43d1890768a613d3fb586b44f17360f29.zip
Add DECLARE STATEMENT command to ECPG
This command declares a SQL identifier for a SQL statement to be used in other embedded SQL statements. The identifier is linked to a connection. Author: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Shawn Wang <shawn.wang.pg@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/TY2PR01MB24438A52DB04E71D0E501452F5630@TY2PR01MB2443.jpnprd01.prod.outlook.com
Diffstat (limited to 'src/interfaces/ecpg/preproc/ecpg.c')
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index f362664fdc1..3c6506017d8 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -28,6 +28,7 @@ struct _include_path *include_paths = NULL;
struct cursor *cur = NULL;
struct typedefs *types = NULL;
struct _defines *defines = NULL;
+struct declared_list *g_declared_list = NULL;
static void
help(const char *progname)
@@ -347,6 +348,7 @@ main(int argc, char *const argv[])
struct cursor *ptr;
struct _defines *defptr;
struct typedefs *typeptr;
+ struct declared_list *list;
/* remove old cursor definitions if any are still there */
for (ptr = cur; ptr != NULL;)
@@ -373,6 +375,13 @@ main(int argc, char *const argv[])
}
cur = NULL;
+ /* remove old delared statements if any are still there */
+ for (list = g_declared_list; list != NULL;)
+ {
+ struct declared_list *this = list;
+ free(this);
+ }
+
/* remove non-pertinent old defines as well */
while (defines && !defines->pertinent)
{