DB_MYSQL :: CoreModule: DB_MYSQL :: the MySQL driver for Kamailio. More...
#include "../../lib/srdb1/db_con.h"#include "../../lib/srdb1/db_res.h"#include "../../lib/srdb1/db_key.h"#include "../../lib/srdb1/db_op.h"#include "../../lib/srdb1/db_val.h"#include "../../str.h"

Go to the source code of this file.
Definition in file db_mysql/km_dbase.h.
| int db_mysql_affected_rows | ( | const db1_con_t * | _h | ) |
Returns number of affected rows for last query.
| _h | database handle |
Definition at line 489 of file db_mysql/km_dbase.c.
| void db_mysql_close | ( | db1_con_t * | _h | ) |
Close a database connection.
No function should be called after this
| _h | handle to the closed connection |
Definition at line 146 of file db_mysql/km_dbase.c.
References db_do_close(), and db_mysql_free_connection().

| int db_mysql_delete | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_op_t * | _o, | |||
| const db_val_t * | _v, | |||
| const int | _n | |||
| ) |
Delete a row from table.
| _h | structure representing database connection | |
| _k | key names | |
| _o | operators | |
| _v | values of the keys that must match | |
| _n | number of key=value pairs |
Definition at line 423 of file db_mysql/km_dbase.c.
References db_do_delete(), db_mysql_submit_query(), and db_mysql_val2str().

fetch rows from a result
Gets a partial result set, fetch a number of rows from a database result. This function initialize the given result structure on the first run, and fetches the nrows number of rows. On subsequenting runs, it uses the existing result and fetches more rows, until it reaches the end of the result set. Because of this the result needs to be null in the first invocation of the function. If the number of wanted rows is zero, the function returns anything with a result of zero.
| _h | structure representing the database connection | |
| _r | pointer to a structure representing the result | |
| nrows | number of fetched rows |
Definition at line 280 of file db_mysql/km_dbase.c.
References counter_inc(), db_free_result(), db_free_rows(), db_mysql_convert_row(), db_mysql_get_columns(), db_new_result(), RES_LAST_ROW, RES_NUM_ROWS, RES_ROW_N, and RES_ROWS.

Free all memory allocated by get_result.
| _h | handle to the database | |
| _r | result set that should be freed |
Definition at line 227 of file db_mysql/km_dbase.c.
References db_free_result().

Initialize database connection.
No function should be called before this
| _url | URL used for initialization |
Definition at line 134 of file db_mysql/km_dbase.c.
References db_do_init(), and db_mysql_new_connection().

| int db_mysql_insert | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n | |||
| ) |
Insert a row into table.
| _h | structure representing database connection | |
| _k | key names | |
| _v | values of the keys | |
| _n | number of key=value pairs |
Definition at line 407 of file db_mysql/km_dbase.c.
References db_do_insert(), db_mysql_submit_query(), and db_mysql_val2str().

| int db_mysql_insert_delayed | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n | |||
| ) |
Insert a row into table.
| _h | structure representing database connection | |
| _k | key names | |
| _v | values of the keys | |
| _n | number of key=value pairs |
Definition at line 565 of file db_mysql/km_dbase.c.
References db_do_insert_delayed(), db_mysql_submit_query(), and db_mysql_val2str().

| int db_mysql_insert_update | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n | |||
| ) |
Insert a row into table, update on duplicate key.
| _h | structure representing database connection | |
| _k | key names | |
| _v | values of the keys | |
| _n | number of key=value pairs |
Definition at line 506 of file db_mysql/km_dbase.c.
References CON_TABLE, db_mysql_submit_query(), db_mysql_val2str(), db_print_columns(), db_print_set(), db_print_values(), _str::len, and _str::s.

| int db_mysql_last_inserted_id | ( | const db1_con_t * | _h | ) |
| _h | database handle |
Definition at line 474 of file db_mysql/km_dbase.c.
| int db_mysql_query | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_op_t * | _op, | |||
| const db_val_t * | _v, | |||
| const db_key_t * | _c, | |||
| const int | _n, | |||
| const int | _nc, | |||
| const db_key_t | _o, | |||
| db1_res_t ** | _r | |||
| ) |
Do a query.
| _h | structure representing database connection | |
| _k | key names | |
| _op | operators | |
| _v | values of the keys that must match | |
| _c | column names to return | |
| _n | number of key=values pairs to compare | |
| _nc | number of columns to return | |
| _o | order by the specified column | |
| _r | pointer to a structure representing the result |
Definition at line 257 of file db_mysql/km_dbase.c.
References db_do_query(), db_mysql_store_result(), db_mysql_submit_query(), and db_mysql_val2str().

Raw SQL query.
| _h | handle for the database | |
| _s | raw query string | |
| _r | result set for storage |
Definition at line 392 of file db_mysql/km_dbase.c.
References db_do_raw_query(), db_mysql_store_result(), and db_mysql_submit_query().

| int db_mysql_replace | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_val_t * | _v, | |||
| const int | _n, | |||
| const int | _un, | |||
| const int | _m | |||
| ) |
| _h | database handle | |
| _k | key names | |
| _v | values of the keys that must match | |
| _n | number of key=value pairs |
Definition at line 460 of file db_mysql/km_dbase.c.
References db_do_replace(), db_mysql_submit_query(), and db_mysql_val2str().

| int db_mysql_update | ( | const db1_con_t * | _h, | |
| const db_key_t * | _k, | |||
| const db_op_t * | _o, | |||
| const db_val_t * | _v, | |||
| const db_key_t * | _uk, | |||
| const db_val_t * | _uv, | |||
| const int | _n, | |||
| const int | _un | |||
| ) |
Update a row in table.
| _h | structure representing database connection | |
| _k | key names | |
| _o | operators | |
| _v | values of the keys that must match | |
| _uk | updated columns | |
| _uv | updated values of the columns | |
| _n | number of key=value pairs | |
| _un | number of columns to update |
Definition at line 443 of file db_mysql/km_dbase.c.
References db_do_update(), db_mysql_submit_query(), and db_mysql_val2str().

Store name of table that will be used by subsequent database functions.
| _h | database handle | |
| _t | table name |
Definition at line 578 of file db_mysql/km_dbase.c.
References db_use_table().

1.7.1