Fix MySQL Wrapper Watcher

This commit is contained in:
Kirigaya Kazuto 2017-12-28 18:14:26 +08:00
parent 621ef36565
commit 35241984e0

View File

@ -90,11 +90,11 @@ int MySQLConn::connect(const std::string& host, const std::string& user, const s
} }
} }
FILE* fp=fopen("sql_log.txt","w"); FILE* fp=[](){FILE* s=fopen("sql_log.txt","a");fprintf(s,"%p=============\n",s);return s;}();
int MySQLConn::exec(const std::string& SQLCommand, const std::function<void(MySQLResult&)>& func) int MySQLConn::exec(const std::string& SQLCommand, const std::function<void(MySQLResult&)>& func)
{ {
fprintf(fp,"%s\n",SQLCommand.c_str()); fprintf(fp,"%p: %s\n",this,SQLCommand.c_str());
fflush(fp); fflush(fp);
if(mysql_real_query(&(pimpl->m),SQLCommand.c_str(),SQLCommand.size())!=0) if(mysql_real_query(&(pimpl->m),SQLCommand.c_str(),SQLCommand.size())!=0)