database
database copied to clipboard
mysql: insert when primary key is not auto_increment
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.
Duplicate: #41
Can you send PR? :)
sorry for duplicate, I have to be blind or something... Ok, I will send PR for that issue