我必须使用动态查询来设置数据库查询的架构/库名称,并且 Anypoint Studio 7.4.1 不断抛出错误,指出它“无法解析参数的值:sql”。
我正在关注这个文档https://docs.mulesoft.com/connectors/db/database-connector-examples#dynamic-queries。
当我运行它时它可以正常工作,但是有没有办法让 AnyPoint 停止显示错误?
这是XML
<flow name="GetLinks" doc:id="c1f17deb-98f2-4261-93ec-cf785e310892" >
<set-variable value="${db.dataLibrary}" doc:name="Set Library" doc:id="2a5cebbb-3047-4ede-ab0d-7a7257427e7e" variableName="library"/>
<db:select doc:name="Select EP0001F1" doc:id="ecf2a61f-4e14-4b00-beb1-546d2fa1ba8f" config-ref="Database_Config" fetchSize="100" maxRows="500">
<db:sql >#["select * from $(vars.library).EP0001F1 order by EPDRC desc"]</db:sql>
</db:select>
<ee:transform doc:name="Transform Message" doc:id="c3b8bcb4-20ef-4b86-a4cd-585e7f57e6d0" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload map ( payload01 , indexOfPayload01 ) -> {
loginId: trim(payload01.EPLOGINID),
individualId: trim(payload01.EPIID),
officeNumber: payload01.EPOFID,
controlNumber: payload01.EPICN,
webControlNumber: payload01.EPWCN,
lastUpdatedBy: trim(payload01.EPULU)
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
错误的堆栈跟踪显示
Caused by: org.mule.runtime.core.api.expression.ExpressionRuntimeException: "You called the function '' with these arguments:
1: Null (null)
2: String (".EP0001F1 order by EPDRC desc")
But it expects arguments of these types:
1: String
2: String
Trace:
at main (Unknown)" evaluating expression: ""select * from $(vars.library).EP0001F1 order by EPDRC desc"".
Caused by: org.mule.runtime.api.el.ExpressionExecutionException: You called the function '' with these arguments:
1: Null (null)
2: String (".EP0001F1 order by EPDRC desc")
But it expects arguments of these types:
1: String
2: String
Trace:
at main (Unknown)