Merge
This commit is contained in:
commit
6147201a17
@ -1998,7 +1998,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
{
|
||||
if (!preserve_comments)
|
||||
{
|
||||
// Skip spaces at the beggining of a statement
|
||||
// Skip spaces at the beginning of a statement
|
||||
if (my_isspace(charset_info,inchar) && (out == line) &&
|
||||
buffer.is_empty())
|
||||
continue;
|
||||
@ -2081,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (!*ml_comment && !*in_string &&
|
||||
(end_of_line - pos) >= 10 &&
|
||||
!my_strnncoll(charset_info, (uchar*) pos, 10,
|
||||
(const uchar*) "delimiter ", 10))
|
||||
{
|
||||
// Flush previously accepted characters
|
||||
if (out != line)
|
||||
{
|
||||
buffer.append(line, (uint32) (out - line));
|
||||
out= line;
|
||||
}
|
||||
|
||||
// Flush possible comments in the buffer
|
||||
if (!buffer.is_empty())
|
||||
{
|
||||
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
|
||||
DBUG_RETURN(1);
|
||||
buffer.length(0);
|
||||
}
|
||||
|
||||
/*
|
||||
Delimiter wants the get rest of the given line as argument to
|
||||
allow one to change ';' to ';;' and back
|
||||
*/
|
||||
buffer.append(pos);
|
||||
if (com_delimiter(&buffer, pos) > 0)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
buffer.length(0);
|
||||
break;
|
||||
}
|
||||
else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
|
||||
{
|
||||
// Found a statement. Continue parsing after the delimiter
|
||||
@ -2174,8 +2143,24 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
|
||||
// comment to end of line
|
||||
if (preserve_comments)
|
||||
{
|
||||
bool started_with_nothing= !buffer.length();
|
||||
|
||||
buffer.append(pos);
|
||||
|
||||
/*
|
||||
A single-line comment by itself gets sent immediately so that
|
||||
client commands (delimiter, status, etc) will be interpreted on
|
||||
the next line.
|
||||
*/
|
||||
if (started_with_nothing)
|
||||
{
|
||||
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
|
||||
DBUG_RETURN(1);
|
||||
buffer.length(0);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if (!*in_string && inchar == '/' && *(pos+1) == '*' &&
|
||||
|
@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
|
||||
AC_CANONICAL_SYSTEM
|
||||
# The Docs Makefile.am parses this line!
|
||||
# remember to also change ndb version below and update version.c in ndb
|
||||
AM_INIT_AUTOMAKE(mysql, 5.0.74)
|
||||
AM_INIT_AUTOMAKE(mysql, 5.0.76)
|
||||
AM_CONFIG_HEADER([include/config.h:config.h.in])
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
|
||||
# ndb version
|
||||
NDB_VERSION_MAJOR=5
|
||||
NDB_VERSION_MINOR=0
|
||||
NDB_VERSION_BUILD=74
|
||||
NDB_VERSION_BUILD=76
|
||||
NDB_VERSION_STATUS=""
|
||||
|
||||
# Set all version vars based on $VERSION. How do we do this more elegant ?
|
||||
@ -2728,8 +2728,10 @@ then
|
||||
AC_SUBST(THREAD_LOBJECTS)
|
||||
fi
|
||||
|
||||
if test "$with_server" != "no"
|
||||
if test "$with_server" = "no"
|
||||
then
|
||||
AM_CONDITIONAL([BUILD_INNODB_TOOLS], [false])
|
||||
else
|
||||
server_scripts="mysqld_safe mysql_install_db"
|
||||
sql_server_dirs="strings mysys dbug extra regex"
|
||||
|
||||
|
@ -185,11 +185,36 @@ static const char *get_ha_error_msg(int code)
|
||||
}
|
||||
|
||||
|
||||
#if defined(__WIN__)
|
||||
static my_bool print_win_error_msg(DWORD error, my_bool verbose)
|
||||
{
|
||||
LPTSTR s;
|
||||
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, error, 0, (LPTSTR)&s, 0,
|
||||
NULL))
|
||||
{
|
||||
if (verbose)
|
||||
printf("Win32 error code %d: %s", error, s);
|
||||
else
|
||||
puts(s);
|
||||
LocalFree(s);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int error,code,found;
|
||||
const char *msg;
|
||||
char *unknown_error = 0;
|
||||
#if defined(__WIN__)
|
||||
my_bool skip_win_message= 0;
|
||||
#endif
|
||||
MY_INIT(argv[0]);
|
||||
|
||||
if (get_options(&argc,&argv))
|
||||
@ -286,8 +311,15 @@ int main(int argc,char *argv[])
|
||||
/* Error message still not found, look in handler error codes */
|
||||
if (!(msg=get_ha_error_msg(code)))
|
||||
{
|
||||
fprintf(stderr,"Illegal error code: %d\n",code);
|
||||
error=1;
|
||||
#if defined(__WIN__)
|
||||
if (!(skip_win_message= !print_win_error_msg((DWORD)code, verbose)))
|
||||
{
|
||||
#endif
|
||||
fprintf(stderr,"Illegal error code: %d\n",code);
|
||||
error=1;
|
||||
#if defined(__WIN__)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -298,6 +330,10 @@ int main(int argc,char *argv[])
|
||||
puts(msg);
|
||||
}
|
||||
}
|
||||
#if defined(__WIN__)
|
||||
if (!skip_win_message)
|
||||
print_win_error_msg((DWORD)code, verbose);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,6 +245,15 @@ inline double ulonglong2double(ulonglong value)
|
||||
#define my_off_t2double(A) ulonglong2double(A)
|
||||
#endif /* _WIN64 */
|
||||
|
||||
inline ulonglong double2ulonglong(double d)
|
||||
{
|
||||
double t= d - (double) 0x8000000000000000ULL;
|
||||
|
||||
if (t >= 0)
|
||||
return ((ulonglong) t) + 0x8000000000000000ULL;
|
||||
return (ulonglong) d;
|
||||
}
|
||||
|
||||
#if SIZEOF_OFF_T > 4
|
||||
#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
|
||||
#define tell(A) _telli64(A)
|
||||
|
@ -713,6 +713,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
||||
#define ulonglong2double(A) ((double) (ulonglong) (A))
|
||||
#define my_off_t2double(A) ((double) (my_off_t) (A))
|
||||
#endif
|
||||
#ifndef double2ulonglong
|
||||
#define double2ulonglong(A) ((ulonglong) (double) (A))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef offsetof
|
||||
|
@ -52,7 +52,7 @@ can be released by page reorganize, then it is reorganized */
|
||||
|
||||
#define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32)
|
||||
|
||||
/* When estimating number of different kay values in an index sample
|
||||
/* When estimating number of different key values in an index, sample
|
||||
this many index pages */
|
||||
#define BTR_KEY_VAL_ESTIMATE_N_PAGES 8
|
||||
|
||||
|
@ -162,6 +162,8 @@ btr_search_info_create(
|
||||
|
||||
info->last_search = NULL;
|
||||
info->n_direction = 0;
|
||||
|
||||
info->ref_count = 0;
|
||||
info->root_guess = NULL;
|
||||
|
||||
info->hash_analysis = 0;
|
||||
@ -183,6 +185,31 @@ btr_search_info_create(
|
||||
return(info);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
Returns the value of ref_count. The value is protected by
|
||||
btr_search_latch. */
|
||||
ulint
|
||||
btr_search_info_get_ref_count(
|
||||
/*==========================*/
|
||||
/* out: ref_count value. */
|
||||
btr_search_t* info) /* in: search info. */
|
||||
{
|
||||
ulint ret;
|
||||
|
||||
ut_ad(info);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
rw_lock_s_lock(&btr_search_latch);
|
||||
ret = info->ref_count;
|
||||
rw_lock_s_unlock(&btr_search_latch);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Updates the search info of an index about hash successes. NOTE that info
|
||||
is NOT protected by any semaphore, to save CPU time! Do not assume its fields
|
||||
@ -1019,8 +1046,12 @@ next_rec:
|
||||
ha_remove_all_nodes_to_page(table, folds[i], page);
|
||||
}
|
||||
|
||||
ut_a(index->search_info->ref_count > 0);
|
||||
index->search_info->ref_count--;
|
||||
|
||||
block->is_hashed = FALSE;
|
||||
block->index = NULL;
|
||||
|
||||
cleanup:
|
||||
if (UNIV_UNLIKELY(block->n_pointers)) {
|
||||
/* Corruption */
|
||||
@ -1241,6 +1272,15 @@ btr_search_build_page_hash_index(
|
||||
goto exit_func;
|
||||
}
|
||||
|
||||
/* This counter is decremented every time we drop page
|
||||
hash index entries and is incremented here. Since we can
|
||||
rebuild hash index for a page that is already hashed, we
|
||||
have to take care not to increment the counter in that
|
||||
case. */
|
||||
if (!block->is_hashed) {
|
||||
index->search_info->ref_count++;
|
||||
}
|
||||
|
||||
block->is_hashed = TRUE;
|
||||
block->n_hash_helps = 0;
|
||||
|
||||
|
@ -1556,6 +1556,8 @@ dict_index_remove_from_cache(
|
||||
dict_field_t* field;
|
||||
ulint size;
|
||||
ulint i;
|
||||
ulint retries = 0;
|
||||
btr_search_t* info;
|
||||
|
||||
ut_ad(table && index);
|
||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||
@ -1564,6 +1566,51 @@ dict_index_remove_from_cache(
|
||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
/* We always create search info whether or not adaptive
|
||||
hash index is enabled or not. */
|
||||
info = index->search_info;
|
||||
ut_ad(info);
|
||||
|
||||
/* We are not allowed to free the in-memory index struct
|
||||
dict_index_t until all entries in the adaptive hash index
|
||||
that point to any of the page belonging to his b-tree index
|
||||
are dropped. This is so because dropping of these entries
|
||||
require access to dict_index_t struct. To avoid such scenario
|
||||
We keep a count of number of such pages in the search_info and
|
||||
only free the dict_index_t struct when this count drops to
|
||||
zero. */
|
||||
|
||||
for (;;) {
|
||||
ulint ref_count = btr_search_info_get_ref_count(info);
|
||||
if (ref_count == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Sleep for 10ms before trying again. */
|
||||
os_thread_sleep(10000);
|
||||
++retries;
|
||||
|
||||
if (retries % 500 == 0) {
|
||||
/* No luck after 5 seconds of wait. */
|
||||
fprintf(stderr, "InnoDB: Error: Waited for"
|
||||
" %lu secs for hash index"
|
||||
" ref_count (%lu) to drop"
|
||||
" to 0.\n"
|
||||
"index: \"%s\""
|
||||
" table: \"%s\"\n",
|
||||
retries/100,
|
||||
ref_count,
|
||||
index->name,
|
||||
table->name);
|
||||
}
|
||||
|
||||
/* To avoid a hang here we commit suicide if the
|
||||
ref_count doesn't drop to zero in 600 seconds. */
|
||||
if (retries >= 60000) {
|
||||
ut_error;
|
||||
}
|
||||
}
|
||||
|
||||
ut_ad(UT_LIST_GET_LEN((index->tree)->tree_indexes) == 1);
|
||||
dict_tree_free(index->tree);
|
||||
|
||||
|
@ -40,6 +40,14 @@ btr_search_info_create(
|
||||
/*===================*/
|
||||
/* out, own: search info struct */
|
||||
mem_heap_t* heap); /* in: heap where created */
|
||||
/*********************************************************************
|
||||
Returns the value of ref_count. The value is protected by
|
||||
btr_search_latch. */
|
||||
ulint
|
||||
btr_search_info_get_ref_count(
|
||||
/*==========================*/
|
||||
/* out: ref_count value. */
|
||||
btr_search_t* info); /* in: search info. */
|
||||
/*************************************************************************
|
||||
Updates the search info. */
|
||||
UNIV_INLINE
|
||||
@ -144,6 +152,13 @@ btr_search_validate(void);
|
||||
|
||||
struct btr_search_struct{
|
||||
ulint magic_n; /* magic number */
|
||||
ulint ref_count; /* Number of blocks in this index tree
|
||||
that have search index built
|
||||
i.e. block->index points to this index.
|
||||
Protected by btr_search_latch except
|
||||
when during initialization in
|
||||
btr_search_info_create(). */
|
||||
|
||||
/* The following 4 fields are currently not used: */
|
||||
rec_t* last_search; /* pointer to the lower limit record of the
|
||||
previous search; NULL if not known */
|
||||
@ -154,8 +169,10 @@ struct btr_search_struct{
|
||||
or BTR_SEA_SAME_PAGE */
|
||||
dulint modify_clock; /* value of modify clock at the time
|
||||
last_search was stored */
|
||||
/*----------------------*/
|
||||
/* The following 4 fields are not protected by any latch: */
|
||||
|
||||
/* The following fields are not protected by any latch.
|
||||
Unfortunately, this means that they must be aligned to
|
||||
the machine word, i.e., they cannot be turned into bit-fields. */
|
||||
page_t* root_guess; /* the root page frame when it was last time
|
||||
fetched, or NULL */
|
||||
ulint hash_analysis; /* when this exceeds a certain value, the
|
||||
|
@ -139,11 +139,15 @@ ib_time_t
|
||||
ut_time(void);
|
||||
/*=========*/
|
||||
/**************************************************************
|
||||
Returns system time. */
|
||||
Returns system time.
|
||||
Upon successful completion, the value 0 is returned; otherwise the
|
||||
value -1 is returned and the global variable errno is set to indicate the
|
||||
error. */
|
||||
|
||||
void
|
||||
int
|
||||
ut_usectime(
|
||||
/*========*/
|
||||
/* out: 0 on success, -1 otherwise */
|
||||
ulint* sec, /* out: seconds since the Epoch */
|
||||
ulint* ms); /* out: microseconds since the Epoch+*sec */
|
||||
/**************************************************************
|
||||
|
@ -1372,7 +1372,7 @@ srv_table_reserve_slot_for_mysql(void)
|
||||
|
||||
/*******************************************************************
|
||||
Puts a MySQL OS thread to wait for a lock to be released. If an error
|
||||
occurs during the wait trx->error_state associated with thr is
|
||||
occurs during the wait, then trx->error_state associated with thr is
|
||||
!= DB_SUCCESS when we return. DB_LOCK_WAIT_TIMEOUT and DB_DEADLOCK
|
||||
are possible errors. DB_DEADLOCK is returned if selective deadlock
|
||||
resolution chose this transaction as a victim. */
|
||||
@ -1442,8 +1442,11 @@ srv_suspend_mysql_thread(
|
||||
srv_n_lock_wait_count++;
|
||||
srv_n_lock_wait_current_count++;
|
||||
|
||||
ut_usectime(&sec, &ms);
|
||||
start_time = (ib_longlong)sec * 1000000 + ms;
|
||||
if (ut_usectime(&sec, &ms) == -1) {
|
||||
start_time = -1;
|
||||
} else {
|
||||
start_time = (ib_longlong)sec * 1000000 + ms;
|
||||
}
|
||||
}
|
||||
/* Wake the lock timeout monitor thread, if it is suspended */
|
||||
|
||||
@ -1497,14 +1500,20 @@ srv_suspend_mysql_thread(
|
||||
wait_time = ut_difftime(ut_time(), slot->suspend_time);
|
||||
|
||||
if (thr->lock_state == QUE_THR_LOCK_ROW) {
|
||||
ut_usectime(&sec, &ms);
|
||||
finish_time = (ib_longlong)sec * 1000000 + ms;
|
||||
if (ut_usectime(&sec, &ms) == -1) {
|
||||
finish_time = -1;
|
||||
} else {
|
||||
finish_time = (ib_longlong)sec * 1000000 + ms;
|
||||
}
|
||||
|
||||
diff_time = (ulint) (finish_time - start_time);
|
||||
|
||||
srv_n_lock_wait_current_count--;
|
||||
srv_n_lock_wait_time = srv_n_lock_wait_time + diff_time;
|
||||
if (diff_time > srv_n_lock_max_wait_time) {
|
||||
if (diff_time > srv_n_lock_max_wait_time &&
|
||||
/* only update the variable if we successfully
|
||||
retrieved the start and finish times. See Bug#36819. */
|
||||
start_time != -1 && finish_time != -1) {
|
||||
srv_n_lock_max_wait_time = diff_time;
|
||||
}
|
||||
}
|
||||
|
@ -180,11 +180,11 @@ srv_parse_data_file_paths_and_sizes(
|
||||
str++;
|
||||
}
|
||||
|
||||
if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
|
||||
if (0 == strncmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
|
||||
|
||||
str += (sizeof ":autoextend") - 1;
|
||||
|
||||
if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) {
|
||||
if (0 == strncmp(str, ":max:", (sizeof ":max:") - 1)) {
|
||||
|
||||
str += (sizeof ":max:") - 1;
|
||||
|
||||
@ -288,13 +288,13 @@ srv_parse_data_file_paths_and_sizes(
|
||||
(*data_file_names)[i] = path;
|
||||
(*data_file_sizes)[i] = size;
|
||||
|
||||
if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
|
||||
if (0 == strncmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
|
||||
|
||||
*is_auto_extending = TRUE;
|
||||
|
||||
str += (sizeof ":autoextend") - 1;
|
||||
|
||||
if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) {
|
||||
if (0 == strncmp(str, ":max:", (sizeof ":max:") - 1)) {
|
||||
|
||||
str += (sizeof ":max:") - 1;
|
||||
|
||||
|
@ -123,19 +123,45 @@ ut_time(void)
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
Returns system time. */
|
||||
Returns system time.
|
||||
Upon successful completion, the value 0 is returned; otherwise the
|
||||
value -1 is returned and the global variable errno is set to indicate the
|
||||
error. */
|
||||
|
||||
void
|
||||
int
|
||||
ut_usectime(
|
||||
/*========*/
|
||||
/* out: 0 on success, -1 otherwise */
|
||||
ulint* sec, /* out: seconds since the Epoch */
|
||||
ulint* ms) /* out: microseconds since the Epoch+*sec */
|
||||
{
|
||||
struct timeval tv;
|
||||
int ret;
|
||||
int errno_gettimeofday;
|
||||
int i;
|
||||
|
||||
ut_gettimeofday(&tv, NULL);
|
||||
*sec = (ulint) tv.tv_sec;
|
||||
*ms = (ulint) tv.tv_usec;
|
||||
for (i = 0; i < 10; i++) {
|
||||
|
||||
ret = ut_gettimeofday(&tv, NULL);
|
||||
|
||||
if (ret == -1) {
|
||||
errno_gettimeofday = errno;
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: gettimeofday(): %s\n",
|
||||
strerror(errno_gettimeofday));
|
||||
os_thread_sleep(100000); /* 0.1 sec */
|
||||
errno = errno_gettimeofday;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != -1) {
|
||||
*sec = (ulint) tv.tv_sec;
|
||||
*ms = (ulint) tv.tv_usec;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
|
@ -122,11 +122,11 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b)
|
||||
|
||||
static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
|
||||
{
|
||||
/* ORDER BY word DESC, ndepth DESC */
|
||||
int i= mi_compare_text(cs, (uchar*) (*b)->word+1,(*b)->len-1,
|
||||
(uchar*) (*a)->word+1,(*a)->len-1,0,0);
|
||||
/* ORDER BY word, ndepth */
|
||||
int i= mi_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1,
|
||||
(uchar*) (*b)->word + 1, (*b)->len - 1, 0, 0);
|
||||
if (!i)
|
||||
i=CMP_NUM((*b)->ndepth,(*a)->ndepth);
|
||||
i= CMP_NUM((*a)->ndepth, (*b)->ndepth);
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -674,23 +674,49 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
|
||||
(byte *) end, &word, TRUE))
|
||||
{
|
||||
int a, b, c;
|
||||
/*
|
||||
Find right-most element in the array of query words matching this
|
||||
word from a document.
|
||||
*/
|
||||
for (a=0, b=ftb->queue.elements, c=(a+b)/2; b-a>1; c=(a+b)/2)
|
||||
{
|
||||
ftbw=ftb->list[c];
|
||||
if (mi_compare_text(ftb->charset, (uchar*) word.pos, word.len,
|
||||
(uchar*) ftbw->word+1, ftbw->len-1,
|
||||
(my_bool) (ftbw->flags&FTB_FLAG_TRUNC),0) >0)
|
||||
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
|
||||
b=c;
|
||||
else
|
||||
a=c;
|
||||
}
|
||||
/*
|
||||
If there were no words with truncation operator, we iterate to the
|
||||
beginning of an array until array element is equal to the word from
|
||||
a document. This is done mainly because the same word may be
|
||||
mentioned twice (or more) in the query.
|
||||
|
||||
In case query has words with truncation operator we must iterate
|
||||
to the beginning of the array. There may be non-matching query words
|
||||
between matching word with truncation operator and the right-most
|
||||
matching element. E.g., if we're looking for 'aaa15' in an array of
|
||||
'aaa1* aaa14 aaa15 aaa16'.
|
||||
|
||||
Worse of that there still may be match even if the binary search
|
||||
above didn't find matching element. E.g., if we're looking for
|
||||
'aaa15' in an array of 'aaa1* aaa14 aaa16'. The binary search will
|
||||
stop at 'aaa16'.
|
||||
*/
|
||||
for (; c>=0; c--)
|
||||
{
|
||||
ftbw=ftb->list[c];
|
||||
if (mi_compare_text(ftb->charset, (uchar*) word.pos, word.len,
|
||||
(uchar*) ftbw->word+1,ftbw->len-1,
|
||||
(my_bool) (ftbw->flags&FTB_FLAG_TRUNC),0))
|
||||
break;
|
||||
{
|
||||
if (ftb->with_scan & FTB_FLAG_TRUNC)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (ftbw->docid[1] == docid)
|
||||
continue;
|
||||
ftbw->docid[1]=docid;
|
||||
|
@ -11,12 +11,12 @@
|
||||
#
|
||||
# Dump all global variables
|
||||
#
|
||||
show global variables;
|
||||
SHOW GLOBAL VARIABLES WHERE variable_name != 'timestamp';
|
||||
|
||||
#
|
||||
# Dump all databases
|
||||
#
|
||||
show databases;
|
||||
SHOW DATABASES;
|
||||
|
||||
#
|
||||
# Dump the "test" database, all it's tables and their data
|
||||
@ -29,23 +29,23 @@ show databases;
|
||||
#
|
||||
--exec $MYSQL_DUMP --skip-comments --no-data mysql
|
||||
use mysql;
|
||||
select * from columns_priv;
|
||||
select * from db order by host, db, user;
|
||||
select * from func;
|
||||
select * from help_category;
|
||||
select * from help_keyword;
|
||||
select * from help_relation;
|
||||
select * from help_relation;
|
||||
select * from host;
|
||||
select * from proc;
|
||||
select * from procs_priv;
|
||||
select * from tables_priv;
|
||||
select * from time_zone;
|
||||
select * from time_zone_leap_second;
|
||||
select * from time_zone_name;
|
||||
select * from time_zone_transition;
|
||||
select * from time_zone_transition_type;
|
||||
select * from user;
|
||||
SELECT * FROM columns_priv;
|
||||
SELECT * FROM db ORDER BY host, db, user;
|
||||
SELECT * FROM func;
|
||||
SELECT * FROM help_category;
|
||||
SELECT * FROM help_keyword;
|
||||
SELECT * FROM help_relation;
|
||||
SELECT * FROM help_relation;
|
||||
SELECT * FROM host;
|
||||
SELECT * FROM proc;
|
||||
SELECT * FROM procs_priv;
|
||||
SELECT * FROM tables_priv;
|
||||
SELECT * FROM time_zone;
|
||||
SELECT * FROM time_zone_leap_second;
|
||||
SELECT * FROM time_zone_name;
|
||||
SELECT * FROM time_zone_transition;
|
||||
SELECT * FROM time_zone_transition_type;
|
||||
SELECT * FROM user;
|
||||
|
||||
|
||||
|
||||
|
@ -2380,13 +2380,7 @@ sub setup_vardir() {
|
||||
{
|
||||
# on windows, copy all files from std_data into var/std_data_ln
|
||||
mkpath("$opt_vardir/std_data_ln");
|
||||
opendir(DIR, "$glob_mysql_test_dir/std_data")
|
||||
or mtr_error("Can't find the std_data directory: $!");
|
||||
for(readdir(DIR)) {
|
||||
next if -d "$glob_mysql_test_dir/std_data/$_";
|
||||
copy("$glob_mysql_test_dir/std_data/$_", "$opt_vardir/std_data_ln/$_");
|
||||
}
|
||||
closedir(DIR);
|
||||
mtr_copy_dir("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
|
||||
}
|
||||
|
||||
# Remove old log files
|
||||
|
@ -915,3 +915,19 @@ check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a tinytext character set latin1);
|
||||
alter table t1 convert to character set utf8;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` text
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
drop table t1;
|
||||
create table t1 (a mediumtext character set latin1);
|
||||
alter table t1 convert to character set utf8;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
drop table t1;
|
||||
|
@ -21,6 +21,7 @@ flush logs;
|
||||
*** must be a warning master-bin.000001 was not found ***
|
||||
Warnings:
|
||||
Warning 1477 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
|
||||
Warning 1477 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
|
||||
*** must show one record, of the active binlog, left in the index file after PURGE ***
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
|
@ -5071,4 +5071,19 @@ select * from t1;
|
||||
a
|
||||
foo
|
||||
drop table t1;
|
||||
create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv;
|
||||
select * from bug39616_1;
|
||||
id d
|
||||
1 integer sans quotes
|
||||
1 string sans quotes
|
||||
1 string end quotes"
|
||||
1 quotes"in between" strings
|
||||
1 Integer with quote and string with no quote
|
||||
1 escape sequence
|
||||
" \
\a within quotes
|
||||
drop table bug39616_1;
|
||||
create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv;
|
||||
select * from bug39616_1;
|
||||
id d
|
||||
drop table bug39616_1;
|
||||
End of 5.0 tests
|
||||
|
11
mysql-test/r/ctype_filesystem.result
Normal file
11
mysql-test/r/ctype_filesystem.result
Normal file
@ -0,0 +1,11 @@
|
||||
SET CHARACTER SET utf8;
|
||||
SHOW VARIABLES like 'character_sets_dir';
|
||||
Variable_name Value
|
||||
character_sets_dir MYSQL_TEST_DIR/ß/
|
||||
SHOW VARIABLES like 'character_set_filesystem';
|
||||
Variable_name Value
|
||||
character_set_filesystem latin1
|
||||
SHOW VARIABLES like 'character_set_client';
|
||||
Variable_name Value
|
||||
character_set_client utf8
|
||||
SET CHARACTER SET default;
|
@ -1813,3 +1813,35 @@ select hex(_utf8 B'001111111111');
|
||||
ERROR HY000: Invalid utf8 character string: 'FF'
|
||||
select (_utf8 X'616263FF');
|
||||
ERROR HY000: Invalid utf8 character string: 'FF'
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
|
||||
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
|
||||
CONVERT(a, CHAR) CONVERT(b, CHAR)
|
||||
70002 1065
|
||||
70001 1085
|
||||
70000 1092
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
|
||||
CONVERT(a, CHAR) CONVERT(b, CHAR)
|
||||
70000 1092
|
||||
70001 1085
|
||||
70002 1065
|
||||
ALTER TABLE t1 ADD UNIQUE (b);
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
|
||||
CONVERT(a, CHAR) CONVERT(b, CHAR)
|
||||
70002 1065
|
||||
70001 1085
|
||||
70000 1092
|
||||
DROP INDEX b ON t1;
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
|
||||
CONVERT(a, CHAR) CONVERT(b, CHAR)
|
||||
70002 1065
|
||||
70001 1085
|
||||
70000 1092
|
||||
ALTER TABLE t1 ADD INDEX (b);
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
|
||||
CONVERT(a, CHAR) CONVERT(b, CHAR)
|
||||
70002 1065
|
||||
70001 1085
|
||||
70000 1092
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -107,3 +107,51 @@ X X X X X X X X X
|
||||
X X X X X X X X X Range checked for each record (index map: 0xFFFFFFFFFF)
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
execute s1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -469,3 +469,40 @@ SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
|
||||
a
|
||||
aaaaa aaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b));
|
||||
INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
|
||||
('test', 1),('test', 2),('test', 3),('test', 4);
|
||||
EXPLAIN SELECT * FROM t1
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 fulltext b,a a 0 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 USE INDEX(a)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 fulltext a a 0 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 fulltext a a 0 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref b b 5 const 4 Using where
|
||||
EXPLAIN SELECT * FROM t1 USE INDEX(b)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref b b 5 const 4 Using where
|
||||
EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref b b 5 const 4 Using where
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a CHAR(10));
|
||||
INSERT INTO t1 VALUES('aaa15');
|
||||
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
|
||||
MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE)
|
||||
1
|
||||
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
|
||||
MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
|
||||
2
|
||||
DROP TABLE t1;
|
||||
|
@ -1425,4 +1425,27 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
|
||||
AVG(a) CAST(AVG(a) AS DECIMAL)
|
||||
15 15
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
|
||||
SET SQL_MODE='ONLY_FULL_GROUP_BY';
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
3
|
||||
SELECT COUNT(*) FROM t1 where a=1;
|
||||
COUNT(*)
|
||||
3
|
||||
SELECT COUNT(*),a FROM t1;
|
||||
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
|
||||
COUNT(*)
|
||||
9
|
||||
SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
|
||||
FROM t1 outr;
|
||||
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
SELECT COUNT(*) FROM t1 a JOIN t1 outr
|
||||
ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
|
||||
COUNT(*)
|
||||
0
|
||||
SET SQL_MODE=default;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -176,4 +176,13 @@ IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((R
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c LONGTEXT);
|
||||
INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890');
|
||||
SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
MAX(IF(1, CAST(c AS UNSIGNED), 0))
|
||||
12345678901234567890
|
||||
SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
MAX(IFNULL(CAST(c AS UNSIGNED), 0))
|
||||
12345678901234567890
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -256,3 +256,15 @@ a
|
||||
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
|
||||
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f")
|
||||
2003-01-02 10:11:12.001200
|
||||
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
|
||||
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') time('00:00:00')
|
||||
-24:00:00 00:00:00
|
||||
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
|
||||
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00')
|
||||
0
|
||||
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
|
||||
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00')
|
||||
1
|
||||
SELECT CAST(time('-73:42:12') AS DECIMAL);
|
||||
CAST(time('-73:42:12') AS DECIMAL)
|
||||
-734212
|
||||
|
@ -717,8 +717,6 @@ insert(_latin2'abcd',2,3,_latin2'ef'),
|
||||
replace(_latin2'abcd',_latin2'b',_latin2'B'),
|
||||
encode('abcd','ab')
|
||||
;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'format(130,10)' at row 1
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@ -727,7 +725,7 @@ t1 CREATE TABLE `t1` (
|
||||
`conv(130,16,10)` varchar(64) default NULL,
|
||||
`hex(130)` varchar(6) NOT NULL default '',
|
||||
`char(130)` varbinary(4) NOT NULL default '',
|
||||
`format(130,10)` varchar(4) NOT NULL default '',
|
||||
`format(130,10)` varchar(16) NOT NULL default '',
|
||||
`left(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
|
||||
`right(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
|
||||
`lcase(_latin2'a')` varchar(1) character set latin2 NOT NULL default '',
|
||||
@ -2175,4 +2173,12 @@ SELECT HEX(c1) from v1;
|
||||
HEX(c1)
|
||||
414243
|
||||
DROP VIEW v1;
|
||||
create table t1(a float);
|
||||
insert into t1 values (1.33);
|
||||
select format(a, 2) from t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def format(a, 2) 253 20 4 Y 0 2 8
|
||||
format(a, 2)
|
||||
1.33
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -1261,4 +1261,10 @@ a b c
|
||||
5 1 1
|
||||
4 1 1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
|
||||
CREATE INDEX i1 on t1 (a(3));
|
||||
SELECT * FROM t1 WHERE a = 'abcde';
|
||||
a
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -378,29 +378,6 @@ where 0=1;
|
||||
delete t1, t2 from t2,t1
|
||||
where t1.id1=t2.id2 and 0=1;
|
||||
drop table t1,t2;
|
||||
create table t1 ( a int not null, b int not null) ;
|
||||
alter table t1 add index i1(a);
|
||||
delete from t1 where a > 2000000;
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
select 't2 rows before small delete', count(*) from t1;
|
||||
t2 rows before small delete count(*)
|
||||
t2 rows before small delete 2000000
|
||||
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
|
||||
select 't2 rows after small delete', count(*) from t2;
|
||||
t2 rows after small delete count(*)
|
||||
t2 rows after small delete 1999999
|
||||
select 't1 rows after small delete', count(*) from t1;
|
||||
t1 rows after small delete count(*)
|
||||
t1 rows after small delete 1999999
|
||||
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
|
||||
select 't2 rows after big delete', count(*) from t2;
|
||||
t2 rows after big delete count(*)
|
||||
t2 rows after big delete 1900001
|
||||
select 't1 rows after big delete', count(*) from t1;
|
||||
t1 rows after big delete count(*)
|
||||
t1 rows after big delete 1900001
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 ( a int );
|
||||
CREATE TABLE t2 ( a int );
|
||||
DELETE t1 FROM t1, t2 AS t3;
|
||||
|
25
mysql-test/r/multi_update2.result
Normal file
25
mysql-test/r/multi_update2.result
Normal file
@ -0,0 +1,25 @@
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
|
||||
# The protocolling of many inserts into t1 is suppressed.
|
||||
ALTER TABLE t1 ADD INDEX i1(a);
|
||||
DELETE FROM t1 WHERE a > 2000000;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
SELECT 't2 rows before small delete', COUNT(*) FROM t1;
|
||||
t2 rows before small delete COUNT(*)
|
||||
t2 rows before small delete 2000000
|
||||
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
|
||||
SELECT 't2 rows after small delete', COUNT(*) FROM t2;
|
||||
t2 rows after small delete COUNT(*)
|
||||
t2 rows after small delete 1999999
|
||||
SELECT 't1 rows after small delete', COUNT(*) FROM t1;
|
||||
t1 rows after small delete COUNT(*)
|
||||
t1 rows after small delete 1999999
|
||||
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
|
||||
SELECT 't2 rows after big delete', COUNT(*) FROM t2;
|
||||
t2 rows after big delete COUNT(*)
|
||||
t2 rows after big delete 1900001
|
||||
SELECT 't1 rows after big delete', COUNT(*) FROM t1;
|
||||
t1 rows after big delete COUNT(*)
|
||||
t1 rows after big delete 1900001
|
||||
DROP TABLE t1,t2;
|
@ -180,4 +180,10 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
|
||||
1
|
||||
This is a file starting with UTF8 BOM 0xEFBBBF
|
||||
This is a file starting with UTF8 BOM 0xEFBBBF
|
||||
delimiter
|
||||
1
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
End of 5.0 tests
|
||||
|
6
mysql-test/r/perror-win.result
Normal file
6
mysql-test/r/perror-win.result
Normal file
@ -0,0 +1,6 @@
|
||||
MySQL error code 150: Foreign key constraint is incorrectly formed
|
||||
Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
|
||||
OS error code 23: Too many open files in system
|
||||
Win32 error code 23: Data error (cyclic redundancy check).
|
||||
Win32 error code 1062: The service has not been started.
|
||||
Illegal error code: 30000
|
@ -23,39 +23,9 @@ SET @@global.max_allowed_packet=4096;
|
||||
SET @@global.net_buffer_length=4096;
|
||||
STOP SLAVE;
|
||||
START SLAVE;
|
||||
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
|
||||
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
|
||||
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
|
||||
show slave status;
|
||||
Slave_IO_State #
|
||||
Master_Host 127.0.0.1
|
||||
Master_User root
|
||||
Master_Port MASTER_MYPORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos 2138
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
Slave_IO_Running No
|
||||
Slave_SQL_Running #
|
||||
Replicate_Do_DB
|
||||
Replicate_Ignore_DB
|
||||
Replicate_Do_Table
|
||||
Replicate_Ignore_Table
|
||||
Replicate_Wild_Do_Table
|
||||
Replicate_Wild_Ignore_Table
|
||||
Last_Errno 0
|
||||
Last_Error
|
||||
Skip_Counter 0
|
||||
Exec_Master_Log_Pos 2138
|
||||
Relay_Log_Space #
|
||||
Until_Condition None
|
||||
Until_Log_File
|
||||
Until_Log_Pos 0
|
||||
Master_SSL_Allowed No
|
||||
Master_SSL_CA_File
|
||||
Master_SSL_CA_Path
|
||||
Master_SSL_Cert
|
||||
Master_SSL_Cipher
|
||||
Master_SSL_Key
|
||||
Seconds_Behind_Master #
|
||||
Slave_IO_Running = No (expect No)
|
||||
==== clean up ====
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -4407,4 +4407,49 @@ pk a
|
||||
3 30
|
||||
2 20
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (s1 char(1));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
|
||||
s1
|
||||
a
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(id BIGINT);
|
||||
CREATE TABLE t2(id1 BIGINT, id2 BIGINT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t2 VALUES (2,1),(3,1);
|
||||
SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1);
|
||||
id
|
||||
2
|
||||
3
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (id int);
|
||||
CREATE TABLE t2 (id int, c int);
|
||||
INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t2 (id) VALUES (1);
|
||||
INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t2 (id) VALUES (1);
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
UPDATE v1 SET c=1;
|
||||
CREATE VIEW v2 (a,b) AS
|
||||
SELECT t2.id, t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
INSERT INTO v2(a,b) VALUES (2,2);
|
||||
ERROR HY000: CHECK OPTION failed 'test.v2'
|
||||
INSERT INTO v2(a,b) VALUES (1,2);
|
||||
SELECT * FROM v1;
|
||||
c
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
CREATE VIEW v3 AS
|
||||
SELECT t2.c AS c FROM t2
|
||||
WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
DELETE FROM v3;
|
||||
DROP VIEW v1,v2,v3;
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests.
|
||||
|
@ -110,7 +110,7 @@ i ts
|
||||
362793610 1981-07-01 04:00:00
|
||||
select from_unixtime(362793609);
|
||||
from_unixtime(362793609)
|
||||
1981-07-01 03:59:60
|
||||
1981-07-01 03:59:59
|
||||
drop table t1;
|
||||
create table t1 (ts timestamp);
|
||||
set time_zone='UTC';
|
||||
|
@ -17,6 +17,9 @@ insert into t1 values
|
||||
insert into t1 values
|
||||
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
|
||||
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
|
||||
insert into t1 values
|
||||
(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
|
||||
(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
|
||||
select i, from_unixtime(i), c from t1;
|
||||
i from_unixtime(i) c
|
||||
1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
|
||||
@ -31,6 +34,8 @@ i from_unixtime(i) c
|
||||
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
|
||||
362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
|
||||
362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
|
||||
1230768022 2009-01-01 02:59:59 2009-01-01 02:59:59
|
||||
1230768024 2009-01-01 03:00:00 2009-01-01 03:00:00
|
||||
drop table t1;
|
||||
create table t1 (ts timestamp);
|
||||
insert into t1 values (19730101235900), (20040101235900);
|
||||
@ -39,3 +44,6 @@ ts
|
||||
1973-01-01 23:59:00
|
||||
2004-01-01 23:59:00
|
||||
drop table t1;
|
||||
SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
|
||||
FROM_UNIXTIME(1230768022) FROM_UNIXTIME(1230768023) FROM_UNIXTIME(1230768024)
|
||||
2009-01-01 02:59:59 2009-01-01 02:59:59 2009-01-01 03:00:00
|
||||
|
@ -708,4 +708,45 @@ HEX(b1) HEX(b2) i2
|
||||
1 0 100
|
||||
1 0 200
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE IF NOT EXISTS t1 (
|
||||
f1 bit(2) NOT NULL default b'10',
|
||||
f2 bit(14) NOT NULL default b'11110000111100'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` bit(2) NOT NULL default b'10',
|
||||
`f2` bit(14) NOT NULL default b'11110000111100'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE IF NOT EXISTS t1 (
|
||||
f1 bit(2) NOT NULL default b''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
ERROR 42000: Invalid default value for 'f1'
|
||||
create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
|
||||
create table t2bit7 (b1 bit(7)) engine=MyISAM;
|
||||
insert into t1bit7 values (b'1100000');
|
||||
insert into t1bit7 values (b'1100001');
|
||||
insert into t1bit7 values (b'1100010');
|
||||
insert into t2bit7 values (b'1100001');
|
||||
insert into t2bit7 values (b'1100010');
|
||||
insert into t2bit7 values (b'1100110');
|
||||
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
|
||||
bin(a1)
|
||||
1100001
|
||||
1100010
|
||||
drop table t1bit7, t2bit7;
|
||||
create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
|
||||
create table t2bit7 (b1 bit(15)) engine=MyISAM;
|
||||
insert into t1bit7 values (b'110000011111111');
|
||||
insert into t1bit7 values (b'110000111111111');
|
||||
insert into t1bit7 values (b'110001011111111');
|
||||
insert into t2bit7 values (b'110000111111111');
|
||||
insert into t2bit7 values (b'110001011111111');
|
||||
insert into t2bit7 values (b'110011011111111');
|
||||
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
|
||||
bin(a1)
|
||||
110000111111111
|
||||
110001011111111
|
||||
drop table t1bit7, t2bit7;
|
||||
End of 5.0 tests
|
||||
|
@ -392,4 +392,13 @@ f1 + 0e0
|
||||
1.0000000150475e+30
|
||||
-1.0000000150475e+30
|
||||
drop table t1;
|
||||
create table t1(d double, u bigint unsigned);
|
||||
insert into t1(d) values (9.22337203685479e18),
|
||||
(1.84e19);
|
||||
update t1 set u = d;
|
||||
select u from t1;
|
||||
u
|
||||
9223372036854790144
|
||||
18400000000000000000
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -1524,4 +1524,19 @@ select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
|
||||
(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
|
||||
1.01500000 * 1.01500000 * 0.99500000)
|
||||
0.812988073953673124592306939480
|
||||
create table t1 as select 5.05 / 0.014;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column '5.05 / 0.014' at row 1
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1265 Data truncated for column '5.05 / 0.014' at row 1
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`5.05 / 0.014` decimal(10,6) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t1;
|
||||
5.05 / 0.014
|
||||
360.714286
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -625,7 +625,7 @@ drop table t1;
|
||||
create table t1 (a int, b int);
|
||||
create view v1 as select a, sum(b) from t1 group by a;
|
||||
select b from v1 use index (some_index) where b=1;
|
||||
ERROR HY000: Incorrect usage of USE INDEX and VIEW
|
||||
ERROR HY000: Key 'some_index' doesn't exist in table 'v1'
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1 (col1 char(5),col2 char(5));
|
||||
@ -3567,11 +3567,11 @@ CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM v1 USE KEY(non_existant);
|
||||
ERROR HY000: Incorrect usage of USE INDEX and VIEW
|
||||
ERROR HY000: Key 'non_existant' doesn't exist in table 'v1'
|
||||
SELECT * FROM v1 FORCE KEY(non_existant);
|
||||
ERROR HY000: Incorrect usage of FORCE INDEX and VIEW
|
||||
ERROR HY000: Key 'non_existant' doesn't exist in table 'v1'
|
||||
SELECT * FROM v1 IGNORE KEY(non_existant);
|
||||
ERROR HY000: Incorrect usage of IGNORE INDEX and VIEW
|
||||
ERROR HY000: Key 'non_existant' doesn't exist in table 'v1'
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
|
||||
@ -3679,6 +3679,31 @@ DROP VIEW v1;
|
||||
|
||||
CREATE VIEW v1 AS SELECT 1;
|
||||
DROP VIEW v1;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
|
||||
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
|
||||
SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
|
||||
c1 c2
|
||||
2 2
|
||||
SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
|
||||
c1 c2
|
||||
2 2
|
||||
CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
|
||||
SHOW INDEX FROM v1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
|
||||
ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
|
||||
SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
|
||||
ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
|
||||
SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
|
||||
ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
|
||||
SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
|
||||
ERROR HY000: Key 'c2' doesn't exist in table 'v1'
|
||||
SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
|
||||
ERROR HY000: Key 'c2' doesn't exist in table 'v1'
|
||||
SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
|
||||
ERROR HY000: Key 'c2' doesn't exist in table 'v1'
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.0 tests.
|
||||
# -----------------------------------------------------------------
|
||||
|
Binary file not shown.
@ -696,3 +696,16 @@ unlock tables;
|
||||
select * from t1;
|
||||
check table t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
|
||||
#
|
||||
create table t1 (a tinytext character set latin1);
|
||||
alter table t1 convert to character set utf8;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
create table t1 (a mediumtext character set latin1);
|
||||
alter table t1 convert to character set utf8;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
@ -1460,4 +1460,47 @@ insert into t1 values();
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #39616 Missing quotes from .CSV crashes server
|
||||
#
|
||||
# Editing the .CSV file and leaving out quotes from around an integer field
|
||||
# crashes the server.
|
||||
#
|
||||
|
||||
#
|
||||
# Test for the integers and strings enclosed in quotes, not enclosed in quotes,
|
||||
# \X characters.
|
||||
#
|
||||
create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv;
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV
|
||||
--write_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV
|
||||
1,"integer sans quotes"
|
||||
1,string sans quotes
|
||||
1,string end quotes"
|
||||
1,quotes"in between" strings
|
||||
"1",Integer with quote and string with no quote
|
||||
1,"escape sequence \n \" \\ \r \a within quotes"
|
||||
EOF
|
||||
|
||||
select * from bug39616_1;
|
||||
|
||||
drop table bug39616_1;
|
||||
|
||||
#
|
||||
# Test for he case when a field begins with a quote, but does not end in a
|
||||
# quote.
|
||||
# Note: This results in an empty set.
|
||||
#
|
||||
create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv;
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV
|
||||
--write_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV
|
||||
1,"string only at the beginning quotes
|
||||
EOF
|
||||
|
||||
select * from bug39616_1;
|
||||
|
||||
drop table bug39616_1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
2
mysql-test/t/ctype_filesystem-master.opt
Normal file
2
mysql-test/t/ctype_filesystem-master.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--character-sets-dir=$MYSQL_TEST_DIR/ß
|
||||
--character-set-filesystem=latin1
|
6
mysql-test/t/ctype_filesystem.test
Normal file
6
mysql-test/t/ctype_filesystem.test
Normal file
@ -0,0 +1,6 @@
|
||||
SET CHARACTER SET utf8;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
SHOW VARIABLES like 'character_sets_dir';
|
||||
SHOW VARIABLES like 'character_set_filesystem';
|
||||
SHOW VARIABLES like 'character_set_client';
|
||||
SET CHARACTER SET default;
|
@ -1437,3 +1437,20 @@ select hex(_utf8 X'616263FF');
|
||||
select hex(_utf8 B'001111111111');
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
select (_utf8 X'616263FF');
|
||||
|
||||
#
|
||||
# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
|
||||
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
|
||||
ALTER TABLE t1 ADD UNIQUE (b);
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
|
||||
DROP INDEX b ON t1;
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
|
||||
ALTER TABLE t1 ADD INDEX (b);
|
||||
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -94,4 +94,33 @@ EXPLAIN SELECT 1 FROM
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #34773: query with explain extended and derived table / other table
|
||||
# crashes server
|
||||
#
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
execute s1;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
# End of 5.0 tests.
|
||||
|
@ -396,3 +396,39 @@ SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# BUG#38842 - Fix for 25951 seems incorrect
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b));
|
||||
INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
|
||||
('test', 1),('test', 2),('test', 3),('test', 4);
|
||||
|
||||
EXPLAIN SELECT * FROM t1
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 USE INDEX(a)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 USE INDEX(b)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
|
||||
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# BUG#37245 - Full text search problem
|
||||
#
|
||||
CREATE TABLE t1(a CHAR(10));
|
||||
INSERT INTO t1 VALUES('aaa15');
|
||||
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
|
||||
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -926,5 +926,34 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #39656: Behaviour different for agg functions with & without where -
|
||||
# ONLY_FULL_GROUP_BY
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
|
||||
|
||||
SET SQL_MODE='ONLY_FULL_GROUP_BY';
|
||||
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t1 where a=1;
|
||||
|
||||
--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
|
||||
SELECT COUNT(*),a FROM t1;
|
||||
|
||||
SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
|
||||
|
||||
--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
|
||||
SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
|
||||
FROM t1 outr;
|
||||
|
||||
SELECT COUNT(*) FROM t1 a JOIN t1 outr
|
||||
ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
|
||||
|
||||
SET SQL_MODE=default;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
###
|
||||
--echo End of 5.0 tests
|
||||
|
@ -150,4 +150,18 @@ FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed)
|
||||
# (was: LEFT JOIN on inline view crashes server)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c LONGTEXT);
|
||||
INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890');
|
||||
|
||||
SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -135,3 +135,20 @@ select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
|
||||
--enable_ps_protocol
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bug#37553: MySql Error Compare TimeDiff & Time
|
||||
#
|
||||
|
||||
# calculations involving negative time values ignored sign
|
||||
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
|
||||
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
|
||||
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
|
||||
|
||||
# show that conversion to DECIMAL no longer drops sign
|
||||
SELECT CAST(time('-73:42:12') AS DECIMAL);
|
||||
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -1149,4 +1149,14 @@ CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1;
|
||||
SELECT HEX(c1) from v1;
|
||||
DROP VIEW v1;
|
||||
|
||||
#
|
||||
# Bug #35558 Wrong server metadata blows up the client
|
||||
#
|
||||
create table t1(a float);
|
||||
insert into t1 values (1.33);
|
||||
--enable_metadata
|
||||
select format(a, 2) from t1;
|
||||
--disable_metadata
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -1014,4 +1014,15 @@ SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#37284 Crash in Field_string::type()
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
|
||||
CREATE INDEX i1 on t1 (a(3));
|
||||
SELECT * FROM t1 WHERE a = 'abcde';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -9,9 +9,9 @@
|
||||
drop table if exists t1,t2,t3;
|
||||
drop database if exists mysqltest;
|
||||
drop view if exists v1;
|
||||
--error 0,1141,1147
|
||||
--error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT
|
||||
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
|
||||
--error 0,1141,1147
|
||||
--error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
delete from mysql.user where user=_binary'mysqltest_1';
|
||||
--enable_warnings
|
||||
@ -159,9 +159,9 @@ create table t2 (n int(10) not null primary key, d int(10));
|
||||
insert into t1 values(1,1);
|
||||
insert into t2 values(1,10),(2,20);
|
||||
LOCK TABLES t1 write, t2 read;
|
||||
--error 1099
|
||||
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
|
||||
DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
|
||||
--error 1099
|
||||
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
|
||||
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
|
||||
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
|
||||
unlock tables;
|
||||
@ -182,7 +182,7 @@ create table t1 (n int(10), d int(10));
|
||||
create table t2 (n int(10), d int(10));
|
||||
insert into t1 values(1,1);
|
||||
insert into t2 values(1,10),(2,20);
|
||||
--error 1175
|
||||
--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
|
||||
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
|
||||
set sql_safe_updates=0;
|
||||
drop table t1,t2;
|
||||
@ -195,7 +195,7 @@ set timestamp=1038000000;
|
||||
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
|
||||
select n,d,unix_timestamp(t) from t1;
|
||||
select n,d,unix_timestamp(t) from t2;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n;
|
||||
drop table t1,t2;
|
||||
set timestamp=0;
|
||||
@ -322,41 +322,6 @@ delete t1, t2 from t2,t1
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test for bug #1820.
|
||||
#
|
||||
|
||||
create table t1 ( a int not null, b int not null) ;
|
||||
--disable_query_log
|
||||
insert into t1 values (1,1),(2,2),(3,3),(4,4);
|
||||
let $1=19;
|
||||
set @d=4;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 select a+@d,b+@d from t1;
|
||||
eval set @d=@d*2;
|
||||
dec $1;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
alter table t1 add index i1(a);
|
||||
delete from t1 where a > 2000000;
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
|
||||
select 't2 rows before small delete', count(*) from t1;
|
||||
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
|
||||
select 't2 rows after small delete', count(*) from t2;
|
||||
select 't1 rows after small delete', count(*) from t1;
|
||||
|
||||
## Try deleting many rows
|
||||
|
||||
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
|
||||
select 't2 rows after big delete', count(*) from t2;
|
||||
select 't1 rows after big delete', count(*) from t1;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test alias (this is not correct in 4.0)
|
||||
#
|
||||
@ -366,7 +331,7 @@ CREATE TABLE t2 ( a int );
|
||||
DELETE t1 FROM t1, t2 AS t3;
|
||||
DELETE t4 FROM t1, t1 AS t4;
|
||||
DELETE t3 FROM t1 AS t3, t1 AS t4;
|
||||
--error 1109
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE t1 FROM t1 AS t3, t2 AS t4;
|
||||
INSERT INTO t1 values (1),(2);
|
||||
INSERT INTO t2 values (1),(2);
|
||||
@ -421,7 +386,7 @@ drop database mysqltest;
|
||||
create table t1 (a int, primary key (a));
|
||||
create table t2 (a int, primary key (a));
|
||||
create table t3 (a int, primary key (a));
|
||||
-- error 1109
|
||||
-- error ER_UNKNOWN_TABLE
|
||||
delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
|
||||
drop table t1, t2, t3;
|
||||
|
||||
@ -430,9 +395,9 @@ drop table t1, t2, t3;
|
||||
#
|
||||
create table t1 (col1 int);
|
||||
create table t2 (col1 int);
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
|
||||
drop table t1,t2;
|
||||
|
||||
@ -457,7 +422,7 @@ drop table t1, t2;
|
||||
#
|
||||
create table t1(a int);
|
||||
create table t2(a int);
|
||||
--error 1093
|
||||
--error ER_UPDATE_TABLE_USED
|
||||
delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
|
||||
drop table t1, t2;
|
||||
# End of 4.1 tests
|
||||
|
1
mysql-test/t/multi_update2-master.opt
Normal file
1
mysql-test/t/multi_update2-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--set-variable=tmp_table_size=1024
|
43
mysql-test/t/multi_update2.test
Normal file
43
mysql-test/t/multi_update2.test
Normal file
@ -0,0 +1,43 @@
|
||||
#
|
||||
# Test of update statement that uses many tables.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#1820 Rows not deleted from second table on multi-table delete
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
|
||||
--echo # The protocolling of many inserts into t1 is suppressed.
|
||||
--disable_query_log
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
|
||||
let $1=19;
|
||||
set @d=4;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
|
||||
eval SET @d=@d*2;
|
||||
dec $1;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
ALTER TABLE t1 ADD INDEX i1(a);
|
||||
DELETE FROM t1 WHERE a > 2000000;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
|
||||
SELECT 't2 rows before small delete', COUNT(*) FROM t1;
|
||||
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
|
||||
SELECT 't2 rows after small delete', COUNT(*) FROM t2;
|
||||
SELECT 't1 rows after small delete', COUNT(*) FROM t1;
|
||||
|
||||
## Try deleting many rows
|
||||
|
||||
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
|
||||
SELECT 't2 rows after big delete', COUNT(*) FROM t2;
|
||||
SELECT 't1 rows after big delete', COUNT(*) FROM t1;
|
||||
|
||||
DROP TABLE t1,t2;
|
@ -290,4 +290,23 @@ EOF
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
|
||||
|
||||
#
|
||||
# Bug #33812: mysql client incorrectly parsing DELIMITER
|
||||
#
|
||||
# The space and ; after delimiter are important
|
||||
--exec $MYSQL -e "select 1 delimiter ;"
|
||||
|
||||
#
|
||||
# Bug #38158: mysql client regression, can't read dump files
|
||||
#
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/bug38158.sql
|
||||
-- Testing
|
||||
--
|
||||
delimiter ||
|
||||
select 2 ||
|
||||
EOF
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
|
||||
--exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
14
mysql-test/t/perror-win.test
Normal file
14
mysql-test/t/perror-win.test
Normal file
@ -0,0 +1,14 @@
|
||||
# Windows-specific tests
|
||||
--source include/windows.inc
|
||||
--require r/have_perror.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$MY_PERROR") > 0 as "have_perror";
|
||||
enable_query_log;
|
||||
|
||||
|
||||
--exec $MY_PERROR 150 2>&1
|
||||
--exec $MY_PERROR 23 2>&1
|
||||
--exec $MY_PERROR 1062 2>&1
|
||||
--error 1
|
||||
--exec $MY_PERROR 30000 2>&1
|
||||
|
@ -73,16 +73,26 @@ disconnect master;
|
||||
connect (master, localhost, root);
|
||||
connection master;
|
||||
|
||||
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
|
||||
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
||||
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
|
||||
|
||||
# The slave I/O thread must stop after trying to read the above event
|
||||
connection slave;
|
||||
--source include/wait_for_slave_io_to_stop.inc
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
# import is only the 11th column Slave_IO_Running
|
||||
--replace_column 1 # 8 # 9 # 12 # 23 # 33 #
|
||||
query_vertical show slave status;
|
||||
--source include/wait_for_slave_io_to_stop.inc
|
||||
let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
|
||||
--echo Slave_IO_Running = $slave_io_running (expect No)
|
||||
|
||||
|
||||
--echo ==== clean up ====
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
# slave is stopped
|
||||
connection slave;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of tests
|
||||
|
@ -3307,5 +3307,57 @@ SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
#
|
||||
# Bug#20835 (literal string with =any values)
|
||||
#
|
||||
CREATE TABLE t1 (s1 char(1));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#40519 Subselect query using bigint fails
|
||||
#
|
||||
CREATE TABLE t1(id BIGINT);
|
||||
CREATE TABLE t2(id1 BIGINT, id2 BIGINT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t2 VALUES (2,1),(3,1);
|
||||
SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1);
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug#37460 Assertion failed:
|
||||
# !table->file || table->file->inited == handler::NONE
|
||||
#
|
||||
CREATE TABLE t1 (id int);
|
||||
CREATE TABLE t2 (id int, c int);
|
||||
|
||||
INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t2 (id) VALUES (1);
|
||||
INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t2 (id) VALUES (1);
|
||||
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
UPDATE v1 SET c=1;
|
||||
|
||||
CREATE VIEW v2 (a,b) AS
|
||||
SELECT t2.id, t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
|
||||
--error 1369
|
||||
INSERT INTO v2(a,b) VALUES (2,2);
|
||||
INSERT INTO v2(a,b) VALUES (1,2);
|
||||
SELECT * FROM v1;
|
||||
|
||||
CREATE VIEW v3 AS
|
||||
SELECT t2.c AS c FROM t2
|
||||
WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
|
||||
DELETE FROM v3;
|
||||
|
||||
DROP VIEW v1,v2,v3;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -45,6 +45,10 @@ insert into t1 values
|
||||
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
|
||||
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
|
||||
|
||||
insert into t1 values
|
||||
(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
|
||||
(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
|
||||
|
||||
select i, from_unixtime(i), c from t1;
|
||||
drop table t1;
|
||||
|
||||
@ -58,4 +62,12 @@ insert into t1 values (19730101235900), (20040101235900);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
|
||||
# literal
|
||||
#
|
||||
|
||||
# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
|
||||
SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -352,4 +352,49 @@ SELECT HEX(b1), HEX(b2), i2 FROM t2
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug #35796 SHOW CREATE TABLE and default value for BIT field
|
||||
#
|
||||
CREATE TABLE IF NOT EXISTS t1 (
|
||||
f1 bit(2) NOT NULL default b'10',
|
||||
f2 bit(14) NOT NULL default b'11110000111100'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_INVALID_DEFAULT
|
||||
CREATE TABLE IF NOT EXISTS t1 (
|
||||
f1 bit(2) NOT NULL default b''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
|
||||
|
||||
#
|
||||
# Bug#31399 Wrong query result when doing join buffering over BIT fields
|
||||
#
|
||||
create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
|
||||
create table t2bit7 (b1 bit(7)) engine=MyISAM;
|
||||
|
||||
insert into t1bit7 values (b'1100000');
|
||||
insert into t1bit7 values (b'1100001');
|
||||
insert into t1bit7 values (b'1100010');
|
||||
insert into t2bit7 values (b'1100001');
|
||||
insert into t2bit7 values (b'1100010');
|
||||
insert into t2bit7 values (b'1100110');
|
||||
|
||||
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
|
||||
drop table t1bit7, t2bit7;
|
||||
|
||||
create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
|
||||
create table t2bit7 (b1 bit(15)) engine=MyISAM;
|
||||
|
||||
insert into t1bit7 values (b'110000011111111');
|
||||
insert into t1bit7 values (b'110000111111111');
|
||||
insert into t1bit7 values (b'110001011111111');
|
||||
insert into t2bit7 values (b'110000111111111');
|
||||
insert into t2bit7 values (b'110001011111111');
|
||||
insert into t2bit7 values (b'110011011111111');
|
||||
|
||||
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
|
||||
drop table t1bit7, t2bit7;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -252,4 +252,19 @@ insert into t1 values (2e30), (-2e30);
|
||||
select f1 + 0e0 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on
|
||||
# windows.
|
||||
#
|
||||
|
||||
create table t1(d double, u bigint unsigned);
|
||||
|
||||
insert into t1(d) values (9.22337203685479e18),
|
||||
(1.84e19);
|
||||
|
||||
update t1 set u = d;
|
||||
select u from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -1225,4 +1225,14 @@ DROP TABLE t1;
|
||||
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
|
||||
1.01500000 * 1.01500000 * 0.99500000);
|
||||
|
||||
#
|
||||
# Bug #31616 div_precision_increment description looks wrong
|
||||
#
|
||||
|
||||
create table t1 as select 5.05 / 0.014;
|
||||
show warnings;
|
||||
show create table t1;
|
||||
select * from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -510,7 +510,7 @@ drop table t1;
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
create view v1 as select a, sum(b) from t1 group by a;
|
||||
--error ER_WRONG_USAGE
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
select b from v1 use index (some_index) where b=1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
@ -3424,11 +3424,11 @@ drop table t1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
--error ER_WRONG_USAGE
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 USE KEY(non_existant);
|
||||
--error ER_WRONG_USAGE
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 FORCE KEY(non_existant);
|
||||
--error ER_WRONG_USAGE
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 IGNORE KEY(non_existant);
|
||||
|
||||
DROP VIEW v1;
|
||||
@ -3568,6 +3568,32 @@ DROP VIEW v1;
|
||||
CREATE VIEW v1 AS SELECT 1;
|
||||
DROP VIEW v1;
|
||||
|
||||
#
|
||||
# Bug #33461: SELECT ... FROM <view> USE INDEX (...) throws an error
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
|
||||
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
|
||||
SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
|
||||
SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
|
||||
|
||||
CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
|
||||
SHOW INDEX FROM v1;
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
|
||||
--error ER_KEY_DOES_NOT_EXITS
|
||||
SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.0 tests.
|
||||
|
@ -416,37 +416,96 @@ int ha_tina::find_current_row(byte *buf)
|
||||
if ((end_ptr= find_eoln(share->mapped_file, current_position, share->file_stat.st_size)) == 0)
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
|
||||
/*
|
||||
Parse the line obtained using the following algorithm
|
||||
|
||||
BEGIN
|
||||
1) Store the EOL (end of line) for the current row
|
||||
2) Until all the fields in the current query have not been
|
||||
filled
|
||||
2.1) If the current character begins with a quote
|
||||
2.1.1) Until EOL has not been reached
|
||||
a) If end of current field is reached, move
|
||||
to next field and jump to step 2.3
|
||||
b) If current character begins with \\ handle
|
||||
\\n, \\r, \\, \\"
|
||||
c) else append the current character into the buffer
|
||||
before checking that EOL has not been reached.
|
||||
2.2) If the current character does not begin with a quote
|
||||
2.2.1) Until EOL has not been reached
|
||||
a) If the end of field has been reached move to the
|
||||
next field and jump to step 2.3
|
||||
b) append the current character into the buffer
|
||||
2.3) Store the current field value and jump to 2)
|
||||
TERMINATE
|
||||
*/
|
||||
|
||||
for (Field **field=table->field ; *field ; field++)
|
||||
{
|
||||
buffer.length(0);
|
||||
mapped_ptr++; // Increment past the first quote
|
||||
for(;mapped_ptr != end_ptr; mapped_ptr++)
|
||||
/* Handle the case where the first character begins with a quote */
|
||||
if (*mapped_ptr == '"')
|
||||
{
|
||||
//Need to convert line feeds!
|
||||
if (*mapped_ptr == '"' &&
|
||||
(((mapped_ptr[1] == ',') && (mapped_ptr[2] == '"')) || (mapped_ptr == end_ptr -1 )))
|
||||
/* Increment past the first quote */
|
||||
mapped_ptr++;
|
||||
/* Loop through the row to extract the values for the current field */
|
||||
for(; mapped_ptr != end_ptr; mapped_ptr++)
|
||||
{
|
||||
mapped_ptr += 2; // Move past the , and the "
|
||||
break;
|
||||
}
|
||||
if (*mapped_ptr == '\\' && mapped_ptr != (end_ptr - 1))
|
||||
{
|
||||
mapped_ptr++;
|
||||
if (*mapped_ptr == 'r')
|
||||
buffer.append('\r');
|
||||
else if (*mapped_ptr == 'n' )
|
||||
buffer.append('\n');
|
||||
else if ((*mapped_ptr == '\\') || (*mapped_ptr == '"'))
|
||||
buffer.append(*mapped_ptr);
|
||||
else /* This could only happed with an externally created file */
|
||||
/* check for end of the current field */
|
||||
if (*mapped_ptr == '"' &&
|
||||
(mapped_ptr[1] == ',' || mapped_ptr == end_ptr -1 ))
|
||||
{
|
||||
buffer.append('\\');
|
||||
/* Move past the , and the " */
|
||||
mapped_ptr += 2;
|
||||
break;
|
||||
}
|
||||
if (*mapped_ptr == '\\' && mapped_ptr != (end_ptr - 1))
|
||||
{
|
||||
mapped_ptr++;
|
||||
if (*mapped_ptr == 'r')
|
||||
buffer.append('\r');
|
||||
else if (*mapped_ptr == 'n' )
|
||||
buffer.append('\n');
|
||||
else if ((*mapped_ptr == '\\') || (*mapped_ptr == '"'))
|
||||
buffer.append(*mapped_ptr);
|
||||
else /* This could only happed with an externally created file */
|
||||
{
|
||||
buffer.append('\\');
|
||||
buffer.append(*mapped_ptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
If no last quote was found, but the end of row has been reached
|
||||
it implies that there has been error.
|
||||
*/
|
||||
if (mapped_ptr == end_ptr -1)
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
/* Store current character in the buffer for the field */
|
||||
buffer.append(*mapped_ptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
buffer.append(*mapped_ptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle the case where the current row does not start with quotes */
|
||||
|
||||
/* Loop through the row to extract the values for the current field */
|
||||
for (; mapped_ptr != end_ptr; mapped_ptr++)
|
||||
{
|
||||
/* check for end of current field */
|
||||
if (*mapped_ptr == ',')
|
||||
{
|
||||
/* Increment past the current comma */
|
||||
mapped_ptr++;
|
||||
break;
|
||||
}
|
||||
/* store the current character in the buffer for the field */
|
||||
buffer.append(*mapped_ptr);
|
||||
}
|
||||
}
|
||||
/* Store the field value from the buffer */
|
||||
(*field)->store(buffer.ptr(), buffer.length(), buffer.charset());
|
||||
}
|
||||
next_position= (end_ptr - share->mapped_file)+1;
|
||||
|
@ -3473,7 +3473,7 @@ int Field_longlong::store(double nr)
|
||||
error= 1;
|
||||
}
|
||||
else
|
||||
res=(longlong) (ulonglong) nr;
|
||||
res=(longlong) double2ulonglong(nr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5372,6 +5372,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime, timestamp_type time_type)
|
||||
{
|
||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||
String str(buff, sizeof(buff), &my_charset_latin1);
|
||||
tmp= 0;
|
||||
make_date((DATE_TIME_FORMAT *) 0, ltime, &str);
|
||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
|
||||
str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1);
|
||||
@ -5608,6 +5609,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
|
||||
{
|
||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||
String str(buff, sizeof(buff), &my_charset_latin1);
|
||||
tmp= 0;
|
||||
make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str);
|
||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
|
||||
str.ptr(), str.length(), MYSQL_TIMESTAMP_DATETIME,1);
|
||||
|
@ -1320,6 +1320,14 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
|
||||
thr_lock_init(&share->lock);
|
||||
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
Free tmp_share.scheme allocated in the parse_url()
|
||||
as we found share in the hash and tmp_share isn't needed anymore.
|
||||
*/
|
||||
my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
|
||||
}
|
||||
share->use_count++;
|
||||
pthread_mutex_unlock(&federated_mutex);
|
||||
|
||||
|
@ -2158,6 +2158,14 @@ ha_innobase::open(
|
||||
UT_NOT_USED(test_if_locked);
|
||||
|
||||
thd = current_thd;
|
||||
|
||||
/* Under some cases MySQL seems to call this function while
|
||||
holding btr_search_latch. This breaks the latching order as
|
||||
we acquire dict_sys->mutex below and leads to a deadlock. */
|
||||
if (thd != NULL) {
|
||||
innobase_release_temporary_latches(thd);
|
||||
}
|
||||
|
||||
normalize_table_name(norm_name, name);
|
||||
|
||||
user_thd = NULL;
|
||||
|
@ -1957,8 +1957,53 @@ bool handler::get_error_message(int error, String* buf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check for incompatible collation changes.
|
||||
|
||||
@retval
|
||||
HA_ADMIN_NEEDS_UPGRADE Table may have data requiring upgrade.
|
||||
@retval
|
||||
0 No upgrade required.
|
||||
*/
|
||||
|
||||
int handler::check_collation_compatibility()
|
||||
{
|
||||
ulong mysql_version= table->s->mysql_version;
|
||||
|
||||
if (mysql_version < 50048)
|
||||
{
|
||||
KEY *key= table->key_info;
|
||||
KEY *key_end= key + table->s->keys;
|
||||
for (; key < key_end; key++)
|
||||
{
|
||||
KEY_PART_INFO *key_part= key->key_part;
|
||||
KEY_PART_INFO *key_part_end= key_part + key->key_parts;
|
||||
for (; key_part < key_part_end; key_part++)
|
||||
{
|
||||
if (!key_part->fieldnr)
|
||||
continue;
|
||||
Field *field= table->field[key_part->fieldnr - 1];
|
||||
uint cs_number= field->charset()->number;
|
||||
if (mysql_version < 50048 &&
|
||||
(cs_number == 11 || /* ascii_general_ci - bug #29499, bug #27562 */
|
||||
cs_number == 41 || /* latin7_general_ci - bug #29461 */
|
||||
cs_number == 42 || /* latin7_general_cs - bug #29461 */
|
||||
cs_number == 20 || /* latin7_estonian_cs - bug #29461 */
|
||||
cs_number == 21 || /* latin2_hungarian_ci - bug #29461 */
|
||||
cs_number == 22 || /* koi8u_general_ci - bug #29461 */
|
||||
cs_number == 23 || /* cp1251_ukrainian_ci - bug #29461 */
|
||||
cs_number == 26)) /* cp1250_general_ci - bug #29461 */
|
||||
return HA_ADMIN_NEEDS_UPGRADE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
|
||||
{
|
||||
int error;
|
||||
KEY *keyinfo, *keyend;
|
||||
KEY_PART_INFO *keypart, *keypartend;
|
||||
|
||||
@ -1987,6 +2032,10 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
|
||||
}
|
||||
if (table->s->frm_version != FRM_VER_TRUE_VARCHAR)
|
||||
return HA_ADMIN_NEEDS_ALTER;
|
||||
|
||||
if ((error= check_collation_compatibility()))
|
||||
return error;
|
||||
|
||||
return check_for_upgrade(check_opt);
|
||||
}
|
||||
|
||||
|
@ -787,6 +787,7 @@ protected:
|
||||
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt)
|
||||
{ return 0; }
|
||||
public:
|
||||
int check_collation_compatibility();
|
||||
int ha_check_for_upgrade(HA_CHECK_OPT *check_opt);
|
||||
int check_old_types();
|
||||
/* to be actually called to get 'check()' functionality*/
|
||||
|
@ -4950,6 +4950,9 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions)
|
||||
|
||||
ulonglong nr;
|
||||
uint32 length= str_value.length();
|
||||
if (!length)
|
||||
return 1;
|
||||
|
||||
if (length > 8)
|
||||
{
|
||||
nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX;
|
||||
@ -6792,7 +6795,7 @@ enum_field_types Item_type_holder::get_real_type(Item *item)
|
||||
*/
|
||||
Item_sum *item_sum= (Item_sum *) item;
|
||||
if (item_sum->keep_field_type())
|
||||
return get_real_type(item_sum->args[0]);
|
||||
return get_real_type(item_sum->get_arg(0));
|
||||
break;
|
||||
}
|
||||
case FUNC_ITEM:
|
||||
@ -7056,7 +7059,7 @@ void Item_type_holder::get_full_info(Item *item)
|
||||
if (item->type() == Item::SUM_FUNC_ITEM &&
|
||||
(((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC ||
|
||||
((Item_sum*)item)->sum_func() == Item_sum::MIN_FUNC))
|
||||
item = ((Item_sum*)item)->args[0];
|
||||
item = ((Item_sum*)item)->get_arg(0);
|
||||
/*
|
||||
We can have enum/set type after merging only if we have one enum|set
|
||||
field (or MIN|MAX(enum|set field)) and number of NULL fields
|
||||
|
@ -745,11 +745,11 @@ Arg_comparator::can_compare_as_dates(Item *a, Item *b, ulonglong *const_value)
|
||||
obtained value
|
||||
*/
|
||||
|
||||
ulonglong
|
||||
longlong
|
||||
get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null)
|
||||
{
|
||||
ulonglong value;
|
||||
longlong value;
|
||||
Item *item= **item_arg;
|
||||
MYSQL_TIME ltime;
|
||||
|
||||
@ -761,7 +761,7 @@ get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
else
|
||||
{
|
||||
*is_null= item->get_time(<ime);
|
||||
value= !*is_null ? TIME_to_ulonglong_datetime(<ime) : 0;
|
||||
value= !*is_null ? (longlong) TIME_to_ulonglong_datetime(<ime) : 0;
|
||||
}
|
||||
/*
|
||||
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
|
||||
@ -886,11 +886,11 @@ void Arg_comparator::set_datetime_cmp_func(Item **a1, Item **b1)
|
||||
obtained value
|
||||
*/
|
||||
|
||||
ulonglong
|
||||
longlong
|
||||
get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null)
|
||||
{
|
||||
ulonglong value= 0;
|
||||
longlong value= 0;
|
||||
String buf, *str= 0;
|
||||
Item *item= **item_arg;
|
||||
|
||||
@ -925,7 +925,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
enum_field_types f_type= warn_item->field_type();
|
||||
timestamp_type t_type= f_type ==
|
||||
MYSQL_TYPE_DATE ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME;
|
||||
value= get_date_from_str(thd, str, t_type, warn_item->name, &error);
|
||||
value= (longlong) get_date_from_str(thd, str, t_type, warn_item->name, &error);
|
||||
/*
|
||||
If str did not contain a valid date according to the current
|
||||
SQL_MODE, get_date_from_str() has already thrown a warning,
|
||||
@ -979,7 +979,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
int Arg_comparator::compare_datetime()
|
||||
{
|
||||
bool a_is_null, b_is_null;
|
||||
ulonglong a_value, b_value;
|
||||
longlong a_value, b_value;
|
||||
|
||||
/* Get DATE/DATETIME/TIME value of the 'a' item. */
|
||||
a_value= (*get_value_func)(thd, &a, &a_cache, *b, &a_is_null);
|
||||
@ -1434,7 +1434,8 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
|
||||
}
|
||||
not_null_tables_cache= args[0]->not_null_tables();
|
||||
with_sum_func= args[0]->with_sum_func;
|
||||
const_item_cache= args[0]->const_item();
|
||||
if ((const_item_cache= args[0]->const_item()))
|
||||
cache->store(args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ class Arg_comparator: public Sql_alloc
|
||||
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
|
||||
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
|
||||
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
|
||||
ulonglong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
longlong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
public:
|
||||
DTCollation cmp_collation;
|
||||
|
||||
@ -1028,7 +1028,7 @@ public:
|
||||
*/
|
||||
class cmp_item_datetime :public cmp_item
|
||||
{
|
||||
ulonglong value;
|
||||
longlong value;
|
||||
public:
|
||||
THD *thd;
|
||||
/* Item used for issuing warnings. */
|
||||
|
@ -1316,8 +1316,10 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
|
||||
|
||||
void Item_func_div::result_precision()
|
||||
{
|
||||
uint arg_prec= args[0]->decimal_precision() + prec_increment;
|
||||
uint precision=min(arg_prec, DECIMAL_MAX_PRECISION);
|
||||
uint precision=min(args[0]->decimal_precision() +
|
||||
args[1]->decimals + prec_increment,
|
||||
DECIMAL_MAX_PRECISION);
|
||||
|
||||
/* Integer operations keep unsigned_flag if one of arguments is unsigned */
|
||||
if (result_type() == INT_RESULT)
|
||||
unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag;
|
||||
@ -2273,7 +2275,7 @@ void Item_func_min_max::fix_length_and_dec()
|
||||
|
||||
uint Item_func_min_max::cmp_datetimes(ulonglong *value)
|
||||
{
|
||||
ulonglong min_max;
|
||||
longlong min_max;
|
||||
uint min_max_idx= 0;
|
||||
LINT_INIT(min_max);
|
||||
|
||||
@ -2281,7 +2283,7 @@ uint Item_func_min_max::cmp_datetimes(ulonglong *value)
|
||||
{
|
||||
Item **arg= args + i;
|
||||
bool is_null;
|
||||
ulonglong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
|
||||
longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
|
||||
if ((null_value= args[i]->null_value))
|
||||
return 0;
|
||||
if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0)
|
||||
@ -5022,7 +5024,9 @@ bool Item_func_match::fix_index()
|
||||
for (keynr=0 ; keynr < table->s->keys ; keynr++)
|
||||
{
|
||||
if ((table->key_info[keynr].flags & HA_FULLTEXT) &&
|
||||
(table->s->keys_in_use.is_set(keynr)))
|
||||
(flags & FT_BOOL ? table->keys_in_use_for_query.is_set(keynr) :
|
||||
table->s->keys_in_use.is_set(keynr)))
|
||||
|
||||
{
|
||||
ft_to_key[fts]=keynr;
|
||||
ft_cnt[fts]=0;
|
||||
|
@ -351,7 +351,10 @@ public:
|
||||
Item_func_unsigned(Item *a) :Item_func_signed(a) {}
|
||||
const char *func_name() const { return "cast_as_unsigned"; }
|
||||
void fix_length_and_dec()
|
||||
{ max_length=args[0]->max_length; unsigned_flag=1; }
|
||||
{
|
||||
max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2);
|
||||
unsigned_flag=1;
|
||||
}
|
||||
longlong val_int();
|
||||
void print(String *str);
|
||||
};
|
||||
|
@ -516,8 +516,9 @@ public:
|
||||
{
|
||||
collation.set(default_charset());
|
||||
uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
|
||||
max_length= ((char_length + (char_length-args[0]->decimals)/3) *
|
||||
collation.collation->mbmaxlen);
|
||||
uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1;
|
||||
max_length= (char_length + max_sep_count + decimals) *
|
||||
collation.collation->mbmaxlen;
|
||||
}
|
||||
const char *func_name() const { return "format"; }
|
||||
void print(String *);
|
||||
|
@ -370,6 +370,10 @@ Item_sum::Item_sum(List<Item> &list) :arg_count(list.elements),
|
||||
args[i++]= item;
|
||||
}
|
||||
}
|
||||
if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count)))
|
||||
{
|
||||
args= NULL;
|
||||
}
|
||||
mark_as_sum_func();
|
||||
list.empty(); // Fields are used
|
||||
}
|
||||
@ -380,18 +384,28 @@ Item_sum::Item_sum(List<Item> &list) :arg_count(list.elements),
|
||||
*/
|
||||
|
||||
Item_sum::Item_sum(THD *thd, Item_sum *item):
|
||||
Item_result_field(thd, item), arg_count(item->arg_count),
|
||||
Item_result_field(thd, item),
|
||||
aggr_sel(item->aggr_sel),
|
||||
nest_level(item->nest_level), aggr_level(item->aggr_level),
|
||||
quick_group(item->quick_group), used_tables_cache(item->used_tables_cache),
|
||||
quick_group(item->quick_group),
|
||||
arg_count(item->arg_count), orig_args(NULL),
|
||||
used_tables_cache(item->used_tables_cache),
|
||||
forced_const(item->forced_const)
|
||||
{
|
||||
if (arg_count <= 2)
|
||||
{
|
||||
args=tmp_args;
|
||||
orig_args=tmp_orig_args;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(args= (Item**) thd->alloc(sizeof(Item*)*arg_count)))
|
||||
return;
|
||||
if (!(orig_args= (Item**) thd->alloc(sizeof(Item*)*arg_count)))
|
||||
return;
|
||||
}
|
||||
memcpy(args, item->args, sizeof(Item*)*arg_count);
|
||||
memcpy(orig_args, item->orig_args, sizeof(Item*)*arg_count);
|
||||
}
|
||||
|
||||
|
||||
@ -426,12 +440,13 @@ void Item_sum::make_field(Send_field *tmp_field)
|
||||
|
||||
void Item_sum::print(String *str)
|
||||
{
|
||||
Item **pargs= orig_args;
|
||||
str->append(func_name());
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
if (i)
|
||||
str->append(',');
|
||||
args[i]->print(str);
|
||||
pargs[i]->print(str);
|
||||
}
|
||||
str->append(')');
|
||||
}
|
||||
@ -532,6 +547,13 @@ void Item_sum::update_used_tables ()
|
||||
}
|
||||
|
||||
|
||||
Item *Item_sum::set_arg(int i, THD *thd, Item *new_val)
|
||||
{
|
||||
thd->change_item_tree(args + i, new_val);
|
||||
return new_val;
|
||||
}
|
||||
|
||||
|
||||
String *
|
||||
Item_sum_num::val_str(String *str)
|
||||
{
|
||||
@ -583,6 +605,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
|
||||
if (check_sum_func(thd, ref))
|
||||
return TRUE;
|
||||
|
||||
memcpy (orig_args, args, sizeof (Item *) * arg_count);
|
||||
fixed= 1;
|
||||
return FALSE;
|
||||
}
|
||||
@ -670,6 +693,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
|
||||
if (check_sum_func(thd, ref))
|
||||
return TRUE;
|
||||
|
||||
orig_args[0]= args[0];
|
||||
fixed= 1;
|
||||
return FALSE;
|
||||
}
|
||||
@ -3107,6 +3131,12 @@ Item_func_group_concat(Name_resolution_context *context_arg,
|
||||
sizeof(ORDER*)*arg_count_order)))
|
||||
return;
|
||||
|
||||
if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count)))
|
||||
{
|
||||
args= NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
order= (ORDER**)(args + arg_count);
|
||||
|
||||
/* fill args items of show and sort */
|
||||
@ -3334,6 +3364,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
|
||||
if (check_sum_func(thd, ref))
|
||||
return TRUE;
|
||||
|
||||
memcpy (orig_args, args, sizeof (Item *) * arg_count);
|
||||
fixed= 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -228,10 +228,8 @@ public:
|
||||
VARIANCE_FUNC, SUM_BIT_FUNC, UDF_SUM_FUNC, GROUP_CONCAT_FUNC
|
||||
};
|
||||
|
||||
Item **args, *tmp_args[2];
|
||||
Item **ref_by; /* pointer to a ref to the object used to register it */
|
||||
Item_sum *next; /* next in the circular chain of registered objects */
|
||||
uint arg_count;
|
||||
Item_sum *in_sum_func; /* embedding set function if any */
|
||||
st_select_lex * aggr_sel; /* select where the function is aggregated */
|
||||
int8 nest_level; /* number of the nesting level of the set function */
|
||||
@ -248,24 +246,32 @@ public:
|
||||
List<Item_field> outer_fields;
|
||||
|
||||
protected:
|
||||
uint arg_count;
|
||||
Item **args, *tmp_args[2];
|
||||
/*
|
||||
Copy of the arguments list to hold the original set of arguments.
|
||||
Used in EXPLAIN EXTENDED instead of the current argument list because
|
||||
the current argument list can be altered by usage of temporary tables.
|
||||
*/
|
||||
Item **orig_args, *tmp_orig_args[2];
|
||||
table_map used_tables_cache;
|
||||
bool forced_const;
|
||||
|
||||
public:
|
||||
|
||||
void mark_as_sum_func();
|
||||
Item_sum() :arg_count(0), quick_group(1), forced_const(FALSE)
|
||||
Item_sum() :quick_group(1), arg_count(0), forced_const(FALSE)
|
||||
{
|
||||
mark_as_sum_func();
|
||||
}
|
||||
Item_sum(Item *a) :args(tmp_args), arg_count(1), quick_group(1),
|
||||
forced_const(FALSE)
|
||||
Item_sum(Item *a) :quick_group(1), arg_count(1), args(tmp_args),
|
||||
orig_args(tmp_orig_args), forced_const(FALSE)
|
||||
{
|
||||
args[0]=a;
|
||||
mark_as_sum_func();
|
||||
}
|
||||
Item_sum( Item *a, Item *b ) :args(tmp_args), arg_count(2), quick_group(1),
|
||||
forced_const(FALSE)
|
||||
Item_sum( Item *a, Item *b ) :quick_group(1), arg_count(2), args(tmp_args),
|
||||
orig_args(tmp_orig_args), forced_const(FALSE)
|
||||
{
|
||||
args[0]=a; args[1]=b;
|
||||
mark_as_sum_func();
|
||||
@ -374,6 +380,10 @@ public:
|
||||
bool register_sum_func(THD *thd, Item **ref);
|
||||
st_select_lex *depended_from()
|
||||
{ return (nest_level == aggr_level ? 0 : aggr_sel); }
|
||||
|
||||
Item *get_arg(int i) { return args[i]; }
|
||||
Item *set_arg(int i, THD *thd, Item *new_val);
|
||||
uint get_arg_count() { return arg_count; }
|
||||
};
|
||||
|
||||
|
||||
@ -981,6 +991,7 @@ public:
|
||||
if (udf.fix_fields(thd, this, this->arg_count, this->args))
|
||||
return TRUE;
|
||||
|
||||
memcpy (orig_args, args, sizeof (Item *) * arg_count);
|
||||
return check_sum_func(thd, ref);
|
||||
}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
|
@ -2550,6 +2550,8 @@ void Item_char_typecast::fix_length_and_dec()
|
||||
and thus avoid unnecessary character set conversion.
|
||||
- If the argument is not a number, then from_cs is set to
|
||||
the argument's charset.
|
||||
|
||||
Note (TODO): we could use repertoire technique here.
|
||||
*/
|
||||
from_cs= (args[0]->result_type() == INT_RESULT ||
|
||||
args[0]->result_type() == DECIMAL_RESULT ||
|
||||
@ -2557,12 +2559,13 @@ void Item_char_typecast::fix_length_and_dec()
|
||||
(cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) :
|
||||
args[0]->collation.collation;
|
||||
charset_conversion= (cast_cs->mbmaxlen > 1) ||
|
||||
!my_charset_same(from_cs, cast_cs) &&
|
||||
from_cs != &my_charset_bin &&
|
||||
cast_cs != &my_charset_bin;
|
||||
(!my_charset_same(from_cs, cast_cs) &&
|
||||
from_cs != &my_charset_bin &&
|
||||
cast_cs != &my_charset_bin);
|
||||
collation.set(cast_cs, DERIVATION_IMPLICIT);
|
||||
char_length= (cast_length >= 0) ? cast_length :
|
||||
args[0]->max_length/from_cs->mbmaxlen;
|
||||
char_length= (cast_length >= 0) ?
|
||||
cast_length :
|
||||
args[0]->max_length / args[0]->collation.collation->mbmaxlen;
|
||||
max_length= char_length * cast_cs->mbmaxlen;
|
||||
}
|
||||
|
||||
|
@ -408,6 +408,7 @@ public:
|
||||
{
|
||||
return save_time_in_field(field);
|
||||
}
|
||||
bool result_as_longlong() { return TRUE; }
|
||||
};
|
||||
|
||||
|
||||
|
213
sql/log.cc
213
sql/log.cc
@ -417,6 +417,7 @@ MYSQL_LOG::MYSQL_LOG()
|
||||
index_file_name[0] = 0;
|
||||
bzero((char*) &log_file,sizeof(log_file));
|
||||
bzero((char*) &index_file, sizeof(index_file));
|
||||
bzero((char*) &purge_temp, sizeof(purge_temp));
|
||||
}
|
||||
|
||||
/* this is called only once */
|
||||
@ -1059,10 +1060,10 @@ err:
|
||||
|
||||
IMPLEMENTATION
|
||||
- Protects index file with LOCK_index
|
||||
- Read the next file name from the index file and store in rli->linfo
|
||||
- Delete relevant relay log files
|
||||
- Copy all file names after these ones to the front of the index file
|
||||
- If the OS has truncate, truncate the file, else fill it with \n'
|
||||
- Read the next file name from the index file and store in rli->linfo
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
@ -1076,6 +1077,7 @@ err:
|
||||
int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included)
|
||||
{
|
||||
int error;
|
||||
char *to_purge_if_included= NULL;
|
||||
DBUG_ENTER("purge_first_log");
|
||||
|
||||
DBUG_ASSERT(is_open());
|
||||
@ -1083,36 +1085,20 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included)
|
||||
DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->event_relay_log_name));
|
||||
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
pthread_mutex_lock(&rli->log_space_lock);
|
||||
rli->relay_log.purge_logs(rli->group_relay_log_name, included,
|
||||
0, 0, &rli->log_space_total);
|
||||
// Tell the I/O thread to take the relay_log_space_limit into account
|
||||
rli->ignore_log_space_limit= 0;
|
||||
pthread_mutex_unlock(&rli->log_space_lock);
|
||||
to_purge_if_included= my_strdup(rli->group_relay_log_name, MYF(0));
|
||||
|
||||
/*
|
||||
Ok to broadcast after the critical region as there is no risk of
|
||||
the mutex being destroyed by this thread later - this helps save
|
||||
context switches
|
||||
*/
|
||||
pthread_cond_broadcast(&rli->log_space_cond);
|
||||
|
||||
/*
|
||||
Read the next log file name from the index file and pass it back to
|
||||
the caller
|
||||
If included is true, we want the first relay log;
|
||||
otherwise we want the one after event_relay_log_name.
|
||||
the caller.
|
||||
*/
|
||||
if ((included && (error=find_log_pos(&rli->linfo, NullS, 0))) ||
|
||||
(!included &&
|
||||
((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) ||
|
||||
(error=find_next_log(&rli->linfo, 0)))))
|
||||
if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) ||
|
||||
(error=find_next_log(&rli->linfo, 0)))
|
||||
{
|
||||
char buff[22];
|
||||
sql_print_error("next log error: %d offset: %s log: %s included: %d",
|
||||
error,
|
||||
llstr(rli->linfo.index_file_offset,buff),
|
||||
rli->group_relay_log_name,
|
||||
rli->event_relay_log_name,
|
||||
included);
|
||||
goto err;
|
||||
}
|
||||
@ -1140,7 +1126,42 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included)
|
||||
/* Store where we are in the new file for the execution thread */
|
||||
flush_relay_log_info(rli);
|
||||
|
||||
DBUG_EXECUTE_IF("crash_before_purge_logs", abort(););
|
||||
|
||||
pthread_mutex_lock(&rli->log_space_lock);
|
||||
rli->relay_log.purge_logs(to_purge_if_included, included,
|
||||
0, 0, &rli->log_space_total);
|
||||
// Tell the I/O thread to take the relay_log_space_limit into account
|
||||
rli->ignore_log_space_limit= 0;
|
||||
pthread_mutex_unlock(&rli->log_space_lock);
|
||||
|
||||
/*
|
||||
Ok to broadcast after the critical region as there is no risk of
|
||||
the mutex being destroyed by this thread later - this helps save
|
||||
context switches
|
||||
*/
|
||||
pthread_cond_broadcast(&rli->log_space_cond);
|
||||
|
||||
/*
|
||||
* Need to update the log pos because purge logs has been called
|
||||
* after fetching initially the log pos at the begining of the method.
|
||||
*/
|
||||
if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
|
||||
{
|
||||
char buff[22];
|
||||
sql_print_error("next log error: %d offset: %s log: %s included: %d",
|
||||
error,
|
||||
llstr(rli->linfo.index_file_offset,buff),
|
||||
rli->group_relay_log_name,
|
||||
included);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* If included was passed, rli->linfo should be the first entry. */
|
||||
DBUG_ASSERT(!included || rli->linfo.index_file_start_offset == 0);
|
||||
|
||||
err:
|
||||
my_free(to_purge_if_included, MYF(0));
|
||||
pthread_mutex_unlock(&LOCK_index);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -1199,8 +1220,36 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
||||
|
||||
if (need_mutex)
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/)))
|
||||
if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/)))
|
||||
{
|
||||
sql_print_error("MYSQL_LOG::purge_logs was called with file %s not "
|
||||
"listed in the index.", to_log);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
For crash recovery reasons the index needs to be updated before
|
||||
any files are deleted. Move files to be deleted into a temp file
|
||||
to be processed after the index is updated.
|
||||
*/
|
||||
if (!my_b_inited(&purge_temp))
|
||||
{
|
||||
if ((error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX,
|
||||
DISK_BUFFER_SIZE, MYF(MY_WME))))
|
||||
{
|
||||
sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1)))
|
||||
{
|
||||
sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp "
|
||||
"for write");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
File name exists in index file; delete until we find this file
|
||||
@ -1211,6 +1260,59 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
||||
while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) &&
|
||||
!log_in_use(log_info.log_file_name))
|
||||
{
|
||||
if ((error=my_b_write(&purge_temp, (byte*)log_info.log_file_name,
|
||||
strlen(log_info.log_file_name))) ||
|
||||
(error=my_b_write(&purge_temp, (byte*)"\n", 1)))
|
||||
{
|
||||
sql_print_error("MYSQL_LOG::purge_logs failed to copy %s to purge_temp",
|
||||
log_info.log_file_name);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (find_next_log(&log_info, 0) || exit_loop)
|
||||
break;
|
||||
}
|
||||
|
||||
/* We know how many files to delete. Update index file. */
|
||||
if ((error=update_log_index(&log_info, need_update_threads)))
|
||||
{
|
||||
sql_print_error("MSYQL_LOG::purge_logs failed to update the index file");
|
||||
goto err;
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF("crash_after_update_index", abort(););
|
||||
|
||||
/* Switch purge_temp for read. */
|
||||
if ((error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)))
|
||||
{
|
||||
sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp "
|
||||
"for read");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Read each entry from purge_temp and delete the file. */
|
||||
for (;;)
|
||||
{
|
||||
uint length;
|
||||
|
||||
if ((length=my_b_gets(&purge_temp, log_info.log_file_name,
|
||||
FN_REFLEN)) <= 1)
|
||||
{
|
||||
if (purge_temp.error)
|
||||
{
|
||||
error= purge_temp.error;
|
||||
sql_print_error("MSYQL_LOG::purge_logs error %d reading from "
|
||||
"purge_temp", error);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Reached EOF */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get rid of the trailing '\n' */
|
||||
log_info.log_file_name[length-1]= 0;
|
||||
|
||||
MY_STAT s;
|
||||
if (!my_stat(log_info.log_file_name, &s, MYF(0)))
|
||||
{
|
||||
@ -1304,17 +1406,10 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (find_next_log(&log_info, 0) || exit_loop)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
If we get killed -9 here, the sysadmin would have to edit
|
||||
the log index file after restart - otherwise, this should be safe
|
||||
*/
|
||||
error= update_log_index(&log_info, need_update_threads);
|
||||
|
||||
err:
|
||||
close_cached_file(&purge_temp);
|
||||
if (need_mutex)
|
||||
pthread_mutex_unlock(&LOCK_index);
|
||||
DBUG_RETURN(error);
|
||||
@ -1326,7 +1421,6 @@ err:
|
||||
|
||||
SYNOPSIS
|
||||
purge_logs_before_date()
|
||||
thd Thread pointer
|
||||
before_date Delete all log files before given date.
|
||||
|
||||
NOTES
|
||||
@ -1343,6 +1437,7 @@ err:
|
||||
int MYSQL_LOG::purge_logs_before_date(time_t purge_time)
|
||||
{
|
||||
int error;
|
||||
char to_log[FN_REFLEN];
|
||||
LOG_INFO log_info;
|
||||
MY_STAT stat_area;
|
||||
THD *thd= current_thd;
|
||||
@ -1350,12 +1445,8 @@ int MYSQL_LOG::purge_logs_before_date(time_t purge_time)
|
||||
DBUG_ENTER("purge_logs_before_date");
|
||||
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
to_log[0]= 0;
|
||||
|
||||
/*
|
||||
Delete until we find curren file
|
||||
or a file that is used or a file
|
||||
that is older than purge_time.
|
||||
*/
|
||||
if ((error=find_log_pos(&log_info, NullS, 0 /*no mutex*/)))
|
||||
goto err;
|
||||
|
||||
@ -1405,54 +1496,18 @@ int MYSQL_LOG::purge_logs_before_date(time_t purge_time)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stat_area.st_mtime >= purge_time)
|
||||
if (stat_area.st_mtime < purge_time)
|
||||
strmake(to_log,
|
||||
log_info.log_file_name,
|
||||
sizeof(log_info.log_file_name));
|
||||
else
|
||||
break;
|
||||
if (my_delete(log_info.log_file_name, MYF(0)))
|
||||
{
|
||||
if (my_errno == ENOENT)
|
||||
{
|
||||
/* It's not fatal even if we can't delete a log file */
|
||||
if (thd)
|
||||
{
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
|
||||
log_info.log_file_name);
|
||||
}
|
||||
sql_print_information("Failed to delete file '%s'",
|
||||
log_info.log_file_name);
|
||||
my_errno= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (thd)
|
||||
{
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_BINLOG_PURGE_FATAL_ERR,
|
||||
"a problem with deleting %s; "
|
||||
"consider examining correspondence "
|
||||
"of your binlog index file "
|
||||
"to the actual binlog files",
|
||||
log_info.log_file_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
sql_print_information("Failed to delete log file '%s'",
|
||||
log_info.log_file_name);
|
||||
}
|
||||
error= LOG_INFO_FATAL;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (find_next_log(&log_info, 0))
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
If we get killed -9 here, the sysadmin would have to edit
|
||||
the log index file after restart - otherwise, this should be safe
|
||||
*/
|
||||
error= update_log_index(&log_info, 1);
|
||||
error= (to_log[0] ? purge_logs(to_log, 1, 0, 1, (ulonglong *) 0) : 0);
|
||||
|
||||
err:
|
||||
pthread_mutex_unlock(&LOCK_index);
|
||||
|
@ -216,7 +216,7 @@ my_decimal *date2my_decimal(MYSQL_TIME *ltime, my_decimal *dec)
|
||||
date = (ltime->year*100L + ltime->month)*100L + ltime->day;
|
||||
if (ltime->time_type > MYSQL_TIMESTAMP_DATE)
|
||||
date= ((date*100L + ltime->hour)*100L+ ltime->minute)*100L + ltime->second;
|
||||
if (int2my_decimal(E_DEC_FATAL_ERROR, date, FALSE, dec))
|
||||
if (int2my_decimal(E_DEC_FATAL_ERROR, ltime->neg ? -date : date, FALSE, dec))
|
||||
return dec;
|
||||
if (ltime->second_part)
|
||||
{
|
||||
|
@ -435,6 +435,7 @@ MY_LOCALE *my_locale_by_number(uint number);
|
||||
#define UNCACHEABLE_PREPARE 16
|
||||
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
|
||||
#define UNCACHEABLE_UNITED 32
|
||||
#define UNCACHEABLE_CHECKOPTION 64
|
||||
|
||||
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
|
||||
#define UNDEF_POS (-1)
|
||||
@ -1556,8 +1557,8 @@ void make_date(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
|
||||
String *str);
|
||||
void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
|
||||
String *str);
|
||||
ulonglong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
|
||||
int test_if_number(char *str,int *res,bool allow_wildcards);
|
||||
void change_byte(byte *,uint,char,char);
|
||||
|
@ -3035,12 +3035,14 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
||||
sys_init_connect.value_length= strlen(opt_init_connect);
|
||||
else
|
||||
sys_init_connect.value=my_strdup("",MYF(0));
|
||||
sys_init_connect.is_os_charset= TRUE;
|
||||
|
||||
sys_init_slave.value_length= 0;
|
||||
if ((sys_init_slave.value= opt_init_slave))
|
||||
sys_init_slave.value_length= strlen(opt_init_slave);
|
||||
else
|
||||
sys_init_slave.value=my_strdup("",MYF(0));
|
||||
sys_init_slave.is_os_charset= TRUE;
|
||||
|
||||
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
|
||||
return 1;
|
||||
@ -3840,6 +3842,9 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
||||
: mysqld_unix_port),
|
||||
mysqld_port,
|
||||
MYSQL_COMPILATION_COMMENT);
|
||||
#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
|
||||
Service.SetRunning();
|
||||
#endif
|
||||
|
||||
#if defined(__NT__) || defined(HAVE_SMEM)
|
||||
handle_connections_methods();
|
||||
|
@ -245,10 +245,6 @@ void NTService::ServiceMain(DWORD argc, LPTSTR *argv)
|
||||
if (!pService->StartService())
|
||||
goto error;
|
||||
|
||||
// Check that the service is now running.
|
||||
if (!pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0))
|
||||
goto error;
|
||||
|
||||
// wait for exit event
|
||||
WaitForSingleObject (pService->hExitEvent, INFINITE);
|
||||
|
||||
@ -264,6 +260,14 @@ error:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void NTService::SetRunning()
|
||||
{
|
||||
if (pService)
|
||||
pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
StartService() - starts the appliaction thread
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -56,7 +56,19 @@ class NTService
|
||||
BOOL IsService(LPCSTR ServiceName);
|
||||
BOOL got_service_option(char **argv, char *service_option);
|
||||
BOOL is_super_user();
|
||||
void Stop(void); //to be called from app. to stop service
|
||||
|
||||
/*
|
||||
SetRunning() is to be called by the application
|
||||
when initialization completes and it can accept
|
||||
stop request
|
||||
*/
|
||||
void SetRunning(void);
|
||||
|
||||
/*
|
||||
Stop() is to be called by the application to stop
|
||||
the service
|
||||
*/
|
||||
void Stop(void);
|
||||
|
||||
protected:
|
||||
LPSTR ServiceName;
|
||||
|
@ -7738,7 +7738,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
/* The argument of MIN/MAX. */
|
||||
Item *expr= min_max_item->args[0]->real_item();
|
||||
Item *expr= min_max_item->get_arg(0)->real_item();
|
||||
if (expr->type() == Item::FIELD_ITEM) /* Is it an attribute? */
|
||||
{
|
||||
if (! min_max_arg_item)
|
||||
|
@ -160,7 +160,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
|
||||
to the number of rows in the tables if this number is exact and
|
||||
there are no outer joins.
|
||||
*/
|
||||
if (!conds && !((Item_sum_count*) item)->args[0]->maybe_null &&
|
||||
if (!conds && !((Item_sum_count*) item)->get_arg(0)->maybe_null &&
|
||||
!outer_tables && is_exact_count)
|
||||
{
|
||||
((Item_sum_count*) item)->make_const(count);
|
||||
@ -176,7 +176,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
|
||||
parts of the key is found in the COND, then we can use
|
||||
indexes to find the key.
|
||||
*/
|
||||
Item *expr=item_sum->args[0];
|
||||
Item *expr=item_sum->get_arg(0);
|
||||
if (expr->real_item()->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
byte key_buff[MAX_KEY_LENGTH];
|
||||
@ -319,7 +319,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
|
||||
parts of the key is found in the COND, then we can use
|
||||
indexes to find the key.
|
||||
*/
|
||||
Item *expr=item_sum->args[0];
|
||||
Item *expr=item_sum->get_arg(0);
|
||||
if (expr->real_item()->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
byte key_buff[MAX_KEY_LENGTH];
|
||||
|
@ -138,7 +138,7 @@ sys_var_thd_ulong sys_auto_increment_offset("auto_increment_offset",
|
||||
sys_var_bool_ptr sys_automatic_sp_privileges("automatic_sp_privileges",
|
||||
&sp_automatic_privileges);
|
||||
|
||||
sys_var_const_str sys_basedir("basedir", mysql_home);
|
||||
sys_var_const_os_str sys_basedir("basedir", mysql_home);
|
||||
sys_var_long_ptr sys_binlog_cache_size("binlog_cache_size",
|
||||
&binlog_cache_size);
|
||||
sys_var_thd_ulong sys_bulk_insert_buff_size("bulk_insert_buffer_size",
|
||||
@ -151,6 +151,8 @@ sys_var_character_set_client sys_character_set_client("character_set_client");
|
||||
sys_var_character_set_connection sys_character_set_connection("character_set_connection");
|
||||
sys_var_character_set_results sys_character_set_results("character_set_results");
|
||||
sys_var_character_set_filesystem sys_character_set_filesystem("character_set_filesystem");
|
||||
sys_var_const_os_str sys_character_sets_dir("character_sets_dir",
|
||||
mysql_charsets_dir);
|
||||
sys_var_thd_ulong sys_completion_type("completion_type",
|
||||
&SV::completion_type,
|
||||
check_completion_type,
|
||||
@ -162,7 +164,7 @@ sys_var_long_ptr sys_concurrent_insert("concurrent_insert",
|
||||
&myisam_concurrent_insert);
|
||||
sys_var_long_ptr sys_connect_timeout("connect_timeout",
|
||||
&connect_timeout);
|
||||
sys_var_const_str sys_datadir("datadir", mysql_real_data_home);
|
||||
sys_var_const_os_str sys_datadir("datadir", mysql_real_data_home);
|
||||
sys_var_enum sys_delay_key_write("delay_key_write",
|
||||
&delay_key_write_options,
|
||||
&delay_key_write_typelib,
|
||||
@ -311,6 +313,7 @@ sys_var_thd_ulong sys_optimizer_prune_level("optimizer_prune_level",
|
||||
&SV::optimizer_prune_level);
|
||||
sys_var_thd_ulong sys_optimizer_search_depth("optimizer_search_depth",
|
||||
&SV::optimizer_search_depth);
|
||||
sys_var_const_os_str sys_plugin_dir("plugin_dir", opt_plugin_dir);
|
||||
sys_var_thd_ulong sys_preload_buff_size("preload_buffer_size",
|
||||
&SV::preload_buff_size);
|
||||
sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
|
||||
@ -338,7 +341,7 @@ sys_var_thd_ulong sys_query_alloc_block_size("query_alloc_block_size",
|
||||
sys_var_thd_ulong sys_query_prealloc_size("query_prealloc_size",
|
||||
&SV::query_prealloc_size,
|
||||
0, fix_thd_mem_root);
|
||||
sys_var_readonly sys_tmpdir("tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
|
||||
sys_var_readonly_os sys_tmpdir("tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
|
||||
sys_var_thd_ulong sys_trans_alloc_block_size("transaction_alloc_block_size",
|
||||
&SV::trans_alloc_block_size,
|
||||
0, fix_trans_mem_root);
|
||||
@ -363,9 +366,11 @@ sys_var_bool_ptr sys_secure_auth("secure_auth", &opt_secure_auth);
|
||||
sys_var_const_str_ptr sys_secure_file_priv("secure_file_priv",
|
||||
&opt_secure_file_priv);
|
||||
sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id);
|
||||
#ifdef HAVE_REPLICATION
|
||||
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
|
||||
&opt_slave_compressed_protocol);
|
||||
#ifdef HAVE_REPLICATION
|
||||
sys_var_const_os_str_ptr sys_slave_load_tmpdir("slave_load_tmpdir",
|
||||
&slave_load_tmpdir);
|
||||
sys_var_long_ptr sys_slave_net_timeout("slave_net_timeout",
|
||||
&slave_net_timeout);
|
||||
sys_var_long_ptr sys_slave_trans_retries("slave_transaction_retries",
|
||||
@ -380,17 +385,17 @@ sys_var_thd_sql_mode sys_sql_mode("sql_mode",
|
||||
#ifdef HAVE_OPENSSL
|
||||
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
|
||||
*opt_ssl_key;
|
||||
sys_var_const_str_ptr sys_ssl_ca("ssl_ca", &opt_ssl_ca);
|
||||
sys_var_const_str_ptr sys_ssl_capath("ssl_capath", &opt_ssl_capath);
|
||||
sys_var_const_str_ptr sys_ssl_cert("ssl_cert", &opt_ssl_cert);
|
||||
sys_var_const_str_ptr sys_ssl_cipher("ssl_cipher", &opt_ssl_cipher);
|
||||
sys_var_const_str_ptr sys_ssl_key("ssl_key", &opt_ssl_key);
|
||||
sys_var_const_os_str_ptr sys_ssl_ca("ssl_ca", &opt_ssl_ca);
|
||||
sys_var_const_os_str_ptr sys_ssl_capath("ssl_capath", &opt_ssl_capath);
|
||||
sys_var_const_os_str_ptr sys_ssl_cert("ssl_cert", &opt_ssl_cert);
|
||||
sys_var_const_os_str_ptr sys_ssl_cipher("ssl_cipher", &opt_ssl_cipher);
|
||||
sys_var_const_os_str_ptr sys_ssl_key("ssl_key", &opt_ssl_key);
|
||||
#else
|
||||
sys_var_const_str sys_ssl_ca("ssl_ca", NULL);
|
||||
sys_var_const_str sys_ssl_capath("ssl_capath", NULL);
|
||||
sys_var_const_str sys_ssl_cert("ssl_cert", NULL);
|
||||
sys_var_const_str sys_ssl_cipher("ssl_cipher", NULL);
|
||||
sys_var_const_str sys_ssl_key("ssl_key", NULL);
|
||||
sys_var_const_os_str sys_ssl_ca("ssl_ca", NULL);
|
||||
sys_var_const_os_str sys_ssl_capath("ssl_capath", NULL);
|
||||
sys_var_const_os_str sys_ssl_cert("ssl_cert", NULL);
|
||||
sys_var_const_os_str sys_ssl_cipher("ssl_cipher", NULL);
|
||||
sys_var_const_os_str sys_ssl_key("ssl_key", NULL);
|
||||
#endif
|
||||
sys_var_thd_enum
|
||||
sys_updatable_views_with_limit("updatable_views_with_limit",
|
||||
@ -460,6 +465,14 @@ sys_var_long_ptr sys_innodb_commit_concurrency("innodb_commit_concurrency",
|
||||
sys_var_long_ptr sys_innodb_flush_log_at_trx_commit(
|
||||
"innodb_flush_log_at_trx_commit",
|
||||
&srv_flush_log_at_trx_commit);
|
||||
sys_var_const_os_str_ptr sys_innodb_data_file_path("innodb_data_file_path",
|
||||
&innobase_data_file_path);
|
||||
sys_var_const_os_str_ptr sys_innodb_data_home_dir("innodb_data_home_dir",
|
||||
&innobase_data_home_dir);
|
||||
sys_var_const_os_str_ptr sys_innodb_log_arch_dir("innodb_log_arch_dir",
|
||||
&innobase_log_arch_dir);
|
||||
sys_var_const_os_str_ptr sys_innodb_log_group_home_dir("innodb_log_group_home_dir",
|
||||
&innobase_log_group_home_dir);
|
||||
#endif
|
||||
|
||||
/* Condition pushdown to storage engine */
|
||||
@ -844,7 +857,7 @@ struct show_var_st init_vars[]= {
|
||||
{sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS},
|
||||
{sys_character_set_server.name, (char*) &sys_character_set_server,SHOW_SYS},
|
||||
{sys_charset_system.name, (char*) &sys_charset_system, SHOW_SYS},
|
||||
{"character_sets_dir", mysql_charsets_dir, SHOW_CHAR},
|
||||
{sys_character_sets_dir.name, (char *) &sys_character_sets_dir, SHOW_SYS},
|
||||
{sys_collation_connection.name,(char*) &sys_collation_connection, SHOW_SYS},
|
||||
{sys_collation_database.name,(char*) &sys_collation_database, SHOW_SYS},
|
||||
{sys_collation_server.name,(char*) &sys_collation_server, SHOW_SYS},
|
||||
@ -905,8 +918,8 @@ struct show_var_st init_vars[]= {
|
||||
{"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL},
|
||||
{sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency, SHOW_SYS},
|
||||
{sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS},
|
||||
{"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR},
|
||||
{"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR},
|
||||
{sys_innodb_data_file_path.name, (char*) &sys_innodb_data_file_path, SHOW_SYS},
|
||||
{sys_innodb_data_home_dir.name, (char*) &sys_innodb_data_home_dir, SHOW_SYS},
|
||||
{"innodb_adaptive_hash_index", (char*) &innobase_adaptive_hash_index, SHOW_MY_BOOL},
|
||||
{"innodb_doublewrite", (char*) &innobase_use_doublewrite, SHOW_MY_BOOL},
|
||||
{sys_innodb_fast_shutdown.name,(char*) &sys_innodb_fast_shutdown, SHOW_SYS},
|
||||
@ -917,12 +930,12 @@ struct show_var_st init_vars[]= {
|
||||
{"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
|
||||
{"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
|
||||
{"innodb_locks_unsafe_for_binlog", (char*) &innobase_locks_unsafe_for_binlog, SHOW_MY_BOOL},
|
||||
{"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
|
||||
{sys_innodb_log_arch_dir.name, (char*) &sys_innodb_log_arch_dir, SHOW_SYS},
|
||||
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
|
||||
{"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG },
|
||||
{"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONGLONG},
|
||||
{"innodb_log_files_in_group", (char*) &innobase_log_files_in_group, SHOW_LONG},
|
||||
{"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
|
||||
{sys_innodb_log_group_home_dir.name, (char*) &sys_innodb_log_group_home_dir, SHOW_SYS},
|
||||
{sys_innodb_max_dirty_pages_pct.name, (char*) &sys_innodb_max_dirty_pages_pct, SHOW_SYS},
|
||||
{sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS},
|
||||
{"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
|
||||
@ -1026,7 +1039,7 @@ struct show_var_st init_vars[]= {
|
||||
{sys_optimizer_search_depth.name,(char*) &sys_optimizer_search_depth,
|
||||
SHOW_SYS},
|
||||
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
|
||||
{"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR},
|
||||
{sys_plugin_dir.name, (char*) &sys_plugin_dir, SHOW_SYS},
|
||||
{"port", (char*) &mysqld_port, SHOW_INT},
|
||||
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
|
||||
{"protocol_version", (char*) &protocol_version, SHOW_INT},
|
||||
@ -1068,7 +1081,7 @@ struct show_var_st init_vars[]= {
|
||||
#ifdef HAVE_REPLICATION
|
||||
{sys_slave_compressed_protocol.name,
|
||||
(char*) &sys_slave_compressed_protocol, SHOW_SYS},
|
||||
{"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
|
||||
{sys_slave_load_tmpdir.name,(char*) &sys_slave_load_tmpdir, SHOW_SYS},
|
||||
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
|
||||
{"slave_skip_errors", (char*) &slave_error_mask, SHOW_SLAVE_SKIP_ERRORS},
|
||||
{sys_slave_trans_retries.name,(char*) &sys_slave_trans_retries, SHOW_SYS},
|
||||
@ -1175,6 +1188,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
|
||||
old_value= var_str->value;
|
||||
var_str->value= res;
|
||||
var_str->value_length= new_length;
|
||||
var_str->is_os_charset= FALSE;
|
||||
rw_unlock(var_mutex);
|
||||
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
|
||||
return 0;
|
||||
@ -1914,11 +1928,11 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
||||
char *str= (char*) value_ptr(thd, var_type, base);
|
||||
if (str)
|
||||
tmp= new Item_string(str, strlen(str),
|
||||
system_charset_info, DERIVATION_SYSCONST);
|
||||
charset(thd), DERIVATION_SYSCONST);
|
||||
else
|
||||
{
|
||||
tmp= new Item_null();
|
||||
tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
|
||||
tmp->collation.set(charset(thd), DERIVATION_SYSCONST);
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
return tmp;
|
||||
@ -1930,6 +1944,13 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
||||
}
|
||||
|
||||
|
||||
CHARSET_INFO *sys_var::charset(THD *thd)
|
||||
{
|
||||
return is_os_charset ? thd->variables.character_set_filesystem :
|
||||
system_charset_info;
|
||||
}
|
||||
|
||||
|
||||
bool sys_var_thd_enum::update(THD *thd, set_var *var)
|
||||
{
|
||||
if (var->type == OPT_GLOBAL)
|
||||
|
@ -46,9 +46,17 @@ public:
|
||||
|
||||
sys_after_update_func after_update;
|
||||
bool no_support_one_shot;
|
||||
/*
|
||||
true if the value is in character_set_filesystem,
|
||||
false otherwise.
|
||||
Note that we can't use a pointer to the charset as the system var is
|
||||
instantiated in global scope and the charset pointers are initialized
|
||||
later.
|
||||
*/
|
||||
bool is_os_charset;
|
||||
sys_var(const char *name_arg, sys_after_update_func func= NULL)
|
||||
:name(name_arg), after_update(func)
|
||||
, no_support_one_shot(1)
|
||||
, no_support_one_shot(1), is_os_charset(FALSE)
|
||||
{}
|
||||
virtual ~sys_var() {}
|
||||
virtual bool check(THD *thd, set_var *var);
|
||||
@ -68,6 +76,7 @@ public:
|
||||
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
virtual bool is_struct() { return 0; }
|
||||
virtual bool is_readonly() const { return 0; }
|
||||
CHARSET_INFO *charset(THD *thd);
|
||||
};
|
||||
|
||||
|
||||
@ -247,6 +256,17 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class sys_var_const_os_str: public sys_var_const_str
|
||||
{
|
||||
public:
|
||||
sys_var_const_os_str(const char *name_arg, const char *value_arg)
|
||||
:sys_var_const_str(name_arg, value_arg)
|
||||
{
|
||||
is_os_charset= TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class sys_var_const_str_ptr :public sys_var
|
||||
{
|
||||
public:
|
||||
@ -276,6 +296,17 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class sys_var_const_os_str_ptr :public sys_var_const_str_ptr
|
||||
{
|
||||
public:
|
||||
sys_var_const_os_str_ptr(const char *name_arg, char **value_arg)
|
||||
:sys_var_const_str_ptr(name_arg, value_arg)
|
||||
{
|
||||
is_os_charset= TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class sys_var_enum :public sys_var
|
||||
{
|
||||
uint *value;
|
||||
@ -791,6 +822,20 @@ public:
|
||||
bool is_readonly() const { return 1; }
|
||||
};
|
||||
|
||||
|
||||
class sys_var_readonly_os: public sys_var_readonly
|
||||
{
|
||||
public:
|
||||
sys_var_readonly_os(const char *name_arg, enum_var_type type,
|
||||
SHOW_TYPE show_type_arg,
|
||||
sys_value_ptr_func value_ptr_func_arg)
|
||||
:sys_var_readonly(name_arg, type, show_type_arg, value_ptr_func_arg)
|
||||
{
|
||||
is_os_charset= TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class sys_var_thd_time_zone :public sys_var_thd
|
||||
{
|
||||
public:
|
||||
|
@ -2102,7 +2102,10 @@ bool reopen_table(TABLE *table,bool locked)
|
||||
for (key=0 ; key < table->s->keys ; key++)
|
||||
{
|
||||
for (part=0 ; part < table->key_info[key].usable_key_parts ; part++)
|
||||
{
|
||||
table->key_info[key].key_part[part].field->table= table;
|
||||
table->key_info[key].key_part[part].field->orig_table= table;
|
||||
}
|
||||
}
|
||||
if (table->triggers)
|
||||
table->triggers->set_table(table);
|
||||
|
@ -205,6 +205,13 @@ class MYSQL_LOG: public TC_LOG
|
||||
time_t last_time,query_start;
|
||||
IO_CACHE log_file;
|
||||
IO_CACHE index_file;
|
||||
/*
|
||||
purge_temp is a temp file used in purge_logs so that the index file
|
||||
can be updated before deleting files from disk, yielding better crash
|
||||
recovery. It is created on demand the first time purge_logs is called
|
||||
and then reused for subsequent calls. It is cleaned up in cleanup().
|
||||
*/
|
||||
IO_CACHE purge_temp;
|
||||
char *name;
|
||||
char time_buff[20],db[NAME_LEN+1];
|
||||
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN];
|
||||
|
@ -85,6 +85,7 @@ class Materialized_cursor: public Server_side_cursor
|
||||
List<Item> item_list;
|
||||
ulong fetch_limit;
|
||||
ulong fetch_count;
|
||||
bool is_rnd_inited;
|
||||
public:
|
||||
Materialized_cursor(select_result *result, TABLE *table);
|
||||
|
||||
@ -191,7 +192,11 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result,
|
||||
such command is SHOW VARIABLES or SHOW STATUS.
|
||||
*/
|
||||
if (rc)
|
||||
{
|
||||
if (result_materialize->materialized_cursor)
|
||||
delete result_materialize->materialized_cursor;
|
||||
goto err_open;
|
||||
}
|
||||
|
||||
if (sensitive_cursor->is_open())
|
||||
{
|
||||
@ -532,7 +537,8 @@ Materialized_cursor::Materialized_cursor(select_result *result_arg,
|
||||
:Server_side_cursor(&table_arg->mem_root, result_arg),
|
||||
table(table_arg),
|
||||
fetch_limit(0),
|
||||
fetch_count(0)
|
||||
fetch_count(0),
|
||||
is_rnd_inited(0)
|
||||
{
|
||||
fake_unit.init_query();
|
||||
fake_unit.thd= table->in_use;
|
||||
@ -589,11 +595,12 @@ int Materialized_cursor::open(JOIN *join __attribute__((unused)))
|
||||
THD *thd= fake_unit.thd;
|
||||
int rc;
|
||||
Query_arena backup_arena;
|
||||
|
||||
thd->set_n_backup_active_arena(this, &backup_arena);
|
||||
/* Create a list of fields and start sequential scan */
|
||||
rc= (result->prepare(item_list, &fake_unit) ||
|
||||
table->file->ha_rnd_init(TRUE));
|
||||
rc= result->prepare(item_list, &fake_unit);
|
||||
if (!rc && !(rc= table->file->ha_rnd_init(TRUE)))
|
||||
is_rnd_inited= 1;
|
||||
|
||||
thd->restore_active_arena(this, &backup_arena);
|
||||
if (rc == 0)
|
||||
{
|
||||
@ -673,7 +680,8 @@ void Materialized_cursor::close()
|
||||
{
|
||||
/* Free item_list items */
|
||||
free_items();
|
||||
(void) table->file->ha_rnd_end();
|
||||
if (is_rnd_inited)
|
||||
(void) table->file->ha_rnd_end();
|
||||
/*
|
||||
We need to grab table->mem_root to prevent free_tmp_table from freeing:
|
||||
the cursor object was allocated in this memory.
|
||||
|
@ -390,11 +390,21 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array,
|
||||
{
|
||||
int res;
|
||||
nesting_map save_allow_sum_func=thd->lex->allow_sum_func ;
|
||||
/*
|
||||
Need to save the value, so we can turn off only the new NON_AGG_FIELD
|
||||
additions coming from the WHERE
|
||||
*/
|
||||
uint8 saved_flag= thd->lex->current_select->full_group_by_flag;
|
||||
DBUG_ENTER("setup_without_group");
|
||||
|
||||
thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
|
||||
res= setup_conds(thd, tables, leaves, conds);
|
||||
|
||||
/* it's not wrong to have non-aggregated columns in a WHERE */
|
||||
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
|
||||
thd->lex->current_select->full_group_by_flag= saved_flag |
|
||||
(thd->lex->current_select->full_group_by_flag & ~NON_AGG_FIELD_USED);
|
||||
|
||||
thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
|
||||
res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
|
||||
order);
|
||||
@ -1589,8 +1599,11 @@ JOIN::exec()
|
||||
(zero_result_cause?zero_result_cause:"No tables used"));
|
||||
else
|
||||
{
|
||||
result->send_fields(*columns_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
|
||||
if (result->send_fields(*columns_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
{
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
/*
|
||||
We have to test for 'conds' here as the WHERE may not be constant
|
||||
even if we don't have any tables for prepared statements or if
|
||||
@ -9434,11 +9447,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
}
|
||||
if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
|
||||
{ /* Can't calc group yet */
|
||||
((Item_sum*) item)->result_field=0;
|
||||
for (i=0 ; i < ((Item_sum*) item)->arg_count ; i++)
|
||||
Item_sum *sum_item= (Item_sum *) item;
|
||||
sum_item->result_field=0;
|
||||
for (i=0 ; i < sum_item->get_arg_count() ; i++)
|
||||
{
|
||||
Item **argp= ((Item_sum*) item)->args + i;
|
||||
Item *arg= *argp;
|
||||
Item *arg= sum_item->get_arg(i);
|
||||
if (!arg->const_item())
|
||||
{
|
||||
uint field_index= (uint) (reg_field - table->field);
|
||||
@ -9468,7 +9481,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
string_total_length+= new_field->pack_length();
|
||||
}
|
||||
thd->mem_root= mem_root_save;
|
||||
thd->change_item_tree(argp, new Item_field(new_field));
|
||||
arg= sum_item->set_arg(i, thd, new Item_field(new_field));
|
||||
thd->mem_root= &table->mem_root;
|
||||
if (!(new_field->flags & NOT_NULL_FLAG))
|
||||
{
|
||||
@ -9477,7 +9490,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
new_field->maybe_null() is still false, it will be
|
||||
changed below. But we have to setup Item_field correctly
|
||||
*/
|
||||
(*argp)->maybe_null=1;
|
||||
arg->maybe_null=1;
|
||||
}
|
||||
new_field->query_id= thd->query_id;
|
||||
}
|
||||
@ -13223,6 +13236,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
|
||||
length=0;
|
||||
for (i=0 ; i < table_count ; i++)
|
||||
{
|
||||
bool have_bit_fields= FALSE;
|
||||
uint null_fields=0,used_fields;
|
||||
|
||||
Field **f_ptr,*field;
|
||||
@ -13237,13 +13251,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
|
||||
length+=field->fill_cache_field(copy);
|
||||
if (copy->blob_field)
|
||||
(*blob_ptr++)=copy;
|
||||
if (field->maybe_null())
|
||||
if (field->real_maybe_null())
|
||||
null_fields++;
|
||||
if (field->type() == MYSQL_TYPE_BIT &&
|
||||
((Field_bit*)field)->bit_len)
|
||||
have_bit_fields= TRUE;
|
||||
copy++;
|
||||
}
|
||||
}
|
||||
/* Copy null bits from table */
|
||||
if (null_fields && tables[i].table->s->null_fields)
|
||||
if (null_fields || have_bit_fields)
|
||||
{ /* must copy null bits */
|
||||
copy->str=(char*) tables[i].table->null_flags;
|
||||
copy->length= tables[i].table->s->null_bytes;
|
||||
@ -13908,9 +13925,9 @@ count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param,
|
||||
param->quick_group=0; // UDF SUM function
|
||||
param->sum_func_count++;
|
||||
|
||||
for (uint i=0 ; i < sum_item->arg_count ; i++)
|
||||
for (uint i=0 ; i < sum_item->get_arg_count() ; i++)
|
||||
{
|
||||
if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM)
|
||||
if (sum_item->get_arg(i)->real_item()->type() == Item::FIELD_ITEM)
|
||||
param->field_count++;
|
||||
else
|
||||
param->func_count++;
|
||||
|
@ -798,7 +798,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
|
||||
{
|
||||
bool has_default;
|
||||
bool has_now_default;
|
||||
|
||||
enum enum_field_types field_type= field->type();
|
||||
/*
|
||||
We are using CURRENT_TIMESTAMP instead of NOW because it is
|
||||
more standard
|
||||
@ -806,7 +806,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
|
||||
has_now_default= table->timestamp_field == field &&
|
||||
field->unireg_check != Field::TIMESTAMP_UN_FIELD;
|
||||
|
||||
has_default= (field->type() != FIELD_TYPE_BLOB &&
|
||||
has_default= (field_type != FIELD_TYPE_BLOB &&
|
||||
!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
|
||||
field->unireg_check != Field::NEXT_NUMBER &&
|
||||
!((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40))
|
||||
@ -821,7 +821,19 @@ static bool get_field_default_value(THD *thd, TABLE *table,
|
||||
{ // Not null by default
|
||||
char tmp[MAX_FIELD_WIDTH];
|
||||
String type(tmp, sizeof(tmp), field->charset());
|
||||
field->val_str(&type);
|
||||
if (field_type == MYSQL_TYPE_BIT)
|
||||
{
|
||||
longlong dec= field->val_int();
|
||||
char *ptr= longlong2str(dec, tmp + 2, 2);
|
||||
uint32 length= (uint32) (ptr - tmp);
|
||||
tmp[0]= 'b';
|
||||
tmp[1]= '\'';
|
||||
tmp[length]= '\'';
|
||||
type.length(length + 1);
|
||||
quoted= 0;
|
||||
}
|
||||
else
|
||||
field->val_str(&type);
|
||||
if (type.length())
|
||||
{
|
||||
String def_val;
|
||||
@ -1441,6 +1453,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
char name_buffer[80];
|
||||
int len;
|
||||
LEX_STRING null_lex_str;
|
||||
CHARSET_INFO *charset= system_charset_info;
|
||||
DBUG_ENTER("show_status_array");
|
||||
|
||||
null_lex_str.str= 0; // For sys_var->value_ptr()
|
||||
@ -1469,9 +1482,10 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
long nr;
|
||||
if (show_type == SHOW_SYS)
|
||||
{
|
||||
show_type= ((sys_var*) value)->show_type();
|
||||
value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
|
||||
&null_lex_str);
|
||||
sys_var *var= ((sys_var *) value);
|
||||
show_type= var->show_type();
|
||||
value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
|
||||
charset= var->charset(thd);
|
||||
}
|
||||
|
||||
pos= end= buff;
|
||||
@ -1794,7 +1808,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
restore_record(table, s->default_values);
|
||||
table->field[0]->store(name_buffer, strlen(name_buffer),
|
||||
system_charset_info);
|
||||
table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
|
||||
table->field[1]->store(pos, (uint32) (end - pos), charset);
|
||||
if (schema_table_store_record(thd, table))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
@ -1535,7 +1535,9 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
|
||||
|
||||
if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
|
||||
{
|
||||
if (sql_field->sql_type == FIELD_TYPE_BLOB)
|
||||
if (sql_field->sql_type == FIELD_TYPE_BLOB ||
|
||||
sql_field->sql_type == FIELD_TYPE_TINY_BLOB ||
|
||||
sql_field->sql_type == FIELD_TYPE_MEDIUM_BLOB)
|
||||
{
|
||||
/* The user has given a length to the blob column */
|
||||
sql_field->sql_type= get_blob_type_from_length(sql_field->length);
|
||||
|
@ -1249,6 +1249,32 @@ multi_update::initialize_tables(JOIN *join)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
enable uncacheable flag if we update a view with check option
|
||||
and check option has a subselect, otherwise, the check option
|
||||
can be evaluated after the subselect was freed as independent
|
||||
(See full_local in JOIN::join_free()).
|
||||
*/
|
||||
if (table_ref->check_option && !join->select_lex->uncacheable)
|
||||
{
|
||||
SELECT_LEX_UNIT *tmp_unit;
|
||||
SELECT_LEX *sl;
|
||||
for (tmp_unit= join->select_lex->first_inner_unit();
|
||||
tmp_unit;
|
||||
tmp_unit= tmp_unit->next_unit())
|
||||
{
|
||||
for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
|
||||
{
|
||||
if (sl->master_unit()->item)
|
||||
{
|
||||
join->select_lex->uncacheable|= UNCACHEABLE_CHECKOPTION;
|
||||
goto loop_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
loop_end:
|
||||
|
||||
if (table == first_table_for_update && table_ref->check_option)
|
||||
{
|
||||
table_map unupdated_tables= table_ref->check_option->used_tables() &
|
||||
|
@ -980,13 +980,14 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
if (table->use_index || table->ignore_index)
|
||||
List<String> *index_list= table->use_index ? table->use_index
|
||||
: table->ignore_index;
|
||||
if (index_list)
|
||||
{
|
||||
my_error(ER_WRONG_USAGE, MYF(0),
|
||||
table->ignore_index ? "IGNORE INDEX" :
|
||||
(table->force_index ? "FORCE INDEX" : "USE INDEX"),
|
||||
"VIEW");
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_ASSERT(index_list->head()); // should never fail
|
||||
my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), index_list->head()->c_ptr(),
|
||||
table->table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/* check loop via view definition */
|
||||
|
@ -1073,6 +1073,7 @@ Time_zone_system::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
|
||||
localtime_r(&tmp_t, &tmp_tm);
|
||||
localtime_to_TIME(tmp, &tmp_tm);
|
||||
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
|
||||
adjust_leap_second(tmp);
|
||||
}
|
||||
|
||||
|
||||
@ -1157,6 +1158,7 @@ Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
|
||||
gmtime_r(&tmp_t, &tmp_tm);
|
||||
localtime_to_TIME(tmp, &tmp_tm);
|
||||
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
|
||||
adjust_leap_second(tmp);
|
||||
}
|
||||
|
||||
|
||||
@ -1260,6 +1262,7 @@ void
|
||||
Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
|
||||
{
|
||||
::gmt_sec_to_TIME(tmp, t, tz_info);
|
||||
adjust_leap_second(tmp);
|
||||
}
|
||||
|
||||
|
||||
@ -2373,6 +2376,25 @@ Time_zone *my_tz_find_with_opening_tz_tables(THD *thd, const String *name)
|
||||
DBUG_RETURN(tz);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Convert leap seconds into non-leap
|
||||
|
||||
This function will convert the leap seconds added by the OS to
|
||||
non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ...
|
||||
This check is not checking for years on purpose : although it's not a
|
||||
complete check this way it doesn't require looking (and having installed)
|
||||
the leap seconds table.
|
||||
|
||||
@param[in,out] broken down time structure as filled in by the OS
|
||||
*/
|
||||
|
||||
void Time_zone::adjust_leap_second(MYSQL_TIME *t)
|
||||
{
|
||||
if (t->second == 60 || t->second == 61)
|
||||
t->second= 59;
|
||||
}
|
||||
|
||||
#endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
|
||||
|
||||
|
||||
|
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