Further caveat on unqualified column names
This commit is contained in:
parent
bb3048f8f8
commit
e2058fb6ae
1 changed files with 3 additions and 1 deletions
|
|
@ -15,7 +15,9 @@ The default builder for rows and result sets creates qualified keywords that mat
|
|||
* `as-lower-arrays` -- table-qualified lower-case keywords,
|
||||
* `as-unqualified-lower-arrays` -- simple lower-case keywords.
|
||||
|
||||
The reason behind the default is to a) be a simple transform, b) produce qualified keys in keeping with Clojure's direction (with `clojure.spec` etc), and c) not mess with the data. `as-arrays` is (slightly) faster than `as-maps` since it produces less data (vectors of values instead of vectors of hash maps), but the `lower` options will be slightly slower since they include (conditional) logic to convert strings to lower-case. The `unqualified` options may be slightly faster than their qualified equivalents but make no attempt to keep column names unique if your SQL joins across multiple tables.
|
||||
The reason behind the default is to a) be a simple transform, b) produce qualified keys in keeping with Clojure's direction (with `clojure.spec` etc), and c) not mess with the data. `as-arrays` is (slightly) faster than `as-maps` since it produces less data (vectors of values instead of vectors of hash maps), but the `lower` options will be slightly slower since they include (conditional) logic to convert strings to lower-case. The `unqualified` options may be slightly faster than their qualified equivalents but **make no attempt to keep column names unique if your SQL joins across multiple tables**.
|
||||
|
||||
*Note: This is a deliberate difference from `clojure.java.jdbc` which would make column names unique by appending numeric suffices. It was always poor practice to rely on `clojure.java.jdbc`'s renaming behavior and it added quite an overhead to result set building, which is why `next.jdbc` does not support it -- use explicit column aliasing in your SQL instead if you want _unqualified_ column names!*
|
||||
|
||||
In addition, the following generic builders can take `:label-fn` and `:qualifier-fn` options to control how the label and qualified are processed. The `lower` variants above are implemented in terms of these, passing a `lower-case` function for both of those options.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue