Result type for single column query #140
-
The result type of
|
Beta Was this translation helpful? Give feedback.
Answered by
fernandobatels
Dec 23, 2022
Replies: 1 comment 1 reply
-
let rows: Vec<(i32,)> = conn.query("select 1+1 from RDB$DATABASE", ())?; You can also use the query_first if you only need one row: let (sum,): (i32,) = conn.query_first("select 1+1 from RDB$DATABASE", ())?.unwrap(); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zhus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(i32)
is not a tuple, you need use a extra,
when you have a single column to force a tuple:You can also use the query_first if you only need one row: