Module: ActiveRecord::ConnectionAdapters::Spanner::Quoting
- Included in:
- ActiveRecord::ConnectionAdapters::SpannerAdapter
- Defined in:
- lib/active_record/connection_adapters/spanner/quoting.rb
Instance Method Summary collapse
- #_type_cast(value) ⇒ Object
- #quote_column_name(name) ⇒ Object
- #quote_string(s) ⇒ Object
- #quote_table_name(name) ⇒ Object
- #quoted_binary(value) ⇒ Object
Instance Method Details
#_type_cast(value) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/active_record/connection_adapters/spanner/quoting.rb', line 73 def _type_cast value case value when Array ActiveSupport::JSON.encode value else super end end |
#quote_column_name(name) ⇒ Object
50 51 52 |
# File 'lib/active_record/connection_adapters/spanner/quoting.rb', line 50 def quote_column_name name QUOTED_COLUMN_NAMES[name] ||= "`#{name.to_s.gsub '`', '``'}`".freeze end |
#quote_string(s) ⇒ Object
65 66 67 |
# File 'lib/active_record/connection_adapters/spanner/quoting.rb', line 65 def quote_string s s.gsub STR_ESCAPE_REGX, STR_ESCAPE_VALUES end |
#quote_table_name(name) ⇒ Object
54 55 56 |
# File 'lib/active_record/connection_adapters/spanner/quoting.rb', line 54 def quote_table_name name QUOTED_TABLE_NAMES[name] ||= "`#{name.to_s.gsub '.', '`.`'}`".freeze end |
#quoted_binary(value) ⇒ Object
69 70 71 |
# File 'lib/active_record/connection_adapters/spanner/quoting.rb', line 69 def quoted_binary value "b'#{value}'" end |