make async querying work.
make async querying work.

From mysql 5.1 documentation:

http://dev.mysql.com/doc/refman/5.1/en/threaded-clients.html

* Two threads can't send a query to the MySQL server at the same time on the same connection. In particular, you have to ensure that between calls to mysql_query() and mysql_store_result() no other thread is using the same connection.
* Many threads can access different result sets that are retrieved with mysql_store_result().

* If you use mysql_use_result(), you must ensure that no other thread is using the same connection until the result set is closed. However, it really is best for threaded clients that share the same connection to use mysql_store_result()

So, create a pthread mutex around  calls to mysql_real_query. Only support mysql_store_result for async mode.

beni55/node-mysql-libmysqlclient,Sannis/node-mysql-libmysqlclient,beni55/node-mysql-libmysqlclient,Sannis/node-mysql-libmysqlclient,beni55/node-mysql-libmysqlclient,Sannis/node-mysql-libmysqlclient,beni55/node-mysql-libmysqlclient,beni55/node-mysql-libmysqlclient,Sannis/node-mysql-libmysqlclient