예제 #1
0
func (session *Session) handleStmtQuery(stmt *mysql.Stmt, data []byte) error {
	var rows mysql.Rows
	var err error

	if len(data) > 0 {
		rows, err = stmt.Query(driver.RawStmtParams(data))
	} else {
		rows, err = stmt.Query()
	}

	if err != nil {
		return session.handleMySQLError(err)
	}

	return session.writeRows(rows)
}
예제 #2
0
func (session *Session) handleStmtExec(stmt *mysql.Stmt, data []byte) error {

	var rs mysql.Result
	var err error

	if len(data) > 0 {
		rs, err = stmt.Exec(driver.RawStmtParams(data))
	} else {
		rs, err = stmt.Exec()
	}

	if err != nil {
		return session.handleMySQLError(err)
	}

	return session.fc.WriteOK(rs)
}