You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a problem similar to a previously closed issue (#204). However, in my use case, I need to execute arbitrary select-SQL and generate a vector of maps, where each map represents a row with column name/value pairs.
Problem Description:
The issue arises because the statement is mutably borrowed during the time when column names need to be accessed.
Environment:
DuckDB version: { version = "0.9.2", features = ["json"] }
Rust version: 1.71.1 (eb26296b5 2023-08-03)
OS: Ubuntu 22.04
Could you suggest a workaround for this issue? Additionally, is this behavior intentional for reasons I might not be aware of?
Thank you for your assistance and for maintaining this project.
The text was updated successfully, but these errors were encountered:
ravi-nallappan
changed the title
Issue with Immutable Borrow of Statement in DuckDB when Accessing Column Names (Option::unwrap())
Issue with Mutable Borrow of Statement when Accessing Column Names (Option::unwrap())
Jan 5, 2024
I ran into this exact issue. There's a catch-22 if you don't know the number of columns in advance. You can't get the column count without executing the query, and you can't execute the query without knowing the column count (because you don't know which columns to get).
The trick is to call row.as_ref().column_names() once you matched single value with something like match row.next()... prior to getting column names. Hope it helps!
I encountered a problem similar to a previously closed issue (#204). However, in my use case, I need to execute arbitrary select-SQL and generate a vector of maps, where each map represents a row with column name/value pairs.
Code Snippet:
Problem Description:
The issue arises because the statement is mutably borrowed during the time when column names need to be accessed.
Environment:
{ version = "0.9.2", features = ["json"] }
Could you suggest a workaround for this issue? Additionally, is this behavior intentional for reasons I might not be aware of?
Thank you for your assistance and for maintaining this project.
The text was updated successfully, but these errors were encountered: