tiny_tds 2.1.5 → 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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +590 -0
- data/.gitignore +2 -0
- data/CHANGELOG.md +32 -1
- data/Gemfile +1 -8
- data/ISSUE_TEMPLATE.md +1 -1
- data/README.md +75 -88
- data/Rakefile +44 -30
- data/VERSION +1 -1
- data/docker-compose.yml +20 -8
- data/ext/tiny_tds/client.c +10 -15
- data/ext/tiny_tds/extconf.rb +183 -66
- data/ext/tiny_tds/extconsts.rb +4 -11
- data/ext/tiny_tds/result.c +28 -35
- data/ext/tiny_tds/tiny_tds_ext.c +4 -1
- 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 -14
- data/lib/tiny_tds/result.rb +0 -2
- data/lib/tiny_tds/version.rb +1 -1
- data/lib/tiny_tds.rb +28 -47
- data/setup_cimgruby_dev.sh +25 -0
- data/start_dev.sh +21 -0
- data/tasks/native_gem.rake +12 -10
- data/tasks/package.rake +1 -3
- data/tasks/ports.rake +14 -75
- data/tasks/test.rake +3 -5
- data/test/bin/install-freetds.sh +2 -4
- data/test/bin/install-mssql.ps1 +42 -0
- data/test/bin/install-mssqltools.sh +9 -0
- data/test/bin/restore-from-native-gem.ps1 +10 -0
- data/test/bin/setup_tinytds_db.sh +7 -0
- data/test/bin/setup_volume_permissions.sh +10 -0
- data/test/client_test.rb +111 -120
- data/test/gem_test.rb +32 -111
- data/test/result_test.rb +259 -365
- data/test/schema_test.rb +369 -395
- data/test/sql/db-create.sql +18 -0
- data/test/sql/db-login.sql +38 -0
- data/test/test_helper.rb +75 -102
- data/test/thread_test.rb +22 -31
- data/tiny_tds.gemspec +28 -27
- metadata +70 -57
- data/.travis.yml +0 -25
- data/appveyor.yml +0 -72
- data/tasks/ports/freetds.rb +0 -37
- data/tasks/ports/libiconv.rb +0 -43
- data/tasks/ports/openssl.rb +0 -62
- data/tasks/ports/recipe.rb +0 -52
- data/test/appveyor/dbsetup.ps1 +0 -27
- data/test/appveyor/dbsetup.sql +0 -9
- 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/bin/setup.sh +0 -19
- data/test/schema/sqlserver_2000.sql +0 -140
- data/test/schema/sqlserver_2005.sql +0 -140
- data/test/schema/sqlserver_2014.sql +0 -140
- data/test/schema/sqlserver_2016.sql +0 -140
- data/test/schema/sybase_ase.sql +0 -138
- /data/test/schema/{sqlserver_2008.sql → sqlserver_2017.sql} +0 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
:ON ERROR EXIT
|
2
|
+
|
3
|
+
PRINT 'RUNNING DB-CREATE.SQL, CREATING TINYTDS TEST DATABASE';
|
4
|
+
IF NOT EXISTS(SELECT * FROM sys.databases WHERE name = 'tinytdstest')
|
5
|
+
BEGIN
|
6
|
+
CREATE DATABASE [tinytdstest];
|
7
|
+
END
|
8
|
+
GO
|
9
|
+
|
10
|
+
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name LIKE 'tinytdstest')
|
11
|
+
BEGIN
|
12
|
+
PRINT 'TINY TDS TEST DB SUCCESSFULY CREATED';
|
13
|
+
END
|
14
|
+
ELSE
|
15
|
+
BEGIN
|
16
|
+
THROW 51000, 'TINY TDS TEST DB CREATION FAILED', 1;
|
17
|
+
END
|
18
|
+
GO
|
@@ -0,0 +1,38 @@
|
|
1
|
+
:ON ERROR EXIT
|
2
|
+
|
3
|
+
PRINT 'RUNNING DB-LOGIN.SQL';
|
4
|
+
|
5
|
+
PRINT 'CREATING TINYTDS TEST LOGIN';
|
6
|
+
IF NOT EXISTS (select name from sys.server_principals where name like 'tinytds')
|
7
|
+
BEGIN
|
8
|
+
CREATE LOGIN [tinytds] WITH PASSWORD = '', CHECK_POLICY = OFF, DEFAULT_DATABASE = [tinytdstest];
|
9
|
+
END
|
10
|
+
GO
|
11
|
+
|
12
|
+
IF EXISTS (select name from sys.server_principals where name like 'tinytds')
|
13
|
+
BEGIN
|
14
|
+
PRINT 'TINY TDS TEST LOGIN SUCCESSFULY CREATED';
|
15
|
+
END
|
16
|
+
ELSE
|
17
|
+
BEGIN
|
18
|
+
THROW 51000, 'TINY TDS TEST LOGIN CREATION FAILED', 1;
|
19
|
+
END
|
20
|
+
GO
|
21
|
+
|
22
|
+
USE [tinytdstest];
|
23
|
+
IF NOT EXISTS (select name from sys.database_principals where name LIKE 'tinytds')
|
24
|
+
BEGIN
|
25
|
+
CREATE USER [tinytds] FOR LOGIN [tinytds];
|
26
|
+
EXEC sp_addrolemember N'db_owner', N'tinytds';
|
27
|
+
END
|
28
|
+
GO
|
29
|
+
|
30
|
+
IF EXISTS (select name from sys.database_principals where name LIKE 'tinytds')
|
31
|
+
BEGIN
|
32
|
+
PRINT 'TINY TDS TEST USER SUCCESSFULY CREATED';
|
33
|
+
END
|
34
|
+
ELSE
|
35
|
+
BEGIN
|
36
|
+
THROW 51000, 'TINY TDS TEST USER CREATION FAILED', 1;
|
37
|
+
END
|
38
|
+
GO
|
data/test/test_helper.rb
CHANGED
@@ -1,30 +1,26 @@
|
|
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
|
+
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Reporters::JUnitReporter.new]
|
8
9
|
|
9
|
-
|
10
|
-
class TestCase < MiniTest::Spec
|
10
|
+
TINYTDS_SCHEMAS = ["sqlserver_2017", "sqlserver_azure"].freeze
|
11
11
|
|
12
|
+
module TinyTds
|
13
|
+
class TestCase < Minitest::Spec
|
12
14
|
class << self
|
13
|
-
|
14
15
|
def current_schema
|
15
|
-
ENV[
|
16
|
+
ENV["TINYTDS_SCHEMA"] || "sqlserver_2017"
|
16
17
|
end
|
17
18
|
|
18
19
|
TINYTDS_SCHEMAS.each do |schema|
|
19
|
-
define_method "#{schema}?" do
|
20
|
-
schema ==
|
20
|
+
define_method :"#{schema}?" do
|
21
|
+
schema == current_schema
|
21
22
|
end
|
22
23
|
end
|
23
|
-
|
24
|
-
def sqlserver?
|
25
|
-
current_schema =~ /sqlserver/
|
26
|
-
end
|
27
|
-
|
28
24
|
end
|
29
25
|
|
30
26
|
after { close_client }
|
@@ -32,7 +28,7 @@ module TinyTds
|
|
32
28
|
protected
|
33
29
|
|
34
30
|
TINYTDS_SCHEMAS.each do |schema|
|
35
|
-
define_method "#{schema}?" do
|
31
|
+
define_method :"#{schema}?" do
|
36
32
|
schema == self.class.current_schema
|
37
33
|
end
|
38
34
|
end
|
@@ -41,52 +37,44 @@ module TinyTds
|
|
41
37
|
self.class.current_schema
|
42
38
|
end
|
43
39
|
|
44
|
-
def
|
45
|
-
self.class.sqlserver?
|
46
|
-
end
|
47
|
-
|
48
|
-
def close_client(client=@client)
|
40
|
+
def close_client(client = @client)
|
49
41
|
client.close if defined?(client) && client.is_a?(TinyTds::Client)
|
50
42
|
end
|
51
43
|
|
52
|
-
def new_connection(options={})
|
44
|
+
def new_connection(options = {})
|
53
45
|
client = TinyTds::Client.new(connection_options(options))
|
54
|
-
if
|
55
|
-
client.execute("SET
|
56
|
-
|
57
|
-
|
58
|
-
client.execute(
|
59
|
-
client.execute(
|
60
|
-
client.execute(
|
61
|
-
client.execute(
|
62
|
-
client.execute('SET ANSI_PADDING ON').do
|
63
|
-
client.execute('SET QUOTED_IDENTIFIER ON').do
|
64
|
-
client.execute('SET ANSI_WARNINGS ON').do
|
46
|
+
if sqlserver_azure?
|
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
|
65
54
|
else
|
66
|
-
client.execute(
|
67
|
-
client.execute(
|
68
|
-
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
|
69
58
|
end
|
70
|
-
client.execute(
|
71
|
-
client.execute(
|
59
|
+
client.execute("SET TEXTSIZE 2147483647").do
|
60
|
+
client.execute("SET CONCAT_NULL_YIELDS_NULL ON").do
|
72
61
|
client
|
73
62
|
end
|
74
63
|
|
75
|
-
def connection_options(options={})
|
76
|
-
username = (sqlserver_azure? ? ENV[
|
77
|
-
password = (sqlserver_azure? ? ENV[
|
78
|
-
{
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
}.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)
|
90
78
|
end
|
91
79
|
|
92
80
|
def connection_timeout
|
@@ -94,7 +82,7 @@ module TinyTds
|
|
94
82
|
end
|
95
83
|
|
96
84
|
def assert_client_works(client)
|
97
|
-
_(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"}]
|
98
86
|
end
|
99
87
|
|
100
88
|
def assert_new_connections_work
|
@@ -111,28 +99,26 @@ module TinyTds
|
|
111
99
|
rescue TinyTds::Error => e
|
112
100
|
error_raised = true
|
113
101
|
end
|
114
|
-
assert error_raised,
|
102
|
+
assert error_raised, "expected a TinyTds::Error but none happened"
|
115
103
|
yield e
|
116
104
|
ensure
|
117
105
|
close_client(result)
|
118
106
|
end
|
119
107
|
|
120
108
|
def inspect_tinytds_exception
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
raise "TinyTds::Error - #{props.inspect}"
|
127
|
-
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}"
|
128
114
|
end
|
129
115
|
|
130
116
|
def assert_binary_encoding(value)
|
131
|
-
assert_equal Encoding.find(
|
117
|
+
assert_equal Encoding.find("BINARY"), value.encoding
|
132
118
|
end
|
133
119
|
|
134
120
|
def assert_utf8_encoding(value)
|
135
|
-
assert_equal Encoding.find(
|
121
|
+
assert_equal Encoding.find("UTF-8"), value.encoding
|
136
122
|
end
|
137
123
|
|
138
124
|
def rubyRbx?
|
@@ -140,17 +126,17 @@ module TinyTds
|
|
140
126
|
end
|
141
127
|
|
142
128
|
def ruby_windows?
|
143
|
-
RbConfig::CONFIG[
|
129
|
+
RbConfig::CONFIG["host_os"] =~ /ming/
|
144
130
|
end
|
145
131
|
|
146
132
|
def ruby_darwin?
|
147
|
-
RbConfig::CONFIG[
|
133
|
+
RbConfig::CONFIG["host_os"] =~ /darwin/
|
148
134
|
end
|
149
135
|
|
150
136
|
def load_current_schema
|
151
137
|
loader = new_connection
|
152
|
-
schema_file = File.expand_path File.join(File.dirname(__FILE__),
|
153
|
-
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 }
|
154
140
|
loader.execute(drop_sql).do
|
155
141
|
loader.execute(schema_sql).do
|
156
142
|
loader.execute(sp_sql).do
|
@@ -161,28 +147,6 @@ module TinyTds
|
|
161
147
|
end
|
162
148
|
|
163
149
|
def drop_sql
|
164
|
-
sybase_ase? ? drop_sql_sybase : drop_sql_microsoft
|
165
|
-
end
|
166
|
-
|
167
|
-
def drop_sql_sybase
|
168
|
-
%|IF EXISTS(
|
169
|
-
SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'datatypes'
|
170
|
-
) DROP TABLE datatypes
|
171
|
-
IF EXISTS(
|
172
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestReturnCodes'
|
173
|
-
) DROP PROCEDURE tinytds_TestReturnCodes
|
174
|
-
IF EXISTS(
|
175
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestPrintWithError'
|
176
|
-
) DROP PROCEDURE tinytds_TestPrintWithError
|
177
|
-
IF EXISTS(
|
178
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestPrintWithError'
|
179
|
-
) DROP PROCEDURE tinytds_TestPrintWithError
|
180
|
-
IF EXISTS(
|
181
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestSeveralPrints'
|
182
|
-
) DROP PROCEDURE tinytds_TestSeveralPrints|
|
183
|
-
end
|
184
|
-
|
185
|
-
def drop_sql_microsoft
|
186
150
|
%|IF EXISTS (
|
187
151
|
SELECT TABLE_NAME
|
188
152
|
FROM INFORMATION_SCHEMA.TABLES
|
@@ -219,14 +183,14 @@ module TinyTds
|
|
219
183
|
end
|
220
184
|
|
221
185
|
def sp_several_prints_sql
|
222
|
-
|
186
|
+
%(CREATE PROCEDURE tinytds_TestSeveralPrints
|
223
187
|
AS
|
224
188
|
PRINT 'hello 1'
|
225
189
|
PRINT 'hello 2'
|
226
|
-
PRINT 'hello 3'
|
190
|
+
PRINT 'hello 3')
|
227
191
|
end
|
228
192
|
|
229
|
-
def find_value(id, column, query_options={})
|
193
|
+
def find_value(id, column, query_options = {})
|
230
194
|
query_options[:timezone] ||= :utc
|
231
195
|
sql = "SELECT [#{column}] FROM [datatypes] WHERE [id] = #{id}"
|
232
196
|
@client.execute(sql).each(query_options).first[column.to_s]
|
@@ -248,22 +212,31 @@ module TinyTds
|
|
248
212
|
end
|
249
213
|
|
250
214
|
def init_toxiproxy
|
251
|
-
return if ENV['APPVEYOR_BUILD_FOLDER'] # only for CI using docker
|
252
|
-
|
253
215
|
# In order for toxiproxy to work for local docker instances of mssql, the containers must be on the same network
|
254
216
|
# and the host used below must match the mssql container name so toxiproxy knows where to proxy to.
|
255
217
|
# localhost from the perspective of toxiproxy's container is its own container an *not* the mssql container it needs to proxy to.
|
256
218
|
# docker-compose.yml handles this automatically for us. In instances where someone is using their own local mssql container they'll
|
257
219
|
# need to set up the networks manually and set TINYTDS_UNIT_HOST to their mssql container name
|
258
220
|
# For anything other than localhost just use the environment config
|
259
|
-
|
260
|
-
|
261
|
-
|
221
|
+
toxi_host = ENV["TOXIPROXY_HOST"] || "localhost"
|
222
|
+
toxi_api_port = 8474
|
223
|
+
toxi_test_port = 1234
|
224
|
+
Toxiproxy.host = "http://#{toxi_host}:#{toxi_api_port}"
|
225
|
+
|
226
|
+
toxi_upstream_host = ENV["TINYTDS_UNIT_HOST_TEST"] || ENV["TINYTDS_UNIT_HOST"] || "localhost"
|
227
|
+
toxi_upstream_port = ENV["TINYTDS_UNIT_PORT"] || 1433
|
228
|
+
|
229
|
+
puts "\n-------------------------"
|
230
|
+
puts "Toxiproxy api listener: #{toxi_host}:#{toxi_api_port}"
|
231
|
+
puts "Toxiproxy unit test listener: #{toxi_host}:#{toxi_test_port}"
|
232
|
+
puts "Toxiproxy upstream sqlserver: #{toxi_upstream_host}:#{toxi_upstream_port}"
|
233
|
+
puts "-------------------------"
|
234
|
+
|
262
235
|
Toxiproxy.populate([
|
263
236
|
{
|
264
237
|
name: "sqlserver_test",
|
265
|
-
listen: "
|
266
|
-
upstream: "#{
|
238
|
+
listen: "#{toxi_host}:#{toxi_test_port}",
|
239
|
+
upstream: "#{toxi_upstream_host}:#{toxi_upstream_port}"
|
267
240
|
}
|
268
241
|
])
|
269
242
|
end
|
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,30 +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.add_development_dependency
|
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
|
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"
|
30
31
|
end
|