[hibernate-commits] Hibernate SVN: r17784 - in core/branches/Branch_3_3/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:22:29 EDT 2009


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

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

Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/Dialect.java	2009-10-16 16:22:06 UTC (rev 17783)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/Dialect.java	2009-10-16 16:22:29 UTC (rev 17784)
@@ -1090,6 +1090,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_3/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/MySQLDialect.java	2009-10-16 16:22:06 UTC (rev 17783)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/MySQLDialect.java	2009-10-16 16:22:29 UTC (rev 17784)
@@ -278,6 +278,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";
@@ -321,11 +331,7 @@
 		return true;
 	}
 
-	public Boolean performTemporaryTableDDLInIsolation() {
-		return Boolean.FALSE;
-	}
 
-
 	// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 	public boolean supportsEmptyInList() {

Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 16:22:06 UTC (rev 17783)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 16:22:29 UTC (rev 17784)
@@ -181,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