summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-06-18 04:38:58 +0300
committerunknown <monty@mysql.com>2004-06-18 04:38:58 +0300
commit2b9a8afa50c3575f924587588ce13852933d4d15 (patch)
tree7b3b07f5c8491e5a81ca71b19d92dc87ec314192 /sql
parent7d52eabb39d1733f4f10cac0f8f4d0555346ed9a (diff)
parent5fa063ba7eda4bbe70e758b2e5662dbd4edfe961 (diff)
downloadmariadb-git-2b9a8afa50c3575f924587588ce13852933d4d15.tar.gz
Merge with 4.0.21
BitKeeper/etc/logging_ok: auto-union Build-tools/mysql-copyright-2: Auto merged include/violite.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/buf/buf0flu.c: Auto merged innobase/buf/buf0lru.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/fsp/fsp0fsp.c: Auto merged innobase/fut/fut0lst.c: Auto merged innobase/ha/hash0hash.c: Auto merged innobase/include/buf0buf.ic: Auto merged innobase/include/buf0lru.h: Auto merged innobase/include/data0data.h: Auto merged innobase/include/dict0dict.h: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/fsp0fsp.h: Auto merged innobase/include/hash0hash.h: Auto merged innobase/include/lock0lock.h: Auto merged innobase/include/log0log.h: Auto merged innobase/include/log0log.ic: Auto merged innobase/include/mem0dbg.ic: Auto merged innobase/include/mem0pool.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/sync0rw.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0roll.h: Auto merged innobase/include/trx0trx.h: Auto merged innobase/include/ut0mem.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0log.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/mem/mem0pool.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/pars/pars0opt.c: Auto merged innobase/que/que0que.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0rw.c: Auto merged innobase/sync/sync0sync.c: Auto merged innobase/thr/thr0loc.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/usr/usr0sess.c: Auto merged innobase/ut/ut0mem.c: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_decimal.test: Auto merged mysys/mf_tempfile.c: Auto merged netware/BUILD/nwbootstrap: Auto merged netware/Makefile.am: Auto merged scripts/mysqld_safe.sh: Auto merged sql/item_cmpfunc.cc: Auto merged mysql-test/t/func_if.test: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_parse.cc: Auto merged support-files/my-innodb-heavy-4G.cnf.sh: Auto merged Build-tools/Do-compile: Merge with 4.0 Build-tools/mysql-copyright: Merge with 4.0 client/mysqltest.c: Merge with 4.0 include/my_global.h: Merge with 4.0 innobase/buf/buf0rea.c: Merge with 4.0 innobase/data/data0type.c: Merge with 4.0 innobase/ibuf/ibuf0ibuf.c: Merge with 4.0 innobase/include/buf0buf.h: Merge with 4.0 innobase/include/data0type.h: Merge with 4.0 innobase/include/mem0mem.h: Merge with 4.0 innobase/include/mem0mem.ic: Merge with 4.0 innobase/log/log0recv.c: Merge with 4.0 libmysql/libmysql.c: Merge with 4.0 libmysqld/Makefile.am: Merge with 4.0 mysql-test/r/range.result: Merge with 4.0 mysql-test/r/type_decimal.result: Merge with 4.0 mysql-test/t/range.test: Merge with 4.0 netware/BUILD/mwenv: Merge with 4.0 netware/mysql_test_run.c: Merge with 4.0 scripts/mysql_install_db.sh: Merge with 4.0 sql/field.cc: Merge with 4.0 sql/field.h: Merge with 4.0 sql/item_cmpfunc.h: Merge with 4.0 support-files/my-huge.cnf.sh: Merge with 4.0 support-files/my-large.cnf.sh: Merge with 4.0 support-files/my-medium.cnf.sh: Merge with 4.0 support-files/my-small.cnf.sh: Merge with 4.0 support-files/mysql.spec.sh: Merge with 4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc19
-rw-r--r--sql/field.h1
-rw-r--r--sql/item_cmpfunc.cc4
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/opt_range.cc30
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_parse.cc12
7 files changed, 55 insertions, 17 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 0660e774396..2077a6e5455 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3395,6 +3395,25 @@ String *Field_time::val_str(String *val_buffer,
}
+bool Field_time::get_date(TIME *ltime,
+ bool fuzzydate __attribute__((unused)))
+{
+ long tmp=(long) sint3korr(ptr);
+ ltime->neg=0;
+ if (tmp < 0)
+ {
+ ltime->neg= 1;
+ tmp=-tmp;
+ }
+ ltime->hour=tmp/10000;
+ tmp-=ltime->hour*10000;
+ ltime->minute= tmp/100;
+ ltime->second= tmp % 100;
+ ltime->year= ltime->month= ltime->day= ltime->second_part= 0;
+ return 0;
+}
+
+
bool Field_time::get_time(TIME *ltime)
{
long tmp=(long) sint3korr(ptr);
diff --git a/sql/field.h b/sql/field.h
index 002a7228164..f4c8c5a9955 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -800,6 +800,7 @@ public:
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
+ bool get_date(TIME *ltime,bool fuzzydate);
bool send_binary(Protocol *protocol);
bool get_time(TIME *ltime);
int cmp(const char *,const char*);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 446d72ac143..be509c7ed11 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -922,8 +922,8 @@ Item_func_if::fix_length_and_dec()
decimals=max(args[1]->decimals,args[2]->decimals);
enum Item_result arg1_type=args[1]->result_type();
enum Item_result arg2_type=args[2]->result_type();
- bool null1=args[1]->null_value;
- bool null2=args[2]->null_value;
+ bool null1=args[1]->const_item() && args[1]->null_value;
+ bool null2=args[2]->const_item() && args[2]->null_value;
if (null1)
{
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c26d5188fdd..7de00e3c43f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5458,7 +5458,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
mysql_data_home= mysql_real_data_home;
break;
case 'u':
- if (!mysqld_user)
+ if (!mysqld_user || !strcmp(mysqld_user, argument))
mysqld_user= argument;
else
fprintf(stderr, "Warning: Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index a5d2450e551..41ba09a3e70 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1561,7 +1561,7 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
{
swap_variables(SEL_ARG *,key1,key2);
}
- else if (!(key1=key1->clone_tree()))
+ if (key1->use_count > 0 || !(key1=key1->clone_tree()))
return 0; // OOM
}
@@ -1630,10 +1630,10 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
SEL_ARG *next=key2->next; // Keys are not overlapping
if (key2_shared)
{
- SEL_ARG *tmp= new SEL_ARG(*key2); // Must make copy
- if (!tmp)
+ SEL_ARG *cpy= new SEL_ARG(*key2); // Must make copy
+ if (!cpy)
return 0; // OOM
- key1=key1->insert(tmp);
+ key1=key1->insert(cpy);
key2->increment_use_count(key1->use_count+1);
}
else
@@ -1869,8 +1869,17 @@ SEL_ARG::find_range(SEL_ARG *key)
/*
-** Remove a element from the tree
-** This also frees all sub trees that is used by the element
+ Remove a element from the tree
+
+ SYNOPSIS
+ tree_delete()
+ key Key that is to be deleted from tree (this)
+
+ NOTE
+ This also frees all sub trees that is used by the element
+
+ RETURN
+ root of new tree (with key deleted)
*/
SEL_ARG *
@@ -1878,7 +1887,10 @@ SEL_ARG::tree_delete(SEL_ARG *key)
{
enum leaf_color remove_color;
SEL_ARG *root,*nod,**par,*fix_par;
- root=this; this->parent= 0;
+ DBUG_ENTER("tree_delete");
+
+ root=this;
+ this->parent= 0;
/* Unlink from list */
if (key->prev)
@@ -1925,7 +1937,7 @@ SEL_ARG::tree_delete(SEL_ARG *key)
}
if (root == &null_element)
- return 0; // Maybe root later
+ DBUG_RETURN(0); // Maybe root later
if (remove_color == BLACK)
root=rb_delete_fixup(root,nod,fix_par);
test_rb_tree(root,root->parent);
@@ -1933,7 +1945,7 @@ SEL_ARG::tree_delete(SEL_ARG *key)
root->use_count=this->use_count; // Fix root counters
root->elements=this->elements-1;
root->maybe_flag=this->maybe_flag;
- return root;
+ DBUG_RETURN(root);
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 9d1eb7bc54d..d552429af4b 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2830,7 +2830,7 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table)
if (table->grant.version != grant_version)
{
table->grant.grant_table=
- table_hash_search(thd->host,thd->ip,thd->db,
+ table_hash_search(thd->host, thd->ip, table->table_cache_key,
thd->priv_user,
table->real_name,0); /* purecov: inspected */
table->grant.version=grant_version; /* purecov: inspected */
@@ -2943,7 +2943,7 @@ ulong get_column_grant(THD *thd, TABLE_LIST *table, Field *field)
if (table->grant.version != grant_version)
{
table->grant.grant_table=
- table_hash_search(thd->host,thd->ip,thd->db,
+ table_hash_search(thd->host, thd->ip, table->db,
thd->priv_user,
table->real_name,0); /* purecov: inspected */
table->grant.version=grant_version; /* purecov: inspected */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 28e833b8421..50a150604ef 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1586,7 +1586,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
mysql_log.write(thd,command,db);
- mysql_rm_db(thd,alias,0,0);
+ mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db), 0, 0);
break;
}
#ifndef EMBEDDED_LIBRARY
@@ -3114,7 +3114,8 @@ purposes internal to the MySQL server", MYF(0));
send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION);
goto error;
}
- res=mysql_rm_db(thd,alias,lex->drop_if_exists,0);
+ res=mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : lex->name),
+ lex->drop_if_exists, 0);
break;
}
case SQLCOM_ALTER_DB:
@@ -4185,7 +4186,12 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
break;
case FIELD_TYPE_DECIMAL:
if (!length)
- new_field->length= 10; // Default length for DECIMAL
+ {
+ if ((new_field->length= new_field->decimals))
+ new_field->length++;
+ else
+ new_field->length= 10; // Default length for DECIMAL
+ }
if (new_field->length < MAX_FIELD_WIDTH) // Skip wrong argument
{
new_field->length+=sign_len;