Utility functions for database drivers. More...
#include <time.h>#include <limits.h>#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "../../mem/mem.h"#include "../../dprint.h"#include "db_ut.h"
Go to the source code of this file.
This utility methods are used from the database SQL driver to convert values and print SQL queries from the internal API representation.
Definition in file db_ut.c.
| int db_double2str | ( | double | _v, | |
| char * | _s, | |||
| int * | _l | |||
| ) | [inline] |
| _v | source value | |
| _s | target value | |
| _l | available length and target length |
Definition at line 179 of file db_ut.c.
Referenced by db_val2str().

| int db_int2str | ( | int | _v, | |
| char * | _s, | |||
| int * | _l | |||
| ) | [inline] |
| _v | source value | |
| _s | target value | |
| _l | available length and target length |
Definition at line 133 of file db_ut.c.
Referenced by db_val2str().

| int db_longlong2str | ( | long long | _v, | |
| char * | _s, | |||
| int * | _l | |||
| ) | [inline] |
| _v | source value | |
| _s | target value | |
| _l | available length and target length |
Definition at line 156 of file db_ut.c.
Referenced by db_val2pv_spec(), and db_val2str().

| int db_print_columns | ( | char * | _b, | |
| const int | _l, | |||
| const db_key_t * | _c, | |||
| const int | _n | |||
| ) | [inline] |
| _b | target char | |
| _l | length of the target | |
| _c | keys that should be printed | |
| _n | number of keys |
Definition at line 265 of file db_ut.c.
Referenced by db_do_replace(), and db_mysql_insert_update().

| int db_print_set | ( | const db1_con_t * | _c, | |
| char * | _b, | |||
| const int | _l, | |||
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str | |||
| ) |
| _c | structure representing database connection | |
| _b | target char | |
| _l | length of the target | |
| _k | keys that should be printed | |
| _v | vals that should be printed | |
| _n | number of key/value pairs | |
| (*val2str) | function pointer to a db specific conversion function |
Definition at line 383 of file db_ut.c.
Referenced by db_do_update(), and db_mysql_insert_update().

| int db_print_values | ( | const db1_con_t * | _c, | |
| char * | _b, | |||
| const int | _l, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str | |||
| ) |
| _c | structure representing database connection | |
| _b | target char | |
| _l | length of the target | |
| _v | values that should be printed | |
| _n | number of values | |
| (*val2str) | function pointer to a db specific conversion function |
Definition at line 296 of file db_ut.c.
Referenced by db_do_replace(), and db_mysql_insert_update().

| int db_print_where | ( | const db1_con_t * | _c, | |
| char * | _b, | |||
| const int | _l, | |||
| const db_key_t * | _k, | |||
| const db_op_t * | _o, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| int(*)(const db1_con_t *, const db_val_t *, char *, int *) | val2str | |||
| ) |
| _c | structure representing database connection | |
| _b | target char | |
| _l | length of the target | |
| _k | keys that should be printed | |
| _o | optional operators | |
| _v | values that should be printed | |
| _n | number of key/value pairs | |
| (*val2str) | function pointer to a db specific conversion function |
Definition at line 325 of file db_ut.c.
References OP_BITWISE_AND.
Referenced by db_do_delete(), and db_do_update().

| int db_str2double | ( | const char * | _s, | |
| double * | _v | |||
| ) | [inline] |
| _s | source value | |
| _v | target value |
Definition at line 117 of file db_ut.c.
Referenced by bdb_str2val(), and db_str2val().

| int db_str2int | ( | const char * | _s, | |
| int * | _v | |||
| ) | [inline] |
| _s | source value | |
| _v | target value |
Definition at line 73 of file db_ut.c.
Referenced by bdb_str2val(), and db_str2val().

| int db_str2longlong | ( | const char * | _s, | |
| long long * | _v | |||
| ) | [inline] |
| _s | source value | |
| _v | target value |
Definition at line 94 of file db_ut.c.
Referenced by db_str2val().

| int db_str2time | ( | const char * | _s, | |
| time_t * | _v | |||
| ) | [inline] |
| _s | source value | |
| _v | target value |
Definition at line 202 of file db_ut.c.
Referenced by bdb_str2val(), and db_str2val().

| int db_time2str | ( | time_t | _v, | |
| char * | _s, | |||
| int * | _l | |||
| ) | [inline] |
| _v | source value | |
| _s | target value | |
| _l | available length and target length |
Definition at line 231 of file db_ut.c.
Referenced by db_val2str(), and get_all_db_ucontacts().

| msg | sip msg structure | |
| dbval | database value | |
| pvs | pv_spec where to put the database value |
Definition at line 421 of file db_ut.c.
References db_val_t::bitmap_val, db_val_t::blob_val, DB1_BIGINT, DB1_BITMAP, DB1_BLOB, DB1_DATETIME, DB1_INT, DB1_STR, DB1_STRING, db_longlong2str(), db_val_t::int_val, _str::len, db_val_t::ll_val, db_val_t::nul, _str::s, db_val_t::str_val, db_val_t::string_val, db_val_t::time_val, db_val_t::type, and db_val_t::val.

1.7.1