Fixed MySQL
This commit is contained in:
		
							parent
							
								
									371ca06bfa
								
							
						
					
					
						commit
						ec1205c313
					
				@ -53,7 +53,7 @@ find_package(Boringssl REQUIRED)
 | 
			
		||||
find_package(ThreadPool REQUIRED)
 | 
			
		||||
find_package(CXXTerminal REQUIRED)
 | 
			
		||||
find_package(StringVariable REQUIRED)
 | 
			
		||||
 | 
			
		||||
find_package(mysqlclient REQUIRED)
 | 
			
		||||
find_package(yaml-cpp REQUIRED)
 | 
			
		||||
find_package(jsoncpp REQUIRED)
 | 
			
		||||
find_package(Ed25519 REQUIRED)
 | 
			
		||||
@ -90,7 +90,6 @@ include_directories(${LIBEVENT_INCLUDE_DIRS})
 | 
			
		||||
include_directories(${StringVariable_INCLUDE_DIR})
 | 
			
		||||
 | 
			
		||||
add_definitions(-DINET -DINET6)
 | 
			
		||||
include_directories(/usr/local/mysql/include/)
 | 
			
		||||
 | 
			
		||||
add_subdirectory(shared/)
 | 
			
		||||
add_subdirectory(server/)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										53
									
								
								cmake/Modules/Findmysqlclient.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								cmake/Modules/Findmysqlclient.cmake
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
			
		||||
# - Try to find mysqlclient include dirs and libraries
 | 
			
		||||
#
 | 
			
		||||
# Usage of this module as follows:
 | 
			
		||||
#
 | 
			
		||||
#     find_package(mysqlclient)
 | 
			
		||||
#
 | 
			
		||||
# Variables used by this module, they can change the default behaviour and need
 | 
			
		||||
# to be set before calling find_package:
 | 
			
		||||
#
 | 
			
		||||
#  MYSQLCLIENT_ROOT_DIR          Set this variable to the root installation of
 | 
			
		||||
#                            mysqlclient if the module has problems finding the
 | 
			
		||||
#                            proper installation path.
 | 
			
		||||
#
 | 
			
		||||
# Variables defined by this module:
 | 
			
		||||
#
 | 
			
		||||
#  MYSQLCLIENT_FOUND             System has mysqlclient, include and library dirs found
 | 
			
		||||
#  MYSQLCLIENT_INCLUDE_DIR       The mysqlclient include directories.
 | 
			
		||||
 | 
			
		||||
include(FindPackageHandleStandardArgs)
 | 
			
		||||
 | 
			
		||||
find_package(PkgConfig)
 | 
			
		||||
pkg_check_modules(PC_MYSQL_CLIENT QUIET mysqlclient)
 | 
			
		||||
 | 
			
		||||
message(${PC_MYSQL_CLIENT_INCLUDEDIR})
 | 
			
		||||
find_path(MYSQLCLIENT_INCLUDE_DIR
 | 
			
		||||
        NAMES mysql.h
 | 
			
		||||
        HINTS ${MYSQLCLIENT_ROOT_DIR} ${MYSQLCLIENT_ROOT_DIR}/include/ ${PC_MYSQL_CLIENT_INCLUDEDIR}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if (NOT TARGET mysqlclient::static)
 | 
			
		||||
    find_library(MYSQLCLIENT_STATIC_LIBS
 | 
			
		||||
        NAMES libmysqlclient.a
 | 
			
		||||
        HINTS ${mysqlclient_ROOT_DIR} ${mysqlclient_ROOT_DIR}/lib ${PC_MYSQL_CLIENT_LIBDIR}
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    if (MYSQLCLIENT_STATIC_LIBS)
 | 
			
		||||
        add_library(mysqlclient::static SHARED IMPORTED)
 | 
			
		||||
        set_target_properties(mysqlclient::static PROPERTIES
 | 
			
		||||
                IMPORTED_LOCATION ${MYSQLCLIENT_STATIC_LIBS}
 | 
			
		||||
                INTERFACE_INCLUDE_DIRECTORIES ${MYSQLCLIENT_INCLUDE_DIR}
 | 
			
		||||
        )
 | 
			
		||||
    endif ()
 | 
			
		||||
endif ()
 | 
			
		||||
find_package_handle_standard_args(mysqlclient DEFAULT_MSG
 | 
			
		||||
        MYSQLCLIENT_INCLUDE_DIR
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
mark_as_advanced(
 | 
			
		||||
        MYSQLCLIENT_ROOT_DIR
 | 
			
		||||
        MYSQLCLIENT_STATIC_LIBS
 | 
			
		||||
 | 
			
		||||
        PC_MYSQL_CLIENT
 | 
			
		||||
)
 | 
			
		||||
@ -276,8 +276,7 @@ target_link_libraries(TeaSpeakServer
 | 
			
		||||
        tomcrypt::static
 | 
			
		||||
        tommath::static
 | 
			
		||||
 | 
			
		||||
        /usr/local/mysql/lib/libmysqlclient.a
 | 
			
		||||
        #mysqlclient.a
 | 
			
		||||
        mysqlclient::static
 | 
			
		||||
        jsoncpp_lib
 | 
			
		||||
        ${ed25519_LIBRARIES_STATIC}
 | 
			
		||||
        ${DataPipes_LIBRARIES_SHARED} # Also includes glib2.0
 | 
			
		||||
@ -295,6 +294,14 @@ target_link_libraries(TeaSpeakServer
 | 
			
		||||
        z
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
#check_include_file(mysql.h HAVE_MYSQL_MYSQL_H)
 | 
			
		||||
#if (NOT HAVE_MYSQL_MYSQL_H)
 | 
			
		||||
#    check_include_file(mysql.h HAVE_MYSQL_H)
 | 
			
		||||
#    if (NOT HAVE_MYSQL_H)
 | 
			
		||||
#        message(FATAL_ERROR "Missing MySQL header")
 | 
			
		||||
#    endif ()
 | 
			
		||||
#endif ()
 | 
			
		||||
 | 
			
		||||
set(DISABLE_JEMALLOC ON)
 | 
			
		||||
if (NOT DISABLE_JEMALLOC)
 | 
			
		||||
    target_link_libraries(TeaSpeakServer
 | 
			
		||||
 | 
			
		||||
@ -183,10 +183,10 @@ std::shared_ptr<VirtualServer> VirtualServerManager::createServerFromSnapshot(sh
 | 
			
		||||
    }
 | 
			
		||||
    ServerId log_server_id = old ? old->getServerId() : serverId;
 | 
			
		||||
 | 
			
		||||
    futures.push_back({
 | 
			
		||||
    futures.emplace_back(
 | 
			
		||||
        "server id register",
 | 
			
		||||
        sql::command(this->handle->getSql(), "INSERT INTO `servers` (`serverId`, `host`, `port`) VALUES (:sid, :host, :port)", variable{":sid", serverId}, variable{":host", host}, variable{":port", port}).executeLater()
 | 
			
		||||
    });
 | 
			
		||||
    );
 | 
			
		||||
    sql::model sql_insert_channel(this->handle->getSql(), "INSERT INTO `channels` (`serverId`, `channelId`, `type`, `parentId`) VALUES (:sid, :id, :type, :pid)", variable{":sid", serverId});
 | 
			
		||||
    sql::model sql_insert_group_assignment(this->handle->getSql(), "INSERT INTO `assignedGroups` (`serverId`, `cldbid`, `groupId`, `channelId`, `until`) VALUES (:sid, :cldbid, :gid, :chid, :until)", variable{":sid", serverId}, variable{":until", 0});
 | 
			
		||||
    sql::model sql_insert_permission(this->handle->getSql(), "INSERT INTO `permissions` (`serverId`, `type`, `id`, `channelId`, `permId`, `value`, `grant`, `flag_skip`, `flag_negate`) VALUES (:serverId, :type, :id, :chId, :permId, :value, :grant, :flag_skip, :flag_negate)",
 | 
			
		||||
@ -215,7 +215,7 @@ std::shared_ptr<VirtualServer> VirtualServerManager::createServerFromSnapshot(sh
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            debugMessage(LOG_GENERAL, PREFIX + " Having server key {} = {}", key, arguments[index][key].as<std::string>());
 | 
			
		||||
            futures.push_back({
 | 
			
		||||
            futures.emplace_back(
 | 
			
		||||
                "server property import proprty=" + key,
 | 
			
		||||
                sql_insert_property.command().values(
 | 
			
		||||
                        variable{":type", property::PropertyType::PROP_TYPE_SERVER},
 | 
			
		||||
@ -223,7 +223,7 @@ std::shared_ptr<VirtualServer> VirtualServerManager::createServerFromSnapshot(sh
 | 
			
		||||
                        variable{":key", key},
 | 
			
		||||
                        variable{":value", arguments[index][key].string()}
 | 
			
		||||
                ).executeLater()
 | 
			
		||||
            });
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(arguments[index].has("end_virtualserver")) break;
 | 
			
		||||
@ -245,10 +245,10 @@ std::shared_ptr<VirtualServer> VirtualServerManager::createServerFromSnapshot(sh
 | 
			
		||||
                if (arguments[index].has("end_channels")) break;
 | 
			
		||||
 | 
			
		||||
                auto channel_id = arguments[index]["channel_id"].string();
 | 
			
		||||
                futures.push_back({
 | 
			
		||||
                futures.emplace_back(
 | 
			
		||||
                    "channel register cid=" + channel_id,
 | 
			
		||||
                    sql_insert_channel.command().values(variable{":id", channel_id}, variable{":type", -1}, variable{":pid", arguments[index]["channel_pid"].string()}).executeLater()
 | 
			
		||||
                }); //TODO findout type!
 | 
			
		||||
                ); //TODO findout type!
 | 
			
		||||
                for (const auto &key : arguments[index].keys()) {
 | 
			
		||||
                    if(key == "channel_id") continue;
 | 
			
		||||
                    if(key == "channel_pid") continue;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								shared
									
									
									
									
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								shared
									
									
									
									
									
								
							@ -1 +1 @@
 | 
			
		||||
Subproject commit 97fd71b69a88a189d3d24a527bea1c8442810e07
 | 
			
		||||
Subproject commit 71d1cc666b3135d9df0875a6f78f71cda64221e5
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user