db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r578452 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_4.java
Date Sat, 22 Sep 2007 14:54:50 GMT
Author: rhillegas
Date: Sat Sep 22 07:54:48 2007
New Revision: 578452

URL: http://svn.apache.org/viewvc?rev=578452&view=rev
Log:
DERBY-716: Prevent table function creation after soft-upgrade, verify with a regression test.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_4.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=578452&r1=578451&r2=578452&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Sat Sep
22 07:54:48 2007
@@ -10136,6 +10136,8 @@
 	    ( <COMMA> functionTableReturnColumn( names, types ) ) *
 	<RIGHT_PAREN>
 	{
+        checkVersion( DataDictionary.DD_VERSION_DERBY_10_4, "table functions");
+
 		columnCount = names.size();
 		nameArray = new String[ columnCount ];
 		names.toArray( nameArray );

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_4.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_4.java?rev=578452&r1=578451&r2=578452&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_4.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_4.java
Sat Sep 22 07:54:48 2007
@@ -130,4 +130,54 @@
             break;
         }
     }
+
+
+    /**
+     * Check that you must be hard-upgraded to 10.4 or later in order to declare
+     * table functions.
+     * @throws SQLException 
+     *
+     */
+    public void testTableFunctionDeclaration() throws SQLException
+    {
+        Statement       s = createStatement();
+        String          createTableFunctionText =
+            "create function svnLogReader( logFileName varchar( 32672 ) )\n" +
+            "returns TABLE\n" +
+            "  (\n" +
+            "     XID varchar( 15 ),\n" +
+            "     committer    varchar( 20 ),\n" +
+            "     commit_time  timestamp,\n" +
+            "     line_count   varchar( 10 ),\n" +
+            "     description  varchar( 32672 )\n" +
+            "  )\n" +
+            "language java\n" +
+            "parameter style DERBY_JDBC_RESULT_SET\n" +
+            "no sql\n" +
+            "external name 'org.apache.derbyDemo.vtis.example.SubversionLogVTI.subversionLogVTI'\n"
+            ;
+
+        switch (getPhase())
+        {
+        case PH_CREATE:
+            assertStatementError("42X01", s, createTableFunctionText );
+            break;
+            
+        case PH_SOFT_UPGRADE:
+            assertStatementError("XCL47", s, createTableFunctionText );
+            break;
+            
+        case PH_POST_SOFT_UPGRADE:
+            assertStatementError("42X01", s, createTableFunctionText );
+            break;
+            
+        case PH_HARD_UPGRADE:
+        case PH_POST_HARD_UPGRADE:
+            s.execute( createTableFunctionText );
+            break;
+        }
+
+        s.close();
+    }
+
 }



Mime
View raw message