mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 01:56:36 +08:00
Use cached result of SHOW CHARSET in one more place.
This commit is contained in:
@ -68,7 +68,6 @@ type
|
|||||||
procedure btnColDownClick(Sender: TObject);
|
procedure btnColDownClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
dsCharsets: TMySQLQuery;
|
|
||||||
public
|
public
|
||||||
{ Public declarations }
|
{ Public declarations }
|
||||||
end;
|
end;
|
||||||
@ -142,6 +141,7 @@ var
|
|||||||
seldb, seltable, dbcreate: WideString;
|
seldb, seltable, dbcreate: WideString;
|
||||||
rx: TRegExpr;
|
rx: TRegExpr;
|
||||||
DefCharset: String;
|
DefCharset: String;
|
||||||
|
CharsetTable: TMySQLQuery;
|
||||||
begin
|
begin
|
||||||
// read tables from db
|
// read tables from db
|
||||||
comboTable.Items.Clear;
|
comboTable.Items.Clear;
|
||||||
@ -166,8 +166,6 @@ begin
|
|||||||
comboCharset.Clear;
|
comboCharset.Clear;
|
||||||
v := Mainform.Connection.ServerVersionInt;
|
v := Mainform.Connection.ServerVersionInt;
|
||||||
if ((v >= 50038) and (v < 50100)) or (v >= 50117) then begin
|
if ((v >= 50038) and (v < 50100)) or (v >= 50117) then begin
|
||||||
if dsCharsets = nil then
|
|
||||||
dsCharsets := Mainform.Connection.GetResults('SHOW CHARSET');
|
|
||||||
comboCharset.Enabled := True;
|
comboCharset.Enabled := True;
|
||||||
// Detect db charset
|
// Detect db charset
|
||||||
DefCharset := 'Let server/database decide';
|
DefCharset := 'Let server/database decide';
|
||||||
@ -178,16 +176,17 @@ begin
|
|||||||
if rx.Exec(dbcreate) then
|
if rx.Exec(dbcreate) then
|
||||||
DefCharset := DefCharset + ' ('+rx.Match[1]+')';
|
DefCharset := DefCharset + ' ('+rx.Match[1]+')';
|
||||||
comboCharset.Items.Add(DefCharset);
|
comboCharset.Items.Add(DefCharset);
|
||||||
dsCharsets.First;
|
CharsetTable := Mainform.Connection.CharsetTable;
|
||||||
while not dsCharsets.Eof do begin
|
CharsetTable.First;
|
||||||
comboCharset.Items.Add(dsCharsets.Col(1) + ' ('+dsCharsets.Col(0)+')');
|
while not CharsetTable.Eof do begin
|
||||||
if dsCharsets.Col(0) = 'utf8' then begin
|
comboCharset.Items.Add(CharsetTable.Col(1) + ' ('+CharsetTable.Col(0)+')');
|
||||||
|
if CharsetTable.Col(0) = 'utf8' then begin
|
||||||
i := comboCharset.Items.Count-1;
|
i := comboCharset.Items.Count-1;
|
||||||
comboCharset.Items[i] := comboCharset.Items[i] + ' - '+APPNAME+' output';
|
comboCharset.Items[i] := comboCharset.Items[i] + ' - '+APPNAME+' output';
|
||||||
if selCharsetIndex = -1 then
|
if selCharsetIndex = -1 then
|
||||||
selCharsetIndex := i;
|
selCharsetIndex := i;
|
||||||
end;
|
end;
|
||||||
dsCharsets.Next;
|
CharsetTable.Next;
|
||||||
end;
|
end;
|
||||||
comboCharset.ItemIndex := selCharsetIndex;
|
comboCharset.ItemIndex := selCharsetIndex;
|
||||||
end else begin
|
end else begin
|
||||||
@ -256,8 +255,8 @@ begin
|
|||||||
query := query + 'INTO TABLE ' + Mainform.Mask(comboDatabase.Text) + '.' + Mainform.Mask(comboTable.Text) + ' ';
|
query := query + 'INTO TABLE ' + Mainform.Mask(comboDatabase.Text) + '.' + Mainform.Mask(comboTable.Text) + ' ';
|
||||||
|
|
||||||
if comboCharset.ItemIndex > 0 then begin
|
if comboCharset.ItemIndex > 0 then begin
|
||||||
dsCharsets.RecNo := comboCharset.ItemIndex-1;
|
Mainform.Connection.CharsetTable.RecNo := comboCharset.ItemIndex-1;
|
||||||
query := query + 'CHARACTER SET '+dsCharsets.Col(0)+' ';
|
query := query + 'CHARACTER SET '+Mainform.Connection.CharsetTable.Col(0)+' ';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Fields:
|
// Fields:
|
||||||
|
Reference in New Issue
Block a user