core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunction.java
public Object execute(final Map<Object, Object> iArgs) {
    if (name == null)
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
    if (name.isEmpty())
      throw new OCommandExecutionException("Syntax Error. You must specify a function name: " + getSyntax());
    if (code == null || code.isEmpty())
      throw new OCommandExecutionException("Syntax Error. You must specify the function code: " + getSyntax());

    ODatabaseDocument database = getDatabase();
    final OFunction f = database.getMetadata().getFunctionLibrary().createFunction(name);
    f.setCode(code);
    f.setIdempotent(idempotent);
    if (parameters != null)
      f.setParameters(parameters);
    if (language != null)
      f.setLanguage(language);
    f.save();
    return f.getId();
  }
public Object execute(final Map<Object, Object> iArgs) {
    if (name == null)
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
    if (name.isEmpty())
      throw new OCommandExecutionException("Syntax Error. You must specify a function name: " + getSyntax());
    if (code == null || code.isEmpty())
      throw new OCommandExecutionException("Syntax Error. You must specify the function code: " + getSyntax());

    ODatabaseDocument database = getDatabase();
    final OFunction f = database.getMetadata().getFunctionLibrary().createFunction(name);
    f.setCode(code);
    f.setIdempotent(idempotent);
    if (parameters != null)
      f.setParameters(parameters);
    if (language != null)
      f.setLanguage(language);
    f.save();
    return f.getId();
  }
public Object execute ( final Map < Object , Object > iArgs ) { if ( name == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; if ( name . isEmpty ( ) ) throw new OCommandExecutionException ( "Syntax Error. You must specify a function name: " + getSyntax ( ) ) ; if ( code == null || code . isEmpty ( ) ) throw new OCommandExecutionException ( "Syntax Error. You must specify the function code: " + getSyntax ( ) ) ; ODatabaseDocument database = getDatabase ( ) ; final OFunction f = database . getMetadata ( ) . getFunctionLibrary ( ) . createFunction ( name ) ; f . setCode ( code ) ; f . setIdempotent ( idempotent ) ; if ( parameters != null ) f . setParameters ( parameters ) ; if ( language != null ) f . setLanguage ( language ) ; f . save ( ) ; return f . getId ( ) ; }
Execute the command and return the ODocument object created.
Execute the command and return the ODocument object created .