some more page work
authorPaul J R <me@pjr.cc>
Sat, 14 Nov 2009 17:41:28 +0000 (04:41 +1100)
committerPaul J R <me@pjr.cc>
Sat, 14 Nov 2009 17:41:28 +0000 (04:41 +1100)
src/dbconnector.go
src/webconnector.go

index 668242d..5a6f64b 100644 (file)
@@ -9,6 +9,13 @@ func DBSetup(dbtype string, host string, username string, password string, datab
 {
 
        // the job of this function is to bring up the connection and create tables based on dbtype
+       //var Dbconn *dbibridge.DBIConnection;
+       
+       //Dbconn = dbibridge.DBICreate();
+       
+       //dbibridge.DBIConnect(Dbconn, "mysql", "localhost", "root", "password", "zm");
+       //dbibridge.ExecSQL(Dbconn, "create table asdf (asdf int)");
+       //dbibridge.DBIDisconnect(Dbconn);
 
 }
 
index a579966..1f83b29 100644 (file)
@@ -24,8 +24,8 @@ func ServerResponder(c *http.Conn, req *http.Request) {
                mainPage(c, req);
        }
        
-       if req.RawURL == "/setup" {
-               setupPage(c, req);
+       if req.RawURL == "/confirm" {
+               confirmPage(c, req);
        }
        
        // fucking go, i just wanna consume the incoming data, but it forces me to do something with it... cunt of a language
@@ -33,10 +33,27 @@ func ServerResponder(c *http.Conn, req *http.Request) {
        //fmt.Printf("%d\n", k);
 }
 
-func setupPage(c *http.Conn, req *http.Request)
+func confirmPage(c *http.Conn, req *http.Request)
 {
        header(c);
-       io.WriteString(c, "I am a setup page");
+       io.WriteString(c, "<h1>Confirm</h1>");
+       dbhost := req.FormValue("dbhost");
+       dbuser := req.FormValue("dbuser");
+       dbpass := req.FormValue("dbpass");
+       dbname := req.FormValue("dbname");
+       nthreads := req.FormValue("nthreads");
+       
+       io.WriteString(c, "You are trying to perform a benchmark with the following values:<br>");
+       io.WriteString(c, "<table>");
+       io.WriteString(c, fmt.Sprintf("<tr><td>Host</td><td>%s</td></tr>", dbhost));
+       io.WriteString(c, fmt.Sprintf("<tr><td>User</td><td>%s</td></tr>", dbuser));
+       io.WriteString(c, fmt.Sprintf("<tr><td>Password</td><td>%s</td></tr>", dbpass));
+       io.WriteString(c, fmt.Sprintf("<tr><td>Database</td><td>%s</td></tr>", dbname));
+       io.WriteString(c, fmt.Sprintf("<tr><td>Number of Threads</td><td>%s</td></tr>", nthreads));
+       io.WriteString(c, "</table>");
+       io.WriteString(c, "<a href=\"/\">Back</a>");
+       io.WriteString(c, fmt.Sprintf(" <a href=\"/start?host=%s&user=%s&pass=%s&db=%s&nt=%s\">Begin</a>", dbhost, dbuser, dbpass, dbname, nthreads));
+       
        footer(c);
 }
 
@@ -45,8 +62,9 @@ func mainPage(c *http.Conn, req *http.Request)
        header(c);
        io.WriteString(c, "<h1>goDBHammer</h1><br>");
        io.WriteString(c, "Welcome to goDBHammer, the go based database benchmarking tool<br>");
-       io.WriteString(c, "<form method=\"post\" action=\"/setup\">");
-       io.WriteString(c, "<table><tr><td>Database Host</td><td><input type=\"text\" name=\"dbhost\"></td></tr>");
+       io.WriteString(c, "<form method=\"post\" action=\"/confirm\">");
+       io.WriteString(c, "<table><tr><td>Database Type</td><td><input type=\"text\" name=\"dbtype\" value=\"ignored for now\"></td></tr>");
+       io.WriteString(c, "<tr><td>Database Host</td><td><input type=\"text\" name=\"dbhost\"></td></tr>");
        io.WriteString(c, "<tr><td>Database User</td><td><input type=\"text\" name=\"dbuser\"></td></tr>");
        io.WriteString(c, "<tr><td>Database Password</td><td><input type=\"text\" name=\"dbpass\"></td></tr>");
        io.WriteString(c, "<tr><td>Database</td><td><input type=\"text\" name=\"dbname\"></td></tr>");  
@@ -68,16 +86,8 @@ func footer(c *http.Conn)
        io.WriteString(c, "</body></html>");
 }
 
-func main() {
-
-       //var Dbconn *dbibridge.DBIConnection;
-       
-       //Dbconn = dbibridge.DBICreate();
-       
-       //dbibridge.DBIConnect(Dbconn, "mysql", "localhost", "root", "password", "zm");
-       //dbibridge.ExecSQL(Dbconn, "create table asdf (asdf int)");
-       //dbibridge.DBIDisconnect(Dbconn);
-       
+func main()
+{
        comin = make(chan int);
        comout = make(chan int);