summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-02-01 16:27:08 +0200
committerunknown <monty@mysql.com>2005-02-01 16:27:08 +0200
commitc53184ebb775290d2e0f8397815832f1c84a8a5c (patch)
tree7c6914d5b5f63b475e8b75119e24cfccb97f40c8
parente5d8e72a78c75c37c7b5fdd88dce295e861c0659 (diff)
downloadmariadb-git-c53184ebb775290d2e0f8397815832f1c84a8a5c.tar.gz
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 ' '
-rw-r--r--client/mysqldump.c36
-rw-r--r--innobase/include/univ.i4
-rw-r--r--mysql-test/r/compare.result3
-rw-r--r--mysql-test/t/compare.test2
-rw-r--r--mysys/my_handler.c6
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-bin.c4
-rw-r--r--strings/ctype-gbk.c4
-rw-r--r--strings/ctype-latin1.c4
-rw-r--r--strings/ctype-mb.c4
-rw-r--r--strings/ctype-simple.c6
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-tis620.c4
-rw-r--r--strings/ctype-ucs2.c4
-rw-r--r--strings/ctype-utf8.c4
15 files changed, 47 insertions, 46 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index afaa2dc5a6d..52255ccb896 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -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 )
-{
- MYSQL_RES *tableRes;
- MYSQL_ROW row;
- char query[ NAME_LEN + 50 ];
- DBUG_ENTER("get_actual_table_name");
+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 ];
+ 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)
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index 6ae4fe1c2ce..625978ffc38 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -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
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index 49ec2dd85cc..6f667aabac0 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -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
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index e3c042e608a..bc20786227b 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -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);
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index df1e9e55e0a..5ee181ca78e 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -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;
}
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 997b8ce93d6..270b02212af 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -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;
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 95c52512243..618879607ec 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -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;
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 731ad58a2fb..9daa9f90f3c 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -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;
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index 32d9a227c2f..4ab101add5b 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -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;
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 731fc460cef..6cf48291c91 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -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;
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 4dc6a1be27b..1a09b16a264 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -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;
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index c0b33a13cdd..0cb30a9b6ee 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -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;
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 3a43c556ac8..6a6c55d214e 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -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;
}
}
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 936e2b6fdce..ea11f8816a5 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -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;
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 502d0ec285e..486d428bf1d 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -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;