diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-06-21 19:06:17 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-06-21 19:06:17 -0700 |
commit | 42f28ab8e374137fe3f5d25424489d879d4724f8 (patch) | |
tree | 20353f2446b506d32e6d353b72a57bf48f070389 /vendor/github.com/go-sql-driver/mysql/connection.go | |
parent | 6b39c308d882a0aeac533f8ab1d90b48a2ae4b5a (diff) | |
download | chat-42f28ab8e374137fe3f5d25424489d879d4724f8.tar.gz chat-42f28ab8e374137fe3f5d25424489d879d4724f8.tar.bz2 chat-42f28ab8e374137fe3f5d25424489d879d4724f8.zip |
Updating server dependancies (#6712)
Diffstat (limited to 'vendor/github.com/go-sql-driver/mysql/connection.go')
-rw-r--r-- | vendor/github.com/go-sql-driver/mysql/connection.go | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go index cdce3e30f..d82c728f3 100644 --- a/vendor/github.com/go-sql-driver/mysql/connection.go +++ b/vendor/github.com/go-sql-driver/mysql/connection.go @@ -10,7 +10,6 @@ package mysql import ( "database/sql/driver" - "io" "net" "strconv" "strings" @@ -272,6 +271,7 @@ func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, err return nil, err } query = prepared + args = nil } mc.affectedRows = 0 mc.insertId = 0 @@ -289,29 +289,22 @@ func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, err // Internal function to execute commands func (mc *mysqlConn) exec(query string) error { // Send command - if err := mc.writeCommandPacketStr(comQuery, query); err != nil { + err := mc.writeCommandPacketStr(comQuery, query) + if err != nil { return err } // Read Result resLen, err := mc.readResultSetHeaderPacket() - if err != nil { - return err - } - - if resLen > 0 { - // columns - if err := mc.readUntilEOF(); err != nil { + if err == nil && resLen > 0 { + if err = mc.readUntilEOF(); err != nil { return err } - // rows - if err := mc.readUntilEOF(); err != nil { - return err - } + err = mc.readUntilEOF() } - return mc.discardResults() + return err } func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, error) { @@ -329,6 +322,7 @@ func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, erro return nil, err } query = prepared + args = nil } // Send command err := mc.writeCommandPacketStr(comQuery, query) @@ -341,17 +335,11 @@ func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, erro rows.mc = mc if resLen == 0 { - rows.rs.done = true - - switch err := rows.NextResultSet(); err { - case nil, io.EOF: - return rows, nil - default: - return nil, err - } + // no columns, no more data + return emptyRows{}, nil } // Columns - rows.rs.columns, err = mc.readColumns(resLen) + rows.columns, err = mc.readColumns(resLen) return rows, err } } @@ -371,7 +359,7 @@ func (mc *mysqlConn) getSystemVar(name string) ([]byte, error) { if err == nil { rows := new(textRows) rows.mc = mc - rows.rs.columns = []mysqlField{{fieldType: fieldTypeVarChar}} + rows.columns = []mysqlField{{fieldType: fieldTypeVarChar}} if resLen > 0 { // Columns |