Commit 93c70c07 authored by unknown's avatar unknown

simple optimzation

Portability fixes


client/mysqltest.c:
  Fixed that if error number 0 is included in --error, we will not generate an error message
include/mysql.h:
  Portability fix
mysql-test/mysql-test-run.sh:
  Portability fix
mysql-test/r/heap_btree.result:
  Portability fix
mysql-test/r/rpl_error_ignored_table.result:
  Portability fix
mysql-test/t/heap_btree.test:
  Portability fix
mysql-test/t/rpl_error_ignored_table.test:
  Portability fix
sql/sql_base.cc:
  simple optimzation
sql/sql_yacc.yy:
  simple optimzation
parent 2ac5a256
...@@ -1833,6 +1833,7 @@ int read_line(char* buf, int size) ...@@ -1833,6 +1833,7 @@ int read_line(char* buf, int size)
return feof(*cur_file); return feof(*cur_file);
} }
static char read_query_buf[MAX_QUERY]; static char read_query_buf[MAX_QUERY];
int read_query(struct st_query** q_ptr) int read_query(struct st_query** q_ptr)
...@@ -1840,7 +1841,7 @@ int read_query(struct st_query** q_ptr) ...@@ -1840,7 +1841,7 @@ int read_query(struct st_query** q_ptr)
char *p = read_query_buf, * p1 ; char *p = read_query_buf, * p1 ;
int expected_errno; int expected_errno;
struct st_query* q; struct st_query* q;
DBUG_ENTER("read_query_buf"); DBUG_ENTER("read_query");
if (parser.current_line < parser.read_lines) if (parser.current_line < parser.read_lines)
{ {
...@@ -1857,7 +1858,7 @@ int read_query(struct st_query** q_ptr) ...@@ -1857,7 +1858,7 @@ int read_query(struct st_query** q_ptr)
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno, memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
sizeof(global_expected_errno)); sizeof(global_expected_errno));
q->expected_errors= global_expected_errors; q->expected_errors= global_expected_errors;
q->abort_on_error= global_expected_errno[0] == 0; q->abort_on_error= global_expected_errors == 0;
bzero((gptr) global_expected_errno, sizeof(global_expected_errno)); bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
global_expected_errors=0; global_expected_errors=0;
...@@ -2308,7 +2309,8 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) ...@@ -2308,7 +2309,8 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
goto end; /* Ok */ goto end; /* Ok */
} }
} }
DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors)); DBUG_PRINT("info",("i: %d expected_errors: %d", i,
q->expected_errors));
dynstr_append_mem(ds, "ERROR ",6); dynstr_append_mem(ds, "ERROR ",6);
replace_dynstr_append_mem(ds, mysql_sqlstate(mysql), replace_dynstr_append_mem(ds, mysql_sqlstate(mysql),
strlen(mysql_sqlstate(mysql))); strlen(mysql_sqlstate(mysql)));
......
...@@ -188,9 +188,9 @@ struct st_mysql_options { ...@@ -188,9 +188,9 @@ struct st_mysql_options {
/* function pointers for local infile support */ /* function pointers for local infile support */
int (*local_infile_init)(void **, const char *); int (*local_infile_init)(void **, const char *);
int (*local_infile_read)(void *, char *, uint); int (*local_infile_read)(void *, char *, unsigned int);
void (*local_infile_end)(void *); void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, uint); int (*local_infile_error)(void *, char *, unsigned int);
}; };
enum mysql_status enum mysql_status
...@@ -397,9 +397,11 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, ...@@ -397,9 +397,11 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
void void
mysql_set_local_infile_handler(MYSQL *mysql, mysql_set_local_infile_handler(MYSQL *mysql,
int (*local_infile_init)(void **, const char *), int (*local_infile_init)(void **, const char *),
int (*local_infile_read)(void *, char *, uint), int (*local_infile_read)(void *, char *,
unsigned int),
void (*local_infile_end)(void *), void (*local_infile_end)(void *),
int (*local_infile_error)(void *, char*, uint)); int (*local_infile_error)(void *, char*,
unsigned int));
void void
mysql_set_local_infile_default(MYSQL *mysql); mysql_set_local_infile_default(MYSQL *mysql);
......
...@@ -22,6 +22,9 @@ case `uname` in ...@@ -22,6 +22,9 @@ case `uname` in
SCO_SV | UnixWare | OpenUNIX ) SCO_SV | UnixWare | OpenUNIX )
# do nothing (Causes strange behavior) # do nothing (Causes strange behavior)
;; ;;
QNX)
# do nothing (avoid error message)
;;
* ) * )
ulimit -n 1024 ulimit -n 1024
;; ;;
......
...@@ -178,7 +178,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -178,7 +178,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range btn btn 10 NULL 1 Using where 1 SIMPLE t1 range btn btn 10 NULL 1 Using where
explain select * from t1 where btn like "h%"; explain select * from t1 where btn like "h%";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range btn btn 10 NULL 4 Using where 1 SIMPLE t1 range btn btn 10 NULL # Using where
explain select * from t1 where btn like "a%"; explain select * from t1 where btn like "a%";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range btn btn 10 NULL 1 Using where 1 SIMPLE t1 range btn btn 10 NULL 1 Using where
......
...@@ -26,7 +26,6 @@ select (@id := id) - id from t3; ...@@ -26,7 +26,6 @@ select (@id := id) - id from t3;
0 0
kill @id; kill @id;
drop table t2,t3; drop table t2,t3;
Got one of the listed errors
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int primary key) master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int primary key)
......
...@@ -111,6 +111,7 @@ drop table t1; ...@@ -111,6 +111,7 @@ drop table t1;
create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap; create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "i%"; explain select * from t1 where btn like "i%";
--replace_column 9 #
explain select * from t1 where btn like "h%"; explain select * from t1 where btn like "h%";
explain select * from t1 where btn like "a%"; explain select * from t1 where btn like "a%";
explain select * from t1 where btn like "b%"; explain select * from t1 where btn like "b%";
......
...@@ -45,7 +45,7 @@ select (@id := id) - id from t3; ...@@ -45,7 +45,7 @@ select (@id := id) - id from t3;
kill @id; kill @id;
drop table t2,t3; drop table t2,t3;
connection master; connection master;
--error 1053,0; --error 0,1053;
reap; reap;
connection master1; connection master1;
show binlog events from 79; show binlog events from 79;
......
...@@ -2293,14 +2293,14 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, ...@@ -2293,14 +2293,14 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
DBUG_RETURN(-1); DBUG_RETURN(-1);
#endif #endif
Field **ptr=table->field,*field; Field **ptr=table->field,*field;
TABLE *natural_join_table; TABLE *natural_join_table= 0;
thd->used_tables|=table->map; thd->used_tables|=table->map;
if (table->outer_join || if (!table->outer_join &&
!tables->natural_join || tables->natural_join &&
tables->natural_join->table->outer_join) !tables->natural_join->table->outer_join)
natural_join_table= NULL;
else
natural_join_table= tables->natural_join->table; natural_join_table= tables->natural_join->table;
while ((field = *ptr++)) while ((field = *ptr++))
{ {
/* Skip duplicate field names if NATURAL JOIN is used */ /* Skip duplicate field names if NATURAL JOIN is used */
......
...@@ -1798,10 +1798,10 @@ alter_list_item: ...@@ -1798,10 +1798,10 @@ alter_list_item:
YYABORT; YYABORT;
} }
LEX *lex= Lex; LEX *lex= Lex;
lex->create_info.table_charset= $5; lex->create_info.table_charset=
lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
lex->create_info.default_table_charset= $5; lex->create_info.default_table_charset= $5;
lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
HA_CREATE_USED_DEFAULT_CHARSET);
lex->simple_alter= 0; lex->simple_alter= 0;
} }
| create_table_options_space_separated { Lex->simple_alter=0; } | create_table_options_space_separated { Lex->simple_alter=0; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment