activerecord-sqlserver-adapter 4.2.15 → 4.2.16

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: 1d48925cc69817fb38f75ba9ce678d5df931b7d7
4
- data.tar.gz: f0cd00edff4e8b9fb009b239368c8cb799e48e66
3
+ metadata.gz: 7c7985b6dcbd1c96d62b6c252bd260826c5689fa
4
+ data.tar.gz: 3708a1600a2c515ff4f7605c45079728c10fe254
5
5
  SHA512:
6
- metadata.gz: 43b840b4991b0584ab46219d2d427adbd28b3c67586726b8367ac124927b3fb05d99ba4034706c4486df66a00dffdd731fc3b1d9cad36be35b0da747e912a1c6
7
- data.tar.gz: 09c590c4c7e253e493c130addfee719741b308f453274ecfce1f3da4a4ecc770cf91e18e7600325bf6d89c273e6c6e47070be433502e71ea25d5b92d015da4c6
6
+ metadata.gz: edd7abf4c1cf08d0caf66bae13b7cce3bb715b273572d08e60e8527f671b22c7a2b8ae04164a17b4855960eaf5931c701e01ff35f96aa780828ac68f2aaac843
7
+ data.tar.gz: e744b5c9cb0969436ae7dbb122f6c9de5ee955b4ca776c7696bc1ecfa6b21addbc604f6f360d47ba1790ee77d9bd2578502d2884380d0a71a572eb041d2159a3
data/.travis.yml ADDED
@@ -0,0 +1,27 @@
1
+ sudo: required
2
+ cache: bundler
3
+ services:
4
+ - docker
5
+ env:
6
+ global:
7
+ - TINYTDS_VERSION=1.1.0
8
+ - ACTIVERECORD_UNITTEST_HOST=localhost
9
+ - ACTIVERECORD_UNITTEST_DATASERVER=localhost
10
+ rvm:
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.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## v4.2.16
2
+
3
+ #### Fixed
4
+
5
+ * Overwrite `_type_cast` method for char data. Fixes #491 #494
6
+ * Char type data compared against it's string value. Fixes #487 #488
7
+ * Filter table constraints with matching table schema to column. Fixes #478
8
+
9
+
1
10
  ## v4.2.15
2
11
 
3
12
  #### Fixed
data/README.md CHANGED
@@ -1,7 +1,12 @@
1
1
 
2
2
  # ActiveRecord SQL Server Adapter. For SQL Server 2012 And Higher.
3
3
 
4
- [![Build status](https://ci.appveyor.com/api/projects/status/mtgbx8f57vr7k2qa/branch/master?svg=true)](https://ci.appveyor.com/project/rails-sqlserver/activerecord-sqlserver-adapter/branch/master) [![Gem Version](http://img.shields.io/gem/v/activerecord-sqlserver-adapter.svg?style=flat)](https://rubygems.org/gems/activerecord-sqlserver-adapter) [![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)
4
+ * [![TravisCI](https://travis-ci.org/rails-sqlserver/activerecord-sqlserver-adapter.svg?branch=4-2-stable)](https://travis-ci.org/rails-sqlserver/activerecord-sqlserver-adapter) - TravisCI
5
+ * [![CircleCI](https://circleci.com/gh/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-2-stable.svg?style=svg)](https://circleci.com/gh/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-2-stable) - CircleCI
6
+ * [![Build Status](https://ci.appveyor.com/api/projects/status/mtgbx8f57vr7k2qa/branch/4-2-stable?svg=true)](https://ci.appveyor.com/project/rails-sqlserver/activerecord-sqlserver-adapter/branch/4-2-stable) - Appveyor
7
+ * [![Gem Version](http://img.shields.io/gem/v/activerecord-sqlserver-adapter.svg)](https://rubygems.org/gems/activerecord-sqlserver-adapter) - Gem Version
8
+ * [![Dependency Status](https://dependencyci.com/github/rails-sqlserver/activerecord-sqlserver-adapter/badge)](https://dependencyci.com/github/rails-sqlserver/activerecord-sqlserver-adapter) - Dependency Status
9
+ * [![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
5
10
 
6
11
  ![kantishna-wide](https://cloud.githubusercontent.com/assets/2381/5895051/aa6a57e0-a4e1-11e4-95b9-23627af5876a.jpg)
7
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.2.15
1
+ 4.2.16
data/appveyor.yml CHANGED
@@ -2,8 +2,7 @@ init:
2
2
  - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
3
3
  - SET PATH=C:\MinGW\msys\1.0\bin;%PATH%
4
4
  - SET RAKEOPT=-rdevkit
5
- - SET TESTOPTS='-v'
6
- - SET TINYTDS_VERSION=1.0.4
5
+ - SET TINYTDS_VERSION=1.1.0
7
6
  clone_depth: 5
8
7
  skip_tags: true
9
8
  matrix:
@@ -12,7 +11,9 @@ install:
12
11
  - ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number"
13
12
  - ruby --version
14
13
  - gem --version
15
- - bundle install --without odbc guard
14
+ - bundle install
15
+ - gem uninstall bcrypt
16
+ - gem install bcrypt --platform=ruby
16
17
  build: off
17
18
  test_script:
18
19
  - powershell -File "%APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.ps1"
@@ -26,14 +27,13 @@ test_script:
26
27
  - timeout /t 4 /nobreak > NUL
27
28
  - sqlcmd -S ".\SQL2012SP1" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
28
29
  - bundle exec rake test ACTIVERECORD_UNITTEST_DATASERVER="localhost\SQL2012SP1"
29
- - timeout /t 4 /nobreak > NUL
30
- - bundle exec rake test ACTIVERECORD_UNITTEST_HOST=%CI_AZURE_HOST% ACTIVERECORD_UNITTEST_PASS=%CI_AZURE_PASS% ACTIVERECORD_UNITTEST_AZURE=1
31
30
  environment:
32
31
  CI_AZURE_HOST:
33
32
  secure: VChrioaIWkf9iuuaSs4cryiA4honrADgZqNC0++begg=
34
33
  CI_AZURE_PASS:
35
34
  secure: cSQp8sk4urJYvq0utpsK+r7J+snJ2wpcdp8RdXJfB+w=
36
35
  matrix:
37
- - ruby_version: "200"
38
- - ruby_version: "22"
36
+ - ruby_version: "23-x64"
37
+ - ruby_version: "23"
39
38
  - ruby_version: "22-x64"
39
+ - ruby_version: "22"
data/circle.yml ADDED
@@ -0,0 +1,34 @@
1
+ general:
2
+ branches:
3
+ ignore:
4
+ - /dev.*/
5
+
6
+ machine:
7
+ environment:
8
+ PATH: /opt/local/bin:${PATH}
9
+ TINYTDS_VERSION: 1.1.0
10
+ ACTIVERECORD_UNITTEST_HOST: localhost
11
+ ACTIVERECORD_UNITTEST_DATASERVER: localhost
12
+ services:
13
+ - docker
14
+
15
+ dependencies:
16
+ override:
17
+ - sudo ./test/bin/install-openssl.sh
18
+ - openssl version
19
+ - sudo ./test/bin/install-freetds.sh
20
+ - tsql -C
21
+ - rvm-exec 2.2.5 bundle install
22
+ - rvm-exec 2.3.1 bundle install
23
+
24
+ database:
25
+ override:
26
+ - echo "Hello"
27
+ post:
28
+ - docker info
29
+ - ./test/bin/setup.sh
30
+
31
+ test:
32
+ override:
33
+ - rvm-exec 2.2.5 bundle exec rake test
34
+ - rvm-exec 2.3.1 bundle exec rake test
@@ -63,6 +63,15 @@ module ActiveRecord
63
63
  end
64
64
  end
65
65
 
66
+ def _type_cast(value)
67
+ case value
68
+ when ActiveRecord::Type::SQLServer::Char::Data
69
+ value.to_s
70
+ else
71
+ super
72
+ end
73
+ end
74
+
66
75
  end
67
76
  end
68
77
  end
@@ -264,6 +264,7 @@ module ActiveRecord
264
264
  FROM #{database}.INFORMATION_SCHEMA.COLUMNS columns
265
265
  LEFT OUTER JOIN #{database}.INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
266
266
  ON TC.TABLE_NAME = columns.TABLE_NAME
267
+ AND TC.TABLE_SCHEMA = columns.TABLE_SCHEMA
267
268
  AND TC.CONSTRAINT_TYPE = N'PRIMARY KEY'
268
269
  LEFT OUTER JOIN #{database}.INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU
269
270
  ON KCU.COLUMN_NAME = columns.COLUMN_NAME
@@ -29,6 +29,11 @@ module ActiveRecord
29
29
  end
30
30
  alias_method :to_str, :to_s
31
31
 
32
+ def ==(other)
33
+ self.to_s == other.to_s
34
+ end
35
+ alias_method :eql?, :==
36
+
32
37
  end
33
38
 
34
39
  end
data/test/bin/.keep ADDED
File without changes
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -x
4
+ set -e
5
+
6
+ FREETDS_VERSION=1.00.21
7
+
8
+ wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-$FREETDS_VERSION.tar.gz
9
+ tar -xzf freetds-$FREETDS_VERSION.tar.gz
10
+ cd freetds-$FREETDS_VERSION
11
+ ./configure --prefix=/opt/local \
12
+ --with-openssl=/opt/local \
13
+ --with-tdsver=7.3
14
+ make
15
+ make install
16
+ cd ..
17
+ rm -rf freetds-$FREETDS_VERSION
18
+ rm freetds-$FREETDS_VERSION.tar.gz
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -x
4
+ set -e
5
+
6
+ OPENSSL_VERSION=1.0.2j
7
+
8
+ wget https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
9
+ tar -xzf openssl-$OPENSSL_VERSION.tar.gz
10
+ cd openssl-$OPENSSL_VERSION
11
+ ./config --prefix=/opt/local
12
+ make
13
+ make install
14
+ cd ..
15
+ rm -rf openssl-$OPENSSL_VERSION
16
+ rm openssl-$OPENSSL_VERSION.tar.gz
data/test/bin/setup.sh ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -x
4
+ set -e
5
+
6
+ tag=1.2
7
+
8
+ docker pull metaskills/mssql-server-linux-rails:$tag
9
+
10
+ container=$(docker ps -a -q --filter ancestor=metaskills/mssql-server-linux-rails:$tag)
11
+ if [[ -z $container ]]; then
12
+ docker run -p 1433:1433 -d metaskills/mssql-server-linux-rails:$tag && sleep 10
13
+ exit
14
+ fi
15
+
16
+ container=$(docker ps -q --filter ancestor=metaskills/mssql-server-linux-rails:$tag)
17
+ if [[ -z $container ]]; then
18
+ docker start $container && sleep 10
19
+ fi
@@ -164,4 +164,12 @@ class SpecificSchemaTestSQLServer < ActiveRecord::TestCase
164
164
  db_uuid.must_match(acceptable_uuid)
165
165
  end
166
166
 
167
+ # with similar table definition in two schemas
168
+
169
+ it 'returns the correct primary columns' do
170
+ connection = ActiveRecord::Base.connection
171
+ assert_equal 'field_1', connection.columns('test.sst_schema_test_mulitple_schema').detect(&:is_primary?).name
172
+ assert_equal 'field_2', connection.columns('test2.sst_schema_test_mulitple_schema').detect(&:is_primary?).name
173
+ end
174
+
167
175
  end
@@ -204,4 +204,20 @@ ActiveRecord::Schema.define do
204
204
  )
205
205
  NATURALPKTABLESQLINOTHERSCHEMA
206
206
 
207
+ execute "IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sst_schema_test_mulitple_schema' and TABLE_SCHEMA = 'test') DROP TABLE test.sst_schema_test_mulitple_schema"
208
+ execute <<-SCHEMATESTMULTIPLESCHEMA
209
+ CREATE TABLE test.sst_schema_test_mulitple_schema(
210
+ field_1 int NOT NULL PRIMARY KEY,
211
+ field_2 int,
212
+ )
213
+ SCHEMATESTMULTIPLESCHEMA
214
+ execute "IF NOT EXISTS(SELECT * FROM sys.schemas WHERE name = 'test2') EXEC sp_executesql N'CREATE SCHEMA test2'"
215
+ execute "IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sst_schema_test_mulitple_schema' and TABLE_SCHEMA = 'test2') DROP TABLE test2.sst_schema_test_mulitple_schema"
216
+ execute <<-SCHEMATESTMULTIPLESCHEMA
217
+ CREATE TABLE test2.sst_schema_test_mulitple_schema(
218
+ field_1 int,
219
+ field_2 int NOT NULL PRIMARY KEY,
220
+ )
221
+ SCHEMATESTMULTIPLESCHEMA
222
+
207
223
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-sqlserver-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.15
4
+ version: 4.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2016-05-30 00:00:00.000000000 Z
17
+ date: 2017-01-24 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activerecord
@@ -39,6 +39,7 @@ extensions: []
39
39
  extra_rdoc_files: []
40
40
  files:
41
41
  - ".gitignore"
42
+ - ".travis.yml"
42
43
  - CHANGELOG.md
43
44
  - CODE_OF_CONDUCT.md
44
45
  - Gemfile
@@ -50,6 +51,7 @@ files:
50
51
  - VERSION
51
52
  - activerecord-sqlserver-adapter.gemspec
52
53
  - appveyor.yml
54
+ - circle.yml
53
55
  - lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb
54
56
  - lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb
55
57
  - lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb
@@ -112,6 +114,10 @@ files:
112
114
  - lib/arel_sqlserver.rb
113
115
  - test/appveyor/dbsetup.ps1
114
116
  - test/appveyor/dbsetup.sql
117
+ - test/bin/.keep
118
+ - test/bin/install-freetds.sh
119
+ - test/bin/install-openssl.sh
120
+ - test/bin/setup.sh
115
121
  - test/cases/adapter_test_sqlserver.rb
116
122
  - test/cases/coerced_tests.rb
117
123
  - test/cases/column_test_sqlserver.rb
@@ -188,13 +194,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
194
  version: '0'
189
195
  requirements: []
190
196
  rubyforge_project:
191
- rubygems_version: 2.4.5.1
197
+ rubygems_version: 2.6.4
192
198
  signing_key:
193
199
  specification_version: 4
194
200
  summary: ActiveRecord SQL Server Adapter.
195
201
  test_files:
196
202
  - test/appveyor/dbsetup.ps1
197
203
  - test/appveyor/dbsetup.sql
204
+ - test/bin/.keep
205
+ - test/bin/install-freetds.sh
206
+ - test/bin/install-openssl.sh
207
+ - test/bin/setup.sh
198
208
  - test/cases/adapter_test_sqlserver.rb
199
209
  - test/cases/coerced_tests.rb
200
210
  - test/cases/column_test_sqlserver.rb
@@ -251,4 +261,3 @@ test_files:
251
261
  - test/support/paths_sqlserver.rb
252
262
  - test/support/rake_helpers.rb
253
263
  - test/support/sql_counter_sqlserver.rb
254
- has_rdoc: