Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors on Statement::column_* methods #204

Closed
goosetherumfoodle opened this issue Aug 30, 2023 · 2 comments
Closed

errors on Statement::column_* methods #204

goosetherumfoodle opened this issue Aug 30, 2023 · 2 comments

Comments

@goosetherumfoodle
Copy link

goosetherumfoodle commented Aug 30, 2023

I'm on 0.8.1, using the bundled db. I can create tables and query rows, but all of the column methods fail.

Starting with the basic example, everything works, but if I stick the following at the end:

    let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
    let col_count = stmt.column_count();
    println!("COL COUNT: {}", col_count);

I get an error with the following backtrace:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/duckdb-0.8.1/src/raw_statement.rs:70:21

I get the same for the other column_* methods.

@Mause
Copy link
Member

Mause commented Aug 31, 2023

Have you tried executing the query before retrieving the number of columns?

@goosetherumfoodle
Copy link
Author

@Mause that does work, thanks! The documentation mentions needing to step first, but doesn't mention having to execute first...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants