Java driver returns invalid row with SELECT COUNT

42 views
Skip to first unread message

Hung Tran

unread,
Jan 13, 2016, 3:03:29 AM1/13/16
to orient-...@googlegroups.com
Hi,

I have a query

SELECT COUNT(*) FROM (SELECT FROM User WHERE Email=:p0)

From Studio (Http protocol), it returns [ {  COUNT: 1 } ] row

From JavaAPI (Binary protocol) version 2.1.8, it returns [ {  COUNT: 0 } ]. It returns [ {  COUNT: 1 } ] in version 1.7.8.

I change the query to

SELECT COUNT(*) FROM User WHERE Email=:p0

It always return [ {  COUNT: 1 } ] for both versions

My Best,
Hung Tran


alessand...@gmail.com

unread,
Jan 14, 2016, 8:48:55 AM1/14/16
to orient-...@googlegroups.com
Hi, I have tried this code and it works with 2.1.8



HashMap<String, Object> params = new HashMap<String, Object>();
params.put("p0", "mail");
Iterable<Vertex> result=g.command(new OCommandSQL("SELECT COUNT(*) FROM (SELECT FROM User WHERE Email=:p0)")).execute(params);
for(Vertex v: result){
   System.out.println(v.getProperty("COUNT"));
}

Best regards,
Alessandro
Reply all
Reply to author
Forward
0 new messages