Hello,
2015-06-11 20:30 GMT+02:00 <[email protected]>:
> the ExecuteListener would activate your MockConnection if needed.
>>
>
> How would this work? A MockConnection is registered when the DSLContext
> object is created, so how would you activate it through a listener?
>
There is no direct link between the two but you can implement your own
"protocol" for the two to communicate. A very simple version using
ThreadLocal:
VisitListener:
if (somecondition)
Global.threadLocal.set(true);
MockConnection:
if (Boolean.TRUE.equals(Global.threadLocal.get())
// Do something
That's of course not very robust. You might find a much better way for the
two to communicate in your implementation.
The VisitListener could be used to extract tables from a query
>>
>
> I was thinking about this. But a VisitListener can't distinguish between
> reads and writes, and a ExecuteListener can, but it can't extract tables.
> How could I have them communicate?
>
The VisitListener can also distinguish between reads and writes, although
not as easily as the ExecuteListener. You can always look into
VisitContext.clauses() to see what the top-level statement is
http://www.jooq.org/javadoc/latest/org/jooq/VisitContext.html#clauses--
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.