5
5
"strconv"
6
6
7
7
"github.com/pingcap/errors"
8
- "github.com/siddontang/go/hack"
8
+
9
+ "github.com/go-mysql-org/go-mysql/utils"
9
10
)
10
11
11
12
func FormatTextValue (value interface {}) ([]byte , error ) {
@@ -37,7 +38,7 @@ func FormatTextValue(value interface{}) ([]byte, error) {
37
38
case []byte :
38
39
return v , nil
39
40
case string :
40
- return hack . Slice (v ), nil
41
+ return utils . StringToByteSlice (v ), nil
41
42
case nil :
42
43
return nil , nil
43
44
default :
@@ -74,7 +75,7 @@ func formatBinaryValue(value interface{}) ([]byte, error) {
74
75
case []byte :
75
76
return v , nil
76
77
case string :
77
- return hack . Slice (v ), nil
78
+ return utils . StringToByteSlice (v ), nil
78
79
default :
79
80
return nil , errors .Errorf ("invalid type %T" , value )
80
81
}
@@ -128,7 +129,7 @@ func BuildSimpleTextResultset(names []string, values [][]interface{}) (*Resultse
128
129
129
130
if len (values ) == 0 {
130
131
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 }
132
133
}
133
134
return r , nil
134
135
}
@@ -145,7 +146,7 @@ func BuildSimpleTextResultset(names []string, values [][]interface{}) (*Resultse
145
146
return nil , errors .Trace (err )
146
147
}
147
148
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 }
149
150
err = formatField (r .Fields [j ], value )
150
151
if err != nil {
151
152
return nil , errors .Trace (err )
@@ -213,7 +214,7 @@ func BuildSimpleBinaryResultset(names []string, values [][]interface{}) (*Result
213
214
if i == 0 {
214
215
field := & Field {Type : typ }
215
216
r .Fields [j ] = field
216
- field .Name = hack . Slice (names [j ])
217
+ field .Name = utils . StringToByteSlice (names [j ])
217
218
218
219
if err = formatField (field , value ); err != nil {
219
220
return nil , errors .Trace (err )
0 commit comments