Failures in make test for DBD::ODBC with sql server 2005 and Express - possible solution

Failures in make test for DBD::ODBC with sql server 2005 and Express - possible solution

am 01.11.2006 11:46:51 von Martin.Evans

We have had a number of failures in the make test for DBD::ODBC reported to us
when the target database is MS SQL Server 2005 or Express. These failures
occur in the 20SqlServer test and are usually tests 28, 31, 32 and 33 which are
all related to using the asynchronous setting in DBD::ODBC to retrieve
diagnostics in an error handler.

Example test output for failing tests looks like the dump at the bottom of this
email.

There is actually nothing wrong with DBD::ODBC itself, the problem is in the
test code. To fix these test errors:

edit t/20SqlServer, search for:

$sth = $dbh->prepare("dbcc TRACESTATUS(-1)");

and change it to:

$sth = $dbh->prepare("dbcc TRACESTATUS(0)");

Although I understand what the test is trying to do I am unsure exactly what the
best fix is. The above does work, returning what the test expects, but I think
it is possible relying on tracestatus(0) not returning a result set is what
caused this error to occur when MS fixed tracestatus in 2005. If anyone know
this test and can provide any better workarounds of comments I'd like to hear
them.

A failing test looks like:

t/20SqlServer....ok 4/37
# Failed test 'dbcc messages being returned'
t/20SqlServer....NOK 28# in t/20SqlServer.t at line 443.
# '0'
# >
# '0'
t/20SqlServer....ok 29/37Describe failed during DBI::st=HASH(0x9d65010)->FETCH(o
dbc_more_results,0) at t/20SqlServer.t line 453.

# Failed test 'ensure 2 error messages from two print statements'
# in t/20SqlServer.t at line 459.
# got: '3'
# expected: '2'
t/20SqlServer....NOK 31
# Failed test 'validate error messages being retrieved'
# in t/20SqlServer.t at line 460.
# got: 'Connection is busy with results for another hstmt'
# expected: 'END'
t/20SqlServer....NOK 32
# Failed test 'Multiple concurrent statements should fail'
# in t/20SqlServer.t at line 471.
DBI::db=HASH(0x9d1f1cc)->disconnect invalidates 1 active statement handle (eithe
r destroy statement handles or call finish on them before disconnecting) at t/20
SqlServer.t line 473.
t/20SqlServer....ok 36/37# Looks like you planned 37 tests but only ran 36.
# Looks like you failed 4 tests of 36 run.
t/20SqlServer....dubious
Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 28, 31-33, 37
Failed 5/37 tests, 86.49% okay

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com