jeffery sumler wrote:
I'm currently working on a project that involves replacing a number of
scripts that are wrappers around Informix's dbaccess with
DBI/DBD::Informix.

Consider getting SQLCMD from the IIUG software archive (http://www.iiug.org/software). It is designed to replace DB-Access.


An odd issue has cropped up: where dbaccess returns (or formats)
what are I assume floating point types equal to zero as 0.0, DBI
returns 0.00000E+00.

Here's a snippet of a dbaccess dump:

0004010002|O| |0|ML4863CS|S|ML4863CS| |EA|6111.0|AMC09|1.404||||||0.0|0.0|EDI850| | |

and the corresponding line from one of our DBI/DBD::Informix scripts:

0004010002|O||0|ML4863CS|S|ML4863CS||EA|6111|AMC09|1.4040||||||0.00000E+00|0.00000E+00|EDI850|||


All of these scripts create text files that are later fed into Oracle and there are situations in which sqlldr chokes on 0.00000E+00.

Obviously we can munge the output formatting in our scripts with s/// so
this is not a critical issue. We would prefer to not go down that route
however as this Informix -> Oracle transfer is somewhat time sensitive
and the less manipulation we have to do, the better.

I've read the dbi-users archive, the DBD::Informix docs and searched a
variety of other Informix resources with no luck. Does anyone have any
suggestions ?

DBD::Informix is version 1.00.PC2
DBI is version 1.21

1.04.PC2 has different code in dbdimp.ec - function decgen() - to handle formatting, and should avoid the exponential notation on fixed-point decimals. So, one option is to try that; I'm at home and don't have it compiled up so I can't verify it for you tonight.


Alternatively, you can hack the decgen() code to suit yourself. You could probably use the normal ESQL/C decimal formatting functions. DBD::Informix does not because of subtle problems in old versions of ESQL/C.

Or you could hack the code for formatting decimals from SQLCMD (mentioned above) into DBD::Informix. There's a lot of commonality, but also some slight differences (dec_sci() is a newer version of decsci(), and dec_fix() is a newer version of decfix()).

I unfortunately have no control over the Informix db so upgrades are
impractical if not impossible.

The database does not need to be upgraded for this to be fixed.


We're trying to make the DBI based replacement for the dbaccess wrappers
as generic as possible so using printf or sprintf on our query results
to control the formatting really isn't practical. The deprecated $#
variable has no effect.

The decimal formatting code goes nowhere near Perl at that point.


I suspect that somewhere something like

printf "%E", $foo;

is happening but I have no idea where . . . .

More or less - see above.




--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED]) #include <disclaimer.h>
Guardian of DBD::Informix 1.04.PC1 -- http://dbi.perl.org/




Reply via email to