}
else if (methodId.equalsIgnoreCase("SUBSTRING"))
{
List argscall = new ArrayList();
JavaTypeMapping mapping = srm.getDatastoreAdapter().getMapping(String.class, srm);
IntegerLiteral one = new IntegerLiteral(qs, mapping, BigInteger.ONE, false);
argscall.add(((ScalarExpression) args.get(1)).sub(one));
if (args.size() > 2)
{
argscall.add(((ScalarExpression) args.get(2)).add(one));
}
return ((ScalarExpression) args.get(0)).callMethod(methodId.toLowerCase(), argscall);
}
else if (methodId.equalsIgnoreCase("LOWER"))
{
return ((ScalarExpression) args.get(0)).callMethod("toLowerCase",
Collections.EMPTY_LIST);
}
else if (methodId.equalsIgnoreCase("UPPER"))
{
return ((ScalarExpression) args.get(0)).callMethod("toUpperCase",
Collections.EMPTY_LIST);
}
else if (methodId.equalsIgnoreCase("SIZE"))
{
return ((ScalarExpression) args.get(0)).callMethod(methodId.toLowerCase(),
Collections.EMPTY_LIST);
}
else if (methodId.equalsIgnoreCase("LOCATE"))
{
List argscall = new ArrayList();
argscall.add(args.get(0));
JavaTypeMapping mapping = srm.getDatastoreAdapter().getMapping(String.class, srm);
IntegerLiteral one = new IntegerLiteral(qs, mapping, BigInteger.ONE,false);
if (args.size() > 2)
{
argscall.add(((ScalarExpression)args.get(2)).sub(one));
}
return ((ScalarExpression)args.get(1)).callMethod("indexOf", argscall).add(one);