[CDBI] can't "SELECT FROM table"

Michael Peters mpeters at plusthree.com
Wed May 10 23:12:48 BST 2006


I'm experiencing some strange, intermittent errors with C::DBI. It usually
happens after an application has been running for a while and it doesn't seem to
affect every apache child (refreshing will not always result in an error), just
a few at a time. We'll end up with a message like this:

  Project::DB::Foo can't SELECT \nFROM   foo\n: DBD::mysql::st execute failed

So it seems that Class:DBI is loosing either the ESSENTIAL columns or the
primary key, or both.

I can sort of reproduce the error if I put this

  __PACKAGE__->db_Main->{FetchHashKeyName} = 'NAME';

Before a call to set_up_table('foo') (using Class:DBI::mysql). It will trigger
that error on almost all subsequent requests, except the first few, which will
have this error:

  "foo has no primary key"

But we haven't seen this second error on the live system.

I've also tried various methods of restarting mysql while the application server
is running to see if maybe somehow the db handle attributes needed by C::DBI
were not getting set, but it works just fine except for a few "Can't connect to
local MySQL" errors.

Thoughts?

-- 
Michael Peters
Developer
Plus Three, LP




More information about the ClassDBI mailing list