Fix raw get() api to using the Result-based api

rusqlite must have just returned the data itself rather than relying on
the Result type to communicate failures to callers.  Fixing that here,
albeit in a fragile way.
This commit is contained in:
Conrad Dean 2019-07-22 08:36:32 -04:00
parent ff48f6369a
commit cdfd1f6b30

View file

@ -369,14 +369,14 @@ impl TypedIndex {
match self { match self {
&Known(value_index, value_type) => { &Known(value_index, value_type) => {
let v: rusqlite::types::Value = row.get(value_index); let v: rusqlite::types::Value = row.get(value_index).unwrap();
TypedValue::from_sql_value_pair(v, value_type) TypedValue::from_sql_value_pair(v, value_type)
.map(|v| v.into()) .map(|v| v.into())
.map_err(|e| e.into()) .map_err(|e| e.into())
}, },
&Unknown(value_index, type_index) => { &Unknown(value_index, type_index) => {
let v: rusqlite::types::Value = row.get(value_index); let v: rusqlite::types::Value = row.get(value_index).unwrap();
let value_type_tag: i32 = row.get(type_index); let value_type_tag: i32 = row.get(type_index).unwrap();
TypedValue::from_sql_value_pair(v, value_type_tag) TypedValue::from_sql_value_pair(v, value_type_tag)
.map(|v| v.into()) .map(|v| v.into())
.map_err(|e| e.into()) .map_err(|e| e.into())