summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2010-03-21 11:56:45 +0000
committerMichael Meskes <meskes@postgresql.org>2010-03-21 11:56:45 +0000
commitb4d298ac234cb85df96a3c95f3b7c55183606e4a (patch)
tree8ed1bea8d8d0f81775f4184ea5b953e108c954a9 /src
parent654fff2311f564c276e29d460e07696f77b92847 (diff)
ECPG's parser now accepts and handles variables as arguments for the FREE command.
Informix allows variables as argument to the embedded SQL command FREE. Given that we only allow freeing cursors via FREE for compatibility reasons only we should do the same.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.addons11
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.trailer4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons
index de46f51ca72..8d33444e5c7 100644
--- a/src/interfaces/ecpg/preproc/ecpg.addons
+++ b/src/interfaces/ecpg/preproc/ecpg.addons
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.16 2010/01/29 16:28:13 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.17 2010/03/21 11:56:45 meskes Exp $ */
ECPG: stmtClosePortalStmt block
{
if (INFORMIX_MODE)
@@ -106,10 +106,13 @@ ECPG: stmtViewStmt rule
| ECPGFree
{
const char *con = connection ? connection : "NULL";
- if (strcmp($1, "all"))
- fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, \"%s\");", compat, con, $1);
- else
+
+ if (!strcmp($1, "all"))
fprintf(yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con);
+ else if ($1[0] == ':')
+ fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, %s);", compat, con, $1+1);
+ else
+ fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, \"%s\");", compat, con, $1);
whenever_action(2);
free($1);
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer
index e9bc9e7ae03..436c4fda4bd 100644
--- a/src/interfaces/ecpg/preproc/ecpg.trailer
+++ b/src/interfaces/ecpg/preproc/ecpg.trailer
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.22 2010/03/20 18:53:00 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.23 2010/03/21 11:56:45 meskes Exp $ */
statements: /*EMPTY*/
| statements statement
@@ -966,7 +966,7 @@ execstring: char_variable
* the exec sql free command to deallocate a previously
* prepared statement
*/
-ECPGFree: SQL_FREE name { $$ = $2; }
+ECPGFree: SQL_FREE cursor_name { $$ = $2; }
| SQL_FREE ALL { $$ = make_str("all"); }
;