Avoid running SHOW TABLE STATUS FROM '' and friends on an empty database name, when trying to determine a column's origin.

This commit is contained in:
Ansgar Becker
2010-09-14 23:24:32 +00:00
parent 9a58fc526b
commit 3865d383da

View File

@@ -2272,12 +2272,14 @@ begin
if Field.table <> Field.org_table then begin
// Probably a VIEW, in which case we rely on the first column's table name.
// TODO: This is unsafe when joining a view with a table/view.
Objects := Connection.GetDBObjects(Connection.DecodeAPIString(Field.db));
for Obj in Objects do begin
if (Obj.Name = Connection.DecodeAPIString(Field.table)) and (Obj.NodeType = lntView) then begin
tbl := Field.table;
break;
// TODO: This is unsafe when joining a view with a table/view.
if Field.db <> '' then begin
Objects := Connection.GetDBObjects(Connection.DecodeAPIString(Field.db));
for Obj in Objects do begin
if (Obj.Name = Connection.DecodeAPIString(Field.table)) and (Obj.NodeType = lntView) then begin
tbl := Field.table;
break;
end;
end;
end;
if tbl <> '' then