summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-03-13 17:27:45 +0000
committerunknown <serg@serg.mysql.com>2002-03-13 17:27:45 +0000
commit226169b10b260b360fea6f097ba2e1750f5db0bd (patch)
treeca18ad4bbcd7658a8f7a2987609354e0f412c004 /sql
parentd556096f73320f173611f4551a24289b4877f8e6 (diff)
parent827133864a306e52cc63797f2b09e6542e1dcfe2 (diff)
downloadmariadb-git-226169b10b260b360fea6f097ba2e1750f5db0bd.tar.gz
merged
sql/ha_myisam.cc: Auto merged sql/lex.h: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_isam.cc2
-rw-r--r--sql/ha_myisam.cc2
-rw-r--r--sql/ha_myisammrg.cc2
-rw-r--r--sql/handler.cc3
-rw-r--r--sql/lex.h2
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/sql_acl.cc30
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_repl.cc4
-rw-r--r--sql/sql_yacc.yy20
-rw-r--r--sql/table.cc4
12 files changed, 54 insertions, 24 deletions
diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc
index 4b8c40f8fe6..7c9c7a64c9d 100644
--- a/sql/ha_isam.cc
+++ b/sql/ha_isam.cc
@@ -201,7 +201,7 @@ void ha_isam::info(uint flag)
sortkey = info.sortkey;
block_size=nisam_block_size;
table->keys = min(table->keys,info.keys);
- table->keys_in_use= (((key_map) 1) << table->keys)- (key_map) 1;
+ table->keys_in_use= set_bits(key_map,table->keys);
table->db_options_in_use= info.options;
table->db_record_offset=
(table->db_options_in_use &
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 2247045894c..127519d20f4 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -688,7 +688,7 @@ bool ha_myisam::activate_all_index(THD *thd)
mi_extra(file, HA_EXTRA_BULK_INSERT_END);
if (enable_activate_all_index &&
- share->state.key_map != ((ulonglong) 1L << share->base.keys)-1)
+ share->state.key_map != set_bits(ulonglong, share->base.keys))
{
const char *save_proc_info=thd->proc_info;
thd->proc_info="Creating index";
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index 63a23fb708f..42f8b807898 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -189,7 +189,7 @@ void ha_myisammrg::info(uint flag)
deleted = (ha_rows) info.deleted;
data_file_length=info.data_file_length;
errkey = info.errkey;
- table->keys_in_use=(((key_map) 1) << table->keys)- (key_map) 1;
+ table->keys_in_use= set_bits(key_map, table->keys);
table->db_options_in_use = info.options;
table->is_view=1;
mean_rec_length=info.reclength;
diff --git a/sql/handler.cc b/sql/handler.cc
index 8447797442c..e0e9ee25506 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -542,7 +542,8 @@ int handler::read_first_row(byte * buf, uint primary_key)
If there is very few deleted rows in the table, find the first row by
scanning the table.
*/
- if (deleted < 10 || primary_key >= MAX_KEY)
+ if (deleted < 10 || primary_key >= MAX_KEY ||
+ !(option_flag() & HA_READ_ORDER))
{
(void) rnd_init();
while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
diff --git a/sql/lex.h b/sql/lex.h
index 46b9e9f4bec..10c1ad766d5 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -191,6 +191,7 @@ static SYMBOL symbols[] = {
{ "INT4", SYM(INT_SYM),0,0},
{ "INT8", SYM(BIGINT),0,0},
{ "INTO", SYM(INTO),0,0},
+ { "IO_THREAD", SYM(IO_THREAD),0,0},
{ "IF", SYM(IF),0,0},
{ "IS", SYM(IS),0,0},
{ "ISOLATION", SYM(ISOLATION),0,0},
@@ -327,6 +328,7 @@ static SYMBOL symbols[] = {
{ "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0},
{ "SQL_SLAVE_SKIP_COUNTER", SYM(SQL_SLAVE_SKIP_COUNTER),0,0},
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
+ { "SQL_THREAD", SYM(SQL_THREAD),0,0},
{ "SQL_WARNINGS", SYM(SQL_WARNINGS),0,0},
{ "SSL", SYM(SSL_SYM),0,0},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 46eda3a1e2f..94fe76f8408 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -970,8 +970,11 @@ static void server_init(void)
unireg_abort(1);
}
if (listen(ip_sock,(int) back_log) < 0)
- sql_print_error("Warning: listen() on TCP/IP failed with error %d",
+ {
+ sql_print_error("Error: listen() on TCP/IP failed with error %d",
socket_errno);
+ unireg_abort(1);
+ }
}
if (mysqld_chroot)
@@ -3386,6 +3389,7 @@ Starts the MySQL server\n");
--init-file=file Read SQL commands from this file at startup\n\
-L, --language=... Client error messages in given language. May be\n\
given as a full path\n\
+ --local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\
-l, --log[=file] Log connections and queries to file\n\
--log-bin[=file] Log queries in new binary format (for replication)\n\
--log-bin-index=file File that holds the names for last binary log files\n\
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 869be5b327d..104b431bdbb 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -922,14 +922,10 @@ bool acl_check_host(const char *host, const char *ip)
bool change_password(THD *thd, const char *host, const char *user,
char *new_password)
{
+ uint length=0;
DBUG_ENTER("change_password");
DBUG_PRINT("enter",("thd=%x, host='%s', user='%s', new_password='%s'",thd,host,user,new_password));
- uint length=0;
- if (!user[0])
- {
- send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
- DBUG_RETURN(1);
- }
+
if (!initialized)
{
send_error(&thd->net, ER_PASSWORD_NOT_ALLOWED); /* purecov: inspected */
@@ -941,16 +937,21 @@ bool change_password(THD *thd, const char *host, const char *user,
length=(uint) strlen(new_password);
new_password[length & 16]=0;
- if (!thd || (!thd->slave_thread && ( strcmp(thd->user,user) ||
- my_strcasecmp(host,thd->host ? thd->host : thd->ip))))
+ if (!thd->slave_thread &&
+ (strcmp(thd->user,user) ||
+ my_strcasecmp(host,thd->host ? thd->host : thd->ip)))
{
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
DBUG_RETURN(1);
}
+ if (!thd->slave_thread && !thd->user[0])
+ {
+ send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
+ DBUG_RETURN(1);
+ }
VOID(pthread_mutex_lock(&acl_cache->lock));
ACL_USER *acl_user;
- DBUG_PRINT("info",("host=%s, user=%s",host,user));
- if (!(acl_user= find_acl_user(host,user)) || !acl_user->user)
+ if (!(acl_user= find_acl_user(host,user)))
{
send_error(&thd->net, ER_PASSWORD_NO_MATCH);
VOID(pthread_mutex_unlock(&acl_cache->lock));
@@ -958,7 +959,8 @@ bool change_password(THD *thd, const char *host, const char *user,
}
if (update_user_table(thd,
acl_user->host.hostname ? acl_user->host.hostname : "",
- acl_user->user, new_password))
+ acl_user->user ? acl_user->user : "",
+ new_password))
{
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
send_error(&thd->net,0); /* purecov: deadcode */
@@ -978,7 +980,7 @@ bool change_password(THD *thd, const char *host, const char *user,
qinfo.q_len =
my_sprintf(buff,
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"",
- acl_user->user,
+ acl_user->user ? acl_user->user : "",
acl_user->host.hostname ? acl_user->host.hostname : "",
new_password));
mysql_update_log.write(thd,buff,qinfo.q_len);
@@ -2743,9 +2745,9 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
}
}
- db.append (" ON ",4);
+ db.append (" ON '",5);
db.append(acl_db->db);
- db.append (".* TO '",7);
+ db.append ("'.* TO '",8);
db.append(lex_user->user.str,lex_user->user.length);
db.append ("'@'",3);
db.append(lex_user->host.str, lex_user->host.length);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 7995e7701e5..43195bc908b 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -150,6 +150,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->convert_set=(lex->thd=thd)->convert_set;
lex->yacc_yyss=lex->yacc_yyvs=0;
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
+ lex->slave_thd_opt=0;
return lex;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index c0ede015eb8..ecfb3dec99c 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -186,7 +186,7 @@ typedef struct st_lex {
thr_lock_type lock_option;
bool drop_primary,drop_if_exists,local_file;
bool in_comment,ignore_space,verbose,simple_alter, option_type;
-
+ uint slave_thd_opt;
} LEX;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 0b408920703..c6384817512 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -562,6 +562,8 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
return 1;
lock_slave_threads(mi); // this allows us to cleanly read slave_running
init_thread_mask(&thread_mask,mi,1 /* inverse */);
+ if (thd->lex.slave_thd_opt)
+ thread_mask &= thd->lex.slave_thd_opt;
if (thread_mask)
{
if (server_id_supplied && (!mi->inited || (mi->inited && *mi->host)))
@@ -602,6 +604,8 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
int thread_mask;
lock_slave_threads(mi);
init_thread_mask(&thread_mask,mi,0 /* not inverse*/);
+ if (thd->lex.slave_thd_opt)
+ thread_mask &= thd->lex.slave_thd_opt;
slave_errno = (thread_mask) ?
terminate_slave_threads(mi,thread_mask,
1 /*skip lock */) : ER_SLAVE_NOT_RUNNING;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index a7d6f57c3e8..83a21b03ac4 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -123,6 +123,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token RESET_SYM
%token PURGE
%token SLAVE
+%token IO_THREAD
+%token SQL_THREAD
%token START_SYM
%token STOP_SYM
%token TRUNCATE_SYM
@@ -1257,20 +1259,34 @@ opt_to:
| AS {}
slave:
- SLAVE START_SYM
+ SLAVE START_SYM slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_START;
lex->type = 0;
}
|
- SLAVE STOP_SYM
+ SLAVE STOP_SYM slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_STOP;
lex->type = 0;
};
+slave_thread_opts: slave_thread_opt
+ | slave_thread_opts ',' slave_thread_opt
+
+slave_thread_opt:
+ /*empty*/ {}
+ | SQL_THREAD
+ {
+ Lex->slave_thd_opt|=SLAVE_SQL;
+ }
+ | IO_THREAD
+ {
+ Lex->slave_thd_opt|=SLAVE_IO;
+ }
+
restore:
RESTORE_SYM table_or_tables
{
diff --git a/sql/table.cc b/sql/table.cc
index b1cd63d465a..023d4d85df9 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -130,8 +130,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0)));
if (read_string(file,(gptr*) &disk_buff,(uint) uint2korr(head+28)))
goto err_not_open; /* purecov: inspected */
- outparam->keys=keys=disk_buff[0];
- outparam->keys_in_use= (((key_map) 1) << keys)- (key_map) 1;
+ outparam->keys=keys= disk_buff[0];
+ outparam->keys_in_use= set_bits(key_map, keys);
outparam->key_parts=key_parts=disk_buff[1];
n_length=keys*sizeof(KEY)+key_parts*sizeof(KEY_PART_INFO);