srcshelton / myway

Enhanced MySQL-targeted Flyway alternative
0 stars 0 forks source link

Off-by-one in errors after calling `set_err()`? #5

Closed srcshelton closed 8 years ago

srcshelton commented 8 years ago

Calling set_err() results in the next statement which is executed to fail with the loaded message - correct statement execution doesn't clear the error state.

There is a place (are places?) in myway.pl where set_err() is called to attempt to propagate a caught error up the stack - and this mostly works. However, I have just encountered an edge-case where a failing statement (in this case, calling ALTER TABLE ... ADD COLUMN with a column which already exists) causes the error to be output twice - once when it occurs, and once when the next statement successfully completes, potentially leading to a loss of state.

Ideally, the throw/catch mechanism emulated by calling set_err() can be removed entirely - but this will need to be thoroughly tested to ensure that nothing is lost in the process...

srcshelton commented 8 years ago

Code removed where possible, no apparently negative outcome. Will leave this issue open for a while to track any regressions which may be found...