List:General Discussion« Previous MessageNext Message »
From:Michael Dykman Date:February 4 2008 10:04pm
Subject:Re: lock the row selected by a session and lock those rows for other sessions
View as plain text  
SELECT .... FOR UPDATE

On Feb 4, 2008 4:58 PM, Frederic Belleudy <fredericb@stripped> wrote:
> Hi there, I'm new with innodb and I'm not sure it's good to go with
> innodb for my personnal goals.
>
> Ok, let's assume I 've a table and want to select the first 10 rows from
> that table but I want to be sure that no other scripts will select the
> same rows I've previously got by the first script.
>
> How can I do that?
>
> my table contains one primary key. Let's say id is the column name.
> So my first script is running and select the ids: 1, 2, 3 .... 10
>
> Then that script will play with the returned ids.
> In the same time, I'm running a second script and do the same select.
> But I don't want him to get the first 10 ids.
>
> The only thing I can think about is to lock WRITE my table. I taught
> innodb was able to automatically lock the selected rows and not allowed any
> other script to get the same rows until it's commited...
>
> Tks
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>



-- 
 - michael dykman
 - mdykman@stripped

 - All models are wrong.  Some models are useful.
Thread
lock the row selected by a session and lock those rows for othersessionsFrederic Belleudy4 Feb
  • Re: lock the row selected by a session and lock those rows for other sessionsMichael Dykman4 Feb
    • Re: lock the row selected by a session and lock those rows for othersessionsFrederic Belleudy5 Feb
      • Re: lock the row selected by a session and lock those rows for other sessionsBaron Schwartz5 Feb
Re: lock the row selected by a session and lock those rows for other sessionsBaron Schwartz5 Feb
  • Re: lock the row selected by a session and lock those rows for othersessionsFrederic Belleudy5 Feb