MXS-1248: Further modifications for CTE

- Fields in CTEs are marked as being used in subselects.
- In qc_mysqlembedded all selects must be walked if CTE is present.
- In qc_sqlite unions need special handling.
This commit is contained in:
Johan Wikman
2017-06-30 12:47:46 +02:00
parent b5d54292a4
commit d060320b36
2 changed files with 33 additions and 16 deletions

View File

@ -1081,7 +1081,7 @@ static void update_field_infos_from_with(QC_SQLITE_INFO* info,
if (pCte->pSelect)
{
update_field_infos_from_select(info, pCte->pSelect, QC_USED_IN_SELECT, NULL);
update_field_infos_from_select(info, pCte->pSelect, QC_USED_IN_SUBSELECT, NULL);
}
}
}
@ -1487,6 +1487,11 @@ static void update_field_infos_from_select(QC_SQLITE_INFO* info,
{
update_field_infos_from_with(info, pSelect->pWith);
}
if ((pSelect->op == TK_UNION) && pSelect->pPrior)
{
update_field_infos_from_select(info, pSelect->pPrior, usage, pExclude);
}
}
static void update_database_names(QC_SQLITE_INFO* info, const char* zDatabase)