-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SQL Transaction #35
Comments
For now, your specific case can be done like this: -- # :payer string
-- # :recipient string
-- # :amount int
UPDATE money SET amount = amount * IF(player = :payer, 1, -1) WHERE player IN (:payer, :recipient) This is a very ugly hack, but before transactions get implemented, this method can successfully squeeze your queries into one. |
Hmm, Can you add LOCK TABLE & UNLOCK TABLE ?, Query will conflict when multi server using one MySQL Server |
It only example. But i can't do this when result from query SELECT and the result must executed by code |
Right now the best solution is to |
The problem could be simply resolved using AwaitGenerator.
|
This has nothing to do with async. It is about the atomicness of transactions at the server side. |
Is your feature request related to a problem? Please describe.
I tried to make Payment System like EconomyAPI (/pay).
A: doing pay to B
B: receive pay from A
It need 2 query (
Reduce money A
Add money B )
, but when 1 query executed the server crash, A money reduced and B money not added.
I need startTransaction function and callback if query failed.
The text was updated successfully, but these errors were encountered: