HHH-4486 : MySQL [DROP TEMPORARY TABLE] support

git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@17783 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2009-10-16 16:22:06 +00:00
parent 2d96fb581a
commit f73f158b32
3 changed files with 22 additions and 5 deletions

View File

@ -1090,6 +1090,15 @@ public abstract class Dialect {
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
* isolation from other statements? This would be the case if the creation

View File

@ -255,6 +255,16 @@ public class MySQLDialect extends Dialect {
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,10 +308,6 @@ public class MySQLDialect extends Dialect {
return true;
}
public Boolean performTemporaryTableDDLInIsolation() {
return Boolean.FALSE;
}
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -158,8 +158,10 @@ public abstract class AbstractStatementExecutor implements StatementExecutor {
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() + "]" );