1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

SQL: 0.3 per column versioning syntax, .frm, optimized updates and tests

This commit is contained in:
Kosov Eugene
2016-10-02 12:35:50 +03:00
committed by Aleksey Midenkov
parent 2db17e6624
commit a9a56b2355
18 changed files with 440 additions and 83 deletions

View File

@@ -138,7 +138,6 @@ static void sql_kill_user(THD *thd, LEX_USER *user, killed_state state);
static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables);
static bool execute_show_status(THD *, TABLE_LIST *);
static bool check_rename_table(THD *, TABLE_LIST *, TABLE_LIST *);
static bool check_system_versioning(Table_scope_and_contents_source_st *);
const char *any_db="*any*"; // Special symbol for check_access
@@ -3856,11 +3855,7 @@ mysql_execute_command(THD *thd)
goto end_with_restore_list;
}
if (System_versioning_info *info= create_info.get_system_versioning_info())
if (info->add_implicit_fields(thd, &alter_info))
goto end_with_restore_list;
if (check_system_versioning(&create_info))
if (create_info.system_versioning_info.check(thd, &alter_info))
goto end_with_restore_list;
/* Check privileges */
@@ -7326,66 +7321,6 @@ bool check_fk_parent_table_access(THD *thd,
}
/****************************************************************************
Checks related to system versioning
****************************************************************************/
static bool check_system_versioning(Table_scope_and_contents_source_st *create_info)
{
const System_versioning_info *versioning_info = &create_info->system_versioning_info;
if (!versioning_info->versioned)
return false;
bool r = false;
if (!versioning_info->declared_system_versioning)
{
r = true;
my_error(ER_MISSING_WITH_SYSTEM_VERSIONING, MYF(0));
}
if (!versioning_info->generated_as_row.start)
{
r = true;
my_error(ER_SYS_START_NOT_SPECIFIED, MYF(0));
}
if (!versioning_info->generated_as_row.end)
{
r = true;
my_error(ER_SYS_END_NOT_SPECIFIED, MYF(0));
}
if (!versioning_info->period_for_system_time.start || !versioning_info->period_for_system_time.end)
{
r = true;
my_error(ER_MISSING_PERIOD_FOR_SYSTEM_TIME, MYF(0));
}
if (!r)
{
if (my_strcasecmp(system_charset_info,
versioning_info->generated_as_row.start->c_ptr(),
versioning_info->period_for_system_time.start->c_ptr()))
{
r = true;
my_error(ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_START_COLUMN, MYF(0));
}
if (my_strcasecmp(system_charset_info,
versioning_info->generated_as_row.end->c_ptr(),
versioning_info->period_for_system_time.end->c_ptr()))
{
r = true;
my_error(ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_END_COLUMN, MYF(0));
}
}
return r; // false means no error
}
/****************************************************************************
Check stack size; Send error if there isn't enough stack to continue
****************************************************************************/