Fixed in 1.10 released about 10 minutes ago ;)

Sorry for the wait.

Jeff

> -----Original Message-----
> From: Jenda Krynicky [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 20, 2004 9:51 AM
> To: Jeff Urlwin
> Cc: [EMAIL PROTECTED]
> Subject: RE: :ODBC, MSSQL, output params
> 
> 
> From: "Jeff Urlwin" <[EMAIL PROTECTED]>
> > It could be a bug.  Can you wrap up a quick test case and 
> I'll trace 
> > it through?
> > 
> > Regards,
> > 
> > Jeff
> 
> Sorry for the delay.
> 
> #!perl
> use DBI;
> 
> my $PROC = <<'*END*';
> CREATE PROCEDURE dbo.GetL__ocationInfo(
>       @LocationID Int,
>       @City varchar(50) OUTPUT,
>       @State varchar(50) OUTPUT,
>       @Country char(2) OUTPUT,
>       @Zip char(5) OUTPUT
> ) AS
> BEGIN
>       SET @Zip = '12345';
>       SET @State = 'Whatever';
>       SET @Country = 'US'
>       SET @City = 'Some City ' + Convert(varchar(10), @LocationID) END
> *END*
> 
> $db = DBI->connect('dbi:ODBC:xxxx', 'xxx', 'xxx',
>       {PrintError => 0,RaiseError => 1,LongReadLen => 
> 65536,AutoCommit => 
> 1});
> 
> $db->do($PROC);
> 
> eval{
>       {
>               my ($JobCity, $JobState, $JobCountry, $JobZIP);
>               # this one returns just one char in each output 
> variable in the 
> first call
> #             my ($JobCity, $JobState, $JobCountry, $JobZIP) 
> = ('','','','');
>               # this one returns just one char in each output 
> variable in the 
> first call
> #             my ($JobCity, $JobState, $JobCountry, $JobZIP) 
> = ( " "x 50, " "x 
> 50, "  ", " "x 5);
> #             my ($JobCity, $JobState, $JobCountry, $JobZIP) 
> = ("\0" x 50, "\0" 
> x 50, "\0" x 2, "\0" x 5, );
>               # the two above work fine
> #             my ($JobCity, $JobState, $JobCountry, $JobZIP) 
> = ( " "x 3, " "x 3, 
> " ", " "x 3);
> #             my ($JobCity, $JobState, $JobCountry, $JobZIP) 
> = ( " ", " ", " ", 
> " ");
>               # it's strange but these two work fine
> 
>               my $sp = $db->prepare('EXEC 
> dbo.GetL__ocationInfo '. join(', 
> ',('?') x 5));
>               $sp->bind_param_inout(2, \$JobCity, 50, 
> DBI::SQL_VARCHAR);
>               $sp->bind_param_inout(3, \$JobState, 50, 
> DBI::SQL_VARCHAR);
>               $sp->bind_param_inout(4, \$JobCountry, 2, 
> DBI::SQL_VARCHAR);
>               $sp->bind_param_inout(5, \$JobZIP, 5, DBI::SQL_VARCHAR);
> 
>               sub GetLocation {
>                       $sp->bind_param(1, $_[0]);
>                       $sp->execute();
>                       $_[1] = $JobCity;
>                       $_[2] = $JobState;
>                       $_[3] = $JobCountry;
>                       $_[4] = $JobZIP;
>               }
>       }
> 
>       my ($JobCity, $JobState, $JobCountry, $JobZIP);
> 
>       GetLocation( 10, $JobCity, $JobState, $JobCountry, $JobZIP);
>       print "'" .  join( "', '", $JobCity, $JobState, $JobCountry, 
> $JobZIP) . "'\n";
> 
>       GetLocation( 15456, $JobCity, $JobState, $JobCountry, $JobZIP);
>       print "'" .  join( "', '", $JobCity, $JobState, $JobCountry, 
> $JobZIP) . "'\n";
> 
>       GetLocation( 15457716, $JobCity, $JobState, 
> $JobCountry, $JobZIP);
>       print "'" .  join( "', '", $JobCity, $JobState, $JobCountry, 
> $JobZIP) . "'\n";
> };
> 
> $db->do('DROP PROCEDURE dbo.GetL__ocationInfo');
> __END__
> 
> 
> If I do not initialize the variables or initialize them to '' then 
> the first call returns just the first characters of the return 
> values, in all other cases it works correctly.
> The second and following calls work fine, even if the values are 
> longer than the ones returned before.
> 
> # $Id: DBI.pm,v 11.43 2004/02/01 11:16:16 timbo Exp $ 
> $DBI::VERSION = "1.43"; # ==> ALSO update the version in the pod text 
> below!
> 
> 
> # $Id: ODBC.pm 124 2004-02-22 15:57:00Z jurl $ 
> $DBD::ODBC::VERSION = '1.07';
> 
> This is perl, v5.8.0 built for MSWin32-x86-multi-thread
> ...
> Binary build 805 provided by ActiveState Corp. 
> http://www.ActiveState.com
> Built 18:08:02 Feb  4 2003
> 
> Microsoft SQL Server  2000 - 8.00.760 (Intel X86)   Dec 17 2002 
> 14:22:05   Copyright (c) 1988-2003 Microsoft Corporation  Enterprise 
> Edition on Windows NT 5.0 (Build 2195: Service Pack 4) 
> 
> 
> Thanks, Jenda
> ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>       -- Terry Pratchett in Sourcery
> 

Reply via email to