Re: [PHP] MySQL Locking Question

2001-10-05 Thread Mark
I don't think get_lock will work here anyway since the only way to use it is with persistent connections, and there's no guarantee the person will get the same connection with the second request, he probably won't. without persistent connections the lock will die when the script finishes. On Fri,

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Don Read
On 06-Oct-2001 Chip wrote: >> Well, if you only update the fields that changed then who cares? The >> fields that Jill changes are going to overwrites Jack's changes anyway. >> Locking the record and having Jack finish before Jill can start isn't >> going to change the end result which would be

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Rasmus Lerdorf
> So once a user logs into a MySQL Server via PHP, if they don't logout, they > stay logged in forever??? Depends how you write your application. If you are using persistent connections you log in and out of mysql durig a single request. If you use persistent connections you log in once and

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Chip
So once a user logs into a MySQL Server via PHP, if they don't logout, they stay logged in forever??? Rasmus Lerdorf <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > A. Browser Closed Before Finishing Edit: > > From what I have read Get_Lock

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Rasmus Lerdorf
> A. Browser Closed Before Finishing Edit: > From what I have read Get_Lock locks are automatically released > when connections terminate. I'm new to this so am unsure if MySQL will > terminate the connection when the browser is closed. If not does MySQL > disconnect users after a

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Chip
Hmmm...that is true It would still prevent Jill from editing. I'll probably add a locked_by field to convey the user info. For Dead Locks: A. Browser Closed Before Finishing Edit: From what I have read Get_Lock locks are automatically released when connections terminate. I'm

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Rasmus Lerdorf
> OK that example is poor I admit...but do you see the reasoning behind > locking? If a lock was in place Jill would't be able to edit her post > because she would get a message stating that Admin Jack was allready editing > it. GET_LOCK has no way of conveying that information. You would need

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Chip
> Well, if you only update the fields that changed then who cares? The > fields that Jill changes are going to overwrites Jack's changes anyway. > Locking the record and having Jack finish before Jill can start isn't > going to change the end result which would be that Jill's changes are > going

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Rasmus Lerdorf
> 1. Jack opens record A to change an entry. > 2. Jill opens record A to change an entry. > 3. Jack finishes his changes and saves the data. > 4. Jill finishes her changes and saves the data. Well, if you only update the fields that changed then who cares? The fields that Jill changes are going

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Chip
Well here is the situation. 1. Jack opens record A to change an entry. 2. Jill opens record A to change an entry. 3. Jack finishes his changes and saves the data. 4. Jill finishes her changes and saves the data. Jill just over wrote whatever Jack did. The only method I could think of to prevent

Re: [PHP] MySQL Locking Question

2001-10-05 Thread Rasmus Lerdorf
It is really a bad idea to design a system where locking is required. Are you sure there is no way to build the system to not require locking through the use of atomic updates and such? Anyway, yes, GET_LOCK is just another query as far as PHP is concerned. You can pass it to MySQL via mysql_que