[Dbix-class] How to

Hardik Joshi hardik.maven at gmail.com
Tue Jun 19 06:36:11 GMT 2012


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 <eaa-home at yandex.ru> 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" <hardik at mavenvista.com>:
>
> 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 =3D $schema->resultset('Test')->search($filter,
> {for=3D>'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/dbix-class@lists.scsys.co.uk
>
> --
> 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/dbix-class@lists.scsys.co.uk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120619/882=
9776a/attachment-0001.htm


More information about the DBIx-Class mailing list