From 39a95f6939417ebc5d8e716ca1664a1da1fc722c Mon Sep 17 00:00:00 2001
From: znone <glyc@sina.com.cn>
Date: Thu, 09 Feb 2017 12:04:19 +0000
Subject: [PATCH] 根据回调函数参数推断绑定的数据类型。

---
 include/qtl_mysql.hpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/qtl_mysql.hpp b/include/qtl_mysql.hpp
index 1c9cf5d..60c552b 100644
--- a/include/qtl_mysql.hpp
+++ b/include/qtl_mysql.hpp
@@ -563,12 +563,13 @@
 	bool open(const char *host, const char *user, const char *passwd, const char *db,
 		unsigned long clientflag=0, unsigned int port=0, const char *unix_socket=NULL)
 	{
+		if(m_mysql==NULL) m_mysql=mysql_init(NULL);
 		return mysql_real_connect(m_mysql, host, user, passwd, db, port, unix_socket, clientflag)!=NULL;
 	}
 	void close()
 	{
 		mysql_close(m_mysql);
-		m_mysql=mysql_init(NULL);
+		m_mysql=NULL;
 	}
 	void refresh(unsigned int options)
 	{

--
Gitblit v1.9.3