db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r126039 - in incubator/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/conn impl/jdbc impl/sql/conn jdbc
Date Sat, 22 Jan 2005 16:11:06 GMT
Author: djd
Date: Sat Jan 22 08:11:05 2005
New Revision: 126039

URL: http://svn.apache.org/viewcvs?view=rev&rev=126039
Log:
Fix Derby-130 - IDENTITY_VAL_LOCAL not reset when EmbedConnection object re-used from pool.
Added generic resetFromPool method to handle future situations.

Modified:
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java?view=diff&rev=126039&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java&r1=126038&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java&r2=126039
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
Sat Jan 22 08:11:05 2005
@@ -233,12 +233,10 @@
 	public TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(String tableName);
 
 	/**
-	 * Drop all the declared global temporary tables associated with this connection. This gets
called
-	 * when a getConnection() is done on a PooledConnection. This will ensure all the temporary
tables
-	 * declared on earlier connection handle associated with this physical database connection
are dropped
-	 * before a new connection handle is issued on that same physical database connection.
+		Reset the connection before it is returned (indirectly) by
+		a PooledConnection object. See EmbeddedConnection.
 	 */
-	public void dropAllDeclaredGlobalTempTables()
+	public void resetFromPool()
 		 throws StandardException;
 
 	/**

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java?view=diff&rev=126039&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java&r1=126038&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java&r2=126039
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection20.java
Sat Jan 22 08:11:05 2005
@@ -62,18 +62,19 @@
 	}
 
 	/**
-	 * Drop all the declared global temporary tables associated with this connection. This gets
called
-	 * when a getConnection() is done on a PooledConnection. This will ensure all the temporary
tables
-	 * declared on earlier connection handle associated with this physical database connection
are dropped
-	 * before a new connection handle is issued on that same physical database connection.
-	 *
+		Reset the connection before it is returned from a PooledConnection
+		to a new application request (wrapped by a BrokeredConnection).
+		Examples of reset covered here is dropping session temporary tables
+		and reseting IDENTITY_VAL_LOCAL.
+		Most JDBC level reset is handled by calling standard java.sql.Connection
+		methods from EmbedPooledConnection.
 	 */
-	public void dropAllDeclaredGlobalTempTables() throws SQLException {
+	public void resetFromPool() throws SQLException {
 		synchronized (getConnectionSynchronization())
 		{
 			setupContextStack();
 			try {
-				getLanguageConnection().dropAllDeclaredGlobalTempTables();
+				getLanguageConnection().resetFromPool();
 			} catch (StandardException t) {
 				throw handleException(t);
 			}

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?view=diff&rev=126039&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java&r1=126038&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java&r2=126039
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Sat Jan 22 08:11:05 2005
@@ -523,9 +523,26 @@
 	}
 
 	/**
-	 * @see LanguageConnectionContext#dropAllDeclaredGlobalTempTables
+		Reset the connection before it is returned (indirectly) by
+		a PooledConnection object. See EmbeddedConnection.
 	 */
-	public void dropAllDeclaredGlobalTempTables() throws StandardException {
+	public void resetFromPool()
+		 throws StandardException
+	{
+		// Reset IDENTITY_VAL_LOCAL
+		identityNotNull = false;
+
+		// drop all temp tables.
+		dropAllDeclaredGlobalTempTables();
+	}
+
+	/**
+	 * Drop all the declared global temporary tables associated with this connection. This gets
called
+	 * when a getConnection() is done on a PooledConnection. This will ensure all the temporary
tables
+	 * declared on earlier connection handle associated with this physical database connection
are dropped
+	 * before a new connection handle is issued on that same physical database connection.
+	 */
+	private void dropAllDeclaredGlobalTempTables() throws StandardException {
 		if (allDeclaredGlobalTempTables == null)
 			return;
     

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java?view=diff&rev=126039&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java&r1=126038&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java&r2=126039
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
Sat Jan 22 08:11:05 2005
@@ -202,8 +202,8 @@
 		if (realConnection.getHoldability() != JDBC30Translation.HOLD_CURSORS_OVER_COMMIT)
 			realConnection.setHoldability(JDBC30Translation.HOLD_CURSORS_OVER_COMMIT);
 
-		// drop any temporary tables that may have been declared by the previous user
-		realConnection.dropAllDeclaredGlobalTempTables();
+		// reset any remaining state of the connection
+		realConnection.resetFromPool();
 	}
 
 	/**

Mime
View raw message