Difference between command and query?

1,795 views
Skip to first unread message

Erik Pragt

unread,
Dec 26, 2015, 2:02:13 PM12/26/15
to OrientDB
Hi all,

Question: what's the difference between: 


db.query(new OSQLSynchQuery<ODocument>("select * from books"));

and 

db.command(new OSQLSynchQuery<Book>("select * from books")).execute(params);

What's the recommended way, and what's the actual difference between these two??

Thanks, Erik

Luigi Dell'Aquila

unread,
Dec 28, 2015, 4:36:24 AM12/28/15
to orient-...@googlegroups.com
Hi Erik,

the only difference is that query() checks that you statements are idempotent (do not modify database status), while command() is also allowed to execute insert/update/delete.
There is no difference in terms of performance and no particular advantage in one or the other, apart from the semantics.

Thanks

Luigi


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Erik Pragt

unread,
Dec 28, 2015, 5:28:50 AM12/28/15
to OrientDB
Hi Luigi,

Much appreciated for the answer, that's clear!

Erik
Reply all
Reply to author
Forward
0 new messages