在 orientdb 中使用嵌入式地图更新字段时出现问题
Issue with updating field with embedded map in orientdb
我在 orientdb studio(2.1.12) 中有一个 javascript 函数,我试图用 json 更新名为 "node" 的字段,属性 是在 uiJson Document/Class 中输入 embeddedMap。找到下面的代码:
var dt = db.query("SELECT * from uijson");
childUijson = dt[0].getRecord();
node = childUijson.field('node');
print(node )
db.command('update uiJson set node=' + node + 'where @rid=18:1');
return node;
/*Print in oriendb console{0=inputs[{s_type=URL,source=,v_type=java.l,value=http://www.gmail.com}], next={0=1}, label=Open Url, type=OPEN_URL, component=FireFox, screenshot=false,chained=false,flowchartElement=startElement_1,left=0.12737921}}
*/
/*Return statement {
"0": {
"inputs": [
{
"s_type": "URL",
"source": "",
"v_type": "java.lang.String",
"value": "http://localhost:8090/Automaton/"
}
],
"next": {
"0": "1"
},
"label": "Open Url",
"type": "OPEN_URL",
"component": "FireFox",
"screenshot": false,
"chained": false,
"flowchartElement": "startElement_1",
"top": 0.4410876,
"left": 0.12737921
}
"@type": "d",
"@version": 0
}*/
Print 和 return 使用相同的变量 node 。在控制台中打印时,它使用 java object tostring() while returning 它给出了 Json.Please 帮助我用 Json 类型的嵌入式地图更新字段。
Error message {
"errors": [
{
"code": 500,
"reason": 500,
"content": "com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #0: Error parsing query: \nupdate uiJson set node={0={inputs=[{s_type=URL, source=, v_type=java.lang.String, value=http://www.gmail.com/}], next={0=1}, label=Open Url, type=OPEN_URL, component=FireFox, screenshot=false, chained=false, flowchartElement=startElement_1, top=0.4410876, left=0.12737921}}where @rid=18:1\nEncountered \" <INTEGER_LITERAL> \"0 \"\" at line 1, column 25.\r\nWas expecting one of:\r\n <TO> ...\r\n <VALUES> ...\r\n <SET> ...\r\n <ADD> ...\r\n <PUT> ...\r\n <MERGE> ...\r\n <CONTENT> ...\r\n <REMOVE> ...\r\n <ORDER> ...\r\n <GROUP> ...\r\n <OFFSET> ...\r\n <RECORD> ...\r\n <LUCENE> ...\r\n <NEAR> ...\r\n <WITHIN> ...\r\n <EXCEPTION> ...\r\n <FIND> ...\r\n <REFERENCES> ...\r\n <RECORD_ATTRIBUTE> ...\r\n <CHARACTER_LITERAL> ...\r\n <STRING_LITERAL> ...\r\n \"}\" ...\r\n <IN> ...\r\n <KEY> ...\r\n <IDENTIFIER> ...\r\n <QUOTED_IDENTIFIER> ...\r\n "
}
]
}
childUijson.field("node",node);
db.save();
db.commit();
解决了我的问题
我在 orientdb studio(2.1.12) 中有一个 javascript 函数,我试图用 json 更新名为 "node" 的字段,属性 是在 uiJson Document/Class 中输入 embeddedMap。找到下面的代码:
var dt = db.query("SELECT * from uijson");
childUijson = dt[0].getRecord();
node = childUijson.field('node');
print(node )
db.command('update uiJson set node=' + node + 'where @rid=18:1');
return node;
/*Print in oriendb console{0=inputs[{s_type=URL,source=,v_type=java.l,value=http://www.gmail.com}], next={0=1}, label=Open Url, type=OPEN_URL, component=FireFox, screenshot=false,chained=false,flowchartElement=startElement_1,left=0.12737921}}
*/
/*Return statement {
"0": {
"inputs": [
{
"s_type": "URL",
"source": "",
"v_type": "java.lang.String",
"value": "http://localhost:8090/Automaton/"
}
],
"next": {
"0": "1"
},
"label": "Open Url",
"type": "OPEN_URL",
"component": "FireFox",
"screenshot": false,
"chained": false,
"flowchartElement": "startElement_1",
"top": 0.4410876,
"left": 0.12737921
}
"@type": "d",
"@version": 0
}*/
Print 和 return 使用相同的变量 node 。在控制台中打印时,它使用 java object tostring() while returning 它给出了 Json.Please 帮助我用 Json 类型的嵌入式地图更新字段。
Error message {
"errors": [
{
"code": 500,
"reason": 500,
"content": "com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #0: Error parsing query: \nupdate uiJson set node={0={inputs=[{s_type=URL, source=, v_type=java.lang.String, value=http://www.gmail.com/}], next={0=1}, label=Open Url, type=OPEN_URL, component=FireFox, screenshot=false, chained=false, flowchartElement=startElement_1, top=0.4410876, left=0.12737921}}where @rid=18:1\nEncountered \" <INTEGER_LITERAL> \"0 \"\" at line 1, column 25.\r\nWas expecting one of:\r\n <TO> ...\r\n <VALUES> ...\r\n <SET> ...\r\n <ADD> ...\r\n <PUT> ...\r\n <MERGE> ...\r\n <CONTENT> ...\r\n <REMOVE> ...\r\n <ORDER> ...\r\n <GROUP> ...\r\n <OFFSET> ...\r\n <RECORD> ...\r\n <LUCENE> ...\r\n <NEAR> ...\r\n <WITHIN> ...\r\n <EXCEPTION> ...\r\n <FIND> ...\r\n <REFERENCES> ...\r\n <RECORD_ATTRIBUTE> ...\r\n <CHARACTER_LITERAL> ...\r\n <STRING_LITERAL> ...\r\n \"}\" ...\r\n <IN> ...\r\n <KEY> ...\r\n <IDENTIFIER> ...\r\n <QUOTED_IDENTIFIER> ...\r\n "
}
]
}
childUijson.field("node",node);
db.save();
db.commit();
解决了我的问题