// first quarter - crete temp tables calls.
// may fail in case global temp table already exists.
for (int index = 0; index < nTables; index++) {
try {
DatasourceCall databseCall = (DatasourceCall)getCalls().elementAt(index);
executeCall(databseCall);
} catch (DatabaseException databaseEx) {
// ignore
}
}
// second quarter - populate temp tables calls.
// if that fails save the exception and untill cleanup
for (int index = nTables; index < nTables*2 && ex == null; index++) {
try {
DatasourceCall databseCall = (DatasourceCall)getCalls().elementAt(index);
executeCall(databseCall);
} catch (DatabaseException databaseEx) {
ex = databaseEx;
}
}
// third quarter - update original tables calls.
// if that fails save the exception and untill cleanup
for (int index = nTables*2; index < nTables*3 && ex == null; index++) {
try {
DatasourceCall databseCall = (DatasourceCall)getCalls().elementAt(index);
Integer rowCount = (Integer)executeCall(databseCall);
if ((index == nTables*2) || (rowCount.intValue() <= 0)) {// Row count returned must be from first table or zero if any are zero.
returnedRowCount = rowCount;
}
} catch (DatabaseException databaseEx) {
ex = databaseEx;
}
}
// last quarter - cleanup temp tables calls.
// ignore exceptions here.
for (int index = nTables*3; index < nTables*4; index++) {
try {
DatasourceCall databseCall = (DatasourceCall)getCalls().elementAt(index);
executeCall(databseCall);
} catch (DatabaseException databaseEx) {
// ignore
}
}