> 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
How about
:
UPDATE Servers SET Server_Connections_In_Use =
Server_Connections_In_Use+1 WHERE Server_ID =
(SELECT Server_ID WHERE
Servers.Server_Connections_In_Use < Servers.Server_Max_Connections
LIMIT 1)
--
Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com