On Monday, February 2, 2015 at 1:31:33 AM UTC-8, Lin Jen-Shin wrote:
>
> Hi, 
>
> I saw that in PostgreSQL adapter, there's 
> `connection_configuration_sqls` which is 
> some statements to configure the connection, such as: 
>
>     SET standard_conforming_strings = ON 
>     SET client_min_messages = 'WARNING' 
>
> Is there a way to configure this array, so that we could insert the 
> other configuration? 
> The statement we want to execute in particular is: 
>
>     SET LC_MONETARY TO 'POSIX' 
>
> This configuration might not be very important, but it would be great 
> if we can do 
> this and for potential configurations we might want to run in the future. 
>

You can do this via using an :after_connect proc, which is passed each 
newly created connection object before it is used by Sequel.

DB = Sequel.connect(..., :after_connect=>proc{|c| c.execute("SET 
LC_MONETARY TO 'POSIX'")})

Note that c in this case is the connection object, so you need to use the 
API of the underlying driver.  The above example will work for the pg and 
postgres-pr drivers, the jdbc driver will require something different.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to