db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1476291 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/ engine/org/apache/derby/iapi/sql/conn/ engine/org/apache/derby/iapi/sql/execute/ engine/org/apache/derby/iapi/transaction/ engine/org/apache/derby/impl/jdbc/ engine/o...
Date Fri, 26 Apr 2013 16:59:38 GMT
Author: rhillegas
Date: Fri Apr 26 16:59:37 2013
New Revision: 1476291

URL: http://svn.apache.org/r1476291
Log:
DERBY-6206: Encapsulate constants and names used for isolation levels.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionContext.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/transaction/TransactionControl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowChangerImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScanResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java Fri Apr 26
16:59:37 2013
@@ -40,6 +40,7 @@ import org.apache.derby.iapi.jdbc.Engine
 import org.apache.derby.iapi.jdbc.EngineResultSet;
 import org.apache.derby.iapi.reference.JDBC30Translation;
 import org.apache.derby.iapi.sql.execute.ExecutionContext;
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.util.StringUtil;
 import org.apache.derby.impl.jdbc.Util;
 
@@ -841,9 +842,9 @@ class DRDAStatement
         // for JCC. Other static packages will need to be supported for 
         // CCC. Maybe a static hash table would then be in order.
         if (pkgid.equals("SYSSTAT"))
-            return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL;
+            return TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL;
         else
-            return ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;
+            return TransactionControl.UNSPECIFIED_ISOLATION_LEVEL;
     }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
Fri Apr 26 16:59:37 2013
@@ -843,7 +843,7 @@ public interface LanguageConnectionConte
 	 * Get the prepare isolation level.
 	 * If the isolation level has been explicitly set with a SQL statement or
 	 * embedded call to setTransactionIsolation, this will return
-	 * ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL 
+	 * TransactionControl.UNSPECIFIED_ISOLATION_LEVEL 
 	 * SET ISOLATION always takes priority.
 	 * 
 	 */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionContext.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionContext.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionContext.java
Fri Apr 26 16:59:37 2013
@@ -38,40 +38,6 @@ public interface ExecutionContext extend
 	String CONTEXT_ID = "ExecutionContext";
 	
 	
-	/* Constants for scan isolation levels. */
-	public static final int UNSPECIFIED_ISOLATION_LEVEL = 0;
-	public static final int READ_UNCOMMITTED_ISOLATION_LEVEL = 1;
-	public static final int READ_COMMITTED_ISOLATION_LEVEL = 2;
-	public static final int REPEATABLE_READ_ISOLATION_LEVEL = 3;
-	public static final int SERIALIZABLE_ISOLATION_LEVEL = 4;
-
-    /**
-     * Map from Derby transaction isolation constants to
-     * JDBC constants.
-     */
-	public static final int[] CS_TO_JDBC_ISOLATION_LEVEL_MAP = {
-		java.sql.Connection.TRANSACTION_NONE,				// UNSPECIFIED_ISOLATION_LEVEL
-		java.sql.Connection.TRANSACTION_READ_UNCOMMITTED,	// READ_UNCOMMITTED_ISOLATION_LEVEL
-		java.sql.Connection.TRANSACTION_READ_COMMITTED,		// READ_COMMITTED_ISOLATION_LEVEL
-		java.sql.Connection.TRANSACTION_REPEATABLE_READ,	// REPEATABLE_READ_ISOLATION_LEVEL		
-		java.sql.Connection.TRANSACTION_SERIALIZABLE		// SERIALIZABLE_ISOLATION_LEVEL
-	};
-
-    /**
-     * Map from Derby transaction isolation constants to
-     * text values used in SQL. Note that the text
-     * "REPEATABLE READ" or "RR" maps to SERIALIZABLE_ISOLATION_LEVEL
-     * as a hang over from DB2 compatibility and now to preserve
-     * backwards compatability.
-     */
-	public static final String[][] CS_TO_SQL_ISOLATION_MAP = {
-		{ "  "},					// UNSPECIFIED_ISOLATION_LEVEL
-		{ "UR", "DIRTY READ", "READ UNCOMMITTED"},
-		{ "CS", "CURSOR STABILITY", "READ COMMITTED"},
-		{ "RS"},		// read stability	
-		{ "RR", "REPEATABLE READ", "SERIALIZABLE"}
-	};
-
 	/**
 	 * Get the ExecutionFactory from this ExecutionContext.
 	 *

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/transaction/TransactionControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/transaction/TransactionControl.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/transaction/TransactionControl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/transaction/TransactionControl.java
Fri Apr 26 16:59:37 2013
@@ -25,6 +25,7 @@ import java.util.Iterator;
 
 import org.apache.derby.iapi.error.ExceptionSeverity;
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.reference.SQLState;
 
 /**
@@ -36,7 +37,56 @@ import org.apache.derby.iapi.reference.S
  */
 public final class TransactionControl {
     
+	/* Constants for scan isolation levels. */
+	public static final int UNSPECIFIED_ISOLATION_LEVEL = 0;
+	public static final int READ_UNCOMMITTED_ISOLATION_LEVEL = 1;
+	public static final int READ_COMMITTED_ISOLATION_LEVEL = 2;
+	public static final int REPEATABLE_READ_ISOLATION_LEVEL = 3;
+	public static final int SERIALIZABLE_ISOLATION_LEVEL = 4;
+
+    /**
+     * Map from Derby transaction isolation constants to
+     * JDBC constants.
+     */
+	private static final int[] CS_TO_JDBC_ISOLATION_LEVEL_MAP = {
+		java.sql.Connection.TRANSACTION_NONE,				// UNSPECIFIED_ISOLATION_LEVEL
+		java.sql.Connection.TRANSACTION_READ_UNCOMMITTED,	// READ_UNCOMMITTED_ISOLATION_LEVEL
+		java.sql.Connection.TRANSACTION_READ_COMMITTED,		// READ_COMMITTED_ISOLATION_LEVEL
+		java.sql.Connection.TRANSACTION_REPEATABLE_READ,	// REPEATABLE_READ_ISOLATION_LEVEL		
+		java.sql.Connection.TRANSACTION_SERIALIZABLE		// SERIALIZABLE_ISOLATION_LEVEL
+	};
+
+    /**
+     * Map from Derby transaction isolation constants to
+     * text values used in SQL. Note that the text
+     * "REPEATABLE READ" or "RR" maps to SERIALIZABLE_ISOLATION_LEVEL
+     * as a hang over from DB2 compatibility and now to preserve
+     * backwards compatability.
+     */
+	private static final String[][] CS_TO_SQL_ISOLATION_MAP = {
+		{ "  "},					// UNSPECIFIED_ISOLATION_LEVEL
+		{ "UR", "DIRTY READ", "READ UNCOMMITTED"},
+		{ "CS", "CURSOR STABILITY", "READ COMMITTED"},
+		{ "RS"},		// read stability	
+		{ "RR", "REPEATABLE READ", "SERIALIZABLE"}
+	};
+
     private final ArrayList listeners;
+
+    /** Map a Derby isolation level to the corresponding JDBC level */
+    public  static  int jdbcIsolationLevel( int derbyIsolationLevel )
+    {
+        return CS_TO_JDBC_ISOLATION_LEVEL_MAP[ derbyIsolationLevel ];
+    }
+
+    /** Map Derby isolation level to SQL text values */
+    public  static  String[]    isolationTextNames( int derbyIsolationLevel )
+    {
+        return ArrayUtil.copy( CS_TO_SQL_ISOLATION_MAP[ derbyIsolationLevel ] );
+    }
+
+    /** Get number of isolation string mappings */
+    public  static  int     isolationMapCount() { return CS_TO_SQL_ISOLATION_MAP.length;
}
     
     public TransactionControl()
     {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Fri Apr
26 16:59:37 2013
@@ -84,6 +84,7 @@ import org.apache.derby.iapi.jdbc.Engine
 import org.apache.derby.iapi.jdbc.ExceptionFactory;
 import org.apache.derby.iapi.reference.Limits;
 import org.apache.derby.iapi.sql.conn.StatementContext;
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.util.InterruptStatus;
 import org.apache.derby.impl.jdbc.authentication.NoneAuthenticationServiceImpl;
 
@@ -2213,19 +2214,19 @@ public class EmbedConnection implements 
 		switch (level)
 		{
 		case java.sql.Connection.TRANSACTION_READ_UNCOMMITTED:
-			iLevel = ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL;
+			iLevel = TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL;
 			break;
 
 		case java.sql.Connection.TRANSACTION_READ_COMMITTED:
-			iLevel = ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;
+			iLevel = TransactionControl.READ_COMMITTED_ISOLATION_LEVEL;
 			break;
 
 		case java.sql.Connection.TRANSACTION_REPEATABLE_READ:
-            iLevel = ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL;
+            iLevel = TransactionControl.REPEATABLE_READ_ISOLATION_LEVEL;
             break;
 
 		case java.sql.Connection.TRANSACTION_SERIALIZABLE:
-			iLevel = ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL;
+			iLevel = TransactionControl.SERIALIZABLE_ISOLATION_LEVEL;
 			break;
 		default:
 			throw newSQLException(SQLState.UNIMPLEMENTED_ISOLATION_LEVEL, new Integer(level));
@@ -2255,7 +2256,7 @@ public class EmbedConnection implements 
      */
     public final int getTransactionIsolation() throws SQLException {
         checkIfClosed();
-		return ExecutionContext.CS_TO_JDBC_ISOLATION_LEVEL_MAP[getLanguageConnection().getCurrentIsolationLevel()];
+		return TransactionControl.jdbcIsolationLevel( getLanguageConnection().getCurrentIsolationLevel()
);
 	}
 
     /**
@@ -3136,7 +3137,7 @@ public class EmbedConnection implements 
 	 * @param level Isolation level to change to.  level is the DB2 level
 	 *               specified in the package names which happen to correspond
 	 *               to our internal levels. If 
-	 *               level == ExecutionContext.UNSPECIFIED_ISOLATION,
+	 *               level == TransactionControl.UNSPECIFIED_ISOLATION,
 	 *               the statement won't be prepared with an isolation level.
 	 * 
 	 * 
@@ -3148,11 +3149,11 @@ public class EmbedConnection implements 
 
 		switch (level)
 		{
-			case ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL:
-			case ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL:
-			case ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL:
-			case ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL:
-			case ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL:
+			case TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL:
+			case TransactionControl.REPEATABLE_READ_ISOLATION_LEVEL:
+			case TransactionControl.READ_COMMITTED_ISOLATION_LEVEL:
+			case TransactionControl.SERIALIZABLE_ISOLATION_LEVEL:
+			case TransactionControl.UNSPECIFIED_ISOLATION_LEVEL:
 				break;
 			default:
 				throw Util.generateCsSQLException(

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java Fri Apr
26 16:59:37 2013
@@ -44,6 +44,7 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.execute.ExecutionContext;
 import org.apache.derby.impl.sql.compile.StatementNode;
 import org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext;
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.util.InterruptStatus;
 
 public class GenericStatement
@@ -310,7 +311,7 @@ public class GenericStatement
 			CompilerContext cc = lcc.pushCompilerContext(compilationSchema);
 			
 			if (prepareIsolationLevel != 
-				ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL)
+				TransactionControl.UNSPECIFIED_ISOLATION_LEVEL)
 			{
 				cc.setScanIsolationLevel(prepareIsolationLevel);
 			}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
Fri Apr 26 16:59:37 2013
@@ -73,6 +73,7 @@ import org.apache.derby.iapi.error.Stand
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.services.context.ContextImpl;
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.util.ReuseFactory;
 
 import java.sql.SQLWarning;
@@ -146,7 +147,7 @@ public class CompilerContextImpl extends
 		compilationSchema = null;
 		parameterList = null;
 		parameterDescriptors = null;
-		scanIsolationLevel = ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;
+		scanIsolationLevel = TransactionControl.UNSPECIFIED_ISOLATION_LEVEL;
 		warnings = null;
 		savedObjects = null;
 		reliability = CompilerContext.SQL_LEGAL;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Fri
Apr 26 16:59:37 2013
@@ -73,6 +73,7 @@ import org.apache.derby.iapi.sql.Languag
 import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;
 import org.apache.derby.iapi.store.access.StoreCostController;
 import org.apache.derby.iapi.store.access.ScanController;
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.store.access.TransactionController;
 
 import org.apache.derby.iapi.types.DataValueDescriptor;
@@ -4260,7 +4261,7 @@ public class FromBaseTable extends FromT
             getLanguageConnectionContext().getCurrentIsolationLevel();
 
 
-		if ((isolationLevel != ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL) &&
+		if ((isolationLevel != TransactionControl.SERIALIZABLE_ISOLATION_LEVEL) &&
 			(tableDescriptor.getLockGranularity() != 
 					TableDescriptor.TABLE_LOCK_GRANULARITY))
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java Fri Apr
26 16:59:37 2013
@@ -62,6 +62,7 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.execute.ExecutionContext;
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.util.JBitSet;
@@ -1956,7 +1957,7 @@ public class FromVTI extends FromTable i
 	}
 	
 	public final int getStatementIsolationLevel() {
-		return ExecutionContext.CS_TO_JDBC_ISOLATION_LEVEL_MAP[getCompilerContext().getScanIsolationLevel()];
+		return TransactionControl.jdbcIsolationLevel( getCompilerContext().getScanIsolationLevel()
);
 	}
 
 	public void setSharedState(String key, java.io.Serializable value) {

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=1476291&r1=1476290&r2=1476291&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 Fri Apr
26 16:59:37 2013
@@ -55,6 +55,7 @@ import org.apache.derby.iapi.types.TypeI
 import org.apache.derby.iapi.sql.compile.TypeCompiler;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.types.DateTimeDataValue;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataTypeUtilities;
@@ -3319,7 +3320,7 @@ preparableSelectStatement(boolean checkP
 	ResultSetNode	  queryExpression;
 	ArrayList updateColumns = new ArrayList();
 	int               forUpdateState = CursorNode.UNSPECIFIED;
-	int				  isolationLevel = ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;
+	int				  isolationLevel = TransactionControl.UNSPECIFIED_ISOLATION_LEVEL;
 	CursorNode		  retval;
 	OrderByList orderCols = null;
     ValueNode[] offsetClauses = new ValueNode[ OFFSET_CLAUSE_COUNT ];
@@ -3355,7 +3356,7 @@ preparableSelectStatement(boolean checkP
 		}
 
 		/* Set the isolation levels for the scans if specified */
-		if (isolationLevel != ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL)
+		if (isolationLevel != TransactionControl.UNSPECIFIED_ISOLATION_LEVEL)
 		{
 			getCompilerContext().setScanIsolationLevel(isolationLevel);
 		}
@@ -12286,7 +12287,7 @@ isolationLevelDB2OrReset() :
 }
 {
         (
-                <RESET> { return ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL; }
+                <RESET> { return TransactionControl.UNSPECIFIED_ISOLATION_LEVEL; }
                 | isolationLevel = isolationLevelDB2() { return isolationLevel; }
         )
 }
@@ -12300,22 +12301,22 @@ isolationLevelDB2() :
 	(
                 isolationLevel = isolationLevelDB2Abbrev() { return isolationLevel; }
                 | ( ( <REPEATABLE> <READ> ) | <SERIALIZABLE> )
-                        { return ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL; }
+                        { return TransactionControl.SERIALIZABLE_ISOLATION_LEVEL; }
 		| <CURSOR> <STABILITY>
-                        { return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL; }
+                        { return TransactionControl.READ_COMMITTED_ISOLATION_LEVEL; }
 
 		| <DIRTY> <READ>
-                        { return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL; }
+                        { return TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL; }
 
 		|
                         LOOKAHEAD( { getToken(1).kind == READ && getToken(2).kind
== COMMITTED } )
                         <READ> <COMMITTED>
-                        { return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL; }
+                        { return TransactionControl.READ_COMMITTED_ISOLATION_LEVEL; }
 
 		|
                         LOOKAHEAD( { getToken(1).kind == READ && getToken(2).kind
== UNCOMMITTED } )
                         <READ> <UNCOMMITTED>
-                        { return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL; }
+                        { return TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL; }
 	)
 }
 
@@ -12326,15 +12327,15 @@ isolationLevelDB2Abbrev() :
 {
 	(
 		<RR>
-                        { return ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL; }
+                        { return TransactionControl.SERIALIZABLE_ISOLATION_LEVEL; }
 
-		| <RS> { return ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL; }
+		| <RS> { return TransactionControl.REPEATABLE_READ_ISOLATION_LEVEL; }
 
 		| <CS>
-                        { return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL; }
+                        { return TransactionControl.READ_COMMITTED_ISOLATION_LEVEL; }
 
 		| <UR>
-                        { return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL; }
+                        { return TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL; }
 	)
 }
 
@@ -12363,12 +12364,12 @@ levelOfIsolation() :
 | 
     <REPEATABLE> <READ>
     {
-		return ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL;
+		return TransactionControl.REPEATABLE_READ_ISOLATION_LEVEL;
     }
 |
 	<SERIALIZABLE>
 	{
-		return ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL;
+		return TransactionControl.SERIALIZABLE_ISOLATION_LEVEL;
 	}
 }
 
@@ -12379,12 +12380,12 @@ levelOfIsolationRead() :
 {
 	<UNCOMMITTED> 
 	{
-		return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL;
+		return TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL;
 	}
 |
 	<COMMITTED> 
 	{
-		return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;
+		return TransactionControl.READ_COMMITTED_ISOLATION_LEVEL;
 	}
 }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Fri Apr 26 16:59:37 2013
@@ -73,6 +73,7 @@ import org.apache.derby.iapi.sql.Paramet
 
 import org.apache.derby.iapi.store.access.TransactionController;
 import org.apache.derby.iapi.store.access.XATransactionController;
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.util.IdUtil;
 import org.apache.derby.iapi.util.InterruptStatus;
 
@@ -230,7 +231,7 @@ public class GenericLanguageConnectionCo
     private SchemaDescriptor cachedInitialDefaultSchemaDescr = null;
 
     // RESOLVE - How do we want to set the default.
-    private int defaultIsolationLevel = ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;
+    private int defaultIsolationLevel = TransactionControl.READ_COMMITTED_ISOLATION_LEVEL;
     protected int isolationLevel = defaultIsolationLevel;
 
     private boolean isolationLevelExplicitlySet = false;
@@ -254,7 +255,7 @@ public class GenericLanguageConnectionCo
     // isolation level to when preparing statements.
     // if unspecified, the statement won't be prepared with a specific 
     // scan isolationlevel
-    protected int prepareIsolationLevel = ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;
+    protected int prepareIsolationLevel = TransactionControl.UNSPECIFIED_ISOLATION_LEVEL;
 
     // Whether or not to write executing statement info to db2j.log
     private boolean logStatementText;
@@ -2950,7 +2951,7 @@ public class GenericLanguageConnectionCo
      */
     public int getCurrentIsolationLevel()
     {
-        return (isolationLevel == ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL) ? defaultIsolationLevel
: isolationLevel;
+        return (isolationLevel == TransactionControl.UNSPECIFIED_ISOLATION_LEVEL) ? defaultIsolationLevel
: isolationLevel;
     }
 
     /**
@@ -2958,9 +2959,11 @@ public class GenericLanguageConnectionCo
      */
     public String getCurrentIsolationLevelStr()
     {
-        if( isolationLevel >= 0 && isolationLevel < ExecutionContext.CS_TO_SQL_ISOLATION_MAP.length)
-            return ExecutionContext.CS_TO_SQL_ISOLATION_MAP[ isolationLevel][0];
-        return ExecutionContext.CS_TO_SQL_ISOLATION_MAP[ ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL][0];
+        if( isolationLevel >= 0 && isolationLevel < TransactionControl.isolationMapCount()
)
+        {
+            return TransactionControl.isolationTextNames( isolationLevel )[0];
+        }
+        return TransactionControl.isolationTextNames( TransactionControl.UNSPECIFIED_ISOLATION_LEVEL
)[0];
     }
 
     /**
@@ -2979,7 +2982,7 @@ public class GenericLanguageConnectionCo
         if (!isolationLevelExplicitlySet)
             return prepareIsolationLevel;
         else
-            return ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;
+            return TransactionControl.UNSPECIFIED_ISOLATION_LEVEL;
     }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
Fri Apr 26 16:59:37 2013
@@ -40,6 +40,7 @@ import org.apache.derby.iapi.store.acces
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.transaction.TransactionControl;
 
 /**
  * For INSERT/UPDATE/DELETE impls.  Used to tag them.
@@ -235,7 +236,7 @@ abstract class DMLWriteResultSet extends
      * Decode the update lock mode.
      * <p>
      * The value for update lock mode is in the second most significant byte for
-     * ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL isolation level. Otherwise
+     * TransactionControl.SERIALIZABLE_ISOLATION_LEVEL isolation level. Otherwise
      * (REPEATABLE READ, READ COMMITTED, and READ UNCOMMITTED) the lock mode is
      * located in the least significant byte.
      * <p>
@@ -260,12 +261,12 @@ abstract class DMLWriteResultSet extends
         }
 
         // Note that isolation level encoding from getCurrentIsolationLevel()
-        // returns ExecutionContext.*ISOLATION_LEVEL constants, not
+        // returns TransactionControl.*ISOLATION_LEVEL constants, not
         // TransactionController.ISOLATION* constants.
 
         int isolationLevel = lcc.getCurrentIsolationLevel();
 
-        if (isolationLevel == ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL) {
+        if (isolationLevel == TransactionControl.SERIALIZABLE_ISOLATION_LEVEL) {
             return lockMode >>> 16;
         }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowChangerImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowChangerImpl.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowChangerImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowChangerImpl.java
Fri Apr 26 16:59:37 2013
@@ -42,7 +42,7 @@ import org.apache.derby.iapi.store.acces
 import org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo;
 import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;
 import org.apache.derby.iapi.store.access.TransactionController;
-
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 
 import org.apache.derby.iapi.types.RowLocation;
@@ -301,7 +301,7 @@ class RowChangerImpl	implements	RowChang
 		int isolationLevel;
 		if (lcc == null)
 		{
-			isolationLevel = ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;
+			isolationLevel = TransactionControl.READ_COMMITTED_ISOLATION_LEVEL;
 		}
 		else
 		{
@@ -313,22 +313,22 @@ class RowChangerImpl	implements	RowChang
 		{
 			// Even though we preserve the isolation level at READ UNCOMMITTED,
 			// Store will overwrite it to READ COMMITTED for update.
-			case ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL:
+			case TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL:
 				isolationLevel = 
                     TransactionController.ISOLATION_READ_UNCOMMITTED;
 				break;
 
-			case ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL:
+			case TransactionControl.READ_COMMITTED_ISOLATION_LEVEL:
 				isolationLevel = 
                     TransactionController.ISOLATION_READ_COMMITTED;
 				break;
 
-			case ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL:
+			case TransactionControl.REPEATABLE_READ_ISOLATION_LEVEL:
 				isolationLevel = 
                     TransactionController.ISOLATION_REPEATABLE_READ;
 				break;
 
-			case ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL:
+			case TransactionControl.SERIALIZABLE_ISOLATION_LEVEL:
 				isolationLevel = 
                     TransactionController.ISOLATION_SERIALIZABLE;
 				break;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScanResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScanResultSet.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScanResultSet.java Fri
Apr 26 16:59:37 2013
@@ -28,6 +28,7 @@ import org.apache.derby.iapi.sql.execute
 import org.apache.derby.iapi.sql.execute.ExecRowBuilder;
 import org.apache.derby.iapi.sql.execute.ExecutionContext;
 import org.apache.derby.iapi.store.access.TransactionController;
+import org.apache.derby.iapi.transaction.TransactionControl;
 
 /**
  * Abstract <code>ResultSet</code> class for <code>NoPutResultSet</code>s
which
@@ -114,7 +115,7 @@ abstract class ScanResultSet extends NoP
         this.tableLocked = tableLocked;
         suppliedLockMode = lockMode;
 
-        if (isolationLevel == ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL) {
+        if (isolationLevel == TransactionControl.UNSPECIFIED_ISOLATION_LEVEL) {
             unspecifiedIsolationLevel = true;
             isolationLevel = getLanguageConnectionContext().getCurrentIsolationLevel();
         } else {
@@ -176,7 +177,7 @@ abstract class ScanResultSet extends NoP
          */
         if (tableLocked ||
                 (languageLevel ==
-                     ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL)) {
+                     TransactionControl.SERIALIZABLE_ISOLATION_LEVEL)) {
             return suppliedLockMode;
         } else {
             return TransactionController.MODE_RECORD;
@@ -192,9 +193,9 @@ abstract class ScanResultSet extends NoP
     private int translateLanguageIsolationLevel(int languageLevel) {
 
         switch (languageLevel) {
-        case ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL:
+        case TransactionControl.READ_UNCOMMITTED_ISOLATION_LEVEL:
             return TransactionController.ISOLATION_READ_UNCOMMITTED;
-        case ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL:
+        case TransactionControl.READ_COMMITTED_ISOLATION_LEVEL:
             /*
              * Now we see if we can get instantaneous locks
              * if we are getting share locks.
@@ -205,9 +206,9 @@ abstract class ScanResultSet extends NoP
                 return TransactionController.ISOLATION_READ_COMMITTED;
             }
             return TransactionController.ISOLATION_READ_COMMITTED_NOHOLDLOCK;
-        case ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL:
+        case TransactionControl.REPEATABLE_READ_ISOLATION_LEVEL:
             return TransactionController.ISOLATION_REPEATABLE_READ;
-        case ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL:
+        case TransactionControl.SERIALIZABLE_ISOLATION_LEVEL:
             return TransactionController.ISOLATION_SERIALIZABLE;
         }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java?rev=1476291&r1=1476290&r2=1476291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java Fri
Apr 26 16:59:37 2013
@@ -44,7 +44,7 @@ import org.apache.derby.iapi.store.acces
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.services.loader.GeneratedMethod;
-
+import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.types.RowLocation;
 import org.apache.derby.iapi.reference.SQLState;
 
@@ -101,9 +101,9 @@ class VTIResultSet extends NoPutResultSe
 
 	/**
 		Specified isolation level of SELECT (scan). If not set or
-		not application, it will be set to ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL
+		not application, it will be set to TransactionControl.UNSPECIFIED_ISOLATION_LEVEL
 	*/
-	private int scanIsolationLevel = ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;
+	private int scanIsolationLevel = TransactionControl.UNSPECIFIED_ISOLATION_LEVEL;
 
     //
     // class interface
@@ -704,7 +704,7 @@ class VTIResultSet extends NoPutResultSe
 	}
 
 	public final int getStatementIsolationLevel() {
-		return ExecutionContext.CS_TO_JDBC_ISOLATION_LEVEL_MAP[getScanIsolationLevel()];
+		return TransactionControl.jdbcIsolationLevel( getScanIsolationLevel() );
 	}
 
 



Mime
View raw message