You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2008/01/05 00:26:03 UTC

svn commit: r609053 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/conn/ iapi/sql/execute/ impl/sql/conn/ impl/sql/execute/

Author: djd
Date: Fri Jan  4 15:25:59 2008
New Revision: 609053

URL: http://svn.apache.org/viewvc?rev=609053&view=rev
Log:
DERBY-2661 (partial) Move getting of the run time statistics factory from the ExecutionContext to the ExecutionFactory. Remove the LanguageConnectionContext.getExecutionContext() method as it is no longer used.

Modified:
    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/sql/execute/ExecutionFactory.java
    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/GenericExecutionContext.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java

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=609053&r1=609052&r2=609053&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 Jan  4 15:25:59 2008
@@ -817,11 +817,6 @@
 	public Authorizer getAuthorizer(); 
 
 	/**
-	 *	Get the current ExecutionContext.
-	 */
-	ExecutionContext getExecutionContext();
-
-	/**
 	 *	Get the current StatementContext.
 	 */
 	StatementContext getStatementContext();

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=609053&r1=609052&r2=609053&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 Jan  4 15:25:59 2008
@@ -23,10 +23,6 @@
 
 import org.apache.derby.iapi.services.context.Context;
 
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.sql.ResultSet;
-
 /**
  * ExecutionContext stores the factories that are to be used by
  * the current connection. It also provides execution services
@@ -49,6 +45,10 @@
 	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
@@ -57,6 +57,13 @@
 		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"},
@@ -64,17 +71,6 @@
 		{ "RS"},		// read stability	
 		{ "RR", "REPEATABLE READ", "SERIALIZABLE"}
 	};
-
-	/**
-	 * Get the ResultSetStatisticsFactory from this ExecutionContext.
-	 *
-	 * @return	The result set statistics factory associated with this
-	 *		ExecutionContext
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	ResultSetStatisticsFactory getResultSetStatisticsFactory()
-								throws StandardException;
 
 	/**
 	 * Get the ExecutionFactory from this ExecutionContext.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionFactory.java?rev=609053&r1=609052&r2=609053&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecutionFactory.java Fri Jan  4 15:25:59 2008
@@ -77,6 +77,17 @@
 		@return the result set factory for this database.
 	 */
 	ResultSetFactory getResultSetFactory();
+    
+    /**
+     * Get the ResultSetStatisticsFactory from this ExecutionFactory.
+     *
+     * @return  The result set statistics factory associated with this
+     *      ExecutionFactory
+     *
+     * @exception StandardException     Thrown on error
+     */
+    public ResultSetStatisticsFactory getResultSetStatisticsFactory()
+        throws StandardException;
 
 	/**
 		We want an execution context so that we can push it onto

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=609053&r1=609052&r2=609053&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 Jan  4 15:25:59 2008
@@ -2514,14 +2514,6 @@
 	}
 
 	/**
-	 * @see LanguageConnectionContext#getExecutionContext
-	 */
-	public ExecutionContext getExecutionContext()
-	{
-		return (ExecutionContext) getContextManager().getContext(ExecutionContext.CONTEXT_ID);
-	}
-
-	/**
 	 * @see LanguageConnectionContext#getStatementContext
 	 */
 	public StatementContext getStatementContext()

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java?rev=609053&r1=609052&r2=609053&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java Fri Jan  4 15:25:59 2008
@@ -21,16 +21,12 @@
 
 package org.apache.derby.impl.sql.execute;
 
-import java.util.Properties;
-
 import org.apache.derby.iapi.error.ExceptionSeverity;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.context.ContextImpl;
 import org.apache.derby.iapi.services.context.ContextManager;
-import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.iapi.sql.execute.ExecutionContext;
 import org.apache.derby.iapi.sql.execute.ExecutionFactory;
-import org.apache.derby.iapi.sql.execute.ResultSetStatisticsFactory;
 /**
  * ExecutionContext stores the result set factory to be used by
  * the current connection, and manages execution-level connection
@@ -47,34 +43,11 @@
 	//
 	// class implementation
 	//
-	private ResultSetStatisticsFactory rssFactory;
 	private ExecutionFactory execFactory;
 
 	//
 	// ExecutionContext interface
 	//
-
-	/**
-	 * Get the ResultSetStatisticsFactory from this ExecutionContext.
-	 *
-	 * @return	The result set statistics factory associated with this
-	 *		ExecutionContext
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public ResultSetStatisticsFactory getResultSetStatisticsFactory()
-					throws StandardException {
-		if (rssFactory == null) {
-			rssFactory = (ResultSetStatisticsFactory)
-				Monitor.bootServiceModule(
-									false,
-									execFactory,
-									ResultSetStatisticsFactory.MODULE,
-									(Properties) null);
-		}
-
-		return rssFactory;
-	}
 
 	public ExecutionFactory getExecutionFactory() {
 		return execFactory;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java?rev=609053&r1=609052&r2=609053&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java Fri Jan  4 15:25:59 2008
@@ -75,6 +75,11 @@
  */
 public class GenericExecutionFactory
 	implements ModuleControl, ModuleSupportable, ExecutionFactory {
+    
+    /**
+     * Statistics factory for this factory.
+     */
+    private ResultSetStatisticsFactory rssFactory;
 
 	//
 	// ModuleControl interface
@@ -143,6 +148,28 @@
 		}
 		return genericConstantActionFactory; 
 	}
+    
+    /**
+     * Get the ResultSetStatisticsFactory from this ExecutionFactory.
+     *
+     * @return  The result set statistics factory associated with this
+     *      ExecutionFactory
+     *
+     * @exception StandardException     Thrown on error
+     */
+    public ResultSetStatisticsFactory getResultSetStatisticsFactory()
+                    throws StandardException {
+        if (rssFactory == null) {
+            rssFactory = (ResultSetStatisticsFactory)
+                Monitor.bootServiceModule(
+                                    false,
+                                    this,
+                                    ResultSetStatisticsFactory.MODULE,
+                                    (Properties) null);
+        }
+
+        return rssFactory;
+    }
 
 	/**
 		We want a dependency context so that we can push it onto

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java?rev=609053&r1=609052&r2=609053&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java Fri Jan  4 15:25:59 2008
@@ -146,9 +146,9 @@
 			if (lcc.getRunTimeStatisticsMode())
 			{
 				endExecutionTime = getCurrentTimeMillis();
-
+                
 				lcc.setRunTimeStatisticsObject(
-					lcc.getExecutionContext().getResultSetStatisticsFactory().getRunTimeStatistics(activation, this, subqueryTrackingArray));
+					lcc.getLanguageConnectionFactory().getExecutionFactory().getResultSetStatisticsFactory().getRunTimeStatistics(activation, this, subqueryTrackingArray));
 
 				HeaderPrintWriter istream = lcc.getLogQueryPlan() ? Monitor.getStream() : null;
 				if (istream != null)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java?rev=609053&r1=609052&r2=609053&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java Fri Jan  4 15:25:59 2008
@@ -40,7 +40,6 @@
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.execute.ExecRow;
-import org.apache.derby.iapi.sql.execute.ExecutionContext;
 import org.apache.derby.iapi.sql.execute.NoPutResultSet;
 import org.apache.derby.iapi.sql.execute.ResultSetStatisticsFactory;
 import org.apache.derby.iapi.types.DataValueDescriptor;
@@ -348,9 +347,9 @@
 			{
 				endExecutionTime = getCurrentTimeMillis();
 
-				ExecutionContext ec = lcc.getExecutionContext();
-				ResultSetStatisticsFactory rssf;
-				rssf = ec.getResultSetStatisticsFactory();
+				ResultSetStatisticsFactory rssf =
+                    lcc.getLanguageConnectionFactory().
+                         getExecutionFactory().getResultSetStatisticsFactory();
 
 				lcc.setRunTimeStatisticsObject(
 					rssf.getRunTimeStatistics(activation, this, subqueryTrackingArray));