Add a replacement scan definition to the specified database
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 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 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.
Close the appender, flushing all intermediate state in the appender to the table and closing it for further appends.
Creates an appender object.
Close the appender and destroy it. Flushing all intermediate state in the appender to the table, and de-allocating
all memory associated with the appender.
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 and the data to be appended to the
base table.
Returns the number of columns present in a the arrow result object.
Returns the number of rows present in a the arrow result object.
Returns the number of rows changed by the query stored in the arrow result. This is relevant only for
INSERT/UPDATE/DELETE queries. For other queries the rows_changed will be 0.
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 an double value to the prepared statement at the specified index.
Binds an 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 the parameter at the given index.
Retrieves the number of regular (non-named) parameters to the function.
Binds an 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.
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 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 null-terminated varchar value to the prepared statement at the specified index.
Binds a varchar value to the prepared statement at the specified index.
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
.
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.
Returns the logical column type of the specified column.
Returns the column name of the specified column. The result should not need 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.
Initializes an empty configuration object that can be used to provide start-up options for the DuckDB instance
through duckdb_open_ext
.
Creates an empty DataChunk with the specified set of types.
Creates a duckdb_logical_type
of type decimal with the specified width and scale
The resulting type should be destroyed with duckdb_destroy_logical_type
.
Creates a value from an int64
Creates a list type from its child type.
The resulting type should be destroyed with duckdb_destroy_logical_type
.
Creates a duckdb_logical_type
from a standard primitive type.
The resulting type should be destroyed with duckdb_destroy_logical_type
.
Creates a map type from its key type and value type.
The resulting type should be destroyed with duckdb_destroy_logical_type
.
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 UNION type from the passed types array
The resulting type should 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.
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.
Closes the result and de-allocates all memory allocated for the arrow result.
Destroys the specified configuration option 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.
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 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.
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.
Executes the prepared statement with the given bound parameters, and returns an arrow query result.
Execute DuckDB tasks on this thread.
Execute DuckDB tasks on this thread.
Returns true if 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.
If the extract fails, duckdb_extract_statements_error
can be called to obtain the reason why the extract failed.
connection: The connection object
query: The SQL query to extract
out_extracted_statements: The resulting extracted statements object
returns: The number of extracted statements or 0 on failure.
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.
result: The extracted statements to fetch the error from.
returns: The error of the extracted statements.
Finish execution on a specific task.
Free a value returned from duckdb_malloc
, duckdb_value_varchar
or duckdb_value_blob
.
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 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.
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
).
Obtains an int64 of the given value.
Retrieves the type class of a duckdb_logical_type
.
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)
Returns the version of the linked DuckDB, with a version postfix for dev versions
Retrieves the child type of the given list 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.
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 the given path.
If no path is given a new in-memory database is created instead.
Extended version of duckdb_open. Creates a new database or opens an existing database file stored at the the given path.
Returns the parameter type for the parameter at the given index.
Returns the error message contained within the pending result.
Executes a single task within the query, returning whether or not the query is ready.
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.
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.
If the prepare fails, duckdb_prepare_error
can be called to obtain the reason why the prepare failed.
connection: The connection object
extracted_statements: The extracted statements object
index: The index of the extracted statement to prepare
out_prepared_statement: The resulting prepared statement object
returns: DuckDBSuccess
on success or DuckDBError
on failure.
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
.
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
.
Fetch an internal arrow array from the arrow result.
Returns the error message contained within the result. The error is only set if duckdb_query_arrow
returns
DuckDBError
.
Fetch the internal arrow schema from the arrow result.
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 to use. 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.
Returns the number of data chunks present in the result.
Returns the error message contained within the result. The error is only set if duckdb_query
returns DuckDBError
.
Fetches a data chunk from the duckdb_result. This function should be called repeatedly until the result is exhausted.
Returns the number of rows present in a the result object.
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.
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
.
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.
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.
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.
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 “blob.data” must be freed with duckdb_free.
returns: The boolean value at the specified location, or false if the value cannot be converted.
returns: The duckdb_date value at the specified location, or 0 if the value cannot be converted.
returns: The duckdb_decimal value at the specified location, or 0 if the value cannot be converted.
returns: The double value at the specified location, or 0 if the value cannot be converted.
returns: The float value at the specified location, or 0 if the value cannot be converted.
returns: The duckdb_hugeint value at the specified location, or 0 if the value cannot be converted.
returns: The int8_t value at the specified location, or 0 if the value cannot be converted.
returns: The int16_t value at the specified location, or 0 if the value cannot be converted.
returns: The int32_t value at the specified location, or 0 if the value cannot be converted.
returns: The int64_t value at the specified location, or 0 if the value cannot be converted.
returns: The duckdb_interval value at the specified location, or 0 if the value cannot be converted.
returns: Returns true if the value at the specified index is NULL, and false otherwise.
s
returns: The string value at the specified location.
The result must be freed with duckdb_free
.
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.
returns: The duckdb_time value at the specified location, or 0 if the value cannot be converted.
returns: The duckdb_timestamp value at the specified location, or 0 if the value cannot be converted.
returns: The uint8_t value at the specified location, or 0 if the value cannot be converted.
returns: The uint16_t value at the specified location, or 0 if the value cannot be converted.
returns: The uint32_t value at the specified location, or 0 if the value cannot be converted.
returns: The uint64_t value at the specified location, or 0 if the value cannot be converted.
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
.
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.
Assigns a string element in the vector at the specified location.
Assigns a string element in the vector at the specified location.
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
.