From fe4e86d0b0b3a5cbbaba3b4f95c62aa9a63ba7eb Mon Sep 17 00:00:00 2001 From: ohager Date: Mon, 22 Apr 2024 07:34:26 -0300 Subject: [PATCH] chore: removed old deprecated mergeInto statements --- src/brs/db/sql/SqlAccountStore.java | 11 +---------- src/brs/db/sql/SqlDigitalGoodsStoreStore.java | 17 +---------------- src/brs/db/sql/SqlEscrowStore.java | 12 ++---------- src/brs/db/sql/SqlOrderStore.java | 10 ---------- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/src/brs/db/sql/SqlAccountStore.java b/src/brs/db/sql/SqlAccountStore.java index 2f24a7c26..c4cc787df 100644 --- a/src/brs/db/sql/SqlAccountStore.java +++ b/src/brs/db/sql/SqlAccountStore.java @@ -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(); } }; @@ -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 diff --git a/src/brs/db/sql/SqlDigitalGoodsStoreStore.java b/src/brs/db/sql/SqlDigitalGoodsStoreStore.java index 4b68448db..97c783d01 100644 --- a/src/brs/db/sql/SqlDigitalGoodsStoreStore.java +++ b/src/brs/db/sql/SqlDigitalGoodsStoreStore.java @@ -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(); } }; @@ -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) { @@ -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 diff --git a/src/brs/db/sql/SqlEscrowStore.java b/src/brs/db/sql/SqlEscrowStore.java index 980e1ad15..d4f4aa044 100644 --- a/src/brs/db/sql/SqlEscrowStore.java +++ b/src/brs/db/sql/SqlEscrowStore.java @@ -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 @@ -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 { diff --git a/src/brs/db/sql/SqlOrderStore.java b/src/brs/db/sql/SqlOrderStore.java index 5974136b0..c6e4ad0db 100644 --- a/src/brs/db/sql/SqlOrderStore.java +++ b/src/brs/db/sql/SqlOrderStore.java @@ -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 @@ -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 {