tiny_tds 1.0.4 → 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/.codeclimate.yml +20 -0
  3. data/.gitattributes +1 -0
  4. data/.github/workflows/ci.yml +590 -0
  5. data/.gitignore +2 -0
  6. data/.rubocop.yml +31 -0
  7. data/{CHANGELOG → CHANGELOG.md} +133 -26
  8. data/Gemfile +1 -5
  9. data/ISSUE_TEMPLATE.md +36 -3
  10. data/README.md +147 -85
  11. data/Rakefile +51 -94
  12. data/VERSION +1 -1
  13. data/docker-compose.yml +34 -0
  14. data/ext/tiny_tds/client.c +149 -67
  15. data/ext/tiny_tds/client.h +11 -5
  16. data/ext/tiny_tds/extconf.rb +144 -283
  17. data/ext/tiny_tds/extconsts.rb +4 -11
  18. data/ext/tiny_tds/result.c +68 -50
  19. data/ext/tiny_tds/tiny_tds_ext.c +4 -1
  20. data/lib/tiny_tds/bin.rb +44 -40
  21. data/lib/tiny_tds/client.rb +63 -55
  22. data/lib/tiny_tds/error.rb +0 -3
  23. data/lib/tiny_tds/gem.rb +23 -0
  24. data/lib/tiny_tds/result.rb +0 -3
  25. data/lib/tiny_tds.rb +37 -32
  26. data/{ports/patches/freetds/1.00 → patches/freetds/1.00.27}/0001-mingw_missing_inet_pton.diff +4 -4
  27. data/patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff +28 -0
  28. data/patches/libiconv/1.14/1-avoid-gets-error.patch +17 -0
  29. data/setup_cimgruby_dev.sh +25 -0
  30. data/start_dev.sh +21 -0
  31. data/tasks/native_gem.rake +16 -0
  32. data/tasks/package.rake +6 -0
  33. data/tasks/ports.rake +24 -0
  34. data/tasks/test.rake +7 -0
  35. data/test/bin/install-freetds.sh +18 -0
  36. data/test/bin/install-mssql.ps1 +42 -0
  37. data/test/bin/install-mssqltools.sh +9 -0
  38. data/test/bin/install-openssl.sh +18 -0
  39. data/test/bin/restore-from-native-gem.ps1 +10 -0
  40. data/test/bin/setup_tinytds_db.sh +7 -0
  41. data/test/bin/setup_volume_permissions.sh +10 -0
  42. data/test/client_test.rb +161 -112
  43. data/test/gem_test.rb +100 -0
  44. data/test/result_test.rb +293 -313
  45. data/test/schema_test.rb +369 -395
  46. data/test/sql/db-create.sql +18 -0
  47. data/test/sql/db-login.sql +38 -0
  48. data/test/test_helper.rb +116 -85
  49. data/test/thread_test.rb +22 -31
  50. data/tiny_tds.gemspec +27 -24
  51. metadata +109 -56
  52. data/appveyor.yml +0 -51
  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/schema/sqlserver_2000.sql +0 -140
  59. data/test/schema/sqlserver_2005.sql +0 -140
  60. data/test/schema/sqlserver_2014.sql +0 -140
  61. data/test/schema/sybase_ase.sql +0 -138
  62. /data/bin/{defncopy → defncopy-ttds} +0 -0
  63. /data/bin/{tsql → tsql-ttds} +0 -0
  64. /data/test/schema/{sqlserver_2008.sql → sqlserver_2017.sql} +0 -0
data/test/gem_test.rb ADDED
@@ -0,0 +1,100 @@
1
+ require "test_helper"
2
+ require "tiny_tds/gem"
3
+
4
+ class GemTest < Minitest::Spec
5
+ gem_root ||= File.expand_path "../..", __FILE__
6
+
7
+ describe TinyTds::Gem do
8
+ # We're going to muck with some system globals so lets make sure
9
+ # they get set back later
10
+ original_platform = RbConfig::CONFIG["arch"]
11
+ original_pwd = Dir.pwd
12
+
13
+ after do
14
+ RbConfig::CONFIG["arch"] = original_platform
15
+ Dir.chdir original_pwd
16
+ end
17
+
18
+ describe "#root_path" do
19
+ let(:root_path) { TinyTds::Gem.root_path }
20
+
21
+ it "should be the root path" do
22
+ _(root_path).must_equal gem_root
23
+ end
24
+
25
+ it "should be the root path no matter the cwd" do
26
+ Dir.chdir "/"
27
+
28
+ _(root_path).must_equal gem_root
29
+ end
30
+ end
31
+
32
+ describe "#ports_root_path" do
33
+ let(:ports_root_path) { TinyTds::Gem.ports_root_path }
34
+
35
+ it "should be the ports path" do
36
+ _(ports_root_path).must_equal File.join(gem_root, "ports")
37
+ end
38
+
39
+ it "should be the ports path no matter the cwd" do
40
+ Dir.chdir "/"
41
+
42
+ _(ports_root_path).must_equal File.join(gem_root, "ports")
43
+ end
44
+ end
45
+
46
+ describe "#ports_bin_paths" do
47
+ let(:ports_bin_paths) { TinyTds::Gem.ports_bin_paths }
48
+
49
+ describe "when the ports directories exist" do
50
+ let(:fake_bin_paths) do
51
+ ports_host_root = File.join(gem_root, "ports", "fake-host-with-dirs")
52
+ [
53
+ File.join("a", "bin"),
54
+ File.join("a", "inner", "bin"),
55
+ File.join("b", "bin")
56
+ ].map do |p|
57
+ File.join(ports_host_root, p)
58
+ end
59
+ end
60
+
61
+ before do
62
+ RbConfig::CONFIG["arch"] = "fake-host-with-dirs"
63
+ fake_bin_paths.each do |path|
64
+ FileUtils.mkdir_p(path)
65
+ end
66
+ end
67
+
68
+ after do
69
+ FileUtils.remove_entry_secure(
70
+ File.join(gem_root, "ports", "fake-host-with-dirs"), true
71
+ )
72
+ end
73
+
74
+ it "should return all the bin directories" do
75
+ _(ports_bin_paths.sort).must_equal fake_bin_paths.sort
76
+ end
77
+
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
81
+ end
82
+ end
83
+
84
+ describe "when the ports directories are missing" do
85
+ before do
86
+ RbConfig::CONFIG["arch"] = "fake-host-without-dirs"
87
+ end
88
+
89
+ it "should return no directories" do
90
+ _(ports_bin_paths).must_be_empty
91
+ end
92
+
93
+ it "should return no directories regardless of cwd" do
94
+ Dir.chdir "/"
95
+ _(ports_bin_paths).must_be_empty
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end