mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-06-25 21:11:32 +00:00
Implement sqlite3_column_name and helper function to return column names
This commit is contained in:
@ -137,11 +137,15 @@ fn cursor_workflow() {
|
||||
#[test]
|
||||
fn statement_columns() {
|
||||
let connection = setup_users(":memory:");
|
||||
let statement = "SELECT * FROM users";
|
||||
let statement = "SELECT id, name, age, photo as user_photo FROM users";
|
||||
let mut statement = ok!(connection.prepare(statement));
|
||||
|
||||
assert_eq!(statement.columns(), 4);
|
||||
|
||||
let column_names = statement.column_names();
|
||||
assert_eq!(column_names, vec!["id", "name", "age", "user_photo"]);
|
||||
assert_eq!("user_photo", statement.column_name(3));
|
||||
|
||||
assert_eq!(ok!(statement.next()), State::Row);
|
||||
|
||||
assert_eq!(statement.columns(), 4);
|
||||
|
Reference in New Issue
Block a user