Skip to content

Improve GADBC API to be GObject Introspection friendly #1280

@esodan

Description

@esodan

The C API could be correct and useful as is, but when switch to Vala using void* doesn't feet Vala's automatic memory management, as we need to tell it if the pointer should or not be freed. In other words void* means manual memory management, and that push back the advantage of Vala for GObject.

For GADBC.Statement, currently there are this API:

gboolean gadbc_statement_bind(GADBCStatement* statement, gpointer c_abi_array,
                              gpointer c_abi_schema, GError** error);

gboolean gadbc_statement_bind_stream(GADBCStatement* statement,
                                     gpointer c_abi_array_stream, GError** error)

The C comments declares gpointer c_abi_array and gpointer c_abi_array_stream as out parameters, but the pointer in not a pointer to pointer (void**), so should not be declared as it.

But when looking to a better GObject API, the C API should be:

gboolean gadbc_statement_bind(GADBCStatement* statement, GArrow.Array *array,
                              GArrow.Schema *schema, GError** error);

gboolean gadbc_statement_bind_stream(GADBCStatement* statement,
                                     GArrow.InputStream *stream, GError** error)

Internally, the above statements should use *_get_raw() methods to get the native Arrow structures and fill out them with the provided data.

I'm not quite sure if c_abi_array_stream is a GArrow.InputStream or an GArrow.OutputStream, so please guide me here, because there is not a generic GArrow.Stream to use here.

This issue is affecting #1152 because the current API forces to manual memory management, that is not a good idea, both in C and in Vala.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions