Devin Reade writes:
 > In the particular case of this use in libdbi, I've not looked at the
 > code to see to what extent it is an *actual* problem; however as a
 > generalization, I would advise against using ato*() functions and instead
 > use strto*() functions because the latter provides input error checks
 > that the former does not.

I've had a look at libdbi-driver's current ato*() usage. As far as I
can see it is used only to turn raw row data into integers by
functions which do not return values, i.e. without an easy way to
indicate conversion errors. I haven't checked all drivers yet, but I
see two options:

1) make the functions in question return error codes. This would allow
dbd_fetch_row() to return an error code as well. However, an error in
a single field would make the operation fail.

2) use a field flag to tag the affected field only. This would require
users to check integer fields manually, in a similar fashion as you
have to check for NULL values if this is relevant.

What do you think?


Markus Hoenicka
AQ score 38

This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers 
libdbi-users mailing list

Reply via email to