sql

All things SQL and JDBC...
Ben Sless 2021-04-11T14:35:12.118800Z

Is there a way in next.jdbc to treat some column values as keywords? Can I define a coercion around certain columns? I wanted to use keywords as enumerable values.

seancorfield 2021-04-11T16:41:14.119300Z

Sounds like you want SettableParameter - extend that protocol to keywords.

Ben Sless 2021-04-11T17:09:09.119700Z

I'm using h2 for tests and will probably use postgres in production

Ben Sless 2021-04-11T17:13:27.120Z

If I read this correctly SettableParameter is only for write? For reads I'll have to implement builders.

seancorfield 2021-04-11T17:15:10.120200Z

There’s a ReadableColumn protocol as well. It sounded like you wanted to write keywords into enumerations, sorry.

seancorfield 2021-04-11T17:18:43.120400Z

I don’t think you gain much by trying to use keywords for enumerated types, TBH. Converting them to strings on write via SettableParameter is straightforward, but figuring out which columns need to be keywordized on read is not as simple (because of the API that JDBC affords) and using strings in your code to match these column values isn’t a great hardship — in our experience (with 113K lines of Clojure and a MySQL database full of ENUM type columns!).

Ben Sless 2021-04-11T17:44:04.120600Z

Alright, I'll look into it (after some sleep) Thank you 🙂