[Dbix-class] SQLite problem (cannot update in iterator loop)
Matt S Trout
dbix-class at trout.me.uk
Thu Jan 19 22:25:26 CET 2006
On Thu, Jan 19, 2006 at 03:07:43PM -0600, Brandon Black wrote:
> On 1/19/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> > Yep. That's because a DBIx::Class resultset is actually a resultset against
> > the database. So when you call ->next it fetches a record and inflates it.
> >
> > That means that in DBD::SQLite you've got an open reader against the table,
> > which locks it so it can't be altered, thus giving you inconsistent data.
> >
> > It doesn't show up on Class::DBI because Class::DBI fetches all data from
> > the sth into an arrayref, instantiates the Iterator with that, and throws
> > the sth away. This, as you can imagine, works really well for iterating over
> > thousands of results ...
> >
>
> So the DBD::SQLite (but not SQLite itself) deficiency referred to
> above is that you cannot loop over a SELECT with $sth->fetchrow_xxx
> and do a seperate $dbh->do('anything') inside the loop?
Certainly not for values of anything that alter a table included in the
SELECT's FROM clause, anyway.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list