【问题标题】:How to execute OSQL batch from JavaScript function?如何从 JavaScript 函数执行 OSQL 批处理?
【发布时间】:2016-07-06 17:37:47
【问题描述】:

是否可以从 OrientDB 中用 JavaScript 编写的服务器端函数执行 OSQL 批处理?尝试做一些事情:

var cmd = "begin\n" +
    "let account = create vertex Account set name = 'Luke'\n" +
    "let city = select from City where name = 'London'\n" +
    "let edge = create edge Lives from $account to $city\n" +
    "commit retry 100\n" +
    "return $edge"
db.command(cmd);

抛出 com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException 异常。

有什么建议吗?

【问题讨论】:

    标签: javascript orientdb


    【解决方案1】:

    您可以像这样使用 SQL 函数: (请注意,edg 中的 var edge 已更改,因为 edge 是一个私有词。)


    顺便说一句,您的 db.command(cmd); 也有一点错误:command() 方法需要一个参数来指示要使用哪种语言,所以应该是 db.command("sql",cmd);

    现在,在这种情况下它也不起作用,所以如上所述,请使用 SQL 函数。


    希望对你有帮助,

    伊万

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-03
      • 1970-01-01
      • 2013-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多