Function libduckdb_sys::duckdb_column_data [−][src]
pub unsafe extern "C" fn duckdb_column_data(
result: *mut duckdb_result,
col: idx_t
) -> *mut c_void
Expand description
Returns the data of a specific column of a result in columnar format. This is the fastest way of accessing data in a
query result, as no conversion or type checking must be performed (outside of the original switch). If performance
is a concern, it is recommended to use this API over the duckdb_value
functions.
The function returns a dense array which contains the result data. The exact type stored in the array depends on the
corresponding duckdb_type (as provided by duckdb_column_type
). For the exact type by which the data should be
accessed, see the comments in the types section or the DUCKDB_TYPE
enum.
For example, for a column of type DUCKDB_TYPE_INTEGER
, rows can be accessed in the following manner:
int32_t *data = (int32_t *) duckdb_column_data(&result, 0);
printf("Data for row %d: %d\n", row, data[row]);
result: The result object to fetch the column data from. col: The column index. returns: The column data of the specified column.