diff options
-rw-r--r-- | Docs/manual.texi | 6 | ||||
-rw-r--r-- | sql/ha_innodb.cc | 7 | ||||
-rw-r--r-- | sql/ha_innodb.h | 6 | ||||
-rw-r--r-- | sql/sql_acl.cc | 13 | ||||
-rw-r--r-- | sql/time.cc | 19 |
5 files changed, 42 insertions, 9 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index c421ff3095f..bf62d2dd083 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -50453,6 +50453,12 @@ each individual 4.0.x release. @itemize @bullet @item +Fixed bug where @code{GRANT}/@code{REVOKE} failed if hostname was given in +not matching case. +@item +Don't give warning in @code{LOAD DATA INFILE} when setting a +@code{timestamp} to a string of '0'. +@item Fixed bug in @code{myisamchk -R} mode. @item Fixed bug that caused @code{mysqld} to crash on @code{REVOKE}. diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index c9449ff5384..670ea914b21 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2179,7 +2179,12 @@ convert_search_mode_to_innobase( case HA_READ_AFTER_KEY: return(PAGE_CUR_G); case HA_READ_BEFORE_KEY: return(PAGE_CUR_L); case HA_READ_PREFIX: return(PAGE_CUR_GE); - case HA_READ_PREFIX_LAST: ut_a(0); return(PAGE_CUR_LE); + case HA_READ_PREFIX_LAST: + /* ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Warning: Using HA_READ_PREFIX_LAST\n"); */ + return(PAGE_CUR_LE); + /* InnoDB does not yet support ..PREFIX_LAST! We have to add a new search flag PAGE_CUR_LE_OR_PREFIX to InnoDB. */ diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index 357fb31b5e3..fad585433d7 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -81,6 +81,10 @@ class ha_innobase: public handler HA_NO_WRITE_DELAYED | HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE | + /* We should also list HA_NOT_READ_PREFIX_LAST + here but it currently seems to break ORDER BY; + until release 4.0.5 some LIKE 'abc%' ... DESC + queries will not work correctly */ HA_NO_PREFIX_CHAR_KEYS | HA_TABLE_SCAN_ON_INDEX), last_dup_key((uint) -1), @@ -96,7 +100,7 @@ class ha_innobase: public handler ulong index_flags(uint idx) const { return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | - HA_KEY_READ_ONLY | HA_NOT_READ_PREFIX_LAST); + HA_KEY_READ_ONLY); } uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_keys() const { return MAX_KEY; } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 04a3915d457..867163be90d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -643,7 +643,8 @@ static void acl_update_user(const char *user, const char *host, !strcmp(user,acl_user->user)) { if (!acl_user->host.hostname && !host[0] || - acl_user->host.hostname && !strcmp(host,acl_user->host.hostname)) + acl_user->host.hostname && + !my_strcasecmp(host,acl_user->host.hostname)) { acl_user->access=privileges; if (mqh->bits & 1) @@ -732,7 +733,7 @@ static void acl_update_db(const char *user, const char *host, const char *db, !strcmp(user,acl_db->user)) { if (!acl_db->host.hostname && !host[0] || - acl_db->host.hostname && !strcmp(host,acl_db->host.hostname)) + acl_db->host.hostname && !my_strcasecmp(host,acl_db->host.hostname)) { if (!acl_db->db && !db[0] || acl_db->db && !strcmp(db,acl_db->db)) @@ -1666,7 +1667,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip, { if (exact) { - if ((host && !strcmp(host,grant_table->host)) || + if ((host && !my_strcasecmp(host,grant_table->host)) || (ip && !strcmp(ip,grant_table->host))) return grant_table; } @@ -2723,7 +2724,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if (!(host=acl_user->host.hostname)) host="%"; if (!strcmp(lex_user->user.str,user) && - !strcmp(lex_user->host.str,host)) + !my_strcasecmp(lex_user->host.str,host)) break; } if (counter == acl_users.elements) @@ -2870,7 +2871,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) host=""; if (!strcmp(lex_user->user.str,user) && - !strcmp(lex_user->host.str,host)) + !my_strcasecmp(lex_user->host.str,host)) { want_access=acl_db->access; if (want_access) @@ -2929,7 +2930,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) host=""; if (!strcmp(lex_user->user.str,user) && - !strcmp(lex_user->host.str,host)) + !my_strcasecmp(lex_user->host.str,host)) { want_access=grant_table->privs; if ((want_access | grant_table->cols) != 0) diff --git a/sql/time.cc b/sql/time.cc index 1597368908d..4fe79966404 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -429,6 +429,7 @@ timestamp_type str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) { uint field_length,year_length,digits,i,number_of_fields,date[7]; + uint not_zero_date; const char *pos; const char *end=str+length; DBUG_ENTER("str_to_TIME"); @@ -446,6 +447,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) digits= (uint) (pos-str); year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2; field_length=year_length-1; + not_zero_date= 0; for (i=0 ; i < 6 && str != end && isdigit(*str) ; i++) { uint tmp_value=(uint) (uchar) (*str++ - '0'); @@ -455,6 +457,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) str++; } date[i]=tmp_value; + not_zero_date|= tmp_value; if (i == 2 && str != end && *str == 'T') str++; // ISO8601: CCYYMMDDThhmmss else if ( i != 5 ) // Skip inter-field delimiters @@ -478,6 +481,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) while (str++ != end && isdigit(str[0]) && field_length--) tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0'); date[6]=tmp_value; + not_zero_date|= tmp_value; } else date[6]=0; @@ -491,7 +495,20 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) date[2] > 31 || date[3] > 23 || date[4] > 59 || date[5] > 59 || !fuzzy_date && (date[1] == 0 || date[2] == 0)) { - current_thd->cuted_fields++; + /* Only give warning for a zero date if there is some garbage after */ + if (!not_zero_date) // If zero date + { + for (; str != end ; str++) + { + if (!isspace(*str)) + { + not_zero_date= 1; // Give warning + break; + } + } + } + if (not_zero_date) + current_thd->cuted_fields++; DBUG_RETURN(TIMESTAMP_NONE); } if (str != end && current_thd->count_cuted_fields) |