long mk_cust(DSS_HUGE n_cust, customer_t * c) { DSS_HUGE i; static int bInit = 0; static char szFormat[100]; if (!bInit) { sprintf(szFormat, C_NAME_FMT, 9, HUGE_FORMAT + 1); bInit = 1; } c->custkey = n_cust; sprintf(c->name, szFormat, C_NAME_TAG, n_cust); V_STR(C_ADDR_LEN, C_ADDR_SD, c->address); c->alen = (int)strlen(c->address); RANDOM(i, 0, (nations.count - 1), C_NTRG_SD); c->nation_code = i; gen_phone(i, c->phone, (long) C_PHNE_SD); RANDOM(c->acctbal, C_ABAL_MIN, C_ABAL_MAX, C_ABAL_SD); pick_str(&c_mseg_set, C_MSEG_SD, c->mktsegment); TEXT(C_CMNT_LEN, C_CMNT_SD, c->comment); c->clen = (int)strlen(c->comment); return (0); }
long mk_supp(DSS_HUGE index, supplier_t * s) { DSS_HUGE i, bad_press, noise, offset, type; static int bInit = 0; static char szFormat[100]; if (!bInit) { sprintf(szFormat, S_NAME_FMT, 9, HUGE_FORMAT + 1); bInit = 1; } s->suppkey = index; sprintf(s->name, szFormat, S_NAME_TAG, index); V_STR(S_ADDR_LEN, S_ADDR_SD, s->address); s->alen = (int)strlen(s->address); RANDOM(i, 0, nations.count - 1, S_NTRG_SD); s->nation_code = i; gen_phone(i, s->phone, S_PHNE_SD); RANDOM(s->acctbal, S_ABAL_MIN, S_ABAL_MAX, S_ABAL_SD); TEXT(S_CMNT_LEN, S_CMNT_SD, s->comment); s->clen = (int)strlen(s->comment); /* * these calls should really move inside the if stmt below, but this * will simplify seedless parallel load */ RANDOM(bad_press, 1, 10000, BBB_CMNT_SD); RANDOM(type, 0, 100, BBB_TYPE_SD); RANDOM(noise, 0, (s->clen - BBB_CMNT_LEN), BBB_JNK_SD); RANDOM(offset, 0, (s->clen - (BBB_CMNT_LEN + noise)), BBB_OFFSET_SD); if (bad_press <= S_CMNT_BBB) { type = (type < BBB_DEADBEATS) ? 0 : 1; memcpy(s->comment + offset, BBB_BASE, BBB_BASE_LEN); if (type == 0) memcpy(s->comment + BBB_BASE_LEN + offset + noise, BBB_COMPLAIN, BBB_TYPE_LEN); else memcpy(s->comment + BBB_BASE_LEN + offset + noise, BBB_COMMEND, BBB_TYPE_LEN); } return (0); }
long mk_cust(long n_cust, customer_t *c) { long i; c->custkey = n_cust; sprintf(c->name, C_NAME_FMT, C_NAME_TAG, n_cust); c->alen = V_STR(C_ADDR_LEN, C_ADDR_SD, c->address); RANDOM(i, 0, (nations.count - 1), C_NTRG_SD); c->nation_code = i; gen_phone(i, c->phone, (long)C_PHNE_SD); RANDOM(c->acctbal, C_ABAL_MIN, C_ABAL_MAX, C_ABAL_SD); pick_str(&c_mseg_set, C_MSEG_SD, c->mktsegment); c->clen = TEXT(C_CMNT_LEN, C_CMNT_SD, c->comment); return (0); }
long mk_supp(long index, supplier_t *s) { long i;//, //bad_press, //noise, //offset, //type; s->suppkey = index; sprintf(s->name, S_NAME_FMT, S_NAME_TAG, index); s->alen = V_STR(S_ADDR_LEN, S_ADDR_SD, s->address); RANDOM(i, 0, nations.count-1, S_NTRG_SD); strcpy(s->nation_name,nations.list[i].text); strcpy(s->region_name,regions.list[nations.list[i].weight].text); gen_city(s->city,s->nation_name); gen_phone(i, s->phone, (long)C_PHNE_SD); return (0); }
long mk_cust(long n_cust, customer_t *c) { long i; static int bInit = 0; while (!bInit) { TRACE( TRACE_ALWAYS, "Init mk_cust ..\n"); bInit = 1; } c->custkey = n_cust; sprintf(c->name, C_NAME_FMT, C_NAME_TAG, n_cust); c->alen = V_STR(C_ADDR_LEN, C_ADDR_SD, c->address); RANDOM(i, 0, nations.count-1, C_NTRG_SD); strcpy(c->nation_name,nations.list[i].text); strcpy(c->region_name,regions.list[nations.list[i].weight].text); gen_city(c->city,c->nation_name); gen_phone(i, c->phone, (long)C_PHNE_SD); pick_str(&c_mseg_set, C_MSEG_SD, c->mktsegment); return (0); }