- Added missing rdayofweek function for Informix compatibility.
- Fixed fetch into char pointer.
+
+Fri Jun 20 13:23:07 CEST 2003
+
+ - Enabled constants in using clause.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.10 2003/06/15 04:07:58 momjian Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.11 2003/06/20 12:00:59 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
*malloced_p = true;
}
break;
+ case ECPGt_const:
case ECPGt_char_variable:
{
int slen = strlen((char *) var->value);
{
ECPGlog("ECPGexecute line %d: ASYNC NOTIFY of '%s' from backend pid '%d' received\n",
stmt->lineno, notify->relname, notify->be_pid);
- PQfreemem(notify);
+ PQfreemem(notify);
}
return status;
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/typename.c,v 1.5 2003/06/17 07:28:22 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/typename.c,v 1.6 2003/06/20 12:00:59 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
return "Timestamp";
case ECPGt_interval:
return "Interval";
+ case ECPGt_char_const:
+ return "Const";
default:
abort();
}
ECPGt_union,
ECPGt_descriptor, /* sql descriptor, no C variable */
ECPGt_char_variable,
+ ECPGt_const, /* a constant is needed sometimes */
ECPGt_EOIT, /* End of insert types. */
ECPGt_EORT, /* End of result types. */
ECPGt_NO_INDICATOR /* no indicator */
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.234 2003/06/19 09:52:11 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.235 2003/06/20 12:00:59 meskes Exp $ */
/* Copyright comment */
%{
%type <str> ECPGGetDescriptorHeader ECPGColLabel single_var_declaration
%type <str> reserved_keyword unreserved_keyword ecpg_interval opt_ecpg_using
%type <str> col_name_keyword func_name_keyword precision opt_scale
-%type <str> ECPGTypeName using_list ECPGColLabelCommon
+%type <str> ECPGTypeName using_list ECPGColLabelCommon UsingConst
%type <str> inf_val_list inf_col_list using_descriptor into_descriptor
%type <str> ecpg_into_using
| into_descriptor { $$ = $1; }
;
-using_list: civar | civar ',' using_list;
+using_list: UsingConst | UsingConst ',' using_list;
+
+UsingConst: AllConst
+ {
+ if ($1[1] != '?') /* found a constant */
+ {
+ char *length = mm_alloc(sizeof("INT_MAX")+1);
+
+ sprintf(length, "%d", strlen($1));
+ add_variable(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length), 0), &no_indicator);
+ }
+ }
+ ;
/*
* As long as the prepare statement is not supported by the backend, we will
* quoted */
return ("ECPGt_char_variable");
break;
+ case ECPGt_const: /* constant string quoted */
+ return ("ECPGt_const");
+ break;
case ECPGt_numeric:
return ("ECPGt_numeric");
break;
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
sprintf(offset, "sizeof(Date)");
break;
+ case ECPGt_const:
+
+ /*
+ * just dump the const as string
+ */
+ sprintf(variable, "\"%s\"", name);
+ sprintf(offset, "strlen(\"%s\")", name);
+ break;
default:
/*
struct birthinfo ind_birth;
} ind_personal, *i;
ind ind_children;
- c testname="Petra";
char *query="select name, born, age, married, children from meskes where name = :var1";
exec sql end declare section;
exec sql declare prep cursor for MM;
strcpy(msg, "open");
- exec sql open prep using :testname;
+ exec sql open prep using 'Petra';
exec sql whenever not found do break;