Re: [orientdb] Calling OrientDB function from SQL command

2014-07-29 Thread Gaurav Dhiman
Luigi, Thanks. Below SQL shared by you worked and gave me the same results that REST/HTTP is returning. SELECT expand(getAllCountries) from (SELECT getAllCountries()) Now in case I need to send parameters to functions, how to do that ?? -- Best Regards, Gaurav On Tue, Jul 29, 2014 at 1:06 PM

Re: [orientdb] Calling OrientDB function from SQL command

2014-07-29 Thread Luigi Dell'Aquila
Hi Gaurav, First of all you have to remove the semicolon at the end of the query: SELECT getAllCountries() instead of SELECT getAllCountries(); < - Then two simple questions: 1) are you trying to execute the query from Studio or from a client? You should obtain a single record containing a c

Re: [orientdb] Calling OrientDB function from SQL command

2014-07-28 Thread Gaurav Dhiman
Hi Luigi, Thanks for inputs. Your response make sense. I was accessing request object in function body, hence the error. I altered the function and now below is the current code of getAllCountries() function. var mc = db.query("SELECT FROM MasterCountry"); return mc; In this case, now when I

Re: [orientdb] Calling OrientDB function from SQL command

2014-07-28 Thread Luigi Dell'Aquila
Hi Gaurav, I'd like to see your function code to be sure, but I guess you are trying to access the "request" object (eg. trying to retrieve a request parameter). Request object is not present when invoking a function inside a query. Let me explain in depth, you can invoke JS functions in many ways

Re: [orientdb] Calling OrientDB function from SQL command

2014-07-28 Thread Gaurav Dhiman
On Tue, Jul 29, 2014 at 3:33 AM, Enrico Risa wrote: > Hi Gaurav > > try : > > SELECT getAllCountries() FETCHPLAN *:-1 > It throws below error: com.orientechnologies.orient.core.command.script.OCommandScriptException: Error on parsing script at position #0: Error on execution of the script Script

Re: [orientdb] Calling OrientDB function from SQL command

2014-07-28 Thread Enrico Risa
Hi Gaurav try : SELECT getAllCountries() FETCHPLAN *:-1 Enrico 2014-07-28 23:17 GMT+02:00 Gaurav Dhiman : > Hi, > > I tried calling a JS function in OrientDB using below SQl command, but the > result is different from what I get when I run the function directly in > OrientDB Studio. > > query

[orientdb] Calling OrientDB function from SQL command

2014-07-28 Thread Gaurav Dhiman
Hi, I tried calling a JS function in OrientDB using below SQl command, but the result is different from what I get when I run the function directly in OrientDB Studio. query -- SELECT getAllCountries FETCHPLAN *:-1 result -- { '@rid': { cluster: -2, position: 0 } } What is wrong in above quer,