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: r647250 - /openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
Date Sun, 13 Apr 2008 13:36:23 GMT
Personally, I think it's better to just put the changes into trunk at the
same time that we commit to one of the branches.  It keeps the branches in
synch, and it helps to avoid possible merge conflicts (due to other
unrelated changes being committed to trunk) later on.

Thanks,
Kevin

On Sat, Apr 12, 2008 at 6:55 AM, Patrick Linskey <plinskey@gmail.com> wrote:

> IMO, everything that happens in 1.1.x should go into trunk. However, since
> 1.1.x will be released well before anything from trunk, I think that it's
> fair to just do the work in 1.1.x and do a bulk merge later.
>
> -Patrick
>
>
> On Apr 11, 2008, at 2:49 PM, Albert Lee wrote:
>
> > Should this fix goes into the trunk too?
> >
> > Albert Lee.
> >
> > On Fri, Apr 11, 2008 at 1:07 PM, <awhite@apache.org> wrote:
> >
> >  Author: awhite
> > > Date: Fri Apr 11 11:07:12 2008
> > > New Revision: 647250
> > >
> > > URL: http://svn.apache.org/viewvc?rev=647250&view=rev
> > > Log:
> > > Submit patch for OPENJPA-564.
> > >
> > >
> > > Modified:
> > >
> > >
> > > openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
> > >
> > > Modified:
> > >
> > > openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
> > > URL:
> > >
> > > http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java?rev=647250&r1=647249&r2=647250&view=diff
> > >
> > >
> > > ==============================================================================
> > > ---
> > >
> > > openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
> > > (original)
> > > +++
> > >
> > > openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
> > > Fri Apr 11 11:07:12 2008
> > > @@ -18,6 +18,8 @@
> > > */
> > > package org.apache.openjpa.jdbc.sql;
> > >
> > > +import java.sql.Connection;
> > > +import java.sql.DatabaseMetaData;
> > > import java.sql.ResultSet;
> > > import java.sql.SQLException;
> > > import java.sql.Types;
> > > @@ -51,7 +53,7 @@
> > >   /**
> > >    * Whether the driver automatically deserializes blobs.
> > >    */
> > > -    public boolean driverDeserializesBlobs = true;
> > > +    public boolean driverDeserializesBlobs = false;
> > >
> > >   /**
> > >    * Whether to inline multi-table bulk-delete operations into MySQL's
> > > @@ -70,11 +72,9 @@
> > >       supportsDeferredConstraints = false;
> > >       constraintNameMode = CONS_NAME_MID;
> > >       supportsMultipleNontransactionalResultSets = false;
> > > -        supportsSubselect = false; // old versions
> > >       requiresAliasForSubselect = true; // new versions
> > >       supportsSelectStartIndex = true;
> > >       supportsSelectEndIndex = true;
> > > -        allowsAliasInBulkClause = false;
> > >
> > >       concatenateFunction = "CONCAT({0},{1})";
> > >
> > > @@ -110,6 +110,68 @@
> > >
> > >       typeModifierSet.addAll(Arrays.asList(new String[] { "UNSIGNED",
> > >           "ZEROFILL" }));
> > > +    }
> > > +
> > > +    public void connectedConfiguration(Connection conn) throws
> > > SQLException {
> > > +        super.connectedConfiguration(conn);
> > > +
> > > +        DatabaseMetaData metaData = conn.getMetaData();
> > > +        // The product version looks like 4.1.3-nt
> > > +        String productVersion = metaData.getDatabaseProductVersion();
> > > +        // The driver version looks like mysql-connector-java-3.1.11
> > > (...)
> > > +        String driverVersion = metaData.getDriverVersion();
> > > +
> > > +        try {
> > > +            int[] versions = getMajorMinorVersions(productVersion);
> > > +            int maj = versions[0];
> > > +            int min = versions[1];
> > > +            if (maj < 4 || (maj == 4 && min < 1)) {
> > > +                supportsSubselect = false;
> > > +                allowsAliasInBulkClause = false;
> > > +            }
> > > +
> > > +            versions = getMajorMinorVersions(driverVersion);
> > > +            maj = versions[0];
> > > +            if (maj < 5) {
> > > +                driverDeserializesBlobs = true;
> > > +            }
> > > +        } catch (IllegalArgumentException e) {
> > > +            // we don't understand the version format.
> > > +            // That is ok. We just take the default values.
> > > +        }
> > > +    }
> > > +
> > > +    private static int[] getMajorMinorVersions(String versionStr)
> > > +        throws IllegalArgumentException {
> > > +        int beginIndex = 0;
> > > +        int endIndex = 0;
> > > +
> > > +        versionStr = versionStr.trim();
> > > +        char[] charArr = versionStr.toCharArray();
> > > +        for (int i = 0; i < charArr.length; i++) {
> > > +            if (Character.isDigit(charArr[i])) {
> > > +                beginIndex = i;
> > > +                break;
> > > +            }
> > > +        }
> > > +
> > > +        for (int i = beginIndex+1; i < charArr.length; i++) {
> > > +            if (charArr[i] != '.' && !Character.isDigit(charArr[i]))
> > > {
> > > +                endIndex = i;
> > > +                break;
> > > +            }
> > > +        }
> > > +
> > > +        if (endIndex < beginIndex)
> > > +            throw new IllegalArgumentException();
> > > +
> > > +        String[] arr = versionStr.substring(beginIndex,
> > > endIndex).split("\\.");
> > > +        if (arr.length < 2)
> > > +            throw new IllegalArgumentException();
> > > +
> > > +        int maj = Integer.parseInt(arr[0]);
> > > +        int min = Integer.parseInt(arr[1]);
> > > +        return new int[]{maj, min};
> > >   }
> > >
> > >   public String[] getCreateTableSQL(Table table) {
> > >
> > >
> > >
> > >
> >
> > --
> > Albert Lee.
> >
>
> --
> Patrick Linskey
> 202 669 5907
>
>
>
>
>

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