summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 3f1478694de..eee1b16c27e 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1850,7 +1850,14 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
var->arrsize = va_arg(args, long);
var->offset = va_arg(args, long);
- if (var->arrsize == 0 || var->varcharsize == 0)
+ /*
+ * Unknown array size means pointer to an array.
+ * Unknown varcharsize usually also means pointer. But if the
+ * type is character and the array size is known, it is an
+ * array of pointers to char, so use var->pointer as it is.
+ */
+ if (var->arrsize == 0 ||
+ (var->varcharsize == 0 && ((var->type != ECPGt_char && var->type != ECPGt_unsigned_char) || (var->arrsize <= 1))))
var->value = *((char **) (var->pointer));
else
var->value = var->pointer;