-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38 2004/08/29 05:06:59 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.39 2005/03/18 10:00:43 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
return res;
}
+#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
+#define APREF ap
+#else
+#define APREF *ap
+#endif
+
void
-ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable * var, bool indicator)
+ECPGget_variable(va_list APREF, enum ECPGttype type, struct variable * var, bool indicator)
{
var->type = type;
- var->pointer = va_arg(*ap, char *);
+ var->pointer = va_arg(APREF, char *);
- var->varcharsize = va_arg(*ap, long);
- var->arrsize = va_arg(*ap, long);
- var->offset = va_arg(*ap, long);
+ var->varcharsize = va_arg(APREF, long);
+ var->arrsize = va_arg(APREF, long);
+ var->offset = va_arg(APREF, long);
if (var->arrsize == 0 || var->varcharsize == 0)
var->value = *((char **) (var->pointer));
if (indicator)
{
- var->ind_type = va_arg(*ap, enum ECPGttype);
- var->ind_pointer = va_arg(*ap, char *);
- var->ind_varcharsize = va_arg(*ap, long);
- var->ind_arrsize = va_arg(*ap, long);
- var->ind_offset = va_arg(*ap, long);
+ var->ind_type = va_arg(APREF, enum ECPGttype);
+ var->ind_pointer = va_arg(APREF, char *);
+ var->ind_varcharsize = va_arg(APREF, long);
+ var->ind_arrsize = va_arg(APREF, long);
+ var->ind_offset = va_arg(APREF, long);
if (var->ind_type != ECPGt_NO_INDICATOR
&& (var->ind_arrsize == 0 || var->ind_varcharsize == 0))
var->ind_varcharsize = 0;
}
}
+#undef APREF
/*
* create a list of variables
if (!(var = (struct variable *) ECPGalloc(sizeof(struct variable), lineno)))
return false;
+#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
+ ECPGget_variable(ap, type, var, true);
+#else
ECPGget_variable(&ap, type, var, true);
+#endif
/* if variable is NULL, the statement hasn't been prepared */
if (var->pointer == NULL)
bool ECPGstore_result(const PGresult *results, int act_field,
const struct statement * stmt, struct variable * var);
bool ECPGstore_input(const int, const bool, const struct variable *, const char **, bool *);
+#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
+ // work around a gcc/ABI bug with va_lists on ppc+amd64
+void ECPGget_variable(va_list, enum ECPGttype, struct variable *, bool);
+#else
void ECPGget_variable(va_list *, enum ECPGttype, struct variable *, bool);
+#endif
/* SQLSTATE values generated or processed by ecpglib (intentionally
* not exported -- users should refer to the codes directly) */