From 645913c9d4cc7126475f110b3c7d55bc2f4bc5f0 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 24 Jun 2020 13:38:12 +0800 Subject: [PATCH] 1 --- a8/mysql.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/a8/mysql.cc b/a8/mysql.cc index 604b5a2..d605e3d 100644 --- a/a8/mysql.cc +++ b/a8/mysql.cc @@ -143,7 +143,8 @@ namespace a8 int Query::ExecQuery(const char* querystr, std::vector args) { impl_->FreeLastDataSet(); - int err = mysql_query(impl_->Conn(), FormatSql(querystr, args).c_str()); + std::string real_sql = FormatSql(querystr, args).c_str(); + int err = mysql_query(impl_->Conn(), real_sql.c_str()); if(err == 0){ impl_->mysqlres = mysql_store_result(impl_->Conn()); if(RowsNum() > 0){ @@ -157,7 +158,8 @@ namespace a8 bool Query::ExecScript(const char* scriptstr, std::vector args) { impl_->FreeLastDataSet(); - return mysql_query(impl_->Conn(), FormatSql(scriptstr , args).c_str()) == 0; + std::string real_sql = FormatSql(scriptstr , args).c_str(); + return mysql_query(impl_->Conn(), real_sql.c_str()) == 0; } std::string Query::FormatSqlEx(const char* fmt, std::vector args)