1 // um yes... its a db connector
4 type DBConnector struct {
8 func DBSetup(dbtype string, host string, username string, password string, database string, datamult int, comout chan int)
11 // the job of this function is to bring up the connection and create tables based on dbtype
12 var Dbconn *dbibridge.DBIConnection;
14 Dbconn = dbibridge.DBICreate();
16 dbibridge.DBIConnect(Dbconn, "mysql", host, username, password, database);
18 if dbtype == "mysql" {
19 dbibridge.ExecSQL("create table WAREHOUSE (
20 W_ID integer NOT NULL,
22 W_STREET_1 CHARACTER(20),
23 W_STREET_2 CHARACTER(20),
31 dbibridge.ExecSQL("create table DISTRICT (
32 D_ID integer NOT NULL,
33 D_W_ID integer NOT NULL,
35 D_STREET_1 CHARACTER(20),
36 D_STREET_2 CHARACTER(20),
43 PRIMARY KEY(D_W_ID, D_ID))");
45 dbibridge.ExecSQL("create table ITEM (
46 I_ID integer NOT NULL,
54 dbibridge.DBIDisconnect(Dbconn);