Examples of FunctionCall


Examples of org.ofbiz.sql.FunctionCall

    private static void addFieldDef(DynamicViewEntity dve, List<String> groupBy, String alias, ConstantValue value) {
        if (value instanceof FieldValue) {
            addFieldDef(dve, groupBy, alias, (FieldValue) value, null);
            return;
        } else if (value instanceof FunctionCall) {
            FunctionCall fc = (FunctionCall) value;
            String name = fc.getName().toLowerCase();
            Iterator<Value> it = fc.iterator();
            if (it.hasNext()) {
                Value firstValue = it.next();
                if (!it.hasNext()) {
                    if (firstValue instanceof FieldValue) {
                        addFieldDef(dve, groupBy, alias, (FieldValue) firstValue, name);
View Full Code Here

Examples of org.ofbiz.sql.FunctionCall

    private static ComplexAliasMember buildComplexMember(Value value) {
        if (value instanceof FieldValue) {
            FieldValue fv = (FieldValue) value;
            return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, null);
        } else if (value instanceof FunctionCall) {
            FunctionCall fc = (FunctionCall) value;
            String name = fc.getName().toLowerCase();
            if (fc.getArgCount() == 1) {
                Value firstValue = fc.iterator().next();
                if (firstValue instanceof FieldValue) {
                    FieldValue fv = (FieldValue) firstValue;
                    return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, name);
                } else if (firstValue instanceof FunctionCall) {
                    FunctionCall fc2 = (FunctionCall) firstValue;
                    if (fc2.getName().equalsIgnoreCase("coalesce") && fc2.getArgCount() == 2) {
                        Iterator<Value> it = fc2.iterator();
                        Value f1 = it.next(), f2 = it.next();
                        if (f1 instanceof FieldValue) {
                            FieldValue fv = (FieldValue) f1;
                            if (f2 instanceof NumberValue<?>) {
                                return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), ((NumberValue<?>) f2).getNumber().toString(), name);
View Full Code Here

Examples of org.ofbiz.sql.FunctionCall

    private static void addFieldDef(DynamicViewEntity dve, List<String> groupBy, String alias, ConstantValue value) {
        if (value instanceof FieldValue) {
            addFieldDef(dve, groupBy, alias, (FieldValue) value, null);
            return;
        } else if (value instanceof FunctionCall) {
            FunctionCall fc = (FunctionCall) value;
            String name = fc.getName().toLowerCase();
            Iterator<Value> it = fc.iterator();
            if (it.hasNext()) {
                Value firstValue = it.next();
                if (!it.hasNext()) {
                    if (firstValue instanceof FieldValue) {
                        addFieldDef(dve, groupBy, alias, (FieldValue) firstValue, name);
View Full Code Here

Examples of org.ofbiz.sql.FunctionCall

    private static ComplexAliasMember buildComplexMember(Value value) {
        if (value instanceof FieldValue) {
            FieldValue fv = (FieldValue) value;
            return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, null);
        } else if (value instanceof FunctionCall) {
            FunctionCall fc = (FunctionCall) value;
            String name = fc.getName().toLowerCase();
            if (fc.getArgCount() == 1) {
                Value firstValue = fc.iterator().next();
                if (firstValue instanceof FieldValue) {
                    FieldValue fv = (FieldValue) firstValue;
                    return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, name);
                } else if (firstValue instanceof FunctionCall) {
                    FunctionCall fc2 = (FunctionCall) firstValue;
                    if (fc2.getName().equalsIgnoreCase("coalesce") && fc2.getArgCount() == 2) {
                        Iterator<Value> it = fc2.iterator();
                        Value f1 = it.next(), f2 = it.next();
                        if (f1 instanceof FieldValue) {
                            FieldValue fv = (FieldValue) f1;
                            if (f2 instanceof NumberValue<?>) {
                                return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), ((NumberValue<?>) f2).getNumber().toString(), name);
View Full Code Here

Examples of org.ofbiz.sql.FunctionCall

        ComplexAliasMember complexMember;
        if (value instanceof FieldValue) {
            addFieldDef(dve, groupBy, alias, (FieldValue) value, null);
            return;
        } else if (value instanceof FunctionCall) {
            FunctionCall fc = (FunctionCall) value;
            String name = fc.getName().toLowerCase();
            Iterator<Value> it = fc.iterator();
            if (it.hasNext()) {
                Value firstValue = it.next();
                if (!it.hasNext()) {
                    if (firstValue instanceof FieldValue) {
                        addFieldDef(dve, groupBy, alias, (FieldValue) firstValue, name);
View Full Code Here

Examples of org.ofbiz.sql.FunctionCall

    private static ComplexAliasMember buildComplexMember(Value value) {
        if (value instanceof FieldValue) {
            FieldValue fv = (FieldValue) value;
            return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, null);
        } else if (value instanceof FunctionCall) {
            FunctionCall fc = (FunctionCall) value;
            String name = fc.getName().toLowerCase();
            if (fc.getArgCount() == 1) {
                Value firstValue = fc.iterator().next();
                if (firstValue instanceof FieldValue) {
                    FieldValue fv = (FieldValue) firstValue;
                    return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, name);
                } else if (firstValue instanceof FunctionCall) {
                    FunctionCall fc2 = (FunctionCall) firstValue;
                    if (fc2.getName().equalsIgnoreCase("coalesce") && fc2.getArgCount() == 2) {
                        Iterator<Value> it = fc2.iterator();
                        Value f1 = it.next(), f2 = it.next();
                        if (f1 instanceof FieldValue) {
                            FieldValue fv = (FieldValue) f1;
                            if (f2 instanceof NumberValue) {
                                return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), ((NumberValue) f2).getNumber().toString(), name);
View Full Code Here

Examples of org.ofbiz.sql.FunctionCall

            fieldDef = fieldDefIt.next();
            assertEquals("third fieldDef.alias", "SUM", fieldDef.getAlias());
            assertTrue("third is FieldDefValue", fieldDef instanceof FieldDefValue);
            FieldDefValue fdv = (FieldDefValue) fieldDef;
            assertTrue("third fieldDefValue.staticValue is FunctionCall", fdv.getValue() instanceof FunctionCall);
            FunctionCall fc = (FunctionCall) fdv.getValue();
            assertEquals("third arg count", 1, fc.getArgCount());
            Iterator<Value> valueIt = fc.iterator();
            assertTrue("third args hasNext", valueIt.hasNext());
            Value argValue = valueIt.next();
            assertTrue("third first arg is FieldValue", argValue instanceof FieldValue);
            FieldValue fieldValue = (FieldValue) argValue;
            assertEquals("third first arg tableName", "a", fieldValue.getTableName());
View Full Code Here

Examples of org.openrdf.query.algebra.FunctionCall

    throws VisitorException
  {
    ValueConstant vc = (ValueConstant)node.getURI().jjtAccept(this, null);
    assert vc.getValue() instanceof URI;

    FunctionCall functionCall = new FunctionCall(vc.getValue().toString());

    for (ASTValueExpr argExpr : node.getArgList()) {
      functionCall.addArg((ValueExpr)argExpr.jjtAccept(this, null));
    }

    return functionCall;
  }
View Full Code Here

Examples of org.openrdf.query.algebra.FunctionCall

    throws VisitorException
  {
    ValueConstant uriNode = (ValueConstant)node.jjtGetChild(0).jjtAccept(this, null);
    URI functionURI = (URI)uriNode.getValue();

    FunctionCall functionCall = new FunctionCall(functionURI.toString());

    for (int i = 1; i < node.jjtGetNumChildren(); i++) {
      Node argNode = node.jjtGetChild(i);
      functionCall.addArg((ValueExpr)argNode.jjtAccept(this, null));
    }

    return functionCall;
  }
View Full Code Here

Examples of org.renjin.sexp.FunctionCall

  public void sysCall() {
    eval(" sys.call <- function (which = 0) .Internal(sys.call(which))");

    eval(" g <- function(x) sys.call(0) ");

    FunctionCall call = (FunctionCall)eval("g(1)");
    assertThat(call.getFunction(), equalTo(symbol("g")));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.