<commit_before>module DataMapper
  module Adapters
    module Sql
      
      # Quoting is a mixin that extends your DataMapper::Database singleton-class
      # to allow for object-name and value quoting to be exposed to the queries.
      #
      # DESIGN: Is there any need for this outside of the query objects? Should
      # we just include it in our query object subclasses and not rely on a Quoting
      # mixin being part of the "standard" Adapter interface?
      module Quoting

        def quote_table_name(name)
          name.ensure_wrapped_with(self.class::TABLE_QUOTING_CHARACTER)
        end

        def quote_column_name(name)
          name.ensure_wrapped_with(self.class::COLUMN_QUOTING_CHARACTER)
        end

        def quote_value(value)
          return 'NULL' if value.nil?

          case value
            when Numeric then value.to_s
            when String then "'#{value.gsub("'", "''")}'"
            when Class then "'#{value.name}'"
            when Date then "'#{value.to_s}'"
            when Time, DateTime then "'#{value.strftime("%Y-%m-%d %H:%M:%S")}'"
            when TrueClass, FalseClass then value.to_s.upcase
            when Array then "(#{value.map { |entry| quote_value(entry) }.join(', ')})"
            else 
              if value.respond_to?(:to_sql)
                value.to_sql
              else
                raise "Don't know how to quote #{value.inspect}"
              end
          end
        end

      end # module Quoting<commit_msg>Fixed UTC issues with datetimes.<commit_after>module DataMapper
  module Adapters
    module Sql
      
      # Quoting is a mixin that extends your DataMapper::Database singleton-class
      # to allow for object-name and value quoting to be exposed to the queries.
      #
      # DESIGN: Is there any need for this outside of the query objects? Should
      # we just include it in our query object subclasses and not rely on a Quoting
      # mixin being part of the "standard" Adapter interface?
      module Quoting

        def quote_table_name(name)
          name.ensure_wrapped_with(self.class::TABLE_QUOTING_CHARACTER)
        end

        def quote_column_name(name)
          name.ensure_wrapped_with(self.class::COLUMN_QUOTING_CHARACTER)
        end

        def quote_value(value)
          return 'NULL' if value.nil?

          case value
            when Numeric then value.to_s
            when String then "'#{value.gsub("'", "''")}'"
            when Class then "'#{value.name}'"
            when Date then "'#{value.to_s}'"
            when Time, DateTime then "'#{value.utc.strftime("%Y-%m-%d %H:%M:%S")}'"
            when TrueClass, FalseClass then value.to_s.upcase
            when Array then "(#{value.map { |entry| quote_value(entry) }.join(', ')})"
            else 
              if value.respond_to?(:to_sql)
                value.to_sql
              else
                raise "Don't know how to quote #{value.inspect}"
              end
          end
        end

      end # module Quoting
{'fraction_non_alphanumeric': 0.09051866534522629, 'fraction_numerical': 0.0, 'mean_word_length': 2.0069513406156902, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2478893', 'n_tokens_mistral': 862, 'n_tokens_neox': 848, 'n_words': 271}