Is there a way to perform this kind of request in one [database] block?
set @a = (SELECT id FROM Name where (locked= 0) Limit 1,1);
select id,Name FROM Name Where id = @a for update;
update Name Set locked = 1 Where id = @a;
If not how can I read a record in mysql and be sure that it is not treated by an other process at the same time ?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
Is there a way to perform this kind of request in one [database] block?
set @a = (SELECT id FROM
Name
where (locked
= 0) Limit 1,1);select
id
,Name
FROMName
Whereid
= @a for update;update
Name
Set locked = 1 Whereid
= @a;If not how can I read a record in mysql and be sure that it is not treated by an other process at the same time ?
Thanks
I solved it in 3 requests and it works, even if ther is various access to the database at the same time.