orientechnologies / orientjs

The official fast, lightweight node.js client for OrientDB
http://orientdb.com
Other
326 stars 68 forks source link

OrientJS 3.0: SELECT *, otherField FROM #1:0 Syntax Not Working #334

Closed big213 closed 6 years ago

big213 commented 6 years ago

OrientJS Version: 3.0.0-beta3 OrientDB Version: 3.0.7

Steps to reproduce error: INSERT INTO V SET someField = 'foo', otherField = 'bar' SELECT *, otherField FROM #1:0

When I attempt to perform the 2nd SELECT, the session.query(query, params) gets stuck and does not return. The statement works fine on the OrientDB Studio.

big213 commented 6 years ago

Also, I just wanted to know the use of session.query versus session.command. The 1st one only accepts idempotent queries, and the 2nd one accepts both idempotent and non-idempotent queries. I guess I don't understand what the point of the 1st one is then. Is it faster, or is it just to help the user separate the queries between idempotent and non-idempotent?

wolf4ood commented 6 years ago

Hi @big213

i was not able to reproduce this issue. do you have a script to reproduce this?

About session.query and command apart from idempotent difference, the main difference is that query is really streamed, and the statement and execution plan are cached, meanwhile that could not be the same when using command to change things around. And also you can separate query from command (read from write ) :)

big213 commented 6 years ago

@wolf4ood Thanks for clarifying that question, the caching makes sense. I think it is best to use query when it is available, then.

As for the issue, I think it has to do with incoming or outgoing edges. Try this:

INSERT INTO V SET someField = 'foo', otherField = 'bar' '#1:0' INSERT INTO V SET id = 2 '#2:0' CREATE EDGE E FROM #2:0 TO #1:0 SELECT *, otherField FROM #1:0

wolf4ood commented 6 years ago

@big213

thanks, i've reproduced it. Let me try to fix it

wolf4ood commented 6 years ago

Hi @big213

I've found the issue. Seems to be in OrientDB itself instead of OrientJS.

I've just pushed a fix and it will be available in 3.0.8 GA

Thanks