summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorcmiller@zippy.cornsilk.net <>2007-10-17 14:05:43 -0400
committercmiller@zippy.cornsilk.net <>2007-10-17 14:05:43 -0400
commitf3d77c1979bad93a304cbb5b93d672178815df00 (patch)
tree892096ddfa11f5fea89ad26528d5c64fbc05ffce /libmysqld
parentc6b5c6af86cb7fed9ad86690136d668071b6f6cc (diff)
parent571200d48750beba84a2936d727afcb347e1b704 (diff)
downloadmariadb-git-f3d77c1979bad93a304cbb5b93d672178815df00.tar.gz
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-comeng-unification
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-recentcommmerge
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/CMakeLists.txt234
-rw-r--r--libmysqld/Makefile.am6
-rw-r--r--libmysqld/emb_qcache.cc16
-rw-r--r--libmysqld/emb_qcache.h8
-rw-r--r--libmysqld/examples/CMakeLists.txt20
-rw-r--r--libmysqld/examples/Makefile.am14
-rw-r--r--libmysqld/lib_sql.cc43
-rw-r--r--libmysqld/libmysqld.def20
8 files changed, 248 insertions, 113 deletions
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 8a855ebdbf5..fb3316c303c 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -18,89 +18,191 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
# Need to set USE_TLS, since __declspec(thread) approach to thread local
# storage does not work properly in DLLs.
-ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_SERVER -DEMBEDDED_LIBRARY)
+IF(WIN32)
+ ADD_DEFINITIONS(-DUSE_TLS)
+ENDIF(WIN32)
-# The old Windows build method used renamed (.cc -> .cpp) source files, fails
-# in #include in lib_sql.cc. So disable that using the USING_CMAKE define.
-ADD_DEFINITIONS(-DUSING_CMAKE)
+ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/libmysqld
- ${CMAKE_SOURCE_DIR}/libmysql
+ ${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
-)
+ ${CMAKE_SOURCE_DIR}/zlib)
-SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
- PROPERTIES GENERATED 1)
-
-ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc
- ../client/get_password.c ../libmysql/errmsg.c
- ../libmysql/libmysql.c ../sql/password.c ../sql-common/client.c
- ../sql-common/my_time.c ../sql-common/my_user.c
- ../sql-common/pack.c ../sql/derror.cc ../sql/event_scheduler.cc
- ../sql/event_timed.cc ../sql/events.cc ../sql/discover.cc
- ../sql/field_conv.cc ../sql/field.cc ../sql/filesort.cc
- ../sql/gstream.cc ${mysql_se_ha_src}
- ../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 ../sql/item_geofunc.cc ../sql/item_row.cc
- ../sql/item_strfunc.cc ../sql/item_subselect.cc ../sql/item_sum.cc
- ../sql/item_timefunc.cc ../sql/item_uniq.cc ../sql/item_xmlfunc.cc
- ../sql/key.cc ../sql/lock.cc ../sql/log.cc ../sql/log_event.cc
- ../sql/mf_iocache.cc ../sql/my_decimal.cc ../sql/net_serv.cc
- ../sql/opt_range.cc ../sql/opt_sum.cc ../sql/parse_file.cc
- ../sql/procedure.cc ../sql/protocol.cc ../sql/records.cc
- ../sql/repl_failsafe.cc ../sql/rpl_filter.cc ../sql/set_var.cc
- ../sql/spatial.cc ../sql/sp_cache.cc ../sql/sp.cc
- ../sql/sp_head.cc ../sql/sp_pcontext.cc ../sql/sp_rcontext.cc
- ../sql/sql_acl.cc ../sql/sql_analyse.cc ../sql/sql_base.cc
- ../sql/sql_cache.cc ../sql/sql_class.cc ../sql/sql_crypt.cc
- ../sql/sql_cursor.cc ../sql/sql_db.cc ../sql/sql_delete.cc
- ../sql/sql_derived.cc ../sql/sql_do.cc ../sql/sql_error.cc
- ../sql/sql_handler.cc ../sql/sql_help.cc ../sql/sql_insert.cc
- ../sql/sql_lex.cc ../sql/sql_list.cc ../sql/sql_load.cc
- ../sql/sql_manager.cc ../sql/sql_map.cc ../sql/sql_parse.cc
- ../sql/sql_partition.cc ../sql/sql_plugin.cc ../sql/sql_prepare.cc
- ../sql/sql_rename.cc ../sql/sql_repl.cc ../sql/sql_select.cc
- ../sql/sql_show.cc ../sql/sql_state.c ../sql/sql_string.cc
- ../sql/sql_tablespace.cc ../sql/sql_table.cc ../sql/sql_test.cc
- ../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
- ../sql/sql_update.cc ../sql/sql_view.cc
- ../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
- ../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
- ../sql/partition_info.cc ../sql/sql_locale.cc
- ../sql/sql_connect.cc ../sql/scheduler.cc
- ../vio/vio.c ../vio/viosocket.c ../vio/viossl.c
- ../vio/viosslfactories.c
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h)
+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)
-# Seems we cannot make a library without at least one source file. So use a
-# dummy empty file
-FILE(WRITE cmake_dummy.c " ")
+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)
+
+# Engines
+INCLUDE(${CMAKE_SOURCE_DIR}/storage/heap/CMakeLists.txt)
+FOREACH(rpath ${HEAP_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/heap/${rpath})
+ENDFOREACH(rpath)
+
+INCLUDE(${CMAKE_SOURCE_DIR}/storage/myisam/CMakeLists.txt)
+FOREACH(rpath ${MYISAM_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/myisam/${rpath})
+ENDFOREACH(rpath)
+
+INCLUDE(${CMAKE_SOURCE_DIR}/storage/myisammrg/CMakeLists.txt)
+FOREACH(rpath ${MYISAMMRG_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/myisammrg/${rpath})
+ENDFOREACH(rpath)
-ADD_LIBRARY(mysqlserver cmake_dummy.c)
-TARGET_LINK_LIBRARIES(mysqlserver wsock32)
-ADD_DEPENDENCIES(mysqlserver dbug mysys strings zlib mysqldemb regex myisam myisammrg
- heap yassl taocrypt)
IF(WITH_ARCHIVE_STORAGE_ENGINE)
- ADD_DEPENDENCIES(mysqlserver archive)
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/archive/CMakeLists.txt)
+ FOREACH(rpath ${ARCHIVE_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/archive/${rpath})
+ ENDFOREACH(rpath)
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
+
+IF(WITH_BLACKHOLE_STORAGE_ENGINE)
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/blackhole/CMakeLists.txt)
+ FOREACH(rpath ${BLACKHOLE_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/blackhole/${rpath})
+ ENDFOREACH(rpath)
+ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
+
IF(WITH_EXAMPLE_STORAGE_ENGINE)
- ADD_DEPENDENCIES(mysqlserver example)
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/example/CMakeLists.txt)
+ FOREACH(rpath ${EXAMPLE_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/example/${rpath})
+ ENDFOREACH(rpath)
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
+
IF(WITH_FEDERATED_STORAGE_ENGINE)
- ADD_DEPENDENCIES(mysqlserver federated)
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/federated/CMakeLists.txt)
+ FOREACH(rpath ${FEDERATED_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/federated/${rpath})
+ ENDFOREACH(rpath)
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
+
IF(WITH_INNOBASE_STORAGE_ENGINE)
- ADD_DEPENDENCIES(mysqlserver innobase)
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/innobase/CMakeLists.txt)
+ FOREACH(rpath ${INNOBASE_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/innobase/${rpath})
+ ENDFOREACH(rpath)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+IF(WITH_CSV_STORAGE_ENGINE)
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/csv/CMakeLists.txt)
+ FOREACH(rpath ${CSV_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../storage/csv/${rpath})
+ ENDFOREACH(rpath)
+ENDIF(WITH_CSV_STORAGE_ENGINE)
+
+SET(SOURCE_SUBLIBS FALSE)
+
+SET(LIBMYSQLD_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/event_scheduler.cc ../sql/events.cc
+ ../sql/event_data_objects.cc ../sql/event_queue.cc
+ ../sql/event_db_repository.cc ../sql/field.cc ../sql/field_conv.cc
+ ../sql/filesort.cc ../sql/gstream.cc ../sql/ha_partition.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
+ ../sql/item_geofunc.cc ../sql/item_row.cc ../sql/item_strfunc.cc
+ ../sql/item_subselect.cc ../sql/item_sum.cc ../sql/item_timefunc.cc
+ ../sql/item_xmlfunc.cc ../sql/key.cc ../sql/lock.cc ../sql/log.cc
+ ../sql/log_event.cc ../sql/mf_iocache.cc ../sql/my_decimal.cc
+ ../sql/net_serv.cc ../sql/opt_range.cc ../sql/opt_sum.cc
+ ../sql/parse_file.cc ../sql/procedure.cc ../sql/protocol.cc
+ ../sql/records.cc ../sql/repl_failsafe.cc ../sql/rpl_filter.cc
+ ../sql/rpl_record.cc
+ ../sql/rpl_injector.cc ../sql/set_var.cc ../sql/spatial.cc
+ ../sql/sp_cache.cc ../sql/sp.cc ../sql/sp_head.cc
+ ../sql/sp_pcontext.cc ../sql/sp_rcontext.cc ../sql/sql_acl.cc
+ ../sql/sql_analyse.cc ../sql/sql_base.cc ../sql/sql_cache.cc
+ ../sql/sql_class.cc ../sql/sql_crypt.cc ../sql/sql_cursor.cc
+ ../sql/sql_db.cc ../sql/sql_delete.cc ../sql/sql_derived.cc
+ ../sql/sql_do.cc ../sql/sql_error.cc ../sql/sql_handler.cc
+ ../sql/sql_help.cc ../sql/sql_insert.cc ../sql/sql_lex.cc
+ ../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc
+ ../sql/sql_binlog.cc ../sql/sql_manager.cc ../sql/sql_map.cc
+ ../sql/sql_parse.cc ../sql/sql_partition.cc ../sql/sql_plugin.cc
+ ../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc
+ ../sql/sql_select.cc ../sql/sql_servers.cc
+ ../sql/sql_show.cc ../sql/sql_state.c ../sql/sql_string.cc
+ ../sql/sql_tablespace.cc ../sql/sql_table.cc ../sql/sql_test.cc
+ ../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
+ ../sql/sql_update.cc ../sql/sql_view.cc
+ ../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
+ ../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
+ ../sql/partition_info.cc ../sql/sql_connect.cc
+ ../sql/scheduler.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_LIBRARY(libmysqld MODULE cmake_dummy.c libmysqld.def)
-TARGET_LINK_LIBRARIES(libmysqld wsock32)
ADD_DEPENDENCIES(libmysqld mysqlserver)
+TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32)
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index 1b3207bac17..5d673bb340e 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -22,7 +22,7 @@ MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(libdir)
-EXTRA_DIST = libmysqld.def
+EXTRA_DIST = libmysqld.def CMakeLists.txt
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
@@ -79,7 +79,8 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
rpl_injector.cc my_user.c partition_info.cc \
sql_servers.cc
-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
+libmysqld_int_a_SOURCES= $(libmysqld_sources)
+nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
libmysqld_a_SOURCES=
sqlstoragesources = $(EXTRA_libmysqld_a_SOURCES)
@@ -96,6 +97,7 @@ INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/vio/libvio.a \
+ @NDB_SCI_LIBS@ \
@mysql_plugin_libs@ \
$(yassl_inc_libs)
diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc
index e6f35aa33a0..17549bfa96b 100644
--- a/libmysqld/emb_qcache.cc
+++ b/libmysqld/emb_qcache.cc
@@ -47,9 +47,9 @@ void Querycache_stream::store_short(ushort s)
cur_data+= 2;
return;
}
- *cur_data= ((byte *)(&s))[0];
+ *cur_data= ((uchar *)(&s))[0];
use_next_block(TRUE);
- *(cur_data++)= ((byte *)(&s))[1];
+ *(cur_data++)= ((uchar *)(&s))[1];
}
void Querycache_stream::store_int(uint i)
@@ -100,7 +100,7 @@ void Querycache_stream::store_ll(ulonglong ll)
}
memcpy(cur_data, &ll, rest_len);
use_next_block(TRUE);
- memcpy(cur_data, ((byte*)&ll)+rest_len, 8-rest_len);
+ memcpy(cur_data, ((uchar*)&ll)+rest_len, 8-rest_len);
cur_data+= 8-rest_len;
}
@@ -165,9 +165,9 @@ ushort Querycache_stream::load_short()
cur_data+= 2;
return result;
}
- ((byte*)&result)[0]= *cur_data;
+ ((uchar*)&result)[0]= *cur_data;
use_next_block(FALSE);
- ((byte*)&result)[1]= *(cur_data++);
+ ((uchar*)&result)[1]= *(cur_data++);
return result;
}
@@ -216,7 +216,7 @@ ulonglong Querycache_stream::load_ll()
}
memcpy(&result, cur_data, rest_len);
use_next_block(FALSE);
- memcpy(((byte*)&result)+rest_len, cur_data, 8-rest_len);
+ memcpy(((uchar*)&result)+rest_len, cur_data, 8-rest_len);
cur_data+= 8-rest_len;
return result;
}
@@ -245,7 +245,7 @@ char *Querycache_stream::load_str(MEM_ROOT *alloc, uint *str_len)
{
char *result;
*str_len= load_int();
- if (!(result= alloc_root(alloc, *str_len + 1)))
+ if (!(result= (char*) alloc_root(alloc, *str_len + 1)))
return 0;
load_str_only(result, *str_len);
return result;
@@ -259,7 +259,7 @@ int Querycache_stream::load_safe_str(MEM_ROOT *alloc, char **str, uint *str_len)
return 0;
}
(*str_len)--;
- if (!(*str= alloc_root(alloc, *str_len + 1)))
+ if (!(*str= (char*) alloc_root(alloc, *str_len + 1)))
return 1;
load_str_only(*str, *str_len);
return 0;
diff --git a/libmysqld/emb_qcache.h b/libmysqld/emb_qcache.h
index 5c5209902a1..6e320fbd967 100644
--- a/libmysqld/emb_qcache.h
+++ b/libmysqld/emb_qcache.h
@@ -15,8 +15,8 @@
class Querycache_stream
{
- byte *cur_data;
- byte *data_end;
+ uchar *cur_data;
+ uchar *data_end;
Query_cache_block *block;
uint headers_len;
public:
@@ -27,7 +27,7 @@ public:
Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) :
block(ini_block), headers_len(ini_headers_len)
{
- cur_data= ((byte*)block)+headers_len;
+ cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
#ifndef DBUG_OFF
first_block= ini_block;
@@ -54,7 +54,7 @@ public:
else
DBUG_ASSERT(block->type == Query_cache_block::RES_CONT);
- cur_data= ((byte*)block)+headers_len;
+ cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
}
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index b33b4740c93..ee129ff2df0 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -15,12 +15,24 @@
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)
# Currently does not work with DBUG, there are missing symbols reported.
-ADD_DEFINITIONS(-DDBUG_OFF)
-ADD_EXECUTABLE(test_libmysqld ../../client/completion_hash.cc
+IF(WIN32)
+ ADD_DEFINITIONS(-DUSE_TLS)
+ENDIF(WIN32)
+ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc
../../client/sql_string.cc)
-TARGET_LINK_LIBRARIES(test_libmysqld yassl taocrypt zlib wsock32)
-ADD_DEPENDENCIES(test_libmysqld libmysqld)
+TARGET_LINK_LIBRARIES(mysql_embedded mysys yassl taocrypt zlib debug dbug regex strings wsock32)
+ADD_DEPENDENCIES(mysql_embedded libmysqld)
+
+ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c)
+TARGET_LINK_LIBRARIES(mysqltest_embedded mysys yassl taocrypt zlib debug dbug regex strings wsock32)
+ADD_DEPENDENCIES(mysqltest_embedded libmysqld)
+
+ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)
+TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug mysys yassl taocrypt zlib strings wsock32)
+ADD_DEPENDENCIES(mysql_client_test_embedded libmysqld)
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index 3e4769c564d..3425b48645f 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -15,10 +15,11 @@
noinst_PROGRAMS = mysql
bin_PROGRAMS = mysqltest_embedded mysql_client_test_embedded
-client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES)
-tests_sources = $(mysql_client_test_embedded_SOURCES)
+client_sources = $(nodist_mysqltest_embedded_SOURCES) $(nodist_mysql_SOURCES)
+tests_sources = $(nodist_mysql_client_test_embedded_SOURCES)
BUILT_SOURCES = link_sources
CLEANFILES = $(client_sources) $(tests_sources) $(BUILT_SOURCES)
+EXTRA_DIST = CMakeLists.txt
link_sources:
for f in $(client_sources); do \
@@ -36,18 +37,19 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
$(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
-LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS)
+LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
+ @NDB_SCI_LIBS@
mysqltest_embedded_LINK = $(CXXLINK)
-mysqltest_embedded_SOURCES = mysqltest.c
+nodist_mysqltest_embedded_SOURCES = mysqltest.c
mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a
-mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
+nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
my_readline.h sql_string.h completion_hash.h
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
mysql_client_test_embedded_LINK = $(CXXLINK)
-mysql_client_test_embedded_SOURCES = mysql_client_test.c
+nodist_mysql_client_test_embedded_SOURCES = mysql_client_test.c
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index dbec5bf6bbf..9c26febe627 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -28,11 +28,7 @@ extern "C"
extern unsigned long max_allowed_packet, net_buffer_length;
}
-#if defined(__WIN__) && !defined(USING_CMAKE)
-#include "../sql/mysqld.cpp"
-#else
#include "../sql/mysqld.cc"
-#endif
C_MODE_START
@@ -68,13 +64,13 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
net->last_errno= ei->last_errno;
strmake(net->last_error, ei->info, sizeof(net->last_error));
memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate));
- my_free((gptr) data, MYF(0));
+ my_free(data, MYF(0));
}
static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
- const char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check,
+ const uchar *header, ulong header_length,
+ const uchar *arg, ulong arg_length, my_bool skip_check,
MYSQL_STMT *stmt)
{
my_bool result= 1;
@@ -180,7 +176,7 @@ static MYSQL_FIELD *emb_list_fields(MYSQL *mysql)
res= ((THD*) mysql->thd)->cur_data;
((THD*) mysql->thd)->cur_data= 0;
mysql->field_alloc= res->alloc;
- my_free((gptr) res,MYF(0));
+ my_free(res,MYF(0));
mysql->status= MYSQL_STATUS_READY;
return mysql->fields;
}
@@ -209,7 +205,7 @@ static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
stmt->fields= mysql->fields;
stmt->mem_root= res->alloc;
mysql->fields= NULL;
- my_free((gptr) res,MYF(0));
+ my_free(res,MYF(0));
}
return 0;
@@ -265,7 +261,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
thd->cur_data= res;
}
else
- my_free((gptr) res, MYF(0));
+ my_free(res, MYF(0));
return 0;
}
@@ -273,7 +269,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
static int emb_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("emb_stmt_execute");
- char header[5];
+ uchar header[5];
THD *thd;
my_bool res;
@@ -568,10 +564,21 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
init_alloc_root(&mysql->field_alloc, 8192, 0);
}
+/**
+ @brief Initialize a new THD for a connection in the embedded server
+
+ @param client_flag Client capabilities which this thread supports
+ @return pointer to the created THD object
+
+ @todo
+ This function copies code from several places in the server, including
+ create_new_thread(), and prepare_new_connection_state(). This should
+ be refactored to avoid code duplication.
+*/
void *create_embedded_thd(int client_flag)
{
THD * thd= new THD;
- thd->thread_id= thread_id++;
+ thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
thd->thread_stack= (char*) &thd;
if (thd->store_globals())
@@ -1063,22 +1070,22 @@ bool Protocol_text::store_null()
return false;
}
-bool Protocol::net_store_data(const char *from, uint length)
+bool Protocol::net_store_data(const uchar *from, size_t length)
{
char *field_buf;
if (!thd->mysql) // bootstrap file handling
- return false;
+ return FALSE;
- if (!(field_buf=alloc_root(alloc, length + sizeof(uint) + 1)))
- return true;
+ if (!(field_buf= (char*) alloc_root(alloc, length + sizeof(uint) + 1)))
+ return TRUE;
*(uint *)field_buf= length;
*next_field= field_buf + sizeof(uint);
- memcpy(*next_field, from, length);
+ memcpy((uchar*) *next_field, from, length);
(*next_field)[length]= 0;
if (next_mysql_field->max_length < length)
next_mysql_field->max_length=length;
++next_field;
++next_mysql_field;
- return false;
+ return FALSE;
}
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
index 6f7800ee207..78ff08e510a 100644
--- a/libmysqld/libmysqld.def
+++ b/libmysqld/libmysqld.def
@@ -1,6 +1,6 @@
LIBRARY LIBMYSQLD
-DESCRIPTION 'MySQL 5.0 Embedded Server Library'
-VERSION 5.0
+DESCRIPTION 'MySQL 5.1 Embedded Server Library'
+VERSION 5.1
EXPORTS
_dig_vec_upper
_dig_vec_lower
@@ -30,8 +30,8 @@ EXPORTS
my_print_variables
my_realloc
my_strdup
- my_thread_end
- my_thread_init
+ mysql_thread_end
+ mysql_thread_init
myodbc_remove_escape
mysql_affected_rows
mysql_autocommit
@@ -41,11 +41,14 @@ EXPORTS
mysql_commit
mysql_data_seek
mysql_debug
+ mysql_disable_rpl_parse
mysql_dump_debug_info
+ mysql_enable_rpl_parse
mysql_eof
mysql_errno
mysql_error
mysql_escape_string
+ mysql_hex_string
mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields
@@ -55,15 +58,18 @@ EXPORTS
mysql_field_seek
mysql_field_tell
mysql_free_result
+ mysql_get_character_set_info
mysql_get_client_info
mysql_get_host_info
mysql_get_proto_info
mysql_get_server_info
+ mysql_get_client_version
mysql_get_ssl_cipher
mysql_info
mysql_init
mysql_insert_id
mysql_kill
+ mysql_set_server_option
mysql_list_dbs
mysql_list_fields
mysql_list_processes
@@ -84,6 +90,8 @@ EXPORTS
mysql_rollback
mysql_row_seek
mysql_row_tell
+ mysql_rpl_parse_enabled
+ mysql_rpl_probe
mysql_select_db
mysql_send_query
mysql_shutdown
@@ -109,6 +117,7 @@ EXPORTS
get_tty_password
sql_protocol_typelib
mysql_get_server_version
+ mysql_set_character_set
mysql_sqlstate
charsets_dir
disabled_my_option
@@ -133,6 +142,8 @@ EXPORTS
my_read
llstr
mysql_get_parameters
+ mysql_thread_init
+ mysql_thread_end
mysql_stmt_bind_param
mysql_stmt_bind_result
mysql_stmt_execute
@@ -164,4 +175,3 @@ EXPORTS
my_charset_bin
my_charset_same
modify_defaults_file
- mysql_set_server_option