Skip to content

Commit

Permalink
chore: removed old deprecated mergeInto statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ohager committed Apr 22, 2024
1 parent f80c65b commit fe4e86d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 46 deletions.
11 changes: 1 addition & 10 deletions src/brs/db/sql/SqlAccountStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ protected void save(DSLContext ctx, Account.RewardRecipientAssignment assignment
.set(REWARD_RECIP_ASSIGN.LATEST, true)
.execute();

// TODO: clean up if insertInto works
// ctx.mergeInto(REWARD_RECIP_ASSIGN, REWARD_RECIP_ASSIGN.ACCOUNT_ID, REWARD_RECIP_ASSIGN.PREV_RECIP_ID, REWARD_RECIP_ASSIGN.RECIP_ID, REWARD_RECIP_ASSIGN.FROM_HEIGHT, REWARD_RECIP_ASSIGN.HEIGHT, REWARD_RECIP_ASSIGN.LATEST)
// .key(REWARD_RECIP_ASSIGN.ACCOUNT_ID, REWARD_RECIP_ASSIGN.HEIGHT)
// .values(assignment.accountId, assignment.getPrevRecipientId(), assignment.getRecipientId(), assignment.getFromHeight(), Signum.getBlockchain().getHeight(), true)
// .execute();
}
};

Expand Down Expand Up @@ -124,11 +119,7 @@ protected void save(DSLContext ctx, Account.AccountAsset accountAsset) {
.set(ACCOUNT_ASSET.UNCONFIRMED_QUANTITY, accountAsset.getUnconfirmedQuantityQnt())
.set(ACCOUNT_ASSET.LATEST, true)
.execute();
// TODO: clean up
// ctx.mergeInto(ACCOUNT_ASSET, ACCOUNT_ASSET.ACCOUNT_ID, ACCOUNT_ASSET.ASSET_ID, ACCOUNT_ASSET.QUANTITY, ACCOUNT_ASSET.UNCONFIRMED_QUANTITY, ACCOUNT_ASSET.HEIGHT, ACCOUNT_ASSET.LATEST)
// .key(ACCOUNT_ASSET.ACCOUNT_ID, ACCOUNT_ASSET.ASSET_ID, ACCOUNT_ASSET.HEIGHT)
// .values(accountAsset.accountId, accountAsset.assetId, accountAsset.getQuantityQnt(), accountAsset.getUnconfirmedQuantityQnt(), Signum.getBlockchain().getHeight(), true)
// .execute();

}

@Override
Expand Down
17 changes: 1 addition & 16 deletions src/brs/db/sql/SqlDigitalGoodsStoreStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ protected void save(DSLContext ctx, DigitalGoodsStore.Purchase purchase, String
.set(PURCHASE_PUBLIC_FEEDBACK.HEIGHT, Signum.getBlockchain().getHeight())
.set(PURCHASE_PUBLIC_FEEDBACK.LATEST, true)
.execute();
// old code
// TODO: cleanup - if all works
// ctx.mergeInto(PURCHASE_PUBLIC_FEEDBACK, PURCHASE_PUBLIC_FEEDBACK.ID, PURCHASE_PUBLIC_FEEDBACK.PUBLIC_FEEDBACK, PURCHASE_PUBLIC_FEEDBACK.HEIGHT, PURCHASE_PUBLIC_FEEDBACK.LATEST)
// .key(PURCHASE_PUBLIC_FEEDBACK.ID, PURCHASE_PUBLIC_FEEDBACK.HEIGHT)
// .values(purchase.getId(), publicFeedback, Signum.getBlockchain().getHeight(), true)
// .execute();
}
};

Expand Down Expand Up @@ -238,11 +232,7 @@ private void saveGoods(DSLContext ctx, DigitalGoodsStore.Goods goods) {
.set(GOODS.DELISTED, goods.isDelisted())
.set(GOODS.LATEST, true)
.execute();
// TODO: clean up old code
// ctx.mergeInto(GOODS, GOODS.ID, GOODS.SELLER_ID, GOODS.NAME, GOODS.DESCRIPTION, GOODS.TAGS, GOODS.TIMESTAMP, GOODS.QUANTITY, GOODS.PRICE, GOODS.DELISTED, GOODS.HEIGHT, GOODS.LATEST)
// .key(GOODS.ID, GOODS.HEIGHT)
// .values(goods.getId(), goods.getSellerId(), goods.getName(), goods.getDescription(), goods.getTags(), goods.getTimestamp(), goods.getQuantity(), goods.getPriceNQT(), goods.isDelisted(), Signum.getBlockchain().getHeight(), true)
// .execute();

}

private void savePurchase(DSLContext ctx, DigitalGoodsStore.Purchase purchase) {
Expand Down Expand Up @@ -303,11 +293,6 @@ private void savePurchase(DSLContext ctx, DigitalGoodsStore.Purchase purchase) {
.set(PURCHASE.REFUND, purchase.getRefundNQT())
.set(PURCHASE.LATEST, true)
.execute();
// TODO: clean up
// ctx.mergeInto(PURCHASE, PURCHASE.ID, PURCHASE.BUYER_ID, PURCHASE.GOODS_ID, PURCHASE.SELLER_ID, PURCHASE.QUANTITY, PURCHASE.PRICE, PURCHASE.DEADLINE, PURCHASE.NOTE, PURCHASE.NONCE, PURCHASE.TIMESTAMP, PURCHASE.PENDING, PURCHASE.GOODS, PURCHASE.GOODS_NONCE, PURCHASE.REFUND_NOTE, PURCHASE.REFUND_NONCE, PURCHASE.HAS_FEEDBACK_NOTES, PURCHASE.HAS_PUBLIC_FEEDBACKS, PURCHASE.DISCOUNT, PURCHASE.REFUND, PURCHASE.HEIGHT, PURCHASE.LATEST)
// .key(PURCHASE.ID, PURCHASE.HEIGHT)
// .values(purchase.getId(), purchase.getBuyerId(), purchase.getGoodsId(), purchase.getSellerId(), purchase.getQuantity(), purchase.getPriceNQT(), purchase.getDeliveryDeadlineTimestamp(), note, nonce, purchase.getTimestamp(), purchase.isPending(), goods, goodsNonce, refundNote, refundNonce, purchase.getFeedbackNotes() != null && !purchase.getFeedbackNotes().isEmpty(), !purchase.getPublicFeedback().isEmpty(), purchase.getDiscountNQT(), purchase.getRefundNQT(), Signum.getBlockchain().getHeight(), true)
// .execute();
}

@Override
Expand Down
12 changes: 2 additions & 10 deletions src/brs/db/sql/SqlEscrowStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ private void saveDecision(DSLContext ctx, Escrow.Decision decision) {
.set(ESCROW_DECISION.DECISION, (int) Escrow.decisionToByte(decision.getDecision()))
.set(ESCROW_DECISION.LATEST, true)
.execute();
// TODO: clean up old statement once all works as expected
// ctx.mergeInto(ESCROW_DECISION, ESCROW_DECISION.ESCROW_ID, ESCROW_DECISION.ACCOUNT_ID, ESCROW_DECISION.DECISION, ESCROW_DECISION.HEIGHT, ESCROW_DECISION.LATEST)
// .key(ESCROW_DECISION.ESCROW_ID, ESCROW_DECISION.ACCOUNT_ID, ESCROW_DECISION.HEIGHT)
// .values(decision.escrowId, decision.accountId, (int) Escrow.decisionToByte(decision.getDecision()), Signum.getBlockchain().getHeight(), true)
// .execute();

}

@Override
Expand Down Expand Up @@ -140,11 +136,7 @@ private void saveEscrow(DSLContext ctx, Escrow escrow) {
.set(ESCROW.DEADLINE_ACTION, (int) Escrow.decisionToByte(escrow.getDeadlineAction()))
.set(ESCROW.LATEST, true)
.execute();
// TODO: cleanup if the insertInto works
// ctx.mergeInto(ESCROW, ESCROW.ID, ESCROW.SENDER_ID, ESCROW.RECIPIENT_ID, ESCROW.AMOUNT, ESCROW.REQUIRED_SIGNERS, ESCROW.DEADLINE, ESCROW.DEADLINE_ACTION, ESCROW.HEIGHT, ESCROW.LATEST)
// .key(ESCROW.ID, ESCROW.HEIGHT)
// .values(escrow.id, escrow.senderId, escrow.recipientId, escrow.amountNQT, escrow.requiredSigners, escrow.deadline, (int) Escrow.decisionToByte(escrow.deadlineAction), Signum.getBlockchain().getHeight(), true)
// .execute();

}

private class SqlDecision extends Escrow.Decision {
Expand Down
10 changes: 0 additions & 10 deletions src/brs/db/sql/SqlOrderStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ private void saveAsk(DSLContext ctx, Order.Ask ask) {
.set(ASK_ORDER.LATEST, true)
.execute();

// TODO: clean up this if the new alternative works
// ctx.mergeInto(ASK_ORDER, ASK_ORDER.ID, ASK_ORDER.ACCOUNT_ID, ASK_ORDER.ASSET_ID, ASK_ORDER.PRICE, ASK_ORDER.QUANTITY, ASK_ORDER.CREATION_HEIGHT, ASK_ORDER.HEIGHT, ASK_ORDER.LATEST)
// .key(ASK_ORDER.ID, ASK_ORDER.HEIGHT)
// .values(ask.getId(), ask.getAccountId(), ask.getAssetId(), ask.getPriceNQT(), ask.getQuantityQNT(), ask.getHeight(), Signum.getBlockchain().getHeight(), true)
// .execute();
}

@Override
Expand Down Expand Up @@ -245,11 +240,6 @@ private void saveBid(DSLContext ctx, Order.Bid bid) {
.set(BID_ORDER.CREATION_HEIGHT, bid.getHeight())
.set(BID_ORDER.LATEST, true)
.execute();
// TODO: remove once all is running as expected
// ctx.mergeInto(BID_ORDER, BID_ORDER.ID, BID_ORDER.ACCOUNT_ID, BID_ORDER.ASSET_ID, BID_ORDER.PRICE, BID_ORDER.QUANTITY, BID_ORDER.CREATION_HEIGHT, BID_ORDER.HEIGHT, BID_ORDER.LATEST)
// .key(BID_ORDER.ID, BID_ORDER.HEIGHT)
// .values(bid.getId(), bid.getAccountId(), bid.getAssetId(), bid.getPriceNQT(), bid.getQuantityQNT(), bid.getHeight(), Signum.getBlockchain().getHeight(), true)
// .execute();
}

class SqlAsk extends Order.Ask {
Expand Down

0 comments on commit fe4e86d

Please sign in to comment.