Class: ActiveRecord::ConnectionAdapters::Sqlserver::Utils
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::Sqlserver::Utils
- Defined in:
- lib/active_record/connection_adapters/sqlserver/utils.rb
Class Method Summary collapse
- .unqualify_db_name(table_name) ⇒ Object
- .unqualify_table_name(table_name) ⇒ Object
- .unqualify_table_schema(table_name) ⇒ Object
- .unquote_string(string) ⇒ Object
Class Method Details
.unqualify_db_name(table_name) ⇒ Object
20 21 22 23 |
# File 'lib/active_record/connection_adapters/sqlserver/utils.rb', line 20 def unqualify_db_name(table_name) table_names = table_name.to_s.split('.') table_names.length == 3 ? table_names.first.tr('[]','') : nil end |
.unqualify_table_name(table_name) ⇒ Object
12 13 14 |
# File 'lib/active_record/connection_adapters/sqlserver/utils.rb', line 12 def unqualify_table_name(table_name) table_name.to_s.split('.').last.tr('[]','') end |
.unqualify_table_schema(table_name) ⇒ Object
16 17 18 |
# File 'lib/active_record/connection_adapters/sqlserver/utils.rb', line 16 def unqualify_table_schema(table_name) table_name.to_s.split('.')[-2].gsub(/[\[\]]/,'') rescue nil end |
.unquote_string(string) ⇒ Object
8 9 10 |
# File 'lib/active_record/connection_adapters/sqlserver/utils.rb', line 8 def unquote_string(string) string.to_s.gsub(/\'\'/, "'") end |