17 // hello world, the web server
18 func ServerResponder(c *http.Conn, req *http.Request) {
22 fmt.Printf("lk: %s %s %s\n", req.Method, req.RawURL, req.URL);
23 if req.RawURL == "/" {
27 if req.RawURL == "/setup" {
31 // fucking go, i just wanna consume the incoming data, but it forces me to do something with it... cunt of a language
33 //fmt.Printf("%d\n", k);
36 func setupPage(c *http.Conn, req *http.Request)
39 io.WriteString(c, "I am a setup page");
43 func mainPage(c *http.Conn, req *http.Request)
46 io.WriteString(c, "<h1>goDBHammer</h1><br>");
47 io.WriteString(c, "Welcome to goDBHammer, the go based database benchmarking tool<br>");
48 io.WriteString(c, "<form method=\"post\" action=\"/setup\">");
49 io.WriteString(c, "<table><tr><td>Database Host</td><td><input type=\"text\" name=\"dbhost\"></td></tr>");
50 io.WriteString(c, "<tr><td>Database User</td><td><input type=\"text\" name=\"dbuser\"></td></tr>");
51 io.WriteString(c, "<tr><td>Database Password</td><td><input type=\"text\" name=\"dbpass\"></td></tr>");
52 io.WriteString(c, "<tr><td>Database</td><td><input type=\"text\" name=\"dbname\"></td></tr>");
53 io.WriteString(c, "<tr><td>Number of Clients</td><td><input type=\"text\" name=\"nthreads\"></td></tr>");
54 io.WriteString(c, "<tr><td><input type=\"submit\" name=\"Setup\" value=\"Setup\"></td></tr>");
55 io.WriteString(c, "</table>");
56 io.WriteString(c, "</form>");
57 fmt.Printf("%s\n", req.FormValue("dbhost"));
61 func header(c *http.Conn)
63 io.WriteString(c, "<html><head></head><body>");
66 func footer(c *http.Conn)
68 io.WriteString(c, "</body></html>");
73 //var Dbconn *dbibridge.DBIConnection;
75 //Dbconn = dbibridge.DBICreate();
77 //dbibridge.DBIConnect(Dbconn, "mysql", "localhost", "root", "password", "zm");
78 //dbibridge.ExecSQL(Dbconn, "create table asdf (asdf int)");
79 //dbibridge.DBIDisconnect(Dbconn);
81 comin = make(chan int);
82 comout = make(chan int);
84 bc := benchcontroller.CreateController();
85 go benchcontroller.MainLoop(bc, comout, comin);
87 http.Handle("/", http.HandlerFunc(ServerResponder));
88 err := http.ListenAndServe(":12345", nil);
90 panic("ListenAndServe: ", err.String())