db_configuration.c File Reference
`#include "db_configuration.h"`
`#include "db_error.h"`
`#include <stdlib.h>`
`#include <string.h>`

Go to the source code of this file.

## Functions

db_configuration_t * | db_configuration_new (void)
void | db_configuration_free (db_configuration_t *configuration)
const char * | db_configuration_value (const db_configuration_t *configuration)
int | db_configuration_set_name (db_configuration_t *configuration, const char *name)
int | db_configuration_set_value (db_configuration_t *configuration, const char *value)
int | db_configuration_not_empty (const db_configuration_t *configuration)
db_configuration_list_t * | db_configuration_list_new (void)
void | db_configuration_list_free (db_configuration_list_t *configuration_list)
int | db_configuration_list_add (db_configuration_list_t *configuration_list, db_configuration_t *configuration)
const db_configuration_t * | db_configuration_list_find (const db_configuration_list_t *configuration_list, const char *name)

## Function Documentation

## db_configuration_free()

void db_configuration_free | ( | db_configuration_t * | configuration | ) |

Delete a database configuration.

Parameters

  [in] | configuration | a db_configuration_t pointer.

Definition at line 48 of file db_configuration.c.

Referenced by clean_suite_classes(), clean_suite_database_operations(), and clean_suite_initialization().

## db_configuration_list_add()

int db_configuration_list_add | ( | db_configuration_list_t * | configuration_list,
|  | db_configuration_t * | configuration
| ) |  |

free global allocator. db_configuration_list_free MUST be called for all its contents. Add a database configuration to a database configuration list, this takes over the ownership of the database configuration.

Parameters

  [in] | configuration_list | a db_configuration_list_t pointer.
  [in] | configuration | a db_configuration_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 150 of file db_configuration.c.

Referenced by test_initialization_configuration().

## db_configuration_list_find()

const db_configuration_t* db_configuration_list_find | ( | const db_configuration_list_t * | configuration_list,
|  | const char * | name
| ) |  |

Find a database configuration by name within a database configuration list.

Parameters

  [in] | configuration_list | a db_configuration_list_t pointer.
  [in] | name | a character pointer.

Returns
  a db_configuration_t pointer or NULL on error or if the database configuration does not exist.

Definition at line 179 of file db_configuration.c.

## db_configuration_list_free()

void db_configuration_list_free | ( | db_configuration_list_t * | configuration_list | ) |

Delete a database configuration list and all database configurations in the list.

Parameters

  [in] | configuration_list | a db_configuration_list_t pointer.

Definition at line 134 of file db_configuration.c.

Referenced by clean_suite_classes(), clean_suite_database_operations(), clean_suite_initialization(), and engine_dealloc().

## db_configuration_list_new()

db_configuration_list_t* db_configuration_list_new | ( | void |  | ) |

Create a new database configuration list.

Returns
  a db_configuration_list_t pointer or NULL on error.

Definition at line 127 of file db_configuration.c.

Referenced by test_initialization_configuration().

## db_configuration_new()

db_configuration_t* db_configuration_new | ( | void |  | ) |

Create a new database configuration.

Returns
  a db_configuration_t pointer or NULL on error.

Definition at line 41 of file db_configuration.c.

Referenced by test_class_db_configuration(), and test_initialization_configuration().

## db_configuration_not_empty()

int db_configuration_not_empty | ( | const db_configuration_t * | configuration | ) |

Check if the database configuration is not empty.

Parameters

  [in] | configuration | a db_configuration_t pointer.

Returns
  DB_ERROR_* if empty, otherwise DB_OK.

Definition at line 110 of file db_configuration.c.

Referenced by test_class_db_configuration().

## db_configuration_set_name()

int db_configuration_set_name | ( | db_configuration_t * | configuration,
|  | const char * | name
| ) |  |

Set the name of a database configuration.

Parameters

  [in] | configuration | a db_configuration_t pointer.
  [in] | name | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 68 of file db_configuration.c.

Referenced by test_class_db_configuration(), and test_initialization_configuration().

## db_configuration_set_value()

int db_configuration_set_value | ( | db_configuration_t * | configuration,
|  | const char * | value
| ) |  |

Set the value of a database configuration.

Parameters

  [in] | configuration | a db_configuration_t pointer.
  [in] | value | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 89 of file db_configuration.c.

Referenced by test_class_db_configuration(), and test_initialization_configuration().

## db_configuration_value()

const char* db_configuration_value | ( | const db_configuration_t * | configuration | ) |

Get the value of a database configuration.

Parameters

  [in] | configuration | a db_configuration_t pointer.

Returns
  a character pointer or NULL on error or if no database configuration value has been set.

Definition at line 60 of file db_configuration.c.

Referenced by test_class_db_configuration().