sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

Fn selector::one

Open zbinhazzaa opened this issue 3 years ago • 4 comments

I was try to use sea_orm::Selector::one The return of the function is Result<Option<S::Item>, DbErr> I expected if the database not exist or record is not found then i will have DbErr enum which will describe the error, but the actual behavior i always i get Ok(None) the database is SQLite.

zbinhazzaa avatar Feb 18 '22 17:02 zbinhazzaa

Hey @zbinhazzaa, welcome! I wonder if you are connecting to an in-memory SQLite? It will be created on-the-fly without the need to initialize. Hence, no errors will be thrown. Also, from what I understand, SQLite does not support multiple databases / schemas. It only contains one database / schema and with multiple tables in it.

billy1624 avatar Mar 01 '22 09:03 billy1624

um... we seem to have caught the error and suppressed it somewhere

tyt2y3 avatar Mar 24 '22 14:03 tyt2y3

hey, @billy1624 I was trying different cases to get DbErr but this does not work well, for example when a record is not found. @tyt2y3 Is the error was as I explained or something else?

zbinhazzaa avatar Mar 24 '22 16:03 zbinhazzaa

Hey @zbinhazzaa, sorry for the delay. For select, we won't errors when the select return none. But for update one we do thrown error when the updating row doesn't exist.

billy1624 avatar Jul 11 '22 09:07 billy1624

Reason to close: not having an reproducible example

tyt2y3 avatar Feb 21 '23 10:02 tyt2y3