Commit 79c3bf49 authored by Michael Meskes's avatar Michael Meskes

- Fixed DEALLOCATE PREPARE to use correct function call

- Made sure connect statement does not accept single char variable,
  but only strings.
parent 0a19fb42
...@@ -1795,6 +1795,12 @@ Mon May 10 15:38:58 CEST 2004 ...@@ -1795,6 +1795,12 @@ Mon May 10 15:38:58 CEST 2004
- Argh, just another bug in adjust_informix. - Argh, just another bug in adjust_informix.
- Added "extern C" flags for C++ compiler. - 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 pgtypes library version to 1.2.
- Set ecpg version to 3.2.0. - Set ecpg version to 3.2.0.
- Set compat library version to 1.2. - Set compat library version to 1.2.
......
/* $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 #define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -116,7 +116,7 @@ ECPGdeallocate(int lineno, int c, char *name) ...@@ -116,7 +116,7 @@ ECPGdeallocate(int lineno, int c, char *name)
{ {
/* /*
* Just ignore all errors since we do not know the list of cursors * 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; return true;
} }
......
/* $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 */ /* Copyright comment */
%{ %{
...@@ -714,7 +714,7 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); } ...@@ -714,7 +714,7 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
{ {
if (connection) if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement.\n"); 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); whenever_action(2);
free($1); free($1);
} }
...@@ -4249,27 +4249,17 @@ connection_target: database_name opt_server opt_port ...@@ -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("\""))); $$ = 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] == '\"') if ($1[0] == '\"')
$$ = $1; $$ = $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 else
$$ = make3_str(make_str("\""), $1, make_str("\"")); $$ = make3_str(make_str("\""), $1, make_str("\""));
} }
| char_variable
{
$$ = $1;
}
; ;
db_prefix: ident cvariable db_prefix: ident cvariable
...@@ -4365,10 +4355,15 @@ user_name: UserId ...@@ -4365,10 +4355,15 @@ user_name: UserId
char_variable: cvariable char_variable: cvariable
{ {
/* check if we have a char variable */ /* check if we have a string variable */
struct variable *p = find_variable($1); struct variable *p = find_variable($1);
enum ECPGttype type = p->type->type; enum ECPGttype type = p->type->type;
/* If we have just one character this is not a string */
if (atol(p->type->size) == 1)
mmerror(PARSE_ERROR, ET_ERROR, "invalid datatype");
else
{
/* if array see what's inside */ /* if array see what's inside */
if (type == ECPGt_array) if (type == ECPGt_array)
type = p->type->u.element->type; type = p->type->u.element->type;
...@@ -4387,6 +4382,7 @@ char_variable: cvariable ...@@ -4387,6 +4382,7 @@ char_variable: cvariable
break; break;
} }
} }
}
; ;
opt_options: Op ColId opt_options: Op ColId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment