summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-08-12 17:10:00 +0500
committerunknown <bar@mysql.com>2005-08-12 17:10:00 +0500
commit8685497a3f2467fb3929d633d5104782142c5362 (patch)
tree837691783e69d447d573b714d65381b20a31dd69
parent36283ca2f09569fa1f1c7aabfcce4a188a17ad60 (diff)
parent058d5bff6e73eb4b9b36cb0bb82687557e3c317d (diff)
downloadmariadb-git-8685497a3f2467fb3929d633d5104782142c5362.tar.gz
Merge mysql.com:/usr/home/bar/mysql-4.1.b12351
into mysql.com:/usr/home/bar/mysql-5.0 client/mysqlcheck.c: Auto merged mysql-test/r/func_system.result: Auto merged sql/item_strfunc.cc: Auto merged
-rw-r--r--client/mysqlcheck.c11
-rw-r--r--mysql-test/r/func_system.result15
-rw-r--r--mysql-test/t/func_system.test12
-rw-r--r--sql/item_strfunc.cc1
4 files changed, 36 insertions, 3 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index c767f1c89b7..465213cce50 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -575,8 +575,13 @@ static void print_result()
if (status)
{
+ /*
+ if there was an error with the table, we have --auto-repair set,
+ and this isn't a repair op, then add the table to the tables4repair
+ list
+ */
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
- (!opt_fast || strcmp(row[3],"OK")))
+ strcmp(row[3],"OK"))
insert_dynamic(&tables4repair, prev);
found_error=0;
if (opt_silent)
@@ -595,8 +600,8 @@ static void print_result()
strmov(prev, row[0]);
putchar('\n');
}
- if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
- !opt_fast)
+ /* add the last table to be repaired to the list */
+ if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
insert_dynamic(&tables4repair, prev);
mysql_free_result(res);
}
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 5ec5d7d724e..1c1c6dff21e 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -68,6 +68,21 @@ drop table t1;
select TRUE,FALSE,NULL;
TRUE FALSE NULL
1 0 NULL
+create table t1 (c1 char(5)) character set=latin1;
+insert into t1 values('row 1');
+insert into t1 values('row 2');
+insert into t1 values('row 3');
+select concat(user(), '--', c1) from t1;
+concat(user(), '--', c1)
+root@localhost--row 1
+root@localhost--row 2
+root@localhost--row 3
+select concat(database(), '--', c1) from t1;
+concat(database(), '--', c1)
+test--row 1
+test--row 2
+test--row 3
+drop table t1;
create table t1 (a char(10)) character set latin1;
select * from t1 where a=version();
a
diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test
index d7e215f5d48..4a526935491 100644
--- a/mysql-test/t/func_system.test
+++ b/mysql-test/t/func_system.test
@@ -32,6 +32,18 @@ drop table t1;
select TRUE,FALSE,NULL;
#
+# Bug#12351: CONCAT with USER()/DATEBASE() and
+# a constant and a column gets strange results
+#
+create table t1 (c1 char(5)) character set=latin1;
+insert into t1 values('row 1');
+insert into t1 values('row 2');
+insert into t1 values('row 3');
+select concat(user(), '--', c1) from t1;
+select concat(database(), '--', c1) from t1;
+drop table t1;
+
+#
# Bug#8291 Illegal collation mix with USER() function
#
create table t1 (a char(10)) character set latin1;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 39e74acb2e9..11c763ee173 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1570,6 +1570,7 @@ Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs)
return NULL;
}
conv->str_value.copy();
+ conv->str_value.shrink_to_length();
return conv;
}