Repository: duckdb/duckdb
File: src/include/duckdb.h (C/C++)

Code before:
* returns: The return state.
*/
DUCKDB_API duckdb_state duckdb_append_data_chunk(duckdb_appender appender, duckdb_data_chunk chunk);

//===--------------------------------------------------------------------===//
// TableDescription
//===--------------------------------------------------------------------===//

/*!
Creates a table description object.
Note that the object must be destroyed with `duckdb_table_description_destroy`.
* connection: The connection context.
* schema: The schema of the table, or `nullptr` for the default schema.
* table: The table name.
* out: The resulting table description object.
* returns: `DuckDBSuccess` on success or `DuckDBError` on failure.
*/
DUCKDB_API duckdb_state duckdb_table_description_create(duckdb_connection connection, const char *schema,
                                                        const char *table, duckdb_table_description *out);

/*!
Destroy the TableDescription object.
* table: The table_description to destroy.
* returns: `DuckDBSuccess` on success or `DuckDBError` on failure.
*/
DUCKDB_API duckdb_state duckdb_table_description_destroy(duckdb_table_description *table);

/*!
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.
* table_description: The table_description to get the error from.
* returns: The error message, or `nullptr` if there is none.
*/
DUCKDB_API const char *duckdb_table_description_error(duckdb_table_description table);

/*!
Check if the column at 'index' index of the table has a DEFAULT expression.
* table: The table_description to query.
* index: The index of the column to query.
* out: The out-parameter used to store the result.
* returns: `DuckDBSuccess` on success or `DuckDBError` on failure.
*/
DUCKDB_API duckdb_state duckdb_column_has_default(duckdb_table_description table_description, idx_t index, bool *out);

#ifndef DUCKDB_API_NO_DEPRECATED
//===--------------------------------------------------------------------===//
// Arrow Interface
//===--------------------------------------------------------------------===//

/*!

Review comment (suggestion):
Let's name the parameter `table_description` instead of just `table`—or at least make it uniform between the functions. As we're using `table` for the `string`.

Code after:
Appends a pre-filled data chunk to the specified appender.

The types of the data chunk must exactly match the types of the table, no casting is performed.
If the types do not match or the appender is in an invalid state, DuckDBError is returned.
If the append is successful, DuckDBSuccess is returned.

* appender: The appender to append to.
* chunk: The data chunk to append.
* returns: The return state.
*/
DUCKDB_API duckdb_state duckdb_append_data_chunk(duckdb_appender appender, duckdb_data_chunk chunk);

//===--------------------------------------------------------------------===//
// TableDescription
//===--------------------------------------------------------------------===//

/*!
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`.
* connection: The connection context.
* schema: The schema of the table, or `nullptr` for the default schema.
* table: The table name.
* out: The resulting table description object.
* returns: `DuckDBSuccess` on success or `DuckDBError` on failure.
*/
DUCKDB_API duckdb_state duckdb_table_description_create(duckdb_connection connection, const char *schema,
                                                        const char *table, duckdb_table_description *out);

/*!
Destroy the TableDescription object.
* table: The table_description to destroy.
*/
DUCKDB_API void duckdb_table_description_destroy(duckdb_table_description *table_description);

/*!
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.
* table_description: The table_description to get the error from.
* returns: The error message, or `nullptr` if there is none.
*/
DUCKDB_API const char *duckdb_table_description_error(duckdb_table_description table);

/*!
Check if the column at 'index' index of the table has a DEFAULT expression.
* table: The table_description to query.
* index: The index of the column to query.
* out: The out-parameter used to store the result.
* returns: `DuckDBSuccess` on success or `DuckDBError` on failure.
*/