- Fix detection of views in a SHOW TABLE STATUS result. Don't rely on the "Comment" field containing the exact string "VIEW", as it can also contain an error message wrt a corrupted view.

- Show this potential message in the "Comment" column of ListTables
This commit is contained in:
Ansgar Becker
2008-03-23 19:31:04 +00:00
parent cbb6d3d220
commit 56abd6f53d
2 changed files with 10 additions and 2 deletions

View File

@ -2181,7 +2181,7 @@ begin
// Engine
ListCaptions.Add('');
// Comment
ListCaptions.Add('');
ListCaptions.Add(FieldContent('Comment'));
// Version
ListCaptions.Add('');
// Row_format

View File

@ -2177,8 +2177,16 @@ end;
// Tell type of db object (table|view) by a given row from a SHOW TABLE STATUS result
function GetDBObjectType( TableStatus: TFields ): Byte;
begin
{**
@see http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html
For views, all the fields displayed by SHOW TABLE STATUS are NULL except
that Name indicates the view name and Comment says view.
@note The "Comment" column can contain different content, normally "VIEW"
but for views which is missing its tables, it says
"Views bla references invalid..."
}
if TableStatus[1].IsNull // Engine column is NULL for views
and (LowerCase( TableStatus.FieldByName('Comment').AsString) = 'view') then
and TableStatus[2].IsNull then
Result := NODETYPE_VIEW
else
Result := NODETYPE_BASETABLE;