tiny_tds 2.1.2 → 3.2.0

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.
Files changed (64) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +590 -0
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +51 -1
  5. data/Gemfile +1 -8
  6. data/ISSUE_TEMPLATE.md +1 -1
  7. data/README.md +89 -89
  8. data/Rakefile +44 -30
  9. data/VERSION +1 -1
  10. data/docker-compose.yml +34 -0
  11. data/ext/tiny_tds/client.c +100 -59
  12. data/ext/tiny_tds/client.h +5 -3
  13. data/ext/tiny_tds/extconf.rb +173 -52
  14. data/ext/tiny_tds/extconsts.rb +4 -11
  15. data/ext/tiny_tds/result.c +52 -45
  16. data/ext/tiny_tds/tiny_tds_ext.c +4 -1
  17. data/lib/tiny_tds/bin.rb +12 -26
  18. data/lib/tiny_tds/client.rb +38 -42
  19. data/lib/tiny_tds/error.rb +0 -2
  20. data/lib/tiny_tds/gem.rb +5 -14
  21. data/lib/tiny_tds/result.rb +0 -2
  22. data/lib/tiny_tds/version.rb +1 -1
  23. data/lib/tiny_tds.rb +28 -47
  24. data/setup_cimgruby_dev.sh +25 -0
  25. data/start_dev.sh +21 -0
  26. data/tasks/native_gem.rake +12 -10
  27. data/tasks/package.rake +1 -3
  28. data/tasks/ports.rake +14 -77
  29. data/tasks/test.rake +3 -5
  30. data/test/bin/install-freetds.sh +2 -4
  31. data/test/bin/install-mssql.ps1 +42 -0
  32. data/test/bin/install-mssqltools.sh +9 -0
  33. data/test/bin/restore-from-native-gem.ps1 +10 -0
  34. data/test/bin/setup_tinytds_db.sh +7 -0
  35. data/test/bin/setup_volume_permissions.sh +10 -0
  36. data/test/client_test.rb +152 -116
  37. data/test/gem_test.rb +39 -118
  38. data/test/result_test.rb +285 -350
  39. data/test/schema_test.rb +369 -395
  40. data/test/sql/db-create.sql +18 -0
  41. data/test/sql/db-login.sql +38 -0
  42. data/test/test_helper.rb +112 -85
  43. data/test/thread_test.rb +22 -31
  44. data/tiny_tds.gemspec +28 -26
  45. metadata +85 -59
  46. data/.travis.yml +0 -24
  47. data/BACKERS.md +0 -32
  48. data/appveyor.yml +0 -51
  49. data/tasks/ports/freetds.rb +0 -37
  50. data/tasks/ports/libiconv.rb +0 -43
  51. data/tasks/ports/openssl.rb +0 -78
  52. data/tasks/ports/recipe.rb +0 -52
  53. data/test/appveyor/dbsetup.ps1 +0 -27
  54. data/test/appveyor/dbsetup.sql +0 -9
  55. data/test/benchmark/query.rb +0 -77
  56. data/test/benchmark/query_odbc.rb +0 -106
  57. data/test/benchmark/query_tinytds.rb +0 -126
  58. data/test/bin/setup.sh +0 -19
  59. data/test/schema/sqlserver_2000.sql +0 -140
  60. data/test/schema/sqlserver_2005.sql +0 -140
  61. data/test/schema/sqlserver_2014.sql +0 -140
  62. data/test/schema/sqlserver_2016.sql +0 -140
  63. data/test/schema/sybase_ase.sql +0 -138
  64. /data/test/schema/{sqlserver_2008.sql → sqlserver_2017.sql} +0 -0
data/test/gem_test.rb CHANGED
@@ -1,67 +1,65 @@
1
- # encoding: utf-8
2
- require 'test_helper'
3
- require 'tiny_tds/gem'
1
+ require "test_helper"
2
+ require "tiny_tds/gem"
4
3
 
5
- class GemTest < MiniTest::Spec
6
- gem_root ||= File.expand_path '../..', __FILE__
4
+ class GemTest < Minitest::Spec
5
+ gem_root ||= File.expand_path "../..", __FILE__
7
6
 
8
7
  describe TinyTds::Gem do
9
-
10
8
  # We're going to muck with some system globals so lets make sure
11
9
  # they get set back later
12
- original_host = RbConfig::CONFIG['host']
10
+ original_platform = RbConfig::CONFIG["arch"]
13
11
  original_pwd = Dir.pwd
14
12
 
15
13
  after do
16
- RbConfig::CONFIG['host'] = original_host
14
+ RbConfig::CONFIG["arch"] = original_platform
17
15
  Dir.chdir original_pwd
18
16
  end
19
17
 
20
- describe '#root_path' do
18
+ describe "#root_path" do
21
19
  let(:root_path) { TinyTds::Gem.root_path }
22
20
 
23
- it 'should be the root path' do
24
- root_path.must_equal gem_root
21
+ it "should be the root path" do
22
+ _(root_path).must_equal gem_root
25
23
  end
26
24
 
27
- it 'should be the root path no matter the cwd' do
28
- Dir.chdir '/'
25
+ it "should be the root path no matter the cwd" do
26
+ Dir.chdir "/"
29
27
 
30
- root_path.must_equal gem_root
28
+ _(root_path).must_equal gem_root
31
29
  end
32
30
  end
33
31
 
34
- describe '#ports_root_path' do
32
+ describe "#ports_root_path" do
35
33
  let(:ports_root_path) { TinyTds::Gem.ports_root_path }
36
34
 
37
- it 'should be the ports path' do
38
- ports_root_path.must_equal File.join(gem_root,'ports')
35
+ it "should be the ports path" do
36
+ _(ports_root_path).must_equal File.join(gem_root, "ports")
39
37
  end
40
38
 
41
- it 'should be the ports path no matter the cwd' do
42
- Dir.chdir '/'
39
+ it "should be the ports path no matter the cwd" do
40
+ Dir.chdir "/"
43
41
 
44
- ports_root_path.must_equal File.join(gem_root,'ports')
42
+ _(ports_root_path).must_equal File.join(gem_root, "ports")
45
43
  end
46
44
  end
47
45
 
48
- describe '#ports_bin_paths' do
46
+ describe "#ports_bin_paths" do
49
47
  let(:ports_bin_paths) { TinyTds::Gem.ports_bin_paths }
50
-
51
- describe 'when the ports directories exist' do
48
+
49
+ describe "when the ports directories exist" do
52
50
  let(:fake_bin_paths) do
53
- ports_host_root = File.join(gem_root, 'ports', 'fake-host-with-dirs')
51
+ ports_host_root = File.join(gem_root, "ports", "fake-host-with-dirs")
54
52
  [
55
- File.join('a','bin'),
56
- File.join('a','inner','bin'),
57
- File.join('b','bin')
53
+ File.join("a", "bin"),
54
+ File.join("a", "inner", "bin"),
55
+ File.join("b", "bin")
58
56
  ].map do |p|
59
57
  File.join(ports_host_root, p)
60
58
  end
61
59
  end
62
60
 
63
61
  before do
64
- RbConfig::CONFIG['host'] = 'fake-host-with-dirs'
62
+ RbConfig::CONFIG["arch"] = "fake-host-with-dirs"
65
63
  fake_bin_paths.each do |path|
66
64
  FileUtils.mkdir_p(path)
67
65
  end
@@ -69,111 +67,34 @@ class GemTest < MiniTest::Spec
69
67
 
70
68
  after do
71
69
  FileUtils.remove_entry_secure(
72
- File.join(gem_root, 'ports', 'fake-host-with-dirs'), true
70
+ File.join(gem_root, "ports", "fake-host-with-dirs"), true
73
71
  )
74
72
  end
75
73
 
76
- it 'should return all the bin directories' do
77
- ports_bin_paths.sort.must_equal fake_bin_paths.sort
74
+ it "should return all the bin directories" do
75
+ _(ports_bin_paths.sort).must_equal fake_bin_paths.sort
78
76
  end
79
77
 
80
- it 'should return all the bin directories regardless of cwd' do
81
- Dir.chdir '/'
82
- ports_bin_paths.sort.must_equal fake_bin_paths.sort
78
+ it "should return all the bin directories regardless of cwd" do
79
+ Dir.chdir "/"
80
+ _(ports_bin_paths.sort).must_equal fake_bin_paths.sort
83
81
  end
84
82
  end
85
83
 
86
- describe 'when the ports directories are missing' do
84
+ describe "when the ports directories are missing" do
87
85
  before do
88
- RbConfig::CONFIG['host'] = 'fake-host-without-dirs'
86
+ RbConfig::CONFIG["arch"] = "fake-host-without-dirs"
89
87
  end
90
88
 
91
- it 'should return no directories' do
92
- ports_bin_paths.must_be_empty
89
+ it "should return no directories" do
90
+ _(ports_bin_paths).must_be_empty
93
91
  end
94
92
 
95
- it 'should return no directories regardless of cwd' do
96
- Dir.chdir '/'
97
- ports_bin_paths.must_be_empty
98
- end
99
- end
100
- end
101
-
102
- describe '#ports_lib_paths' do
103
- let(:ports_lib_paths) { TinyTds::Gem.ports_lib_paths }
104
-
105
- describe 'when the ports directories exist' do
106
- let(:fake_lib_paths) do
107
- ports_host_root = File.join(gem_root, 'ports', 'fake-host-with-dirs')
108
- [
109
- File.join('a','lib'),
110
- File.join('a','inner','lib'),
111
- File.join('b','lib')
112
- ].map do |p|
113
- File.join(ports_host_root, p)
114
- end
115
- end
116
-
117
- before do
118
- RbConfig::CONFIG['host'] = 'fake-host-with-dirs'
119
- fake_lib_paths.each do |path|
120
- FileUtils.mkdir_p(path)
121
- end
122
- end
123
-
124
- after do
125
- FileUtils.remove_entry_secure(
126
- File.join(gem_root, 'ports', 'fake-host-with-dirs'), true
127
- )
128
- end
129
-
130
- it 'should return all the lib directories' do
131
- ports_lib_paths.sort.must_equal fake_lib_paths.sort
132
- end
133
-
134
- it 'should return all the lib directories regardless of cwd' do
135
- Dir.chdir '/'
136
- ports_lib_paths.sort.must_equal fake_lib_paths.sort
137
- end
138
- end
139
-
140
- describe 'when the ports directories are missing' do
141
- before do
142
- RbConfig::CONFIG['host'] = 'fake-host-without-dirs'
143
- end
144
-
145
-
146
- it 'should return no directories' do
147
- ports_lib_paths.must_be_empty
148
- end
149
-
150
- it 'should return no directories regardless of cwd' do
151
- Dir.chdir '/'
152
- ports_lib_paths.must_be_empty
153
- end
154
- end
155
- end
156
-
157
- describe '#ports_host' do
158
- {
159
- 'i686-pc-linux-gnu' => 'i686-pc-linux-gnu',
160
- 'x86_64-pc-linux-gnu' => 'x86_64-pc-linux-gnu',
161
- 'i686-w64-mingw32' => 'i686-w64-mingw32',
162
- 'x86_64-w64-mingw32' => 'x86_64-w64-mingw32',
163
- # consolidate this host to our build w64-mingw32 arch
164
- 'i686-pc-mingw32' => 'i686-w64-mingw32'
165
- }.each do |host,expected|
166
- describe "on a #{host} architecture" do
167
- before do
168
- RbConfig::CONFIG['host'] = host
169
- end
170
-
171
- it "should return a #{expected} ports host" do
172
- TinyTds::Gem.ports_host.must_equal expected
173
- end
93
+ it "should return no directories regardless of cwd" do
94
+ Dir.chdir "/"
95
+ _(ports_bin_paths).must_be_empty
174
96
  end
175
97
  end
176
98
  end
177
99
  end
178
100
  end
179
-