Press ESC to close

Or check our Popular Categories...

Database

4   Articles
4

Latest Articles and Errors& Fixes of popular RDBMS like Sql server, Oracle, MYSQL and more

3 Min Read
0 0

SOLUTION :1 We generally use when working with transactions looks like this (semi-pseudo-code): [pastacode lang=”sql” manual=”try%20%7B%0A%20%20%20%20%2F%2F%20First%20of%20all%2C%20let’s%20begin%20a%20transaction%0A%20%20%20%20%24db-%3EbeginTransaction()%3B%0A%0A%20%20%20%20%2F%2F%20A%20set%20of%20queries%3B%20if%20one%20fails%2C%20an%20exception%20should%20be%20thrown%0A%20%20%20%20%24db-%3Equery(‘first%20query’)%3B%0A%20%20%20%20%24db-%3Equery(‘second%20query’)%3B%0A%20%20%20%20%24db-%3Equery(‘third%20query’)%3B%0A%0A%20%20%20%20%2F%2F%20If%20we%20arrive%20here%2C%20it%20means%20that%20no%20exception%20was%20thrown%0A%20%20%20%20%2F%2F%20i.e.%20no%20query%20has%20failed%2C%20and%20we%20can%20commit%20the%20transaction%0A%20%20%20%20%24db-%3Ecommit()%3B%0A%7D%20catch%20(Exception%20%24e)%20%7B%0A%20%20%20%20%2F%2F%20An%20exception%20has%20been%20thrown%0A%20%20%20%20%2F%2F%20We%20must%20rollback%20the%20transaction%0A%20%20%20%20%24db-%3Erollback()%3B%0A%7D%0A” message=”jQuery Code” highlight=”” provider=”manual”/] [ad type=”banner”] Note that, with this idea, if a query…

Continue Reading
X