  def self.get_for(user_id, category=nil)

    SqlHelper.validate_token([user_id, category])

    con = []
    con << "(user_id=#{user_id.to_i})"
    con << "(category='#{category}')" unless category.nil?

    settings = Setting.where(con.join(' and ')).to_a

    return nil if settings.nil? or settings.empty?

    hash = Hash.new

    settings.each do |setting|
      hash[setting.xkey] = setting.xvalue
    end

    return hash
  end
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.