Examples of ScalarExpression


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

        return mappingSampleValue;
    }

    public ScalarExpression newLiteral(QueryExpression qs, Object value)
    {
        ScalarExpression expr = new IntegerLiteral(qs, this, (Number)value);
        return expr;       
    }
View Full Code Here

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

        return expr;       
    }

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

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

    return mappingSampleValue;
  }
 
    public ScalarExpression newLiteral(QueryExpression qs, Object value)
    {
        ScalarExpression expr = new IntegerLiteral(qs, this, (Number)value);
        return expr;
    }
View Full Code Here

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

        return expr;
    }

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

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

    // ---------------------------- JDOQL Query Methods --------------------------------------

    public ScalarExpression newLiteral(QueryExpression qs, Object value)
    {
        ScalarExpression expr = new ObjectLiteral(qs, this, value,getType());
        return expr;       
    }
View Full Code Here

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

                    QueryExpression st = storeMgr.getDatastoreAdapter().newQueryStatement(subclassTable, subclassTableIdentifier, om.getClassLoaderResolver());
                    LogicSetExpression table_expr_sub = st.newTableExpression(subclassTable, subclassTableIdentifier);
                    JavaTypeMapping subMapping = subclassTable.getIDMapping();
                    st.select(subclassTableIdentifier, subMapping);

                    ScalarExpression subExpr = subMapping.newScalarExpression(qs, table_expr_sub);
                    ScalarExpression schExpr =
                        (((DatastoreClass)schemaDataOption.getDatastoreContainerObject()).getIDMapping()).newScalarExpression(
                            qs,qs.getMainTableExpression());
                    qs.leftOuterJoin(subExpr, schExpr, table_expr_sub, true);
                    qs.andCondition(new NullLiteral(qs).eq(subExpr));
                }
            }

            // WHERE (object id) = ?
            JavaTypeMapping idMapping = ((DatastoreClass)schemaDataOption.getDatastoreContainerObject()).getIDMapping();

            // We have to create a StateManager here just to map fields from the AppId key object
            // to the table fields. Really the table should have some way of doing this. TODO : Refactor this
            Class pc_class = om.getClassLoaderResolver().classForName(schemaDataOption.getName());
            StateManager sm = StateManagerFactory.newStateManagerForHollow(om,pc_class,id);
            ScalarExpression fieldExpr = idMapping.newScalarExpression(qs, qs.getMainTableExpression());
            ScalarExpression fieldValue = idMapping.newLiteral(qs, sm.getObject());
            qs.andCondition(fieldExpr.eq(fieldValue), true);
            // Discriminator for this class
            JavaTypeMapping discrimMapping = schemaDataOption.getDatastoreContainerObject().getDiscriminatorMapping(false);
            DiscriminatorMetaData discrimMetaData = cmd.getInheritanceMetaData().getDiscriminatorMetaData();
            if (discrimMapping != null)
            {
                ScalarExpression discrimExpr = discrimMapping.newScalarExpression(qs, qs.getMainTableExpression());
                Object value = null;
                if (cmd.getDiscriminatorStrategy() == DiscriminatorStrategy.CLASS_NAME)
                {
                    value = schemaDataOption.getName();
                }
                else if (cmd.getDiscriminatorStrategy() == DiscriminatorStrategy.VALUE_MAP)
                {
                    value = discrimMetaData.getValue();
                }
                ScalarExpression discrimValue = discrimMapping.newLiteral(qs, value);
                qs.andCondition(discrimExpr.eq(discrimValue), true);
            }

            if (qs_base==null)
            {
View Full Code Here

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

        // WHERE (object id) = ?
        // We have to create a StateManager here just to map fields from the AppId key object to the table fields.
        // Really the table should have some way of doing this. TODO : Refactor this
        StateManager sm = StateManagerFactory.newStateManagerForHollow(om, objectClass, id);
        JavaTypeMapping idMapping = primaryTable.getIDMapping();
        ScalarExpression fieldExpr = idMapping.newScalarExpression(stmt, stmt.getMainTableExpression());
        ScalarExpression fieldValue = idMapping.newLiteral(stmt, sm.getObject());
        stmt.andCondition(fieldExpr.eq(fieldValue), true);

        // Perform the query
        try
        {
View Full Code Here

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

     * @param from The from position
     * @return The text of the SQL expression.
     */
    public NumericExpression indexOfMethod(ScalarExpression source, ScalarExpression str, NumericExpression from)
    {
        ScalarExpression integerLiteral = getMapping(BigInteger.class, source).newLiteral(source.getQueryExpression(), BigInteger.ONE);

        ArrayList args = new ArrayList();
        args.add(source);
        args.add(str);
        if (from != null)
        {
            // Add 1 to the passed in value so that it is of origin 1 to be compatible with LOCATE
            args.add(from.add(integerLiteral));
        }
        else
        {
            ScalarExpression literal = getMapping(BigInteger.class, source).newLiteral(source.getQueryExpression(), BigInteger.ZERO);
            args.add(literal);
        }
        NumericExpression locateExpr = new NumericExpression("JPOX_STRPOS", args);

        // Subtract 1 from the result of STRPOS to be consistent with Java strings
View Full Code Here

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

     **/
    public BooleanExpression startsWithMethod(ScalarExpression source, ScalarExpression str)
    {
        JavaTypeMapping m = getMapping(BigInteger.class, source);
       
        ScalarExpression integerLiteral = m.newLiteral(source.getQueryExpression(), BigInteger.ONE);
        ArrayList args = new ArrayList();
        args.add(source);
        args.add(str);
        ScalarExpression literal = getMapping(BigInteger.class, source).newLiteral(source.getQueryExpression(), BigInteger.ZERO);
        args.add(literal);
        //JPOX_STRPOS( SearchString, stringSearched, [StartPosition] )
        return new BooleanExpression(new StringExpression("JPOX_STRPOS", args),ScalarExpression.OP_EQ,integerLiteral);
    }
View Full Code Here

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

            throw new IllegalArgumentTypeException(rightOperand);
        }
       
        JavaTypeMapping m = getMapping(BigInteger.class, leftOperand);
       
        ScalarExpression integerLiteral = m.newLiteral(leftOperand.getQueryExpression(), BigInteger.ONE);
        ArrayList args = new ArrayList();
        args.add(leftOperand);
        args.add(rightOperand);
        ScalarExpression literal = getMapping(BigInteger.class, leftOperand).newLiteral(leftOperand.getQueryExpression(), BigInteger.ZERO);
        args.add(literal);
        //JPOX_STRPOS( SearchString, stringSearched, [StartPosition] )
        return new BooleanExpression(new StringExpression("JPOX_STRPOS", args),ScalarExpression.OP_EQ,lengthMethod((StringExpression)leftOperand).sub(lengthMethod((StringExpression)rightOperand)).add(integerLiteral).encloseWithInParentheses());
    }
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.