OpenDNSSEC-enforcer 2.1.13
Data Structures | Typedefs | Functions
db_connection.h File Reference
#include "db_configuration.h"
#include "db_backend.h"
#include "db_result.h"
#include "db_object.h"
#include "db_join.h"
#include "db_clause.h"

Go to the source code of this file.

Data Structures

struct  db_connection
 

Typedefs

typedef struct db_connection db_connection_t
 

Functions

db_connection_tdb_connection_new (void)
 
void db_connection_free (db_connection_t *connection)
 
int db_connection_set_configuration_list (db_connection_t *connection, const db_configuration_list_t *configuration_list)
 
int db_connection_setup (db_connection_t *connection)
 
int db_connection_connect (const db_connection_t *connection)
 
int db_connection_create (const db_connection_t *connection, const db_object_t *object, const db_object_field_list_t *object_field_list, const db_value_set_t *value_set)
 
db_result_list_tdb_connection_read (const db_connection_t *connection, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list)
 
int db_connection_update (const db_connection_t *connection, const db_object_t *object, const db_object_field_list_t *object_field_list, const db_value_set_t *value_set, const db_clause_list_t *clause_list)
 
int db_connection_delete (const db_connection_t *connection, const db_object_t *object, const db_clause_list_t *clause_list)
 
int db_connection_count (const db_connection_t *connection, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list, size_t *count)
 

Typedef Documentation

◆ db_connection_t

Definition at line 34 of file db_connection.h.

Function Documentation

◆ db_connection_connect()

int db_connection_connect ( const db_connection_t connection)
extern

Connect to the database.

Parameters
[in]connectiona db_connection_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 88 of file db_connection.c.

References db_connection::backend, db_connection::configuration_list, db_backend_connect(), and DB_ERROR_UNKNOWN.

Referenced by get_database_connection(), test_class_db_connection(), and test_initialization_connection().

◆ db_connection_count()

int db_connection_count ( const db_connection_t connection,
const db_object_t object,
const db_join_list_t join_list,
const db_clause_list_t clause_list,
size_t *  count 
)
extern

Count objects from the database. Return the count in count.

Parameters
[in]connectiona db_connection_t pointer.
[in]objecta db_object_t pointer.
[in]join_lista db_join_list_t pointer.
[in]clause_lista db_clause_list_t pointer.
[out]counta size_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 170 of file db_connection.c.

References db_connection::backend, db_backend_count(), and DB_ERROR_UNKNOWN.

Referenced by db_object_count(), and test_class_db_connection().

◆ db_connection_create()

int db_connection_create ( const db_connection_t connection,
const db_object_t object,
const db_object_field_list_t object_field_list,
const db_value_set_t value_set 
)
extern

Create an object in the database. The object refer to the database object begin created, the object_field_list describes the fields that should be set in the object and the value_set has the values for each field.

Parameters
[in]connectiona db_connection_t pointer.
[in]objecta db_object_t pointer.
[in]object_field_lista db_object_field_list_t pointer.
[in]value_seta db_value_set_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 102 of file db_connection.c.

References db_connection::backend, db_backend_create(), and DB_ERROR_UNKNOWN.

Referenced by db_object_create(), and test_class_db_connection().

◆ db_connection_delete()

int db_connection_delete ( const db_connection_t connection,
const db_object_t object,
const db_clause_list_t clause_list 
)
extern

Delete an object or objects from the database.

Parameters
[in]connectiona db_connection_t pointer.
[in]objecta db_object_t pointer.
[in]clause_lista db_clause_list_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 156 of file db_connection.c.

References db_connection::backend, db_backend_delete(), and DB_ERROR_UNKNOWN.

Referenced by db_object_delete(), and test_class_db_connection().

◆ db_connection_free()

void db_connection_free ( db_connection_t connection)
extern

Delete a database connection and the database backend within.

Parameters
[in]connectiona db_connection_t pointer.

Definition at line 45 of file db_connection.c.

References db_connection::backend, and db_backend_free().

Referenced by autostart(), clean_suite_classes(), clean_suite_database_operations(), clean_suite_initialization(), enforce_task_flush_all(), engine_setup(), engine_stop_workers(), get_database_connection(), and test_class_end().

◆ db_connection_new()

db_connection_t * db_connection_new ( void  )
extern

Create a new database connection.

Returns
a db_connection_t pointer or NULL on error.

Definition at line 38 of file db_connection.c.

Referenced by get_database_connection(), test_class_db_connection(), and test_initialization_connection().

◆ db_connection_read()

db_result_list_t * db_connection_read ( const db_connection_t connection,
const db_object_t object,
const db_join_list_t join_list,
const db_clause_list_t clause_list 
)
extern

Read an object or objects from the database.

Parameters
[in]connectiona db_connection_t pointer.
[in]objecta db_object_t pointer.
[in]join_lista db_join_list_t pointer.
[in]clause_lista db_clause_list_t pointer.
Returns
a db_result_list_t pointer or NULL on error or if no objects where read.

Definition at line 122 of file db_connection.c.

References db_connection::backend, and db_backend_read().

Referenced by db_object_read(), and test_class_db_connection().

◆ db_connection_set_configuration_list()

int db_connection_set_configuration_list ( db_connection_t connection,
const db_configuration_list_t configuration_list 
)
extern

Set the database configuration list for a database connection.

Parameters
[in]connectiona db_connection_t pointer.
[in]configuration_lista db_configuration_list_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 54 of file db_connection.c.

References db_connection::configuration_list, DB_ERROR_UNKNOWN, and DB_OK.

Referenced by get_database_connection(), test_class_db_connection(), and test_initialization_connection().

◆ db_connection_setup()

int db_connection_setup ( db_connection_t connection)
extern

Setup the database connection, this verifies the information in the database configuration list and allocated a database backend.

Parameters
[in]connectiona db_connection_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 66 of file db_connection.c.

References db_connection::backend, db_connection::configuration_list, db_backend_factory_get_backend(), db_configuration_list_find(), db_configuration_value(), DB_ERROR_UNKNOWN, and DB_OK.

Referenced by get_database_connection(), test_class_db_connection(), and test_initialization_connection().

◆ db_connection_update()

int db_connection_update ( const db_connection_t connection,
const db_object_t object,
const db_object_field_list_t object_field_list,
const db_value_set_t value_set,
const db_clause_list_t clause_list 
)
extern

Update an object or objects in the database.

Parameters
[in]connectiona db_connection_t pointer.
[in]objecta db_object_t pointer.
[in]object_field_lista db_object_field_list_t pointer.
[in]value_seta db_value_set_t pointer.
[in]clause_lista db_clause_list_t pointer.
Returns
DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 136 of file db_connection.c.

References db_connection::backend, db_backend_update(), and DB_ERROR_UNKNOWN.

Referenced by db_object_update(), and test_class_db_connection().