Wisser / Jailer

Database Subsetting and Relational Data Browsing Tool.

Home Page:https://wisser.github.io/Jailer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conditions with () have leading and trailing parans removed

swerner0 opened this issue · comments

I'm currently using the API to generate my extraction file programmatically rather than with the GUI.
When doing so, I came across an issue adding a restriction using getRestrictionModel().addRestriction() where removePreviousRestriction = false.
This properly wraps the previous restriction in () and appends, but when written out to the file, the first '(' and last ')' are removed. The damage seems to occur on calls to association.getRestrictionCondition(), the condition in RestrictionModel.restriction map is correct.

Example:

getRestrictionModel().addRestriction(... "cond1", false)
getRestrictionModel().addRestriction(... "cond2", false)

Results in:
RestrictionModel.restriction have '(cond1) and (cond2)'

In the file and calls to getRestrictionCondition() result in:
'cond1) and (cond2'

Perhaps this is no longer necessary or you could change the code so RestrictionModel.restriction maintains a List<> of conditions per association. Then join the list with and's on the getRestrictionCondition call. One benefit to the latter is multiple calls will not result nested parans.

Thanks for the report.

The GUI no longer uses addRestriction to combine multiple conditions. So the problem never occurred.

I have corrected this. If you like, you can test the fix (attached here) in advance.

jailer-engine-9.3.1.9.jar.zip

The GUI also had similar logic, but appears you have cleaned that up as well. Will give it a shot, thanks for the quick turnaround.