Olle E. Johansson fe977dfcb9 db_mysql Add transaction support пре 12 година
..
doc 61c706ef81 db_mysql: new module parameter - insert_delayed пре 12 година
Makefile bc9dca0a9d db_mysql: fix cross-compilation пре 12 година
README 61c706ef81 db_mysql: new module parameter - insert_delayed пре 12 година
km_db_mysql.c fe977dfcb9 db_mysql Add transaction support пре 12 година
km_db_mysql.h 61c706ef81 db_mysql: new module parameter - insert_delayed пре 12 година
km_dbase.c fe977dfcb9 db_mysql Add transaction support пре 12 година
km_dbase.h fe977dfcb9 db_mysql Add transaction support пре 12 година
km_my_con.c 7ca3941c12 modules/db_mysql Added statistics (via counter framework) for mysql driver error пре 15 година
km_my_con.h fe977dfcb9 db_mysql Add transaction support пре 12 година
km_res.c b81f22eed0 DB_* renamed to DB1_* in files originating from kamailio/db_mysql. пре 16 година
km_res.h 8d67ed8e92 modules: several small doxygen bug fixes пре 14 година
km_row.c f1fc20c7cb db_res renamed to db1_res in files originating from kamailio/db_mysql. пре 16 година
km_row.h f1fc20c7cb db_res renamed to db1_res in files originating from kamailio/db_mysql. пре 16 година
km_val.c b81f22eed0 DB_* renamed to DB1_* in files originating from kamailio/db_mysql. пре 16 година
km_val.h 8d67ed8e92 modules: several small doxygen bug fixes пре 14 година
my_cmd.c c867df9a62 doxygen: fix a bunch of errors in parser, db_mysql and xmlrpc modules пре 14 година
my_cmd.h 9bbb835a75 Changes necessary to make the module compile in the sip-router tree. пре 16 година
my_con.c b5d6bb38c3 fixed compile time warnings пре 13 година
my_con.h 0e564bcd36 db_mysql: Fixes crash in libmysqlclient after connection reset. пре 15 година
my_fld.c 9bbb835a75 Changes necessary to make the module compile in the sip-router tree. пре 16 година
my_fld.h 9bbb835a75 Changes necessary to make the module compile in the sip-router tree. пре 16 година
my_res.c 9bbb835a75 Changes necessary to make the module compile in the sip-router tree. пре 16 година
my_res.h 9bbb835a75 Changes necessary to make the module compile in the sip-router tree. пре 16 година
my_uri.c 9bbb835a75 Changes necessary to make the module compile in the sip-router tree. пре 16 година
my_uri.h 9bbb835a75 Changes necessary to make the module compile in the sip-router tree. пре 16 година
mysql_mod.c 61c706ef81 db_mysql: new module parameter - insert_delayed пре 12 година
mysql_mod.h 7ca3941c12 modules/db_mysql Added statistics (via counter framework) for mysql driver error пре 15 година

README

mysql Module

Daniel-Constantin Mierla



Edited by

Daniel-Constantin Mierla



Copyright � 2006 Voice Sistem SRL
__________________________________________________________________

Table of Contents

1. Admin Guide

1. Overview
2. Dependencies

2.1. Kamailio Modules
2.2. External Libraries or Applications

3. Parameters

3.1. ping_interval (integer)
3.2. timeout_interval (integer)
3.3. auto_reconnect (integer)
3.4. insert_delayed (integer)

4. Functions
5. Installation
6. Reading configuration from my.cnf

List of Examples

1.1. Set ping_interval parameter
1.2. Set timeout_interval parameter
1.3. Set auto_reconnect parameter
1.4. Set insert_delayed parameter
1.5. Set a my.cnf group in db_url parameter
1.6. Adding a kamailio group to my.cnf
1.7. Using [client] and specific group

Chapter 1. Admin Guide

Table of Contents

1. Overview
2. Dependencies

2.1. Kamailio Modules
2.2. External Libraries or Applications

3. Parameters

3.1. ping_interval (integer)
3.2. timeout_interval (integer)
3.3. auto_reconnect (integer)
3.4. insert_delayed (integer)

4. Functions
5. Installation
6. Reading configuration from my.cnf

1. Overview

This is a module which provides MySQL connectivity for Kamailio. It
implements the DB API defined in Kamailio.

2. Dependencies

2.1. Kamailio Modules
2.2. External Libraries or Applications

2.1. Kamailio Modules

The following modules must be loaded before this module:
* No dependencies on other Kamailio modules.

2.2. External Libraries or Applications

The following libraries or applications must be installed before
running Kamailio with this module loaded:
* mysql - the development libraries forthe Mysql database. In some
Linux distributions named "libmysqlclient-dev".

3. Parameters

3.1. ping_interval (integer)
3.2. timeout_interval (integer)
3.3. auto_reconnect (integer)
3.4. insert_delayed (integer)

3.1. ping_interval (integer)

Time interval in seconds to send ping messages to MySQL server in order
to keep the connection open.

Default value is 300 (5 min).

Example 1.1. Set ping_interval parameter
...
modparam("db_mysql", "ping_interval", 600)
...

3.2. timeout_interval (integer)

Time interval (in seconds) after that an connection attempt, read or
write request is aborted. The value counts three times, as several
retries are done from the driver before it gives up.

The read timeout parameter is ignored on MySQL driver versions prior to
"5.1.12", "5.0.25" and "4.1.22". The write timeout parameter is ignored
on versions prior to "5.1.12" and "5.0.25", the "4.1" release don't
support it at all.

Default value is 2 (6 sec).

Example 1.2. Set timeout_interval parameter
...
modparam("db_mysql", "timeout_interval", 2)
...

3.3. auto_reconnect (integer)

Configure whether the module should automatically reconnect to MySQL
server if the connection was lost.

Default value is 1 (1 - on / 0 - off).

Example 1.3. Set auto_reconnect parameter
...
modparam("db_mysql", "auto_reconnect", 0)
...

3.4. insert_delayed (integer)

If set to 1, all INSERT SQL queries will be sent to MySQL server as
INSERT DELAYED.

Default value is 0 (1 - on / 0 - off).

Example 1.4. Set insert_delayed parameter
...
modparam("db_mysql", "insert_delayed", 1)
...

4. Functions

No function exported to be used from configuration file.

5. Installation

Because it dependes on an external library, the mysql module is not
compiled and installed by default. You can use one of these options.
* - edit the "Makefile" and remove "db_mysql" from "excluded_modules"
list. Then follow the standard procedure to install Kamailio: "make
all; make install".
* - from command line use: 'make all include_modules="db_mysql"; make
install include_modules="db_mysql"'.

6. Reading configuration from my.cnf

In order to take into account specific mysql client options, a my.cnf
config group can be passed using the db_url module parameter. This is
done by setting [group] in front of or instead of the host part. The
following examples are valid db_url definitions, which include a my.cnf
group:
* mysql://user:pass@[group]host:port/db
* mysql://user:pass@[group]:port/db
* mysql://user:pass@[group]/db
* mysql://[group]/db

Example 1.5. Set a my.cnf group in db_url parameter
...
modparam("usrloc", "db_url", "mysql://[kamailio]/kamailio)
...

Example 1.6. Adding a kamailio group to my.cnf
...
[kamailio]
socket = /path/to/mysql.sock
user = kamailiouser
password = kamailiopass
default-character-set = utf8
...

In addition to the given group, also the [client] section is read, in
the order given in my.cnf. So if you for example specify a socket in
both your specific group and the client group, then the value is taken
from the last one.

Example 1.7. Using [client] and specific group
...
[client]
socket = /var/run/mysql/mysqld.sock

[kamailio]
socket = /path/to/mysqld.sock
user = kamailiouser
password = kamailiopass
default-character-set = utf8
...

In the example given above, the socket /path/to/mysqld.sock is used by
Kamailio because both [kamailio] and [client] define this option, and
the latter overwrites the first.