summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-06-04 08:29:08 +0300
committerunknown <monty@hundin.mysql.fi>2002-06-04 08:29:08 +0300
commitdaff6c5115b74c611222095fff40d075909ae454 (patch)
treed273a823d7f94fdea3e5775b8d8cd0b912812b0f /sql
parent08526ba32d9f4c353640b928edfdde862efc8596 (diff)
parentad4e68655565878b31ac67ef1819d9ef29312c51 (diff)
downloadmariadb-git-daff6c5115b74c611222095fff40d075909ae454.tar.gz
merge with 4.0 to get last fixes to last merge
BitKeeper/etc/logging_ok: auto-union Docs/manual.texi: Auto merged client/mysqltest.c: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/func_math.result: Auto merged sql/hostname.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: merge with 4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/hostname.cc2
-rw-r--r--sql/item_cmpfunc.cc11
-rw-r--r--sql/item_cmpfunc.h12
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/sql_analyse.cc27
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_table.cc28
-rw-r--r--sql/sql_yacc.yy1
8 files changed, 55 insertions, 43 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 0a9be8a3213..bcc8ea87281 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -58,7 +58,7 @@ void hostname_cache_refresh()
bool hostname_cache_init()
{
host_entry *tmp;
- uint offset= (uint) ((char*) (&tmp->ip) - (char*) &tmp);
+ uint offset= (uint) ((char*) (&tmp->ip) - (char*) tmp);
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 4e25fae56b2..8433ae5bfba 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1308,13 +1308,14 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist)
{
pattern = first + 1;
pattern_len = len - 2;
- DBUG_PRINT("TurboBM", ("Initializing pattern: '%s'...", first));
- int* suff = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
- bmGs = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
- bmBc = (int*)thd->alloc(sizeof(int[alphabet_size]));
+ DBUG_PRINT("info", ("Initializing pattern: '%s'", first));
+ int *suff = (int*) thd->alloc(sizeof(int)*((pattern_len + 1)*2+
+ alphabet_size));
+ bmGs = suff + pattern_len + 1;
+ bmBc = bmGs + pattern_len + 1;
turboBM_compute_good_suffix_shifts(suff);
turboBM_compute_bad_character_shifts();
- DBUG_PRINT("turboBM",("done"));
+ DBUG_PRINT("info",("done"));
}
}
return 0;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index ea5f4a6b0bf..302ad88905e 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -495,16 +495,10 @@ class Item_func_like :public Item_bool_func2
enum { alphabet_size = 256 };
public:
- Item_func_like::Item_func_like(Item *a,Item *b, char* escape_arg) :
- Item_bool_func2(a,b),
- escape(*escape_arg),
- canDoTurboBM(false),
- pattern(0),
- pattern_len(0),
- bmGs(0),
- bmBc(0)
+ Item_func_like(Item *a,Item *b, char* escape_arg)
+ :Item_bool_func2(a,b), escape(*escape_arg), canDoTurboBM(false),
+ pattern(0), pattern_len(0), bmGs(0), bmBc(0)
{}
-
longlong val_int();
enum Functype functype() const { return LIKE_FUNC; }
optimize_type select_optimize() const;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b67a088c88d..98bfa162242 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4004,6 +4004,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(0);
case 'T':
test_flags= argument ? (uint) atoi(argument) : 0;
+ test_flags&= ~TEST_NO_THREADS;
opt_endinfo=1;
break;
case (int) OPT_BIG_TABLES:
@@ -4193,8 +4194,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
mysql_port=0;
break;
+#ifdef ONE_THREAD
case (int) OPT_ONE_THREAD:
test_flags |= TEST_NO_THREADS;
+#endif
break;
case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL;
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index cc3406d0f54..91d6b967929 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -90,21 +90,21 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0)
{
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
pc->max_tree_elements = (uint) (*param->item)->val_int();
param = param->next;
if (param->next) // no third parameter possible
{
net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
// second parameter
if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val() < 0)
{
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
pc->max_treemem = (uint) (*param->item)->val_int();
}
@@ -112,7 +112,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0)
{
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
// if only one parameter was given, it will be the value of max_tree_elements
else
@@ -148,21 +148,26 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
if (item->result_type() == STRING_RESULT)
*f_info++ = new field_str(item, pc);
}
- return pc;
-} // proc_analyse_init
+ DBUG_RETURN(pc);
+}
-// return 1 if number, else return 0
-// store info about found number in info
-// NOTE:It is expected, that elements of 'info' are all zero!
+/*
+ Return 1 if number, else return 0
+ store info about found number in info
+ NOTE:It is expected, that elements of 'info' are all zero!
+*/
+
bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
{
const char *begin, *end = str + str_len;
DBUG_ENTER("test_if_number");
- // MySQL removes any endspaces of a string, so we must take care only of
- // spaces in front of a string
+ /*
+ MySQL removes any endspaces of a string, so we must take care only of
+ spaces in front of a string
+ */
for (; str != end && my_isspace(system_charset_info, *str); str++) ;
if (str == end)
return 0;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index d999271e3df..790994b897e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -590,7 +590,7 @@ pthread_handler_decl(handle_one_connection,arg)
#if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create
// The following calls needs to be done before we call DBUG_ macros
- if (my_thread_init())
+ if (!(test_flags & TEST_NO_THREADS) & my_thread_init())
{
close_connection(&thd->net,ER_OUT_OF_RESOURCES);
statistic_increment(aborted_connects,&LOCK_thread_count);
@@ -1972,6 +1972,7 @@ mysql_execute_command(void)
}
auxi->lock_type=walk->lock_type=TL_WRITE;
auxi->table= (TABLE *) walk; // Remember corresponding table
+ (void)add_item_to_list(new Item_field(auxi->db,auxi->real_name,"*"));
}
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
if (add_item_to_list(new Item_null()))
@@ -2583,8 +2584,17 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables,
}
}
else if (check_access(thd,want_access,tables->db,&tables->grant.privilege,
+ 0, no_errors | grant_option))
+ {
+ if (grant_option)
+ {
+ if ( check_access(thd,want_access & (uint) ~TABLE_ACLS,tables->db,&tables->grant.privilege,
0, no_errors))
- return TRUE; // Access denied
+ return TRUE;
+ }
+ else
+ return TRUE;
+ }
}
if (grant_option)
return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 977571e1ff5..f4f4dd212bd 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1303,7 +1303,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->proc_info="init";
table_name=table_list->real_name;
db=table_list->db;
- if (!new_db)
+ if (!new_db || !strcmp(new_db,db))
new_db=db;
used_fields=create_info->used_fields;
@@ -1357,10 +1357,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* In some simple cases we need not to recreate the table */
thd->proc_info="setup";
- if (simple_alter)
+ if (simple_alter && !table->tmp_table)
{
error=0;
- if (new_name != table_name)
+ if (new_name != table_name || new_db != db)
{
thd->proc_info="rename";
VOID(pthread_mutex_lock(&LOCK_open));
@@ -1383,15 +1383,15 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
if (!error)
{
- switch (keys_onoff)
- {
- case LEAVE_AS_IS: break;
- case ENABLE:
- error=table->file->activate_all_index(thd);
- break;
- case DISABLE:
- table->file->deactivate_non_unique_index(HA_POS_ERROR);
- break;
+ switch (keys_onoff) {
+ case LEAVE_AS_IS:
+ break;
+ case ENABLE:
+ error=table->file->activate_all_index(thd);
+ break;
+ case DISABLE:
+ table->file->deactivate_non_unique_index(HA_POS_ERROR);
+ break;
}
}
if (!error)
@@ -1797,7 +1797,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->proc_info="rename result table";
sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid,
thd->thread_id);
- if (new_name != table_name)
+ if (new_name != table_name || new_db != db)
{
if (!access(new_name_buff,F_OK))
{
@@ -1815,7 +1815,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
/*
Win32 and InnoDB can't drop a table that is in use, so we must
- close all the original table at before doing the rename
+ close the original table at before doing the rename
*/
table_name=thd->strdup(table_name); // must be saved
if (close_cached_table(thd,table))
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 578cad25bb4..b64da20339c 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1329,7 +1329,6 @@ alter_list_item:
LEX *lex=Lex;
lex->select->db=$3->db.str;
lex->name= $3->table.str;
- lex->simple_alter=0;
}
| create_table_options { Lex->simple_alter=0; }
| order_clause { Lex->simple_alter=0; };