gis-related tests fixes.
merging.
This commit is contained in:
commit
b826c88841
@ -1,6 +1,6 @@
|
||||
[MYSQL]
|
||||
tree_location = lp:maria/5.2
|
||||
tree_location = lp:maria/5.3
|
||||
post_commit_to = commits@mariadb.org
|
||||
post_commit_url = lp:maria/5.2
|
||||
tree_name = maria/5.2
|
||||
project_name = "Mariadb 5.2, with Maria 2.0"
|
||||
post_commit_url = lp:maria/5.3
|
||||
tree_name = maria/5.3
|
||||
project_name = "Mariadb 5.3, with Aria 2.0"
|
||||
|
26
.bzrignore
26
.bzrignore
@ -10,6 +10,7 @@
|
||||
*.core
|
||||
*.d
|
||||
*.da
|
||||
*.dir
|
||||
*.dll
|
||||
*.exe
|
||||
*.exp
|
||||
@ -31,6 +32,7 @@
|
||||
*.pdb
|
||||
*.reject
|
||||
*.res
|
||||
*.rule
|
||||
*.sbr
|
||||
*.so
|
||||
*.so.*
|
||||
@ -41,15 +43,21 @@
|
||||
*.dsp
|
||||
*.Po
|
||||
*.Plo
|
||||
*.dir/
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
*/*.dir/*
|
||||
*.dir
|
||||
Debug
|
||||
MySql.sdf
|
||||
Win32
|
||||
*/*_pure_*warnings
|
||||
*/.deps
|
||||
*/.libs/*
|
||||
*/.pure
|
||||
debug/
|
||||
MinSizeRel/
|
||||
Release/
|
||||
RelWithDebInfo/
|
||||
*/debug/*
|
||||
*/minsizerel/*
|
||||
*/release/*
|
||||
RelWithDebInfo
|
||||
*~
|
||||
.*.swp
|
||||
./CMakeCache.txt
|
||||
@ -336,6 +344,7 @@ client/rpl_record_old.h
|
||||
client/rpl_tblmap.h
|
||||
client/rpl_tblmap.cc
|
||||
client/rpl_utility.h
|
||||
client/rpl_utility.cc
|
||||
client/select_test
|
||||
client/sql_string.cpp
|
||||
client/ssl_test
|
||||
@ -429,6 +438,7 @@ include/mysql_h.ic
|
||||
include/mysql_version.h
|
||||
include/mysqld_ername.h
|
||||
include/mysqld_error.h
|
||||
include/mysqld_error.h.rule
|
||||
include/openssl
|
||||
include/readline
|
||||
include/readline/*.h
|
||||
@ -672,6 +682,8 @@ libmysqld/unireg.cc
|
||||
libmysqld/discover_xt.cc
|
||||
libmysqld/ha_pbxt.cc
|
||||
libmysqld/myxt_xt.cc
|
||||
libmysqld/rpl_reporting.cc
|
||||
libmysqld/rpl_utility.cc
|
||||
libmysqltest/*.ds?
|
||||
libmysqltest/*.vcproj
|
||||
libmysqltest/mytest.c
|
||||
@ -1154,7 +1166,9 @@ scripts/mysql_find_rows
|
||||
scripts/mysql_fix_extensions
|
||||
scripts/mysql_fix_privilege_tables
|
||||
scripts/mysql_fix_privilege_tables.sql
|
||||
scripts/mysql_fix_privilege_tables.sql.rule
|
||||
scripts/mysql_fix_privilege_tables_sql.c
|
||||
scripts/mysql_fix_privilege_tables_sql.c.rule
|
||||
scripts/mysql_install_db
|
||||
scripts/mysql_secure_installation
|
||||
scripts/mysql_setpermission
|
||||
@ -1239,6 +1253,7 @@ sql/handlerton.cc
|
||||
sql/html
|
||||
sql/latex
|
||||
sql/lex_hash.h
|
||||
sql/lex_hash.h.rule
|
||||
sql/link_sources
|
||||
sql/max/*
|
||||
sql/message.h
|
||||
@ -1290,6 +1305,7 @@ sql/sql_builtin.cc
|
||||
sql/sql_select.cc.orig
|
||||
sql/sql_yacc.cc
|
||||
sql/sql_yacc.h
|
||||
sql/sql_yacc.h.rule
|
||||
sql/sql_yacc.output
|
||||
sql/sql_yacc.yy.orig
|
||||
sql/test_time
|
||||
|
@ -92,6 +92,7 @@ ADD_DEFINITIONS(-D__NT__)
|
||||
|
||||
IF(CYBOZU)
|
||||
ADD_DEFINITIONS(-DCYBOZU)
|
||||
ADD_DEFINITIONS(-DHAVE_UTF8_GENERAL_CS)
|
||||
ENDIF(CYBOZU)
|
||||
|
||||
IF(EXTRA_DEBUG)
|
||||
@ -170,15 +171,7 @@ IF(MSVC)
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)
|
||||
|
||||
# Disable automatic manifest generation.
|
||||
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
|
||||
${CMAKE_EXE_LINKER_FLAGS})
|
||||
# Explicitly disable it since it is the default for newer versions of VS
|
||||
STRING(REGEX MATCH "MANIFEST:NO" tmp_manifest ${CMAKE_EXE_LINKER_FLAGS})
|
||||
IF(NOT tmp_manifest)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
ENDIF(NOT tmp_manifest)
|
||||
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL:NO")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(WIN32)
|
||||
@ -363,7 +356,6 @@ ADD_SUBDIRECTORY(extra/libevent)
|
||||
ADD_SUBDIRECTORY(extra)
|
||||
ADD_SUBDIRECTORY(sql)
|
||||
ADD_SUBDIRECTORY(client)
|
||||
ADD_SUBDIRECTORY(server-tools/instance-manager)
|
||||
ADD_SUBDIRECTORY(libmysql)
|
||||
ADD_SUBDIRECTORY(libservices)
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
|
@ -14,7 +14,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
|
||||
|
||||
# We use the "mysqlclient_notls" library here just as safety, in case
|
||||
# We use the "mysqlclient" library here just as safety, in case
|
||||
# any of the clients here would go beyond the client API and access the
|
||||
# Thread Local Storage directly.
|
||||
|
||||
@ -29,27 +29,27 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysql mysqlclient wsock32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc DESTINATION bin)
|
||||
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
|
||||
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient wsock32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysqldump mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysqldump mysqlclient wsock32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient wsock32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient wsock32)
|
||||
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient wsock32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
|
||||
../mysys/mf_tempdir.c
|
||||
@ -58,11 +58,12 @@ MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
|
||||
../mysys/my_bitmap.c
|
||||
../mysys/my_vle.c
|
||||
../mysys/base64.c
|
||||
../mysys/checksum.c
|
||||
DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient wsock32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient_notls wsock32)
|
||||
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient wsock32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c DESTINATION bin)
|
||||
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
|
||||
|
@ -24,6 +24,7 @@ endif
|
||||
INCLUDES = -I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/regex \
|
||||
@ZLIB_INCLUDES@ \
|
||||
$(openssl_includes)
|
||||
|
||||
LIBS = @CLIENT_LIBS@
|
||||
@ -63,7 +64,8 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc \
|
||||
$(top_srcdir)/mysys/my_bit.c \
|
||||
$(top_srcdir)/mysys/my_bitmap.c \
|
||||
$(top_srcdir)/mysys/my_vle.c \
|
||||
$(top_srcdir)/mysys/base64.c
|
||||
$(top_srcdir)/mysys/base64.c \
|
||||
$(top_srcdir)/mysys/checksum.c
|
||||
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
|
||||
|
||||
mysqldump_SOURCES= mysqldump.c \
|
||||
@ -106,6 +108,7 @@ sql_src=log_event.h mysql_priv.h rpl_constants.h \
|
||||
log_event.cc my_decimal.h my_decimal.cc \
|
||||
log_event_old.h log_event_old.cc \
|
||||
rpl_record_old.h rpl_record_old.cc \
|
||||
rpl_utility.h rpl_utility.cc \
|
||||
sql_list.h rpl_filter.h sql_list.cc rpl_filter.cc
|
||||
strings_src=decimal.c strings_def.h
|
||||
|
||||
|
@ -85,6 +85,7 @@ enum options_client
|
||||
OPT_SLAP_POST_SYSTEM,
|
||||
OPT_SLAP_COMMIT,
|
||||
OPT_SLAP_DETACH,
|
||||
OPT_SLAP_NO_DROP,
|
||||
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT_MODE, OPT_SERVER_ID,
|
||||
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
||||
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
|
||||
|
@ -25,9 +25,11 @@ typedef struct st_line_buffer
|
||||
uint eof;
|
||||
ulong max_size;
|
||||
ulong read_length; /* Length of last read string */
|
||||
int error;
|
||||
bool truncated;
|
||||
} LINE_BUFFER;
|
||||
|
||||
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
|
||||
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
|
||||
extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated);
|
||||
extern char *batch_readline(LINE_BUFFER *buffer);
|
||||
extern void batch_readline_end(LINE_BUFFER *buffer);
|
||||
|
@ -1137,6 +1137,8 @@ int main(int argc,char *argv[])
|
||||
if (status.batch && !status.line_buff &&
|
||||
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
|
||||
{
|
||||
put_info("Can't initialize batch_readline - may be the input source is "
|
||||
"a directory or a block device.", INFO_ERROR, 0);
|
||||
free_defaults(defaults_argv);
|
||||
my_end(0);
|
||||
exit(1);
|
||||
@ -1898,14 +1900,13 @@ static int read_and_execute(bool interactive)
|
||||
ulong line_number=0;
|
||||
bool ml_comment= 0;
|
||||
COMMANDS *com;
|
||||
bool truncated= 0;
|
||||
status.exit_status=1;
|
||||
|
||||
while (!aborted)
|
||||
{
|
||||
if (!interactive)
|
||||
{
|
||||
line=batch_readline(status.line_buff, &truncated);
|
||||
line=batch_readline(status.line_buff);
|
||||
/*
|
||||
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
|
||||
Editors like "notepad" put this marker in
|
||||
@ -1979,9 +1980,13 @@ static int read_and_execute(bool interactive)
|
||||
if (opt_outfile && line)
|
||||
fprintf(OUTFILE, "%s\n", line);
|
||||
}
|
||||
if (!line) // End of file
|
||||
// End of file or system error
|
||||
if (!line)
|
||||
{
|
||||
status.exit_status=0;
|
||||
if (status.line_buff && status.line_buff->error)
|
||||
status.exit_status= 1;
|
||||
else
|
||||
status.exit_status= 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2002,7 +2007,8 @@ static int read_and_execute(bool interactive)
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated))
|
||||
if (add_line(glob_buffer, line, &in_string, &ml_comment,
|
||||
status.line_buff ? status.line_buff->truncated : 0))
|
||||
break;
|
||||
}
|
||||
/* if in batch mode, send last query even if it doesn't end with \g or go */
|
||||
|
@ -423,6 +423,9 @@ int main(int argc,char *argv[])
|
||||
|
||||
if (interval) /* --sleep=interval given */
|
||||
{
|
||||
if (opt_count_iterations && --nr_iterations == 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
If connection was dropped (unintentionally, or due to SHUTDOWN),
|
||||
re-establish it if --wait ("retry-connect") was given and user
|
||||
|
@ -84,6 +84,7 @@ static const char* database= 0;
|
||||
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
|
||||
static my_bool debug_info_flag, debug_check_flag;
|
||||
static my_bool force_if_open_opt= 1;
|
||||
static my_bool opt_verify_binlog_checksum= 1;
|
||||
static ulonglong offset = 0;
|
||||
static const char* host = 0;
|
||||
static int port= 0;
|
||||
@ -164,7 +165,8 @@ Log_event* read_remote_annotate_event(uchar* net_buf, ulong event_len,
|
||||
event_buf[event_len]= 0;
|
||||
|
||||
if (!(event= Log_event::read_log_event((const char*) event_buf, event_len,
|
||||
error_msg, glob_description_event)))
|
||||
error_msg, glob_description_event,
|
||||
opt_verify_binlog_checksum)))
|
||||
{
|
||||
my_free(event_buf, MYF(0));
|
||||
return 0;
|
||||
@ -809,7 +811,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
read them to be able to process the wanted events.
|
||||
*/
|
||||
if (((rec_count >= offset) &&
|
||||
((my_time_t)(ev->when) >= start_datetime)) ||
|
||||
(ev->when >= start_datetime)) ||
|
||||
(ev_type == FORMAT_DESCRIPTION_EVENT))
|
||||
{
|
||||
if (ev_type != FORMAT_DESCRIPTION_EVENT)
|
||||
@ -821,11 +823,19 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
*/
|
||||
start_datetime= 0;
|
||||
offset= 0; // print everything and protect against cycling rec_count
|
||||
/*
|
||||
Skip events according to the --server-id flag. However, don't
|
||||
skip format_description or rotate events, because they they
|
||||
are really "global" events that are relevant for the entire
|
||||
binlog, even if they have a server_id. Also, we have to read
|
||||
the format_description event so that we can parse subsequent
|
||||
events.
|
||||
*/
|
||||
if (ev_type != ROTATE_EVENT &&
|
||||
server_id && (server_id != ev->server_id))
|
||||
goto end;
|
||||
}
|
||||
if (server_id && (server_id != ev->server_id))
|
||||
/* skip just this event, continue processing the log. */
|
||||
goto end;
|
||||
if (((my_time_t)(ev->when) >= stop_datetime)
|
||||
if ((ev->when >= stop_datetime)
|
||||
|| (pos >= stop_position_mot))
|
||||
{
|
||||
/* end the program */
|
||||
@ -1311,6 +1321,9 @@ that may lead to an endless loop.",
|
||||
"Used to reserve file descriptors for use by this program.",
|
||||
&open_files_limit, &open_files_limit, 0, GET_ULONG,
|
||||
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
|
||||
{"verify-binlog-checksum", 'c', "Verify checksum binlog events.",
|
||||
(uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"rewrite-db", OPT_REWRITE_DB,
|
||||
"Updates to a database with a different name than the original. \
|
||||
Example: rewrite-db='from->to'.",
|
||||
@ -1432,7 +1445,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
|
||||
int was_cut;
|
||||
MYSQL_TIME l_time;
|
||||
long dummy_my_timezone;
|
||||
my_bool dummy_in_dst_time_gap;
|
||||
uint dummy_in_dst_time_gap;
|
||||
/* We require a total specification (date AND time) */
|
||||
if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) !=
|
||||
MYSQL_TIMESTAMP_DATETIME || was_cut)
|
||||
@ -1709,7 +1722,18 @@ static Exit_status check_master_version()
|
||||
"Master reported NULL for the version.");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
Make a notice to the server that this client
|
||||
is checksum-aware. It does not need the first fake Rotate
|
||||
necessary checksummed.
|
||||
That preference is specified below.
|
||||
*/
|
||||
if (mysql_query(mysql, "SET @master_binlog_checksum='NONE'"))
|
||||
{
|
||||
error("Could not notify master about checksum awareness."
|
||||
"Master returned '%s'", mysql_error(mysql));
|
||||
goto err;
|
||||
}
|
||||
delete glob_description_event;
|
||||
switch (*version) {
|
||||
case '3':
|
||||
@ -1838,7 +1862,8 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
{
|
||||
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
|
||||
len - 1, &error_msg,
|
||||
glob_description_event)))
|
||||
glob_description_event,
|
||||
opt_verify_binlog_checksum)))
|
||||
{
|
||||
error("Could not construct log event object: %s", error_msg);
|
||||
DBUG_RETURN(ERROR_STOP);
|
||||
@ -2066,7 +2091,8 @@ static Exit_status check_header(IO_CACHE* file,
|
||||
Format_description_log_event *new_description_event;
|
||||
my_b_seek(file, tmp_pos); /* seek back to event's start */
|
||||
if (!(new_description_event= (Format_description_log_event*)
|
||||
Log_event::read_log_event(file, glob_description_event)))
|
||||
Log_event::read_log_event(file, glob_description_event,
|
||||
opt_verify_binlog_checksum)))
|
||||
/* EOF can't be hit here normally, so it's a real error */
|
||||
{
|
||||
error("Could not read a Format_description_log_event event at "
|
||||
@ -2099,7 +2125,8 @@ static Exit_status check_header(IO_CACHE* file,
|
||||
{
|
||||
Log_event *ev;
|
||||
my_b_seek(file, tmp_pos); /* seek back to event's start */
|
||||
if (!(ev= Log_event::read_log_event(file, glob_description_event)))
|
||||
if (!(ev= Log_event::read_log_event(file, glob_description_event,
|
||||
opt_verify_binlog_checksum)))
|
||||
{
|
||||
/* EOF can't be hit here normally, so it's a real error */
|
||||
error("Could not read a Rotate_log_event event at offset %llu;"
|
||||
@ -2212,7 +2239,8 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
char llbuff[21];
|
||||
my_off_t old_off = my_b_tell(file);
|
||||
|
||||
Log_event* ev = Log_event::read_log_event(file, glob_description_event);
|
||||
Log_event* ev = Log_event::read_log_event(file, glob_description_event,
|
||||
opt_verify_binlog_checksum);
|
||||
if (!ev)
|
||||
{
|
||||
/*
|
||||
@ -2391,4 +2419,4 @@ void *sql_alloc(size_t size)
|
||||
#include "sql_string.cc"
|
||||
#include "sql_list.cc"
|
||||
#include "rpl_filter.cc"
|
||||
|
||||
#include "rpl_utility.cc"
|
||||
|
@ -1176,6 +1176,9 @@ static int switch_db_collation(FILE *sql_file,
|
||||
{
|
||||
if (strcmp(current_db_cl_name, required_db_cl_name) != 0)
|
||||
{
|
||||
char quoted_db_buf[NAME_LEN * 2 + 3];
|
||||
char *quoted_db_name= quote_name(db_name, quoted_db_buf, FALSE);
|
||||
|
||||
CHARSET_INFO *db_cl= get_charset_by_name(required_db_cl_name, MYF(0));
|
||||
|
||||
if (!db_cl)
|
||||
@ -1183,7 +1186,7 @@ static int switch_db_collation(FILE *sql_file,
|
||||
|
||||
fprintf(sql_file,
|
||||
"ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n",
|
||||
(const char *) db_name,
|
||||
(const char *) quoted_db_name,
|
||||
(const char *) db_cl->csname,
|
||||
(const char *) db_cl->name,
|
||||
(const char *) delimiter);
|
||||
@ -1204,6 +1207,9 @@ static int restore_db_collation(FILE *sql_file,
|
||||
const char *delimiter,
|
||||
const char *db_cl_name)
|
||||
{
|
||||
char quoted_db_buf[NAME_LEN * 2 + 3];
|
||||
char *quoted_db_name= quote_name(db_name, quoted_db_buf, FALSE);
|
||||
|
||||
CHARSET_INFO *db_cl= get_charset_by_name(db_cl_name, MYF(0));
|
||||
|
||||
if (!db_cl)
|
||||
@ -1211,7 +1217,7 @@ static int restore_db_collation(FILE *sql_file,
|
||||
|
||||
fprintf(sql_file,
|
||||
"ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n",
|
||||
(const char *) db_name,
|
||||
(const char *) quoted_db_name,
|
||||
(const char *) db_cl->csname,
|
||||
(const char *) db_cl->name,
|
||||
(const char *) delimiter);
|
||||
@ -2290,6 +2296,15 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
const char *insert_option;
|
||||
char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
|
||||
char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH];
|
||||
const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, "
|
||||
"`COLUMN_TYPE` AS `Type`, "
|
||||
"`IS_NULLABLE` AS `Null`, "
|
||||
"`COLUMN_KEY` AS `Key`, "
|
||||
"`COLUMN_DEFAULT` AS `Default`, "
|
||||
"`EXTRA` AS `Extra`, "
|
||||
"`COLUMN_COMMENT` AS `Comment` "
|
||||
"FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
|
||||
"TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
|
||||
FILE *sql_file= md_result_file;
|
||||
int len;
|
||||
MYSQL_RES *result;
|
||||
@ -2557,8 +2572,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
|
||||
my_progname, mysql_error(mysql));
|
||||
|
||||
my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
|
||||
result_table);
|
||||
my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table);
|
||||
|
||||
if (mysql_query_with_error_report(mysql, &result, query_buff))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
@ -131,7 +131,7 @@ const char *delimiter= "\n";
|
||||
|
||||
const char *create_schema_string= "mysqlslap";
|
||||
|
||||
static my_bool opt_preserve= TRUE;
|
||||
static my_bool opt_preserve= TRUE, opt_no_drop= FALSE;
|
||||
static my_bool debug_info_flag= 0, debug_check_flag= 0;
|
||||
static my_bool opt_only_print= FALSE;
|
||||
static my_bool opt_compress= FALSE, tty_password= FALSE,
|
||||
@ -617,6 +617,8 @@ static struct my_option my_long_options[] =
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"iterations", 'i', "Number of times to run the tests.", &iterations,
|
||||
&iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
|
||||
{"no-drop", OPT_SLAP_NO_DROP, "Do not drop the schema after the test.",
|
||||
&opt_no_drop, &opt_no_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"number-char-cols", 'x',
|
||||
"Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
|
||||
(char**) &num_char_cols_opt, (char**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
|
||||
@ -1167,8 +1169,11 @@ get_options(int *argc,char ***argv)
|
||||
if (!user)
|
||||
user= (char *)"root";
|
||||
|
||||
/* If something is created we clean it up, otherwise we leave schemas alone */
|
||||
if (create_string || auto_generate_sql)
|
||||
/*
|
||||
If something is created and --no-drop is not specified, we drop the
|
||||
schema.
|
||||
*/
|
||||
if (!opt_no_drop && (create_string || auto_generate_sql))
|
||||
opt_preserve= FALSE;
|
||||
|
||||
if (auto_generate_sql && (create_string || user_supplied_query))
|
||||
@ -1541,7 +1546,12 @@ generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
result= mysql_store_result(mysql);
|
||||
if (!(result= mysql_store_result(mysql)))
|
||||
{
|
||||
fprintf(stderr, "%s: Error when storing result: %d %s\n",
|
||||
my_progname, mysql_errno(mysql), mysql_error(mysql));
|
||||
exit(1);
|
||||
}
|
||||
primary_keys_number_of= mysql_num_rows(result);
|
||||
|
||||
/* So why check this? Blackhole :) */
|
||||
@ -1915,16 +1925,14 @@ limit_not_met:
|
||||
{
|
||||
if (mysql_field_count(mysql))
|
||||
{
|
||||
if ((result= mysql_store_result(mysql)))
|
||||
{
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
counter++;
|
||||
mysql_free_result(result);
|
||||
}
|
||||
if (!(result= mysql_store_result(mysql)))
|
||||
fprintf(stderr, "%s: Error when storing result: %d %s\n",
|
||||
my_progname, mysql_errno(mysql), mysql_error(mysql));
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"%s: Error in mysql_store_result(): %d %s\n",
|
||||
my_progname, mysql_errno(mysql), mysql_error(mysql));
|
||||
while ((row= mysql_fetch_row(result)))
|
||||
counter++;
|
||||
mysql_free_result(result);
|
||||
}
|
||||
}
|
||||
} while(mysql_next_result(mysql) == 0);
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* Copyright (C) 2000 MySQL AB
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009-2011 Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -11,7 +12,7 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/*
|
||||
mysqltest
|
||||
@ -111,7 +112,7 @@ static my_bool display_result_vertically= FALSE, display_result_lower= FALSE,
|
||||
display_metadata= FALSE, display_result_sorted= FALSE;
|
||||
static my_bool disable_query_log= 0, disable_result_log= 0;
|
||||
static my_bool disable_connect_log= 1;
|
||||
static my_bool disable_warnings= 0;
|
||||
static my_bool disable_warnings= 0, disable_column_names= 0;
|
||||
static my_bool prepare_warnings_enabled= 0;
|
||||
static my_bool disable_info= 1;
|
||||
static my_bool abort_on_error= 1;
|
||||
@ -297,6 +298,7 @@ enum enum_commands {
|
||||
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
|
||||
Q_ENABLE_INFO, Q_DISABLE_INFO,
|
||||
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
|
||||
Q_ENABLE_COLUMN_NAMES, Q_DISABLE_COLUMN_NAMES,
|
||||
Q_EXEC, Q_DELIMITER,
|
||||
Q_DISABLE_ABORT_ON_ERROR, Q_ENABLE_ABORT_ON_ERROR,
|
||||
Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
|
||||
@ -370,6 +372,8 @@ const char *command_names[]=
|
||||
"disable_info",
|
||||
"enable_metadata",
|
||||
"disable_metadata",
|
||||
"enable_column_names",
|
||||
"disable_column_names",
|
||||
"exec",
|
||||
"delimiter",
|
||||
"disable_abort_on_error",
|
||||
@ -490,7 +494,7 @@ VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
|
||||
void var_free(void* v);
|
||||
VAR* var_get(const char *var_name, const char** var_name_end,
|
||||
my_bool raw, my_bool ignore_not_existing);
|
||||
void eval_expr(VAR* v, const char *p, const char** p_end, bool backtick= true);
|
||||
void eval_expr(VAR* v, const char *p, const char** p_end, bool do_eval= true);
|
||||
my_bool match_delimiter(int c, const char *delim, uint length);
|
||||
void dump_result_to_reject_file(char *buf, int size);
|
||||
void dump_warning_messages();
|
||||
@ -600,6 +604,10 @@ public:
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_ASSERT(ds->str);
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
DBUG_PRINT("QQ", ("str: %*s", (int) ds->length, ds->str));
|
||||
#endif
|
||||
|
||||
if (fwrite(ds->str, 1, ds->length, m_file) != ds->length)
|
||||
die("Failed to write %lu bytes to '%s', errno: %d",
|
||||
(unsigned long)ds->length, m_file_name, errno);
|
||||
@ -1269,6 +1277,22 @@ static void cleanup_and_exit(int exit_code)
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
void print_file_stack()
|
||||
{
|
||||
struct st_test_file* err_file= cur_file;
|
||||
if (err_file == file_stack)
|
||||
return;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
err_file--;
|
||||
fprintf(stderr, "included from %s at line %d:\n",
|
||||
err_file->file_name, err_file->lineno);
|
||||
if (err_file == file_stack)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void die(const char *fmt, ...)
|
||||
{
|
||||
static int dying= 0;
|
||||
@ -1276,11 +1300,15 @@ void die(const char *fmt, ...)
|
||||
DBUG_ENTER("die");
|
||||
DBUG_PRINT("enter", ("start_lineno: %d", start_lineno));
|
||||
|
||||
fflush(stdout);
|
||||
/* Print the error message */
|
||||
fprintf(stderr, "mysqltest: ");
|
||||
if (cur_file && cur_file != file_stack)
|
||||
fprintf(stderr, "In included file \"%s\": ",
|
||||
{
|
||||
fprintf(stderr, "In included file \"%s\": \n",
|
||||
cur_file->file_name);
|
||||
print_file_stack();
|
||||
}
|
||||
if (start_lineno > 0)
|
||||
fprintf(stderr, "At line %u: ", start_lineno);
|
||||
if (fmt)
|
||||
@ -1319,7 +1347,6 @@ void die(const char *fmt, ...)
|
||||
void abort_not_supported_test(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
struct st_test_file* err_file= cur_file;
|
||||
DBUG_ENTER("abort_not_supported_test");
|
||||
|
||||
/* Print include filestack */
|
||||
@ -1327,13 +1354,8 @@ void abort_not_supported_test(const char *fmt, ...)
|
||||
fprintf(stderr, "The test '%s' is not supported by this installation\n",
|
||||
file_stack->file_name);
|
||||
fprintf(stderr, "Detected in file %s at line %d\n",
|
||||
err_file->file_name, err_file->lineno);
|
||||
while (err_file != file_stack)
|
||||
{
|
||||
err_file--;
|
||||
fprintf(stderr, "included from %s at line %d\n",
|
||||
err_file->file_name, err_file->lineno);
|
||||
}
|
||||
cur_file->file_name, cur_file->lineno);
|
||||
print_file_stack();
|
||||
|
||||
/* Print error message */
|
||||
va_start(args, fmt);
|
||||
@ -1365,6 +1387,7 @@ void verbose_msg(const char *fmt, ...)
|
||||
if (!verbose)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
fflush(stdout);
|
||||
va_start(args, fmt);
|
||||
fprintf(stderr, "mysqltest: ");
|
||||
if (cur_file && cur_file != file_stack)
|
||||
@ -1375,6 +1398,7 @@ void verbose_msg(const char *fmt, ...)
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
fflush(stderr);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -1459,6 +1483,8 @@ static int run_command(char* cmd,
|
||||
char buf[512]= {0};
|
||||
FILE *res_file;
|
||||
int error;
|
||||
DBUG_ENTER("run_command");
|
||||
DBUG_PRINT("enter", ("cmd: %s", cmd));
|
||||
|
||||
if (!(res_file= popen(cmd, "r")))
|
||||
die("popen(\"%s\", \"r\") failed", cmd);
|
||||
@ -1479,7 +1505,7 @@ static int run_command(char* cmd,
|
||||
}
|
||||
|
||||
error= pclose(res_file);
|
||||
return WEXITSTATUS(error);
|
||||
DBUG_RETURN(WEXITSTATUS(error));
|
||||
}
|
||||
|
||||
|
||||
@ -2418,7 +2444,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
|
||||
break;
|
||||
}
|
||||
}
|
||||
eval_expr(var, value, 0);
|
||||
eval_expr(var, value, 0, false);
|
||||
}
|
||||
dynstr_free(&ds_query);
|
||||
mysql_free_result(res);
|
||||
@ -2448,12 +2474,16 @@ void var_copy(VAR *dest, VAR *src)
|
||||
}
|
||||
|
||||
|
||||
void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
|
||||
void eval_expr(VAR *v, const char *p, const char **p_end, bool do_eval)
|
||||
{
|
||||
|
||||
DBUG_ENTER("eval_expr");
|
||||
DBUG_PRINT("enter", ("p: '%s'", p));
|
||||
|
||||
/* Skip to treat as pure string if no evaluation */
|
||||
if (! do_eval)
|
||||
goto NO_EVAL;
|
||||
|
||||
if (*p == '$')
|
||||
{
|
||||
VAR *vp;
|
||||
@ -2473,7 +2503,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
if (*p == '`' && backtick)
|
||||
if (*p == '`')
|
||||
{
|
||||
var_query_set(v, p, p_end);
|
||||
DBUG_VOID_RETURN;
|
||||
@ -2496,6 +2526,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
|
||||
}
|
||||
}
|
||||
|
||||
NO_EVAL:
|
||||
{
|
||||
int new_val_len = (p_end && *p_end) ?
|
||||
(int) (*p_end - p) : (int) strlen(p);
|
||||
@ -6673,6 +6704,7 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
||||
my_bool *is_null;
|
||||
ulong *length;
|
||||
uint i;
|
||||
int error;
|
||||
|
||||
/* Allocate array with bind structs, lengths and NULL flags */
|
||||
my_bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
|
||||
@ -6700,7 +6732,7 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
||||
die("mysql_stmt_bind_result failed: %d: %s",
|
||||
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
|
||||
|
||||
while (mysql_stmt_fetch(stmt) == 0)
|
||||
while ((error=mysql_stmt_fetch(stmt)) == 0)
|
||||
{
|
||||
for (i= 0; i < num_fields; i++)
|
||||
append_field(ds, i, &fields[i], (char*)my_bind[i].buffer,
|
||||
@ -6709,8 +6741,11 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
||||
dynstr_append_mem(ds, "\n", 1);
|
||||
}
|
||||
|
||||
if (error != MYSQL_NO_DATA)
|
||||
die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: error: %d",
|
||||
error);
|
||||
if (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA)
|
||||
die("fetch didn't end with MYSQL_NO_DATA from statement: %d %s",
|
||||
die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: %d %s",
|
||||
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
|
||||
|
||||
for (i= 0; i < num_fields; i++)
|
||||
@ -6805,6 +6840,8 @@ void append_table_headings(DYNAMIC_STRING *ds,
|
||||
uint num_fields)
|
||||
{
|
||||
uint col_idx;
|
||||
if (disable_column_names)
|
||||
return;
|
||||
for (col_idx= 0; col_idx < num_fields; col_idx++)
|
||||
{
|
||||
if (col_idx)
|
||||
@ -7450,7 +7487,8 @@ int util_query(MYSQL* org_mysql, const char* query){
|
||||
cur_con->util_mysql= mysql;
|
||||
}
|
||||
|
||||
return mysql_query(mysql, query);
|
||||
int ret= mysql_query(mysql, query);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
@ -7531,6 +7569,15 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
||||
dynstr_append_mem(ds, "\n", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
Write the command to the result file before we execute the query
|
||||
This is needed to be able to analyse the log if something goes
|
||||
wrong
|
||||
*/
|
||||
log_file.write(&ds_res);
|
||||
log_file.flush();
|
||||
dynstr_set(&ds_res, 0);
|
||||
|
||||
if (view_protocol_enabled &&
|
||||
complete_query &&
|
||||
match_re(&view_re, query))
|
||||
@ -8121,13 +8168,15 @@ int main(int argc, char **argv)
|
||||
cur_file->lineno= 1;
|
||||
}
|
||||
init_re();
|
||||
|
||||
/* Cursor protcol implies ps protocol */
|
||||
if (cursor_protocol)
|
||||
ps_protocol= 1;
|
||||
|
||||
ps_protocol_enabled= ps_protocol;
|
||||
sp_protocol_enabled= sp_protocol;
|
||||
view_protocol_enabled= view_protocol;
|
||||
cursor_protocol_enabled= cursor_protocol;
|
||||
/* Cursor protcol implies ps protocol */
|
||||
if (cursor_protocol_enabled)
|
||||
ps_protocol_enabled= 1;
|
||||
|
||||
st_connection *con= connections;
|
||||
if (! (con->mysql= mysql_init(0)))
|
||||
@ -8306,6 +8355,14 @@ int main(int argc, char **argv)
|
||||
display_metadata= 0;
|
||||
var_set_int("$ENABLED_METADATA", 0);
|
||||
break;
|
||||
case Q_ENABLE_COLUMN_NAMES:
|
||||
disable_column_names= 0;
|
||||
var_set_int("$ENABLED_COLUMN_NAMES", 0);
|
||||
break;
|
||||
case Q_DISABLE_COLUMN_NAMES:
|
||||
disable_column_names= 1;
|
||||
var_set_int("$ENABLED_COLUMN_NAMES", 1);
|
||||
break;
|
||||
case Q_SOURCE: do_source(command); break;
|
||||
case Q_SLEEP: do_sleep(command, 0); break;
|
||||
case Q_REAL_SLEEP: do_sleep(command, 1); break;
|
||||
@ -8693,7 +8750,7 @@ void timer_output(void)
|
||||
|
||||
ulonglong timer_now(void)
|
||||
{
|
||||
return my_micro_time() / 1000;
|
||||
return my_interval_timer() / 1000000;
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,18 +18,28 @@
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#include <m_string.h>
|
||||
#include <my_dir.h>
|
||||
#include "my_readline.h"
|
||||
|
||||
static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
|
||||
ulong max_size);
|
||||
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str);
|
||||
static size_t fill_buffer(LINE_BUFFER *buffer);
|
||||
static char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated);
|
||||
static char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length);
|
||||
|
||||
|
||||
LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
|
||||
{
|
||||
LINE_BUFFER *line_buff;
|
||||
|
||||
#ifndef __WIN__
|
||||
MY_STAT input_file_stat;
|
||||
if (my_fstat(fileno(file), &input_file_stat, MYF(MY_WME)) ||
|
||||
MY_S_ISDIR(input_file_stat.st_mode) ||
|
||||
MY_S_ISBLK(input_file_stat.st_mode))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (!(line_buff=(LINE_BUFFER*)
|
||||
my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
|
||||
return 0;
|
||||
@ -42,14 +52,13 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
|
||||
}
|
||||
|
||||
|
||||
char *batch_readline(LINE_BUFFER *line_buff, bool *truncated)
|
||||
char *batch_readline(LINE_BUFFER *line_buff)
|
||||
{
|
||||
char *pos;
|
||||
ulong out_length;
|
||||
DBUG_ASSERT(truncated != NULL);
|
||||
LINT_INIT(out_length);
|
||||
|
||||
if (!(pos=intern_read_line(line_buff,&out_length, truncated)))
|
||||
if (!(pos=intern_read_line(line_buff, &out_length)))
|
||||
return 0;
|
||||
if (out_length && pos[out_length-1] == '\n')
|
||||
if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */
|
||||
@ -163,7 +172,10 @@ static size_t fill_buffer(LINE_BUFFER *buffer)
|
||||
if (!(buffer->buffer = (char*) my_realloc(buffer->buffer,
|
||||
buffer->bufread+1,
|
||||
MYF(MY_WME | MY_FAE))))
|
||||
return (uint) -1;
|
||||
{
|
||||
buffer->error= my_errno;
|
||||
return (size_t) -1;
|
||||
}
|
||||
buffer->start_of_line=buffer->buffer+start_offset;
|
||||
buffer->end=buffer->buffer+bufbytes;
|
||||
}
|
||||
@ -178,7 +190,10 @@ static size_t fill_buffer(LINE_BUFFER *buffer)
|
||||
/* Read in new stuff. */
|
||||
if ((read_count= my_read(buffer->file, (uchar*) buffer->end, read_count,
|
||||
MYF(MY_WME))) == MY_FILE_ERROR)
|
||||
{
|
||||
buffer->error= my_errno;
|
||||
return (size_t) -1;
|
||||
}
|
||||
|
||||
DBUG_PRINT("fill_buff", ("Got %lu bytes", (ulong) read_count));
|
||||
|
||||
@ -199,8 +214,7 @@ static size_t fill_buffer(LINE_BUFFER *buffer)
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated)
|
||||
char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length)
|
||||
{
|
||||
char *pos;
|
||||
size_t length;
|
||||
@ -215,22 +229,25 @@ char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated)
|
||||
if (pos == buffer->end)
|
||||
{
|
||||
/*
|
||||
fill_buffer() can return 0 either on EOF in which case we abort
|
||||
or when the internal buffer has hit the size limit. In the latter case
|
||||
return what we have read so far and signal string truncation.
|
||||
fill_buffer() can return NULL on EOF (in which case we abort),
|
||||
on error, or when the internal buffer has hit the size limit.
|
||||
In the latter case return what we have read so far and signal
|
||||
string truncation.
|
||||
*/
|
||||
if (!(length=fill_buffer(buffer)) || length == (uint) -1)
|
||||
if (!(length= fill_buffer(buffer)))
|
||||
{
|
||||
if (buffer->eof)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
else if (length == (size_t) -1)
|
||||
DBUG_RETURN(NULL);
|
||||
else
|
||||
continue;
|
||||
pos--; /* break line here */
|
||||
*truncated= 1;
|
||||
buffer->truncated= 1;
|
||||
}
|
||||
else
|
||||
*truncated= 0;
|
||||
buffer->truncated= 0;
|
||||
buffer->end_of_line=pos+1;
|
||||
*out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line);
|
||||
DBUG_RETURN(buffer->start_of_line);
|
||||
|
@ -539,11 +539,11 @@ uint32 String::numchars()
|
||||
return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
|
||||
}
|
||||
|
||||
int String::charpos(int i,uint32 offset)
|
||||
int String::charpos(longlong i,uint32 offset)
|
||||
{
|
||||
if (i <= 0)
|
||||
return i;
|
||||
return str_charset->cset->charpos(str_charset,Ptr+offset,Ptr+str_length,i);
|
||||
return (int)i;
|
||||
return (int)str_charset->cset->charpos(str_charset,Ptr+offset,Ptr+str_length,(size_t)i);
|
||||
}
|
||||
|
||||
int String::strstr(const String &s,uint32 offset)
|
||||
|
@ -272,7 +272,7 @@ public:
|
||||
friend int stringcmp(const String *a,const String *b);
|
||||
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||
uint32 numchars();
|
||||
int charpos(int i,uint32 offset=0);
|
||||
int charpos(longlong i,uint32 offset=0);
|
||||
|
||||
int reserve(uint32 space_needed)
|
||||
{
|
||||
|
@ -1012,13 +1012,10 @@ vi_histedit(EditLine *el, int c __attribute__((__unused__)))
|
||||
if (fd < 0)
|
||||
return CC_ERROR;
|
||||
cp = el->el_line.buffer;
|
||||
if (write(fd, cp, el->el_line.lastchar - cp +0u) == -1 ||
|
||||
write(fd, "\n", 1) == -1)
|
||||
{
|
||||
close(fd);
|
||||
unlink(tempfile);
|
||||
return CC_ERROR;
|
||||
}
|
||||
if (write(fd, cp, el->el_line.lastchar - cp +0u) == -1)
|
||||
goto error;
|
||||
if (write(fd, "\n", 1) == -1)
|
||||
goto error;
|
||||
pid = fork();
|
||||
switch (pid) {
|
||||
case -1:
|
||||
@ -1046,6 +1043,12 @@ vi_histedit(EditLine *el, int c __attribute__((__unused__)))
|
||||
unlink(tempfile);
|
||||
/* return CC_REFRESH; */
|
||||
return ed_newline(el, 0);
|
||||
|
||||
/* XXXMYSQL: Avoid compiler warnings. */
|
||||
error:
|
||||
close(fd);
|
||||
unlink(tempfile);
|
||||
return CC_ERROR;
|
||||
}
|
||||
|
||||
/* vi_history_word():
|
||||
|
@ -1962,6 +1962,15 @@ dnl
|
||||
|
||||
MYSQL_CHECK_TIME_T
|
||||
|
||||
dnl
|
||||
dnl check size of time_t
|
||||
dnl
|
||||
|
||||
AC_CHECK_SIZEOF(time_t, 8)
|
||||
if test "$ac_cv_sizeof_time_t" -eq 0
|
||||
then
|
||||
AC_MSG_ERROR("MySQL needs a time_t type.")
|
||||
fi
|
||||
|
||||
# do we need #pragma interface/#pragma implementation ?
|
||||
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
|
||||
|
@ -32,26 +32,26 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp
|
||||
--charset=${PROJECT_SOURCE_DIR}/sql/share/charsets
|
||||
--out-dir=${CMAKE_BINARY_DIR}/sql/share/
|
||||
--header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp
|
||||
--name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h
|
||||
--state_file=${CMAKE_BINARY_DIR}/include/sql_state.h
|
||||
--name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp
|
||||
--state_file=${CMAKE_BINARY_DIR}/include/sql_state.h.tmp
|
||||
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_error.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_ername.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/sql_state.h.tmp ${CMAKE_BINARY_DIR}/include/sql_state.h
|
||||
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt)
|
||||
|
||||
ADD_CUSTOM_TARGET(GenError
|
||||
ALL
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp)
|
||||
|
||||
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
|
||||
MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
|
||||
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32)
|
||||
|
||||
ADD_EXECUTABLE(perror perror.c)
|
||||
MYSQL_ADD_EXECUTABLE(perror perror.c)
|
||||
TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32)
|
||||
|
||||
ADD_EXECUTABLE(resolveip resolveip.c)
|
||||
MYSQL_ADD_EXECUTABLE(resolveip resolveip.c)
|
||||
TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32)
|
||||
|
||||
ADD_EXECUTABLE(replace replace.c)
|
||||
MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Server)
|
||||
TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32)
|
||||
|
||||
MYSQL_INSTALL_TARGETS(comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT Server)
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define HEADER_LENGTH 32 /* Length of header in errmsg.sys */
|
||||
#define DEFAULT_CHARSET_DIR "../sql/share/charsets"
|
||||
#define ER_PREFIX "ER_"
|
||||
#define ER_PREFIX2 "MARIA_ER_"
|
||||
#define WARN_PREFIX "WARN_"
|
||||
static char *OUTFILE= (char*) "errmsg.sys";
|
||||
static char *HEADERFILE= (char*) "mysqld_error.h";
|
||||
@ -57,7 +58,7 @@ const char *empty_string= ""; /* For empty states */
|
||||
*/
|
||||
|
||||
const char *default_language= "eng";
|
||||
int er_offset= 1000;
|
||||
uint er_offset= 1000;
|
||||
my_bool info_flag= 0;
|
||||
|
||||
/* Storage of one error message row (for one language) */
|
||||
@ -85,7 +86,7 @@ struct languages
|
||||
struct errors
|
||||
{
|
||||
const char *er_name; /* Name of the error (ER_HASHCK) */
|
||||
int d_code; /* Error code number */
|
||||
uint d_code; /* Error code number */
|
||||
const char *sql_code1; /* sql state */
|
||||
const char *sql_code2; /* ODBC state */
|
||||
struct errors *next_error; /* Pointer to next error */
|
||||
@ -127,6 +128,7 @@ static struct my_option my_long_options[]=
|
||||
};
|
||||
|
||||
|
||||
static struct errors *generate_empty_message(uint dcode);
|
||||
static struct languages *parse_charset_string(char *str);
|
||||
static struct errors *parse_error_string(char *ptr, int er_count);
|
||||
static struct message *parse_message_string(struct message *new_message,
|
||||
@ -203,6 +205,7 @@ static int create_header_files(struct errors *error_head)
|
||||
uint er_last;
|
||||
FILE *er_definef, *sql_statef, *er_namef;
|
||||
struct errors *tmp_error;
|
||||
uint current_d_code;
|
||||
DBUG_ENTER("create_header_files");
|
||||
LINT_INIT(er_last);
|
||||
|
||||
@ -228,13 +231,22 @@ static int create_header_files(struct errors *error_head)
|
||||
|
||||
fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code);
|
||||
|
||||
current_d_code= error_head->d_code -1;
|
||||
for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error)
|
||||
{
|
||||
/*
|
||||
generating mysqld_error.h
|
||||
fprintf() will automatically add \r on windows
|
||||
*/
|
||||
fprintf(er_definef, "#define %s %d\n", tmp_error->er_name,
|
||||
|
||||
if (!tmp_error->er_name)
|
||||
continue; /* Placeholder for gap */
|
||||
|
||||
if (tmp_error->d_code > current_d_code + 1)
|
||||
fprintf(er_definef, "\n/* New section */\n\n");
|
||||
current_d_code= tmp_error->d_code;
|
||||
|
||||
fprintf(er_definef, "#define %s %u\n", tmp_error->er_name,
|
||||
tmp_error->d_code);
|
||||
er_last= tmp_error->d_code;
|
||||
|
||||
@ -403,7 +415,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
|
||||
char *str, buff[1000];
|
||||
struct errors *current_error= 0, **tail_error= top_error;
|
||||
struct message current_message;
|
||||
int rcount= 0;
|
||||
uint rcount= 0;
|
||||
my_bool er_offset_found= 0;
|
||||
DBUG_ENTER("parse_input_file");
|
||||
|
||||
*top_error= 0;
|
||||
@ -424,11 +437,32 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
|
||||
}
|
||||
if (is_prefix(str, "start-error-number"))
|
||||
{
|
||||
if (!(er_offset= parse_error_offset(str)))
|
||||
uint tmp_er_offset;
|
||||
if (!(tmp_er_offset= parse_error_offset(str)))
|
||||
{
|
||||
fprintf(stderr, "Failed to parse the error offset string!\n");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if (!er_offset_found)
|
||||
{
|
||||
er_offset_found= 1;
|
||||
er_offset= tmp_er_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create empty error messages between er_offset and tmp_err_offset */
|
||||
if (tmp_er_offset < er_offset + rcount)
|
||||
{
|
||||
fprintf(stderr, "new start-error-number %u is smaller than current error message: %u\n", tmp_er_offset, er_offset + rcount);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
for ( ; er_offset + rcount < tmp_er_offset ; rcount++)
|
||||
{
|
||||
current_error= generate_empty_message(er_offset + rcount);
|
||||
*tail_error= current_error;
|
||||
tail_error= ¤t_error->next_error;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (is_prefix(str, "default-language"))
|
||||
@ -475,7 +509,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
|
||||
DBUG_RETURN(0);
|
||||
continue;
|
||||
}
|
||||
if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX))
|
||||
if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX) ||
|
||||
is_prefix(str, ER_PREFIX2))
|
||||
{
|
||||
if (!(current_error= parse_error_string(str, rcount)))
|
||||
{
|
||||
@ -490,12 +525,12 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
|
||||
continue;
|
||||
}
|
||||
if (*str == '#' || *str == '\n')
|
||||
continue; /* skip comment or empty lines */
|
||||
continue; /* skip comment or empty lines */
|
||||
|
||||
fprintf(stderr, "Wrong input file format. Stop!\nLine: %s\n", str);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
*tail_error= 0; /* Mark end of list */
|
||||
*tail_error= 0; /* Mark end of list */
|
||||
|
||||
my_fclose(file, MYF(0));
|
||||
DBUG_RETURN(rcount);
|
||||
@ -604,7 +639,6 @@ static struct message *find_message(struct errors *err, const char *lang,
|
||||
DBUG_RETURN(tmp);
|
||||
if (!strcmp(tmp->lang_short_name, default_language))
|
||||
{
|
||||
DBUG_ASSERT(tmp->text[0] != 0);
|
||||
return_val= tmp;
|
||||
}
|
||||
}
|
||||
@ -824,6 +858,33 @@ static struct message *parse_message_string(struct message *new_message,
|
||||
}
|
||||
|
||||
|
||||
static struct errors *generate_empty_message(uint d_code)
|
||||
{
|
||||
struct errors *new_error;
|
||||
struct message message;
|
||||
|
||||
/* create a new element */
|
||||
if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
|
||||
MYF(MY_WME))))
|
||||
return(0);
|
||||
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1))
|
||||
return(0); /* OOM: Fatal error */
|
||||
|
||||
new_error->er_name= NULL;
|
||||
new_error->d_code= d_code;
|
||||
new_error->sql_code1= empty_string;
|
||||
new_error->sql_code2= empty_string;
|
||||
|
||||
if (!(message.lang_short_name= my_strdup(default_language, MYF(MY_WME))) ||
|
||||
!(message.text= my_strdup("", MYF(MY_WME))))
|
||||
return(0);
|
||||
|
||||
/* Can't fail as msg is preallocated */
|
||||
(void) insert_dynamic(&new_error->msg, (uchar*) &message);
|
||||
return(new_error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Parsing the string with error name and codes; returns the pointer to
|
||||
the errors struct
|
||||
@ -836,7 +897,9 @@ static struct errors *parse_error_string(char *str, int er_count)
|
||||
DBUG_PRINT("enter", ("str: %s", str));
|
||||
|
||||
/* create a new element */
|
||||
new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME));
|
||||
if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
|
||||
MYF(MY_WME))))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0))
|
||||
DBUG_RETURN(0); /* OOM: Fatal error */
|
||||
@ -966,7 +1029,7 @@ static struct languages *parse_charset_string(char *str)
|
||||
static void print_version(void)
|
||||
{
|
||||
DBUG_ENTER("print_version");
|
||||
printf("%s (Compile errormessage) Ver %s\n", my_progname, "2.0");
|
||||
printf("%s (Compile errormessage) Ver %s\n", my_progname, "3.0");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@ static my_bool verbose, print_all_codes;
|
||||
|
||||
#include "../include/my_base.h"
|
||||
#include "../mysys/my_handler_errors.h"
|
||||
#include "../include/my_handler.h"
|
||||
|
||||
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
|
||||
static my_bool ndb_code;
|
||||
@ -185,6 +184,36 @@ static const char *get_ha_error_msg(int code)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Register handler error messages for usage with my_error()
|
||||
|
||||
NOTES
|
||||
This is safe to call multiple times as my_error_register()
|
||||
will ignore calls to register already registered error numbers.
|
||||
*/
|
||||
void my_handler_error_register(void)
|
||||
{
|
||||
/*
|
||||
If you got compilation error here about compile_time_assert array, check
|
||||
that every HA_ERR_xxx constant has a corresponding error message in
|
||||
handler_error_messages[] list (check mysys/ma_handler_errors.h and
|
||||
include/my_base.h).
|
||||
*/
|
||||
compile_time_assert(HA_ERR_FIRST + array_elements(handler_error_messages) ==
|
||||
HA_ERR_LAST + 1);
|
||||
my_error_register(handler_error_messages, HA_ERR_FIRST,
|
||||
HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
|
||||
}
|
||||
|
||||
|
||||
void my_handler_error_unregister(void)
|
||||
{
|
||||
my_error_unregister(HA_ERR_FIRST,
|
||||
HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(__WIN__)
|
||||
static my_bool print_win_error_msg(DWORD error, my_bool verbose)
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ SSL::SSL(SSL_CTX* ctx)
|
||||
SetError(YasslError(err));
|
||||
return;
|
||||
}
|
||||
else if (serverSide) {
|
||||
else if (serverSide && !(ctx->GetCiphers().setSuites_)) {
|
||||
// remove RSA or DSA suites depending on cert key type
|
||||
ProtocolVersion pv = secure_.get_connection().version_;
|
||||
|
||||
|
@ -30,6 +30,7 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
|
||||
my_getopt.h sslopt-longopts.h my_dir.h \
|
||||
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
|
||||
m_ctype.h my_attribute.h my_compiler.h \
|
||||
my_decimal_limits.h ma_dyncol.h \
|
||||
$(HEADERS_GEN_CONFIGURE) \
|
||||
$(HEADERS_GEN_MAKE)
|
||||
|
||||
@ -40,9 +41,11 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
|
||||
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
|
||||
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
|
||||
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
|
||||
my_handler.h my_time.h service_versions.h \
|
||||
service_versions.h \
|
||||
my_compare.h my_handler.h my_time.h \
|
||||
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
|
||||
atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
|
||||
atomic/rwlock.h atomic/x86-gcc.h \
|
||||
atomic/generic-msvc.h \
|
||||
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
|
||||
wqueue.h waiting_threads.h
|
||||
|
||||
|
@ -201,6 +201,11 @@ typedef SSIZE_T ssize_t;
|
||||
#define SIZEOF_LONG 4
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SIZEOF_OFF_T 8
|
||||
/*
|
||||
The size of time_t depends on the compiler.
|
||||
But it's 8 for all the supported VC versions.
|
||||
*/
|
||||
#define SIZEOF_TIME_T 8
|
||||
#ifdef _WIN64
|
||||
#define SIZEOF_CHARP 8
|
||||
#else
|
||||
@ -325,10 +330,9 @@ inline ulonglong double2ulonglong(double d)
|
||||
#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */
|
||||
#endif
|
||||
|
||||
#ifdef NOT_USED
|
||||
#define HAVE_SNPRINTF /* Gave link error */
|
||||
#define _snprintf snprintf
|
||||
#endif
|
||||
|
||||
#define HAVE_SNPRINTF
|
||||
#define snprintf _snprintf
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
|
||||
|
@ -29,17 +29,17 @@ typedef struct st_decimal_t {
|
||||
|
||||
int internal_str2dec(const char *from, decimal_t *to, char **end,
|
||||
my_bool fixed);
|
||||
int decimal2string(decimal_t *from, char *to, int *to_len,
|
||||
int decimal2string(const decimal_t *from, char *to, int *to_len,
|
||||
int fixed_precision, int fixed_decimals,
|
||||
char filler);
|
||||
int decimal2ulonglong(decimal_t *from, ulonglong *to);
|
||||
int decimal2ulonglong(const decimal_t *from, ulonglong *to);
|
||||
int ulonglong2decimal(ulonglong from, decimal_t *to);
|
||||
int decimal2longlong(decimal_t *from, longlong *to);
|
||||
int decimal2longlong(const decimal_t *from, longlong *to);
|
||||
int longlong2decimal(longlong from, decimal_t *to);
|
||||
int decimal2double(decimal_t *from, double *to);
|
||||
int decimal2double(const decimal_t *from, double *to);
|
||||
int double2decimal(double from, decimal_t *to);
|
||||
int decimal_actual_fraction(decimal_t *from);
|
||||
int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
|
||||
int decimal2bin(const decimal_t *from, uchar *to, int precision, int scale);
|
||||
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale);
|
||||
|
||||
int decimal_size(int precision, int scale);
|
||||
@ -55,7 +55,7 @@ int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to);
|
||||
int decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to,
|
||||
int scale_incr);
|
||||
int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to);
|
||||
int decimal_round(decimal_t *from, decimal_t *to, int new_scale,
|
||||
int decimal_round(const decimal_t *from, decimal_t *to, int new_scale,
|
||||
decimal_round_mode mode);
|
||||
int decimal_is_zero(decimal_t *from);
|
||||
void max_decimal(int precision, int frac, decimal_t *to);
|
||||
|
@ -25,6 +25,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <my_compare.h>
|
||||
|
||||
#define HA_FT_MAXBYTELEN 254
|
||||
#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3)
|
||||
|
||||
|
@ -30,7 +30,7 @@ extern "C" {
|
||||
#include <thr_lock.h>
|
||||
#endif
|
||||
|
||||
#include "my_handler.h"
|
||||
#include "my_compare.h"
|
||||
#include "my_tree.h"
|
||||
|
||||
/* defines used by heap-funktions */
|
||||
|
@ -148,7 +148,8 @@ enum my_lex_states
|
||||
MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR,
|
||||
MY_LEX_IDENT_OR_KEYWORD,
|
||||
MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN, MY_LEX_IDENT_OR_NCHAR,
|
||||
MY_LEX_STRING_OR_DELIMITER
|
||||
MY_LEX_STRING_OR_DELIMITER, MY_LEX_MINUS_OR_COMMENT, MY_LEX_PLACEHOLDER,
|
||||
MY_LEX_COMMA
|
||||
};
|
||||
|
||||
struct charset_info_st;
|
||||
|
147
include/ma_dyncol.h
Normal file
147
include/ma_dyncol.h
Normal file
@ -0,0 +1,147 @@
|
||||
/* Copyright (c) 2011, Monty Program Ab
|
||||
Copyright (c) 2011, Oleksandr Byelkin
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ma_dyncol_h
|
||||
#define ma_dyncol_h
|
||||
|
||||
#include <decimal.h>
|
||||
#include <my_decimal_limits.h>
|
||||
#include <mysql_time.h>
|
||||
|
||||
/*
|
||||
Max length for data in a dynamic colums. This comes from how the
|
||||
how the offset are stored.
|
||||
*/
|
||||
#define MAX_DYNAMIC_COLUMN_LENGTH 0X1FFFFFFFL
|
||||
|
||||
/* NO and OK is the same used just to show semantics */
|
||||
#define ER_DYNCOL_NO ER_DYNCOL_OK
|
||||
|
||||
enum enum_dyncol_func_result
|
||||
{
|
||||
ER_DYNCOL_OK= 0,
|
||||
ER_DYNCOL_YES= 1, /* For functions returning 0/1 */
|
||||
ER_DYNCOL_FORMAT= -1, /* Wrong format of the encoded string */
|
||||
ER_DYNCOL_LIMIT= -2, /* Some limit reached */
|
||||
ER_DYNCOL_RESOURCE= -3, /* Out of resourses */
|
||||
ER_DYNCOL_DATA= -4, /* Incorrect input data */
|
||||
ER_DYNCOL_UNKNOWN_CHARSET= -5 /* Unknown character set */
|
||||
};
|
||||
|
||||
typedef DYNAMIC_STRING DYNAMIC_COLUMN;
|
||||
|
||||
enum enum_dynamic_column_type
|
||||
{
|
||||
DYN_COL_NULL= 0,
|
||||
DYN_COL_INT,
|
||||
DYN_COL_UINT,
|
||||
DYN_COL_DOUBLE,
|
||||
DYN_COL_STRING,
|
||||
DYN_COL_DECIMAL,
|
||||
DYN_COL_DATETIME,
|
||||
DYN_COL_DATE,
|
||||
DYN_COL_TIME
|
||||
};
|
||||
|
||||
typedef enum enum_dynamic_column_type DYNAMIC_COLUMN_TYPE;
|
||||
|
||||
struct st_dynamic_column_value
|
||||
{
|
||||
DYNAMIC_COLUMN_TYPE type;
|
||||
union
|
||||
{
|
||||
long long long_value;
|
||||
unsigned long long ulong_value;
|
||||
double double_value;
|
||||
struct {
|
||||
LEX_STRING string_value;
|
||||
CHARSET_INFO *charset;
|
||||
};
|
||||
struct {
|
||||
decimal_digit_t decimal_buffer[DECIMAL_BUFF_LENGTH];
|
||||
decimal_t decimal_value;
|
||||
};
|
||||
MYSQL_TIME time_value;
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE;
|
||||
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_create(DYNAMIC_COLUMN *str,
|
||||
uint column_nr, DYNAMIC_COLUMN_VALUE *value);
|
||||
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_create_many(DYNAMIC_COLUMN *str,
|
||||
uint column_count,
|
||||
uint *column_numbers,
|
||||
DYNAMIC_COLUMN_VALUE *values);
|
||||
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr,
|
||||
DYNAMIC_COLUMN_VALUE *value);
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_update_many(DYNAMIC_COLUMN *str,
|
||||
uint add_column_count,
|
||||
uint *column_numbers,
|
||||
DYNAMIC_COLUMN_VALUE *values);
|
||||
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_delete(DYNAMIC_COLUMN *org, uint column_nr);
|
||||
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr);
|
||||
|
||||
/* List of not NULL columns */
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint);
|
||||
|
||||
/*
|
||||
if the column do not exists it is NULL
|
||||
*/
|
||||
enum enum_dyncol_func_result
|
||||
dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr,
|
||||
DYNAMIC_COLUMN_VALUE *store_it_here);
|
||||
|
||||
#define dynamic_column_initialize(A) memset((A), 0, sizeof(*(A)))
|
||||
#define dynamic_column_column_free(V) dynstr_free(V)
|
||||
|
||||
/***************************************************************************
|
||||
Internal functions, don't use if you don't know what you are doing...
|
||||
***************************************************************************/
|
||||
|
||||
#define dynamic_column_reassociate(V,P,L, A) dynstr_reassociate((V),(P),(L),(A))
|
||||
|
||||
#define dynamic_column_value_init(V) (V)->type= DYN_COL_NULL
|
||||
|
||||
/*
|
||||
Prepare value for using as decimal
|
||||
*/
|
||||
void dynamic_column_prepare_decimal(DYNAMIC_COLUMN_VALUE *value);
|
||||
|
||||
#endif
|
@ -26,6 +26,7 @@ extern "C" {
|
||||
#include <m_ctype.h>
|
||||
#include "../storage/maria/ma_pagecache.h"
|
||||
#include "my_handler.h"
|
||||
#include "my_compare.h"
|
||||
#include "ft_global.h"
|
||||
#include <myisamchk.h>
|
||||
#include <mysql/plugin.h>
|
||||
|
@ -446,7 +446,8 @@ enum ha_base_keytype {
|
||||
#define HA_ERR_ROW_NOT_VISIBLE 177
|
||||
#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 178 /*Too many active concurrent transactions */
|
||||
#define HA_ERR_ABORTED_BY_USER 179
|
||||
#define HA_ERR_LAST 179 /* Copy of last error nr */
|
||||
#define HA_ERR_DISK_FULL 180
|
||||
#define HA_ERR_LAST 180 /* Copy of last error nr */
|
||||
|
||||
/* Number of different errors */
|
||||
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
|
||||
|
@ -1,3 +1,19 @@
|
||||
/* Copyright (c) 2007, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009-2011, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/*
|
||||
Some useful bit functions
|
||||
*/
|
||||
@ -42,9 +58,12 @@ STATIC_INLINE uint my_count_bits(ulonglong v)
|
||||
#endif
|
||||
}
|
||||
|
||||
STATIC_INLINE uint my_count_bits_ushort(ushort v)
|
||||
STATIC_INLINE uint my_count_bits_uint32(uint32 v)
|
||||
{
|
||||
return _my_bits_nbits[v];
|
||||
return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
|
||||
_my_bits_nbits[(uchar) (v >> 8)] +
|
||||
_my_bits_nbits[(uchar) (v >> 16)] +
|
||||
_my_bits_nbits[(uchar) (v >> 24)]);
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +123,6 @@ extern uint32 my_round_up_to_next_power(uint32 v);
|
||||
uint32 my_clear_highest_bit(uint32 v);
|
||||
uint32 my_reverse_bits(uint32 key);
|
||||
extern uint my_count_bits(ulonglong v);
|
||||
extern uint my_count_bits_ushort(ushort v);
|
||||
extern uint my_count_bits_uint32(uint32 v);
|
||||
#endif /* HAVE_INLINE */
|
||||
C_MODE_END
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* Copyright (C) 2000 MySQL AB
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009-2011, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -151,9 +152,10 @@ bitmap_is_set(const MY_BITMAP *map,uint bit)
|
||||
|
||||
static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
|
||||
{
|
||||
*(map1)->last_word_ptr|= (map1)->last_word_mask;
|
||||
*(map2)->last_word_ptr|= (map2)->last_word_mask;
|
||||
return memcmp((map1)->bitmap, (map2)->bitmap, 4*no_words_in_map((map1)))==0;
|
||||
if (memcmp(map1->bitmap, map2->bitmap, 4*(no_words_in_map(map1)-1)) != 0)
|
||||
return FALSE;
|
||||
return ((*map1->last_word_ptr | map1->last_word_mask) ==
|
||||
(*map2->last_word_ptr | map2->last_word_mask));
|
||||
}
|
||||
|
||||
#define bitmap_clear_all(MAP) \
|
||||
|
121
include/my_compare.h
Normal file
121
include/my_compare.h
Normal file
@ -0,0 +1,121 @@
|
||||
/* Copyright (c) Monty Program Ab; 1991-2011
|
||||
Copyright (C) 2002-2006 MySQL AB
|
||||
Copyright (c) 2011, Oracle and/or its affiliates.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _my_compare_h
|
||||
#define _my_compare_h
|
||||
|
||||
#include "myisampack.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct st_HA_KEYSEG /* Key-portion */
|
||||
{
|
||||
CHARSET_INFO *charset;
|
||||
uint32 start; /* Start of key in record */
|
||||
uint32 null_pos; /* position to NULL indicator */
|
||||
uint16 bit_pos; /* Position to bit part */
|
||||
uint16 flag;
|
||||
uint16 length; /* Keylength */
|
||||
uint8 type; /* Type of key (for sort) */
|
||||
uint8 language;
|
||||
uint8 null_bit; /* bitmask to test for NULL */
|
||||
uint8 bit_start,bit_end; /* if bit field */
|
||||
uint8 bit_length; /* Length of bit part */
|
||||
} HA_KEYSEG;
|
||||
|
||||
#define get_key_length(length,key) \
|
||||
{ if (*(const uchar*) (key) != 255) \
|
||||
length= (uint) *(const uchar*) ((key)++); \
|
||||
else \
|
||||
{ length= mi_uint2korr((key)+1); (key)+=3; } \
|
||||
}
|
||||
|
||||
#define get_key_length_rdonly(length,key) \
|
||||
{ if (*(const uchar*) (key) != 255) \
|
||||
length= ((uint) *(const uchar*) ((key))); \
|
||||
else \
|
||||
{ length= mi_uint2korr((key)+1); } \
|
||||
}
|
||||
|
||||
#define get_key_pack_length(length,length_pack,key) \
|
||||
{ if (*(const uchar*) (key) != 255) \
|
||||
{ length= (uint) *(const uchar*) ((key)++); length_pack= 1; }\
|
||||
else \
|
||||
{ length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
|
||||
}
|
||||
|
||||
#define store_key_length_inc(key,length) \
|
||||
{ if ((length) < 255) \
|
||||
{ *(key)++= (length); } \
|
||||
else \
|
||||
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
|
||||
}
|
||||
|
||||
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
|
||||
|
||||
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
||||
(((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
|
||||
((1 << (bit_len)) - 1))
|
||||
|
||||
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
|
||||
{ \
|
||||
(bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
|
||||
((bits) << (bit_ofs)); \
|
||||
if ((bit_ofs) + (bit_len) > 8) \
|
||||
(bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
|
||||
((bits) >> (8 - (bit_ofs))); \
|
||||
}
|
||||
|
||||
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
||||
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
||||
|
||||
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
|
||||
const uchar *, uint , my_bool, my_bool);
|
||||
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register const uchar *a,
|
||||
register const uchar *b, uint key_length,
|
||||
uint32 nextflag, uint *diff_pos);
|
||||
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
|
||||
|
||||
/**
|
||||
Return values of index_cond_func_xxx functions.
|
||||
|
||||
0=ICP_NO_MATCH - index tuple doesn't satisfy the pushed index condition (the
|
||||
engine should discard the tuple and go to the next one)
|
||||
1=ICP_MATCH - index tuple satisfies the pushed index condition (the
|
||||
engine should fetch and return the record)
|
||||
2=ICP_OUT_OF_RANGE - index tuple is out range that we're scanning, e.g. this
|
||||
if we're scanning "t.key BETWEEN 10 AND 20" and got a
|
||||
"t.key=21" tuple (the engine should stop scanning and
|
||||
return HA_ERR_END_OF_FILE right away).
|
||||
-1= ICP_ERROR - Reserved for internal errors in engines. Should not be
|
||||
returned by index_cond_func_xxx
|
||||
*/
|
||||
|
||||
typedef enum icp_result {
|
||||
ICP_ERROR=-1,
|
||||
ICP_NO_MATCH=0,
|
||||
ICP_MATCH=1,
|
||||
ICP_OUT_OF_RANGE=2
|
||||
} ICP_RESULT;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _my_compare_h */
|
31
include/my_decimal_limits.h
Normal file
31
include/my_decimal_limits.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef my_decimal_limits_h
|
||||
#define my_decimal_limits_h
|
||||
|
||||
#define DECIMAL_LONGLONG_DIGITS 22
|
||||
#define DECIMAL_LONG_DIGITS 10
|
||||
#define DECIMAL_LONG3_DIGITS 8
|
||||
|
||||
/** maximum length of buffer in our big digits (uint32). */
|
||||
#define DECIMAL_BUFF_LENGTH 9
|
||||
|
||||
/* the number of digits that my_decimal can possibly contain */
|
||||
#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9)
|
||||
|
||||
|
||||
/**
|
||||
maximum guaranteed precision of number in decimal digits (number of our
|
||||
digits * number of decimal digits in one our big digit - number of decimal
|
||||
digits in one our big digit decreased by 1 (because we always put decimal
|
||||
point on the border of our big digits))
|
||||
*/
|
||||
#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2)
|
||||
#define DECIMAL_MAX_SCALE 30
|
||||
#define DECIMAL_NOT_SPECIFIED 31
|
||||
|
||||
/**
|
||||
maximum length of string representation (number of maximum decimal
|
||||
digits + 1 position for sign + 1 position for decimal point)
|
||||
*/
|
||||
#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2)
|
||||
|
||||
#endif
|
@ -854,10 +854,10 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
||||
#define strtok_r(A,B,C) strtok((A),(B))
|
||||
#endif
|
||||
|
||||
/* This is from the old m-machine.h file */
|
||||
|
||||
#if SIZEOF_LONG_LONG > 4
|
||||
#if SIZEOF_LONG_LONG >= 8
|
||||
#define HAVE_LONG_LONG 1
|
||||
#else
|
||||
#error WHAT? sizeof(long long) < 8 ???
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2002-2006 MySQL AB
|
||||
/* Copyright (c) Monty Program Ab; 1991-2011
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
@ -18,12 +18,6 @@
|
||||
#ifndef _my_handler_h
|
||||
#define _my_handler_h
|
||||
|
||||
#include "myisampack.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
There is a hard limit for the maximum number of keys as there are only
|
||||
8 bits in the index file header for the number of keys in a table.
|
||||
@ -47,76 +41,6 @@ extern "C" {
|
||||
#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
|
||||
#define HA_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
|
||||
|
||||
typedef struct st_HA_KEYSEG /* Key-portion */
|
||||
{
|
||||
CHARSET_INFO *charset;
|
||||
uint32 start; /* Start of key in record */
|
||||
uint32 null_pos; /* position to NULL indicator */
|
||||
uint16 bit_pos; /* Position to bit part */
|
||||
uint16 flag;
|
||||
uint16 length; /* Keylength */
|
||||
uint8 type; /* Type of key (for sort) */
|
||||
uint8 language;
|
||||
uint8 null_bit; /* bitmask to test for NULL */
|
||||
uint8 bit_start,bit_end; /* if bit field */
|
||||
uint8 bit_length; /* Length of bit part */
|
||||
} HA_KEYSEG;
|
||||
|
||||
#define get_key_length(length,key) \
|
||||
{ if (*(const uchar*) (key) != 255) \
|
||||
length= (uint) *(const uchar*) ((key)++); \
|
||||
else \
|
||||
{ length= mi_uint2korr((key)+1); (key)+=3; } \
|
||||
}
|
||||
|
||||
#define get_key_length_rdonly(length,key) \
|
||||
{ if (*(const uchar*) (key) != 255) \
|
||||
length= ((uint) *(const uchar*) ((key))); \
|
||||
else \
|
||||
{ length= mi_uint2korr((key)+1); } \
|
||||
}
|
||||
|
||||
#define get_key_pack_length(length,length_pack,key) \
|
||||
{ if (*(const uchar*) (key) != 255) \
|
||||
{ length= (uint) *(const uchar*) ((key)++); length_pack= 1; }\
|
||||
else \
|
||||
{ length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
|
||||
}
|
||||
|
||||
#define store_key_length_inc(key,length) \
|
||||
{ if ((length) < 255) \
|
||||
{ *(key)++= (length); } \
|
||||
else \
|
||||
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
|
||||
}
|
||||
|
||||
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
|
||||
|
||||
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
||||
(((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
|
||||
((1 << (bit_len)) - 1))
|
||||
|
||||
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
|
||||
{ \
|
||||
(bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
|
||||
((bits) << (bit_ofs)); \
|
||||
if ((bit_ofs) + (bit_len) > 8) \
|
||||
(bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
|
||||
((bits) >> (8 - (bit_ofs))); \
|
||||
}
|
||||
|
||||
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
||||
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
||||
|
||||
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
|
||||
const uchar *, uint , my_bool, my_bool);
|
||||
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register const uchar *a,
|
||||
register const uchar *b, uint key_length,
|
||||
uint32 nextflag, uint *diff_pos);
|
||||
|
||||
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
|
||||
extern void my_handler_error_register(void);
|
||||
extern void my_handler_error_unregister(void);
|
||||
/*
|
||||
Inside an in-memory data record, memory pointers to pieces of the
|
||||
record (like BLOBs) are stored in their native byte order and in
|
||||
@ -124,32 +48,9 @@ extern void my_handler_error_unregister(void);
|
||||
*/
|
||||
#define portable_sizeof_char_ptr 8
|
||||
|
||||
/**
|
||||
Return values of index_cond_func_xxx functions.
|
||||
/* Register / unregister errors for my_error() */
|
||||
|
||||
0=ICP_NO_MATCH - index tuple doesn't satisfy the pushed index condition (the
|
||||
engine should discard the tuple and go to the next one)
|
||||
1=ICP_MATCH - index tuple satisfies the pushed index condition (the engine
|
||||
should fetch and return the record)
|
||||
2=ICP_OUT_OF_RANGE - index tuple is out range that we're scanning, e.g. this
|
||||
if we're scanning "t.key BETWEEN 10 AND 20" and got a
|
||||
"t.key=21" tuple (the engine should stop scanning and return
|
||||
HA_ERR_END_OF_FILE right away).
|
||||
|
||||
-1= ICP_ERROR - Reserved for internal errors in engines. Should not be
|
||||
returned by index_cond_func_xxx
|
||||
*/
|
||||
|
||||
typedef enum icp_result {
|
||||
ICP_ERROR=-1,
|
||||
ICP_NO_MATCH=0,
|
||||
ICP_MATCH=1,
|
||||
ICP_OUT_OF_RANGE=2
|
||||
} ICP_RESULT;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern void my_handler_error_register(void);
|
||||
extern void my_handler_error_unregister(void);
|
||||
|
||||
#endif /* _my_handler_h */
|
||||
|
@ -75,37 +75,11 @@ typedef volatile LONG my_pthread_once_t;
|
||||
#define MY_PTHREAD_ONCE_INPROGRESS 1
|
||||
#define MY_PTHREAD_ONCE_DONE 2
|
||||
|
||||
/*
|
||||
Struct and macros to be used in combination with the
|
||||
windows implementation of pthread_cond_timedwait
|
||||
*/
|
||||
|
||||
/*
|
||||
Declare a union to make sure FILETIME is properly aligned
|
||||
so it can be used directly as a 64 bit value. The value
|
||||
stored is in 100ns units.
|
||||
*/
|
||||
union ft64 {
|
||||
FILETIME ft;
|
||||
__int64 i64;
|
||||
};
|
||||
|
||||
struct timespec {
|
||||
union ft64 tv;
|
||||
/* The max timeout value in millisecond for pthread_cond_timedwait */
|
||||
long max_timeout_msec;
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
#define set_timespec_time_nsec(ABSTIME,TIME,NSEC) do { \
|
||||
(ABSTIME).tv.i64= (TIME)+(__int64)(NSEC)/100; \
|
||||
(ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \
|
||||
} while(0)
|
||||
|
||||
#define set_timespec_nsec(ABSTIME,NSEC) do { \
|
||||
union ft64 tv; \
|
||||
GetSystemTimeAsFileTime(&tv.ft); \
|
||||
set_timespec_time_nsec((ABSTIME), tv.i64, (NSEC)); \
|
||||
} while(0)
|
||||
|
||||
void win_pthread_init(void);
|
||||
int win_pthread_setspecific(void *A,void *B,uint length);
|
||||
@ -442,7 +416,7 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
|
||||
|
||||
#ifndef set_timespec_nsec
|
||||
#define set_timespec_nsec(ABSTIME,NSEC) \
|
||||
set_timespec_time_nsec((ABSTIME),my_getsystime(),(NSEC))
|
||||
set_timespec_time_nsec((ABSTIME), my_hrtime().val*1000 + (NSEC))
|
||||
#endif /* !set_timespec_nsec */
|
||||
|
||||
/* adapt for two different flavors of struct timespec */
|
||||
@ -455,11 +429,10 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
|
||||
#endif /* HAVE_TIMESPEC_TS_SEC */
|
||||
|
||||
#ifndef set_timespec_time_nsec
|
||||
#define set_timespec_time_nsec(ABSTIME,TIME,NSEC) do { \
|
||||
ulonglong nsec= (NSEC); \
|
||||
ulonglong now= (TIME) + (nsec/100); \
|
||||
(ABSTIME).MY_tv_sec= (now / ULL(10000000)); \
|
||||
(ABSTIME).MY_tv_nsec= (now % ULL(10000000) * 100 + (nsec % 100)); \
|
||||
#define set_timespec_time_nsec(ABSTIME,NSEC) do { \
|
||||
ulonglong now= (NSEC); \
|
||||
(ABSTIME).MY_tv_sec= (now / 1000000000ULL); \
|
||||
(ABSTIME).MY_tv_nsec= (now % 1000000000ULL); \
|
||||
} while(0)
|
||||
#endif /* !set_timespec_time_nsec */
|
||||
|
||||
|
@ -863,6 +863,8 @@ extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
|
||||
extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
|
||||
extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
|
||||
extern void dynstr_free(DYNAMIC_STRING *str);
|
||||
extern void dynstr_reassociate(DYNAMIC_STRING *str, char **res, size_t *length,
|
||||
size_t *alloc_length);
|
||||
#ifdef HAVE_MLOCK
|
||||
extern void *my_malloc_lock(size_t length,myf flags);
|
||||
extern void my_free_lock(void *ptr,myf flags);
|
||||
@ -929,15 +931,23 @@ extern ulong crc32(ulong crc, const uchar *buf, uint len);
|
||||
extern uint my_set_max_open_files(uint files);
|
||||
void my_free_open_file_info(void);
|
||||
|
||||
extern time_t my_time(myf flags);
|
||||
extern ulonglong my_getsystime(void);
|
||||
extern ulonglong my_getcputime(void);
|
||||
extern ulonglong my_micro_time();
|
||||
extern ulonglong my_micro_time_and_time(time_t *time_arg);
|
||||
time_t my_time_possible_from_micro(ulonglong microtime);
|
||||
extern my_bool my_gethwaddr(uchar *to);
|
||||
extern int my_getncpus();
|
||||
|
||||
#define HRTIME_RESOLUTION 1000000ULL /* microseconds */
|
||||
typedef struct {ulonglong val;} my_hrtime_t;
|
||||
void my_time_init();
|
||||
extern my_hrtime_t my_hrtime();
|
||||
extern ulonglong my_interval_timer(void);
|
||||
extern ulonglong my_getcputime(void);
|
||||
|
||||
#define microsecond_interval_timer() (my_interval_timer()/1000)
|
||||
#define hrtime_to_time(X) ((X).val/HRTIME_RESOLUTION)
|
||||
#define hrtime_from_time(X) ((ulonglong)((X)*HRTIME_RESOLUTION))
|
||||
#define hrtime_to_double(X) ((X).val/(double)HRTIME_RESOLUTION)
|
||||
#define hrtime_sec_part(X) ((ulong)((X).val % HRTIME_RESOLUTION))
|
||||
#define my_time(X) hrtime_to_time(my_hrtime())
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
@ -47,14 +47,28 @@ typedef long my_time_t;
|
||||
#define TIMESTAMP_MAX_YEAR 2038
|
||||
#define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1)
|
||||
#define TIMESTAMP_MAX_VALUE INT_MAX32
|
||||
#define TIMESTAMP_MIN_VALUE 1
|
||||
#define TIMESTAMP_MIN_VALUE 0
|
||||
|
||||
/* two-digit years < this are 20..; >= this are 19.. */
|
||||
#define YY_PART_YEAR 70
|
||||
|
||||
/*
|
||||
check for valid times only if the range of time_t is greater than
|
||||
the range of my_time_t
|
||||
*/
|
||||
#if SIZEOF_TIME_T > 4 || defined(TIME_T_UNSIGNED)
|
||||
# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
|
||||
((x) <= TIMESTAMP_MAX_VALUE && \
|
||||
(x) >= TIMESTAMP_MIN_VALUE)
|
||||
#else
|
||||
# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
|
||||
((x) >= TIMESTAMP_MIN_VALUE)
|
||||
#endif
|
||||
|
||||
/* Flags to str_to_datetime */
|
||||
#define TIME_FUZZY_DATE 1
|
||||
#define TIME_DATETIME_ONLY 2
|
||||
#define TIME_TIME_ONLY 4
|
||||
/* Must be same as MODE_NO_ZERO_IN_DATE */
|
||||
#define TIME_NO_ZERO_IN_DATE (65536L*2*2*2*2*2*2*2)
|
||||
/* Must be same as MODE_NO_ZERO_DATE */
|
||||
@ -68,28 +82,46 @@ typedef long my_time_t;
|
||||
#define TIME_MAX_HOUR 838
|
||||
#define TIME_MAX_MINUTE 59
|
||||
#define TIME_MAX_SECOND 59
|
||||
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \
|
||||
TIME_MAX_SECOND)
|
||||
#define TIME_MAX_SECOND_PART 999999
|
||||
#define TIME_SECOND_PART_FACTOR (TIME_MAX_SECOND_PART+1)
|
||||
#define TIME_SECOND_PART_DIGITS 6
|
||||
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + TIME_MAX_SECOND)
|
||||
#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \
|
||||
TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND)
|
||||
|
||||
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
|
||||
ulong flags, int *was_cut);
|
||||
enum enum_mysql_timestamp_type
|
||||
str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
ulong flag, int *warning);
|
||||
enum enum_mysql_timestamp_type
|
||||
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
uint flags, int *was_cut);
|
||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||
ulong flags, int *was_cut);
|
||||
longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
|
||||
uint flags, int *was_cut);
|
||||
|
||||
static inline
|
||||
longlong double_to_datetime(double nr, MYSQL_TIME *ltime, uint flags, int *cut)
|
||||
{
|
||||
if (nr < 0 || nr > LONGLONG_MAX)
|
||||
nr= (double)LONGLONG_MAX;
|
||||
return number_to_datetime((longlong) floor(nr),
|
||||
(ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR),
|
||||
ltime, flags, cut);
|
||||
}
|
||||
|
||||
int number_to_time(my_bool neg, longlong nr, ulong sec_part,
|
||||
MYSQL_TIME *ltime, int *was_cut);
|
||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
|
||||
double TIME_to_double(const MYSQL_TIME *my_time);
|
||||
|
||||
longlong pack_time(MYSQL_TIME *my_time);
|
||||
MYSQL_TIME *unpack_time(longlong packed, MYSQL_TIME *my_time);
|
||||
|
||||
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
||||
int *warning);
|
||||
|
||||
int check_time_range(struct st_mysql_time *, int *warning);
|
||||
int check_time_range(struct st_mysql_time *my_time, uint dec, int *warning);
|
||||
|
||||
long calc_daynr(uint year,uint month,uint day);
|
||||
uint calc_days_in_year(uint year);
|
||||
@ -122,8 +154,7 @@ static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
|
||||
}
|
||||
|
||||
my_time_t
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone,
|
||||
my_bool *in_dst_time_gap);
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, uint *error_code);
|
||||
|
||||
void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
||||
|
||||
@ -136,11 +167,28 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
||||
sent using binary protocol fit in this buffer.
|
||||
*/
|
||||
#define MAX_DATE_STRING_REP_LENGTH 30
|
||||
#define AUTO_SEC_PART_DIGITS 31 /* same as NOT_FIXED_DEC */
|
||||
|
||||
int my_time_to_str(const MYSQL_TIME *l_time, char *to);
|
||||
int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
||||
int my_date_to_str(const MYSQL_TIME *l_time, char *to);
|
||||
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
|
||||
int my_TIME_to_str(const MYSQL_TIME *l_time, char *to);
|
||||
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
||||
int my_TIME_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
||||
|
||||
static inline longlong sec_part_shift(longlong second_part, uint digits)
|
||||
{
|
||||
return second_part / (longlong)log_10_int[TIME_SECOND_PART_DIGITS - digits];
|
||||
}
|
||||
static inline longlong sec_part_unshift(longlong second_part, uint digits)
|
||||
{
|
||||
return second_part * (longlong)log_10_int[TIME_SECOND_PART_DIGITS - digits];
|
||||
}
|
||||
static inline ulong sec_part_truncate(ulong second_part, uint digits)
|
||||
{
|
||||
/* the cast here should be unnecessary! */
|
||||
return second_part - second_part % (ulong)log_10_int[TIME_SECOND_PART_DIGITS - digits];
|
||||
}
|
||||
|
||||
#define hrtime_to_my_time(X) ((my_time_t)hrtime_to_time(X))
|
||||
|
||||
/*
|
||||
Available interval types used in any statement.
|
||||
|
@ -31,6 +31,7 @@ extern "C" {
|
||||
#include "keycache.h"
|
||||
#endif
|
||||
#include "my_handler.h"
|
||||
#include "my_compare.h"
|
||||
#include <myisamchk.h>
|
||||
#include <mysql/plugin.h>
|
||||
|
||||
|
@ -100,7 +100,8 @@ int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
|
||||
struct my_rnd_struct;
|
||||
enum Item_result
|
||||
{
|
||||
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT
|
||||
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT,
|
||||
TIME_RESULT
|
||||
};
|
||||
typedef struct st_udf_args
|
||||
{
|
||||
|
@ -447,7 +447,8 @@ struct my_rnd_struct;
|
||||
|
||||
enum Item_result
|
||||
{
|
||||
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT
|
||||
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT,
|
||||
TIME_RESULT
|
||||
#ifdef MYSQL_SERVER
|
||||
,IMPOSSIBLE_RESULT /* Yes, we know this is ugly, don't tell us */
|
||||
#endif
|
||||
|
@ -68,6 +68,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
|
||||
../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
|
||||
../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
|
||||
../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
|
||||
../strings/decimal.c
|
||||
../mysys/default.c errmsg.c ../mysys/errors.c ../mysys/my_sync.c
|
||||
../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c
|
||||
get_password.c ../strings/int2str.c ../strings/is_prefix.c
|
||||
@ -79,12 +80,13 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
|
||||
../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
|
||||
../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
|
||||
../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
|
||||
../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
|
||||
../mysys/my_fopen.c ../mysys/my_fstream.c
|
||||
../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
|
||||
../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
|
||||
../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
|
||||
../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
|
||||
../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
|
||||
../mysys/ma_dyncol.c
|
||||
../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
|
||||
../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
|
||||
../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
|
||||
@ -110,18 +112,16 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
|
||||
|
||||
ADD_LIBRARY(mysqlclient STATIC ${CLIENT_SOURCES})
|
||||
ADD_DEPENDENCIES(mysqlclient GenError)
|
||||
TARGET_LINK_LIBRARIES(mysqlclient)
|
||||
|
||||
ADD_LIBRARY(mysqlclient_notls STATIC ${CLIENT_SOURCES})
|
||||
ADD_DEPENDENCIES(mysqlclient_notls GenError)
|
||||
TARGET_LINK_LIBRARIES(mysqlclient_notls)
|
||||
SET(SHARED_SOURCES dll.c libmysql.def)
|
||||
ADD_VERSION_INFO(libmysql SHARED SHARED_SOURCES)
|
||||
ADD_LIBRARY(libmysql SHARED ${SHARED_SOURCES})
|
||||
|
||||
ADD_LIBRARY(libmysql SHARED ${CLIENT_SOURCES} dll.c libmysql.def)
|
||||
IF(WIN32)
|
||||
SET_TARGET_PROPERTIES(libmysql mysqlclient PROPERTIES COMPILE_FLAGS "-DUSE_TLS")
|
||||
ENDIF(WIN32)
|
||||
ADD_DEPENDENCIES(libmysql GenError)
|
||||
TARGET_LINK_LIBRARIES(libmysql wsock32)
|
||||
TARGET_LINK_LIBRARIES(libmysql mysqlclient ws2_32)
|
||||
ADD_DEFINITIONS(-DHAVE_DLOPEN)
|
||||
|
||||
MYSQL_INSTALL_TARGETS(mysqlclient DESTINATION lib COMPONENT Development)
|
||||
|
@ -48,7 +48,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
|
||||
ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
|
||||
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
|
||||
ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo \
|
||||
strmov_overlapp.lo
|
||||
strmov_overlapp.lo decimal.lo
|
||||
|
||||
mystringsextra= strto.c
|
||||
mystringsheaders= strings_def.h
|
||||
@ -65,12 +65,12 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
|
||||
my_symlink.lo my_fstream.lo mf_arr_appstr.lo \
|
||||
mf_loadpath.lo my_pthread.lo my_thr_init.lo \
|
||||
thr_mutex.lo mulalloc.lo string.lo \
|
||||
default.lo default_modify.lo \
|
||||
default.lo default_modify.lo ma_dyncol.lo \
|
||||
my_compress.lo array.lo my_once.lo list.lo my_net.lo \
|
||||
charset.lo charset-def.lo hash.lo mf_iocache.lo \
|
||||
mf_iocache2.lo my_seek.lo my_sleep.lo \
|
||||
my_pread.lo mf_cache.lo md5.lo sha1.lo my_rnd.lo \
|
||||
my_getopt.lo my_gethostbyname.lo my_port.lo \
|
||||
my_getopt.lo my_port.lo \
|
||||
my_rename.lo my_chsize.lo my_sync.lo my_getsystime.lo
|
||||
sqlobjects = net.lo
|
||||
sql_cmn_objects = pack.lo client.lo my_time.lo client_plugin.lo
|
||||
|
@ -3549,7 +3549,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
|
||||
case MYSQL_TYPE_TIME:
|
||||
{
|
||||
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
|
||||
str_to_time(value, length, tm, &err);
|
||||
str_to_time(value, length, tm, TIME_FUZZY_DATE, &err);
|
||||
*param->error= test(err);
|
||||
break;
|
||||
}
|
||||
@ -3681,7 +3681,8 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
{
|
||||
int error;
|
||||
value= number_to_datetime(value, (MYSQL_TIME *) buffer, TIME_FUZZY_DATE,
|
||||
value= number_to_datetime(value, 0,
|
||||
(MYSQL_TIME *) buffer, TIME_FUZZY_DATE,
|
||||
&error);
|
||||
*param->error= test(error);
|
||||
break;
|
||||
@ -3904,7 +3905,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
||||
fetch_string_with_conversion:
|
||||
*/
|
||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||
uint length= my_TIME_to_str(my_time, buff);
|
||||
uint length= my_TIME_to_str(my_time, buff, field->decimals);
|
||||
/* Resort to string conversion */
|
||||
fetch_string_with_conversion(param, (char *)buff, length);
|
||||
break;
|
||||
@ -4381,7 +4382,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
||||
field->max_length= MAX_DOUBLE_STRING_REP_LENGTH;
|
||||
break;
|
||||
case MYSQL_TYPE_TIME:
|
||||
field->max_length= 15; /* 19:23:48.123456 */
|
||||
field->max_length= 17; /* -819:23:48.123456 */
|
||||
param->skip_result= skip_result_with_length;
|
||||
break;
|
||||
case MYSQL_TYPE_DATE:
|
||||
|
@ -144,7 +144,8 @@ SET(LIBMYSQLD_SOURCES libmysqld.c emb_qcache.cc lib_sql.cc
|
||||
../sql/multi_range_read.cc
|
||||
../sql/opt_index_cond_pushdown.cc
|
||||
../sql/opt_subselect.cc
|
||||
../sql/create_options.cc
|
||||
../sql/create_options.cc ../sql/rpl_utility.cc
|
||||
../sql/rpl_reporting.cc
|
||||
../sql/sql_expression_cache.cc
|
||||
${GEN_SOURCES}
|
||||
${LIB_SOURCES})
|
||||
|
@ -55,7 +55,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
|
||||
item_geofunc.cc item_subselect.cc item_row.cc\
|
||||
item_xmlfunc.cc \
|
||||
key.cc lock.cc log.cc sql_state.c \
|
||||
log_event.cc rpl_record.cc \
|
||||
log_event.cc rpl_record.cc rpl_utility.cc rpl_reporting.cc \
|
||||
log_event_old.cc rpl_record_old.cc \
|
||||
protocol.cc net_serv.cc opt_range.cc \
|
||||
opt_subselect.cc \
|
||||
|
@ -46,6 +46,7 @@ extern "C" void unireg_clear(int exit_code)
|
||||
{
|
||||
DBUG_ENTER("unireg_clear");
|
||||
clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
|
||||
clean_up_mutexes();
|
||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -574,6 +575,7 @@ void end_embedded_server()
|
||||
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
|
||||
copy_arguments_ptr=0;
|
||||
clean_up(0);
|
||||
clean_up_mutexes();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
LIBRARY LIBMYSQLD
|
||||
DESCRIPTION 'MySQL 5.1 Embedded Server Library'
|
||||
VERSION 5.1
|
||||
EXPORTS
|
||||
mysql_thread_end
|
||||
|
@ -1,4 +1,5 @@
|
||||
# Copyright (C) 2000-2006 MySQL AB
|
||||
# Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
# Copyright (c) 2009-2011, Monty Program Ab
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
@ -10,10 +11,9 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
## Process this file with automake to create Makefile.in
|
||||
|
||||
@ -84,7 +84,6 @@ TEST_DIRS = t r include std_data std_data/parts collections \
|
||||
std_data/funcs_1 \
|
||||
extra/binlog_tests/ extra/rpl_tests \
|
||||
suite/binlog suite/binlog/t suite/binlog/r suite/binlog/std_data \
|
||||
suite/bugs suite/bugs/data suite/bugs/t suite/bugs/r \
|
||||
suite/federated \
|
||||
suite/pbxt/t suite/pbxt/r suite/pbxt \
|
||||
suite/vcol suite/vcol/t suite/vcol/r suite/vcol/inc \
|
||||
|
@ -15,9 +15,13 @@ The syntax is as follows:
|
||||
and any subsequent characters are ignored.
|
||||
|
||||
4) The full test case name including the suite and execution mode
|
||||
must be specified, for example:
|
||||
may be specified, for example:
|
||||
main.alias 'row' # bug#00000
|
||||
|
||||
4b) Now, combinations will also be covered if only the test name is
|
||||
specified, for example:
|
||||
rpl.rpl_ps # Covers 'row', 'mix' and 'stmt'
|
||||
|
||||
5) As an exception to item 4, the last character of the test case
|
||||
specification may be an asterisk (*). In that case, all test cases that
|
||||
start with the same characters up to the last letter before the asterisk
|
||||
|
@ -2,6 +2,8 @@
|
||||
# in alphabetical order. This also helps with merge conflict resolution.
|
||||
|
||||
binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
binlog.binlog_bug23533 # skozlov: BUG#12371924
|
||||
|
||||
|
||||
funcs_1.charset_collation_1 # depends on compile-time decisions
|
||||
funcs_1.is_cml_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
@ -21,8 +23,9 @@ main.outfile_loaddata @solaris # joro : Bug #46895
|
||||
|
||||
ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
|
||||
rpl.rpl_innodb_bug28430* @solaris # Bug#46029
|
||||
rpl.rpl_row_sp011 @solaris # Joro : Bug #54138
|
||||
rpl.rpl_innodb_bug28430 @solaris # Bug#46029
|
||||
rpl.rpl_row_sp011 @solaris # Joro : Bug #45445
|
||||
rpl.rpl_stop_slave # Sven : BUG#12345981
|
||||
|
||||
rpl_ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
rpl_ndb.rpl_ndb_log # Bug#38998
|
||||
|
@ -1,4 +1,3 @@
|
||||
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
|
||||
perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.partition_alter1_2_ndb parts.part_supported_sql_func_innodb parts.partition_alter1_2_innodb parts.partition_alter4_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_ndb rpl_ndb.rpl_truncate_7ndb_2 main.archive-big main.sum_distinct-big main.mysqlbinlog_row_big main.alter_table-big main.variables-big main.type_newdecimal-big main.read_many_rows_innodb main.log_tables-big main.count_distinct3 main.events_time_zone main.merge-big main.create-big main.events_stress main.ssl-big funcs_1.myisam_views-big
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-row-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=row
|
||||
|
@ -1,5 +0,0 @@
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
|
@ -1,4 +0,0 @@
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --suite=main --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
|
6
mysql-test/collections/mysql-next-mr-wl2540.push
Normal file
6
mysql-test/collections/mysql-next-mr-wl2540.push
Normal file
@ -0,0 +1,6 @@
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum --mysqld=--binlog-checksum=CRC32 --vardir=var-rpl_binlog_checksum --suite=binlog,rpl --skip-test-list=collections/disabled-per-push.list
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
|
7
mysql-test/collections/mysql-trunk.daily
Normal file
7
mysql-test/collections/mysql-trunk.daily
Normal file
@ -0,0 +1,7 @@
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_ndb_row --vardir=var-rpl_ndb_row --mysqld=--binlog-format=row --suite=rpl_ndb,ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum --mysqld=--binlog-checksum=CRC32 --vardir=var-rpl_binlog_checksum --suite=binlog,rpl
|
2
mysql-test/collections/mysql-trunk.weekly
Normal file
2
mysql-test/collections/mysql-trunk.weekly
Normal file
@ -0,0 +1,2 @@
|
||||
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
|
||||
perl mysql-test-run.pl --timer --force --comment=all_binlog_checksum --experimental=collections/default.experimental --mysqld=--binlog-checksum=CRC32 --vardir=var-all_binlog_checksum --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
|
@ -83,17 +83,22 @@ set @bcs = @@binlog_cache_size;
|
||||
set global binlog_cache_size=4096;
|
||||
reset master;
|
||||
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t1 (a int, b char(255)) engine=innodb;
|
||||
|
||||
let $1=400;
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
|
||||
let $1=100;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values( $1 );
|
||||
eval insert into t1 values( $1, 'just to fill void to make transaction occupying at least two buffers of the trans cache' );
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
--echo *** the following must show the counter value = 1 ***
|
||||
show status like "binlog_cache_use";
|
||||
enable_query_log;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
@ -343,6 +348,7 @@ SHOW SESSION VARIABLES LIKE "%_checks";
|
||||
--echo # INSERT INTO t1 VALUES(2)
|
||||
--echo # foreign_key_checks=1 and unique_checks=1
|
||||
--echo # It should not change current session's variables, even error happens
|
||||
call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
|
||||
--error 1062
|
||||
BINLOG '
|
||||
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
|
||||
|
@ -311,6 +311,7 @@ select get_lock("a",10);
|
||||
begin;
|
||||
insert into t1 values(8);
|
||||
insert into t2 select * from t1;
|
||||
|
||||
disconnect con3;
|
||||
|
||||
connection con4;
|
||||
|
@ -93,6 +93,7 @@ if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRIC
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
--echo Last_SQL_Error = $err (expected "duplicate key" error)
|
||||
call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo ---- Resolve the conflict on the slave and restart SQL thread ----
|
||||
@ -137,6 +138,7 @@ connection slave;
|
||||
# replication continues.
|
||||
if (`SELECT @@global.binlog_format = 'ROW' AND @@global.slave_exec_mode = 'STRICT'`) {
|
||||
--echo ---- Wait until slave stops with an error ----
|
||||
call mtr.add_suppression("Can.t find record in .t1., Error_code: 1032");
|
||||
let $slave_sql_errno= 1032; # ER_KEY_NOT_FOUND
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
|
||||
|
@ -121,6 +121,16 @@ SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
|
||||
hex(f10),hex(f11) FROM t1 ORDER BY f3 LIMIT 20;
|
||||
|
||||
#connection slave;
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
|
||||
call mtr.add_suppression("Slave.*Can.t DROP .c7.; check that column.key exists.* Error_code: 1091");
|
||||
call mtr.add_suppression("Slave.*Unknown column .c7. in .t15.* Error_code: 1054");
|
||||
call mtr.add_suppression("Slave.*Key column .c6. doesn.t exist in table.* Error_code: 1072");
|
||||
call mtr.add_suppression("Slave I/O: Get master clock failed with error:.* Error_code: 2013");
|
||||
call mtr.add_suppression("Slave I/O: Get master SERVER_ID failed with error:.* Error_code: 2013");
|
||||
--enable_query_log
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo
|
||||
--echo * Select count and 20 rows from Slave *
|
||||
|
@ -766,6 +766,10 @@ RESET MASTER;
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
call mtr.add_suppression("Slave SQL.*Error .Unknown table .t6.. on query.* Error_code: 1051");
|
||||
call mtr.add_suppression("Slave SQL.*Error .Duplicate column name .c6.. on query.* Error_code: 1060");
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column . ...e mismatch.* Error_code: 1535");
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
|
@ -15,6 +15,7 @@ create table t3 (a int) engine=merge union(t1);
|
||||
create table t4 (a int);
|
||||
# We force the slave to open t3 (because we want to try confusing him) with this :
|
||||
insert into t4 select * from t3;
|
||||
--let $rename_event_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
rename table t1 to t5, t2 to t1;
|
||||
# RENAME may have confused the master (this is a known bug): so FLUSH tables,
|
||||
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
|
||||
|
64
mysql-test/extra/rpl_tests/rpl_insert_duplicate.test
Normal file
64
mysql-test/extra/rpl_tests/rpl_insert_duplicate.test
Normal file
@ -0,0 +1,64 @@
|
||||
# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
|
||||
# In SBR, if a statement does not fail, it is always written to the binary log,
|
||||
# regardless if rows are changed or not. If there is a failure, a statement is
|
||||
# only written to the binary log if a non-transactional (.e.g. MyIsam) engine
|
||||
# is updated. INSERT ON DUPLICATE KEY UPDATE was not following the rule above
|
||||
# and was not written to the binary log, if then engine was Innodb.
|
||||
#
|
||||
# In this test case, we check if INSERT ON DUPLICATE KEY UPDATE that does not
|
||||
# change anything is still written to the binary log.
|
||||
|
||||
# Prepare environment
|
||||
--connection master
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a INT UNSIGNED NOT NULL PRIMARY KEY
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a INT UNSIGNED
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
|
||||
# An insert duplicate that does not update anything must be written to the binary
|
||||
# log in SBR and MIXED modes. We check this property by summing a before and after
|
||||
# the update and comparing the binlog positions. The sum should be the same at both
|
||||
# points and the statement should be in the binary log.
|
||||
--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
|
||||
--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1)
|
||||
--let $statement_file=INSERT INTO t1 SELECT t2.a FROM t2 ORDER BY t2.a ON DUPLICATE KEY UPDATE t1.a= t1.a
|
||||
--eval $statement_file
|
||||
|
||||
--let $assert_cond= SUM(a) = 1 FROM t1
|
||||
--let $assert_text= Sum of elements in t1 should be 1.
|
||||
--source include/assert.inc
|
||||
|
||||
if (`SELECT @@BINLOG_FORMAT = 'ROW'`)
|
||||
{
|
||||
--let $binlog_position_cmp= =
|
||||
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('Innodb')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('MyIsam')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 0, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
--source include/assert.inc
|
||||
|
||||
# Compare master and slave
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:test.t1 , slave:test.t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
# Clean up
|
||||
--connection master
|
||||
drop table t1, t2;
|
||||
--sync_slave_with_master
|
@ -5,6 +5,7 @@
|
||||
# Slave needs to be started with --innodb to store table in InnoDB.
|
||||
# Same test for MyISAM (which had no bug).
|
||||
|
||||
--connection master
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
@ -32,38 +33,49 @@ INSERT INTO t2 VALUES (5, 4);
|
||||
INSERT INTO t2 VALUES (6, 6);
|
||||
|
||||
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
|
||||
--let $assert_cond= COUNT(*) = 6 FROM t1
|
||||
--let $assert_text= Count of elements in t1 should be 6.
|
||||
--source include/assert.inc
|
||||
|
||||
# Compare results
|
||||
# Compare master and slave
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:test.t1 , slave:test.t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
|
||||
# An insert ignore that does not update anything must be written to the binary log in SBR
|
||||
# and MIXED modes. We check this property by counting occurrences in t1 before and after
|
||||
# the insert and comparing the binlog positions. The count should be the same in both points
|
||||
# and the statement should be in the binary log.
|
||||
--connection master
|
||||
--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
|
||||
--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1)
|
||||
--let $statement_file=INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
|
||||
--eval $statement_file
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
--let $assert_cond= COUNT(*) = 6 FROM t1
|
||||
--let $assert_text= Count of elements in t1 should be 6.
|
||||
--source include/assert.inc
|
||||
|
||||
# Now do the same for MyISAM
|
||||
if (`SELECT @@BINLOG_FORMAT = 'ROW'`)
|
||||
{
|
||||
--let $binlog_position_cmp= =
|
||||
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('Innodb')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 2, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('MyIsam')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
--source include/assert.inc
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
unique (b)
|
||||
) ENGINE=$engine_type2;
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (3, 3);
|
||||
INSERT INTO t1 VALUES (4, 4);
|
||||
|
||||
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
# Clean up
|
||||
--connection master
|
||||
drop table t1, t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--sync_slave_with_master
|
||||
|
@ -63,6 +63,8 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# 1062 = ER_DUP_ENTRY
|
||||
call mtr.add_suppression("Slave SQL.*Error .Duplicate entry .10. for key .b.. on query.* Error_code: 1062");
|
||||
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.*error code=1062.*Error on slave:.*Error_code: 0");
|
||||
--let $slave_sql_errno= 1062
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
|
@ -62,4 +62,24 @@ UPDATE t1 SET c1= 0;
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
#
|
||||
# BUG#11766865: 60091: RBR + NO PK + UPDATE NULL VALUE --> SLAVE BREAK WITH ERROR HA_ERR_END_OF_
|
||||
#
|
||||
|
||||
--connection master
|
||||
--source include/rpl_reset.inc
|
||||
--connection master
|
||||
|
||||
--eval CREATE TABLE t1 (c1 int(11) NOT NULL, c2 int(11) NOT NULL, c3 int(11) DEFAULT '-1') ENGINE=$engine DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO t1 VALUES (1,2,NULL);
|
||||
UPDATE t1 SET c1=1, c2=2, c3=-1 WHERE c1=1 AND c2=2 AND ISNULL(c3);
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
--let $diff_tables=master:test.t1, slave:test.t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
--sync_slave_with_master
|
||||
|
@ -10,6 +10,9 @@
|
||||
|
||||
-- source include/master-slave.inc
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
call mtr.add_suppression('Slave I/O: Get master BINLOG_CHECKSUM failed with error');
|
||||
--enable_query_log
|
||||
let $status_items= Master_User, Master_Host;
|
||||
source include/show_slave_status.inc;
|
||||
|
||||
|
@ -378,7 +378,9 @@ INSERT INTO t3 VALUES (1, "", 1);
|
||||
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
|
||||
|
||||
connection slave;
|
||||
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
|
||||
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
|
||||
call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032");
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
@ -147,6 +147,7 @@ sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO t4 VALUES (4);
|
||||
connection slave;
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column [012] type mismatch.* Error_code: 1535");
|
||||
--let $slave_skip_counter= 2
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
|
@ -25,6 +25,7 @@ drop table t1;
|
||||
|
||||
connection slave;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.* error code=1062.*Error on slave:.* Error_code: 0");
|
||||
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
|
||||
let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
|
||||
--echo Error: "$error" (expected different error codes on master and slave)
|
||||
|
@ -11,16 +11,18 @@
|
||||
# Format_description_log_event length =
|
||||
# 19 /* event common header */ +
|
||||
# 57 /* misc stuff in the Format description header */ +
|
||||
# number of events.
|
||||
# number of events +
|
||||
# 1 /* Checksum algorithm */ +
|
||||
# 4 /* CRC32 length */
|
||||
#
|
||||
# With current number of events = 160,
|
||||
#
|
||||
# binlog_start_pos = 4 + 19 + 57 + 160 = 240.
|
||||
# binlog_start_pos = 4 + 19 + 57 + 160 + 1 + 4 = 245.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
let $binlog_start_pos=240;
|
||||
let $binlog_start_pos=245;
|
||||
--disable_query_log
|
||||
SET @binlog_start_pos=240;
|
||||
SET @binlog_start_pos=245;
|
||||
--enable_query_log
|
||||
|
||||
|
@ -33,7 +33,8 @@ connection default;
|
||||
# least it acquires S-locks on some of rows.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state in ("Sending data","statistics", "preparing") and
|
||||
where state in ("Sending data","statistics", "preparing", "updating",
|
||||
"executing", "Searching rows for update") and
|
||||
info = "$wait_statement";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
|
@ -502,16 +502,16 @@ call p_verify_status_increment(2, 2, 2, 2);
|
||||
--echo # 12. Read-write statement: IODKU, change 0 rows.
|
||||
--echo #
|
||||
insert t1 set a=2 on duplicate key update a=2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 13. Read-write statement: INSERT IGNORE, change 0 rows.
|
||||
--echo #
|
||||
insert ignore t1 set a=2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 14. Read-write statement: INSERT IGNORE, change 1 row.
|
||||
--echo #
|
||||
|
@ -44,3 +44,19 @@ SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #58650 "Failing assertion: primary_key_no == -1 ||
|
||||
--echo # primary_key_no == 0".
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--echo # The minimal test case.
|
||||
create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a));
|
||||
drop table t1;
|
||||
--echo # The original test case.
|
||||
create table t1 (a int not null, b linestring not null, unique key b (b(12)));
|
||||
create unique index a on t1(a);
|
||||
drop table t1;
|
||||
|
4
mysql-test/include/have_binlog_checksum_off.inc
Normal file
4
mysql-test/include/have_binlog_checksum_off.inc
Normal file
@ -0,0 +1,4 @@
|
||||
if (`select variable_value not like 'NONE' from information_schema.GLOBAL_VARIABLES
|
||||
where variable_name='binlog_checksum'`){
|
||||
skip Can not run the test when server activated checksumming;
|
||||
}
|
78
mysql-test/include/have_dbi_dbd-mysql.inc
Normal file
78
mysql-test/include/have_dbi_dbd-mysql.inc
Normal file
@ -0,0 +1,78 @@
|
||||
#
|
||||
# Originally created by John Embretsen, 2011-01-26.
|
||||
#
|
||||
# Checks for the existence of Perl modules DBI and DBD::mysql as seen from the
|
||||
# perl installation used by "external" executable perl scripts, i.e. scripts
|
||||
# that are executed as standalone scripts interpreted by the perl installation
|
||||
# specified by the "shebang" line in the top of these scripts.
|
||||
#
|
||||
# If either module is not found, the test will be skipped.
|
||||
#
|
||||
# For use in tests that call perl scripts that require these modules.
|
||||
#
|
||||
# This file is intended to work on Unix. Windows may need different treatment.
|
||||
# Reasoning:
|
||||
# - "shebangs" are not relevant on Windows, but need to be handled here.
|
||||
# - Perl scripts cannot be made executable on Windows, interpreter must be
|
||||
# specified.
|
||||
#
|
||||
# Note that if there are multiple perl installations and not all have the
|
||||
# required modules, this check may fail even if the perl in path does have
|
||||
# the modules available. This may happen if the perl specified by the script's
|
||||
# shebang (e.g. #!/usr/bin/perl) does not have these modules, and script is
|
||||
# called without specifying the perl interpreter. However, this will be
|
||||
# a correct result in cases where a test calls a script with a similar shebang.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
--source include/not_windows.inc
|
||||
|
||||
# We jump through some hoops since there is no direct way to check if an
|
||||
# external command went OK or not from a mysql-test file:
|
||||
#
|
||||
# - In theory, we could do as simple as "exec perl -MDBI -MDBD::mysql -e 1",
|
||||
# however we cannot check the result (exit code) from within a test script.
|
||||
# Also, this may not yield the same result as other uses of perl due to the
|
||||
# shebang issue mentioned above.
|
||||
# - Instead we use a separate helper perl script that checks for the modules.
|
||||
# - If the modules are found, the perl script leaves a file which sets a
|
||||
# variable that can be read by this file.
|
||||
# If the modules are not found, the perl script does not set this variable,
|
||||
# but leaves an empty file instead.
|
||||
#
|
||||
# This is done because there is apparently no direct way to transfer
|
||||
# information from perl to the test script itself.
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--disable_warnings
|
||||
|
||||
# We do not use embedded perl in this script because that would not have yielded
|
||||
# correct results for a situation where an external Perl script is called like
|
||||
# "scriptname" instead of "perl scriptname" and the shebang in the script points
|
||||
# to a specific perl that may be different than the perl in PATH.
|
||||
#
|
||||
# Instead, we call a separate helper script which checks for the modules in its
|
||||
# own environment. We call it without "perl" in front.
|
||||
|
||||
--let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl
|
||||
--let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt
|
||||
|
||||
# Make the script executable and execute it.
|
||||
--chmod 0755 $perlChecker
|
||||
--exec $perlChecker
|
||||
|
||||
# Source the resulting temporary file and look for a variable being set.
|
||||
--source $resultFile
|
||||
|
||||
if (!$dbidbd) {
|
||||
--skip Test needs Perl modules DBI and DBD::mysql
|
||||
}
|
||||
|
||||
# Clean up
|
||||
--remove_file $resultFile
|
||||
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
--enable_warnings
|
||||
|
@ -634,6 +634,10 @@ drop table t1;
|
||||
drop table bug29807;
|
||||
create table bug29807 (a int);
|
||||
drop table bug29807;
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal");
|
||||
call mtr.add_suppression("Cannot find or open table test\/bug29807 from");
|
||||
--enable_query_log
|
||||
|
||||
|
||||
#
|
||||
|
@ -53,7 +53,7 @@ END
|
||||
-- Insert patterns that should always be suppressed
|
||||
--
|
||||
INSERT INTO global_suppressions VALUES
|
||||
("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"),
|
||||
(".SELECT UNIX_TIMESTAMP... failed on master"),
|
||||
("Aborted connection"),
|
||||
("Client requested master to start replication from impossible position"),
|
||||
("Could not find first log file name in binary log"),
|
||||
@ -107,11 +107,8 @@ INSERT INTO global_suppressions VALUES
|
||||
("Slave: The incident LOST_EVENTS occured on the master"),
|
||||
("Slave: Unknown error.* 1105"),
|
||||
("Slave: Can't drop database.* database doesn't exist"),
|
||||
("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"),
|
||||
("Sort aborted"),
|
||||
("Time-out in NDB"),
|
||||
("Warning:\s+One can only use the --user.*root"),
|
||||
("Warning:\s+Setting lower_case_table_names=2"),
|
||||
("Warning:\s+Table:.* on (delete|rename)"),
|
||||
("You have an error in your SQL syntax"),
|
||||
("deprecated"),
|
||||
@ -124,55 +121,21 @@ INSERT INTO global_suppressions VALUES
|
||||
("slave SQL thread aborted"),
|
||||
("Slave: .*Duplicate entry"),
|
||||
|
||||
/*
|
||||
Special case, made as specific as possible, for:
|
||||
Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
|
||||
server coredump
|
||||
*/
|
||||
|
||||
("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
|
||||
|
||||
("Statement may not be safe to log in statement format"),
|
||||
|
||||
/* test case for Bug#bug29807 copies a stray frm into database */
|
||||
("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
|
||||
("Cannot find or open table test\/bug29807 from"),
|
||||
|
||||
/* innodb foreign key tests that fail in ALTER or RENAME produce this */
|
||||
("InnoDB: Error: in ALTER TABLE `test`.`t[123]`"),
|
||||
("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
|
||||
("InnoDB: Error: table `test`.`t[123]` does not exist in the InnoDB internal"),
|
||||
|
||||
/* Test case for Bug#14233 produces the following warnings: */
|
||||
("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"),
|
||||
("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"),
|
||||
("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"),
|
||||
|
||||
/*
|
||||
BUG#32080 - Excessive warnings on Solaris: setrlimit could not
|
||||
change the size of core files
|
||||
*/
|
||||
("setrlimit could not change the size of core files to 'infinity'"),
|
||||
|
||||
/*
|
||||
rpl_extrColmaster_*.test, the slave thread produces warnings
|
||||
when it get updates to a table that has more columns on the
|
||||
master
|
||||
*/
|
||||
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
|
||||
("Slave: Can't DROP 'c7'.* 1091"),
|
||||
("Slave: Key column 'c6'.* 1072"),
|
||||
("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
|
||||
(".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
|
||||
|
||||
/* Test case for Bug#31590 in order_by.test produces the following error */
|
||||
("Out of sort memory; increase server sort buffer size"),
|
||||
|
||||
/* Special case for Bug #26402 in show_check.test
|
||||
- Question marks are not valid file name parts on Windows. Ignore
|
||||
this error message.
|
||||
*/
|
||||
("Can't find file: '.\\\\test\\\\\\?{8}.frm'"),
|
||||
("Slave: Unknown table 't1' Error_code: 1051"),
|
||||
|
||||
/* Maria storage engine dependent tests */
|
||||
@ -209,7 +172,9 @@ INSERT INTO global_suppressions VALUES
|
||||
("Slave I/O: Get master clock failed with error:.*"),
|
||||
("Slave I/O: Get master COLLATION_SERVER failed with error:.*"),
|
||||
("Slave I/O: Get master TIME_ZONE failed with error:.*"),
|
||||
|
||||
("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum on master.*"),
|
||||
("Slave I/O: Get master BINLOG_CHECKSUM failed with error.*"),
|
||||
("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"),
|
||||
("THE_LAST_SUPPRESSION")||
|
||||
|
||||
|
||||
|
@ -4,12 +4,26 @@
|
||||
|
||||
--source include/not_windows.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_dbi_dbd-mysql.inc
|
||||
|
||||
if ($MYSQLHOTCOPY)
|
||||
if (!$MYSQLHOTCOPY)
|
||||
{
|
||||
# Fail the test if the mysqlhotcopy script is missing.
|
||||
# If the tool's location changes, mysql-test-run.pl must be updated to
|
||||
# reflect this (look for "MYSQLHOTCOPY").
|
||||
die due to missing mysqlhotcopy tool;
|
||||
}
|
||||
|
||||
# NOTE (johnemb, 2011-01-26):
|
||||
# In this test mysqlhotcopy (a perl script) is executed as a standalone
|
||||
# executable, i.e. not necessarily using the perl interpreter in PATH,
|
||||
# because that is how the documentation demonstrates it.
|
||||
#
|
||||
# We include have_dbi_dbd-mysql.inc above so that the test will
|
||||
# be skipped if Perl modules required by the mysqlhotcopy tool are not
|
||||
# found when the script is run this way.
|
||||
|
||||
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS hotcopy_test;
|
||||
@ -95,7 +109,7 @@ DROP DATABASE hotcopy_save;
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
--list_files $MYSQLD_DATADIR/hotcopy_save
|
||||
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
|
||||
--error 9,2304
|
||||
--error 9,11,2304
|
||||
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
|
||||
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
|
||||
--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
|
||||
|
24
mysql-test/include/not_crashrep.inc
Normal file
24
mysql-test/include/not_crashrep.inc
Normal file
@ -0,0 +1,24 @@
|
||||
# Check if CrashReporter is enabled and would open a window
|
||||
|
||||
perl;
|
||||
sub skip_test {
|
||||
# Only relevant on Mac OS X
|
||||
return 0 unless $^O eq 'darwin';
|
||||
my $crep= `defaults read com.apple.CrashReporter DialogType`;
|
||||
return 0 if $?;
|
||||
chomp ($crep);
|
||||
$crep= lc $crep;
|
||||
return ($crep eq 'basic' || $crep eq 'developer');
|
||||
}
|
||||
my $skip= skip_test();
|
||||
open (F, ">" . $ENV{'MYSQL_TMP_DIR'} . "/crashrep.inc");
|
||||
print F "let \$crashrep= $skip;\n";
|
||||
close F;
|
||||
EOF
|
||||
|
||||
--source $MYSQL_TMP_DIR/crashrep.inc
|
||||
--remove_file $MYSQL_TMP_DIR/crashrep.inc
|
||||
|
||||
if ($crashrep) {
|
||||
--skip CrashReporter would popup a window
|
||||
}
|
@ -106,7 +106,7 @@ drop table t5 ;
|
||||
# c1 tinyint, c2 smallint, c3 mediumint, c4 int,
|
||||
# c5 integer, c6 bigint, c7 float, c8 double,
|
||||
# c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
|
||||
# c13 date, c14 datetime, c15 timestamp(14), c16 time,
|
||||
# c13 date, c14 datetime, c15 timestamp, c16 time,
|
||||
# c17 year, c18 tinyint, c19 bool, c20 char,
|
||||
# c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
|
||||
# c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
|
||||
@ -672,7 +672,6 @@ select '-- insert into string columns --' as test_sequence ;
|
||||
--enable_query_log
|
||||
|
||||
######## INSERT into .. string columns values(CHAR(n),LONGTEXT) ########
|
||||
--disable_query_log
|
||||
insert into t9
|
||||
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
|
||||
values
|
||||
@ -860,8 +859,6 @@ values
|
||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00 ;
|
||||
|
||||
--enable_query_log
|
||||
|
||||
######## SELECT of all inserted records ########
|
||||
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
|
||||
from t9 where c1 >= 20
|
||||
@ -980,14 +977,13 @@ delete from t9 ;
|
||||
|
||||
######################### test of date/time columns ########################
|
||||
# #
|
||||
# c13 date, c14 datetime, c15 timestamp(14), c16 time, c17 year #
|
||||
# c13 date, c14 datetime, c15 timestamp, c16 time, c17 year #
|
||||
# #
|
||||
############################################################################
|
||||
--disable_query_log
|
||||
select '-- insert into date/time columns --' as test_sequence ;
|
||||
--enable_query_log
|
||||
######## INSERT into .. date/time columns values(VARCHAR(19),LONGTEXT) ########
|
||||
--disable_query_log
|
||||
set @arg00= '1991-01-01 01:01:01' ;
|
||||
insert into t9
|
||||
( c1, c13, c14, c15, c16, c17 )
|
||||
@ -1143,12 +1139,9 @@ values
|
||||
( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
|
||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
|
||||
|
||||
--enable_query_log
|
||||
|
||||
######## SELECT of all inserted records ########
|
||||
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
|
||||
|
||||
|
||||
--disable_query_log
|
||||
select '-- select .. where date/time column = .. --' as test_sequence ;
|
||||
--enable_query_log
|
||||
@ -1156,19 +1149,19 @@ select '-- select .. where date/time column = .. --' as test_sequence ;
|
||||
set @arg00= '1991-01-01 01:01:01' ;
|
||||
select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
|
||||
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
|
||||
c15= '1991-01-01 01:01:01' and
|
||||
c17= '1991-01-01 01:01:01' ;
|
||||
select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
|
||||
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00
|
||||
and c17= @arg00 ;
|
||||
prepare stmt1 from "select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
|
||||
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
|
||||
c15= '1991-01-01 01:01:01' and
|
||||
c17= '1991-01-01 01:01:01'" ;
|
||||
execute stmt1 ;
|
||||
prepare stmt1 from "select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
|
||||
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ;
|
||||
execute stmt1 using @arg00, @arg00, @arg00, @arg00 ;
|
||||
|
||||
|
||||
######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ########
|
||||
@ -1177,21 +1170,39 @@ select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
|
||||
c14= CAST('1991-01-01 01:01:01' as datetime) and
|
||||
c15= CAST('1991-01-01 01:01:01' as datetime) and
|
||||
c16= CAST('1991-01-01 01:01:01' as datetime) and
|
||||
c17= CAST('1991-01-01 01:01:01' as datetime) ;
|
||||
select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
|
||||
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00
|
||||
and c17= @arg00 ;
|
||||
prepare stmt1 from "select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
|
||||
c14= CAST('1991-01-01 01:01:01' as datetime) and
|
||||
c15= CAST('1991-01-01 01:01:01' as datetime) and
|
||||
c16= CAST('1991-01-01 01:01:01' as datetime) and
|
||||
c17= CAST('1991-01-01 01:01:01' as datetime)" ;
|
||||
execute stmt1 ;
|
||||
prepare stmt1 from "select 'true' as found from t9
|
||||
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
|
||||
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ;
|
||||
execute stmt1 using @arg00, @arg00, @arg00, @arg00 ;
|
||||
|
||||
|
||||
######## SELECT .. WHERE column(date/time/..)=value(CHAR(n)/LONGTEXT) ########
|
||||
set @arg00= '01:01:01' ;
|
||||
select 'true' as found from t9 where c1= 20 and c16= '01:01:01' ;
|
||||
select 'true' as found from t9 where c1= 20 and c16= @arg00 ;
|
||||
prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= '01:01:01'" ;
|
||||
execute stmt1 ;
|
||||
prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ;
|
||||
execute stmt1 using @arg00 ;
|
||||
|
||||
|
||||
######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ########
|
||||
set @arg00= CAST('01:01:01' as time) ;
|
||||
select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time) ;
|
||||
select 'true' as found from t9 where c1= 20 and c16= @arg00 ;
|
||||
prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time)" ;
|
||||
execute stmt1 ;
|
||||
prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ;
|
||||
execute stmt1 using @arg00 ;
|
||||
|
||||
|
||||
######## SELECT .. WHERE column(year)=value(INT(10)/BIGINT) ########
|
||||
|
43
mysql-test/include/restart_slave_sql.inc
Normal file
43
mysql-test/include/restart_slave_sql.inc
Normal file
@ -0,0 +1,43 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Provide a earier way to restart SQL thread when you want to stop sql thread
|
||||
# and then start it immediately.
|
||||
#
|
||||
# Sources stop_slave_sql.inc to stop SQL thread on the current connection.
|
||||
# Then issues START SLAVE SQL_THREAD and then waits until
|
||||
# the SQL threads have started, or until a timeout is reached.
|
||||
#
|
||||
# Please use this instead of 'STOP|START SLAVE SQL_THREAD', to reduce the risk of
|
||||
# test case bugs.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# [--let $slave_timeout= NUMBER]
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/restart_slave_sql.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $slave_timeout
|
||||
# See include/wait_for_slave_param.inc
|
||||
#
|
||||
# $rpl_debug
|
||||
# See include/rpl_init.inc
|
||||
|
||||
|
||||
--let $include_filename= restart_slave.inc
|
||||
--source include/begin_include_file.inc
|
||||
|
||||
|
||||
if (!$rpl_debug)
|
||||
{
|
||||
--disable_query_log
|
||||
}
|
||||
|
||||
source include/stop_slave_sql.inc;
|
||||
START SLAVE SQL_THREAD;
|
||||
source include/wait_for_slave_sql_to_start.inc;
|
||||
|
||||
|
||||
--let $include_filename= restart_slave.inc
|
||||
--source include/end_include_file.inc
|
2
mysql-test/include/rpl_connection_master.inc
Normal file
2
mysql-test/include/rpl_connection_master.inc
Normal file
@ -0,0 +1,2 @@
|
||||
let $rpl_connection_name= master;
|
||||
source include/rpl_connection.inc;
|
2
mysql-test/include/rpl_connection_slave.inc
Normal file
2
mysql-test/include/rpl_connection_slave.inc
Normal file
@ -0,0 +1,2 @@
|
||||
let $rpl_connection_name= slave;
|
||||
source include/rpl_connection.inc;
|
2
mysql-test/include/rpl_connection_slave1.inc
Normal file
2
mysql-test/include/rpl_connection_slave1.inc
Normal file
@ -0,0 +1,2 @@
|
||||
let $rpl_connection_name= slave1;
|
||||
source include/rpl_connection.inc;
|
@ -88,7 +88,7 @@ while ($_rpl_i) {
|
||||
{
|
||||
--echo Sync IO: $_rpl_slave_io_running; Sync SQL: $_rpl_slave_sql_running
|
||||
}
|
||||
--let $_rpl_slave_io_running= `SELECT IF('$_rpl_slave_io_running' = 'Yes', 1, '')`
|
||||
--let $_rpl_slave_io_running= `SELECT IF('$_rpl_slave_io_running' != 'No', 1, '')`
|
||||
--let $_rpl_slave_sql_running= `SELECT IF('$_rpl_slave_sql_running' = 'Yes', 1, '')`
|
||||
if ($_rpl_slave_io_running)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
--let $binlog_start=240
|
||||
--let $binlog_start=245
|
||||
--replace_result $binlog_start <binlog_start>
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
|
152
mysql-test/include/subselect_mat_cost.inc
Normal file
152
mysql-test/include/subselect_mat_cost.inc
Normal file
@ -0,0 +1,152 @@
|
||||
-- echo
|
||||
-- echo /* A. Subqueries in the SELECT clause. */
|
||||
explain
|
||||
select a1, a1 in (select b1 from t2 where b1 > '0') from t1;
|
||||
select a1, a1 in (select b1 from t2 where b1 > '0') from t1;
|
||||
-- echo
|
||||
explain
|
||||
select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0') from t1;
|
||||
select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0') from t1;
|
||||
-- echo
|
||||
explain
|
||||
select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0' and b1 < '9') from t1;
|
||||
select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0' and b1 < '9') from t1;
|
||||
|
||||
-- echo
|
||||
-- echo /*
|
||||
-- echo B. "Natural" examples of subqueries without grouping that
|
||||
-- echo cannot be flattened into semijoin.
|
||||
-- echo */
|
||||
|
||||
explain
|
||||
select a1 from t1 where a1 in (select b2 from t2) or a2 < '9';
|
||||
select a1 from t1 where a1 in (select b2 from t2) or a2 < '9';
|
||||
-- echo
|
||||
explain
|
||||
select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') or a2 < '9';
|
||||
select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') or a2 < '9';
|
||||
-- echo UNION subqueries are currently limited to only use IN-TO-EXISTS.
|
||||
explain
|
||||
select a2 from t1 where a2 in (select b2 from t2 UNION select b3 from t2 as t3);
|
||||
select a2 from t1 where a2 in (select b2 from t2 UNION select b3 from t2 as t3);
|
||||
-- echo
|
||||
explain
|
||||
select a1 from t1 where a1 = '1 - 02' and a1 in (select max(b1) from t2 where b2 = '2 - 02');
|
||||
select a1 from t1 where a1 = '1 - 02' and a1 in (select max(b1) from t2 where b2 = '2 - 02');
|
||||
-- echo
|
||||
explain
|
||||
select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 order by b3);
|
||||
select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 order by b3);
|
||||
|
||||
-- echo
|
||||
-- echo /* C. Subqueries in the WHERE clause with GROUP BY. */
|
||||
explain
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
|
||||
-- echo
|
||||
explain
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
|
||||
-- echo
|
||||
explain
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2 having b2 < '2 - 04');
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2 having b2 < '2 - 04');
|
||||
-- echo
|
||||
explain
|
||||
select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 group by b1, b2, b3);
|
||||
select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 group by b1, b2, b3);
|
||||
-- echo
|
||||
explain
|
||||
select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 where b3 = '3 - 02' group by b1, b2);
|
||||
select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 where b3 = '3 - 02' group by b1, b2);
|
||||
-- echo
|
||||
explain
|
||||
select * from t1 where (a1,a2,a3) in (select b1,b2,b3 from t2 where b1 = '1 - 01' group by b1,b2,b3);
|
||||
select * from t1 where (a1,a2,a3) in (select b1,b2,b3 from t2 where b1 = '1 - 01' group by b1,b2,b3);
|
||||
|
||||
-- echo
|
||||
-- echo /*
|
||||
-- echo D. Subqueries for which materialization is not possible, and the
|
||||
-- echo optimizer reverts to in-to-exists.
|
||||
-- echo */
|
||||
# The first two cases are rejected during the prepare phase by the procedure
|
||||
# subquery_types_allow_materialization().
|
||||
explain
|
||||
select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0') or a2 < '9';
|
||||
select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0') or a2 < '9';
|
||||
explain
|
||||
select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0') or a2 < '9';
|
||||
select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0') or a2 < '9';
|
||||
-- echo
|
||||
# The following two subqueries return the result of a string function with a
|
||||
# blob argument, where the return type may be != blob. These are rejected during
|
||||
# cost-based optimization when attempting to create a temporary table.
|
||||
explain
|
||||
select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0') or a2 < '9';
|
||||
select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0') or a2 < '9';
|
||||
explain
|
||||
select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select substring(b1,1,1024), substring(b2,1,1024) from t2_1024 where b1 > '0') or a2 < '9';
|
||||
select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select substring(b1,1,1024), substring(b2,1,1024) from t2_1024 where b1 > '0') or a2 < '9';
|
||||
-- echo
|
||||
|
||||
|
||||
-- echo
|
||||
-- echo /* E. Edge cases. */
|
||||
-- echo
|
||||
|
||||
-- echo /* E.1 Both materialization and in_to_exists cannot be off. */
|
||||
set @save_optimizer_switch=@@optimizer_switch;
|
||||
set @@optimizer_switch = 'materialization=off,in_to_exists=off';
|
||||
--error ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
|
||||
set @@optimizer_switch = @save_optimizer_switch;
|
||||
|
||||
-- echo /* E.2 Outer query without tables, always uses IN-TO-EXISTS. */
|
||||
explain
|
||||
select '1 - 03' in (select b1 from t2 where b1 > '0');
|
||||
select '1 - 03' in (select b1 from t2 where b1 > '0');
|
||||
|
||||
-- echo /* E.3 Subqueries without tables. */
|
||||
explain
|
||||
select a1 from t1 where a1 in (select '1 - 03') or a2 < '9';
|
||||
select a1 from t1 where a1 in (select '1 - 03') or a2 < '9';
|
||||
-- echo UNION subqueries are currently limited to only use IN-TO-EXISTS.
|
||||
explain
|
||||
select a1 from t1 where a1 in (select '1 - 03' UNION select '1 - 02');
|
||||
select a1 from t1 where a1 in (select '1 - 03' UNION select '1 - 02');
|
||||
|
||||
-- echo /* E.4 optimize_cond detects FALSE where/having clause. */
|
||||
explain
|
||||
select a1 from t1 where a1 in (select b1 from t2 where b1 = b2 and b2 = '1 - 03' and b1 = '1 - 02' ) or a2 < '9';
|
||||
select a1 from t1 where a1 in (select b1 from t2 where b1 = b2 and b2 = '1 - 03' and b1 = '1 - 02' ) or a2 < '9';
|
||||
|
||||
-- echo /* E.5 opt_sum_query detects no matching min/max row or substitutes MIN/MAX with a const. */
|
||||
-- echo TODO this test produces wrong result due to missing logic to handle the case
|
||||
-- echo when JOIN::optimize detects an empty subquery result.
|
||||
explain
|
||||
select a1 from t1 where a1 in (select max(b1) from t2);
|
||||
select a1 from t1 where a1 in (select max(b1) from t2);
|
||||
-- echo
|
||||
explain
|
||||
select a1 from t1 where a1 in (select max(b1) from t2 where b1 = '7 - 02');
|
||||
select a1 from t1 where a1 in (select max(b1) from t2 where b1 = '7 - 02');
|
||||
|
||||
-- echo /* E.6 make_join_select detects impossible WHERE. *
|
||||
|
||||
-- echo TODO
|
||||
|
||||
-- echo /* E.7 constant optimization detects "no matching row in const table". */
|
||||
|
||||
-- echo TODO
|
||||
|
||||
-- echo /* E.8 Impossible WHERE noticed after reading const tables. */
|
||||
explain
|
||||
select '1 - 03' in (select b1 from t2 where b1 > '0' and b1 < '0');
|
||||
select '1 - 03' in (select b1 from t2 where b1 > '0' and b1 < '0');
|
||||
|
||||
-- echo
|
||||
-- echo /* F. UPDATE/DELETE with subqueries. */
|
||||
-- echo
|
||||
|
||||
-- echo TODO
|
||||
-- echo
|
128
mysql-test/include/type_hrtime.inc
Normal file
128
mysql-test/include/type_hrtime.inc
Normal file
@ -0,0 +1,128 @@
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3;
|
||||
--enable_warnings
|
||||
|
||||
--error ER_TOO_BIG_PRECISION
|
||||
eval create table t1 (a $type(7));
|
||||
|
||||
eval create table t1 (a $type(3), key(a));
|
||||
insert t1 values ('2010-12-11 00:20:03.1234');
|
||||
insert t1 values ('2010-12-11 15:47:11.1234');
|
||||
insert t1 values (20101211010203.45678);
|
||||
insert t1 values (20101211030405.789e0);
|
||||
insert t1 values (99991231235959e1);
|
||||
select * from t1;
|
||||
--replace_regex /121000/121094/ /457000/457031/ /789000/789062/
|
||||
select truncate(a, 6) from t1; # Field::val_real()
|
||||
select a DIV 1 from t1; # Field::val_int()
|
||||
select group_concat(distinct a) from t1; # Field::cmp()
|
||||
alter table t1 engine=innodb;
|
||||
select * from t1 order by a;
|
||||
select * from t1 order by a+0;
|
||||
drop table t1;
|
||||
eval create table t1 (a $type(4)) engine=innodb;
|
||||
insert t1 values ('2010-12-11 01:02:03.456789');
|
||||
select * from t1;
|
||||
select extract(microsecond from a + interval 100 microsecond) from t1 where a>'2010-11-12 01:02:03.456';
|
||||
select a from t1 where a>'2010-11-12 01:02:03.456' group by a;
|
||||
|
||||
#
|
||||
# metadata
|
||||
#
|
||||
show create table t1;
|
||||
show columns from t1;
|
||||
--query_vertical select table_name, column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, datetime_precision, character_set_name, collation_name, column_type, column_key, extra from information_schema.columns where table_name='t1'
|
||||
|
||||
#
|
||||
# update/delete
|
||||
#
|
||||
select a, a+interval 9876543 microsecond from t1;
|
||||
update t1 set a=a+interval 9876543 microsecond;
|
||||
select * from t1;
|
||||
select a, a + interval 2 year from t1;
|
||||
insert t1 select a + interval 2 year from t1;
|
||||
select * from t1;
|
||||
delete from t1 where a < 20110101;
|
||||
select * from t1;
|
||||
|
||||
#
|
||||
# create ... select
|
||||
#
|
||||
create table t2 select * from t1;
|
||||
create table t3 like t1;
|
||||
|
||||
show create table t2;
|
||||
show create table t3;
|
||||
drop table t2, t3;
|
||||
|
||||
# math, aggregation
|
||||
insert t1 values ('2010-12-13 14:15:16.222222');
|
||||
select a, a+0, a-1, a*1, a/2 from t1;
|
||||
select max(a), min(a), sum(a), avg(a) from t1;
|
||||
create table t2 select a, a+0, a-1, a*1, a/2 from t1;
|
||||
create table t3 select max(a), min(a), sum(a), avg(a) from t1;
|
||||
show create table t2;
|
||||
show create table t3;
|
||||
|
||||
drop table t1, t2, t3;
|
||||
|
||||
# insert, alter with conversion
|
||||
--vertical_results
|
||||
eval create table t1 (f0_$type $type(0), f1_$type $type(1), f2_$type $type(2), f3_$type $type(3), f4_$type $type(4), f5_$type $type(5), f6_$type $type(6));
|
||||
insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
|
||||
select * from t1;
|
||||
eval select cast(f0_$type as time(4)) time4_f0_$type, cast(f1_$type as datetime(3)) datetime3_f1_$type, cast(f2_$type as date) date_f2_$type, cast(f4_$type as double) double_f3_$type, cast(f4_$type as decimal(40,5)) decimal5_f4_$type, cast(f5_$type as signed) bigint_f5_$type, cast(f6_$type as char(255)) varchar_f6_$type from t1;
|
||||
eval create table t2 (time4_f0_$type time(4), datetime3_f1_$type datetime(3), date_f2_$type date, double_f3_$type double, decimal5_f4_$type decimal(40,5), bigint_f5_$type bigint, varchar_f6_$type varchar(255));
|
||||
insert t2 select * from t1;
|
||||
select * from t2;
|
||||
eval alter table t1 change f0_$type time4_f0_$type time(4), change f1_$type datetime3_f1_$type datetime(3), change f2_$type date_f2_$type date, change f3_$type double_f3_$type double, change f4_$type decimal5_f4_$type decimal(40,5), change f5_$type bigint_f5_$type bigint, change f6_$type varchar_f6_$type varchar(255);
|
||||
select * from t1;
|
||||
eval alter table t1 modify time4_f0_$type $type(0), modify datetime3_f1_$type $type(1), modify date_f2_$type $type(2), modify double_f3_$type $type(3), modify decimal5_f4_$type $type(4), modify bigint_f5_$type $type(5), modify varchar_f6_$type $type(6);
|
||||
select * from t1;
|
||||
delete from t1;
|
||||
insert t1 select * from t2;
|
||||
select * from t1;
|
||||
drop table t1, t2;
|
||||
--horizontal_results
|
||||
|
||||
#
|
||||
# SP
|
||||
#
|
||||
eval create table t1 (a $type(6), b $type(6));
|
||||
eval create procedure foo(x $type, y $type(4)) insert into t1 values (x, y);
|
||||
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
|
||||
select * from t1;
|
||||
delimiter |;
|
||||
eval create procedure bar(a int, c $type(5))
|
||||
begin
|
||||
declare b $type(4);
|
||||
set b = c + interval a microsecond;
|
||||
insert t1 values (b, c + interval a microsecond);
|
||||
end|
|
||||
delimiter ;|
|
||||
call bar(1111111, '2011-01-02 3:4:5.123456');
|
||||
select * from t1;
|
||||
drop procedure foo;
|
||||
drop procedure bar;
|
||||
eval create function xyz(s char(20)) returns $type(4)
|
||||
return addtime('2010-10-10 10:10:10.101010', s);
|
||||
select xyz('1:1:1.010101');
|
||||
drop function xyz;
|
||||
|
||||
#
|
||||
# Views
|
||||
#
|
||||
|
||||
create view v1 as select * from t1 group by a,b;
|
||||
select * from v1;
|
||||
show columns from v1;
|
||||
create table t2 select * from v1;
|
||||
show create table t2;
|
||||
select * from t2;
|
||||
|
||||
drop view v1;
|
||||
drop table t1, t2;
|
||||
|
@ -1,4 +1,20 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; version 2
|
||||
# of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
package My::ConfigFactory;
|
||||
|
||||
use strict;
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2004-2006 MySQL AB
|
||||
# Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,4 +1,19 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
package My::File::Path;
|
||||
use strict;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2004-2006 MySQL AB
|
||||
# Copyright (c) 2004, 2011, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -28,8 +28,6 @@ use My::Platform;
|
||||
use base qw(Exporter);
|
||||
our @EXPORT= qw(my_find_bin my_find_dir my_find_file NOT_REQUIRED);
|
||||
|
||||
our $vs_config_dir;
|
||||
|
||||
my $bin_extension= ".exe" if IS_WINDOWS;
|
||||
|
||||
# Helper function to be used for fourth parameter to find functions
|
||||
@ -158,7 +156,7 @@ sub my_find_paths {
|
||||
# User can select to look in a special build dir
|
||||
# which is a subdirectory of any of the paths
|
||||
my @extra_dirs;
|
||||
my $build_dir= $vs_config_dir || $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR};
|
||||
my $build_dir= $::opt_vs_config || $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR};
|
||||
push(@extra_dirs, $build_dir) if defined $build_dir;
|
||||
|
||||
if (defined $extension){
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2004-2006 MySQL AB
|
||||
# Copyright (C) 2008 MySQL AB
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2004-2006 MySQL AB
|
||||
# Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,14 +1,16 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2004-2006 MySQL AB
|
||||
# Copyright (c) 2008, 2010, Oracle and/or its affiliates.
|
||||
# Copyright (c) 2009, 2011 Monty Program Ab
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; version 2
|
||||
# of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
@ -84,17 +86,17 @@ sub is_child {
|
||||
|
||||
my @safe_process_cmd;
|
||||
my $safe_kill;
|
||||
my $bindir;
|
||||
if(defined $ENV{MTR_BINDIR})
|
||||
{
|
||||
# This is an out-of-source build. Build directory
|
||||
# is given in MTR_BINDIR env.variable
|
||||
$bindir = $ENV{MTR_BINDIR}."/mysql-test";
|
||||
}
|
||||
else
|
||||
{
|
||||
$bindir = ".";
|
||||
}
|
||||
my $bindir;
|
||||
if(defined $ENV{MTR_BINDIR})
|
||||
{
|
||||
# This is an out-of-source build. Build directory
|
||||
# is given in MTR_BINDIR env.variable
|
||||
$bindir = $ENV{MTR_BINDIR}."/mysql-test";
|
||||
}
|
||||
else
|
||||
{
|
||||
$bindir = ".";
|
||||
}
|
||||
|
||||
# Find the safe process binary or script
|
||||
sub find_bin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2004-2006 MySQL AB
|
||||
# Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user