pub unsafe fn query(
con: duckdb_connection,
sql: &str,
) -> Result<QueryResult, ExtensionError>Expand description
Runs sql on con and returns the materialised result.
§Several statements in one string
sql may hold several ;-separated statements, and DuckDB runs every
one of them, in order. The result returned is the first statement that
produces rows (a SELECT, …), or — when none does — the last statement’s.
Results of later row-producing statements are discarded (DuckDB chains
them where the C API cannot reach them). The first statement that fails
fails the call, but the statements before it have already run and, outside
an explicit transaction, committed. A string with no statement at all
("", ";") succeeds with an empty result.
§Errors
Returns ExtensionError carrying DuckDB’s own message if a statement
fails, or if sql contains an interior NUL byte.
§Safety
con must be a valid, open duckdb_connection.