Hi,
I have a question which is related to numeric data type bugs on ECPG sqlda.
Currently, I think following functions have a problem when using numeric data type on sqlda.
Please see the details of problem from the mail I sent before.
[src/ecpg/ecpglib/sqlda.c]
- ecpg_set_native_sqlda()
- sqlda_common_total_size()
- ecpg_set_compat_sqlda()
However, I think some codes which have problem in ecpg_set_compat_sqlda() are not used.
On ecpg_set_compat_sqlda(), there are own cases for numeric and decimal data type.
-------------
ecpg_set_compat_sqlda(int lineno, struct sqlda_compat **_sqlda, const PGresult *res, int row, enum COMPAT_MODE compat)
{
for (i = 0; i < sqlda->sqld; i++)
{
switch (sqlda->sqlvar[i].sqltype)
{
case ECPGt_decimal:
ecpg_sqlda_align_add_size(offset, sizeof(double), sizeof(double), &offset, &next_offset);
case ECPGt_numeric:
ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->ndigits + 1, &offset, &next_offset);
-------------
ecpg_set_compat_sqlda() is used only when INFORMIX_MODE(stmt->compat) is true.
-------------
bool
ecpg_process_output(struct statement *stmt, bool clear_result)
{
if (INFORMIX_MODE(stmt->compat))
{
sqlda_new = ecpg_build_compat_sqlda(stmt->lineno, stmt->results, i, stmt->compat);
ecpg_set_compat_sqlda(stmt->lineno, _sqlda, stmt->results, i, stmt->compat);
}
-------------
However, numeric data type could be changed to decimal by ecpg_build_compat_sqlda() in this case.
-------------
ecpg_build_compat_sqlda(int line, PGresult *res, int row, enum COMPAT_MODE compat)
{
sqlda->sqlvar[i].sqltype = sqlda_dynamic_type(PQftype(res, i), compat);
sqlda_dynamic_type(Oid type, enum COMPAT_MODE compat)
{
switch (type)
{
case NUMERICOID:
return INFORMIX_MODE(compat) ? ECPGt_decimal : ECPGt_numeric;
-------------
Could we remove some codes for numeric in ecpg_set_compat_sqlda()?
Regards,
Daisuke, Higuchi