FS-11727: [mod_mariadb] Add MariaDB (MySQL) support

This commit is contained in:
Andrey Volk 2019-06-12 12:05:42 +04:00
parent 65cd6ec1ed
commit 4a2812aaf5
23 changed files with 1598 additions and 4 deletions

View File

@ -584,6 +584,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Databases", "Databases", "{
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_pgsql", "src\mod\databases\mod_pgsql\mod_pgsql.2017.vcxproj", "{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_pgsql", "src\mod\databases\mod_pgsql\mod_pgsql.2017.vcxproj", "{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_mariadb", "src\mod\databases\mod_mariadb\mod_mariadb.2017.vcxproj", "{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32 All|Win32 = All|Win32
@ -2675,6 +2677,18 @@ Global
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|Win32.Build.0 = Release|Win32 {1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|Win32.Build.0 = Release|Win32
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|x64.ActiveCfg = Release|x64 {1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|x64.ActiveCfg = Release|x64
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|x64.Build.0 = Release|x64 {1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|x64.Build.0 = Release|x64
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.All|Win32.ActiveCfg = Release|Win32
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.All|Win32.Build.0 = Release|Win32
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.All|x64.ActiveCfg = Release|x64
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.All|x64.Build.0 = Release|x64
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Debug|Win32.ActiveCfg = Debug|Win32
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Debug|Win32.Build.0 = Debug|Win32
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Debug|x64.ActiveCfg = Debug|x64
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Debug|x64.Build.0 = Debug|x64
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Release|Win32.ActiveCfg = Release|Win32
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Release|Win32.Build.0 = Release|Win32
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Release|x64.ActiveCfg = Release|x64
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -2886,6 +2900,7 @@ Global
{B19AE6FC-BFFF-428D-B483-3BBEAECCC618} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B19AE6FC-BFFF-428D-B483-3BBEAECCC618} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{BC1FD72E-1CD5-4525-A7F5-17C5740BFDED} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {BC1FD72E-1CD5-4525-A7F5-17C5740BFDED} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1} {1BA65811-5453-46F6-8190-9ECEEFEB7DF2} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1}
{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {09840DE7-9208-45AA-9667-1A71EE93BD1E} SolutionGuid = {09840DE7-9208-45AA-9667-1A71EE93BD1E}

View File

@ -79,6 +79,7 @@ codecs/mod_opus
#codecs/mod_silk #codecs/mod_silk
#codecs/mod_siren #codecs/mod_siren
#codecs/mod_theora #codecs/mod_theora
#databases/mod_mariadb
databases/mod_pgsql databases/mod_pgsql
dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_asterisk
#dialplans/mod_dialplan_directory #dialplans/mod_dialplan_directory

View File

@ -76,6 +76,7 @@ codecs/mod_sangoma_codec
codecs/mod_silk codecs/mod_silk
codecs/mod_siren codecs/mod_siren
codecs/mod_theora codecs/mod_theora
#databases/mod_mariadb
databases/mod_pgsql databases/mod_pgsql
dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_asterisk
dialplans/mod_dialplan_directory dialplans/mod_dialplan_directory

View File

@ -1,6 +1,7 @@
<configuration name="pre_load_modules.conf" description="Modules"> <configuration name="pre_load_modules.conf" description="Modules">
<modules> <modules>
<!-- Databases --> <!-- Databases -->
<!-- <load module="mod_mariadb"/> -->
<load module="mod_pgsql"/> <load module="mod_pgsql"/>
</modules> </modules>
</configuration> </configuration>

View File

@ -168,6 +168,7 @@
--> -->
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'" /> --> <!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'" /> -->
<!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE&application_name=freeswitch" /> --> <!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE&application_name=freeswitch" /> -->
<!-- <param name="core-db-dsn" value="mariadb://Server=localhost;Database=freeswitch;Uid=freeswitch;Pwd=pass;" /> -->
<!-- <param name="core-db-dsn" value="dsn:username:password" /> --> <!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
<!-- <!--
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for

View File

@ -1,6 +1,7 @@
<configuration name="pre_load_modules.conf" description="Modules"> <configuration name="pre_load_modules.conf" description="Modules">
<modules> <modules>
<!-- Databases --> <!-- Databases -->
<!-- <load module="mod_mariadb"/> -->
<load module="mod_pgsql"/> <load module="mod_pgsql"/>
</modules> </modules>
</configuration> </configuration>

View File

@ -173,6 +173,7 @@
--> -->
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> --> <!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> -->
<!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> --> <!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> -->
<!-- <param name="core-db-dsn" value="mariadb://Server=localhost;Database=freeswitch;Uid=freeswitch;Pwd=pass;" /> -->
<!-- <param name="core-db-dsn" value="dsn:username:password" /> --> <!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
<!-- <!--
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for

View File

@ -1,6 +1,7 @@
<configuration name="pre_load_modules.conf" description="Modules"> <configuration name="pre_load_modules.conf" description="Modules">
<modules> <modules>
<!-- Databases --> <!-- Databases -->
<!-- <load module="mod_mariadb"/> -->
<load module="mod_pgsql"/> <load module="mod_pgsql"/>
</modules> </modules>
</configuration> </configuration>

View File

@ -182,6 +182,7 @@
--> -->
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> --> <!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> -->
<!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> --> <!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> -->
<!-- <param name="core-db-dsn" value="mariadb://Server=localhost;Database=freeswitch;Uid=freeswitch;Pwd=pass;" /> -->
<!-- <param name="core-db-dsn" value="dsn:username:password" /> --> <!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
<!-- <!--
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for

View File

@ -705,6 +705,11 @@ AC_SUBST([POSTGRESQL_CFLAGS], [$POSTGRESQL_CFLAGS])
AC_SUBST([POSTGRESQL_LDFLAGS], [$POSTGRESQL_LDFLAGS]) AC_SUBST([POSTGRESQL_LDFLAGS], [$POSTGRESQL_LDFLAGS])
AC_SUBST([POSTGRESQL_LIBDIR], [$POSTGRESQL_LIBDIR]) AC_SUBST([POSTGRESQL_LIBDIR], [$POSTGRESQL_LIBDIR])
PKG_CHECK_MODULES([MARIADB], [libmariadb >= 3.0.9],[
AM_CONDITIONAL([HAVE_MARIADB],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MARIADB],[false])])
AC_ARG_ENABLE(deprecated-core-db-events, AC_ARG_ENABLE(deprecated-core-db-events,
[AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"]) [AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"])
@ -1925,6 +1930,7 @@ AC_CONFIG_FILES([Makefile
src/mod/codecs/mod_siren/Makefile src/mod/codecs/mod_siren/Makefile
src/mod/codecs/mod_skel_codec/Makefile src/mod/codecs/mod_skel_codec/Makefile
src/mod/codecs/mod_theora/Makefile src/mod/codecs/mod_theora/Makefile
src/mod/databases/mod_mariadb/Makefile
src/mod/databases/mod_pgsql/Makefile src/mod/databases/mod_pgsql/Makefile
src/mod/dialplans/mod_dialplan_asterisk/Makefile src/mod/dialplans/mod_dialplan_asterisk/Makefile
src/mod/dialplans/mod_dialplan_directory/Makefile src/mod/dialplans/mod_dialplan_directory/Makefile

2
debian/bootstrap.sh vendored
View File

@ -623,6 +623,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-memcache (= \${binary:Version}), freeswitch-mod-memcache (= \${binary:Version}),
freeswitch-mod-nibblebill (= \${binary:Version}), freeswitch-mod-nibblebill (= \${binary:Version}),
freeswitch-mod-oreka (= \${binary:Version}), freeswitch-mod-oreka (= \${binary:Version}),
freeswitch-mod-mariadb (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}), freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-png (= \${binary:Version}), freeswitch-mod-png (= \${binary:Version}),
freeswitch-mod-redis (= \${binary:Version}), freeswitch-mod-redis (= \${binary:Version}),
@ -863,6 +864,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-memcache-dbg (= \${binary:Version}), freeswitch-mod-memcache-dbg (= \${binary:Version}),
freeswitch-mod-nibblebill-dbg (= \${binary:Version}), freeswitch-mod-nibblebill-dbg (= \${binary:Version}),
freeswitch-mod-oreka-dbg (= \${binary:Version}), freeswitch-mod-oreka-dbg (= \${binary:Version}),
freeswitch-mod-mariadb-dbg (= \${binary:Version}),
freeswitch-mod-pgsql-dbg (= \${binary:Version}), freeswitch-mod-pgsql-dbg (= \${binary:Version}),
freeswitch-mod-png-dbg (= \${binary:Version}), freeswitch-mod-png-dbg (= \${binary:Version}),
freeswitch-mod-redis-dbg (= \${binary:Version}), freeswitch-mod-redis-dbg (= \${binary:Version}),

View File

@ -393,6 +393,11 @@ Description: Adds mod_yuv
## mod/databases ## mod/databases
Module: databases/mod_mariadb
Description: Adds mod_mariadb
Adds mod_mariadb.
Build-Depends: libmariadb-dev
Module: databases/mod_pgsql Module: databases/mod_pgsql
Description: Adds mod_pgsql Description: Adds mod_pgsql
Adds mod_pgsql. Adds mod_pgsql.

View File

@ -3,7 +3,7 @@
# spec file for package freeswitch # spec file for package freeswitch
# #
# includes module(s): freeswitch-devel freeswitch-codec-passthru-amr freeswitch-codec-passthru-amrwb freeswitch-codec-passthru-g729 # includes module(s): freeswitch-devel freeswitch-codec-passthru-amr freeswitch-codec-passthru-amrwb freeswitch-codec-passthru-g729
# freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-pgsql freeswitch-perl freeswitch-python freeswitch-v8 freeswitch-signalwire # freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-mariadb freeswitch-pgsql freeswitch-perl freeswitch-python freeswitch-v8 freeswitch-signalwire
# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-hu freeswitch-lang-ru freeswitch-freetdm # freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-hu freeswitch-lang-ru freeswitch-freetdm
# and others # and others
# #
@ -842,6 +842,16 @@ Theora Video Codec support for FreeSWITCH open source telephony platform.
# FreeSWITCH Database Modules # FreeSWITCH Database Modules
###################################################################################################################### ######################################################################################################################
%package database-mariadb
Summary: MariaDB native support for FreeSWITCH
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
Requires: mariadb-connector-c
BuildRequires: mariadb-connector-c-devel
%description database-mariadb
MariaDB native support for FreeSWITCH.
%package database-pgsql %package database-pgsql
Summary: PostgreSQL native support for FreeSWITCH Summary: PostgreSQL native support for FreeSWITCH
Group: System/Libraries Group: System/Libraries
@ -1534,7 +1544,7 @@ CODECS_MODULES+="codecs/mod_sangoma_codec"
# Database Modules # Database Modules
# #
###################################################################################################################### ######################################################################################################################
DATABASES_MODULES="databases/mod_pgsql" DATABASES_MODULES="databases/mod_mariadb databases/mod_pgsql"
###################################################################################################################### ######################################################################################################################
# #
@ -2290,6 +2300,9 @@ fi
# #
###################################################################################################################### ######################################################################################################################
%files database-mariadb
%{MODINSTDIR}/mod_mariadb.so*
%files database-pgsql %files database-pgsql
%{MODINSTDIR}/mod_pgsql.so* %{MODINSTDIR}/mod_pgsql.so*

3
libs/.gitignore vendored
View File

@ -862,4 +862,5 @@ libks-*/
libks* libks*
signalwire-client-c-*/ signalwire-client-c-*/
signalwire-client-c-* signalwire-client-c-*
mariadb-connector-c-*/
mariadb-connector-c-*

View File

@ -0,0 +1,18 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_mariadb
if HAVE_MARIADB
mod_LTLIBRARIES = mod_mariadb.la
mod_mariadb_la_SOURCES = mariadb_dsn.cpp mod_mariadb.c
mod_mariadb_la_CFLAGS = $(AM_CFLAGS) $(MARIADB_CFLAGS)
mod_mariadb_la_CXXFLAGS = -std=c++11 $(MARIADB_CFLAGS)
mod_mariadb_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(MARIADB_LIBS)
mod_mariadb_la_LDFLAGS = -avoid-version -module -no-undefined -shared
else
install: error
all: error
error:
$(error You must install libmariadb-dev to build mod_mariadb. MariaDB supports non-blocking operations starting with version 5.5.21. libmariadb version should be >= 3.0.9 to support MySQL 8.0)
endif

View File

@ -0,0 +1,161 @@
/*
* mod_mariadb for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2019, Andrey Volk <andywolk@gmail.com>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is ported from FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrey Volk <andywolk@gmail.com>
*
* mariadb_dsn.cpp -- Connection string parser for MariaDB FreeSWITCH module
*
*/
#include <switch.h>
#include "mariadb_dsn.hpp"
#include <string>
#include <iterator>
#include <vector>
#include <unordered_map>
#include <regex>
#include <algorithm>
#include <sstream>
class mariadb_dsn {
std::string _host = "localhost";
std::string _user;
std::string _passwd;
std::string _db;
int _port = 3306;
std::string _unix_socket;
std::string _character_set;
unsigned long _clientflag;
public:
template<typename Out>
void split(const std::string &s, char delim, Out result) {
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, delim)) {
*(result++) = item;
}
}
std::vector<std::string> split(const std::string &s, char delim) {
std::vector<std::string> elems;
split(s, delim, std::back_inserter(elems));
return elems;
}
mariadb_dsn(MYSQL *mysql, const char *dsn, unsigned long clientflag)
{
_clientflag = clientflag;
if (dsn) {
std::vector<std::string> params = split(std::string(dsn), ';');
for (auto &param : params) {
std::vector<std::string> pair = split(param, '=');
if (pair.size() >= 2) {
std::string key = std::regex_replace(pair[0], std::regex("^ +| +$|( ) +"), "$1");
std::transform(key.begin(), key.end(), key.begin(), ::tolower);
std::string value = pair[1];
if ("server" == key || "host" == key) {
_host = value;
} else if ("uid" == key || "user" == key || "username" == key) {
_user = value;
} else if ("pwd" == key || "passwd" == key || "password" == key) {
_passwd = value;
} else if ("database" == key || "db" == key) {
_db = value;
} else if ("port" == key) {
_port = std::stoi(value);
} else if ("option" == key || "options" == key) {
unsigned long option;
std::stringstream(value) >> option;
_clientflag |= option;
} else if ("charset" == key) {
std::string charset = std::regex_replace(value, std::regex("^ +| +$|( ) +"), "$1");
int err = mysql_optionsv(mysql, MYSQL_SET_CHARSET_NAME, (void *)charset.c_str());
if (err) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mysql_optionsv returned an error [MYSQL_SET_CHARSET_NAME=%s]: %s\n", charset.c_str(), mysql_error(mysql));
}
}
}
}
}
}
const char* host() const
{
return _host.c_str();
}
const char* user() const
{
return _user.c_str();
}
const char* passwd() const
{
return _passwd.c_str();
}
const char* db() const
{
return _db.c_str();
}
const int port() const
{
return _port;
}
const char* unix_socket() const
{
return ("" == _unix_socket) ? NULL : _unix_socket.c_str();
}
unsigned long clientflag()
{
return _clientflag;
}
};
MYSQL* STDCALL mysql_dsn_connect(MYSQL *mysql, const char *connection_string, unsigned long clientflag)
{
mariadb_dsn dsn(mysql, connection_string, clientflag);
return mysql_real_connect(mysql, dsn.host(), dsn.user(), dsn.passwd(), dsn.db(), dsn.port(), dsn.unix_socket(), dsn.clientflag());
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -0,0 +1,57 @@
/*
* mod_mariadb for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2019, Andrey Volk <andywolk@gmail.com>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is ported from FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrey Volk <andywolk@gmail.com>
*
* mariadb_dsn.hpp -- Connection string parser header
*
*/
#ifndef _MARIADB_DSN_H_
#define _MARIADB_DSN_H_
#include <mysql.h>
#ifdef __cplusplus
extern "C" {
#endif
MYSQL* STDCALL mysql_dsn_connect(MYSQL *mysql, const char *connection_string, unsigned long clientflag);
#ifdef __cplusplus
}
#endif
#endif //_MARIADB_DSN_H_
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_mariadb</ProjectName>
<RootNamespace>mod_mariadb</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(SolutionDir)w32/mariadb-connector-c.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mariadb_dsn.cpp" />
<ClCompile Include="mod_mariadb.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="mariadb_dsn.hpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -2929,7 +2929,7 @@ static char create_row_size_limited_channels_sql[] =
" ip_addr VARCHAR(256),\n" " ip_addr VARCHAR(256),\n"
" dest VARCHAR(1024),\n" " dest VARCHAR(1024),\n"
" application VARCHAR(128),\n" " application VARCHAR(128),\n"
" application_data VARCHAR(4096),\n" " application_data TEXT,\n"
" dialplan VARCHAR(128),\n" " dialplan VARCHAR(128),\n"
" context VARCHAR(128),\n" " context VARCHAR(128),\n"
" read_codec VARCHAR(128),\n" " read_codec VARCHAR(128),\n"

View File

@ -477,6 +477,14 @@
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir> <RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\mod\databases\mod_mariadb\mod_mariadb.2017.vcxproj">
<Name>mod_mariadb</Name>
<Project>{0b612f84-7533-4dec-aedd-5c9cbcf15eac}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\..\src\mod\databases\mod_pgsql\mod_pgsql.2017.vcxproj"> <ProjectReference Include="..\..\src\mod\databases\mod_pgsql\mod_pgsql.2017.vcxproj">
<Name>mod_pgsql</Name> <Name>mod_pgsql</Name>
<Project>{1ba65811-5453-46f6-8190-9eceefeb7df2}</Project> <Project>{1ba65811-5453-46f6-8190-9eceefeb7df2}</Project>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
</ImportGroup>
<PropertyGroup Label="UserMacros">
<mariadb-connector-cVersion>3.0.9</mariadb-connector-cVersion>
</PropertyGroup>
<PropertyGroup>
<mariadb-connector-cVersionImported>true</mariadb-connector-cVersionImported>
</PropertyGroup>
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup>
<BuildMacro Include="mariadb-connector-cVersion">
<Value>$(mariadb-connector-cVersion)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="mariadb-connector-c-version.props" Condition=" '$(mariadb-connector-cVersionImported)' == '' "/>
<Import Project="downloadpackage.task" Condition=" '$(downloadpackagetask_Imported)' == '' " />
</ImportGroup>
<PropertyGroup>
<mariadb-connector-cPropsImported>true</mariadb-connector-cPropsImported>
</PropertyGroup>
<PropertyGroup Label="UserMacros">
<mariadb-connector-clibDir>$(BaseDir)libs\mariadb-connector-c-$(mariadb-connector-cVersion)</mariadb-connector-clibDir>
</PropertyGroup>
<!--
Download Target.
Name must be unique.
By design, targets are executed only once per project.
Usage:
package: URI
expectfileordirectory: Skips the download and extraction if exists
outputfolder: Folder to store a downloaded file.
By default "$(BaseDir)libs", if empty
outputfilename: If not empty, overrides filename from URI.
.exe files don't get extracted
extractto: Folder to extract an archive to
-->
<Target Name="mariadb-connector-cBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
<DownloadPackageTask
package="http://files.freeswitch.org/windows/packages/mariadb-connector-c/$(mariadb-connector-cVersion)/mariadb-connector-c-$(mariadb-connector-cVersion)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip"
expectfileordirectory="$(mariadb-connector-clibDir)\binaries\$(Platform)\$(Configuration)\libmariadb.dll"
outputfolder=""
outputfilename=""
extractto="$(BaseDir)libs\"
/>
</Target>
<Target Name="mariadb-connector-cHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
<DownloadPackageTask
package="http://files.freeswitch.org/windows/packages/mariadb-connector-c/$(mariadb-connector-cVersion)/mariadb-connector-c-$(mariadb-connector-cVersion)-headers.zip"
expectfileordirectory="$(mariadb-connector-clibDir)\include\mysql.h"
outputfolder=""
outputfilename=""
extractto="$(BaseDir)libs\"
/>
</Target>
<Target Name="mariadb-connector-ccopyTarget" AfterTargets="Build" DependsOnTargets="Build">
<ItemGroup>
<mariadb-connector-cFiles Include="$(mariadb-connector-clibDir)\binaries\$(Platform)\$(Configuration)\*.dll"/>
<libmariadb-plugins Include="$(mariadb-connector-clibDir)\binaries\$(Platform)\$(Configuration)\plugin\*.*" />
</ItemGroup>
<Copy Condition="!exists('$(BaseDir)\$(Platform)\$(Configuration)\libmariadb.dll')"
SourceFiles="@(mariadb-connector-cFiles)"
DestinationFiles="@(mariadb-connector-cFiles->'$(BaseDir)\$(Platform)\$(Configuration)\%(Filename)%(Extension)')"
/>
<Copy Condition="!exists('$(BaseDir)\$(Platform)\$(Configuration)\plugin\caching_sha2_password.dll')"
SourceFiles="@(libmariadb-plugins)"
DestinationFolder="$(BaseDir)\$(Platform)\$(Configuration)\libmariadb_plugin\"
/>
</Target>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(mariadb-connector-clibDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(mariadb-connector-clibDir)\binaries\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libmariadb.lib;Secur32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
</Project>