Structs

! Days are stored as days since 1970-01-01 ! Use the duckdb_from_date/duckdb_to_date function to extract individual information

! Hugeints are composed in a (lower, upper) component ! The value of the hugeint is upper * 2^64 + lower ! For easy usage, the functions duckdb_hugeint_to_double/duckdb_double_to_hugeint are recommended

! Time is stored as microseconds since 00:00:00 ! Use the duckdb_from_time/duckdb_to_time function to extract individual information

! Timestamps are stored as microseconds since 1970-01-01 ! Use the duckdb_from_timestamp/duckdb_to_timestamp function to extract individual information

Enums

Error Codes

Constants

Statics

Functions

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 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.

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.

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 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.

Destroys the logical type and de-allocates all memory allocated for that type.

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 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_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.

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.

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)

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

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.

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.

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.

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.

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 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.

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.

returns: The char* value at the specified location, or nullptr if the value cannot be converted. The result must be freed with duckdb_free.

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.

Type Definitions

Unions