Re: [Dbix-class] Race condition in find_or_create()

2008-08-25 Thread Tobias Kremer
Quoting Matt S Trout [EMAIL PROTECTED]: On Mon, Aug 04, 2008 at 10:32:31AM +0200, Tobias Kremer wrote: Quoting Ash Berlin [EMAIL PROTECTED]: 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)

Re: [Dbix-class] Race condition in find_or_create()

2008-08-24 Thread Matt S Trout
On Mon, Aug 04, 2008 at 10:32:31AM +0200, Tobias Kremer wrote: Quoting Ash Berlin [EMAIL PROTECTED]: 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

Re: [Dbix-class] Race condition in find_or_create()

2008-08-07 Thread Tobias Kremer
Guys, any comments on how we are going to pull this off would be greatly appreciated :) Thanks! --Tobias Quoting Tobias Kremer [EMAIL PROTECTED]: Quoting Ash Berlin [EMAIL PROTECTED]: A method on the storage object (which is subclassed to be the particular type of DBI you are connecting

Re: [Dbix-class] Race condition in find_or_create()

2008-08-04 Thread Tobias Kremer
Quoting Ash Berlin [EMAIL PROTECTED]: 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

Re: [Dbix-class] Race condition in find_or_create()

2008-08-03 Thread Matt S Trout
On Fri, Aug 01, 2008 at 12:59:27PM +0200, Hartmaier Alexander wrote: For Oracle that would be the ORA-numbers. Imho lots of the db specific things belong into the DBD modules. Sure. But if there's no predefined DBI API for 'em, then we put the functionality in Storage first, battle test it so

RE: [Dbix-class] Race condition in find_or_create()

2008-08-01 Thread Hartmaier Alexander
For Oracle that would be the ORA-numbers. Imho lots of the db specific things belong into the DBD modules. -Alex From: Oleg Pronin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 11:40 PM To: DBIx::Class user and developer list Subject: Re: [Dbix-class] Race condition in find_or_create

Re: [Dbix-class] Race condition in find_or_create()

2008-07-31 Thread Oleg Pronin
Not quite right. There are two general case: 1) when you except most of queries to not find the row. Then your example is quite ok. eval {create}; if error then find; Most of cases there will be only 1 query. 2) when you expect to find (for example - updating daily stats once per

Re: [Dbix-class] Race condition in find_or_create()

2008-07-31 Thread Oleg Pronin
Do not forget that not all of the world has english databases. Some people use localized postgresql or other. If so it may return errors in other language :) The best way is to use error codes (they are specific in various db servers), but unfortunately, some databases (or database drivers) return