tiny_tds 3.0.0-x64-mingw-ucrt → 3.2.0-x64-mingw-ucrt
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +194 -74
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -1
- data/README.md +59 -50
- data/Rakefile +46 -37
- data/VERSION +1 -1
- data/ext/tiny_tds/extconf.rb +169 -70
- data/ext/tiny_tds/extconsts.rb +3 -4
- data/lib/tiny_tds/3.1/tiny_tds.so +0 -0
- data/lib/tiny_tds/3.2/tiny_tds.so +0 -0
- data/lib/tiny_tds/3.3/tiny_tds.so +0 -0
- data/lib/tiny_tds/3.4/tiny_tds.so +0 -0
- data/lib/tiny_tds/bin.rb +12 -26
- data/lib/tiny_tds/client.rb +38 -42
- data/lib/tiny_tds/error.rb +0 -2
- data/lib/tiny_tds/gem.rb +5 -9
- data/lib/tiny_tds/result.rb +0 -2
- data/lib/tiny_tds/version.rb +1 -1
- data/lib/tiny_tds.rb +28 -47
- data/ports/x64-mingw-ucrt/{freetds/1.4.23/bin → bin}/defncopy.exe +0 -0
- data/ports/x64-mingw-ucrt/bin/libsybdb-5.dll +0 -0
- data/ports/x64-mingw-ucrt/bin/tsql.exe +0 -0
- data/tasks/native_gem.rake +11 -18
- data/tasks/package.rake +1 -3
- data/tasks/ports.rake +7 -91
- data/tasks/test.rake +3 -5
- data/test/bin/install-freetds.sh +2 -4
- data/test/bin/restore-from-native-gem.ps1 +10 -0
- data/test/client_test.rb +106 -112
- data/test/gem_test.rb +32 -108
- data/test/result_test.rb +208 -221
- data/test/schema_test.rb +177 -181
- data/test/test_helper.rb +59 -64
- data/test/thread_test.rb +22 -31
- data/tiny_tds.gemspec +28 -29
- metadata +29 -44
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/bsqldb.exe +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/datacopy.exe +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/freebcp.exe +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/libct-4.dll +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/libsybdb-5.dll +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/osql +0 -393
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/tdspool.exe +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/bin/tsql.exe +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/lib/libct.dll.a +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/lib/libct.la +0 -41
- data/ports/x64-mingw-ucrt/freetds/1.4.23/lib/libsybdb.dll.a +0 -0
- data/ports/x64-mingw-ucrt/freetds/1.4.23/lib/libsybdb.la +0 -41
- data/ports/x64-mingw-ucrt/libiconv/1.17/bin/iconv.exe +0 -0
- data/ports/x64-mingw-ucrt/libiconv/1.17/bin/libcharset-1.dll +0 -0
- data/ports/x64-mingw-ucrt/libiconv/1.17/bin/libiconv-2.dll +0 -0
- data/ports/x64-mingw-ucrt/libiconv/1.17/lib/libcharset.dll.a +0 -0
- data/ports/x64-mingw-ucrt/libiconv/1.17/lib/libcharset.la +0 -41
- data/ports/x64-mingw-ucrt/libiconv/1.17/lib/libiconv.dll.a +0 -0
- data/ports/x64-mingw-ucrt/libiconv/1.17/lib/libiconv.la +0 -41
- data/ports/x64-mingw-ucrt/openssl/3.4.0/bin/c_rehash +0 -252
- data/ports/x64-mingw-ucrt/openssl/3.4.0/bin/libcrypto-3-x64.dll +0 -0
- data/ports/x64-mingw-ucrt/openssl/3.4.0/bin/libssl-3-x64.dll +0 -0
- data/ports/x64-mingw-ucrt/openssl/3.4.0/bin/openssl.exe +0 -0
- data/tasks/ports/freetds.rb +0 -32
- data/tasks/ports/libiconv.rb +0 -26
- data/tasks/ports/openssl.rb +0 -62
- data/tasks/ports/recipe.rb +0 -64
- data/test/benchmark/query.rb +0 -77
- data/test/benchmark/query_odbc.rb +0 -106
- data/test/benchmark/query_tinytds.rb +0 -126
data/lib/tiny_tds/gem.rb
CHANGED
@@ -1,26 +1,22 @@
|
|
1
|
-
require
|
1
|
+
require "rbconfig"
|
2
2
|
|
3
3
|
module TinyTds
|
4
4
|
module Gem
|
5
5
|
class << self
|
6
6
|
def root_path
|
7
|
-
File.expand_path
|
7
|
+
File.expand_path "../../..", __FILE__
|
8
8
|
end
|
9
9
|
|
10
10
|
def ports_root_path
|
11
|
-
File.join(root_path,
|
11
|
+
File.join(root_path, "ports")
|
12
12
|
end
|
13
13
|
|
14
14
|
def ports_bin_paths
|
15
|
-
Dir.glob(File.join(ports_root_path,
|
15
|
+
Dir.glob(File.join(ports_root_path, "**", "bin"))
|
16
16
|
end
|
17
17
|
|
18
18
|
def ports_lib_paths
|
19
|
-
Dir.glob(File.join(ports_root_path,
|
20
|
-
end
|
21
|
-
|
22
|
-
def ports_host
|
23
|
-
RbConfig::CONFIG["arch"]
|
19
|
+
Dir.glob(File.join(ports_root_path, "**", "lib"))
|
24
20
|
end
|
25
21
|
end
|
26
22
|
end
|
data/lib/tiny_tds/result.rb
CHANGED
data/lib/tiny_tds/version.rb
CHANGED
data/lib/tiny_tds.rb
CHANGED
@@ -1,61 +1,42 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
require 'bigdecimal'
|
4
|
-
require 'rational'
|
1
|
+
require "date"
|
2
|
+
require "bigdecimal"
|
5
3
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
4
|
+
require "tiny_tds/version"
|
5
|
+
require "tiny_tds/error"
|
6
|
+
require "tiny_tds/client"
|
7
|
+
require "tiny_tds/result"
|
8
|
+
require "tiny_tds/gem"
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
module TinyTds
|
11
|
+
# Is this file part of a fat binary gem with bundled freetds?
|
12
|
+
# This path must be enabled by add_dll_directory on Windows.
|
13
|
+
gplat = ::Gem::Platform.local
|
14
|
+
FREETDS_LIB_PATH = Dir[File.expand_path("../ports/#{gplat.cpu}-#{gplat.os}*/lib", __dir__)].first
|
15
15
|
|
16
16
|
add_dll_path = proc do |path, &block|
|
17
|
-
|
18
|
-
require 'ruby_installer/runtime'
|
19
|
-
RubyInstaller::Runtime.add_dll_directory(path, &block)
|
20
|
-
rescue LoadError
|
21
|
-
old_path = ENV['PATH']
|
22
|
-
ENV['PATH'] = "#{path};#{old_path}"
|
17
|
+
if RUBY_PLATFORM =~ /(mswin|mingw)/i && path
|
23
18
|
begin
|
19
|
+
require "ruby_installer/runtime"
|
20
|
+
RubyInstaller::Runtime.add_dll_directory(path, &block)
|
21
|
+
rescue LoadError
|
22
|
+
old_path = ENV["PATH"]
|
23
|
+
ENV["PATH"] = "#{path};#{old_path}"
|
24
24
|
block.call
|
25
|
-
|
26
|
-
ENV['PATH'] = old_path
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
add_dll_paths = proc do |paths, &block|
|
32
|
-
if path=paths.shift
|
33
|
-
add_dll_path.call(path) do
|
34
|
-
add_dll_paths.call(paths, &block)
|
25
|
+
ENV["PATH"] = old_path
|
35
26
|
end
|
36
27
|
else
|
28
|
+
# libsybdb is found by a relative rpath in the cross compiled extension dll
|
29
|
+
# or by the system library loader
|
37
30
|
block.call
|
38
31
|
end
|
39
32
|
end
|
40
33
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
49
|
-
else
|
50
|
-
# Load dependent shared libraries into the process, so that they are already present,
|
51
|
-
# when tiny_tds.so is loaded. This ensures, that shared libraries are loaded even when
|
52
|
-
# the path is different between build and run time (e.g. Heroku).
|
53
|
-
ports_libs = File.join(TinyTds::Gem.ports_root_path,
|
54
|
-
"#{RbConfig::CONFIG['host']}/lib/*.so")
|
55
|
-
Dir[ports_libs].each do |lib|
|
56
|
-
require 'fiddle'
|
57
|
-
Fiddle.dlopen(lib)
|
34
|
+
add_dll_path.call(FREETDS_LIB_PATH) do
|
35
|
+
# Try the <major>.<minor> subdirectory for fat binary gems
|
36
|
+
major_minor = RUBY_VERSION[/^(\d+\.\d+)/] or
|
37
|
+
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
|
38
|
+
require "tiny_tds/#{major_minor}/tiny_tds"
|
39
|
+
rescue LoadError
|
40
|
+
require "tiny_tds/tiny_tds"
|
58
41
|
end
|
59
|
-
|
60
|
-
require 'tiny_tds/tiny_tds'
|
61
42
|
end
|
Binary file
|
Binary file
|
Binary file
|
data/tasks/native_gem.rake
CHANGED
@@ -1,23 +1,16 @@
|
|
1
|
-
|
1
|
+
CrossLibraries.each do |xlib|
|
2
|
+
platform = xlib.platform
|
2
3
|
|
3
|
-
desc
|
4
|
-
task
|
5
|
-
|
4
|
+
desc "Build fat binary gem for platform #{platform}"
|
5
|
+
task "gem:native:#{platform}" do
|
6
|
+
require "rake_compiler_dock"
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
RakeCompilerDock.sh "bundle --local && RUBY_CC_VERSION=#{meta[:ruby_versions]} rake native:#{plat} gem", platform: plat
|
8
|
+
RakeCompilerDock.sh <<-EOT, platform: platform
|
9
|
+
bundle install &&
|
10
|
+
rake native:#{platform} pkg/#{SPEC.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=#{RakeCompilerDock.set_ruby_cc_version("~> 2.7", "~> 3.0")} MAKEFLAGS="V=1"
|
11
|
+
EOT
|
12
12
|
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# assumes you are in a container provided by Rake compiler
|
16
|
-
# if not, use the task above
|
17
|
-
task 'gem:for_platform', [:gem_platform] do |_task, args|
|
18
|
-
args.with_defaults(gem_platform: RbConfig::CONFIG["arch"])
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
sh "RUBY_CC_VERSION=#{GEM_PLATFORM_HOSTS[args.gem_platform][:ruby_versions]} rake native:#{args.gem_platform} gem"
|
14
|
+
desc "Build the native binary gems"
|
15
|
+
multitask "gem:native" => "gem:native:#{platform}"
|
23
16
|
end
|
data/tasks/package.rake
CHANGED
data/tasks/ports.rake
CHANGED
@@ -1,108 +1,24 @@
|
|
1
|
-
|
2
|
-
require 'mini_portile2'
|
3
|
-
require 'fileutils'
|
4
|
-
require_relative 'ports/libiconv'
|
5
|
-
require_relative 'ports/openssl'
|
6
|
-
require_relative 'ports/freetds'
|
7
|
-
require_relative '../ext/tiny_tds/extconsts'
|
1
|
+
require_relative "../ext/tiny_tds/extconsts"
|
8
2
|
|
9
3
|
namespace :ports do
|
10
4
|
libraries_to_compile = {
|
11
|
-
openssl:
|
12
|
-
libiconv:
|
13
|
-
freetds:
|
5
|
+
openssl: OPENSSL_VERSION,
|
6
|
+
libiconv: ICONV_VERSION,
|
7
|
+
freetds: FREETDS_VERSION
|
14
8
|
}
|
15
9
|
|
16
|
-
directory "ports"
|
17
|
-
CLEAN.include "ports/*mingw*"
|
18
|
-
CLEAN.include "ports/*.installed"
|
19
|
-
|
20
|
-
task :openssl, [:host, :gem_platform] do |_task, args|
|
21
|
-
args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
|
22
|
-
|
23
|
-
libraries_to_compile[:openssl].files = [OPENSSL_SOURCE_URI]
|
24
|
-
libraries_to_compile[:openssl].host = args.host
|
25
|
-
libraries_to_compile[:openssl].gem_platform = args.gem_platform
|
26
|
-
|
27
|
-
libraries_to_compile[:openssl].cook
|
28
|
-
libraries_to_compile[:openssl].activate
|
29
|
-
end
|
30
|
-
|
31
|
-
task :libiconv, [:host, :gem_platform] do |_task, args|
|
32
|
-
args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
|
33
|
-
|
34
|
-
libraries_to_compile[:libiconv].files = [ICONV_SOURCE_URI]
|
35
|
-
libraries_to_compile[:libiconv].host = args.host
|
36
|
-
libraries_to_compile[:libiconv].gem_platform = args.gem_platform
|
37
|
-
libraries_to_compile[:libiconv].cook
|
38
|
-
libraries_to_compile[:libiconv].activate
|
39
|
-
end
|
40
|
-
|
41
|
-
task :freetds, [:host, :gem_platform] do |_task, args|
|
42
|
-
args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
|
43
|
-
|
44
|
-
libraries_to_compile[:freetds].files = [FREETDS_SOURCE_URI]
|
45
|
-
libraries_to_compile[:freetds].host = args.host
|
46
|
-
libraries_to_compile[:freetds].gem_platform = args.gem_platform
|
47
|
-
|
48
|
-
if libraries_to_compile[:openssl]
|
49
|
-
# freetds doesn't have an option that will provide an rpath
|
50
|
-
# so we do it manually
|
51
|
-
ENV['OPENSSL_CFLAGS'] = "-Wl,-rpath -Wl,#{libraries_to_compile[:openssl].path}/lib64"
|
52
|
-
# Add the pkgconfig file with MSYS2'ish path, to prefer our ports build
|
53
|
-
# over MSYS2 system OpenSSL.
|
54
|
-
ENV['PKG_CONFIG_PATH'] = "#{libraries_to_compile[:openssl].path.gsub(/^(\w):/i) { "/" + $1.downcase }}/lib64/pkgconfig:#{ENV['PKG_CONFIG_PATH']}"
|
55
|
-
libraries_to_compile[:freetds].configure_options << "--with-openssl=#{libraries_to_compile[:openssl].path}"
|
56
|
-
end
|
57
|
-
|
58
|
-
if libraries_to_compile[:libiconv]
|
59
|
-
libraries_to_compile[:freetds].configure_options << "--with-libiconv-prefix=#{libraries_to_compile[:libiconv].path}"
|
60
|
-
end
|
61
|
-
|
62
|
-
libraries_to_compile[:freetds].cook
|
63
|
-
libraries_to_compile[:freetds].activate
|
64
|
-
end
|
65
|
-
|
66
|
-
task :compile, [:host, :gem_platform] do |_task, args|
|
67
|
-
args.with_defaults(host: RbConfig::CONFIG['host'], gem_platform: RbConfig::CONFIG["arch"])
|
68
|
-
|
69
|
-
puts "Compiling ports for #{args.host} (Ruby platform #{args.gem_platform}) ..."
|
70
|
-
|
71
|
-
libraries_to_compile.keys.each do |lib|
|
72
|
-
Rake::Task["ports:#{lib}"].invoke(args.host, args.gem_platform)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
desc 'Build the ports windows binaries via rake-compiler-dock'
|
77
|
-
task 'cross' do
|
78
|
-
require 'rake_compiler_dock'
|
79
|
-
|
80
|
-
# build the ports for all our cross compile hosts
|
81
|
-
GEM_PLATFORM_HOSTS.each do |gem_platform, meta|
|
82
|
-
# make sure to install our bundle
|
83
|
-
build = ['bundle']
|
84
|
-
build << "RUBY_CC_VERSION=#{meta[:ruby_versions]} rake ports:compile[#{meta[:host]},#{gem_platform}] MAKE='make -j`nproc`'"
|
85
|
-
RakeCompilerDock.sh build.join(' && '), platform: gem_platform
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
10
|
desc "Notes the actual versions for the compiled ports into a file"
|
90
11
|
task "version_file", [:gem_platform] do |_task, args|
|
91
12
|
args.with_defaults(gem_platform: RbConfig::CONFIG["arch"])
|
92
13
|
|
93
14
|
ports_version = {}
|
94
15
|
|
95
|
-
libraries_to_compile.each do |library,
|
96
|
-
ports_version[library] =
|
16
|
+
libraries_to_compile.each do |library, version|
|
17
|
+
ports_version[library] = version
|
97
18
|
end
|
98
19
|
|
99
20
|
ports_version[:platform] = args.gem_platform
|
100
21
|
|
101
|
-
File.
|
102
|
-
f.write ports_version
|
103
|
-
end
|
22
|
+
File.write(".ports_versions", ports_version)
|
104
23
|
end
|
105
24
|
end
|
106
|
-
|
107
|
-
desc 'Build ports and activate libraries for the current architecture.'
|
108
|
-
task :ports => ['ports:compile']
|
data/tasks/test.rake
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
require 'rake/testtask'
|
1
|
+
require "rake/testtask"
|
3
2
|
|
4
3
|
Rake::TestTask.new do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.test_files = FileList[
|
4
|
+
t.libs << "test"
|
5
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
7
6
|
t.verbose = true
|
8
7
|
end
|
9
|
-
|
data/test/bin/install-freetds.sh
CHANGED
@@ -10,11 +10,9 @@ fi
|
|
10
10
|
wget http://www.freetds.org/files/stable/freetds-$FREETDS_VERSION.tar.gz
|
11
11
|
tar -xzf freetds-$FREETDS_VERSION.tar.gz
|
12
12
|
cd freetds-$FREETDS_VERSION
|
13
|
-
./configure
|
14
|
-
--with-openssl=/opt/local \
|
15
|
-
--with-tdsver=7.3
|
13
|
+
./configure
|
16
14
|
make
|
17
|
-
make install
|
15
|
+
sudo make install
|
18
16
|
cd ..
|
19
17
|
rm -rf freetds-$FREETDS_VERSION
|
20
18
|
rm freetds-$FREETDS_VERSION.tar.gz
|
@@ -0,0 +1,10 @@
|
|
1
|
+
$gemVersion = (Get-Content VERSION).Trim()
|
2
|
+
$gemToUnpack = "./tiny_tds-$gemVersion-$env:RUBY_ARCHITECTURE.gem"
|
3
|
+
|
4
|
+
Write-Host "Looking to unpack $gemToUnpack"
|
5
|
+
gem unpack --target ./tmp "$gemToUnpack"
|
6
|
+
|
7
|
+
# Restore precompiled code
|
8
|
+
$source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$env:RUBY_ARCHITECTURE\lib\tiny_tds").Path
|
9
|
+
$destination = (Resolve-Path ".\lib\tiny_tds").Path
|
10
|
+
Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
|