Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2011-06-13 18:44:39 -0400
committerRyan D. Brooks2011-06-13 18:44:39 -0400
commit13e90fd0610b9ac2d29d352e96f39739224c6a08 (patch)
tree3a50155c898b91aef49110438b3a7ac9d6ea8047 /plugins/org.eclipse.osee.framework.database
parent489db52326445cb482da850191f3676f619b639b (diff)
downloadorg.eclipse.osee-13e90fd0610b9ac2d29d352e96f39739224c6a08.tar.gz
org.eclipse.osee-13e90fd0610b9ac2d29d352e96f39739224c6a08.tar.xz
org.eclipse.osee-13e90fd0610b9ac2d29d352e96f39739224c6a08.zip
refinement: Also remove non-existent gamma for archived branches
Diffstat (limited to 'plugins/org.eclipse.osee.framework.database')
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeUnusedBackingDataAndTransactions.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeUnusedBackingDataAndTransactions.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeUnusedBackingDataAndTransactions.java
index 98d8edff8e..b4e53e86e1 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeUnusedBackingDataAndTransactions.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeUnusedBackingDataAndTransactions.java
@@ -32,7 +32,7 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractOperation {
"select transaction_id from osee_tx_details txd where tx_type = 0 and not exists (select 1 from osee_txs txs1 where txd.transaction_id = txs1.transaction_id) and not exists (select 1 from osee_txs_archived txs3 where txd.transaction_id = txs3.transaction_id)";
private static final String NONEXISTENT_GAMMAS =
- "SELECT gamma_id FROM osee_txs txs WHERE NOT EXISTS " +
+ "SELECT gamma_id FROM %s txs WHERE NOT EXISTS " +
"(SELECT 1 FROM osee_attribute att WHERE txs.gamma_id = att.gamma_id) AND NOT EXISTS " +
"(SELECT 1 FROM osee_artifact art WHERE txs.gamma_id = art.gamma_id) AND NOT EXISTS " +
"(SELECT 1 FROM osee_relation_link rel WHERE txs.gamma_id = rel.gamma_id)";
@@ -62,12 +62,12 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractOperation {
ConnectionHandler.runBatchUpdate(sql, notAddressedGammas);
}
- private void processAddressedButNonexistentGammas() throws OseeCoreException {
+ private void processAddressedButNonexistentGammas(String tableName) throws OseeCoreException {
List<Object[]> nonexistentGammas = new LinkedList<Object[]>();
IOseeStatement chStmt = ConnectionHandler.getStatement();
try {
- chStmt.runPreparedQuery(NONEXISTENT_GAMMAS);
+ chStmt.runPreparedQuery(String.format(NONEXISTENT_GAMMAS, tableName));
while (chStmt.next()) {
nonexistentGammas.add(new Object[] {chStmt.getInt("gamma_id")});
log(String.valueOf(chStmt.getInt("gamma_id")));
@@ -76,7 +76,7 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractOperation {
chStmt.close();
}
- ConnectionHandler.runBatchUpdate(String.format(DELETE_GAMMAS, "osee_txs"), nonexistentGammas);
+ ConnectionHandler.runBatchUpdate(String.format(DELETE_GAMMAS, tableName), nonexistentGammas);
}
private void processEmptyTransactions() throws OseeCoreException {
@@ -101,7 +101,8 @@ public class PurgeUnusedBackingDataAndTransactions extends AbstractOperation {
processNotAddressedGammas("osee_attribute");
processNotAddressedGammas("osee_artifact");
processNotAddressedGammas("osee_relation_link");
- processAddressedButNonexistentGammas();
+ processAddressedButNonexistentGammas("osee_txs");
+ processAddressedButNonexistentGammas("osee_txs_archived");
processEmptyTransactions();
}
} \ No newline at end of file

Back to the top