#include "db_id.h"
#include "../dprint.h"
#include "../mem/mem.h"
#include "../ut.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.
Defines | |
| #define | SHORTEST_DB_URL "s://a/b" |
| #define | SHORTEST_DB_URL_LEN (sizeof(SHORTEST_DB_URL) - 1) |
Functions | |
| unsigned char | cmp_db_id (const struct db_id *id1, const struct db_id *id2) |
| static int | dupl_string (char **dst, const char *begin, const char *end) |
| void | free_db_id (struct db_id *id) |
| struct db_id * | new_db_id (const str *url) |
| static int | parse_db_url (struct db_id *id, const str *url) |
Definition in file db_id.c.
| #define SHORTEST_DB_URL "s://a/b" |
| #define SHORTEST_DB_URL_LEN (sizeof(SHORTEST_DB_URL) - 1) |
Referenced by parse_db_url().
Compare two connection identifiers
| id1 | first identifier | |
| id2 | second identifier |
Definition at line 259 of file db_id.c.
References db_id::database, db_id::host, db_id::password, db_id::port, db_id::scheme, and db_id::username.
Referenced by pool_get().
| static int dupl_string | ( | char ** | dst, | |
| const char * | begin, | |||
| const char * | end | |||
| ) | [static] |
Duplicate a string
| dst | destination | |
| begin | start of the string | |
| end | end of the string |
Definition at line 44 of file db_id.c.
References NULL, pkg_free, and pkg_malloc.
Referenced by parse_db_url().
| void free_db_id | ( | struct db_id * | id | ) |
Free a connection identifier
| id | identifier |
Definition at line 285 of file db_id.c.
References db_id::database, db_id::host, db_id::password, pkg_free, db_id::scheme, and db_id::username.
Referenced by db_do_init(), db_mysql_free_connection(), db_oracle_free_connection(), and db_postgres_free_connection().
Create a new connection identifier
| url | database URL |
Definition at line 224 of file db_id.c.
References _str::len, LM_ERR, parse_db_url(), pkg_free, pkg_malloc, and _str::s.
Referenced by db_do_init().
Parse a database URL of form scheme://[username[:password]@]hostname[:port]/database
| id | filled id struct | |
| url | parsed URL |
Definition at line 67 of file db_id.c.
References db_id::database, dupl_string(), db_id::host, _str::len, len, db_id::password, pkg_free, _str::s, db_id::scheme, SHORTEST_DB_URL_LEN, str2s(), and db_id::username.
Referenced by new_db_id().
1.5.6