Ok,
I got rid of parameters
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<>("select from
(traverse out_HAS from (select from Case where name = 'demo') while $depth
<= 1) where name = 'telnet_cat_emial_list.pcap'");
Query does return a result.
I changed it to unnamed parameters
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<>("select from
(traverse * from (select from Case where name = ? ) while $depth <= 1)
where name = ?");
List<ODocument> docs =
graph.getRawGraph().command(query).execute(c.getCase().getName(),
c.getName());
and it's even worse, I got an exception
Caused by:
com.orientechnologies.orient.core.exception.OCommandExecutionException:
Error on execution of command: sql.select from (traverse * from (select
from Case where name = ? ) while $depth <= 1) where name = ?
at
com.orientechnologies.orient.core.storage.OStorageEmbedded.executeCommand(OStorageEmbedded.java:102)
at
com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:85)
at
com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69)
at
com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:82)
at
com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:29)
at
com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1320)
at
com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:330)
at
com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:125)
at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:45)
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at
com.orientechnologies.orient.core.sql.filter.OSQLPredicate.bindParameters(OSQLPredicate.java:358)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:135)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:354)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:328)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:313)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:57)
at
com.orientechnologies.orient.core.storage.OStorageEmbedded.executeCommand(OStorageEmbedded.java:96)
... 8 more
This doesn't seem right to me.
On Friday, February 14, 2014 3:33:55 PM UTC-5, Andrey Yesyev wrote:
>
> Hi there,
>
> Trying to query DB using this function
>
> public Iterable<Vertex> findCollectionVertex(Collection c){
> OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<>("select
> from (traverse out_HAS from (select from Case where name = :cname ) while
> $depth <= 1) where name = :name");
> Map<String,Object> params = new HashMap<>();
> params.put("cname", c.getCase().getName());
> params.put("name", c.getName());
>
> Iterable<Vertex> list = graph.command(query).execute(params);
> return list;
> }
>
>
> * list *is always empty. However I run the same query in Orient Studio
> with parameters in query
>
> select from (traverse out_HAS from (select from Case where name = 'demo' )
> while $depth <= 1) where name = 'telnet_cat_emial_list.pcap'
>
> and have expected results
>
> @rid@version@classnamein_HAS#13:3<http://localhost:2480/studio/index.html#/database/ePersona/browse/edit/13:3>
> 2Collectiontelnet_cat_emial_list.pcap[1]
> Any ideas why this can happen !?
>
> -Andrey
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.