[Dbix-class] Need a pointer

Matt S Trout dbix-class at trout.me.uk
Sat May 3 22:29:08 BST 2008


On Fri, Apr 25, 2008 at 04:40:22PM -0700, Alan Humphrey wrote:
> All -
> 
> I'm not sure if this is a DBIx issue or a Catalyst issue.  I'm starting with
> DBIx based on the error message.  At this point I'm looking for pointers as
> to what to go to figure out this problem.

There's no such thing as 'DBIx', DBIx:: is the namespace prefix for DBI
extensions. If you're going to shorten DBIx::Class, please shorten it to
DBIC.
 
> Scenario:  A Catalyst application using DBIx to access a MSSQL database via
> FreeTDS.  The database lives on a different server than the web app and
> there's a relatively slow connection between the two.  The web app is very
> lightly used.  On occasion the error message below will be returned.  It
> doesn't always happen at the same place and isn't always in InflateColumn.

"Attempt to initiate a new SQL Server operation with results pending."

If I paste that into google without quotes, the first result is:

http://support.microsoft.com/kb/165951

which explains that there's a protocol limitation that means you can't
start a new $sth while there's one currently open that has got rows still
to fetch.
 
> I've gone back to the application code and put in more prefetches and this
> has made a big difference.  At this point I can't duplicate the problem.
> However, I feel that I've just kicked the can down the road and eventually
> this will come back.

Which explains why prefetch fixes it; the code causing the problem was
probably something like

while (my $obj = $rs->next) {
  ...
  my $other_obj = $obj->relation_name;
  ...
}

I'm not sure I'd actually want to get rid of this error, to be honest - it's
almost handy having the database warn you when you've missed a prefetch :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list