From c3703e5568c76669c8277e98206a00e6f652b5fd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Apr 2002 13:56:32 +0300 Subject: Don't change FLOAT(X+1,X) to FLOAT(X+2,X) Docs/manual.texi: ChangeLog mysql-test/r/show_check.result: Updated test for SHOW COLUMNS mysql-test/t/show_check.test: Updated test for SHOW COLUMNS --- sql/sql_parse.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4f9140cc3f2..06a121ea30c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2432,9 +2432,9 @@ bool add_field_to_list(char *field_name, enum_field_types type, uint sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1; if (new_field->length && new_field->decimals && - new_field->length < new_field->decimals+2 && + new_field->length < new_field->decimals+1 && new_field->decimals != NOT_FIXED_DEC) - new_field->length=new_field->decimals+2; /* purecov: inspected */ + new_field->length=new_field->decimals+1; /* purecov: inspected */ switch (type) { case FIELD_TYPE_TINY: -- cgit v1.2.1 From 23bf3689667890dd8da518b6478f10090a5adaf4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 May 2002 18:04:21 +0300 Subject: Fixed problems with DECIMAL() type on overflow. Docs/manual.texi: Changlog configure.in: Change to version 3.23.51 Fix for OSF1 include/mysqld_error.h: Added copyright message isam/pack_isam.c: Added copyright message mysql-test/r/type_decimal.result: New test results mysql-test/t/type_decimal.test: New test results strings/Makefile.am: Added mising file --- sql/field.cc | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'sql') diff --git a/sql/field.cc b/sql/field.cc index c6a26a48c0c..246427cc2ac 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -63,8 +63,8 @@ const char field_separator=','; *****************************************************************************/ /* - ** Calculate length of number and it's parts - ** Increment cuted_fields if wrong number + Calculate length of number and it's parts + Increment cuted_fields if wrong number */ static bool @@ -380,13 +380,34 @@ Field_decimal::reset(void) void Field_decimal::overflow(bool negative) { uint len=field_length; - char *to=ptr; - if (negative && !unsigned_flag) + char *to=ptr, filler= '9'; + if (negative) { - *to++ = '-'; - len--; + if (!unsigned_flag) + { + /* Put - sign as a first digit so we'll have -999..999 or 999..999 */ + *to++ = '-'; + len--; + } + else + { + filler= '0'; // Fill up with 0 + if (!zerofill) + { + /* + Handle unsigned integer without zerofill, in which case + the number should be of format ' 0' or ' 0.000' + */ + uint whole_part=field_length- (dec ? dec+2 : 1); + // Fill with spaces up to the first digit + bfill(to, whole_part, ' '); + to+= whole_part; + len-= whole_part; + // The main code will also handle the 0 before the decimal point + } + } } - bfill(to,len,negative && unsigned_flag ? '0' : '9'); + bfill(to, len, filler); if (dec) ptr[field_length-dec-1]='.'; return; @@ -421,10 +442,15 @@ void Field_decimal::store(const char *from,uint len) from++; if (unsigned_flag) // No sign with zerofill { - if (!error) - current_thd->cuted_fields++; - Field_decimal::overflow(1); - return; + if (decstr.sign_char == '+') // just remove "+" + decstr.sign= 0; + else + { + if (!error) + current_thd->cuted_fields++; + Field_decimal::overflow(1); + return; + } } } /* -- cgit v1.2.1 From 10729adbf50768d371c955777622d1fc420a4fe1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 May 2002 18:55:38 -0700 Subject: Backport of Sasha's fix to 3.23 from 4.0 see dev-private email from sasha, subject: URGENT: rpl_sporadic_master BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/slave.cc | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index cff3af42ce1..cb3d375f476 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -837,9 +837,6 @@ command"); static uint read_event(MYSQL* mysql, MASTER_INFO *mi) { uint len = packet_error; - // for convinience lets think we start by - // being in the interrupted state :-) - int read_errno = EINTR; // my_real_read() will time us out // we check if we were told to die, and if not, try reading again @@ -848,27 +845,21 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi) return packet_error; #endif - while (!abort_loop && !abort_slave && len == packet_error && - read_errno == EINTR ) - { - len = mc_net_safe_read(mysql); - read_errno = errno; - } - if (abort_loop || abort_slave) - return packet_error; - if (len == packet_error || (int) len < 1) + len = mc_net_safe_read(mysql); + + if (len == packet_error || (long) len < 1) { - sql_print_error("Error reading packet from server: %s (read_errno %d,\ + sql_print_error("Error reading packet from server: %s (\ server_errno=%d)", - mc_mysql_error(mysql), read_errno, mc_mysql_errno(mysql)); + mc_mysql_error(mysql), mc_mysql_errno(mysql)); return packet_error; } if (len == 1) { sql_print_error("Slave: received 0 length packet from server, apparent\ - master shutdown: %s (%d)", - mc_mysql_error(mysql), read_errno); + master shutdown: %s", + mc_mysql_error(mysql)); return packet_error; } -- cgit v1.2.1 From e67eb77b13f722e00da721d1e620a6e8f882b4b3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 May 2002 11:11:00 +0300 Subject: Fixed bug in ISNULL(not_null_expression) Docs/manual.texi: Changlelog --- sql/item_cmpfunc.cc | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 2b7f4cb6c40..0c0eef37841 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -25,9 +25,9 @@ #include /* -** Test functions -** These returns 0LL if false and 1LL if true and null if some arg is null -** 'AND' and 'OR' never return null + Test functions + These returns 0LL if false and 1LL if true and null if some arg is null + 'AND' and 'OR' never return null */ longlong Item_func_not::val_int() @@ -59,8 +59,10 @@ void Item_bool_func2::fix_length_and_dec() { max_length=1; - /* As some compare functions are generated after sql_yacc, - we have to check for out of memory conditons here */ + /* + As some compare functions are generated after sql_yacc, + we have to check for out of memory conditons here + */ if (!args[0] || !args[1]) return; // Make a special case of compare with fields to get nicer DATE comparisons @@ -336,8 +338,10 @@ void Item_func_between::fix_length_and_dec() { max_length=1; - /* As some compare functions are generated after sql_yacc, - we have to check for out of memory conditons here */ + /* + As some compare functions are generated after sql_yacc, + we have to check for out of memory conditons here + */ if (!args[0] || !args[1] || !args[2]) return; cmp_type=args[0]->result_type(); @@ -389,7 +393,7 @@ longlong Item_func_between::val_int() { longlong value=args[0]->val_int(),a,b; if ((null_value=args[0]->null_value)) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ a=args[1]->val_int(); b=args[2]->val_int(); if (!args[1]->null_value && !args[2]->null_value) @@ -409,7 +413,7 @@ longlong Item_func_between::val_int() { double value=args[0]->val(),a,b; if ((null_value=args[0]->null_value)) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ a=args[1]->val(); b=args[2]->val(); if (!args[1]->null_value && !args[2]->null_value) @@ -594,11 +598,10 @@ Item_func_nullif::val_str(String *str) } /* -** CASE expression + CASE expression + Return the matching ITEM or NULL if all compares (including else) failed */ -/* Return the matching ITEM or NULL if all compares (including else) failed */ - Item *Item_func_case::find_item(String *str) { String *first_expr_str,*tmp; @@ -786,7 +789,7 @@ void Item_func_case::print(String *str) } /* -** Coalesce - return first not NULL argument. + Coalesce - return first not NULL argument. */ String *Item_func_coalesce::val_str(String *str) @@ -841,7 +844,7 @@ void Item_func_coalesce::fix_length_and_dec() } /**************************************************************************** -** classes and function for the IN operator + Classes and function for the IN operator ****************************************************************************/ static int cmp_longlong(longlong *a,longlong *b) @@ -914,7 +917,7 @@ byte *in_longlong::get_value(Item *item) { tmp=item->val_int(); if (item->null_value) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ return (byte*) &tmp; } @@ -932,7 +935,7 @@ byte *in_double::get_value(Item *item) { tmp=item->val(); if (item->null_value) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ return (byte*) &tmp; } @@ -1170,9 +1173,11 @@ longlong Item_cond_and::val_int() { if (item->val_int() == 0) { - /* TODO: In case of NULL, ANSI would require us to continue evaluation - until we get a FALSE value or run out of values; This would - require a lot of unnecessary evaluation, which we skip for now */ + /* + TODO: In case of NULL, ANSI would require us to continue evaluation + until we get a FALSE value or run out of values; This would + require a lot of unnecessary evaluation, which we skip for now + */ null_value=item->null_value; return 0; } @@ -1201,6 +1206,12 @@ longlong Item_cond_or::val_int() longlong Item_func_isnull::val_int() { + /* + Handle optimization if the argument can't be null + This has to be here because of the test in update_used_tables(). + */ + if (!used_tables_cache) + return 0; (void) args[0]->val(); return (args[0]->null_value) ? 1 : 0; } -- cgit v1.2.1 From daafa8db5049da5a8e3c51edb7cb5b7f36dbc73f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 May 2002 19:08:56 +0300 Subject: Fix for ISNULL() Docs/manual.texi: Chagnelog mysql-test/r/join.result: New tests for IS NULL mysql-test/t/join.test: New tests for IS NULL --- sql/item_cmpfunc.cc | 2 +- sql/item_cmpfunc.h | 7 +++++++ sql/item_timefunc.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0c0eef37841..73821f8d826 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1211,7 +1211,7 @@ longlong Item_func_isnull::val_int() This has to be here because of the test in update_used_tables(). */ if (!used_tables_cache) - return 0; + return cached_value; (void) args[0]->val(); return (args[0]->null_value) ? 1 : 0; } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 5ee0687c064..e7c598808e8 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -429,6 +429,7 @@ class Item_func_in :public Item_int_func class Item_func_isnull :public Item_bool_func { + longlong cached_value; public: Item_func_isnull(Item *a) :Item_bool_func(a) {} longlong val_int(); @@ -449,6 +450,12 @@ public: args[0]->update_used_tables(); used_tables_cache=args[0]->used_tables(); } + if (!used_tables_cache) + { + /* Remember if the value is always NULL or never NULL */ + args[0]->val(); + cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0; + } } optimize_type select_optimize() const { return OPTIMIZE_NULL; } }; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 6913d4c6809..720f8ba2882 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -47,7 +47,7 @@ public: Item_func_to_days(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "to_days"; } - void fix_length_and_dec() { decimals=0; max_length=6; } + void fix_length_and_dec() { decimals=0; max_length=6; maybe_null=1; } }; -- cgit v1.2.1 From 716ed1168f280cd75df310ca80d85b58339b10ef Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 12 May 2002 23:01:45 -0300 Subject: Sergei's MyODBC fix --- sql/log.cc | 4 ++-- sql/slave.cc | 2 +- sql/sql_acl.cc | 8 ++++---- sql/sql_select.cc | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index bc2b19d921f..f4284ac6bad 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -372,14 +372,14 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log) error = LOG_INFO_MEM; goto err; } - if (init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024)) + if (my_init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024)) { error = LOG_INFO_MEM; goto err; } logs_to_purge_inited = 1; - if (init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024)) + if (my_init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024)) { error = LOG_INFO_MEM; goto err; diff --git a/sql/slave.cc b/sql/slave.cc index cb3d375f476..946cf483e4b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -114,7 +114,7 @@ void init_table_rule_hash(HASH* h, bool* h_inited) void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited) { - init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, + my_init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, TABLE_RULE_ARR_SIZE); *a_inited = 1; } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 33924ada8ab..e6b0248e29b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -158,7 +158,7 @@ int acl_init(bool dont_read_acl_tables) init_sql_alloc(&mem,1024,0); init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0); - VOID(init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50)); + VOID(my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50)); while (!(read_record_info.read_record(&read_record_info))) { ACL_HOST host; @@ -182,7 +182,7 @@ int acl_init(bool dont_read_acl_tables) freeze_size(&acl_hosts); init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0); - VOID(init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100)); + VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100)); if (table->field[2]->field_length == 8 && protocol_version == PROTOCOL_VERSION) { @@ -236,7 +236,7 @@ int acl_init(bool dont_read_acl_tables) freeze_size(&acl_users); init_read_record(&read_record_info,thd,table=tables[2].table,NULL,1,0); - VOID(init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100)); + VOID(my_init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100)); while (!(read_record_info.read_record(&read_record_info))) { ACL_DB db; @@ -688,7 +688,7 @@ int wild_case_compare(const char *str,const char *wildstr) static void init_check_host(void) { DBUG_ENTER("init_check_host"); - VOID(init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), + VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), acl_users.elements,1)); VOID(hash_init(&acl_check_hosts,acl_users.elements,0,0, (hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE)); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c4383cbb09f..c6339c2c34f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1462,7 +1462,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, join_tab[i].table->map); } } - if (init_dynamic_array(keyuse,sizeof(KEYUSE),20,64)) + if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64)) return TRUE; /* fill keyuse with found key parts */ for (KEY_FIELD *field=key_fields ; field != end ; field++) -- cgit v1.2.1 From f876e01f9d7c92d3dd61dbaaf708789442cc07e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2002 14:42:03 +0300 Subject: DROP DATABASE with symlinks did not work before --- sql/sql_db.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 1e798a392b1..372dff85007 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -271,9 +271,16 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path, */ if (!found_other_files) { - char tmp_path[FN_REFLEN]; + char tmp_path[FN_REFLEN], lnk_path[FN_REFLEN]; char *path=unpack_filename(tmp_path,org_path); #ifdef HAVE_READLINK + if (path[0] == FN_CURLIB) + { + int length = (strxmov(lnk_path,curr_dir,path + 2, NullS) - lnk_path) - 1; + path=lnk_path; + if (path[length] == FN_LIBCHAR) + path[length]='\0'; + } int linkcount = readlink(path,filePath,sizeof(filePath)-1); if (linkcount > 0) // If the path was a symbolic link { -- cgit v1.2.1 From 3051d8bbc15ef775dcb549fd00be596d61131fcf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2002 19:06:23 +0300 Subject: Corrected fix for DROP DATABASE on symbolic link --- sql/sql_db.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'sql') diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 372dff85007..451a48042b5 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -271,20 +271,20 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path, */ if (!found_other_files) { - char tmp_path[FN_REFLEN], lnk_path[FN_REFLEN]; + char tmp_path[FN_REFLEN], *pos; char *path=unpack_filename(tmp_path,org_path); #ifdef HAVE_READLINK - if (path[0] == FN_CURLIB) - { - int length = (strxmov(lnk_path,curr_dir,path + 2, NullS) - lnk_path) - 1; - path=lnk_path; - if (path[length] == FN_LIBCHAR) - path[length]='\0'; - } - int linkcount = readlink(path,filePath,sizeof(filePath)-1); - if (linkcount > 0) // If the path was a symbolic link + int error; + + /* Remove end FN_LIBCHAR as this causes problem on Linux in readlink */ + pos=strend(path); + if (pos > path && pos[-1] == FN_LIBCHAR) + *--pos=0; + + if ((error=my_readlink(filePath, path, MYF(MY_WME))) < 0) + DBUG_RETURN(-1); + if (!error) { - *(filePath + linkcount) = '\0'; if (my_delete(path,MYF(!level ? MY_WME : 0))) { /* Don't give errors if we can't delete 'RAID' directory */ @@ -293,11 +293,12 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path, send_error(&thd->net); DBUG_RETURN(-1); } - path=filePath; + /* Delete directory symbolic link pointed at */ + path= filePath; } #endif /* Remove last FN_LIBCHAR to not cause a probelm on OS/2 */ - char *pos=strend(path); + pos=strend(path); if (pos > path && pos[-1] == FN_LIBCHAR) *--pos=0; /* Don't give errors if we can't delete 'RAID' directory */ -- cgit v1.2.1 From eba5ec8b4bceabab302462db850882f715a7b040 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 01:01:26 +0300 Subject: Fixed bug in datetime range optimization Docs/manual.texi: Changelog mysql-test/r/type_datetime.result: Test of datetime optimization mysql-test/t/type_datetime.test: Test of datetime optimization --- sql/item.h | 19 +++++++++++++++++++ sql/item_cmpfunc.cc | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/item.h b/sql/item.h index 41b897956db..b8903756027 100644 --- a/sql/item.h +++ b/sql/item.h @@ -342,6 +342,25 @@ public: }; +/* + The following class is used to optimize comparing of date columns + We need to save the original item, to be able to set the field to the + original value in 'opt_range'. +*/ + +class Item_int_with_ref :public Item_int +{ + Item *ref; +public: + Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg) + {} + bool save_in_field(Field *field) + { + return ref->save_in_field(field); + } +}; + + #include "item_sum.h" #include "item_func.h" #include "item_cmpfunc.h" diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 73821f8d826..ae50090fea1 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -45,8 +45,8 @@ static bool convert_constant_item(Field *field, Item **item) (*item)->save_in_field(field); if (!((*item)->null_value)) { - Item *tmp=new Item_int(field->val_int()); - if ((tmp)) + Item *tmp=new Item_int_with_ref(field->val_int(), *item); + if (tmp) *item=tmp; return 1; } -- cgit v1.2.1 From 00d62e8dc5ded1f4ab612d05f8807312c05da9f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 11:06:44 +0200 Subject: Fixed sql_yacc.yy to be compatible with bison 1.31 and above. Made detection of GNU tar a bit more flexible. Only use /usr/local/mysql-glibc if it actually exists Build-tools/Do-linux-build: Only use the "--with-other-libc" parameter, if another libc actually exists at this location Makefile.am: Removed hard-coded tar binary name configure.in: Added check for GNU tar with various names sql/sql_yacc.yy: Added semicolons to several expressions to make bison 1.31 and above happy when used in Yacc compatibility mode. From the bison NEWS: "Bison has always permitted actions such as { $$ = $1 }: it adds the ending semicolon. Now if in Yacc compatibility mode, the semicolon is no longer output: one has to write { $$ = $1; }." BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/sql_yacc.yy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0cbf6f45194..c01532e48f7 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -726,7 +726,7 @@ opt_table_options: table_options: table_option { $$=$1; } - | table_option table_options { $$= $1 | $2 } + | table_option table_options { $$= $1 | $2; } table_option: TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; } @@ -1469,7 +1469,7 @@ simple_expr: (Item_func_match *)($$=new Item_func_match(*$2,$5))); } | BINARY expr %prec NEG { $$= new Item_func_binary($2); } | CASE_SYM opt_expr WHEN_SYM when_list opt_else END - { $$= new Item_func_case(* $4, $2, $5 ) } + { $$= new Item_func_case(* $4, $2, $5 ); } | FUNC_ARG0 '(' ')' { $$= ((Item*(*)(void))($1.symbol->create_func))();} | FUNC_ARG1 '(' expr ')' @@ -1696,7 +1696,7 @@ sum_expr: { $$=new Item_sum_sum($3); } in_sum_expr: - { Lex->in_sum_expr++ } + { Lex->in_sum_expr++; } expr { Lex->in_sum_expr--; @@ -1730,7 +1730,7 @@ opt_else: | ELSE expr { $$= $2; } when_list: - { Lex->when_list.push_front(new List) } + { Lex->when_list.push_front(new List); } when_list2 { $$= Lex->when_list.pop(); } @@ -1753,7 +1753,7 @@ opt_pad: join_table_list: '(' join_table_list ')' { $$=$2; } | join_table { $$=$1; } - | join_table_list normal_join join_table { $$=$3 } + | join_table_list normal_join join_table { $$=$3; } | join_table_list STRAIGHT_JOIN join_table { $$=$3 ; $$->straight=1; } | join_table_list INNER_SYM JOIN_SYM join_table ON expr { add_join_on($4,$6); $$=$4; } @@ -1808,7 +1808,7 @@ opt_key_definition: { Lex->ignore_index= *$2; Lex->ignore_index_ptr= &Lex->ignore_index;} key_usage_list: - key_or_index { Lex->interval_list.empty() } '(' key_usage_list2 ')' + key_or_index { Lex->interval_list.empty(); } '(' key_usage_list2 ')' { $$= &Lex->interval_list; } key_usage_list2: @@ -2287,7 +2287,7 @@ describe: YYABORT; } opt_describe_column - | describe_command select { Lex->options|= SELECT_DESCRIBE }; + | describe_command select { Lex->options|= SELECT_DESCRIBE; }; describe_command: @@ -2456,7 +2456,7 @@ literal: | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } | NULL_SYM { $$ = new Item_null(); Lex->next_state=STATE_OPERATOR_OR_IDENT;} - | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length)}; + | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length); } | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; } -- cgit v1.2.1 From d2b95cd7ab5b3ed450af572e9c77cd11d3c420ba Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 May 2002 16:32:51 +0300 Subject: New my_gethostbyname_r() handling Changed some status variable names Fix bug in GRANT ... PASSWORD string Docs/manual.texi: Update of variable names include/my_net.h: New my_gethostbyname_r() handling include/my_pthread.h: New my_gethostbyname_r() handling libmysql/Makefile.shared: New my_gethostbyname_r() handling libmysql/libmysql.c: New my_gethostbyname_r() handling mysys/Makefile.am: New my_gethostbyname_r() handling mysys/my_pthread.c: New my_gethostbyname_r() handling mysys/my_thr_init.c: New my_gethostbyname_r() handling sql/hostname.cc: New my_gethostbyname_r() handling sql/mini_client.cc: New my_gethostbyname_r() handling sql/mysqld.cc: change some status variable names sql/sql_acl.cc: Fix bug in GRANT ... PASSWORD string --- sql/hostname.cc | 7 ++++++- sql/mini_client.cc | 15 ++------------- sql/mysqld.cc | 4 ++-- sql/sql_acl.cc | 13 +++++++++---- 4 files changed, 19 insertions(+), 20 deletions(-) (limited to 'sql') diff --git a/sql/hostname.cc b/sql/hostname.cc index bc812341337..21dbd5a2bbe 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -171,17 +171,22 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) { DBUG_PRINT("error",("gethostbyname_r returned %d",tmp_errno)); add_wrong_ip(in); + my_gethostbyname_r_free(); DBUG_RETURN(0); } if (!hp->h_name[0]) { DBUG_PRINT("error",("Got an empty hostname")); add_wrong_ip(in); + my_gethostbyname_r_free(); DBUG_RETURN(0); // Don't allow empty hostnames } if (!(name=my_strdup(hp->h_name,MYF(0)))) + { + my_gethostbyname_r_free(); DBUG_RETURN(0); // out of memory - + } + my_gethostbyname_r_free(); #else VOID(pthread_mutex_lock(&LOCK_hostname)); if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET))) diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 3dfd58375a5..8f703b80e3a 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -614,7 +614,6 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr)); } else -#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD) { int tmp_errno; struct hostent tmp_hostent,*hp; @@ -625,22 +624,12 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, { net->last_errno=CR_UNKNOWN_HOST; sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno); + my_gethostbyname_r_free(); goto error; } memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); + my_gethostbyname_r_free(); } -#else - { - struct hostent *hp; - if (!(hp=gethostbyname(host))) - { - net->last_errno=CR_UNKNOWN_HOST; - sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno); - goto error; - } - memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); - } -#endif sock_addr.sin_port = (ushort) htons((ushort) port); if (mc_sock_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), mysql->options.connect_timeout) <0) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ebb7592820b..9ac6ea6fff8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3149,10 +3149,10 @@ struct show_var_st status_vars[]= { {"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG}, {"Com_show_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG}, {"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),SHOW_LONG}, - {"Com_show_master_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG}, + {"Com_show_master_status", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG}, {"Com_show_open_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_OPEN_TABLES),SHOW_LONG}, {"Com_show_processlist", (char*) (com_stat+(uint) SQLCOM_SHOW_PROCESSLIST),SHOW_LONG}, - {"Com_show_slave_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, + {"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, {"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG}, {"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG}, {"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG}, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e6b0248e29b..446076e0d55 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -983,12 +983,17 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo, char *password,empty_string[1]; DBUG_ENTER("replace_user_table"); + password=empty_string; + empty_string[0]=0; + if (combo.password.str && combo.password.str[0]) - password=combo.password.str; - else { - password=empty_string; - empty_string[0]=0; + if (combo.password.length != HASH_PASSWORD_LENGTH) + { + my_error(ER_PASSWORD_NO_MATCH,MYF(0)); + DBUG_RETURN(-1); + } + password=combo.password.str; } table->field[0]->store(combo.host.str,combo.host.length); -- cgit v1.2.1