Fork me on GitHub
#sql
<
2019-07-12
>
jonpither14:07:39

Playing with next.jdbc, newbie Q, but the column names returned via queries / inserts are lowercase vs uppercase depending on the DB

jonpither14:07:22

while I'm here, is there way grab the options back out of the built datasource?

seancorfield17:07:54

@darioszr Yeah, apparently draft releases can only be seen within the org -- TIL. Here's the change log instead https://github.com/seancorfield/next-jdbc/blob/master/CHANGELOG.md (not all changes in 1.0.2 are in issues @thenonameguy)

clj 4
seancorfield18:07:44

@jonpither If you want case consistent across DBs, you'll probably need {:builder-fn rs/as-lower-maps} but that can also cause problems with DBs that are both case-sensitive and return UPPER CASE names... RDBMS is such a hot mess of non-standard and/or inconsistent behavior 😞

jonpither18:07:06

And finding next.jdbc nice so far

seancorfield18:07:11

Unqualified lower case was the default in clojure.java.jdbc. If you have to work across multiple incompatible DBs, it's probably the easier option there too.

seancorfield18:07:59

We use MySQL and it's case-sensitive in table names but not column names, so as-maps is a change for us, but we're slowly shifting over and new code is written with next.jdbc and that default. Where we have to interact with older code, we are trying to use as-unqualified-maps and just ensure our code is case insensitive

seancorfield18:07:29

(we have to be careful that table names stay as-is because of MySQL but it doesn't matter whether column names are mixed or lower case, luckily -- then we just have accessor functions for mixed case column names -- a practice we stopped some years ago, but we have a lot of legacy DB tables with mixed case!)