Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBD-Oracle CPAN distribution.

Report information
The Basics
Id: 49818
Status: resolved
Priority: 0/
Queue: DBD-Oracle

People
Owner: Nobody in particular
Requestors: bohica [...] ntlworld.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.23
Fixed in:
  • 1.24
  • 1.24a
  • 1.24b



Subject: Support binding of integers so they are returned as IVs
Download (untitled) / with headers
text/plain 1.6k
It would be really nice if DBD::Oracle allowed the binding of integers such that bind_col($n, undef, { TYPE => SQL_INTEGER }) actually returned an IV instead of a PV. Here is my specific case: The query I am executing returns a mix of strings and integers which are fetched with fetchall_arrayref. The returned data is then fed into JSON::XS to produce a JSON string. JSON::XS encodes strings as "string" and numbers as number (no quotes) but it detects numbers using: if (SvPOKp (sv)) { STRLEN len; char *str = SvPV (sv, len); encode_ch (enc, '"'); encode_str (enc, str, len, SvUTF8 (sv)); encode_ch (enc, '"'); } else if (SvNOKp (sv)) { // trust that perl will do the right thing w.r.t. JSON syntax. need (enc, NV_DIG + 32); Gconvert (SvNVX (sv), NV_DIG, 0, enc->cur); enc->cur += strlen (enc->cur); } else if (SvIOKp (sv)) { // we assume we can always read an IV as a UV and vice versa // we assume two's complement // we assume no aliasing issues in the union My query returns 209 thousand rows and the JSON encoded data is over 21Mb. 3 of the fields are really numbers so if they are encoded as numbers we lose 2 " around each of the numbers vastly reducing the size of the encoded data. As DBD::Oracle does not support returning columns as integers I have to loop through all 209000 rows adding 0 to each field which is a number to make it an IV - this takes a lot of time - believe me, I've Devel::NYTProf'ed it. I'm sure this would be of general usefulness, I only cite my specific example to help explain why this would be good. Martin -- Martin J. Evans Wetherby, UK
The patch for this has been incorporated into the latest release candidate and trunk and can be found

http://svn.perl.org/modules/dbd-oracle/trunk


or here

http://svn.perl.org/modules/dbd-oracle/trunk/DBD-Oracle-1.24-RC1.tar


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.