Skip to content

Commit 91d6063

Browse files
author
Michael Meskes
committed
"char *" of course is not the same as "char []". So I had to fix the way ecpg treated the second one.
1 parent 841b4a2 commit 91d6063

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,10 @@ Wed Jul 2 09:45:59 CEST 2003
15501550
Fri Jul 4 13:51:11 CEST 2003
15511551

15521552
- date, interval and timestamp data should be quoted.
1553+
1554+
Mon Jul 7 14:13:43 CEST 2003
1555+
1556+
- Made sure "char *" is handled differently than "char []".
15531557
- Set ecpg version to 3.0.0
15541558
- Set ecpg library to 4.0.0
15551559
- Set pgtypes library to 1.0.0

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.16 2003/07/04 12:00:52 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.17 2003/07/07 12:15:33 meskes Exp $ */
22

33
/*
44
* 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
138138
else
139139
var->value = var->pointer;
140140

141+
/* negative values are used to indicate an array without given bounds */
142+
/* reset to zero for us */
143+
if (var->arrsize < 0)
144+
var->arrsize = 0;
145+
if (var->varcharsize < 0)
146+
var->varcharsize = 0;
147+
148+
141149
var->ind_type = va_arg(ap, enum ECPGttype);
142150
var->ind_pointer = va_arg(ap, char *);
143151
var->ind_varcharsize = va_arg(ap, long);

src/interfaces/ecpg/preproc/variable.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,14 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
512512
/* one index is the string length */
513513
if (atoi(*length) < 0)
514514
{
515-
*length = (atoi(*dimension) < 0) ? make_str("1") : *dimension;
515+
/* make sure we return length = -1 for arrays without given bounds */
516+
if (atoi(*dimension) < 0)
517+
*length = make_str("1");
518+
else if (atoi(*dimension) == 0)
519+
*length = make_str("-1");
520+
else
521+
*length = *dimension;
522+
516523
*dimension = make_str("-1");
517524
}
518525
break;

0 commit comments

Comments
 (0)