Subject: | DiscardString with SQL_INTEGER not working properly |
use DBI qw(:sql_types);
use strict;
use warnings;
my $dbh = DBI->connect('dbi:ODBC:DSN=baugi','sa','easysoft', {RaiseError
=> 1, PrintError => 0});
eval {
$dbh->do(q/drop table test/);
};
$dbh->do(q/create table test(a varchar(10))/);
$dbh->do(q/insert into test values(?)/, undef, 100);
my $sth = $dbh->prepare('select a from test');
$sth->execute;
my $aa;
$sth->bind_col(1, \$aa, {DiscardString => 1, TYPE => SQL_INTEGER});
$sth->fetch;
outputs:
Argument "d\0\0\0" isn't numeric in subroutine entry at discard.pl line
19.
It is because the returned data is an SQL_INTEGER (4 bytes) and not a
string.
Martin
--
Martin J. Evans
Wetherby, UK