1
0
mirror of https://github.com/fluencelabs/sqlite-wasm-connector synced 2025-03-15 06:20:50 +00:00

Add a failing test for reading columns with NULLs

This commit is contained in:
Ivan Ukhov 2019-05-22 07:40:48 +02:00
parent fa17cd620e
commit f8f737bf2f

@ -72,6 +72,29 @@ fn connection_set_busy_handler() {
}
}
#[test]
fn cursor_read() {
let connection = setup_users(":memory:");
ok!(connection.execute("INSERT INTO users VALUES (2, 'Bob', NULL, NULL)"));
let statement = "SELECT id, age FROM users ORDER BY 1 DESC";
let statement = ok!(connection.prepare(statement));
let mut count = 0;
let mut cursor = statement.cursor();
while let Some(row) = ok!(cursor.next()) {
let id = row[0].as_integer().unwrap();
if id == 1 {
assert_eq!(row[1].as_float().unwrap(), 42.69);
} else if id == 2 {
assert_eq!(row[1].as_float().unwrap_or(69.42), 69.42);
} else {
assert!(false);
}
count += 1;
}
assert_eq!(count, 2);
}
#[test]
fn cursor_wildcard_with_binding() {
let connection = setup_english(":memory:");