HHH-4486 : MySQL [DROP TEMPORARY TABLE] support

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17782 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2009-10-16 16:21:02 +00:00
parent 7eb946fec5
commit 376ef717e9
3 changed files with 22 additions and 6 deletions

View File

@ -1091,6 +1091,15 @@ public abstract class Dialect {
return ""; 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 * Does the dialect require that temporary table DDL statements occur in
* isolation from other statements? This would be the case if the creation * isolation from other statements? This would be the case if the creation

View File

@ -281,6 +281,16 @@ public class MySQLDialect extends Dialect {
return "create temporary table if not exists"; 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) { public String getCastTypeName(int code) {
if ( code==Types.INTEGER ) { if ( code==Types.INTEGER ) {
return "signed"; return "signed";
@ -324,10 +334,6 @@ public class MySQLDialect extends Dialect {
return true; return true;
} }
public Boolean performTemporaryTableDDLInIsolation() {
return Boolean.FALSE;
}
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -28,7 +28,6 @@ import java.sql.PreparedStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Statement; import java.sql.Statement;
import java.util.List; import java.util.List;
import java.util.Iterator;
import java.util.Collections; import java.util.Collections;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
@ -182,8 +181,10 @@ public abstract class AbstractStatementExecutor implements StatementExecutor {
public void doWork(Connection connection) throws HibernateException { public void doWork(Connection connection) throws HibernateException {
Statement stmnt = null; Statement stmnt = null;
try { try {
final String command = session.getFactory().getSettings().getDialect().getDropTemporaryTableString()
+ " " + persister.getTemporaryIdTableName();
stmnt = connection.createStatement(); stmnt = connection.createStatement();
stmnt.executeUpdate( "drop table " + persister.getTemporaryIdTableName() ); stmnt.executeUpdate( command );
} }
catch( Throwable t ) { catch( Throwable t ) {
log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" ); log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );