Fork me on GitHub
#honeysql
<
2023-01-30
>
nigel22:01:23

I want to convert boolean values to bit values for DBs that don't have BOOLEAN values (sqlserver, oracle) in a consistent way (say, convert INT), while also keeping TRUE/FALSE values for dbs with native boolean support. a) Is this supported with HoneySQL? It doesn't appear to be. b) would registering a new dialect be a good approach, or should this be handled in application code?

seancorfield22:01:32

I'm not even sure what you're asking in terms of HoneySQL -- bit/boolean conversion happens at the JDBC level.

nigel22:01:47

Thanks. I guess my question was really "where should this happen"

seancorfield22:01:22

MySQL does not have a BOOLEAN data type, but its JDBC driver converts to/from Boolean just fine for a BIT(1) field. It's not even done in next.jdbc.

seancorfield22:01:15

For a JDBC driver that doesn't do the conversion you want, you can generally extend the protocols in next.jdbc to "force" the conversion but you have to be a bit careful since such conversions will be global to your application.

nigel22:01:33

Excellent. Thanks for the help.