tiny_tds 1.0.5-x64-mingw32 → 1.1.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +27 -0
- data/CHANGELOG +12 -0
- data/Gemfile +1 -0
- data/ISSUE_TEMPLATE.md +1 -0
- data/README.md +52 -15
- data/Rakefile +3 -8
- data/VERSION +1 -1
- data/appveyor.yml +3 -7
- data/circle.yml +33 -0
- data/ext/tiny_tds/client.c +1 -0
- data/ext/tiny_tds/extconf.rb +18 -4
- data/ext/tiny_tds/extconsts.rb +2 -2
- data/ext/tiny_tds/result.c +9 -0
- data/lib/tiny_tds/bin.rb +1 -1
- data/lib/tiny_tds/client.rb +1 -1
- data/ports/patches/freetds/{1.00.15 → 1.00.21}/0001-mingw_missing_inet_pton.diff +0 -0
- data/test/bin/install-freetds.sh +20 -0
- data/test/bin/install-openssl.sh +18 -0
- data/test/bin/setup.sh +17 -0
- data/test/client_test.rb +10 -3
- data/test/result_test.rb +5 -0
- data/test/test_helper.rb +4 -0
- data/tiny_tds.gemspec +2 -2
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49c507bfb5368fba5159d1d58a606a99a51a4054
|
4
|
+
data.tar.gz: 89c4cca31bd2b062dd6aaced12f38b508b9e2908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af77d5ffb2568436f0ecc0a59c57b0f1c68480d8b939c5ef9ced3f2eadc524f148507c93ec0d72c9dccb90e6b1ad0bcbd2925cc71484711e791976078070b305
|
7
|
+
data.tar.gz: 2f3bbe9298cfd671217b6b785d0d6eed7e7d4846040c687e56ace2fc7b2272f322f887e827b633bf2abb322698d384667636f941cb52ebaea27a96afa0aee462
|
data/.travis.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
sudo: required
|
2
|
+
cache: bundler
|
3
|
+
services:
|
4
|
+
- docker
|
5
|
+
env:
|
6
|
+
global:
|
7
|
+
- TESTOPTS="-v"
|
8
|
+
- TINYTDS_UNIT_HOST=localhost
|
9
|
+
rvm:
|
10
|
+
- 2.1.9
|
11
|
+
- 2.2.5
|
12
|
+
- 2.3.1
|
13
|
+
before_install:
|
14
|
+
- export PATH=/opt/local/bin:$PATH
|
15
|
+
- docker info
|
16
|
+
- sudo ./test/bin/setup.sh
|
17
|
+
- sudo ./test/bin/install-openssl.sh
|
18
|
+
- openssl version
|
19
|
+
- sudo ./test/bin/install-freetds.sh
|
20
|
+
- tsql -C
|
21
|
+
install:
|
22
|
+
- export PATH=/opt/local/bin:$PATH
|
23
|
+
- gem install bundler
|
24
|
+
- bundle --version
|
25
|
+
- bundle install
|
26
|
+
script:
|
27
|
+
- bundle exec rake
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
* 1.1.0 *
|
2
|
+
|
3
|
+
* Use rake-compiler-dock v0.6.0
|
4
|
+
* Handle SYBVARIANT types from SQL function. Fixes #317. Fixed #321.
|
5
|
+
* Fix `use_utf16` optoin for booleans. Fixes #314
|
6
|
+
* Add `-q` check for bin puts. Fixes #318
|
7
|
+
* Use FreeTDS 1.00.21.
|
8
|
+
* Appveyor tests only 2012, 2014 with one Ruby, 23-x64.
|
9
|
+
* CircleCI & TravisCI both test 2016.
|
10
|
+
|
11
|
+
|
1
12
|
* 1.0.5 *
|
2
13
|
|
3
14
|
* Windows Static Builds - Use FreeTDS 1.00.15, OpenSSL 1.0.2j.
|
@@ -5,6 +16,7 @@
|
|
5
16
|
* Error messages greater than 1024 chars generates a buffer overflow. Fixes #293.
|
6
17
|
* Ensures numeric options are treated numerically Fixes #303.
|
7
18
|
* New `:contained` login option. May deprecate `:azure`. Fixes #292.
|
19
|
+
* New `:use_utf16` login option. Toggle UCS-2 or UTF-16. Default true.
|
8
20
|
|
9
21
|
|
10
22
|
* 1.0.4 *
|
data/Gemfile
CHANGED
data/ISSUE_TEMPLATE.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
Having problems? Have you checked these first:
|
2
2
|
|
3
|
+
* Have you made sure to [enable SQL Server authentication](http://bit.ly/1Kw3set)?
|
3
4
|
* Are you using FreeTDS 0.95.80 or later? Check `$ tsql -C` to find out.
|
4
5
|
* If not, please update then uninstall the TinyTDS gem and re-install it.
|
5
6
|
* Using Ubuntu? If so, you may have forgotten to install FreeTDS first.
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
|
2
2
|
|
3
|
-
[![
|
3
|
+
* [![TravisCI](https://travis-ci.org/rails-sqlserver/tiny_tds.svg?branch=master)](https://travis-ci.org/rails-sqlserver/tiny_tds) - TravisCI
|
4
|
+
* [![CircleCI](https://circleci.com/gh/rails-sqlserver/tiny_tds/tree/master.svg?style=svg)](https://circleci.com/gh/rails-sqlserver/tiny_tds/tree/master) - CircleCI
|
5
|
+
* [![Build Status](https://ci.appveyor.com/api/projects/status/g2bhhbsdkx0mal55/branch/master?svg=true)](https://ci.appveyor.com/project/rails-sqlserver/tiny-tds/branch/master) - Appveyor
|
6
|
+
* [![Code Climate](https://codeclimate.com/github/rails-sqlserver/tiny_tds/badges/gpa.svg)](https://codeclimate.com/github/rails-sqlserver/tiny_tds) - Code Climate
|
7
|
+
* [![Gem Version](https://img.shields.io/gem/v/tiny_tds.svg)](https://rubygems.org/gems/tiny_tds) - Gem Version
|
8
|
+
* [![Gitter chat](https://img.shields.io/badge/%E2%8A%AA%20GITTER%20-JOIN%20CHAT%20%E2%86%92-brightgreen.svg?style=flat)](https://gitter.im/rails-sqlserver/activerecord-sqlserver-adapter) - Community
|
4
9
|
|
5
10
|
The TinyTDS gem is meant to serve the extremely common use-case of connecting, querying and iterating over results to Microsoft SQL Server or Sybase databases from Ruby using the FreeTDS's DB-Library API.
|
6
11
|
|
@@ -21,7 +26,22 @@ Installing with rubygems should just work. TinyTDS is currently tested on Ruby v
|
|
21
26
|
$ gem install tiny_tds
|
22
27
|
```
|
23
28
|
|
24
|
-
If you use Windows, we pre-compile TinyTDS with static versions of FreeTDS
|
29
|
+
If you use Windows, we pre-compile TinyTDS with static versions of FreeTDS and supporting libraries. On all other platforms, we will find these dependencies. It is recommended that you install the latest FreeTDS via your method of choice. For example, here is how to install FreeTDS on Ubuntu. You might also need the `build-essential` and possibly the `libc6-dev` packages.
|
30
|
+
|
31
|
+
```shell
|
32
|
+
$ apt-get wget
|
33
|
+
$ apt-get install build-essential
|
34
|
+
$ apt-get install libc6-dev
|
35
|
+
|
36
|
+
$ wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.21.tar.gz
|
37
|
+
$ tar -xzf freetds-1.00.21.tar.gz
|
38
|
+
$ cd freetds-1.00.21
|
39
|
+
$ ./configure --prefix=/usr/local --with-tdsver=7.3
|
40
|
+
$ make
|
41
|
+
$ make install
|
42
|
+
```
|
43
|
+
|
44
|
+
If none exist, our native extension will use MiniPortile to install any missing dependencies listed above for your specific platform. These dependencies will be built and linked within the installed TinyTDS gem. Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
|
25
45
|
|
26
46
|
```
|
27
47
|
--enable-system-freetds / --disable-system-freetds
|
@@ -375,34 +395,51 @@ The compiled gems will exist in `./pkg` directory.
|
|
375
395
|
|
376
396
|
## Development & Testing
|
377
397
|
|
378
|
-
First
|
398
|
+
First, clone the repo using the command line or your Git GUI of choice.
|
379
399
|
|
380
|
-
```
|
381
|
-
$
|
382
|
-
$ sqsh -H <host> -p 1433 -U sa -P <pass>
|
400
|
+
```shell
|
401
|
+
$ git clone git@github.com:rails-sqlserver/tiny_tds.git
|
383
402
|
```
|
384
403
|
|
404
|
+
After that, the quickest way to get setup for development is to use [Docker](https://www.docker.com/). Assuming you have [downloaded docker](https://www.docker.com/products/docker) for your platform and you have , you can run our test setup script.
|
405
|
+
|
406
|
+
```shell
|
407
|
+
$ ./test/bin/setup.sh
|
408
|
+
```
|
409
|
+
|
410
|
+
This will download our SQL Server for Linux Docker image based from [microsoft/mssql-server-linux/](https://hub.docker.com/r/microsoft/mssql-server-linux/). Our image already has the `[tinytdstest]` DB and `tinytds` users created. Basically, it does the following.
|
411
|
+
|
412
|
+
```shell
|
413
|
+
$ docker pull metaskills/mssql-server-linux-tinytds
|
414
|
+
$ docker run -p 1433:1433 -d metaskills/mssql-server-linux-tinytds
|
415
|
+
```
|
416
|
+
|
417
|
+
If you are using your own database. Make sure to run these SQL commands as SA to get the test database and user installed.
|
418
|
+
|
385
419
|
```sql
|
386
420
|
CREATE DATABASE [tinytdstest];
|
387
|
-
|
421
|
+
```
|
422
|
+
|
423
|
+
```sql
|
388
424
|
CREATE LOGIN [tinytds] WITH PASSWORD = '', CHECK_POLICY = OFF, DEFAULT_DATABASE = [tinytdstest];
|
389
|
-
GO
|
390
425
|
USE [tinytdstest];
|
391
426
|
CREATE USER [tinytds] FOR LOGIN [tinytds];
|
392
|
-
GO
|
393
427
|
EXEC sp_addrolemember N'db_owner', N'tinytds';
|
394
|
-
GO
|
395
428
|
```
|
396
429
|
|
397
|
-
|
430
|
+
From here you can now run the tests. This assumes you have both Ruby & the needed FreeTDS installed.
|
431
|
+
|
432
|
+
```shell
|
433
|
+
$ bundle install
|
434
|
+
$ bundle exec rake
|
435
|
+
```
|
436
|
+
|
437
|
+
Examples us using enviornment variables to customize the test task.
|
398
438
|
|
399
439
|
```
|
400
440
|
$ rake TINYTDS_UNIT_DATASERVER=mydbserver
|
401
|
-
or
|
402
441
|
$ rake TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2008
|
403
|
-
or
|
404
442
|
$ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
|
405
|
-
or
|
406
443
|
$ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=sybase_ase
|
407
444
|
```
|
408
445
|
|
@@ -417,7 +454,7 @@ $ rake TINYTDS_SKIP_PORTS=1
|
|
417
454
|
|
418
455
|
* Github Source: http://github.com/rails-sqlserver/tiny_tds
|
419
456
|
* Github Issues: http://github.com/rails-sqlserver/tiny_tds/issues
|
420
|
-
*
|
457
|
+
* Gitter Chat: https://gitter.im/rails-sqlserver/activerecord-sqlserver-adapter
|
421
458
|
* IRC Room: #rails-sqlserver on irc.freenode.net
|
422
459
|
|
423
460
|
|
data/Rakefile
CHANGED
@@ -68,8 +68,8 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
|
|
68
68
|
gemplat = spec.platform.to_s
|
69
69
|
host = platform_host_map[gemplat]
|
70
70
|
dlls = [
|
71
|
-
"libeay32
|
72
|
-
"ssleay32
|
71
|
+
"libeay32-#{OPENSSL_VERSION}-#{host}.dll",
|
72
|
+
"ssleay32-#{OPENSSL_VERSION}-#{host}.dll",
|
73
73
|
'libiconv-2.dll',
|
74
74
|
'libsybdb-5.dll'
|
75
75
|
]
|
@@ -77,11 +77,6 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
|
|
77
77
|
spec.files = spec.files.reject { |f| f =~ %r{^ports\/archives/} }
|
78
78
|
spec.files += dlls.map { |dll| "ports/#{host}/bin/#{File.basename(dll)}" }
|
79
79
|
spec.files += Dir.glob('exe/*')
|
80
|
-
dlls.each do |dll|
|
81
|
-
file "ports/#{host}/bin/#{dll}" do |t|
|
82
|
-
sh 'x86_64-w64-mingw32-strip', t.name
|
83
|
-
end
|
84
|
-
end
|
85
80
|
end
|
86
81
|
end
|
87
82
|
|
@@ -94,7 +89,7 @@ desc 'Build the windows binary gems per rake-compiler-dock'
|
|
94
89
|
task 'gem:windows' do
|
95
90
|
require 'rake_compiler_dock'
|
96
91
|
RakeCompilerDock.sh <<-EOT
|
97
|
-
bundle && rake cross native gem RUBY_CC_VERSION=2.
|
92
|
+
bundle && rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 CFLAGS="-Wall"
|
98
93
|
EOT
|
99
94
|
end
|
100
95
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/appveyor.yml
CHANGED
@@ -5,6 +5,7 @@ init:
|
|
5
5
|
- SET TESTOPTS='-v'
|
6
6
|
clone_depth: 5
|
7
7
|
skip_tags: true
|
8
|
+
skip_branch_with_pr: true
|
8
9
|
matrix:
|
9
10
|
fast_finish: true
|
10
11
|
install:
|
@@ -22,12 +23,6 @@ test_script:
|
|
22
23
|
- timeout /t 4 /nobreak > NUL
|
23
24
|
- powershell -File "%APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.ps1"
|
24
25
|
- timeout /t 4 /nobreak > NUL
|
25
|
-
- ps: Start-Service 'MSSQL$SQL2016'
|
26
|
-
- timeout /t 4 /nobreak > NUL
|
27
|
-
- sqlcmd -S ".\SQL2016" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
28
|
-
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2016" TINYTDS_SCHEMA=sqlserver_2014 TDSVER=7.1
|
29
|
-
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2016" TINYTDS_SCHEMA=sqlserver_2014
|
30
|
-
- ps: Stop-Service 'MSSQL$SQL2016'
|
31
26
|
- ps: Start-Service 'MSSQL$SQL2014'
|
32
27
|
- timeout /t 4 /nobreak > NUL
|
33
28
|
- sqlcmd -S ".\SQL2014" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
@@ -46,6 +41,7 @@ environment:
|
|
46
41
|
matrix:
|
47
42
|
- ruby_version: "23-x64"
|
48
43
|
- ruby_version: "23"
|
49
|
-
- ruby_version: "
|
44
|
+
- ruby_version: "22-x64"
|
45
|
+
- ruby_version: "22"
|
50
46
|
on_failure:
|
51
47
|
- find -name compile.log | xargs cat
|
data/circle.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
general:
|
2
|
+
branches:
|
3
|
+
ignore:
|
4
|
+
- /dev.*/
|
5
|
+
|
6
|
+
machine:
|
7
|
+
environment:
|
8
|
+
PATH: /opt/local/bin:${PATH}
|
9
|
+
TESTOPTS: -v
|
10
|
+
TINYTDS_UNIT_HOST: localhost
|
11
|
+
services:
|
12
|
+
- docker
|
13
|
+
|
14
|
+
dependencies:
|
15
|
+
override:
|
16
|
+
- rvm-exec 2.1.9 bundle install
|
17
|
+
- rvm-exec 2.2.5 bundle install
|
18
|
+
- rvm-exec 2.3.1 bundle install
|
19
|
+
- sudo ./test/bin/install-openssl.sh
|
20
|
+
- openssl version
|
21
|
+
- sudo ./test/bin/install-freetds.sh
|
22
|
+
- tsql -C
|
23
|
+
|
24
|
+
database:
|
25
|
+
post:
|
26
|
+
- docker info
|
27
|
+
- ./test/bin/setup.sh
|
28
|
+
|
29
|
+
test:
|
30
|
+
override:
|
31
|
+
- rvm-exec 2.1.9 bundle exec rake
|
32
|
+
- rvm-exec 2.2.5 bundle exec rake
|
33
|
+
- rvm-exec 2.3.1 bundle exec rake
|
data/ext/tiny_tds/client.c
CHANGED
@@ -409,6 +409,7 @@ void init_tinytds_client() {
|
|
409
409
|
sym_encoding = ID2SYM(rb_intern("encoding"));
|
410
410
|
sym_azure = ID2SYM(rb_intern("azure"));
|
411
411
|
sym_contained = ID2SYM(rb_intern("contained"));
|
412
|
+
sym_use_utf16 = ID2SYM(rb_intern("use_utf16"));
|
412
413
|
/* Intern TinyTds::Error Accessors */
|
413
414
|
intern_source_eql = rb_intern("source=");
|
414
415
|
intern_severity_eql = rb_intern("severity=");
|
data/ext/tiny_tds/extconf.rb
CHANGED
@@ -166,6 +166,19 @@ def define_libssl_recipe(host)
|
|
166
166
|
execute "configure", "sh -c \"#{args.join(" ")}\""
|
167
167
|
end
|
168
168
|
|
169
|
+
def dllwrap(dllname, outputlib, deffile, linkto)
|
170
|
+
gcc = consolidated_host(RbConfig::CONFIG["CC"])
|
171
|
+
|
172
|
+
#RbConfig does not provide dlltool, but it should exist where dllwrap lives
|
173
|
+
dlltool = consolidated_host(RbConfig::CONFIG["DLLWRAP"]).sub('dllwrap','dlltool')
|
174
|
+
|
175
|
+
execute "gcc-#{dllname}-compile", "#{gcc} -Wl,--base-file,#{dllname}.base -mdll -o #{dllname}.dll --leading-underscore #{linkto}"
|
176
|
+
execute "dlltool-#{dllname}-exp", "#{dlltool} --base-file #{dllname}.base --output-exp #{dllname}.exp --dllname #{dllname}.dll --def #{deffile}"
|
177
|
+
execute "gcc-#{dllname}-dll", "#{gcc} -Wl,--base-file,#{dllname}.base #{dllname}.exp -mdll -o #{dllname}.dll --leading-underscore #{linkto}"
|
178
|
+
execute "dlltool-#{dllname}-outputlib", "#{dlltool} --base-file #{dllname}.base --output-exp #{dllname}.exp --dllname #{dllname}.dll --def #{deffile} --output-lib #{outputlib}"
|
179
|
+
execute "gcc-#{dllname}-link", "#{gcc} #{dllname}.exp -mdll -o #{dllname}.dll --leading-underscore #{linkto}"
|
180
|
+
end
|
181
|
+
|
169
182
|
def compile
|
170
183
|
super
|
171
184
|
# OpenSSL DLLs are called "libeay32.dll" and "ssleay32.dll" per default,
|
@@ -174,9 +187,8 @@ def define_libssl_recipe(host)
|
|
174
187
|
# with our own naming scheme.
|
175
188
|
execute "mkdef-libeay32", "(perl util/mkdef.pl 32 libeay >libeay32.def)"
|
176
189
|
execute "mkdef-ssleay32", "(perl util/mkdef.pl 32 ssleay >ssleay32.def)"
|
177
|
-
dllwrap
|
178
|
-
|
179
|
-
execute "dllwrap-ssleay32", "#{dllwrap} --dllname ssleay32-#{version}-#{host}.dll --output-lib libssl.dll.a --def ssleay32.def libssl.a libcrypto.dll.a"
|
190
|
+
dllwrap("libeay32-#{version}-#{host}", "libcrypto.dll.a", "libeay32.def", "libcrypto.a -lws2_32 -lgdi32 -lcrypt32")
|
191
|
+
dllwrap("ssleay32-#{version}-#{host}", "libssl.dll.a", "ssleay32.def", "libssl.a libcrypto.dll.a")
|
180
192
|
end
|
181
193
|
|
182
194
|
def install
|
@@ -193,7 +205,9 @@ end
|
|
193
205
|
def define_libiconv_recipe(host)
|
194
206
|
BuildRecipe.new("libiconv", ICONV_VERSION, [ICONV_SOURCE_URI]).tap do |recipe|
|
195
207
|
# always produce position independent code
|
196
|
-
|
208
|
+
# and set an explicit optimization to avoid inline functions being optimized
|
209
|
+
# out of libiconv
|
210
|
+
recipe.configure_options << "CFLAGS=-fPIC -O2"
|
197
211
|
end
|
198
212
|
end
|
199
213
|
|
data/ext/tiny_tds/extconsts.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
ICONV_VERSION = ENV['TINYTDS_ICONV_VERSION'] || "1.14"
|
3
3
|
ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz"
|
4
4
|
|
5
|
-
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.0.
|
5
|
+
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.0.2j'
|
6
6
|
OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
|
7
7
|
|
8
|
-
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.
|
8
|
+
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.21"
|
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
@@ -325,6 +325,15 @@ static VALUE rb_tinytds_result_fetch_row(VALUE self, ID timezone, int symbolize_
|
|
325
325
|
case SYBTEXT:
|
326
326
|
val = ENCODED_STR_NEW(data, data_len);
|
327
327
|
break;
|
328
|
+
case 98: { // SYBVARIANT
|
329
|
+
if (data_len == 4) {
|
330
|
+
val = INT2NUM(*(DBINT *)data);
|
331
|
+
break;
|
332
|
+
} else {
|
333
|
+
val = ENCODED_STR_NEW(data, data_len);
|
334
|
+
break;
|
335
|
+
}
|
336
|
+
}
|
328
337
|
default:
|
329
338
|
val = ENCODED_STR_NEW(data, data_len);
|
330
339
|
break;
|
data/lib/tiny_tds/bin.rb
CHANGED
data/lib/tiny_tds/client.rb
CHANGED
@@ -42,7 +42,7 @@ module TinyTds
|
|
42
42
|
opts[:password] = opts[:password].to_s if opts[:password] && opts[:password].to_s.strip != ''
|
43
43
|
opts[:appname] ||= 'TinyTds'
|
44
44
|
opts[:tds_version] = tds_versions_setter(opts)
|
45
|
-
opts[:use_utf16]
|
45
|
+
opts[:use_utf16] = opts[:use_utf16].nil? || ["true", "1", "yes"].include?(opts[:use_utf16].to_s)
|
46
46
|
opts[:login_timeout] ||= 60
|
47
47
|
opts[:timeout] ||= 5
|
48
48
|
opts[:encoding] = opts[:encoding].nil? || opts[:encoding].casecmp('utf8').zero? ? 'UTF-8' : opts[:encoding].upcase
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -x
|
4
|
+
set -e
|
5
|
+
|
6
|
+
if [ -z "$FREETDS_VERSION" ]; then
|
7
|
+
FREETDS_VERSION=$(ruby -r "./ext/tiny_tds/extconsts.rb" -e "puts FREETDS_VERSION")
|
8
|
+
fi
|
9
|
+
|
10
|
+
wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-$FREETDS_VERSION.tar.gz
|
11
|
+
tar -xzf freetds-$FREETDS_VERSION.tar.gz
|
12
|
+
cd freetds-$FREETDS_VERSION
|
13
|
+
./configure --prefix=/opt/local \
|
14
|
+
--with-openssl=/opt/local \
|
15
|
+
--with-tdsver=7.3
|
16
|
+
make
|
17
|
+
make install
|
18
|
+
cd ..
|
19
|
+
rm -rf freetds-$FREETDS_VERSION
|
20
|
+
rm freetds-$FREETDS_VERSION.tar.gz
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -x
|
4
|
+
set -e
|
5
|
+
|
6
|
+
if [ -z "$OPENSSL_VERSION" ]; then
|
7
|
+
OPENSSL_VERSION=$(ruby -r "./ext/tiny_tds/extconsts.rb" -e "puts OPENSSL_VERSION")
|
8
|
+
fi
|
9
|
+
|
10
|
+
wget https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
|
11
|
+
tar -xzf openssl-$OPENSSL_VERSION.tar.gz
|
12
|
+
cd openssl-$OPENSSL_VERSION
|
13
|
+
./config --prefix=/opt/local
|
14
|
+
make
|
15
|
+
make install
|
16
|
+
cd ..
|
17
|
+
rm -rf openssl-$OPENSSL_VERSION
|
18
|
+
rm openssl-$OPENSSL_VERSION.tar.gz
|
data/test/bin/setup.sh
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -x
|
4
|
+
set -e
|
5
|
+
|
6
|
+
docker pull metaskills/mssql-server-linux-tinytds
|
7
|
+
|
8
|
+
container=$(docker ps -a -q --filter ancestor=metaskills/mssql-server-linux-tinytds)
|
9
|
+
if [[ -z $container ]]; then
|
10
|
+
docker run -p 1433:1433 -d metaskills/mssql-server-linux-tinytds && sleep 10
|
11
|
+
exit
|
12
|
+
fi
|
13
|
+
|
14
|
+
container=$(docker ps -q --filter ancestor=metaskills/mssql-server-linux-tinytds)
|
15
|
+
if [[ -z $container ]]; then
|
16
|
+
docker start $container && sleep 10
|
17
|
+
fi
|
data/test/client_test.rb
CHANGED
@@ -84,9 +84,16 @@ class ClientTest < TinyTds::TestCase
|
|
84
84
|
options = connection_options :login_timeout => 1, :dataserver => 'DOESNOTEXIST'
|
85
85
|
action = lambda { new_connection(options) }
|
86
86
|
assert_raise_tinytds_error(action) do |e|
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
# Not sure why tese are different.
|
88
|
+
if ruby_darwin?
|
89
|
+
assert_equal 20009, e.db_error_number
|
90
|
+
assert_equal 9, e.severity
|
91
|
+
assert_match %r{is unavailable or does not exist}i, e.message, 'ignore if non-english test run'
|
92
|
+
else
|
93
|
+
assert_equal 20012, e.db_error_number
|
94
|
+
assert_equal 2, e.severity
|
95
|
+
assert_match %r{server name not found in configuration files}i, e.message, 'ignore if non-english test run'
|
96
|
+
end
|
90
97
|
end
|
91
98
|
assert_new_connections_work
|
92
99
|
end
|
data/test/result_test.rb
CHANGED
@@ -335,6 +335,11 @@ class ResultTest < TinyTds::TestCase
|
|
335
335
|
assert_nil result.return_code
|
336
336
|
end
|
337
337
|
|
338
|
+
it 'with LOGINPROPERTY function' do
|
339
|
+
v = @client.execute("SELECT LOGINPROPERTY('sa', 'IsLocked') as v").first['v']
|
340
|
+
v.must_equal 0
|
341
|
+
end
|
342
|
+
|
338
343
|
describe 'with multiple result sets' do
|
339
344
|
|
340
345
|
before do
|
data/test/test_helper.rb
CHANGED
@@ -142,6 +142,10 @@ module TinyTds
|
|
142
142
|
RbConfig::CONFIG['host_os'] =~ /ming/
|
143
143
|
end
|
144
144
|
|
145
|
+
def ruby_darwin?
|
146
|
+
RbConfig::CONFIG['host_os'] =~ /darwin/
|
147
|
+
end
|
148
|
+
|
145
149
|
def load_current_schema
|
146
150
|
loader = new_connection
|
147
151
|
schema_file = File.expand_path File.join(File.dirname(__FILE__), 'schema', "#{current_schema}.sql")
|
data/tiny_tds.gemspec
CHANGED
@@ -19,10 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.extensions = ['ext/tiny_tds/extconf.rb']
|
20
20
|
s.license = 'MIT'
|
21
21
|
s.required_ruby_version = '>= 2.0.0'
|
22
|
-
s.add_runtime_dependency 'mini_portile2', '~> 2.0'
|
22
|
+
s.add_runtime_dependency 'mini_portile2', '~> 2.0'
|
23
23
|
s.add_development_dependency 'rake', '~> 10.4'
|
24
24
|
s.add_development_dependency 'rake-compiler', '0.9.5'
|
25
|
-
s.add_development_dependency 'rake-compiler-dock', '~> 0.
|
25
|
+
s.add_development_dependency 'rake-compiler-dock', '~> 0.6.0'
|
26
26
|
s.add_development_dependency 'minitest', '~> 5.6'
|
27
27
|
s.add_development_dependency 'connection_pool', '~> 2.2'
|
28
28
|
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: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: x64-mingw32
|
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: 2016-
|
13
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mini_portile2
|
@@ -60,14 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.6.0
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.6.0
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: minitest
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- ".codeclimate.yml"
|
111
111
|
- ".gitignore"
|
112
112
|
- ".rubocop.yml"
|
113
|
+
- ".travis.yml"
|
113
114
|
- CHANGELOG
|
114
115
|
- CODE_OF_CONDUCT.md
|
115
116
|
- Gemfile
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- appveyor.yml
|
122
123
|
- bin/defncopy
|
123
124
|
- bin/tsql
|
125
|
+
- circle.yml
|
124
126
|
- exe/.keep
|
125
127
|
- exe/defncopy.exe
|
126
128
|
- exe/tsql.exe
|
@@ -137,21 +139,25 @@ files:
|
|
137
139
|
- lib/tiny_tds/2.1/tiny_tds.so
|
138
140
|
- lib/tiny_tds/2.2/tiny_tds.so
|
139
141
|
- lib/tiny_tds/2.3/tiny_tds.so
|
142
|
+
- lib/tiny_tds/2.4/tiny_tds.so
|
140
143
|
- lib/tiny_tds/bin.rb
|
141
144
|
- lib/tiny_tds/client.rb
|
142
145
|
- lib/tiny_tds/error.rb
|
143
146
|
- lib/tiny_tds/result.rb
|
144
147
|
- lib/tiny_tds/version.rb
|
145
|
-
- ports/patches/freetds/1.00.
|
146
|
-
- ports/x86_64-w64-mingw32/bin/libeay32-1.0.
|
148
|
+
- ports/patches/freetds/1.00.21/0001-mingw_missing_inet_pton.diff
|
149
|
+
- ports/x86_64-w64-mingw32/bin/libeay32-1.0.2j-x86_64-w64-mingw32.dll
|
147
150
|
- ports/x86_64-w64-mingw32/bin/libiconv-2.dll
|
148
151
|
- ports/x86_64-w64-mingw32/bin/libsybdb-5.dll
|
149
|
-
- ports/x86_64-w64-mingw32/bin/ssleay32-1.0.
|
152
|
+
- ports/x86_64-w64-mingw32/bin/ssleay32-1.0.2j-x86_64-w64-mingw32.dll
|
150
153
|
- test/appveyor/dbsetup.ps1
|
151
154
|
- test/appveyor/dbsetup.sql
|
152
155
|
- test/benchmark/query.rb
|
153
156
|
- test/benchmark/query_odbc.rb
|
154
157
|
- test/benchmark/query_tinytds.rb
|
158
|
+
- test/bin/install-freetds.sh
|
159
|
+
- test/bin/install-openssl.sh
|
160
|
+
- test/bin/setup.sh
|
155
161
|
- test/client_test.rb
|
156
162
|
- test/result_test.rb
|
157
163
|
- test/schema/1px.gif
|
@@ -187,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
193
|
version: '0'
|
188
194
|
requirements: []
|
189
195
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.5.
|
196
|
+
rubygems_version: 2.5.2
|
191
197
|
signing_key:
|
192
198
|
specification_version: 4
|
193
199
|
summary: TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.
|