[go: up one dir, main page]

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

mysql: insert when primary key is not auto_increment #80

Open
Hajneej opened this issue Jul 22, 2015 · 2 comments · May be fixed by #102
Open

mysql: insert when primary key is not auto_increment #80

Hajneej opened this issue Jul 22, 2015 · 2 comments · May be fixed by #102

Comments

@Hajneej
Copy link
Contributor
Hajneej commented Jul 22, 2015

When inserting record to table with primary key column without auto_increment, the result of operation is false. The reason is that it is not able to refetch data. It is because the current solution is relying on LAST_INSERT_ID() sql query, which is working only for auto_increment columns (docs).

Proposed solution
When table has not primary key with auto_increment, it has to be in data passed to insert method. So the solution should be that when the primary key is already set, no getLastInsertId method is needed to be called and refetch can use the primary id from data.

@matej21
Copy link
Contributor
matej21 commented Jul 22, 2015

Duplicate: #41

Can you send PR? :)

@Hajneej
Copy link
Contributor Author
Hajneej commented Jul 22, 2015

sorry for duplicate, I have to be blind or something... Ok, I will send PR for that issue

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