Enable test for Queryer

This commit is contained in:
mattn 2014-06-26 04:06:39 +09:00
parent d9e7576acf
commit 5fb02bd99d
1 changed files with 40 additions and 40 deletions

View File

@ -660,43 +660,43 @@ func TestExecer(t *testing.T) {
} }
} }
//func TestQueryer(t *testing.T) { func TestQueryer(t *testing.T) {
// tempFilename := TempFilename() tempFilename := TempFilename()
// db, err := sql.Open("sqlite3", tempFilename) db, err := sql.Open("sqlite3", tempFilename)
// if err != nil { if err != nil {
// t.Fatal("Failed to open database:", err) t.Fatal("Failed to open database:", err)
// } }
// defer os.Remove(tempFilename) defer os.Remove(tempFilename)
// defer db.Close() defer db.Close()
//
// _, err = db.Exec(` _, err = db.Exec(`
// create table foo (id integer); create table foo (id integer);
// `) `)
// if err != nil { if err != nil {
// t.Error("Failed to call db.Query:", err) t.Error("Failed to call db.Query:", err)
// } }
//
// rows, err := db.Query(` rows, err := db.Query(`
// insert into foo(id) values(?); insert into foo(id) values(?);
// insert into foo(id) values(?); insert into foo(id) values(?);
// insert into foo(id) values(?); insert into foo(id) values(?);
// select id from foo order by id; select id from foo order by id;
// `, 3, 2, 1) `, 3, 2, 1)
// if err != nil { if err != nil {
// t.Error("Failed to call db.Query:", err) t.Error("Failed to call db.Query:", err)
// } }
// defer rows.Close() defer rows.Close()
// n := 1 n := 1
// if rows != nil { if rows != nil {
// for rows.Next() { for rows.Next() {
// var id int var id int
// err = rows.Scan(&id) err = rows.Scan(&id)
// if err != nil { if err != nil {
// t.Error("Failed to db.Query:", err) t.Error("Failed to db.Query:", err)
// } }
// if id != n { if id != n {
// t.Error("Failed to db.Query: not matched results") t.Error("Failed to db.Query: not matched results")
// } }
// } }
// } }
//} }