[Maria-developers] Rev 2784: small changes to WL#43: in http://bazaar.launchpad.net/~maria-captains/maria/5.2/
At http://bazaar.launchpad.net/~maria-captains/maria/5.2/ ------------------------------------------------------------ revno: 2784 revision-id: sergii@pisem.net-20100430101225-dhby6azvhpef1vme parent: sergii@pisem.net-20100408210307-j82aap23b14h7j3t committer: Sergei Golubchik <sergii@pisem.net> branch nick: 5.2 timestamp: Fri 2010-04-30 12:12:25 +0200 message: small changes to WL#43: consistency: don't use "index" and "key" interchangeably => rename "key" to "index" consistency: all option types are logical, besides ULL => rename ULL to NUMBER don't accept floats where integers are expected accept hexadecimal where integers are expected === modified file 'mysql-test/r/plugin.result' --- a/mysql-test/r/plugin.result 2010-04-08 17:19:01 +0000 +++ b/mysql-test/r/plugin.result 2010-04-30 10:12:25 +0000 @@ -101,6 +101,17 @@ drop table t1; SET SQL_MODE=''; CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; ERROR HY000: Incorrect value '10000000000000000000' for option 'ULL' +CREATE TABLE t1 (a int) ENGINE=example ULL=10.00; +ERROR 42000: Only integers allowed as number here near '10.00' at line 1 +CREATE TABLE t1 (a int) ENGINE=example ULL=1e2; +ERROR 42000: Only integers allowed as number here near '1e2' at line 1 +CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660 +DROP TABLE t1; SET @@SQL_MODE=@OLD_SQL_MODE; select 1; 1 === modified file 'mysql-test/t/plugin.test' --- a/mysql-test/t/plugin.test 2010-04-08 17:19:01 +0000 +++ b/mysql-test/t/plugin.test 2010-04-30 10:12:25 +0000 @@ -110,6 +110,17 @@ drop table t1; SET SQL_MODE=''; --error ER_BAD_OPTION_VALUE CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; + +--error ER_PARSE_ERROR +CREATE TABLE t1 (a int) ENGINE=example ULL=10.00; + +--error ER_PARSE_ERROR +CREATE TABLE t1 (a int) ENGINE=example ULL=1e2; + +CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234; +SHOW CREATE TABLE t1; +DROP TABLE t1; + SET @@SQL_MODE=@OLD_SQL_MODE; # === modified file 'sql/handler.h' --- a/sql/handler.h 2010-04-08 12:10:05 +0000 +++ b/sql/handler.h 2010-04-30 10:12:25 +0000 @@ -555,19 +555,19 @@ struct handler_log_file_data { /* Definitions for engine-specific table/field/index options in the CREATE TABLE. - Options are declared with HA_*OPTION_* macros (HA_TOPTION_ULL, HA_FOPTION_ENUM, - HA_KOPTION_STRING, etc). + Options are declared with HA_*OPTION_* macros (HA_TOPTION_NUMBER, + HA_FOPTION_ENUM, HA_IOPTION_STRING, etc). Every macros takes the option name, and the name of the underlying field of the appropriate C structure. The "appropriate C structure" is ha_table_option_struct for table level options, ha_field_option_struct for field level options, - ha_key_option_struct for key level options. The engine either + ha_index_option_struct for key level options. The engine either defines a structure of this name, or uses #define's to map these "appropriate" names to the actual structure type name. ULL options use a ulonglong as the backing store. - HA_*OPTION_ULL() takes the option name, the structure field name, + HA_*OPTION_NUMBER() takes the option name, the structure field name, the default value for the option, min, max, and blk_siz values. STRING options use a char* as a backing store. @@ -595,7 +595,7 @@ enum ha_option_type { HA_OPTION_TYPE_ULL HA_OPTION_TYPE_ENUM, /* uint */ HA_OPTION_TYPE_BOOL}; /* bool */ -#define HA_xOPTION_ULL(name, struc, field, def, min, max, blk_siz) \ +#define HA_xOPTION_NUMBER(name, struc, field, def, min, max, blk_siz) \ { HA_OPTION_TYPE_ULL, name, sizeof(name)-1, \ offsetof(struc, field), def, min, max, blk_siz, 0 } #define HA_xOPTION_STRING(name, struc, field) \ @@ -610,8 +610,8 @@ enum ha_option_type { HA_OPTION_TYPE_ULL offsetof(struc, field), def, 0, 1, 0, 0 } #define HA_xOPTION_END { HA_OPTION_TYPE_ULL, 0, 0, 0, 0, 0, 0, 0, 0 } -#define HA_TOPTION_ULL(name, field, def, min, max, blk_siz) \ - HA_xOPTION_ULL(name, ha_table_option_struct, field, def, min, max, blk_siz) +#define HA_TOPTION_NUMBER(name, field, def, min, max, blk_siz) \ + HA_xOPTION_NUMBER(name, ha_table_option_struct, field, def, min, max, blk_siz) #define HA_TOPTION_STRING(name, field) \ HA_xOPTION_STRING(name, ha_table_option_struct, field) #define HA_TOPTION_ENUM(name, field, values, def) \ @@ -620,8 +620,8 @@ enum ha_option_type { HA_OPTION_TYPE_ULL HA_xOPTION_BOOL(name, ha_table_option_struct, field, def) #define HA_TOPTION_END HA_xOPTION_END -#define HA_FOPTION_ULL(name, field, def, min, max, blk_siz) \ - HA_xOPTION_ULL(name, ha_field_option_struct, field, def, min, max, blk_siz) +#define HA_FOPTION_NUMBER(name, field, def, min, max, blk_siz) \ + HA_xOPTION_NUMBER(name, ha_field_option_struct, field, def, min, max, blk_siz) #define HA_FOPTION_STRING(name, field) \ HA_xOPTION_STRING(name, ha_field_option_struct, field) #define HA_FOPTION_ENUM(name, field, values, def) \ @@ -630,15 +630,15 @@ enum ha_option_type { HA_OPTION_TYPE_ULL HA_xOPTION_BOOL(name, ha_field_option_struct, field, def) #define HA_FOPTION_END HA_xOPTION_END -#define HA_KOPTION_ULL(name, field, def, min, max, blk_siz) \ - HA_xOPTION_ULL(name, ha_key_option_struct, field, def, min, max, blk_siz) -#define HA_KOPTION_STRING(name, field) \ - HA_xOPTION_STRING(name, ha_key_option_struct, field) -#define HA_KOPTION_ENUM(name, field, values, def) \ - HA_xOPTION_ENUM(name, ha_key_option_struct, field, values, def) -#define HA_KOPTION_BOOL(name, field, values, def) \ - HA_xOPTION_BOOL(name, ha_key_option_struct, field, values, def) -#define HA_KOPTION_END HA_xOPTION_END +#define HA_IOPTION_NUMBER(name, field, def, min, max, blk_siz) \ + HA_xOPTION_NUMBER(name, ha_index_option_struct, field, def, min, max, blk_siz) +#define HA_IOPTION_STRING(name, field) \ + HA_xOPTION_STRING(name, ha_index_option_struct, field) +#define HA_IOPTION_ENUM(name, field, values, def) \ + HA_xOPTION_ENUM(name, ha_index_option_struct, field, values, def) +#define HA_IOPTION_BOOL(name, field, values, def) \ + HA_xOPTION_BOOL(name, ha_index_option_struct, field, values, def) +#define HA_IOPTION_END HA_xOPTION_END typedef struct st_ha_create_table_option { enum ha_option_type type; @@ -1060,7 +1060,7 @@ typedef struct st_ha_create_information /* the following three are only for ALTER TABLE, check_if_incompatible_data() */ void *option_struct; ///< structure with parsed table options void **fileds_option_struct; ///< array of field option structures - void **keys_option_struct; ///< array of key option structures + void **indexes_option_struct; ///< array of index option structures } HA_CREATE_INFO; === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc 2010-04-08 12:10:05 +0000 +++ b/sql/sql_table.cc 2010-04-30 10:12:25 +0000 @@ -5783,7 +5783,7 @@ compare_tables(TABLE *table, if ((create_info->fileds_option_struct= (void**)thd->calloc(sizeof(void*) * table->s->fields)) == NULL || - (create_info->keys_option_struct= + (create_info->indexes_option_struct= (void**)thd->calloc(sizeof(void*) * table->s->keys)) == NULL) DBUG_RETURN(1); @@ -5984,7 +5984,7 @@ compare_tables(TABLE *table, else { DBUG_ASSERT(i < table->s->keys); - create_info->keys_option_struct[i]= new_key->option_struct; + create_info->indexes_option_struct[i]= new_key->option_struct; } } === modified file 'sql/sql_yacc.yy' --- a/sql/sql_yacc.yy 2010-04-08 12:10:05 +0000 +++ b/sql/sql_yacc.yy 2010-04-30 10:12:25 +0000 @@ -4769,7 +4769,7 @@ create_table_option: engine_option_value($1, $3, false, &Lex->create_info.option_list, &Lex->option_list_last); } - | IDENT_sys equal ulonglong_num + | IDENT_sys equal real_ulonglong_num { new (YYTHD->mem_root) engine_option_value($1, $3, &Lex->create_info.option_list, @@ -5434,7 +5434,7 @@ attribute: engine_option_value($1, $3, false, &Lex->option_list, &Lex->option_list_last); } - | IDENT_sys equal ulonglong_num + | IDENT_sys equal real_ulonglong_num { new (YYTHD->mem_root) engine_option_value($1, $3, &Lex->option_list, @@ -5746,7 +5746,7 @@ all_key_opt: engine_option_value($1, $3, false, &Lex->option_list, &Lex->option_list_last); } - | IDENT_sys equal ulonglong_num + | IDENT_sys equal real_ulonglong_num { new (YYTHD->mem_root) engine_option_value($1, $3, &Lex->option_list, @@ -9472,6 +9472,7 @@ ulonglong_num: real_ulonglong_num: NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | HEX_NUM { $$= strtoull($1.str, (char**) 0, 16); } | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } | dec_num_error { MYSQL_YYABORT; } ; === modified file 'storage/example/ha_example.cc' --- a/storage/example/ha_example.cc 2010-04-08 12:10:05 +0000 +++ b/storage/example/ha_example.cc 2010-04-30 10:12:25 +0000 @@ -151,7 +151,7 @@ ha_create_table_option example_table_opt range of values 0..UINT_MAX32, and a "block size" of 10 (any value must be divisible by 10). */ - HA_TOPTION_ULL("ULL", ullparam, UINT_MAX32, 0, UINT_MAX32, 10), + HA_TOPTION_NUMBER("ULL", ullparam, UINT_MAX32, 0, UINT_MAX32, 10), /* one option that takes an arbitrary string */
participants (1)
-
serg@askmonty.org