首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mule 3.9.1数据库参数化-查询不返回数据

Mule 3.9.1数据库参数化-查询不返回数据
EN

Stack Overflow用户
提问于 2019-01-07 21:28:26
回答 1查看 366关注 0票数 0

我有以下流参考:<flow name="getAccountsFlow"> <logger message="Type:&quot;#[message.inboundProperties.'http.query.params'.type]&quot;" level="INFO" doc:name="Logger"/> <db:select config-ref="MySQL_Configuration" doc:name="Database"> <db:parameterized-query><![CDATA[select * from flights_customers where accountType = "#[message.inboundProperties.'http.query.params'.type]"]]></db:parameterized-query> </db:select> </flow>

记录器打印变量值:INFO 2019-01-07 16:08:51,270 [[assignment-accounts].accounts-api-httpListenerConfig.worker.03] org.mule.api.processor.LoggerMessageProcessor: Type:"business"

但是查询返回0行。

但是,当我使用变量转换器时,则可以在查询中以下列形式访问值:<flow name="getAccountsFlow"> <logger message="Type:&quot;#[message.inboundProperties.'http.query.params'.type]&quot;" level="INFO" doc:name="Logger"/> <set-variable variableName="type" value="#[message.inboundProperties.'http.query.params'.type]" doc:name="Variable"/> <db:select config-ref="MySQL_Configuration" doc:name="Database"> <db:parameterized-query><![CDATA[select * from flights_customers where accountType = :type]]></db:parameterized-query> <db:in-param name="type" type="VARCHAR" value="#[flowVars.type]" ></db:in-param> </db:select> </flow>

为什么#[message.inboundProperties.'http.query.params'.type]在查询中不可见?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-08 09:33:25

这是因为查询中表达式周围有双引号。试着移除那些。

但是使用占位符是比较安全的,因为不管怎么说,我还是会使用第二个例子。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54082155

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档