File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
lib/active_record/connection_adapters/sqlserver Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,42 @@ def quoted_date(value)
6868 end
6969 end
7070
71+ def column_name_matcher
72+ COLUMN_NAME
73+ end
74+
75+ def column_name_with_order_matcher
76+ COLUMN_NAME_WITH_ORDER
77+ end
78+
79+ COLUMN_NAME = /
80+ \A
81+ (
82+ (?:
83+ # [table_name].[column_name] | function(one or no argument)
84+ ((?:\w +\. |\[ \w +\] \. )?(?:\w +|\[ \w +\] )) | \w +\( (?:|\g <2>)\)
85+ )
86+ (?:\s +AS\s +(?:\w +|\[ \w +\] ))?
87+ )
88+ (?:\s *,\s *\g <1>)*
89+ \z
90+ /ix
91+
92+ COLUMN_NAME_WITH_ORDER = /
93+ \A
94+ (
95+ (?:
96+ # [table_name].[column_name] | function(one or no argument)
97+ ((?:\w +\. |\[ \w +\] \. )?(?:\w +|\[ \w +\] )) | \w +\( (?:|\g <2>)\)
98+ )
99+ (?:\s +ASC|\s +DESC)?
100+ (?:\s +NULLS\s +(?:FIRST|LAST))?
101+ )
102+ (?:\s *,\s *\g <1>)*
103+ \z
104+ /ix
105+
106+ private_constant :COLUMN_NAME , :COLUMN_NAME_WITH_ORDER
71107
72108 private
73109
You can’t perform that action at this time.
0 commit comments