return OK;
author_results_table = malloc(a_id_max * sizeof(struct search_results)); title_results_table = malloc(i_id_max * sizeof(struct search_results)); for (i = 0; i < a_id_max; i++) { for(j = 0; j < PROMOTIONAL_ITEMS_MAX; j++) { author_results_table[i].i_related[j] = 0; author_results_table[i].i_thumbnail[j] = 0; } } for (i = 0; i < i_id_max; i++) { for(j = 0; j < PROMOTIONAL_ITEMS_MAX; j++) { title_results_table[i].i_related[j] = 0; title_results_table[i].i_thumbnail[j] = 0; } }  warm_up_thread_id = (pthread_t *) malloc(db_thread * sizeof(pthread_t)); range = (struct table_range *) malloc(db_thread * sizeof(struct table_range));   author_step = a_id_max / db_thread; title_step = i_id_max / db_thread; range[0].author_start = 0; range[0].author_end = author_step - 1; range[0].title_start = 0; range[0].title_end = title_step - 1; for (i = 1; i < db_thread; i++) { range[i].author_start = range[i - 1].author_end + 1; range[i].author_end = range[i].author_start + author_step - 1; range[i].title_start = range[i - 1].title_end + 1; range[i].title_end = range[i].title_start + title_step - 1; } if (db_thread > 1) {   range[db_thread - 1].author_end = a_id_max - 1; range[db_thread - 1].title_end = i_id_max - 1; }  if (sanity_check == 1) { printf("thread      a_id range      i_id range\n"); for (i = 0; i < db_thread; i++) { printf("%6d  %5d to %5d  %5d to %5d\n", i, range[i].author_start + 1, range[i].author_end + 1, range[i].title_start + 1, range[i].title_end + 1); } }   for (i = 0; i < db_thread; i++) { if (pthread_create(&warm_up_thread_id[i], NULL, warm_up_cache, (void *) &range[i]) != 0) { printf("warm_up thread create failed"); return NULL; } sleep(1); } printf("%d rows to retrieve.\n", a_id_max + i_id_max); warm_up = 1;   for (i = 0; i < db_thread; i++) { pthread_join(warm_up_thread_id[i], NULL); }  printf("Cache is warm.\n");  if (sanity_check == 1) { printf("Data sanity check.\n");   printf("Results for a_lname search:\n"); printf("%10s %3s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s\n", "a_id", "#", "i_r1", "i_t1", "i_r2", "i_t2", "i_r3", "i_t3", "i_r4", "i_t4", "i_r5", "i_t5"); for (i = 0; i < a_id_max; i++) { printf("%10d %3d", i + 1, author_results_table[i].record_number); for(j = 0; j < PROMOTIONAL_ITEMS_MAX; j++) { printf(" %10lld %10lld", author_results_table[i].i_related[j], author_results_table[i].i_thumbnail[j]); } printf("\n");  printf("\t%10s %20s %20s %60s\n", "i_id", "a_fname", "a_lname", "i_title"); for (j = 0; j < author_results_table[i].record_number; j++) { printf("\t%10lld %20s %20s %60s\n", author_results_table[i].search_results[j].i_id, author_results_table[i].search_results[j].a_fname, author_results_table[i].search_results[j].a_lname, author_results_table[i].search_results[j].i_title); } printf("\n"); }   printf("Results for i_title search:\n"); printf("%10s %3s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s\n", "a_id", "#", "i_r1", "i_t1", "i_r2", "i_t2", "i_r3", "i_t3", "i_r4", "i_t4", "i_r5", "i_t5"); for (i = 0; i < i_id_max; i++) { printf("%10d %3d", i + 1, title_results_table[i].record_number); for(j = 0; j < PROMOTIONAL_ITEMS_MAX; j++) { printf(" %10lld %10lld", title_results_table[i].i_related[j], title_results_table[i].i_thumbnail[j]); } printf("\n");  printf("\t%10s %20s %20s %60s\n", "i_id", "a_fname", "a_lname", "i_title"); for (j = 0; j < title_results_table[i].record_number; j++) { printf("\t%10lld %20s %20s %60s\n", title_results_table[i].search_results[j].i_id, title_results_table[i].search_results[j].a_fname, title_results_table[i].search_results[j].a_lname, title_results_table[i].search_results[j].i_title); } printf("\n"); } printf("Data sanity check complete.\n"); }  return NULL;
int init_cache(int item, char *sname, char *uname, char *auth){	int rc;	author_results_table=malloc(item/10*sizeof(struct search_results));		title_results_table=malloc(item/5*sizeof(struct search_results));		if ((rc=odbc_init(sname, uname, auth))!=OK)	{		return W_ERROR;	}	return OK;}