Skip to content
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

Table.batchInsert constrained by Any #847

Closed
brezinajn opened this issue Mar 26, 2020 · 3 comments · Fixed by #1040
Closed

Table.batchInsert constrained by Any #847

brezinajn opened this issue Mar 26, 2020 · 3 comments · Fixed by #1040

Comments

@brezinajn
Copy link

in org.jetbrains.exposed.sql Queries.kt there is fun <T:Table, E:Any> T.batchInsert(data: Iterable<E>, ignore: Boolean = false, body: BatchInsertStatement.(E)->Unit): List<ResultRow>. Is there any reason why E is bound to Any? It doesn't seem to serve any purpose.

@Tapac
Copy link
Contributor

Tapac commented Mar 26, 2020

Could you clarify your expectations? You expect E:Any?? How you could insert null into table?

@brezinajn
Copy link
Author

OK, so the Any constraint is to guard against null cases. Totally missed that one :D Thanks for clarification.

@brezinajn
Copy link
Author

Technically speaking. If you are able to provide meaningful insert statement for null value, handling the null case should be allowed. In same manner as here is no not-null constraint for plain insert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants