DBD::Oracle, Support binding of integers so they are returned as IVs

"Martin J. Evans" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
Hi,

With reference to the rt I created "Support binding of integers so they
are returned as IVs" at http://rt.cpan.org/Public/Bug/Display.html?id=49818

I am now at the point where being unable to bind columns to results-sets
in DBD::Oracle with a bind type of SQL_INTEGER (or whatever) so they
look like integers in Perl is slowing some code of ours down
dramatically. We convert a fetchall_arrayref returned structure into
JSON with JSON::XS and JSON::XS converts strings to "string" and numbers
to a plain number. Our select returns a number of columns which are
really integer columns and as the result-set is very large the extra
space we use encoding integers as "number" is more than just annoying.
JSON::XS appears to know a perl scalar has been used in the context of a
number as if we add 0 to the integer columns returned in
fetchall_arrayref it encodes them as plain numbers instead of strings
like "number" (see the rt for the snippet from JSON::XS which does
this). As a result, a workaround we are using now is to loop through the
rows adding 0 to all integer columns. I believe DBI allows bind_col to
be called without a destination scalar so you can use it to specify the
type of the bind e.g., SQL_INTEGER but still call fetchall_arrayref.

Does anyone know if it is feasible to make this work with DBD::Oracle
and if so do you have some pointers as to how it may be achieved. I am
not looking for anyone else to do the work but would like to sound
people out about the possibility before I launch into it.

Thanks

Martin
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.