void worker_thread(const int job_id) { // init database connection DBManager dbm = DBManager("localhost", "user_name", "password", "db_name", 0); DBJob job = dbm.get_job(job_id); cout << "job terms: " << job.getTerms() << ", job type: " << job.getType() << endl; vector<string> queries = split(job.getTerms(), '$'); vector<job_data> matches = ldp.get_matches(queries, job.getType()); if (job.getType() == 1) { // build results as $-separated string string results_str = build_result_str(matches); cout << "result string: " << results_str << endl; dbm.update_completed_type134(job_id, results_str, job.getType()); } else if (job.getType() == 2) { // return 10 options for start and end terms dbm.update_completed_type2(job_id, matches[0].result, matches[1].result); } else if (job.getType() == 3 || job.getType() == 4) { dbm.update_completed_type134(job_id, matches[0].result, job.getType()); } // clean up and close dbm.close(); }