← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9713: 1.4 import, including archived data records

 

------------------------------------------------------------
revno: 9713
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-04 19:48:14 +0200
message:
  1.4 import, including archived data records
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml


--
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-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml	2010-11-19 15:15:14 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml	2013-02-04 17:48:14 +0000
@@ -24,19 +24,23 @@
     <!-- Statement -->
 	
     <select id="getRoutineDataValues" resultMap="routineDataValueResultMap">
-        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineData
+        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineData UNION
+        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineDataArchive        
     </select>
 
     <select id="getRoutineDataValuesLastUpdated" parameterClass="java.util.Date" resultMap="routineDataValueResultMap">
-        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineData WHERE LastUpdated > #value#
+        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineData WHERE LastUpdated > #value# UNION
+        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineDataArchive WHERE LastUpdated > #value#
     </select>
 
     <select id="getDistinctPeriodIdentifiers" resultClass="java.lang.Integer">
-        SELECT DISTINCT DataPeriodID FROM RoutineData
+        SELECT DISTINCT DataPeriodID FROM RoutineData UNION
+        SELECT DISTINCT DataPeriodID FROM RoutineDataArchive
     </select>
 
 	<select id="getRoutineDataValuesOutOfRange" resultClass="java.lang.Integer">
-		SELECT COUNT(*) FROM RoutineData WHERE EntryNumber > 2147483647
+		SELECT COUNT(*) FROM RoutineData WHERE EntryNumber > 2147483647 UNION
+		SELECT COUNT(*) FROM RoutineDataArchive WHERE EntryNumber > 2147483647
 	</select>
 
 </sqlMap>

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml	2010-11-19 15:15:14 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml	2013-02-04 17:48:14 +0000
@@ -25,22 +25,34 @@
 	<!-- Statement -->
 	
 	<select id="getSemiPermanentDataValues" resultMap="semiPermanentDataValueResultMap">
-		SELECT SemiPermanentData.DataElementID, SemiPermanentData.ValidFrom, SemiPermanentData.ValidTo, 
-		SemiPermanentData.OrgUnitID, SemiPermanentData.EntryNumber, SemiPermanentData.EntryYesNo, DataElement.DataPeriodTypeID 
-		FROM SemiPermanentData, DataElement 
-        WHERE SemiPermanentData.DataElementID = DataElement.DataElementID
+		SELECT SPD.DataElementID, SPD.ValidFrom, SPD.ValidTo, 
+		SPD.OrgUnitID, SPD.EntryNumber, SPD.EntryYesNo, DataElement.DataPeriodTypeID 
+		FROM SemiPermanentData AS SPD, DataElement 
+        WHERE SPD.DataElementID = DataElement.DataElementID
+        UNION
+        SELECT SPD.DataElementID, SPD.ValidFrom, SPD.ValidTo, 
+        SPD.OrgUnitID, SPD.EntryNumber, SPD.EntryYesNo, DataElement.DataPeriodTypeID 
+        FROM SemiPermanentDataArchive AS SPD, DataElement 
+        WHERE SPD.DataElementID = DataElement.DataElementID
 	</select>
   
     <select id="getSemiPermanentDataValuesLastUpdated" parameterClass="java.util.Date" resultMap="semiPermanentDataValueResultMap">
-        SELECT SemiPermanentData.DataElementID, SemiPermanentData.ValidFrom, SemiPermanentData.ValidTo, 
-        SemiPermanentData.OrgUnitID, SemiPermanentData.EntryNumber, SemiPermanentData.EntryYesNo, DataElement.DataPeriodTypeID 
-        FROM SemiPermanentData, DataElement 
-        WHERE SemiPermanentData.DataElementID = DataElement.DataElementID 
-        AND LastUpdated > #value#
+        SELECT SPD.DataElementID, SPD.ValidFrom, SPD.ValidTo, 
+        SPD.OrgUnitID, SPD.EntryNumber, SPD.EntryYesNo, DataElement.DataPeriodTypeID 
+        FROM SemiPermanentData AS SPD, DataElement 
+        WHERE SPD.DataElementID = DataElement.DataElementID 
+        AND SPD.LastUpdated > #value#
+        UNION
+        SELECT SPD.DataElementID, SPD.ValidFrom, SPD.ValidTo, 
+        SPD.OrgUnitID, SPD.EntryNumber, SPD.EntryYesNo, DataElement.DataPeriodTypeID 
+        FROM SemiPermanentDataArchive AS SPD, DataElement 
+        WHERE SPD.DataElementID = DataElement.DataElementID 
+        AND SPD.LastUpdated > #value#
     </select>
   
     <select id="getSemiPermanentDataValuesOutOfRange" resultClass="java.lang.Integer">
-		SELECT COUNT(*) FROM SemiPermanentData WHERE EntryNumber > 2147483647
+		SELECT COUNT(*) FROM SemiPermanentData WHERE EntryNumber > 2147483647 UNION
+		SELECT COUNT(*) FROM SemiPermanentDataArchive WHERE EntryNumber > 2147483647
 	</select>
   
 </sqlMap>