Skip to content

Commit

Permalink
fix: correct sql function execution after refactor issue #9888
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Nov 1, 2022
1 parent 2941fd3 commit bd543dd
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.orientechnologies.orient.core.command;

import com.orientechnologies.orient.core.command.script.OCommandExecutorScript;
import com.orientechnologies.orient.core.command.script.OCommandScript;
import com.orientechnologies.orient.core.command.script.OCommandExecutorFunction;
import com.orientechnologies.orient.core.command.script.OCommandFunction;
import com.orientechnologies.orient.core.command.traverse.OAbstractScriptExecutor;
import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
Expand Down Expand Up @@ -134,16 +134,14 @@ private OResultSet executeInternal(List<OStatement> statements, OCommandContext
public Object executeFunction(
OCommandContext context, final String functionName, final Map<Object, Object> iArgs) {

Object result;
ODatabaseDocumentInternal db = (ODatabaseDocumentInternal) context.getDatabase();
if (db == null) {
db = ODatabaseRecordThreadLocal.instance().get();
}
final OFunction f = db.getMetadata().getFunctionLibrary().getFunction(functionName);

final OCommandExecutorScript command = new OCommandExecutorScript();
command.parse(new OCommandScript(language, f.getCode()));
result = command.execute(iArgs);
return result;
final OCommandExecutorFunction command = new OCommandExecutorFunction();
command.parse(new OCommandFunction(functionName));
return command.executeInContext(context, iArgs);
}
}

0 comments on commit bd543dd

Please sign in to comment.