duckdb-ffi-1.4.1.2: Haskell FFI bindings for DuckDB
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.DuckDB.FFI.Deprecated

Description

This module gathers bindings that DuckDB has marked with a deprecation notice so downstream code can opt-in to the legacy surface separately from the main Database.DuckDB.FFI module.

Synopsis

Documentation

c_duckdb_appender_error :: DuckDBAppender -> IO CString Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release. Use duckdb_appender_error_data instead.

Returns the error message associated with the appender. If the appender has no error message, this returns nullptr instead.

The error message should not be freed. It will be de-allocated when duckdb_appender_destroy is called.

Parameters: * appender: The appender to get the error from.

Returns The error message, or nullptr if there is none.

c_duckdb_query_arrow :: DuckDBConnection -> CString -> Ptr DuckDBArrow -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Executes a SQL query within a connection and stores the full (materialized) result in an arrow structure. If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling duckdb_query_arrow_error.

Note that after running duckdb_query_arrow, duckdb_destroy_arrow must be called on the result object even if the query fails, otherwise the error stored within the result will not be freed correctly.

Parameters: * connection: The connection to perform the query in. * query: The SQL query to run. * out_result: The query result.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_query_arrow_schema :: DuckDBArrow -> Ptr DuckDBArrowSchema -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Fetch the internal arrow schema from the arrow result. Remember to call release on the respective ArrowSchema object.

Parameters: * result: The result to fetch the schema from. * out_schema: The output schema.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_prepared_arrow_schema :: DuckDBPreparedStatement -> Ptr DuckDBArrowSchema -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Fetch the internal arrow schema from the prepared statement. Remember to call release on the respective ArrowSchema object.

Parameters: * prepared: The prepared statement to fetch the schema from. * out_schema: The output schema.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_result_arrow_array :: Ptr DuckDBResult -> DuckDBDataChunk -> Ptr DuckDBArrowArray -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Convert a data chunk into an arrow struct array. Remember to call release on the respective ArrowArray object.

Parameters: * result: The result object the data chunk have been fetched from. * chunk: The data chunk to convert. * out_array: The output array.

These bindings call the wrapper symbol wrapped_duckdb_result_arrow_array but mirror the DuckDB C API semantics of duckdb_result_arrow_array.

c_duckdb_query_arrow_array :: DuckDBArrow -> Ptr DuckDBArrowArray -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Fetch an internal arrow struct array from the arrow result. Remember to call release on the respective ArrowArray object.

This function can be called multiple time to get next chunks, which will free the previous out_array. So consume the out_array before calling this function again.

Parameters: * result: The result to fetch the array from. * out_array: The output array.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_arrow_column_count :: DuckDBArrow -> IO DuckDBIdx Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns the number of columns present in the arrow result object.

Parameters: * result: The result object.

Returns The number of columns present in the result object.

c_duckdb_arrow_row_count :: DuckDBArrow -> IO DuckDBIdx Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns the number of rows present in the arrow result object.

Parameters: * result: The result object.

Returns The number of rows present in the result object.

c_duckdb_arrow_rows_changed :: DuckDBArrow -> IO DuckDBIdx Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns the number of rows changed by the query stored in the arrow result. This is relevant only for INSERTUPDATEDELETE queries. For other queries the rows_changed will be 0.

Parameters: * result: The result object.

Returns The number of rows changed.

c_duckdb_query_arrow_error :: DuckDBArrow -> IO CString Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns the error message contained within the result. The error is only set if duckdb_query_arrow returns DuckDBError.

The error message should not be freed. It will be de-allocated when duckdb_destroy_arrow is called.

Parameters: * result: The result object to fetch the error from.

Returns The error of the result.

c_duckdb_destroy_arrow :: Ptr DuckDBArrow -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Closes the result and de-allocates all memory allocated for the arrow result.

Parameters: * result: The result to destroy.

c_duckdb_destroy_arrow_stream :: Ptr DuckDBArrowStream -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Releases the arrow array stream and de-allocates its memory.

Parameters: * stream_p: The arrow array stream to destroy.

c_duckdb_execute_prepared_arrow :: DuckDBPreparedStatement -> Ptr DuckDBArrow -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Executes the prepared statement with the given bound parameters, and returns an arrow query result. Note that after running duckdb_execute_prepared_arrow, duckdb_destroy_arrow must be called on the result object.

Parameters: * prepared_statement: The prepared statement to execute. * out_result: The query result.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_arrow_scan :: DuckDBConnection -> CString -> DuckDBArrowStream -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Scans the Arrow stream and creates a view with the given name.

Parameters: * connection: The connection on which to execute the scan. * table_name: Name of the temporary view to create. * arrow: Arrow stream wrapper.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_arrow_array_scan :: DuckDBConnection -> CString -> DuckDBArrowSchema -> DuckDBArrowArray -> Ptr DuckDBArrowStream -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Scans the Arrow array and creates a view with the given name. Note that after running duckdb_arrow_array_scan, duckdb_destroy_arrow_stream must be called on the out stream.

Parameters: * connection: The connection on which to execute the scan. * table_name: Name of the temporary view to create. * arrow_schema: Arrow schema wrapper. * arrow_array: Arrow array wrapper. * out_stream: Output array stream that wraps around the passed schema, for releasing/deleting once done.

Returns DuckDBSuccess on success or DuckDBError on failure.

duckdbArrowSchemaInternal :: DuckDBArrowSchema -> IO (Maybe ArrowSchemaPtr) Source #

Read the internal_ptr field of a deprecated Arrow schema wrapper. Returns Nothing when the wrapper is null or DuckDB has already cleared the pointer.

duckdbArrowSchemaClear :: DuckDBArrowSchema -> IO () Source #

Clear the internal_ptr field on a deprecated Arrow schema wrapper. Useful after copying the schema to application-managed storage.

duckdbArrowArrayInternal :: DuckDBArrowArray -> IO (Maybe ArrowArrayPtr) Source #

Read the internal_ptr field of a deprecated Arrow array wrapper. Returns Nothing when the wrapper is null or the internal pointer has been cleared by DuckDB.

duckdbArrowArrayClear :: DuckDBArrowArray -> IO () Source #

Clear the internal_ptr field on a deprecated Arrow array wrapper. After this call DuckDB treats the wrapper as null.

duckdbArrowStreamInternal :: DuckDBArrowStream -> IO (Maybe ArrowStreamPtr) Source #

Read the internal_ptr field of a deprecated Arrow stream wrapper. Returns Nothing when the wrapper is null or the stream has already been released.

duckdbArrowStreamClear :: DuckDBArrowStream -> IO () Source #

Clear the internal_ptr field on a deprecated Arrow stream wrapper. Use this after consuming the stream via duckdb_arrow_scan to avoid stale pointers on the DuckDB side.

c_duckdb_execute_prepared_streaming :: DuckDBPreparedStatement -> Ptr DuckDBResult -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Executes the prepared statement with the given bound parameters, and returns an optionally-streaming query result. To determine if the resulting query was in fact streamed, use duckdb_result_is_streaming

This method can be called multiple times for each prepared statement, and the parameters can be modified between calls to this function.

Note that the result must be freed with duckdb_destroy_result.

Parameters: * prepared_statement: The prepared statement to execute. * out_result: The query result.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_pending_prepared_streaming :: DuckDBPreparedStatement -> Ptr DuckDBPendingResult -> IO DuckDBState Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Executes the prepared statement with the given bound parameters, and returns a pending result. This pending result will create a streaming duckdb_result when executed. The pending result represents an intermediate structure for a query that is not yet fully executed.

Note that after calling duckdb_pending_prepared_streaming, the pending result should always be destroyed using duckdb_destroy_pending, even if this function returns DuckDBError.

Parameters: * prepared_statement: The prepared statement to execute. * out_result: The pending query result.

Returns DuckDBSuccess on success or DuckDBError on failure.

c_duckdb_column_data :: Ptr DuckDBResult -> DuckDBIdx -> IO (Ptr ()) Source #

Deprecated This method has been deprecated. Prefer using

duckdb_result_get_chunk instead.

Returns the data of a specific column of a result in columnar format.

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: ``c int32_t *data = (int32_t *) duckdb_column_data(&result, 0); printf("Data for row %d: %dn", row, data[row]); ``

Parameters: * result: The result object to fetch the column data from. * col: The column index.

Returns The column data of the specified column.

c_duckdb_nullmask_data :: Ptr DuckDBResult -> DuckDBIdx -> IO (Ptr CBool) Source #

Deprecated This method has been deprecated. Prefer using

duckdb_result_get_chunk instead.

Returns the nullmask of a specific column of a result in columnar format. The nullmask indicates for every row whether or not the corresponding row is NULL. If a row is NULL, the values present in the array provided by duckdb_column_data are undefined.

``c int32_t *data = (int32_t *) duckdb_column_data(&result, 0); bool *nullmask = duckdb_nullmask_data(&result, 0); if (nullmask[row]) { printf("Data for row %d: NULLn", row); } else { printf("Data for row %d: %dn", row, data[row]); } ``

Parameters: * result: The result object to fetch the nullmask from. * col: The column index.

Returns The nullmask of the specified column.

c_duckdb_row_count :: Ptr DuckDBResult -> IO DuckDBIdx Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns the number of rows present in the result object.

Parameters: * result: The result object.

Returns The number of rows present in the result object.

c_duckdb_result_get_chunk :: Ptr DuckDBResult -> DuckDBIdx -> IO DuckDBDataChunk Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Fetches a data chunk from the duckdb_result. This function should be called repeatedly until the result is exhausted.

The result must be destroyed with duckdb_destroy_data_chunk.

This function supersedes all duckdb_value functions, as well as the duckdb_column_data and duckdb_nullmask_data functions. It results in significantly better performance, and should be preferred in newer code-bases.

If this function is used, none of the other result functions can be used and vice versa (i.e., this function cannot be mixed with the legacy result functions).

Use duckdb_result_chunk_count to figure out how many chunks there are in the result.

Parameters: * result: The result object to fetch the data chunk from. * chunk_index: The chunk index to fetch from.

Returns The resulting data chunk. Returns NULL if the chunk index is out of bounds.

These bindings call the wrapper symbol wrapped_duckdb_result_get_chunk but mirror the DuckDB C API semantics of duckdb_result_get_chunk.

c_duckdb_result_is_streaming :: Ptr DuckDBResult -> IO CBool Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Checks if the type of the internal result is StreamQueryResult.

Parameters: * result: The result object to check.

Returns Whether or not the result object is of the type StreamQueryResult

These bindings call the wrapper symbol wrapped_duckdb_result_is_streaming but mirror the DuckDB C API semantics of duckdb_result_is_streaming.

c_duckdb_result_chunk_count :: Ptr DuckDBResult -> IO DuckDBIdx Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns the number of data chunks present in the result.

Parameters: * result: The result object

Returns Number of data chunks present in the result.

These bindings call the wrapper symbol wrapped_duckdb_result_chunk_count but mirror the DuckDB C API semantics of duckdb_result_chunk_count.

c_duckdb_value_boolean :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CBool Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The boolean value at the specified location, or false if the value cannot be converted.

c_duckdb_value_int8 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int8 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The int8_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_int16 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int16 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The int16_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_int32 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int32 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The int32_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_int64 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Int64 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The int64_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_hugeint :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBHugeInt -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_hugeint value at the specified location, or 0 if the value cannot be converted.

These bindings call the wrapper symbol wrapped_duckdb_value_hugeint but mirror the DuckDB C API semantics of duckdb_value_hugeint.

c_duckdb_value_uhugeint :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBUHugeInt -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_uhugeint value at the specified location, or 0 if the value cannot be converted.

These bindings call the wrapper symbol wrapped_duckdb_value_uhugeint but mirror the DuckDB C API semantics of duckdb_value_uhugeint.

c_duckdb_value_decimal :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBDecimal -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_decimal value at the specified location, or 0 if the value cannot be converted.

These bindings call the wrapper symbol wrapped_duckdb_value_decimal but mirror the DuckDB C API semantics of duckdb_value_decimal.

c_duckdb_value_uint8 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word8 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The uint8_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_uint16 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word16 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The uint16_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_uint32 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word32 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The uint32_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_uint64 :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO Word64 Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The uint64_t value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_float :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CFloat Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The float value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_double :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CDouble Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The double value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_date :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO DuckDBDate Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_date value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_time :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO DuckDBTime Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_time value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_timestamp :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO DuckDBTimestamp Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_timestamp value at the specified location, or 0 if the value cannot be converted.

c_duckdb_value_interval :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBInterval -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_interval value at the specified location, or 0 if the value cannot be converted.

These bindings call the wrapper symbol wrapped_duckdb_value_interval but mirror the DuckDB C API semantics of duckdb_value_interval.

c_duckdb_value_string :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBString -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

No support for nested types, and for other complex types. The resulting field "string.data" must be freed with duckdb_free.

Returns The string value at the specified location. Attempts to cast the result value to string.

These bindings call the wrapper symbol wrapped_duckdb_value_string but mirror the DuckDB C API semantics of duckdb_value_string.

c_duckdb_value_blob :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBBlob -> IO () Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns The duckdb_blob value at the specified location. Returns a blob with blob.data set to nullptr if the value cannot be converted. The resulting field "blob.data" must be freed with duckdb_free.

These bindings call the wrapper symbol wrapped_duckdb_value_blob but mirror the DuckDB C API semantics of duckdb_value_blob.

c_duckdb_value_is_null :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CBool Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Returns Returns true if the value at the specified index is NULL, and false otherwise.

c_duckdb_value_varchar :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CString Source #

Deprecated This method has been deprecated. Use duckdb_value_string instead.

This function does not work correctly if the string contains null bytes.

Returns The text value at the specified location as a null-terminated string, or nullptr if the value cannot be converted. The result must be freed with duckdb_free.

c_duckdb_value_varchar_internal :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> IO CString Source #

Deprecated This method has been deprecated. Use duckdb_value_string_internal

instead. This function does not work correctly if the string contains null bytes.

Returns The char* value at the specified location. ONLY works on VARCHAR columns and does not auto-cast. If the column is NOT a VARCHAR column this function will return NULL. The result must NOT be freed.

c_duckdb_value_string_internal :: Ptr DuckDBResult -> DuckDBIdx -> DuckDBIdx -> Ptr DuckDBString -> IO () Source #

Deprecated This method has been deprecated. Use duckdb_value_string_internal

instead. This function does not work correctly if the string contains null bytes.

Returns The char* value at the specified location. ONLY works on VARCHAR columns and does not auto-cast. If the column is NOT a VARCHAR column this function will return NULL. The result must NOT be freed.

These bindings call the wrapper symbol wrapped_duckdb_value_string_internal but mirror the DuckDB C API semantics of duckdb_value_string_internal.

c_duckdb_stream_fetch_chunk :: Ptr DuckDBResult -> IO DuckDBDataChunk Source #

Warning Deprecation notice. This method is scheduled for removal in a future

release.

Fetches a data chunk from the (streaming) duckdb_result. This function should be called repeatedly until the result is exhausted.

The result must be destroyed with duckdb_destroy_data_chunk.

This function can only be used on duckdb_results created with duckdb_pending_prepared_streaming

If this function is used, none of the other result functions can be used and vice versa (i.e., this function cannot be mixed with the legacy result functions or the materialized result functions).

It is not known beforehand how many chunks will be returned by this result.

Parameters: * result: The result object to fetch the data chunk from.

Returns The resulting data chunk. Returns NULL if the result has an error.

These bindings call the wrapper symbol wrapped_duckdb_stream_fetch_chunk but mirror the DuckDB C API semantics of duckdb_stream_fetch_chunk.