Re: Re: Insert/delete works - more than one person working on same file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <f2hr8u+vp72@xxxxxxxxxxx>, sonalizutshi
<sonalizutshi@xxxxxxxxx> writes
>Thanks for writing.
>
>There can be 2-3 people working on a file at a time. 

When you SELECT the data, you should use the command 
SELECT ... FOR UPDATE

However, your original question seems to be, can more than one person
work on a table at once.  MySQLs internal handling can deal with this
easily.  If that's all you need, you have a simple answer, and can
ignore the rest of this post!

But if you are talking about more than one person updating the same
*record*, then you need the FOR UPDATE clause.

As far as I know, you would need InnoDB tables - but I may be wrong
here.  MySQL standard tables would only support table locking.  This is
going off memory, because although I have done lots of work with locking
on other databases, I have never needed it on MySQL, simply due to
clients requirements.

As to the previous poster asking which is the valid update, then with
record locking, there will only be one person able to update the data,
and this will be the first one to request, and therefore lock, the
record(s) for editing.

If you are updating multiple tables, then you would need transactions,
and watch out for the "deadly handshake" - A cannot complete the update,
because B has the record locked, and B cannot complete their update,
because A has a record locked.  Ensure that the transactions work in a
logical order.  However, many applications simply don't need
transactions, because data is not updated across tables.

And without knowing about your database requirements, perhaps updates
can be made by adding records to another table?  Which is simpler, but
may not be what you need.
 
(and if you top post, then the replies get out of order...)




> 
>>I hope the data base has to be able for
>> dealing with this situation, and you have to decide what level of 
>>security
>
>It is not clear to me how would Database be able to deal with this 
>situation. Do you mind sending me the links of some tutorials that 
>would guide me some approaches?
>
>Thanks
>
>--- In php-objects@xxxxxxxxxxxxxxx, "Altamiro Teixeira de Souza" 
><mirotsster@...> wrote:
>>
>> There´s a lot things to be considered about you question. If the 
>file you
>> are talking about is accessed by a lot of people, what´s the valid 
>update
>> one ? the 1st one, the 2nd one ... the nth one?...  what about 
>every people
>> send an update at the sometime ? I hope the data base has to be 
>able for
>> dealing with this situation, and you have to decide what level of 
>security
>> you need and than use the interface the data base offers to you.
>> 
>> 2007/5/16, sonalizutshi <sonalizutshi@...>:
>> >
>> >   I dont have good experience with PHP and MYSQL. I created a 
>small data
>> > base for the company. My database doesn't handle any 
>transactions.
>> >
>> > I dont check anywhere - Commit and Rollback... I have been 
>reading
>> > about this lately. Although I make use of insert/update/delete
>> > statement.
>> >
>> > I was wondering if more than one person is logged on and working 
>on the
>> > same file, how will insert/update/delete work.
>> >
>> > I know I am asking some silly questions, but can somebody clear 
>my
>> > doubts?
>> >
>> > Thanks

-- 
Pete Clark

Sunny Andalucia
http://www.hotcosta.com/comm_1.htm

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux