Description
(this is just an idea for now)
When creating a new instance of a TinyTds::Client
, it immediately tries to connect to the database. It might be a better pattern to separate the connect
part to a new method that needs to be called separately.
For one, you could call escape
on the Client
without requiring a live connection to the server.
Second, we could investigate to hand off the GVL when calling dbopen
and dbuse
. Both of these functions communicate with the server. In case the connection is slow / bad, it blocks the current Ruby thread. I personally would feel more comfortable handing off the GVL within a method instead of when we initialize a new object in Ruby space.
Technically, the connect
method on the client is already public. It would be more about removing it from initialize
.