Sha256: 81ce619bf9331cf3bb541598cd195b0dcfcbe2a30842bd76a97ccfd582d19fda

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

# encoding: UTF-8
require 'date'
require 'bigdecimal'
require 'rational' unless RUBY_VERSION >= '1.9.2'

require 'tiny_tds/version'
require 'tiny_tds/error'
require 'tiny_tds/client'
require 'tiny_tds/result'

# Support multiple ruby versions, fat binaries under Windows.
if RUBY_PLATFORM =~ /mingw|mswin/ && RUBY_VERSION =~ /(\d+.\d+)/
  ver = $1
  # Set the PATH environment variable, so that the DLLs can be found.
  old_path = ENV['PATH']
  begin
    # Do the same host consolidation as in extconf.rb
    ports_dir = RbConfig::CONFIG["host"].gsub('i586-mingw32msvc', 'i686-w64-mingw32').
                                         gsub('i686-pc-mingw32', 'i686-w64-mingw32')
    ENV['PATH'] = "#{File.expand_path("../../ports/#{ports_dir}/bin", __FILE__)};#{old_path}"
    require "tiny_tds/#{ver}/tiny_tds"
  rescue LoadError
    require 'tiny_tds/tiny_tds'
  ensure
    ENV['PATH'] = old_path
  end
else
  # Load dependent shared libraries into the process, so that they are already present,
  # when tiny_tds.so is loaded. This ensures, that shared libraries are loaded even when
  # the path is different between build and run time (e.g. Heroku).
  ports_libs = File.expand_path("../../ports/#{RbConfig::CONFIG["host"]}/lib/*.so", __FILE__)
  Dir[ports_libs].each do |lib|
    require "fiddle"
    Fiddle.dlopen(lib)
  end

  require 'tiny_tds/tiny_tds'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tiny_tds-0.6.3.rc2-x64-mingw32 lib/tiny_tds.rb
tiny_tds-0.6.3.rc2-x86-mingw32 lib/tiny_tds.rb
tiny_tds-0.6.3.rc2 lib/tiny_tds.rb