Page 1 of 1

Multiple users

Posted: Thu 19 Jan 2006 07:58
by charliejo
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

Posted: Thu 19 Jan 2006 15:18
by Ikar
Yes it's possible. Please see Mydac\Demos\Win32\Lock\ for example.

Posted: Thu 19 Jan 2006 16:03
by charliejo
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.

Posted: Fri 20 Jan 2006 15:02
by Ikar
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.

if i use second transaction, first transaction canceled.

Posted: Sat 21 Jan 2006 08:33
by oquz
if i use second transaction, first transaction canceled.

i want to record lock and multi transaction.

Posted: Mon 23 Jan 2006 15:09
by Ikar
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

one connection one active transaction.

Posted: Tue 24 Jan 2006 11:49
by oquz
one connection one active transaction.

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

thanks ikar.