1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

0.1: SQL-level System Versioning

This commit is contained in:
Daniel Fiala
2016-06-19 07:38:28 +01:00
committed by Aleksey Midenkov
parent 14bdfa8541
commit be6f2d302c
115 changed files with 4055 additions and 1101 deletions

View File

@@ -1666,6 +1666,7 @@ static bool get_field_default_value(THD *thd, Field *field, String *def_value,
has_default= (field->default_value ||
(!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
!field->is_generated() &&
field->unireg_check != Field::NEXT_NUMBER));
def_value->length(0);
@@ -2123,6 +2124,14 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
packet->append(STRING_WITH_LEN(" DEFAULT "));
packet->append(def_value.ptr(), def_value.length(), system_charset_info);
}
else if (field->is_generated_row_start())
{
packet->append(STRING_WITH_LEN(" GENERATED AS ROW START"));
}
else if (field->is_generated_row_end())
{
packet->append(STRING_WITH_LEN(" GENERATED AS ROW END"));
}
if (!limited_mysql_mode &&
print_on_update_clause(field, &def_value, false))
@@ -2215,6 +2224,17 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
hton->index_options);
}
if (table->versioned())
{
const Field *fs = table->vers_start_field();
const Field *fe = table->vers_end_field();
packet->append(STRING_WITH_LEN(",\n PERIOD FOR SYSTEM_TIME ("));
append_identifier(thd,packet,fs->field_name, strlen(fs->field_name));
packet->append(STRING_WITH_LEN(", "));
append_identifier(thd,packet,fe->field_name, strlen(fe->field_name));
packet->append(STRING_WITH_LEN(")"));
}
/*
Get possible foreign key definitions stored in InnoDB and append them
to the CREATE TABLE statement
@@ -2253,6 +2273,11 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
add_table_options(thd, table, create_info_arg,
table_list->schema_table != 0, 0, packet);
if (table->versioned())
{
packet->append(STRING_WITH_LEN(" WITH SYSTEM VERSIONING"));
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
{
if (table->part_info &&