| 213 | } |
| 214 | |
| 215 | void CBackup::ProcessQueries() |
| 216 | { |
| 217 | for(int JobNum = 0;; JobNum++) |
| 218 | { |
| 219 | m_pShared->m_NumBackup.Wait(); |
| 220 | CSqlExecData *pThreadData = m_pShared->m_aQueries[JobNum % std::size(m_pShared->m_aQueries)].get(); |
| 221 | |
| 222 | // work through all database jobs after OnShutdown is called before exiting the thread |
| 223 | if(pThreadData == nullptr) |
| 224 | { |
| 225 | m_pShared->m_NumWorker.Signal(); |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | if(pThreadData->m_Mode == CSqlExecData::ADD_SQLITE && |
| 230 | pThreadData->m_Ptr.m_Sqlite.m_Mode == CDbConnectionPool::Mode::WRITE_BACKUP) |
| 231 | { |
| 232 | m_pWriteBackup = CreateSqliteConnection(pThreadData->m_Ptr.m_Sqlite.m_Filename, true); |
| 233 | } |
| 234 | else if(pThreadData->m_Mode == CSqlExecData::WRITE_ACCESS && m_pWriteBackup.get()) |
| 235 | { |
| 236 | bool Success = CDbConnectionPool::ExecSqlFunc(m_pWriteBackup.get(), pThreadData, Write::BACKUP_FIRST); |
| 237 | if(m_DebugSql || !Success) |
| 238 | dbg_msg("sql", "[%i] %s done on write backup database, Success=%i", JobNum, pThreadData->m_pName, Success); |
| 239 | } |
| 240 | m_pShared->m_NumWorker.Signal(); |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | // the worker threads executes queries on mysql or sqlite. If we write on |
| 245 | // a mysql server and have a backup server configured, we'll remove the |
no test coverage detected