Multiple users

Multiple users

Postby charliejo » Thu 19 Jan 2006 07:58

Hello,
If 2 users update in the same time the same records,how MyDAC resolve the problem?
Is it possible to lock the record when the first user update it... and the second user must wait the record be free?

Thanks
charliejo
 
Posts: 11
Joined: Mon 02 Jan 2006 12:53

Postby Ikar » Thu 19 Jan 2006 15:18

Yes it's possible. Please see Mydac\Demos\Win32\Lock\ for example.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby charliejo » Thu 19 Jan 2006 16:03

I develop with C++ builder 6. I used code of demo in my application , but it doesn't work. The record isn't lock .
I used MyISAM table.
charliejo
 
Posts: 11
Joined: Mon 02 Jan 2006 12:53

Postby Ikar » Fri 20 Jan 2006 15:02

If the second user had applied Lock with lrImmediately parameter, the other users can't perform any changes with locked record at all. But if they both open the same table and then the first user deletes a record, the second user is not notified of record deletion. To avoid editing deleted record, you should try to lock record before editing and catch error using try...except block.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

if i use second transaction, first transaction canceled.

Postby oquz » Sat 21 Jan 2006 08:33

if i use second transaction, first transaction canceled.

i want to record lock and multi transaction.
oquz
 
Posts: 11
Joined: Mon 02 Jan 2006 15:16

Postby Ikar » Mon 23 Jan 2006 15:09

We can't understand your problem exactly. If you want to use more than one transaction using one MyConnection, it's nested transactions. Nested
transactions are not supported by MySQL Server. Quotation from MySQL manual: "Transactions cannot be nested. This is a consequence of the implicit COMMIT performed for any current transaction when you issue a START TRANSACTION statement or one of its synonyms."
Try to use more MyConnection instances. If transaction that locked a record was rolled back, the record automatically gets unlocked
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

one connection one active transaction.

Postby oquz » Tue 24 Jan 2006 11:49

one connection one active transaction.

but i want to one connection multi active transaction.
this problem is belong to mysql.

thanks ikar.
oquz
 
Posts: 11
Joined: Mon 02 Jan 2006 15:16


Return to MySQL Data Access Components