summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mysql.com>2010-02-27 11:43:32 +0400
committerAlexander Barkov <bar@mysql.com>2010-02-27 11:43:32 +0400
commit7a83782f1caa102ebc552b017885f18f005425f0 (patch)
tree79944b66b5194acfaac9f3ba322f1403d08f0080 /libmysqld
parent69904fa6584b383368c94b1531e1a1a8a57f43b5 (diff)
parent6190282adb84a0b12829671ce9c4b98a7219c809 (diff)
downloadmariadb-git-7a83782f1caa102ebc552b017885f18f005425f0.tar.gz
Mergine from mysql-next-me
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/CMakeLists.txt185
-rw-r--r--libmysqld/Makefile.am7
-rw-r--r--libmysqld/examples/CMakeLists.txt54
-rw-r--r--libmysqld/lib_sql.cc6
4 files changed, 121 insertions, 131 deletions
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index cf6c9d19e68..e5f2a8b56f9 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,56 @@ 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
+ ../sql/mdl.cc ../sql/transaction.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})
+
+# Visual Studio users need debug static library
+IF(MSVC)
+ INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR}/debug)
+ENDIF()
+
+IF(MSVC AND NOT DISABLE_SHARED)
+ MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
+ENDIF()
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index 2e3b935cafa..380dfb1396c 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -75,11 +75,10 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
- debug_sync.cc \
- sql_tablespace.cc \
+ debug_sync.cc sql_tablespace.cc transaction.cc \
rpl_injector.cc my_user.c partition_info.cc \
- sql_servers.cc sql_audit.cc event_parse_data.cc \
- sql_signal.cc rpl_handler.cc keycaches.cc
+ sql_servers.cc event_parse_data.cc sql_signal.cc \
+ rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources)
nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index e4b6533f8a2..f8adae9c931 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -15,24 +15,46 @@
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)
-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)
+MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
+ ../../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(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)
+MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
+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
+ )
+ MYSQL_ADD_EXECUTABLE(mysql_client_test_embedded
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_client_test_embedded_dummy.cc
+ ../../tests/mysql_client_test.c)
+ELSE()
+ MYSQL_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()
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 78e07110d7b..256c1e8fd40 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -118,6 +118,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
net_clear_error(net);
thd->current_stmt= stmt;
+ thd->thread_stack= (char*) &thd;
thd->store_globals(); // Fix if more than one connect
/*
We have to call free_old_query before we start to fill mysql->fields
@@ -746,11 +747,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)