@@ -51,8 +51,8 @@ def self.sqlserver_connection(config) #:nodoc:
5151 conn [ "AutoCommit" ] = autocommit
5252 ConnectionAdapters ::SQLServerAdapter . new ( conn , logger , [ driver_url , username , password ] )
5353 end
54-
55-
54+
55+
5656 private
5757
5858 # Overwrite the ActiveRecord::Base method for SQL server.
@@ -62,7 +62,7 @@ def self.construct_finder_sql_for_association_limiting(options, join_dependency)
6262 is_distinct = !options [ :joins ] . blank? || include_eager_conditions? ( options ) || include_eager_order? ( options )
6363
6464 sql = "SELECT #{ table_name } .#{ connection . quote_column_name ( primary_key ) } FROM #{ table_name } "
65-
65+
6666 if is_distinct
6767 sql << join_dependency . join_associations . collect ( &:association_join ) . join
6868 add_joins! ( sql , options [ :joins ] , scope )
@@ -75,7 +75,7 @@ def self.construct_finder_sql_for_association_limiting(options, join_dependency)
7575 if sql =~ /GROUP\s +BY/i
7676 sql << ", #{ table_name } .#{ connection . quote_column_name ( primary_key ) } "
7777 else
78- sql << " GROUP BY #{ table_name } .#{ connection . quote_column_name ( primary_key ) } "
78+ sql << " GROUP BY #{ table_name } .#{ connection . quote_column_name ( primary_key ) } "
7979 end #if sql =~ /GROUP BY/i
8080
8181 connection . add_order_by_for_association_limiting! ( sql , options )
@@ -87,7 +87,6 @@ def self.construct_finder_sql_for_association_limiting(options, join_dependency)
8787
8888 return sanitize_sql ( sql )
8989 end
90-
9190 end # class Base
9291
9392 module ConnectionAdapters
@@ -100,7 +99,7 @@ def initialize(info)
10099 else
101100 type = "#{ info [ :type ] } (#{ info [ :length ] } )"
102101 end
103- super ( info [ :name ] , info [ :default_value ] , type , info [ :is_nullable ] ) == 1
102+ super ( info [ :name ] , info [ :default_value ] , type , info [ :is_nullable ] == 1 )
104103 @identity = info [ :is_identity ]
105104 @is_special = [ "text" , "ntext" , "image" ] . include? ( info [ :type ] )
106105 @is_utf8 = type =~ /nvarchar|ntext/i
@@ -200,8 +199,8 @@ def new_time(year, mon, mday, hour, min, sec, microsec = 0)
200199 return nil if year . nil? || year == 0
201200 Time . time_with_datetime_fallback ( Base . default_timezone , year , mon , mday , hour , min , sec , microsec ) rescue nil
202201 end
203- end #class << self
204- end #SQLServerColumn
202+ end
203+ end
205204
206205 # In ADO mode, this adapter will ONLY work on Windows systems,
207206 # since it relies on Win32OLE, which, to my knowledge, is only
@@ -521,7 +520,7 @@ def add_limit_offset!(sql, options)
521520 #if sql =~ /\.\[/ and tc =~ /\./ # if column quoting used in query
522521 # tc.gsub!(/\./, '\\.\\[')
523522 # tc << '\\]'
524- #end
523+ #end
525524 if sql =~ /#{ Regexp . escape ( tc ) } AS (t\d _r\d \d ?)/
526525 parts [ 0 ] = $1
527526 elsif parts [ 0 ] =~ /\w +\. \[ ?(\w +)\] ?/
@@ -539,7 +538,7 @@ def add_limit_offset!(sql, options)
539538 end unless options [ :limit ] . nil? || options [ :limit ] < 1
540539 end
541540 end #add_limit_offset!(sql, options)
542-
541+
543542 def add_order_by_for_association_limiting! ( sql , options )
544543 return sql if options [ :order ] . blank?
545544
@@ -577,7 +576,7 @@ def recreate_database(name)
577576 def drop_database ( name )
578577 execute "DROP DATABASE #{ name } "
579578 end
580-
579+
581580 # Clear the given table and reset the table's id to 1
582581 # Argument:
583582 # +table_name+:: (String) Name of the table to be cleared and reset
@@ -787,7 +786,7 @@ def repair_special_columns(sql)
787786 end
788787 sql
789788 end
790-
789+
791790 def get_utf8_columns ( table_name )
792791 utf8 = [ ]
793792 @table_columns ||= [ ]
@@ -797,10 +796,10 @@ def get_utf8_columns(table_name)
797796 end
798797 utf8
799798 end
800-
799+
801800 def set_utf8_values! ( sql )
802801 utf8_cols = get_utf8_columns ( get_table_name ( sql ) )
803- if sql =~ /^\s *UPDATE/i
802+ if sql =~ /^\s *UPDATE/i
804803 utf8_cols . each do |col |
805804 sql . gsub! ( "[#{ col . to_s } ] = '" , "[#{ col . to_s } ] = N'" )
806805 end
0 commit comments