if (parameterCount < 1)
{
throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
}
final Type textType = parameters.getType(0);
final Object textValue = parameters.getValue(0);
final String query =
context.getTypeRegistry().convertToText(textType, textValue);
if (query == null)
{
throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
}
final String resultColumn;
if (parameterCount > 1)
{
final Type encodingType = parameters.getType(1);
final Object encodingValue = parameters.getValue(1);
resultColumn = context.getTypeRegistry().convertToText(encodingType, encodingValue);
if (resultColumn == null)
{
throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
}
}
else
{
resultColumn = null;
}
final int queryTimeOut;
if (parameterCount > 2)
{
final Type encodingType = parameters.getType(2);
final Object encodingValue = parameters.getValue(2);
final Number number = context.getTypeRegistry().convertToNumber(encodingType, encodingValue);
if (number == null)
{
throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
}
queryTimeOut = number.intValue();
}
else
{
queryTimeOut = 0;
}
final int queryLimit;
if (parameterCount > 3)
{
final Type encodingType = parameters.getType(3);
final Object encodingValue = parameters.getValue(3);
final Number number = context.getTypeRegistry().convertToNumber(encodingType, encodingValue);
if (number == null)
{
throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);