module ActiveRecord::ConnectionAdapters::Fb::Quoting
Public Instance Methods
quote(value, column = nil)
click to toggle source
Calls superclass method
# File lib/active_record/connection_adapters/fb/quoting.rb, line 5 def quote(value, column = nil) return value.quoted_id if value.respond_to?(:quoted_id) type = column && column.type case value when String, ActiveSupport::Multibyte::Chars value = value.to_s if [:integer, :float].include?(type) (type == :integer ? value.to_i : value.to_f).to_s elsif type && type == :binary "@BINDBINARY#{Base64.encode64(value.to_s)}BINDBINARY@" else "'#{quote_string(value)}'" end when Date, Time "@BINDDATE#{quoted_date(value)}BINDDATE@" else super end end
quote_table_name_for_assignment(_table, attr)
click to toggle source
# File lib/active_record/connection_adapters/fb/quoting.rb, line 35 def quote_table_name_for_assignment(_table, attr) quote_column_name(attr) end
type_cast(value, column)
click to toggle source
Calls superclass method
# File lib/active_record/connection_adapters/fb/quoting.rb, line 55 def type_cast(value, column) if [true, false].include?(value) value ? quoted_true : quoted_false else super end end
unquoted_false()
click to toggle source
# File lib/active_record/connection_adapters/fb/quoting.rb, line 47 def unquoted_false boolean_domain[:false] end
unquoted_true()
click to toggle source
# File lib/active_record/connection_adapters/fb/quoting.rb, line 39 def unquoted_true boolean_domain[:true] end
Private Instance Methods
_quote(value)
click to toggle source
Types that are bind parameters will not be quoted
Calls superclass method
# File lib/active_record/connection_adapters/fb/quoting.rb, line 66 def _quote(value) case value when Type::Binary::Data "@BINDBINARY#{Base64.encode64(value.to_s)}BINDBINARY@" when Date, Time "@BINDDATE#{quoted_date(value)}BINDDATE@" else super end end
ar_to_fb_case(column_name)
click to toggle source
Maps lowercase ActiveRecord
column names to uppercase for Fierbird; mixed-case columns retain their original case.
# File lib/active_record/connection_adapters/fb/quoting.rb, line 85 def ar_to_fb_case(column_name) column_name =~ /[[:upper:]]/ ? column_name : column_name.upcase end
decode(s)
click to toggle source
# File lib/active_record/connection_adapters/fb/quoting.rb, line 90 def decode(s) Base64.decode64(s).force_encoding(@connection.encoding) end
fb_to_ar_case(column_name)
click to toggle source
Maps uppercase Firebird column names to lowercase for ActiveRecord
; mixed-case columns retain their original case.
# File lib/active_record/connection_adapters/fb/quoting.rb, line 79 def fb_to_ar_case(column_name) column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase end