dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38843
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19737: Event analytics tables. Using integer column types with values (1, 0, null) for booleans instead of...
------------------------------------------------------------
revno: 19737
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-08-06 22:36:58 +0200
message:
Event analytics tables. Using integer column types with values (1,0,null) for booleans instead of text.
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.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-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2015-06-22 09:21:54 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2015-08-06 20:36:58 +0000
@@ -380,7 +380,8 @@
}
/**
- * Returns the database column type based on the given value type.
+ * Returns the database column type based on the given value type. For boolean
+ * values, 1 means true, 0 means false and null means no value.
*/
private String getColumnType( ValueType valueType )
{
@@ -392,6 +393,10 @@
{
return "integer";
}
+ else if ( Boolean.class.equals( valueType.getJavaClass() ) )
+ {
+ return "integer";
+ }
else
{
return "character varying(255)";
@@ -412,6 +417,10 @@
{
return "cast(value as integer)";
}
+ else if ( Boolean.class.equals( valueType.getJavaClass() ) )
+ {
+ return "case when value = 'true' then 1 when value = 'false' then 0 else null end";
+ }
else
{
return "value";