From 6bcd65f2dc69400e17a26979470aa290b92bab01 Mon Sep 17 00:00:00 2001 From: James Cor Date: Thu, 28 Sep 2023 14:08:20 -0700 Subject: [PATCH] removing bad test and adding doc comment --- go/mysql/query.go | 5 ++++- go/sqltypes/type_test.go | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go/mysql/query.go b/go/mysql/query.go index 912855e2fa3..2cb5ef30cae 100644 --- a/go/mysql/query.go +++ b/go/mysql/query.go @@ -649,8 +649,11 @@ func (c *Conn) parseComStmtExecute(prepareData map[uint32]*PrepareData, data []b return stmtID, 0, NewSQLError(CRMalformedPacket, SSUnknownSQLState, "reading parameter flags failed") } - // TODO: execute is special in the way it specifies types? // convert MySQL type to internal type. + // for com_stmt_execute, the flag will either be 0x00 or 0x80 indicating signed or unsigned + // as a result, we need to shift the flag to the right by 2 bits + // while this flag may conflict with the mysqlBinary constant, it doesn't matter; + // the format for BLOB and TEXT parameters is the same for both binary and non-binary valType, err := sqltypes.MySQLToType(int64(mysqlType), int64(flags) >> 2) if err != nil { return stmtID, 0, NewSQLError(CRMalformedPacket, SSUnknownSQLState, "MySQLToType(%v,%v) failed: %v", mysqlType, flags, err) diff --git a/go/sqltypes/type_test.go b/go/sqltypes/type_test.go index 945aef7e08a..63637160506 100644 --- a/go/sqltypes/type_test.go +++ b/go/sqltypes/type_test.go @@ -436,11 +436,6 @@ func TestMySQLToType(t *testing.T) { inflags: mysqlUnsigned | mysqlBinary, outtype: Blob, }, - { - intype: 8, - inflags: 0x80, - outtype: Uint64, - }, } for _, tcase := range testcases { got, err := MySQLToType(tcase.intype, tcase.inflags)