traject/lib/hathi_macro.rb
# Looks up JDBC url from settings, either 'horizon.jdbc_url' if present,
# or individual settings. Will include password from `horizon.password`
# only if given a `true` arg -- leave false for output to logs, to keep
# password out of logs.
Looks up JDBC url from settings, either 'horizon.jdbc_url' if present,
or individual settings. Will include password from `horizon.password`
only if given a `true` arg -- leave false for output to logs, to keep
password out of logs.
Looks up JDBC url from settings either ' horizon . jdbc_url ' if present or individual settings . Will include password from ` horizon . password ` only if given a ` true ` arg -- leave false for output to logs to keep password out of logs .
def jdbc_url(include_password=false)
    url = if settings.has_key? "horizon.jdbc_url"
      settings["horizon.jdbc_url"]
    else
      jtds_type = settings['horizon.jtds_type'] || 'sybase'
      database  = settings['horizon.database']  || 'horizon'
      host      = settings['horizon.host']      or raise ArgumentError.new("Need horizon.host setting, or horizon.jdbc_url")
      port      = settings['horizon.port']      || '2025'
      user      = settings['horizon.user']      or raise ArgumentError.new("Need horizon.user setting, or horizon.jdbc_url")
      "jdbc:jtds:#{jtds_type}://#{host}:#{port}/#{database};user=#{user}"
    end
    url += ";useCursors=true"
    if timeout = settings['horizon.timeout']
      url += ";socketTimeout=#{timeout};loginTimeout=#{timeout}"
    end
    if include_password
      password  = settings['horizon.password'] or raise ArgumentError.new("Need horizon.password setting")
      url += ";password=#{password}"
    end
    return url
  end
def jdbc_url ( include_password = false ) url = if settings . has_key? "horizon.jdbc_url" settings [ "horizon.jdbc_url" ] else jtds_type = settings [ 'horizon.jtds_type' ] || 'sybase' database = settings [ 'horizon.database' ] || 'horizon' host = settings [ 'horizon.host' ] or raise ArgumentError . new ( "Need horizon.host setting, or horizon.jdbc_url" ) port = settings [ 'horizon.port' ] || '2025' user = settings [ 'horizon.user' ] or raise ArgumentError . new ( "Need horizon.user setting, or horizon.jdbc_url" ) "jdbc:jtds:#{jtds_type}://#{host}:#{port}/#{database};user=#{user}" end url += ";useCursors=true" if timeout = settings [ 'horizon.timeout' ] url += ";socketTimeout=#{timeout};loginTimeout=#{timeout}" end if include_password password = settings [ 'horizon.password' ] or raise ArgumentError . new ( "Need horizon.password setting" ) url += ";password=#{password}" end return url end
Looks up JDBC url from settings, either 'horizon.jdbc_url' if present,
or individual settings.
Looks up JDBC url from settings either ' horizon . jdbc_url ' if present or individual settings .
# Not sure if useCursors makes a difference, but just in case.
include_password
<not_specific>