public void FillStock(int wid) { Console.WriteLine("filling stock " + DateTime.Now); #if TRY for (int siid=1;siid<=10;siid++) #else for (int siid = 1; siid <= 100000; siid++) #endif { util u = new util(26, 50); var cmd = conn.CreateCommand(); cmd.CommandText="insert into STOCK(" + "S_I_ID,S_W_ID,S_QUANTITY,S_DIST_01,S_DIST_02," + "S_DIST_03,S_DIST_04,S_DIST_05,S_DIST_06," + "S_DIST_07,S_DIST_08,S_DIST_09,S_DIST_10," + "S_YTD,S_ORDER_CNT,S_REMOTE_CNT,S_DATA) values (" + siid + "," + wid + "," + util.random(10, 100) + "," + //0,1,2 GetString(util.randchar(24)) + "," + // 3 GetString(util.randchar(24)) + "," + // 4 GetString(util.randchar(24)) + "," + // 5 GetString(util.randchar(24)) + "," + // 6 GetString(util.randchar(24)) + "," + // 7 GetString(util.randchar(24)) + "," + // 8 GetString(util.randchar(24)) + "," + // 9 GetString(util.randchar(24)) + "," + // 10 GetString(util.randchar(24)) + "," + // 11 GetString(util.randchar(24)) + "," + // 12 "0.0,0,0," + GetString(util.fixStockData(u.NextAString())) + ")"; cmd.ExecuteNonQuery(); } Console.WriteLine("Done filling stock " + DateTime.Now); }
public void FillWarehouse(int w) { util u1 = new util(6, 10); util u2 = new util(10, 20); Console.WriteLine("Starting warehouse " + w + " " + DateTime.Now); conn.ExecuteNonQuery("insert WAREHOUSE(W_ID,W_NAME,W_STREET_1,W_STREET_2," + "W_CITY,W_STATE,W_ZIP,W_TAX,W_YTD) values(" + w + "," + GetString(u1.NextAString()) + "," + GetString(u2.NextAString()) + "," + GetString(u2.NextAString()) + "," + GetString(u2.NextAString()) + ",'" + (char)util.random(65, 90) + (char)util.random(65, 90) + "'," + GetString(util.NZip()) + "," + util.NextNString(0, 2000, 4) + ",300000.00)"); FillStock(w); }
public void FillCustomer(int wid, int did) { Console.WriteLine("starting customer w=" + wid + " d=" + did); util uf = new util(8, 16); util us = new util(10, 20); util ud = new util(300, 500); util uh = new util(12, 24); var ccols = new string[] { "C_ID", "C_D_ID", "C_W_ID", "C_FIRST", "C_MIDDLE", "C_LAST", "C_STREET_1", "C_STREET_2", "C_CITY", "C_STATE", "C_ZIP", "C_PHONE", "C_SINCE", "C_CREDIT", "C_CREDIT_LIM", "C_DISCOUNT", "C_BALANCE", "C_YTD_PAYMENT", "C_PAYMENT_CNT", "C_DELIVERY_CNT", "C_DATA" }; var hcols = new string[] { "H_C_ID", "H_C_D_ID", "H_C_W_ID", "H_D_ID", "H_W_ID", "H_DATE", "H_AMOUNT", "H_DATA" }; #if TRY for (int cid = 1; cid <= 3; cid++) #else for (int cid = 1; cid <= 3000; cid++) #endif { conn.Insert("CUSTOMER", ccols, new Serialisable[][] { new Serialisable[] { new SInteger(cid), new SInteger(did), new SInteger(wid), GetString(util.NextLast(cid)), new SString("OE"), GetString(uf.NextAString()), GetString(uf.NextAString()), GetString(uf.NextAString()), GetString(uf.NextAString()), new SString("" + (char)util.random(65, 90) + (char)util.random(65, 90)), GetString(util.NZip()), new SInteger(util.NString(16)), new SDate(DateTime.Now), new SString(credit()), new SNumeric(500000, 12, 2), new SNumeric(util.random(0, 5000), 4, 4), new SNumeric(-1000, 12, 2), new SNumeric(1000, 12, 2), new SNumeric(1, 4, 0), new SNumeric(0, 4, 0), GetString(ud.NextAString()) } }); conn.Insert("HISTORY", hcols, new Serialisable[][] { new Serialisable[] { new SInteger(cid), new SInteger(did), new SInteger(wid), new SInteger(did), new SInteger(wid), new SDate(DateTime.Now), new SNumeric(1000, 6, 2), GetString(uh.NextAString()) } }); } Console.WriteLine("Customers done"); }
Serialisable[] StockVals(int siid, int wid) { util u = new util(26, 50); var r = new Serialisable[17]; r[0] = new SInteger(siid); r[1] = new SInteger(wid); r[2] = new SNumeric(util.random(10, 100), 4, 0); for (var i = 3; i < 13; i++) { r[i] = GetString(util.randchar(24)); } r[13] = SInteger.Zero; r[14] = SInteger.Zero; r[15] = SInteger.Zero; r[16] = GetString(util.fixStockData(u.NextAString())); return(r); }
public void FillDistrict(int wid, int did) { util us = new util(10, 20); util un = new util(6, 10); var cols = new string[] { "D_ID", "D_W_ID", "D_NAME", "D_STREET_1", "D_STREET_2", "D_CITY", "D_STATE", "D_ZIP", "D_TAX", "D_YTD", "D_NEXT_O_ID" }; conn.Insert("DISTRICT", cols, new Serialisable[][] { new Serialisable[] { new SInteger(did), new SInteger(wid), GetString(un.NextAString()), GetString(un.NextAString()), GetString(un.NextAString()), GetString(un.NextAString()), new SString("" + (char)util.random(65, 90) + (char)util.random(65, 90)), new SNumeric(300000, 12, 2), new SInteger(3001) } }); FillCustomer(wid, did); FillOrder(wid, did); }
public void FillDistrict(int wid, int did) { Console.WriteLine("Filling District " + did + " " + DateTime.Now); util us = new util(10, 20); util un = new util(6, 10); conn.ExecuteNonQuery("insert DISTRICT(D_ID,D_W_ID,D_NAME,D_STREET_1,D_STREET_2," + "D_CITY,D_STATE,D_ZIP,D_TAX,D_YTD,D_NEXT_O_ID) values(" + did + "," + wid + "," + GetString(un.NextAString()) + "," + GetString(un.NextAString()) + "," + GetString(un.NextAString()) + "," + GetString(un.NextAString()) + ",'" + (char)util.random(65, 90) + (char)util.random(65, 90) + "'," + GetString(util.NZip()) + "," + util.NextNString(0, 2000, 4) + "," + "3000.00,3001)"); FillCustomer(wid, did); FillOrder(wid, did); Console.WriteLine("Done Filling District " + DateTime.Now); }
public void FillWarehouse(int w) { util u1 = new util(6, 10); util u2 = new util(10, 20); var cols = new string[] { "W_ID", "W_NAME", "W_STREET_1", "W_STREET_2", "W_CITY", "W_STATE", "W_ZIP", "W_TAX", "W_YTD" }; Console.WriteLine("Starting warehouse " + w); conn.Insert("WAREHOUSE", cols, new Serialisable[][] { new Serialisable[] { new SInteger(w), GetString(u1.NextAString()), GetString(u2.NextAString()), GetString(u2.NextAString()), GetString(u2.NextAString()), new SString("" + (char)util.random(65, 90) + (char)util.random(65, 90)), GetString(util.NZip()), GetString(util.NextNString(0, 2000, 4)), new SNumeric(30000000, 12, 2) } }); FillStock(w); }
public void FillItems() { util ut = new util(14, 24); var cols = new string[] { "I_ID", "I_IM_ID", "I_NAME", "I_PRICE", "I_DATA" }; #if TRY for (int j = 1; j <= 10; j++) #else for (int j = 1; j <= 100000; j++) #endif { conn.Insert("ITEM", cols, new Serialisable[][] { new Serialisable[] { #if TRY new SInteger(j), new SNumeric(util.random(1, 10)), #else new SInteger(j), new SInteger(util.random(1, 10000)), #endif GetString(ut.NextAString()), GetString(util.NextNString(100, 10000, 2)), NextData() } }); } }
public void FillItems() { Console.WriteLine("Adding Items: " + DateTime.Now); util ut = new util(14, 24); #if TRY for (int j = 1; j <= 10; j++) #else for (int j = 1; j <= 100000; j++) #endif { conn.ExecuteNonQuery("insert ITEM(I_ID,I_IM_ID,I_NAME,I_PRICE,I_DATA)" + " values(" + #if TRY j + "," + util.random(1, 10) + #else j + "," + util.random(1, 10000) + #endif "," + GetString(ut.NextAString()) + "," + util.NextNString(100, 10000, 2) + "," + NextData() + ")"); } Console.WriteLine("Items done: Fill stock?" + DateTime.Now); }
public void FillCustomer(int wid, int did) { Console.WriteLine("starting customer w=" + wid + " d=" + did+" " + DateTime.Now); util uf = new util(8, 16); util us = new util(10, 20); util ud = new util(300, 500); util uh = new util(12, 24); #if TRY for (int cid=1;cid<=3;cid++) #else for (int cid = 1; cid <= 3000; cid++) #endif { var cmd = conn.CreateCommand(); cmd.CommandText="insert into CUSTOMER(" + "C_ID,C_D_ID,C_W_ID,C_FIRST,C_MIDDLE,C_LAST," + "C_STREET_1,C_STREET_2,C_CITY,C_STATE,C_ZIP,C_PHONE," + "C_SINCE,C_CREDIT,C_CREDIT_LIM,C_DISCOUNT,C_BALANCE," + "C_YTD_PAYMENT,C_PAYMENT_CNT,C_DELIVERY_CNT,C_DATA) values (" + cid + "," + did + "," + wid + "," + GetString(util.NextLast(cid)) + ",'OE'," + GetString(uf.NextAString()) + "," + GetString(uf.NextAString()) + "," + GetString(uf.NextAString()) + "," + GetString(uf.NextAString()) + ",'" + (char)util.random(65, 90) + (char)util.random(65, 90) + "'," + GetString(util.NZip()) + ",'" + util.NString(16) + "','"+ DateTime.Now.ToString("o") +"','"+ credit() + "',5000.00," + util.randomA(0, 5000, 10000.0) + ",-10.00,10.00,1,0," + GetString(ud.NextAString()) + ")"; cmd.ExecuteNonQuery(); cmd.CommandText= "insert into HISTORY(" + "H_C_ID,H_C_D_ID,H_C_W_ID,H_D_ID,H_W_ID,H_DATE,H_AMOUNT,H_DATA) values(" + cid + "," + did + "," + wid + "," + did + "," + wid + ",'" + DateTime.Now.ToString("o") + "',10.00," + GetString(uh.NextAString()) + ")"; cmd.ExecuteNonQuery(); } Console.WriteLine("Customers done " + DateTime.Now); }