Method: ActiveRecord::ConnectionAdapters::IBM_DB2_I5#quote_date_time_for_pstmt

Defined in:
lib/active_record/connection_adapters/ibm_db_adapter.rb

#quote_date_time_for_pstmt(value, column = nil) ⇒ Object



3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 3254

def quote_date_time_for_pstmt(value, column=nil)
  if column && column.sql_type == 'time' # T006 time format
    sep = TIME_SEP_CHAR[@adapter.time_sep]
    value = value.to_s[/\d\d#{sep}\d\d#{sep}\d\d/] 
  elsif value.acts_like?(:date)
    if column && column.sql_type == 'timestamp' # T013 timestamp format
      value = value.to_time
    end
    value = @adapter.quoted_date(value)
  elsif value.acts_like?(:time)
    value = @adapter.quoted_date(value)
  else
    value.to_yaml
  end
end