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

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


                String nuctypeName = cls.getType();
                if (maxClassNameLength > nuctypeName.length())
                {
                    nuctypeName = StringUtils.leftAlignedPaddedString(nuctypeName, maxClassNameLength);
                }
                StringLiteral lit = new StringLiteral(tblStmt, m, nuctypeName, null);
                tblStmt.select(lit, UnionStatementGenerator.NUC_TYPE_COLUMN);

                if (stmt == null)
                {
                    stmt = tblStmt;
View Full Code Here


        if (expr instanceof SQLLiteral)
        {
            // Just convert the literal value directly
            if (((SQLLiteral)expr).getValue() == null)
            {
                return new StringLiteral(expr.getSQLStatement(), m, null, null);
            }
            return new StringLiteral(expr.getSQLStatement(), m, ((SQLLiteral)expr).getValue().toString(), null);
        }

        List args = new ArrayList();
        args.add(expr);
        List types = new ArrayList();
View Full Code Here

        if (expr instanceof SQLLiteral)
        {
            // Just convert the literal value directly
            if (((SQLLiteral)expr).getValue() == null)
            {
                return new StringLiteral(expr.getSQLStatement(), m, null, null);
            }
            return new StringLiteral(expr.getSQLStatement(), m, ((SQLLiteral)expr).getValue().toString(), null);
        }

        List args = new ArrayList();
        args.add(expr);
        List types = new ArrayList();
View Full Code Here

                String nuctypeName = className;
                if (maxClassNameLength > nuctypeName.length())
                {
                    nuctypeName = StringUtils.leftAlignedPaddedString(nuctypeName, maxClassNameLength);
                }
                StringLiteral lit = new StringLiteral(stmt, m, nuctypeName, null);
                stmt.select(lit, NUC_TYPE_COLUMN);
            /*}*/
        }
    }
View Full Code Here

    public SQLExpression getExpression(SQLExpression expr, List args)
    {
        if (expr instanceof StringLiteral)
        {
            String val = (String)((StringLiteral)expr).getValue();
            return new StringLiteral(stmt, expr.getJavaTypeMapping(), val.toUpperCase(), null);
        }
        return super.getExpression(expr, args);
    }
View Full Code Here

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

    public SQLExpression getExpression(SQLExpression expr, List args)
    {
        if (expr instanceof StringLiteral)
        {
            String val = (String)((StringLiteral)expr).getValue();
            return new StringLiteral(stmt, expr.getJavaTypeMapping(), val.trim(), null);
        }
        else
        {
            ArrayList funcArgs = new ArrayList();
            funcArgs.add(expr);
View Full Code Here

                    {
                        return new BooleanExpression(expr, Expression.OP_LIKE,
                            ExpressionUtils.getEscapedPatternExpression(substrExpr));
                    }
                }
                SQLExpression likeSubstrExpr = new StringLiteral(stmt,
                    expr.getJavaTypeMapping(), '%', null);
                return new BooleanExpression(expr, Expression.OP_LIKE,
                    likeSubstrExpr.add(ExpressionUtils.getEscapedPatternExpression(substrExpr)));
            }
            else
            {
                // Create a new StringExpression and manually update its SQL
                if (substrExpr.isParameter())
                {
                    // Any pattern expression cannot be a parameter here
                    SQLLiteral substrLit = (SQLLiteral)substrExpr;
                    stmt.getQueryGenerator().useParameterExpressionAsLiteral(substrLit);
                    if (substrLit.getValue() == null)
                    {
                        return new BooleanExpression(expr, Expression.OP_LIKE,
                            ExpressionUtils.getEscapedPatternExpression(substrExpr));
                    }
                }
                SQLExpression likeSubstrExpr = new StringLiteral(stmt,
                    expr.getJavaTypeMapping(), '%', null);
                return new BooleanExpression(expr, Expression.OP_LIKE,
                    likeSubstrExpr.add(ExpressionUtils.getEscapedPatternExpression(substrExpr)));
            }
        }
    }
View Full Code Here

                    {
                        return new BooleanExpression(expr, Expression.OP_LIKE,
                            ExpressionUtils.getEscapedPatternExpression(substrExpr));
                    }
                }
                SQLExpression likeSubstrExpr = new StringLiteral(stmt,
                    expr.getJavaTypeMapping(), '%', null);
                return new BooleanExpression(expr, Expression.OP_LIKE,
                    ExpressionUtils.getEscapedPatternExpression(substrExpr).add(likeSubstrExpr));
            }
            else
            {
                // Create a new StringExpression and manually update its SQL
                if (substrExpr.isParameter())
                {
                    // Any pattern expression cannot be a parameter here
                    SQLLiteral substrLit = (SQLLiteral)substrExpr;
                    stmt.getQueryGenerator().useParameterExpressionAsLiteral(substrLit);
                    if (substrLit.getValue() == null)
                    {
                        return new BooleanExpression(expr, Expression.OP_LIKE,
                            ExpressionUtils.getEscapedPatternExpression(substrExpr));
                    }
                }
                SQLExpression likeSubstrExpr = new StringLiteral(stmt,
                    expr.getJavaTypeMapping(), '%', null);
                return new BooleanExpression(expr, Expression.OP_LIKE,
                    ExpressionUtils.getEscapedPatternExpression(substrExpr).add(likeSubstrExpr));
            }
        }
View Full Code Here

    public SQLExpression getExpression(SQLExpression expr, List args)
    {
        if (expr instanceof StringLiteral)
        {
            String val = (String)((StringLiteral)expr).getValue();
            return new StringLiteral(stmt, expr.getJavaTypeMapping(), val.trim(), null);
        }
        return super.getExpression(expr, args);
    }
View Full Code Here

TOP

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

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.