There are a number of approaches which you could take to this.

One option would be to 'pre-assign' rows to a server - so that each server
has a distinct set of rows to work through.

Another would be to use transactions to handle this, so that only one set of
updates actually occur at a time (locking should prevent the processes from
getting the same data, since the objects/rows held in the transaction would
be locked out).

Difficult to say without a better idea of what you are trying to achieve,
though!


Cheers,

Matt

> -----Original Message-----
> From: Thomas Schwanhaeuser [mailto:[EMAIL PROTECTED]
> Sent: 19 June 2004 23:40
> To: [EMAIL PROTECTED]
> Subject: Returning updated rows
> 
> Is it possible that one can return the actual rows, which where
> affected by an update statement?
> 
> What I want to do: I have n rows in a table which symbolize some work,
> which have several servers to do. For this, the table has a column
> called INPROCESS.
> 
> In order that multiple servers can work on the transactions, I'ld like
> that each of them requests 1 row, which is not currently processed  -
> and set's INPROCESS to YES. I have to avoid that two server grab the
> same row...
> 
> My ideas was now something like UPDATE ... INPROCESS=YES WHERE
> INPROCESS=NO ... LIMIT 1 - but of course the application would also
> have to know which item it should process know.
> 
> 
> Thank you in advance for your help.
> 
> 
> Thomas
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to