List<QueryElement> whereElemNames, List<QueryElement> selectElemNames) {
Set<DatabaseTable> tables = new HashSet<DatabaseTable>();
// add tables from where element set
if (whereElemNames != null) {
for (QueryElement qe : whereElemNames) {
MappingField fld = mapping.getFieldByLocalName(qe.getValue());
if (fld != null) {
DatabaseTable t = mapping.getTableByName(fld.getTableName());
if (t != null && !tables.contains(t)) {
tables.add(t);
}
}
}
}
// add tables from select element set
if (selectElemNames != null) {
for (QueryElement qe : selectElemNames) {
MappingField fld = mapping.getFieldByLocalName(qe.getValue());
if (fld != null) {
DatabaseTable t = mapping.getTableByName(fld.getTableName());
if (t != null && !tables.contains(t)) {
tables.add(t);
}
}
}