activerecord_sqlserver_crm 4.3.0 → 5.0.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: 5632b8f45c98560b213a941945be26caf7933396
4
- data.tar.gz: 2b79f447a42186b1143f98d8e0f3e30fcba6911e
3
+ metadata.gz: fb4cd782e903ee4cd337f04794c441e3dde58bce
4
+ data.tar.gz: 3f7885b8975e84872bb1bfc91460dfd84d8b0745
5
5
  SHA512:
6
- metadata.gz: 81567aa661188bacd4765591de49261aa900c6a94c1879fe99e18cb18798365c408ca20df536c13262cf941a1b1363b508e1b1f005e9b5186d9cb567529fb23f
7
- data.tar.gz: fa2db689e0709d531eee6ce092e71a89dd7cdade0ec3e815ac2106579864128f08ffaa78a119c2ed09c648bcb404c4bfafad5be105918914c0a947ab6dc70e59
6
+ metadata.gz: 6b197031744c98bf4e907864225dcebc038a636a492630db3b72913f18d4349cb28e895af60b4023980a9e154044eef9e0861c65f4b41912b884ac8a76cfe0af
7
+ data.tar.gz: 423356df1139ead9d10ad8e93af3b3c624767e50d8d8daff568739cf99a3d33328c819a4e52af2c7a1110b6c4e526fb9cf65410cb6f28c4c576257b8816472d4
@@ -7,7 +7,7 @@ module ActiveRecord
7
7
 
8
8
  def views_real_column_name(table_name, column_name)
9
9
  view_definition = Rails.cache.fetch("sqlserver_table_view_info_#{table_name}", expires_in: SCHEMA_EXPIRES_IN) do
10
- schema_cache.view_information(table_name)[:VIEW_DEFINITION]
10
+ view_information(table_name)[:VIEW_DEFINITION]
11
11
  end
12
12
  return column_name unless view_definition
13
13
  # match_data = view_definition.match(/([\w-]*)\s+as\s+#{column_name}/im)
@@ -24,8 +24,8 @@ module ActiveRecord
24
24
  SQLServer::Utils.extract_identifiers(table_name)
25
25
  end
26
26
  database = identifier.fully_qualified_database_quoted
27
- view_exists = schema_cache.view_exists?(table_name)
28
- view_tblnm = table_name_or_views_table_name(table_name) if view_exists
27
+ view_exists = view_exists?(table_name)
28
+ view_tblnm = view_table_name(table_name) if view_exists
29
29
  sql = %{
30
30
  SELECT DISTINCT
31
31
  #{lowercase_schema_reflection_sql('columns.TABLE_NAME')} AS table_name,
@@ -35,7 +35,7 @@ module ActiveRecord
35
35
  columns.NUMERIC_SCALE AS numeric_scale,
36
36
  columns.NUMERIC_PRECISION AS numeric_precision,
37
37
  columns.DATETIME_PRECISION AS datetime_precision,
38
- columns.COLLATION_NAME AS collation,
38
+ columns.COLLATION_NAME AS [collation],
39
39
  columns.ordinal_position,
40
40
  CASE
41
41
  WHEN columns.DATA_TYPE IN ('nchar','nvarchar','char','varchar') THEN columns.CHARACTER_MAXIMUM_LENGTH
@@ -53,6 +53,7 @@ module ActiveRecord
53
53
  FROM #{database}.INFORMATION_SCHEMA.COLUMNS columns
54
54
  LEFT OUTER JOIN #{database}.INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
55
55
  ON TC.TABLE_NAME = columns.TABLE_NAME
56
+ AND TC.TABLE_SCHEMA = columns.TABLE_SCHEMA
56
57
  AND TC.CONSTRAINT_TYPE = N'PRIMARY KEY'
57
58
  LEFT OUTER JOIN #{database}.INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU
58
59
  ON KCU.COLUMN_NAME = columns.COLUMN_NAME
@@ -70,12 +71,14 @@ module ActiveRecord
70
71
  INNER JOIN #{database}.sys.columns AS c
71
72
  ON o.object_id = c.object_id
72
73
  AND c.name = columns.COLUMN_NAME
73
- WHERE columns.TABLE_NAME = @0
74
- AND columns.TABLE_SCHEMA = #{identifier.schema.blank? ? 'schema_name()' : '@1'}
74
+ WHERE columns.TABLE_NAME = #{prepared_statements ? '@0' : quote(identifier.object)}
75
+ AND columns.TABLE_SCHEMA = #{identifier.schema.blank? ? 'schema_name()' : (prepared_statements ? '@1' : quote(identifier.schema))}
75
76
  ORDER BY columns.ordinal_position
76
- }.gsub(/[ \t\r\n]+/, ' ')
77
- binds = [[info_schema_table_name_column, identifier.object]]
78
- binds << [info_schema_table_schema_column, identifier.schema] unless identifier.schema.blank?
77
+ }.gsub(/[ \t\r\n]+/, ' ').strip
78
+ binds = []
79
+ nv128 = SQLServer::Type::UnicodeVarchar.new limit: 128
80
+ binds << Relation::QueryAttribute.new('TABLE_NAME', identifier.object, nv128)
81
+ binds << Relation::QueryAttribute.new('TABLE_SCHEMA', identifier.schema, nv128) unless identifier.schema.blank?
79
82
  results = sp_executesql(sql, 'SCHEMA', binds)
80
83
  ret = results.map do |ci|
81
84
  ci = ci.symbolize_keys
@@ -142,13 +142,9 @@ unless OdataConfig.odata_config[Rails.env]['odata_enabled'] == false
142
142
  ActiveRecord::Base.send(:include, ActiveRecordExtension)
143
143
 
144
144
  # Extend belongs_to for crm_key field
145
- module BelongsToActiveRecordExtension
146
- def valid_options
147
- super + [:crm_key]
148
- end
149
- end
150
-
151
145
  class ActiveRecord::Associations::Builder::BelongsTo
152
- include ::BelongsToActiveRecordExtension
146
+ def self.valid_options(options)
147
+ super + [:polymorphic, :touch, :counter_cache, :optional, :crm_key]
148
+ end
153
149
  end
154
150
  end
@@ -1,3 +1,3 @@
1
1
  module ActiverecordSqlserverCrm
2
- VERSION = "4.3.0"
2
+ VERSION = "5.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_sqlserver_crm
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rolf Lawrenz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-15 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,60 +16,60 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 4.2.6
22
+ version: 5.0.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '5.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 4.2.6
32
+ version: 5.0.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activerecord-sqlserver-adapter
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '4.2'
39
+ version: '5.0'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 4.2.15
42
+ version: 5.0.5
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '4.2'
49
+ version: '5.0'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 4.2.15
52
+ version: 5.0.5
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: tiny_tds
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.0'
59
+ version: '1.1'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.0.4
62
+ version: 1.1.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.0'
69
+ version: '1.1'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.0.4
72
+ version: 1.1.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: typhoeus
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,7 @@ dependencies:
79
79
  version: '1.1'
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.1.0
82
+ version: 1.1.2
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,21 +89,21 @@ dependencies:
89
89
  version: '1.1'
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 1.1.0
92
+ version: 1.1.2
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rspec-rails
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '3.4'
99
+ version: 3.5.2
100
100
  type: :development
101
101
  prerelease: false
102
102
  version_requirements: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - "~>"
105
105
  - !ruby/object:Gem::Version
106
- version: '3.4'
106
+ version: 3.5.2
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: byebug
109
109
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +113,7 @@ dependencies:
113
113
  version: '9.0'
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: 9.0.5
116
+ version: 9.0.6
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,7 +123,7 @@ dependencies:
123
123
  version: '9.0'
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: 9.0.5
126
+ version: 9.0.6
127
127
  description: A rails engine that uses ActiveRecord SQL Server to read from CRM SQL
128
128
  Server, and OData to write to CRM.
129
129
  email: