Search code examples
functionargumentsorientdb

How to pass a rid as an argument to a custom sql function in OrientDB?


I'm trying to create a custom sql function in the OrientDB Studio that takes a rid as an argument and, let's say, selects from that rid. The problem is that when I pass a rid it is not recognised as a rid inside the function, but as an argument of the string type. Does anyone know how to convert it to an actual rid so I can select or traverse from it?


Solution

  • You can use if it is a string inside your function like this

    var graph = orient.getGraph()
    return graph.command('sql',"select from " +rid );
    

    with rid as parameter of the function