| 143 | } |
| 144 | |
| 145 | bool CScoreWorker::LoadBestTime(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize) |
| 146 | { |
| 147 | const auto *pData = dynamic_cast<const CSqlLoadBestTimeRequest *>(pGameData); |
| 148 | auto *pResult = dynamic_cast<CScoreLoadBestTimeResult *>(pGameData->m_pResult.get()); |
| 149 | |
| 150 | char aBuf[512]; |
| 151 | // get the best time |
| 152 | str_format(aBuf, sizeof(aBuf), |
| 153 | "SELECT Time FROM %s_race WHERE Map=? ORDER BY `Time` ASC LIMIT 1", |
| 154 | pSqlServer->GetPrefix()); |
| 155 | if(!pSqlServer->PrepareStatement(aBuf, pError, ErrorSize)) |
| 156 | { |
| 157 | return false; |
| 158 | } |
| 159 | pSqlServer->BindString(1, pData->m_aMap); |
| 160 | |
| 161 | bool End; |
| 162 | if(!pSqlServer->Step(&End, pError, ErrorSize)) |
| 163 | { |
| 164 | return false; |
| 165 | } |
| 166 | if(!End) |
| 167 | { |
| 168 | pResult->m_CurrentRecord = pSqlServer->GetFloat(1); |
| 169 | } |
| 170 | |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | // update stuff |
| 175 | bool CScoreWorker::LoadPlayerData(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize) |
nothing calls this directly
no test coverage detected