diff --git a/v2/network/session.go b/v2/network/session.go index 2609e88..89b8617 100755 --- a/v2/network/session.go +++ b/v2/network/session.go @@ -1876,8 +1876,8 @@ func (session *Session) GetFixedClr() ([]byte, error) { } var size int switch nb { - case 0: - size = 0 + case 0, 0xFD, 0xFF: + return nil, nil case 0xFE: size, err = session.GetInt(4, false, true) if err != nil { @@ -1886,9 +1886,6 @@ func (session *Session) GetFixedClr() ([]byte, error) { default: size = int(nb) } - if size == 0 { - return nil, nil - } return session.GetBytes(size) } func (session *Session) WriteFixedClr(buffer *bytes.Buffer, data []byte) { diff --git a/v2/parameter.go b/v2/parameter.go index 49df963..b636b1b 100644 --- a/v2/parameter.go +++ b/v2/parameter.go @@ -518,12 +518,14 @@ func (par *ParameterInfo) decodePrimValue(conn *Connection, temporaryLobs *[][]b return nil } if udt { /*special extraction of udt fields*/ - switch par.DataType { - case NCHAR, CHAR, LONG, LongVarChar: - par.BValue, err = session.GetFixedClr() - default: - par.BValue, err = session.GetClr() - } + //switch par.DataType { + //case NCHAR, CHAR, LONG, LongVarChar: + // par.BValue, err = session.GetFixedClr() + // //par.BValue, err = session.GetClr() + //default: + // par.BValue, err = session.GetClr() + //} + par.BValue, err = session.GetFixedClr() } else { par.BValue, err = session.GetClr() } @@ -649,7 +651,6 @@ func (par *ParameterInfo) decodePrimValue(conn *Connection, temporaryLobs *[][]b locator, err = session.GetClr() } else { locator = par.BValue - } if err != nil { return err diff --git a/v2/parameter_encode.go b/v2/parameter_encode.go index 5471109..130cb13 100644 --- a/v2/parameter_encode.go +++ b/v2/parameter_encode.go @@ -498,10 +498,11 @@ func (par *ParameterInfo) encodePrimValue(conn *Connection) error { } else { objectBuffer.Write(attrib.BValue) } - case NCHAR, CHAR, LONG, LongVarChar: - session.WriteFixedClr(&objectBuffer, attrib.BValue) + //case NCHAR, CHAR, LONG, LongVarChar: + // session.WriteFixedClr(&objectBuffer, attrib.BValue) default: - session.WriteClr(&objectBuffer, attrib.BValue) + session.WriteFixedClr(&objectBuffer, attrib.BValue) + //session.WriteClr(&objectBuffer, attrib.BValue) } } if par.parent == nil {