Ticket created: https://github.com/orientechnologies/orientdb/issues/2334
Another issue: select 'Ay' as a , 'bEE' *works, but* select 'Ay' as a , 'bEE' *as b* fails with Error: com.orientechnologies.orient.enterprise.channel.binary.OResponseProcessingException: Exception during response processing. Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #19: Invalid keyword ''BEE'' select 'Ay' as a , "bEE", "cee" also doesn't work, and throws Error: com.orientechnologies.orient.enterprise.channel.binary.OResponseProcessingException: Exception during response processing. Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #17: Invalid keyword '"BEE"' in version OrientDB Server v1.7-SNAPSHOT (build UNKNOWN@r; 2014-04-03 08:54:36-0400) Op vrijdag 9 mei 2014 17:19:06 UTC+2 schreef Lvc@: > > Hi, > That syntax is cool, please can you open a new issue to support it? > > In the meanwhile as workaround, with 1.7-SNAPSHOT you could do: > > > *select jsonParameterTest( $j ) LET $j = (select 1 as a, 'zE' as b) > FETCHPLAN *:1 * > > Lvc@ > > > > Lvc@ > > > On 6 May 2014 10:35, MrFT <[email protected] <javascript:>> wrote: > >> Hello, >> >> from what I get so far, the parameters for a server-side javascript >> function can be simple things like strings and numbers. >> >> My question is: is it possible to have a json object as the parameter? >> >> For example, when calling the function >> >> function jsonparameterTest( par ) >> if ( typeof par == 'object' ) { >> return JSON.stringify( par ); >> } >> else { >> return "NO OBJECT: " + par; >> } >> } >> >> in the studio like this: >> >> select jsonParameterTest( 'mystringparameter' ) FETCHPLAN *:1 >> >> It works as expected. >> >> But when I try (and that's what I would like to do, if possible): >> select jsonParameterTest( { "a": 1, "b": "zE" } ) FETCHPLAN *:1 >> >> I get: >> com.orientechnologies.orient.core.command.script.OCommandScriptException: >> Error on parsing script at position #0: Error on execution of the script >> Script: jsonParameterTest ------^ --> javax.script.ScriptException: >> sun.org.mozilla.javascript.internal.EvaluatorException: Java class >> "[Ljava.lang.annotation.Annotation;" has no public instance field or method >> named "toJSON". (#93) in at line number 93 --> >> sun.org.mozilla.javascript.internal.EvaluatorException: Java class >> "[Ljava.lang.annotation.Annotation;" has no public instance field or method >> named "toJSON". (#93) >> >> So my question is: >> >> - can this be done, and >> - if so, what am I doing wrong? >> >> >> -- >> >> --- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- 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.
