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)