Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSS] Unable to reuse same parameter in query #4558

Closed
milindaperera opened this issue Aug 1, 2019 · 1 comment · Fixed by wso2/carbon-data#282 or wso2/product-micro-integrator#2182

Comments

@milindaperera
Copy link
Contributor

Description:
Unable to reuse same parameter multiple times in same query.

Eaxmple:

<query id="GetEmpNotWork" useConfig="Datasource">
      <sql>select EM.EmployeeNumber, EM.FirstName, EM.LastName, EM.Email, EM.Salary from Employees EM where EM.EmployeeNumber=:EmployeeNumber and EM.EmployeeNumber=:EmployeeNumber order by EM.FirstName</sql>
      <result element="Entries" rowName="Entry">
         <element column="EmployeeNumber" name="EmployeeNumber" xsdType="string"/>
         <element column="FirstName" name="FirstName" xsdType="string"/>
         <element column="LastName" name="LastName" xsdType="string"/>
         <element column="Email" name="Email" xsdType="string"/>
         <element column="Salary" name="Salary" xsdType="string"/>
      </result>
      <param name="EmployeeNumber" sqlType="STRING"/>
   </query>

This works fine with EI 6.4.0, but fails in 6.5.0

Error:

DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processPreNormalQuery': null
DS Code: DATABASE_ERROR
Source Data Service:-
Name: AccountDetailsService
Location: /AccountDetailsService.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: GetCustaNotWork
Current Params: {EmployeeNumber=3}
Nested Exception:-
java.lang.NullPointerException


	at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:75)
	at org.wso2.carbon.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:359)
	at org.wso2.carbon.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:41)
	at org.wso2.carbon.dataservices.core.DBInOutMessageReceiver.invokeBusinessLogic(DBInOutMessageReceiver.java:82)
	at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
	at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
	at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:415)
	at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:152)
	at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
GDLMadushanka added a commit to GDLMadushanka/micro-integrator that referenced this issue Mar 25, 2021
Fix inability to reuse the same parameter in a query
Fixes wso2/product-ei/issues/4558
GDLMadushanka added a commit to GDLMadushanka/micro-integrator that referenced this issue Mar 26, 2021
Fix inability to reuse the same parameter in a query
Fixes wso2/product-ei/issues/4558
GDLMadushanka added a commit to GDLMadushanka/micro-integrator that referenced this issue Mar 26, 2021
Add integration tests for duplicate parameters in the dataservice query.
Related to wso2/product-ei/issues/4558
GDLMadushanka added a commit to GDLMadushanka/micro-integrator that referenced this issue Mar 26, 2021
Add integration tests for duplicate parameters in the dataservice query.
Related to wso2/product-ei/issues/4558
@robchur
Copy link

robchur commented Apr 1, 2023

Problem exists in 7.1.0, did not exist in 6.1.1

Same error is thrown.

By removing the second instances the error does not occour.

SELECT
smssubscribernumber,
(
SELECT UpdateMessage
FROM wp_database.wp_SMSSubscriberUpdateMessages
WHERE LocationID = :idlocation and NRUCMD = :smscommand and Active = 'Yes' OR Active = 'Once'
ORDER BY RAND()
LIMIT 1
) as UpdateMessage

FROM wp_smssubscriptions_v2
WHERE LocationID = :idlocation and smscommand = :smscommand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants