That appears to be a good idea at first, although there are many subtle
differences between the two. These differences might also be the reason why
only few databases natively support two INSERT syntaxes. Mostly:

- You can have multi-record INSERTs
- You can have multi-row UPDATEs

Also, the DSL returns different types on both variants of set methods. A
common interface would need to return a common DSL supertype, possibly also
giving access to set() and to execute().

I feel that such a trick might lead to a lot of DSL API complexity that is
hard to maintain. There are also other clauses that seem to have similar
features, like FROM, WHERE.

On the other hand, there are already many ways to execute INSERT or UPDATE.
E.g. through UpdatableRecord.store(), or both query types accept
Map<Field<?>, ?> as an argument:
http://www.jooq.org/javadoc/3.2.x/org/jooq/UpdateSetStep.html#set(java.util.Map)



2014-01-30 Rob Nikander <[email protected]>

> Hi,
>
> It seems this would be useful. Maybe I'm using the library in an odd way,
> but I've got insert code that looks a lot like update code -- all the
> set(...) calls are the same.  I might put those set(...) calls into a
> common function, but you can't because UpdateSetStep is not related to
> InsertSetStep.  I've written a wrapper interface that allows be to do it,
> but it's not as convenient as it could be.  Have you thought of making them
> share a common interface, if that makes sense?
>
> Rob
>
>
>
> --
> 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.
>

-- 
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