MXS-884: Update exclusion code

This commit is contained in:
Johan Wikman 2016-11-06 21:04:18 +02:00
parent ac4999ec76
commit add7577f08
2 changed files with 29 additions and 7 deletions

View File

@ -1793,17 +1793,27 @@ static bool should_exclude(const char* name, List<Item>* excludep)
while (!exclude && (exclude_item = ilist++))
{
const char* exclude_name = exclude_item->full_name();
if (strchr(exclude_name, '.') == NULL)
{
exclude_name = exclude_item->name;
}
const char* exclude_name = exclude_item->name;
if (exclude_name && (strcasecmp(name, exclude_name) == 0))
{
exclude = true;
}
if (!exclude)
{
exclude_name = strrchr(exclude_item->full_name(), '.');
if (exclude_name)
{
++exclude_name; // Char after the '.'
if (strcasecmp(name, exclude_name) == 0)
{
exclude = true;
}
}
}
}
return exclude;

View File

@ -663,6 +663,18 @@ static bool should_exclude(const char* zName, const ExprList* pExclude)
Expr* pExpr = item->pExpr;
if (pExpr->op == TK_EQ)
{
// We end up here e.g with "UPDATE t set t.col = 5 ..."
// So, we pick the left branch.
pExpr = pExpr->pLeft;
}
while (pExpr->op == TK_DOT)
{
pExpr = pExpr->pRight;
}
if (pExpr->op == TK_ID)
{
// We need to ensure that we do not report fields where there
@ -1596,7 +1608,7 @@ void mxs_sqlite3Update(Parse* pParse, SrcList* pTabList, ExprList* pChanges, Exp
if (pWhere)
{
update_fields_infos(info, 0, pWhere, QC_TOKEN_MIDDLE, NULL);
update_fields_infos(info, 0, pWhere, QC_TOKEN_MIDDLE, pChanges);
}
exposed_sqlite3SrcListDelete(pParse->db, pTabList);