![]() Should no longer skip sqlite - they (appear to) work out of the box. IĬouldn't figure out what was going on here. The trait bound 'Sqlite: SupportsDefaultKeyword' is not satisfied. The tests concerning RETURNING for insertĪppear to rest on support for the DEFAULT keyword, and fail with error: You'll want the impl in your code, naturally (maybe behind some Understanding of your repo, apologies in advance □) So here's what I think needs to be done (based on my very cursory I've added the line we discussed above ( impl SupportsReturningClause for Sqlite ) to diesel/src/sqlite/backend.rs,Īnd as best as I can tell, it mostly works! □ Ok, thanks for the kind encouragement! I'm very much a rust beginner, so please let me know if I'm causing more trouble than it's worth, but as noted above I would love to help get this running. Maybe this workarkound could be exposed somewhere in the docs (for LoadDsl or SqliteConnection)? Also, I have to admit, I don't know how how to execute raw sql query in diesel, searching for raw yields no results. I've just learned that you can execute the raw query SELECT last_insert_rowid().I guess that would require some architectural changes in diesel, but on the other hand, it's the simplest solution wrt porting code between backends. Make the get_result work for sqlite by pulling data from the structs that are inserted.I actually don't know diesel well enough to understand whether this is possible by appropriate implementations of Queryable. Make the get_result work on sqlite only on structs containing just the id.This solution is nice as it allows writing backend-agnostic code. ![]() Postgres backend could just call get_result. Create a trait method for getting the id of the insert/update and implement it for all the backends.The connection is not Sync so it shouldn't be a problem. Just reexport the last_insert_rowid for SqliteConnection.Without that feature, the sqlite backend is quite unusable for me. Sqlite exposes last_insert_rowid but it's not reexported by diesel. Postgres backend allows to do that using RETURING clause via the get_result method. ![]() It is a really crucial feature to be able to obtain an id an inserted object.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |