【发布时间】:2013-04-30 12:57:33
【问题描述】:
我们有一个非常复杂的查询,我们正在使用 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
在该示例中,我们希望仅获取 @rid 为 #20:34 且“选择”属性为“b”的数据,该属性将返回 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的问题。如果有人能带领我实现我们想要实现的目标,那将是一个很大的帮助。
【问题讨论】:
标签: sql eval orientdb and-operator