List:Commits« Previous MessageNext Message »
From:Craig L Russell Date:March 23 2011 10:45pm
Subject:bzr push into mysql-5.1-telco-7.1 branch (Craig.Russell:4139 to 4140)
View as plain text  
 4140 Craig L Russell	2011-03-23
      WARNING: ClusterJ backward compatibility broken
      Change the name of the accessor method in ColumnMetadata from type() to columnType()
      Change the name of the enum from com.mysql.clusterj.ColumnMetadata.Type to com.mysql.clusterj.ColumnType
      Both changes will require source code recompile.
      This change was necessitated by the documentation tool not being able to detect the difference
      between the class ColumnMetadata.Type and the method ColumnMetadata.type().

    added:
      storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnType.java
    modified:
      storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnMetadata.java
      storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/AbstractDomainFieldHandlerImpl.java
      storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/DomainFieldHandlerImpl.java
      storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/store/Column.java
      storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/DynamicObjectTest.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ColumnImpl.java
 4139 Craig L Russell	2011-03-22
      Typo in query in test

    modified:
      storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/QueryInTest.java
=== modified file 'storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnMetadata.java'
--- a/storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnMetadata.java	2010-12-21 00:52:28 +0000
+++ b/storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnMetadata.java	2011-03-23 22:41:01 +0000
@@ -1,5 +1,5 @@
 /*
-   Copyright 2010, Oracle and/or its affiliates. All rights reserved.
+   Copyright 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ public interface ColumnMetadata {
     /** Return the type of the column.
      * @return the type of the column
      */
-    Type type();
+    ColumnType columnType();
 
     /** Return the java type of the column.
      * @return the java type of the column
@@ -76,39 +76,4 @@ public interface ColumnMetadata {
      */
     String charsetName();
 
-    public enum Type {
-
-        Bigint,          ///< 64 bit. 8 byte signed integer, can be used in array
-        Bigunsigned,     ///< 64 Bit. 8 byte signed integer, can be used in array
-        Binary,          ///< Len
-        Bit,             ///< Bit, length specifies no of bits
-        Blob,            ///< Binary large object (see NdbBlob)
-        Char,            ///< Len. A fixed array of 1-byte chars
-        Date,            ///< Precision down to 1 day(sizeof(Date) == 4 bytes )
-        Datetime,        ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
-        Double,          ///< 64-bit float. 8 byte float, can be used in array
-        Decimal,         ///< MySQL >= 5.0 signed decimal,  Precision, Scale
-        Decimalunsigned,
-        Float,           ///< 32-bit float. 4 bytes float, can be used in array
-        Int,             ///< 32 bit. 4 byte signed integer, can be used in array
-        Longvarchar,     ///< Length bytes: 2, little-endian
-        Longvarbinary,   ///< Length bytes: 2, little-endian
-        Mediumint,       ///< 24 bit. 3 byte signed integer, can be used in array
-        Mediumunsigned,  ///< 24 bit. 3 byte unsigned integer, can be used in array
-        Olddecimal,
-        Olddecimalunsigned,
-        Smallint,        ///< 16 bit. 2 byte signed integer, can be used in array
-        Smallunsigned,   ///< 16 bit. 2 byte unsigned integer, can be used in array
-        Text,            ///< Text blob
-        Time,            ///< Time without date
-        Timestamp,       ///< Unix time
-        Tinyint,         ///< 8 bit. 1 byte signed integer, can be used in array
-        Tinyunsigned,    ///< 8 bit. 1 byte unsigned integer, can be used in array
-        Undefined,
-        Unsigned,        ///< 32 bit. 4 byte unsigned integer, can be used in array
-        Varbinary,       ///< Length bytes: 1, Max: 255
-        Varchar,         ///< Length bytes: 1, Max: 255
-        Year             ///< Year 1901-2155 (1 byte)
-    }
-
 }

=== added file 'storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnType.java'
--- a/storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnType.java	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-api/src/main/java/com/mysql/clusterj/ColumnType.java	2011-03-23 22:41:01 +0000
@@ -0,0 +1,56 @@
+/*
+   Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+package com.mysql.clusterj;
+
+/** This class enumerates the column types for columns in ndb.
+ *
+ */
+public enum ColumnType {
+
+    Bigint,          ///< 64 bit. 8 byte signed integer, can be used in array
+    Bigunsigned,     ///< 64 Bit. 8 byte signed integer, can be used in array
+    Binary,          ///< Length is fixed. A fixed array of 1-byte values
+    Bit,             ///< Bit, length specifies no of bits
+    Blob,            ///< Binary large object (see NdbBlob)
+    Char,            ///< Length is fixed. A fixed array of 1-byte chars
+    Date,            ///< Precision down to 1 day(sizeof(Date) == 4 bytes )
+    Datetime,        ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
+    Double,          ///< 64-bit float. 8 byte float, can be used in array
+    Decimal,         ///< MySQL >= 5.0 signed decimal,  Precision, Scale
+    Decimalunsigned,
+    Float,           ///< 32-bit float. 4 bytes float, can be used in array
+    Int,             ///< 32 bit. 4 byte signed integer, can be used in array
+    Longvarchar,     ///< Length bytes: 2, little-endian
+    Longvarbinary,   ///< Length bytes: 2, little-endian
+    Mediumint,       ///< 24 bit. 3 byte signed integer, can be used in array
+    Mediumunsigned,  ///< 24 bit. 3 byte unsigned integer, can be used in array
+    Olddecimal,
+    Olddecimalunsigned,
+    Smallint,        ///< 16 bit. 2 byte signed integer, can be used in array
+    Smallunsigned,   ///< 16 bit. 2 byte unsigned integer, can be used in array
+    Text,            ///< Text blob
+    Time,            ///< Time without date
+    Timestamp,       ///< Unix time
+    Tinyint,         ///< 8 bit. 1 byte signed integer, can be used in array
+    Tinyunsigned,    ///< 8 bit. 1 byte unsigned integer, can be used in array
+    Undefined,
+    Unsigned,        ///< 32 bit. 4 byte unsigned integer, can be used in array
+    Varbinary,       ///< Length bytes: 1, Max: 255
+    Varchar,         ///< Length bytes: 1, Max: 255
+    Year             ///< Year 1901-2155 (1 byte)
+}

=== modified file 'storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/AbstractDomainFieldHandlerImpl.java'
--- a/storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/AbstractDomainFieldHandlerImpl.java	2011-03-22 01:48:09 +0000
+++ b/storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/AbstractDomainFieldHandlerImpl.java	2011-03-23 22:41:01 +0000
@@ -21,6 +21,7 @@ import com.mysql.clusterj.ClusterJDatast
 import com.mysql.clusterj.ClusterJFatalInternalException;
 import com.mysql.clusterj.ClusterJUserException;
 import com.mysql.clusterj.ColumnMetadata;
+import com.mysql.clusterj.ColumnType;
 import com.mysql.clusterj.core.spi.ValueHandler;
 import com.mysql.clusterj.core.spi.DomainTypeHandler;
 import com.mysql.clusterj.core.query.CandidateIndexImpl;
@@ -90,7 +91,7 @@ public abstract class AbstractDomainFiel
     protected boolean partitionKey;
 
     /** The Store Type for the column. */
-    protected Type storeColumnType = null;
+    protected ColumnType storeColumnType = null;
 
     /** Column names in the case of a field mapped to multiple columns, e.g. foreign keys */
     protected String[] columnNames;
@@ -2753,7 +2754,7 @@ public abstract class AbstractDomainFiel
         return scale;
     }
 
-    public Type type() {
+    public ColumnType columnType() {
         return this.storeColumnType;
     }
 

=== modified file 'storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/DomainFieldHandlerImpl.java'
--- a/storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/DomainFieldHandlerImpl.java	2011-02-06 21:37:05 +0000
+++ b/storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/metadata/DomainFieldHandlerImpl.java	2011-03-23 22:41:01 +0000
@@ -20,6 +20,7 @@ package com.mysql.clusterj.core.metadata
 import com.mysql.clusterj.core.spi.ValueHandler;
 import com.mysql.clusterj.ClusterJDatastoreException;
 import com.mysql.clusterj.ClusterJUserException;
+import com.mysql.clusterj.ColumnType;
 
 import com.mysql.clusterj.annotation.Column;
 import com.mysql.clusterj.annotation.Lob;
@@ -218,7 +219,7 @@ public class DomainFieldHandlerImpl exte
             } else if (type.equals(Long.class)) {
                 objectOperationHandlerDelegate = objectOperationHandlerObjectLong;
             } else if (type.equals(Short.class)) {
-                if (Type.Year.equals(storeColumnType)) {
+                if (ColumnType.Year.equals(storeColumnType)) {
                     objectOperationHandlerDelegate = objectOperationHandlerObjectShortYear;
                 } else {
                     objectOperationHandlerDelegate = objectOperationHandlerObjectShort;
@@ -230,7 +231,7 @@ public class DomainFieldHandlerImpl exte
             } else if (type.equals(long.class)) {
                 objectOperationHandlerDelegate = objectOperationHandlerLong;
             } else if (type.equals(short.class)) {
-                if (Type.Year.equals(storeColumnType)) {
+                if (ColumnType.Year.equals(storeColumnType)) {
                     objectOperationHandlerDelegate = objectOperationHandlerShortYear;
                 } else {
                     objectOperationHandlerDelegate = objectOperationHandlerShort;

=== modified file 'storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/store/Column.java'
--- a/storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/store/Column.java	2011-02-02 09:52:33 +0000
+++ b/storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/store/Column.java	2011-03-23 22:41:01 +0000
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 
 package com.mysql.clusterj.core.store;
 
-import com.mysql.clusterj.ColumnMetadata.Type;
+import com.mysql.clusterj.ColumnType;
 
 /** Column metadata for ndb columns.
  *
@@ -33,7 +33,7 @@ public interface Column {
      * 
      * @return the store type
      */
-    public Type getType();
+    public ColumnType getType();
 
     /** Is this column a primary key column?
      * @return true if this column is a primary key column

=== modified file 'storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/DynamicObjectTest.java'
--- a/storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/DynamicObjectTest.java	2011-02-02 09:52:33 +0000
+++ b/storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/DynamicObjectTest.java	2011-03-23 22:41:01 +0000
@@ -17,15 +17,11 @@
 
 package testsuite.clusterj;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 import com.mysql.clusterj.ClusterJUserException;
+import com.mysql.clusterj.ColumnType;
 import com.mysql.clusterj.DynamicObject;
 import com.mysql.clusterj.ColumnMetadata;
 import com.mysql.clusterj.Query;
-import com.mysql.clusterj.ColumnMetadata.Type;
 import com.mysql.clusterj.annotation.PersistenceCapable;
 import com.mysql.clusterj.query.QueryBuilder;
 import com.mysql.clusterj.query.QueryDomainType;
@@ -42,7 +38,7 @@ public class DynamicObjectTest extends A
 
     private Object[] expectedTBasicNames = new Object[] {"id", "name", "age", "magic"};
 
-    private Object[] expectedTBasicTypes = new Object[] {Type.Int, Type.Varchar, Type.Int, Type.Int};
+    private Object[] expectedTBasicTypes = new Object[] {ColumnType.Int, ColumnType.Varchar, ColumnType.Int, ColumnType.Int};
 
     private Object[] expectedTBasicJavaTypes = new Object[] {Integer.class, String.class, Integer.class, Integer.class};
 
@@ -181,11 +177,6 @@ public class DynamicObjectTest extends A
     }
 
     private static class DynamicObjectPrivate extends DynamicObject {
-        public DynamicObjectPrivate() {}
-        @Override
-        public String table() {
-            return "DynamicObjectProtectedConstructor";
-        }        
     }
 
     public class DynamicObjectNonStatic extends DynamicObject {
@@ -220,7 +211,7 @@ public class DynamicObjectTest extends A
         ColumnMetadata[] metadata = tbasic.columnMetadata();
         for (int i = 0; i < metadata.length; ++i) {
             errorIfNotEqual("t_basic column " + i + " name", expectedTBasicNames[i], metadata[i].name());
-            errorIfNotEqual("t_basic column " + i + " type", expectedTBasicTypes[i], metadata[i].type());
+            errorIfNotEqual("t_basic column " + i + " type", expectedTBasicTypes[i], metadata[i].columnType());
             errorIfNotEqual("t_basic column " + i + " javaType", expectedTBasicJavaTypes[i], metadata[i].javaType());
             errorIfNotEqual("t_basic column " + i + " maximumLength", expectedTBasicMaximumLengths[i], metadata[i].maximumLength());
             errorIfNotEqual("t_basic column " + i + " charsetName", expectedTBasicCharsetNames [i], metadata[i].charsetName());

=== modified file 'storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ColumnImpl.java'
--- a/storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ColumnImpl.java	2011-02-04 22:14:36 +0000
+++ b/storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ColumnImpl.java	2011-03-23 22:41:01 +0000
@@ -23,7 +23,7 @@ import com.mysql.ndbjtie.ndbapi.NdbDicti
 import com.mysql.clusterj.ClusterJDatastoreException;
 import com.mysql.clusterj.ClusterJFatalInternalException;
 
-import com.mysql.clusterj.ColumnMetadata.Type;
+import com.mysql.clusterj.ColumnType;
 
 import com.mysql.clusterj.core.store.Column;
 
@@ -57,7 +57,7 @@ class ColumnImpl implements Column {
     private int charsetNumber = 0;
 
     /** The ndb column type for the column */
-    private Type columnType;
+    private ColumnType columnType;
 
     /** The prefix length for variable size columns */
     private int prefixLength = -1;
@@ -238,43 +238,43 @@ class ColumnImpl implements Column {
         }
     }
 
-    public Type getType() {
+    public ColumnType getType() {
         return columnType;
     }
 
-    private Type convertType(int type) {
+    private ColumnType convertType(int type) {
         switch (type) {
-            case ColumnConst.Type.Bigint: return Type.Bigint;
-            case ColumnConst.Type.Bigunsigned: return Type.Bigunsigned;
-            case ColumnConst.Type.Binary: return Type.Binary;
-            case ColumnConst.Type.Bit: return Type.Bit;
-            case ColumnConst.Type.Blob: return Type.Blob;
-            case ColumnConst.Type.Char: return Type.Char;
-            case ColumnConst.Type.Date: return Type.Date;
-            case ColumnConst.Type.Datetime: return Type.Datetime;
-            case ColumnConst.Type.Decimal: return Type.Decimal;
-            case ColumnConst.Type.Decimalunsigned: return Type.Decimalunsigned;
-            case ColumnConst.Type.Double: return Type.Double;
-            case ColumnConst.Type.Float: return Type.Float;
-            case ColumnConst.Type.Int: return Type.Int;
-            case ColumnConst.Type.Longvarbinary: return Type.Longvarbinary;
-            case ColumnConst.Type.Longvarchar: return Type.Longvarchar;
-            case ColumnConst.Type.Mediumint: return Type.Mediumint;
-            case ColumnConst.Type.Mediumunsigned: return Type.Mediumunsigned;
-            case ColumnConst.Type.Olddecimal: return Type.Olddecimal;
-            case ColumnConst.Type.Olddecimalunsigned: return Type.Olddecimalunsigned;
-            case ColumnConst.Type.Smallint: return Type.Smallint;
-            case ColumnConst.Type.Smallunsigned: return Type.Smallunsigned;
-            case ColumnConst.Type.Text: return Type.Text;
-            case ColumnConst.Type.Time: return Type.Time;
-            case ColumnConst.Type.Timestamp: return Type.Timestamp;
-            case ColumnConst.Type.Tinyint: return Type.Tinyint;
-            case ColumnConst.Type.Tinyunsigned: return Type.Tinyunsigned;
-            case ColumnConst.Type.Undefined: return Type.Undefined;
-            case ColumnConst.Type.Unsigned: return Type.Unsigned;
-            case ColumnConst.Type.Varbinary: return Type.Varbinary;
-            case ColumnConst.Type.Varchar: return Type.Varchar;
-            case ColumnConst.Type.Year: return Type.Year;
+            case ColumnConst.Type.Bigint: return ColumnType.Bigint;
+            case ColumnConst.Type.Bigunsigned: return ColumnType.Bigunsigned;
+            case ColumnConst.Type.Binary: return ColumnType.Binary;
+            case ColumnConst.Type.Bit: return ColumnType.Bit;
+            case ColumnConst.Type.Blob: return ColumnType.Blob;
+            case ColumnConst.Type.Char: return ColumnType.Char;
+            case ColumnConst.Type.Date: return ColumnType.Date;
+            case ColumnConst.Type.Datetime: return ColumnType.Datetime;
+            case ColumnConst.Type.Decimal: return ColumnType.Decimal;
+            case ColumnConst.Type.Decimalunsigned: return ColumnType.Decimalunsigned;
+            case ColumnConst.Type.Double: return ColumnType.Double;
+            case ColumnConst.Type.Float: return ColumnType.Float;
+            case ColumnConst.Type.Int: return ColumnType.Int;
+            case ColumnConst.Type.Longvarbinary: return ColumnType.Longvarbinary;
+            case ColumnConst.Type.Longvarchar: return ColumnType.Longvarchar;
+            case ColumnConst.Type.Mediumint: return ColumnType.Mediumint;
+            case ColumnConst.Type.Mediumunsigned: return ColumnType.Mediumunsigned;
+            case ColumnConst.Type.Olddecimal: return ColumnType.Olddecimal;
+            case ColumnConst.Type.Olddecimalunsigned: return ColumnType.Olddecimalunsigned;
+            case ColumnConst.Type.Smallint: return ColumnType.Smallint;
+            case ColumnConst.Type.Smallunsigned: return ColumnType.Smallunsigned;
+            case ColumnConst.Type.Text: return ColumnType.Text;
+            case ColumnConst.Type.Time: return ColumnType.Time;
+            case ColumnConst.Type.Timestamp: return ColumnType.Timestamp;
+            case ColumnConst.Type.Tinyint: return ColumnType.Tinyint;
+            case ColumnConst.Type.Tinyunsigned: return ColumnType.Tinyunsigned;
+            case ColumnConst.Type.Undefined: return ColumnType.Undefined;
+            case ColumnConst.Type.Unsigned: return ColumnType.Unsigned;
+            case ColumnConst.Type.Varbinary: return ColumnType.Varbinary;
+            case ColumnConst.Type.Varchar: return ColumnType.Varchar;
+            case ColumnConst.Type.Year: return ColumnType.Year;
             default: throw new ClusterJFatalInternalException(
                     local.message("ERR_Unknown_Column_Type",
                     tableName, columnName, type));


Attachment: [text/bzr-bundle] bzr/craig.russell@oracle.com-20110323224101-q3l0hz6lmnhwwx2c.bundle
Thread
bzr push into mysql-5.1-telco-7.1 branch (Craig.Russell:4139 to 4140)Craig L Russell24 Mar
  • Re: bzr push into mysql-5.1-telco-7.1 branch (Craig.Russell:4139to 4140)Jonas Oreland24 Mar