Skip to content

Commit

Permalink
Merge pull request flike#336 from zs1379/master
Browse files Browse the repository at this point in the history
修复带函数并且有sharding、group by及order by的情况下,返回的数据未按照order进行排序的问题
  • Loading branch information
Fei Chen authored May 17, 2017
2 parents 14071df + 3ade2e5 commit d6009de
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proxy/server/conn_resultset.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ func (c *ClientConn) buildResultset(fields []*mysql.Field, names []string, value
r := new(mysql.Resultset)

r.Fields = make([]*mysql.Field, len(names))
r.FieldNames = make(map[string]int, len(names))

//use the field def that get from true database
if len(fields) != 0 {
if len(r.Fields) == len(fields) {
Expand All @@ -112,9 +114,11 @@ func (c *ClientConn) buildResultset(fields []*mysql.Field, names []string, value
if i == 0 {
if ExistFields {
r.Fields[j] = fields[j]
r.FieldNames[string(r.Fields[j].Name)] = j
} else {
field := &mysql.Field{}
r.Fields[j] = field
r.FieldNames[string(r.Fields[j].Name)] = j
field.Name = hack.Slice(names[j])
if err = formatField(field, value); err != nil {
return nil, err
Expand Down

0 comments on commit d6009de

Please sign in to comment.