{"action":"created","issue":{"url":"https://api.github.com/repos/jOOQ/jOOQ/issues/6604","repository_url":"https://api.github.com/repos/jOOQ/jOOQ","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/6604/labels{/name}","comments_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/6604/comments","events_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/6604/events","html_url":"https://github.com/jOOQ/jOOQ/issues/6604","id":259819485,"node_id":"MDU6SXNzdWUyNTk4MTk0ODU=","number":6604,"title":"Improve INSERT .. VALUES API for dynamic multi-row inserts","user":{"login":"lukaseder","id":734593,"node_id":"MDQ6VXNlcjczNDU5Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/734593?v=4","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"labels":[{"id":9935131,"node_id":"MDU6TGFiZWw5OTM1MTMx","url":"https://api.github.com/repos/jOOQ/jOOQ/labels/C:%20Functionality","name":"C: Functionality","color":"0000aa","default":false},{"id":9935166,"node_id":"MDU6TGFiZWw5OTM1MTY2","url":"https://api.github.com/repos/jOOQ/jOOQ/labels/P:%20Medium","name":"P: Medium","color":"ffaaaa","default":false},{"id":9935128,"node_id":"MDU6TGFiZWw5OTM1MTI4","url":"https://api.github.com/repos/jOOQ/jOOQ/labels/T:%20Enhancement","name":"T: Enhancement","color":"cccccc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/152","html_url":"https://github.com/jOOQ/jOOQ/milestone/152","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/152/labels","id":2832459,"node_id":"MDk6TWlsZXN0b25lMjgzMjQ1OQ==","number":152,"title":"Version 3.12.0","description":"","creator":{"login":"lukaseder","id":734593,"node_id":"MDQ6VXNlcjczNDU5Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/734593?v=4","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"open_issues":819,"closed_issues":175,"state":"open","created_at":"2017-10-12T08:16:15Z","updated_at":"2018-09-24T10:42:24Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2017-09-22T13:43:57Z","updated_at":"2018-09-25T03:46:45Z","closed_at":null,"author_association":"MEMBER","body":"The `INSERT .. VALUES` API is quite useful for multi-row inserts as well:\r\n\r\n```java\r\nctx.insertInto(T)\r\n   .columns(T.C1, T.C2, T.C3)\r\n   .values(1, 2, 3)\r\n   .values(4, 5, 6)\r\n   .values(7, 8, 9)\r\n   .execute();\r\n```\r\n\r\nBut that works well only for constant numbers of rows. When the rows are determined dynamically, users have to assign the `InsertValuesStep` type to a local variable and loop through their rows, copying values to the DSL API, which is ugly.\r\n\r\nWe should have similar API like `DSL.values()` for the `INSERT` statement as well. Hypothetical syntax:\r\n\r\n```java\r\nInteger[][] values = {{ 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }};\r\nctx.insertInto(T)\r\n   .columns(T.C1, T.C2, T.C3)\r\n   .values(values)\r\n   .execute();\r\n```\r\n\r\nThe method name probably cannot be overloaded easily, because of the existing `values(Collection<?>)` overload.\r\n\r\nSeveral variants of this new API will be made available, supporting arrays, collections, etc, perhaps taking inspiration from the `Loader` API."},"comment":{"url":"https://api.github.com/repos/jOOQ/jOOQ/issues/comments/424198176","html_url":"https://github.com/jOOQ/jOOQ/issues/6604#issuecomment-424198176","issue_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/6604","id":424198176,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDE5ODE3Ng==","user":{"login":"psilent","id":6934708,"node_id":"MDQ6VXNlcjY5MzQ3MDg=","avatar_url":"https://avatars2.githubusercontent.com/u/6934708?v=4","gravatar_id":"","url":"https://api.github.com/users/psilent","html_url":"https://github.com/psilent","followers_url":"https://api.github.com/users/psilent/followers","following_url":"https://api.github.com/users/psilent/following{/other_user}","gists_url":"https://api.github.com/users/psilent/gists{/gist_id}","starred_url":"https://api.github.com/users/psilent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psilent/subscriptions","organizations_url":"https://api.github.com/users/psilent/orgs","repos_url":"https://api.github.com/users/psilent/repos","events_url":"https://api.github.com/users/psilent/events{/privacy}","received_events_url":"https://api.github.com/users/psilent/received_events","type":"User","site_admin":false},"created_at":"2018-09-25T03:46:45Z","updated_at":"2018-09-25T03:46:45Z","author_association":"NONE","body":"Looking forward to this feature. I'm also trying to insert a collection of records. I'm using the approach assigning the InsertValuesStep type to a local variable and looping through rows. This gives me significantly better performance over the loader API or .batchInsert() (I'm not sure why) but I will occasionally run into an error with MySQL of \"packet size too large\". I haven't been able to find a jOOQ option for determining this size limit ahead of time and restricting the number of times I call .values() so instead I'm calling .execute() in a try block and using a smaller batch size when I get that size exception. I understand I can configure max_allowed_packet on the server but that just pushes the problem back. Any suggestions or will this have to do until this feature is implemented?"}}
{"actor":{"display_login":"psilent"}}