View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 10:28 AM
qwertycat@googlemail.com
 
Posts: n/a
Default Is it possible to combine a SELECT and UPDATE in a single query

Is it possible to combine both of these queries into a single one so a
connection is reserved immediately when found so a competing script
doesn't take up the connection in between

SELECT Server_ID, Server_Address, Server_Port WHERE
Servers.Server_Connections_In_Use < Servers.Server_Max_Connections
LIMIT 1"

UPDATE Servers SET Server_Connections_In_Use =
Server_Connections_In_Use+1 WHERE Server_ID = '$Server_ID' LIMIT 1

Reply With Quote