Sha256: 0c46d636205691936a40476e24333a8216c7b738c620c9ecf3d4e1ba1269b113

Contents?: true

Size: 610 Bytes

Versions: 6

Compression:

Stored size: 610 Bytes

Contents

# Module containing overrides for Sequel's standard date/time literalization
# to use the SQL standrd.  The SQL standard is used by fewer databases than
# the defacto standard (which is just a normal string).
module Sequel::Dataset::SQLStandardDateFormat
  private

  # Use SQL standard syntax for Date
  def literal_date(v)
    v.strftime("DATE '%Y-%m-%d'") 
  end
    
  # Use SQL standard syntax for DateTime
  def literal_datetime(v)
    v.strftime("TIMESTAMP '%Y-%m-%d %H:%M:%S'")
  end

  # Use SQL standard syntax for Time
  def literal_time(v)
    v.strftime("TIMESTAMP '%Y-%m-%d %H:%M:%S'")
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
colincasey-sequel-2.10.4 lib/sequel_core/adapters/utils/date_format.rb
epugh-sequel-0.0.0 lib/sequel/adapters/utils/date_format.rb
sequel-2.11.0 lib/sequel_core/adapters/utils/date_format.rb
sequel-2.12.0 lib/sequel/adapters/utils/date_format.rb
sequel-3.0.0 lib/sequel/adapters/utils/date_format.rb
sequel-3.1.0 lib/sequel/adapters/utils/date_format.rb