Hey, I'm trying to achieve searching DB strings of Windows path elements containing single slashes like "n:\somepath\anotherpath\", is there any workaround for that?
I tried:
all methods I found which is replacing double-slashes to single one on java level (nothing worked so far),
replacing database path values single slashes with doubleslashes - no luck
replacing slashes on the hba sql leve - no luck
results always returns with 0 values.
Here is some examples I have tried:
`
Search ss = new Search(Video.class);
ss.addFilterSome("videoFileSet", Filter.custom("value like REGEXP_REPLACE('%somepath\%', '\+', '', 'n')"));
videoFileSet - it is one-to-many relations HashSet, some of the above searches works if I remove slashes out of path "%somepath%" like this one:
ss.addFilterSome("videoFileSet", Filter.iLike("value", "%somepath%"));
If I replace slashes with % it also works "n:%somepath%anotherpath%" -but that approach has broken logic if it faces duplicate dir/file names deeper in the tree...
I just discovered that slash is postgresql escape character, so switching it to something like # works:
ss.addFilterSome("videoFileSet", Filter.custom("value like '%somepath\%' escape '#'"));
Hey, I'm trying to achieve searching DB strings of Windows path elements containing single slashes like "n:\somepath\anotherpath\", is there any workaround for that? I tried:
Here is some examples I have tried: ` Search ss = new Search(Video.class);
ss.addFilterSome("videoFileSet", Filter.custom("value like REGEXP_REPLACE('%somepath\%', '\+', '', 'n')"));
ss.clear(); ss.addFilterSome("videoFileSet", Filter.custom("REGEXP_REPLACE(value, '+', '', 'n') like REGEXP_REPLACE('%somepath\%', '\+', '', 'n')"));
ss.clear(); ss.addFilterSome("videoFileSet", Filter.iLike("value", "%somepath\%".replaceAll('\\\\+', '\\'))); `
videoFileSet - it is one-to-many relations HashSet, some of the above searches works if I remove slashes out of path "%somepath%" like this one: ss.addFilterSome("videoFileSet", Filter.iLike("value", "%somepath%"));
If I replace slashes with % it also works "n:%somepath%anotherpath%" -but that approach has broken logic if it faces duplicate dir/file names deeper in the tree...