Skip to content

Supports sqlite3 #169

@qnkhuat

Description

@qnkhuat

Helpers that return pk or instance don't work with sqlite3. This is because the sqlite3 JDBC does not return pk when :return-key is set to true but it'll return the last_insert_rowid() (src).

The best way to fix this is to use the RETURNING clause as last_insert_rowid is not guaranteed to be the row id we inserted.

From the doc

returns the rowid of the most recent successful INSERT into a rowid table

Also, this will not work for WITHOUT ROWID tables.

Another advantage of using RETURNING clause is that we don't have to do another DB call to select the instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions