New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated insertion of values. #41

Closed
PeterWolters opened this Issue Jun 19, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@PeterWolters

PeterWolters commented Jun 19, 2015

Goodafternoon,

First of all, thank you for this superb framework.

It would be a nice addition if the framework supports some kind of bulk insertion mechanism.

See example below:
Operation INSERT_NAME_1K = insertInto(TRAN)
.withGeneratedValue("ID", ValueGenerators.sequence().startingAt(1L).incrementingBy(1))
.columns("NAME", "ADDRESS")
.values("Donald", "Duckstad")
.valuesToRepeat("Donald", "Donald").times(1000)
.build();

@jnizet

This comment has been minimized.

Show comment
Hide comment
@jnizet

jnizet Jun 19, 2015

Member

Well, it does. Not with that syntax of course, but using a simple loop:

Insert.Builder builder = insertInto(TRAN)
    .withGeneratedValue("ID", ValueGenerators.sequence().startingAt(1L).incrementingBy(1))
    .columns("NAME", "ADDRESS")
    .values("Donald", "Duckstad");
for (int i = 0; i < 1000; i++) {
    builder.values("Donald", "Donald");
}
Operation INSERT_NAME_1K = builder.build();

Your suggested syntax is of course prettier, although less flexible. Do you have to do that often? I personally had to do that once, and thus didn't really feel the need for such a feature. But if you can convince me it's useful, why not.

Member

jnizet commented Jun 19, 2015

Well, it does. Not with that syntax of course, but using a simple loop:

Insert.Builder builder = insertInto(TRAN)
    .withGeneratedValue("ID", ValueGenerators.sequence().startingAt(1L).incrementingBy(1))
    .columns("NAME", "ADDRESS")
    .values("Donald", "Duckstad");
for (int i = 0; i < 1000; i++) {
    builder.values("Donald", "Donald");
}
Operation INSERT_NAME_1K = builder.build();

Your suggested syntax is of course prettier, although less flexible. Do you have to do that often? I personally had to do that once, and thus didn't really feel the need for such a feature. But if you can convince me it's useful, why not.

@PeterWolters

This comment has been minimized.

Show comment
Hide comment
@PeterWolters

PeterWolters Jun 19, 2015

I agree with you that the desired requirement can be be fulfilled with a for loop.

For readability and maintainability reasons I think its a nice feature to have. You can construct with one statement the desired operation without using any, ugly, for loop and writing extra code.

I hope this convinces you :)

Peter.

PeterWolters commented Jun 19, 2015

I agree with you that the desired requirement can be be fulfilled with a for loop.

For readability and maintainability reasons I think its a nice feature to have. You can construct with one statement the desired operation without using any, ugly, for loop and writing extra code.

I hope this convinces you :)

Peter.

@jnizet jnizet closed this in db11e04 Jun 26, 2015

@jnizet

This comment has been minimized.

Show comment
Hide comment
@jnizet

jnizet Jun 26, 2015

Member

@PeterWolters FYI, I just release version 1.6.0, containing this feature, which should be available soon in Maven central. See http://dbsetup.ninja-squad.com/release-notes.html

Member

jnizet commented Jun 26, 2015

@PeterWolters FYI, I just release version 1.6.0, containing this feature, which should be available soon in Maven central. See http://dbsetup.ninja-squad.com/release-notes.html

@PeterWolters

This comment has been minimized.

Show comment
Hide comment
@PeterWolters

PeterWolters Jun 29, 2015

@jnizet , Glad to see that my arguments convinced you! Thank you very much for implementing this neat feature!

Kind regards,

Peter Wolters.

PeterWolters commented Jun 29, 2015

@jnizet , Glad to see that my arguments convinced you! Thank you very much for implementing this neat feature!

Kind regards,

Peter Wolters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment