Code cosmetic: Sanitize NODETYPE_BASETABLE constant from superflous "BASE"

This commit is contained in:
Ansgar Becker
2008-06-14 12:48:04 +00:00
parent e7ec3b9a1d
commit 2ed4507666
7 changed files with 17 additions and 17 deletions

View File

@@ -225,7 +225,7 @@ const
// Node types of Virtual Tree nodes
NODETYPE_DEFAULT = 0;
NODETYPE_BASETABLE = 1;
NODETYPE_TABLE = 1;
NODETYPE_VIEW = 2;
NODETYPE_DB = 3;
NODETYPE_COLUMN = 4;

View File

@@ -1572,7 +1572,7 @@ begin
lblDataTop.Caption := ActiveDatabase + '.' + SelectedTable + ': ';
if GetSelectedNodeType = NODETYPE_BASETABLE then begin
if GetSelectedNodeType = NODETYPE_TABLE then begin
// Get rowcount from table
rows_total := StrToInt64( GetVar( 'SELECT COUNT(*) FROM ' + mask( SelectedTable ), 0 ) );
lblDataTop.Caption := lblDataTop.Caption + FormatNumber( rows_total ) + ' records total';
@@ -1822,10 +1822,10 @@ begin
// Treat tables slightly different than views
case GetDBObjectType( ds.Fields) of
NODETYPE_BASETABLE: // A normal table
NODETYPE_TABLE: // A normal table
begin
VTRowDataListTables[i-1].ImageIndex := ICONINDEX_TABLE;
VTRowDataListTables[i-1].NodeType := NODETYPE_BASETABLE;
VTRowDataListTables[i-1].NodeType := NODETYPE_TABLE;
// Records
if ds.FindField('Rows') <> nil then
ListCaptions.Add( FormatNumber( FieldContent('Rows') ) )
@@ -2160,7 +2160,7 @@ begin
// Check type of first selected node, to en-/disable certain menu items
if NodeSelected then begin
NodeData := ListTables.GetNodeData( SelectedNodes[0] );
tableSelected := NodeData.NodeType = NODETYPE_BASETABLE;
tableSelected := NodeData.NodeType = NODETYPE_TABLE;
ViewSelected := NodeData.NodeType = NODETYPE_VIEW;
end;
@@ -2838,7 +2838,7 @@ var
begin
ObjName := Fields[0].AsString;
case GetDBObjectType(Fields) of
NODETYPE_BASETABLE: ObjType := 'table';
NODETYPE_TABLE: ObjType := 'table';
NODETYPE_VIEW: ObjType := 'view';
else ObjType := 'unknown';
end;
@@ -4024,7 +4024,7 @@ begin
menuAlterDatabase.Hint := STR_NOTSUPPORTED
else
menuAlterDatabase.Hint := 'Rename and/or modify character set of database';
menuTreeAlterTable.Enabled := (L = 2) and (GetSelectedNodeType = NODETYPE_BASETABLE);
menuTreeAlterTable.Enabled := (L = 2) and (GetSelectedNodeType = NODETYPE_TABLE);
Mainform.actEditView.Enabled := (L = 2) and (GetSelectedNodeType = NODETYPE_VIEW);
MainForm.DropTablesAndViews.Enabled := (L = 2);
end;
@@ -6645,7 +6645,7 @@ begin
ds := FetchDbTableList(Databases[Node.Parent.Index]);
ds.RecNo := Node.Index+1;
case GetDBObjectType(ds.Fields) of
NODETYPE_BASETABLE:
NODETYPE_TABLE:
if Kind = ikSelected then
ImageIndex := ICONINDEX_TABLE_HIGHLIGHT
else ImageIndex := ICONINDEX_TABLE;

View File

@@ -2198,7 +2198,7 @@ begin
but for views which is missing its tables, it says
"Views bla references invalid..."
}
Result := NODETYPE_BASETABLE;
Result := NODETYPE_TABLE;
if (TableStatus.Count>=3) // Result from SHOW TABLE STATUS
and TableStatus[1].IsNull // Engine column is NULL for views
and TableStatus[2].IsNull then

View File

@@ -142,7 +142,7 @@ begin
ds := Mainform.ChildWin.FetchDbTableList(comboDatabase.Text);
while not ds.Eof do begin
// Only display tables, skip views etc.
if GetDBObjectType(ds.Fields) = NODETYPE_BASETABLE then begin
if GetDBObjectType(ds.Fields) = NODETYPE_TABLE then begin
comboTable.Items.Add(ds.Fields[0].AsString);
count := comboTable.Items.Count-1;
if (comboDatabase.Text = seldb) and (comboTable.Items[count] = seltable) then

View File

@@ -1101,12 +1101,12 @@ begin
Views := TStringlist.Create;
if Childwin.PageControlMain.ActivePage = Childwin.tabDatabase then begin
// Invoked from one of the various buttons, SheetDatabase is the active page, drop highlighted table(s).
Tables := GetVTCaptions(Childwin.ListTables, True, 0, NODETYPE_BASETABLE);
Tables := GetVTCaptions(Childwin.ListTables, True, 0, NODETYPE_TABLE);
Views := GetVTCaptions(Childwin.ListTables, True, 0, NODETYPE_VIEW);
end else begin
// Invoked from one of the various buttons, drop table selected in tree view.
case Childwin.GetSelectedNodeType of
NODETYPE_BASETABLE: Tables.Add(Childwin.SelectedTable);
NODETYPE_TABLE: Tables.Add(Childwin.SelectedTable);
NODETYPE_VIEW: Views.Add(Childwin.SelectedTable)
end;
end;

View File

@@ -180,7 +180,7 @@ begin
ds := CWin.FetchDbTableList(CWin.Databases[Node.Parent.Index]);
ds.RecNo := Node.Index+1;
case GetDBObjectType(ds.Fields) of
NODETYPE_BASETABLE: ImageIndex := ICONINDEX_TABLE;
NODETYPE_TABLE: ImageIndex := ICONINDEX_TABLE;
NODETYPE_VIEW: ImageIndex := ICONINDEX_VIEW;
end;
end;

View File

@@ -445,7 +445,7 @@ begin
case u.Privileges[i].DBOType of
NODETYPE_DEFAULT: Icon := ICONINDEX_SERVER;
NODETYPE_DB: Icon := ICONINDEX_DB;
NODETYPE_BASETABLE: Icon := ICONINDEX_TABLE;
NODETYPE_TABLE: Icon := ICONINDEX_TABLE;
NODETYPE_VIEW: Icon := ICONINDEX_VIEW;
NODETYPE_COLUMN: Icon := ICONINDEX_FIELD;
end;
@@ -1056,7 +1056,7 @@ begin
TableName := mask(PRIVTABLE_DB);
SetFieldName := '';
end;
NODETYPE_BASETABLE: begin
NODETYPE_TABLE: begin
TableSet := dsTables;
TableName := mask(PRIVTABLE_TABLES);
SetFieldName := 'table_priv';
@@ -1618,7 +1618,7 @@ begin
case FDBOType of
NODETYPE_DEFAULT: Result := Result + 'Server privileges';
NODETYPE_DB: Result := Result + 'Database: ';
NODETYPE_BASETABLE: Result := Result + 'Table: ';
NODETYPE_TABLE: Result := Result + 'Table: ';
NODETYPE_COLUMN: Result := Result + 'Column: ';
end;
Result := Result + GetDBOKey;
@@ -1664,7 +1664,7 @@ begin
DBONames.Add(Fields.FieldByName('Db').AsString);
end;
if Fields.FindField('Table_name') <> nil then begin
DBOType := NODETYPE_BASETABLE;
DBOType := NODETYPE_TABLE;
DBONames.Add(Fields.FieldByName('Table_name').AsString);
end;
if Fields.FindField('Column_name') <> nil then begin