mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Proper fix for comparision with ' '
(Bug #7788 "Table is full" occurs during a multitable update")
This commit is contained in:
parent
dabb56a7cb
commit
b87e0c52a7
15 changed files with 47 additions and 46 deletions
|
@ -2091,27 +2091,27 @@ static int dump_all_tables_in_db(char *database)
|
|||
RETURN
|
||||
void
|
||||
*/
|
||||
static void get_actual_table_name( const char *old_table_name,
|
||||
char *new_table_name,
|
||||
int buf_size )
|
||||
|
||||
static void get_actual_table_name(const char *old_table_name,
|
||||
char *new_table_name,
|
||||
int buf_size)
|
||||
{
|
||||
MYSQL_RES *tableRes;
|
||||
MYSQL_ROW row;
|
||||
char query[ NAME_LEN + 50 ];
|
||||
MYSQL_RES *tableRes;
|
||||
MYSQL_ROW row;
|
||||
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 );
|
||||
if (mysql_query_with_error_report(sock, 0, query))
|
||||
{
|
||||
safe_exit(EX_MYSQLERR);
|
||||
}
|
||||
|
||||
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 */
|
||||
tableRes= mysql_store_result( sock );
|
||||
row= mysql_fetch_row( tableRes );
|
||||
strmake(new_table_name, row[0], buf_size-1);
|
||||
mysql_free_result(tableRes);
|
||||
}
|
||||
|
||||
|
||||
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 */
|
||||
|
||||
#ifdef DBUG_ON
|
||||
#define UNIV_DEBUG
|
||||
#endif /* DBUG_ON */
|
||||
|
||||
/*
|
||||
#define UNIV_DEBUG
|
||||
#define UNIV_MEM_DEBUG
|
||||
|
|
|
@ -39,3 +39,6 @@ DROP TABLE t1;
|
|||
SELECT CHAR(31) = '', '' = CHAR(31);
|
||||
CHAR(31) = '' '' = CHAR(31)
|
||||
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
|
||||
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;
|
||||
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
|
||||
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 */
|
||||
a_length= b_length;
|
||||
a= b;
|
||||
swap= -1 ^ 1; /* swap sign of result */
|
||||
swap= -1; /* swap sign of result */
|
||||
}
|
||||
for (end= a + a_length-length; a < end ; a++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
|
|||
if (!res && a_length != b_length)
|
||||
{
|
||||
const uchar *end;
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
/*
|
||||
Check the next not space character of the longer key. If it's < ' ',
|
||||
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++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -157,7 +157,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||
}
|
||||
if (a_length != b_length)
|
||||
{
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
/*
|
||||
Check the next not space character of the longer key. If it's < ' ',
|
||||
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++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -2632,7 +2632,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
|
|||
if (!res && a_length != b_length)
|
||||
{
|
||||
const uchar *end;
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
/*
|
||||
Check the next not space character of the longer key. If it's < ' ',
|
||||
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++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -611,7 +611,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
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 < ' ',
|
||||
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++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -389,7 +389,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||
}
|
||||
if (a_length != b_length)
|
||||
{
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
/*
|
||||
Check the next not space character of the longer key. If it's < ' ',
|
||||
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++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -143,7 +143,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_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 < ' ',
|
||||
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 */
|
||||
a_length= b_length;
|
||||
a= b;
|
||||
swap= -1^1; /* swap sign of result */
|
||||
swap= -1; /* swap sign of result */
|
||||
}
|
||||
for (end= a + a_length-length; a < end ; a++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
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);
|
||||
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 < ' ',
|
||||
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++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
return (*a < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -589,7 +589,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
|||
}
|
||||
if (a_length != b_length)
|
||||
{
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
/*
|
||||
Check the next not space character of the longer key. If it's < ' ',
|
||||
then it's smaller than the other key.
|
||||
|
@ -605,7 +605,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
|||
{
|
||||
if (*a != ' ')
|
||||
{
|
||||
res= ((int) *a - (int) ' ') ^ swap;
|
||||
res= (*a < ' ') ? -swap : swap;
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
if (slen != tlen)
|
||||
{
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
if (slen < tlen)
|
||||
{
|
||||
s= t;
|
||||
|
@ -286,7 +286,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||
for ( ; s < se ; s+= 2)
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -2077,7 +2077,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
|
|||
|
||||
if (slen != tlen)
|
||||
{
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
if (slen < tlen)
|
||||
{
|
||||
slen= tlen;
|
||||
|
@ -2098,7 +2098,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
|
|||
for ( ; s < se; s++)
|
||||
{
|
||||
if (*s != ' ')
|
||||
return ((int)*s - (int) ' ') ^ swap;
|
||||
return (*s < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue