Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions stdlib/src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,15 @@ impl StdlibRegistry {
.collect();

let mut rows = Vec::new();

let mut template = IndexMap::with_capacity(col_count);
for name in &col_names {
template.insert(name.clone(), RuntimeValue::Null);
}

let row_iter = stmt
.query_map(rusqlite::params_from_iter(params), |row| {
let mut map = IndexMap::with_capacity(col_count);
let mut map = template.clone();
for i in 0..col_count {
let val = row.get_ref_unwrap(i);
let rt_val = match val {
Expand All @@ -207,7 +213,9 @@ impl StdlibRegistry {
)
}
};
map.insert(col_names[i].clone(), rt_val);
if let Some((_, v)) = map.get_index_mut(i) {
*v = rt_val;
}
}
Ok(map)
})
Expand Down
Loading
Loading