PhpOrient查询默认返回负Rid-s

时间:2017-10-21 11:13:23

标签: orientdb

我正在尝试检索由一些彼此链接的分配组成的简单图形,但是在查询一组这些分配后,返回的Rid-s全部为负且与Rid无关-s在数据库中,所以我不能运行基于那些Rid-s的其他查询,我该如何解决这个问题,或者我做错了什么?

以下是负责的代码段:

$records = $this->client->queryAsync('select rID, value, schedule, priority, type from Assignment where type = 5');
foreach ($records as $record)
{
    $id = $record->getRid();
    $rid = $id->__toString();
    $return[$rid] = $this->client->query('TRAVERSE out("Assignment") FROM ' . $rid . ' WHILE $depth <= 5');
}

以及我收到的错误:

com.orientechnologies.orient.core.exception.ORecordNotFoundException: The record with id '#-2:0' was not found

但是在数据库中,第一个id是:#18:0

2 个答案:

答案 0 :(得分:0)

海盗的失落之珠,

可能是事务的问题,orientdb在临时时会产生负RID。提交后,RID-s更改为正数,此处为doc

答案 1 :(得分:0)

There are a couple of errors in your code:

First off you should change your __toString(); into _toString(); using a single underscore.

Then fix the $this->client->query by either switching quotation marks at the end such as " WHILE $depth <= 5" or concatenate the variable while keeping the same quotes ' WHILE ' . $depth . ' <= 5'.

OrientDB Docs | getRid()