[hibernate-commits] Hibernate SVN: r17785 - in core/branches/Branch_3_2_4_SP1_CP/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:44:01 EDT 2009


Author: stliu
Date: 2009-10-16 12:44:01 -0400 (Fri, 16 Oct 2009)
New Revision: 17785

Modified:
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Dialect.java
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/MySQLDialect.java
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java
Log:
JBPAPP-2900 HHH-4486 : Account for MySQL's <DROP TEMPORARY TABLE> statement

Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Dialect.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Dialect.java	2009-10-16 16:22:29 UTC (rev 17784)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Dialect.java	2009-10-16 16:44:01 UTC (rev 17785)
@@ -1046,6 +1046,15 @@
 	public String getCreateTemporaryTablePostfix() {
 		return "";
 	}
+	
+     /**
+	  * 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

Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/MySQLDialect.java	2009-10-16 16:22:29 UTC (rev 17784)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/MySQLDialect.java	2009-10-16 16:44:01 UTC (rev 17785)
@@ -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/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 16:22:29 UTC (rev 17784)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java	2009-10-16 16:44:01 UTC (rev 17785)
@@ -158,8 +158,12 @@
 				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