12: def connect(server)
13: opts = server_opts(server)
14: conn = if opts.include?(:drvconnect)
15: ::ODBC::Database.new.drvconnect(opts[:drvconnect])
16: elsif opts.include?(:driver)
17: Deprecation.deprecate("The odbc driver's handling of the :driver option is thought to be broken and will probably be removed in the future. If you are successfully using it, please contact the developers.")
18: drv = ::ODBC::Driver.new
19: drv.name = 'Sequel ODBC Driver130'
20: opts.each do |param, value|
21: if :driver == param and not (value =~ GUARDED_DRV_NAME)
22: value = DRV_NAME_GUARDS % value
23: end
24: drv.attrs[param.to_s.upcase] = value.to_s
25: end
26: ::ODBC::Database.new.drvconnect(drv)
27: else
28: ::ODBC::connect(opts[:database], opts[:user], opts[:password])
29: end
30: conn.autocommit = true
31: conn
32: end