mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Remove no longer needed routine for autocalculating row limit: GetCalculatedLimit. The Export SQL dialog now uses a constant number of 5000 rows fetched per step. Also removes the option in the preferences screen for limiting the data amount, which was misleading the user before and only used to limit the export stuff.
This commit is contained in:
@ -58,8 +58,6 @@ const
|
|||||||
DEFAULT_DATALIMITEND = 5000;
|
DEFAULT_DATALIMITEND = 5000;
|
||||||
// how much memory we're aiming to use for the
|
// how much memory we're aiming to use for the
|
||||||
// data grid and it's automatic limit function
|
// data grid and it's automatic limit function
|
||||||
REGNAME_LOADSIZE = 'DataLoadSize';
|
|
||||||
DEFAULT_LOADSIZE = 5*1024*1024;
|
|
||||||
REGNAME_LOGSQLNUM = 'logsqlnum';
|
REGNAME_LOGSQLNUM = 'logsqlnum';
|
||||||
DEFAULT_LOGSQLNUM = 300;
|
DEFAULT_LOGSQLNUM = 300;
|
||||||
REGNAME_LOGSQLWIDTH = 'logsqlwidth';
|
REGNAME_LOGSQLWIDTH = 'logsqlwidth';
|
||||||
|
@ -377,7 +377,6 @@ type
|
|||||||
procedure GridPaintText(Sender: TBaseVirtualTree; const TargetCanvas:
|
procedure GridPaintText(Sender: TBaseVirtualTree; const TargetCanvas:
|
||||||
TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
|
TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
|
||||||
procedure menuDeleteSnippetClick(Sender: TObject);
|
procedure menuDeleteSnippetClick(Sender: TObject);
|
||||||
procedure GetCalculatedLimit(Table: String; out Limit, AllRows: Int64);
|
|
||||||
procedure menuExploreClick(Sender: TObject);
|
procedure menuExploreClick(Sender: TObject);
|
||||||
procedure menuInsertSnippetAtCursorClick(Sender: TObject);
|
procedure menuInsertSnippetAtCursorClick(Sender: TObject);
|
||||||
procedure menuLoadSnippetClick(Sender: TObject);
|
procedure menuLoadSnippetClick(Sender: TObject);
|
||||||
@ -505,8 +504,7 @@ type
|
|||||||
prefConvertHTMLEntities : Boolean;
|
prefConvertHTMLEntities : Boolean;
|
||||||
prefLogsqlnum,
|
prefLogsqlnum,
|
||||||
prefLogSqlWidth,
|
prefLogSqlWidth,
|
||||||
prefDefaultColWidth,
|
prefDefaultColWidth : Integer;
|
||||||
prefLoadSize : Integer;
|
|
||||||
prefCSVSeparator,
|
prefCSVSeparator,
|
||||||
prefCSVEncloser,
|
prefCSVEncloser,
|
||||||
prefCSVTerminator : String[10];
|
prefCSVTerminator : String[10];
|
||||||
@ -868,7 +866,6 @@ begin
|
|||||||
prefCSVTerminator := Mainform.GetRegValue(REGNAME_CSV_TERMINATOR, DEFAULT_CSV_TERMINATOR);
|
prefCSVTerminator := Mainform.GetRegValue(REGNAME_CSV_TERMINATOR, DEFAULT_CSV_TERMINATOR);
|
||||||
prefRememberFilters := Mainform.GetRegValue(REGNAME_REMEMBERFILTERS, DEFAULT_REMEMBERFILTERS);
|
prefRememberFilters := Mainform.GetRegValue(REGNAME_REMEMBERFILTERS, DEFAULT_REMEMBERFILTERS);
|
||||||
prefPreferShowTables := Mainform.GetRegValue(REGNAME_PREFER_SHOWTABLES, DEFAULT_PREFER_SHOWTABLES);
|
prefPreferShowTables := Mainform.GetRegValue(REGNAME_PREFER_SHOWTABLES, DEFAULT_PREFER_SHOWTABLES);
|
||||||
prefLoadSize := Mainform.GetRegValue(REGNAME_LOADSIZE, DEFAULT_LOADSIZE);
|
|
||||||
|
|
||||||
// SQL-Font:
|
// SQL-Font:
|
||||||
fontname := Mainform.GetRegValue(REGNAME_FONTNAME, DEFAULT_FONTNAME);
|
fontname := Mainform.GetRegValue(REGNAME_FONTNAME, DEFAULT_FONTNAME);
|
||||||
@ -3739,45 +3736,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{***
|
|
||||||
Detect average row size and limit the number of rows fetched at
|
|
||||||
once if more than ~ 5 MB of data
|
|
||||||
}
|
|
||||||
procedure TMDIChild.GetCalculatedLimit(Table: String; out Limit, AllRows: Int64);
|
|
||||||
var
|
|
||||||
AvgRowSize : Int64;
|
|
||||||
ds: TDataSet;
|
|
||||||
const
|
|
||||||
// how much overhead this application has per row
|
|
||||||
ROW_SIZE_OVERHEAD : Integer = 1150;
|
|
||||||
// average row size guess for mysql server < 5.0
|
|
||||||
ROW_SIZE_GUESS: Integer = 2048;
|
|
||||||
begin
|
|
||||||
Limit := -1;
|
|
||||||
try
|
|
||||||
ds := GetResults('SHOW TABLE STATUS LIKE ' + esc(Table));
|
|
||||||
if ds = nil then exit;
|
|
||||||
if ds.FieldByName('Avg_row_length').IsNull or ds.FieldByName('Rows').IsNull then begin
|
|
||||||
// Guessing row size and count for views, fixes bug #346
|
|
||||||
AvgRowSize := ROW_SIZE_GUESS + ROW_SIZE_OVERHEAD;
|
|
||||||
AllRows := MaxInt;
|
|
||||||
end else begin
|
|
||||||
AvgRowSize := MakeInt( ds.FieldByName( 'Avg_row_length' ).AsString ) + ROW_SIZE_OVERHEAD;
|
|
||||||
AllRows := MakeInt( ds.FieldByName( 'Rows' ).AsString );
|
|
||||||
end;
|
|
||||||
if AvgRowSize * AllRows > prefLoadSize then
|
|
||||||
begin
|
|
||||||
Limit := Trunc( prefLoadSize / AvgRowSize );
|
|
||||||
if Limit >= AllRows then Limit := -1;
|
|
||||||
end;
|
|
||||||
ds.Close;
|
|
||||||
FreeAndNil(ds);
|
|
||||||
finally
|
|
||||||
debug( 'GetCalculatedLimit: ' + formatnumber(Limit) );
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{**
|
{**
|
||||||
Column selection for datagrid
|
Column selection for datagrid
|
||||||
}
|
}
|
||||||
|
@ -973,12 +973,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{***
|
// Set rows per step limit and detect total row count
|
||||||
Detect average row size and limit the number of rows fetched at
|
// Be sure to do this step before the table is locked!
|
||||||
once if more than ~ 5 MB of data
|
limit := 5000;
|
||||||
Be sure to do this step before the table is locked!
|
RecordCount_all := MakeInt(cwin.GetNamedVar('SHOW TABLE STATUS LIKE '+esc(checkListTables.Items[i]), 'Rows'));
|
||||||
}
|
|
||||||
cwin.GetCalculatedLimit( checkListTables.Items[i], limit, RecordCount_all);
|
|
||||||
|
|
||||||
if RecordCount_all = 0 then begin
|
if RecordCount_all = 0 then begin
|
||||||
if tofile then
|
if tofile then
|
||||||
|
@ -445,13 +445,6 @@ object optionsform: Toptionsform
|
|||||||
Height = 13
|
Height = 13
|
||||||
Caption = 'Maximum column-width in data-grids:'
|
Caption = 'Maximum column-width in data-grids:'
|
||||||
end
|
end
|
||||||
object lblLoadSize: TLabel
|
|
||||||
Left = 8
|
|
||||||
Top = 58
|
|
||||||
Width = 196
|
|
||||||
Height = 13
|
|
||||||
Caption = 'Data size for auto calculating LIMIT [KB]:'
|
|
||||||
end
|
|
||||||
object GroupBox2: TGroupBox
|
object GroupBox2: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 80
|
Top = 80
|
||||||
@ -561,26 +554,6 @@ object optionsform: Toptionsform
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnClick = Modified
|
OnClick = Modified
|
||||||
end
|
end
|
||||||
object editLoadSize: TEdit
|
|
||||||
Left = 219
|
|
||||||
Top = 55
|
|
||||||
Width = 42
|
|
||||||
Height = 21
|
|
||||||
TabOrder = 4
|
|
||||||
Text = '1'
|
|
||||||
end
|
|
||||||
object updownLoadSize: TUpDown
|
|
||||||
Left = 261
|
|
||||||
Top = 55
|
|
||||||
Width = 17
|
|
||||||
Height = 21
|
|
||||||
Associate = editLoadSize
|
|
||||||
Min = 1
|
|
||||||
Max = 32767
|
|
||||||
Position = 1
|
|
||||||
TabOrder = 5
|
|
||||||
Wrap = True
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
object TabSheet5: TTabSheet
|
object TabSheet5: TTabSheet
|
||||||
BorderWidth = 5
|
BorderWidth = 5
|
||||||
|
@ -92,9 +92,6 @@ type
|
|||||||
updownUpdatecheckInterval: TUpDown;
|
updownUpdatecheckInterval: TUpDown;
|
||||||
chkPreferShowTables: TCheckBox;
|
chkPreferShowTables: TCheckBox;
|
||||||
chkUpdateCheckBuilds: TCheckBox;
|
chkUpdateCheckBuilds: TCheckBox;
|
||||||
lblLoadSize: TLabel;
|
|
||||||
editLoadSize: TEdit;
|
|
||||||
updownLoadSize: TUpDown;
|
|
||||||
procedure ButtonCancelClick(Sender: TObject);
|
procedure ButtonCancelClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure Modified(Sender: TObject);
|
procedure Modified(Sender: TObject);
|
||||||
@ -176,7 +173,6 @@ begin
|
|||||||
reg.WriteBool(REGNAME_DO_UPDATECHECK_BUILDS, chkUpdatecheckBuilds.Checked);
|
reg.WriteBool(REGNAME_DO_UPDATECHECK_BUILDS, chkUpdatecheckBuilds.Checked);
|
||||||
reg.WriteInteger(REGNAME_UPDATECHECK_INTERVAL, updownUpdatecheckInterval.Position);
|
reg.WriteInteger(REGNAME_UPDATECHECK_INTERVAL, updownUpdatecheckInterval.Position);
|
||||||
reg.WriteBool(REGNAME_PREFER_SHOWTABLES, chkPreferShowTables.Checked);
|
reg.WriteBool(REGNAME_PREFER_SHOWTABLES, chkPreferShowTables.Checked);
|
||||||
reg.WriteInteger(REGNAME_LOADSIZE, updownLoadSize.Position*SIZE_KB);
|
|
||||||
|
|
||||||
// Clean registry from unwanted WHERE clauses if "Remember WHERE filters" was unchecked
|
// Clean registry from unwanted WHERE clauses if "Remember WHERE filters" was unchecked
|
||||||
if not chkRememberFilters.Checked then begin
|
if not chkRememberFilters.Checked then begin
|
||||||
@ -235,7 +231,6 @@ begin
|
|||||||
cwin.prefCSVTerminator := self.Edit3.text;
|
cwin.prefCSVTerminator := self.Edit3.text;
|
||||||
cwin.prefConvertHTMLEntities := self.CheckBoxConvertHTMLEntities.Checked;
|
cwin.prefConvertHTMLEntities := self.CheckBoxConvertHTMLEntities.Checked;
|
||||||
cwin.prefPreferShowTables := chkPreferShowTables.Checked;
|
cwin.prefPreferShowTables := chkPreferShowTables.Checked;
|
||||||
cwin.prefLoadSize := updownLoadSize.Position * SIZE_KB;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Settings have been applied, send a signal to the user
|
// Settings have been applied, send a signal to the user
|
||||||
@ -284,7 +279,6 @@ begin
|
|||||||
updownUpdatecheckInterval.Position := Mainform.GetRegValue(REGNAME_UPDATECHECK_INTERVAL, DEFAULT_UPDATECHECK_INTERVAL);
|
updownUpdatecheckInterval.Position := Mainform.GetRegValue(REGNAME_UPDATECHECK_INTERVAL, DEFAULT_UPDATECHECK_INTERVAL);
|
||||||
chkUpdatecheckClick(Sender);
|
chkUpdatecheckClick(Sender);
|
||||||
chkPreferShowTables.Checked := Mainform.GetRegValue(REGNAME_PREFER_SHOWTABLES, DEFAULT_PREFER_SHOWTABLES);
|
chkPreferShowTables.Checked := Mainform.GetRegValue(REGNAME_PREFER_SHOWTABLES, DEFAULT_PREFER_SHOWTABLES);
|
||||||
updownLoadSize.Position := Mainform.GetRegValue(REGNAME_LOADSIZE, DEFAULT_LOADSIZE) div SIZE_KB;
|
|
||||||
|
|
||||||
// Default Column-Width in DBGrids:
|
// Default Column-Width in DBGrids:
|
||||||
updownDefaultColWidth.Position := Mainform.GetRegValue(REGNAME_DEFAULTCOLWIDTH, DEFAULT_DEFAULTCOLWIDTH);
|
updownDefaultColWidth.Position := Mainform.GetRegValue(REGNAME_DEFAULTCOLWIDTH, DEFAULT_DEFAULTCOLWIDTH);
|
||||||
|
Reference in New Issue
Block a user