#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.h"

Go to the source code of this file.
Functions | |
| int | db_bind_mod (const str *mod, db_func_t *mydbf) |
| fills mydbf with the corresponding db module callbacks | |
| int | db_check_api (db_func_t *dbf, char *mname) |
| int | db_check_table_version (db_func_t *dbf, db_con_t *dbh, const str *table, const unsigned int version) |
| Check the table version 0 means ok, -1 means an error occured. | |
| void | db_do_close (db_con_t *_h, void(*free_connection)()) |
| Shut down database module. | |
| db_con_t * | db_do_init (const str *url, void *(*new_connection)()) |
| Initialize database module. | |
| int | db_table_version (const db_func_t *dbf, db_con_t *connection, const str *table) |
| Get version of a table. | |
| int | db_use_table (db_con_t *_h, const str *_t) |
| Store name of table that will be used by subsequent database functions. | |
Variables | |
| static unsigned int | MAX_URL_LENGTH = 255 |
Definition in file db/db.c.
fills mydbf with the corresponding db module callbacks
Bind database module functions.
| mod | ||
| mydbf |
Definition at line 148 of file db/db.c.
References db_func::close, db_check_api(), db_func::delete, db_func::fetch_result, find_mod_export(), db_func::free_result, db_func::init, db_func::insert, db_func::insert_update, db_func::last_inserted_id, _str::len, len, LM_CRIT, LM_DBG, LM_ERR, MAX_URL_LENGTH, NULL, pkg_free, pkg_malloc, db_func::query, db_func::raw_query, db_func::replace, _str::s, db_func::update, and db_func::use_table.
Referenced by avpops_db_bind(), carrierroute_db_init(), cpl_db_bind(), domain_db_bind(), domainpolicy_db_bind(), group_db_bind(), init(), init_addresses(), init_db_data(), init_dlg_db(), init_ds_db(), init_trusted(), lcr_db_bind(), mod_init(), uridb_db_bind(), and userblacklist_db_init().
| int db_check_api | ( | db_func_t * | dbf, | |
| char * | mname | |||
| ) |
Definition at line 72 of file db/db.c.
References db_func::cap, db_func::close, DB_CAP_DELETE, DB_CAP_FETCH, DB_CAP_INSERT, DB_CAP_INSERT_UPDATE, DB_CAP_LAST_INSERTED_ID, DB_CAP_QUERY, DB_CAP_RAW_QUERY, DB_CAP_REPLACE, DB_CAP_UPDATE, db_func::delete, db_func::fetch_result, db_func::free_result, db_func::init, db_func::insert, db_func::insert_update, db_func::last_inserted_id, LM_ERR, NULL, db_func::query, db_func::raw_query, db_func::replace, db_func::update, and db_func::use_table.
Referenced by db_bind_mod().
| int db_check_table_version | ( | db_func_t * | dbf, | |
| db_con_t * | dbh, | |||
| const str * | table, | |||
| const unsigned int | version | |||
| ) |
Check the table version 0 means ok, -1 means an error occured.
Check the table version.
Definition at line 402 of file db/db.c.
References db_table_version(), _str::len, LM_ERR, and _str::s.
Referenced by auth_fixup(), carrierroute_db_init(), cpl_db_bind(), domain_db_ver(), init_addresses(), init_child_trusted(), init_db_data(), init_dlg_db(), init_trusted(), mod_init(), register_udomain(), and userblacklist_db_init().
| void db_do_close | ( | db_con_t * | _h, | |
| void(*)() | free_connection | |||
| ) |
Shut down database module.
Helper for db_close function.
Definition at line 311 of file db/db.c.
References LM_ERR, pkg_free, pool_remove(), and db_con_t::tail.
Referenced by db_mysql_close(), db_oracle_close(), db_postgres_close(), and db_unixodbc_close().
Initialize database module.
Helper for db_init function.
Definition at line 248 of file db/db.c.
References free_db_id(), id, _str::len, LM_DBG, LM_ERR, MAX_URL_LENGTH, new_db_id(), pkg_free, pkg_malloc, pool_get(), pool_insert(), _str::s, and db_con_t::tail.
Referenced by db_mysql_init(), db_oracle_init(), db_postgres_init(), and db_unixodbc_init().
Get version of a table.
Get the version of a table.
| dbf | ||
| connection | ||
| table |
Definition at line 337 of file db/db.c.
References DB_INT, DB_STR, db_func::free_result, _str::len, LM_CRIT, LM_DBG, LM_ERR, NULL, db_func::query, RES_ROW_N, RES_ROWS, ROW_VALUES, _str::s, str_init, TABLENAME_COLUMN, db_func::use_table, VAL_INT, VAL_NULL, VAL_STR, VAL_TYPE, version, VERSION_COLUMN, VERSION_TABLE, and ZSW.
Referenced by db_check_table_version(), domainpolicy_db_ver(), init_ds_db(), and uridb_db_ver().
Store name of table that will be used by subsequent database functions.
Stores the name of a table.
Definition at line 419 of file db/db.c.
References CON_TABLE, LM_ERR, and _str::s.
Referenced by bdb_use_table(), db_mysql_use_table(), db_oracle_use_table(), db_postgres_use_table(), db_unixodbc_use_table(), and dbt_use_table().
unsigned int MAX_URL_LENGTH = 255 [static] |
maximum length of a SQL URL
Definition at line 69 of file db/db.c.
Referenced by db_bind_mod(), and db_do_init().
1.5.6