mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
System Versioning 1.0 pre5 [closes #407]
Merge branch '10.3' into trunk Both field_visibility and VERS_HIDDEN_FLAG exist independently. TODO: VERS_HIDDEN_FLAG should be replaced with SYSTEM_INVISIBLE (or COMPLETELY_INVISIBLE?).
This commit is contained in:
@ -2183,17 +2183,22 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
||||
*/
|
||||
old_map= tmp_use_all_columns(table, table->read_set);
|
||||
|
||||
bool not_the_first_field= false;
|
||||
for (ptr=table->field ; (field= *ptr); ptr++)
|
||||
{
|
||||
|
||||
uint flags = field->flags;
|
||||
|
||||
if (vers_hide == VERS_HIDE_FULL &&
|
||||
(flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG)))
|
||||
continue;
|
||||
|
||||
if (ptr != table->field)
|
||||
if (field->field_visibility > USER_DEFINED_INVISIBLE)
|
||||
continue;
|
||||
if (not_the_first_field)
|
||||
packet->append(STRING_WITH_LEN(",\n"));
|
||||
|
||||
not_the_first_field= true;
|
||||
packet->append(STRING_WITH_LEN(" "));
|
||||
append_identifier(thd,packet,field->field_name.str,
|
||||
field->field_name.length);
|
||||
@ -2254,6 +2259,10 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
||||
packet->append(STRING_WITH_LEN(" NULL"));
|
||||
}
|
||||
|
||||
if (field->field_visibility == USER_DEFINED_INVISIBLE)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" INVISIBLE"));
|
||||
}
|
||||
def_value.set(def_value_buf, sizeof(def_value_buf), system_charset_info);
|
||||
if (get_field_default_value(thd, field, &def_value, 1))
|
||||
{
|
||||
@ -2300,6 +2309,8 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
||||
|
||||
for (uint i=0 ; i < share->keys ; i++,key_info++)
|
||||
{
|
||||
if (key_info->flags & HA_INVISIBLE_KEY)
|
||||
continue;
|
||||
KEY_PART_INFO *key_part= key_info->key_part;
|
||||
bool found_primary=0;
|
||||
packet->append(STRING_WITH_LEN(",\n "));
|
||||
@ -2853,6 +2864,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
||||
{
|
||||
thd_info->proc_info= "Busy";
|
||||
thd_info->progress= 0.0;
|
||||
thd_info->db= "";
|
||||
}
|
||||
|
||||
thd_info->state_info= thread_state_info(tmp);
|
||||
@ -5835,6 +5847,8 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||
|
||||
for (; (field= *ptr) ; ptr++)
|
||||
{
|
||||
if(field->field_visibility > USER_DEFINED_INVISIBLE)
|
||||
continue;
|
||||
uchar *pos;
|
||||
char tmp[MAX_FIELD_WIDTH];
|
||||
String type(tmp,sizeof(tmp), system_charset_info);
|
||||
@ -5892,11 +5906,11 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||
table->field[16]->store((const char*) pos,
|
||||
strlen((const char*) pos), cs);
|
||||
|
||||
StringBuffer<256> buf;
|
||||
if (field->unireg_check == Field::NEXT_NUMBER)
|
||||
table->field[17]->store(STRING_WITH_LEN("auto_increment"), cs);
|
||||
buf.set(STRING_WITH_LEN("auto_increment"),cs);
|
||||
if (print_on_update_clause(field, &type, true))
|
||||
table->field[17]->store(type.ptr(), type.length(), cs);
|
||||
|
||||
buf.set(type.ptr(), type.length(),cs);
|
||||
if (field->vcol_info)
|
||||
{
|
||||
String gen_s(tmp,sizeof(tmp), system_charset_info);
|
||||
@ -5907,13 +5921,20 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||
table->field[20]->store(STRING_WITH_LEN("ALWAYS"), cs);
|
||||
|
||||
if (field->vcol_info->stored_in_db)
|
||||
table->field[17]->store(STRING_WITH_LEN("STORED GENERATED"), cs);
|
||||
buf.set(STRING_WITH_LEN("STORED GENERATED"), cs);
|
||||
else
|
||||
table->field[17]->store(STRING_WITH_LEN("VIRTUAL GENERATED"), cs);
|
||||
buf.set(STRING_WITH_LEN("VIRTUAL GENERATED"), cs);
|
||||
}
|
||||
else
|
||||
table->field[20]->store(STRING_WITH_LEN("NEVER"), cs);
|
||||
|
||||
/*Invisible can coexist with auto_increment and virtual */
|
||||
if (field->field_visibility == USER_DEFINED_INVISIBLE)
|
||||
{
|
||||
if (buf.length())
|
||||
buf.append(STRING_WITH_LEN(", "));
|
||||
buf.append(STRING_WITH_LEN("INVISIBLE"),cs);
|
||||
}
|
||||
table->field[17]->store(buf.ptr(), buf.length(), cs);
|
||||
table->field[19]->store(field->comment.str, field->comment.length, cs);
|
||||
if (schema_table_store_record(thd, table))
|
||||
DBUG_RETURN(1);
|
||||
@ -6493,6 +6514,9 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
|
||||
}
|
||||
for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
|
||||
{
|
||||
if ((key_info->flags & HA_INVISIBLE_KEY) &&
|
||||
DBUG_EVALUATE_IF("test_invisible_index", 0, 1))
|
||||
continue;
|
||||
KEY_PART_INFO *key_part= key_info->key_part;
|
||||
LEX_CSTRING *str;
|
||||
LEX_CSTRING unknown= {STRING_WITH_LEN("?unknown field?") };
|
||||
|
Reference in New Issue
Block a user