aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/ecpg/ChangeLog6
-rw-r--r--src/interfaces/ecpg/ecpglib/prepare.c4
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y62
3 files changed, 37 insertions, 35 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 7226149853b..f16bf08d820 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -1795,6 +1795,12 @@ Mon May 10 15:38:58 CEST 2004
- Argh, just another bug in adjust_informix.
- Added "extern C" flags for C++ compiler.
+
+Fri May 21 15:17:35 CEST 2004
+
+ - Fixed DEALLOCATE PREPARE to use correct function call
+ - Made sure connect statement does not accept single char variable,
+ but only strings.
- Set pgtypes library version to 1.2.
- Set ecpg version to 3.2.0.
- Set compat library version to 1.2.
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index 9de1b9bfd8b..f850b9c8f7f 100644
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.11 2004/01/28 09:52:14 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.12 2004/05/21 13:50:12 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -116,7 +116,7 @@ ECPGdeallocate(int lineno, int c, char *name)
{
/*
* Just ignore all errors since we do not know the list of cursors
- * we are allowed to free. We have to trust that the software.
+ * we are allowed to free. We have to trust the software.
*/
return true;
}
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 572c0fca648..d12576f8035 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.282 2004/05/10 13:46:06 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.283 2004/05/21 13:50:12 meskes Exp $ */
/* Copyright comment */
%{
@@ -714,7 +714,7 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement.\n");
- fprintf(yyout, "{ ECPGdeallocate(__LINE__, \"%s\");", $1);
+ fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s);", compat, $1);
whenever_action(2);
free($1);
}
@@ -4249,27 +4249,17 @@ connection_target: database_name opt_server opt_port
$$ = make3_str(make3_str(make_str("\""), $1, make_str(":")), $3, make3_str(make3_str($4, make_str("/"), $6), $7, make_str("\"")));
}
- | StringConst
+ | Sconst
{
if ($1[0] == '\"')
$$ = $1;
- else if (strcmp($1, " ?") == 0) /* variable */
- {
- enum ECPGttype type = argsinsert->variable->type->type;
-
- /* if array see what's inside */
- if (type == ECPGt_array)
- type = argsinsert->variable->type->u.element->type;
-
- /* handle varchars */
- if (type == ECPGt_varchar)
- $$ = make2_str(mm_strdup(argsinsert->variable->name), make_str(".arr"));
- else
- $$ = mm_strdup(argsinsert->variable->name);
- }
else
$$ = make3_str(make_str("\""), $1, make_str("\""));
}
+ | char_variable
+ {
+ $$ = $1;
+ }
;
db_prefix: ident cvariable
@@ -4365,26 +4355,32 @@ user_name: UserId
char_variable: cvariable
{
- /* check if we have a char variable */
+ /* check if we have a string variable */
struct variable *p = find_variable($1);
enum ECPGttype type = p->type->type;
- /* if array see what's inside */
- if (type == ECPGt_array)
- type = p->type->u.element->type;
-
- switch (type)
- {
- case ECPGt_char:
- case ECPGt_unsigned_char:
- $$ = $1;
- break;
- case ECPGt_varchar:
- $$ = make2_str($1, make_str(".arr"));
- break;
- default:
+ /* If we have just one character this is not a string */
+ if (atol(p->type->size) == 1)
mmerror(PARSE_ERROR, ET_ERROR, "invalid datatype");
- break;
+ else
+ {
+ /* if array see what's inside */
+ if (type == ECPGt_array)
+ type = p->type->u.element->type;
+
+ switch (type)
+ {
+ case ECPGt_char:
+ case ECPGt_unsigned_char:
+ $$ = $1;
+ break;
+ case ECPGt_varchar:
+ $$ = make2_str($1, make_str(".arr"));
+ break;
+ default:
+ mmerror(PARSE_ERROR, ET_ERROR, "invalid datatype");
+ break;
+ }
}
}
;