← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1802: Fixed bug: data-archive-throws-exception

 

------------------------------------------------------------
revno: 1802
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-04-22 18:31:39 +0200
message:
  Fixed bug: data-archive-throws-exception
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java	2010-04-22 16:31:39 +0000
@@ -34,6 +34,8 @@
 import org.hisp.dhis.dataarchive.DataArchiveStore;
 import org.springframework.jdbc.core.JdbcTemplate;
 
+import static org.hisp.dhis.system.util.DateUtils.*;
+
 /**
  * @author Lars Helge Overland
  */
@@ -66,16 +68,16 @@
             "INSERT INTO datavaluearchive ( " +
                 "SELECT d.* FROM datavalue AS d " +
                 "JOIN period as p USING (periodid) " +
-                "WHERE p.startdate>'" + startDate + "' " +
-                "AND p.enddate<='" + endDate + "' );" +
+                "WHERE p.startdate>='" + getMediumDateString( startDate ) + "' " +
+                "AND p.enddate<='" + getMediumDateString( endDate ) + "' );" +
             
             // Delete data from datavalue
             
             "DELETE FROM datavalue AS d " +
             "USING period as p " +
             "WHERE d.periodid=p.periodid " +
-            "AND p.startdate>'" + startDate + "' " +
-            "AND p.enddate<='" + endDate + "';";
+            "AND p.startdate>='" + getMediumDateString( startDate ) + "' " +
+            "AND p.enddate<='" + getMediumDateString( endDate ) + "';";
     
         log.info( sql );
         
@@ -91,16 +93,16 @@
             "INSERT INTO datavalue ( " +
                 "SELECT a.* FROM datavaluearchive AS a " +
                 "JOIN period as p USING (periodid) " +
-                "WHERE p.startdate>'" + startDate + "' " +
-                "AND p.enddate<='" + endDate + "' );" +
+                "WHERE p.startdate>='" + getMediumDateString( startDate ) + "' " +
+                "AND p.enddate<='" + getMediumDateString( endDate ) + "' );" +
             
             // Delete data from datavalue
             
             "DELETE FROM datavaluearchive AS a " +
             "USING period AS p " +
             "WHERE a.periodid=p.periodid " +
-            "AND p.startdate>'" + startDate + "' " +
-            "AND p.enddate<='" + endDate + "';";
+            "AND p.startdate>='" + getMediumDateString( startDate ) + "' " +
+            "AND p.enddate<='" + getMediumDateString( endDate ) + "';";
 
         log.info( sql );