> I think the problem was with
> default constructor on query object not properly being initialized.
> Once I initialized sqlquery object like this ... mysqlpp::Query
> sqlquery = commonDBCon.query(); , the problem went away
Are you saying that it doesn't work when you pass the query string to
Connection::query()? The examples do this in several places
successfully, and this is an intended feature, so if you can show an
instance where it doesn't work, I'd be interested in seeing compilable
code that shows it.
Not MySQL++ related, but this is highly error-prone code. You should be
using an RAII pattern here to make sure that all code paths that exit
the function release the critical section mutex. It appears fine now,
but future maintenance could add a code path that accidentally doesn't
release the mutex. See the code for MySQL++'s Transaction class -- it's
short -- for the general idea.