From 6977704d2bea20f53d9c1ccd71c52d59a7f7b4c2 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Mon, 10 Mar 2003 13:54:20 +0200 Subject: [PATCH] after merge fixes --- mysql-test/r/backup.result | 40 +++++++++++++++++-------------- mysql-test/r/delete.result | 15 ++++++++++++ mysql-test/r/join.result | 19 +++++++++++++++ mysql-test/r/type_datetime.result | 6 +++++ mysys/my_getopt.c | 4 ++-- sql/mysqld.cc | 8 +++---- 6 files changed, 68 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result index 43d57d2d4f7..0e0a87172f2 100644 --- a/mysql-test/r/backup.result +++ b/mysql-test/r/backup.result @@ -1,20 +1,24 @@ set SQL_LOG_BIN=0; -drop table if exists t1; -create table t1(n int); -backup table t1 to '../bogus'; +create table t4(n int); +backup table t4 to '../bogus'; Table Op Msg_type Msg_text -test.t1 backup error Failed copying .frm file: errno = X -test.t1 backup status Operation failed -backup table t1 to '../tmp'; +test.t4 backup error Failed copying .frm file (errno: X) +test.t4 backup status Operation failed +backup table t4 to '../tmp'; Table Op Msg_type Msg_text -test.t1 backup status OK -drop table t1; -restore table t1 from '../tmp'; +test.t4 backup status OK +backup table t4 to '../tmp'; Table Op Msg_type Msg_text -test.t1 restore status OK -select count(*) from t1; +test.t4 backup error Failed copying .frm file (errno: X) +test.t4 backup status Operation failed +drop table t4; +restore table t4 from '../tmp'; +Table Op Msg_type Msg_text +test.t4 restore status OK +select count(*) from t4; count(*) 0 +create table t1(n int); insert into t1 values (23),(45),(67); backup table t1 to '../tmp'; Table Op Msg_type Msg_text @@ -35,9 +39,8 @@ create table t2(m int not null primary key); create table t3(k int not null primary key); insert into t2 values (123),(145),(167); insert into t3 values (223),(245),(267); -backup table t1,t2,t3 to '../tmp'; +backup table t2,t3 to '../tmp'; Table Op Msg_type Msg_text -test.t1 backup status OK test.t2 backup status OK test.t3 backup status OK drop table t1,t2,t3; @@ -61,13 +64,14 @@ k 223 245 267 -drop table t1,t2,t3; +drop table t1,t2,t3,t4; restore table t1 from '../tmp'; Table Op Msg_type Msg_text test.t1 restore status OK -lock tables t1 write; -backup table t1 to '../tmp'; +rename table t1 to t5; +lock tables t5 write; +backup table t5 to '../tmp'; unlock tables; Table Op Msg_type Msg_text -test.t1 backup status OK -drop table t1; +test.t5 backup status OK +drop table t5; diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index c2230722aa6..582ab894233 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -24,3 +24,18 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; +CREATE TABLE t1 ( +bool char(0) default NULL, +not_null varchar(20) binary NOT NULL default '', +misc integer not null, +PRIMARY KEY (not_null) +) TYPE=MyISAM; +INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7); +select * from t1 where misc > 5 and bool is null; +bool not_null misc +NULL c 6 +NULL d 7 +delete from t1 where misc > 5 and bool is null; +select * from t1 where misc > 5 and bool is null; +bool not_null misc +drop table t1; diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index d8c45ca09ce..9f6a8762325 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -251,7 +251,26 @@ t1_id t2_id type cost_unit min_value max_value t3_id item_id id name 22 1 Percent Cost 100 -1 6 291 1 s1 23 1 Percent Cost 100 -1 21 291 1 s1 drop table t1,t2; +CREATE TABLE t1 ( +siteid varchar(25) NOT NULL default '', +emp_id varchar(30) NOT NULL default '', +rate_code varchar(10) default NULL, +UNIQUE KEY site_emp (siteid,emp_id), +KEY siteid (siteid) +) TYPE=MyISAM; +INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust'); +CREATE TABLE t2 ( +siteid varchar(25) NOT NULL default '', +rate_code varchar(10) NOT NULL default '', +base_rate float NOT NULL default '0', +PRIMARY KEY (siteid,rate_code), +FULLTEXT KEY rate_code (rate_code) +) TYPE=MyISAM; +INSERT INTO t2 VALUES ('rivercats','cust',20); +SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats'; rate_code base_rate cust 20 +SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith'; rate_code base_rate cust 20 +drop table t1,t2; diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 38b264b96b9..4785f790069 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -78,3 +78,9 @@ EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; table type possible_keys key key_len ref rows Extra t1 ref expedition expedition 8 const 1 Using where drop table t1; +create table t1 (a datetime not null, b datetime not null); +insert into t1 values (now(), now()); +insert into t1 values (now(), now()); +select * from t1 where a is null or b is null; +a b +drop table t1; diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index c6fe606eaaf..759c96462f6 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -431,8 +431,8 @@ int handle_options(int *argc, char ***argv, Will set the option value to given value */ -static int setval (const struct my_option *opts, char *argument, - my_bool set_maximum_value) +static int setval(const struct my_option *opts, char *argument, + my_bool set_maximum_value) { int err= 0; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7eab432ff49..67806e69f12 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3595,8 +3595,8 @@ struct my_option my_long_options[] = (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, IF_PURIFY(0,1), 0, 0, 0, 0, 0}, #endif - {"user", 'u', "Run mysqld daemon as user", (gptr*) &mysqld_user, - (gptr*) &mysqld_user, 0, 0, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"user", 'u', "Run mysqld daemon as user", 0, 0, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'v', "Synonym for option -v", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, @@ -4221,9 +4221,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case 'u': if (!mysqld_user) - mysqld_user=optarg; + mysqld_user= argument; else - fprintf(stderr, "Warning: Ignoring user change to '%s' becasue the user is set to '%s' earlier on the command line\n", optarg, mysqld_user); + fprintf(stderr, "Warning: Ignoring user change to '%s' becasue the user is set to '%s' earlier on the command line\n", argument, mysqld_user); break; case 'L': strmake(language, argument, sizeof(language)-1);