activerecord-sqlserver-adapter 2.2.19 → 2.2.20
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -1,6 +1,25 @@
|
|
1
1
|
|
2
2
|
MASTER
|
3
3
|
|
4
|
+
*
|
5
|
+
|
6
|
+
|
7
|
+
* 2.2.20 * (September 10th, 2009)
|
8
|
+
|
9
|
+
* Implement a new remove_default_constraint method that uses sp_helpconstraint [Ken Collins]
|
10
|
+
|
11
|
+
* Use a lazy match in add_order_by_for_association_limiting! to allow sub selects to be used. Resolves
|
12
|
+
ticket #11.
|
13
|
+
|
14
|
+
* Add default rake task back for testing. Runs the namespaced sqlserver:test_sqlserver_odbc.
|
15
|
+
Resolves ticket #10 [Ken Collins]
|
16
|
+
|
17
|
+
* Default value detection in column_definitions is kinder to badly formatted, or long winded user
|
18
|
+
defined functions, for default values. Resolves ticket #8 [Ken Collins]
|
19
|
+
|
20
|
+
* Make sure bigint SQL Server data type can be used and converted back to Bignum as expected. [Ken Collins]
|
21
|
+
|
22
|
+
|
4
23
|
* 2.2.19 * (June 19th, 2009)
|
5
24
|
|
6
25
|
* Leave quoted column names as is. Resolves ticket #36 [Vince Puzzella]
|
data/RUNNING_UNIT_TESTS
CHANGED
@@ -5,12 +5,19 @@ The default names for the test databases are "activerecord_unittest" and
|
|
5
5
|
to update the connection adapter setups you want to test with in
|
6
6
|
test/connections/<your database>/connection.rb.
|
7
7
|
|
8
|
+
The connection files make certain assumptions. For instance, the ODBC connection
|
9
|
+
assumes you have a DSN setup that matches the name of the default database names.
|
10
|
+
|
8
11
|
|
9
12
|
== Requirements
|
10
13
|
|
11
14
|
The following gems need to be installed. Make sure you have gems.github.com as a
|
12
|
-
source. http://github.com/
|
15
|
+
source. Info here. http://gems.github.com/
|
16
|
+
|
17
|
+
We use echoe for packagemanagement to rubyforge. Not needed really for the tests
|
18
|
+
but since we need it... you need to install it.
|
13
19
|
|
20
|
+
* gem install echoe
|
14
21
|
* gem install thoughtbot-shoulda -s http://gems.github.com
|
15
22
|
* gem install mocha
|
16
23
|
|
@@ -21,11 +28,8 @@ is assumed to exist:
|
|
21
28
|
#{RAILS_ROOT}/vendor/plugins/adapters/sqlserver
|
22
29
|
#{RAILS_ROOT}/vendor/rails/activerecord/test
|
23
30
|
|
24
|
-
Define a user named 'rails' in SQL Server with all privileges granted
|
25
|
-
|
26
|
-
which allows you to set a default password for the current session.
|
27
|
-
|
28
|
-
Then run "rake create_databases".
|
31
|
+
Define a user named 'rails' in SQL Server with all privileges granted for the
|
32
|
+
test databases. Use an empty password for said user.
|
29
33
|
|
30
34
|
|
31
35
|
== Running with Rake
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rake'
|
|
3
3
|
require 'rake/testtask'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
|
-
Echoe.new('activerecord-sqlserver-adapter','2.2.
|
6
|
+
Echoe.new('activerecord-sqlserver-adapter','2.2.20') do |p|
|
7
7
|
p.summary = "SQL Server 2000, 2005 and 2008 Adapter For Rails."
|
8
8
|
p.description = "SQL Server 2000, 2005 and 2008 Adapter For Rails."
|
9
9
|
p.author = ["Ken Collins","Murray Steele","Shawn Balestracci","Joe Rafaniello","Tom Ward"]
|
@@ -183,7 +183,7 @@ module ActiveRecord
|
|
183
183
|
class SQLServerAdapter < AbstractAdapter
|
184
184
|
|
185
185
|
ADAPTER_NAME = 'SQLServer'.freeze
|
186
|
-
VERSION = '2.2.
|
186
|
+
VERSION = '2.2.20'.freeze
|
187
187
|
DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+(\d{4})/
|
188
188
|
SUPPORTED_VERSIONS = [2000,2005,2008].freeze
|
189
189
|
LIMITABLE_TYPES = ['string','integer','float','char','nchar','varchar','nvarchar'].freeze
|
@@ -698,7 +698,7 @@ module ActiveRecord
|
|
698
698
|
# Disertation http://gist.github.com/24073
|
699
699
|
# Information http://weblogs.sqlteam.com/jeffs/archive/2007/12/13/select-distinct-order-by-error.aspx
|
700
700
|
return sql if options[:order].blank?
|
701
|
-
columns = sql.match(/SELECT\s+DISTINCT(
|
701
|
+
columns = sql.match(/SELECT\s+DISTINCT(.*?)FROM/)[1].strip
|
702
702
|
sql.sub!(/SELECT\s+DISTINCT/,'SELECT')
|
703
703
|
sql << "GROUP BY #{columns} ORDER BY #{order_to_min_set(options[:order])}"
|
704
704
|
end
|
@@ -908,9 +908,10 @@ module ActiveRecord
|
|
908
908
|
end
|
909
909
|
|
910
910
|
def remove_default_constraint(table_name, column_name)
|
911
|
-
|
912
|
-
|
913
|
-
|
911
|
+
select_all("EXEC sp_helpconstraint '#{quote_string(table_name)}','nomsg'").select do |row|
|
912
|
+
row['constraint_type'] == "DEFAULT on column #{column_name}"
|
913
|
+
end.each do |row|
|
914
|
+
do_execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{row['constraint_name']}"
|
914
915
|
end
|
915
916
|
end
|
916
917
|
|
@@ -1081,7 +1082,8 @@ module ActiveRecord
|
|
1081
1082
|
when nil, '(null)', '(NULL)'
|
1082
1083
|
nil
|
1083
1084
|
else
|
1084
|
-
ci[:default_value].match(/\A\(+N?'?(.*?)'?\)+\Z/)
|
1085
|
+
match_data = ci[:default_value].match(/\A\(+N?'?(.*?)'?\)+\Z/)
|
1086
|
+
match_data ? match_data[1] : nil
|
1085
1087
|
end
|
1086
1088
|
ci[:null] = ci[:is_nullable].to_i == 1 ; ci.delete(:is_nullable)
|
1087
1089
|
ci
|
data/tasks/sqlserver.rake
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
|
2
|
+
|
2
3
|
namespace :sqlserver do
|
3
4
|
|
4
5
|
['sqlserver','sqlserver_odbc'].each do |adapter|
|
@@ -29,3 +30,10 @@ namespace :sqlserver do
|
|
29
30
|
|
30
31
|
end
|
31
32
|
|
33
|
+
|
34
|
+
desc 'Test the default ODBC mode, taks sqlserver:test_sqlserver_odbc.'
|
35
|
+
task :test do
|
36
|
+
test = Rake::Task['sqlserver:test_sqlserver_odbc']
|
37
|
+
test.invoke
|
38
|
+
end
|
39
|
+
|
@@ -50,7 +50,24 @@ class SpecificSchemaTestSqlserver < ActiveRecord::TestCase
|
|
50
50
|
|
51
51
|
end
|
52
52
|
|
53
|
+
context 'with bigint column' do
|
53
54
|
|
55
|
+
setup do
|
56
|
+
@b5k = 5000
|
57
|
+
@bi5k = @edge_class.create! :bigint => @b5k, :description => 'Five Thousand'
|
58
|
+
@bnum = 9_000_000_000_000_000_000
|
59
|
+
@bimjr = @edge_class.create! :bigint => @bnum, :description => 'Close to max bignum'
|
60
|
+
end
|
61
|
+
|
62
|
+
should 'can find by biginit' do
|
63
|
+
assert_equal @bi5k, @edge_class.find_by_bigint(@b5k)
|
64
|
+
assert_equal @b5k, @edge_class.find(:first, :select => 'bigint', :conditions => {:bigint => @b5k}).bigint
|
65
|
+
assert_equal @bimjr, @edge_class.find_by_bigint(@bnum)
|
66
|
+
assert_equal @bnum, @edge_class.find(:first, :select => 'bigint', :conditions => {:bigint => @bnum}).bigint
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
54
71
|
end
|
55
72
|
|
56
73
|
|
@@ -64,6 +64,7 @@ ActiveRecord::Schema.define do
|
|
64
64
|
|
65
65
|
create_table :sql_server_edge_schemas, :force => true do |t|
|
66
66
|
t.string :description
|
67
|
+
t.column :bigint, :bigint
|
67
68
|
end
|
68
69
|
|
69
70
|
execute "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'customers_view') DROP VIEW customers_view"
|
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: 2.2.
|
4
|
+
version: 2.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins, Murray Steele, Shawn Balestracci, Joe Rafaniello, Tom Ward
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-10 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,8 @@ files:
|
|
85
85
|
- test/schema/sqlserver_specific_schema.rb
|
86
86
|
has_rdoc: true
|
87
87
|
homepage: http://github.com/rails-sqlserver
|
88
|
+
licenses: []
|
89
|
+
|
88
90
|
post_install_message:
|
89
91
|
rdoc_options:
|
90
92
|
- --line-numbers
|
@@ -110,9 +112,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
112
|
requirements: []
|
111
113
|
|
112
114
|
rubyforge_project: arsqlserver
|
113
|
-
rubygems_version: 1.3.
|
115
|
+
rubygems_version: 1.3.4
|
114
116
|
signing_key:
|
115
|
-
specification_version:
|
117
|
+
specification_version: 3
|
116
118
|
summary: SQL Server 2000, 2005 and 2008 Adapter For Rails.
|
117
119
|
test_files: []
|
118
120
|
|