[DBD-ADO] bind_param broken in version 2.95?
am 22.07.2006 17:21:13 von jderrick------=_NextPart_000_009F_01C6AD80.F0FF2530
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Hi Everybody,
DBD-ADO version 2.95 appears to have a problem with the bind_param =
command when using the SQL type constants. The problem does not occur =
with version 2.94. See the dbi-users posting "Possible bug in DBD-ADO =
2.94 bind_param" from September 24, 2005 for more info. See below for =
example code, error message received, and the source line in DBD-ADO =
that is causing the error. MS Access is the database being used by the =
example code.=20
Thanks and regards,
John
Error:
Can't use string ("3") as a HASH ref while "strict refs" in use at =
C:/Perl/site/lib/DBD/ADO.pm line 1022.
ADO.pm Source line 1022:
$i->{Size} =3D defined $attr->{ado_size} ? $attr->{ado_size} : length =
$value;
Example code:
use DBI qw(:sql_types);
my $provider =3D "Microsoft.Jet.OLEDB.4.0";
my $datasource =3D "db1.mdb";
my $createSQL =3D <
col1 COUNTER PRIMARY KEY,
col2 DECIMAL(9,2),
col3 VARCHAR(20)
)
END
my $insertSQL =3D "INSERT INTO test1 (col2, col3) VALUES (?, ?)";
my $dbh =3D DBI->connect("dbi:ADO:Provider=3D$provider;Data =
Source=3D$datasource", "", "", {PrintError =3D> 1});
die "could not connect to db $datasource" unless $dbh;
$dbh->do($createSQL) or print "error on create table";
my $sth =3D $dbh->prepare($insertSQL) or die "could not prepare SQL =
insert";
$sth->bind_param(1, 383874379.99, SQL_DECIMAL);
$sth->bind_param(2, "this is a string", SQL_VARCHAR);
$sth->execute();
$dbh->disconnect();
------=_NextPart_000_009F_01C6AD80.F0FF2530--