db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r563172 - in /db/derby/code/trunk/java: engine/org/apache/derby/catalog/ engine/org/apache/derby/catalog/types/ engine/org/apache/derby/impl/jdbc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTest...
Date Mon, 06 Aug 2007 15:36:48 GMT
Author: rhillegas
Date: Mon Aug  6 08:36:47 2007
New Revision: 563172

URL: http://svn.apache.org/viewvc?view=rev&rev=563172
Log:
DERBY-2983: Add missing FUNCTION_TYPE column to the ResultSet returned by DatabaseMetaData.getFunctions().

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/AliasInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/MethodAliasInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/SynonymAliasInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/metadata.properties
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/AliasInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/AliasInfo.java?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/AliasInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/AliasInfo.java Mon Aug  6 08:36:47
2007
@@ -67,4 +67,10 @@
 	 * represents at the source database.
 	 */
 	public String getMethodName();
+
+	/**
+	 * Return true if this alias is a Table Function.
+	 */
+	public boolean isTableFunction();
+
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/MethodAliasInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/MethodAliasInfo.java?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/MethodAliasInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/MethodAliasInfo.java Mon
Aug  6 08:36:47 2007
@@ -115,6 +115,8 @@
 		return methodName;
 	}
 
+	public boolean isTableFunction() {return false; }
+
 	/**
 	  @see java.lang.Object#toString
 	  */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java Mon
Aug  6 08:36:47 2007
@@ -209,6 +209,10 @@
 		return returnType;
 	}
 
+	public boolean isTableFunction() {
+		return returnType.isRowMultiSet();
+	}
+
 
 	// Formatable methods
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/SynonymAliasInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/SynonymAliasInfo.java?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/SynonymAliasInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/SynonymAliasInfo.java Mon
Aug  6 08:36:47 2007
@@ -58,6 +58,8 @@
 		return schemaName;
 	}
 
+	public boolean isTableFunction() {return false; }
+
 	// Formatable methods
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/metadata.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/metadata.properties?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/metadata.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/metadata.properties Mon Aug
 6 08:36:47 2007
@@ -1181,6 +1181,10 @@
         CAST ((SYS.SYSALIASES.JAVACLASSNAME || '.' || \
                SYS.SYSALIASES.ALIASINFO->getMethodName()) \
              AS VARCHAR(32672)) AS REMARKS, \
+	CASE WHEN (SYS.SYSALIASES.ALIASINFO->isTableFunction())\
+           THEN CAST (2 AS SMALLINT)\
+           ELSE CAST (1 AS SMALLINT) \
+         END AS FUNCTION_TYPE, \
         SYS.SYSALIASES.SPECIFICNAME AS SPECIFIC_NAME \
     FROM SYS.SYSSCHEMAS, SYS.SYSALIASES \
     WHERE SYS.SYSALIASES.SCHEMAID = SYS.SYSSCHEMAS.SCHEMAID \

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java
Mon Aug  6 08:36:47 2007
@@ -55,6 +55,10 @@
     public static final int FUNCTION_NULLABLE          = 1;
     public static final int FUNCTION_NULLABLE_UNKNOWN  = 2;
 
+    public static final int FUNCTION_RESULT_UNKNOWN          = 0;
+    public static final int FUNCTION_NO_TABLE          = 1;
+    public static final int FUNCTION_RETURNS_TABLE  = 2;
+
     // constants from java.sql.Types
     public static final int NCHAR = -15;
     public static final int NVARCHAR = -9;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java
Mon Aug  6 08:36:47 2007
@@ -67,6 +67,21 @@
                      JDBC40Translation.FUNCTION_RETURN);
     }
 
+    public void testDatabaseMetaDataFUNCTION_RESULT_UNKNOWN() {
+        assertEquals(DatabaseMetaData.functionResultUnknown,
+                     JDBC40Translation.FUNCTION_RESULT_UNKNOWN);
+    }
+
+    public void testDatabaseMetaDataFUNCTION_NO_TABLE() {
+        assertEquals(DatabaseMetaData.functionNoTable,
+                     JDBC40Translation.FUNCTION_NO_TABLE);
+    }
+
+    public void testDatabaseMetaDataFUNCTION_RETURNS_TABLE() {
+        assertEquals(DatabaseMetaData.functionReturnsTable,
+                     JDBC40Translation.FUNCTION_RETURNS_TABLE);
+    }
+
     public void testDatabaseMetaDataFUNCTION_NO_NULLS() {
         assertEquals(DatabaseMetaData.functionNoNulls,
                      JDBC40Translation.FUNCTION_NO_NULLS);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java?view=diff&rev=563172&r1=563171&r2=563172
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
Mon Aug  6 08:36:47 2007
@@ -1,6 +1,6 @@
 /*
 
-   Derby - Class org.apache.derbyTesting.functionTests.tests.jdbc.TestDbMetaData
+   Derby - Class org.apache.derbyTesting.functionTests.tests.jdbc4.TestDbMetaData
 
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -27,6 +27,7 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.sql.Types;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -42,6 +43,8 @@
  */
 public class TestDbMetaData extends BaseJDBCTestCase {
 
+    private static  final   Integer FUNCTION_NO_TABLE_VALUE = new Integer( DatabaseMetaData.functionNoTable
);
+    
     private DatabaseMetaData meta;
 
     public TestDbMetaData(String name) {
@@ -125,59 +128,62 @@
     private void assertGetFunctionsRs(ResultSet rs) throws SQLException {
         JDBC.assertColumnNames(rs, new String[] {
             "FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME", "REMARKS",
-            "SPECIFIC_NAME" });
+            "FUNCTION_TYPE", "SPECIFIC_NAME" });
+        JDBC.assertColumnTypes(rs, new int[] {
+            Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
+            Types.SMALLINT, Types.VARCHAR });
     }
     
     private static final GeneratedId GENERIC_NAME = new GeneratedId();
 
     /** Expected rows from getFunctions() when all functions match. */
     private static final Object[][] ALL_FUNCTIONS = {
-        { null, "APP", "DUMMY1", "java.some.func", GENERIC_NAME },
-        { null, "APP", "DUMMY2", "java.some.func", GENERIC_NAME },
-        { null, "APP", "DUMMY3", "java.some.func", GENERIC_NAME },
-        { null, "APP", "DUMMY4", "java.some.func", GENERIC_NAME },
+        { null, "APP", "DUMMY1", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
+        { null, "APP", "DUMMY2", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
+        { null, "APP", "DUMMY3", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
+        { null, "APP", "DUMMY4", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
         { null, "SYSCS_UTIL", "SYSCS_CHECK_TABLE",
           "org.apache.derby.catalog.SystemProcedures.SYSCS_CHECK_TABLE",
-          GENERIC_NAME },
+          FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSCS_UTIL", "SYSCS_GET_DATABASE_PROPERTY",
           "org.apache.derby.catalog.SystemProcedures." +
-          "SYSCS_GET_DATABASE_PROPERTY", GENERIC_NAME },
+          "SYSCS_GET_DATABASE_PROPERTY", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSCS_UTIL", "SYSCS_GET_RUNTIMESTATISTICS",
           "org.apache.derby.catalog.SystemProcedures." +
-          "SYSCS_GET_RUNTIMESTATISTICS", GENERIC_NAME },
+          "SYSCS_GET_RUNTIMESTATISTICS", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
           { null, "SYSCS_UTIL", "SYSCS_GET_USER_ACCESS",
               "org.apache.derby.catalog.SystemProcedures." +
-              "SYSCS_GET_USER_ACCESS", GENERIC_NAME },
+              "SYSCS_GET_USER_ACCESS", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBCREATELOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBCREATELOCATOR", GENERIC_NAME },
+          "BLOBCREATELOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETBYTES",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETBYTES", GENERIC_NAME },
+          "BLOBGETBYTES", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETLENGTH",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETLENGTH", GENERIC_NAME },
+          "BLOBGETLENGTH", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETPOSITIONFROMBYTES",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETPOSITIONFROMBYTES", GENERIC_NAME },
+          "BLOBGETPOSITIONFROMBYTES", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETPOSITIONFROMLOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETPOSITIONFROMLOCATOR", GENERIC_NAME },
+          "BLOBGETPOSITIONFROMLOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBCREATELOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBCREATELOCATOR", GENERIC_NAME },
+          "CLOBCREATELOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETLENGTH",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETLENGTH", GENERIC_NAME },
+          "CLOBGETLENGTH", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETPOSITIONFROMLOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETPOSITIONFROMLOCATOR", GENERIC_NAME },
+          "CLOBGETPOSITIONFROMLOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETPOSITIONFROMSTRING",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETPOSITIONFROMSTRING", GENERIC_NAME },
+          "CLOBGETPOSITIONFROMSTRING", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETSUBSTRING",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETSUBSTRING", GENERIC_NAME },
+          "CLOBGETSUBSTRING", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
 
     };
 



Mime
View raw message