[hibernate-commits] Hibernate SVN: r17783 - in core/branches/Branch_3_2/src/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:22:07 EDT 2009


Author: steve.ebersole at jboss.com
Date: 2009-10-16 12:22:06 -0400 (Fri, 16 Oct 2009)
New Revision: 17783

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

Modified: core/branches/Branch_3_2/src/org/hibernate/dialect/Dialect.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/dialect/Dialect.java	2009-10-16 16:21:02 UTC (rev 17782)
+++ core/branches/Branch_3_2/src/org/hibernate/dialect/Dialect.java	2009-10-16 16:22:06 UTC (rev 17783)
@@ -1091,6 +1091,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/branches/Branch_3_2/src/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/dialect/MySQLDialect.java	2009-10-16 16:21:02 UTC (rev 17782)
+++ core/branches/Branch_3_2/src/org/hibernate/dialect/MySQLDialect.java	2009-10-16 16:22:06 UTC (rev 17783)
@@ -255,6 +255,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";
@@ -298,11 +308,7 @@
 		return true;
 	}
 
-	public Boolean performTemporaryTableDDLInIsolation() {
-		return Boolean.FALSE;
-	}
 
-
 	// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 	public boolean supportsEmptyInList() {

Modified: core/branches/Branch_3_2/src/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 16:21:02 UTC (rev 17782)
+++ core/branches/Branch_3_2/src/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 16:22:06 UTC (rev 17783)
@@ -158,8 +158,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