#include "FavoriteCfg.h" #include "BaseConfig.h" FavoriteCfg::FavoriteCfg() {} FavoriteCfg::~FavoriteCfg() {} void FavoriteCfg::GetUpdateSql(std::vector& ups) { char buffer[512]; string strtemp = "INSERT INTO %s(%s,%s,%s) VALUES('%s',"; sprintf_s(buffer, sizeof(buffer), strtemp.c_str(), BaseConfig::TABLE_NAME.c_str(), BaseConfig::FIELD_CONFIG_NAME.c_str(), BaseConfig::FIELD_CONFIG_CODE.c_str(), BaseConfig::FIELD_CONFIG_VALUE.c_str(), FavoriteCfg::CONFIG_NAME.c_str() ); string strsql = string(buffer) + "'%s','%s')"; std::map::iterator it; for (it = mFavoriteMap.begin(); it != mFavoriteMap.end(); it++) { sprintf_s(buffer, sizeof(buffer), strsql.c_str(), it->first.c_str(), it->second.c_str()); ups.push_back(buffer); } } void FavoriteCfg::Add(std::string name, std::string value) { mFavoriteMap[name] = value; } string FavoriteCfg::CONFIG_NAME ="Favorite";