Possible DefaultExecuteListener bug

16 views
Skip to first unread message

Anthony Calce

unread,
Nov 4, 2015, 6:08:14 PM11/4/15
to jOOQ User Group
Hello,

First let me start off by saying that jOOQ is an amazing package.  Excellent job on this.  Now, to my question / possible bug.

I have created my own custom wrapper for any jOOQ related operations.  Below is an example code of the execution of a batch operation
KrJooqWrapper wrapper = new KrJooqWrapper(1)            
BatchBindStep x = wrapper.getCreate()
    .batch(wrapper.getCreate()
        .insertInto(TABLE, 
                    TABLE.COL_A,
                    TABLE.COL_B)
        .values((Integer)null, 
                (String)null));
                
x.bind(0, "blah");
x.execute();

My wrapper class creates the config with a QueryListener which implements the following
@Override
public void executeEnd(ExecuteContext ctx) {
    if (isLogQuery) {
        // Formatter for printing
        DSLContext formatter = DSL.using(ctx.dialect(), new Settings()
                .withRenderFormatted(true)
                .withRenderKeywordStyle(RenderKeywordStyle.UPPER)
                .withRenderNameStyle(RenderNameStyle.AS_IS));

        // For every query in batch mode (or 1 in non-match mode)
        StringBuilder sb = new StringBuilder();
        sb.append("The query(s) was: \n");
        for (Query query : ctx.batchQueries()) {
            sb.append(formatter.renderInlined(query) + "\n");
        }

        Logging.logInfo(sb.toString());
    }
}

When executing the example batch operation, the binded variables are not logged.  I have gone through every function of the DefaultExecuteListener and I cannot find any reference of the binded variables.  The logged operation is below:

The query(s) was: 
INSERT INTO db.a_table (
  col_a, 
  col_b
)
VALUES (
  NULL, 
  NULL
)

Is this intended or is it a bug that is of low priority?  Thanks for helping.


Anthony

Lukas Eder

unread,
Nov 5, 2015, 3:12:21 AM11/5/15
to jooq...@googlegroups.com
Hello,

Thanks for your enquiry. I'd say it's a missing feature, for which I've now created a feature request:

The batch bind variables aren't available via the ExecuteContext. You can thus not access them in your logger.

The NULL values that you're getting when rendering the query are the values that you've passed to the query initially, but they have no meaning.

Cheers,
Lukas

--
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anthony Calce

unread,
Nov 10, 2015, 11:06:31 AM11/10/15
to jOOQ User Group
Thanks for the quick response
Reply all
Reply to author
Forward
0 new messages