mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
CSV scanner: fix crash when selected filename cannot be opened
This commit is contained in:
@ -125,6 +125,7 @@ begin
|
|||||||
Screen.Cursor := crHourGlass;
|
Screen.Cursor := crHourGlass;
|
||||||
btnScan.ImageIndex := 150;
|
btnScan.ImageIndex := 150;
|
||||||
btnScan.Enabled := False;
|
btnScan.Enabled := False;
|
||||||
|
btnSave.Enabled := False;
|
||||||
// Parse contents to a TGridRows instance
|
// Parse contents to a TGridRows instance
|
||||||
GridRows := TGridRows.Create(True);
|
GridRows := TGridRows.Create(True);
|
||||||
GridRow := nil;
|
GridRow := nil;
|
||||||
@ -144,6 +145,7 @@ begin
|
|||||||
|
|
||||||
InEncl := False;
|
InEncl := False;
|
||||||
|
|
||||||
|
try
|
||||||
MainForm.ShowStatusMsg(f_('Reading textfile (%s) ...', [FormatByteNumber(TestChunkSize)]));
|
MainForm.ShowStatusMsg(f_('Reading textfile (%s) ...', [FormatByteNumber(TestChunkSize)]));
|
||||||
Encoding := FLoadDataFrm.FileEncoding;
|
Encoding := FLoadDataFrm.FileEncoding;
|
||||||
OpenTextfile(FLoadDataFrm.editFilename.Text, Stream, Encoding);
|
OpenTextfile(FLoadDataFrm.editFilename.Text, Stream, Encoding);
|
||||||
@ -194,7 +196,11 @@ begin
|
|||||||
// Find matching column types for values
|
// Find matching column types for values
|
||||||
Columns := DetectColumnAttributes(GridRows, IgnoreLines);
|
Columns := DetectColumnAttributes(GridRows, IgnoreLines);
|
||||||
SynMemoCreateTable.Text := ComposeCreateStatement(Columns);
|
SynMemoCreateTable.Text := ComposeCreateStatement(Columns);
|
||||||
|
btnSave.Enabled := True;
|
||||||
|
except
|
||||||
|
on E:EFOpenError do
|
||||||
|
ErrorDialog(E.Message);
|
||||||
|
end;
|
||||||
GridRows.Free;
|
GridRows.Free;
|
||||||
|
|
||||||
MainForm.ShowStatusMsg;
|
MainForm.ShowStatusMsg;
|
||||||
|
Reference in New Issue
Block a user