Skip to main content
6 votes
Accepted

Transaction manager, supporting undo/redo, using C++ templates

If you want to implement the command manager pattern, you can do something so very much simpler that I don't really understand what you're aiming for. As you know, the design pattern has a ...
papagaga's user avatar
  • 5,767
4 votes

Updating multiple database tables when products are shipped back by customer

First and most importantly, yes, you should definitely be wrapping these actions in transactions because if a single "write" fails, then all related processes should be rolled back. It ...
mickmackusa's user avatar
  • 8,694
4 votes

Using a transaction to create account records

Retrieving the ID of newly-created user should not be done like this: $select = $dbc->prepare("SELECT MAX(uid)+1 AS 'NEWUID' FROM mainTable"); Instead ...
Kate's user avatar
  • 7,588
4 votes

Using a transaction to create account records

Does this appear as proper use of the commit and rollback functions? I honestly haven't used PDO functions directly - typically used a framework like Laravel or similar. I do agree with the advice on ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
3 votes
Accepted

Deleting millions of logs in batches

Here is another recent Code Review question that has a lot of similarities to yours: Daily SQL job to delete records older than 24 hours. I think I would recommend three things here: Snapshot ...
Dan Oberlam's user avatar
  • 7,854
3 votes

Isolate a Database Change Within Django Transaction.Atomic

Let's start off with what's probably the most important note here: if you are running into issues with atomic transactions, pushing the database work off to Celery (or another worker thread) ...
Kevin Brown-Silva's user avatar
3 votes
Accepted

Synchronization of transaction processing

class Transaction { public int Id { get; set; } public int Counter { get; set; } } Neither of the properties should be publicly settable. ...
404's user avatar
  • 2,306
3 votes

Synchronization of transaction processing

I cannot verify this pattern for its correctnes but I find you can simplify and make the TransactionLocker better testable by removing the trasaction logic from it. ...
t3chb0t's user avatar
  • 44.3k
3 votes
Accepted

Updates or creates an entity based on if a value is present in an Optional

Regarding your questions Is this an inappropriate use of Optional's map method? I'm not mapping to a new object but rather just returning the same car with some properties potentially updated. I ...
Marc's user avatar
  • 5,674
2 votes

IF SELECT statement will break SQL ACID Compliance?

I should not use IF SELECT before doing an UPDATE statement because it will breaks the atomicity of a transaction This is wrong. The if exists / update is itself a ...
Reinderien's user avatar
  • 65.6k
2 votes

Reducing Inventory Quantity When Order Is Being Processed

Are you sure that you need two queries for this? E.g. you could do something like this: ...
RobH's user avatar
  • 17k
1 vote

Thread Safe Bank Transaction: Deposit, Withdrawal, Check Balance and Transfer in Java

Let's break this down. You have two locks for single object that guarding same fields. It's generally bad practice, and it doesn't make sense as second lock(transferLock) is used only in single ...
Bogdan Mart's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible