activerecord-sqlserver-adapter 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
|
2
|
+
* 3.2.2 *
|
3
|
+
|
4
|
+
* Fixes all known issues with cross database schema reflection. Fixes #185 [Chris Altman]
|
5
|
+
|
6
|
+
* Fix exists? with offset by patching visitor. Fixes #171 and Fixes #167
|
7
|
+
|
8
|
+
* Set default text size to 2147483647 for TinyTDS connections. Fixes #181
|
9
|
+
|
10
|
+
* Set @config ivar for 3rd party libs. Fixes #177
|
11
|
+
|
12
|
+
* Make #sql_type_for_statement work for integers that may have empty parens or none at all. Fixes #175
|
13
|
+
|
14
|
+
|
2
15
|
* 3.2.1 *
|
3
16
|
|
4
17
|
* Add explicit order-by clause for windowed results. Fixes #161.
|
@@ -165,7 +165,7 @@ module ActiveRecord
|
|
165
165
|
columns.ordinal_position,
|
166
166
|
CASE
|
167
167
|
WHEN columns.DATA_TYPE IN ('nchar','nvarchar') THEN columns.CHARACTER_MAXIMUM_LENGTH
|
168
|
-
ELSE COL_LENGTH(columns.TABLE_SCHEMA+'.'+columns.TABLE_NAME, columns.COLUMN_NAME)
|
168
|
+
ELSE COL_LENGTH('#{db_name_with_period}'+columns.TABLE_SCHEMA+'.'+columns.TABLE_NAME, columns.COLUMN_NAME)
|
169
169
|
END AS [length],
|
170
170
|
CASE
|
171
171
|
WHEN columns.IS_NULLABLE = 'YES' THEN 1
|
@@ -175,19 +175,27 @@ module ActiveRecord
|
|
175
175
|
WHEN KCU.COLUMN_NAME IS NOT NULL AND TC.CONSTRAINT_TYPE = N'PRIMARY KEY' THEN 1
|
176
176
|
ELSE NULL
|
177
177
|
END AS [is_primary],
|
178
|
-
|
179
|
-
WHEN COLUMNPROPERTY(OBJECT_ID(columns.TABLE_SCHEMA+'.'+columns.TABLE_NAME), columns.COLUMN_NAME, 'IsIdentity') = 1 THEN 1
|
180
|
-
ELSE NULL
|
181
|
-
END AS [is_identity]
|
178
|
+
c.is_identity AS [is_identity]
|
182
179
|
FROM #{db_name_with_period}INFORMATION_SCHEMA.COLUMNS columns
|
183
|
-
LEFT OUTER JOIN #{db_name_with_period}INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
|
184
|
-
ON TC.TABLE_NAME = columns.TABLE_NAME
|
185
|
-
AND TC.CONSTRAINT_TYPE = N'PRIMARY KEY'
|
180
|
+
LEFT OUTER JOIN #{db_name_with_period}INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
|
181
|
+
ON TC.TABLE_NAME = columns.TABLE_NAME
|
182
|
+
AND TC.CONSTRAINT_TYPE = N'PRIMARY KEY'
|
186
183
|
LEFT OUTER JOIN #{db_name_with_period}INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU
|
187
184
|
ON KCU.COLUMN_NAME = columns.COLUMN_NAME
|
188
185
|
AND KCU.CONSTRAINT_NAME = TC.CONSTRAINT_NAME
|
189
186
|
AND KCU.CONSTRAINT_CATALOG = TC.CONSTRAINT_CATALOG
|
190
187
|
AND KCU.CONSTRAINT_SCHEMA = TC.CONSTRAINT_SCHEMA
|
188
|
+
INNER JOIN #{db_name_with_period}.sys.schemas AS s
|
189
|
+
ON s.name = columns.TABLE_SCHEMA
|
190
|
+
AND s.schema_id = s.schema_id
|
191
|
+
INNER JOIN #{db_name_with_period}.sys.objects AS o
|
192
|
+
ON s.schema_id = o.schema_id
|
193
|
+
AND o.is_ms_shipped = 0
|
194
|
+
AND o.type IN ('U', 'V')
|
195
|
+
AND o.name = columns.TABLE_NAME
|
196
|
+
INNER JOIN #{db_name_with_period}.sys.columns AS c
|
197
|
+
ON o.object_id = c.object_id
|
198
|
+
AND c.name = columns.COLUMN_NAME
|
191
199
|
WHERE columns.TABLE_NAME = @0
|
192
200
|
AND columns.TABLE_SCHEMA = #{table_schema.blank? ? "schema_name()" : "@1"}
|
193
201
|
ORDER BY columns.ordinal_position
|
@@ -227,7 +235,6 @@ module ActiveRecord
|
|
227
235
|
end
|
228
236
|
ci[:null] = ci[:is_nullable].to_i == 1 ; ci.delete(:is_nullable)
|
229
237
|
ci[:is_primary] = ci[:is_primary].to_i == 1
|
230
|
-
ci[:is_identity] = ci[:is_identity].to_i == 1
|
231
238
|
ci
|
232
239
|
end
|
233
240
|
end
|
@@ -96,7 +96,7 @@ module ActiveRecord
|
|
96
96
|
|
97
97
|
def sql_type_for_statement
|
98
98
|
if is_integer? || is_real?
|
99
|
-
sql_type.sub(/\(\d
|
99
|
+
sql_type.sub(/\((\d+)?\)/,'')
|
100
100
|
else
|
101
101
|
sql_type
|
102
102
|
end
|
@@ -199,6 +199,7 @@ module ActiveRecord
|
|
199
199
|
@schema_cache = Sqlserver::SchemaCache.new self
|
200
200
|
@visitor = Arel::Visitors::SQLServer.new self
|
201
201
|
# Our Responsibility
|
202
|
+
@config = config
|
202
203
|
@connection_options = config
|
203
204
|
connect
|
204
205
|
@database_version = select_value 'SELECT @@version', 'SCHEMA'
|
@@ -438,6 +439,7 @@ module ActiveRecord
|
|
438
439
|
client.execute("SET CURSOR_CLOSE_ON_COMMIT OFF").do
|
439
440
|
client.execute("SET IMPLICIT_TRANSACTIONS OFF").do
|
440
441
|
end
|
442
|
+
client.execute("SET TEXTSIZE 2147483647").do
|
441
443
|
end
|
442
444
|
when :odbc
|
443
445
|
if config[:dsn].include?(';')
|
@@ -156,7 +156,7 @@ module Arel
|
|
156
156
|
[ ("SELECT" if !windowed),
|
157
157
|
(visit(core.set_quantifier) if core.set_quantifier),
|
158
158
|
(visit(o.limit) if o.limit && !windowed),
|
159
|
-
(projections.map{ |x| visit(x) }.join(', ')),
|
159
|
+
(projections.map{ |x| v = visit(x); v == "1" ? "1 AS [__wrp]" : v }.join(', ')),
|
160
160
|
(source_with_lock_for_select_statement(o)),
|
161
161
|
("WHERE #{core.wheres.map{ |x| visit(x) }.join ' AND ' }" unless core.wheres.empty?),
|
162
162
|
("GROUP BY #{groups.map { |x| visit x }.join ', ' }" unless groups.empty?),
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-sqlserver-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 2
|
10
|
+
version: 3.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ken Collins
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-
|
22
|
+
date: 2012-04-13 00:00:00 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: activerecord
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements: []
|
96
96
|
|
97
97
|
rubyforge_project: activerecord-sqlserver-adapter
|
98
|
-
rubygems_version: 1.8.
|
98
|
+
rubygems_version: 1.8.17
|
99
99
|
signing_key:
|
100
100
|
specification_version: 3
|
101
101
|
summary: SQL Server 2005 and 2008 Adapter For ActiveRecord.
|