Permalink
Browse files

Update #indexes to use unqualified table name. Fixes cases where user…

…s may decide to use table name prefixes like 'dbo.'. Move to version 2.2.13
  • Loading branch information...
1 parent bd09d0f commit e319916b5a78153b2b64f20744ee420b590e3bad @metaskills metaskills committed Feb 10, 2009
Showing with 10 additions and 3 deletions.
  1. +1 −1 2000-2005-adapter.gemspec
  2. +6 −0 CHANGELOG
  3. +3 −2 lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "2000-2005-adapter"
- s.version = "2.2.12"
+ s.version = "2.2.13"
s.date = "2009-02-08"
s.summary = "SQL Server 2000 & 2005 Adapter For Rails."
s.email = "ken@metaskills.net"
View
@@ -4,6 +4,12 @@ MASTER
*
+* 2.2.13 * (February 10th, 2009)
+
+* Update #indexes to use unqualified table name. Fixes cases where users may decide to use table
+ name prefixes like 'dbo.'. [Ken Collins]
+
+
* 2.2.12 * (February 8th, 2009)
* Update table_exists? to work with qualified table names that may include an user prefix. [Ken Collins]
@@ -150,7 +150,7 @@ def simplified_datetime
class SQLServerAdapter < AbstractAdapter
ADAPTER_NAME = 'SQLServer'.freeze
- VERSION = '2.2.12'.freeze
+ VERSION = '2.2.13'.freeze
DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+(\d{4})/
SUPPORTED_VERSIONS = [2000,2005].freeze
LIMITABLE_TYPES = ['string','integer','float','char','nchar','varchar','nvarchar'].freeze
@@ -501,7 +501,8 @@ def table_exists?(table_name)
end
def indexes(table_name, name = nil)
- select("EXEC sp_helpindex #{quote_table_name(table_name)}",name).inject([]) do |indexes,index|
+ unquoted_table_name = unqualify_table_name(table_name)
+ select("EXEC sp_helpindex #{quote_table_name(unquoted_table_name)}",name).inject([]) do |indexes,index|
if index['index_description'] =~ /primary key/
indexes
else

0 comments on commit e319916

Please sign in to comment.