[英]As we are writing %like% in SQL to match some details, how we can implement the %like% in gosu query?
var pp = gw.api.database.Query.make(entity.PolicyPeriod)
What is the syntax we can use for %like% which we have already been used in SQL to match elements? 什么是我们可以用于%like%的语法,我们已经在SQL中使用它来匹配元素?
Please help me to find the implementation 请帮我找实施
You can use contains function with 3 parameters, first the Column, second the input value and third a boolean value to ignoreCase (true for denorm the input and column value). 您可以使用包含3个参数的contains函数,首先是Column,第二个是输入值,第三个是一个boolean值来ignoreCase(对于denorm输入和列值,为true)。
Query.make(PolicyPeriod).contains(PolicyPeriod#PolicyNumber, "123A", true)
Query.make(PolicyPeriod).contains(PolicyPeriod#PolicyNumber,“123A”,true)
Produces 产生
[%123a%]
[%123A%]
SELECT FROM bc_policyperiod gRoot WHERE gRoot.PolicyNumberDenorm LIKE ?
SELECT FROM bc_policyperiod gRoot WHERE gRoot.PolicyNumberDenorm LIKE? AND gRoot.Retired = 0
AND gRoot.Retired = 0
您可以使用上面提到的.contains,并且还有.startsWith(),它将在SQL中执行与LIKE%文本相同的操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.