Bluemix SQLDB 查询 - 无法弄清楚 JSON 参数标记

Bluemix SQLDB Query - Can't figure out JSON Parameter Markings

在我的 Nodered Bluemix 应用程序中,我尝试进行 SqlDB 查询,但我找不到足够的文档或示例来说明如何在查询中使用参数标记。是否有任何示例并进一步了解我做错了什么?这是我遇到问题的流程:

[
    {       
        "id":"7924a83a.03355",
        "type":"websocket-listener",
        "path":"/ws/dbdata",
        "wholemsg":"false"
    },
    {
        "id":"b84efad2.9a2a58",
        "type":"function",
        "name":"Parse JSON",
        "func":"msg.payload = JSON.parse(msg.payload);\nvar begin = msg.payload[0].split(\" \");\nbegin[1] = begin[1]+\":00\";\nvar date1 = begin[0].split(\"-\");\nvar processStart = date1[2]+\"-\"+date1[0]+\"-\"+date1[1]+\" \"+begin[1];\n\nvar end = msg.payload[0].split(\" \");\nend[1] = end[1]+\":00\";\nvar date2 = end[0].split(\"-\");\nvar processEnd = date2[2]+\"-\"+date2[0]+\"-\"+date2[1]+\" \"+end[1];\n\nmsg.payload[0] = processStart;\nmsg.payload[1] = processEnd;\nreturn msg;",
        "outputs":1,"noerr":0,"x":381.79998779296875,"y":164.8000030517578,"z":"3f9da5d2.b3f0aa",
        "wires":[["4f92b16a.cf981"]]
    },
    {
        "id":"3e20f8a4.06451",
        "type":"websocket in",
        "name":"dbInput",
        "server":"7924a83a.03355",
        "client":"",
        "x":159.8000030517578,"y":164.8000030517578,"z":"3f9da5d2.b3f0aa",
        "wires":[["b84efad2.9a2a58"]]
    },
    {
        "id":"68a4a35.5983f5c",
        "type":"debug",
        "name":"",
        "active":true,"console":"false",
        "complete":"true",
        "x":970.7999877929688,"y":162.8000030517578,"z":"3f9da5d2.b3f0aa",
        "wires":[]
    },
    {
        "id":"5a0aed1c.34279c",
        "type":"sqldb in",
        "service":"LabSensors-sqldb",
        "query":"",
        "params":"{msg.begin},{msg.end}",
        "name":"db Request",
        "x":787.7999877929688,"y":163.8000030517578,"z":"3f9da5d2.b3f0aa",
        "wires":[["68a4a35.5983f5c"]]
    },
    {
        "id":"e08c4a85.e95e68",
        "type":"debug",
        "name":"",
        "active":true,"console":"false",
        "complete":"true",
        "x":791.7999877929688,"y":233.8000030517578,"z":"3f9da5d2.b3f0aa",
        "wires":[]
    },
    {
        "id":"4f92b16a.cf981",
        "type":"function",
        "name":"Construct Query",
        "func":"msg.begin = msg.payload[0];\nmsg.end = msg.payload[1];\nmsg.payload = \"SELECT * FROM IOT WHERE TIME >= '?' AND TIME < '?'\";\nreturn msg;",
        "outputs":1,"noerr":0,"x":583.7999877929688,"y":163.8000030517578,"z":"3f9da5d2.b3f0aa",
        "wires":[["5a0aed1c.34279c",
        "e08c4a85.e95e68"]]
    }
]

在 SQLDB 查询节点的节点红色文档中说:

"参数标记 是逗号分隔的一组 json 路径。这些将替换您在查询中放置的任何问号,按它们出现的顺序."

您是否尝试过删除花括号,即将节点中的 "params" 字段设置为 "msg.begin,msg.end"?

你只需要删除单引号这是一个正确的句子:

msg.payload = "SELECT * FROM IOT WHERE TIME >= ? AND TIME < ?";