summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-03-10 14:13:46 +0200
committerunknown <monty@narttu.mysql.fi>2003-03-10 14:13:46 +0200
commita6ea34ee5b2244dc85821cfbaedb4ccf5f397011 (patch)
treee5ead60265e7c75b687cf6327ae7a9b589cc6e12 /sql
parent3223245de3177fb42ce415b35f9edd050a5733b1 (diff)
parent5c100a6975cb50a6e20e6a0380bfb616e54eab70 (diff)
downloadmariadb-git-a6ea34ee5b2244dc85821cfbaedb4ccf5f397011.tar.gz
merge
BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-delete.result: Auto merged client/mysqlbinlog.cc: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/delete.result: Auto merged mysql-test/r/type_datetime.result: Auto merged mysql-test/t/delete.test: Auto merged mysql-test/t/type_datetime.test: Auto merged sql/field.h: Auto merged sql/ha_myisam.cc: Auto merged sql/lock.cc: Auto merged sql/log_event.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/slave.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_myisam.cc14
-rw-r--r--sql/item_func.cc18
-rw-r--r--sql/mysqld.cc10
-rw-r--r--sql/opt_range.cc12
-rw-r--r--sql/slave.cc7
-rw-r--r--sql/sql_rename.cc10
-rw-r--r--sql/sql_table.cc5
7 files changed, 48 insertions, 28 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 749a3eba5e4..6933b47449b 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -407,7 +407,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.testflag = 0;
- mi_check_print_error(&param,errmsg, my_errno);
+ mi_check_print_error(&param, errmsg, my_errno);
DBUG_RETURN(error);
}
}
@@ -425,17 +425,17 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
reg_ext))
{
- errmsg = "Failed in fn_format() for .frm file: errno = %d";
+ errmsg = "Failed in fn_format() for .frm file (errno: %d)";
error = HA_ADMIN_INVALID;
goto err;
}
if (my_copy(fn_format(src_path, table->path,"", reg_ext, MY_UNPACK_FILENAME),
dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES)))
+ MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
{
error = HA_ADMIN_FAILED;
- errmsg = "Failed copying .frm file: errno = %d";
+ errmsg = "Failed copying .frm file (errno: %d)";
goto err;
}
@@ -443,7 +443,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
if (!fn_format(dst_path, dst_path, "", MI_NAME_DEXT,
MY_REPLACE_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH))
{
- errmsg = "Failed in fn_format() for .MYD file: errno = %d";
+ errmsg = "Failed in fn_format() for .MYD file (errno: %d)";
error = HA_ADMIN_INVALID;
goto err;
}
@@ -451,9 +451,9 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
if (my_copy(fn_format(src_path, table->path,"", MI_NAME_DEXT,
MY_UNPACK_FILENAME),
dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES)))
+ MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
{
- errmsg = "Failed copying .MYD file: errno = %d";
+ errmsg = "Failed copying .MYD file (errno: %d)";
error= HA_ADMIN_FAILED;
goto err;
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index ef629098d2a..d5b7869cbcb 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -679,20 +679,28 @@ double Item_func_round::val()
double value=args[0]->val();
int dec=(int) args[1]->val_int();
uint abs_dec=abs(dec);
+ double tmp;
+ /*
+ tmp2 is here to avoid return the value with 80 bit precision
+ This will fix that the test round(0.1,1) = round(0.1,1) is true
+ */
+ volatile double tmp2;
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0.0;
- double tmp=(abs_dec < array_elements(log_10) ?
- log_10[abs_dec] : pow(10.0,(double) abs_dec));
+ tmp=(abs_dec < array_elements(log_10) ?
+ log_10[abs_dec] : pow(10.0,(double) abs_dec));
if (truncate)
{
if (value >= 0)
- return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
+ tmp2= dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
else
- return dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
+ tmp2= dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
}
- return dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
+ else
+ tmp2=dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
+ return tmp2;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index a042b7f314b..daa5bfcc7ff 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3597,8 +3597,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, GET_STR, 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,6 +4221,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
/* Correct pointer set by my_getopt (for embedded library) */
mysql_data_home= mysql_real_data_home;
break;
+ case 'u':
+ if (!mysqld_user)
+ 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", argument, mysqld_user);
+ break;
case 'L':
strmake(language, argument, sizeof(language)-1);
break;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index c1b03ed629f..aeeabb7d29c 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1340,7 +1340,8 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
}
if (((clone_flag & CLONE_KEY2_MAYBE) &&
- !(clone_flag & CLONE_KEY1_MAYBE)) ||
+ !(clone_flag & CLONE_KEY1_MAYBE) &&
+ key2->type != SEL_ARG::MAYBE_KEY) ||
key1->type == SEL_ARG::MAYBE_KEY)
{ // Put simple key in key2
swap(SEL_ARG *,key1,key2);
@@ -1368,7 +1369,10 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
{
key1->maybe_smaller();
if (key2->next_key_part)
+ {
+ key1->use_count--; // Incremented in and_all_keys
return and_all_keys(key1,key2,clone_flag);
+ }
key2->use_count--; // Key2 doesn't have a tree
}
return key1;
@@ -2067,7 +2071,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
{
if (this == root && use_count != 1)
{
- sql_print_error("Use_count: Wrong count %lu for root",use_count);
+ sql_print_error("Note: Use_count: Wrong count %lu for root",use_count);
return;
}
if (this->type != SEL_ARG::KEY_RANGE)
@@ -2081,7 +2085,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
ulong count=count_key_part_usage(root,pos->next_key_part);
if (count > pos->next_key_part->use_count)
{
- sql_print_error("Use_count: Wrong count for key at %lx, %lu should be %lu",
+ sql_print_error("Note: Use_count: Wrong count for key at %lx, %lu should be %lu",
pos,pos->next_key_part->use_count,count);
return;
}
@@ -2089,7 +2093,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
}
}
if (e_count != elements)
- sql_print_error("Wrong use count: %u for tree at %lx", e_count,
+ sql_print_error("Warning: Wrong use count: %u for tree at %lx", e_count,
(gptr) this);
}
diff --git a/sql/slave.cc b/sql/slave.cc
index dcec15f173e..daca8fe1cf6 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1815,7 +1815,8 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
if (init_thr_lock() || thd->store_globals())
{
- end_thread(thd,0);
+ thd->cleanup();
+ delete thd;
DBUG_RETURN(-1);
}
@@ -2096,6 +2097,7 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init();
+ DBUG_ENTER("handle_slave_io");
#ifndef DBUG_OFF
slave_begin:
@@ -2113,7 +2115,6 @@ slave_begin:
#endif
thd= new THD; // note that contructor of THD uses DBUG_ !
- DBUG_ENTER("handle_slave_io");
THD_CHECK_SENTRY(thd);
pthread_detach_this_thread();
@@ -2370,6 +2371,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init();
+ DBUG_ENTER("handle_slave_sql");
#ifndef DBUG_OFF
slave_begin:
@@ -2382,7 +2384,6 @@ slave_begin:
#ifndef DBUG_OFF
rli->events_till_abort = abort_slave_event_count;
#endif
- DBUG_ENTER("handle_slave_sql");
thd = new THD; // note that contructor of THD uses DBUG_ !
THD_CHECK_SENTRY(thd);
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 1bb89060167..d7e998264f3 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -31,8 +31,8 @@ static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
{
- bool error=1;
- TABLE_LIST *ren_table=0;
+ bool error= 1;
+ TABLE_LIST *ren_table= 0;
DBUG_ENTER("mysql_rename_tables");
/*
@@ -49,8 +49,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
VOID(pthread_mutex_lock(&LOCK_open));
if (lock_table_names(thd, table_list))
goto err;
-
- error= 0;
+
+ error=0;
if ((ren_table=rename_tables(thd,table_list,0)))
{
/* Rename didn't succeed; rename back the tables in reverse order */
@@ -119,7 +119,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
if (!access(name,F_OK))
{
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),name);
- DBUG_RETURN(ren_table); // This can't be skiped
+ DBUG_RETURN(ren_table); // This can't be skipped
}
sprintf(name,"%s/%s/%s%s",mysql_data_home,
ren_table->db,ren_table->real_name,
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 156d2b842f1..adaedebfa28 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -65,7 +65,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
{
- int error;
+ int error= 0;
DBUG_ENTER("mysql_rm_table");
/* mark for close and remove all cached entries */
@@ -80,6 +80,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
{
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0),
tables->real_name);
+ error= 1;
goto err;
}
while (global_read_lock && ! thd->killed)
@@ -173,7 +174,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table=tables ; table ; table=table->next)
{
- char *db=table->db ? table->db : thd->db;
+ char *db=table->db;
mysql_ha_closeall(thd, table);
if (!close_temporary_table(thd, db, table->real_name))
{