Examples of StringExpression


Examples of org.datanucleus.store.rdbms.sql.expression.StringExpression

                throw new NucleusException(LOCALISER.msg("060003", "substring", "StringExpression", 0,
                    "NumericExpression/IntegerLiteral/ParameterLiteral"));
            }

            // Create a new StringExpression and manually update its SQL
            StringExpression strExpr = new StringExpression(stmt, null, null);
            SQLText sql = strExpr.toSQLText();
            sql.append("SUBSTRING(").append(expr).append(" FROM ").append(startExpr.add(one)).append(')');
            return strExpr;
        }
        else
        {
            // {stringExpr}.substring(numExpr1, numExpr2)
            SQLExpression one = ExpressionUtils.getLiteralForOne(stmt);

            SQLExpression startExpr = (SQLExpression)args.get(0);
            if (!(startExpr instanceof NumericExpression))
            {
                throw new NucleusException(LOCALISER.msg("060003", "substring", "StringExpression", 0,
                    "NumericExpression"));
            }
            SQLExpression endExpr = (SQLExpression)args.get(1);
            if (!(endExpr instanceof NumericExpression))
            {
                throw new NucleusException(LOCALISER.msg("060003", "substring", "StringExpression", 1,
                    "NumericExpression"));
            }

            // Create a new StringExpression and manually update its SQL
            StringExpression strExpr = new StringExpression(stmt, null, null);
            SQLText sql = strExpr.toSQLText();
            sql.append("SUBSTRING(").append(expr).append(" FROM ").append(startExpr.add(one))
                .append(" FOR ").append(endExpr.sub(startExpr)).append(')');
            return strExpr;
        }
    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.sql.expression.StringExpression

        }

        List args = new ArrayList();
        args.add(expr);
        List trimArgs = new ArrayList();
        trimArgs.add(new StringExpression(expr.getSQLStatement(), m, "CHAR", args));
        return new StringExpression(expr.getSQLStatement(), m, "RTRIM", trimArgs);
    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.sql.expression.StringExpression

        ArrayList funcArgs = new ArrayList();
        funcArgs.add(expr);
        funcArgs.add(mm);
        ArrayList funcArgs2 = new ArrayList();
        funcArgs2.add(new StringExpression(stmt, getMappingForClass(int.class), "TO_CHAR", funcArgs));

        // Delete one from the SQL "month" (origin=1) to be compatible with Java month (origin=0)
        NumericExpression numExpr = new NumericExpression(
            new NumericExpression(stmt, getMappingForClass(int.class), "TO_NUMBER", funcArgs2),
            Expression.OP_SUB, one);
View Full Code Here

Examples of org.eclipse.persistence.jpa.internal.jpql.parser.StringExpression

      return position;
    }

    // Traverse the expression until the expression
    for (Iterator<StringExpression> iter = parent.orderedChildren(); iter.hasNext(); ) {
      StringExpression childExpression = iter.next();

      // Continue to calculate the position by going up the hierarchy
      if (childExpression == expression) {
        return calculatePosition(parent, position);
      }

      position += childExpression.toParsedText().length();
    }

    // Never reach this
    throw new RuntimeException();
  }
View Full Code Here

Examples of org.jpox.store.mapped.expression.StringExpression

        {
            return new NumericExpression(qs, this, te);
        }
        else if (datastoreJavaType.equals(ClassNameConstants.JAVA_LANG_STRING))
        {
            return new StringExpression(qs, this, te);
        }
        else
        {
            // No querying of serialised Enums!
            return null;
View Full Code Here

Examples of org.jpox.store.mapped.expression.StringExpression

     * @param te Expression for the datastore container
     * @return The JDOQL expression
     */
    public ScalarExpression newScalarExpression(QueryExpression qs, LogicSetExpression te)
    {
        return new StringExpression(qs, this, te);
    }
View Full Code Here

Examples of org.jpox.store.mapped.expression.StringExpression

        return expr;
    }

    public ScalarExpression newScalarExpression(QueryExpression qs, LogicSetExpression te)
    {
        ScalarExpression expr = new StringExpression(qs, this, te);
        return expr;
    }
View Full Code Here

Examples of org.jpox.store.mapped.expression.StringExpression

    {
        ArrayList args = new ArrayList();
        args.add(str);
        if (leading && trailing)
        {
            StringExpression strExpr = new StringExpression("RTRIM", args);
            args.clear();
            args.add(strExpr);
            return new StringExpression("LTRIM", args);
        }
        else if (leading)
        {
            return new StringExpression("LTRIM", args);
        }
        else if (trailing)
        {
            return new StringExpression("RTRIM", args);
        }
        return str;
    }
View Full Code Here

Examples of org.jpox.store.mapped.expression.StringExpression

    {
        ArrayList args = new ArrayList();
        args.add(time);
        args.add(new StringLiteral(time.getQueryExpression(),null,"%I"));
        ArrayList args0 = new ArrayList();
        args0.add(new StringExpression("TO_CHAR",args));
        ArrayList types = new ArrayList();
        types.add("INTEGER");
        return new NumericExpression("CAST",args0,types);
    }   
View Full Code Here

Examples of org.jpox.store.mapped.expression.StringExpression

    {
        ArrayList args = new ArrayList();
        args.add(time);
        args.add(new StringLiteral(time.getQueryExpression(),null,"%M"));
        ArrayList args0 = new ArrayList();
        args0.add(new StringExpression("TO_CHAR",args));
        ArrayList types = new ArrayList();
        types.add("INTEGER");
        return new NumericExpression("CAST",args0,types);
    }   
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.