db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r894002 - in /db/derby/code/trunk: java/engine/org/apache/derby/iapi/sql/compile/ java/engine/org/apache/derby/impl/sql/compile/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/ tools/jar/
Date Sat, 26 Dec 2009 16:21:27 GMT
Author: rhillegas
Date: Sat Dec 26 16:21:26 2009
New Revision: 894002

URL: http://svn.apache.org/viewvc?rev=894002&view=rev
Log:
DERBY-712: Committed patch from Suran Jayathilaka, adding dummy support for NEXT VALUE FOR
clause on sequences.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/C_NodeTypes.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/C_NodeNames.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java
    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/lang/SequenceTest.java
    db/derby/code/trunk/tools/jar/DBMSnodes.properties

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/C_NodeTypes.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/C_NodeTypes.java?rev=894002&r1=894001&r2=894002&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/C_NodeTypes.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/C_NodeTypes.java Sat
Dec 26 16:21:26 2009
@@ -235,6 +235,7 @@
     // sequences
     static final int CREATE_SEQUENCE_NODE = 224;
     static final int DROP_SEQUENCE_NODE = 225;
+    static final int NEXT_SEQUENCE_NODE = 231;
 
 	// Windowing
 	static final int AGGREGATE_WINDOW_FUNCTION_NODE = 226;
@@ -244,7 +245,7 @@
 	static final int WINDOW_RESULTSET_NODE = 230;
 
     // Final value in set, keep up to date!
-    static final int FINAL_VALUE = WINDOW_RESULTSET_NODE;
+    static final int FINAL_VALUE = NEXT_SEQUENCE_NODE;
 
     /**
      * Extensions to this interface can use nodetypes > MAX_NODE_TYPE with out fear of
collision

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/C_NodeNames.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/C_NodeNames.java?rev=894002&r1=894001&r2=894002&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/C_NodeNames.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/C_NodeNames.java Sat
Dec 26 16:21:26 2009
@@ -196,7 +196,9 @@
 
 	static final String NEW_INVOCATION_NODE_NAME = "org.apache.derby.impl.sql.compile.NewInvocationNode";
 
-	static final String NON_STATIC_METHOD_CALL_NODE_NAME = "org.apache.derby.impl.sql.compile.NonStaticMethodCallNode";
+    static final String NEXT_SEQUENCE_NODE_NAME = "org.apache.derby.impl.sql.compile.NextSequenceNode";
+
+    static final String NON_STATIC_METHOD_CALL_NODE_NAME = "org.apache.derby.impl.sql.compile.NonStaticMethodCallNode";
 
 	static final String NORMALIZE_RESULT_SET_NODE_NAME = "org.apache.derby.impl.sql.compile.NormalizeResultSetNode";
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java?rev=894002&r1=894001&r2=894002&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java
Sat Dec 26 16:21:26 2009
@@ -641,6 +641,9 @@
           case C_NodeTypes.DROP_SEQUENCE_NODE:
             return C_NodeNames.DROP_SEQUENCE_NODE_NAME;
 
+          case C_NodeTypes.NEXT_SEQUENCE_NODE:
+            return C_NodeNames.NEXT_SEQUENCE_NODE_NAME;
+
           // WARNING: WHEN ADDING NODE TYPES HERE, YOU MUST ALSO ADD
 		  // THEM TO tools/jar/DBMSnodes.properties
 

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=894002&r1=894001&r2=894002&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 Dec
26 16:21:26 2009
@@ -6669,6 +6669,11 @@
 	{
 		return value;
 	}
+|
+    value = nextValueExpression()
+	{
+		return value;
+	}
 }
 
 /*
@@ -9695,6 +9700,27 @@
 		
 }
 
+/**
+ * Next value from a sequence object
+ */
+ValueNode
+nextValueExpression() throws StandardException :
+{
+	ValueNode		 nextValue;
+	TableName sequenceName;
+}
+{
+       <NEXT> <VALUE> <FOR> sequenceName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH)
+       {
+        checkVersion(DataDictionary.DD_VERSION_DERBY_10_6, "NEXT VALUE");
+		nextValue = (ValueNode) nodeFactory.getNode(
+									C_NodeTypes.NEXT_SEQUENCE_NODE,
+									sequenceName,
+									getContextManager());
+
+		return nextValue;}	
+}
+
 /*
  * <A NAME="charOrVarchar">charOrVarchar</A>
  */

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java?rev=894002&r1=894001&r2=894002&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
Sat Dec 26 16:21:26 2009
@@ -194,4 +194,14 @@
         adminCon.close();
     }
 
+    /**
+     * initial test for next value
+     * @throws SQLException on error
+     */
+    public void testNextValue() throws SQLException {
+        Statement s = createStatement();
+        s.executeUpdate("CREATE SEQUENCE mySeq1");
+        s.execute("SELECT NEXT VALUE FOR mySeq1 from sys.systables");
+    }
+
 }

Modified: db/derby/code/trunk/tools/jar/DBMSnodes.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/jar/DBMSnodes.properties?rev=894002&r1=894001&r2=894002&view=diff
==============================================================================
--- db/derby/code/trunk/tools/jar/DBMSnodes.properties (original)
+++ db/derby/code/trunk/tools/jar/DBMSnodes.properties Sat Dec 26 16:21:26 2009
@@ -150,6 +150,7 @@
 derby.module.cloudscapenodes.ha=org.apache.derby.impl.sql.compile.WindowNode
 derby.module.cloudscapenodes.hb=org.apache.derby.impl.sql.compile.WindowReferenceNode
 derby.module.cloudscapenodes.hc=org.apache.derby.impl.sql.compile.WindowResultSetNode
+derby.module.cloudscapenodes.hd=org.apache.derby.impl.sql.compile.NextSequenceNode
 
 # Warning: make sure this file is properly terminated with a newline,
 # else the build can fail silently. Symptom: derby.jar lacks many



Mime
View raw message