summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriggy@amd64.(none) <>2007-08-03 21:44:59 -0400
committeriggy@amd64.(none) <>2007-08-03 21:44:59 -0400
commit64b6c611081e4a2cc10272888a2ba987dcecb188 (patch)
tree8a56836c31dc997c4350174acfc4c641d741f298
parentdb15f4daebe6cbdc27990182f1a1c000bc80769a (diff)
parent171f402ad448c92dc76ed38a52008de1e6a351ac (diff)
downloadmariadb-git-64b6c611081e4a2cc10272888a2ba987dcecb188.tar.gz
Merge amd64.(none):/src/mysql-5.1-maint
into amd64.(none):/src/mysql-5.1-build_29903
-rw-r--r--.bzrignore3
-rw-r--r--client/client_priv.h2
-rw-r--r--client/mysql.cc48
-rw-r--r--libmysqld/CMakeLists.txt63
-rw-r--r--libmysqld/examples/CMakeLists.txt6
-rw-r--r--libmysqld/libmysqld.def8
-rwxr-xr-xmysql-test/mysql-test-run.pl31
-rw-r--r--mysql-test/r/mysql.result1
-rw-r--r--mysql-test/t/mysql.test7
-rw-r--r--win/README15
10 files changed, 159 insertions, 25 deletions
diff --git a/.bzrignore b/.bzrignore
index af4feb9a5b8..c38cb22d0fd 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1099,6 +1099,7 @@ libmysqld/item_sum.cc
libmysqld/item_timefunc.cc
libmysqld/item_uniq.cc
libmysqld/key.cc
+libmysqld/lex_hash.h
libmysqld/lib_sql.cpp
libmysqld/libmysql.c
libmysqld/link_sources
@@ -1107,6 +1108,8 @@ libmysqld/log.cc
libmysqld/log_event.cc
libmysqld/log_event_old.cc
libmysqld/md5.c
+libmysqld/message.h
+libmysqld/message.rc
libmysqld/mf_iocache.cc
libmysqld/mini_client.cc
libmysqld/my_decimal.cc
diff --git a/client/client_priv.h b/client/client_priv.h
index 97ff44b67fc..a2f61b9e9ca 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -48,7 +48,7 @@ enum options_client
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
- OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS,
+ OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_SERVER_ARG,
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT,
#ifdef HAVE_NDBCLUSTER_DB
diff --git a/client/mysql.cc b/client/mysql.cc
index c0423e0c897..45b049bc518 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -51,6 +51,9 @@ const char *VER= "14.14";
/* Buffer to hold 'version' and 'version_comment' */
#define MAX_SERVER_VERSION_LENGTH 128
+/* Array of options to pass to libemysqld */
+#define MAX_SERVER_ARGS 64
+
void* sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr);
#include "sql_string.h"
@@ -304,7 +307,10 @@ static COMMANDS commands[] = {
};
static const char *load_default_groups[]= { "mysql","client",0 };
-static const char *server_default_groups[]=
+
+static int embedded_server_arg_count= 0;
+static char *embedded_server_args[MAX_SERVER_ARGS];
+static const char *embedded_server_groups[]=
{ "server", "embedded", "mysql_SERVER", 0 };
#ifdef HAVE_READLINE
@@ -349,15 +355,6 @@ static sig_handler handle_sigint(int sig);
int main(int argc,char *argv[])
{
char buff[80];
- char *defaults, *extra_defaults, *group_suffix;
- char *emb_argv[4];
- int emb_argc;
-
- /* Get --defaults-xxx args for mysql_server_init() */
- emb_argc= get_defaults_options(argc, argv, &defaults, &extra_defaults,
- &group_suffix)+1;
- memcpy((char*) emb_argv, (char*) argv, emb_argc * sizeof(*argv));
- emb_argv[emb_argc]= 0;
MY_INIT(argv[0]);
DBUG_ENTER("main");
@@ -418,7 +415,8 @@ int main(int argc,char *argv[])
my_end(0);
exit(1);
}
- if (mysql_server_init(emb_argc, emb_argv, (char**) server_default_groups))
+ if (mysql_server_init(embedded_server_arg_count, embedded_server_args,
+ (char**) embedded_server_groups))
{
free_defaults(defaults_argv);
my_end(0);
@@ -541,6 +539,8 @@ sig_handler mysql_end(int sig)
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
+ while (embedded_server_arg_count > 1)
+ my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
mysql_server_end();
free_defaults(defaults_argv);
my_end(my_end_arg);
@@ -766,6 +766,8 @@ static struct my_option my_long_options[] =
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
" uses old (pre-4.1.1) protocol", (uchar**) &opt_secure_auth,
(uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
(uchar**) &show_warnings, (uchar**) &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
@@ -893,7 +895,29 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
break;
- break;
+ case OPT_SERVER_ARG:
+#ifdef EMBEDDED_LIBRARY
+ /*
+ When the embedded server is being tested, the client needs to be
+ able to pass command-line arguments to the embedded server so it can
+ locate the language files and data directory.
+ */
+ if (!embedded_server_arg_count)
+ {
+ embedded_server_arg_count= 1;
+ embedded_server_args[0]= (char*) "";
+ }
+ if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
+ !(embedded_server_args[embedded_server_arg_count++]=
+ my_strdup(argument, MYF(MY_FAE))))
+ {
+ put_info("Can't use server argument", INFO_ERROR);
+ return 0;
+ }
+#else /*EMBEDDED_LIBRARY */
+ printf("WARNING: --server-arg option not supported in this configuration.\n");
+#endif
+ break;
case 'A':
opt_rehash= 0;
break;
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 45a298b2efe..e8e5bebb5fc 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -21,16 +21,20 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_SERVER)
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
)
-SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
+SET_SOURCE_FILES_PROPERTIES(sql_yacc.cc
+ sql_yacc.h
+ message.h
+ message.rc
+ ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc
+ lex_hash.h
PROPERTIES GENERATED 1)
ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc
@@ -76,10 +80,54 @@ ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.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)
+ sql_yacc.cc
+ sql_yacc.h
+ message.h
+ message.rc
+ lex_hash.h)
ADD_DEPENDENCIES(mysqldemb GenError)
+# Sql Parser custom command
+ADD_CUSTOM_COMMAND(
+ SOURCE ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
+ OUTPUT sql_yacc.cc
+ COMMAND bison.exe
+ ARGS -y -p MYSQL --defines=sql_yacc.h
+ --output=sql_yacc.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
+ DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
+)
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT sql_yacc.h
+ COMMAND echo
+ DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
+)
+
+# Windows message file
+ADD_CUSTOM_COMMAND(
+ SOURCE ${CMAKE_SOURCE_DIR}/sql/message.mc
+ OUTPUT message.rc message.h
+ COMMAND mc
+ ARGS ${CMAKE_SOURCE_DIR}/sql/message.mc
+ DEPENDS ${CMAKE_SOURCE_DIR}/sql/message.mc
+)
+
+# Gen_lex_hash
+ADD_EXECUTABLE(gen_lex_hash ../sql/gen_lex_hash.cc)
+TARGET_LINK_LIBRARIES(gen_lex_hash dbug mysqlclient wsock32)
+GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
+ADD_CUSTOM_COMMAND(
+ OUTPUT lex_hash.h
+ COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h
+ DEPENDS ${GEN_LEX_HASH_EXE}
+)
+
+# Remove the auto-generated files as part of 'Clean Solution'
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
+ "lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc")
+
+ADD_DEPENDENCIES(mysqldemb gen_lex_hash)
+
# Seems we cannot make a library without at least one source file. So use a
# dummy empty file
FILE(WRITE cmake_dummy.c " ")
@@ -116,3 +164,6 @@ ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF(WITH_BLACKHOLE_STORAGE_ENGINE)
TARGET_LINK_LIBRARIES(libmysqld blackhole)
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
+IF(WITH_CSV_STORAGE_ENGINE)
+ TARGET_LINK_LIBRARIES(libmysqld csv)
+ENDIF(WITH_CSV_STORAGE_ENGINE)
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index 59fa390399d..13956fe0a10 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -23,11 +23,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
# Currently does not work with DBUG, there are missing symbols reported.
ADD_DEFINITIONS(-DDBUG_OFF)
ADD_DEFINITIONS(-DUSE_TLS)
-ADD_EXECUTABLE(test_libmysqld ../../client/completion_hash.cc
+ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc
../../client/sql_string.cc)
-TARGET_LINK_LIBRARIES(test_libmysqld mysys yassl taocrypt zlib dbug regex strings wsock32)
-ADD_DEPENDENCIES(test_libmysqld libmysqld)
+TARGET_LINK_LIBRARIES(mysql_embedded mysys yassl taocrypt zlib 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 dbug regex strings wsock32)
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
index c1025cd3846..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
@@ -48,6 +48,7 @@ EXPORTS
mysql_errno
mysql_error
mysql_escape_string
+ mysql_hex_string
mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields
@@ -62,11 +63,13 @@ EXPORTS
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
@@ -172,4 +175,3 @@ EXPORTS
my_charset_bin
my_charset_same
modify_defaults_file
- mysql_set_server_option
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index e05849eda16..305c56d69cd 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -693,6 +693,37 @@ sub command_line_setup () {
$glob_timers= mtr_init_timers();
+ # --------------------------------------------------------------------------
+ # Embedded server flag
+ # --------------------------------------------------------------------------
+ if ( $opt_embedded_server )
+ {
+ $glob_use_embedded_server= 1;
+ # Add the location for libmysqld.dll to the path.
+ if ( $glob_win32 )
+ {
+ my $lib_mysqld=
+ mtr_path_exists(vs_config_dirs('libmysqld',''));
+ $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"`
+ : ";".$lib_mysqld;
+ chomp($lib_mysqld);
+ $ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld;
+ }
+
+ push(@glob_test_mode, "embedded");
+ $opt_skip_rpl= 1; # We never run replication with embedded
+ $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
+ $opt_skip_ssl= 1; # Turn off use of SSL
+
+ # Turn off use of bin log
+ push(@opt_extra_mysqld_opt, "--skip-log-bin");
+
+ if ( $opt_extern )
+ {
+ mtr_error("Can't use --extern with --embedded-server");
+ }
+ }
+
#
# Find the mysqld executable to be able to find the mysqld version
# number as early as possible
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 57e1f2e4ef6..f5b369f246a 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -177,3 +177,4 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
1
1
End of 5.0 tests
+WARNING: --server-arg option not supported in this configuration.
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index e7131efa0f3..16f5fecf051 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -275,3 +275,10 @@ EOF
--exec $MYSQL --character-sets-dir="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1
--echo End of 5.0 tests
+
+#
+# Bug #29903: The CMake build method does not produce the embedded library.
+#
+--disable_query_log
+--exec $MYSQL --server-arg=no-defaults test -e "quit"
+--enable_query_log
diff --git a/win/README b/win/README
index afa4bd65163..d4b6ee1e3df 100644
--- a/win/README
+++ b/win/README
@@ -65,6 +65,8 @@ The options right now are:
EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS
default will be used. (Note - This option should only be
used by MySQL AB.)
+ EMBEDDED_ONLY Configure solution to produce libmysqld.dll
+ default will be used.
So the command line could look like:
@@ -98,3 +100,16 @@ may be necessary to clean the build tree to remove any stale objects.
Please see this link: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
At step 5 you only need to add the libraries advapi32.lib and user32.lib to
the file "corewin_express.vsprops" in order to avoid link errors.
+
+3. Testing the Windows embedded library requires a two step process. The extra
+step is necessary because the testsuite requires mysqld to run properly but both
+the embedded library and the mysqld executable cannot be built at the same time.
+Here's the process for building and testing the embedded library:
+
+ A. Follow steps 1 - 7 listed above to produce the Release configuration.
+ B. Perform step 5 from above again adding "--EMBEDDED-ONLY" to previously
+ supplied options.
+ C. Complete the build steps above to produce the Release configuration. Make
+ sure to Rebuild the solution so that all libraries are re-built.
+ D. Run the testsuite as usual.
+