Module: ActiveRecord::ConnectionAdapters::SQLServer::Quoting::ClassMethods

Defined in:
lib/active_record/connection_adapters/sqlserver/quoting.rb

Instance Method Summary collapse

Instance Method Details

#column_name_matcherObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/active_record/connection_adapters/sqlserver/quoting.rb', line 13

def column_name_matcher
  /
    \A
    (
      (?:
        # [database_name].[database_owner].[table_name].[column_name] | function(one or no argument)
        ((?:\w+\.|\[\w+\]\.)?(?:\w+\.|\[\w+\]\.)?(?:\w+\.|\[\w+\]\.)?(?:\w+|\[\w+\]) | \w+\((?:|\g<2>)\))
      )
      (?:\s+AS\s+(?:\w+|\[\w+\]))?
    )
    (?:\s*,\s*\g<1>)*
    \z
  /ix
end

#column_name_with_order_matcherObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/active_record/connection_adapters/sqlserver/quoting.rb', line 28

def column_name_with_order_matcher
  /
    \A
    (
      (?:
        # [database_name].[database_owner].[table_name].[column_name] | function(one or no argument)
        ((?:\w+\.|\[\w+\]\.)?(?:\w+\.|\[\w+\]\.)?(?:\w+\.|\[\w+\]\.)?(?:\w+|\[\w+\]) | \w+\((?:|\g<2>)\))
      )
      (?:\s+COLLATE\s+\w+)?
      (?:\s+ASC|\s+DESC)?
      (?:\s+NULLS\s+(?:FIRST|LAST))?
    )
    (?:\s*,\s*\g<1>)*
    \z
  /ix
end

#quote_column_name(name) ⇒ Object



45
46
47
# File 'lib/active_record/connection_adapters/sqlserver/quoting.rb', line 45

def quote_column_name(name)
  QUOTED_COLUMN_NAMES[name] ||= SQLServer::Utils.extract_identifiers(name).quoted
end

#quote_table_name(name) ⇒ Object



49
50
51
# File 'lib/active_record/connection_adapters/sqlserver/quoting.rb', line 49

def quote_table_name(name)
  QUOTED_TABLE_NAMES[name] ||= SQLServer::Utils.extract_identifiers(name).quoted
end