I created a function below, and executed through Functions page, Browse 
page and Binary Protocol. they return differently.
What I expect the return should always like Functions page. But Browse page 
and Binary Protocol only return Record Id.
Any way can return Record from Function ?
function test() {
   return db.query("select from V where @rid=#9:1")
}



EXECUTED through Functions page
[{"@type":"d","@rid":"#9:1","@version":25,"@class":"V","name":"HEY BO 
DIDDLEY","song_type":"cover","performances":5,"type":"song",
"out_followed_by":["#11:0","#11:1","#11:2","#11:3","#11:4"],"out_written_by"
:"#9:7","out_sung_by":"#9:8","in_followed_by":["#11:10","#11:150","#11:2578"
,"#11:5574"],"@fieldTypes":"out_followed_by=g,in_followed_by=g"}]



EXECUTED through Browse page
SELECT test()
returned
{
    "result": [
        {
            "@type": "d",
            "@rid": "#-2:0",
            "@version": 0,
            "test": [
                1
            ]
        }
    ],
    "notification": "Query executed in 0.023 sec. Returned 1 record(s)"
}



EXECUTED through Binary Protocol
p.Exec(SyncQuery(dbSid, "SELECT test()", -1, "", nil, nil, nil))
server log
2014-04-24 09:47:02:355 INFO /127.0.0.1:49697 - Reading byte (1 byte)... 
[OChannelBinaryServer]
2014-04-24 09:47:02:356 INFO /127.0.0.1:49697 - Read byte: 41 
[OChannelBinaryServer]
2014-04-24 09:47:02:356 INFO /127.0.0.1:49697 - Reading int (4 bytes)... 
[OChannelBinaryServer]
2014-04-24 09:47:02:356 INFO /127.0.0.1:49697 - Read int: 5 
[OChannelBinaryServer]
2014-04-24 09:47:02:357 INFO /127.0.0.1:49697 - Reading byte (1 byte)... 
[OChannelBinaryServer]
2014-04-24 09:47:02:357 INFO /127.0.0.1:49697 - Read byte: 115 
[OChannelBinaryServer]
2014-04-24 09:47:02:359 INFO /127.0.0.1:49697 - Reading chunk of bytes. 
Reading chunk length as int (4 bytes)... [OChannelBinaryServer]
2014-04-24 09:47:02:359 INFO /127.0.0.1:49697 - Read chunk lenght: 42 
[OChannelBinaryServer]
2014-04-24 09:47:02:359 INFO /127.0.0.1:49697 - Reading 42 bytes... 
[OChannelBinaryServer]
SELECT test()�������� [OChannelBinaryServer]7 - Read 42 bytes: q
2014-04-24 09:47:02:413 INFO /127.0.0.1:49697 - Writing byte (1 byte): 0 
[OChannelBinaryServer]
2014-04-24 09:47:02:414 INFO /127.0.0.1:49697 - Writing int (4 bytes): 5 
[OChannelBinaryServer]
2014-04-24 09:47:02:414 INFO /127.0.0.1:49697 - Writing byte (1 byte): 108 
[OChannelBinaryServer]
2014-04-24 09:47:02:414 INFO /127.0.0.1:49697 - Writing int (4 bytes): 1 
[OChannelBinaryServer]
2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing short (2 bytes): 0 
[OChannelBinaryServer]
2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing byte (1 byte): 100 
[OChannelBinaryServer]
2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing short (2 bytes): -2 
[OChannelBinaryServer]
2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing cluster position (8 
bytes) : 0.... [OChannelBinaryServer]
2014-04-24 09:47:02:417 INFO /127.0.0.1:49697 - Writing int (4 bytes): 0 
[OChannelBinaryServer]
2014-04-24 09:47:02:419 INFO /127.0.0.1:49697 - Writing bytes (4+11=15 
bytes): [116, 101, 115, 116, 58, 91, 35, 57, 58, 49, 93] 
[OChannelBinaryServer]
2014-04-24 09:47:02:419 INFO /127.0.0.1:49697 - Writing byte (1 byte): 0 
[OChannelBinaryServer]
deserialized record
&Record{
  Type:0x64,
  Rid:RecordId{cluster:-2, position:0},
  Version:0,
  Content:{
    "@type":100,
    "test":[
      {cluster:9, position:1}
    ]
  }
}



-- 

--- 
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/d/optout.

Reply via email to