Commit 1b6858ea authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.1

into  zippy.cornsilk.net:/home/cmiller/work/mysql/merge/mysql-5.1

parents bfaef559 167aaaa5
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff);
static void mysql_end_timer(ulong start_time,char *buff);
static void nice_time(double sec,char *buff,bool part_second);
static sig_handler mysql_end(int sig);
static sig_handler handle_sigint(int sig);
static sig_handler mysql_sigint(int sig);

int main(int argc,char *argv[])
{
@@ -420,7 +420,8 @@ int main(int argc,char *argv[])
  if (opt_sigint_ignore)
    signal(SIGINT, SIG_IGN);
  else
    signal(SIGINT, handle_sigint);              // Catch SIGINT to clean up
    signal(SIGINT, mysql_sigint);		// Catch SIGINT to clean up

  signal(SIGQUIT, mysql_end);			// Catch SIGQUIT to clean up

  /*
@@ -488,6 +489,28 @@ int main(int argc,char *argv[])
#endif
}

sig_handler mysql_sigint(int sig)
{
  char kill_buffer[40];
  MYSQL *kill_mysql= NULL;

  signal(SIGINT, mysql_sigint);

  /* terminate if no query being executed, or we already tried interrupting */
  if (!executing_query || interrupted_query++)
    mysql_end(sig);

  kill_mysql= mysql_init(kill_mysql);
  if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
                          "", opt_mysql_port, opt_mysql_unix_port,0))
    mysql_end(sig);
  /* kill_buffer is always big enough because max length of %lu is 15 */
  sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
  mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
  mysql_close(kill_mysql);
  tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
}

sig_handler mysql_end(int sig)
{
  mysql_close(&mysql);
@@ -1035,6 +1058,8 @@ static int read_and_execute(bool interactive)
      if (opt_outfile && glob_buffer.is_empty())
	fflush(OUTFILE);

      interrupted_query= 0;

#if defined( __WIN__) || defined(__NETWARE__)
      tee_fputs(prompt, stdout);
#if defined(__NETWARE__)
@@ -2016,7 +2041,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
  }

  timer=start_timer();

  executing_query= 1;

  error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());

#ifdef HAVE_READLINE
@@ -2032,6 +2059,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
  {
    executing_query= 0;
    buffer->length(0); // Remove query on error
    executing_query= 0;
    return error;
  }
  error=0;
@@ -2115,6 +2143,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
      fflush(stdout);
    mysql_free_result(result);
  } while (!(err= mysql_next_result(&mysql)));

  executing_query= 0;

  if (err >= 1)
    error= put_error(&mysql);

+16 −12
Original line number Diff line number Diff line
@@ -1320,30 +1320,34 @@ sub executable_setup () {

sub environment_setup () {

  my $extra_ld_library_paths;
  umask(022);

  # --------------------------------------------------------------------------
  # We might not use a standard installation directory, like /usr/lib.
  # Set LD_LIBRARY_PATH to make sure we find our installed libraries.
  # Setup LD_LIBRARY_PATH so the libraries from this distro/clone
  # are used in favor of the system installed ones
  # --------------------------------------------------------------------------

  unless ( $opt_source_dist )
  if ( $opt_source_dist )
  {
    $ENV{'LD_LIBRARY_PATH'}=
      "$glob_basedir/lib" .
        ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
    $ENV{'DYLD_LIBRARY_PATH'}=
      "$glob_basedir/lib" .
        ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
    $extra_ld_library_paths= "$glob_basedir/libmysql/.libs/";
  }
  else
  {
    $extra_ld_library_paths= "$glob_basedir/lib";
  }

  # --------------------------------------------------------------------------
  # Add the path where mysqld will find udf_example.so
  # --------------------------------------------------------------------------
  $extra_ld_library_paths .= ":" .
    ($lib_udf_example ?  dirname($lib_udf_example) : "");

  $ENV{'LD_LIBRARY_PATH'}=
    ($lib_udf_example ?  dirname($lib_udf_example) : "") .
    "$extra_ld_library_paths" .
      ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");

  $ENV{'DYLD_LIBRARY_PATH'}=
    "$extra_ld_library_paths" .
      ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");

  # --------------------------------------------------------------------------
  # Also command lines in .opt files may contain env vars
+20 −0
Original line number Diff line number Diff line
@@ -891,6 +891,26 @@ 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;
+78 −0
Original line number Diff line number Diff line
@@ -870,3 +870,81 @@ insert into mysql.user select * from t2;
flush privileges;
drop table t2;
drop table t1;
CREATE DATABASE mysqltest3;
use mysqltest3;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW  v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2;
use mysqltest2;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW  v_nn AS SELECT * FROM t_nn;
CREATE VIEW  v_yn AS SELECT * FROM t_nn;
CREATE VIEW  v_gy AS SELECT * FROM t_nn;
CREATE VIEW  v_ny AS SELECT * FROM t_nn;
CREATE VIEW  v_yy AS SELECT * FROM t_nn WHERE c1=55;
GRANT SHOW VIEW        ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SELECT           ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SELECT           ON mysqltest2.*    TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
SHOW CREATE VIEW  mysqltest2.v_nn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE TABLE mysqltest2.v_nn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE VIEW  mysqltest2.v_yn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn'
SHOW CREATE TABLE mysqltest2.v_yn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn'
SHOW CREATE TABLE mysqltest2.v_ny;
View	Create View
v_ny	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn`
SHOW CREATE VIEW  mysqltest2.v_ny;
View	Create View
v_ny	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn`
SHOW CREATE TABLE mysqltest3.t_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
SHOW CREATE VIEW  mysqltest3.t_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
SHOW CREATE VIEW  mysqltest3.v_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE TABLE mysqltest3.v_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE TABLE mysqltest2.t_nn;
Table	Create Table
t_nn	CREATE TABLE `t_nn` (
  `c1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW  mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
SHOW CREATE VIEW mysqltest2.v_yy;
View	Create View
v_yy	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55)
SHOW CREATE TABLE mysqltest2.v_yy;
View	Create View
v_yy	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55)
SHOW CREATE TABLE mysqltest2.v_nn;
View	Create View
v_nn	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn`
SHOW CREATE VIEW  mysqltest2.v_nn;
View	Create View
v_nn	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn`
SHOW CREATE TABLE mysqltest2.t_nn;
Table	Create Table
t_nn	CREATE TABLE `t_nn` (
  `c1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
DROP VIEW  mysqltest2.v_nn;
DROP VIEW  mysqltest2.v_yn;
DROP VIEW  mysqltest2.v_ny;
DROP VIEW  mysqltest2.v_yy;
DROP TABLE mysqltest2.t_nn;
DROP DATABASE mysqltest2;
DROP VIEW  mysqltest3.v_nn;
DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
create user mysqltest1_thisisreallytoolong;
ERROR HY000: Operation CREATE USER failed for 'mysqltest1_thisisreallytoolong'@'%'
End of 5.0 tests
+8 −0
Original line number Diff line number Diff line
@@ -114,4 +114,12 @@ a int(11) YES NULL
b	varchar(255)	YES		NULL	
c	int(11)	YES		NULL	
drop table t1;
1
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
\
\\
';
';
End of 5.0 tests
Loading