//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-BASE_STORE * GetStore()
+STORE * GetStore()
{
return msc.GetStore();
}
return -1;
}
+if (mysql_num_rows(res) != 1)
+{
+ errorStr = "User not found";
+ mysql_close(sock);
+ return -1;
+}
+
row = mysql_fetch_row(res);
string param;
{
i = StrToIPS(ipStr);
}
-catch (string s)
+catch (const string & s)
{
mysql_free_result(res);
errorStr = "User \'" + login + "\' data not read. Parameter IP address. " + s;
return 0;
}
//-----------------------------------------------------------------------------
-int MYSQL_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+int MYSQL_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
time_t lastStat,
const string & login) const
{
endTime.c_str()
);
-int retRes;
map<IP_DIR_PAIR, STAT_NODE>::const_iterator stIter;
-stIter = statTree->begin();
+stIter = statTree.begin();
-while (stIter != statTree->end())
+while (stIter != statTree.end())
{
strprintf(&tempStr,"IP='%s', dir=%d, down=%lld, up=%lld, cash=%f",
inet_ntostring(stIter->first.ip).c_str(),
stIter->second.cash
);
- if( (retRes = MysqlQuery((res+tempStr).c_str(),sock)) )
+ if( MysqlQuery((res+tempStr).c_str(),sock) )
{
errorStr = "Couldn't insert data in WriteDetailedStat:\n";
errorStr += mysql_error(sock);