mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Fix crash when scanning CSV file with more values in data than in header line. Closes #1698
This commit is contained in:
@@ -5,7 +5,8 @@ interface
|
||||
uses
|
||||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, SynEdit, SynMemo, extra_controls, apphelpers,
|
||||
loaddata, dbconnection, Vcl.ExtCtrls, gnugettext, dbstructures, System.Math, SynRegExpr, System.IOUtils;
|
||||
loaddata, dbconnection, Vcl.ExtCtrls, gnugettext, dbstructures, System.Math, SynRegExpr, System.IOUtils,
|
||||
System.StrUtils;
|
||||
|
||||
type
|
||||
TfrmCsvDetector = class(TExtForm)
|
||||
@@ -208,7 +209,7 @@ function TfrmCsvDetector.DetectColumnAttributes(Rows: TGridRows; IgnoreLines: In
|
||||
var
|
||||
Row: TGridRow;
|
||||
Value: TGridValue;
|
||||
Col: TTableColumn;
|
||||
Col, UnknownColumn: TTableColumn;
|
||||
i, j, k: Integer;
|
||||
UnknownTypeYet, IsInteger, IsFloat, IsDate, IsDatetime, IsText: Boolean;
|
||||
ValueSize, TypeSize: Int64;
|
||||
@@ -237,11 +238,15 @@ begin
|
||||
Break;
|
||||
end;
|
||||
|
||||
UnknownColumn := TTableColumn.Create(FConnection);
|
||||
for i:=IgnoreLines to Rows.Count-1 do begin
|
||||
MainForm.ProgressStep;
|
||||
for j:=0 to Rows[i].Count-1 do begin
|
||||
Value := Rows[i][j];
|
||||
Col := Result[j];
|
||||
if j >= Result.Count then
|
||||
Col := UnknownColumn
|
||||
else
|
||||
Col := Result[j];
|
||||
|
||||
// Detect data type of current value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user