diff options
author | Michael Widenius <monty@askmonty.org> | 2009-02-15 12:58:34 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2009-02-15 12:58:34 +0200 |
commit | a8fdaa6f2c5b2e302bffb069be3475772ca20f48 (patch) | |
tree | b5c9560ec7346f7af6a5904ad344fdbb8020849c /sql/sql_table.cc | |
parent | 115efe100dbc1393bce964fa1370e50cfef71d18 (diff) | |
parent | f7a24d72dc7a86341da4634f6d1a71f1ea77000b (diff) | |
download | mariadb-git-a8fdaa6f2c5b2e302bffb069be3475772ca20f48.tar.gz |
Merge with base MySQL 5.1
Contains fixes for test cases
Changed release tag to beta
configure.in:
change release tag to beta
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e91a82a0b1d..47440c2cfe4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -114,6 +114,30 @@ uint filename_to_tablename(const char *from, char *to, uint to_length) } +/** + Check if given string begins with "#mysql50#" prefix, cut it if so. + + @param from string to check and cut + @param to[out] buffer for result string + @param to_length its size + + @retval + 0 no prefix found + @retval + non-0 result string length +*/ + +uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length) +{ + if (from[0] == '#' && + !strncmp(from, MYSQL50_TABLE_NAME_PREFIX, + MYSQL50_TABLE_NAME_PREFIX_LENGTH)) + return (uint) (strmake(to, from + MYSQL50_TABLE_NAME_PREFIX_LENGTH, + to_length - 1) - to); + return 0; +} + + /* Translate a table name to a file name (WL #1324). @@ -133,11 +157,8 @@ uint tablename_to_filename(const char *from, char *to, uint to_length) DBUG_ENTER("tablename_to_filename"); DBUG_PRINT("enter", ("from '%s'", from)); - if (from[0] == '#' && !strncmp(from, MYSQL50_TABLE_NAME_PREFIX, - MYSQL50_TABLE_NAME_PREFIX_LENGTH)) - DBUG_RETURN((uint) (strmake(to, from+MYSQL50_TABLE_NAME_PREFIX_LENGTH, - to_length-1) - - (from + MYSQL50_TABLE_NAME_PREFIX_LENGTH))); + if ((length= check_n_cut_mysql50_prefix(from, to, to_length))) + DBUG_RETURN(length); length= strconvert(system_charset_info, from, &my_charset_filename, to, to_length, &errors); if (check_if_legal_tablename(to) && @@ -3111,10 +3132,12 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, warn_buff); } - + if ((sql_field->flags & BLOB_FLAG) && sql_field->length) { - if (sql_field->sql_type == MYSQL_TYPE_BLOB) + if (sql_field->sql_type == FIELD_TYPE_BLOB || + sql_field->sql_type == FIELD_TYPE_TINY_BLOB || + sql_field->sql_type == FIELD_TYPE_MEDIUM_BLOB) { /* The user has given a length to the blob column */ sql_field->sql_type= get_blob_type_from_length(sql_field->length); @@ -3426,14 +3449,6 @@ bool mysql_create_table_no_lock(THD *thd, } else { - #ifdef FN_DEVCHAR - /* check if the table name contains FN_DEVCHAR when defined */ - if (strchr(alias, FN_DEVCHAR)) - { - my_error(ER_WRONG_TABLE_NAME, MYF(0), alias); - DBUG_RETURN(TRUE); - } -#endif path_length= build_table_filename(path, sizeof(path), db, alias, reg_ext, internal_tmp_table ? FN_IS_TMP : 0); } @@ -4328,6 +4343,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, table->table=0; // For query cache if (protocol->write()) goto err; + thd->main_da.reset_diagnostics_area(); continue; /* purecov: end */ } @@ -5881,7 +5897,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, if (key_info->flags & HA_USES_BLOCK_SIZE) key_create_info.block_size= key_info->block_size; if (key_info->flags & HA_USES_PARSER) - key_create_info.parser_name= *key_info->parser_name; + key_create_info.parser_name= *plugin_name(key_info->parser); if (key_info->flags & HA_SPATIAL) key_type= Key::SPATIAL; |