Adds the aggregate function as a new overload to the aggregate function set.
Add a replacement scan definition to the specified database.
Adds the scalar function as a new overload to the scalar function set.
Adds a parameter to the aggregate function.
Retrieves the extra info of the function as set in duckdb_aggregate_function_set_extra_info
.
Sets the state destructor callback of the aggregate function (optional)
Report that an error has occurred while executing the aggregate function.
Assigns extra information to the scalar function that can be fetched during binding, etc.
Sets the main functions of the aggregate function.
Sets the name of the given aggregate function.
Sets the return type of the aggregate function.
Sets the NULL handling of the aggregate function to SPECIAL_HANDLING.
Append a blob value to the appender.
Append a bool value to the appender.
Appends a pre-filled data chunk to the specified appender.
Append a duckdb_date value to the appender.
Append a DEFAULT value (NULL if DEFAULT not available for column) to the appender.
Append a double value to the appender.
Append a float value to the appender.
Append a duckdb_hugeint value to the appender.
Append an int8_t value to the appender.
Append an int16_t value to the appender.
Append an int32_t value to the appender.
Append an int64_t value to the appender.
Append a duckdb_interval value to the appender.
Append a NULL value to the appender (of any type).
Append a duckdb_time value to the appender.
Append a duckdb_timestamp value to the appender.
Append a duckdb_uhugeint value to the appender.
Append a uint8_t value to the appender.
Append a uint16_t value to the appender.
Append a uint32_t value to the appender.
Append a uint64_t value to the appender.
Append a varchar value to the appender.
Append a varchar value to the appender.
A nop function, provided for backwards compatibility reasons. Does nothing. Only duckdb_appender_end_row
is required.
Closes the appender by flushing all intermediate states and closing it for further appends. If flushing the data
triggers a constraint violation or any other error, then all data is invalidated, and this function returns DuckDBError.
Call duckdb_appender_error to obtain the error message followed by duckdb_appender_destroy to destroy the invalidated
appender.
Returns the number of columns in the table that belongs to the appender.
Returns the type of the column at the specified index.
Creates an appender object.
Closes the appender by flushing all intermediate states to the table and destroying it. By destroying it, this function
de-allocates all memory associated with the appender. If flushing the data triggers a constraint violation,
then all data is invalidated, and this function returns DuckDBError. Due to the destruction of the appender, it is no
longer possible to obtain the specific error message with duckdb_appender_error. Therefore, call duckdb_appender_close
before destroying the appender, if you need insights into the specific error.
Finish the current row of appends. After end_row is called, the next row can be appended.
Returns the error message associated with the given appender.
If the appender has no error message, this returns nullptr
instead.
Flush the appender to the table, forcing the cache of the appender to be cleared. If flushing the data triggers a
constraint violation or any other error, then all data is invalidated, and this function returns DuckDBError.
It is not possible to append more values. Call duckdb_appender_error to obtain the error message followed by
duckdb_appender_destroy to destroy the invalidated appender.
Retrieves the array size of the given array type.
Retrieves the child type of the given ARRAY type.
Retrieves the child vector of a array vector.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Adds a result column to the output of the table function.
Binds a blob value to the prepared statement at the specified index.
Binds a bool value to the prepared statement at the specified index.
Binds a duckdb_date value to the prepared statement at the specified index.
Binds a duckdb_decimal value to the prepared statement at the specified index.
Binds a double value to the prepared statement at the specified index.
Binds a float value to the prepared statement at the specified index.
Retrieves the extra info of the function as set in duckdb_table_function_set_extra_info
.
Retrieves a named parameter with the given name.
Retrieves the parameter at the given index.
Retrieves the number of regular (non-named) parameters to the function.
Binds a duckdb_hugeint value to the prepared statement at the specified index.
Binds an int8_t value to the prepared statement at the specified index.
Binds an int16_t value to the prepared statement at the specified index.
Binds an int32_t value to the prepared statement at the specified index.
Binds an int64_t value to the prepared statement at the specified index.
Binds a duckdb_interval value to the prepared statement at the specified index.
Binds a NULL value to the prepared statement at the specified index.
Retrieve the index of the parameter for the prepared statement, identified by name
Sets the user-provided bind data in the bind object. This object can be retrieved again during execution.
Sets the cardinality estimate for the table function, used for optimization.
Report that an error has occurred while calling bind.
Binds a duckdb_time value to the prepared statement at the specified index.
Binds a duckdb_timestamp value to the prepared statement at the specified index.
Binds a duckdb_timestamp value to the prepared statement at the specified index.
Binds an duckdb_uhugeint value to the prepared statement at the specified index.
Binds an uint8_t value to the prepared statement at the specified index.
Binds an uint16_t value to the prepared statement at the specified index.
Binds an uint32_t value to the prepared statement at the specified index.
Binds an uint64_t value to the prepared statement at the specified index.
Binds a value to the prepared statement at the specified index.
Binds a null-terminated varchar value to the prepared statement at the specified index.
Binds a varchar value to the prepared statement at the specified index.
Get the cast execution mode from the given function info.
Retrieves the extra info of the function as set in duckdb_cast_function_set_extra_info
.
Report that an error has occurred while executing the cast function.
Assigns extra information to the cast function that can be fetched during execution, etc.
Sets the actual cast function to use.
Sets the “cost” of implicitly casting the source type to the target type using this function.
Report that an error has occurred while executing the cast function, setting the corresponding output row to NULL.
Sets the source type of the cast function.
Sets the target type of the cast function.
Clear the params bind to the prepared statement.
Closes the specified database and de-allocates all memory allocated for that database.
This should be called after you are done with any database allocated through duckdb_open
or duckdb_open_ext
.
Note that failing to call duckdb_close
(in case of e.g. a program crash) will not cause data corruption.
Still, it is recommended to always correctly close a database object after you are done with it.
Returns the number of columns present in a the result object.
DEPRECATED**: Prefer using duckdb_result_get_chunk
instead.
Check if the column at ‘index’ index of the table has a DEFAULT expression.
Returns the logical column type of the specified column.
Returns the column name of the specified column. The result should not need to be freed; the column names will
automatically be destroyed when the result is destroyed.
Returns the column type of the specified column.
This returns the total amount of configuration options available for usage with duckdb_get_config_flag
.
Opens a connection to a database. Connections are required to query the database, and store transactional state
associated with the connection.
The instantiated connection should be closed using ‘duckdb_disconnect’.
Creates a new empty aggregate function.
Creates a new empty aggregate function set.
Creates an ARRAY type from its child type.
The return type must be destroyed with duckdb_destroy_logical_type
.
Creates an array value from a child (element) type and an array of values of length value_count
.
Must be destroyed with duckdb_destroy_value
.
Creates a value from a blob
Creates a value from a boolean
Creates a new cast function object.
Initializes an empty configuration object that can be used to provide start-up options for the DuckDB instance
through duckdb_open_ext
.
The duckdb_config must be destroyed using ‘duckdb_destroy_config’
Creates an empty data chunk with the specified column types.
The result must be destroyed with duckdb_destroy_data_chunk
.
Creates a value from a date
Creates a DECIMAL type with the specified width and scale.
The resulting type should be destroyed with duckdb_destroy_logical_type
.
Creates a value from a double
Creates an ENUM type from the passed member name array.
The resulting type should be destroyed with duckdb_destroy_logical_type
.
Creates a value from a float
Creates a value from a hugeint
Creates a value from a int8_t (a tinyint)
Creates a value from a int16_t (a smallint)
Creates a value from a int32_t (an integer)
Creates a value from an int64
Creates a value from an interval
Creates a LIST type from its child type.
The return type must be destroyed with duckdb_destroy_logical_type
.
Creates a list value from a child (element) type and an array of values of length value_count
.
Must be destroyed with duckdb_destroy_value
.
Creates a duckdb_logical_type
from a primitive type.
The resulting logical type must be destroyed with duckdb_destroy_logical_type
.
Creates a MAP type from its key type and value type.
The return type must be destroyed with duckdb_destroy_logical_type
.
Creates a new empty scalar function.
Creates a new empty scalar function set.
Creates a STRUCT type based on the member types and names.
The resulting type must be destroyed with duckdb_destroy_logical_type
.
Creates a struct value from a type and an array of values. Must be destroyed with duckdb_destroy_value
.
Creates a new empty table function.
Creates a task state that can be used with duckdb_execute_tasks_state to execute tasks until
duckdb_finish_execution
is called on the state.
Creates a value from a time
Create a duckdb_time_tz
object from micros and a timezone offset.
Creates a value from a time_tz.
Not to be confused with duckdb_create_time_tz
, which creates a duckdb_time_tz_t.
Creates a value from a timestamp
Creates a value from a uhugeint
Creates a value from a uint8_t (a utinyint)
Creates a value from a uint16_t (a usmallint)
Creates a value from a uint32_t (a uinteger)
Creates a value from a uint64_t (a ubigint)
Creates a UNION type from the passed arrays.
The return type must be destroyed with duckdb_destroy_logical_type
.
Creates a value from a null-terminated string
Creates a value from a string
Retrieves the number of columns in a data chunk.
Retrieves the current number of tuples in a data chunk.
Retrieves the vector at the specified column index in the data chunk.
Resets a data chunk, clearing the validity masks and setting the cardinality of the data chunk to 0.
After calling this method, you must call duckdb_vector_get_validity
and duckdb_vector_get_data
to obtain current
data and validity pointers
Sets the current number of tuples in a data chunk.
Retrieves the internal storage type of a decimal type.
Retrieves the scale of a decimal type.
Converts a duckdb_decimal object (as obtained from a DUCKDB_TYPE_DECIMAL
column) into a double.
Retrieves the width of a decimal type.
Destroys the given aggregate function object.
Destroys the given aggregate function set object.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Destroys the cast function object.
Destroys the specified configuration object and de-allocates all memory allocated for the object.
Destroys the data chunk and de-allocates all memory allocated for that chunk.
De-allocates all memory allocated for the extracted statements.
@param extracted_statements The extracted statements to destroy.
Destroys the logical type and de-allocates all memory allocated for that type.
Closes the pending result and de-allocates all memory allocated for the result.
Closes the prepared statement and de-allocates all memory allocated for the statement.
Closes the result and de-allocates all memory allocated for that connection.
Destroys the given scalar function object.
Destroys the given scalar function set object.
Destroys the given table function object.
Destroys the task state returned from duckdb_create_task_state.
Destroys the value and de-allocates all memory allocated for that type.
Closes the specified connection and de-allocates all memory allocated for that connection.
Converts a double value to a duckdb_decimal object.
Converts a double value to a duckdb_hugeint object.
Converts a double value to a duckdb_uhugeint object.
Retrieves the dictionary size of the enum type.
Retrieves the dictionary value at the specified position from the enum.
Retrieves the internal storage type of an enum type.
Execute DuckDB tasks on this thread.
Fully execute a pending query result, returning the final query result.
Executes the prepared statement with the given bound parameters, and returns a materialized query result.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Execute DuckDB tasks on this thread.
Execute DuckDB tasks on this thread.
Returns true if the execution of the current query is finished.
Extract all statements from a query.
Note that after calling duckdb_extract_statements
, the extracted statements should always be destroyed using
duckdb_destroy_extracted
, even if no statements were extracted.
Returns the error message contained within the extracted statements.
The result of this function must not be freed. It will be cleaned up when duckdb_destroy_extracted
is called.
Fetches a data chunk from a duckdb_result. This function should be called repeatedly until the result is exhausted.
Finish execution on a specific task.
Free a value returned from duckdb_malloc
, duckdb_value_varchar
, duckdb_value_blob
, or
duckdb_value_string
.
Decompose a duckdb_date
object into year, month and date (stored as duckdb_date_struct
).
Decompose a duckdb_time
object into hour, minute, second and microsecond (stored as duckdb_time_struct
).
Decompose a TIME_TZ objects into micros and a timezone offset.
Decompose a duckdb_timestamp
object into a duckdb_timestamp_struct
.
Gets the bind data set by duckdb_bind_set_bind_data
during the bind.
Retrieves the extra info of the function as set in duckdb_table_function_set_extra_info
.
Gets the init data set by duckdb_init_set_init_data
during the init.
Gets the thread-local init data set by duckdb_init_set_init_data
during the local_init.
Report that an error has occurred while executing the function.
Returns the blob value of the given value.
Returns the boolean value of the given value.
Obtains a human-readable name and description of a specific configuration option. This can be used to e.g.
display configuration options. This will succeed unless index
is out of range (i.e. >= duckdb_config_count
).
Returns the date value of the given value.
Returns the double value of the given value.
Returns the float value of the given value.
Returns the hugeint value of the given value.
Returns the int8_t value of the given value.
Returns the int16_t value of the given value.
Returns the int32_t value of the given value.
Returns the int64_t value of the given value.
Returns the interval value of the given value.
Returns the MAP key at index as a duckdb_value.
Returns the number of elements in a MAP value.
Returns the MAP value at index as a duckdb_value.
Returns the root node of the profiling information. Returns nullptr, if profiling is not enabled.
Returns the time value of the given value.
Returns the time_tz value of the given value.
Returns the timestamp value of the given value.
Retrieves the enum duckdb_type
of a duckdb_logical_type
.
Returns the uhugeint value of the given value.
Returns the uint8_t value of the given value.
Returns the uint16_t value of the given value.
Returns the uint32_t value of the given value.
Returns the uint64_t value of the given value.
Returns the type of the given value. The type is valid as long as the value is not destroyed.
The type itself must not be destroyed.
Obtains a string representation of the given value.
The result must be destroyed with duckdb_free
.
Converts a duckdb_hugeint object (as obtained from a DUCKDB_TYPE_HUGEINT
column) into a double.
Gets the bind data set by duckdb_bind_set_bind_data
during the bind.
Returns the number of projected columns.
Returns the column index of the projected column at the specified position.
Retrieves the extra info of the function as set in duckdb_table_function_set_extra_info
.
Report that an error has occurred while calling init.
Sets the user-provided init data in the init object. This object can be retrieved again during execution.
Sets how many threads can process this table function in parallel (default: 1)
Interrupt running query
Test a duckdb_date
to see if it is a finite value.
Test a duckdb_timestamp
to see if it is a finite value.
Returns the version of the linked DuckDB, with a version postfix for dev versions
Retrieves the child type of the given LIST type. Also accepts MAP types.
The result must be freed with duckdb_destroy_logical_type
.
Retrieves the child vector of a list vector.
Returns the size of the child vector of the list.
Sets the total capacity of the underlying child-vector of a list.
Sets the total size of the underlying child-vector of a list vector.
Returns the alias of a duckdb_logical_type, if set, else nullptr
.
The result must be destroyed with duckdb_free
.
Sets the alias of a duckdb_logical_type.
Allocate size
bytes of memory using the duckdb internal malloc function. Any memory allocated in this manner
should be freed using duckdb_free
.
Retrieves the key type of the given map type.
Retrieves the value type of the given map type.
Returns the number of parameters that can be provided to the given prepared statement.
DEPRECATED**: Prefer using duckdb_result_get_chunk
instead.
Creates a new database or opens an existing database file stored at the given path.
If no path is given a new in-memory database is created instead.
The instantiated database should be closed with ‘duckdb_close’.
Extended version of duckdb_open. Creates a new database or opens an existing database file stored at the given path.
The instantiated database should be closed with ‘duckdb_close’.
Returns the parameter type for the parameter at the given index.
Returns the name used to identify the parameter
The returned string should be freed using duckdb_free
.
Returns the error message contained within the pending result.
If this returns DUCKDB_PENDING_RESULT_READY, the duckdb_execute_pending function can be called to obtain the result.
If this returns DUCKDB_PENDING_RESULT_NOT_READY, the duckdb_pending_execute_check_state function should be called again.
If this returns DUCKDB_PENDING_ERROR, an error occurred during execution.
Executes a single task within the query, returning whether or not the query is ready.
Returns whether a duckdb_pending_state is finished executing. For example if pending_state
is
DUCKDB_PENDING_RESULT_READY, this function will return true.
Executes the prepared statement with the given bound parameters, and returns a pending result.
The pending result represents an intermediate structure for a query that is not yet fully executed.
The pending result can be used to incrementally execute a query, returning control to the client between tasks.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Create a prepared statement object from a query.
Returns the error message associated with the given prepared statement.
If the prepared statement has no error message, this returns nullptr
instead.
Prepare an extracted statement.
Note that after calling duckdb_prepare_extracted_statement
, the prepared statement should always be destroyed using
duckdb_destroy_prepare
, even if the prepare fails.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Returns the statement type of the statement to be executed
Returns the child node at the specified index.
Returns the number of children in the current profiling info node.
Returns the key-value metric map of this profiling node as a MAP duckdb_value.
The individual elements are accessible via the duckdb_value MAP functions.
Returns the value of the metric of the current profiling info node. Returns nullptr, if the metric does
not exist or is not enabled. Currently, the value holds a string, and you can retrieve the string
by calling the corresponding function: char *duckdb_get_varchar(duckdb_value value).
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
.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Get progress of the running query
Register the aggregate function object within the given connection.
Register the aggregate function set within the given connection.
Registers a cast function within the given connection.
Registers a custom type within the given connection.
The type must have an alias
Register the scalar function object within the given connection.
Register the scalar function set within the given connection.
Register the table function object within the given connection.
Adds a parameter to the replacement scan function.
Report that an error has occurred while executing the replacement scan.
Sets the replacement function name. If this function is called in the replacement callback,
the replacement scan is performed. If it is not called, the replacement callback is not performed.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
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
returns DuckDBError
.
Returns the result error type contained within the result. The error is only set if duckdb_query
returns
DuckDBError
.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Returns the return_type of the given result, or DUCKDB_RETURN_TYPE_INVALID on error
Returns the statement type of the statement that was executed
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Returns the number of rows changed by the query stored in the result. This is relevant only for INSERT/UPDATE/DELETE
queries. For other queries the rows_changed will be 0.
Adds a parameter to the scalar function.
Retrieves the extra info of the function as set in duckdb_scalar_function_set_extra_info
.
Report that an error has occurred while executing the scalar function.
Assigns extra information to the scalar function that can be fetched during binding, etc.
Sets the main function of the scalar function.
Sets the name of the given scalar function.
Sets the return type of the scalar function.
Sets the parameters of the given scalar function to varargs. Does not require adding parameters with
duckdb_scalar_function_add_parameter.
Sets the parameters of the given scalar function to varargs. Does not require adding parameters with
duckdb_scalar_function_add_parameter.
Sets the Function Stability of the scalar function to VOLATILE, indicating the function should be re-run for every row.
This limits optimization that can be performed for the function.
Sets the specified option for the specified configuration. The configuration option is indicated by name.
To obtain a list of config options, see duckdb_get_config_flag
.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
Whether or not the duckdb_string_t value is inlined.
This means that the data of the string does not have a separate allocation.
Get a pointer to the string data of a string_t
Get the string length of a string_t
Returns the number of children of a struct type.
Retrieves the name of the struct child.
Retrieves the child type of the given struct type at the specified index.
Retrieves the child vector of a struct vector.
Creates a table description object. Note that duckdb_table_description_destroy
should always be called on the
resulting table_description, even if the function returns DuckDBError
.
Destroy the TableDescription object.
Returns the error message associated with the given table_description.
If the table_description has no error message, this returns nullptr
instead.
The error message should not be freed. It will be de-allocated when duckdb_table_description_destroy
is called.
Adds a named parameter to the table function.
Adds a parameter to the table function.
Sets the bind function of the table function.
Assigns extra information to the table function that can be fetched during binding, etc.
Sets the main function of the table function.
Sets the init function of the table function.
Sets the thread-local init function of the table function.
Sets the name of the given table function.
Sets whether or not the given table function supports projection pushdown.
Check if the provided duckdb_task_state has finished execution
Re-compose a duckdb_date
from year, month and date (duckdb_date_struct
).
Re-compose a duckdb_time
from hour, minute, second and microsecond (duckdb_time_struct
).
Re-compose a duckdb_timestamp
from a duckdb_timestamp_struct.
Converts a duckdb_uhugeint object (as obtained from a DUCKDB_TYPE_UHUGEINT
column) into a double.
Returns the number of members that the union type has.
Retrieves the name of the union member.
Retrieves the child type of the given union member at the specified index.
Returns whether or not a row is valid (i.e. not NULL) in the given validity mask.
In a validity mask, sets a specific row to invalid.
In a validity mask, sets a specific row to valid.
In a validity mask, sets a specific row to either valid or invalid.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATED**: Use duckdb_value_string_internal instead. This function does not work correctly if the string contains
null bytes.
@return 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.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
DEPRECATED**: Use duckdb_value_string instead. This function does not work correctly if the string contains null
bytes.
DEPRECATED**: Use duckdb_value_string_internal instead. This function does not work correctly if the string contains
null bytes.
Assigns a string element in the vector at the specified location.
Assigns a string element in the vector at the specified location. You may also use this function to assign BLOBs.
Ensures the validity mask is writable by allocating it.
Retrieves the column type of the specified vector.
Retrieves the data pointer of the vector.
Retrieves the validity mask pointer of the specified vector.
The internal vector size used by DuckDB.
This is the amount of tuples that will fit into a data chunk created by duckdb_create_data_chunk
.