2014-02-18 13:00 GMT+01:00 Ben Hood <[email protected]>: > Hey Lukas, > > On Tue, Feb 18, 2014 at 11:48 AM, Lukas Eder <[email protected]> wrote: > > This is something you should be doing directly on the connection pool / > > driver. > > I found an option in the BoneCP API that does the trick: > > config.setInitSQL("set lc_numeric = 'sv_SE.UTF-8';"); > > You still have to build a custom field to get Postgres to format > decimals according to the locale: > > Field<String> localized = DSL.field("to_char({0},'999D99')", > String.class, SOME_FIELD); > > But JOOQ handles that for you quite well. >
Hmm, I've recently added TO_CHAR() to the OracleDSL: https://github.com/jOOQ/jOOQ/issues/2832 I wonder if TO_CHAR is widely supported. I guess it could be moved up to DSL, even if the formatting strings are probably not compatible between databases. > BTW, nice like subtle point you make about being type safe when > handling locales :-) > Oh, you know. I just thought that you would have an enum with values like lc_numeric, and then pass that to: YourDSL.set(LC_NUMERIC, "sv_SE.UTF-8"); But if BoneCP already has that feature, that's good enough. On a different note, I'm wondering if I'm shooting myself in the foot > by switching locales - it's like using a non-US keyboard layout :-( Oh, certainly. That's the beginning of the end :-) Cheers Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
