rails-sqlserver-2000-2005-adapter 2.2.11 → 2.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,7 +1,12 @@
1
1
 
2
2
  MASTER
3
3
 
4
- *
4
+ *
5
+
6
+
7
+ * 2.2.12 * (February 8th, 2009)
8
+
9
+ * Update table_exists? to work with qualified table names that may include an user prefix. [Ken Collins]
5
10
 
6
11
 
7
12
  * 2.2.10/11 * (January 22nd, 2009)
@@ -83,7 +88,7 @@ MASTER
83
88
  will run quickly. [Ken Collins]
84
89
 
85
90
  * Add views support. ActiveRecord classes can use views. The connection now has a #views method and
86
- #table_exists? will not fall back to checking views too. [Ken Collins]
91
+ #table_exists? will now fall back to checking views too. [Ken Collins]
87
92
 
88
93
 
89
94
  2.2.0 (November 21st, 2008)
@@ -150,7 +150,7 @@ module ActiveRecord
150
150
  class SQLServerAdapter < AbstractAdapter
151
151
 
152
152
  ADAPTER_NAME = 'SQLServer'.freeze
153
- VERSION = '2.2.11'.freeze
153
+ VERSION = '2.2.12'.freeze
154
154
  DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+(\d{4})/
155
155
  SUPPORTED_VERSIONS = [2000,2005].freeze
156
156
  LIMITABLE_TYPES = ['string','integer','float','char','nchar','varchar','nvarchar'].freeze
@@ -497,7 +497,7 @@ module ActiveRecord
497
497
  end
498
498
 
499
499
  def table_exists?(table_name)
500
- super || views.include?(table_name.to_s)
500
+ super || tables.include?(unqualify_table_name(table_name)) || views.include?(table_name.to_s)
501
501
  end
502
502
 
503
503
  def indexes(table_name, name = nil)
@@ -39,6 +39,17 @@ class AdapterTestSqlserver < ActiveRecord::TestCase
39
39
  assert @connection.supports_ddl_transactions?
40
40
  end
41
41
 
42
+ should 'allow owner table name prefixs like dbo. to still allow table_exists? to return true' do
43
+ begin
44
+ assert_equal 'tasks', Task.table_name
45
+ assert Task.table_exists?
46
+ Task.table_name = 'dbo.tasks'
47
+ assert Task.table_exists?, 'Tasks table name of dbo.tasks should return true for exists.'
48
+ ensure
49
+ Task.table_name = 'tasks'
50
+ end
51
+ end
52
+
42
53
  context 'for database version' do
43
54
 
44
55
  setup do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-sqlserver-2000-2005-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.11
4
+ version: 2.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2009-01-22 00:00:00 -08:00
16
+ date: 2009-02-08 00:00:00 -08:00
17
17
  default_executable:
18
18
  dependencies: []
19
19