#include "db_ut.h"#include <stdio.h>#include <time.h>

Go to the source code of this file.
Functions | |
| int | db_str2val (const db_type_t _t, db_val_t *_v, const char *_s, const int _l, const unsigned int _cpy) |
| Convert a str to a db value. | |
| int | db_val2str (const db_con_t *_c, const db_val_t *_v, char *_s, int *_len) |
| Convert a numerical value to a string. | |
| int db_str2val | ( | const db_type_t | _t, | |
| db_val_t * | _v, | |||
| const char * | _s, | |||
| const int | _l, | |||
| const unsigned int | _cpy | |||
| ) |
Convert a str to a db value.
Convert a str to a db value, copy strings if _cpy is not zero. Copying is not necessary if the result from the database client library is freed after the result inside the server is processed. If the result is freed earlier, e.g. because its saved inside some temporary storage, then it must be copied in order to be use it reliable.
| _t | destination value type | |
| _v | destination value | |
| _s | source string | |
| _l | string length | |
| _cpy | when set to zero does not copy strings, otherwise copy strings |
Definition at line 45 of file db_val.c.
References DB_BIGINT, DB_BITMAP, DB_BLOB, DB_DATETIME, DB_DOUBLE, DB_INT, DB_STR, db_str2double(), db_str2int(), db_str2longlong(), db_str2time(), DB_STRING, LM_DBG, LM_ERR, NULL, pkg_malloc, s, _str::s, VAL_BIGINT, VAL_BLOB, VAL_DOUBLE, VAL_FREE, VAL_INT, VAL_NULL, VAL_STR, VAL_STRING, VAL_TIME, and VAL_TYPE.
Referenced by db_mysql_convert_row(), db_postgres_str2val(), and db_unixodbc_str2val().
Convert a numerical value to a string.
Convert a numerical value to a string, used when converting result from a query. Implement common functionality needed from the databases, does parameter checking.
| _c | database connection | |
| _v | source value | |
| _s | target string | |
| _len | target string length |
Definition at line 202 of file db_val.c.
References DB_BIGINT, DB_BITMAP, DB_DATETIME, DB_DOUBLE, db_double2str(), DB_INT, db_int2str(), db_longlong2str(), db_time2str(), LM_ERR, snprintf, VAL_BIGINT, VAL_BITMAP, VAL_DOUBLE, VAL_INT, VAL_NULL, VAL_TIME, and VAL_TYPE.
Referenced by db_mysql_val2str(), db_postgres_val2str(), and db_unixodbc_val2str().
1.5.6