the datetime object insertion looses the fraction part of the second
--------------------------------------------------------------------

                 Key: JRUBY-5255
                 URL: http://jira.codehaus.org/browse/JRUBY-5255
             Project: JRuby
          Issue Type: Bug
          Components: Ruby 1.8.7
    Affects Versions: JRuby 1.5.5
         Environment: jirb
            Reporter: Geeta
            Priority: Trivial


jirb in 1.8 mode
irb(main):003:0> require 'date'
=> true
irb(main):004:0> x=DateTime.now()
=> #<DateTime: 21215812251739/8640000,11/48,2299161>

*********** %3N the length for N is ignored
irb(main):005:0> x.strftime("%Y%m%d %H:%M:%S.%3N")
=> "20101203 13:18:37.390000000"
irb(main):006:0> x.strftime("%Y%m%d %H:%M:%S.%N")
=> "20101203 13:18:37.390000000"
irb(main):007:0> x=Time.now()
=> Fri Dec 03 13:20:22 +0530 2010
irb(main):008:0> x.strftime("%Y%m%d %H:%M:%S.%N")
=> "20101203 13:20:22.944915345"

******  %3N not recognised for time objcet but %N is recognised as above

irb(main):009:0> x.strftime("%Y%m%d %H:%M:%S.%3N")
=> "20101203 13:20:22.%3N"



The default db format string is not used and does not have the fraction part of 
the second string %N in it

the datetime object insertion looses the fraction part of the second
for insert stmt in mssql the following format needs the %3N to work and 
   def quote(value, column = nil)
      return value.quoted_id if value.respond_to?(:quoted_id)

      case value
      when String, ActiveSupport::Multibyte::Chars
        value = value.to_s
        if column && column.type == :binary
          "'#{quote_string(JdbcSpec::MsSQL::Column.string_to_binary(value))}'" 
# ' (for ruby-mode)
        elsif column && [:integer, :float].include?(column.type)
          value = column.type == :integer ? value.to_i : value.to_f
          value.to_s
        else
          "'#{quote_string(value)}'" # ' (for ruby-mode)
        end
      when TrueClass             then '1'
      when FalseClass            then '0'
      when Time, DateTime        then "'#{value.strftime("%Y%m%d 
%H:%M:%S.%3N")[0,21]}'"
      when Date                  then "'#{value.strftime("%Y%m%d")}'"
      else                       super
      end
    end


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to