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

Go to the source code of this file.

## Functions

db_value_t * | db_value_new ()
void | db_value_free (db_value_t *value)
void | db_value_reset (db_value_t *value)
int | db_value_copy (db_value_t *value, const db_value_t *from_value)
int | db_value_cmp (const db_value_t *value_a, const db_value_t *value_b, int *result)
db_type_t | db_value_type (const db_value_t *value)
const db_type_int32_t * | db_value_int32 (const db_value_t *value)
const db_type_uint32_t * | db_value_uint32 (const db_value_t *value)
const db_type_int64_t * | db_value_int64 (const db_value_t *value)
const db_type_uint64_t * | db_value_uint64 (const db_value_t *value)
const char * | db_value_text (const db_value_t *value)
int | db_value_enum_value (const db_value_t *value, int *enum_value)
int | db_value_not_empty (const db_value_t *value)
int | db_value_to_int32 (const db_value_t *value, db_type_int32_t *to_int32)
int | db_value_to_uint32 (const db_value_t *value, db_type_uint32_t *to_uint32)
int | db_value_to_int64 (const db_value_t *value, db_type_int64_t *to_int64)
int | db_value_to_uint64 (const db_value_t *value, db_type_uint64_t *to_uint64)
int | db_value_to_text (const db_value_t *value, char **to_text)
int | db_value_to_enum_value (const db_value_t *value, int *to_int, const db_enum_t *enum_set)
int | db_value_from_int32 (db_value_t *value, db_type_int32_t from_int32)
int | db_value_from_uint32 (db_value_t *value, db_type_uint32_t from_uint32)
int | db_value_from_int64 (db_value_t *value, db_type_int64_t from_int64)
int | db_value_from_uint64 (db_value_t *value, db_type_uint64_t from_uint64)
int | db_value_from_text (db_value_t *value, const char *from_text)
int | db_value_from_text2 (db_value_t *value, const char *from_text, size_t size)
int | db_value_from_enum_value (db_value_t *value, int enum_value, const db_enum_t *enum_set)
int | db_value_set_primary_key (db_value_t *value)
db_value_set_t * | db_value_set_new (size_t size)
db_value_set_t * | db_value_set_new_copy (const db_value_set_t *from_value_set)
void | db_value_set_free (db_value_set_t *value_set)
size_t | db_value_set_size (const db_value_set_t *value_set)
const db_value_t * | db_value_set_at (const db_value_set_t *value_set, size_t at)
db_value_t * | db_value_set_get (db_value_set_t *value_set, size_t at)

## Function Documentation

## db_value_cmp()

int db_value_cmp | ( | const db_value_t * | value_a,
|  | const db_value_t * | value_b,
|  | int * | result
| ) |  |

Compare two database values A and B. Sets `result` with less than, equal to, or greater than zero if A is found, respectively, to be less than, to match, or be greater than B.

Parameters

  [in] | value_a | a db_value_t pointer.
  [in] | value_b | a db_value_t pointer.
  [out] | result | an integer pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 102 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_ENUM, DB_TYPE_INT32, DB_TYPE_INT64, DB_TYPE_TEXT, DB_TYPE_UINT32, DB_TYPE_UINT64, db_value::enum_value, db_value::int32, db_value::int64, db_value::text, db_value::type, db_value::uint32, and db_value::uint64.

Referenced by key_data_cmp(), policy_key_cmp(), removeDeadKeysNow(), signconf_export_all(), test_class_db_value(), test_database_operations_read_object2(), test_database_operations_read_object2_2(), and zonelist_export().

## db_value_copy()

int db_value_copy | ( | db_value_t * | value,
|  | const db_value_t * | from_value
| ) |  |

Copy the contant from one database value into another.

Parameters

  [in] | value | a db_value_t pointer to copy to.
  [in] | from_value | a db_value_t pointer to copy from.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 77 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, db_value_reset(), db_value::text, and db_value::type.

Referenced by database_version_from_result(), db_value_set_new_copy(), hsm_key_copy(), hsm_key_create(), hsm_key_factory_delete_key(), hsm_key_from_result(), hsm_key_get_by_id(), hsm_key_list_get_by_policy_id(), hsm_key_list_new_get_by_policy_key(), hsm_key_policy_id_clause(), hsm_key_set_policy_id(), hsm_key_update(), key_data_copy(), key_data_create(), key_data_delete(), key_data_from_result(), key_data_get_by_hsm_key_id(), key_data_get_by_id(), key_data_hsm_key_id_clause(), key_data_list_get_by_zone_id(), key_data_set_hsm_key_id(), key_data_set_zone_id(), key_data_update(), key_data_zone_id_clause(), key_dependency_copy(), key_dependency_create(), key_dependency_delete(), key_dependency_from_result(), key_dependency_get_by_id(), key_dependency_list_get_by_zone_id(), key_dependency_set_from_key_data_id(), key_dependency_set_to_key_data_id(), key_dependency_set_zone_id(), key_state_copy(), key_state_create(), key_state_delete(), key_state_from_result(), key_state_get_by_id(), key_state_key_data_id_clause(), key_state_list_get_by_key_data_id(), key_state_set_key_data_id(), key_state_update(), perform_keydata_import(), policy_copy(), policy_delete(), policy_from_result(), policy_get_by_id(), policy_key_copy(), policy_key_create(), policy_key_delete(), policy_key_from_result(), policy_key_get_by_id(), policy_key_get_by_policyid_and_role(), policy_key_list_get_by_policy_id(), policy_key_set_policy_id(), policy_update(), test2_delete(), test2_from_result(), test2_get_by_id(), test2_update(), test_class_db_value(), test_count_by_id(), test_database_operations_create_object2(), test_database_operations_create_object2_2(), test_database_operations_create_object3(), test_database_operations_create_object3_2(), test_delete(), test_from_result(), test_get_by_id(), test_update(), zone_db_copy(), zone_db_create(), zone_db_delete(), zone_db_from_result(), zone_db_get_by_id(), zone_db_policy_id_clause(), zone_db_set_policy_id(), zone_db_update(), and zone_list_db_get_by_policy_id().

## db_value_enum_value()

int db_value_enum_value | ( | const db_value_t * | value,
|  | int * | enum_value
| ) |  |

Sets `enum_value` with the integer value of an enumeration database value.

Parameters

  [in] | value | a db_value_t pointer.
  [out] | enum_value | an integer pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 332 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_ENUM, db_value::enum_value, and db_value::type.

Referenced by test_class_db_value().

## db_value_free()

void db_value_free | ( | db_value_t * | value | ) |

Delete a database value.

Parameters

  [in] | value | a db_value_t pointer.

Definition at line 51 of file db_value.c.

References db_value::text.

Referenced by clean_suite_classes(), test2_free(), test_class_db_value(), and test_free().

## db_value_from_enum_value()

int db_value_from_enum_value | ( | db_value_t * | value,
|  | int | enum_value,
|  | const db_enum_t * | enum_set
| ) |  |

Set the database value to an enumeration value based on an integer value.

Parameters

  [in] | value | a db_value_t pointer.
  [in] | enum_value | an integer pointer.
  [in] | enum_set | a db_enum_t array that MUST end with NULL.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 572 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_ENUM, db_value::enum_text, db_value::enum_value, db_enum::text, db_value::type, and db_enum::value.

Referenced by hsm_key_backup_clause(), hsm_key_create(), hsm_key_key_type_clause(), hsm_key_role_clause(), hsm_key_state_clause(), hsm_key_update(), key_data_create(), key_data_ds_at_parent_clause(), key_data_role_clause(), key_data_update(), key_dependency_create(), key_state_create(), key_state_update(), policy_create(), policy_denial_type_clause(), policy_key_create(), policy_key_get_by_policyid_and_role(), policy_update(), and test_class_db_value().

## db_value_from_int32()

int db_value_from_int32 | ( | db_value_t * | value,
|  | db_type_int32_t | from_int32
| ) |  |

Set the database value to a 32bit integer value.

Parameters

  [in] | value | a db_value_t pointer.
  [in] | from_int32 | a db_type_int32_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 479 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_INT32, db_value::int32, and db_value::type.

Referenced by test_class_db_clause(), test_class_db_value(), zone_db_create(), and zone_db_update().

## db_value_from_int64()

int db_value_from_int64 | ( | db_value_t * | value,
|  | db_type_int64_t | from_int64
| ) |  |

Set the database value to a 64bit integer value.

Parameters

  [in] | value | a db_value_t pointer.
  [in] | from_int64 | a db_type_int64_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 505 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_INT64, db_value::int64, and db_value::type.

Referenced by test_class_db_value().

## db_value_from_text()

int db_value_from_text | ( | db_value_t * | value,
|  | const char * | from_text
| ) |  |

Set the database value to a text value.

Parameters

  [in] | value | a db_value_t pointer.
  [in] | from_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 531 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_TEXT, db_value::text, and db_value::type.

Referenced by hsm_key_create(), hsm_key_factory_delete_key(), hsm_key_get_by_locator(), hsm_key_list_new_get_by_policy_key(), hsm_key_repository_clause(), hsm_key_update(), policy_create(), policy_get_by_name(), policy_key_create(), policy_update(), test2_create(), test2_get_by_name(), test2_update(), test_class_db_value(), test_count_by_name(), test_create(), test_get_by_name(), test_update(), zone_db_create(), zone_db_get_by_name(), and zone_db_update().

## db_value_from_text2()

int db_value_from_text2 | ( | db_value_t * | value,
|  | const char * | from_text,
|  | size_t | size
| ) |  |

Set the database value to a text value.

Parameters

  [in] | value | a db_value_t pointer.
  [in] | from_text | a character pointer.
  [in] | size | a size_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 550 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_TEXT, db_value::text, and db_value::type.

## db_value_from_uint32()

int db_value_from_uint32 | ( | db_value_t * | value,
|  | db_type_uint32_t | from_uint32
| ) |  |

Set the database value to an unsigned 32bit integer value.

Parameters

  [in] | value | a db_value_t pointer.
  [in] | from_uint32 | a db_type_uint32_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 492 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_UINT32, db_value::type, and db_value::uint32.

Referenced by hsm_key_algorithm_clause(), hsm_key_bits_clause(), hsm_key_create(), hsm_key_is_revoked_clause(), hsm_key_list_new_get_by_policy_key(), hsm_key_update(), key_data_create(), key_data_keytag_clause(), key_data_update(), key_state_create(), key_state_update(), policy_create(), policy_key_create(), policy_update(), test_class_db_value(), zone_db_create(), and zone_db_update().

## db_value_from_uint64()

int db_value_from_uint64 | ( | db_value_t * | value,
|  | db_type_uint64_t | from_uint64
| ) |  |

Set the database value to an unsigned 64bit integer value.

Parameters

  [in] | value | a db_value_t pointer.
  [in] | from_uint64 | a db_type_uint64_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 518 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_UINT64, db_value::type, and db_value::uint64.

Referenced by test_class_db_value().

## db_value_int32()

const db_type_int32_t * db_value_int32 | ( | const db_value_t * | value | ) |

Get a pointer for the 32bit integer in a database value.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  a db_type_int32_t pointer or NULL on error, if empty or not a 32bit integer value. TODO: unit test

Definition at line 277 of file db_value.c.

References DB_TYPE_INT32, db_value::int32, and db_value::type.

## db_value_int64()

const db_type_int64_t * db_value_int64 | ( | const db_value_t * | value | ) |

Get a pointer for the 64bit integer in a database value.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  a db_type_int64_t pointer or NULL on error, if empty or not a 64bit integer value. TODO: unit test

Definition at line 299 of file db_value.c.

References DB_TYPE_INT64, db_value::int64, and db_value::type.

## db_value_new()

db_value_t * db_value_new | ( | void |  | ) |

Create a new database value.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 40 of file db_value.c.

References DB_TYPE_EMPTY, and db_value::type.

Referenced by test2_new(), test_class_db_value(), and test_new().

## db_value_not_empty()

int db_value_not_empty | ( | const db_value_t * | value | ) |

Check if a database value is not empty.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  DB_ERROR_* if empty, otherwise DB_OK.

Definition at line 347 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, and db_value::type.

Referenced by hsm_key_create(), hsm_key_get_by_id(), hsm_key_list_get_by_policy_id(), hsm_key_list_new_get_by_policy_id(), hsm_key_policy_id_clause(), hsm_key_set_policy_id(), hsm_key_update(), key_data_create(), key_data_delete(), key_data_get_by_id(), key_data_get_hsm_key(), key_data_get_zone(), key_data_hsm_key_id_clause(), key_data_list_get_by_zone_id(), key_data_list_new_get_by_zone_id(), key_data_set_hsm_key_id(), key_data_set_zone_id(), key_data_update(), key_data_zone_id_clause(), key_dependency_create(), key_dependency_delete(), key_dependency_get_by_id(), key_dependency_get_from_key_data(), key_dependency_list_get_by_zone_id(), key_dependency_list_new_get_by_zone_id(), key_dependency_set_from_key_data_id(), key_dependency_set_to_key_data_id(), key_dependency_set_zone_id(), key_state_create(), key_state_delete(), key_state_get_by_id(), key_state_key_data_id_clause(), key_state_list_get_by_key_data_id(), key_state_list_new_get_by_key_data_id(), key_state_set_key_data_id(), key_state_update(), policy_create(), policy_delete(), policy_get_by_id(), policy_get_policy_keys(), policy_key_create(), policy_key_delete(), policy_key_get_by_id(), policy_key_list_get_by_policy_id(), policy_key_list_new_get_by_policy_id(), policy_key_set_policy_id(), policy_update(), test2_create(), test2_delete(), test2_update(), test_class_db_value(), test_create(), test_delete(), test_update(), zone_db_create(), zone_db_delete(), zone_db_get_by_id(), zone_db_get_key_dependencies(), zone_db_get_keys(), zone_db_get_policy(), zone_db_policy_id_clause(), zone_db_set_policy_id(), zone_db_update(), zone_list_db_get_by_policy_id(), and zone_list_db_new_get_by_policy_id().

## db_value_reset()

void db_value_reset | ( | db_value_t * | value | ) |

Reset a database value, releasing all interal resources and marking it empty.

Parameters

  [in] | value | a db_value_t pointer.

Definition at line 60 of file db_value.c.

References DB_TYPE_EMPTY, db_value::enum_text, db_value::enum_value, db_value::int32, db_value::int64, db_value::primary_key, db_value::text, db_value::type, db_value::uint32, and db_value::uint64.

Referenced by clean_suite_database_operations(), database_version_free(), database_version_from_result(), database_version_new(), db_clause_free(), db_clause_new(), db_value_copy(), db_value_set_free(), hsm_key_free(), hsm_key_from_result(), hsm_key_new(), hsm_key_set_policy_id(), key_data_free(), key_data_from_result(), key_data_new(), key_data_set_hsm_key_id(), key_data_set_zone_id(), key_dependency_free(), key_dependency_from_result(), key_dependency_new(), key_dependency_set_from_key_data_id(), key_dependency_set_to_key_data_id(), key_dependency_set_zone_id(), key_state_free(), key_state_from_result(), key_state_new(), key_state_set_key_data_id(), policy_free(), policy_from_result(), policy_key_free(), policy_key_from_result(), policy_key_new(), policy_key_reset(), policy_key_set_policy_id(), policy_new(), test2_from_result(), test_class_db_value(), test_database_operations_create_object2(), test_database_operations_create_object2_2(), test_database_operations_create_object3(), test_database_operations_create_object3_2(), test_from_result(), zone_db_free(), zone_db_from_result(), zone_db_new(), and zone_db_set_policy_id().

## db_value_set_at()

const db_value_t * db_value_set_at | ( | const db_value_set_t * | value_set,
|  | size_t | at
| ) |  |

Get a read only database value at a position in a database value set.

Parameters

  [in] | value_set | a db_value_set_t pointer.
  [in] | at | a size_t.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 742 of file db_value.c.

References db_value_set::values.

Referenced by __db_result_list_next(), database_version_from_result(), hsm_key_from_result(), key_data_from_result(), key_dependency_from_result(), key_state_from_result(), policy_from_result(), policy_key_from_result(), test2_from_result(), test_class_db_value_set(), test_from_result(), and zone_db_from_result().

## db_value_set_free()

void db_value_set_free | ( | db_value_set_t * | value_set | ) |

Delete a database value set and all values within the set.

Parameters

  [in] | value_set | a db_value_set_t pointer.

Definition at line 697 of file db_value.c.

References db_value_reset(), db_value_set::size, and db_value_set::values.

Referenced by clean_suite_classes(), db_result_copy(), db_result_free(), db_value_set_new_copy(), hsm_key_create(), hsm_key_update(), key_data_create(), key_data_update(), key_dependency_create(), key_state_create(), key_state_update(), policy_create(), policy_key_create(), policy_update(), test2_create(), test2_update(), test_class_end(), test_create(), test_update(), zone_db_create(), and zone_db_update().

## db_value_set_get()

db_value_t * db_value_set_get | ( | db_value_set_t * | value_set,
|  | size_t | at
| ) |  |

Get a writable database value at a position in a database value set.

Parameters

  [in] | value_set | a db_value_set_t pointer.
  [in] | at | a size_t.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 756 of file db_value.c.

References db_value_set::values.

Referenced by __db_result_list_next(), hsm_key_create(), hsm_key_update(), key_data_create(), key_data_update(), key_dependency_create(), key_state_create(), key_state_update(), policy_create(), policy_key_create(), policy_update(), test2_create(), test2_update(), test_class_db_value_set(), test_create(), test_update(), zone_db_create(), and zone_db_update().

## db_value_set_new()

db_value_set_t * db_value_set_new | ( | size_t | size | ) |

Create a new set of database value.

Parameters

  [in] | size | a size_t.

Returns
  a db_value_set_t pointer or NULL on error.

Definition at line 622 of file db_value.c.

References DB_TYPE_EMPTY, db_value_set::size, db_value::type, and db_value_set::values.

Referenced by __db_result_list_next(), db_value_set_new_copy(), hsm_key_create(), hsm_key_update(), key_data_create(), key_data_update(), key_dependency_create(), key_state_create(), key_state_update(), policy_create(), policy_key_create(), policy_update(), test2_create(), test2_update(), test_class_db_value_set(), test_create(), test_update(), zone_db_create(), and zone_db_update().

## db_value_set_new_copy()

db_value_set_t * db_value_set_new_copy | ( | const db_value_set_t * | from_value_set | ) |

Create a new set of database value that is a copy of another.

Parameters

  [in] | from_value_set | a db_value_set_t pointer.

Returns
  a db_value_set_t pointer or NULL on error.

Definition at line 670 of file db_value.c.

References DB_TYPE_EMPTY, db_value_copy(), db_value_set_free(), db_value_set_new(), db_value_type(), db_value_set::size, and db_value_set::values.

Referenced by db_result_copy().

## db_value_set_primary_key()

int db_value_set_primary_key | ( | db_value_t * | value | ) |

Mark the database as a primary key.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 595 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_EMPTY, DB_TYPE_ENUM, db_value::primary_key, and db_value::type.

Referenced by test_class_db_value().

## db_value_set_size()

size_t db_value_set_size | ( | const db_value_set_t * | value_set | ) |

Get the size of database value set.

Parameters

  [in] | value_set | a db_value_set_t pointer.

Returns
  a size_t.

Definition at line 734 of file db_value.c.

References DB_OK, and db_value_set::size.

Referenced by __db_result_list_next(), database_version_from_result(), hsm_key_from_result(), key_data_from_result(), key_dependency_from_result(), key_state_from_result(), policy_from_result(), policy_key_from_result(), test2_from_result(), test_class_db_value_set(), test_from_result(), and zone_db_from_result().

## db_value_text()

const char * db_value_text | ( | const db_value_t * | value | ) |

Get a character pointer for the text in a database value.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  a character pointer or NULL on error, if empty or not a text value.

Definition at line 321 of file db_value.c.

References DB_TYPE_TEXT, db_value::text, and db_value::type.

Referenced by __check_id(), and test_class_db_value().

## db_value_to_enum_value()

int db_value_to_enum_value | ( | const db_value_t * | value,
|  | int * | to_int,
|  | const db_enum_t * | enum_set
| ) |  |

Get the integer enumeration representation of the database value.

Parameters

  [in] | value | a db_value_t pointer.
  [out] | to_int | an integer pointer.
  [in] | enum_set | a db_enum_t array that MUST end with NULL.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 438 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_ENUM, DB_TYPE_INT32, DB_TYPE_TEXT, db_value::enum_value, db_value::int32, db_enum::text, db_value::text, db_value::type, and db_enum::value.

Referenced by hsm_key_from_result(), key_data_from_result(), key_dependency_from_result(), key_state_from_result(), policy_from_result(), policy_key_from_result(), and test_class_db_value().

## db_value_to_int32()

int db_value_to_int32 | ( | const db_value_t * | value,
|  | db_type_int32_t * | to_int32
| ) |  |

Get the 32bit integer representation of the database value.

Parameters

  [in] | value | a db_value_t pointer.
  [out] | to_int32 | a db_type_int32_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 357 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_INT32, db_value::int32, and db_value::type.

Referenced by __check_id(), test_class_db_value(), and zone_db_from_result().

## db_value_to_int64()

int db_value_to_int64 | ( | const db_value_t * | value,
|  | db_type_int64_t * | to_int64
| ) |  |

Get the 64bit integer representation of the database value.

Parameters

  [in] | value | a db_value_t pointer.
  [out] | to_int64 | a db_type_int64_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 387 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_INT64, db_value::int64, and db_value::type.

Referenced by __check_id(), and test_class_db_value().

## db_value_to_text()

int db_value_to_text | ( | const db_value_t * | value,
|  | char ** | to_text
| ) |  |

Get the character representation of the database value.

Parameters

  [in] | value | a db_value_t pointer.
  [out] | to_text | a character pointer pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 417 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_TEXT, db_value::text, and db_value::type.

Referenced by hsm_key_from_result(), policy_from_result(), policy_key_from_result(), test2_from_result(), test_class_db_value(), test_from_result(), and zone_db_from_result().

## db_value_to_uint32()

int db_value_to_uint32 | ( | const db_value_t * | value,
|  | db_type_uint32_t * | to_uint32
| ) |  |

Get the unsigned 32bit integer representation of the database value.

Parameters

  [in] | value | a db_value_t pointer.
  [out] | to_uint32 | a db_type_uint32_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 372 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_UINT32, db_value::type, and db_value::uint32.

Referenced by __check_id(), database_version_from_result(), hsm_key_from_result(), key_data_from_result(), key_state_from_result(), policy_from_result(), policy_key_from_result(), test_class_db_value(), and zone_db_from_result().

## db_value_to_uint64()

int db_value_to_uint64 | ( | const db_value_t * | value,
|  | db_type_uint64_t * | to_uint64
| ) |  |

Get the unsigned 64bit integer representation of the database value.

Parameters

  [in] | value | a db_value_t pointer.
  [out] | to_uint64 | a db_type_uint64_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 402 of file db_value.c.

References DB_ERROR_UNKNOWN, DB_OK, DB_TYPE_UINT64, db_value::type, and db_value::uint64.

Referenced by __check_id(), and test_class_db_value().

## db_value_type()

db_type_t db_value_type | ( | const db_value_t * | value | ) |

Get the type of a database value.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  a db_type_t.

Definition at line 269 of file db_value.c.

References DB_TYPE_EMPTY, and db_value::type.

Referenced by __check_id(), db_clause_not_empty(), db_value_set_new_copy(), and test_class_db_value().

## db_value_uint32()

const db_type_uint32_t * db_value_uint32 | ( | const db_value_t * | value | ) |

Get a pointer for the unsigned 32bit integer in a database value.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  a db_type_uint32_t pointer or NULL on error, if empty or not an unsigned 32bit integer value. TODO: unit test

Definition at line 288 of file db_value.c.

References DB_TYPE_UINT32, db_value::type, and db_value::uint32.

## db_value_uint64()

const db_type_uint64_t * db_value_uint64 | ( | const db_value_t * | value | ) |

Get a pointer for the unsigned 64bit integer in a database value.

Parameters

  [in] | value | a db_value_t pointer.

Returns
  a db_type_uint64_t pointer or NULL on error, if empty or not an unsigned 64bit integer value. TODO: unit test

Definition at line 310 of file db_value.c.

References DB_TYPE_UINT64, db_value::type, and db_value::uint64.