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

column_count can panic #261

Open
Timmmm opened this issue Feb 8, 2024 · 0 comments
Open

column_count can panic #261

Timmmm opened this issue Feb 8, 2024 · 0 comments

Comments

@Timmmm
Copy link

Timmmm commented Feb 8, 2024

Statement::column_count() just returns a usize, yet it can easily fail. In that case it panics because it calls result_unwrap() as shown by this backtrace.

   4: duckdb::raw_statement::RawStatement::result_unwrap
             at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/duckdb-0.9.2/src/raw_statement.rs:72:9
   5: duckdb::raw_statement::RawStatement::column_count
             at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/duckdb-0.9.2/src/raw_statement.rs:168:49
   6: duckdb::column::<impl duckdb::statement::Statement>::column_count
             at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/duckdb-0.9.2/src/column.rs:49:9

All I did was this:

    let mut stmt = conn.prepare(&sql)?;
    let cols = stmt.column_count();

There's no indication that that will panic!

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

1 participant