Skip to content

Commit 0702154

Browse files
committed
Fetch Query-Rows on Access
Fixes Issue #10
1 parent 26a3506 commit 0702154

File tree

5 files changed

+283
-263
lines changed

5 files changed

+283
-263
lines changed

connection.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, err
208208
e
209209
}
210210

211-
// Internal function to execute statements
211+
// Internal function to execute commands
212212
func (mc *mysqlConn) exec(query string) (e error) {
213213
// Send command
214214
e = mc.writeCommandPacket(COM_QUERY, query)
@@ -217,7 +217,8 @@ func (mc *mysqlConn) exec(query string) (e error) {
217217
}
218218

219219
// Read Result
220-
resLen, e := mc.readResultSetHeaderPacket()
220+
var resLen int
221+
resLen, e = mc.readResultSetHeaderPacket()
221222
if e != nil {
222223
return
223224
}
@@ -258,13 +259,18 @@ func (mc *mysqlConn) getSystemVar(name string) (val string, e error) {
258259
return
259260
}
260261

261-
var rows []*[]*[]byte
262-
rows, e = mc.readRows(int(n))
262+
var row *[]*[]byte
263+
row, e = mc.readRow(int(n))
264+
if e != nil {
265+
return
266+
}
267+
268+
_, e = mc.readUntilEOF()
263269
if e != nil {
264270
return
265271
}
266272

267-
val = string(*(*rows[0])[0])
273+
val = string(*(*row)[0])
268274
}
269275

270276
return

0 commit comments

Comments
 (0)