Closed federkasten closed 9 years ago
Looks good. My only concern is the keyword name, wouldn't properties
or parameters
be more descriptive than extras
?
It makes sense. I have substituted extra
with properties
. Thanks.
Excellent. Can you squash everything into a single commit? Thanks.
Sure. Done.
I needed to make some changes to this.
I found out that you can already set driver properties if Korma is not using connection pool by simply adding key value pairs to to the spec map. For example:
(mysql {:db "korma" :user "root" :useUnicode true :characterEncoding "utf8"})
I changed the solution so that the properties can be given as additional keys in the spec map and the keys can be keywords as well. Internally it doesn't append them to the JDBC url but uses the the .setProperties
method of the datasource instead. This is in line with implementation in clojure.java.jdbc which uses java Properties as well.
:ok_hand:
Improved #259 and #227.
I added the
:extra
option intokorma.db/connection-pool
and a test case for handling non-ascii characters.Extra queries are useful for passing properties to JDBC.
In particular, to make MySQL support non-ascii characters, I have to append queries (e.g.
?useUnicode=true&characterEncoding=utf8
) to JDBC URL.I tested this PR on MySQL(MariaDB) and PostgreSQL. I couldn't test on other databases,
Thanks.