Skip to content

Commit 05ae089

Browse files
committed
Ensure proper fallbacks are in place for nil values
1 parent 55b205f commit 05ae089

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/tiny_tds/client.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ def initialize(app_name: "TinyTds", azure: false, charset: "UTF-8", contained: f
3636
@app_name = app_name
3737
@charset = (charset.nil? || charset.casecmp("utf8").zero?) ? "UTF-8" : charset.upcase
3838
@database = database
39-
@dataserver = dataserver || "#{host}:#{port}"
40-
@login_timeout = login_timeout.to_i
39+
@login_timeout = (login_timeout || 60).to_i
4140
@password = password if password && password.to_s.strip != ""
42-
@port = port.to_i
43-
@timeout = timeout.to_i
41+
@port = (port || 1433).to_i
42+
@timeout = (timeout || 5).to_i
4443
@tds_version = tds_versions_setter(tds_version:)
4544
@username = parse_username(azure:, host:, username:)
4645
@use_utf16 = use_utf16.nil? || ["true", "1", "yes"].include?(use_utf16.to_s)
46+
47+
@dataserver = dataserver || "#{host}:#{@port}"
4748
end
4849

4950
def tds_73?

0 commit comments

Comments
 (0)