Client APIs
API Reference Overview
Executes a SQL query within a connection and stores the full (materialized) result in the out_result pointer.
If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling
`duckdb_result_error`.  
Note that after running `duckdb_query`, `duckdb_destroy_result` must be called on the result object even if the
query fails, otherwise the error stored within the result will not be freed correctly.  
###### Syntax {#docs:api:c:api::syntax}  
```c
duckdb_state duckdb_query(
duckdb_connection connection,
const char *query,
duckdb_result *out_result
);
```  
###### Parameters {#docs:api:c:api::parameters}  
* `connection`: The connection to perform the query in.
* `query`: The SQL query to run.
* `out_result`: The query result.  
###### Return Value {#docs:api:c:api::return-value}  
`DuckDBSuccess` on success or `DuckDBError` on failure.  
<br>