On Jul 11, 2014, at 3:15 PM, <willem.meert@stripped<mailto:willem.meert@stripped>>
So basically, your example consists of making 8 threads, each of which do the following work: open a connection, fire off 100 queries, done.
It should work, but in case of problems (database hits connection limit, …), you are not checking anything and you’ll be using a NULL address: if the connection setup fails → cxn will be null → cxn.query will segfault in your for loop;
Actually, I was expecting that any error case would throw an exception with the code as I've written it; i.e. we would crash in a call to std::terminate but not a segfault. I may be mistaken in that regard, too, though. Am I? But please note that these are just silly exercises; i.e., I would most certainly want to add error handling for cases like you mention, Willem, in any kind of "real world" code.
This e-mail and any attachments are confidential. If it is not intended for you, please notify the sender, and please erase and ignore the contents.