55 "strconv"
66
77 "github.com/pingcap/errors"
8- "github.com/siddontang/go/hack"
8+
9+ "github.com/go-mysql-org/go-mysql/utils"
910)
1011
1112func FormatTextValue (value interface {}) ([]byte , error ) {
@@ -37,7 +38,7 @@ func FormatTextValue(value interface{}) ([]byte, error) {
3738 case []byte :
3839 return v , nil
3940 case string :
40- return hack . Slice (v ), nil
41+ return utils . StringToByteSlice (v ), nil
4142 case nil :
4243 return nil , nil
4344 default :
@@ -74,7 +75,7 @@ func formatBinaryValue(value interface{}) ([]byte, error) {
7475 case []byte :
7576 return v , nil
7677 case string :
77- return hack . Slice (v ), nil
78+ return utils . StringToByteSlice (v ), nil
7879 default :
7980 return nil , errors .Errorf ("invalid type %T" , value )
8081 }
@@ -128,7 +129,7 @@ func BuildSimpleTextResultset(names []string, values [][]interface{}) (*Resultse
128129
129130 if len (values ) == 0 {
130131 for i , name := range names {
131- r .Fields [i ] = & Field {Name : hack . Slice (name ), Charset : 33 , Type : MYSQL_TYPE_NULL }
132+ r .Fields [i ] = & Field {Name : utils . StringToByteSlice (name ), Charset : 33 , Type : MYSQL_TYPE_NULL }
132133 }
133134 return r , nil
134135 }
@@ -145,7 +146,7 @@ func BuildSimpleTextResultset(names []string, values [][]interface{}) (*Resultse
145146 return nil , errors .Trace (err )
146147 }
147148 if r .Fields [j ] == nil {
148- r .Fields [j ] = & Field {Name : hack . Slice (names [j ]), Type : typ }
149+ r .Fields [j ] = & Field {Name : utils . StringToByteSlice (names [j ]), Type : typ }
149150 err = formatField (r .Fields [j ], value )
150151 if err != nil {
151152 return nil , errors .Trace (err )
@@ -213,7 +214,7 @@ func BuildSimpleBinaryResultset(names []string, values [][]interface{}) (*Result
213214 if i == 0 {
214215 field := & Field {Type : typ }
215216 r .Fields [j ] = field
216- field .Name = hack . Slice (names [j ])
217+ field .Name = utils . StringToByteSlice (names [j ])
217218
218219 if err = formatField (field , value ); err != nil {
219220 return nil , errors .Trace (err )
0 commit comments