Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 25683
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: blblack [...] gmail.com
Requestors: coldguy [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.07005
Fixed in: (no value)



Subject: Invalid cursor state in DBIx::Class::Storage::DBI
When generating a schema using DBIx::Class::Schema::Loader (connecting to a Microsoft SQL Server with DBD::ODBC linked against unixODBC), I repeatedly get the following error: DBD::ODBC::db type_info failed: [unixODBC][FreeTDS][SQL Server]Invalid cursor state (SQL-24000)(DBD: odbc_get_type_info/SQLGetTypeInfo err=-1) at /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/Storage/DBI.pm line 937. This is because MS SQL Server is fussy about letting you do more than one thing on a connection at once. At this point in the routine $sth still has an active result set going, even if it is an empty set. That's enough to keep you from calling $dbh->type_info. I've never had much luck getting SQL Server to use a cursor type that let you do more than one thing on the same connection. If I recall correctly there's something in the FreeTDS implementation that isn't quite there yet (although I think they're working on it). Anyway, I was able to hack around this by adding... $sth->finish; ...after line 931. That's kind of a dirty solution though, because you still need to look up various things stored inside $sth. It appears to work fine now, the data's still there from the last ->execute, but I wouldn't want to count on it working that way with other versions or combinations of software. The right thing to do in this case (for MS SQL and current versions of FreeTDS, anyway) would be to open two connections, or to read everything you need out of $sth first, finish up the statement, and then make your calls to $dbh->type_info. That ought to work for all databases, even ones that are a little dumb like mine. Software versions: Perl 5.8.8 DBIx::Class 0.7005 DBI 1.53 DBD::ODBC 1.13 unixODBC 2.2.12 FreeTDS 0.64 Slackware 11.0.0 MS SQL Server 2000 - 8.00.2039 X86 Build 3790: SP 1
Patched in trunk, should show up in the next release.
marking as resolved, please re-open if 08003 still suffers from this. Thanks for the report.