Skip Menu |

This queue is for tickets about the DBD-ADO CPAN distribution.

Report information
The Basics
Id: 52048
Status: resolved
Priority: 0/
Queue: DBD-ADO

People
Owner: Nobody in particular
Requestors: frioux [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Bind Length messes up after first prepare
This is really weird. So if you do a query where the first param is *shorter* than later params the later params cause undef to be returned. It's easier to see in code than with words. #!perl use strict; use warnings; use DBI; my $dbh = DBI->connect('DBI:ADO:PROVIDER=sqlncli10;SERVER=tcp:10.6.0.9;MARS Connection=True;Initial Catalog=CIS_dev;UID=cis_web;PWD=elided;'); #my $dbh = DBI->connect('dbi:ODBC:dsn=CIS;UID=cis_web;PWD=elided;'); # <-- works no matter what my $sth = $dbh->prepare(' SELECT exp_date FROM User_Products WHERE ( product_name = ? AND user_id = ? )'); #for (qw{PF DMF }) { # <-- returns undef on the second result for (qw{ DMF PF }) { # <-- works fine $sth->execute($_, 'wesm'); while (my @row = $sth->fetchrow_array) { print @row; } print "\n"; } Thanks much!
Here is the DBI trace (1) when I do this: Broken: <- prepare(' SELECT exp_date FROM User_Products WHERE ( product_name = ? AND user_id = ? )')= DBI::st=HASH(0x2c32e64) at wtfi swrong.pl line 12 <- execute('PF', 'wesm')= -1 at wtfiswrong.pl line 17 <- fetchrow_array= ( '12/21/2012' ) [1 items] row1 at wtfiswrong.pl line 18 <- fetchrow_array= ( ) [0 items] row1 at wtfiswrong.pl line 18 12/21/2012 <- execute('DMF', 'wesm')= '0E0' at wtfiswrong.pl line 17 <- fetchrow_array= ( ) [0 items] at wtfiswrong.pl line 18 <- DESTROY(DBI::st=HASH(2c32ea4))= undef <- FETCH('Active')= 1 at ADO.pm line 986 Working: <- prepare(' SELECT exp_date FROM User_Products WHERE ( product_name = ? AND user_id = ? )')= DBI::st=HASH(0x2c32e64) at wtfi swrong.pl line 12 <- execute('DMF', 'wesm')= -1 at wtfiswrong.pl line 17 <- fetchrow_array= ( '12/21/2012' ) [1 items] row1 at wtfiswrong.pl line 18 <- fetchrow_array= ( ) [0 items] row1 at wtfiswrong.pl line 18 12/21/2012 <- execute('PF', 'wesm')= -1 at wtfiswrong.pl line 17 <- fetchrow_array= ( '12/21/2012' ) [1 items] row1 at wtfiswrong.pl line 18 <- fetchrow_array= ( ) [0 items] row1 at wtfiswrong.pl line 18 12/21/2012 <- DESTROY(DBI::st=HASH(2c32ea4))= undef <- FETCH('Active')= 1 at ADO.pm line 986
On Di. 24. Nov. 2009, 18:23:57, frew wrote: Show quoted text
> This is really weird. So if you do a query where the first param is > *shorter* than later params the later params cause undef to be
returned. Thanks for the bug report! Looks like this SQLOLEDB bug <http://search.cpan.org/~sgoeldner/DBD-ADO-2.97/lib/DBD/ ADO.pm#ADO_providers> It seems that all SQL Server clients (ADO Provider) have this strange behavior - and not only for INSERT buffer. Does the ado_size workaround work for you? Steffen