Answer the question
In order to leave comments, you need to log in
What are the chances of a failing sql query?
Hello. I am slowly developing my skills. So far I have not delved into the source code of this topic, but I use transactions from laravel for bundles of important sql queries.
For example, a user on the site has a balance. When I click on "buy", I take away the balance from him and add the purchased item to the transaction. If one of the requests does not pass, the user receives an error, they say, repeat again.
The second example: when I click on "sell in 30 minutes", I put a task in the queue with the product ID. It’s a little more complicated here: if the sql query about selling an item fails, I need to tell Laravel that the task failed. At the same time, I need to revert all other changes that are not related to the database manually.
And now the question is: is there even a chance for the user to get such an error and does it make sense to write logic to process the sql query fail? Let's say that we live in a world of ideal business logic without errors in the code, but in the usual linux world with normal MySQL (otherSQL)
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question