tiny_tds 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +187 -74
- data/CHANGELOG.md +8 -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/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/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 +31 -107
- data/test/result_test.rb +208 -221
- data/test/schema_test.rb +177 -181
- data/test/test_helper.rb +58 -63
- data/test/thread_test.rb +22 -31
- data/tiny_tds.gemspec +28 -29
- metadata +21 -13
- 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/test/test_helper.rb
CHANGED
@@ -1,26 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require "bundler"
|
2
|
+
Bundler.require :development, :test
|
3
|
+
require "tiny_tds"
|
4
|
+
require "minitest/autorun"
|
5
|
+
require "toxiproxy"
|
6
6
|
|
7
7
|
require "minitest/reporters"
|
8
8
|
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Reporters::JUnitReporter.new]
|
9
9
|
|
10
|
-
TINYTDS_SCHEMAS = [
|
10
|
+
TINYTDS_SCHEMAS = ["sqlserver_2017", "sqlserver_azure"].freeze
|
11
11
|
|
12
12
|
module TinyTds
|
13
13
|
class TestCase < Minitest::Spec
|
14
|
-
|
15
14
|
class << self
|
16
|
-
|
17
15
|
def current_schema
|
18
|
-
ENV[
|
16
|
+
ENV["TINYTDS_SCHEMA"] || "sqlserver_2017"
|
19
17
|
end
|
20
18
|
|
21
19
|
TINYTDS_SCHEMAS.each do |schema|
|
22
|
-
define_method "#{schema}?" do
|
23
|
-
schema ==
|
20
|
+
define_method :"#{schema}?" do
|
21
|
+
schema == current_schema
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -30,7 +28,7 @@ module TinyTds
|
|
30
28
|
protected
|
31
29
|
|
32
30
|
TINYTDS_SCHEMAS.each do |schema|
|
33
|
-
define_method "#{schema}?" do
|
31
|
+
define_method :"#{schema}?" do
|
34
32
|
schema == self.class.current_schema
|
35
33
|
end
|
36
34
|
end
|
@@ -39,45 +37,44 @@ module TinyTds
|
|
39
37
|
self.class.current_schema
|
40
38
|
end
|
41
39
|
|
42
|
-
def close_client(client
|
40
|
+
def close_client(client = @client)
|
43
41
|
client.close if defined?(client) && client.is_a?(TinyTds::Client)
|
44
42
|
end
|
45
43
|
|
46
|
-
def new_connection(options={})
|
44
|
+
def new_connection(options = {})
|
47
45
|
client = TinyTds::Client.new(connection_options(options))
|
48
46
|
if sqlserver_azure?
|
49
|
-
client.execute(
|
50
|
-
client.execute(
|
51
|
-
client.execute(
|
52
|
-
client.execute(
|
53
|
-
client.execute(
|
54
|
-
client.execute(
|
55
|
-
client.execute(
|
47
|
+
client.execute("SET ANSI_NULLS ON").do
|
48
|
+
client.execute("SET CURSOR_CLOSE_ON_COMMIT OFF").do
|
49
|
+
client.execute("SET ANSI_NULL_DFLT_ON ON").do
|
50
|
+
client.execute("SET IMPLICIT_TRANSACTIONS OFF").do
|
51
|
+
client.execute("SET ANSI_PADDING ON").do
|
52
|
+
client.execute("SET QUOTED_IDENTIFIER ON").do
|
53
|
+
client.execute("SET ANSI_WARNINGS ON").do
|
56
54
|
else
|
57
|
-
client.execute(
|
58
|
-
client.execute(
|
59
|
-
client.execute(
|
55
|
+
client.execute("SET ANSI_DEFAULTS ON").do
|
56
|
+
client.execute("SET CURSOR_CLOSE_ON_COMMIT OFF").do
|
57
|
+
client.execute("SET IMPLICIT_TRANSACTIONS OFF").do
|
60
58
|
end
|
61
|
-
client.execute(
|
62
|
-
client.execute(
|
59
|
+
client.execute("SET TEXTSIZE 2147483647").do
|
60
|
+
client.execute("SET CONCAT_NULL_YIELDS_NULL ON").do
|
63
61
|
client
|
64
62
|
end
|
65
63
|
|
66
|
-
def connection_options(options={})
|
67
|
-
username = (sqlserver_azure? ? ENV[
|
68
|
-
password = (sqlserver_azure? ? ENV[
|
69
|
-
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
}.merge(options)
|
64
|
+
def connection_options(options = {})
|
65
|
+
username = (sqlserver_azure? ? ENV["TINYTDS_UNIT_AZURE_USER"] : ENV["TINYTDS_UNIT_USER"]) || "tinytds"
|
66
|
+
password = (sqlserver_azure? ? ENV["TINYTDS_UNIT_AZURE_PASS"] : ENV["TINYTDS_UNIT_PASS"]) || ""
|
67
|
+
{dataserver: sqlserver_azure? ? nil : ENV["TINYTDS_UNIT_DATASERVER"],
|
68
|
+
host: ENV["TINYTDS_UNIT_HOST"] || "localhost",
|
69
|
+
port: ENV["TINYTDS_UNIT_PORT"] || "1433",
|
70
|
+
tds_version: ENV["TINYTDS_UNIT_VERSION"],
|
71
|
+
username: username,
|
72
|
+
password: password,
|
73
|
+
database: ENV["TINYTDS_UNIT_DATABASE"] || "tinytdstest",
|
74
|
+
appname: "TinyTds Dev",
|
75
|
+
login_timeout: 5,
|
76
|
+
timeout: connection_timeout,
|
77
|
+
azure: sqlserver_azure?}.merge(options)
|
81
78
|
end
|
82
79
|
|
83
80
|
def connection_timeout
|
@@ -85,7 +82,7 @@ module TinyTds
|
|
85
82
|
end
|
86
83
|
|
87
84
|
def assert_client_works(client)
|
88
|
-
_(client.execute("SELECT 'client_works' as [client_works]").each).must_equal [{
|
85
|
+
_(client.execute("SELECT 'client_works' as [client_works]").each).must_equal [{"client_works" => "client_works"}]
|
89
86
|
end
|
90
87
|
|
91
88
|
def assert_new_connections_work
|
@@ -102,28 +99,26 @@ module TinyTds
|
|
102
99
|
rescue TinyTds::Error => e
|
103
100
|
error_raised = true
|
104
101
|
end
|
105
|
-
assert error_raised,
|
102
|
+
assert error_raised, "expected a TinyTds::Error but none happened"
|
106
103
|
yield e
|
107
104
|
ensure
|
108
105
|
close_client(result)
|
109
106
|
end
|
110
107
|
|
111
108
|
def inspect_tinytds_exception
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
raise "TinyTds::Error - #{props.inspect}"
|
118
|
-
end
|
109
|
+
yield
|
110
|
+
rescue TinyTds::Error => e
|
111
|
+
props = {source: e.source, message: e.message, severity: e.severity,
|
112
|
+
db_error_number: e.db_error_number, os_error_number: e.os_error_number}
|
113
|
+
raise "TinyTds::Error - #{props.inspect}"
|
119
114
|
end
|
120
115
|
|
121
116
|
def assert_binary_encoding(value)
|
122
|
-
assert_equal Encoding.find(
|
117
|
+
assert_equal Encoding.find("BINARY"), value.encoding
|
123
118
|
end
|
124
119
|
|
125
120
|
def assert_utf8_encoding(value)
|
126
|
-
assert_equal Encoding.find(
|
121
|
+
assert_equal Encoding.find("UTF-8"), value.encoding
|
127
122
|
end
|
128
123
|
|
129
124
|
def rubyRbx?
|
@@ -131,17 +126,17 @@ module TinyTds
|
|
131
126
|
end
|
132
127
|
|
133
128
|
def ruby_windows?
|
134
|
-
RbConfig::CONFIG[
|
129
|
+
RbConfig::CONFIG["host_os"] =~ /ming/
|
135
130
|
end
|
136
131
|
|
137
132
|
def ruby_darwin?
|
138
|
-
RbConfig::CONFIG[
|
133
|
+
RbConfig::CONFIG["host_os"] =~ /darwin/
|
139
134
|
end
|
140
135
|
|
141
136
|
def load_current_schema
|
142
137
|
loader = new_connection
|
143
|
-
schema_file = File.expand_path File.join(File.dirname(__FILE__),
|
144
|
-
schema_sql = File.open(schema_file,"rb:UTF-8") { |f|f.read }
|
138
|
+
schema_file = File.expand_path File.join(File.dirname(__FILE__), "schema", "#{current_schema}.sql")
|
139
|
+
schema_sql = File.open(schema_file, "rb:UTF-8") { |f| f.read }
|
145
140
|
loader.execute(drop_sql).do
|
146
141
|
loader.execute(schema_sql).do
|
147
142
|
loader.execute(sp_sql).do
|
@@ -188,14 +183,14 @@ module TinyTds
|
|
188
183
|
end
|
189
184
|
|
190
185
|
def sp_several_prints_sql
|
191
|
-
|
186
|
+
%(CREATE PROCEDURE tinytds_TestSeveralPrints
|
192
187
|
AS
|
193
188
|
PRINT 'hello 1'
|
194
189
|
PRINT 'hello 2'
|
195
|
-
PRINT 'hello 3'
|
190
|
+
PRINT 'hello 3')
|
196
191
|
end
|
197
192
|
|
198
|
-
def find_value(id, column, query_options={})
|
193
|
+
def find_value(id, column, query_options = {})
|
199
194
|
query_options[:timezone] ||= :utc
|
200
195
|
sql = "SELECT [#{column}] FROM [datatypes] WHERE [id] = #{id}"
|
201
196
|
@client.execute(sql).each(query_options).first[column.to_s]
|
@@ -223,19 +218,19 @@ module TinyTds
|
|
223
218
|
# docker-compose.yml handles this automatically for us. In instances where someone is using their own local mssql container they'll
|
224
219
|
# need to set up the networks manually and set TINYTDS_UNIT_HOST to their mssql container name
|
225
220
|
# For anything other than localhost just use the environment config
|
226
|
-
toxi_host = ENV[
|
221
|
+
toxi_host = ENV["TOXIPROXY_HOST"] || "localhost"
|
227
222
|
toxi_api_port = 8474
|
228
223
|
toxi_test_port = 1234
|
229
224
|
Toxiproxy.host = "http://#{toxi_host}:#{toxi_api_port}"
|
230
225
|
|
231
|
-
toxi_upstream_host = ENV[
|
232
|
-
toxi_upstream_port = ENV[
|
226
|
+
toxi_upstream_host = ENV["TINYTDS_UNIT_HOST_TEST"] || ENV["TINYTDS_UNIT_HOST"] || "localhost"
|
227
|
+
toxi_upstream_port = ENV["TINYTDS_UNIT_PORT"] || 1433
|
233
228
|
|
234
229
|
puts "\n-------------------------"
|
235
230
|
puts "Toxiproxy api listener: #{toxi_host}:#{toxi_api_port}"
|
236
231
|
puts "Toxiproxy unit test listener: #{toxi_host}:#{toxi_test_port}"
|
237
232
|
puts "Toxiproxy upstream sqlserver: #{toxi_upstream_host}:#{toxi_upstream_port}"
|
238
|
-
puts
|
233
|
+
puts "-------------------------"
|
239
234
|
|
240
235
|
Toxiproxy.populate([
|
241
236
|
{
|
data/test/thread_test.rb
CHANGED
@@ -1,25 +1,23 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "test_helper"
|
2
|
+
require "logger"
|
3
|
+
require "benchmark"
|
4
4
|
|
5
5
|
class ThreadTest < TinyTds::TestCase
|
6
|
-
|
7
|
-
describe 'Threaded SELECT queries' do
|
8
|
-
|
6
|
+
describe "Threaded SELECT queries" do
|
9
7
|
before do
|
10
8
|
@logger = Logger.new $stdout
|
11
9
|
@logger.level = Logger::WARN
|
12
10
|
@poolsize = 4
|
13
11
|
@numthreads = 10
|
14
12
|
@query = "waitfor delay '00:00:01'"
|
15
|
-
@pool = ConnectionPool.new(:
|
13
|
+
@pool = ConnectionPool.new(size: @poolsize, timeout: 5) { new_connection }
|
16
14
|
end
|
17
15
|
|
18
16
|
after do
|
19
17
|
@pool.shutdown { |c| c.close }
|
20
18
|
end
|
21
19
|
|
22
|
-
it
|
20
|
+
it "should finish faster in parallel" do
|
23
21
|
skip if sqlserver_azure?
|
24
22
|
x = Benchmark.realtime do
|
25
23
|
threads = []
|
@@ -35,24 +33,22 @@ class ThreadTest < TinyTds::TestCase
|
|
35
33
|
threads.each { |t| t.join }
|
36
34
|
end
|
37
35
|
assert x < @numthreads, "#{x} is not faster than #{@numthreads} seconds"
|
38
|
-
mintime = (1.0
|
36
|
+
mintime = (1.0 * @numthreads / @poolsize).ceil
|
39
37
|
@logger.info "#{@numthreads} queries on #{@poolsize} threads: #{x} sec. Minimum time: #{mintime} sec."
|
40
38
|
assert x > mintime, "#{x} is not slower than #{mintime} seconds"
|
41
39
|
end
|
42
40
|
|
43
|
-
it
|
41
|
+
it "should not crash on error in parallel" do
|
44
42
|
skip if sqlserver_azure?
|
45
43
|
threads = []
|
46
44
|
@numthreads.times do |i|
|
47
45
|
threads << Thread.new do
|
48
46
|
@pool.with do |client|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
# segfault on errors thrown in threads
|
55
|
-
end
|
47
|
+
result = client.execute "select dbname()"
|
48
|
+
result.each { |r| puts r }
|
49
|
+
rescue => _e
|
50
|
+
# We are throwing an error on purpose here since 0.6.1 would
|
51
|
+
# segfault on errors thrown in threads
|
56
52
|
end
|
57
53
|
end
|
58
54
|
end
|
@@ -60,27 +56,25 @@ class ThreadTest < TinyTds::TestCase
|
|
60
56
|
assert true
|
61
57
|
end
|
62
58
|
|
63
|
-
it
|
59
|
+
it "should cancel when hitting timeout in thread" do
|
64
60
|
exception = false
|
65
61
|
|
66
62
|
thread = Thread.new do
|
67
63
|
@pool.with do |client|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
exception = true
|
75
|
-
end
|
64
|
+
delay = ("0" + (connection_timeout + 2).to_s)[-2, 2] # Two seconds longer than default.
|
65
|
+
result = client.execute "waitfor delay '00:00:#{delay}'; select db_name()"
|
66
|
+
result.each { |r| puts r }
|
67
|
+
rescue TinyTds::Error => e
|
68
|
+
if e.message == "Adaptive Server connection timed out"
|
69
|
+
exception = true
|
76
70
|
end
|
77
71
|
end
|
78
72
|
end
|
79
73
|
|
80
74
|
timer_thread = Thread.new do
|
81
75
|
# Sleep until after the timeout should have been reached
|
82
|
-
sleep(connection_timeout+2)
|
83
|
-
if
|
76
|
+
sleep(connection_timeout + 2)
|
77
|
+
if !exception
|
84
78
|
thread.kill
|
85
79
|
raise "Timeout passed without query timing out"
|
86
80
|
end
|
@@ -91,8 +85,5 @@ class ThreadTest < TinyTds::TestCase
|
|
91
85
|
|
92
86
|
assert exception
|
93
87
|
end
|
94
|
-
|
95
88
|
end
|
96
|
-
|
97
89
|
end
|
98
|
-
|
data/tiny_tds.gemspec
CHANGED
@@ -1,32 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'tiny_tds/version'
|
1
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "tiny_tds/version"
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
|
-
s.name
|
7
|
-
s.version
|
8
|
-
s.platform
|
9
|
-
s.authors
|
10
|
-
s.email
|
11
|
-
s.homepage
|
12
|
-
s.summary
|
13
|
-
s.description
|
14
|
-
s.files
|
15
|
-
s.
|
16
|
-
s.
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
s.
|
20
|
-
s.
|
21
|
-
s.
|
22
|
-
s.
|
23
|
-
s.
|
24
|
-
s.add_development_dependency
|
25
|
-
s.add_development_dependency
|
26
|
-
s.add_development_dependency
|
27
|
-
s.add_development_dependency
|
28
|
-
s.add_development_dependency
|
29
|
-
s.add_development_dependency
|
30
|
-
s.add_development_dependency
|
31
|
-
s.add_development_dependency
|
5
|
+
s.name = "tiny_tds"
|
6
|
+
s.version = TinyTds::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Ken Collins", "Erik Bryn", "Will Bond"]
|
9
|
+
s.email = ["ken@metaskills.net", "will@wbond.net"]
|
10
|
+
s.homepage = "http://github.com/rails-sqlserver/tiny_tds"
|
11
|
+
s.summary = "TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library."
|
12
|
+
s.description = "TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library. Developed for the ActiveRecord SQL Server adapter."
|
13
|
+
s.files = `git ls-files`.split("\n") + Dir.glob("exe/*")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
17
|
+
s.extensions = ["ext/tiny_tds/extconf.rb"]
|
18
|
+
s.license = "MIT"
|
19
|
+
s.required_ruby_version = ">= 2.7.0"
|
20
|
+
s.metadata["msys2_mingw_dependencies"] = "freetds"
|
21
|
+
s.add_dependency "bigdecimal", "~> 3"
|
22
|
+
s.add_development_dependency "mini_portile2", "~> 2.8.0"
|
23
|
+
s.add_development_dependency "rake", "~> 13.0.0"
|
24
|
+
s.add_development_dependency "rake-compiler", "~> 1.2"
|
25
|
+
s.add_development_dependency "rake-compiler-dock", "~> 1.9.1"
|
26
|
+
s.add_development_dependency "minitest", "~> 5.25"
|
27
|
+
s.add_development_dependency "minitest-reporters", "~> 1.6.1"
|
28
|
+
s.add_development_dependency "connection_pool", "~> 2.2.0"
|
29
|
+
s.add_development_dependency "toxiproxy", "~> 2.0.0"
|
30
|
+
s.add_development_dependency "standard", "~> 1.31.0"
|
32
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_tds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-
|
13
|
+
date: 2025-02-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bigdecimal
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 2.
|
35
|
+
version: 2.8.0
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 2.
|
42
|
+
version: 2.8.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rake
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,14 +74,14 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.
|
77
|
+
version: 1.9.1
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 1.
|
84
|
+
version: 1.9.1
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: minitest
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,6 +138,20 @@ dependencies:
|
|
138
138
|
- - "~>"
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: 2.0.0
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: standard
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 1.31.0
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - "~>"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 1.31.0
|
141
155
|
description: TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.
|
142
156
|
Developed for the ActiveRecord SQL Server adapter.
|
143
157
|
email:
|
@@ -190,18 +204,12 @@ files:
|
|
190
204
|
- tasks/native_gem.rake
|
191
205
|
- tasks/package.rake
|
192
206
|
- tasks/ports.rake
|
193
|
-
- tasks/ports/freetds.rb
|
194
|
-
- tasks/ports/libiconv.rb
|
195
|
-
- tasks/ports/openssl.rb
|
196
|
-
- tasks/ports/recipe.rb
|
197
207
|
- tasks/test.rake
|
198
|
-
- test/benchmark/query.rb
|
199
|
-
- test/benchmark/query_odbc.rb
|
200
|
-
- test/benchmark/query_tinytds.rb
|
201
208
|
- test/bin/install-freetds.sh
|
202
209
|
- test/bin/install-mssql.ps1
|
203
210
|
- test/bin/install-mssqltools.sh
|
204
211
|
- test/bin/install-openssl.sh
|
212
|
+
- test/bin/restore-from-native-gem.ps1
|
205
213
|
- test/bin/setup_tinytds_db.sh
|
206
214
|
- test/bin/setup_volume_permissions.sh
|
207
215
|
- test/client_test.rb
|
data/tasks/ports/freetds.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require_relative './recipe'
|
2
|
-
|
3
|
-
module Ports
|
4
|
-
class Freetds < Recipe
|
5
|
-
def initialize(version)
|
6
|
-
super('freetds', version)
|
7
|
-
|
8
|
-
set_patches
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def configure_defaults
|
14
|
-
opts = super
|
15
|
-
|
16
|
-
opts << '--with-pic'
|
17
|
-
opts << '--disable-odbc'
|
18
|
-
opts << '--with-tdsver=7.3'
|
19
|
-
|
20
|
-
if windows?
|
21
|
-
opts << '--sysconfdir=C:/Sites'
|
22
|
-
opts << '--enable-sspi'
|
23
|
-
end
|
24
|
-
|
25
|
-
opts
|
26
|
-
end
|
27
|
-
|
28
|
-
def set_patches
|
29
|
-
self.patch_files.concat get_patches(name, version)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/tasks/ports/libiconv.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative './recipe'
|
2
|
-
|
3
|
-
module Ports
|
4
|
-
class Libiconv < Recipe
|
5
|
-
def initialize(version)
|
6
|
-
super('libiconv', version)
|
7
|
-
|
8
|
-
set_patches
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def configure_defaults
|
14
|
-
[
|
15
|
-
"--host=#{@host}",
|
16
|
-
'--disable-static',
|
17
|
-
'--enable-shared',
|
18
|
-
'CFLAGS=-fPIC -O2'
|
19
|
-
]
|
20
|
-
end
|
21
|
-
|
22
|
-
def set_patches
|
23
|
-
self.patch_files.concat get_patches(name, version)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/tasks/ports/openssl.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require_relative './recipe'
|
2
|
-
|
3
|
-
module Ports
|
4
|
-
class Openssl < Recipe
|
5
|
-
def initialize(version)
|
6
|
-
super('openssl', version)
|
7
|
-
|
8
|
-
set_patches
|
9
|
-
end
|
10
|
-
|
11
|
-
def configure
|
12
|
-
return if configured?
|
13
|
-
|
14
|
-
md5_file = File.join(tmp_path, 'configure.md5')
|
15
|
-
digest = Digest::MD5.hexdigest(computed_options.to_s)
|
16
|
-
File.open(md5_file, "w") { |f| f.write digest }
|
17
|
-
|
18
|
-
# Windows doesn't recognize the shebang so always explicitly use sh
|
19
|
-
execute('configure', "sh -c \"./Configure #{computed_options.join(' ')}\"")
|
20
|
-
end
|
21
|
-
|
22
|
-
def install
|
23
|
-
unless installed?
|
24
|
-
execute('install', %Q(#{make_cmd} install_sw install_ssldirs))
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def configure_defaults
|
31
|
-
opts = [
|
32
|
-
'shared',
|
33
|
-
target_arch,
|
34
|
-
"--openssldir=#{path}",
|
35
|
-
]
|
36
|
-
|
37
|
-
if cross_build?
|
38
|
-
opts << "--cross-compile-prefix=#{host}-"
|
39
|
-
end
|
40
|
-
|
41
|
-
opts
|
42
|
-
end
|
43
|
-
|
44
|
-
def target_arch
|
45
|
-
if windows?
|
46
|
-
arch = ''
|
47
|
-
arch = '64' if host=~ /x86_64/
|
48
|
-
|
49
|
-
"mingw#{arch}"
|
50
|
-
else
|
51
|
-
arch = 'x32'
|
52
|
-
arch = 'x86_64' if host=~ /x86_64/
|
53
|
-
|
54
|
-
"linux-#{arch}"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def set_patches
|
59
|
-
self.patch_files.concat get_patches(name, version)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|