Ok, so it seems :after_connect provides the underlying adapter connection 
object, rather than a Sequel::Database object. Ideally it'd be nice to keep 
my post-connection queries adapter agnostic and work with a 
Sequel::Database instance. Is there a way to achieve this?

Tom

On Thursday, 13 July 2017 12:26:43 UTC+10, Tom Wardrop wrote:
>
> Why is it that I never find the answer I'm after before posting, but then 
> find it immediately after I post: 
> https://groups.google.com/forum/#!topic/sequel-talk/AE8EfF5wSJU
>
> I assume that's the way to go.
>
> On Thursday, 13 July 2017 12:25:39 UTC+10, Tom Wardrop wrote:
>>
>> Hey Guys,
>>
>> I've finally got to the bottom of a bit of a weird issue. The issue was 
>> that if the database connection was interrupted, say because the SQL server 
>> had to reboot for updates overnight, I'd have to restart my app due to user 
>> session issues, despite the fact that Sequel was automatically reconnecting 
>> to the database. Eventually, I worked out the problem was that on 
>> reconnection, the "SET" statements I was running on application startup 
>> (obviously) weren't being applied to the new connection. Here's an example 
>> of what my app does when it starts up:
>>
>>   db = Sequel.connect(CONFIG[:db])
>>   db << 'SET DATEFORMAT DMY'
>>   db << 'SET ANSI_NULLS ON'
>>   db << 'SET CONCAT_NULL_YIELDS_NULL OFF'
>>   db << 'SET TEXTSIZE 2147483647' # Required for storing binary files and 
>> long text in SQL. Otherwise the default maximum size is 4kb.
>>
>> The TEXTSIZE defaulting to 4kb after reconnection is what was causing my 
>> app to have issues. So my question is, what's the best way of running a 
>> series of queries/commands after Sequel automatically reconnects. Is there 
>> an appropriate hook, or some better way to do what I'm doing?
>>
>> Cheers,
>> Tom
>>
>

-- 
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 https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to