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

Supports sqlite3 #169

Open
qnkhuat opened this issue Apr 13, 2024 · 0 comments
Open

Supports sqlite3 #169

qnkhuat opened this issue Apr 13, 2024 · 0 comments

Comments

@qnkhuat
Copy link
Contributor

qnkhuat commented Apr 13, 2024

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.

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

No branches or pull requests

1 participant