diff --git a/scylla/src/transport/session_test.rs b/scylla/src/transport/session_test.rs index 0d73a2ac7e..175b87a9a0 100644 --- a/scylla/src/transport/session_test.rs +++ b/scylla/src/transport/session_test.rs @@ -44,19 +44,24 @@ async fn test_unprepared_statement() { .await .unwrap(); - let rs = session + let query_result = session .query("SELECT a, b, c FROM ks.t", &[]) .await - .unwrap() - .rows .unwrap(); + let (a_idx, _) = query_result.get_spec_by_name("a").unwrap(); + let (b_idx, _) = query_result.get_spec_by_name("b").unwrap(); + let (c_idx, _) = query_result.get_spec_by_name("c").unwrap(); + assert!(query_result.get_spec_by_name("d").is_none()); + + let rs = query_result.rows.unwrap(); + let mut results: Vec<(i32, i32, &String)> = rs .iter() .map(|r| { - let a = r.columns[0].as_ref().unwrap().as_int().unwrap(); - let b = r.columns[1].as_ref().unwrap().as_int().unwrap(); - let c = r.columns[2].as_ref().unwrap().as_text().unwrap(); + let a = r.columns[a_idx].as_ref().unwrap().as_int().unwrap(); + let b = r.columns[b_idx].as_ref().unwrap().as_int().unwrap(); + let c = r.columns[c_idx].as_ref().unwrap().as_text().unwrap(); (a, b, c) }) .collect();