diff options
-rw-r--r-- | mysql-test/r/plugin.result | 3 | ||||
-rw-r--r-- | mysql-test/t/plugin.test | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 48 | ||||
-rw-r--r-- | sql/sql_string.cc | 4 | ||||
-rw-r--r-- | sql/sql_string.h | 14 |
5 files changed, 46 insertions, 25 deletions
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 8169bd458e8..ec9d804d6da 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -111,6 +111,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660 +select create_options from information_schema.tables where table_schema='test' and table_name='t1'; +create_options +`ULL`=4660 ALTER TABLE t1 ULL=DEFAULT; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 55250b73ae5..406821e7a7c 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -120,6 +120,8 @@ CREATE TABLE t1 (a int) ENGINE=example ULL=1e2; CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234; SHOW CREATE TABLE t1; +select create_options from information_schema.tables where table_schema='test' and table_name='t1'; + ALTER TABLE t1 ULL=DEFAULT; SHOW CREATE TABLE t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index cc1e956939c..cae33661b87 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4103,6 +4103,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, else { char option_buff[350],*ptr; + String str(option_buff,sizeof(option_buff), system_charset_info); TABLE *show_table= tables->table; TABLE_SHARE *share= show_table->s; handler *file= show_table->file; @@ -4135,53 +4136,56 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, table->field[4]->store(tmp_buff, strlen(tmp_buff), cs); table->field[5]->store((longlong) share->frm_version, TRUE); - ptr=option_buff; + str.length(0); if (share->min_rows) { - ptr=strmov(ptr," min_rows="); - ptr=longlong10_to_str(share->min_rows,ptr,10); + str.qs_append(STRING_WITH_LEN(" min_rows=")); + str.qs_append(share->min_rows); } if (share->max_rows) { - ptr=strmov(ptr," max_rows="); - ptr=longlong10_to_str(share->max_rows,ptr,10); + str.qs_append(STRING_WITH_LEN(" max_rows=")); + str.qs_append(share->max_rows); } if (share->avg_row_length) { - ptr=strmov(ptr," avg_row_length="); - ptr=longlong10_to_str(share->avg_row_length,ptr,10); + str.qs_append(STRING_WITH_LEN(" avg_row_length=")); + str.qs_append(share->avg_row_length); } if (share->db_create_options & HA_OPTION_PACK_KEYS) - ptr=strmov(ptr," pack_keys=1"); + str.qs_append(STRING_WITH_LEN(" pack_keys=1")); if (share->db_create_options & HA_OPTION_NO_PACK_KEYS) - ptr=strmov(ptr," pack_keys=0"); + str.qs_append(STRING_WITH_LEN(" pack_keys=0")); /* We use CHECKSUM, instead of TABLE_CHECKSUM, for backward compability */ if (share->db_create_options & HA_OPTION_CHECKSUM) - ptr=strmov(ptr," checksum=1"); + str.qs_append(STRING_WITH_LEN(" checksum=1")); if (share->page_checksum != HA_CHOICE_UNDEF) - ptr= strxmov(ptr, " page_checksum=", - ha_choice_values[(uint) share->page_checksum], NullS); + { + str.qs_append(STRING_WITH_LEN(" page_checksum=")); + str.qs_append(ha_choice_values[(uint) share->page_checksum]); + } if (share->db_create_options & HA_OPTION_DELAY_KEY_WRITE) - ptr=strmov(ptr," delay_key_write=1"); + str.qs_append(STRING_WITH_LEN(" delay_key_write=1")); if (share->row_type != ROW_TYPE_DEFAULT) - ptr=strxmov(ptr, " row_format=", - ha_row_type[(uint) share->row_type], - NullS); + { + str.qs_append(STRING_WITH_LEN(" row_format=")); + str.qs_append(ha_row_type[(uint) share->row_type]); + } if (share->key_block_size) { - ptr= strmov(ptr, " key_block_size="); - ptr= longlong10_to_str(share->key_block_size, ptr, 10); + str.qs_append(STRING_WITH_LEN(" key_block_size=")); + str.qs_append(share->key_block_size); } #ifdef WITH_PARTITION_STORAGE_ENGINE if (is_partitioned) - ptr= strmov(ptr, " partitioned"); + str.qs_append(STRING_WITH_LEN(" partitioned")); #endif if (share->transactional != HA_CHOICE_UNDEF) ptr= strxmov(ptr, " transactional=", ha_choice_values[(uint) share->transactional], NullS); - table->field[19]->store(option_buff+1, - (ptr == option_buff ? 0 : - (uint) (ptr-option_buff)-1), cs); + append_create_options(thd, &str, share->option_list); + if (str.length()) + table->field[19]->store(str.ptr()+1, str.length()-1, cs); tmp_buff= (share->table_charset ? share->table_charset->name : "default"); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index db3d07a28a4..eafd8502706 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -687,10 +687,10 @@ void String::qs_append(int i) str_length+= (int) (end-buff); } -void String::qs_append(uint i) +void String::qs_append(ulonglong i) { char *buff= Ptr + str_length; - char *end= int10_to_str(i, buff, 10); + char *end= longlong10_to_str(i, buff,10); str_length+= (int) (end-buff); } diff --git a/sql/sql_string.h b/sql/sql_string.h index a9df0dc2620..f5794cca6b2 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -336,6 +336,10 @@ public: int4store(Ptr + position,value); } + void qs_append(const char *str) + { + qs_append(str, strlen(str)); + } void qs_append(const char *str, uint32 len); void qs_append(double d); void qs_append(double *d); @@ -345,7 +349,15 @@ public: str_length++; } void qs_append(int i); - void qs_append(uint i); + void qs_append(uint i) + { + qs_append((ulonglong)i); + } + void qs_append(ulong i) + { + qs_append((ulonglong)i); + } + void qs_append(ulonglong i); /* Inline (general) functions used by the protocol functions */ |