Re: DBI and Apache::DBI issues
Perrin Harkins <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
Hi Max, On Sat, Feb 5, 2011 at 10:01 PM, Max Pinton <[email protected]> wrote: > But the issue I'm asking about today is with DBI (1.612) and Apache::DBI > (1.08). In my old configuration they worked fine, but after the upgrade I > started seeing tons of errors like this: > > DBD::mysql::st execute failed: Commands out of sync; you can't run this > command now Are you running the worker MPM? Apache::DBI will do the right thing with prefork MPM, but I don't think it will work with threads. > package My::Foo; > use My::DBI; > my $dbh = My::DBI->connect; > sub new { > my $sth = $dbh->... > } > > Thinking that the problem was that $dbh was having some weird scope issue, I > moved all the connect calls into the subs that use them. Yes, good call. The new() sub creates a closure with $dbh there. - Perrin