Hi Kevinjeet,

In your second example, you cannot "bind" an expression to your batch. You
can only bind values to it. You should make sure the expression is already
in the INSERT statement.

static class BulkInsertBufferV2 {
    public BatchBindStep insertBuffer = mysql.batch(
        insertInto(table("Table1"), field("BytesKey"), field("StringData"))
        .values(field("unhex({0})", String.class, null), null));

    public void add(Record record) {
        insertBuffer = insertBuffer.bind(record.getHexStringKey(),(String)
record.getData());
    }

    public int[] flush(DSLContext mysql) {
        return insertBuffer.execute();
    }
}

Notice that those "null" values in the insertInto statement are
"placeholders" for your bind variables. You have to put them there for
syntactic reasons, even if that's a bit confusing. If you want to use an
expression in your VALUES clause, you can do that, but you still have to
place a bind variable placeholder somewhere.

I hope this helps,
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO6_ArWve7Smwk-LRcZ%2BsuYwx%2BVQimVmeuzvjgk0poZo3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to