On 25-Jul-2002 Joe Tebelskis wrote:
> Here is another bug in DBD::ODBC 0.45_4.  When I try to insert the legal
> string "" (or undef) into table1, I get the error:
> 
>       DBD::ODBC::st bind_param failed: [Microsoft][ODBC SQL Server Driver]
>       Invalid precision value (SQL-HY104)
>       (DBD: _rebind_ph/SQLBindParameter err=-1) at dbtest4.pl line 12.
> 
> Version 0.43 worked correctly.  (I think the DATETIME type may have a similar
> bug.)
> 
> 
> use DBI qw(:sql_types);
> my $dbh=DBI->connect() or die "Can't connect";
> 
> eval {$dbh->do("DROP TABLE table1");};
> eval {$dbh->do("CREATE TABLE table1 (str VARCHAR(4000))");};
> 
> my $sth = $dbh->prepare ("INSERT INTO table1 (str) VALUES (?)");
> my $str = "";
> $sth->bind_param (1, $str, SQL_LONGVARCHAR);
> $sth->execute();
> 
> $dbh->disconnect;

This fails because the call to SQLBindParameter sets ColumnSize to 0.
cbColDef in dbdimp.c/_dbd_rebind_ph() needs to be set to 1 in this case.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development

Reply via email to