[Dbix-class] Constraints within cursor

Peter Edwards peter at dragonstaff.com
Wed Oct 4 10:38:55 CEST 2006


Thanks for the link.

An issue with UPDATE within CURSOR inside a BEGIN/END TRANSACTION block was
fixed recently in SQLite:

http://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked
 Here are other reasons for getting an SQLITE_LOCKED error: 
 ...
 Trying to write to a table while a SELECT is active on that same table. 
 As of check-in [3355] (2006-08-16 after version 3.3.7) this is now allowed.
 http://www.sqlite.org/cvstrac/chngview?cn=3355

It looks like DBD::SQLite will honour that so this problem may go away with
the latest SQLite.

Regards, Peter

-----Original Message-----
From: dbix-class-bounces at lists.rawmode.org
[mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of Daisuke Murase
Sent: 03 October 2006 20:48
To: dbix-class at lists.rawmode.org
Subject: Re: [Dbix-class] Constraints within cursor

You can't call update in ->next loop with SQLite.
This is DBD::SQLite problem, and use $rs->search->all instead of iterator.

Please see below thread for detail.
http://lists.rawmode.org/pipermail/dbix-class/2006-January/thread.html#531

-- 
Daisuke Murase <typester at cpan.org>


On Tue, 3 Oct 2006 19:05:35 +0100, "Peter Edwards" <peter at dragonstaff.com>
wrote:
> I hit a problem recently using DBIx::Class against SQLite.
> 
> I was traversing a set of records using a cursor (or rather ->search then
> ->next which I guess is the same thing) and then doing some updates on
> related records in another table.
> 
> Now I know of old from Oracle that a delete within cursor is the sort of
> thing to cause problems, and in this case I was getting an error saying
the
> SQLite db was locked. The workaround I used was to select the outer
records
> into a perl array then do the updates, which didn't matter in this case as
> the db is only accessed by a single process, but with multiple processes
I'd
> run the risk of inconsistent data.
> 
> Is this something I should be solving with locking statements or some
other
> means?
> 
>  
> 
> Thanks, Peter
> 
>  
> 

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive:
http://www.mail-archive.com/dbix-class@lists.rawmode.org/





More information about the Dbix-class mailing list