Module: ActiveRecord::ConnectionAdapters::MySQL::Quoting

Included in:
AbstractMysqlAdapter
Defined in:
lib/active_record/connection_adapters/mysql/quoting.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#quote_column_name(name) ⇒ Object



7
8
9
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 7

def quote_column_name(name)
  @quoted_column_names[name] ||= "`#{super.gsub('`', '``')}`".freeze
end

#quote_table_name(name) ⇒ Object



11
12
13
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 11

def quote_table_name(name)
  @quoted_table_names[name] ||= super.gsub(".", "`.`").freeze
end

#quoted_binary(value) ⇒ Object



39
40
41
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 39

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

#quoted_date(value) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 31

def quoted_date(value)
  if supports_datetime_with_precision?
    super
  else
    super.sub(/\.\d{6}\z/, "")
  end
end

#quoted_falseObject



23
24
25
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 23

def quoted_false
  QUOTED_FALSE
end

#quoted_trueObject



15
16
17
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 15

def quoted_true
  QUOTED_TRUE
end

#unquoted_falseObject



27
28
29
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 27

def unquoted_false
  0
end

#unquoted_trueObject



19
20
21
# File 'lib/active_record/connection_adapters/mysql/quoting.rb', line 19

def unquoted_true
  1
end