openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter" <kwsut...@gmail.com>
Subject Re: svn commit: r567962 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Date Tue, 21 Aug 2007 12:28:03 GMT
Nice catches, Patrick.  These 1.5-specific items keep slipping through.
I've been talking with Mike and Marc about this -- maybe there's something
more automated that can be done to help prevent these type of changes from
slipping through.

The other change you caught with the unbalanced parens kind of scares me.
We ran both the regression bucket and JPA TCK against DB2 without this
getting caught.  Maybe this particular path isn't executed by those tests.
I am checking with Teresa to see if we need some new testcases for this.

Thanks again!
Kevin

On 8/21/07, pcl@apache.org <pcl@apache.org> wrote:
>
> Author: pcl
> Date: Mon Aug 20 22:26:15 2007
> New Revision: 567962
>
> URL: http://svn.apache.org/viewvc?rev=567962&view=rev
> Log:
> OPENJPA-321. Avoiding JDK1.5-specific String.replace() call. Also changed
> the method to return a well-balanced SQL, since it looks like the only usage
> is in a place where well-balanced-ness is possible.
>
> Modified:
>
>     openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
>
> Modified:
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=567962&r1=567961&r2=567962&view=diff
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
> (original)
> +++
> openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
> Mon Aug 20 22:26:15 2007
> @@ -37,6 +37,7 @@
> import org.apache.openjpa.meta.JavaTypes;
> import org.apache.openjpa.util.OpenJPAException;
> import org.apache.openjpa.util.UnsupportedException;
> +import serp.util.Strings;
>
> /**
>   * Dictionary for IBM DB2 database.
> @@ -630,7 +631,8 @@
>              String asString) {
>          String fstring = func;
>          if (func.indexOf(target) != -1)
> -            fstring = func.replace(target, "CAST(" + target + asString);
> +            fstring = Strings.replace(
> +                func, target, "CAST(" + target + asString + ")");
>          return fstring;
>      }
>
> @@ -659,7 +661,7 @@
>      public String getCastFunction(Val val, String func) {
>          if (val instanceof Lit || val instanceof Param)
>              if (func.indexOf("VARCHAR") == -1)
> -                func = addCastAsString(func, "{0}", " AS
> VARCHAR(1000))");
> +                func = addCastAsString(func, "{0}", " AS VARCHAR(1000)");
>          return func;
>      }
>
>
>
>

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