Thanks Alex,

I have tried 'SELECT...FOR UPDATE' with normal DBI module and its working
well where as via DBIx::Class its not working as per requirement.

So, I feel I might missing something in DBIx::Class. do you have any idea
for that?

Thanks,

Hardik Joshi

On Tue, Jun 19, 2012 at 10:40 AM, Alex Erzin <[email protected]> wrote:

> Not sure about DBIx::Class, but according to SQL you not need transaction
> like "transaction begin/commit", but need something like "select for
> update".
> Quote from Mysql manual:
>
> -------
> SELECT ... FOR UPDATE 
> <http://dev.mysql.com/doc/refman/5.6/en/select.html>locks the rows and any 
> associated index entries
> <...>
> Other transactions are blocked from updating those rows, from doing SELECT
> ... LOCK IN SHARE MODE<http://dev.mysql.com/doc/refman/5.6/en/select.html>,
> or from reading the data in certain transaction isolation levels.
> -------
>
>
> 19.06.2012, 08:31, "Hardik Joshi" <[email protected]>:
>
> Hello,
> I have am working on one real time auction application where user used to
> enter new bid based on previous minimum bid value. There is possibility
> that two user will get same minimum value for their next bid. So I would
> like to restrict second user on select statement if already first user has
> fired select statement and waiting for insert statement to complete.
> So could any one can guide me how to deal with such condition in
> DBIx::Class.  I have tried
> eg.
> $schema->storage->txn_begin();
> my $res = $schema->resultset('Test')->search($filter,
> {for=>'update'})->first();
> $schema->resultset('Test')->create($params);
> $schema->storage->txn_commit();
> Thanks,
> Hardik Joshi
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/[email protected]
>
> --
> eaa@
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/[email protected]
>
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to