Package org.datanucleus.store.rdbms.sql.expression

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


                if (vermd.getVersionStrategy() == VersionStrategy.VERSION_NUMBER)
                {
                    // Increment the version
                    SQLTable verSqlTbl = stmt.getTable(verTable, stmt.getPrimaryTable().getGroupName());
                    SQLExpression verExpr = new NumericExpression(stmt, verSqlTbl, verMapping);
                    SQLExpression incrExpr = verExpr.add(new IntegerLiteral(stmt,
                        stmt.getSQLExpressionFactory().getMappingForType(Integer.class, false), new Integer(1), null));

                    updateSqlExpr = verExpr.eq(incrExpr);

                    SQLExpression[] oldArray = updateSqlExprs;
View Full Code Here


                funcArgs.add(strExpr);
                funcArgs.add(substrExpr);
                NumericExpression locateExpr = new NumericExpression(stmt, getMappingForClass(int.class), "STRPOS", funcArgs);

                SQLExpression[] whenExprs = new SQLExpression[1];
                NumericExpression zeroExpr = new IntegerLiteral(stmt, exprFactory.getMappingForType(Integer.class, false), Integer.valueOf(0), null);
                whenExprs[0] = locateExpr.gt(zeroExpr);

                SQLExpression[] actionExprs = new SQLExpression[1];
                SQLExpression oneExpr = ExpressionUtils.getLiteralForOne(stmt);
                NumericExpression posExpr1 = new NumericExpression(locateExpr, Expression.OP_SUB, oneExpr);
                actionExprs[0] = new NumericExpression(posExpr1, Expression.OP_ADD, fromExpr);

                SQLExpression elseExpr = new IntegerLiteral(stmt, exprFactory.getMappingForType(Integer.class, false), Integer.valueOf(-1), null);

                return new CaseExpression(whenExprs, actionExprs, elseExpr);
            }
        }
    }
View Full Code Here

    {
        if (expr instanceof StringLiteral)
        {
            JavaTypeMapping m = exprFactory.getMappingForType(int.class, false);
            String val = (String)((StringLiteral)expr).getValue();
            return new IntegerLiteral(stmt, m, Integer.valueOf(val.length()), null);
        }
        else if (expr instanceof StringExpression || expr instanceof ParameterLiteral)
        {
            ArrayList funcArgs = new ArrayList();
            funcArgs.add(expr);
View Full Code Here

            }
            else if (expr instanceof IntegerLiteral)
            {
                int originalValue = ((Number) ((IntegerLiteral) expr).getValue()).intValue();
                Integer absValue = Integer.valueOf(Math.abs(originalValue));
                return new IntegerLiteral(stmt, expr.getJavaTypeMapping(), absValue, null);
            }
            else if (expr instanceof FloatingPointLiteral)
            {
                double originalValue = ((BigDecimal) ((FloatingPointLiteral) expr).getValue()).doubleValue();
                Double absValue = new Double(Math.abs(originalValue));
View Full Code Here

    {
        if (expr instanceof StringLiteral)
        {
            JavaTypeMapping m = exprFactory.getMappingForType(int.class, false);
            String val = (String)((StringLiteral)expr).getValue();
            return new IntegerLiteral(stmt, m, Integer.valueOf(val.length()), null);
        }
        else if (expr instanceof StringExpression || expr instanceof ParameterLiteral)
        {
            ArrayList funcArgs = new ArrayList();
            funcArgs.add(expr);
View Full Code Here

    public SQLExpression getExpression(SQLExpression expr, List args)
    {
        if (expr instanceof EnumLiteral)
        {
            Enum val = (Enum)((EnumLiteral)expr).getValue();
            return new IntegerLiteral(stmt,
                exprFactory.getMappingForType(int.class, false), val.ordinal(), null);
        }
        else if (expr instanceof EnumExpression)
        {
            EnumExpression enumExpr = (EnumExpression)expr;
View Full Code Here

    {
        if (expr instanceof StringLiteral)
        {
            JavaTypeMapping m = exprFactory.getMappingForType(int.class, false);
            String val = (String)((StringLiteral)expr).getValue();
            return new IntegerLiteral(stmt, m, Integer.valueOf(val.length()), null);
        }
        else if (expr instanceof StringExpression || expr instanceof ParameterLiteral)
        {
            ArrayList funcArgs = new ArrayList();
            funcArgs.add(expr);
View Full Code Here

TOP

Related Classes of org.datanucleus.store.rdbms.sql.expression.IntegerLiteral

Copyright © 2018 www.massapicom. 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.