@@ -146,44 +146,6 @@ func (c *comparison) Compare(ctx *sql.Context, row sql.Row) (int, error) {
146
146
return 0 , err
147
147
}
148
148
149
- //var compareType sql.Type
150
- //// ENUM, SET, and TIME must be excluded when doing comparisons, as they're too restrictive to use as a comparison
151
- //// base.
152
- ////
153
- //// The best overall method would be to assign type priority. For example, INT would have a higher priority than
154
- //// TINYINT. This could then be combined with the origin of the value (table column, procedure param, etc.) to
155
- //// determine the best type for any comparison (tie-breakers can be simple rules such as the current left preference).
156
- //
157
- //collationPreference := sql.Collation_Default
158
- //switch c.Left().(type) {
159
- //case *GetField, *UserVar, *SystemVar, *ProcedureParam:
160
- // compareType = c.Left().Type()
161
- // if twc, ok := compareType.(sql.TypeWithCollation); ok {
162
- // collationPreference = twc.Collation()
163
- // }
164
- //default:
165
- // switch c.Right().(type) {
166
- // case *GetField, *UserVar, *SystemVar, *ProcedureParam:
167
- // compareType = c.Right().Type()
168
- // if twc, ok := compareType.(sql.TypeWithCollation); ok {
169
- // collationPreference = twc.Collation()
170
- // }
171
- // }
172
- //}
173
- //if compareType != nil {
174
- // _, isEnum := compareType.(sql.EnumType)
175
- // _, isSet := compareType.(sql.SetType)
176
- // _, isTime := compareType.(types.TimeType)
177
- // if !isEnum && !isSet && !isTime {
178
- // compareType = nil
179
- // }
180
- //}
181
- //if compareType == nil {
182
- // left, right, compareType, err = c.castLeftAndRight(ctx, left, right)
183
- // if err != nil {
184
- // return 0, err
185
- // }
186
- //}
187
149
collationPreference , _ := c .CollationCoercibility (ctx )
188
150
if stringCompareType , ok := compareType .(sql.StringType ); ok {
189
151
compareType = types .MustCreateString (stringCompareType .Type (), stringCompareType .Length (), collationPreference )
0 commit comments