I am using jOOq to write queries except I am using a vendor specific type of SQL... to be specific flexible search. The main difference between SQL and flexiSearch is that parameter values are enclosed in a curly bracket. e.g.
SELECT * FROM {Product} WHERE {code} LIKE ‘%al%’
So what I'm trying to do is to get jOOq to automatically intercept the query building procedure to include the brackets.
Looking through the docs, it seems that I should implement some kind of execute listener? But I am not sure what to do after that. Thanks
You could indeed implement an
ExecuteListener
that replaces"
by a{
and every even"
by a}
using any dialect (be careful of syntactic ambiguities)`
by a{
and every even`
by a}
using MySQL dialect[
by a{
and every]
by a}
using SQL Server dialectBut from what I can tell, that won't be the only thing you'll be patching in generated SQL, so you might as well fork the jOOQ Open Source Edition and patch the relevant code yourself.
Beware, jOOQ doesn't really support this particular dialect. This will not be the only thing you'll run into. For example, you could try to pattern match subqueries in an
ExecuteListener
and wrap them in{{ ... }}
, but that, too, would be much easier to achieve by patching jOOQ directly.