mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Proper fix for comparision with ' '
(Bug #7788 "Table is full" occurs during a multitable update") client/mysqldump.c: Style fixes innobase/include/univ.i: UNIV_DEBUG should not depend on configure --debug but on --debug=full mysql-test/r/compare.result: Added test to find bug in previous bugfix mysql-test/t/compare.test: Added test to find bug in previous bugfix mysys/my_handler.c: Proper fix for comparision with ' ' strings/ctype-big5.c: Proper fix for comparision with ' ' strings/ctype-bin.c: Proper fix for comparision with ' ' strings/ctype-gbk.c: Proper fix for comparision with ' ' strings/ctype-latin1.c: Proper fix for comparision with ' ' strings/ctype-mb.c: Proper fix for comparision with ' ' strings/ctype-simple.c: Proper fix for comparision with ' ' strings/ctype-sjis.c: Proper fix for comparision with ' ' strings/ctype-tis620.c: Proper fix for comparision with ' ' strings/ctype-ucs2.c: Proper fix for comparision with ' ' strings/ctype-utf8.c: Proper fix for comparision with ' '
This commit is contained in:
@ -2091,27 +2091,27 @@ static int dump_all_tables_in_db(char *database)
|
|||||||
RETURN
|
RETURN
|
||||||
void
|
void
|
||||||
*/
|
*/
|
||||||
static void get_actual_table_name( const char *old_table_name,
|
|
||||||
char *new_table_name,
|
static void get_actual_table_name(const char *old_table_name,
|
||||||
int buf_size )
|
char *new_table_name,
|
||||||
|
int buf_size)
|
||||||
{
|
{
|
||||||
MYSQL_RES *tableRes;
|
MYSQL_RES *tableRes;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
char query[ NAME_LEN + 50 ];
|
char query[ NAME_LEN + 50 ];
|
||||||
|
DBUG_ENTER("get_actual_table_name");
|
||||||
|
|
||||||
DBUG_ENTER("get_actual_table_name");
|
sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name);
|
||||||
|
if (mysql_query_with_error_report(sock, 0, query))
|
||||||
|
{
|
||||||
|
safe_exit(EX_MYSQLERR);
|
||||||
|
}
|
||||||
|
|
||||||
sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name );
|
tableRes= mysql_store_result( sock );
|
||||||
if (mysql_query_with_error_report(sock, 0, query))
|
row= mysql_fetch_row( tableRes );
|
||||||
{
|
strmake(new_table_name, row[0], buf_size-1);
|
||||||
safe_exit(EX_MYSQLERR);
|
mysql_free_result(tableRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
tableRes = mysql_store_result( sock );
|
|
||||||
row = mysql_fetch_row( tableRes );
|
|
||||||
strncpy( new_table_name, row[0], buf_size );
|
|
||||||
mysql_free_result(tableRes);
|
|
||||||
} /* get_actual_table_name */
|
|
||||||
|
|
||||||
|
|
||||||
static int dump_selected_tables(char *db, char **table_names, int tables)
|
static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||||
|
@ -80,10 +80,6 @@ memory is read outside the allocated blocks. */
|
|||||||
|
|
||||||
/* Make a non-inline debug version */
|
/* Make a non-inline debug version */
|
||||||
|
|
||||||
#ifdef DBUG_ON
|
|
||||||
#define UNIV_DEBUG
|
|
||||||
#endif /* DBUG_ON */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define UNIV_DEBUG
|
#define UNIV_DEBUG
|
||||||
#define UNIV_MEM_DEBUG
|
#define UNIV_MEM_DEBUG
|
||||||
|
@ -39,3 +39,6 @@ DROP TABLE t1;
|
|||||||
SELECT CHAR(31) = '', '' = CHAR(31);
|
SELECT CHAR(31) = '', '' = CHAR(31);
|
||||||
CHAR(31) = '' '' = CHAR(31)
|
CHAR(31) = '' '' = CHAR(31)
|
||||||
0 0
|
0 0
|
||||||
|
SELECT CHAR(30) = '', '' = CHAR(30);
|
||||||
|
CHAR(30) = '' '' = CHAR(30)
|
||||||
|
0 0
|
||||||
|
@ -33,3 +33,5 @@ DROP TABLE t1;
|
|||||||
|
|
||||||
# Bug #8134: Comparison against CHAR(31) at end of string
|
# Bug #8134: Comparison against CHAR(31) at end of string
|
||||||
SELECT CHAR(31) = '', '' = CHAR(31);
|
SELECT CHAR(31) = '', '' = CHAR(31);
|
||||||
|
# Extra test
|
||||||
|
SELECT CHAR(30) = '', '' = CHAR(30);
|
||||||
|
@ -43,7 +43,7 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
|
|||||||
return 0;
|
return 0;
|
||||||
if (skip_end_space && a_length != b_length)
|
if (skip_end_space && a_length != b_length)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
We are using space compression. We have to check if longer key
|
We are using space compression. We have to check if longer key
|
||||||
has next character < ' ', in which case it's less than the shorter
|
has next character < ' ', in which case it's less than the shorter
|
||||||
@ -57,12 +57,12 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
|
|||||||
/* put shorter key in a */
|
/* put shorter key in a */
|
||||||
a_length= b_length;
|
a_length= b_length;
|
||||||
a= b;
|
a= b;
|
||||||
swap= -1 ^ 1; /* swap sign of result */
|
swap= -1; /* swap sign of result */
|
||||||
}
|
}
|
||||||
for (end= a + a_length-length; a < end ; a++)
|
for (end= a + a_length-length; a < end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
if (!res && a_length != b_length)
|
if (!res && a_length != b_length)
|
||||||
{
|
{
|
||||||
const uchar *end;
|
const uchar *end;
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -286,7 +286,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
for (end= a + a_length-length; a < end ; a++)
|
for (end= a + a_length-length; a < end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -157,7 +157,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
if (a_length != b_length)
|
if (a_length != b_length)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -172,7 +172,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
for (end= a + a_length-length; a < end ; a++)
|
for (end= a + a_length-length; a < end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2632,7 +2632,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
if (!res && a_length != b_length)
|
if (!res && a_length != b_length)
|
||||||
{
|
{
|
||||||
const uchar *end;
|
const uchar *end;
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -2647,7 +2647,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
for (end= a + a_length-length; a < end ; a++)
|
for (end= a + a_length-length; a < end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -611,7 +611,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
|
|
||||||
if (a != a_end || b != b_end)
|
if (a != a_end || b != b_end)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -626,7 +626,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
for ( ; a < a_end ; a++)
|
for ( ; a < a_end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -389,7 +389,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
if (a_length != b_length)
|
if (a_length != b_length)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -404,7 +404,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
for (end= a + a_length-length; a < end ; a++)
|
for (end= a + a_length-length; a < end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -143,7 +143,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
|
|||||||
}
|
}
|
||||||
if (a_length != b_length)
|
if (a_length != b_length)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -153,12 +153,12 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
|
|||||||
/* put shorter key in s */
|
/* put shorter key in s */
|
||||||
a_length= b_length;
|
a_length= b_length;
|
||||||
a= b;
|
a= b;
|
||||||
swap= -1^1; /* swap sign of result */
|
swap= -1; /* swap sign of result */
|
||||||
}
|
}
|
||||||
for (end= a + a_length-length; a < end ; a++)
|
for (end= a + a_length-length; a < end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -251,7 +251,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length);
|
int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length);
|
||||||
if (!res && (a != a_end || b != b_end))
|
if (!res && (a != a_end || b != b_end))
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -266,7 +266,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
for (; a < a_end ; a++)
|
for (; a < a_end ; a++)
|
||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
return ((int) *a - (int) ' ') ^ swap;
|
return (*a < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -589,7 +589,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
if (a_length != b_length)
|
if (a_length != b_length)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
/*
|
/*
|
||||||
Check the next not space character of the longer key. If it's < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
@ -605,7 +605,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
if (*a != ' ')
|
if (*a != ' ')
|
||||||
{
|
{
|
||||||
res= ((int) *a - (int) ' ') ^ swap;
|
res= (*a < ' ') ? -swap : swap;
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
|
|
||||||
if (slen != tlen)
|
if (slen != tlen)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
if (slen < tlen)
|
if (slen < tlen)
|
||||||
{
|
{
|
||||||
s= t;
|
s= t;
|
||||||
@ -286,7 +286,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
for ( ; s < se ; s+= 2)
|
for ( ; s < se ; s+= 2)
|
||||||
{
|
{
|
||||||
if (s[0] || s[1] != ' ')
|
if (s[0] || s[1] != ' ')
|
||||||
return (((int)s[0] << 8) + (int) s[1] - (int) ' ') ^ swap;
|
return (s[0] == 0 && s[1] < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2077,7 +2077,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
|
|||||||
|
|
||||||
if (slen != tlen)
|
if (slen != tlen)
|
||||||
{
|
{
|
||||||
int swap= 0;
|
int swap= 1;
|
||||||
if (slen < tlen)
|
if (slen < tlen)
|
||||||
{
|
{
|
||||||
slen= tlen;
|
slen= tlen;
|
||||||
@ -2098,7 +2098,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
|
|||||||
for ( ; s < se; s++)
|
for ( ; s < se; s++)
|
||||||
{
|
{
|
||||||
if (*s != ' ')
|
if (*s != ' ')
|
||||||
return ((int)*s - (int) ' ') ^ swap;
|
return (*s < ' ') ? -swap : swap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user