Gary/Jim -- please run the test I attached in the previous post responding
to Gary.  It retrieves and integer value as an integer.  Note that
DBI/DBD::ODBC takes the data the way that it's sent by the server/ODBC
driver...

Jeff

>
> Jim;
> I've the same problem with Access2000.
>
> Based upon your e-mail, I think it is due to DBI not knowing how to decode
> the various type values used by different databases.
>
> Try using the  TYPE attribute for the recordset to get the
> pointer to an array of
> type-values for the recordset. Once you have that; you can find
> out what value
> your database provider uses for the integer fields. Then use a
> <Test> ? <True> : <False>
> statement to apply the integer function to the relevant colum(s).
> Worked for me.
>
> I've sent an e-mail out asking if the DBI (or DBD-ODBC) could be
> modified to allow
> casting when binding columns, just as is done when binding
> parameters. This would solve
> the problem nicely.
>
> Hope this helps.
>
> Regards;
> Gary
>
>
> >>> Jim Clark <[EMAIL PROTECTED]> 07/22/2002 9:02:32 PM >>>
> A quick question regarding numeric formatting and SQL Server 2000. I
> have a view set up that has an integer field of length 4. When I fetch
> the data, instead of seeing values such as '1024' as it is displayed in
> SQL Enterprise Manager, the data shows up in my array ref as '1,024.00'.
> I can remove the extra formatting with a little extra code but of course
> would prefer not to do so. Searching the SQL Server docs didn't
> enlighten me at all as to the cause of this. I am testing on an XP
> laptop and PPM tells me both DBI and DBD-ODBC is up to date with current
> ActiveState versions.
>
> Thanks for any help.
>
> -Jim
>
> $sth = $dbh->prepare("SELECT ContactLocationID, ContactLocationName,
> ContactID, UniqueID FROM qryTerritories");
> die "ERROR: Cannot prepare statement: $DBI::errstr\n" unless (defined
> $sth);
> $sth->execute or die $sth->errstr;
> my @territory_rows = $sth->fetchall_arrayref;
> $sth->finish;
>
> @territory_rows = @{ $territory_rows[0] } [0..$#{$territory_rows[0]}]; #
> is this the best way?
> for ($loop=0; $loop < $#territory_rows + 1; $loop++) {
> $territory_rows[$loop][ssContactID] =~ s/,|\.00//g;   # remove extra
> formatting so '1,024.00' becomes '1024'
> $territory_rows[$loop][ssContactID] = int(
> $territory_rows[$loop][ssContactID] ); # '1,024.00' = 1 unless
> substitution of previous line is done
> }
>


Reply via email to