From 3865d383daf8352f986ce679fdaf4b0629b7ef83 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 14 Sep 2010 23:24:32 +0000 Subject: [PATCH] Avoid running SHOW TABLE STATUS FROM '' and friends on an empty database name, when trying to determine a column's origin. --- source/mysql_connection.pas | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/mysql_connection.pas b/source/mysql_connection.pas index 6f43186d..3ca3a699 100644 --- a/source/mysql_connection.pas +++ b/source/mysql_connection.pas @@ -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