Internal function to execute commands
(query string)
| 456 | |
| 457 | // Internal function to execute commands |
| 458 | func (mc *mysqlConn) exec(query string) error { |
| 459 | handleOk := mc.clearResult() |
| 460 | // Send command |
| 461 | if err := mc.writeCommandPacketStr(comQuery, query); err != nil { |
| 462 | return mc.markBadConn(err) |
| 463 | } |
| 464 | |
| 465 | // Read Result |
| 466 | resLen, _, err := handleOk.readResultSetHeaderPacket() |
| 467 | if err != nil { |
| 468 | return err |
| 469 | } |
| 470 | |
| 471 | if resLen > 0 { |
| 472 | // columns |
| 473 | if err := mc.skipColumns(resLen); err != nil { |
| 474 | return err |
| 475 | } |
| 476 | |
| 477 | // rows |
| 478 | if err := mc.skipRows(); err != nil { |
| 479 | return err |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | return handleOk.discardResults() |
| 484 | } |
| 485 | |
| 486 | func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, error) { |
| 487 | return mc.query(query, args) |
no test coverage detected