On Tuesday 27 January 2009 08:55, Martin Evans wrote:
> Stephen Carville wrote:
> > On Tuesday 27 January 2009 07:21, Martin Evans wrote:
> >> Does anyone know of a way to get numbers (as I've described) back from
> >> DBD::Oracle.
> >
> > If you know the data is integer try:
> >
> >   while($s->fetch) {
> >     push @data, int($num);
> >
> >     etc()
> >   }
>
> I do know it is an integer but so does DBD::Oracle and Oracle. I was
> hoping to avoid doing int($x) or $x+0 or $x*1 etc etc everywhere I had
> an integer, especially since a lot of the code uses fetchall_arrayref
> which means looping though all rows and integer columns changing them or
> changing the code to loop on fetch. I guess I don't see why a known
> integer cannot look like an integer once retrieved without me manually
> changing it.

OK, I see your issue better.  Did you try 

$s->bind_col(1, \$num, {ora_type => ORA_NUMBER});

instead of ORA_LONG?

If worse comes to worst and you know the position of the miscreant data, you 
could use map() to change the columns.  

@data[0,2] = map(int,@data[0,2]);

That doesn't cure the underlying problem but will let you use 
fetchall_arrayref().

> If any other DBDs do something special for integers please let me know
> as I'm thinking of looking at this for DBD::ODBC too.
>
> Martin

-- 
Stephen Carville <[email protected]>
Systems Engineer
Land America
1.626.667.1450 X1326
============================================================
Any security software design that doesn't assume the enemy
possesses the source code is already untrustworthy.
                                           -- Eric Raymond

Reply via email to