We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In SQLite3, we can use rowid pseudo-column and last_insert_rowid() function to query the last inserted record.
rowid
last_insert_rowid()
To build such a query with HRR, I tried
lastInsertRecord :: Table r -> Pi r v -> Relation () v lastInsertRecord tab selector = relation $ do record <- query $ table tab let rowid = unsafeProjectSql "rowid" last_rowid = unsafeProjectSql "last_insert_rowid()" wheres $ rowid .=. last_rowid return (record ! selector)
This gives me a Relation like:
Relation
>>> lastInsertRecord tableOfSample id' SELECT ALL T0.sample_id AS f0, T0.val AS f1 FROM MAIN.sample T0 WHERE (rowid = last_insert_rowid())
This works. However, because rowid is a pseudo-column of sample table, it should be T0.rowid in the above query.
sample
T0.rowid
So, is there any way to specify rowid as a pseudo-column of a table?
The text was updated successfully, but these errors were encountered:
Thanks for your reporting.
I added the support of Register monad for INSERT statement in be1e318 , 7d35bd3 and 002bbcb .
And, I updated the example of constant INSERT using Register monad. ( bd2455f )
Sorry, something went wrong.
Great work! Thank you.
But I think the commits you mentioned are related to #20. Not this issue.
No branches or pull requests
In SQLite3, we can use
rowid
pseudo-column andlast_insert_rowid()
function to query the last inserted record.To build such a query with HRR, I tried
This gives me a
Relation
like:This works. However, because
rowid
is a pseudo-column ofsample
table, it should beT0.rowid
in the above query.So, is there any way to specify
rowid
as a pseudo-column of a table?The text was updated successfully, but these errors were encountered: