Generic Database Interface. More...
#include "../../dprint.h"#include "../../sr_module.h"#include "../../mem/mem.h"#include "../../ut.h"#include "db_cap.h"#include "db_id.h"#include "db_pool.h"#include "db_query.h"#include "db.h"
Go to the source code of this file.
Definition in file lib/srdb1/db.c.
| int db_api_init | ( | void | ) |
This function must be executed by DB connector modules at load time to initialize the internals of DB API library.
Definition at line 519 of file lib/srdb1/db.c.
References db_query_init().
Referenced by db_mysql_alloc_buffer().


Bind database module functions.
| mod | ||
| mydbf |
Definition at line 158 of file lib/srdb1/db.c.
References _str::len, MAX_URL_LENGTH, and _str::s.
Referenced by carrierroute_db_init(), domainpolicy_db_bind(), group_db_bind(), init_ds_db(), matrix_db_init(), mod_init(), pl_init_db(), and userblacklist_db_init().

| int db_check_table_version | ( | db_func_t * | dbf, | |
| db1_con_t * | dbh, | |||
| const str * | table, | |||
| const unsigned int | version | |||
| ) |
Check the table version.
Definition at line 432 of file lib/srdb1/db.c.
References db_table_version(), _str::len, and _str::s.
Referenced by carrierroute_db_init(), matrix_db_init(), mod_init(), register_udomain(), and userblacklist_db_init().


| void db_do_close | ( | db1_con_t * | _h, | |
| void(*)() | free_connection | |||
| ) |
Helper for db_close function.
Definition at line 342 of file lib/srdb1/db.c.
References pool_remove(), and db1_con_t::tail.
Referenced by db_mysql_close(), and db_postgres_close().


Helper for db_init function.
Definition at line 269 of file lib/srdb1/db.c.
References db_do_init2().
Referenced by db_mysql_init(), and db_postgres_init().


Helper for db_init2 function.
Definition at line 279 of file lib/srdb1/db.c.
References free_db_id(), _str::len, MAX_URL_LENGTH, new_db_id(), pool_get(), pool_insert(), _str::s, and db1_con_t::tail.
Referenced by db_do_init(), and db_postgres_init2().


| int db_load_bulk_data | ( | db_func_t * | binding, | |
| db1_con_t * | handle, | |||
| str * | name, | |||
| db_key_t * | cols, | |||
| unsigned int | count, | |||
| unsigned int | strict, | |||
| db1_res_t * | res | |||
| ) |
Generic query helper method for load bulk data, e.g. lcr tables
| binding | database module binding | |
| handle | database connection | |
| name | database table name | |
| cols | queried columns | |
| count | number of queried columns | |
| strict | if set to 1 an error is returned when no data could be loaded, otherwise just a warning is logged | |
| res | database result, unchanged on failure and if no data could be found |
Definition at line 474 of file lib/srdb1/db.c.
Get the version of a table.
| dbf | ||
| connection | ||
| table |
Definition at line 368 of file lib/srdb1/db.c.
References DB1_INT, _str::len, RES_ROW_N, RES_ROWS, ROW_VALUES, _str::s, TABLENAME_COLUMN, VAL_INT, VAL_NULL, VAL_STR, VAL_TYPE, VERSION_COLUMN, and VERSION_TABLE.
Referenced by db_check_table_version(), domainpolicy_db_ver(), init_ds_db(), and pl_init_db().

Stores the name of a table.
Definition at line 449 of file lib/srdb1/db.c.
References CON_TABLE, and _str::s.
Referenced by db_mysql_use_table(), and db_postgres_use_table().

1.7.1