Module: ActiveRecord::ConnectionAdapters::SQLite3::Quoting
Overview
Defined Under Namespace
Modules: ClassMethods
Constant Summary
collapse
- QUOTED_COLUMN_NAMES =
Concurrent::Map.new
- QUOTED_TABLE_NAMES =
Concurrent::Map.new
Instance Method Summary
collapse
append_features, class_methods, extended, included, prepend_features, prepended
Instance Method Details
#quote_default_expression(value, column) ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 86
def quote_default_expression(value, column)
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) ⇒ Object
53
54
55
|
# 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) ⇒ Object
57
58
59
|
# 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) ⇒ Object
66
67
68
|
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 66
def quoted_binary(value)
"x'#{value.hex}'"
end
|
#quoted_false ⇒ Object
78
79
80
|
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 78
def quoted_false
"0"
end
|
#quoted_time(value) ⇒ Object
61
62
63
64
|
# 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 ⇒ Object
70
71
72
|
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 70
def quoted_true
"1"
end
|
#type_cast(value) ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 99
def type_cast(value)
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 ⇒ Object
82
83
84
|
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 82
def unquoted_false
0
end
|
#unquoted_true ⇒ Object
74
75
76
|
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb', line 74
def unquoted_true
1
end
|