mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #12: fix row count always -1 on SQLite, in "copy table" dialog
This commit is contained in:
@ -255,7 +255,7 @@ begin
|
|||||||
nColumns: CellText := _('Columns');
|
nColumns: CellText := _('Columns');
|
||||||
nKeys: CellText := _('Indexes');
|
nKeys: CellText := _('Indexes');
|
||||||
nForeignKeys: CellText := _('Foreign keys');
|
nForeignKeys: CellText := _('Foreign keys');
|
||||||
nData: CellText := f_('Data (%s rows)', [FormatNumber(FDBObj.Rows)]);
|
nData: CellText := f_('Data (%s rows)', [FormatNumber(FDBObj.RowCount(False))]);
|
||||||
else raise Exception.Create(_(SUnhandledNodeIndex));
|
else raise Exception.Create(_(SUnhandledNodeIndex));
|
||||||
end;
|
end;
|
||||||
if Node.Index <> nData then begin
|
if Node.Index <> nData then begin
|
||||||
@ -315,7 +315,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if ChildCount > 0 then
|
if ChildCount > 0 then
|
||||||
Include(InitialStates, ivsHasChildren);
|
Include(InitialStates, ivsHasChildren);
|
||||||
if (ChildCount = 0) or ((Node.Index = nData) and (FDBObj.Rows = 0)) then
|
if (ChildCount = 0) or ((Node.Index = nData) and (FDBObj.RowCount(False) = 0)) then
|
||||||
Node.States := Node.States + [vsDisabled]
|
Node.States := Node.States + [vsDisabled]
|
||||||
else if AppSettings.ReadBool(Option) then
|
else if AppSettings.ReadBool(Option) then
|
||||||
Node.CheckState := csCheckedNormal;
|
Node.CheckState := csCheckedNormal;
|
||||||
|
@ -142,7 +142,7 @@ type
|
|||||||
function QuotedName(AlwaysQuote: Boolean=True; SeparateSegments: Boolean=True): String;
|
function QuotedName(AlwaysQuote: Boolean=True; SeparateSegments: Boolean=True): String;
|
||||||
function QuotedDbAndTableName(AlwaysQuote: Boolean=True): String;
|
function QuotedDbAndTableName(AlwaysQuote: Boolean=True): String;
|
||||||
function QuotedColumn(AlwaysQuote: Boolean=True): String;
|
function QuotedColumn(AlwaysQuote: Boolean=True): String;
|
||||||
function RowCount: Int64;
|
function RowCount(Reload: Boolean): Int64;
|
||||||
function GetCreateCode: String; overload;
|
function GetCreateCode: String; overload;
|
||||||
function GetCreateCode(RemoveAutoInc, RemoveDefiner: Boolean): String; overload;
|
function GetCreateCode(RemoveAutoInc, RemoveDefiner: Boolean): String; overload;
|
||||||
property ObjType: String read GetObjType;
|
property ObjType: String read GetObjType;
|
||||||
@ -8384,9 +8384,12 @@ begin
|
|||||||
Result := Connection.QuoteIdent(Column, AlwaysQuote);
|
Result := Connection.QuoteIdent(Column, AlwaysQuote);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDBObject.RowCount: Int64;
|
function TDBObject.RowCount(Reload: Boolean): Int64;
|
||||||
begin
|
begin
|
||||||
Result := Connection.GetRowCount(Self);
|
if (Rows = -1) or Reload then begin
|
||||||
|
Rows := Connection.GetRowCount(Self);
|
||||||
|
end;
|
||||||
|
Result := Rows;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBObject.Drop;
|
procedure TDBObject.Drop;
|
||||||
|
@ -5455,7 +5455,7 @@ begin
|
|||||||
if (not IsLimited) and (not IsFiltered) then
|
if (not IsLimited) and (not IsFiltered) then
|
||||||
RowsTotal := DataGrid.RootNodeCount // No need to fetch via SHOW TABLE STATUS
|
RowsTotal := DataGrid.RootNodeCount // No need to fetch via SHOW TABLE STATUS
|
||||||
else
|
else
|
||||||
RowsTotal := DBObject.RowCount;
|
RowsTotal := DBObject.RowCount(True);
|
||||||
if RowsTotal > -1 then begin
|
if RowsTotal > -1 then begin
|
||||||
cap := cap + ': ' + FormatNumber(RowsTotal) + ' ' + _('rows total');
|
cap := cap + ': ' + FormatNumber(RowsTotal) + ' ' + _('rows total');
|
||||||
if DBObject.Engine = 'InnoDB' then
|
if DBObject.Engine = 'InnoDB' then
|
||||||
|
Reference in New Issue
Block a user