rails-sqlserver-2000-2005-adapter 2.2.3 → 2.2.4

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
@@ -4,6 +4,11 @@ MASTER
4
4
  *
5
5
 
6
6
 
7
+ * 2.2.4 (December 5th, 2008)
8
+
9
+ * Fix a type left in #views_real_column_name. Also cache #view_information lookups. [Ken Collins]
10
+
11
+
7
12
  * 2.2.3 (December 5th, 2008)
8
13
 
9
14
  * Changing back to using real table name in column_definitions. Makes sure views get back only the columns
@@ -150,7 +150,7 @@ module ActiveRecord
150
150
  class SQLServerAdapter < AbstractAdapter
151
151
 
152
152
  ADAPTER_NAME = 'SQLServer'.freeze
153
- VERSION = '2.2.3'.freeze
153
+ VERSION = '2.2.4'.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
@@ -458,7 +458,8 @@ module ActiveRecord
458
458
 
459
459
  def view_information(table_name)
460
460
  table_name = unqualify_table_name(table_name)
461
- select_one "SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = '#{table_name}'"
461
+ @sqlserver_view_information_cache[table_name] ||=
462
+ select_one "SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = '#{table_name}'"
462
463
  end
463
464
 
464
465
  def view_table_name(table_name)
@@ -830,7 +831,7 @@ module ActiveRecord
830
831
 
831
832
  def views_real_column_name(table_name,column_name)
832
833
  view_definition = view_information(table_name)['VIEW_DEFINITION']
833
- match_data = view_definition.match(/([\w-]*)\s+as\s+pretend_null/im)
834
+ match_data = view_definition.match(/([\w-]*)\s+as\s+#{column_name}/im)
834
835
  match_data ? match_data[1] : column_name
835
836
  end
836
837
 
@@ -857,6 +858,7 @@ module ActiveRecord
857
858
  def initialize_sqlserver_caches(reset_columns=true)
858
859
  @sqlserver_columns_cache = {} if reset_columns
859
860
  @sqlserver_views_cache = nil
861
+ @sqlserver_view_information_cache = {}
860
862
  end
861
863
 
862
864
  def column_definitions(table_name)
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.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins