YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
bool Alter_info::set_requested_lock(const LEX_CSTRING *str)
{ // To avoid adding new keywords to the grammar, we match strings here. if (lex_string_eq(str, STRING_WITH_LEN("NONE")))
requested_lock= ALTER_TABLE_LOCK_NONE; elseif (lex_string_eq(str, STRING_WITH_LEN("SHARED")))
requested_lock= ALTER_TABLE_LOCK_SHARED; elseif (lex_string_eq(str, STRING_WITH_LEN("EXCLUSIVE")))
requested_lock= ALTER_TABLE_LOCK_EXCLUSIVE; elseif (lex_string_eq(str, STRING_WITH_LEN("DEFAULT")))
requested_lock= ALTER_TABLE_LOCK_DEFAULT; else returntrue; returnfalse;
}
constchar* Alter_info::algorithm_clause(THD *thd) const
{ switch (algorithm(thd)) { case ALTER_TABLE_ALGORITHM_INPLACE: return"ALGORITHM=INPLACE"; case ALTER_TABLE_ALGORITHM_COPY: return"ALGORITHM=COPY"; case ALTER_TABLE_ALGORITHM_NONE:
DBUG_ASSERT(0); /* Fall through */ case ALTER_TABLE_ALGORITHM_DEFAULT: return"ALGORITHM=DEFAULT"; case ALTER_TABLE_ALGORITHM_NOCOPY: return"ALGORITHM=NOCOPY"; case ALTER_TABLE_ALGORITHM_INSTANT: return"ALGORITHM=INSTANT";
}
return NULL; /* purecov: begin deadcode */
}
constchar* Alter_info::lock() const
{ switch (requested_lock) { case ALTER_TABLE_LOCK_SHARED: return"LOCK=SHARED"; case ALTER_TABLE_LOCK_NONE: return"LOCK=NONE"; case ALTER_TABLE_LOCK_DEFAULT: return"LOCK=DEFAULT"; case ALTER_TABLE_LOCK_EXCLUSIVE: return"LOCK=EXCLUSIVE";
} return NULL; /* purecov: begin deadcode */
}
bool Alter_info::supports_algorithm(THD *thd, const Alter_inplace_info *ha_alter_info)
{ switch (ha_alter_info->inplace_supported) { case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: case HA_ALTER_INPLACE_SHARED_LOCK: case HA_ALTER_INPLACE_NO_LOCK: case HA_ALTER_INPLACE_INSTANT: returnfalse; case HA_ALTER_INPLACE_COPY_NO_LOCK: case HA_ALTER_INPLACE_COPY_LOCK: if (algorithm(thd) >= Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY)
{
ha_alter_info->report_unsupported_error(algorithm_clause(thd), "ALGORITHM=INPLACE"); returntrue;
} returnfalse; case HA_ALTER_INPLACE_NOCOPY_NO_LOCK: case HA_ALTER_INPLACE_NOCOPY_LOCK: if (algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_INSTANT)
{
ha_alter_info->report_unsupported_error("ALGORITHM=INSTANT", "ALGORITHM=NOCOPY"); returntrue;
} returnfalse; case HA_ALTER_INPLACE_NOT_SUPPORTED: if (algorithm(thd) >= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE)
{
ha_alter_info->report_unsupported_error(algorithm_clause(thd), "ALGORITHM=COPY"); returntrue;
} returnfalse; case HA_ALTER_ERROR: returntrue;
} /* purecov: begin deadcode */
DBUG_ASSERT(0); returnfalse;
}
bool Alter_info::supports_lock(THD *thd, bool online,
Alter_inplace_info *ha_alter_info)
{ switch (ha_alter_info->inplace_supported) { case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: // If SHARED lock and no particular algorithm was requested, use COPY. if (requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED &&
algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) returnfalse;
if (requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED ||
requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE)
{
ha_alter_info->report_unsupported_error(lock(), "LOCK=EXCLUSIVE"); returntrue;
} returnfalse; case HA_ALTER_INPLACE_NO_LOCK: case HA_ALTER_INPLACE_INSTANT: case HA_ALTER_INPLACE_COPY_NO_LOCK: case HA_ALTER_INPLACE_NOCOPY_NO_LOCK: returnfalse; case HA_ALTER_INPLACE_COPY_LOCK: case HA_ALTER_INPLACE_NOCOPY_LOCK: case HA_ALTER_INPLACE_NOT_SUPPORTED: case HA_ALTER_INPLACE_SHARED_LOCK: if (requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE)
{ if (online)
ha_alter_info->inplace_supported= HA_ALTER_INPLACE_NOT_SUPPORTED; else
{
ha_alter_info->report_unsupported_error("LOCK=NONE", "LOCK=SHARED"); returntrue;
}
} returnfalse; case HA_ALTER_ERROR: returntrue;
} /* purecov: begin deadcode */
DBUG_ASSERT(0); returnfalse;
}
bool Sql_cmd_alter_table::execute(THD *thd)
{
LEX *lex= thd->lex; /* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
SELECT_LEX *select_lex= lex->first_select_lex(); /* first table of first SELECT_LEX */
TABLE_LIST *first_table= (TABLE_LIST*) select_lex->table_list.first;
constbool used_engine= lex->create_info.used_fields & HA_CREATE_USED_ENGINE;
DBUG_ASSERT((m_storage_engine_name.str != NULL) == used_engine); if (used_engine)
{ if (resolve_storage_engine_with_error(thd, &lex->create_info.db_type,
lex->create_info.tmp_table())) returntrue; // Engine not found, substitution is not allowed if (!lex->create_info.db_type) // Not found, but substitution is allowed
lex->create_info.used_fields&= ~HA_CREATE_USED_ENGINE;
}
/* If it is a merge table, check privileges for merge children. */ if (create_info.merge_list)
{ /* Theusermusthave(SELECT_ACL|UPDATE_ACL|DELETE_ACL)onthe underlyingbasetables,eveniftherearetemporarytableswiththesame names.
bool Sql_cmd_discard_import_tablespace::execute(THD *thd)
{ /* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
SELECT_LEX *select_lex= thd->lex->first_select_lex(); /* first table of first SELECT_LEX */
TABLE_LIST *table_list= (TABLE_LIST*) select_lex->table_list.first;
if (check_access(thd, ALTER_ACL, table_list->db.str,
&table_list->grant.privilege,
&table_list->grant.m_internal, 0, 0)) returntrue;
if (check_grant(thd, ALTER_ACL, table_list, false, UINT_MAX, false)) returntrue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.