bug in SQLBindCol

"Martin J. Evans" <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Organization Easysoft Ltd
Message-ID <[email protected]>
I appologise in advance for not looking into this any further but I'm very time
poor at the moment (if you are on the dbi-users list you'll know why).

create table test(a numeric(10.6))
insert into test (1000)
SQLBindCol(SQL_C_CHAR, buffer length 11)
  11 is OK as its 4.6 = 11 chrs and bound columns are not null terminated
SQLFetch

you get back "1000.00000" and a length of 11 instead of
"1000.000000" and a length of 11.

This is most noticeable under DBD::OBDC as the 11 is use to create a perl
scalar and so you get whatever trailing garbage is in the 11th chr. i.e. you
often end up with 1000.00000\u0000.

I got around the problem by changing my code to numeric(11.6) and ensuring no
value above 9999 can be entered.

Also, this raised another issue with numeric(10.6) in mysql itself.
If you insert 10000 into a 10.6 it goes in without error but when you read it
back it is 9999.999999.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.