db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r805444 - in /db/derby/code/branches/10.5/java: engine/org/apache/derby/impl/sql/compile/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Tue, 18 Aug 2009 15:15:49 GMT
Author: rhillegas
Date: Tue Aug 18 15:15:39 2009
New Revision: 805444

URL: http://svn.apache.org/viewvc?rev=805444&view=rev
Log:
DERBY-4092: Port 805443 from trunk to 10.5 branch.

Modified:
    db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
    db/derby/code/branches/10.5/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/branches/10.5/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java?rev=805444&r1=805443&r2=805444&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
(original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
Tue Aug 18 15:15:39 2009
@@ -21,6 +21,7 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.StringDataValue;
@@ -251,6 +252,13 @@
 			throw StandardException.newException(SQLState.LANG_NO_CORRESPONDING_S_Q_L_TYPE, 
 				javaNode.getJavaTypeName());
 		}
+
+        TypeDescriptor catalogType = dts.getCatalogType();
+
+        if ( catalogType.getTypeName().equals( "java.sql.ResultSet" ) )
+        {
+			throw StandardException.newException(SQLState.LANG_TABLE_FUNCTION_NOT_ALLOWED);
+        }
         
         setType(dts);
 		

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/loc/messages.xml?rev=805444&r1=805443&r2=805444&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/loc/messages.xml Tue Aug 18 15:15:39
2009
@@ -2748,6 +2748,11 @@
                 <arg>className</arg>
             </msg>
 
+            <msg>
+                <name>42ZB6</name>
+                <text>A scalar value is expected, not a row set returned by a table
function.</text>
+            </msg>
+
         </family>
 
 

Modified: db/derby/code/branches/10.5/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=805444&r1=805443&r2=805444&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/branches/10.5/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Tue Aug 18 15:15:39 2009
@@ -1089,6 +1089,7 @@
     String LANG_XML_NOT_ALLOWED_DJRS                                = "42ZB3";
     String LANG_NOT_TABLE_FUNCTION                                  = "42ZB4";
     String LANG_NO_COSTING_CONSTRUCTOR                              = "42ZB5";
+    String LANG_TABLE_FUNCTION_NOT_ALLOWED                   = "42ZB6";
 
 	//following 3 matches the DB2 sql states
 	String LANG_DECLARED_GLOBAL_TEMP_TABLE_ONLY_IN_SESSION_SCHEMA = "428EK";

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java?rev=805444&r1=805443&r2=805444&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
Tue Aug 18 15:15:39 2009
@@ -925,6 +925,8 @@
         subqueryTest();
 
         coercionTest();
+
+        miscBugs();
     }
     
     /**
@@ -1621,6 +1623,51 @@
     
     /**
      * <p>
+     * Miscellaneous bugs.
+     * </p>
+     */
+    private void  miscBugs()
+        throws Exception
+    {
+        derby_4092();
+    }
+    
+    /**
+     * <p>
+     * Don't allow table functions to appear where scalar functions are expected.
+     * </p>
+     */
+    private void  derby_4092()
+        throws Exception
+    {
+        goodStatement
+            (
+             "create function derby_4092()\n" +
+             "returns TABLE\n" +
+             "  (\n" +
+             "     column0 varchar( 10 ),\n" +
+             "     column1 varchar( 10 )\n" +
+             "  )\n" +
+             "language java\n" +
+             "parameter style DERBY_JDBC_RESULT_SET\n" +
+             "no sql\n" +
+             "external name '" + getClass().getName() + ".returnsACoupleRows'\n"
+             );
+
+        expectError
+            (
+             "42ZB6",
+             "values( derby_4092() )"
+             );
+        expectError
+            (
+             "42ZB6",
+             "select derby_4092(), tablename from sys.systables"
+             );
+    }
+    
+    /**
+     * <p>
      * Make the input rows for the coercion function.
      * </p>
      */



Mime
View raw message