Connection connection;
Statement statement;
SqlStatementExecutePermission permission;
str deleteStm;
if (!Global::isSystemAdministrator())
{
error("@SYS130561");
return;
}
connection = new Connection();
connection.ttsbegin();
statement = connection.createStatement();
deleteStm = '(SELECT RECID FROM ' + ReleaseUpdateDB::backendTableName(tableNum(Batch)) + ' WHERE GROUPID = \'' + 'TT_BT' + '\')';
deleteStm = 'DELETE FROM ' + ReleaseUpdateDB::backendTableName(tableNum(BatchConstraints)) + ' WHERE BATCHID IN ' + deleteStm +
' OR DEPENDSONBATCHID IN ' + deleteStm + ';';
permission = new SqlStatementExecutePermission(deleteStm);
permission.assert();
statement.executeUpdate(deleteStm);
statement.close();
CodeAccessPermission::revertAssert();
statement = connection.createStatement();
deleteStm = 'DELETE FROM ' + ReleaseUpdateDB::backendTableName(tableNum(Batch)) + ' WHERE GROUPID = \'' + 'TT_BT' + '\';';
permission = new SqlStatementExecutePermission(deleteStm);
permission.assert();
statement.executeUpdate(deleteStm);
statement.close();
CodeAccessPermission::revertAssert();
statement = connection.createStatement();
deleteStm = 'DELETE FROM ' + ReleaseUpdateDB::backendTableName(tableNum(BatchJobHistory)) + ' WHERE STATUS != \'' + 3 + '\';';
permission = new SqlStatementExecutePermission(deleteStm);
permission.assert();
statement.executeUpdate(deleteStm);
statement.close();
CodeAccessPermission::revertAssert();
connection.ttscommit();
connection = null;
No comments:
Post a Comment