Re: MySQL IV vs PV
[email protected] ("Martin J. Evans" via dbi-users) Tue, 14 Nov 2017 09:08:28 +0000
| Newsgroups | perl.dbi.users |
|---|---|
| Message-ID | <[email protected]> |
On 13/11/17 17:43, James Cloos wrote: > Is there anything in a db handle or statement handle one use to know > whether the running instance of DBD::MySQL will return integer columns > as IV? > > I'm adding some code to a layer atop DBI which will force IV (via +=0), > but want to avoid doing that were it is not required. > > The particular code path serializes the returned rows via JSON::XS, > hense the need. > > -JimC > See http://search.cpan.org/~timb/DBI-1.637/DBI.pm#sql_type_cast http://search.cpan.org/~mjevans/DBD-ODBC-1.56/ODBC.pm#DiscardString http://search.cpan.org/~mjevans/DBD-ODBC-1.56/ODBC.pm#StrictlyTyped These attributes are implemented in DBD::Oracle and DBD::ODBC and allow the caller of bind_param to stipulate it wants an integer instead of a string. They were originally implemented by me (with Tim's help) when I was retrieving result-sets which I wanted to convert to JSON. JSON treats numbers and string differently and I required numbers to be numbers and not strings. There is of course, the type argument to bind_param as well. Best of luck. Martin