tiny_tds 0.9.5.beta.2 → 0.9.5.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/VERSION +1 -1
- data/bin/defncopy +6 -0
- data/bin/tsql +3 -22
- data/ext/tiny_tds/extconf.rb +1 -1
- data/ext/tiny_tds/extconsts.rb +1 -1
- data/ext/tiny_tds/result.c +1 -1
- data/lib/tiny_tds/bin.rb +57 -0
- data/ports/patches/freetds/{0.95.75 → 0.95.76}/0001-mingw_missing_inet_pton.diff +0 -0
- data/test/result_test.rb +2 -2
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69b63ae949503a40cb1e8c12258d3ec1c446cac0
|
4
|
+
data.tar.gz: 2c94123af8caae780b5ab62403b38b455d209b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84244891e399a9888786bbe98af841772150b4a5bd2b0be87c48a5d682b522df4b1f418a55f77c0d3103a9b7013c9fe3288b9a3f0fac6c73d7dde2166c011241
|
7
|
+
data.tar.gz: 28bccae5b4bc18487403262e013fcc7f3cb2048ae9ff53e6f6e90ee7bbfc7bb918af9e5573361a15425f55a248daad062b303f75064ca34200e74123810db0d9
|
data/README.md
CHANGED
@@ -285,6 +285,7 @@ TinyTDS takes an opinionated stance on how we handle encoding errors. First, we
|
|
285
285
|
The TinyTDS gem uses binstub wrappers which mirror compiled [FreeTDS Utilities](http://www.freetds.org/userguide/usefreetds.htm) binaries. These native executables are usually installed at the system level when installing FreeTDS. However, when using MiniPortile to install TinyTDS as we do with Windows binaries, these binstubs will find and prefer local gem `exe` directory executables. These are the following binstubs we wrap.
|
286
286
|
|
287
287
|
* tsql - Used to test connections and debug compile time settings.
|
288
|
+
* defncopy - Used to dump schema structures.
|
288
289
|
|
289
290
|
|
290
291
|
## Using TinyTDS With Rails & The ActiveRecord SQL Server adapter.
|
@@ -402,3 +403,4 @@ My name is Ken Collins and I currently maintain the SQL Server adapter for Activ
|
|
402
403
|
|
403
404
|
TinyTDS is Copyright (c) 2010-2015 Ken Collins, <ken@metaskills.net> and Will Bond (Veracross LLC) <wbond@breuer.com>. It is distributed under the MIT license. Windows binaries contain pre-compiled versions of FreeTDS <http://www.freetds.org/> which is licensed under the GNU LGPL license at <http://www.gnu.org/licenses/lgpl-2.0.html>
|
404
405
|
|
406
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.5.beta.
|
1
|
+
0.9.5.beta.3
|
data/bin/defncopy
ADDED
data/bin/tsql
CHANGED
@@ -1,25 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
ROOT = File.expand_path(File.join File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__), '..')
|
5
|
-
PATHS = ENV['PATH'].split(File::PATH_SEPARATOR)
|
6
|
-
EXTS = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
7
|
-
SELF = File.join ROOT, 'bin', BIN
|
8
|
-
EXE = File.join ROOT, 'exe', BIN
|
3
|
+
require_relative '../lib/tiny_tds/bin'
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
EXTS.each do |ext|
|
13
|
-
exe = File.expand_path File.join(path, "#{cmd}#{ext}"), ROOT
|
14
|
-
next unless File.executable?(exe)
|
15
|
-
next if exe == SELF
|
16
|
-
return exe
|
17
|
-
end
|
18
|
-
end
|
19
|
-
return nil
|
20
|
-
end
|
21
|
-
|
22
|
-
bin = File.exists?(EXE) ? EXE : which(BIN)
|
23
|
-
puts "[TinyTds] #{BIN}: #{bin}"
|
24
|
-
|
25
|
-
Kernel.system bin, *ARGV
|
5
|
+
bin = TinyTds::Bin.new 'tsql'
|
6
|
+
Kernel.system bin.path, *ARGV
|
data/ext/tiny_tds/extconf.rb
CHANGED
@@ -227,7 +227,7 @@ def define_freetds_recipe(host, libiconv, libssl, gnutls)
|
|
227
227
|
bin_path = File.expand_path File.join(path, 'bin')
|
228
228
|
exe_path = File.expand_path File.join(target, '..', 'exe')
|
229
229
|
return unless File.directory?(bin_path)
|
230
|
-
['tsql'].each do |bin|
|
230
|
+
['tsql', 'defncopy'].each do |bin|
|
231
231
|
['.exe', ''].each do |ext|
|
232
232
|
exe = File.join bin_path, "#{bin}#{ext}"
|
233
233
|
next unless File.exists?(exe)
|
data/ext/tiny_tds/extconsts.rb
CHANGED
@@ -5,7 +5,7 @@ ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION
|
|
5
5
|
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.0.2e'
|
6
6
|
OPENSSL_SOURCE_URI = "http://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
|
7
7
|
|
8
|
-
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "0.95.
|
8
|
+
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "0.95.76"
|
9
9
|
FREETDS_VERSION_INFO = Hash.new { |h,k|
|
10
10
|
h[k] = {files: "ftp://ftp.freetds.org/pub/freetds/stable/freetds-#{k}.tar.bz2"}
|
11
11
|
}
|
data/ext/tiny_tds/result.c
CHANGED
@@ -489,7 +489,7 @@ static VALUE rb_tinytds_result_cancel(VALUE self) {
|
|
489
489
|
GET_RESULT_WRAPPER(self);
|
490
490
|
userdata = (tinytds_client_userdata *)dbgetuserdata(rwrap->client);
|
491
491
|
if (rwrap->client && !userdata->dbcancel_sent) {
|
492
|
-
|
492
|
+
rb_tinytds_result_ok_helper(rwrap->client);
|
493
493
|
dbcancel(rwrap->client);
|
494
494
|
userdata->dbcancel_sent = 1;
|
495
495
|
userdata->dbsql_sent = 0;
|
data/lib/tiny_tds/bin.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative './version'
|
2
|
+
|
3
|
+
module TinyTds
|
4
|
+
class Bin
|
5
|
+
|
6
|
+
ROOT = File.expand_path '../..', __FILE__
|
7
|
+
PATHS = ENV['PATH'].split File::PATH_SEPARATOR
|
8
|
+
EXTS = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
9
|
+
|
10
|
+
attr_reader :name
|
11
|
+
|
12
|
+
def initialize(name, options = {})
|
13
|
+
@name = name
|
14
|
+
@binstub = File.join ROOT, 'bin', @name
|
15
|
+
@exefile = File.join ROOT, 'exe', @name
|
16
|
+
puts info unless options[:silent]
|
17
|
+
end
|
18
|
+
|
19
|
+
def path
|
20
|
+
return @path if defined?(@path)
|
21
|
+
@path = File.exists?(@exefile) ? @exefile : which
|
22
|
+
end
|
23
|
+
|
24
|
+
def info
|
25
|
+
"[TinyTds][v#{TinyTds::VERSION}][#{name}]: #{path}"
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def which
|
32
|
+
PATHS.each do |path|
|
33
|
+
EXTS.each do |ext|
|
34
|
+
exe = File.expand_path File.join(path, "#{name}#{ext}"), ROOT
|
35
|
+
next if exe == @binstub
|
36
|
+
next if !File.executable?(exe)
|
37
|
+
next if !binary?(exe)
|
38
|
+
return exe
|
39
|
+
end
|
40
|
+
end
|
41
|
+
return nil
|
42
|
+
end
|
43
|
+
|
44
|
+
# Implementation directly copied from ptools.
|
45
|
+
# https://github.com/djberg96/ptools
|
46
|
+
# https://opensource.org/licenses/Artistic-2.0
|
47
|
+
#
|
48
|
+
def binary?(file)
|
49
|
+
bytes = File.stat(file).blksize
|
50
|
+
bytes = 4096 if bytes > 4096
|
51
|
+
s = (File.read(file, bytes) || "")
|
52
|
+
s = s.encode('US-ASCII', :undef => :replace).split(//)
|
53
|
+
((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
File without changes
|
data/test/result_test.rb
CHANGED
@@ -313,7 +313,7 @@ class ResultTest < TinyTds::TestCase
|
|
313
313
|
it 'has properly encoded column names with symbol keys' do
|
314
314
|
col_name = "öäüß"
|
315
315
|
@client.execute("DROP TABLE [test_encoding]").do rescue nil
|
316
|
-
@client.execute("CREATE TABLE [dbo].[test_encoding] ( [#{col_name}] [nvarchar](10) NOT NULL )").do
|
316
|
+
@client.execute("CREATE TABLE [dbo].[test_encoding] ( [id] int NOT NULL IDENTITY(1,1) PRIMARY KEY, [#{col_name}] [nvarchar](10) NOT NULL )").do
|
317
317
|
@client.execute("INSERT INTO [test_encoding] ([#{col_name}]) VALUES (N'#{col_name}')").do
|
318
318
|
result = @client.execute("SELECT [#{col_name}] FROM [test_encoding]")
|
319
319
|
row = result.each(:as => :hash, :symbolize_keys => true).first
|
@@ -321,7 +321,7 @@ class ResultTest < TinyTds::TestCase
|
|
321
321
|
assert_equal col_name.to_sym, result.fields.first
|
322
322
|
assert_instance_of Symbol, row.keys.first
|
323
323
|
assert_equal col_name.to_sym, row.keys.first
|
324
|
-
end
|
324
|
+
end
|
325
325
|
|
326
326
|
it 'allows #return_code to work with stored procedures and reset per sql batch' do
|
327
327
|
assert_nil @client.return_code
|
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: 0.9.5.beta.
|
4
|
+
version: 0.9.5.beta.3
|
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: 2015-12-
|
13
|
+
date: 2015-12-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mini_portile2
|
@@ -102,6 +102,7 @@ email:
|
|
102
102
|
- ken@metaskills.net
|
103
103
|
- will@wbond.net
|
104
104
|
executables:
|
105
|
+
- defncopy
|
105
106
|
- tsql
|
106
107
|
extensions:
|
107
108
|
- ext/tiny_tds/extconf.rb
|
@@ -116,6 +117,7 @@ files:
|
|
116
117
|
- Rakefile
|
117
118
|
- VERSION
|
118
119
|
- appveyor.yml
|
120
|
+
- bin/defncopy
|
119
121
|
- bin/tsql
|
120
122
|
- exe/.keep
|
121
123
|
- ext/tiny_tds/client.c
|
@@ -127,13 +129,14 @@ files:
|
|
127
129
|
- ext/tiny_tds/tiny_tds_ext.c
|
128
130
|
- ext/tiny_tds/tiny_tds_ext.h
|
129
131
|
- lib/tiny_tds.rb
|
132
|
+
- lib/tiny_tds/bin.rb
|
130
133
|
- lib/tiny_tds/client.rb
|
131
134
|
- lib/tiny_tds/error.rb
|
132
135
|
- lib/tiny_tds/result.rb
|
133
136
|
- lib/tiny_tds/version.rb
|
134
137
|
- ports/patches/freetds/0.91.112/Makefile.in.diff
|
135
138
|
- ports/patches/freetds/0.91.112/dblib-30-char-username.diff
|
136
|
-
- ports/patches/freetds/0.95.
|
139
|
+
- ports/patches/freetds/0.95.76/0001-mingw_missing_inet_pton.diff
|
137
140
|
- test/appveyor/dbsetup.ps1
|
138
141
|
- test/appveyor/dbsetup.sql
|
139
142
|
- test/benchmark/query.rb
|