openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "catalina wei" <catalina....@gmail.com>
Subject Re: svn commit: r661472 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel: JDBCStoreQuery.java exps/Abs.java exps/Math.java exps/Sqrt.java exps/UnaryOp.java exps/Val.java
Date Thu, 29 May 2008 21:15:05 GMT
Sorry,
thanks for catching that.  Title is correct, but wrong JIRA issue number.
Is there anything I can do about it ?

Catalina

On Thu, May 29, 2008 at 1:52 PM, Michael Dick <michael.d.dick@gmail.com>
wrote:

> FYI I think this is linked to the wrong JIRA issue. The patch was provided
> for OPENJPA-616, not 617.
>
> On Thu, May 29, 2008 at 3:38 PM, <fancy@apache.org> wrote:
>
> > Author: fancy
> > Date: Thu May 29 13:38:21 2008
> > New Revision: 661472
> >
> > URL: http://svn.apache.org/viewvc?rev=661472&view=rev
> > Log:
> > OPENJPA-617 Add support for calculating update value in
> > QueryImpl.updateInMemory
> > Help comitting patch provided by Fay Wang
> > Add support for in-memory math - sqrt, abs functions
> >
> > Modified:
> >
> >
>  openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java
> >
> >
>  openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java
> >
> >
>  openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java
> >
> >
>  openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java
> >
> >
>  openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java
> >
> >
>  openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
> >
> > Modified:
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java
> > URL:
> >
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java?rev=661472&r1=661471&r2=661472&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java
> > (original)
> > +++
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java
> > Thu May 29 13:38:21 2008
> > @@ -707,6 +707,10 @@
> >             return handleTrimVal(value, ob, params, sm);
> >         case Val.INDEXOF_VAL:
> >             return handleIndexOfVal(value, ob, params, sm);
> > +        case Val.ABS_VAL:
> > +            return handleAbsVal(value, ob, params, sm);
> > +        case Val.SQRT_VAL:
> > +            return handleSqrtVal(value, ob, params, sm);
> >         default:
> >             throw new UnsupportedException();
> >         }
> > @@ -853,11 +857,47 @@
> >             (org.apache.openjpa.jdbc.kernel.exps.IndexOf) value;
> >         String val1 = (String) getValue(locateVal.getVal1(), ob, params,
> > sm);
> >         Val[] val2 = (Val[]) getValue(locateVal.getVal2(), ob, params,
> sm);
> > -        String strVal = (String)getValue(val2[0], ob, params, sm);
> > +        String strVal = (String) getValue(val2[0], ob, params, sm);
> >         int idx = ((Long) getValue(val2[1], ob, params, sm)).intValue();
> >         return strVal.indexOf(val1, idx);
> >     }
> >
> > +    private Object handleAbsVal(Object value, Object ob, Object[]
> params,
> > +        OpenJPAStateManager sm) {
> > +        org.apache.openjpa.jdbc.kernel.exps.Abs absVal =
> > +            (org.apache.openjpa.jdbc.kernel.exps.Abs) value;
> > +        Object val = getValue(absVal.getValue(), ob, params, sm);
> > +        Class c = val.getClass();
> > +        if (c == Integer.class)
> > +            return new Integer(java.lang.Math.abs(((Integer)
> > val).intValue()));
> > +        else if (c == Float.class)
> > +            return new Float(java.lang.Math.abs(((Float)
> > val).floatValue()));
> > +        else if (c == Double.class)
> > +            return new Double(java.lang.Math.abs(((Double)
> > val).doubleValue()));
> > +        else if (c == Long.class)
> > +            return new Long(java.lang.Math.abs(((Long)
> val).longValue()));
> > +        throw new UnsupportedException();
> > +    }
> > +
> > +    private Object handleSqrtVal(Object value, Object ob, Object[]
> params,
> > +        OpenJPAStateManager sm) {
> > +        org.apache.openjpa.jdbc.kernel.exps.Sqrt sqrtVal =
> > +            (org.apache.openjpa.jdbc.kernel.exps.Sqrt) value;
> > +        Object val = getValue(sqrtVal.getValue(), ob, params, sm);
> > +        Class c = val.getClass();
> > +        if (c == Integer.class)
> > +            return new Double(java.lang.Math.sqrt(((Integer) val).
> > +                doubleValue()));
> > +        else if (c == Float.class)
> > +            return new Double(java.lang.Math.sqrt(((Float)
> > val).floatValue()));
> > +        else if (c == Double.class)
> > +            return new Double(java.lang.Math.sqrt(((Double) val).
> > +                doubleValue()));
> > +        else if (c == Long.class)
> > +            return new Double(java.lang.Math.sqrt(((Long)
> > val).doubleValue()));
> > +        throw new UnsupportedException();
> > +    }
> > +
> >     private Object getValue(Object value, Object ob, Object[] params,
> >         OpenJPAStateManager sm) {
> >         if (value instanceof PCPath) {
> >
> > Modified:
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java
> > URL:
> >
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java?rev=661472&r1=661471&r2=661472&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java
> > (original)
> > +++
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Abs.java
> > Thu May 29 13:38:21 2008
> > @@ -26,7 +26,7 @@
> >  /**
> >  * Absolute value.
> >  */
> > -class Abs
> > +public class Abs
> >     extends UnaryOp {
> >
> >     /**
> > @@ -51,5 +51,9 @@
> >     protected String getOperator() {
> >         return "ABS";
> >     }
> > +
> > +    public int getId() {
> > +        return Val.ABS_VAL;
> > +    }
> >  }
> >
> >
> > Modified:
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java
> > URL:
> >
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java?rev=661472&r1=661471&r2=661472&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java
> > (original)
> > +++
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Math.java
> > Thu May 29 13:38:21 2008
> > @@ -154,5 +154,9 @@
> >         _val2.acceptVisit(visitor);
> >         visitor.exit(this);
> >     }
> > +
> > +    public int getId() {
> > +        return Val.MATH_VAL;
> > +    }
> >  }
> >
> >
> > Modified:
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java
> > URL:
> >
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java?rev=661472&r1=661471&r2=661472&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java
> > (original)
> > +++
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Sqrt.java
> > Thu May 29 13:38:21 2008
> > @@ -23,7 +23,7 @@
> >  *
> >  * @author Abe White
> >  */
> > -class Sqrt
> > +public class Sqrt
> >     extends UnaryOp {
> >
> >     /**
> > @@ -40,5 +40,9 @@
> >     protected String getOperator() {
> >         return "SQRT";
> >     }
> > +
> > +    public int getId() {
> > +        return Val.SQRT_VAL;
> > +    }
> >  }
> >
> >
> > Modified:
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java
> > URL:
> >
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java?rev=661472&r1=661471&r2=661472&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java
> > (original)
> > +++
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java
> > Thu May 29 13:38:21 2008
> > @@ -53,7 +53,7 @@
> >         _noParen = noParen;
> >     }
> >
> > -    protected Val getValue() {
> > +    public Val getValue() {
> >         return _val;
> >     }
> >
> >
> > Modified:
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
> > URL:
> >
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java?rev=661472&r1=661471&r2=661472&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
> > (original)
> > +++
> >
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
> > Thu May 29 13:38:21 2008
> > @@ -62,6 +62,8 @@
> >     public final int LOCATE_VAL = 8;
> >     public final int ARGS_VAL = 9;
> >     public final int INDEXOF_VAL = 10;
> > +    public final int ABS_VAL = 11;
> > +    public final int SQRT_VAL = 12;
> >
> >     /**
> >      * Initialize the value. This method should recursively initialize
> any
> >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message