[Dbix-class] Race condition in find_or_create()

Tobias Kremer list at funkreich.de
Mon Aug 25 10:15:18 BST 2008


Quoting Matt S Trout <dbix-class at trout.me.uk>:
> On Mon, Aug 04, 2008 at 10:32:31AM +0200, Tobias Kremer wrote:
> > Quoting Ash Berlin <ash_cpan at firemirror.com>:
> > > A method on the storage object (which is subclassed to be the
> > > particular type of DBI you are connecting to, eg
> > > DBIx::Class::Storage::DBI::mysql) which parses and encapsulates the
> > > error as returned from the database to mark its type, e.g. FK
> > > constraint violation, duplicate key, etc. etc.
> > > Then you could check $@->type eq 'duplicate_key' or something.

> Doesn't storage go via $self->throw_exception ? If so you could put the
> parsing in there.

You mean overriding throw_exception in the storage-specific subclasses? Sounds
good to me. Would you return a normalized string or rather some sort of
exception object?

--Tobias



More information about the DBIx-Class mailing list