Ejemplo n.º 1
0
        /**
         * Find the variable in the expression.
         * @param expr the expression to look in
         * @return the index of the variable or -1 if there is not exactly one
         *   variable.
         */
        private int findVariable(ExprNodeDesc expr)
        {
            int result = -1;
            List <ExprNodeDesc> children = expr.getChildren();

            for (int i = 0; i < children.Count; ++i)
            {
                ExprNodeDesc child = children[i];
                if (child is ExprNodeColumnDesc)
                {
                    // if we already found a variable, this isn't a sarg
                    if (result != -1)
                    {
                        return(-1);
                    }
                    else
                    {
                        result = i;
                    }
                }
            }
            return(result);
        }
 /**
  * Find the variable in the expression.
  * @param expr the expression to look in
  * @return the index of the variable or -1 if there is not exactly one
  *   variable.
  */
 private int findVariable(ExprNodeDesc expr)
 {
     int result = -1;
     List<ExprNodeDesc> children = expr.getChildren();
     for (int i = 0; i < children.Count; ++i)
     {
         ExprNodeDesc child = children[i];
         if (child is ExprNodeColumnDesc)
         {
             // if we already found a variable, this isn't a sarg
             if (result != -1)
             {
                 return -1;
             }
             else
             {
                 result = i;
             }
         }
     }
     return result;
 }