activerecord-sqlserver-adapter 3.2.8 → 3.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -1
- data/VERSION +1 -1
- data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +1 -1
- data/lib/active_record/connection_adapters/sqlserver/core_ext/relation.rb +19 -0
- data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +5 -1
- data/lib/active_record/connection_adapters/sqlserver/quoting.rb +1 -1
- data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +1 -1
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +1 -0
- metadata +5 -4
data/CHANGELOG
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
|
2
|
+
* 3.2.9 *
|
3
|
+
|
4
|
+
* The #remove_default_constraint uses #execute_procedure now. Fixes #223. Thanks @gicappa and @clintmiller.
|
5
|
+
* Mimic other adapters quoting for empty strings passed to integer columns. Fixes #164.
|
6
|
+
* Allow named parameters in stored procedures. Fixes #216. Thanks @sixfeetover.
|
7
|
+
* Make sure exclude [__rnt] table names form relation reflection. Fixes #219 and #221. Thanks @sphogan.
|
8
|
+
|
9
|
+
|
2
10
|
* 3.2.8 *
|
3
11
|
|
4
|
-
Include VERSION in gemspec's files.
|
12
|
+
* Include VERSION in gemspec's files.
|
5
13
|
|
6
14
|
|
7
15
|
* 3.2.7 *
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.9
|
@@ -23,7 +23,7 @@ module ActiveRecord
|
|
23
23
|
executesql_args = executesql.split(', ')
|
24
24
|
found_args = executesql_args.reject! { |arg| arg =~ SQLSERVER_PARAM_MATCHER }
|
25
25
|
executesql_args.pop if found_args && executesql_args.many?
|
26
|
-
executesql = executesql_args.join(', ').strip.match(/N'(.*)'/)[1]
|
26
|
+
executesql = executesql_args.join(', ').strip.match(/N'(.*)'/m)[1]
|
27
27
|
Utils.unquote_string(executesql)
|
28
28
|
else
|
29
29
|
sql
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
module Sqlserver
|
4
|
+
module CoreExt
|
5
|
+
module Relation
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def tables_in_string(string)
|
10
|
+
super - ['__rnt']
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ActiveRecord::Relation.send :include, ActiveRecord::ConnectionAdapters::Sqlserver::CoreExt::Relation
|
@@ -93,7 +93,11 @@ module ActiveRecord
|
|
93
93
|
# === SQLServer Specific ======================================== #
|
94
94
|
|
95
95
|
def execute_procedure(proc_name, *variables)
|
96
|
-
vars = variables.
|
96
|
+
vars = if variables.any? && variables.first.is_a?(Hash)
|
97
|
+
variables.first.map { |k,v| "@#{k} = #{quote(v)}" }
|
98
|
+
else
|
99
|
+
variables.map { |v| quote(v) }
|
100
|
+
end.join(', ')
|
97
101
|
sql = "EXEC #{proc_name} #{vars}".strip
|
98
102
|
name = 'Execute Procedure'
|
99
103
|
log(sql, name) do
|
@@ -10,7 +10,7 @@ module ActiveRecord
|
|
10
10
|
case value
|
11
11
|
when String, ActiveSupport::Multibyte::Chars
|
12
12
|
if column && column.type == :integer && value.blank?
|
13
|
-
|
13
|
+
value.to_i.to_s
|
14
14
|
elsif column && column.type == :binary
|
15
15
|
column.class.string_to_binary(value)
|
16
16
|
elsif value.is_utf8? || (column && column.type == :string)
|
@@ -250,7 +250,7 @@ module ActiveRecord
|
|
250
250
|
|
251
251
|
def remove_default_constraint(table_name, column_name)
|
252
252
|
# If their are foreign keys in this table, we could still get back a 2D array, so flatten just in case.
|
253
|
-
|
253
|
+
execute_procedure(:sp_helpconstraint, table_name, 'nomsg').flatten.select do |row|
|
254
254
|
row['constraint_type'] == "DEFAULT on column #{column_name}"
|
255
255
|
end.each do |row|
|
256
256
|
do_execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{row['constraint_name']}"
|
@@ -8,6 +8,7 @@ require 'active_record/connection_adapters/abstract_adapter'
|
|
8
8
|
require 'active_record/connection_adapters/sqlserver/core_ext/active_record'
|
9
9
|
require 'active_record/connection_adapters/sqlserver/core_ext/database_statements'
|
10
10
|
require 'active_record/connection_adapters/sqlserver/core_ext/explain'
|
11
|
+
require 'active_record/connection_adapters/sqlserver/core_ext/relation'
|
11
12
|
require 'active_record/connection_adapters/sqlserver/database_limits'
|
12
13
|
require 'active_record/connection_adapters/sqlserver/database_statements'
|
13
14
|
require 'active_record/connection_adapters/sqlserver/errors'
|
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: 3.2.
|
4
|
+
version: 3.2.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,11 +13,11 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2012-
|
16
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: activerecord
|
20
|
-
requirement: &
|
20
|
+
requirement: &70115456563760 !ruby/object:Gem::Requirement
|
21
21
|
none: false
|
22
22
|
requirements:
|
23
23
|
- - ~>
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
version: 3.2.0
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
|
-
version_requirements: *
|
28
|
+
version_requirements: *70115456563760
|
29
29
|
description: SQL Server 2005 and 2008 Adapter For ActiveRecord
|
30
30
|
email: ken@metaskills.net
|
31
31
|
executables: []
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/active_record/connection_adapters/sqlserver/core_ext/database_statements.rb
|
40
40
|
- lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb
|
41
41
|
- lib/active_record/connection_adapters/sqlserver/core_ext/odbc.rb
|
42
|
+
- lib/active_record/connection_adapters/sqlserver/core_ext/relation.rb
|
42
43
|
- lib/active_record/connection_adapters/sqlserver/database_limits.rb
|
43
44
|
- lib/active_record/connection_adapters/sqlserver/database_statements.rb
|
44
45
|
- lib/active_record/connection_adapters/sqlserver/errors.rb
|