module ActiveRecord::ConnectionAdapters::SQLServer::Quoting

Constants

QUOTED_FALSE
QUOTED_STRING_PREFIX
QUOTED_TRUE

Public Instance Methods

quote_column_name(name) click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 14
def quote_column_name(name)
  SQLServer::Utils.extract_identifiers(name).quoted
end
quote_default_value(value, column) click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 18
def quote_default_value(value, column)
  if column.type == :uuid && value =~ /\(\)/
    value
  else
    quote(value, column)
  end
end
quote_string(s) click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 10
def quote_string(s)
  SQLServer::Utils.quote_string(s)
end
quoted_date(value) click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 42
def quoted_date(value)
  if value.acts_like?(:date)
    Type::Date.new.type_cast_for_database(value)
  else value.acts_like?(:time)
    Type::DateTime.new.type_cast_for_database(value)
  end
end
quoted_false() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 34
def quoted_false
  QUOTED_FALSE
end
quoted_true() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 26
def quoted_true
  QUOTED_TRUE
end
unquoted_false() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 38
def unquoted_false
  0
end
unquoted_true() click to toggle source
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 30
def unquoted_true
  1
end

Private Instance Methods

_quote(value) click to toggle source
Calls superclass method
# File lib/active_record/connection_adapters/sqlserver/quoting.rb, line 53
def _quote(value)
  case value
  when Type::Binary::Data
    "0x#{value.hex}"
  when ActiveRecord::Type::SQLServer::Char::Data
    value.quoted
  when String, ActiveSupport::Multibyte::Chars
    "#{QUOTED_STRING_PREFIX}#{super}"
  else
    super
  end
end