123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::ConnectionAdapters::SQLite3::Quoting

Do not use. This module is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb

Constant Summary

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

append_features, prepend_features

Instance Method Summary

Instance Method Details

#quote_default_expression(value, column)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 86

def quote_default_expression(value, column) # :nodoc:
  if value.is_a?(Proc)
    value = value.call
    if value.match?(/\A\w+\(.*\)\z/)
      "(#{value})"
    else
      value
    end
  else
    super
  end
end

#quote_string(s)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 53

def quote_string(s)
  ::SQLite3::Database.quote(s)
end

#quote_table_name_for_assignment(table, attr)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 57

def quote_table_name_for_assignment(table, attr)
  quote_column_name(attr)
end

#quoted_binary(value)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 66

def quoted_binary(value)
  "x'#{value.hex}'"
end

#quoted_false

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 78

def quoted_false
  "0"
end

#quoted_time(value)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 61

def quoted_time(value)
  value = value.change(year: 2000, month: 1, day: 1)
  quoted_date(value).sub(/\A\d\d\d\d-\d\d-\d\d /, "2000-01-01 ")
end

#quoted_true

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 70

def quoted_true
  "1"
end

#type_cast(value)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 99

def type_cast(value) # :nodoc:
  case value
  when BigDecimal, Rational
    value.to_f
  when String
    if value.encoding == Encoding::ASCII_8BIT
      super(value.encode(Encoding::UTF_8))
    else
      super
    end
  else
    super
  end
end

#unquoted_false

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 82

def unquoted_false
  0
end

#unquoted_true

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 74

def unquoted_true
  1
end