haxetink / tink_sql

SQL embedded into Haxe
MIT License
54 stars 17 forks source link

Filter Date order is important #120

Open hypersurge opened 3 years ago

hypersurge commented 3 years ago

A Filter with Date > Field creates "Cannot compare Date and tink.sql.Field<Date,...>", whereas flipping the order to Field < Date completes as expected. Same with ==. The issue did not present on Int and VarChar fields.

The workaround is easy enough so this little note is probably enough to help others avoid the issue.

kevinresol commented 3 years ago

I wonder why though. Because even for Float there are only Field <op> Float operator overloads but not Float <op> Field, so I expect this will work only one way but the other way round:

https://github.com/haxetink/tink_sql/blob/097c652f7be854385e933730c17f7f376595156f/src/tink/sql/expr/Field.hx#L152