Hi.
I am experimenting IBM DB2 Express as a back-end for Radiant. Results
are encouraging so far. Some problems needed tweaks to the ibm_db
adapter for rails or to environment settings (see tracker on
http://rubyforge.org/projects/rubyibm/ for details). People at IBM have
been very responsive. Though more complicated to set up vis-a-vis mysql
or postgres, db2 has native support for xml, and this is the reason why
I am interested in using it in rails.
I propose the following patch to radiant/app/models/archive_finder.rb in
order to support db2 specific syntax for date fields:
def extract(part, field)
#puts ActiveRecord::Base.connection.adapter_name
case ActiveRecord::Base.connection.adapter_name
#start of patch
when /ibm_db/i
format = case part
when /year/i
"YEAR(#{field})"
when /month/i
"MONTH(#{field})"
when /day/i
"DAY(#{field})"
end
format
#end of patch
when /sqlite/i
format = case part
when /year/i
'%Y'
when /month/i
'%m'
when /day/i
'%d'
end
"CAST(STRFTIME('#{format}', #{field}) AS INTEGER)"
when /sqlserver/i
"DATEPART(#{part.upcase}, #{field})"
else
"EXTRACT(#{part.upcase} FROM #{field})"
end
end
Luca Erzegovesi
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant