Hi Abel,

Thank you for that contribution.

I don't think we should introduce so many new types, just for the
ignore flag. This is a minor feature, it shouldn't have such a big
impact. However, you were right in thinking that this also affects the
non-fluent API. But I'd prefer to have a getter/setter on the
org.jooq.InsertQuery type, rather than duplicating the whole type.
This will keep things DRY and thus maintainable:
http://en.wikipedia.org/wiki/DRY

In the same way, the fluent API and its implementation shouldn't be
duplicated. So here are the expected added artefacts:

- Several overloaded Factory.insertIgnoreInto() methods
- Getter / Setter on InsertQuery
- Boolean flag in InsertQueryImpl

Note, should you want to try again, your files seem to be a bit
outdated. Before sending them, can you please merge SVN trunk into
your changes? Do you want to try again? Or should I implement it?

Please let me know

Cheers
Lukas


2012/4/13 Abel Birya <[email protected]>:
> Hey Lukas,
>
> Thank you for your email. I was however unable to upload the files to
> sourceforge. The page seems to be having an endless redirect loop. Find
> attached the files that I created. Below is a list of the changes that I
> made to already existing files.
>
> Factory Operations - I added insertIgnoreInto() and insertIgnoreQuery()
> methods.
> Factory - I implemented the above methods.
>
> Kindly let me know whether everything is satisfactory or whether I may need
> to make adjustments to any of the code.
>
> Cheers.
>
> Abel
>
> ________________________________
> From: "Lukas Eder" <[email protected]>
> To: [email protected]
> Sent: Thursday, April 12, 2012 3:51:39 PM
> Subject: Re: JOOQ INSERT IGNORE
>
>
> Hi Abel
>
>> Apologies for the late reply... The screen to my laptop has been having
>> problems the last 2 days.
>
> No worries!
>
>> I had however started on the implementation of the insert ignore
>> functionalities. I had planned on doing it in 2 parts ie "insertignore"
>> and
>> "insertignoreselect".
>
> I don't think the latter is needed. These syntaxes will already be possible:
>
> new Factory(...).insertIgnoreInto(...).values(...)
> new Factory(...).insertIgnoreInto(...).set(...).set(...)
> new Factory(...).insertIgnoreInto(...).select(...)
>
>> I have been able to implement what I think is the "insertignore"
>> functionality although with my laptop having issues I am unable to do any
>> testing. Kindly let me send you the files with a list of the changes I
>> have
>> made so that you can start testing when you have time and maybe give me a
>> few pointers on where you feel I need to make adjustments and/or changes
>> (if
>> any).
>
> You can send those files to the user group if the change is not too
> big. Otherwise, you could attach them to this ticket with your
> sourceforge account:
> https://sourceforge.net/apps/trac/jooq/ticket/1295
>
> Cheers
> Lukas
>
>>
>> Regards
>>
>>
>> On Tuesday, April 10, 2012 2:28:47 PM UTC+3, Lukas Eder wrote:
>>>
>>> Hello Abel,
>>>
>>> > [...] if I had the right guide I can try to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>>
>>> OK, very nice. So the new method would probably be called
>>> Factory.insertIgnore(...), and it would set a new "ignore" flag in
>>> InsertQueryImpl. If you could try to make this work for MySQL, it
>>> would be great. I can then take over and simulate this for other
>>> dialects.
>>>
>>> Cheers
>>> Lukas
>>>
>>> 2012/4/10 name256 <[email protected]>:
>>> > Hi.
>>> >
>>> > Many thanks for your quick reply. I am currently working on a project
>>> > that I
>>> > am sure will benefit from the many features that JOOQ has to offer.
>>> > Challenge is the "INSERT IGNORE" implementation is integral to the
>>> > success
>>> > of this project (I am thinking of changing the implementation from raw
>>> > jdbc
>>> > to JOOQ) and that is why I felt that if I had the right guide I can try
>>> > to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>> >
>>> > I have also been looking at the implementation of
>>> >  onDuplicateKeyUpdate() to
>>> > see whether I can make some headway on its implementation (no luck so
>>> > far).
>>> > I shall let you know how I am getting along in the coming days.
>>> >
>>> > Regards
>>> >
>>> > Abel
>>> >
>>> > On Tuesday, April 10, 2012 1:13:51 PM UTC+3, Lukas Eder wrote:
>>> >>
>>> >> Hello Abel,
>>> >>
>>> >> Good idea, and thanks for the offer of implementing this. I'll track
>>> >> this idea as feature request #1295:
>>> >> https://sourceforge.net/apps/trac/jooq/ticket/1295
>>> >>
>>> >> For better maintainability, I would prefer if such DSL features
>>> >> wouldn't be implemented in dialect-specific factories, but in the
>>> >> global Factory with an appropriate org.jooq.Support annotation to
>>> >> indicate the dialects supporting this clause. Specifically, MySQL's
>>> >> INSERT IGNORE clause could be simulated using the SQL:2003 standard
>>> >> MERGE statement in DB2, HSQLDB, Oracle, SQL Server, and Sybase SQL
>>> >> Anywhere.
>>> >>
>>> >> On the other hand, there seems to be no difference between executing
>>> >> INSERT IGNORE and INSERT .. ON DUPLICATE KEY UPDATE SET pk = pk, where
>>> >> the UPDATE part is effectively optimised away in a simple test by this
>>> >> Stack Overflow user:
>>> >>
>>> >> http://stackoverflow.com/a/7853634/521799
>>> >>
>>> >> So, INSERT IGNORE could be rendered "as is" for MySQL, and simulated
>>> >> for CUBRID (Which has the ON DUPLICATE KEY UPDATE clause), DB2,
>>> >> HSQLDB, Oracle, SQL Server, Sybase SQL Anywhere (which have the MERGE
>>> >> statement)
>>> >>
>>> >> Any other opinions welcome!
>>> >>
>>> >> Cheers
>>> >> Lukas
>>> >>
>>> >> 2012/4/10 name256 <[email protected]>:
>>> >> > Hi,
>>> >> >
>>> >> > I am a newbie to JOOQ. I was wondering whether someone has been able
>>> >> > to
>>> >> > implement an implementation of insert ignore for the MYSQLFactory.
>>> >> > Kindly
>>> >> > let me know. I would't mind a guide to doing this myself as well as
>>> >> > it
>>> >> > will
>>> >> > give me a better insight into JOOQ.
>>> >> >
>>> >> > Regards.
>>> >> >
>>> >> > Abel
>>
>>
>> On Tuesday, April 10, 2012 2:28:47 PM UTC+3, Lukas Eder wrote:
>>>
>>> Hello Abel,
>>>
>>> > [...] if I had the right guide I can try to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>>
>>> OK, very nice. So the new method would probably be called
>>> Factory.insertIgnore(...), and it would set a new "ignore" flag in
>>> InsertQueryImpl. If you could try to make this work for MySQL, it
>>> would be great. I can then take over and simulate this for other
>>> dialects.
>>>
>>> Cheers
>>> Lukas
>>>
>>> 2012/4/10 name256 <[email protected]>:
>>> > Hi.
>>> >
>>> > Many thanks for your quick reply. I am currently working on a project
>>> > that I
>>> > am sure will benefit from the many features that JOOQ has to offer.
>>> > Challenge is the "INSERT IGNORE" implementation is integral to the
>>> > success
>>> > of this project (I am thinking of changing the implementation from raw
>>> > jdbc
>>> > to JOOQ) and that is why I felt that if I had the right guide I can try
>>> > to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>> >
>>> > I have also been looking at the implementation of
>>> >  onDuplicateKeyUpdate() to
>>> > see whether I can make some headway on its implementation (no luck so
>>> > far).
>>> > I shall let you know how I am getting along in the coming days.
>>> >
>>> > Regards
>>> >
>>> > Abel
>>> >
>>> > On Tuesday, April 10, 2012 1:13:51 PM UTC+3, Lukas Eder wrote:
>>> >>
>>> >> Hello Abel,
>>> >>
>>> >> Good idea, and thanks for the offer of implementing this. I'll track
>>> >> this idea as feature request #1295:
>>> >> https://sourceforge.net/apps/trac/jooq/ticket/1295
>>> >>
>>> >> For better maintainability, I would prefer if such DSL features
>>> >> wouldn't be implemented in dialect-specific factories, but in the
>>> >> global Factory with an appropriate org.jooq.Support annotation to
>>> >> indicate the dialects supporting this clause. Specifically, MySQL's
>>> >> INSERT IGNORE clause could be simulated using the SQL:2003 standard
>>> >> MERGE statement in DB2, HSQLDB, Oracle, SQL Server, and Sybase SQL
>>> >> Anywhere.
>>> >>
>>> >> On the other hand, there seems to be no difference between executing
>>> >> INSERT IGNORE and INSERT .. ON DUPLICATE KEY UPDATE SET pk = pk, where
>>> >> the UPDATE part is effectively optimised away in a simple test by this
>>> >> Stack Overflow user:
>>> >>
>>> >> http://stackoverflow.com/a/7853634/521799
>>> >>
>>> >> So, INSERT IGNORE could be rendered "as is" for MySQL, and simulated
>>> >> for CUBRID (Which has the ON DUPLICATE KEY UPDATE clause), DB2,
>>> >> HSQLDB, Oracle, SQL Server, Sybase SQL Anywhere (which have the MERGE
>>> >> statement)
>>> >>
>>> >> Any other opinions welcome!
>>> >>
>>> >> Cheers
>>> >> Lukas
>>> >>
>>> >> 2012/4/10 name256 <[email protected]>:
>>> >> > Hi,
>>> >> >
>>> >> > I am a newbie to JOOQ. I was wondering whether someone has been able
>>> >> > to
>>> >> > implement an implementation of insert ignore for the MYSQLFactory.
>>> >> > Kindly
>>> >> > let me know. I would't mind a guide to doing this myself as well as
>>> >> > it
>>> >> > will
>>> >> > give me a better insight into JOOQ.
>>> >> >
>>> >> > Regards.
>>> >> >
>>> >> > Abel
>>
>>
>> On Tuesday, April 10, 2012 2:28:47 PM UTC+3, Lukas Eder wrote:
>>>
>>> Hello Abel,
>>>
>>> > [...] if I had the right guide I can try to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>>
>>> OK, very nice. So the new method would probably be called
>>> Factory.insertIgnore(...), and it would set a new "ignore" flag in
>>> InsertQueryImpl. If you could try to make this work for MySQL, it
>>> would be great. I can then take over and simulate this for other
>>> dialects.
>>>
>>> Cheers
>>> Lukas
>>>
>>> 2012/4/10 name256 <[email protected]>:
>>> > Hi.
>>> >
>>> > Many thanks for your quick reply. I am currently working on a project
>>> > that I
>>> > am sure will benefit from the many features that JOOQ has to offer.
>>> > Challenge is the "INSERT IGNORE" implementation is integral to the
>>> > success
>>> > of this project (I am thinking of changing the implementation from raw
>>> > jdbc
>>> > to JOOQ) and that is why I felt that if I had the right guide I can try
>>> > to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>> >
>>> > I have also been looking at the implementation of
>>> >  onDuplicateKeyUpdate() to
>>> > see whether I can make some headway on its implementation (no luck so
>>> > far).
>>> > I shall let you know how I am getting along in the coming days.
>>> >
>>> > Regards
>>> >
>>> > Abel
>>> >
>>> > On Tuesday, April 10, 2012 1:13:51 PM UTC+3, Lukas Eder wrote:
>>> >>
>>> >> Hello Abel,
>>> >>
>>> >> Good idea, and thanks for the offer of implementing this. I'll track
>>> >> this idea as feature request #1295:
>>> >> https://sourceforge.net/apps/trac/jooq/ticket/1295
>>> >>
>>> >> For better maintainability, I would prefer if such DSL features
>>> >> wouldn't be implemented in dialect-specific factories, but in the
>>> >> global Factory with an appropriate org.jooq.Support annotation to
>>> >> indicate the dialects supporting this clause. Specifically, MySQL's
>>> >> INSERT IGNORE clause could be simulated using the SQL:2003 standard
>>> >> MERGE statement in DB2, HSQLDB, Oracle, SQL Server, and Sybase SQL
>>> >> Anywhere.
>>> >>
>>> >> On the other hand, there seems to be no difference between executing
>>> >> INSERT IGNORE and INSERT .. ON DUPLICATE KEY UPDATE SET pk = pk, where
>>> >> the UPDATE part is effectively optimised away in a simple test by this
>>> >> Stack Overflow user:
>>> >>
>>> >> http://stackoverflow.com/a/7853634/521799
>>> >>
>>> >> So, INSERT IGNORE could be rendered "as is" for MySQL, and simulated
>>> >> for CUBRID (Which has the ON DUPLICATE KEY UPDATE clause), DB2,
>>> >> HSQLDB, Oracle, SQL Server, Sybase SQL Anywhere (which have the MERGE
>>> >> statement)
>>> >>
>>> >> Any other opinions welcome!
>>> >>
>>> >> Cheers
>>> >> Lukas
>>> >>
>>> >> 2012/4/10 name256 <[email protected]>:
>>> >> > Hi,
>>> >> >
>>> >> > I am a newbie to JOOQ. I was wondering whether someone has been able
>>> >> > to
>>> >> > implement an implementation of insert ignore for the MYSQLFactory.
>>> >> > Kindly
>>> >> > let me know. I would't mind a guide to doing this myself as well as
>>> >> > it
>>> >> > will
>>> >> > give me a better insight into JOOQ.
>>> >> >
>>> >> > Regards.
>>> >> >
>>> >> > Abel
>>
>>
>> On Tuesday, April 10, 2012 2:28:47 PM UTC+3, Lukas Eder wrote:
>>>
>>> Hello Abel,
>>>
>>> > [...] if I had the right guide I can try to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>>
>>> OK, very nice. So the new method would probably be called
>>> Factory.insertIgnore(...), and it would set a new "ignore" flag in
>>> InsertQueryImpl. If you could try to make this work for MySQL, it
>>> would be great. I can then take over and simulate this for other
>>> dialects.
>>>
>>> Cheers
>>> Lukas
>>>
>>> 2012/4/10 name256 <[email protected]>:
>>> > Hi.
>>> >
>>> > Many thanks for your quick reply. I am currently working on a project
>>> > that I
>>> > am sure will benefit from the many features that JOOQ has to offer.
>>> > Challenge is the "INSERT IGNORE" implementation is integral to the
>>> > success
>>> > of this project (I am thinking of changing the implementation from raw
>>> > jdbc
>>> > to JOOQ) and that is why I felt that if I had the right guide I can try
>>> > to
>>> > do an implementation of this functionality. I will use your suggestions
>>> > as a
>>> > guide and will get back to you as I progress along.
>>> >
>>> > I have also been looking at the implementation of
>>> >  onDuplicateKeyUpdate() to
>>> > see whether I can make some headway on its implementation (no luck so
>>> > far).
>>> > I shall let you know how I am getting along in the coming days.
>>> >
>>> > Regards
>>> >
>>> > Abel
>>> >
>>> > On Tuesday, April 10, 2012 1:13:51 PM UTC+3, Lukas Eder wrote:
>>> >>
>>> >> Hello Abel,
>>> >>
>>> >> Good idea, and thanks for the offer of implementing this. I'll track
>>> >> this idea as feature request #1295:
>>> >> https://sourceforge.net/apps/trac/jooq/ticket/1295
>>> >>
>>> >> For better maintainability, I would prefer if such DSL features
>>> >> wouldn't be implemented in dialect-specific factories, but in the
>>> >> global Factory with an appropriate org.jooq.Support annotation to
>>> >> indicate the dialects supporting this clause. Specifically, MySQL's
>>> >> INSERT IGNORE clause could be simulated using the SQL:2003 standard
>>> >> MERGE statement in DB2, HSQLDB, Oracle, SQL Server, and Sybase SQL
>>> >> Anywhere.
>>> >>
>>> >> On the other hand, there seems to be no difference between executing
>>> >> INSERT IGNORE and INSERT .. ON DUPLICATE KEY UPDATE SET pk = pk, where
>>> >> the UPDATE part is effectively optimised away in a simple test by this
>>> >> Stack Overflow user:
>>> >>
>>> >> http://stackoverflow.com/a/7853634/521799
>>> >>
>>> >> So, INSERT IGNORE could be rendered "as is" for MySQL, and simulated
>>> >> for CUBRID (Which has the ON DUPLICATE KEY UPDATE clause), DB2,
>>> >> HSQLDB, Oracle, SQL Server, Sybase SQL Anywhere (which have the MERGE
>>> >> statement)
>>> >>
>>> >> Any other opinions welcome!
>>> >>
>>> >> Cheers
>>> >> Lukas
>>> >>
>>> >> 2012/4/10 name256 <[email protected]>:
>>> >> > Hi,
>>> >> >
>>> >> > I am a newbie to JOOQ. I was wondering whether someone has been able
>>> >> > to
>>> >> > implement an implementation of insert ignore for the MYSQLFactory.
>>> >> > Kindly
>>> >> > let me know. I would't mind a guide to doing this myself as well as
>>> >> > it
>>> >> > will
>>> >> > give me a better insight into JOOQ.
>>> >> >
>>> >> > Regards.
>>> >> >
>>> >> > Abel
>

Reply via email to