Skip to content

Commit

Permalink
ability to send multiple resultsets from handleQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
GoWebProd committed Nov 10, 2020
1 parent a4724a0 commit 379882c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions server/caching_sha2_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,13 @@ func (h *testCacheHandler) handleQuery(query string, binary bool) (*mysql.Result
return nil, nil
}

func (h *testCacheHandler) HandleQuery(query string) (*mysql.Result, error) {
return h.handleQuery(query, false)
func (h *testCacheHandler) HandleQuery(query string) ([]*mysql.Result, error) {
res, err := h.handleQuery(query, false)
if err != nil {
return nil, err
}

return []*mysql.Result{res}, nil
}

func (h *testCacheHandler) HandleFieldList(table string, fieldWildcard string) ([]*mysql.Field, error) {
Expand Down
2 changes: 1 addition & 1 deletion server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type EmptyHandler struct {
func (h EmptyHandler) UseDB(dbName string) error {
return nil
}
func (h EmptyHandler) HandleQuery(query string) (*Result, error) {
func (h EmptyHandler) HandleQuery(query string) ([]*Result, error) {
return nil, fmt.Errorf("not supported now")
}

Expand Down
8 changes: 7 additions & 1 deletion server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ func (h *testHandler) handleQuery(query string, binary bool) (*mysql.Result, err
}

func (h *testHandler) HandleQuery(query string) (*mysql.Result, error) {
return h.handleQuery(query, false)
res, err := h.handleQuery(query, false)
if err != nil {
return nil, err

}

return []*mysql.Result{res}, nil
}

func (h *testHandler) HandleFieldList(table string, fieldWildcard string) ([]*mysql.Field, error) {
Expand Down

0 comments on commit 379882c

Please sign in to comment.