[Solved] Mysql exec_first query_first behave differently

Helo, I'm very newbie in rust.
I'm doing some exercises with rust & mysql but I have a problem.
If I get a row from a table with conn.query_first(.....).map(....) work fine
but If try with the same select instruction with conn.exec_first(....).map
I get error:
thread 'main' panicked at 'Couldn't convert Row.
Dump show that the row is correctly read from mysql.

Can you help me?

I sI solved by my self. After a few tests seems that the two function have a different behavior on map mysql double field.
query_first map on f32
exec_first map on f64.

I hope this can help someone else

1 Like

Yes thank you. was getting the same error. been pulling my hair out trying to get it to work and never could have guessed the error was being caused by something that seemed to be doing fine.
Couldn't convert Row { product_id: Int(2), product_code: Bytes("P002"), price: Double(93.99), name: Bytes("Golf clu..") } to type (u64, alloc::string::String, f32, alloc::string::String).
and here i was thinking it had something to do with Bytes("GOLF CLUB") as its type was string. never ever would've guessed that it was f64 all along.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.