Ostico / PhpOrient

PhpOrient - Official Php driver based on the binary protocol of OrientDB.
Other
68 stars 37 forks source link

Empty OData content on TRAVERSE query. #41

Open odiel opened 9 years ago

odiel commented 9 years ago

Hi

I'm, having an issue since I upgraded to v1.2.0.

When executing a query like this one:

TRAVERSE out('hasParents') FROM (SELECT out('hasParents') FROM #49:3243757

I get two records when I query OrientDB from the UI, when using PHPOrient I get the same 2 records but the second record has no OData content, instead it has an empty array.

ghost commented 8 years ago

+1

Same here, for example: $client->query('traverse both() from (traverse bothE() from (select from Artist where title="U2" LIMIT 1) ) limit 24'); shows 1st element as expected, second and the rest won't have oData, oClass, version, etc., just the RIDs.

OrientDB v2.1.0

Ostico commented 8 years ago

Hi @odiel , @oharlem

i tried with the database GratefulDeadConcerts with this query: "traverse both() from ( traverse bothE() from ( select from V where name='BERTHA' LIMIT 1 ) )"

and it worked as expected. Could you provide more info or a data test set?

Ostico commented 8 years ago

I found what you say.

Investigating

Ostico commented 8 years ago

I found some interesting things.

When the SQL method TRAVERSE is called from $client->query method OrientDB returns only the first row with $classId === 0, it returns all other rows with $classId === -3

@see https://github.com/Ostico/PhpOrient/blob/master/src/PhpOrient/Protocols/Binary/Abstracts/Operation.php#L497

so the oData content is never sent to the client after the first record.

I obtained what you want by using ASYNC query type with LIMIT = -1 param:

$result = $client->queryAsync( "traverse both() from ( traverse bothE() from ( select from V where name='BERTHA' LIMIT 1 ) )", [ 'limit' => -1 ] );