Skip to content

Commit

Permalink
Update if statement to switch statement for easier readability
Browse files Browse the repository at this point in the history
  • Loading branch information
haynescd committed Mar 13, 2023
1 parent 66324a8 commit 8669d99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@

<select id="getPatientsDistinctClinicalEventInStudies" resultType="org.cbioportal.model.ClinicalEvent">
SELECT
<if test="_databaseId == 'mysql'">
<choose>
<when test="_databaseId == 'mysql'">
ANY_VALUE(clinical_event.CLINICAL_EVENT_ID) AS clinicalEventId,
</if>
<if test="_databaseId != 'mysql'">
</when>
<when test="_databaseId == 'h2'">
clinical_event.CLINICAL_EVENT_ID AS clinicalEventId,
</if>
</when>
</choose>
clinical_event.EVENT_TYPE AS eventType,
patient.STABLE_ID AS patientId
<include refid="from"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@
<property name="url" value="jdbc:h2:mem:;MODE=MySQL;DATABASE_TO_UPPER=false;INIT=RUNSCRIPT FROM 'classpath:cgds-test.sql'\;RUNSCRIPT FROM 'classpath:testSql.sql'"/>
</bean>

<bean id="databaseIdProvider" class="org.apache.ibatis.mapping.VendorDatabaseIdProvider">
<property name="properties">
<props>
<prop key="MySQL">mysql</prop>
<prop key="H2">h2</prop>
</props>
</property>
</bean>

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dbcpDataSource"/>
<property name="typeAliasesPackage" value="org.mskcc.cbio.portal.model"/>
<property name="typeHandlersPackage" value="org.cbioportal.persistence.mybatis.typehandler"/>
<property name="databaseIdProvider" ref="databaseIdProvider"/>
</bean>

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
Expand Down

0 comments on commit 8669d99

Please sign in to comment.