summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <iggy@rolltop.ignatz42.dyndns.org>2006-08-16 19:31:33 -0400
committerunknown <iggy@rolltop.ignatz42.dyndns.org>2006-08-16 19:31:33 -0400
commitb2cfa703f4799e68bc41dd651e30d4057b5c7076 (patch)
tree09113ee1ad0f3a06c7c13659f66d5e2d71dccbca
parent90b069ed34c293f7eb55f7827dd9fd086ff78015 (diff)
parent4934231545c994b90517b2c1b4c9b85b4fbe2018 (diff)
downloadmariadb-git-b2cfa703f4799e68bc41dd651e30d4057b5c7076.tar.gz
Merge rolltop.ignatz42.dyndns.org:/mnt/storeage/mysql-4.1-maint_20328
into rolltop.ignatz42.dyndns.org:/mnt/storeage/mysql-5.0-merge sql/item_timefunc.cc: Auto merged sql/slave.cc: Auto merged mysql-test/r/func_time.result: manual merge mysql-test/r/mysql_client.result: manual merge mysql-test/t/func_time.test: manual merge mysql-test/t/mysql_client.test: manual merge sql/sql_acl.cc: manual merge
-rw-r--r--mysql-test/r/func_time.result21
-rw-r--r--mysql-test/r/mysql_client.result48
-rw-r--r--mysql-test/t/func_time.test20
-rw-r--r--mysql-test/t/mysql_client.test7
-rw-r--r--sql/item_timefunc.cc6
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_acl.cc27
7 files changed, 74 insertions, 57 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index c7db2fc6364..b9533104b76 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -891,6 +891,27 @@ t1 CREATE TABLE `t1` (
`from_unixtime(1) + 0` double(23,6) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
+H
+120
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
+H
+120
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
+H
+05
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
+H
+5
+End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/mysql_client.result b/mysql-test/r/mysql_client.result
index 01a8c731bc9..a20bd60aaf3 100644
--- a/mysql-test/r/mysql_client.result
+++ b/mysql-test/r/mysql_client.result
@@ -2,54 +2,6 @@
1
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ERROR at line 1: USE must be followed by a database name
-? (\?) Synonym for `help'.
-clear (\c) Clear command.
-connect (\r) Reconnect to the server. Optional arguments are db and host.
-delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
-edit (\e) Edit command with $EDITOR.
-ego (\G) Send command to mysql server, display result vertically.
-exit (\q) Exit mysql. Same as quit.
-go (\g) Send command to mysql server.
-help (\h) Display this help.
-nopager (\n) Disable pager, print to stdout.
-notee (\t) Don't write into outfile.
-pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
-print (\p) Print current command.
-prompt (\R) Change your mysql prompt.
-quit (\q) Quit mysql.
-rehash (\#) Rebuild completion hash.
-source (\.) Execute an SQL script file. Takes a file name as an argument.
-status (\s) Get status information from the server.
-system (\!) Execute a system shell command.
-tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
-use (\u) Use another database. Takes database name as argument.
-charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
-warnings (\W) Show warnings after every statement.
-nowarning (\w) Don't show warnings after every statement.
-? (\?) Synonym for `help'.
-clear (\c) Clear command.
-connect (\r) Reconnect to the server. Optional arguments are db and host.
-delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
-edit (\e) Edit command with $EDITOR.
-ego (\G) Send command to mysql server, display result vertically.
-exit (\q) Exit mysql. Same as quit.
-go (\g) Send command to mysql server.
-help (\h) Display this help.
-nopager (\n) Disable pager, print to stdout.
-notee (\t) Don't write into outfile.
-pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
-print (\p) Print current command.
-prompt (\R) Change your mysql prompt.
-quit (\q) Quit mysql.
-rehash (\#) Rebuild completion hash.
-source (\.) Execute an SQL script file. Takes a file name as an argument.
-status (\s) Get status information from the server.
-system (\!) Execute a system shell command.
-tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
-use (\u) Use another database. Takes database name as argument.
-charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
-warnings (\W) Show warnings after every statement.
-nowarning (\w) Don't show warnings after every statement.
\
\\
';
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index c95d3e3319a..0945c3ab33e 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -446,7 +446,25 @@ create table t1 select now() - now(), curtime() - curtime(),
show create table t1;
drop table t1;
-# End of 4.1 tests
+#
+# Bug #19844 time_format in Union truncates values
+#
+
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
+
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
+
+--echo End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test
index 7953e0b6550..e960e449fea 100644
--- a/mysql-test/t/mysql_client.test
+++ b/mysql-test/t/mysql_client.test
@@ -29,10 +29,9 @@
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
#
-# Bug #20328: mysql client interprets commands in comments
-#
---exec echo 'help' | $MYSQL
---exec echo 'help ' | $MYSQL
+# Bug #20328: mysql client: dumb about trailing spaces on 'help' command
+--exec echo 'help' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
+--exec echo 'help ' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
#
# Bug #20103: Escaping with backslash does not work
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 835be6554bc..babfdc6a180 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1704,14 +1704,12 @@ uint Item_func_date_format::format_length(const String *format)
case 'u': /* week (00..52), where week starts with Monday */
case 'V': /* week 1..53 used with 'x' */
case 'v': /* week 1..53 used with 'x', where week starts with Monday */
- case 'H': /* hour (00..23) */
case 'y': /* year, numeric, 2 digits */
case 'm': /* month, numeric */
case 'd': /* day (of the month), numeric */
case 'h': /* hour (01..12) */
case 'I': /* --||-- */
case 'i': /* minutes, numeric */
- case 'k': /* hour ( 0..23) */
case 'l': /* hour ( 1..12) */
case 'p': /* locale's AM or PM */
case 'S': /* second (00..61) */
@@ -1720,6 +1718,10 @@ uint Item_func_date_format::format_length(const String *format)
case 'e': /* day (0..31) */
size += 2;
break;
+ case 'k': /* hour ( 0..23) */
+ case 'H': /* hour (00..23; value > 23 OK, padding always 2-digit) */
+ size += 7; /* docs allow > 23, range depends on sizeof(unsigned int) */
+ break;
case 'r': /* time, 12-hour (hh:mm:ss [AP]M) */
size += 11;
break;
diff --git a/sql/slave.cc b/sql/slave.cc
index 8bcaa6be102..55cff94a179 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3226,7 +3226,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
rli->is_until_satisfied())
{
char buf[22];
- sql_print_error("Slave SQL thread stopped because it reached its"
+ sql_print_information("Slave SQL thread stopped because it reached its"
" UNTIL position %s", llstr(rli->until_pos(), buf));
/*
Setting abort_slave flag because we do not want additional message about
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 6e25878671d..f95cfd5e37c 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -4693,6 +4693,32 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
DBUG_RETURN(0);
}
+ACL_USER *check_acl_user(LEX_USER *user_name,
+ uint *acl_acl_userdx)
+{
+ ACL_USER *acl_user= 0;
+ uint counter;
+
+ safe_mutex_assert_owner(&acl_cache->lock);
+
+ for (counter= 0 ; counter < acl_users.elements ; counter++)
+ {
+ const char *user,*host;
+ acl_user= dynamic_element(&acl_users, counter, ACL_USER*);
+ if (!(user=acl_user->user))
+ user= "";
+ if (!(host=acl_user->host.hostname))
+ host= "";
+ if (!strcmp(user_name->user.str,user) &&
+ !my_strcasecmp(system_charset_info, user_name->host.str, host))
+ break;
+ }
+ if (counter == acl_users.elements)
+ return 0;
+
+ *acl_acl_userdx= counter;
+ return acl_user;
+}
/*
Modify a privilege table.
@@ -4741,7 +4767,6 @@ static int modify_grant_table(TABLE *table, Field *host_field,
DBUG_RETURN(error);
}
-
/*
Handle a privilege table.