Simultaneous accesses to the same table. How to avoid conflicts?

Simultaneous accesses to the same table. How to avoid conflicts?

am 15.07.2005 22:12:28 von personel personel

--0-1250296089-1121458348=:80816
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit


Hello,

I have just began to use MySQL server. I would like to run the server on system A and be able to connect simultaneously to the SAME table from multiple other systems (maximum 5). These clients could access the same row and column of the table. One of the row is a counter. Each time a client accesses the table it does the following queries:

1) read the curent value of counter;

2) update the value of counter (ie +1)

How can I prevent conflicts between the clients? Is there a mechanism in MySQL server? Or do I need to use the multithread library of MSVC++ 6.0 (mutex)?

Thank you!

P. Lalonde,

Canada,

lepascal01@yahoo.com



---------------------------------
Start your day with Yahoo! - make it your home page
--0-1250296089-1121458348=:80816--

Re: Simultaneous accesses to the same table. How to avoid conflicts?

am 15.07.2005 23:43:33 von oceanare pte ltd

Hi,

personel personel wrote:
>
> 1) read the curent value of counter;
>
> 2) update the value of counter (ie +1)
>
> How can I prevent conflicts between the clients? Is there a mechanism in MySQL server? Or do I need to use the multithread library of MSVC++ 6.0 (mutex)?
>
MySQL has certain commands to lock records. Check the handbook for details.

Erich

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

RE: Simultaneous accesses to the same table. How to avoid conflicts?

am 21.07.2005 01:22:33 von jbonnett

Older versions of MySQL support only the LOCK TABLE command to lock the
entire table while you make potentially conflicting updates. With the
newer versions, providing you use transaction safe table types like
InnoDb, you can use the standard SQL BEGIN/COMMIT syntax to control
conflicts in the situation you outline.

John B.

-----Original Message-----
From: Erich Dollansky [mailto:oceanare@pacific.net.sg]=20
Sent: Saturday, 16 July 2005 7:14 AM
To: personel personel
Cc: win32@lists.mysql.com
Subject: Re: Simultaneous accesses to the same table. How to avoid
conflicts?

Hi,

personel personel wrote:
>=20
> 1) read the curent value of counter;
>=20
> 2) update the value of counter (ie +1)
>=20
> How can I prevent conflicts between the clients? Is there a mechanism
in MySQL server? Or do I need to use the multithread library of MSVC++
6.0 (mutex)?
>=20
MySQL has certain commands to lock records. Check the handbook for
details.

Erich


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org