![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Wed, May 10 2006 5:10 AM | Permanent Link |
"Davide" | hi,
i'm using the dbisam v 4.22(b6) with BCB5. I need to store-work with wideStrings, which field type can i use best?? bytes, blob? in version 4 manual wideString aren't mentioned. Now i'm trying with bytes-type, i can read-write my wideString! But if i connect a DBGrid with wideString support( TntWare) to the dbisam table it dont work correcty.... any suggestion? Davide. |
Wed, May 10 2006 8:47 AM | Permanent Link |
Dan Rootham | Davide,
<< I need to store-work with wideStrings, which field type can i use best?? bytes, blob? >> I don't have experience of BCB, only Delphi 6+7 with DBISAM ver 3 and Tnt Unicode controls. But I have successfully stored and retrieved widestring data in a blob field. We got truncation trying to read byte-by-byte because you often trip over chr(0) as part of a Unicode character. So we defined a packed record which can be read either as two chars or as one widechar (i.e. as a Unicode character). The packed record and the retrieval procedure to load a Tnt memo are shown below. Cheers, Dan Lexicon Software Ltd, Bath, UK type TMyConvert = packed record Case IsWide : Boolean of True : (WChar :WideChar); False : (Chars : Array [0..1] of char); end; procedure TEditorForm.ShowAsianTextInUnicodeControl(DictTable: TDBISAMTable; DictFieldname: string; UnicodeControl: TTntMemo); var CharCount : integer; MyBlob : TBlobField; MemStream : TMemoryStream; WString : WideString; MyConvert : TMyConvert; begin MyBlob := TBlobField(TDBISAMTable(DictTable).FieldByName(DictFieldname)); if (MyBlob.BlobSize > 0) then begin MemStream := TMemoryStream.Create; MyBlob.SaveToStream(MemStream); MemStream.Position := 0; for CharCount := 1 to MemStream.Size do begin if (CharCount mod 2) = 0 then begin MemStream.ReadBuffer(MyConvert.Chars,2); WString := WString + MyConvert.WChar; end; end; UnicodeControl.Text := WString; end else UnicodeControl.Text := ''; end; |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |