ccaosdb.h

Typedefs

typedef struct caosdb_connection_connection caosdb_connection_connection

A wrapper of the C++ Connection class.

We use a wrapper for future extensibility and in order to have a minimal capability for type checking in C even though the C++ class Connection is opaque in C.

typedef struct caosdb_connection_connection_configuration caosdb_connection_connection_configuration

A wrapper of the C++ ConnectionConfiguration class.

We use a wrapper for future extensibility and in order to have a minimal capability for type checking in C even though the C++ class Connection is opaque in C.

typedef struct caosdb_info_version_info caosdb_info_version_info

A wrapper of the C++ VersionInfo class.

We use a wrapper for future extensibility and in order to have a minimal capability for type checking in C even though the C++ class Connection is opaque in C.

typedef struct caosdb_connection_certificate_provider caosdb_connection_certificate_provider
typedef struct caosdb_authentication_authenticator caosdb_authentication_authenticator
typedef struct caosdb_transaction_transaction caosdb_transaction_transaction
typedef struct caosdb_transaction_result_set caosdb_transaction_result_set
typedef struct caosdb_entity_entity caosdb_entity_entity
typedef struct caosdb_entity_property caosdb_entity_property
typedef struct caosdb_entity_parent caosdb_entity_parent
typedef struct caosdb_entity_message caosdb_entity_message
typedef struct caosdb_entity_value caosdb_entity_value
typedef struct caosdb_entity_datatype caosdb_entity_datatype

Functions

int caosdb_constants_LIBCAOSDB_VERSION_MAJOR()

Return the constant caosdb::LIBCAOSDB_VERSION_MAJOR.

int caosdb_constants_LIBCAOSDB_VERSION_MINOR()

Return the constant caosdb::LIBCAOSDB_VERSION_MINOR

int caosdb_constants_LIBCAOSDB_VERSION_PATCH()

Return the constant caosdb::LIBCAOSDB_VERSION_PATCH.

int caosdb_constants_COMPATIBLE_SERVER_VERSION_MAJOR()

Return the constant caosdb::COMPATIBLE_SERVER_VERSION_MAJOR.

int caosdb_constants_COMPATIBLE_SERVER_VERSION_MINOR()

Return the constant caosdb::COMPATIBLE_SERVER_VERSION_MINOR.

int caosdb_constants_COMPATIBLE_SERVER_VERSION_PATCH()

Return the constant caosdb::COMPATIBLE_SERVER_VERSION_PATCH.

const char *caosdb_constants_COMPATIBLE_SERVER_VERSION_PRE_RELEASE()

Return the constant caosdb::COMPATIBLE_SERVER_VERSION_PRE_RELEASE.

int caosdb_status_code_OTHER_CLIENT_ERROR()

Return the status code reserved for errors in clients wrapping this interface.

const char *caosdb_utility_get_env_fallback(const char *name, const char *fallback)

Return the environment variable of the given name.

If the environment variable is not set, return the fallback instead.

const char *caosdb_get_status_description(int code)

Return a description of the status code.

int caosdb_connection_create_pem_file_certificate_provider(caosdb_connection_certificate_provider *out, const char *path)

Create a pem-file certificate provider.

Use the destructor function caosdb_connection_delete_certificate_provider to free the wrapped provider.

EXPERT USE ONLY. Memory management with this function is a bit tricky. Only use it when you know what you are doing.

int caosdb_connection_delete_certificate_provider(caosdb_connection_certificate_provider *provider)

Destructor function for a certificate provider.

EXPERT USE ONLY. Only use it when you know what you are doing.

int caosdb_connection_create_tls_connection_configuration(caosdb_connection_connection_configuration *out, const char *host, const int port, caosdb_authentication_authenticator *authenticator, caosdb_connection_certificate_provider *provider)

Create a tls-secured connection configuration.

The configuration is needed to instantiate a connection.

Use the destructor function caosdb_connection_delete_connection_configuration to free the wrapped configuration.

EXPERT USE ONLY. Memory management with this function is a bit tricky. Only use it when you know what you are doing.

int caosdb_connection_create_insecure_connection_configuration(caosdb_connection_connection_configuration *out, const char *host, const int port)

Create a tls-secured connection configuration.

The configuration is needed to instantiate a connection.

Use caosdb_connection_create_tls_connection_configuration for a tls-secured connection which also supports authentication.

Use the destructor function caosdb_connection_delete_connection_configuration to free the wrapped configuration.

EXPERT USE ONLY. Memory management with this function is a bit tricky. Only use it when you know what you are doing.

int caosdb_connection_delete_connection_configuration(caosdb_connection_connection_configuration *configuration)

Destructor function for the caosdb_connection_connection_configuration struct.

EXPERT USE ONLY. Only use it when you know what you are doing.

int caosdb_connection_configuration_add_cacert(caosdb_connection_connection_configuration *configuration, const char *cacert)

Add a public certificate of a trusted certificate authority to an existing, tls-enabled connection configuration.

Parameters

cacert – path to a pem-file.

int caosdb_authentication_create_plain_password_authenticator(caosdb_authentication_authenticator *out, const char *username, const char *password)

Create a plain password authenticator.

Use the destructor function caosdb_authentication_delete_authenticator to free the wrapped authenticator.

EXPERT USE ONLY. Memory management with this function is a bit tricky. Only use it when you know what you are doing.

int caosdb_authentication_delete_authenticator(caosdb_authentication_authenticator *authenticator)

Destructor function for the caosdb_authentication_authenticator struct.

EXPERT USE ONLY. Only use it when you know what you are doing.

int caosdb_connection_create_connection(caosdb_connection_connection *out, const caosdb_connection_connection_configuration *configuration)

Create a connection instance.

The connection is needed to create transactions and to initiate any other interaction with a CaosDB server.

Use the destructor function caosdb_connection_delete_connection to free the wrapped connection.

EXPERT USE ONLY. Memory management with this function is a bit tricky. Only use it when you know what you are doing.

int caosdb_connection_delete_connection(caosdb_connection_connection *connection)

Destructor function for the caosdb_connection_connection struct.

EXPERT USE ONLY. Only use it when you know what you are doing.

int caosdb_connection_get_version_info(caosdb_info_version_info *out, const caosdb_connection_connection *connection)

Request the version of the server.

int caosdb_connection_connection_manager_get_default_connection(caosdb_connection_connection *out)

Get the default connection from the ConnectionManager.

The default connection is to be specified in a configuration file.

int caosdb_connection_connection_manager_get_connection(caosdb_connection_connection *out, const char *name)

Get a named connection from the ConnectionManager.

The named connection is to be specified in a configuration file.

int caosdb_connection_connection_create_transaction(caosdb_connection_connection *connection, caosdb_transaction_transaction *out)

Create a transaction on an existing connection.

This transaction has to be deleted manually by caosdb_transaction_delete_transaction() later on.

int caosdb_transaction_delete_transaction(caosdb_transaction_transaction *transaction)
int caosdb_transaction_transaction_retrieve_by_id(caosdb_transaction_transaction *transaction, const char *id)
int caosdb_transaction_transaction_retrieve_and_download_file_by_id(caosdb_transaction_transaction *transaction, const char *id, const char *path)
int caosdb_transaction_transaction_retrieve_by_ids(caosdb_transaction_transaction *transaction, const char *ids[], int length)
int caosdb_transaction_transaction_query(caosdb_transaction_transaction *transaction, const char *query)
int caosdb_transaction_transaction_execute(caosdb_transaction_transaction *transaction)
int caosdb_transaction_transaction_get_result_set(caosdb_transaction_transaction *transaction, caosdb_transaction_result_set *out)
int caosdb_transaction_transaction_release_result_set(caosdb_transaction_transaction *transaction, caosdb_transaction_result_set *out)

Release the result set from the transaction.

The transactions is spoiled after this action and should not be used anymore.

Note: The result_set has to be deleted via caosdb_transaction_delete_result_set.

EXPERT USE ONLY. Only use it when you know what you are doing.

int caosdb_transaction_result_set_release_at(caosdb_transaction_result_set *result_set, caosdb_entity_entity *entity, int index)

Release the entity from the result set.

Each entity (each index) can be released once. The result set is spoiled after this action and should not be used for anything else anymore.

Note: The result_set has to be deleted via caosdb_entity_delete_entity.

EXPERT USE ONLY. Only use it when you know what you are doing.

int caosdb_transaction_delete_result_set(caosdb_transaction_result_set *result_set)

Destructor for caosdb_transaction_result_set.

EXPERT USE ONLY. Only use it when you know what you are doing.

int caosdb_transaction_transaction_get_count_result(caosdb_transaction_transaction *transaction, long *out)
int caosdb_transaction_result_set_at(caosdb_transaction_result_set *result_set, caosdb_entity_entity *entity, int index)
int caosdb_transaction_result_set_size(caosdb_transaction_result_set *result_set, int *out)
int caosdb_transaction_transaction_insert_entity(caosdb_transaction_transaction *transaction, caosdb_entity_entity *entity)
int caosdb_transaction_transaction_update_entity(caosdb_transaction_transaction *transaction, caosdb_entity_entity *entity)
int caosdb_transaction_transaction_delete_by_id(caosdb_transaction_transaction *transaction, const char *id)
int caosdb_entity_entity_get_id(caosdb_entity_entity *entity, char **out)
int caosdb_entity_entity_get_role(caosdb_entity_entity *entity, char **out)
int caosdb_entity_entity_get_name(caosdb_entity_entity *entity, char **out)
int caosdb_entity_entity_get_description(caosdb_entity_entity *entity, char **out)
int caosdb_entity_entity_get_local_path(caosdb_entity_entity *entity, char **out)
int caosdb_entity_entity_get_datatype(caosdb_entity_entity *entity, caosdb_entity_datatype *out)
int caosdb_entity_entity_get_unit(caosdb_entity_entity *entity, char **out)
int caosdb_entity_entity_get_value(caosdb_entity_entity *entity, caosdb_entity_value *out)
int caosdb_entity_entity_get_version_id(caosdb_entity_entity *entity, char **out)
int caosdb_entity_entity_get_errors_size(caosdb_entity_entity *entity, int *out)
int caosdb_entity_entity_get_error(caosdb_entity_entity *entity, caosdb_entity_message *out, int index)
int caosdb_entity_entity_get_warnings_size(caosdb_entity_entity *entity, int *out)
int caosdb_entity_entity_get_warning(caosdb_entity_entity *entity, caosdb_entity_message *out, int index)
int caosdb_entity_entity_get_infos_size(caosdb_entity_entity *entity, int *out)
int caosdb_entity_entity_get_info(caosdb_entity_entity *entity, caosdb_entity_message *out, int index)
int caosdb_entity_entity_get_properties_size(caosdb_entity_entity *entity, int *out)
int caosdb_entity_entity_get_property(caosdb_entity_entity *entity, caosdb_entity_property *out, int index)
int caosdb_entity_entity_get_parents_size(caosdb_entity_entity *entity, int *out)
int caosdb_entity_entity_get_parent(caosdb_entity_entity *entity, caosdb_entity_parent *out, int index)
int caosdb_entity_property_get_id(caosdb_entity_property *property, char **out)
int caosdb_entity_property_get_name(caosdb_entity_property *property, char **out)
int caosdb_entity_property_get_description(caosdb_entity_property *property, char **out)
int caosdb_entity_property_get_importance(caosdb_entity_property *property, char **out)
int caosdb_entity_property_get_datatype(caosdb_entity_property *property, caosdb_entity_datatype *out)
int caosdb_entity_property_get_unit(caosdb_entity_property *property, char **out)
int caosdb_entity_property_get_value(caosdb_entity_property *property, caosdb_entity_value *out)
int caosdb_entity_parent_get_id(caosdb_entity_parent *parent, char **out)
int caosdb_entity_parent_get_name(caosdb_entity_parent *parent, char **out)
int caosdb_entity_parent_get_description(caosdb_entity_parent *parent, char **out)
int caosdb_entity_message_get_code(caosdb_entity_message *message, int *out)
int caosdb_entity_message_get_description(caosdb_entity_message *message, char **out)
int caosdb_entity_datatype_is_undefined(caosdb_entity_datatype *datatype, bool *out)
int caosdb_entity_datatype_is_atomic(caosdb_entity_datatype *datatype, bool *out)
int caosdb_entity_datatype_is_reference(caosdb_entity_datatype *datatype, bool *out)
int caosdb_entity_datatype_is_list_of_atomic(caosdb_entity_datatype *datatype, bool *out)
int caosdb_entity_datatype_is_list_of_reference(caosdb_entity_datatype *datatype, bool *out)
int caosdb_entity_datatype_get_datatype_name(caosdb_entity_datatype *datatype, char **out)
int caosdb_entity_value_is_null(caosdb_entity_value *value, bool *out)
int caosdb_entity_value_is_string(caosdb_entity_value *value, bool *out)
int caosdb_entity_value_is_double(caosdb_entity_value *value, bool *out)
int caosdb_entity_value_is_integer(caosdb_entity_value *value, bool *out)
int caosdb_entity_value_is_bool(caosdb_entity_value *value, bool *out)
int caosdb_entity_value_is_vector(caosdb_entity_value *value, bool *out)
int caosdb_entity_value_get_as_string(caosdb_entity_value *value, char **out)
int caosdb_entity_value_get_as_double(caosdb_entity_value *value, double *out)
int caosdb_entity_value_get_as_integer(caosdb_entity_value *value, int64_t *out)
int caosdb_entity_value_get_as_bool(caosdb_entity_value *value, bool *out)
int caosdb_entity_value_get_as_vector_size(caosdb_entity_value *value, int *out)
int caosdb_entity_value_get_as_vector_at(caosdb_entity_value *value, caosdb_entity_value *out, const int index)
int caosdb_entity_create_entity(caosdb_entity_entity *out)
int caosdb_entity_delete_entity(caosdb_entity_entity *out)
int caosdb_entity_create_property(caosdb_entity_property *out)
int caosdb_entity_delete_property(caosdb_entity_property *out)
int caosdb_entity_create_parent(caosdb_entity_parent *out)
int caosdb_entity_delete_parent(caosdb_entity_parent *out)
int caosdb_entity_create_atomic_datatype(caosdb_entity_datatype *out, const char *name)
int caosdb_entity_create_reference_datatype(caosdb_entity_datatype *out, const char *name)
int caosdb_entity_create_atomic_list_datatype(caosdb_entity_datatype *out, const char *name)
int caosdb_entity_create_reference_list_datatype(caosdb_entity_datatype *out, const char *name)
int caosdb_entity_delete_datatype(caosdb_entity_datatype *out)
int caosdb_entity_create_int_value(caosdb_entity_value *out, const int64_t value)
int caosdb_entity_create_string_value(caosdb_entity_value *out, const char *value)
int caosdb_entity_create_double_value(caosdb_entity_value *out, const double value)
int caosdb_entity_create_bool_value(caosdb_entity_value *out, const bool value)
int caosdb_entity_create_int_vector_value(caosdb_entity_value *out, const int64_t *value, const int length)
int caosdb_entity_create_string_vector_value(caosdb_entity_value *out, const char **value, const int length)
int caosdb_entity_create_double_vector_value(caosdb_entity_value *out, const double *value, const int length)
int caosdb_entity_create_bool_vector_value(caosdb_entity_value *out, const bool *value, const int length)
int caosdb_entity_delete_value(caosdb_entity_value *out)
int caosdb_entity_entity_set_role(caosdb_entity_entity *entity, const char *role)
int caosdb_entity_entity_set_name(caosdb_entity_entity *entity, const char *name)
int caosdb_entity_entity_set_description(caosdb_entity_entity *entity, const char *description)
int caosdb_entity_entity_set_local_path(caosdb_entity_entity *entity, const char *name)
int caosdb_entity_entity_set_file_path(caosdb_entity_entity *entity, const char *name)
int caosdb_entity_entity_set_datatype(caosdb_entity_entity *entity, caosdb_entity_datatype *datatype)
int caosdb_entity_entity_set_unit(caosdb_entity_entity *entity, const char *unit)
int caosdb_entity_entity_set_value(caosdb_entity_entity *entity, caosdb_entity_value *value)
int caosdb_entity_entity_append_parent(caosdb_entity_entity *entity, caosdb_entity_parent *parent)
int caosdb_entity_entity_remove_parent(caosdb_entity_entity *entity, int index)
int caosdb_entity_entity_append_property(caosdb_entity_entity *entity, caosdb_entity_property *property)
int caosdb_entity_entity_remove_property(caosdb_entity_entity *entity, int index)
int caosdb_entity_property_set_id(caosdb_entity_property *property, const char *id)
int caosdb_entity_property_set_name(caosdb_entity_property *property, const char *name)
int caosdb_entity_property_set_datatype(caosdb_entity_property *property, caosdb_entity_datatype *datatype)
int caosdb_entity_property_set_importance(caosdb_entity_property *property, const char *importance)
int caosdb_entity_property_set_unit(caosdb_entity_property *property, const char *unit)
int caosdb_entity_property_set_value(caosdb_entity_property *property, caosdb_entity_value *value)
int caosdb_entity_parent_set_id(caosdb_entity_parent *parent, const char *id)
int caosdb_entity_parent_set_name(caosdb_entity_parent *parent, const char *name)
struct caosdb_connection_connection
#include <ccaosdb.h>

A wrapper of the C++ Connection class.

We use a wrapper for future extensibility and in order to have a minimal capability for type checking in C even though the C++ class Connection is opaque in C.

Public Members

void *wrapped_connection
bool _deletable
struct caosdb_connection_connection_configuration
#include <ccaosdb.h>

A wrapper of the C++ ConnectionConfiguration class.

We use a wrapper for future extensibility and in order to have a minimal capability for type checking in C even though the C++ class Connection is opaque in C.

Public Members

void *wrapped_connection_configuration
bool _deletable
struct caosdb_info_version_info
#include <ccaosdb.h>

A wrapper of the C++ VersionInfo class.

We use a wrapper for future extensibility and in order to have a minimal capability for type checking in C even though the C++ class Connection is opaque in C.

Public Members

int major
int minor
int patch
const char *pre_release
const char *build
struct caosdb_connection_certificate_provider

Public Members

void *wrapped_certificate_provider
bool _deletable
struct caosdb_authentication_authenticator

Public Members

void *wrapped_authenticator
bool _deletable
struct caosdb_transaction_transaction

Public Members

void *wrapped_transaction
bool _deletable
struct caosdb_transaction_result_set

Public Members

void *wrapped_result_set
bool _deletable
struct caosdb_entity_entity

Public Members

void *wrapped_entity
bool _deletable
struct caosdb_entity_property

Public Members

void *wrapped_property
bool _deletable
struct caosdb_entity_parent

Public Members

void *wrapped_parent
bool _deletable
struct caosdb_entity_message

Public Members

void *wrapped_message
bool _deletable
struct caosdb_entity_value

Public Members

void *wrapped_value
bool _deletable
struct caosdb_entity_datatype

Public Members

void *wrapped_datatype
bool _deletable