# File lib/active_record/connection_adapters/frontbase_adapter.rb, line 297
      def quote(value, column = nil)
        return value.quoted_id if value.respond_to?(:quoted_id)

        retvalue = "<INVALID>"

        puts "quote(#{value.inspect}(#{value.class}),#{column.type.inspect})" if FB_TRACE
        # If a column was passed in, use column type information
        unless value.nil?
          if column
            retvalue = case column.type
              when :string
                if value.kind_of?(String)
                  "'#{quote_string(value.to_s)}'" # ' (for ruby-mode)
                else
                  "'#{quote_string(value.to_yaml)}'"
                end
              when :integer
                if value.kind_of?(TrueClass)
                  '1'
                elsif value.kind_of?(FalseClass)
                  '0'
                else
                   value.to_i.to_s
                end
              when :float
                value.to_f.to_s
              when :decimal
                value.to_d.to_s("F")
              when :datetime, :timestamp
                "TIMESTAMP '#{value.strftime("%Y-%m-%d %H:%M:%S")}'"
              when :time
                "TIME '#{value.strftime("%H:%M:%S")}'"
              when :date
                "DATE '#{value.strftime("%Y-%m-%d")}'"
              when :twelvebytekey
                value = value.to_s.unpack("H*").first unless value.kind_of?(TwelveByteKey)
                "X'#{value.to_s}'"
              when :boolean
                value = quoted_true if value.kind_of?(TrueClass)
                value = quoted_false if value.kind_of?(FalseClass)
                value
              when :binary
                blob_handle = @connection.create_blob(value.to_s)
                puts "SQL -> Insert #{value.to_s.length} byte blob as #{retvalue}" if FB_TRACE
                blob_handle.handle
              when :text
                if value.kind_of?(String)
                  clobdata = value.to_s # ' (for ruby-mode)
                else
                  clobdata = value.to_yaml
                end
                clob_handle = @connection.create_clob(clobdata)
                puts "SQL -> Insert #{value.to_s.length} byte clob as #{retvalue}" if FB_TRACE
                clob_handle.handle
              else
                raise "*** UNKNOWN TYPE: #{column.type.inspect}"
            end # case
          # Since we don't have column type info, make a best guess based
          # on the Ruby class of the value
          else
            retvalue = case value
              when ActiveRecord::ConnectionAdapters::TwelveByteKey
                s = value.unpack("H*").first
                "X'#{s}'"
              when String
                if column && column.type == :binary
                  s = value.unpack("H*").first
                  "X'#{s}'"
                elsif column && [:integer, :float, :decimal].include?(column.type) 
                  value.to_s
                else
                  "'#{quote_string(value)}'" # ' (for ruby-mode)
                end
              when NilClass
                "NULL"
              when TrueClass
                (column && column.type == :integer ? '1' : quoted_true)
              when FalseClass
                (column && column.type == :integer ? '0' : quoted_false)
              when Float, Fixnum, Bignum, BigDecimal
                value.to_s
              when Time, Date, DateTime
                if column
                  case column.type
                    when :date
                      "DATE '#{value.strftime("%Y-%m-%d")}'"
                    when :time
                      "TIME '#{value.strftime("%H:%M:%S")}'"
                    when :timestamp
                      "TIMESTAMP '#{value.strftime("%Y-%m-%d %H:%M:%S")}'"
                  else
                    raise NotImplementedError, "Unknown column type!"
                  end # case
                else # Column wasn't passed in, so try to guess the right type
                  if value.kind_of? Date
                    "DATE '#{value.strftime("%Y-%m-%d")}'"
                  else
                    if [:hour, :min, :sec].all? {|part| value.send(:part).zero? }
                      "TIME '#{value.strftime("%H:%M:%S")}'"
                    else
                      "TIMESTAMP '#{quoted_date(value)}'"
                    end
                  end 
                end #if column
              else 
                "'#{quote_string(value.to_yaml)}'"
            end #case
          end
        else
          retvalue = "NULL"
        end
         
        retvalue
      end