db_backend.h File Reference
`#include "db_configuration.h"`
`#include "db_result.h"`
`#include "db_object.h"`
`#include "db_join.h"`
`#include "db_clause.h"`
`#include "db_value.h"`

Go to the source code of this file.

## Data Structures

struct | db_backend_handle
struct | db_backend

## Typedefs

typedef struct db_backend_handle | db_backend_handle_t
typedef struct db_backend | db_backend_t
typedef int(* | db_backend_handle_initialize_t) (void *data)
typedef int(* | db_backend_handle_shutdown_t) (void *data)
typedef int(* | db_backend_handle_connect_t) (void *data, const db_configuration_list_t *configuration_list)
typedef int(* | db_backend_handle_disconnect_t) (void *data)
typedef int(* | db_backend_handle_create_t) (void *data, const db_object_t *object, const db_object_field_list_t *object_field_list, const db_value_set_t *value_set)
typedef db_result_list_t *(* | db_backend_handle_read_t) (void *data, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list)
typedef int(* | db_backend_handle_update_t) (void *data, 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)
typedef int(* | db_backend_handle_delete_t) (void *data, const db_object_t *object, const db_clause_list_t *clause_list)
typedef int(* | db_backend_handle_count_t) (void *data, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list, size_t *count)
typedef void(* | db_backend_handle_free_t) (void *data)
typedef int(* | db_backend_handle_transaction_begin_t) (void *data)
typedef int(* | db_backend_handle_transaction_commit_t) (void *data)
typedef int(* | db_backend_handle_transaction_rollback_t) (void *data)

## Functions

db_backend_handle_t * | db_backend_handle_new (void)
void | db_backend_handle_free (db_backend_handle_t *backend_handle)
int | db_backend_handle_initialize (const db_backend_handle_t *backend_handle)
int | db_backend_handle_connect (const db_backend_handle_t *backend_handle, const db_configuration_list_t *configuration_list)
int | db_backend_handle_create (const db_backend_handle_t *backend_handle, const db_object_t *object, const db_object_field_list_t *object_field_list, const db_value_set_t *value_set)
db_result_list_t * | db_backend_handle_read (const db_backend_handle_t *backend_handle, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list)
int | db_backend_handle_update (const db_backend_handle_t *backend_handle, 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_backend_handle_delete (const db_backend_handle_t *backend_handle, const db_object_t *object, const db_clause_list_t *clause_list)
int | db_backend_handle_count (const db_backend_handle_t *backend_handle, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list, size_t *count)
int | db_backend_handle_set_initialize (db_backend_handle_t *backend_handle, db_backend_handle_initialize_t initialize_function)
int | db_backend_handle_set_shutdown (db_backend_handle_t *backend_handle, db_backend_handle_shutdown_t shutdown_function)
int | db_backend_handle_set_connect (db_backend_handle_t *backend_handle, db_backend_handle_connect_t connect_function)
int | db_backend_handle_set_disconnect (db_backend_handle_t *backend_handle, db_backend_handle_disconnect_t disconnect_function)
int | db_backend_handle_set_create (db_backend_handle_t *backend_handle, db_backend_handle_create_t create_function)
int | db_backend_handle_set_read (db_backend_handle_t *backend_handle, db_backend_handle_read_t read_function)
int | db_backend_handle_set_update (db_backend_handle_t *backend_handle, db_backend_handle_update_t update_function)
int | db_backend_handle_set_delete (db_backend_handle_t *backend_handle, db_backend_handle_delete_t delete_function)
int | db_backend_handle_set_count (db_backend_handle_t *backend_handle, db_backend_handle_count_t count_function)
int | db_backend_handle_set_free (db_backend_handle_t *backend_handle, db_backend_handle_free_t free_function)
int | db_backend_handle_set_transaction_begin (db_backend_handle_t *backend_handle, db_backend_handle_transaction_begin_t transaction_begin_function)
int | db_backend_handle_set_transaction_commit (db_backend_handle_t *backend_handle, db_backend_handle_transaction_commit_t transaction_commit_function)
int | db_backend_handle_set_transaction_rollback (db_backend_handle_t *backend_handle, db_backend_handle_transaction_rollback_t transaction_rollback_function)
int | db_backend_handle_set_data (db_backend_handle_t *backend_handle, void *data)
db_backend_t * | db_backend_new (void)
void | db_backend_free (db_backend_t *backend)
const db_backend_handle_t * | db_backend_handle (const db_backend_t *backend)
int | db_backend_set_name (db_backend_t *backend, const char *name)
int | db_backend_set_handle (db_backend_t *backend, db_backend_handle_t *handle)
int | db_backend_initialize (const db_backend_t *backend)
int | db_backend_connect (const db_backend_t *backend, const db_configuration_list_t *configuration_list)
int | db_backend_create (const db_backend_t *backend, const db_object_t *object, const db_object_field_list_t *object_field_list, const db_value_set_t *value_set)
db_result_list_t * | db_backend_read (const db_backend_t *backend, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list)
int | db_backend_update (const db_backend_t *backend, 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_backend_delete (const db_backend_t *backend, const db_object_t *object, const db_clause_list_t *clause_list)
int | db_backend_count (const db_backend_t *backend, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list, size_t *count)
db_backend_t * | db_backend_factory_get_backend (const char *name)

## Typedef Documentation

## db_backend_handle_connect_t

typedef int(* db_backend_handle_connect_t) (void *data, const db_configuration_list_t *configuration_list)

Function pointer for connecting a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.
  [in] | configuration_list | a db_configuration_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 68 of file db_backend.h.

## db_backend_handle_count_t

typedef int(* db_backend_handle_count_t) (void *data, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list, size_t *count)

Function pointer for counting objects from database backend. The backend handle specific data is supplied in `data`. Returns the size in `size`.

Parameters

  [in] | data | a void pointer.
  [in] | object | a db_object_t pointer.
  [in] | join_list | a db_join_list_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.
  [out] | count | a size_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 133 of file db_backend.h.

## db_backend_handle_create_t

typedef int(* db_backend_handle_create_t) (void *data, const db_object_t *object, const db_object_field_list_t *object_field_list, const db_value_set_t *value_set)

Function pointer for creating a object in a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.
  [in] | object | a db_object_t pointer.
  [in] | object_field_list | a db_object_field_list_t pointer.
  [in] | value_set | a db_value_set_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 87 of file db_backend.h.

## db_backend_handle_delete_t

typedef int(* db_backend_handle_delete_t) (void *data, const db_object_t *object, const db_clause_list_t *clause_list)

Function pointer for deleting objects from database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.
  [in] | object | a db_object_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 121 of file db_backend.h.

## db_backend_handle_disconnect_t

typedef int(* db_backend_handle_disconnect_t) (void *data)

Function pointer for disconnecting a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 76 of file db_backend.h.

## db_backend_handle_free_t

typedef void(* db_backend_handle_free_t) (void *data)

Function pointer for freeing the backend handle specific data in `data`.

Parameters

  [in] | data | a void pointer.

Definition at line 139 of file db_backend.h.

## db_backend_handle_initialize_t

typedef int(* db_backend_handle_initialize_t) (void *data)

Function pointer for initializing a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 51 of file db_backend.h.

## db_backend_handle_read_t

typedef db_result_list_t *(* db_backend_handle_read_t) (void *data, const db_object_t *object, const db_join_list_t *join_list, const db_clause_list_t *clause_list)

Function pointer for reading objects from database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.
  [in] | object | a db_object_t pointer.
  [in] | join_list | a db_join_list_t pointer.
  [in] | clause_list | a 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 99 of file db_backend.h.

## db_backend_handle_shutdown_t

typedef int(* db_backend_handle_shutdown_t) (void *data)

Function pointer for shutting down a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 59 of file db_backend.h.

## db_backend_handle_t

typedef struct db_backend_handle db_backend_handle_t

Definition at line 35 of file db_backend.h.

## db_backend_handle_transaction_begin_t

typedef int(* db_backend_handle_transaction_begin_t) (void *data)

Function pointer for beginning a transaction in a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 147 of file db_backend.h.

## db_backend_handle_transaction_commit_t

typedef int(* db_backend_handle_transaction_commit_t) (void *data)

Function pointer for committing a transaction in a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 155 of file db_backend.h.

## db_backend_handle_transaction_rollback_t

typedef int(* db_backend_handle_transaction_rollback_t) (void *data)

Function pointer for rolling back a transaction in a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 163 of file db_backend.h.

## db_backend_handle_update_t

typedef int(* db_backend_handle_update_t) (void *data, 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)

Function pointer for updating objects in a database backend. The backend handle specific data is supplied in `data`.

Parameters

  [in] | data | a void pointer.
  [in] | object | a db_object_t pointer.
  [in] | object_field_list | a db_object_field_list_t pointer.
  [in] | value_set | a db_value_set_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 111 of file db_backend.h.

## db_backend_t

typedef struct db_backend db_backend_t

Definition at line 36 of file db_backend.h.

## Function Documentation

## db_backend_connect()

int db_backend_connect | ( | const db_backend_t * | backend,
|  | const db_configuration_list_t * | configuration_list
| ) |  |

extern

Connect to the database of a database backend, the connection specific configuration is given by `configuration_list`.

Parameters

  [in] | backend | a db_backend_t pointer.
  [in] | configuration_list | a db_configuration_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 371 of file db_backend.c.

References db_backend_handle_connect(), DB_ERROR_UNKNOWN, and db_backend::handle.

Referenced by db_connection_connect(), and test_class_db_backend().

## db_backend_count()

int db_backend_count | ( | const db_backend_t * | backend,
|  | 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] | backend | a db_backend_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | join_list | a db_join_list_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.
  [out] | count | a size_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 453 of file db_backend.c.

References db_backend_handle_count(), DB_ERROR_UNKNOWN, and db_backend::handle.

Referenced by db_connection_count(), and test_class_db_backend().

## db_backend_create()

int db_backend_create | ( | const db_backend_t * | backend,
|  | 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] | backend | a db_backend_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | object_field_list | a db_object_field_list_t pointer.
  [in] | value_set | a db_value_set_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 385 of file db_backend.c.

References db_backend_handle_create(), DB_ERROR_UNKNOWN, and db_backend::handle.

Referenced by db_connection_create(), and test_class_db_backend().

## db_backend_delete()

int db_backend_delete | ( | const db_backend_t * | backend,
|  | const db_object_t * | object,
|  | const db_clause_list_t * | clause_list
| ) |  |

extern

Delete an object or objects from the database.

Parameters

  [in] | backend | a db_backend_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 439 of file db_backend.c.

References db_backend_handle_delete(), DB_ERROR_UNKNOWN, and db_backend::handle.

Referenced by db_connection_delete(), and test_class_db_backend().

## db_backend_factory_get_backend()

db_backend_t * db_backend_factory_get_backend | ( | const char * | name | ) |

extern

Get a new database backend by the name supplied in `name`.

Parameters

  [in] | name | a character pointer.

Returns
  a db_backend_t pointer or NULL on error or if the database backend does not exist.

Definition at line 472 of file db_backend.c.

References db_backend_free(), db_backend_initialize(), db_backend_mysql_new_handle(), db_backend_new(), db_backend_set_handle(), db_backend_set_name(), and db_backend_sqlite_new_handle().

Referenced by db_connection_setup().

## db_backend_free()

void db_backend_free | ( | db_backend_t * | backend | ) |

extern

Delete a database backend.

Parameters

  [in] | backend | a db_backend_t pointer.

Definition at line 318 of file db_backend.c.

References db_backend_handle_free(), db_backend::handle, and db_backend::name.

Referenced by clean_suite_classes(), db_backend_factory_get_backend(), db_connection_free(), and test_class_end().

## db_backend_handle()

const db_backend_handle_t * db_backend_handle | ( | const db_backend_t * | backend | ) |

extern

Get the database backend handle of a database backend.

Parameters

  [in] | backend | a db_backend_t pointer.

Returns
  a db_backend_handle_t pointer or NULL on error or if no database backend handle has been set.

## db_backend_handle_connect()

int db_backend_handle_connect | ( | const db_backend_handle_t * | backend_handle,
|  | const db_configuration_list_t * | configuration_list
| ) |  |

extern

Connect to the database of a database backend, the connection specific configuration is given by `configuration_list`.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | configuration_list | a db_configuration_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 79 of file db_backend.c.

References db_backend_handle::connect_function, db_backend_handle::data, and DB_ERROR_UNKNOWN.

Referenced by db_backend_connect(), and test_class_db_backend_handle().

## db_backend_handle_count()

int db_backend_handle_count | ( | const db_backend_handle_t * | backend_handle,
|  | 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] | backend_handle | a db_backend_handle_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | join_list | a db_join_list_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.
  [out] | count | a size_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 161 of file db_backend.c.

References db_backend_handle::count_function, db_backend_handle::data, and DB_ERROR_UNKNOWN.

Referenced by db_backend_count(), and test_class_db_backend_handle().

## db_backend_handle_create()

int db_backend_handle_create | ( | const db_backend_handle_t * | backend_handle,
|  | 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] | backend_handle | a db_backend_handle_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | object_field_list | a db_object_field_list_t pointer.
  [in] | value_set | a db_value_set_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 93 of file db_backend.c.

References db_backend_handle::create_function, db_backend_handle::data, and DB_ERROR_UNKNOWN.

Referenced by db_backend_create(), and test_class_db_backend_handle().

## db_backend_handle_delete()

int db_backend_handle_delete | ( | const db_backend_handle_t * | backend_handle,
|  | const db_object_t * | object,
|  | const db_clause_list_t * | clause_list
| ) |  |

extern

Delete an object or objects from the database.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 147 of file db_backend.c.

References db_backend_handle::data, DB_ERROR_UNKNOWN, and db_backend_handle::delete_function.

Referenced by db_backend_delete(), and test_class_db_backend_handle().

## db_backend_handle_free()

void db_backend_handle_free | ( | db_backend_handle_t * | backend_handle | ) |

extern

Delete a database backend handle, disconnecting the backend and freeing the backend specific data.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.

Definition at line 56 of file db_backend.c.

References db_backend_handle::data, db_backend_handle::disconnect_function, and db_backend_handle::free_function.

Referenced by clean_suite_classes(), db_backend_free(), db_backend_mysql_new_handle(), and db_backend_sqlite_new_handle().

## db_backend_handle_initialize()

int db_backend_handle_initialize | ( | const db_backend_handle_t * | backend_handle | ) |

extern

Initiate the backend of a database backend.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 68 of file db_backend.c.

References db_backend_handle::data, DB_ERROR_UNKNOWN, and db_backend_handle::initialize_function.

Referenced by db_backend_initialize().

## db_backend_handle_new()

db_backend_handle_t * db_backend_handle_new | ( | void |  | ) |

extern

Create a new database backend handle.

Returns
  a db_backend_handle_t pointer or NULL on error.

Definition at line 49 of file db_backend.c.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_read()

db_result_list_t * db_backend_handle_read | ( | const db_backend_handle_t * | backend_handle,
|  | 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] | backend_handle | a db_backend_handle_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | join_list | a db_join_list_t pointer.
  [in] | clause_list | a 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 113 of file db_backend.c.

References db_backend_handle::data, and db_backend_handle::read_function.

Referenced by db_backend_read(), and test_class_db_backend_handle().

## db_backend_handle_set_connect()

int db_backend_handle_set_connect | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_connect_t | connect_function
| ) |  |

extern

Set the connect function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | connect_function | a db_backend_handle_connect_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 196 of file db_backend.c.

References db_backend_handle::connect_function, DB_ERROR_UNKNOWN, and DB_OK.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_count()

int db_backend_handle_set_count | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_count_t | count_function
| ) |  |

extern

Set the count function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | count_function | a db_backend_handle_count_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 250 of file db_backend.c.

References db_backend_handle::count_function, DB_ERROR_UNKNOWN, and DB_OK.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_create()

int db_backend_handle_set_create | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_create_t | create_function
| ) |  |

extern

Set the create function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | create_function | a db_backend_handle_create_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 214 of file db_backend.c.

References db_backend_handle::create_function, DB_ERROR_UNKNOWN, and DB_OK.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_data()

int db_backend_handle_set_data | ( | db_backend_handle_t * | backend_handle,
|  | void * | data
| ) |  |

extern

Set the backend specific data of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | data | a void pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 295 of file db_backend.c.

References db_backend_handle::data, DB_ERROR_UNKNOWN, and DB_OK.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_delete()

int db_backend_handle_set_delete | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_delete_t | delete_function
| ) |  |

extern

Set the delete function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | delete_function | a db_backend_handle_delete_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 241 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::delete_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_disconnect()

int db_backend_handle_set_disconnect | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_disconnect_t | disconnect_function
| ) |  |

extern

Set the disconnect function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | disconnect_function | a db_backend_handle_disconnect_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 205 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::disconnect_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_free()

int db_backend_handle_set_free | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_free_t | free_function
| ) |  |

extern

Set the free function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | free_function | a db_backend_handle_free_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 259 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::free_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_initialize()

int db_backend_handle_set_initialize | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_initialize_t | initialize_function
| ) |  |

extern

Set the initialize function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | initialize_function | a db_backend_handle_initialize_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 178 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::initialize_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_read()

int db_backend_handle_set_read | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_read_t | read_function
| ) |  |

extern

Set the read function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | read_function | a db_backend_handle_read_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 223 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::read_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_shutdown()

int db_backend_handle_set_shutdown | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_shutdown_t | shutdown_function
| ) |  |

extern

Set the shutdown function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | shutdown_function | a db_backend_handle_shutdown_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 187 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::shutdown_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_transaction_begin()

int db_backend_handle_set_transaction_begin | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_transaction_begin_t | transaction_begin_function
| ) |  |

extern

Set the transaction begin function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | transaction_begin_function | a db_backend_handle_transaction_begin_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 268 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::transaction_begin_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_transaction_commit()

int db_backend_handle_set_transaction_commit | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_transaction_commit_t | transaction_commit_function
| ) |  |

extern

Set the transaction commit function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | transaction_commit_function | a db_backend_handle_transaction_commit_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 277 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::transaction_commit_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_transaction_rollback()

int db_backend_handle_set_transaction_rollback | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_transaction_rollback_t | transaction_rollback_function
| ) |  |

extern

Set the transaction rollback function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | transaction_rollback_function | a db_backend_handle_transaction_rollback_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 286 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::transaction_rollback_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_set_update()

int db_backend_handle_set_update | ( | db_backend_handle_t * | backend_handle,
|  | db_backend_handle_update_t | update_function
| ) |  |

extern

Set the update function of a database backend handle.

Parameters

  [in] | backend_handle | a db_backend_handle_t pointer.
  [in] | update_function | a db_backend_handle_update_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 232 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend_handle::update_function.

Referenced by db_backend_mysql_new_handle(), db_backend_sqlite_new_handle(), and test_class_db_backend_handle().

## db_backend_handle_update()

int db_backend_handle_update | ( | const db_backend_handle_t * | backend_handle,
|  | 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] | backend_handle | a db_backend_handle_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | object_field_list | a db_object_field_list_t pointer.
  [in] | value_set | a db_value_set_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 127 of file db_backend.c.

References db_backend_handle::data, DB_ERROR_UNKNOWN, and db_backend_handle::update_function.

Referenced by db_backend_update(), and test_class_db_backend_handle().

## db_backend_initialize()

int db_backend_initialize | ( | const db_backend_t * | backend | ) |

extern

Initiate the backend of a database backend.

Parameters

  [in] | backend | a db_backend_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 360 of file db_backend.c.

References db_backend_handle_initialize(), DB_ERROR_UNKNOWN, and db_backend::handle.

Referenced by db_backend_factory_get_backend(), and test_class_db_backend().

## db_backend_new()

db_backend_t * db_backend_new | ( | void |  | ) |

extern

Create a new database backend.

Returns
  a db_backend_t pointer or NULL on error.

Definition at line 311 of file db_backend.c.

Referenced by db_backend_factory_get_backend(), and test_class_db_backend().

## db_backend_read()

db_result_list_t * db_backend_read | ( | const db_backend_t * | backend,
|  | 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] | backend | a db_backend_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | join_list | a db_join_list_t pointer.
  [in] | clause_list | a 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 405 of file db_backend.c.

References db_backend_handle_read(), and db_backend::handle.

Referenced by db_connection_read(), and test_class_db_backend().

## db_backend_set_handle()

int db_backend_set_handle | ( | db_backend_t * | backend,
|  | db_backend_handle_t * | handle
| ) |  |

extern

Det the database backend handle of a database backend, this takes over the ownership of the database backend handle.

Parameters

  [in] | backend | a db_backend_t pointer.
  [in] | handle | a db_backend_handle_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 348 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend::handle.

Referenced by db_backend_factory_get_backend(), and test_class_db_backend().

## db_backend_set_name()

int db_backend_set_name | ( | db_backend_t * | backend,
|  | const char * | name
| ) |  |

extern

Set the name of a database backend.

Parameters

  [in] | backend | a db_backend_t pointer.
  [in] | name | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 330 of file db_backend.c.

References DB_ERROR_UNKNOWN, DB_OK, and db_backend::name.

Referenced by db_backend_factory_get_backend(), and test_class_db_backend().

## db_backend_update()

int db_backend_update | ( | const db_backend_t * | backend,
|  | 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] | backend | a db_backend_t pointer.
  [in] | object | a db_object_t pointer.
  [in] | object_field_list | a db_object_field_list_t pointer.
  [in] | value_set | a db_value_set_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 419 of file db_backend.c.

References db_backend_handle_update(), DB_ERROR_UNKNOWN, and db_backend::handle.

Referenced by db_connection_update(), and test_class_db_backend().