dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00579
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 162: Slight optimization of the StatementBuilders regarding object creation.
------------------------------------------------------------
revno: 162
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-04-07 16:11:30 +0200
message:
Slight optimization of the StatementBuilders regarding object creation.
modified:
dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AbstractBatchHandler.java
dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java
dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AbstractBatchHandler.java'
--- dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AbstractBatchHandler.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AbstractBatchHandler.java 2009-04-07 14:11:30 +0000
@@ -186,7 +186,7 @@
{
try
{
- String sql = getUpdateSqlStatement( object );
+ final String sql = getUpdateSqlStatement( object );
statement.executeUpdate( sql );
}
@@ -200,7 +200,7 @@
{
try
{
- String sql = getUniquenessStatement( objectName );
+ final String sql = getUniquenessStatement( objectName );
ResultSet resultSet = statement.executeQuery( sql );
@@ -216,7 +216,7 @@
{
try
{
- String sql = getIdentifierStatement( objectName );
+ final String sql = getIdentifierStatement( objectName );
ResultSet resultSet = statement.executeQuery( sql );
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java'
--- dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java 2009-04-03 13:27:40 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java 2009-04-07 14:11:30 +0000
@@ -56,7 +56,7 @@
public String getInsertStatementOpening( String table )
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "INSERT INTO " + table + " (" );
@@ -79,14 +79,12 @@
public String getNoColumnInsertStatementOpening( String table )
{
- String sql = "INSERT INTO " + table + " VALUES ";
-
- return sql;
+ return "INSERT INTO " + table + " VALUES ";
}
public String getInsertStatementValues()
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( BRACKET_START );
@@ -109,7 +107,7 @@
public String getUpdateStatement( String table )
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "UPDATE " + table + " SET " );
@@ -136,23 +134,19 @@
public String getValueStatement( String table, String returnField, String compareField, String value )
{
- String sql = "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
-
- return sql;
+ return "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
}
public String getValueStatement( String table, String returnField1, String returnField2, String compareField1, String value1, String compareField2, String value2 )
{
- String sql = "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
-
- return sql;
+ return "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
}
public String getValueStatement( String table, String returnField, Map<String, String> fieldMap, boolean union )
{
- String operator = union ? " AND " : " OR ";
+ final String operator = union ? " AND " : " OR ";
- StringBuffer sqlBuffer = new StringBuffer();
+ final StringBuffer sqlBuffer = new StringBuffer();
sqlBuffer.append( "SELECT " ).append( returnField ).append( " FROM " ).append( table ).append( " WHERE " );
for ( Entry<String, String> entry : fieldMap.entrySet() )
@@ -168,24 +162,21 @@
public String getDoubleColumnType()
{
- String type = "DOUBLE";
-
- return type;
+ return "DOUBLE";
}
public String getPeriodIdentifierStatement( Period period )
{
- String sql =
+ return
"SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " +
"AND startdate='" + getDateString( period.getStartDate() ) + "' " +
"AND enddate='" + getDateString( period.getEndDate() ) + "'";
-
- return sql;
}
public String getCreateAggregatedDataValueTable()
{
- String sql = "CREATE TABLE aggregateddatavalue ( " +
+ return
+ "CREATE TABLE aggregateddatavalue ( " +
"dataelementid INTEGER, " +
"categoryoptioncomboid INTEGER, " +
"periodid INTEGER, " +
@@ -193,13 +184,12 @@
"periodtypeid INTEGER, " +
"level INTEGER, " +
"value DOUBLE );";
-
- return sql;
}
public String getCreateAggregatedIndicatorTable()
{
- String sql = "CREATE TABLE aggregatedindicatorvalue ( " +
+ return
+ "CREATE TABLE aggregatedindicatorvalue ( " +
"indicatorid INTEGER, " +
"periodid INTEGER, " +
"organisationunitid INTEGER, " +
@@ -210,13 +200,12 @@
"value DOUBLE, " +
"numeratorvalue DOUBLE, " +
"denominatorvalue DOUBLE );";
-
- return sql;
}
public String getCreateDataSetCompletenessTable()
{
- String sql = "CREATE TABLE aggregateddatasetcompleteness ( " +
+ return
+ "CREATE TABLE aggregateddatasetcompleteness ( " +
"datasetid INTEGER, " +
"periodid INTEGER, " +
"periodname VARCHAR( 30 ), " +
@@ -227,40 +216,32 @@
"registrationsOnTime INTEGER, " +
"value DOUBLE, " +
"valueOnTime DOUBLE );";
-
- return sql;
}
public String getCreateDataValueIndex()
{
- String sql =
+ return
"CREATE INDEX crosstab " +
"ON datavalue ( periodid, sourceid );";
-
- return sql;
}
public String getDeleteRelativePeriods()
{
- String sql =
+ return
"DELETE FROM period " +
"USING period, periodtype " +
"WHERE period.periodtypeid = periodtype.periodtypeid " +
"AND periodtype.name = '" + RelativePeriodType.NAME + "';";
-
- return sql;
}
public String getDeleteZeroDataValues()
{
- String sql =
+ return
"DELETE FROM datavalue " +
"USING datavalue, dataelement " +
"WHERE datavalue.dataelementid = dataelement.dataelementid " +
"AND dataelement.aggregationtype = 'sum' " +
"AND datavalue.value IN ( '0', '0.', '.0', '0.0' )";
-
- return sql;
}
public int getMaximumNumberOfColumns()
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2009-04-07 12:41:32 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2009-04-07 14:11:30 +0000
@@ -56,7 +56,7 @@
public String getInsertStatementOpening( String table )
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "INSERT INTO " + table + " (" );
@@ -79,14 +79,12 @@
public String getNoColumnInsertStatementOpening( String table )
{
- String sql = "INSERT INTO " + table + " VALUES ";
-
- return sql;
+ return "INSERT INTO " + table + " VALUES ";
}
public String getInsertStatementValues()
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( BRACKET_START );
@@ -109,7 +107,7 @@
public String getUpdateStatement( String table )
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "UPDATE " + table + " SET " );
@@ -136,23 +134,19 @@
public String getValueStatement( String table, String returnField, String compareField, String value )
{
- String sql = "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
-
- return sql;
+ return "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
}
public String getValueStatement( String table, String returnField1, String returnField2, String compareField1, String value1, String compareField2, String value2 )
{
- String sql = "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
-
- return sql;
+ return "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
}
public String getValueStatement( String table, String returnField, Map<String, String> fieldMap, boolean union )
{
- String operator = union ? " AND " : " OR ";
+ final String operator = union ? " AND " : " OR ";
- StringBuffer sqlBuffer = new StringBuffer();
+ final StringBuffer sqlBuffer = new StringBuffer();
sqlBuffer.append( "SELECT " ).append( returnField ).append( " FROM " ).append( table ).append( " WHERE " );
for ( Entry<String, String> entry : fieldMap.entrySet() )
@@ -160,8 +154,7 @@
sqlBuffer.append( entry.getKey() ).append( "='" ).append( sqlEncode( entry.getValue() ) ).append( "'" ).append( operator );
}
- String sql = sqlBuffer.toString();
-
+ String sql = sqlBuffer.toString();
sql = sql.substring( 0, sql.length() - operator.length() );
return sql;
@@ -169,24 +162,20 @@
public String getDoubleColumnType()
{
- String type = "DOUBLE";
-
- return type;
+ return "DOUBLE";
}
public String getPeriodIdentifierStatement( Period period )
{
- String sql =
+ return
"SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " +
"AND startdate='" + getDateString( period.getStartDate() ) + "' " +
"AND enddate='" + getDateString( period.getEndDate() ) + "'";
-
- return sql;
}
public String getCreateAggregatedDataValueTable()
{
- String sql =
+ return
"CREATE TABLE aggregateddatavalue ( " +
"dataelementid INTEGER, " +
"categoryoptioncomboid INTEGER, " +
@@ -195,13 +184,11 @@
"periodtypeid INTEGER, " +
"level INTEGER, " +
"value DOUBLE );";
-
- return sql;
}
public String getCreateAggregatedIndicatorTable()
{
- String sql =
+ return
"CREATE TABLE aggregatedindicatorvalue ( " +
"indicatorid INTEGER, " +
"periodid INTEGER, " +
@@ -213,13 +200,12 @@
"value DOUBLE, " +
"numeratorvalue DOUBLE, " +
"denominatorvalue DOUBLE );";
-
- return sql;
}
public String getCreateDataSetCompletenessTable()
{
- String sql = "CREATE TABLE aggregateddatasetcompleteness ( " +
+ return
+ "CREATE TABLE aggregateddatasetcompleteness ( " +
"datasetid INTEGER, " +
"periodid INTEGER, " +
"periodname VARCHAR( 30 ), " +
@@ -230,37 +216,29 @@
"registrationsOnTime INTEGER, " +
"value DOUBLE, " +
"valueOnTime DOUBLE );";
-
- return sql;
}
public String getCreateDataValueIndex()
{
- String sql =
+ return
"CREATE INDEX crosstab " +
"ON datavalue ( periodid, sourceid );";
-
- return sql;
}
public String getDeleteRelativePeriods()
{
- String sql =
+ return
"DELETE FROM period " +
"USING periodtype " +
"WHERE period.periodtypeid = periodtype.periodtypeid " +
"AND periodtype.name = '" + RelativePeriodType.NAME + "';";
-
- return sql;
}
public String getDeleteZeroDataValues()
{
- String sql =
+ return
"DELETE FROM datavalue " +
"WHERE datavalue.value IN ( '0', '0.', '.0', '0.0', ' 0', '0 ', '0 0' )";
-
- return sql;
}
public int getMaximumNumberOfColumns()
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2009-03-13 11:51:35 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2009-04-07 14:11:30 +0000
@@ -56,7 +56,7 @@
public String getInsertStatementOpening( String table )
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "INSERT INTO " + table + " (" );
@@ -79,14 +79,12 @@
public String getNoColumnInsertStatementOpening( String table )
{
- String sql = "INSERT INTO " + table + " VALUES ";
-
- return sql;
+ return "INSERT INTO " + table + " VALUES ";
}
public String getInsertStatementValues()
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( BRACKET_START );
@@ -109,7 +107,7 @@
public String getUpdateStatement( String table )
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "UPDATE " + table + " SET " );
@@ -136,23 +134,19 @@
public String getValueStatement( String table, String returnField, String compareField, String value )
{
- String sql = "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
-
- return sql;
+ return "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
}
public String getValueStatement( String table, String returnField1, String returnField2, String compareField1, String value1, String compareField2, String value2 )
{
- String sql = "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
-
- return sql;
+ return "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
}
public String getValueStatement( String table, String returnField, Map<String, String> fieldMap, boolean union )
{
- String operator = union ? " AND " : " OR ";
+ final String operator = union ? " AND " : " OR ";
- StringBuffer sqlBuffer = new StringBuffer();
+ final StringBuffer sqlBuffer = new StringBuffer();
sqlBuffer.append( "SELECT " ).append( returnField ).append( " FROM " ).append( table ).append( " WHERE " );
for ( Entry<String, String> entry : fieldMap.entrySet() )
@@ -168,24 +162,21 @@
public String getDoubleColumnType()
{
- String type = "DOUBLE";
-
- return type;
+ return "DOUBLE";
}
public String getPeriodIdentifierStatement( Period period )
{
- String sql =
+ return
"SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " +
"AND startdate='" + getDateString( period.getStartDate() ) + "' " +
"AND enddate='" + getDateString( period.getEndDate() ) + "'";
-
- return sql;
}
public String getCreateAggregatedDataValueTable()
{
- String sql = "CREATE TABLE aggregateddatavalue ( " +
+ return
+ "CREATE TABLE aggregateddatavalue ( " +
"dataelementid INTEGER, " +
"categoryoptioncomboid INTEGER, " +
"periodid INTEGER, " +
@@ -193,13 +184,12 @@
"periodtypeid INTEGER, " +
"level INTEGER, " +
"value DOUBLE );";
-
- return sql;
}
public String getCreateAggregatedIndicatorTable()
{
- String sql = "CREATE TABLE aggregatedindicatorvalue ( " +
+ return
+ "CREATE TABLE aggregatedindicatorvalue ( " +
"indicatorid INTEGER, " +
"periodid INTEGER, " +
"organisationunitid INTEGER, " +
@@ -210,13 +200,12 @@
"value DOUBLE, " +
"numeratorvalue DOUBLE, " +
"denominatorvalue DOUBLE );";
-
- return sql;
}
public String getCreateDataSetCompletenessTable()
{
- String sql = "CREATE TABLE aggregateddatasetcompleteness ( " +
+ return
+ "CREATE TABLE aggregateddatasetcompleteness ( " +
"datasetid INTEGER, " +
"periodid INTEGER, " +
"periodname VARCHAR( 30 ), " +
@@ -227,40 +216,32 @@
"registrationsOnTime INTEGER, " +
"value DOUBLE, " +
"valueOnTime DOUBLE );";
-
- return sql;
}
public String getCreateDataValueIndex()
{
- String sql =
+ return
"CREATE INDEX crosstab " +
"ON datavalue ( periodid, sourceid );";
-
- return sql;
}
public String getDeleteRelativePeriods()
{
- String sql =
+ return
"DELETE FROM period " +
"USING period, periodtype " +
"WHERE period.periodtypeid = periodtype.periodtypeid " +
"AND periodtype.name = '" + RelativePeriodType.NAME + "';";
-
- return sql;
}
public String getDeleteZeroDataValues()
{
- String sql =
+ return
"DELETE FROM datavalue " +
"USING datavalue, dataelement " +
"WHERE datavalue.dataelementid = dataelement.dataelementid " +
"AND dataelement.aggregationtype = 'sum' " +
"AND datavalue.value IN ( '0', '0.', '.0', '0.0', ' 0', '0 ', '0 0' )";
-
- return sql;
}
public int getMaximumNumberOfColumns()
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2009-03-13 11:51:35 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2009-04-07 14:11:30 +0000
@@ -65,7 +65,7 @@
columns.add( autoIncrementColumnIndex, autoIncrementColumnName );
}
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "INSERT INTO " + table + " (" );
@@ -88,9 +88,7 @@
public String getNoColumnInsertStatementOpening( String table )
{
- String sql = "INSERT INTO " + table + " VALUES ";
-
- return sql;
+ return "INSERT INTO " + table + " VALUES ";
}
public String getInsertStatementValues()
@@ -100,7 +98,7 @@
values.add( autoIncrementColumnIndex, AUTO_INCREMENT );
}
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( BRACKET_START );
@@ -123,7 +121,7 @@
public String getUpdateStatement( String table )
{
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
buffer.append( "UPDATE " + table + " SET " );
@@ -150,23 +148,19 @@
public String getValueStatement( String table, String returnField, String compareField, String value )
{
- String sql = "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
-
- return sql;
+ return "SELECT " + returnField + " FROM " + table + " WHERE " + compareField + " = '" + sqlEncode( value ) + "'";
}
public String getValueStatement( String table, String returnField1, String returnField2, String compareField1, String value1, String compareField2, String value2 )
{
- String sql = "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
-
- return sql;
+ return "SELECT " + returnField1 + ", " + returnField2 + " FROM " + table + " WHERE " + compareField1 + "='" + sqlEncode( value1 ) + "' AND " + compareField2 + "='" + value2 + "'";
}
public String getValueStatement( String table, String returnField, Map<String, String> fieldMap, boolean union )
{
- String operator = union ? " AND " : " OR ";
+ final String operator = union ? " AND " : " OR ";
- StringBuffer sqlBuffer = new StringBuffer( "SELECT " ).append( returnField ).append( " FROM " ).append( table ).append( " WHERE " );
+ final StringBuffer sqlBuffer = new StringBuffer( "SELECT " ).append( returnField ).append( " FROM " ).append( table ).append( " WHERE " );
for ( Entry<String, String> entry : fieldMap.entrySet() )
{
@@ -181,24 +175,21 @@
public String getDoubleColumnType()
{
- String type = "DOUBLE PRECISION";
-
- return type;
+ return "DOUBLE PRECISION";
}
public String getPeriodIdentifierStatement( Period period )
{
- String sql =
+ return
"SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " +
"AND startdate='" + getDateString( period.getStartDate() ) + "' " +
"AND enddate='" + getDateString( period.getEndDate() ) + "'";
-
- return sql;
}
public String getCreateAggregatedDataValueTable()
{
- String sql = "CREATE TABLE aggregateddatavalue ( " +
+ return
+ "CREATE TABLE aggregateddatavalue ( " +
"dataelementid INTEGER, " +
"categoryoptioncomboid INTEGER, " +
"periodid INTEGER, " +
@@ -206,13 +197,12 @@
"periodtypeid INTEGER, " +
"level INTEGER, " +
"value DOUBLE PRECISION );";
-
- return sql;
}
public String getCreateAggregatedIndicatorTable()
{
- String sql = "CREATE TABLE aggregatedindicatorvalue ( " +
+ return
+ "CREATE TABLE aggregatedindicatorvalue ( " +
"indicatorid INTEGER, " +
"periodid INTEGER, " +
"organisationunitid INTEGER, " +
@@ -223,13 +213,12 @@
"value DOUBLE PRECISION, " +
"numeratorvalue DOUBLE PRECISION, " +
"denominatorvalue DOUBLE PRECISION );";
-
- return sql;
}
public String getCreateDataSetCompletenessTable()
{
- String sql = "CREATE TABLE aggregateddatasetcompleteness ( " +
+ return
+ "CREATE TABLE aggregateddatasetcompleteness ( " +
"datasetid INTEGER, " +
"periodid INTEGER, " +
"periodname VARCHAR( 30 ), " +
@@ -240,40 +229,32 @@
"registrationsOnTime INTEGER, " +
"value DOUBLE PRECISION, " +
"valueOnTime DOUBLE PRECISION );";
-
- return sql;
}
public String getCreateDataValueIndex()
{
- String sql =
+ return
"CREATE INDEX crosstab " +
"ON datavalue ( periodid, sourceid );";
-
- return sql;
}
public String getDeleteRelativePeriods()
{
- String sql =
+ return
"DELETE FROM period " +
"USING periodtype " +
"WHERE period.periodtypeid = periodtype.periodtypeid " +
"AND periodtype.name = '" + RelativePeriodType.NAME + "';";
-
- return sql;
}
public String getDeleteZeroDataValues()
{
- String sql =
+ return
"DELETE FROM datavalue " +
"USING dataelement " +
"WHERE datavalue.dataelementid = dataelement.dataelementid " +
"AND dataelement.aggregationtype = 'sum' " +
"AND datavalue.value IN ( '0', '0.', '.0', '0.0', ' 0', '0 ', '0 0' )";
-
- return sql;
}
public int getMaximumNumberOfColumns()
--
Trunk
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.