activerecord-sqlserver-adapter 6.0.0.rc1 → 6.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +29 -0
  4. data/CHANGELOG.md +20 -0
  5. data/Gemfile +11 -5
  6. data/Guardfile +9 -8
  7. data/Rakefile +12 -16
  8. data/VERSION +1 -1
  9. data/activerecord-sqlserver-adapter.gemspec +3 -3
  10. data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +0 -4
  11. data/lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb +1 -4
  12. data/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +3 -4
  13. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +1 -3
  14. data/lib/active_record/connection_adapters/sqlserver/core_ext/finder_methods.rb +2 -3
  15. data/lib/active_record/connection_adapters/sqlserver/core_ext/query_methods.rb +2 -3
  16. data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +35 -32
  17. data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +7 -12
  18. data/lib/active_record/connection_adapters/sqlserver/errors.rb +0 -3
  19. data/lib/active_record/connection_adapters/sqlserver/quoting.rb +8 -8
  20. data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +0 -2
  21. data/lib/active_record/connection_adapters/sqlserver/schema_dumper.rb +7 -7
  22. data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +106 -103
  23. data/lib/active_record/connection_adapters/sqlserver/showplan.rb +6 -8
  24. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +2 -2
  25. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +1 -1
  26. data/lib/active_record/connection_adapters/sqlserver/sql_type_metadata.rb +0 -2
  27. data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +1 -4
  28. data/lib/active_record/connection_adapters/sqlserver/transaction.rb +4 -8
  29. data/lib/active_record/connection_adapters/sqlserver/type.rb +35 -35
  30. data/lib/active_record/connection_adapters/sqlserver/type/big_integer.rb +0 -2
  31. data/lib/active_record/connection_adapters/sqlserver/type/binary.rb +0 -2
  32. data/lib/active_record/connection_adapters/sqlserver/type/boolean.rb +0 -2
  33. data/lib/active_record/connection_adapters/sqlserver/type/char.rb +2 -2
  34. data/lib/active_record/connection_adapters/sqlserver/type/data.rb +0 -2
  35. data/lib/active_record/connection_adapters/sqlserver/type/date.rb +2 -3
  36. data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +2 -3
  37. data/lib/active_record/connection_adapters/sqlserver/type/datetime2.rb +0 -2
  38. data/lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb +0 -2
  39. data/lib/active_record/connection_adapters/sqlserver/type/decimal.rb +0 -2
  40. data/lib/active_record/connection_adapters/sqlserver/type/float.rb +0 -2
  41. data/lib/active_record/connection_adapters/sqlserver/type/integer.rb +0 -2
  42. data/lib/active_record/connection_adapters/sqlserver/type/json.rb +0 -1
  43. data/lib/active_record/connection_adapters/sqlserver/type/money.rb +0 -2
  44. data/lib/active_record/connection_adapters/sqlserver/type/real.rb +0 -2
  45. data/lib/active_record/connection_adapters/sqlserver/type/small_integer.rb +0 -2
  46. data/lib/active_record/connection_adapters/sqlserver/type/small_money.rb +0 -2
  47. data/lib/active_record/connection_adapters/sqlserver/type/smalldatetime.rb +0 -2
  48. data/lib/active_record/connection_adapters/sqlserver/type/string.rb +0 -2
  49. data/lib/active_record/connection_adapters/sqlserver/type/text.rb +0 -2
  50. data/lib/active_record/connection_adapters/sqlserver/type/time.rb +2 -3
  51. data/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +6 -9
  52. data/lib/active_record/connection_adapters/sqlserver/type/timestamp.rb +0 -2
  53. data/lib/active_record/connection_adapters/sqlserver/type/tiny_integer.rb +0 -2
  54. data/lib/active_record/connection_adapters/sqlserver/type/unicode_char.rb +1 -3
  55. data/lib/active_record/connection_adapters/sqlserver/type/unicode_string.rb +0 -2
  56. data/lib/active_record/connection_adapters/sqlserver/type/unicode_text.rb +0 -2
  57. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar.rb +0 -2
  58. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar_max.rb +0 -2
  59. data/lib/active_record/connection_adapters/sqlserver/type/uuid.rb +1 -2
  60. data/lib/active_record/connection_adapters/sqlserver/type/varbinary.rb +1 -3
  61. data/lib/active_record/connection_adapters/sqlserver/type/varbinary_max.rb +0 -2
  62. data/lib/active_record/connection_adapters/sqlserver/type/varchar.rb +1 -3
  63. data/lib/active_record/connection_adapters/sqlserver/type/varchar_max.rb +0 -2
  64. data/lib/active_record/connection_adapters/sqlserver/utils.rb +8 -11
  65. data/lib/active_record/connection_adapters/sqlserver/version.rb +0 -2
  66. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +85 -83
  67. data/lib/active_record/connection_adapters/sqlserver_column.rb +0 -2
  68. data/lib/active_record/sqlserver_base.rb +1 -1
  69. data/lib/active_record/tasks/sqlserver_database_tasks.rb +26 -32
  70. data/lib/activerecord-sqlserver-adapter.rb +1 -1
  71. data/lib/arel/visitors/sqlserver.rb +18 -14
  72. data/lib/arel_sqlserver.rb +2 -2
  73. data/test/cases/adapter_test_sqlserver.rb +161 -182
  74. data/test/cases/change_column_null_test_sqlserver.rb +12 -12
  75. data/test/cases/coerced_tests.rb +88 -270
  76. data/test/cases/column_test_sqlserver.rb +281 -283
  77. data/test/cases/connection_test_sqlserver.rb +15 -20
  78. data/test/cases/execute_procedure_test_sqlserver.rb +18 -20
  79. data/test/cases/fetch_test_sqlserver.rb +14 -22
  80. data/test/cases/fully_qualified_identifier_test_sqlserver.rb +12 -18
  81. data/test/cases/helper_sqlserver.rb +13 -15
  82. data/test/cases/in_clause_test_sqlserver.rb +9 -9
  83. data/test/cases/index_test_sqlserver.rb +13 -15
  84. data/test/cases/json_test_sqlserver.rb +23 -25
  85. data/test/cases/migration_test_sqlserver.rb +22 -28
  86. data/test/cases/order_test_sqlserver.rb +51 -54
  87. data/test/cases/pessimistic_locking_test_sqlserver.rb +25 -33
  88. data/test/cases/rake_test_sqlserver.rb +31 -45
  89. data/test/cases/schema_dumper_test_sqlserver.rb +104 -108
  90. data/test/cases/schema_test_sqlserver.rb +18 -26
  91. data/test/cases/scratchpad_test_sqlserver.rb +2 -4
  92. data/test/cases/showplan_test_sqlserver.rb +24 -33
  93. data/test/cases/specific_schema_test_sqlserver.rb +66 -65
  94. data/test/cases/transaction_test_sqlserver.rb +16 -19
  95. data/test/cases/trigger_test_sqlserver.rb +12 -12
  96. data/test/cases/utils_test_sqlserver.rb +68 -70
  97. data/test/cases/uuid_test_sqlserver.rb +11 -13
  98. data/test/debug.rb +6 -6
  99. data/test/migrations/create_clients_and_change_column_null.rb +1 -1
  100. data/test/migrations/transaction_table/1_table_will_never_be_created.rb +2 -4
  101. data/test/models/sqlserver/booking.rb +1 -1
  102. data/test/models/sqlserver/customers_view.rb +1 -1
  103. data/test/models/sqlserver/dollar_table_name.rb +1 -1
  104. data/test/models/sqlserver/edge_schema.rb +1 -3
  105. data/test/models/sqlserver/fk_has_fk.rb +1 -1
  106. data/test/models/sqlserver/fk_has_pk.rb +1 -1
  107. data/test/models/sqlserver/natural_pk_data.rb +2 -2
  108. data/test/models/sqlserver/natural_pk_int_data.rb +1 -1
  109. data/test/models/sqlserver/no_pk_data.rb +1 -1
  110. data/test/models/sqlserver/object_default.rb +1 -1
  111. data/test/models/sqlserver/quoted_table.rb +2 -2
  112. data/test/models/sqlserver/quoted_view_1.rb +1 -1
  113. data/test/models/sqlserver/quoted_view_2.rb +1 -1
  114. data/test/models/sqlserver/sst_memory.rb +1 -1
  115. data/test/models/sqlserver/string_default.rb +1 -1
  116. data/test/models/sqlserver/string_defaults_big_view.rb +1 -1
  117. data/test/models/sqlserver/string_defaults_view.rb +1 -1
  118. data/test/models/sqlserver/tinyint_pk.rb +1 -1
  119. data/test/models/sqlserver/trigger.rb +2 -2
  120. data/test/models/sqlserver/trigger_history.rb +1 -1
  121. data/test/models/sqlserver/upper.rb +1 -1
  122. data/test/models/sqlserver/uppered.rb +1 -1
  123. data/test/models/sqlserver/uuid.rb +1 -1
  124. data/test/schema/sqlserver_specific_schema.rb +20 -22
  125. data/test/support/coerceable_test_sqlserver.rb +1 -4
  126. data/test/support/connection_reflection.rb +1 -2
  127. data/test/support/core_ext/query_cache.rb +1 -1
  128. data/test/support/load_schema_sqlserver.rb +3 -5
  129. data/test/support/minitest_sqlserver.rb +1 -1
  130. data/test/support/paths_sqlserver.rb +9 -11
  131. data/test/support/rake_helpers.rb +12 -10
  132. data/test/support/sql_counter_sqlserver.rb +0 -4
  133. data/test/support/test_in_memory_oltp.rb +7 -7
  134. metadata +5 -4
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Json < ActiveRecord::Type::Json
8
-
9
8
  end
10
9
  end
11
10
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Money < Decimal
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @precision = 19
@@ -19,7 +18,6 @@ module ActiveRecord
19
18
  def sqlserver_type
20
19
  "money"
21
20
  end
22
-
23
21
  end
24
22
  end
25
23
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Real < Float
8
-
9
8
  def type
10
9
  :real
11
10
  end
@@ -13,7 +12,6 @@ module ActiveRecord
13
12
  def sqlserver_type
14
13
  "real"
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
  end
@@ -5,11 +5,9 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class SmallInteger < Integer
8
-
9
8
  def sqlserver_type
10
9
  "smallint"
11
10
  end
12
-
13
11
  end
14
12
  end
15
13
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class SmallMoney < Money
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @precision = 10
@@ -19,7 +18,6 @@ module ActiveRecord
19
18
  def sqlserver_type
20
19
  "smallmoney"
21
20
  end
22
-
23
21
  end
24
22
  end
25
23
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class SmallDateTime < DateTime
8
-
9
8
  def type
10
9
  :smalldatetime
11
10
  end
@@ -23,7 +22,6 @@ module ActiveRecord
23
22
  def apply_seconds_precision(value)
24
23
  value.change usec: 0 if value
25
24
  end
26
-
27
25
  end
28
26
  end
29
27
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class String < ActiveRecord::Type::String
8
-
9
8
  def changed_in_place?(raw_old_value, new_value)
10
9
  if raw_old_value.is_a?(Data)
11
10
  raw_old_value.value != new_value
@@ -13,7 +12,6 @@ module ActiveRecord
13
12
  super
14
13
  end
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Text < VarcharMax
8
-
9
8
  def type
10
9
  :text_basic
11
10
  end
@@ -13,7 +12,6 @@ module ActiveRecord
13
12
  def sqlserver_type
14
13
  "text"
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Time < ActiveRecord::Type::Time
8
-
9
8
  include TimeValueFractional2
10
9
 
11
10
  def serialize(value)
@@ -13,7 +12,7 @@ module ActiveRecord
13
12
  return value unless value.acts_like?(:time)
14
13
 
15
14
  time = "#{value.to_s(:_sqlserver_time)}.#{quote_fractional(value)}"
16
-
15
+
17
16
  Data.new time, self
18
17
  end
19
18
 
@@ -38,6 +37,7 @@ module ActiveRecord
38
37
  def cast_value(value)
39
38
  value = super
40
39
  return if value.blank?
40
+
41
41
  value = value.change year: 2000, month: 01, day: 01
42
42
  apply_seconds_precision(value)
43
43
  end
@@ -45,7 +45,6 @@ module ActiveRecord
45
45
  def fractional_scale
46
46
  precision
47
47
  end
48
-
49
48
  end
50
49
  end
51
50
  end
@@ -4,18 +4,18 @@ module ActiveRecord
4
4
  module ConnectionAdapters
5
5
  module SQLServer
6
6
  module Type
7
-
8
7
  module TimeValueFractional
9
-
10
8
  private
11
9
 
12
10
  def apply_seconds_precision(value)
13
11
  return value if !value.respond_to?(fractional_property) || value.send(fractional_property).zero?
12
+
14
13
  value.change fractional_property => seconds_precision(value)
15
14
  end
16
15
 
17
16
  def seconds_precision(value)
18
17
  return 0 if fractional_scale == 0
18
+
19
19
  seconds = value.send(fractional_property).to_f / fractional_operator.to_f
20
20
  seconds = ((seconds * (1 / fractional_precision)).round / (1 / fractional_precision)).round(fractional_scale)
21
21
  (seconds * fractional_operator).round(0).to_i
@@ -23,9 +23,10 @@ module ActiveRecord
23
23
 
24
24
  def quote_fractional(value)
25
25
  return 0 if fractional_scale == 0
26
+
26
27
  frac_seconds = seconds_precision(value)
27
28
  seconds = (frac_seconds.to_f / fractional_operator.to_f).round(fractional_scale)
28
- seconds.to_d.to_s.split('.').last.to(fractional_scale-1)
29
+ seconds.to_d.to_s.split(".").last.to(fractional_scale - 1)
29
30
  end
30
31
 
31
32
  def fractional_property
@@ -37,7 +38,7 @@ module ActiveRecord
37
38
  end
38
39
 
39
40
  def fractional_operator
40
- 10 ** fractional_digits
41
+ 10**fractional_digits
41
42
  end
42
43
 
43
44
  def fractional_precision
@@ -47,11 +48,9 @@ module ActiveRecord
47
48
  def fractional_scale
48
49
  3
49
50
  end
50
-
51
51
  end
52
52
 
53
53
  module TimeValueFractional2
54
-
55
54
  include TimeValueFractional
56
55
 
57
56
  private
@@ -82,11 +81,9 @@ module ActiveRecord
82
81
  end
83
82
 
84
83
  def fractional_scale_max
85
- ('9' * fractional_scale) + ('0' * (fractional_digits - fractional_scale))
84
+ ("9" * fractional_scale) + ("0" * (fractional_digits - fractional_scale))
86
85
  end
87
-
88
86
  end
89
-
90
87
  end
91
88
  end
92
89
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Timestamp < Binary
8
-
9
8
  def type
10
9
  :ss_timestamp
11
10
  end
@@ -13,7 +12,6 @@ module ActiveRecord
13
12
  def sqlserver_type
14
13
  "timestamp"
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class TinyInteger < Integer
8
-
9
8
  def sqlserver_type
10
9
  "tinyint"
11
10
  end
@@ -19,7 +18,6 @@ module ActiveRecord
19
18
  def min_value
20
19
  0
21
20
  end
22
-
23
21
  end
24
22
  end
25
23
  end
@@ -5,18 +5,16 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class UnicodeChar < UnicodeString
8
-
9
8
  def type
10
9
  :nchar
11
10
  end
12
11
 
13
12
  def sqlserver_type
14
- 'nchar'.yield_self do |type|
13
+ "nchar".yield_self do |type|
15
14
  type += "(#{limit})" if limit
16
15
  type
17
16
  end
18
17
  end
19
-
20
18
  end
21
19
  end
22
20
  end
@@ -5,8 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class UnicodeString < String
8
-
9
-
10
8
  end
11
9
  end
12
10
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class UnicodeText < UnicodeVarcharMax
8
-
9
8
  def type
10
9
  :ntext
11
10
  end
@@ -13,7 +12,6 @@ module ActiveRecord
13
12
  def sqlserver_type
14
13
  "ntext"
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class UnicodeVarchar < UnicodeChar
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @limit = 4000 if @limit.to_i == 0
@@ -21,7 +20,6 @@ module ActiveRecord
21
20
  type
22
21
  end
23
22
  end
24
-
25
23
  end
26
24
  end
27
25
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class UnicodeVarcharMax < UnicodeVarchar
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @limit = 2_147_483_647
@@ -18,7 +17,6 @@ module ActiveRecord
18
17
  def sqlserver_type
19
18
  "nvarchar(max)"
20
19
  end
21
-
22
20
  end
23
21
  end
24
22
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Uuid < String
8
-
9
8
  ACCEPTABLE_UUID = %r{\A\{?([a-fA-F0-9]{4}-?){8}\}?\z}x
10
9
 
11
10
  alias_method :serialize, :deserialize
@@ -20,6 +19,7 @@ module ActiveRecord
20
19
 
21
20
  def serialize(value)
22
21
  return unless value
22
+
23
23
  Data.new super, self
24
24
  end
25
25
 
@@ -30,7 +30,6 @@ module ActiveRecord
30
30
  def quoted(value)
31
31
  Utils.quote_string_single(value) if value
32
32
  end
33
-
34
33
  end
35
34
  end
36
35
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Varbinary < Binary
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @limit = 8000 if @limit.to_i == 0
@@ -16,12 +15,11 @@ module ActiveRecord
16
15
  end
17
16
 
18
17
  def sqlserver_type
19
- 'varbinary'.yield_self do |type|
18
+ "varbinary".yield_self do |type|
20
19
  type += "(#{limit})" if limit
21
20
  type
22
21
  end
23
22
  end
24
-
25
23
  end
26
24
  end
27
25
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class VarbinaryMax < Varbinary
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @limit = 2_147_483_647
@@ -18,7 +17,6 @@ module ActiveRecord
18
17
  def sqlserver_type
19
18
  "varbinary(max)"
20
19
  end
21
-
22
20
  end
23
21
  end
24
22
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class Varchar < Char
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @limit = 8000 if @limit.to_i == 0
@@ -16,12 +15,11 @@ module ActiveRecord
16
15
  end
17
16
 
18
17
  def sqlserver_type
19
- 'varchar'.yield_self do |type|
18
+ "varchar".yield_self do |type|
20
19
  type += "(#{limit})" if limit
21
20
  type
22
21
  end
23
22
  end
24
-
25
23
  end
26
24
  end
27
25
  end
@@ -5,7 +5,6 @@ module ActiveRecord
5
5
  module SQLServer
6
6
  module Type
7
7
  class VarcharMax < Varchar
8
-
9
8
  def initialize(**args)
10
9
  super
11
10
  @limit = 2_147_483_647
@@ -18,7 +17,6 @@ module ActiveRecord
18
17
  def sqlserver_type
19
18
  "varchar(max)"
20
19
  end
21
-
22
20
  end
23
21
  end
24
22
  end
@@ -1,19 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'strscan'
3
+ require "strscan"
4
4
 
5
5
  module ActiveRecord
6
6
  module ConnectionAdapters
7
7
  module SQLServer
8
8
  module Utils
9
-
10
- QUOTED_STRING_PREFIX = 'N'
9
+ QUOTED_STRING_PREFIX = "N"
11
10
 
12
11
  # Value object to return identifiers from SQL Server names http://bit.ly/1CZ3EiL
13
12
  # Inspiried from Rails PostgreSQL::Name adapter object in their own Utils.
14
13
  #
15
14
  class Name
16
-
17
15
  SEPARATOR = "."
18
16
  UNQUOTED_SCANNER = /\]?\./
19
17
  QUOTED_SCANNER = /\A\[.*?\]\./
@@ -56,15 +54,15 @@ module ActiveRecord
56
54
  end
57
55
 
58
56
  def quoted
59
- parts.map{ |p| quote(p) if p }.join SEPARATOR
57
+ parts.map { |p| quote(p) if p }.join SEPARATOR
60
58
  end
61
59
 
62
60
  def quoted_raw
63
61
  quote @raw_name
64
62
  end
65
63
 
66
- def ==(o)
67
- o.class == self.class && o.parts == parts
64
+ def ==(other)
65
+ other.class == self.class && other.parts == parts
68
66
  end
69
67
  alias_method :eql?, :==
70
68
 
@@ -77,6 +75,7 @@ module ActiveRecord
77
75
  def parse_raw_name
78
76
  @parts = []
79
77
  return if raw_name.blank?
78
+
80
79
  scanner = StringScanner.new(raw_name)
81
80
  matched = scanner.exist?(QUOTED_CHECKER) ? scanner.scan_until(QUOTED_SCANNER) : scanner.scan_until(UNQUOTED_SCANNER)
82
81
  while matched
@@ -93,7 +92,7 @@ module ActiveRecord
93
92
  @schema = @parts.first
94
93
  end
95
94
  rest = scanner.rest
96
- rest = rest.starts_with?('.') ? rest[1..-1] : rest[0..-1]
95
+ rest = rest.starts_with?(".") ? rest[1..-1] : rest[0..-1]
97
96
  @object = unquote(rest)
98
97
  @parts << @object
99
98
  end
@@ -103,7 +102,7 @@ module ActiveRecord
103
102
  end
104
103
 
105
104
  def unquote(part)
106
- if part && part.start_with?('[')
105
+ if part && part.start_with?("[")
107
106
  part[1..-2]
108
107
  else
109
108
  part
@@ -113,7 +112,6 @@ module ActiveRecord
113
112
  def parts
114
113
  @parts
115
114
  end
116
-
117
115
  end
118
116
 
119
117
  extend self
@@ -141,7 +139,6 @@ module ActiveRecord
141
139
  def extract_identifiers(name)
142
140
  SQLServer::Utils::Name.new(name)
143
141
  end
144
-
145
142
  end
146
143
  end
147
144
  end