"JOIN periodtype AS pt USING (periodtypeid) " + is in trunk..
"JOIN periodtype AS pt ON (pe.periodtypeid=pt.periodtypeid) " is in 2.0.5 This should fix both. === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java 2010-09-21 00:33:06 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java 2010-11-23 08:32:45 +0000 @@ -168,16 +169,17 @@ statementBuilder.encode( categoryOptionCombo.getName() ) + " AS categoryoptioncomboname " + //TODO join? "FROM period AS pe " + "JOIN periodtype AS pt ON (pe.periodtypeid=pt.periodtypeid) " + - "WHERE periodid IN (" + periodIds + ") " + - "AND periodtypeid='" + dataElement.getPeriodType().getId() + "' " + - "AND periodid NOT IN ( " + - "SELECT periodid FROM datavalue " + + "WHERE pe.periodid IN (" + periodIds + ") " + + "AND pe.periodtypeid='" + dataElement.getPeriodType().getId() + "' " + + "AND pe.periodid NOT IN ( " + + "SELECT DISTINCT periodid FROM datavalue " + "WHERE dataelementid='" + dataElement.getId() + "' " + "AND categoryoptioncomboid='" + categoryOptionCombo.getId() + "' " + "AND sourceid='" + organisationUnit.getId() + "' )"; -- Gap analysis throws SQL syntax error exception https://bugs.launchpad.net/bugs/633156 You received this bug notification because you are a member of DHIS 2 developers, which is subscribed to DHIS. Status in DHIS 2 - District Health Information Software: Confirmed Bug description: When running Gap Analysis (in Data Quality) I got a SQL syntax error exception (H2 database). See About DHIS2 info and stacktrace below. Current user: admin Version: 2.0.6-SNAPSHOT Build revision: 2080 Build date: 2010-09-08 08:19 User agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 External configuration directory: D:\tools\dhis2-live\conf Environment variable: DHIS2_HOME Database type: H2 Database name: dhis2_demo;AUTO_SERVER=TRUE Database user: sa Java Opts: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=768m Java version: 1.6.0_21 Java vendor: Sun Microsystems Inc. OS name: Windows 7 OS architecture: amd64 OS version: 6.1 Exception: * ERROR 14:56:10,188 Error while executing action (ExceptionInterceptor.java [1177016...@qtp-2138081422-21]) java.lang.RuntimeException: Failed to get deflated data values at org.hisp.dhis.dataanalysis.jdbc.JdbcDataAnalysisStore.getDeflatedDataValueGaps(JdbcDataAnalysisStore.java:179) at org.hisp.dhis.dataanalysis.GapAnalysisService.analyse(GapAnalysisService.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) at org.hisp.dhis.jdbc.StatementInterceptor.intercept(StatementInterceptor.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy51.analyse(Unknown Source) at org.hisp.dhis.validationrule.action.dataanalysis.GetAnalysisAction.execute(GetAnalysisAction.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243) at org.hisp.dhis.webportal.interceptor.XWorkPortalUserInterceptor.intercept(XWorkPortalUserInterceptor.java:82) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.webportal.interceptor.XWorkPortalModuleInterceptor.intercept(XWorkPortalModuleInterceptor.java:85) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.webportal.interceptor.XWorkPortalMenuInterceptor.intercept(XWorkPortalMenuInterceptor.java:91) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.webportal.interceptor.XWorkPortalParamsInterceptor.intercept(XWorkPortalParamsInterceptor.java:117) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.ContextInterceptor.intercept(ContextInterceptor.java:67) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.StyleInterceptor.intercept(StyleInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.SystemSettingInterceptor.intercept(SystemSettingInterceptor.java:103) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.DataDictionaryModeInterceptor.intercept(DataDictionaryModeInterceptor.java:109) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.DisplayPropertyInterceptor.intercept(DisplayPropertyInterceptor.java:90) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.SortOrderInterceptor.intercept(SortOrderInterceptor.java:124) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.security.intercept.XWorkSecurityInterceptor.intercept(XWorkSecurityInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.hisp.dhis.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1139) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343) at org.hisp.dhis.security.filter.RequiredLoginFilter.doFilter(RequiredLoginFilter.java:129) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:112) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1139) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1139) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:378) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT '212' AS DATAELEMENTID, PE.PERIODID, '2' AS SOURCEID, '42' AS CATEGORYOPTIONCOMBOID, '' AS VALUE, '' AS STOREDBY, '1900-01-01' AS LASTUPDATED, '' AS COMMENT, FALSE AS FOLLOWUP, ( SELECT MINVALUE FROM MINMAXDATAELEMENT WHERE SOURCEID=' 2' AND DATAELEMENTID='212' AND CATEGORYOPTIONCOMBOID='42' ) AS MINVALUE, ( SELECT MAXVALUE FROM MINMAXDATAELEMENT WHERE SOURCEID=' 2' AND DATAELEMENTID='212' AND CATEGORYOPTIONCOMBOID='42' ) AS MAXVALUE, 'STI - Genital Ulcer referrals' AS DATAELEMENTNAME, PT.NAME AS PERIODTYPENAME, PE.STARTDATE, PE.ENDDATE, 'Bo' AS SOURCENAME, '(0-4y)' AS CATEGORYOPTIONCOMBONAME FROM PERIOD AS PE JOIN PERIODTYPE AS PT USING[*] (PERIODTYPEID) WHERE PERIODID IN (5, 25, 26, 27, 28) AND PERIODTYPEID='3' AND PERIODID NOT IN ( SELECT PERIODID FROM DATAVALUE WHERE DATAELEMENTID='212' AND CATEGORYOPTIONCOMBOID='42' AND SOURCEID='2' ) "; SQL statement: SELECT '212' AS dataelementid, pe.periodid, '2' AS sourceid, '42' AS categoryoptioncomboid, '' AS value, '' AS storedby, '1900-01-01' AS lastupdated, '' AS comment, false AS followup, ( SELECT minvalue FROM minmaxdataelement WHERE sourceid=' 2' AND dataelementid='212' AND categoryoptioncomboid='42' ) AS minvalue, ( SELECT maxvalue FROM minmaxdataelement WHERE sourceid=' 2' AND dataelementid='212' AND categoryoptioncomboid='42' ) AS maxvalue, 'STI - Genital Ulcer referrals' AS dataelementname, pt.name AS periodtypename, pe.startdate, pe.enddate, 'Bo' AS sourcename, '(0-4y)' AS categoryoptioncomboname FROM period AS pe JOIN periodtype AS pt USING (periodtypeid) WHERE periodid IN (5, 25, 26, 27, 28) AND periodtypeid='3' AND periodid NOT IN ( SELECT periodid FROM datavalue WHERE dataelementid='212' AND categoryoptioncomboid='42' AND sourceid='2' ) [42000-136] at org.h2.message.DbException.getJdbcSQLException(DbException.java:327) at org.h2.message.DbException.get(DbException.java:167) at org.h2.message.DbException.get(DbException.java:144) at org.h2.message.DbException.getSyntaxError(DbException.java:179) at org.h2.command.Parser.getSyntaxError(Parser.java:474) at org.h2.command.Parser.prepareCommand(Parser.java:238) at org.h2.engine.Session.prepareLocal(Session.java:420) at org.h2.engine.Session.prepareCommand(Session.java:381) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1071) at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:70) at org.hisp.dhis.dataanalysis.jdbc.JdbcDataAnalysisStore.getDeflatedDataValueGaps(JdbcDataAnalysisStore.java:173) ... 102 more _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp