This is the same problem as the one I described the solution to in my previous
email today. If you apply the change I posted, this test of yours works.

Martin

On 25-Jul-2002 Joe Tebelskis wrote:
> Here is a script that exercises another bug in DBD::ODBC 0.45_4.  It creates
> two tables (table1, table2) and a stored procedure (proc1) that simply
> inserts a value into table1.  If you execute proc1, and then try to insert a
> second value into table2, you get the error:
> 
>       "DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]
>       Connection is busy with results for another hstmt (SQL-HY000)
>       (DBD: st_execute/SQLExecute err=-1) at dbtest2.pl line 27."
> 
> On the other hand, if you insert the first value directly (i.e., using
> $direct=1), it works fine.  
> This bug did not exist in version 0.43.  
> Again, I'm using ActivePerl 5.6.1 and DBI 1.201 under Windows 2000, with SQL
> Server.
> 
>   -- Joe
> 
>#!perl -w
> use strict;
> use DBI;
> 
># Connect to the database, and create two tables and a stored procedure:
> my $dbh=DBI->connect() or die "Can't connect";
> 
> eval {$dbh->do("DROP TABLE table1");};
> eval {$dbh->do("CREATE TABLE table1 (i INTEGER)");};
> 
> eval {$dbh->do("DROP TABLE table2");};
> eval {$dbh->do("CREATE TABLE table2 (i INTEGER)");};
> 
> eval {$dbh->do("DROP PROCEDURE proc1");};
> eval {$dbh->do("CREATE PROCEDURE proc1 AS ".
>                 "BEGIN  INSERT INTO table1 VALUES (1);  END");};
> 
># Insert a row into table1, either directly or indirectly:
> my $direct = 0;
> my $sth1 = $dbh->prepare ($direct 
>     ? "INSERT INTO table1 VALUES (1)"
>     : "EXECUTE proc1");
> $sth1->execute();
> 
># Insert a row into table2 (this fails after an indirect insertion):
> my $sth2 = $dbh->prepare ("INSERT INTO table2 VALUES (2)");
> $sth2->execute();
> 
> $dbh->disconnect;

--
Martin J. Evans
Easysoft Ltd, UK
Development

Reply via email to