diff options
Diffstat (limited to 'libmysqld')
-rw-r--r-- | libmysqld/CMakeLists.txt | 179 | ||||
-rw-r--r-- | libmysqld/examples/CMakeLists.txt | 52 | ||||
-rw-r--r-- | libmysqld/lib_sql.cc | 5 |
3 files changed, 111 insertions, 125 deletions
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index cf6c9d19e68..5c83db5f87c 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -13,92 +13,38 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY -DHAVE_DLOPEN) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/libmysqld - ${CMAKE_SOURCE_DIR}/libmysql - ${CMAKE_SOURCE_DIR}/sql - ${CMAKE_SOURCE_DIR}/regex - ${CMAKE_SOURCE_DIR}/extra/yassl/include - ${CMAKE_SOURCE_DIR}/zlib) - -SET(GEN_SOURCES ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc - ${CMAKE_SOURCE_DIR}/sql/sql_yacc.h - ${CMAKE_SOURCE_DIR}/sql/message.h - ${CMAKE_SOURCE_DIR}/sql/message.rc - ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc - ${CMAKE_SOURCE_DIR}/sql/lex_hash.h) - -SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED 1) - -# Include and add the directory path -SET(SOURCE_SUBLIBS TRUE) -SET(LIB_SOURCES "") - -INCLUDE(${CMAKE_SOURCE_DIR}/zlib/CMakeLists.txt) -FOREACH(rpath ${ZLIB_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../zlib/${rpath}) -ENDFOREACH(rpath) - -# FIXME only needed if build type is "Debug", but CMAKE_BUILD_TYPE is -# not set during configure time. -INCLUDE(${CMAKE_SOURCE_DIR}/dbug/CMakeLists.txt) -FOREACH(rpath ${DBUG_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../dbug/${rpath}) -ENDFOREACH(rpath) - -INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/CMakeLists.txt) -FOREACH(rpath ${TAOCRYPT_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/taocrypt/${rpath}) -ENDFOREACH(rpath) - -INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/CMakeLists.txt) -FOREACH(rpath ${YASSL_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/${rpath}) -ENDFOREACH(rpath) - -INCLUDE(${CMAKE_SOURCE_DIR}/strings/CMakeLists.txt) -FOREACH(rpath ${STRINGS_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../strings/${rpath}) -ENDFOREACH(rpath) - -INCLUDE(${CMAKE_SOURCE_DIR}/regex/CMakeLists.txt) -FOREACH(rpath ${REGEX_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../regex/${rpath}) -ENDFOREACH(rpath) - -INCLUDE(${CMAKE_SOURCE_DIR}/mysys/CMakeLists.txt) -FOREACH(rpath ${MYSYS_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../mysys/${rpath}) -ENDFOREACH(rpath) - -INCLUDE(${CMAKE_SOURCE_DIR}/vio/CMakeLists.txt) -FOREACH(rpath ${VIO_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ../vio/${rpath}) -ENDFOREACH(rpath) - - - -FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS}) - STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER) - SET(ENGINE_DIR ${${ENGINE_LIB_UPPER}_DIR}) - INCLUDE(${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/CMakeLists.txt) - FOREACH(rpath ${${ENGINE_LIB_UPPER}_SOURCES}) - SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/${rpath}) - ENDFOREACH(rpath) -ENDFOREACH(ENGINE_LIB) - - -SET(SOURCE_SUBLIBS FALSE) - -SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc +ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY + ${SSL_DEFINES}) + +INCLUDE_DIRECTORIES( +${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/libmysql +${CMAKE_SOURCE_DIR}/libmysqld +${CMAKE_SOURCE_DIR}/sql +${CMAKE_BINARY_DIR}/sql +${CMAKE_SOURCE_DIR}/regex +${ZLIB_INCLUDE_DIR} +${SSL_INCLUDE_DIRS} +${SSL_INTERNAL_INCLUDE_DIRS} +${NDB_CLUSTER_INCLUDES} +${CMAKE_SOURCE_DIR}/sql/backup +) + +SET(GEN_SOURCES +${CMAKE_BINARY_DIR}/sql/sql_yacc.h +${CMAKE_BINARY_DIR}/sql/sql_yacc.cc +${CMAKE_BINARY_DIR}/sql/lex_hash.h +) + +SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED TRUE) + +SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../libmysql/libmysql.c ../libmysql/errmsg.c ../client/get_password.c ../sql-common/client.c ../sql-common/my_time.c ../sql-common/my_user.c ../sql-common/pack.c ../sql/password.c ../sql/discover.cc ../sql/derror.cc ../sql/field.cc ../sql/field_conv.cc - ../sql/filesort.cc ../sql/gstream.cc ../sql/ha_partition.cc + ../sql/filesort.cc ../sql/gstream.cc ../sql/handler.cc ../sql/hash_filo.cc ../sql/hostname.cc ../sql/init.cc ../sql/item_buff.cc ../sql/item_cmpfunc.cc ../sql/item.cc ../sql/item_create.cc ../sql/item_func.cc @@ -135,29 +81,50 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/scheduler.cc ../sql/sql_audit.cc ../sql/event_parse_data.cc ../sql/sql_signal.cc ../sql/rpl_handler.cc + ../sql/rpl_utility.cc + ../sql/sys_vars.cc + ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc ${GEN_SOURCES} - ${LIB_SOURCES}) - -# Seems we cannot make a library without at least one source file. So use a -# dummy empty file -FILE(WRITE cmake_dummy.c " ") - -# Tried use the correct ${GEN_SOURCES} as dependency, worked on Unix -# but not on Windows and Visual Studio generators. Likely because they -# are no real targets from the Visual Studio project files view. Added -# custom targets to "sql/CMakeLists.txt" and reference them here. -ADD_LIBRARY(mysqlserver STATIC ${LIBMYSQLD_SOURCES}) -ADD_DEPENDENCIES(mysqlserver GenServerSource GenError) -TARGET_LINK_LIBRARIES(mysqlserver) - -# Add any additional libraries requested by engine(s) -FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS}) - STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER) - IF(${ENGINE_LIB_UPPER}_LIBS) - TARGET_LINK_LIBRARIES(mysqlserver ${${ENGINE_LIB_UPPER}_LIBS}) - ENDIF(${ENGINE_LIB_UPPER}_LIBS) -ENDFOREACH(ENGINE_LIB) - -ADD_LIBRARY(libmysqld SHARED cmake_dummy.c libmysqld.def) -ADD_DEPENDENCIES(libmysqld mysqlserver) -TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32) + ${MYSYS_LIBWRAP_SOURCE} +) + + +ADD_CONVENIENCE_LIBRARY(sql_embedded ${SQL_EMBEDDED_SOURCES}) +DTRACE_INSTRUMENT(sql_embedded) +ADD_DEPENDENCIES(sql_embedded GenError GenServerSource) + +# On Windows, static embedded server library is called mysqlserver.lib +# On Unix, it is libmysqld.a +IF(WIN32) + SET(MYSQLSERVER_OUTPUT_NAME mysqlserver) +ELSE() + SET(MYSQLSERVER_OUTPUT_NAME mysqld) +ENDIF() + + +SET(LIBS + dbug strings regex mysys vio + ${ZLIB_LIBRARY} ${SSL_LIBRARIES} + ${LIBWRAP} ${LIBCRYPT} ${LIBDL} + ${MYSQLD_STATIC_PLUGIN_LIBS} ${NDB_CLIENT_LIBS} + sql_embedded +) + +# Some storage engine were compiled for embedded specifically +# (with corresponding target ${engine}_embedded) +SET(EMBEDDED_LIBS) +FOREACH(LIB ${LIBS}) + GET_TARGET_PROPERTY(EMBEDDED_LOCATION ${LIB}_embedded LOCATION) + IF(EMBEDDED_LOCATION) + LIST(APPEND EMBEDDED_LIBS ${LIB}_embedded) + ELSE() + LIST(APPEND EMBEDDED_LIBS ${LIB}) + ENDIF() +ENDFOREACH() + +MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS} + OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME}) + +IF(MSVC AND NOT DISABLE_SHARED) + MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS}) +ENDIF() diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index e4b6533f8a2..ed0e5a361a8 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -15,24 +15,48 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/libmysqld/include - ${CMAKE_SOURCE_DIR}/regex - ${CMAKE_SOURCE_DIR}/zlib - ${CMAKE_SOURCE_DIR}/extra/yassl/include) + ${CMAKE_SOURCE_DIR}/regex + ${READLINE_INCLUDE_DIR} + ) -# Currently does not work with DBUG, there are missing symbols reported. -ADD_DEFINITIONS(-DEMBEDDED_LIBRARY) +ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -UMYSQL_CLIENT) + ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc - ../../client/mysql.cc ../../client/readline.cc - ../../client/sql_string.cc) -TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) -TARGET_LINK_LIBRARIES(mysql_embedded libmysqld) + ../../client/mysql.cc ../../client/readline.cc) +TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver) +IF(UNIX) + ADD_DEFINITIONS(${READLINE_DEFINES}) + TARGET_LINK_LIBRARIES(mysql_embedded ${READLINE_LIBRARY}) +ENDIF(UNIX) ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc) -TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) -TARGET_LINK_LIBRARIES(mysqltest_embedded libmysqld) +TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver) + + +IF(CMAKE_GENERATOR MATCHES "Xcode") +# It does not seem possible to tell Xcode the resulting target might need +# to be linked with C++ runtime. The project needs to have at least one C++ +# file. Add a dummy one. + ADD_CUSTOM_COMMAND(OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/mysql_client_test_embedded_dummy.cc + COMMAND ${CMAKE_COMMAND} -E touch + ${CMAKE_CURRENT_BINARY_DIR}/mysql_client_test_embedded_dummy.cc + ) + ADD_EXECUTABLE(mysql_client_test_embedded + ${CMAKE_CURRENT_BINARY_DIR}/mysql_client_test_embedded_dummy.cc + ../../tests/mysql_client_test.c) +ELSE() + ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c) + SET_TARGET_PROPERTIES(mysql_client_test_embedded PROPERTIES HAS_CXX TRUE) +ENDIF() +TARGET_LINK_LIBRARIES(mysql_client_test_embedded mysqlserver) + +IF(UNIX) +SET_TARGET_PROPERTIES(mysql_embedded PROPERTIES ENABLE_EXPORTS TRUE) +SET_TARGET_PROPERTIES(mysqltest_embedded PROPERTIES ENABLE_EXPORTS TRUE) +SET_TARGET_PROPERTIES(mysql_client_test_embedded PROPERTIES ENABLE_EXPORTS TRUE) +ENDIF() -ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c) -TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) -TARGET_LINK_LIBRARIES(mysql_client_test_embedded libmysqld) +INSTALL(TARGETS mysql_embedded mysqltest_embedded mysql_client_test_embedded DESTINATION bin) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index d56ada00266..c1c5ce3ec97 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -746,11 +746,6 @@ void THD::clear_data_list() cur_data= 0; } -void THD::clear_error() -{ - if (stmt_da->is_error()) - stmt_da->reset_diagnostics_area(); -} static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) |