From aa53e90426fd1929ce0add86389a43394b5116f8 Mon Sep 17 00:00:00 2001 From: Paul J R Date: Sun, 15 Nov 2009 04:41:28 +1100 Subject: [PATCH] some more page work --- src/dbconnector.go | 7 +++++++ src/webconnector.go | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/dbconnector.go b/src/dbconnector.go index 668242d..5a6f64b 100644 --- a/src/dbconnector.go +++ b/src/dbconnector.go @@ -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); } diff --git a/src/webconnector.go b/src/webconnector.go index a579966..1f83b29 100644 --- a/src/webconnector.go +++ b/src/webconnector.go @@ -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, "

Confirm

"); + 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:
"); + io.WriteString(c, ""); + io.WriteString(c, fmt.Sprintf("", dbhost)); + io.WriteString(c, fmt.Sprintf("", dbuser)); + io.WriteString(c, fmt.Sprintf("", dbpass)); + io.WriteString(c, fmt.Sprintf("", dbname)); + io.WriteString(c, fmt.Sprintf("", nthreads)); + io.WriteString(c, "
Host%s
User%s
Password%s
Database%s
Number of Threads%s
"); + io.WriteString(c, "Back"); + io.WriteString(c, fmt.Sprintf(" Begin", dbhost, dbuser, dbpass, dbname, nthreads)); + footer(c); } @@ -45,8 +62,9 @@ func mainPage(c *http.Conn, req *http.Request) header(c); io.WriteString(c, "

goDBHammer


"); io.WriteString(c, "Welcome to goDBHammer, the go based database benchmarking tool
"); - io.WriteString(c, "
"); - io.WriteString(c, ""); + io.WriteString(c, ""); + io.WriteString(c, "
Database Host
"); + io.WriteString(c, ""); io.WriteString(c, ""); io.WriteString(c, ""); io.WriteString(c, ""); @@ -68,16 +86,8 @@ func footer(c *http.Conn) io.WriteString(c, ""); } -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); -- 1.7.0.4
Database Type
Database Host
Database User
Database Password
Database