List:MySQL++« Previous MessageNext Message »
From:Earl Miles Date:March 5 2005 6:12am
Subject:Re: Using mysql++ with a server.
View as plain text  
Imperio59 wrote:
> Another option was to start up the connection to the database when the 
> server loads and keep it alive all throughout the duration of a round, 
> but I think that would be a cheap and wrong way to do it...

Believe it or not, this is pretty much the accepted way to do this. 
Keeping connections open is not terribly expensive, unless you have too 
many of them; in which case, what you really should do is have a server 
which holds a connection.

It doesn't sound, to me, like threads will really be your answer. To 
properly utilize a thread, you'll need to have some way to pass data 
from your main program to your thread, and back, and that runs into fun
locking issues that are well beyond this forum.

Lastly, Warren thinks mysql++ is probably thread-safe, but it can't be 
guaranteed. I use mysql++ in a thread on linux, and I seem to be doing 
pretty well with it, but I have a very limited usage of it.

At the very least, you have a fun problem on your hands. Good luck 
solving it!
Using mysql++ with a server.Imperio595 Mar
  • Re: Using mysql++ with a server.Earl Miles5 Mar
    • Re: Using mysql++ with a server.Warren Young5 Mar
  • Re: Using mysql++ with a server.Warren Young5 Mar
Re: Using mysql++ with a server.Imperio597 Mar