Skip to content

mysql: insert when primary key is not auto_increment #80

Open

Description

@Hajneej

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.

Activity

  1. matej21 commented on Jul 22, 2015

    @matej21
    Contributor

    Duplicate: #41

    Can you send PR? :)

  2. Hajneej commented on Jul 22, 2015

    @Hajneej
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions