[hibernate-commits] Hibernate SVN: r17782 - in core/trunk/core/src/main/java/org/hibernate: hql/ast/exec and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Oct 16 12:21:03 EDT 2009


Author: steve.ebersole at jboss.com
Date: 2009-10-16 12:21:02 -0400 (Fri, 16 Oct 2009)
New Revision: 17782

Modified:
   core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
   core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
   core/trunk/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java
Log:
HHH-4486 : MySQL [DROP TEMPORARY TABLE] support

Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java	2009-10-16 15:34:39 UTC (rev 17781)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java	2009-10-16 16:21:02 UTC (rev 17782)
@@ -1092,6 +1092,15 @@
 	}
 
 	/**
+	 * Command used to drop a temporary table.
+	 *
+	 * @return The command used to drop a temporary table.
+	 */
+	public String getDropTemporaryTableString() {
+		return "drop table";
+	}
+
+	/**
 	 * Does the dialect require that temporary table DDL statements occur in
 	 * isolation from other statements?  This would be the case if the creation
 	 * would cause any current transaction to get committed implicitly.

Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java	2009-10-16 15:34:39 UTC (rev 17781)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java	2009-10-16 16:21:02 UTC (rev 17782)
@@ -281,6 +281,16 @@
 		return "create temporary table if not exists";
 	}
 
+	public String getDropTemporaryTableString() {
+		return "drop temporary table";
+	}
+
+	public Boolean performTemporaryTableDDLInIsolation() {
+		// because we [drop *temporary* table...] we do not
+		// have to perform these in isolation.
+		return Boolean.FALSE;
+	}
+
 	public String getCastTypeName(int code) {
 		if ( code==Types.INTEGER ) {
 			return "signed";
@@ -324,11 +334,7 @@
 		return true;
 	}
 
-	public Boolean performTemporaryTableDDLInIsolation() {
-		return Boolean.FALSE;
-	}
 
-
 	// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 	public boolean supportsEmptyInList() {

Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 15:34:39 UTC (rev 17781)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 16:21:02 UTC (rev 17782)
@@ -28,7 +28,6 @@
 import java.sql.Connection;
 import java.sql.Statement;
 import java.util.List;
-import java.util.Iterator;
 import java.util.Collections;
 
 import org.hibernate.HibernateException;
@@ -182,8 +181,10 @@
 				public void doWork(Connection connection) throws HibernateException {
 					Statement stmnt = null;
 					try {
+						final String command = session.getFactory().getSettings().getDialect().getDropTemporaryTableString()
+								+ " " + persister.getTemporaryIdTableName();
 						stmnt = connection.createStatement();
-						stmnt.executeUpdate( "drop table " + persister.getTemporaryIdTableName() );
+						stmnt.executeUpdate( command );
 					}
 					catch( Throwable t ) {
 						log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );



More information about the hibernate-commits mailing list