fix crash in soci in Android and iOS

This commit is contained in:
Benjamin Reis 2017-10-27 15:52:44 +02:00
parent 8523c03deb
commit 20f8fe59a4
2 changed files with 10 additions and 1 deletions

View file

@ -61,6 +61,10 @@ IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES)
IF(SOCI_${plugin}_PLUGIN)
MESSAGE(STATUS " * Plugin ${plugin} found ${SOCI_${plugin}_PLUGIN}.")
SET(SOCI_${plugin}_FOUND True)
if(IOS OR ANDROID)
list(APPEND SOCI_LIBRARIES ${SOCI_${plugin}_PLUGIN})
endif()
ELSE()
MESSAGE(STATUS " * Plugin ${plugin} not found.")
SET(SOCI_${plugin}_FOUND False)

View file

@ -33,9 +33,14 @@ LINPHONE_BEGIN_NAMESPACE
AbstractDb::AbstractDb (AbstractDbPrivate &p) : Object(p) {}
extern "C" void register_factory_sqlite3();
bool AbstractDb::connect (Backend backend, const string &parameters) {
L_D();
#if defined(__APPLE__) || defined(__ANDROID__)
if (backend == Sqlite3)
register_factory_sqlite3();
#endif // defined(__APPLE__) || defined(__ANDROID__)*/
d->backend = backend;
d->dbSession = DbSessionProvider::getInstance()->getSession(
(backend == Mysql ? "mysql://" : "sqlite3://") + parameters