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

Can we use multiple insert statement in FaaPz / PDO #104

Closed
ParthWeb opened this issue Jun 27, 2018 · 6 comments
Closed

Can we use multiple insert statement in FaaPz / PDO #104

ParthWeb opened this issue Jun 27, 2018 · 6 comments
Assignees
Milestone

Comments

@ParthWeb
Copy link

ParthWeb commented Jun 27, 2018

INSERT INTO employee(eid, ename, email, ebirthdate) VALUES (null,'test','test1@*.com',1530101800), (null,'test','test@.com',1530101800)

Can we create statement in slim pdo for multiple insert in one single query

@lkp186
Copy link

lkp186 commented Mar 25, 2019

I also want to know

@kwhat
Copy link
Collaborator

kwhat commented Jun 28, 2019

This is not supported yet, but probably should be.

@kwhat kwhat self-assigned this Jun 28, 2019
@kwhat kwhat added this to the v2.0.0 milestone Jun 28, 2019
@kwhat
Copy link
Collaborator

kwhat commented Nov 5, 2019

I am thinking about how to implement this and would like to get some feedback from you. I am thinking about modifying the Insert::values(...) method to append to a values array instead of replacing it. The usage would be something like $pdo->insert("table")->columns("col1", "col2")->values(1, 2)->values(3, 4);. The only drawback to this approach is that the values would be immutable. Basically, if you added values to the insert object, you cannot remove those values.

@Caffe1neAdd1ct
Copy link

Might be useful to accept an iterator or array of arrays [[1,2], [3,4]] however this could be left to the end developer to loop on the $pdo instance calling ->values([1,2])

@kwhat kwhat modified the milestones: v2.0.0, v2.1.0 Dec 5, 2019
@kwhat kwhat changed the title Can we use multiple insert statement in slim PDO Can we use multiple insert statement in FaaPz / PDO Dec 18, 2019
@kwhat
Copy link
Collaborator

kwhat commented Dec 18, 2019

I have decided to support the multi-dimensional array approach as it is more inline with similar method usage and it is backward compatible. I will be pushing changes to the 2.1 branch tonight. I will tag this issue in vcs.

@kwhat
Copy link
Collaborator

kwhat commented Dec 18, 2019

This change requires some documentation updates... Anyone want to volunteer?

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

No branches or pull requests

4 participants