Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Date Value Formatting #5

Closed
wants to merge 2 commits into from

2 participants

@fredjean

This PR formats Date, DateTime, and Time using the ISO 8601 standard and allows dates to be used in queries.

fredjean added some commits
@fredjean fredjean Upgrading bundler to 1.1.x
Also making sure that bundle install works on 1.9
92c5c58
@fredjean fredjean Formatting date and time values when building SOQL queries
The dates were formatted using their to_s methods. This introduced white
spaces in the values and generated invalid queries. This uses the ISO 8601
format, which is accepted by SF.com.
b954119
@fredjean

@jpr5 @cloudcrowd Anyone looking at this? This will allow dates and date times to be used in queries, which is a big gap in the current implementation.

Thanks!

@jpr5
Owner

@fredjean Thanks for the patch- I'll test this later today and roll a new gem if there's no problems.

Separately, shouldn't the gem for Ruby 1.9(.3) be 'debugger'? I remember 'ruby-debug19' was necessary with 1.8.7 < x < 1.9.3, but last time I tried 'ruby-debug19' on 1.9.3 it failed.

@jpr5 jpr5 was assigned
@fredjean

I think that the current one is indeed 'debugger'. I have switched to Pry for debugging though...

@jpr5
Owner

Merged these in, rolled and pushed 1.0.6 out to rubygems. Thanks for the patches!

@jpr5 jpr5 closed this
@fredjean

Excellent! Thank you (and you are welcome)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 23, 2012
  1. @fredjean

    Upgrading bundler to 1.1.x

    fredjean authored
    Also making sure that bundle install works on 1.9
  2. @fredjean

    Formatting date and time values when building SOQL queries

    fredjean authored
    The dates were formatted using their to_s methods. This introduced white
    spaces in the values and generated invalid queries. This uses the ISO 8601
    format, which is accepted by SF.com.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +2 −2 Gemfile
  2. +2 −0  lib/dm-salesforce-adapter/sql.rb
View
4 Gemfile
@@ -5,12 +5,12 @@ gemspec
group :test do
gem 'rspec', '~>1.0', :require => %w(spec)
gem 'rake'
- gem 'rcov'
+ gem 'rcov', :platforms => :ruby_18
gem 'ruby-debug', :platforms => :ruby_18
gem 'ruby-debug19', :platforms => :ruby_19
- gem 'bundler', '~> 1.0.0'
+ gem 'bundler', '~> 1.1.0'
gem 'ParseTree', :require => 'parse_tree'
gem 'dm-sweatshop'
gem 'dm-sqlite-adapter'
View
2  lib/dm-salesforce-adapter/sql.rb
@@ -92,6 +92,8 @@ def quote_value(value, property)
when Array then "(#{value.map {|v| quote_value(v, property)}.join(", ")})"
when NilClass then "NULL"
when String then "'#{value.gsub(/'/, "\\'").gsub(/\\/, %{\\\\})}'"
+ when Date then value.iso8601
+ when DateTime, Time then value.iso8601(2)
else "#{value}"
end
end
Something went wrong with that request. Please try again.