"char *" of course is not the same as "char []". So I had to fix the way ecpg treated the second one.

This commit is contained in:
Michael Meskes 2003-07-07 12:15:33 +00:00
parent 841b4a2d55
commit 91d60637cf
3 changed files with 21 additions and 2 deletions

View File

@ -1550,6 +1550,10 @@ Wed Jul 2 09:45:59 CEST 2003
Fri Jul 4 13:51:11 CEST 2003
- date, interval and timestamp data should be quoted.
Mon Jul 7 14:13:43 CEST 2003
- Made sure "char *" is handled differently than "char []".
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0

View File

@ -1,4 +1,4 @@
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.16 2003/07/04 12:00:52 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.17 2003/07/07 12:15:33 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@ -138,6 +138,14 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
else
var->value = var->pointer;
/* negative values are used to indicate an array without given bounds */
/* reset to zero for us */
if (var->arrsize < 0)
var->arrsize = 0;
if (var->varcharsize < 0)
var->varcharsize = 0;
var->ind_type = va_arg(ap, enum ECPGttype);
var->ind_pointer = va_arg(ap, char *);
var->ind_varcharsize = va_arg(ap, long);

View File

@ -512,7 +512,14 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
/* one index is the string length */
if (atoi(*length) < 0)
{
*length = (atoi(*dimension) < 0) ? make_str("1") : *dimension;
/* make sure we return length = -1 for arrays without given bounds */
if (atoi(*dimension) < 0)
*length = make_str("1");
else if (atoi(*dimension) == 0)
*length = make_str("-1");
else
*length = *dimension;
*dimension = make_str("-1");
}
break;