Package nexj.core.persistence.operator

Examples of nexj.core.persistence.operator.ComparisonOperator


      if (query.getWhere() == null || query.getWhere().getOrdinal() != EqualsOperator.ORDINAL)
      {
         throw new InvalidQueryException("err.persistence.file.query");
      }
     
      ComparisonOperator op = (ComparisonOperator)query.getWhere();
      AttributeOperator aop;
      ConstantOperator con;
     
      if (op.getLeft().getOrdinal() == AttributeOperator.ORDINAL)
      {
         aop = (AttributeOperator)op.getLeft();
      }
      else if (op.getRight().getOrdinal() == AttributeOperator.ORDINAL)
      {
         aop = (AttributeOperator)op.getRight();
      }
      else
      {
         throw new InvalidQueryException("err.persistence.file.query");
      }
     
      if (op.getLeft().getOrdinal() == ConstantOperator.ORDINAL)
      {
         con = (ConstantOperator)op.getLeft();
      }
      else if (op.getRight().getOrdinal() == ConstantOperator.ORDINAL)
      {
         con = (ConstantOperator)op.getRight();
      }
      else
      {
         throw new InvalidQueryException("err.persistence.file.query");
      }
View Full Code Here


      /**
       * @see nexj.core.persistence.Query.OperatorFactory#create(nexj.core.scripting.Pair, nexj.core.persistence.Query, Object, byte)
       */
      public Operator create(Pair args, Query query, Object key, byte nOutput)
      {
         ComparisonOperator op = create(query);

         if (args == null || args.getTail() == null)
         {
            throw new InvalidQueryException("err.persistence.comparisonOperatorArgCount",
               new Object[]{op.getSymbol()});
         }

         if (!op.setLeft(query.createOperator(key, args.getHead(), nOutput)))
         {
            return null;
         }

         args = args.getNext();

         MultiArgOperator logical = null;

         for (;;)
         {
            if (!op.setRight(query.createOperator(key, args.getHead(), nOutput)))
            {
               return null;
            }

            op.initialize();

            if (args.getTail() == null)
            {
               break;
            }

            if (logical == null)
            {
               logical = createLogical(query);
               logical.addOperand(op);
            }

            ComparisonOperator right = create(query);

            if (!right.setLeft(query.createOperator(key, args.getHead(), nOutput)))
            {
               return null;
            }

            logical.addOperand(right);
View Full Code Here

      /**
       * @see nexj.core.persistence.sql.SQLGenerator.OperatorAppender#appendOperator(java.lang.StringBuffer, nexj.core.persistence.Operator, nexj.core.persistence.sql.SQLGenerator)
       */
      public void appendOperator(StringBuffer buf, Operator op, SQLGenerator gen)
      {
         ComparisonOperator compOp = (ComparisonOperator)op;
         Operator right = compOp.getRight();

         gen.appendComparisonOperand(buf, compOp.getLeft());

         if (right.isConstant() && right.getValue() == null)
         {
            buf.append(m_sNullComparison);
         }
View Full Code Here

TOP

Related Classes of nexj.core.persistence.operator.ComparisonOperator

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.