2014-02-12 8:59 GMT+01:00 Johannes Bühler <[email protected]>:

> Hi Lukas,
>
>
>
>> BTW: Wouldn't it be better to have batch insert support for the csv and
>>> json loaders?
>>>
>>
>> Yes, of course! I'm hoping to implement this for jOOQ 3.4:
>> https://github.com/jOOQ/jOOQ/issues/2664
>>
>
> May I help implementing this feature?
>

How could I say no to this, after your excellent help with the JSON
feature! :-)

It won't be a trivial refactoring, so let's have a quick review of the
existing functionality and how this fits with batch:

1. Commit rules
2. Duplicate handling rules
3. Error handling rules

In my opinion, JDBC batching should be applied whenever possible without
breaking existing functionality. Ideally, every loader configuration flag
should indicate whether it is "batch-compatible" or not in its Javadoc. A
new batch size setting would allow to override a default batch size of -
say - 1000 statements per batch. A batch size <= 0 would mean that no
batching is done.

*1. Commit rules*

- commitNone() - No interference (default to batch(1000))
- commitEach() - Invalidates the batch size - a warning should be emitted
if users set batch(xy) and commitEach() (forced to batch(0))
- commitAll() - No interference (default to batch(1000))
- commitAfter(int) - The batch size cannot be larger than the commit size.
A warning should be emitted if users set batch(x) and commitAfter(y) with x
> y (default to batch(Math.min(1000, y)))

*2. Duplicate handling rules*

- onDuplicateKeyIgnore() - No interference as this is handled by jOOQ and
will not generate constraint violations (this is currently not implemented
very well)
- onDuplicateKeyUpdate() - No interference as this is handled by jOOQ and
will not generate constraint violations
- onDuplicateKeyError() - No interference

Here, we'll have to see with our integration tests, how each driver behaves

*3. Error handling rules*

- onErrorAbort() - Not sure ...
- onErrorIgnore() - Not sure ...

... what'll change when we switch from single statement execution to batch.

So how would you like to proceed with a contribution? The easiest way would
be to implement this for H2 and I'll make it work for all the other 15 SQL
dialects. Or do you have any other suggestion?

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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to