mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Sanitize default component names.
This commit is contained in:
@@ -16,7 +16,7 @@ object loaddataform: Tloaddataform
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object Bevel1: TBevel
|
||||
object bvlBottom: TBevel
|
||||
Left = 0
|
||||
Top = 300
|
||||
Width = 497
|
||||
@@ -24,35 +24,35 @@ object loaddataform: Tloaddataform
|
||||
Align = alBottom
|
||||
Shape = bsTopLine
|
||||
end
|
||||
object Label1: TLabel
|
||||
object lblTable: TLabel
|
||||
Left = 16
|
||||
Top = 64
|
||||
Width = 78
|
||||
Height = 13
|
||||
Caption = 'Import into table:'
|
||||
end
|
||||
object Label2: TLabel
|
||||
object lblFilename: TLabel
|
||||
Left = 208
|
||||
Top = 24
|
||||
Width = 45
|
||||
Height = 13
|
||||
Caption = 'Filename:'
|
||||
end
|
||||
object Label3: TLabel
|
||||
object lblFields: TLabel
|
||||
Left = 208
|
||||
Top = 56
|
||||
Width = 30
|
||||
Height = 13
|
||||
Caption = 'Fields:'
|
||||
end
|
||||
object Label4: TLabel
|
||||
object lblLines: TLabel
|
||||
Left = 208
|
||||
Top = 144
|
||||
Width = 28
|
||||
Height = 13
|
||||
Caption = 'Lines:'
|
||||
end
|
||||
object Label5: TLabel
|
||||
object lblIgnoreLines: TLabel
|
||||
Left = 415
|
||||
Top = 169
|
||||
Width = 25
|
||||
@@ -60,21 +60,21 @@ object loaddataform: Tloaddataform
|
||||
Caption = 'Lines'
|
||||
Enabled = False
|
||||
end
|
||||
object Label6: TLabel
|
||||
object lblColumns: TLabel
|
||||
Left = 16
|
||||
Top = 112
|
||||
Width = 65
|
||||
Height = 13
|
||||
Caption = 'Use Columns:'
|
||||
end
|
||||
object Label7: TLabel
|
||||
object lblDatabase: TLabel
|
||||
Left = 16
|
||||
Top = 16
|
||||
Width = 49
|
||||
Height = 13
|
||||
Caption = 'Database:'
|
||||
end
|
||||
object Label8: TLabel
|
||||
object lblNote: TLabel
|
||||
Left = 208
|
||||
Top = 256
|
||||
Width = 240
|
||||
@@ -84,7 +84,7 @@ object loaddataform: Tloaddataform
|
||||
'ons > 3.22.6. On previous versions you will get an error!'
|
||||
WordWrap = True
|
||||
end
|
||||
object Button1: TButton
|
||||
object btnImport: TButton
|
||||
Left = 328
|
||||
Top = 312
|
||||
Width = 75
|
||||
@@ -93,9 +93,9 @@ object loaddataform: Tloaddataform
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
OnClick = btnImportClick
|
||||
end
|
||||
object Button2: TButton
|
||||
object btnCancel: TButton
|
||||
Left = 408
|
||||
Top = 312
|
||||
Width = 75
|
||||
@@ -104,24 +104,24 @@ object loaddataform: Tloaddataform
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
OnClick = btnCancelClick
|
||||
end
|
||||
object EditFileName: TEdit
|
||||
object editFilename: TEdit
|
||||
Left = 272
|
||||
Top = 24
|
||||
Width = 193
|
||||
Height = 21
|
||||
TabOrder = 2
|
||||
Text = 'EditFileName'
|
||||
OnDblClick = BitBtn1Click
|
||||
Text = 'editFilename'
|
||||
OnDblClick = btnOpenFileClick
|
||||
end
|
||||
object BitBtn1: TBitBtn
|
||||
object btnOpenFile: TBitBtn
|
||||
Left = 464
|
||||
Top = 24
|
||||
Width = 22
|
||||
Height = 22
|
||||
TabOrder = 3
|
||||
OnClick = BitBtn1Click
|
||||
OnClick = btnOpenFileClick
|
||||
Glyph.Data = {
|
||||
F6000000424DF600000000000000760000002800000010000000100000000100
|
||||
0400000000008000000000000000000000001000000010000000000000000000
|
||||
@@ -132,7 +132,7 @@ object loaddataform: Tloaddataform
|
||||
777770FBFBFBFBF0777770BFB000000077777700077777777000777777777777
|
||||
7700777777777077707077777777770007777777777777777777}
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
object chkLowPriority: TCheckBox
|
||||
Left = 272
|
||||
Top = 200
|
||||
Width = 81
|
||||
@@ -140,7 +140,7 @@ object loaddataform: Tloaddataform
|
||||
Caption = 'Low Priority'
|
||||
TabOrder = 4
|
||||
end
|
||||
object TablesComboBox: TComboBox
|
||||
object comboTable: TComboBox
|
||||
Left = 16
|
||||
Top = 80
|
||||
Width = 153
|
||||
@@ -148,18 +148,18 @@ object loaddataform: Tloaddataform
|
||||
Style = csDropDownList
|
||||
ItemHeight = 13
|
||||
TabOrder = 5
|
||||
OnChange = TablesComboBoxChange
|
||||
OnChange = comboTableChange
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
object chkFieldsTerminated: TCheckBox
|
||||
Left = 272
|
||||
Top = 56
|
||||
Width = 97
|
||||
Height = 17
|
||||
Caption = 'terminated by'
|
||||
TabOrder = 6
|
||||
OnClick = CheckBox2Click
|
||||
OnClick = chkFieldsTerminatedClick
|
||||
end
|
||||
object Edit2: TEdit
|
||||
object editFieldTerminator: TEdit
|
||||
Left = 360
|
||||
Top = 56
|
||||
Width = 49
|
||||
@@ -168,16 +168,16 @@ object loaddataform: Tloaddataform
|
||||
TabOrder = 7
|
||||
Text = '\t'
|
||||
end
|
||||
object CheckBox3: TCheckBox
|
||||
object chkFieldsEnclosed: TCheckBox
|
||||
Left = 272
|
||||
Top = 80
|
||||
Width = 97
|
||||
Height = 17
|
||||
Caption = 'enclosed by'
|
||||
TabOrder = 8
|
||||
OnClick = CheckBox3Click
|
||||
OnClick = chkFieldsEnclosedClick
|
||||
end
|
||||
object Edit3: TEdit
|
||||
object editFieldEncloser: TEdit
|
||||
Left = 360
|
||||
Top = 80
|
||||
Width = 49
|
||||
@@ -185,16 +185,16 @@ object loaddataform: Tloaddataform
|
||||
Enabled = False
|
||||
TabOrder = 9
|
||||
end
|
||||
object CheckBox4: TCheckBox
|
||||
object chkFieldsEscaped: TCheckBox
|
||||
Left = 272
|
||||
Top = 104
|
||||
Width = 97
|
||||
Height = 17
|
||||
Caption = 'escaped by'
|
||||
TabOrder = 10
|
||||
OnClick = CheckBox4Click
|
||||
OnClick = chkFieldsEscapedClick
|
||||
end
|
||||
object Edit4: TEdit
|
||||
object editFieldEscaper: TEdit
|
||||
Left = 360
|
||||
Top = 104
|
||||
Width = 49
|
||||
@@ -203,7 +203,7 @@ object loaddataform: Tloaddataform
|
||||
TabOrder = 11
|
||||
Text = '\\'
|
||||
end
|
||||
object CheckBox5: TCheckBox
|
||||
object chkFieldsEnclosedOptionally: TCheckBox
|
||||
Left = 416
|
||||
Top = 80
|
||||
Width = 73
|
||||
@@ -212,16 +212,16 @@ object loaddataform: Tloaddataform
|
||||
Enabled = False
|
||||
TabOrder = 12
|
||||
end
|
||||
object CheckBox6: TCheckBox
|
||||
object chkLinesTerminated: TCheckBox
|
||||
Left = 272
|
||||
Top = 144
|
||||
Width = 89
|
||||
Height = 17
|
||||
Caption = 'terminated by'
|
||||
TabOrder = 13
|
||||
OnClick = CheckBox6Click
|
||||
OnClick = chkLinesTerminatedClick
|
||||
end
|
||||
object Edit5: TEdit
|
||||
object editLineTerminator: TEdit
|
||||
Left = 360
|
||||
Top = 144
|
||||
Width = 49
|
||||
@@ -230,16 +230,16 @@ object loaddataform: Tloaddataform
|
||||
TabOrder = 14
|
||||
Text = '\n'
|
||||
end
|
||||
object CheckBox7: TCheckBox
|
||||
object chkLinesIgnore: TCheckBox
|
||||
Left = 272
|
||||
Top = 168
|
||||
Width = 73
|
||||
Height = 17
|
||||
Caption = 'ignore'
|
||||
TabOrder = 15
|
||||
OnClick = CheckBox7Click
|
||||
OnClick = chkLinesIgnoreClick
|
||||
end
|
||||
object ColumnsCheckListBox: TCheckListBox
|
||||
object chklistColumns: TCheckListBox
|
||||
Left = 16
|
||||
Top = 128
|
||||
Width = 121
|
||||
@@ -247,7 +247,7 @@ object loaddataform: Tloaddataform
|
||||
ItemHeight = 13
|
||||
TabOrder = 16
|
||||
end
|
||||
object DBComboBox: TComboBox
|
||||
object comboDatabase: TComboBox
|
||||
Left = 16
|
||||
Top = 32
|
||||
Width = 153
|
||||
@@ -255,33 +255,33 @@ object loaddataform: Tloaddataform
|
||||
Style = csDropDownList
|
||||
ItemHeight = 13
|
||||
TabOrder = 17
|
||||
OnChange = DBComboBoxChange
|
||||
OnChange = comboDatabaseChange
|
||||
end
|
||||
object CheckBox8: TCheckBox
|
||||
object chkReplace: TCheckBox
|
||||
Left = 272
|
||||
Top = 224
|
||||
Width = 65
|
||||
Height = 17
|
||||
Caption = 'Replace'
|
||||
TabOrder = 18
|
||||
OnClick = CheckBox8Click
|
||||
OnClick = chkReplaceClick
|
||||
end
|
||||
object CheckBox9: TCheckBox
|
||||
object chkIgnore: TCheckBox
|
||||
Left = 360
|
||||
Top = 224
|
||||
Width = 57
|
||||
Height = 17
|
||||
Caption = 'Ignore'
|
||||
TabOrder = 19
|
||||
OnClick = CheckBox9Click
|
||||
OnClick = chkIgnoreClick
|
||||
end
|
||||
object BitBtn2: TBitBtn
|
||||
object btnColUp: TBitBtn
|
||||
Left = 144
|
||||
Top = 178
|
||||
Width = 25
|
||||
Height = 25
|
||||
TabOrder = 21
|
||||
OnClick = BitBtn2Click
|
||||
OnClick = btnColUpClick
|
||||
Glyph.Data = {
|
||||
F6000000424DF600000000000000760000002800000010000000100000000100
|
||||
0400000000008000000000000000000000001000000010000000000000009410
|
||||
@@ -292,13 +292,13 @@ object loaddataform: Tloaddataform
|
||||
AAAAAAAA0987650AAAAAAAAAA09870AAAAAAAAAAAA090AAAAAAAAAAAAAA0AAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA}
|
||||
end
|
||||
object BitBtn3: TBitBtn
|
||||
object btnColDown: TBitBtn
|
||||
Left = 144
|
||||
Top = 202
|
||||
Width = 25
|
||||
Height = 25
|
||||
TabOrder = 20
|
||||
OnClick = BitBtn3Click
|
||||
OnClick = btnColDownClick
|
||||
Glyph.Data = {
|
||||
F6000000424DF600000000000000760000002800000010000000100000000100
|
||||
040000000000800000000000000000000000100000001000000000000000A521
|
||||
@@ -329,7 +329,7 @@ object loaddataform: Tloaddataform
|
||||
Position = 1
|
||||
TabOrder = 23
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
object OpenDialogCSVFile: TOpenDialog
|
||||
DefaultExt = 'csv'
|
||||
Filter =
|
||||
'CSV-Files (*.csv)|*.csv|Textfiles (*.txt)|*.txt|All Files (*.*)|' +
|
||||
|
||||
@@ -14,55 +14,55 @@ uses
|
||||
|
||||
type
|
||||
Tloaddataform = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
EditFileName: TEdit;
|
||||
BitBtn1: TBitBtn;
|
||||
CheckBox1: TCheckBox;
|
||||
Label1: TLabel;
|
||||
TablesComboBox: TComboBox;
|
||||
Label2: TLabel;
|
||||
CheckBox2: TCheckBox;
|
||||
Label3: TLabel;
|
||||
Edit2: TEdit;
|
||||
CheckBox3: TCheckBox;
|
||||
Edit3: TEdit;
|
||||
CheckBox4: TCheckBox;
|
||||
Edit4: TEdit;
|
||||
CheckBox5: TCheckBox;
|
||||
Label4: TLabel;
|
||||
CheckBox6: TCheckBox;
|
||||
Edit5: TEdit;
|
||||
CheckBox7: TCheckBox;
|
||||
Label5: TLabel;
|
||||
Label6: TLabel;
|
||||
ColumnsCheckListBox: TCheckListBox;
|
||||
DBComboBox: TComboBox;
|
||||
Label7: TLabel;
|
||||
OpenDialog1: TOpenDialog;
|
||||
CheckBox8: TCheckBox;
|
||||
CheckBox9: TCheckBox;
|
||||
Label8: TLabel;
|
||||
BitBtn2: TBitBtn;
|
||||
BitBtn3: TBitBtn;
|
||||
bvlBottom: TBevel;
|
||||
btnImport: TButton;
|
||||
btnCancel: TButton;
|
||||
editFilename: TEdit;
|
||||
btnOpenFile: TBitBtn;
|
||||
chkLowPriority: TCheckBox;
|
||||
lblTable: TLabel;
|
||||
comboTable: TComboBox;
|
||||
lblFilename: TLabel;
|
||||
chkFieldsTerminated: TCheckBox;
|
||||
lblFields: TLabel;
|
||||
editFieldTerminator: TEdit;
|
||||
chkFieldsEnclosed: TCheckBox;
|
||||
editFieldEncloser: TEdit;
|
||||
chkFieldsEscaped: TCheckBox;
|
||||
editFieldEscaper: TEdit;
|
||||
chkFieldsEnclosedOptionally: TCheckBox;
|
||||
lblLines: TLabel;
|
||||
chkLinesTerminated: TCheckBox;
|
||||
editLineTerminator: TEdit;
|
||||
chkLinesIgnore: TCheckBox;
|
||||
lblIgnoreLines: TLabel;
|
||||
lblColumns: TLabel;
|
||||
chklistColumns: TCheckListBox;
|
||||
comboDatabase: TComboBox;
|
||||
lblDatabase: TLabel;
|
||||
OpenDialogCSVFile: TOpenDialog;
|
||||
chkReplace: TCheckBox;
|
||||
chkIgnore: TCheckBox;
|
||||
lblNote: TLabel;
|
||||
btnColUp: TBitBtn;
|
||||
btnColDown: TBitBtn;
|
||||
editIgnoreLines: TEdit;
|
||||
updownIgnoreLines: TUpDown;
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure btnCancelClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure DBComboBoxChange(Sender: TObject);
|
||||
procedure TablesComboBoxChange(Sender: TObject);
|
||||
procedure CheckBox2Click(Sender: TObject);
|
||||
procedure CheckBox3Click(Sender: TObject);
|
||||
procedure CheckBox4Click(Sender: TObject);
|
||||
procedure CheckBox6Click(Sender: TObject);
|
||||
procedure CheckBox7Click(Sender: TObject);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure BitBtn1Click(Sender: TObject);
|
||||
procedure CheckBox8Click(Sender: TObject);
|
||||
procedure CheckBox9Click(Sender: TObject);
|
||||
procedure BitBtn2Click(Sender: TObject);
|
||||
procedure BitBtn3Click(Sender: TObject);
|
||||
procedure comboDatabaseChange(Sender: TObject);
|
||||
procedure comboTableChange(Sender: TObject);
|
||||
procedure chkFieldsTerminatedClick(Sender: TObject);
|
||||
procedure chkFieldsEnclosedClick(Sender: TObject);
|
||||
procedure chkFieldsEscapedClick(Sender: TObject);
|
||||
procedure chkLinesTerminatedClick(Sender: TObject);
|
||||
procedure chkLinesIgnoreClick(Sender: TObject);
|
||||
procedure btnImportClick(Sender: TObject);
|
||||
procedure btnOpenFileClick(Sender: TObject);
|
||||
procedure chkReplaceClick(Sender: TObject);
|
||||
procedure chkIgnoreClick(Sender: TObject);
|
||||
procedure btnColUpClick(Sender: TObject);
|
||||
procedure btnColDownClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
@@ -93,7 +93,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.Button2Click(Sender: TObject);
|
||||
procedure Tloaddataform.btnCancelClick(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
end;
|
||||
@@ -104,15 +104,15 @@ var
|
||||
i : Integer;
|
||||
begin
|
||||
// read dbs and Tables from treeview
|
||||
DBComboBox.Items.Clear;
|
||||
comboDatabase.Items.Clear;
|
||||
for i:=0 to Mainform.ChildWin.DBTree.Items.Count-1 do
|
||||
begin
|
||||
tn := Mainform.ChildWin.DBTree.Items[i];
|
||||
if tn.Level = 1 then
|
||||
DBComboBox.Items.Add(tn.Text);
|
||||
comboDatabase.Items.Add(tn.Text);
|
||||
end;
|
||||
|
||||
with DBComboBox do
|
||||
with comboDatabase do
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
if Items[i] = Mainform.ChildWin.ActualDatabase then
|
||||
@@ -121,25 +121,25 @@ begin
|
||||
ItemIndex := 0;
|
||||
end;
|
||||
|
||||
DBComboBoxChange(self);
|
||||
comboDatabaseChange(self);
|
||||
// filename
|
||||
with TRegistry.Create do
|
||||
if OpenKey(REGPATH, true) then
|
||||
EditFileName.Text := ReadString('loadfilename');
|
||||
if EditFileName.Text = '' then
|
||||
EditFileName.Text := ExtractFilePath(paramstr(0)) + 'import.csv';
|
||||
EditFileName.Text := stringreplace(EditFileName.Text, '\', '/', [rfReplaceAll]);
|
||||
editFilename.Text := ReadString('loadfilename');
|
||||
if editFilename.Text = '' then
|
||||
editFilename.Text := ExtractFilePath(paramstr(0)) + 'import.csv';
|
||||
editFilename.Text := stringreplace(editFilename.Text, '\', '/', [rfReplaceAll]);
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.DBComboBoxChange(Sender: TObject);
|
||||
procedure Tloaddataform.comboDatabaseChange(Sender: TObject);
|
||||
var
|
||||
i : Integer;
|
||||
begin
|
||||
// read tables from db
|
||||
TablesComboBox.Items.Clear;
|
||||
TablesComboBox.Items := Mainform.ChildWin.GetCol( 'SHOW TABLES FROM ' + MainForm.mask( DBComboBox.Text ) );
|
||||
with TablesComboBox do
|
||||
comboTable.Items.Clear;
|
||||
comboTable.Items := Mainform.ChildWin.GetCol( 'SHOW TABLES FROM ' + MainForm.mask( comboDatabase.Text ) );
|
||||
with comboTable do
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
if Items[i] = Mainform.ChildWin.ActualTable then
|
||||
@@ -148,66 +148,66 @@ begin
|
||||
ItemIndex := 0;
|
||||
end;
|
||||
|
||||
TablesComboBoxChange(self);
|
||||
comboTableChange(self);
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.TablesComboBoxChange(Sender: TObject);
|
||||
procedure Tloaddataform.comboTableChange(Sender: TObject);
|
||||
var
|
||||
i : Integer;
|
||||
ds : TDataSet;
|
||||
begin
|
||||
// fill columns:
|
||||
ColumnsCheckListBox.Items.Clear;
|
||||
if (DBComboBox.Text <> '') and (TablesComboBox.Text <> '') then begin
|
||||
ds := Mainform.ChildWin.GetResults( 'SHOW FIELDS FROM ' + mainform.mask(DBComboBox.Text) + '.' + mainform.mask(TablesComboBox.Text));
|
||||
chklistColumns.Items.Clear;
|
||||
if (comboDatabase.Text <> '') and (comboTable.Text <> '') then begin
|
||||
ds := Mainform.ChildWin.GetResults( 'SHOW FIELDS FROM ' + mainform.mask(comboDatabase.Text) + '.' + mainform.mask(comboTable.Text));
|
||||
for i:=1 to ds.RecordCount do
|
||||
begin
|
||||
ColumnsCheckListBox.Items.Add(ds.Fields[0].AsString);
|
||||
chklistColumns.Items.Add(ds.Fields[0].AsString);
|
||||
ds.Next;
|
||||
end;
|
||||
end;
|
||||
|
||||
// select all:
|
||||
for i:=0 to ColumnsCheckListBox.Items.Count-1 do
|
||||
ColumnsCheckListBox.checked[i] := true;
|
||||
for i:=0 to chklistColumns.Items.Count-1 do
|
||||
chklistColumns.checked[i] := true;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.CheckBox2Click(Sender: TObject);
|
||||
procedure Tloaddataform.chkFieldsTerminatedClick(Sender: TObject);
|
||||
begin
|
||||
edit2.Enabled := (sender as TCheckBox).checked;
|
||||
editFieldTerminator.Enabled := (sender as TCheckBox).checked;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.CheckBox3Click(Sender: TObject);
|
||||
procedure Tloaddataform.chkFieldsEnclosedClick(Sender: TObject);
|
||||
begin
|
||||
edit3.Enabled := (sender as TCheckBox).checked;
|
||||
checkbox5.Enabled := (sender as TCheckBox).checked;
|
||||
editFieldEncloser.Enabled := (sender as TCheckBox).checked;
|
||||
chkFieldsEnclosedOptionally.Enabled := (sender as TCheckBox).checked;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.CheckBox4Click(Sender: TObject);
|
||||
procedure Tloaddataform.chkFieldsEscapedClick(Sender: TObject);
|
||||
begin
|
||||
edit4.Enabled := (sender as TCheckBox).checked;
|
||||
editFieldEscaper.Enabled := (sender as TCheckBox).checked;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.CheckBox6Click(Sender: TObject);
|
||||
procedure Tloaddataform.chkLinesTerminatedClick(Sender: TObject);
|
||||
begin
|
||||
edit5.Enabled := (sender as TCheckBox).checked;
|
||||
editLineTerminator.Enabled := (sender as TCheckBox).checked;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.CheckBox7Click(Sender: TObject);
|
||||
procedure Tloaddataform.chkLinesIgnoreClick(Sender: TObject);
|
||||
begin
|
||||
updownIgnoreLines.Enabled := (sender as TCheckBox).checked;
|
||||
editIgnoreLines.Enabled := (sender as TCheckBox).checked;
|
||||
Label5.Enabled := (sender as TCheckBox).checked;
|
||||
lblIgnoreLines.Enabled := (sender as TCheckBox).checked;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tloaddataform.Button1Click(Sender: TObject);
|
||||
procedure Tloaddataform.btnImportClick(Sender: TObject);
|
||||
var
|
||||
query : string;
|
||||
col : TStringList;
|
||||
@@ -216,45 +216,45 @@ begin
|
||||
|
||||
with TRegistry.Create do
|
||||
if OpenKey(REGPATH, true) then
|
||||
WriteString('loadfilename', EditFileName.Text);
|
||||
WriteString('loadfilename', editFilename.Text);
|
||||
|
||||
query := 'LOAD DATA ';
|
||||
|
||||
if checkbox1.Checked then
|
||||
if chkLowPriority.Checked then
|
||||
query := query + 'LOW_PRIORITY ';
|
||||
|
||||
query := query + 'LOCAL INFILE ' + esc(EditFileName.Text) + ' ';
|
||||
if checkbox8.Checked then
|
||||
query := query + 'LOCAL INFILE ' + esc(editFilename.Text) + ' ';
|
||||
if chkReplace.Checked then
|
||||
query := query + 'REPLACE '
|
||||
else if checkbox9.Checked then
|
||||
else if chkIgnore.Checked then
|
||||
query := query + 'IGNORE ';
|
||||
query := query + 'INTO TABLE ' + DBComboBox.Text + '.' + TablesComboBox.Text + ' ';
|
||||
query := query + 'INTO TABLE ' + comboDatabase.Text + '.' + comboTable.Text + ' ';
|
||||
|
||||
// Fields:
|
||||
if checkbox2.Checked or checkbox3.Checked or checkbox4.Checked then
|
||||
if chkFieldsTerminated.Checked or chkFieldsEnclosed.Checked or chkFieldsEscaped.Checked then
|
||||
query := query + 'FIELDS ';
|
||||
if checkbox2.Checked then
|
||||
query := query + 'TERMINATED BY ''' + Edit2.Text + ''' ';
|
||||
if checkbox3.Checked then
|
||||
if chkFieldsTerminated.Checked then
|
||||
query := query + 'TERMINATED BY ''' + editFieldTerminator.Text + ''' ';
|
||||
if chkFieldsEnclosed.Checked then
|
||||
begin
|
||||
if checkbox5.Checked then
|
||||
if chkFieldsEnclosedOptionally.Checked then
|
||||
query := query + 'OPTIONALLY ';
|
||||
query := query + 'ENCLOSED BY ''' + Edit3.Text + ''' ';
|
||||
query := query + 'ENCLOSED BY ''' + editFieldEncloser.Text + ''' ';
|
||||
end;
|
||||
if checkbox4.Checked then
|
||||
query := query + 'ESCAPED BY ''' + Edit4.Text + ''' ';
|
||||
if chkFieldsEscaped.Checked then
|
||||
query := query + 'ESCAPED BY ''' + editFieldEscaper.Text + ''' ';
|
||||
|
||||
// Lines:
|
||||
if checkbox6.Checked then
|
||||
query := query + 'LINES TERMINATED BY ''' + Edit5.Text + ''' ';
|
||||
if checkbox7.Checked then
|
||||
if chkLinesTerminated.Checked then
|
||||
query := query + 'LINES TERMINATED BY ''' + editLineTerminator.Text + ''' ';
|
||||
if chkLinesIgnore.Checked then
|
||||
query := query + 'IGNORE ' + inttostr(updownIgnoreLines.Position) + ' LINES ';
|
||||
|
||||
col := TStringList.Create;
|
||||
for i:=0 to ColumnsCheckListBox.Items.Count - 1 do
|
||||
for i:=0 to chklistColumns.Items.Count - 1 do
|
||||
begin
|
||||
if ColumnsCheckListBox.checked[i] then
|
||||
col.Add(ColumnsCheckListBox.Items[i]);
|
||||
if chklistColumns.checked[i] then
|
||||
col.Add(chklistColumns.Items[i]);
|
||||
end;
|
||||
|
||||
// if col.Count < ColumnsCheckListBox.Items.Count then
|
||||
@@ -264,31 +264,31 @@ begin
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure Tloaddataform.BitBtn1Click(Sender: TObject);
|
||||
procedure Tloaddataform.btnOpenFileClick(Sender: TObject);
|
||||
begin
|
||||
if opendialog1.Execute then
|
||||
editfilename.Text := opendialog1.FileName;
|
||||
if OpenDialogCSVFile.Execute then
|
||||
editfilename.Text := OpenDialogCSVFile.FileName;
|
||||
end;
|
||||
|
||||
procedure Tloaddataform.CheckBox8Click(Sender: TObject);
|
||||
procedure Tloaddataform.chkReplaceClick(Sender: TObject);
|
||||
begin
|
||||
if CheckBox8.Checked then
|
||||
CheckBox9.checked := false;
|
||||
if chkReplace.Checked then
|
||||
chkIgnore.checked := false;
|
||||
end;
|
||||
|
||||
procedure Tloaddataform.CheckBox9Click(Sender: TObject);
|
||||
procedure Tloaddataform.chkIgnoreClick(Sender: TObject);
|
||||
begin
|
||||
if CheckBox9.Checked then
|
||||
CheckBox8.checked := false;
|
||||
if chkIgnore.Checked then
|
||||
chkReplace.checked := false;
|
||||
end;
|
||||
|
||||
procedure Tloaddataform.BitBtn2Click(Sender: TObject);
|
||||
procedure Tloaddataform.btnColUpClick(Sender: TObject);
|
||||
var
|
||||
strtemp : String;
|
||||
strchecked : boolean;
|
||||
begin
|
||||
// move item up!
|
||||
with ColumnsCheckListbox do
|
||||
with chklistColumns do
|
||||
if ItemIndex > -1 then begin
|
||||
if ItemIndex > 0 then begin // not first item...
|
||||
strtemp := items[ItemIndex-1];
|
||||
@@ -305,13 +305,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Tloaddataform.BitBtn3Click(Sender: TObject);
|
||||
procedure Tloaddataform.btnColDownClick(Sender: TObject);
|
||||
var
|
||||
strtemp : String;
|
||||
strchecked : boolean;
|
||||
begin
|
||||
// move item down!
|
||||
with ColumnsCheckListbox do
|
||||
with chklistColumns do
|
||||
if ItemIndex > -1 then begin
|
||||
if ItemIndex < items.count-1 then begin // not last item...
|
||||
strtemp := items[ItemIndex+1];
|
||||
|
||||
Reference in New Issue
Block a user