【问题标题】:jhat OQL AND in where clausejhat OQL AND 在 where 子句中
【发布时间】:2012-02-08 15:21:48
【问题描述】:

jhat OQL where 子句中如何做连词[AND]?

我想这样做:

select s from sun.security.x509.X500Name s where  s.canonicalDn !=null and    
/tiberium/(s.canonicalDn.toString())

也就是说,我想在其 canonicaldn 中找到所有包含 appTrust 的 X500Name。我需要 null 检查,因为一些 canonicaldn 可以为 null [并且 jhat 在这种情况下会在 toString 处引发空指针异常]。

但字面上的“和”不起作用。

顺便说一句,我使用过滤功能解决了这个问题:

select filter(heap.objects("sun.security.x509.X500Name"), isTiberium);

function isTiberium(s) {  
    return s.canonicalDn !=null && /tiberium/(s.canonicalDn.toString());  
}

【问题讨论】:

    标签: java jhat


    【解决方案1】:

    我发现“and”是 && 因为那是 javascript 和运算符。那就是正确的表达方式很简单:

    select s from sun.security.x509.X500Name s where  s.canonicalDn !=null &&    
    /tiberium/(s.canonicalDn.toString())
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-23
      • 1970-01-01
      • 2021-02-02
      • 1970-01-01
      • 2011-08-26
      • 1970-01-01
      • 1970-01-01
      • 2017-05-02
      相关资源
      最近更新 更多