while(iterator.next())
{
ITable table = iterator.getTable();
String tableName = table.getTableMetaData().getTableName();
ITableMetaData metaData =
databaseDataSet.getTableMetaData(tableName);
// enable identity insert
boolean hasIdentityColumn = hasIdentityColumn(metaData, connection);
if (hasIdentityColumn)
{
StringBuffer sqlBuffer = new StringBuffer(128);
sqlBuffer.append("SET IDENTITY_INSERT ");
sqlBuffer.append(getQualifiedName(connection.getSchema(),
metaData.getTableName(), connection));
sqlBuffer.append(" ON");
statement.execute(sqlBuffer.toString());
}
try
{
_operation.execute(connection, new DefaultDataSet(table));
}
finally
{
// disable identity insert
if (hasIdentityColumn)
{
StringBuffer sqlBuffer = new StringBuffer(128);
sqlBuffer.append("SET IDENTITY_INSERT ");
sqlBuffer.append(getQualifiedName(connection.getSchema(),
metaData.getTableName(), connection));
sqlBuffer.append(" OFF");
statement.execute(sqlBuffer.toString());
}
jdbcConnection.commit();
}