harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r548994 - in /harmony/enhanced/classlib/branches/java6/modules/sql/src: main/java/java/sql/ test/java/org/apache/harmony/sql/tests/java/sql/
Date Wed, 20 Jun 2007 08:32:08 GMT
Author: tonywu
Date: Wed Jun 20 01:32:06 2007
New Revision: 548994

URL: http://svn.apache.org/viewvc?view=rev&rev=548994
Log:
Apply patch HARMONY-4242 ([classlib][sql][java6] 2 new enums and several new fields in interfaces
in java.sql package)

Added:
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/ClientInfoStatus.java
  (with props)
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/RowIdLifetime.java
  (with props)
Modified:
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DatabaseMetaData.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Types.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DatabaseMetaDataTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java

Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/ClientInfoStatus.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/ClientInfoStatus.java?view=auto&rev=548994
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/ClientInfoStatus.java
(added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/ClientInfoStatus.java
Wed Jun 20 01:32:06 2007
@@ -0,0 +1,28 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+/**
+ * An enumeration to describe the reason why a property cannot be set by calling
+ * Connection.setClientInfo.
+ * 
+ * @since 1.6
+ */
+public enum ClientInfoStatus {
+	REASON_UNKNOWN, REASON_UNKNOWN_PROPERTY, REASON_VALUE_INVALID, REASON_VALUE_TRUNCATED,
+}

Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/ClientInfoStatus.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DatabaseMetaData.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DatabaseMetaData.java?view=diff&rev=548994&r1=548993&r2=548994
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DatabaseMetaData.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DatabaseMetaData.java
Wed Jun 20 01:32:06 2007
@@ -290,6 +290,71 @@
      * States that the version column may be a pseudo column or not.
      */
     public static final int versionColumnUnknown = 0;
+    
+    /**
+     * States that the method DatabaseMetaData.getSQLStateType may returns  an SQLSTATE value
or not.
+     */
+    public static final int sqlStateSQL = 2;
+
+    /**
+     * States that the parameter or column is an IN parameter
+     */
+    public static final int functionColumnIn = 1;
+
+    /**
+     * States that the parameter or column is an INOUT parameter
+     */
+    public static final int functionColumnInOut = 2;
+
+    /**
+     * States that the parameter or column is an OUT parameter
+     */
+    public static final int functionColumnOut = 3;
+
+    /**
+     * States that the parameter or column is a return value
+     */
+    public static final int functionReturn = 4;
+
+    /**
+     * States that the parameter of function is unknown
+     */
+    public static final int  functionColumnUnknown = 0;
+    
+    /**
+     * States that the parameter or column is a column in a result set
+     */
+    public static final int functionColumnResult = 5;
+
+    /**
+     * States that NULL values are not allowed
+     */
+    public static final int functionNoNulls = 0;
+
+    /**
+     * States that NULL values are allowed
+     */
+    public static final int functionNullable = 1;
+
+    /**
+     * States that whether NULL values are allowed is unknown
+     */
+    public static final int functionNullableUnknown = 2;
+
+    /**
+     * States that it is not known whether the function returns a result or a table
+     */
+    public static final int functionResultUnknown = 0;
+
+    /**
+     * States that the function does not return a table
+     */
+    public static final int functionNoTable = 1;
+
+    /**
+     * States that the function returns a table.
+     */
+    public static final int functionReturnsTable = 2;
 
     /**
      * Answers whether all procedures returned by <code>getProcedures</code>

Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/RowIdLifetime.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/RowIdLifetime.java?view=auto&rev=548994
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/RowIdLifetime.java
(added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/RowIdLifetime.java
Wed Jun 20 01:32:06 2007
@@ -0,0 +1,27 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+/**
+ * An enumeration to describe the life-time of RowID.
+ *  
+ * @since 1.6
+ */
+public enum RowIdLifetime {
+	ROWID_UNSUPPORTED, ROWID_VALID_OTHER, ROWID_VALID_SESSION, ROWID_VALID_TRANSACTION, ROWID_VALID_FOREVER,
+}

Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/RowIdLifetime.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Types.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Types.java?view=diff&rev=548994&r1=548993&r2=548994
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Types.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Types.java
Wed Jun 20 01:32:06 2007
@@ -181,4 +181,34 @@
      * The type code that identifies the SQL type VARCHAR.
      */
     public static final int VARCHAR = 12;
+
+    /**
+     *  The type code that identifies the SQL type ROWID.
+     */
+    public static final int ROWID = -8;
+
+    /**
+     *  The type code that identifies the SQL type NCHAR.
+     */
+    public static final int NCHAR = -15;
+
+    /**
+     *  The type code that identifies the SQL type NVARCHAR.
+     */
+    public static final int NVARCHAR = -9;
+
+    /**
+     *  The type code that identifies the SQL type LONGNVARCHAR.
+     */
+    public static final int LONGNVARCHAR = -16;
+
+    /**
+     *  The type code that identifies the SQL type NCLOB.
+     */
+    public static final int NCLOB = 2011;
+
+    /**
+     *  The type code that identifies the SQL type SQLXML.
+     */
+    public static final int SQLXML = 2009;
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DatabaseMetaDataTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DatabaseMetaDataTest.java?view=diff&rev=548994&r1=548993&r2=548994
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DatabaseMetaDataTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DatabaseMetaDataTest.java
Wed Jun 20 01:32:06 2007
@@ -17,9 +17,7 @@
 
 package org.apache.harmony.sql.tests.java.sql;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
+import static java.sql.DatabaseMetaData.*;
 
 import junit.framework.TestCase;
 
@@ -29,91 +27,67 @@
 	 * Public statics test
 	 */
 	public void testPublicStatics() {
+		assertEquals(attributeNoNulls,0);
+		assertEquals(attributeNullable,1);
+		assertEquals(attributeNullableUnknown,2);
+		assertEquals(bestRowNotPseudo,1);
+		assertEquals(bestRowPseudo,2);
+		assertEquals(bestRowSession,2);
+		assertEquals(bestRowTemporary,0);
+		assertEquals(bestRowTransaction,1);
+		assertEquals(bestRowUnknown,0);
+		assertEquals(columnNoNulls,0);
+		assertEquals(columnNullable,1);
+		assertEquals(columnNullableUnknown,2);
+		assertEquals(functionColumnIn,1);
+		assertEquals(functionColumnInOut,2);
+		assertEquals(functionColumnOut,3);
+		assertEquals(functionColumnResult,5);
+		assertEquals(functionColumnUnknown,0);
+		assertEquals(functionNoNulls,0);
+		assertEquals(functionNoTable,1);
+		assertEquals(functionNullable,1);
+		assertEquals(functionNullableUnknown,2);
+		assertEquals(functionResultUnknown,0);
+		assertEquals(functionReturn,4);
+		assertEquals(functionReturnsTable,2);
+		assertEquals(importedKeyCascade,0);
+		assertEquals(importedKeyInitiallyDeferred,5);
+		assertEquals(importedKeyInitiallyImmediate,6);
+		assertEquals(importedKeyNoAction,3);
+		assertEquals(importedKeyNotDeferrable,7);
+		assertEquals(importedKeyRestrict,1);
+		assertEquals(importedKeySetDefault,4);
+		assertEquals(importedKeySetNull,2);
+		assertEquals(procedureColumnIn,1);
+		assertEquals(procedureColumnInOut,2);
+		assertEquals(procedureColumnOut,4);
+		assertEquals(procedureColumnResult,3);
+		assertEquals(procedureColumnReturn,5);
+		assertEquals(procedureColumnUnknown,0);
+		assertEquals(procedureNoNulls,0);
+		assertEquals(procedureNoResult,1);
+		assertEquals(procedureNullable,1);
+		assertEquals(procedureNullableUnknown,2);
+		assertEquals(procedureResultUnknown,0);
+		assertEquals(procedureReturnsResult,2);
+		assertEquals(sqlStateSQL,2);
+		assertEquals(sqlStateSQL99,2);
+		assertEquals(sqlStateXOpen,1);
+		assertEquals(tableIndexClustered,1);
+		assertEquals(tableIndexHashed,2);
+		assertEquals(tableIndexOther,3);
+		assertEquals(tableIndexStatistic,0);
+		assertEquals(typeNoNulls,0);
+		assertEquals(typeNullable,1);
+		assertEquals(typeNullableUnknown,2);
+		assertEquals(typePredBasic,2);
+		assertEquals(typePredChar,1);
+		assertEquals(typePredNone,0);
+		assertEquals(typeSearchable,3);
+		assertEquals(versionColumnNotPseudo,1);
+		assertEquals(versionColumnPseudo,2);
+		assertEquals(versionColumnUnknown,0);
+	}
 
-		HashMap<String, Number> thePublicStatics = new HashMap<String, Number>();
-		thePublicStatics.put("sqlStateSQL99", new Integer(2));
-		thePublicStatics.put("sqlStateXOpen", new Integer(1));
-		thePublicStatics.put("attributeNullableUnknown", new Short((short) 2));
-		thePublicStatics.put("attributeNullable", new Short((short) 1));
-		thePublicStatics.put("attributeNoNulls", new Short((short) 0));
-		thePublicStatics.put("tableIndexOther", new Short((short) 3));
-		thePublicStatics.put("tableIndexHashed", new Short((short) 2));
-		thePublicStatics.put("tableIndexClustered", new Short((short) 1));
-		thePublicStatics.put("tableIndexStatistic", new Short((short) 0));
-		thePublicStatics.put("typeSearchable", new Integer(3));
-		thePublicStatics.put("typePredBasic", new Integer(2));
-		thePublicStatics.put("typePredChar", new Integer(1));
-		thePublicStatics.put("typePredNone", new Integer(0));
-		thePublicStatics.put("typeNullableUnknown", new Integer(2));
-		thePublicStatics.put("typeNullable", new Integer(1));
-		thePublicStatics.put("typeNoNulls", new Integer(0));
-		thePublicStatics.put("importedKeyNotDeferrable", new Integer(7));
-		thePublicStatics.put("importedKeyInitiallyImmediate", new Integer(6));
-		thePublicStatics.put("importedKeyInitiallyDeferred", new Integer(5));
-		thePublicStatics.put("importedKeySetDefault", new Integer(4));
-		thePublicStatics.put("importedKeyNoAction", new Integer(3));
-		thePublicStatics.put("importedKeySetNull", new Integer(2));
-		thePublicStatics.put("importedKeyRestrict", new Integer(1));
-		thePublicStatics.put("importedKeyCascade", new Integer(0));
-		thePublicStatics.put("versionColumnPseudo", new Integer(2));
-		thePublicStatics.put("versionColumnNotPseudo", new Integer(1));
-		thePublicStatics.put("versionColumnUnknown", new Integer(0));
-		thePublicStatics.put("bestRowPseudo", new Integer(2));
-		thePublicStatics.put("bestRowNotPseudo", new Integer(1));
-		thePublicStatics.put("bestRowUnknown", new Integer(0));
-		thePublicStatics.put("bestRowSession", new Integer(2));
-		thePublicStatics.put("bestRowTransaction", new Integer(1));
-		thePublicStatics.put("bestRowTemporary", new Integer(0));
-		thePublicStatics.put("columnNullableUnknown", new Integer(2));
-		thePublicStatics.put("columnNullable", new Integer(1));
-		thePublicStatics.put("columnNoNulls", new Integer(0));
-		thePublicStatics.put("procedureNullableUnknown", new Integer(2));
-		thePublicStatics.put("procedureNullable", new Integer(1));
-		thePublicStatics.put("procedureNoNulls", new Integer(0));
-		thePublicStatics.put("procedureColumnResult", new Integer(3));
-		thePublicStatics.put("procedureColumnReturn", new Integer(5));
-		thePublicStatics.put("procedureColumnOut", new Integer(4));
-		thePublicStatics.put("procedureColumnInOut", new Integer(2));
-		thePublicStatics.put("procedureColumnIn", new Integer(1));
-		thePublicStatics.put("procedureColumnUnknown", new Integer(0));
-		thePublicStatics.put("procedureReturnsResult", new Integer(2));
-		thePublicStatics.put("procedureNoResult", new Integer(1));
-		thePublicStatics.put("procedureResultUnknown", new Integer(0));
-
-		Class<?> databaseMetaDataClass;
-		try {
-			databaseMetaDataClass = Class.forName("java.sql.DatabaseMetaData");
-		} catch (ClassNotFoundException e) {
-			fail("java.sql.DatabaseMetaData class not found!");
-			return;
-		} // end try
-
-		Field[] theFields = databaseMetaDataClass.getDeclaredFields();
-		int requiredModifier = Modifier.PUBLIC + Modifier.STATIC
-				+ Modifier.FINAL;
-
-		int countPublicStatics = 0;
-		for (Field element : theFields) {
-			String fieldName = element.getName();
-			int theMods = element.getModifiers();
-			if (Modifier.isPublic(theMods) && Modifier.isStatic(theMods)) {
-				try {
-					Object fieldValue = element.get(null);
-					Object expectedValue = thePublicStatics.get(fieldName);
-					if (expectedValue == null) {
-						fail("Field " + fieldName + " missing!");
-					} // end
-					assertEquals("Field " + fieldName + " value mismatch: ",
-							expectedValue, fieldValue);
-					assertEquals("Field " + fieldName + " modifier mismatch: ",
-							requiredModifier, theMods);
-					countPublicStatics++;
-				} catch (IllegalAccessException e) {
-					fail("Illegal access to Field " + fieldName);
-				} // end try
-			} // end if
-		} // end for
-
-	} // end method testPublicStatics
-
-} // end class DatabaseMetaDataTest
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java?view=diff&rev=548994&r1=548993&r2=548994
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java
Wed Jun 20 01:32:06 2007
@@ -17,11 +17,8 @@
 
 package org.apache.harmony.sql.tests.java.sql;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-
 import junit.framework.TestCase;
+import static java.sql.Types.*;
 
 public class TypesTest extends TestCase {
 
@@ -29,73 +26,42 @@
 	 * Public statics test
 	 */
 	public void testPublicStatics() {
+		assertEquals(ARRAY,2003);
+		assertEquals(BIGINT,-5);
+		assertEquals(BINARY,-2);
+		assertEquals(BIT,-7);
+		assertEquals(BLOB,2004);
+		assertEquals(BOOLEAN,16);
+		assertEquals(CHAR,1);
+		assertEquals(CLOB,2005);
+		assertEquals(DATALINK,70);
+		assertEquals(DATE,91);
+		assertEquals(DECIMAL,3);
+		assertEquals(DISTINCT,2001);
+		assertEquals(DOUBLE,8);
+		assertEquals(FLOAT,6);
+		assertEquals(INTEGER,4);
+		assertEquals(JAVA_OBJECT,2000);
+		assertEquals(LONGNVARCHAR,-16);
+		assertEquals(LONGVARBINARY,-4);
+		assertEquals(LONGVARCHAR,-1);
+		assertEquals(NCHAR,-15);
+		assertEquals(NCLOB,2011);
+		assertEquals(NULL,0);
+		assertEquals(NUMERIC,2);
+		assertEquals(NVARCHAR,-9);
+		assertEquals(OTHER,1111);
+		assertEquals(REAL,7);
+		assertEquals(REF,2006);
+		assertEquals(ROWID,-8);
+		assertEquals(SMALLINT,5);
+		assertEquals(SQLXML,2009);
+		assertEquals(STRUCT,2002);
+		assertEquals(TIME,92);
+		assertEquals(TIMESTAMP,93);
+		assertEquals(TINYINT,-6);
+		assertEquals(VARBINARY,-3);
+		assertEquals(VARCHAR,12);
+	}
 
-		HashMap<String, Integer> thePublicStatics = new HashMap<String, Integer>();
-		thePublicStatics.put("BOOLEAN", new Integer(16));
-		thePublicStatics.put("DATALINK", new Integer(70));
-		thePublicStatics.put("REF", new Integer(2006));
-		thePublicStatics.put("CLOB", new Integer(2005));
-		thePublicStatics.put("BLOB", new Integer(2004));
-		thePublicStatics.put("ARRAY", new Integer(2003));
-		thePublicStatics.put("STRUCT", new Integer(2002));
-		thePublicStatics.put("DISTINCT", new Integer(2001));
-		thePublicStatics.put("JAVA_OBJECT", new Integer(2000));
-		thePublicStatics.put("OTHER", new Integer(1111));
-		thePublicStatics.put("NULL", new Integer(0));
-		thePublicStatics.put("LONGVARBINARY", new Integer(-4));
-		thePublicStatics.put("VARBINARY", new Integer(-3));
-		thePublicStatics.put("BINARY", new Integer(-2));
-		thePublicStatics.put("TIMESTAMP", new Integer(93));
-		thePublicStatics.put("TIME", new Integer(92));
-		thePublicStatics.put("DATE", new Integer(91));
-		thePublicStatics.put("LONGVARCHAR", new Integer(-1));
-		thePublicStatics.put("VARCHAR", new Integer(12));
-		thePublicStatics.put("CHAR", new Integer(1));
-		thePublicStatics.put("DECIMAL", new Integer(3));
-		thePublicStatics.put("NUMERIC", new Integer(2));
-		thePublicStatics.put("DOUBLE", new Integer(8));
-		thePublicStatics.put("REAL", new Integer(7));
-		thePublicStatics.put("FLOAT", new Integer(6));
-		thePublicStatics.put("BIGINT", new Integer(-5));
-		thePublicStatics.put("INTEGER", new Integer(4));
-		thePublicStatics.put("SMALLINT", new Integer(5));
-		thePublicStatics.put("TINYINT", new Integer(-6));
-		thePublicStatics.put("BIT", new Integer(-7));
-
-		Class<?> typesClass;
-		try {
-			typesClass = Class.forName("java.sql.Types");
-		} catch (ClassNotFoundException e) {
-			fail("java.sql.Types class not found!");
-			return;
-		} // end try
-
-		Field[] theFields = typesClass.getDeclaredFields();
-		int requiredModifier = Modifier.PUBLIC + Modifier.STATIC
-				+ Modifier.FINAL;
-
-		int countPublicStatics = 0;
-		for (Field element : theFields) {
-			String fieldName = element.getName();
-			int theMods = element.getModifiers();
-			if (Modifier.isPublic(theMods) && Modifier.isStatic(theMods)) {
-				try {
-					Object fieldValue = element.get(null);
-					Object expectedValue = thePublicStatics.get(fieldName);
-					if (expectedValue == null) {
-						fail("Field " + fieldName + " missing!");
-					} // end
-					assertEquals("Field " + fieldName + " value mismatch: ",
-							expectedValue, fieldValue);
-					assertEquals("Field " + fieldName + " modifier mismatch: ",
-							requiredModifier, theMods);
-					countPublicStatics++;
-				} catch (IllegalAccessException e) {
-					fail("Illegal access to Field " + fieldName);
-				} // end try
-			} // end if
-		} // end for
-
-	} // end method testPublicStatics
-
-} // end class TypesTest
+}



Mime
View raw message