User tests: Successful: Unsuccessful:
Pull Request for Issue here
There is no issue for this pull request
Prevent database changes when an error occurs during the installation of an external component.
In the sql file of the component you have to simulate an error of your choice.
the database must rollback the transaction for the installation of tables in the database and all the installed tables before the error came must be deleted.
the expected result occurs.
Status | New | ⇒ | Pending |
Category | ⇒ | Unit Tests Repository Administration com_admin |
Title |
|
Title |
|
Category | Unit Tests Repository Administration com_admin | ⇒ | Libraries |
If we're going to do this, there also needs to be a catch (\Exception $e)
block to catch all exceptions and rollback the transaction otherwise the uncaught Exception is going to leave a lingering open transaction and that too will cause problems.
try {
// Do stuff
} catch (\JDatabaseExceptionExecuting $e) {
$db->transactionRollback();
// Do error handling stuff
} catch (\Exception $e) {
$db->transactionRollback();
throw $e;
}
I think this is a good idea - but
Labels |
Added:
?
?
|
@mbabker i tried to use your methods but it doen't give anything. I will be unavailable the next wo weeks so if you or someone else could create a new pull request it will be very nice.
Fixed the codestyle manually
Added in the catch for the base Exception class. IMO ready for testing/review.
Labels |
Removed:
?
|
I can't this this one.
It's has conflicts with the current branch.
conflict apart this cannot works cause Mysql doesn't allow rollback on DDL
Looks like this also fails in MariaDB https://mariadb.com/kb/en/start-transaction/#ddl-statements - so I'm closing this. Kinda unfortunate though :(
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-12-31 03:17:47 |
Closed_By | ⇒ | wilsonge |
@Tchangue please make sure that when you submit a pull request that you make sure it is against the correct branch