Commit 35503e76 authored by msvensson@pilot.(none)'s avatar msvensson@pilot.(none)

Merge bk-internal:/home/bk/mysql-5.1-maint

into  pilot.(none):/data/msvensson/mysql/mysql-5.1-new-maint
parents 6e3a7e0b a933f28a
......@@ -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
......
......@@ -18,22 +18,24 @@ PROJECT(MySql)
# This reads user configuration, generated by configure.js.
INCLUDE(win/configure.data)
# By default, CMake will create Release, Debug, RelWithDebInfo and MinSizeRel
# configurations. The EMBEDDED_ONLY build parameter is necessary because CMake
# doesn't support custom build configurations for VS2005. Since the Debug
# configuration does not work properly with USE_TLS defined
# (see mysys/CMakeLists.txt) the easiest way to debug the Embedded Server is to
# use the RelWithDebInfo configuration without optimizations.
#
# Debug default CXX_FLAGS "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1"
# RelWithDebInfo default CXX_FLAGS "/MD /Zi /O2 /Ob1 /D NDEBUG"
#
IF(NOT EMBEDDED_ONLY)
# Hardcode support for CSV storage engine
SET(WITH_CSV_STORAGE_ENGINE TRUE)
ELSE(NOT EMBEDDED_ONLY)
# Hardcode support for CSV storage engine
SET(WITH_CSV_STORAGE_ENGINE TRUE)
# CMAKE will not allow custom VS7+ configurations. mysqld and libmysqld
# cannot be built at the same time as they require different configurations
IF(EMBEDDED_ONLY)
ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
# By default, CMake will create Release, Debug, RelWithDebInfo and MinSizeRel
# configurations. The EMBEDDED_ONLY build parameter is necessary because CMake
# doesn't support custom build configurations for VS2005. Since the Debug
# configuration does not work properly with USE_TLS defined
# (see mysys/CMakeLists.txt) the easiest way to debug the Embedded Server is to
# use the RelWithDebInfo configuration without optimizations.
#
# Debug default CXX_FLAGS "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1"
# RelWithDebInfo default CXX_FLAGS "/MD /Zi /O2 /Ob1 /D NDEBUG"
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Zi /Od /Ob0 /D NDEBUG" CACHE STRING "No Optimization" FORCE)
ENDIF(NOT EMBEDDED_ONLY)
ENDIF(EMBEDDED_ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
......@@ -241,14 +243,11 @@ ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/innobase)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
# CMAKE will not allow custom VS7+ configurations. mysqld and libmysqld
# cannot be built at the same time as they require different configurations
ADD_SUBDIRECTORY(client)
IF(EMBEDDED_ONLY)
ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
ADD_SUBDIRECTORY(libmysqld)
ADD_SUBDIRECTORY(libmysqld/examples)
ELSE(EMBEDDED_ONLY)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(sql)
ADD_SUBDIRECTORY(server-tools/instance-manager)
ADD_SUBDIRECTORY(libmysql)
......
......@@ -104,40 +104,43 @@ ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
)
ADD_DEPENDENCIES(mysqlclient GenError)
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
TARGET_LINK_LIBRARIES(mysql mysqlclient mysys zlib dbug wsock32)
ADD_EXECUTABLE(mysqltest mysqltest.c)
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys zlib dbug regex wsock32)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug zlib wsock32)
ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlimport mysqlimport.c)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient dbug zlib wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc
../mysys/my_bit.c ../mysys/my_bitmap.c ../mysys/my_vle.c
../mysys/base64.c)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug zlib wsock32)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib wsock32 dbug)
IF(NOT EMBEDDED_ONLY)
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
TARGET_LINK_LIBRARIES(mysql mysqlclient mysys zlib dbug wsock32)
ADD_EXECUTABLE(mysqltest mysqltest.c)
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys zlib dbug regex wsock32)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug zlib wsock32)
ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlimport mysqlimport.c)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient dbug zlib wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc
../mysys/my_bit.c ../mysys/my_bitmap.c ../mysys/my_vle.c
../mysys/base64.c)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug zlib wsock32)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib wsock32 dbug)
ENDIF(NOT EMBEDDED_ONLY)
ADD_EXECUTABLE(echo echo.c)
......
......@@ -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
......
......@@ -51,6 +51,9 @@ const char *VER= "14.13";
/* 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"
......@@ -302,7 +305,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
......@@ -347,15 +353,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");
......@@ -416,7 +413,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);
......@@ -539,6 +537,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(info_flag ? MY_CHECK_ERROR : 0);
......@@ -761,6 +761,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},
......@@ -888,7 +890,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;
......
......@@ -25,16 +25,20 @@ ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_SERVER)
ADD_DEFINITIONS(-DUSING_CMAKE)
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
......@@ -80,10 +84,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 " ")
......@@ -120,3 +168,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)
......@@ -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)\"" \
......
......@@ -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)
......
......@@ -19,6 +19,7 @@ client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES)
tests_sources = $(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 \
......
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
......@@ -688,6 +688,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
......
......@@ -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.
......@@ -334,4 +334,28 @@ Qcache_queries_in_cache 0
drop table t1;
drop function metaphon;
set GLOBAL query_cache_size=default;
CREATE TABLE const_len_bug (
str_const varchar(4000),
result1 varchar(4000),
result2 varchar(4000)
);
CREATE TRIGGER check_const_len_trigger BEFORE INSERT ON const_len_bug FOR EACH ROW BEGIN
set NEW.str_const = 'bar';
set NEW.result2 = check_const_len(NEW.str_const);
END |
CREATE PROCEDURE check_const_len_sp (IN str_const VARCHAR(4000))
BEGIN
DECLARE result VARCHAR(4000);
SET result = check_const_len(str_const);
insert into const_len_bug values(str_const, result, "");
END |
CREATE FUNCTION check_const_len RETURNS string SONAME "UDF_EXAMPLE_LIB";
CALL check_const_len_sp("foo");
SELECT * from const_len_bug;
str_const result1 result2
bar Correct length Correct length
DROP FUNCTION check_const_len;
DROP PROCEDURE check_const_len_sp;
DROP TRIGGER check_const_len_trigger;
DROP TABLE const_len_bug;
End of 5.0 tests.
......@@ -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
......@@ -364,4 +364,40 @@ drop function metaphon;
set GLOBAL query_cache_size=default;
#
# Bug #29804 UDF parameters don't contain correct string length
#
CREATE TABLE const_len_bug (
str_const varchar(4000),
result1 varchar(4000),
result2 varchar(4000)
);
DELIMITER |;
CREATE TRIGGER check_const_len_trigger BEFORE INSERT ON const_len_bug FOR EACH ROW BEGIN
set NEW.str_const = 'bar';
set NEW.result2 = check_const_len(NEW.str_const);
END |
CREATE PROCEDURE check_const_len_sp (IN str_const VARCHAR(4000))
BEGIN
DECLARE result VARCHAR(4000);
SET result = check_const_len(str_const);
insert into const_len_bug values(str_const, result, "");
END |
DELIMITER ;|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION check_const_len RETURNS string SONAME "$UDF_EXAMPLE_LIB";
CALL check_const_len_sp("foo");
SELECT * from const_len_bug;
DROP FUNCTION check_const_len;
DROP PROCEDURE check_const_len_sp;
DROP TRIGGER check_const_len_trigger;
DROP TABLE const_len_bug;
--echo End of 5.0 tests.
......@@ -2916,7 +2916,8 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
String *res= arguments[i]->val_str(&buffers[i]);
if (arguments[i]->null_value)
continue;
f_args.args[i]= (char*) res->ptr();
f_args.args[i]= (char*) res->c_ptr();
f_args.lengths[i]= res->length();
break;
}
case INT_RESULT:
......
......@@ -1106,4 +1106,39 @@ char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)),
}
my_bool check_const_len_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if (args->arg_count != 1)
{
strmov(message, "IS_CONST accepts only one argument");
return 1;
}
if (args->args[0] == 0)
{
initid->ptr= "Not constant";
}
else if(strlen(args->args[0]) == args->lengths[0])
{
initid->ptr= "Correct length";
}
else
{
initid->ptr= "Wrong length";
}
initid->max_length = 100;
return 0;
}
char * check_const_len(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)),
char *result, unsigned long *length,
char *is_null, char *error __attribute__((unused)))
{
strmov(result, initid->ptr);
*length= strlen(result);
*is_null= 0;
return result;
}
#endif /* HAVE_DLOPEN */
......@@ -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.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment