On 03/06/13 15:31, Greg Sabino Mullane wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


Martin J. Evans wrote:

# $sth is just a select with 4 column
# the first column is an integer and we want to keep it that way
# as the result will be JSONified and we don't want JSON to think it
# is a string and put quotes around it
$sth->bind_col (1, undef, {TYPE => SQL_INTEGER, DiscardString => 1});

Why doesn't the driver simply do sv_setiv unconditionally if the
column is an integer?

It was a lot more complicated than the simple case I've described here. We 
added http://search.cpan.org/~timb/DBI-1.627/DBI.pm#sql_type_cast too and 
strict flag.

Some drivers don't always know something is an integer, some integers in the 
database can be bigger than what will fit in a perl scalar (but they will fit 
in a string), some people have integers in varchar columns but they know they 
are integers... my memory is not good enough to remember all the other reasons.

Martin

Reply via email to