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 ...
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 ...
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 ...
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 ...
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 ...
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) ...
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.
...
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.
...
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 ...
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 ...
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:
...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
transactions × 18c# × 6
sql × 6
java × 3
php × 3
mysql × 2
sql-server × 2
database × 2
thread-safety × 2
entity-framework × 2
pdo × 2
repository × 2
python × 1
c++ × 1
performance × 1
algorithm × 1
multithreading × 1
.net × 1
node.js × 1
functional-programming × 1
swift × 1
concurrency × 1
stack × 1
django × 1
logging × 1