diff --git a/sqlite3.go b/sqlite3.go index cfbdae3..1855eb0 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -191,7 +191,6 @@ type SQLiteRows struct { decltype []string cls bool done chan struct{} - next *SQLiteRows } type functionInfo struct { @@ -471,7 +470,6 @@ func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, erro } func (c *SQLiteConn) query(ctx context.Context, query string, args []namedValue) (driver.Rows, error) { - var top, cur *SQLiteRows start := 0 for { s, err := c.Prepare(query) @@ -489,14 +487,7 @@ func (c *SQLiteConn) query(ctx context.Context, query string, args []namedValue) rows, err := s.(*SQLiteStmt).query(ctx, args[:na]) if err != nil && err != driver.ErrSkip { s.Close() - return top, err - } - if top == nil { - top = rows.(*SQLiteRows) - cur = top - } else { - cur.next = rows.(*SQLiteRows) - cur = cur.next + return rows, err } args = args[na:] start += na @@ -772,7 +763,6 @@ func (s *SQLiteStmt) query(ctx context.Context, args []namedValue) (driver.Rows, decltype: nil, cls: s.cls, done: make(chan struct{}), - next: nil, } go func() { @@ -970,15 +960,3 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { } return nil } - -func (rc *SQLiteRows) HasNextResultSet() bool { - return rc.next != nil -} - -func (rc *SQLiteRows) NextResultSet() error { - if rc.next == nil { - return io.EOF - } - *rc = *rc.next - return nil -} diff --git a/sqlite3_go18_test.go b/sqlite3_go18_test.go index 0536042..54e6604 100644 --- a/sqlite3_go18_test.go +++ b/sqlite3_go18_test.go @@ -9,7 +9,6 @@ package sqlite3 import ( "database/sql" - "fmt" "os" "testing" ) @@ -49,58 +48,3 @@ func TestNamedParams(t *testing.T) { t.Error("Failed to db.QueryRow: not matched results") } } - -func TestMultipleResultSet(t *testing.T) { - tempFilename := TempFilename(t) - defer os.Remove(tempFilename) - db, err := sql.Open("sqlite3", tempFilename) - if err != nil { - t.Fatal("Failed to open database:", err) - } - defer db.Close() - - _, err = db.Exec(` - create table foo (id integer, name text); - `) - if err != nil { - t.Error("Failed to call db.Query:", err) - } - - for i := 0; i < 100; i++ { - _, err = db.Exec(`insert into foo(id, name) values(?, ?)`, i+1, fmt.Sprintf("foo%03d", i+1)) - if err != nil { - t.Error("Failed to call db.Exec:", err) - } - } - - rows, err := db.Query(` - select id, name from foo where id < :id1; - select id, name from foo where id = :id2; - select id, name from foo where id > :id3; - `, - sql.Param(":id1", 3), - sql.Param(":id2", 50), - sql.Param(":id3", 98), - ) - if err != nil { - t.Error("Failed to call db.Query:", err) - } - - var id int - var extra string - - for { - for rows.Next() { - err = rows.Scan(&id, &extra) - if err != nil { - t.Error("Failed to db.Scan:", err) - } - if id != 1 || extra != "foo" { - t.Error("Failed to db.QueryRow: not matched results") - } - } - if !rows.NextResultSet() { - break - } - } -}