mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
bindings/rust: Fix Rows::next() I/O dispatcher handling
The `next()` function needs to be a loop to make sure we actually return rows.
This commit is contained in:
parent
882c5ca168
commit
47e08d34bf
2 changed files with 49 additions and 12 deletions
27
bindings/rust/tests/integration_tests.rs
Normal file
27
bindings/rust/tests/integration_tests.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use limbo::Builder;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_rows_next() {
|
||||
let builder = Builder::new_local(":memory:");
|
||||
let db = builder.build().await.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
conn.execute("CREATE TABLE test (x INTEGER)", ())
|
||||
.await
|
||||
.unwrap();
|
||||
conn.execute("INSERT INTO test (x) VALUES (1)", ())
|
||||
.await
|
||||
.unwrap();
|
||||
conn.execute("INSERT INTO test (x) VALUES (2)", ())
|
||||
.await
|
||||
.unwrap();
|
||||
let mut res = conn.query("SELECT * FROM test", ()).await.unwrap();
|
||||
assert_eq!(
|
||||
res.next().await.unwrap().unwrap().get_value(0).unwrap(),
|
||||
1.into()
|
||||
);
|
||||
assert_eq!(
|
||||
res.next().await.unwrap().unwrap().get_value(0).unwrap(),
|
||||
2.into()
|
||||
);
|
||||
assert!(res.next().await.unwrap().is_none());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue