Skip to content
Permalink
Browse files

Issue #703: Sort charset drop down on "Bulk table editor" alphabetica…

…lly, and increase height of drop down scrollbox to 16 items
  • Loading branch information
ansgarbecker committed Dec 14, 2019
1 parent 14f2a23 commit d5968e1efe5af9c931a483231887770de636d5f7
Showing with 9 additions and 15 deletions.
  1. +2 −1 source/dbconnection.pas
  2. +2 −12 source/loaddata.pas
  3. +2 −0 source/tabletools.dfm
  4. +3 −2 source/tabletools.pas
@@ -4231,9 +4231,10 @@ function TDBConnection.GetCharsetList: TStringList;
if Assigned(c) then begin
c.First;
while not c.Eof do begin
Result.Add(c.Col('Description') + ' (' + c.Col('Charset') + ')');
Result.Add(c.Col('Charset') + ': ' + c.Col('Description'));
c.Next;
end;
Result.Sort;
end;
end;

@@ -185,9 +185,8 @@ procedure Tloaddataform.FormClose(Sender: TObject; var Action: TCloseAction);
procedure Tloaddataform.grpParseMethodClick(Sender: TObject);
var
ServerWillParse: Boolean;
FileCharset, Item: String;
FileCharset: String;
v, i: Integer;
CharsetTable: TDBQuery;
begin
ServerWillParse := grpParseMethod.ItemIndex = 0;
comboEncoding.Enabled := ServerWillParse;
@@ -201,16 +200,7 @@ procedure Tloaddataform.grpParseMethodClick(Sender: TObject);
FileCharset := MainForm.GetCharsetByEncoding(FFileEncoding);
if FileCharset.IsEmpty then
FileCharset := 'utf8';
CharsetTable := FConnection.CharsetTable;
CharsetTable.First;
while not CharsetTable.Eof do begin
if IsNotEmpty(CharsetTable.Col(0)) then
Item := CharsetTable.Col(0);
if IsNotEmpty(CharsetTable.Col(1)) then
Item := Item + ': ' + CharsetTable.Col(1);
comboEncoding.Items.Add(Item);
CharsetTable.Next;
end;
comboEncoding.Items := FConnection.CharsetList;

// Preselect file encoding, or utf8 as a fallback
for i:=0 to comboEncoding.Items.Count-1 do begin
@@ -539,6 +539,7 @@ object frmTableTools: TfrmTableTools
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
DropDownCount = 16
Enabled = False
Sorted = True
TabOrder = 4
@@ -578,6 +579,7 @@ object frmTableTools: TfrmTableTools
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
DropDownCount = 16
Enabled = False
TabOrder = 8
end
@@ -1782,6 +1782,7 @@ procedure TfrmTableTools.DoBulkTableEdit(DBObj: TDBObject);
CreateView: String;
rx: TRegExpr;
HasCharsetClause: Boolean;
SelectedCharset: String;
begin
AddResults('SELECT '+esc(DBObj.Database)+' AS '+DBObj.Connection.QuoteIdent('Database')+', ' +
esc(DBObj.Name)+' AS '+DBObj.Connection.QuoteIdent('Table')+', ' +
@@ -1824,8 +1825,8 @@ procedure TfrmTableTools.DoBulkTableEdit(DBObj: TDBObject);
if DBObj.NodeType = lntTable then begin
HasCharsetClause := False;
if chkBulkTableEditCharset.Checked and (comboBulkTableEditCharset.ItemIndex > -1) then begin
MainForm.ActiveConnection.CharsetTable.RecNo := comboBulkTableEditCharset.ItemIndex;
Specs.Add('CONVERT TO CHARSET '+DBObj.Connection.CharsetTable.Col('Charset'));
SelectedCharset := RegExprGetMatch('^(\w+)\b', comboBulkTableEditCharset.Text, 1);
Specs.Add('CONVERT TO CHARSET '+SelectedCharset);
HasCharsetClause := True;
end;
if chkBulkTableEditCollation.Checked and (comboBulkTableEditCollation.ItemIndex > -1) then begin

0 comments on commit d5968e1

Please sign in to comment.
You can’t perform that action at this time.