diff --git a/rows.go b/rows.go index 900f548ae..ad66a8e6e 100644 --- a/rows.go +++ b/rows.go @@ -33,12 +33,6 @@ type mysqlRows struct { type binaryRows struct { mysqlRows - // stmtCols is a pointer to the statement's cached columns for different - // result sets. - stmtCols *[][]mysqlField - // i is a number of the current result set. It is used to fetch proper - // columns from stmtCols. - i int } type textRows struct { @@ -132,25 +126,14 @@ func (rows *mysqlRows) nextNotEmptyResultSet() (int, error) { } } -func (rows *binaryRows) NextResultSet() (err error) { +func (rows *binaryRows) NextResultSet() error { resLen, err := rows.nextNotEmptyResultSet() if err != nil { return err } - // get columns, if not cached, read them and cache them. - if rows.i >= len(*rows.stmtCols) { - rows.rs.columns, err = rows.mc.readColumns(resLen) - *rows.stmtCols = append(*rows.stmtCols, rows.rs.columns) - } else { - rows.rs.columns = (*rows.stmtCols)[rows.i] - if err := rows.mc.readUntilEOF(); err != nil { - return err - } - } - - rows.i++ - return nil + rows.rs.columns, err = rows.mc.readColumns(resLen) + return err } func (rows *binaryRows) Next(dest []driver.Value) error { diff --git a/statement.go b/statement.go index b88771674..e5071276a 100644 --- a/statement.go +++ b/statement.go @@ -20,7 +20,6 @@ type mysqlStmt struct { mc *mysqlConn id uint32 paramCount int - columns [][]mysqlField // cached from the first query } func (stmt *mysqlStmt) Close() error { @@ -109,20 +108,10 @@ func (stmt *mysqlStmt) Query(args []driver.Value) (driver.Rows, error) { } rows := new(binaryRows) - rows.stmtCols = &stmt.columns if resLen > 0 { rows.mc = mc - rows.i++ - // Columns - // If not cached, read them and cache them - if len(stmt.columns) == 0 { - rows.rs.columns, err = mc.readColumns(resLen) - stmt.columns = append(stmt.columns, rows.rs.columns) - } else { - rows.rs.columns = stmt.columns[0] - err = mc.readUntilEOF() - } + rows.rs.columns, err = mc.readColumns(resLen) } else { rows.rs.done = true