Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit b32d2fd

Browse files
authored
Merge pull request #637 from ajnavarro/fix/return-correct-charset-depending-of-type
Add charset to fields
2 parents 38223c6 + e00c941 commit b32d2fd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: server/handler.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,17 @@ func rowToSQL(s sql.Schema, row sql.Row) []sqltypes.Value {
221221
func schemaToFields(s sql.Schema) []*query.Field {
222222
fields := make([]*query.Field, len(s))
223223
for i, c := range s {
224+
var charset uint32
225+
if c.Type.Type() == mysql.TypeBlob {
226+
charset = mysql.CharacterSetBinary
227+
} else {
228+
charset = mysql.CharacterSetUtf8
229+
}
230+
224231
fields[i] = &query.Field{
225-
Name: c.Name,
226-
Type: c.Type.Type(),
232+
Name: c.Name,
233+
Type: c.Type.Type(),
234+
Charset: charset,
227235
}
228236
}
229237

0 commit comments

Comments
 (0)