]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3542 fix the DATE type on Oracle
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 11 Sep 2012 08:23:29 +0000 (10:23 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 11 Sep 2012 08:23:29 +0000 (10:23 +0200)
sonar-server/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/oracle/adapter.rb

index c27a4f2d71499aa382398dbb515b4789f46588c6..3486a58887be1312bee209f4ae91a8c53f0dd564 100644 (file)
@@ -382,7 +382,9 @@ module ::ArJdbc
         end
         quoted = super
         #sonar
-        if value.acts_like?(:date) || value.acts_like?(:time) || value.acts_like?(:timestamp)
+        if value.acts_like?(:date)
+          quoted = "TO_DATE('#{value.strftime('%Y-%m-%d')}','YYYY-MM-DD')"
+        elsif value.acts_like?(:time) || value.acts_like?(:timestamp)
           quoted = "TO_TIMESTAMP('#{value.strftime('%Y-%m-%d %H:%M:%S')}:#{("%.6f"%value.to_f).split('.')[1]}','YYYY-MM-DD HH24:MI:SS:FF6')"
         end
         #/sonar