Unicode text (memo) field
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
This looks like the problem is not in Tnt controls. We are required a test sample to investigate this issue more detailed. Please send me a complete small sample to demonstrate it including script to create database and object(s) in it. Also specify some additional information:
- exact version of Delphi, C++ Builder or Kylix;
- exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- exact version of MySQL server and MySQL client. You can see it in the Info sheet of TMyConnection Editor;
- exact version of Delphi, C++ Builder or Kylix;
- exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- exact version of MySQL server and MySQL client. You can see it in the Info sheet of TMyConnection Editor;
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
Thank you for your sample. We used it for testing. There is a little inaccuracy in the code we posted before. The code below is working:
Code: Select all
function GetAsWideString(Field: TField): WideString;
var
WideField: IWideStringField;
Blob: TBlob;
begin
if (Field is TMemoField) and (Field.DataSet is TCustomDADataSet) and not Field.IsNull then begin
Blob := TCustomDADataSet(Field.DataSet).GetBlob(Field.FieldName);
if Blob.IsUnicode then
Result := Blob.AsWideString
else
Result := Blob.AsString;
Exit;
end;
if Field.GetInterface(IWideStringField, WideField) then
Result := WideField.AsWideString
else if (Field is TWideStringField{TNT-ALLOW TWideStringField}) then begin
if Field.IsNull then
// This fixes a bug in TWideStringField.GetAsWideString which does not handle Null at all.
Result := ''
else
Result := TWideStringField{TNT-ALLOW TWideStringField}(Field).Value
end else
Result := Field.AsString{TNT-ALLOW AsString};
end;Code: Select all
procedure SetAsWideString(Field: TField; const Value: WideString);
var
WideField: IWideStringField;
Blob: TBlob;
begin
if (Field is TMemoField) and (Field.DataSet is TCustomDADataSet) then begin
Blob := TCustomDADataSet(Field.DataSet).GetBlob(Field.FieldName);
if Blob.IsUnicode then
Blob.AsWideString := Value
else
Blob.AsString := Value;
TBlobField(Field).Modified := True;
Exit;
end;
if Field.GetInterface(IWideStringField, WideField) then
WideField.AsWideString := Value
else if (Field is TWideStringField{TNT-ALLOW TWideStringField}) then
TWideStringField{TNT-ALLOW TWideStringField}(Field).Value := Value
else
Field.AsString{TNT-ALLOW AsString} := Value;
end;-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
hehhe..
CoreLab support is the best!GuzunNicolae wrote:Thanks a lot for your patience!!!!
Finally it worked!!!!!