Try to fix issue #1188: weird values in collation pulldown inside the text editor. Could it be that TField.AsString is broken if this heals the problem.

This commit is contained in:
Ansgar Becker
2009-06-05 20:44:39 +00:00
parent edcd544953
commit 6576461b9e
3 changed files with 8 additions and 8 deletions

View File

@ -860,7 +860,7 @@ type
function GetRegKeyTable: String; function GetRegKeyTable: String;
procedure SaveListSetup( List: TVirtualStringTree ); procedure SaveListSetup( List: TVirtualStringTree );
procedure RestoreListSetup( List: TVirtualStringTree ); procedure RestoreListSetup( List: TVirtualStringTree );
function GetCollations(Items: TStrings = nil): TDataset; function GetCollations(Items: TWideStrings = nil): TDataset;
procedure SetEditorTabCaption(Editor: TFrame; ObjName: WideString); procedure SetEditorTabCaption(Editor: TFrame; ObjName: WideString);
end; end;
@ -8842,7 +8842,7 @@ begin
end; end;
function TMainform.GetCollations(Items: TStrings = nil): TDataset; function TMainform.GetCollations(Items: TWideStrings = nil): TDataset;
begin begin
// Return cached collation list, used in several places, e.g. table editor // Return cached collation list, used in several places, e.g. table editor
if (dsCollations = nil) or (dsCollations.State = dsInactive) then if (dsCollations = nil) or (dsCollations.State = dsInactive) then
@ -8851,7 +8851,7 @@ begin
dsCollations.First; dsCollations.First;
if Assigned(Items) then begin if Assigned(Items) then begin
while not dsCollations.Eof do begin while not dsCollations.Eof do begin
Items.Add(dsCollations.FieldByName('Collation').AsString); Items.Add(dsCollations.FieldByName('Collation').AsWideString);
dsCollations.Next; dsCollations.Next;
end; end;
dsCollations.First; dsCollations.First;

View File

@ -347,7 +347,7 @@ object frmTableEditor: TfrmTableEditor
TabOrder = 0 TabOrder = 0
OnChange = editNumEditChange OnChange = editNumEditChange
end end
object comboCollation: TComboBox object comboCollation: TTntComboBox
Left = 354 Left = 354
Top = 3 Top = 3
Width = 119 Width = 119

View File

@ -35,7 +35,7 @@ type
memoUnionTables: TTntMemo; memoUnionTables: TTntMemo;
comboInsertMethod: TComboBox; comboInsertMethod: TComboBox;
lblCollation: TLabel; lblCollation: TLabel;
comboCollation: TComboBox; comboCollation: TTNTComboBox;
lblEngine: TLabel; lblEngine: TLabel;
comboEngine: TComboBox; comboEngine: TComboBox;
treeIndexes: TVirtualStringTree; treeIndexes: TVirtualStringTree;
@ -259,7 +259,7 @@ begin
engine := ds.FieldByName(DBO_TYPE).AsString; engine := ds.FieldByName(DBO_TYPE).AsString;
comboEngine.ItemIndex := comboEngine.Items.IndexOf(engine); comboEngine.ItemIndex := comboEngine.Items.IndexOf(engine);
if ds.FindField(DBO_COLLATION) <> nil then if ds.FindField(DBO_COLLATION) <> nil then
comboCollation.ItemIndex := comboCollation.Items.IndexOf(ds.FieldByName(DBO_COLLATION).AsString); comboCollation.ItemIndex := comboCollation.Items.IndexOf(ds.FieldByName(DBO_COLLATION).AsWideString);
editAutoInc.Text := ds.FieldByName(DBO_AUTOINC).AsString; editAutoInc.Text := ds.FieldByName(DBO_AUTOINC).AsString;
editAvgRowLen.Text := ds.FieldByName(DBO_AVGROWLEN).AsString; editAvgRowLen.Text := ds.FieldByName(DBO_AVGROWLEN).AsString;
comboRowFormat.ItemIndex := comboRowFormat.Items.IndexOf(ds.FieldByName(DBO_ROWFORMAT).AsString); comboRowFormat.ItemIndex := comboRowFormat.Items.IndexOf(ds.FieldByName(DBO_ROWFORMAT).AsString);
@ -448,7 +448,7 @@ begin
ds := Mainform.GetCollations; ds := Mainform.GetCollations;
while not ds.Eof do begin while not ds.Eof do begin
if ds.FieldByName('Collation').AsWideString = comboCollation.Text then begin if ds.FieldByName('Collation').AsWideString = comboCollation.Text then begin
Specs.Add('CONVERT TO CHARSET '+ds.FieldByName('Charset').AsString); Specs.Add('CONVERT TO CHARSET '+ds.FieldByName('Charset').AsWideString);
break; break;
end; end;
ds.Next; ds.Next;
@ -994,7 +994,7 @@ begin
8: begin // Collation pulldown 8: begin // Collation pulldown
EnumEditor := TEnumEditorLink.Create; EnumEditor := TEnumEditorLink.Create;
EnumEditor.ValueList := TWideStringList.Create; EnumEditor.ValueList := TWideStringList.Create;
Mainform.GetCollations(TStrings(EnumEditor.ValueList)); Mainform.GetCollations(EnumEditor.ValueList);
EditLink := EnumEditor; EditLink := EnumEditor;
end; end;
6: begin 6: begin