Hi Christopher,

I have finally found the time to improve the manual's section about
ExecuteListeners and the jOOQ Console. I have added your suggestions
and while doing that, discovered the nice feature of dumping the Java
stack trace to stdout. This is really neat when debugging in Eclipse!
:-) Also, jOOQ 2.1.0 will include the console in the full deliverable,
so we can hope for some more feedback.

I've thought about our discussion again, whether the jOOQ Console
should be able to send queries from the Editor pane directly to the
server for execution in "headless" mode. I somehow still like the
idea! The jOOQ Console could allow for setting breakpoints (!) on any
type of matching SQL. My immediate idea would be to be able to match
SQL statements against regular expressions and when they are executed
(or in more advanced implementations: rendered, or variables bound, or
records fetched, etc), the server would lock on some mutex, that can
be freed again by the jOOQ Console - i.e. not a true Java breakpoint,
but a synthetic "DebugListener - breakpoint". While the server is
locked, it can still receive SQL statements from the jOOQ Console
Editor pane.

The big advantage of this is that you're able to introspect
server-side transaction state, which is not disclosed to the rest of
the database before a commit happens. For debugging purposes, this
could be very nice! Imagine, you want to intercept a slow/erroneous
INSERT statement. You'd specify a regex matching that statement. When
it is executed, the server locks, and lets the jOOQ Console "control"
the transaction. The jOOQ Console can now

1. Modify/tweak the current statement in any way (that would be a new feature)
2. Send arbitrary SQL to be executed on the same connection /
transaction / server-side Java thread, allowing for introspection /
modification of an uncommitted transaction (this wouldn't be logged by
the jOOQ Console Logger)
3. Free the lock, letting the server continue/finish the statement

Another advantage of this is usability. I've found it hard to explain
in the manual why there is no Editor pane in "headless" mode.

What do you think about this?

Cheers
Lukas

Reply via email to