@@ -9678,65 +9678,72 @@ procedure TMainForm.DBtreeGetText(Sender: TBaseVirtualTree; Node:
96789678 Bytes: Int64;
96799679 AllListsCached: Boolean;
96809680begin
9681- DBObj := Sender.GetNodeData(Node);
9682- case Column of
9683- 0: case DBObj.NodeType of
9684- lntNone: CellText := DBObj.Connection.Parameters.SessionPath;
9685- lntDb: CellText := DBObj.Database;
9686- lntGroup: begin
9687- CellText := DBObj.Name;
9688- if Sender.ChildrenInitialized[Node] then
9689- CellText := CellText + ' (' + FormatNumber(Sender.ChildCount[Node]) + ')';
9690- end;
9691- lntTable..lntEvent: try
9692- if (DBObj.Schema <> '') and (DBObj.Connection.Parameters.NetTypeGroup = ngMSSQL) then
9693- CellText := DBObj.Schema + '.' + DBObj.Name
9694- else
9681+ try
9682+ DBObj := Sender.GetNodeData(Node);
9683+ case Column of
9684+ 0: case DBObj.NodeType of
9685+ lntNone: CellText := DBObj.Connection.Parameters.SessionPath;
9686+ lntDb: CellText := DBObj.Database;
9687+ lntGroup: begin
96959688 CellText := DBObj.Name;
9696- except
9697- CellText := DBObj.Name;
9689+ if Sender.ChildrenInitialized[Node] then
9690+ CellText := CellText + ' (' + FormatNumber(Sender.ChildCount[Node]) + ')';
9691+ end;
9692+ lntTable..lntEvent: try
9693+ if (DBObj.Schema <> '') and (DBObj.Connection.Parameters.NetTypeGroup = ngMSSQL) then
9694+ CellText := DBObj.Schema + '.' + DBObj.Name
9695+ else
9696+ CellText := DBObj.Name;
9697+ except
9698+ CellText := DBObj.Name;
9699+ end;
9700+ lntColumn: CellText := DBObj.Column;
96989701 end;
9699- lntColumn: CellText := DBObj.Column;
9700- end;
9701- 1: if DBObj.Connection.Active then case DBObj.NodeType of
9702- // Calculate and display the sum of all table sizes in ALL dbs if all table lists are cached
9703- lntNone: begin
9704- AllListsCached := true;
9705- for i:=0 to DBObj.Connection.AllDatabases.Count-1 do begin
9706- if not DBObj.Connection.DbObjectsCached(DBObj.Connection.AllDatabases[i]) then begin
9707- AllListsCached := false;
9708- break;
9709- end;
9710- end;
9711- // Will be also set to a negative value by GetTableSize and results of SHOW TABLES
9712- Bytes := -1;
9713- if AllListsCached then begin
9714- Bytes := 0;
9702+ 1: if DBObj.Connection.Active then case DBObj.NodeType of
9703+ // Calculate and display the sum of all table sizes in ALL dbs if all table lists are cached
9704+ lntNone: begin
9705+ AllListsCached := true;
97159706 for i:=0 to DBObj.Connection.AllDatabases.Count-1 do begin
9716- DBObjects := DBObj.Connection.GetDBObjects(DBObj.Connection.AllDatabases[i]);
9717- Inc(Bytes, DBObjects.DataSize);
9707+ if not DBObj.Connection.DbObjectsCached(DBObj.Connection.AllDatabases[i]) then begin
9708+ AllListsCached := false;
9709+ break;
9710+ end;
97189711 end;
9712+ // Will be also set to a negative value by GetTableSize and results of SHOW TABLES
9713+ Bytes := -1;
9714+ if AllListsCached then begin
9715+ Bytes := 0;
9716+ for i:=0 to DBObj.Connection.AllDatabases.Count-1 do begin
9717+ DBObjects := DBObj.Connection.GetDBObjects(DBObj.Connection.AllDatabases[i]);
9718+ Inc(Bytes, DBObjects.DataSize);
9719+ end;
9720+ end;
9721+ if Bytes >= 0 then CellText := FormatByteNumber(Bytes)
9722+ else CellText := '';
97199723 end;
9720- if Bytes >= 0 then CellText := FormatByteNumber(Bytes)
9721- else CellText := '';
9722- end;
9723- // Calculate and display the sum of all table sizes in ONE db, if the list is already cached.
9724- lntDb: begin
9725- if not DBObj.Connection.DbObjectsCached(DBObj.Database) then
9726- CellText := ''
9727- else begin
9728- DBObjects := DBObj.Connection.GetDBObjects(DBObj.Database);
9729- CellText := FormatByteNumber(DBObjects.DataSize);
9724+ // Calculate and display the sum of all table sizes in ONE db, if the list is already cached.
9725+ lntDb: begin
9726+ if not DBObj.Connection.DbObjectsCached(DBObj.Database) then
9727+ CellText := ''
9728+ else begin
9729+ DBObjects := DBObj.Connection.GetDBObjects(DBObj.Database);
9730+ CellText := FormatByteNumber(DBObjects.DataSize);
9731+ end;
97309732 end;
9731- end;
9732- lntTable: begin
9733- if DBObj.Size >= 0 then
9734- CellText := FormatByteNumber(DBObj.Size)
9735- else
9736- CellText := '';
9737- end
9738- else CellText := ''; // Applies for views/procs/... which have no size
9739- end;
9733+ lntTable: begin
9734+ if DBObj.Size >= 0 then
9735+ CellText := FormatByteNumber(DBObj.Size)
9736+ else
9737+ CellText := '';
9738+ end
9739+ else CellText := ''; // Applies for views/procs/... which have no size
9740+ end;
9741+ end;
9742+ except
9743+ // Uploaded crash reports show multiple different situations with an AV,
9744+ // some of them in conjunction with a killed query.
9745+ on E:EAccessViolation do
9746+ CellText := '';
97409747 end;
97419748end;
97429749
0 commit comments