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

Go to the source code of this file.

## Functions

database_version_t * | database_version_new (const db_connection_t *connection)
void | database_version_free (database_version_t *database_version)
int | database_version_from_result (database_version_t *database_version, const db_result_t *result)
unsigned int | database_version_version (const database_version_t *database_version)
database_version_list_t * | database_version_list_new (const db_connection_t *connection)
void | database_version_list_free (database_version_list_t *database_version_list)
int | database_version_list_get (database_version_list_t *database_version_list)
database_version_list_t * | database_version_list_new_get (const db_connection_t *connection)
const database_version_t * | database_version_list_next (database_version_list_t *database_version_list)

## Function Documentation

## database_version_free()

void database_version_free | ( | database_version_t * | database_version | ) |

Delete a database version object, this does not delete it from the database.

Parameters

  [in] | database_version | a database_version_t pointer.

Definition at line 118 of file database_version.c.

References db_object_free(), db_value_reset(), database_version::dbo, database_version::id, and database_version::rev.

Referenced by database_version_list_free(), and database_version_list_get().

## database_version_from_result()

int database_version_from_result | ( | database_version_t * | database_version,
|  | const db_result_t * | result
| ) |  |

Set the content of a database version object based on a database result.

Parameters

  [in] | database_version | a database_version_t pointer.
  [in] | result | a db_result_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 129 of file database_version.c.

## database_version_list_free()

void database_version_list_free | ( | database_version_list_t * | database_version_list | ) |

Delete a database version object list.

Parameters

  [in] | database_version_list | a database_version_list_t pointer.

Definition at line 179 of file database_version.c.

References database_version_list::database_version, database_version_free(), db_object_free(), db_result_list_free(), database_version_list::dbo, database_version_list::object_list, database_version_list::object_list_size, and database_version_list::result_list.

Referenced by database_version_list_new_get().

## database_version_list_get()

int database_version_list_get | ( | database_version_list_t * | database_version_list | ) |

Get all database version objects.

Parameters

  [in] | database_version_list | a database_version_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 209 of file database_version.c.

References database_version_list::associated_fetch, database_version_free(), DB_ERROR_UNKNOWN, db_object_read(), db_result_list_fetch_all(), db_result_list_free(), database_version_list::dbo, database_version_list::object_list, database_version_list::object_list_first, database_version_list::object_list_size, and database_version_list::result_list.

Referenced by database_version_list_new_get().

## database_version_list_new()

database_version_list_t* database_version_list_new | ( | const db_connection_t * | connection | ) |

Create a new database version object list.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a database_version_list_t pointer or NULL on error.

Definition at line 165 of file database_version.c.

References database_version_list::dbo.

Referenced by database_version_list_new_get().

## database_version_list_new_get()

database_version_list_t* database_version_list_new_get | ( | const db_connection_t * | connection | ) |

Get a new list with all database version objects.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a database_version_list_t pointer or NULL on error.

Definition at line 248 of file database_version.c.

References database_version_list_free(), database_version_list_get(), and database_version_list_new().

## database_version_list_next()

const database_version_t* database_version_list_next | ( | database_version_list_t * | database_version_list | ) |

Get the next database version object in a database version object list. Ownership of this object is retained within the list and the object is only valid until the next call to this function.

Parameters

  [in] | database_version_list | a database_version_list_t pointer.

Returns
  a database_version_t pointer or NULL on error or if there are no more database version objects in the database version object list.

Definition at line 265 of file database_version.c.

## database_version_new()

database_version_t* database_version_new | ( | const db_connection_t * | connection | ) |

Create a new database version object.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a database_version_t pointer or NULL on error.

Definition at line 102 of file database_version.c.

References database_version::dbo.

## database_version_version()

unsigned int database_version_version | ( | const database_version_t * | database_version | ) |

Get the version of a database version object. Undefined behavior if `database_version` is NULL.

Parameters

  [in] | database_version | a database_version_t pointer.

Returns
  an unsigned integer.

Definition at line 153 of file database_version.c.

References database_version::version.