dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07324
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2074: Mysql query fixed. Typo fixed.
------------------------------------------------------------
revno: 2074
committer: Quang <Quang@Quang-PC>
branch nick: trunk
timestamp: Mon 2010-09-06 22:22:49 +0700
message:
Mysql query fixed. Typo fixed.
modified:
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datamerge/jdbc/JdbcDataMergeStore.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.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/datamerge/jdbc/JdbcDataMergeStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datamerge/jdbc/JdbcDataMergeStore.java 2010-08-31 15:58:23 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datamerge/jdbc/JdbcDataMergeStore.java 2010-09-06 15:22:49 +0000
@@ -75,7 +75,7 @@
// Update destination with source where source is last update
- sql = statementBuilder.getUpdateDateDestination( destDataElementId, destCategoryOptionComboId, sourceDataElementId, sourceCategoryOptionComboId );
+ sql = statementBuilder.getUpdateDestination( destDataElementId, destCategoryOptionComboId, sourceDataElementId, sourceCategoryOptionComboId );
log.info( sql );
jdbcTemplate.execute( sql );
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2010-08-31 15:58:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2010-09-06 15:22:49 +0000
@@ -110,6 +110,6 @@
String getMoveFromSourceToDestination( int destDataElementId, int destCategoryOptionComboId,
int sourceDataElementId, int sourceCategoryOptionComboId );
- String getUpdateDateDestination( int destDataElementId, int destCategoryOptionComboId,
+ String getUpdateDestination( int destDataElementId, int destCategoryOptionComboId,
int sourceDataElementId, int sourceCategoryOptionComboId );
}
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java 2010-08-31 15:58:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java 2010-09-06 15:22:49 +0000
@@ -156,7 +156,7 @@
}
@Override
- public String getUpdateDateDestination( int destDataElementId, int destCategoryOptionComboId,
+ public String getUpdateDestination( int destDataElementId, int destCategoryOptionComboId,
int sourceDataElementId, int sourceCategoryOptionComboId )
{
return "UPDATE datavalue AS d1 SET dataelementid=" + destDataElementId + ", categoryoptioncomboid="
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2010-08-31 15:58:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2010-09-06 15:22:49 +0000
@@ -154,7 +154,7 @@
@Override
- public String getUpdateDateDestination( int destDataElementId, int destCategoryOptionComboId,
+ public String getUpdateDestination( int destDataElementId, int destCategoryOptionComboId,
int sourceDataElementId, int sourceCategoryOptionComboId )
{
return "UPDATE datavalue AS d1 SET dataelementid=" + destDataElementId + ", categoryoptioncomboid="
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2010-08-31 15:58:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2010-09-06 15:22:49 +0000
@@ -155,15 +155,16 @@
}
@Override
- public String getUpdateDateDestination( int destDataElementId, int destCategoryOptionComboId,
+ public String getUpdateDestination( int destDataElementId, int destCategoryOptionComboId,
int sourceDataElementId, int sourceCategoryOptionComboId )
{
- return "UPDATE datavalue AS d1 SET dataelementid=" + destDataElementId + ", categoryoptioncomboid="
- + destCategoryOptionComboId + " " + "WHERE dataelementid=" + sourceDataElementId
- + " and categoryoptioncomboid=" + sourceCategoryOptionComboId + " " + "AND NOT EXISTS ( "
- + "SELECT * FROM (SELECT * FROM datavalue) AS d2 " + "WHERE d2.dataelementid=" + destDataElementId + " "
- + "AND d2.categoryoptioncomboid=" + destCategoryOptionComboId + " " + "AND d1.periodid=d2.periodid "
- + "AND d1.sourceid=d2.sourceid );";
+
+ return "UPDATE datavalue d1 LEFT JOIN datavalue d2 ON d2.dataelementid = " + destDataElementId
+ + " AND d2.categoryoptioncomboid = " + destCategoryOptionComboId
+ + " AND d1.periodid = d2.periodid AND d1.sourceid = d2.sourceid SET d1.dataelementid = "
+ + destDataElementId + ", d1.categoryoptioncomboid = " + destCategoryOptionComboId
+ + " WHERE d1.dataelementid = " + sourceDataElementId + " AND d1.categoryoptioncomboid = "
+ + sourceCategoryOptionComboId + " AND d2.dataelementid IS NULL";
}
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2010-08-31 15:58:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2010-09-06 15:22:49 +0000
@@ -156,7 +156,7 @@
}
@Override
- public String getUpdateDateDestination( int destDataElementId, int destCategoryOptionComboId,
+ public String getUpdateDestination( int destDataElementId, int destCategoryOptionComboId,
int sourceDataElementId, int sourceCategoryOptionComboId )
{
return "UPDATE datavalue AS d1 SET dataelementid=" + destDataElementId + ", categoryoptioncomboid="