test_database_operations.c File Reference
`#include "config.h"`
`#include "../db_configuration.h"`
`#include "../db_connection.h"`
`#include "../db_object.h"`
`#include "CUnit/Basic.h"`
`#include <string.h>`

Go to the source code of this file.

## Data Structures

struct | test_t
struct | test_list_t
struct | test2_t

## Functions

db_object_t * | __test_new_object (const db_connection_t *connection)
test_t * | test_new (const db_connection_t *connection)
void | test_free (test_t *test)
const db_value_t * | test_id (const test_t *test)
const char * | test_name (const test_t *test)
int | test_set_name (test_t *test, const char *name)
int | test_from_result (test_t *test, const db_result_t *result)
int | test_get_by_name (test_t *test, const char *name)
int | test_get_by_id (test_t *test, const db_value_t *id)
int | test_create (test_t *test)
int | test_update (test_t *test)
int | test_delete (test_t *test)
size_t | test_count_by_name (test_t *test, const char *name)
size_t | test_count_by_id (test_t *test, const db_value_t *id)
test_list_t * | test_list_new (const db_connection_t *connection)
void | test_list_free (test_list_t *test_list)
int | test_list_get (test_list_t *test_list)
const test_t * | test_list_begin (test_list_t *test_list)
const test_t * | test_list_next (test_list_t *test_list)
db_object_t * | __test2_new_object (const db_connection_t *connection)
test2_t * | test2_new (const db_connection_t *connection)
void | test2_free (test2_t *test2)
const db_value_t * | test2_id (const test2_t *test2)
const char * | test2_name (const test2_t *test2)
int | test2_set_name (test2_t *test2, const char *name)
int | test2_from_result (test2_t *test2, const db_result_t *result)
int | test2_get_by_name (test2_t *test2, const char *name)
int | test2_get_by_id (test2_t *test2, const db_value_t *id)
int | test2_create (test2_t *test2)
int | test2_update (test2_t *test2)
int | test2_delete (test2_t *test2)
int | clean_suite_database_operations (void)
void | __check_id (const db_value_t *id, int id_int, const char *id_text)
void | test_database_operations_read_object1 (void)
void | test_database_operations_create_object2 (void)
void | test_database_operations_read_object2 (void)
void | test_database_operations_update_object2 (void)
void | test_database_operations_delete_object2 (void)
void | test_database_operations_create_object3 (void)
void | test_database_operations_delete_object3 (void)
void | test_database_operations_read_all (void)
void | test_database_operations_count (void)
void | test_database_operations_read_object1_2 (void)
void | test_database_operations_create_object2_2 (void)
void | test_database_operations_read_object2_2 (void)
void | test_database_operations_update_object2_2 (void)
void | test_database_operations_update_objects_revisions (void)
void | test_database_operations_delete_object2_2 (void)
void | test_database_operations_create_object3_2 (void)
void | test_database_operations_delete_object3_2 (void)

## Function Documentation

## __check_id()

void __check_id | ( | const db_value_t * | id,
|  | int | id_int,
|  | const char * | id_text )

Definition at line 1008 of file test_database_operations.c.

References DB_TYPE_INT32, DB_TYPE_INT64, DB_TYPE_TEXT, DB_TYPE_UINT32, DB_TYPE_UINT64, db_value_text(), db_value_to_int32(), db_value_to_int64(), db_value_to_uint32(), db_value_to_uint64(), and db_value_type().

Referenced by test_database_operations_read_object1(), and test_database_operations_read_object1_2().

## __test2_new_object()

db_object_t * __test2_new_object | ( | const db_connection_t * | connection | ) |

Definition at line 475 of file test_database_operations.c.

References db_object_field_list_add(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), db_object_new(), db_object_set_connection(), db_object_set_object_field_list(), db_object_set_primary_key_name(), db_object_set_table(), DB_TYPE_PRIMARY_KEY, DB_TYPE_REVISION, and DB_TYPE_TEXT.

Referenced by test2_new().

## __test_new_object()

db_object_t * __test_new_object | ( | const db_connection_t * | connection | ) |

Definition at line 58 of file test_database_operations.c.

References db_object_field_list_add(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), db_object_new(), db_object_set_connection(), db_object_set_object_field_list(), db_object_set_primary_key_name(), db_object_set_table(), DB_TYPE_PRIMARY_KEY, and DB_TYPE_TEXT.

Referenced by test_list_new(), and test_new().

## clean_suite_database_operations()

int clean_suite_database_operations | ( | void |  | ) |

Definition at line 988 of file test_database_operations.c.

References db_configuration_free(), db_configuration_list_free(), db_connection_free(), db_value_reset(), test2_free(), test_free(), and test_list_free().

Referenced by main().

## test2_create()

int test2_create | ( | test2_t * | test2 | ) |

Definition at line 666 of file test_database_operations.c.

References db_object_create(), db_object_field_free(), db_object_field_list_add(), db_object_field_list_free(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), DB_TYPE_TEXT, db_value_from_text(), db_value_not_empty(), db_value_set_free(), db_value_set_get(), and db_value_set_new().

Referenced by test_database_operations_create_object2_2(), test_database_operations_create_object3_2(), and test_database_operations_update_objects_revisions().

## test2_delete()

int test2_delete | ( | test2_t * | test2 | ) |

Definition at line 751 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_delete(), db_value_copy(), and db_value_not_empty().

Referenced by test_database_operations_delete_object2_2(), and test_database_operations_delete_object3_2().

## test2_free()

void test2_free | ( | test2_t * | test2 | ) |

Definition at line 521 of file test_database_operations.c.

References db_object_free(), and db_value_free().

Referenced by clean_suite_database_operations(), test_database_operations_create_object2_2(), test_database_operations_create_object3_2(), test_database_operations_delete_object2_2(), test_database_operations_delete_object3_2(), test_database_operations_read_object1_2(), test_database_operations_read_object2_2(), test_database_operations_update_object2_2(), and test_database_operations_update_objects_revisions().

## test2_from_result()

int test2_from_result | ( | test2_t * | test2,
|  | const db_result_t * | result )

Definition at line 563 of file test_database_operations.c.

References db_result_value_set(), db_value_copy(), db_value_reset(), db_value_set_at(), db_value_set_size(), and db_value_to_text().

Referenced by test2_get_by_id(), and test2_get_by_name().

## test2_get_by_id()

int test2_get_by_id | ( | test2_t * | test2,
|  | const db_value_t * | id )

Definition at line 626 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_read(), db_result_list_free(), db_result_list_next(), db_value_copy(), and test2_from_result().

Referenced by test_database_operations_delete_object2_2(), test_database_operations_delete_object3_2(), test_database_operations_read_object2_2(), and test_database_operations_update_object2_2().

## test2_get_by_name()

int test2_get_by_name | ( | test2_t * | test2,
|  | const char * | name )

Definition at line 586 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_read(), db_result_list_free(), db_result_list_next(), db_value_from_text(), and test2_from_result().

Referenced by test_database_operations_create_object2_2(), test_database_operations_create_object3_2(), test_database_operations_read_object1_2(), and test_database_operations_update_objects_revisions().

## test2_id()

const db_value_t * test2_id | ( | const test2_t * | test2 | ) |

Definition at line 539 of file test_database_operations.c.

Referenced by test_database_operations_create_object2_2(), test_database_operations_create_object3_2(), test_database_operations_read_object1_2(), and test_database_operations_read_object2_2().

## test2_name()

const char * test2_name | ( | const test2_t * | test2 | ) |

Definition at line 545 of file test_database_operations.c.

Referenced by test_database_operations_create_object2_2(), test_database_operations_create_object3_2(), test_database_operations_read_object1_2(), test_database_operations_read_object2_2(), test_database_operations_update_object2_2(), and test_database_operations_update_objects_revisions().

## test2_new()

test2_t * test2_new | ( | const db_connection_t * | connection | ) |

Definition at line 508 of file test_database_operations.c.

References __test2_new_object(), and db_value_new().

Referenced by test_database_operations_create_object2_2(), test_database_operations_create_object3_2(), test_database_operations_delete_object2_2(), test_database_operations_delete_object3_2(), test_database_operations_read_object1_2(), test_database_operations_read_object2_2(), test_database_operations_update_object2_2(), and test_database_operations_update_objects_revisions().

## test2_set_name()

int test2_set_name | ( | test2_t * | test2,
|  | const char * | name )

Definition at line 551 of file test_database_operations.c.

Referenced by test_database_operations_create_object2_2(), test_database_operations_create_object3_2(), test_database_operations_update_object2_2(), and test_database_operations_update_objects_revisions().

## test2_update()

int test2_update | ( | test2_t * | test2 | ) |

Definition at line 700 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_field_free(), db_object_field_list_add(), db_object_field_list_free(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), db_object_update(), DB_TYPE_TEXT, db_value_copy(), db_value_from_text(), db_value_not_empty(), db_value_set_free(), db_value_set_get(), and db_value_set_new().

Referenced by test_database_operations_update_object2_2(), and test_database_operations_update_objects_revisions().

## test_count_by_id()

size_t test_count_by_id | ( | test_t * | test,
|  | const db_value_t * | id )

Definition at line 365 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_count(), and db_value_copy().

Referenced by test_database_operations_count().

## test_count_by_name()

size_t test_count_by_name | ( | test_t * | test,
|  | const char * | name )

Definition at line 342 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_count(), and db_value_from_text().

Referenced by test_database_operations_count().

## test_create()

int test_create | ( | test_t * | test | ) |

Definition at line 238 of file test_database_operations.c.

References db_object_create(), db_object_field_free(), db_object_field_list_add(), db_object_field_list_free(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), DB_TYPE_TEXT, db_value_from_text(), db_value_not_empty(), db_value_set_free(), db_value_set_get(), and db_value_set_new().

Referenced by test_database_operations_create_object2(), and test_database_operations_create_object3().

## test_database_operations_count()

void test_database_operations_count | ( | void |  | ) |

Definition at line 1187 of file test_database_operations.c.

References test_count_by_id(), test_count_by_name(), test_free(), and test_new().

Referenced by main().

## test_database_operations_create_object2()

void test_database_operations_create_object2 | ( | void |  | ) |

Definition at line 1059 of file test_database_operations.c.

References db_value_copy(), db_value_reset(), test_create(), test_free(), test_get_by_name(), test_id(), test_name(), test_new(), and test_set_name().

Referenced by main().

## test_database_operations_create_object2_2()

void test_database_operations_create_object2_2 | ( | void |  | ) |

Definition at line 1210 of file test_database_operations.c.

References db_value_copy(), db_value_reset(), test2_create(), test2_free(), test2_get_by_name(), test2_id(), test2_name(), test2_new(), and test2_set_name().

Referenced by main().

## test_database_operations_create_object3()

void test_database_operations_create_object3 | ( | void |  | ) |

Definition at line 1131 of file test_database_operations.c.

References db_value_copy(), db_value_reset(), test_create(), test_free(), test_get_by_name(), test_id(), test_name(), test_new(), and test_set_name().

Referenced by main().

## test_database_operations_create_object3_2()

void test_database_operations_create_object3_2 | ( | void |  | ) |

Definition at line 1317 of file test_database_operations.c.

References db_value_copy(), db_value_reset(), test2_create(), test2_free(), test2_get_by_name(), test2_id(), test2_name(), test2_new(), and test2_set_name().

Referenced by main().

## test_database_operations_delete_object2()

void test_database_operations_delete_object2 | ( | void |  | ) |

Definition at line 1114 of file test_database_operations.c.

References test_delete(), test_free(), test_get_by_id(), and test_new().

Referenced by main().

## test_database_operations_delete_object2_2()

void test_database_operations_delete_object2_2 | ( | void |  | ) |

Definition at line 1300 of file test_database_operations.c.

References test2_delete(), test2_free(), test2_get_by_id(), and test2_new().

Referenced by main().

## test_database_operations_delete_object3()

void test_database_operations_delete_object3 | ( | void |  | ) |

Definition at line 1152 of file test_database_operations.c.

References test_delete(), test_free(), test_get_by_id(), and test_new().

Referenced by main().

## test_database_operations_delete_object3_2()

void test_database_operations_delete_object3_2 | ( | void |  | ) |

Definition at line 1338 of file test_database_operations.c.

References test2_delete(), test2_free(), test2_get_by_id(), and test2_new().

Referenced by main().

## test_database_operations_read_all()

void test_database_operations_read_all | ( | void |  | ) |

Definition at line 1169 of file test_database_operations.c.

References test_list_begin(), test_list_free(), test_list_get(), test_list_new(), and test_list_next().

Referenced by main().

## test_database_operations_read_object1()

void test_database_operations_read_object1 | ( | void |  | ) |

Definition at line 1047 of file test_database_operations.c.

References __check_id(), test_free(), test_get_by_name(), test_id(), test_name(), and test_new().

Referenced by main().

## test_database_operations_read_object1_2()

void test_database_operations_read_object1_2 | ( | void |  | ) |

Definition at line 1198 of file test_database_operations.c.

References __check_id(), test2_free(), test2_get_by_name(), test2_id(), test2_name(), and test2_new().

Referenced by main().

## test_database_operations_read_object2()

void test_database_operations_read_object2 | ( | void |  | ) |

Definition at line 1080 of file test_database_operations.c.

References db_value_cmp(), test_free(), test_get_by_id(), test_id(), test_name(), and test_new().

Referenced by main().

## test_database_operations_read_object2_2()

void test_database_operations_read_object2_2 | ( | void |  | ) |

Definition at line 1231 of file test_database_operations.c.

References db_value_cmp(), test2_free(), test2_get_by_id(), test2_id(), test2_name(), and test2_new().

Referenced by main().

## test_database_operations_update_object2()

void test_database_operations_update_object2 | ( | void |  | ) |

Definition at line 1094 of file test_database_operations.c.

References test_free(), test_get_by_id(), test_name(), test_new(), test_set_name(), and test_update().

Referenced by main().

## test_database_operations_update_object2_2()

void test_database_operations_update_object2_2 | ( | void |  | ) |

Definition at line 1245 of file test_database_operations.c.

References test2_free(), test2_get_by_id(), test2_name(), test2_new(), test2_set_name(), and test2_update().

Referenced by main().

## test_database_operations_update_objects_revisions()

void test_database_operations_update_objects_revisions | ( | void |  | ) |

Definition at line 1265 of file test_database_operations.c.

References test2_create(), test2_free(), test2_get_by_name(), test2_name(), test2_new(), test2_set_name(), and test2_update().

Referenced by main().

## test_delete()

int test_delete | ( | test_t * | test | ) |

Definition at line 316 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_delete(), db_value_copy(), and db_value_not_empty().

Referenced by test_database_operations_delete_object2(), and test_database_operations_delete_object3().

## test_free()

void test_free | ( | test_t * | test | ) |

Definition at line 98 of file test_database_operations.c.

References db_object_free(), and db_value_free().

Referenced by clean_suite_database_operations(), test_database_operations_count(), test_database_operations_create_object2(), test_database_operations_create_object3(), test_database_operations_delete_object2(), test_database_operations_delete_object3(), test_database_operations_read_object1(), test_database_operations_read_object2(), test_database_operations_update_object2(), and test_list_free().

## test_from_result()

int test_from_result | ( | test_t * | test,
|  | const db_result_t * | result )

Definition at line 137 of file test_database_operations.c.

References db_result_value_set(), db_value_copy(), db_value_reset(), db_value_set_at(), db_value_set_size(), and db_value_to_text().

Referenced by test_get_by_id(), test_get_by_name(), test_list_begin(), and test_list_next().

## test_get_by_id()

int test_get_by_id | ( | test_t * | test,
|  | const db_value_t * | id )

Definition at line 198 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_read(), db_result_list_free(), db_result_list_next(), db_value_copy(), and test_from_result().

Referenced by test_database_operations_delete_object2(), test_database_operations_delete_object3(), test_database_operations_read_object2(), and test_database_operations_update_object2().

## test_get_by_name()

int test_get_by_name | ( | test_t * | test,
|  | const char * | name )

Definition at line 158 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_read(), db_result_list_free(), db_result_list_next(), db_value_from_text(), and test_from_result().

Referenced by test_database_operations_create_object2(), test_database_operations_create_object3(), and test_database_operations_read_object1().

## test_id()

const db_value_t * test_id | ( | const test_t * | test | ) |

Definition at line 113 of file test_database_operations.c.

Referenced by test_database_operations_create_object2(), test_database_operations_create_object3(), test_database_operations_read_object1(), and test_database_operations_read_object2().

## test_list_begin()

const test_t * test_list_begin | ( | test_list_t * | test_list | ) |

Definition at line 428 of file test_database_operations.c.

References db_object_connection(), db_result_list_next(), test_from_result(), and test_new().

Referenced by test_database_operations_read_all().

## test_list_free()

void test_list_free | ( | test_list_t * | test_list | ) |

Definition at line 399 of file test_database_operations.c.

References db_object_free(), db_result_list_free(), and test_free().

Referenced by clean_suite_database_operations(), and test_database_operations_read_all().

## test_list_get()

int test_list_get | ( | test_list_t * | test_list | ) |

Definition at line 414 of file test_database_operations.c.

References db_object_read(), and db_result_list_free().

Referenced by test_database_operations_read_all().

## test_list_new()

test_list_t * test_list_new | ( | const db_connection_t * | connection | ) |

Definition at line 388 of file test_database_operations.c.

References __test_new_object().

Referenced by test_database_operations_read_all().

## test_list_next()

const test_t * test_list_next | ( | test_list_t * | test_list | ) |

Definition at line 447 of file test_database_operations.c.

References db_object_connection(), db_result_list_next(), test_from_result(), and test_new().

Referenced by test_database_operations_read_all().

## test_name()

const char * test_name | ( | const test_t * | test | ) |

Definition at line 119 of file test_database_operations.c.

Referenced by test_database_operations_create_object2(), test_database_operations_create_object3(), test_database_operations_read_object1(), test_database_operations_read_object2(), and test_database_operations_update_object2().

## test_new()

test_t * test_new | ( | const db_connection_t * | connection | ) |

Definition at line 86 of file test_database_operations.c.

References __test_new_object(), and db_value_new().

Referenced by test_database_operations_count(), test_database_operations_create_object2(), test_database_operations_create_object3(), test_database_operations_delete_object2(), test_database_operations_delete_object3(), test_database_operations_read_object1(), test_database_operations_read_object2(), test_database_operations_update_object2(), test_list_begin(), and test_list_next().

## test_set_name()

int test_set_name | ( | test_t * | test,
|  | const char * | name )

Definition at line 125 of file test_database_operations.c.

Referenced by test_database_operations_create_object2(), test_database_operations_create_object3(), and test_database_operations_update_object2().

## test_update()

int test_update | ( | test_t * | test | ) |

Definition at line 271 of file test_database_operations.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), db_object_field_free(), db_object_field_list_add(), db_object_field_list_free(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), db_object_update(), DB_TYPE_TEXT, db_value_copy(), db_value_from_text(), db_value_not_empty(), db_value_set_free(), db_value_set_get(), and db_value_set_new().

Referenced by test_database_operations_update_object2().