Commit 62d31f67 authored by Sergei Golubchik's avatar Sergei Golubchik

bugfix: engine defined table options were not showing up in...

bugfix: engine defined table options were not showing up in INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS
parent 3c9dcf9d
......@@ -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
......
......@@ -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;
......
......@@ -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");
......
......@@ -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);
}
......
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment