我们有一个非常复杂的查询,我们正在使用 eval() 函数来评估一些数据。
但似乎 AND 运算符在 eval() 中没有正确处理。
例如:
if(eval('#20:34 IN out[@class='attempts'].in.@rid AND \'b\' IN out[@class='attempts'].choice'), true, false) as attempt_b
在该示例中,我们期望仅获取#20:34
带有“选择”属性“b”的@rid 和“选择”属性的数据,该属性将返回 true
“out”字段是我们的 SELECT 查询的 $current.@rid 。
这是样本数据:
out ------ in ---- choices
14:3 ---- 20:34 ------ b
14:4 ---- 20:34 ------ a
14:7 ---- 20:34 ------ c
14:8 ---- 20:34 ------ d
前任:if(eval('#20:34 IN out[@class='attempts'].in.@rid AND \'" + choice + "\' IN out[@class='attempts'].choice'), true, false) as attempt_choice
1.)$current.@rid = #14:3 and choice is 'a'
Return Output: true
Expected output: false (since there is no #20:34 with a choice of "A" in current.@rid which is #14:3)
2.)$current.@rid = #14:3 and choice is 'b'
Return Output: true
Expected output: true
3.)$current.@rid = #14:3 and choice is 'c'
Return Output: true
Expected output: false (since there is no #20:34 with a choice of "c" in current.@rid which is #14:3)
4.)$current.@rid = #14:3 and choice is 'd'
Return Output: true
Expected output: false (since there is no #20:34 with a choice of "d" in current.@rid which is #14:3)`
我不知道这只是我们的查询问题还是在orientdb中。如果有人能带领我实现我们想要实现的目标,那将是一个很大的帮助。