eval one result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static EvalResultIterator eval(String functionCall) throws TestEvalException { | |
String imports = | |
"import module namespace sem = 'http://marklogic.com/semantics' at '/MarkLogic/semantics.xqy';\n"; | |
ServerEvaluationCall call = | |
client.newServerEval().xquery(entityServicesImport + functionCall); | |
EvalResultIterator results = null; | |
try { | |
results = call.eval(); | |
} catch (FailedRequestException e) { | |
throw new TestEvalException(e); | |
} | |
return results; | |
} | |
protected static <T extends AbstractReadHandle> T evalOneResult(String functionCall, T handle) throws TestEvalException { | |
EvalResultIterator results = eval(functionCall); | |
EvalResult result = null; | |
if (results.hasNext()) { | |
result = results.next(); | |
return result.get(handle); | |
} else { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment