tiny_tds 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4bb1aa7c75ad14ff11c86de306b0d4f7b966da1
4
- data.tar.gz: 0b1aed0619de9e06bee132e474734a7225d4f1d9
3
+ metadata.gz: 6c6ebe14945fb3158078d43e1d5ddea21d796985
4
+ data.tar.gz: f7d810a55c416e50a45ba9600f512d06c2d7cc90
5
5
  SHA512:
6
- metadata.gz: 8d8f91574030e1ebda761a5cb9f7b93dd43ed998a624ed79560be050f60f21ca1707474b7c5627d5ce293da2cecd3a87184cb99c31b4108d3ac222e7b09df049
7
- data.tar.gz: 6368ff6a8beb965da16bbed44ed52e6d3615fa62e953c42ce613c90c037d817f9d23a327bb6e22206a58ea9507d9c13ea5ee9c0775e037c9c7be841649bcdfe6
6
+ metadata.gz: d466970838b8a143d961a28ca553f0ef1c1cd7b152c4bd408e8cea2f811d1c59441debf2496413b418f320fba311eef215f981e4529abd31b84f837b0ff9725e
7
+ data.tar.gz: f2b783a226c06af4eaac3a4f33d4462b5af0fbeb6d8e37ab6127b86c2fd6528bf927637505ff7d264a6fe8da5592c6e29dfaf39550db0d3505b47365ad083e86
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
@@ -2,5 +2,6 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  group :development do
5
+ gem 'rake-compiler-dock', github: 'rake-compiler/rake-compiler-dock'
5
6
  gem 'byebug'
6
7
  end
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
- [![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) [![Gem Version](https://img.shields.io/gem/v/tiny_tds.svg)](https://rubygems.org/gems/tiny_tds) [![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) <a href="https://codeclimate.com/github/rails-sqlserver/tiny_tds"><img src="https://codeclimate.com/github/rails-sqlserver/tiny_tds/badges/gpa.svg" /></a>
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, libiconv, and OpenSSL. On all other platforms, we will find these dependencies. 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:
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 make sure your local database has a `[tinytdstest]` database with a owner login named `[tinytds]` having no password. The following SQL run via the `sa` account should set that up for you.
398
+ First, clone the repo using the command line or your Git GUI of choice.
379
399
 
380
- ```bash
381
- $ tsql -H <host> -p 1433 -U sa -P <pass>
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
- GO
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
- We use bundler for development. Simply run `bundle install` then `rake` to build the gem and run the unit tests. Before running the test rake task, you may need to define a pair of environment variables that help the client connect to your specific FreeTDS database server name and which schema (2000, 2005, 2008, 2014, Azure or Sybase ASE) to use. For example:
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
- * Google Group: http://groups.google.com/group/rails-sqlserver-adapter
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-1.0.2g-#{host}.dll",
72
- "ssleay32-1.0.2g-#{host}.dll",
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.0.0:2.1.6:2.2.2:2.3.0 CFLAGS="-Wall"
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.5
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: "200"
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
@@ -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=");
@@ -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 = consolidated_host(RbConfig::CONFIG["DLLWRAP"])
178
- execute "dllwrap-libeay32", "#{dllwrap} --dllname libeay32-#{version}-#{host}.dll --output-lib libcrypto.dll.a --def libeay32.def libcrypto.a -lwsock32 -lgdi32 -lcrypt32"
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
- recipe.configure_options << "CFLAGS=-fPIC"
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
 
@@ -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.2g'
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.15"
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
  }
@@ -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
@@ -14,7 +14,7 @@ module TinyTds
14
14
 
15
15
  def exe(name, *args)
16
16
  bin = new(name)
17
- puts bin.info
17
+ puts bin.info unless args.any? { |x| x == '-q' }
18
18
  bin.run(*args)
19
19
  end
20
20
 
@@ -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] ||= true
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
@@ -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
- assert_equal 20012, e.db_error_number
88
- assert_equal 2, e.severity
89
- assert_match %r{server name not found in configuration files}i, e.message, 'ignore if non-english test run'
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' # Keep this version in sync with the one in extconf.rb !
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.5.1'
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.5
4
+ version: 1.1.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: 2016-10-10 00:00:00.000000000 Z
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.5.1
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.5.1
70
+ version: 0.6.0
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: minitest
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +111,7 @@ files:
111
111
  - ".codeclimate.yml"
112
112
  - ".gitignore"
113
113
  - ".rubocop.yml"
114
+ - ".travis.yml"
114
115
  - CHANGELOG
115
116
  - CODE_OF_CONDUCT.md
116
117
  - Gemfile
@@ -122,6 +123,7 @@ files:
122
123
  - appveyor.yml
123
124
  - bin/defncopy
124
125
  - bin/tsql
126
+ - circle.yml
125
127
  - exe/.keep
126
128
  - ext/tiny_tds/client.c
127
129
  - ext/tiny_tds/client.h
@@ -137,12 +139,15 @@ files:
137
139
  - lib/tiny_tds/error.rb
138
140
  - lib/tiny_tds/result.rb
139
141
  - lib/tiny_tds/version.rb
140
- - ports/patches/freetds/1.00.15/0001-mingw_missing_inet_pton.diff
142
+ - ports/patches/freetds/1.00.21/0001-mingw_missing_inet_pton.diff
141
143
  - test/appveyor/dbsetup.ps1
142
144
  - test/appveyor/dbsetup.sql
143
145
  - test/benchmark/query.rb
144
146
  - test/benchmark/query_odbc.rb
145
147
  - test/benchmark/query_tinytds.rb
148
+ - test/bin/install-freetds.sh
149
+ - test/bin/install-openssl.sh
150
+ - test/bin/setup.sh
146
151
  - test/client_test.rb
147
152
  - test/result_test.rb
148
153
  - test/schema/1px.gif
@@ -178,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
183
  version: '0'
179
184
  requirements: []
180
185
  rubyforge_project:
181
- rubygems_version: 2.4.5.1
186
+ rubygems_version: 2.6.4
182
187
  signing_key:
183
188
  specification_version: 4
184
189
  summary: TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.
@@ -188,6 +193,9 @@ test_files:
188
193
  - test/benchmark/query.rb
189
194
  - test/benchmark/query_odbc.rb
190
195
  - test/benchmark/query_tinytds.rb
196
+ - test/bin/install-freetds.sh
197
+ - test/bin/install-openssl.sh
198
+ - test/bin/setup.sh
191
199
  - test/client_test.rb
192
200
  - test/result_test.rb
193
201
  - test/schema/1px.gif
@@ -201,4 +209,3 @@ test_files:
201
209
  - test/schema_test.rb
202
210
  - test/test_helper.rb
203
211
  - test/thread_test.rb
204
- has_rdoc: