How do I insert multiple rows in one query? #81

Open
opened 2021-04-02 11:53:30 +00:00 by ancientaexa · 2 comments

I want to insert rows like so:

INSERT INTO tbl_name (a,b,c)
    VALUES(1,2,3), (4,5,6), (7,8,9);

Is there a way to do that with that query builder?

I tried both: builder.Insert(buidlerEq{...}).Insert(buidlerEq{...}) and builder.Insert(buidlerEq{...}, buidlerEq{...}) but they both result in

INSERT INTO tbl_name (a,b,c,a,b,c)VALUES(1,2,3,4,5,6)

instead of

INSERT INTO tbl_name (a,b,c)VALUES(1,2,3),(4,5,6)
I want to insert rows like so: ``` INSERT INTO tbl_name (a,b,c) VALUES(1,2,3), (4,5,6), (7,8,9); ``` Is there a way to do that with that query builder? I tried both: `builder.Insert(buidlerEq{...}).Insert(buidlerEq{...})` and `builder.Insert(buidlerEq{...}, buidlerEq{...})` but they both result in ``` INSERT INTO tbl_name (a,b,c,a,b,c)VALUES(1,2,3,4,5,6) ``` instead of ``` INSERT INTO tbl_name (a,b,c)VALUES(1,2,3),(4,5,6) ```
lunny added the
proposed
label 2021-04-02 16:01:44 +00:00
Owner

I think a better feature is to support

builder.Insert(buidlerEq{...}).
Insert(buidlerEq{...})
I think a better feature is to support ```go builder.Insert(buidlerEq{...}). Insert(buidlerEq{...}) ```
lunny added this to the (deleted) milestone 2021-04-02 16:03:53 +00:00

同样需求这个

Also need this

同样需求这个 Also need this
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/builder#81
No description provided.